@sankhyalabs/sankhyablocks 1.1.20 → 1.1.23

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.
@@ -436,6 +436,7 @@ var Action;
436
436
  Action["DATA_LOADED"] = "dataLoaded";
437
437
  Action["SAVING_DATA"] = "savingData";
438
438
  Action["DATA_SAVED"] = "dataSaved";
439
+ Action["REMOVING_RECORDS"] = "removingRecords";
439
440
  Action["RECORDS_REMOVED"] = "recordsRemoved";
440
441
  Action["RECORDS_ADDED"] = "recordsAdded";
441
442
  Action["RECORDS_COPIED"] = "recordsCopied";
@@ -600,7 +601,11 @@ class RemovedRecordsReducerImpl {
600
601
  reduce(_stateManager, currentState, action) {
601
602
  switch (action.type) {
602
603
  case Action.RECORDS_REMOVED:
603
- return (currentState || []).concat(action.payload);
604
+ const { records, buffered } = action.payload;
605
+ if (buffered) {
606
+ return (currentState || []).concat(records);
607
+ }
608
+ return currentState;
604
609
  case Action.EDITION_CANCELED:
605
610
  case Action.DATA_SAVED:
606
611
  return undefined;
@@ -621,6 +626,12 @@ class RecordsReducerImpl {
621
626
  switch (action.type) {
622
627
  case Action.DATA_LOADED:
623
628
  return action.payload;
629
+ case Action.RECORDS_REMOVED:
630
+ const { records, buffered } = action.payload;
631
+ if (!buffered) {
632
+ return currentState.filter(r => !records.includes(r.__record__id__));
633
+ }
634
+ return currentState;
624
635
  case Action.DATA_SAVED:
625
636
  const recordsMap = new Map();
626
637
  const currentRecords = getRecords(stateManager);
@@ -794,7 +805,7 @@ class SelectionReducerImpl {
794
805
  case Action.DATA_SAVED:
795
806
  return updateSavedIds(stateManager, action.payload.records);
796
807
  case Action.RECORDS_REMOVED:
797
- const removed = action.payload;
808
+ const removed = action.payload.records;
798
809
  if (currentState && removed) {
799
810
  return currentState.filter(recordId => !removed.includes(recordId));
800
811
  }
@@ -984,6 +995,36 @@ class DataUnit {
984
995
  return Promise.resolve();
985
996
  });
986
997
  }
998
+ removeSelectedRecords(buffered = false) {
999
+ return __awaiter(this, void 0, void 0, function* () {
1000
+ const selection = getSelection(this._stateManager);
1001
+ if (selection) {
1002
+ return this.removeRecords(selection, buffered);
1003
+ }
1004
+ return Promise.resolve(selection);
1005
+ });
1006
+ }
1007
+ removeRecords(records, buffered = false) {
1008
+ return __awaiter(this, void 0, void 0, function* () {
1009
+ if (records) {
1010
+ if (buffered || !this.removeLoader) {
1011
+ this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: true });
1012
+ }
1013
+ else {
1014
+ this.dispatchAction(Action.REMOVING_RECORDS);
1015
+ return new Promise((resolve, fail) => {
1016
+ if (this.removeLoader) {
1017
+ this.removeLoader(this, records).then(records => {
1018
+ this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: false });
1019
+ resolve(records);
1020
+ }).catch(error => fail(error));
1021
+ }
1022
+ });
1023
+ }
1024
+ }
1025
+ return Promise.resolve(records);
1026
+ });
1027
+ }
987
1028
  // API
988
1029
  valueFromString(fieldName, value) {
989
1030
  const descriptor = this.getField(fieldName);
@@ -1023,12 +1064,6 @@ class DataUnit {
1023
1064
  this.dispatchAction(Action.RECORDS_COPIED, prepareAddedRecordId(this._stateManager, selectedRecords));
1024
1065
  }
1025
1066
  }
1026
- removeSelectedRecords() {
1027
- const selection = getSelection(this._stateManager);
1028
- if (selection) {
1029
- this.dispatchAction(Action.RECORDS_REMOVED, selection);
1030
- }
1031
- }
1032
1067
  getFieldValue(fieldName) {
1033
1068
  return getFieldValue(this._stateManager, fieldName);
1034
1069
  }
@@ -1170,10 +1205,10 @@ var UserInterface;
1170
1205
 
1171
1206
  class ApplicationContext {
1172
1207
  static getContextValue(key) {
1173
- return ApplicationContext.getCtx()[key].deref();
1208
+ return ApplicationContext.getCtx()[key];
1174
1209
  }
1175
1210
  static setContextValue(key, value) {
1176
- ApplicationContext.getCtx()[key] = new WeakRef(value);
1211
+ ApplicationContext.getCtx()[key] = value;
1177
1212
  }
1178
1213
  static getCtx() {
1179
1214
  let ctx = window.___snkcore___ctx___;
@@ -7549,6 +7584,7 @@ class DataUnitFetcher {
7549
7584
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
7550
7585
  dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
7551
7586
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
7587
+ dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
7552
7588
  return dataUnit;
7553
7589
  }
7554
7590
  loadMetadata(dataUnit) {
@@ -7608,10 +7644,7 @@ class DataUnitFetcher {
7608
7644
  const changes = duChanges.map((change) => {
7609
7645
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
7610
7646
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
7611
- if (value) {
7612
- value = value.toString();
7613
- }
7614
- return { fieldName, value };
7647
+ return { fieldName, value: this.formatValueToServer(value) };
7615
7648
  });
7616
7649
  return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
7617
7650
  });
@@ -7640,6 +7673,39 @@ class DataUnitFetcher {
7640
7673
  });
7641
7674
  });
7642
7675
  }
7676
+ formatValueToServer(value) {
7677
+ if (value === undefined)
7678
+ return value;
7679
+ try {
7680
+ if (value instanceof Date) {
7681
+ return value.toString();
7682
+ }
7683
+ //Any others objects
7684
+ value = JSON.stringify(value);
7685
+ }
7686
+ catch (_a) {
7687
+ value = value.toString();
7688
+ }
7689
+ return value;
7690
+ }
7691
+ removeRecords(dataUnit, recordIds) {
7692
+ const changes = recordIds.map((recordId) => {
7693
+ return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
7694
+ });
7695
+ return new Promise((resolve, reject) => {
7696
+ HttpFetcher.get()
7697
+ .callGraphQL({
7698
+ values: { changes: changes },
7699
+ query: this.templateByQuery.get("saveData"),
7700
+ })
7701
+ .then((_resp) => {
7702
+ resolve(recordIds);
7703
+ })
7704
+ .catch((error) => {
7705
+ reject(error);
7706
+ });
7707
+ });
7708
+ }
7643
7709
  }
7644
7710
 
7645
7711
  class UrlUtils {
@@ -1,4 +1,4 @@
1
- import { DataUnit, } from "@sankhyalabs/core";
1
+ import { DataUnit, ChangeOperation, } from "@sankhyalabs/core";
2
2
  import { HttpFetcher } from "../DataFetcher";
3
3
  import { gql } from "graphql-request";
4
4
  export default class DataUnitFetcher {
@@ -63,6 +63,7 @@ export default class DataUnitFetcher {
63
63
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
64
64
  dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
65
65
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
66
+ dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
66
67
  return dataUnit;
67
68
  }
68
69
  loadMetadata(dataUnit) {
@@ -122,10 +123,7 @@ export default class DataUnitFetcher {
122
123
  const changes = duChanges.map((change) => {
123
124
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
124
125
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
125
- if (value) {
126
- value = value.toString();
127
- }
128
- return { fieldName, value };
126
+ return { fieldName, value: this.formatValueToServer(value) };
129
127
  });
130
128
  return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
131
129
  });
@@ -154,4 +152,37 @@ export default class DataUnitFetcher {
154
152
  });
155
153
  });
156
154
  }
155
+ formatValueToServer(value) {
156
+ if (value === undefined)
157
+ return value;
158
+ try {
159
+ if (value instanceof Date) {
160
+ return value.toString();
161
+ }
162
+ //Any others objects
163
+ value = JSON.stringify(value);
164
+ }
165
+ catch (_a) {
166
+ value = value.toString();
167
+ }
168
+ return value;
169
+ }
170
+ removeRecords(dataUnit, recordIds) {
171
+ const changes = recordIds.map((recordId) => {
172
+ return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
173
+ });
174
+ return new Promise((resolve, reject) => {
175
+ HttpFetcher.get()
176
+ .callGraphQL({
177
+ values: { changes: changes },
178
+ query: this.templateByQuery.get("saveData"),
179
+ })
180
+ .then((_resp) => {
181
+ resolve(recordIds);
182
+ })
183
+ .catch((error) => {
184
+ reject(error);
185
+ });
186
+ });
187
+ }
157
188
  }
@@ -432,6 +432,7 @@ var Action;
432
432
  Action["DATA_LOADED"] = "dataLoaded";
433
433
  Action["SAVING_DATA"] = "savingData";
434
434
  Action["DATA_SAVED"] = "dataSaved";
435
+ Action["REMOVING_RECORDS"] = "removingRecords";
435
436
  Action["RECORDS_REMOVED"] = "recordsRemoved";
436
437
  Action["RECORDS_ADDED"] = "recordsAdded";
437
438
  Action["RECORDS_COPIED"] = "recordsCopied";
@@ -596,7 +597,11 @@ class RemovedRecordsReducerImpl {
596
597
  reduce(_stateManager, currentState, action) {
597
598
  switch (action.type) {
598
599
  case Action.RECORDS_REMOVED:
599
- return (currentState || []).concat(action.payload);
600
+ const { records, buffered } = action.payload;
601
+ if (buffered) {
602
+ return (currentState || []).concat(records);
603
+ }
604
+ return currentState;
600
605
  case Action.EDITION_CANCELED:
601
606
  case Action.DATA_SAVED:
602
607
  return undefined;
@@ -617,6 +622,12 @@ class RecordsReducerImpl {
617
622
  switch (action.type) {
618
623
  case Action.DATA_LOADED:
619
624
  return action.payload;
625
+ case Action.RECORDS_REMOVED:
626
+ const { records, buffered } = action.payload;
627
+ if (!buffered) {
628
+ return currentState.filter(r => !records.includes(r.__record__id__));
629
+ }
630
+ return currentState;
620
631
  case Action.DATA_SAVED:
621
632
  const recordsMap = new Map();
622
633
  const currentRecords = getRecords(stateManager);
@@ -790,7 +801,7 @@ class SelectionReducerImpl {
790
801
  case Action.DATA_SAVED:
791
802
  return updateSavedIds(stateManager, action.payload.records);
792
803
  case Action.RECORDS_REMOVED:
793
- const removed = action.payload;
804
+ const removed = action.payload.records;
794
805
  if (currentState && removed) {
795
806
  return currentState.filter(recordId => !removed.includes(recordId));
796
807
  }
@@ -980,6 +991,36 @@ class DataUnit {
980
991
  return Promise.resolve();
981
992
  });
982
993
  }
994
+ removeSelectedRecords(buffered = false) {
995
+ return __awaiter(this, void 0, void 0, function* () {
996
+ const selection = getSelection(this._stateManager);
997
+ if (selection) {
998
+ return this.removeRecords(selection, buffered);
999
+ }
1000
+ return Promise.resolve(selection);
1001
+ });
1002
+ }
1003
+ removeRecords(records, buffered = false) {
1004
+ return __awaiter(this, void 0, void 0, function* () {
1005
+ if (records) {
1006
+ if (buffered || !this.removeLoader) {
1007
+ this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: true });
1008
+ }
1009
+ else {
1010
+ this.dispatchAction(Action.REMOVING_RECORDS);
1011
+ return new Promise((resolve, fail) => {
1012
+ if (this.removeLoader) {
1013
+ this.removeLoader(this, records).then(records => {
1014
+ this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: false });
1015
+ resolve(records);
1016
+ }).catch(error => fail(error));
1017
+ }
1018
+ });
1019
+ }
1020
+ }
1021
+ return Promise.resolve(records);
1022
+ });
1023
+ }
983
1024
  // API
984
1025
  valueFromString(fieldName, value) {
985
1026
  const descriptor = this.getField(fieldName);
@@ -1019,12 +1060,6 @@ class DataUnit {
1019
1060
  this.dispatchAction(Action.RECORDS_COPIED, prepareAddedRecordId(this._stateManager, selectedRecords));
1020
1061
  }
1021
1062
  }
1022
- removeSelectedRecords() {
1023
- const selection = getSelection(this._stateManager);
1024
- if (selection) {
1025
- this.dispatchAction(Action.RECORDS_REMOVED, selection);
1026
- }
1027
- }
1028
1063
  getFieldValue(fieldName) {
1029
1064
  return getFieldValue(this._stateManager, fieldName);
1030
1065
  }
@@ -1166,10 +1201,10 @@ var UserInterface;
1166
1201
 
1167
1202
  class ApplicationContext {
1168
1203
  static getContextValue(key) {
1169
- return ApplicationContext.getCtx()[key].deref();
1204
+ return ApplicationContext.getCtx()[key];
1170
1205
  }
1171
1206
  static setContextValue(key, value) {
1172
- ApplicationContext.getCtx()[key] = new WeakRef(value);
1207
+ ApplicationContext.getCtx()[key] = value;
1173
1208
  }
1174
1209
  static getCtx() {
1175
1210
  let ctx = window.___snkcore___ctx___;
@@ -7545,6 +7580,7 @@ class DataUnitFetcher {
7545
7580
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
7546
7581
  dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
7547
7582
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
7583
+ dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
7548
7584
  return dataUnit;
7549
7585
  }
7550
7586
  loadMetadata(dataUnit) {
@@ -7604,10 +7640,7 @@ class DataUnitFetcher {
7604
7640
  const changes = duChanges.map((change) => {
7605
7641
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
7606
7642
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
7607
- if (value) {
7608
- value = value.toString();
7609
- }
7610
- return { fieldName, value };
7643
+ return { fieldName, value: this.formatValueToServer(value) };
7611
7644
  });
7612
7645
  return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
7613
7646
  });
@@ -7636,6 +7669,39 @@ class DataUnitFetcher {
7636
7669
  });
7637
7670
  });
7638
7671
  }
7672
+ formatValueToServer(value) {
7673
+ if (value === undefined)
7674
+ return value;
7675
+ try {
7676
+ if (value instanceof Date) {
7677
+ return value.toString();
7678
+ }
7679
+ //Any others objects
7680
+ value = JSON.stringify(value);
7681
+ }
7682
+ catch (_a) {
7683
+ value = value.toString();
7684
+ }
7685
+ return value;
7686
+ }
7687
+ removeRecords(dataUnit, recordIds) {
7688
+ const changes = recordIds.map((recordId) => {
7689
+ return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
7690
+ });
7691
+ return new Promise((resolve, reject) => {
7692
+ HttpFetcher.get()
7693
+ .callGraphQL({
7694
+ values: { changes: changes },
7695
+ query: this.templateByQuery.get("saveData"),
7696
+ })
7697
+ .then((_resp) => {
7698
+ resolve(recordIds);
7699
+ })
7700
+ .catch((error) => {
7701
+ reject(error);
7702
+ });
7703
+ });
7704
+ }
7639
7705
  }
7640
7706
 
7641
7707
  class UrlUtils {
@@ -432,6 +432,7 @@ var Action;
432
432
  Action["DATA_LOADED"] = "dataLoaded";
433
433
  Action["SAVING_DATA"] = "savingData";
434
434
  Action["DATA_SAVED"] = "dataSaved";
435
+ Action["REMOVING_RECORDS"] = "removingRecords";
435
436
  Action["RECORDS_REMOVED"] = "recordsRemoved";
436
437
  Action["RECORDS_ADDED"] = "recordsAdded";
437
438
  Action["RECORDS_COPIED"] = "recordsCopied";
@@ -596,7 +597,11 @@ class RemovedRecordsReducerImpl {
596
597
  reduce(_stateManager, currentState, action) {
597
598
  switch (action.type) {
598
599
  case Action.RECORDS_REMOVED:
599
- return (currentState || []).concat(action.payload);
600
+ const { records, buffered } = action.payload;
601
+ if (buffered) {
602
+ return (currentState || []).concat(records);
603
+ }
604
+ return currentState;
600
605
  case Action.EDITION_CANCELED:
601
606
  case Action.DATA_SAVED:
602
607
  return undefined;
@@ -617,6 +622,12 @@ class RecordsReducerImpl {
617
622
  switch (action.type) {
618
623
  case Action.DATA_LOADED:
619
624
  return action.payload;
625
+ case Action.RECORDS_REMOVED:
626
+ const { records, buffered } = action.payload;
627
+ if (!buffered) {
628
+ return currentState.filter(r => !records.includes(r.__record__id__));
629
+ }
630
+ return currentState;
620
631
  case Action.DATA_SAVED:
621
632
  const recordsMap = new Map();
622
633
  const currentRecords = getRecords(stateManager);
@@ -790,7 +801,7 @@ class SelectionReducerImpl {
790
801
  case Action.DATA_SAVED:
791
802
  return updateSavedIds(stateManager, action.payload.records);
792
803
  case Action.RECORDS_REMOVED:
793
- const removed = action.payload;
804
+ const removed = action.payload.records;
794
805
  if (currentState && removed) {
795
806
  return currentState.filter(recordId => !removed.includes(recordId));
796
807
  }
@@ -980,6 +991,36 @@ class DataUnit {
980
991
  return Promise.resolve();
981
992
  });
982
993
  }
994
+ removeSelectedRecords(buffered = false) {
995
+ return __awaiter(this, void 0, void 0, function* () {
996
+ const selection = getSelection(this._stateManager);
997
+ if (selection) {
998
+ return this.removeRecords(selection, buffered);
999
+ }
1000
+ return Promise.resolve(selection);
1001
+ });
1002
+ }
1003
+ removeRecords(records, buffered = false) {
1004
+ return __awaiter(this, void 0, void 0, function* () {
1005
+ if (records) {
1006
+ if (buffered || !this.removeLoader) {
1007
+ this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: true });
1008
+ }
1009
+ else {
1010
+ this.dispatchAction(Action.REMOVING_RECORDS);
1011
+ return new Promise((resolve, fail) => {
1012
+ if (this.removeLoader) {
1013
+ this.removeLoader(this, records).then(records => {
1014
+ this.dispatchAction(Action.RECORDS_REMOVED, { records, buffered: false });
1015
+ resolve(records);
1016
+ }).catch(error => fail(error));
1017
+ }
1018
+ });
1019
+ }
1020
+ }
1021
+ return Promise.resolve(records);
1022
+ });
1023
+ }
983
1024
  // API
984
1025
  valueFromString(fieldName, value) {
985
1026
  const descriptor = this.getField(fieldName);
@@ -1019,12 +1060,6 @@ class DataUnit {
1019
1060
  this.dispatchAction(Action.RECORDS_COPIED, prepareAddedRecordId(this._stateManager, selectedRecords));
1020
1061
  }
1021
1062
  }
1022
- removeSelectedRecords() {
1023
- const selection = getSelection(this._stateManager);
1024
- if (selection) {
1025
- this.dispatchAction(Action.RECORDS_REMOVED, selection);
1026
- }
1027
- }
1028
1063
  getFieldValue(fieldName) {
1029
1064
  return getFieldValue(this._stateManager, fieldName);
1030
1065
  }
@@ -1166,10 +1201,10 @@ var UserInterface;
1166
1201
 
1167
1202
  class ApplicationContext {
1168
1203
  static getContextValue(key) {
1169
- return ApplicationContext.getCtx()[key].deref();
1204
+ return ApplicationContext.getCtx()[key];
1170
1205
  }
1171
1206
  static setContextValue(key, value) {
1172
- ApplicationContext.getCtx()[key] = new WeakRef(value);
1207
+ ApplicationContext.getCtx()[key] = value;
1173
1208
  }
1174
1209
  static getCtx() {
1175
1210
  let ctx = window.___snkcore___ctx___;
@@ -7545,6 +7580,7 @@ class DataUnitFetcher {
7545
7580
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
7546
7581
  dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
7547
7582
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
7583
+ dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
7548
7584
  return dataUnit;
7549
7585
  }
7550
7586
  loadMetadata(dataUnit) {
@@ -7604,10 +7640,7 @@ class DataUnitFetcher {
7604
7640
  const changes = duChanges.map((change) => {
7605
7641
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
7606
7642
  const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
7607
- if (value) {
7608
- value = value.toString();
7609
- }
7610
- return { fieldName, value };
7643
+ return { fieldName, value: this.formatValueToServer(value) };
7611
7644
  });
7612
7645
  return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
7613
7646
  });
@@ -7636,6 +7669,39 @@ class DataUnitFetcher {
7636
7669
  });
7637
7670
  });
7638
7671
  }
7672
+ formatValueToServer(value) {
7673
+ if (value === undefined)
7674
+ return value;
7675
+ try {
7676
+ if (value instanceof Date) {
7677
+ return value.toString();
7678
+ }
7679
+ //Any others objects
7680
+ value = JSON.stringify(value);
7681
+ }
7682
+ catch (_a) {
7683
+ value = value.toString();
7684
+ }
7685
+ return value;
7686
+ }
7687
+ removeRecords(dataUnit, recordIds) {
7688
+ const changes = recordIds.map((recordId) => {
7689
+ return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
7690
+ });
7691
+ return new Promise((resolve, reject) => {
7692
+ HttpFetcher.get()
7693
+ .callGraphQL({
7694
+ values: { changes: changes },
7695
+ query: this.templateByQuery.get("saveData"),
7696
+ })
7697
+ .then((_resp) => {
7698
+ resolve(recordIds);
7699
+ })
7700
+ .catch((error) => {
7701
+ reject(error);
7702
+ });
7703
+ });
7704
+ }
7639
7705
  }
7640
7706
 
7641
7707
  class UrlUtils {
@@ -0,0 +1,57 @@
1
+ import{r as t,c as e,h as n}from"./p-5fa264b9.js";class i{constructor(t){this._mask="",this._maskChars=new Array,this.placeholder=" ",this.mask=t}set mask(t){this._mask=t,this.updateInternalMask()}get mask(){return this._mask}format(t){let e="";const n=[0];let i=0;const r=this._maskChars.length;for(;i<r;)e=this._maskChars[i].append(e,t,n),i++;return e}updateInternalMask(){if(this._maskChars.length=0,null!=this.mask){let t=0;const e=this.mask.length;for(;t<e;){let n=this.mask.charAt(t);switch(n){case i.DIGIT_KEY:this._maskChars.push(new i.DigitMaskCharacter(this,n));break;case i.LITERAL_KEY:++t<e&&(n=this.mask.charAt(t),this._maskChars.push(new i.LiteralCharacter(this,n)));break;case i.UPPERCASE_KEY:this._maskChars.push(new i.UpperCaseCharacter(this,n));break;case i.LOWERCASE_KEY:this._maskChars.push(new i.LowerCaseCharacter(this,n));break;case i.ALPHA_NUMERIC_KEY:this._maskChars.push(new i.AlphaNumericCharacter(this,n));break;case i.CHARACTER_KEY:this._maskChars.push(new i.CharCharacter(this,n));break;case i.ANYTHING_KEY:this._maskChars.push(new i.MaskCharacter(this,n));break;default:this._maskChars.push(new i.LiteralCharacter(this,n))}t++}}}}i.DIGIT_KEY="#",i.LITERAL_KEY="'",i.UPPERCASE_KEY="U",i.LOWERCASE_KEY="L",i.ALPHA_NUMERIC_KEY="A",i.CHARACTER_KEY="?",i.ANYTHING_KEY="*",i.MaskCharacter=class{constructor(t,e){this.maskFormatter=t,this.type=e}isLiteral(){return!1}isValidCharacter(t){return this.isLiteral()?this.getChar(t)==t:(t=this.getChar(t),!0)}getChar(t){return t}append(t,e,n){const i=n[0]<e.length?e.charAt(n[0]):"";if(this.isLiteral()){const e=this.getChar(i);t+=e,e===i&&(n[0]=n[0]+1)}else if(n[0]>=e.length)t+=this.maskFormatter.placeholder,n[0]=n[0]+1;else{if(!this.isValidCharacter(i))throw new Error(`Valor inválido: "${i}". Na posição ${n[0]+1} espera-se ${this.getFormatMessage()}.`);t+=this.getChar(i),n[0]=n[0]+1}return t}getFormatMessage(){let t;switch(this.type){case i.UPPERCASE_KEY:case i.LOWERCASE_KEY:case i.CHARACTER_KEY:t="uma letra";break;case i.DIGIT_KEY:t="um número";break;case i.ALPHA_NUMERIC_KEY:t="uma letra ou um número";break;default:t=""}return t}},i.LiteralCharacter=class extends i.MaskCharacter{constructor(t,e){super(t,e),this._fixedChar=e}isLiteral(){return!0}getChar(t){return this._fixedChar}},i.DigitMaskCharacter=class extends i.MaskCharacter{isValidCharacter(t){return this.isDigit(t)&&super.isValidCharacter(t)}isDigit(t){return t>="0"&&t<="9"}},i.UpperCaseCharacter=class extends i.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}getChar(t){return t.toUpperCase()}},i.LowerCaseCharacter=class extends i.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}getChar(t){return t.toLocaleLowerCase()}},i.AlphaNumericCharacter=class extends i.MaskCharacter{isValidCharacter(t){return/[a-z0-9]/i.test(t)&&super.isValidCharacter(t)}},i.CharCharacter=class extends i.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}};class r{static clearTime(t,e=!0){const n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0);return e?r.adjustDLST(n):n}static strToDate(t,e=!0,n=!1){let i;if(i=n?/^(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(t):/^(3[01]|[1-2]\d|0[1-9]|[1-9])[^\d]?(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(t),!i)return;var s=n?1:Number(i[1]),o=Number(i[n?1:2]),a=Number(i[n?2:3]),u=Number(i[n?3:4]||0),c=Number(i[n?4:5]||0),h=Number(i[n?5:6]||0);a<100&&(a+=a<30?2e3:1900);let l=new Date(a,o-1,s,u,c,h,0);return!0!==e||n||0!=u||(l=r.adjustDLST(l)),l}static adjustDLST(t){return 23==t.getHours()?new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,1,0,0,0):t}}var s,o;new i("##:##"),function(t){t[t.GET=0]="GET",t[t.PUT=1]="PUT",t[t.POST=2]="POST",t[t.DELETE=3]="DELETE"}(s||(s={})),function(t){t.NUMBER="NUMBER",t.DATE="DATE",t.TEXT="TEXT",t.BOOLEAN="BOOLEAN",t.OBJECT="OBJECT"}(o||(o={}));const a=(t,e)=>{if(null==e)return e;switch(t){case o.NUMBER:return""===e||isNaN(e)?null:Number(e);case o.OBJECT:return"string"==typeof e?JSON.parse(e):e;case o.BOOLEAN:return Boolean(e);case o.DATE:return new Date(e.toString());default:return e}};class u{constructor(t,e){this._type=t,this._payload=e}get type(){return this._type}get payload(){return this._payload}}var c;!function(t){t.LOADING_METADATA="loadingMetadata",t.METADATA_LOADED="metadataLoaded",t.LOADING_DATA="loadingData",t.DATA_LOADED="dataLoaded",t.SAVING_DATA="savingData",t.DATA_SAVED="dataSaved",t.REMOVING_RECORDS="removingRecords",t.RECORDS_REMOVED="recordsRemoved",t.RECORDS_ADDED="recordsAdded",t.RECORDS_COPIED="recordsCopied",t.DATA_CHANGED="dataChanged",t.EDITION_CANCELED="editionCanceled",t.CHANGE_UNDONE="changeUndone",t.CHANGE_REDONE="changeRedone",t.SELECTION_CHANGED="selectionChanged",t.NEXT_SELECTED="nextSelected",t.PREVIOUS_SELECTED="previousSelected",t.STATE_CHANGED="stateChanged"}(c||(c={}));class h{constructor(t){this._past=[],this._future=[],this._present={},this._nonHist={},this._histClean=!1,this._reducers=t}process(t){const e=this._present;let n=!1;this._histClean=!1,this._reducers.forEach((e=>{const i=e.sliceName,r=this.isHistoric(i),s=this.getSlice(i,r),o=e.reduce(this,s,t);o!==s&&(this.updateSlice(i,o,r),n||(n=r))})),n&&!this._histClean&&(this._past.push(e),this._future=[],document.dispatchEvent(new CustomEvent("undoableAction",{detail:this})))}select(t,e){const n=this.isHistoric(t);return e(this.getSlice(t,n))}isHistoric(t){return t.startsWith("hist::")}updateSlice(t,e,n){n?(this._present=Object.assign(Object.assign({},this._present),{[t]:e}),void 0===e&&delete this._present[t]):(this._nonHist=Object.assign(Object.assign({},this._nonHist),{[t]:e}),void 0===e&&delete this._nonHist[t])}getSlice(t,e){return e?this._present[t]:this._nonHist[t]}canUndo(){return this._past.length>0}canRedo(){return this._future.length>0}undo(){this.canUndo()&&(this._future.push(this._present),this._present=this._past.pop())}redo(){this.canRedo()&&(this._past.push(this._present),this._present=this._future.pop())}clearUndo(){this._histClean=!0,this._past=[],this._future=[]}persist(){}}const l=new class{constructor(){this.sliceName=""}reduce(t,e,n){switch(n.type){case c.DATA_SAVED:case c.EDITION_CANCELED:t.clearUndo();break;case c.CHANGE_UNDONE:t.undo();break;case c.CHANGE_REDONE:t.redo()}}},d=new class{constructor(){this.sliceName="unitMetadata"}reduce(t,e,n){return n.type===c.METADATA_LOADED?n.payload:e}},f=t=>t.select(d.sliceName,(t=>t)),v=new class{constructor(){this.sliceName="hist::removedRecords"}reduce(t,e,n){switch(n.type){case c.RECORDS_REMOVED:const{records:t,buffered:i}=n.payload;return i?(e||[]).concat(t):e;case c.EDITION_CANCELED:case c.DATA_SAVED:return}return e}},p=t=>t.select(v.sliceName,(t=>t)),m=new class{constructor(){this.sliceName="records"}reduce(t,e,n){switch(n.type){case c.DATA_LOADED:return n.payload;case c.RECORDS_REMOVED:const{records:i,buffered:r}=n.payload;return r?e:e.filter((t=>!i.includes(t.__record__id__)));case c.DATA_SAVED:const s=new Map,o=y(t);if(o){const e=p(t)||[];o.forEach((t=>{e.includes(t.__record__id__)||s.set(t.__record__id__,t)}))}return n.payload.records.forEach((t=>{const e=t.__old__id__||t.__record__id__,n=Object.assign({},t);delete n.__old__id__,s.set(e,n)})),Array.from(s.values())}return e}},y=t=>t.select(m.sliceName,(t=>t)),b=new class{constructor(){this.sliceName="hist::addedRecords"}reduce(t,e,n){switch(n.type){case c.RECORDS_ADDED:case c.RECORDS_COPIED:return(e||[]).concat(n.payload);case c.DATA_SAVED:case c.EDITION_CANCELED:return}return e}},w=t=>t.select(b.sliceName,(t=>t)),g=(t,e)=>{let n=(w(t)||[]).length;return e.map((t=>Object.assign(Object.assign({},t),{__record__id__:"NEW_"+n++})))},O=new class{constructor(){this.sliceName="hist::changes"}reduce(t,e,n){switch(n.type){case c.DATA_CHANGED:const i=n.payload.records||j(t);if(i){const t=new Map(e);return i.forEach((e=>{const i=Object.assign(Object.assign({},t.get(e)),n.payload);delete i.records,t.set(e,i)})),t}return e;case c.DATA_SAVED:case c.EDITION_CANCELED:return}return e}},E=t=>t.select(O.sliceName,(t=>t)),T=new class{constructor(){this.sliceName="currentRecords"}reduce(t,e,n){let i=y(t);const r=w(t);if(!i&&!r)return;r&&(i=(i||[]).concat(r));const s=p(t);s&&(i=i.filter((t=>!s.includes(t.__record__id__))));const o=E(t);return new Map(i.map((t=>{const e=t.__record__id__;return[e,Object.assign(Object.assign({},t),null==o?void 0:o.get(e))]})))}},D=t=>t.select(T.sliceName,(t=>t)),S=new class{constructor(){this.sliceName="hist::selection"}reduce(t,e,n){switch(n.type){case c.RECORDS_ADDED:case c.RECORDS_COPIED:return n.payload.map((t=>t.__record__id__));case c.DATA_SAVED:return function(t,e){const n=j(t);if(n){const t=[];return n.forEach((n=>{const i=e.find((t=>t.__old__id__===n));t.push(i?i.__record__id__:n)})),t}return n}(t,n.payload.records);case c.RECORDS_REMOVED:const i=n.payload.records;return e&&i?e.filter((t=>!i.includes(t))):e;case c.NEXT_SELECTED:case c.PREVIOUS_SELECTED:const r=D(t);if(r&&r.size>0){let t;if(t=e&&0!==e.length?I(e[0],r)+(n.type===c.PREVIOUS_SELECTED?-1:1):n.type===c.PREVIOUS_SELECTED?0:Math.min(1,r.size),t<r.size&&t>=0)return[Array.from(r.values())[t].__record__id__]}return;case c.SELECTION_CHANGED:const{type:s,selection:o}=n.payload;if(o&&"index"===s){const e=D(t);if(e){const t=Array.from(e.values()),n=[];return o.forEach((i=>{i>0&&i<e.size&&n.push(t[i].__record__id__)})),n}}return o}return e}},j=t=>{let e=t.select(S.sliceName,(t=>t));const n=Array.from((D(t)||new Map).keys());return e&&(e=e.filter((t=>n.includes(t)))),(!e||0===e.length)&&n&&n.length>0?[n[0]]:e};function I(t,e){return Array.from(e.keys()).indexOf(t)}var A,x,_,k,N=function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((i=i.apply(t,e||[])).next())}))};class F{constructor(t){this._name=t,this._stateManager=new h([l,d,m,v,b,S,O,T]),this._observers=[],this._filterProviders=[],this._sortingProvider=void 0,this._interceptors=[]}get name(){return this._name}validateAndTypeValue(t,e){const n=this.getField(t);return n?a(n.dataType,e):e}getFilters(){let t;return this._filterProviders.forEach((e=>{const n=e.getFilter(this.name);n&&(t=(t||[]).concat(n))})),t}getSort(){return this._sortingProvider?this._sortingProvider.getSort(this._name):void 0}loadMetadata(){return N(this,void 0,void 0,(function*(){return this.dispatchAction(c.LOADING_METADATA),new Promise(((t,e)=>{this.metadataLoader&&this.metadataLoader(this).then((e=>{this.metadata=e,t(this.metadata)})).catch((t=>e(t)))}))}))}loadData(){return N(this,void 0,void 0,(function*(){return this.dispatchAction(c.LOADING_DATA),new Promise(((t,e)=>{if(this.dataLoader){const n=this.getSort(),i=this.getFilters();this.dataLoader(this,n,i).then((e=>{this.records=e,t(this.records)})).catch((t=>e(t)))}}))}))}saveData(){return N(this,void 0,void 0,(function*(){const t=((t,e)=>{const n=[],i=E(e),r=y(e);null==r||r.forEach((e=>{if(i){const r=i.get(e.__record__id__);r&&n.push(new $(t,e,r,A.UPDATE))}}));const s=w(e);s&&s.forEach((e=>{n.push(new $(t,e,null==i?void 0:i.get(e.__record__id__),A.INSERT))}));const o=p(e),a={};return null==r||r.forEach((t=>a[t.__record__id__]=t)),o&&o.forEach((e=>{n.push(new $(t,a[e],void 0,A.DELETE))})),n})(this._name,this._stateManager);return t.length>0?(this.dispatchAction(c.SAVING_DATA),new Promise(((e,n)=>{this.saveLoader&&this.saveLoader(this,t).then((e=>this.dispatchAction(c.DATA_SAVED,{changes:t,records:e}))).catch((t=>n(t)))}))):Promise.resolve()}))}removeSelectedRecords(t=!1){return N(this,void 0,void 0,(function*(){const e=j(this._stateManager);return e?this.removeRecords(e,t):Promise.resolve(e)}))}removeRecords(t,e=!1){return N(this,void 0,void 0,(function*(){if(t){if(!e&&this.removeLoader)return this.dispatchAction(c.REMOVING_RECORDS),new Promise(((e,n)=>{this.removeLoader&&this.removeLoader(this,t).then((t=>{this.dispatchAction(c.RECORDS_REMOVED,{records:t,buffered:!1}),e(t)})).catch((t=>n(t)))}));this.dispatchAction(c.RECORDS_REMOVED,{records:t,buffered:!0})}return Promise.resolve(t)}))}valueFromString(t,e){const n=this.getField(t);return n?a(n.dataType,e):e}addInterceptor(t){this._interceptors.push(t)}addFilterProvider(t){this._filterProviders.push(t)}set sortingProvider(t){this._sortingProvider=t}set metadata(t){this.dispatchAction(c.METADATA_LOADED,t)}get metadata(){return f(this._stateManager)}set records(t){this.dispatchAction(c.DATA_LOADED,t)}get records(){const t=D(this._stateManager);return t?Array.from(t.values()):[]}getField(t){return((t,e)=>{const n=f(this._stateManager);return n?n.fields.find((t=>t.name===e)):void 0})(0,t)}addRecord(){this.dispatchAction(c.RECORDS_ADDED,g(this._stateManager,[{}]))}copySelected(){const t=this.getSelectedRecords();t&&this.dispatchAction(c.RECORDS_COPIED,g(this._stateManager,t))}getFieldValue(t){return((t,e)=>{const n=j(t);if(n&&n.length>0){const i=D(t);if(i){const t=i.get(n[0]);return t?t[e]:void 0}}})(this._stateManager,t)}setFieldValue(t,e,n){const i=this.validateAndTypeValue(t,e);this.getFieldValue(t)!==i&&this.dispatchAction(c.DATA_CHANGED,{[t]:i,records:n})}getSelection(){return j(this._stateManager)}setSelection(t){this.dispatchAction(c.SELECTION_CHANGED,{type:"id",selection:t})}setSelectionByIndex(t){this.dispatchAction(c.SELECTION_CHANGED,{type:"index",selection:t})}getSelectedRecords(){const t=this.getSelection();if(t){const e=this.records;return null==e?void 0:e.filter((e=>t.includes(e.__record__id__)))}}nextRecord(){this.dispatchAction(c.NEXT_SELECTED)}previousRecord(){this.dispatchAction(c.PREVIOUS_SELECTED)}cancelEdition(){this.dispatchAction(c.EDITION_CANCELED)}isDirty(){return void 0!==w(t=this._stateManager)||void 0!==p(t)||void 0!==E(t);var t}hasNext(){return(t=>{const e=D(t);if(e){const n=t.select(S.sliceName,(t=>t));return n&&0!==n.length?e.size>I(n[0],e)+1:e.size>0}return!1})(this._stateManager)}hasPrevious(){return(t=>{const e=D(t);if(e){const n=t.select(S.sliceName,(t=>t));return!(!n||0===n.length)&&I(n[0],e)>0}return!1})(this._stateManager)}canUndo(){return this._stateManager.canUndo()}canRedo(){return this._stateManager.canRedo()}undo(){this.dispatchAction(c.CHANGE_UNDONE)}redo(){this.dispatchAction(c.CHANGE_REDONE)}toString(){return this.name}dispatchAction(t,e){var n;let i=new u(t,e);null===(n=this._interceptors)||void 0===n||n.forEach((t=>{i&&(i=t.interceptAction(i))})),i&&(this._stateManager.process(i),this._observers.forEach((t=>t(i))))}subscribe(t){this._observers.push(t)}unsubscribe(t){this._observers=this._observers.filter((e=>e!==t))}}!function(t){t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"}(A||(A={}));class ${constructor(t,e,n,i){this.dataUnit=t,this.record=e,this.updatingFields=n,this._operation=i}get operation(){return this._operation.toString()}isInsert(){return this._operation===A.INSERT}isDelete(){return this._operation===A.DELETE}isUpdate(){return this._operation===A.UPDATE}}!function(t){t.ASC="ASC",t.DESC="DESC"}(x||(x={})),function(t){t.SEARCHING="SEARCHING",t.REQUIREMENT="REQUIREMENT",t.VISIBILITY="REQUIREMENT"}(_||(_={})),function(t){t.FILE="FILE",t.IMAGE="IMAGE",t.DATE="DATE",t.DATETIME="DATETIME",t.TIME="TIME",t.ELAPSEDTIME="ELAPSEDTIME",t.CHECKBOX="CHECKBOX",t.SWITCH="SWITCH",t.OPTIONSELECTOR="OPTIONSELECTOR",t.DECIMALNUMBER="DECIMALNUMBER",t.INTEGERNUMBER="INTEGERNUMBER",t.SEARCH="SEARCH",t.SHORTTEXT="SHORTTEXT",t.PASSWORD="PASSWORD",t.MASKEDTEXT="MASKEDTEXT",t.LONGTEXT="LONGTEXT",t.HTML="HTML"}(k||(k={}));class C{static getContextValue(t){return C.getCtx()[t]}static setContextValue(t,e){C.getCtx()[t]=e}static getCtx(){let t=window.___snkcore___ctx___;return t||(t={},window.___snkcore___ctx___=t),t}}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function M(t,e,n){return t(n={path:e,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},n.exports),n.exports}var P=M((function(t,e){var n="undefined"!=typeof self?self:U,i=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,r="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function v(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function p(t){var e=new FileReader,n=v(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&r&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,n,i=f(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,n=v(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=c(t),e=h(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},d.prototype.delete=function(t){delete this.map[c(t)]},d.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},d.prototype.set=function(t,e){this.map[c(t)]=h(e)},d.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),l(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),l(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),l(t)},i&&(d.prototype[Symbol.iterator]=d.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var n,i,r=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(i=(n=e.method||this.method||"GET").toUpperCase(),b.indexOf(i)>-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}})),e}function O(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},O.error=function(){var t=new O(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];O.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new O(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function T(t,n){return new Promise((function(i,s){var o=new w(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL"),i(new O("response"in a?a.response:a.responseText,n))},a.onerror=function(){s(new TypeError("Network request failed"))},a.ontimeout=function(){s(new TypeError("Network request failed"))},a.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&r&&(a.responseType="blob"),o.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",u)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}T.polyfill=!0,t.fetch||(t.fetch=T,t.Headers=d,t.Request=w,t.Response=O),e.Headers=d,e.Request=w,e.Response=O,e.fetch=T,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=i;(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e})),R=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=function(t){return"object"==typeof t&&null!==t}})),V=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=function(t,e){if(!Boolean(t))throw new Error(null!=e?e:"Unexpected invariant triggered.")}})),q=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=function(t,e){let i=0,r=1;for(const s of t.body.matchAll(n)){if("number"==typeof s.index||(0,V.invariant)(!1),s.index>=e)break;i=s.index+s[0].length,r+=1}return{line:r,column:e+1-i}};const n=/\r\n|[\n\r]/g})),L=M((function(t,e){function n(t,e){const n=t.locationOffset.column-1,r="".padStart(n)+t.body,s=e.line-1,o=e.line+(t.locationOffset.line-1),a=e.column+(1===e.line?n:0),u=`${t.name}:${o}:${a}\n`,c=r.split(/\r\n|[\n\r]/g),h=c[s];if(h.length>120){const t=Math.floor(a/80),e=a%80,n=[];for(let t=0;t<h.length;t+=80)n.push(h.slice(t,t+80));return u+i([[`${o} |`,n[0]],...n.slice(1,t+1).map((t=>["|",t])),["|","^".padStart(e)],["|",n[t+1]]])}return u+i([[o-1+" |",c[s-1]],[`${o} |`,h],["|","^".padStart(a)],[`${o+1} |`,c[s+1]]])}function i(t){const e=t.filter((([t,e])=>void 0!==e)),n=Math.max(...e.map((([t])=>t.length)));return e.map((([t,e])=>t.padStart(n)+(e?" "+e:""))).join("\n")}Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=function(t){return n(t.source,(0,q.getLocation)(t.source,t.start))},e.printSourceLocation=n})),B=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=function(t){return t.toJSON()},e.printError=function(t){return t.toString()};class n extends Error{constructor(t,...e){var r,s,o;const{nodes:a,source:u,positions:c,path:h,originalError:l,extensions:d}=function(t){const e=t[0];return null==e||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}(e);super(t),this.name="GraphQLError",this.path=null!=h?h:void 0,this.originalError=null!=l?l:void 0,this.nodes=i(Array.isArray(a)?a:a?[a]:void 0);const f=i(null===(r=this.nodes)||void 0===r?void 0:r.map((t=>t.loc)).filter((t=>null!=t)));this.source=null!=u?u:null==f||null===(s=f[0])||void 0===s?void 0:s.source,this.positions=null!=c?c:null==f?void 0:f.map((t=>t.start)),this.locations=c&&u?c.map((t=>(0,q.getLocation)(u,t))):null==f?void 0:f.map((t=>(0,q.getLocation)(t.source,t.start)));const v=(0,R.isObjectLike)(null==l?void 0:l.extensions)?null==l?void 0:l.extensions:void 0;this.extensions=null!==(o=null!=d?d:v)&&void 0!==o?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=l&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const e of this.nodes)e.loc&&(t+="\n\n"+(0,L.printLocation)(e.loc));else if(this.source&&this.locations)for(const e of this.locations)t+="\n\n"+(0,L.printSourceLocation)(this.source,e);return t}toJSON(){const t={message:this.message};return null!=this.locations&&(t.locations=this.locations),null!=this.path&&(t.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}function i(t){return void 0===t||0===t.length?void 0:t}e.GraphQLError=n})),H=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=function(t,e,n){return new B.GraphQLError(`Syntax Error: ${n}`,{source:t,positions:[e]})}})),z=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=function(t){const e=null==t?void 0:t.kind;return"string"==typeof e&&s.has(e)};class n{constructor(t,e,n){this.start=t.start,this.end=e.end,this.startToken=t,this.endToken=e,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}e.Location=n;class i{constructor(t,e,n,i,r,s){this.kind=t,this.start=e,this.end=n,this.line=i,this.column=r,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}e.Token=i;const r={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};e.QueryDocumentKeys=r;const s=new Set(Object.keys(r));let o;e.OperationTypeNode=o,function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"}(o||(e.OperationTypeNode=o={}))})),G=M((function(t,e){let n;Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0,e.DirectiveLocation=n,function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(n||(e.DirectiveLocation=n={}))})),J=M((function(t,e){let n;Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0,e.Kind=n,function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(n||(e.Kind=n={}))})),Q=M((function(t,e){function n(t){return t>=48&&t<=57}function i(t){return t>=97&&t<=122||t>=65&&t<=90}Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=i,e.isNameContinue=function(t){return i(t)||n(t)||95===t},e.isNameStart=function(t){return i(t)||95===t},e.isWhiteSpace=function(t){return 9===t||32===t}})),X=M((function(t,e){function n(t){let e=0;for(;e<t.length&&(0,Q.isWhiteSpace)(t.charCodeAt(e));)++e;return e}Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=function(t){var e;let i=Number.MAX_SAFE_INTEGER,r=null,s=-1;for(let e=0;e<t.length;++e){var o;const a=t[e],u=n(a);u!==a.length&&(r=null!==(o=r)&&void 0!==o?o:e,s=e,0!==e&&u<i&&(i=u))}return t.map(((t,e)=>0===e?t:t.slice(i))).slice(null!==(e=r)&&void 0!==e?e:0,s+1)},e.isPrintableAsBlockString=function(t){if(""===t)return!0;let e=!0,n=!1,i=!0,r=!1;for(let s=0;s<t.length;++s)switch(t.codePointAt(s)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:case 13:return!1;case 10:if(e&&!r)return!1;r=!0,e=!0,n=!1;break;case 9:case 32:n||(n=e);break;default:i&&(i=n),e=!1}return!e&&(!i||!r)},e.printBlockString=function(t,e){const n=t.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,s=i.length>1&&i.slice(1).every((t=>0===t.length||(0,Q.isWhiteSpace)(t.charCodeAt(0)))),o=n.endsWith('\\"""'),a=t.endsWith('"')&&!o,u=t.endsWith("\\"),c=a||u,h=!(null!=e&&e.minimize)&&(!r||t.length>70||c||s||o);let l="";const d=r&&(0,Q.isWhiteSpace)(t.charCodeAt(0));return(h&&!d||s)&&(l+="\n"),l+=n,(h||c)&&(l+="\n"),'"""'+l+'"""'}})),K=M((function(t,e){let n;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0,e.TokenKind=n,function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"}(n||(e.TokenKind=n={}))})),W=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.isPunctuatorTokenKind=function(t){return t===K.TokenKind.BANG||t===K.TokenKind.DOLLAR||t===K.TokenKind.AMP||t===K.TokenKind.PAREN_L||t===K.TokenKind.PAREN_R||t===K.TokenKind.SPREAD||t===K.TokenKind.COLON||t===K.TokenKind.EQUALS||t===K.TokenKind.AT||t===K.TokenKind.BRACKET_L||t===K.TokenKind.BRACKET_R||t===K.TokenKind.BRACE_L||t===K.TokenKind.PIPE||t===K.TokenKind.BRACE_R};class n{constructor(t){const e=new z.Token(K.TokenKind.SOF,0,0,0,0);this.source=t,this.lastToken=e,this.token=e,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==K.TokenKind.EOF)do{if(t.next)t=t.next;else{const e=c(this,t.end);t.next=e,e.prev=t,t=e}}while(t.kind===K.TokenKind.COMMENT);return t}}function i(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function r(t,e){return s(t.charCodeAt(e))&&o(t.charCodeAt(e+1))}function s(t){return t>=55296&&t<=56319}function o(t){return t>=56320&&t<=57343}function a(t,e){const n=t.source.body.codePointAt(e);if(void 0===n)return K.TokenKind.EOF;if(n>=32&&n<=126){const t=String.fromCodePoint(n);return'"'===t?"'\"'":`"${t}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function u(t,e,n,i,r){return new z.Token(e,n,i,t.line,1+n-t.lineStart,r)}function c(t,e){const n=t.source.body,s=n.length;let o=e;for(;o<s;){const e=n.charCodeAt(o);switch(e){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++t.line,t.lineStart=o;continue;case 13:10===n.charCodeAt(o+1)?o+=2:++o,++t.line,t.lineStart=o;continue;case 35:return h(t,o);case 33:return u(t,K.TokenKind.BANG,o,o+1);case 36:return u(t,K.TokenKind.DOLLAR,o,o+1);case 38:return u(t,K.TokenKind.AMP,o,o+1);case 40:return u(t,K.TokenKind.PAREN_L,o,o+1);case 41:return u(t,K.TokenKind.PAREN_R,o,o+1);case 46:if(46===n.charCodeAt(o+1)&&46===n.charCodeAt(o+2))return u(t,K.TokenKind.SPREAD,o,o+3);break;case 58:return u(t,K.TokenKind.COLON,o,o+1);case 61:return u(t,K.TokenKind.EQUALS,o,o+1);case 64:return u(t,K.TokenKind.AT,o,o+1);case 91:return u(t,K.TokenKind.BRACKET_L,o,o+1);case 93:return u(t,K.TokenKind.BRACKET_R,o,o+1);case 123:return u(t,K.TokenKind.BRACE_L,o,o+1);case 124:return u(t,K.TokenKind.PIPE,o,o+1);case 125:return u(t,K.TokenKind.BRACE_R,o,o+1);case 34:return 34===n.charCodeAt(o+1)&&34===n.charCodeAt(o+2)?w(t,o):f(t,o)}if((0,Q.isDigit)(e)||45===e)return l(t,o,e);if((0,Q.isNameStart)(e))return g(t,o);throw(0,H.syntaxError)(t.source,o,39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":i(e)||r(n,o)?`Unexpected character: ${a(t,o)}.`:`Invalid character: ${a(t,o)}.`)}return u(t,K.TokenKind.EOF,s,s)}function h(t,e){const n=t.source.body,s=n.length;let o=e+1;for(;o<s;){const t=n.charCodeAt(o);if(10===t||13===t)break;if(i(t))++o;else{if(!r(n,o))break;o+=2}}return u(t,K.TokenKind.COMMENT,e,o,n.slice(e+1,o))}function l(t,e,n){const i=t.source.body;let r=e,s=n,o=!1;if(45===s&&(s=i.charCodeAt(++r)),48===s){if(s=i.charCodeAt(++r),(0,Q.isDigit)(s))throw(0,H.syntaxError)(t.source,r,`Invalid number, unexpected digit after 0: ${a(t,r)}.`)}else r=d(t,r,s),s=i.charCodeAt(r);if(46===s&&(o=!0,s=i.charCodeAt(++r),r=d(t,r,s),s=i.charCodeAt(r)),69!==s&&101!==s||(o=!0,s=i.charCodeAt(++r),43!==s&&45!==s||(s=i.charCodeAt(++r)),r=d(t,r,s),s=i.charCodeAt(r)),46===s||(0,Q.isNameStart)(s))throw(0,H.syntaxError)(t.source,r,`Invalid number, expected digit but got: ${a(t,r)}.`);return u(t,o?K.TokenKind.FLOAT:K.TokenKind.INT,e,r,i.slice(e,r))}function d(t,e,n){if(!(0,Q.isDigit)(n))throw(0,H.syntaxError)(t.source,e,`Invalid number, expected digit but got: ${a(t,e)}.`);const i=t.source.body;let r=e+1;for(;(0,Q.isDigit)(i.charCodeAt(r));)++r;return r}function f(t,e){const n=t.source.body,s=n.length;let o=e+1,c=o,h="";for(;o<s;){const s=n.charCodeAt(o);if(34===s)return h+=n.slice(c,o),u(t,K.TokenKind.STRING,e,o+1,h);if(92!==s){if(10===s||13===s)break;if(i(s))++o;else{if(!r(n,o))throw(0,H.syntaxError)(t.source,o,`Invalid character within String: ${a(t,o)}.`);o+=2}}else{h+=n.slice(c,o);const e=117===n.charCodeAt(o+1)?123===n.charCodeAt(o+2)?v(t,o):p(t,o):b(t,o);h+=e.value,o+=e.size,c=o}}throw(0,H.syntaxError)(t.source,o,"Unterminated string.")}function v(t,e){const n=t.source.body;let r=0,s=3;for(;s<12;){const t=n.charCodeAt(e+s++);if(125===t){if(s<5||!i(r))break;return{value:String.fromCodePoint(r),size:s}}if(r=r<<4|y(t),r<0)break}throw(0,H.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+s)}".`)}function p(t,e){const n=t.source.body,r=m(n,e+2);if(i(r))return{value:String.fromCodePoint(r),size:6};if(s(r)&&92===n.charCodeAt(e+6)&&117===n.charCodeAt(e+7)){const t=m(n,e+8);if(o(t))return{value:String.fromCodePoint(r,t),size:12}}throw(0,H.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+6)}".`)}function m(t,e){return y(t.charCodeAt(e))<<12|y(t.charCodeAt(e+1))<<8|y(t.charCodeAt(e+2))<<4|y(t.charCodeAt(e+3))}function y(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function b(t,e){const n=t.source.body;switch(n.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw(0,H.syntaxError)(t.source,e,`Invalid character escape sequence: "${n.slice(e,e+2)}".`)}function w(t,e){const n=t.source.body,s=n.length;let o=t.lineStart,c=e+3,h=c,l="";const d=[];for(;c<s;){const s=n.charCodeAt(c);if(34===s&&34===n.charCodeAt(c+1)&&34===n.charCodeAt(c+2)){l+=n.slice(h,c),d.push(l);const i=u(t,K.TokenKind.BLOCK_STRING,e,c+3,(0,X.dedentBlockStringLines)(d).join("\n"));return t.line+=d.length-1,t.lineStart=o,i}if(92!==s||34!==n.charCodeAt(c+1)||34!==n.charCodeAt(c+2)||34!==n.charCodeAt(c+3))if(10!==s&&13!==s)if(i(s))++c;else{if(!r(n,c))throw(0,H.syntaxError)(t.source,c,`Invalid character within String: ${a(t,c)}.`);c+=2}else l+=n.slice(h,c),d.push(l),13===s&&10===n.charCodeAt(c+1)?c+=2:++c,l="",h=c,o=c;else l+=n.slice(h,c),h=c+1,c+=4}throw(0,H.syntaxError)(t.source,c,"Unterminated string.")}function g(t,e){const n=t.source.body,i=n.length;let r=e+1;for(;r<i;){const t=n.charCodeAt(r);if(!(0,Q.isNameContinue)(t))break;++r}return u(t,K.TokenKind.NAME,e,r,n.slice(e,r))}e.Lexer=n})),Y=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=function(t,e){if(!Boolean(t))throw new Error(e)}})),Z=M((function(t,e){function n(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return function(t,e){if(null===t)return"null";if(e.includes(t))return"[Circular]";const i=[...e,t];if(function(t){return"function"==typeof t.toJSON}(t)){const e=t.toJSON();if(e!==t)return"string"==typeof e?e:n(e,i)}else if(Array.isArray(t))return function(t,e){if(0===t.length)return"[]";if(e.length>2)return"[Array]";const i=Math.min(10,t.length),r=t.length-i,s=[];for(let r=0;r<i;++r)s.push(n(t[r],e));return 1===r?s.push("... 1 more item"):r>1&&s.push(`... ${r} more items`),"["+s.join(", ")+"]"}(t,i);return function(t,e){const i=Object.entries(t);return 0===i.length?"{}":e.length>2?"["+function(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if("Object"===e&&"function"==typeof t.constructor){const e=t.constructor.name;if("string"==typeof e&&""!==e)return e}return e}(t)+"]":"{ "+i.map((([t,i])=>t+": "+n(i,e))).join(", ")+" }"}(t,i)}(t,e);default:return String(t)}}Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=function(t){return n(t,[])}})),tt=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0,e.instanceOf=function(t,e){return t instanceof e}})),et=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=function(t){return(0,tt.instanceOf)(t,n)};class n{constructor(t,e="GraphQL request",n={line:1,column:1}){"string"==typeof t||(0,Y.devAssert)(!1,`Body must be a string. Received: ${(0,Z.inspect)(t)}.`),this.body=t,this.name=e,this.locationOffset=n,this.locationOffset.line>0||(0,Y.devAssert)(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,Y.devAssert)(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}e.Source=n})),nt=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=function(t,e){return new n(t,e).parseDocument()},e.parseConstValue=function(t,e){const i=new n(t,e);i.expectToken(K.TokenKind.SOF);const r=i.parseConstValueLiteral();return i.expectToken(K.TokenKind.EOF),r},e.parseType=function(t,e){const i=new n(t,e);i.expectToken(K.TokenKind.SOF);const r=i.parseTypeReference();return i.expectToken(K.TokenKind.EOF),r},e.parseValue=function(t,e){const i=new n(t,e);i.expectToken(K.TokenKind.SOF);const r=i.parseValueLiteral(!1);return i.expectToken(K.TokenKind.EOF),r};class n{constructor(t,e){const n=(0,et.isSource)(t)?t:new et.Source(t);this._lexer=new W.Lexer(n),this._options=e}parseName(){const t=this.expectToken(K.TokenKind.NAME);return this.node(t,{kind:J.Kind.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:J.Kind.DOCUMENT,definitions:this.many(K.TokenKind.SOF,this.parseDefinition,K.TokenKind.EOF)})}parseDefinition(){if(this.peek(K.TokenKind.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),e=t?this._lexer.lookahead():this._lexer.token;if(e.kind===K.TokenKind.NAME){switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw(0,H.syntaxError)(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(e.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(e)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(K.TokenKind.BRACE_L))return this.node(t,{kind:J.Kind.OPERATION_DEFINITION,operation:z.OperationTypeNode.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const e=this.parseOperationType();let n;return this.peek(K.TokenKind.NAME)&&(n=this.parseName()),this.node(t,{kind:J.Kind.OPERATION_DEFINITION,operation:e,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(K.TokenKind.NAME);switch(t.value){case"query":return z.OperationTypeNode.QUERY;case"mutation":return z.OperationTypeNode.MUTATION;case"subscription":return z.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(K.TokenKind.PAREN_L,this.parseVariableDefinition,K.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:J.Kind.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(K.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(K.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(K.TokenKind.DOLLAR),this.node(t,{kind:J.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:J.Kind.SELECTION_SET,selections:this.many(K.TokenKind.BRACE_L,this.parseSelection,K.TokenKind.BRACE_R)})}parseSelection(){return this.peek(K.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,e=this.parseName();let n,i;return this.expectOptionalToken(K.TokenKind.COLON)?(n=e,i=this.parseName()):i=e,this.node(t,{kind:J.Kind.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(K.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){return this.optionalMany(K.TokenKind.PAREN_L,t?this.parseConstArgument:this.parseArgument,K.TokenKind.PAREN_R)}parseArgument(t=!1){const e=this._lexer.token,n=this.parseName();return this.expectToken(K.TokenKind.COLON),this.node(e,{kind:J.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(K.TokenKind.SPREAD);const e=this.expectOptionalKeyword("on");return!e&&this.peek(K.TokenKind.NAME)?this.node(t,{kind:J.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:J.Kind.INLINE_FRAGMENT,typeCondition:e?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){var t;const e=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(t=this._options)||void 0===t?void 0:t.allowLegacyFragmentVariables)?this.node(e,{kind:J.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:J.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(t){const e=this._lexer.token;switch(e.kind){case K.TokenKind.BRACKET_L:return this.parseList(t);case K.TokenKind.BRACE_L:return this.parseObject(t);case K.TokenKind.INT:return this._lexer.advance(),this.node(e,{kind:J.Kind.INT,value:e.value});case K.TokenKind.FLOAT:return this._lexer.advance(),this.node(e,{kind:J.Kind.FLOAT,value:e.value});case K.TokenKind.STRING:case K.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case K.TokenKind.NAME:switch(this._lexer.advance(),e.value){case"true":return this.node(e,{kind:J.Kind.BOOLEAN,value:!0});case"false":return this.node(e,{kind:J.Kind.BOOLEAN,value:!1});case"null":return this.node(e,{kind:J.Kind.NULL});default:return this.node(e,{kind:J.Kind.ENUM,value:e.value})}case K.TokenKind.DOLLAR:if(t){if(this.expectToken(K.TokenKind.DOLLAR),this._lexer.token.kind===K.TokenKind.NAME)throw(0,H.syntaxError)(this._lexer.source,e.start,`Unexpected variable "$${this._lexer.token.value}" in constant value.`);throw this.unexpected(e)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this._lexer.advance(),this.node(t,{kind:J.Kind.STRING,value:t.value,block:t.kind===K.TokenKind.BLOCK_STRING})}parseList(t){return this.node(this._lexer.token,{kind:J.Kind.LIST,values:this.any(K.TokenKind.BRACKET_L,(()=>this.parseValueLiteral(t)),K.TokenKind.BRACKET_R)})}parseObject(t){return this.node(this._lexer.token,{kind:J.Kind.OBJECT,fields:this.any(K.TokenKind.BRACE_L,(()=>this.parseObjectField(t)),K.TokenKind.BRACE_R)})}parseObjectField(t){const e=this._lexer.token,n=this.parseName();return this.expectToken(K.TokenKind.COLON),this.node(e,{kind:J.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(t)})}parseDirectives(t){const e=[];for(;this.peek(K.TokenKind.AT);)e.push(this.parseDirective(t));return e}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const e=this._lexer.token;return this.expectToken(K.TokenKind.AT),this.node(e,{kind:J.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let e;if(this.expectOptionalToken(K.TokenKind.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(K.TokenKind.BRACKET_R),e=this.node(t,{kind:J.Kind.LIST_TYPE,type:n})}else e=this.parseNamedType();return this.expectOptionalToken(K.TokenKind.BANG)?this.node(t,{kind:J.Kind.NON_NULL_TYPE,type:e}):e}parseNamedType(){return this.node(this._lexer.token,{kind:J.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(K.TokenKind.STRING)||this.peek(K.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(K.TokenKind.BRACE_L,this.parseOperationTypeDefinition,K.TokenKind.BRACE_R);return this.node(t,{kind:J.Kind.SCHEMA_DEFINITION,description:e,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,e=this.parseOperationType();this.expectToken(K.TokenKind.COLON);const n=this.parseNamedType();return this.node(t,{kind:J.Kind.OPERATION_TYPE_DEFINITION,operation:e,type:n})}parseScalarTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:J.Kind.SCALAR_TYPE_DEFINITION,description:e,name:n,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:J.Kind.OBJECT_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(K.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(K.TokenKind.BRACE_L,this.parseFieldDefinition,K.TokenKind.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(K.TokenKind.COLON);const r=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(t,{kind:J.Kind.FIELD_DEFINITION,description:e,name:n,arguments:i,type:r,directives:s})}parseArgumentDefs(){return this.optionalMany(K.TokenKind.PAREN_L,this.parseInputValueDef,K.TokenKind.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName();this.expectToken(K.TokenKind.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(K.TokenKind.EQUALS)&&(r=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(t,{kind:J.Kind.INPUT_VALUE_DEFINITION,description:e,name:n,type:i,defaultValue:r,directives:s})}parseInterfaceTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:J.Kind.INTERFACE_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(t,{kind:J.Kind.UNION_TYPE_DEFINITION,description:e,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(K.TokenKind.EQUALS)?this.delimitedMany(K.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(t,{kind:J.Kind.ENUM_TYPE_DEFINITION,description:e,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(K.TokenKind.BRACE_L,this.parseEnumValueDefinition,K.TokenKind.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:J.Kind.ENUM_VALUE_DEFINITION,description:e,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw(0,H.syntaxError)(this._lexer.source,this._lexer.token.start,`${i(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(t,{kind:J.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:e,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(K.TokenKind.BRACE_L,this.parseInputValueDef,K.TokenKind.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===K.TokenKind.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const e=this.parseConstDirectives(),n=this.optionalMany(K.TokenKind.BRACE_L,this.parseOperationTypeDefinition,K.TokenKind.BRACE_R);if(0===e.length&&0===n.length)throw this.unexpected();return this.node(t,{kind:J.Kind.SCHEMA_EXTENSION,directives:e,operationTypes:n})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const e=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(t,{kind:J.Kind.SCALAR_TYPE_EXTENSION,name:e,directives:n})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:J.Kind.OBJECT_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:J.Kind.INTERFACE_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:J.Kind.UNION_TYPE_EXTENSION,name:e,directives:n,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:J.Kind.ENUM_TYPE_EXTENSION,name:e,directives:n,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:J.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:e,directives:n,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("directive"),this.expectToken(K.TokenKind.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(t,{kind:J.Kind.DIRECTIVE_DEFINITION,description:e,name:n,arguments:i,repeatable:r,locations:s})}parseDirectiveLocations(){return this.delimitedMany(K.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,e=this.parseName();if(Object.prototype.hasOwnProperty.call(G.DirectiveLocation,e.value))return e;throw this.unexpected(t)}node(t,e){var n;return!0!==(null===(n=this._options)||void 0===n?void 0:n.noLocation)&&(e.loc=new z.Location(t,this._lexer.lastToken,this._lexer.source)),e}peek(t){return this._lexer.token.kind===t}expectToken(t){const e=this._lexer.token;if(e.kind===t)return this._lexer.advance(),e;throw(0,H.syntaxError)(this._lexer.source,e.start,`Expected ${r(t)}, found ${i(e)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t&&(this._lexer.advance(),!0)}expectKeyword(t){const e=this._lexer.token;if(e.kind!==K.TokenKind.NAME||e.value!==t)throw(0,H.syntaxError)(this._lexer.source,e.start,`Expected "${t}", found ${i(e)}.`);this._lexer.advance()}expectOptionalKeyword(t){const e=this._lexer.token;return e.kind===K.TokenKind.NAME&&e.value===t&&(this._lexer.advance(),!0)}unexpected(t){const e=null!=t?t:this._lexer.token;return(0,H.syntaxError)(this._lexer.source,e.start,`Unexpected ${i(e)}.`)}any(t,e,n){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(n);)i.push(e.call(this));return i}optionalMany(t,e,n){if(this.expectOptionalToken(t)){const t=[];do{t.push(e.call(this))}while(!this.expectOptionalToken(n));return t}return[]}many(t,e,n){this.expectToken(t);const i=[];do{i.push(e.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(t,e){this.expectOptionalToken(t);const n=[];do{n.push(e.call(this))}while(this.expectOptionalToken(t));return n}}function i(t){const e=t.value;return r(t.kind)+(null!=e?` "${e}"`:"")}function r(t){return(0,W.isPunctuatorTokenKind)(t)?`"${t}"`:t}e.Parser=n})),it=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.printString=function(t){return`"${t.replace(n,i)}"`};const n=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function i(t){return r[t.charCodeAt(0)]}const r=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"]})),rt=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BREAK=void 0,e.getEnterLeaveForKind=i,e.getVisitFn=function(t,e,n){const{enter:r,leave:s}=i(t,e);return n?s:r},e.visit=function(t,e,r=z.QueryDocumentKeys){const s=new Map;for(const t of Object.values(J.Kind))s.set(t,i(e,t));let o,a,u,c=Array.isArray(t),h=[t],l=-1,d=[],f=t;const v=[],p=[];do{l++;const t=l===h.length,i=t&&0!==d.length;if(t){if(a=0===p.length?void 0:v[v.length-1],f=u,u=p.pop(),i)if(c){f=f.slice();let t=0;for(const[e,n]of d){const i=e-t;null===n?(f.splice(i,1),t++):f[i]=n}}else{f=Object.defineProperties({},Object.getOwnPropertyDescriptors(f));for(const[t,e]of d)f[t]=e}l=o.index,h=o.keys,d=o.edits,c=o.inArray,o=o.prev}else if(u){if(a=c?l:h[l],f=u[a],null==f)continue;v.push(a)}let w;if(!Array.isArray(f)){var m,y;(0,z.isNode)(f)||(0,Y.devAssert)(!1,`Invalid AST Node: ${(0,Z.inspect)(f)}.`);const i=t?null===(m=s.get(f.kind))||void 0===m?void 0:m.leave:null===(y=s.get(f.kind))||void 0===y?void 0:y.enter;if(w=null==i?void 0:i.call(e,f,a,u,v,p),w===n)break;if(!1===w){if(!t){v.pop();continue}}else if(void 0!==w&&(d.push([a,w]),!t)){if(!(0,z.isNode)(w)){v.pop();continue}f=w}}var b;void 0===w&&i&&d.push([a,f]),t?v.pop():(o={inArray:c,index:l,keys:h,edits:d,prev:o},c=Array.isArray(f),h=c?f:null!==(b=r[f.kind])&&void 0!==b?b:[],l=-1,d=[],u&&p.push(u),u=f)}while(void 0!==o);return 0!==d.length?d[d.length-1][1]:t},e.visitInParallel=function(t){const e=new Array(t.length).fill(null),r=Object.create(null);for(const s of Object.values(J.Kind)){let o=!1;const a=new Array(t.length).fill(void 0),u=new Array(t.length).fill(void 0);for(let e=0;e<t.length;++e){const{enter:n,leave:r}=i(t[e],s);o||(o=null!=n||null!=r),a[e]=n,u[e]=r}o&&(r[s]={enter(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const u=null===(s=a[o])||void 0===s?void 0:s.apply(t[o],i);if(!1===u)e[o]=r;else if(u===n)e[o]=n;else if(void 0!==u)return u}},leave(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const r=null===(s=u[o])||void 0===s?void 0:s.apply(t[o],i);if(r===n)e[o]=n;else if(void 0!==r&&!1!==r)return r}else e[o]===r&&(e[o]=null)}})}return r};const n=Object.freeze({});function i(t,e){const n=t[e];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:t.enter,leave:t.leave}}e.BREAK=n})),st=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.print=function(t){return(0,rt.visit)(t,n)};const n={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>i(t.definitions,"\n\n")},OperationDefinition:{leave(t){const e=s("(",i(t.variableDefinitions,", "),")"),n=i([t.operation,i([t.name,e]),i(t.directives," ")]," ");return("query"===n?"":n+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:n,directives:r})=>t+": "+e+s(" = ",n)+s(" ",i(r," "))},SelectionSet:{leave:({selections:t})=>r(t)},Field:{leave({alias:t,name:e,arguments:n,directives:r,selectionSet:a}){const u=s("",t,": ")+e;let c=u+s("(",i(n,", "),")");return c.length>80&&(c=u+s("(\n",o(i(n,"\n")),"\n)")),i([c,i(r," "),a]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+s(" ",i(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:n})=>i(["...",s("on ",t),i(e," "),n]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:n,directives:r,selectionSet:o})=>`fragment ${t}${s("(",i(n,", "),")")} on ${e} ${s("",i(r," ")," ")}`+o},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?(0,X.printBlockString)(t):(0,it.printString)(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+i(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+i(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+s("(",i(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:n})=>s("",t,"\n")+i(["schema",i(e," "),r(n)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i(["scalar",e,i(n," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:a})=>s("",t,"\n")+i(["type",e,s("implements ",i(n," & ")),i(o," "),r(a)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:n,type:r,directives:u})=>s("",t,"\n")+e+(a(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+": "+r+s(" ",i(u," "))},InputValueDefinition:{leave:({description:t,name:e,type:n,defaultValue:r,directives:o})=>s("",t,"\n")+i([e+": "+n,s("= ",r),i(o," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:a})=>s("",t,"\n")+i(["interface",e,s("implements ",i(n," & ")),i(o," "),r(a)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:n,types:r})=>s("",t,"\n")+i(["union",e,i(n," "),s("= ",i(r," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:n,values:o})=>s("",t,"\n")+i(["enum",e,i(n," "),r(o)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i([e,i(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:n,fields:o})=>s("",t,"\n")+i(["input",e,i(n," "),r(o)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:n,repeatable:r,locations:u})=>s("",t,"\n")+"directive @"+e+(a(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+(r?" repeatable":"")+" on "+i(u," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>i(["extend schema",i(t," "),r(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>i(["extend scalar",t,i(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend type",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend interface",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:n})=>i(["extend union",t,i(e," "),s("= ",i(n," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:n})=>i(["extend enum",t,i(e," "),r(n)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:n})=>i(["extend input",t,i(e," "),r(n)]," ")}};function i(t,e=""){var n;return null!==(n=null==t?void 0:t.filter((t=>t)).join(e))&&void 0!==n?n:""}function r(t){return s("{\n",o(i(t,"\n")),"\n}")}function s(t,e,n=""){return null!=e&&""!==e?t+e+n:""}function o(t){return s(" ",t.replace(/\n/g,"\n "))}function a(t){var e;return null!==(e=null==t?void 0:t.some((t=>t.includes("\n"))))&&void 0!==e&&e}})),ot=function(t){var e=t.name,n=t.type;this.uri=t.uri,this.name=e,this.type=n},at=function(t){return"undefined"!=typeof File&&t instanceof File||"undefined"!=typeof Blob&&t instanceof Blob||t instanceof ot},ut=function t(e,n,i){var r;void 0===n&&(n=""),void 0===i&&(i=at);var s=new Map;function o(t,e){var n=s.get(e);n?n.push.apply(n,t):s.set(e,t)}if(i(e))r=null,o([n],e);else{var a=n?n+".":"";if("undefined"!=typeof FileList&&e instanceof FileList)r=Array.prototype.map.call(e,(function(t,e){return o([""+a+e],t),null}));else if(Array.isArray(e))r=e.map((function(e,n){var r=t(e,""+a+n,i);return r.files.forEach(o),r.clone}));else if(e&&e.constructor===Object)for(var u in r={},e){var c=t(e[u],""+a+u,i);c.files.forEach(o),r[u]=c.clone}else r=e}return{clone:r,files:s}},ct=at,ht="object"==typeof self?self.FormData:window.FormData,lt=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultJsonSerializer=void 0,e.defaultJsonSerializer={parse:JSON.parse,stringify:JSON.stringify}})),dt=M((function(t,e){var n=U&&U.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(ht),r=function(t){return ct(t)||null!==t&&"object"==typeof t&&"function"==typeof t.pipe};e.default=function(t,e,n,s){void 0===s&&(s=lt.defaultJsonSerializer);var o=ut({query:t,variables:e,operationName:n},"",r),a=o.clone,u=o.files;if(0===u.size){if(!Array.isArray(t))return s.stringify(a);if(void 0!==e&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");var c=t.reduce((function(t,n,i){return t.push({query:n,variables:e?e[i]:void 0}),t}),[]);return s.stringify(c)}var h=new("undefined"==typeof FormData?i.default:FormData);h.append("operations",s.stringify(a));var l={},d=0;return u.forEach((function(t){l[++d]=t})),h.append("map",s.stringify(l)),d=0,u.forEach((function(t,e){h.append(""+ ++d,e)})),h}})),ft=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchRequestsExtendedArgs=e.parseRawRequestExtendedArgs=e.parseRequestExtendedArgs=e.parseBatchRequestArgs=e.parseRawRequestArgs=e.parseRequestArgs=void 0,e.parseRequestArgs=function(t,e,n){return t.document?t:{document:t,variables:e,requestHeaders:n,signal:void 0}},e.parseRawRequestArgs=function(t,e,n){return t.query?t:{query:t,variables:e,requestHeaders:n,signal:void 0}},e.parseBatchRequestArgs=function(t,e){return t.documents?t:{documents:t,requestHeaders:e,signal:void 0}},e.parseRequestExtendedArgs=function(t,e,n,i){return t.document?t:{url:t,document:e,variables:n,requestHeaders:i,signal:void 0}},e.parseRawRequestExtendedArgs=function(t,e,n,i){return t.query?t:{url:t,query:e,variables:n,requestHeaders:i,signal:void 0}},e.parseBatchRequestsExtendedArgs=function(t,e,n){return t.documents?t:{url:t,documents:e,requestHeaders:n,signal:void 0}}})),vt=M((function(t,e){var n,i=U&&U.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.ClientError=void 0;var r=function(t){function e(n,i){var r=this,s=e.extractMessage(n)+": "+JSON.stringify({response:n,request:i});return r=t.call(this,s)||this,Object.setPrototypeOf(r,e.prototype),r.response=n,r.request=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return i(e,t),e.extractMessage=function(t){try{return t.errors[0].message}catch(e){return"GraphQL Error (Code: "+t.status+")"}},e}(Error);e.ClientError=r})),pt=M((function(t,e){var n=U&&U.__assign||function(){return(n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},i=U&&U.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=U&&U.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=U&&U.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return r(e,t),e},o=U&&U.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((i=i.apply(t,e||[])).next())}))},a=U&&U.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},u=U&&U.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n},c=U&&U.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.gql=e.batchRequests=e.request=e.rawRequest=e.GraphQLClient=e.ClientError=void 0;var h=s(P),l=h,d=c(dt);Object.defineProperty(e,"ClientError",{enumerable:!0,get:function(){return vt.ClientError}});var f=function(t){var e={};return t&&("undefined"!=typeof Headers&&t instanceof Headers||t instanceof l.Headers?e=function(t){var e={};return t.forEach((function(t,n){e[n]=t})),e}(t):Array.isArray(t)?t.forEach((function(t){e[t[0]]=t[1]})):e=t),e},v=function(t){return t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim()},p=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,u=t.headers,c=t.fetch,h=t.fetchOptions;return o(void 0,void 0,void 0,(function(){var t;return a(this,(function(o){switch(o.label){case 0:return t=d.default(i,r,s,h.jsonSerializer),[4,c(e,n({method:"POST",headers:n(n({},"string"==typeof t?{"Content-Type":"application/json"}:{}),u),body:t},h))];case 1:return[2,o.sent()]}}))}))},m=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,u=t.headers,c=t.fetch,h=t.fetchOptions;return o(void 0,void 0,void 0,(function(){var t;return a(this,(function(o){switch(o.label){case 0:return t=function(t){var e=t.query,n=t.variables,i=t.operationName,r=t.jsonSerializer;if(!Array.isArray(e)){var s=["query="+encodeURIComponent(v(e))];return n&&s.push("variables="+encodeURIComponent(r.stringify(n))),i&&s.push("operationName="+encodeURIComponent(i)),s.join("&")}if(void 0!==n&&!Array.isArray(n))throw new Error("Cannot create query with given variable type, array expected");var o=e.reduce((function(t,e,i){return t.push({query:v(e),variables:n?r.stringify(n[i]):void 0}),t}),[]);return"query="+encodeURIComponent(r.stringify(o))}({query:i,variables:r,operationName:s,jsonSerializer:h.jsonSerializer}),[4,c(e+"?"+t,n({method:"GET",headers:u},h))];case 1:return[2,o.sent()]}}))}))},y=function(){function t(t,e){this.url=t,this.options=e||{}}return t.prototype.rawRequest=function(t,e,i){return o(this,void 0,void 0,(function(){var r,s,o,c,l,d,v,p,m,y;return a(this,(function(){return r=ft.parseRawRequestArgs(t,e,i),o=(s=this.options).headers,l=void 0===(c=s.fetch)?h.default:c,v=void 0===(d=s.method)?"POST":d,p=u(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(p.signal=r.signal),y=E(r.query).operationName,[2,b({url:m,query:r.query,variables:r.variables,headers:n(n({},f(o)),f(r.requestHeaders)),operationName:y,fetch:l,method:v,fetchOptions:p})]}))}))},t.prototype.request=function(t,e,i){return o(this,void 0,void 0,(function(){var r,s,o,c,l,d,v,p,m,y,w;return a(this,(function(a){switch(a.label){case 0:return r=ft.parseRequestArgs(t,e,i),o=(s=this.options).headers,l=void 0===(c=s.fetch)?h.default:c,v=void 0===(d=s.method)?"POST":d,p=u(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(p.signal=r.signal),y=E(r.document),w=y.operationName,[4,b({url:m,query:y.query,variables:r.variables,headers:n(n({},f(o)),f(r.requestHeaders)),operationName:w,fetch:l,method:v,fetchOptions:p})];case 1:return[2,a.sent().data]}}))}))},t.prototype.batchRequests=function(t,e){return o(this,void 0,void 0,(function(){var i,r,s,o,c,l,d,v,p,m,y;return a(this,(function(a){switch(a.label){case 0:return i=ft.parseBatchRequestArgs(t,e),s=(r=this.options).headers,c=void 0===(o=r.fetch)?h.default:o,d=void 0===(l=r.method)?"POST":l,v=u(r,["headers","fetch","method"]),p=this.url,void 0!==i.signal&&(v.signal=i.signal),m=i.documents.map((function(t){return E(t.document).query})),y=i.documents.map((function(t){return t.variables})),[4,b({url:p,query:m,variables:y,headers:n(n({},f(s)),f(i.requestHeaders)),operationName:void 0,fetch:c,method:d,fetchOptions:v})];case 1:return[2,a.sent().data]}}))}))},t.prototype.setHeaders=function(t){return this.options.headers=t,this},t.prototype.setHeader=function(t,e){var n,i=this.options.headers;return i?i[t]=e:this.options.headers=((n={})[t]=e,n),this},t.prototype.setEndpoint=function(t){return this.url=t,this},t}();function b(t){var e=t.url,i=t.query,r=t.variables,s=t.headers,u=t.operationName,c=t.fetch,h=t.method,l=void 0===h?"POST":h,d=t.fetchOptions;return o(this,void 0,void 0,(function(){var t,o,h,f,v,y,b;return a(this,(function(a){switch(a.label){case 0:return t="POST"===l.toUpperCase()?p:m,o=Array.isArray(i),[4,t({url:e,query:i,variables:r,operationName:u,headers:s,fetch:c,fetchOptions:d})];case 1:return[4,g(h=a.sent(),d.jsonSerializer)];case 2:if(f=a.sent(),v=o&&Array.isArray(f)?!f.some((function(t){return!t.data})):!!f.data,h.ok&&!f.errors&&v)return y=h.headers,b=h.status,[2,n(n({},o?{data:f}:f),{headers:y,status:b})];throw new vt.ClientError(n(n({},"string"==typeof f?{error:f}:f),{status:h.status,headers:h.headers}),{query:i,variables:r})}}))}))}function w(t,e,i,r){return o(this,void 0,void 0,(function(){var s;return a(this,(function(){return s=ft.parseRequestExtendedArgs(t,e,i,r),[2,new y(s.url).request(n({},s))]}))}))}function g(t,e){return void 0===e&&(e=lt.defaultJsonSerializer),o(this,void 0,void 0,(function(){var n,i,r;return a(this,(function(s){switch(s.label){case 0:return t.headers.forEach((function(t,e){"content-type"===e.toLowerCase()&&(n=t)})),n&&n.toLowerCase().startsWith("application/json")?(r=(i=e).parse,[4,t.text()]):[3,2];case 1:return[2,r.apply(i,[s.sent()])];case 2:return[2,t.text()]}}))}))}function O(t){var e,n=void 0,i=t.definitions.filter((function(t){return"OperationDefinition"===t.kind}));return 1===i.length&&(n=null===(e=i[0].name)||void 0===e?void 0:e.value),n}function E(t){if("string"==typeof t){var e=void 0;try{e=O(nt.parse(t))}catch(t){}return{query:t,operationName:e}}var n=O(t);return{query:st.print(t),operationName:n}}e.GraphQLClient=y,e.rawRequest=function(t,e,i,r){return o(this,void 0,void 0,(function(){var s;return a(this,(function(){return s=ft.parseRawRequestExtendedArgs(t,e,i,r),[2,new y(s.url).rawRequest(n({},s))]}))}))},e.request=w,e.batchRequests=function(t,e,i){return o(this,void 0,void 0,(function(){var r;return a(this,(function(){return r=ft.parseBatchRequestsExtendedArgs(t,e,i),[2,new y(r.url).batchRequests(n({},r))]}))}))},e.default=w,e.gql=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.reduce((function(t,n,i){return""+t+n+(i in e?e[i]:"")}),"")}}));class mt{constructor(){this.watingRequestsById=new Map}static get(){if(!mt.instance){mt.instance=new mt;const t=document.querySelector(this.appTagName);null===t?mt.instance.resume():(t.addEventListener("applicationLoading",(()=>mt.instance.pause())),t.addEventListener("applicationLoaded",(()=>mt.instance.resume())))}return this.instance}async callGraphQL(t){var e;const n=this.getReqKey(t);return t.queryID=n,t.values.queryID=n,this.ready?new Promise((async(e,i)=>{let r=this.getQueryTemplate(t);const s=await this.fecthGrapql([{document:r,variables:t.values}]);s.errors.length>0?i(s):e(s.data[0][n])})):(this.watingRequestsById.has(n)||this.watingRequestsById.set(n,new yt(t)),null===(e=this.getWatingRequest(n))||void 0===e?void 0:e.promise)}getReqKey(t){return window.btoa(this.hashCode(`${t.query}${JSON.stringify(t.values||"")}`)).replace(/=/g,"")}getQueryTemplate(t){return(t.query||"").replaceAll("$queryAlias$",t.queryID)}getWatingRequest(t){return this.watingRequestsById.get(t)}pause(){this.ready=!1}async resume(){if(this.ready=!0,this.watingRequestsById.size>0){const t=[];let e;this.watingRequestsById.forEach((async e=>{let n=this.getQueryTemplate(e.request);t.push({document:n,variables:Object.assign({},e.request.values)})}));let n=[],i=[];e=await this.fecthGrapql(t),n=e.data,i=e.errors,i.forEach((t=>{Object.entries(t).forEach((([t,e])=>{var n;((null===(n=this.getWatingRequest(e.request.variables[e.index].queryID))||void 0===n?void 0:n.reject)||Promise.reject)(e)}))})),n.forEach((t=>{Object.entries(t).forEach((([t,e])=>{var n;((null===(n=this.getWatingRequest(t))||void 0===n?void 0:n.resolve)||Promise.resolve)(e)}))})),this.watingRequestsById.clear()}}async fecthGrapql(t){let e,n=[],i=[];try{e=await pt.batchRequests("http://localhost:8082/",t),e.forEach((t=>{n.push(t.data)}))}catch(t){e=t.response;const r=t.request;Object.entries(e).forEach((([t,e])=>{e.errors?i.push(e.errors.map((e=>(e.request=r,e.index=Number(t),e)))):e.data&&n.push(e.data)}))}return{data:n,errors:i}}hashCode(t){var e,n=0;if(0===t.length)return n.toString();for(e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return n.toString()}}mt.appTagName="snk-application";class yt{constructor(t){this._resolve=()=>{},this._reject=()=>{},this._request=void 0,this._request=t,this._promisse=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}get resolve(){return this._resolve}get reject(){return this._reject}get promise(){return this._promisse}get request(){return this._request}}class bt{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchDataUnit",pt.gql`query($name: String!) {
2
+ $queryAlias$: fetchDataUnit(name: $name){
3
+ name
4
+ fields{
5
+ name
6
+ defaultValue
7
+ label
8
+ readOnly
9
+ required
10
+ dataType
11
+ userInterface
12
+ properties{
13
+ name
14
+ value
15
+ }
16
+ dependencies{
17
+ masterFields
18
+ type
19
+ expression
20
+ }
21
+ }
22
+ }
23
+ }`),this.templateByQuery.set("fetchData",pt.gql`query($dataunit: String! $first: Int $offset:Int $filter: [Filter!] $sort: [Sort!]) {
24
+ $queryAlias$: fetchDataUnit(name: $dataunit){
25
+ data(first: $first offset: $offset filters: $filter sort: $sort){
26
+ first
27
+ offset
28
+ total
29
+ hasMore
30
+ records{
31
+ id
32
+ fields {
33
+ name
34
+ value
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }`),this.templateByQuery.set("saveData",pt.gql`mutation($changes: [Change!]!) {
40
+ $queryAlias$: saveDataUnitChanges(changes: $changes){
41
+ oldId
42
+ id
43
+ fields {
44
+ name
45
+ value
46
+ }
47
+ }
48
+ }`)}getDataUnit(t,e){const n=new F(`dd://${t}/${e}`);return n.metadataLoader=t=>this.loadMetadata(t),n.dataLoader=(t,e,n)=>this.loadData(t,e,n),n.saveLoader=(t,e)=>this.saveData(t,e),n.removeLoader=(t,e)=>this.removeRecords(t,e),n}loadMetadata(t){return new Promise(((e,n)=>{mt.get().callGraphQL({values:{name:t.name},query:this.templateByQuery.get("fetchDataUnit")}).then((t=>{var n;const i={name:t.name,label:t.name,fields:[]};null===(n=t.fields)||void 0===n||n.forEach((t=>{let e;Array.isArray(t.properties)&&(e={},t.properties.forEach((t=>e[t.name]=t.value))),i.fields.push(Object.assign(Object.assign({},t),{properties:e}))})),e(i)})).catch((t=>{n(t)}))}))}loadData(t,e,n){return new Promise(((i,r)=>{mt.get().callGraphQL({values:{dataunit:t.name,sort:e,filters:n},query:this.templateByQuery.get("fetchData")}).then((e=>{const n=[];e.data.records.forEach((e=>{const i={__record__id__:e.id};e.fields.forEach((({name:e,value:n})=>{i[e]=t.valueFromString(e,n)})),n.push(i)})),i(n)})).catch((t=>{r(t)}))}))}saveData(t,e){const n=e.map((t=>{const{dataUnit:e,record:n,updatingFields:i,operation:r}=t;return{dataUnit:e,updatingFields:Object.entries(i).map((([t,e])=>({fieldName:t,value:this.formatValueToServer(e)}))),operation:r,recordId:n.__record__id__}}));return new Promise(((e,i)=>{mt.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((n=>{const i=[];null==n||n.forEach((e=>{const n={__record__id__:e.id};e.oldId&&(n.__old__id__=e.oldId),e.fields.forEach((({name:e,value:i})=>{n[e]=t.valueFromString(e,i)})),i.push(n)})),e(i)})).catch((t=>{i(t)}))}))}formatValueToServer(t){if(void 0===t)return t;try{if(t instanceof Date)return t.toString();t=JSON.stringify(t)}catch(e){t=t.toString()}return t}removeRecords(t,e){const n=e.map((e=>({dataUnit:t.name,operation:A.DELETE,recordId:e})));return new Promise(((t,i)=>{mt.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((()=>{t(e)})).catch((t=>{i(t)}))}))}}class wt{static openAppActivity(t,e){var n;null===(n=window.workspace)||void 0===n||n.openAppActivity(t,e)}}wt.resourceID=window.workspace.resourceID;class gt{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",pt.gql`query($name: String!) {
49
+ $queryAlias$: fetchResource(name: $name){
50
+ name
51
+ resource
52
+ }
53
+ }`)}async getParam(t,e){const n=`param://${e}?params=${window.btoa(t)}`;return mt.get().callGraphQL({values:{name:n},query:this.templateByQuery.get("fetchParam")})}async asString(t,e){const n=await this.getParam(t,e);return this.getValue(n)}async asInteger(t,e){const n=await this.getParam(t,e);return parseInt(this.getValue(n))}async asFloat(t,e){const n=await this.getParam(t,e);return parseFloat(this.getValue(n))}async asBoolean(t,e){const n=await this.getParam(t,e);return"S"==this.getValue(n)}async asDate(t,e){const n=await this.getParam(t,e);return r.strToDate(this.getValue(n))}async getBatchParams(t,e){const n=await this.getParam(t.join(","),e),i={};return n.forEach((t=>i[t.name]=t.resource)),i}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),class{static isEmpty(t){return null==t||null===t||0===(t=(t=t.toString()).trim()).length}static replaceAccentuatedChars(t){return(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.toUpperCase()).replace(/[À]/,"A")).replace(/[Á]/,"A")).replace(/[Â]/,"A")).replace(/[Ã]/,"A")).replace(/[Ä]/,"A")).replace(/[È]/,"E")).replace(/[É]/,"E")).replace(/[Ê]/,"E")).replace(/[Ë]/,"E")).replace(/[Ì]/,"I")).replace(/[Í]/,"I")).replace(/[Î]/,"I")).replace(/[Ï]/,"I")).replace(/[Ò]/,"O")).replace(/[Ó]/,"O")).replace(/[Ô]/,"O")).replace(/[Ö]/,"O")).replace(/[Ù]/,"U")).replace(/[Ú]/,"U")).replace(/[Û]/,"U")).replace(/[Ü]/,"U")).replace(/[Ç]/,"C")).replace(/[^a-z0-9]/gi,"")}}.isEmpty(t.resource)?"":t.resource}}class Ot{static async showDialog(t,e,n=null,i,r=!1){return new Promise((s=>{let o=document.querySelector("ez-dialog");o||(o=document.createElement("ez-dialog"),window.document.body.appendChild(o)),o.show(t,e,r,i,n).then((t=>s(t)))}))}static async alert(t,e,n=null){return Ot.showDialog(t,e,n,!1,!1)}static async error(t,e,n=null){return Ot.showDialog(t,e,n,!1,!0)}static async confirm(t,e,n=null,i=!1){return Ot.showDialog(t,e,n,!0,i)}static async info(t){let e=document.querySelector("ez-toast");e||(e=document.createElement("ez-toast"),window.document.body.appendChild(e)),e.message=t,e.fadeTime=4e3,e.show()}}class Et extends class{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchResource",pt.gql`query($name: String!) {
54
+ $queryAlias$: fetchResource(name: $name){
55
+ resource
56
+ }
57
+ }`)}loadResource(t){return new Promise(((e,n)=>{mt.get().callGraphQL({values:{name:t},query:this.templateByQuery.get("fetchResource")}).then((t=>{e(null==t?void 0:t.resource)})).catch((t=>{n(t)}))}))}}{loadFormConfig(t,e){return new Promise(((n,i)=>{this.loadResource(`cfg://form/${e}/${t}`).then((e=>{if(e){const t=JSON.parse(e),{tabs:i,fields:r}=t;if(i){const t=new Map(i.map((t=>[t.label,t])));r.forEach((e=>e.tab=t.get(e.tab)))}n(r)}else i(`Sem configuração pro formulário "${t}".`)})).catch((t=>{i(t)}))}))}}const Tt={ImplantacaoSaldoConta:[{value:6,label:"Conta Financeiro"},{value:7,label:"Conta Banco do Brasil"}],HistoricoBancario:[{value:9,label:"Lanç. Origem"},{value:8,label:"Lanç. Origem 2"}],ContaDestino:[{value:10,label:"Conta BB"},{value:7,label:"Conta Santander"}],HistoricoBancarioDestino:[{value:11,label:"Contra Bradesco"},{value:13,label:"Contra Destino"}],Usuario:[{value:0,label:"SUP"}],ContaBancaria:[{value:10,label:"Conta 10"},{value:17,label:"Conta 17"}],TipoOperacao:[{value:4,label:"Entrada NFse"},{value:5,label:"Outra top"},{value:6,label:"Top 6"}]},Dt=(t,e,n)=>{var i;console.log(t);const r=null===(i=n.getField(e).properties)||void 0===i?void 0:i.ENTITYNAME;return Tt[r]||[]},St=class{constructor(n){t(this,n),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7)}get parameters(){return this._parameters||(this._parameters=new gt),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||wt.resourceID||"unknown.resource.id"),this._resourceID}async getStringParam(t){return this.parameters.asString(t,this.resourceID)}async getIntParam(t){return this.parameters.asInteger(t,this.resourceID)}async getFloatParam(t){return this.parameters.asFloat(t,this.resourceID)}async getBooleanParam(t){return this.parameters.asBoolean(t,this.resourceID)}async getDateParam(t){return this.parameters.asDate(t,this.resourceID)}async temOpcional(t){const e=t.split(",");return new Promise(((t,n)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{n(t)}))})).catch((t=>{n(t)}))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){wt.openAppActivity(t,e)}async createDataunit(t){return new Promise((e=>{const n=this.dataUnitFetcher.getDataUnit(t,this.resourceID);n.loadMetadata(),e(n)}))}async getResourceID(){return Promise.resolve(this.resourceID)}async alert(t,e,n){return Ot.alert(t,e,n)}async error(t,e,n){return Ot.error(t,e,n)}async confirm(t,e,n,i){return Ot.confirm(t,e,n,i)}async info(t){return Ot.info(t)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}get urlParams(){return this._urlParams||(this._urlParams=class{static getQueryParams(t){const e=new Map,n=/[?&]?([^=]+)=([^&]*)/g;let i;for(t=(t=window.unescape(t)).split("+").join(" ");i=n.exec(t);)e.set(window.decodeURIComponent(i[1]),i[2]);return e.set("urlBase",this.getUrlBase()),window.moduleID&&window.URIServiceBroker&&(e.set("moduleID",window.moduleID),e.set("URIServiceBroker",window.URIServiceBroker)),e}static getUrlBase(){return`${location.protocol}"//"${location.hostname}${location.port?":"+location.port:""}`}}.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new bt),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new Et),this._formConfigFetcher}componentWillLoad(){C.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",Dt)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return n("div",null)}};St.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{St as snk_application}
@@ -1 +1 @@
1
- import{p as a,b as t}from"./p-5fa264b9.js";(()=>{const t=import.meta.url,r={};return""!==t&&(r.resourcesUrl=new URL(".",t).href),a(r)})().then((a=>t([["p-4984305e",[[2,"snk-application",{getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],temOpcional:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getResourceID:[64],alert:[64],error:[64],confirm:[64],info:[64],loadFormConfig:[64]}]]]],a)));
1
+ import{p as a,b as t}from"./p-5fa264b9.js";(()=>{const t=import.meta.url,r={};return""!==t&&(r.resourcesUrl=new URL(".",t).href),a(r)})().then((a=>t([["p-f3bdd8c3",[[2,"snk-application",{getStringParam:[64],getIntParam:[64],getFloatParam:[64],getBooleanParam:[64],getDateParam:[64],temOpcional:[64],getAttributeFromHTMLWrapper:[64],openApp:[64],createDataunit:[64],getResourceID:[64],alert:[64],error:[64],confirm:[64],info:[64],loadFormConfig:[64]}]]]],a)));
@@ -7,4 +7,6 @@ export default class DataUnitFetcher {
7
7
  private loadMetadata;
8
8
  private loadData;
9
9
  private saveData;
10
+ private formatValueToServer;
11
+ private removeRecords;
10
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sankhyalabs/sankhyablocks",
3
- "version": "1.1.20",
3
+ "version": "1.1.23",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "graphql-request": "^4.2.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@sankhyalabs/ezui": "^1.1.100",
37
+ "@sankhyalabs/ezui": "^1.1.99",
38
38
  "@types/jest": "^27.0.3",
39
39
  "jest": "^27.4.5",
40
40
  "jest-cli": "^27.4.5",
@@ -1,57 +0,0 @@
1
- import{r as t,c as e,h as n}from"./p-5fa264b9.js";class i{constructor(t){this._mask="",this._maskChars=new Array,this.placeholder=" ",this.mask=t}set mask(t){this._mask=t,this.updateInternalMask()}get mask(){return this._mask}format(t){let e="";const n=[0];let i=0;const r=this._maskChars.length;for(;i<r;)e=this._maskChars[i].append(e,t,n),i++;return e}updateInternalMask(){if(this._maskChars.length=0,null!=this.mask){let t=0;const e=this.mask.length;for(;t<e;){let n=this.mask.charAt(t);switch(n){case i.DIGIT_KEY:this._maskChars.push(new i.DigitMaskCharacter(this,n));break;case i.LITERAL_KEY:++t<e&&(n=this.mask.charAt(t),this._maskChars.push(new i.LiteralCharacter(this,n)));break;case i.UPPERCASE_KEY:this._maskChars.push(new i.UpperCaseCharacter(this,n));break;case i.LOWERCASE_KEY:this._maskChars.push(new i.LowerCaseCharacter(this,n));break;case i.ALPHA_NUMERIC_KEY:this._maskChars.push(new i.AlphaNumericCharacter(this,n));break;case i.CHARACTER_KEY:this._maskChars.push(new i.CharCharacter(this,n));break;case i.ANYTHING_KEY:this._maskChars.push(new i.MaskCharacter(this,n));break;default:this._maskChars.push(new i.LiteralCharacter(this,n))}t++}}}}i.DIGIT_KEY="#",i.LITERAL_KEY="'",i.UPPERCASE_KEY="U",i.LOWERCASE_KEY="L",i.ALPHA_NUMERIC_KEY="A",i.CHARACTER_KEY="?",i.ANYTHING_KEY="*",i.MaskCharacter=class{constructor(t,e){this.maskFormatter=t,this.type=e}isLiteral(){return!1}isValidCharacter(t){return this.isLiteral()?this.getChar(t)==t:(t=this.getChar(t),!0)}getChar(t){return t}append(t,e,n){const i=n[0]<e.length?e.charAt(n[0]):"";if(this.isLiteral()){const e=this.getChar(i);t+=e,e===i&&(n[0]=n[0]+1)}else if(n[0]>=e.length)t+=this.maskFormatter.placeholder,n[0]=n[0]+1;else{if(!this.isValidCharacter(i))throw new Error(`Valor inválido: "${i}". Na posição ${n[0]+1} espera-se ${this.getFormatMessage()}.`);t+=this.getChar(i),n[0]=n[0]+1}return t}getFormatMessage(){let t;switch(this.type){case i.UPPERCASE_KEY:case i.LOWERCASE_KEY:case i.CHARACTER_KEY:t="uma letra";break;case i.DIGIT_KEY:t="um número";break;case i.ALPHA_NUMERIC_KEY:t="uma letra ou um número";break;default:t=""}return t}},i.LiteralCharacter=class extends i.MaskCharacter{constructor(t,e){super(t,e),this._fixedChar=e}isLiteral(){return!0}getChar(t){return this._fixedChar}},i.DigitMaskCharacter=class extends i.MaskCharacter{isValidCharacter(t){return this.isDigit(t)&&super.isValidCharacter(t)}isDigit(t){return t>="0"&&t<="9"}},i.UpperCaseCharacter=class extends i.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}getChar(t){return t.toUpperCase()}},i.LowerCaseCharacter=class extends i.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}getChar(t){return t.toLocaleLowerCase()}},i.AlphaNumericCharacter=class extends i.MaskCharacter{isValidCharacter(t){return/[a-z0-9]/i.test(t)&&super.isValidCharacter(t)}},i.CharCharacter=class extends i.MaskCharacter{isValidCharacter(t){return/[a-z]/i.test(t)&&super.isValidCharacter(t)}};class r{static clearTime(t,e=!0){const n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0);return e?r.adjustDLST(n):n}static strToDate(t,e=!0,n=!1){let i;if(i=n?/^(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(t):/^(3[01]|[1-2]\d|0[1-9]|[1-9])[^\d]?(1[0-2]|0[1-9]|[1-9])[^\d]?(\d{2}|\d{4})(?:\s(\d{1,2}):(\d{1,2}):?(\d{0,2}))?$/.exec(t),!i)return;var s=n?1:Number(i[1]),o=Number(i[n?1:2]),a=Number(i[n?2:3]),u=Number(i[n?3:4]||0),c=Number(i[n?4:5]||0),h=Number(i[n?5:6]||0);a<100&&(a+=a<30?2e3:1900);let l=new Date(a,o-1,s,u,c,h,0);return!0!==e||n||0!=u||(l=r.adjustDLST(l)),l}static adjustDLST(t){return 23==t.getHours()?new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,1,0,0,0):t}}var s,o;new i("##:##"),function(t){t[t.GET=0]="GET",t[t.PUT=1]="PUT",t[t.POST=2]="POST",t[t.DELETE=3]="DELETE"}(s||(s={})),function(t){t.NUMBER="NUMBER",t.DATE="DATE",t.TEXT="TEXT",t.BOOLEAN="BOOLEAN",t.OBJECT="OBJECT"}(o||(o={}));const a=(t,e)=>{if(null==e)return e;switch(t){case o.NUMBER:return""===e||isNaN(e)?null:Number(e);case o.OBJECT:return"string"==typeof e?JSON.parse(e):e;case o.BOOLEAN:return Boolean(e);case o.DATE:return new Date(e.toString());default:return e}};class u{constructor(t,e){this._type=t,this._payload=e}get type(){return this._type}get payload(){return this._payload}}var c;!function(t){t.LOADING_METADATA="loadingMetadata",t.METADATA_LOADED="metadataLoaded",t.LOADING_DATA="loadingData",t.DATA_LOADED="dataLoaded",t.SAVING_DATA="savingData",t.DATA_SAVED="dataSaved",t.RECORDS_REMOVED="recordsRemoved",t.RECORDS_ADDED="recordsAdded",t.RECORDS_COPIED="recordsCopied",t.DATA_CHANGED="dataChanged",t.EDITION_CANCELED="editionCanceled",t.CHANGE_UNDONE="changeUndone",t.CHANGE_REDONE="changeRedone",t.SELECTION_CHANGED="selectionChanged",t.NEXT_SELECTED="nextSelected",t.PREVIOUS_SELECTED="previousSelected",t.STATE_CHANGED="stateChanged"}(c||(c={}));class h{constructor(t){this._past=[],this._future=[],this._present={},this._nonHist={},this._histClean=!1,this._reducers=t}process(t){const e=this._present;let n=!1;this._histClean=!1,this._reducers.forEach((e=>{const i=e.sliceName,r=this.isHistoric(i),s=this.getSlice(i,r),o=e.reduce(this,s,t);o!==s&&(this.updateSlice(i,o,r),n||(n=r))})),n&&!this._histClean&&(this._past.push(e),this._future=[],document.dispatchEvent(new CustomEvent("undoableAction",{detail:this})))}select(t,e){const n=this.isHistoric(t);return e(this.getSlice(t,n))}isHistoric(t){return t.startsWith("hist::")}updateSlice(t,e,n){n?(this._present=Object.assign(Object.assign({},this._present),{[t]:e}),void 0===e&&delete this._present[t]):(this._nonHist=Object.assign(Object.assign({},this._nonHist),{[t]:e}),void 0===e&&delete this._nonHist[t])}getSlice(t,e){return e?this._present[t]:this._nonHist[t]}canUndo(){return this._past.length>0}canRedo(){return this._future.length>0}undo(){this.canUndo()&&(this._future.push(this._present),this._present=this._past.pop())}redo(){this.canRedo()&&(this._past.push(this._present),this._present=this._future.pop())}clearUndo(){this._histClean=!0,this._past=[],this._future=[]}persist(){}}const l=new class{constructor(){this.sliceName=""}reduce(t,e,n){switch(n.type){case c.DATA_SAVED:case c.EDITION_CANCELED:t.clearUndo();break;case c.CHANGE_UNDONE:t.undo();break;case c.CHANGE_REDONE:t.redo()}}},d=new class{constructor(){this.sliceName="unitMetadata"}reduce(t,e,n){return n.type===c.METADATA_LOADED?n.payload:e}},f=t=>t.select(d.sliceName,(t=>t)),v=new class{constructor(){this.sliceName="hist::removedRecords"}reduce(t,e,n){switch(n.type){case c.RECORDS_REMOVED:return(e||[]).concat(n.payload);case c.EDITION_CANCELED:case c.DATA_SAVED:return}return e}},p=t=>t.select(v.sliceName,(t=>t)),m=new class{constructor(){this.sliceName="records"}reduce(t,e,n){switch(n.type){case c.DATA_LOADED:return n.payload;case c.DATA_SAVED:const e=new Map,i=y(t);if(i){const n=p(t)||[];i.forEach((t=>{n.includes(t.__record__id__)||e.set(t.__record__id__,t)}))}return n.payload.records.forEach((t=>{const n=t.__old__id__||t.__record__id__,i=Object.assign({},t);delete i.__old__id__,e.set(n,i)})),Array.from(e.values())}return e}},y=t=>t.select(m.sliceName,(t=>t)),b=new class{constructor(){this.sliceName="hist::addedRecords"}reduce(t,e,n){switch(n.type){case c.RECORDS_ADDED:case c.RECORDS_COPIED:return(e||[]).concat(n.payload);case c.DATA_SAVED:case c.EDITION_CANCELED:return}return e}},w=t=>t.select(b.sliceName,(t=>t)),g=(t,e)=>{let n=(w(t)||[]).length;return e.map((t=>Object.assign(Object.assign({},t),{__record__id__:"NEW_"+n++})))},O=new class{constructor(){this.sliceName="hist::changes"}reduce(t,e,n){switch(n.type){case c.DATA_CHANGED:const i=n.payload.records||j(t);if(i){const t=new Map(e);return i.forEach((e=>{const i=Object.assign(Object.assign({},t.get(e)),n.payload);delete i.records,t.set(e,i)})),t}return e;case c.DATA_SAVED:case c.EDITION_CANCELED:return}return e}},E=t=>t.select(O.sliceName,(t=>t)),T=new class{constructor(){this.sliceName="currentRecords"}reduce(t,e,n){let i=y(t);const r=w(t);if(!i&&!r)return;r&&(i=(i||[]).concat(r));const s=p(t);s&&(i=i.filter((t=>!s.includes(t.__record__id__))));const o=E(t);return new Map(i.map((t=>{const e=t.__record__id__;return[e,Object.assign(Object.assign({},t),null==o?void 0:o.get(e))]})))}},D=t=>t.select(T.sliceName,(t=>t)),S=new class{constructor(){this.sliceName="hist::selection"}reduce(t,e,n){switch(n.type){case c.RECORDS_ADDED:case c.RECORDS_COPIED:return n.payload.map((t=>t.__record__id__));case c.DATA_SAVED:return function(t,e){const n=j(t);if(n){const t=[];return n.forEach((n=>{const i=e.find((t=>t.__old__id__===n));t.push(i?i.__record__id__:n)})),t}return n}(t,n.payload.records);case c.RECORDS_REMOVED:const i=n.payload;return e&&i?e.filter((t=>!i.includes(t))):e;case c.NEXT_SELECTED:case c.PREVIOUS_SELECTED:const r=D(t);if(r&&r.size>0){let t;if(t=e&&0!==e.length?I(e[0],r)+(n.type===c.PREVIOUS_SELECTED?-1:1):n.type===c.PREVIOUS_SELECTED?0:Math.min(1,r.size),t<r.size&&t>=0)return[Array.from(r.values())[t].__record__id__]}return;case c.SELECTION_CHANGED:const{type:s,selection:o}=n.payload;if(o&&"index"===s){const e=D(t);if(e){const t=Array.from(e.values()),n=[];return o.forEach((i=>{i>0&&i<e.size&&n.push(t[i].__record__id__)})),n}}return o}return e}},j=t=>{let e=t.select(S.sliceName,(t=>t));const n=Array.from((D(t)||new Map).keys());return e&&(e=e.filter((t=>n.includes(t)))),(!e||0===e.length)&&n&&n.length>0?[n[0]]:e};function I(t,e){return Array.from(e.keys()).indexOf(t)}var A,x,k,_,N=function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((i=i.apply(t,e||[])).next())}))};class F{constructor(t){this._name=t,this._stateManager=new h([l,d,m,v,b,S,O,T]),this._observers=[],this._filterProviders=[],this._sortingProvider=void 0,this._interceptors=[]}get name(){return this._name}validateAndTypeValue(t,e){const n=this.getField(t);return n?a(n.dataType,e):e}getFilters(){let t;return this._filterProviders.forEach((e=>{const n=e.getFilter(this.name);n&&(t=(t||[]).concat(n))})),t}getSort(){return this._sortingProvider?this._sortingProvider.getSort(this._name):void 0}loadMetadata(){return N(this,void 0,void 0,(function*(){return this.dispatchAction(c.LOADING_METADATA),new Promise(((t,e)=>{this.metadataLoader&&this.metadataLoader(this).then((e=>{this.metadata=e,t(this.metadata)})).catch((t=>e(t)))}))}))}loadData(){return N(this,void 0,void 0,(function*(){return this.dispatchAction(c.LOADING_DATA),new Promise(((t,e)=>{if(this.dataLoader){const n=this.getSort(),i=this.getFilters();this.dataLoader(this,n,i).then((e=>{this.records=e,t(this.records)})).catch((t=>e(t)))}}))}))}saveData(){return N(this,void 0,void 0,(function*(){const t=((t,e)=>{const n=[],i=E(e),r=y(e);null==r||r.forEach((e=>{if(i){const r=i.get(e.__record__id__);r&&n.push(new $(t,e,r,A.UPDATE))}}));const s=w(e);s&&s.forEach((e=>{n.push(new $(t,e,null==i?void 0:i.get(e.__record__id__),A.INSERT))}));const o=p(e),a={};return null==r||r.forEach((t=>a[t.__record__id__]=t)),o&&o.forEach((e=>{n.push(new $(t,a[e],void 0,A.DELETE))})),n})(this._name,this._stateManager);return t.length>0?(this.dispatchAction(c.SAVING_DATA),new Promise(((e,n)=>{this.saveLoader&&this.saveLoader(this,t).then((e=>this.dispatchAction(c.DATA_SAVED,{changes:t,records:e}))).catch((t=>n(t)))}))):Promise.resolve()}))}valueFromString(t,e){const n=this.getField(t);return n?a(n.dataType,e):e}addInterceptor(t){this._interceptors.push(t)}addFilterProvider(t){this._filterProviders.push(t)}set sortingProvider(t){this._sortingProvider=t}set metadata(t){this.dispatchAction(c.METADATA_LOADED,t)}get metadata(){return f(this._stateManager)}set records(t){this.dispatchAction(c.DATA_LOADED,t)}get records(){const t=D(this._stateManager);return t?Array.from(t.values()):[]}getField(t){return((t,e)=>{const n=f(this._stateManager);return n?n.fields.find((t=>t.name===e)):void 0})(0,t)}addRecord(){this.dispatchAction(c.RECORDS_ADDED,g(this._stateManager,[{}]))}copySelected(){const t=this.getSelectedRecords();t&&this.dispatchAction(c.RECORDS_COPIED,g(this._stateManager,t))}removeSelectedRecords(){const t=j(this._stateManager);t&&this.dispatchAction(c.RECORDS_REMOVED,t)}getFieldValue(t){return((t,e)=>{const n=j(t);if(n&&n.length>0){const i=D(t);if(i){const t=i.get(n[0]);return t?t[e]:void 0}}})(this._stateManager,t)}setFieldValue(t,e,n){const i=this.validateAndTypeValue(t,e);this.getFieldValue(t)!==i&&this.dispatchAction(c.DATA_CHANGED,{[t]:i,records:n})}getSelection(){return j(this._stateManager)}setSelection(t){this.dispatchAction(c.SELECTION_CHANGED,{type:"id",selection:t})}setSelectionByIndex(t){this.dispatchAction(c.SELECTION_CHANGED,{type:"index",selection:t})}getSelectedRecords(){const t=this.getSelection();if(t){const e=this.records;return null==e?void 0:e.filter((e=>t.includes(e.__record__id__)))}}nextRecord(){this.dispatchAction(c.NEXT_SELECTED)}previousRecord(){this.dispatchAction(c.PREVIOUS_SELECTED)}cancelEdition(){this.dispatchAction(c.EDITION_CANCELED)}isDirty(){return void 0!==w(t=this._stateManager)||void 0!==p(t)||void 0!==E(t);var t}hasNext(){return(t=>{const e=D(t);if(e){const n=t.select(S.sliceName,(t=>t));return n&&0!==n.length?e.size>I(n[0],e)+1:e.size>0}return!1})(this._stateManager)}hasPrevious(){return(t=>{const e=D(t);if(e){const n=t.select(S.sliceName,(t=>t));return!(!n||0===n.length)&&I(n[0],e)>0}return!1})(this._stateManager)}canUndo(){return this._stateManager.canUndo()}canRedo(){return this._stateManager.canRedo()}undo(){this.dispatchAction(c.CHANGE_UNDONE)}redo(){this.dispatchAction(c.CHANGE_REDONE)}toString(){return this.name}dispatchAction(t,e){var n;let i=new u(t,e);null===(n=this._interceptors)||void 0===n||n.forEach((t=>{i&&(i=t.interceptAction(i))})),i&&(this._stateManager.process(i),this._observers.forEach((t=>t(i))))}subscribe(t){this._observers.push(t)}unsubscribe(t){this._observers=this._observers.filter((e=>e!==t))}}!function(t){t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"}(A||(A={}));class ${constructor(t,e,n,i){this.dataUnit=t,this.record=e,this.updatingFields=n,this._operation=i}get operation(){return this._operation.toString()}isInsert(){return this._operation===A.INSERT}isDelete(){return this._operation===A.DELETE}isUpdate(){return this._operation===A.UPDATE}}!function(t){t.ASC="ASC",t.DESC="DESC"}(x||(x={})),function(t){t.SEARCHING="SEARCHING",t.REQUIREMENT="REQUIREMENT",t.VISIBILITY="REQUIREMENT"}(k||(k={})),function(t){t.FILE="FILE",t.IMAGE="IMAGE",t.DATE="DATE",t.DATETIME="DATETIME",t.TIME="TIME",t.ELAPSEDTIME="ELAPSEDTIME",t.CHECKBOX="CHECKBOX",t.SWITCH="SWITCH",t.OPTIONSELECTOR="OPTIONSELECTOR",t.DECIMALNUMBER="DECIMALNUMBER",t.INTEGERNUMBER="INTEGERNUMBER",t.SEARCH="SEARCH",t.SHORTTEXT="SHORTTEXT",t.PASSWORD="PASSWORD",t.MASKEDTEXT="MASKEDTEXT",t.LONGTEXT="LONGTEXT",t.HTML="HTML"}(_||(_={}));class C{static getContextValue(t){return C.getCtx()[t].deref()}static setContextValue(t,e){C.getCtx()[t]=new WeakRef(e)}static getCtx(){let t=window.___snkcore___ctx___;return t||(t={},window.___snkcore___ctx___=t),t}}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function M(t,e,n){return t(n={path:e,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},n.exports),n.exports}var P=M((function(t,e){var n="undefined"!=typeof self?self:U,i=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,r="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function v(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function p(t){var e=new FileReader,n=v(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&r&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,n,i=f(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,n=v(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=c(t),e=h(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},d.prototype.delete=function(t){delete this.map[c(t)]},d.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},d.prototype.set=function(t,e){this.map[c(t)]=h(e)},d.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),l(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),l(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),l(t)},i&&(d.prototype[Symbol.iterator]=d.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var n,i,r=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(i=(n=e.method||this.method||"GET").toUpperCase(),b.indexOf(i)>-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}})),e}function O(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},O.error=function(){var t=new O(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];O.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new O(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function T(t,n){return new Promise((function(i,s){var o=new w(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL"),i(new O("response"in a?a.response:a.responseText,n))},a.onerror=function(){s(new TypeError("Network request failed"))},a.ontimeout=function(){s(new TypeError("Network request failed"))},a.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&r&&(a.responseType="blob"),o.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",u)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}T.polyfill=!0,t.fetch||(t.fetch=T,t.Headers=d,t.Request=w,t.Response=O),e.Headers=d,e.Request=w,e.Response=O,e.fetch=T,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=i;(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e})),R=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=function(t){return"object"==typeof t&&null!==t}})),V=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=function(t,e){if(!Boolean(t))throw new Error(null!=e?e:"Unexpected invariant triggered.")}})),q=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=function(t,e){let i=0,r=1;for(const s of t.body.matchAll(n)){if("number"==typeof s.index||(0,V.invariant)(!1),s.index>=e)break;i=s.index+s[0].length,r+=1}return{line:r,column:e+1-i}};const n=/\r\n|[\n\r]/g})),L=M((function(t,e){function n(t,e){const n=t.locationOffset.column-1,r="".padStart(n)+t.body,s=e.line-1,o=e.line+(t.locationOffset.line-1),a=e.column+(1===e.line?n:0),u=`${t.name}:${o}:${a}\n`,c=r.split(/\r\n|[\n\r]/g),h=c[s];if(h.length>120){const t=Math.floor(a/80),e=a%80,n=[];for(let t=0;t<h.length;t+=80)n.push(h.slice(t,t+80));return u+i([[`${o} |`,n[0]],...n.slice(1,t+1).map((t=>["|",t])),["|","^".padStart(e)],["|",n[t+1]]])}return u+i([[o-1+" |",c[s-1]],[`${o} |`,h],["|","^".padStart(a)],[`${o+1} |`,c[s+1]]])}function i(t){const e=t.filter((([t,e])=>void 0!==e)),n=Math.max(...e.map((([t])=>t.length)));return e.map((([t,e])=>t.padStart(n)+(e?" "+e:""))).join("\n")}Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=function(t){return n(t.source,(0,q.getLocation)(t.source,t.start))},e.printSourceLocation=n})),B=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=function(t){return t.toJSON()},e.printError=function(t){return t.toString()};class n extends Error{constructor(t,...e){var r,s,o;const{nodes:a,source:u,positions:c,path:h,originalError:l,extensions:d}=function(t){const e=t[0];return null==e||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}(e);super(t),this.name="GraphQLError",this.path=null!=h?h:void 0,this.originalError=null!=l?l:void 0,this.nodes=i(Array.isArray(a)?a:a?[a]:void 0);const f=i(null===(r=this.nodes)||void 0===r?void 0:r.map((t=>t.loc)).filter((t=>null!=t)));this.source=null!=u?u:null==f||null===(s=f[0])||void 0===s?void 0:s.source,this.positions=null!=c?c:null==f?void 0:f.map((t=>t.start)),this.locations=c&&u?c.map((t=>(0,q.getLocation)(u,t))):null==f?void 0:f.map((t=>(0,q.getLocation)(t.source,t.start)));const v=(0,R.isObjectLike)(null==l?void 0:l.extensions)?null==l?void 0:l.extensions:void 0;this.extensions=null!==(o=null!=d?d:v)&&void 0!==o?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=l&&l.stack?Object.defineProperty(this,"stack",{value:l.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const e of this.nodes)e.loc&&(t+="\n\n"+(0,L.printLocation)(e.loc));else if(this.source&&this.locations)for(const e of this.locations)t+="\n\n"+(0,L.printSourceLocation)(this.source,e);return t}toJSON(){const t={message:this.message};return null!=this.locations&&(t.locations=this.locations),null!=this.path&&(t.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}function i(t){return void 0===t||0===t.length?void 0:t}e.GraphQLError=n})),H=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=function(t,e,n){return new B.GraphQLError(`Syntax Error: ${n}`,{source:t,positions:[e]})}})),z=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=function(t){const e=null==t?void 0:t.kind;return"string"==typeof e&&s.has(e)};class n{constructor(t,e,n){this.start=t.start,this.end=e.end,this.startToken=t,this.endToken=e,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}e.Location=n;class i{constructor(t,e,n,i,r,s){this.kind=t,this.start=e,this.end=n,this.line=i,this.column=r,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}e.Token=i;const r={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};e.QueryDocumentKeys=r;const s=new Set(Object.keys(r));let o;e.OperationTypeNode=o,function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"}(o||(e.OperationTypeNode=o={}))})),G=M((function(t,e){let n;Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0,e.DirectiveLocation=n,function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(n||(e.DirectiveLocation=n={}))})),J=M((function(t,e){let n;Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0,e.Kind=n,function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(n||(e.Kind=n={}))})),Q=M((function(t,e){function n(t){return t>=48&&t<=57}function i(t){return t>=97&&t<=122||t>=65&&t<=90}Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=i,e.isNameContinue=function(t){return i(t)||n(t)||95===t},e.isNameStart=function(t){return i(t)||95===t},e.isWhiteSpace=function(t){return 9===t||32===t}})),W=M((function(t,e){function n(t){let e=0;for(;e<t.length&&(0,Q.isWhiteSpace)(t.charCodeAt(e));)++e;return e}Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=function(t){var e;let i=Number.MAX_SAFE_INTEGER,r=null,s=-1;for(let e=0;e<t.length;++e){var o;const a=t[e],u=n(a);u!==a.length&&(r=null!==(o=r)&&void 0!==o?o:e,s=e,0!==e&&u<i&&(i=u))}return t.map(((t,e)=>0===e?t:t.slice(i))).slice(null!==(e=r)&&void 0!==e?e:0,s+1)},e.isPrintableAsBlockString=function(t){if(""===t)return!0;let e=!0,n=!1,i=!0,r=!1;for(let s=0;s<t.length;++s)switch(t.codePointAt(s)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:case 13:return!1;case 10:if(e&&!r)return!1;r=!0,e=!0,n=!1;break;case 9:case 32:n||(n=e);break;default:i&&(i=n),e=!1}return!e&&(!i||!r)},e.printBlockString=function(t,e){const n=t.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,s=i.length>1&&i.slice(1).every((t=>0===t.length||(0,Q.isWhiteSpace)(t.charCodeAt(0)))),o=n.endsWith('\\"""'),a=t.endsWith('"')&&!o,u=t.endsWith("\\"),c=a||u,h=!(null!=e&&e.minimize)&&(!r||t.length>70||c||s||o);let l="";const d=r&&(0,Q.isWhiteSpace)(t.charCodeAt(0));return(h&&!d||s)&&(l+="\n"),l+=n,(h||c)&&(l+="\n"),'"""'+l+'"""'}})),X=M((function(t,e){let n;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0,e.TokenKind=n,function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"}(n||(e.TokenKind=n={}))})),K=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.isPunctuatorTokenKind=function(t){return t===X.TokenKind.BANG||t===X.TokenKind.DOLLAR||t===X.TokenKind.AMP||t===X.TokenKind.PAREN_L||t===X.TokenKind.PAREN_R||t===X.TokenKind.SPREAD||t===X.TokenKind.COLON||t===X.TokenKind.EQUALS||t===X.TokenKind.AT||t===X.TokenKind.BRACKET_L||t===X.TokenKind.BRACKET_R||t===X.TokenKind.BRACE_L||t===X.TokenKind.PIPE||t===X.TokenKind.BRACE_R};class n{constructor(t){const e=new z.Token(X.TokenKind.SOF,0,0,0,0);this.source=t,this.lastToken=e,this.token=e,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==X.TokenKind.EOF)do{if(t.next)t=t.next;else{const e=c(this,t.end);t.next=e,e.prev=t,t=e}}while(t.kind===X.TokenKind.COMMENT);return t}}function i(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function r(t,e){return s(t.charCodeAt(e))&&o(t.charCodeAt(e+1))}function s(t){return t>=55296&&t<=56319}function o(t){return t>=56320&&t<=57343}function a(t,e){const n=t.source.body.codePointAt(e);if(void 0===n)return X.TokenKind.EOF;if(n>=32&&n<=126){const t=String.fromCodePoint(n);return'"'===t?"'\"'":`"${t}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function u(t,e,n,i,r){return new z.Token(e,n,i,t.line,1+n-t.lineStart,r)}function c(t,e){const n=t.source.body,s=n.length;let o=e;for(;o<s;){const e=n.charCodeAt(o);switch(e){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++t.line,t.lineStart=o;continue;case 13:10===n.charCodeAt(o+1)?o+=2:++o,++t.line,t.lineStart=o;continue;case 35:return h(t,o);case 33:return u(t,X.TokenKind.BANG,o,o+1);case 36:return u(t,X.TokenKind.DOLLAR,o,o+1);case 38:return u(t,X.TokenKind.AMP,o,o+1);case 40:return u(t,X.TokenKind.PAREN_L,o,o+1);case 41:return u(t,X.TokenKind.PAREN_R,o,o+1);case 46:if(46===n.charCodeAt(o+1)&&46===n.charCodeAt(o+2))return u(t,X.TokenKind.SPREAD,o,o+3);break;case 58:return u(t,X.TokenKind.COLON,o,o+1);case 61:return u(t,X.TokenKind.EQUALS,o,o+1);case 64:return u(t,X.TokenKind.AT,o,o+1);case 91:return u(t,X.TokenKind.BRACKET_L,o,o+1);case 93:return u(t,X.TokenKind.BRACKET_R,o,o+1);case 123:return u(t,X.TokenKind.BRACE_L,o,o+1);case 124:return u(t,X.TokenKind.PIPE,o,o+1);case 125:return u(t,X.TokenKind.BRACE_R,o,o+1);case 34:return 34===n.charCodeAt(o+1)&&34===n.charCodeAt(o+2)?w(t,o):f(t,o)}if((0,Q.isDigit)(e)||45===e)return l(t,o,e);if((0,Q.isNameStart)(e))return g(t,o);throw(0,H.syntaxError)(t.source,o,39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":i(e)||r(n,o)?`Unexpected character: ${a(t,o)}.`:`Invalid character: ${a(t,o)}.`)}return u(t,X.TokenKind.EOF,s,s)}function h(t,e){const n=t.source.body,s=n.length;let o=e+1;for(;o<s;){const t=n.charCodeAt(o);if(10===t||13===t)break;if(i(t))++o;else{if(!r(n,o))break;o+=2}}return u(t,X.TokenKind.COMMENT,e,o,n.slice(e+1,o))}function l(t,e,n){const i=t.source.body;let r=e,s=n,o=!1;if(45===s&&(s=i.charCodeAt(++r)),48===s){if(s=i.charCodeAt(++r),(0,Q.isDigit)(s))throw(0,H.syntaxError)(t.source,r,`Invalid number, unexpected digit after 0: ${a(t,r)}.`)}else r=d(t,r,s),s=i.charCodeAt(r);if(46===s&&(o=!0,s=i.charCodeAt(++r),r=d(t,r,s),s=i.charCodeAt(r)),69!==s&&101!==s||(o=!0,s=i.charCodeAt(++r),43!==s&&45!==s||(s=i.charCodeAt(++r)),r=d(t,r,s),s=i.charCodeAt(r)),46===s||(0,Q.isNameStart)(s))throw(0,H.syntaxError)(t.source,r,`Invalid number, expected digit but got: ${a(t,r)}.`);return u(t,o?X.TokenKind.FLOAT:X.TokenKind.INT,e,r,i.slice(e,r))}function d(t,e,n){if(!(0,Q.isDigit)(n))throw(0,H.syntaxError)(t.source,e,`Invalid number, expected digit but got: ${a(t,e)}.`);const i=t.source.body;let r=e+1;for(;(0,Q.isDigit)(i.charCodeAt(r));)++r;return r}function f(t,e){const n=t.source.body,s=n.length;let o=e+1,c=o,h="";for(;o<s;){const s=n.charCodeAt(o);if(34===s)return h+=n.slice(c,o),u(t,X.TokenKind.STRING,e,o+1,h);if(92!==s){if(10===s||13===s)break;if(i(s))++o;else{if(!r(n,o))throw(0,H.syntaxError)(t.source,o,`Invalid character within String: ${a(t,o)}.`);o+=2}}else{h+=n.slice(c,o);const e=117===n.charCodeAt(o+1)?123===n.charCodeAt(o+2)?v(t,o):p(t,o):b(t,o);h+=e.value,o+=e.size,c=o}}throw(0,H.syntaxError)(t.source,o,"Unterminated string.")}function v(t,e){const n=t.source.body;let r=0,s=3;for(;s<12;){const t=n.charCodeAt(e+s++);if(125===t){if(s<5||!i(r))break;return{value:String.fromCodePoint(r),size:s}}if(r=r<<4|y(t),r<0)break}throw(0,H.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+s)}".`)}function p(t,e){const n=t.source.body,r=m(n,e+2);if(i(r))return{value:String.fromCodePoint(r),size:6};if(s(r)&&92===n.charCodeAt(e+6)&&117===n.charCodeAt(e+7)){const t=m(n,e+8);if(o(t))return{value:String.fromCodePoint(r,t),size:12}}throw(0,H.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+6)}".`)}function m(t,e){return y(t.charCodeAt(e))<<12|y(t.charCodeAt(e+1))<<8|y(t.charCodeAt(e+2))<<4|y(t.charCodeAt(e+3))}function y(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function b(t,e){const n=t.source.body;switch(n.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw(0,H.syntaxError)(t.source,e,`Invalid character escape sequence: "${n.slice(e,e+2)}".`)}function w(t,e){const n=t.source.body,s=n.length;let o=t.lineStart,c=e+3,h=c,l="";const d=[];for(;c<s;){const s=n.charCodeAt(c);if(34===s&&34===n.charCodeAt(c+1)&&34===n.charCodeAt(c+2)){l+=n.slice(h,c),d.push(l);const i=u(t,X.TokenKind.BLOCK_STRING,e,c+3,(0,W.dedentBlockStringLines)(d).join("\n"));return t.line+=d.length-1,t.lineStart=o,i}if(92!==s||34!==n.charCodeAt(c+1)||34!==n.charCodeAt(c+2)||34!==n.charCodeAt(c+3))if(10!==s&&13!==s)if(i(s))++c;else{if(!r(n,c))throw(0,H.syntaxError)(t.source,c,`Invalid character within String: ${a(t,c)}.`);c+=2}else l+=n.slice(h,c),d.push(l),13===s&&10===n.charCodeAt(c+1)?c+=2:++c,l="",h=c,o=c;else l+=n.slice(h,c),h=c+1,c+=4}throw(0,H.syntaxError)(t.source,c,"Unterminated string.")}function g(t,e){const n=t.source.body,i=n.length;let r=e+1;for(;r<i;){const t=n.charCodeAt(r);if(!(0,Q.isNameContinue)(t))break;++r}return u(t,X.TokenKind.NAME,e,r,n.slice(e,r))}e.Lexer=n})),Y=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=function(t,e){if(!Boolean(t))throw new Error(e)}})),Z=M((function(t,e){function n(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return function(t,e){if(null===t)return"null";if(e.includes(t))return"[Circular]";const i=[...e,t];if(function(t){return"function"==typeof t.toJSON}(t)){const e=t.toJSON();if(e!==t)return"string"==typeof e?e:n(e,i)}else if(Array.isArray(t))return function(t,e){if(0===t.length)return"[]";if(e.length>2)return"[Array]";const i=Math.min(10,t.length),r=t.length-i,s=[];for(let r=0;r<i;++r)s.push(n(t[r],e));return 1===r?s.push("... 1 more item"):r>1&&s.push(`... ${r} more items`),"["+s.join(", ")+"]"}(t,i);return function(t,e){const i=Object.entries(t);return 0===i.length?"{}":e.length>2?"["+function(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if("Object"===e&&"function"==typeof t.constructor){const e=t.constructor.name;if("string"==typeof e&&""!==e)return e}return e}(t)+"]":"{ "+i.map((([t,i])=>t+": "+n(i,e))).join(", ")+" }"}(t,i)}(t,e);default:return String(t)}}Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=function(t){return n(t,[])}})),tt=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0,e.instanceOf=function(t,e){return t instanceof e}})),et=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=function(t){return(0,tt.instanceOf)(t,n)};class n{constructor(t,e="GraphQL request",n={line:1,column:1}){"string"==typeof t||(0,Y.devAssert)(!1,`Body must be a string. Received: ${(0,Z.inspect)(t)}.`),this.body=t,this.name=e,this.locationOffset=n,this.locationOffset.line>0||(0,Y.devAssert)(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,Y.devAssert)(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}e.Source=n})),nt=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=function(t,e){return new n(t,e).parseDocument()},e.parseConstValue=function(t,e){const i=new n(t,e);i.expectToken(X.TokenKind.SOF);const r=i.parseConstValueLiteral();return i.expectToken(X.TokenKind.EOF),r},e.parseType=function(t,e){const i=new n(t,e);i.expectToken(X.TokenKind.SOF);const r=i.parseTypeReference();return i.expectToken(X.TokenKind.EOF),r},e.parseValue=function(t,e){const i=new n(t,e);i.expectToken(X.TokenKind.SOF);const r=i.parseValueLiteral(!1);return i.expectToken(X.TokenKind.EOF),r};class n{constructor(t,e){const n=(0,et.isSource)(t)?t:new et.Source(t);this._lexer=new K.Lexer(n),this._options=e}parseName(){const t=this.expectToken(X.TokenKind.NAME);return this.node(t,{kind:J.Kind.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:J.Kind.DOCUMENT,definitions:this.many(X.TokenKind.SOF,this.parseDefinition,X.TokenKind.EOF)})}parseDefinition(){if(this.peek(X.TokenKind.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),e=t?this._lexer.lookahead():this._lexer.token;if(e.kind===X.TokenKind.NAME){switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw(0,H.syntaxError)(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(e.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(e)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(X.TokenKind.BRACE_L))return this.node(t,{kind:J.Kind.OPERATION_DEFINITION,operation:z.OperationTypeNode.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const e=this.parseOperationType();let n;return this.peek(X.TokenKind.NAME)&&(n=this.parseName()),this.node(t,{kind:J.Kind.OPERATION_DEFINITION,operation:e,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(X.TokenKind.NAME);switch(t.value){case"query":return z.OperationTypeNode.QUERY;case"mutation":return z.OperationTypeNode.MUTATION;case"subscription":return z.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(X.TokenKind.PAREN_L,this.parseVariableDefinition,X.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:J.Kind.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(X.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(X.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(X.TokenKind.DOLLAR),this.node(t,{kind:J.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:J.Kind.SELECTION_SET,selections:this.many(X.TokenKind.BRACE_L,this.parseSelection,X.TokenKind.BRACE_R)})}parseSelection(){return this.peek(X.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,e=this.parseName();let n,i;return this.expectOptionalToken(X.TokenKind.COLON)?(n=e,i=this.parseName()):i=e,this.node(t,{kind:J.Kind.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(X.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){return this.optionalMany(X.TokenKind.PAREN_L,t?this.parseConstArgument:this.parseArgument,X.TokenKind.PAREN_R)}parseArgument(t=!1){const e=this._lexer.token,n=this.parseName();return this.expectToken(X.TokenKind.COLON),this.node(e,{kind:J.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(X.TokenKind.SPREAD);const e=this.expectOptionalKeyword("on");return!e&&this.peek(X.TokenKind.NAME)?this.node(t,{kind:J.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:J.Kind.INLINE_FRAGMENT,typeCondition:e?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){var t;const e=this._lexer.token;return this.expectKeyword("fragment"),!0===(null===(t=this._options)||void 0===t?void 0:t.allowLegacyFragmentVariables)?this.node(e,{kind:J.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(e,{kind:J.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(t){const e=this._lexer.token;switch(e.kind){case X.TokenKind.BRACKET_L:return this.parseList(t);case X.TokenKind.BRACE_L:return this.parseObject(t);case X.TokenKind.INT:return this._lexer.advance(),this.node(e,{kind:J.Kind.INT,value:e.value});case X.TokenKind.FLOAT:return this._lexer.advance(),this.node(e,{kind:J.Kind.FLOAT,value:e.value});case X.TokenKind.STRING:case X.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case X.TokenKind.NAME:switch(this._lexer.advance(),e.value){case"true":return this.node(e,{kind:J.Kind.BOOLEAN,value:!0});case"false":return this.node(e,{kind:J.Kind.BOOLEAN,value:!1});case"null":return this.node(e,{kind:J.Kind.NULL});default:return this.node(e,{kind:J.Kind.ENUM,value:e.value})}case X.TokenKind.DOLLAR:if(t){if(this.expectToken(X.TokenKind.DOLLAR),this._lexer.token.kind===X.TokenKind.NAME)throw(0,H.syntaxError)(this._lexer.source,e.start,`Unexpected variable "$${this._lexer.token.value}" in constant value.`);throw this.unexpected(e)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this._lexer.advance(),this.node(t,{kind:J.Kind.STRING,value:t.value,block:t.kind===X.TokenKind.BLOCK_STRING})}parseList(t){return this.node(this._lexer.token,{kind:J.Kind.LIST,values:this.any(X.TokenKind.BRACKET_L,(()=>this.parseValueLiteral(t)),X.TokenKind.BRACKET_R)})}parseObject(t){return this.node(this._lexer.token,{kind:J.Kind.OBJECT,fields:this.any(X.TokenKind.BRACE_L,(()=>this.parseObjectField(t)),X.TokenKind.BRACE_R)})}parseObjectField(t){const e=this._lexer.token,n=this.parseName();return this.expectToken(X.TokenKind.COLON),this.node(e,{kind:J.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(t)})}parseDirectives(t){const e=[];for(;this.peek(X.TokenKind.AT);)e.push(this.parseDirective(t));return e}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const e=this._lexer.token;return this.expectToken(X.TokenKind.AT),this.node(e,{kind:J.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let e;if(this.expectOptionalToken(X.TokenKind.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(X.TokenKind.BRACKET_R),e=this.node(t,{kind:J.Kind.LIST_TYPE,type:n})}else e=this.parseNamedType();return this.expectOptionalToken(X.TokenKind.BANG)?this.node(t,{kind:J.Kind.NON_NULL_TYPE,type:e}):e}parseNamedType(){return this.node(this._lexer.token,{kind:J.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(X.TokenKind.STRING)||this.peek(X.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(X.TokenKind.BRACE_L,this.parseOperationTypeDefinition,X.TokenKind.BRACE_R);return this.node(t,{kind:J.Kind.SCHEMA_DEFINITION,description:e,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,e=this.parseOperationType();this.expectToken(X.TokenKind.COLON);const n=this.parseNamedType();return this.node(t,{kind:J.Kind.OPERATION_TYPE_DEFINITION,operation:e,type:n})}parseScalarTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:J.Kind.SCALAR_TYPE_DEFINITION,description:e,name:n,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:J.Kind.OBJECT_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(X.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(X.TokenKind.BRACE_L,this.parseFieldDefinition,X.TokenKind.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(X.TokenKind.COLON);const r=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(t,{kind:J.Kind.FIELD_DEFINITION,description:e,name:n,arguments:i,type:r,directives:s})}parseArgumentDefs(){return this.optionalMany(X.TokenKind.PAREN_L,this.parseInputValueDef,X.TokenKind.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName();this.expectToken(X.TokenKind.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(X.TokenKind.EQUALS)&&(r=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(t,{kind:J.Kind.INPUT_VALUE_DEFINITION,description:e,name:n,type:i,defaultValue:r,directives:s})}parseInterfaceTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:J.Kind.INTERFACE_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(t,{kind:J.Kind.UNION_TYPE_DEFINITION,description:e,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(X.TokenKind.EQUALS)?this.delimitedMany(X.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(t,{kind:J.Kind.ENUM_TYPE_DEFINITION,description:e,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(X.TokenKind.BRACE_L,this.parseEnumValueDefinition,X.TokenKind.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:J.Kind.ENUM_VALUE_DEFINITION,description:e,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw(0,H.syntaxError)(this._lexer.source,this._lexer.token.start,`${i(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(t,{kind:J.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:e,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(X.TokenKind.BRACE_L,this.parseInputValueDef,X.TokenKind.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===X.TokenKind.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const e=this.parseConstDirectives(),n=this.optionalMany(X.TokenKind.BRACE_L,this.parseOperationTypeDefinition,X.TokenKind.BRACE_R);if(0===e.length&&0===n.length)throw this.unexpected();return this.node(t,{kind:J.Kind.SCHEMA_EXTENSION,directives:e,operationTypes:n})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const e=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(t,{kind:J.Kind.SCALAR_TYPE_EXTENSION,name:e,directives:n})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:J.Kind.OBJECT_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:J.Kind.INTERFACE_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:J.Kind.UNION_TYPE_EXTENSION,name:e,directives:n,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:J.Kind.ENUM_TYPE_EXTENSION,name:e,directives:n,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:J.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:e,directives:n,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("directive"),this.expectToken(X.TokenKind.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(t,{kind:J.Kind.DIRECTIVE_DEFINITION,description:e,name:n,arguments:i,repeatable:r,locations:s})}parseDirectiveLocations(){return this.delimitedMany(X.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,e=this.parseName();if(Object.prototype.hasOwnProperty.call(G.DirectiveLocation,e.value))return e;throw this.unexpected(t)}node(t,e){var n;return!0!==(null===(n=this._options)||void 0===n?void 0:n.noLocation)&&(e.loc=new z.Location(t,this._lexer.lastToken,this._lexer.source)),e}peek(t){return this._lexer.token.kind===t}expectToken(t){const e=this._lexer.token;if(e.kind===t)return this._lexer.advance(),e;throw(0,H.syntaxError)(this._lexer.source,e.start,`Expected ${r(t)}, found ${i(e)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t&&(this._lexer.advance(),!0)}expectKeyword(t){const e=this._lexer.token;if(e.kind!==X.TokenKind.NAME||e.value!==t)throw(0,H.syntaxError)(this._lexer.source,e.start,`Expected "${t}", found ${i(e)}.`);this._lexer.advance()}expectOptionalKeyword(t){const e=this._lexer.token;return e.kind===X.TokenKind.NAME&&e.value===t&&(this._lexer.advance(),!0)}unexpected(t){const e=null!=t?t:this._lexer.token;return(0,H.syntaxError)(this._lexer.source,e.start,`Unexpected ${i(e)}.`)}any(t,e,n){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(n);)i.push(e.call(this));return i}optionalMany(t,e,n){if(this.expectOptionalToken(t)){const t=[];do{t.push(e.call(this))}while(!this.expectOptionalToken(n));return t}return[]}many(t,e,n){this.expectToken(t);const i=[];do{i.push(e.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(t,e){this.expectOptionalToken(t);const n=[];do{n.push(e.call(this))}while(this.expectOptionalToken(t));return n}}function i(t){const e=t.value;return r(t.kind)+(null!=e?` "${e}"`:"")}function r(t){return(0,K.isPunctuatorTokenKind)(t)?`"${t}"`:t}e.Parser=n})),it=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.printString=function(t){return`"${t.replace(n,i)}"`};const n=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function i(t){return r[t.charCodeAt(0)]}const r=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"]})),rt=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BREAK=void 0,e.getEnterLeaveForKind=i,e.getVisitFn=function(t,e,n){const{enter:r,leave:s}=i(t,e);return n?s:r},e.visit=function(t,e,r=z.QueryDocumentKeys){const s=new Map;for(const t of Object.values(J.Kind))s.set(t,i(e,t));let o,a,u,c=Array.isArray(t),h=[t],l=-1,d=[],f=t;const v=[],p=[];do{l++;const t=l===h.length,i=t&&0!==d.length;if(t){if(a=0===p.length?void 0:v[v.length-1],f=u,u=p.pop(),i)if(c){f=f.slice();let t=0;for(const[e,n]of d){const i=e-t;null===n?(f.splice(i,1),t++):f[i]=n}}else{f=Object.defineProperties({},Object.getOwnPropertyDescriptors(f));for(const[t,e]of d)f[t]=e}l=o.index,h=o.keys,d=o.edits,c=o.inArray,o=o.prev}else if(u){if(a=c?l:h[l],f=u[a],null==f)continue;v.push(a)}let w;if(!Array.isArray(f)){var m,y;(0,z.isNode)(f)||(0,Y.devAssert)(!1,`Invalid AST Node: ${(0,Z.inspect)(f)}.`);const i=t?null===(m=s.get(f.kind))||void 0===m?void 0:m.leave:null===(y=s.get(f.kind))||void 0===y?void 0:y.enter;if(w=null==i?void 0:i.call(e,f,a,u,v,p),w===n)break;if(!1===w){if(!t){v.pop();continue}}else if(void 0!==w&&(d.push([a,w]),!t)){if(!(0,z.isNode)(w)){v.pop();continue}f=w}}var b;void 0===w&&i&&d.push([a,f]),t?v.pop():(o={inArray:c,index:l,keys:h,edits:d,prev:o},c=Array.isArray(f),h=c?f:null!==(b=r[f.kind])&&void 0!==b?b:[],l=-1,d=[],u&&p.push(u),u=f)}while(void 0!==o);return 0!==d.length?d[d.length-1][1]:t},e.visitInParallel=function(t){const e=new Array(t.length).fill(null),r=Object.create(null);for(const s of Object.values(J.Kind)){let o=!1;const a=new Array(t.length).fill(void 0),u=new Array(t.length).fill(void 0);for(let e=0;e<t.length;++e){const{enter:n,leave:r}=i(t[e],s);o||(o=null!=n||null!=r),a[e]=n,u[e]=r}o&&(r[s]={enter(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const u=null===(s=a[o])||void 0===s?void 0:s.apply(t[o],i);if(!1===u)e[o]=r;else if(u===n)e[o]=n;else if(void 0!==u)return u}},leave(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const r=null===(s=u[o])||void 0===s?void 0:s.apply(t[o],i);if(r===n)e[o]=n;else if(void 0!==r&&!1!==r)return r}else e[o]===r&&(e[o]=null)}})}return r};const n=Object.freeze({});function i(t,e){const n=t[e];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:t.enter,leave:t.leave}}e.BREAK=n})),st=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.print=function(t){return(0,rt.visit)(t,n)};const n={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>i(t.definitions,"\n\n")},OperationDefinition:{leave(t){const e=s("(",i(t.variableDefinitions,", "),")"),n=i([t.operation,i([t.name,e]),i(t.directives," ")]," ");return("query"===n?"":n+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:n,directives:r})=>t+": "+e+s(" = ",n)+s(" ",i(r," "))},SelectionSet:{leave:({selections:t})=>r(t)},Field:{leave({alias:t,name:e,arguments:n,directives:r,selectionSet:a}){const u=s("",t,": ")+e;let c=u+s("(",i(n,", "),")");return c.length>80&&(c=u+s("(\n",o(i(n,"\n")),"\n)")),i([c,i(r," "),a]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+s(" ",i(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:n})=>i(["...",s("on ",t),i(e," "),n]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:n,directives:r,selectionSet:o})=>`fragment ${t}${s("(",i(n,", "),")")} on ${e} ${s("",i(r," ")," ")}`+o},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?(0,W.printBlockString)(t):(0,it.printString)(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+i(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+i(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+s("(",i(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:n})=>s("",t,"\n")+i(["schema",i(e," "),r(n)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i(["scalar",e,i(n," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:a})=>s("",t,"\n")+i(["type",e,s("implements ",i(n," & ")),i(o," "),r(a)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:n,type:r,directives:u})=>s("",t,"\n")+e+(a(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+": "+r+s(" ",i(u," "))},InputValueDefinition:{leave:({description:t,name:e,type:n,defaultValue:r,directives:o})=>s("",t,"\n")+i([e+": "+n,s("= ",r),i(o," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:a})=>s("",t,"\n")+i(["interface",e,s("implements ",i(n," & ")),i(o," "),r(a)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:n,types:r})=>s("",t,"\n")+i(["union",e,i(n," "),s("= ",i(r," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:n,values:o})=>s("",t,"\n")+i(["enum",e,i(n," "),r(o)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i([e,i(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:n,fields:o})=>s("",t,"\n")+i(["input",e,i(n," "),r(o)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:n,repeatable:r,locations:u})=>s("",t,"\n")+"directive @"+e+(a(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+(r?" repeatable":"")+" on "+i(u," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>i(["extend schema",i(t," "),r(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>i(["extend scalar",t,i(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend type",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend interface",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:n})=>i(["extend union",t,i(e," "),s("= ",i(n," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:n})=>i(["extend enum",t,i(e," "),r(n)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:n})=>i(["extend input",t,i(e," "),r(n)]," ")}};function i(t,e=""){var n;return null!==(n=null==t?void 0:t.filter((t=>t)).join(e))&&void 0!==n?n:""}function r(t){return s("{\n",o(i(t,"\n")),"\n}")}function s(t,e,n=""){return null!=e&&""!==e?t+e+n:""}function o(t){return s(" ",t.replace(/\n/g,"\n "))}function a(t){var e;return null!==(e=null==t?void 0:t.some((t=>t.includes("\n"))))&&void 0!==e&&e}})),ot=function(t){var e=t.name,n=t.type;this.uri=t.uri,this.name=e,this.type=n},at=function(t){return"undefined"!=typeof File&&t instanceof File||"undefined"!=typeof Blob&&t instanceof Blob||t instanceof ot},ut=function t(e,n,i){var r;void 0===n&&(n=""),void 0===i&&(i=at);var s=new Map;function o(t,e){var n=s.get(e);n?n.push.apply(n,t):s.set(e,t)}if(i(e))r=null,o([n],e);else{var a=n?n+".":"";if("undefined"!=typeof FileList&&e instanceof FileList)r=Array.prototype.map.call(e,(function(t,e){return o([""+a+e],t),null}));else if(Array.isArray(e))r=e.map((function(e,n){var r=t(e,""+a+n,i);return r.files.forEach(o),r.clone}));else if(e&&e.constructor===Object)for(var u in r={},e){var c=t(e[u],""+a+u,i);c.files.forEach(o),r[u]=c.clone}else r=e}return{clone:r,files:s}},ct=at,ht="object"==typeof self?self.FormData:window.FormData,lt=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultJsonSerializer=void 0,e.defaultJsonSerializer={parse:JSON.parse,stringify:JSON.stringify}})),dt=M((function(t,e){var n=U&&U.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(ht),r=function(t){return ct(t)||null!==t&&"object"==typeof t&&"function"==typeof t.pipe};e.default=function(t,e,n,s){void 0===s&&(s=lt.defaultJsonSerializer);var o=ut({query:t,variables:e,operationName:n},"",r),a=o.clone,u=o.files;if(0===u.size){if(!Array.isArray(t))return s.stringify(a);if(void 0!==e&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");var c=t.reduce((function(t,n,i){return t.push({query:n,variables:e?e[i]:void 0}),t}),[]);return s.stringify(c)}var h=new("undefined"==typeof FormData?i.default:FormData);h.append("operations",s.stringify(a));var l={},d=0;return u.forEach((function(t){l[++d]=t})),h.append("map",s.stringify(l)),d=0,u.forEach((function(t,e){h.append(""+ ++d,e)})),h}})),ft=M((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchRequestsExtendedArgs=e.parseRawRequestExtendedArgs=e.parseRequestExtendedArgs=e.parseBatchRequestArgs=e.parseRawRequestArgs=e.parseRequestArgs=void 0,e.parseRequestArgs=function(t,e,n){return t.document?t:{document:t,variables:e,requestHeaders:n,signal:void 0}},e.parseRawRequestArgs=function(t,e,n){return t.query?t:{query:t,variables:e,requestHeaders:n,signal:void 0}},e.parseBatchRequestArgs=function(t,e){return t.documents?t:{documents:t,requestHeaders:e,signal:void 0}},e.parseRequestExtendedArgs=function(t,e,n,i){return t.document?t:{url:t,document:e,variables:n,requestHeaders:i,signal:void 0}},e.parseRawRequestExtendedArgs=function(t,e,n,i){return t.query?t:{url:t,query:e,variables:n,requestHeaders:i,signal:void 0}},e.parseBatchRequestsExtendedArgs=function(t,e,n){return t.documents?t:{url:t,documents:e,requestHeaders:n,signal:void 0}}})),vt=M((function(t,e){var n,i=U&&U.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.ClientError=void 0;var r=function(t){function e(n,i){var r=this,s=e.extractMessage(n)+": "+JSON.stringify({response:n,request:i});return r=t.call(this,s)||this,Object.setPrototypeOf(r,e.prototype),r.response=n,r.request=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return i(e,t),e.extractMessage=function(t){try{return t.errors[0].message}catch(e){return"GraphQL Error (Code: "+t.status+")"}},e}(Error);e.ClientError=r})),pt=M((function(t,e){var n=U&&U.__assign||function(){return(n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},i=U&&U.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=U&&U.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=U&&U.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return r(e,t),e},o=U&&U.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((i=i.apply(t,e||[])).next())}))},a=U&&U.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},u=U&&U.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n},c=U&&U.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.gql=e.batchRequests=e.request=e.rawRequest=e.GraphQLClient=e.ClientError=void 0;var h=s(P),l=h,d=c(dt);Object.defineProperty(e,"ClientError",{enumerable:!0,get:function(){return vt.ClientError}});var f=function(t){var e={};return t&&("undefined"!=typeof Headers&&t instanceof Headers||t instanceof l.Headers?e=function(t){var e={};return t.forEach((function(t,n){e[n]=t})),e}(t):Array.isArray(t)?t.forEach((function(t){e[t[0]]=t[1]})):e=t),e},v=function(t){return t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim()},p=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,u=t.headers,c=t.fetch,h=t.fetchOptions;return o(void 0,void 0,void 0,(function(){var t;return a(this,(function(o){switch(o.label){case 0:return t=d.default(i,r,s,h.jsonSerializer),[4,c(e,n({method:"POST",headers:n(n({},"string"==typeof t?{"Content-Type":"application/json"}:{}),u),body:t},h))];case 1:return[2,o.sent()]}}))}))},m=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,u=t.headers,c=t.fetch,h=t.fetchOptions;return o(void 0,void 0,void 0,(function(){var t;return a(this,(function(o){switch(o.label){case 0:return t=function(t){var e=t.query,n=t.variables,i=t.operationName,r=t.jsonSerializer;if(!Array.isArray(e)){var s=["query="+encodeURIComponent(v(e))];return n&&s.push("variables="+encodeURIComponent(r.stringify(n))),i&&s.push("operationName="+encodeURIComponent(i)),s.join("&")}if(void 0!==n&&!Array.isArray(n))throw new Error("Cannot create query with given variable type, array expected");var o=e.reduce((function(t,e,i){return t.push({query:v(e),variables:n?r.stringify(n[i]):void 0}),t}),[]);return"query="+encodeURIComponent(r.stringify(o))}({query:i,variables:r,operationName:s,jsonSerializer:h.jsonSerializer}),[4,c(e+"?"+t,n({method:"GET",headers:u},h))];case 1:return[2,o.sent()]}}))}))},y=function(){function t(t,e){this.url=t,this.options=e||{}}return t.prototype.rawRequest=function(t,e,i){return o(this,void 0,void 0,(function(){var r,s,o,c,l,d,v,p,m,y;return a(this,(function(){return r=ft.parseRawRequestArgs(t,e,i),o=(s=this.options).headers,l=void 0===(c=s.fetch)?h.default:c,v=void 0===(d=s.method)?"POST":d,p=u(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(p.signal=r.signal),y=E(r.query).operationName,[2,b({url:m,query:r.query,variables:r.variables,headers:n(n({},f(o)),f(r.requestHeaders)),operationName:y,fetch:l,method:v,fetchOptions:p})]}))}))},t.prototype.request=function(t,e,i){return o(this,void 0,void 0,(function(){var r,s,o,c,l,d,v,p,m,y,w;return a(this,(function(a){switch(a.label){case 0:return r=ft.parseRequestArgs(t,e,i),o=(s=this.options).headers,l=void 0===(c=s.fetch)?h.default:c,v=void 0===(d=s.method)?"POST":d,p=u(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(p.signal=r.signal),y=E(r.document),w=y.operationName,[4,b({url:m,query:y.query,variables:r.variables,headers:n(n({},f(o)),f(r.requestHeaders)),operationName:w,fetch:l,method:v,fetchOptions:p})];case 1:return[2,a.sent().data]}}))}))},t.prototype.batchRequests=function(t,e){return o(this,void 0,void 0,(function(){var i,r,s,o,c,l,d,v,p,m,y;return a(this,(function(a){switch(a.label){case 0:return i=ft.parseBatchRequestArgs(t,e),s=(r=this.options).headers,c=void 0===(o=r.fetch)?h.default:o,d=void 0===(l=r.method)?"POST":l,v=u(r,["headers","fetch","method"]),p=this.url,void 0!==i.signal&&(v.signal=i.signal),m=i.documents.map((function(t){return E(t.document).query})),y=i.documents.map((function(t){return t.variables})),[4,b({url:p,query:m,variables:y,headers:n(n({},f(s)),f(i.requestHeaders)),operationName:void 0,fetch:c,method:d,fetchOptions:v})];case 1:return[2,a.sent().data]}}))}))},t.prototype.setHeaders=function(t){return this.options.headers=t,this},t.prototype.setHeader=function(t,e){var n,i=this.options.headers;return i?i[t]=e:this.options.headers=((n={})[t]=e,n),this},t.prototype.setEndpoint=function(t){return this.url=t,this},t}();function b(t){var e=t.url,i=t.query,r=t.variables,s=t.headers,u=t.operationName,c=t.fetch,h=t.method,l=void 0===h?"POST":h,d=t.fetchOptions;return o(this,void 0,void 0,(function(){var t,o,h,f,v,y,b;return a(this,(function(a){switch(a.label){case 0:return t="POST"===l.toUpperCase()?p:m,o=Array.isArray(i),[4,t({url:e,query:i,variables:r,operationName:u,headers:s,fetch:c,fetchOptions:d})];case 1:return[4,g(h=a.sent(),d.jsonSerializer)];case 2:if(f=a.sent(),v=o&&Array.isArray(f)?!f.some((function(t){return!t.data})):!!f.data,h.ok&&!f.errors&&v)return y=h.headers,b=h.status,[2,n(n({},o?{data:f}:f),{headers:y,status:b})];throw new vt.ClientError(n(n({},"string"==typeof f?{error:f}:f),{status:h.status,headers:h.headers}),{query:i,variables:r})}}))}))}function w(t,e,i,r){return o(this,void 0,void 0,(function(){var s;return a(this,(function(){return s=ft.parseRequestExtendedArgs(t,e,i,r),[2,new y(s.url).request(n({},s))]}))}))}function g(t,e){return void 0===e&&(e=lt.defaultJsonSerializer),o(this,void 0,void 0,(function(){var n,i,r;return a(this,(function(s){switch(s.label){case 0:return t.headers.forEach((function(t,e){"content-type"===e.toLowerCase()&&(n=t)})),n&&n.toLowerCase().startsWith("application/json")?(r=(i=e).parse,[4,t.text()]):[3,2];case 1:return[2,r.apply(i,[s.sent()])];case 2:return[2,t.text()]}}))}))}function O(t){var e,n=void 0,i=t.definitions.filter((function(t){return"OperationDefinition"===t.kind}));return 1===i.length&&(n=null===(e=i[0].name)||void 0===e?void 0:e.value),n}function E(t){if("string"==typeof t){var e=void 0;try{e=O(nt.parse(t))}catch(t){}return{query:t,operationName:e}}var n=O(t);return{query:st.print(t),operationName:n}}e.GraphQLClient=y,e.rawRequest=function(t,e,i,r){return o(this,void 0,void 0,(function(){var s;return a(this,(function(){return s=ft.parseRawRequestExtendedArgs(t,e,i,r),[2,new y(s.url).rawRequest(n({},s))]}))}))},e.request=w,e.batchRequests=function(t,e,i){return o(this,void 0,void 0,(function(){var r;return a(this,(function(){return r=ft.parseBatchRequestsExtendedArgs(t,e,i),[2,new y(r.url).batchRequests(n({},r))]}))}))},e.default=w,e.gql=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.reduce((function(t,n,i){return""+t+n+(i in e?e[i]:"")}),"")}}));class mt{constructor(){this.watingRequestsById=new Map}static get(){if(!mt.instance){mt.instance=new mt;const t=document.querySelector(this.appTagName);null===t?mt.instance.resume():(t.addEventListener("applicationLoading",(()=>mt.instance.pause())),t.addEventListener("applicationLoaded",(()=>mt.instance.resume())))}return this.instance}async callGraphQL(t){var e;const n=this.getReqKey(t);return t.queryID=n,t.values.queryID=n,this.ready?new Promise((async(e,i)=>{let r=this.getQueryTemplate(t);const s=await this.fecthGrapql([{document:r,variables:t.values}]);s.errors.length>0?i(s):e(s.data[0][n])})):(this.watingRequestsById.has(n)||this.watingRequestsById.set(n,new yt(t)),null===(e=this.getWatingRequest(n))||void 0===e?void 0:e.promise)}getReqKey(t){return window.btoa(this.hashCode(`${t.query}${JSON.stringify(t.values||"")}`)).replace(/=/g,"")}getQueryTemplate(t){return(t.query||"").replaceAll("$queryAlias$",t.queryID)}getWatingRequest(t){return this.watingRequestsById.get(t)}pause(){this.ready=!1}async resume(){if(this.ready=!0,this.watingRequestsById.size>0){const t=[];let e;this.watingRequestsById.forEach((async e=>{let n=this.getQueryTemplate(e.request);t.push({document:n,variables:Object.assign({},e.request.values)})}));let n=[],i=[];e=await this.fecthGrapql(t),n=e.data,i=e.errors,i.forEach((t=>{Object.entries(t).forEach((([t,e])=>{var n;((null===(n=this.getWatingRequest(e.request.variables[e.index].queryID))||void 0===n?void 0:n.reject)||Promise.reject)(e)}))})),n.forEach((t=>{Object.entries(t).forEach((([t,e])=>{var n;((null===(n=this.getWatingRequest(t))||void 0===n?void 0:n.resolve)||Promise.resolve)(e)}))})),this.watingRequestsById.clear()}}async fecthGrapql(t){let e,n=[],i=[];try{e=await pt.batchRequests("http://localhost:8082/",t),e.forEach((t=>{n.push(t.data)}))}catch(t){e=t.response;const r=t.request;Object.entries(e).forEach((([t,e])=>{e.errors?i.push(e.errors.map((e=>(e.request=r,e.index=Number(t),e)))):e.data&&n.push(e.data)}))}return{data:n,errors:i}}hashCode(t){var e,n=0;if(0===t.length)return n.toString();for(e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return n.toString()}}mt.appTagName="snk-application";class yt{constructor(t){this._resolve=()=>{},this._reject=()=>{},this._request=void 0,this._request=t,this._promisse=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}get resolve(){return this._resolve}get reject(){return this._reject}get promise(){return this._promisse}get request(){return this._request}}class bt{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchDataUnit",pt.gql`query($name: String!) {
2
- $queryAlias$: fetchDataUnit(name: $name){
3
- name
4
- fields{
5
- name
6
- defaultValue
7
- label
8
- readOnly
9
- required
10
- dataType
11
- userInterface
12
- properties{
13
- name
14
- value
15
- }
16
- dependencies{
17
- masterFields
18
- type
19
- expression
20
- }
21
- }
22
- }
23
- }`),this.templateByQuery.set("fetchData",pt.gql`query($dataunit: String! $first: Int $offset:Int $filter: [Filter!] $sort: [Sort!]) {
24
- $queryAlias$: fetchDataUnit(name: $dataunit){
25
- data(first: $first offset: $offset filters: $filter sort: $sort){
26
- first
27
- offset
28
- total
29
- hasMore
30
- records{
31
- id
32
- fields {
33
- name
34
- value
35
- }
36
- }
37
- }
38
- }
39
- }`),this.templateByQuery.set("saveData",pt.gql`mutation($changes: [Change!]!) {
40
- $queryAlias$: saveDataUnitChanges(changes: $changes){
41
- oldId
42
- id
43
- fields {
44
- name
45
- value
46
- }
47
- }
48
- }`)}getDataUnit(t,e){const n=new F(`dd://${t}/${e}`);return n.metadataLoader=t=>this.loadMetadata(t),n.dataLoader=(t,e,n)=>this.loadData(t,e,n),n.saveLoader=(t,e)=>this.saveData(t,e),n}loadMetadata(t){return new Promise(((e,n)=>{mt.get().callGraphQL({values:{name:t.name},query:this.templateByQuery.get("fetchDataUnit")}).then((t=>{var n;const i={name:t.name,label:t.name,fields:[]};null===(n=t.fields)||void 0===n||n.forEach((t=>{let e;Array.isArray(t.properties)&&(e={},t.properties.forEach((t=>e[t.name]=t.value))),i.fields.push(Object.assign(Object.assign({},t),{properties:e}))})),e(i)})).catch((t=>{n(t)}))}))}loadData(t,e,n){return new Promise(((i,r)=>{mt.get().callGraphQL({values:{dataunit:t.name,sort:e,filters:n},query:this.templateByQuery.get("fetchData")}).then((e=>{const n=[];e.data.records.forEach((e=>{const i={__record__id__:e.id};e.fields.forEach((({name:e,value:n})=>{i[e]=t.valueFromString(e,n)})),n.push(i)})),i(n)})).catch((t=>{r(t)}))}))}saveData(t,e){const n=e.map((t=>{const{dataUnit:e,record:n,updatingFields:i,operation:r}=t;return{dataUnit:e,updatingFields:Object.entries(i).map((([t,e])=>(e&&(e=e.toString()),{fieldName:t,value:e}))),operation:r,recordId:n.__record__id__}}));return new Promise(((e,i)=>{mt.get().callGraphQL({values:{changes:n},query:this.templateByQuery.get("saveData")}).then((n=>{const i=[];null==n||n.forEach((e=>{const n={__record__id__:e.id};e.oldId&&(n.__old__id__=e.oldId),e.fields.forEach((({name:e,value:i})=>{n[e]=t.valueFromString(e,i)})),i.push(n)})),e(i)})).catch((t=>{i(t)}))}))}}class wt{static openAppActivity(t,e){var n;null===(n=window.workspace)||void 0===n||n.openAppActivity(t,e)}}wt.resourceID=window.workspace.resourceID;class gt{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchParam",pt.gql`query($name: String!) {
49
- $queryAlias$: fetchResource(name: $name){
50
- name
51
- resource
52
- }
53
- }`)}async getParam(t,e){const n=`param://${e}?params=${window.btoa(t)}`;return mt.get().callGraphQL({values:{name:n},query:this.templateByQuery.get("fetchParam")})}async asString(t,e){const n=await this.getParam(t,e);return this.getValue(n)}async asInteger(t,e){const n=await this.getParam(t,e);return parseInt(this.getValue(n))}async asFloat(t,e){const n=await this.getParam(t,e);return parseFloat(this.getValue(n))}async asBoolean(t,e){const n=await this.getParam(t,e);return"S"==this.getValue(n)}async asDate(t,e){const n=await this.getParam(t,e);return r.strToDate(this.getValue(n))}async getBatchParams(t,e){const n=await this.getParam(t.join(","),e),i={};return n.forEach((t=>i[t.name]=t.resource)),i}getValue(t={}){return Array.isArray(t)&&t.length>0&&(t=t[0]),class{static isEmpty(t){return null==t||null===t||0===(t=(t=t.toString()).trim()).length}static replaceAccentuatedChars(t){return(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.toUpperCase()).replace(/[À]/,"A")).replace(/[Á]/,"A")).replace(/[Â]/,"A")).replace(/[Ã]/,"A")).replace(/[Ä]/,"A")).replace(/[È]/,"E")).replace(/[É]/,"E")).replace(/[Ê]/,"E")).replace(/[Ë]/,"E")).replace(/[Ì]/,"I")).replace(/[Í]/,"I")).replace(/[Î]/,"I")).replace(/[Ï]/,"I")).replace(/[Ò]/,"O")).replace(/[Ó]/,"O")).replace(/[Ô]/,"O")).replace(/[Ö]/,"O")).replace(/[Ù]/,"U")).replace(/[Ú]/,"U")).replace(/[Û]/,"U")).replace(/[Ü]/,"U")).replace(/[Ç]/,"C")).replace(/[^a-z0-9]/gi,"")}}.isEmpty(t.resource)?"":t.resource}}class Ot{static async showDialog(t,e,n=null,i,r=!1){return new Promise((s=>{let o=document.querySelector("ez-dialog");o||(o=document.createElement("ez-dialog"),window.document.body.appendChild(o)),o.show(t,e,r,i,n).then((t=>s(t)))}))}static async alert(t,e,n=null){return Ot.showDialog(t,e,n,!1,!1)}static async error(t,e,n=null){return Ot.showDialog(t,e,n,!1,!0)}static async confirm(t,e,n=null,i=!1){return Ot.showDialog(t,e,n,!0,i)}static async info(t){let e=document.querySelector("ez-toast");e||(e=document.createElement("ez-toast"),window.document.body.appendChild(e)),e.message=t,e.fadeTime=4e3,e.show()}}class Et extends class{constructor(){this.templateByQuery=new Map,this.buldTemplates()}buldTemplates(){this.templateByQuery.set("fetchResource",pt.gql`query($name: String!) {
54
- $queryAlias$: fetchResource(name: $name){
55
- resource
56
- }
57
- }`)}loadResource(t){return new Promise(((e,n)=>{mt.get().callGraphQL({values:{name:t},query:this.templateByQuery.get("fetchResource")}).then((t=>{e(null==t?void 0:t.resource)})).catch((t=>{n(t)}))}))}}{loadFormConfig(t,e){return new Promise(((n,i)=>{this.loadResource(`cfg://form/${e}/${t}`).then((e=>{if(e){const t=JSON.parse(e),{tabs:i,fields:r}=t;if(i){const t=new Map(i.map((t=>[t.label,t])));r.forEach((e=>e.tab=t.get(e.tab)))}n(r)}else i(`Sem configuração pro formulário "${t}".`)})).catch((t=>{i(t)}))}))}}const Tt={ImplantacaoSaldoConta:[{value:6,label:"Conta Financeiro"},{value:7,label:"Conta Banco do Brasil"}],HistoricoBancario:[{value:9,label:"Lanç. Origem"},{value:8,label:"Lanç. Origem 2"}],ContaDestino:[{value:10,label:"Conta BB"},{value:7,label:"Conta Santander"}],HistoricoBancarioDestino:[{value:11,label:"Contra Bradesco"},{value:13,label:"Contra Destino"}],Usuario:[{value:0,label:"SUP"}],ContaBancaria:[{value:10,label:"Conta 10"},{value:17,label:"Conta 17"}],TipoOperacao:[{value:4,label:"Entrada NFse"},{value:5,label:"Outra top"},{value:6,label:"Top 6"}]},Dt=(t,e,n)=>{var i;console.log(t);const r=null===(i=n.getField(e).properties)||void 0===i?void 0:i.ENTITYNAME;return Tt[r]||[]},St=class{constructor(n){t(this,n),this.applicationLoaded=e(this,"applicationLoaded",7),this.applicationLoading=e(this,"applicationLoading",7)}get parameters(){return this._parameters||(this._parameters=new gt),this._parameters}get resourceID(){return this._resourceID||(this._resourceID=this.urlParams.get("workspaceResourceID")||this.urlParams.get("resourceID")||wt.resourceID||"unknown.resource.id"),this._resourceID}async getStringParam(t){return this.parameters.asString(t,this.resourceID)}async getIntParam(t){return this.parameters.asInteger(t,this.resourceID)}async getFloatParam(t){return this.parameters.asFloat(t,this.resourceID)}async getBooleanParam(t){return this.parameters.asBoolean(t,this.resourceID)}async getDateParam(t){return this.parameters.asDate(t,this.resourceID)}async temOpcional(t){const e=t.split(",");return new Promise(((t,n)=>{this.getAttributeFromHTMLWrapper("opc0009").then((i=>{"1"===i?t(!0):Promise.all(e.map((t=>this.getAttributeFromHTMLWrapper("opc"+t)))).then((e=>{t(e.includes("1"))})).catch((t=>{n(t)}))})).catch((t=>{n(t)}))}))}async getAttributeFromHTMLWrapper(t){return Promise.resolve(window[t])}async openApp(t,e){wt.openAppActivity(t,e)}async createDataunit(t){return new Promise((e=>{const n=this.dataUnitFetcher.getDataUnit(t,this.resourceID);n.loadMetadata(),e(n)}))}async getResourceID(){return Promise.resolve(this.resourceID)}async alert(t,e,n){return Ot.alert(t,e,n)}async error(t,e,n){return Ot.error(t,e,n)}async confirm(t,e,n,i){return Ot.confirm(t,e,n,i)}async info(t){return Ot.info(t)}async loadFormConfig(t){return this.formConfigFetcher.loadFormConfig(t,this.resourceID)}get urlParams(){return this._urlParams||(this._urlParams=class{static getQueryParams(t){const e=new Map,n=/[?&]?([^=]+)=([^&]*)/g;let i;for(t=(t=window.unescape(t)).split("+").join(" ");i=n.exec(t);)e.set(window.decodeURIComponent(i[1]),i[2]);return e.set("urlBase",this.getUrlBase()),window.moduleID&&window.URIServiceBroker&&(e.set("moduleID",window.moduleID),e.set("URIServiceBroker",window.URIServiceBroker)),e}static getUrlBase(){return`${location.protocol}"//"${location.hostname}${location.port?":"+location.port:""}`}}.getQueryParams(location.search)),this._urlParams}get dataUnitFetcher(){return this._dataUnitFetcher||(this._dataUnitFetcher=new bt),this._dataUnitFetcher}get formConfigFetcher(){return this._formConfigFetcher||(this._formConfigFetcher=new Et),this._formConfigFetcher}componentWillLoad(){C.setContextValue("__EZUI__SEARCH__OPTION__LOADER__",Dt)}componentDidLoad(){this.applicationLoading.emit(!0),window.requestAnimationFrame((()=>{this.applicationLoaded.emit(!0)}))}render(){return n("div",null)}};St.style=".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";export{St as snk_application}