@p5-wrapper/next
Version:
A NextJS specific library for the @P5-Wrapper/react project.
559 lines (558 loc) • 17.5 kB
JavaScript
import G from "react";
function fe(a) {
return a && a.__esModule && Object.prototype.hasOwnProperty.call(a, "default") ? a.default : a;
}
var L = { exports: {} }, F = {}, ee;
function J() {
if (ee) return F;
ee = 1;
function a(s) {
return s && s.__esModule ? s : { default: s };
}
return F._ = a, F;
}
var q = { exports: {} }, C = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var re;
function _e() {
if (re) return C;
re = 1;
var a = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
function m(E, f, R) {
var T = null;
if (R !== void 0 && (T = "" + R), f.key !== void 0 && (T = "" + f.key), "key" in f) {
R = {};
for (var v in f)
v !== "key" && (R[v] = f[v]);
} else R = f;
return f = R.ref, {
$$typeof: a,
type: E,
key: T,
ref: f !== void 0 ? f : null,
props: R
};
}
return C.Fragment = s, C.jsx = m, C.jsxs = m, C;
}
var N = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var te;
function me() {
return te || (te = 1, process.env.NODE_ENV !== "production" && function() {
function a(e) {
if (e == null) return null;
if (typeof e == "function")
return e.$$typeof === se ? null : e.displayName || e.name || null;
if (typeof e == "string") return e;
switch (e) {
case o:
return "Fragment";
case l:
return "Profiler";
case t:
return "StrictMode";
case d:
return "Suspense";
case P:
return "SuspenseList";
case ie:
return "Activity";
}
if (typeof e == "object")
switch (typeof e.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), e.$$typeof) {
case n:
return "Portal";
case j:
return (e.displayName || "Context") + ".Provider";
case w:
return (e._context.displayName || "Context") + ".Consumer";
case x:
var r = e.render;
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
case y:
return r = e.displayName || null, r !== null ? r : a(e.type) || "Memo";
case z:
r = e._payload, e = e._init;
try {
return a(e(r));
} catch {
}
}
return null;
}
function s(e) {
return "" + e;
}
function m(e) {
try {
s(e);
var r = !1;
} catch {
r = !0;
}
if (r) {
r = console;
var i = r.error, b = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
return i.call(
r,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
b
), s(e);
}
}
function E(e) {
if (e === o) return "<>";
if (typeof e == "object" && e !== null && e.$$typeof === z)
return "<...>";
try {
var r = a(e);
return r ? "<" + r + ">" : "<...>";
} catch {
return "<...>";
}
}
function f() {
var e = D.A;
return e === null ? null : e.getOwner();
}
function R() {
return Error("react-stack-top-frame");
}
function T(e) {
if (X.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning) return !1;
}
return e.key !== void 0;
}
function v(e, r) {
function i() {
Z || (Z = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
r
));
}
i.isReactWarning = !0, Object.defineProperty(e, "key", {
get: i,
configurable: !0
});
}
function O() {
var e = a(this.type);
return H[e] || (H[e] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), e = this.props.ref, e !== void 0 ? e : null;
}
function A(e, r, i, b, k, g, Y, M) {
return i = g.ref, e = {
$$typeof: u,
type: e,
key: r,
props: g,
_owner: k
}, (i !== void 0 ? i : null) !== null ? Object.defineProperty(e, "ref", {
enumerable: !1,
get: O
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(e, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(e, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: Y
}), Object.defineProperty(e, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: M
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
}
function c(e, r, i, b, k, g, Y, M) {
var h = r.children;
if (h !== void 0)
if (b)
if (ce(h)) {
for (b = 0; b < h.length; b++)
_(h[b]);
Object.freeze && Object.freeze(h);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else _(h);
if (X.call(r, "key")) {
h = a(e);
var S = Object.keys(r).filter(function(de) {
return de !== "key";
});
b = 0 < S.length ? "{key: someKey, " + S.join(": ..., ") + ": ...}" : "{key: someKey}", K[h + b] || (S = 0 < S.length ? "{" + S.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
b,
h,
S,
h
), K[h + b] = !0);
}
if (h = null, i !== void 0 && (m(i), h = "" + i), T(r) && (m(r.key), h = "" + r.key), "key" in r) {
i = {};
for (var $ in r)
$ !== "key" && (i[$] = r[$]);
} else i = r;
return h && v(
i,
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
), A(
e,
h,
g,
k,
f(),
i,
Y,
M
);
}
function _(e) {
typeof e == "object" && e !== null && e.$$typeof === u && e._store && (e._store.validated = 1);
}
var p = G, u = Symbol.for("react.transitional.element"), n = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), t = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), j = Symbol.for("react.context"), x = Symbol.for("react.forward_ref"), d = Symbol.for("react.suspense"), P = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), ie = Symbol.for("react.activity"), se = Symbol.for("react.client.reference"), D = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, X = Object.prototype.hasOwnProperty, ce = Array.isArray, I = console.createTask ? console.createTask : function() {
return null;
};
p = {
"react-stack-bottom-frame": function(e) {
return e();
}
};
var Z, H = {}, B = p["react-stack-bottom-frame"].bind(
p,
R
)(), Q = I(E(R)), K = {};
N.Fragment = o, N.jsx = function(e, r, i, b, k) {
var g = 1e4 > D.recentlyCreatedOwnerStacks++;
return c(
e,
r,
i,
!1,
b,
k,
g ? Error("react-stack-top-frame") : B,
g ? I(E(e)) : Q
);
}, N.jsxs = function(e, r, i, b, k) {
var g = 1e4 > D.recentlyCreatedOwnerStacks++;
return c(
e,
r,
i,
!0,
b,
k,
g ? Error("react-stack-top-frame") : B,
g ? I(E(e)) : Q
);
};
}()), N;
}
var ne;
function pe() {
return ne || (ne = 1, process.env.NODE_ENV === "production" ? q.exports = _e() : q.exports = me()), q.exports;
}
function be(a) {
throw new Error('Could not dynamically require "' + a + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var V = {}, W = {}, ae;
function he() {
return ae || (ae = 1, function(a) {
"use client";
Object.defineProperty(a, "__esModule", {
value: !0
}), Object.defineProperty(a, "LoadableContext", {
enumerable: !0,
get: function() {
return E;
}
});
const E = (/* @__PURE__ */ (/* @__PURE__ */ J())._(G)).default.createContext(null);
process.env.NODE_ENV !== "production" && (E.displayName = "LoadableContext");
}(W)), W;
}
var oe;
function Re() {
return oe || (oe = 1, function(a) {
Object.defineProperty(a, "__esModule", {
value: !0
}), Object.defineProperty(a, "default", {
enumerable: !0,
get: function() {
return u;
}
});
const m = /* @__PURE__ */ (/* @__PURE__ */ J())._(G), E = he();
function f(n) {
return n && n.default ? n.default : n;
}
const R = [], T = [];
let v = !1;
function O(n) {
let o = n(), t = {
loading: !0,
loaded: null,
error: null
};
return t.promise = o.then((l) => (t.loading = !1, t.loaded = l, l)).catch((l) => {
throw t.loading = !1, t.error = l, l;
}), t;
}
function A(n, o) {
let t = Object.assign({
loader: null,
loading: null,
delay: 200,
timeout: null,
webpack: null,
modules: null
}, o), l = null;
function w() {
if (!l) {
const d = new c(n, t);
l = {
getCurrentValue: d.getCurrentValue.bind(d),
subscribe: d.subscribe.bind(d),
retry: d.retry.bind(d),
promise: d.promise.bind(d)
};
}
return l.promise();
}
if (typeof window > "u" && R.push(w), !v && typeof window < "u") {
const d = t.webpack && typeof be.resolveWeak == "function" ? t.webpack() : t.modules;
d && T.push((P) => {
for (const y of d)
if (P.includes(y))
return w();
});
}
function j() {
w();
const d = m.default.useContext(E.LoadableContext);
d && Array.isArray(t.modules) && t.modules.forEach((P) => {
d(P);
});
}
function x(d, P) {
j();
const y = m.default.useSyncExternalStore(l.subscribe, l.getCurrentValue, l.getCurrentValue);
return m.default.useImperativeHandle(P, () => ({
retry: l.retry
}), []), m.default.useMemo(() => y.loading || y.error ? /* @__PURE__ */ m.default.createElement(t.loading, {
isLoading: y.loading,
pastDelay: y.pastDelay,
timedOut: y.timedOut,
error: y.error,
retry: l.retry
}) : y.loaded ? /* @__PURE__ */ m.default.createElement(f(y.loaded), d) : null, [
d,
y
]);
}
return x.preload = () => w(), x.displayName = "LoadableComponent", /* @__PURE__ */ m.default.forwardRef(x);
}
class c {
promise() {
return this._res.promise;
}
retry() {
this._clearTimeouts(), this._res = this._loadFn(this._opts.loader), this._state = {
pastDelay: !1,
timedOut: !1
};
const { _res: o, _opts: t } = this;
o.loading && (typeof t.delay == "number" && (t.delay === 0 ? this._state.pastDelay = !0 : this._delay = setTimeout(() => {
this._update({
pastDelay: !0
});
}, t.delay)), typeof t.timeout == "number" && (this._timeout = setTimeout(() => {
this._update({
timedOut: !0
});
}, t.timeout))), this._res.promise.then(() => {
this._update({}), this._clearTimeouts();
}).catch((l) => {
this._update({}), this._clearTimeouts();
}), this._update({});
}
_update(o) {
this._state = {
...this._state,
error: this._res.error,
loaded: this._res.loaded,
loading: this._res.loading,
...o
}, this._callbacks.forEach((t) => t());
}
_clearTimeouts() {
clearTimeout(this._delay), clearTimeout(this._timeout);
}
getCurrentValue() {
return this._state;
}
subscribe(o) {
return this._callbacks.add(o), () => {
this._callbacks.delete(o);
};
}
constructor(o, t) {
this._loadFn = o, this._opts = t, this._callbacks = /* @__PURE__ */ new Set(), this._delay = null, this._timeout = null, this.retry();
}
}
function _(n) {
return A(O, n);
}
function p(n, o) {
let t = [];
for (; n.length; ) {
let l = n.pop();
t.push(l(o));
}
return Promise.all(t).then(() => {
if (n.length)
return p(n, o);
});
}
_.preloadAll = () => new Promise((n, o) => {
p(R).then(n, o);
}), _.preloadReady = (n) => (n === void 0 && (n = []), new Promise((o) => {
const t = () => (v = !0, o());
p(T, n).then(t, t);
})), typeof window < "u" && (window.__NEXT_PRELOADREADY = _.preloadReady);
const u = _;
}(V)), V;
}
var ue;
function ye() {
return ue || (ue = 1, function(a, s) {
Object.defineProperty(s, "__esModule", {
value: !0
});
function m(c, _) {
for (var p in _) Object.defineProperty(c, p, {
enumerable: !0,
get: _[p]
});
}
m(s, {
/**
* This function lets you dynamically import a component.
* It uses [React.lazy()](https://react.dev/reference/react/lazy) with [Suspense](https://react.dev/reference/react/Suspense) under the hood.
*
* Read more: [Next.js Docs: `next/dynamic`](https://nextjs.org/docs/app/building-your-application/optimizing/lazy-loading#nextdynamic)
*/
default: function() {
return A;
},
noSSR: function() {
return O;
}
});
const E = /* @__PURE__ */ J(), f = pe(), R = /* @__PURE__ */ E._(Re()), T = typeof window > "u";
function v(c) {
return {
default: c?.default || c
};
}
function O(c, _) {
if (delete _.webpack, delete _.modules, !T)
return c(_);
const p = _.loading;
return () => /* @__PURE__ */ (0, f.jsx)(p, {
error: null,
isLoading: !0,
pastDelay: !1,
timedOut: !1
});
}
function A(c, _) {
let p = R.default, u = {
// A loading component is not required, so we default it
loading: (t) => {
let { error: l, isLoading: w, pastDelay: j } = t;
if (!j) return null;
if (process.env.NODE_ENV !== "production") {
if (w)
return null;
if (l)
return /* @__PURE__ */ (0, f.jsxs)("p", {
children: [
l.message,
/* @__PURE__ */ (0, f.jsx)("br", {}),
l.stack
]
});
}
return null;
}
};
c instanceof Promise ? u.loader = () => c : typeof c == "function" ? u.loader = c : typeof c == "object" && (u = {
...u,
...c
}), u = {
...u,
..._
};
const n = u.loader, o = () => n != null ? n().then(v) : Promise.resolve(v(() => null));
return u.loadableGenerated && (u = {
...u,
...u.loadableGenerated
}, delete u.loadableGenerated), typeof u.ssr == "boolean" && !u.ssr ? (delete u.webpack, delete u.modules, O(p, u)) : p({
...u,
loader: o
});
}
(typeof s.default == "function" || typeof s.default == "object" && s.default !== null) && typeof s.default.__esModule > "u" && (Object.defineProperty(s.default, "__esModule", { value: !0 }), Object.assign(s.default, s), a.exports = s.default);
}(L, L.exports)), L.exports;
}
var U, le;
function Ee() {
return le || (le = 1, U = ye()), U;
}
var ve = Ee();
const Te = /* @__PURE__ */ fe(ve), we = Te(
async () => (await import("@p5-wrapper/react")).ReactP5Wrapper,
{ ssr: !1 }
);
export {
we as NextReactP5Wrapper
};