@wexio/messenger-widget-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +133 -0
- package/dist/widget-react-AgErOR36.js +325 -0
- package/dist/widget-react-AgErOR36.js.map +1 -0
- package/dist/widget-react-BAOIDvhV.js +4250 -0
- package/dist/widget-react-BAOIDvhV.js.map +1 -0
- package/dist/widget-react-BfPdgAQ-.js +5767 -0
- package/dist/widget-react-BfPdgAQ-.js.map +1 -0
- package/dist/widget-react-BxvW64LH.js +4429 -0
- package/dist/widget-react-BxvW64LH.js.map +1 -0
- package/dist/widget-react-C5COLy3m.js +23847 -0
- package/dist/widget-react-C5COLy3m.js.map +1 -0
- package/dist/widget-react-CAWxn8I0.js +247 -0
- package/dist/widget-react-CAWxn8I0.js.map +1 -0
- package/dist/widget-react-CDPzwV1i.js +11685 -0
- package/dist/widget-react-CDPzwV1i.js.map +1 -0
- package/dist/widget-react-CPYwD6FR.js +498 -0
- package/dist/widget-react-CPYwD6FR.js.map +1 -0
- package/dist/widget-react-CUBFPjaV.js +23 -0
- package/dist/widget-react-CUBFPjaV.js.map +1 -0
- package/dist/widget-react-CUuKGDZN.js +355 -0
- package/dist/widget-react-CUuKGDZN.js.map +1 -0
- package/dist/widget-react-CZs0xRrr.js +1336 -0
- package/dist/widget-react-CZs0xRrr.js.map +1 -0
- package/dist/widget-react-Cj_zbk_F.js +325 -0
- package/dist/widget-react-Cj_zbk_F.js.map +1 -0
- package/dist/widget-react-D-QrEVpv.js +125 -0
- package/dist/widget-react-D-QrEVpv.js.map +1 -0
- package/dist/widget-react-D8TPnM9r.js +26 -0
- package/dist/widget-react-D8TPnM9r.js.map +1 -0
- package/dist/widget-react-DE7AVrCo.js +5737 -0
- package/dist/widget-react-DE7AVrCo.js.map +1 -0
- package/dist/widget-react-DOX6j7_Q.js +30 -0
- package/dist/widget-react-DOX6j7_Q.js.map +1 -0
- package/dist/widget-react-DSw03RG7.js +262 -0
- package/dist/widget-react-DSw03RG7.js.map +1 -0
- package/dist/widget-react-Dew7YaLU.js +16 -0
- package/dist/widget-react-Dew7YaLU.js.map +1 -0
- package/dist/widget-react-DtOeNw5z.js +325 -0
- package/dist/widget-react-DtOeNw5z.js.map +1 -0
- package/dist/widget-react-DwL_rsx_.js +630 -0
- package/dist/widget-react-DwL_rsx_.js.map +1 -0
- package/dist/widget-react.d.ts +301 -0
- package/dist/widget-react.js +22285 -0
- package/dist/widget-react.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-react-BfPdgAQ-.js","names":["_a","invariant","maybe","maybe","wrap","invariant","originalInvariant","global","invariant","hasOwnProperty","maybe","canUseDOM","defaultDispose","noop","global","hasOwnProperty","toString","global","untypedGlobal","invariant","React","React","React","invariant","hasOwnProperty","hasOwnProperty","invariant","invariant","canUseDOM","React","React","React","invariant","React","setRef","composeRefs","useComposedRefs","useComposedRefs","usePresence","Fragment","__iconNode","__iconNode","__iconNode","__iconNode","getElementRef","useStateMachine","React2","ScrollArea","React2","Fragment"],"sources":["../node_modules/tslib/tslib.es6.mjs","../node_modules/ts-invariant/lib/invariant.js","../node_modules/@apollo/client/version.js","../node_modules/@apollo/client/utilities/globals/maybe.js","../node_modules/@apollo/client/utilities/globals/global.js","../node_modules/@apollo/client/utilities/common/makeUniqueId.js","../node_modules/@apollo/client/utilities/common/stringifyForDisplay.js","../node_modules/@apollo/client/utilities/globals/invariantWrappers.js","../node_modules/rehackt/index.js","../node_modules/graphql/jsutils/devAssert.mjs","../node_modules/graphql/jsutils/isObjectLike.mjs","../node_modules/graphql/jsutils/invariant.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/ast.mjs","../node_modules/graphql/language/directiveLocation.mjs","../node_modules/graphql/language/kinds.mjs","../node_modules/graphql/language/characterClasses.mjs","../node_modules/graphql/language/blockString.mjs","../node_modules/graphql/language/tokenKind.mjs","../node_modules/graphql/language/lexer.mjs","../node_modules/graphql/jsutils/inspect.mjs","../node_modules/graphql/jsutils/instanceOf.mjs","../node_modules/graphql/language/source.mjs","../node_modules/graphql/language/parser.mjs","../node_modules/graphql/language/visitor.mjs","../node_modules/@apollo/client/utilities/graphql/directives.js","../node_modules/@wry/trie/lib/index.js","../node_modules/@apollo/client/utilities/common/canUse.js","../node_modules/@apollo/client/utilities/common/objects.js","../node_modules/@apollo/client/utilities/graphql/fragments.js","../node_modules/@wry/caches/lib/strong.js","../node_modules/@wry/caches/lib/weak.js","../node_modules/@apollo/client/utilities/caching/caches.js","../node_modules/@apollo/client/utilities/caching/sizes.js","../node_modules/@apollo/client/utilities/caching/getMemoryInternals.js","../node_modules/@apollo/client/utilities/common/canonicalStringify.js","../node_modules/@apollo/client/utilities/graphql/storeUtils.js","../node_modules/@apollo/client/utilities/graphql/getFromAST.js","../node_modules/@wry/context/lib/slot.js","../node_modules/@wry/context/lib/index.js","../node_modules/optimism/lib/context.js","../node_modules/optimism/lib/helpers.js","../node_modules/optimism/lib/entry.js","../node_modules/optimism/lib/dep.js","../node_modules/optimism/lib/index.js","../node_modules/@apollo/client/utilities/common/arrays.js","../node_modules/zen-observable-ts/module.js","../node_modules/@apollo/client/utilities/promises/preventUnhandledRejection.js","../node_modules/@apollo/client/utilities/common/cloneDeep.js","../node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js","../node_modules/@apollo/client/utilities/observables/iteration.js","../node_modules/@apollo/client/utilities/observables/subclassing.js","../node_modules/@apollo/client/utilities/common/compact.js","../node_modules/@apollo/client/utilities/common/mergeOptions.js","../node_modules/@apollo/client/utilities/deprecation/index.js","../node_modules/@apollo/client/react/context/ApolloContext.js","../node_modules/@apollo/client/react/hooks/useApolloClient.js","../node_modules/@apollo/client/react/hooks/useSyncExternalStore.js","../node_modules/@wry/equality/lib/index.js","../node_modules/@apollo/client/errors/index.js","../node_modules/@apollo/client/core/equalByQuery.js","../node_modules/@apollo/client/core/networkStatus.js","../node_modules/@apollo/client/core/ObservableQuery.js","../node_modules/graphql-tag/lib/index.js","../node_modules/@apollo/client/react/parser/index.js","../node_modules/@apollo/client/react/hooks/internal/useIsomorphicLayoutEffect.js","../node_modules/@apollo/client/react/hooks/internal/useWarnRemovedOption.js","../node_modules/@apollo/client/react/hooks/internal/wrapHook.js","../node_modules/@apollo/client/react/hooks/useQuery.js","../node_modules/@apollo/client/react/hooks/useMutation.js","../node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs","../node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../lib/asset-url.ts","../lib/use-widget-env.tsx","../lib/api.ts","../dummy/authors.ts","../lib/theme-font.ts","../lib/widget-config.ts","../lib/use-widget-config.ts","../node_modules/lucide-react/dist/esm/icons/check.mjs","../node_modules/lucide-react/dist/esm/icons/chevron-down.mjs","../node_modules/lucide-react/dist/esm/icons/chevron-left.mjs","../node_modules/lucide-react/dist/esm/icons/chevron-right.mjs","../node_modules/lucide-react/dist/esm/icons/x.mjs","../node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../components/ui/card.tsx","../node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.mjs","../node_modules/@radix-ui/react-primitive/dist/index.mjs","../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs","../node_modules/@radix-ui/react-presence/dist/index.mjs","../node_modules/@radix-ui/react-context/dist/index.mjs","../node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs","../node_modules/@radix-ui/react-direction/dist/index.mjs","../node_modules/@radix-ui/number/dist/index.mjs","../node_modules/@radix-ui/primitive/dist/index.mjs","../node_modules/@radix-ui/react-scroll-area/dist/index.mjs","../components/ui/scroll-area.tsx","../components/widget/tabs/messages-tab/message/media-lightbox.tsx"],"sourcesContent":["/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar 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\nexport function __extends(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\nexport var __assign = function() {\n __assign = Object.assign || function __assign(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)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(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}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\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;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(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}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"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 (g && (g = 0, op[0] && (_ = 0)), _) 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}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\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}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\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);\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); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n","import { __extends } from \"tslib\";\nvar genericMessage = \"Invariant Violation\";\nvar _a = Object.setPrototypeOf, setPrototypeOf = _a === void 0 ? function (obj, proto) {\n obj.__proto__ = proto;\n return obj;\n} : _a;\nvar InvariantError = /** @class */ (function (_super) {\n __extends(InvariantError, _super);\n function InvariantError(message) {\n if (message === void 0) { message = genericMessage; }\n var _this = _super.call(this, typeof message === \"number\"\n ? genericMessage + \": \" + message + \" (see https://github.com/apollographql/invariant-packages)\"\n : message) || this;\n _this.framesToPop = 1;\n _this.name = genericMessage;\n setPrototypeOf(_this, InvariantError.prototype);\n return _this;\n }\n return InvariantError;\n}(Error));\nexport { InvariantError };\nexport function invariant(condition, message) {\n if (!condition) {\n throw new InvariantError(message);\n }\n}\nvar verbosityLevels = [\"debug\", \"log\", \"warn\", \"error\", \"silent\"];\nvar verbosityLevel = verbosityLevels.indexOf(\"log\");\nfunction wrapConsoleMethod(name) {\n return function () {\n if (verbosityLevels.indexOf(name) >= verbosityLevel) {\n // Default to console.log if this host environment happens not to provide\n // all the console.* methods we need.\n var method = console[name] || console.log;\n return method.apply(console, arguments);\n }\n };\n}\n(function (invariant) {\n invariant.debug = wrapConsoleMethod(\"debug\");\n invariant.log = wrapConsoleMethod(\"log\");\n invariant.warn = wrapConsoleMethod(\"warn\");\n invariant.error = wrapConsoleMethod(\"error\");\n})(invariant || (invariant = {}));\nexport function setVerbosity(level) {\n var old = verbosityLevels[verbosityLevel];\n verbosityLevel = Math.max(0, verbosityLevels.indexOf(level));\n return old;\n}\nexport default invariant;\n//# sourceMappingURL=invariant.js.map","export var version = \"3.14.1\";\n//# sourceMappingURL=version.js.map","export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe.js\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) || // We don't expect the Function constructor ever to be invoked at runtime, as\n// long as at least one of globalThis, window, self, or global is defined, so\n// we are under no obligation to make it easy for static analysis tools to\n// detect syntactic usage of the Function constructor. If you think you can\n// improve your static analysis to detect this obfuscation, think again. This\n// is an arms race you cannot win, at least not in JavaScript.\nmaybe(function () {\n return maybe.constructor(\"return this\")();\n}));\n//# sourceMappingURL=global.js.map","var prefixCounts = new Map();\n// These IDs won't be globally unique, but they will be unique within this\n// process, thanks to the counter, and unguessable thanks to the random suffix.\nexport function makeUniqueId(prefix) {\n var count = prefixCounts.get(prefix) || 1;\n prefixCounts.set(prefix, count + 1);\n return \"\".concat(prefix, \":\").concat(count, \":\").concat(Math.random().toString(36).slice(2));\n}\n//# sourceMappingURL=makeUniqueId.js.map","import { makeUniqueId } from \"./makeUniqueId.js\";\nexport function stringifyForDisplay(value, space) {\n if (space === void 0) { space = 0; }\n var undefId = makeUniqueId(\"stringifyForDisplay\");\n return JSON.stringify(value, function (key, value) {\n return value === void 0 ? undefId : value;\n }, space)\n .split(JSON.stringify(undefId))\n .join(\"<undefined>\");\n}\n//# sourceMappingURL=stringifyForDisplay.js.map","import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\nfunction wrap(fn) {\n return function (message) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof message === \"number\") {\n var arg0 = message;\n message = getHandledErrorMsg(arg0);\n if (!message) {\n message = getFallbackErrorMsg(arg0, args);\n args = [];\n }\n }\n fn.apply(void 0, [message].concat(args));\n };\n}\nvar invariant = Object.assign(function invariant(condition, message) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n if (!condition) {\n originalInvariant(condition, getHandledErrorMsg(message, args) || getFallbackErrorMsg(message, args));\n }\n}, {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n});\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(message) {\n var optionalParams = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n optionalParams[_i - 1] = arguments[_i];\n }\n return new InvariantError(getHandledErrorMsg(message, optionalParams) ||\n getFallbackErrorMsg(message, optionalParams));\n}\nvar ApolloErrorMessageHandler = Symbol.for(\"ApolloErrorMessageHandler_\" + version);\nfunction stringify(arg) {\n if (typeof arg == \"string\") {\n return arg;\n }\n try {\n return stringifyForDisplay(arg, 2).slice(0, 1000);\n }\n catch (_a) {\n return \"<non-serializable>\";\n }\n}\nfunction getHandledErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return (global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, messageArgs.map(stringify)));\n}\nfunction getFallbackErrorMsg(message, messageArgs) {\n if (messageArgs === void 0) { messageArgs = []; }\n if (!message)\n return;\n return \"An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#\".concat(encodeURIComponent(JSON.stringify({\n version: version,\n message: message,\n args: messageArgs.map(stringify),\n })));\n}\nexport { invariant, InvariantError, newInvariantError, ApolloErrorMessageHandler, };\n//# sourceMappingURL=invariantWrappers.js.map","\"use strict\";\nif (0) {\n // Trick cjs-module-lexer into adding named exports for all React exports.\n // (if imported with `import()`, they will appear in `.default` as well.)\n // This way, cjs-module-lexer will let all of react's (named) exports through unchanged.\n module.exports = require(\"react\");\n}\n// We don't want bundlers to error when they encounter usage of any of these exports.\n// It's up to the package author to ensure that if they access React internals,\n// they do so in a safe way that won't break if React changes how they use these internals.\n// (e.g. only access them in development, and only in an optional way that won't\n// break if internals are not there or do not have the expected structure)\n// @ts-ignore\nmodule.exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = undefined;\n// @ts-ignore\nmodule.exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = undefined;\n// @ts-ignore\nmodule.exports.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = undefined;\n// Here we actually pull in the React library and add everything\n// it exports to our own `module.exports`.\n// If React suddenly were to add one of the above \"polyfilled\" exports,\n// the React version would overwrite our version, so this should be\n// future-proof.\nObject.assign(module.exports, require(\"react\"));\n","export function devAssert(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(message);\n }\n}\n","/**\n * Return true if `value` is object-like. A value is object-like if it's not\n * `null` and has a `typeof` result of \"object\".\n */\nexport function isObjectLike(value) {\n return typeof value == 'object' && value !== null;\n}\n","export function invariant(condition, message) {\n const booleanCondition = Boolean(condition);\n\n if (!booleanCondition) {\n throw new Error(\n message != null ? message : 'Unexpected invariant triggered.',\n );\n }\n}\n","import { invariant } from '../jsutils/invariant.mjs';\nconst LineRegExp = /\\r\\n|[\\n\\r]/g;\n/**\n * Represents a location in a Source.\n */\n\n/**\n * Takes a Source and a UTF-8 character offset, and returns the corresponding\n * line and column as a SourceLocation.\n */\nexport function getLocation(source, position) {\n let lastLineStart = 0;\n let line = 1;\n\n for (const match of source.body.matchAll(LineRegExp)) {\n typeof match.index === 'number' || invariant(false);\n\n if (match.index >= position) {\n break;\n }\n\n lastLineStart = match.index + match[0].length;\n line += 1;\n }\n\n return {\n line,\n column: position + 1 - lastLineStart,\n };\n}\n","import { getLocation } from './location.mjs';\n\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\nexport function printLocation(location) {\n return printSourceLocation(\n location.source,\n getLocation(location.source, location.start),\n );\n}\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printSourceLocation(source, sourceLocation) {\n const firstLineColumnOffset = source.locationOffset.column - 1;\n const body = ''.padStart(firstLineColumnOffset) + source.body;\n const lineIndex = sourceLocation.line - 1;\n const lineOffset = source.locationOffset.line - 1;\n const lineNum = sourceLocation.line + lineOffset;\n const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;\n const columnNum = sourceLocation.column + columnOffset;\n const locationStr = `${source.name}:${lineNum}:${columnNum}\\n`;\n const lines = body.split(/\\r\\n|[\\n\\r]/g);\n const locationLine = lines[lineIndex]; // Special case for minified documents\n\n if (locationLine.length > 120) {\n const subLineIndex = Math.floor(columnNum / 80);\n const subLineColumnNum = columnNum % 80;\n const subLines = [];\n\n for (let i = 0; i < locationLine.length; i += 80) {\n subLines.push(locationLine.slice(i, i + 80));\n }\n\n return (\n locationStr +\n printPrefixedLines([\n [`${lineNum} |`, subLines[0]],\n ...subLines.slice(1, subLineIndex + 1).map((subLine) => ['|', subLine]),\n ['|', '^'.padStart(subLineColumnNum)],\n ['|', subLines[subLineIndex + 1]],\n ])\n );\n }\n\n return (\n locationStr +\n printPrefixedLines([\n // Lines specified like this: [\"prefix\", \"string\"],\n [`${lineNum - 1} |`, lines[lineIndex - 1]],\n [`${lineNum} |`, locationLine],\n ['|', '^'.padStart(columnNum)],\n [`${lineNum + 1} |`, lines[lineIndex + 1]],\n ])\n );\n}\n\nfunction printPrefixedLines(lines) {\n const existingLines = lines.filter(([_, line]) => line !== undefined);\n const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length));\n return existingLines\n .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : ''))\n .join('\\n');\n}\n","import { isObjectLike } from '../jsutils/isObjectLike.mjs';\nimport { getLocation } from '../language/location.mjs';\nimport {\n printLocation,\n printSourceLocation,\n} from '../language/printLocation.mjs';\n\nfunction toNormalizedOptions(args) {\n const firstArg = args[0];\n\n if (firstArg == null || 'kind' in firstArg || 'length' in firstArg) {\n return {\n nodes: firstArg,\n source: args[1],\n positions: args[2],\n path: args[3],\n originalError: args[4],\n extensions: args[5],\n };\n }\n\n return firstArg;\n}\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 class GraphQLError extends Error {\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\n /**\n * @deprecated Please use the `GraphQLErrorOptions` constructor overload instead.\n */\n constructor(message, ...rawArgs) {\n var _this$nodes, _nodeLocations$, _ref;\n\n const { nodes, source, positions, path, originalError, extensions } =\n toNormalizedOptions(rawArgs);\n super(message);\n this.name = 'GraphQLError';\n this.path = path !== null && path !== void 0 ? path : undefined;\n this.originalError =\n originalError !== null && originalError !== void 0\n ? originalError\n : undefined; // Compute list of blame nodes.\n\n this.nodes = undefinedIfEmpty(\n Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined,\n );\n const nodeLocations = undefinedIfEmpty(\n (_this$nodes = this.nodes) === null || _this$nodes === void 0\n ? void 0\n : _this$nodes.map((node) => node.loc).filter((loc) => loc != null),\n ); // Compute locations in the source for the given nodes/positions.\n\n this.source =\n source !== null && source !== void 0\n ? source\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : (_nodeLocations$ = nodeLocations[0]) === null ||\n _nodeLocations$ === void 0\n ? void 0\n : _nodeLocations$.source;\n this.positions =\n positions !== null && positions !== void 0\n ? positions\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => loc.start);\n this.locations =\n positions && source\n ? positions.map((pos) => getLocation(source, pos))\n : nodeLocations === null || nodeLocations === void 0\n ? void 0\n : nodeLocations.map((loc) => getLocation(loc.source, loc.start));\n const originalExtensions = isObjectLike(\n originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions,\n )\n ? originalError === null || originalError === void 0\n ? void 0\n : originalError.extensions\n : undefined;\n this.extensions =\n (_ref =\n extensions !== null && extensions !== void 0\n ? extensions\n : originalExtensions) !== null && _ref !== void 0\n ? _ref\n : Object.create(null); // Only properties prescribed by the spec should be enumerable.\n // Keep the rest as non-enumerable.\n\n Object.defineProperties(this, {\n message: {\n writable: true,\n enumerable: true,\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 /* c8 ignore start */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n\n if (\n originalError !== null &&\n originalError !== void 0 &&\n originalError.stack\n ) {\n Object.defineProperty(this, 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true,\n });\n } else if (Error.captureStackTrace) {\n Error.captureStackTrace(this, GraphQLError);\n } else {\n Object.defineProperty(this, 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true,\n });\n }\n /* c8 ignore stop */\n }\n\n get [Symbol.toStringTag]() {\n return 'GraphQLError';\n }\n\n toString() {\n let output = this.message;\n\n if (this.nodes) {\n for (const node of this.nodes) {\n if (node.loc) {\n output += '\\n\\n' + printLocation(node.loc);\n }\n }\n } else if (this.source && this.locations) {\n for (const location of this.locations) {\n output += '\\n\\n' + printSourceLocation(this.source, location);\n }\n }\n\n return output;\n }\n\n toJSON() {\n const formattedError = {\n message: this.message,\n };\n\n if (this.locations != null) {\n formattedError.locations = this.locations;\n }\n\n if (this.path != null) {\n formattedError.path = this.path;\n }\n\n if (this.extensions != null && Object.keys(this.extensions).length > 0) {\n formattedError.extensions = this.extensions;\n }\n\n return formattedError;\n }\n}\n\nfunction undefinedIfEmpty(array) {\n return array === undefined || array.length === 0 ? undefined : array;\n}\n/**\n * See: https://spec.graphql.org/draft/#sec-Errors\n */\n\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n *\n * @deprecated Please use `error.toString` instead. Will be removed in v17\n */\nexport function printError(error) {\n return error.toString();\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 * @deprecated Please use `error.toJSON` instead. Will be removed in v17\n */\n\nexport function formatError(error) {\n return error.toJSON();\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: ${description}`, {\n source,\n positions: [position],\n });\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 class Location {\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 constructor(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 get [Symbol.toStringTag]() {\n return 'Location';\n }\n\n toJSON() {\n return {\n start: this.start,\n end: this.end,\n };\n }\n}\n/**\n * Represents a range of characters represented by a lexical token\n * within a Source.\n */\n\nexport class Token {\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 * Note: is undefined for punctuation tokens, but typed as string for\n * convenience in the parser.\n */\n\n /**\n * Tokens exist as nodes in a double-linked-list amongst all tokens\n * including ignored tokens. <SOF> is always the first node and <EOF>\n * the last.\n */\n constructor(kind, start, end, line, column, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\n this.value = value;\n this.prev = null;\n this.next = null;\n }\n\n get [Symbol.toStringTag]() {\n return 'Token';\n }\n\n toJSON() {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column,\n };\n }\n}\n/**\n * The list of all possible AST node types.\n */\n\n/**\n * @internal\n */\nexport const QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: [\n 'description',\n 'name',\n 'variableDefinitions',\n 'directives',\n 'selectionSet',\n ],\n VariableDefinition: [\n 'description',\n 'variable',\n 'type',\n 'defaultValue',\n 'directives',\n ],\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: [\n 'description',\n 'name', // Note: fragment variable definitions are deprecated and will removed in v17.0.0\n 'variableDefinitions',\n 'typeCondition',\n 'directives',\n 'selectionSet',\n ],\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: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: [\n 'description',\n 'name',\n 'type',\n 'defaultValue',\n 'directives',\n ],\n InterfaceTypeDefinition: [\n 'description',\n 'name',\n 'interfaces',\n 'directives',\n 'fields',\n ],\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: [\n 'description',\n 'name',\n 'arguments',\n 'directives',\n 'locations',\n ],\n SchemaExtension: ['directives', 'operationTypes'],\n DirectiveExtension: ['name', 'directives'],\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 TypeCoordinate: ['name'],\n MemberCoordinate: ['name', 'memberName'],\n ArgumentCoordinate: ['name', 'fieldName', 'argumentName'],\n DirectiveCoordinate: ['name'],\n DirectiveArgumentCoordinate: ['name', 'argumentName'],\n};\nconst kindValues = new Set(Object.keys(QueryDocumentKeys));\n/**\n * @internal\n */\n\nexport function isNode(maybeNode) {\n const maybeKind =\n maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;\n return typeof maybeKind === 'string' && kindValues.has(maybeKind);\n}\n/** Name */\n\nvar OperationTypeNode;\n\n(function (OperationTypeNode) {\n OperationTypeNode['QUERY'] = 'query';\n OperationTypeNode['MUTATION'] = 'mutation';\n OperationTypeNode['SUBSCRIPTION'] = 'subscription';\n})(OperationTypeNode || (OperationTypeNode = {}));\n\nexport { OperationTypeNode };\n","/**\n * The set of allowed directive location values.\n */\nvar DirectiveLocation;\n\n(function (DirectiveLocation) {\n DirectiveLocation['QUERY'] = 'QUERY';\n DirectiveLocation['MUTATION'] = 'MUTATION';\n DirectiveLocation['SUBSCRIPTION'] = 'SUBSCRIPTION';\n DirectiveLocation['FIELD'] = 'FIELD';\n DirectiveLocation['FRAGMENT_DEFINITION'] = 'FRAGMENT_DEFINITION';\n DirectiveLocation['FRAGMENT_SPREAD'] = 'FRAGMENT_SPREAD';\n DirectiveLocation['INLINE_FRAGMENT'] = 'INLINE_FRAGMENT';\n DirectiveLocation['VARIABLE_DEFINITION'] = 'VARIABLE_DEFINITION';\n DirectiveLocation['SCHEMA'] = 'SCHEMA';\n DirectiveLocation['SCALAR'] = 'SCALAR';\n DirectiveLocation['OBJECT'] = 'OBJECT';\n DirectiveLocation['FIELD_DEFINITION'] = 'FIELD_DEFINITION';\n DirectiveLocation['ARGUMENT_DEFINITION'] = 'ARGUMENT_DEFINITION';\n DirectiveLocation['INTERFACE'] = 'INTERFACE';\n DirectiveLocation['UNION'] = 'UNION';\n DirectiveLocation['ENUM'] = 'ENUM';\n DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE';\n DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';\n DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';\n DirectiveLocation['DIRECTIVE_DEFINITION'] = 'DIRECTIVE_DEFINITION';\n})(DirectiveLocation || (DirectiveLocation = {}));\n\nexport { DirectiveLocation };\n/**\n * The enum type representing the directive location values.\n *\n * @deprecated Please use `DirectiveLocation`. Will be remove in v17.\n */\n","/**\n * The set of allowed kind values for AST nodes.\n */\nvar Kind;\n\n(function (Kind) {\n Kind['NAME'] = 'Name';\n Kind['DOCUMENT'] = 'Document';\n Kind['OPERATION_DEFINITION'] = 'OperationDefinition';\n Kind['VARIABLE_DEFINITION'] = 'VariableDefinition';\n Kind['SELECTION_SET'] = 'SelectionSet';\n Kind['FIELD'] = 'Field';\n Kind['ARGUMENT'] = 'Argument';\n Kind['FRAGMENT_SPREAD'] = 'FragmentSpread';\n Kind['INLINE_FRAGMENT'] = 'InlineFragment';\n Kind['FRAGMENT_DEFINITION'] = 'FragmentDefinition';\n Kind['VARIABLE'] = 'Variable';\n Kind['INT'] = 'IntValue';\n Kind['FLOAT'] = 'FloatValue';\n Kind['STRING'] = 'StringValue';\n Kind['BOOLEAN'] = 'BooleanValue';\n Kind['NULL'] = 'NullValue';\n Kind['ENUM'] = 'EnumValue';\n Kind['LIST'] = 'ListValue';\n Kind['OBJECT'] = 'ObjectValue';\n Kind['OBJECT_FIELD'] = 'ObjectField';\n Kind['DIRECTIVE'] = 'Directive';\n Kind['NAMED_TYPE'] = 'NamedType';\n Kind['LIST_TYPE'] = 'ListType';\n Kind['NON_NULL_TYPE'] = 'NonNullType';\n Kind['SCHEMA_DEFINITION'] = 'SchemaDefinition';\n Kind['OPERATION_TYPE_DEFINITION'] = 'OperationTypeDefinition';\n Kind['SCALAR_TYPE_DEFINITION'] = 'ScalarTypeDefinition';\n Kind['OBJECT_TYPE_DEFINITION'] = 'ObjectTypeDefinition';\n Kind['FIELD_DEFINITION'] = 'FieldDefinition';\n Kind['INPUT_VALUE_DEFINITION'] = 'InputValueDefinition';\n Kind['INTERFACE_TYPE_DEFINITION'] = 'InterfaceTypeDefinition';\n Kind['UNION_TYPE_DEFINITION'] = 'UnionTypeDefinition';\n Kind['ENUM_TYPE_DEFINITION'] = 'EnumTypeDefinition';\n Kind['ENUM_VALUE_DEFINITION'] = 'EnumValueDefinition';\n Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition';\n Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition';\n Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';\n Kind['DIRECTIVE_EXTENSION'] = 'DirectiveExtension';\n Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';\n Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';\n Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension';\n Kind['UNION_TYPE_EXTENSION'] = 'UnionTypeExtension';\n Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';\n Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';\n Kind['TYPE_COORDINATE'] = 'TypeCoordinate';\n Kind['MEMBER_COORDINATE'] = 'MemberCoordinate';\n Kind['ARGUMENT_COORDINATE'] = 'ArgumentCoordinate';\n Kind['DIRECTIVE_COORDINATE'] = 'DirectiveCoordinate';\n Kind['DIRECTIVE_ARGUMENT_COORDINATE'] = 'DirectiveArgumentCoordinate';\n})(Kind || (Kind = {}));\n\nexport { Kind };\n/**\n * The enum type representing the possible kind values of AST nodes.\n *\n * @deprecated Please use `Kind`. Will be remove in v17.\n */\n","/**\n * ```\n * WhiteSpace ::\n * - \"Horizontal Tab (U+0009)\"\n * - \"Space (U+0020)\"\n * ```\n * @internal\n */\nexport function isWhiteSpace(code) {\n return code === 0x0009 || code === 0x0020;\n}\n/**\n * ```\n * Digit :: one of\n * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`\n * ```\n * @internal\n */\n\nexport function isDigit(code) {\n return code >= 0x0030 && code <= 0x0039;\n}\n/**\n * ```\n * Letter :: one of\n * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M`\n * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z`\n * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m`\n * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z`\n * ```\n * @internal\n */\n\nexport function isLetter(code) {\n return (\n (code >= 0x0061 && code <= 0x007a) || // A-Z\n (code >= 0x0041 && code <= 0x005a) // a-z\n );\n}\n/**\n * ```\n * NameStart ::\n * - Letter\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameStart(code) {\n return isLetter(code) || code === 0x005f;\n}\n/**\n * ```\n * NameContinue ::\n * - Letter\n * - Digit\n * - `_`\n * ```\n * @internal\n */\n\nexport function isNameContinue(code) {\n return isLetter(code) || isDigit(code) || code === 0x005f;\n}\n","import { isWhiteSpace } from './characterClasses.mjs';\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 */\n\nexport function dedentBlockStringLines(lines) {\n var _firstNonEmptyLine2;\n\n let commonIndent = Number.MAX_SAFE_INTEGER;\n let firstNonEmptyLine = null;\n let lastNonEmptyLine = -1;\n\n for (let i = 0; i < lines.length; ++i) {\n var _firstNonEmptyLine;\n\n const line = lines[i];\n const indent = leadingWhitespace(line);\n\n if (indent === line.length) {\n continue; // skip empty lines\n }\n\n firstNonEmptyLine =\n (_firstNonEmptyLine = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine !== void 0\n ? _firstNonEmptyLine\n : i;\n lastNonEmptyLine = i;\n\n if (i !== 0 && indent < commonIndent) {\n commonIndent = indent;\n }\n }\n\n return lines // Remove common indentation from all lines but first.\n .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) // Remove leading and trailing blank lines.\n .slice(\n (_firstNonEmptyLine2 = firstNonEmptyLine) !== null &&\n _firstNonEmptyLine2 !== void 0\n ? _firstNonEmptyLine2\n : 0,\n lastNonEmptyLine + 1,\n );\n}\n\nfunction leadingWhitespace(str) {\n let i = 0;\n\n while (i < str.length && isWhiteSpace(str.charCodeAt(i))) {\n ++i;\n }\n\n return i;\n}\n/**\n * @internal\n */\n\nexport function isPrintableAsBlockString(value) {\n if (value === '') {\n return true; // empty string is printable\n }\n\n let isEmptyLine = true;\n let hasIndent = false;\n let hasCommonIndent = true;\n let seenNonEmptyLine = false;\n\n for (let i = 0; i < value.length; ++i) {\n switch (value.codePointAt(i)) {\n case 0x0000:\n case 0x0001:\n case 0x0002:\n case 0x0003:\n case 0x0004:\n case 0x0005:\n case 0x0006:\n case 0x0007:\n case 0x0008:\n case 0x000b:\n case 0x000c:\n case 0x000e:\n case 0x000f:\n return false;\n // Has non-printable characters\n\n case 0x000d:\n // \\r\n return false;\n // Has \\r or \\r\\n which will be replaced as \\n\n\n case 10:\n // \\n\n if (isEmptyLine && !seenNonEmptyLine) {\n return false; // Has leading new line\n }\n\n seenNonEmptyLine = true;\n isEmptyLine = true;\n hasIndent = false;\n break;\n\n case 9: // \\t\n\n case 32:\n // <space>\n hasIndent || (hasIndent = isEmptyLine);\n break;\n\n default:\n hasCommonIndent && (hasCommonIndent = hasIndent);\n isEmptyLine = false;\n }\n }\n\n if (isEmptyLine) {\n return false; // Has trailing empty lines\n }\n\n if (hasCommonIndent && seenNonEmptyLine) {\n return false; // Has internal indent\n }\n\n return true;\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, options) {\n const escapedValue = value.replace(/\"\"\"/g, '\\\\\"\"\"'); // Expand a block string's raw value into independent lines.\n\n const lines = escapedValue.split(/\\r\\n|[\\n\\r]/g);\n const isSingleLine = lines.length === 1; // If common indentation is found we can fix some of those cases by adding leading new line\n\n const forceLeadingNewLine =\n lines.length > 1 &&\n lines\n .slice(1)\n .every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); // Trailing triple quotes just looks confusing but doesn't force trailing new line\n\n const hasTrailingTripleQuotes = escapedValue.endsWith('\\\\\"\"\"'); // Trailing quote (single or double) or slash forces trailing new line\n\n const hasTrailingQuote = value.endsWith('\"') && !hasTrailingTripleQuotes;\n const hasTrailingSlash = value.endsWith('\\\\');\n const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash;\n const printAsMultipleLines =\n !(options !== null && options !== void 0 && options.minimize) && // add leading and trailing new lines only if it improves readability\n (!isSingleLine ||\n value.length > 70 ||\n forceTrailingNewline ||\n forceLeadingNewLine ||\n hasTrailingTripleQuotes);\n let result = ''; // Format a multi-line block quote to account for leading space.\n\n const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0));\n\n if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) {\n result += '\\n';\n }\n\n result += escapedValue;\n\n if (printAsMultipleLines || forceTrailingNewline) {\n result += '\\n';\n }\n\n return '\"\"\"' + result + '\"\"\"';\n}\n","/**\n * An exported enum describing the different kinds of tokens that the\n * lexer emits.\n */\nvar TokenKind;\n\n(function (TokenKind) {\n TokenKind['SOF'] = '<SOF>';\n TokenKind['EOF'] = '<EOF>';\n TokenKind['BANG'] = '!';\n TokenKind['DOLLAR'] = '$';\n TokenKind['AMP'] = '&';\n TokenKind['PAREN_L'] = '(';\n TokenKind['PAREN_R'] = ')';\n TokenKind['DOT'] = '.';\n TokenKind['SPREAD'] = '...';\n TokenKind['COLON'] = ':';\n TokenKind['EQUALS'] = '=';\n TokenKind['AT'] = '@';\n TokenKind['BRACKET_L'] = '[';\n TokenKind['BRACKET_R'] = ']';\n TokenKind['BRACE_L'] = '{';\n TokenKind['PIPE'] = '|';\n TokenKind['BRACE_R'] = '}';\n TokenKind['NAME'] = 'Name';\n TokenKind['INT'] = 'Int';\n TokenKind['FLOAT'] = 'Float';\n TokenKind['STRING'] = 'String';\n TokenKind['BLOCK_STRING'] = 'BlockString';\n TokenKind['COMMENT'] = 'Comment';\n})(TokenKind || (TokenKind = {}));\n\nexport { TokenKind };\n/**\n * The enum type representing the token kinds values.\n *\n * @deprecated Please use `TokenKind`. Will be remove in v17.\n */\n","import { syntaxError } from '../error/syntaxError.mjs';\nimport { Token } from './ast.mjs';\nimport { dedentBlockStringLines } from './blockString.mjs';\nimport { isDigit, isNameContinue, isNameStart } from './characterClasses.mjs';\nimport { TokenKind } from './tokenKind.mjs';\n/**\n * A Lexer interface which provides common properties and methods required for\n * lexing GraphQL source.\n *\n * @internal\n */\n\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 */\nexport class Lexer {\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 constructor(source) {\n const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0);\n this.source = source;\n this.lastToken = startOfFileToken;\n this.token = startOfFileToken;\n this.line = 1;\n this.lineStart = 0;\n }\n\n get [Symbol.toStringTag]() {\n return 'Lexer';\n }\n /**\n * Advances the token stream to the next non-ignored token.\n */\n\n advance() {\n this.lastToken = this.token;\n const 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 lookahead() {\n let token = this.token;\n\n if (token.kind !== TokenKind.EOF) {\n do {\n if (token.next) {\n token = token.next;\n } else {\n // Read the next token and form a link in the token linked-list.\n const nextToken = readNextToken(this, token.end); // @ts-expect-error next is only mutable during parsing.\n\n token.next = nextToken; // @ts-expect-error prev is only mutable during parsing.\n\n nextToken.prev = token;\n token = nextToken;\n }\n } while (token.kind === TokenKind.COMMENT);\n }\n\n return token;\n }\n}\n/**\n * @internal\n */\n\nexport function isPunctuatorTokenKind(kind) {\n return (\n kind === TokenKind.BANG ||\n kind === TokenKind.DOLLAR ||\n kind === TokenKind.AMP ||\n kind === TokenKind.PAREN_L ||\n kind === TokenKind.PAREN_R ||\n kind === TokenKind.DOT ||\n kind === TokenKind.SPREAD ||\n kind === TokenKind.COLON ||\n kind === TokenKind.EQUALS ||\n kind === TokenKind.AT ||\n kind === TokenKind.BRACKET_L ||\n kind === TokenKind.BRACKET_R ||\n kind === TokenKind.BRACE_L ||\n kind === TokenKind.PIPE ||\n kind === TokenKind.BRACE_R\n );\n}\n/**\n * A Unicode scalar value is any Unicode code point except surrogate code\n * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and\n * 0xE000 to 0x10FFFF.\n *\n * SourceCharacter ::\n * - \"Any Unicode scalar value\"\n */\n\nfunction isUnicodeScalarValue(code) {\n return (\n (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff)\n );\n}\n/**\n * The GraphQL specification defines source text as a sequence of unicode scalar\n * values (which Unicode defines to exclude surrogate code points). However\n * JavaScript defines strings as a sequence of UTF-16 code units which may\n * include surrogates. A surrogate pair is a valid source character as it\n * encodes a supplementary code point (above U+FFFF), but unpaired surrogate\n * code points are not valid source characters.\n */\n\nfunction isSupplementaryCodePoint(body, location) {\n return (\n isLeadingSurrogate(body.charCodeAt(location)) &&\n isTrailingSurrogate(body.charCodeAt(location + 1))\n );\n}\n\nfunction isLeadingSurrogate(code) {\n return code >= 0xd800 && code <= 0xdbff;\n}\n\nfunction isTrailingSurrogate(code) {\n return code >= 0xdc00 && code <= 0xdfff;\n}\n/**\n * Prints the code point (or end of file reference) at a given location in a\n * source for use in error messages.\n *\n * Printable ASCII is printed quoted, while other points are printed in Unicode\n * code point form (ie. U+1234).\n *\n * @internal\n */\n\nexport function printCodePointAt(lexer, location) {\n const code = lexer.source.body.codePointAt(location);\n\n if (code === undefined) {\n return TokenKind.EOF;\n } else if (code >= 0x0020 && code <= 0x007e) {\n // Printable ASCII\n const char = String.fromCodePoint(code);\n return char === '\"' ? \"'\\\"'\" : `\"${char}\"`;\n } // Unicode code point\n\n return 'U+' + code.toString(16).toUpperCase().padStart(4, '0');\n}\n/**\n * Create a token with line and column location information.\n *\n * @internal\n */\n\nexport function createToken(lexer, kind, start, end, value) {\n const line = lexer.line;\n const col = 1 + start - lexer.lineStart;\n return new Token(kind, start, end, line, col, value);\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\nfunction readNextToken(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // SourceCharacter\n\n switch (code) {\n // Ignored ::\n // - UnicodeBOM\n // - WhiteSpace\n // - LineTerminator\n // - Comment\n // - Comma\n //\n // UnicodeBOM :: \"Byte Order Mark (U+FEFF)\"\n //\n // WhiteSpace ::\n // - \"Horizontal Tab (U+0009)\"\n // - \"Space (U+0020)\"\n //\n // Comma :: ,\n case 0xfeff: // <BOM>\n\n case 0x0009: // \\t\n\n case 0x0020: // <space>\n\n case 0x002c:\n // ,\n ++position;\n continue;\n // LineTerminator ::\n // - \"New Line (U+000A)\"\n // - \"Carriage Return (U+000D)\" [lookahead != \"New Line (U+000A)\"]\n // - \"Carriage Return (U+000D)\" \"New Line (U+000A)\"\n\n case 0x000a:\n // \\n\n ++position;\n ++lexer.line;\n lexer.lineStart = position;\n continue;\n\n case 0x000d:\n // \\r\n if (body.charCodeAt(position + 1) === 0x000a) {\n position += 2;\n } else {\n ++position;\n }\n\n ++lexer.line;\n lexer.lineStart = position;\n continue;\n // Comment\n\n case 0x0023:\n // #\n return readComment(lexer, position);\n // Token ::\n // - Punctuator\n // - Name\n // - IntValue\n // - FloatValue\n // - StringValue\n //\n // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | }\n\n case 0x0021:\n // !\n return createToken(lexer, TokenKind.BANG, position, position + 1);\n\n case 0x0024:\n // $\n return createToken(lexer, TokenKind.DOLLAR, position, position + 1);\n\n case 0x0026:\n // &\n return createToken(lexer, TokenKind.AMP, position, position + 1);\n\n case 0x0028:\n // (\n return createToken(lexer, TokenKind.PAREN_L, position, position + 1);\n\n case 0x0029:\n // )\n return createToken(lexer, TokenKind.PAREN_R, position, position + 1);\n\n case 0x002e:\n // .\n if (\n body.charCodeAt(position + 1) === 0x002e &&\n body.charCodeAt(position + 2) === 0x002e\n ) {\n return createToken(lexer, TokenKind.SPREAD, position, position + 3);\n }\n\n break;\n\n case 0x003a:\n // :\n return createToken(lexer, TokenKind.COLON, position, position + 1);\n\n case 0x003d:\n // =\n return createToken(lexer, TokenKind.EQUALS, position, position + 1);\n\n case 0x0040:\n // @\n return createToken(lexer, TokenKind.AT, position, position + 1);\n\n case 0x005b:\n // [\n return createToken(lexer, TokenKind.BRACKET_L, position, position + 1);\n\n case 0x005d:\n // ]\n return createToken(lexer, TokenKind.BRACKET_R, position, position + 1);\n\n case 0x007b:\n // {\n return createToken(lexer, TokenKind.BRACE_L, position, position + 1);\n\n case 0x007c:\n // |\n return createToken(lexer, TokenKind.PIPE, position, position + 1);\n\n case 0x007d:\n // }\n return createToken(lexer, TokenKind.BRACE_R, position, position + 1);\n // StringValue\n\n case 0x0022:\n // \"\n if (\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022\n ) {\n return readBlockString(lexer, position);\n }\n\n return readString(lexer, position);\n } // IntValue | FloatValue (Digit | -)\n\n if (isDigit(code) || code === 0x002d) {\n return readNumber(lexer, position, code);\n } // Name\n\n if (isNameStart(code)) {\n return readName(lexer, position);\n }\n\n throw syntaxError(\n lexer.source,\n position,\n code === 0x0027\n ? 'Unexpected single quote character (\\'), did you mean to use a double quote (\")?'\n : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position)\n ? `Unexpected character: ${printCodePointAt(lexer, position)}.`\n : `Invalid character: ${printCodePointAt(lexer, position)}.`,\n );\n }\n\n return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength);\n}\n/**\n * Reads a comment token from the source file.\n *\n * ```\n * Comment :: # CommentChar* [lookahead != CommentChar]\n *\n * CommentChar :: SourceCharacter but not LineTerminator\n * ```\n */\n\nfunction readComment(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // LineTerminator (\\n | \\r)\n\n if (code === 0x000a || code === 0x000d) {\n break;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n break;\n }\n }\n\n return createToken(\n lexer,\n TokenKind.COMMENT,\n start,\n position,\n body.slice(start + 1, position),\n );\n}\n/**\n * Reads a number token from the source file, either a FloatValue or an IntValue\n * depending on whether a FractionalPart or ExponentPart is encountered.\n *\n * ```\n * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}]\n *\n * IntegerPart ::\n * - NegativeSign? 0\n * - NegativeSign? NonZeroDigit Digit*\n *\n * NegativeSign :: -\n *\n * NonZeroDigit :: Digit but not `0`\n *\n * FloatValue ::\n * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}]\n * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}]\n * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}]\n *\n * FractionalPart :: . Digit+\n *\n * ExponentPart :: ExponentIndicator Sign? Digit+\n *\n * ExponentIndicator :: one of `e` `E`\n *\n * Sign :: one of + -\n * ```\n */\n\nfunction readNumber(lexer, start, firstCode) {\n const body = lexer.source.body;\n let position = start;\n let code = firstCode;\n let isFloat = false; // NegativeSign (-)\n\n if (code === 0x002d) {\n code = body.charCodeAt(++position);\n } // Zero (0)\n\n if (code === 0x0030) {\n code = body.charCodeAt(++position);\n\n if (isDigit(code)) {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid number, unexpected digit after 0: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n } else {\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // Full stop (.)\n\n if (code === 0x002e) {\n isFloat = true;\n code = body.charCodeAt(++position);\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // E e\n\n if (code === 0x0045 || code === 0x0065) {\n isFloat = true;\n code = body.charCodeAt(++position); // + -\n\n if (code === 0x002b || code === 0x002d) {\n code = body.charCodeAt(++position);\n }\n\n position = readDigits(lexer, position, code);\n code = body.charCodeAt(position);\n } // Numbers cannot be followed by . or NameStart\n\n if (code === 0x002e || isNameStart(code)) {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid number, expected digit but got: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n\n return createToken(\n lexer,\n isFloat ? TokenKind.FLOAT : TokenKind.INT,\n start,\n position,\n body.slice(start, position),\n );\n}\n/**\n * Returns the new position in the source after reading one or more digits.\n */\n\nfunction readDigits(lexer, start, firstCode) {\n if (!isDigit(firstCode)) {\n throw syntaxError(\n lexer.source,\n start,\n `Invalid number, expected digit but got: ${printCodePointAt(\n lexer,\n start,\n )}.`,\n );\n }\n\n const body = lexer.source.body;\n let position = start + 1; // +1 to skip first firstCode\n\n while (isDigit(body.charCodeAt(position))) {\n ++position;\n }\n\n return position;\n}\n/**\n * Reads a single-quote string token from the source file.\n *\n * ```\n * StringValue ::\n * - `\"\"` [lookahead != `\"`]\n * - `\"` StringCharacter+ `\"`\n *\n * StringCharacter ::\n * - SourceCharacter but not `\"` or `\\` or LineTerminator\n * - `\\u` EscapedUnicode\n * - `\\` EscapedCharacter\n *\n * EscapedUnicode ::\n * - `{` HexDigit+ `}`\n * - HexDigit HexDigit HexDigit HexDigit\n *\n * EscapedCharacter :: one of `\"` `\\` `/` `b` `f` `n` `r` `t`\n * ```\n */\n\nfunction readString(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n let chunkStart = position;\n let value = '';\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // Closing Quote (\")\n\n if (code === 0x0022) {\n value += body.slice(chunkStart, position);\n return createToken(lexer, TokenKind.STRING, start, position + 1, value);\n } // Escape Sequence (\\)\n\n if (code === 0x005c) {\n value += body.slice(chunkStart, position);\n const escape =\n body.charCodeAt(position + 1) === 0x0075 // u\n ? body.charCodeAt(position + 2) === 0x007b // {\n ? readEscapedUnicodeVariableWidth(lexer, position)\n : readEscapedUnicodeFixedWidth(lexer, position)\n : readEscapedCharacter(lexer, position);\n value += escape.value;\n position += escape.size;\n chunkStart = position;\n continue;\n } // LineTerminator (\\n | \\r)\n\n if (code === 0x000a || code === 0x000d) {\n break;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character within String: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n }\n\n throw syntaxError(lexer.source, position, 'Unterminated string.');\n} // The string value and lexed size of an escape sequence.\n\nfunction readEscapedUnicodeVariableWidth(lexer, position) {\n const body = lexer.source.body;\n let point = 0;\n let size = 3; // Cannot be larger than 12 chars (\\u{00000000}).\n\n while (size < 12) {\n const code = body.charCodeAt(position + size++); // Closing Brace (})\n\n if (code === 0x007d) {\n // Must be at least 5 chars (\\u{0}) and encode a Unicode scalar value.\n if (size < 5 || !isUnicodeScalarValue(point)) {\n break;\n }\n\n return {\n value: String.fromCodePoint(point),\n size,\n };\n } // Append this hex digit to the code point.\n\n point = (point << 4) | readHexDigit(code);\n\n if (point < 0) {\n break;\n }\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid Unicode escape sequence: \"${body.slice(\n position,\n position + size,\n )}\".`,\n );\n}\n\nfunction readEscapedUnicodeFixedWidth(lexer, position) {\n const body = lexer.source.body;\n const code = read16BitHexCode(body, position + 2);\n\n if (isUnicodeScalarValue(code)) {\n return {\n value: String.fromCodePoint(code),\n size: 6,\n };\n } // GraphQL allows JSON-style surrogate pair escape sequences, but only when\n // a valid pair is formed.\n\n if (isLeadingSurrogate(code)) {\n // \\u\n if (\n body.charCodeAt(position + 6) === 0x005c &&\n body.charCodeAt(position + 7) === 0x0075\n ) {\n const trailingCode = read16BitHexCode(body, position + 8);\n\n if (isTrailingSurrogate(trailingCode)) {\n // JavaScript defines strings as a sequence of UTF-16 code units and\n // encodes Unicode code points above U+FFFF using a surrogate pair of\n // code units. Since this is a surrogate pair escape sequence, just\n // include both codes into the JavaScript string value. Had JavaScript\n // not been internally based on UTF-16, then this surrogate pair would\n // be decoded to retrieve the supplementary code point.\n return {\n value: String.fromCodePoint(code, trailingCode),\n size: 12,\n };\n }\n }\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid Unicode escape sequence: \"${body.slice(position, position + 6)}\".`,\n );\n}\n/**\n * Reads four hexadecimal characters and returns the positive integer that 16bit\n * hexadecimal string represents. For example, \"000f\" will return 15, and \"dead\"\n * will return 57005.\n *\n * Returns a negative number if any char was not a valid hexadecimal digit.\n */\n\nfunction read16BitHexCode(body, position) {\n // readHexDigit() returns -1 on error. ORing a negative value with any other\n // value always produces a negative value.\n return (\n (readHexDigit(body.charCodeAt(position)) << 12) |\n (readHexDigit(body.charCodeAt(position + 1)) << 8) |\n (readHexDigit(body.charCodeAt(position + 2)) << 4) |\n readHexDigit(body.charCodeAt(position + 3))\n );\n}\n/**\n * Reads a hexadecimal character and returns its positive integer value (0-15).\n *\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 if the provided character code was not a valid hexadecimal digit.\n *\n * HexDigit :: one of\n * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9`\n * - `A` `B` `C` `D` `E` `F`\n * - `a` `b` `c` `d` `e` `f`\n */\n\nfunction readHexDigit(code) {\n return code >= 0x0030 && code <= 0x0039 // 0-9\n ? code - 0x0030\n : code >= 0x0041 && code <= 0x0046 // A-F\n ? code - 0x0037\n : code >= 0x0061 && code <= 0x0066 // a-f\n ? code - 0x0057\n : -1;\n}\n/**\n * | Escaped Character | Code Point | Character Name |\n * | ----------------- | ---------- | ---------------------------- |\n * | `\"` | U+0022 | double quote |\n * | `\\` | U+005C | reverse solidus (back slash) |\n * | `/` | U+002F | solidus (forward slash) |\n * | `b` | U+0008 | backspace |\n * | `f` | U+000C | form feed |\n * | `n` | U+000A | line feed (new line) |\n * | `r` | U+000D | carriage return |\n * | `t` | U+0009 | horizontal tab |\n */\n\nfunction readEscapedCharacter(lexer, position) {\n const body = lexer.source.body;\n const code = body.charCodeAt(position + 1);\n\n switch (code) {\n case 0x0022:\n // \"\n return {\n value: '\\u0022',\n size: 2,\n };\n\n case 0x005c:\n // \\\n return {\n value: '\\u005c',\n size: 2,\n };\n\n case 0x002f:\n // /\n return {\n value: '\\u002f',\n size: 2,\n };\n\n case 0x0062:\n // b\n return {\n value: '\\u0008',\n size: 2,\n };\n\n case 0x0066:\n // f\n return {\n value: '\\u000c',\n size: 2,\n };\n\n case 0x006e:\n // n\n return {\n value: '\\u000a',\n size: 2,\n };\n\n case 0x0072:\n // r\n return {\n value: '\\u000d',\n size: 2,\n };\n\n case 0x0074:\n // t\n return {\n value: '\\u0009',\n size: 2,\n };\n }\n\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character escape sequence: \"${body.slice(\n position,\n position + 2,\n )}\".`,\n );\n}\n/**\n * Reads a block string token from the source file.\n *\n * ```\n * StringValue ::\n * - `\"\"\"` BlockStringCharacter* `\"\"\"`\n *\n * BlockStringCharacter ::\n * - SourceCharacter but not `\"\"\"` or `\\\"\"\"`\n * - `\\\"\"\"`\n * ```\n */\n\nfunction readBlockString(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let lineStart = lexer.lineStart;\n let position = start + 3;\n let chunkStart = position;\n let currentLine = '';\n const blockLines = [];\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position); // Closing Triple-Quote (\"\"\")\n\n if (\n code === 0x0022 &&\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022\n ) {\n currentLine += body.slice(chunkStart, position);\n blockLines.push(currentLine);\n const token = createToken(\n lexer,\n TokenKind.BLOCK_STRING,\n start,\n position + 3, // Return a string of the lines joined with U+000A.\n dedentBlockStringLines(blockLines).join('\\n'),\n );\n lexer.line += blockLines.length - 1;\n lexer.lineStart = lineStart;\n return token;\n } // Escaped Triple-Quote (\\\"\"\")\n\n if (\n code === 0x005c &&\n body.charCodeAt(position + 1) === 0x0022 &&\n body.charCodeAt(position + 2) === 0x0022 &&\n body.charCodeAt(position + 3) === 0x0022\n ) {\n currentLine += body.slice(chunkStart, position);\n chunkStart = position + 1; // skip only slash\n\n position += 4;\n continue;\n } // LineTerminator\n\n if (code === 0x000a || code === 0x000d) {\n currentLine += body.slice(chunkStart, position);\n blockLines.push(currentLine);\n\n if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) {\n position += 2;\n } else {\n ++position;\n }\n\n currentLine = '';\n chunkStart = position;\n lineStart = position;\n continue;\n } // SourceCharacter\n\n if (isUnicodeScalarValue(code)) {\n ++position;\n } else if (isSupplementaryCodePoint(body, position)) {\n position += 2;\n } else {\n throw syntaxError(\n lexer.source,\n position,\n `Invalid character within String: ${printCodePointAt(\n lexer,\n position,\n )}.`,\n );\n }\n }\n\n throw syntaxError(lexer.source, position, 'Unterminated string.');\n}\n/**\n * Reads an alphanumeric + underscore name from the source.\n *\n * ```\n * Name ::\n * - NameStart NameContinue* [lookahead != NameContinue]\n * ```\n *\n * @internal\n */\n\nexport function readName(lexer, start) {\n const body = lexer.source.body;\n const bodyLength = body.length;\n let position = start + 1;\n\n while (position < bodyLength) {\n const code = body.charCodeAt(position);\n\n if (isNameContinue(code)) {\n ++position;\n } else {\n break;\n }\n }\n\n return createToken(\n lexer,\n TokenKind.NAME,\n start,\n position,\n body.slice(start, position),\n );\n}\n","const MAX_ARRAY_LENGTH = 10;\nconst MAX_RECURSIVE_DEPTH = 2;\n/**\n * Used to print values in error messages.\n */\n\nexport 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 ${value.name}]` : '[function]';\n\n case 'object':\n return formatObjectValue(value, seenValues);\n\n default:\n return String(value);\n }\n}\n\nfunction formatObjectValue(value, previouslySeenValues) {\n if (value === null) {\n return 'null';\n }\n\n if (previouslySeenValues.includes(value)) {\n return '[Circular]';\n }\n\n const seenValues = [...previouslySeenValues, value];\n\n if (isJSONable(value)) {\n const jsonValue = value.toJSON(); // check for infinite recursion\n\n if (jsonValue !== value) {\n return typeof jsonValue === 'string'\n ? jsonValue\n : formatValue(jsonValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n}\n\nfunction isJSONable(value) {\n return typeof value.toJSON === 'function';\n}\n\nfunction formatObject(object, seenValues) {\n const entries = Object.entries(object);\n\n if (entries.length === 0) {\n return '{}';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[' + getObjectTag(object) + ']';\n }\n\n const properties = entries.map(\n ([key, value]) => key + ': ' + formatValue(value, seenValues),\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 const len = Math.min(MAX_ARRAY_LENGTH, array.length);\n const remaining = array.length - len;\n const items = [];\n\n for (let 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(`... ${remaining} more items`);\n }\n\n return '[' + items.join(', ') + ']';\n}\n\nfunction getObjectTag(object) {\n const tag = Object.prototype.toString\n .call(object)\n .replace(/^\\[object /, '')\n .replace(/]$/, '');\n\n if (tag === 'Object' && typeof object.constructor === 'function') {\n const name = object.constructor.name;\n\n if (typeof name === 'string' && name !== '') {\n return name;\n }\n }\n\n return tag;\n}\n","import { inspect } from './inspect.mjs';\n/* c8 ignore next 3 */\n\nconst isProduction =\n globalThis.process && // eslint-disable-next-line no-undef\n process.env.NODE_ENV === 'production';\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n * See: https://webpack.js.org/guides/production/\n */\n\nexport const instanceOf =\n /* c8 ignore next 6 */\n // FIXME: https://github.com/graphql/graphql-js/issues/2317\n isProduction\n ? function instanceOf(value, constructor) {\n return value instanceof constructor;\n }\n : function 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 // Prefer Symbol.toStringTag since it is immune to minification.\n const className = constructor.prototype[Symbol.toStringTag];\n const valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009\n ? value[Symbol.toStringTag]\n : (_value$constructor = value.constructor) === null ||\n _value$constructor === void 0\n ? void 0\n : _value$constructor.name;\n\n if (className === valueClassName) {\n const stringifiedValue = inspect(value);\n throw new Error(`Cannot use ${className} \"${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","import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.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 class Source {\n constructor(\n body,\n name = 'GraphQL request',\n locationOffset = {\n line: 1,\n column: 1,\n },\n ) {\n typeof body === 'string' ||\n devAssert(false, `Body must be a string. Received: ${inspect(body)}.`);\n this.body = body;\n this.name = name;\n this.locationOffset = locationOffset;\n this.locationOffset.line > 0 ||\n devAssert(\n false,\n 'line in locationOffset is 1-indexed and must be positive.',\n );\n this.locationOffset.column > 0 ||\n devAssert(\n false,\n 'column in locationOffset is 1-indexed and must be positive.',\n );\n }\n\n get [Symbol.toStringTag]() {\n return 'Source';\n }\n}\n/**\n * Test if the given value is a Source object.\n *\n * @internal\n */\n\nexport function isSource(source) {\n return instanceOf(source, Source);\n}\n","import { syntaxError } from '../error/syntaxError.mjs';\nimport { Location, OperationTypeNode } from './ast.mjs';\nimport { DirectiveLocation } from './directiveLocation.mjs';\nimport { Kind } from './kinds.mjs';\nimport { isPunctuatorTokenKind, Lexer } from './lexer.mjs';\nimport { SchemaCoordinateLexer } from './schemaCoordinateLexer.mjs';\nimport { isSource, Source } from './source.mjs';\nimport { TokenKind } from './tokenKind.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 const parser = new Parser(source, options);\n const document = parser.parseDocument();\n Object.defineProperty(document, 'tokenCount', {\n enumerable: false,\n value: parser.tokenCount,\n });\n return document;\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 const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const value = parser.parseValueLiteral(false);\n parser.expectToken(TokenKind.EOF);\n return value;\n}\n/**\n * Similar to parseValue(), but raises a parse error if it encounters a\n * variable. The return type will be a constant value.\n */\n\nexport function parseConstValue(source, options) {\n const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const value = parser.parseConstValueLiteral();\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 const parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n const type = parser.parseTypeReference();\n parser.expectToken(TokenKind.EOF);\n return type;\n}\n/**\n * Given a string containing a GraphQL Schema Coordinate (ex. `Type.field`),\n * parse the AST for that schema coordinate.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * Consider providing the results to the utility function:\n * resolveASTSchemaCoordinate(). Or calling resolveSchemaCoordinate() directly\n * with an unparsed source.\n */\n\nexport function parseSchemaCoordinate(source) {\n const sourceObj = isSource(source) ? source : new Source(source);\n const lexer = new SchemaCoordinateLexer(sourceObj);\n const parser = new Parser(source, {\n lexer,\n });\n parser.expectToken(TokenKind.SOF);\n const coordinate = parser.parseSchemaCoordinate();\n parser.expectToken(TokenKind.EOF);\n return coordinate;\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 class Parser {\n constructor(source, options = {}) {\n const { lexer, ..._options } = options;\n\n if (lexer) {\n this._lexer = lexer;\n } else {\n const sourceObj = isSource(source) ? source : new Source(source);\n this._lexer = new Lexer(sourceObj);\n }\n\n this._options = _options;\n this._tokenCounter = 0;\n }\n\n get tokenCount() {\n return this._tokenCounter;\n }\n /**\n * Converts a name lex token into a name parse node.\n */\n\n parseName() {\n const token = this.expectToken(TokenKind.NAME);\n return this.node(token, {\n kind: Kind.NAME,\n value: token.value,\n });\n } // Implements the parsing rules in the Document section.\n\n /**\n * Document : Definition+\n */\n\n parseDocument() {\n return this.node(this._lexer.token, {\n kind: Kind.DOCUMENT,\n definitions: this.many(\n TokenKind.SOF,\n this.parseDefinition,\n TokenKind.EOF,\n ),\n });\n }\n /**\n * Definition :\n * - ExecutableDefinition\n * - TypeSystemDefinition\n * - TypeSystemExtension\n *\n * ExecutableDefinition :\n * - OperationDefinition\n * - FragmentDefinition\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 parseDefinition() {\n if (this.peek(TokenKind.BRACE_L)) {\n return this.parseOperationDefinition();\n } // Many definitions begin with a description and require a lookahead.\n\n const hasDescription = this.peekDescription();\n const keywordToken = hasDescription\n ? this._lexer.lookahead()\n : this._lexer.token;\n\n if (hasDescription && keywordToken.kind === TokenKind.BRACE_L) {\n throw syntaxError(\n this._lexer.source,\n this._lexer.token.start,\n 'Unexpected description, descriptions are not supported on shorthand queries.',\n );\n }\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 switch (keywordToken.value) {\n case 'query':\n case 'mutation':\n case 'subscription':\n return this.parseOperationDefinition();\n\n case 'fragment':\n return this.parseFragmentDefinition();\n }\n\n if (hasDescription) {\n throw syntaxError(\n this._lexer.source,\n this._lexer.token.start,\n 'Unexpected description, only GraphQL definitions support descriptions.',\n );\n }\n\n switch (keywordToken.value) {\n case 'extend':\n return this.parseTypeSystemExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n } // Implements the parsing rules in the Operations section.\n\n /**\n * OperationDefinition :\n * - SelectionSet\n * - OperationType Name? VariableDefinitions? Directives? SelectionSet\n */\n\n parseOperationDefinition() {\n const start = this._lexer.token;\n\n if (this.peek(TokenKind.BRACE_L)) {\n return this.node(start, {\n kind: Kind.OPERATION_DEFINITION,\n operation: OperationTypeNode.QUERY,\n description: undefined,\n name: undefined,\n variableDefinitions: [],\n directives: [],\n selectionSet: this.parseSelectionSet(),\n });\n }\n\n const description = this.parseDescription();\n const operation = this.parseOperationType();\n let name;\n\n if (this.peek(TokenKind.NAME)) {\n name = this.parseName();\n }\n\n return this.node(start, {\n kind: Kind.OPERATION_DEFINITION,\n operation,\n description,\n name,\n variableDefinitions: this.parseVariableDefinitions(),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * OperationType : one of query mutation subscription\n */\n\n parseOperationType() {\n const operationToken = this.expectToken(TokenKind.NAME);\n\n switch (operationToken.value) {\n case 'query':\n return OperationTypeNode.QUERY;\n\n case 'mutation':\n return OperationTypeNode.MUTATION;\n\n case 'subscription':\n return OperationTypeNode.SUBSCRIPTION;\n }\n\n throw this.unexpected(operationToken);\n }\n /**\n * VariableDefinitions : ( VariableDefinition+ )\n */\n\n parseVariableDefinitions() {\n return this.optionalMany(\n TokenKind.PAREN_L,\n this.parseVariableDefinition,\n TokenKind.PAREN_R,\n );\n }\n /**\n * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?\n */\n\n parseVariableDefinition() {\n return this.node(this._lexer.token, {\n kind: Kind.VARIABLE_DEFINITION,\n description: this.parseDescription(),\n variable: this.parseVariable(),\n type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),\n defaultValue: this.expectOptionalToken(TokenKind.EQUALS)\n ? this.parseConstValueLiteral()\n : undefined,\n directives: this.parseConstDirectives(),\n });\n }\n /**\n * Variable : $ Name\n */\n\n parseVariable() {\n const start = this._lexer.token;\n this.expectToken(TokenKind.DOLLAR);\n return this.node(start, {\n kind: Kind.VARIABLE,\n name: this.parseName(),\n });\n }\n /**\n * ```\n * SelectionSet : { Selection+ }\n * ```\n */\n\n parseSelectionSet() {\n return this.node(this._lexer.token, {\n kind: Kind.SELECTION_SET,\n selections: this.many(\n TokenKind.BRACE_L,\n this.parseSelection,\n TokenKind.BRACE_R,\n ),\n });\n }\n /**\n * Selection :\n * - Field\n * - FragmentSpread\n * - InlineFragment\n */\n\n parseSelection() {\n return this.peek(TokenKind.SPREAD)\n ? this.parseFragment()\n : this.parseField();\n }\n /**\n * Field : Alias? Name Arguments? Directives? SelectionSet?\n *\n * Alias : Name :\n */\n\n parseField() {\n const start = this._lexer.token;\n const nameOrAlias = this.parseName();\n let alias;\n let name;\n\n if (this.expectOptionalToken(TokenKind.COLON)) {\n alias = nameOrAlias;\n name = this.parseName();\n } else {\n name = nameOrAlias;\n }\n\n return this.node(start, {\n kind: Kind.FIELD,\n alias,\n name,\n arguments: this.parseArguments(false),\n directives: this.parseDirectives(false),\n selectionSet: this.peek(TokenKind.BRACE_L)\n ? this.parseSelectionSet()\n : undefined,\n });\n }\n /**\n * Arguments[Const] : ( Argument[?Const]+ )\n */\n\n parseArguments(isConst) {\n const 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 parseArgument(isConst = false) {\n const start = this._lexer.token;\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return this.node(start, {\n kind: Kind.ARGUMENT,\n name,\n value: this.parseValueLiteral(isConst),\n });\n }\n\n parseConstArgument() {\n return this.parseArgument(true);\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 parseFragment() {\n const start = this._lexer.token;\n this.expectToken(TokenKind.SPREAD);\n const hasTypeCondition = this.expectOptionalKeyword('on');\n\n if (!hasTypeCondition && this.peek(TokenKind.NAME)) {\n return this.node(start, {\n kind: Kind.FRAGMENT_SPREAD,\n name: this.parseFragmentName(),\n directives: this.parseDirectives(false),\n });\n }\n\n return this.node(start, {\n kind: Kind.INLINE_FRAGMENT,\n typeCondition: hasTypeCondition ? this.parseNamedType() : undefined,\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * FragmentDefinition :\n * - fragment FragmentName on TypeCondition Directives? SelectionSet\n *\n * TypeCondition : NamedType\n */\n\n parseFragmentDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('fragment'); // Legacy 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.allowLegacyFragmentVariables === true) {\n return this.node(start, {\n kind: Kind.FRAGMENT_DEFINITION,\n description,\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 });\n }\n\n return this.node(start, {\n kind: Kind.FRAGMENT_DEFINITION,\n description,\n name: this.parseFragmentName(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n });\n }\n /**\n * FragmentName : Name but not `on`\n */\n\n 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 parseValueLiteral(isConst) {\n const 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.advanceLexer();\n return this.node(token, {\n kind: Kind.INT,\n value: token.value,\n });\n\n case TokenKind.FLOAT:\n this.advanceLexer();\n return this.node(token, {\n kind: Kind.FLOAT,\n value: token.value,\n });\n\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n return this.parseStringLiteral();\n\n case TokenKind.NAME:\n this.advanceLexer();\n\n switch (token.value) {\n case 'true':\n return this.node(token, {\n kind: Kind.BOOLEAN,\n value: true,\n });\n\n case 'false':\n return this.node(token, {\n kind: Kind.BOOLEAN,\n value: false,\n });\n\n case 'null':\n return this.node(token, {\n kind: Kind.NULL,\n });\n\n default:\n return this.node(token, {\n kind: Kind.ENUM,\n value: token.value,\n });\n }\n\n case TokenKind.DOLLAR:\n if (isConst) {\n this.expectToken(TokenKind.DOLLAR);\n\n if (this._lexer.token.kind === TokenKind.NAME) {\n const varName = this._lexer.token.value;\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Unexpected variable \"$${varName}\" in constant value.`,\n );\n } else {\n throw this.unexpected(token);\n }\n }\n\n return this.parseVariable();\n\n default:\n throw this.unexpected();\n }\n }\n\n parseConstValueLiteral() {\n return this.parseValueLiteral(true);\n }\n\n parseStringLiteral() {\n const token = this._lexer.token;\n this.advanceLexer();\n return this.node(token, {\n kind: Kind.STRING,\n value: token.value,\n block: token.kind === TokenKind.BLOCK_STRING,\n });\n }\n /**\n * ListValue[Const] :\n * - [ ]\n * - [ Value[?Const]+ ]\n */\n\n parseList(isConst) {\n const item = () => this.parseValueLiteral(isConst);\n\n return this.node(this._lexer.token, {\n kind: Kind.LIST,\n values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),\n });\n }\n /**\n * ```\n * ObjectValue[Const] :\n * - { }\n * - { ObjectField[?Const]+ }\n * ```\n */\n\n parseObject(isConst) {\n const item = () => this.parseObjectField(isConst);\n\n return this.node(this._lexer.token, {\n kind: Kind.OBJECT,\n fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R),\n });\n }\n /**\n * ObjectField[Const] : Name : Value[?Const]\n */\n\n parseObjectField(isConst) {\n const start = this._lexer.token;\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return this.node(start, {\n kind: Kind.OBJECT_FIELD,\n name,\n value: this.parseValueLiteral(isConst),\n });\n } // Implements the parsing rules in the Directives section.\n\n /**\n * Directives[Const] : Directive[?Const]+\n */\n\n parseDirectives(isConst) {\n const directives = [];\n\n while (this.peek(TokenKind.AT)) {\n directives.push(this.parseDirective(isConst));\n }\n\n return directives;\n }\n\n parseConstDirectives() {\n return this.parseDirectives(true);\n }\n /**\n * ```\n * Directive[Const] : @ Name Arguments[?Const]?\n * ```\n */\n\n parseDirective(isConst) {\n const start = this._lexer.token;\n this.expectToken(TokenKind.AT);\n return this.node(start, {\n kind: Kind.DIRECTIVE,\n name: this.parseName(),\n arguments: this.parseArguments(isConst),\n });\n } // Implements the parsing rules in the Types section.\n\n /**\n * Type :\n * - NamedType\n * - ListType\n * - NonNullType\n */\n\n parseTypeReference() {\n const start = this._lexer.token;\n let type;\n\n if (this.expectOptionalToken(TokenKind.BRACKET_L)) {\n const innerType = this.parseTypeReference();\n this.expectToken(TokenKind.BRACKET_R);\n type = this.node(start, {\n kind: Kind.LIST_TYPE,\n type: innerType,\n });\n } else {\n type = this.parseNamedType();\n }\n\n if (this.expectOptionalToken(TokenKind.BANG)) {\n return this.node(start, {\n kind: Kind.NON_NULL_TYPE,\n type,\n });\n }\n\n return type;\n }\n /**\n * NamedType : Name\n */\n\n parseNamedType() {\n return this.node(this._lexer.token, {\n kind: Kind.NAMED_TYPE,\n name: this.parseName(),\n });\n } // Implements the parsing rules in the Type Definition section.\n\n peekDescription() {\n return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);\n }\n /**\n * Description : StringValue\n */\n\n parseDescription() {\n if (this.peekDescription()) {\n return this.parseStringLiteral();\n }\n }\n /**\n * ```\n * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }\n * ```\n */\n\n parseSchemaDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('schema');\n const directives = this.parseConstDirectives();\n const operationTypes = this.many(\n TokenKind.BRACE_L,\n this.parseOperationTypeDefinition,\n TokenKind.BRACE_R,\n );\n return this.node(start, {\n kind: Kind.SCHEMA_DEFINITION,\n description,\n directives,\n operationTypes,\n });\n }\n /**\n * OperationTypeDefinition : OperationType : NamedType\n */\n\n parseOperationTypeDefinition() {\n const start = this._lexer.token;\n const operation = this.parseOperationType();\n this.expectToken(TokenKind.COLON);\n const type = this.parseNamedType();\n return this.node(start, {\n kind: Kind.OPERATION_TYPE_DEFINITION,\n operation,\n type,\n });\n }\n /**\n * ScalarTypeDefinition : Description? scalar Name Directives[Const]?\n */\n\n parseScalarTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('scalar');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.SCALAR_TYPE_DEFINITION,\n description,\n name,\n directives,\n });\n }\n /**\n * ObjectTypeDefinition :\n * Description?\n * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?\n */\n\n parseObjectTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('type');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n return this.node(start, {\n kind: Kind.OBJECT_TYPE_DEFINITION,\n description,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * ImplementsInterfaces :\n * - implements `&`? NamedType\n * - ImplementsInterfaces & NamedType\n */\n\n parseImplementsInterfaces() {\n return this.expectOptionalKeyword('implements')\n ? this.delimitedMany(TokenKind.AMP, this.parseNamedType)\n : [];\n }\n /**\n * ```\n * FieldsDefinition : { FieldDefinition+ }\n * ```\n */\n\n parseFieldsDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseFieldDefinition,\n TokenKind.BRACE_R,\n );\n }\n /**\n * FieldDefinition :\n * - Description? Name ArgumentsDefinition? : Type Directives[Const]?\n */\n\n parseFieldDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseName();\n const args = this.parseArgumentDefs();\n this.expectToken(TokenKind.COLON);\n const type = this.parseTypeReference();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.FIELD_DEFINITION,\n description,\n name,\n arguments: args,\n type,\n directives,\n });\n }\n /**\n * ArgumentsDefinition : ( InputValueDefinition+ )\n */\n\n parseArgumentDefs() {\n return this.optionalMany(\n TokenKind.PAREN_L,\n this.parseInputValueDef,\n TokenKind.PAREN_R,\n );\n }\n /**\n * InputValueDefinition :\n * - Description? Name : Type DefaultValue? Directives[Const]?\n */\n\n parseInputValueDef() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseName();\n this.expectToken(TokenKind.COLON);\n const type = this.parseTypeReference();\n let defaultValue;\n\n if (this.expectOptionalToken(TokenKind.EQUALS)) {\n defaultValue = this.parseConstValueLiteral();\n }\n\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.INPUT_VALUE_DEFINITION,\n description,\n name,\n type,\n defaultValue,\n directives,\n });\n }\n /**\n * InterfaceTypeDefinition :\n * - Description? interface Name Directives[Const]? FieldsDefinition?\n */\n\n parseInterfaceTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('interface');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n return this.node(start, {\n kind: Kind.INTERFACE_TYPE_DEFINITION,\n description,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * UnionTypeDefinition :\n * - Description? union Name Directives[Const]? UnionMemberTypes?\n */\n\n parseUnionTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('union');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const types = this.parseUnionMemberTypes();\n return this.node(start, {\n kind: Kind.UNION_TYPE_DEFINITION,\n description,\n name,\n directives,\n types,\n });\n }\n /**\n * UnionMemberTypes :\n * - = `|`? NamedType\n * - UnionMemberTypes | NamedType\n */\n\n parseUnionMemberTypes() {\n return this.expectOptionalToken(TokenKind.EQUALS)\n ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType)\n : [];\n }\n /**\n * EnumTypeDefinition :\n * - Description? enum Name Directives[Const]? EnumValuesDefinition?\n */\n\n parseEnumTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('enum');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const values = this.parseEnumValuesDefinition();\n return this.node(start, {\n kind: Kind.ENUM_TYPE_DEFINITION,\n description,\n name,\n directives,\n values,\n });\n }\n /**\n * ```\n * EnumValuesDefinition : { EnumValueDefinition+ }\n * ```\n */\n\n parseEnumValuesDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseEnumValueDefinition,\n TokenKind.BRACE_R,\n );\n }\n /**\n * EnumValueDefinition : Description? EnumValue Directives[Const]?\n */\n\n parseEnumValueDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n const name = this.parseEnumValueName();\n const directives = this.parseConstDirectives();\n return this.node(start, {\n kind: Kind.ENUM_VALUE_DEFINITION,\n description,\n name,\n directives,\n });\n }\n /**\n * EnumValue : Name but not `true`, `false` or `null`\n */\n\n parseEnumValueName() {\n if (\n this._lexer.token.value === 'true' ||\n this._lexer.token.value === 'false' ||\n this._lexer.token.value === 'null'\n ) {\n throw syntaxError(\n this._lexer.source,\n this._lexer.token.start,\n `${getTokenDesc(\n this._lexer.token,\n )} is reserved and cannot be used for an enum value.`,\n );\n }\n\n return this.parseName();\n }\n /**\n * InputObjectTypeDefinition :\n * - Description? input Name Directives[Const]? InputFieldsDefinition?\n */\n\n parseInputObjectTypeDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('input');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const fields = this.parseInputFieldsDefinition();\n return this.node(start, {\n kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,\n description,\n name,\n directives,\n fields,\n });\n }\n /**\n * ```\n * InputFieldsDefinition : { InputValueDefinition+ }\n * ```\n */\n\n parseInputFieldsDefinition() {\n return this.optionalMany(\n TokenKind.BRACE_L,\n this.parseInputValueDef,\n TokenKind.BRACE_R,\n );\n }\n /**\n * TypeSystemExtension :\n * - SchemaExtension\n * - TypeExtension\n *\n * TypeExtension :\n * - ScalarTypeExtension\n * - ObjectTypeExtension\n * - InterfaceTypeExtension\n * - UnionTypeExtension\n * - EnumTypeExtension\n * - InputObjectTypeDefinition\n * - DirectiveDefinitionExtension\n */\n\n parseTypeSystemExtension() {\n const 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 case 'directive':\n if (this._options.experimentalDirectivesOnDirectiveDefinitions) {\n return this.parseDirectiveDefinitionExtension();\n }\n\n break;\n }\n }\n\n throw this.unexpected(keywordToken);\n }\n /**\n * ```\n * SchemaExtension :\n * - extend schema Directives[Const]? { OperationTypeDefinition+ }\n * - extend schema Directives[Const]\n * ```\n */\n\n parseSchemaExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('schema');\n const directives = this.parseConstDirectives();\n const operationTypes = this.optionalMany(\n TokenKind.BRACE_L,\n this.parseOperationTypeDefinition,\n TokenKind.BRACE_R,\n );\n\n if (directives.length === 0 && operationTypes.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.SCHEMA_EXTENSION,\n directives,\n operationTypes,\n });\n }\n /**\n * ScalarTypeExtension :\n * - extend scalar Name Directives[Const]\n */\n\n parseScalarTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('scalar');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n\n if (directives.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.SCALAR_TYPE_EXTENSION,\n name,\n directives,\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 parseObjectTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('type');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n\n if (\n interfaces.length === 0 &&\n directives.length === 0 &&\n fields.length === 0\n ) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.OBJECT_TYPE_EXTENSION,\n name,\n interfaces,\n directives,\n fields,\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 parseInterfaceTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('interface');\n const name = this.parseName();\n const interfaces = this.parseImplementsInterfaces();\n const directives = this.parseConstDirectives();\n const fields = this.parseFieldsDefinition();\n\n if (\n interfaces.length === 0 &&\n directives.length === 0 &&\n fields.length === 0\n ) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.INTERFACE_TYPE_EXTENSION,\n name,\n interfaces,\n directives,\n fields,\n });\n }\n /**\n * UnionTypeExtension :\n * - extend union Name Directives[Const]? UnionMemberTypes\n * - extend union Name Directives[Const]\n */\n\n parseUnionTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('union');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const types = this.parseUnionMemberTypes();\n\n if (directives.length === 0 && types.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.UNION_TYPE_EXTENSION,\n name,\n directives,\n types,\n });\n }\n /**\n * EnumTypeExtension :\n * - extend enum Name Directives[Const]? EnumValuesDefinition\n * - extend enum Name Directives[Const]\n */\n\n parseEnumTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('enum');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const values = this.parseEnumValuesDefinition();\n\n if (directives.length === 0 && values.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.ENUM_TYPE_EXTENSION,\n name,\n directives,\n values,\n });\n }\n /**\n * InputObjectTypeExtension :\n * - extend input Name Directives[Const]? InputFieldsDefinition\n * - extend input Name Directives[Const]\n */\n\n parseInputObjectTypeExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('input');\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n const fields = this.parseInputFieldsDefinition();\n\n if (directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,\n name,\n directives,\n fields,\n });\n }\n\n parseDirectiveDefinitionExtension() {\n const start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('directive');\n this.expectToken(TokenKind.AT);\n const name = this.parseName();\n const directives = this.parseConstDirectives();\n\n if (directives.length === 0) {\n throw this.unexpected();\n }\n\n return this.node(start, {\n kind: Kind.DIRECTIVE_EXTENSION,\n name,\n directives,\n });\n }\n /**\n * ```\n * DirectiveDefinition :\n * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations\n * ```\n */\n\n parseDirectiveDefinition() {\n const start = this._lexer.token;\n const description = this.parseDescription();\n this.expectKeyword('directive');\n this.expectToken(TokenKind.AT);\n const name = this.parseName();\n const args = this.parseArgumentDefs();\n const directives = this._options\n .experimentalDirectivesOnDirectiveDefinitions\n ? this.parseConstDirectives()\n : [];\n const repeatable = this.expectOptionalKeyword('repeatable');\n this.expectKeyword('on');\n const locations = this.parseDirectiveLocations();\n return this.node(start, {\n kind: Kind.DIRECTIVE_DEFINITION,\n description,\n name,\n arguments: args,\n directives,\n repeatable,\n locations,\n });\n }\n /**\n * DirectiveLocations :\n * - `|`? DirectiveLocation\n * - DirectiveLocations | DirectiveLocation\n */\n\n 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 * `DIRECTIVE_DEFINITION`\n */\n\n parseDirectiveLocation() {\n const start = this._lexer.token;\n const name = this.parseName();\n\n if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) {\n return name;\n }\n\n throw this.unexpected(start);\n } // Schema Coordinates\n\n /**\n * SchemaCoordinate :\n * - Name\n * - Name . Name\n * - Name . Name ( Name : )\n * - \\@ Name\n * - \\@ Name ( Name : )\n */\n\n parseSchemaCoordinate() {\n const start = this._lexer.token;\n const ofDirective = this.expectOptionalToken(TokenKind.AT);\n const name = this.parseName();\n let memberName;\n\n if (!ofDirective && this.expectOptionalToken(TokenKind.DOT)) {\n memberName = this.parseName();\n }\n\n let argumentName;\n\n if (\n (ofDirective || memberName) &&\n this.expectOptionalToken(TokenKind.PAREN_L)\n ) {\n argumentName = this.parseName();\n this.expectToken(TokenKind.COLON);\n this.expectToken(TokenKind.PAREN_R);\n }\n\n if (ofDirective) {\n if (argumentName) {\n return this.node(start, {\n kind: Kind.DIRECTIVE_ARGUMENT_COORDINATE,\n name,\n argumentName,\n });\n }\n\n return this.node(start, {\n kind: Kind.DIRECTIVE_COORDINATE,\n name,\n });\n } else if (memberName) {\n if (argumentName) {\n return this.node(start, {\n kind: Kind.ARGUMENT_COORDINATE,\n name,\n fieldName: memberName,\n argumentName,\n });\n }\n\n return this.node(start, {\n kind: Kind.MEMBER_COORDINATE,\n name,\n memberName,\n });\n }\n\n return this.node(start, {\n kind: Kind.TYPE_COORDINATE,\n name,\n });\n } // Core parsing utility functions\n\n /**\n * Returns a node that, if configured to do so, sets a \"loc\" field as a\n * location object, used to identify the place in the source that created a\n * given parsed object.\n */\n\n node(startToken, node) {\n if (this._options.noLocation !== true) {\n node.loc = new Location(\n startToken,\n this._lexer.lastToken,\n this._lexer.source,\n );\n }\n\n return node;\n }\n /**\n * Determines if the next token is of a given kind\n */\n\n 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 expectToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this.advanceLexer();\n return token;\n }\n\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`,\n );\n }\n /**\n * If the next token is of the given kind, return \"true\" after advancing the lexer.\n * Otherwise, do not change the parser state and return \"false\".\n */\n\n expectOptionalToken(kind) {\n const token = this._lexer.token;\n\n if (token.kind === kind) {\n this.advanceLexer();\n return true;\n }\n\n return false;\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 expectKeyword(value) {\n const token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this.advanceLexer();\n } else {\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Expected \"${value}\", found ${getTokenDesc(token)}.`,\n );\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 expectOptionalKeyword(value) {\n const token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this.advanceLexer();\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 unexpected(atToken) {\n const token =\n atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;\n return syntaxError(\n this._lexer.source,\n token.start,\n `Unexpected ${getTokenDesc(token)}.`,\n );\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 any(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n const 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 optionalMany(openKind, parseFn, closeKind) {\n if (this.expectOptionalToken(openKind)) {\n const 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 many(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n const 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 delimitedMany(delimiterKind, parseFn) {\n this.expectOptionalToken(delimiterKind);\n const nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (this.expectOptionalToken(delimiterKind));\n\n return nodes;\n }\n\n advanceLexer() {\n const { maxTokens } = this._options;\n\n const token = this._lexer.advance();\n\n if (token.kind !== TokenKind.EOF) {\n ++this._tokenCounter;\n\n if (maxTokens !== undefined && this._tokenCounter > maxTokens) {\n throw syntaxError(\n this._lexer.source,\n token.start,\n `Document contains more that ${maxTokens} tokens. Parsing aborted.`,\n );\n }\n }\n }\n}\n/**\n * A helper function to describe a token as a string for debugging.\n */\n\nfunction getTokenDesc(token) {\n const value = token.value;\n return getTokenKindDesc(token.kind) + (value != null ? ` \"${value}\"` : '');\n}\n/**\n * A helper function to describe a token kind as a string for debugging.\n */\n\nfunction getTokenKindDesc(kind) {\n return isPunctuatorTokenKind(kind) ? `\"${kind}\"` : kind;\n}\n","import { devAssert } from '../jsutils/devAssert.mjs';\nimport { inspect } from '../jsutils/inspect.mjs';\nimport { isNode, QueryDocumentKeys } from './ast.mjs';\nimport { Kind } from './kinds.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 const 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 * ```ts\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 *\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 three permutations of the\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node of a specific kind.\n *\n * ```ts\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n * ```\n *\n * 2) Named visitors that trigger upon entering and leaving a node of a specific kind.\n *\n * ```ts\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 *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * ```ts\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n * ```\n */\n\nexport function visit(root, visitor, visitorKeys = QueryDocumentKeys) {\n const enterLeaveMap = new Map();\n\n for (const kind of Object.values(Kind)) {\n enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind));\n }\n /* eslint-disable no-undef-init */\n\n let stack = undefined;\n let inArray = Array.isArray(root);\n let keys = [root];\n let index = -1;\n let edits = [];\n let node = root;\n let key = undefined;\n let parent = undefined;\n const path = [];\n const ancestors = [];\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n const isLeaving = index === keys.length;\n const 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 let editOffset = 0;\n\n for (const [editKey, editValue] of edits) {\n const arrayKey = editKey - editOffset;\n\n if (editValue === null) {\n node.splice(arrayKey, 1);\n editOffset++;\n } else {\n node[arrayKey] = editValue;\n }\n }\n } else {\n node = { ...node };\n\n for (const [editKey, editValue] of edits) {\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 if (parent) {\n key = inArray ? index : keys[index];\n node = parent[key];\n\n if (node === null || node === undefined) {\n continue;\n }\n\n path.push(key);\n }\n\n let result;\n\n if (!Array.isArray(node)) {\n var _enterLeaveMap$get, _enterLeaveMap$get2;\n\n isNode(node) || devAssert(false, `Invalid AST Node: ${inspect(node)}.`);\n const visitFn = isLeaving\n ? (_enterLeaveMap$get = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get === void 0\n ? void 0\n : _enterLeaveMap$get.leave\n : (_enterLeaveMap$get2 = enterLeaveMap.get(node.kind)) === null ||\n _enterLeaveMap$get2 === void 0\n ? void 0\n : _enterLeaveMap$get2.enter;\n result =\n visitFn === null || visitFn === void 0\n ? void 0\n : 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 if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n var _node$kind;\n\n stack = {\n inArray,\n index,\n keys,\n edits,\n prev: stack,\n };\n inArray = Array.isArray(node);\n keys = inArray\n ? node\n : (_node$kind = visitorKeys[node.kind]) !== null &&\n _node$kind !== void 0\n ? _node$kind\n : [];\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 // New root\n return edits[edits.length - 1][1];\n }\n\n return root;\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 const skipping = new Array(visitors.length).fill(null);\n const mergedVisitor = Object.create(null);\n\n for (const kind of Object.values(Kind)) {\n let hasVisitor = false;\n const enterList = new Array(visitors.length).fill(undefined);\n const leaveList = new Array(visitors.length).fill(undefined);\n\n for (let i = 0; i < visitors.length; ++i) {\n const { enter, leave } = getEnterLeaveForKind(visitors[i], kind);\n hasVisitor || (hasVisitor = enter != null || leave != null);\n enterList[i] = enter;\n leaveList[i] = leave;\n }\n\n if (!hasVisitor) {\n continue;\n }\n\n const mergedEnterLeave = {\n enter(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _enterList$i;\n\n const result =\n (_enterList$i = enterList[i]) === null || _enterList$i === void 0\n ? void 0\n : _enterList$i.apply(visitors[i], args);\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(...args) {\n const node = args[0];\n\n for (let i = 0; i < visitors.length; i++) {\n if (skipping[i] === null) {\n var _leaveList$i;\n\n const result =\n (_leaveList$i = leaveList[i]) === null || _leaveList$i === void 0\n ? void 0\n : _leaveList$i.apply(visitors[i], args);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n },\n };\n mergedVisitor[kind] = mergedEnterLeave;\n }\n\n return mergedVisitor;\n}\n/**\n * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind.\n */\n\nexport function getEnterLeaveForKind(visitor, kind) {\n const kindVisitor = visitor[kind];\n\n if (typeof kindVisitor === 'object') {\n // { Kind: { enter() {}, leave() {} } }\n return kindVisitor;\n } else if (typeof kindVisitor === 'function') {\n // { Kind() {} }\n return {\n enter: kindVisitor,\n leave: undefined,\n };\n } // { enter() {}, leave() {} }\n\n return {\n enter: visitor.enter,\n leave: visitor.leave,\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 * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17\n */\n\n/* c8 ignore next 8 */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n const { enter, leave } = getEnterLeaveForKind(visitor, kind);\n return isLeaving ? leave : enter;\n}\n","import { invariant } from \"../globals/index.js\";\nimport { visit, BREAK, Kind } from \"graphql\";\nexport function shouldInclude(_a, variables) {\n var directives = _a.directives;\n if (!directives || !directives.length) {\n return true;\n }\n return getInclusionDirectives(directives).every(function (_a) {\n var directive = _a.directive, ifArgument = _a.ifArgument;\n var evaledValue = false;\n if (ifArgument.value.kind === \"Variable\") {\n evaledValue =\n variables && variables[ifArgument.value.name.value];\n invariant(evaledValue !== void 0, 105, directive.name.value);\n }\n else {\n evaledValue = ifArgument.value.value;\n }\n return directive.name.value === \"skip\" ? !evaledValue : evaledValue;\n });\n}\nexport function getDirectiveNames(root) {\n var names = [];\n visit(root, {\n Directive: function (node) {\n names.push(node.name.value);\n },\n });\n return names;\n}\nexport var hasAnyDirectives = function (names, root) {\n return hasDirectives(names, root, false);\n};\nexport var hasAllDirectives = function (names, root) {\n return hasDirectives(names, root, true);\n};\nexport function hasDirectives(names, root, all) {\n var nameSet = new Set(names);\n var uniqueCount = nameSet.size;\n visit(root, {\n Directive: function (node) {\n if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) {\n return BREAK;\n }\n },\n });\n // If we found all the names, nameSet will be empty. If we only care about\n // finding some of them, the < condition is sufficient.\n return all ? !nameSet.size : nameSet.size < uniqueCount;\n}\nexport function hasClientExports(document) {\n return document && hasDirectives([\"client\", \"export\"], document, true);\n}\nfunction isInclusionDirective(_a) {\n var value = _a.name.value;\n return value === \"skip\" || value === \"include\";\n}\nexport function getInclusionDirectives(directives) {\n var result = [];\n if (directives && directives.length) {\n directives.forEach(function (directive) {\n if (!isInclusionDirective(directive))\n return;\n var directiveArguments = directive.arguments;\n var directiveName = directive.name.value;\n invariant(directiveArguments && directiveArguments.length === 1, 106, directiveName);\n var ifArgument = directiveArguments[0];\n invariant(ifArgument.name && ifArgument.name.value === \"if\", 107, directiveName);\n var ifValue = ifArgument.value;\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\"), 108, directiveName);\n result.push({ directive: directive, ifArgument: ifArgument });\n });\n }\n return result;\n}\n/** @internal */\nexport function getFragmentMaskMode(fragment) {\n var _a, _b;\n var directive = (_a = fragment.directives) === null || _a === void 0 ? void 0 : _a.find(function (_a) {\n var name = _a.name;\n return name.value === \"unmask\";\n });\n if (!directive) {\n return \"mask\";\n }\n var modeArg = (_b = directive.arguments) === null || _b === void 0 ? void 0 : _b.find(function (_a) {\n var name = _a.name;\n return name.value === \"mode\";\n });\n if (globalThis.__DEV__ !== false) {\n if (modeArg) {\n if (modeArg.value.kind === Kind.VARIABLE) {\n globalThis.__DEV__ !== false && invariant.warn(109);\n }\n else if (modeArg.value.kind !== Kind.STRING) {\n globalThis.__DEV__ !== false && invariant.warn(110);\n }\n else if (modeArg.value.value !== \"migrate\") {\n globalThis.__DEV__ !== false && invariant.warn(111, modeArg.value.value);\n }\n }\n }\n if (modeArg &&\n \"value\" in modeArg.value &&\n modeArg.value.value === \"migrate\") {\n return \"migrate\";\n }\n return \"unmask\";\n}\n//# sourceMappingURL=directives.js.map","// A [trie](https://en.wikipedia.org/wiki/Trie) data structure that holds\n// object keys weakly, yet can also hold non-object keys, unlike the\n// native `WeakMap`.\n// If no makeData function is supplied, the looked-up data will be an empty,\n// null-prototype Object.\nconst defaultMakeData = () => Object.create(null);\n// Useful for processing arguments objects as well as arrays.\nconst { forEach, slice } = Array.prototype;\nconst { hasOwnProperty } = Object.prototype;\nexport class Trie {\n constructor(weakness = true, makeData = defaultMakeData) {\n this.weakness = weakness;\n this.makeData = makeData;\n }\n lookup() {\n return this.lookupArray(arguments);\n }\n lookupArray(array) {\n let node = this;\n forEach.call(array, key => node = node.getChildTrie(key));\n return hasOwnProperty.call(node, \"data\")\n ? node.data\n : node.data = this.makeData(slice.call(array));\n }\n peek() {\n return this.peekArray(arguments);\n }\n peekArray(array) {\n let node = this;\n for (let i = 0, len = array.length; node && i < len; ++i) {\n const map = node.mapFor(array[i], false);\n node = map && map.get(array[i]);\n }\n return node && node.data;\n }\n remove() {\n return this.removeArray(arguments);\n }\n removeArray(array) {\n let data;\n if (array.length) {\n const head = array[0];\n const map = this.mapFor(head, false);\n const child = map && map.get(head);\n if (child) {\n data = child.removeArray(slice.call(array, 1));\n if (!child.data && !child.weak && !(child.strong && child.strong.size)) {\n map.delete(head);\n }\n }\n }\n else {\n data = this.data;\n delete this.data;\n }\n return data;\n }\n getChildTrie(key) {\n const map = this.mapFor(key, true);\n let child = map.get(key);\n if (!child)\n map.set(key, child = new Trie(this.weakness, this.makeData));\n return child;\n }\n mapFor(key, create) {\n return this.weakness && isObjRef(key)\n ? this.weak || (create ? this.weak = new WeakMap : void 0)\n : this.strong || (create ? this.strong = new Map : void 0);\n }\n}\nfunction isObjRef(value) {\n switch (typeof value) {\n case \"object\":\n if (value === null)\n break;\n // Fall through to return true...\n case \"function\":\n return true;\n }\n return false;\n}\n//# sourceMappingURL=index.js.map","import { maybe } from \"../globals/index.js\";\nvar isReactNative = maybe(function () { return navigator.product; }) == \"ReactNative\";\nexport var canUseWeakMap = typeof WeakMap === \"function\" &&\n !(isReactNative && !global.HermesInternal);\nexport var canUseWeakSet = typeof WeakSet === \"function\";\nexport var canUseSymbol = typeof Symbol === \"function\" && typeof Symbol.for === \"function\";\nexport var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;\nexport var canUseDOM = typeof maybe(function () { return window.document.createElement; }) === \"function\";\nvar usingJSDOM = \n// Following advice found in this comment from @domenic (maintainer of jsdom):\n// https://github.com/jsdom/jsdom/issues/1537#issuecomment-229405327\n//\n// Since we control the version of Jest and jsdom used when running Apollo\n// Client tests, and that version is recent enought to include \" jsdom/x.y.z\"\n// at the end of the user agent string, I believe this case is all we need to\n// check. Testing for \"Node.js\" was recommended for backwards compatibility\n// with older version of jsdom, but we don't have that problem.\nmaybe(function () { return navigator.userAgent.indexOf(\"jsdom\") >= 0; }) || false;\n// Our tests should all continue to pass if we remove this !usingJSDOM\n// condition, thereby allowing useLayoutEffect when using jsdom. Unfortunately,\n// if we allow useLayoutEffect, then useSyncExternalStore generates many\n// warnings about useLayoutEffect doing nothing on the server. While these\n// warnings are harmless, this !usingJSDOM condition seems to be the best way to\n// prevent them (i.e. skipping useLayoutEffect when using jsdom).\nexport var canUseLayoutEffect = (canUseDOM || isReactNative) && !usingJSDOM;\n//# sourceMappingURL=canUse.js.map","export function isNonNullObject(obj) {\n return obj !== null && typeof obj === \"object\";\n}\nexport function isPlainObject(obj) {\n return (obj !== null &&\n typeof obj === \"object\" &&\n (Object.getPrototypeOf(obj) === Object.prototype ||\n Object.getPrototypeOf(obj) === null));\n}\n//# sourceMappingURL=objects.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { invariant, newInvariantError } from \"../globals/index.js\";\nimport { BREAK, visit } from \"graphql\";\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(document, fragmentName) {\n var actualFragmentName = fragmentName;\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n var fragments = [];\n document.definitions.forEach(function (definition) {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === \"OperationDefinition\") {\n throw newInvariantError(\n 112,\n definition.operation,\n definition.name ? \" named '\".concat(definition.name.value, \"'\") : \"\"\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === \"FragmentDefinition\") {\n fragments.push(definition);\n }\n });\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === \"undefined\") {\n invariant(fragments.length === 1, 113, fragments.length);\n actualFragmentName = fragments[0].name.value;\n }\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n var query = __assign(__assign({}, document), { definitions: __spreadArray([\n {\n kind: \"OperationDefinition\",\n // OperationTypeNode is an enum\n operation: \"query\",\n selectionSet: {\n kind: \"SelectionSet\",\n selections: [\n {\n kind: \"FragmentSpread\",\n name: {\n kind: \"Name\",\n value: actualFragmentName,\n },\n },\n ],\n },\n }\n ], document.definitions, true) });\n return query;\n}\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(fragments) {\n if (fragments === void 0) { fragments = []; }\n var symTable = {};\n fragments.forEach(function (fragment) {\n symTable[fragment.name.value] = fragment;\n });\n return symTable;\n}\nexport function getFragmentFromSelection(selection, fragmentMap) {\n switch (selection.kind) {\n case \"InlineFragment\":\n return selection;\n case \"FragmentSpread\": {\n var fragmentName = selection.name.value;\n if (typeof fragmentMap === \"function\") {\n return fragmentMap(fragmentName);\n }\n var fragment = fragmentMap && fragmentMap[fragmentName];\n invariant(fragment, 114, fragmentName);\n return fragment || null;\n }\n default:\n return null;\n }\n}\nexport function isFullyUnmaskedOperation(document) {\n var isUnmasked = true;\n visit(document, {\n FragmentSpread: function (node) {\n isUnmasked =\n !!node.directives &&\n node.directives.some(function (directive) { return directive.name.value === \"unmask\"; });\n if (!isUnmasked) {\n return BREAK;\n }\n },\n });\n return isUnmasked;\n}\n//# sourceMappingURL=fragments.js.map","function defaultDispose() { }\nexport class StrongCache {\n constructor(max = Infinity, dispose = defaultDispose) {\n this.max = max;\n this.dispose = dispose;\n this.map = new Map();\n this.newest = null;\n this.oldest = null;\n }\n has(key) {\n return this.map.has(key);\n }\n get(key) {\n const node = this.getNode(key);\n return node && node.value;\n }\n get size() {\n return this.map.size;\n }\n getNode(key) {\n const node = this.map.get(key);\n if (node && node !== this.newest) {\n const { older, newer } = node;\n if (newer) {\n newer.older = older;\n }\n if (older) {\n older.newer = newer;\n }\n node.older = this.newest;\n node.older.newer = node;\n node.newer = null;\n this.newest = node;\n if (node === this.oldest) {\n this.oldest = newer;\n }\n }\n return node;\n }\n set(key, value) {\n let node = this.getNode(key);\n if (node) {\n return node.value = value;\n }\n node = {\n key,\n value,\n newer: null,\n older: this.newest\n };\n if (this.newest) {\n this.newest.newer = node;\n }\n this.newest = node;\n this.oldest = this.oldest || node;\n this.map.set(key, node);\n return node.value;\n }\n clean() {\n while (this.oldest && this.map.size > this.max) {\n this.delete(this.oldest.key);\n }\n }\n delete(key) {\n const node = this.map.get(key);\n if (node) {\n if (node === this.newest) {\n this.newest = node.older;\n }\n if (node === this.oldest) {\n this.oldest = node.newer;\n }\n if (node.newer) {\n node.newer.older = node.older;\n }\n if (node.older) {\n node.older.newer = node.newer;\n }\n this.map.delete(key);\n this.dispose(node.value, key);\n return true;\n }\n return false;\n }\n}\n//# sourceMappingURL=strong.js.map","function noop() { }\nconst defaultDispose = noop;\nconst _WeakRef = typeof WeakRef !== \"undefined\"\n ? WeakRef\n : function (value) {\n return { deref: () => value };\n };\nconst _WeakMap = typeof WeakMap !== \"undefined\" ? WeakMap : Map;\nconst _FinalizationRegistry = typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : function () {\n return {\n register: noop,\n unregister: noop,\n };\n };\nconst finalizationBatchSize = 10024;\nexport class WeakCache {\n constructor(max = Infinity, dispose = defaultDispose) {\n this.max = max;\n this.dispose = dispose;\n this.map = new _WeakMap();\n this.newest = null;\n this.oldest = null;\n this.unfinalizedNodes = new Set();\n this.finalizationScheduled = false;\n this.size = 0;\n this.finalize = () => {\n const iterator = this.unfinalizedNodes.values();\n for (let i = 0; i < finalizationBatchSize; i++) {\n const node = iterator.next().value;\n if (!node)\n break;\n this.unfinalizedNodes.delete(node);\n const key = node.key;\n delete node.key;\n node.keyRef = new _WeakRef(key);\n this.registry.register(key, node, node);\n }\n if (this.unfinalizedNodes.size > 0) {\n queueMicrotask(this.finalize);\n }\n else {\n this.finalizationScheduled = false;\n }\n };\n this.registry = new _FinalizationRegistry(this.deleteNode.bind(this));\n }\n has(key) {\n return this.map.has(key);\n }\n get(key) {\n const node = this.getNode(key);\n return node && node.value;\n }\n getNode(key) {\n const node = this.map.get(key);\n if (node && node !== this.newest) {\n const { older, newer } = node;\n if (newer) {\n newer.older = older;\n }\n if (older) {\n older.newer = newer;\n }\n node.older = this.newest;\n node.older.newer = node;\n node.newer = null;\n this.newest = node;\n if (node === this.oldest) {\n this.oldest = newer;\n }\n }\n return node;\n }\n set(key, value) {\n let node = this.getNode(key);\n if (node) {\n return (node.value = value);\n }\n node = {\n key,\n value,\n newer: null,\n older: this.newest,\n };\n if (this.newest) {\n this.newest.newer = node;\n }\n this.newest = node;\n this.oldest = this.oldest || node;\n this.scheduleFinalization(node);\n this.map.set(key, node);\n this.size++;\n return node.value;\n }\n clean() {\n while (this.oldest && this.size > this.max) {\n this.deleteNode(this.oldest);\n }\n }\n deleteNode(node) {\n if (node === this.newest) {\n this.newest = node.older;\n }\n if (node === this.oldest) {\n this.oldest = node.newer;\n }\n if (node.newer) {\n node.newer.older = node.older;\n }\n if (node.older) {\n node.older.newer = node.newer;\n }\n this.size--;\n const key = node.key || (node.keyRef && node.keyRef.deref());\n this.dispose(node.value, key);\n if (!node.keyRef) {\n this.unfinalizedNodes.delete(node);\n }\n else {\n this.registry.unregister(node);\n }\n if (key)\n this.map.delete(key);\n }\n delete(key) {\n const node = this.map.get(key);\n if (node) {\n this.deleteNode(node);\n return true;\n }\n return false;\n }\n scheduleFinalization(node) {\n this.unfinalizedNodes.add(node);\n if (!this.finalizationScheduled) {\n this.finalizationScheduled = true;\n queueMicrotask(this.finalize);\n }\n }\n}\n//# sourceMappingURL=weak.js.map","import { WeakCache, StrongCache } from \"@wry/caches\";\nvar scheduledCleanup = new WeakSet();\nfunction schedule(cache) {\n if (cache.size <= (cache.max || -1)) {\n return;\n }\n if (!scheduledCleanup.has(cache)) {\n scheduledCleanup.add(cache);\n setTimeout(function () {\n cache.clean();\n scheduledCleanup.delete(cache);\n }, 100);\n }\n}\n/**\n * @internal\n * A version of WeakCache that will auto-schedule a cleanup of the cache when\n * a new item is added and the cache reached maximum size.\n * Throttled to once per 100ms.\n *\n * @privateRemarks\n * Should be used throughout the rest of the codebase instead of WeakCache,\n * with the notable exception of usage in `wrap` from `optimism` - that one\n * already handles cleanup and should remain a `WeakCache`.\n */\nexport var AutoCleanedWeakCache = function (max, dispose) {\n /*\n Some builds of `WeakCache` are function prototypes, some are classes.\n This library still builds with an ES5 target, so we can't extend the\n real classes.\n Instead, we have to use this workaround until we switch to a newer build\n target.\n */\n var cache = new WeakCache(max, dispose);\n cache.set = function (key, value) {\n var ret = WeakCache.prototype.set.call(this, key, value);\n schedule(this);\n return ret;\n };\n return cache;\n};\n/**\n * @internal\n * A version of StrongCache that will auto-schedule a cleanup of the cache when\n * a new item is added and the cache reached maximum size.\n * Throttled to once per 100ms.\n *\n * @privateRemarks\n * Should be used throughout the rest of the codebase instead of StrongCache,\n * with the notable exception of usage in `wrap` from `optimism` - that one\n * already handles cleanup and should remain a `StrongCache`.\n */\nexport var AutoCleanedStrongCache = function (max, dispose) {\n /*\n Some builds of `StrongCache` are function prototypes, some are classes.\n This library still builds with an ES5 target, so we can't extend the\n real classes.\n Instead, we have to use this workaround until we switch to a newer build\n target.\n */\n var cache = new StrongCache(max, dispose);\n cache.set = function (key, value) {\n var ret = StrongCache.prototype.set.call(this, key, value);\n schedule(this);\n return ret;\n };\n return cache;\n};\n//# sourceMappingURL=caches.js.map","import { __assign } from \"tslib\";\nimport { global } from \"../globals/index.js\";\nvar cacheSizeSymbol = Symbol.for(\"apollo.cacheSize\");\n/**\n *\n * The global cache size configuration for Apollo Client.\n *\n * @remarks\n *\n * You can directly modify this object, but any modification will\n * only have an effect on caches that are created after the modification.\n *\n * So for global caches, such as `parser`, `canonicalStringify` and `print`,\n * you might need to call `.reset` on them, which will essentially re-create them.\n *\n * Alternatively, you can set `globalThis[Symbol.for(\"apollo.cacheSize\")]` before\n * you load the Apollo Client package:\n *\n * @example\n * ```ts\n * globalThis[Symbol.for(\"apollo.cacheSize\")] = {\n * parser: 100\n * } satisfies Partial<CacheSizes> // the `satisfies` is optional if using TypeScript\n * ```\n */\nexport var cacheSizes = __assign({}, global[cacheSizeSymbol]);\n//# sourceMappingURL=sizes.js.map","import { __assign, __spreadArray } from \"tslib\";\nimport { cacheSizes } from \"./sizes.js\";\nvar globalCaches = {};\nexport function registerGlobalCache(name, getSize) {\n globalCaches[name] = getSize;\n}\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloClientMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloClientMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getInMemoryCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getInMemoryCacheMemoryInternals\n : undefined;\n/**\n * For internal purposes only - please call `ApolloClient.getMemoryInternals` instead\n * @internal\n */\nexport var getApolloCacheMemoryInternals = globalThis.__DEV__ !== false ?\n _getApolloCacheMemoryInternals\n : undefined;\nfunction getCurrentCacheSizes() {\n // `defaultCacheSizes` is a `const enum` that will be inlined during build, so we have to reconstruct it's shape here\n var defaults = {\n parser: 1000 /* defaultCacheSizes[\"parser\"] */,\n canonicalStringify: 1000 /* defaultCacheSizes[\"canonicalStringify\"] */,\n print: 2000 /* defaultCacheSizes[\"print\"] */,\n \"documentTransform.cache\": 2000 /* defaultCacheSizes[\"documentTransform.cache\"] */,\n \"queryManager.getDocumentInfo\": 2000 /* defaultCacheSizes[\"queryManager.getDocumentInfo\"] */,\n \"PersistedQueryLink.persistedQueryHashes\": 2000 /* defaultCacheSizes[\"PersistedQueryLink.persistedQueryHashes\"] */,\n \"fragmentRegistry.transform\": 2000 /* defaultCacheSizes[\"fragmentRegistry.transform\"] */,\n \"fragmentRegistry.lookup\": 1000 /* defaultCacheSizes[\"fragmentRegistry.lookup\"] */,\n \"fragmentRegistry.findFragmentSpreads\": 4000 /* defaultCacheSizes[\"fragmentRegistry.findFragmentSpreads\"] */,\n \"cache.fragmentQueryDocuments\": 1000 /* defaultCacheSizes[\"cache.fragmentQueryDocuments\"] */,\n \"removeTypenameFromVariables.getVariableDefinitions\": 2000 /* defaultCacheSizes[\"removeTypenameFromVariables.getVariableDefinitions\"] */,\n \"inMemoryCache.maybeBroadcastWatch\": 5000 /* defaultCacheSizes[\"inMemoryCache.maybeBroadcastWatch\"] */,\n \"inMemoryCache.executeSelectionSet\": 50000 /* defaultCacheSizes[\"inMemoryCache.executeSelectionSet\"] */,\n \"inMemoryCache.executeSubSelectedArray\": 10000 /* defaultCacheSizes[\"inMemoryCache.executeSubSelectedArray\"] */,\n };\n return Object.fromEntries(Object.entries(defaults).map(function (_a) {\n var k = _a[0], v = _a[1];\n return [\n k,\n cacheSizes[k] || v,\n ];\n }));\n}\nfunction _getApolloClientMemoryInternals() {\n var _a, _b, _c, _d, _e;\n if (!(globalThis.__DEV__ !== false))\n throw new Error(\"only supported in development mode\");\n return {\n limits: getCurrentCacheSizes(),\n sizes: __assign({ print: (_a = globalCaches.print) === null || _a === void 0 ? void 0 : _a.call(globalCaches), parser: (_b = globalCaches.parser) === null || _b === void 0 ? void 0 : _b.call(globalCaches), canonicalStringify: (_c = globalCaches.canonicalStringify) === null || _c === void 0 ? void 0 : _c.call(globalCaches), links: linkInfo(this.link), queryManager: {\n getDocumentInfo: this[\"queryManager\"][\"transformCache\"].size,\n documentTransforms: transformInfo(this[\"queryManager\"].documentTransform),\n } }, (_e = (_d = this.cache).getMemoryInternals) === null || _e === void 0 ? void 0 : _e.call(_d)),\n };\n}\nfunction _getApolloCacheMemoryInternals() {\n return {\n cache: {\n fragmentQueryDocuments: getWrapperInformation(this[\"getFragmentDoc\"]),\n },\n };\n}\nfunction _getInMemoryCacheMemoryInternals() {\n var fragments = this.config.fragments;\n return __assign(__assign({}, _getApolloCacheMemoryInternals.apply(this)), { addTypenameDocumentTransform: transformInfo(this[\"addTypenameTransform\"]), inMemoryCache: {\n executeSelectionSet: getWrapperInformation(this[\"storeReader\"][\"executeSelectionSet\"]),\n executeSubSelectedArray: getWrapperInformation(this[\"storeReader\"][\"executeSubSelectedArray\"]),\n maybeBroadcastWatch: getWrapperInformation(this[\"maybeBroadcastWatch\"]),\n }, fragmentRegistry: {\n findFragmentSpreads: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.findFragmentSpreads),\n lookup: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.lookup),\n transform: getWrapperInformation(fragments === null || fragments === void 0 ? void 0 : fragments.transform),\n } });\n}\nfunction isWrapper(f) {\n return !!f && \"dirtyKey\" in f;\n}\nfunction getWrapperInformation(f) {\n return isWrapper(f) ? f.size : undefined;\n}\nfunction isDefined(value) {\n return value != null;\n}\nfunction transformInfo(transform) {\n return recurseTransformInfo(transform).map(function (cache) { return ({ cache: cache }); });\n}\nfunction recurseTransformInfo(transform) {\n return transform ?\n __spreadArray(__spreadArray([\n getWrapperInformation(transform === null || transform === void 0 ? void 0 : transform[\"performWork\"])\n ], recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"left\"]), true), recurseTransformInfo(transform === null || transform === void 0 ? void 0 : transform[\"right\"]), true).filter(isDefined)\n : [];\n}\nfunction linkInfo(link) {\n var _a;\n return link ?\n __spreadArray(__spreadArray([\n (_a = link === null || link === void 0 ? void 0 : link.getMemoryInternals) === null || _a === void 0 ? void 0 : _a.call(link)\n ], linkInfo(link === null || link === void 0 ? void 0 : link.left), true), linkInfo(link === null || link === void 0 ? void 0 : link.right), true).filter(isDefined)\n : [];\n}\n//# sourceMappingURL=getMemoryInternals.js.map","import { AutoCleanedStrongCache, cacheSizes, } from \"../../utilities/caching/index.js\";\nimport { registerGlobalCache } from \"../caching/getMemoryInternals.js\";\n/**\n * Like JSON.stringify, but with object keys always sorted in the same order.\n *\n * To achieve performant sorting, this function uses a Map from JSON-serialized\n * arrays of keys (in any order) to sorted arrays of the same keys, with a\n * single sorted array reference shared by all permutations of the keys.\n *\n * As a drawback, this function will add a little bit more memory for every\n * object encountered that has different (more, less, a different order of) keys\n * than in the past.\n *\n * In a typical application, this extra memory usage should not play a\n * significant role, as `canonicalStringify` will be called for only a limited\n * number of object shapes, and the cache will not grow beyond a certain point.\n * But in some edge cases, this could be a problem, so we provide\n * canonicalStringify.reset() as a way of clearing the cache.\n * */\nexport var canonicalStringify = Object.assign(function canonicalStringify(value) {\n return JSON.stringify(value, stableObjectReplacer);\n}, {\n reset: function () {\n // Clearing the sortingMap will reclaim all cached memory, without\n // affecting the logical results of canonicalStringify, but potentially\n // sacrificing performance until the cache is refilled.\n sortingMap = new AutoCleanedStrongCache(cacheSizes.canonicalStringify || 1000 /* defaultCacheSizes.canonicalStringify */);\n },\n});\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"canonicalStringify\", function () { return sortingMap.size; });\n}\n// Values are JSON-serialized arrays of object keys (in any order), and values\n// are sorted arrays of the same keys.\nvar sortingMap;\ncanonicalStringify.reset();\n// The JSON.stringify function takes an optional second argument called a\n// replacer function. This function is called for each key-value pair in the\n// object being stringified, and its return value is used instead of the\n// original value. If the replacer function returns a new value, that value is\n// stringified as JSON instead of the original value of the property.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter\nfunction stableObjectReplacer(key, value) {\n if (value && typeof value === \"object\") {\n var proto = Object.getPrototypeOf(value);\n // We don't want to mess with objects that are not \"plain\" objects, which\n // means their prototype is either Object.prototype or null. This check also\n // prevents needlessly rearranging the indices of arrays.\n if (proto === Object.prototype || proto === null) {\n var keys = Object.keys(value);\n // If keys is already sorted, let JSON.stringify serialize the original\n // value instead of creating a new object with keys in the same order.\n if (keys.every(everyKeyInOrder))\n return value;\n var unsortedKey = JSON.stringify(keys);\n var sortedKeys = sortingMap.get(unsortedKey);\n if (!sortedKeys) {\n keys.sort();\n var sortedKey = JSON.stringify(keys);\n // Checking for sortedKey in the sortingMap allows us to share the same\n // sorted array reference for all permutations of the same set of keys.\n sortedKeys = sortingMap.get(sortedKey) || keys;\n sortingMap.set(unsortedKey, sortedKeys);\n sortingMap.set(sortedKey, sortedKeys);\n }\n var sortedObject_1 = Object.create(proto);\n // Reassigning the keys in sorted order will cause JSON.stringify to\n // serialize them in sorted order.\n sortedKeys.forEach(function (key) {\n sortedObject_1[key] = value[key];\n });\n return sortedObject_1;\n }\n }\n return value;\n}\n// Since everything that happens in stableObjectReplacer benefits from being as\n// efficient as possible, we use a static function as the callback for\n// keys.every in order to test if the provided keys are already sorted without\n// allocating extra memory for a callback.\nfunction everyKeyInOrder(key, i, keys) {\n return i === 0 || keys[i - 1] <= key;\n}\n//# sourceMappingURL=canonicalStringify.js.map","import { newInvariantError } from \"../globals/index.js\";\nimport { isNonNullObject } from \"../common/objects.js\";\nimport { getFragmentFromSelection } from \"./fragments.js\";\nimport { canonicalStringify } from \"../common/canonicalStringify.js\";\nexport function makeReference(id) {\n return { __ref: String(id) };\n}\nexport function isReference(obj) {\n return Boolean(obj && typeof obj === \"object\" && typeof obj.__ref === \"string\");\n}\nexport function isDocumentNode(value) {\n return (isNonNullObject(value) &&\n value.kind === \"Document\" &&\n Array.isArray(value.definitions));\n}\nfunction isStringValue(value) {\n return value.kind === \"StringValue\";\n}\nfunction isBooleanValue(value) {\n return value.kind === \"BooleanValue\";\n}\nfunction isIntValue(value) {\n return value.kind === \"IntValue\";\n}\nfunction isFloatValue(value) {\n return value.kind === \"FloatValue\";\n}\nfunction isVariable(value) {\n return value.kind === \"Variable\";\n}\nfunction isObjectValue(value) {\n return value.kind === \"ObjectValue\";\n}\nfunction isListValue(value) {\n return value.kind === \"ListValue\";\n}\nfunction isEnumValue(value) {\n return value.kind === \"EnumValue\";\n}\nfunction isNullValue(value) {\n return value.kind === \"NullValue\";\n}\nexport function valueToObjectRepresentation(argObj, name, value, variables) {\n if (isIntValue(value) || isFloatValue(value)) {\n argObj[name.value] = Number(value.value);\n }\n else if (isBooleanValue(value) || isStringValue(value)) {\n argObj[name.value] = value.value;\n }\n else if (isObjectValue(value)) {\n var nestedArgObj_1 = {};\n value.fields.map(function (obj) {\n return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables);\n });\n argObj[name.value] = nestedArgObj_1;\n }\n else if (isVariable(value)) {\n var variableValue = (variables || {})[value.name.value];\n argObj[name.value] = variableValue;\n }\n else if (isListValue(value)) {\n argObj[name.value] = value.values.map(function (listValue) {\n var nestedArgArrayObj = {};\n valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables);\n return nestedArgArrayObj[name.value];\n });\n }\n else if (isEnumValue(value)) {\n argObj[name.value] = value.value;\n }\n else if (isNullValue(value)) {\n argObj[name.value] = null;\n }\n else {\n throw newInvariantError(123, name.value, value.kind);\n }\n}\nexport function storeKeyNameFromField(field, variables) {\n var directivesObj = null;\n if (field.directives) {\n directivesObj = {};\n field.directives.forEach(function (directive) {\n directivesObj[directive.name.value] = {};\n if (directive.arguments) {\n directive.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables);\n });\n }\n });\n }\n var argObj = null;\n if (field.arguments && field.arguments.length) {\n argObj = {};\n field.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(argObj, name, value, variables);\n });\n }\n return getStoreKeyName(field.name.value, argObj, directivesObj);\n}\nvar KNOWN_DIRECTIVES = [\n \"connection\",\n \"include\",\n \"skip\",\n \"client\",\n \"rest\",\n \"export\",\n \"nonreactive\",\n];\n// Default stable JSON.stringify implementation used by getStoreKeyName. Can be\n// updated/replaced with something better by calling\n// getStoreKeyName.setStringify(newStringifyFunction).\nvar storeKeyNameStringify = canonicalStringify;\nexport var getStoreKeyName = Object.assign(function (fieldName, args, directives) {\n if (args &&\n directives &&\n directives[\"connection\"] &&\n directives[\"connection\"][\"key\"]) {\n if (directives[\"connection\"][\"filter\"] &&\n directives[\"connection\"][\"filter\"].length > 0) {\n var filterKeys = directives[\"connection\"][\"filter\"] ?\n directives[\"connection\"][\"filter\"]\n : [];\n filterKeys.sort();\n var filteredArgs_1 = {};\n filterKeys.forEach(function (key) {\n filteredArgs_1[key] = args[key];\n });\n return \"\".concat(directives[\"connection\"][\"key\"], \"(\").concat(storeKeyNameStringify(filteredArgs_1), \")\");\n }\n else {\n return directives[\"connection\"][\"key\"];\n }\n }\n var completeFieldName = fieldName;\n if (args) {\n // We can't use `JSON.stringify` here since it's non-deterministic,\n // and can lead to different store key names being created even though\n // the `args` object used during creation has the same properties/values.\n var stringifiedArgs = storeKeyNameStringify(args);\n completeFieldName += \"(\".concat(stringifiedArgs, \")\");\n }\n if (directives) {\n Object.keys(directives).forEach(function (key) {\n if (KNOWN_DIRECTIVES.indexOf(key) !== -1)\n return;\n if (directives[key] && Object.keys(directives[key]).length) {\n completeFieldName += \"@\".concat(key, \"(\").concat(storeKeyNameStringify(directives[key]), \")\");\n }\n else {\n completeFieldName += \"@\".concat(key);\n }\n });\n }\n return completeFieldName;\n}, {\n setStringify: function (s) {\n var previous = storeKeyNameStringify;\n storeKeyNameStringify = s;\n return previous;\n },\n});\nexport function argumentsObjectFromField(field, variables) {\n if (field.arguments && field.arguments.length) {\n var argObj_1 = {};\n field.arguments.forEach(function (_a) {\n var name = _a.name, value = _a.value;\n return valueToObjectRepresentation(argObj_1, name, value, variables);\n });\n return argObj_1;\n }\n return null;\n}\nexport function resultKeyNameFromField(field) {\n return field.alias ? field.alias.value : field.name.value;\n}\nexport function getTypenameFromResult(result, selectionSet, fragmentMap) {\n var fragments;\n for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {\n var selection = _a[_i];\n if (isField(selection)) {\n if (selection.name.value === \"__typename\") {\n return result[resultKeyNameFromField(selection)];\n }\n }\n else if (fragments) {\n fragments.push(selection);\n }\n else {\n fragments = [selection];\n }\n }\n if (typeof result.__typename === \"string\") {\n return result.__typename;\n }\n if (fragments) {\n for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {\n var selection = fragments_1[_b];\n var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);\n if (typeof typename === \"string\") {\n return typename;\n }\n }\n }\n}\nexport function isField(selection) {\n return selection.kind === \"Field\";\n}\nexport function isInlineFragment(selection) {\n return selection.kind === \"InlineFragment\";\n}\n//# sourceMappingURL=storeUtils.js.map","import { invariant, newInvariantError } from \"../globals/index.js\";\nimport { valueToObjectRepresentation } from \"./storeUtils.js\";\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc) {\n invariant(doc && doc.kind === \"Document\", 115);\n var operations = doc.definitions\n .filter(function (d) { return d.kind !== \"FragmentDefinition\"; })\n .map(function (definition) {\n if (definition.kind !== \"OperationDefinition\") {\n throw newInvariantError(116, definition.kind);\n }\n return definition;\n });\n invariant(operations.length <= 1, 117, operations.length);\n return doc;\n}\nexport function getOperationDefinition(doc) {\n checkDocument(doc);\n return doc.definitions.filter(function (definition) {\n return definition.kind === \"OperationDefinition\";\n })[0];\n}\nexport function getOperationName(doc) {\n return (doc.definitions\n .filter(function (definition) {\n return definition.kind === \"OperationDefinition\" && !!definition.name;\n })\n .map(function (x) { return x.name.value; })[0] || null);\n}\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(doc) {\n return doc.definitions.filter(function (definition) {\n return definition.kind === \"FragmentDefinition\";\n });\n}\nexport function getQueryDefinition(doc) {\n var queryDef = getOperationDefinition(doc);\n invariant(queryDef && queryDef.operation === \"query\", 118);\n return queryDef;\n}\nexport function getFragmentDefinition(doc) {\n invariant(doc.kind === \"Document\", 119);\n invariant(doc.definitions.length <= 1, 120);\n var fragmentDef = doc.definitions[0];\n invariant(fragmentDef.kind === \"FragmentDefinition\", 121);\n return fragmentDef;\n}\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(queryDoc) {\n checkDocument(queryDoc);\n var fragmentDefinition;\n for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) {\n var definition = _a[_i];\n if (definition.kind === \"OperationDefinition\") {\n var operation = definition.operation;\n if (operation === \"query\" ||\n operation === \"mutation\" ||\n operation === \"subscription\") {\n return definition;\n }\n }\n if (definition.kind === \"FragmentDefinition\" && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition;\n }\n }\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n throw newInvariantError(122);\n}\nexport function getDefaultValues(definition) {\n var defaultValues = Object.create(null);\n var defs = definition && definition.variableDefinitions;\n if (defs && defs.length) {\n defs.forEach(function (def) {\n if (def.defaultValue) {\n valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue);\n }\n });\n }\n return defaultValues;\n}\n//# sourceMappingURL=getFromAST.js.map","// This currentContext variable will only be used if the makeSlotClass\n// function is called, which happens only if this is the first copy of the\n// @wry/context package to be imported.\nlet currentContext = null;\n// This unique internal object is used to denote the absence of a value\n// for a given Slot, and is never exposed to outside code.\nconst MISSING_VALUE = {};\nlet idCounter = 1;\n// Although we can't do anything about the cost of duplicated code from\n// accidentally bundling multiple copies of the @wry/context package, we can\n// avoid creating the Slot class more than once using makeSlotClass.\nconst makeSlotClass = () => class Slot {\n constructor() {\n // If you have a Slot object, you can find out its slot.id, but you cannot\n // guess the slot.id of a Slot you don't have access to, thanks to the\n // randomized suffix.\n this.id = [\n \"slot\",\n idCounter++,\n Date.now(),\n Math.random().toString(36).slice(2),\n ].join(\":\");\n }\n hasValue() {\n for (let context = currentContext; context; context = context.parent) {\n // We use the Slot object iself as a key to its value, which means the\n // value cannot be obtained without a reference to the Slot object.\n if (this.id in context.slots) {\n const value = context.slots[this.id];\n if (value === MISSING_VALUE)\n break;\n if (context !== currentContext) {\n // Cache the value in currentContext.slots so the next lookup will\n // be faster. This caching is safe because the tree of contexts and\n // the values of the slots are logically immutable.\n currentContext.slots[this.id] = value;\n }\n return true;\n }\n }\n if (currentContext) {\n // If a value was not found for this Slot, it's never going to be found\n // no matter how many times we look it up, so we might as well cache\n // the absence of the value, too.\n currentContext.slots[this.id] = MISSING_VALUE;\n }\n return false;\n }\n getValue() {\n if (this.hasValue()) {\n return currentContext.slots[this.id];\n }\n }\n withValue(value, callback, \n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args, thisArg) {\n const slots = {\n __proto__: null,\n [this.id]: value,\n };\n const parent = currentContext;\n currentContext = { parent, slots };\n try {\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg, args);\n }\n finally {\n currentContext = parent;\n }\n }\n // Capture the current context and wrap a callback function so that it\n // reestablishes the captured context when called.\n static bind(callback) {\n const context = currentContext;\n return function () {\n const saved = currentContext;\n try {\n currentContext = context;\n return callback.apply(this, arguments);\n }\n finally {\n currentContext = saved;\n }\n };\n }\n // Immediately run a callback function without any captured context.\n static noContext(callback, \n // Given the prevalence of arrow functions, specifying arguments is likely\n // to be much more common than specifying `this`, hence this ordering:\n args, thisArg) {\n if (currentContext) {\n const saved = currentContext;\n try {\n currentContext = null;\n // Function.prototype.apply allows the arguments array argument to be\n // omitted or undefined, so args! is fine here.\n return callback.apply(thisArg, args);\n }\n finally {\n currentContext = saved;\n }\n }\n else {\n return callback.apply(thisArg, args);\n }\n }\n};\nfunction maybe(fn) {\n try {\n return fn();\n }\n catch (ignored) { }\n}\n// We store a single global implementation of the Slot class as a permanent\n// non-enumerable property of the globalThis object. This obfuscation does\n// nothing to prevent access to the Slot class, but at least it ensures the\n// implementation (i.e. currentContext) cannot be tampered with, and all copies\n// of the @wry/context package (hopefully just one) will share the same Slot\n// implementation. Since the first copy of the @wry/context package to be\n// imported wins, this technique imposes a steep cost for any future breaking\n// changes to the Slot class.\nconst globalKey = \"@wry/context:Slot\";\nconst host = \n// Prefer globalThis when available.\n// https://github.com/benjamn/wryware/issues/347\nmaybe(() => globalThis) ||\n // Fall back to global, which works in Node.js and may be converted by some\n // bundlers to the appropriate identifier (window, self, ...) depending on the\n // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224\n maybe(() => global) ||\n // Otherwise, use a dummy host that's local to this module. We used to fall\n // back to using the Array constructor as a namespace, but that was flagged in\n // https://github.com/benjamn/wryware/issues/347, and can be avoided.\n Object.create(null);\n// Whichever globalHost we're using, make TypeScript happy about the additional\n// globalKey property.\nconst globalHost = host;\nexport const Slot = globalHost[globalKey] ||\n // Earlier versions of this package stored the globalKey property on the Array\n // constructor, so we check there as well, to prevent Slot class duplication.\n Array[globalKey] ||\n (function (Slot) {\n try {\n Object.defineProperty(globalHost, globalKey, {\n value: Slot,\n enumerable: false,\n writable: false,\n // When it was possible for globalHost to be the Array constructor (a\n // legacy Slot dedup strategy), it was important for the property to be\n // configurable:true so it could be deleted. That does not seem to be as\n // important when globalHost is the global object, but I don't want to\n // cause similar problems again, and configurable:true seems safest.\n // https://github.com/endojs/endo/issues/576#issuecomment-1178274008\n configurable: true\n });\n }\n finally {\n return Slot;\n }\n })(makeSlotClass());\n//# sourceMappingURL=slot.js.map","import { Slot } from \"./slot.js\";\nexport { Slot };\nexport const { bind, noContext } = Slot;\n// Like global.setTimeout, except the callback runs with captured context.\nexport { setTimeoutWithContext as setTimeout };\nfunction setTimeoutWithContext(callback, delay) {\n return setTimeout(bind(callback), delay);\n}\n// Turn any generator function into an async function (using yield instead\n// of await), with context automatically preserved across yields.\nexport function asyncFromGen(genFn) {\n return function () {\n const gen = genFn.apply(this, arguments);\n const boundNext = bind(gen.next);\n const boundThrow = bind(gen.throw);\n return new Promise((resolve, reject) => {\n function invoke(method, argument) {\n try {\n var result = method.call(gen, argument);\n }\n catch (error) {\n return reject(error);\n }\n const next = result.done ? resolve : invokeNext;\n if (isPromiseLike(result.value)) {\n result.value.then(next, result.done ? reject : invokeThrow);\n }\n else {\n next(result.value);\n }\n }\n const invokeNext = (value) => invoke(boundNext, value);\n const invokeThrow = (error) => invoke(boundThrow, error);\n invokeNext();\n });\n };\n}\nfunction isPromiseLike(value) {\n return value && typeof value.then === \"function\";\n}\n// If you use the fibers npm package to implement coroutines in Node.js,\n// you should call this function at least once to ensure context management\n// remains coherent across any yields.\nconst wrappedFibers = [];\nexport function wrapYieldingFiberMethods(Fiber) {\n // There can be only one implementation of Fiber per process, so this array\n // should never grow longer than one element.\n if (wrappedFibers.indexOf(Fiber) < 0) {\n const wrap = (obj, method) => {\n const fn = obj[method];\n obj[method] = function () {\n return noContext(fn, arguments, this);\n };\n };\n // These methods can yield, according to\n // https://github.com/laverdet/node-fibers/blob/ddebed9b8ae3883e57f822e2108e6943e5c8d2a8/fibers.js#L97-L100\n wrap(Fiber, \"yield\");\n wrap(Fiber.prototype, \"run\");\n wrap(Fiber.prototype, \"throwInto\");\n wrappedFibers.push(Fiber);\n }\n return Fiber;\n}\n//# sourceMappingURL=index.js.map","import { Slot } from \"@wry/context\";\nexport const parentEntrySlot = new Slot();\nexport function nonReactive(fn) {\n return parentEntrySlot.withValue(void 0, fn);\n}\nexport { Slot };\nexport { bind as bindContext, noContext, setTimeout, asyncFromGen, } from \"@wry/context\";\n//# sourceMappingURL=context.js.map","export const { hasOwnProperty, } = Object.prototype;\nexport const arrayFromSet = Array.from ||\n function (set) {\n const array = [];\n set.forEach(item => array.push(item));\n return array;\n };\nexport function maybeUnsubscribe(entryOrDep) {\n const { unsubscribe } = entryOrDep;\n if (typeof unsubscribe === \"function\") {\n entryOrDep.unsubscribe = void 0;\n unsubscribe();\n }\n}\n//# sourceMappingURL=helpers.js.map","import { parentEntrySlot } from \"./context.js\";\nimport { maybeUnsubscribe, arrayFromSet } from \"./helpers.js\";\nconst emptySetPool = [];\nconst POOL_TARGET_SIZE = 100;\n// Since this package might be used browsers, we should avoid using the\n// Node built-in assert module.\nfunction assert(condition, optionalMessage) {\n if (!condition) {\n throw new Error(optionalMessage || \"assertion failure\");\n }\n}\nfunction valueIs(a, b) {\n const len = a.length;\n return (\n // Unknown values are not equal to each other.\n len > 0 &&\n // Both values must be ordinary (or both exceptional) to be equal.\n len === b.length &&\n // The underlying value or exception must be the same.\n a[len - 1] === b[len - 1]);\n}\nfunction valueGet(value) {\n switch (value.length) {\n case 0: throw new Error(\"unknown value\");\n case 1: return value[0];\n case 2: throw value[1];\n }\n}\nfunction valueCopy(value) {\n return value.slice(0);\n}\nexport class Entry {\n constructor(fn) {\n this.fn = fn;\n this.parents = new Set();\n this.childValues = new Map();\n // When this Entry has children that are dirty, this property becomes\n // a Set containing other Entry objects, borrowed from emptySetPool.\n // When the set becomes empty, it gets recycled back to emptySetPool.\n this.dirtyChildren = null;\n this.dirty = true;\n this.recomputing = false;\n this.value = [];\n this.deps = null;\n ++Entry.count;\n }\n peek() {\n if (this.value.length === 1 && !mightBeDirty(this)) {\n rememberParent(this);\n return this.value[0];\n }\n }\n // This is the most important method of the Entry API, because it\n // determines whether the cached this.value can be returned immediately,\n // or must be recomputed. The overall performance of the caching system\n // depends on the truth of the following observations: (1) this.dirty is\n // usually false, (2) this.dirtyChildren is usually null/empty, and thus\n // (3) valueGet(this.value) is usually returned without recomputation.\n recompute(args) {\n assert(!this.recomputing, \"already recomputing\");\n rememberParent(this);\n return mightBeDirty(this)\n ? reallyRecompute(this, args)\n : valueGet(this.value);\n }\n setDirty() {\n if (this.dirty)\n return;\n this.dirty = true;\n reportDirty(this);\n // We can go ahead and unsubscribe here, since any further dirty\n // notifications we receive will be redundant, and unsubscribing may\n // free up some resources, e.g. file watchers.\n maybeUnsubscribe(this);\n }\n dispose() {\n this.setDirty();\n // Sever any dependency relationships with our own children, so those\n // children don't retain this parent Entry in their child.parents sets,\n // thereby preventing it from being fully garbage collected.\n forgetChildren(this);\n // Because this entry has been kicked out of the cache (in index.js),\n // we've lost the ability to find out if/when this entry becomes dirty,\n // whether that happens through a subscription, because of a direct call\n // to entry.setDirty(), or because one of its children becomes dirty.\n // Because of this loss of future information, we have to assume the\n // worst (that this entry might have become dirty very soon), so we must\n // immediately mark this entry's parents as dirty. Normally we could\n // just call entry.setDirty() rather than calling parent.setDirty() for\n // each parent, but that would leave this entry in parent.childValues\n // and parent.dirtyChildren, which would prevent the child from being\n // truly forgotten.\n eachParent(this, (parent, child) => {\n parent.setDirty();\n forgetChild(parent, this);\n });\n }\n forget() {\n // The code that creates Entry objects in index.ts will replace this method\n // with one that actually removes the Entry from the cache, which will also\n // trigger the entry.dispose method.\n this.dispose();\n }\n dependOn(dep) {\n dep.add(this);\n if (!this.deps) {\n this.deps = emptySetPool.pop() || new Set();\n }\n this.deps.add(dep);\n }\n forgetDeps() {\n if (this.deps) {\n arrayFromSet(this.deps).forEach(dep => dep.delete(this));\n this.deps.clear();\n emptySetPool.push(this.deps);\n this.deps = null;\n }\n }\n}\nEntry.count = 0;\nfunction rememberParent(child) {\n const parent = parentEntrySlot.getValue();\n if (parent) {\n child.parents.add(parent);\n if (!parent.childValues.has(child)) {\n parent.childValues.set(child, []);\n }\n if (mightBeDirty(child)) {\n reportDirtyChild(parent, child);\n }\n else {\n reportCleanChild(parent, child);\n }\n return parent;\n }\n}\nfunction reallyRecompute(entry, args) {\n forgetChildren(entry);\n // Set entry as the parent entry while calling recomputeNewValue(entry).\n parentEntrySlot.withValue(entry, recomputeNewValue, [entry, args]);\n if (maybeSubscribe(entry, args)) {\n // If we successfully recomputed entry.value and did not fail to\n // (re)subscribe, then this Entry is no longer explicitly dirty.\n setClean(entry);\n }\n return valueGet(entry.value);\n}\nfunction recomputeNewValue(entry, args) {\n entry.recomputing = true;\n const { normalizeResult } = entry;\n let oldValueCopy;\n if (normalizeResult && entry.value.length === 1) {\n oldValueCopy = valueCopy(entry.value);\n }\n // Make entry.value an empty array, representing an unknown value.\n entry.value.length = 0;\n try {\n // If entry.fn succeeds, entry.value will become a normal Value.\n entry.value[0] = entry.fn.apply(null, args);\n // If we have a viable oldValueCopy to compare with the (successfully\n // recomputed) new entry.value, and they are not already === identical, give\n // normalizeResult a chance to pick/choose/reuse parts of oldValueCopy[0]\n // and/or entry.value[0] to determine the final cached entry.value.\n if (normalizeResult && oldValueCopy && !valueIs(oldValueCopy, entry.value)) {\n try {\n entry.value[0] = normalizeResult(entry.value[0], oldValueCopy[0]);\n }\n catch (_a) {\n // If normalizeResult throws, just use the newer value, rather than\n // saving the exception as entry.value[1].\n }\n }\n }\n catch (e) {\n // If entry.fn throws, entry.value will hold that exception.\n entry.value[1] = e;\n }\n // Either way, this line is always reached.\n entry.recomputing = false;\n}\nfunction mightBeDirty(entry) {\n return entry.dirty || !!(entry.dirtyChildren && entry.dirtyChildren.size);\n}\nfunction setClean(entry) {\n entry.dirty = false;\n if (mightBeDirty(entry)) {\n // This Entry may still have dirty children, in which case we can't\n // let our parents know we're clean just yet.\n return;\n }\n reportClean(entry);\n}\nfunction reportDirty(child) {\n eachParent(child, reportDirtyChild);\n}\nfunction reportClean(child) {\n eachParent(child, reportCleanChild);\n}\nfunction eachParent(child, callback) {\n const parentCount = child.parents.size;\n if (parentCount) {\n const parents = arrayFromSet(child.parents);\n for (let i = 0; i < parentCount; ++i) {\n callback(parents[i], child);\n }\n }\n}\n// Let a parent Entry know that one of its children may be dirty.\nfunction reportDirtyChild(parent, child) {\n // Must have called rememberParent(child) before calling\n // reportDirtyChild(parent, child).\n assert(parent.childValues.has(child));\n assert(mightBeDirty(child));\n const parentWasClean = !mightBeDirty(parent);\n if (!parent.dirtyChildren) {\n parent.dirtyChildren = emptySetPool.pop() || new Set;\n }\n else if (parent.dirtyChildren.has(child)) {\n // If we already know this child is dirty, then we must have already\n // informed our own parents that we are dirty, so we can terminate\n // the recursion early.\n return;\n }\n parent.dirtyChildren.add(child);\n // If parent was clean before, it just became (possibly) dirty (according to\n // mightBeDirty), since we just added child to parent.dirtyChildren.\n if (parentWasClean) {\n reportDirty(parent);\n }\n}\n// Let a parent Entry know that one of its children is no longer dirty.\nfunction reportCleanChild(parent, child) {\n // Must have called rememberChild(child) before calling\n // reportCleanChild(parent, child).\n assert(parent.childValues.has(child));\n assert(!mightBeDirty(child));\n const childValue = parent.childValues.get(child);\n if (childValue.length === 0) {\n parent.childValues.set(child, valueCopy(child.value));\n }\n else if (!valueIs(childValue, child.value)) {\n parent.setDirty();\n }\n removeDirtyChild(parent, child);\n if (mightBeDirty(parent)) {\n return;\n }\n reportClean(parent);\n}\nfunction removeDirtyChild(parent, child) {\n const dc = parent.dirtyChildren;\n if (dc) {\n dc.delete(child);\n if (dc.size === 0) {\n if (emptySetPool.length < POOL_TARGET_SIZE) {\n emptySetPool.push(dc);\n }\n parent.dirtyChildren = null;\n }\n }\n}\n// Removes all children from this entry and returns an array of the\n// removed children.\nfunction forgetChildren(parent) {\n if (parent.childValues.size > 0) {\n parent.childValues.forEach((_value, child) => {\n forgetChild(parent, child);\n });\n }\n // Remove this parent Entry from any sets to which it was added by the\n // addToSet method.\n parent.forgetDeps();\n // After we forget all our children, this.dirtyChildren must be empty\n // and therefore must have been reset to null.\n assert(parent.dirtyChildren === null);\n}\nfunction forgetChild(parent, child) {\n child.parents.delete(parent);\n parent.childValues.delete(child);\n removeDirtyChild(parent, child);\n}\nfunction maybeSubscribe(entry, args) {\n if (typeof entry.subscribe === \"function\") {\n try {\n maybeUnsubscribe(entry); // Prevent double subscriptions.\n entry.unsubscribe = entry.subscribe.apply(null, args);\n }\n catch (e) {\n // If this Entry has a subscribe function and it threw an exception\n // (or an unsubscribe function it previously returned now throws),\n // return false to indicate that we were not able to subscribe (or\n // unsubscribe), and this Entry should remain dirty.\n entry.setDirty();\n return false;\n }\n }\n // Returning true indicates either that there was no entry.subscribe\n // function or that it succeeded.\n return true;\n}\n//# sourceMappingURL=entry.js.map","import { parentEntrySlot } from \"./context.js\";\nimport { hasOwnProperty, maybeUnsubscribe, arrayFromSet, } from \"./helpers.js\";\nconst EntryMethods = {\n setDirty: true,\n dispose: true,\n forget: true, // Fully remove parent Entry from LRU cache and computation graph\n};\nexport function dep(options) {\n const depsByKey = new Map();\n const subscribe = options && options.subscribe;\n function depend(key) {\n const parent = parentEntrySlot.getValue();\n if (parent) {\n let dep = depsByKey.get(key);\n if (!dep) {\n depsByKey.set(key, dep = new Set);\n }\n parent.dependOn(dep);\n if (typeof subscribe === \"function\") {\n maybeUnsubscribe(dep);\n dep.unsubscribe = subscribe(key);\n }\n }\n }\n depend.dirty = function dirty(key, entryMethodName) {\n const dep = depsByKey.get(key);\n if (dep) {\n const m = (entryMethodName &&\n hasOwnProperty.call(EntryMethods, entryMethodName)) ? entryMethodName : \"setDirty\";\n // We have to use arrayFromSet(dep).forEach instead of dep.forEach,\n // because modifying a Set while iterating over it can cause elements in\n // the Set to be removed from the Set before they've been iterated over.\n arrayFromSet(dep).forEach(entry => entry[m]());\n depsByKey.delete(key);\n maybeUnsubscribe(dep);\n }\n };\n return depend;\n}\n//# sourceMappingURL=dep.js.map","import { Trie } from \"@wry/trie\";\nimport { StrongCache } from \"@wry/caches\";\nimport { Entry } from \"./entry.js\";\nimport { parentEntrySlot } from \"./context.js\";\n// These helper functions are important for making optimism work with\n// asynchronous code. In order to register parent-child dependencies,\n// optimism needs to know about any currently active parent computations.\n// In ordinary synchronous code, the parent context is implicit in the\n// execution stack, but asynchronous code requires some extra guidance in\n// order to propagate context from one async task segment to the next.\nexport { bindContext, noContext, nonReactive, setTimeout, asyncFromGen, Slot, } from \"./context.js\";\n// A lighter-weight dependency, similar to OptimisticWrapperFunction, except\n// with only one argument, no makeCacheKey, no wrapped function to recompute,\n// and no result value. Useful for representing dependency leaves in the graph\n// of computation. Subscriptions are supported.\nexport { dep } from \"./dep.js\";\n// The defaultMakeCacheKey function is remarkably powerful, because it gives\n// a unique object for any shallow-identical list of arguments. If you need\n// to implement a custom makeCacheKey function, you may find it helpful to\n// delegate the final work to defaultMakeCacheKey, which is why we export it\n// here. However, you may want to avoid defaultMakeCacheKey if your runtime\n// does not support WeakMap, or you have the ability to return a string key.\n// In those cases, just write your own custom makeCacheKey functions.\nlet defaultKeyTrie;\nexport function defaultMakeCacheKey(...args) {\n const trie = defaultKeyTrie || (defaultKeyTrie = new Trie(typeof WeakMap === \"function\"));\n return trie.lookupArray(args);\n}\n// If you're paranoid about memory leaks, or you want to avoid using WeakMap\n// under the hood, but you still need the behavior of defaultMakeCacheKey,\n// import this constructor to create your own tries.\nexport { Trie as KeyTrie };\n;\nconst caches = new Set();\nexport function wrap(originalFunction, { max = Math.pow(2, 16), keyArgs, makeCacheKey = defaultMakeCacheKey, normalizeResult, subscribe, cache: cacheOption = StrongCache, } = Object.create(null)) {\n const cache = typeof cacheOption === \"function\"\n ? new cacheOption(max, entry => entry.dispose())\n : cacheOption;\n const optimistic = function () {\n const key = makeCacheKey.apply(null, keyArgs ? keyArgs.apply(null, arguments) : arguments);\n if (key === void 0) {\n return originalFunction.apply(null, arguments);\n }\n let entry = cache.get(key);\n if (!entry) {\n cache.set(key, entry = new Entry(originalFunction));\n entry.normalizeResult = normalizeResult;\n entry.subscribe = subscribe;\n // Give the Entry the ability to trigger cache.delete(key), even though\n // the Entry itself does not know about key or cache.\n entry.forget = () => cache.delete(key);\n }\n const value = entry.recompute(Array.prototype.slice.call(arguments));\n // Move this entry to the front of the least-recently used queue,\n // since we just finished computing its value.\n cache.set(key, entry);\n caches.add(cache);\n // Clean up any excess entries in the cache, but only if there is no\n // active parent entry, meaning we're not in the middle of a larger\n // computation that might be flummoxed by the cleaning.\n if (!parentEntrySlot.hasValue()) {\n caches.forEach(cache => cache.clean());\n caches.clear();\n }\n return value;\n };\n Object.defineProperty(optimistic, \"size\", {\n get: () => cache.size,\n configurable: false,\n enumerable: false,\n });\n Object.freeze(optimistic.options = {\n max,\n keyArgs,\n makeCacheKey,\n normalizeResult,\n subscribe,\n cache,\n });\n function dirtyKey(key) {\n const entry = key && cache.get(key);\n if (entry) {\n entry.setDirty();\n }\n }\n optimistic.dirtyKey = dirtyKey;\n optimistic.dirty = function dirty() {\n dirtyKey(makeCacheKey.apply(null, arguments));\n };\n function peekKey(key) {\n const entry = key && cache.get(key);\n if (entry) {\n return entry.peek();\n }\n }\n optimistic.peekKey = peekKey;\n optimistic.peek = function peek() {\n return peekKey(makeCacheKey.apply(null, arguments));\n };\n function forgetKey(key) {\n return key ? cache.delete(key) : false;\n }\n optimistic.forgetKey = forgetKey;\n optimistic.forget = function forget() {\n return forgetKey(makeCacheKey.apply(null, arguments));\n };\n optimistic.makeCacheKey = makeCacheKey;\n optimistic.getKey = keyArgs ? function getKey() {\n return makeCacheKey.apply(null, keyArgs.apply(null, arguments));\n } : makeCacheKey;\n return Object.freeze(optimistic);\n}\n//# sourceMappingURL=index.js.map","// A version of Array.isArray that works better with readonly arrays.\nexport var isArray = Array.isArray;\nexport function isNonEmptyArray(value) {\n return Array.isArray(value) && value.length > 0;\n}\n//# sourceMappingURL=arrays.js.map","function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\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); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n// === Symbol Support ===\nvar hasSymbols = function () {\n return typeof Symbol === 'function';\n};\n\nvar hasSymbol = function (name) {\n return hasSymbols() && Boolean(Symbol[name]);\n};\n\nvar getSymbol = function (name) {\n return hasSymbol(name) ? Symbol[name] : '@@' + name;\n};\n\nif (hasSymbols() && !hasSymbol('observable')) {\n Symbol.observable = Symbol('observable');\n}\n\nvar SymbolIterator = getSymbol('iterator');\nvar SymbolObservable = getSymbol('observable');\nvar SymbolSpecies = getSymbol('species'); // === Abstract Operations ===\n\nfunction getMethod(obj, key) {\n var value = obj[key];\n if (value == null) return undefined;\n if (typeof value !== 'function') throw new TypeError(value + ' is not a function');\n return value;\n}\n\nfunction getSpecies(obj) {\n var ctor = obj.constructor;\n\n if (ctor !== undefined) {\n ctor = ctor[SymbolSpecies];\n\n if (ctor === null) {\n ctor = undefined;\n }\n }\n\n return ctor !== undefined ? ctor : Observable;\n}\n\nfunction isObservable(x) {\n return x instanceof Observable; // SPEC: Brand check\n}\n\nfunction hostReportError(e) {\n if (hostReportError.log) {\n hostReportError.log(e);\n } else {\n setTimeout(function () {\n throw e;\n });\n }\n}\n\nfunction enqueue(fn) {\n Promise.resolve().then(function () {\n try {\n fn();\n } catch (e) {\n hostReportError(e);\n }\n });\n}\n\nfunction cleanupSubscription(subscription) {\n var cleanup = subscription._cleanup;\n if (cleanup === undefined) return;\n subscription._cleanup = undefined;\n\n if (!cleanup) {\n return;\n }\n\n try {\n if (typeof cleanup === 'function') {\n cleanup();\n } else {\n var unsubscribe = getMethod(cleanup, 'unsubscribe');\n\n if (unsubscribe) {\n unsubscribe.call(cleanup);\n }\n }\n } catch (e) {\n hostReportError(e);\n }\n}\n\nfunction closeSubscription(subscription) {\n subscription._observer = undefined;\n subscription._queue = undefined;\n subscription._state = 'closed';\n}\n\nfunction flushSubscription(subscription) {\n var queue = subscription._queue;\n\n if (!queue) {\n return;\n }\n\n subscription._queue = undefined;\n subscription._state = 'ready';\n\n for (var i = 0; i < queue.length; ++i) {\n notifySubscription(subscription, queue[i].type, queue[i].value);\n if (subscription._state === 'closed') break;\n }\n}\n\nfunction notifySubscription(subscription, type, value) {\n subscription._state = 'running';\n var observer = subscription._observer;\n\n try {\n var m = getMethod(observer, type);\n\n switch (type) {\n case 'next':\n if (m) m.call(observer, value);\n break;\n\n case 'error':\n closeSubscription(subscription);\n if (m) m.call(observer, value);else throw value;\n break;\n\n case 'complete':\n closeSubscription(subscription);\n if (m) m.call(observer);\n break;\n }\n } catch (e) {\n hostReportError(e);\n }\n\n if (subscription._state === 'closed') cleanupSubscription(subscription);else if (subscription._state === 'running') subscription._state = 'ready';\n}\n\nfunction onNotify(subscription, type, value) {\n if (subscription._state === 'closed') return;\n\n if (subscription._state === 'buffering') {\n subscription._queue.push({\n type: type,\n value: value\n });\n\n return;\n }\n\n if (subscription._state !== 'ready') {\n subscription._state = 'buffering';\n subscription._queue = [{\n type: type,\n value: value\n }];\n enqueue(function () {\n return flushSubscription(subscription);\n });\n return;\n }\n\n notifySubscription(subscription, type, value);\n}\n\nvar Subscription = /*#__PURE__*/function () {\n function Subscription(observer, subscriber) {\n // ASSERT: observer is an object\n // ASSERT: subscriber is callable\n this._cleanup = undefined;\n this._observer = observer;\n this._queue = undefined;\n this._state = 'initializing';\n var subscriptionObserver = new SubscriptionObserver(this);\n\n try {\n this._cleanup = subscriber.call(undefined, subscriptionObserver);\n } catch (e) {\n subscriptionObserver.error(e);\n }\n\n if (this._state === 'initializing') this._state = 'ready';\n }\n\n var _proto = Subscription.prototype;\n\n _proto.unsubscribe = function unsubscribe() {\n if (this._state !== 'closed') {\n closeSubscription(this);\n cleanupSubscription(this);\n }\n };\n\n _createClass(Subscription, [{\n key: \"closed\",\n get: function () {\n return this._state === 'closed';\n }\n }]);\n\n return Subscription;\n}();\n\nvar SubscriptionObserver = /*#__PURE__*/function () {\n function SubscriptionObserver(subscription) {\n this._subscription = subscription;\n }\n\n var _proto2 = SubscriptionObserver.prototype;\n\n _proto2.next = function next(value) {\n onNotify(this._subscription, 'next', value);\n };\n\n _proto2.error = function error(value) {\n onNotify(this._subscription, 'error', value);\n };\n\n _proto2.complete = function complete() {\n onNotify(this._subscription, 'complete');\n };\n\n _createClass(SubscriptionObserver, [{\n key: \"closed\",\n get: function () {\n return this._subscription._state === 'closed';\n }\n }]);\n\n return SubscriptionObserver;\n}();\n\nvar Observable = /*#__PURE__*/function () {\n function Observable(subscriber) {\n if (!(this instanceof Observable)) throw new TypeError('Observable cannot be called as a function');\n if (typeof subscriber !== 'function') throw new TypeError('Observable initializer must be a function');\n this._subscriber = subscriber;\n }\n\n var _proto3 = Observable.prototype;\n\n _proto3.subscribe = function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n observer = {\n next: observer,\n error: arguments[1],\n complete: arguments[2]\n };\n }\n\n return new Subscription(observer, this._subscriber);\n };\n\n _proto3.forEach = function forEach(fn) {\n var _this = this;\n\n return new Promise(function (resolve, reject) {\n if (typeof fn !== 'function') {\n reject(new TypeError(fn + ' is not a function'));\n return;\n }\n\n function done() {\n subscription.unsubscribe();\n resolve();\n }\n\n var subscription = _this.subscribe({\n next: function (value) {\n try {\n fn(value, done);\n } catch (e) {\n reject(e);\n subscription.unsubscribe();\n }\n },\n error: reject,\n complete: resolve\n });\n });\n };\n\n _proto3.map = function map(fn) {\n var _this2 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n return _this2.subscribe({\n next: function (value) {\n try {\n value = fn(value);\n } catch (e) {\n return observer.error(e);\n }\n\n observer.next(value);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n observer.complete();\n }\n });\n });\n };\n\n _proto3.filter = function filter(fn) {\n var _this3 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n return _this3.subscribe({\n next: function (value) {\n try {\n if (!fn(value)) return;\n } catch (e) {\n return observer.error(e);\n }\n\n observer.next(value);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n observer.complete();\n }\n });\n });\n };\n\n _proto3.reduce = function reduce(fn) {\n var _this4 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n var hasSeed = arguments.length > 1;\n var hasValue = false;\n var seed = arguments[1];\n var acc = seed;\n return new C(function (observer) {\n return _this4.subscribe({\n next: function (value) {\n var first = !hasValue;\n hasValue = true;\n\n if (!first || hasSeed) {\n try {\n acc = fn(acc, value);\n } catch (e) {\n return observer.error(e);\n }\n } else {\n acc = value;\n }\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n if (!hasValue && !hasSeed) return observer.error(new TypeError('Cannot reduce an empty sequence'));\n observer.next(acc);\n observer.complete();\n }\n });\n });\n };\n\n _proto3.concat = function concat() {\n var _this5 = this;\n\n for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n\n var C = getSpecies(this);\n return new C(function (observer) {\n var subscription;\n var index = 0;\n\n function startNext(next) {\n subscription = next.subscribe({\n next: function (v) {\n observer.next(v);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n if (index === sources.length) {\n subscription = undefined;\n observer.complete();\n } else {\n startNext(C.from(sources[index++]));\n }\n }\n });\n }\n\n startNext(_this5);\n return function () {\n if (subscription) {\n subscription.unsubscribe();\n subscription = undefined;\n }\n };\n });\n };\n\n _proto3.flatMap = function flatMap(fn) {\n var _this6 = this;\n\n if (typeof fn !== 'function') throw new TypeError(fn + ' is not a function');\n var C = getSpecies(this);\n return new C(function (observer) {\n var subscriptions = [];\n\n var outer = _this6.subscribe({\n next: function (value) {\n if (fn) {\n try {\n value = fn(value);\n } catch (e) {\n return observer.error(e);\n }\n }\n\n var inner = C.from(value).subscribe({\n next: function (value) {\n observer.next(value);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n var i = subscriptions.indexOf(inner);\n if (i >= 0) subscriptions.splice(i, 1);\n completeIfDone();\n }\n });\n subscriptions.push(inner);\n },\n error: function (e) {\n observer.error(e);\n },\n complete: function () {\n completeIfDone();\n }\n });\n\n function completeIfDone() {\n if (outer.closed && subscriptions.length === 0) observer.complete();\n }\n\n return function () {\n subscriptions.forEach(function (s) {\n return s.unsubscribe();\n });\n outer.unsubscribe();\n };\n });\n };\n\n _proto3[SymbolObservable] = function () {\n return this;\n };\n\n Observable.from = function from(x) {\n var C = typeof this === 'function' ? this : Observable;\n if (x == null) throw new TypeError(x + ' is not an object');\n var method = getMethod(x, SymbolObservable);\n\n if (method) {\n var observable = method.call(x);\n if (Object(observable) !== observable) throw new TypeError(observable + ' is not an object');\n if (isObservable(observable) && observable.constructor === C) return observable;\n return new C(function (observer) {\n return observable.subscribe(observer);\n });\n }\n\n if (hasSymbol('iterator')) {\n method = getMethod(x, SymbolIterator);\n\n if (method) {\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n\n for (var _iterator = _createForOfIteratorHelperLoose(method.call(x)), _step; !(_step = _iterator()).done;) {\n var item = _step.value;\n observer.next(item);\n if (observer.closed) return;\n }\n\n observer.complete();\n });\n });\n }\n }\n\n if (Array.isArray(x)) {\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n\n for (var i = 0; i < x.length; ++i) {\n observer.next(x[i]);\n if (observer.closed) return;\n }\n\n observer.complete();\n });\n });\n }\n\n throw new TypeError(x + ' is not observable');\n };\n\n Observable.of = function of() {\n for (var _len2 = arguments.length, items = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n items[_key2] = arguments[_key2];\n }\n\n var C = typeof this === 'function' ? this : Observable;\n return new C(function (observer) {\n enqueue(function () {\n if (observer.closed) return;\n\n for (var i = 0; i < items.length; ++i) {\n observer.next(items[i]);\n if (observer.closed) return;\n }\n\n observer.complete();\n });\n });\n };\n\n _createClass(Observable, null, [{\n key: SymbolSpecies,\n get: function () {\n return this;\n }\n }]);\n\n return Observable;\n}();\n\nif (hasSymbols()) {\n Object.defineProperty(Observable, Symbol('extensions'), {\n value: {\n symbol: SymbolObservable,\n hostReportError: hostReportError\n },\n configurable: true\n });\n}\n\nexport { Observable };\n","export function preventUnhandledRejection(promise) {\n promise.catch(function () { });\n return promise;\n}\n//# sourceMappingURL=preventUnhandledRejection.js.map","var toString = Object.prototype.toString;\n/**\n * Deeply clones a value to create a new instance.\n */\nexport function cloneDeep(value) {\n return cloneDeepHelper(value);\n}\nfunction cloneDeepHelper(val, seen) {\n switch (toString.call(val)) {\n case \"[object Array]\": {\n seen = seen || new Map();\n if (seen.has(val))\n return seen.get(val);\n var copy_1 = val.slice(0);\n seen.set(val, copy_1);\n copy_1.forEach(function (child, i) {\n copy_1[i] = cloneDeepHelper(child, seen);\n });\n return copy_1;\n }\n case \"[object Object]\": {\n seen = seen || new Map();\n if (seen.has(val))\n return seen.get(val);\n // High fidelity polyfills of Object.create and Object.getPrototypeOf are\n // possible in all JS environments, so we will assume they exist/work.\n var copy_2 = Object.create(Object.getPrototypeOf(val));\n seen.set(val, copy_2);\n Object.keys(val).forEach(function (key) {\n copy_2[key] = cloneDeepHelper(val[key], seen);\n });\n return copy_2;\n }\n default:\n return val;\n }\n}\n//# sourceMappingURL=cloneDeep.js.map","import { isNonNullObject } from \"./objects.js\";\nexport function deepFreeze(value) {\n var workSet = new Set([value]);\n workSet.forEach(function (obj) {\n if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {\n Object.getOwnPropertyNames(obj).forEach(function (name) {\n if (isNonNullObject(obj[name]))\n workSet.add(obj[name]);\n });\n }\n });\n return value;\n}\nfunction shallowFreeze(obj) {\n if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) {\n try {\n Object.freeze(obj);\n }\n catch (e) {\n // Some types like Uint8Array and Node.js's Buffer cannot be frozen, but\n // they all throw a TypeError when you try, so we re-throw any exceptions\n // that are not TypeErrors, since that would be unexpected.\n if (e instanceof TypeError)\n return null;\n throw e;\n }\n }\n return obj;\n}\nexport function maybeDeepFreeze(obj) {\n if (globalThis.__DEV__ !== false) {\n deepFreeze(obj);\n }\n return obj;\n}\n//# sourceMappingURL=maybeDeepFreeze.js.map","/**\n * @deprecated `iterateObserversSafely` will be removed with Apollo Client 4.0.\n * Please discontinue using this function.\n */\nexport function iterateObserversSafely(observers, method, argument) {\n // In case observers is modified during iteration, we need to commit to the\n // original elements, which also provides an opportunity to filter them down\n // to just the observers with the given method.\n var observersWithMethod = [];\n observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); });\n observersWithMethod.forEach(function (obs) { return obs[method](argument); });\n}\n//# sourceMappingURL=iteration.js.map","import { Observable } from \"./Observable.js\";\nimport { canUseSymbol } from \"../common/canUse.js\";\n// Generic implementations of Observable.prototype methods like map and\n// filter need to know how to create a new Observable from an Observable\n// subclass (like Concast or ObservableQuery). Those methods assume\n// (perhaps unwisely?) that they can call the subtype's constructor with a\n// Subscriber function, even though the subclass constructor might expect\n// different parameters. Defining this static Symbol.species property on\n// the subclass is a hint to generic Observable code to use the default\n// constructor instead of trying to do `new Subclass(observer => ...)`.\nexport function fixObservableSubclass(subclass) {\n function set(key) {\n // Object.defineProperty is necessary because the Symbol.species\n // property is a getter by default in modern JS environments, so we\n // can't assign to it with a normal assignment expression.\n Object.defineProperty(subclass, key, { value: Observable });\n }\n if (canUseSymbol && Symbol.species) {\n set(Symbol.species);\n }\n // The \"@@species\" string is used as a fake Symbol.species value in some\n // polyfill systems (including the SymbolSpecies variable used by\n // zen-observable), so we should set it as well, to be safe.\n set(\"@@species\");\n return subclass;\n}\n//# sourceMappingURL=subclassing.js.map","/**\n * Merges the provided objects shallowly and removes\n * all properties with an `undefined` value\n */\nexport function compact() {\n var objects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n objects[_i] = arguments[_i];\n }\n var result = Object.create(null);\n objects.forEach(function (obj) {\n if (!obj)\n return;\n Object.keys(obj).forEach(function (key) {\n var value = obj[key];\n if (value !== void 0) {\n result[key] = value;\n }\n });\n });\n return result;\n}\n//# sourceMappingURL=compact.js.map","import { __assign } from \"tslib\";\nimport { compact } from \"./compact.js\";\nexport function mergeOptions(defaults, options) {\n return compact(defaults, options, options.variables && {\n variables: compact(__assign(__assign({}, (defaults && defaults.variables)), options.variables)),\n });\n}\n//# sourceMappingURL=mergeOptions.js.map","var _a;\nimport { __spreadArray } from \"tslib\";\nimport { Slot } from \"optimism\";\nimport { invariant, global as untypedGlobal } from \"../globals/index.js\";\nvar muteAllDeprecations = Symbol.for(\"apollo.deprecations\");\nvar deprecationsSlot = Symbol.for(\"apollo.deprecations.slot\");\nvar global = untypedGlobal;\nvar slot = ((_a = global[deprecationsSlot]) !== null && _a !== void 0 ? _a : (global[deprecationsSlot] = new Slot()));\nfunction isMuted(name) {\n return global[muteAllDeprecations] || (slot.getValue() || []).includes(name);\n}\nexport function muteDeprecations(name) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return slot.withValue.apply(slot, __spreadArray([Array.isArray(name) ? name : [name]], args, false));\n}\nexport function warnRemovedOption(options, name, callSite, recommendation) {\n if (recommendation === void 0) { recommendation = \"Please remove this option.\"; }\n warnDeprecated(name, function () {\n if (name in options) {\n globalThis.__DEV__ !== false && invariant.warn(103, callSite, name, recommendation);\n }\n });\n}\nexport function warnDeprecated(name, cb) {\n if (!isMuted(name)) {\n cb();\n }\n}\n//# sourceMappingURL=index.js.map","import * as React from \"rehackt\";\nimport { canUseSymbol } from \"../../utilities/index.js\";\nimport { invariant } from \"../../utilities/globals/index.js\";\n// To make sure Apollo Client doesn't create more than one React context\n// (which can lead to problems like having an Apollo Client instance added\n// in one context, then attempting to retrieve it from another different\n// context), a single Apollo context is created and tracked in global state.\nvar contextKey = canUseSymbol ? Symbol.for(\"__APOLLO_CONTEXT__\") : \"__APOLLO_CONTEXT__\";\nexport function getApolloContext() {\n invariant(\"createContext\" in React, 69);\n var context = React.createContext[contextKey];\n if (!context) {\n Object.defineProperty(React.createContext, contextKey, {\n value: (context = React.createContext({})),\n enumerable: false,\n writable: false,\n configurable: true,\n });\n context.displayName = \"ApolloContext\";\n }\n return context;\n}\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport var resetApolloContext = function () {\n if (globalThis.__DEV__ !== false) {\n globalThis.__DEV__ !== false && invariant.warn(70);\n }\n return getApolloContext();\n};\n//# sourceMappingURL=ApolloContext.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { getApolloContext } from \"../context/index.js\";\n/**\n * @example\n * ```jsx\n * import { useApolloClient } from '@apollo/client';\n *\n * function SomeComponent() {\n * const client = useApolloClient();\n * // `client` is now set to the `ApolloClient` instance being used by the\n * // application (that was configured using something like `ApolloProvider`)\n * }\n * ```\n *\n * @since 3.0.0\n * @returns The `ApolloClient` instance being used by the application.\n */\nexport function useApolloClient(override) {\n var context = React.useContext(getApolloContext());\n var client = override || context.client;\n invariant(!!client, 78);\n return client;\n}\n//# sourceMappingURL=useApolloClient.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { canUseLayoutEffect } from \"../../utilities/index.js\";\nvar didWarnUncachedGetSnapshot = false;\n// Prevent webpack from complaining about our feature detection of the\n// useSyncExternalStore property of the React namespace, which is expected not\n// to exist when using React 17 and earlier, and that's fine.\nvar uSESKey = \"useSyncExternalStore\";\nvar realHook = React[uSESKey];\n// Adapted from https://www.npmjs.com/package/use-sync-external-store, with\n// Apollo Client deviations called out by \"// DEVIATION ...\" comments.\n// When/if React.useSyncExternalStore is defined, delegate fully to it.\nexport var useSyncExternalStore = realHook ||\n (function (subscribe, getSnapshot, getServerSnapshot) {\n // Read the current snapshot from the store on every render. Again, this\n // breaks the rules of React, and only works here because of specific\n // implementation details, most importantly that updates are\n // always synchronous.\n var value = getSnapshot();\n if (\n // DEVIATION: Using __DEV__\n globalThis.__DEV__ !== false &&\n !didWarnUncachedGetSnapshot &&\n // DEVIATION: Not using Object.is because we know our snapshots will never\n // be exotic primitive values like NaN, which is !== itself.\n value !== getSnapshot()) {\n didWarnUncachedGetSnapshot = true;\n // DEVIATION: Using invariant.error instead of console.error directly.\n globalThis.__DEV__ !== false && invariant.error(91);\n }\n // Because updates are synchronous, we don't queue them. Instead we force a\n // re-render whenever the subscribed state changes by updating an some\n // arbitrary useState hook. Then, during render, we call getSnapshot to read\n // the current value.\n //\n // Because we don't actually use the state returned by the useState hook, we\n // can save a bit of memory by storing other stuff in that slot.\n //\n // To implement the early bailout, we need to track some things on a mutable\n // object. Usually, we would put that in a useRef hook, but we can stash it in\n // our useState hook instead.\n //\n // To force a re-render, we call forceUpdate({inst}). That works because the\n // new object always fails an equality check.\n var _a = React.useState({\n inst: { value: value, getSnapshot: getSnapshot },\n }), inst = _a[0].inst, forceUpdate = _a[1];\n // Track the latest getSnapshot function with a ref. This needs to be updated\n // in the layout phase so we can access it during the tearing check that\n // happens on subscribe.\n if (canUseLayoutEffect) {\n // DEVIATION: We avoid calling useLayoutEffect when !canUseLayoutEffect,\n // which may seem like a conditional hook, but this code ends up behaving\n // unconditionally (one way or the other) because canUseLayoutEffect is\n // constant.\n React.useLayoutEffect(function () {\n Object.assign(inst, { value: value, getSnapshot: getSnapshot });\n // Whenever getSnapshot or subscribe changes, we need to check in the\n // commit phase if there was an interleaved mutation. In concurrent mode\n // this can happen all the time, but even in synchronous mode, an earlier\n // effect may have mutated the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n // React Hook React.useLayoutEffect has a missing dependency: 'inst'. Either include it or remove the dependency array.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe, value, getSnapshot]);\n }\n else {\n Object.assign(inst, { value: value, getSnapshot: getSnapshot });\n }\n React.useEffect(function () {\n // Check for changes right before subscribing. Subsequent changes will be\n // detected in the subscription handler.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n // Subscribe to the store and return a clean-up function.\n return subscribe(function handleStoreChange() {\n // TODO: Because there is no cross-renderer API for batching updates, it's\n // up to the consumer of this library to wrap their subscription event\n // with unstable_batchedUpdates. Should we try to detect when this isn't\n // the case and print a warning in development?\n // The store changed. Check if the snapshot changed since the last time we\n // read from the store.\n if (checkIfSnapshotChanged(inst)) {\n // Force a re-render.\n forceUpdate({ inst: inst });\n }\n });\n // React Hook React.useEffect has a missing dependency: 'inst'. Either include it or remove the dependency array.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [subscribe]);\n return value;\n });\nfunction checkIfSnapshotChanged(_a) {\n var value = _a.value, getSnapshot = _a.getSnapshot;\n try {\n return value !== getSnapshot();\n }\n catch (_b) {\n return true;\n }\n}\n//# sourceMappingURL=useSyncExternalStore.js.map","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","import { __extends, __spreadArray } from \"tslib\";\nimport \"../utilities/globals/index.js\";\nimport { isNonNullObject } from \"../utilities/index.js\";\n// This Symbol allows us to pass transport-specific errors from the link chain\n// into QueryManager/client internals without risking a naming collision within\n// extensions (which implementers can use as they see fit).\nexport var PROTOCOL_ERRORS_SYMBOL = Symbol();\nexport function graphQLResultHasProtocolErrors(result) {\n if (result.extensions) {\n return Array.isArray(result.extensions[PROTOCOL_ERRORS_SYMBOL]);\n }\n return false;\n}\n/**\n * @deprecated `isApolloError` will be removed with Apollo Client 4.0. This\n * function is safe to use in Apollo Client 3.x.\n *\n * **Recommended now**\n *\n * No action needed\n *\n * **When migrating**\n *\n * Errors are no longer wrapped in Apollo Client 4.0. To check if an error is an\n * instance of an error provided by Apollo Client, use the static `.is` method\n * on the error class you want to test against.\n *\n * ```ts\n * // Test if an error is an instance of `CombinedGraphQLErrors`\n * const isGraphQLErrors = CombinedGraphQLErrors.is(error);\n * ```\n */\nexport function isApolloError(err) {\n return err.hasOwnProperty(\"graphQLErrors\");\n}\n// Sets the error message on this error according to the\n// the GraphQL and network errors that are present.\n// If the error message has already been set through the\n// constructor or otherwise, this function is a nop.\nvar generateErrorMessage = function (err) {\n var errors = __spreadArray(__spreadArray(__spreadArray([], err.graphQLErrors, true), err.clientErrors, true), err.protocolErrors, true);\n if (err.networkError)\n errors.push(err.networkError);\n return (errors\n // The rest of the code sometimes unsafely types non-Error objects as GraphQLErrors\n .map(function (err) {\n return (isNonNullObject(err) && err.message) || \"Error message not found.\";\n })\n .join(\"\\n\"));\n};\nvar ApolloError = /** @class */ (function (_super) {\n __extends(ApolloError, _super);\n // Constructs an instance of ApolloError given serialized GraphQL errors,\n // client errors, protocol errors or network errors.\n // Note that one of these has to be a valid\n // value or the constructed error will be meaningless.\n function ApolloError(_a) {\n var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo;\n var _this = _super.call(this, errorMessage) || this;\n _this.name = \"ApolloError\";\n _this.graphQLErrors = graphQLErrors || [];\n _this.protocolErrors = protocolErrors || [];\n _this.clientErrors = clientErrors || [];\n _this.networkError = networkError || null;\n _this.message = errorMessage || generateErrorMessage(_this);\n _this.extraInfo = extraInfo;\n _this.cause =\n __spreadArray(__spreadArray(__spreadArray([\n networkError\n ], (graphQLErrors || []), true), (protocolErrors || []), true), (clientErrors || []), true).find(function (e) { return !!e; }) || null;\n // We're not using `Object.setPrototypeOf` here as it isn't fully\n // supported on Android (see issue #3236).\n _this.__proto__ = ApolloError.prototype;\n return _this;\n }\n return ApolloError;\n}(Error));\nexport { ApolloError };\n//# sourceMappingURL=index.js.map","import { __rest } from \"tslib\";\nimport equal from \"@wry/equality\";\nimport { createFragmentMap, getFragmentDefinitions, getFragmentFromSelection, getMainDefinition, isField, resultKeyNameFromField, shouldInclude, } from \"../utilities/index.js\";\n// Returns true if aResult and bResult are deeply equal according to the fields\n// selected by the given query, ignoring any fields marked as @nonreactive.\nexport function equalByQuery(query, _a, _b, variables) {\n var aData = _a.data, aRest = __rest(_a, [\"data\"]);\n var bData = _b.data, bRest = __rest(_b, [\"data\"]);\n return (equal(aRest, bRest) &&\n equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, {\n fragmentMap: createFragmentMap(getFragmentDefinitions(query)),\n variables: variables,\n }));\n}\nfunction equalBySelectionSet(selectionSet, aResult, bResult, context) {\n if (aResult === bResult) {\n return true;\n }\n var seenSelections = new Set();\n // Returning true from this Array.prototype.every callback function skips the\n // current field/subtree. Returning false aborts the entire traversal\n // immediately, causing equalBySelectionSet to return false.\n return selectionSet.selections.every(function (selection) {\n // Avoid re-processing the same selection at the same level of recursion, in\n // case the same field gets included via multiple indirect fragment spreads.\n if (seenSelections.has(selection))\n return true;\n seenSelections.add(selection);\n // Ignore @skip(if: true) and @include(if: false) fields.\n if (!shouldInclude(selection, context.variables))\n return true;\n // If the field or (named) fragment spread has a @nonreactive directive on\n // it, we don't care if it's different, so we pretend it's the same.\n if (selectionHasNonreactiveDirective(selection))\n return true;\n if (isField(selection)) {\n var resultKey = resultKeyNameFromField(selection);\n var aResultChild = aResult && aResult[resultKey];\n var bResultChild = bResult && bResult[resultKey];\n var childSelectionSet = selection.selectionSet;\n if (!childSelectionSet) {\n // These are scalar values, so we can compare them with deep equal\n // without redoing the main recursive work.\n return equal(aResultChild, bResultChild);\n }\n var aChildIsArray = Array.isArray(aResultChild);\n var bChildIsArray = Array.isArray(bResultChild);\n if (aChildIsArray !== bChildIsArray)\n return false;\n if (aChildIsArray && bChildIsArray) {\n var length_1 = aResultChild.length;\n if (bResultChild.length !== length_1) {\n return false;\n }\n for (var i = 0; i < length_1; ++i) {\n if (!equalBySelectionSet(childSelectionSet, aResultChild[i], bResultChild[i], context)) {\n return false;\n }\n }\n return true;\n }\n return equalBySelectionSet(childSelectionSet, aResultChild, bResultChild, context);\n }\n else {\n var fragment = getFragmentFromSelection(selection, context.fragmentMap);\n if (fragment) {\n // The fragment might === selection if it's an inline fragment, but\n // could be !== if it's a named fragment ...spread.\n if (selectionHasNonreactiveDirective(fragment))\n return true;\n return equalBySelectionSet(fragment.selectionSet, \n // Notice that we reuse the same aResult and bResult values here,\n // since the fragment ...spread does not specify a field name, but\n // consists of multiple fields (within the fragment's selection set)\n // that should be applied to the current result value(s).\n aResult, bResult, context);\n }\n }\n });\n}\nfunction selectionHasNonreactiveDirective(selection) {\n return (!!selection.directives && selection.directives.some(directiveIsNonreactive));\n}\nfunction directiveIsNonreactive(dir) {\n return dir.name.value === \"nonreactive\";\n}\n//# sourceMappingURL=equalByQuery.js.map","/**\n * The current status of a query’s execution in our system.\n */\nexport var NetworkStatus;\n(function (NetworkStatus) {\n /**\n * The query has never been run before and the query is now currently running. A query will still\n * have this network status even if a partial data result was returned from the cache, but a\n * query was dispatched anyway.\n */\n NetworkStatus[NetworkStatus[\"loading\"] = 1] = \"loading\";\n /**\n * If `setVariables` was called and a query was fired because of that then the network status\n * will be `setVariables` until the result of that query comes back.\n */\n NetworkStatus[NetworkStatus[\"setVariables\"] = 2] = \"setVariables\";\n /**\n * Indicates that `fetchMore` was called on this query and that the query created is currently in\n * flight.\n */\n NetworkStatus[NetworkStatus[\"fetchMore\"] = 3] = \"fetchMore\";\n /**\n * Similar to the `setVariables` network status. It means that `refetch` was called on a query\n * and the refetch request is currently in flight.\n */\n NetworkStatus[NetworkStatus[\"refetch\"] = 4] = \"refetch\";\n /**\n * Indicates that a polling query is currently in flight. So for example if you are polling a\n * query every 10 seconds then the network status will switch to `poll` every 10 seconds whenever\n * a poll request has been sent but not resolved.\n */\n NetworkStatus[NetworkStatus[\"poll\"] = 6] = \"poll\";\n /**\n * No request is in flight for this query, and no errors happened. Everything is OK.\n */\n NetworkStatus[NetworkStatus[\"ready\"] = 7] = \"ready\";\n /**\n * No request is in flight for this query, but one or more errors were detected.\n */\n NetworkStatus[NetworkStatus[\"error\"] = 8] = \"error\";\n})(NetworkStatus || (NetworkStatus = {}));\n/**\n * Returns true if there is currently a network request in flight according to a given network\n * status.\n */\nexport function isNetworkRequestInFlight(networkStatus) {\n return networkStatus ? networkStatus < 7 : false;\n}\n/**\n * Returns true if the network request is in ready or error state according to a given network\n * status.\n */\nexport function isNetworkRequestSettled(networkStatus) {\n return networkStatus === 7 || networkStatus === 8;\n}\n//# sourceMappingURL=networkStatus.js.map","import { __assign, __extends } from \"tslib\";\nimport { invariant } from \"../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { NetworkStatus, isNetworkRequestInFlight } from \"./networkStatus.js\";\nimport { cloneDeep, compact, getOperationDefinition, Observable, iterateObserversSafely, fixObservableSubclass, getQueryDefinition, preventUnhandledRejection, } from \"../utilities/index.js\";\nimport { ApolloError, isApolloError } from \"../errors/index.js\";\nimport { equalByQuery } from \"./equalByQuery.js\";\nimport { Slot } from \"optimism\";\nimport { muteDeprecations, warnDeprecated, warnRemovedOption, } from \"../utilities/index.js\";\nvar assign = Object.assign, hasOwnProperty = Object.hasOwnProperty;\nvar ObservableQuery = /** @class */ (function (_super) {\n __extends(ObservableQuery, _super);\n function ObservableQuery(_a) {\n var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;\n var _this = this;\n var startedInactive = ObservableQuery.inactiveOnCreation.getValue();\n _this = _super.call(this, function (observer) {\n _this._getOrCreateQuery();\n // Zen Observable has its own error function, so in order to log correctly\n // we need to provide a custom error callback.\n try {\n var subObserver = observer._subscription._observer;\n if (subObserver && !subObserver.error) {\n subObserver.error = defaultSubscriptionObserverErrorCallback;\n }\n }\n catch (_a) { }\n var first = !_this.observers.size;\n _this.observers.add(observer);\n // Deliver most recent error or result.\n var last = _this.last;\n if (last && last.error) {\n observer.error && observer.error(last.error);\n }\n else if (last && last.result) {\n observer.next && observer.next(_this.maskResult(last.result));\n }\n // Initiate observation of this query if it hasn't been reported to\n // the QueryManager yet.\n if (first) {\n // Blindly catching here prevents unhandled promise rejections,\n // and is safe because the ObservableQuery handles this error with\n // this.observer.error, so we're not just swallowing the error by\n // ignoring it here.\n _this.reobserve().catch(function () { });\n }\n return function () {\n if (_this.observers.delete(observer) && !_this.observers.size) {\n _this.tearDownQuery();\n }\n };\n }) || this;\n _this.observers = new Set();\n _this.subscriptions = new Set();\n _this.dirty = false;\n _this._getOrCreateQuery = function () {\n if (startedInactive) {\n queryManager[\"queries\"].set(_this.queryId, queryInfo);\n startedInactive = false;\n }\n return _this.queryManager.getOrCreateQuery(_this.queryId);\n };\n // related classes\n _this.queryInfo = queryInfo;\n _this.queryManager = queryManager;\n // active state\n _this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);\n _this.isTornDown = false;\n _this.subscribeToMore = _this.subscribeToMore.bind(_this);\n _this.maskResult = _this.maskResult.bind(_this);\n var _b = queryManager.defaultOptions.watchQuery, _c = _b === void 0 ? {} : _b, _d = _c.fetchPolicy, defaultFetchPolicy = _d === void 0 ? \"cache-first\" : _d;\n var _e = options.fetchPolicy, fetchPolicy = _e === void 0 ? defaultFetchPolicy : _e, \n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n _f = options.initialFetchPolicy, \n // Make sure we don't store \"standby\" as the initialFetchPolicy.\n initialFetchPolicy = _f === void 0 ? fetchPolicy === \"standby\" ? defaultFetchPolicy : (fetchPolicy) : _f;\n _this.options = __assign(__assign({}, options), { \n // Remember the initial options.fetchPolicy so we can revert back to this\n // policy when variables change. This information can also be specified\n // (or overridden) by providing options.initialFetchPolicy explicitly.\n initialFetchPolicy: initialFetchPolicy, \n // This ensures this.options.fetchPolicy always has a string value, in\n // case options.fetchPolicy was not provided.\n fetchPolicy: fetchPolicy });\n _this.queryId = queryInfo.queryId || queryManager.generateQueryId();\n var opDef = getOperationDefinition(_this.query);\n _this.queryName = opDef && opDef.name && opDef.name.value;\n return _this;\n }\n Object.defineProperty(ObservableQuery.prototype, \"query\", {\n // The `query` computed property will always reflect the document transformed\n // by the last run query. `this.options.query` will always reflect the raw\n // untransformed query to ensure document transforms with runtime conditionals\n // are run on the original document.\n get: function () {\n return this.lastQuery || this.options.query;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ObservableQuery.prototype, \"variables\", {\n // Computed shorthand for this.options.variables, preserved for\n // backwards compatibility.\n /**\n * An object containing the variables that were provided for the query.\n */\n get: function () {\n return this.options.variables;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * @deprecated `result` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * If you continue to need this functionality, subscribe to `ObservableQuery`\n * to get the first value emitted from the observable, then immediately unsubscribe.\n *\n * **When upgrading**\n *\n * Use RxJS's [`firstResultFrom`](https://rxjs.dev/api/index/function/firstValueFrom) function to mimic this functionality.\n *\n * ```ts\n * const result = await firstValueFrom(from(observableQuery));\n * ```\n */\n ObservableQuery.prototype.result = function () {\n var _this = this;\n if (globalThis.__DEV__ !== false) {\n warnDeprecated(\"observableQuery.result\", function () {\n globalThis.__DEV__ !== false && invariant.warn(23);\n });\n }\n return new Promise(function (resolve, reject) {\n // TODO: this code doesn’t actually make sense insofar as the observer\n // will never exist in this.observers due how zen-observable wraps observables.\n // https://github.com/zenparsing/zen-observable/blob/master/src/Observable.js#L169\n var observer = {\n next: function (result) {\n resolve(result);\n // Stop the query within the QueryManager if we can before\n // this function returns.\n //\n // We do this in order to prevent observers piling up within\n // the QueryManager. Notice that we only fully unsubscribe\n // from the subscription in a setTimeout(..., 0) call. This call can\n // actually be handled by the browser at a much later time. If queries\n // are fired in the meantime, observers that should have been removed\n // from the QueryManager will continue to fire, causing an unnecessary\n // performance hit.\n _this.observers.delete(observer);\n if (!_this.observers.size) {\n _this.queryManager.removeQuery(_this.queryId);\n }\n setTimeout(function () {\n subscription.unsubscribe();\n }, 0);\n },\n error: reject,\n };\n var subscription = _this.subscribe(observer);\n });\n };\n /** @internal */\n ObservableQuery.prototype.resetDiff = function () {\n this.queryInfo.resetDiff();\n };\n ObservableQuery.prototype.getCurrentFullResult = function (saveAsLastResult) {\n var _this = this;\n if (saveAsLastResult === void 0) { saveAsLastResult = true; }\n // Use the last result as long as the variables match this.variables.\n var lastResult = muteDeprecations(\"getLastResult\", function () {\n return _this.getLastResult(true);\n });\n var networkStatus = this.queryInfo.networkStatus ||\n (lastResult && lastResult.networkStatus) ||\n NetworkStatus.ready;\n var result = __assign(__assign({}, lastResult), { loading: isNetworkRequestInFlight(networkStatus), networkStatus: networkStatus });\n var _a = this.options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a;\n if (\n // These fetch policies should never deliver data from the cache, unless\n // redelivering a previously delivered result.\n skipCacheDataFor(fetchPolicy) ||\n // If this.options.query has @client(always: true) fields, we cannot\n // trust diff.result, since it was read from the cache without running\n // local resolvers (and it's too late to run resolvers now, since we must\n // return a result synchronously).\n this.queryManager.getDocumentInfo(this.query).hasForcedResolvers) {\n // Fall through.\n }\n else if (this.waitForOwnResult) {\n // This would usually be a part of `QueryInfo.getDiff()`.\n // which we skip in the waitForOwnResult case since we are not\n // interested in the diff.\n this.queryInfo[\"updateWatch\"]();\n }\n else {\n var diff = this.queryInfo.getDiff();\n if (diff.complete || this.options.returnPartialData) {\n result.data = diff.result;\n }\n if (equal(result.data, {})) {\n result.data = void 0;\n }\n if (diff.complete) {\n // Similar to setting result.partial to false, but taking advantage of the\n // falsiness of missing fields.\n delete result.partial;\n // If the diff is complete, and we're using a FetchPolicy that\n // terminates after a complete cache read, we can assume the next result\n // we receive will have NetworkStatus.ready and !loading.\n if (diff.complete &&\n result.networkStatus === NetworkStatus.loading &&\n (fetchPolicy === \"cache-first\" || fetchPolicy === \"cache-only\")) {\n result.networkStatus = NetworkStatus.ready;\n result.loading = false;\n }\n }\n else {\n result.partial = true;\n }\n // We need to check for both both `error` and `errors` field because there\n // are cases where sometimes `error` is set, but not `errors` and\n // vice-versa. This will be updated in the next major version when\n // `errors` is deprecated in favor of `error`.\n if (result.networkStatus === NetworkStatus.ready &&\n (result.error || result.errors)) {\n result.networkStatus = NetworkStatus.error;\n }\n if (globalThis.__DEV__ !== false &&\n !diff.complete &&\n !this.options.partialRefetch &&\n !result.loading &&\n !result.data &&\n !result.error) {\n logMissingFieldErrors(diff.missing);\n }\n }\n if (saveAsLastResult) {\n this.updateLastResult(result);\n }\n return result;\n };\n ObservableQuery.prototype.getCurrentResult = function (saveAsLastResult) {\n if (saveAsLastResult === void 0) { saveAsLastResult = true; }\n return this.maskResult(this.getCurrentFullResult(saveAsLastResult));\n };\n // Compares newResult to the snapshot we took of this.lastResult when it was\n // first received.\n ObservableQuery.prototype.isDifferentFromLastResult = function (newResult, variables) {\n if (!this.last) {\n return true;\n }\n var documentInfo = this.queryManager.getDocumentInfo(this.query);\n var dataMasking = this.queryManager.dataMasking;\n var query = dataMasking ? documentInfo.nonReactiveQuery : this.query;\n var resultIsDifferent = dataMasking || documentInfo.hasNonreactiveDirective ?\n !equalByQuery(query, this.last.result, newResult, this.variables)\n : !equal(this.last.result, newResult);\n return (resultIsDifferent || (variables && !equal(this.last.variables, variables)));\n };\n ObservableQuery.prototype.getLast = function (key, variablesMustMatch) {\n var last = this.last;\n if (last &&\n last[key] &&\n (!variablesMustMatch || equal(last.variables, this.variables))) {\n return last[key];\n }\n };\n /**\n * @deprecated `getLastResult` will be removed in Apollo Client 4.0. Please\n * discontinue using this method.\n */\n ObservableQuery.prototype.getLastResult = function (variablesMustMatch) {\n if (globalThis.__DEV__ !== false) {\n warnDeprecated(\"getLastResult\", function () {\n globalThis.__DEV__ !== false && invariant.warn(24);\n });\n }\n return this.getLast(\"result\", variablesMustMatch);\n };\n /**\n * @deprecated `getLastError` will be removed in Apollo Client 4.0. Please\n * discontinue using this method.\n */\n ObservableQuery.prototype.getLastError = function (variablesMustMatch) {\n if (globalThis.__DEV__ !== false) {\n warnDeprecated(\"getLastError\", function () {\n globalThis.__DEV__ !== false && invariant.warn(25);\n });\n }\n return this.getLast(\"error\", variablesMustMatch);\n };\n /**\n * @deprecated `resetLastResults` will be removed in Apollo Client 4.0. Please\n * discontinue using this method.\n */\n ObservableQuery.prototype.resetLastResults = function () {\n if (globalThis.__DEV__ !== false) {\n warnDeprecated(\"resetLastResults\", function () {\n globalThis.__DEV__ !== false && invariant.warn(26);\n });\n }\n delete this.last;\n this.isTornDown = false;\n };\n /**\n * @deprecated `resetQueryStoreErrors` will be removed in Apollo Client 4.0.\n * Please discontinue using this method.\n */\n ObservableQuery.prototype.resetQueryStoreErrors = function () {\n if (globalThis.__DEV__ !== false) {\n globalThis.__DEV__ !== false && invariant.warn(27);\n }\n this.queryManager.resetErrors(this.queryId);\n };\n /**\n * Update the variables of this observable query, and fetch the new results.\n * This method should be preferred over `setVariables` in most use cases.\n *\n * @param variables - The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n ObservableQuery.prototype.refetch = function (variables) {\n var _a;\n var reobserveOptions = {\n // Always disable polling for refetches.\n pollInterval: 0,\n };\n // Unless the provided fetchPolicy always consults the network\n // (no-cache, network-only, or cache-and-network), override it with\n // network-only to force the refetch for this fetchQuery call.\n var fetchPolicy = this.options.fetchPolicy;\n if (fetchPolicy === \"no-cache\") {\n reobserveOptions.fetchPolicy = \"no-cache\";\n }\n else {\n reobserveOptions.fetchPolicy = \"network-only\";\n }\n if (globalThis.__DEV__ !== false && variables && hasOwnProperty.call(variables, \"variables\")) {\n var queryDef = getQueryDefinition(this.query);\n var vars = queryDef.variableDefinitions;\n if (!vars || !vars.some(function (v) { return v.variable.name.value === \"variables\"; })) {\n globalThis.__DEV__ !== false && invariant.warn(\n 28,\n variables,\n ((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef\n );\n }\n }\n if (variables && !equal(this.options.variables, variables)) {\n // Update the existing options with new variables\n reobserveOptions.variables = this.options.variables = __assign(__assign({}, this.options.variables), variables);\n }\n this.queryInfo.resetLastWrite();\n return this.reobserve(reobserveOptions, NetworkStatus.refetch);\n };\n /**\n * A function that helps you fetch the next set of results for a [paginated list field](https://www.apollographql.com/docs/react/pagination/core-api/).\n */\n ObservableQuery.prototype.fetchMore = function (fetchMoreOptions) {\n var _this = this;\n var combinedOptions = __assign(__assign({}, (fetchMoreOptions.query ? fetchMoreOptions : (__assign(__assign(__assign(__assign({}, this.options), { query: this.options.query }), fetchMoreOptions), { variables: __assign(__assign({}, this.options.variables), fetchMoreOptions.variables) })))), { \n // The fetchMore request goes immediately to the network and does\n // not automatically write its result to the cache (hence no-cache\n // instead of network-only), because we allow the caller of\n // fetchMore to provide an updateQuery callback that determines how\n // the data gets written to the cache.\n fetchPolicy: \"no-cache\" });\n combinedOptions.query = this.transformDocument(combinedOptions.query);\n var qid = this.queryManager.generateQueryId();\n // If a temporary query is passed to `fetchMore`, we don't want to store\n // it as the last query result since it may be an optimized query for\n // pagination. We will however run the transforms on the original document\n // as well as the document passed in `fetchMoreOptions` to ensure the cache\n // uses the most up-to-date document which may rely on runtime conditionals.\n this.lastQuery =\n fetchMoreOptions.query ?\n this.transformDocument(this.options.query)\n : combinedOptions.query;\n // Simulate a loading result for the original query with\n // result.networkStatus === NetworkStatus.fetchMore.\n var queryInfo = this.queryInfo;\n var originalNetworkStatus = queryInfo.networkStatus;\n queryInfo.networkStatus = NetworkStatus.fetchMore;\n if (combinedOptions.notifyOnNetworkStatusChange) {\n this.observe();\n }\n var updatedQuerySet = new Set();\n var updateQuery = fetchMoreOptions === null || fetchMoreOptions === void 0 ? void 0 : fetchMoreOptions.updateQuery;\n var isCached = this.options.fetchPolicy !== \"no-cache\";\n if (!isCached) {\n invariant(updateQuery, 29);\n }\n return this.queryManager\n .fetchQuery(qid, combinedOptions, NetworkStatus.fetchMore)\n .then(function (fetchMoreResult) {\n _this.queryManager.removeQuery(qid);\n if (queryInfo.networkStatus === NetworkStatus.fetchMore) {\n queryInfo.networkStatus = originalNetworkStatus;\n }\n if (isCached) {\n // Performing this cache update inside a cache.batch transaction ensures\n // any affected cache.watch watchers are notified at most once about any\n // updates. Most watchers will be using the QueryInfo class, which\n // responds to notifications by calling reobserveCacheFirst to deliver\n // fetchMore cache results back to this ObservableQuery.\n _this.queryManager.cache.batch({\n update: function (cache) {\n var updateQuery = fetchMoreOptions.updateQuery;\n if (updateQuery) {\n cache.updateQuery({\n query: _this.query,\n variables: _this.variables,\n returnPartialData: true,\n optimistic: false,\n }, function (previous) {\n return updateQuery(previous, {\n fetchMoreResult: fetchMoreResult.data,\n variables: combinedOptions.variables,\n });\n });\n }\n else {\n // If we're using a field policy instead of updateQuery, the only\n // thing we need to do is write the new data to the cache using\n // combinedOptions.variables (instead of this.variables, which is\n // what this.updateQuery uses, because it works by abusing the\n // original field value, keyed by the original variables).\n cache.writeQuery({\n query: combinedOptions.query,\n variables: combinedOptions.variables,\n data: fetchMoreResult.data,\n });\n }\n },\n onWatchUpdated: function (watch) {\n // Record the DocumentNode associated with any watched query whose\n // data were updated by the cache writes above.\n updatedQuerySet.add(watch.query);\n },\n });\n }\n else {\n // There is a possibility `lastResult` may not be set when\n // `fetchMore` is called which would cause this to crash. This should\n // only happen if we haven't previously reported a result. We don't\n // quite know what the right behavior should be here since this block\n // of code runs after the fetch result has executed on the network.\n // We plan to let it crash in the meantime.\n //\n // If we get bug reports due to the `data` property access on\n // undefined, this should give us a real-world scenario that we can\n // use to test against and determine the right behavior. If we do end\n // up changing this behavior, this may require, for example, an\n // adjustment to the types on `updateQuery` since that function\n // expects that the first argument always contains previous result\n // data, but not `undefined`.\n var lastResult = _this.getLast(\"result\");\n var data = updateQuery(lastResult.data, {\n fetchMoreResult: fetchMoreResult.data,\n variables: combinedOptions.variables,\n });\n _this.reportResult(__assign(__assign({}, lastResult), { networkStatus: originalNetworkStatus, loading: isNetworkRequestInFlight(originalNetworkStatus), data: data }), _this.variables);\n }\n return _this.maskResult(fetchMoreResult);\n })\n .finally(function () {\n // In case the cache writes above did not generate a broadcast\n // notification (which would have been intercepted by onWatchUpdated),\n // likely because the written data were the same as what was already in\n // the cache, we still want fetchMore to deliver its final loading:false\n // result with the unchanged data.\n if (isCached && !updatedQuerySet.has(_this.query)) {\n _this.reobserveCacheFirst();\n }\n });\n };\n // XXX the subscription variables are separate from the query variables.\n // if you want to update subscription variables, right now you have to do that separately,\n // and you can only do it by stopping the subscription and then subscribing again with new variables.\n /**\n * A function that enables you to execute a [subscription](https://www.apollographql.com/docs/react/data/subscriptions/), usually to subscribe to specific fields that were included in the query.\n *\n * This function returns _another_ function that you can call to terminate the subscription.\n */\n ObservableQuery.prototype.subscribeToMore = function (options) {\n var _this = this;\n var subscription = this.queryManager\n .startGraphQLSubscription({\n query: options.document,\n variables: options.variables,\n context: options.context,\n })\n .subscribe({\n next: function (subscriptionData) {\n var updateQuery = options.updateQuery;\n if (updateQuery) {\n _this.updateQuery(function (previous, updateOptions) {\n return updateQuery(previous, __assign({ subscriptionData: subscriptionData }, updateOptions));\n });\n }\n },\n error: function (err) {\n if (options.onError) {\n options.onError(err);\n return;\n }\n globalThis.__DEV__ !== false && invariant.error(30, err);\n },\n });\n this.subscriptions.add(subscription);\n return function () {\n if (_this.subscriptions.delete(subscription)) {\n subscription.unsubscribe();\n }\n };\n };\n /**\n * @deprecated `setOptions` will be removed in Apollo Client 4.0. Please use\n * `observableQuery.reobserve(newOptions)` instead.\n */\n ObservableQuery.prototype.setOptions = function (newOptions) {\n if (globalThis.__DEV__ !== false) {\n warnRemovedOption(newOptions, \"canonizeResults\", \"setOptions\");\n warnDeprecated(\"setOptions\", function () {\n globalThis.__DEV__ !== false && invariant.warn(31);\n });\n }\n return this.reobserve(newOptions);\n };\n ObservableQuery.prototype.silentSetOptions = function (newOptions) {\n var mergedOptions = compact(this.options, newOptions || {});\n assign(this.options, mergedOptions);\n };\n /**\n * Update the variables of this observable query, and fetch the new results\n * if they've changed. Most users should prefer `refetch` instead of\n * `setVariables` in order to to be properly notified of results even when\n * they come from the cache.\n *\n * Note: the `next` callback will *not* fire if the variables have not changed\n * or if the result is coming from cache.\n *\n * Note: the promise will return the old results immediately if the variables\n * have not changed.\n *\n * Note: the promise will return null immediately if the query is not active\n * (there are no subscribers).\n *\n * @param variables - The new set of variables. If there are missing variables,\n * the previous values of those variables will be used.\n */\n ObservableQuery.prototype.setVariables = function (variables) {\n var _this = this;\n if (equal(this.variables, variables)) {\n // If we have no observers, then we don't actually want to make a network\n // request. As soon as someone observes the query, the request will kick\n // off. For now, we just store any changes. (See #1077)\n return this.observers.size ?\n muteDeprecations(\"observableQuery.result\", function () { return _this.result(); })\n : Promise.resolve();\n }\n this.options.variables = variables;\n // See comment above\n if (!this.observers.size) {\n return Promise.resolve();\n }\n return this.reobserve({\n // Reset options.fetchPolicy to its original value.\n fetchPolicy: this.options.initialFetchPolicy,\n variables: variables,\n }, NetworkStatus.setVariables);\n };\n /**\n * A function that enables you to update the query's cached result without executing a followup GraphQL operation.\n *\n * See [using updateQuery and updateFragment](https://www.apollographql.com/docs/react/caching/cache-interaction/#using-updatequery-and-updatefragment) for additional information.\n */\n ObservableQuery.prototype.updateQuery = function (mapFn) {\n var queryManager = this.queryManager;\n var _a = queryManager.cache.diff({\n query: this.options.query,\n variables: this.variables,\n returnPartialData: true,\n optimistic: false,\n }), result = _a.result, complete = _a.complete;\n var newResult = mapFn(result, {\n variables: this.variables,\n complete: !!complete,\n previousData: result,\n });\n if (newResult) {\n queryManager.cache.writeQuery({\n query: this.options.query,\n data: newResult,\n variables: this.variables,\n });\n queryManager.broadcastQueries();\n }\n };\n /**\n * A function that instructs the query to begin re-executing at a specified interval (in milliseconds).\n */\n ObservableQuery.prototype.startPolling = function (pollInterval) {\n this.options.pollInterval = pollInterval;\n this.updatePolling();\n };\n /**\n * A function that instructs the query to stop polling after a previous call to `startPolling`.\n */\n ObservableQuery.prototype.stopPolling = function () {\n this.options.pollInterval = 0;\n this.updatePolling();\n };\n // Update options.fetchPolicy according to options.nextFetchPolicy.\n ObservableQuery.prototype.applyNextFetchPolicy = function (reason, \n // It's possible to use this method to apply options.nextFetchPolicy to\n // options.fetchPolicy even if options !== this.options, though that happens\n // most often when the options are temporary, used for only one request and\n // then thrown away, so nextFetchPolicy may not end up mattering.\n options) {\n if (options.nextFetchPolicy) {\n var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? \"cache-first\" : _a, _b = options.initialFetchPolicy, initialFetchPolicy = _b === void 0 ? fetchPolicy : _b;\n if (fetchPolicy === \"standby\") {\n // Do nothing, leaving options.fetchPolicy unchanged.\n }\n else if (typeof options.nextFetchPolicy === \"function\") {\n // When someone chooses \"cache-and-network\" or \"network-only\" as their\n // initial FetchPolicy, they often do not want future cache updates to\n // trigger unconditional network requests, which is what repeatedly\n // applying the \"cache-and-network\" or \"network-only\" policies would\n // seem to imply. Instead, when the cache reports an update after the\n // initial network request, it may be desirable for subsequent network\n // requests to be triggered only if the cache result is incomplete. To\n // that end, the options.nextFetchPolicy option provides an easy way to\n // update options.fetchPolicy after the initial network request, without\n // having to call observableQuery.setOptions.\n options.fetchPolicy = options.nextFetchPolicy(fetchPolicy, {\n reason: reason,\n options: options,\n observable: this,\n initialFetchPolicy: initialFetchPolicy,\n });\n }\n else if (reason === \"variables-changed\") {\n options.fetchPolicy = initialFetchPolicy;\n }\n else {\n options.fetchPolicy = options.nextFetchPolicy;\n }\n }\n return options.fetchPolicy;\n };\n ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) {\n // TODO Make sure we update the networkStatus (and infer fetchVariables)\n // before actually committing to the fetch.\n var queryInfo = this._getOrCreateQuery();\n queryInfo.setObservableQuery(this);\n return this.queryManager[\"fetchConcastWithInfo\"](queryInfo, options, newNetworkStatus, query);\n };\n // Turns polling on or off based on this.options.pollInterval.\n ObservableQuery.prototype.updatePolling = function () {\n var _this = this;\n // Avoid polling in SSR mode\n if (this.queryManager.ssrMode) {\n return;\n }\n var _a = this, pollingInfo = _a.pollingInfo, pollInterval = _a.options.pollInterval;\n if (!pollInterval || !this.hasObservers()) {\n if (pollingInfo) {\n clearTimeout(pollingInfo.timeout);\n delete this.pollingInfo;\n }\n return;\n }\n if (pollingInfo && pollingInfo.interval === pollInterval) {\n return;\n }\n invariant(pollInterval, 32);\n var info = pollingInfo || (this.pollingInfo = {});\n info.interval = pollInterval;\n var maybeFetch = function () {\n var _a, _b;\n if (_this.pollingInfo) {\n if (!isNetworkRequestInFlight(_this.queryInfo.networkStatus) &&\n !((_b = (_a = _this.options).skipPollAttempt) === null || _b === void 0 ? void 0 : _b.call(_a))) {\n _this.reobserve({\n // Most fetchPolicy options don't make sense to use in a polling context, as\n // users wouldn't want to be polling the cache directly. However, network-only and\n // no-cache are both useful for when the user wants to control whether or not the\n // polled results are written to the cache.\n fetchPolicy: _this.options.initialFetchPolicy === \"no-cache\" ?\n \"no-cache\"\n : \"network-only\",\n }, NetworkStatus.poll).then(poll, poll);\n }\n else {\n poll();\n }\n }\n };\n var poll = function () {\n var info = _this.pollingInfo;\n if (info) {\n clearTimeout(info.timeout);\n info.timeout = setTimeout(maybeFetch, info.interval);\n }\n };\n poll();\n };\n ObservableQuery.prototype.updateLastResult = function (newResult, variables) {\n var _this = this;\n if (variables === void 0) { variables = this.variables; }\n var error = muteDeprecations(\"getLastError\", function () {\n return _this.getLastError();\n });\n // Preserve this.last.error unless the variables have changed.\n if (error && this.last && !equal(variables, this.last.variables)) {\n error = void 0;\n }\n return (this.last = __assign({ result: this.queryManager.assumeImmutableResults ?\n newResult\n : cloneDeep(newResult), variables: variables }, (error ? { error: error } : null)));\n };\n ObservableQuery.prototype.reobserveAsConcast = function (newOptions, newNetworkStatus) {\n var _this = this;\n this.isTornDown = false;\n var useDisposableConcast = \n // Refetching uses a disposable Concast to allow refetches using different\n // options/variables, without permanently altering the options of the\n // original ObservableQuery.\n newNetworkStatus === NetworkStatus.refetch ||\n // The fetchMore method does not actually call the reobserve method, but,\n // if it did, it would definitely use a disposable Concast.\n newNetworkStatus === NetworkStatus.fetchMore ||\n // Polling uses a disposable Concast so the polling options (which force\n // fetchPolicy to be \"network-only\" or \"no-cache\") won't override the original options.\n newNetworkStatus === NetworkStatus.poll;\n // Save the old variables, since Object.assign may modify them below.\n var oldVariables = this.options.variables;\n var oldFetchPolicy = this.options.fetchPolicy;\n var mergedOptions = compact(this.options, newOptions || {});\n var options = useDisposableConcast ?\n // Disposable Concast fetches receive a shallow copy of this.options\n // (merged with newOptions), leaving this.options unmodified.\n mergedOptions\n : assign(this.options, mergedOptions);\n // Don't update options.query with the transformed query to avoid\n // overwriting this.options.query when we aren't using a disposable concast.\n // We want to ensure we can re-run the custom document transforms the next\n // time a request is made against the original query.\n var query = this.transformDocument(options.query);\n this.lastQuery = query;\n if (!useDisposableConcast) {\n // We can skip calling updatePolling if we're not changing this.options.\n this.updatePolling();\n // Reset options.fetchPolicy to its original value when variables change,\n // unless a new fetchPolicy was provided by newOptions.\n if (newOptions &&\n newOptions.variables &&\n !equal(newOptions.variables, oldVariables) &&\n // Don't mess with the fetchPolicy if it's currently \"standby\".\n options.fetchPolicy !== \"standby\" &&\n // If we're changing the fetchPolicy anyway, don't try to change it here\n // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.\n (options.fetchPolicy === oldFetchPolicy ||\n // A `nextFetchPolicy` function has even higher priority, though,\n // so in that case `applyNextFetchPolicy` must be called.\n typeof options.nextFetchPolicy === \"function\")) {\n this.applyNextFetchPolicy(\"variables-changed\", options);\n if (newNetworkStatus === void 0) {\n newNetworkStatus = NetworkStatus.setVariables;\n }\n }\n }\n this.waitForOwnResult && (this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy));\n var finishWaitingForOwnResult = function () {\n if (_this.concast === concast) {\n _this.waitForOwnResult = false;\n }\n };\n var variables = options.variables && __assign({}, options.variables);\n var _a = this.fetch(options, newNetworkStatus, query), concast = _a.concast, fromLink = _a.fromLink;\n var observer = {\n next: function (result) {\n if (equal(_this.variables, variables)) {\n finishWaitingForOwnResult();\n _this.reportResult(result, variables);\n }\n },\n error: function (error) {\n if (equal(_this.variables, variables)) {\n // Coming from `getResultsFromLink`, `error` here should always be an `ApolloError`.\n // However, calling `concast.cancel` can inject another type of error, so we have to\n // wrap it again here.\n if (!isApolloError(error)) {\n error = new ApolloError({ networkError: error });\n }\n finishWaitingForOwnResult();\n _this.reportError(error, variables);\n }\n },\n };\n if (!useDisposableConcast && (fromLink || !this.concast)) {\n // We use the {add,remove}Observer methods directly to avoid wrapping\n // observer with an unnecessary SubscriptionObserver object.\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n }\n this.concast = concast;\n this.observer = observer;\n }\n concast.addObserver(observer);\n return concast;\n };\n ObservableQuery.prototype.reobserve = function (newOptions, newNetworkStatus) {\n return preventUnhandledRejection(this.reobserveAsConcast(newOptions, newNetworkStatus).promise.then(this.maskResult));\n };\n ObservableQuery.prototype.resubscribeAfterError = function () {\n var _this = this;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n // If `lastError` is set in the current when the subscription is re-created,\n // the subscription will immediately receive the error, which will\n // cause it to terminate again. To avoid this, we first clear\n // the last error/result from the `observableQuery` before re-starting\n // the subscription, and restore the last value afterwards so that the\n // subscription has a chance to stay open.\n var last = this.last;\n muteDeprecations(\"resetLastResults\", function () { return _this.resetLastResults(); });\n var subscription = this.subscribe.apply(this, args);\n this.last = last;\n return subscription;\n };\n // (Re)deliver the current result to this.observers without applying fetch\n // policies or making network requests.\n ObservableQuery.prototype.observe = function () {\n this.reportResult(\n // Passing false is important so that this.getCurrentResult doesn't\n // save the fetchMore result as this.lastResult, causing it to be\n // ignored due to the this.isDifferentFromLastResult check in\n // this.reportResult.\n this.getCurrentFullResult(false), this.variables);\n };\n ObservableQuery.prototype.reportResult = function (result, variables) {\n var _this = this;\n var lastError = muteDeprecations(\"getLastError\", function () {\n return _this.getLastError();\n });\n var isDifferent = this.isDifferentFromLastResult(result, variables);\n // Update the last result even when isDifferentFromLastResult returns false,\n // because the query may be using the @nonreactive directive, and we want to\n // save the the latest version of any nonreactive subtrees (in case\n // getCurrentResult is called), even though we skip broadcasting changes.\n if (lastError || !result.partial || this.options.returnPartialData) {\n this.updateLastResult(result, variables);\n }\n if (lastError || isDifferent) {\n iterateObserversSafely(this.observers, \"next\", this.maskResult(result));\n }\n };\n ObservableQuery.prototype.reportError = function (error, variables) {\n var _this = this;\n // Since we don't get the current result on errors, only the error, we\n // must mirror the updates that occur in QueryStore.markQueryError here\n var errorResult = __assign(__assign({}, muteDeprecations(\"getLastResult\", function () { return _this.getLastResult(); })), { error: error, errors: error.graphQLErrors, networkStatus: NetworkStatus.error, loading: false });\n this.updateLastResult(errorResult, variables);\n iterateObserversSafely(this.observers, \"error\", (this.last.error = error));\n };\n ObservableQuery.prototype.hasObservers = function () {\n return this.observers.size > 0;\n };\n ObservableQuery.prototype.tearDownQuery = function () {\n if (this.isTornDown)\n return;\n if (this.concast && this.observer) {\n this.concast.removeObserver(this.observer);\n delete this.concast;\n delete this.observer;\n }\n this.stopPolling();\n // stop all active GraphQL subscriptions\n this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });\n this.subscriptions.clear();\n this.queryManager.stopQuery(this.queryId);\n this.observers.clear();\n this.isTornDown = true;\n };\n ObservableQuery.prototype.transformDocument = function (document) {\n return this.queryManager.transform(document);\n };\n ObservableQuery.prototype.maskResult = function (result) {\n return result && \"data\" in result ? __assign(__assign({}, result), { data: this.queryManager.maskOperation({\n document: this.query,\n data: result.data,\n fetchPolicy: this.options.fetchPolicy,\n id: this.queryId,\n }) }) : result;\n };\n /** @internal */\n ObservableQuery.prototype.resetNotifications = function () {\n this.cancelNotifyTimeout();\n this.dirty = false;\n };\n ObservableQuery.prototype.cancelNotifyTimeout = function () {\n if (this.notifyTimeout) {\n clearTimeout(this.notifyTimeout);\n this.notifyTimeout = void 0;\n }\n };\n /** @internal */\n ObservableQuery.prototype.scheduleNotify = function () {\n var _this = this;\n if (this.dirty)\n return;\n this.dirty = true;\n if (!this.notifyTimeout) {\n this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0);\n }\n };\n /** @internal */\n ObservableQuery.prototype.notify = function () {\n this.cancelNotifyTimeout();\n if (this.dirty) {\n if (this.options.fetchPolicy == \"cache-only\" ||\n this.options.fetchPolicy == \"cache-and-network\" ||\n !isNetworkRequestInFlight(this.queryInfo.networkStatus)) {\n var diff = this.queryInfo.getDiff();\n if (diff.fromOptimisticTransaction) {\n // If this diff came from an optimistic transaction, deliver the\n // current cache data to the ObservableQuery, but don't perform a\n // reobservation, since oq.reobserveCacheFirst might make a network\n // request, and we never want to trigger network requests in the\n // middle of optimistic updates.\n this.observe();\n }\n else {\n // Otherwise, make the ObservableQuery \"reobserve\" the latest data\n // using a temporary fetch policy of \"cache-first\", so complete cache\n // results have a chance to be delivered without triggering additional\n // network requests, even when options.fetchPolicy is \"network-only\"\n // or \"cache-and-network\". All other fetch policies are preserved by\n // this method, and are handled by calling oq.reobserve(). If this\n // reobservation is spurious, isDifferentFromLastResult still has a\n // chance to catch it before delivery to ObservableQuery subscribers.\n this.reobserveCacheFirst();\n }\n }\n }\n this.dirty = false;\n };\n // Reobserve with fetchPolicy effectively set to \"cache-first\", triggering\n // delivery of any new data from the cache, possibly falling back to the network\n // if any cache data are missing. This allows _complete_ cache results to be\n // delivered without also kicking off unnecessary network requests when\n // this.options.fetchPolicy is \"cache-and-network\" or \"network-only\". When\n // this.options.fetchPolicy is any other policy (\"cache-first\", \"cache-only\",\n // \"standby\", or \"no-cache\"), we call this.reobserve() as usual.\n ObservableQuery.prototype.reobserveCacheFirst = function () {\n var _a = this.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy;\n if (fetchPolicy === \"cache-and-network\" || fetchPolicy === \"network-only\") {\n return this.reobserve({\n fetchPolicy: \"cache-first\",\n // Use a temporary nextFetchPolicy function that replaces itself with the\n // previous nextFetchPolicy value and returns the original fetchPolicy.\n nextFetchPolicy: function (currentFetchPolicy, context) {\n // Replace this nextFetchPolicy function in the options object with the\n // original this.options.nextFetchPolicy value.\n this.nextFetchPolicy = nextFetchPolicy;\n // If the original nextFetchPolicy value was a function, give it a\n // chance to decide what happens here.\n if (typeof this.nextFetchPolicy === \"function\") {\n return this.nextFetchPolicy(currentFetchPolicy, context);\n }\n // Otherwise go back to the original this.options.fetchPolicy.\n return fetchPolicy;\n },\n });\n }\n return this.reobserve();\n };\n /**\n * @internal\n * A slot used by the `useQuery` hook to indicate that `client.watchQuery`\n * should not register the query immediately, but instead wait for the query to\n * be started registered with the `QueryManager` when `useSyncExternalStore`\n * actively subscribes to it.\n */\n ObservableQuery.inactiveOnCreation = new Slot();\n return ObservableQuery;\n}(Observable));\nexport { ObservableQuery };\n// Necessary because the ObservableQuery constructor has a different\n// signature than the Observable constructor.\nfixObservableSubclass(ObservableQuery);\nfunction defaultSubscriptionObserverErrorCallback(error) {\n globalThis.__DEV__ !== false && invariant.error(33, error.message, error.stack);\n}\nexport function logMissingFieldErrors(missing) {\n if (globalThis.__DEV__ !== false && missing) {\n globalThis.__DEV__ !== false && invariant.debug(34, missing);\n }\n}\nfunction skipCacheDataFor(fetchPolicy /* `undefined` would mean `\"cache-first\"` */) {\n return (fetchPolicy === \"network-only\" ||\n fetchPolicy === \"no-cache\" ||\n fetchPolicy === \"standby\");\n}\n//# sourceMappingURL=ObservableQuery.js.map","import { __assign } from \"tslib\";\nimport { parse } from 'graphql';\nvar docCache = new Map();\nvar fragmentSourceMap = new Map();\nvar printFragmentWarnings = true;\nvar experimentalFragmentVariables = false;\nfunction normalize(string) {\n return string.replace(/[\\s,]+/g, ' ').trim();\n}\nfunction cacheKeyFromLoc(loc) {\n return normalize(loc.source.body.substring(loc.start, loc.end));\n}\nfunction processFragments(ast) {\n var seenKeys = new Set();\n var definitions = [];\n ast.definitions.forEach(function (fragmentDefinition) {\n if (fragmentDefinition.kind === 'FragmentDefinition') {\n var fragmentName = fragmentDefinition.name.value;\n var sourceKey = cacheKeyFromLoc(fragmentDefinition.loc);\n var sourceKeySet = fragmentSourceMap.get(fragmentName);\n if (sourceKeySet && !sourceKeySet.has(sourceKey)) {\n if (printFragmentWarnings) {\n console.warn(\"Warning: fragment with name \" + fragmentName + \" already exists.\\n\"\n + \"graphql-tag enforces all fragment names across your application to be unique; read more about\\n\"\n + \"this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names\");\n }\n }\n else if (!sourceKeySet) {\n fragmentSourceMap.set(fragmentName, sourceKeySet = new Set);\n }\n sourceKeySet.add(sourceKey);\n if (!seenKeys.has(sourceKey)) {\n seenKeys.add(sourceKey);\n definitions.push(fragmentDefinition);\n }\n }\n else {\n definitions.push(fragmentDefinition);\n }\n });\n return __assign(__assign({}, ast), { definitions: definitions });\n}\nfunction stripLoc(doc) {\n var workSet = new Set(doc.definitions);\n workSet.forEach(function (node) {\n if (node.loc)\n delete node.loc;\n Object.keys(node).forEach(function (key) {\n var value = node[key];\n if (value && typeof value === 'object') {\n workSet.add(value);\n }\n });\n });\n var loc = doc.loc;\n if (loc) {\n delete loc.startToken;\n delete loc.endToken;\n }\n return doc;\n}\nfunction parseDocument(source) {\n var cacheKey = normalize(source);\n if (!docCache.has(cacheKey)) {\n var parsed = parse(source, {\n experimentalFragmentVariables: experimentalFragmentVariables,\n allowLegacyFragmentVariables: experimentalFragmentVariables\n });\n if (!parsed || parsed.kind !== 'Document') {\n throw new Error('Not a valid GraphQL document.');\n }\n docCache.set(cacheKey, stripLoc(processFragments(parsed)));\n }\n return docCache.get(cacheKey);\n}\nexport function gql(literals) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (typeof literals === 'string') {\n literals = [literals];\n }\n var result = literals[0];\n args.forEach(function (arg, i) {\n if (arg && arg.kind === 'Document') {\n result += arg.loc.source.body;\n }\n else {\n result += arg;\n }\n result += literals[i + 1];\n });\n return parseDocument(result);\n}\nexport function resetCaches() {\n docCache.clear();\n fragmentSourceMap.clear();\n}\nexport function disableFragmentWarnings() {\n printFragmentWarnings = false;\n}\nexport function enableExperimentalFragmentVariables() {\n experimentalFragmentVariables = true;\n}\nexport function disableExperimentalFragmentVariables() {\n experimentalFragmentVariables = false;\n}\nvar extras = {\n gql: gql,\n resetCaches: resetCaches,\n disableFragmentWarnings: disableFragmentWarnings,\n enableExperimentalFragmentVariables: enableExperimentalFragmentVariables,\n disableExperimentalFragmentVariables: disableExperimentalFragmentVariables\n};\n(function (gql_1) {\n 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;\n})(gql || (gql = {}));\ngql[\"default\"] = gql;\nexport default gql;\n//# sourceMappingURL=index.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nimport { AutoCleanedWeakCache, cacheSizes, } from \"../../utilities/index.js\";\nimport { registerGlobalCache } from \"../../utilities/caching/getMemoryInternals.js\";\nimport { muteDeprecations, warnDeprecated } from \"../../utilities/index.js\";\nexport var DocumentType;\n(function (DocumentType) {\n DocumentType[DocumentType[\"Query\"] = 0] = \"Query\";\n DocumentType[DocumentType[\"Mutation\"] = 1] = \"Mutation\";\n DocumentType[DocumentType[\"Subscription\"] = 2] = \"Subscription\";\n})(DocumentType || (DocumentType = {}));\nvar cache;\nexport function operationName(type) {\n var name;\n switch (type) {\n case DocumentType.Query:\n name = \"Query\";\n break;\n case DocumentType.Mutation:\n name = \"Mutation\";\n break;\n case DocumentType.Subscription:\n name = \"Subscription\";\n break;\n }\n return name;\n}\n/**\n * @deprecated `parser` will be removed in Apollo Client 4.0.\n *\n * **Recommended now**\n *\n * Remove all usages of `parser` as it is an internal implementation detail.\n */\nexport function parser(document) {\n warnDeprecated(\"parser\", function () {\n globalThis.__DEV__ !== false && invariant.warn(93);\n });\n if (!cache) {\n cache = new AutoCleanedWeakCache(cacheSizes.parser || 1000 /* defaultCacheSizes.parser */);\n }\n var cached = cache.get(document);\n if (cached)\n return cached;\n var variables, type, name;\n invariant(!!document && !!document.kind, 94, document);\n var fragments = [];\n var queries = [];\n var mutations = [];\n var subscriptions = [];\n for (var _i = 0, _a = document.definitions; _i < _a.length; _i++) {\n var x = _a[_i];\n if (x.kind === \"FragmentDefinition\") {\n fragments.push(x);\n continue;\n }\n if (x.kind === \"OperationDefinition\") {\n switch (x.operation) {\n case \"query\":\n queries.push(x);\n break;\n case \"mutation\":\n mutations.push(x);\n break;\n case \"subscription\":\n subscriptions.push(x);\n break;\n }\n }\n }\n invariant(!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length, 95);\n invariant(\n queries.length + mutations.length + subscriptions.length <= 1,\n 96,\n document,\n queries.length,\n subscriptions.length,\n mutations.length\n );\n type = queries.length ? DocumentType.Query : DocumentType.Mutation;\n if (!queries.length && !mutations.length)\n type = DocumentType.Subscription;\n var definitions = queries.length ? queries\n : mutations.length ? mutations\n : subscriptions;\n invariant(definitions.length === 1, 97, document, definitions.length);\n var definition = definitions[0];\n variables = definition.variableDefinitions || [];\n if (definition.name && definition.name.kind === \"Name\") {\n name = definition.name.value;\n }\n else {\n name = \"data\"; // fallback to using data if no name\n }\n var payload = { name: name, type: type, variables: variables };\n cache.set(document, payload);\n return payload;\n}\nparser.resetCache = function () {\n cache = undefined;\n};\nif (globalThis.__DEV__ !== false) {\n registerGlobalCache(\"parser\", function () { return (cache ? cache.size : 0); });\n}\nexport function verifyDocumentType(document, type) {\n var operation = muteDeprecations(\"parser\", parser, [document]);\n var requiredOperationName = operationName(type);\n var usedOperationName = operationName(operation.type);\n invariant(\n operation.type === type,\n 98,\n requiredOperationName,\n requiredOperationName,\n usedOperationName\n );\n}\n//# sourceMappingURL=index.js.map","import * as React from \"rehackt\";\nimport { canUseDOM } from \"../../../utilities/index.js\";\n// use canUseDOM here instead of canUseLayoutEffect because we want to be able\n// to use useLayoutEffect in our jest tests. useLayoutEffect seems to work fine\n// in useSuspenseQuery tests, but to honor the original comment about the\n// warnings for useSyncExternalStore implementation, canUseLayoutEffect is left\n// alone.\nexport var useIsomorphicLayoutEffect = canUseDOM ? React.useLayoutEffect : React.useEffect;\n//# sourceMappingURL=useIsomorphicLayoutEffect.js.map","import * as React from \"rehackt\";\nimport { warnRemovedOption } from \"../../../utilities/index.js\";\n// Remove with Apollo Client 4.0\nexport function useWarnRemovedOption(options, name, callSite, recommendation) {\n \"use no memo\";\n if (recommendation === void 0) { recommendation = \"Please remove this option.\"; }\n var didWarn = React.useRef(false);\n if (globalThis.__DEV__ !== false) {\n if (name in options && !didWarn.current) {\n warnRemovedOption(options, name, callSite, recommendation);\n // eslint-disable-next-line react-compiler/react-compiler\n didWarn.current = true;\n }\n }\n}\n//# sourceMappingURL=useWarnRemovedOption.js.map","var wrapperSymbol = Symbol.for(\"apollo.hook.wrappers\");\n/**\n * @internal\n *\n * Makes an Apollo Client hook \"wrappable\".\n * That means that the Apollo Client instance can expose a \"wrapper\" that will be\n * used to wrap the original hook implementation with additional logic.\n * @example\n * ```tsx\n * // this is already done in `@apollo/client` for all wrappable hooks (see `WrappableHooks`)\n * // following this pattern\n * function useQuery() {\n * return wrapHook('useQuery', _useQuery, options.client)(query, options);\n * }\n * function _useQuery(query, options) {\n * // original implementation\n * }\n *\n * // this is what a library like `@apollo/client-react-streaming` would do\n * class ApolloClientWithStreaming extends ApolloClient {\n * constructor(options) {\n * super(options);\n * this.queryManager[Symbol.for(\"apollo.hook.wrappers\")] = {\n * useQuery: (original) => (query, options) => {\n * console.log(\"useQuery was called with options\", options);\n * return original(query, options);\n * }\n * }\n * }\n * }\n *\n * // this will now log the options and then call the original `useQuery`\n * const client = new ApolloClientWithStreaming({ ... });\n * useQuery(query, { client });\n * ```\n */\nexport function wrapHook(hookName, useHook, clientOrObsQuery) {\n var queryManager = clientOrObsQuery[\"queryManager\"];\n var wrappers = queryManager && queryManager[wrapperSymbol];\n var wrapper = wrappers && wrappers[hookName];\n return wrapper ? wrapper(useHook) : useHook;\n}\n//# sourceMappingURL=wrapHook.js.map","import { __assign, __rest } from \"tslib\";\n/**\n * Function parameters in this file try to follow a common order for the sake of\n * readability and consistency. The order is as follows:\n *\n * resultData\n * observable\n * client\n * query\n * options\n * watchQueryOptions\n * makeWatchQueryOptions\n * isSSRAllowed\n * disableNetworkFetches\n * partialRefetch\n * renderPromises\n * isSyncSSR\n * callbacks\n */\n/** */\nimport { invariant } from \"../../utilities/globals/index.js\";\nimport * as React from \"rehackt\";\nimport { useSyncExternalStore } from \"./useSyncExternalStore.js\";\nimport { equal } from \"@wry/equality\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { getApolloContext } from \"../context/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { ObservableQuery, NetworkStatus } from \"../../core/index.js\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { compact, isNonEmptyArray, maybeDeepFreeze, } from \"../../utilities/index.js\";\nimport { useWarnRemovedOption, wrapHook } from \"./internal/index.js\";\nimport { muteDeprecations } from \"../../utilities/index.js\";\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nfunction noop() { }\nvar lastWatchOptions = Symbol();\n/**\n * A hook for executing queries in an Apollo application.\n *\n * To run a query within a React component, call `useQuery` and pass it a GraphQL query document.\n *\n * When your component renders, `useQuery` returns an object from Apollo Client that contains `loading`, `error`, and `data` properties you can use to render your UI.\n *\n * > Refer to the [Queries](https://www.apollographql.com/docs/react/data/queries) section for a more in-depth overview of `useQuery`.\n *\n * @example\n * ```jsx\n * import { gql, useQuery } from '@apollo/client';\n *\n * const GET_GREETING = gql`\n * query GetGreeting($language: String!) {\n * greeting(language: $language) {\n * message\n * }\n * }\n * `;\n *\n * function Hello() {\n * const { loading, error, data } = useQuery(GET_GREETING, {\n * variables: { language: 'english' },\n * });\n * if (loading) return <p>Loading ...</p>;\n * return <h1>Hello {data.greeting.message}!</h1>;\n * }\n * ```\n * @since 3.0.0\n * @param query - A GraphQL query document parsed into an AST by `gql`.\n * @param options - Options to control how the query is executed.\n * @returns Query result object\n */\nexport function useQuery(query, options) {\n if (options === void 0) { options = Object.create(null); }\n return wrapHook(\"useQuery\", useQuery_, useApolloClient(options && options.client))(query, options);\n}\nfunction useQuery_(query, options) {\n if (globalThis.__DEV__ !== false) {\n /* eslint-disable react-hooks/rules-of-hooks, react-compiler/react-compiler */\n useWarnRemovedOption(options, \"canonizeResults\", \"useQuery\");\n useWarnRemovedOption(options, \"partialRefetch\", \"useQuery\");\n useWarnRemovedOption(options, \"defaultOptions\", \"useQuery\", \"Pass the options directly to the hook instead.\");\n useWarnRemovedOption(options, \"onCompleted\", \"useQuery\", \"If your `onCompleted` callback sets local state, switch to use derived state using `data` returned from the hook instead. Use `useEffect` to perform side-effects as a result of updates to `data`.\");\n useWarnRemovedOption(options, \"onError\", \"useQuery\", \"If your `onError` callback sets local state, switch to use derived state using `data`, `error` or `errors` returned from the hook instead. Use `useEffect` if you need to perform side-effects as a result of updates to `data`, `error` or `errors`.\");\n /* eslint-enable react-hooks/rules-of-hooks, react-compiler/react-compiler */\n }\n var _a = useQueryInternals(query, options), result = _a.result, obsQueryFields = _a.obsQueryFields;\n return React.useMemo(function () { return (__assign(__assign({}, result), obsQueryFields)); }, [result, obsQueryFields]);\n}\nfunction useInternalState(client, query, options, renderPromises, makeWatchQueryOptions) {\n function createInternalState(previous) {\n var _a;\n verifyDocumentType(query, DocumentType.Query);\n var internalState = {\n client: client,\n query: query,\n observable: \n // See if there is an existing observable that was used to fetch the same\n // data and if so, use it instead since it will contain the proper queryId\n // to fetch the result set. This is used during SSR.\n (renderPromises &&\n renderPromises.getSSRObservable(makeWatchQueryOptions())) ||\n ObservableQuery[\"inactiveOnCreation\"].withValue(!renderPromises, function () {\n return muteDeprecations([\"canonizeResults\", \"partialRefetch\"], function () {\n return client.watchQuery(getObsQueryOptions(void 0, client, options, makeWatchQueryOptions()));\n });\n }),\n resultData: {\n // Reuse previousData from previous InternalState (if any) to provide\n // continuity of previousData even if/when the query or client changes.\n previousData: (_a = previous === null || previous === void 0 ? void 0 : previous.resultData.current) === null || _a === void 0 ? void 0 : _a.data,\n },\n };\n return internalState;\n }\n var _a = React.useState(createInternalState), internalState = _a[0], updateInternalState = _a[1];\n /**\n * Used by `useLazyQuery` when a new query is executed.\n * We keep this logic here since it needs to update things in unsafe\n * ways and here we at least can keep track of that in a single place.\n */\n function onQueryExecuted(watchQueryOptions) {\n var _a;\n var _b;\n // this needs to be set to prevent an immediate `resubscribe` in the\n // next rerender of the `useQuery` internals\n Object.assign(internalState.observable, (_a = {},\n _a[lastWatchOptions] = watchQueryOptions,\n _a));\n var resultData = internalState.resultData;\n updateInternalState(__assign(__assign({}, internalState), { \n // might be a different query\n query: watchQueryOptions.query, resultData: Object.assign(resultData, {\n // We need to modify the previous `resultData` object as we rely on the\n // object reference in other places\n previousData: ((_b = resultData.current) === null || _b === void 0 ? void 0 : _b.data) || resultData.previousData,\n current: undefined,\n }) }));\n }\n if (client !== internalState.client || query !== internalState.query) {\n // If the client or query have changed, we need to create a new InternalState.\n // This will trigger a re-render with the new state, but it will also continue\n // to run the current render function to completion.\n // Since we sometimes trigger some side-effects in the render function, we\n // re-assign `state` to the new state to ensure that those side-effects are\n // triggered with the new state.\n var newInternalState = createInternalState(internalState);\n updateInternalState(newInternalState);\n return [newInternalState, onQueryExecuted];\n }\n return [internalState, onQueryExecuted];\n}\nexport function useQueryInternals(query, options) {\n var client = useApolloClient(options.client);\n var renderPromises = React.useContext(getApolloContext()).renderPromises;\n var isSyncSSR = !!renderPromises;\n var disableNetworkFetches = client.disableNetworkFetches;\n var ssrAllowed = options.ssr !== false && !options.skip;\n var partialRefetch = options.partialRefetch;\n var makeWatchQueryOptions = createMakeWatchQueryOptions(client, query, options, isSyncSSR);\n var _a = useInternalState(client, query, options, renderPromises, makeWatchQueryOptions), _b = _a[0], observable = _b.observable, resultData = _b.resultData, onQueryExecuted = _a[1];\n var watchQueryOptions = makeWatchQueryOptions(observable);\n useResubscribeIfNecessary(resultData, // might get mutated during render\n observable, // might get mutated during render\n client, options, watchQueryOptions);\n var obsQueryFields = React.useMemo(function () { return bindObservableMethods(observable); }, [observable]);\n useRegisterSSRObservable(observable, renderPromises, ssrAllowed);\n var result = useObservableSubscriptionResult(resultData, observable, client, options, watchQueryOptions, disableNetworkFetches, partialRefetch, isSyncSSR, {\n onCompleted: options.onCompleted || noop,\n onError: options.onError || noop,\n });\n return {\n result: result,\n obsQueryFields: obsQueryFields,\n observable: observable,\n resultData: resultData,\n client: client,\n onQueryExecuted: onQueryExecuted,\n };\n}\nfunction useObservableSubscriptionResult(resultData, observable, client, options, watchQueryOptions, disableNetworkFetches, partialRefetch, isSyncSSR, callbacks) {\n var callbackRef = React.useRef(callbacks);\n React.useEffect(function () {\n // Make sure state.onCompleted and state.onError always reflect the latest\n // options.onCompleted and options.onError callbacks provided to useQuery,\n // since those functions are often recreated every time useQuery is called.\n // Like the forceUpdate method, the versions of these methods inherited from\n // InternalState.prototype are empty no-ops, but we can override them on the\n // base state object (without modifying the prototype).\n callbackRef.current = callbacks;\n });\n var resultOverride = ((isSyncSSR || disableNetworkFetches) &&\n options.ssr === false &&\n !options.skip) ?\n // If SSR has been explicitly disabled, and this function has been called\n // on the server side, return the default loading state.\n ssrDisabledResult\n : options.skip || watchQueryOptions.fetchPolicy === \"standby\" ?\n // When skipping a query (ie. we're not querying for data but still want to\n // render children), make sure the `data` is cleared out and `loading` is\n // set to `false` (since we aren't loading anything).\n //\n // NOTE: We no longer think this is the correct behavior. Skipping should\n // not automatically set `data` to `undefined`, but instead leave the\n // previous data in place. In other words, skipping should not mandate that\n // previously received data is all of a sudden removed. Unfortunately,\n // changing this is breaking, so we'll have to wait until Apollo Client 4.0\n // to address this.\n skipStandbyResult\n : void 0;\n var previousData = resultData.previousData;\n var currentResultOverride = React.useMemo(function () {\n return resultOverride &&\n toQueryResult(resultOverride, previousData, observable, client);\n }, [client, observable, resultOverride, previousData]);\n return useSyncExternalStore(React.useCallback(function (handleStoreChange) {\n // reference `disableNetworkFetches` here to ensure that the rules of hooks\n // keep it as a dependency of this effect, even though it's not used\n disableNetworkFetches;\n if (isSyncSSR) {\n return function () { };\n }\n var onNext = function () {\n var previousResult = resultData.current;\n // We use `getCurrentResult()` instead of the onNext argument because\n // the values differ slightly. Specifically, loading results will have\n // an empty object for data instead of `undefined` for some reason.\n var result = observable.getCurrentResult();\n // Make sure we're not attempting to re-render similar results\n if (previousResult &&\n previousResult.loading === result.loading &&\n previousResult.networkStatus === result.networkStatus &&\n equal(previousResult.data, result.data)) {\n return;\n }\n setResult(result, resultData, observable, client, partialRefetch, handleStoreChange, callbackRef.current);\n };\n var onError = function (error) {\n subscription.current.unsubscribe();\n subscription.current = observable.resubscribeAfterError(onNext, onError);\n if (!hasOwnProperty.call(error, \"graphQLErrors\")) {\n // The error is not a GraphQL error\n throw error;\n }\n var previousResult = resultData.current;\n if (!previousResult ||\n (previousResult && previousResult.loading) ||\n !equal(error, previousResult.error)) {\n setResult({\n data: (previousResult &&\n previousResult.data),\n error: error,\n loading: false,\n networkStatus: NetworkStatus.error,\n }, resultData, observable, client, partialRefetch, handleStoreChange, callbackRef.current);\n }\n };\n // TODO evaluate if we keep this in\n // React Compiler cannot handle scoped `let` access, but a mutable object\n // like this is fine.\n // was:\n // let subscription = observable.subscribe(onNext, onError);\n var subscription = { current: observable.subscribe(onNext, onError) };\n // Do the \"unsubscribe\" with a short delay.\n // This way, an existing subscription can be reused without an additional\n // request if \"unsubscribe\" and \"resubscribe\" to the same ObservableQuery\n // happen in very fast succession.\n return function () {\n setTimeout(function () { return subscription.current.unsubscribe(); });\n };\n }, [\n disableNetworkFetches,\n isSyncSSR,\n observable,\n resultData,\n partialRefetch,\n client,\n ]), function () {\n return currentResultOverride ||\n getCurrentResult(resultData, observable, callbackRef.current, partialRefetch, client);\n }, function () {\n return currentResultOverride ||\n getCurrentResult(resultData, observable, callbackRef.current, partialRefetch, client);\n });\n}\nfunction useRegisterSSRObservable(observable, renderPromises, ssrAllowed) {\n if (renderPromises && ssrAllowed) {\n renderPromises.registerSSRObservable(observable);\n if (observable.getCurrentResult().loading) {\n // TODO: This is a legacy API which could probably be cleaned up\n renderPromises.addObservableQueryPromise(observable);\n }\n }\n}\n// this hook is not compatible with any rules of React, and there's no good way to rewrite it.\n// it should stay a separate hook that will not be optimized by the compiler\nfunction useResubscribeIfNecessary(\n/** this hook will mutate properties on `resultData` */\nresultData, \n/** this hook will mutate properties on `observable` */\nobservable, client, options, watchQueryOptions) {\n var _a;\n if (observable[lastWatchOptions] &&\n !equal(observable[lastWatchOptions], watchQueryOptions)) {\n // Though it might be tempting to postpone this reobserve call to the\n // useEffect block, we need getCurrentResult to return an appropriate\n // loading:true result synchronously (later within the same call to\n // useQuery). Since we already have this.observable here (not true for\n // the very first call to useQuery), we are not initiating any new\n // subscriptions, though it does feel less than ideal that reobserve\n // (potentially) kicks off a network request (for example, when the\n // variables have changed), which is technically a side-effect.\n observable.reobserve(getObsQueryOptions(observable, client, options, watchQueryOptions));\n // Make sure getCurrentResult returns a fresh ApolloQueryResult<TData>,\n // but save the current data as this.previousData, just like setResult\n // usually does.\n resultData.previousData =\n ((_a = resultData.current) === null || _a === void 0 ? void 0 : _a.data) || resultData.previousData;\n resultData.current = void 0;\n }\n observable[lastWatchOptions] = watchQueryOptions;\n}\n/*\n * A function to massage options before passing them to ObservableQuery.\n * This is two-step curried because we want to reuse the `make` function,\n * but the `observable` might differ between calls to `make`.\n */\nexport function createMakeWatchQueryOptions(client, query, _a, isSyncSSR) {\n if (_a === void 0) { _a = {}; }\n var skip = _a.skip, ssr = _a.ssr, onCompleted = _a.onCompleted, onError = _a.onError, defaultOptions = _a.defaultOptions, \n // The above options are useQuery-specific, so this ...otherOptions spread\n // makes otherOptions almost a WatchQueryOptions object, except for the\n // query property that we add below.\n otherOptions = __rest(_a, [\"skip\", \"ssr\", \"onCompleted\", \"onError\", \"defaultOptions\"]);\n return function (observable) {\n // This Object.assign is safe because otherOptions is a fresh ...rest object\n // that did not exist until just now, so modifications are still allowed.\n var watchQueryOptions = Object.assign(otherOptions, { query: query });\n if (isSyncSSR &&\n (watchQueryOptions.fetchPolicy === \"network-only\" ||\n watchQueryOptions.fetchPolicy === \"cache-and-network\")) {\n // this behavior was added to react-apollo without explanation in this PR\n // https://github.com/apollographql/react-apollo/pull/1579\n watchQueryOptions.fetchPolicy = \"cache-first\";\n }\n if (!watchQueryOptions.variables) {\n watchQueryOptions.variables = {};\n }\n if (skip) {\n // When skipping, we set watchQueryOptions.fetchPolicy initially to\n // \"standby\", but we also need/want to preserve the initial non-standby\n // fetchPolicy that would have been used if not skipping.\n watchQueryOptions.initialFetchPolicy =\n watchQueryOptions.initialFetchPolicy ||\n watchQueryOptions.fetchPolicy ||\n getDefaultFetchPolicy(defaultOptions, client.defaultOptions);\n watchQueryOptions.fetchPolicy = \"standby\";\n }\n else if (!watchQueryOptions.fetchPolicy) {\n watchQueryOptions.fetchPolicy =\n (observable === null || observable === void 0 ? void 0 : observable.options.initialFetchPolicy) ||\n getDefaultFetchPolicy(defaultOptions, client.defaultOptions);\n }\n return watchQueryOptions;\n };\n}\nexport function getObsQueryOptions(observable, client, queryHookOptions, watchQueryOptions) {\n var toMerge = [];\n var globalDefaults = client.defaultOptions.watchQuery;\n if (globalDefaults)\n toMerge.push(globalDefaults);\n if (queryHookOptions.defaultOptions) {\n toMerge.push(queryHookOptions.defaultOptions);\n }\n // We use compact rather than mergeOptions for this part of the merge,\n // because we want watchQueryOptions.variables (if defined) to replace\n // this.observable.options.variables whole. This replacement allows\n // removing variables by removing them from the variables input to\n // useQuery. If the variables were always merged together (rather than\n // replaced), there would be no way to remove existing variables.\n // However, the variables from options.defaultOptions and globalDefaults\n // (if provided) should be merged, to ensure individual defaulted\n // variables always have values, if not otherwise defined in\n // observable.options or watchQueryOptions.\n toMerge.push(compact(observable && observable.options, watchQueryOptions));\n return toMerge.reduce(mergeOptions);\n}\nfunction setResult(nextResult, resultData, observable, client, partialRefetch, forceUpdate, callbacks) {\n var previousResult = resultData.current;\n if (previousResult && previousResult.data) {\n resultData.previousData = previousResult.data;\n }\n if (!nextResult.error && isNonEmptyArray(nextResult.errors)) {\n // Until a set naming convention for networkError and graphQLErrors is\n // decided upon, we map errors (graphQLErrors) to the error options.\n // TODO: Is it possible for both result.error and result.errors to be\n // defined here?\n nextResult.error = new ApolloError({ graphQLErrors: nextResult.errors });\n }\n resultData.current = toQueryResult(unsafeHandlePartialRefetch(nextResult, observable, partialRefetch), resultData.previousData, observable, client);\n // Calling state.setResult always triggers an update, though some call sites\n // perform additional equality checks before committing to an update.\n forceUpdate();\n handleErrorOrCompleted(nextResult, previousResult === null || previousResult === void 0 ? void 0 : previousResult.networkStatus, callbacks);\n}\nfunction handleErrorOrCompleted(result, previousNetworkStatus, callbacks) {\n if (!result.loading) {\n var error_1 = toApolloError(result);\n // wait a tick in case we are in the middle of rendering a component\n Promise.resolve()\n .then(function () {\n if (error_1) {\n callbacks.onError(error_1);\n }\n else if (result.data &&\n previousNetworkStatus !== result.networkStatus &&\n result.networkStatus === NetworkStatus.ready) {\n callbacks.onCompleted(result.data);\n }\n })\n .catch(function (error) {\n globalThis.__DEV__ !== false && invariant.warn(error);\n });\n }\n}\nfunction getCurrentResult(resultData, observable, callbacks, partialRefetch, client) {\n // Using this.result as a cache ensures getCurrentResult continues returning\n // the same (===) result object, unless state.setResult has been called, or\n // we're doing server rendering and therefore override the result below.\n if (!resultData.current) {\n // WARNING: SIDE-EFFECTS IN THE RENDER FUNCTION\n // this could call unsafeHandlePartialRefetch\n setResult(observable.getCurrentResult(), resultData, observable, client, partialRefetch, function () { }, callbacks);\n }\n return resultData.current;\n}\nexport function getDefaultFetchPolicy(queryHookDefaultOptions, clientDefaultOptions) {\n var _a;\n return ((queryHookDefaultOptions === null || queryHookDefaultOptions === void 0 ? void 0 : queryHookDefaultOptions.fetchPolicy) ||\n ((_a = clientDefaultOptions === null || clientDefaultOptions === void 0 ? void 0 : clientDefaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||\n \"cache-first\");\n}\nexport function toApolloError(result) {\n return isNonEmptyArray(result.errors) ?\n new ApolloError({ graphQLErrors: result.errors })\n : result.error;\n}\nexport function toQueryResult(result, previousData, observable, client) {\n var data = result.data, partial = result.partial, resultWithoutPartial = __rest(result, [\"data\", \"partial\"]);\n var queryResult = __assign(__assign({ data: data }, resultWithoutPartial), { client: client, observable: observable, variables: observable.variables, called: result !== ssrDisabledResult && result !== skipStandbyResult, previousData: previousData });\n return queryResult;\n}\nfunction unsafeHandlePartialRefetch(result, observable, partialRefetch) {\n // TODO: This code should be removed when the partialRefetch option is\n // removed. I was unable to get this hook to behave reasonably in certain\n // edge cases when this block was put in an effect.\n if (result.partial &&\n partialRefetch &&\n !result.loading &&\n (!result.data || Object.keys(result.data).length === 0) &&\n observable.options.fetchPolicy !== \"cache-only\") {\n observable.refetch();\n return __assign(__assign({}, result), { loading: true, networkStatus: NetworkStatus.refetch });\n }\n return result;\n}\nvar ssrDisabledResult = maybeDeepFreeze({\n loading: true,\n data: void 0,\n error: void 0,\n networkStatus: NetworkStatus.loading,\n});\nvar skipStandbyResult = maybeDeepFreeze({\n loading: false,\n data: void 0,\n error: void 0,\n networkStatus: NetworkStatus.ready,\n});\nfunction bindObservableMethods(observable) {\n return {\n refetch: observable.refetch.bind(observable),\n reobserve: function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (globalThis.__DEV__ !== false) {\n globalThis.__DEV__ !== false && invariant.warn(83);\n }\n return observable.reobserve.apply(observable, args);\n },\n fetchMore: observable.fetchMore.bind(observable),\n updateQuery: observable.updateQuery.bind(observable),\n startPolling: observable.startPolling.bind(observable),\n stopPolling: observable.stopPolling.bind(observable),\n subscribeToMore: observable.subscribeToMore.bind(observable),\n };\n}\n//# sourceMappingURL=useQuery.js.map","import { __assign } from \"tslib\";\nimport * as React from \"rehackt\";\nimport { mergeOptions } from \"../../utilities/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { DocumentType, verifyDocumentType } from \"../parser/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\nimport { useApolloClient } from \"./useApolloClient.js\";\nimport { useIsomorphicLayoutEffect } from \"./internal/useIsomorphicLayoutEffect.js\";\nimport { useWarnRemovedOption } from \"./internal/useWarnRemovedOption.js\";\n/**\n *\n *\n * > Refer to the [Mutations](https://www.apollographql.com/docs/react/data/mutations/) section for a more in-depth overview of `useMutation`.\n *\n * @example\n * ```jsx\n * import { gql, useMutation } from '@apollo/client';\n *\n * const ADD_TODO = gql`\n * mutation AddTodo($type: String!) {\n * addTodo(type: $type) {\n * id\n * type\n * }\n * }\n * `;\n *\n * function AddTodo() {\n * let input;\n * const [addTodo, { data }] = useMutation(ADD_TODO);\n *\n * return (\n * <div>\n * <form\n * onSubmit={e => {\n * e.preventDefault();\n * addTodo({ variables: { type: input.value } });\n * input.value = '';\n * }}\n * >\n * <input\n * ref={node => {\n * input = node;\n * }}\n * />\n * <button type=\"submit\">Add Todo</button>\n * </form>\n * </div>\n * );\n * }\n * ```\n * @since 3.0.0\n * @param mutation - A GraphQL mutation document parsed into an AST by `gql`.\n * @param options - Options to control how the mutation is executed.\n * @returns A tuple in the form of `[mutate, result]`\n */\nexport function useMutation(mutation, options) {\n if (globalThis.__DEV__ !== false) {\n // eslint-disable-next-line react-compiler/react-compiler, react-hooks/rules-of-hooks\n useWarnRemovedOption(options || {}, \"ignoreResults\", \"useMutation\", \"If you don't want to synchronize component state with the mutation, please use the `useApolloClient` hook to get the client instance and call `client.mutate` directly.\");\n }\n var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);\n verifyDocumentType(mutation, DocumentType.Mutation);\n var _a = React.useState({\n called: false,\n loading: false,\n client: client,\n }), result = _a[0], setResult = _a[1];\n var ref = React.useRef({\n result: result,\n mutationId: 0,\n isMounted: true,\n client: client,\n mutation: mutation,\n options: options,\n });\n useIsomorphicLayoutEffect(function () {\n Object.assign(ref.current, { client: client, options: options, mutation: mutation });\n });\n var execute = React.useCallback(function (executeOptions) {\n if (executeOptions === void 0) { executeOptions = {}; }\n var _a = ref.current, options = _a.options, mutation = _a.mutation;\n var baseOptions = __assign(__assign({}, options), { mutation: mutation });\n var client = executeOptions.client || ref.current.client;\n if (!ref.current.result.loading &&\n !baseOptions.ignoreResults &&\n ref.current.isMounted) {\n setResult((ref.current.result = {\n loading: true,\n error: void 0,\n data: void 0,\n called: true,\n client: client,\n }));\n }\n var mutationId = ++ref.current.mutationId;\n var clientOptions = mergeOptions(baseOptions, executeOptions);\n return client\n .mutate(clientOptions)\n .then(function (response) {\n var _a, _b;\n var data = response.data, errors = response.errors;\n var error = errors && errors.length > 0 ?\n new ApolloError({ graphQLErrors: errors })\n : void 0;\n var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);\n if (error && onError) {\n onError(error, clientOptions);\n }\n if (mutationId === ref.current.mutationId &&\n !clientOptions.ignoreResults) {\n var result_1 = {\n called: true,\n loading: false,\n data: data,\n error: error,\n client: client,\n };\n if (ref.current.isMounted && !equal(ref.current.result, result_1)) {\n setResult((ref.current.result = result_1));\n }\n }\n var onCompleted = executeOptions.onCompleted || ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onCompleted);\n if (!error) {\n onCompleted === null || onCompleted === void 0 ? void 0 : onCompleted(response.data, clientOptions);\n }\n return response;\n }, function (error) {\n var _a;\n if (mutationId === ref.current.mutationId &&\n ref.current.isMounted) {\n var result_2 = {\n loading: false,\n error: error,\n data: void 0,\n called: true,\n client: client,\n };\n if (!equal(ref.current.result, result_2)) {\n setResult((ref.current.result = result_2));\n }\n }\n var onError = executeOptions.onError || ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError);\n if (onError) {\n onError(error, clientOptions);\n // TODO(brian): why are we returning this here???\n return { data: void 0, errors: error };\n }\n throw error;\n });\n }, []);\n var reset = React.useCallback(function () {\n if (ref.current.isMounted) {\n var result_3 = {\n called: false,\n loading: false,\n client: ref.current.client,\n };\n Object.assign(ref.current, { mutationId: 0, result: result_3 });\n setResult(result_3);\n }\n }, []);\n React.useEffect(function () {\n var current = ref.current;\n current.isMounted = true;\n return function () {\n current.isMounted = false;\n };\n }, []);\n return [execute, __assign({ reset: reset }, result)];\n}\n//# sourceMappingURL=useMutation.js.map","import * as React from 'react';\n\n/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { useComposedRefs };\n//# sourceMappingURL=use-composed-ref.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { isHTMLElement } from 'motion-dom';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { useComposedRefs } from '../../utils/use-composed-ref.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0;\n const computedStyle = getComputedStyle(element);\n const size = this.props.sizeRef.current;\n size.height = parseFloat(computedStyle.height);\n size.width = parseFloat(computedStyle.width);\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n size.bottom = parentHeight - size.height - size.top;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef = children.props?.ref ??\n children?.ref;\n const composedRef = useComposedRefs(ref, childRef);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom } = size.current;\n if (isPresent || pop === false || !ref.current || !width || !height)\n return;\n const x = anchorX === \"left\" ? `left: ${left}` : `right: ${right}`;\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n const parent = root ?? document.head;\n parent.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `);\n }\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\");\n if (parent.contains(style)) {\n parent.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, pop: pop, children: pop === false\n ? children\n : React.cloneElement(children, { ref: composedRef }) }));\n}\n\nexport { PopChild };\n//# sourceMappingURL=PopChild.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => presenceChildren.delete(childId);\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n children = (jsx(PopChild, { pop: mode === \"popLayout\", isPresent: isPresent, anchorX: anchorX, anchorY: anchorY, root: root, children: children }));\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n//# sourceMappingURL=PresenceChild.mjs.map\n","import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", anchorY = \"top\", root }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n exitingComponents.current.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitingComponents.current.has(key)) {\n return;\n }\n if (exitComplete.has(key)) {\n exitingComponents.current.add(key);\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, anchorY: anchorY, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n//# sourceMappingURL=index.mjs.map\n","/**\n * Resolve a widget static asset (notification sounds, brand logo, …)\n * to a fetchable URL.\n *\n * The widget's static assets live in `public/` and are served from the\n * widget's OWN origin in iframe / web-component mode — there `/sounds/\n * wx-nt_3.wav` resolves correctly. The React-component embed, though,\n * runs on the HOST page's origin (e.g. `frontend-app`), where that path\n * 404s. `__WEXIO_ASSET_BASE__` is baked in at build time (see\n * `vite.react-component.config.ts` / `vite.web-component.config.ts`):\n * the widget's CDN origin for the cross-origin embeds, and left\n * undefined for the same-origin Next iframe build (→ empty base).\n */\ndeclare const __WEXIO_ASSET_BASE__: string | undefined;\n\nconst ASSET_BASE = typeof __WEXIO_ASSET_BASE__ === \"string\" ? __WEXIO_ASSET_BASE__ : \"\";\n\n/**\n * Prefix a `public/`-relative asset path with the build-time asset\n * base. Already-absolute URLs (operator-uploaded customs) pass through\n * untouched.\n */\nexport function assetUrl(path: string): string {\n if (/^https?:\\/\\//.test(path)) return path;\n return ASSET_BASE + (path.startsWith(\"/\") ? path : `/${path}`);\n}\n","\"use client\";\n\nimport { createContext, type ReactNode, useContext } from \"react\";\nimport type { InjectableWidgetConfig, WidgetConfig } from \"./widget-config\";\n\n/**\n * Visitor identity the host passes in to log a known user into the\n * widget (the embed equivalent of Intercom's `boot({ user_id, ... })`).\n *\n * `userId` + `userHash` are the IDENTITY — `userHash` is an\n * HMAC-SHA256(integration secret, userId) the host computes server-side,\n * which the BE re-derives and constant-time compares so a visitor can't\n * be impersonated. The rest is profile data, NOT used for auth:\n * `name` / `email` / `phone` are written to the People row, and\n * `attributes` is an open bag of extra fields forwarded as the session\n * `contextSnapshot`.\n *\n * Threaded to `useVisitorAuth`, which routes to `startIdentifiedVisitor`\n * (vs `startAnonymousVisitor`) when present.\n */\nexport interface VisitorIdentity {\n /** Verified user id. Required on the HMAC path (it's what `userHash`\n * signs); optional on the `jwt` path (the BE takes it from the token's\n * `sub`). */\n userId?: string;\n /** Legacy HMAC proof — `HMAC-SHA256(secret, userId)`. Supply with\n * `userId`. Mutually exclusive with `jwt`. */\n userHash?: string;\n /** RECOMMENDED: a short-lived host-signed JWT (HS256). Carries\n * `{ sub, email?, name?, phone?, exp }`; the BE verifies signature +\n * expiry. Mutually exclusive with `userHash`. */\n jwt?: string;\n /** Google \"Sign in with Google\" / One-Tap `id_token` (FedCM). The BE\n * verifies it against Google's keys with the integration's\n * `googleClientId`. Mutually exclusive with the other proofs. */\n googleIdToken?: string;\n name?: string;\n email?: string;\n phone?: string;\n attributes?: Record<string, unknown>;\n}\n\n/**\n * Default profile values the host passes to PRE-FILL the prechat form\n * (e.g. via `?wx_email=…` URL params, a `prefill` prop, or\n * `window.wexioSettings.prefill`). Unlike `VisitorIdentity` there's no\n * `userHash` — these are UNVERIFIED, so they don't authenticate anyone;\n * they just save the visitor typing. When they cover every required\n * prechat field the widget attaches them (via the prechat write) and\n * skips the form; otherwise it pre-fills what it can and shows the rest.\n */\nexport interface VisitorPrefill {\n name?: string;\n email?: string;\n phone?: string;\n}\n\n/**\n * Two delivery modes:\n *\n * - **iframe** — host page injects `loader.js`, which renders\n * the widget inside an iframe. Resize / close\n * signals fire as `postMessage` to `window.parent`,\n * and the public-key comes from the iframe URL\n * (`?pk=...`).\n *\n * - **web-component** — host page mounts `<wexio-widget>` directly.\n * The widget runs in the host's JS context inside\n * a Shadow DOM. There is no parent frame to\n * postMessage to and no iframe URL to read; the\n * web-component bridge supplies the public-key\n * via an attribute and listens for resize / close\n * via `CustomEvent`s instead.\n *\n * The `WidgetShell` stays env-agnostic — it asks `useWidgetEnv()` for the\n * outbound signal handlers and trusts the host adapter to do the right\n * thing. Default values keep the iframe path working without any provider\n * (so `next dev` + Storybook continue to behave identically).\n */\nexport interface WidgetEnv {\n /** Which embed surface the widget is mounted into. */\n kind: \"iframe\" | \"web-component\";\n /**\n * Public-key override. Web-component mode passes the value from the\n * `<wexio-widget public-key=\"...\">` attribute; iframe mode leaves\n * this undefined and `useWidgetConfig` reads `?pk=` from the URL.\n */\n publicKeyOverride?: string;\n /**\n * Explicit mode override (defaults to URL-driven). Web-component\n * mode pins this to `production` because the embed is for real\n * deployments — there is no demo/preview attribute path.\n */\n modeOverride?: \"production\" | \"preview\" | \"demo\";\n /**\n * Live config patch from a React host — the operator dashboard's\n * theme/branding editor threads its in-progress draft here via the\n * `<WexioWidget configOverride={...} />` prop. `useWidgetConfig`\n * merges it on top of the resolved config (BE / demo) AND any\n * iframe `postMessage` patches, so the preview pane reflects\n * unsaved edits instantly with no serialization round-trip.\n *\n * Iframe + web-component embeds leave this undefined — the iframe\n * uses the `wexio:preview-config:v1` postMessage channel instead.\n */\n configOverride?: Partial<WidgetConfig>;\n /**\n * Full, host-supplied widget config. When set, `useWidgetConfig` uses\n * it VERBATIM as the base and SKIPS the `GET /api/web/config/:pk`\n * bootstrap round-trip — for a host (SSR, an app shell, the dashboard)\n * that already holds the integration's config and wants the widget to\n * boot with one fewer request. `configOverride` still layers on top.\n *\n * Distinct from its two neighbours:\n * - `configOverride` is a PARTIAL patch merged onto a FETCHED base.\n * - `forceDummyData` swaps in `DEMO_CONFIG` + the MOCK data layer.\n * - `configBase` is the REAL, complete config and keeps the LIVE data\n * layer (real conversations / help / news). Combine with\n * `forceDummyData` only if you also want mock content.\n *\n * The host owns locale-correctness: the config's localized chrome\n * (greeting / messenger / prechat) is whatever was passed, so re-inject\n * it when the visitor switches language (there's no fetch to re-run).\n *\n * The `publicKey` is still required (GraphQL header + visitor\n * handshake) — only the CONFIG fetch is skipped.\n *\n * Typed `InjectableWidgetConfig` (NOT the full `WidgetConfig`): the\n * server-/plan-owned fields (`branding`, `status`) and the integration\n * identity (`integrationId`, `name`) are excluded so a host can't\n * override them from props — `useWidgetConfig` fills those itself.\n */\n configBase?: InjectableWidgetConfig;\n /**\n * Force the widget into demo-data mode regardless of whether a real\n * `publicKey` was supplied. The operator dashboard's preview pane\n * uses this to render the bundled mock content layer (messages,\n * help articles + categories + FAQs, news items, launcher unread\n * count, …) on top of the operator's real config — so a brand-new\n * integration with empty BE-side content still shows a populated\n * widget to design against. Set `false` (or omit) and the widget\n * uses live data: real conversations, real articles, real news.\n *\n * Only affects the data layer — operator config (theme, branding,\n * logo, greeting, prechat, sounds, blocks, …) always flows through\n * untouched, in either mode.\n */\n forceDummyData?: boolean;\n /**\n * Dashboard-prefetched data for the preview pane. When set, the\n * widget reads news content from this object instead of round-\n * tripping to the BE — lets the preview render real operator data\n * without the widget's visitor-side queries hitting the\n * `WebOriginGuard` from a dashboard origin.\n *\n * Shape mirrors the visitor JSON the BE returns (id, title, excerpt,\n * coverImageUrl, externalCoverImageUrl, publishedAt, …). Components\n * that consume it use the same extractors as the live query path.\n *\n * `null` / undefined → fall through to the live query (production\n * embeds, real customer pages). Only meaningful when the dashboard\n * preview pane mounts the widget.\n */\n previewData?: {\n newsPosts?: unknown[];\n newsPostsById?: Record<string, unknown>;\n helpArticles?: unknown[];\n helpArticlesById?: Record<string, unknown>;\n };\n /**\n * Anchor the launcher + panel to the embed's host `<div>` instead of\n * the viewport. The React-component embed sets this `true` — the host\n * sizes + positions the outer `<div>` with normal layout CSS and the\n * widget fills that box (`position: absolute`), so the launcher/panel\n * never escape into a `position: fixed` viewport corner. Iframe +\n * web-component embeds leave it undefined: they own the whole viewport\n * (or their own iframe) and keep the `fixed` corner anchoring.\n */\n embedded?: boolean;\n /**\n * Render the media lightbox as a viewport-`fixed` overlay rather than\n * one `absolute`-contained to the widget's host box.\n *\n * Only meaningful when `embedded` is `true`. The dashboard's *desktop*\n * preview pane wants the lightbox contained (it's a small framed\n * mock inside a larger editor) — leave this unset. The dashboard's\n * *mobile* floating-widget preview is itself tiny, so a contained\n * lightbox would be unusable; it sets this `true` so the gallery\n * breaks out to the full viewport. The overlay still renders inside\n * the Shadow DOM either way (it keeps the widget's styles) — this\n * only switches `absolute` ↔ `fixed`.\n */\n lightboxViewport?: boolean;\n /**\n * Where the widget writes its `data-theme=\"light|dark\"` attribute and\n * injects the operator's theme-token `<style>` block.\n *\n * The React-component embed points these at its **Shadow DOM** — the\n * portal-target element for `themeRoot`, the shadow root itself for\n * `styleRoot` — so the widget's theming is fully self-contained and\n * never mutates (or depends on) the host page's `<html>`. The\n * structural dark-mode rules in `globals.css` (panel glow, header\n * polish) are adopted into the shadow DOM, so they only match when\n * `data-theme` lives inside that same tree.\n *\n * Iframe / web-component embeds leave both undefined and fall back\n * to `document.documentElement` + `document.head`.\n */\n themeRoot?: HTMLElement;\n styleRoot?: ShadowRoot | Document;\n /**\n * Called every time the widget's intended dimensions change. The\n * iframe adapter forwards via `postMessage`; the web-component\n * adapter dispatches a `wexio:resize` `CustomEvent` on the host\n * element so a `ResizeObserver`-style integration on the host can\n * react.\n */\n onResize: (width: number, height: number) => void;\n /**\n * Called when the visitor closes the panel via the close button.\n * Iframe adapter posts to the parent so the loader hides the\n * frame; web-component adapter dispatches a `wexio:close`\n * `CustomEvent` for host-side teardown.\n */\n onClose: () => void;\n /**\n * Reports the operator's resolved `localeStrategy` once the config\n * has loaded — the embed's \"phase 2\" of locale resolution.\n *\n * The embed wrapper resolves a PROVISIONAL locale at mount (explicit\n * prop/attr, else browser) before the BE strategy is known. Once\n * `useWidgetConfig` has the config it hands the strategy back here so\n * the wrapper can re-resolve via `detectClientLocale(strategy)` — e.g.\n * switch to the host page's `<html lang>` for `WEBSITE`, or to a\n * pinned code. A no-op when the host pinned an explicit locale.\n *\n * Set only by the **embeds** (web-component / react-component). The\n * iframe leaves it undefined: the loader already resolved the strategy\n * and passed `?lang=`, so the server picked the right locale up front.\n */\n onLocaleStrategy?: (strategy: string) => void;\n /**\n * Known-user identity supplied by the host (see `VisitorIdentity`).\n * The web-component (`identify(user)`) and react-component (`user`\n * prop) set this directly. The iframe leaves it undefined and\n * receives identity asynchronously over `postMessage` instead\n * (`useHostVisitorIdentity` bridges that), since the host's data\n * can't cross into the iframe document any other way.\n */\n visitorIdentity?: VisitorIdentity;\n /**\n * Default profile values to pre-fill the prechat form (see\n * `VisitorPrefill`). Set by the embeds directly; the iframe receives\n * it over `postMessage` (`wexio:prefill:v1`), bridged alongside\n * identity in `useHostVisitorData`. Unverified — convenience only.\n */\n visitorPrefill?: VisitorPrefill;\n}\n\n/**\n * Default env — assumes iframe + parent window is the host. Matches the\n * pre-existing behaviour so any non-provider path (Storybook stories\n * mounted outside the loader, `next dev` on `/`) still works.\n */\nfunction iframeDefaultEnv(): WidgetEnv {\n const post = (msg: object) => {\n if (typeof window === \"undefined\") return;\n window.parent?.postMessage(msg, \"*\");\n };\n return {\n kind: \"iframe\",\n onResize: (width, height) => post({ type: \"wexio:widget:resize:v1\", width, height }),\n onClose: () => post({ type: \"wexio:widget:close:v1\" }),\n };\n}\n\nconst WidgetEnvContext = createContext<WidgetEnv | null>(null);\n\nexport function WidgetEnvProvider({ env, children }: { env: WidgetEnv; children: ReactNode }) {\n return <WidgetEnvContext.Provider value={env}>{children}</WidgetEnvContext.Provider>;\n}\n\n/**\n * Read the active embed environment. Falls back to the iframe defaults\n * when no provider is mounted — exactly the behaviour the widget had\n * before this context existed.\n */\nexport function useWidgetEnv(): WidgetEnv {\n const ctx = useContext(WidgetEnvContext);\n // `useMemo` would be overkill here — `iframeDefaultEnv` is cheap and\n // the consumers store the returned handlers in effect deps that only\n // care about reference equality across a single render.\n return ctx ?? iframeDefaultEnv();\n}\n","import type {\n InjectableWidgetConfig,\n PrechatFieldKind,\n WidgetConfig,\n WidgetPrechatForm,\n} from \"./widget-config\";\n\n/**\n * The widget's REST surface area is **one endpoint**: the loader-script\n * bootstrap call to `GET /api/web/config/:publicKey`. Everything else\n * (messages, news, help, signals, upload, history) goes through the\n * visitor-facing GraphQL resolver wired in Day 1c.\n *\n * Why config stays REST: the loader script that injects this iframe\n * does NOT bundle Apollo — keeping config as a simple GET means the\n * loader can pre-fetch it before the iframe mounts, avoiding a\n * round-trip of empty-state paint during cold loads.\n */\n\n/** Plain-localhost HTTP fallback — Storybook, headless CI, anything\n * served on `http://localhost` where the BE also runs on HTTP. */\nconst DEFAULT_API_BASE_HTTP = \"http://localhost:3001\";\n\n/** Cert-backed HTTPS endpoint the BE exposes locally — used when the\n * host page is the dashboard at `https://local.app.wexio.io:3000`\n * (browser blocks mixed http→https; the matching `local.api.wexio.io`\n * cert avoids that and satisfies CORS). */\nconst DEFAULT_API_BASE_HTTPS_LOCAL = \"https://local.api.wexio.io:3443\";\n\n/**\n * Resolve the BE base URL the widget should hit.\n *\n * Order of precedence:\n * 1. **`NEXT_PUBLIC_WEXIO_API_URL`** — explicit override, wins. Set\n * this in `web-widget/.env.local` to point at a custom BE.\n * 2. **Same-protocol same-domain auto-detect** — when the host page\n * is on `https://*.wexio.io`, route to the matching\n * `api.<rest>.wexio.io` so dev (`local.api.wexio.io:3443`) and\n * prod (`api.wexio.io`) both work without env config.\n * 3. **Plain-localhost fallback** — `http://localhost:3001` for\n * Storybook / CI / non-cert local setups.\n *\n * SSR-safe: reads `window.location` only in the browser; falls back\n * to the http default during SSR (which is fine — the widget never\n * fetches during SSR).\n */\nexport function apiBase(): string {\n const override = process.env.NEXT_PUBLIC_WEXIO_API_URL;\n if (override) return override;\n\n if (typeof window !== \"undefined\") {\n const { protocol, hostname } = window.location;\n\n // Local dashboard (`local.app.wexio.io`) → local BE\n // (`local.api.wexio.io:3443`). The BE serves a matching cert so\n // CORS preflight + secure-context constraints all line up.\n if (protocol === \"https:\" && /^local\\.[a-z-]+\\.wexio\\.io$/i.test(hostname)) {\n return DEFAULT_API_BASE_HTTPS_LOCAL;\n }\n\n // Production / staging / PR dashboards on any `.wexio.io`\n // subdomain → derive the `api.` sibling by swapping the `app` /\n // `templates` segment for `api`. e.g.\n // `app.wexio.io` → `api.wexio.io`\n // `staging.app.wexio.io` → `staging.api.wexio.io`\n // `pr-123.app.wexio.io` → `pr-123.api.wexio.io`\n if (protocol === \"https:\" && /\\.wexio\\.io$/i.test(hostname)) {\n const apiHost = hostname\n // `app.wexio.io` / `templates.wexio.io` → `api.wexio.io`.\n .replace(/^(app|templates)\\./i, \"api.\")\n // `<env>.app.wexio.io` / `<env>.templates.wexio.io` →\n // `<env>.api.wexio.io`.\n .replace(/\\.(app|templates)\\./i, \".api.\");\n // Defensive fallback for hostnames that don't fit either\n // pattern — point at the root `api.` so the widget still has\n // somewhere to ask.\n return apiHost === hostname ? `https://api.wexio.io` : `https://${apiHost}`;\n }\n }\n\n return DEFAULT_API_BASE_HTTP;\n}\n\n/**\n * Backend response shape — matches the `WebConfigDto` returned by the\n * REST controller. The mapper below normalises it to the widget's\n * internal `WidgetConfig` shape, papering over any naming drift\n * between the two layers.\n */\n/**\n * Raw shape of `GET /api/web/config/:pk`. Exported so a host that\n * proxies that endpoint (and wants to inject the result via the\n * `config` prop / `window.wexioSettings.config` to skip the widget's\n * own fetch) can convert it to the internal `WidgetConfig` with\n * `mapBackendConfig` rather than hand-building the internal shape.\n */\nexport interface BackendWebConfig {\n // Only the fields the widget actually CONSUMES are declared. The BE\n // response also carries `integrationId` / `name` / `publicKey` (and the\n // full payload always has), but the widget doesn't use them — they're\n // the integration's internal admin fields, not visitor config — so they\n // aren't declared here. (`allowedOrigins` was dropped from the visitor\n // response entirely; `WebOriginGuard` enforces it server-side.)\n status: \"active\" | \"disabled\" | \"plan_blocked\";\n defaultTab?: \"HOME\" | \"MESSENGER\" | \"HELP\" | \"NEWS\" | \"PROFILE\";\n /** UI-language strategy — `\"AUTO\"` / `\"WEBSITE\"` / `\"DEFAULT\"`. Absent\n * on legacy rows → mapped to `\"AUTO\"`. */\n localeStrategy?: \"AUTO\" | \"WEBSITE\" | \"DEFAULT\";\n /** Integration's canonical / fallback language (BCP-47). Resolves\n * `localeStrategy: \"DEFAULT\"`. Absent → `\"en\"`. */\n defaultLocale?: string;\n /** Languages the operator enabled (drives the switcher); always\n * includes `defaultLocale`. BE-sent; not consumed by the mapper yet. */\n supportedLocales?: string[];\n /** The locale actually served for this response (echoed back). BE-sent;\n * declared so a full payload passes through `mapBackendConfig`. */\n locale?: string;\n /** Visitor-auth config — sign-in methods (Google / passkey) + the\n * `requireAuth` composer gate. Absent on legacy rows → all-off\n * default. `google.clientId` is the operator's PUBLIC Google OAuth\n * identifier (same one their main-site login uses) — the widget\n * runs GIS directly with it. The BE verifies `id_token.aud` against\n * the same stored value server-side, so a leaked clientId can't be\n * abused (Google's redirect-URI allowlist + the BE audience check\n * are the actual security boundaries). */\n security?: {\n requireAuth?: boolean;\n google?: { enabled?: boolean; clientId?: string | null };\n passkey?: { enabled?: boolean };\n } | null;\n theme?: Record<string, unknown> | null;\n features?: {\n home?: boolean;\n messenger?: boolean;\n help?: boolean;\n news?: boolean;\n profile?: boolean;\n } | null;\n prechatForm?: {\n enabled?: boolean;\n fields?: Array<{\n kind?: string;\n key?: string;\n label?: string;\n required?: boolean;\n }>;\n } | null;\n homeLayout?: unknown[] | null;\n /** Per-mode logo URLs — already flattened from Media refs by the BE. */\n logo?: { light?: string | null; dark?: string | null } | null;\n operatorAvatars?: Array<{ src?: string; alt?: string }> | null;\n greeting?: { headline?: string; subheadline?: string } | null;\n branding?: { hidden?: boolean } | null;\n /** Turnstile bot-protection surface. The BE sends it; the widget's\n * mapper doesn't consume it yet — declared so a full BE payload can be\n * passed through `mapBackendConfig` without an excess-property error. */\n botProtection?: {\n turnstile?: { enabled?: boolean; siteKey?: string | null };\n } | null;\n sounds?: {\n enabled?: boolean;\n inboundSoundId?: string | null;\n outboundSoundId?: string | null;\n volume?: number;\n } | null;\n messenger?: {\n title?: string | null;\n description?: string | null;\n /** BE flattens the Media `_id` → CDN URL before sending. */\n aiAssistantAvatar?: string | null;\n commands?: string[] | null;\n messages?: Array<{\n kind?: string;\n text?: string;\n }> | null;\n showRelatedNews?: boolean;\n showRelatedHelpArticles?: boolean;\n showReactionCounts?: boolean;\n } | null;\n}\n\n/**\n * In-flight + session cache for `fetchWebConfig`, keyed by\n * `publicKey|locale`. The widget reload mounts ~5 components that each\n * call `useWidgetConfig` → `fetchWebConfig` in the same tick; without\n * dedup that's 5 identical `GET /config` requests. The config is an\n * idempotent GET that only varies by `(publicKey, locale)`, so all\n * concurrent callers share ONE request, and a resolved value is reused\n * for the rest of the session (config doesn't change mid-session; a\n * locale switch is a different key → its own fetch). Failures evict the\n * entry so a later mount can retry instead of being stuck on `null`.\n */\nconst webConfigCache = new Map<string, Promise<WidgetConfig | null>>();\n\n/**\n * Fetches the public widget config. Resolves to `null` on any failure\n * — caller falls back to mock data rather than surfacing the error\n * (the widget should never show a \"couldn't load\" screen; the\n * operator's dashboard surfaces config errors separately).\n *\n * De-duplicated per `(publicKey, locale)` — see `webConfigCache`.\n */\nexport function fetchWebConfig(publicKey: string, locale?: string): Promise<WidgetConfig | null> {\n if (!publicKey) return Promise.resolve(null);\n const cacheKey = `${publicKey}|${locale ?? \"\"}`;\n const inflight = webConfigCache.get(cacheKey);\n if (inflight) return inflight;\n\n const request = (async (): Promise<WidgetConfig | null> => {\n try {\n // `?locale=` lets the BE resolve the per-locale chrome overrides\n // (greeting / messenger / prechat / home layout) server-side and\n // return already-localized base fields + the served `locale`. Omit\n // it → BE serves the integration's default-locale copy.\n const url = new URL(`${apiBase()}/api/web/config/${encodeURIComponent(publicKey)}`);\n if (locale) url.searchParams.set(\"locale\", locale);\n const res = await fetch(url.toString(), {\n method: \"GET\",\n headers: { \"x-web-public-key\": publicKey },\n credentials: \"omit\",\n });\n if (!res.ok) return null;\n const data = (await res.json()) as BackendWebConfig;\n return mapBackendConfig(data);\n } catch {\n return null;\n }\n })();\n\n // Cache the in-flight promise so concurrent callers share it. Evict on\n // a `null` result (or rejection, defensively) so a transient failure\n // doesn't poison the cache for the rest of the session.\n webConfigCache.set(\n cacheKey,\n request.then((value) => {\n if (value === null) webConfigCache.delete(cacheKey);\n return value;\n }),\n );\n return webConfigCache.get(cacheKey) ?? request;\n}\n\nconst PRECHAT_KINDS: readonly PrechatFieldKind[] = [\"NAME\", \"EMAIL\", \"PHONE\", \"CUSTOM_TEXT\"];\n\n/**\n * Defensively normalise the BE prechat shape — operators on legacy\n * rows may have partial / null fields. Unknown `kind` values are\n * dropped (rather than rendered as a broken input) so a future BE\n * enum extension doesn't crash the widget at runtime.\n */\n// `TEXT` removed alongside the WEB_VISITOR_VISIT flow-trigger landing —\n// proactive bot bubbles now arrive through SSE from the flow runner.\n// BE filters TEXT rows out of the visitor payload defensively, but we\n// keep this allow-list narrow so a legacy row sneaking through still\n// drops silently rather than rendering.\nconst MESSENGER_MESSAGE_KINDS = [\"HINT\", \"SYSTEM\"] as const;\n\n/**\n * Map the BE's `messenger` sub-doc to the widget's shape. Returns\n * `null` only when the BE explicitly sends `null` — operators who\n * haven't configured anything still get a defaults-bearing object\n * so the widget renders consistently. Defensive filters: unknown\n * `kind` values drop, non-string commands drop, length caps apply\n * client-side too (BE caps but we don't trust on read).\n */\nfunction mapMessenger(raw: BackendWebConfig[\"messenger\"]): WidgetConfig[\"messenger\"] {\n if (raw === null) return null;\n if (!raw) {\n // BE didn't include the field at all — treat as \"no operator\n // overrides\", which is the same shape as `null` from the\n // widget's perspective.\n return null;\n }\n const commands = Array.isArray(raw.commands)\n ? raw.commands.filter((c): c is string => typeof c === \"string\" && c.length > 0).slice(0, 20)\n : [];\n const messages = Array.isArray(raw.messages)\n ? raw.messages\n .filter(\n (m): m is { kind: string; text: string } =>\n !!m &&\n typeof m.text === \"string\" &&\n m.text.length > 0 &&\n typeof m.kind === \"string\" &&\n (MESSENGER_MESSAGE_KINDS as readonly string[]).includes(m.kind),\n )\n .map((m) => ({\n kind: m.kind as \"HINT\" | \"SYSTEM\",\n text: m.text,\n }))\n .slice(0, 10)\n : [];\n return {\n title: raw.title ?? null,\n description: raw.description ?? null,\n aiAssistantAvatar: raw.aiAssistantAvatar ?? null,\n commands,\n messages,\n showRelatedNews: raw.showRelatedNews ?? true,\n showRelatedHelpArticles: raw.showRelatedHelpArticles ?? true,\n showReactionCounts: raw.showReactionCounts ?? false,\n };\n}\n\nfunction mapPrechatForm(raw: BackendWebConfig[\"prechatForm\"]): WidgetPrechatForm | null {\n if (!raw) return null;\n const fields = Array.isArray(raw.fields) ? raw.fields : [];\n const mapped = fields\n .filter((f) => f && PRECHAT_KINDS.includes(f.kind as PrechatFieldKind))\n .map((f) => ({\n kind: f.kind as PrechatFieldKind,\n key: String(f.key ?? \"\"),\n label: String(f.label ?? \"\"),\n required: Boolean(f.required),\n }))\n .filter((f) => f.key.length > 0);\n return {\n enabled: Boolean(raw.enabled),\n fields: mapped,\n };\n}\n\n/**\n * Normalise the raw BE config payload (`BackendWebConfig`) to the\n * widget's internal `WidgetConfig`. Exported for hosts that already\n * hold the BE response (proxied / server-rendered) and want to inject\n * it via the `config` prop without re-fetching — `configBase` expects\n * `WidgetConfig`, not the BE shape, so run it through here first.\n */\nexport function mapBackendConfig(data: BackendWebConfig): WidgetConfig {\n return {\n // `integrationId` / `name` / `publicKey` are intentionally NOT mapped —\n // they're the integration's internal admin fields, not part of the\n // visitor `WidgetConfig`. The widget keys per-integration state off the\n // publicKey it already holds and shows `messenger.title`.\n status: data.status,\n defaultTab: (data.defaultTab?.toLowerCase() ?? \"home\") as WidgetConfig[\"defaultTab\"],\n // UI-language strategy — pass through verbatim. Legacy rows without\n // the field default to browser-detect (`AUTO`).\n localeStrategy: data.localeStrategy ?? \"AUTO\",\n // Canonical language — resolves `localeStrategy: \"DEFAULT\"`. Legacy\n // rows / demo default to English.\n defaultLocale: data.defaultLocale ?? \"en\",\n // Visitor-auth config — normalised so the widget never null-checks\n // deep. Legacy rows (no `security`) default to all-off.\n security: {\n requireAuth: data.security?.requireAuth ?? false,\n google: {\n enabled: data.security?.google?.enabled ?? false,\n clientId: data.security?.google?.clientId ?? null,\n },\n passkey: {\n enabled: data.security?.passkey?.enabled ?? false,\n },\n },\n features: {\n home: data.features?.home ?? true,\n messenger: data.features?.messenger ?? true,\n help: data.features?.help ?? true,\n news: data.features?.news ?? true,\n // Profile is ON by default — the visitor profile / preferences\n // surface is part of the widget's first-class feature set. Operators\n // can still opt OUT explicitly by setting `features.profile: false`.\n profile: data.features?.profile ?? true,\n },\n theme: (data.theme as WidgetConfig[\"theme\"]) ?? null,\n themeMode: \"auto\",\n prechatForm: mapPrechatForm(data.prechatForm),\n // Operator avatars — BE surfaces `{ src, alt }` (already flattened\n // from Media refs). Drop any entry missing a `src` so the header\n // never renders a broken `<img>`.\n operatorAvatars: Array.isArray(data.operatorAvatars)\n ? data.operatorAvatars\n .filter((a): a is { src: string; alt?: string } => !!a?.src)\n .map((a) => ({ src: a.src, alt: a.alt ?? \"\" }))\n : [],\n // Per-mode logo. BE sends `{ light, dark }` (or null). Normalise\n // missing fields to `null` so the shell's resolve-by-mode logic\n // has a stable shape.\n organizationLogo: data.logo\n ? {\n light: data.logo.light ?? null,\n dark: data.logo.dark ?? null,\n }\n : null,\n // Greeting — empty strings (or a null BE greeting) → HomeTab\n // falls back to i18n defaults (`messages/<locale>.json#home.*`).\n // Operator-set strings override the default in any locale.\n greeting: {\n headline: data.greeting?.headline ?? \"\",\n subheadline: data.greeting?.subheadline ?? \"\",\n },\n // `homeLayout` is operator JSON — pass it through verbatim; the\n // Home renderer validates per-block and falls back to\n // `DEFAULT_HOME_LAYOUT` when this is `null`.\n homeLayout: (data.homeLayout as WidgetConfig[\"homeLayout\"]) ?? null,\n branding: data.branding?.hidden ? { hidden: true } : null,\n // Prechat form already set above.\n sounds: data.sounds\n ? {\n enabled: data.sounds.enabled ?? true,\n inboundSoundId: data.sounds.inboundSoundId ?? null,\n outboundSoundId: data.sounds.outboundSoundId ?? null,\n volume:\n typeof data.sounds.volume === \"number\"\n ? Math.max(0, Math.min(1, data.sounds.volume))\n : 0.5,\n }\n : null,\n messenger: mapMessenger(data.messenger),\n };\n}\n\n/**\n * Convert a raw BE config payload into the shape a host may INJECT\n * (`config` prop / `window.wexioSettings.config`) — i.e. the full\n * `WidgetConfig` MINUS the BE-owned fields a host must never supply\n * (`branding`, `status`, `integrationId`, `name`). Use this (not\n * `mapBackendConfig`) when a host proxies `GET /api/web/config` and wants\n * to inject it: the result is type-narrowed to `InjectableWidgetConfig`,\n * so the protected fields are dropped at the type level. They're re-fetched\n * authoritatively from the BE by publicKey (the lite `?view=gate` config,\n * see `fetchWebGate`) regardless of injection, so nothing is lost.\n */\nexport function toInjectableConfig(data: BackendWebConfig): InjectableWidgetConfig {\n const { branding: _branding, status: _status, ...injectable } = mapBackendConfig(data);\n return injectable;\n}\n\n/**\n * The plan / restriction gate the widget needs BEFORE auth and must NOT\n * trust from host-injected config. Always fetched from the BE by publicKey\n * (the lite `?view=gate` config), even when presentation is injected — so\n * a host can't fake white-label removal or the plan gate. Matches the BE's\n * gate payload exactly: `{ status, branding: { hidden } }`.\n */\nexport interface WebGate {\n status: WidgetConfig[\"status\"];\n /** Plan-coerced server-side; `{ hidden: true }` only when the plan\n * allows white-label AND the operator turned it on. `null` = shown. */\n branding: WidgetConfig[\"branding\"];\n /** Visitor-auth config — surfaced here too so a host that injects\n * presentation config CAN'T forge `security.google.clientId` (the\n * BE-stored Google OAuth client id paired with the BE-side\n * audience check). Hosts may still influence `enabled` flags via\n * the injectable config; `clientId` is always the BE's value. */\n security: WidgetConfig[\"security\"];\n}\n\nconst webGateCache = new Map<string, Promise<WebGate | null>>();\n\n/**\n * Fetch ONLY the plan/restriction gate for a publicKey — the lite\n * `?view=gate` view of the config endpoint (`{ status, branding }`). Used\n * when a host injects presentation config: the widget skips the heavy\n * config but STILL fetches this small authoritative gate so branding +\n * status stay server-owned. De-duplicated per publicKey like\n * `fetchWebConfig`. (A full payload also carries these two fields, so this\n * works even if `?view=gate` isn't honored.)\n */\nexport function fetchWebGate(publicKey: string): Promise<WebGate | null> {\n if (!publicKey) return Promise.resolve(null);\n const cached = webGateCache.get(publicKey);\n if (cached) return cached;\n\n const request = (async (): Promise<WebGate | null> => {\n try {\n const url = new URL(`${apiBase()}/api/web/config/${encodeURIComponent(publicKey)}`);\n url.searchParams.set(\"view\", \"gate\");\n const res = await fetch(url.toString(), {\n method: \"GET\",\n headers: { \"x-web-public-key\": publicKey },\n credentials: \"omit\",\n });\n if (!res.ok) return null;\n const data = (await res.json()) as Partial<BackendWebConfig>;\n // Surface the BE-owned security block alongside the gate so a\n // host that injects presentation config still picks up the BE's\n // `clientId` + `enabled` defaults when it omits them. `clientId`\n // is a PUBLIC Google OAuth identifier — same one the operator\n // embeds on their main-site login; safe to ship to the visitor.\n // The actual trust boundary is the BE's audience check (it\n // verifies `id_token.aud` against the same stored clientId\n // server-side). Defaults all-off so a sparse BE response\n // degrades safely.\n return {\n status: (data.status as WidgetConfig[\"status\"]) ?? \"active\",\n branding: data.branding?.hidden ? { hidden: true } : null,\n security: {\n requireAuth: data.security?.requireAuth ?? false,\n google: {\n enabled: data.security?.google?.enabled ?? false,\n clientId: data.security?.google?.clientId ?? null,\n },\n passkey: {\n enabled: data.security?.passkey?.enabled ?? false,\n },\n },\n };\n } catch {\n return null;\n }\n })();\n\n webGateCache.set(\n publicKey,\n request.then((value) => {\n if (value === null) webGateCache.delete(publicKey);\n return value;\n }),\n );\n return webGateCache.get(publicKey) ?? request;\n}\n","/**\n * Demo author identities, shared by help articles + news posts. Proper\n * names + seeded face avatars (pravatar) so demo content reads like\n * real, attributed writing. Names aren't translated — like \"Gaia\".\n *\n * Both surfaces support MULTIPLE authors: a struct lists `authorIds`,\n * and the builder maps them to these records via `authorsFor`.\n */\nexport interface DemoAuthor {\n _id: string;\n name: string;\n photo: { url: string };\n}\n\nexport const DEMO_AUTHORS = {\n maya: {\n _id: \"demo-author-maya\",\n name: \"Maya Chen\",\n photo: { url: \"https://i.pravatar.cc/96?img=47\" },\n },\n leo: {\n _id: \"demo-author-leo\",\n name: \"Leo Martins\",\n photo: { url: \"https://i.pravatar.cc/96?img=13\" },\n },\n ira: {\n _id: \"demo-author-ira\",\n name: \"Ira Kovalenko\",\n photo: { url: \"https://i.pravatar.cc/96?img=32\" },\n },\n sam: {\n _id: \"demo-author-sam\",\n name: \"Sam Okafor\",\n photo: { url: \"https://i.pravatar.cc/96?img=68\" },\n },\n} as const satisfies Record<string, DemoAuthor>;\n\nexport type DemoAuthorKey = keyof typeof DEMO_AUTHORS;\n\n/** Resolve a list of author keys to their full records. */\nexport function authorsFor(keys: readonly DemoAuthorKey[]): DemoAuthor[] {\n return keys.map((key) => DEMO_AUTHORS[key]);\n}\n","/**\n * Web-font loading for the operator's chosen `theme.fontFamily`.\n *\n * The dashboard's font picker offers a handful of Google Fonts that the\n * widget bundle does NOT ship — selecting one would silently fall back\n * to `system-ui` unless the font file is actually fetched. This module\n * injects the matching Google Fonts `<link>` on demand.\n *\n * The `<link>` goes into the HOST document's `<head>`, never the Shadow\n * DOM: `@font-face` rules loaded in the top-level document ARE visible\n * to shadow trees, but a `<link>` placed inside a shadow root is not a\n * reliable way to load fonts. System stacks (Geist, `system-ui`, an\n * operator's own self-hosted family) match nothing here and are no-ops.\n */\n\n/**\n * Operator-selectable Google Fonts → their `family=` query value.\n * Mirrors the dashboard's `FontFamilySelect` list. Lowercase keys so\n * the lookup is case-insensitive.\n */\nconst GOOGLE_FONTS: Record<string, string> = {\n inter: \"Inter:wght@400;500;600;700\",\n poppins: \"Poppins:wght@400;500;600;700\",\n \"dm sans\": \"DM+Sans:wght@400;500;600;700\",\n roboto: \"Roboto:wght@400;500;700\",\n \"ibm plex sans\": \"IBM+Plex+Sans:wght@400;500;600;700\",\n lato: \"Lato:wght@400;700\",\n montserrat: \"Montserrat:wght@400;500;600;700\",\n nunito: \"Nunito:wght@400;500;600;700\",\n raleway: \"Raleway:wght@400;500;600;700\",\n \"work sans\": \"Work+Sans:wght@400;500;600;700\",\n};\n\n/**\n * Make sure the web font referenced by a `font-family` stack is loaded.\n * Extracts the first family name, and if it's a known Google Font that\n * isn't already loaded, appends a `<link>` to `document.head`. Deduped\n * by font id; safe to call on every theme change.\n */\nexport function ensureThemeFont(fontFamily: string | undefined): void {\n if (!fontFamily || typeof document === \"undefined\") return;\n\n const first = fontFamily\n .split(\",\")[0]\n ?.trim()\n .replace(/^['\"]|['\"]$/g, \"\");\n if (!first) return;\n\n const family = GOOGLE_FONTS[first.toLowerCase()];\n if (!family) return; // System / Geist / operator-hosted — nothing to fetch.\n\n const id = `wexio-font-${first.toLowerCase().replace(/\\s+/g, \"-\")}`;\n if (document.getElementById(id)) return; // Already loaded.\n\n const link = document.createElement(\"link\");\n link.id = id;\n link.rel = \"stylesheet\";\n link.href = `https://fonts.googleapis.com/css2?family=${family}&display=swap`;\n document.head.appendChild(link);\n}\n","/**\n * Widget configuration shape — mirrors the visitor-facing GraphQL\n * `visitorWebConfig` query plus client-only fields for demo/preview.\n *\n * The widget runs in three modes that share this shape:\n *\n * - **production** → bootstrapped from `GET /api/web/config/:publicKey`\n * (the one REST endpoint kept for the loader script\n * to avoid bundling Apollo into the loader). Rest of\n * runtime data via GraphQL.\n *\n * - **preview** → operator's dashboard embeds the widget in an\n * iframe and posts `wexio:preview-config:v1` messages\n * on every theme/feature edit. Hot-swaps tokens\n * without a BE round-trip.\n *\n * - **demo** → no operator context at all. Built-in mock config\n * so the widget renders something on a marketing\n * site / first-load preview before the operator\n * has picked an integration.\n */\n\nimport { assetUrl } from \"./asset-url\";\n\nexport type WidgetMode = \"production\" | \"preview\" | \"demo\";\n\nexport type WidgetTab = \"home\" | \"messages\" | \"help\" | \"news\" | \"profile\";\n\nexport interface WidgetFeatures {\n home: boolean;\n messenger: boolean;\n help: boolean;\n news: boolean;\n /** Operator-gated. When `true`, the bottom-nav surfaces a \"Profile\" tab\n * where the visitor can edit their own profile fields + preferences\n * (language, desktop notifications, theme mode). Defaults to `false` —\n * the tab is hidden until the operator opts in. */\n profile?: boolean;\n}\n\n/* ─── Home-tab block model ───────────────────────────────────────────\n * `WidgetConfig.homeLayout` is an operator-configured ordered list of\n * blocks the Home tab renders top-to-bottom. `null` → the widget falls\n * back to a sensible hardcoded default (see `DEFAULT_HOME_LAYOUT`).\n * Mirrors the BE `homeLayout` JSON shape + the dashboard editor — keep\n * the three in sync. The renderer tolerates unknown `kind`s (skips\n * them) so a newer dashboard can't break an older widget bundle. */\n\n/** Curated icon set for `quick-actions` buttons — channel logos +\n * common actions. Maps to a bundled icon in the widget. */\nexport type HomeNamedIcon =\n | \"telegram\"\n | \"whatsapp\"\n | \"viber\"\n | \"instagram\"\n | \"messenger\"\n | \"discord\"\n | \"slack\"\n | \"chat\"\n | \"email\"\n | \"phone\"\n | \"video-call\"\n | \"help\"\n | \"book\"\n | \"bell\"\n | \"star\"\n | \"heart\"\n | \"bookmark\"\n | \"arrow-right\"\n | \"lock\"\n | \"shield\"\n | \"user\"\n | \"users\";\n\n/** A `quick-actions` button icon — either a curated named icon or an\n * operator-uploaded image URL. */\nexport type HomeQuickActionIcon =\n | { kind: \"named\"; name: HomeNamedIcon }\n | { kind: \"media\"; url: string };\n\nexport interface HomeQuickActionButton {\n /** At least one of `label` / `icon` must be set. */\n label?: string;\n icon?: HomeQuickActionIcon;\n /** Where the tap goes. `open-url` requires `url`. */\n action: \"open-messenger\" | \"open-help\" | \"open-news\" | \"open-url\";\n url?: string;\n /** Visual weight. Max one `primary` per block. */\n style?: \"default\" | \"primary\" | \"ghost\";\n}\n\n/** How a `quick-actions` block lays its buttons out.\n * - `stacked` → one full-width row per button (default; best for\n * verbose labels + primary CTAs).\n * - `inline` → up to 4 icon-only square tiles in a row (best for\n * channel-switchers — WhatsApp / Telegram / Instagram).\n * Labels become tooltips; long labels are clamped. */\nexport type HomeQuickActionLayout = \"stacked\" | \"inline\";\n\nexport interface HomeHelpSuggestionsConfig {\n mode: \"popular\" | \"recent\" | \"category\" | \"manual\";\n /** 3–8. */\n maxItems: number;\n categoryId?: string;\n articleIds?: string[];\n}\n\nexport type HomeBlock =\n | {\n kind: \"quick-actions\";\n buttons: HomeQuickActionButton[];\n /** Defaults to `\"stacked\"` when omitted. */\n layout?: HomeQuickActionLayout;\n }\n | {\n kind: \"help-search\";\n placeholder?: string;\n suggestions: HomeHelpSuggestionsConfig;\n }\n | { kind: \"pinned-articles\"; articleIds: string[]; title?: string }\n | { kind: \"news-preview\"; maxItems?: number; title?: string }\n | {\n kind: \"team-status\";\n showResponseTime: boolean;\n showOperatorAvatars: boolean;\n }\n | { kind: \"divider\" }\n | { kind: \"rich-text\"; markdown: string }\n /** CTA card — title + subtitle + operator avatar stack + chevron. Tap\n * opens the messenger. Visual style of the demo \"Ask a question\"\n * card; copy is operator-configurable. */\n | {\n kind: \"ask-question\";\n title?: string;\n subtitle?: string;\n /** Tap target. Defaults to `\"open-messenger\"`. */\n action?: \"open-messenger\" | \"open-help\" | \"open-news\";\n }\n /** Recent-message card — header strip + the latest inbound message\n * for the visitor. Live mode hides when the visitor has no chat\n * history; demo mode shows a bundled sample. */\n | { kind: \"recent-message\"; title?: string }\n /** Single hero card for a featured **news post**. Operator picks the\n * post by id in the dashboard; the widget hydrates title + excerpt\n * + cover image from the BE (`visitorNewsPost({ id })`). Tap drills into\n * the news article view. `ctaLabel` overrides the footer copy\n * (\"See the launch agenda\" by default). When `newsId` is unset or\n * the post can't be resolved the card paints a gradient placeholder\n * so the home tab never has a blank rectangle. */\n | {\n kind: \"featured-article\";\n newsId?: string;\n ctaLabel?: string;\n };\n\nexport type HomeBlockKind = HomeBlock[\"kind\"];\n\n/**\n * A complete palette of brandable colour tokens — designer-friendly\n * names (`background`, `surface`, `text`, ...) that mirror the BE's\n * `WebIntegrationThemePalette` shape exactly. The widget translates\n * these into the internal `--wx-*` CSS variables at apply time\n * (see `applyThemeOverrides` in `use-widget-config.ts`).\n *\n * Every field optional — widget falls back to the bundled defaults\n * in `globals.css` for any token the operator hasn't set.\n */\nexport interface WidgetThemePalette {\n // Surfaces\n background?: string;\n surface?: string;\n surfaceElevated?: string;\n // Text\n text?: string;\n textMuted?: string;\n textSubtle?: string;\n // Borders\n border?: string;\n borderStrong?: string;\n // Brand\n primary?: string;\n primaryHover?: string;\n primaryForeground?: string;\n // Launcher\n launcherBackground?: string;\n launcherForeground?: string;\n // Status\n success?: string;\n danger?: string;\n}\n\nexport interface WidgetThemeRadii {\n sm?: number;\n md?: number;\n lg?: number;\n xl?: number;\n}\n\n/** Anchor corner for the floating launcher + panel on the host page.\n * Mirrors the BE's `LauncherPosition` enum. Defaults to bottom-right. */\nexport type LauncherPosition = \"RIGHT_BOTTOM\" | \"LEFT_BOTTOM\";\n\nexport interface WidgetTheme {\n /** Light-mode palette. Active when `useThemeMode()` resolves to\n * `'light'`. */\n light?: WidgetThemePalette;\n /** Dark-mode palette. Active when `useThemeMode()` resolves to\n * `'dark'`. */\n dark?: WidgetThemePalette;\n /** Radii are theme-invariant — same values apply in both modes. */\n radii?: WidgetThemeRadii;\n /** Which corner the launcher + panel anchor to. Theme-invariant;\n * lives in `theme` to mirror the BE's `WebIntegrationTheme` shape. */\n launcherPosition?: LauncherPosition;\n /** Full CSS `font-family` stack applied to the whole widget.\n * Theme-invariant. When unset the widget keeps its bundled Geist\n * default. Mirrors the BE's `WebIntegrationTheme.fontFamily`. */\n fontFamily?: string;\n}\n\nexport type PrechatFieldKind = \"NAME\" | \"EMAIL\" | \"PHONE\" | \"CUSTOM_TEXT\";\n\nexport interface WidgetPrechatField {\n /** Drives the input type + default label/validator. `CUSTOM_TEXT`\n * is the open-text catch-all (e.g. \"Order number\"). */\n kind: PrechatFieldKind;\n /** Stable identifier the BE uses on submit. Operators set this\n * when designing the form; `[a-z0-9_]{1,32}` per BE validator. */\n key: string;\n /** Operator-supplied label. Empty string = render the i18n default\n * for `kind` (e.g. \"Email\" / \"Email\"). */\n label: string;\n required: boolean;\n}\n\nexport interface WidgetPrechatForm {\n /** When `false`, the form never renders even if `fields` is populated. */\n enabled: boolean;\n fields: WidgetPrechatField[];\n}\n\nexport interface WidgetSounds {\n /** Operator-level global mute. Visitor `wexio:sound-muted` localStorage\n * overrides this — visitors always win. */\n enabled: boolean;\n /**\n * Sound played when an inbound (operator/bot/AI) message arrives.\n * Either a preset id (`\"wx-nt_3\"`, picks `public/sounds/wx-nt_3.wav`)\n * OR a fully-qualified URL pointing at an operator-uploaded asset.\n * `null` = silent for this direction.\n */\n inboundSoundId: string | null;\n /** Same shape; played when the visitor's outbound send acknowledges. */\n outboundSoundId: string | null;\n /** 0.0 (silent) … 1.0 (full), clamped. */\n volume: number;\n}\n\nexport interface WidgetBranding {\n /**\n * Hide the in-widget \"Powered by Wexio\" badge. Default `false` —\n * free + standard tiers MUST show the badge; only enterprise /\n * white-label plans can set this to `true`. The BE enforces the\n * plan gate on save; the widget treats `true` as \"operator paid\n * for white-label\" and trusts it without re-checking.\n *\n * The badge is the in-widget visual surface. The separate\n * SEO-backlink injection on the host page (loader script) is its\n * own toggle — operators who hide one don't automatically hide\n * the other.\n */\n hidden: boolean;\n}\n\n/**\n * Widget UI-language strategy (operator-configured on the BE):\n * - `\"AUTO\"` — follow the visitor's browser (`navigator.language`).\n * - `\"WEBSITE\"` — follow the host page's `<html lang>`.\n * - `\"DEFAULT\"` — pin every visitor to the integration's `defaultLocale`.\n */\nexport type WidgetLocaleStrategy = \"AUTO\" | \"WEBSITE\" | \"DEFAULT\";\n\n/**\n * Visitor-auth configuration (operator-controlled). Which sign-in methods\n * the widget offers, and whether messaging is gated behind a verified\n * identity. Extensible — new methods slot in alongside `google`/`passkey`.\n */\nexport interface WidgetSecurity {\n /** When `true`, the widget shows the sign-in panel INSTEAD of the\n * message/voice composer until the visitor is verified (`anon:false`). */\n requireAuth: boolean;\n /** \"Sign in with Google\" via Google Identity Services. The widget\n * runs GIS directly in-panel using `clientId` (a PUBLIC OAuth\n * identifier — same one the operator already embeds on their\n * main-site Google login). The resulting `id_token` rides\n * `startIdentifiedVisitor`; the BE verifies `aud === clientId`\n * server-side via `WebAuthProofService.verifyGoogleIdToken`.\n * Rendered only when `enabled` AND `clientId` is set. */\n google: { enabled: boolean; clientId: string | null };\n /** Passkey (WebAuthn) sign-in — runs entirely in the widget. */\n passkey: { enabled: boolean };\n}\n\n/**\n * Host-injectable shape of `WidgetSecurity` — every field optional,\n * each defaults to the BE value when the host omits it. BE remains the\n * source of truth for actual gating (enforces `requireAuth`\n * server-side; verifies Google `id_token.aud` server-side regardless\n * of where the token was minted). Host-supplied values here are UI /\n * test-harness conveniences.\n */\nexport interface InjectableWidgetSecurity {\n /** Force-show the sign-in gate even when the BE gate fetch is\n * unavailable (e.g. the inject test harness without a publicKey).\n * BE-enforced server-side regardless. */\n requireAuth?: boolean;\n /** Host can flip whether Google sign-in is offered — but `clientId`\n * is deliberately NOT injectable. The widget always reads the\n * Google `clientId` from the BE config (`/api/web/config`); hosts\n * must not bypass that to avoid mismatches with the BE's\n * audience check. */\n google?: { enabled?: boolean };\n passkey?: { enabled?: boolean };\n}\n\nexport interface WidgetConfig {\n // NOTE: no `integrationId` / `name` / `publicKey` — those are the\n // integration's internal admin fields, BE-resolved from the publicKey\n // and never returned to the visitor. The widget keys per-integration\n // state off the `publicKey` it already holds, and the visitor-facing\n // name is `messenger.title`.\n status: \"active\" | \"disabled\" | \"plan_blocked\";\n defaultTab: WidgetTab;\n /** How the widget picks the visitor's UI language. `\"AUTO\"` follows\n * the browser (`navigator.language`); `\"WEBSITE\"` follows the host\n * page's `<html lang>`; `\"DEFAULT\"` pins to `defaultLocale`.\n * Resolved by `detectClientLocale` (embeds) / the loader (iframe).\n * Defaults to `\"AUTO\"` for legacy configs. */\n localeStrategy: WidgetLocaleStrategy;\n /** The integration's canonical / fallback language (BCP-47). Used to\n * resolve `localeStrategy: \"DEFAULT\"`, and as the content fallback.\n * Defaults to `\"en\"`. */\n defaultLocale: string;\n /** Visitor-auth config — which sign-in methods the widget offers and\n * whether messaging is gated behind a verified identity. */\n security: WidgetSecurity;\n features: WidgetFeatures;\n theme: WidgetTheme | null;\n themeMode: \"light\" | \"dark\" | \"auto\";\n /** Operator avatars surfaced in the header stack (max 3). */\n operatorAvatars: { src: string; alt: string }[];\n /** Organisation logo — per-mode URLs (already flattened from the\n * BE's Media refs by `fetchWebConfig`). The shell resolves the\n * active URL by theme mode; when both are `null` the header\n * renders the framed Wexio fallback mark. `null` for the whole\n * object = operator never uploaded a logo. */\n organizationLogo: { light: string | null; dark: string | null } | null;\n /** Greeting shown on the Home tab — operator-configurable copy. */\n greeting: {\n headline: string;\n subheadline: string;\n };\n /** Operator-configured Home-tab block layout, rendered top-to-bottom.\n * `null` → the widget falls back to `DEFAULT_HOME_LAYOUT`. */\n homeLayout: HomeBlock[] | null;\n /** Pre-chat form configuration. `null` (or `enabled: false`) means\n * visitors send their first message straight from the composer\n * with no gate. */\n prechatForm: WidgetPrechatForm | null;\n /** Branding controls — `null` for the implicit default (badge shown). */\n branding: WidgetBranding | null;\n /** Sound preferences — `null` for the implicit default (presets + 0.5 volume). */\n sounds: WidgetSounds | null;\n /** Messenger-tab configuration — operator copy for the chat surface\n * (title, description, pre-populated bot messages), AI assistant\n * avatar override, slash-command quick-tap chips, and display\n * toggles for the related-news / related-help / reaction-count\n * blocks. `null` → all fields fall back to widget defaults. */\n messenger: WidgetMessengerConfig | null;\n}\n\n/**\n * The subset of `WidgetConfig` a HOST may inject via the `config` prop /\n * `window.wexioSettings.config` (to skip the heavy bootstrap fetch). It\n * EXCLUDES the plan / restriction gate (`branding`, `status`) — those are\n * BE-owned, fetched authoritatively by publicKey (the lite `?view=gate`\n * config) so a host can't fake white-label removal or the plan gate.\n *\n * (`integrationId` / `name` / `publicKey` / `allowedOrigins` aren't part of\n * `WidgetConfig` at all — they're the integration's internal admin fields,\n * never returned to the visitor; the widget keys per-integration state off\n * the `publicKey` it already holds and uses `messenger.title` for display.)\n *\n * So a host passes ONLY presentation: theme / messenger / features /\n * homeLayout / greeting / prechat / sounds / security methods / locales.\n */\nexport type InjectableWidgetConfig = Omit<WidgetConfig, \"branding\" | \"status\" | \"security\"> & {\n /** Sign-in methods — host can only flip `enabled` per method.\n * `clientId` and `requireAuth` are BE-sourced (see\n * `InjectableWidgetSecurity`). Optional so a host that doesn't\n * care about auth gating can omit it entirely. */\n security?: InjectableWidgetSecurity;\n};\n\n/**\n * Operator-configured pre-populated messages in the messenger tab.\n *\n * `TEXT` was removed in the WEB_VISITOR_VISIT flow-trigger landing —\n * proactive bot bubbles now arrive via SSE from the flow runner, not\n * as static config. Only the chrome affordances remain here:\n *\n * - `HINT` — italic tip card (e.g. \"Try `/start`\").\n * - `SYSTEM` — centred status pill (e.g. \"We're back online\").\n */\nexport type WidgetMessengerMessageKind = \"HINT\" | \"SYSTEM\";\n\nexport interface WidgetMessengerMessage {\n kind: WidgetMessengerMessageKind;\n text: string;\n}\n\nexport interface WidgetMessengerConfig {\n /** Header title — falls back to the i18n default `\"Send us a message\"`\n * when null / empty. ≤ 120 chars on the BE. */\n title: string | null;\n /** Sub-header description — falls back to the i18n default when null\n * / empty. ≤ 500 chars on the BE. */\n description: string | null;\n /** Avatar URL surfaced on AI / bot bubbles. The BE flattens the\n * Media `_id` to a CDN URL before sending the config; this is\n * already a fetchable string by the time it reaches the widget.\n * `null` → AI bubbles render WITHOUT an avatar (no Wexio mark\n * fallback), so the operator explicitly opts in to surfacing a\n * bot identity. */\n aiAssistantAvatar: string | null;\n /** Slash-command quick-tap chips surfaced in the composer's\n * commands dropdown. Each entry is the literal text the visitor\n * sends on tap (e.g. `\"/start\"`). Empty array → the commands\n * dropdown trigger is hidden entirely. Capped at 20 by the BE,\n * each `^/[a-zA-Z0-9_-]{1,32}$`. */\n commands: string[];\n /** Pre-populated messages that paint at the top of the thread\n * before any real visitor / operator turn. Render styles depend\n * on `kind`:\n * - `TEXT` — normal bot bubble (treats sender as AI).\n * - `HINT` — dim italic affordance pill.\n * - `SYSTEM` — centred system row (matches runtime\n * `MessageType.SYSTEM`).\n * Capped at 10 by the BE. */\n messages: WidgetMessengerMessage[];\n /** Surface the \"Related news\" affordance below the welcome\n * message run. */\n showRelatedNews: boolean;\n /** Surface the \"Related help articles\" affordance below the\n * welcome message run. */\n showRelatedHelpArticles: boolean;\n /** Render aggregate reaction counts under each bot message. */\n showReactionCounts: boolean;\n}\n\n/**\n * Default mock config used in `demo` mode and as a fallback while the\n * `preview` mode waits for the first postMessage from the dashboard.\n * Mirrors the Intercom-style layout the operator picked as reference.\n */\nexport const DEMO_CONFIG: WidgetConfig = {\n status: \"active\",\n defaultTab: \"home\",\n // Demo follows the browser so the showcase localises to whoever's\n // viewing it (and honours `?lang=` for the marketing/Storybook tour).\n localeStrategy: \"AUTO\",\n defaultLocale: \"en\",\n // Demo doesn't gate or wire real sign-in methods.\n security: {\n requireAuth: true,\n // Demo's published Google clientId — same one the dashboard's\n // showcase site uses. Real operator configs override this via the\n // BE config fetch.\n google: {\n enabled: true,\n clientId: \"771481034494-41m4aop4gbn7k58ahgqgvr3kiv8vmrd3.apps.googleusercontent.com\",\n },\n passkey: { enabled: true },\n },\n features: { home: true, messenger: true, help: true, news: true, profile: true },\n theme: null,\n themeMode: \"auto\",\n operatorAvatars: [\n {\n src: \"https://i.pravatar.cc/64?u=op-1\",\n alt: \"Operator\",\n },\n {\n src: \"https://i.pravatar.cc/64?u=op-2\",\n alt: \"Operator\",\n },\n {\n src: \"https://i.pravatar.cc/64?u=op-3\",\n alt: \"Operator\",\n },\n ],\n // Demo mode = no org logo, so the home header falls back to the\n // framed Wexio mark. Real integrations override this with\n // BE-supplied per-mode logo URLs.\n organizationLogo: null,\n // Friendly DEMO defaults so the bundled demo mode + the dashboard\n // preview (when the operator hasn't typed anything yet) still paint\n // a populated header. Operators send their own non-empty strings\n // via BE config; an operator who explicitly sets empty strings\n // disables the greeting (HomeTab renders no heading at all rather\n // than surfacing a placeholder).\n greeting: {\n headline: \"Hi there 👋\",\n subheadline: \"How can we help?\",\n },\n // Demo mode → `null` so the Home tab renders `DEFAULT_HOME_LAYOUT`.\n homeLayout: null,\n // Demo mode renders no prechat gate — visitors land straight on\n // the composer. Real integrations override this via BE config.\n prechatForm: {\n enabled: true,\n // Labels left EMPTY on purpose — real operators configure their own\n // (operator copy is their text, not translated by the widget), but\n // the DEMO must localise, so blank labels fall through to the i18n\n // defaults (`prechat.labelName` / `labelEmail`, both locales).\n fields: [\n {\n kind: \"NAME\",\n key: \"visitor_name\",\n label: \"\",\n required: true,\n },\n {\n kind: \"EMAIL\",\n key: \"visitor_email\",\n label: \"\",\n required: true,\n },\n ],\n },\n // Demo + free-tier embeds always show the \"Powered by Wexio\" badge.\n branding: null,\n // Default sound config — bundled presets, half volume.\n sounds: {\n enabled: true,\n inboundSoundId: \"wx-nt_3\",\n outboundSoundId: \"wx-nt_1\",\n volume: 0.5,\n },\n // Messenger demo config — null title/description so the widget\n // falls back to the i18n strings. One welcome bubble + two\n // example commands so the demo embed shows the feature without\n // looking empty.\n messenger: {\n title: null,\n description: null,\n // Demo-only: give Gaia a real avatar (the Wexio mark) so AI bubbles,\n // the welcome row, peek + recent-message all show an identity instead\n // of collapsing the avatar slot. `assetUrl` rewrites to the widget's\n // CDN base in the web-component / react-component builds.\n aiAssistantAvatar: assetUrl(\"/logo-dark.png\"),\n commands: [\"/start\", \"/help\", \"/contact\"],\n // Welcome run is provided (translated) by `getMockWelcomeMessages`\n // in demo mode — see MessagesTab — so this stays empty.\n messages: [],\n showRelatedNews: true,\n showRelatedHelpArticles: true,\n showReactionCounts: false,\n },\n};\n\n/**\n * Fallback Home-tab layout used when `WidgetConfig.homeLayout` is\n * `null` (operator hasn't customised the Home tab yet). Mirrors the\n * \"default layout\" in `docs/Channels/Web/WEB_HOME_TAB.md` — a welcome\n * greeting, a primary \"message us\" CTA, help search, and a news\n * preview. The Home renderer drops the help-search / news-preview\n * blocks when `features.help` / `features.news` are off.\n */\nexport const DEFAULT_HOME_LAYOUT: HomeBlock[] = [\n { kind: \"ask-question\" },\n { kind: \"recent-message\" },\n\n { kind: \"featured-article\" },\n // Popular help articles. Demo mode fills this with the most-viewed\n // sample articles; in a real embed with no operator-pinned ids the\n // block renders nothing until the operator pins some.\n { kind: \"pinned-articles\", articleIds: [] },\n {\n kind: \"quick-actions\",\n layout: \"inline\",\n buttons: [\n {\n label: \"WhatsApp\",\n icon: { kind: \"named\", name: \"whatsapp\" },\n action: \"open-url\",\n url: \"https://wa.me/15555555555\",\n },\n {\n label: \"Telegram\",\n icon: { kind: \"named\", name: \"telegram\" },\n action: \"open-url\",\n url: \"https://t.me/wexio\",\n },\n {\n label: \"Instagram\",\n icon: { kind: \"named\", name: \"instagram\" },\n action: \"open-url\",\n url: \"https://instagram.com/wexio\",\n },\n {\n label: \"Email\",\n icon: { kind: \"named\", name: \"email\" },\n action: \"open-url\",\n url: \"mailto:help@wexio.io\",\n },\n ],\n },\n];\n","\"use client\";\n\nimport { useLocale } from \"next-intl\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { fetchWebConfig, fetchWebGate } from \"./api\";\nimport { ensureThemeFont } from \"./theme-font\";\nimport { useWidgetEnv } from \"./use-widget-env\";\nimport {\n DEMO_CONFIG,\n type WidgetConfig,\n type WidgetMode,\n type WidgetTheme,\n type WidgetThemePalette,\n type WidgetThemeRadii,\n} from \"./widget-config\";\n\n/**\n * Resolves the widget's runtime mode + active `WidgetConfig`.\n *\n * **Mode** is the ambient UX (close button visibility, postMessage\n * subscription, dashboard-specific affordances):\n *\n * - `?pk=<publicKey>` → production\n * - `?mode=preview` → preview (dashboard live edit)\n * - default → demo (marketing / first-load)\n *\n * **Data source** is orthogonal to mode — every mode tries the real\n * REST config endpoint first and only falls back to `DEMO_CONFIG`\n * when no `publicKey` is available or the fetch fails. `isDummy`\n * surfaces the fallback state so non-production surfaces can paint a\n * subtle \"demo data\" badge.\n *\n * Resolution order for the `publicKey`:\n * 1. `?pk=` URL param (production / dashboard preview pointing at an integration)\n * 2. `NEXT_PUBLIC_WEXIO_DEMO_PK` env var (marketing-site demo integration)\n * 3. None → fall back to bundled `DEMO_CONFIG`\n *\n * **Three layers compose into the effective config:**\n * 1. **base** — resolved from the BE (`fetchWebConfig`) or `DEMO_CONFIG`.\n * 2. **postMessage patch** — accumulated `wexio:preview-config:v1`\n * events (iframe preview path; dashboard posts to the iframe).\n * 3. **`env.configOverride`** — a live `Partial<WidgetConfig>` prop\n * threaded by the `<WexioWidget>` React embed (dashboard theme\n * editor's in-progress draft; no serialization round-trip).\n *\n * Higher layers win. The effective config is `useMemo`'d so a draft\n * edit re-renders the tree without a fetch, and a single effect\n * re-applies the theme CSS vars whenever the effective `theme`\n * reference changes.\n */\nexport function useWidgetConfig(): {\n mode: WidgetMode;\n config: WidgetConfig;\n isDummy: boolean;\n isLoading: boolean;\n} {\n // Web-component mode supplies its own pk / mode via the env context\n // (the embed's `<wexio-widget>` attributes). Iframe mode leaves both\n // undefined and we fall through to the URL/env resolution below —\n // preserves the loader.js flow exactly.\n const env = useWidgetEnv();\n // Visitor's resolved UI locale (see `locale-detect` → NextIntlClient\n // Provider). Threaded into the config fetch so the BE serves the\n // operator's localized chrome for THIS language; re-fetches on change\n // (e.g. a language switcher) since it's an effect dependency below.\n const locale = useLocale();\n // BASE layer — resolved from BE or DEMO. Never carries preview\n // patches; those live in their own layers so a late BE response\n // can't clobber an in-flight edit.\n const [base, setBase] = useState<{\n mode: WidgetMode;\n config: WidgetConfig;\n isDummy: boolean;\n isLoading: boolean;\n }>({\n mode: \"demo\",\n config: DEMO_CONFIG,\n isDummy: true,\n isLoading: true,\n });\n // POSTMESSAGE layer — accumulated `wexio:preview-config:v1` patches\n // (iframe preview path). `null` until the first event arrives.\n const [postMessagePatch, setPostMessagePatch] = useState<Partial<WidgetConfig> | null>(null);\n\n useEffect(() => {\n const url = new URL(window.location.href);\n const pkFromUrl = url.searchParams.get(\"pk\") ?? undefined;\n const pkFromEnv = process.env.NEXT_PUBLIC_WEXIO_DEMO_PK || undefined;\n const explicitMode = url.searchParams.get(\"mode\");\n\n const publicKey = env.publicKeyOverride ?? pkFromUrl ?? pkFromEnv;\n\n const mode: WidgetMode =\n env.modeOverride ??\n (publicKey ? \"production\" : explicitMode === \"preview\" ? \"preview\" : \"demo\");\n\n let cancelled = false;\n\n const resolve = async () => {\n // Host-injected PRESENTATION config → skip the HEAVY config fetch\n // (theme / messenger / homeLayout / …) and render those from props.\n // But the plan / restriction / identity gate (`branding`, `status`,\n // `integrationId`, `name`) is ALWAYS fetched authoritatively from the\n // BE by publicKey — a host must never be able to fake white-label\n // removal or the plan gate from props. So we do a small `?view=gate`\n // fetch and merge it OVER the injected presentation. `configOverride`\n // still merges on top (below).\n if (env.configBase) {\n const gate = publicKey ? await fetchWebGate(publicKey) : null;\n if (cancelled) return;\n // Resolve `security` with the BE as the source of truth for\n // sensitive fields, allowing the host to influence ONLY the\n // method-enabled flags:\n // - `clientId` → ALWAYS from BE (paired with BE's Google\n // audience check; a host-supplied value would let them\n // direct visitors to their own OAuth client).\n // - `requireAuth` → ALWAYS from BE (server-side enforcement\n // anyway; letting the host override only desyncs UI).\n // - `google.enabled` / `passkey.enabled` → host's value wins\n // when explicitly set; otherwise the BE default is used.\n const hostSec = env.configBase.security;\n const beSec = gate?.security;\n const resolvedSecurity: WidgetConfig[\"security\"] = {\n // `requireAuth` is BE-enforced server-side (the visitor JWT\n // guard rejects unverified writes when the integration\n // requires auth), so the host's UI hint is safe to honour\n // when the BE gate is unavailable — without it the inject\n // test harness can't render the sign-in gate at all.\n requireAuth: hostSec?.requireAuth ?? beSec?.requireAuth ?? false,\n google: {\n enabled: hostSec?.google?.enabled ?? beSec?.google?.enabled ?? false,\n // `clientId` is BE-ONLY. Hosts can't inject it via props\n // (the type strips it from `InjectableWidgetSecurity`),\n // and the widget always reads the live value from the BE\n // gate fetch — keeps it in lockstep with the BE's\n // audience check on `startIdentifiedVisitor`. `null` when\n // the BE gate fetch failed / there's no publicKey, which\n // hides the button (see `MessagesTab`).\n clientId: beSec?.google?.clientId ?? null,\n },\n passkey: {\n enabled: hostSec?.passkey?.enabled ?? beSec?.passkey?.enabled ?? false,\n },\n };\n // Spread the host config (less `security`, which we rebuild\n // above), then stamp the resolved security + the BE gate. The\n // type-level `InjectableWidgetConfig` already strips `clientId`\n // / `requireAuth` from the host-supplied shape; this is the\n // runtime defence in depth.\n const { security: _ignoredHostSecurity, ...presentation } = env.configBase;\n setBase({\n mode,\n config: {\n ...presentation,\n security: resolvedSecurity,\n // Plan/restriction gate — BE-owned, never from props. Safe\n // defaults if the gate fetch failed / there's no publicKey.\n branding: gate?.branding ?? null,\n status: gate?.status ?? \"active\",\n },\n isDummy: env.forceDummyData === true,\n isLoading: false,\n });\n return;\n }\n\n // The operator dashboard's preview pane embeds the widget with a\n // `useDummyData` prop (host knows whether it wants the mock data\n // layer or the real one) AND threads the operator's full config\n // through `configOverride`. The REST bootstrap fetch would 403\n // anyway — the dashboard's origin isn't on the operator's\n // `allowedOrigins`, that allow-list is for the visitor's host\n // page — so skip it entirely and trust the host. `isDummy` then\n // reflects the toggle directly.\n if (env.forceDummyData !== undefined) {\n setBase({\n mode,\n config: DEMO_CONFIG,\n isDummy: env.forceDummyData,\n isLoading: false,\n });\n return;\n }\n\n if (publicKey) {\n const real = await fetchWebConfig(publicKey, locale);\n if (cancelled) return;\n if (real) {\n setBase({ mode, config: real, isDummy: false, isLoading: false });\n return;\n }\n }\n // No publicKey OR the fetch failed → fall back to bundled mock.\n // Demo + preview surfaces can still operate; production sees an\n // empty-state header.\n setBase({ mode, config: DEMO_CONFIG, isDummy: true, isLoading: false });\n };\n\n resolve();\n\n if (mode !== \"preview\")\n return () => {\n cancelled = true;\n };\n\n const onMessage = (event: MessageEvent) => {\n if (!event.data || typeof event.data !== \"object\") return;\n if (event.data.type !== \"wexio:preview-config:v1\") return;\n const patch = event.data.config as Partial<WidgetConfig> | undefined;\n if (!patch) return;\n // Accumulate onto the existing patch layer — a dashboard that\n // posts `{ theme }` then `{ features }` should end up with both.\n setPostMessagePatch((prev) => mergeConfigPatch(prev ?? {}, patch));\n };\n\n window.addEventListener(\"message\", onMessage);\n return () => {\n cancelled = true;\n window.removeEventListener(\"message\", onMessage);\n };\n // Re-resolve when the embed surface swaps its overrides — happens\n // in web-component mode when the host page mutates the\n // `public-key` attribute on `<wexio-widget>`. Iframe mode keeps\n // both overrides `undefined` so the effect runs exactly once.\n // Dashboard preview path: `forceDummyData` flip needs to re-resolve\n // so the new `isDummy` lands on `base` (visitor flow re-derives).\n // `locale` re-fetches the BE config in the new language.\n }, [env.publicKeyOverride, env.modeOverride, env.forceDummyData, env.configBase, locale]);\n\n // `forceDummyData` lets the operator dashboard's preview pane show the\n // bundled mock content layer (messages / articles / news / FAQs /\n // launcher unread) on top of an otherwise-real config — useful for a\n // brand-new integration with empty BE content. It only toggles the data\n // layer; operator config (theme, logo, greeting, etc.) flows through\n // either way via the `configOverride` merge below.\n const effectiveIsDummy = base.isDummy || env.forceDummyData === true;\n\n // Effective config = base ← postMessage patch ← configOverride prop.\n //\n // When the effective config is in dummy mode AND the operator hasn't\n // uploaded any avatars, fall back to the bundled DEMO_CONFIG avatars so\n // the dashboard preview shows a populated header. The logo / greeting\n // stay live — they're operator-config, not content.\n const config = useMemo(() => {\n let c = base.config;\n if (postMessagePatch) c = mergeConfigPatch(c, postMessagePatch);\n if (env.configOverride) c = mergeConfigPatch(c, env.configOverride);\n if (effectiveIsDummy && c.operatorAvatars.length === 0) {\n c = { ...c, operatorAvatars: DEMO_CONFIG.operatorAvatars };\n }\n return c;\n }, [base.config, postMessagePatch, env.configOverride, effectiveIsDummy]);\n\n // Re-apply the theme CSS-variable block whenever the effective\n // theme changes reference — covers BE arrival, postMessage patches,\n // AND the configOverride prop in one place. `config.theme` is a\n // stable reference when no layer touched it (see `mergeConfigPatch`),\n // so this only fires on a real theme change.\n //\n // `env.styleRoot` decides WHERE the token `<style>` lands: the\n // React-component embed points it at its Shadow DOM so theming is\n // self-contained; iframe / web-component builds leave it undefined\n // and fall back to `document` (→ `<head>`).\n const styleRoot = env.styleRoot;\n useEffect(() => {\n if (config.theme) {\n applyThemeOverrides(config.theme, styleRoot ?? document);\n // The operator can pick a Google Font the bundle doesn't ship —\n // fetch it so `--wx-font` resolves to the real face instead of\n // silently falling back to `system-ui`.\n ensureThemeFont(config.theme.fontFamily);\n }\n }, [config.theme, styleRoot]);\n\n // Phase 2 of locale resolution (embeds only): now that the config has\n // resolved we know the operator's `localeStrategy`. Hand it back to the\n // embed wrapper so it can re-resolve the visitor's UI language —\n // switching to the host page's `<html lang>` for `WEBSITE`, or to a\n // pinned code. The wrapper updates the provider locale, which flips\n // `useLocale()` and re-runs the fetch effect above in the new language.\n //\n // Safe to fire on every strategy change: `detectClientLocale(strategy)`\n // is deterministic, so a wrapper that re-resolves to the same locale\n // does a no-op `setState`. The iframe leaves `onLocaleStrategy`\n // undefined — its loader already resolved the strategy via `?lang=`.\n const onLocaleStrategy = env.onLocaleStrategy;\n useEffect(() => {\n // Translate the `DEFAULT` strategy to the integration's canonical\n // locale code before handing it down — `detectClientLocale` then\n // pins to that code. `AUTO` / `WEBSITE` pass through as-is.\n const resolved =\n config.localeStrategy === \"DEFAULT\" ? config.defaultLocale : config.localeStrategy;\n onLocaleStrategy?.(resolved);\n }, [onLocaleStrategy, config.localeStrategy, config.defaultLocale]);\n\n return {\n mode: base.mode,\n config,\n isDummy: effectiveIsDummy,\n isLoading: base.isLoading,\n };\n}\n\n/**\n * Merge a `Partial<WidgetConfig>` patch onto a base. Used both to\n * accumulate postMessage patches (base is itself a partial) and to\n * apply a patch layer onto the full resolved config.\n *\n * `features` + `greeting` deep-merge so a patch touching one key\n * doesn't wipe the siblings. `theme` is replaced wholesale — the\n * dashboard editor holds the complete theme object in state, so a\n * partial-theme patch would be the editor's bug, not ours; replacing\n * also keeps `config.theme` referentially stable when no patch\n * touches it (the theme-apply effect depends on that). Everything\n * else is a shallow replace.\n */\nfunction mergeConfigPatch<T extends Partial<WidgetConfig>>(\n base: T,\n patch: Partial<WidgetConfig>,\n): T {\n return {\n ...base,\n ...patch,\n features: { ...(base.features ?? {}), ...(patch.features ?? {}) },\n greeting: { ...(base.greeting ?? {}), ...(patch.greeting ?? {}) },\n theme: patch.theme === undefined ? base.theme : patch.theme,\n } as T;\n}\n\n/**\n * Designer-friendly palette name → CSS custom property. Mirrors the\n * `WidgetThemePalette` shape; the values are the variables defined\n * in `app/globals.css` for both `:root` (light) and\n * `[data-theme=\"dark\"]` (dark).\n *\n * Lookup table only — `applyThemeOverrides` iterates the palette\n * the operator sent and writes one declaration per matched key.\n * Unmatched keys are silently ignored so future schema additions\n * (BE ships a new token before the widget knows about it) don't\n * crash the apply step.\n */\nconst PALETTE_CSS_VARS: Record<keyof WidgetThemePalette, string> = {\n background: \"--wx-bg\",\n surface: \"--wx-bg-elevated\",\n surfaceElevated: \"--wx-bg-elevated-2\",\n text: \"--wx-fg\",\n textMuted: \"--wx-fg-muted\",\n textSubtle: \"--wx-fg-subtle\",\n border: \"--wx-border\",\n borderStrong: \"--wx-border-strong\",\n primary: \"--wx-primary\",\n primaryHover: \"--wx-primary-hover\",\n primaryForeground: \"--wx-primary-fg\",\n launcherBackground: \"--wx-launcher-bg\",\n launcherForeground: \"--wx-launcher-fg\",\n success: \"--wx-success\",\n danger: \"--wx-danger\",\n};\n\nconst RADII_CSS_VARS: Record<keyof WidgetThemeRadii, string> = {\n sm: \"--wx-radius-sm\",\n md: \"--wx-radius\",\n lg: \"--wx-radius-lg\",\n xl: \"--wx-radius-xl\",\n};\n\n/**\n * Build the `prop: value;` declaration list for one palette. Skips\n * empty / non-string values so a partial palette doesn't emit\n * `--wx-bg: undefined`.\n */\nfunction paletteDeclarations(palette: WidgetThemePalette | undefined): string {\n if (!palette) return \"\";\n return (Object.entries(palette) as [keyof WidgetThemePalette, unknown][])\n .filter(([, v]) => typeof v === \"string\" && (v as string).length > 0)\n .map(([key, v]) => `${PALETTE_CSS_VARS[key]}: ${v as string};`)\n .join(\" \");\n}\n\nfunction radiiDeclarations(radii: WidgetThemeRadii | undefined): string {\n if (!radii) return \"\";\n return (Object.entries(radii) as [keyof WidgetThemeRadii, unknown][])\n .filter(([, v]) => typeof v === \"number\" && Number.isFinite(v))\n .map(([key, v]) => `${RADII_CSS_VARS[key]}: ${v as number}px;`)\n .join(\" \");\n}\n\n/**\n * Per-shadow-root operator-theme `CSSStyleSheet`. Keyed by shadow root\n * so multiple `<WexioWidget>` instances on one page (e.g. the\n * dashboard's desktop + mobile preview panes) each get their own.\n */\nconst themeSheets = new WeakMap<ShadowRoot, CSSStyleSheet>();\n\n/** Build the operator-theme CSS text — two selector blocks:\n *\n * :root, :host { ...light + radii + font }\n * [data-theme=\"dark\"] { ...dark + radii + font }\n *\n * `:root` matches `<html>` in the iframe / web-component builds; `:host`\n * matches the shadow host in the React-component embed — so the\n * light/default tokens land regardless of which tree the widget lives\n * in. `[data-theme=\"dark\"]` matches whatever `useThemeMode` stamped the\n * attribute on (`<html>` or the shadow portal target). Radii + font live\n * on both blocks because the dark block overrides the light one. */\nfunction buildThemeCss(theme: WidgetTheme): string {\n const radiiDecls = radiiDeclarations(theme.radii);\n const fontDecl =\n typeof theme.fontFamily === \"string\" && theme.fontFamily.trim().length > 0\n ? `--wx-font: ${theme.fontFamily};`\n : \"\";\n const invariantDecls = [radiiDecls, fontDecl].filter(Boolean).join(\" \");\n const lightDecls = [paletteDeclarations(theme.light), invariantDecls].filter(Boolean).join(\" \");\n const darkDecls = [paletteDeclarations(theme.dark), invariantDecls].filter(Boolean).join(\" \");\n\n const blocks: string[] = [];\n if (lightDecls) blocks.push(`:root, :host { ${lightDecls} }`);\n if (darkDecls) blocks.push(`[data-theme=\"dark\"] { ${darkDecls} }`);\n return blocks.join(\" \");\n}\n\n/**\n * Apply operator theme overrides into `styleRoot`.\n *\n * - `ShadowRoot` (React-component embed) → a constructable\n * `CSSStyleSheet` appended LAST to `shadowRoot.adoptedStyleSheets`.\n * This is the critical bit: `adoptedStyleSheets` are ordered AFTER\n * a shadow tree's `<style>` children in the cascade, and the\n * bundled `globals.css` is itself an adopted sheet — so a plain\n * `<style>` child would LOSE to `globals.css`'s built-in token\n * defaults and the operator's colours would never show. The\n * override must be an adopted sheet appended after `globals.css`.\n * (Old browsers with no constructable-stylesheet support fall back\n * to a `<style>` child — there `globals.css` is also a `<style>`\n * child, so source order still lets the override win.)\n * - `Document` (iframe / web-component) → a `<style>` in `<head>`,\n * appended after `globals.css` so it wins by source order.\n *\n * The sheet / element is reused across renders so toggling theme mode\n * never duplicates it.\n */\nfunction applyThemeOverrides(theme: WidgetTheme, styleRoot: ShadowRoot | Document) {\n const css = buildThemeCss(theme);\n\n if (!(styleRoot instanceof Document)) {\n const shadow = styleRoot;\n const supportsConstructable =\n typeof CSSStyleSheet !== \"undefined\" && \"replaceSync\" in CSSStyleSheet.prototype;\n\n if (supportsConstructable) {\n let sheet = themeSheets.get(shadow);\n if (!sheet) {\n sheet = new CSSStyleSheet();\n themeSheets.set(shadow, sheet);\n // Append LAST — must sit after the adopted `globals.css`.\n shadow.adoptedStyleSheets = [...shadow.adoptedStyleSheets, sheet];\n }\n sheet.replaceSync(css);\n return;\n }\n\n // Fallback: no constructable stylesheets — `globals.css` is a\n // `<style data-wexio-style>` child here too, so a later `<style>`\n // child wins by source order.\n let styleEl = shadow.querySelector<HTMLStyleElement>(\"#wexio-theme-vars\");\n if (!styleEl) {\n styleEl = document.createElement(\"style\");\n styleEl.id = \"wexio-theme-vars\";\n shadow.appendChild(styleEl);\n }\n styleEl.textContent = css;\n return;\n }\n\n // `Document` — inject a `<style>` into `<head>`.\n let style = styleRoot.getElementById(\"wexio-theme-vars\") as HTMLStyleElement | null;\n if (!style) {\n style = document.createElement(\"style\");\n style.id = \"wexio-theme-vars\";\n styleRoot.head.appendChild(style);\n }\n style.textContent = css;\n}\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [[\"path\", { d: \"M20 6 9 17l-5-5\", key: \"1gmf2c\" }]];\nconst Check = createLucideIcon(\"check\", __iconNode);\n\nexport { __iconNode, Check as default };\n//# sourceMappingURL=check.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [[\"path\", { d: \"m6 9 6 6 6-6\", key: \"qrunsl\" }]];\nconst ChevronDown = createLucideIcon(\"chevron-down\", __iconNode);\n\nexport { __iconNode, ChevronDown as default };\n//# sourceMappingURL=chevron-down.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [[\"path\", { d: \"m15 18-6-6 6-6\", key: \"1wnfg3\" }]];\nconst ChevronLeft = createLucideIcon(\"chevron-left\", __iconNode);\n\nexport { __iconNode, ChevronLeft as default };\n//# sourceMappingURL=chevron-left.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [[\"path\", { d: \"m9 18 6-6-6-6\", key: \"mthhwq\" }]];\nconst ChevronRight = createLucideIcon(\"chevron-right\", __iconNode);\n\nexport { __iconNode, ChevronRight as default };\n//# sourceMappingURL=chevron-right.mjs.map\n","/**\n * @license lucide-react v1.14.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\"path\", { d: \"M18 6 6 18\", key: \"1bl5f8\" }],\n [\"path\", { d: \"m6 6 12 12\", key: \"d8bk6v\" }]\n];\nconst X = createLucideIcon(\"x\", __iconNode);\n\nexport { __iconNode, X as default };\n//# sourceMappingURL=x.mjs.map\n","// packages/react/compose-refs/src/compose-refs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","import * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Surface primitive. Two visual heights:\n *\n * - `Card` — default, sits on `--wx-bg`, painted in\n * `--wx-bg-elevated`. The Home tab's stacked\n * blocks use this.\n * - `CardNested` — for surfaces that live INSIDE another card\n * (e.g. an inline action chip on the recent\n * message card). Uses `--wx-bg-elevated-2`.\n *\n * Padding stays caller-controlled — different surfaces (button-as-\n * card vs. content card vs. media card) want different paddings.\n */\nexport const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"rounded-wx-lg bg-wx-bg-elevated text-wx-fg\", className)}\n {...props}\n />\n ),\n);\nCard.displayName = \"Card\";\n\nexport const CardNested = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"rounded-wx bg-wx-bg-elevated-2 text-wx-fg\", className)}\n {...props}\n />\n ),\n);\nCardNested.displayName = \"CardNested\";\n\nexport const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex flex-col gap-1 px-5 pt-5\", className)} {...props} />\n ),\n);\nCardHeader.displayName = \"CardHeader\";\n\nexport const CardTitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"text-base font-semibold text-wx-fg\", className)} {...props} />\n));\nCardTitle.displayName = \"CardTitle\";\n\nexport const CardSubtitle = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => (\n <p ref={ref} className={cn(\"text-sm text-wx-fg-muted\", className)} {...props} />\n));\nCardSubtitle.displayName = \"CardSubtitle\";\n\nexport const CardBody = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"px-5 py-4\", className)} {...props} />\n ),\n);\nCardBody.displayName = \"CardBody\";\n\nexport const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"flex items-center justify-between px-5 py-3 border-t border-wx-border\",\n className,\n )}\n {...props}\n />\n ),\n);\nCardFooter.displayName = \"CardFooter\";\n","// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n","// src/primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-layout-effect/src/use-layout-effect.tsx\nimport * as React from \"react\";\nvar useLayoutEffect2 = globalThis?.document ? React.useLayoutEffect : () => {\n};\nexport {\n useLayoutEffect2 as useLayoutEffect\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/presence.tsx\nimport * as React2 from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\n\n// src/use-state-machine.tsx\nimport * as React from \"react\";\nfunction useStateMachine(initialState, machine) {\n return React.useReducer((state, event) => {\n const nextState = machine[state][event];\n return nextState ?? state;\n }, initialState);\n}\n\n// src/presence.tsx\nvar Presence = (props) => {\n const { present, children } = props;\n const presence = usePresence(present);\n const child = typeof children === \"function\" ? children({ present: presence.isPresent }) : React2.Children.only(children);\n const ref = useComposedRefs(presence.ref, getElementRef(child));\n const forceMount = typeof children === \"function\";\n return forceMount || presence.isPresent ? React2.cloneElement(child, { ref }) : null;\n};\nPresence.displayName = \"Presence\";\nfunction usePresence(present) {\n const [node, setNode] = React2.useState();\n const stylesRef = React2.useRef(null);\n const prevPresentRef = React2.useRef(present);\n const prevAnimationNameRef = React2.useRef(\"none\");\n const initialState = present ? \"mounted\" : \"unmounted\";\n const [state, send] = useStateMachine(initialState, {\n mounted: {\n UNMOUNT: \"unmounted\",\n ANIMATION_OUT: \"unmountSuspended\"\n },\n unmountSuspended: {\n MOUNT: \"mounted\",\n ANIMATION_END: \"unmounted\"\n },\n unmounted: {\n MOUNT: \"mounted\"\n }\n });\n React2.useEffect(() => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n prevAnimationNameRef.current = state === \"mounted\" ? currentAnimationName : \"none\";\n }, [state]);\n useLayoutEffect(() => {\n const styles = stylesRef.current;\n const wasPresent = prevPresentRef.current;\n const hasPresentChanged = wasPresent !== present;\n if (hasPresentChanged) {\n const prevAnimationName = prevAnimationNameRef.current;\n const currentAnimationName = getAnimationName(styles);\n if (present) {\n send(\"MOUNT\");\n } else if (currentAnimationName === \"none\" || styles?.display === \"none\") {\n send(\"UNMOUNT\");\n } else {\n const isAnimating = prevAnimationName !== currentAnimationName;\n if (wasPresent && isAnimating) {\n send(\"ANIMATION_OUT\");\n } else {\n send(\"UNMOUNT\");\n }\n }\n prevPresentRef.current = present;\n }\n }, [present, send]);\n useLayoutEffect(() => {\n if (node) {\n let timeoutId;\n const ownerWindow = node.ownerDocument.defaultView ?? window;\n const handleAnimationEnd = (event) => {\n const currentAnimationName = getAnimationName(stylesRef.current);\n const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));\n if (event.target === node && isCurrentAnimation) {\n send(\"ANIMATION_END\");\n if (!prevPresentRef.current) {\n const currentFillMode = node.style.animationFillMode;\n node.style.animationFillMode = \"forwards\";\n timeoutId = ownerWindow.setTimeout(() => {\n if (node.style.animationFillMode === \"forwards\") {\n node.style.animationFillMode = currentFillMode;\n }\n });\n }\n }\n };\n const handleAnimationStart = (event) => {\n if (event.target === node) {\n prevAnimationNameRef.current = getAnimationName(stylesRef.current);\n }\n };\n node.addEventListener(\"animationstart\", handleAnimationStart);\n node.addEventListener(\"animationcancel\", handleAnimationEnd);\n node.addEventListener(\"animationend\", handleAnimationEnd);\n return () => {\n ownerWindow.clearTimeout(timeoutId);\n node.removeEventListener(\"animationstart\", handleAnimationStart);\n node.removeEventListener(\"animationcancel\", handleAnimationEnd);\n node.removeEventListener(\"animationend\", handleAnimationEnd);\n };\n } else {\n send(\"ANIMATION_END\");\n }\n }, [node, send]);\n return {\n isPresent: [\"mounted\", \"unmountSuspended\"].includes(state),\n ref: React2.useCallback((node2) => {\n stylesRef.current = node2 ? getComputedStyle(node2) : null;\n setNode(node2);\n }, [])\n };\n}\nfunction getAnimationName(styles) {\n return styles?.animationName || \"none\";\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Presence;\nexport {\n Presence,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/context/src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n const Provider = (props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName) {\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n}\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope) {\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n }\n const createScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n };\n };\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = () => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\nexport {\n createContext2 as createContext,\n createContextScope\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-callback-ref/src/use-callback-ref.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/direction/src/direction.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DirectionContext = React.createContext(void 0);\nvar DirectionProvider = (props) => {\n const { dir, children } = props;\n return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });\n};\nfunction useDirection(localDir) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\nvar Provider = DirectionProvider;\nexport {\n DirectionProvider,\n Provider,\n useDirection\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/core/number/src/number.ts\nfunction clamp(value, [min, max]) {\n return Math.min(max, Math.max(min, value));\n}\nexport {\n clamp\n};\n//# sourceMappingURL=index.mjs.map\n","// src/primitive.tsx\nvar canUseDOM = !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\nfunction composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {\n return function handleEvent(event) {\n originalEventHandler?.(event);\n if (checkForDefaultPrevented === false || !event.defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\nfunction getOwnerWindow(element) {\n if (!canUseDOM) {\n throw new Error(\"Cannot access window outside of the DOM\");\n }\n return element?.ownerDocument?.defaultView ?? window;\n}\nfunction getOwnerDocument(element) {\n if (!canUseDOM) {\n throw new Error(\"Cannot access document outside of the DOM\");\n }\n return element?.ownerDocument ?? document;\n}\nfunction getActiveElement(node, activeDescendant = false) {\n const { activeElement } = getOwnerDocument(node);\n if (!activeElement?.nodeName) {\n return null;\n }\n if (isFrame(activeElement) && activeElement.contentDocument) {\n return getActiveElement(activeElement.contentDocument.body, activeDescendant);\n }\n if (activeDescendant) {\n const id = activeElement.getAttribute(\"aria-activedescendant\");\n if (id) {\n const element = getOwnerDocument(activeElement).getElementById(id);\n if (element) {\n return element;\n }\n }\n }\n return activeElement;\n}\nfunction isFrame(element) {\n return element.tagName === \"IFRAME\";\n}\nexport {\n canUseDOM,\n composeEventHandlers,\n getActiveElement,\n getOwnerDocument,\n getOwnerWindow,\n isFrame\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// src/scroll-area.tsx\nimport * as React2 from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useDirection } from \"@radix-ui/react-direction\";\nimport { useLayoutEffect } from \"@radix-ui/react-use-layout-effect\";\nimport { clamp } from \"@radix-ui/number\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\n\n// src/use-state-machine.ts\nimport * as React from \"react\";\nfunction useStateMachine(initialState, machine) {\n return React.useReducer((state, event) => {\n const nextState = machine[state][event];\n return nextState ?? state;\n }, initialState);\n}\n\n// src/scroll-area.tsx\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nvar SCROLL_AREA_NAME = \"ScrollArea\";\nvar [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME);\nvar [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME);\nvar ScrollArea = React2.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopeScrollArea,\n type = \"hover\",\n dir,\n scrollHideDelay = 600,\n ...scrollAreaProps\n } = props;\n const [scrollArea, setScrollArea] = React2.useState(null);\n const [viewport, setViewport] = React2.useState(null);\n const [content, setContent] = React2.useState(null);\n const [scrollbarX, setScrollbarX] = React2.useState(null);\n const [scrollbarY, setScrollbarY] = React2.useState(null);\n const [cornerWidth, setCornerWidth] = React2.useState(0);\n const [cornerHeight, setCornerHeight] = React2.useState(0);\n const [scrollbarXEnabled, setScrollbarXEnabled] = React2.useState(false);\n const [scrollbarYEnabled, setScrollbarYEnabled] = React2.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setScrollArea(node));\n const direction = useDirection(dir);\n return /* @__PURE__ */ jsx(\n ScrollAreaProvider,\n {\n scope: __scopeScrollArea,\n type,\n dir: direction,\n scrollHideDelay,\n scrollArea,\n viewport,\n onViewportChange: setViewport,\n content,\n onContentChange: setContent,\n scrollbarX,\n onScrollbarXChange: setScrollbarX,\n scrollbarXEnabled,\n onScrollbarXEnabledChange: setScrollbarXEnabled,\n scrollbarY,\n onScrollbarYChange: setScrollbarY,\n scrollbarYEnabled,\n onScrollbarYEnabledChange: setScrollbarYEnabled,\n onCornerWidthChange: setCornerWidth,\n onCornerHeightChange: setCornerHeight,\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n dir: direction,\n ...scrollAreaProps,\n ref: composedRefs,\n style: {\n position: \"relative\",\n // Pass corner sizes as CSS vars to reduce re-renders of context consumers\n [\"--radix-scroll-area-corner-width\"]: cornerWidth + \"px\",\n [\"--radix-scroll-area-corner-height\"]: cornerHeight + \"px\",\n ...props.style\n }\n }\n )\n }\n );\n }\n);\nScrollArea.displayName = SCROLL_AREA_NAME;\nvar VIEWPORT_NAME = \"ScrollAreaViewport\";\nvar ScrollAreaViewport = React2.forwardRef(\n (props, forwardedRef) => {\n const { __scopeScrollArea, children, nonce, ...viewportProps } = props;\n const context = useScrollAreaContext(VIEWPORT_NAME, __scopeScrollArea);\n const ref = React2.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref, context.onViewportChange);\n return /* @__PURE__ */ jsxs(Fragment, { children: [\n /* @__PURE__ */ jsx(\n \"style\",\n {\n dangerouslySetInnerHTML: {\n __html: `[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`\n },\n nonce\n }\n ),\n /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-radix-scroll-area-viewport\": \"\",\n ...viewportProps,\n ref: composedRefs,\n style: {\n /**\n * We don't support `visible` because the intention is to have at least one scrollbar\n * if this component is used and `visible` will behave like `auto` in that case\n * https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description\n *\n * We don't handle `auto` because the intention is for the native implementation\n * to be hidden if using this component. We just want to ensure the node is scrollable\n * so could have used either `scroll` or `auto` here. We picked `scroll` to prevent\n * the browser from having to work out whether to render native scrollbars or not,\n * we tell it to with the intention of hiding them in CSS.\n */\n overflowX: context.scrollbarXEnabled ? \"scroll\" : \"hidden\",\n overflowY: context.scrollbarYEnabled ? \"scroll\" : \"hidden\",\n ...props.style\n },\n children: /* @__PURE__ */ jsx(\"div\", { ref: context.onContentChange, style: { minWidth: \"100%\", display: \"table\" }, children })\n }\n )\n ] });\n }\n);\nScrollAreaViewport.displayName = VIEWPORT_NAME;\nvar SCROLLBAR_NAME = \"ScrollAreaScrollbar\";\nvar ScrollAreaScrollbar = React2.forwardRef(\n (props, forwardedRef) => {\n const { forceMount, ...scrollbarProps } = props;\n const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);\n const { onScrollbarXEnabledChange, onScrollbarYEnabledChange } = context;\n const isHorizontal = props.orientation === \"horizontal\";\n React2.useEffect(() => {\n isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);\n return () => {\n isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);\n };\n }, [isHorizontal, onScrollbarXEnabledChange, onScrollbarYEnabledChange]);\n return context.type === \"hover\" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarHover, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === \"scroll\" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarScroll, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === \"auto\" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarAuto, { ...scrollbarProps, ref: forwardedRef, forceMount }) : context.type === \"always\" ? /* @__PURE__ */ jsx(ScrollAreaScrollbarVisible, { ...scrollbarProps, ref: forwardedRef }) : null;\n }\n);\nScrollAreaScrollbar.displayName = SCROLLBAR_NAME;\nvar ScrollAreaScrollbarHover = React2.forwardRef((props, forwardedRef) => {\n const { forceMount, ...scrollbarProps } = props;\n const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);\n const [visible, setVisible] = React2.useState(false);\n React2.useEffect(() => {\n const scrollArea = context.scrollArea;\n let hideTimer = 0;\n if (scrollArea) {\n const handlePointerEnter = () => {\n window.clearTimeout(hideTimer);\n setVisible(true);\n };\n const handlePointerLeave = () => {\n hideTimer = window.setTimeout(() => setVisible(false), context.scrollHideDelay);\n };\n scrollArea.addEventListener(\"pointerenter\", handlePointerEnter);\n scrollArea.addEventListener(\"pointerleave\", handlePointerLeave);\n return () => {\n window.clearTimeout(hideTimer);\n scrollArea.removeEventListener(\"pointerenter\", handlePointerEnter);\n scrollArea.removeEventListener(\"pointerleave\", handlePointerLeave);\n };\n }\n }, [context.scrollArea, context.scrollHideDelay]);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx(\n ScrollAreaScrollbarAuto,\n {\n \"data-state\": visible ? \"visible\" : \"hidden\",\n ...scrollbarProps,\n ref: forwardedRef\n }\n ) });\n});\nvar ScrollAreaScrollbarScroll = React2.forwardRef((props, forwardedRef) => {\n const { forceMount, ...scrollbarProps } = props;\n const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);\n const isHorizontal = props.orientation === \"horizontal\";\n const debounceScrollEnd = useDebounceCallback(() => send(\"SCROLL_END\"), 100);\n const [state, send] = useStateMachine(\"hidden\", {\n hidden: {\n SCROLL: \"scrolling\"\n },\n scrolling: {\n SCROLL_END: \"idle\",\n POINTER_ENTER: \"interacting\"\n },\n interacting: {\n SCROLL: \"interacting\",\n POINTER_LEAVE: \"idle\"\n },\n idle: {\n HIDE: \"hidden\",\n SCROLL: \"scrolling\",\n POINTER_ENTER: \"interacting\"\n }\n });\n React2.useEffect(() => {\n if (state === \"idle\") {\n const hideTimer = window.setTimeout(() => send(\"HIDE\"), context.scrollHideDelay);\n return () => window.clearTimeout(hideTimer);\n }\n }, [state, context.scrollHideDelay, send]);\n React2.useEffect(() => {\n const viewport = context.viewport;\n const scrollDirection = isHorizontal ? \"scrollLeft\" : \"scrollTop\";\n if (viewport) {\n let prevScrollPos = viewport[scrollDirection];\n const handleScroll = () => {\n const scrollPos = viewport[scrollDirection];\n const hasScrollInDirectionChanged = prevScrollPos !== scrollPos;\n if (hasScrollInDirectionChanged) {\n send(\"SCROLL\");\n debounceScrollEnd();\n }\n prevScrollPos = scrollPos;\n };\n viewport.addEventListener(\"scroll\", handleScroll);\n return () => viewport.removeEventListener(\"scroll\", handleScroll);\n }\n }, [context.viewport, isHorizontal, send, debounceScrollEnd]);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || state !== \"hidden\", children: /* @__PURE__ */ jsx(\n ScrollAreaScrollbarVisible,\n {\n \"data-state\": state === \"hidden\" ? \"hidden\" : \"visible\",\n ...scrollbarProps,\n ref: forwardedRef,\n onPointerEnter: composeEventHandlers(props.onPointerEnter, () => send(\"POINTER_ENTER\")),\n onPointerLeave: composeEventHandlers(props.onPointerLeave, () => send(\"POINTER_LEAVE\"))\n }\n ) });\n});\nvar ScrollAreaScrollbarAuto = React2.forwardRef((props, forwardedRef) => {\n const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);\n const { forceMount, ...scrollbarProps } = props;\n const [visible, setVisible] = React2.useState(false);\n const isHorizontal = props.orientation === \"horizontal\";\n const handleResize = useDebounceCallback(() => {\n if (context.viewport) {\n const isOverflowX = context.viewport.offsetWidth < context.viewport.scrollWidth;\n const isOverflowY = context.viewport.offsetHeight < context.viewport.scrollHeight;\n setVisible(isHorizontal ? isOverflowX : isOverflowY);\n }\n }, 10);\n useResizeObserver(context.viewport, handleResize);\n useResizeObserver(context.content, handleResize);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || visible, children: /* @__PURE__ */ jsx(\n ScrollAreaScrollbarVisible,\n {\n \"data-state\": visible ? \"visible\" : \"hidden\",\n ...scrollbarProps,\n ref: forwardedRef\n }\n ) });\n});\nvar ScrollAreaScrollbarVisible = React2.forwardRef((props, forwardedRef) => {\n const { orientation = \"vertical\", ...scrollbarProps } = props;\n const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);\n const thumbRef = React2.useRef(null);\n const pointerOffsetRef = React2.useRef(0);\n const [sizes, setSizes] = React2.useState({\n content: 0,\n viewport: 0,\n scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }\n });\n const thumbRatio = getThumbRatio(sizes.viewport, sizes.content);\n const commonProps = {\n ...scrollbarProps,\n sizes,\n onSizesChange: setSizes,\n hasThumb: Boolean(thumbRatio > 0 && thumbRatio < 1),\n onThumbChange: (thumb) => thumbRef.current = thumb,\n onThumbPointerUp: () => pointerOffsetRef.current = 0,\n onThumbPointerDown: (pointerPos) => pointerOffsetRef.current = pointerPos\n };\n function getScrollPosition(pointerPos, dir) {\n return getScrollPositionFromPointer(pointerPos, pointerOffsetRef.current, sizes, dir);\n }\n if (orientation === \"horizontal\") {\n return /* @__PURE__ */ jsx(\n ScrollAreaScrollbarX,\n {\n ...commonProps,\n ref: forwardedRef,\n onThumbPositionChange: () => {\n if (context.viewport && thumbRef.current) {\n const scrollPos = context.viewport.scrollLeft;\n const offset = getThumbOffsetFromScroll(scrollPos, sizes, context.dir);\n thumbRef.current.style.transform = `translate3d(${offset}px, 0, 0)`;\n }\n },\n onWheelScroll: (scrollPos) => {\n if (context.viewport) context.viewport.scrollLeft = scrollPos;\n },\n onDragScroll: (pointerPos) => {\n if (context.viewport) {\n context.viewport.scrollLeft = getScrollPosition(pointerPos, context.dir);\n }\n }\n }\n );\n }\n if (orientation === \"vertical\") {\n return /* @__PURE__ */ jsx(\n ScrollAreaScrollbarY,\n {\n ...commonProps,\n ref: forwardedRef,\n onThumbPositionChange: () => {\n if (context.viewport && thumbRef.current) {\n const scrollPos = context.viewport.scrollTop;\n const offset = getThumbOffsetFromScroll(scrollPos, sizes);\n thumbRef.current.style.transform = `translate3d(0, ${offset}px, 0)`;\n }\n },\n onWheelScroll: (scrollPos) => {\n if (context.viewport) context.viewport.scrollTop = scrollPos;\n },\n onDragScroll: (pointerPos) => {\n if (context.viewport) context.viewport.scrollTop = getScrollPosition(pointerPos);\n }\n }\n );\n }\n return null;\n});\nvar ScrollAreaScrollbarX = React2.forwardRef((props, forwardedRef) => {\n const { sizes, onSizesChange, ...scrollbarProps } = props;\n const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);\n const [computedStyle, setComputedStyle] = React2.useState();\n const ref = React2.useRef(null);\n const composeRefs = useComposedRefs(forwardedRef, ref, context.onScrollbarXChange);\n React2.useEffect(() => {\n if (ref.current) setComputedStyle(getComputedStyle(ref.current));\n }, [ref]);\n return /* @__PURE__ */ jsx(\n ScrollAreaScrollbarImpl,\n {\n \"data-orientation\": \"horizontal\",\n ...scrollbarProps,\n ref: composeRefs,\n sizes,\n style: {\n bottom: 0,\n left: context.dir === \"rtl\" ? \"var(--radix-scroll-area-corner-width)\" : 0,\n right: context.dir === \"ltr\" ? \"var(--radix-scroll-area-corner-width)\" : 0,\n [\"--radix-scroll-area-thumb-width\"]: getThumbSize(sizes) + \"px\",\n ...props.style\n },\n onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.x),\n onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.x),\n onWheelScroll: (event, maxScrollPos) => {\n if (context.viewport) {\n const scrollPos = context.viewport.scrollLeft + event.deltaX;\n props.onWheelScroll(scrollPos);\n if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {\n event.preventDefault();\n }\n }\n },\n onResize: () => {\n if (ref.current && context.viewport && computedStyle) {\n onSizesChange({\n content: context.viewport.scrollWidth,\n viewport: context.viewport.offsetWidth,\n scrollbar: {\n size: ref.current.clientWidth,\n paddingStart: toInt(computedStyle.paddingLeft),\n paddingEnd: toInt(computedStyle.paddingRight)\n }\n });\n }\n }\n }\n );\n});\nvar ScrollAreaScrollbarY = React2.forwardRef((props, forwardedRef) => {\n const { sizes, onSizesChange, ...scrollbarProps } = props;\n const context = useScrollAreaContext(SCROLLBAR_NAME, props.__scopeScrollArea);\n const [computedStyle, setComputedStyle] = React2.useState();\n const ref = React2.useRef(null);\n const composeRefs = useComposedRefs(forwardedRef, ref, context.onScrollbarYChange);\n React2.useEffect(() => {\n if (ref.current) setComputedStyle(getComputedStyle(ref.current));\n }, [ref]);\n return /* @__PURE__ */ jsx(\n ScrollAreaScrollbarImpl,\n {\n \"data-orientation\": \"vertical\",\n ...scrollbarProps,\n ref: composeRefs,\n sizes,\n style: {\n top: 0,\n right: context.dir === \"ltr\" ? 0 : void 0,\n left: context.dir === \"rtl\" ? 0 : void 0,\n bottom: \"var(--radix-scroll-area-corner-height)\",\n [\"--radix-scroll-area-thumb-height\"]: getThumbSize(sizes) + \"px\",\n ...props.style\n },\n onThumbPointerDown: (pointerPos) => props.onThumbPointerDown(pointerPos.y),\n onDragScroll: (pointerPos) => props.onDragScroll(pointerPos.y),\n onWheelScroll: (event, maxScrollPos) => {\n if (context.viewport) {\n const scrollPos = context.viewport.scrollTop + event.deltaY;\n props.onWheelScroll(scrollPos);\n if (isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos)) {\n event.preventDefault();\n }\n }\n },\n onResize: () => {\n if (ref.current && context.viewport && computedStyle) {\n onSizesChange({\n content: context.viewport.scrollHeight,\n viewport: context.viewport.offsetHeight,\n scrollbar: {\n size: ref.current.clientHeight,\n paddingStart: toInt(computedStyle.paddingTop),\n paddingEnd: toInt(computedStyle.paddingBottom)\n }\n });\n }\n }\n }\n );\n});\nvar [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME);\nvar ScrollAreaScrollbarImpl = React2.forwardRef((props, forwardedRef) => {\n const {\n __scopeScrollArea,\n sizes,\n hasThumb,\n onThumbChange,\n onThumbPointerUp,\n onThumbPointerDown,\n onThumbPositionChange,\n onDragScroll,\n onWheelScroll,\n onResize,\n ...scrollbarProps\n } = props;\n const context = useScrollAreaContext(SCROLLBAR_NAME, __scopeScrollArea);\n const [scrollbar, setScrollbar] = React2.useState(null);\n const composeRefs = useComposedRefs(forwardedRef, (node) => setScrollbar(node));\n const rectRef = React2.useRef(null);\n const prevWebkitUserSelectRef = React2.useRef(\"\");\n const viewport = context.viewport;\n const maxScrollPos = sizes.content - sizes.viewport;\n const handleWheelScroll = useCallbackRef(onWheelScroll);\n const handleThumbPositionChange = useCallbackRef(onThumbPositionChange);\n const handleResize = useDebounceCallback(onResize, 10);\n function handleDragScroll(event) {\n if (rectRef.current) {\n const x = event.clientX - rectRef.current.left;\n const y = event.clientY - rectRef.current.top;\n onDragScroll({ x, y });\n }\n }\n React2.useEffect(() => {\n const handleWheel = (event) => {\n const element = event.target;\n const isScrollbarWheel = scrollbar?.contains(element);\n if (isScrollbarWheel) handleWheelScroll(event, maxScrollPos);\n };\n document.addEventListener(\"wheel\", handleWheel, { passive: false });\n return () => document.removeEventListener(\"wheel\", handleWheel, { passive: false });\n }, [viewport, scrollbar, maxScrollPos, handleWheelScroll]);\n React2.useEffect(handleThumbPositionChange, [sizes, handleThumbPositionChange]);\n useResizeObserver(scrollbar, handleResize);\n useResizeObserver(context.content, handleResize);\n return /* @__PURE__ */ jsx(\n ScrollbarProvider,\n {\n scope: __scopeScrollArea,\n scrollbar,\n hasThumb,\n onThumbChange: useCallbackRef(onThumbChange),\n onThumbPointerUp: useCallbackRef(onThumbPointerUp),\n onThumbPositionChange: handleThumbPositionChange,\n onThumbPointerDown: useCallbackRef(onThumbPointerDown),\n children: /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...scrollbarProps,\n ref: composeRefs,\n style: { position: \"absolute\", ...scrollbarProps.style },\n onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {\n const mainPointer = 0;\n if (event.button === mainPointer) {\n const element = event.target;\n element.setPointerCapture(event.pointerId);\n rectRef.current = scrollbar.getBoundingClientRect();\n prevWebkitUserSelectRef.current = document.body.style.webkitUserSelect;\n document.body.style.webkitUserSelect = \"none\";\n if (context.viewport) context.viewport.style.scrollBehavior = \"auto\";\n handleDragScroll(event);\n }\n }),\n onPointerMove: composeEventHandlers(props.onPointerMove, handleDragScroll),\n onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {\n const element = event.target;\n if (element.hasPointerCapture(event.pointerId)) {\n element.releasePointerCapture(event.pointerId);\n }\n document.body.style.webkitUserSelect = prevWebkitUserSelectRef.current;\n if (context.viewport) context.viewport.style.scrollBehavior = \"\";\n rectRef.current = null;\n })\n }\n )\n }\n );\n});\nvar THUMB_NAME = \"ScrollAreaThumb\";\nvar ScrollAreaThumb = React2.forwardRef(\n (props, forwardedRef) => {\n const { forceMount, ...thumbProps } = props;\n const scrollbarContext = useScrollbarContext(THUMB_NAME, props.__scopeScrollArea);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || scrollbarContext.hasThumb, children: /* @__PURE__ */ jsx(ScrollAreaThumbImpl, { ref: forwardedRef, ...thumbProps }) });\n }\n);\nvar ScrollAreaThumbImpl = React2.forwardRef(\n (props, forwardedRef) => {\n const { __scopeScrollArea, style, ...thumbProps } = props;\n const scrollAreaContext = useScrollAreaContext(THUMB_NAME, __scopeScrollArea);\n const scrollbarContext = useScrollbarContext(THUMB_NAME, __scopeScrollArea);\n const { onThumbPositionChange } = scrollbarContext;\n const composedRef = useComposedRefs(\n forwardedRef,\n (node) => scrollbarContext.onThumbChange(node)\n );\n const removeUnlinkedScrollListenerRef = React2.useRef(void 0);\n const debounceScrollEnd = useDebounceCallback(() => {\n if (removeUnlinkedScrollListenerRef.current) {\n removeUnlinkedScrollListenerRef.current();\n removeUnlinkedScrollListenerRef.current = void 0;\n }\n }, 100);\n React2.useEffect(() => {\n const viewport = scrollAreaContext.viewport;\n if (viewport) {\n const handleScroll = () => {\n debounceScrollEnd();\n if (!removeUnlinkedScrollListenerRef.current) {\n const listener = addUnlinkedScrollListener(viewport, onThumbPositionChange);\n removeUnlinkedScrollListenerRef.current = listener;\n onThumbPositionChange();\n }\n };\n onThumbPositionChange();\n viewport.addEventListener(\"scroll\", handleScroll);\n return () => viewport.removeEventListener(\"scroll\", handleScroll);\n }\n }, [scrollAreaContext.viewport, debounceScrollEnd, onThumbPositionChange]);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-state\": scrollbarContext.hasThumb ? \"visible\" : \"hidden\",\n ...thumbProps,\n ref: composedRef,\n style: {\n width: \"var(--radix-scroll-area-thumb-width)\",\n height: \"var(--radix-scroll-area-thumb-height)\",\n ...style\n },\n onPointerDownCapture: composeEventHandlers(props.onPointerDownCapture, (event) => {\n const thumb = event.target;\n const thumbRect = thumb.getBoundingClientRect();\n const x = event.clientX - thumbRect.left;\n const y = event.clientY - thumbRect.top;\n scrollbarContext.onThumbPointerDown({ x, y });\n }),\n onPointerUp: composeEventHandlers(props.onPointerUp, scrollbarContext.onThumbPointerUp)\n }\n );\n }\n);\nScrollAreaThumb.displayName = THUMB_NAME;\nvar CORNER_NAME = \"ScrollAreaCorner\";\nvar ScrollAreaCorner = React2.forwardRef(\n (props, forwardedRef) => {\n const context = useScrollAreaContext(CORNER_NAME, props.__scopeScrollArea);\n const hasBothScrollbarsVisible = Boolean(context.scrollbarX && context.scrollbarY);\n const hasCorner = context.type !== \"scroll\" && hasBothScrollbarsVisible;\n return hasCorner ? /* @__PURE__ */ jsx(ScrollAreaCornerImpl, { ...props, ref: forwardedRef }) : null;\n }\n);\nScrollAreaCorner.displayName = CORNER_NAME;\nvar ScrollAreaCornerImpl = React2.forwardRef((props, forwardedRef) => {\n const { __scopeScrollArea, ...cornerProps } = props;\n const context = useScrollAreaContext(CORNER_NAME, __scopeScrollArea);\n const [width, setWidth] = React2.useState(0);\n const [height, setHeight] = React2.useState(0);\n const hasSize = Boolean(width && height);\n useResizeObserver(context.scrollbarX, () => {\n const height2 = context.scrollbarX?.offsetHeight || 0;\n context.onCornerHeightChange(height2);\n setHeight(height2);\n });\n useResizeObserver(context.scrollbarY, () => {\n const width2 = context.scrollbarY?.offsetWidth || 0;\n context.onCornerWidthChange(width2);\n setWidth(width2);\n });\n return hasSize ? /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...cornerProps,\n ref: forwardedRef,\n style: {\n width,\n height,\n position: \"absolute\",\n right: context.dir === \"ltr\" ? 0 : void 0,\n left: context.dir === \"rtl\" ? 0 : void 0,\n bottom: 0,\n ...props.style\n }\n }\n ) : null;\n});\nfunction toInt(value) {\n return value ? parseInt(value, 10) : 0;\n}\nfunction getThumbRatio(viewportSize, contentSize) {\n const ratio = viewportSize / contentSize;\n return isNaN(ratio) ? 0 : ratio;\n}\nfunction getThumbSize(sizes) {\n const ratio = getThumbRatio(sizes.viewport, sizes.content);\n const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;\n const thumbSize = (sizes.scrollbar.size - scrollbarPadding) * ratio;\n return Math.max(thumbSize, 18);\n}\nfunction getScrollPositionFromPointer(pointerPos, pointerOffset, sizes, dir = \"ltr\") {\n const thumbSizePx = getThumbSize(sizes);\n const thumbCenter = thumbSizePx / 2;\n const offset = pointerOffset || thumbCenter;\n const thumbOffsetFromEnd = thumbSizePx - offset;\n const minPointerPos = sizes.scrollbar.paddingStart + offset;\n const maxPointerPos = sizes.scrollbar.size - sizes.scrollbar.paddingEnd - thumbOffsetFromEnd;\n const maxScrollPos = sizes.content - sizes.viewport;\n const scrollRange = dir === \"ltr\" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];\n const interpolate = linearScale([minPointerPos, maxPointerPos], scrollRange);\n return interpolate(pointerPos);\n}\nfunction getThumbOffsetFromScroll(scrollPos, sizes, dir = \"ltr\") {\n const thumbSizePx = getThumbSize(sizes);\n const scrollbarPadding = sizes.scrollbar.paddingStart + sizes.scrollbar.paddingEnd;\n const scrollbar = sizes.scrollbar.size - scrollbarPadding;\n const maxScrollPos = sizes.content - sizes.viewport;\n const maxThumbPos = scrollbar - thumbSizePx;\n const scrollClampRange = dir === \"ltr\" ? [0, maxScrollPos] : [maxScrollPos * -1, 0];\n const scrollWithoutMomentum = clamp(scrollPos, scrollClampRange);\n const interpolate = linearScale([0, maxScrollPos], [0, maxThumbPos]);\n return interpolate(scrollWithoutMomentum);\n}\nfunction linearScale(input, output) {\n return (value) => {\n if (input[0] === input[1] || output[0] === output[1]) return output[0];\n const ratio = (output[1] - output[0]) / (input[1] - input[0]);\n return output[0] + ratio * (value - input[0]);\n };\n}\nfunction isScrollingWithinScrollbarBounds(scrollPos, maxScrollPos) {\n return scrollPos > 0 && scrollPos < maxScrollPos;\n}\nvar addUnlinkedScrollListener = (node, handler = () => {\n}) => {\n let prevPosition = { left: node.scrollLeft, top: node.scrollTop };\n let rAF = 0;\n (function loop() {\n const position = { left: node.scrollLeft, top: node.scrollTop };\n const isHorizontalScroll = prevPosition.left !== position.left;\n const isVerticalScroll = prevPosition.top !== position.top;\n if (isHorizontalScroll || isVerticalScroll) handler();\n prevPosition = position;\n rAF = window.requestAnimationFrame(loop);\n })();\n return () => window.cancelAnimationFrame(rAF);\n};\nfunction useDebounceCallback(callback, delay) {\n const handleCallback = useCallbackRef(callback);\n const debounceTimerRef = React2.useRef(0);\n React2.useEffect(() => () => window.clearTimeout(debounceTimerRef.current), []);\n return React2.useCallback(() => {\n window.clearTimeout(debounceTimerRef.current);\n debounceTimerRef.current = window.setTimeout(handleCallback, delay);\n }, [handleCallback, delay]);\n}\nfunction useResizeObserver(element, onResize) {\n const handleResize = useCallbackRef(onResize);\n useLayoutEffect(() => {\n let rAF = 0;\n if (element) {\n const resizeObserver = new ResizeObserver(() => {\n cancelAnimationFrame(rAF);\n rAF = window.requestAnimationFrame(handleResize);\n });\n resizeObserver.observe(element);\n return () => {\n window.cancelAnimationFrame(rAF);\n resizeObserver.unobserve(element);\n };\n }\n }, [element, handleResize]);\n}\nvar Root = ScrollArea;\nvar Viewport = ScrollAreaViewport;\nvar Scrollbar = ScrollAreaScrollbar;\nvar Thumb = ScrollAreaThumb;\nvar Corner = ScrollAreaCorner;\nexport {\n Corner,\n Root,\n ScrollArea,\n ScrollAreaCorner,\n ScrollAreaScrollbar,\n ScrollAreaThumb,\n ScrollAreaViewport,\n Scrollbar,\n Thumb,\n Viewport,\n createScrollAreaScope\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\nimport * as ScrollAreaPrimitive from \"@radix-ui/react-scroll-area\";\nimport type * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * Brand-styled scroll surface — wraps Radix's headless scroll-area\n * primitive (the same one shadcn ships). Behaviour:\n *\n * - Scrollbars are **hidden** by default and reveal on hover\n * anywhere over the scroll surface OR while the visitor is\n * actively scrolling (Radix's default).\n * - Thumb uses the muted foreground token at ~30% so it reads as\n * chrome, not content — same visual weight as the widget's\n * secondary text.\n * - Track is transparent so existing surface backgrounds (bubble\n * elevated, gradient hero, etc.) carry through.\n *\n * Usage:\n *\n * <ScrollArea className=\"flex-1\">\n * <div>... scrollable content ...</div>\n * </ScrollArea>\n *\n * Pass `flex-1` (or similar) on the ScrollArea root to make it\n * inherit available height from its parent flex column.\n */\ninterface ScrollAreaProps extends React.ComponentProps<typeof ScrollAreaPrimitive.Root> {\n /** Ref forwarded to the inner Viewport — the element that actually\n * scrolls. Use this when callers need `scrollTo` / `scrollHeight`\n * (eg. auto-scrolling a chat list to the bottom). The Root's\n * default ref isn't useful for that because it just points at the\n * outer wrapper. */\n viewportRef?: React.Ref<HTMLDivElement>;\n}\n\nfunction ScrollArea({\n className,\n viewportRef,\n children,\n // The Radix Root doesn't scroll — its inner Viewport does. Pull\n // `onScroll` out of the spread so it lands on the Viewport, where\n // the scroll event actually fires. Callers that pass `onScroll`\n // (infinite-scroll triggers, \"near the bottom\" load-more handlers)\n // depend on this.\n onScroll,\n ...props\n}: ScrollAreaProps) {\n return (\n <ScrollAreaPrimitive.Root\n data-slot=\"scroll-area\"\n // `overflow-hidden` clips the viewport to the Root's box —\n // without it, content inside the viewport pushes the Root\n // taller than its `flex-1` slot, which is what was making\n // the messages composer disappear and Help / News content\n // overflow.\n // `min-h-0 min-w-0` lets the Root actually shrink inside a\n // flex parent (flex children default to `min-height: auto`,\n // which prevents the constraint from kicking in).\n className={cn(\"relative min-h-0 min-w-0 overflow-hidden\", className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n ref={viewportRef}\n data-slot=\"scroll-area-viewport\"\n onScroll={onScroll}\n className={cn(\n \"h-full w-full rounded-[inherit]\",\n // Radix wraps children in a `<div style=\"min-width:100%;\n // display:table\">` for horizontal-overflow support. That\n // `display:table` semantics let inner content GROW the\n // table past 100% width if a child has an intrinsic\n // size (which broke widget cards on 375 px viewports — a\n // 400 px-natural card overflowed the panel). Force the\n // inner wrapper to `block` + clamp to `100%` width so\n // children honour the parent's width budget instead.\n \"[&>div]:!block [&>div]:!w-full [&>div]:!max-w-full\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary/40\",\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n}\n\nfunction ScrollBar({\n className,\n orientation = \"vertical\",\n ...props\n}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n data-slot=\"scroll-area-scrollbar\"\n orientation={orientation}\n // Radix sets `data-state=\"visible|hidden\"` based on scrolling\n // activity. We fade with `opacity` so the bar can also be\n // reveal-on-hover via the parent's group/hover state.\n className={cn(\n \"flex touch-none select-none transition-opacity duration-150\",\n // Default: invisible. Visible whenever Radix marks the bar as\n // visible (active scrolling) OR the visitor is hovering the\n // scroll area.\n \"opacity-0 data-[state=visible]:opacity-100\",\n \"hover:opacity-100\",\n orientation === \"vertical\" && \"h-full w-1.5 border-l border-l-transparent p-px\",\n orientation === \"horizontal\" && \"h-1.5 flex-col border-t border-t-transparent p-px\",\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb\n data-slot=\"scroll-area-thumb\"\n className={cn(\n \"relative flex-1 rounded-full\",\n // Subtle muted thumb — same colour as helper text. Reads as\n // chrome on every widget surface (light bubble, primary\n // bubble, gradient hero).\n \"bg-wx-fg-muted/40 hover:bg-wx-fg-muted/60 transition-colors\",\n )}\n />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n}\n\nexport { ScrollArea, ScrollBar };\n","\"use client\";\n\nimport { ChevronLeft, ChevronRight, X } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { useTranslations } from \"next-intl\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useWidgetEnv } from \"@/lib/use-widget-env\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface LightboxItem {\n url: string;\n mimetype: string;\n alt: string;\n}\n\ninterface MediaLightboxProps {\n items: LightboxItem[];\n initialIndex: number;\n open: boolean;\n onClose: () => void;\n}\n\n/**\n * Full-screen media preview. Opens when a visitor taps an image or\n * video in a message bubble. Renders a single item by default; if\n * the source array has multiple items the visitor can scrub\n * left/right with chevron buttons or arrow keys.\n *\n * **Why an inline lightbox** (vs the FE app's modal-provider system):\n * the widget runs inside an iframe and has no global modal context\n * to lean on — a self-contained component keeps the dependency\n * surface flat.\n *\n * **Embed-aware overlay** — in iframe / web-component mode the overlay\n * is `position: fixed`, portaled to `<body>`, and covers the whole\n * viewport (it owns the page). In the React-component embed it instead\n * portals into the widget's own Shadow DOM and is `position: absolute`\n * — so it keeps the widget's Tailwind styles (they only exist inside\n * the shadow tree) and stays inside the host's preview container\n * rather than fighting the host app's z-index / sidebar.\n *\n * Closing surfaces:\n * - X chip top-right\n * - Click on the dark backdrop (NOT on the image)\n * - `Escape` key\n */\nexport function MediaLightbox({ items, initialIndex, open, onClose }: MediaLightboxProps) {\n const t = useTranslations(\"lightbox\");\n const [index, setIndex] = useState(initialIndex);\n const env = useWidgetEnv();\n const embedded = env.embedded ?? false;\n // `fixed` (viewport-anchored) overlay UNLESS we're a contained embed.\n // The embed can opt back into viewport coverage via `lightboxViewport`\n // (a tiny floating widget where a contained gallery would be unusable).\n const useFixed = !embedded || (env.lightboxViewport ?? false);\n\n // Snap index to whatever item the parent opened on whenever the\n // overlay (re)opens — without this the lightbox would keep its\n // last index across opens.\n useEffect(() => {\n if (open) setIndex(initialIndex);\n }, [open, initialIndex]);\n\n const total = items.length;\n const item = items[index];\n\n const next = useCallback(() => {\n setIndex((i) => (i + 1) % total);\n }, [total]);\n const prev = useCallback(() => {\n setIndex((i) => (i - 1 + total) % total);\n }, [total]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onClose();\n else if (e.key === \"ArrowRight\") next();\n else if (e.key === \"ArrowLeft\") prev();\n };\n document.addEventListener(\"keydown\", onKey);\n // Lock body scroll only when the overlay actually covers the\n // viewport (`useFixed`). A contained embed overlay sits inside the\n // widget's own box — freezing the host app's scroll would be an\n // intrusive side effect.\n const prevOverflow = document.body.style.overflow;\n if (useFixed) document.body.style.overflow = \"hidden\";\n return () => {\n document.removeEventListener(\"keydown\", onKey);\n if (useFixed) document.body.style.overflow = prevOverflow;\n };\n }, [open, onClose, next, prev, useFixed]);\n\n // Portal target stays inside the widget's Shadow DOM whenever\n // embedded — that's where the widget's Tailwind styles live, so the\n // overlay only renders correctly there (true even when it's `fixed`:\n // a `position: fixed` element inside the shadow tree still anchors to\n // the viewport, it just keeps its stylesheet). Iframe / web-component\n // builds own the page, so they portal to `<body>`.\n const portalTarget: Element | null = embedded\n ? (env.themeRoot ?? null)\n : typeof document !== \"undefined\"\n ? document.body\n : null;\n if (!portalTarget) return null;\n\n return createPortal(\n <AnimatePresence>\n {open && item && (\n <motion.div\n key=\"media-lightbox\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.15 }}\n onClick={onClose}\n className={cn(\n useFixed ? \"fixed\" : \"absolute\",\n \"inset-0 z-[2147483647] flex items-center justify-center\",\n \"bg-black/85 backdrop-blur-sm\",\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={item.alt || t(\"mediaPreview\")}\n >\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n onClose();\n }}\n aria-label={t(\"close\")}\n className={cn(\n // `z-10` keeps the controls above the media — in the\n // contained layout the image fills the box edge-to-edge\n // and would otherwise paint over the buttons.\n \"absolute top-4 right-4 z-10 flex h-9 w-9 items-center justify-center rounded-full\",\n \"bg-white/10 text-white transition-colors hover:bg-white/20\",\n )}\n >\n <X size={18} />\n </button>\n\n {total > 1 && (\n <>\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n prev();\n }}\n aria-label={t(\"previous\")}\n className={cn(\n \"absolute left-4 top-1/2 z-10 -translate-y-1/2 flex h-10 w-10 items-center justify-center rounded-full\",\n \"bg-white/10 text-white transition-colors hover:bg-white/20\",\n )}\n >\n <ChevronLeft size={20} />\n </button>\n <button\n type=\"button\"\n onClick={(e) => {\n e.stopPropagation();\n next();\n }}\n aria-label={t(\"next\")}\n className={cn(\n \"absolute right-4 top-1/2 z-10 -translate-y-1/2 flex h-10 w-10 items-center justify-center rounded-full\",\n \"bg-white/10 text-white transition-colors hover:bg-white/20\",\n )}\n >\n <ChevronRight size={20} />\n </button>\n </>\n )}\n\n {/* Media wrapper.\n\n Sizing is overlay-scope-aware: when the overlay covers the\n viewport (`useFixed`) the media is capped to the VIEWPORT\n (`90vh`/`90vw`). When it's contained to the widget's host\n box, viewport units would size the image far bigger than\n that box and spill out — so the wrapper fills the overlay\n (`inset-0` + padding) and the media is capped to that with\n `max-h/w-full`.\n\n `pointer-events-none` on the wrapper is load-bearing in the\n contained mode: there the wrapper is `inset-0` and would\n otherwise sit on top of the X / prev / next buttons (later\n in DOM order) and swallow their clicks. The media element\n itself re-enables pointer events so it can still be clicked\n (and `stopPropagation` keeps that click off the backdrop). */}\n <motion.div\n key={`${index}-${item.url}`}\n initial={{ scale: 0.96, opacity: 0 }}\n animate={{ scale: 1, opacity: 1 }}\n exit={{ scale: 0.96, opacity: 0 }}\n transition={{ duration: 0.18, ease: \"easeOut\" }}\n className={cn(\n \"pointer-events-none flex items-center justify-center\",\n useFixed ? \"max-h-[90vh] max-w-[90vw]\" : \"absolute inset-0 p-6\",\n )}\n >\n {item.mimetype.startsWith(\"video/\") ? (\n // biome-ignore lint/a11y/useMediaCaption: operator-provided\n <video\n src={item.url}\n controls\n autoPlay\n onClick={(e) => e.stopPropagation()}\n className={cn(\n \"pointer-events-auto rounded-wx-lg\",\n useFixed ? \"max-h-[90vh] max-w-[90vw]\" : \"max-h-full max-w-full\",\n )}\n />\n ) : item.mimetype === \"application/pdf\" ? (\n // PDFs render in the browser's built-in viewer via iframe —\n // free zoom / search / download with no extra dep. White\n // backdrop so a transparent PDF doesn't read as broken.\n <iframe\n src={item.url}\n title={item.alt || \"PDF preview\"}\n onClick={(e) => e.stopPropagation()}\n className={cn(\n \"pointer-events-auto rounded-wx-lg border-0 bg-white\",\n useFixed ? \"h-[90vh] w-[90vw]\" : \"h-full w-full\",\n )}\n />\n ) : (\n // biome-ignore lint/performance/noImgElement: uploaded media of arbitrary host/dimensions; next/image needs known sizes + an allowlist, and isn't available in the web-component / iframe embeds\n <motion.img\n src={item.url}\n alt={item.alt}\n onClick={(e) => e.stopPropagation()}\n // Swipe to navigate (mouse drag + touch). Constrained to\n // x:0 with elastic so the image springs back to centre;\n // `onDragEnd` reads the drag distance and advances if it\n // passed the threshold. Only enabled with >1 item.\n draggable={false}\n drag={total > 1 ? \"x\" : false}\n dragConstraints={{ left: 0, right: 0 }}\n dragElastic={0.18}\n dragMomentum={false}\n onDragEnd={(_e, info) => {\n const SWIPE_PX = 60;\n if (info.offset.x <= -SWIPE_PX) next();\n else if (info.offset.x >= SWIPE_PX) prev();\n }}\n className={cn(\n \"pointer-events-auto rounded-wx-lg object-contain\",\n total > 1 && \"cursor-grab active:cursor-grabbing\",\n useFixed ? \"max-h-[90vh] max-w-[90vw]\" : \"max-h-full max-w-full\",\n )}\n />\n )}\n </motion.div>\n\n {total > 1 && (\n <div className=\"absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full bg-white/10 px-3 py-1 text-xs font-medium text-white\">\n {index + 1} / {total}\n </div>\n )}\n </motion.div>\n )}\n </AnimatePresence>,\n portalTarget,\n );\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,85,86,87,88,89,90,92,93,94,95,96,97,98,99,100,101],"mappings":";;;;;;;;;;;;AAgBA,IAAI,KAAgB,SAAS,GAAG,GAAG;CAIjC,OAHA,KAAgB,OAAO,kBAClB,EAAE,WAAW,EAAE,EAAE,YAAY,SAAS,SAAU,GAAG,GAAG;EAAE,EAAE,YAAY;MACvE,SAAU,GAAG,GAAG;EAAE,KAAK,IAAI,KAAK,GAAG,AAAI,OAAO,UAAU,eAAe,KAAK,GAAG,EAAE,KAAE,EAAE,KAAK,EAAE;IACzF,GAAc,GAAG,EAAE;;AAG5B,SAAgB,GAAU,GAAG,GAAG;CAC9B,IAAI,OAAO,KAAM,cAAc,MAAM,MAC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