UNPKG

@ant-design/x-sdk

Version:

placeholder for @ant-design/x-sdk

1,351 lines (1,342 loc) 96.9 kB
((__TURBOPACK__) => { if (!Array.isArray(__TURBOPACK__)) { return; } const CHUNK_BASE_PATH = ""; const CHUNK_SUFFIX_PATH = ""; const RELATIVE_ROOT_PATH = "/ROOT"; const RUNTIME_PUBLIC_PATH = ""; /** * This file contains runtime types and functions that are shared between all * TurboPack ECMAScript runtimes. * * It will be prepended to the runtime code of each runtime. */ /* eslint-disable @typescript-eslint/no-unused-vars */ /// <reference path="./runtime-types.d.ts" /> const REEXPORTED_OBJECTS = Symbol("reexported objects"); /** * Constructs the `__turbopack_context__` object for a module. */ function Context(module) { this.m = module; this.e = module.exports; } const contextPrototype = Context.prototype; const hasOwnProperty = Object.prototype.hasOwnProperty; const toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag; function defineProp(obj, name, options) { if (!hasOwnProperty.call(obj, name)) Object.defineProperty(obj, name, options); } function getOverwrittenModule(moduleCache, id) { let module = moduleCache[id]; if (!module) { // This is invoked when a module is merged into another module, thus it wasn't invoked via // instantiateModule and the cache entry wasn't created yet. module = createModuleObject(id); moduleCache[id] = module; } return module; } /** * Creates the module object. Only done here to ensure all module objects have the same shape. */ function createModuleObject(id) { return { exports: {}, error: undefined, loaded: false, id, namespaceObject: undefined, [REEXPORTED_OBJECTS]: undefined }; } /** * Adds the getters to the exports object. */ function esm(exports, getters) { defineProp(exports, "__esModule", { value: true }); if (toStringTag) defineProp(exports, toStringTag, { value: "Module" }); for(const key in getters){ const item = getters[key]; if (Array.isArray(item)) { defineProp(exports, key, { get: item[0], set: item[1], enumerable: true }); } else { defineProp(exports, key, { get: item, enumerable: true }); } } Object.seal(exports); } /** * Makes the module an ESM with exports */ function esmExport(getters, id) { let module = this.m; let exports = this.e; if (id != null) { module = getOverwrittenModule(this.c, id); exports = module.exports; } module.namespaceObject = module.exports; esm(exports, getters); } contextPrototype.s = esmExport; function ensureDynamicExports(module, exports) { let reexportedObjects = module[REEXPORTED_OBJECTS]; if (!reexportedObjects) { reexportedObjects = module[REEXPORTED_OBJECTS] = []; module.exports = module.namespaceObject = new Proxy(exports, { get (target, prop) { if (hasOwnProperty.call(target, prop) || prop === "default" || prop === "__esModule") { return Reflect.get(target, prop); } for (const obj of reexportedObjects){ const value = Reflect.get(obj, prop); if (value !== undefined) return value; } return undefined; }, ownKeys (target) { const keys = Reflect.ownKeys(target); for (const obj of reexportedObjects){ for (const key of Reflect.ownKeys(obj)){ if (key !== "default" && !keys.includes(key)) keys.push(key); } } return keys; } }); } } /** * Dynamically exports properties from an object */ function dynamicExport(object, id) { let module = this.m; let exports = this.e; if (id != null) { module = getOverwrittenModule(this.c, id); exports = module.exports; } ensureDynamicExports(module, exports); if (typeof object === "object" && object !== null) { module[REEXPORTED_OBJECTS].push(object); } } contextPrototype.j = dynamicExport; function exportValue(value, id) { let module = this.m; if (id != null) { module = getOverwrittenModule(this.c, id); } module.exports = value; } contextPrototype.v = exportValue; function exportNamespace(namespace, id) { let module = this.m; if (id != null) { module = getOverwrittenModule(this.c, id); } module.exports = module.namespaceObject = namespace; } contextPrototype.n = exportNamespace; function createGetter(obj, key) { return ()=>obj[key]; } /** * @returns prototype of the object */ const getProto = Object.getPrototypeOf ? (obj)=>Object.getPrototypeOf(obj) : (obj)=>obj.__proto__; /** Prototypes that are not expanded for exports */ const LEAF_PROTOTYPES = [ null, getProto({}), getProto([]), getProto(getProto) ]; /** * @param raw * @param ns * @param allowExportDefault * * `false`: will have the raw module as default export * * `true`: will have the default property as default export */ function interopEsm(raw, ns, allowExportDefault) { const getters = Object.create(null); for(let current = raw; (typeof current === "object" || typeof current === "function") && !LEAF_PROTOTYPES.includes(current); current = getProto(current)){ for (const key of Object.getOwnPropertyNames(current)){ getters[key] = createGetter(raw, key); } } // this is not really correct // we should set the `default` getter if the imported module is a `.cjs file` if (!(allowExportDefault && "default" in getters)) { getters["default"] = ()=>raw; } esm(ns, getters); return ns; } function createNS(raw) { if (typeof raw === "function") { return function(...args) { return raw.apply(this, args); }; } else { return Object.create(null); } } function esmImport(id) { const module = getOrInstantiateModuleFromParent(id, this.m); if (module.error) throw module.error; // any ES module has to have `module.namespaceObject` defined. if (module.namespaceObject) return module.namespaceObject; // only ESM can be an async module, so we don't need to worry about exports being a promise here. const raw = module.exports; return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); } contextPrototype.i = esmImport; function asyncLoader(moduleId) { const loader = this.r(moduleId); return loader(this.i.bind(this)); } contextPrototype.A = asyncLoader; // Add a simple runtime require so that environments without one can still pass // `typeof require` CommonJS checks so that exports are correctly registered. const runtimeRequire = // @ts-ignore typeof require === "function" ? require : function require1() { throw new Error("Unexpected use of runtime require"); }; contextPrototype.t = runtimeRequire; function commonJsRequire(id) { const module = getOrInstantiateModuleFromParent(id, this.m); if (module.error) throw module.error; return module.exports; } contextPrototype.r = commonJsRequire; /** * `require.context` and require/import expression runtime. */ function moduleContext(map) { function moduleContext(id) { if (hasOwnProperty.call(map, id)) { return map[id].module(); } const e = new Error(`Cannot find module '${id}'`); e.code = "MODULE_NOT_FOUND"; throw e; } moduleContext.keys = ()=>{ return Object.keys(map); }; moduleContext.resolve = (id)=>{ if (hasOwnProperty.call(map, id)) { return map[id].id(); } const e = new Error(`Cannot find module '${id}'`); e.code = "MODULE_NOT_FOUND"; throw e; }; moduleContext.import = async (id)=>{ return await moduleContext(id); }; return moduleContext; } contextPrototype.f = moduleContext; /** * Returns the path of a chunk defined by its data. */ function getChunkPath(chunkData) { return typeof chunkData === "string" ? chunkData : chunkData.path; } function isPromise(maybePromise) { return maybePromise != null && typeof maybePromise === "object" && "then" in maybePromise && typeof maybePromise.then === "function"; } function isAsyncModuleExt(obj) { return turbopackQueues in obj; } function createPromise() { let resolve; let reject; const promise = new Promise((res, rej)=>{ reject = rej; resolve = res; }); return { promise, resolve: resolve, reject: reject }; } // everything below is adapted from webpack // https://github.com/webpack/webpack/blob/6be4065ade1e252c1d8dcba4af0f43e32af1bdc1/lib/runtime/AsyncModuleRuntimeModule.js#L13 const turbopackQueues = Symbol("turbopack queues"); const turbopackExports = Symbol("turbopack exports"); const turbopackError = Symbol("turbopack error"); function resolveQueue(queue) { if (queue && queue.status !== 1) { queue.status = 1; queue.forEach((fn)=>fn.queueCount--); queue.forEach((fn)=>fn.queueCount-- ? fn.queueCount++ : fn()); } } function wrapDeps(deps) { return deps.map((dep)=>{ if (dep !== null && typeof dep === "object") { if (isAsyncModuleExt(dep)) return dep; if (isPromise(dep)) { const queue = Object.assign([], { status: 0 }); const obj = { [turbopackExports]: {}, [turbopackQueues]: (fn)=>fn(queue) }; dep.then((res)=>{ obj[turbopackExports] = res; resolveQueue(queue); }, (err)=>{ obj[turbopackError] = err; resolveQueue(queue); }); return obj; } } return { [turbopackExports]: dep, [turbopackQueues]: ()=>{} }; }); } function asyncModule(body, hasAwait) { const module = this.m; const queue = hasAwait ? Object.assign([], { status: -1 }) : undefined; const depQueues = new Set(); const { resolve, reject, promise: rawPromise } = createPromise(); const promise = Object.assign(rawPromise, { [turbopackExports]: module.exports, [turbopackQueues]: (fn)=>{ queue && fn(queue); depQueues.forEach(fn); promise["catch"](()=>{}); } }); const attributes = { get () { return promise; }, set (v) { // Calling `esmExport` leads to this. if (v !== promise) { promise[turbopackExports] = v; } } }; Object.defineProperty(module, "exports", attributes); Object.defineProperty(module, "namespaceObject", attributes); function handleAsyncDependencies(deps) { const currentDeps = wrapDeps(deps); const getResult = ()=>currentDeps.map((d)=>{ if (d[turbopackError]) throw d[turbopackError]; return d[turbopackExports]; }); const { promise, resolve } = createPromise(); const fn = Object.assign(()=>resolve(getResult), { queueCount: 0 }); function fnQueue(q) { if (q !== queue && !depQueues.has(q)) { depQueues.add(q); if (q && q.status === 0) { fn.queueCount++; q.push(fn); } } } currentDeps.map((dep)=>dep[turbopackQueues](fnQueue)); return fn.queueCount ? promise : getResult(); } function asyncResult(err) { if (err) { reject(promise[turbopackError] = err); } else { resolve(promise[turbopackExports]); } resolveQueue(queue); } body(handleAsyncDependencies, asyncResult); if (queue && queue.status === -1) { queue.status = 0; } } contextPrototype.a = asyncModule; /** * A pseudo "fake" URL object to resolve to its relative path. * * When UrlRewriteBehavior is set to relative, calls to the `new URL()` will construct url without base using this * runtime function to generate context-agnostic urls between different rendering context, i.e ssr / client to avoid * hydration mismatch. * * This is based on webpack's existing implementation: * https://github.com/webpack/webpack/blob/87660921808566ef3b8796f8df61bd79fc026108/lib/runtime/RelativeUrlRuntimeModule.js */ const relativeURL = function relativeURL(inputUrl) { const realUrl = new URL(inputUrl, "x:/"); const values = {}; for(const key in realUrl)values[key] = realUrl[key]; values.href = inputUrl; values.pathname = inputUrl.replace(/[?#].*/, ""); values.origin = values.protocol = ""; values.toString = values.toJSON = (..._args)=>inputUrl; for(const key in values)Object.defineProperty(this, key, { enumerable: true, configurable: true, value: values[key] }); }; relativeURL.prototype = URL.prototype; contextPrototype.U = relativeURL; /** * Utility function to ensure all variants of an enum are handled. */ function invariant(never, computeMessage) { throw new Error(`Invariant: ${computeMessage(never)}`); } /** * A stub function to make `require` available but non-functional in ESM. */ function requireStub(_moduleId) { throw new Error("dynamic usage of require is not supported"); } contextPrototype.z = requireStub; /** * This file contains runtime types and functions that are shared between all * Turbopack *development* ECMAScript runtimes. * * It will be appended to the runtime code of each runtime right after the * shared runtime utils. */ /* eslint-disable @typescript-eslint/no-unused-vars */ /// <reference path="./globals.d.ts" /> /// <reference path="./runtime-utils.ts" /> // Used in WebWorkers to tell the runtime about the chunk base path function normalizeChunkPath(path) { if (path.startsWith("/")) { path = path.substring(1); } else if (path.startsWith("./")) { path = path.substring(2); } if (!path.endsWith("/")) { path += "/"; } return path; } const NORMALIZED_CHUNK_BASE_PATH = normalizeChunkPath(CHUNK_BASE_PATH); const browserContextPrototype = Context.prototype; var SourceType = /*#__PURE__*/ function(SourceType) { /** * The module was instantiated because it was included in an evaluated chunk's * runtime. * SourceData is a ChunkPath. */ SourceType[SourceType["Runtime"] = 0] = "Runtime"; /** * The module was instantiated because a parent module imported it. * SourceData is a ModuleId. */ SourceType[SourceType["Parent"] = 1] = "Parent"; /** * The module was instantiated because it was included in a chunk's hot module * update. * SourceData is an array of ModuleIds or undefined. */ SourceType[SourceType["Update"] = 2] = "Update"; return SourceType; }(SourceType || {}); const moduleFactories = Object.create(null); contextPrototype.M = moduleFactories; const availableModules = new Map(); const availableModuleChunks = new Map(); function factoryNotAvailable(moduleId, sourceType, sourceData) { let instantiationReason; switch(sourceType){ case 0: instantiationReason = `as a runtime entry of chunk ${sourceData}`; break; case 1: instantiationReason = `because it was required from module ${sourceData}`; break; case 2: instantiationReason = "because of an HMR update"; break; default: invariant(sourceType, (sourceType)=>`Unknown source type: ${sourceType}`); } throw new Error(`Module ${moduleId} was instantiated ${instantiationReason}, but the module factory is not available. It might have been deleted in an HMR update.`); } const loadedChunk = Promise.resolve(undefined); const instrumentedBackendLoadChunks = new WeakMap(); // Do not make this async. React relies on referential equality of the returned Promise. function loadChunkByUrl(chunkUrl) { return loadChunkByUrlInternal(1, this.m.id, chunkUrl); } browserContextPrototype.L = loadChunkByUrl; // Do not make this async. React relies on referential equality of the returned Promise. function loadChunkByUrlInternal(sourceType, sourceData, chunkUrl) { const thenable = BACKEND.loadChunkCached(sourceType, sourceData, chunkUrl); let entry = instrumentedBackendLoadChunks.get(thenable); if (entry === undefined) { const resolve = instrumentedBackendLoadChunks.set.bind(instrumentedBackendLoadChunks, thenable, loadedChunk); entry = thenable.then(resolve).catch((error)=>{ let loadReason; switch(sourceType){ case 0: loadReason = `as a runtime dependency of chunk ${sourceData}`; break; case 1: loadReason = `from module ${sourceData}`; break; case 2: loadReason = "from an HMR update"; break; default: invariant(sourceType, (sourceType)=>`Unknown source type: ${sourceType}`); } throw new Error(`Failed to load chunk ${chunkUrl} ${loadReason}${error ? `: ${error}` : ""}`, error ? { cause: error } : undefined); }); instrumentedBackendLoadChunks.set(thenable, entry); } return entry; } // Do not make this async. React relies on referential equality of the returned Promise. function loadChunkPath(sourceType, sourceData, chunkPath) { const url = getChunkRelativeUrl(chunkPath); return loadChunkByUrlInternal(sourceType, sourceData, url); } /** * Returns an absolute url to an asset. */ function resolvePathFromModule(moduleId) { const exported = this.r(moduleId); return exported?.default ?? exported; } browserContextPrototype.R = resolvePathFromModule; /** * no-op for browser * @param modulePath */ function resolveAbsolutePath(modulePath) { return `/ROOT/${modulePath ?? ""}`; } browserContextPrototype.P = resolveAbsolutePath; /** * Instantiates a runtime module. */ function instantiateRuntimeModule(moduleId, chunkPath) { return instantiateModule(moduleId, 0, chunkPath); } /** * Returns the URL relative to the origin where a chunk can be fetched from. */ function getChunkRelativeUrl(chunkPath) { return `${NORMALIZED_CHUNK_BASE_PATH}${chunkPath.split("/").map((p)=>encodeURIComponent(p)).join("/")}${CHUNK_SUFFIX_PATH}`; } function getPathFromScript(chunkScript) { if (typeof chunkScript === "string") { return chunkScript; } const chunkUrl = typeof TURBOPACK_NEXT_CHUNK_URLS !== "undefined" ? TURBOPACK_NEXT_CHUNK_URLS.pop() : chunkScript.getAttribute("src"); const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, "")); const path = src.startsWith(CHUNK_BASE_PATH) ? src.slice(CHUNK_BASE_PATH.length) : src; return path; } function registerCompressedModuleFactory(moduleId, moduleFactory) { if (!moduleFactories[moduleId]) { if (Array.isArray(moduleFactory)) { let [moduleFactoryFn, otherIds] = moduleFactory; moduleFactories[moduleId] = moduleFactoryFn; for (const otherModuleId of otherIds){ moduleFactories[otherModuleId] = moduleFactoryFn; } } else { moduleFactories[moduleId] = moduleFactory; } } } const regexJsUrl = /\.js(?:\?[^#]*)?(?:#.*)?$/; /** * Checks if a given path/URL ends with .js, optionally followed by ?query or #fragment. */ function isJs(chunkUrlOrPath) { return regexJsUrl.test(chunkUrlOrPath); } /// <reference path="./runtime-base.ts" /> /// <reference path="./dummy.ts" /> const moduleCache = {}; contextPrototype.c = moduleCache; /** * Gets or instantiates a runtime module. */ // @ts-ignore // eslint-disable-next-line @typescript-eslint/no-unused-vars function getOrInstantiateRuntimeModule(chunkPath, moduleId) { const module = moduleCache[moduleId]; if (module) { if (module.error) { throw module.error; } return module; } return instantiateModule(moduleId, SourceType.Runtime, chunkPath); } /** * Retrieves a module from the cache, or instantiate it if it is not cached. */ // Used by the backend // @ts-ignore // eslint-disable-next-line @typescript-eslint/no-unused-vars const getOrInstantiateModuleFromParent = (id, sourceModule)=>{ const module = moduleCache[id]; if (module) { return module; } return instantiateModule(id, SourceType.Parent, sourceModule.id); }; function instantiateModule(id, sourceType, sourceData) { const moduleFactory = moduleFactories[id]; if (typeof moduleFactory !== "function") { // This can happen if modules incorrectly handle HMR disposes/updates, // e.g. when they keep a `setTimeout` around which still executes old code // and contains e.g. a `require("something")` call. factoryNotAvailable(id, sourceType, sourceData); } const module = createModuleObject(id); moduleCache[id] = module; // NOTE(alexkirsz) This can fail when the module encounters a runtime error. try { const context = new Context(module); moduleFactory(context); } catch (error) { module.error = error; throw error; } module.loaded = true; if (module.namespaceObject && module.exports !== module.namespaceObject) { // in case of a circular dependency: cjs1 -> esm2 -> cjs1 interopEsm(module.exports, module.namespaceObject); } return module; } // eslint-disable-next-line @typescript-eslint/no-unused-vars function registerChunk([chunkScript, chunkModules, runtimeParams]) { const chunkPath = getPathFromScript(chunkScript); for (const [moduleId, moduleFactory] of Object.entries(chunkModules)){ registerCompressedModuleFactory(moduleId, moduleFactory); } return BACKEND.registerChunk(chunkPath, runtimeParams); } /* eslint-disable @typescript-eslint/no-unused-vars */ /// <reference path="./runtime-utils.ts" /> /// A 'base' utilities to support runtime can have externals. /// Currently this is for node.js / edge runtime both. /// If a fn requires node.js specific behavior, it should be placed in `node-external-utils` instead. async function externalImport(id) { let raw; try { raw = await import(id); } catch (err) { // TODO(alexkirsz) This can happen when a client-side module tries to load // an external module we don't provide a shim for (e.g. querystring, url). // For now, we fail semi-silently, but in the future this should be a // compilation error. throw new Error(`Failed to load external module ${id}: ${err}`); } if (raw && raw.__esModule && raw.default && "default" in raw.default) { return interopEsm(raw.default, createNS(raw), true); } return raw; } contextPrototype.y = externalImport; function externalRequire(id, thunk, esm = false) { let raw; try { raw = thunk(); } catch (err) { // TODO(alexkirsz) This can happen when a client-side module tries to load // an external module we don't provide a shim for (e.g. querystring, url). // For now, we fail semi-silently, but in the future this should be a // compilation error. throw new Error(`Failed to load external module ${id}: ${err}`); } if (!esm || raw.__esModule) { return raw; } return interopEsm(raw, createNS(raw), true); } externalRequire.resolve = (id, options)=>{ return require.resolve(id, options); }; contextPrototype.x = externalRequire; /** * This file contains the runtime code specific to the Turbopack development * ECMAScript DOM runtime. * * It will be appended to the base development runtime code. */ /* eslint-disable @typescript-eslint/no-unused-vars */ /// <reference path="./runtime-base.ts" /> /// <reference path="./runtime-types.d.ts" /> let BACKEND; /** * Maps chunk paths to the corresponding resolver. */ const chunkResolvers = new Map(); (()=>{ BACKEND = { registerChunk (chunkPath, params) { const chunkUrl = getChunkRelativeUrl(chunkPath); const resolver = getOrCreateResolver(chunkUrl); resolver.resolve(); if (params == null) { return; } for (const otherChunkData of params.otherChunks){ const otherChunkPath = getChunkPath(otherChunkData); const otherChunkUrl = getChunkRelativeUrl(otherChunkPath); // Chunk might have started loading, so we want to avoid triggering another load. getOrCreateResolver(otherChunkUrl); } if (params.runtimeModuleIds.length > 0) { for (const moduleId of params.runtimeModuleIds){ getOrInstantiateRuntimeModule(chunkPath, moduleId); } } }, /** * Loads the given chunk, and returns a promise that resolves once the chunk * has been loaded. */ loadChunkCached (sourceType, sourceData, chunkUrl) { return doLoadChunk(sourceType, sourceData, chunkUrl); } }; function getOrCreateResolver(chunkUrl) { let resolver = chunkResolvers.get(chunkUrl); if (!resolver) { let resolve; let reject; const promise = new Promise((innerResolve, innerReject)=>{ resolve = innerResolve; reject = innerReject; }); resolver = { resolved: false, loadingStarted: false, promise, resolve: ()=>{ resolver.resolved = true; resolve(); }, reject: reject }; chunkResolvers.set(chunkUrl, resolver); } return resolver; } /** * Loads the given chunk, and returns a promise that resolves once the chunk * has been loaded. */ function doLoadChunk(sourceType, _sourceData, chunkUrl) { const resolver = getOrCreateResolver(chunkUrl); if (resolver.loadingStarted) { return resolver.promise; } if (sourceType === SourceType.Runtime) { // We don't need to load chunks references from runtime code, as they're already // present in the DOM. resolver.loadingStarted = true; // We need to wait for JS chunks to register themselves within `registerChunk` // before we can start instantiating runtime modules, hence the absence of // `resolver.resolve()` in this branch. return resolver.promise; } if (typeof importScripts === "function") { // We're in a web worker if (isJs(chunkUrl)) { self.TURBOPACK_NEXT_CHUNK_URLS.push(chunkUrl); importScripts(TURBOPACK_WORKER_LOCATION + chunkUrl); } else { throw new Error(`can't infer type of chunk from URL ${chunkUrl} in worker`); } } else { // TODO(PACK-2140): remove this once all filenames are guaranteed to be escaped. const decodedChunkUrl = decodeURI(chunkUrl); if (isJs(chunkUrl)) { const previousScripts = document.querySelectorAll(`script[src="${chunkUrl}"],script[src^="${chunkUrl}?"],script[src="${decodedChunkUrl}"],script[src^="${decodedChunkUrl}?"]`); if (previousScripts.length > 0) { // There is this edge where the script already failed loading, but we // can't detect that. The Promise will never resolve in this case. for (const script of Array.from(previousScripts)){ script.addEventListener("error", ()=>{ resolver.reject(); }); } } else { const script = document.createElement("script"); script.src = chunkUrl; // We'll only mark the chunk as loaded once the script has been executed, // which happens in `registerChunk`. Hence the absence of `resolve()` in // this branch. script.onerror = ()=>{ resolver.reject(); }; // Append to the `head` for webpack compatibility. document.head.appendChild(script); } } else { throw new Error(`can't infer type of chunk from URL ${chunkUrl}`); } } resolver.loadingStarted = true; return resolver.promise; } })(); const chunksToRegister = __TURBOPACK__; __TURBOPACK__ = { push: registerChunk }; chunksToRegister.forEach(registerChunk); function factory () { const runtimeModuleIds = ["643"]; if (runtimeModuleIds.length > 0) { const module = moduleCache[runtimeModuleIds[0]]; if (module.error) throw module.error; // any ES module has to have `module.namespaceObject` defined. if (module.namespaceObject) return module.namespaceObject; // only ESM can be an async module, so we don't need to worry about exports being a promise here. const raw = module.exports; return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); } } if (typeof exports === 'object' && typeof module === 'object') { module.exports = factory(); } else if (typeof exports === 'object') { exports["XSDK"] = factory(); } else { globalThis["XSDK"] = factory(); } })([["x-sdk.js", { 571: ((__turbopack_context__) => { "use strict"; let mod; if (typeof exports === 'object' && typeof module === 'object') { mod = __turbopack_context__.x("react", () => require("react")); } else { mod = globalThis["React"] } __turbopack_context__.v(mod); }), 652: ((__turbopack_context__, module, exports) => { "use strict"; /** * @license React * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), h = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u; u = Symbol.for("react.module.reference"); function v(a) { if ("object" === typeof a && null !== a) { var r = a.$$typeof; switch(r){ case b: switch(a = a.type, a){ case d: case f: case e: case m: case n: return a; default: switch(a = a && a.$$typeof, a){ case k: case h: case l: case q: case p: case g: return a; default: return r; } } case c: return r; } } } exports.ContextConsumer = h; exports.ContextProvider = g; exports.Element = b; exports.ForwardRef = l; exports.Fragment = d; exports.Lazy = q; exports.Memo = p; exports.Portal = c; exports.Profiler = f; exports.StrictMode = e; exports.Suspense = m; exports.SuspenseList = n; exports.isAsyncMode = function() { return !1; }; exports.isConcurrentMode = function() { return !1; }; exports.isContextConsumer = function(a) { return v(a) === h; }; exports.isContextProvider = function(a) { return v(a) === g; }; exports.isElement = function(a) { return "object" === typeof a && null !== a && a.$$typeof === b; }; exports.isForwardRef = function(a) { return v(a) === l; }; exports.isFragment = function(a) { return v(a) === d; }; exports.isLazy = function(a) { return v(a) === q; }; exports.isMemo = function(a) { return v(a) === p; }; exports.isPortal = function(a) { return v(a) === c; }; exports.isProfiler = function(a) { return v(a) === f; }; exports.isStrictMode = function(a) { return v(a) === e; }; exports.isSuspense = function(a) { return v(a) === m; }; exports.isSuspenseList = function(a) { return v(a) === n; }; exports.isValidElementType = function(a) { return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? !0 : !1; }; exports.typeOf = v; }), 674: ((__turbopack_context__, module, exports) => { "use strict"; if ("TURBOPACK compile-time truthy", 1) { module.exports = __turbopack_context__.r(652); } else //TURBOPACK unreachable ; }), 643: ((__turbopack_context__) => { "use strict"; // MERGED MODULE: [project]/packages/x-sdk/src/index.ts [library] (ecmascript) ; // MERGED MODULE: [project]/packages/x-sdk/src/index.ts [library] (ecmascript) <locals> ; ; ; ; ; ; __turbopack_context__.s([], 584); var __TURBOPACK__imported__module__584__ = __turbopack_context__.i(584); // MERGED MODULE: [project]/packages/x-sdk/src/x-chat/index.ts [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/rc-util/es/index.js [library] (ecmascript) <locals> ; // MERGED MODULE: [project]/node_modules/rc-util/es/hooks/useEvent.js [library] (ecmascript) ; var __TURBOPACK__imported__module__571__ = __turbopack_context__.i(571); ; function useEvent(callback) { var fnRef = __TURBOPACK__imported__module__571__["useRef"](); fnRef.current = callback; var memoFn = __TURBOPACK__imported__module__571__["useCallback"](function() { var _fnRef$current; for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ args[_key] = arguments[_key]; } return (_fnRef$current = fnRef.current) === null || _fnRef$current === void 0 ? void 0 : _fnRef$current.call.apply(_fnRef$current, [ fnRef ].concat(args)); }, []); return memoFn; } // MERGED MODULE: [project]/node_modules/rc-util/es/hooks/useMergedState.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/slicedToArray.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js [library] (ecmascript) ; function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js [library] (ecmascript) ; function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for(; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally{ try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally{ if (o) throw n; } } return a; } } ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js [library] (ecmascript) ; function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for(var e = 0, n = Array(a); e < a; e++)n[e] = r[e]; return n; } ; ; function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = ({}).toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js [library] (ecmascript) ; function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } ; ; ; ; ; function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } ; // MERGED MODULE: [project]/node_modules/rc-util/es/hooks/useLayoutEffect.js [library] (ecmascript) ; var __TURBOPACK__imported__module__571__1 = __TURBOPACK__imported__module__571__; // MERGED MODULE: [project]/node_modules/rc-util/es/Dom/canUseDom.js [library] (ecmascript) ; function canUseDom() { return !!(typeof window !== 'undefined' && window.document && window.document.createElement); } ; ; /** * Wrap `React.useLayoutEffect` which will not throw warning message in test env */ var useInternalLayoutEffect = ("TURBOPACK compile-time value", "production") !== 'test' && canUseDom() ? __TURBOPACK__imported__module__571__1["useLayoutEffect"] : __TURBOPACK__imported__module__571__1["useEffect"]; var useLayoutEffect = function useLayoutEffect(callback, deps) { var firstMountRef = __TURBOPACK__imported__module__571__1["useRef"](true); useInternalLayoutEffect(function() { return callback(firstMountRef.current); }, deps); // We tell react that first mount has passed useInternalLayoutEffect(function() { firstMountRef.current = false; return function() { firstMountRef.current = true; }; }, []); }; var useLayoutUpdateEffect = function useLayoutUpdateEffect(callback, deps) { useLayoutEffect(function(firstMount) { if (!firstMount) { return callback(); } }, deps); }; const __TURBOPACK__default__export__ = useLayoutEffect; // MERGED MODULE: [project]/node_modules/rc-util/es/hooks/useState.js [library] (ecmascript) ; var __TURBOPACK__imported__module__571__2 = __TURBOPACK__imported__module__571__; ; ; function useSafeState(defaultValue) { var destroyRef = __TURBOPACK__imported__module__571__2["useRef"](false); var _React$useState = __TURBOPACK__imported__module__571__2["useState"](defaultValue), _React$useState2 = _slicedToArray(_React$useState, 2), value = _React$useState2[0], setValue = _React$useState2[1]; __TURBOPACK__imported__module__571__2["useEffect"](function() { destroyRef.current = false; return function() { destroyRef.current = true; }; }, []); function safeSetState(updater, ignoreDestroy) { if (ignoreDestroy && destroyRef.current) { return; } setValue(updater); } return [ value, safeSetState ]; } ; ; ; ; /** We only think `undefined` is empty */ function hasValue(value) { return value !== undefined; } function useMergedState(defaultStateValue, option) { var _ref = option || {}, defaultValue = _ref.defaultValue, value = _ref.value, onChange = _ref.onChange, postState = _ref.postState; // ======================= Init ======================= var _useState = useSafeState(function() { if (hasValue(value)) { return value; } else if (hasValue(defaultValue)) { return typeof defaultValue === 'function' ? defaultValue() : defaultValue; } else { return typeof defaultStateValue === 'function' ? defaultStateValue() : defaultStateValue; } }), _useState2 = _slicedToArray(_useState, 2), innerValue = _useState2[0], setInnerValue = _useState2[1]; var mergedValue = value !== undefined ? value : innerValue; var postMergedValue = postState ? postState(mergedValue) : mergedValue; // ====================== Change ====================== var onChangeFn = useEvent(onChange); var _useState3 = useSafeState([ mergedValue ]), _useState4 = _slicedToArray(_useState3, 2), prevValue = _useState4[0], setPrevValue = _useState4[1]; useLayoutUpdateEffect(function() { var prev = prevValue[0]; if (innerValue !== prev) { onChangeFn(innerValue, prev); } }, [ prevValue ]); // Sync value back to `undefined` when it from control to un-control useLayoutUpdateEffect(function() { if (!hasValue(value)) { setInnerValue(value); } }, [ value ]); // ====================== Update ====================== var triggerChange = useEvent(function(updater, ignoreDestroy) { setInnerValue(updater, ignoreDestroy); setPrevValue([ mergedValue ], ignoreDestroy); }); return [ postMergedValue, triggerChange ]; } // MERGED MODULE: [project]/node_modules/rc-util/es/ref.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/typeof.js [library] (ecmascript) ; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { return typeof o; } : function(o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } ; var __TURBOPACK__imported__module__571__3 = __TURBOPACK__imported__module__571__; var __TURBOPACK__imported__module__674__ = __turbopack_context__.i(674); // MERGED MODULE: [project]/node_modules/rc-util/es/hooks/useMemo.js [library] (ecmascript) ; var __TURBOPACK__imported__module__571__4 = __TURBOPACK__imported__module__571__; ; function useMemo(getValue, condition, shouldUpdate) { var cacheRef = __TURBOPACK__imported__module__571__4["useRef"]({}); if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) { cacheRef.current.value = getValue(); cacheRef.current.condition = condition; } return cacheRef.current.value; } // MERGED MODULE: [project]/node_modules/rc-util/es/React/isFragment.js [library] (ecmascript) ; ; var REACT_ELEMENT_TYPE_18 = Symbol.for('react.element'); var REACT_ELEMENT_TYPE_19 = Symbol.for('react.transitional.element'); var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); function isFragment(object) { return(// Base object type object && _typeof(object) === 'object' && (// React Element type object.$$typeof === REACT_ELEMENT_TYPE_18 || object.$$typeof === REACT_ELEMENT_TYPE_19) && // React Fragment type object.type === REACT_FRAGMENT_TYPE); } ; ; ; ; ; var ReactMajorVersion = Number(__TURBOPACK__imported__module__571__3["version"].split('.')[0]); var fillRef = function fillRef(ref, node) { if (typeof ref === 'function') { ref(node); } else if (_typeof(ref) === 'object' && ref && 'current' in ref) { ref.current = node; } }; var composeRef = function composeRef() { for(var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++){ refs[_key] = arguments[_key]; } var refList = refs.filter(Boolean); if (refList.length <= 1) { return refList[0]; } return function(node) { refs.forEach(function(ref) { fillRef(ref, node); }); }; }; var useComposeRef = function useComposeRef() { for(var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++){ refs[_key2] = arguments[_key2]; } return useMemo(function() { return composeRef.apply(void 0, refs); }, refs, function(prev, next) { return prev.length !== next.length || prev.every(function(ref, i) { return ref !== next[i]; }); }); }; var supportRef = function supportRef(nodeOrComponent) { var _type$prototype, _nodeOrComponent$prot; if (!nodeOrComponent) { return false; } // React 19 no need `forwardRef` anymore. So just pass if is a React element. if (isReactElement(nodeOrComponent) && ReactMajorVersion >= 19) { return true; } var type = (0, __TURBOPACK__imported__module__674__["isMemo"])(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; // Function component node if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== __TURBOPACK__imported__module__674__["ForwardRef"]) { return false; } // Class component if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== __TURBOPACK__imported__module__674__["ForwardRef"]) { return false; } return true; }; function isReactElement(node) { return /*#__PURE__*/ (0, __TURBOPACK__imported__module__571__3["isValidElement"])(node) && !isFragment(node); } var supportNodeRef = function supportNodeRef(node) { return isReactElement(node) && supportRef(node); }; var getNodeRef = function getNodeRef(node) { if (node && isReactElement(node)) { var ele = node; // Source from: // https://github.com/mui/material-ui/blob/master/packages/mui-utils/src/getReactNodeRef/getReactNodeRef.ts return ele.props.propertyIsEnumerable('ref') ? ele.props.ref : ele.ref; } return null; }; // MERGED MODULE: [project]/node_modules/rc-util/es/utils/get.js [library] (ecmascript) ; function get(entity, path) { var current = entity; for(var i = 0; i < path.length; i += 1){ if (current === null || current === undefined) { return undefined; } current = current[path[i]]; } return current; } // MERGED MODULE: [project]/node_modules/rc-util/es/utils/set.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/objectSpread2.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/defineProperty.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/toPrimitive.js [library] (ecmascript) ; ; function toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } ; ; ; function toPropertyKey(t) { var i = toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } ; ; function _defineProperty(e, r, t) { return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } ; ; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function(r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread2(e) { for(var r = 1; r < arguments.length; r++){ var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function(r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js [library] (ecmascript) ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js [library] (ecmascript) ; ; function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/iterableToArray.js [library] (ecmascript) ; function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } ; // MERGED MODULE: [project]/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js [library] (ecmascript) ; function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterab