dualvue
Version:
A React library to compare two images with a slider
1,445 lines (1,442 loc) • 48.6 kB
JavaScript
import lr, { useState as xe, useRef as Ce, useEffect as Qe } from "react";
function Dr(s) {
return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
}
var De = { exports: {} }, ge = {};
/**
* @license React
* react-jsx-runtime.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 er;
function Fr() {
if (er) return ge;
er = 1;
var s = lr, Y = Symbol.for("react.element"), I = Symbol.for("react.fragment"), v = Object.prototype.hasOwnProperty, x = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, f = { key: !0, ref: !0, __self: !0, __source: !0 };
function P(l, y, _) {
var u, d = {}, k = null, F = null;
_ !== void 0 && (k = "" + _), y.key !== void 0 && (k = "" + y.key), y.ref !== void 0 && (F = y.ref);
for (u in y) v.call(y, u) && !f.hasOwnProperty(u) && (d[u] = y[u]);
if (l && l.defaultProps) for (u in y = l.defaultProps, y) d[u] === void 0 && (d[u] = y[u]);
return { $$typeof: Y, type: l, key: k, ref: F, props: d, _owner: x.current };
}
return ge.Fragment = I, ge.jsx = P, ge.jsxs = P, ge;
}
var Ee = {};
/**
* @license React
* react-jsx-runtime.development.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 rr;
function Yr() {
return rr || (rr = 1, process.env.NODE_ENV !== "production" && function() {
var s = lr, Y = Symbol.for("react.element"), I = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), P = Symbol.for("react.provider"), l = Symbol.for("react.context"), y = Symbol.for("react.forward_ref"), _ = Symbol.for("react.suspense"), u = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), k = Symbol.for("react.lazy"), F = Symbol.for("react.offscreen"), z = Symbol.iterator, D = "@@iterator";
function L(e) {
if (e === null || typeof e != "object")
return null;
var r = z && e[z] || e[D];
return typeof r == "function" ? r : null;
}
var q = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function $(e) {
{
for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), c = 1; c < r; c++)
o[c - 1] = arguments[c];
U("error", e, o);
}
}
function U(e, r, o) {
{
var c = q.ReactDebugCurrentFrame, C = c.getStackAddendum();
C !== "" && (r += "%s", o = o.concat([C]));
var M = o.map(function(O) {
return String(O);
});
M.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, M);
}
}
var W = !1, a = !1, re = !1, ie = !1, ce = !1, fe;
fe = Symbol.for("react.module.reference");
function K(e) {
return !!(typeof e == "string" || typeof e == "function" || e === v || e === f || ce || e === x || e === _ || e === u || ie || e === F || W || a || re || typeof e == "object" && e !== null && (e.$$typeof === k || e.$$typeof === d || e.$$typeof === P || e.$$typeof === l || e.$$typeof === y || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
e.$$typeof === fe || e.getModuleId !== void 0));
}
function B(e, r, o) {
var c = e.displayName;
if (c)
return c;
var C = r.displayName || r.name || "";
return C !== "" ? o + "(" + C + ")" : o;
}
function Z(e) {
return e.displayName || "Context";
}
function X(e) {
if (e == null)
return null;
if (typeof e.tag == "number" && $("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
return e.displayName || e.name || null;
if (typeof e == "string")
return e;
switch (e) {
case v:
return "Fragment";
case I:
return "Portal";
case f:
return "Profiler";
case x:
return "StrictMode";
case _:
return "Suspense";
case u:
return "SuspenseList";
}
if (typeof e == "object")
switch (e.$$typeof) {
case l:
var r = e;
return Z(r) + ".Consumer";
case P:
var o = e;
return Z(o._context) + ".Provider";
case y:
return B(e, e.render, "ForwardRef");
case d:
var c = e.displayName || null;
return c !== null ? c : X(e.type) || "Memo";
case k: {
var C = e, M = C._payload, O = C._init;
try {
return X(O(M));
} catch {
return null;
}
}
}
return null;
}
var J = Object.assign, se = 0, ee, ae, le, pe, t, i, g;
function b() {
}
b.__reactDisabledLog = !0;
function p() {
{
if (se === 0) {
ee = console.log, ae = console.info, le = console.warn, pe = console.error, t = console.group, i = console.groupCollapsed, g = console.groupEnd;
var e = {
configurable: !0,
enumerable: !0,
value: b,
writable: !0
};
Object.defineProperties(console, {
info: e,
log: e,
warn: e,
error: e,
group: e,
groupCollapsed: e,
groupEnd: e
});
}
se++;
}
}
function S() {
{
if (se--, se === 0) {
var e = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: J({}, e, {
value: ee
}),
info: J({}, e, {
value: ae
}),
warn: J({}, e, {
value: le
}),
error: J({}, e, {
value: pe
}),
group: J({}, e, {
value: t
}),
groupCollapsed: J({}, e, {
value: i
}),
groupEnd: J({}, e, {
value: g
})
});
}
se < 0 && $("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var h = q.ReactCurrentDispatcher, m;
function E(e, r, o) {
{
if (m === void 0)
try {
throw Error();
} catch (C) {
var c = C.stack.trim().match(/\n( *(at )?)/);
m = c && c[1] || "";
}
return `
` + m + e;
}
}
var w = !1, T;
{
var H = typeof WeakMap == "function" ? WeakMap : Map;
T = new H();
}
function n(e, r) {
if (!e || w)
return "";
{
var o = T.get(e);
if (o !== void 0)
return o;
}
var c;
w = !0;
var C = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var M;
M = h.current, h.current = null, p();
try {
if (r) {
var O = function() {
throw Error();
};
if (Object.defineProperty(O.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(O, []);
} catch (Q) {
c = Q;
}
Reflect.construct(e, [], O);
} else {
try {
O.call();
} catch (Q) {
c = Q;
}
e.call(O.prototype);
}
} else {
try {
throw Error();
} catch (Q) {
c = Q;
}
e();
}
} catch (Q) {
if (Q && c && typeof Q.stack == "string") {
for (var R = Q.stack.split(`
`), G = c.stack.split(`
`), N = R.length - 1, V = G.length - 1; N >= 1 && V >= 0 && R[N] !== G[V]; )
V--;
for (; N >= 1 && V >= 0; N--, V--)
if (R[N] !== G[V]) {
if (N !== 1 || V !== 1)
do
if (N--, V--, V < 0 || R[N] !== G[V]) {
var ne = `
` + R[N].replace(" at new ", " at ");
return e.displayName && ne.includes("<anonymous>") && (ne = ne.replace("<anonymous>", e.displayName)), typeof e == "function" && T.set(e, ne), ne;
}
while (N >= 1 && V >= 0);
break;
}
}
} finally {
w = !1, h.current = M, S(), Error.prepareStackTrace = C;
}
var me = e ? e.displayName || e.name : "", ve = me ? E(me) : "";
return typeof e == "function" && T.set(e, ve), ve;
}
function te(e, r, o) {
return n(e, !1);
}
function ye(e) {
var r = e.prototype;
return !!(r && r.isReactComponent);
}
function de(e, r, o) {
if (e == null)
return "";
if (typeof e == "function")
return n(e, ye(e));
if (typeof e == "string")
return E(e);
switch (e) {
case _:
return E("Suspense");
case u:
return E("SuspenseList");
}
if (typeof e == "object")
switch (e.$$typeof) {
case y:
return te(e.render);
case d:
return de(e.type, r, o);
case k: {
var c = e, C = c._payload, M = c._init;
try {
return de(M(C), r, o);
} catch {
}
}
}
return "";
}
var be = Object.prototype.hasOwnProperty, Le = {}, We = q.ReactDebugCurrentFrame;
function Te(e) {
if (e) {
var r = e._owner, o = de(e.type, e._source, r ? r.type : null);
We.setExtraStackFrame(o);
} else
We.setExtraStackFrame(null);
}
function pr(e, r, o, c, C) {
{
var M = Function.call.bind(be);
for (var O in e)
if (M(e, O)) {
var R = void 0;
try {
if (typeof e[O] != "function") {
var G = Error((c || "React class") + ": " + o + " type `" + O + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[O] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw G.name = "Invariant Violation", G;
}
R = e[O](r, O, c, o, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (N) {
R = N;
}
R && !(R instanceof Error) && (Te(C), $("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", c || "React class", o, O, typeof R), Te(null)), R instanceof Error && !(R.message in Le) && (Le[R.message] = !0, Te(C), $("Failed %s type: %s", o, R.message), Te(null));
}
}
}
var yr = Array.isArray;
function _e(e) {
return yr(e);
}
function hr(e) {
{
var r = typeof Symbol == "function" && Symbol.toStringTag, o = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
return o;
}
}
function mr(e) {
try {
return qe(e), !1;
} catch {
return !0;
}
}
function qe(e) {
return "" + e;
}
function Ue(e) {
if (mr(e))
return $("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", hr(e)), qe(e);
}
var Ne = q.ReactCurrentOwner, br = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, Ve, ze;
function gr(e) {
if (be.call(e, "ref")) {
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
if (r && r.isReactWarning)
return !1;
}
return e.ref !== void 0;
}
function Er(e) {
if (be.call(e, "key")) {
var r = Object.getOwnPropertyDescriptor(e, "key").get;
if (r && r.isReactWarning)
return !1;
}
return e.key !== void 0;
}
function Tr(e, r) {
typeof e.ref == "string" && Ne.current;
}
function Rr(e, r) {
{
var o = function() {
Ve || (Ve = !0, $("%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://reactjs.org/link/special-props)", r));
};
o.isReactWarning = !0, Object.defineProperty(e, "key", {
get: o,
configurable: !0
});
}
}
function _r(e, r) {
{
var o = function() {
ze || (ze = !0, $("%s: `ref` 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://reactjs.org/link/special-props)", r));
};
o.isReactWarning = !0, Object.defineProperty(e, "ref", {
get: o,
configurable: !0
});
}
}
var Sr = function(e, r, o, c, C, M, O) {
var R = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: Y,
// Built-in properties that belong on the element
type: e,
key: r,
ref: o,
props: O,
// Record the component responsible for creating this element.
_owner: M
};
return R._store = {}, Object.defineProperty(R._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(R, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: c
}), Object.defineProperty(R, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: C
}), Object.freeze && (Object.freeze(R.props), Object.freeze(R)), R;
};
function Or(e, r, o, c, C) {
{
var M, O = {}, R = null, G = null;
o !== void 0 && (Ue(o), R = "" + o), Er(r) && (Ue(r.key), R = "" + r.key), gr(r) && (G = r.ref, Tr(r, C));
for (M in r)
be.call(r, M) && !br.hasOwnProperty(M) && (O[M] = r[M]);
if (e && e.defaultProps) {
var N = e.defaultProps;
for (M in N)
O[M] === void 0 && (O[M] = N[M]);
}
if (R || G) {
var V = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
R && Rr(O, V), G && _r(O, V);
}
return Sr(e, R, G, C, c, Ne.current, O);
}
}
var Se = q.ReactCurrentOwner, Be = q.ReactDebugCurrentFrame;
function he(e) {
if (e) {
var r = e._owner, o = de(e.type, e._source, r ? r.type : null);
Be.setExtraStackFrame(o);
} else
Be.setExtraStackFrame(null);
}
var Oe;
Oe = !1;
function Pe(e) {
return typeof e == "object" && e !== null && e.$$typeof === Y;
}
function Je() {
{
if (Se.current) {
var e = X(Se.current.type);
if (e)
return `
Check the render method of \`` + e + "`.";
}
return "";
}
}
function Pr(e) {
return "";
}
var Ke = {};
function wr(e) {
{
var r = Je();
if (!r) {
var o = typeof e == "string" ? e : e.displayName || e.name;
o && (r = `
Check the top-level render call using <` + o + ">.");
}
return r;
}
}
function Xe(e, r) {
{
if (!e._store || e._store.validated || e.key != null)
return;
e._store.validated = !0;
var o = wr(r);
if (Ke[o])
return;
Ke[o] = !0;
var c = "";
e && e._owner && e._owner !== Se.current && (c = " It was passed a child from " + X(e._owner.type) + "."), he(e), $('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', o, c), he(null);
}
}
function He(e, r) {
{
if (typeof e != "object")
return;
if (_e(e))
for (var o = 0; o < e.length; o++) {
var c = e[o];
Pe(c) && Xe(c, r);
}
else if (Pe(e))
e._store && (e._store.validated = !0);
else if (e) {
var C = L(e);
if (typeof C == "function" && C !== e.entries)
for (var M = C.call(e), O; !(O = M.next()).done; )
Pe(O.value) && Xe(O.value, r);
}
}
}
function xr(e) {
{
var r = e.type;
if (r == null || typeof r == "string")
return;
var o;
if (typeof r == "function")
o = r.propTypes;
else if (typeof r == "object" && (r.$$typeof === y || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
r.$$typeof === d))
o = r.propTypes;
else
return;
if (o) {
var c = X(r);
pr(o, e.props, "prop", c, e);
} else if (r.PropTypes !== void 0 && !Oe) {
Oe = !0;
var C = X(r);
$("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", C || "Unknown");
}
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && $("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function Cr(e) {
{
for (var r = Object.keys(e.props), o = 0; o < r.length; o++) {
var c = r[o];
if (c !== "children" && c !== "key") {
he(e), $("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", c), he(null);
break;
}
}
e.ref !== null && (he(e), $("Invalid attribute `ref` supplied to `React.Fragment`."), he(null));
}
}
var Ge = {};
function Ze(e, r, o, c, C, M) {
{
var O = K(e);
if (!O) {
var R = "";
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (R += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var G = Pr();
G ? R += G : R += Je();
var N;
e === null ? N = "null" : _e(e) ? N = "array" : e !== void 0 && e.$$typeof === Y ? (N = "<" + (X(e.type) || "Unknown") + " />", R = " Did you accidentally export a JSX literal instead of a component?") : N = typeof e, $("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", N, R);
}
var V = Or(e, r, o, C, M);
if (V == null)
return V;
if (O) {
var ne = r.children;
if (ne !== void 0)
if (c)
if (_e(ne)) {
for (var me = 0; me < ne.length; me++)
He(ne[me], e);
Object.freeze && Object.freeze(ne);
} else
$("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
He(ne, e);
}
if (be.call(r, "key")) {
var ve = X(e), Q = Object.keys(r).filter(function(Mr) {
return Mr !== "key";
}), we = Q.length > 0 ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Ge[ve + we]) {
var $r = Q.length > 0 ? "{" + Q.join(": ..., ") + ": ...}" : "{}";
$(`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} />`, we, ve, $r, ve), Ge[ve + we] = !0;
}
}
return e === v ? Cr(V) : xr(V), V;
}
}
function jr(e, r, o) {
return Ze(e, r, o, !0);
}
function Ar(e, r, o) {
return Ze(e, r, o, !1);
}
var Ir = Ar, kr = jr;
Ee.Fragment = v, Ee.jsx = Ir, Ee.jsxs = kr;
}()), Ee;
}
process.env.NODE_ENV === "production" ? De.exports = Fr() : De.exports = Yr();
var ue = De.exports, Fe = { exports: {} }, Re = { exports: {} }, j = {};
/** @license React v16.13.1
* 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 tr;
function Lr() {
if (tr) return j;
tr = 1;
var s = typeof Symbol == "function" && Symbol.for, Y = s ? Symbol.for("react.element") : 60103, I = s ? Symbol.for("react.portal") : 60106, v = s ? Symbol.for("react.fragment") : 60107, x = s ? Symbol.for("react.strict_mode") : 60108, f = s ? Symbol.for("react.profiler") : 60114, P = s ? Symbol.for("react.provider") : 60109, l = s ? Symbol.for("react.context") : 60110, y = s ? Symbol.for("react.async_mode") : 60111, _ = s ? Symbol.for("react.concurrent_mode") : 60111, u = s ? Symbol.for("react.forward_ref") : 60112, d = s ? Symbol.for("react.suspense") : 60113, k = s ? Symbol.for("react.suspense_list") : 60120, F = s ? Symbol.for("react.memo") : 60115, z = s ? Symbol.for("react.lazy") : 60116, D = s ? Symbol.for("react.block") : 60121, L = s ? Symbol.for("react.fundamental") : 60117, q = s ? Symbol.for("react.responder") : 60118, $ = s ? Symbol.for("react.scope") : 60119;
function U(a) {
if (typeof a == "object" && a !== null) {
var re = a.$$typeof;
switch (re) {
case Y:
switch (a = a.type, a) {
case y:
case _:
case v:
case f:
case x:
case d:
return a;
default:
switch (a = a && a.$$typeof, a) {
case l:
case u:
case z:
case F:
case P:
return a;
default:
return re;
}
}
case I:
return re;
}
}
}
function W(a) {
return U(a) === _;
}
return j.AsyncMode = y, j.ConcurrentMode = _, j.ContextConsumer = l, j.ContextProvider = P, j.Element = Y, j.ForwardRef = u, j.Fragment = v, j.Lazy = z, j.Memo = F, j.Portal = I, j.Profiler = f, j.StrictMode = x, j.Suspense = d, j.isAsyncMode = function(a) {
return W(a) || U(a) === y;
}, j.isConcurrentMode = W, j.isContextConsumer = function(a) {
return U(a) === l;
}, j.isContextProvider = function(a) {
return U(a) === P;
}, j.isElement = function(a) {
return typeof a == "object" && a !== null && a.$$typeof === Y;
}, j.isForwardRef = function(a) {
return U(a) === u;
}, j.isFragment = function(a) {
return U(a) === v;
}, j.isLazy = function(a) {
return U(a) === z;
}, j.isMemo = function(a) {
return U(a) === F;
}, j.isPortal = function(a) {
return U(a) === I;
}, j.isProfiler = function(a) {
return U(a) === f;
}, j.isStrictMode = function(a) {
return U(a) === x;
}, j.isSuspense = function(a) {
return U(a) === d;
}, j.isValidElementType = function(a) {
return typeof a == "string" || typeof a == "function" || a === v || a === _ || a === f || a === x || a === d || a === k || typeof a == "object" && a !== null && (a.$$typeof === z || a.$$typeof === F || a.$$typeof === P || a.$$typeof === l || a.$$typeof === u || a.$$typeof === L || a.$$typeof === q || a.$$typeof === $ || a.$$typeof === D);
}, j.typeOf = U, j;
}
var A = {};
/** @license React v16.13.1
* react-is.development.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 nr;
function Wr() {
return nr || (nr = 1, process.env.NODE_ENV !== "production" && function() {
var s = typeof Symbol == "function" && Symbol.for, Y = s ? Symbol.for("react.element") : 60103, I = s ? Symbol.for("react.portal") : 60106, v = s ? Symbol.for("react.fragment") : 60107, x = s ? Symbol.for("react.strict_mode") : 60108, f = s ? Symbol.for("react.profiler") : 60114, P = s ? Symbol.for("react.provider") : 60109, l = s ? Symbol.for("react.context") : 60110, y = s ? Symbol.for("react.async_mode") : 60111, _ = s ? Symbol.for("react.concurrent_mode") : 60111, u = s ? Symbol.for("react.forward_ref") : 60112, d = s ? Symbol.for("react.suspense") : 60113, k = s ? Symbol.for("react.suspense_list") : 60120, F = s ? Symbol.for("react.memo") : 60115, z = s ? Symbol.for("react.lazy") : 60116, D = s ? Symbol.for("react.block") : 60121, L = s ? Symbol.for("react.fundamental") : 60117, q = s ? Symbol.for("react.responder") : 60118, $ = s ? Symbol.for("react.scope") : 60119;
function U(n) {
return typeof n == "string" || typeof n == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
n === v || n === _ || n === f || n === x || n === d || n === k || typeof n == "object" && n !== null && (n.$$typeof === z || n.$$typeof === F || n.$$typeof === P || n.$$typeof === l || n.$$typeof === u || n.$$typeof === L || n.$$typeof === q || n.$$typeof === $ || n.$$typeof === D);
}
function W(n) {
if (typeof n == "object" && n !== null) {
var te = n.$$typeof;
switch (te) {
case Y:
var ye = n.type;
switch (ye) {
case y:
case _:
case v:
case f:
case x:
case d:
return ye;
default:
var de = ye && ye.$$typeof;
switch (de) {
case l:
case u:
case z:
case F:
case P:
return de;
default:
return te;
}
}
case I:
return te;
}
}
}
var a = y, re = _, ie = l, ce = P, fe = Y, K = u, B = v, Z = z, X = F, J = I, se = f, ee = x, ae = d, le = !1;
function pe(n) {
return le || (le = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), t(n) || W(n) === y;
}
function t(n) {
return W(n) === _;
}
function i(n) {
return W(n) === l;
}
function g(n) {
return W(n) === P;
}
function b(n) {
return typeof n == "object" && n !== null && n.$$typeof === Y;
}
function p(n) {
return W(n) === u;
}
function S(n) {
return W(n) === v;
}
function h(n) {
return W(n) === z;
}
function m(n) {
return W(n) === F;
}
function E(n) {
return W(n) === I;
}
function w(n) {
return W(n) === f;
}
function T(n) {
return W(n) === x;
}
function H(n) {
return W(n) === d;
}
A.AsyncMode = a, A.ConcurrentMode = re, A.ContextConsumer = ie, A.ContextProvider = ce, A.Element = fe, A.ForwardRef = K, A.Fragment = B, A.Lazy = Z, A.Memo = X, A.Portal = J, A.Profiler = se, A.StrictMode = ee, A.Suspense = ae, A.isAsyncMode = pe, A.isConcurrentMode = t, A.isContextConsumer = i, A.isContextProvider = g, A.isElement = b, A.isForwardRef = p, A.isFragment = S, A.isLazy = h, A.isMemo = m, A.isPortal = E, A.isProfiler = w, A.isStrictMode = T, A.isSuspense = H, A.isValidElementType = U, A.typeOf = W;
}()), A;
}
var ar;
function dr() {
return ar || (ar = 1, process.env.NODE_ENV === "production" ? Re.exports = Lr() : Re.exports = Wr()), Re.exports;
}
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
var je, or;
function qr() {
if (or) return je;
or = 1;
var s = Object.getOwnPropertySymbols, Y = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
function v(f) {
if (f == null)
throw new TypeError("Object.assign cannot be called with null or undefined");
return Object(f);
}
function x() {
try {
if (!Object.assign)
return !1;
var f = new String("abc");
if (f[5] = "de", Object.getOwnPropertyNames(f)[0] === "5")
return !1;
for (var P = {}, l = 0; l < 10; l++)
P["_" + String.fromCharCode(l)] = l;
var y = Object.getOwnPropertyNames(P).map(function(u) {
return P[u];
});
if (y.join("") !== "0123456789")
return !1;
var _ = {};
return "abcdefghijklmnopqrst".split("").forEach(function(u) {
_[u] = u;
}), Object.keys(Object.assign({}, _)).join("") === "abcdefghijklmnopqrst";
} catch {
return !1;
}
}
return je = x() ? Object.assign : function(f, P) {
for (var l, y = v(f), _, u = 1; u < arguments.length; u++) {
l = Object(arguments[u]);
for (var d in l)
Y.call(l, d) && (y[d] = l[d]);
if (s) {
_ = s(l);
for (var k = 0; k < _.length; k++)
I.call(l, _[k]) && (y[_[k]] = l[_[k]]);
}
}
return y;
}, je;
}
var Ae, ir;
function Ye() {
if (ir) return Ae;
ir = 1;
var s = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
return Ae = s, Ae;
}
var Ie, sr;
function vr() {
return sr || (sr = 1, Ie = Function.call.bind(Object.prototype.hasOwnProperty)), Ie;
}
var ke, ur;
function Ur() {
if (ur) return ke;
ur = 1;
var s = function() {
};
if (process.env.NODE_ENV !== "production") {
var Y = Ye(), I = {}, v = vr();
s = function(f) {
var P = "Warning: " + f;
typeof console < "u" && console.error(P);
try {
throw new Error(P);
} catch {
}
};
}
function x(f, P, l, y, _) {
if (process.env.NODE_ENV !== "production") {
for (var u in f)
if (v(f, u)) {
var d;
try {
if (typeof f[u] != "function") {
var k = Error(
(y || "React class") + ": " + l + " type `" + u + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof f[u] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
);
throw k.name = "Invariant Violation", k;
}
d = f[u](P, u, y, l, null, Y);
} catch (z) {
d = z;
}
if (d && !(d instanceof Error) && s(
(y || "React class") + ": type specification of " + l + " `" + u + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof d + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
), d instanceof Error && !(d.message in I)) {
I[d.message] = !0;
var F = _ ? _() : "";
s(
"Failed " + l + " type: " + d.message + (F ?? "")
);
}
}
}
}
return x.resetWarningCache = function() {
process.env.NODE_ENV !== "production" && (I = {});
}, ke = x, ke;
}
var $e, cr;
function Nr() {
if (cr) return $e;
cr = 1;
var s = dr(), Y = qr(), I = Ye(), v = vr(), x = Ur(), f = function() {
};
process.env.NODE_ENV !== "production" && (f = function(l) {
var y = "Warning: " + l;
typeof console < "u" && console.error(y);
try {
throw new Error(y);
} catch {
}
});
function P() {
return null;
}
return $e = function(l, y) {
var _ = typeof Symbol == "function" && Symbol.iterator, u = "@@iterator";
function d(t) {
var i = t && (_ && t[_] || t[u]);
if (typeof i == "function")
return i;
}
var k = "<<anonymous>>", F = {
array: q("array"),
bigint: q("bigint"),
bool: q("boolean"),
func: q("function"),
number: q("number"),
object: q("object"),
string: q("string"),
symbol: q("symbol"),
any: $(),
arrayOf: U,
element: W(),
elementType: a(),
instanceOf: re,
node: K(),
objectOf: ce,
oneOf: ie,
oneOfType: fe,
shape: Z,
exact: X
};
function z(t, i) {
return t === i ? t !== 0 || 1 / t === 1 / i : t !== t && i !== i;
}
function D(t, i) {
this.message = t, this.data = i && typeof i == "object" ? i : {}, this.stack = "";
}
D.prototype = Error.prototype;
function L(t) {
if (process.env.NODE_ENV !== "production")
var i = {}, g = 0;
function b(S, h, m, E, w, T, H) {
if (E = E || k, T = T || m, H !== I) {
if (y) {
var n = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
);
throw n.name = "Invariant Violation", n;
} else if (process.env.NODE_ENV !== "production" && typeof console < "u") {
var te = E + ":" + m;
!i[te] && // Avoid spamming the console because they are often not actionable except for lib authors
g < 3 && (f(
"You are manually calling a React.PropTypes validation function for the `" + T + "` prop on `" + E + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
), i[te] = !0, g++);
}
}
return h[m] == null ? S ? h[m] === null ? new D("The " + w + " `" + T + "` is marked as required " + ("in `" + E + "`, but its value is `null`.")) : new D("The " + w + " `" + T + "` is marked as required in " + ("`" + E + "`, but its value is `undefined`.")) : null : t(h, m, E, w, T);
}
var p = b.bind(null, !1);
return p.isRequired = b.bind(null, !0), p;
}
function q(t) {
function i(g, b, p, S, h, m) {
var E = g[b], w = ee(E);
if (w !== t) {
var T = ae(E);
return new D(
"Invalid " + S + " `" + h + "` of type " + ("`" + T + "` supplied to `" + p + "`, expected ") + ("`" + t + "`."),
{ expectedType: t }
);
}
return null;
}
return L(i);
}
function $() {
return L(P);
}
function U(t) {
function i(g, b, p, S, h) {
if (typeof t != "function")
return new D("Property `" + h + "` of component `" + p + "` has invalid PropType notation inside arrayOf.");
var m = g[b];
if (!Array.isArray(m)) {
var E = ee(m);
return new D("Invalid " + S + " `" + h + "` of type " + ("`" + E + "` supplied to `" + p + "`, expected an array."));
}
for (var w = 0; w < m.length; w++) {
var T = t(m, w, p, S, h + "[" + w + "]", I);
if (T instanceof Error)
return T;
}
return null;
}
return L(i);
}
function W() {
function t(i, g, b, p, S) {
var h = i[g];
if (!l(h)) {
var m = ee(h);
return new D("Invalid " + p + " `" + S + "` of type " + ("`" + m + "` supplied to `" + b + "`, expected a single ReactElement."));
}
return null;
}
return L(t);
}
function a() {
function t(i, g, b, p, S) {
var h = i[g];
if (!s.isValidElementType(h)) {
var m = ee(h);
return new D("Invalid " + p + " `" + S + "` of type " + ("`" + m + "` supplied to `" + b + "`, expected a single ReactElement type."));
}
return null;
}
return L(t);
}
function re(t) {
function i(g, b, p, S, h) {
if (!(g[b] instanceof t)) {
var m = t.name || k, E = pe(g[b]);
return new D("Invalid " + S + " `" + h + "` of type " + ("`" + E + "` supplied to `" + p + "`, expected ") + ("instance of `" + m + "`."));
}
return null;
}
return L(i);
}
function ie(t) {
if (!Array.isArray(t))
return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? f(
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
) : f("Invalid argument supplied to oneOf, expected an array.")), P;
function i(g, b, p, S, h) {
for (var m = g[b], E = 0; E < t.length; E++)
if (z(m, t[E]))
return null;
var w = JSON.stringify(t, function(H, n) {
var te = ae(n);
return te === "symbol" ? String(n) : n;
});
return new D("Invalid " + S + " `" + h + "` of value `" + String(m) + "` " + ("supplied to `" + p + "`, expected one of " + w + "."));
}
return L(i);
}
function ce(t) {
function i(g, b, p, S, h) {
if (typeof t != "function")
return new D("Property `" + h + "` of component `" + p + "` has invalid PropType notation inside objectOf.");
var m = g[b], E = ee(m);
if (E !== "object")
return new D("Invalid " + S + " `" + h + "` of type " + ("`" + E + "` supplied to `" + p + "`, expected an object."));
for (var w in m)
if (v(m, w)) {
var T = t(m, w, p, S, h + "." + w, I);
if (T instanceof Error)
return T;
}
return null;
}
return L(i);
}
function fe(t) {
if (!Array.isArray(t))
return process.env.NODE_ENV !== "production" && f("Invalid argument supplied to oneOfType, expected an instance of array."), P;
for (var i = 0; i < t.length; i++) {
var g = t[i];
if (typeof g != "function")
return f(
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + le(g) + " at index " + i + "."
), P;
}
function b(p, S, h, m, E) {
for (var w = [], T = 0; T < t.length; T++) {
var H = t[T], n = H(p, S, h, m, E, I);
if (n == null)
return null;
n.data && v(n.data, "expectedType") && w.push(n.data.expectedType);
}
var te = w.length > 0 ? ", expected one of type [" + w.join(", ") + "]" : "";
return new D("Invalid " + m + " `" + E + "` supplied to " + ("`" + h + "`" + te + "."));
}
return L(b);
}
function K() {
function t(i, g, b, p, S) {
return J(i[g]) ? null : new D("Invalid " + p + " `" + S + "` supplied to " + ("`" + b + "`, expected a ReactNode."));
}
return L(t);
}
function B(t, i, g, b, p) {
return new D(
(t || "React class") + ": " + i + " type `" + g + "." + b + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + p + "`."
);
}
function Z(t) {
function i(g, b, p, S, h) {
var m = g[b], E = ee(m);
if (E !== "object")
return new D("Invalid " + S + " `" + h + "` of type `" + E + "` " + ("supplied to `" + p + "`, expected `object`."));
for (var w in t) {
var T = t[w];
if (typeof T != "function")
return B(p, S, h, w, ae(T));
var H = T(m, w, p, S, h + "." + w, I);
if (H)
return H;
}
return null;
}
return L(i);
}
function X(t) {
function i(g, b, p, S, h) {
var m = g[b], E = ee(m);
if (E !== "object")
return new D("Invalid " + S + " `" + h + "` of type `" + E + "` " + ("supplied to `" + p + "`, expected `object`."));
var w = Y({}, g[b], t);
for (var T in w) {
var H = t[T];
if (v(t, T) && typeof H != "function")
return B(p, S, h, T, ae(H));
if (!H)
return new D(
"Invalid " + S + " `" + h + "` key `" + T + "` supplied to `" + p + "`.\nBad object: " + JSON.stringify(g[b], null, " ") + `
Valid keys: ` + JSON.stringify(Object.keys(t), null, " ")
);
var n = H(m, T, p, S, h + "." + T, I);
if (n)
return n;
}
return null;
}
return L(i);
}
function J(t) {
switch (typeof t) {
case "number":
case "string":
case "undefined":
return !0;
case "boolean":
return !t;
case "object":
if (Array.isArray(t))
return t.every(J);
if (t === null || l(t))
return !0;
var i = d(t);
if (i) {
var g = i.call(t), b;
if (i !== t.entries) {
for (; !(b = g.next()).done; )
if (!J(b.value))
return !1;
} else
for (; !(b = g.next()).done; ) {
var p = b.value;
if (p && !J(p[1]))
return !1;
}
} else
return !1;
return !0;
default:
return !1;
}
}
function se(t, i) {
return t === "symbol" ? !0 : i ? i["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && i instanceof Symbol : !1;
}
function ee(t) {
var i = typeof t;
return Array.isArray(t) ? "array" : t instanceof RegExp ? "object" : se(i, t) ? "symbol" : i;
}
function ae(t) {
if (typeof t > "u" || t === null)
return "" + t;
var i = ee(t);
if (i === "object") {
if (t instanceof Date)
return "date";
if (t instanceof RegExp)
return "regexp";
}
return i;
}
function le(t) {
var i = ae(t);
switch (i) {
case "array":
case "object":
return "an " + i;
case "boolean":
case "date":
case "regexp":
return "a " + i;
default:
return i;
}
}
function pe(t) {
return !t.constructor || !t.constructor.name ? k : t.constructor.name;
}
return F.checkPropTypes = x, F.resetWarningCache = x.resetWarningCache, F.PropTypes = F, F;
}, $e;
}
var Me, fr;
function Vr() {
if (fr) return Me;
fr = 1;
var s = Ye();
function Y() {
}
function I() {
}
return I.resetWarningCache = Y, Me = function() {
function v(P, l, y, _, u, d) {
if (d !== s) {
var k = new Error(
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
);
throw k.name = "Invariant Violation", k;
}
}
v.isRequired = v;
function x() {
return v;
}
var f = {
array: v,
bigint: v,
bool: v,
func: v,
number: v,
object: v,
string: v,
symbol: v,
any: v,
arrayOf: x,
element: v,
elementType: v,
instanceOf: x,
node: v,
objectOf: x,
oneOf: x,
oneOfType: x,
shape: x,
exact: x,
checkPropTypes: I,
resetWarningCache: Y
};
return f.PropTypes = f, f;
}, Me;
}
if (process.env.NODE_ENV !== "production") {
var zr = dr(), Br = !0;
Fe.exports = Nr()(zr.isElement, Br);
} else
Fe.exports = Vr()();
var Jr = Fe.exports;
const oe = /* @__PURE__ */ Dr(Jr), Kr = ({
firstImage: s,
secondImage: Y,
initialPosition: I = 50,
sliderColor: v = "white",
sliderWidth: x = 2,
buttonSize: f = 40,
width: P = "800px",
height: l = "400px",
className: y = "",
style: _ = {}
}) => {
const [u, d] = xe(I), [k, F] = xe(!0), [z, D] = xe(0), L = Ce(null), q = Ce(null), $ = Ce(!1), U = () => {
D((K) => K + 1);
}, W = (K) => {
console.error(`Failed to load image: ${K.target.src}`);
}, a = (K) => {
if (!$.current) return;
const B = L.current.getBoundingClientRect(), X = Math.max(0, Math.min(K.clientX - B.left, B.width)) / B.width * 100;
d(X);
}, re = () => {
$.current = !0;
}, ie = () => {
$.current = !1;
}, ce = (K) => {
if (!$.current) return;
const B = K.touches[0], Z = L.current.getBoundingClientRect(), J = Math.max(0, Math.min(B.clientX - Z.left, Z.width)) / Z.width * 100;
d(J);
}, fe = (K) => {
switch (K.key) {
case "ArrowLeft":
d((B) => Math.max(0, B - 1));
break;
case "ArrowRight":
d((B) => Math.min(100, B + 1));
break;
case "Home":
d(0);
break;
case "End":
d(100);
break;
}
};
return Qe(() => {
var X;
(X = q.current) == null || X.focus();
const K = L.current, B = (J) => {
J.preventDefault(), ce(J);
};
K.addEventListener("touchmove", B, {
passive: !1
});
const Z = () => {
$.current = !1;
};
return window.addEventListener("mouseup", Z), () => {
K.removeEventListener("touchmove", B), window.removeEventListener("mouseup", Z);
};
}, []), Qe(() => {
z === 2 && F(!1);
}, [z]), /* @__PURE__ */ ue.jsxs(
"div",
{
ref: L,
className: `dualvue-container ${y}`,
style: {
width: P,
height: l,
margin: "0 auto",
..._
},
onMouseMove: a,
onMouseUp: ie,
onMouseLeave: ie,
onTouchMove: ce,
onTouchStart: re,
onTouchEnd: ie,
children: [
k && /* @__PURE__ */ ue.jsx("div", { className: "dualvue-loading", children: "Loading..." }),
/* @__PURE__ */ ue.jsx("div", { className: "image-wrapper", children: /* @__PURE__ */ ue.jsx(
"img",
{
src: s,
alt: "First",
className: "dualvue-image",
onLoad: U,
onError: W
}
) }),
/* @__PURE__ */ ue.jsx(
"div",
{
className: "image-wrapper overlay",
style: { clipPath: `inset(0 ${100 - u}% 0 0)` },
children: /* @__PURE__ */ ue.jsx(
"img",
{
src: Y,
alt: "Second",
className: "dualvue-image",
onLoad: U,
onError: W
}
)
}
),
/* @__PURE__ */ ue.jsxs(
"div",
{
ref: q,
className: "dualvue-slider",
style: { left: `${u}%` },
onMouseDown: re,
tabIndex: 0,
onKeyDown: fe,
role: "slider",
"aria-label": "Image comparison slider",
"aria-valuenow": u,
"aria-valuemin": 0,
"aria-valuemax": 100,
children: [
/* @__PURE__ */ ue.jsx(
"div",
{
className: "slider-bar",
style: { backgroundColor: v, width: `${x}px` }
}
),
/* @__PURE__ */ ue.jsx(
"div",
{
className: "slider-button",
style: { width: `${f}px`, height: `${f}px` }
}
)
]
}
)
]
}
);
};
Kr.propTypes = {
firstImage: oe.string.isRequired,
secondImage: oe.string.isRequired,
initialPosition: oe.number,
sliderColor: oe.string,
sliderWidth: oe.number,
buttonSize: oe.number,
width: oe.string,
height: oe.string,
className: oe.string,
style: oe.object
};
export {
Kr as DualVue
};