From ed1feb2fee515160aba593d13193ec2dcf8ef2ce Mon Sep 17 00:00:00 2001 From: Sam Beveridge Date: Thu, 20 Nov 2025 11:25:47 -0800 Subject: [PATCH 1/8] in progress lit-element testing --- .../dist/src/SqlReferralCode.d.ts | 9 + .../dist/src/SqlReferralCode.js | 53 + .../dist/src/SqlReferralCode.js.map | 1 + .../lit-components/dist/src/index.d.ts | 1 + .../packages/lit-components/dist/src/index.js | 2 + .../lit-components/dist/src/index.js.map | 1 + .../dist/src/sql-referral-code.d.ts | 1 + .../dist/src/sql-referral-code.js | 3 + .../dist/src/sql-referral-code.js.map | 1 + .../dist/stories/index.stories.d.ts | 33 + .../dist/stories/index.stories.js | 37 + .../dist/stories/index.stories.js.map | 1 + .../dist/test/sql-referral-code.test.d.ts | 1 + .../dist/test/sql-referral-code.test.js | 24 + .../dist/test/sql-referral-code.test.js.map | 1 + .../lit-components/dist/tsconfig.tsbuildinfo | 1 + packages/lit-components/LICENSE | 21 + packages/lit-components/README.md | 76 + packages/lit-components/custom-elements.json | 168 + packages/lit-components/demo/index.html | 51 + .../lit-components/dist/rollup.config.d.ts | 10 + packages/lit-components/dist/rollup.config.js | 59 + .../lit-components/dist/rollup.config.js.map | 1 + .../dist/src/SqlReferralCode.d.ts | 9 + .../dist/src/SqlReferralCode.js | 53 + .../dist/src/SqlReferralCode.js.map | 1 + packages/lit-components/dist/src/index.d.ts | 1 + packages/lit-components/dist/src/index.js | 9490 ++++++++ packages/lit-components/dist/src/index.js.map | 1 + .../dist/src/sql-referral-code.d.ts | 1 + .../dist/src/sql-referral-code.js | 9492 ++++++++ .../dist/src/sql-referral-code.js.map | 1 + .../dist/stories/index.stories.d.ts | 33 + .../dist/stories/index.stories.js | 37 + .../dist/stories/index.stories.js.map | 1 + .../dist/test/sql-referral-code.test.d.ts | 1 + .../dist/test/sql-referral-code.test.js | 24 + .../dist/test/sql-referral-code.test.js.map | 1 + .../lit-components/dist/tsconfig.tsbuildinfo | 1 + packages/lit-components/package-lock.json | 19126 ++++++++++++++++ packages/lit-components/package.json | 105 + packages/lit-components/rollup.config.js | 89 + .../lit-components/src/SqlReferralCode.ts | 56 + packages/lit-components/src/index.ts | 1 + .../lit-components/src/sql-referral-code.ts | 3 + .../lit-components/stories/index.stories.ts | 60 + .../test/sql-referral-code.test.ts | 32 + packages/lit-components/tsconfig.json | 22 + .../lit-components/web-dev-server.config.js | 27 + .../lit-components/web-test-runner.config.js | 41 + packages/mint-components/src/components.d.ts | 40 - 51 files changed, 39265 insertions(+), 40 deletions(-) create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.d.ts create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.js create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.js.map create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.d.ts create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.js create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.js.map create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.d.ts create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.js create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.js.map create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.d.ts create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.js create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.js.map create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.d.ts create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.js create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.js.map create mode 100644 packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/tsconfig.tsbuildinfo create mode 100644 packages/lit-components/LICENSE create mode 100644 packages/lit-components/README.md create mode 100644 packages/lit-components/custom-elements.json create mode 100644 packages/lit-components/demo/index.html create mode 100644 packages/lit-components/dist/rollup.config.d.ts create mode 100644 packages/lit-components/dist/rollup.config.js create mode 100644 packages/lit-components/dist/rollup.config.js.map create mode 100644 packages/lit-components/dist/src/SqlReferralCode.d.ts create mode 100644 packages/lit-components/dist/src/SqlReferralCode.js create mode 100644 packages/lit-components/dist/src/SqlReferralCode.js.map create mode 100644 packages/lit-components/dist/src/index.d.ts create mode 100644 packages/lit-components/dist/src/index.js create mode 100644 packages/lit-components/dist/src/index.js.map create mode 100644 packages/lit-components/dist/src/sql-referral-code.d.ts create mode 100644 packages/lit-components/dist/src/sql-referral-code.js create mode 100644 packages/lit-components/dist/src/sql-referral-code.js.map create mode 100644 packages/lit-components/dist/stories/index.stories.d.ts create mode 100644 packages/lit-components/dist/stories/index.stories.js create mode 100644 packages/lit-components/dist/stories/index.stories.js.map create mode 100644 packages/lit-components/dist/test/sql-referral-code.test.d.ts create mode 100644 packages/lit-components/dist/test/sql-referral-code.test.js create mode 100644 packages/lit-components/dist/test/sql-referral-code.test.js.map create mode 100644 packages/lit-components/dist/tsconfig.tsbuildinfo create mode 100644 packages/lit-components/package-lock.json create mode 100644 packages/lit-components/package.json create mode 100644 packages/lit-components/rollup.config.js create mode 100644 packages/lit-components/src/SqlReferralCode.ts create mode 100644 packages/lit-components/src/index.ts create mode 100644 packages/lit-components/src/sql-referral-code.ts create mode 100644 packages/lit-components/stories/index.stories.ts create mode 100644 packages/lit-components/test/sql-referral-code.test.ts create mode 100644 packages/lit-components/tsconfig.json create mode 100644 packages/lit-components/web-dev-server.config.js create mode 100644 packages/lit-components/web-test-runner.config.js diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.d.ts b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.d.ts new file mode 100644 index 0000000000..5cbf6918c0 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.d.ts @@ -0,0 +1,9 @@ +import { LitElement } from 'lit'; +export declare class SqlReferralCode extends LitElement { + static styles: import("lit").CSSResult; + constructor(); + header: string; + counter: number; + __increment(): void; + render(): import("lit-html").TemplateResult<1>; +} diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.js b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.js new file mode 100644 index 0000000000..3c7c874d68 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.js @@ -0,0 +1,53 @@ +import { __decorate } from "tslib"; +import { html, css, LitElement } from 'lit'; +import { property } from 'lit/decorators.js'; +// import { setImplementation } from '@saasquatch/universal-hooks'; +// import * as haunted from 'haunted'; +// setImplementation(haunted); +// @ts-ignore +import { useQuery, useProgramId } from '@saasquatch/component-boilerplate'; +import { gql } from 'graphql-tag'; +const MessageLinkQuery = gql ` + query getReferralCode($programId: ID) { + user: viewer { + ... on User { + referralCode(programId: $programId) + } + } + } +`; +export class SqlReferralCode extends LitElement { + constructor() { + super(); + this.header = 'Hey there'; + this.counter = 5; + console.log('yay'); + const programId = useProgramId(); + // const user = useUserIdentity(); + const { data } = useQuery(MessageLinkQuery, { programId }); + // console.log({ user }); + } + __increment() { + this.counter += 1; + } + render() { + return html ` +

${this.header} Nr. ${this.counter}!

+ + `; + } +} +SqlReferralCode.styles = css ` + :host { + display: block; + padding: 25px; + color: var(--sql-referral-code-text-color, #000); + } + `; +__decorate([ + property({ type: String }) +], SqlReferralCode.prototype, "header", void 0); +__decorate([ + property({ type: Number }) +], SqlReferralCode.prototype, "counter", void 0); +//# sourceMappingURL=SqlReferralCode.js.map \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.js.map b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.js.map new file mode 100644 index 0000000000..b2165b663e --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/SqlReferralCode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SqlReferralCode.js","sourceRoot":"","sources":["../../src/SqlReferralCode.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,mEAAmE;AACnE,sCAAsC;AACtC,8BAA8B;AAE9B,aAAa;AACb,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;CAQ3B,CAAC;AAEF,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAS7C;QACE,KAAK,EAAE,CAAC;QAWkB,WAAM,GAAG,WAAW,CAAC;QAErB,YAAO,GAAG,CAAC,CAAC;QAZtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;QACjC,kCAAkC;QAElC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAE3D,yBAAyB;IAC3B,CAAC;IAMD,WAAW;QACT,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;YACH,IAAI,CAAC,MAAM,QAAQ,IAAI,CAAC,OAAO;uBACpB,IAAI,CAAC,WAAW;KAClC,CAAC;IACJ,CAAC;;AAjCM,sBAAM,GAAG,GAAG,CAAA;;;;;;GAMlB,AANY,CAMX;AAc0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAsB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAa","sourcesContent":["import { html, css, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n// import { setImplementation } from '@saasquatch/universal-hooks';\n// import * as haunted from 'haunted';\n// setImplementation(haunted);\n\n// @ts-ignore\nimport { useQuery, useProgramId } from '@saasquatch/component-boilerplate';\nimport { gql } from 'graphql-tag';\n\nconst MessageLinkQuery = gql`\n query getReferralCode($programId: ID) {\n user: viewer {\n ... on User {\n referralCode(programId: $programId)\n }\n }\n }\n`;\n\nexport class SqlReferralCode extends LitElement {\n static styles = css`\n :host {\n display: block;\n padding: 25px;\n color: var(--sql-referral-code-text-color, #000);\n }\n `;\n\n constructor() {\n super();\n console.log('yay');\n\n const programId = useProgramId();\n // const user = useUserIdentity();\n\n const { data } = useQuery(MessageLinkQuery, { programId });\n\n // console.log({ user });\n }\n\n @property({ type: String }) header = 'Hey there';\n\n @property({ type: Number }) counter = 5;\n\n __increment() {\n this.counter += 1;\n }\n\n render() {\n return html`\n

${this.header} Nr. ${this.counter}!

\n \n `;\n }\n}\n"]} \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.d.ts b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.d.ts new file mode 100644 index 0000000000..9ba7143ed0 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.d.ts @@ -0,0 +1 @@ +export { SqlReferralCode } from './SqlReferralCode'; diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.js b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.js new file mode 100644 index 0000000000..66b1e6e5dd --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.js @@ -0,0 +1,2 @@ +export { SqlReferralCode } from './SqlReferralCode'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.js.map b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.js.map new file mode 100644 index 0000000000..11856a324c --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["export { SqlReferralCode } from './SqlReferralCode';\n"]} \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.d.ts b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.d.ts new file mode 100644 index 0000000000..cb0ff5c3b5 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.js b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.js new file mode 100644 index 0000000000..0eb72b22a6 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.js @@ -0,0 +1,3 @@ +import { SqlReferralCode } from './SqlReferralCode'; +window.customElements.define('sql-referral-code', SqlReferralCode); +//# sourceMappingURL=sql-referral-code.js.map \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.js.map b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.js.map new file mode 100644 index 0000000000..2c0ed5e709 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/src/sql-referral-code.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sql-referral-code.js","sourceRoot":"","sources":["../../src/sql-referral-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { SqlReferralCode } from './SqlReferralCode';\n\nwindow.customElements.define('sql-referral-code', SqlReferralCode);\n"]} \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.d.ts b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.d.ts new file mode 100644 index 0000000000..84e7899e78 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.d.ts @@ -0,0 +1,33 @@ +import { TemplateResult } from 'lit'; +import '../src/sql-referral-code.js'; +declare const _default: { + title: string; + component: string; + argTypes: { + header: { + control: string; + }; + counter: { + control: string; + }; + textColor: { + control: string; + }; + }; +}; +export default _default; +interface Story { + (args: T): TemplateResult; + args?: Partial; + argTypes?: Record; +} +interface ArgTypes { + header?: string; + counter?: number; + textColor?: string; + slot?: TemplateResult; +} +export declare const Regular: Story; +export declare const CustomHeader: Story; +export declare const CustomCounter: Story; +export declare const SlottedContent: Story; diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.js b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.js new file mode 100644 index 0000000000..963fa184c3 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.js @@ -0,0 +1,37 @@ +import { html } from 'lit'; +import '../src/sql-referral-code.js'; +export default { + title: 'SqlReferralCode', + component: 'sql-referral-code', + argTypes: { + header: { control: 'text' }, + counter: { control: 'number' }, + textColor: { control: 'color' }, + }, +}; +const Template = ({ header = 'Hello world', counter = 5, textColor, slot, }) => html ` + + ${slot} + +`; +export const Regular = Template.bind({}); +export const CustomHeader = Template.bind({}); +CustomHeader.args = { + header: 'My header', +}; +export const CustomCounter = Template.bind({}); +CustomCounter.args = { + counter: 123456, +}; +export const SlottedContent = Template.bind({}); +SlottedContent.args = { + slot: html `

Slotted content

`, +}; +SlottedContent.argTypes = { + slot: { table: { disable: true } }, +}; +//# sourceMappingURL=index.stories.js.map \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.js.map b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.js.map new file mode 100644 index 0000000000..249192c541 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/stories/index.stories.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.stories.js","sourceRoot":"","sources":["../../stories/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,6BAA6B,CAAC;AAErC,eAAe;IACb,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,mBAAmB;IAC9B,QAAQ,EAAE;QACR,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC3B,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC9B,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;KAChC;CACF,CAAC;AAeF,MAAM,QAAQ,GAAoB,CAAC,EACjC,MAAM,GAAG,aAAa,EACtB,OAAO,GAAG,CAAC,EACX,SAAS,EACT,IAAI,GACK,EAAE,EAAE,CAAC,IAAI,CAAA;;6CAEyB,SAAS,IAAI,OAAO;cACnD,MAAM;eACL,OAAO;;MAEhB,IAAI;;CAET,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC9C,YAAY,CAAC,IAAI,GAAG;IAClB,MAAM,EAAE,WAAW;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/C,aAAa,CAAC,IAAI,GAAG;IACnB,OAAO,EAAE,MAAM;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAChD,cAAc,CAAC,IAAI,GAAG;IACpB,IAAI,EAAE,IAAI,CAAA,wBAAwB;CACnC,CAAC;AACF,cAAc,CAAC,QAAQ,GAAG;IACxB,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CACnC,CAAC","sourcesContent":["import { html, TemplateResult } from 'lit';\nimport '../src/sql-referral-code.js';\n\nexport default {\n title: 'SqlReferralCode',\n component: 'sql-referral-code',\n argTypes: {\n header: { control: 'text' },\n counter: { control: 'number' },\n textColor: { control: 'color' },\n },\n};\n\ninterface Story {\n (args: T): TemplateResult;\n args?: Partial;\n argTypes?: Record;\n}\n\ninterface ArgTypes {\n header?: string;\n counter?: number;\n textColor?: string;\n slot?: TemplateResult;\n}\n\nconst Template: Story = ({\n header = 'Hello world',\n counter = 5,\n textColor,\n slot,\n}: ArgTypes) => html`\n \n ${slot}\n \n`;\n\nexport const Regular = Template.bind({});\n\nexport const CustomHeader = Template.bind({});\nCustomHeader.args = {\n header: 'My header',\n};\n\nexport const CustomCounter = Template.bind({});\nCustomCounter.args = {\n counter: 123456,\n};\n\nexport const SlottedContent = Template.bind({});\nSlottedContent.args = {\n slot: html`

Slotted content

`,\n};\nSlottedContent.argTypes = {\n slot: { table: { disable: true } },\n};\n"]} \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.d.ts b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.d.ts new file mode 100644 index 0000000000..022d380cf1 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.d.ts @@ -0,0 +1 @@ +import '../src/sql-referral-code.js'; diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.js b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.js new file mode 100644 index 0000000000..bddc6f4689 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.js @@ -0,0 +1,24 @@ +import { html } from 'lit'; +import { fixture, expect } from '@open-wc/testing'; +import '../src/sql-referral-code.js'; +describe('SqlReferralCode', () => { + it('has a default header "Hey there" and counter 5', async () => { + const el = await fixture(html ``); + expect(el.header).to.equal('Hey there'); + expect(el.counter).to.equal(5); + }); + it('increases the counter on button click', async () => { + const el = await fixture(html ``); + el.shadowRoot.querySelector('button').click(); + expect(el.counter).to.equal(6); + }); + it('can override the header via attribute', async () => { + const el = await fixture(html ``); + expect(el.header).to.equal('attribute header'); + }); + it('passes the a11y audit', async () => { + const el = await fixture(html ``); + await expect(el).shadowDom.to.be.accessible(); + }); +}); +//# sourceMappingURL=sql-referral-code.test.js.map \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.js.map b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.js.map new file mode 100644 index 0000000000..c1e35f90d3 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/test/sql-referral-code.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sql-referral-code.test.js","sourceRoot":"","sources":["../../test/sql-referral-code.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,6BAA6B,CAAC;AAErC,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,gDAAgD,EAAE,KAAK,IAAI,EAAE;QAC9D,MAAM,EAAE,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA,yCAAyC,CAAC,CAAC;QAEzF,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QACxC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA,yCAAyC,CAAC,CAAC;QACzF,EAAE,CAAC,UAAW,CAAC,aAAa,CAAC,QAAQ,CAAE,CAAC,KAAK,EAAE,CAAC;QAEhD,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;QACrD,MAAM,EAAE,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA,mEAAmE,CAAC,CAAC;QAEnH,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;QACrC,MAAM,EAAE,GAAG,MAAM,OAAO,CAAkB,IAAI,CAAA,yCAAyC,CAAC,CAAC;QAEzF,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html } from 'lit';\nimport { fixture, expect } from '@open-wc/testing';\nimport { SqlReferralCode } from '../src/SqlReferralCode.js';\nimport '../src/sql-referral-code.js';\n\ndescribe('SqlReferralCode', () => {\n it('has a default header \"Hey there\" and counter 5', async () => {\n const el = await fixture(html``);\n\n expect(el.header).to.equal('Hey there');\n expect(el.counter).to.equal(5);\n });\n\n it('increases the counter on button click', async () => {\n const el = await fixture(html``);\n el.shadowRoot!.querySelector('button')!.click();\n\n expect(el.counter).to.equal(6);\n });\n\n it('can override the header via attribute', async () => {\n const el = await fixture(html``);\n\n expect(el.header).to.equal('attribute header');\n });\n\n it('passes the a11y audit', async () => {\n const el = await fixture(html``);\n\n await expect(el).shadowDom.to.be.accessible();\n });\n});\n"]} \ No newline at end of file diff --git a/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/tsconfig.tsbuildinfo b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/tsconfig.tsbuildinfo new file mode 100644 index 0000000000..c20a171949 --- /dev/null +++ b/packages/lit-components/.rollup.cache/Users/sambeveridge/Documents/GitHub/program-tools/packages/lit-components/dist/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.dom.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2016.intl.d.ts","../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../node_modules/typescript/lib/lib.es2017.date.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../node_modules/typescript/lib/lib.esnext.float16.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/tslib/tslib.d.ts","../node_modules/@lit/reactive-element/css-tag.d.ts","../node_modules/@lit/reactive-element/reactive-controller.d.ts","../node_modules/@lit/reactive-element/reactive-element.d.ts","../node_modules/lit-html/directive.d.ts","../node_modules/@types/trusted-types/lib/index.d.ts","../node_modules/lit-html/lit-html.d.ts","../node_modules/lit-element/lit-element.d.ts","../node_modules/lit-html/is-server.d.ts","../node_modules/lit/index.d.ts","../node_modules/@lit/reactive-element/decorators/base.d.ts","../node_modules/@lit/reactive-element/decorators/custom-element.d.ts","../node_modules/@lit/reactive-element/decorators/property.d.ts","../node_modules/@lit/reactive-element/decorators/state.d.ts","../node_modules/@lit/reactive-element/decorators/event-options.d.ts","../node_modules/@lit/reactive-element/decorators/query.d.ts","../node_modules/@lit/reactive-element/decorators/query-all.d.ts","../node_modules/@lit/reactive-element/decorators/query-async.d.ts","../node_modules/@lit/reactive-element/decorators/query-assigned-nodes.d.ts","../node_modules/@lit/reactive-element/decorators/query-assigned-elements.d.ts","../node_modules/lit/decorators.d.ts","../node_modules/@types/node/compatibility/iterators.d.ts","../node_modules/@types/node/globals.typedarray.d.ts","../node_modules/@types/node/buffer.buffer.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/web-globals/abortcontroller.d.ts","../node_modules/@types/node/web-globals/crypto.d.ts","../node_modules/@types/node/web-globals/domexception.d.ts","../node_modules/@types/node/web-globals/events.d.ts","../node_modules/buffer/index.d.ts","../node_modules/undici-types/utility.d.ts","../node_modules/undici-types/header.d.ts","../node_modules/undici-types/readable.d.ts","../node_modules/undici-types/fetch.d.ts","../node_modules/undici-types/formdata.d.ts","../node_modules/undici-types/connector.d.ts","../node_modules/undici-types/client-stats.d.ts","../node_modules/undici-types/client.d.ts","../node_modules/undici-types/errors.d.ts","../node_modules/undici-types/dispatcher.d.ts","../node_modules/undici-types/global-dispatcher.d.ts","../node_modules/undici-types/global-origin.d.ts","../node_modules/undici-types/pool-stats.d.ts","../node_modules/undici-types/pool.d.ts","../node_modules/undici-types/handlers.d.ts","../node_modules/undici-types/balanced-pool.d.ts","../node_modules/undici-types/h2c-client.d.ts","../node_modules/undici-types/agent.d.ts","../node_modules/undici-types/mock-interceptor.d.ts","../node_modules/undici-types/mock-call-history.d.ts","../node_modules/undici-types/mock-agent.d.ts","../node_modules/undici-types/mock-client.d.ts","../node_modules/undici-types/mock-pool.d.ts","../node_modules/undici-types/snapshot-agent.d.ts","../node_modules/undici-types/mock-errors.d.ts","../node_modules/undici-types/proxy-agent.d.ts","../node_modules/undici-types/env-http-proxy-agent.d.ts","../node_modules/undici-types/retry-handler.d.ts","../node_modules/undici-types/retry-agent.d.ts","../node_modules/undici-types/api.d.ts","../node_modules/undici-types/cache-interceptor.d.ts","../node_modules/undici-types/interceptors.d.ts","../node_modules/undici-types/util.d.ts","../node_modules/undici-types/cookies.d.ts","../node_modules/undici-types/patch.d.ts","../node_modules/undici-types/websocket.d.ts","../node_modules/undici-types/eventsource.d.ts","../node_modules/undici-types/diagnostics-channel.d.ts","../node_modules/undici-types/content-type.d.ts","../node_modules/undici-types/cache.d.ts","../node_modules/undici-types/index.d.ts","../node_modules/@types/node/web-globals/fetch.d.ts","../node_modules/@types/node/web-globals/navigator.d.ts","../node_modules/@types/node/web-globals/storage.d.ts","../node_modules/@types/node/web-globals/streams.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/inspector.generated.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/sea.d.ts","../node_modules/@types/node/sqlite.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/dom-context/dist/index.d.ts","../node_modules/@saasquatch/component-environment/dist/index.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/environment/uselocale.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/environment/useprogramid.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/environment/useuseridentity.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/environment/index.d.ts","../node_modules/graphql/language/kinds.d.ts","../node_modules/graphql/language/source.d.ts","../node_modules/graphql/language/tokenkind.d.ts","../node_modules/graphql/language/ast.d.ts","../node_modules/graphql-request/dist/types.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/graphql/usebasequery.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/useauthenticatewithemailandpasswordmutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/useregisterwithemailandpasswordmutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/useregisterviaregistrationformmutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/usechangepasswordmutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/useresetpasswordmutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/useverifypasswordresetcodemutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/useverifyemailmutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/userequestpasswordresetemailmutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/userequestverificationemailmutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/usemanagedidentitysessionquery.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/instantaccess/useauthenticatemanagedidentitywithinstantaccess.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/managedidentity/useauthenticatewithgoogle.d.ts","../node_modules/graphql-request/dist/types.dom.d.ts","../node_modules/graphql-request/dist/index.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/subscription.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/types.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/subscriber.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/operator.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/iif.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/throwerror.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/subject.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/connectableobservable.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/operators/groupby.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/symbol/observable.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/behaviorsubject.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/replaysubject.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/asyncsubject.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/action.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/asyncscheduler.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/asyncaction.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/asapscheduler.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/asap.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/async.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/queuescheduler.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/queue.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/animationframescheduler.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/animationframe.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduler/virtualtimescheduler.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/notification.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/pipe.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/noop.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/identity.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/isobservable.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/argumentoutofrangeerror.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/emptyerror.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/objectunsubscribederror.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/unsubscriptionerror.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/util/timeouterror.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/bindcallback.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/bindnodecallback.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/innersubscriber.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/outersubscriber.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/combinelatest.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/concat.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/defer.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/empty.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/forkjoin.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/from.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/fromevent.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/fromeventpattern.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/generate.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/interval.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/merge.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/never.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/of.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/onerrorresumenext.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/pairs.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/partition.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/race.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/range.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/timer.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/using.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/observable/zip.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/scheduled/scheduled.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/internal/config.d.ts","../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/index.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/batchedgraphqlclient.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/graphql/usequery.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/graphql/usemutation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/graphql/uselazyquery.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/graphql/usegraphqlclient.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/graphql/refresh.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/graphql/useparentquery.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/usenavigation.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/pagination/usepagination.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/pagination/usepaginatedquery.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/usedebounce.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/usetick.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/usehost.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/useparentstate.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/useshareevent.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/useloadevent.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/hooks/useform.d.ts","../node_modules/@saasquatch/component-boilerplate/dist/index.d.ts","../node_modules/graphql-tag/lib/index.d.ts","../src/sqlreferralcode.ts","../src/index.ts","../src/sql-referral-code.ts","../stories/index.stories.ts","../node_modules/@types/chai/index.d.ts","../node_modules/@open-wc/semantic-dom-diff/get-diffable-html.d.ts","../node_modules/@open-wc/semantic-dom-diff/chai-dom-diff-plugin.d.ts","../node_modules/@open-wc/semantic-dom-diff/chai-dom-diff.d.ts","../node_modules/@open-wc/semantic-dom-diff/index.d.ts","../node_modules/chai-a11y-axe/chai-a11y-axe-plugin.d.ts","../node_modules/chai-a11y-axe/src/accessible.d.ts","../node_modules/chai-a11y-axe/index.d.ts","../node_modules/@types/chai-dom/index.d.ts","../node_modules/@types/sinonjs__fake-timers/index.d.ts","../node_modules/@types/sinon/index.d.ts","../node_modules/@types/sinon-chai/index.d.ts","../node_modules/@open-wc/testing/register-chai-plugins.d.ts","../node_modules/@open-wc/testing-helpers/types/src/elementupdated.d.ts","../node_modules/lit-html/static.d.ts","../node_modules/lit/static-html.d.ts","../node_modules/@open-wc/testing-helpers/types/src/renderable.d.ts","../node_modules/@open-wc/dedupe-mixin/index.d.ts","../node_modules/@open-wc/scoped-elements/types.d.ts","../node_modules/@open-wc/scoped-elements/html-element.d.ts","../node_modules/@open-wc/testing-helpers/types/src/fixture-no-side-effect.d.ts","../node_modules/@open-wc/testing-helpers/types/src/fixture.d.ts","../node_modules/@open-wc/testing-helpers/types/src/fixturewrapper.d.ts","../node_modules/@open-wc/testing-helpers/types/src/helpers.d.ts","../node_modules/lit/html.d.ts","../node_modules/@open-wc/testing-helpers/types/src/scopedelementswrapper.d.ts","../node_modules/@open-wc/testing-helpers/types/src/litfixture.d.ts","../node_modules/@open-wc/testing-helpers/types/src/stringfixture.d.ts","../node_modules/@open-wc/testing-helpers/types/index.d.ts","../node_modules/@open-wc/testing/index.d.ts","../test/sql-referral-code.test.ts","../node_modules/@types/accepts/index.d.ts","../node_modules/@types/babel__code-frame/index.d.ts","../node_modules/@babel/types/lib/index.d.ts","../node_modules/@types/babel__generator/index.d.ts","../node_modules/@babel/parser/typings/babel-parser.d.ts","../node_modules/@types/babel__template/index.d.ts","../node_modules/@types/babel__traverse/index.d.ts","../node_modules/@types/babel__core/index.d.ts","../node_modules/@types/connect/index.d.ts","../node_modules/@types/body-parser/index.d.ts","../node_modules/@types/qs/index.d.ts","../node_modules/@types/co-body/index.d.ts","../node_modules/@types/command-line-args/index.d.ts","../node_modules/@types/content-disposition/index.d.ts","../node_modules/@types/convert-source-map/index.d.ts","../node_modules/@types/send/index.d.ts","../node_modules/@types/range-parser/index.d.ts","../node_modules/@types/express-serve-static-core/index.d.ts","../node_modules/@types/http-errors/index.d.ts","../node_modules/@types/mime/index.d.ts","../node_modules/@types/serve-static/node_modules/@types/send/index.d.ts","../node_modules/@types/serve-static/index.d.ts","../node_modules/@types/express/index.d.ts","../node_modules/@types/keygrip/index.d.ts","../node_modules/@types/cookies/index.d.ts","../node_modules/@types/cross-spawn/index.d.ts","../node_modules/@types/debounce/index.d.ts","../node_modules/@types/detect-port/index.d.ts","../node_modules/@types/doctrine/index.d.ts","../node_modules/@types/ejs/index.d.ts","../node_modules/@types/emscripten/index.d.ts","../node_modules/@types/estree/index.d.ts","../node_modules/@types/find-cache-dir/index.d.ts","../node_modules/@types/fs-extra/index.d.ts","../node_modules/minimatch/dist/commonjs/ast.d.ts","../node_modules/minimatch/dist/commonjs/escape.d.ts","../node_modules/minimatch/dist/commonjs/unescape.d.ts","../node_modules/minimatch/dist/commonjs/index.d.ts","../node_modules/@types/glob/index.d.ts","../node_modules/@types/graceful-fs/index.d.ts","../node_modules/@types/http-assert/index.d.ts","../node_modules/@types/istanbul-lib-coverage/index.d.ts","../node_modules/@types/istanbul-lib-report/index.d.ts","../node_modules/@types/istanbul-reports/index.d.ts","../node_modules/@types/json5/index.d.ts","../node_modules/@types/koa-compose/index.d.ts","../node_modules/@types/koa/index.d.ts","../node_modules/@types/lodash/common/common.d.ts","../node_modules/@types/lodash/common/array.d.ts","../node_modules/@types/lodash/common/collection.d.ts","../node_modules/@types/lodash/common/date.d.ts","../node_modules/@types/lodash/common/function.d.ts","../node_modules/@types/lodash/common/lang.d.ts","../node_modules/@types/lodash/common/math.d.ts","../node_modules/@types/lodash/common/number.d.ts","../node_modules/@types/lodash/common/object.d.ts","../node_modules/@types/lodash/common/seq.d.ts","../node_modules/@types/lodash/common/string.d.ts","../node_modules/@types/lodash/common/util.d.ts","../node_modules/@types/lodash/index.d.ts","../node_modules/@types/mdx/types.d.ts","../node_modules/@types/mdx/index.d.ts","../node_modules/@types/mime-types/index.d.ts","../node_modules/@types/mocha/index.d.ts","../node_modules/form-data/index.d.ts","../node_modules/@types/node-fetch/externals.d.ts","../node_modules/@types/node-fetch/index.d.ts","../node_modules/@types/normalize-package-data/index.d.ts","../node_modules/@types/parse5/lib/tree-adapters/default.d.ts","../node_modules/@types/parse5/index.d.ts","../node_modules/@types/pretty-hrtime/index.d.ts","../node_modules/@types/prop-types/index.d.ts","../node_modules/@types/react/global.d.ts","../node_modules/csstype/index.d.ts","../node_modules/@types/react/index.d.ts","../node_modules/@types/resolve/index.d.ts","../node_modules/@types/semver/functions/inc.d.ts","../node_modules/@types/semver/classes/semver.d.ts","../node_modules/@types/semver/functions/parse.d.ts","../node_modules/@types/semver/functions/valid.d.ts","../node_modules/@types/semver/functions/clean.d.ts","../node_modules/@types/semver/functions/diff.d.ts","../node_modules/@types/semver/functions/major.d.ts","../node_modules/@types/semver/functions/minor.d.ts","../node_modules/@types/semver/functions/patch.d.ts","../node_modules/@types/semver/functions/prerelease.d.ts","../node_modules/@types/semver/functions/compare.d.ts","../node_modules/@types/semver/functions/rcompare.d.ts","../node_modules/@types/semver/functions/compare-loose.d.ts","../node_modules/@types/semver/functions/compare-build.d.ts","../node_modules/@types/semver/functions/sort.d.ts","../node_modules/@types/semver/functions/rsort.d.ts","../node_modules/@types/semver/functions/gt.d.ts","../node_modules/@types/semver/functions/lt.d.ts","../node_modules/@types/semver/functions/eq.d.ts","../node_modules/@types/semver/functions/neq.d.ts","../node_modules/@types/semver/functions/gte.d.ts","../node_modules/@types/semver/functions/lte.d.ts","../node_modules/@types/semver/functions/cmp.d.ts","../node_modules/@types/semver/functions/coerce.d.ts","../node_modules/@types/semver/classes/comparator.d.ts","../node_modules/@types/semver/classes/range.d.ts","../node_modules/@types/semver/functions/satisfies.d.ts","../node_modules/@types/semver/ranges/max-satisfying.d.ts","../node_modules/@types/semver/ranges/min-satisfying.d.ts","../node_modules/@types/semver/ranges/to-comparators.d.ts","../node_modules/@types/semver/ranges/min-version.d.ts","../node_modules/@types/semver/ranges/valid.d.ts","../node_modules/@types/semver/ranges/outside.d.ts","../node_modules/@types/semver/ranges/gtr.d.ts","../node_modules/@types/semver/ranges/ltr.d.ts","../node_modules/@types/semver/ranges/intersects.d.ts","../node_modules/@types/semver/ranges/simplify.d.ts","../node_modules/@types/semver/ranges/subset.d.ts","../node_modules/@types/semver/internals/identifiers.d.ts","../node_modules/@types/semver/index.d.ts","../node_modules/@types/trusted-types/index.d.ts","../node_modules/@types/unist/index.d.ts","../node_modules/@types/uuid/index.d.ts","../node_modules/@types/ws/index.d.ts","../node_modules/@types/yargs-parser/index.d.ts","../node_modules/@types/yargs/index.d.ts","../node_modules/@types/yauzl/index.d.ts"],"fileIdsList":[[78,133,150,151,330],[78,133,150,151],[65,78,133,150,151],[58,65,78,133,150,151],[58,65,73,78,133,150,151],[67,78,133,150,151],[56,57,78,133,150,151],[78,133,150,151,314,315],[78,133,150,151,314],[78,133,150,151,297,298],[78,133,150,151,299],[78,133,150,151,298,300],[78,133,150,151,310,312,318,319,320,323,324],[78,133,150,151,313,316],[78,133,150,151,317],[78,133,150,151,313,317,322],[64,78,133,150,151],[78,133,150,151,313,316,321],[78,133,150,151,297,309,325],[78,133,150,151,301,304,305,308],[78,133,150,151,194,209,273],[78,133,150,151,185,186,187,188],[78,133,150,151,185],[78,133,150,151,194],[78,133,150,151,274],[78,133,150,151,195],[78,133,150,151,184,185],[78,133,150,151,189,196,197,198,199,200,201,202,203,204,205,206,207,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290],[78,133,150,151,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,229,230,232,234,235,236,237,238,239,240,241,242,243,244,245,246,247,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272],[78,133,150,151,210,212,217],[78,133,150,151,212,249],[78,133,150,151,211,216],[78,133,150,151,210,211,212,213,214,215],[78,133,150,151,211,212,213,216,249],[78,133,150,151,210,212,216,217],[78,133,150,151,216],[78,133,150,151,216,256],[78,133,150,151,210,211,212,216],[78,133,150,151,211,212,213,216],[78,133,150,151,211,212],[78,133,150,151,210,211,212,216,217],[78,133,150,151,212,248],[78,133,150,151,210,211,212,217],[78,133,150,151,273],[78,133,150,151,210,211,225],[78,133,150,151,210,211,224],[78,133,150,151,233],[78,133,150,151,226,227],[78,133,150,151,228],[78,133,150,151,226],[78,133,150,151,210,211,225,226],[78,133,150,151,210,211,224,225,227],[78,133,150,151,231],[78,133,150,151,210,211,226,227],[78,133,150,151,210,211,212,213,216],[78,133,150,151,210,211],[78,133,150,151,211],[78,133,150,151,210,216],[78,133,150,151,184],[78,133,147,150,151,183],[78,133,150,151,330,331,332,333,334],[78,133,150,151,330,332],[78,133,147,150,151,183,336],[78,133,150,151,297],[78,133,147,150,151,183,338],[78,133,147,150,151,183,336,350,351],[78,133,134,150,151,183],[78,133,144,147,150,151,183,338,343,344],[78,133,150,151,337,338,345,349],[78,133,145,150,151,183],[78,133,144,145,150,151,183,365],[78,133,150,151,369],[78,133,150,151,370],[78,133,150,151,374],[78,132,133,144,147,148,150,151,153,159,176,183,328,341,346,351,352,368,373],[78,133,150,151,375,377,378,379,380,381,382,383,384,385,386,387],[78,133,150,151,375,376,378,379,380,381,382,383,384,385,386,387],[78,133,150,151,376,377,378,379,380,381,382,383,384,385,386,387],[78,133,150,151,375,376,377,379,380,381,382,383,384,385,386,387],[78,133,150,151,375,376,377,378,380,381,382,383,384,385,386,387],[78,133,150,151,375,376,377,378,379,381,382,383,384,385,386,387],[78,133,150,151,375,376,377,378,379,380,382,383,384,385,386,387],[78,133,150,151,375,376,377,378,379,380,381,383,384,385,386,387],[78,133,150,151,375,376,377,378,379,380,381,382,384,385,386,387],[78,133,150,151,375,376,377,378,379,380,381,382,383,385,386,387],[78,133,150,151,375,376,377,378,379,380,381,382,383,384,386,387],[78,133,150,151,375,376,377,378,379,380,381,382,383,384,385,387],[78,133,150,151,375,376,377,378,379,380,381,382,383,384,385,386],[78,133,150,151,388,389],[78,133,147,150,151,176,183,392,393],[78,130,131,133,150,151],[78,132,133,150,151],[133,150,151],[78,133,138,150,151,168],[78,133,134,139,144,150,151,153,165,176],[78,133,134,135,144,150,151,153],[78,133,136,150,151,177],[78,133,137,138,145,150,151,154],[78,133,138,150,151,165,173],[78,133,139,141,144,150,151,153],[78,132,133,140,150,151],[78,133,141,142,150,151],[78,133,143,144,150,151],[78,132,133,144,150,151],[78,133,144,145,146,150,151,165,176],[78,133,144,145,146,150,151,160,165,168],[78,125,133,141,144,147,150,151,153,165,176],[78,133,144,145,147,148,150,151,153,165,173,176],[78,133,147,149,150,151,165,173,176],[76,77,78,79,80,81,82,83,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182],[78,133,144,150,151],[78,133,150,151,152,176],[78,133,141,144,150,151,153,165],[78,133,150,151,154],[78,133,150,151,155],[78,132,133,150,151,156],[78,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182],[78,133,150,151,158],[78,133,150,151,159],[78,133,144,150,151,160,161],[78,133,150,151,160,162,177,179],[78,133,145,150,151],[78,133,144,150,151,165,166,168],[78,133,150,151,167,168],[78,133,150,151,165,166],[78,133,150,151,168],[78,133,150,151,169],[78,130,133,150,151,165,170],[78,133,144,150,151,171,172],[78,133,150,151,171,172],[78,133,138,150,151,153,165,173],[78,133,150,151,174],[78,133,150,151,153,175],[78,133,147,150,151,159,176],[78,133,138,150,151,177],[78,133,150,151,165,178],[78,133,150,151,152,179],[78,133,150,151,180],[78,133,138,150,151],[78,125,133,150,151],[78,133,150,151,181],[78,125,133,144,146,150,151,156,165,168,176,178,179,181],[78,133,150,151,165,182],[78,133,150,151,396],[78,133,150,151,397],[78,133,150,151,399,400,401],[78,133,150,151,405,443],[78,133,150,151,405,428,443],[78,133,150,151,404,443],[78,133,150,151,443],[78,133,150,151,405],[78,133,150,151,405,429,443],[78,133,150,151,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442],[78,133,150,151,429,443],[78,133,145,150,151,165,183],[78,133,147,150,151,183,346,348],[78,133,145,150,151,165,183,347],[78,133,150,151,297,307],[78,133,150,151,306],[60,78,133,150,151],[78,133,144,147,149,150,151,153,165,173,176,182,183],[78,133,150,151,448],[78,133,144,150,151,165,183],[78,133,150,151,303],[78,133,150,151,302],[78,133,150,151,183],[78,133,147,150,151,165,183],[78,133,150,151,194,208],[78,133,150,151,193],[78,133,150,151,193,292],[78,133,150,151,190,191,192],[58,61,78,133,150,151],[61,78,133,150,151],[59,60,78,133,150,151],[66,67,68,69,70,71,72,73,74,78,133,150,151],[58,61,62,63,78,133,150,151],[78,133,150,151,311],[78,133,150,151,365],[78,133,150,151,362,363,364],[78,91,94,97,98,133,150,151,176],[78,94,133,150,151,165,176],[78,94,98,133,150,151,176],[78,133,150,151,165],[78,88,133,150,151],[78,92,133,150,151],[78,90,91,94,133,150,151,176],[78,133,150,151,153,173],[78,88,133,150,151,183],[78,90,94,133,150,151,153,176],[78,85,86,87,89,93,133,144,150,151,165,176],[78,94,102,110,133,150,151],[78,86,92,133,150,151],[78,94,119,120,133,150,151],[78,86,89,94,133,150,151,168,176,183],[78,94,133,150,151],[78,90,94,133,150,151,176],[78,85,133,150,151],[78,88,89,90,92,93,94,95,96,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,120,121,122,123,124,133,150,151],[78,94,112,115,133,141,150,151],[78,94,102,103,104,133,150,151],[78,92,94,103,105,133,150,151],[78,93,133,150,151],[78,86,88,94,133,150,151],[78,94,98,103,105,133,150,151],[78,98,133,150,151],[78,92,94,97,133,150,151,176],[78,86,90,94,102,133,150,151],[78,94,112,133,150,151],[78,105,133,150,151],[78,88,94,119,133,150,151,168,181,183],[55,78,133,150,151,293],[55,64,75,78,133,150,151,291,292],[55,64,78,133,150,151,295],[55,64,78,133,150,151,293,295,326]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"a6a5253138c5432c68a1510c70fe78a644fe2e632111ba778e1978010d6edfec","impliedFormat":1},{"version":"74012d464fbc5354ca3a7d5e71bee43b17da01a853c8ff10971bbe3680c76f40","impliedFormat":99},{"version":"5e30131b6a5587fe666926ad1d9807e733c0a597ed12d682669fcaa331aea576","impliedFormat":99},{"version":"1aa53fff8e30c86e74eceb7514d715efa71c7820e5eb8bce70e2dd1b5a8b13ff","affectsGlobalScope":true,"impliedFormat":99},{"version":"00cb63103f9670f8094c238a4a7e252c8b4c06ba371fea5c44add7e41b7247e4","impliedFormat":99},{"version":"15fe687c59d62741b4494d5e623d497d55eb38966ecf5bea7f36e48fc3fbe15e","impliedFormat":1},{"version":"d854b2f06015f4241109d05b4b214d9f1fdd5fb15d2606843a8e0d6cd795a37d","impliedFormat":99},{"version":"9a318e3a8900672b85cd3c8c3a5acf51b88049557a3ae897ccdcf2b85a8f61f9","impliedFormat":99},{"version":"1bcd560deed90a43c51b08aa18f7f55229f2e30974ab5ed1b7bb5721be379013","impliedFormat":99},{"version":"dc08fe04e50bc24d1baded4f33e942222bbdd5d77d6341a93cfe6e4e4586a3be","impliedFormat":99},{"version":"cdeae34aca6700620ebf3f27cf7d439c3af97595dd6e2729fa4780483add5680","impliedFormat":99},{"version":"3ff87ea3471b51beaf4aa8fd8f4422862b11d343fdbb55bf383e0f8cc195a445","impliedFormat":99},{"version":"99bdf729529cdbf12e2bf76ea751b662011133dcf9e35abcb3def47bb02f7b0a","impliedFormat":99},{"version":"732fb71ecb695d6f36ddcbb72ebfe4ff6b6491d45101a00fa2b75a26b80d640f","impliedFormat":99},{"version":"039cb05125d7621f8143616c495b8e6b54249c4e64d2754b80ff93867f7f4b01","impliedFormat":99},{"version":"1b81f1fa82ad30af01ab1cae91ccaddc10c48f5916bbd6d282155e44a65d858d","impliedFormat":99},{"version":"a0fc7a02a75802678a67000607f20266cf1a49dc0e787967efe514e31b9ed0c3","impliedFormat":99},{"version":"5ebf098a1d81d400b8af82807cf19893700335cf91a7b9dbd83a5d737af34b11","impliedFormat":99},{"version":"101cf83ac3f9c5e1a7355a02e4fbe988877ef83c4ebec0ff0f02b2af022254a3","impliedFormat":99},{"version":"d017e2fcd44b46ca80cd2b592a6314e75f5caab5bda230f0f4a45e964049a43a","impliedFormat":99},{"version":"a8992b852521a66f63e0cedc6e1f054b28f972232b6fa5ca59771db6a1c8bbea","impliedFormat":99},{"version":"d153a11543fd884b596587ccd97aebbeed950b26933ee000f94009f1ab142848","affectsGlobalScope":true,"impliedFormat":1},{"version":"378281aa35786c27d5811af7e6bcaa492eebd0c7013d48137c35bbc69a2b9751","affectsGlobalScope":true,"impliedFormat":1},{"version":"3af97acf03cc97de58a3a4bc91f8f616408099bc4233f6d0852e72a8ffb91ac9","affectsGlobalScope":true,"impliedFormat":1},{"version":"1b2dd1cbeb0cc6ae20795958ba5950395ebb2849b7c8326853dd15530c77ab0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1db0b7dca579049ca4193d034d835f6bfe73096c73663e5ef9a0b5779939f3d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"387a023d363f755eb63450a66c28b14cdd7bc30a104565e2dbf0a8988bb4a56c","affectsGlobalScope":true,"impliedFormat":1},{"version":"9798340ffb0d067d69b1ae5b32faa17ab31b82466a3fc00d8f2f2df0c8554aaa","affectsGlobalScope":true,"impliedFormat":1},{"version":"f26b11d8d8e4b8028f1c7d618b22274c892e4b0ef5b3678a8ccbad85419aef43","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e9c23ba78aabc2e0a27033f18737a6df754067731e69dc5f52823957d60a4b6","impliedFormat":1},{"version":"cdcf9ea426ad970f96ac930cd176d5c69c6c24eebd9fc580e1572d6c6a88f62c","impliedFormat":1},{"version":"23cd712e2ce083d68afe69224587438e5914b457b8acf87073c22494d706a3d0","impliedFormat":1},{"version":"487b694c3de27ddf4ad107d4007ad304d29effccf9800c8ae23c2093638d906a","impliedFormat":1},{"version":"3a80bc85f38526ca3b08007ee80712e7bb0601df178b23fbf0bf87036fce40ce","impliedFormat":1},{"version":"ccf4552357ce3c159ef75f0f0114e80401702228f1898bdc9402214c9499e8c0","impliedFormat":1},{"version":"c6fd2c5a395f2432786c9cb8deb870b9b0e8ff7e22c029954fabdd692bff6195","impliedFormat":1},{"version":"68834d631c8838c715f225509cfc3927913b9cc7a4870460b5b60c8dbdb99baf","impliedFormat":1},{"version":"2931540c47ee0ff8a62860e61782eb17b155615db61e36986e54645ec67f67c2","impliedFormat":1},{"version":"ccab02f3920fc75c01174c47fcf67882a11daf16baf9e81701d0a94636e94556","impliedFormat":1},{"version":"f6faf5f74e4c4cc309a6c6a6c4da02dbb840be5d3e92905a23dcd7b2b0bd1986","impliedFormat":1},{"version":"ea6bc8de8b59f90a7a3960005fd01988f98fd0784e14bc6922dde2e93305ec7d","impliedFormat":1},{"version":"36107995674b29284a115e21a0618c4c2751b32a8766dd4cb3ba740308b16d59","impliedFormat":1},{"version":"914a0ae30d96d71915fc519ccb4efbf2b62c0ddfb3a3fc6129151076bc01dc60","impliedFormat":1},{"version":"33e981bf6376e939f99bd7f89abec757c64897d33c005036b9a10d9587d80187","impliedFormat":1},{"version":"7fd1b31fd35876b0aa650811c25ec2c97a3c6387e5473eb18004bed86cdd76b6","impliedFormat":1},{"version":"b41767d372275c154c7ea6c9d5449d9a741b8ce080f640155cc88ba1763e35b3","impliedFormat":1},{"version":"3bacf516d686d08682751a3bd2519ea3b8041a164bfb4f1d35728993e70a2426","impliedFormat":1},{"version":"7fb266686238369442bd1719bc0d7edd0199da4fb8540354e1ff7f16669b4323","impliedFormat":1},{"version":"0a60a292b89ca7218b8616f78e5bbd1c96b87e048849469cccb4355e98af959a","impliedFormat":1},{"version":"0b6e25234b4eec6ed96ab138d96eb70b135690d7dd01f3dd8a8ab291c35a683a","impliedFormat":1},{"version":"9666f2f84b985b62400d2e5ab0adae9ff44de9b2a34803c2c5bd3c8325b17dc0","impliedFormat":1},{"version":"40cd35c95e9cf22cfa5bd84e96408b6fcbca55295f4ff822390abb11afbc3dca","impliedFormat":1},{"version":"b1616b8959bf557feb16369c6124a97a0e74ed6f49d1df73bb4b9ddf68acf3f3","impliedFormat":1},{"version":"5b03a034c72146b61573aab280f295b015b9168470f2df05f6080a2122f9b4df","impliedFormat":1},{"version":"40b463c6766ca1b689bfcc46d26b5e295954f32ad43e37ee6953c0a677e4ae2b","impliedFormat":1},{"version":"249b9cab7f5d628b71308c7d9bb0a808b50b091e640ba3ed6e2d0516f4a8d91d","impliedFormat":1},{"version":"80aae6afc67faa5ac0b32b5b8bc8cc9f7fa299cff15cf09cc2e11fd28c6ae29e","impliedFormat":1},{"version":"f473cd2288991ff3221165dcf73cd5d24da30391f87e85b3dd4d0450c787a391","impliedFormat":1},{"version":"499e5b055a5aba1e1998f7311a6c441a369831c70905cc565ceac93c28083d53","impliedFormat":1},{"version":"54c3e2371e3d016469ad959697fd257e5621e16296fa67082c2575d0bf8eced0","impliedFormat":1},{"version":"beb8233b2c220cfa0feea31fbe9218d89fa02faa81ef744be8dce5acb89bb1fd","impliedFormat":1},{"version":"c183b931b68ad184bc8e8372bf663f3d33304772fb482f29fb91b3c391031f3e","impliedFormat":1},{"version":"5d0375ca7310efb77e3ef18d068d53784faf62705e0ad04569597ae0e755c401","impliedFormat":1},{"version":"59af37caec41ecf7b2e76059c9672a49e682c1a2aa6f9d7dc78878f53aa284d6","impliedFormat":1},{"version":"addf417b9eb3f938fddf8d81e96393a165e4be0d4a8b6402292f9c634b1cb00d","impliedFormat":1},{"version":"48cc3ec153b50985fb95153258a710782b25975b10dd4ac8a4f3920632d10790","impliedFormat":1},{"version":"adf27937dba6af9f08a68c5b1d3fce0ca7d4b960c57e6d6c844e7d1a8e53adae","impliedFormat":1},{"version":"e1528ca65ac90f6fa0e4a247eb656b4263c470bb22d9033e466463e13395e599","impliedFormat":1},{"version":"2e85db9e6fd73cfa3d7f28e0ab6b55417ea18931423bd47b409a96e4a169e8e6","impliedFormat":1},{"version":"c46e079fe54c76f95c67fb89081b3e399da2c7d109e7dca8e4b58d83e332e605","impliedFormat":1},{"version":"866078923a56d026e39243b4392e282c1c63159723996fa89243140e1388a98d","impliedFormat":1},{"version":"830171b27c5fdf9bcbe4cf7d428fcf3ae2c67780fb7fbdccdf70d1623d938bc4","affectsGlobalScope":true,"impliedFormat":1},{"version":"1cf059eaf468efcc649f8cf6075d3cb98e9a35a0fe9c44419ec3d2f5428d7123","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7721c4f69f93c91360c26a0a84ee885997d748237ef78ef665b153e622b36c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d97fb21da858fb18b8ae72c314e9743fd52f73ebe2764e12af1db32fc03f853f","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ea15fd99b2e34cb25fe8346c955000bb70c8b423ae4377a972ef46bfb37f595","impliedFormat":1},{"version":"7cf69dd5502c41644c9e5106210b5da7144800670cbe861f66726fa209e231c4","impliedFormat":1},{"version":"72c1f5e0a28e473026074817561d1bc9647909cf253c8d56c41d1df8d95b85f7","impliedFormat":1},{"version":"f9b4137a0d285bd77dba2e6e895530112264310ae47e07bf311feae428fb8b61","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b21e13ed07d0df176ae31d6b7f01f7b17d66dbeb489c0d31d00de2ca14883da","impliedFormat":1},{"version":"51aecd2df90a3cffea1eb4696b33b2d78594ea2aa2138e6b9471ec4841c6c2ee","impliedFormat":1},{"version":"9d8f9e63e29a3396285620908e7f14d874d066caea747dc4b2c378f0599166b4","affectsGlobalScope":true,"impliedFormat":1},{"version":"5524481e56c48ff486f42926778c0a3cce1cc85dc46683b92b1271865bcf015a","impliedFormat":1},{"version":"f929f0b6b3421a2d34344b0f421f45aeb2c84ad365ebf29d04312023b3accc58","impliedFormat":1},{"version":"db9ada976f9e52e13f7ae8b9a320f4b67b87685938c5879187d8864b2fbe97f3","impliedFormat":1},{"version":"9f39e70a354d0fba29ac3cdf6eca00b7f9e96f64b2b2780c432e8ea27f133743","impliedFormat":1},{"version":"0dace96cc0f7bc6d0ee2044921bdf19fe42d16284dbcc8ae200800d1c9579335","impliedFormat":1},{"version":"a2e2bbde231b65c53c764c12313897ffdfb6c49183dd31823ee2405f2f7b5378","impliedFormat":1},{"version":"ad1cc0ed328f3f708771272021be61ab146b32ecf2b78f3224959ff1e2cd2a5c","impliedFormat":1},{"version":"c64e1888baaa3253ca4405b455e4bf44f76357868a1bd0a52998ade9a092ad78","affectsGlobalScope":true,"impliedFormat":1},{"version":"d8cf132379078d0974a59df26069689a2d33c7dc826b5be56231841cb2f32e58","impliedFormat":1},{"version":"fbf413fc617837453c878a9174a1f1b383616857a3f8366bc41cf30df4aea7d5","impliedFormat":1},{"version":"148c73ec11318850f571172ceae3e55ce479d850fe18ec8eae0abd99d9f6c319","impliedFormat":1},{"version":"230bdc111d7578276e4a3bb9d075d85c78c6b68f428c3a9935e2eaa10f4ae1f5","impliedFormat":1},{"version":"e8aabbee5e7b9101b03bb4222607d57f38859b8115a8050a4eb91b4ee43a3a73","impliedFormat":1},{"version":"bbf42f98a5819f4f06e18c8b669a994afe9a17fe520ae3454a195e6eabf7700d","impliedFormat":1},{"version":"c0bb1b65757c72bbf8ddf7eaa532223bacf58041ff16c883e76f45506596e925","impliedFormat":1},{"version":"c8b85f7aed29f8f52b813f800611406b0bfe5cf3224d20a4bdda7c7f73ce368e","affectsGlobalScope":true,"impliedFormat":1},{"version":"145dcf25fd4967c610c53d93d7bc4dce8fbb1b6dd7935362472d4ae49363c7ba","impliedFormat":1},{"version":"ff65b8a8bd380c6d129becc35de02f7c29ad7ce03300331ca91311fb4044d1a9","impliedFormat":1},{"version":"76957a6d92b94b9e2852cf527fea32ad2dc0ef50f67fe2b14bd027c9ceef2d86","impliedFormat":1},{"version":"9043daec15206650fa119bad6b8d70136021ea7d52673a71f79a87a42ee38d44","affectsGlobalScope":true,"impliedFormat":1},{"version":"4e2de7ab2f74e36d7078bccdf831585b10dc6330bab56054921531b03f9beaf3","affectsGlobalScope":true,"impliedFormat":1},{"version":"a58a15da4c5ba3df60c910a043281256fa52d36a0fcdef9b9100c646282e88dd","impliedFormat":1},{"version":"b36beffbf8acdc3ebc58c8bb4b75574b31a2169869c70fc03f82895b93950a12","impliedFormat":1},{"version":"de263f0089aefbfd73c89562fb7254a7468b1f33b61839aafc3f035d60766cb4","impliedFormat":1},{"version":"77fbe5eecb6fac4b6242bbf6eebfc43e98ce5ccba8fa44e0ef6a95c945ff4d98","impliedFormat":1},{"version":"8c81fd4a110490c43d7c578e8c6f69b3af01717189196899a6a44f93daa57a3a","impliedFormat":1},{"version":"5fb39858b2459864b139950a09adae4f38dad87c25bf572ce414f10e4bd7baab","impliedFormat":1},{"version":"65faec1b4bd63564aeec33eab9cacfaefd84ce2400f03903a71a1841fbce195f","impliedFormat":1},{"version":"b33b74b97952d9bf4fbd2951dcfbb5136656ddb310ce1c84518aaa77dbca9992","impliedFormat":1},{"version":"37ba7b45141a45ce6e80e66f2a96c8a5ab1bcef0fc2d0f56bb58df96ec67e972","impliedFormat":1},{"version":"45650f47bfb376c8a8ed39d4bcda5902ab899a3150029684ee4c10676d9fbaee","impliedFormat":1},{"version":"6b306cd4282bbb54d4a6bb23cfb7a271160983dfc38c67b5a132504cfcc34896","affectsGlobalScope":true,"impliedFormat":1},{"version":"c119835edf36415081dfd9ed15fc0cd37aaa28d232be029ad073f15f3d88c323","impliedFormat":1},{"version":"450172a56b944c2d83f45cc11c9a388ea967cd301a21202aa0a23c34c7506a18","impliedFormat":1},{"version":"9705cd157ffbb91c5cab48bdd2de5a437a372e63f870f8a8472e72ff634d47c1","affectsGlobalScope":true,"impliedFormat":1},{"version":"ae86f30d5d10e4f75ce8dcb6e1bd3a12ecec3d071a21e8f462c5c85c678efb41","impliedFormat":1},{"version":"72f8936aebf0c4a1adab767b97d34ba7d3a308afcf76de4417b9c16fb92ed548","impliedFormat":1},{"version":"e03460fe72b259f6d25ad029f085e4bedc3f90477da4401d8fbc1efa9793230e","impliedFormat":1},{"version":"4286a3a6619514fca656089aee160bb6f2e77f4dd53dc5a96b26a0b4fc778055","impliedFormat":1},{"version":"69e0a41d620fb678a899c65e073413b452f4db321b858fe422ad93fd686cd49a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3585d6891e9ea18e07d0755a6d90d71331558ba5dc5561933553209f886db106","affectsGlobalScope":true,"impliedFormat":1},{"version":"86be71cbb0593468644932a6eb96d527cfa600cecfc0b698af5f52e51804451d","impliedFormat":1},{"version":"84dd6b0fd2505135692935599d6606f50a421389e8d4535194bcded307ee5cf2","impliedFormat":1},{"version":"0d5b085f36e6dc55bc6332ecb9c733be3a534958c238fb8d8d18d4a2b6f2a15a","impliedFormat":1},{"version":"db19ea066fdc5f97df3f769e582ae3000380ab7942e266654bdb1a4650d19eaf","affectsGlobalScope":true,"impliedFormat":1},{"version":"2a034894bf28c220a331c7a0229d33564803abe2ac1b9a5feee91b6b9b6e88ea","impliedFormat":1},{"version":"d7e9ab1b0996639047c61c1e62f85c620e4382206b3abb430d9a21fb7bc23c77","impliedFormat":1},{"version":"ce6c79023a5768c64139b1cfe4ec3264e6c6e9c8026a8b4f9fe59a96e3e16b66","impliedFormat":1},{"version":"fa41f61aaeda6ad892edc9d51dac3ac772620c7f8f1ba9954467c277e30011ed","affectsGlobalScope":true,"impliedFormat":1},{"version":"4c4d975747c688b14091e38d383762d9e49e5e687f222d5b544bf2df3b27dca6","impliedFormat":1},{"version":"d0813af494d135909b592c75da235bb1dbba437349a46b571aaf4efff544cf3f","impliedFormat":1},{"version":"2f40b48cbec3c90866176601f1c5bffd75f15615552b1a311c017b79238c16f9","impliedFormat":1},{"version":"602542b7584a80f7f65b8577bab89f2c18778670f0c727326d16646a84045ff2","impliedFormat":1},{"version":"7283aaea55499e5a9760db0ef199e3c12a35ff5391733fe1495b2d3add0c58ab","impliedFormat":1},{"version":"b725acb041d2a18fde8f46c48a1408418489c4aa222f559b1ef47bf267cb4be0","impliedFormat":1},{"version":"c1c8ccb14c76efb31ff84038ec7833a5715ba23e681b158b3c83cc012b8c3cfa","impliedFormat":1},{"version":"abb0a41fa0432cdec9595dbe84bd3efc5b59f04aa85dcd5cec7b453908fc85c3","impliedFormat":1},{"version":"8fb686bcb1593c907a4a6284625137308915871b7a3f672c6096769704fd6593","impliedFormat":1},{"version":"f4fb4a9eb600fbfbe0486701a3a6a30a3486e3c43f612677cbb946997b2ac74f","impliedFormat":1},{"version":"ba3f31628fd1bbc56180070bf1f6744752de8a060cf2355ffa3c42f1543a79e9","impliedFormat":1},{"version":"302561147c76a73e2ec13d5643f259d999c66bf863ddfbce8c6c5ba82ad7373d","impliedFormat":1},{"version":"4b27167c2960db122dbb31840bbd3a4ef68360cca7033919a51d8815112c6333","impliedFormat":1},{"version":"d9e9ecea3e42e71c42b3a8fdf93a11d00e6efe3e060de3ce8fe23604ff23669d","impliedFormat":1},{"version":"fb93936a47bc59e6c929f0a07d587ef285dfb004d6e047e4bc86350901f9ea99","impliedFormat":1},{"version":"de5305e662af0836c8e02388579afd7d0bc67853621f79f6bb166baf3ad6a2c6","impliedFormat":1},{"version":"9901a7886c1d7f91d658b627335328f794497b02a187939c3954b5e97e598350","impliedFormat":1},{"version":"f3e71ec347f2c8c4ef87053e4faaf19d5b659d01eb8c7b61109f96f2631c6c40","impliedFormat":1},{"version":"70eba17d144d807b46f404a492bd6c432b034b38f87a17299ea85c0ec4489016","impliedFormat":1},{"version":"9fdacebcc6845ad1425094bc3bec5e6b84709beba1d81c0c2d138361ee6b30a0","impliedFormat":1},{"version":"8a92d1ff6e8856cd79443b8ebea53872bd2fbebe928a934f5866433d6f50556a","impliedFormat":1},{"version":"122c2e8188e9f6a01aa6c9868acdd09d4b30c8172b097affcb77116fdde5e2ac","impliedFormat":1},{"version":"80283bd376b4d5b8970d1f0b8c549e3b9e24aa26d8f785bec3e29e22c525f1a4","impliedFormat":1},{"version":"6efd085323d69407ea14900a7afcb0876669a668c8e5c357782eb09d30f5e90a","impliedFormat":1},{"version":"6cb35d83d21a7e72bd00398c93302749bcd38349d0cc5e76ff3a90c6d1498a4d","impliedFormat":1},{"version":"369dd7668d0e6c91550bce0c325f37ce6402e5dd40ecfca66fbb5283e23e559d","affectsGlobalScope":true,"impliedFormat":1},{"version":"2632057d8b983ee33295566088c080384d7d69a492bc60b008d6a6dfd3508d6b","impliedFormat":1},{"version":"4bf71cf2a94492fc71e97800bdf2bcb0a9a0fa5fce921c8fe42c67060780cbfa","impliedFormat":1},{"version":"0996ff06f64cb05b6dac158a6ada2e16f8c2ccd20f9ff6f3c3e871f1ba5fb6d9","impliedFormat":1},{"version":"5c492d01a19fea5ebfff9d27e786bc533e5078909521ca17ae41236f16f9686a","impliedFormat":1},{"version":"a6ee930b81c65ec79aca49025b797817dde6f2d2e9b0e0106f0844e18e2cc819","impliedFormat":1},{"version":"84fce15473e993e6b656db9dd3c9196b80f545647458e6621675e840fd700d29","impliedFormat":1},{"version":"7d5336ee766aa72dffb1cc2a515f61d18a4fb61b7a2757cbccfb7b286b783dfb","impliedFormat":1},{"version":"63e96248ab63f6e7a86e31aa3e654ed6de1c3f99e3b668e04800df05874e8b77","impliedFormat":1},{"version":"80da0f61195385d22b666408f6cccbc261c066d401611a286f07dfddf7764017","impliedFormat":1},{"version":"06a20cc7d937074863861ea1159ac783ff97b13952b4b5d1811c7d8ab5c94776","impliedFormat":1},{"version":"ab6de4af0e293eae73b67dad251af097d7bcc0b8b62de84e3674e831514cb056","impliedFormat":1},{"version":"18cbd79079af97af66c9c07c61b481fce14a4e7282eca078c474b40c970ba1d0","impliedFormat":1},{"version":"e7b45405689d87e745a217b648d3646fb47a6aaba9c8d775204de90c7ea9ff35","impliedFormat":1},{"version":"669b754ec246dd7471e19b655b73bda6c2ca5bb7ccb1a4dff44a9ae45b6a716a","impliedFormat":1},{"version":"bcfaca4a8ff50f57fd36df91fba5d34056883f213baff7192cbfc4d3805d2084","impliedFormat":1},{"version":"76a564b360b267502219a89514953058494713ee0923a63b2024e542c18b40e5","impliedFormat":1},{"version":"8f62cbd3afbd6a07bb8c934294b6bfbe437021b89e53a4da7de2648ecfc7af25","impliedFormat":1},{"version":"a20629551ed7923f35f7556c4c15d0c8b2ebe7afaa68ceaab079a1707ba64be2","impliedFormat":1},{"version":"d6de66600c97cd499526ddecea6e12166ab1c0e8d9bf36fb2339fd39c8b3372a","impliedFormat":1},{"version":"8e7a5b8f867b99cc8763c0b024068fb58e09f7da2c4810c12833e1ca6eb11c4f","impliedFormat":1},{"version":"a8932876de2e3138a5a27f9426b225a4d27f0ba0a1e2764ba20930b4c3faf4b9","impliedFormat":1},{"version":"df877050b04c29b9f8409aa10278d586825f511f0841d1ec41b6554f8362092b","impliedFormat":1},{"version":"027d600e00c5f5e1816c207854285d736f2f5fa28276e2829db746d5d6811ba1","impliedFormat":1},{"version":"5443113a16ef378446e08d6500bb48b35de582426459abdb5c9704f5c7d327d9","impliedFormat":1},{"version":"0fb581ecb53304a3c95bb930160b4fa610537470cce850371cbaad5a458ca0d9","impliedFormat":1},{"version":"7da4e290c009d7967343a7f8c3f145a3d2c157c62483362183ba9f637a536489","impliedFormat":1},{"version":"eb21ddc3a8136a12e69176531197def71dc28ffaf357b74d4bf83407bd845991","impliedFormat":1},{"version":"914560d0c4c6aa947cfe7489fe970c94ba25383c414bbe0168b44fd20dbf0df4","impliedFormat":1},{"version":"4fb3405055b54566dea2135845c3a776339e7e170d692401d97fd41ad9a20e5d","impliedFormat":1},{"version":"8d607832a6ef0eac30657173441367dd76c96bf7800d77193428b922e060c3af","impliedFormat":1},{"version":"20ff7207f0bb5cdde5fee8e83315ade7e5b8100cfa2087d20d39069a3d7d06f4","impliedFormat":1},{"version":"7ca4c534eab7cff43d81327e369a23464bc37ef38ce5337ceff24a42c6c84eb2","impliedFormat":1},{"version":"5252dec18a34078398be4e321dee884dc7f47930e5225262543a799b591b36d2","impliedFormat":1},{"version":"23caed4dff98bd28157d2b798b43f1dfefe727f18641648c01ce4e0e929a1630","impliedFormat":1},{"version":"f67e013d5374826596d7c23dbae1cdb14375a27cd72e16c5fb46a4b445059329","impliedFormat":1},{"version":"ea3401b70e2302683bbf4c18b69ef2292b60f4d8f8e6d920413b81fb7bde0f65","impliedFormat":1},{"version":"71afe26642c0fb86b9f8b1af4af5deb5181b43b6542a3ff2314871b53d04c749","impliedFormat":1},{"version":"0d7f01634e6234d84cf0106508efdb8ae00e5ed126eff9606d37b031ac1de654","impliedFormat":1},{"version":"f8d209086bad78af6bd7fef063c1ed449c815e6f8d36058115f222d9f788b848","impliedFormat":1},{"version":"3ad003278d569d1953779e2f838f7798f02e793f6a1eceac8e0065f1a202669b","impliedFormat":1},{"version":"fb2c5eceffcd918dbb86332afa0199f5e7b6cf6ee42809e930a827b28ef25afe","impliedFormat":1},{"version":"f664aaff6a981eeca68f1ff2d9fd21b6664f47bf45f3ae19874df5a6683a8d8a","impliedFormat":1},{"version":"ce066f85d73e09e9adbd0049bcf6471c7eefbfc2ec4b5692b5bcef1e36babd2a","impliedFormat":1},{"version":"09d302513cacfbcc54b67088739bd8ac1c3c57917f83f510b2d1adcb99fd7d2a","impliedFormat":1},{"version":"3faa54e978b92a6f726440c13fe3ab35993dc74d697c7709681dc1764a25219f","impliedFormat":1},{"version":"2bd0489e968925eb0c4c0fb12ef090be5165c86bd088e1e803102c38d4a717d8","impliedFormat":1},{"version":"88924207132b9ba339c1adb1ed3ea07e47b3149ff8a2e21a3ea1f91cee68589d","impliedFormat":1},{"version":"b8800b93d8ab532f8915be73f8195b9d4ef06376d8a82e8cdc17c400553172d6","impliedFormat":1},{"version":"d7d469703b78beba76d511957f8c8b534c3bbb02bea7ab4705c65ef573532fb8","impliedFormat":1},{"version":"74c8c3057669c03264263d911d0f82e876cef50b05be21c54fef23c900de0420","impliedFormat":1},{"version":"b303eda2ff2d582a9c3c5ecb708fb57355cdc25e8c8197a9f66d4d1bf09fda19","impliedFormat":1},{"version":"4e5dc89fa22ff43da3dee1db97d5add0591ebaff9e4adef6c8b6f0b41f0f60f0","impliedFormat":1},{"version":"ec4e82cb42a902fe83dc13153c7a260bee95684541f8d7ef26cb0629a2f4ca31","impliedFormat":1},{"version":"5f36e24cd92b0ff3e2a243685a8a780c9413941c36739f04b428cc4e15de629d","impliedFormat":1},{"version":"40a26494e6ab10a91851791169582ab77fed4fbd799518968177e7eefe08c7a9","impliedFormat":1},{"version":"208e125b45bc561765a74f6f1019d88e44e94678769824cf93726e1bac457961","impliedFormat":1},{"version":"b3985971de086ef3aa698ef19009a53527b72e65851b782dc188ac341a1e1390","impliedFormat":1},{"version":"c81d421aabb6113cd98b9d4f11e9a03273b363b841f294b457f37c15d513151d","impliedFormat":1},{"version":"30063e3a184ff31254bbafa782c78a2d6636943dfe59e1a34f451827fd7a68dc","impliedFormat":1},{"version":"c05d4cae0bceed02c9d013360d3e65658297acb1b7a90252fe366f2bf4f9ccc9","impliedFormat":1},{"version":"6f14b92848889abba03a474e0750f7350cc91fc190c107408ca48679a03975ae","impliedFormat":1},{"version":"a588d0765b1d18bf00a498b75a83e095aef75a9300b6c1e91cbf39e408f2fe2f","impliedFormat":1},{"version":"41b86184df9af9b44d746e96963d546e72f76dc0ec040c38f6d027f958073354","impliedFormat":1},{"version":"abf868b50638a515a88bbd9aadaf7ebcafd7374bd59122fd8b0e989e7392e78d","impliedFormat":1},{"version":"11f1fb12dd32c15d9a8fc6d0bbf118325d8e495ab1ee37e1edc0f699634092a3","impliedFormat":1},{"version":"1f5edba9e08ff60b69af19b2aa36845fee8419e637ba94082bac1aeee517800f","impliedFormat":1},{"version":"086da63f4a6380032fba1a9ae0345ad60b548fe6feb4b62a953df4bccfb5d060","impliedFormat":1},{"version":"9659db1a33ff369191e83825f013d3683cae3f8d139c11c19c17f5ea959c44af","impliedFormat":1},{"version":"0e53c93276fe62f4982dc1fed4e4561cad7393d3c6dc746b584287357c4c3f26","impliedFormat":1},{"version":"a21cb3f6b3231268763108a518b99db29b68a4b6aabf3f87ba5893b614a74c6d","impliedFormat":1},{"version":"462ff130d0bde1c3f5328175a20c2597836d515762727a8009cdc3a69556efc9","impliedFormat":1},{"version":"a2ba96894ca9e598cc3c54b5a3bbafb46a97afd20eb26742b7a7e9af8783f255","impliedFormat":1},{"version":"77cb10333d10cf49e51e1c9ee0317d67cb0cd09d97d41d9989332927dfa1620f","impliedFormat":1},{"version":"7e8e46fe31ffbe8348c3a2b8b38c09eb13a8600ccf820bfa8e3e7f78f3d57f68","impliedFormat":1},{"version":"78888f91aca3fce9f52fa1be10e865ae68acd4c9bda8d5e8659617e3dc0f722f","impliedFormat":1},{"version":"64cf05d43dacd03ba3b276707f35559cca383d7d29947444537932eb19824eaa","impliedFormat":1},{"version":"7fd466ef52ad3c46c901c0583b6762c521ea2a83e44f66bde1e84587198a62a5","impliedFormat":1},{"version":"8a8012ac52b584781f990dc910a4588fa0b58c00cca3fb391eb3cc85aacef777","affectsGlobalScope":true,"impliedFormat":1},{"version":"4be94a129d42326b3208dba5559331568041e3400036f4de74823a50d5360313","impliedFormat":1},{"version":"1c7a3777b7d4c9d27e52efd9b7cc42ed76be13fb791dae24b05b95fc5f7af0e5","impliedFormat":1},{"version":"07ca7906cd7ebb46a93f2216b2bf1ac94d43a35be2935804b5e346536c4f4cbe","impliedFormat":1},{"version":"c05e6cdefc3dced2752c5a728bc18c5ddd49ece70fa7896005bfe3ca35c62033","signature":"f693d714493ffed3f4ef3db08277d0826d4bda4b5da7b31b56f6017fa87abf46"},"7237d4eb616724ea5d1f0f46a054f330a6024570e6170d6de4ca982e69db0405",{"version":"ec6542512cb27c81c056c64e110a39e2342c78bb39e6de5c5ef2eefbc87e0c40","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"97bacfbafc50c190219e2fdcdb9b83c505b80064f5988a1dbfa1abac8c3c1468","signature":"b37ee33fd2e385d857eeefe7e768826f41414e2e1e60577e46ed1b5a83fe7d2a"},{"version":"eef204f061321360559bd19235ea32a9d55b3ec22a362cc78d14ef50d4db4490","affectsGlobalScope":true,"impliedFormat":1},{"version":"72bee526b949b9932edba50997ff3b9cdede7b314d790d5f0d94f3d2944930ea","impliedFormat":99},{"version":"2d412861573a672bd90fdcb1e48740593324565f3b3aaf6808c0e3e2f0d54ae8","affectsGlobalScope":true,"impliedFormat":99},{"version":"cd711db43a952f15464b571ac11b7a440332cd52342bc92c4bf908c70688f57f","affectsGlobalScope":true,"impliedFormat":99},{"version":"9d8709c916778cb34830708ed47b78e9a46d1fb2eb73a682b14eee990bed4aa6","impliedFormat":99},{"version":"507e2131e89b515ce40c05c0c2fef6cc575ba8947703f92e8cdf36078747a9ff","affectsGlobalScope":true,"impliedFormat":99},{"version":"999a90d30a3183dcee987d0a5a7c586aba5bacbf6ce087ba8635124082ccfeea","impliedFormat":99},{"version":"8a5878edd52f4a720560b4c6e6247e9ddc3df6118ad9cf2f9927903b03d5f440","impliedFormat":99},{"version":"e7be17cfcbe98809c052f384c230ecea9e1cee045edac9db0659e997a988ff9e","affectsGlobalScope":true,"impliedFormat":1},{"version":"baf3507287629018d38c88e2636dd041550c70620bb774127011eb6dc3b361c0","impliedFormat":1},{"version":"12d5592986cbcd3404fa50481df6b62ed74f7035ea0d6a27c207844b7bc7c950","impliedFormat":1},{"version":"525b52b38b44420fb1758c0917e7b67cf379f7f9477d2ba7343f3d5f50a44258","affectsGlobalScope":true,"impliedFormat":1},{"version":"65b91a3725399231d3469529b5e27b85bf2aa98013e607f308e5fe260b47eeff","impliedFormat":99},{"version":"04e3793f33c71ceae20a4719698c068b72c98cf925b3c5f8a33096c00ed44258","impliedFormat":99},{"version":"fa8ef3fb228e258f9508386e2056c95c959d1c1168301181313a5c978754ba70","impliedFormat":99},{"version":"15c9478a8a3d630ac5e738aca25fca15d0842aaeb97fb1a9c1e80eddc5a0e14c","impliedFormat":99},{"version":"cc46ce345c0e19e456388446733250527eead4ca557b5e5fdf0c2e30adc3c89f","impliedFormat":99},{"version":"88cda4269c54f0803834fd62b2fac61af8bff7a085693f7ca9df85c1f19dee8a","impliedFormat":99},{"version":"5d600cfe96a85d58ea8dbf44646f35e82d25e788ea0a6a8295594cef9948445a","affectsGlobalScope":true,"impliedFormat":99},{"version":"d9e25c382a75bed1c058c324edff8b2af655521472b431857e58cdac5f9b2185","impliedFormat":99},{"version":"6168f8e0a5b354f8177bf0dee7c1a69c2afb6a155d5534221f3a1a2d86b84367","impliedFormat":99},{"version":"d7840fd94e6dfb5b0d9df5a20fe1e79c8dd72b1efdb74d2ef04c31e3588c6b5b","impliedFormat":99},{"version":"fa6d684e15fe6e99c7208a51b45c04f8e0147f1c8587871aac48fff55b7b1f24","impliedFormat":99},{"version":"d61a4b627c3e2e054616df905a25226f547dc0e821c2a2b6d5f13318b3fd7e78","impliedFormat":99},{"version":"1308479c593c3d337bd9c438ac1d7164006a9286638cec0b26e3331a978f91d4","impliedFormat":99},{"version":"cfad37dbd7cf27cc16758755847ad7c07ac52a01c466486e50f8f84d0f0ea9ce","impliedFormat":99},{"version":"0c4d3009672fd12d4d9a6505e769de9369c180dcfa8188d9fd850ec156245d87","impliedFormat":99},{"version":"793fca6322a14fa8fa6bc6a4fc694fd7bcc88922c4f9abcd48bf6908f8bf939b","impliedFormat":99},{"version":"be3e93b109deb44b925583674cc0706c0b3c2e7316bcf79631285a45c18ed0c8","impliedFormat":99},{"version":"50f63746fc2a779d1f9c5657fd78e292045dc98b540e026799e039ea629f2943","impliedFormat":99},{"version":"247ceeae88eef88549396ba4c7c3d529263a4a5b1a5cc58a8d7114ba33092a89","signature":"defd487962cdd1bb2cafcea2d4953506046777d30d4675081eb2b738bd8a88a0"},{"version":"87f287f296f3ff07dbd14ea7853c2400d995dccd7bd83206196d6c0974774e96","impliedFormat":1},{"version":"3dcefe176e6dce7a06bd345522e19f631f7fdb370335e2e93bc225b3afbb0bd0","impliedFormat":1},{"version":"c2c2a861a338244d7dd700d0c52a78916b4bb75b98fc8ca5e7c501899fc03796","impliedFormat":1},{"version":"b6d03c9cfe2cf0ba4c673c209fcd7c46c815b2619fd2aad59fc4229aaef2ed43","impliedFormat":1},{"version":"adb467429462e3891de5bb4a82a4189b92005d61c7f9367c089baf03997c104e","impliedFormat":1},{"version":"670a76db379b27c8ff42f1ba927828a22862e2ab0b0908e38b671f0e912cc5ed","impliedFormat":1},{"version":"13b77ab19ef7aadd86a1e54f2f08ea23a6d74e102909e3c00d31f231ed040f62","impliedFormat":1},{"version":"069bebfee29864e3955378107e243508b163e77ab10de6a5ee03ae06939f0bb9","impliedFormat":1},{"version":"104c67f0da1bdf0d94865419247e20eded83ce7f9911a1aa75fc675c077ca66e","impliedFormat":1},{"version":"cc0d0b339f31ce0ab3b7a5b714d8e578ce698f1e13d7f8c60bfb766baeb1d35c","impliedFormat":1},{"version":"baac9896d29bcc55391d769e408ff400d61273d832dd500f21de766205255acb","impliedFormat":1},{"version":"7578ed901eec5f590609fc7a6ba9027be5735ad1aedef119aa56d53a22dfbe02","impliedFormat":1},{"version":"5b7206ca5f2f6eeaac6daa285664f424e0b728f3e31937da89deb8696c5f1dbc","impliedFormat":1},{"version":"0504070e7eaba788f5d0d5926782ed177f1db01cee28363c488fae94950c0bbc","impliedFormat":1},{"version":"1e87d58d3678958d89e2a94454afcc827f1aa6363abbcbd4f99729e65ab47995","impliedFormat":1},{"version":"d34aa8df2d0b18fb56b1d772ff9b3c7aea7256cf0d692f969be6e1d27b74d660","impliedFormat":1},{"version":"2f5747b1508ccf83fad0c251ba1e5da2f5a30b78b09ffa1cfaf633045160afed","impliedFormat":1},{"version":"94ee9ee71018d54902c3fe6730090a8a421dcad95fc372d9b69a6d5351194885","affectsGlobalScope":true,"impliedFormat":1},{"version":"b71c603a539078a5e3a039b20f2b0a0d1708967530cf97dec8850a9ca45baa2b","impliedFormat":1},{"version":"d3f2d715f57df3f04bf7b16dde01dec10366f64fce44503c92b8f78f614c1769","impliedFormat":1},{"version":"cb90077223cc1365fa21ef0911a1f9b8f2f878943523d97350dc557973ca3823","impliedFormat":1},{"version":"18f1541b81b80d806120a3489af683edfb811deb91aeca19735d9bb2613e6311","impliedFormat":1},{"version":"232f118ae64ab84dcd26ddb60eaed5a6e44302d36249abf05e9e3fc2cbb701a2","impliedFormat":1},{"version":"6847334317c1bc1e6fc4b679b0095bbd2b6ee3b85fe3f26fc26bac462f68ef5e","impliedFormat":1},{"version":"e3ccea927a3e1cb3895f549c439452774db977521d2086738642ef1e1608ba64","impliedFormat":1},{"version":"c269a12e83c5ffc0332b1f245008e4e621e483dd2f8b9b77fc6a664fcde4969d","impliedFormat":1},{"version":"072099609280e6659eb29b1d2a601e95708c90b7db2aba2571ebda50d1be0dd5","impliedFormat":1},{"version":"72dff7d18139f0d579db7e4b904fb39f5740423f656edc1f84e4baa936b1fac0","impliedFormat":1},{"version":"febcc45f9517827496659c229a21b058831eef4cf9b71b77fd9a364ae12c3b9e","impliedFormat":1},{"version":"f2a60d253f7206372203b736144906bf135762100a2b3d1b415776ebf6575d07","impliedFormat":1},{"version":"78d131416e33b506ef0424a72c320fc8db64f17838056f583887643906b80714","affectsGlobalScope":true,"impliedFormat":1},{"version":"151ff381ef9ff8da2da9b9663ebf657eac35c4c9a19183420c05728f31a6761d","impliedFormat":1},{"version":"19f1159e1fa24300e2eaf72cb53f0815f5879ec53cad3c606802f0c55f0917e9","impliedFormat":1},{"version":"a13b9bb3e49bc162bb03870f3409474c58bb04a5e60618c305c7842f8a7b251c","impliedFormat":1},{"version":"7212c2d58855b8df35275180e97903a4b6093d4fbaefea863d8d028da63938c6","impliedFormat":1},{"version":"de0199a112f75809a7f80ec071495159dcf3e434bc021347e0175627398264c3","impliedFormat":1},{"version":"1a2bed55cfa62b4649485df27c0e560b04d4da4911e3a9f0475468721495563f","impliedFormat":1},{"version":"854045924626ba585f454b53531c42aed4365f02301aa8eca596423f4675b71f","impliedFormat":1},{"version":"fd326577c62145816fe1acc306c734c2396487f76719d3785d4e825b34540b33","impliedFormat":1},{"version":"afe73051ff6a03a9565cbd8ebb0e956ee3df5e913ad5c1ded64218aabfa3dcb5","impliedFormat":1},{"version":"fbf802b3a028f5eb22ad406ee5fc7c368f0acfd3a2a6d0f805120766f5717ec8","impliedFormat":1},{"version":"035a5df183489c2e22f3cf59fc1ed2b043d27f357eecc0eb8d8e840059d44245","impliedFormat":1},{"version":"a4809f4d92317535e6b22b01019437030077a76fec1d93b9881c9ed4738fcc54","impliedFormat":1},{"version":"5f53fa0bd22096d2a78533f94e02c899143b8f0f9891a46965294ee8b91a9434","impliedFormat":1},{"version":"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","impliedFormat":1},{"version":"2e9a5180cb127e7614170db6d4452e1bc604bdd2f7921e28f799c460c88e8c35","impliedFormat":1},{"version":"8cf9b9045a614f883b623c2f1a631ec6a93321747e933330b2eec0ee47164a34","impliedFormat":1},{"version":"380b919bfa0516118edaf25b99e45f855e7bc3fd75ce4163a1cfe4a666388804","impliedFormat":1},{"version":"0b24a72109c8dd1b41f94abfe1bb296ba01b3734b8ac632db2c48ffc5dccaf01","impliedFormat":1},{"version":"fcf79300e5257a23ed3bacaa6861d7c645139c6f7ece134d15e6669447e5e6db","impliedFormat":1},{"version":"187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","impliedFormat":1},{"version":"aa2c18a1b5a086bbcaae10a4efba409cc95ba7287d8cf8f2591b53704fea3dea","impliedFormat":1},{"version":"b88749bdb18fc1398370e33aa72bc4f88274118f4960e61ce26605f9b33c5ba2","impliedFormat":1},{"version":"0aaef8cded245bf5036a7a40b65622dd6c4da71f7a35343112edbe112b348a1e","impliedFormat":1},{"version":"00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","impliedFormat":1},{"version":"a873c50d3e47c21aa09fbe1e2023d9a44efb07cc0cb8c72f418bf301b0771fd3","impliedFormat":1},{"version":"7c14ccd2eaa82619fffc1bfa877eb68a012e9fb723d07ee98db451fadb618906","impliedFormat":1},{"version":"49c36529ee09ea9ce19525af5bb84985ea8e782cb7ee8c493d9e36d027a3d019","impliedFormat":1},{"version":"df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9","impliedFormat":1},{"version":"4f6a12044ee6f458db11964153830abbc499e73d065c51c329ec97407f4b13dd","impliedFormat":1},{"version":"f8a6bb79327f4a6afc63d28624654522fc80f7536efa7a617ef48200b7a5f673","impliedFormat":1},{"version":"8e0733c50eaac49b4e84954106acc144ec1a8019922d6afcde3762523a3634af","impliedFormat":1},{"version":"169cc96316cacf8b489aaab4ac6bcef7b33e8779a8902bce57c737b4aa372d16","impliedFormat":1},{"version":"29f72ec1289ae3aeda78bf14b38086d3d803262ac13904b400422941a26a3636","affectsGlobalScope":true,"impliedFormat":1},{"version":"736097ddbb2903bef918bb3b5811ef1c9c5656f2a73bd39b22a91b9cc2525e50","impliedFormat":1},{"version":"4340936f4e937c452ae783514e7c7bbb7fc06d0c97993ff4865370d0962bb9cf","impliedFormat":1},{"version":"b70c7ea83a7d0de17a791d9b5283f664033a96362c42cc4d2b2e0bdaa65ef7d1","impliedFormat":1},{"version":"22293bd6fa12747929f8dfca3ec1684a3fe08638aa18023dd286ab337e88a592","impliedFormat":1},{"version":"fc37aca06f6b8b296c42412a2e75ab53d30cd1fa8a340a3bb328a723fd678377","impliedFormat":1},{"version":"5f2c582b9ef260cb9559a64221b38606378c1fabe17694592cdfe5975a6d7efa","impliedFormat":1},{"version":"d7c30ea636d7d7cbeba0795baa8ec1bbd06274bd19a23ec0d7c84d0610a5f0c7","impliedFormat":1},{"version":"87d9d29dbc745f182683f63187bf3d53fd8673e5fca38ad5eaab69798ed29fbc","impliedFormat":1},{"version":"eb5b19b86227ace1d29ea4cf81387279d04bb34051e944bc53df69f58914b788","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"7a3aa194cfd5919c4da251ef04ea051077e22702638d4edcb9579e9101653519","affectsGlobalScope":true,"impliedFormat":1},{"version":"8baa5d0febc68db886c40bf341e5c90dc215a90cd64552e47e8184be6b7e3358","impliedFormat":1},{"version":"ce6a3f09b8db73a7e9701aca91a04b4fabaf77436dd35b24482f9ee816016b17","impliedFormat":1},{"version":"20e086e5b64fdd52396de67761cc0e94693494deadb731264aac122adf08de3f","impliedFormat":1},{"version":"6e78f75403b3ec65efb41c70d392aeda94360f11cedc9fb2c039c9ea23b30962","impliedFormat":1},{"version":"c863198dae89420f3c552b5a03da6ed6d0acfa3807a64772b895db624b0de707","impliedFormat":1},{"version":"8b03a5e327d7db67112ebbc93b4f744133eda2c1743dbb0a990c61a8007823ef","impliedFormat":1},{"version":"42fad1f540271e35ca37cecda12c4ce2eef27f0f5cf0f8dd761d723c744d3159","impliedFormat":1},{"version":"ff3743a5de32bee10906aff63d1de726f6a7fd6ee2da4b8229054dfa69de2c34","impliedFormat":1},{"version":"83acd370f7f84f203e71ebba33ba61b7f1291ca027d7f9a662c6307d74e4ac22","impliedFormat":1},{"version":"1445cec898f90bdd18b2949b9590b3c012f5b7e1804e6e329fb0fe053946d5ec","impliedFormat":1},{"version":"0e5318ec2275d8da858b541920d9306650ae6ac8012f0e872fe66eb50321a669","impliedFormat":1},{"version":"cf530297c3fb3a92ec9591dd4fa229d58b5981e45fe6702a0bd2bea53a5e59be","impliedFormat":1},{"version":"c1f6f7d08d42148ddfe164d36d7aba91f467dbcb3caa715966ff95f55048b3a4","impliedFormat":1},{"version":"eefd2bbc8edb14c3bd1246794e5c070a80f9b8f3730bd42efb80df3cc50b9039","impliedFormat":1},{"version":"0c1ee27b8f6a00097c2d6d91a21ee4d096ab52c1e28350f6362542b55380059a","impliedFormat":1},{"version":"7677d5b0db9e020d3017720f853ba18f415219fb3a9597343b1b1012cfd699f7","impliedFormat":1},{"version":"bc1c6bc119c1784b1a2be6d9c47addec0d83ef0d52c8fbe1f14a51b4dfffc675","impliedFormat":1},{"version":"52cf2ce99c2a23de70225e252e9822a22b4e0adb82643ab0b710858810e00bf1","impliedFormat":1},{"version":"770625067bb27a20b9826255a8d47b6b5b0a2d3dfcbd21f89904c731f671ba77","impliedFormat":1},{"version":"d1ed6765f4d7906a05968fb5cd6d1db8afa14dbe512a4884e8ea5c0f5e142c80","impliedFormat":1},{"version":"799c0f1b07c092626cf1efd71d459997635911bb5f7fc1196efe449bba87e965","impliedFormat":1},{"version":"2a184e4462b9914a30b1b5c41cf80c6d3428f17b20d3afb711fff3f0644001fd","impliedFormat":1},{"version":"9eabde32a3aa5d80de34af2c2206cdc3ee094c6504a8d0c2d6d20c7c179503cc","impliedFormat":1},{"version":"397c8051b6cfcb48aa22656f0faca2553c5f56187262135162ee79d2b2f6c966","impliedFormat":1},{"version":"a8ead142e0c87dcd5dc130eba1f8eeed506b08952d905c47621dc2f583b1bff9","impliedFormat":1},{"version":"a02f10ea5f73130efca046429254a4e3c06b5475baecc8f7b99a0014731be8b3","impliedFormat":1},{"version":"c2576a4083232b0e2d9bd06875dd43d371dee2e090325a9eac0133fd5650c1cb","impliedFormat":1},{"version":"4c9a0564bb317349de6a24eb4efea8bb79898fa72ad63a1809165f5bd42970dd","impliedFormat":1},{"version":"f40ac11d8859092d20f953aae14ba967282c3bb056431a37fced1866ec7a2681","impliedFormat":1},{"version":"cc11e9e79d4746cc59e0e17473a59d6f104692fd0eeea1bdb2e206eabed83b03","impliedFormat":1},{"version":"b444a410d34fb5e98aa5ee2b381362044f4884652e8bc8a11c8fe14bbd85518e","impliedFormat":1},{"version":"c35808c1f5e16d2c571aa65067e3cb95afeff843b259ecfa2fc107a9519b5392","impliedFormat":1},{"version":"14d5dc055143e941c8743c6a21fa459f961cbc3deedf1bfe47b11587ca4b3ef5","impliedFormat":1},{"version":"a3ad4e1fc542751005267d50a6298e6765928c0c3a8dce1572f2ba6ca518661c","impliedFormat":1},{"version":"f237e7c97a3a89f4591afd49ecb3bd8d14f51a1c4adc8fcae3430febedff5eb6","impliedFormat":1},{"version":"3ffdfbec93b7aed71082af62b8c3e0cc71261cc68d796665faa1e91604fbae8f","impliedFormat":1},{"version":"662201f943ed45b1ad600d03a90dffe20841e725203ced8b708c91fcd7f9379a","impliedFormat":1},{"version":"c9ef74c64ed051ea5b958621e7fb853fe3b56e8787c1587aefc6ea988b3c7e79","impliedFormat":1},{"version":"2462ccfac5f3375794b861abaa81da380f1bbd9401de59ffa43119a0b644253d","impliedFormat":1},{"version":"34baf65cfee92f110d6653322e2120c2d368ee64b3c7981dff08ed105c4f19b0","impliedFormat":1},{"version":"a56fe175741cc8841835eb72e61fa5a34adcbc249ede0e3494c229f0750f6b85","impliedFormat":1},{"version":"2c3b8be03577c98530ef9cb1a76e2c812636a871f367e9edf4c5f3ce702b77f8","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d09838b65c3c780513878793fc394ae29b8595d9e4729246d14ce69abc71140","impliedFormat":1},{"version":"7d2b7fe4adb76d8253f20e4dbdce044f1cdfab4902ec33c3604585f553883f7d","impliedFormat":1},{"version":"bc81aff061c53a7140270555f4b22da4ecfe8601e8027cf5aa175fbdc7927c31","impliedFormat":1},{"version":"bae8d023ef6b23df7da26f51cea44321f95817c190342a36882e93b80d07a960","impliedFormat":1},{"version":"26a770cec4bd2e7dbba95c6e536390fffe83c6268b78974a93727903b515c4e7","impliedFormat":1},{"version":"74d5a87c3616cd5d8691059d531504403aa857e09cbaecb1c64dfb9ace0db185","impliedFormat":1}],"root":[[293,296],327],"options":{"allowSyntheticDefaultImports":true,"declaration":true,"emitDeclarationOnly":false,"esModuleInterop":false,"experimentalDecorators":true,"importHelpers":true,"inlineSources":true,"module":99,"noEmitHelpers":true,"noEmitOnError":true,"outDir":"./","rootDir":"..","skipLibCheck":true,"sourceMap":true,"strict":true,"target":8},"referencedMap":[[332,1],[330,2],[56,2],[65,2],[66,3],[69,4],[67,4],[71,4],[74,5],[73,4],[72,4],[70,4],[68,6],[57,2],[58,7],[314,2],[316,8],[315,9],[299,10],[300,11],[298,2],[301,12],[325,13],[310,2],[317,14],[318,15],[319,2],[320,9],[323,16],[313,17],[322,18],[324,15],[326,19],[309,20],[274,21],[189,22],[186,2],[187,2],[188,23],[279,2],[195,24],[278,25],[277,26],[276,26],[280,26],[275,26],[206,26],[196,26],[207,26],[199,26],[205,26],[198,26],[197,26],[203,26],[204,26],[200,26],[202,26],[201,26],[283,26],[282,2],[284,2],[290,2],[286,2],[289,27],[281,23],[287,2],[288,2],[285,2],[291,28],[273,29],[223,30],[221,30],[272,2],[248,31],[236,32],[216,33],[246,32],[247,32],[250,34],[251,32],[218,35],[252,32],[253,32],[254,32],[255,32],[256,36],[257,37],[258,32],[214,32],[259,32],[260,32],[261,36],[262,32],[263,32],[264,38],[265,32],[266,34],[267,32],[215,32],[268,32],[269,32],[270,39],[213,40],[219,41],[249,42],[222,43],[271,44],[224,45],[225,46],[234,47],[233,48],[229,49],[228,48],[230,50],[227,51],[226,52],[232,53],[231,50],[235,54],[217,55],[212,56],[210,57],[220,2],[211,58],[241,2],[242,2],[239,2],[240,36],[238,2],[243,2],[237,57],[245,2],[244,2],[185,59],[328,60],[329,2],[335,61],[331,1],[333,62],[334,1],[337,63],[305,64],[297,2],[339,65],[340,2],[336,60],[341,2],[342,2],[352,66],[353,67],[354,2],[355,2],[356,2],[357,2],[358,2],[359,2],[345,68],[350,69],[360,2],[361,70],[366,71],[367,70],[368,2],[346,2],[369,2],[370,72],[371,73],[372,2],[351,2],[373,74],[374,75],[376,76],[377,77],[375,78],[378,79],[379,80],[380,81],[381,82],[382,83],[383,84],[384,85],[385,86],[386,87],[387,88],[389,89],[388,2],[390,2],[347,2],[391,2],[393,2],[394,90],[130,91],[131,91],[132,92],[78,93],[133,94],[134,95],[135,96],[76,2],[136,97],[137,98],[138,99],[139,100],[140,101],[141,102],[142,102],[143,103],[144,104],[145,105],[146,106],[79,2],[77,2],[147,107],[148,108],[149,109],[183,110],[150,111],[151,2],[152,112],[153,113],[154,114],[155,115],[156,116],[157,117],[158,118],[159,119],[160,120],[161,120],[162,121],[163,2],[164,122],[165,123],[167,124],[166,125],[168,126],[169,127],[170,128],[171,129],[172,130],[173,131],[174,132],[175,133],[176,134],[177,135],[178,136],[179,137],[180,138],[80,2],[81,139],[82,2],[83,2],[126,140],[127,141],[128,2],[129,126],[181,142],[182,143],[395,2],[397,144],[396,145],[398,2],[399,2],[338,2],[344,2],[400,2],[402,146],[403,2],[428,147],[429,148],[405,149],[408,150],[426,147],[427,147],[417,147],[416,151],[414,147],[409,147],[422,147],[420,147],[424,147],[404,147],[421,147],[425,147],[410,147],[411,147],[423,147],[406,147],[412,147],[413,147],[415,147],[419,147],[430,152],[418,147],[407,147],[443,153],[442,2],[437,152],[439,154],[438,152],[431,152],[432,152],[434,152],[436,152],[440,154],[441,154],[433,154],[435,154],[343,155],[349,156],[348,157],[308,158],[307,159],[306,2],[444,160],[60,2],[445,2],[446,2],[447,161],[448,2],[449,162],[450,163],[84,2],[302,64],[304,164],[303,165],[401,2],[184,166],[392,167],[209,168],[194,169],[208,2],[292,170],[193,171],[190,2],[191,2],[192,2],[62,172],[59,173],[63,2],[61,174],[311,173],[75,175],[321,173],[64,176],[312,177],[362,178],[363,178],[365,179],[364,178],[55,2],[53,2],[54,2],[9,2],[10,2],[12,2],[11,2],[2,2],[13,2],[14,2],[15,2],[16,2],[17,2],[18,2],[19,2],[20,2],[3,2],[21,2],[22,2],[4,2],[23,2],[27,2],[24,2],[25,2],[26,2],[28,2],[29,2],[30,2],[5,2],[31,2],[32,2],[33,2],[34,2],[6,2],[38,2],[35,2],[36,2],[37,2],[39,2],[7,2],[40,2],[45,2],[46,2],[41,2],[42,2],[43,2],[44,2],[8,2],[50,2],[47,2],[48,2],[49,2],[1,2],[51,2],[52,2],[102,180],[114,181],[100,182],[115,183],[124,184],[91,185],[92,186],[90,187],[123,166],[118,188],[122,189],[94,190],[111,191],[93,192],[121,193],[88,194],[89,188],[95,195],[96,2],[101,196],[99,195],[86,197],[125,198],[116,199],[105,200],[104,195],[106,201],[109,202],[103,203],[107,204],[119,166],[97,205],[98,206],[110,207],[87,183],[113,208],[112,195],[108,209],[117,2],[85,2],[120,210],[294,211],[295,211],[293,212],[296,213],[327,214]],"version":"5.9.3"} \ No newline at end of file diff --git a/packages/lit-components/LICENSE b/packages/lit-components/LICENSE new file mode 100644 index 0000000000..bda200bab5 --- /dev/null +++ b/packages/lit-components/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 sql-referral-code + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/lit-components/README.md b/packages/lit-components/README.md new file mode 100644 index 0000000000..8fb1176c18 --- /dev/null +++ b/packages/lit-components/README.md @@ -0,0 +1,76 @@ +# \ + +This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation. + +## Installation + +```bash +npm i sql-referral-code +``` + +## Usage + +```html + + + +``` + +## Linting and formatting + +To scan the project for linting and formatting errors, run + +```bash +npm run lint +``` + +To automatically fix linting and formatting errors, run + +```bash +npm run format +``` + +## Testing with Web Test Runner + +To execute a single test run: + +```bash +npm run test +``` + +To run the tests in interactive watch mode run: + +```bash +npm run test:watch +``` + +## Demoing with Storybook + +To run a local instance of Storybook for your component, run + +```bash +npm run storybook +``` + +To build a production version of Storybook, run + +```bash +npm run storybook:build +``` + + +## Tooling configs + +For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project. + +If you customize the configuration a lot, you can consider moving them to individual files. + +## Local Demo with `web-dev-server` + +```bash +npm start +``` + +To run a local development server that serves the basic demo located in `demo/index.html` diff --git a/packages/lit-components/custom-elements.json b/packages/lit-components/custom-elements.json new file mode 100644 index 0000000000..33263b09d5 --- /dev/null +++ b/packages/lit-components/custom-elements.json @@ -0,0 +1,168 @@ +{ + "schemaVersion": "1.0.0", + "readme": "", + "modules": [ + { + "kind": "javascript-module", + "path": "src/SqlReferralCode.ts", + "declarations": [ + { + "kind": "class", + "description": "", + "name": "SqlReferralCode", + "members": [ + { + "kind": "field", + "name": "header", + "type": { + "text": "string" + }, + "default": "'Hey there'", + "attribute": "header" + }, + { + "kind": "field", + "name": "counter", + "type": { + "text": "number" + }, + "default": "5", + "attribute": "counter" + }, + { + "kind": "method", + "name": "__increment" + } + ], + "attributes": [ + { + "name": "header", + "type": { + "text": "string" + }, + "default": "'Hey there'", + "fieldName": "header" + }, + { + "name": "counter", + "type": { + "text": "number" + }, + "default": "5", + "fieldName": "counter" + } + ], + "superclass": { + "name": "LitElement", + "package": "lit" + }, + "tagName": "sql-referral-code", + "customElement": true + } + ], + "exports": [ + { + "kind": "js", + "name": "SqlReferralCode", + "declaration": { + "name": "SqlReferralCode", + "module": "src/SqlReferralCode.ts" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "src/index.ts", + "declarations": [], + "exports": [ + { + "kind": "js", + "name": "SqlReferralCode", + "declaration": { + "name": "SqlReferralCode", + "module": "./SqlReferralCode.js" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "src/sql-referral-code.ts", + "declarations": [], + "exports": [ + { + "kind": "custom-element-definition", + "name": "sql-referral-code", + "declaration": { + "name": "SqlReferralCode", + "module": "/src/SqlReferralCode.js" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "stories/index.stories.ts", + "declarations": [ + { + "kind": "variable", + "name": "Regular" + }, + { + "kind": "variable", + "name": "CustomHeader" + }, + { + "kind": "variable", + "name": "CustomCounter" + }, + { + "kind": "variable", + "name": "SlottedContent" + } + ], + "exports": [ + { + "kind": "js", + "name": "default", + "declaration": { + "module": "stories/index.stories.ts" + } + }, + { + "kind": "js", + "name": "Regular", + "declaration": { + "name": "Regular", + "module": "stories/index.stories.ts" + } + }, + { + "kind": "js", + "name": "CustomHeader", + "declaration": { + "name": "CustomHeader", + "module": "stories/index.stories.ts" + } + }, + { + "kind": "js", + "name": "CustomCounter", + "declaration": { + "name": "CustomCounter", + "module": "stories/index.stories.ts" + } + }, + { + "kind": "js", + "name": "SlottedContent", + "declaration": { + "name": "SlottedContent", + "module": "stories/index.stories.ts" + } + } + ] + } + ] +} diff --git a/packages/lit-components/demo/index.html b/packages/lit-components/demo/index.html new file mode 100644 index 0000000000..b0ef26ff75 --- /dev/null +++ b/packages/lit-components/demo/index.html @@ -0,0 +1,51 @@ + + + + + + + + + +
+ + + + diff --git a/packages/lit-components/dist/rollup.config.d.ts b/packages/lit-components/dist/rollup.config.d.ts new file mode 100644 index 0000000000..5a62c487fe --- /dev/null +++ b/packages/lit-components/dist/rollup.config.d.ts @@ -0,0 +1,10 @@ +declare const _default: { + input: string; + output: { + file: string; + format: string; + sourcemap: boolean; + }[]; + plugins: import("rollup").Plugin[]; +}; +export default _default; diff --git a/packages/lit-components/dist/rollup.config.js b/packages/lit-components/dist/rollup.config.js new file mode 100644 index 0000000000..9ce0665658 --- /dev/null +++ b/packages/lit-components/dist/rollup.config.js @@ -0,0 +1,59 @@ +import path from 'path'; +import alias from '@rollup/plugin-alias'; +export default { + input: 'src/index.ts', + output: [ + { file: 'dist/src/index.js', format: 'es', sourcemap: true }, + { file: 'dist/src/sql-referral-code.js', format: 'cjs', sourcemap: true }, + ], + plugins: [ + alias({ + entries: [ + { + find: '@saasquatch/universal-hooks', + replacement: path.resolve(__dirname, 'node_modules', 'haunted'), + }, + ], + }), + // clean dist before build + // del({ targets: 'dist/*' }), + // // resolve node modules and commonjs packages + // nodeResolve({ browser: true, preferBuiltins: false }), + // commonjs(), + // // compile TypeScript + // typescript({ tsconfig: './tsconfig.json', sourceMap: true }), + // // after bundle is written, copy haunted into the dist path expected by consumers + // copy({ + // targets: [ + // { + // src: 'node_modules/haunted/**', + // dest: 'dist/@saasquatch/universal-hooks', + // }, + // ], + // hook: 'writeBundle', + // copyOnce: true, + // verbose: true, + // }), + // aliasPlugin, + // // remove existing dist copy before building + // del({ + // targets: 'dist/@saasquatch/universal-hooks/*', + // runOnce: true, + // hook: 'buildStart', + // }), + // // ...other plugins (nodeResolve, commonjs, babel, etc.)... + // // after bundle is written, copy the haunted package into dist/@saasquatch/universal-hooks + // copy({ + // targets: [ + // { + // src: 'node_modules/haunted/**', + // dest: 'dist/@saasquatch/universal-hooks', + // }, + // ], + // hook: 'writeBundle', + // copyOnce: true, + // verbose: true, + // }), + ], +}; +//# sourceMappingURL=rollup.config.js.map \ No newline at end of file diff --git a/packages/lit-components/dist/rollup.config.js.map b/packages/lit-components/dist/rollup.config.js.map new file mode 100644 index 0000000000..aa1cb3c650 --- /dev/null +++ b/packages/lit-components/dist/rollup.config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rollup.config.js","sourceRoot":"","sources":["../rollup.config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,sBAAsB,CAAC;AAOzC,eAAe;IACb,KAAK,EAAE,cAAc;IACrB,MAAM,EAAE;QACN,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;QAC5D,EAAE,IAAI,EAAE,+BAA+B,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE;KAC1E;IACD,OAAO,EAAE;QACP,KAAK,CAAC;YACJ,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,6BAA6B;oBACnC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,SAAS,CAAC;iBAChE;aACF;SACF,CAAC;QACF,0BAA0B;QAC1B,8BAA8B;QAE9B,gDAAgD;QAChD,yDAAyD;QACzD,cAAc;QAEd,wBAAwB;QACxB,gEAAgE;QAEhE,oFAAoF;QACpF,SAAS;QACT,eAAe;QACf,QAAQ;QACR,wCAAwC;QACxC,kDAAkD;QAClD,SAAS;QACT,OAAO;QACP,yBAAyB;QACzB,oBAAoB;QACpB,mBAAmB;QACnB,MAAM;QACN,eAAe;QACf,+CAA+C;QAC/C,QAAQ;QACR,mDAAmD;QACnD,mBAAmB;QACnB,wBAAwB;QACxB,MAAM;QACN,8DAA8D;QAC9D,6FAA6F;QAC7F,SAAS;QACT,eAAe;QACf,QAAQ;QACR,wCAAwC;QACxC,kDAAkD;QAClD,SAAS;QACT,OAAO;QACP,yBAAyB;QACzB,oBAAoB;QACpB,mBAAmB;QACnB,MAAM;KACP;CACF,CAAC","sourcesContent":["import path from 'path';\nimport alias from '@rollup/plugin-alias';\nimport del from 'rollup-plugin-delete';\nimport copy from 'rollup-plugin-copy';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\nimport commonjs from '@rollup/plugin-commonjs';\nimport typescript from '@rollup/plugin-typescript';\n\nexport default {\n input: 'src/index.ts',\n output: [\n { file: 'dist/src/index.js', format: 'es', sourcemap: true },\n { file: 'dist/src/sql-referral-code.js', format: 'cjs', sourcemap: true },\n ],\n plugins: [\n alias({\n entries: [\n {\n find: '@saasquatch/universal-hooks',\n replacement: path.resolve(__dirname, 'node_modules', 'haunted'),\n },\n ],\n }),\n // clean dist before build\n // del({ targets: 'dist/*' }),\n\n // // resolve node modules and commonjs packages\n // nodeResolve({ browser: true, preferBuiltins: false }),\n // commonjs(),\n\n // // compile TypeScript\n // typescript({ tsconfig: './tsconfig.json', sourceMap: true }),\n\n // // after bundle is written, copy haunted into the dist path expected by consumers\n // copy({\n // targets: [\n // {\n // src: 'node_modules/haunted/**',\n // dest: 'dist/@saasquatch/universal-hooks',\n // },\n // ],\n // hook: 'writeBundle',\n // copyOnce: true,\n // verbose: true,\n // }),\n // aliasPlugin,\n // // remove existing dist copy before building\n // del({\n // targets: 'dist/@saasquatch/universal-hooks/*',\n // runOnce: true,\n // hook: 'buildStart',\n // }),\n // // ...other plugins (nodeResolve, commonjs, babel, etc.)...\n // // after bundle is written, copy the haunted package into dist/@saasquatch/universal-hooks\n // copy({\n // targets: [\n // {\n // src: 'node_modules/haunted/**',\n // dest: 'dist/@saasquatch/universal-hooks',\n // },\n // ],\n // hook: 'writeBundle',\n // copyOnce: true,\n // verbose: true,\n // }),\n ],\n};\n"]} \ No newline at end of file diff --git a/packages/lit-components/dist/src/SqlReferralCode.d.ts b/packages/lit-components/dist/src/SqlReferralCode.d.ts new file mode 100644 index 0000000000..5cbf6918c0 --- /dev/null +++ b/packages/lit-components/dist/src/SqlReferralCode.d.ts @@ -0,0 +1,9 @@ +import { LitElement } from 'lit'; +export declare class SqlReferralCode extends LitElement { + static styles: import("lit").CSSResult; + constructor(); + header: string; + counter: number; + __increment(): void; + render(): import("lit-html").TemplateResult<1>; +} diff --git a/packages/lit-components/dist/src/SqlReferralCode.js b/packages/lit-components/dist/src/SqlReferralCode.js new file mode 100644 index 0000000000..3c7c874d68 --- /dev/null +++ b/packages/lit-components/dist/src/SqlReferralCode.js @@ -0,0 +1,53 @@ +import { __decorate } from "tslib"; +import { html, css, LitElement } from 'lit'; +import { property } from 'lit/decorators.js'; +// import { setImplementation } from '@saasquatch/universal-hooks'; +// import * as haunted from 'haunted'; +// setImplementation(haunted); +// @ts-ignore +import { useQuery, useProgramId } from '@saasquatch/component-boilerplate'; +import { gql } from 'graphql-tag'; +const MessageLinkQuery = gql ` + query getReferralCode($programId: ID) { + user: viewer { + ... on User { + referralCode(programId: $programId) + } + } + } +`; +export class SqlReferralCode extends LitElement { + constructor() { + super(); + this.header = 'Hey there'; + this.counter = 5; + console.log('yay'); + const programId = useProgramId(); + // const user = useUserIdentity(); + const { data } = useQuery(MessageLinkQuery, { programId }); + // console.log({ user }); + } + __increment() { + this.counter += 1; + } + render() { + return html ` +

${this.header} Nr. ${this.counter}!

+ + `; + } +} +SqlReferralCode.styles = css ` + :host { + display: block; + padding: 25px; + color: var(--sql-referral-code-text-color, #000); + } + `; +__decorate([ + property({ type: String }) +], SqlReferralCode.prototype, "header", void 0); +__decorate([ + property({ type: Number }) +], SqlReferralCode.prototype, "counter", void 0); +//# sourceMappingURL=SqlReferralCode.js.map \ No newline at end of file diff --git a/packages/lit-components/dist/src/SqlReferralCode.js.map b/packages/lit-components/dist/src/SqlReferralCode.js.map new file mode 100644 index 0000000000..b2165b663e --- /dev/null +++ b/packages/lit-components/dist/src/SqlReferralCode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"SqlReferralCode.js","sourceRoot":"","sources":["../../src/SqlReferralCode.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,mEAAmE;AACnE,sCAAsC;AACtC,8BAA8B;AAE9B,aAAa;AACb,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,MAAM,gBAAgB,GAAG,GAAG,CAAA;;;;;;;;CAQ3B,CAAC;AAEF,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAS7C;QACE,KAAK,EAAE,CAAC;QAWkB,WAAM,GAAG,WAAW,CAAC;QAErB,YAAO,GAAG,CAAC,CAAC;QAZtC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;QACjC,kCAAkC;QAElC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAE3D,yBAAyB;IAC3B,CAAC;IAMD,WAAW;QACT,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;YACH,IAAI,CAAC,MAAM,QAAQ,IAAI,CAAC,OAAO;uBACpB,IAAI,CAAC,WAAW;KAClC,CAAC;IACJ,CAAC;;AAjCM,sBAAM,GAAG,GAAG,CAAA;;;;;;GAMlB,AANY,CAMX;AAc0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAsB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAa","sourcesContent":["import { html, css, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n// import { setImplementation } from '@saasquatch/universal-hooks';\n// import * as haunted from 'haunted';\n// setImplementation(haunted);\n\n// @ts-ignore\nimport { useQuery, useProgramId } from '@saasquatch/component-boilerplate';\nimport { gql } from 'graphql-tag';\n\nconst MessageLinkQuery = gql`\n query getReferralCode($programId: ID) {\n user: viewer {\n ... on User {\n referralCode(programId: $programId)\n }\n }\n }\n`;\n\nexport class SqlReferralCode extends LitElement {\n static styles = css`\n :host {\n display: block;\n padding: 25px;\n color: var(--sql-referral-code-text-color, #000);\n }\n `;\n\n constructor() {\n super();\n console.log('yay');\n\n const programId = useProgramId();\n // const user = useUserIdentity();\n\n const { data } = useQuery(MessageLinkQuery, { programId });\n\n // console.log({ user });\n }\n\n @property({ type: String }) header = 'Hey there';\n\n @property({ type: Number }) counter = 5;\n\n __increment() {\n this.counter += 1;\n }\n\n render() {\n return html`\n

${this.header} Nr. ${this.counter}!

\n \n `;\n }\n}\n"]} \ No newline at end of file diff --git a/packages/lit-components/dist/src/index.d.ts b/packages/lit-components/dist/src/index.d.ts new file mode 100644 index 0000000000..9ba7143ed0 --- /dev/null +++ b/packages/lit-components/dist/src/index.d.ts @@ -0,0 +1 @@ +export { SqlReferralCode } from './SqlReferralCode'; diff --git a/packages/lit-components/dist/src/index.js b/packages/lit-components/dist/src/index.js new file mode 100644 index 0000000000..c94645d9b2 --- /dev/null +++ b/packages/lit-components/dist/src/index.js @@ -0,0 +1,9490 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t$3=globalThis,e$3=t$3.ShadowRoot&&(void 0===t$3.ShadyCSS||t$3.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$3=Symbol(),o$5=new WeakMap;let n$5 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s$3)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$3&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$5.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$5.set(s,t));}return t}toString(){return this.cssText}};const r$5=t=>new n$5("string"==typeof t?t:t+"",void 0,s$3),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(true===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$5(o,t,s$3)},S$1=(s,o)=>{if(e$3)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$3.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$4=e$3?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$5(e)})(t):t; + +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const{is:i$2,defineProperty:e$2,getOwnPropertyDescriptor:h$2,getOwnPropertyNames:r$4,getOwnPropertySymbols:o$4,getPrototypeOf:n$4}=Object,a$2=globalThis,c$3=a$2.trustedTypes,l$2=c$3?c$3.emptyScript:"",p$2=a$2.reactiveElementPolyfillSupport,d$2=(t,s)=>t,u$2={toAttribute(t,s){switch(s){case Boolean:t=t?l$2:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$2=(t,s)=>!i$2(t,s),b={attribute:true,type:String,converter:u$2,reflect:false,useDefault:false,hasChanged:f$2};Symbol.metadata??=Symbol("metadata"),a$2.litPropertyMetadata??=new WeakMap;let y$1 = class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$2(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d$2("elementProperties")))return;const t=n$4(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$2("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d$2("properties"))){const t=this.properties,s=[...r$4(t),...o$4(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$4(s));}else void 0!==s&&i.push(c$4(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u$2).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$2;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f$2)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}};y$1.elementStyles=[],y$1.shadowRootOptions={mode:"open"},y$1[d$2("elementProperties")]=new Map,y$1[d$2("finalized")]=new Map,p$2?.({ReactiveElement:y$1}),(a$2.reactiveElementVersions??=[]).push("2.1.1"); + +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t$2=globalThis,i$1=t$2.trustedTypes,s$2=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$1="$lit$",h$1=`lit$${Math.random().toFixed(9).slice(2)}$`,o$3="?"+h$1,n$3=`<${o$3}>`,r$3=document,l$1=()=>r$3.createComment(""),c$2=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a$1=Array.isArray,u$1=t=>a$1(t)||"function"==typeof t?.[Symbol.iterator],d$1="[ \t\n\f\r]",f$1=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m$1=RegExp(`>|${d$1}(?:([^\\s"'>=/]+)(${d$1}*=${d$1}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p$1=/'/g,g$1=/"/g,$$1=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C$1=r$3.createTreeWalker(r$3,129);function P(t,i){if(!a$1(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$2?s$2.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"":3===i?"":"",c=f$1;for(let i=0;i"===u[0]?(c=r??f$1,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m$1:'"'===u[3]?g$1:p$1):c===g$1||c===p$1?c=m$1:c===v||c===_?c=f$1:(c=m$1,r=void 0);const x=c===m$1&&t[i+1].startsWith("/>")?" ":"";l+=c===f$1?s+n$3:d>=0?(o.push(a),s.slice(0,d)+e$1+s.slice(d)+h$1+x):s+h$1+(-2===d?i:x);}return [P(t,l+(t[s]||"")+(2===i?"":3===i?"":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C$1.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C$1.nextNode())&&d.length0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=false;if(void 0===h)t=S(this,t,i,0),o=!c$2(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l$1(),t),t,void 0,s??{});}return h._$AI(t),h}; + +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const s$1=globalThis;class i extends y$1{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(r,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return T}}i._$litElement$=true,i["finalized"]=true,s$1.litElementHydrateSupport?.({LitElement:i});const o$2=s$1.litElementPolyfillSupport;o$2?.({LitElement:i});(s$1.litElementVersions??=[]).push("4.2.1"); + +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const o$1={attribute:true,type:String,converter:u$2,reflect:false,hasChanged:f$2},r$2=(t=o$1,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n$2(t){return (e,o)=>"object"==typeof o?r$2(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)} + +function e(e){this.message=e;}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r$1="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,"");if(t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,c="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return c};function t$1(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw "Illegal base64url string!"}try{return function(e){return decodeURIComponent(r$1(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0"+t),"%"+t})))}(t)}catch(e){return r$1(t)}}function n$1(e){this.message=e;}function o(e,r){if("string"!=typeof e)throw new n$1("Invalid token specified");var o=true===(r=r||{}).header?0:1;try{return JSON.parse(t$1(e.split(".")[o]))}catch(e){throw new n$1("Invalid token specified: "+e.message)}}n$1.prototype=new Error,n$1.prototype.name="InvalidTokenError"; + +function t(t,n){for(var e=0;e=i&&(t._interval&&clearInterval(t._interval),t.status="Timeout"):"Connected"===e()&&t._interval&&clearInterval(t._interval);}};return (a(this.options.pollingMs)||100)>0&&i>1&&(this._interval=setInterval(o,a(this.options.pollingMs)||100)),o(),this},e.stop=function(){return this._interval&&clearInterval(this._interval),this.resolvePromise&&this.resolvePromise(),this.status="Initial",this},n(t,[{key:"status",set:function(t){this._status=t,this.options.onStatus&&this.options.onStatus(t);},get:function(){return this._status}}]),t}(),c$1=function(){function t(t){var n=this;this.__listeners=[],this.connectListener=function(t){try{t.stopPropagation(),n.__listeners=[].concat(n.__listeners,[t.detail]);var e=function(e,i){try{var o=Promise.resolve(t.detail.onConnect(n.__current)).then(function(){});}catch(t){return i(!0,t)}return o&&o.then?o.then(i.bind(null,!1),i.bind(null,!0)):i(!1,o)}(0,function(e,i){var o,r;if(n.__listeners=(r=(o=n.__listeners).indexOf(t.detail),o.slice(0,r).concat(o.slice(r+1,o.length))),e)throw i;return i});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},this.options=t,this.__current=a(t.initialState);}var e=t.prototype;return e.start=function(){return a(this.options.element).addEventListener(this.options.contextName,this.connectListener),this},e.stop=function(){return a(this.options.element).removeEventListener(this.options.contextName,this.connectListener),this.__listeners.map(function(t){t.onDisconnect();}),this.__listeners=[],this},n(t,[{key:"context",set:function(t){var n=this.__current;this.__current=t,this.__listeners.forEach(function(e){return e.onChange(t,n)});},get:function(){return a(this.__current)}},{key:"listeners",get:function(){return Object.freeze([].concat(this.__listeners))}}]),t}();function a(t){return "function"==typeof typeof t?t():t} + +const { toString, hasOwnProperty } = Object.prototype; +const fnToStr = Function.prototype.toString; +const previousComparisons = new Map(); +/** + * Performs a deep equality check on two JavaScript values, tolerating cycles. + */ +function equal(a, b) { + try { + return check(a, b); + } + finally { + previousComparisons.clear(); + } +} +function check(a, b) { + // If the two values are strictly equal, our job is easy. + if (a === b) { + return true; + } + // Object.prototype.toString returns a representation of the runtime type of + // the given value that is considerably more precise than typeof. + const aTag = toString.call(a); + const bTag = toString.call(b); + // If the runtime types of a and b are different, they could maybe be equal + // under some interpretation of equality, but for simplicity and performance + // we just return false instead. + if (aTag !== bTag) { + return false; + } + switch (aTag) { + case '[object Array]': + // Arrays are a lot like other objects, but we can cheaply compare their + // lengths as a short-cut before comparing their elements. + if (a.length !== b.length) + return false; + // Fall through to object case... + case '[object Object]': { + if (previouslyCompared(a, b)) + return true; + const aKeys = definedKeys(a); + const bKeys = definedKeys(b); + // If `a` and `b` have a different number of enumerable keys, they + // must be different. + const keyCount = aKeys.length; + if (keyCount !== bKeys.length) + return false; + // Now make sure they have the same keys. + for (let k = 0; k < keyCount; ++k) { + if (!hasOwnProperty.call(b, aKeys[k])) { + return false; + } + } + // Finally, check deep equality of all child properties. + for (let k = 0; k < keyCount; ++k) { + const key = aKeys[k]; + if (!check(a[key], b[key])) { + return false; + } + } + return true; + } + case '[object Error]': + return a.name === b.name && a.message === b.message; + case '[object Number]': + // Handle NaN, which is !== itself. + if (a !== a) + return b !== b; + // Fall through to shared +a === +b case... + case '[object Boolean]': + case '[object Date]': + return +a === +b; + case '[object RegExp]': + case '[object String]': + return a == `${b}`; + case '[object Map]': + case '[object Set]': { + if (a.size !== b.size) + return false; + if (previouslyCompared(a, b)) + return true; + const aIterator = a.entries(); + const isMap = aTag === '[object Map]'; + while (true) { + const info = aIterator.next(); + if (info.done) + break; + // If a instanceof Set, aValue === aKey. + const [aKey, aValue] = info.value; + // So this works the same way for both Set and Map. + if (!b.has(aKey)) { + return false; + } + // However, we care about deep equality of values only when dealing + // with Map structures. + if (isMap && !check(aValue, b.get(aKey))) { + return false; + } + } + return true; + } + case '[object Uint16Array]': + case '[object Uint8Array]': // Buffer, in Node.js. + case '[object Uint32Array]': + case '[object Int32Array]': + case '[object Int8Array]': + case '[object Int16Array]': + case '[object ArrayBuffer]': + // DataView doesn't need these conversions, but the equality check is + // otherwise the same. + a = new Uint8Array(a); + b = new Uint8Array(b); + // Fall through... + case '[object DataView]': { + let len = a.byteLength; + if (len === b.byteLength) { + while (len-- && a[len] === b[len]) { + // Keep looping as long as the bytes are equal. + } + } + return len === -1; + } + case '[object AsyncFunction]': + case '[object GeneratorFunction]': + case '[object AsyncGeneratorFunction]': + case '[object Function]': { + const aCode = fnToStr.call(a); + if (aCode !== fnToStr.call(b)) { + return false; + } + // We consider non-native functions equal if they have the same code + // (native functions require === because their code is censored). + // Note that this behavior is not entirely sound, since !== function + // objects with the same code can behave differently depending on + // their closure scope. However, any function can behave differently + // depending on the values of its input arguments (including this) + // and its calling context (including its closure scope), even + // though the function object is === to itself; and it is entirely + // possible for functions that are not === to behave exactly the + // same under all conceivable circumstances. Because none of these + // factors are statically decidable in JavaScript, JS function + // equality is not well-defined. This ambiguity allows us to + // consider the best possible heuristic among various imperfect + // options, and equating non-native functions that have the same + // code has enormous practical benefits, such as when comparing + // functions that are repeatedly passed as fresh function + // expressions within objects that are otherwise deeply equal. Since + // any function created from the same syntactic expression (in the + // same code location) will always stringify to the same code + // according to fnToStr.call, we can reasonably expect these + // repeatedly passed function expressions to have the same code, and + // thus behave "the same" (with all the caveats mentioned above), + // even though the runtime function objects are !== to one another. + return !endsWith(aCode, nativeCodeSuffix); + } + } + // Otherwise the values are not equal. + return false; +} +function definedKeys(obj) { + // Remember that the second argument to Array.prototype.filter will be + // used as `this` within the callback function. + return Object.keys(obj).filter(isDefinedKey, obj); +} +function isDefinedKey(key) { + return this[key] !== void 0; +} +const nativeCodeSuffix = "{ [native code] }"; +function endsWith(full, suffix) { + const fromIndex = full.length - suffix.length; + return fromIndex >= 0 && + full.indexOf(suffix, fromIndex) === fromIndex; +} +function previouslyCompared(a, b) { + // Though cyclic references can make an object graph appear infinite from the + // perspective of a depth-first traversal, the graph still contains a finite + // number of distinct object references. We use the previousComparisons cache + // to avoid comparing the same pair of object references more than once, which + // guarantees termination (even if we end up comparing every object in one + // graph to every object in the other graph, which is extremely unlikely), + // while still allowing weird isomorphic structures (like rings with different + // lengths) a chance to pass the equality test. + let bSet = previousComparisons.get(a); + if (bSet) { + // Return true here because we can be sure false will be returned somewhere + // else if the objects are not equivalent. + if (bSet.has(b)) + return true; + } + else { + previousComparisons.set(a, bSet = new Set); + } + bSet.add(b); + return false; +} + +var __defProp = Object.defineProperty; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + } + return a; +}; + +// src/types.ts +var USER_CONTEXT_NAME = "sq:user-identity"; +var LOCALE_CONTEXT_NAME = "sq:locale"; +var PROGRAM_CONTEXT_NAME = "sq:program-id"; +function getEnvironmentSDK() { + var _a, _b, _c; + if (window["SquatchAndroid"]) { + return { + type: "SquatchAndroid", + android: window["SquatchAndroid"], + widgetIdent: window["widgetIdent"] + }; + } + if (window["SquatchPortal"]) { + return { + type: "SquatchPortal", + env: window["SquatchPortal"] + }; + } + if (window["SquatchAdmin"]) { + return { + type: "SquatchAdmin", + adminSDK: window["SquatchAdmin"] + }; + } + if ((window["widgetIdent"] || ((_a = window.frameElement) == null ? void 0 : _a["squatchJsApi"])) && ((_b = window["widgetIdent"]) == null ? void 0 : _b.env) !== "demo") { + return { + type: "SquatchJS2", + api: (_c = window.frameElement) == null ? void 0 : _c["squatchJsApi"], + widgetIdent: window["widgetIdent"] + }; + } + return { + type: "None" + }; +} +function isDemo() { + const sdk = getEnvironmentSDK(); + return sdk.type === "None" || sdk.type === "SquatchAdmin"; +} +var FAKE_TENANT = "demo"; +function getTenantAlias() { + var _a; + const sdk = getEnvironmentSDK(); + switch (sdk.type) { + case "SquatchAndroid": + case "SquatchIOS": + case "SquatchJS2": + return (_a = sdk.widgetIdent) == null ? void 0 : _a.tenantAlias; + case "SquatchAdmin": + case "None": + return FAKE_TENANT; + case "SquatchPortal": + return sdk.env.tenantAlias; + } +} +var DEFAULT_DOMAIN = "https://app.referralsaasquatch.com"; +function getAppDomain() { + var _a, _b; + const sdk = getEnvironmentSDK(); + switch (sdk.type) { + case "SquatchAndroid": + case "SquatchIOS": + case "SquatchJS2": + return ((_a = sdk.widgetIdent) == null ? void 0 : _a.appDomain) || DEFAULT_DOMAIN; + case "SquatchPortal": + return ((_b = sdk.env) == null ? void 0 : _b.appDomain) || DEFAULT_DOMAIN; + case "SquatchAdmin": + case "None": + return DEFAULT_DOMAIN; + } +} + +// src/debug.ts +var debugEnabled = (() => { + var _a; + try { + return (_a = window == null ? void 0 : window.localStorage) == null ? void 0 : _a.getItem("debug"); + } catch (e) { + return false; + } +})(); +function debug(ns, ...args) { + if (debugEnabled) { + console.debug(`sq:environment:${ns}`, ...args); + } +} +var debug3 = (...args) => debug(LOCALE_CONTEXT_NAME, ...args); +function validateLocale(locale) { + if (locale && /^[a-z]{2}(_(?:[A-Z]{2}|[0-9]{3}))?$/.test(locale)) { + return locale; + } +} +function lazilyStartLocaleContext() { + var _a; + let globalProvider = window.squatchLocale; + if (!globalProvider) { + debug3("Creating locale context provider"); + const locale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll("-", "_")); + debug3("initializing with locale:", locale); + globalProvider = new c$1({ + element: document.documentElement, + initialState: locale, + contextName: LOCALE_CONTEXT_NAME + }).start(); + window.squatchLocale = globalProvider; + } + return globalProvider; +} + +// src/fetchLocale.ts +var debug4 = (...args) => debug(LOCALE_CONTEXT_NAME, ...args); +var GET_LOCALE = ` + query { + viewer { + ... on User { + locale + } + } + } +`; +async function fetchLocale() { + var _a; + debug4("Fetching locale from GraphQL for current user"); + try { + const result = await fetch(`${getAppDomain()}/api/v1/${getTenantAlias()}/graphql`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${(_a = getUserIdentity()) == null ? void 0 : _a.jwt}` + }, + body: JSON.stringify({ + query: GET_LOCALE + }) + }); + if (!result.ok) { + throw new Error("Failed to fetch locale"); + } + const json = await result.json(); + if (json.errors) { + throw new Error(JSON.stringify(json.errors, null, 2)); + } + return json.data.viewer.locale || void 0; + } catch (e) { + debug4(`Failed to fetch locale for current user`, e.message); + return void 0; + } +} + +// src/listeners.ts +var debug5 = (...args) => debug(LOCALE_CONTEXT_NAME, ...args); +var userContextListenerDiv = (() => { + const id = "__environment_context_listener"; + let div = document.getElementById(id); + if (!div) { + div = document.createElement("div"); + div.id = id; + document.documentElement.appendChild(div); + } + return div; +})(); +var userContextListenerForLocale = new s({ + contextName: USER_CONTEXT_NAME, + element: userContextListenerDiv, + onChange: async (next) => { + var _a; + const localeProvider = lazilyStartLocaleContext(); + const defaultLocale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll("-", "_")); + let newLocale; + if (next) { + debug5("User context changed, refetching locale"); + const locale = await fetchLocale(); + debug5(`New value fetched from GraphQL [${locale}]`); + newLocale = locale || defaultLocale; + } else { + newLocale = defaultLocale; + } + debug5(`Setting locale context to [${newLocale}]`); + localeProvider.context = newLocale; + } +}); +function startUserContextListenerForLocale() { + debug5("Starting user context listener for locale updates"); + userContextListenerForLocale.start(); +} + +// src/contexts/UserIdentityContext.ts +var debug6 = (...args) => debug(USER_CONTEXT_NAME, ...args); +function lazilyStartUserContext() { + let globalProvider = window.squatchUserIdentity; + if (!globalProvider) { + debug6("Creating user context provider"); + globalProvider = new c$1({ + element: document.documentElement, + initialState: _getInitialValue(), + contextName: USER_CONTEXT_NAME + }).start(); + window.squatchUserIdentity = globalProvider; + startUserContextListenerForLocale(); + } + return globalProvider; +} +function isDecodedSquatchJWT(decoded) { + return decoded.user && decoded.user.id && decoded.user.accountId; +} +function isDecodedWidgetAPIJWT(decoded) { + return decoded.sub && /.*:.*@.*:users/.test(decoded.sub); +} +function userIdentityFromJwt(jwt) { + if (!jwt) + return void 0; + try { + const decoded = o(jwt); + const exp = decoded.exp; + let userId = void 0; + let accountId = void 0; + let email = void 0; + if (isDecodedWidgetAPIJWT(decoded)) { + const matches = decoded.sub.match(/(.*):(.*)@(.*):users/); + if (matches == null ? void 0 : matches[1]) + accountId = atob(matches[1]); + if (matches == null ? void 0 : matches[2]) + userId = atob(matches[2]); + } else if (isDecodedSquatchJWT(decoded)) { + accountId = decoded.user.accountId; + userId = decoded.user.id; + email = decoded.user.email; + } + if (!userId || !accountId) { + debug6("No user information"); + return void 0; + } + if (exp && Date.now() >= exp * 1e3) { + debug6("JWT has expired"); + return void 0; + } + return { + id: userId, + accountId, + email, + jwt + }; + } catch (e) { + debug6("Invalid JWT"); + return void 0; + } +} +function _getInitialValue() { + const sdk = getEnvironmentSDK(); + switch (sdk.type) { + case "SquatchIOS": + case "SquatchAndroid": + case "SquatchJS2": + if (!sdk.widgetIdent) + return void 0; + const { userId, accountId, token } = sdk.widgetIdent; + if (!userId || !accountId || !token) + return void 0; + return { + id: sdk.widgetIdent.userId, + accountId: sdk.widgetIdent.accountId, + email: sdk.widgetIdent.email, + jwt: sdk.widgetIdent.token + }; + case "SquatchPortal": + const searchParams = new URLSearchParams(document.location.search); + if (searchParams.has("jwt")) { + return userIdentityFromJwt(searchParams.get("jwt")); + } + const stored = localStorage.getItem(USER_CONTEXT_NAME); + if (!stored) + return void 0; + try { + const potentialUserIdent = JSON.parse(stored); + const identity = userIdentityFromJwt(potentialUserIdent.jwt); + if (identity) { + return __spreadValues(__spreadValues({}, potentialUserIdent), identity); + } + return void 0; + } catch (e) { + return void 0; + } + case "SquatchAdmin": + case "None": + return void 0; + } +} +function setUserIdentity(identity) { + const globalProvider = lazilyStartUserContext(); + if (!equal(globalProvider.context, identity)) { + debug6(`Setting user context value [${JSON.stringify(identity)}]`); + globalProvider.context = identity; + } + { + localStorage.removeItem(USER_CONTEXT_NAME); + } +} +function getUserIdentity() { + var _a; + return (_a = window.squatchUserIdentity) == null ? void 0 : _a.context; +} +var debug7 = (...args) => debug(PROGRAM_CONTEXT_NAME, ...args); +function lazilyStartProgramContext() { + var _a; + let globalProvider = window.squatchProgramId; + if (!globalProvider) { + debug7("Creating program context provider"); + globalProvider = new c$1({ + element: document.documentElement, + initialState: ((_a = window.widgetIdent) == null ? void 0 : _a.programId) || void 0, + contextName: PROGRAM_CONTEXT_NAME + }).start(); + window.squatchProgramId = globalProvider; + } + return globalProvider; +} + +let current$1; +let currentId$1 = 0; +function notify$1() { + return currentId$1++; +} + +const hookSymbol$1 = Symbol("haunted.hook"); +const effectsSymbol$1 = Symbol("haunted.effects"); +const layoutEffectsSymbol$1 = Symbol("haunted.layoutEffects"); +const contextEvent$1 = "haunted.context"; + +Promise.resolve().then.bind(Promise.resolve()); + +let Hook$1 = class Hook { + id; + state; + constructor(id, state) { + this.id = id; + this.state = state; + } +}; +function use$1(Hook, ...args) { + let id = notify$1(); + let hooks = current$1[hookSymbol$1]; + let hook = hooks.get(id); + if (!hook) { + hook = new Hook(id, current$1, ...args); + hooks.set(id, hook); + } + return hook.update(...args); +} +function hook$1(Hook) { + return use$1.bind(null, Hook); +} + +function createEffect$1(setEffects) { + return hook$1(class extends Hook$1 { + callback; + lastValues; + values; + _teardown; + constructor(id, state, ignored1, ignored2) { + super(id, state); + setEffects(state, this); + } + update(callback, values) { + this.callback = callback; + this.values = values; + } + call() { + const hasChanged = !this.values || this.hasChanged(); + this.lastValues = this.values; + if (hasChanged) { + this.run(); + } + } + run() { + this.teardown(); + this._teardown = this.callback.call(this.state); + } + teardown() { + if (typeof this._teardown === "function") { + this._teardown(); + } + } + hasChanged() { + return (!this.lastValues || + this.values.some((value, i) => this.lastValues[i] !== value)); + } + }); +} + +function setEffects$1(state, cb) { + state[effectsSymbol$1].push(cb); +} +/** + * @function + * @param {() => void} effect - callback function that runs each time dependencies change + * @param {unknown[]} [dependencies] - list of dependencies to the effect + * @return {void} + */ +const useEffect = createEffect$1(setEffects$1); + +/** + * @function + * @template T + * @param {Context} context + * @return {T} + */ +hook$1(class extends Hook$1 { + Context; + value; + _ranEffect; + _unsubscribe; + constructor(id, state, _) { + super(id, state); + this._updater = this._updater.bind(this); + this._ranEffect = false; + this._unsubscribe = null; + setEffects$1(state, this); + } + update(Context) { + if (this.state.virtual) { + throw new Error("can't be used with virtual components"); + } + if (this.Context !== Context) { + this._subscribe(Context); + this.Context = Context; + } + return this.value; + } + call() { + if (!this._ranEffect) { + this._ranEffect = true; + if (this._unsubscribe) + this._unsubscribe(); + this._subscribe(this.Context); + this.state.update(); + } + } + _updater(value) { + this.value = value; + this.state.update(); + } + _subscribe(Context) { + const detail = { Context, callback: this._updater }; + this.state.host.dispatchEvent(new CustomEvent(contextEvent$1, { + detail, + bubbles: true, + cancelable: true, + composed: true, // to pass ShadowDOM boundaries + })); + const { unsubscribe = null, value } = detail; + this.value = unsubscribe ? value : Context.defaultValue; + this._unsubscribe = unsubscribe; + } + teardown() { + if (this._unsubscribe) { + this._unsubscribe(); + } + } +}); + +/** + * @function + * @template T + * @param {() => T} fn function to memoize + * @param {unknown[]} values dependencies to the memoized computation + * @return {T} The next computed value + */ +const useMemo = hook$1(class extends Hook$1 { + value; + values; + constructor(id, state, fn, values) { + super(id, state); + this.value = fn(); + this.values = values; + } + update(fn, values) { + if (this.hasChanged(values)) { + this.values = values; + this.value = fn(); + } + return this.value; + } + hasChanged(values = []) { + return values.some((value, i) => this.values[i] !== value); + } +}); + +/** + * @function + * @template {Function} T + * @param {T} fn - callback to memoize + * @param {unknown[]} inputs - dependencies to callback memoization + * @return {T} + */ +const useCallback = (fn, inputs) => useMemo(() => fn, inputs); + +function setLayoutEffects$1(state, cb) { + state[layoutEffectsSymbol$1].push(cb); +} +/** + * @function + * @param {Effect} callback effecting callback + * @param {unknown[]} [values] dependencies to the effect + * @return {void} + */ +createEffect$1(setLayoutEffects$1); + +/** + * @function + * @template {*} T + * @param {T} [initialState] - Optional initial state + * @return {StateTuple} stateTuple - Tuple of current state and state updater function + */ +const useState = hook$1(class extends Hook$1 { + args; + constructor(id, state, initialValue) { + super(id, state); + this.updater = this.updater.bind(this); + if (typeof initialValue === "function") { + const initFn = initialValue; + initialValue = initFn(); + } + this.makeArgs(initialValue); + } + update() { + return this.args; + } + updater(value) { + const [previousValue] = this.args; + if (typeof value === "function") { + const updaterFn = value; + value = updaterFn(previousValue); + } + if (Object.is(previousValue, value)) { + return; + } + this.makeArgs(value); + this.state.update(); + } + makeArgs(value) { + this.args = Object.freeze([value, this.updater]); + } +}); + +/** + * @license + * Portions Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +Promise.resolve(); + +/** + * Given a reducer function, initial state, and optional state initializer function, returns a tuple of state and dispatch function. + * @function + * @template S State + * @template I Initial State + * @template A Action + * @param {Reducer} reducer - reducer function to compute the next state given the previous state and the action + * @param {I} initialState - the initial state of the reducer + * @param {(init: I) => S} [init=undefined] - Optional initializer function, called on initialState if provided + * @return {readonly [S, (action: A) => void]} + */ +const useReducer = hook$1(class extends Hook$1 { + reducer; + currentState; + constructor(id, state, _, initialState, init) { + super(id, state); + this.dispatch = this.dispatch.bind(this); + this.currentState = + init !== undefined ? init(initialState) : initialState; + } + update(reducer) { + this.reducer = reducer; + return [this.currentState, this.dispatch]; + } + dispatch(action) { + this.currentState = this.reducer(this.currentState, action); + this.state.update(); + } +}); + +function useRef(initialValue) { + return useMemo(() => ({ + current: initialValue, + }), []); +} + +function c(){return (c=Object.assign||function(e){for(var t=1;t0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case "years":case "year":case "yrs":case "yr":case "y":return 315576e5*n;case "weeks":case "week":case "w":return 6048e5*n;case "days":case "day":case "d":return n*d;case "hours":case "hour":case "hrs":case "hr":case "h":return n*l;case "minutes":case "minute":case "mins":case "min":case "m":return n*C;case "seconds":case "second":case "secs":case "sec":case "s":return n*u;case "milliseconds":case "millisecond":case "msecs":case "msec":case "ms":return n;default:return}}}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=d?g(e,t,d,"day"):t>=l?g(e,t,l,"hour"):t>=C?g(e,t,C,"minute"):t>=u?g(e,t,u,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=d?Math.round(e/d)+"d":t>=l?Math.round(e/l)+"h":t>=C?Math.round(e/C)+"m":t>=u?Math.round(e/u)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function g(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}var p,m=(function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(o=r));}),t.splice(o,0,n);},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug");}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug");}catch(e){}return !e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return !("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=false;return ()=>{e||(e=true,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=function(e){function t(e){let r,o=null;function s(...e){if(!s.enabled)return;const n=s,o=Number(new Date);n.diff=o-(r||o),n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if("%%"===r)return "%";a++;const s=t.formatters[o];return "function"==typeof s&&(r=s.call(n,e[a]),e.splice(a,1),a--),r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e);}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:true,configurable:false,get:()=>null===o?t.enabled(e):o,set:e=>{o=e;}}),"function"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n{t[n]=e[n];}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t 120) { + var subLineIndex = Math.floor(columnNum / 80); + var subLineColumnNum = columnNum % 80; + var subLines = []; + + for (var i = 0; i < locationLine.length; i += 80) { + subLines.push(locationLine.slice(i, i + 80)); + } + + return locationStr + printPrefixedLines([["".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) { + return ['', subLine]; + }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]])); + } + + return locationStr + printPrefixedLines([// Lines specified like this: ["prefix", "string"], + ["".concat(lineNum - 1), lines[lineIndex - 1]], ["".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], ["".concat(lineNum + 1), lines[lineIndex + 1]]]); +} + +function printPrefixedLines(lines) { + var existingLines = lines.filter(function (_ref) { + _ref[0]; + var line = _ref[1]; + return line !== undefined; + }); + var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) { + var prefix = _ref2[0]; + return prefix.length; + })); + return existingLines.map(function (_ref3) { + var prefix = _ref3[0], + line = _ref3[1]; + return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |'); + }).join('\n'); +} + +function whitespace(len) { + return Array(len + 1).join(' '); +} + +function leftPad(len, str) { + return whitespace(len - str.length) + str; +} + +function _typeof$2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } + +function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ + +var GraphQLError = /*#__PURE__*/function (_Error) { + _inherits(GraphQLError, _Error); + + var _super = _createSuper(GraphQLError); + + /** + * An array of { line, column } locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + + /** + * The original error thrown from a field resolver during execution. + */ + + /** + * Extension fields to add to the formatted error. + */ + function GraphQLError(message, nodes, source, positions, path, originalError, extensions) { + var _nodeLocations, _nodeLocations2, _nodeLocations3; + + var _this; + + _classCallCheck(this, GraphQLError); + + _this = _super.call(this, message); + _this.name = 'GraphQLError'; + _this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; // Compute list of blame nodes. + + _this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined); + var nodeLocations = []; + + for (var _i2 = 0, _ref3 = (_this$nodes = _this.nodes) !== null && _this$nodes !== void 0 ? _this$nodes : []; _i2 < _ref3.length; _i2++) { + var _this$nodes; + + var _ref4 = _ref3[_i2]; + var loc = _ref4.loc; + + if (loc != null) { + nodeLocations.push(loc); + } + } + + nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions. + + _this.source = source !== null && source !== void 0 ? source : (_nodeLocations = nodeLocations) === null || _nodeLocations === void 0 ? void 0 : _nodeLocations[0].source; + _this.positions = positions !== null && positions !== void 0 ? positions : (_nodeLocations2 = nodeLocations) === null || _nodeLocations2 === void 0 ? void 0 : _nodeLocations2.map(function (loc) { + return loc.start; + }); + _this.locations = positions && source ? positions.map(function (pos) { + return getLocation(source, pos); + }) : (_nodeLocations3 = nodeLocations) === null || _nodeLocations3 === void 0 ? void 0 : _nodeLocations3.map(function (loc) { + return getLocation(loc.source, loc.start); + }); + _this.path = path !== null && path !== void 0 ? path : undefined; + var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions; + + if (extensions == null && isObjectLike(originalExtensions)) { + _this.extensions = _objectSpread({}, originalExtensions); + } else { + _this.extensions = extensions !== null && extensions !== void 0 ? extensions : {}; + } // By being enumerable, JSON.stringify will include bellow properties in the resulting output. + // This ensures that the simplest possible GraphQL service adheres to the spec. + + + Object.defineProperties(_assertThisInitialized(_this), { + message: { + enumerable: true + }, + locations: { + enumerable: _this.locations != null + }, + path: { + enumerable: _this.path != null + }, + extensions: { + enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0 + }, + name: { + enumerable: false + }, + nodes: { + enumerable: false + }, + source: { + enumerable: false + }, + positions: { + enumerable: false + }, + originalError: { + enumerable: false + } + }); // Include (non-enumerable) stack trace. + + if (originalError !== null && originalError !== void 0 && originalError.stack) { + Object.defineProperty(_assertThisInitialized(_this), 'stack', { + value: originalError.stack, + writable: true, + configurable: true + }); + return _possibleConstructorReturn(_this); + } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') + + + if (Error.captureStackTrace) { + Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError); + } else { + Object.defineProperty(_assertThisInitialized(_this), 'stack', { + value: Error().stack, + writable: true, + configurable: true + }); + } + + return _this; + } + + _createClass$1(GraphQLError, [{ + key: "toString", + value: function toString() { + return printError(this); + } + }, { + key: "toJSON", + value: function toJSON() { + return formatError(this); + } // FIXME: workaround to not break chai comparisons, should be remove in v16 + // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + + }, { + key: SYMBOL_TO_STRING_TAG, + get: function get() { + return 'Object'; + } + }]); + + return GraphQLError; +}( /*#__PURE__*/_wrapNativeSuper(Error)); + +function undefinedIfEmpty(array) { + return array === undefined || array.length === 0 ? undefined : array; +} +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + */ + + +function printError(error) { + var output = error.message; + + if (error.nodes) { + for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) { + var node = _error$nodes2[_i4]; + + if (node.loc) { + output += '\n\n' + printLocation(node.loc); + } + } + } else if (error.source && error.locations) { + for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) { + var location = _error$locations2[_i6]; + output += '\n\n' + printSourceLocation(error.source, location); + } + } + + return output; +} +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + */ + +function formatError(error) { + var _error$message; + + error || devAssert(0, 'Received null or undefined error.'); + var message = (_error$message = error.message) !== null && _error$message !== void 0 ? _error$message : 'An unknown error occurred.'; + var locations = error.locations; + var path = error.path; + var extensions = error.extensions; + return extensions && Object.keys(extensions).length > 0 ? { + message: message, + locations: locations, + path: path, + extensions: extensions + } : { + message: message, + locations: locations, + path: path + }; +} +/** + * @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors + */ + +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ + +function syntaxError(source, position, description) { + return new GraphQLError("Syntax Error: ".concat(description), undefined, source, [position]); +} + +/** + * The set of allowed kind values for AST nodes. + */ +var Kind = Object.freeze({ + // Name + NAME: 'Name', + // Document + DOCUMENT: 'Document', + OPERATION_DEFINITION: 'OperationDefinition', + VARIABLE_DEFINITION: 'VariableDefinition', + SELECTION_SET: 'SelectionSet', + FIELD: 'Field', + ARGUMENT: 'Argument', + // Fragments + FRAGMENT_SPREAD: 'FragmentSpread', + INLINE_FRAGMENT: 'InlineFragment', + FRAGMENT_DEFINITION: 'FragmentDefinition', + // Values + VARIABLE: 'Variable', + INT: 'IntValue', + FLOAT: 'FloatValue', + STRING: 'StringValue', + BOOLEAN: 'BooleanValue', + NULL: 'NullValue', + ENUM: 'EnumValue', + LIST: 'ListValue', + OBJECT: 'ObjectValue', + OBJECT_FIELD: 'ObjectField', + // Directives + DIRECTIVE: 'Directive', + // Types + NAMED_TYPE: 'NamedType', + LIST_TYPE: 'ListType', + NON_NULL_TYPE: 'NonNullType', + // Type System Definitions + SCHEMA_DEFINITION: 'SchemaDefinition', + OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', + // Type Definitions + SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', + OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', + FIELD_DEFINITION: 'FieldDefinition', + INPUT_VALUE_DEFINITION: 'InputValueDefinition', + INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', + UNION_TYPE_DEFINITION: 'UnionTypeDefinition', + ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', + ENUM_VALUE_DEFINITION: 'EnumValueDefinition', + INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', + // Directive Definitions + DIRECTIVE_DEFINITION: 'DirectiveDefinition', + // Type System Extensions + SCHEMA_EXTENSION: 'SchemaExtension', + // Type Extensions + SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', + OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', + INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', + UNION_TYPE_EXTENSION: 'UnionTypeExtension', + ENUM_TYPE_EXTENSION: 'EnumTypeExtension', + INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension' +}); +/** + * The enum type representing the possible kind values of AST nodes. + */ + +function invariant(condition, message) { + var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js') + + if (!booleanCondition) { + throw new Error('Unexpected invariant triggered.'); + } +} + +// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') +var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; + +/** + * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON` + */ + +function defineInspect(classObject) { + var fn = classObject.prototype.toJSON; + typeof fn === 'function' || invariant(0); + classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317') + + if (nodejsCustomInspectSymbol) { + classObject.prototype[nodejsCustomInspectSymbol] = fn; + } +} + +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +var Location = /*#__PURE__*/function () { + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The Token at which this Node begins. + */ + + /** + * The Token at which this Node ends. + */ + + /** + * The Source document the AST represents. + */ + function Location(startToken, endToken, source) { + this.start = startToken.start; + this.end = endToken.end; + this.startToken = startToken; + this.endToken = endToken; + this.source = source; + } + + var _proto = Location.prototype; + + _proto.toJSON = function toJSON() { + return { + start: this.start, + end: this.end + }; + }; + + return Location; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + +defineInspect(Location); +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ + +var Token = /*#__PURE__*/function () { + /** + * The kind of Token. + */ + + /** + * The character offset at which this Node begins. + */ + + /** + * The character offset at which this Node ends. + */ + + /** + * The 1-indexed line number on which this Token appears. + */ + + /** + * The 1-indexed column number at which this Token begins. + */ + + /** + * For non-punctuation tokens, represents the interpreted value of the token. + */ + + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + function Token(kind, start, end, line, column, prev, value) { + this.kind = kind; + this.start = start; + this.end = end; + this.line = line; + this.column = column; + this.value = value; + this.prev = prev; + this.next = null; + } + + var _proto2 = Token.prototype; + + _proto2.toJSON = function toJSON() { + return { + kind: this.kind, + value: this.value, + line: this.line, + column: this.column + }; + }; + + return Token; +}(); // Print a simplified form when appearing in `inspect` and `util.inspect`. + +defineInspect(Token); +/** + * @internal + */ + +function isNode(maybeNode) { + return maybeNode != null && typeof maybeNode.kind === 'string'; +} +/** + * The list of all possible AST node types. + */ + +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +var TokenKind = Object.freeze({ + SOF: '', + EOF: '', + BANG: '!', + DOLLAR: '$', + AMP: '&', + PAREN_L: '(', + PAREN_R: ')', + SPREAD: '...', + COLON: ':', + EQUALS: '=', + AT: '@', + BRACKET_L: '[', + BRACKET_R: ']', + BRACE_L: '{', + PIPE: '|', + BRACE_R: '}', + NAME: 'Name', + INT: 'Int', + FLOAT: 'Float', + STRING: 'String', + BLOCK_STRING: 'BlockString', + COMMENT: 'Comment' +}); +/** + * The enum type representing the token kinds values. + */ + +function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); } +var MAX_ARRAY_LENGTH = 10; +var MAX_RECURSIVE_DEPTH = 2; +/** + * Used to print values in error messages. + */ + +function inspect(value) { + return formatValue(value, []); +} + +function formatValue(value, seenValues) { + switch (_typeof$1(value)) { + case 'string': + return JSON.stringify(value); + + case 'function': + return value.name ? "[function ".concat(value.name, "]") : '[function]'; + + case 'object': + if (value === null) { + return 'null'; + } + + return formatObjectValue(value, seenValues); + + default: + return String(value); + } +} + +function formatObjectValue(value, previouslySeenValues) { + if (previouslySeenValues.indexOf(value) !== -1) { + return '[Circular]'; + } + + var seenValues = [].concat(previouslySeenValues, [value]); + var customInspectFn = getCustomFn(value); + + if (customInspectFn !== undefined) { + var customValue = customInspectFn.call(value); // check for infinite recursion + + if (customValue !== value) { + return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); + } + } else if (Array.isArray(value)) { + return formatArray(value, seenValues); + } + + return formatObject(value, seenValues); +} + +function formatObject(object, seenValues) { + var keys = Object.keys(object); + + if (keys.length === 0) { + return '{}'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[' + getObjectTag(object) + ']'; + } + + var properties = keys.map(function (key) { + var value = formatValue(object[key], seenValues); + return key + ': ' + value; + }); + return '{ ' + properties.join(', ') + ' }'; +} + +function formatArray(array, seenValues) { + if (array.length === 0) { + return '[]'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[Array]'; + } + + var len = Math.min(MAX_ARRAY_LENGTH, array.length); + var remaining = array.length - len; + var items = []; + + for (var i = 0; i < len; ++i) { + items.push(formatValue(array[i], seenValues)); + } + + if (remaining === 1) { + items.push('... 1 more item'); + } else if (remaining > 1) { + items.push("... ".concat(remaining, " more items")); + } + + return '[' + items.join(', ') + ']'; +} + +function getCustomFn(object) { + var customInspectFn = object[String(nodejsCustomInspectSymbol)]; + + if (typeof customInspectFn === 'function') { + return customInspectFn; + } + + if (typeof object.inspect === 'function') { + return object.inspect; + } +} + +function getObjectTag(object) { + var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); + + if (tag === 'Object' && typeof object.constructor === 'function') { + var name = object.constructor.name; + + if (typeof name === 'string' && name !== '') { + return name; + } + } + + return tag; +} + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + */ + +// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production +// See: https://webpack.js.org/guides/production/ +var instanceOf = process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') +// eslint-disable-next-line no-shadow +function instanceOf(value, constructor) { + return value instanceof constructor; +} : // eslint-disable-next-line no-shadow +function instanceOf(value, constructor) { + if (value instanceof constructor) { + return true; + } + + if (_typeof(value) === 'object' && value !== null) { + var _value$constructor; + + var className = constructor.prototype[Symbol.toStringTag]; + var valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library. + Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name; + + if (className === valueClassName) { + var stringifiedValue = inspect(value); + throw new Error("Cannot use ".concat(className, " \"").concat(stringifiedValue, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.")); + } + } + + return false; +}; + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; } + +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +var Source = /*#__PURE__*/function () { + function Source(body) { + var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GraphQL request'; + var locationOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { + line: 1, + column: 1 + }; + typeof body === 'string' || devAssert(0, "Body must be a string. Received: ".concat(inspect(body), ".")); + this.body = body; + this.name = name; + this.locationOffset = locationOffset; + this.locationOffset.line > 0 || devAssert(0, 'line in locationOffset is 1-indexed and must be positive.'); + this.locationOffset.column > 0 || devAssert(0, 'column in locationOffset is 1-indexed and must be positive.'); + } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet + + + _createClass(Source, [{ + key: SYMBOL_TO_STRING_TAG, + get: function get() { + return 'Source'; + } + }]); + + return Source; +}(); +/** + * Test if the given value is a Source object. + * + * @internal + */ + +// eslint-disable-next-line no-redeclare +function isSource(source) { + return instanceOf(source, Source); +} + +/** + * The set of allowed directive location values. + */ +var DirectiveLocation = Object.freeze({ + // Request Definitions + QUERY: 'QUERY', + MUTATION: 'MUTATION', + SUBSCRIPTION: 'SUBSCRIPTION', + FIELD: 'FIELD', + FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION', + FRAGMENT_SPREAD: 'FRAGMENT_SPREAD', + INLINE_FRAGMENT: 'INLINE_FRAGMENT', + VARIABLE_DEFINITION: 'VARIABLE_DEFINITION', + // Type System Definitions + SCHEMA: 'SCHEMA', + SCALAR: 'SCALAR', + OBJECT: 'OBJECT', + FIELD_DEFINITION: 'FIELD_DEFINITION', + ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION', + INTERFACE: 'INTERFACE', + UNION: 'UNION', + ENUM: 'ENUM', + ENUM_VALUE: 'ENUM_VALUE', + INPUT_OBJECT: 'INPUT_OBJECT', + INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION' +}); +/** + * The enum type representing the directive location values. + */ + +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ +function dedentBlockStringValue(rawString) { + // Expand a block string's raw value into independent lines. + var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. + + var commonIndent = getBlockStringIndentation(rawString); + + if (commonIndent !== 0) { + for (var i = 1; i < lines.length; i++) { + lines[i] = lines[i].slice(commonIndent); + } + } // Remove leading and trailing blank lines. + + + var startLine = 0; + + while (startLine < lines.length && isBlank(lines[startLine])) { + ++startLine; + } + + var endLine = lines.length; + + while (endLine > startLine && isBlank(lines[endLine - 1])) { + --endLine; + } // Return a string of the lines joined with U+000A. + + + return lines.slice(startLine, endLine).join('\n'); +} + +function isBlank(str) { + for (var i = 0; i < str.length; ++i) { + if (str[i] !== ' ' && str[i] !== '\t') { + return false; + } + } + + return true; +} +/** + * @internal + */ + + +function getBlockStringIndentation(value) { + var _commonIndent; + + var isFirstLine = true; + var isEmptyLine = true; + var indent = 0; + var commonIndent = null; + + for (var i = 0; i < value.length; ++i) { + switch (value.charCodeAt(i)) { + case 13: + // \r + if (value.charCodeAt(i + 1) === 10) { + ++i; // skip \r\n as one symbol + } + + // falls through + + case 10: + // \n + isFirstLine = false; + isEmptyLine = true; + indent = 0; + break; + + case 9: // \t + + case 32: + // + ++indent; + break; + + default: + if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) { + commonIndent = indent; + } + + isEmptyLine = false; + } + } + + return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0; +} +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ + +function printBlockString(value) { + var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var isSingleLine = value.indexOf('\n') === -1; + var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; + var hasTrailingQuote = value[value.length - 1] === '"'; + var hasTrailingSlash = value[value.length - 1] === '\\'; + var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines; + var result = ''; // Format a multi-line block quote to account for leading space. + + if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { + result += '\n' + indentation; + } + + result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; + + if (printAsMultipleLines) { + result += '\n'; + } + + return '"""' + result.replace(/"""/g, '\\"""') + '"""'; +} + +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ + +var Lexer = /*#__PURE__*/function () { + /** + * The previously focused non-ignored token. + */ + + /** + * The currently focused non-ignored token. + */ + + /** + * The (1-indexed) line containing the current token. + */ + + /** + * The character offset at which the current line begins. + */ + function Lexer(source) { + var startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0, null); + this.source = source; + this.lastToken = startOfFileToken; + this.token = startOfFileToken; + this.line = 1; + this.lineStart = 0; + } + /** + * Advances the token stream to the next non-ignored token. + */ + + + var _proto = Lexer.prototype; + + _proto.advance = function advance() { + this.lastToken = this.token; + var token = this.token = this.lookahead(); + return token; + } + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + ; + + _proto.lookahead = function lookahead() { + var token = this.token; + + if (token.kind !== TokenKind.EOF) { + do { + var _token$next; + + // Note: next is only mutable during parsing, so we cast to allow this. + token = (_token$next = token.next) !== null && _token$next !== void 0 ? _token$next : token.next = readToken(this, token); + } while (token.kind === TokenKind.COMMENT); + } + + return token; + }; + + return Lexer; +}(); +/** + * @internal + */ + +function isPunctuatorTokenKind(kind) { + return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R; +} + +function printCharCode(code) { + return (// NaN/undefined represents access beyond the end of the file. + isNaN(code) ? TokenKind.EOF : // Trust JSON for ASCII. + code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form. + "\"\\u".concat(('00' + code.toString(16).toUpperCase()).slice(-4), "\"") + ); +} +/** + * Gets the next token from the source starting at the given position. + * + * This skips over whitespace until it finds the next lexable token, then lexes + * punctuators immediately or calls the appropriate helper function for more + * complicated tokens. + */ + + +function readToken(lexer, prev) { + var source = lexer.source; + var body = source.body; + var bodyLength = body.length; + var pos = prev.end; + + while (pos < bodyLength) { + var code = body.charCodeAt(pos); + var _line = lexer.line; + + var _col = 1 + pos - lexer.lineStart; // SourceCharacter + + + switch (code) { + case 0xfeff: // + + case 9: // \t + + case 32: // + + case 44: + // , + ++pos; + continue; + + case 10: + // \n + ++pos; + ++lexer.line; + lexer.lineStart = pos; + continue; + + case 13: + // \r + if (body.charCodeAt(pos + 1) === 10) { + pos += 2; + } else { + ++pos; + } + + ++lexer.line; + lexer.lineStart = pos; + continue; + + case 33: + // ! + return new Token(TokenKind.BANG, pos, pos + 1, _line, _col, prev); + + case 35: + // # + return readComment(source, pos, _line, _col, prev); + + case 36: + // $ + return new Token(TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev); + + case 38: + // & + return new Token(TokenKind.AMP, pos, pos + 1, _line, _col, prev); + + case 40: + // ( + return new Token(TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev); + + case 41: + // ) + return new Token(TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev); + + case 46: + // . + if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) { + return new Token(TokenKind.SPREAD, pos, pos + 3, _line, _col, prev); + } + + break; + + case 58: + // : + return new Token(TokenKind.COLON, pos, pos + 1, _line, _col, prev); + + case 61: + // = + return new Token(TokenKind.EQUALS, pos, pos + 1, _line, _col, prev); + + case 64: + // @ + return new Token(TokenKind.AT, pos, pos + 1, _line, _col, prev); + + case 91: + // [ + return new Token(TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev); + + case 93: + // ] + return new Token(TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev); + + case 123: + // { + return new Token(TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev); + + case 124: + // | + return new Token(TokenKind.PIPE, pos, pos + 1, _line, _col, prev); + + case 125: + // } + return new Token(TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev); + + case 34: + // " + if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) { + return readBlockString(source, pos, _line, _col, prev, lexer); + } + + return readString(source, pos, _line, _col, prev); + + case 45: // - + + case 48: // 0 + + case 49: // 1 + + case 50: // 2 + + case 51: // 3 + + case 52: // 4 + + case 53: // 5 + + case 54: // 6 + + case 55: // 7 + + case 56: // 8 + + case 57: + // 9 + return readNumber(source, pos, code, _line, _col, prev); + + case 65: // A + + case 66: // B + + case 67: // C + + case 68: // D + + case 69: // E + + case 70: // F + + case 71: // G + + case 72: // H + + case 73: // I + + case 74: // J + + case 75: // K + + case 76: // L + + case 77: // M + + case 78: // N + + case 79: // O + + case 80: // P + + case 81: // Q + + case 82: // R + + case 83: // S + + case 84: // T + + case 85: // U + + case 86: // V + + case 87: // W + + case 88: // X + + case 89: // Y + + case 90: // Z + + case 95: // _ + + case 97: // a + + case 98: // b + + case 99: // c + + case 100: // d + + case 101: // e + + case 102: // f + + case 103: // g + + case 104: // h + + case 105: // i + + case 106: // j + + case 107: // k + + case 108: // l + + case 109: // m + + case 110: // n + + case 111: // o + + case 112: // p + + case 113: // q + + case 114: // r + + case 115: // s + + case 116: // t + + case 117: // u + + case 118: // v + + case 119: // w + + case 120: // x + + case 121: // y + + case 122: + // z + return readName(source, pos, _line, _col, prev); + } + + throw syntaxError(source, pos, unexpectedCharacterMessage(code)); + } + + var line = lexer.line; + var col = 1 + pos - lexer.lineStart; + return new Token(TokenKind.EOF, bodyLength, bodyLength, line, col, prev); +} +/** + * Report a message that an unexpected character was encountered. + */ + + +function unexpectedCharacterMessage(code) { + if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { + return "Cannot contain the invalid character ".concat(printCharCode(code), "."); + } + + if (code === 39) { + // ' + return 'Unexpected single quote character (\'), did you mean to use a double quote (")?'; + } + + return "Cannot parse the unexpected character ".concat(printCharCode(code), "."); +} +/** + * Reads a comment token from the source file. + * + * #[\u0009\u0020-\uFFFF]* + */ + + +function readComment(source, start, line, col, prev) { + var body = source.body; + var code; + var position = start; + + do { + code = body.charCodeAt(++position); + } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator + code > 0x001f || code === 0x0009)); + + return new Token(TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position)); +} +/** + * Reads a number token from the source file, either a float + * or an int depending on whether a decimal point appears. + * + * Int: -?(0|[1-9][0-9]*) + * Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)? + */ + + +function readNumber(source, start, firstCode, line, col, prev) { + var body = source.body; + var code = firstCode; + var position = start; + var isFloat = false; + + if (code === 45) { + // - + code = body.charCodeAt(++position); + } + + if (code === 48) { + // 0 + code = body.charCodeAt(++position); + + if (code >= 48 && code <= 57) { + throw syntaxError(source, position, "Invalid number, unexpected digit after 0: ".concat(printCharCode(code), ".")); + } + } else { + position = readDigits(source, position, code); + code = body.charCodeAt(position); + } + + if (code === 46) { + // . + isFloat = true; + code = body.charCodeAt(++position); + position = readDigits(source, position, code); + code = body.charCodeAt(position); + } + + if (code === 69 || code === 101) { + // E e + isFloat = true; + code = body.charCodeAt(++position); + + if (code === 43 || code === 45) { + // + - + code = body.charCodeAt(++position); + } + + position = readDigits(source, position, code); + code = body.charCodeAt(position); + } // Numbers cannot be followed by . or NameStart + + + if (code === 46 || isNameStart(code)) { + throw syntaxError(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); + } + + return new Token(isFloat ? TokenKind.FLOAT : TokenKind.INT, start, position, line, col, prev, body.slice(start, position)); +} +/** + * Returns the new position in the source after reading digits. + */ + + +function readDigits(source, start, firstCode) { + var body = source.body; + var position = start; + var code = firstCode; + + if (code >= 48 && code <= 57) { + // 0 - 9 + do { + code = body.charCodeAt(++position); + } while (code >= 48 && code <= 57); // 0 - 9 + + + return position; + } + + throw syntaxError(source, position, "Invalid number, expected digit but got: ".concat(printCharCode(code), ".")); +} +/** + * Reads a string token from the source file. + * + * "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*" + */ + + +function readString(source, start, line, col, prev) { + var body = source.body; + var position = start + 1; + var chunkStart = position; + var code = 0; + var value = ''; + + while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator + code !== 0x000a && code !== 0x000d) { + // Closing Quote (") + if (code === 34) { + value += body.slice(chunkStart, position); + return new Token(TokenKind.STRING, start, position + 1, line, col, prev, value); + } // SourceCharacter + + + if (code < 0x0020 && code !== 0x0009) { + throw syntaxError(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); + } + + ++position; + + if (code === 92) { + // \ + value += body.slice(chunkStart, position - 1); + code = body.charCodeAt(position); + + switch (code) { + case 34: + value += '"'; + break; + + case 47: + value += '/'; + break; + + case 92: + value += '\\'; + break; + + case 98: + value += '\b'; + break; + + case 102: + value += '\f'; + break; + + case 110: + value += '\n'; + break; + + case 114: + value += '\r'; + break; + + case 116: + value += '\t'; + break; + + case 117: + { + // uXXXX + var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4)); + + if (charCode < 0) { + var invalidSequence = body.slice(position + 1, position + 5); + throw syntaxError(source, position, "Invalid character escape sequence: \\u".concat(invalidSequence, ".")); + } + + value += String.fromCharCode(charCode); + position += 4; + break; + } + + default: + throw syntaxError(source, position, "Invalid character escape sequence: \\".concat(String.fromCharCode(code), ".")); + } + + ++position; + chunkStart = position; + } + } + + throw syntaxError(source, position, 'Unterminated string.'); +} +/** + * Reads a block string token from the source file. + * + * """("?"?(\\"""|\\(?!=""")|[^"\\]))*""" + */ + + +function readBlockString(source, start, line, col, prev, lexer) { + var body = source.body; + var position = start + 3; + var chunkStart = position; + var code = 0; + var rawValue = ''; + + while (position < body.length && !isNaN(code = body.charCodeAt(position))) { + // Closing Triple-Quote (""") + if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) { + rawValue += body.slice(chunkStart, position); + return new Token(TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, dedentBlockStringValue(rawValue)); + } // SourceCharacter + + + if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) { + throw syntaxError(source, position, "Invalid character within String: ".concat(printCharCode(code), ".")); + } + + if (code === 10) { + // new line + ++position; + ++lexer.line; + lexer.lineStart = position; + } else if (code === 13) { + // carriage return + if (body.charCodeAt(position + 1) === 10) { + position += 2; + } else { + ++position; + } + + ++lexer.line; + lexer.lineStart = position; + } else if ( // Escape Triple-Quote (\""") + code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) { + rawValue += body.slice(chunkStart, position) + '"""'; + position += 4; + chunkStart = position; + } else { + ++position; + } + } + + throw syntaxError(source, position, 'Unterminated string.'); +} +/** + * Converts four hexadecimal chars to the integer that the + * string represents. For example, uniCharCode('0','0','0','f') + * will return 15, and uniCharCode('0','0','f','f') returns 255. + * + * Returns a negative number on error, if a char was invalid. + * + * This is implemented by noting that char2hex() returns -1 on error, + * which means the result of ORing the char2hex() will also be negative. + */ + + +function uniCharCode(a, b, c, d) { + return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d); +} +/** + * Converts a hex character to its integer value. + * '0' becomes 0, '9' becomes 9 + * 'A' becomes 10, 'F' becomes 15 + * 'a' becomes 10, 'f' becomes 15 + * + * Returns -1 on error. + */ + + +function char2hex(a) { + return a >= 48 && a <= 57 ? a - 48 // 0-9 + : a >= 65 && a <= 70 ? a - 55 // A-F + : a >= 97 && a <= 102 ? a - 87 // a-f + : -1; +} +/** + * Reads an alphanumeric + underscore name from the source. + * + * [_A-Za-z][_0-9A-Za-z]* + */ + + +function readName(source, start, line, col, prev) { + var body = source.body; + var bodyLength = body.length; + var position = start + 1; + var code = 0; + + while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _ + code >= 48 && code <= 57 || // 0-9 + code >= 65 && code <= 90 || // A-Z + code >= 97 && code <= 122) // a-z + ) { + ++position; + } + + return new Token(TokenKind.NAME, start, position, line, col, prev, body.slice(start, position)); +} // _ A-Z a-z + + +function isNameStart(code) { + return code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122; +} + +/** + * Configuration options to control parser behavior + */ + +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +function parse(source, options) { + var parser = new Parser(source, options); + return parser.parseDocument(); +} +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ + +var Parser = /*#__PURE__*/function () { + function Parser(source, options) { + var sourceObj = isSource(source) ? source : new Source(source); + this._lexer = new Lexer(sourceObj); + this._options = options; + } + /** + * Converts a name lex token into a name parse node. + */ + + + var _proto = Parser.prototype; + + _proto.parseName = function parseName() { + var token = this.expectToken(TokenKind.NAME); + return { + kind: Kind.NAME, + value: token.value, + loc: this.loc(token) + }; + } // Implements the parsing rules in the Document section. + + /** + * Document : Definition+ + */ + ; + + _proto.parseDocument = function parseDocument() { + var start = this._lexer.token; + return { + kind: Kind.DOCUMENT, + definitions: this.many(TokenKind.SOF, this.parseDefinition, TokenKind.EOF), + loc: this.loc(start) + }; + } + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + */ + ; + + _proto.parseDefinition = function parseDefinition() { + if (this.peek(TokenKind.NAME)) { + switch (this._lexer.token.value) { + case 'query': + case 'mutation': + case 'subscription': + return this.parseOperationDefinition(); + + case 'fragment': + return this.parseFragmentDefinition(); + + case 'schema': + case 'scalar': + case 'type': + case 'interface': + case 'union': + case 'enum': + case 'input': + case 'directive': + return this.parseTypeSystemDefinition(); + + case 'extend': + return this.parseTypeSystemExtension(); + } + } else if (this.peek(TokenKind.BRACE_L)) { + return this.parseOperationDefinition(); + } else if (this.peekDescription()) { + return this.parseTypeSystemDefinition(); + } + + throw this.unexpected(); + } // Implements the parsing rules in the Operations section. + + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + ; + + _proto.parseOperationDefinition = function parseOperationDefinition() { + var start = this._lexer.token; + + if (this.peek(TokenKind.BRACE_L)) { + return { + kind: Kind.OPERATION_DEFINITION, + operation: 'query', + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + + var operation = this.parseOperationType(); + var name; + + if (this.peek(TokenKind.NAME)) { + name = this.parseName(); + } + + return { + kind: Kind.OPERATION_DEFINITION, + operation: operation, + name: name, + variableDefinitions: this.parseVariableDefinitions(), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + /** + * OperationType : one of query mutation subscription + */ + ; + + _proto.parseOperationType = function parseOperationType() { + var operationToken = this.expectToken(TokenKind.NAME); + + switch (operationToken.value) { + case 'query': + return 'query'; + + case 'mutation': + return 'mutation'; + + case 'subscription': + return 'subscription'; + } + + throw this.unexpected(operationToken); + } + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + ; + + _proto.parseVariableDefinitions = function parseVariableDefinitions() { + return this.optionalMany(TokenKind.PAREN_L, this.parseVariableDefinition, TokenKind.PAREN_R); + } + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + ; + + _proto.parseVariableDefinition = function parseVariableDefinition() { + var start = this._lexer.token; + return { + kind: Kind.VARIABLE_DEFINITION, + variable: this.parseVariable(), + type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), + defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseValueLiteral(true) : undefined, + directives: this.parseDirectives(true), + loc: this.loc(start) + }; + } + /** + * Variable : $ Name + */ + ; + + _proto.parseVariable = function parseVariable() { + var start = this._lexer.token; + this.expectToken(TokenKind.DOLLAR); + return { + kind: Kind.VARIABLE, + name: this.parseName(), + loc: this.loc(start) + }; + } + /** + * SelectionSet : { Selection+ } + */ + ; + + _proto.parseSelectionSet = function parseSelectionSet() { + var start = this._lexer.token; + return { + kind: Kind.SELECTION_SET, + selections: this.many(TokenKind.BRACE_L, this.parseSelection, TokenKind.BRACE_R), + loc: this.loc(start) + }; + } + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + ; + + _proto.parseSelection = function parseSelection() { + return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField(); + } + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + ; + + _proto.parseField = function parseField() { + var start = this._lexer.token; + var nameOrAlias = this.parseName(); + var alias; + var name; + + if (this.expectOptionalToken(TokenKind.COLON)) { + alias = nameOrAlias; + name = this.parseName(); + } else { + name = nameOrAlias; + } + + return { + kind: Kind.FIELD, + alias: alias, + name: name, + arguments: this.parseArguments(false), + directives: this.parseDirectives(false), + selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined, + loc: this.loc(start) + }; + } + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + ; + + _proto.parseArguments = function parseArguments(isConst) { + var item = isConst ? this.parseConstArgument : this.parseArgument; + return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R); + } + /** + * Argument[Const] : Name : Value[?Const] + */ + ; + + _proto.parseArgument = function parseArgument() { + var start = this._lexer.token; + var name = this.parseName(); + this.expectToken(TokenKind.COLON); + return { + kind: Kind.ARGUMENT, + name: name, + value: this.parseValueLiteral(false), + loc: this.loc(start) + }; + }; + + _proto.parseConstArgument = function parseConstArgument() { + var start = this._lexer.token; + return { + kind: Kind.ARGUMENT, + name: this.parseName(), + value: (this.expectToken(TokenKind.COLON), this.parseValueLiteral(true)), + loc: this.loc(start) + }; + } // Implements the parsing rules in the Fragments section. + + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + ; + + _proto.parseFragment = function parseFragment() { + var start = this._lexer.token; + this.expectToken(TokenKind.SPREAD); + var hasTypeCondition = this.expectOptionalKeyword('on'); + + if (!hasTypeCondition && this.peek(TokenKind.NAME)) { + return { + kind: Kind.FRAGMENT_SPREAD, + name: this.parseFragmentName(), + directives: this.parseDirectives(false), + loc: this.loc(start) + }; + } + + return { + kind: Kind.INLINE_FRAGMENT, + typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + ; + + _proto.parseFragmentDefinition = function parseFragmentDefinition() { + var _this$_options; + + var start = this._lexer.token; + this.expectKeyword('fragment'); // Experimental support for defining variables within fragments changes + // the grammar of FragmentDefinition: + // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet + + if (((_this$_options = this._options) === null || _this$_options === void 0 ? void 0 : _this$_options.experimentalFragmentVariables) === true) { + return { + kind: Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + variableDefinitions: this.parseVariableDefinitions(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + + return { + kind: Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + loc: this.loc(start) + }; + } + /** + * FragmentName : Name but not `on` + */ + ; + + _proto.parseFragmentName = function parseFragmentName() { + if (this._lexer.token.value === 'on') { + throw this.unexpected(); + } + + return this.parseName(); + } // Implements the parsing rules in the Values section. + + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + ; + + _proto.parseValueLiteral = function parseValueLiteral(isConst) { + var token = this._lexer.token; + + switch (token.kind) { + case TokenKind.BRACKET_L: + return this.parseList(isConst); + + case TokenKind.BRACE_L: + return this.parseObject(isConst); + + case TokenKind.INT: + this._lexer.advance(); + + return { + kind: Kind.INT, + value: token.value, + loc: this.loc(token) + }; + + case TokenKind.FLOAT: + this._lexer.advance(); + + return { + kind: Kind.FLOAT, + value: token.value, + loc: this.loc(token) + }; + + case TokenKind.STRING: + case TokenKind.BLOCK_STRING: + return this.parseStringLiteral(); + + case TokenKind.NAME: + this._lexer.advance(); + + switch (token.value) { + case 'true': + return { + kind: Kind.BOOLEAN, + value: true, + loc: this.loc(token) + }; + + case 'false': + return { + kind: Kind.BOOLEAN, + value: false, + loc: this.loc(token) + }; + + case 'null': + return { + kind: Kind.NULL, + loc: this.loc(token) + }; + + default: + return { + kind: Kind.ENUM, + value: token.value, + loc: this.loc(token) + }; + } + + case TokenKind.DOLLAR: + if (!isConst) { + return this.parseVariable(); + } + + break; + } + + throw this.unexpected(); + }; + + _proto.parseStringLiteral = function parseStringLiteral() { + var token = this._lexer.token; + + this._lexer.advance(); + + return { + kind: Kind.STRING, + value: token.value, + block: token.kind === TokenKind.BLOCK_STRING, + loc: this.loc(token) + }; + } + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + ; + + _proto.parseList = function parseList(isConst) { + var _this = this; + + var start = this._lexer.token; + + var item = function item() { + return _this.parseValueLiteral(isConst); + }; + + return { + kind: Kind.LIST, + values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R), + loc: this.loc(start) + }; + } + /** + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + */ + ; + + _proto.parseObject = function parseObject(isConst) { + var _this2 = this; + + var start = this._lexer.token; + + var item = function item() { + return _this2.parseObjectField(isConst); + }; + + return { + kind: Kind.OBJECT, + fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R), + loc: this.loc(start) + }; + } + /** + * ObjectField[Const] : Name : Value[?Const] + */ + ; + + _proto.parseObjectField = function parseObjectField(isConst) { + var start = this._lexer.token; + var name = this.parseName(); + this.expectToken(TokenKind.COLON); + return { + kind: Kind.OBJECT_FIELD, + name: name, + value: this.parseValueLiteral(isConst), + loc: this.loc(start) + }; + } // Implements the parsing rules in the Directives section. + + /** + * Directives[Const] : Directive[?Const]+ + */ + ; + + _proto.parseDirectives = function parseDirectives(isConst) { + var directives = []; + + while (this.peek(TokenKind.AT)) { + directives.push(this.parseDirective(isConst)); + } + + return directives; + } + /** + * Directive[Const] : @ Name Arguments[?Const]? + */ + ; + + _proto.parseDirective = function parseDirective(isConst) { + var start = this._lexer.token; + this.expectToken(TokenKind.AT); + return { + kind: Kind.DIRECTIVE, + name: this.parseName(), + arguments: this.parseArguments(isConst), + loc: this.loc(start) + }; + } // Implements the parsing rules in the Types section. + + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + ; + + _proto.parseTypeReference = function parseTypeReference() { + var start = this._lexer.token; + var type; + + if (this.expectOptionalToken(TokenKind.BRACKET_L)) { + type = this.parseTypeReference(); + this.expectToken(TokenKind.BRACKET_R); + type = { + kind: Kind.LIST_TYPE, + type: type, + loc: this.loc(start) + }; + } else { + type = this.parseNamedType(); + } + + if (this.expectOptionalToken(TokenKind.BANG)) { + return { + kind: Kind.NON_NULL_TYPE, + type: type, + loc: this.loc(start) + }; + } + + return type; + } + /** + * NamedType : Name + */ + ; + + _proto.parseNamedType = function parseNamedType() { + var start = this._lexer.token; + return { + kind: Kind.NAMED_TYPE, + name: this.parseName(), + loc: this.loc(start) + }; + } // Implements the parsing rules in the Type Definition section. + + /** + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + ; + + _proto.parseTypeSystemDefinition = function parseTypeSystemDefinition() { + // Many definitions begin with a description and require a lookahead. + var keywordToken = this.peekDescription() ? this._lexer.lookahead() : this._lexer.token; + + if (keywordToken.kind === TokenKind.NAME) { + switch (keywordToken.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(); + } + } + + throw this.unexpected(keywordToken); + }; + + _proto.peekDescription = function peekDescription() { + return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING); + } + /** + * Description : StringValue + */ + ; + + _proto.parseDescription = function parseDescription() { + if (this.peekDescription()) { + return this.parseStringLiteral(); + } + } + /** + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + */ + ; + + _proto.parseSchemaDefinition = function parseSchemaDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('schema'); + var directives = this.parseDirectives(true); + var operationTypes = this.many(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R); + return { + kind: Kind.SCHEMA_DEFINITION, + description: description, + directives: directives, + operationTypes: operationTypes, + loc: this.loc(start) + }; + } + /** + * OperationTypeDefinition : OperationType : NamedType + */ + ; + + _proto.parseOperationTypeDefinition = function parseOperationTypeDefinition() { + var start = this._lexer.token; + var operation = this.parseOperationType(); + this.expectToken(TokenKind.COLON); + var type = this.parseNamedType(); + return { + kind: Kind.OPERATION_TYPE_DEFINITION, + operation: operation, + type: type, + loc: this.loc(start) + }; + } + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + ; + + _proto.parseScalarTypeDefinition = function parseScalarTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('scalar'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + return { + kind: Kind.SCALAR_TYPE_DEFINITION, + description: description, + name: name, + directives: directives, + loc: this.loc(start) + }; + } + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + ; + + _proto.parseObjectTypeDefinition = function parseObjectTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('type'); + var name = this.parseName(); + var interfaces = this.parseImplementsInterfaces(); + var directives = this.parseDirectives(true); + var fields = this.parseFieldsDefinition(); + return { + kind: Kind.OBJECT_TYPE_DEFINITION, + description: description, + name: name, + interfaces: interfaces, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + ; + + _proto.parseImplementsInterfaces = function parseImplementsInterfaces() { + var _this$_options2; + + if (!this.expectOptionalKeyword('implements')) { + return []; + } + + if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) { + var types = []; // Optional leading ampersand + + this.expectOptionalToken(TokenKind.AMP); + + do { + types.push(this.parseNamedType()); + } while (this.expectOptionalToken(TokenKind.AMP) || this.peek(TokenKind.NAME)); + + return types; + } + + return this.delimitedMany(TokenKind.AMP, this.parseNamedType); + } + /** + * FieldsDefinition : { FieldDefinition+ } + */ + ; + + _proto.parseFieldsDefinition = function parseFieldsDefinition() { + var _this$_options3; + + // Legacy support for the SDL? + if (((_this$_options3 = this._options) === null || _this$_options3 === void 0 ? void 0 : _this$_options3.allowLegacySDLEmptyFields) === true && this.peek(TokenKind.BRACE_L) && this._lexer.lookahead().kind === TokenKind.BRACE_R) { + this._lexer.advance(); + + this._lexer.advance(); + + return []; + } + + return this.optionalMany(TokenKind.BRACE_L, this.parseFieldDefinition, TokenKind.BRACE_R); + } + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + ; + + _proto.parseFieldDefinition = function parseFieldDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + var name = this.parseName(); + var args = this.parseArgumentDefs(); + this.expectToken(TokenKind.COLON); + var type = this.parseTypeReference(); + var directives = this.parseDirectives(true); + return { + kind: Kind.FIELD_DEFINITION, + description: description, + name: name, + arguments: args, + type: type, + directives: directives, + loc: this.loc(start) + }; + } + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + ; + + _proto.parseArgumentDefs = function parseArgumentDefs() { + return this.optionalMany(TokenKind.PAREN_L, this.parseInputValueDef, TokenKind.PAREN_R); + } + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + ; + + _proto.parseInputValueDef = function parseInputValueDef() { + var start = this._lexer.token; + var description = this.parseDescription(); + var name = this.parseName(); + this.expectToken(TokenKind.COLON); + var type = this.parseTypeReference(); + var defaultValue; + + if (this.expectOptionalToken(TokenKind.EQUALS)) { + defaultValue = this.parseValueLiteral(true); + } + + var directives = this.parseDirectives(true); + return { + kind: Kind.INPUT_VALUE_DEFINITION, + description: description, + name: name, + type: type, + defaultValue: defaultValue, + directives: directives, + loc: this.loc(start) + }; + } + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + ; + + _proto.parseInterfaceTypeDefinition = function parseInterfaceTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('interface'); + var name = this.parseName(); + var interfaces = this.parseImplementsInterfaces(); + var directives = this.parseDirectives(true); + var fields = this.parseFieldsDefinition(); + return { + kind: Kind.INTERFACE_TYPE_DEFINITION, + description: description, + name: name, + interfaces: interfaces, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + ; + + _proto.parseUnionTypeDefinition = function parseUnionTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('union'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var types = this.parseUnionMemberTypes(); + return { + kind: Kind.UNION_TYPE_DEFINITION, + description: description, + name: name, + directives: directives, + types: types, + loc: this.loc(start) + }; + } + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + ; + + _proto.parseUnionMemberTypes = function parseUnionMemberTypes() { + return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : []; + } + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + ; + + _proto.parseEnumTypeDefinition = function parseEnumTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('enum'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var values = this.parseEnumValuesDefinition(); + return { + kind: Kind.ENUM_TYPE_DEFINITION, + description: description, + name: name, + directives: directives, + values: values, + loc: this.loc(start) + }; + } + /** + * EnumValuesDefinition : { EnumValueDefinition+ } + */ + ; + + _proto.parseEnumValuesDefinition = function parseEnumValuesDefinition() { + return this.optionalMany(TokenKind.BRACE_L, this.parseEnumValueDefinition, TokenKind.BRACE_R); + } + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + * + * EnumValue : Name + */ + ; + + _proto.parseEnumValueDefinition = function parseEnumValueDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + var name = this.parseName(); + var directives = this.parseDirectives(true); + return { + kind: Kind.ENUM_VALUE_DEFINITION, + description: description, + name: name, + directives: directives, + loc: this.loc(start) + }; + } + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + ; + + _proto.parseInputObjectTypeDefinition = function parseInputObjectTypeDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('input'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var fields = this.parseInputFieldsDefinition(); + return { + kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, + description: description, + name: name, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * InputFieldsDefinition : { InputValueDefinition+ } + */ + ; + + _proto.parseInputFieldsDefinition = function parseInputFieldsDefinition() { + return this.optionalMany(TokenKind.BRACE_L, this.parseInputValueDef, TokenKind.BRACE_R); + } + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + ; + + _proto.parseTypeSystemExtension = function parseTypeSystemExtension() { + var keywordToken = this._lexer.lookahead(); + + if (keywordToken.kind === TokenKind.NAME) { + switch (keywordToken.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(keywordToken); + } + /** + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + */ + ; + + _proto.parseSchemaExtension = function parseSchemaExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('schema'); + var directives = this.parseDirectives(true); + var operationTypes = this.optionalMany(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R); + + if (directives.length === 0 && operationTypes.length === 0) { + throw this.unexpected(); + } + + return { + kind: Kind.SCHEMA_EXTENSION, + directives: directives, + operationTypes: operationTypes, + loc: this.loc(start) + }; + } + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + ; + + _proto.parseScalarTypeExtension = function parseScalarTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('scalar'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + + if (directives.length === 0) { + throw this.unexpected(); + } + + return { + kind: Kind.SCALAR_TYPE_EXTENSION, + name: name, + directives: directives, + loc: this.loc(start) + }; + } + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + ; + + _proto.parseObjectTypeExtension = function parseObjectTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('type'); + var name = this.parseName(); + var interfaces = this.parseImplementsInterfaces(); + var directives = this.parseDirectives(true); + var fields = this.parseFieldsDefinition(); + + if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return { + kind: Kind.OBJECT_TYPE_EXTENSION, + name: name, + interfaces: interfaces, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + ; + + _proto.parseInterfaceTypeExtension = function parseInterfaceTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('interface'); + var name = this.parseName(); + var interfaces = this.parseImplementsInterfaces(); + var directives = this.parseDirectives(true); + var fields = this.parseFieldsDefinition(); + + if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return { + kind: Kind.INTERFACE_TYPE_EXTENSION, + name: name, + interfaces: interfaces, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + ; + + _proto.parseUnionTypeExtension = function parseUnionTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('union'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var types = this.parseUnionMemberTypes(); + + if (directives.length === 0 && types.length === 0) { + throw this.unexpected(); + } + + return { + kind: Kind.UNION_TYPE_EXTENSION, + name: name, + directives: directives, + types: types, + loc: this.loc(start) + }; + } + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + ; + + _proto.parseEnumTypeExtension = function parseEnumTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('enum'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var values = this.parseEnumValuesDefinition(); + + if (directives.length === 0 && values.length === 0) { + throw this.unexpected(); + } + + return { + kind: Kind.ENUM_TYPE_EXTENSION, + name: name, + directives: directives, + values: values, + loc: this.loc(start) + }; + } + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + ; + + _proto.parseInputObjectTypeExtension = function parseInputObjectTypeExtension() { + var start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('input'); + var name = this.parseName(); + var directives = this.parseDirectives(true); + var fields = this.parseInputFieldsDefinition(); + + if (directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + + return { + kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, + name: name, + directives: directives, + fields: fields, + loc: this.loc(start) + }; + } + /** + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + */ + ; + + _proto.parseDirectiveDefinition = function parseDirectiveDefinition() { + var start = this._lexer.token; + var description = this.parseDescription(); + this.expectKeyword('directive'); + this.expectToken(TokenKind.AT); + var name = this.parseName(); + var args = this.parseArgumentDefs(); + var repeatable = this.expectOptionalKeyword('repeatable'); + this.expectKeyword('on'); + var locations = this.parseDirectiveLocations(); + return { + kind: Kind.DIRECTIVE_DEFINITION, + description: description, + name: name, + arguments: args, + repeatable: repeatable, + locations: locations, + loc: this.loc(start) + }; + } + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + ; + + _proto.parseDirectiveLocations = function parseDirectiveLocations() { + return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation); + } + /* + * DirectiveLocation : + * - ExecutableDirectiveLocation + * - TypeSystemDirectiveLocation + * + * ExecutableDirectiveLocation : one of + * `QUERY` + * `MUTATION` + * `SUBSCRIPTION` + * `FIELD` + * `FRAGMENT_DEFINITION` + * `FRAGMENT_SPREAD` + * `INLINE_FRAGMENT` + * + * TypeSystemDirectiveLocation : one of + * `SCHEMA` + * `SCALAR` + * `OBJECT` + * `FIELD_DEFINITION` + * `ARGUMENT_DEFINITION` + * `INTERFACE` + * `UNION` + * `ENUM` + * `ENUM_VALUE` + * `INPUT_OBJECT` + * `INPUT_FIELD_DEFINITION` + */ + ; + + _proto.parseDirectiveLocation = function parseDirectiveLocation() { + var start = this._lexer.token; + var name = this.parseName(); + + if (DirectiveLocation[name.value] !== undefined) { + return name; + } + + throw this.unexpected(start); + } // Core parsing utility functions + + /** + * Returns a location object, used to identify the place in the source that created a given parsed object. + */ + ; + + _proto.loc = function loc(startToken) { + var _this$_options4; + + if (((_this$_options4 = this._options) === null || _this$_options4 === void 0 ? void 0 : _this$_options4.noLocation) !== true) { + return new Location(startToken, this._lexer.lastToken, this._lexer.source); + } + } + /** + * Determines if the next token is of a given kind + */ + ; + + _proto.peek = function peek(kind) { + return this._lexer.token.kind === kind; + } + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + ; + + _proto.expectToken = function expectToken(kind) { + var token = this._lexer.token; + + if (token.kind === kind) { + this._lexer.advance(); + + return token; + } + + throw syntaxError(this._lexer.source, token.start, "Expected ".concat(getTokenKindDesc(kind), ", found ").concat(getTokenDesc(token), ".")); + } + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and return undefined. + */ + ; + + _proto.expectOptionalToken = function expectOptionalToken(kind) { + var token = this._lexer.token; + + if (token.kind === kind) { + this._lexer.advance(); + + return token; + } + + return undefined; + } + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + ; + + _proto.expectKeyword = function expectKeyword(value) { + var token = this._lexer.token; + + if (token.kind === TokenKind.NAME && token.value === value) { + this._lexer.advance(); + } else { + throw syntaxError(this._lexer.source, token.start, "Expected \"".concat(value, "\", found ").concat(getTokenDesc(token), ".")); + } + } + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + ; + + _proto.expectOptionalKeyword = function expectOptionalKeyword(value) { + var token = this._lexer.token; + + if (token.kind === TokenKind.NAME && token.value === value) { + this._lexer.advance(); + + return true; + } + + return false; + } + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + ; + + _proto.unexpected = function unexpected(atToken) { + var token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token; + return syntaxError(this._lexer.source, token.start, "Unexpected ".concat(getTokenDesc(token), ".")); + } + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + ; + + _proto.any = function any(openKind, parseFn, closeKind) { + this.expectToken(openKind); + var nodes = []; + + while (!this.expectOptionalToken(closeKind)) { + nodes.push(parseFn.call(this)); + } + + return nodes; + } + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + ; + + _proto.optionalMany = function optionalMany(openKind, parseFn, closeKind) { + if (this.expectOptionalToken(openKind)) { + var nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + + return []; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + ; + + _proto.many = function many(openKind, parseFn, closeKind) { + this.expectToken(openKind); + var nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + + return nodes; + } + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + ; + + _proto.delimitedMany = function delimitedMany(delimiterKind, parseFn) { + this.expectOptionalToken(delimiterKind); + var nodes = []; + + do { + nodes.push(parseFn.call(this)); + } while (this.expectOptionalToken(delimiterKind)); + + return nodes; + }; + + return Parser; +}(); +/** + * A helper function to describe a token as a string for debugging. + */ + +function getTokenDesc(token) { + var value = token.value; + return getTokenKindDesc(token.kind) + (value != null ? " \"".concat(value, "\"") : ''); +} +/** + * A helper function to describe a token kind as a string for debugging. + */ + + +function getTokenKindDesc(kind) { + return isPunctuatorTokenKind(kind) ? "\"".concat(kind, "\"") : kind; +} + +/** + * A visitor is provided to visit, it contains the collection of + * relevant functions to be called during the visitor's traversal. + */ + +var QueryDocumentKeys = { + 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', // Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + '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'] +}; +var BREAK = Object.freeze({}); +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to four permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * + * 2) Named visitors that trigger upon entering and leaving a node of + * a specific kind. + * + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * + * 4) Parallel visitors for entering and leaving nodes of a specific kind. + * + * visit(ast, { + * enter: { + * Kind(node) { + * // enter the "Kind" node + * } + * }, + * leave: { + * Kind(node) { + * // leave the "Kind" node + * } + * } + * }) + */ + +function visit(root, visitor) { + var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys; + + /* eslint-disable no-undef-init */ + var stack = undefined; + var inArray = Array.isArray(root); + var keys = [root]; + var index = -1; + var edits = []; + var node = undefined; + var key = undefined; + var parent = undefined; + var path = []; + var ancestors = []; + var newRoot = root; + /* eslint-enable no-undef-init */ + + do { + index++; + var isLeaving = index === keys.length; + var isEdited = isLeaving && edits.length !== 0; + + if (isLeaving) { + key = ancestors.length === 0 ? undefined : path[path.length - 1]; + node = parent; + parent = ancestors.pop(); + + if (isEdited) { + if (inArray) { + node = node.slice(); + } else { + var clone = {}; + + for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) { + var k = _Object$keys2[_i2]; + clone[k] = node[k]; + } + + node = clone; + } + + var editOffset = 0; + + for (var ii = 0; ii < edits.length; ii++) { + var editKey = edits[ii][0]; + var editValue = edits[ii][1]; + + if (inArray) { + editKey -= editOffset; + } + + if (inArray && editValue === null) { + node.splice(editKey, 1); + editOffset++; + } else { + node[editKey] = editValue; + } + } + } + + index = stack.index; + keys = stack.keys; + edits = stack.edits; + inArray = stack.inArray; + stack = stack.prev; + } else { + key = parent ? inArray ? index : keys[index] : undefined; + node = parent ? parent[key] : newRoot; + + if (node === null || node === undefined) { + continue; + } + + if (parent) { + path.push(key); + } + } + + var result = void 0; + + if (!Array.isArray(node)) { + if (!isNode(node)) { + throw new Error("Invalid AST Node: ".concat(inspect(node), ".")); + } + + var visitFn = getVisitFn(visitor, node.kind, isLeaving); + + if (visitFn) { + result = visitFn.call(visitor, node, key, parent, path, ancestors); + + if (result === BREAK) { + break; + } + + if (result === false) { + if (!isLeaving) { + path.pop(); + continue; + } + } else if (result !== undefined) { + edits.push([key, result]); + + if (!isLeaving) { + if (isNode(result)) { + node = result; + } else { + path.pop(); + continue; + } + } + } + } + } + + if (result === undefined && isEdited) { + edits.push([key, node]); + } + + if (isLeaving) { + path.pop(); + } else { + var _visitorKeys$node$kin; + + stack = { + inArray: inArray, + index: index, + keys: keys, + edits: edits, + prev: stack + }; + inArray = Array.isArray(node); + keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : []; + index = -1; + edits = []; + + if (parent) { + ancestors.push(parent); + } + + parent = node; + } + } while (stack !== undefined); + + if (edits.length !== 0) { + newRoot = edits[edits.length - 1][1]; + } + + return newRoot; +} +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + */ + +function getVisitFn(visitor, kind, isLeaving) { + var kindVisitor = visitor[kind]; + + if (kindVisitor) { + if (!isLeaving && typeof kindVisitor === 'function') { + // { Kind() {} } + return kindVisitor; + } + + var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter; + + if (typeof kindSpecificVisitor === 'function') { + // { Kind: { enter() {}, leave() {} } } + return kindSpecificVisitor; + } + } else { + var specificVisitor = isLeaving ? visitor.leave : visitor.enter; + + if (specificVisitor) { + if (typeof specificVisitor === 'function') { + // { enter() {}, leave() {} } + return specificVisitor; + } + + var specificKindVisitor = specificVisitor[kind]; + + if (typeof specificKindVisitor === 'function') { + // { enter: { Kind() {} }, leave: { Kind() {} } } + return specificKindVisitor; + } + } + } +} + +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ + +function print(ast) { + return visit(ast, { + leave: printDocASTReducer + }); +} +var MAX_LINE_LENGTH = 80; // TODO: provide better type coverage in future + +var printDocASTReducer = { + Name: function Name(node) { + return node.value; + }, + Variable: function Variable(node) { + return '$' + node.name; + }, + // Document + Document: function Document(node) { + return join(node.definitions, '\n\n') + '\n'; + }, + OperationDefinition: function OperationDefinition(node) { + var op = node.operation; + var name = node.name; + var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); + var directives = join(node.directives, ' '); + var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use + // the query short form. + + return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' '); + }, + VariableDefinition: function VariableDefinition(_ref) { + var variable = _ref.variable, + type = _ref.type, + defaultValue = _ref.defaultValue, + directives = _ref.directives; + return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' ')); + }, + SelectionSet: function SelectionSet(_ref2) { + var selections = _ref2.selections; + return block(selections); + }, + Field: function Field(_ref3) { + var alias = _ref3.alias, + name = _ref3.name, + args = _ref3.arguments, + directives = _ref3.directives, + selectionSet = _ref3.selectionSet; + var prefix = wrap('', alias, ': ') + name; + var argsLine = prefix + wrap('(', join(args, ', '), ')'); + + if (argsLine.length > MAX_LINE_LENGTH) { + argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); + } + + return join([argsLine, join(directives, ' '), selectionSet], ' '); + }, + Argument: function Argument(_ref4) { + var name = _ref4.name, + value = _ref4.value; + return name + ': ' + value; + }, + // Fragments + FragmentSpread: function FragmentSpread(_ref5) { + var name = _ref5.name, + directives = _ref5.directives; + return '...' + name + wrap(' ', join(directives, ' ')); + }, + InlineFragment: function InlineFragment(_ref6) { + var typeCondition = _ref6.typeCondition, + directives = _ref6.directives, + selectionSet = _ref6.selectionSet; + return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' '); + }, + FragmentDefinition: function FragmentDefinition(_ref7) { + var name = _ref7.name, + typeCondition = _ref7.typeCondition, + variableDefinitions = _ref7.variableDefinitions, + directives = _ref7.directives, + selectionSet = _ref7.selectionSet; + return (// Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + "fragment ".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), " ") + "on ".concat(typeCondition, " ").concat(wrap('', join(directives, ' '), ' ')) + selectionSet + ); + }, + // Value + IntValue: function IntValue(_ref8) { + var value = _ref8.value; + return value; + }, + FloatValue: function FloatValue(_ref9) { + var value = _ref9.value; + return value; + }, + StringValue: function StringValue(_ref10, key) { + var value = _ref10.value, + isBlockString = _ref10.block; + return isBlockString ? printBlockString(value, key === 'description' ? '' : ' ') : JSON.stringify(value); + }, + BooleanValue: function BooleanValue(_ref11) { + var value = _ref11.value; + return value ? 'true' : 'false'; + }, + NullValue: function NullValue() { + return 'null'; + }, + EnumValue: function EnumValue(_ref12) { + var value = _ref12.value; + return value; + }, + ListValue: function ListValue(_ref13) { + var values = _ref13.values; + return '[' + join(values, ', ') + ']'; + }, + ObjectValue: function ObjectValue(_ref14) { + var fields = _ref14.fields; + return '{' + join(fields, ', ') + '}'; + }, + ObjectField: function ObjectField(_ref15) { + var name = _ref15.name, + value = _ref15.value; + return name + ': ' + value; + }, + // Directive + Directive: function Directive(_ref16) { + var name = _ref16.name, + args = _ref16.arguments; + return '@' + name + wrap('(', join(args, ', '), ')'); + }, + // Type + NamedType: function NamedType(_ref17) { + var name = _ref17.name; + return name; + }, + ListType: function ListType(_ref18) { + var type = _ref18.type; + return '[' + type + ']'; + }, + NonNullType: function NonNullType(_ref19) { + var type = _ref19.type; + return type + '!'; + }, + // Type System Definitions + SchemaDefinition: addDescription(function (_ref20) { + var directives = _ref20.directives, + operationTypes = _ref20.operationTypes; + return join(['schema', join(directives, ' '), block(operationTypes)], ' '); + }), + OperationTypeDefinition: function OperationTypeDefinition(_ref21) { + var operation = _ref21.operation, + type = _ref21.type; + return operation + ': ' + type; + }, + ScalarTypeDefinition: addDescription(function (_ref22) { + var name = _ref22.name, + directives = _ref22.directives; + return join(['scalar', name, join(directives, ' ')], ' '); + }), + ObjectTypeDefinition: addDescription(function (_ref23) { + var name = _ref23.name, + interfaces = _ref23.interfaces, + directives = _ref23.directives, + fields = _ref23.fields; + return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); + }), + FieldDefinition: addDescription(function (_ref24) { + var name = _ref24.name, + args = _ref24.arguments, + type = _ref24.type, + directives = _ref24.directives; + return name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' ')); + }), + InputValueDefinition: addDescription(function (_ref25) { + var name = _ref25.name, + type = _ref25.type, + defaultValue = _ref25.defaultValue, + directives = _ref25.directives; + return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' '); + }), + InterfaceTypeDefinition: addDescription(function (_ref26) { + var name = _ref26.name, + interfaces = _ref26.interfaces, + directives = _ref26.directives, + fields = _ref26.fields; + return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); + }), + UnionTypeDefinition: addDescription(function (_ref27) { + var name = _ref27.name, + directives = _ref27.directives, + types = _ref27.types; + return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); + }), + EnumTypeDefinition: addDescription(function (_ref28) { + var name = _ref28.name, + directives = _ref28.directives, + values = _ref28.values; + return join(['enum', name, join(directives, ' '), block(values)], ' '); + }), + EnumValueDefinition: addDescription(function (_ref29) { + var name = _ref29.name, + directives = _ref29.directives; + return join([name, join(directives, ' ')], ' '); + }), + InputObjectTypeDefinition: addDescription(function (_ref30) { + var name = _ref30.name, + directives = _ref30.directives, + fields = _ref30.fields; + return join(['input', name, join(directives, ' '), block(fields)], ' '); + }), + DirectiveDefinition: addDescription(function (_ref31) { + var name = _ref31.name, + args = _ref31.arguments, + repeatable = _ref31.repeatable, + locations = _ref31.locations; + return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\n', indent(join(args, '\n')), '\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | '); + }), + SchemaExtension: function SchemaExtension(_ref32) { + var directives = _ref32.directives, + operationTypes = _ref32.operationTypes; + return join(['extend schema', join(directives, ' '), block(operationTypes)], ' '); + }, + ScalarTypeExtension: function ScalarTypeExtension(_ref33) { + var name = _ref33.name, + directives = _ref33.directives; + return join(['extend scalar', name, join(directives, ' ')], ' '); + }, + ObjectTypeExtension: function ObjectTypeExtension(_ref34) { + var name = _ref34.name, + interfaces = _ref34.interfaces, + directives = _ref34.directives, + fields = _ref34.fields; + return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); + }, + InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) { + var name = _ref35.name, + interfaces = _ref35.interfaces, + directives = _ref35.directives, + fields = _ref35.fields; + return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' '); + }, + UnionTypeExtension: function UnionTypeExtension(_ref36) { + var name = _ref36.name, + directives = _ref36.directives, + types = _ref36.types; + return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' '); + }, + EnumTypeExtension: function EnumTypeExtension(_ref37) { + var name = _ref37.name, + directives = _ref37.directives, + values = _ref37.values; + return join(['extend enum', name, join(directives, ' '), block(values)], ' '); + }, + InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) { + var name = _ref38.name, + directives = _ref38.directives, + fields = _ref38.fields; + return join(['extend input', name, join(directives, ' '), block(fields)], ' '); + } +}; + +function addDescription(cb) { + return function (node) { + return join([node.description, cb(node)], '\n'); + }; +} +/** + * Given maybeArray, print an empty string if it is null or empty, otherwise + * print all items together separated by separator if provided + */ + + +function join(maybeArray) { + var _maybeArray$filter$jo; + + var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) { + return x; + }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : ''; +} +/** + * Given array, print each item on its own line, wrapped in an + * indented "{ }" block. + */ + + +function block(array) { + return wrap('{\n', indent(join(array, '\n')), '\n}'); +} +/** + * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. + */ + + +function wrap(start, maybeString) { + var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; + return maybeString != null && maybeString !== '' ? start + maybeString + end : ''; +} + +function indent(str) { + return wrap(' ', str.replace(/\n/g, '\n ')); +} + +function isMultiline(str) { + return str.indexOf('\n') !== -1; +} + +function hasMultilineItems(maybeArray) { + return maybeArray != null && maybeArray.some(isMultiline); +} + +var printer = /*#__PURE__*/Object.freeze({ + __proto__: null, + print: print +}); + +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function getAugmentedNamespace(n) { + if (Object.prototype.hasOwnProperty.call(n, '__esModule')) return n; + var f = n.default; + if (typeof f == "function") { + var a = function a () { + var isInstance = false; + try { + isInstance = this instanceof a; + } catch {} + if (isInstance) { + return Reflect.construct(f, arguments, this.constructor); + } + return f.apply(this, arguments); + }; + a.prototype = f.prototype; + } else a = {}; + Object.defineProperty(a, '__esModule', {value: true}); + Object.keys(n).forEach(function (k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function () { + return n[k]; + } + }); + }); + return a; +} + +var src = {exports: {}}; + +var hasRequiredSrc; + +function requireSrc () { + if (hasRequiredSrc) return src.exports; + hasRequiredSrc = 1; + // + // Main + // + + function memoize (fn, options) { + var cache = options && options.cache + ? options.cache + : cacheDefault; + + var serializer = options && options.serializer + ? options.serializer + : serializerDefault; + + var strategy = options && options.strategy + ? options.strategy + : strategyDefault; + + return strategy(fn, { + cache: cache, + serializer: serializer + }) + } + + // + // Strategy + // + + function isPrimitive (value) { + return value == null || typeof value === 'number' || typeof value === 'boolean' // || typeof value === "string" 'unsafe' primitive for our needs + } + + function monadic (fn, cache, serializer, arg) { + var cacheKey = isPrimitive(arg) ? arg : serializer(arg); + + var computedValue = cache.get(cacheKey); + if (typeof computedValue === 'undefined') { + computedValue = fn.call(this, arg); + cache.set(cacheKey, computedValue); + } + + return computedValue + } + + function variadic (fn, cache, serializer) { + var args = Array.prototype.slice.call(arguments, 3); + var cacheKey = serializer(args); + + var computedValue = cache.get(cacheKey); + if (typeof computedValue === 'undefined') { + computedValue = fn.apply(this, args); + cache.set(cacheKey, computedValue); + } + + return computedValue + } + + function assemble (fn, context, strategy, cache, serialize) { + return strategy.bind( + context, + fn, + cache, + serialize + ) + } + + function strategyDefault (fn, options) { + var strategy = fn.length === 1 ? monadic : variadic; + + return assemble( + fn, + this, + strategy, + options.cache.create(), + options.serializer + ) + } + + function strategyVariadic (fn, options) { + var strategy = variadic; + + return assemble( + fn, + this, + strategy, + options.cache.create(), + options.serializer + ) + } + + function strategyMonadic (fn, options) { + var strategy = monadic; + + return assemble( + fn, + this, + strategy, + options.cache.create(), + options.serializer + ) + } + + // + // Serializer + // + + function serializerDefault () { + return JSON.stringify(arguments) + } + + // + // Cache + // + + function ObjectWithoutPrototypeCache () { + this.cache = Object.create(null); + } + + ObjectWithoutPrototypeCache.prototype.has = function (key) { + return (key in this.cache) + }; + + ObjectWithoutPrototypeCache.prototype.get = function (key) { + return this.cache[key] + }; + + ObjectWithoutPrototypeCache.prototype.set = function (key, value) { + this.cache[key] = value; + }; + + var cacheDefault = { + create: function create () { + return new ObjectWithoutPrototypeCache() + } + }; + + // + // API + // + + src.exports = memoize; + src.exports.strategies = { + variadic: strategyVariadic, + monadic: strategyMonadic + }; + return src.exports; +} + +var srcExports = requireSrc(); +var M = /*@__PURE__*/getDefaultExportFromCjs(srcExports); + +var dist$1 = {}; + +var utils = {}; + +var hasRequiredUtils; + +function requireUtils () { + if (hasRequiredUtils) return utils; + hasRequiredUtils = 1; + var __assign = (utils && utils.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + var __spreadArrays = (utils && utils.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + Object.defineProperty(utils, "__esModule", { value: true }); + utils.renameVariables = utils.renameVariablesAndTopLevelFields = utils.renameVariablesAndTopLevelFieldsOnOpDef = utils.renameSelectionSetArguments = utils.renameVariableDefinition = utils.renameDirectiveArguments = utils.renameArgument = utils.renameValue = utils.defaultRenameFn = void 0; + utils.defaultRenameFn = function (name, index) { return name + "_" + index; }; + function renameValue(node, renameFn) { + if (node.kind === 'Variable') { + return __assign(__assign({}, node), { name: __assign(__assign({}, node.name), { value: renameFn(node.name.value) }) }); + } + else if (node.kind === 'ObjectValue') { + return __assign(__assign({}, node), { fields: node.fields.map(function (field) { return (__assign(__assign({}, field), { value: renameValue(field.value, renameFn) })); }) }); + } + else if (node.kind === 'ListValue') { + return __assign(__assign({}, node), { values: node.values.map(function (value) { return renameValue(value, renameFn); }) }); + } + return node; + } + utils.renameValue = renameValue; + function renameArgument(node, renameFn) { + return __assign(__assign({}, node), { value: renameValue(node.value, renameFn) }); + } + utils.renameArgument = renameArgument; + function renameDirectiveArguments(node, renameFn) { + var _a; + return __assign(__assign({}, node), { arguments: (_a = node.arguments) === null || _a === void 0 ? void 0 : _a.map(function (arg) { return renameArgument(arg, renameFn); }) }); + } + utils.renameDirectiveArguments = renameDirectiveArguments; + function renameVariableDefinition(node, renameFn) { + var _a; + return __assign(__assign({}, node), { variable: __assign(__assign({}, node.variable), { name: __assign(__assign({}, node.variable.name), { value: renameFn(node.variable.name.value) }) }), directives: (_a = node.directives) === null || _a === void 0 ? void 0 : _a.map(function (dir) { return renameDirectiveArguments(dir, renameFn); }) }); + } + utils.renameVariableDefinition = renameVariableDefinition; + function renameSelectionSetArguments(selectionSet, renameFn) { + return __assign(__assign({}, selectionSet), { selections: selectionSet.selections.map(function (sel) { + var _a, _b, _c; + switch (sel.kind) { + case 'Field': + return __assign(__assign({}, sel), { arguments: (_a = sel.arguments) === null || _a === void 0 ? void 0 : _a.map(function (arg) { return renameArgument(arg, renameFn); }), selectionSet: sel.selectionSet ? renameSelectionSetArguments(sel.selectionSet, renameFn) : undefined }); + case 'FragmentSpread': + return __assign(__assign({}, sel), { directives: (_b = sel.directives) === null || _b === void 0 ? void 0 : _b.map(function (dir) { return renameDirectiveArguments(dir, renameFn); }) }); + case 'InlineFragment': + return __assign(__assign({}, sel), { directives: (_c = sel.directives) === null || _c === void 0 ? void 0 : _c.map(function (dir) { return renameDirectiveArguments(dir, renameFn); }), selectionSet: renameSelectionSetArguments(sel.selectionSet, renameFn) }); + } + }) }); + } + utils.renameSelectionSetArguments = renameSelectionSetArguments; + function renameVariablesAndTopLevelFieldsOnOpDef(op, variableRenameFn, fieldRenameFn) { + var _a, _b; + return __assign(__assign({}, op), { variableDefinitions: (_a = op.variableDefinitions) === null || _a === void 0 ? void 0 : _a.map(function (vardef) { return renameVariableDefinition(vardef, variableRenameFn); }), directives: (_b = op.directives) === null || _b === void 0 ? void 0 : _b.map(function (dir) { return renameDirectiveArguments(dir, variableRenameFn); }), selectionSet: renameSelectionSetArguments(__assign(__assign({}, op.selectionSet), { selections: op.selectionSet.selections.map(function (sel) { + var _a, _b; + switch (sel.kind) { + case 'Field': + return __assign(__assign({}, sel), { alias: __assign(__assign({}, sel.name), { value: fieldRenameFn((_b = (_a = sel.alias) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : sel.name.value) }) }); + default: + return sel; + } + }) }), variableRenameFn) }); + } + utils.renameVariablesAndTopLevelFieldsOnOpDef = renameVariablesAndTopLevelFieldsOnOpDef; + function renameVariablesAndTopLevelFields(doc, variableRenameFn, fieldRenameFn) { + return __assign(__assign({}, doc), { definitions: __spreadArrays(doc.definitions.filter(function (def) { return def.kind !== 'OperationDefinition'; }), doc.definitions.filter(function (def) { return def.kind === 'OperationDefinition'; }).map(function (opDef) { + return renameVariablesAndTopLevelFieldsOnOpDef(opDef, variableRenameFn, fieldRenameFn); + })) }); + } + utils.renameVariablesAndTopLevelFields = renameVariablesAndTopLevelFields; + function renameVariables(variables, renameFn) { + return Object.keys(variables).reduce(function (vars, key) { + var _a; + return __assign(__assign({}, vars), (_a = {}, _a[renameFn(key)] = variables[key], _a)); + }, {}); + } + utils.renameVariables = renameVariables; + + return utils; +} + +var hasRequiredDist$1; + +function requireDist$1 () { + if (hasRequiredDist$1) return dist$1; + hasRequiredDist$1 = 1; + var __extends = (dist$1 && dist$1.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __assign = (dist$1 && dist$1.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + var __spreadArrays = (dist$1 && dist$1.__spreadArrays) || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + Object.defineProperty(dist$1, "__esModule", { value: true }); + var utils_1 = requireUtils(); + var emptyDoc = { + kind: 'Document', + definitions: [] + }; + var CombinedQueryError = /** @class */ (function (_super) { + __extends(CombinedQueryError, _super); + function CombinedQueryError() { + return _super !== null && _super.apply(this, arguments) || this; + } + return CombinedQueryError; + }(Error)); + var CombinedQueryBuilderImpl = /** @class */ (function () { + function CombinedQueryBuilderImpl(operationName, document, variables) { + this.operationName = operationName; + this.document = document; + this.variables = variables; + } + CombinedQueryBuilderImpl.prototype.add = function (document, variables) { + var _this = this; + var opDefs = this.document.definitions.concat(document.definitions).filter(function (def) { return def.kind === 'OperationDefinition'; }); + if (!opDefs.length) { + throw new CombinedQueryError('Expected at least one OperationDefinition, but found none.'); + } + // do some basic validation + opDefs.forEach(function (def) { + var _a, _b; + var otherOpDefs = opDefs.filter(function (_def) { return _def !== def; }); + // all op defs must be of the same type + otherOpDefs.forEach(function (_def) { + var _a, _b; + if (_def.operation !== def.operation) { + throw new CombinedQueryError("expected all operations to be of the same type, but " + ((_a = _def.name) === null || _a === void 0 ? void 0 : _a.value) + " is " + _def.operation + " and " + ((_b = def.name) === null || _b === void 0 ? void 0 : _b.value) + " is " + def.operation); + } + }); + // all top level fields mut be unique. doesn't drill down fragments tho. maybe someday + (_a = def.selectionSet.selections) === null || _a === void 0 ? void 0 : _a.filter(function (s) { return s.kind === 'Field'; }).forEach(function (sel) { + otherOpDefs.forEach(function (_def) { var _a; return (_a = _def.selectionSet.selections) === null || _a === void 0 ? void 0 : _a.filter(function (s) { return s.kind === 'Field'; }).forEach(function (_sel) { + var _a, _b, _c, _d; + if ((((_a = sel.alias) === null || _a === void 0 ? void 0 : _a.value) || sel.name.value) === (((_b = _sel.alias) === null || _b === void 0 ? void 0 : _b.value) || _sel.name.value)) { + throw new CombinedQueryError("duplicate field definition " + _sel.name.value + " for operations " + ((_c = def.name) === null || _c === void 0 ? void 0 : _c.value) + " and " + ((_d = _def.name) === null || _d === void 0 ? void 0 : _d.value)); + } + }); }); + }); + // finally all variables must be unique + (_b = def.variableDefinitions) === null || _b === void 0 ? void 0 : _b.forEach(function (variable) { + otherOpDefs.forEach(function (_def) { var _a; return (_a = _def.variableDefinitions) === null || _a === void 0 ? void 0 : _a.forEach(function (_variable) { + var _a, _b; + if (variable.variable.name.value === _variable.variable.name.value) { + throw new CombinedQueryError("duplicate variable definition " + _variable.variable.name.value + " for operations " + ((_a = def.name) === null || _a === void 0 ? void 0 : _a.value) + " and " + ((_b = _def.name) === null || _b === void 0 ? void 0 : _b.value)); + } + }); }); + }); + }); + var newVars = (function () { + if (_this.variables && variables) { + return __assign(__assign({}, _this.variables), variables); + } + return (variables || _this.variables); + })(); + var definitions = [{ + kind: 'OperationDefinition', + directives: opDefs.flatMap(function (def) { return def.directives || []; }), + name: { kind: 'Name', value: this.operationName }, + operation: opDefs[0].operation, + selectionSet: { + kind: 'SelectionSet', + selections: opDefs.flatMap(function (def) { return def.selectionSet.selections; }) + }, + variableDefinitions: opDefs.flatMap(function (def) { return def.variableDefinitions || []; }) + }]; + var encounteredFragmentList = new Set(); + var combinedDocumentDefinitions = this.document.definitions.concat(document.definitions); + for (var _i = 0, combinedDocumentDefinitions_1 = combinedDocumentDefinitions; _i < combinedDocumentDefinitions_1.length; _i++) { + var definition = combinedDocumentDefinitions_1[_i]; + if (definition.kind === 'OperationDefinition') { + continue; + } + if (definition.kind === 'FragmentDefinition') { + if (encounteredFragmentList.has(definition.name.value)) { + continue; + } + encounteredFragmentList.add(definition.name.value); + } + definitions = __spreadArrays([definition], definitions); + } + var newDoc = { + kind: 'Document', + definitions: definitions + }; + return new CombinedQueryBuilderImpl(this.operationName, newDoc, newVars); + }; + CombinedQueryBuilderImpl.prototype.addN = function (document, variables, variableRenameFn, fieldRenameFn) { + if (variableRenameFn === void 0) { variableRenameFn = utils_1.defaultRenameFn; } + if (fieldRenameFn === void 0) { fieldRenameFn = utils_1.defaultRenameFn; } + if (!variables.length) { + return this; + } + return variables.reduce(function (builder, _variables, idx) { + var doc = utils_1.renameVariablesAndTopLevelFields(document, function (name) { return variableRenameFn(name, idx); }, function (name) { return fieldRenameFn(name, idx); }); + var vars = utils_1.renameVariables(_variables, function (name) { return variableRenameFn(name, idx); }); + return builder.add(doc, vars); + }, this); + }; + return CombinedQueryBuilderImpl; + }()); + function combinedQuery(operationName) { + return { + operationName: operationName, + add: function (document, variables) { + return new CombinedQueryBuilderImpl(this.operationName, document, variables); + }, + addN: function (document, variables, variableRenameFn, fieldRenameFn) { + return new CombinedQueryBuilderImpl(this.operationName, emptyDoc).addN(document, variables, variableRenameFn, fieldRenameFn); + } + }; + } + dist$1.default = combinedQuery; + + return dist$1; +} + +var distExports$1 = requireDist$1(); +var $ = /*@__PURE__*/getDefaultExportFromCjs(distExports$1); + +var dist = {}; + +var browserPonyfill = {exports: {}}; + +var hasRequiredBrowserPonyfill; + +function requireBrowserPonyfill () { + if (hasRequiredBrowserPonyfill) return browserPonyfill.exports; + hasRequiredBrowserPonyfill = 1; + (function (module, exports$1) { + // Save global object in a variable + var __global__ = + (typeof globalThis !== 'undefined' && globalThis) || + (typeof self !== 'undefined' && self) || + (typeof commonjsGlobal !== 'undefined' && commonjsGlobal); + // Create an object that extends from __global__ without the fetch function + var __globalThis__ = (function () { + function F() { + this.fetch = false; + this.DOMException = __global__.DOMException; + } + F.prototype = __global__; // Needed for feature detection on whatwg-fetch's code + return new F(); + })(); + // Wraps whatwg-fetch with a function scope to hijack the global object + // "globalThis" that's going to be patched + (function(globalThis) { + + ((function (exports$1) { + + /* eslint-disable no-prototype-builtins */ + var g = + (typeof globalThis !== 'undefined' && globalThis) || + (typeof self !== 'undefined' && self) || + // eslint-disable-next-line no-undef + (typeof commonjsGlobal !== 'undefined' && commonjsGlobal) || + {}; + + var support = { + searchParams: 'URLSearchParams' in g, + iterable: 'Symbol' in g && 'iterator' in Symbol, + blob: + 'FileReader' in g && + 'Blob' in g && + (function() { + try { + new Blob(); + return true + } catch (e) { + return false + } + })(), + formData: 'FormData' in g, + arrayBuffer: 'ArrayBuffer' in g + }; + + function isDataView(obj) { + return obj && DataView.prototype.isPrototypeOf(obj) + } + + if (support.arrayBuffer) { + var viewClasses = [ + '[object Int8Array]', + '[object Uint8Array]', + '[object Uint8ClampedArray]', + '[object Int16Array]', + '[object Uint16Array]', + '[object Int32Array]', + '[object Uint32Array]', + '[object Float32Array]', + '[object Float64Array]' + ]; + + var isArrayBufferView = + ArrayBuffer.isView || + function(obj) { + return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 + }; + } + + function normalizeName(name) { + if (typeof name !== 'string') { + name = String(name); + } + if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') { + throw new TypeError('Invalid character in header field name: "' + name + '"') + } + return name.toLowerCase() + } + + function normalizeValue(value) { + if (typeof value !== 'string') { + value = String(value); + } + return value + } + + // Build a destructive iterator for the value list + function iteratorFor(items) { + var iterator = { + next: function() { + var value = items.shift(); + return {done: value === undefined, value: value} + } + }; + + if (support.iterable) { + iterator[Symbol.iterator] = function() { + return iterator + }; + } + + return iterator + } + + function Headers(headers) { + this.map = {}; + + if (headers instanceof Headers) { + headers.forEach(function(value, name) { + this.append(name, value); + }, this); + } else if (Array.isArray(headers)) { + headers.forEach(function(header) { + if (header.length != 2) { + throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length) + } + this.append(header[0], header[1]); + }, this); + } else if (headers) { + Object.getOwnPropertyNames(headers).forEach(function(name) { + this.append(name, headers[name]); + }, this); + } + } + + Headers.prototype.append = function(name, value) { + name = normalizeName(name); + value = normalizeValue(value); + var oldValue = this.map[name]; + this.map[name] = oldValue ? oldValue + ', ' + value : value; + }; + + Headers.prototype['delete'] = function(name) { + delete this.map[normalizeName(name)]; + }; + + Headers.prototype.get = function(name) { + name = normalizeName(name); + return this.has(name) ? this.map[name] : null + }; + + Headers.prototype.has = function(name) { + return this.map.hasOwnProperty(normalizeName(name)) + }; + + Headers.prototype.set = function(name, value) { + this.map[normalizeName(name)] = normalizeValue(value); + }; + + Headers.prototype.forEach = function(callback, thisArg) { + for (var name in this.map) { + if (this.map.hasOwnProperty(name)) { + callback.call(thisArg, this.map[name], name, this); + } + } + }; + + Headers.prototype.keys = function() { + var items = []; + this.forEach(function(value, name) { + items.push(name); + }); + return iteratorFor(items) + }; + + Headers.prototype.values = function() { + var items = []; + this.forEach(function(value) { + items.push(value); + }); + return iteratorFor(items) + }; + + Headers.prototype.entries = function() { + var items = []; + this.forEach(function(value, name) { + items.push([name, value]); + }); + return iteratorFor(items) + }; + + if (support.iterable) { + Headers.prototype[Symbol.iterator] = Headers.prototype.entries; + } + + function consumed(body) { + if (body._noBody) return + if (body.bodyUsed) { + return Promise.reject(new TypeError('Already read')) + } + body.bodyUsed = true; + } + + function fileReaderReady(reader) { + return new Promise(function(resolve, reject) { + reader.onload = function() { + resolve(reader.result); + }; + reader.onerror = function() { + reject(reader.error); + }; + }) + } + + function readBlobAsArrayBuffer(blob) { + var reader = new FileReader(); + var promise = fileReaderReady(reader); + reader.readAsArrayBuffer(blob); + return promise + } + + function readBlobAsText(blob) { + var reader = new FileReader(); + var promise = fileReaderReady(reader); + var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type); + var encoding = match ? match[1] : 'utf-8'; + reader.readAsText(blob, encoding); + return promise + } + + function readArrayBufferAsText(buf) { + var view = new Uint8Array(buf); + var chars = new Array(view.length); + + for (var i = 0; i < view.length; i++) { + chars[i] = String.fromCharCode(view[i]); + } + return chars.join('') + } + + function bufferClone(buf) { + if (buf.slice) { + return buf.slice(0) + } else { + var view = new Uint8Array(buf.byteLength); + view.set(new Uint8Array(buf)); + return view.buffer + } + } + + function Body() { + this.bodyUsed = false; + + this._initBody = function(body) { + /* + fetch-mock wraps the Response object in an ES6 Proxy to + provide useful test harness features such as flush. However, on + ES5 browsers without fetch or Proxy support pollyfills must be used; + the proxy-pollyfill is unable to proxy an attribute unless it exists + on the object before the Proxy is created. This change ensures + Response.bodyUsed exists on the instance, while maintaining the + semantic of setting Request.bodyUsed in the constructor before + _initBody is called. + */ + // eslint-disable-next-line no-self-assign + this.bodyUsed = this.bodyUsed; + this._bodyInit = body; + if (!body) { + this._noBody = true; + this._bodyText = ''; + } else if (typeof body === 'string') { + this._bodyText = body; + } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { + this._bodyBlob = body; + } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { + this._bodyFormData = body; + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this._bodyText = body.toString(); + } else if (support.arrayBuffer && support.blob && isDataView(body)) { + this._bodyArrayBuffer = bufferClone(body.buffer); + // IE 10-11 can't handle a DataView body. + this._bodyInit = new Blob([this._bodyArrayBuffer]); + } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { + this._bodyArrayBuffer = bufferClone(body); + } else { + this._bodyText = body = Object.prototype.toString.call(body); + } + + if (!this.headers.get('content-type')) { + if (typeof body === 'string') { + this.headers.set('content-type', 'text/plain;charset=UTF-8'); + } else if (this._bodyBlob && this._bodyBlob.type) { + this.headers.set('content-type', this._bodyBlob.type); + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); + } + } + }; + + if (support.blob) { + this.blob = function() { + var rejected = consumed(this); + if (rejected) { + return rejected + } + + if (this._bodyBlob) { + return Promise.resolve(this._bodyBlob) + } else if (this._bodyArrayBuffer) { + return Promise.resolve(new Blob([this._bodyArrayBuffer])) + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as blob') + } else { + return Promise.resolve(new Blob([this._bodyText])) + } + }; + } + + this.arrayBuffer = function() { + if (this._bodyArrayBuffer) { + var isConsumed = consumed(this); + if (isConsumed) { + return isConsumed + } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) { + return Promise.resolve( + this._bodyArrayBuffer.buffer.slice( + this._bodyArrayBuffer.byteOffset, + this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength + ) + ) + } else { + return Promise.resolve(this._bodyArrayBuffer) + } + } else if (support.blob) { + return this.blob().then(readBlobAsArrayBuffer) + } else { + throw new Error('could not read as ArrayBuffer') + } + }; + + this.text = function() { + var rejected = consumed(this); + if (rejected) { + return rejected + } + + if (this._bodyBlob) { + return readBlobAsText(this._bodyBlob) + } else if (this._bodyArrayBuffer) { + return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as text') + } else { + return Promise.resolve(this._bodyText) + } + }; + + if (support.formData) { + this.formData = function() { + return this.text().then(decode) + }; + } + + this.json = function() { + return this.text().then(JSON.parse) + }; + + return this + } + + // HTTP methods whose capitalization should be normalized + var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE']; + + function normalizeMethod(method) { + var upcased = method.toUpperCase(); + return methods.indexOf(upcased) > -1 ? upcased : method + } + + function Request(input, options) { + if (!(this instanceof Request)) { + throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') + } + + options = options || {}; + var body = options.body; + + if (input instanceof Request) { + if (input.bodyUsed) { + throw new TypeError('Already read') + } + this.url = input.url; + this.credentials = input.credentials; + if (!options.headers) { + this.headers = new Headers(input.headers); + } + this.method = input.method; + this.mode = input.mode; + this.signal = input.signal; + if (!body && input._bodyInit != null) { + body = input._bodyInit; + input.bodyUsed = true; + } + } else { + this.url = String(input); + } + + this.credentials = options.credentials || this.credentials || 'same-origin'; + if (options.headers || !this.headers) { + this.headers = new Headers(options.headers); + } + this.method = normalizeMethod(options.method || this.method || 'GET'); + this.mode = options.mode || this.mode || null; + this.signal = options.signal || this.signal || (function () { + if ('AbortController' in g) { + var ctrl = new AbortController(); + return ctrl.signal; + } + }()); + this.referrer = null; + + if ((this.method === 'GET' || this.method === 'HEAD') && body) { + throw new TypeError('Body not allowed for GET or HEAD requests') + } + this._initBody(body); + + if (this.method === 'GET' || this.method === 'HEAD') { + if (options.cache === 'no-store' || options.cache === 'no-cache') { + // Search for a '_' parameter in the query string + var reParamSearch = /([?&])_=[^&]*/; + if (reParamSearch.test(this.url)) { + // If it already exists then set the value with the current time + this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime()); + } else { + // Otherwise add a new '_' parameter to the end with the current time + var reQueryString = /\?/; + this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime(); + } + } + } + } + + Request.prototype.clone = function() { + return new Request(this, {body: this._bodyInit}) + }; + + function decode(body) { + var form = new FormData(); + body + .trim() + .split('&') + .forEach(function(bytes) { + if (bytes) { + var split = bytes.split('='); + var name = split.shift().replace(/\+/g, ' '); + var value = split.join('=').replace(/\+/g, ' '); + form.append(decodeURIComponent(name), decodeURIComponent(value)); + } + }); + return form + } + + function parseHeaders(rawHeaders) { + var headers = new Headers(); + // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space + // https://tools.ietf.org/html/rfc7230#section-3.2 + var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); + // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill + // https://github.com/github/fetch/issues/748 + // https://github.com/zloirock/core-js/issues/751 + preProcessedHeaders + .split('\r') + .map(function(header) { + return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header + }) + .forEach(function(line) { + var parts = line.split(':'); + var key = parts.shift().trim(); + if (key) { + var value = parts.join(':').trim(); + try { + headers.append(key, value); + } catch (error) { + console.warn('Response ' + error.message); + } + } + }); + return headers + } + + Body.call(Request.prototype); + + function Response(bodyInit, options) { + if (!(this instanceof Response)) { + throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') + } + if (!options) { + options = {}; + } + + this.type = 'default'; + this.status = options.status === undefined ? 200 : options.status; + if (this.status < 200 || this.status > 599) { + throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].") + } + this.ok = this.status >= 200 && this.status < 300; + this.statusText = options.statusText === undefined ? '' : '' + options.statusText; + this.headers = new Headers(options.headers); + this.url = options.url || ''; + this._initBody(bodyInit); + } + + Body.call(Response.prototype); + + Response.prototype.clone = function() { + return new Response(this._bodyInit, { + status: this.status, + statusText: this.statusText, + headers: new Headers(this.headers), + url: this.url + }) + }; + + Response.error = function() { + var response = new Response(null, {status: 200, statusText: ''}); + response.ok = false; + response.status = 0; + response.type = 'error'; + return response + }; + + var redirectStatuses = [301, 302, 303, 307, 308]; + + Response.redirect = function(url, status) { + if (redirectStatuses.indexOf(status) === -1) { + throw new RangeError('Invalid status code') + } + + return new Response(null, {status: status, headers: {location: url}}) + }; + + exports$1.DOMException = g.DOMException; + try { + new exports$1.DOMException(); + } catch (err) { + exports$1.DOMException = function(message, name) { + this.message = message; + this.name = name; + var error = Error(message); + this.stack = error.stack; + }; + exports$1.DOMException.prototype = Object.create(Error.prototype); + exports$1.DOMException.prototype.constructor = exports$1.DOMException; + } + + function fetch(input, init) { + return new Promise(function(resolve, reject) { + var request = new Request(input, init); + + if (request.signal && request.signal.aborted) { + return reject(new exports$1.DOMException('Aborted', 'AbortError')) + } + + var xhr = new XMLHttpRequest(); + + function abortXhr() { + xhr.abort(); + } + + xhr.onload = function() { + var options = { + statusText: xhr.statusText, + headers: parseHeaders(xhr.getAllResponseHeaders() || '') + }; + // This check if specifically for when a user fetches a file locally from the file system + // Only if the status is out of a normal range + if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) { + options.status = 200; + } else { + options.status = xhr.status; + } + options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); + var body = 'response' in xhr ? xhr.response : xhr.responseText; + setTimeout(function() { + resolve(new Response(body, options)); + }, 0); + }; + + xhr.onerror = function() { + setTimeout(function() { + reject(new TypeError('Network request failed')); + }, 0); + }; + + xhr.ontimeout = function() { + setTimeout(function() { + reject(new TypeError('Network request timed out')); + }, 0); + }; + + xhr.onabort = function() { + setTimeout(function() { + reject(new exports$1.DOMException('Aborted', 'AbortError')); + }, 0); + }; + + function fixUrl(url) { + try { + return url === '' && g.location.href ? g.location.href : url + } catch (e) { + return url + } + } + + xhr.open(request.method, fixUrl(request.url), true); + + if (request.credentials === 'include') { + xhr.withCredentials = true; + } else if (request.credentials === 'omit') { + xhr.withCredentials = false; + } + + if ('responseType' in xhr) { + if (support.blob) { + xhr.responseType = 'blob'; + } else if ( + support.arrayBuffer + ) { + xhr.responseType = 'arraybuffer'; + } + } + + if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) { + var names = []; + Object.getOwnPropertyNames(init.headers).forEach(function(name) { + names.push(normalizeName(name)); + xhr.setRequestHeader(name, normalizeValue(init.headers[name])); + }); + request.headers.forEach(function(value, name) { + if (names.indexOf(name) === -1) { + xhr.setRequestHeader(name, value); + } + }); + } else { + request.headers.forEach(function(value, name) { + xhr.setRequestHeader(name, value); + }); + } + + if (request.signal) { + request.signal.addEventListener('abort', abortXhr); + + xhr.onreadystatechange = function() { + // DONE (success or failure) + if (xhr.readyState === 4) { + request.signal.removeEventListener('abort', abortXhr); + } + }; + } + + xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); + }) + } + + fetch.polyfill = true; + + if (!g.fetch) { + g.fetch = fetch; + g.Headers = Headers; + g.Request = Request; + g.Response = Response; + } + + exports$1.Headers = Headers; + exports$1.Request = Request; + exports$1.Response = Response; + exports$1.fetch = fetch; + + Object.defineProperty(exports$1, '__esModule', { value: true }); + + return exports$1; + + }))({}); + })(__globalThis__); + // This is a ponyfill, so... + __globalThis__.fetch.ponyfill = true; + delete __globalThis__.fetch.polyfill; + // Choose between native implementation (__global__) or custom implementation (__globalThis__) + var ctx = __global__.fetch ? __global__ : __globalThis__; + exports$1 = ctx.fetch; // To enable: import fetch from 'cross-fetch' + exports$1.default = ctx.fetch; // For TypeScript consumers without esModuleInterop. + exports$1.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch' + exports$1.Headers = ctx.Headers; + exports$1.Request = ctx.Request; + exports$1.Response = ctx.Response; + module.exports = exports$1; + } (browserPonyfill, browserPonyfill.exports)); + return browserPonyfill.exports; +} + +var require$$1 = /*@__PURE__*/getAugmentedNamespace(printer); + +var createRequestBody = {}; + +var _public = {}; + +var ReactNativeFile; +var hasRequiredReactNativeFile; + +function requireReactNativeFile () { + if (hasRequiredReactNativeFile) return ReactNativeFile; + hasRequiredReactNativeFile = 1; + + ReactNativeFile = function ReactNativeFile(_ref) { + var uri = _ref.uri, + name = _ref.name, + type = _ref.type; + this.uri = uri; + this.name = name; + this.type = type; + }; + return ReactNativeFile; +} + +var isExtractableFile; +var hasRequiredIsExtractableFile; + +function requireIsExtractableFile () { + if (hasRequiredIsExtractableFile) return isExtractableFile; + hasRequiredIsExtractableFile = 1; + + var ReactNativeFile = /*@__PURE__*/ requireReactNativeFile(); + + isExtractableFile = function isExtractableFile(value) { + return ( + (typeof File !== 'undefined' && value instanceof File) || + (typeof Blob !== 'undefined' && value instanceof Blob) || + value instanceof ReactNativeFile + ); + }; + return isExtractableFile; +} + +var extractFiles; +var hasRequiredExtractFiles; + +function requireExtractFiles () { + if (hasRequiredExtractFiles) return extractFiles; + hasRequiredExtractFiles = 1; + + var defaultIsExtractableFile = /*@__PURE__*/ requireIsExtractableFile(); + + extractFiles = function extractFiles(value, path, isExtractableFile) { + if (path === void 0) { + path = ''; + } + + if (isExtractableFile === void 0) { + isExtractableFile = defaultIsExtractableFile; + } + + var clone; + var files = new Map(); + + function addFile(paths, file) { + var storedPaths = files.get(file); + if (storedPaths) storedPaths.push.apply(storedPaths, paths); + else files.set(file, paths); + } + + if (isExtractableFile(value)) { + clone = null; + addFile([path], value); + } else { + var prefix = path ? path + '.' : ''; + if (typeof FileList !== 'undefined' && value instanceof FileList) + clone = Array.prototype.map.call(value, function (file, i) { + addFile(['' + prefix + i], file); + return null; + }); + else if (Array.isArray(value)) + clone = value.map(function (child, i) { + var result = extractFiles(child, '' + prefix + i, isExtractableFile); + result.files.forEach(addFile); + return result.clone; + }); + else if (value && value.constructor === Object) { + clone = {}; + + for (var i in value) { + var result = extractFiles(value[i], '' + prefix + i, isExtractableFile); + result.files.forEach(addFile); + clone[i] = result.clone; + } + } else clone = value; + } + + return { + clone: clone, + files: files, + }; + }; + return extractFiles; +} + +var hasRequired_public; + +function require_public () { + if (hasRequired_public) return _public; + hasRequired_public = 1; + + _public.ReactNativeFile = /*@__PURE__*/ requireReactNativeFile(); + _public.extractFiles = /*@__PURE__*/ requireExtractFiles(); + _public.isExtractableFile = /*@__PURE__*/ requireIsExtractableFile(); + return _public; +} + +var browser$1; +var hasRequiredBrowser$1; + +function requireBrowser$1 () { + if (hasRequiredBrowser$1) return browser$1; + hasRequiredBrowser$1 = 1; + + /* eslint-env browser */ + browser$1 = typeof self === 'object' ? self.FormData : window.FormData; + return browser$1; +} + +var hasRequiredCreateRequestBody; + +function requireCreateRequestBody () { + if (hasRequiredCreateRequestBody) return createRequestBody; + hasRequiredCreateRequestBody = 1; + var __importDefault = (createRequestBody && createRequestBody.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + Object.defineProperty(createRequestBody, "__esModule", { value: true }); + var extract_files_1 = /*@__PURE__*/ require_public(); + var form_data_1 = __importDefault(requireBrowser$1()); + /** + * Duck type if NodeJS stream + * https://github.com/sindresorhus/is-stream/blob/3750505b0727f6df54324784fe369365ef78841e/index.js#L3 + */ + var isExtractableFileEnhanced = function (value) { + return extract_files_1.isExtractableFile(value) || + (value !== null && typeof value === 'object' && typeof value.pipe === 'function'); + }; + /** + * Returns Multipart Form if body contains files + * (https://github.com/jaydenseric/graphql-multipart-request-spec) + * Otherwise returns JSON + */ + function createRequestBody$1(query, variables, operationName) { + var _a = extract_files_1.extractFiles({ query: query, variables: variables, operationName: operationName }, '', isExtractableFileEnhanced), clone = _a.clone, files = _a.files; + if (files.size === 0) { + if (!Array.isArray(query)) { + return JSON.stringify(clone); + } + if (typeof variables !== 'undefined' && !Array.isArray(variables)) { + throw new Error('Cannot create request body with given variable type, array expected'); + } + // Batch support + var payload = query.reduce(function (accu, currentQuery, index) { + accu.push({ query: currentQuery, variables: variables ? variables[index] : undefined }); + return accu; + }, []); + return JSON.stringify(payload); + } + var Form = typeof FormData === 'undefined' ? form_data_1.default : FormData; + var form = new Form(); + form.append('operations', JSON.stringify(clone)); + var map = {}; + var i = 0; + files.forEach(function (paths) { + map[++i] = paths; + }); + form.append('map', JSON.stringify(map)); + i = 0; + files.forEach(function (paths, file) { + form.append("" + ++i, file); + }); + return form; + } + createRequestBody.default = createRequestBody$1; + + return createRequestBody; +} + +var types = {}; + +var hasRequiredTypes; + +function requireTypes () { + if (hasRequiredTypes) return types; + hasRequiredTypes = 1; + var __extends = (types && types.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + Object.defineProperty(types, "__esModule", { value: true }); + types.ClientError = void 0; + var ClientError = /** @class */ (function (_super) { + __extends(ClientError, _super); + function ClientError(response, request) { + var _this = this; + var message = ClientError.extractMessage(response) + ": " + JSON.stringify({ + response: response, + request: request, + }); + _this = _super.call(this, message) || this; + Object.setPrototypeOf(_this, ClientError.prototype); + _this.response = response; + _this.request = request; + // this is needed as Safari doesn't support .captureStackTrace + if (typeof Error.captureStackTrace === 'function') { + Error.captureStackTrace(_this, ClientError); + } + return _this; + } + ClientError.extractMessage = function (response) { + try { + return response.errors[0].message; + } + catch (e) { + return "GraphQL Error (Code: " + response.status + ")"; + } + }; + return ClientError; + }(Error)); + types.ClientError = ClientError; + + return types; +} + +var hasRequiredDist; + +function requireDist () { + if (hasRequiredDist) return dist; + hasRequiredDist = 1; + (function (exports$1) { + var __assign = (dist && dist.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); + }; + var __createBinding = (dist && dist.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); + }) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; + })); + var __setModuleDefault = (dist && dist.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }); + var __importStar = (dist && dist.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; + }; + var __awaiter = (dist && dist.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = (dist && dist.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __rest = (dist && dist.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + var __importDefault = (dist && dist.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + Object.defineProperty(exports$1, "__esModule", { value: true }); + exports$1.gql = exports$1.batchRequests = exports$1.request = exports$1.rawRequest = exports$1.GraphQLClient = exports$1.ClientError = void 0; + var cross_fetch_1 = __importStar(requireBrowserPonyfill()), CrossFetch = cross_fetch_1; + var printer_1 = require$$1; + var createRequestBody_1 = __importDefault(requireCreateRequestBody()); + var types_1 = requireTypes(); + Object.defineProperty(exports$1, "ClientError", { enumerable: true, get: function () { return types_1.ClientError; } }); + /** + * Convert the given headers configuration into a plain object. + */ + var resolveHeaders = function (headers) { + var oHeaders = {}; + if (headers) { + if ((typeof Headers !== 'undefined' && headers instanceof Headers) || + headers instanceof CrossFetch.Headers) { + oHeaders = HeadersInstanceToPlainObject(headers); + } + else if (Array.isArray(headers)) { + headers.forEach(function (_a) { + var name = _a[0], value = _a[1]; + oHeaders[name] = value; + }); + } + else { + oHeaders = headers; + } + } + return oHeaders; + }; + /** + * Clean a GraphQL document to send it via a GET query + * + * @param {string} str GraphQL query + * @returns {string} Cleaned query + */ + var queryCleanner = function (str) { return str.replace(/([\s,]|#[^\n\r]+)+/g, ' ').trim(); }; + /** + * Create query string for GraphQL request + * + * @param {object} param0 - + * + * @param {string|string[]} param0.query the GraphQL document or array of document if it's a batch request + * @param {string|undefined} param0.operationName the GraphQL operation name + * @param {any|any[]} param0.variables the GraphQL variables to use + */ + var buildGetQueryParams = function (_a) { + var query = _a.query, variables = _a.variables, operationName = _a.operationName; + if (!Array.isArray(query)) { + var search = ["query=" + encodeURIComponent(queryCleanner(query))]; + if (variables) { + search.push("variables=" + encodeURIComponent(JSON.stringify(variables))); + } + if (operationName) { + search.push("operationName=" + encodeURIComponent(operationName)); + } + return search.join('&'); + } + if (typeof variables !== 'undefined' && !Array.isArray(variables)) { + throw new Error('Cannot create query with given variable type, array expected'); + } + // Batch support + var payload = query.reduce(function (accu, currentQuery, index) { + accu.push({ + query: queryCleanner(currentQuery), + variables: variables ? JSON.stringify(variables[index]) : undefined, + }); + return accu; + }, []); + return "query=" + encodeURIComponent(JSON.stringify(payload)); + }; + /** + * Fetch data using POST method + */ + var post = function (_a) { + var url = _a.url, query = _a.query, variables = _a.variables, operationName = _a.operationName, headers = _a.headers, fetch = _a.fetch, fetchOptions = _a.fetchOptions; + return __awaiter(void 0, void 0, void 0, function () { + var body; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + body = createRequestBody_1.default(query, variables, operationName); + return [4 /*yield*/, fetch(url, __assign({ method: 'POST', headers: __assign(__assign({}, (typeof body === 'string' ? { 'Content-Type': 'application/json' } : {})), headers), body: body }, fetchOptions))]; + case 1: return [2 /*return*/, _b.sent()]; + } + }); + }); + }; + /** + * Fetch data using GET method + */ + var get = function (_a) { + var url = _a.url, query = _a.query, variables = _a.variables, operationName = _a.operationName, headers = _a.headers, fetch = _a.fetch, fetchOptions = _a.fetchOptions; + return __awaiter(void 0, void 0, void 0, function () { + var queryParams; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + queryParams = buildGetQueryParams({ + query: query, + variables: variables, + operationName: operationName, + }); + return [4 /*yield*/, fetch(url + "?" + queryParams, __assign({ method: 'GET', headers: headers }, fetchOptions))]; + case 1: return [2 /*return*/, _b.sent()]; + } + }); + }); + }; + /** + * todo + */ + var GraphQLClient = /** @class */ (function () { + function GraphQLClient(url, options) { + this.url = url; + this.options = options || {}; + } + GraphQLClient.prototype.rawRequest = function (query, variables, requestHeaders) { + var _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, ["headers", "fetch", "method"]); + var url = this.url; + return makeRequest({ + url: url, + query: query, + variables: variables, + headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(requestHeaders)), + operationName: undefined, + fetch: fetch, + method: method, + fetchOptions: fetchOptions, + }); + }; + /** + * Send a GraphQL document to the server. + */ + GraphQLClient.prototype.request = function (document, variables, requestHeaders) { + return __awaiter(this, void 0, void 0, function () { + var _a, headers, _b, fetch, _c, method, fetchOptions, url, _d, query, operationName, data; + return __generator(this, function (_e) { + switch (_e.label) { + case 0: + _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, ["headers", "fetch", "method"]); + url = this.url; + _d = resolveRequestDocument(document), query = _d.query, operationName = _d.operationName; + return [4 /*yield*/, makeRequest({ + url: url, + query: query, + variables: variables, + headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(requestHeaders)), + operationName: operationName, + fetch: fetch, + method: method, + fetchOptions: fetchOptions, + })]; + case 1: + data = (_e.sent()).data; + return [2 /*return*/, data]; + } + }); + }); + }; + /** + * Send a GraphQL document to the server. + */ + GraphQLClient.prototype.batchRequests = function (documents, requestHeaders) { + return __awaiter(this, void 0, void 0, function () { + var _a, headers, _b, fetch, _c, method, fetchOptions, url, queries, variables, data; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, ["headers", "fetch", "method"]); + url = this.url; + queries = documents.map(function (_a) { + var document = _a.document; + return resolveRequestDocument(document).query; + }); + variables = documents.map(function (_a) { + var variables = _a.variables; + return variables; + }); + return [4 /*yield*/, makeRequest({ + url: url, + query: queries, + variables: variables, + headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(requestHeaders)), + operationName: undefined, + fetch: fetch, + method: method, + fetchOptions: fetchOptions, + })]; + case 1: + data = (_d.sent()).data; + return [2 /*return*/, data]; + } + }); + }); + }; + GraphQLClient.prototype.setHeaders = function (headers) { + this.options.headers = headers; + return this; + }; + /** + * Attach a header to the client. All subsequent requests will have this header. + */ + GraphQLClient.prototype.setHeader = function (key, value) { + var _a; + var headers = this.options.headers; + if (headers) { + // todo what if headers is in nested array form... ? + //@ts-ignore + headers[key] = value; + } + else { + this.options.headers = (_a = {}, _a[key] = value, _a); + } + return this; + }; + /** + * Change the client endpoint. All subsequent requests will send to this endpoint. + */ + GraphQLClient.prototype.setEndpoint = function (value) { + this.url = value; + return this; + }; + return GraphQLClient; + }()); + exports$1.GraphQLClient = GraphQLClient; + function makeRequest(_a) { + var url = _a.url, query = _a.query, variables = _a.variables, headers = _a.headers, operationName = _a.operationName, fetch = _a.fetch, _b = _a.method, method = _b === void 0 ? 'POST' : _b, fetchOptions = _a.fetchOptions; + return __awaiter(this, void 0, void 0, function () { + var fetcher, isBathchingQuery, response, result, successfullyReceivedData, headers_1, status_1, errorResult; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + fetcher = method.toUpperCase() === 'POST' ? post : get; + isBathchingQuery = Array.isArray(query); + return [4 /*yield*/, fetcher({ + url: url, + query: query, + variables: variables, + operationName: operationName, + headers: headers, + fetch: fetch, + fetchOptions: fetchOptions, + })]; + case 1: + response = _c.sent(); + return [4 /*yield*/, getResult(response)]; + case 2: + result = _c.sent(); + successfullyReceivedData = isBathchingQuery && Array.isArray(result) ? !result.some(function (_a) { + var data = _a.data; + return !data; + }) : !!result.data; + if (response.ok && !result.errors && successfullyReceivedData) { + headers_1 = response.headers, status_1 = response.status; + return [2 /*return*/, __assign(__assign({}, (isBathchingQuery ? { data: result } : result)), { headers: headers_1, status: status_1 })]; + } + else { + errorResult = typeof result === 'string' ? { error: result } : result; + throw new types_1.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables }); + } + } + }); + }); + } + /** + * todo + */ + function rawRequest(url, query, variables, requestHeaders) { + return __awaiter(this, void 0, void 0, function () { + var client; + return __generator(this, function (_a) { + client = new GraphQLClient(url); + return [2 /*return*/, client.rawRequest(query, variables, requestHeaders)]; + }); + }); + } + exports$1.rawRequest = rawRequest; + /** + * Send a GraphQL Document to the GraphQL server for exectuion. + * + * @example + * + * ```ts + * // You can pass a raw string + * + * await request('https://foo.bar/graphql', ` + * { + * query { + * users + * } + * } + * `) + * + * // You can also pass a GraphQL DocumentNode. Convenient if you + * // are using graphql-tag package. + * + * import gql from 'graphql-tag' + * + * await request('https://foo.bar/graphql', gql`...`) + * + * // If you don't actually care about using DocumentNode but just + * // want the tooling support for gql template tag like IDE syntax + * // coloring and prettier autoformat then note you can use the + * // passthrough gql tag shipped with graphql-request to save a bit + * // of performance and not have to install another dep into your project. + * + * import { gql } from 'graphql-request' + * + * await request('https://foo.bar/graphql', gql`...`) + * ``` + */ + function request(url, document, variables, requestHeaders) { + return __awaiter(this, void 0, void 0, function () { + var client; + return __generator(this, function (_a) { + client = new GraphQLClient(url); + return [2 /*return*/, client.request(document, variables, requestHeaders)]; + }); + }); + } + exports$1.request = request; + /** + * Send a batch of GraphQL Document to the GraphQL server for exectuion. + * + * @example + * + * ```ts + * // You can pass a raw string + * + * await batchRequests('https://foo.bar/graphql', [ + * { + * query: ` + * { + * query { + * users + * } + * }` + * }, + * { + * query: ` + * { + * query { + * users + * } + * }` + * }]) + * + * // You can also pass a GraphQL DocumentNode as query. Convenient if you + * // are using graphql-tag package. + * + * import gql from 'graphql-tag' + * + * await batchRequests('https://foo.bar/graphql', [{ query: gql`...` }]) + * ``` + */ + function batchRequests(url, documents, requestHeaders) { + return __awaiter(this, void 0, void 0, function () { + var client; + return __generator(this, function (_a) { + client = new GraphQLClient(url); + return [2 /*return*/, client.batchRequests(documents, requestHeaders)]; + }); + }); + } + exports$1.batchRequests = batchRequests; + exports$1.default = request; + /** + * todo + */ + function getResult(response) { + var contentType = response.headers.get('Content-Type'); + if (contentType && contentType.startsWith('application/json')) { + return response.json(); + } + else { + return response.text(); + } + } + /** + * helpers + */ + function resolveRequestDocument(document) { + var _a; + if (typeof document === 'string') + return { query: document }; + var operationName = undefined; + var operationDefinitions = document.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; }); + if (operationDefinitions.length === 1) { + operationName = (_a = operationDefinitions[0].name) === null || _a === void 0 ? void 0 : _a.value; + } + return { query: printer_1.print(document), operationName: operationName }; + } + /** + * Convenience passthrough template tag to get the benefits of tooling for the gql template tag. This does not actually parse the input into a GraphQL DocumentNode like graphql-tag package does. It just returns the string with any variables given interpolated. Can save you a bit of performance and having to install another package. + * + * @example + * + * import { gql } from 'graphql-request' + * + * await request('https://foo.bar/graphql', gql`...`) + * + * @remarks + * + * Several tools in the Node GraphQL ecosystem are hardcoded to specially treat any template tag named "gql". For example see this prettier issue: https://github.com/prettier/prettier/issues/4360. Using this template tag has no runtime effect beyond variable interpolation. + */ + function gql(chunks) { + var variables = []; + for (var _i = 1; _i < arguments.length; _i++) { + variables[_i - 1] = arguments[_i]; + } + return chunks.reduce(function (accumulator, chunk, index) { return "" + accumulator + chunk + (index in variables ? variables[index] : ''); }, ''); + } + exports$1.gql = gql; + /** + * Convert Headers instance into regular object + */ + function HeadersInstanceToPlainObject(headers) { + var o = {}; + headers.forEach(function (v, k) { + o[k] = v; + }); + return o; + } + + } (dist)); + return dist; +} + +var distExports = requireDist(); + +var typesExports = requireTypes(); + +let nanoid = (size = 21) => + crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { + byte &= 63; + if (byte < 36) { + id += byte.toString(36); + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase(); + } else if (byte > 62) { + id += '-'; + } else { + id += '_'; + } + return id + }, ''); + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +function isFunction(x) { + return typeof x === 'function'; +} + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +var _enable_super_gross_mode_that_will_cause_bad_things = false; +var config = { + set useDeprecatedSynchronousErrorHandling(value) { + if (value) { + var error = /*@__PURE__*/ new Error(); + /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack); + } + _enable_super_gross_mode_that_will_cause_bad_things = value; + }, + get useDeprecatedSynchronousErrorHandling() { + return _enable_super_gross_mode_that_will_cause_bad_things; + }, +}; + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +function hostReportError(err) { + setTimeout(function () { throw err; }, 0); +} + +/** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */ +var empty = { + closed: true, + next: function (value) { }, + error: function (err) { + if (config.useDeprecatedSynchronousErrorHandling) { + throw err; + } + else { + hostReportError(err); + } + }, + complete: function () { } +}; + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })(); + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +function isObject(x) { + return x !== null && typeof x === 'object'; +} + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +var UnsubscriptionErrorImpl = /*@__PURE__*/ (function () { + function UnsubscriptionErrorImpl(errors) { + Error.call(this); + this.message = errors ? + errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : ''; + this.name = 'UnsubscriptionError'; + this.errors = errors; + return this; + } + UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype); + return UnsubscriptionErrorImpl; +})(); +var UnsubscriptionError = UnsubscriptionErrorImpl; + +/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */ +var Subscription = /*@__PURE__*/ (function () { + function Subscription(unsubscribe) { + this.closed = false; + this._parentOrParents = null; + this._subscriptions = null; + if (unsubscribe) { + this._ctorUnsubscribe = true; + this._unsubscribe = unsubscribe; + } + } + Subscription.prototype.unsubscribe = function () { + var errors; + if (this.closed) { + return; + } + var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions; + this.closed = true; + this._parentOrParents = null; + this._subscriptions = null; + if (_parentOrParents instanceof Subscription) { + _parentOrParents.remove(this); + } + else if (_parentOrParents !== null) { + for (var index = 0; index < _parentOrParents.length; ++index) { + var parent_1 = _parentOrParents[index]; + parent_1.remove(this); + } + } + if (isFunction(_unsubscribe)) { + if (_ctorUnsubscribe) { + this._unsubscribe = undefined; + } + try { + _unsubscribe.call(this); + } + catch (e) { + errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e]; + } + } + if (isArray(_subscriptions)) { + var index = -1; + var len = _subscriptions.length; + while (++index < len) { + var sub = _subscriptions[index]; + if (isObject(sub)) { + try { + sub.unsubscribe(); + } + catch (e) { + errors = errors || []; + if (e instanceof UnsubscriptionError) { + errors = errors.concat(flattenUnsubscriptionErrors(e.errors)); + } + else { + errors.push(e); + } + } + } + } + } + if (errors) { + throw new UnsubscriptionError(errors); + } + }; + Subscription.prototype.add = function (teardown) { + var subscription = teardown; + if (!teardown) { + return Subscription.EMPTY; + } + switch (typeof teardown) { + case 'function': + subscription = new Subscription(teardown); + case 'object': + if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') { + return subscription; + } + else if (this.closed) { + subscription.unsubscribe(); + return subscription; + } + else if (!(subscription instanceof Subscription)) { + var tmp = subscription; + subscription = new Subscription(); + subscription._subscriptions = [tmp]; + } + break; + default: { + throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); + } + } + var _parentOrParents = subscription._parentOrParents; + if (_parentOrParents === null) { + subscription._parentOrParents = this; + } + else if (_parentOrParents instanceof Subscription) { + if (_parentOrParents === this) { + return subscription; + } + subscription._parentOrParents = [_parentOrParents, this]; + } + else if (_parentOrParents.indexOf(this) === -1) { + _parentOrParents.push(this); + } + else { + return subscription; + } + var subscriptions = this._subscriptions; + if (subscriptions === null) { + this._subscriptions = [subscription]; + } + else { + subscriptions.push(subscription); + } + return subscription; + }; + Subscription.prototype.remove = function (subscription) { + var subscriptions = this._subscriptions; + if (subscriptions) { + var subscriptionIndex = subscriptions.indexOf(subscription); + if (subscriptionIndex !== -1) { + subscriptions.splice(subscriptionIndex, 1); + } + } + }; + Subscription.EMPTY = (function (empty) { + empty.closed = true; + return empty; + }(new Subscription())); + return Subscription; +}()); +function flattenUnsubscriptionErrors(errors) { + return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []); +} + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +var rxSubscriber = /*@__PURE__*/ (function () { + return typeof Symbol === 'function' + ? /*@__PURE__*/ Symbol('rxSubscriber') + : '@@rxSubscriber_' + /*@__PURE__*/ Math.random(); +})(); + +/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */ +var Subscriber = /*@__PURE__*/ (function (_super) { + __extends(Subscriber, _super); + function Subscriber(destinationOrNext, error, complete) { + var _this = _super.call(this) || this; + _this.syncErrorValue = null; + _this.syncErrorThrown = false; + _this.syncErrorThrowable = false; + _this.isStopped = false; + switch (arguments.length) { + case 0: + _this.destination = empty; + break; + case 1: + if (!destinationOrNext) { + _this.destination = empty; + break; + } + if (typeof destinationOrNext === 'object') { + if (destinationOrNext instanceof Subscriber) { + _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable; + _this.destination = destinationOrNext; + destinationOrNext.add(_this); + } + else { + _this.syncErrorThrowable = true; + _this.destination = new SafeSubscriber(_this, destinationOrNext); + } + break; + } + default: + _this.syncErrorThrowable = true; + _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete); + break; + } + return _this; + } + Subscriber.prototype[rxSubscriber] = function () { return this; }; + Subscriber.create = function (next, error, complete) { + var subscriber = new Subscriber(next, error, complete); + subscriber.syncErrorThrowable = false; + return subscriber; + }; + Subscriber.prototype.next = function (value) { + if (!this.isStopped) { + this._next(value); + } + }; + Subscriber.prototype.error = function (err) { + if (!this.isStopped) { + this.isStopped = true; + this._error(err); + } + }; + Subscriber.prototype.complete = function () { + if (!this.isStopped) { + this.isStopped = true; + this._complete(); + } + }; + Subscriber.prototype.unsubscribe = function () { + if (this.closed) { + return; + } + this.isStopped = true; + _super.prototype.unsubscribe.call(this); + }; + Subscriber.prototype._next = function (value) { + this.destination.next(value); + }; + Subscriber.prototype._error = function (err) { + this.destination.error(err); + this.unsubscribe(); + }; + Subscriber.prototype._complete = function () { + this.destination.complete(); + this.unsubscribe(); + }; + Subscriber.prototype._unsubscribeAndRecycle = function () { + var _parentOrParents = this._parentOrParents; + this._parentOrParents = null; + this.unsubscribe(); + this.closed = false; + this.isStopped = false; + this._parentOrParents = _parentOrParents; + return this; + }; + return Subscriber; +}(Subscription)); +var SafeSubscriber = /*@__PURE__*/ (function (_super) { + __extends(SafeSubscriber, _super); + function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { + var _this = _super.call(this) || this; + _this._parentSubscriber = _parentSubscriber; + var next; + var context = _this; + if (isFunction(observerOrNext)) { + next = observerOrNext; + } + else if (observerOrNext) { + next = observerOrNext.next; + error = observerOrNext.error; + complete = observerOrNext.complete; + if (observerOrNext !== empty) { + context = Object.create(observerOrNext); + if (isFunction(context.unsubscribe)) { + _this.add(context.unsubscribe.bind(context)); + } + context.unsubscribe = _this.unsubscribe.bind(_this); + } + } + _this._context = context; + _this._next = next; + _this._error = error; + _this._complete = complete; + return _this; + } + SafeSubscriber.prototype.next = function (value) { + if (!this.isStopped && this._next) { + var _parentSubscriber = this._parentSubscriber; + if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { + this.__tryOrUnsub(this._next, value); + } + else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { + this.unsubscribe(); + } + } + }; + SafeSubscriber.prototype.error = function (err) { + if (!this.isStopped) { + var _parentSubscriber = this._parentSubscriber; + var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling; + if (this._error) { + if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { + this.__tryOrUnsub(this._error, err); + this.unsubscribe(); + } + else { + this.__tryOrSetError(_parentSubscriber, this._error, err); + this.unsubscribe(); + } + } + else if (!_parentSubscriber.syncErrorThrowable) { + this.unsubscribe(); + if (useDeprecatedSynchronousErrorHandling) { + throw err; + } + hostReportError(err); + } + else { + if (useDeprecatedSynchronousErrorHandling) { + _parentSubscriber.syncErrorValue = err; + _parentSubscriber.syncErrorThrown = true; + } + else { + hostReportError(err); + } + this.unsubscribe(); + } + } + }; + SafeSubscriber.prototype.complete = function () { + var _this = this; + if (!this.isStopped) { + var _parentSubscriber = this._parentSubscriber; + if (this._complete) { + var wrappedComplete = function () { return _this._complete.call(_this._context); }; + if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { + this.__tryOrUnsub(wrappedComplete); + this.unsubscribe(); + } + else { + this.__tryOrSetError(_parentSubscriber, wrappedComplete); + this.unsubscribe(); + } + } + else { + this.unsubscribe(); + } + } + }; + SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) { + try { + fn.call(this._context, value); + } + catch (err) { + this.unsubscribe(); + if (config.useDeprecatedSynchronousErrorHandling) { + throw err; + } + else { + hostReportError(err); + } + } + }; + SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { + if (!config.useDeprecatedSynchronousErrorHandling) { + throw new Error('bad call'); + } + try { + fn.call(this._context, value); + } + catch (err) { + if (config.useDeprecatedSynchronousErrorHandling) { + parent.syncErrorValue = err; + parent.syncErrorThrown = true; + return true; + } + else { + hostReportError(err); + return true; + } + } + return false; + }; + SafeSubscriber.prototype._unsubscribe = function () { + var _parentSubscriber = this._parentSubscriber; + this._context = null; + this._parentSubscriber = null; + _parentSubscriber.unsubscribe(); + }; + return SafeSubscriber; +}(Subscriber)); + +/** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */ +function canReportError(observer) { + while (observer) { + var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped; + if (closed_1 || isStopped) { + return false; + } + else if (destination && destination instanceof Subscriber) { + observer = destination; + } + else { + observer = null; + } + } + return true; +} + +/** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */ +function toSubscriber(nextOrObserver, error, complete) { + if (nextOrObserver) { + if (nextOrObserver instanceof Subscriber) { + return nextOrObserver; + } + if (nextOrObserver[rxSubscriber]) { + return nextOrObserver[rxSubscriber](); + } + } + if (!nextOrObserver && !error && !complete) { + return new Subscriber(empty); + } + return new Subscriber(nextOrObserver, error, complete); +} + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })(); + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +function identity(x) { + return x; +} + +/** PURE_IMPORTS_START _identity PURE_IMPORTS_END */ +function pipeFromArray(fns) { + if (fns.length === 0) { + return identity; + } + if (fns.length === 1) { + return fns[0]; + } + return function piped(input) { + return fns.reduce(function (prev, fn) { return fn(prev); }, input); + }; +} + +/** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */ +var Observable = /*@__PURE__*/ (function () { + function Observable(subscribe) { + this._isScalar = false; + if (subscribe) { + this._subscribe = subscribe; + } + } + Observable.prototype.lift = function (operator) { + var observable = new Observable(); + observable.source = this; + observable.operator = operator; + return observable; + }; + Observable.prototype.subscribe = function (observerOrNext, error, complete) { + var operator = this.operator; + var sink = toSubscriber(observerOrNext, error, complete); + if (operator) { + sink.add(operator.call(sink, this.source)); + } + else { + sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ? + this._subscribe(sink) : + this._trySubscribe(sink)); + } + if (config.useDeprecatedSynchronousErrorHandling) { + if (sink.syncErrorThrowable) { + sink.syncErrorThrowable = false; + if (sink.syncErrorThrown) { + throw sink.syncErrorValue; + } + } + } + return sink; + }; + Observable.prototype._trySubscribe = function (sink) { + try { + return this._subscribe(sink); + } + catch (err) { + if (config.useDeprecatedSynchronousErrorHandling) { + sink.syncErrorThrown = true; + sink.syncErrorValue = err; + } + if (canReportError(sink)) { + sink.error(err); + } + else { + console.warn(err); + } + } + }; + Observable.prototype.forEach = function (next, promiseCtor) { + var _this = this; + promiseCtor = getPromiseCtor(promiseCtor); + return new promiseCtor(function (resolve, reject) { + var subscription; + subscription = _this.subscribe(function (value) { + try { + next(value); + } + catch (err) { + reject(err); + if (subscription) { + subscription.unsubscribe(); + } + } + }, reject, resolve); + }); + }; + Observable.prototype._subscribe = function (subscriber) { + var source = this.source; + return source && source.subscribe(subscriber); + }; + Observable.prototype[observable] = function () { + return this; + }; + Observable.prototype.pipe = function () { + var operations = []; + for (var _i = 0; _i < arguments.length; _i++) { + operations[_i] = arguments[_i]; + } + if (operations.length === 0) { + return this; + } + return pipeFromArray(operations)(this); + }; + Observable.prototype.toPromise = function (promiseCtor) { + var _this = this; + promiseCtor = getPromiseCtor(promiseCtor); + return new promiseCtor(function (resolve, reject) { + var value; + _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); }); + }); + }; + Observable.create = function (subscribe) { + return new Observable(subscribe); + }; + return Observable; +}()); +function getPromiseCtor(promiseCtor) { + if (!promiseCtor) { + promiseCtor = Promise; + } + if (!promiseCtor) { + throw new Error('no Promise impl found'); + } + return promiseCtor; +} + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +var ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () { + function ObjectUnsubscribedErrorImpl() { + Error.call(this); + this.message = 'object unsubscribed'; + this.name = 'ObjectUnsubscribedError'; + return this; + } + ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype); + return ObjectUnsubscribedErrorImpl; +})(); +var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl; + +/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */ +var SubjectSubscription = /*@__PURE__*/ (function (_super) { + __extends(SubjectSubscription, _super); + function SubjectSubscription(subject, subscriber) { + var _this = _super.call(this) || this; + _this.subject = subject; + _this.subscriber = subscriber; + _this.closed = false; + return _this; + } + SubjectSubscription.prototype.unsubscribe = function () { + if (this.closed) { + return; + } + this.closed = true; + var subject = this.subject; + var observers = subject.observers; + this.subject = null; + if (!observers || observers.length === 0 || subject.isStopped || subject.closed) { + return; + } + var subscriberIndex = observers.indexOf(this.subscriber); + if (subscriberIndex !== -1) { + observers.splice(subscriberIndex, 1); + } + }; + return SubjectSubscription; +}(Subscription)); + +/** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */ +var SubjectSubscriber = /*@__PURE__*/ (function (_super) { + __extends(SubjectSubscriber, _super); + function SubjectSubscriber(destination) { + var _this = _super.call(this, destination) || this; + _this.destination = destination; + return _this; + } + return SubjectSubscriber; +}(Subscriber)); +var Subject = /*@__PURE__*/ (function (_super) { + __extends(Subject, _super); + function Subject() { + var _this = _super.call(this) || this; + _this.observers = []; + _this.closed = false; + _this.isStopped = false; + _this.hasError = false; + _this.thrownError = null; + return _this; + } + Subject.prototype[rxSubscriber] = function () { + return new SubjectSubscriber(this); + }; + Subject.prototype.lift = function (operator) { + var subject = new AnonymousSubject(this, this); + subject.operator = operator; + return subject; + }; + Subject.prototype.next = function (value) { + if (this.closed) { + throw new ObjectUnsubscribedError(); + } + if (!this.isStopped) { + var observers = this.observers; + var len = observers.length; + var copy = observers.slice(); + for (var i = 0; i < len; i++) { + copy[i].next(value); + } + } + }; + Subject.prototype.error = function (err) { + if (this.closed) { + throw new ObjectUnsubscribedError(); + } + this.hasError = true; + this.thrownError = err; + this.isStopped = true; + var observers = this.observers; + var len = observers.length; + var copy = observers.slice(); + for (var i = 0; i < len; i++) { + copy[i].error(err); + } + this.observers.length = 0; + }; + Subject.prototype.complete = function () { + if (this.closed) { + throw new ObjectUnsubscribedError(); + } + this.isStopped = true; + var observers = this.observers; + var len = observers.length; + var copy = observers.slice(); + for (var i = 0; i < len; i++) { + copy[i].complete(); + } + this.observers.length = 0; + }; + Subject.prototype.unsubscribe = function () { + this.isStopped = true; + this.closed = true; + this.observers = null; + }; + Subject.prototype._trySubscribe = function (subscriber) { + if (this.closed) { + throw new ObjectUnsubscribedError(); + } + else { + return _super.prototype._trySubscribe.call(this, subscriber); + } + }; + Subject.prototype._subscribe = function (subscriber) { + if (this.closed) { + throw new ObjectUnsubscribedError(); + } + else if (this.hasError) { + subscriber.error(this.thrownError); + return Subscription.EMPTY; + } + else if (this.isStopped) { + subscriber.complete(); + return Subscription.EMPTY; + } + else { + this.observers.push(subscriber); + return new SubjectSubscription(this, subscriber); + } + }; + Subject.prototype.asObservable = function () { + var observable = new Observable(); + observable.source = this; + return observable; + }; + Subject.create = function (destination, source) { + return new AnonymousSubject(destination, source); + }; + return Subject; +}(Observable)); +var AnonymousSubject = /*@__PURE__*/ (function (_super) { + __extends(AnonymousSubject, _super); + function AnonymousSubject(destination, source) { + var _this = _super.call(this) || this; + _this.destination = destination; + _this.source = source; + return _this; + } + AnonymousSubject.prototype.next = function (value) { + var destination = this.destination; + if (destination && destination.next) { + destination.next(value); + } + }; + AnonymousSubject.prototype.error = function (err) { + var destination = this.destination; + if (destination && destination.error) { + this.destination.error(err); + } + }; + AnonymousSubject.prototype.complete = function () { + var destination = this.destination; + if (destination && destination.complete) { + this.destination.complete(); + } + }; + AnonymousSubject.prototype._subscribe = function (subscriber) { + var source = this.source; + if (source) { + return this.source.subscribe(subscriber); + } + else { + return Subscription.EMPTY; + } + }; + return AnonymousSubject; +}(Subject)); + +/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */ +var Action = /*@__PURE__*/ (function (_super) { + __extends(Action, _super); + function Action(scheduler, work) { + return _super.call(this) || this; + } + Action.prototype.schedule = function (state, delay) { + return this; + }; + return Action; +}(Subscription)); + +/** PURE_IMPORTS_START tslib,_Action PURE_IMPORTS_END */ +var AsyncAction = /*@__PURE__*/ (function (_super) { + __extends(AsyncAction, _super); + function AsyncAction(scheduler, work) { + var _this = _super.call(this, scheduler, work) || this; + _this.scheduler = scheduler; + _this.work = work; + _this.pending = false; + return _this; + } + AsyncAction.prototype.schedule = function (state, delay) { + if (delay === void 0) { + delay = 0; + } + if (this.closed) { + return this; + } + this.state = state; + var id = this.id; + var scheduler = this.scheduler; + if (id != null) { + this.id = this.recycleAsyncId(scheduler, id, delay); + } + this.pending = true; + this.delay = delay; + this.id = this.id || this.requestAsyncId(scheduler, this.id, delay); + return this; + }; + AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) { + if (delay === void 0) { + delay = 0; + } + return setInterval(scheduler.flush.bind(scheduler, this), delay); + }; + AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) { + if (delay === void 0) { + delay = 0; + } + if (delay !== null && this.delay === delay && this.pending === false) { + return id; + } + clearInterval(id); + return undefined; + }; + AsyncAction.prototype.execute = function (state, delay) { + if (this.closed) { + return new Error('executing a cancelled action'); + } + this.pending = false; + var error = this._execute(state, delay); + if (error) { + return error; + } + else if (this.pending === false && this.id != null) { + this.id = this.recycleAsyncId(this.scheduler, this.id, null); + } + }; + AsyncAction.prototype._execute = function (state, delay) { + var errored = false; + var errorValue = undefined; + try { + this.work(state); + } + catch (e) { + errored = true; + errorValue = !!e && e || new Error(e); + } + if (errored) { + this.unsubscribe(); + return errorValue; + } + }; + AsyncAction.prototype._unsubscribe = function () { + var id = this.id; + var scheduler = this.scheduler; + var actions = scheduler.actions; + var index = actions.indexOf(this); + this.work = null; + this.state = null; + this.pending = false; + this.scheduler = null; + if (index !== -1) { + actions.splice(index, 1); + } + if (id != null) { + this.id = this.recycleAsyncId(scheduler, id, null); + } + this.delay = null; + }; + return AsyncAction; +}(Action)); + +var Scheduler = /*@__PURE__*/ (function () { + function Scheduler(SchedulerAction, now) { + if (now === void 0) { + now = Scheduler.now; + } + this.SchedulerAction = SchedulerAction; + this.now = now; + } + Scheduler.prototype.schedule = function (work, delay, state) { + if (delay === void 0) { + delay = 0; + } + return new this.SchedulerAction(this, work).schedule(state, delay); + }; + Scheduler.now = function () { return Date.now(); }; + return Scheduler; +}()); + +/** PURE_IMPORTS_START tslib,_Scheduler PURE_IMPORTS_END */ +var AsyncScheduler = /*@__PURE__*/ (function (_super) { + __extends(AsyncScheduler, _super); + function AsyncScheduler(SchedulerAction, now) { + if (now === void 0) { + now = Scheduler.now; + } + var _this = _super.call(this, SchedulerAction, function () { + if (AsyncScheduler.delegate && AsyncScheduler.delegate !== _this) { + return AsyncScheduler.delegate.now(); + } + else { + return now(); + } + }) || this; + _this.actions = []; + _this.active = false; + _this.scheduled = undefined; + return _this; + } + AsyncScheduler.prototype.schedule = function (work, delay, state) { + if (delay === void 0) { + delay = 0; + } + if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) { + return AsyncScheduler.delegate.schedule(work, delay, state); + } + else { + return _super.prototype.schedule.call(this, work, delay, state); + } + }; + AsyncScheduler.prototype.flush = function (action) { + var actions = this.actions; + if (this.active) { + actions.push(action); + return; + } + var error; + this.active = true; + do { + if (error = action.execute(action.state, action.delay)) { + break; + } + } while (action = actions.shift()); + this.active = false; + if (error) { + while (action = actions.shift()) { + action.unsubscribe(); + } + throw error; + } + }; + return AsyncScheduler; +}(Scheduler)); + +/** PURE_IMPORTS_START PURE_IMPORTS_END */ +function isScheduler(value) { + return value && typeof value.schedule === 'function'; +} + +/** PURE_IMPORTS_START _AsyncAction,_AsyncScheduler PURE_IMPORTS_END */ +var asyncScheduler = /*@__PURE__*/ new AsyncScheduler(AsyncAction); +var async = asyncScheduler; + +/** PURE_IMPORTS_START tslib,_scheduler_async,_Subscriber,_util_isScheduler PURE_IMPORTS_END */ +function bufferTime(bufferTimeSpan) { + var length = arguments.length; + var scheduler = async; + if (isScheduler(arguments[arguments.length - 1])) { + scheduler = arguments[arguments.length - 1]; + length--; + } + var bufferCreationInterval = null; + if (length >= 2) { + bufferCreationInterval = arguments[1]; + } + var maxBufferSize = Number.POSITIVE_INFINITY; + if (length >= 3) { + maxBufferSize = arguments[2]; + } + return function bufferTimeOperatorFunction(source) { + return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); + }; +} +var BufferTimeOperator = /*@__PURE__*/ (function () { + function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { + this.bufferTimeSpan = bufferTimeSpan; + this.bufferCreationInterval = bufferCreationInterval; + this.maxBufferSize = maxBufferSize; + this.scheduler = scheduler; + } + BufferTimeOperator.prototype.call = function (subscriber, source) { + return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); + }; + return BufferTimeOperator; +}()); +var Context = /*@__PURE__*/ (function () { + function Context() { + this.buffer = []; + } + return Context; +}()); +var BufferTimeSubscriber = /*@__PURE__*/ (function (_super) { + __extends(BufferTimeSubscriber, _super); + function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { + var _this = _super.call(this, destination) || this; + _this.bufferTimeSpan = bufferTimeSpan; + _this.bufferCreationInterval = bufferCreationInterval; + _this.maxBufferSize = maxBufferSize; + _this.scheduler = scheduler; + _this.contexts = []; + var context = _this.openContext(); + _this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; + if (_this.timespanOnly) { + var timeSpanOnlyState = { subscriber: _this, context: context, bufferTimeSpan: bufferTimeSpan }; + _this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); + } + else { + var closeState = { subscriber: _this, context: context }; + var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: _this, scheduler: scheduler }; + _this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); + _this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); + } + return _this; + } + BufferTimeSubscriber.prototype._next = function (value) { + var contexts = this.contexts; + var len = contexts.length; + var filledBufferContext; + for (var i = 0; i < len; i++) { + var context_1 = contexts[i]; + var buffer = context_1.buffer; + buffer.push(value); + if (buffer.length == this.maxBufferSize) { + filledBufferContext = context_1; + } + } + if (filledBufferContext) { + this.onBufferFull(filledBufferContext); + } + }; + BufferTimeSubscriber.prototype._error = function (err) { + this.contexts.length = 0; + _super.prototype._error.call(this, err); + }; + BufferTimeSubscriber.prototype._complete = function () { + var _a = this, contexts = _a.contexts, destination = _a.destination; + while (contexts.length > 0) { + var context_2 = contexts.shift(); + destination.next(context_2.buffer); + } + _super.prototype._complete.call(this); + }; + BufferTimeSubscriber.prototype._unsubscribe = function () { + this.contexts = null; + }; + BufferTimeSubscriber.prototype.onBufferFull = function (context) { + this.closeContext(context); + var closeAction = context.closeAction; + closeAction.unsubscribe(); + this.remove(closeAction); + if (!this.closed && this.timespanOnly) { + context = this.openContext(); + var bufferTimeSpan = this.bufferTimeSpan; + var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; + this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); + } + }; + BufferTimeSubscriber.prototype.openContext = function () { + var context = new Context(); + this.contexts.push(context); + return context; + }; + BufferTimeSubscriber.prototype.closeContext = function (context) { + this.destination.next(context.buffer); + var contexts = this.contexts; + var spliceIndex = contexts ? contexts.indexOf(context) : -1; + if (spliceIndex >= 0) { + contexts.splice(contexts.indexOf(context), 1); + } + }; + return BufferTimeSubscriber; +}(Subscriber)); +function dispatchBufferTimeSpanOnly(state) { + var subscriber = state.subscriber; + var prevContext = state.context; + if (prevContext) { + subscriber.closeContext(prevContext); + } + if (!subscriber.closed) { + state.context = subscriber.openContext(); + state.context.closeAction = this.schedule(state, state.bufferTimeSpan); + } +} +function dispatchBufferCreation(state) { + var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; + var context = subscriber.openContext(); + var action = this; + if (!subscriber.closed) { + subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); + action.schedule(state, bufferCreationInterval); + } +} +function dispatchBufferClose(arg) { + var subscriber = arg.subscriber, context = arg.context; + subscriber.closeContext(context); +} + +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +/** + * An expression marker with embedded unique key to avoid collision with + * possible text in templates. + */ +`{{lit-${String(Math.random()).slice(2)}}}`; + +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +/** + * @module lit-html + */ +/** + * Our TrustedTypePolicy for HTML which is declared using the html template + * tag function. + * + * That HTML is a developer-authored constant, and is parsed with innerHTML + * before any untrusted expressions have been mixed in. Therefor it is + * considered safe by construction. + */ +window.trustedTypes && + trustedTypes.createPolicy('lit-html', { createHTML: (s) => s }); + +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +// Detect event listener options support. If the `capture` property is read +// from the options object, then options are supported. If not, then the third +// argument to add/removeEventListener is interpreted as the boolean capture +// value so we should only pass the `capture` property. +let eventOptionsSupported = false; +// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch +// blocks right into the body of a module +(() => { + try { + const options = { + get capture() { + eventOptionsSupported = true; + return false; + } + }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + window.addEventListener('test', options, options); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + window.removeEventListener('test', options, options); + } + catch (_e) { + // event options not supported + } +})(); + +/** + * @license + * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at + * http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at + * http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at + * http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at + * http://polymer.github.io/PATENTS.txt + */ +/** + * + * Main lit-html module. + * + * Main exports: + * + * - [[html]] + * - [[svg]] + * - [[render]] + * + * @packageDocumentation + */ +/** + * Do not remove this comment; it keeps typedoc from misplacing the module + * docs. + */ +// IMPORTANT: do not change the property name or the assignment expression. +// This line will be used in regexes to search for lit-html usage. +// TODO(justinfagnani): inject version number at build time +if (typeof window !== 'undefined') { + (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.4.1'); +} + +let current; +let currentId = 0; +function notify() { + return currentId++; +} + +const hookSymbol = Symbol('haunted.hook'); +const effectsSymbol = Symbol('haunted.effects'); +const layoutEffectsSymbol = Symbol('haunted.layoutEffects'); +const contextEvent = 'haunted.context'; + +Promise.resolve().then.bind(Promise.resolve()); + +class Hook { + id; + state; + constructor(id, state) { + this.id = id; + this.state = state; + } +} +function use(Hook, ...args) { + let id = notify(); + let hooks = current[hookSymbol]; + let hook = hooks.get(id); + if (!hook) { + hook = new Hook(id, current, ...args); + hooks.set(id, hook); + } + return hook.update(...args); +} +function hook(Hook) { + return use.bind(null, Hook); +} + +function createEffect(setEffects) { + return hook(class extends Hook { + callback; + lastValues; + values; + _teardown; + constructor(id, state, ignored1, ignored2) { + super(id, state); + setEffects(state, this); + } + update(callback, values) { + this.callback = callback; + this.values = values; + } + call() { + if (!this.values || this.hasChanged()) { + this.run(); + } + this.lastValues = this.values; + } + run() { + this.teardown(); + this._teardown = this.callback.call(this.state); + } + teardown() { + if (typeof this._teardown === 'function') { + this._teardown(); + } + } + hasChanged() { + return !this.lastValues || this.values.some((value, i) => this.lastValues[i] !== value); + } + }); +} + +function setEffects(state, cb) { + state[effectsSymbol].push(cb); +} +/** + * @function + * @param {() => void} effect - callback function that runs each time dependencies change + * @param {unknown[]} [dependencies] - list of dependencies to the effect + * @return {void} + */ +createEffect(setEffects); + +/** + * @function + * @template T + * @param {Context} context + * @return {T} + */ +hook(class extends Hook { + Context; + value; + _ranEffect; + _unsubscribe; + constructor(id, state, _) { + super(id, state); + this._updater = this._updater.bind(this); + this._ranEffect = false; + this._unsubscribe = null; + setEffects(state, this); + } + update(Context) { + if (this.state.virtual) { + throw new Error('can\'t be used with virtual components'); + } + if (this.Context !== Context) { + this._subscribe(Context); + this.Context = Context; + } + return this.value; + } + call() { + if (!this._ranEffect) { + this._ranEffect = true; + if (this._unsubscribe) + this._unsubscribe(); + this._subscribe(this.Context); + this.state.update(); + } + } + _updater(value) { + this.value = value; + this.state.update(); + } + _subscribe(Context) { + const detail = { Context, callback: this._updater }; + this.state.host.dispatchEvent(new CustomEvent(contextEvent, { + detail, + bubbles: true, + cancelable: true, + composed: true, // to pass ShadowDOM boundaries + })); + const { unsubscribe = null, value } = detail; + this.value = unsubscribe ? value : Context.defaultValue; + this._unsubscribe = unsubscribe; + } + teardown() { + if (this._unsubscribe) { + this._unsubscribe(); + } + } +}); + +/** + * @function + * @template T + * @param {() => T} fn function to memoize + * @param {unknown[]} values dependencies to the memoized computation + * @return {T} The next computed value + */ +hook(class extends Hook { + value; + values; + constructor(id, state, fn, values) { + super(id, state); + this.value = fn(); + this.values = values; + } + update(fn, values) { + if (this.hasChanged(values)) { + this.values = values; + this.value = fn(); + } + return this.value; + } + hasChanged(values = []) { + return values.some((value, i) => this.values[i] !== value); + } +}); + +function setLayoutEffects(state, cb) { + state[layoutEffectsSymbol].push(cb); +} +/** + * @function + * @param {Effect} callback effecting callback + * @param {unknown[]} [values] dependencies to the effect + * @return {void} + */ +createEffect(setLayoutEffects); + +/** + * @function + * @template {*} T + * @param {T} [initialState] - Optional initial state + * @return {readonly [state: T, updaterFn: StateUpdater]} stateTuple - Tuple of current state and state updater function + */ +hook(class extends Hook { + args; + constructor(id, state, initialValue) { + super(id, state); + this.updater = this.updater.bind(this); + if (typeof initialValue === 'function') { + initialValue = initialValue(); + } + this.makeArgs(initialValue); + } + update() { + return this.args; + } + updater(value) { + if (typeof value === 'function') { + const updaterFn = value; + const [previousValue] = this.args; + value = updaterFn(previousValue); + } + this.makeArgs(value); + this.state.update(); + } + makeArgs(value) { + this.args = Object.freeze([value, this.updater]); + } +}); + +/** + * @license + * Portions Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +Promise.resolve(); + +/** + * Given a reducer function, initial state, and optional state initializer function, returns a tuple of state and dispatch function. + * @function + * @template S State + * @template I Initial State + * @template A Action + * @param {Reducer} reducer - reducer function to compute the next state given the previous state and the action + * @param {I} initialState - the initial state of the reducer + * @param {(init: I) => S} [init=undefined] - Optional initializer function, called on initialState if provided + * @return {readonly [S, (action: A) => void]} + */ +hook(class extends Hook { + reducer; + currentState; + constructor(id, state, _, initialState, init) { + super(id, state); + this.dispatch = this.dispatch.bind(this); + this.currentState = init !== undefined ? init(initialState) : initialState; + } + update(reducer) { + this.reducer = reducer; + return [this.currentState, this.dispatch]; + } + dispatch(action) { + this.currentState = this.reducer(this.currentState, action); + this.state.update(); + } +}); + +var browser = {exports: {}}; + +/** + * Helpers. + */ + +var ms; +var hasRequiredMs; + +function requireMs () { + if (hasRequiredMs) return ms; + hasRequiredMs = 1; + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + + ms = function (val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); + }; + + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } + } + + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; + } + + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; + } + + /** + * Pluralization helper. + */ + + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); + } + return ms; +} + +var common; +var hasRequiredCommon; + +function requireCommon () { + if (hasRequiredCommon) return common; + hasRequiredCommon = 1; + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = requireMs(); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + const split = (typeof namespaces === 'string' ? namespaces : '') + .trim() + .replace(/\s+/g, ',') + .split(',') + .filter(Boolean); + + for (const ns of split) { + if (ns[0] === '-') { + createDebug.skips.push(ns.slice(1)); + } else { + createDebug.names.push(ns); + } + } + } + + /** + * Checks if the given string matches a namespace template, honoring + * asterisks as wildcards. + * + * @param {String} search + * @param {String} template + * @return {Boolean} + */ + function matchesTemplate(search, template) { + let searchIndex = 0; + let templateIndex = 0; + let starIndex = -1; + let matchIndex = 0; + + while (searchIndex < search.length) { + if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) { + // Match character or proceed with wildcard + if (template[templateIndex] === '*') { + starIndex = templateIndex; + matchIndex = searchIndex; + templateIndex++; // Skip the '*' + } else { + searchIndex++; + templateIndex++; + } + } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition + // Backtrack to the last '*' and try to match more characters + templateIndex = starIndex + 1; + matchIndex++; + searchIndex = matchIndex; + } else { + return false; // No match + } + } + + // Handle trailing '*' in template + while (templateIndex < template.length && template[templateIndex] === '*') { + templateIndex++; + } + + return templateIndex === template.length; + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names, + ...createDebug.skips.map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + for (const skip of createDebug.skips) { + if (matchesTemplate(name, skip)) { + return false; + } + } + + for (const ns of createDebug.names) { + if (matchesTemplate(name, ns)) { + return true; + } + } + + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; + } + + common = setup; + return common; +} + +/* eslint-env browser */ + +var hasRequiredBrowser; + +function requireBrowser () { + if (hasRequiredBrowser) return browser.exports; + hasRequiredBrowser = 1; + (function (module, exports$1) { + /** + * This is the web browser implementation of `debug()`. + */ + + exports$1.formatArgs = formatArgs; + exports$1.save = save; + exports$1.load = load; + exports$1.useColors = useColors; + exports$1.storage = localstorage(); + exports$1.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; + })(); + + /** + * Colors. + */ + + exports$1.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' + ]; + + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + + // eslint-disable-next-line complexity + function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + let m; + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + // eslint-disable-next-line no-return-assign + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); + } + + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + } + + /** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ + exports$1.log = console.debug || console.log || (() => {}); + + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + function save(namespaces) { + try { + if (namespaces) { + exports$1.storage.setItem('debug', namespaces); + } else { + exports$1.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + } + + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + function load() { + let r; + try { + r = exports$1.storage.getItem('debug') || exports$1.storage.getItem('DEBUG') ; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; + } + + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + } + + module.exports = requireCommon()(exports$1); + + const {formatters} = module.exports; + + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } + }; + } (browser, browser.exports)); + return browser.exports; +} + +var browserExports = requireBrowser(); +var r = /*@__PURE__*/getDefaultExportFromCjs(browserExports); + +r("stencil-hook"); + +/** + * Returns a function, that, as long as it continues to be invoked, will not + * be triggered. The function will be called after it stops being called for + * N milliseconds. If `immediate` is passed, trigger the function on the + * leading edge, instead of the trailing. The function also has a property 'clear' + * that is a function which will clear the timer to prevent previously scheduled executions. + * + * @source underscore.js + * @see http://unscriptable.com/2009/03/20/debouncing-javascript-methods/ + * @param {Function} function to wrap + * @param {Number} timeout in ms (`100`) + * @param {Boolean} whether to execute at the beginning (`false`) + * @api public + */ + +var debounce_1; +var hasRequiredDebounce; + +function requireDebounce () { + if (hasRequiredDebounce) return debounce_1; + hasRequiredDebounce = 1; + function debounce(func, wait, immediate){ + var timeout, args, context, timestamp, result; + if (null == wait) wait = 100; + + function later() { + var last = Date.now() - timestamp; + + if (last < wait && last >= 0) { + timeout = setTimeout(later, wait - last); + } else { + timeout = null; + if (!immediate) { + result = func.apply(context, args); + context = args = null; + } + } + } + var debounced = function(){ + context = this; + args = arguments; + timestamp = Date.now(); + var callNow = immediate && !timeout; + if (!timeout) timeout = setTimeout(later, wait); + if (callNow) { + result = func.apply(context, args); + context = args = null; + } + + return result; + }; + + debounced.clear = function() { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + }; + + debounced.flush = function() { + if (timeout) { + result = func.apply(context, args); + context = args = null; + + clearTimeout(timeout); + timeout = null; + } + }; + + return debounced; + } + // Adds compatibility for ES modules + debounce.debounce = debounce; + + debounce_1 = debounce; + return debounce_1; +} + +requireDebounce(); + +var jsonpointer = {}; + +var hasRequiredJsonpointer; + +function requireJsonpointer () { + if (hasRequiredJsonpointer) return jsonpointer; + hasRequiredJsonpointer = 1; + var hasExcape = /~/; + var escapeMatcher = /~[01]/g; + function escapeReplacer (m) { + switch (m) { + case '~1': return '/' + case '~0': return '~' + } + throw new Error('Invalid tilde escape: ' + m) + } + + function untilde (str) { + if (!hasExcape.test(str)) return str + return str.replace(escapeMatcher, escapeReplacer) + } + + function setter (obj, pointer, value) { + var part; + var hasNextPart; + + if (pointer[1] === 'constructor' && pointer[2] === 'prototype') return obj + if (pointer[1] === '__proto__') return obj + + for (var p = 1, len = pointer.length; p < len;) { + part = untilde(pointer[p++]); + hasNextPart = len > p; + + if (typeof obj[part] === 'undefined') { + // support setting of /- + if (Array.isArray(obj) && part === '-') { + part = obj.length; + } + + // support nested objects/array when setting values + if (hasNextPart) { + if ((pointer[p] !== '' && pointer[p] < Infinity) || pointer[p] === '-') obj[part] = []; + else obj[part] = {}; + } + } + + if (!hasNextPart) break + obj = obj[part]; + } + + var oldValue = obj[part]; + if (value === undefined) delete obj[part]; + else obj[part] = value; + return oldValue + } + + function compilePointer (pointer) { + if (typeof pointer === 'string') { + pointer = pointer.split('/'); + if (pointer[0] === '') return pointer + throw new Error('Invalid JSON pointer.') + } else if (Array.isArray(pointer)) { + return pointer + } + + throw new Error('Invalid JSON pointer.') + } + + function get (obj, pointer) { + if (typeof obj !== 'object') throw new Error('Invalid input object.') + pointer = compilePointer(pointer); + var len = pointer.length; + if (len === 1) return obj + + for (var p = 1; p < len;) { + obj = obj[untilde(pointer[p++])]; + if (len === p) return obj + if (typeof obj !== 'object') return undefined + } + } + + function set (obj, pointer, value) { + if (typeof obj !== 'object') throw new Error('Invalid input object.') + pointer = compilePointer(pointer); + if (pointer.length === 0) throw new Error('Invalid JSON pointer for set.') + return setter(obj, pointer, value) + } + + function compile (pointer) { + var compiled = compilePointer(pointer); + return { + get: function (object) { + return get(object, compiled) + }, + set: function (object, value) { + return set(object, compiled, value) + } + } + } + + jsonpointer.get = get; + jsonpointer.set = set; + jsonpointer.compile = compile; + return jsonpointer; +} + +requireJsonpointer(); + +function U(){throw new Error("no implementation of useHost provided");}function H(){lazilyStartProgramContext();const e=U();return h(e,PROGRAM_CONTEXT_NAME)}function G(){var e;return null==(e=J())?void 0:e.jwt}function J(){lazilyStartUserContext();const e=U(),t=h(e,USER_CONTEXT_NAME),n=userIdentityFromJwt(null==t?void 0:t.jwt);if(isDemo()||!t||n)return t;setUserIdentity(void 0);}const Q=getTenantAlias,z=getAppDomain;var K=function(){return (K=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{if(r.includes(o)){const d=le(o),c=a.findIndex(e=>e.id===d);if(-1===c)return false;r.splice(i,1),n=a.splice(c,1)[0];const u=fe(e.response.data,n);s[i]=ue(s[i],d);const{query:l,variables:m}=n,f=se({},e.response,{errors:[t],data:u,path:s}),g=new typesExports.ClientError(f,{query:"string"!=typeof l?print(l):l,variables:m});return he(n,g),true}return false});}pe(t,a);}else ye(o,e);}}),r.subscribe(async function(e){try{const{query:t,variables:r}=e,a=await n.superRequest(t,r);ge(a,e);}catch(t){he(e,t);}});}superRequest(e,t){return super.request(e,t)}request(e,t,n){return new Promise((r,a)=>{const o={query:e,variables:t,id:ce(),options:n,resolve:r,reject:a};this.subject.next(o);})}}const ce=()=>nanoid().replace(/[-_]/g,""),ue=(e,t)=>e.replace(`_${t}`,""),le=e=>{const t=e.split("_");return t[t.length-1]},me=e=>{const t=[],n=[],{document:r,variables:a}=e.reduce((e,r)=>{const{query:a,variables:o,id:i,options:s}=r;if(null==s||!s.batch)return n.push(r),e;try{const s="string"==typeof a?parse(a):a,d=s.definitions.find(e=>"FragmentDefinition"===e.kind),c="string"==typeof a?a:print(a),u=/@/.test(c);if(d||u)return n.push(r),e;const l=e=>((e,t)=>`${e}_${t}`)(e,i);return e=e.addN(s,[o],l,l),t.push(r),e}catch(t){return n.push(r),e}},$("BatchedQuery"));return {mergedQuery:r&&print(r),mergedVariables:a,mergedQueryAddedEvents:t,unmergedQueryAddedEvents:n}},fe=(e,t)=>{if(!e)return e;const n=Object.keys(e),{id:r}=t;return n.reduce((t,n)=>(n.endsWith(r)&&(t=se({},t,{[ue(n,r)]:e[n]})),t),{})},ge=(e,t)=>{const{resolve:n}=t;n(e);},pe=(e,t)=>{for(const n of t){const t=fe(e,n);n.resolve(t);}},he=(e,t)=>{const{reject:n}=e;n(t);},ye=(e,t)=>{for(const n of e){const{reject:e}=n;e(t);}},Ce=M(function(e,t,n){return new de(e+"/api/v1/"+t+"/graphql",{headers:{Authorization:`Bearer ${n||""}`}})});function we(e,t){switch(t.type){case "loading":return {data:void 0,errors:void 0,loading:true};case "data":return {data:t.payload,errors:void 0,loading:false};case "errors":return {data:void 0,errors:t.payload,loading:false}}}function be(e,t,n={batch:true}){const r=function(){const e=G(),t=z(),n=Q(),r=Ce(t,n,e),a=U(),o=h(a,"sq:graphql-client",{attempts:0});return null!=o?o:r}(),[a,o]=useReducer(we,t);return [a,useCallback(async function(t,a=false){if(!r){const e=new Error("No GraphQL client found");return o({type:"errors",payload:e}),e}try{a||o({type:"loading"});const i=await r.request(e,t,n);return o({type:"data",payload:i}),i}catch(e){return o({type:"errors",payload:e}),e}},[r,e,o])]}let Fe;ie(Fe||(Fe=(e=>e)` + mutation AuthenticateWithEmailAndPassword( + $email: String! + $password: String! + ) { + authenticateManagedIdentityWithEmailAndPassword( + authenticateManagedIdentityWithEmailAndPasswordInput: { + email: $email + password: $password + } + ) { + token + email + emailVerified + sessionData + } + } +`));let Pe;ie(Pe||(Pe=(e=>e)` + mutation RegisterWithEmailAndPassword( + $email: String! + $password: String! + $formData: RSJsonNode + $redirectPath: String + ) { + registerManagedIdentityWithEmailAndPassword( + registerManagedIdentityWithEmailAndPasswordInput: { + email: $email + password: $password + formData: $formData + redirectPath: $redirectPath + } + ) { + token + email + emailVerified + sessionData + } + } +`));let ke;ie(ke||(ke=(e=>e)` + mutation RegisterViaRegistrationForm($key: String!, $formData: RSJsonNode!) { + submitForm(formSubmissionInput: { key: $key, formData: $formData }) { + results { + ... on FormHandlerSubmissionResult { + result + formHandler { + namespace + } + } + ... on FormHandlerError { + errorCode + error + errorType + formHandler { + name + endpointUrl + } + } + } + } + } +`));let Re;ie(Re||(Re=(e=>e)` + mutation ChangePassword($password: String!) { + changeManagedIdentityPassword( + changeManagedIdentityPasswordInput: { password: $password } + ) { + success + } + } +`));let xe;ie(xe||(xe=(e=>e)` + mutation ResetPassword($oobCode: String!, $password: String!) { + resetManagedIdentityPassword( + resetManagedIdentityPasswordInput: { + password: $password + oobCode: $oobCode + } + ) { + token + email + emailVerified + sessionData + } + } +`));let Oe;ie(Oe||(Oe=(e=>e)` + mutation VerifyPasswordResetCode($oobCode: String!) { + verifyManagedIdentityPasswordResetCode( + verifyManagedIdentityPasswordResetCodeInput: { oobCode: $oobCode } + ) { + success + } + } +`));function He({skip:e=false,update:t,variables:n}){useEffect(()=>{const r=r=>{!e&&t(n,true);};return document.addEventListener("sq:refresh",r),()=>document.removeEventListener("sq:refresh",r)},function(e){const t=useRef(e),n=useRef(0);return equal(e,t.current)||(t.current=e,n.current+=1),useMemo(()=>t.current,[n.current])}([n,t,e]));}let Qe;ie(Qe||(Qe=(e=>e)` + query ManagedIdentitySession { + managedIdentitySession { + email + emailVerified + sessionData + } + } +`));let Ke;ie(Ke||(Ke=(e=>e)` + mutation VerifyEmail($oobCode: String!) { + verifyManagedIdentityEmail( + verifyManagedIdentityEmailInput: { oobCode: $oobCode } + ) { + success + } + } +`));let Ye;ie(Ye||(Ye=(e=>e)` + mutation RequestPasswordResetEmail( + $email: String! + $urlParams: RSJsonNode + $redirectPath: String + ) { + requestManagedIdentityPasswordResetEmail( + requestManagedIdentityPasswordResetEmailInput: { + email: $email + urlParams: $urlParams + redirectPath: $redirectPath + } + ) { + success + } + } +`));let nt;ie(nt||(nt=(e=>e)` + mutation RequestVerificationEmail( + $email: String! + $urlParams: RSJsonNode + $redirectPath: String + ) { + requestManagedIdentityVerificationEmail( + requestManagedIdentityVerificationEmailInput: { + email: $email + urlParams: $urlParams + redirectPath: $redirectPath + } + ) { + success + } + } +`));let ot;ie(ot||(ot=(e=>e)` + mutation authenticateManagedIdentityWithInstantAccess( + $email: String! + $firstName: String + $lastName: String + $locale: RSLocale + $countryCode: RSCountryCode + $cookies: String + ) { + authenticateManagedIdentityWithInstantAccess( + authenticateManagedIdentityWithInstantAccessInput: { + email: $email + firstName: $firstName + lastName: $lastName + locale: $locale + countryCode: $countryCode + cookies: $cookies + } + ) { + email + emailVerified + sessionData + token + } + } +`));let dt;distExports.gql(dt||(dt=(e=>e)` + mutation authenticateManagedIdentityWithGoogle($idToken: String!) { + authenticateManagedIdentityWithGoogle( + authenticateManagedIdentityWithGoogleInput: { idToken: $idToken } + ) { + token + email + emailVerified + sessionData + } + } +`));function lt(e,t){const n=useRef();return n.current&&equal(t,n.current.key)||(n.current={key:t,value:e()}),n.current.value}function mt(){return useReducer(e=>e+1,0)}function ft(e){const t=Object.getOwnPropertyNames(e);for(const n of t){const t=e[n];t&&"object"==typeof t&&ft(t);}return Object.freeze(e)}const gt={loading:true,data:void 0,errors:void 0};function pt(e,t,n,r){const[a,o]=be(e,gt,se({batch:true},{})),[i,s]=mt();return lt(()=>{o(t);},[e,t,o,i,n]),He({skip:n,update:o,variables:t}),ft(se({},a,{refetch:s}))}let qt;distExports.gql(qt||(qt=(e=>e)` + mutation ($eventMeta: UserAnalyticsEvent!) { + createUserAnalyticsEvent(eventMeta: $eventMeta) + } +`));var Vt=1e3,jt=60*Vt,xt=60*jt,Wt=24*xt,Nt=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case "years":case "year":case "yrs":case "yr":case "y":return 315576e5*n;case "weeks":case "week":case "w":return 6048e5*n;case "days":case "day":case "d":return n*Wt;case "hours":case "hour":case "hrs":case "hr":case "h":return n*xt;case "minutes":case "minute":case "mins":case "min":case "m":return n*jt;case "seconds":case "second":case "secs":case "sec":case "s":return n*Vt;case "milliseconds":case "millisecond":case "msecs":case "msec":case "ms":return n;default:return}}}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=Wt?Ot(e,t,Wt,"day"):t>=xt?Ot(e,t,xt,"hour"):t>=jt?Ot(e,t,jt,"minute"):t>=Vt?Ot(e,t,Vt,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=Wt?Math.round(e/Wt)+"d":t>=xt?Math.round(e/xt)+"h":t>=jt?Math.round(e/jt)+"m":t>=Vt?Math.round(e/Vt)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Ot(e,t,n,r){var a=t>=1.5*n;return Math.round(e/n)+" "+r+(a?"s":"")}var Ut,Lt=(function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,a=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(r++,"%c"===e&&(a=r));}),t.splice(a,0,n);},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug");}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug");}catch(e){}return !e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return !("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=false;return ()=>{e||(e=true,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=function(e){function t(e){let r,a=null;function o(...e){if(!o.enabled)return;const n=o,a=Number(new Date);n.diff=a-(r||a),n.prev=r,n.curr=a,r=a,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,a)=>{if("%%"===r)return "%";i++;const o=t.formatters[a];return "function"==typeof o&&(r=o.call(n,e[i]),e.splice(i,1),i--),r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e);}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=n,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:true,configurable:false,get:()=>null===a?t.enabled(e):a,set:e=>{a=e;}}),"function"==typeof t.init&&t.init(o),o}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),a=r.length;for(n=0;n{t[n]=e[n];}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;te)` + mutation loadEvent($eventMeta: UserAnalyticsEvent!) { + createUserAnalyticsEvent(eventMeta: $eventMeta) + } +`));let Jt,Qt,zt,Bt=e=>e;Lt("sq:useForm");distExports.gql(Jt||(Jt=Bt` + query ($key: String!) { + form(key: $key) { + schema + initialData { + initialData + isEnabled + isEnabledErrorMessage + } + } + } +`));distExports.gql(Qt||(Qt=Bt` + mutation ($formSubmissionInput: FormSubmissionInput!) { + submitForm(formSubmissionInput: $formSubmissionInput) { + success + results { + ... on FormHandlerSubmissionResult { + formHandler { + name + endpointUrl + integration { + name + } + } + result + } + ... on FormHandlerError { + formHandler { + name + endpointUrl + integration { + name + } + } + errorType + error + errorCode + } + } + } + } +`));distExports.gql(zt||(zt=Bt` + query ($formValidationInput: FormValidationInput!) { + validateForm(formValidationInput: $formValidationInput) { + valid + results { + ... on FormHandlerValidationResult { + formHandler { + name + endpointUrl + integration { + name + } + } + result + } + ... on FormHandlerError { + formHandler { + name + endpointUrl + integration { + name + } + } + errorType + error + errorCode + } + } + } + } +`)); + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; + +typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +var docCache = new Map(); +var fragmentSourceMap = new Map(); +var printFragmentWarnings = true; +var experimentalFragmentVariables = false; +function normalize(string) { + return string.replace(/[\s,]+/g, ' ').trim(); +} +function cacheKeyFromLoc(loc) { + return normalize(loc.source.body.substring(loc.start, loc.end)); +} +function processFragments(ast) { + var seenKeys = new Set(); + var definitions = []; + ast.definitions.forEach(function (fragmentDefinition) { + if (fragmentDefinition.kind === 'FragmentDefinition') { + var fragmentName = fragmentDefinition.name.value; + var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc); + var sourceKeySet = fragmentSourceMap.get(fragmentName); + if (sourceKeySet && !sourceKeySet.has(sourceKey)) { + if (printFragmentWarnings) { + console.warn("Warning: fragment with name " + fragmentName + " already exists.\n" + + "graphql-tag enforces all fragment names across your application to be unique; read more about\n" + + "this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names"); + } + } + else if (!sourceKeySet) { + fragmentSourceMap.set(fragmentName, sourceKeySet = new Set); + } + sourceKeySet.add(sourceKey); + if (!seenKeys.has(sourceKey)) { + seenKeys.add(sourceKey); + definitions.push(fragmentDefinition); + } + } + else { + definitions.push(fragmentDefinition); + } + }); + return __assign(__assign({}, ast), { definitions: definitions }); +} +function stripLoc(doc) { + var workSet = new Set(doc.definitions); + workSet.forEach(function (node) { + if (node.loc) + delete node.loc; + Object.keys(node).forEach(function (key) { + var value = node[key]; + if (value && typeof value === 'object') { + workSet.add(value); + } + }); + }); + var loc = doc.loc; + if (loc) { + delete loc.startToken; + delete loc.endToken; + } + return doc; +} +function parseDocument(source) { + var cacheKey = normalize(source); + if (!docCache.has(cacheKey)) { + var parsed = parse(source, { + experimentalFragmentVariables: experimentalFragmentVariables, + allowLegacyFragmentVariables: experimentalFragmentVariables + }); + if (!parsed || parsed.kind !== 'Document') { + throw new Error('Not a valid GraphQL document.'); + } + docCache.set(cacheKey, stripLoc(processFragments(parsed))); + } + return docCache.get(cacheKey); +} +function gql(literals) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (typeof literals === 'string') { + literals = [literals]; + } + var result = literals[0]; + args.forEach(function (arg, i) { + if (arg && arg.kind === 'Document') { + result += arg.loc.source.body; + } + else { + result += arg; + } + result += literals[i + 1]; + }); + return parseDocument(result); +} +function resetCaches() { + docCache.clear(); + fragmentSourceMap.clear(); +} +function disableFragmentWarnings() { + printFragmentWarnings = false; +} +function enableExperimentalFragmentVariables() { + experimentalFragmentVariables = true; +} +function disableExperimentalFragmentVariables() { + experimentalFragmentVariables = false; +} +var extras = { + gql: gql, + resetCaches: resetCaches, + disableFragmentWarnings: disableFragmentWarnings, + enableExperimentalFragmentVariables: enableExperimentalFragmentVariables, + disableExperimentalFragmentVariables: disableExperimentalFragmentVariables +}; +(function (gql_1) { + gql_1.gql = extras.gql, gql_1.resetCaches = extras.resetCaches, gql_1.disableFragmentWarnings = extras.disableFragmentWarnings, gql_1.enableExperimentalFragmentVariables = extras.enableExperimentalFragmentVariables, gql_1.disableExperimentalFragmentVariables = extras.disableExperimentalFragmentVariables; +})(gql || (gql = {})); +gql["default"] = gql; + +const MessageLinkQuery = gql` + query getReferralCode($programId: ID) { + user: viewer { + ... on User { + referralCode(programId: $programId) + } + } + } +`; + +class SqlReferralCode extends i { + static styles = i$3` + :host { + display: block; + padding: 25px; + color: var(--sql-referral-code-text-color, #000); + } + `; + + constructor() { + super(); + console.log('yay'); + + const programId = H(); + // const user = useUserIdentity(); + + const { data } = pt(MessageLinkQuery, { programId }); + + // console.log({ user }); + } + + @n$2({ type: String }) header = 'Hey there'; + + @n$2({ type: Number }) counter = 5; + + __increment() { + this.counter += 1; + } + + render() { + return x` +

${this.header} Nr. ${this.counter}!

+ + `; + } +} + +export { SqlReferralCode }; +//# sourceMappingURL=index.js.map diff --git a/packages/lit-components/dist/src/index.js.map b/packages/lit-components/dist/src/index.js.map new file mode 100644 index 0000000000..346b6e56f2 --- /dev/null +++ b/packages/lit-components/dist/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":["../../node_modules/@lit/reactive-element/css-tag.js","../../node_modules/@lit/reactive-element/reactive-element.js","../../node_modules/lit-html/lit-html.js","../../node_modules/lit-element/lit-element.js","../../node_modules/@lit/reactive-element/decorators/property.js","../../node_modules/jwt-decode/build/jwt-decode.esm.js","../../node_modules/dom-context/dist/index.module.js","../../node_modules/@wry/equality/lib/index.js","../../node_modules/@saasquatch/component-environment/dist/index.mjs","../../node_modules/haunted/lib/interface.js","../../node_modules/haunted/lib/symbols.js","../../node_modules/haunted/lib/scheduler.js","../../node_modules/haunted/lib/hook.js","../../node_modules/haunted/lib/create-effect.js","../../node_modules/haunted/lib/use-effect.js","../../node_modules/haunted/lib/use-context.js","../../node_modules/haunted/lib/use-memo.js","../../node_modules/haunted/lib/use-callback.js","../../node_modules/haunted/lib/use-layout-effect.js","../../node_modules/haunted/lib/use-state.js","../../node_modules/haunted/lib/use-controller.js","../../node_modules/haunted/lib/use-reducer.js","../../node_modules/haunted/lib/use-ref.js","../../node_modules/@saasquatch/dom-context-hooks/dist/dom-context-hooks.module.js","../../node_modules/graphql/jsutils/devAssert.mjs","../../node_modules/graphql/jsutils/isObjectLike.mjs","../../node_modules/graphql/polyfills/symbols.mjs","../../node_modules/graphql/language/location.mjs","../../node_modules/graphql/language/printLocation.mjs","../../node_modules/graphql/error/GraphQLError.mjs","../../node_modules/graphql/error/syntaxError.mjs","../../node_modules/graphql/language/kinds.mjs","../../node_modules/graphql/jsutils/invariant.mjs","../../node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs","../../node_modules/graphql/jsutils/defineInspect.mjs","../../node_modules/graphql/language/ast.mjs","../../node_modules/graphql/language/tokenKind.mjs","../../node_modules/graphql/jsutils/inspect.mjs","../../node_modules/graphql/jsutils/instanceOf.mjs","../../node_modules/graphql/language/source.mjs","../../node_modules/graphql/language/directiveLocation.mjs","../../node_modules/graphql/language/blockString.mjs","../../node_modules/graphql/language/lexer.mjs","../../node_modules/graphql/language/parser.mjs","../../node_modules/graphql/language/visitor.mjs","../../node_modules/graphql/language/printer.mjs","../../node_modules/fast-memoize/src/index.js","../../node_modules/graphql-combine-query/dist/utils.js","../../node_modules/graphql-combine-query/dist/index.js","../../node_modules/cross-fetch/dist/browser-ponyfill.js","../../node_modules/extract-files/public/ReactNativeFile.js","../../node_modules/extract-files/public/isExtractableFile.js","../../node_modules/extract-files/public/extractFiles.js","../../node_modules/extract-files/public/index.js","../../node_modules/graphql-request/node_modules/form-data/lib/browser.js","../../node_modules/graphql-request/dist/createRequestBody.js","../../node_modules/graphql-request/dist/types.js","../../node_modules/graphql-request/dist/index.js","../../node_modules/nanoid/index.browser.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/node_modules/tslib/tslib.es6.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/isFunction.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/config.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/hostReportError.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/Observer.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/isArray.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/isObject.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/Subscription.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/Subscriber.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/canReportError.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/toSubscriber.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/symbol/observable.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/identity.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/pipe.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/Observable.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/SubjectSubscription.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/Subject.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/scheduler/Action.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/Scheduler.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/util/isScheduler.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/scheduler/async.js","../../node_modules/@saasquatch/component-boilerplate/node_modules/rxjs/_esm5/internal/operators/bufferTime.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/lit-html/lib/template.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/lit-html/lib/template-result.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/lit-html/lib/parts.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/lit-html/lit-html.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/interface.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/symbols.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/scheduler.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/hook.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/create-effect.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/use-effect.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/use-context.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/use-memo.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/use-layout-effect.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/use-state.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/use-controller.js","../../node_modules/@saasquatch/stencil-hooks/node_modules/haunted/lib/use-reducer.js","../../node_modules/ms/index.js","../../node_modules/debug/src/common.js","../../node_modules/debug/src/browser.js","../../node_modules/@saasquatch/stencil-hooks/build/stencil-hooks.module.js","../../node_modules/debounce/index.js","../../node_modules/jsonpointer/jsonpointer.js","../../node_modules/@saasquatch/component-boilerplate/dist/index.modern.js","../../node_modules/tslib/tslib.es6.mjs","../../node_modules/graphql-tag/lib/index.js","../../src/SqlReferralCode.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&\"adoptedStyleSheets\"in Document.prototype&&\"replace\"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s)throw Error(\"CSSResult is not constructable. Use `unsafeCSS` or `css` instead.\");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o.set(s,t))}return t}toString(){return this.cssText}}const r=t=>new n(\"string\"==typeof t?t:t+\"\",void 0,s),i=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if(\"number\"==typeof t)return t;throw Error(\"Value passed to 'css' function must be a 'css' function result: \"+t+\". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.\")})(s)+t[o+1]),t[0]);return new n(o,t,s)},S=(s,o)=>{if(e)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement(\"style\"),n=t.litNonce;void 0!==n&&o.setAttribute(\"nonce\",n),o.textContent=e.cssText,s.appendChild(o)}},c=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e=\"\";for(const s of t.cssRules)e+=s.cssText;return r(e)})(t):t;export{n as CSSResult,S as adoptStyles,i as css,c as getCompatibleStyle,e as supportsAdoptingStyleSheets,r as unsafeCSS};\n//# sourceMappingURL=css-tag.js.map\n","import{getCompatibleStyle as t,adoptStyles as s}from\"./css-tag.js\";export{CSSResult,css,supportsAdoptingStyleSheets,unsafeCSS}from\"./css-tag.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{is:i,defineProperty:e,getOwnPropertyDescriptor:h,getOwnPropertyNames:r,getOwnPropertySymbols:o,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:\"\",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},f=(t,s)=>!i(t,s),b={attribute:!0,type:String,converter:u,reflect:!1,useDefault:!1,hasChanged:f};Symbol.metadata??=Symbol(\"metadata\"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e(this.prototype,t,h)}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d(\"elementProperties\")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(d(\"finalized\")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d(\"properties\"))){const t=this.properties,s=[...r(t),...o(t)];for(const i of s)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(t(s))}else void 0!==s&&i.push(t(s));return i}static _$Eu(t,s){const i=s.attribute;return!1===i?void 0:\"string\"==typeof i?i:\"string\"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,s,i){this._$AK(t,i)}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h=\"function\"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),!0!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),!0===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];!0!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e)}}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:\"open\"},y[d(\"elementProperties\")]=new Map,y[d(\"finalized\")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push(\"2.1.1\");export{y as ReactiveElement,s as adoptStyles,u as defaultConverter,t as getCompatibleStyle,f as notEqual};\n//# sourceMappingURL=reactive-element.js.map\n","/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t=globalThis,i=t.trustedTypes,s=i?i.createPolicy(\"lit-html\",{createHTML:t=>t}):void 0,e=\"$lit$\",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o=\"?\"+h,n=`<${o}>`,r=document,l=()=>r.createComment(\"\"),c=t=>null===t||\"object\"!=typeof t&&\"function\"!=typeof t,a=Array.isArray,u=t=>a(t)||\"function\"==typeof t?.[Symbol.iterator],d=\"[ \\t\\n\\f\\r]\",f=/<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\\\s\"'>=/]+)(${d}*=${d}*(?:[^ \\t\\n\\f\\r\"'\\`<>=]|(\"|')|))|$)`,\"g\"),p=/'/g,g=/\"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),b=y(2),w=y(3),T=Symbol.for(\"lit-noChange\"),E=Symbol.for(\"lit-nothing\"),A=new WeakMap,C=r.createTreeWalker(r,129);function P(t,i){if(!a(t)||!t.hasOwnProperty(\"raw\"))throw Error(\"invalid template strings array\");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?\"\":3===i?\"\":\"\",c=f;for(let i=0;i\"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'\"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith(\"/>\")?\" \":\"\";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e+s.slice(d)+h+x):s+h+(-2===d?i:x)}return[P(t,l+(t[s]||\"\")+(2===i?\"\":3===i?\"\":\"\")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=C.nextNode())&&d.length0){r.textContent=i?i.emptyScript:\"\";for(let i=0;i2||\"\"!==s[0]||\"\"!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else{const e=t;let n,r;for(t=h[0],n=0;n{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{})}return h._$AI(t),h};export{Z as _$LH,x as html,w as mathml,T as noChange,E as nothing,B as render,b as svg};\n//# sourceMappingURL=lit-html.js.map\n","import{ReactiveElement as t}from\"@lit/reactive-element\";export*from\"@lit/reactive-element\";import{render as e,noChange as r}from\"lit-html\";export*from\"lit-html\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const s=globalThis;class i extends t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=e(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return r}}i._$litElement$=!0,i[\"finalized\"]=!0,s.litElementHydrateSupport?.({LitElement:i});const o=s.litElementPolyfillSupport;o?.({LitElement:i});const n={_$AK:(t,e,r)=>{t._$AK(e,r)},_$AL:t=>t._$AL};(s.litElementVersions??=[]).push(\"4.2.1\");export{i as LitElement,n as _$LE};\n//# sourceMappingURL=lit-element.js.map\n","import{defaultConverter as t,notEqual as e}from\"../reactive-element.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const o={attribute:!0,type:String,converter:t,reflect:!1,hasChanged:e},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),\"setter\"===n&&((t=Object.create(t)).wrapped=!0),s.set(r.name,t),\"accessor\"===n){const{name:o}=r;return{set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t)},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if(\"setter\"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t)}}throw Error(\"Unsupported decorator location: \"+n)};function n(t){return(e,o)=>\"object\"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}export{n as property,r as standardProperty};\n//# sourceMappingURL=property.js.map\n","function e(e){this.message=e}e.prototype=new Error,e.prototype.name=\"InvalidCharacterError\";var r=\"undefined\"!=typeof window&&window.atob&&window.atob.bind(window)||function(r){var t=String(r).replace(/=+$/,\"\");if(t.length%4==1)throw new e(\"'atob' failed: The string to be decoded is not correctly encoded.\");for(var n,o,a=0,i=0,c=\"\";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?c+=String.fromCharCode(255&n>>(-2*a&6)):0)o=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\".indexOf(o);return c};function t(e){var t=e.replace(/-/g,\"+\").replace(/_/g,\"/\");switch(t.length%4){case 0:break;case 2:t+=\"==\";break;case 3:t+=\"=\";break;default:throw\"Illegal base64url string!\"}try{return function(e){return decodeURIComponent(r(e).replace(/(.)/g,(function(e,r){var t=r.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t=\"0\"+t),\"%\"+t})))}(t)}catch(e){return r(t)}}function n(e){this.message=e}function o(e,r){if(\"string\"!=typeof e)throw new n(\"Invalid token specified\");var o=!0===(r=r||{}).header?0:1;try{return JSON.parse(t(e.split(\".\")[o]))}catch(e){throw new n(\"Invalid token specified: \"+e.message)}}n.prototype=new Error,n.prototype.name=\"InvalidTokenError\";export default o;export{n as InvalidTokenError};\n//# sourceMappingURL=jwt-decode.esm.js.map\n","function t(t,n){for(var e=0;e=i&&(t._interval&&clearInterval(t._interval),t.status=\"Timeout\"):\"Connected\"===e()&&t._interval&&clearInterval(t._interval)}};return(a(this.options.pollingMs)||100)>0&&i>1&&(this._interval=setInterval(o,a(this.options.pollingMs)||100)),o(),this},e.stop=function(){return this._interval&&clearInterval(this._interval),this.resolvePromise&&this.resolvePromise(),this.status=\"Initial\",this},n(t,[{key:\"status\",set:function(t){this._status=t,this.options.onStatus&&this.options.onStatus(t)},get:function(){return this._status}}]),t}(),c=function(){function t(t){var n=this;this.__listeners=[],this.connectListener=function(t){try{t.stopPropagation(),n.__listeners=[].concat(n.__listeners,[t.detail]);var e=function(e,i){try{var o=Promise.resolve(t.detail.onConnect(n.__current)).then(function(){})}catch(t){return i(!0,t)}return o&&o.then?o.then(i.bind(null,!1),i.bind(null,!0)):i(!1,o)}(0,function(e,i){var o,r;if(n.__listeners=(r=(o=n.__listeners).indexOf(t.detail),o.slice(0,r).concat(o.slice(r+1,o.length))),e)throw i;return i});return Promise.resolve(e&&e.then?e.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},this.options=t,this.__current=a(t.initialState)}var e=t.prototype;return e.start=function(){return a(this.options.element).addEventListener(this.options.contextName,this.connectListener),this},e.stop=function(){return a(this.options.element).removeEventListener(this.options.contextName,this.connectListener),this.__listeners.map(function(t){t.onDisconnect()}),this.__listeners=[],this},n(t,[{key:\"context\",set:function(t){var n=this.__current;this.__current=t,this.__listeners.forEach(function(e){return e.onChange(t,n)})},get:function(){return a(this.__current)}},{key:\"listeners\",get:function(){return Object.freeze([].concat(this.__listeners))}}]),t}();function a(t){return\"function\"==typeof typeof t?t():t}export{s as ContextListener,c as ContextProvider,o as GlobalProviders,r as createContext};\n//# sourceMappingURL=index.module.js.map\n","const { toString, hasOwnProperty } = Object.prototype;\nconst fnToStr = Function.prototype.toString;\nconst previousComparisons = new Map();\n/**\n * Performs a deep equality check on two JavaScript values, tolerating cycles.\n */\nexport function equal(a, b) {\n try {\n return check(a, b);\n }\n finally {\n previousComparisons.clear();\n }\n}\n// Allow default imports as well.\nexport default equal;\nfunction check(a, b) {\n // If the two values are strictly equal, our job is easy.\n if (a === b) {\n return true;\n }\n // Object.prototype.toString returns a representation of the runtime type of\n // the given value that is considerably more precise than typeof.\n const aTag = toString.call(a);\n const bTag = toString.call(b);\n // If the runtime types of a and b are different, they could maybe be equal\n // under some interpretation of equality, but for simplicity and performance\n // we just return false instead.\n if (aTag !== bTag) {\n return false;\n }\n switch (aTag) {\n case '[object Array]':\n // Arrays are a lot like other objects, but we can cheaply compare their\n // lengths as a short-cut before comparing their elements.\n if (a.length !== b.length)\n return false;\n // Fall through to object case...\n case '[object Object]': {\n if (previouslyCompared(a, b))\n return true;\n const aKeys = definedKeys(a);\n const bKeys = definedKeys(b);\n // If `a` and `b` have a different number of enumerable keys, they\n // must be different.\n const keyCount = aKeys.length;\n if (keyCount !== bKeys.length)\n return false;\n // Now make sure they have the same keys.\n for (let k = 0; k < keyCount; ++k) {\n if (!hasOwnProperty.call(b, aKeys[k])) {\n return false;\n }\n }\n // Finally, check deep equality of all child properties.\n for (let k = 0; k < keyCount; ++k) {\n const key = aKeys[k];\n if (!check(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n case '[object Error]':\n return a.name === b.name && a.message === b.message;\n case '[object Number]':\n // Handle NaN, which is !== itself.\n if (a !== a)\n return b !== b;\n // Fall through to shared +a === +b case...\n case '[object Boolean]':\n case '[object Date]':\n return +a === +b;\n case '[object RegExp]':\n case '[object String]':\n return a == `${b}`;\n case '[object Map]':\n case '[object Set]': {\n if (a.size !== b.size)\n return false;\n if (previouslyCompared(a, b))\n return true;\n const aIterator = a.entries();\n const isMap = aTag === '[object Map]';\n while (true) {\n const info = aIterator.next();\n if (info.done)\n break;\n // If a instanceof Set, aValue === aKey.\n const [aKey, aValue] = info.value;\n // So this works the same way for both Set and Map.\n if (!b.has(aKey)) {\n return false;\n }\n // However, we care about deep equality of values only when dealing\n // with Map structures.\n if (isMap && !check(aValue, b.get(aKey))) {\n return false;\n }\n }\n return true;\n }\n case '[object Uint16Array]':\n case '[object Uint8Array]': // Buffer, in Node.js.\n case '[object Uint32Array]':\n case '[object Int32Array]':\n case '[object Int8Array]':\n case '[object Int16Array]':\n case '[object ArrayBuffer]':\n // DataView doesn't need these conversions, but the equality check is\n // otherwise the same.\n a = new Uint8Array(a);\n b = new Uint8Array(b);\n // Fall through...\n case '[object DataView]': {\n let len = a.byteLength;\n if (len === b.byteLength) {\n while (len-- && a[len] === b[len]) {\n // Keep looping as long as the bytes are equal.\n }\n }\n return len === -1;\n }\n case '[object AsyncFunction]':\n case '[object GeneratorFunction]':\n case '[object AsyncGeneratorFunction]':\n case '[object Function]': {\n const aCode = fnToStr.call(a);\n if (aCode !== fnToStr.call(b)) {\n return false;\n }\n // We consider non-native functions equal if they have the same code\n // (native functions require === because their code is censored).\n // Note that this behavior is not entirely sound, since !== function\n // objects with the same code can behave differently depending on\n // their closure scope. However, any function can behave differently\n // depending on the values of its input arguments (including this)\n // and its calling context (including its closure scope), even\n // though the function object is === to itself; and it is entirely\n // possible for functions that are not === to behave exactly the\n // same under all conceivable circumstances. Because none of these\n // factors are statically decidable in JavaScript, JS function\n // equality is not well-defined. This ambiguity allows us to\n // consider the best possible heuristic among various imperfect\n // options, and equating non-native functions that have the same\n // code has enormous practical benefits, such as when comparing\n // functions that are repeatedly passed as fresh function\n // expressions within objects that are otherwise deeply equal. Since\n // any function created from the same syntactic expression (in the\n // same code location) will always stringify to the same code\n // according to fnToStr.call, we can reasonably expect these\n // repeatedly passed function expressions to have the same code, and\n // thus behave \"the same\" (with all the caveats mentioned above),\n // even though the runtime function objects are !== to one another.\n return !endsWith(aCode, nativeCodeSuffix);\n }\n }\n // Otherwise the values are not equal.\n return false;\n}\nfunction definedKeys(obj) {\n // Remember that the second argument to Array.prototype.filter will be\n // used as `this` within the callback function.\n return Object.keys(obj).filter(isDefinedKey, obj);\n}\nfunction isDefinedKey(key) {\n return this[key] !== void 0;\n}\nconst nativeCodeSuffix = \"{ [native code] }\";\nfunction endsWith(full, suffix) {\n const fromIndex = full.length - suffix.length;\n return fromIndex >= 0 &&\n full.indexOf(suffix, fromIndex) === fromIndex;\n}\nfunction previouslyCompared(a, b) {\n // Though cyclic references can make an object graph appear infinite from the\n // perspective of a depth-first traversal, the graph still contains a finite\n // number of distinct object references. We use the previousComparisons cache\n // to avoid comparing the same pair of object references more than once, which\n // guarantees termination (even if we end up comparing every object in one\n // graph to every object in the other graph, which is extremely unlikely),\n // while still allowing weird isomorphic structures (like rings with different\n // lengths) a chance to pass the equality test.\n let bSet = previousComparisons.get(a);\n if (bSet) {\n // Return true here because we can be sure false will be returned somewhere\n // else if the objects are not equivalent.\n if (bSet.has(b))\n return true;\n }\n else {\n previousComparisons.set(a, bSet = new Set);\n }\n bSet.add(b);\n return false;\n}\n//# sourceMappingURL=index.js.map","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\n\n// src/types.ts\nvar USER_CONTEXT_NAME = \"sq:user-identity\";\nvar LOCALE_CONTEXT_NAME = \"sq:locale\";\nvar PROGRAM_CONTEXT_NAME = \"sq:program-id\";\nvar DEFAULT_MEDIUM = \"EMBED\";\n\n// src/environment.ts\nfunction getEnvironment() {\n return getEnvironmentSDK().type;\n}\nfunction getEnvironmentSDK() {\n var _a, _b, _c;\n if (window[\"SquatchAndroid\"]) {\n return {\n type: \"SquatchAndroid\",\n android: window[\"SquatchAndroid\"],\n widgetIdent: window[\"widgetIdent\"]\n };\n }\n if (window[\"SquatchPortal\"]) {\n return {\n type: \"SquatchPortal\",\n env: window[\"SquatchPortal\"]\n };\n }\n if (window[\"SquatchAdmin\"]) {\n return {\n type: \"SquatchAdmin\",\n adminSDK: window[\"SquatchAdmin\"]\n };\n }\n if ((window[\"widgetIdent\"] || ((_a = window.frameElement) == null ? void 0 : _a[\"squatchJsApi\"])) && ((_b = window[\"widgetIdent\"]) == null ? void 0 : _b.env) !== \"demo\") {\n return {\n type: \"SquatchJS2\",\n api: (_c = window.frameElement) == null ? void 0 : _c[\"squatchJsApi\"],\n widgetIdent: window[\"widgetIdent\"]\n };\n }\n return {\n type: \"None\"\n };\n}\nfunction isDemo() {\n const sdk = getEnvironmentSDK();\n return sdk.type === \"None\" || sdk.type === \"SquatchAdmin\";\n}\nvar FAKE_TENANT = \"demo\";\nfunction getTenantAlias() {\n var _a;\n const sdk = getEnvironmentSDK();\n switch (sdk.type) {\n case \"SquatchAndroid\":\n case \"SquatchIOS\":\n case \"SquatchJS2\":\n return (_a = sdk.widgetIdent) == null ? void 0 : _a.tenantAlias;\n case \"SquatchAdmin\":\n case \"None\":\n return FAKE_TENANT;\n case \"SquatchPortal\":\n return sdk.env.tenantAlias;\n }\n}\nvar DEFAULT_DOMAIN = \"https://app.referralsaasquatch.com\";\nfunction getAppDomain() {\n var _a, _b;\n const sdk = getEnvironmentSDK();\n switch (sdk.type) {\n case \"SquatchAndroid\":\n case \"SquatchIOS\":\n case \"SquatchJS2\":\n return ((_a = sdk.widgetIdent) == null ? void 0 : _a.appDomain) || DEFAULT_DOMAIN;\n case \"SquatchPortal\":\n return ((_b = sdk.env) == null ? void 0 : _b.appDomain) || DEFAULT_DOMAIN;\n case \"SquatchAdmin\":\n case \"None\":\n return DEFAULT_DOMAIN;\n }\n}\nfunction getEngagementMedium() {\n var _a;\n const sdk = getEnvironmentSDK();\n switch (sdk.type) {\n case \"SquatchJS2\":\n return ((_a = sdk.widgetIdent) == null ? void 0 : _a.engagementMedium) || DEFAULT_MEDIUM;\n case \"SquatchAndroid\":\n case \"SquatchIOS\":\n case \"SquatchPortal\":\n case \"SquatchAdmin\":\n case \"None\":\n return DEFAULT_MEDIUM;\n }\n}\n\n// src/debug.ts\nvar debugEnabled = (() => {\n var _a;\n try {\n return (_a = window == null ? void 0 : window.localStorage) == null ? void 0 : _a.getItem(\"debug\");\n } catch (e) {\n return false;\n }\n})();\nfunction debug(ns, ...args) {\n if (debugEnabled) {\n console.debug(`sq:environment:${ns}`, ...args);\n }\n}\n\n// src/history.ts\nvar debug2 = (...args) => debug(\"history\", ...args);\nfunction normalizeTo(to) {\n if (typeof to === \"string\")\n return to;\n const url = new URL(to.pathname, window.origin);\n if (to.search)\n url.search = to.search;\n if (to.hash)\n url.hash = to.hash;\n return url;\n}\nvar BrowserHistory = class {\n constructor() {\n this.listeners = /* @__PURE__ */ new Set();\n window.addEventListener(\"popstate\", this.notify.bind(this));\n window.addEventListener(\"pushState\", this.notify.bind(this));\n window.addEventListener(\"replaceState\", this.notify.bind(this));\n }\n listen(fn) {\n this.listeners.add(fn);\n return () => {\n this.listeners.delete(fn);\n };\n }\n notify() {\n debug2(\"notifying listeners of route change\", this.location);\n if (this.listeners) {\n this.listeners.forEach((listener) => listener());\n }\n }\n get location() {\n return {\n pathname: window.location.pathname,\n search: window.location.search,\n hash: window.location.hash,\n state: window.history.state\n };\n }\n back() {\n this.go(-1);\n }\n forward() {\n this.go(1);\n }\n go(delta) {\n window.history.go(delta);\n }\n push(to, state) {\n const url = normalizeTo(to);\n window.history.pushState(state, \"\", url);\n }\n replace(to, state) {\n const url = normalizeTo(to);\n window.history.replaceState(state, \"\", url);\n }\n};\nvar MemoryHistory = class {\n constructor() {\n this.history = [{ pathname: \"/\", search: \"\", hash: \"\" }];\n this.index = 0;\n this.listeners = /* @__PURE__ */ new Set();\n }\n listen(fn) {\n this.listeners.add(fn);\n return () => {\n this.listeners.delete(fn);\n };\n }\n current() {\n return this.history[this.index];\n }\n get state() {\n return this.current().state;\n }\n notify() {\n debug2(\"notifying listeners of route change\", this.location);\n this.listeners.forEach((listener) => listener());\n }\n get location() {\n return this.history[this.index];\n }\n back() {\n this.go(-1);\n }\n forward() {\n this.go(1);\n }\n go(delta) {\n this.index += delta;\n if (this.index < 0)\n this.index = 0;\n if (this.index >= this.history.length)\n this.index = this.history.length - 1;\n this.notify();\n }\n push(to, state) {\n let entry;\n if (typeof to === \"string\") {\n entry = {\n pathname: to,\n search: this.history[this.index].search,\n hash: this.history[this.index].hash,\n state\n };\n } else {\n entry = __spreadProps(__spreadValues({}, to), {\n state\n });\n }\n this.index++;\n this.history.splice(this.index, this.history.length, entry);\n this.notify();\n }\n replace(to, state) {\n if (typeof to === \"string\") {\n this.history[this.index] = {\n pathname: to,\n search: \"\",\n hash: \"\",\n state\n };\n } else {\n this.history[this.index] = __spreadProps(__spreadValues({}, to), {\n state\n });\n }\n this.notify();\n }\n};\nfunction createHistory() {\n if (getEnvironment() === \"SquatchPortal\") {\n let wrapHistoryFunction2 = function(functionName) {\n const orig = window.history[functionName];\n return function(...args) {\n const returnValue = orig.apply(window.history, args);\n const event = new Event(functionName);\n window.dispatchEvent(event);\n return returnValue;\n };\n };\n var wrapHistoryFunction = wrapHistoryFunction2;\n window.history.pushState = wrapHistoryFunction2(\"pushState\");\n window.history.replaceState = wrapHistoryFunction2(\"replaceState\");\n return new BrowserHistory();\n } else {\n return new MemoryHistory();\n }\n}\nfunction lazyHistory() {\n window.squatchHistory = window.squatchHistory || createHistory();\n return window.squatchHistory;\n}\nvar LazyHistory = class {\n get location() {\n return lazyHistory().location;\n }\n listen(fn) {\n return lazyHistory().listen(fn);\n }\n back() {\n lazyHistory().back();\n }\n forward() {\n lazyHistory().forward();\n }\n go(delta) {\n lazyHistory().go(delta);\n }\n push(to, state) {\n lazyHistory().push(to, state);\n }\n replace(to, state) {\n lazyHistory().replace(to, state);\n }\n};\nvar history_default = new LazyHistory();\n\n// src/contexts/UserIdentityContext.ts\nimport decode from \"jwt-decode\";\nimport { ContextProvider as ContextProvider2 } from \"dom-context\";\nimport { equal } from \"@wry/equality\";\n\n// src/listeners.ts\nimport { ContextListener } from \"dom-context\";\n\n// src/contexts/LocaleContext.ts\nimport { ContextProvider } from \"dom-context\";\nvar debug3 = (...args) => debug(LOCALE_CONTEXT_NAME, ...args);\nfunction validateLocale(locale) {\n if (locale && /^[a-z]{2}(_(?:[A-Z]{2}|[0-9]{3}))?$/.test(locale)) {\n return locale;\n }\n}\nfunction lazilyStartLocaleContext() {\n var _a;\n let globalProvider = window.squatchLocale;\n if (!globalProvider) {\n debug3(\"Creating locale context provider\");\n const locale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll(\"-\", \"_\"));\n debug3(\"initializing with locale:\", locale);\n globalProvider = new ContextProvider({\n element: document.documentElement,\n initialState: locale,\n contextName: LOCALE_CONTEXT_NAME\n }).start();\n window.squatchLocale = globalProvider;\n }\n return globalProvider;\n}\nfunction setLocale(locale) {\n const globalProvider = lazilyStartLocaleContext();\n if (globalProvider.context !== locale) {\n debug3(`Setting locale context value [${locale}]`);\n globalProvider.context = locale;\n }\n}\nfunction getLocale() {\n var _a;\n return (_a = window.squatchLocale) == null ? void 0 : _a.context;\n}\n\n// src/fetchLocale.ts\nvar debug4 = (...args) => debug(LOCALE_CONTEXT_NAME, ...args);\nvar GET_LOCALE = `\n query {\n viewer {\n ... on User {\n locale\n }\n }\n }\n`;\nasync function fetchLocale() {\n var _a;\n debug4(\"Fetching locale from GraphQL for current user\");\n try {\n const result = await fetch(`${getAppDomain()}/api/v1/${getTenantAlias()}/graphql`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${(_a = getUserIdentity()) == null ? void 0 : _a.jwt}`\n },\n body: JSON.stringify({\n query: GET_LOCALE\n })\n });\n if (!result.ok) {\n throw new Error(\"Failed to fetch locale\");\n }\n const json = await result.json();\n if (json.errors) {\n throw new Error(JSON.stringify(json.errors, null, 2));\n }\n return json.data.viewer.locale || void 0;\n } catch (e) {\n debug4(`Failed to fetch locale for current user`, e.message);\n return void 0;\n }\n}\n\n// src/listeners.ts\nvar debug5 = (...args) => debug(LOCALE_CONTEXT_NAME, ...args);\nvar userContextListenerDiv = (() => {\n const id = \"__environment_context_listener\";\n let div = document.getElementById(id);\n if (!div) {\n div = document.createElement(\"div\");\n div.id = id;\n document.documentElement.appendChild(div);\n }\n return div;\n})();\nvar userContextListenerForLocale = new ContextListener({\n contextName: USER_CONTEXT_NAME,\n element: userContextListenerDiv,\n onChange: async (next) => {\n var _a;\n const localeProvider = lazilyStartLocaleContext();\n const defaultLocale = ((_a = window.widgetIdent) == null ? void 0 : _a.locale) ?? validateLocale(navigator.language.replaceAll(\"-\", \"_\"));\n let newLocale;\n if (next) {\n debug5(\"User context changed, refetching locale\");\n const locale = await fetchLocale();\n debug5(`New value fetched from GraphQL [${locale}]`);\n newLocale = locale || defaultLocale;\n } else {\n newLocale = defaultLocale;\n }\n debug5(`Setting locale context to [${newLocale}]`);\n localeProvider.context = newLocale;\n }\n});\nfunction startUserContextListenerForLocale() {\n debug5(\"Starting user context listener for locale updates\");\n userContextListenerForLocale.start();\n}\n\n// src/contexts/UserIdentityContext.ts\nvar debug6 = (...args) => debug(USER_CONTEXT_NAME, ...args);\nfunction lazilyStartUserContext() {\n let globalProvider = window.squatchUserIdentity;\n if (!globalProvider) {\n debug6(\"Creating user context provider\");\n globalProvider = new ContextProvider2({\n element: document.documentElement,\n initialState: _getInitialValue(),\n contextName: USER_CONTEXT_NAME\n }).start();\n window.squatchUserIdentity = globalProvider;\n startUserContextListenerForLocale();\n }\n return globalProvider;\n}\nfunction isDecodedSquatchJWT(decoded) {\n return decoded.user && decoded.user.id && decoded.user.accountId;\n}\nfunction isDecodedWidgetAPIJWT(decoded) {\n return decoded.sub && /.*:.*@.*:users/.test(decoded.sub);\n}\nfunction userIdentityFromJwt(jwt) {\n if (!jwt)\n return void 0;\n try {\n const decoded = decode(jwt);\n const exp = decoded.exp;\n let userId = void 0;\n let accountId = void 0;\n let email = void 0;\n if (isDecodedWidgetAPIJWT(decoded)) {\n const matches = decoded.sub.match(/(.*):(.*)@(.*):users/);\n if (matches == null ? void 0 : matches[1])\n accountId = atob(matches[1]);\n if (matches == null ? void 0 : matches[2])\n userId = atob(matches[2]);\n } else if (isDecodedSquatchJWT(decoded)) {\n accountId = decoded.user.accountId;\n userId = decoded.user.id;\n email = decoded.user.email;\n }\n if (!userId || !accountId) {\n debug6(\"No user information\");\n return void 0;\n }\n if (exp && Date.now() >= exp * 1e3) {\n debug6(\"JWT has expired\");\n return void 0;\n }\n return {\n id: userId,\n accountId,\n email,\n jwt\n };\n } catch (e) {\n debug6(\"Invalid JWT\");\n return void 0;\n }\n}\nfunction _getInitialValue() {\n const sdk = getEnvironmentSDK();\n switch (sdk.type) {\n case \"SquatchIOS\":\n case \"SquatchAndroid\":\n case \"SquatchJS2\":\n if (!sdk.widgetIdent)\n return void 0;\n const { userId, accountId, token } = sdk.widgetIdent;\n if (!userId || !accountId || !token)\n return void 0;\n return {\n id: sdk.widgetIdent.userId,\n accountId: sdk.widgetIdent.accountId,\n email: sdk.widgetIdent.email,\n jwt: sdk.widgetIdent.token\n };\n case \"SquatchPortal\":\n const searchParams = new URLSearchParams(document.location.search);\n if (searchParams.has(\"jwt\")) {\n return userIdentityFromJwt(searchParams.get(\"jwt\"));\n }\n const stored = localStorage.getItem(USER_CONTEXT_NAME);\n if (!stored)\n return void 0;\n try {\n const potentialUserIdent = JSON.parse(stored);\n const identity = userIdentityFromJwt(potentialUserIdent.jwt);\n if (identity) {\n return __spreadValues(__spreadValues({}, potentialUserIdent), identity);\n }\n return void 0;\n } catch (e) {\n return void 0;\n }\n case \"SquatchAdmin\":\n case \"None\":\n return void 0;\n }\n}\nfunction setUserIdentity(identity) {\n const globalProvider = lazilyStartUserContext();\n if (!equal(globalProvider.context, identity)) {\n debug6(`Setting user context value [${JSON.stringify(identity)}]`);\n globalProvider.context = identity;\n }\n if (identity && getEnvironmentSDK().type === \"SquatchPortal\") {\n localStorage.setItem(USER_CONTEXT_NAME, JSON.stringify(identity));\n } else if (!identity) {\n localStorage.removeItem(USER_CONTEXT_NAME);\n }\n}\nfunction getUserIdentity() {\n var _a;\n return (_a = window.squatchUserIdentity) == null ? void 0 : _a.context;\n}\n\n// src/contexts/ProgramContext.ts\nimport { ContextProvider as ContextProvider3 } from \"dom-context\";\nvar debug7 = (...args) => debug(PROGRAM_CONTEXT_NAME, ...args);\nfunction lazilyStartProgramContext() {\n var _a;\n let globalProvider = window.squatchProgramId;\n if (!globalProvider) {\n debug7(\"Creating program context provider\");\n globalProvider = new ContextProvider3({\n element: document.documentElement,\n initialState: ((_a = window.widgetIdent) == null ? void 0 : _a.programId) || void 0,\n contextName: PROGRAM_CONTEXT_NAME\n }).start();\n window.squatchProgramId = globalProvider;\n }\n return globalProvider;\n}\nfunction setProgramId(programId) {\n const globalProvider = lazilyStartProgramContext();\n if (globalProvider.context !== programId) {\n debug7(`Setting program context value [${programId}]`);\n globalProvider.context = programId;\n }\n}\nfunction getProgramId() {\n var _a;\n return (_a = window.squatchProgramId) == null ? void 0 : _a.context;\n}\nexport {\n BrowserHistory,\n DEFAULT_MEDIUM,\n LOCALE_CONTEXT_NAME,\n LazyHistory,\n MemoryHistory,\n PROGRAM_CONTEXT_NAME,\n USER_CONTEXT_NAME,\n getAppDomain,\n getEngagementMedium,\n getEnvironment,\n getEnvironmentSDK,\n getLocale,\n getProgramId,\n getTenantAlias,\n getUserIdentity,\n history_default as history,\n isDemo,\n lazilyStartLocaleContext,\n lazilyStartProgramContext,\n lazilyStartUserContext,\n setLocale,\n setProgramId,\n setUserIdentity,\n userIdentityFromJwt,\n validateLocale\n};\n","let current;\nlet currentId = 0;\nfunction setCurrent(state) {\n current = state;\n}\nfunction clear() {\n current = null;\n currentId = 0;\n}\nfunction notify() {\n return currentId++;\n}\nexport { clear, current, setCurrent, notify };\n","const phaseSymbol = Symbol(\"haunted.phase\");\nconst hookSymbol = Symbol(\"haunted.hook\");\nconst updateSymbol = Symbol(\"haunted.update\");\nconst commitSymbol = Symbol(\"haunted.commit\");\nconst effectsSymbol = Symbol(\"haunted.effects\");\nconst layoutEffectsSymbol = Symbol(\"haunted.layoutEffects\");\nconst contextEvent = \"haunted.context\";\nexport { phaseSymbol, hookSymbol, updateSymbol, commitSymbol, effectsSymbol, layoutEffectsSymbol, contextEvent, };\n","import { State } from \"./state\";\nimport { commitSymbol, phaseSymbol, updateSymbol, effectsSymbol, layoutEffectsSymbol, } from \"./symbols\";\nconst defer = Promise.resolve().then.bind(Promise.resolve());\nfunction runner() {\n let tasks = [];\n let id;\n function runTasks() {\n id = null;\n let t = tasks;\n tasks = [];\n for (var i = 0, len = t.length; i < len; i++) {\n t[i]();\n }\n }\n return function (task) {\n tasks.push(task);\n if (id == null) {\n id = defer(runTasks);\n }\n };\n}\nconst read = runner();\nconst write = runner();\nclass BaseScheduler {\n renderer;\n host;\n state;\n [phaseSymbol];\n _updateQueued;\n constructor(renderer, host) {\n this.renderer = renderer;\n this.host = host;\n this.state = new State(this.update.bind(this), host);\n this[phaseSymbol] = null;\n this._updateQueued = false;\n }\n update() {\n if (this._updateQueued)\n return;\n read(() => {\n let result = this.handlePhase(updateSymbol);\n write(() => {\n this.handlePhase(commitSymbol, result);\n write(() => {\n this.handlePhase(effectsSymbol);\n });\n });\n this._updateQueued = false;\n });\n this._updateQueued = true;\n }\n handlePhase(phase, arg) {\n this[phaseSymbol] = phase;\n switch (phase) {\n case commitSymbol:\n this.commit(arg);\n this.runEffects(layoutEffectsSymbol);\n return;\n case updateSymbol:\n return this.render();\n case effectsSymbol:\n return this.runEffects(effectsSymbol);\n }\n }\n render() {\n return this.state.run(() => this.renderer.call(this.host, this.host));\n }\n runEffects(phase) {\n this.state._runEffects(phase);\n }\n teardown() {\n this.state.teardown();\n }\n}\nexport { BaseScheduler };\n","import { current, notify } from \"./interface\";\nimport { hookSymbol } from \"./symbols\";\nclass Hook {\n id;\n state;\n constructor(id, state) {\n this.id = id;\n this.state = state;\n }\n}\nfunction use(Hook, ...args) {\n let id = notify();\n let hooks = current[hookSymbol];\n let hook = hooks.get(id);\n if (!hook) {\n hook = new Hook(id, current, ...args);\n hooks.set(id, hook);\n }\n return hook.update(...args);\n}\nfunction hook(Hook) {\n return use.bind(null, Hook);\n}\nexport { hook, Hook };\n","import { Hook, hook } from \"./hook\";\nfunction createEffect(setEffects) {\n return hook(class extends Hook {\n callback;\n lastValues;\n values;\n _teardown;\n constructor(id, state, ignored1, ignored2) {\n super(id, state);\n setEffects(state, this);\n }\n update(callback, values) {\n this.callback = callback;\n this.values = values;\n }\n call() {\n const hasChanged = !this.values || this.hasChanged();\n this.lastValues = this.values;\n if (hasChanged) {\n this.run();\n }\n }\n run() {\n this.teardown();\n this._teardown = this.callback.call(this.state);\n }\n teardown() {\n if (typeof this._teardown === \"function\") {\n this._teardown();\n }\n }\n hasChanged() {\n return (!this.lastValues ||\n this.values.some((value, i) => this.lastValues[i] !== value));\n }\n });\n}\nexport { createEffect };\n","import { effectsSymbol } from \"./symbols\";\nimport { createEffect } from \"./create-effect\";\nfunction setEffects(state, cb) {\n state[effectsSymbol].push(cb);\n}\n/**\n * @function\n * @param {() => void} effect - callback function that runs each time dependencies change\n * @param {unknown[]} [dependencies] - list of dependencies to the effect\n * @return {void}\n */\nconst useEffect = createEffect(setEffects);\nexport { setEffects, useEffect };\n","import { hook, Hook } from \"./hook\";\nimport { contextEvent } from \"./symbols\";\nimport { setEffects } from \"./use-effect\";\n/**\n * @function\n * @template T\n * @param {Context} context\n * @return {T}\n */\nconst useContext = hook(class extends Hook {\n Context;\n value;\n _ranEffect;\n _unsubscribe;\n constructor(id, state, _) {\n super(id, state);\n this._updater = this._updater.bind(this);\n this._ranEffect = false;\n this._unsubscribe = null;\n setEffects(state, this);\n }\n update(Context) {\n if (this.state.virtual) {\n throw new Error(\"can't be used with virtual components\");\n }\n if (this.Context !== Context) {\n this._subscribe(Context);\n this.Context = Context;\n }\n return this.value;\n }\n call() {\n if (!this._ranEffect) {\n this._ranEffect = true;\n if (this._unsubscribe)\n this._unsubscribe();\n this._subscribe(this.Context);\n this.state.update();\n }\n }\n _updater(value) {\n this.value = value;\n this.state.update();\n }\n _subscribe(Context) {\n const detail = { Context, callback: this._updater };\n this.state.host.dispatchEvent(new CustomEvent(contextEvent, {\n detail,\n bubbles: true,\n cancelable: true,\n composed: true, // to pass ShadowDOM boundaries\n }));\n const { unsubscribe = null, value } = detail;\n this.value = unsubscribe ? value : Context.defaultValue;\n this._unsubscribe = unsubscribe;\n }\n teardown() {\n if (this._unsubscribe) {\n this._unsubscribe();\n }\n }\n});\nexport { useContext };\n","import { hook, Hook } from \"./hook\";\n/**\n * @function\n * @template T\n * @param {() => T} fn function to memoize\n * @param {unknown[]} values dependencies to the memoized computation\n * @return {T} The next computed value\n */\nconst useMemo = hook(class extends Hook {\n value;\n values;\n constructor(id, state, fn, values) {\n super(id, state);\n this.value = fn();\n this.values = values;\n }\n update(fn, values) {\n if (this.hasChanged(values)) {\n this.values = values;\n this.value = fn();\n }\n return this.value;\n }\n hasChanged(values = []) {\n return values.some((value, i) => this.values[i] !== value);\n }\n});\nexport { useMemo };\n","import { useMemo } from \"./use-memo\";\n/**\n * @function\n * @template {Function} T\n * @param {T} fn - callback to memoize\n * @param {unknown[]} inputs - dependencies to callback memoization\n * @return {T}\n */\nconst useCallback = (fn, inputs) => useMemo(() => fn, inputs);\nexport { useCallback };\n","import { layoutEffectsSymbol } from \"./symbols\";\nimport { createEffect } from \"./create-effect\";\nfunction setLayoutEffects(state, cb) {\n state[layoutEffectsSymbol].push(cb);\n}\n/**\n * @function\n * @param {Effect} callback effecting callback\n * @param {unknown[]} [values] dependencies to the effect\n * @return {void}\n */\nconst useLayoutEffect = createEffect(setLayoutEffects);\nexport { useLayoutEffect };\n","import { hook, Hook } from \"./hook\";\n/**\n * @function\n * @template {*} T\n * @param {T} [initialState] - Optional initial state\n * @return {StateTuple} stateTuple - Tuple of current state and state updater function\n */\nconst useState = hook(class extends Hook {\n args;\n constructor(id, state, initialValue) {\n super(id, state);\n this.updater = this.updater.bind(this);\n if (typeof initialValue === \"function\") {\n const initFn = initialValue;\n initialValue = initFn();\n }\n this.makeArgs(initialValue);\n }\n update() {\n return this.args;\n }\n updater(value) {\n const [previousValue] = this.args;\n if (typeof value === \"function\") {\n const updaterFn = value;\n value = updaterFn(previousValue);\n }\n if (Object.is(previousValue, value)) {\n return;\n }\n this.makeArgs(value);\n this.state.update();\n }\n makeArgs(value) {\n this.args = Object.freeze([value, this.updater]);\n }\n});\nexport { useState };\n","/**\n * @license\n * Portions Copyright 2021 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nimport { useLayoutEffect } from \"./use-layout-effect\";\nimport { useState } from \"./use-state\";\nconst microtask = Promise.resolve();\n/**\n * An implementation of ReactiveControllerHost that is driven by Haunted hooks\n * and `useController()`.\n */\nclass HauntedControllerHost {\n count;\n kick;\n _controllers = [];\n _updatePending = true;\n _updateCompletePromise;\n _resolveUpdate;\n constructor(count, kick) {\n this.count = count;\n this.kick = kick;\n this._updateCompletePromise = new Promise((res) => {\n this._resolveUpdate = res;\n });\n }\n addController(controller) {\n this._controllers.push(controller);\n }\n removeController(controller) {\n // Note, if the indexOf is -1, the >>> will flip the sign which makes the\n // splice do nothing.\n this._controllers &&\n this._controllers.splice(this._controllers.indexOf(controller) >>> 0, 1);\n }\n requestUpdate() {\n if (!this._updatePending) {\n this._updatePending = true;\n microtask.then(() => this.kick((this.count += 1)));\n }\n }\n get updateComplete() {\n return this._updateCompletePromise;\n }\n connected() {\n this._controllers.forEach((c) => c.hostConnected && c.hostConnected());\n }\n disconnected() {\n this._controllers.forEach((c) => c.hostDisconnected && c.hostDisconnected());\n }\n update() {\n this._controllers.forEach((c) => c.hostUpdate && c.hostUpdate());\n }\n updated() {\n this._updatePending = false;\n const resolve = this._resolveUpdate;\n // Create a new updateComplete Promise for the next update,\n // before resolving the current one.\n this._updateCompletePromise = new Promise((res) => {\n this._resolveUpdate = res;\n });\n this._controllers.forEach((c) => c.hostUpdated && c.hostUpdated());\n resolve(this._updatePending);\n }\n}\n/**\n * Creates and stores a stateful ReactiveController instance and provides it\n * with a ReactiveControllerHost that drives the controller lifecycle.\n *\n * Use this hook to convert a ReactiveController into a Haunted hook.\n *\n * @param {(host: ReactiveControllerHost) => C} createController A function that creates a controller instance.\n * This function is given a HauntedControllerHost to pass to the controller. The\n * create function is only called once per component.\n * @return {ReactiveController} the controller instance\n */\nexport function useController(createController) {\n const [count, kick] = useState(0);\n const [host] = useState(() => {\n const host = new HauntedControllerHost(count, kick);\n const controller = createController(host);\n host.primaryController = controller;\n host.connected();\n return host;\n });\n // We use useLayoutEffect because we need updated() called synchronously\n // after rendering.\n useLayoutEffect(() => host.updated());\n // Returning a cleanup function simulates hostDisconnected timing. An empty\n // deps array tells Haunted to only call this once: on mount with the cleanup\n // called on unmount.\n useLayoutEffect(() => () => host.disconnected(), []);\n host.update();\n return host.primaryController;\n}\n","import { hook, Hook } from \"./hook\";\n/**\n * Given a reducer function, initial state, and optional state initializer function, returns a tuple of state and dispatch function.\n * @function\n * @template S State\n * @template I Initial State\n * @template A Action\n * @param {Reducer} reducer - reducer function to compute the next state given the previous state and the action\n * @param {I} initialState - the initial state of the reducer\n * @param {(init: I) => S} [init=undefined] - Optional initializer function, called on initialState if provided\n * @return {readonly [S, (action: A) => void]}\n */\nconst useReducer = hook(class extends Hook {\n reducer;\n currentState;\n constructor(id, state, _, initialState, init) {\n super(id, state);\n this.dispatch = this.dispatch.bind(this);\n this.currentState =\n init !== undefined ? init(initialState) : initialState;\n }\n update(reducer) {\n this.reducer = reducer;\n return [this.currentState, this.dispatch];\n }\n dispatch(action) {\n this.currentState = this.reducer(this.currentState, action);\n this.state.update();\n }\n});\nexport { useReducer };\n","import { useMemo } from \"./use-memo\";\nexport function useRef(initialValue) {\n return useMemo(() => ({\n current: initialValue,\n }), []);\n}\n","import{createContext as e,ContextListener as t,ContextProvider as n}from\"dom-context\";import{useRef as r,useState as o,useMemo as s,useEffect as a,useReducer as i}from\"@saasquatch/universal-hooks\";function c(){return(c=Object.assign||function(e){for(var t=1;t0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]);switch((t[2]||\"ms\").toLowerCase()){case\"years\":case\"year\":case\"yrs\":case\"yr\":case\"y\":return 315576e5*n;case\"weeks\":case\"week\":case\"w\":return 6048e5*n;case\"days\":case\"day\":case\"d\":return n*d;case\"hours\":case\"hour\":case\"hrs\":case\"hr\":case\"h\":return n*l;case\"minutes\":case\"minute\":case\"mins\":case\"min\":case\"m\":return n*C;case\"seconds\":case\"second\":case\"secs\":case\"sec\":case\"s\":return n*u;case\"milliseconds\":case\"millisecond\":case\"msecs\":case\"msec\":case\"ms\":return n;default:return}}}}(e);if(\"number\"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=d?g(e,t,d,\"day\"):t>=l?g(e,t,l,\"hour\"):t>=C?g(e,t,C,\"minute\"):t>=u?g(e,t,u,\"second\"):e+\" ms\"}(e):function(e){var t=Math.abs(e);return t>=d?Math.round(e/d)+\"d\":t>=l?Math.round(e/l)+\"h\":t>=C?Math.round(e/C)+\"m\":t>=u?Math.round(e/u)+\"s\":e+\"ms\"}(e);throw new Error(\"val is not a non-empty string or a valid number. val=\"+JSON.stringify(e))};function g(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+\" \"+r+(o?\"s\":\"\")}var p,m=(function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?\"%c\":\"\")+this.namespace+(this.useColors?\" %c\":\" \")+t[0]+(this.useColors?\"%c \":\" \")+\"+\"+e.exports.humanize(this.diff),!this.useColors)return;const n=\"color: \"+this.color;t.splice(1,0,n,\"color: inherit\");let r=0,o=0;t[0].replace(/%[a-zA-Z%]/g,e=>{\"%%\"!==e&&(r++,\"%c\"===e&&(o=r))}),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem(\"debug\",e):t.storage.removeItem(\"debug\")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem(\"debug\")}catch(e){}return!e&&\"undefined\"!=typeof process&&\"env\"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!(\"undefined\"==typeof window||!window.process||\"renderer\"!==window.process.type&&!window.process.__nwjs)||(\"undefined\"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/))&&(\"undefined\"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||\"undefined\"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||\"undefined\"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)&&parseInt(RegExp.$1,10)>=31||\"undefined\"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn(\"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.\"))}})(),t.colors=[\"#0000CC\",\"#0000FF\",\"#0033CC\",\"#0033FF\",\"#0066CC\",\"#0066FF\",\"#0099CC\",\"#0099FF\",\"#00CC00\",\"#00CC33\",\"#00CC66\",\"#00CC99\",\"#00CCCC\",\"#00CCFF\",\"#3300CC\",\"#3300FF\",\"#3333CC\",\"#3333FF\",\"#3366CC\",\"#3366FF\",\"#3399CC\",\"#3399FF\",\"#33CC00\",\"#33CC33\",\"#33CC66\",\"#33CC99\",\"#33CCCC\",\"#33CCFF\",\"#6600CC\",\"#6600FF\",\"#6633CC\",\"#6633FF\",\"#66CC00\",\"#66CC33\",\"#9900CC\",\"#9900FF\",\"#9933CC\",\"#9933FF\",\"#99CC00\",\"#99CC33\",\"#CC0000\",\"#CC0033\",\"#CC0066\",\"#CC0099\",\"#CC00CC\",\"#CC00FF\",\"#CC3300\",\"#CC3333\",\"#CC3366\",\"#CC3399\",\"#CC33CC\",\"#CC33FF\",\"#CC6600\",\"#CC6633\",\"#CC9900\",\"#CC9933\",\"#CCCC00\",\"#CCCC33\",\"#FF0000\",\"#FF0033\",\"#FF0066\",\"#FF0099\",\"#FF00CC\",\"#FF00FF\",\"#FF3300\",\"#FF3333\",\"#FF3366\",\"#FF3399\",\"#FF33CC\",\"#FF33FF\",\"#FF6600\",\"#FF6633\",\"#FF9900\",\"#FF9933\",\"#FFCC00\",\"#FFCC33\"],t.log=console.debug||console.log||(()=>{}),e.exports=function(e){function t(e){let r,o=null;function s(...e){if(!s.enabled)return;const n=s,o=Number(new Date);n.diff=o-(r||o),n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),\"string\"!=typeof e[0]&&e.unshift(\"%O\");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(r,o)=>{if(\"%%\"===r)return\"%\";a++;const s=t.formatters[o];return\"function\"==typeof s&&(r=s.call(n,e[a]),e.splice(a,1),a--),r}),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=n,s.destroy=t.destroy,Object.defineProperty(s,\"enabled\",{enumerable:!0,configurable:!1,get:()=>null===o?t.enabled(e):o,set:e=>{o=e}}),\"function\"==typeof t.init&&t.init(s),s}function n(e,n){const r=t(this.namespace+(void 0===n?\":\":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\\.\\*\\?$/,\"*\")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map(e=>\"-\"+e)].join(\",\");return t.enable(\"\"),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=(\"string\"==typeof e?e:\"\").split(/[\\s,]+/),o=r.length;for(n=0;n{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t 120) {\n var subLineIndex = Math.floor(columnNum / 80);\n var subLineColumnNum = columnNum % 80;\n var subLines = [];\n\n for (var i = 0; i < locationLine.length; i += 80) {\n subLines.push(locationLine.slice(i, i + 80));\n }\n\n return locationStr + printPrefixedLines([[\"\".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) {\n return ['', subLine];\n }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]]));\n }\n\n return locationStr + printPrefixedLines([// Lines specified like this: [\"prefix\", \"string\"],\n [\"\".concat(lineNum - 1), lines[lineIndex - 1]], [\"\".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], [\"\".concat(lineNum + 1), lines[lineIndex + 1]]]);\n}\n\nfunction printPrefixedLines(lines) {\n var existingLines = lines.filter(function (_ref) {\n var _ = _ref[0],\n line = _ref[1];\n return line !== undefined;\n });\n var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) {\n var prefix = _ref2[0];\n return prefix.length;\n }));\n return existingLines.map(function (_ref3) {\n var prefix = _ref3[0],\n line = _ref3[1];\n return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |');\n }).join('\\n');\n}\n\nfunction whitespace(len) {\n return Array(len + 1).join(' ');\n}\n\nfunction leftPad(len, str) {\n return whitespace(len - str.length) + str;\n}\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport devAssert from \"../jsutils/devAssert.mjs\";\nimport isObjectLike from \"../jsutils/isObjectLike.mjs\";\nimport { SYMBOL_TO_STRING_TAG } from \"../polyfills/symbols.mjs\";\nimport { getLocation } from \"../language/location.mjs\";\nimport { printLocation, printSourceLocation } from \"../language/printLocation.mjs\";\n/**\n * A GraphQLError describes an Error found during the parse, validate, or\n * execute phases of performing a GraphQL operation. In addition to a message\n * and stack trace, it also includes information about the locations in a\n * GraphQL document and/or execution result that correspond to the Error.\n */\n\nexport var GraphQLError = /*#__PURE__*/function (_Error) {\n _inherits(GraphQLError, _Error);\n\n var _super = _createSuper(GraphQLError);\n\n /**\n * An array of { line, column } locations within the source GraphQL document\n * which correspond to this error.\n *\n * Errors during validation often contain multiple locations, for example to\n * point out two things with the same name. Errors during execution include a\n * single location, the field which produced the error.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array describing the JSON-path into the execution response which\n * corresponds to this error. Only included for errors during execution.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array of GraphQL AST Nodes corresponding to this error.\n */\n\n /**\n * The source GraphQL document for the first location of this error.\n *\n * Note that if this Error represents more than one node, the source may not\n * represent nodes after the first node.\n */\n\n /**\n * An array of character offsets within the source GraphQL document\n * which correspond to this error.\n */\n\n /**\n * The original error thrown from a field resolver during execution.\n */\n\n /**\n * Extension fields to add to the formatted error.\n */\n function GraphQLError(message, nodes, source, positions, path, originalError, extensions) {\n var _nodeLocations, _nodeLocations2, _nodeLocations3;\n\n var _this;\n\n _classCallCheck(this, GraphQLError);\n\n _this = _super.call(this, message);\n _this.name = 'GraphQLError';\n _this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; // Compute list of blame nodes.\n\n _this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);\n var nodeLocations = [];\n\n for (var _i2 = 0, _ref3 = (_this$nodes = _this.nodes) !== null && _this$nodes !== void 0 ? _this$nodes : []; _i2 < _ref3.length; _i2++) {\n var _this$nodes;\n\n var _ref4 = _ref3[_i2];\n var loc = _ref4.loc;\n\n if (loc != null) {\n nodeLocations.push(loc);\n }\n }\n\n nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions.\n\n _this.source = source !== null && source !== void 0 ? source : (_nodeLocations = nodeLocations) === null || _nodeLocations === void 0 ? void 0 : _nodeLocations[0].source;\n _this.positions = positions !== null && positions !== void 0 ? positions : (_nodeLocations2 = nodeLocations) === null || _nodeLocations2 === void 0 ? void 0 : _nodeLocations2.map(function (loc) {\n return loc.start;\n });\n _this.locations = positions && source ? positions.map(function (pos) {\n return getLocation(source, pos);\n }) : (_nodeLocations3 = nodeLocations) === null || _nodeLocations3 === void 0 ? void 0 : _nodeLocations3.map(function (loc) {\n return getLocation(loc.source, loc.start);\n });\n _this.path = path !== null && path !== void 0 ? path : undefined;\n var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions;\n\n if (extensions == null && isObjectLike(originalExtensions)) {\n _this.extensions = _objectSpread({}, originalExtensions);\n } else {\n _this.extensions = extensions !== null && extensions !== void 0 ? extensions : {};\n } // By being enumerable, JSON.stringify will include bellow properties in the resulting output.\n // This ensures that the simplest possible GraphQL service adheres to the spec.\n\n\n Object.defineProperties(_assertThisInitialized(_this), {\n message: {\n enumerable: true\n },\n locations: {\n enumerable: _this.locations != null\n },\n path: {\n enumerable: _this.path != null\n },\n extensions: {\n enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0\n },\n name: {\n enumerable: false\n },\n nodes: {\n enumerable: false\n },\n source: {\n enumerable: false\n },\n positions: {\n enumerable: false\n },\n originalError: {\n enumerable: false\n }\n }); // Include (non-enumerable) stack trace.\n\n if (originalError !== null && originalError !== void 0 && originalError.stack) {\n Object.defineProperty(_assertThisInitialized(_this), 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true\n });\n return _possibleConstructorReturn(_this);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError);\n } else {\n Object.defineProperty(_assertThisInitialized(_this), 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true\n });\n }\n\n return _this;\n }\n\n _createClass(GraphQLError, [{\n key: \"toString\",\n value: function toString() {\n return printError(this);\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n return formatError(this);\n } // FIXME: workaround to not break chai comparisons, should be remove in v16\n // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet\n\n }, {\n key: SYMBOL_TO_STRING_TAG,\n get: function get() {\n return 'Object';\n }\n }]);\n\n return GraphQLError;\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nfunction undefinedIfEmpty(array) {\n return array === undefined || array.length === 0 ? undefined : array;\n}\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n */\n\n\nexport function printError(error) {\n var output = error.message;\n\n if (error.nodes) {\n for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) {\n var node = _error$nodes2[_i4];\n\n if (node.loc) {\n output += '\\n\\n' + printLocation(node.loc);\n }\n }\n } else if (error.source && error.locations) {\n for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) {\n var location = _error$locations2[_i6];\n output += '\\n\\n' + printSourceLocation(error.source, location);\n }\n }\n\n return output;\n}\n/**\n * Given a GraphQLError, format it according to the rules described by the\n * Response Format, Errors section of the GraphQL Specification.\n */\n\nexport function formatError(error) {\n var _error$message;\n\n error || devAssert(0, 'Received null or undefined error.');\n var message = (_error$message = error.message) !== null && _error$message !== void 0 ? _error$message : 'An unknown error occurred.';\n var locations = error.locations;\n var path = error.path;\n var extensions = error.extensions;\n return extensions && Object.keys(extensions).length > 0 ? {\n message: message,\n locations: locations,\n path: path,\n extensions: extensions\n } : {\n message: message,\n locations: locations,\n path: path\n };\n}\n/**\n * @see https://github.com/graphql/graphql-spec/blob/master/spec/Section%207%20--%20Response.md#errors\n */\n","import { GraphQLError } from \"./GraphQLError.mjs\";\n/**\n * Produces a GraphQLError representing a syntax error, containing useful\n * descriptive information about the syntax error's position in the source.\n */\n\nexport function syntaxError(source, position, description) {\n return new GraphQLError(\"Syntax Error: \".concat(description), undefined, source, [position]);\n}\n","/**\n * The set of allowed kind values for AST nodes.\n */\nexport var Kind = Object.freeze({\n // Name\n NAME: 'Name',\n // Document\n DOCUMENT: 'Document',\n OPERATION_DEFINITION: 'OperationDefinition',\n VARIABLE_DEFINITION: 'VariableDefinition',\n SELECTION_SET: 'SelectionSet',\n FIELD: 'Field',\n ARGUMENT: 'Argument',\n // Fragments\n FRAGMENT_SPREAD: 'FragmentSpread',\n INLINE_FRAGMENT: 'InlineFragment',\n FRAGMENT_DEFINITION: 'FragmentDefinition',\n // Values\n VARIABLE: 'Variable',\n INT: 'IntValue',\n FLOAT: 'FloatValue',\n STRING: 'StringValue',\n BOOLEAN: 'BooleanValue',\n NULL: 'NullValue',\n ENUM: 'EnumValue',\n LIST: 'ListValue',\n OBJECT: 'ObjectValue',\n OBJECT_FIELD: 'ObjectField',\n // Directives\n DIRECTIVE: 'Directive',\n // Types\n NAMED_TYPE: 'NamedType',\n LIST_TYPE: 'ListType',\n NON_NULL_TYPE: 'NonNullType',\n // Type System Definitions\n SCHEMA_DEFINITION: 'SchemaDefinition',\n OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition',\n // Type Definitions\n SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition',\n OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition',\n FIELD_DEFINITION: 'FieldDefinition',\n INPUT_VALUE_DEFINITION: 'InputValueDefinition',\n INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition',\n UNION_TYPE_DEFINITION: 'UnionTypeDefinition',\n ENUM_TYPE_DEFINITION: 'EnumTypeDefinition',\n ENUM_VALUE_DEFINITION: 'EnumValueDefinition',\n INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition',\n // Directive Definitions\n DIRECTIVE_DEFINITION: 'DirectiveDefinition',\n // Type System Extensions\n SCHEMA_EXTENSION: 'SchemaExtension',\n // Type Extensions\n SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension',\n OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension',\n INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension',\n UNION_TYPE_EXTENSION: 'UnionTypeExtension',\n ENUM_TYPE_EXTENSION: 'EnumTypeExtension',\n INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension'\n});\n/**\n * The enum type representing the possible kind values of AST nodes.\n */\n","export default function invariant(condition, message) {\n var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')\n\n if (!booleanCondition) {\n throw new Error(message != null ? message : 'Unexpected invariant triggered.');\n }\n}\n","// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\nvar nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined;\nexport default nodejsCustomInspectSymbol;\n","import invariant from \"./invariant.mjs\";\nimport nodejsCustomInspectSymbol from \"./nodejsCustomInspectSymbol.mjs\";\n/**\n * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON`\n */\n\nexport default function defineInspect(classObject) {\n var fn = classObject.prototype.toJSON;\n typeof fn === 'function' || invariant(0);\n classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317')\n\n if (nodejsCustomInspectSymbol) {\n classObject.prototype[nodejsCustomInspectSymbol] = fn;\n }\n}\n","import defineInspect from \"../jsutils/defineInspect.mjs\";\n\n/**\n * Contains a range of UTF-8 character offsets and token references that\n * identify the region of the source from which the AST derived.\n */\nexport var Location = /*#__PURE__*/function () {\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The Token at which this Node begins.\n */\n\n /**\n * The Token at which this Node ends.\n */\n\n /**\n * The Source document the AST represents.\n */\n function Location(startToken, endToken, source) {\n this.start = startToken.start;\n this.end = endToken.end;\n this.startToken = startToken;\n this.endToken = endToken;\n this.source = source;\n }\n\n var _proto = Location.prototype;\n\n _proto.toJSON = function toJSON() {\n return {\n start: this.start,\n end: this.end\n };\n };\n\n return Location;\n}(); // Print a simplified form when appearing in `inspect` and `util.inspect`.\n\ndefineInspect(Location);\n/**\n * Represents a range of characters represented by a lexical token\n * within a Source.\n */\n\nexport var Token = /*#__PURE__*/function () {\n /**\n * The kind of Token.\n */\n\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The 1-indexed line number on which this Token appears.\n */\n\n /**\n * The 1-indexed column number at which this Token begins.\n */\n\n /**\n * For non-punctuation tokens, represents the interpreted value of the token.\n */\n\n /**\n * Tokens exist as nodes in a double-linked-list amongst all tokens\n * including ignored tokens. is always the first node and \n * the last.\n */\n function Token(kind, start, end, line, column, prev, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column;\n this.value = value;\n this.prev = prev;\n this.next = null;\n }\n\n var _proto2 = Token.prototype;\n\n _proto2.toJSON = function toJSON() {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column\n };\n };\n\n return Token;\n}(); // Print a simplified form when appearing in `inspect` and `util.inspect`.\n\ndefineInspect(Token);\n/**\n * @internal\n */\n\nexport function isNode(maybeNode) {\n return maybeNode != null && typeof maybeNode.kind === 'string';\n}\n/**\n * The list of all possible AST node types.\n */\n","/**\n * An exported enum describing the different kinds of tokens that the\n * lexer emits.\n */\nexport var TokenKind = Object.freeze({\n SOF: '',\n EOF: '',\n BANG: '!',\n DOLLAR: '$',\n AMP: '&',\n PAREN_L: '(',\n PAREN_R: ')',\n SPREAD: '...',\n COLON: ':',\n EQUALS: '=',\n AT: '@',\n BRACKET_L: '[',\n BRACKET_R: ']',\n BRACE_L: '{',\n PIPE: '|',\n BRACE_R: '}',\n NAME: 'Name',\n INT: 'Int',\n FLOAT: 'Float',\n STRING: 'String',\n BLOCK_STRING: 'BlockString',\n COMMENT: 'Comment'\n});\n/**\n * The enum type representing the token kinds values.\n */\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/* eslint-disable flowtype/no-weak-types */\nimport nodejsCustomInspectSymbol from \"./nodejsCustomInspectSymbol.mjs\";\nvar MAX_ARRAY_LENGTH = 10;\nvar MAX_RECURSIVE_DEPTH = 2;\n/**\n * Used to print values in error messages.\n */\n\nexport default function inspect(value) {\n return formatValue(value, []);\n}\n\nfunction formatValue(value, seenValues) {\n switch (_typeof(value)) {\n case 'string':\n return JSON.stringify(value);\n\n case 'function':\n return value.name ? \"[function \".concat(value.name, \"]\") : '[function]';\n\n case 'object':\n if (value === null) {\n return 'null';\n }\n\n return formatObjectValue(value, seenValues);\n\n default:\n return String(value);\n }\n}\n\nfunction formatObjectValue(value, previouslySeenValues) {\n if (previouslySeenValues.indexOf(value) !== -1) {\n return '[Circular]';\n }\n\n var seenValues = [].concat(previouslySeenValues, [value]);\n var customInspectFn = getCustomFn(value);\n\n if (customInspectFn !== undefined) {\n var customValue = customInspectFn.call(value); // check for infinite recursion\n\n if (customValue !== value) {\n return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n}\n\nfunction formatObject(object, seenValues) {\n var keys = Object.keys(object);\n\n if (keys.length === 0) {\n return '{}';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[' + getObjectTag(object) + ']';\n }\n\n var properties = keys.map(function (key) {\n var value = formatValue(object[key], seenValues);\n return key + ': ' + value;\n });\n return '{ ' + properties.join(', ') + ' }';\n}\n\nfunction formatArray(array, seenValues) {\n if (array.length === 0) {\n return '[]';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[Array]';\n }\n\n var len = Math.min(MAX_ARRAY_LENGTH, array.length);\n var remaining = array.length - len;\n var items = [];\n\n for (var i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push('... 1 more item');\n } else if (remaining > 1) {\n items.push(\"... \".concat(remaining, \" more items\"));\n }\n\n return '[' + items.join(', ') + ']';\n}\n\nfunction getCustomFn(object) {\n var customInspectFn = object[String(nodejsCustomInspectSymbol)];\n\n if (typeof customInspectFn === 'function') {\n return customInspectFn;\n }\n\n if (typeof object.inspect === 'function') {\n return object.inspect;\n }\n}\n\nfunction getObjectTag(object) {\n var tag = Object.prototype.toString.call(object).replace(/^\\[object /, '').replace(/]$/, '');\n\n if (tag === 'Object' && typeof object.constructor === 'function') {\n var name = object.constructor.name;\n\n if (typeof name === 'string' && name !== '') {\n return name;\n }\n }\n\n return tag;\n}\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport inspect from \"./inspect.mjs\";\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n */\n\n// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n// See: https://webpack.js.org/guides/production/\nexport default process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n// eslint-disable-next-line no-shadow\nfunction instanceOf(value, constructor) {\n return value instanceof constructor;\n} : // eslint-disable-next-line no-shadow\nfunction instanceOf(value, constructor) {\n if (value instanceof constructor) {\n return true;\n }\n\n if (_typeof(value) === 'object' && value !== null) {\n var _value$constructor;\n\n var className = constructor.prototype[Symbol.toStringTag];\n var valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name;\n\n if (className === valueClassName) {\n var stringifiedValue = inspect(value);\n throw new Error(\"Cannot use \".concat(className, \" \\\"\").concat(stringifiedValue, \"\\\" from another module or realm.\\n\\nEnsure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory. If different versions of \\\"graphql\\\" are the dependencies of other\\nrelied on modules, use \\\"resolutions\\\" to ensure only one version is installed.\\n\\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\\n\\nDuplicate \\\"graphql\\\" modules cannot be used at the same time since different\\nversions may have different capabilities and behavior. The data from one\\nversion used in the function from another could produce confusing and\\nspurious results.\"));\n }\n }\n\n return false;\n};\n","function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { SYMBOL_TO_STRING_TAG } from \"../polyfills/symbols.mjs\";\nimport inspect from \"../jsutils/inspect.mjs\";\nimport devAssert from \"../jsutils/devAssert.mjs\";\nimport instanceOf from \"../jsutils/instanceOf.mjs\";\n\n/**\n * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are\n * optional, but they are useful for clients who store GraphQL documents in source files.\n * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might\n * be useful for `name` to be `\"Foo.graphql\"` and location to be `{ line: 40, column: 1 }`.\n * The `line` and `column` properties in `locationOffset` are 1-indexed.\n */\nexport var Source = /*#__PURE__*/function () {\n function Source(body) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GraphQL request';\n var locationOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {\n line: 1,\n column: 1\n };\n typeof body === 'string' || devAssert(0, \"Body must be a string. Received: \".concat(inspect(body), \".\"));\n this.body = body;\n this.name = name;\n this.locationOffset = locationOffset;\n this.locationOffset.line > 0 || devAssert(0, 'line in locationOffset is 1-indexed and must be positive.');\n this.locationOffset.column > 0 || devAssert(0, 'column in locationOffset is 1-indexed and must be positive.');\n } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet\n\n\n _createClass(Source, [{\n key: SYMBOL_TO_STRING_TAG,\n get: function get() {\n return 'Source';\n }\n }]);\n\n return Source;\n}();\n/**\n * Test if the given value is a Source object.\n *\n * @internal\n */\n\n// eslint-disable-next-line no-redeclare\nexport function isSource(source) {\n return instanceOf(source, Source);\n}\n","/**\n * The set of allowed directive location values.\n */\nexport var DirectiveLocation = Object.freeze({\n // Request Definitions\n QUERY: 'QUERY',\n MUTATION: 'MUTATION',\n SUBSCRIPTION: 'SUBSCRIPTION',\n FIELD: 'FIELD',\n FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION',\n FRAGMENT_SPREAD: 'FRAGMENT_SPREAD',\n INLINE_FRAGMENT: 'INLINE_FRAGMENT',\n VARIABLE_DEFINITION: 'VARIABLE_DEFINITION',\n // Type System Definitions\n SCHEMA: 'SCHEMA',\n SCALAR: 'SCALAR',\n OBJECT: 'OBJECT',\n FIELD_DEFINITION: 'FIELD_DEFINITION',\n ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION',\n INTERFACE: 'INTERFACE',\n UNION: 'UNION',\n ENUM: 'ENUM',\n ENUM_VALUE: 'ENUM_VALUE',\n INPUT_OBJECT: 'INPUT_OBJECT',\n INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION'\n});\n/**\n * The enum type representing the directive location values.\n */\n","/**\n * Produces the value of a block string from its parsed raw value, similar to\n * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.\n *\n * This implements the GraphQL spec's BlockStringValue() static algorithm.\n *\n * @internal\n */\nexport function dedentBlockStringValue(rawString) {\n // Expand a block string's raw value into independent lines.\n var lines = rawString.split(/\\r\\n|[\\n\\r]/g); // Remove common indentation from all lines but first.\n\n var commonIndent = getBlockStringIndentation(rawString);\n\n if (commonIndent !== 0) {\n for (var i = 1; i < lines.length; i++) {\n lines[i] = lines[i].slice(commonIndent);\n }\n } // Remove leading and trailing blank lines.\n\n\n var startLine = 0;\n\n while (startLine < lines.length && isBlank(lines[startLine])) {\n ++startLine;\n }\n\n var endLine = lines.length;\n\n while (endLine > startLine && isBlank(lines[endLine - 1])) {\n --endLine;\n } // Return a string of the lines joined with U+000A.\n\n\n return lines.slice(startLine, endLine).join('\\n');\n}\n\nfunction isBlank(str) {\n for (var i = 0; i < str.length; ++i) {\n if (str[i] !== ' ' && str[i] !== '\\t') {\n return false;\n }\n }\n\n return true;\n}\n/**\n * @internal\n */\n\n\nexport function getBlockStringIndentation(value) {\n var _commonIndent;\n\n var isFirstLine = true;\n var isEmptyLine = true;\n var indent = 0;\n var commonIndent = null;\n\n for (var i = 0; i < value.length; ++i) {\n switch (value.charCodeAt(i)) {\n case 13:\n // \\r\n if (value.charCodeAt(i + 1) === 10) {\n ++i; // skip \\r\\n as one symbol\n }\n\n // falls through\n\n case 10:\n // \\n\n isFirstLine = false;\n isEmptyLine = true;\n indent = 0;\n break;\n\n case 9: // \\t\n\n case 32:\n // \n ++indent;\n break;\n\n default:\n if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) {\n commonIndent = indent;\n }\n\n isEmptyLine = false;\n }\n }\n\n return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0;\n}\n/**\n * Print a block string in the indented block form by adding a leading and\n * trailing blank line. However, if a block string starts with whitespace and is\n * a single-line, adding a leading blank line would strip that whitespace.\n *\n * @internal\n */\n\nexport function printBlockString(value) {\n var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var isSingleLine = value.indexOf('\\n') === -1;\n var hasLeadingSpace = value[0] === ' ' || value[0] === '\\t';\n var hasTrailingQuote = value[value.length - 1] === '\"';\n var hasTrailingSlash = value[value.length - 1] === '\\\\';\n var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines;\n var result = ''; // Format a multi-line block quote to account for leading space.\n\n if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) {\n result += '\\n' + indentation;\n }\n\n result += indentation ? value.replace(/\\n/g, '\\n' + indentation) : value;\n\n if (printAsMultipleLines) {\n result += '\\n';\n }\n\n return '\"\"\"' + result.replace(/\"\"\"/g, '\\\\\"\"\"') + '\"\"\"';\n}\n","import { syntaxError } from \"../error/syntaxError.mjs\";\nimport { Token } from \"./ast.mjs\";\nimport { TokenKind } from \"./tokenKind.mjs\";\nimport { dedentBlockStringValue } from \"./blockString.mjs\";\n/**\n * Given a Source object, creates a Lexer for that source.\n * A Lexer is a stateful stream generator in that every time\n * it is advanced, it returns the next token in the Source. Assuming the\n * source lexes, the final Token emitted by the lexer will be of kind\n * EOF, after which the lexer will repeatedly return the same EOF token\n * whenever called.\n */\n\nexport var Lexer = /*#__PURE__*/function () {\n /**\n * The previously focused non-ignored token.\n */\n\n /**\n * The currently focused non-ignored token.\n */\n\n /**\n * The (1-indexed) line containing the current token.\n */\n\n /**\n * The character offset at which the current line begins.\n */\n function Lexer(source) {\n var startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0, null);\n this.source = source;\n this.lastToken = startOfFileToken;\n this.token = startOfFileToken;\n this.line = 1;\n this.lineStart = 0;\n }\n /**\n * Advances the token stream to the next non-ignored token.\n */\n\n\n var _proto = Lexer.prototype;\n\n _proto.advance = function advance() {\n this.lastToken = this.token;\n var token = this.token = this.lookahead();\n return token;\n }\n /**\n * Looks ahead and returns the next non-ignored token, but does not change\n * the state of Lexer.\n */\n ;\n\n _proto.lookahead = function lookahead() {\n var token = this.token;\n\n if (token.kind !== TokenKind.EOF) {\n do {\n var _token$next;\n\n // Note: next is only mutable during parsing, so we cast to allow this.\n token = (_token$next = token.next) !== null && _token$next !== void 0 ? _token$next : token.next = readToken(this, token);\n } while (token.kind === TokenKind.COMMENT);\n }\n\n return token;\n };\n\n return Lexer;\n}();\n/**\n * @internal\n */\n\nexport function isPunctuatorTokenKind(kind) {\n return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;\n}\n\nfunction printCharCode(code) {\n return (// NaN/undefined represents access beyond the end of the file.\n isNaN(code) ? TokenKind.EOF : // Trust JSON for ASCII.\n code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form.\n \"\\\"\\\\u\".concat(('00' + code.toString(16).toUpperCase()).slice(-4), \"\\\"\")\n );\n}\n/**\n * Gets the next token from the source starting at the given position.\n *\n * This skips over whitespace until it finds the next lexable token, then lexes\n * punctuators immediately or calls the appropriate helper function for more\n * complicated tokens.\n */\n\n\nfunction readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = prev.end;\n\n while (pos < bodyLength) {\n var code = body.charCodeAt(pos);\n var _line = lexer.line;\n\n var _col = 1 + pos - lexer.lineStart; // SourceCharacter\n\n\n switch (code) {\n case 0xfeff: // \n\n case 9: // \\t\n\n case 32: // \n\n case 44:\n // ,\n ++pos;\n continue;\n\n case 10:\n // \\n\n ++pos;\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 13:\n // \\r\n if (body.charCodeAt(pos + 1) === 10) {\n pos += 2;\n } else {\n ++pos;\n }\n\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 33:\n // !\n return new Token(TokenKind.BANG, pos, pos + 1, _line, _col, prev);\n\n case 35:\n // #\n return readComment(source, pos, _line, _col, prev);\n\n case 36:\n // $\n return new Token(TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev);\n\n case 38:\n // &\n return new Token(TokenKind.AMP, pos, pos + 1, _line, _col, prev);\n\n case 40:\n // (\n return new Token(TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev);\n\n case 41:\n // )\n return new Token(TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev);\n\n case 46:\n // .\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Token(TokenKind.SPREAD, pos, pos + 3, _line, _col, prev);\n }\n\n break;\n\n case 58:\n // :\n return new Token(TokenKind.COLON, pos, pos + 1, _line, _col, prev);\n\n case 61:\n // =\n return new Token(TokenKind.EQUALS, pos, pos + 1, _line, _col, prev);\n\n case 64:\n // @\n return new Token(TokenKind.AT, pos, pos + 1, _line, _col, prev);\n\n case 91:\n // [\n return new Token(TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev);\n\n case 93:\n // ]\n return new Token(TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev);\n\n case 123:\n // {\n return new Token(TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev);\n\n case 124:\n // |\n return new Token(TokenKind.PIPE, pos, pos + 1, _line, _col, prev);\n\n case 125:\n // }\n return new Token(TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev);\n\n case 34:\n // \"\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, _line, _col, prev, lexer);\n }\n\n return readString(source, pos, _line, _col, prev);\n\n case 45: // -\n\n case 48: // 0\n\n case 49: // 1\n\n case 50: // 2\n\n case 51: // 3\n\n case 52: // 4\n\n case 53: // 5\n\n case 54: // 6\n\n case 55: // 7\n\n case 56: // 8\n\n case 57:\n // 9\n return readNumber(source, pos, code, _line, _col, prev);\n\n case 65: // A\n\n case 66: // B\n\n case 67: // C\n\n case 68: // D\n\n case 69: // E\n\n case 70: // F\n\n case 71: // G\n\n case 72: // H\n\n case 73: // I\n\n case 74: // J\n\n case 75: // K\n\n case 76: // L\n\n case 77: // M\n\n case 78: // N\n\n case 79: // O\n\n case 80: // P\n\n case 81: // Q\n\n case 82: // R\n\n case 83: // S\n\n case 84: // T\n\n case 85: // U\n\n case 86: // V\n\n case 87: // W\n\n case 88: // X\n\n case 89: // Y\n\n case 90: // Z\n\n case 95: // _\n\n case 97: // a\n\n case 98: // b\n\n case 99: // c\n\n case 100: // d\n\n case 101: // e\n\n case 102: // f\n\n case 103: // g\n\n case 104: // h\n\n case 105: // i\n\n case 106: // j\n\n case 107: // k\n\n case 108: // l\n\n case 109: // m\n\n case 110: // n\n\n case 111: // o\n\n case 112: // p\n\n case 113: // q\n\n case 114: // r\n\n case 115: // s\n\n case 116: // t\n\n case 117: // u\n\n case 118: // v\n\n case 119: // w\n\n case 120: // x\n\n case 121: // y\n\n case 122:\n // z\n return readName(source, pos, _line, _col, prev);\n }\n\n throw syntaxError(source, pos, unexpectedCharacterMessage(code));\n }\n\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n return new Token(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n}\n/**\n * Report a message that an unexpected character was encountered.\n */\n\n\nfunction unexpectedCharacterMessage(code) {\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n return \"Cannot contain the invalid character \".concat(printCharCode(code), \".\");\n }\n\n if (code === 39) {\n // '\n return 'Unexpected single quote character (\\'), did you mean to use a double quote (\")?';\n }\n\n return \"Cannot parse the unexpected character \".concat(printCharCode(code), \".\");\n}\n/**\n * Reads a comment token from the source file.\n *\n * #[\\u0009\\u0020-\\uFFFF]*\n */\n\n\nfunction readComment(source, start, line, col, prev) {\n var body = source.body;\n var code;\n var position = start;\n\n do {\n code = body.charCodeAt(++position);\n } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator\n code > 0x001f || code === 0x0009));\n\n return new Token(TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position));\n}\n/**\n * Reads a number token from the source file, either a float\n * or an int depending on whether a decimal point appears.\n *\n * Int: -?(0|[1-9][0-9]*)\n * Float: -?(0|[1-9][0-9]*)(\\.[0-9]+)?((E|e)(+|-)?[0-9]+)?\n */\n\n\nfunction readNumber(source, start, firstCode, line, col, prev) {\n var body = source.body;\n var code = firstCode;\n var position = start;\n var isFloat = false;\n\n if (code === 45) {\n // -\n code = body.charCodeAt(++position);\n }\n\n if (code === 48) {\n // 0\n code = body.charCodeAt(++position);\n\n if (code >= 48 && code <= 57) {\n throw syntaxError(source, position, \"Invalid number, unexpected digit after 0: \".concat(printCharCode(code), \".\"));\n }\n } else {\n position = readDigits(source, position, code);\n code = body.charCodeAt(position);\n }\n\n if (code === 46) {\n // .\n isFloat = true;\n code = body.charCodeAt(++position);\n position = readDigits(source, position, code);\n code = body.charCodeAt(position);\n }\n\n if (code === 69 || code === 101) {\n // E e\n isFloat = true;\n code = body.charCodeAt(++position);\n\n if (code === 43 || code === 45) {\n // + -\n code = body.charCodeAt(++position);\n }\n\n position = readDigits(source, position, code);\n code = body.charCodeAt(position);\n } // Numbers cannot be followed by . or NameStart\n\n\n if (code === 46 || isNameStart(code)) {\n throw syntaxError(source, position, \"Invalid number, expected digit but got: \".concat(printCharCode(code), \".\"));\n }\n\n return new Token(isFloat ? TokenKind.FLOAT : TokenKind.INT, start, position, line, col, prev, body.slice(start, position));\n}\n/**\n * Returns the new position in the source after reading digits.\n */\n\n\nfunction readDigits(source, start, firstCode) {\n var body = source.body;\n var position = start;\n var code = firstCode;\n\n if (code >= 48 && code <= 57) {\n // 0 - 9\n do {\n code = body.charCodeAt(++position);\n } while (code >= 48 && code <= 57); // 0 - 9\n\n\n return position;\n }\n\n throw syntaxError(source, position, \"Invalid number, expected digit but got: \".concat(printCharCode(code), \".\"));\n}\n/**\n * Reads a string token from the source file.\n *\n * \"([^\"\\\\\\u000A\\u000D]|(\\\\(u[0-9a-fA-F]{4}|[\"\\\\/bfnrt])))*\"\n */\n\n\nfunction readString(source, start, line, col, prev) {\n var body = source.body;\n var position = start + 1;\n var chunkStart = position;\n var code = 0;\n var value = '';\n\n while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator\n code !== 0x000a && code !== 0x000d) {\n // Closing Quote (\")\n if (code === 34) {\n value += body.slice(chunkStart, position);\n return new Token(TokenKind.STRING, start, position + 1, line, col, prev, value);\n } // SourceCharacter\n\n\n if (code < 0x0020 && code !== 0x0009) {\n throw syntaxError(source, position, \"Invalid character within String: \".concat(printCharCode(code), \".\"));\n }\n\n ++position;\n\n if (code === 92) {\n // \\\n value += body.slice(chunkStart, position - 1);\n code = body.charCodeAt(position);\n\n switch (code) {\n case 34:\n value += '\"';\n break;\n\n case 47:\n value += '/';\n break;\n\n case 92:\n value += '\\\\';\n break;\n\n case 98:\n value += '\\b';\n break;\n\n case 102:\n value += '\\f';\n break;\n\n case 110:\n value += '\\n';\n break;\n\n case 114:\n value += '\\r';\n break;\n\n case 116:\n value += '\\t';\n break;\n\n case 117:\n {\n // uXXXX\n var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4));\n\n if (charCode < 0) {\n var invalidSequence = body.slice(position + 1, position + 5);\n throw syntaxError(source, position, \"Invalid character escape sequence: \\\\u\".concat(invalidSequence, \".\"));\n }\n\n value += String.fromCharCode(charCode);\n position += 4;\n break;\n }\n\n default:\n throw syntaxError(source, position, \"Invalid character escape sequence: \\\\\".concat(String.fromCharCode(code), \".\"));\n }\n\n ++position;\n chunkStart = position;\n }\n }\n\n throw syntaxError(source, position, 'Unterminated string.');\n}\n/**\n * Reads a block string token from the source file.\n *\n * \"\"\"(\"?\"?(\\\\\"\"\"|\\\\(?!=\"\"\")|[^\"\\\\]))*\"\"\"\n */\n\n\nfunction readBlockString(source, start, line, col, prev, lexer) {\n var body = source.body;\n var position = start + 3;\n var chunkStart = position;\n var code = 0;\n var rawValue = '';\n\n while (position < body.length && !isNaN(code = body.charCodeAt(position))) {\n // Closing Triple-Quote (\"\"\")\n if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {\n rawValue += body.slice(chunkStart, position);\n return new Token(TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, dedentBlockStringValue(rawValue));\n } // SourceCharacter\n\n\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n throw syntaxError(source, position, \"Invalid character within String: \".concat(printCharCode(code), \".\"));\n }\n\n if (code === 10) {\n // new line\n ++position;\n ++lexer.line;\n lexer.lineStart = position;\n } else if (code === 13) {\n // carriage return\n if (body.charCodeAt(position + 1) === 10) {\n position += 2;\n } else {\n ++position;\n }\n\n ++lexer.line;\n lexer.lineStart = position;\n } else if ( // Escape Triple-Quote (\\\"\"\")\n code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) {\n rawValue += body.slice(chunkStart, position) + '\"\"\"';\n position += 4;\n chunkStart = position;\n } else {\n ++position;\n }\n }\n\n throw syntaxError(source, position, 'Unterminated string.');\n}\n/**\n * Converts four hexadecimal chars to the integer that the\n * string represents. For example, uniCharCode('0','0','0','f')\n * will return 15, and uniCharCode('0','0','f','f') returns 255.\n *\n * Returns a negative number on error, if a char was invalid.\n *\n * This is implemented by noting that char2hex() returns -1 on error,\n * which means the result of ORing the char2hex() will also be negative.\n */\n\n\nfunction uniCharCode(a, b, c, d) {\n return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d);\n}\n/**\n * Converts a hex character to its integer value.\n * '0' becomes 0, '9' becomes 9\n * 'A' becomes 10, 'F' becomes 15\n * 'a' becomes 10, 'f' becomes 15\n *\n * Returns -1 on error.\n */\n\n\nfunction char2hex(a) {\n return a >= 48 && a <= 57 ? a - 48 // 0-9\n : a >= 65 && a <= 70 ? a - 55 // A-F\n : a >= 97 && a <= 102 ? a - 87 // a-f\n : -1;\n}\n/**\n * Reads an alphanumeric + underscore name from the source.\n *\n * [_A-Za-z][_0-9A-Za-z]*\n */\n\n\nfunction readName(source, start, line, col, prev) {\n var body = source.body;\n var bodyLength = body.length;\n var position = start + 1;\n var code = 0;\n\n while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _\n code >= 48 && code <= 57 || // 0-9\n code >= 65 && code <= 90 || // A-Z\n code >= 97 && code <= 122) // a-z\n ) {\n ++position;\n }\n\n return new Token(TokenKind.NAME, start, position, line, col, prev, body.slice(start, position));\n} // _ A-Z a-z\n\n\nfunction isNameStart(code) {\n return code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122;\n}\n","import { syntaxError } from \"../error/syntaxError.mjs\";\nimport { Kind } from \"./kinds.mjs\";\nimport { Location } from \"./ast.mjs\";\nimport { TokenKind } from \"./tokenKind.mjs\";\nimport { Source, isSource } from \"./source.mjs\";\nimport { DirectiveLocation } from \"./directiveLocation.mjs\";\nimport { Lexer, isPunctuatorTokenKind } from \"./lexer.mjs\";\n/**\n * Configuration options to control parser behavior\n */\n\n/**\n * Given a GraphQL source, parses it into a Document.\n * Throws GraphQLError if a syntax error is encountered.\n */\nexport function parse(source, options) {\n var parser = new Parser(source, options);\n return parser.parseDocument();\n}\n/**\n * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for\n * that value.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Values directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: valueFromAST().\n */\n\nexport function parseValue(source, options) {\n var parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n var value = parser.parseValueLiteral(false);\n parser.expectToken(TokenKind.EOF);\n return value;\n}\n/**\n * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for\n * that type.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Types directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: typeFromAST().\n */\n\nexport function parseType(source, options) {\n var parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n var type = parser.parseTypeReference();\n parser.expectToken(TokenKind.EOF);\n return type;\n}\n/**\n * This class is exported only to assist people in implementing their own parsers\n * without duplicating too much code and should be used only as last resort for cases\n * such as experimental syntax or if certain features could not be contributed upstream.\n *\n * It is still part of the internal API and is versioned, so any changes to it are never\n * considered breaking changes. If you still need to support multiple versions of the\n * library, please use the `versionInfo` variable for version detection.\n *\n * @internal\n */\n\nexport var Parser = /*#__PURE__*/function () {\n function Parser(source, options) {\n var sourceObj = isSource(source) ? source : new Source(source);\n this._lexer = new Lexer(sourceObj);\n this._options = options;\n }\n /**\n * Converts a name lex token into a name parse node.\n */\n\n\n var _proto = Parser.prototype;\n\n _proto.parseName = function parseName() {\n var token = this.expectToken(TokenKind.NAME);\n return {\n kind: Kind.NAME,\n value: token.value,\n loc: this.loc(token)\n };\n } // Implements the parsing rules in the Document section.\n\n /**\n * Document : Definition+\n */\n ;\n\n _proto.parseDocument = function parseDocument() {\n var start = this._lexer.token;\n return {\n kind: Kind.DOCUMENT,\n definitions: this.many(TokenKind.SOF, this.parseDefinition, TokenKind.EOF),\n loc: this.loc(start)\n };\n }\n /**\n * Definition :\n * - ExecutableDefinition\n * - TypeSystemDefinition\n * - TypeSystemExtension\n *\n * ExecutableDefinition :\n * - OperationDefinition\n * - FragmentDefinition\n */\n ;\n\n _proto.parseDefinition = function parseDefinition() {\n if (this.peek(TokenKind.NAME)) {\n switch (this._lexer.token.value) {\n case 'query':\n case 'mutation':\n case 'subscription':\n return this.parseOperationDefinition();\n\n case 'fragment':\n return this.parseFragmentDefinition();\n\n case 'schema':\n case 'scalar':\n case 'type':\n case 'interface':\n case 'union':\n case 'enum':\n case 'input':\n case 'directive':\n return this.parseTypeSystemDefinition();\n\n case 'extend':\n return this.parseTypeSystemExtension();\n }\n } else if (this.peek(TokenKind.BRACE_L)) {\n return this.parseOperationDefinition();\n } else if (this.peekDescription()) {\n return this.parseTypeSystemDefinition();\n }\n\n throw this.unexpected();\n } // Implements the parsing rules in the Operations section.\n\n /**\n * OperationDefinition :\n * - SelectionSet\n * - OperationType Name? VariableDefinitions? Directives? SelectionSet\n */\n ;\n\n _proto.parseOperationDefinition = function parseOperationDefinition() {\n var start = this._lexer.token;\n\n if (this.peek(TokenKind.BRACE_L)) {\n return {\n kind: Kind.OPERATION_DEFINITION,\n operation: 'query',\n name: undefined,\n variableDefinitions: [],\n directives: [],\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n\n var operation = this.parseOperationType();\n var name;\n\n if (this.peek(TokenKind.NAME)) {\n name = this.parseName();\n }\n\n return {\n kind: Kind.OPERATION_DEFINITION,\n operation: operation,\n name: name,\n variableDefinitions: this.parseVariableDefinitions(),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * OperationType : one of query mutation subscription\n */\n ;\n\n _proto.parseOperationType = function parseOperationType() {\n var operationToken = this.expectToken(TokenKind.NAME);\n\n switch (operationToken.value) {\n case 'query':\n return 'query';\n\n case 'mutation':\n return 'mutation';\n\n case 'subscription':\n return 'subscription';\n }\n\n throw this.unexpected(operationToken);\n }\n /**\n * VariableDefinitions : ( VariableDefinition+ )\n */\n ;\n\n _proto.parseVariableDefinitions = function parseVariableDefinitions() {\n return this.optionalMany(TokenKind.PAREN_L, this.parseVariableDefinition, TokenKind.PAREN_R);\n }\n /**\n * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?\n */\n ;\n\n _proto.parseVariableDefinition = function parseVariableDefinition() {\n var start = this._lexer.token;\n return {\n kind: Kind.VARIABLE_DEFINITION,\n variable: this.parseVariable(),\n type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),\n defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseValueLiteral(true) : undefined,\n directives: this.parseDirectives(true),\n loc: this.loc(start)\n };\n }\n /**\n * Variable : $ Name\n */\n ;\n\n _proto.parseVariable = function parseVariable() {\n var start = this._lexer.token;\n this.expectToken(TokenKind.DOLLAR);\n return {\n kind: Kind.VARIABLE,\n name: this.parseName(),\n loc: this.loc(start)\n };\n }\n /**\n * SelectionSet : { Selection+ }\n */\n ;\n\n _proto.parseSelectionSet = function parseSelectionSet() {\n var start = this._lexer.token;\n return {\n kind: Kind.SELECTION_SET,\n selections: this.many(TokenKind.BRACE_L, this.parseSelection, TokenKind.BRACE_R),\n loc: this.loc(start)\n };\n }\n /**\n * Selection :\n * - Field\n * - FragmentSpread\n * - InlineFragment\n */\n ;\n\n _proto.parseSelection = function parseSelection() {\n return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField();\n }\n /**\n * Field : Alias? Name Arguments? Directives? SelectionSet?\n *\n * Alias : Name :\n */\n ;\n\n _proto.parseField = function parseField() {\n var start = this._lexer.token;\n var nameOrAlias = this.parseName();\n var alias;\n var name;\n\n if (this.expectOptionalToken(TokenKind.COLON)) {\n alias = nameOrAlias;\n name = this.parseName();\n } else {\n name = nameOrAlias;\n }\n\n return {\n kind: Kind.FIELD,\n alias: alias,\n name: name,\n arguments: this.parseArguments(false),\n directives: this.parseDirectives(false),\n selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined,\n loc: this.loc(start)\n };\n }\n /**\n * Arguments[Const] : ( Argument[?Const]+ )\n */\n ;\n\n _proto.parseArguments = function parseArguments(isConst) {\n var item = isConst ? this.parseConstArgument : this.parseArgument;\n return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);\n }\n /**\n * Argument[Const] : Name : Value[?Const]\n */\n ;\n\n _proto.parseArgument = function parseArgument() {\n var start = this._lexer.token;\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return {\n kind: Kind.ARGUMENT,\n name: name,\n value: this.parseValueLiteral(false),\n loc: this.loc(start)\n };\n };\n\n _proto.parseConstArgument = function parseConstArgument() {\n var start = this._lexer.token;\n return {\n kind: Kind.ARGUMENT,\n name: this.parseName(),\n value: (this.expectToken(TokenKind.COLON), this.parseValueLiteral(true)),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Fragments section.\n\n /**\n * Corresponds to both FragmentSpread and InlineFragment in the spec.\n *\n * FragmentSpread : ... FragmentName Directives?\n *\n * InlineFragment : ... TypeCondition? Directives? SelectionSet\n */\n ;\n\n _proto.parseFragment = function parseFragment() {\n var start = this._lexer.token;\n this.expectToken(TokenKind.SPREAD);\n var hasTypeCondition = this.expectOptionalKeyword('on');\n\n if (!hasTypeCondition && this.peek(TokenKind.NAME)) {\n return {\n kind: Kind.FRAGMENT_SPREAD,\n name: this.parseFragmentName(),\n directives: this.parseDirectives(false),\n loc: this.loc(start)\n };\n }\n\n return {\n kind: Kind.INLINE_FRAGMENT,\n typeCondition: hasTypeCondition ? this.parseNamedType() : undefined,\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * FragmentDefinition :\n * - fragment FragmentName on TypeCondition Directives? SelectionSet\n *\n * TypeCondition : NamedType\n */\n ;\n\n _proto.parseFragmentDefinition = function parseFragmentDefinition() {\n var _this$_options;\n\n var start = this._lexer.token;\n this.expectKeyword('fragment'); // Experimental support for defining variables within fragments changes\n // the grammar of FragmentDefinition:\n // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet\n\n if (((_this$_options = this._options) === null || _this$_options === void 0 ? void 0 : _this$_options.experimentalFragmentVariables) === true) {\n return {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n variableDefinitions: this.parseVariableDefinitions(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n\n return {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * FragmentName : Name but not `on`\n */\n ;\n\n _proto.parseFragmentName = function parseFragmentName() {\n if (this._lexer.token.value === 'on') {\n throw this.unexpected();\n }\n\n return this.parseName();\n } // Implements the parsing rules in the Values section.\n\n /**\n * Value[Const] :\n * - [~Const] Variable\n * - IntValue\n * - FloatValue\n * - StringValue\n * - BooleanValue\n * - NullValue\n * - EnumValue\n * - ListValue[?Const]\n * - ObjectValue[?Const]\n *\n * BooleanValue : one of `true` `false`\n *\n * NullValue : `null`\n *\n * EnumValue : Name but not `true`, `false` or `null`\n */\n ;\n\n _proto.parseValueLiteral = function parseValueLiteral(isConst) {\n var token = this._lexer.token;\n\n switch (token.kind) {\n case TokenKind.BRACKET_L:\n return this.parseList(isConst);\n\n case TokenKind.BRACE_L:\n return this.parseObject(isConst);\n\n case TokenKind.INT:\n this._lexer.advance();\n\n return {\n kind: Kind.INT,\n value: token.value,\n loc: this.loc(token)\n };\n\n case TokenKind.FLOAT:\n this._lexer.advance();\n\n return {\n kind: Kind.FLOAT,\n value: token.value,\n loc: this.loc(token)\n };\n\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n return this.parseStringLiteral();\n\n case TokenKind.NAME:\n this._lexer.advance();\n\n switch (token.value) {\n case 'true':\n return {\n kind: Kind.BOOLEAN,\n value: true,\n loc: this.loc(token)\n };\n\n case 'false':\n return {\n kind: Kind.BOOLEAN,\n value: false,\n loc: this.loc(token)\n };\n\n case 'null':\n return {\n kind: Kind.NULL,\n loc: this.loc(token)\n };\n\n default:\n return {\n kind: Kind.ENUM,\n value: token.value,\n loc: this.loc(token)\n };\n }\n\n case TokenKind.DOLLAR:\n if (!isConst) {\n return this.parseVariable();\n }\n\n break;\n }\n\n throw this.unexpected();\n };\n\n _proto.parseStringLiteral = function parseStringLiteral() {\n var token = this._lexer.token;\n\n this._lexer.advance();\n\n return {\n kind: Kind.STRING,\n value: token.value,\n block: token.kind === TokenKind.BLOCK_STRING,\n loc: this.loc(token)\n };\n }\n /**\n * ListValue[Const] :\n * - [ ]\n * - [ Value[?Const]+ ]\n */\n ;\n\n _proto.parseList = function parseList(isConst) {\n var _this = this;\n\n var start = this._lexer.token;\n\n var item = function item() {\n return _this.parseValueLiteral(isConst);\n };\n\n return {\n kind: Kind.LIST,\n values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),\n loc: this.loc(start)\n };\n }\n /**\n * ObjectValue[Const] :\n * - { }\n * - { ObjectField[?Const]+ }\n */\n ;\n\n _proto.parseObject = function parseObject(isConst) {\n var _this2 = this;\n\n var start = this._lexer.token;\n\n var item = function item() {\n return _this2.parseObjectField(isConst);\n };\n\n return {\n kind: Kind.OBJECT,\n fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R),\n loc: this.loc(start)\n };\n }\n /**\n * ObjectField[Const] : Name : Value[?Const]\n */\n ;\n\n _proto.parseObjectField = function parseObjectField(isConst) {\n var start = this._lexer.token;\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return {\n kind: Kind.OBJECT_FIELD,\n name: name,\n value: this.parseValueLiteral(isConst),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Directives section.\n\n /**\n * Directives[Const] : Directive[?Const]+\n */\n ;\n\n _proto.parseDirectives = function parseDirectives(isConst) {\n var directives = [];\n\n while (this.peek(TokenKind.AT)) {\n directives.push(this.parseDirective(isConst));\n }\n\n return directives;\n }\n /**\n * Directive[Const] : @ Name Arguments[?Const]?\n */\n ;\n\n _proto.parseDirective = function parseDirective(isConst) {\n var start = this._lexer.token;\n this.expectToken(TokenKind.AT);\n return {\n kind: Kind.DIRECTIVE,\n name: this.parseName(),\n arguments: this.parseArguments(isConst),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Types section.\n\n /**\n * Type :\n * - NamedType\n * - ListType\n * - NonNullType\n */\n ;\n\n _proto.parseTypeReference = function parseTypeReference() {\n var start = this._lexer.token;\n var type;\n\n if (this.expectOptionalToken(TokenKind.BRACKET_L)) {\n type = this.parseTypeReference();\n this.expectToken(TokenKind.BRACKET_R);\n type = {\n kind: Kind.LIST_TYPE,\n type: type,\n loc: this.loc(start)\n };\n } else {\n type = this.parseNamedType();\n }\n\n if (this.expectOptionalToken(TokenKind.BANG)) {\n return {\n kind: Kind.NON_NULL_TYPE,\n type: type,\n loc: this.loc(start)\n };\n }\n\n return type;\n }\n /**\n * NamedType : Name\n */\n ;\n\n _proto.parseNamedType = function parseNamedType() {\n var start = this._lexer.token;\n return {\n kind: Kind.NAMED_TYPE,\n name: this.parseName(),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Type Definition section.\n\n /**\n * TypeSystemDefinition :\n * - SchemaDefinition\n * - TypeDefinition\n * - DirectiveDefinition\n *\n * TypeDefinition :\n * - ScalarTypeDefinition\n * - ObjectTypeDefinition\n * - InterfaceTypeDefinition\n * - UnionTypeDefinition\n * - EnumTypeDefinition\n * - InputObjectTypeDefinition\n */\n ;\n\n _proto.parseTypeSystemDefinition = function parseTypeSystemDefinition() {\n // Many definitions begin with a description and require a lookahead.\n var keywordToken = this.peekDescription() ? this._lexer.lookahead() : this._lexer.token;\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaDefinition();\n\n case 'scalar':\n return this.parseScalarTypeDefinition();\n\n case 'type':\n return this.parseObjectTypeDefinition();\n\n case 'interface':\n return this.parseInterfaceTypeDefinition();\n\n case 'union':\n return this.parseUnionTypeDefinition();\n\n case 'enum':\n return this.parseEnumTypeDefinition();\n\n case 'input':\n return this.parseInputObjectTypeDefinition();\n\n case 'directive':\n return this.parseDirectiveDefinition();\n }\n }\n\n throw this.unexpected(keywordToken);\n };\n\n _proto.peekDescription = function peekDescription() {\n return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);\n }\n /**\n * Description : StringValue\n */\n ;\n\n _proto.parseDescription = function parseDescription() {\n if (this.peekDescription()) {\n return this.parseStringLiteral();\n }\n }\n /**\n * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }\n */\n ;\n\n _proto.parseSchemaDefinition = function parseSchemaDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('schema');\n var directives = this.parseDirectives(true);\n var operationTypes = this.many(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R);\n return {\n kind: Kind.SCHEMA_DEFINITION,\n description: description,\n directives: directives,\n operationTypes: operationTypes,\n loc: this.loc(start)\n };\n }\n /**\n * OperationTypeDefinition : OperationType : NamedType\n */\n ;\n\n _proto.parseOperationTypeDefinition = function parseOperationTypeDefinition() {\n var start = this._lexer.token;\n var operation = this.parseOperationType();\n this.expectToken(TokenKind.COLON);\n var type = this.parseNamedType();\n return {\n kind: Kind.OPERATION_TYPE_DEFINITION,\n operation: operation,\n type: type,\n loc: this.loc(start)\n };\n }\n /**\n * ScalarTypeDefinition : Description? scalar Name Directives[Const]?\n */\n ;\n\n _proto.parseScalarTypeDefinition = function parseScalarTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('scalar');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.SCALAR_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ObjectTypeDefinition :\n * Description?\n * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?\n */\n ;\n\n _proto.parseObjectTypeDefinition = function parseObjectTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('type');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n return {\n kind: Kind.OBJECT_TYPE_DEFINITION,\n description: description,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * ImplementsInterfaces :\n * - implements `&`? NamedType\n * - ImplementsInterfaces & NamedType\n */\n ;\n\n _proto.parseImplementsInterfaces = function parseImplementsInterfaces() {\n var _this$_options2;\n\n if (!this.expectOptionalKeyword('implements')) {\n return [];\n }\n\n if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) {\n var types = []; // Optional leading ampersand\n\n this.expectOptionalToken(TokenKind.AMP);\n\n do {\n types.push(this.parseNamedType());\n } while (this.expectOptionalToken(TokenKind.AMP) || this.peek(TokenKind.NAME));\n\n return types;\n }\n\n return this.delimitedMany(TokenKind.AMP, this.parseNamedType);\n }\n /**\n * FieldsDefinition : { FieldDefinition+ }\n */\n ;\n\n _proto.parseFieldsDefinition = function parseFieldsDefinition() {\n var _this$_options3;\n\n // Legacy support for the SDL?\n if (((_this$_options3 = this._options) === null || _this$_options3 === void 0 ? void 0 : _this$_options3.allowLegacySDLEmptyFields) === true && this.peek(TokenKind.BRACE_L) && this._lexer.lookahead().kind === TokenKind.BRACE_R) {\n this._lexer.advance();\n\n this._lexer.advance();\n\n return [];\n }\n\n return this.optionalMany(TokenKind.BRACE_L, this.parseFieldDefinition, TokenKind.BRACE_R);\n }\n /**\n * FieldDefinition :\n * - Description? Name ArgumentsDefinition? : Type Directives[Const]?\n */\n ;\n\n _proto.parseFieldDefinition = function parseFieldDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n var args = this.parseArgumentDefs();\n this.expectToken(TokenKind.COLON);\n var type = this.parseTypeReference();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.FIELD_DEFINITION,\n description: description,\n name: name,\n arguments: args,\n type: type,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ArgumentsDefinition : ( InputValueDefinition+ )\n */\n ;\n\n _proto.parseArgumentDefs = function parseArgumentDefs() {\n return this.optionalMany(TokenKind.PAREN_L, this.parseInputValueDef, TokenKind.PAREN_R);\n }\n /**\n * InputValueDefinition :\n * - Description? Name : Type DefaultValue? Directives[Const]?\n */\n ;\n\n _proto.parseInputValueDef = function parseInputValueDef() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n var type = this.parseTypeReference();\n var defaultValue;\n\n if (this.expectOptionalToken(TokenKind.EQUALS)) {\n defaultValue = this.parseValueLiteral(true);\n }\n\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.INPUT_VALUE_DEFINITION,\n description: description,\n name: name,\n type: type,\n defaultValue: defaultValue,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * InterfaceTypeDefinition :\n * - Description? interface Name Directives[Const]? FieldsDefinition?\n */\n ;\n\n _proto.parseInterfaceTypeDefinition = function parseInterfaceTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('interface');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n return {\n kind: Kind.INTERFACE_TYPE_DEFINITION,\n description: description,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * UnionTypeDefinition :\n * - Description? union Name Directives[Const]? UnionMemberTypes?\n */\n ;\n\n _proto.parseUnionTypeDefinition = function parseUnionTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('union');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var types = this.parseUnionMemberTypes();\n return {\n kind: Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: this.loc(start)\n };\n }\n /**\n * UnionMemberTypes :\n * - = `|`? NamedType\n * - UnionMemberTypes | NamedType\n */\n ;\n\n _proto.parseUnionMemberTypes = function parseUnionMemberTypes() {\n return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : [];\n }\n /**\n * EnumTypeDefinition :\n * - Description? enum Name Directives[Const]? EnumValuesDefinition?\n */\n ;\n\n _proto.parseEnumTypeDefinition = function parseEnumTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('enum');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var values = this.parseEnumValuesDefinition();\n return {\n kind: Kind.ENUM_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n values: values,\n loc: this.loc(start)\n };\n }\n /**\n * EnumValuesDefinition : { EnumValueDefinition+ }\n */\n ;\n\n _proto.parseEnumValuesDefinition = function parseEnumValuesDefinition() {\n return this.optionalMany(TokenKind.BRACE_L, this.parseEnumValueDefinition, TokenKind.BRACE_R);\n }\n /**\n * EnumValueDefinition : Description? EnumValue Directives[Const]?\n *\n * EnumValue : Name\n */\n ;\n\n _proto.parseEnumValueDefinition = function parseEnumValueDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.ENUM_VALUE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * InputObjectTypeDefinition :\n * - Description? input Name Directives[Const]? InputFieldsDefinition?\n */\n ;\n\n _proto.parseInputObjectTypeDefinition = function parseInputObjectTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('input');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var fields = this.parseInputFieldsDefinition();\n return {\n kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * InputFieldsDefinition : { InputValueDefinition+ }\n */\n ;\n\n _proto.parseInputFieldsDefinition = function parseInputFieldsDefinition() {\n return this.optionalMany(TokenKind.BRACE_L, this.parseInputValueDef, TokenKind.BRACE_R);\n }\n /**\n * TypeSystemExtension :\n * - SchemaExtension\n * - TypeExtension\n *\n * TypeExtension :\n * - ScalarTypeExtension\n * - ObjectTypeExtension\n * - InterfaceTypeExtension\n * - UnionTypeExtension\n * - EnumTypeExtension\n * - InputObjectTypeDefinition\n */\n ;\n\n _proto.parseTypeSystemExtension = function parseTypeSystemExtension() {\n var keywordToken = this._lexer.lookahead();\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaExtension();\n\n case 'scalar':\n return this.parseScalarTypeExtension();\n\n case 'type':\n return this.parseObjectTypeExtension();\n\n case 'interface':\n return this.parseInterfaceTypeExtension();\n\n case 'union':\n return this.parseUnionTypeExtension();\n\n case 'enum':\n return this.parseEnumTypeExtension();\n\n case 'input':\n return this.parseInputObjectTypeExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n }\n /**\n * SchemaExtension :\n * - extend schema Directives[Const]? { OperationTypeDefinition+ }\n * - extend schema Directives[Const]\n */\n ;\n\n _proto.parseSchemaExtension = function parseSchemaExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('schema');\n var directives = this.parseDirectives(true);\n var operationTypes = this.optionalMany(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R);\n\n if (directives.length === 0 && operationTypes.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.SCHEMA_EXTENSION,\n directives: directives,\n operationTypes: operationTypes,\n loc: this.loc(start)\n };\n }\n /**\n * ScalarTypeExtension :\n * - extend scalar Name Directives[Const]\n */\n ;\n\n _proto.parseScalarTypeExtension = function parseScalarTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('scalar');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n\n if (directives.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.SCALAR_TYPE_EXTENSION,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ObjectTypeExtension :\n * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend type Name ImplementsInterfaces? Directives[Const]\n * - extend type Name ImplementsInterfaces\n */\n ;\n\n _proto.parseObjectTypeExtension = function parseObjectTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('type');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n\n if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.OBJECT_TYPE_EXTENSION,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * InterfaceTypeExtension :\n * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend interface Name ImplementsInterfaces? Directives[Const]\n * - extend interface Name ImplementsInterfaces\n */\n ;\n\n _proto.parseInterfaceTypeExtension = function parseInterfaceTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('interface');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n\n if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.INTERFACE_TYPE_EXTENSION,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * UnionTypeExtension :\n * - extend union Name Directives[Const]? UnionMemberTypes\n * - extend union Name Directives[Const]\n */\n ;\n\n _proto.parseUnionTypeExtension = function parseUnionTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('union');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var types = this.parseUnionMemberTypes();\n\n if (directives.length === 0 && types.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.UNION_TYPE_EXTENSION,\n name: name,\n directives: directives,\n types: types,\n loc: this.loc(start)\n };\n }\n /**\n * EnumTypeExtension :\n * - extend enum Name Directives[Const]? EnumValuesDefinition\n * - extend enum Name Directives[Const]\n */\n ;\n\n _proto.parseEnumTypeExtension = function parseEnumTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('enum');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var values = this.parseEnumValuesDefinition();\n\n if (directives.length === 0 && values.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.ENUM_TYPE_EXTENSION,\n name: name,\n directives: directives,\n values: values,\n loc: this.loc(start)\n };\n }\n /**\n * InputObjectTypeExtension :\n * - extend input Name Directives[Const]? InputFieldsDefinition\n * - extend input Name Directives[Const]\n */\n ;\n\n _proto.parseInputObjectTypeExtension = function parseInputObjectTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('input');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var fields = this.parseInputFieldsDefinition();\n\n if (directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,\n name: name,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * DirectiveDefinition :\n * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations\n */\n ;\n\n _proto.parseDirectiveDefinition = function parseDirectiveDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('directive');\n this.expectToken(TokenKind.AT);\n var name = this.parseName();\n var args = this.parseArgumentDefs();\n var repeatable = this.expectOptionalKeyword('repeatable');\n this.expectKeyword('on');\n var locations = this.parseDirectiveLocations();\n return {\n kind: Kind.DIRECTIVE_DEFINITION,\n description: description,\n name: name,\n arguments: args,\n repeatable: repeatable,\n locations: locations,\n loc: this.loc(start)\n };\n }\n /**\n * DirectiveLocations :\n * - `|`? DirectiveLocation\n * - DirectiveLocations | DirectiveLocation\n */\n ;\n\n _proto.parseDirectiveLocations = function parseDirectiveLocations() {\n return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);\n }\n /*\n * DirectiveLocation :\n * - ExecutableDirectiveLocation\n * - TypeSystemDirectiveLocation\n *\n * ExecutableDirectiveLocation : one of\n * `QUERY`\n * `MUTATION`\n * `SUBSCRIPTION`\n * `FIELD`\n * `FRAGMENT_DEFINITION`\n * `FRAGMENT_SPREAD`\n * `INLINE_FRAGMENT`\n *\n * TypeSystemDirectiveLocation : one of\n * `SCHEMA`\n * `SCALAR`\n * `OBJECT`\n * `FIELD_DEFINITION`\n * `ARGUMENT_DEFINITION`\n * `INTERFACE`\n * `UNION`\n * `ENUM`\n * `ENUM_VALUE`\n * `INPUT_OBJECT`\n * `INPUT_FIELD_DEFINITION`\n */\n ;\n\n _proto.parseDirectiveLocation = function parseDirectiveLocation() {\n var start = this._lexer.token;\n var name = this.parseName();\n\n if (DirectiveLocation[name.value] !== undefined) {\n return name;\n }\n\n throw this.unexpected(start);\n } // Core parsing utility functions\n\n /**\n * Returns a location object, used to identify the place in the source that created a given parsed object.\n */\n ;\n\n _proto.loc = function loc(startToken) {\n var _this$_options4;\n\n if (((_this$_options4 = this._options) === null || _this$_options4 === void 0 ? void 0 : _this$_options4.noLocation) !== true) {\n return new Location(startToken, this._lexer.lastToken, this._lexer.source);\n }\n }\n /**\n * Determines if the next token is of a given kind\n */\n ;\n\n _proto.peek = function peek(kind) {\n return this._lexer.token.kind === kind;\n }\n /**\n * If the next token is of the given kind, return that token after advancing the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n ;\n\n _proto.expectToken = function expectToken(kind) {\n var token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n throw syntaxError(this._lexer.source, token.start, \"Expected \".concat(getTokenKindDesc(kind), \", found \").concat(getTokenDesc(token), \".\"));\n }\n /**\n * If the next token is of the given kind, return that token after advancing the lexer.\n * Otherwise, do not change the parser state and return undefined.\n */\n ;\n\n _proto.expectOptionalToken = function expectOptionalToken(kind) {\n var token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n return undefined;\n }\n /**\n * If the next token is a given keyword, advance the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n ;\n\n _proto.expectKeyword = function expectKeyword(value) {\n var token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n } else {\n throw syntaxError(this._lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat(getTokenDesc(token), \".\"));\n }\n }\n /**\n * If the next token is a given keyword, return \"true\" after advancing the lexer.\n * Otherwise, do not change the parser state and return \"false\".\n */\n ;\n\n _proto.expectOptionalKeyword = function expectOptionalKeyword(value) {\n var token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n\n return true;\n }\n\n return false;\n }\n /**\n * Helper function for creating an error when an unexpected lexed token is encountered.\n */\n ;\n\n _proto.unexpected = function unexpected(atToken) {\n var token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;\n return syntaxError(this._lexer.source, token.start, \"Unexpected \".concat(getTokenDesc(token), \".\"));\n }\n /**\n * Returns a possibly empty list of parse nodes, determined by the parseFn.\n * This list begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n ;\n\n _proto.any = function any(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n var nodes = [];\n\n while (!this.expectOptionalToken(closeKind)) {\n nodes.push(parseFn.call(this));\n }\n\n return nodes;\n }\n /**\n * Returns a list of parse nodes, determined by the parseFn.\n * It can be empty only if open token is missing otherwise it will always return non-empty list\n * that begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n ;\n\n _proto.optionalMany = function optionalMany(openKind, parseFn, closeKind) {\n if (this.expectOptionalToken(openKind)) {\n var nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n\n return [];\n }\n /**\n * Returns a non-empty list of parse nodes, determined by the parseFn.\n * This list begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n ;\n\n _proto.many = function many(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n var nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n /**\n * Returns a non-empty list of parse nodes, determined by the parseFn.\n * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.\n * Advances the parser to the next lex token after last item in the list.\n */\n ;\n\n _proto.delimitedMany = function delimitedMany(delimiterKind, parseFn) {\n this.expectOptionalToken(delimiterKind);\n var nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (this.expectOptionalToken(delimiterKind));\n\n return nodes;\n };\n\n return Parser;\n}();\n/**\n * A helper function to describe a token as a string for debugging.\n */\n\nfunction getTokenDesc(token) {\n var value = token.value;\n return getTokenKindDesc(token.kind) + (value != null ? \" \\\"\".concat(value, \"\\\"\") : '');\n}\n/**\n * A helper function to describe a token kind as a string for debugging.\n */\n\n\nfunction getTokenKindDesc(kind) {\n return isPunctuatorTokenKind(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}\n","import inspect from \"../jsutils/inspect.mjs\";\nimport { isNode } from \"./ast.mjs\";\n/**\n * A visitor is provided to visit, it contains the collection of\n * relevant functions to be called during the visitor's traversal.\n */\n\nexport var QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['description', 'directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'],\n InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields']\n};\nexport var BREAK = Object.freeze({});\n/**\n * visit() will walk through an AST using a depth-first traversal, calling\n * the visitor's enter function at each node in the traversal, and calling the\n * leave function after visiting that node and all of its child nodes.\n *\n * By returning different values from the enter and leave functions, the\n * behavior of the visitor can be altered, including skipping over a sub-tree of\n * the AST (by returning false), editing the AST by returning a value or null\n * to remove the value, or to stop the whole traversal by returning BREAK.\n *\n * When using visit() to edit an AST, the original AST will not be modified, and\n * a new version of the AST with the changes applied will be returned from the\n * visit function.\n *\n * const editedAST = visit(ast, {\n * enter(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: skip visiting this node\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * },\n * leave(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: no action\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * }\n * });\n *\n * Alternatively to providing enter() and leave() functions, a visitor can\n * instead provide functions named the same as the kinds of AST nodes, or\n * enter/leave visitors at a named key, leading to four permutations of the\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node of a specific kind.\n *\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n *\n * 2) Named visitors that trigger upon entering and leaving a node of\n * a specific kind.\n *\n * visit(ast, {\n * Kind: {\n * enter(node) {\n * // enter the \"Kind\" node\n * }\n * leave(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n *\n * 4) Parallel visitors for entering and leaving nodes of a specific kind.\n *\n * visit(ast, {\n * enter: {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * },\n * leave: {\n * Kind(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n */\n\nexport function visit(root, visitor) {\n var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys;\n\n /* eslint-disable no-undef-init */\n var stack = undefined;\n var inArray = Array.isArray(root);\n var keys = [root];\n var index = -1;\n var edits = [];\n var node = undefined;\n var key = undefined;\n var parent = undefined;\n var path = [];\n var ancestors = [];\n var newRoot = root;\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n var isLeaving = index === keys.length;\n var isEdited = isLeaving && edits.length !== 0;\n\n if (isLeaving) {\n key = ancestors.length === 0 ? undefined : path[path.length - 1];\n node = parent;\n parent = ancestors.pop();\n\n if (isEdited) {\n if (inArray) {\n node = node.slice();\n } else {\n var clone = {};\n\n for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) {\n var k = _Object$keys2[_i2];\n clone[k] = node[k];\n }\n\n node = clone;\n }\n\n var editOffset = 0;\n\n for (var ii = 0; ii < edits.length; ii++) {\n var editKey = edits[ii][0];\n var editValue = edits[ii][1];\n\n if (inArray) {\n editKey -= editOffset;\n }\n\n if (inArray && editValue === null) {\n node.splice(editKey, 1);\n editOffset++;\n } else {\n node[editKey] = editValue;\n }\n }\n }\n\n index = stack.index;\n keys = stack.keys;\n edits = stack.edits;\n inArray = stack.inArray;\n stack = stack.prev;\n } else {\n key = parent ? inArray ? index : keys[index] : undefined;\n node = parent ? parent[key] : newRoot;\n\n if (node === null || node === undefined) {\n continue;\n }\n\n if (parent) {\n path.push(key);\n }\n }\n\n var result = void 0;\n\n if (!Array.isArray(node)) {\n if (!isNode(node)) {\n throw new Error(\"Invalid AST Node: \".concat(inspect(node), \".\"));\n }\n\n var visitFn = getVisitFn(visitor, node.kind, isLeaving);\n\n if (visitFn) {\n result = visitFn.call(visitor, node, key, parent, path, ancestors);\n\n if (result === BREAK) {\n break;\n }\n\n if (result === false) {\n if (!isLeaving) {\n path.pop();\n continue;\n }\n } else if (result !== undefined) {\n edits.push([key, result]);\n\n if (!isLeaving) {\n if (isNode(result)) {\n node = result;\n } else {\n path.pop();\n continue;\n }\n }\n }\n }\n }\n\n if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n var _visitorKeys$node$kin;\n\n stack = {\n inArray: inArray,\n index: index,\n keys: keys,\n edits: edits,\n prev: stack\n };\n inArray = Array.isArray(node);\n keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : [];\n index = -1;\n edits = [];\n\n if (parent) {\n ancestors.push(parent);\n }\n\n parent = node;\n }\n } while (stack !== undefined);\n\n if (edits.length !== 0) {\n newRoot = edits[edits.length - 1][1];\n }\n\n return newRoot;\n}\n/**\n * Creates a new visitor instance which delegates to many visitors to run in\n * parallel. Each visitor will be visited for each node before moving on.\n *\n * If a prior visitor edits a node, no following visitors will see that node.\n */\n\nexport function visitInParallel(visitors) {\n var skipping = new Array(visitors.length);\n return {\n enter: function enter(node) {\n for (var i = 0; i < visitors.length; i++) {\n if (skipping[i] == null) {\n var fn = getVisitFn(visitors[i], node.kind,\n /* isLeaving */\n false);\n\n if (fn) {\n var result = fn.apply(visitors[i], arguments);\n\n if (result === false) {\n skipping[i] = node;\n } else if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined) {\n return result;\n }\n }\n }\n }\n },\n leave: function leave(node) {\n for (var i = 0; i < visitors.length; i++) {\n if (skipping[i] == null) {\n var fn = getVisitFn(visitors[i], node.kind,\n /* isLeaving */\n true);\n\n if (fn) {\n var result = fn.apply(visitors[i], arguments);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n }\n };\n}\n/**\n * Given a visitor instance, if it is leaving or not, and a node kind, return\n * the function the visitor runtime should call.\n */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n var kindVisitor = visitor[kind];\n\n if (kindVisitor) {\n if (!isLeaving && typeof kindVisitor === 'function') {\n // { Kind() {} }\n return kindVisitor;\n }\n\n var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter;\n\n if (typeof kindSpecificVisitor === 'function') {\n // { Kind: { enter() {}, leave() {} } }\n return kindSpecificVisitor;\n }\n } else {\n var specificVisitor = isLeaving ? visitor.leave : visitor.enter;\n\n if (specificVisitor) {\n if (typeof specificVisitor === 'function') {\n // { enter() {}, leave() {} }\n return specificVisitor;\n }\n\n var specificKindVisitor = specificVisitor[kind];\n\n if (typeof specificKindVisitor === 'function') {\n // { enter: { Kind() {} }, leave: { Kind() {} } }\n return specificKindVisitor;\n }\n }\n }\n}\n","import { visit } from \"./visitor.mjs\";\nimport { printBlockString } from \"./blockString.mjs\";\n/**\n * Converts an AST into a string, using one set of reasonable\n * formatting rules.\n */\n\nexport function print(ast) {\n return visit(ast, {\n leave: printDocASTReducer\n });\n}\nvar MAX_LINE_LENGTH = 80; // TODO: provide better type coverage in future\n\nvar printDocASTReducer = {\n Name: function Name(node) {\n return node.value;\n },\n Variable: function Variable(node) {\n return '$' + node.name;\n },\n // Document\n Document: function Document(node) {\n return join(node.definitions, '\\n\\n') + '\\n';\n },\n OperationDefinition: function OperationDefinition(node) {\n var op = node.operation;\n var name = node.name;\n var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')');\n var directives = join(node.directives, ' ');\n var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n\n return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' ');\n },\n VariableDefinition: function VariableDefinition(_ref) {\n var variable = _ref.variable,\n type = _ref.type,\n defaultValue = _ref.defaultValue,\n directives = _ref.directives;\n return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' '));\n },\n SelectionSet: function SelectionSet(_ref2) {\n var selections = _ref2.selections;\n return block(selections);\n },\n Field: function Field(_ref3) {\n var alias = _ref3.alias,\n name = _ref3.name,\n args = _ref3.arguments,\n directives = _ref3.directives,\n selectionSet = _ref3.selectionSet;\n var prefix = wrap('', alias, ': ') + name;\n var argsLine = prefix + wrap('(', join(args, ', '), ')');\n\n if (argsLine.length > MAX_LINE_LENGTH) {\n argsLine = prefix + wrap('(\\n', indent(join(args, '\\n')), '\\n)');\n }\n\n return join([argsLine, join(directives, ' '), selectionSet], ' ');\n },\n Argument: function Argument(_ref4) {\n var name = _ref4.name,\n value = _ref4.value;\n return name + ': ' + value;\n },\n // Fragments\n FragmentSpread: function FragmentSpread(_ref5) {\n var name = _ref5.name,\n directives = _ref5.directives;\n return '...' + name + wrap(' ', join(directives, ' '));\n },\n InlineFragment: function InlineFragment(_ref6) {\n var typeCondition = _ref6.typeCondition,\n directives = _ref6.directives,\n selectionSet = _ref6.selectionSet;\n return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' ');\n },\n FragmentDefinition: function FragmentDefinition(_ref7) {\n var name = _ref7.name,\n typeCondition = _ref7.typeCondition,\n variableDefinitions = _ref7.variableDefinitions,\n directives = _ref7.directives,\n selectionSet = _ref7.selectionSet;\n return (// Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n \"fragment \".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), \" \") + \"on \".concat(typeCondition, \" \").concat(wrap('', join(directives, ' '), ' ')) + selectionSet\n );\n },\n // Value\n IntValue: function IntValue(_ref8) {\n var value = _ref8.value;\n return value;\n },\n FloatValue: function FloatValue(_ref9) {\n var value = _ref9.value;\n return value;\n },\n StringValue: function StringValue(_ref10, key) {\n var value = _ref10.value,\n isBlockString = _ref10.block;\n return isBlockString ? printBlockString(value, key === 'description' ? '' : ' ') : JSON.stringify(value);\n },\n BooleanValue: function BooleanValue(_ref11) {\n var value = _ref11.value;\n return value ? 'true' : 'false';\n },\n NullValue: function NullValue() {\n return 'null';\n },\n EnumValue: function EnumValue(_ref12) {\n var value = _ref12.value;\n return value;\n },\n ListValue: function ListValue(_ref13) {\n var values = _ref13.values;\n return '[' + join(values, ', ') + ']';\n },\n ObjectValue: function ObjectValue(_ref14) {\n var fields = _ref14.fields;\n return '{' + join(fields, ', ') + '}';\n },\n ObjectField: function ObjectField(_ref15) {\n var name = _ref15.name,\n value = _ref15.value;\n return name + ': ' + value;\n },\n // Directive\n Directive: function Directive(_ref16) {\n var name = _ref16.name,\n args = _ref16.arguments;\n return '@' + name + wrap('(', join(args, ', '), ')');\n },\n // Type\n NamedType: function NamedType(_ref17) {\n var name = _ref17.name;\n return name;\n },\n ListType: function ListType(_ref18) {\n var type = _ref18.type;\n return '[' + type + ']';\n },\n NonNullType: function NonNullType(_ref19) {\n var type = _ref19.type;\n return type + '!';\n },\n // Type System Definitions\n SchemaDefinition: addDescription(function (_ref20) {\n var directives = _ref20.directives,\n operationTypes = _ref20.operationTypes;\n return join(['schema', join(directives, ' '), block(operationTypes)], ' ');\n }),\n OperationTypeDefinition: function OperationTypeDefinition(_ref21) {\n var operation = _ref21.operation,\n type = _ref21.type;\n return operation + ': ' + type;\n },\n ScalarTypeDefinition: addDescription(function (_ref22) {\n var name = _ref22.name,\n directives = _ref22.directives;\n return join(['scalar', name, join(directives, ' ')], ' ');\n }),\n ObjectTypeDefinition: addDescription(function (_ref23) {\n var name = _ref23.name,\n interfaces = _ref23.interfaces,\n directives = _ref23.directives,\n fields = _ref23.fields;\n return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n }),\n FieldDefinition: addDescription(function (_ref24) {\n var name = _ref24.name,\n args = _ref24.arguments,\n type = _ref24.type,\n directives = _ref24.directives;\n return name + (hasMultilineItems(args) ? wrap('(\\n', indent(join(args, '\\n')), '\\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' '));\n }),\n InputValueDefinition: addDescription(function (_ref25) {\n var name = _ref25.name,\n type = _ref25.type,\n defaultValue = _ref25.defaultValue,\n directives = _ref25.directives;\n return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' ');\n }),\n InterfaceTypeDefinition: addDescription(function (_ref26) {\n var name = _ref26.name,\n interfaces = _ref26.interfaces,\n directives = _ref26.directives,\n fields = _ref26.fields;\n return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n }),\n UnionTypeDefinition: addDescription(function (_ref27) {\n var name = _ref27.name,\n directives = _ref27.directives,\n types = _ref27.types;\n return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' ');\n }),\n EnumTypeDefinition: addDescription(function (_ref28) {\n var name = _ref28.name,\n directives = _ref28.directives,\n values = _ref28.values;\n return join(['enum', name, join(directives, ' '), block(values)], ' ');\n }),\n EnumValueDefinition: addDescription(function (_ref29) {\n var name = _ref29.name,\n directives = _ref29.directives;\n return join([name, join(directives, ' ')], ' ');\n }),\n InputObjectTypeDefinition: addDescription(function (_ref30) {\n var name = _ref30.name,\n directives = _ref30.directives,\n fields = _ref30.fields;\n return join(['input', name, join(directives, ' '), block(fields)], ' ');\n }),\n DirectiveDefinition: addDescription(function (_ref31) {\n var name = _ref31.name,\n args = _ref31.arguments,\n repeatable = _ref31.repeatable,\n locations = _ref31.locations;\n return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\\n', indent(join(args, '\\n')), '\\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | ');\n }),\n SchemaExtension: function SchemaExtension(_ref32) {\n var directives = _ref32.directives,\n operationTypes = _ref32.operationTypes;\n return join(['extend schema', join(directives, ' '), block(operationTypes)], ' ');\n },\n ScalarTypeExtension: function ScalarTypeExtension(_ref33) {\n var name = _ref33.name,\n directives = _ref33.directives;\n return join(['extend scalar', name, join(directives, ' ')], ' ');\n },\n ObjectTypeExtension: function ObjectTypeExtension(_ref34) {\n var name = _ref34.name,\n interfaces = _ref34.interfaces,\n directives = _ref34.directives,\n fields = _ref34.fields;\n return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n },\n InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) {\n var name = _ref35.name,\n interfaces = _ref35.interfaces,\n directives = _ref35.directives,\n fields = _ref35.fields;\n return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n },\n UnionTypeExtension: function UnionTypeExtension(_ref36) {\n var name = _ref36.name,\n directives = _ref36.directives,\n types = _ref36.types;\n return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' ');\n },\n EnumTypeExtension: function EnumTypeExtension(_ref37) {\n var name = _ref37.name,\n directives = _ref37.directives,\n values = _ref37.values;\n return join(['extend enum', name, join(directives, ' '), block(values)], ' ');\n },\n InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) {\n var name = _ref38.name,\n directives = _ref38.directives,\n fields = _ref38.fields;\n return join(['extend input', name, join(directives, ' '), block(fields)], ' ');\n }\n};\n\nfunction addDescription(cb) {\n return function (node) {\n return join([node.description, cb(node)], '\\n');\n };\n}\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\n\n\nfunction join(maybeArray) {\n var _maybeArray$filter$jo;\n\n var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) {\n return x;\n }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : '';\n}\n/**\n * Given array, print each item on its own line, wrapped in an\n * indented \"{ }\" block.\n */\n\n\nfunction block(array) {\n return wrap('{\\n', indent(join(array, '\\n')), '\\n}');\n}\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.\n */\n\n\nfunction wrap(start, maybeString) {\n var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n return maybeString != null && maybeString !== '' ? start + maybeString + end : '';\n}\n\nfunction indent(str) {\n return wrap(' ', str.replace(/\\n/g, '\\n '));\n}\n\nfunction isMultiline(str) {\n return str.indexOf('\\n') !== -1;\n}\n\nfunction hasMultilineItems(maybeArray) {\n return maybeArray != null && maybeArray.some(isMultiline);\n}\n","//\n// Main\n//\n\nfunction memoize (fn, options) {\n var cache = options && options.cache\n ? options.cache\n : cacheDefault\n\n var serializer = options && options.serializer\n ? options.serializer\n : serializerDefault\n\n var strategy = options && options.strategy\n ? options.strategy\n : strategyDefault\n\n return strategy(fn, {\n cache: cache,\n serializer: serializer\n })\n}\n\n//\n// Strategy\n//\n\nfunction isPrimitive (value) {\n return value == null || typeof value === 'number' || typeof value === 'boolean' // || typeof value === \"string\" 'unsafe' primitive for our needs\n}\n\nfunction monadic (fn, cache, serializer, arg) {\n var cacheKey = isPrimitive(arg) ? arg : serializer(arg)\n\n var computedValue = cache.get(cacheKey)\n if (typeof computedValue === 'undefined') {\n computedValue = fn.call(this, arg)\n cache.set(cacheKey, computedValue)\n }\n\n return computedValue\n}\n\nfunction variadic (fn, cache, serializer) {\n var args = Array.prototype.slice.call(arguments, 3)\n var cacheKey = serializer(args)\n\n var computedValue = cache.get(cacheKey)\n if (typeof computedValue === 'undefined') {\n computedValue = fn.apply(this, args)\n cache.set(cacheKey, computedValue)\n }\n\n return computedValue\n}\n\nfunction assemble (fn, context, strategy, cache, serialize) {\n return strategy.bind(\n context,\n fn,\n cache,\n serialize\n )\n}\n\nfunction strategyDefault (fn, options) {\n var strategy = fn.length === 1 ? monadic : variadic\n\n return assemble(\n fn,\n this,\n strategy,\n options.cache.create(),\n options.serializer\n )\n}\n\nfunction strategyVariadic (fn, options) {\n var strategy = variadic\n\n return assemble(\n fn,\n this,\n strategy,\n options.cache.create(),\n options.serializer\n )\n}\n\nfunction strategyMonadic (fn, options) {\n var strategy = monadic\n\n return assemble(\n fn,\n this,\n strategy,\n options.cache.create(),\n options.serializer\n )\n}\n\n//\n// Serializer\n//\n\nfunction serializerDefault () {\n return JSON.stringify(arguments)\n}\n\n//\n// Cache\n//\n\nfunction ObjectWithoutPrototypeCache () {\n this.cache = Object.create(null)\n}\n\nObjectWithoutPrototypeCache.prototype.has = function (key) {\n return (key in this.cache)\n}\n\nObjectWithoutPrototypeCache.prototype.get = function (key) {\n return this.cache[key]\n}\n\nObjectWithoutPrototypeCache.prototype.set = function (key, value) {\n this.cache[key] = value\n}\n\nvar cacheDefault = {\n create: function create () {\n return new ObjectWithoutPrototypeCache()\n }\n}\n\n//\n// API\n//\n\nmodule.exports = memoize\nmodule.exports.strategies = {\n variadic: strategyVariadic,\n monadic: strategyMonadic\n}\n","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.renameVariables = exports.renameVariablesAndTopLevelFields = exports.renameVariablesAndTopLevelFieldsOnOpDef = exports.renameSelectionSetArguments = exports.renameVariableDefinition = exports.renameDirectiveArguments = exports.renameArgument = exports.renameValue = exports.defaultRenameFn = void 0;\nexports.defaultRenameFn = function (name, index) { return name + \"_\" + index; };\nfunction renameValue(node, renameFn) {\n if (node.kind === 'Variable') {\n return __assign(__assign({}, node), { name: __assign(__assign({}, node.name), { value: renameFn(node.name.value) }) });\n }\n else if (node.kind === 'ObjectValue') {\n return __assign(__assign({}, node), { fields: node.fields.map(function (field) { return (__assign(__assign({}, field), { value: renameValue(field.value, renameFn) })); }) });\n }\n else if (node.kind === 'ListValue') {\n return __assign(__assign({}, node), { values: node.values.map(function (value) { return renameValue(value, renameFn); }) });\n }\n return node;\n}\nexports.renameValue = renameValue;\nfunction renameArgument(node, renameFn) {\n return __assign(__assign({}, node), { value: renameValue(node.value, renameFn) });\n}\nexports.renameArgument = renameArgument;\nfunction renameDirectiveArguments(node, renameFn) {\n var _a;\n return __assign(__assign({}, node), { arguments: (_a = node.arguments) === null || _a === void 0 ? void 0 : _a.map(function (arg) { return renameArgument(arg, renameFn); }) });\n}\nexports.renameDirectiveArguments = renameDirectiveArguments;\nfunction renameVariableDefinition(node, renameFn) {\n var _a;\n return __assign(__assign({}, node), { variable: __assign(__assign({}, node.variable), { name: __assign(__assign({}, node.variable.name), { value: renameFn(node.variable.name.value) }) }), directives: (_a = node.directives) === null || _a === void 0 ? void 0 : _a.map(function (dir) { return renameDirectiveArguments(dir, renameFn); }) });\n}\nexports.renameVariableDefinition = renameVariableDefinition;\nfunction renameSelectionSetArguments(selectionSet, renameFn) {\n return __assign(__assign({}, selectionSet), { selections: selectionSet.selections.map(function (sel) {\n var _a, _b, _c;\n switch (sel.kind) {\n case 'Field':\n return __assign(__assign({}, sel), { arguments: (_a = sel.arguments) === null || _a === void 0 ? void 0 : _a.map(function (arg) { return renameArgument(arg, renameFn); }), selectionSet: sel.selectionSet ? renameSelectionSetArguments(sel.selectionSet, renameFn) : undefined });\n case 'FragmentSpread':\n return __assign(__assign({}, sel), { directives: (_b = sel.directives) === null || _b === void 0 ? void 0 : _b.map(function (dir) { return renameDirectiveArguments(dir, renameFn); }) });\n case 'InlineFragment':\n return __assign(__assign({}, sel), { directives: (_c = sel.directives) === null || _c === void 0 ? void 0 : _c.map(function (dir) { return renameDirectiveArguments(dir, renameFn); }), selectionSet: renameSelectionSetArguments(sel.selectionSet, renameFn) });\n }\n }) });\n}\nexports.renameSelectionSetArguments = renameSelectionSetArguments;\nfunction renameVariablesAndTopLevelFieldsOnOpDef(op, variableRenameFn, fieldRenameFn) {\n var _a, _b;\n return __assign(__assign({}, op), { variableDefinitions: (_a = op.variableDefinitions) === null || _a === void 0 ? void 0 : _a.map(function (vardef) { return renameVariableDefinition(vardef, variableRenameFn); }), directives: (_b = op.directives) === null || _b === void 0 ? void 0 : _b.map(function (dir) { return renameDirectiveArguments(dir, variableRenameFn); }), selectionSet: renameSelectionSetArguments(__assign(__assign({}, op.selectionSet), { selections: op.selectionSet.selections.map(function (sel) {\n var _a, _b;\n switch (sel.kind) {\n case 'Field':\n return __assign(__assign({}, sel), { alias: __assign(__assign({}, sel.name), { value: fieldRenameFn((_b = (_a = sel.alias) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : sel.name.value) }) });\n default:\n return sel;\n }\n }) }), variableRenameFn) });\n}\nexports.renameVariablesAndTopLevelFieldsOnOpDef = renameVariablesAndTopLevelFieldsOnOpDef;\nfunction renameVariablesAndTopLevelFields(doc, variableRenameFn, fieldRenameFn) {\n return __assign(__assign({}, doc), { definitions: __spreadArrays(doc.definitions.filter(function (def) { return def.kind !== 'OperationDefinition'; }), doc.definitions.filter(function (def) { return def.kind === 'OperationDefinition'; }).map(function (opDef) {\n return renameVariablesAndTopLevelFieldsOnOpDef(opDef, variableRenameFn, fieldRenameFn);\n })) });\n}\nexports.renameVariablesAndTopLevelFields = renameVariablesAndTopLevelFields;\nfunction renameVariables(variables, renameFn) {\n return Object.keys(variables).reduce(function (vars, key) {\n var _a;\n return __assign(__assign({}, vars), (_a = {}, _a[renameFn(key)] = variables[key], _a));\n }, {});\n}\nexports.renameVariables = renameVariables;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __spreadArrays = (this && this.__spreadArrays) || function () {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar utils_1 = require(\"./utils\");\nvar emptyDoc = {\n kind: 'Document',\n definitions: []\n};\nvar CombinedQueryError = /** @class */ (function (_super) {\n __extends(CombinedQueryError, _super);\n function CombinedQueryError() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return CombinedQueryError;\n}(Error));\nvar CombinedQueryBuilderImpl = /** @class */ (function () {\n function CombinedQueryBuilderImpl(operationName, document, variables) {\n this.operationName = operationName;\n this.document = document;\n this.variables = variables;\n }\n CombinedQueryBuilderImpl.prototype.add = function (document, variables) {\n var _this = this;\n var opDefs = this.document.definitions.concat(document.definitions).filter(function (def) { return def.kind === 'OperationDefinition'; });\n if (!opDefs.length) {\n throw new CombinedQueryError('Expected at least one OperationDefinition, but found none.');\n }\n // do some basic validation\n opDefs.forEach(function (def) {\n var _a, _b;\n var otherOpDefs = opDefs.filter(function (_def) { return _def !== def; });\n // all op defs must be of the same type\n otherOpDefs.forEach(function (_def) {\n var _a, _b;\n if (_def.operation !== def.operation) {\n throw new CombinedQueryError(\"expected all operations to be of the same type, but \" + ((_a = _def.name) === null || _a === void 0 ? void 0 : _a.value) + \" is \" + _def.operation + \" and \" + ((_b = def.name) === null || _b === void 0 ? void 0 : _b.value) + \" is \" + def.operation);\n }\n });\n // all top level fields mut be unique. doesn't drill down fragments tho. maybe someday\n (_a = def.selectionSet.selections) === null || _a === void 0 ? void 0 : _a.filter(function (s) { return s.kind === 'Field'; }).forEach(function (sel) {\n otherOpDefs.forEach(function (_def) { var _a; return (_a = _def.selectionSet.selections) === null || _a === void 0 ? void 0 : _a.filter(function (s) { return s.kind === 'Field'; }).forEach(function (_sel) {\n var _a, _b, _c, _d;\n if ((((_a = sel.alias) === null || _a === void 0 ? void 0 : _a.value) || sel.name.value) === (((_b = _sel.alias) === null || _b === void 0 ? void 0 : _b.value) || _sel.name.value)) {\n throw new CombinedQueryError(\"duplicate field definition \" + _sel.name.value + \" for operations \" + ((_c = def.name) === null || _c === void 0 ? void 0 : _c.value) + \" and \" + ((_d = _def.name) === null || _d === void 0 ? void 0 : _d.value));\n }\n }); });\n });\n // finally all variables must be unique\n (_b = def.variableDefinitions) === null || _b === void 0 ? void 0 : _b.forEach(function (variable) {\n otherOpDefs.forEach(function (_def) { var _a; return (_a = _def.variableDefinitions) === null || _a === void 0 ? void 0 : _a.forEach(function (_variable) {\n var _a, _b;\n if (variable.variable.name.value === _variable.variable.name.value) {\n throw new CombinedQueryError(\"duplicate variable definition \" + _variable.variable.name.value + \" for operations \" + ((_a = def.name) === null || _a === void 0 ? void 0 : _a.value) + \" and \" + ((_b = _def.name) === null || _b === void 0 ? void 0 : _b.value));\n }\n }); });\n });\n });\n var newVars = (function () {\n if (_this.variables && variables) {\n return __assign(__assign({}, _this.variables), variables);\n }\n return (variables || _this.variables);\n })();\n var definitions = [{\n kind: 'OperationDefinition',\n directives: opDefs.flatMap(function (def) { return def.directives || []; }),\n name: { kind: 'Name', value: this.operationName },\n operation: opDefs[0].operation,\n selectionSet: {\n kind: 'SelectionSet',\n selections: opDefs.flatMap(function (def) { return def.selectionSet.selections; })\n },\n variableDefinitions: opDefs.flatMap(function (def) { return def.variableDefinitions || []; })\n }];\n var encounteredFragmentList = new Set();\n var combinedDocumentDefinitions = this.document.definitions.concat(document.definitions);\n for (var _i = 0, combinedDocumentDefinitions_1 = combinedDocumentDefinitions; _i < combinedDocumentDefinitions_1.length; _i++) {\n var definition = combinedDocumentDefinitions_1[_i];\n if (definition.kind === 'OperationDefinition') {\n continue;\n }\n if (definition.kind === 'FragmentDefinition') {\n if (encounteredFragmentList.has(definition.name.value)) {\n continue;\n }\n encounteredFragmentList.add(definition.name.value);\n }\n definitions = __spreadArrays([definition], definitions);\n }\n var newDoc = {\n kind: 'Document',\n definitions: definitions\n };\n return new CombinedQueryBuilderImpl(this.operationName, newDoc, newVars);\n };\n CombinedQueryBuilderImpl.prototype.addN = function (document, variables, variableRenameFn, fieldRenameFn) {\n if (variableRenameFn === void 0) { variableRenameFn = utils_1.defaultRenameFn; }\n if (fieldRenameFn === void 0) { fieldRenameFn = utils_1.defaultRenameFn; }\n if (!variables.length) {\n return this;\n }\n return variables.reduce(function (builder, _variables, idx) {\n var doc = utils_1.renameVariablesAndTopLevelFields(document, function (name) { return variableRenameFn(name, idx); }, function (name) { return fieldRenameFn(name, idx); });\n var vars = utils_1.renameVariables(_variables, function (name) { return variableRenameFn(name, idx); });\n return builder.add(doc, vars);\n }, this);\n };\n return CombinedQueryBuilderImpl;\n}());\nfunction combinedQuery(operationName) {\n return {\n operationName: operationName,\n add: function (document, variables) {\n return new CombinedQueryBuilderImpl(this.operationName, document, variables);\n },\n addN: function (document, variables, variableRenameFn, fieldRenameFn) {\n return new CombinedQueryBuilderImpl(this.operationName, emptyDoc).addN(document, variables, variableRenameFn, fieldRenameFn);\n }\n };\n}\nexports.default = combinedQuery;\n//# sourceMappingURL=index.js.map","// Save global object in a variable\nvar __global__ =\n(typeof globalThis !== 'undefined' && globalThis) ||\n(typeof self !== 'undefined' && self) ||\n(typeof global !== 'undefined' && global);\n// Create an object that extends from __global__ without the fetch function\nvar __globalThis__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = __global__.DOMException\n}\nF.prototype = __global__; // Needed for feature detection on whatwg-fetch's code\nreturn new F();\n})();\n// Wraps whatwg-fetch with a function scope to hijack the global object\n// \"globalThis\" that's going to be patched\n(function(globalThis) {\n\nvar irrelevant = (function (exports) {\n\n /* eslint-disable no-prototype-builtins */\n var g =\n (typeof globalThis !== 'undefined' && globalThis) ||\n (typeof self !== 'undefined' && self) ||\n // eslint-disable-next-line no-undef\n (typeof global !== 'undefined' && global) ||\n {};\n\n var support = {\n searchParams: 'URLSearchParams' in g,\n iterable: 'Symbol' in g && 'iterator' in Symbol,\n blob:\n 'FileReader' in g &&\n 'Blob' in g &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in g,\n arrayBuffer: 'ArrayBuffer' in g\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {\n throw new TypeError('Invalid character in header field name: \"' + name + '\"')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n if (header.length != 2) {\n throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)\n }\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body._noBody) return\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);\n var encoding = match ? match[1] : 'utf-8';\n reader.readAsText(blob, encoding);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n /*\n fetch-mock wraps the Response object in an ES6 Proxy to\n provide useful test harness features such as flush. However, on\n ES5 browsers without fetch or Proxy support pollyfills must be used;\n the proxy-pollyfill is unable to proxy an attribute unless it exists\n on the object before the Proxy is created. This change ensures\n Response.bodyUsed exists on the instance, while maintaining the\n semantic of setting Request.bodyUsed in the constructor before\n _initBody is called.\n */\n // eslint-disable-next-line no-self-assign\n this.bodyUsed = this.bodyUsed;\n this._bodyInit = body;\n if (!body) {\n this._noBody = true;\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n var isConsumed = consumed(this);\n if (isConsumed) {\n return isConsumed\n } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {\n return Promise.resolve(\n this._bodyArrayBuffer.buffer.slice(\n this._bodyArrayBuffer.byteOffset,\n this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength\n )\n )\n } else {\n return Promise.resolve(this._bodyArrayBuffer)\n }\n } else if (support.blob) {\n return this.blob().then(readBlobAsArrayBuffer)\n } else {\n throw new Error('could not read as ArrayBuffer')\n }\n };\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n if (!(this instanceof Request)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal || (function () {\n if ('AbortController' in g) {\n var ctrl = new AbortController();\n return ctrl.signal;\n }\n }());\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n\n if (this.method === 'GET' || this.method === 'HEAD') {\n if (options.cache === 'no-store' || options.cache === 'no-cache') {\n // Search for a '_' parameter in the query string\n var reParamSearch = /([?&])_=[^&]*/;\n if (reParamSearch.test(this.url)) {\n // If it already exists then set the value with the current time\n this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());\n } else {\n // Otherwise add a new '_' parameter to the end with the current time\n var reQueryString = /\\?/;\n this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();\n }\n }\n }\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill\n // https://github.com/github/fetch/issues/748\n // https://github.com/zloirock/core-js/issues/751\n preProcessedHeaders\n .split('\\r')\n .map(function(header) {\n return header.indexOf('\\n') === 0 ? header.substr(1, header.length) : header\n })\n .forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n try {\n headers.append(key, value);\n } catch (error) {\n console.warn('Response ' + error.message);\n }\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!(this instanceof Response)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n if (this.status < 200 || this.status > 599) {\n throw new RangeError(\"Failed to construct 'Response': The status provided (0) is outside the range [200, 599].\")\n }\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = options.statusText === undefined ? '' : '' + options.statusText;\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 200, statusText: ''});\n response.ok = false;\n response.status = 0;\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = g.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n // This check if specifically for when a user fetches a file locally from the file system\n // Only if the status is out of a normal range\n if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) {\n options.status = 200;\n } else {\n options.status = xhr.status;\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n setTimeout(function() {\n resolve(new Response(body, options));\n }, 0);\n };\n\n xhr.onerror = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'));\n }, 0);\n };\n\n xhr.ontimeout = function() {\n setTimeout(function() {\n reject(new TypeError('Network request timed out'));\n }, 0);\n };\n\n xhr.onabort = function() {\n setTimeout(function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n }, 0);\n };\n\n function fixUrl(url) {\n try {\n return url === '' && g.location.href ? g.location.href : url\n } catch (e) {\n return url\n }\n }\n\n xhr.open(request.method, fixUrl(request.url), true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr) {\n if (support.blob) {\n xhr.responseType = 'blob';\n } else if (\n support.arrayBuffer\n ) {\n xhr.responseType = 'arraybuffer';\n }\n }\n\n if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {\n var names = [];\n Object.getOwnPropertyNames(init.headers).forEach(function(name) {\n names.push(normalizeName(name));\n xhr.setRequestHeader(name, normalizeValue(init.headers[name]));\n });\n request.headers.forEach(function(value, name) {\n if (names.indexOf(name) === -1) {\n xhr.setRequestHeader(name, value);\n }\n });\n } else {\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n }\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!g.fetch) {\n g.fetch = fetch;\n g.Headers = Headers;\n g.Request = Request;\n g.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(__globalThis__);\n// This is a ponyfill, so...\n__globalThis__.fetch.ponyfill = true;\ndelete __globalThis__.fetch.polyfill;\n// Choose between native implementation (__global__) or custom implementation (__globalThis__)\nvar ctx = __global__.fetch ? __global__ : __globalThis__;\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","'use strict';\n\nmodule.exports = function ReactNativeFile(_ref) {\n var uri = _ref.uri,\n name = _ref.name,\n type = _ref.type;\n this.uri = uri;\n this.name = name;\n this.type = type;\n};\n","'use strict';\n\nvar ReactNativeFile = require('./ReactNativeFile');\n\nmodule.exports = function isExtractableFile(value) {\n return (\n (typeof File !== 'undefined' && value instanceof File) ||\n (typeof Blob !== 'undefined' && value instanceof Blob) ||\n value instanceof ReactNativeFile\n );\n};\n","'use strict';\n\nvar defaultIsExtractableFile = require('./isExtractableFile');\n\nmodule.exports = function extractFiles(value, path, isExtractableFile) {\n if (path === void 0) {\n path = '';\n }\n\n if (isExtractableFile === void 0) {\n isExtractableFile = defaultIsExtractableFile;\n }\n\n var clone;\n var files = new Map();\n\n function addFile(paths, file) {\n var storedPaths = files.get(file);\n if (storedPaths) storedPaths.push.apply(storedPaths, paths);\n else files.set(file, paths);\n }\n\n if (isExtractableFile(value)) {\n clone = null;\n addFile([path], value);\n } else {\n var prefix = path ? path + '.' : '';\n if (typeof FileList !== 'undefined' && value instanceof FileList)\n clone = Array.prototype.map.call(value, function (file, i) {\n addFile(['' + prefix + i], file);\n return null;\n });\n else if (Array.isArray(value))\n clone = value.map(function (child, i) {\n var result = extractFiles(child, '' + prefix + i, isExtractableFile);\n result.files.forEach(addFile);\n return result.clone;\n });\n else if (value && value.constructor === Object) {\n clone = {};\n\n for (var i in value) {\n var result = extractFiles(value[i], '' + prefix + i, isExtractableFile);\n result.files.forEach(addFile);\n clone[i] = result.clone;\n }\n } else clone = value;\n }\n\n return {\n clone: clone,\n files: files,\n };\n};\n","'use strict';\n\nexports.ReactNativeFile = require('./ReactNativeFile');\nexports.extractFiles = require('./extractFiles');\nexports.isExtractableFile = require('./isExtractableFile');\n","'use strict';\n\n/* eslint-env browser */\nmodule.exports = typeof self === 'object' ? self.FormData : window.FormData;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar extract_files_1 = require(\"extract-files\");\nvar form_data_1 = __importDefault(require(\"form-data\"));\n/**\n * Duck type if NodeJS stream\n * https://github.com/sindresorhus/is-stream/blob/3750505b0727f6df54324784fe369365ef78841e/index.js#L3\n */\nvar isExtractableFileEnhanced = function (value) {\n return extract_files_1.isExtractableFile(value) ||\n (value !== null && typeof value === 'object' && typeof value.pipe === 'function');\n};\n/**\n * Returns Multipart Form if body contains files\n * (https://github.com/jaydenseric/graphql-multipart-request-spec)\n * Otherwise returns JSON\n */\nfunction createRequestBody(query, variables, operationName) {\n var _a = extract_files_1.extractFiles({ query: query, variables: variables, operationName: operationName }, '', isExtractableFileEnhanced), clone = _a.clone, files = _a.files;\n if (files.size === 0) {\n if (!Array.isArray(query)) {\n return JSON.stringify(clone);\n }\n if (typeof variables !== 'undefined' && !Array.isArray(variables)) {\n throw new Error('Cannot create request body with given variable type, array expected');\n }\n // Batch support\n var payload = query.reduce(function (accu, currentQuery, index) {\n accu.push({ query: currentQuery, variables: variables ? variables[index] : undefined });\n return accu;\n }, []);\n return JSON.stringify(payload);\n }\n var Form = typeof FormData === 'undefined' ? form_data_1.default : FormData;\n var form = new Form();\n form.append('operations', JSON.stringify(clone));\n var map = {};\n var i = 0;\n files.forEach(function (paths) {\n map[++i] = paths;\n });\n form.append('map', JSON.stringify(map));\n i = 0;\n files.forEach(function (paths, file) {\n form.append(\"\" + ++i, file);\n });\n return form;\n}\nexports.default = createRequestBody;\n//# sourceMappingURL=createRequestBody.js.map","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ClientError = void 0;\nvar ClientError = /** @class */ (function (_super) {\n __extends(ClientError, _super);\n function ClientError(response, request) {\n var _this = this;\n var message = ClientError.extractMessage(response) + \": \" + JSON.stringify({\n response: response,\n request: request,\n });\n _this = _super.call(this, message) || this;\n Object.setPrototypeOf(_this, ClientError.prototype);\n _this.response = response;\n _this.request = request;\n // this is needed as Safari doesn't support .captureStackTrace\n if (typeof Error.captureStackTrace === 'function') {\n Error.captureStackTrace(_this, ClientError);\n }\n return _this;\n }\n ClientError.extractMessage = function (response) {\n try {\n return response.errors[0].message;\n }\n catch (e) {\n return \"GraphQL Error (Code: \" + response.status + \")\";\n }\n };\n return ClientError;\n}(Error));\nexports.ClientError = ClientError;\n//# sourceMappingURL=types.js.map","\"use strict\";\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.gql = exports.batchRequests = exports.request = exports.rawRequest = exports.GraphQLClient = exports.ClientError = void 0;\nvar cross_fetch_1 = __importStar(require(\"cross-fetch\")), CrossFetch = cross_fetch_1;\nvar printer_1 = require(\"graphql/language/printer\");\nvar createRequestBody_1 = __importDefault(require(\"./createRequestBody\"));\nvar types_1 = require(\"./types\");\nObject.defineProperty(exports, \"ClientError\", { enumerable: true, get: function () { return types_1.ClientError; } });\n/**\n * Convert the given headers configuration into a plain object.\n */\nvar resolveHeaders = function (headers) {\n var oHeaders = {};\n if (headers) {\n if ((typeof Headers !== 'undefined' && headers instanceof Headers) ||\n headers instanceof CrossFetch.Headers) {\n oHeaders = HeadersInstanceToPlainObject(headers);\n }\n else if (Array.isArray(headers)) {\n headers.forEach(function (_a) {\n var name = _a[0], value = _a[1];\n oHeaders[name] = value;\n });\n }\n else {\n oHeaders = headers;\n }\n }\n return oHeaders;\n};\n/**\n * Clean a GraphQL document to send it via a GET query\n *\n * @param {string} str GraphQL query\n * @returns {string} Cleaned query\n */\nvar queryCleanner = function (str) { return str.replace(/([\\s,]|#[^\\n\\r]+)+/g, ' ').trim(); };\n/**\n * Create query string for GraphQL request\n *\n * @param {object} param0 -\n *\n * @param {string|string[]} param0.query the GraphQL document or array of document if it's a batch request\n * @param {string|undefined} param0.operationName the GraphQL operation name\n * @param {any|any[]} param0.variables the GraphQL variables to use\n */\nvar buildGetQueryParams = function (_a) {\n var query = _a.query, variables = _a.variables, operationName = _a.operationName;\n if (!Array.isArray(query)) {\n var search = [\"query=\" + encodeURIComponent(queryCleanner(query))];\n if (variables) {\n search.push(\"variables=\" + encodeURIComponent(JSON.stringify(variables)));\n }\n if (operationName) {\n search.push(\"operationName=\" + encodeURIComponent(operationName));\n }\n return search.join('&');\n }\n if (typeof variables !== 'undefined' && !Array.isArray(variables)) {\n throw new Error('Cannot create query with given variable type, array expected');\n }\n // Batch support\n var payload = query.reduce(function (accu, currentQuery, index) {\n accu.push({\n query: queryCleanner(currentQuery),\n variables: variables ? JSON.stringify(variables[index]) : undefined,\n });\n return accu;\n }, []);\n return \"query=\" + encodeURIComponent(JSON.stringify(payload));\n};\n/**\n * Fetch data using POST method\n */\nvar post = function (_a) {\n var url = _a.url, query = _a.query, variables = _a.variables, operationName = _a.operationName, headers = _a.headers, fetch = _a.fetch, fetchOptions = _a.fetchOptions;\n return __awaiter(void 0, void 0, void 0, function () {\n var body;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n body = createRequestBody_1.default(query, variables, operationName);\n return [4 /*yield*/, fetch(url, __assign({ method: 'POST', headers: __assign(__assign({}, (typeof body === 'string' ? { 'Content-Type': 'application/json' } : {})), headers), body: body }, fetchOptions))];\n case 1: return [2 /*return*/, _b.sent()];\n }\n });\n });\n};\n/**\n * Fetch data using GET method\n */\nvar get = function (_a) {\n var url = _a.url, query = _a.query, variables = _a.variables, operationName = _a.operationName, headers = _a.headers, fetch = _a.fetch, fetchOptions = _a.fetchOptions;\n return __awaiter(void 0, void 0, void 0, function () {\n var queryParams;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0:\n queryParams = buildGetQueryParams({\n query: query,\n variables: variables,\n operationName: operationName,\n });\n return [4 /*yield*/, fetch(url + \"?\" + queryParams, __assign({ method: 'GET', headers: headers }, fetchOptions))];\n case 1: return [2 /*return*/, _b.sent()];\n }\n });\n });\n};\n/**\n * todo\n */\nvar GraphQLClient = /** @class */ (function () {\n function GraphQLClient(url, options) {\n this.url = url;\n this.options = options || {};\n }\n GraphQLClient.prototype.rawRequest = function (query, variables, requestHeaders) {\n var _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, [\"headers\", \"fetch\", \"method\"]);\n var url = this.url;\n return makeRequest({\n url: url,\n query: query,\n variables: variables,\n headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(requestHeaders)),\n operationName: undefined,\n fetch: fetch,\n method: method,\n fetchOptions: fetchOptions,\n });\n };\n /**\n * Send a GraphQL document to the server.\n */\n GraphQLClient.prototype.request = function (document, variables, requestHeaders) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, headers, _b, fetch, _c, method, fetchOptions, url, _d, query, operationName, data;\n return __generator(this, function (_e) {\n switch (_e.label) {\n case 0:\n _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, [\"headers\", \"fetch\", \"method\"]);\n url = this.url;\n _d = resolveRequestDocument(document), query = _d.query, operationName = _d.operationName;\n return [4 /*yield*/, makeRequest({\n url: url,\n query: query,\n variables: variables,\n headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(requestHeaders)),\n operationName: operationName,\n fetch: fetch,\n method: method,\n fetchOptions: fetchOptions,\n })];\n case 1:\n data = (_e.sent()).data;\n return [2 /*return*/, data];\n }\n });\n });\n };\n /**\n * Send a GraphQL document to the server.\n */\n GraphQLClient.prototype.batchRequests = function (documents, requestHeaders) {\n return __awaiter(this, void 0, void 0, function () {\n var _a, headers, _b, fetch, _c, method, fetchOptions, url, queries, variables, data;\n return __generator(this, function (_d) {\n switch (_d.label) {\n case 0:\n _a = this.options, headers = _a.headers, _b = _a.fetch, fetch = _b === void 0 ? cross_fetch_1.default : _b, _c = _a.method, method = _c === void 0 ? 'POST' : _c, fetchOptions = __rest(_a, [\"headers\", \"fetch\", \"method\"]);\n url = this.url;\n queries = documents.map(function (_a) {\n var document = _a.document;\n return resolveRequestDocument(document).query;\n });\n variables = documents.map(function (_a) {\n var variables = _a.variables;\n return variables;\n });\n return [4 /*yield*/, makeRequest({\n url: url,\n query: queries,\n variables: variables,\n headers: __assign(__assign({}, resolveHeaders(headers)), resolveHeaders(requestHeaders)),\n operationName: undefined,\n fetch: fetch,\n method: method,\n fetchOptions: fetchOptions,\n })];\n case 1:\n data = (_d.sent()).data;\n return [2 /*return*/, data];\n }\n });\n });\n };\n GraphQLClient.prototype.setHeaders = function (headers) {\n this.options.headers = headers;\n return this;\n };\n /**\n * Attach a header to the client. All subsequent requests will have this header.\n */\n GraphQLClient.prototype.setHeader = function (key, value) {\n var _a;\n var headers = this.options.headers;\n if (headers) {\n // todo what if headers is in nested array form... ?\n //@ts-ignore\n headers[key] = value;\n }\n else {\n this.options.headers = (_a = {}, _a[key] = value, _a);\n }\n return this;\n };\n /**\n * Change the client endpoint. All subsequent requests will send to this endpoint.\n */\n GraphQLClient.prototype.setEndpoint = function (value) {\n this.url = value;\n return this;\n };\n return GraphQLClient;\n}());\nexports.GraphQLClient = GraphQLClient;\nfunction makeRequest(_a) {\n var url = _a.url, query = _a.query, variables = _a.variables, headers = _a.headers, operationName = _a.operationName, fetch = _a.fetch, _b = _a.method, method = _b === void 0 ? 'POST' : _b, fetchOptions = _a.fetchOptions;\n return __awaiter(this, void 0, void 0, function () {\n var fetcher, isBathchingQuery, response, result, successfullyReceivedData, headers_1, status_1, errorResult;\n return __generator(this, function (_c) {\n switch (_c.label) {\n case 0:\n fetcher = method.toUpperCase() === 'POST' ? post : get;\n isBathchingQuery = Array.isArray(query);\n return [4 /*yield*/, fetcher({\n url: url,\n query: query,\n variables: variables,\n operationName: operationName,\n headers: headers,\n fetch: fetch,\n fetchOptions: fetchOptions,\n })];\n case 1:\n response = _c.sent();\n return [4 /*yield*/, getResult(response)];\n case 2:\n result = _c.sent();\n successfullyReceivedData = isBathchingQuery && Array.isArray(result) ? !result.some(function (_a) {\n var data = _a.data;\n return !data;\n }) : !!result.data;\n if (response.ok && !result.errors && successfullyReceivedData) {\n headers_1 = response.headers, status_1 = response.status;\n return [2 /*return*/, __assign(__assign({}, (isBathchingQuery ? { data: result } : result)), { headers: headers_1, status: status_1 })];\n }\n else {\n errorResult = typeof result === 'string' ? { error: result } : result;\n throw new types_1.ClientError(__assign(__assign({}, errorResult), { status: response.status, headers: response.headers }), { query: query, variables: variables });\n }\n return [2 /*return*/];\n }\n });\n });\n}\n/**\n * todo\n */\nfunction rawRequest(url, query, variables, requestHeaders) {\n return __awaiter(this, void 0, void 0, function () {\n var client;\n return __generator(this, function (_a) {\n client = new GraphQLClient(url);\n return [2 /*return*/, client.rawRequest(query, variables, requestHeaders)];\n });\n });\n}\nexports.rawRequest = rawRequest;\n/**\n * Send a GraphQL Document to the GraphQL server for exectuion.\n *\n * @example\n *\n * ```ts\n * // You can pass a raw string\n *\n * await request('https://foo.bar/graphql', `\n * {\n * query {\n * users\n * }\n * }\n * `)\n *\n * // You can also pass a GraphQL DocumentNode. Convenient if you\n * // are using graphql-tag package.\n *\n * import gql from 'graphql-tag'\n *\n * await request('https://foo.bar/graphql', gql`...`)\n *\n * // If you don't actually care about using DocumentNode but just\n * // want the tooling support for gql template tag like IDE syntax\n * // coloring and prettier autoformat then note you can use the\n * // passthrough gql tag shipped with graphql-request to save a bit\n * // of performance and not have to install another dep into your project.\n *\n * import { gql } from 'graphql-request'\n *\n * await request('https://foo.bar/graphql', gql`...`)\n * ```\n */\nfunction request(url, document, variables, requestHeaders) {\n return __awaiter(this, void 0, void 0, function () {\n var client;\n return __generator(this, function (_a) {\n client = new GraphQLClient(url);\n return [2 /*return*/, client.request(document, variables, requestHeaders)];\n });\n });\n}\nexports.request = request;\n/**\n * Send a batch of GraphQL Document to the GraphQL server for exectuion.\n *\n * @example\n *\n * ```ts\n * // You can pass a raw string\n *\n * await batchRequests('https://foo.bar/graphql', [\n * {\n * query: `\n * {\n * query {\n * users\n * }\n * }`\n * },\n * {\n * query: `\n * {\n * query {\n * users\n * }\n * }`\n * }])\n *\n * // You can also pass a GraphQL DocumentNode as query. Convenient if you\n * // are using graphql-tag package.\n *\n * import gql from 'graphql-tag'\n *\n * await batchRequests('https://foo.bar/graphql', [{ query: gql`...` }])\n * ```\n */\nfunction batchRequests(url, documents, requestHeaders) {\n return __awaiter(this, void 0, void 0, function () {\n var client;\n return __generator(this, function (_a) {\n client = new GraphQLClient(url);\n return [2 /*return*/, client.batchRequests(documents, requestHeaders)];\n });\n });\n}\nexports.batchRequests = batchRequests;\nexports.default = request;\n/**\n * todo\n */\nfunction getResult(response) {\n var contentType = response.headers.get('Content-Type');\n if (contentType && contentType.startsWith('application/json')) {\n return response.json();\n }\n else {\n return response.text();\n }\n}\n/**\n * helpers\n */\nfunction resolveRequestDocument(document) {\n var _a;\n if (typeof document === 'string')\n return { query: document };\n var operationName = undefined;\n var operationDefinitions = document.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; });\n if (operationDefinitions.length === 1) {\n operationName = (_a = operationDefinitions[0].name) === null || _a === void 0 ? void 0 : _a.value;\n }\n return { query: printer_1.print(document), operationName: operationName };\n}\n/**\n * Convenience passthrough template tag to get the benefits of tooling for the gql template tag. This does not actually parse the input into a GraphQL DocumentNode like graphql-tag package does. It just returns the string with any variables given interpolated. Can save you a bit of performance and having to install another package.\n *\n * @example\n *\n * import { gql } from 'graphql-request'\n *\n * await request('https://foo.bar/graphql', gql`...`)\n *\n * @remarks\n *\n * Several tools in the Node GraphQL ecosystem are hardcoded to specially treat any template tag named \"gql\". For example see this prettier issue: https://github.com/prettier/prettier/issues/4360. Using this template tag has no runtime effect beyond variable interpolation.\n */\nfunction gql(chunks) {\n var variables = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n variables[_i - 1] = arguments[_i];\n }\n return chunks.reduce(function (accumulator, chunk, index) { return \"\" + accumulator + chunk + (index in variables ? variables[index] : ''); }, '');\n}\nexports.gql = gql;\n/**\n * Convert Headers instance into regular object\n */\nfunction HeadersInstanceToPlainObject(headers) {\n var o = {};\n headers.forEach(function (v, k) {\n o[k] = v;\n });\n return o;\n}\n//# sourceMappingURL=index.js.map","import { urlAlphabet } from './url-alphabet/index.js'\nlet random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\nlet customRandom = (alphabet, defaultSize, getRandom) => {\n let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) => {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step | 0\n while (j--) {\n id += alphabet[bytes[j] & mask] || ''\n if (id.length === size) return id\n }\n }\n }\n}\nlet customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size, random)\nlet nanoid = (size = 21) =>\n crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {\n byte &= 63\n if (byte < 36) {\n id += byte.toString(36)\n } else if (byte < 62) {\n id += (byte - 26).toString(36).toUpperCase()\n } else if (byte > 62) {\n id += '-'\n } else {\n id += '_'\n }\n return id\n }, '')\nexport { nanoid, customAlphabet, customRandom, urlAlphabet, random }\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function isFunction(x) {\n return typeof x === 'function';\n}\n//# sourceMappingURL=isFunction.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar _enable_super_gross_mode_that_will_cause_bad_things = false;\nexport var config = {\n Promise: undefined,\n set useDeprecatedSynchronousErrorHandling(value) {\n if (value) {\n var error = /*@__PURE__*/ new Error();\n /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \\n' + error.stack);\n }\n else if (_enable_super_gross_mode_that_will_cause_bad_things) {\n /*@__PURE__*/ console.log('RxJS: Back to a better error behavior. Thank you. <3');\n }\n _enable_super_gross_mode_that_will_cause_bad_things = value;\n },\n get useDeprecatedSynchronousErrorHandling() {\n return _enable_super_gross_mode_that_will_cause_bad_things;\n },\n};\n//# sourceMappingURL=config.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function hostReportError(err) {\n setTimeout(function () { throw err; }, 0);\n}\n//# sourceMappingURL=hostReportError.js.map\n","/** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */\nimport { config } from './config';\nimport { hostReportError } from './util/hostReportError';\nexport var empty = {\n closed: true,\n next: function (value) { },\n error: function (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n throw err;\n }\n else {\n hostReportError(err);\n }\n },\n complete: function () { }\n};\n//# sourceMappingURL=Observer.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport var isArray = /*@__PURE__*/ (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();\n//# sourceMappingURL=isArray.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function isObject(x) {\n return x !== null && typeof x === 'object';\n}\n//# sourceMappingURL=isObject.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar UnsubscriptionErrorImpl = /*@__PURE__*/ (function () {\n function UnsubscriptionErrorImpl(errors) {\n Error.call(this);\n this.message = errors ?\n errors.length + \" errors occurred during unsubscription:\\n\" + errors.map(function (err, i) { return i + 1 + \") \" + err.toString(); }).join('\\n ') : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n return this;\n }\n UnsubscriptionErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);\n return UnsubscriptionErrorImpl;\n})();\nexport var UnsubscriptionError = UnsubscriptionErrorImpl;\n//# sourceMappingURL=UnsubscriptionError.js.map\n","/** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_UnsubscriptionError PURE_IMPORTS_END */\nimport { isArray } from './util/isArray';\nimport { isObject } from './util/isObject';\nimport { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nvar Subscription = /*@__PURE__*/ (function () {\n function Subscription(unsubscribe) {\n this.closed = false;\n this._parentOrParents = null;\n this._subscriptions = null;\n if (unsubscribe) {\n this._ctorUnsubscribe = true;\n this._unsubscribe = unsubscribe;\n }\n }\n Subscription.prototype.unsubscribe = function () {\n var errors;\n if (this.closed) {\n return;\n }\n var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;\n this.closed = true;\n this._parentOrParents = null;\n this._subscriptions = null;\n if (_parentOrParents instanceof Subscription) {\n _parentOrParents.remove(this);\n }\n else if (_parentOrParents !== null) {\n for (var index = 0; index < _parentOrParents.length; ++index) {\n var parent_1 = _parentOrParents[index];\n parent_1.remove(this);\n }\n }\n if (isFunction(_unsubscribe)) {\n if (_ctorUnsubscribe) {\n this._unsubscribe = undefined;\n }\n try {\n _unsubscribe.call(this);\n }\n catch (e) {\n errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];\n }\n }\n if (isArray(_subscriptions)) {\n var index = -1;\n var len = _subscriptions.length;\n while (++index < len) {\n var sub = _subscriptions[index];\n if (isObject(sub)) {\n try {\n sub.unsubscribe();\n }\n catch (e) {\n errors = errors || [];\n if (e instanceof UnsubscriptionError) {\n errors = errors.concat(flattenUnsubscriptionErrors(e.errors));\n }\n else {\n errors.push(e);\n }\n }\n }\n }\n }\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n };\n Subscription.prototype.add = function (teardown) {\n var subscription = teardown;\n if (!teardown) {\n return Subscription.EMPTY;\n }\n switch (typeof teardown) {\n case 'function':\n subscription = new Subscription(teardown);\n case 'object':\n if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {\n return subscription;\n }\n else if (this.closed) {\n subscription.unsubscribe();\n return subscription;\n }\n else if (!(subscription instanceof Subscription)) {\n var tmp = subscription;\n subscription = new Subscription();\n subscription._subscriptions = [tmp];\n }\n break;\n default: {\n throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');\n }\n }\n var _parentOrParents = subscription._parentOrParents;\n if (_parentOrParents === null) {\n subscription._parentOrParents = this;\n }\n else if (_parentOrParents instanceof Subscription) {\n if (_parentOrParents === this) {\n return subscription;\n }\n subscription._parentOrParents = [_parentOrParents, this];\n }\n else if (_parentOrParents.indexOf(this) === -1) {\n _parentOrParents.push(this);\n }\n else {\n return subscription;\n }\n var subscriptions = this._subscriptions;\n if (subscriptions === null) {\n this._subscriptions = [subscription];\n }\n else {\n subscriptions.push(subscription);\n }\n return subscription;\n };\n Subscription.prototype.remove = function (subscription) {\n var subscriptions = this._subscriptions;\n if (subscriptions) {\n var subscriptionIndex = subscriptions.indexOf(subscription);\n if (subscriptionIndex !== -1) {\n subscriptions.splice(subscriptionIndex, 1);\n }\n }\n };\n Subscription.EMPTY = (function (empty) {\n empty.closed = true;\n return empty;\n }(new Subscription()));\n return Subscription;\n}());\nexport { Subscription };\nfunction flattenUnsubscriptionErrors(errors) {\n return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);\n}\n//# sourceMappingURL=Subscription.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport var rxSubscriber = /*@__PURE__*/ (function () {\n return typeof Symbol === 'function'\n ? /*@__PURE__*/ Symbol('rxSubscriber')\n : '@@rxSubscriber_' + /*@__PURE__*/ Math.random();\n})();\nexport var $$rxSubscriber = rxSubscriber;\n//# sourceMappingURL=rxSubscriber.js.map\n","/** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { isFunction } from './util/isFunction';\nimport { empty as emptyObserver } from './Observer';\nimport { Subscription } from './Subscription';\nimport { rxSubscriber as rxSubscriberSymbol } from '../internal/symbol/rxSubscriber';\nimport { config } from './config';\nimport { hostReportError } from './util/hostReportError';\nvar Subscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(Subscriber, _super);\n function Subscriber(destinationOrNext, error, complete) {\n var _this = _super.call(this) || this;\n _this.syncErrorValue = null;\n _this.syncErrorThrown = false;\n _this.syncErrorThrowable = false;\n _this.isStopped = false;\n switch (arguments.length) {\n case 0:\n _this.destination = emptyObserver;\n break;\n case 1:\n if (!destinationOrNext) {\n _this.destination = emptyObserver;\n break;\n }\n if (typeof destinationOrNext === 'object') {\n if (destinationOrNext instanceof Subscriber) {\n _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;\n _this.destination = destinationOrNext;\n destinationOrNext.add(_this);\n }\n else {\n _this.syncErrorThrowable = true;\n _this.destination = new SafeSubscriber(_this, destinationOrNext);\n }\n break;\n }\n default:\n _this.syncErrorThrowable = true;\n _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);\n break;\n }\n return _this;\n }\n Subscriber.prototype[rxSubscriberSymbol] = function () { return this; };\n Subscriber.create = function (next, error, complete) {\n var subscriber = new Subscriber(next, error, complete);\n subscriber.syncErrorThrowable = false;\n return subscriber;\n };\n Subscriber.prototype.next = function (value) {\n if (!this.isStopped) {\n this._next(value);\n }\n };\n Subscriber.prototype.error = function (err) {\n if (!this.isStopped) {\n this.isStopped = true;\n this._error(err);\n }\n };\n Subscriber.prototype.complete = function () {\n if (!this.isStopped) {\n this.isStopped = true;\n this._complete();\n }\n };\n Subscriber.prototype.unsubscribe = function () {\n if (this.closed) {\n return;\n }\n this.isStopped = true;\n _super.prototype.unsubscribe.call(this);\n };\n Subscriber.prototype._next = function (value) {\n this.destination.next(value);\n };\n Subscriber.prototype._error = function (err) {\n this.destination.error(err);\n this.unsubscribe();\n };\n Subscriber.prototype._complete = function () {\n this.destination.complete();\n this.unsubscribe();\n };\n Subscriber.prototype._unsubscribeAndRecycle = function () {\n var _parentOrParents = this._parentOrParents;\n this._parentOrParents = null;\n this.unsubscribe();\n this.closed = false;\n this.isStopped = false;\n this._parentOrParents = _parentOrParents;\n return this;\n };\n return Subscriber;\n}(Subscription));\nexport { Subscriber };\nvar SafeSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(SafeSubscriber, _super);\n function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {\n var _this = _super.call(this) || this;\n _this._parentSubscriber = _parentSubscriber;\n var next;\n var context = _this;\n if (isFunction(observerOrNext)) {\n next = observerOrNext;\n }\n else if (observerOrNext) {\n next = observerOrNext.next;\n error = observerOrNext.error;\n complete = observerOrNext.complete;\n if (observerOrNext !== emptyObserver) {\n context = Object.create(observerOrNext);\n if (isFunction(context.unsubscribe)) {\n _this.add(context.unsubscribe.bind(context));\n }\n context.unsubscribe = _this.unsubscribe.bind(_this);\n }\n }\n _this._context = context;\n _this._next = next;\n _this._error = error;\n _this._complete = complete;\n return _this;\n }\n SafeSubscriber.prototype.next = function (value) {\n if (!this.isStopped && this._next) {\n var _parentSubscriber = this._parentSubscriber;\n if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(this._next, value);\n }\n else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.error = function (err) {\n if (!this.isStopped) {\n var _parentSubscriber = this._parentSubscriber;\n var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;\n if (this._error) {\n if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(this._error, err);\n this.unsubscribe();\n }\n else {\n this.__tryOrSetError(_parentSubscriber, this._error, err);\n this.unsubscribe();\n }\n }\n else if (!_parentSubscriber.syncErrorThrowable) {\n this.unsubscribe();\n if (useDeprecatedSynchronousErrorHandling) {\n throw err;\n }\n hostReportError(err);\n }\n else {\n if (useDeprecatedSynchronousErrorHandling) {\n _parentSubscriber.syncErrorValue = err;\n _parentSubscriber.syncErrorThrown = true;\n }\n else {\n hostReportError(err);\n }\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.complete = function () {\n var _this = this;\n if (!this.isStopped) {\n var _parentSubscriber = this._parentSubscriber;\n if (this._complete) {\n var wrappedComplete = function () { return _this._complete.call(_this._context); };\n if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {\n this.__tryOrUnsub(wrappedComplete);\n this.unsubscribe();\n }\n else {\n this.__tryOrSetError(_parentSubscriber, wrappedComplete);\n this.unsubscribe();\n }\n }\n else {\n this.unsubscribe();\n }\n }\n };\n SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {\n try {\n fn.call(this._context, value);\n }\n catch (err) {\n this.unsubscribe();\n if (config.useDeprecatedSynchronousErrorHandling) {\n throw err;\n }\n else {\n hostReportError(err);\n }\n }\n };\n SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {\n if (!config.useDeprecatedSynchronousErrorHandling) {\n throw new Error('bad call');\n }\n try {\n fn.call(this._context, value);\n }\n catch (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n parent.syncErrorValue = err;\n parent.syncErrorThrown = true;\n return true;\n }\n else {\n hostReportError(err);\n return true;\n }\n }\n return false;\n };\n SafeSubscriber.prototype._unsubscribe = function () {\n var _parentSubscriber = this._parentSubscriber;\n this._context = null;\n this._parentSubscriber = null;\n _parentSubscriber.unsubscribe();\n };\n return SafeSubscriber;\n}(Subscriber));\nexport { SafeSubscriber };\n//# sourceMappingURL=Subscriber.js.map\n","/** PURE_IMPORTS_START _Subscriber PURE_IMPORTS_END */\nimport { Subscriber } from '../Subscriber';\nexport function canReportError(observer) {\n while (observer) {\n var _a = observer, closed_1 = _a.closed, destination = _a.destination, isStopped = _a.isStopped;\n if (closed_1 || isStopped) {\n return false;\n }\n else if (destination && destination instanceof Subscriber) {\n observer = destination;\n }\n else {\n observer = null;\n }\n }\n return true;\n}\n//# sourceMappingURL=canReportError.js.map\n","/** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */\nimport { Subscriber } from '../Subscriber';\nimport { rxSubscriber as rxSubscriberSymbol } from '../symbol/rxSubscriber';\nimport { empty as emptyObserver } from '../Observer';\nexport function toSubscriber(nextOrObserver, error, complete) {\n if (nextOrObserver) {\n if (nextOrObserver instanceof Subscriber) {\n return nextOrObserver;\n }\n if (nextOrObserver[rxSubscriberSymbol]) {\n return nextOrObserver[rxSubscriberSymbol]();\n }\n }\n if (!nextOrObserver && !error && !complete) {\n return new Subscriber(emptyObserver);\n }\n return new Subscriber(nextOrObserver, error, complete);\n}\n//# sourceMappingURL=toSubscriber.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport var observable = /*@__PURE__*/ (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();\n//# sourceMappingURL=observable.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function identity(x) {\n return x;\n}\n//# sourceMappingURL=identity.js.map\n","/** PURE_IMPORTS_START _identity PURE_IMPORTS_END */\nimport { identity } from './identity';\nexport function pipe() {\n var fns = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n fns[_i] = arguments[_i];\n }\n return pipeFromArray(fns);\n}\nexport function pipeFromArray(fns) {\n if (fns.length === 0) {\n return identity;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return function piped(input) {\n return fns.reduce(function (prev, fn) { return fn(prev); }, input);\n };\n}\n//# sourceMappingURL=pipe.js.map\n","/** PURE_IMPORTS_START _util_canReportError,_util_toSubscriber,_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */\nimport { canReportError } from './util/canReportError';\nimport { toSubscriber } from './util/toSubscriber';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nvar Observable = /*@__PURE__*/ (function () {\n function Observable(subscribe) {\n this._isScalar = false;\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n Observable.prototype.lift = function (operator) {\n var observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n };\n Observable.prototype.subscribe = function (observerOrNext, error, complete) {\n var operator = this.operator;\n var sink = toSubscriber(observerOrNext, error, complete);\n if (operator) {\n sink.add(operator.call(sink, this.source));\n }\n else {\n sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?\n this._subscribe(sink) :\n this._trySubscribe(sink));\n }\n if (config.useDeprecatedSynchronousErrorHandling) {\n if (sink.syncErrorThrowable) {\n sink.syncErrorThrowable = false;\n if (sink.syncErrorThrown) {\n throw sink.syncErrorValue;\n }\n }\n }\n return sink;\n };\n Observable.prototype._trySubscribe = function (sink) {\n try {\n return this._subscribe(sink);\n }\n catch (err) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n sink.syncErrorThrown = true;\n sink.syncErrorValue = err;\n }\n if (canReportError(sink)) {\n sink.error(err);\n }\n else {\n console.warn(err);\n }\n }\n };\n Observable.prototype.forEach = function (next, promiseCtor) {\n var _this = this;\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor(function (resolve, reject) {\n var subscription;\n subscription = _this.subscribe(function (value) {\n try {\n next(value);\n }\n catch (err) {\n reject(err);\n if (subscription) {\n subscription.unsubscribe();\n }\n }\n }, reject, resolve);\n });\n };\n Observable.prototype._subscribe = function (subscriber) {\n var source = this.source;\n return source && source.subscribe(subscriber);\n };\n Observable.prototype[Symbol_observable] = function () {\n return this;\n };\n Observable.prototype.pipe = function () {\n var operations = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n operations[_i] = arguments[_i];\n }\n if (operations.length === 0) {\n return this;\n }\n return pipeFromArray(operations)(this);\n };\n Observable.prototype.toPromise = function (promiseCtor) {\n var _this = this;\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor(function (resolve, reject) {\n var value;\n _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });\n });\n };\n Observable.create = function (subscribe) {\n return new Observable(subscribe);\n };\n return Observable;\n}());\nexport { Observable };\nfunction getPromiseCtor(promiseCtor) {\n if (!promiseCtor) {\n promiseCtor = config.Promise || Promise;\n }\n if (!promiseCtor) {\n throw new Error('no Promise impl found');\n }\n return promiseCtor;\n}\n//# sourceMappingURL=Observable.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nvar ObjectUnsubscribedErrorImpl = /*@__PURE__*/ (function () {\n function ObjectUnsubscribedErrorImpl() {\n Error.call(this);\n this.message = 'object unsubscribed';\n this.name = 'ObjectUnsubscribedError';\n return this;\n }\n ObjectUnsubscribedErrorImpl.prototype = /*@__PURE__*/ Object.create(Error.prototype);\n return ObjectUnsubscribedErrorImpl;\n})();\nexport var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl;\n//# sourceMappingURL=ObjectUnsubscribedError.js.map\n","/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscription } from './Subscription';\nvar SubjectSubscription = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(SubjectSubscription, _super);\n function SubjectSubscription(subject, subscriber) {\n var _this = _super.call(this) || this;\n _this.subject = subject;\n _this.subscriber = subscriber;\n _this.closed = false;\n return _this;\n }\n SubjectSubscription.prototype.unsubscribe = function () {\n if (this.closed) {\n return;\n }\n this.closed = true;\n var subject = this.subject;\n var observers = subject.observers;\n this.subject = null;\n if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {\n return;\n }\n var subscriberIndex = observers.indexOf(this.subscriber);\n if (subscriberIndex !== -1) {\n observers.splice(subscriberIndex, 1);\n }\n };\n return SubjectSubscription;\n}(Subscription));\nexport { SubjectSubscription };\n//# sourceMappingURL=SubjectSubscription.js.map\n","/** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Observable } from './Observable';\nimport { Subscriber } from './Subscriber';\nimport { Subscription } from './Subscription';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { SubjectSubscription } from './SubjectSubscription';\nimport { rxSubscriber as rxSubscriberSymbol } from '../internal/symbol/rxSubscriber';\nvar SubjectSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(SubjectSubscriber, _super);\n function SubjectSubscriber(destination) {\n var _this = _super.call(this, destination) || this;\n _this.destination = destination;\n return _this;\n }\n return SubjectSubscriber;\n}(Subscriber));\nexport { SubjectSubscriber };\nvar Subject = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(Subject, _super);\n function Subject() {\n var _this = _super.call(this) || this;\n _this.observers = [];\n _this.closed = false;\n _this.isStopped = false;\n _this.hasError = false;\n _this.thrownError = null;\n return _this;\n }\n Subject.prototype[rxSubscriberSymbol] = function () {\n return new SubjectSubscriber(this);\n };\n Subject.prototype.lift = function (operator) {\n var subject = new AnonymousSubject(this, this);\n subject.operator = operator;\n return subject;\n };\n Subject.prototype.next = function (value) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n if (!this.isStopped) {\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].next(value);\n }\n }\n };\n Subject.prototype.error = function (err) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n this.hasError = true;\n this.thrownError = err;\n this.isStopped = true;\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].error(err);\n }\n this.observers.length = 0;\n };\n Subject.prototype.complete = function () {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n this.isStopped = true;\n var observers = this.observers;\n var len = observers.length;\n var copy = observers.slice();\n for (var i = 0; i < len; i++) {\n copy[i].complete();\n }\n this.observers.length = 0;\n };\n Subject.prototype.unsubscribe = function () {\n this.isStopped = true;\n this.closed = true;\n this.observers = null;\n };\n Subject.prototype._trySubscribe = function (subscriber) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n else {\n return _super.prototype._trySubscribe.call(this, subscriber);\n }\n };\n Subject.prototype._subscribe = function (subscriber) {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n else if (this.hasError) {\n subscriber.error(this.thrownError);\n return Subscription.EMPTY;\n }\n else if (this.isStopped) {\n subscriber.complete();\n return Subscription.EMPTY;\n }\n else {\n this.observers.push(subscriber);\n return new SubjectSubscription(this, subscriber);\n }\n };\n Subject.prototype.asObservable = function () {\n var observable = new Observable();\n observable.source = this;\n return observable;\n };\n Subject.create = function (destination, source) {\n return new AnonymousSubject(destination, source);\n };\n return Subject;\n}(Observable));\nexport { Subject };\nvar AnonymousSubject = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AnonymousSubject, _super);\n function AnonymousSubject(destination, source) {\n var _this = _super.call(this) || this;\n _this.destination = destination;\n _this.source = source;\n return _this;\n }\n AnonymousSubject.prototype.next = function (value) {\n var destination = this.destination;\n if (destination && destination.next) {\n destination.next(value);\n }\n };\n AnonymousSubject.prototype.error = function (err) {\n var destination = this.destination;\n if (destination && destination.error) {\n this.destination.error(err);\n }\n };\n AnonymousSubject.prototype.complete = function () {\n var destination = this.destination;\n if (destination && destination.complete) {\n this.destination.complete();\n }\n };\n AnonymousSubject.prototype._subscribe = function (subscriber) {\n var source = this.source;\n if (source) {\n return this.source.subscribe(subscriber);\n }\n else {\n return Subscription.EMPTY;\n }\n };\n return AnonymousSubject;\n}(Subject));\nexport { AnonymousSubject };\n//# sourceMappingURL=Subject.js.map\n","/** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Subscription } from '../Subscription';\nvar Action = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(Action, _super);\n function Action(scheduler, work) {\n return _super.call(this) || this;\n }\n Action.prototype.schedule = function (state, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n return this;\n };\n return Action;\n}(Subscription));\nexport { Action };\n//# sourceMappingURL=Action.js.map\n","/** PURE_IMPORTS_START tslib,_Action PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Action } from './Action';\nvar AsyncAction = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AsyncAction, _super);\n function AsyncAction(scheduler, work) {\n var _this = _super.call(this, scheduler, work) || this;\n _this.scheduler = scheduler;\n _this.work = work;\n _this.pending = false;\n return _this;\n }\n AsyncAction.prototype.schedule = function (state, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if (this.closed) {\n return this;\n }\n this.state = state;\n var id = this.id;\n var scheduler = this.scheduler;\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n this.pending = true;\n this.delay = delay;\n this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);\n return this;\n };\n AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n return setInterval(scheduler.flush.bind(scheduler, this), delay);\n };\n AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {\n if (delay === void 0) {\n delay = 0;\n }\n if (delay !== null && this.delay === delay && this.pending === false) {\n return id;\n }\n clearInterval(id);\n return undefined;\n };\n AsyncAction.prototype.execute = function (state, delay) {\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n this.pending = false;\n var error = this._execute(state, delay);\n if (error) {\n return error;\n }\n else if (this.pending === false && this.id != null) {\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n };\n AsyncAction.prototype._execute = function (state, delay) {\n var errored = false;\n var errorValue = undefined;\n try {\n this.work(state);\n }\n catch (e) {\n errored = true;\n errorValue = !!e && e || new Error(e);\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n };\n AsyncAction.prototype._unsubscribe = function () {\n var id = this.id;\n var scheduler = this.scheduler;\n var actions = scheduler.actions;\n var index = actions.indexOf(this);\n this.work = null;\n this.state = null;\n this.pending = false;\n this.scheduler = null;\n if (index !== -1) {\n actions.splice(index, 1);\n }\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n this.delay = null;\n };\n return AsyncAction;\n}(Action));\nexport { AsyncAction };\n//# sourceMappingURL=AsyncAction.js.map\n","var Scheduler = /*@__PURE__*/ (function () {\n function Scheduler(SchedulerAction, now) {\n if (now === void 0) {\n now = Scheduler.now;\n }\n this.SchedulerAction = SchedulerAction;\n this.now = now;\n }\n Scheduler.prototype.schedule = function (work, delay, state) {\n if (delay === void 0) {\n delay = 0;\n }\n return new this.SchedulerAction(this, work).schedule(state, delay);\n };\n Scheduler.now = function () { return Date.now(); };\n return Scheduler;\n}());\nexport { Scheduler };\n//# sourceMappingURL=Scheduler.js.map\n","/** PURE_IMPORTS_START tslib,_Scheduler PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { Scheduler } from '../Scheduler';\nvar AsyncScheduler = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(AsyncScheduler, _super);\n function AsyncScheduler(SchedulerAction, now) {\n if (now === void 0) {\n now = Scheduler.now;\n }\n var _this = _super.call(this, SchedulerAction, function () {\n if (AsyncScheduler.delegate && AsyncScheduler.delegate !== _this) {\n return AsyncScheduler.delegate.now();\n }\n else {\n return now();\n }\n }) || this;\n _this.actions = [];\n _this.active = false;\n _this.scheduled = undefined;\n return _this;\n }\n AsyncScheduler.prototype.schedule = function (work, delay, state) {\n if (delay === void 0) {\n delay = 0;\n }\n if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {\n return AsyncScheduler.delegate.schedule(work, delay, state);\n }\n else {\n return _super.prototype.schedule.call(this, work, delay, state);\n }\n };\n AsyncScheduler.prototype.flush = function (action) {\n var actions = this.actions;\n if (this.active) {\n actions.push(action);\n return;\n }\n var error;\n this.active = true;\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (action = actions.shift());\n this.active = false;\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n };\n return AsyncScheduler;\n}(Scheduler));\nexport { AsyncScheduler };\n//# sourceMappingURL=AsyncScheduler.js.map\n","/** PURE_IMPORTS_START PURE_IMPORTS_END */\nexport function isScheduler(value) {\n return value && typeof value.schedule === 'function';\n}\n//# sourceMappingURL=isScheduler.js.map\n","/** PURE_IMPORTS_START _AsyncAction,_AsyncScheduler PURE_IMPORTS_END */\nimport { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\nexport var asyncScheduler = /*@__PURE__*/ new AsyncScheduler(AsyncAction);\nexport var async = asyncScheduler;\n//# sourceMappingURL=async.js.map\n","/** PURE_IMPORTS_START tslib,_scheduler_async,_Subscriber,_util_isScheduler PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { async } from '../scheduler/async';\nimport { Subscriber } from '../Subscriber';\nimport { isScheduler } from '../util/isScheduler';\nexport function bufferTime(bufferTimeSpan) {\n var length = arguments.length;\n var scheduler = async;\n if (isScheduler(arguments[arguments.length - 1])) {\n scheduler = arguments[arguments.length - 1];\n length--;\n }\n var bufferCreationInterval = null;\n if (length >= 2) {\n bufferCreationInterval = arguments[1];\n }\n var maxBufferSize = Number.POSITIVE_INFINITY;\n if (length >= 3) {\n maxBufferSize = arguments[2];\n }\n return function bufferTimeOperatorFunction(source) {\n return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler));\n };\n}\nvar BufferTimeOperator = /*@__PURE__*/ (function () {\n function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {\n this.bufferTimeSpan = bufferTimeSpan;\n this.bufferCreationInterval = bufferCreationInterval;\n this.maxBufferSize = maxBufferSize;\n this.scheduler = scheduler;\n }\n BufferTimeOperator.prototype.call = function (subscriber, source) {\n return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler));\n };\n return BufferTimeOperator;\n}());\nvar Context = /*@__PURE__*/ (function () {\n function Context() {\n this.buffer = [];\n }\n return Context;\n}());\nvar BufferTimeSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(BufferTimeSubscriber, _super);\n function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {\n var _this = _super.call(this, destination) || this;\n _this.bufferTimeSpan = bufferTimeSpan;\n _this.bufferCreationInterval = bufferCreationInterval;\n _this.maxBufferSize = maxBufferSize;\n _this.scheduler = scheduler;\n _this.contexts = [];\n var context = _this.openContext();\n _this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0;\n if (_this.timespanOnly) {\n var timeSpanOnlyState = { subscriber: _this, context: context, bufferTimeSpan: bufferTimeSpan };\n _this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));\n }\n else {\n var closeState = { subscriber: _this, context: context };\n var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: _this, scheduler: scheduler };\n _this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState));\n _this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState));\n }\n return _this;\n }\n BufferTimeSubscriber.prototype._next = function (value) {\n var contexts = this.contexts;\n var len = contexts.length;\n var filledBufferContext;\n for (var i = 0; i < len; i++) {\n var context_1 = contexts[i];\n var buffer = context_1.buffer;\n buffer.push(value);\n if (buffer.length == this.maxBufferSize) {\n filledBufferContext = context_1;\n }\n }\n if (filledBufferContext) {\n this.onBufferFull(filledBufferContext);\n }\n };\n BufferTimeSubscriber.prototype._error = function (err) {\n this.contexts.length = 0;\n _super.prototype._error.call(this, err);\n };\n BufferTimeSubscriber.prototype._complete = function () {\n var _a = this, contexts = _a.contexts, destination = _a.destination;\n while (contexts.length > 0) {\n var context_2 = contexts.shift();\n destination.next(context_2.buffer);\n }\n _super.prototype._complete.call(this);\n };\n BufferTimeSubscriber.prototype._unsubscribe = function () {\n this.contexts = null;\n };\n BufferTimeSubscriber.prototype.onBufferFull = function (context) {\n this.closeContext(context);\n var closeAction = context.closeAction;\n closeAction.unsubscribe();\n this.remove(closeAction);\n if (!this.closed && this.timespanOnly) {\n context = this.openContext();\n var bufferTimeSpan = this.bufferTimeSpan;\n var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan };\n this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));\n }\n };\n BufferTimeSubscriber.prototype.openContext = function () {\n var context = new Context();\n this.contexts.push(context);\n return context;\n };\n BufferTimeSubscriber.prototype.closeContext = function (context) {\n this.destination.next(context.buffer);\n var contexts = this.contexts;\n var spliceIndex = contexts ? contexts.indexOf(context) : -1;\n if (spliceIndex >= 0) {\n contexts.splice(contexts.indexOf(context), 1);\n }\n };\n return BufferTimeSubscriber;\n}(Subscriber));\nfunction dispatchBufferTimeSpanOnly(state) {\n var subscriber = state.subscriber;\n var prevContext = state.context;\n if (prevContext) {\n subscriber.closeContext(prevContext);\n }\n if (!subscriber.closed) {\n state.context = subscriber.openContext();\n state.context.closeAction = this.schedule(state, state.bufferTimeSpan);\n }\n}\nfunction dispatchBufferCreation(state) {\n var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler;\n var context = subscriber.openContext();\n var action = this;\n if (!subscriber.closed) {\n subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context }));\n action.schedule(state, bufferCreationInterval);\n }\n}\nfunction dispatchBufferClose(arg) {\n var subscriber = arg.subscriber, context = arg.context;\n subscriber.closeContext(context);\n}\n//# sourceMappingURL=bufferTime.js.map\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = ``;\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n constructor(result, element) {\n this.parts = [];\n this.element = element;\n const nodesToRemove = [];\n const stack = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const { strings, values: { length } } = result;\n while (partIndex < length) {\n const node = walker.nextNode();\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n continue;\n }\n index++;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if (node.hasAttributes()) {\n const attributes = node.attributes;\n const { length } = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)[2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;\n const attributeValue = node.getAttribute(attributeLookupName);\n node.removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({ type: 'attribute', index, name, strings: statics });\n partIndex += statics.length - 1;\n }\n }\n if (node.tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n }\n else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = node.data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n }\n else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({ type: 'node', index: ++index });\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n }\n else {\n node.data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n }\n else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if (node.data === marker) {\n const parent = node.parentNode;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({ type: 'node', index });\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n node.data = '';\n }\n else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({ type: 'node', index: -1 });\n partIndex++;\n }\n }\n }\n }\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode.removeChild(n);\n }\n }\n}\nconst endsWith = (str, suffix) => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\nexport const isTemplatePartActive = (part) => part.index !== -1;\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex = \n// eslint-disable-next-line no-control-regex\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n//# sourceMappingURL=template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { reparentNodes } from './dom.js';\nimport { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js';\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes.createPolicy('lit-html', { createHTML: (s) => s });\nconst commentMarker = ` ${marker} `;\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n constructor(strings, values, type, processor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n /**\n * Returns a string of HTML used to create a `