Files

587 lines
20 KiB
JavaScript

!(function (n, t) {
'object' == typeof exports && 'undefined' != typeof module
? t(exports, require('preact'), require('preact/hooks'))
: 'function' == typeof define && define.amd
? define(['exports', 'preact', 'preact/hooks'], t)
: t(((n || self).preactCompat = {}), n.preact, n.preactHooks)
})(this, function (n, t, e) {
function r(n, t) {
for (var e in t) n[e] = t[e]
return n
}
function u(n, t) {
for (var e in n) if ('__source' !== e && !(e in t)) return !0
for (var r in t) if ('__source' !== r && n[r] !== t[r]) return !0
return !1
}
function o(n) {
this.props = n
}
function i(n, e) {
function r(n) {
var t = this.props.ref,
r = t == n.ref
return (!r && t && (t.call ? t(null) : (t.current = null)), e ? !e(this.props, n) || !r : u(this.props, n))
}
function o(e) {
return ((this.shouldComponentUpdate = r), t.createElement(n, e))
}
return (
(o.displayName = 'Memo(' + (n.displayName || n.name) + ')'),
(o.prototype.isReactComponent = !0),
(o.__f = !0),
o
)
}
;(((o.prototype = new t.Component()).isPureReactComponent = !0),
(o.prototype.shouldComponentUpdate = function (n, t) {
return u(this.props, n) || u(this.state, t)
}))
var c = t.options.__b
t.options.__b = function (n) {
;(n.type && n.type.__f && n.ref && ((n.props.ref = n.ref), (n.ref = null)), c && c(n))
}
var l = ('undefined' != typeof Symbol && Symbol.for && Symbol.for('react.forward_ref')) || 3911
function f(n) {
function t(t) {
var e = r({}, t)
return (delete e.ref, n(e, t.ref || null))
}
return (
(t.$$typeof = l),
(t.render = t),
(t.prototype.isReactComponent = t.__f = !0),
(t.displayName = 'ForwardRef(' + (n.displayName || n.name) + ')'),
t
)
}
var a = function (n, e) {
return null == n ? null : t.toChildArray(t.toChildArray(n).map(e))
},
s = {
map: a,
forEach: a,
count: function (n) {
return n ? t.toChildArray(n).length : 0
},
only: function (n) {
var e = t.toChildArray(n)
if (1 !== e.length) throw 'Children.only'
return e[0]
},
toArray: t.toChildArray,
},
h = t.options.__e
t.options.__e = function (n, t, e, r) {
if (n.then)
for (var u, o = t; (o = o.__); )
if ((u = o.__c) && u.__c) return (null == t.__e && ((t.__e = e.__e), (t.__k = e.__k)), u.__c(n, t))
h(n, t, e, r)
}
var d = t.options.unmount
function v(n, t, e) {
return (
n &&
(n.__c &&
n.__c.__H &&
(n.__c.__H.__.forEach(function (n) {
'function' == typeof n.__c && n.__c()
}),
(n.__c.__H = null)),
null != (n = r({}, n)).__c && (n.__c.__P === e && (n.__c.__P = t), (n.__c = null)),
(n.__k =
n.__k &&
n.__k.map(function (n) {
return v(n, t, e)
}))),
n
)
}
function p(n, t, e) {
return (
n &&
e &&
((n.__v = null),
(n.__k =
n.__k &&
n.__k.map(function (n) {
return p(n, t, e)
})),
n.__c && n.__c.__P === t && (n.__e && e.appendChild(n.__e), (n.__c.__e = !0), (n.__c.__P = e))),
n
)
}
function m() {
;((this.__u = 0), (this.t = null), (this.__b = null))
}
function b(n) {
var t = n.__.__c
return t && t.__a && t.__a(n)
}
function y(n) {
var e, r, u
function o(o) {
if (
(e ||
(e = n()).then(
function (n) {
r = n.default || n
},
function (n) {
u = n
}
),
u)
)
throw u
if (!r) throw e
return t.createElement(r, o)
}
return ((o.displayName = 'Lazy'), (o.__f = !0), o)
}
function _() {
;((this.u = null), (this.o = null))
}
;((t.options.unmount = function (n) {
var t = n.__c
;(t && t.__R && t.__R(), t && 32 & n.__u && (n.type = null), d && d(n))
}),
((m.prototype = new t.Component()).__c = function (n, t) {
var e = t.__c,
r = this
;(null == r.t && (r.t = []), r.t.push(e))
var u = b(r.__v),
o = !1,
i = function () {
o || ((o = !0), (e.__R = null), u ? u(c) : c())
}
e.__R = i
var c = function () {
if (!--r.__u) {
if (r.state.__a) {
var n = r.state.__a
r.__v.__k[0] = p(n, n.__c.__P, n.__c.__O)
}
var t
for (r.setState({ __a: (r.__b = null) }); (t = r.t.pop()); ) t.forceUpdate()
}
}
;(r.__u++ || 32 & t.__u || r.setState({ __a: (r.__b = r.__v.__k[0]) }), n.then(i, i))
}),
(m.prototype.componentWillUnmount = function () {
this.t = []
}),
(m.prototype.render = function (n, e) {
if (this.__b) {
if (this.__v.__k) {
var r = document.createElement('div'),
u = this.__v.__k[0].__c
this.__v.__k[0] = v(this.__b, r, (u.__O = u.__P))
}
this.__b = null
}
var o = e.__a && t.createElement(t.Fragment, null, n.fallback)
return (o && (o.__u &= -33), [t.createElement(t.Fragment, null, e.__a ? null : n.children), o])
}))
var g = function (n, t, e) {
if ((++e[1] === e[0] && n.o.delete(t), n.props.revealOrder && ('t' !== n.props.revealOrder[0] || !n.o.size)))
for (e = n.u; e; ) {
for (; e.length > 3; ) e.pop()()
if (e[1] < e[0]) break
n.u = e = e[2]
}
}
function S(n) {
return (
(this.getChildContext = function () {
return n.context
}),
n.children
)
}
function C(n) {
var e = this,
r = n.i
;((e.componentWillUnmount = function () {
;(t.render(null, e.l), (e.l = null), (e.i = null))
}),
e.i && e.i !== r && e.componentWillUnmount(),
e.l ||
((e.i = r),
(e.l = {
nodeType: 1,
parentNode: r,
childNodes: [],
appendChild: function (n) {
;(this.childNodes.push(n), e.i.appendChild(n))
},
insertBefore: function (n, t) {
;(this.childNodes.push(n), e.i.appendChild(n))
},
removeChild: function (n) {
;(this.childNodes.splice(this.childNodes.indexOf(n) >>> 1, 1), e.i.removeChild(n))
},
})),
t.render(t.createElement(S, { context: e.context }, n.__v), e.l))
}
function E(n, e) {
var r = t.createElement(C, { __v: n, i: e })
return ((r.containerInfo = e), r)
}
;(((_.prototype = new t.Component()).__a = function (n) {
var t = this,
e = b(t.__v),
r = t.o.get(n)
return (
r[0]++,
function (u) {
var o = function () {
t.props.revealOrder ? (r.push(u), g(t, n, r)) : u()
}
e ? e(o) : o()
}
)
}),
(_.prototype.render = function (n) {
;((this.u = null), (this.o = new Map()))
var e = t.toChildArray(n.children)
n.revealOrder && 'b' === n.revealOrder[0] && e.reverse()
for (var r = e.length; r--; ) this.o.set(e[r], (this.u = [1, 0, this.u]))
return n.children
}),
(_.prototype.componentDidUpdate = _.prototype.componentDidMount =
function () {
var n = this
this.o.forEach(function (t, e) {
g(n, e, t)
})
}))
var O = ('undefined' != typeof Symbol && Symbol.for && Symbol.for('react.element')) || 60103,
w =
/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,
x = /^on(Ani|Tra|Tou|BeforeInp|Compo)/,
R = /[A-Z0-9]/g,
j = 'undefined' != typeof document,
N = function (n) {
return ('undefined' != typeof Symbol && 'symbol' == typeof Symbol() ? /fil|che|rad/ : /fil|che|ra/).test(n)
}
function T(n, e, r) {
return (null == e.__k && (e.textContent = ''), t.render(n, e), 'function' == typeof r && r(), n ? n.__c : null)
}
function k(n, e, r) {
return (t.hydrate(n, e), 'function' == typeof r && r(), n ? n.__c : null)
}
;((t.Component.prototype.isReactComponent = {}),
['componentWillMount', 'componentWillReceiveProps', 'componentWillUpdate'].forEach(function (n) {
Object.defineProperty(t.Component.prototype, n, {
configurable: !0,
get: function () {
return this['UNSAFE_' + n]
},
set: function (t) {
Object.defineProperty(this, n, { configurable: !0, writable: !0, value: t })
},
})
}))
var A = t.options.event
function F() {}
function I() {
return this.cancelBubble
}
function L() {
return this.defaultPrevented
}
t.options.event = function (n) {
return (
A && (n = A(n)),
(n.persist = F),
(n.isPropagationStopped = I),
(n.isDefaultPrevented = L),
(n.nativeEvent = n)
)
}
var U,
D = {
enumerable: !1,
configurable: !0,
get: function () {
return this.class
},
},
M = t.options.vnode
t.options.vnode = function (n) {
;('string' == typeof n.type &&
(function (n) {
var e = n.props,
r = n.type,
u = {}
for (var o in e) {
var i = e[o]
if (
!(
('value' === o && 'defaultValue' in e && null == i) ||
(j && 'children' === o && 'noscript' === r) ||
'class' === o ||
'className' === o
)
) {
var c = o.toLowerCase()
;('defaultValue' === o && 'value' in e && null == e.value
? (o = 'value')
: 'download' === o && !0 === i
? (i = '')
: 'ondoubleclick' === c
? (o = 'ondblclick')
: 'onchange' !== c || ('input' !== r && 'textarea' !== r) || N(e.type)
? 'onfocus' === c
? (o = 'onfocusin')
: 'onblur' === c
? (o = 'onfocusout')
: x.test(o)
? (o = c)
: -1 === r.indexOf('-') && w.test(o)
? (o = o.replace(R, '-$&').toLowerCase())
: null === i && (i = void 0)
: (c = o = 'oninput'),
'oninput' === c && u[(o = c)] && (o = 'oninputCapture'),
(u[o] = i))
}
}
;('select' == r &&
u.multiple &&
Array.isArray(u.value) &&
(u.value = t.toChildArray(e.children).forEach(function (n) {
n.props.selected = -1 != u.value.indexOf(n.props.value)
})),
'select' == r &&
null != u.defaultValue &&
(u.value = t.toChildArray(e.children).forEach(function (n) {
n.props.selected = u.multiple
? -1 != u.defaultValue.indexOf(n.props.value)
: u.defaultValue == n.props.value
})),
e.class && !e.className
? ((u.class = e.class), Object.defineProperty(u, 'className', D))
: ((e.className && !e.class) || (e.class && e.className)) &&
(u.class = u.className = e.className),
(n.props = u))
})(n),
(n.$$typeof = O),
M && M(n))
}
var V = t.options.__r
t.options.__r = function (n) {
;(V && V(n), (U = n.__c))
}
var W = t.options.diffed
t.options.diffed = function (n) {
W && W(n)
var t = n.props,
e = n.__e
;(null != e &&
'textarea' === n.type &&
'value' in t &&
t.value !== e.value &&
(e.value = null == t.value ? '' : t.value),
(U = null))
}
var P = {
ReactCurrentDispatcher: {
current: {
readContext: function (n) {
return U.__n[n.__c].props.value
},
},
},
},
z = '17.0.2'
function B(n) {
return t.createElement.bind(null, n)
}
function q(n) {
return !!n && n.$$typeof === O
}
function H(n) {
return q(n) && n.type === t.Fragment
}
function Z(n) {
return q(n) ? t.cloneElement.apply(null, arguments) : n
}
function Y(n) {
return !!n.__k && (t.render(null, n), !0)
}
function $(n) {
return (n && (n.base || (1 === n.nodeType && n))) || null
}
var G = function (n, t) {
return n(t)
},
J = function (n, t) {
return n(t)
},
K = t.Fragment
function Q(n) {
n()
}
function X(n) {
return n
}
function nn() {
return [!1, Q]
}
var tn = e.useLayoutEffect,
en = q
function rn(n, t) {
var r = t(),
u = e.useState({ h: { __: r, v: t } }),
o = u[0].h,
i = u[1]
return (
e.useLayoutEffect(
function () {
;((o.__ = r), (o.v = t), un(o) && i({ h: o }))
},
[n, r, t]
),
e.useEffect(
function () {
return (
un(o) && i({ h: o }),
n(function () {
un(o) && i({ h: o })
})
)
},
[n]
),
r
)
}
function un(n) {
var t,
e,
r = n.v,
u = n.__
try {
var o = r()
return !(((t = u) === (e = o) && (0 !== t || 1 / t == 1 / e)) || (t != t && e != e))
} catch (n) {
return !0
}
}
var on = {
useState: e.useState,
useId: e.useId,
useReducer: e.useReducer,
useEffect: e.useEffect,
useLayoutEffect: e.useLayoutEffect,
useInsertionEffect: tn,
useTransition: nn,
useDeferredValue: X,
useSyncExternalStore: rn,
startTransition: Q,
useRef: e.useRef,
useImperativeHandle: e.useImperativeHandle,
useMemo: e.useMemo,
useCallback: e.useCallback,
useContext: e.useContext,
useDebugValue: e.useDebugValue,
version: z,
Children: s,
render: T,
hydrate: k,
unmountComponentAtNode: Y,
createPortal: E,
createElement: t.createElement,
createContext: t.createContext,
createFactory: B,
cloneElement: Z,
createRef: t.createRef,
Fragment: t.Fragment,
isValidElement: q,
isElement: en,
isFragment: H,
findDOMNode: $,
Component: t.Component,
PureComponent: o,
memo: i,
forwardRef: f,
flushSync: J,
unstable_batchedUpdates: G,
StrictMode: K,
Suspense: m,
SuspenseList: _,
lazy: y,
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: P,
}
;(Object.defineProperty(n, 'Component', {
enumerable: !0,
get: function () {
return t.Component
},
}),
Object.defineProperty(n, 'Fragment', {
enumerable: !0,
get: function () {
return t.Fragment
},
}),
Object.defineProperty(n, 'createContext', {
enumerable: !0,
get: function () {
return t.createContext
},
}),
Object.defineProperty(n, 'createElement', {
enumerable: !0,
get: function () {
return t.createElement
},
}),
Object.defineProperty(n, 'createRef', {
enumerable: !0,
get: function () {
return t.createRef
},
}),
(n.Children = s),
(n.PureComponent = o),
(n.StrictMode = K),
(n.Suspense = m),
(n.SuspenseList = _),
(n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = P),
(n.cloneElement = Z),
(n.createFactory = B),
(n.createPortal = E),
(n.default = on),
(n.findDOMNode = $),
(n.flushSync = J),
(n.forwardRef = f),
(n.hydrate = k),
(n.isElement = en),
(n.isFragment = H),
(n.isValidElement = q),
(n.lazy = y),
(n.memo = i),
(n.render = T),
(n.startTransition = Q),
(n.unmountComponentAtNode = Y),
(n.unstable_batchedUpdates = G),
(n.useDeferredValue = X),
(n.useInsertionEffect = tn),
(n.useSyncExternalStore = rn),
(n.useTransition = nn),
(n.version = z),
Object.keys(e).forEach(function (t) {
'default' === t ||
n.hasOwnProperty(t) ||
Object.defineProperty(n, t, {
enumerable: !0,
get: function () {
return e[t]
},
})
}))
})
//# sourceMappingURL=compat.umd.js.map