@pixi/react
Version:
Write PixiJS applications using React declarative style.
1,646 lines (1,581 loc) • 1.14 MB
JavaScript
import { jsx } from 'react/jsx-runtime';
import * as o from 'react';
import { createContext, useLayoutEffect, useEffect, forwardRef, useRef, useImperativeHandle, useCallback, useContext, useMemo } from 'react';
import { Filter, Container, Graphics, Application as Application$1, TextStyle, extensions } from 'pixi.js';
(function() {
const env = {"NODE_ENV":"development"};
try {
if (process) {
process.env = Object.assign({}, process.env);
Object.assign(process.env, env);
return;
}
} catch (e) {} // avoid ReferenceError: process is not defined
globalThis.process = { env:env };
})();
const f = /* @__PURE__ */ (() => {
var e, t;
return typeof window != "undefined" && (((e = window.document) == null ? void 0 : e.createElement) || ((t = window.navigator) == null ? void 0 : t.product) === "ReactNative");
})() ? o.useLayoutEffect : o.useEffect;
function i(e, t, r) {
if (!e) return;
if (r(e) === !0) return e;
let n = t ? e.return : e.child;
for (; n; ) {
const u = i(n, t, r);
if (u) return u;
n = t ? null : n.sibling;
}
}
function l(e) {
try {
return Object.defineProperties(e, {
_currentRenderer: {
get() {
return null;
},
set() {
}
},
_currentRenderer2: {
get() {
return null;
},
set() {
}
}
});
} catch (t) {
return e;
}
}
const a = /* @__PURE__ */ l(/* @__PURE__ */ o.createContext(null));
class m extends o.Component {
render() {
return /* @__PURE__ */ o.createElement(a.Provider, { value: this._reactInternals }, this.props.children);
}
}
function c() {
const e = o.useContext(a);
if (e === null) throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");
const t = o.useId();
return o.useMemo(() => {
for (const n of [e, e == null ? void 0 : e.alternate]) {
if (!n) continue;
const u = i(n, !1, (d) => {
let s = d.memoizedState;
for (; s; ) {
if (s.memoizedState === t) return !0;
s = s.next;
}
});
if (u) return u;
}
}, [e, t]);
}
function w() {
const e = c(), t = o.useMemo(
() => i(e, !0, (r) => {
var n;
return ((n = r.stateNode) == null ? void 0 : n.containerInfo) != null;
}),
[e]
);
return t == null ? void 0 : t.stateNode.containerInfo;
}
function v(e) {
const t = c(), r = o.useRef(void 0);
return f(() => {
var n;
r.current = (n = i(
t,
!1,
(u) => typeof u.type == "string" && (e === void 0 || u.type === e)
)) == null ? void 0 : n.stateNode;
}, [t]), r;
}
function y(e) {
const t = c(), r = o.useRef(void 0);
return f(() => {
var n;
r.current = (n = i(
t,
!0,
(u) => typeof u.type == "string" && (e === void 0 || u.type === e)
)) == null ? void 0 : n.stateNode;
}, [t]), r;
}
const p = Symbol.for("react.context"), b = (e) => e !== null && typeof e == "object" && "$$typeof" in e && e.$$typeof === p;
function h() {
const e = c(), [t] = o.useState(() => /* @__PURE__ */ new Map());
t.clear();
let r = e;
for (; r; ) {
const n = r.type;
b(n) && n !== a && !t.has(n) && t.set(n, o.use(l(n))), r = r.return;
}
return t;
}
function x() {
const e = h();
return o.useMemo(
() => Array.from(e.keys()).reduce(
(t, r) => (n) => /* @__PURE__ */ o.createElement(t, null, /* @__PURE__ */ o.createElement(r.Provider, { ...n, value: e.get(r) })),
(t) => /* @__PURE__ */ o.createElement(m, { ...t })
),
[e]
);
}
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
function getDefaultExportFromNamespaceIfPresent (n) {
return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n;
}
function getDefaultExportFromNamespaceIfNotNamed (n) {
return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n;
}
function getAugmentedNamespace(n) {
if (n.__esModule) return n;
var f = n.default;
if (typeof f == "function") {
var a = function a () {
if (this instanceof a) {
return Reflect.construct(f, arguments, this.constructor);
}
return f.apply(this, arguments);
};
a.prototype = f.prototype;
} else a = {};
Object.defineProperty(a, '__esModule', {value: true});
Object.keys(n).forEach(function (k) {
var d = Object.getOwnPropertyDescriptor(n, k);
Object.defineProperty(a, k, d.get ? d : {
enumerable: true,
get: function () {
return n[k];
}
});
});
return a;
}
var constants$2 = {exports: {}};
var reactReconcilerConstants_production = {};
var hasRequiredReactReconcilerConstants_production;
function requireReactReconcilerConstants_production () {
if (hasRequiredReactReconcilerConstants_production) return reactReconcilerConstants_production;
hasRequiredReactReconcilerConstants_production = 1;
"use strict";
reactReconcilerConstants_production.ConcurrentRoot = 1;
reactReconcilerConstants_production.ContinuousEventPriority = 8;
reactReconcilerConstants_production.DefaultEventPriority = 32;
reactReconcilerConstants_production.DiscreteEventPriority = 2;
reactReconcilerConstants_production.IdleEventPriority = 268435456;
reactReconcilerConstants_production.LegacyRoot = 0;
reactReconcilerConstants_production.NoEventPriority = 0;
return reactReconcilerConstants_production;
}
var reactReconcilerConstants_development = {};
var hasRequiredReactReconcilerConstants_development;
function requireReactReconcilerConstants_development () {
if (hasRequiredReactReconcilerConstants_development) return reactReconcilerConstants_development;
hasRequiredReactReconcilerConstants_development = 1;
"use strict";
"production" !== process.env.NODE_ENV &&
((reactReconcilerConstants_development.ConcurrentRoot = 1),
(reactReconcilerConstants_development.ContinuousEventPriority = 8),
(reactReconcilerConstants_development.DefaultEventPriority = 32),
(reactReconcilerConstants_development.DiscreteEventPriority = 2),
(reactReconcilerConstants_development.IdleEventPriority = 268435456),
(reactReconcilerConstants_development.LegacyRoot = 0),
(reactReconcilerConstants_development.NoEventPriority = 0));
return reactReconcilerConstants_development;
}
var constants = constants$2.exports;
'use strict';
if (process.env.NODE_ENV === 'production') {
constants$2.exports = requireReactReconcilerConstants_production();
} else {
constants$2.exports = requireReactReconcilerConstants_development();
}
var constantsExports = constants$2.exports;
var constants$1 = /*@__PURE__*/getDefaultExportFromCjs(constantsExports);
"use strict";
const Context = createContext({});
const ContextProvider = Context.Provider;
const ContextConsumer = Context.Consumer;
"use strict";
function isReadOnlyProperty(objectInstance, propertyKey) {
const prototype = Object.getPrototypeOf(objectInstance);
const propertyDescriptor = Object.getOwnPropertyDescriptor(prototype, propertyKey);
return !(typeof propertyDescriptor === "undefined" || propertyDescriptor.writable || propertyDescriptor.set);
}
"use strict";
const store = {
currentUpdatePriority: constantsExports.DefaultEventPriority,
debug: false,
unmountQueue: /* @__PURE__ */ new Set()
};
"use strict";
function log(logType, ...args) {
if (!store.debug) {
return;
}
const logMethod = console[logType];
if (!(logMethod instanceof Function)) {
console.warn(`Attempted to create an invalid log type: "${logType}"`);
return;
}
logMethod("@pixi/react", ...args);
}
"use strict";
function prepareInstance(component, state = {}) {
const instance = component;
instance.__pixireact = Object.assign({
filters: [],
parent: null,
root: null,
type: ""
}, state);
return instance;
}
var name = "@pixi/react";
var version = "0.0.0-development";
var description = "Write PixiJS applications using React declarative style.";
var keywords = [
"react",
"pixi"
];
var homepage = "https://github.com/pixijs/pixi-react#readme";
var bugs = {
url: "https://github.com/pixijs/pixi-react/issues"
};
var repository = {
type: "git",
url: "git+https://github.com/pixijs/pixi-react.git"
};
var license = "MIT";
var exports = {
".": {
"import": {
types: "./types/index.d.ts",
"default": "./lib/index.mjs"
},
require: {
types: "./types/index.d.ts",
"default": "./lib/index.js"
}
}
};
var main = "lib/index.js";
var module = "lib/index.mjs";
var types = "types/index.d.ts";
var files = [
"lib",
"dist",
"types"
];
var workspaces = [
"docs"
];
var scripts = {
build: "rimraf dist lib types && rollup -c && tsc",
"build:docs": "npm run --workspace docs build",
deploy: "npm run deploy --workspace docs",
"start:docs": "npm run --workspace docs start",
clean: "xs clean",
docs: "xs docs",
lint: "xs lint",
"lint:fix": "xs lint --fix",
prepare: "husky install",
prerelease: "npm run test:lint && npm run build",
release: "xs bump,publish,git-push",
test: "tsc --project tsconfig.test.json && vitest run",
"test:e2e": "tsc --project tsconfig.test.json && vitest run e2e",
"test:unit": "tsc --project tsconfig.test.json && vitest run unit",
"test:lint": "xs lint",
"test:watch": "vitest",
"test:types": "tsc --noEmit --emitDeclarationOnly false"
};
var husky = {
hooks: {
"pre-commit": "lint-staged"
}
};
var dependencies = {
"its-fine": "^2.0.0",
"react-reconciler": "0.31.0"
};
var devDependencies = {
"@pixi/extension-scripts": "^4.0.0",
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^19.0.0",
"@types/react-reconciler": "^0.28.9",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/browser": "^2.0.4",
"eslint-plugin-react-hooks": "^5.2.0",
husky: "^8.0.0",
jsdom: "^25.0.0",
"pixi.js": "8.2.6",
playwright: "^1.45.3",
react: "^19.0.0",
"react-dom": "^19.0.0",
rollup: "^4.18.0",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-inject-process-env": "^1.3.1",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-sourcemaps": "^0.6.3",
typescript: "^5.4.5",
vitest: "^2.0.0"
};
var peerDependencies = {
"pixi.js": "^8.2.6",
react: ">=19.0.0"
};
var overrides = {
rollup: "^4.18.0"
};
var publishConfig = {
access: "public"
};
var extensionConfig = {
lint: [
"test",
"src",
"docs"
],
environments: [
"node"
],
docsName: "PixiJS React",
docsTitle: "PixiJS React API Documentation",
docsDescription: "Documentation for PixiJS React library",
docsKeyword: "docs, documentation, pixi, pixijs, react, html5, javascript, jsdoc"
};
var packageData = {
name: name,
version: version,
description: description,
keywords: keywords,
homepage: homepage,
bugs: bugs,
repository: repository,
license: license,
exports: exports,
main: main,
module: module,
types: types,
files: files,
workspaces: workspaces,
scripts: scripts,
husky: husky,
"lint-staged": {
"*.{ts,js,mjs}": [
"eslint --cache --fix --max-warnings 0"
]
},
dependencies: dependencies,
devDependencies: devDependencies,
peerDependencies: peerDependencies,
overrides: overrides,
publishConfig: publishConfig,
extensionConfig: extensionConfig
};
"use strict";
function afterActiveInstanceBlur() {
log("info", "lifecycle::afterActiveInstanceBlur");
}
"use strict";
function attach(parentInstance, childInstance, targetIndex) {
if (childInstance instanceof Filter) {
childInstance.__pixireact.parent = parentInstance;
if (typeof targetIndex === "number") {
parentInstance.__pixireact.filters.splice(targetIndex, 0, childInstance);
} else {
parentInstance.__pixireact.filters.push(childInstance);
}
parentInstance.filters = parentInstance.__pixireact.filters;
}
}
"use strict";
function appendChild(parentNode, childNode) {
log("info", "lifecycle::appendChild");
if (!childNode) {
return;
}
if (childNode instanceof Container) {
parentNode.addChild(childNode);
} else if (childNode instanceof Filter) {
attach(parentNode, childNode);
}
}
"use strict";
function beforeActiveInstanceBlur() {
log("info", "lifecycle::beforeActiveInstanceBlur");
}
"use strict";
function clearContainer() {
log("info", "lifecycle::clearContainer");
return false;
}
"use strict";
const PixiToReactEventPropNames = Object.freeze({
onclick: "onClick",
onglobalmousemove: "onGlobalMouseMove",
onglobalpointermove: "onGlobalPointerMove",
onglobaltouchmove: "onGlobalTouchMove",
onmousedown: "onMouseDown",
onmouseenter: "onMouseEnter",
onmouseleave: "onMouseLeave",
onmousemove: "onMouseMove",
onmouseout: "onMouseOut",
onmouseover: "onMouseOver",
onmouseup: "onMouseUp",
onmouseupoutside: "onMouseUpOutside",
onpointercancel: "onPointerCancel",
onpointerdown: "onPointerDown",
onpointerenter: "onPointerEnter",
onpointerleave: "onPointerLeave",
onpointermove: "onPointerMove",
onpointerout: "onPointerOut",
onpointerover: "onPointerOver",
onpointertap: "onPointerTap",
onpointerup: "onPointerUp",
onpointerupoutside: "onPointerUpOutside",
onrightclick: "onRightClick",
onrightdown: "onRightDown",
onrightup: "onRightUp",
onrightupoutside: "onRightUpOutside",
ontap: "onTap",
ontouchcancel: "onTouchCancel",
ontouchend: "onTouchEnd",
ontouchendoutside: "onTouchEndOutside",
ontouchmove: "onTouchMove",
ontouchstart: "onTouchStart",
onwheel: "onWheel"
});
const ReactToPixiEventPropNames = Object.freeze({
onClick: "onclick",
onGlobalMouseMove: "onglobalmousemove",
onGlobalPointerMove: "onglobalpointermove",
onGlobalTouchMove: "onglobaltouchmove",
onMouseDown: "onmousedown",
onMouseEnter: "onmouseenter",
onMouseLeave: "onmouseleave",
onMouseMove: "onmousemove",
onMouseOut: "onmouseout",
onMouseOver: "onmouseover",
onMouseUp: "onmouseup",
onMouseUpOutside: "onmouseupoutside",
onPointerCancel: "onpointercancel",
onPointerDown: "onpointerdown",
onPointerEnter: "onpointerenter",
onPointerLeave: "onpointerleave",
onPointerMove: "onpointermove",
onPointerOut: "onpointerout",
onPointerOver: "onpointerover",
onPointerTap: "onpointertap",
onPointerUp: "onpointerup",
onPointerUpOutside: "onpointerupoutside",
onRightClick: "onrightclick",
onRightDown: "onrightdown",
onRightUp: "onrightup",
onRightUpOutside: "onrightupoutside",
onTap: "ontap",
onTouchCancel: "ontouchcancel",
onTouchEnd: "ontouchend",
onTouchEndOutside: "ontouchendoutside",
onTouchMove: "ontouchmove",
onTouchStart: "ontouchstart",
onWheel: "onwheel"
});
"use strict";
function isArray(input) {
return Array.isArray(input);
}
function isBoolean(input) {
return typeof input === "boolean";
}
function isEqual(inputA, inputB, options = {
arrays: "reference",
objects: "reference",
strict: true
}) {
const {
arrays,
objects,
strict
} = options;
if (typeof inputA !== typeof inputB || !!inputA !== !!inputB) {
return false;
}
if (isString(inputA) || isNumber(inputA)) {
return inputA === inputB;
}
const isInputAAnObject = isObject(inputA);
if (isInputAAnObject && objects === "reference") {
return inputA === inputB;
}
const isInputAAnArray = isArray(inputA);
if (isInputAAnArray && arrays === "reference") {
return inputA === inputB;
}
if ((isInputAAnArray || isInputAAnObject) && inputA === inputB) {
return true;
}
let key;
for (key in inputA) {
if (!(key in inputB)) {
return false;
}
}
let input = inputA;
if (strict) {
input = inputB;
}
if (isInputAAnObject && arrays === "shallow" && objects === "shallow") {
for (key in input) {
const equalityCheckResult = isEqual(inputA[key], inputB[key], {
strict,
objects: "reference"
});
if (!equalityCheckResult) {
return false;
}
}
} else {
for (key in input) {
if (inputA[key] !== inputB[key]) {
return false;
}
}
}
if (isUndefined(key)) {
if (isInputAAnArray && inputA.length === 0 && inputB.length === 0) {
return true;
}
if (isInputAAnObject && Object.keys(inputA).length === 0 && Object.keys(inputB).length === 0) {
return true;
}
if (inputA !== inputB) {
return false;
}
}
return true;
}
function isFunction(input) {
return typeof input === "function";
}
function isNull(input) {
return input === null;
}
function isNumber(input) {
return typeof input === "number";
}
function isObject(input) {
if (input !== Object(input)) {
return false;
}
if (isArray(input)) {
return false;
}
if (typeof input === "function") {
return false;
}
return true;
}
function isString(input) {
return typeof input === "string";
}
function isUndefined(input) {
return input === void 0;
}
"use strict";
const ReactIgnoredProps = Object.freeze([
"children",
"key",
"ref"
]);
"use strict";
function gentleClone(object, ignoredKeys = []) {
const cloneBase = {};
return Object.entries(object).reduce((accumulator, [key, value]) => {
if (!ignoredKeys.includes(key)) {
accumulator[key] = value;
}
return accumulator;
}, cloneBase);
}
"use strict";
function gentleCloneProps(props, additionalIgnoredProps = []) {
return gentleClone(props, ReactIgnoredProps.concat(additionalIgnoredProps));
}
"use strict";
const DEFAULT$1 = "__default";
function diffProps(newProps, oldProps = {}, remove = false) {
const newPropsRest = gentleCloneProps(newProps);
const oldPropsRest = gentleCloneProps(oldProps);
const entries = Object.entries(newPropsRest);
const changes = [];
if (remove) {
const oldPropsKeys = Object.keys(oldPropsRest);
let propIndex = 0;
while (propIndex < oldPropsKeys.length) {
const propKey = oldPropsKeys[propIndex];
const isPropRemoved = !(propKey in newPropsRest);
if (isPropRemoved) {
entries.unshift([propKey, `${DEFAULT$1}remove`]);
}
propIndex += 1;
}
}
entries.forEach(([key, value]) => {
if (isEqual(value, oldPropsRest[key])) {
return;
}
if (key in ReactToPixiEventPropNames) {
changes.push([key, value, true, []]);
return;
}
let entries2 = [];
if (key.includes("-")) {
entries2 = key.split("-");
}
changes.push([key, value, false, entries2]);
for (const prop in newPropsRest) {
const value2 = newPropsRest[prop];
if (prop.startsWith(`${key}-`)) {
changes.push([prop, value2, false, prop.split("-")]);
}
}
});
return { changes };
}
"use strict";
function isDiffSet(input) {
const inputAsDiffSet = input;
if (!inputAsDiffSet) {
return false;
}
if (!inputAsDiffSet.changes) {
return false;
}
return true;
}
"use strict";
const DEFAULT = "__default";
const DEFAULTS_CONTAINERS = /* @__PURE__ */ new Map();
const PIXI_EVENT_PROP_NAME_ERROR_HAS_BEEN_SHOWN = {};
function targetKeyReducer(accumulator, key) {
if (accumulator) {
const value = accumulator[key];
if (!isUndefined(value) && !isNull(value)) {
return value;
}
}
return accumulator;
}
function applyProps(instance, data) {
const {
__pixireact: instanceState = {},
...instanceProps
} = instance;
let typedData;
if (isDiffSet(data)) {
typedData = data;
} else {
typedData = diffProps(data, instanceProps);
}
const { changes } = typedData;
let changeIndex = 0;
while (changeIndex < changes.length) {
const change = changes[changeIndex];
let hasError = false;
let key = change[0];
let value = change[1];
const isEvent = change[2];
const keys = change[3];
let currentInstance = instance;
let targetProp = currentInstance[key];
if (key === "draw" && typeof value === "function") {
if (instance instanceof Graphics) {
value(instance);
} else {
hasError = true;
log("warn", `The \`draw\` prop was used on a \`${instanceState.type}\` component, but it's only valid on \`graphics\` components.`);
}
}
if (key in PixiToReactEventPropNames) {
const typedKey = key;
hasError = true;
if (!PIXI_EVENT_PROP_NAME_ERROR_HAS_BEEN_SHOWN[key]) {
PIXI_EVENT_PROP_NAME_ERROR_HAS_BEEN_SHOWN[key] = true;
log("warn", `Event names must be pascal case; instead of \`${key}\`, you probably want \`${PixiToReactEventPropNames[typedKey]}\`.`);
}
}
if (!hasError) {
if (keys.length) {
targetProp = keys.reduce(targetKeyReducer, currentInstance);
if (!(targetProp && targetProp.set)) {
const [name, ...reverseEntries] = keys.reverse();
currentInstance = reverseEntries.reverse().reduce(targetKeyReducer, currentInstance);
key = name;
}
}
if (value === `${DEFAULT}remove`) {
if (currentInstance instanceof Container) {
let ctor = DEFAULTS_CONTAINERS.get(currentInstance.constructor);
if (!ctor) {
ctor = currentInstance.constructor;
ctor = new ctor();
DEFAULTS_CONTAINERS.set(currentInstance.constructor, ctor);
}
value = ctor[key];
} else {
value = 0;
}
}
if (isEvent && instanceState) {
const typedKey = key;
const pixiKey = ReactToPixiEventPropNames[typedKey];
if (value) {
currentInstance[pixiKey] = value;
} else {
delete currentInstance[pixiKey];
}
} else if (!isReadOnlyProperty(currentInstance, key)) {
currentInstance[key] = value;
}
}
changeIndex += 1;
}
return instance;
}
"use strict";
function prepareUpdate(_instance, _type, oldProps, newProps) {
log("info", "lifecycle::prepareUpdate");
const {
children: newChildren,
...newPropsRest
} = newProps;
const {
children: oldChildren,
...oldPropsRest
} = oldProps;
const diff = diffProps(newPropsRest, oldPropsRest, true);
if (diff.changes.length) {
return diff;
}
return null;
}
"use strict";
function commitUpdate(instance, type, oldProps, newProps) {
log("info", "lifecycle::commitUpdate");
const diff = prepareUpdate(
instance,
type,
oldProps,
newProps
);
if (diff) {
applyProps(instance, diff);
}
}
"use strict";
const PixiReactIgnoredProps = Object.freeze([
...Object.keys(PixiToReactEventPropNames),
"draw"
]);
"use strict";
const catalogue = {};
"use strict";
function convertStringToPascalCase(string) {
const firstChar = string.charAt(0);
const rest = string.substring(1);
return `${firstChar.toUpperCase()}${rest}`;
}
"use strict";
function lowercaseFirstCharacter(_fullMatch, firstCharacter) {
return firstCharacter.toLowerCase();
}
function parseComponentType(type) {
let parsedType = type;
if (type.startsWith("pixi")) {
parsedType = type.replace(/^pixi([A-Z])/, lowercaseFirstCharacter);
}
return parsedType;
}
"use strict";
function createInstance(type, props, root) {
log("info", "lifecycle::createInstance");
const parsedType = parseComponentType(type);
const name = convertStringToPascalCase(parsedType);
if (!(name in catalogue)) {
throw new Error(`${name} is not part of the PIXI namespace! Did you forget to extend?`);
}
const PixiComponent = catalogue[name];
const pixiProps = gentleCloneProps(props, PixiReactIgnoredProps);
Object.entries(props).forEach(([key, value]) => {
if (key in ReactToPixiEventPropNames) {
const pixiEventName = ReactToPixiEventPropNames[key];
pixiProps[pixiEventName] = value;
}
});
const instance = prepareInstance(new PixiComponent(pixiProps), {
root,
type: parsedType
});
applyProps(instance, props);
return instance;
}
var reactReconciler$1 = {exports: {}};
var reactReconciler_production$1 = {exports: {}};
var require$$0 = /*@__PURE__*/getAugmentedNamespace(o);
var scheduler$1 = {exports: {}};
var scheduler_production = {};
var hasRequiredScheduler_production;
function requireScheduler_production () {
if (hasRequiredScheduler_production) return scheduler_production;
hasRequiredScheduler_production = 1;
(function (exports) {
"use strict";
function push(heap, node) {
var index = heap.length;
heap.push(node);
a: for (; 0 < index; ) {
var parentIndex = (index - 1) >>> 1,
parent = heap[parentIndex];
if (0 < compare(parent, node))
(heap[parentIndex] = node), (heap[index] = parent), (index = parentIndex);
else break a;
}
}
function peek(heap) {
return 0 === heap.length ? null : heap[0];
}
function pop(heap) {
if (0 === heap.length) return null;
var first = heap[0],
last = heap.pop();
if (last !== first) {
heap[0] = last;
a: for (
var index = 0, length = heap.length, halfLength = length >>> 1;
index < halfLength;
) {
var leftIndex = 2 * (index + 1) - 1,
left = heap[leftIndex],
rightIndex = leftIndex + 1,
right = heap[rightIndex];
if (0 > compare(left, last))
rightIndex < length && 0 > compare(right, left)
? ((heap[index] = right),
(heap[rightIndex] = last),
(index = rightIndex))
: ((heap[index] = left),
(heap[leftIndex] = last),
(index = leftIndex));
else if (rightIndex < length && 0 > compare(right, last))
(heap[index] = right), (heap[rightIndex] = last), (index = rightIndex);
else break a;
}
}
return first;
}
function compare(a, b) {
var diff = a.sortIndex - b.sortIndex;
return 0 !== diff ? diff : a.id - b.id;
}
exports.unstable_now = void 0;
if ("object" === typeof performance && "function" === typeof performance.now) {
var localPerformance = performance;
exports.unstable_now = function () {
return localPerformance.now();
};
} else {
var localDate = Date,
initialTime = localDate.now();
exports.unstable_now = function () {
return localDate.now() - initialTime;
};
}
var taskQueue = [],
timerQueue = [],
taskIdCounter = 1,
currentTask = null,
currentPriorityLevel = 3,
isPerformingWork = !1,
isHostCallbackScheduled = !1,
isHostTimeoutScheduled = !1,
localSetTimeout = "function" === typeof setTimeout ? setTimeout : null,
localClearTimeout = "function" === typeof clearTimeout ? clearTimeout : null,
localSetImmediate = "undefined" !== typeof setImmediate ? setImmediate : null;
function advanceTimers(currentTime) {
for (var timer = peek(timerQueue); null !== timer; ) {
if (null === timer.callback) pop(timerQueue);
else if (timer.startTime <= currentTime)
pop(timerQueue),
(timer.sortIndex = timer.expirationTime),
push(taskQueue, timer);
else break;
timer = peek(timerQueue);
}
}
function handleTimeout(currentTime) {
isHostTimeoutScheduled = !1;
advanceTimers(currentTime);
if (!isHostCallbackScheduled)
if (null !== peek(taskQueue))
(isHostCallbackScheduled = !0), requestHostCallback();
else {
var firstTimer = peek(timerQueue);
null !== firstTimer &&
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
}
}
var isMessageLoopRunning = !1,
taskTimeoutID = -1,
frameInterval = 5,
startTime = -1;
function shouldYieldToHost() {
return exports.unstable_now() - startTime < frameInterval ? !1 : !0;
}
function performWorkUntilDeadline() {
if (isMessageLoopRunning) {
var currentTime = exports.unstable_now();
startTime = currentTime;
var hasMoreWork = !0;
try {
a: {
isHostCallbackScheduled = !1;
isHostTimeoutScheduled &&
((isHostTimeoutScheduled = !1),
localClearTimeout(taskTimeoutID),
(taskTimeoutID = -1));
isPerformingWork = !0;
var previousPriorityLevel = currentPriorityLevel;
try {
b: {
advanceTimers(currentTime);
for (
currentTask = peek(taskQueue);
null !== currentTask &&
!(
currentTask.expirationTime > currentTime && shouldYieldToHost()
);
) {
var callback = currentTask.callback;
if ("function" === typeof callback) {
currentTask.callback = null;
currentPriorityLevel = currentTask.priorityLevel;
var continuationCallback = callback(
currentTask.expirationTime <= currentTime
);
currentTime = exports.unstable_now();
if ("function" === typeof continuationCallback) {
currentTask.callback = continuationCallback;
advanceTimers(currentTime);
hasMoreWork = !0;
break b;
}
currentTask === peek(taskQueue) && pop(taskQueue);
advanceTimers(currentTime);
} else pop(taskQueue);
currentTask = peek(taskQueue);
}
if (null !== currentTask) hasMoreWork = !0;
else {
var firstTimer = peek(timerQueue);
null !== firstTimer &&
requestHostTimeout(
handleTimeout,
firstTimer.startTime - currentTime
);
hasMoreWork = !1;
}
}
break a;
} finally {
(currentTask = null),
(currentPriorityLevel = previousPriorityLevel),
(isPerformingWork = !1);
}
hasMoreWork = void 0;
}
} finally {
hasMoreWork
? schedulePerformWorkUntilDeadline()
: (isMessageLoopRunning = !1);
}
}
}
var schedulePerformWorkUntilDeadline;
if ("function" === typeof localSetImmediate)
schedulePerformWorkUntilDeadline = function () {
localSetImmediate(performWorkUntilDeadline);
};
else if ("undefined" !== typeof MessageChannel) {
var channel = new MessageChannel(),
port = channel.port2;
channel.port1.onmessage = performWorkUntilDeadline;
schedulePerformWorkUntilDeadline = function () {
port.postMessage(null);
};
} else
schedulePerformWorkUntilDeadline = function () {
localSetTimeout(performWorkUntilDeadline, 0);
};
function requestHostCallback() {
isMessageLoopRunning ||
((isMessageLoopRunning = !0), schedulePerformWorkUntilDeadline());
}
function requestHostTimeout(callback, ms) {
taskTimeoutID = localSetTimeout(function () {
callback(exports.unstable_now());
}, ms);
}
exports.unstable_IdlePriority = 5;
exports.unstable_ImmediatePriority = 1;
exports.unstable_LowPriority = 4;
exports.unstable_NormalPriority = 3;
exports.unstable_Profiling = null;
exports.unstable_UserBlockingPriority = 2;
exports.unstable_cancelCallback = function (task) {
task.callback = null;
};
exports.unstable_continueExecution = function () {
isHostCallbackScheduled ||
isPerformingWork ||
((isHostCallbackScheduled = !0), requestHostCallback());
};
exports.unstable_forceFrameRate = function (fps) {
0 > fps || 125 < fps
? console.error(
"forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"
)
: (frameInterval = 0 < fps ? Math.floor(1e3 / fps) : 5);
};
exports.unstable_getCurrentPriorityLevel = function () {
return currentPriorityLevel;
};
exports.unstable_getFirstCallbackNode = function () {
return peek(taskQueue);
};
exports.unstable_next = function (eventHandler) {
switch (currentPriorityLevel) {
case 1:
case 2:
case 3:
var priorityLevel = 3;
break;
default:
priorityLevel = currentPriorityLevel;
}
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = priorityLevel;
try {
return eventHandler();
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
exports.unstable_pauseExecution = function () {};
exports.unstable_requestPaint = function () {};
exports.unstable_runWithPriority = function (priorityLevel, eventHandler) {
switch (priorityLevel) {
case 1:
case 2:
case 3:
case 4:
case 5:
break;
default:
priorityLevel = 3;
}
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = priorityLevel;
try {
return eventHandler();
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
exports.unstable_scheduleCallback = function (
priorityLevel,
callback,
options
) {
var currentTime = exports.unstable_now();
"object" === typeof options && null !== options
? ((options = options.delay),
(options =
"number" === typeof options && 0 < options
? currentTime + options
: currentTime))
: (options = currentTime);
switch (priorityLevel) {
case 1:
var timeout = -1;
break;
case 2:
timeout = 250;
break;
case 5:
timeout = 1073741823;
break;
case 4:
timeout = 1e4;
break;
default:
timeout = 5e3;
}
timeout = options + timeout;
priorityLevel = {
id: taskIdCounter++,
callback: callback,
priorityLevel: priorityLevel,
startTime: options,
expirationTime: timeout,
sortIndex: -1
};
options > currentTime
? ((priorityLevel.sortIndex = options),
push(timerQueue, priorityLevel),
null === peek(taskQueue) &&
priorityLevel === peek(timerQueue) &&
(isHostTimeoutScheduled
? (localClearTimeout(taskTimeoutID), (taskTimeoutID = -1))
: (isHostTimeoutScheduled = !0),
requestHostTimeout(handleTimeout, options - currentTime)))
: ((priorityLevel.sortIndex = timeout),
push(taskQueue, priorityLevel),
isHostCallbackScheduled ||
isPerformingWork ||
((isHostCallbackScheduled = !0), requestHostCallback()));
return priorityLevel;
};
exports.unstable_shouldYield = shouldYieldToHost;
exports.unstable_wrapCallback = function (callback) {
var parentPriorityLevel = currentPriorityLevel;
return function () {
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = parentPriorityLevel;
try {
return callback.apply(this, arguments);
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
};
} (scheduler_production));
return scheduler_production;
}
var scheduler_development = {};
var hasRequiredScheduler_development;
function requireScheduler_development () {
if (hasRequiredScheduler_development) return scheduler_development;
hasRequiredScheduler_development = 1;
(function (exports) {
"use strict";
"production" !== process.env.NODE_ENV &&
(function () {
function performWorkUntilDeadline() {
if (isMessageLoopRunning) {
var currentTime = exports.unstable_now();
startTime = currentTime;
var hasMoreWork = !0;
try {
a: {
isHostCallbackScheduled = !1;
isHostTimeoutScheduled &&
((isHostTimeoutScheduled = !1),
localClearTimeout(taskTimeoutID),
(taskTimeoutID = -1));
isPerformingWork = !0;
var previousPriorityLevel = currentPriorityLevel;
try {
b: {
advanceTimers(currentTime);
for (
currentTask = peek(taskQueue);
null !== currentTask &&
!(
currentTask.expirationTime > currentTime &&
shouldYieldToHost()
);
) {
var callback = currentTask.callback;
if ("function" === typeof callback) {
currentTask.callback = null;
currentPriorityLevel = currentTask.priorityLevel;
var continuationCallback = callback(
currentTask.expirationTime <= currentTime
);
currentTime = exports.unstable_now();
if ("function" === typeof continuationCallback) {
currentTask.callback = continuationCallback;
advanceTimers(currentTime);
hasMoreWork = !0;
break b;
}
currentTask === peek(taskQueue) && pop(taskQueue);
advanceTimers(currentTime);
} else pop(taskQueue);
currentTask = peek(taskQueue);
}
if (null !== currentTask) hasMoreWork = !0;
else {
var firstTimer = peek(timerQueue);
null !== firstTimer &&
requestHostTimeout(
handleTimeout,
firstTimer.startTime - currentTime
);
hasMoreWork = !1;
}
}
break a;
} finally {
(currentTask = null),
(currentPriorityLevel = previousPriorityLevel),
(isPerformingWork = !1);
}
hasMoreWork = void 0;
}
} finally {
hasMoreWork
? schedulePerformWorkUntilDeadline()
: (isMessageLoopRunning = !1);
}
}
}
function push(heap, node) {
var index = heap.length;
heap.push(node);
a: for (; 0 < index; ) {
var parentIndex = (index - 1) >>> 1,
parent = heap[parentIndex];
if (0 < compare(parent, node))
(heap[parentIndex] = node),
(heap[index] = parent),
(index = parentIndex);
else break a;
}
}
function peek(heap) {
return 0 === heap.length ? null : heap[0];
}
function pop(heap) {
if (0 === heap.length) return null;
var first = heap[0],
last = heap.pop();
if (last !== first) {
heap[0] = last;
a: for (
var index = 0, length = heap.length, halfLength = length >>> 1;
index < halfLength;
) {
var leftIndex = 2 * (index + 1) - 1,
left = heap[leftIndex],
rightIndex = leftIndex + 1,
right = heap[rightIndex];
if (0 > compare(left, last))
rightIndex < length && 0 > compare(right, left)
? ((heap[index] = right),
(heap[rightIndex] = last),
(index = rightIndex))
: ((heap[index] = left),
(heap[leftIndex] = last),
(index = leftIndex));
else if (rightIndex < length && 0 > compare(right, last))
(heap[index] = right),
(heap[rightIndex] = last),
(index = rightIndex);
else break a;
}
}
return first;
}
function compare(a, b) {
var diff = a.sortIndex - b.sortIndex;
return 0 !== diff ? diff : a.id - b.id;
}
function advanceTimers(currentTime) {
for (var timer = peek(timerQueue); null !== timer; ) {
if (null === timer.callback) pop(timerQueue);
else if (timer.startTime <= currentTime)
pop(timerQueue),
(timer.sortIndex = timer.expirationTime),
push(taskQueue, timer);
else break;
timer = peek(timerQueue);
}
}
function handleTimeout(currentTime) {
isHostTimeoutScheduled = !1;
advanceTimers(currentTime);
if (!isHostCallbackScheduled)
if (null !== peek(taskQueue))
(isHostCallbackScheduled = !0), requestHostCallback();
else {
var firstTimer = peek(timerQueue);
null !== firstTimer &&
requestHostTimeout(
handleTimeout,
firstTimer.startTime - currentTime
);
}
}
function shouldYieldToHost() {
return exports.unstable_now() - startTime < frameInterval ? !1 : !0;
}
function requestHostCallback() {
isMessageLoopRunning ||
((isMessageLoopRunning = !0), schedulePerformWorkUntilDeadline());
}
function requestHostTimeout(callback, ms) {
taskTimeoutID = localSetTimeout(function () {
callback(exports.unstable_now());
}, ms);
}
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
exports.unstable_now = void 0;
if (
"object" === typeof performance &&
"function" === typeof performance.now
) {
var localPerformance = performance;
exports.unstable_now = function () {
return localPerformance.now();
};
} else {
var localDate = Date,
initialTime = localDate.now();
exports.unstable_now = function () {
return localDate.now() - initialTime;
};
}
var taskQueue = [],
timerQueue = [],
taskIdCounter = 1,
currentTask = null,
currentPriorityLevel = 3,
isPerformingWork = !1,
isHostCallbackScheduled = !1,
isHostTimeoutScheduled = !1,
localSetTimeout = "function" === typeof setTimeout ? setTimeout : null,
localClearTimeout =
"function" === typeof clearTimeout ? clearTimeout : null,
localSetImmediate =
"undefined" !== typeof setImmediate ? setImmediate : null,
isMessageLoopRunning = !1,
taskTimeoutID = -1,
frameInterval = 5,
startTime = -1;
if ("function" === typeof localSetImmediate)
var schedulePerformWorkUntilDeadline = function () {
localSetImmediate(performWorkUntilDeadline);
};
else if ("undefined" !== typeof MessageChannel) {
var channel = new MessageChannel(),
port = channel.port2;
channel.port1.onmessage = performWorkUntilDeadline;
schedulePerformWorkUntilDeadline = function () {
port.postMessage(null);
};
} else
schedulePerformWorkUntilDeadline = function () {
localSetTimeout(performWorkUntilDeadline, 0);
};
exports.unstable_IdlePriority = 5;
exports.unstable_ImmediatePriority = 1;
exports.unstable_LowPriority = 4;
exports.unstable_NormalPriority = 3;
exports.unstable_Profiling = null;
exports.unstable_UserBlockingPriority = 2;
exports.unstable_cancelCallback = function (task) {
task.callback = null;
};
exports.unstable_continueExecution = function () {
isHostCallbackScheduled ||
isPerformingWork ||
((isHostCallbackScheduled = !0), requestHostCallback());
};
exports.unstable_forceFrameRate = function (fps) {
0 > fps || 125 < fps
? console.error(
"forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"
)
: (frameInterval = 0 < fps ? Math.floor(1e3 / fps) : 5);
};
exports.unstable_getCurrentPriorityLevel = function () {
return currentPriorityLevel;
};
exports.unstable_getFirstCallbackNode = function () {
return peek(taskQueue);
};
exports.unstable_next = function (eventHandler) {
switch (currentPriorityLevel) {
case 1:
case 2:
case 3:
var priorityLevel = 3;
break;
default:
priorityLevel = currentPriorityLevel;
}
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = priorityLevel;
try {
return eventHandler();
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
exports.unstable_pauseExecution = function () {};
exports.unstable_requestPaint = function () {};
exports.unstable_runWithPriority = function (priorityLevel, eventHandler) {
switch (priorityLevel) {
case 1:
case 2:
case 3:
case 4:
case 5:
break;
default:
priorityLevel = 3;
}
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = priorityLevel;
try {
return eventHandler();
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
exports.unstable_scheduleCallback = function (
priorityLevel,
callback,
options
) {
var currentTime = exports.unstable_now();
"object" === typeof options && null !== options
? ((options = options.delay),
(options =
"number" === typeof options && 0 < options
? currentTime + options
: currentTime))
: (options = currentTime);
switch (priorityLevel) {
case 1:
var timeout = -1;
break;
case 2:
timeout = 250;
break;
case 5:
timeout = 1073741823;
break;
case 4:
timeout = 1e4;
break;
default:
timeout = 5e3;
}
timeout = options + timeout;
priorityLevel = {
id: taskIdCounter++,
callback: callback,
priorityLevel: priorityLevel,
startTime: options,
expirationTime: timeout,
sortIndex: -1
};
options > currentTime
? ((priorityLevel.sortIndex = options),
push(timerQueue, priorityLevel),
null === peek(taskQueue) &&
priorityLevel === peek(timerQueue) &&
(isHostTimeoutScheduled
? (localClearTimeout(taskTimeoutID), (taskTimeoutID = -1))
: (isHostTimeoutScheduled = !0),
requestHostTimeout(handleTimeout, options - currentTime)))
: ((priorityLevel.sortIndex = timeout),
push(taskQueue, priorityLevel),
isHostCallbackScheduled ||
isPerformingWork ||
((isHostCallbackScheduled = !0), requestHostCallback()));
return priorityLevel;
};
exports.unstable_shouldYield = shouldYieldToHost;
exports.unstable_wrapCallback = function (callback) {
var parentPriorityLevel = currentPriorityLevel;
return function () {
var previousPriorityLevel = currentPriorityLevel;
currentPriorityLevel = parentPriorityLevel;
try {
return callback.apply(this, arguments);
} finally {
currentPriorityLevel = previousPriorityLevel;
}
};
};
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
})();
} (scheduler_development));
return scheduler_development;
}
var scheduler = scheduler$1.exports;
var hasRequiredScheduler;
function requireScheduler () {
if (hasRequiredScheduler) return scheduler$1.exports;
hasRequiredScheduler = 1;
'use strict';
if (process.env.NODE_ENV === 'production') {
scheduler$1.exports = requireScheduler_production();
} else {
scheduler$1.exports = requireScheduler_development();
}
return scheduler$1.exports;
}
var reactReconciler_production = reactReconciler_production$1.exports;
var hasRequiredReactReconciler_production;
function requireReactReconciler_production () {
if (hasRequiredReactReconciler_production) return reactReconciler_production$1.exports;
hasRequiredReactReconciler_production = 1;
(function (module) {
"use strict";
module.exports = function ($$$config) {
function createFiber(tag, pendingProps, key, mode) {
return new FiberNode(tag, pendingProps, key, mode);
}
function noop() {}
function formatProdErrorMessage(code) {
var url = "https://react.dev/errors/" + code;
if (1 < arguments.length) {
url += "?args[]=" + encodeURIComponent(arguments[1]);
for (var i = 2; i < arguments.length; i++)
url += "&args[]=" + encodeURIComponent(arguments[i]);
}
return (
"Minified React error #" +
code +
"; visit " +
url +
" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
);
}
function getIteratorFn(maybeIterable) {
if (n