isomorfeus-preact 10.6.62 → 10.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/lib/preact/component/callbacks.rb +2 -2
  3. data/lib/preact/version.rb +1 -1
  4. data/node_modules/.package-lock.json +40 -40
  5. data/node_modules/preact/compat/client.js +13 -0
  6. data/node_modules/preact/compat/client.mjs +13 -0
  7. data/node_modules/preact/compat/dist/compat.js +1 -1
  8. data/node_modules/preact/compat/dist/compat.js.map +1 -1
  9. data/node_modules/preact/compat/dist/compat.mjs +1 -1
  10. data/node_modules/preact/compat/dist/compat.module.js +1 -1
  11. data/node_modules/preact/compat/dist/compat.module.js.map +1 -1
  12. data/node_modules/preact/compat/dist/compat.umd.js +1 -1
  13. data/node_modules/preact/compat/dist/compat.umd.js.map +1 -1
  14. data/node_modules/preact/compat/src/forwardRef.js +2 -9
  15. data/node_modules/preact/compat/src/suspense.js +2 -2
  16. data/node_modules/preact/debug/dist/debug.js +1 -1
  17. data/node_modules/preact/debug/dist/debug.js.map +1 -1
  18. data/node_modules/preact/debug/dist/debug.mjs +1 -1
  19. data/node_modules/preact/debug/dist/debug.module.js +1 -1
  20. data/node_modules/preact/debug/dist/debug.module.js.map +1 -1
  21. data/node_modules/preact/debug/dist/debug.umd.js +1 -1
  22. data/node_modules/preact/debug/dist/debug.umd.js.map +1 -1
  23. data/node_modules/preact/debug/src/debug.js +4 -2
  24. data/node_modules/preact/devtools/dist/devtools.js +1 -1
  25. data/node_modules/preact/devtools/dist/devtools.js.map +1 -1
  26. data/node_modules/preact/devtools/dist/devtools.mjs +1 -1
  27. data/node_modules/preact/devtools/dist/devtools.module.js +1 -1
  28. data/node_modules/preact/devtools/dist/devtools.module.js.map +1 -1
  29. data/node_modules/preact/devtools/dist/devtools.umd.js +1 -1
  30. data/node_modules/preact/devtools/dist/devtools.umd.js.map +1 -1
  31. data/node_modules/preact/devtools/src/devtools.js +1 -1
  32. data/node_modules/preact/dist/preact.js +1 -1
  33. data/node_modules/preact/dist/preact.js.map +1 -1
  34. data/node_modules/preact/dist/preact.min.js +1 -1
  35. data/node_modules/preact/dist/preact.min.js.map +1 -1
  36. data/node_modules/preact/dist/preact.mjs +1 -1
  37. data/node_modules/preact/dist/preact.module.js +1 -1
  38. data/node_modules/preact/dist/preact.module.js.map +1 -1
  39. data/node_modules/preact/dist/preact.umd.js +1 -1
  40. data/node_modules/preact/dist/preact.umd.js.map +1 -1
  41. data/node_modules/preact/hooks/dist/hooks.js +1 -1
  42. data/node_modules/preact/hooks/dist/hooks.js.map +1 -1
  43. data/node_modules/preact/hooks/dist/hooks.mjs +1 -1
  44. data/node_modules/preact/hooks/dist/hooks.module.js +1 -1
  45. data/node_modules/preact/hooks/dist/hooks.module.js.map +1 -1
  46. data/node_modules/preact/hooks/dist/hooks.umd.js +1 -1
  47. data/node_modules/preact/hooks/dist/hooks.umd.js.map +1 -1
  48. data/node_modules/preact/hooks/src/index.js +7 -2
  49. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js +1 -1
  50. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.js.map +1 -1
  51. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs +1 -1
  52. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js +1 -1
  53. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js.map +1 -1
  54. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js +1 -1
  55. data/node_modules/preact/jsx-runtime/dist/jsxRuntime.umd.js.map +1 -1
  56. data/node_modules/preact/jsx-runtime/src/index.js +2 -2
  57. data/node_modules/preact/package.json +35 -30
  58. data/node_modules/preact/src/diff/catch-error.js +4 -2
  59. data/node_modules/preact/src/diff/props.js +1 -1
  60. data/node_modules/preact/src/index.d.ts +5 -1
  61. data/node_modules/preact/src/internal.d.ts +10 -1
  62. data/node_modules/preact/src/jsx.d.ts +2 -0
  63. data/node_modules/preact-render-to-string/dist/commonjs.js +1 -1
  64. data/node_modules/preact-render-to-string/dist/commonjs.js.map +1 -1
  65. data/node_modules/preact-render-to-string/dist/index.js.map +1 -1
  66. data/node_modules/preact-render-to-string/dist/index.mjs +1 -1
  67. data/node_modules/preact-render-to-string/dist/index.module.js +1 -1
  68. data/node_modules/preact-render-to-string/dist/index.module.js.map +1 -1
  69. data/node_modules/preact-render-to-string/dist/jsx-entry.js +1 -1
  70. data/node_modules/preact-render-to-string/dist/jsx-entry.js.map +1 -1
  71. data/node_modules/preact-render-to-string/dist/jsx.js.map +1 -1
  72. data/node_modules/preact-render-to-string/dist/jsx.mjs +1 -1
  73. data/node_modules/preact-render-to-string/dist/jsx.modern.js +1 -1
  74. data/node_modules/preact-render-to-string/dist/jsx.modern.js.map +1 -1
  75. data/node_modules/preact-render-to-string/dist/jsx.module.js +1 -1
  76. data/node_modules/preact-render-to-string/dist/jsx.module.js.map +1 -1
  77. data/node_modules/preact-render-to-string/package.json +1 -1
  78. data/node_modules/preact-render-to-string/src/index.js +8 -3
  79. data/package.json +2 -2
  80. metadata +22 -14
@@ -1,2 +1,2 @@
1
- !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(n.preactHooks={},n.preact)}(this,function(n,t){var u,o,r,i=0,c=[],f=t.options.__b,e=t.options.__r,a=t.options.diffed,v=t.options.__c,p=t.options.unmount;function l(n,u){t.options.__h&&t.options.__h(o,n,i||u),i=0;var r=o.__H||(o.__H={__:[],__h:[]});return n>=r.__.length&&r.__.push({}),r.__[n]}function m(n){return i=1,y(F,n)}function y(n,t,r){var i=l(u++,2);return i.t=n,i.__c||(i.__=[r?r(t):F(void 0,t),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}))}],i.__c=o),i.__}function d(n,r){var i=l(u++,4);!t.options.__s&&A(i.__H,r)&&(i.__=n,i.__H=r,o.__h.push(i))}function s(n,t){var o=l(u++,7);return A(o.__H,t)&&(o.__=n(),o.__H=t,o.__h=n),o.__}function h(){for(var n;n=c.shift();)if(n.__P)try{n.__H.__h.forEach(q),n.__H.__h.forEach(x),n.__H.__h=[]}catch(u){n.__H.__h=[],t.options.__e(u,n.__v)}}t.options.__b=function(n){o=null,f&&f(n)},t.options.__r=function(n){e&&e(n),u=0;var t=(o=n.__c).__H;t&&(t.__h.forEach(q),t.__h.forEach(x),t.__h=[])},t.options.diffed=function(n){a&&a(n);var u=n.__c;u&&u.__H&&u.__H.__h.length&&(1!==c.push(u)&&r===t.options.requestAnimationFrame||((r=t.options.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(o),_&&cancelAnimationFrame(t),setTimeout(n)},o=setTimeout(u,100);_&&(t=requestAnimationFrame(u))})(h)),o=null},t.options.__c=function(n,u){u.some(function(n){try{n.__h.forEach(q),n.__h=n.__h.filter(function(n){return!n.__||x(n)})}catch(o){u.some(function(n){n.__h&&(n.__h=[])}),u=[],t.options.__e(o,n.__v)}}),v&&v(n,u)},t.options.unmount=function(n){p&&p(n);var u,o=n.__c;o&&o.__H&&(o.__H.__.forEach(function(n){try{q(n)}catch(n){u=n}}),u&&t.options.__e(u,o.__v))};var _="function"==typeof requestAnimationFrame;function q(n){var t=o,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),o=t}function x(n){var t=o;n.__c=n.__(),o=t}function A(n,t){return!n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function F(n,t){return"function"==typeof t?t(n):t}n.useState=m,n.useReducer=y,n.useEffect=function(n,r){var i=l(u++,3);!t.options.__s&&A(i.__H,r)&&(i.__=n,i.__H=r,o.__H.__h.push(i))},n.useLayoutEffect=d,n.useRef=function(n){return i=5,s(function(){return{current:n}},[])},n.useImperativeHandle=function(n,t,u){i=6,d(function(){"function"==typeof n?n(t()):n&&(n.current=t())},null==u?u:u.concat(n))},n.useMemo=s,n.useCallback=function(n,t){return i=8,s(function(){return n},t)},n.useContext=function(n){var t=o.context[n.__c],r=l(u++,9);return r.c=n,t?(null==r.__&&(r.__=!0,t.sub(o)),t.props.value):n.__},n.useDebugValue=function(n,u){t.options.useDebugValue&&t.options.useDebugValue(u?u(n):n)},n.useErrorBoundary=function(n){var t=l(u++,10),r=m();return t.__=n,o.componentDidCatch||(o.componentDidCatch=function(n){t.__&&t.__(n),r[1](n)}),[r[0],function(){r[1](void 0)}]}});
1
+ !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t(n.preactHooks={},n.preact)}(this,function(n,t){var u,r,o,i=0,c=[],f=t.options.__b,e=t.options.__r,a=t.options.diffed,v=t.options.__c,l=t.options.unmount;function p(n,u){t.options.__h&&t.options.__h(r,n,i||u),i=0;var o=r.__H||(r.__H={__:[],__h:[]});return n>=o.__.length&&o.__.push({}),o.__[n]}function d(n){return i=1,m(F,n)}function m(n,t,o){var i=p(u++,2);return i.t=n,i.__c||(i.__=[o?o(t):F(void 0,t),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}))}],i.__c=r),i.__}function y(n,o){var i=p(u++,4);!t.options.__s&&A(i.__H,o)&&(i.__=n,i.__H=o,r.__h.push(i))}function s(n,t){var r=p(u++,7);return A(r.__H,t)&&(r.__=n(),r.__H=t,r.__h=n),r.__}function h(){for(var n;n=c.shift();)if(n.__P)try{n.__H.__h.forEach(q),n.__H.__h.forEach(x),n.__H.__h=[]}catch(u){n.__H.__h=[],t.options.__e(u,n.__v)}}t.options.__b=function(n){r=null,f&&f(n)},t.options.__r=function(n){e&&e(n),u=0;var t=(r=n.__c).__H;t&&(t.__h.forEach(q),t.__h.forEach(x),t.__h=[])},t.options.diffed=function(n){a&&a(n);var u=n.__c;u&&u.__H&&u.__H.__h.length&&(1!==c.push(u)&&o===t.options.requestAnimationFrame||((o=t.options.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),_&&cancelAnimationFrame(t),setTimeout(n)},r=setTimeout(u,100);_&&(t=requestAnimationFrame(u))})(h)),r=null},t.options.__c=function(n,u){u.some(function(n){try{n.__h.forEach(q),n.__h=n.__h.filter(function(n){return!n.__||x(n)})}catch(r){u.some(function(n){n.__h&&(n.__h=[])}),u=[],t.options.__e(r,n.__v)}}),v&&v(n,u)},t.options.unmount=function(n){l&&l(n);var u,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{q(n)}catch(n){u=n}}),u&&t.options.__e(u,r.__v))};var _="function"==typeof requestAnimationFrame;function q(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t}function x(n){var t=r;n.__c=n.__(),r=t}function A(n,t){return!n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function F(n,t){return"function"==typeof t?t(n):t}n.useState=d,n.useReducer=m,n.useEffect=function(n,o){var i=p(u++,3);!t.options.__s&&A(i.__H,o)&&(i.__=n,i.__H=o,r.__H.__h.push(i))},n.useLayoutEffect=y,n.useRef=function(n){return i=5,s(function(){return{current:n}},[])},n.useImperativeHandle=function(n,t,u){i=6,y(function(){return"function"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==u?u:u.concat(n))},n.useMemo=s,n.useCallback=function(n,t){return i=8,s(function(){return n},t)},n.useContext=function(n){var t=r.context[n.__c],o=p(u++,9);return o.c=n,t?(null==o.__&&(o.__=!0,t.sub(r)),t.props.value):n.__},n.useDebugValue=function(n,u){t.options.useDebugValue&&t.options.useDebugValue(u?u(n):n)},n.useErrorBoundary=function(n){var t=p(u++,10),o=d();return t.__=n,r.componentDidCatch||(r.componentDidCatch=function(n){t.__&&t.__(n),o[1](n)}),[o[0],function(){o[1](void 0)}]}});
2
2
  //# sourceMappingURL=hooks.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\n\nconst RAF_TIMEOUT = 100;\nlet prevRaf;\n\noptions._diff = vnode => {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\thooks._pendingEffects.forEach(invokeCleanup);\n\t\thooks._pendingEffects.forEach(invokeEffect);\n\t\thooks._pendingEffects = [];\n\t}\n};\n\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks && c.__hooks._pendingEffects.length) {\n\t\tafterPaint(afterPaintEffects.push(c));\n\t}\n\tcurrentComponent = null;\n};\n\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.forEach(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({});\n\t}\n\treturn hooks._list[index];\n}\n\n/**\n * @param {import('./index').StateUpdater<any>} [initialState]\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @param {import('./index').Reducer<any, any>} reducer\n * @param {import('./index').StateUpdater<any>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ any, (state: any) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst nextValue = hookState._reducer(hookState._value[0], action);\n\t\t\t\tif (hookState._value[0] !== nextValue) {\n\t\t\t\t\thookState._value = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\t}\n\n\treturn hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._args = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._args = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {any[]} args\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') ref(createHandle());\n\t\t\telse if (ref) ref.current = createHandle();\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @param {() => any} factory\n * @param {any[]} args\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._value = factory();\n\t\tstate._args = args;\n\t\tstate._factory = factory;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {any[]} args\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(formatter ? formatter(value) : value);\n\t}\n}\n\n/**\n * @param {(error: any) => void} cb\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = err => {\n\t\t\tif (state._value) state._value(err);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tif (!component._parentDom) continue;\n\t\ttry {\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {any[]} oldArgs\n * @param {any[]} newArgs\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n"],"names":["currentIndex","currentComponent","prevRaf","currentHook","afterPaintEffects","oldBeforeDiff","options","oldBeforeRender","oldAfterDiff","diffed","oldCommit","oldBeforeUnmount","unmount","getHookState","index","type","hooks","length","push","useState","initialState","useReducer","invokeOrReturn","reducer","init","hookState","_reducer","undefined","action","nextValue","setState","useLayoutEffect","callback","args","state","argsChanged","useMemo","factory","flushAfterPaintEffects","component","shift","forEach","invokeCleanup","invokeEffect","e","vnode","c","requestAnimationFrame","raf","done","clearTimeout","timeout","HAS_RAF","cancelAnimationFrame","setTimeout","commitQueue","some","filter","cb","hasErrored","s","hook","comp","cleanup","oldArgs","newArgs","arg","f","initialValue","current","ref","createHandle","concat","context","provider","sub","props","value","formatter","useDebugValue","errState","componentDidCatch","err"],"mappings":"uNAGA,IAAIA,EAGAC,EAeAC,EAZAC,EAAc,EAGdC,EAAoB,GAEpBC,EAAgBC,cAChBC,EAAkBD,cAClBE,EAAeF,UAAQG,OACvBC,EAAYJ,cACZK,EAAmBL,UAAQM,QA4E/B,SAASC,EAAaC,EAAOC,GACxBT,eACHA,cAAcL,EAAkBa,EAAOX,GAAeY,GAEvDZ,EAAc,MAORa,EACLf,QACCA,MAA2B,IACpB,OACU,YAGfa,GAASE,KAAYC,QACxBD,KAAYE,KAAK,IAEXF,KAAYF,GAMb,SAASK,EAASC,UACxBjB,EAAc,EACPkB,EAAWC,EAAgBF,GAS5B,SAASC,EAAWE,EAASH,EAAcI,OAE3CC,EAAYZ,EAAab,IAAgB,UAC/CyB,EAAUC,EAAWH,EAChBE,QACJA,KAAmB,CACjBD,EAAiDA,EAAKJ,GAA/CE,OAAeK,EAAWP,GAElC,SAAAQ,OACOC,EAAYJ,EAAUC,EAASD,KAAiB,GAAIG,GACtDH,KAAiB,KAAOI,IAC3BJ,KAAmB,CAACI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,UAI3CkC,IAAiBuC,EACZC,GAEe,MAAhBxC,OACHA,MAAe,EACfwC,EAASC,IAAI1E,IAEPyE,EAASE,MAAMC,OANAJ,sBAahB,SAAuBI,EAAOC,GAChCxE,UAAQyE,eACXzE,UAAQyE,cAAcD,EAAYA,EAAUD,GAASA,uBAOhD,SAA0BnB,OAE1BxB,EAAQrB,EAAab,IAAgB,IACrCgF,EAAW7D,WACjBe,KAAewB,EACVzD,EAAiBgF,oBACrBhF,EAAiBgF,kBAAoB,SAAAC,GAChChD,MAAcA,KAAagD,GAC/BF,EAAS,GAAGE,KAGP,CACNF,EAAS,GACT,WACCA,EAAS,QAAGrD"}
1
+ {"version":3,"file":"hooks.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array<import('./internal').Component>} */\nlet afterPaintEffects = [];\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\n\nconst RAF_TIMEOUT = 100;\nlet prevRaf;\n\noptions._diff = vnode => {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._render = vnode => {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\thooks._pendingEffects.forEach(invokeCleanup);\n\t\thooks._pendingEffects.forEach(invokeEffect);\n\t\thooks._pendingEffects = [];\n\t}\n};\n\noptions.diffed = vnode => {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks && c.__hooks._pendingEffects.length) {\n\t\tafterPaint(afterPaintEffects.push(c));\n\t}\n\tcurrentComponent = null;\n};\n\noptions._commit = (vnode, commitQueue) => {\n\tcommitQueue.some(component => {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.forEach(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =>\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c => {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\noptions.unmount = vnode => {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c && c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.forEach(s => {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index >= hooks._list.length) {\n\t\thooks._list.push({});\n\t}\n\treturn hooks._list[index];\n}\n\n/**\n * @param {import('./index').StateUpdater<any>} [initialState]\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @param {import('./index').Reducer<any, any>} reducer\n * @param {import('./index').StateUpdater<any>} initialState\n * @param {(initialState: any) => void} [init]\n * @returns {[ any, (state: any) => void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction => {\n\t\t\t\tconst nextValue = hookState._reducer(hookState._value[0], action);\n\t\t\t\tif (hookState._value[0] !== nextValue) {\n\t\t\t\t\thookState._value = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\t}\n\n\treturn hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._args = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {any[]} args\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects && argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._args = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() => ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() => object} createHandle\n * @param {any[]} args\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() => {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tref(createHandle());\n\t\t\t\treturn () => ref(null);\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () => ref.current = null;\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @param {() => any} factory\n * @param {any[]} args\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._value = factory();\n\t\tstate._args = args;\n\t\tstate._factory = factory;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() => void} callback\n * @param {any[]} args\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() => callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {<T>(value: T, cb?: (value: T) => string | number) => void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(formatter ? formatter(value) : value);\n\t}\n}\n\n/**\n * @param {(error: any) => void} cb\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = err => {\n\t\t\tif (state._value) state._value(err);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() => {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tif (!component._parentDom) continue;\n\t\ttry {\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeCleanup);\n\t\t\tcomponent.__hooks._pendingEffects.forEach(invokeEffect);\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\tcomponent.__hooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() => void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () => {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {any[]} oldArgs\n * @param {any[]} newArgs\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) => arg !== oldArgs[index])\n\t);\n}\n\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n"],"names":["currentIndex","currentComponent","prevRaf","currentHook","afterPaintEffects","oldBeforeDiff","options","oldBeforeRender","oldAfterDiff","diffed","oldCommit","oldBeforeUnmount","unmount","getHookState","index","type","hooks","length","push","useState","initialState","useReducer","invokeOrReturn","reducer","init","hookState","_reducer","undefined","action","nextValue","setState","useLayoutEffect","callback","args","state","argsChanged","useMemo","factory","flushAfterPaintEffects","component","shift","forEach","invokeCleanup","invokeEffect","e","vnode","c","requestAnimationFrame","raf","done","clearTimeout","timeout","HAS_RAF","cancelAnimationFrame","setTimeout","commitQueue","some","filter","cb","hasErrored","s","hook","comp","cleanup","oldArgs","newArgs","arg","f","initialValue","current","ref","createHandle","concat","context","provider","sub","props","value","formatter","useDebugValue","errState","componentDidCatch","err"],"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T,KAAK,SAACU,EAAKpD,UAAUoD,IAAQF,EAAQlD,KAI/C,SAASQ,EAAe4C,EAAKC,SACT,mBAALA,EAAkBA,EAAED,GAAOC,0CAtOnC,SAAmBnC,EAAUC,OAE7BC,EAAQrB,EAAab,IAAgB,IACtCM,eAAwB6B,EAAYD,MAAaD,KACrDC,KAAeF,EACfE,MAAcD,EAEdhC,UAAyCiB,KAAKgB,kCAmBzC,SAAgBkC,UACtBjE,EAAc,EACPiC,EAAQ,iBAAO,CAAEiC,QAASD,IAAiB,2BAQ5C,SAA6BE,EAAKC,EAActC,GACtD9B,EAAc,EACd4B,EACC,iBACmB,mBAAPuC,GACVA,EAAIC,KACG,kBAAMD,EAAI,QACPA,GACVA,EAAID,QAAUE,IACP,kBAAMD,EAAID,QAAU,YAFrB,GAKA,MAARpC,EAAeA,EAAOA,EAAKuC,OAAOF,+BAwB7B,SAAqBtC,EAAUC,UACrC9B,EAAc,EACPiC,EAAQ,kBAAMJ,GAAUC,iBAMzB,SAAoBwC,OACpBC,EAAWzE,EAAiBwE,QAAQA,OAKpCvC,EAAQrB,EAAab,IAAgB,UAI3CkC,IAAiBuC,EACZC,GAEe,MAAhBxC,OACHA,MAAe,EACfwC,EAASC,IAAI1E,IAEPyE,EAASE,MAAMC,OANAJ,sBAahB,SAAuBI,EAAOC,GAChCxE,UAAQyE,eACXzE,UAAQyE,cAAcD,EAAYA,EAAUD,GAASA,uBAOhD,SAA0BnB,OAE1BxB,EAAQrB,EAAab,IAAgB,IACrCgF,EAAW7D,WACjBe,KAAewB,EACVzD,EAAiBgF,oBACrBhF,EAAiBgF,kBAAoB,SAAAC,GAChChD,MAAcA,KAAagD,GAC/BF,EAAS,GAAGE,KAGP,CACNF,EAAS,GACT,WACCA,EAAS,QAAGrD"}
@@ -197,8 +197,13 @@ export function useImperativeHandle(ref, createHandle, args) {
197
197
  currentHook = 6;
198
198
  useLayoutEffect(
199
199
  () => {
200
- if (typeof ref == 'function') ref(createHandle());
201
- else if (ref) ref.current = createHandle();
200
+ if (typeof ref == 'function') {
201
+ ref(createHandle());
202
+ return () => ref(null);
203
+ } else if (ref) {
204
+ ref.current = createHandle();
205
+ return () => ref.current = null;
206
+ }
202
207
  },
203
208
  args == null ? args : args.concat(ref)
204
209
  );
@@ -1,2 +1,2 @@
1
- var r=require("preact"),_=0;function e(e,o,n,t,l){var u,f,i={};for(f in o)"ref"==f?u=o[f]:i[f]=o[f];var p={type:e,props:i,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--_,__source:t,__self:l};if("function"==typeof e&&(u=e.defaultProps))for(f in u)void 0===i[f]&&(i[f]=u[f]);return r.options.vnode&&r.options.vnode(p),p}exports.Fragment=r.Fragment,exports.jsx=e,exports.jsxs=e,exports.jsxDEV=e;
1
+ var r=require("preact"),_=0;function e(e,o,n,t,l){var u,f,i={};for(f in o)"ref"==f?u=o[f]:i[f]=o[f];var p={type:e,props:i,key:n,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--_,__source:l,__self:t};if("function"==typeof e&&(u=e.defaultProps))for(f in u)void 0===i[f]&&(i[f]=u[f]);return r.options.vnode&&r.options.vnode(p),p}exports.Fragment=r.Fragment,exports.jsx=e,exports.jsxs=e,exports.jsxDEV=e;
2
2
  //# sourceMappingURL=jsxRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsxRuntime.js","sources":["../src/index.js"],"sourcesContent":["import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__source]\n * @param {string} [__self]\n */\nfunction createVNode(type, props, key, __source, __self) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {},\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'ref') {\n\t\t\tref = props[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n"],"names":["vnodeId","createVNode","type","props","key","__source","__self","ref","i","normalizedProps","vnode","undefined","constructor","defaultProps","options"],"mappings":"wBAIIA,EAAU,EAqBd,SAASC,EAAYC,EAAMC,EAAOC,EAAKC,EAAUC,OAK/CC,EACAC,EAFGC,EAAkB,OAGjBD,KAAKL,EACA,OAALK,EACHD,EAAMJ,EAAMK,GAEZC,EAAgBD,GAAKL,EAAMK,OAIvBE,EAAQ,CACbR,KAAAA,EACAC,MAAOM,EACPL,IAAAA,EACAG,IAAAA,MACW,QACF,SACD,MACF,cACII,MACE,SACA,KACZC,iBAAaD,QACAX,EACbK,SAAAA,EACAC,OAAAA,MAKmB,mBAATJ,IAAwBK,EAAML,EAAKW,kBACxCL,KAAKD,OACyB,IAAvBE,EAAgBD,KAC1BC,EAAgBD,GAAKD,EAAIC,WAIxBM,UAAQJ,OAAOI,UAAQJ,MAAMA,GAC1BA"}
1
+ {"version":3,"file":"jsxRuntime.js","sources":["../src/index.js"],"sourcesContent":["import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__self]\n * @param {string} [__source]\n */\nfunction createVNode(type, props, key, __self, __source) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {},\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'ref') {\n\t\t\tref = props[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n"],"names":["vnodeId","createVNode","type","props","key","__self","__source","ref","i","normalizedProps","vnode","undefined","constructor","defaultProps","options"],"mappings":"wBAIIA,EAAU,EAqBd,SAASC,EAAYC,EAAMC,EAAOC,EAAKC,EAAQC,OAK7CC,EACAC,EAFGC,EAAkB,OAGjBD,KAAKL,EACA,OAALK,EACHD,EAAMJ,EAAMK,GAEZC,EAAgBD,GAAKL,EAAMK,OAIvBE,EAAQ,CACbR,KAAAA,EACAC,MAAOM,EACPL,IAAAA,EACAG,IAAAA,MACW,QACF,SACD,MACF,cACII,MACE,SACA,KACZC,iBAAaD,QACAX,EACbM,SAAAA,EACAD,OAAAA,MAKmB,mBAATH,IAAwBK,EAAML,EAAKW,kBACxCL,KAAKD,OACyB,IAAvBE,EAAgBD,KAC1BC,EAAgBD,GAAKD,EAAIC,WAIxBM,UAAQJ,OAAOI,UAAQJ,MAAMA,GAC1BA"}
@@ -1,2 +1,2 @@
1
- import{options as r,Fragment as _}from"preact";export{Fragment}from"preact";var o=0;function e(_,e,n,t,f){var l,s,u={};for(s in e)"ref"==s?l=e[s]:u[s]=e[s];var a={type:_,props:u,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--o,__source:t,__self:f};if("function"==typeof _&&(l=_.defaultProps))for(s in l)void 0===u[s]&&(u[s]=l[s]);return r.vnode&&r.vnode(a),a}export{e as jsx,e as jsxs,e as jsxDEV};
1
+ import{options as r,Fragment as _}from"preact";export{Fragment}from"preact";var o=0;function e(_,e,n,t,f){var l,s,u={};for(s in e)"ref"==s?l=e[s]:u[s]=e[s];var a={type:_,props:u,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--o,__source:f,__self:t};if("function"==typeof _&&(l=_.defaultProps))for(s in l)void 0===u[s]&&(u[s]=l[s]);return r.vnode&&r.vnode(a),a}export{e as jsx,e as jsxs,e as jsxDEV};
2
2
  //# sourceMappingURL=jsxRuntime.module.js.map
@@ -1,2 +1,2 @@
1
- import{options as r,Fragment as _}from"preact";export{Fragment}from"preact";var o=0;function e(_,e,n,t,f){var l,s,u={};for(s in e)"ref"==s?l=e[s]:u[s]=e[s];var a={type:_,props:u,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--o,__source:t,__self:f};if("function"==typeof _&&(l=_.defaultProps))for(s in l)void 0===u[s]&&(u[s]=l[s]);return r.vnode&&r.vnode(a),a}export{e as jsx,e as jsxs,e as jsxDEV};
1
+ import{options as r,Fragment as _}from"preact";export{Fragment}from"preact";var o=0;function e(_,e,n,t,f){var l,s,u={};for(s in e)"ref"==s?l=e[s]:u[s]=e[s];var a={type:_,props:u,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--o,__source:f,__self:t};if("function"==typeof _&&(l=_.defaultProps))for(s in l)void 0===u[s]&&(u[s]=l[s]);return r.vnode&&r.vnode(a),a}export{e as jsx,e as jsxs,e as jsxDEV};
2
2
  //# sourceMappingURL=jsxRuntime.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsxRuntime.module.js","sources":["../src/index.js"],"sourcesContent":["import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__source]\n * @param {string} [__self]\n */\nfunction createVNode(type, props, key, __source, __self) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {},\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'ref') {\n\t\t\tref = props[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n"],"names":["vnodeId","createVNode","type","props","key","__source","__self","ref","i","normalizedProps","vnode","undefined","constructor","defaultProps","options"],"mappings":"4EAIA,IAAIA,EAAU,EAqBd,SAASC,EAAYC,EAAMC,EAAOC,EAAKC,EAAUC,OAK/CC,EACAC,EAFGC,EAAkB,OAGjBD,KAAKL,EACA,OAALK,EACHD,EAAMJ,EAAMK,GAEZC,EAAgBD,GAAKL,EAAMK,OAIvBE,EAAQ,CACbR,KAAAA,EACAC,MAAOM,EACPL,IAAAA,EACAG,IAAAA,MACW,QACF,SACD,MACF,cACII,MACE,SACA,KACZC,iBAAaD,QACAX,EACbK,SAAAA,EACAC,OAAAA,MAKmB,mBAATJ,IAAwBK,EAAML,EAAKW,kBACxCL,KAAKD,OACyB,IAAvBE,EAAgBD,KAC1BC,EAAgBD,GAAKD,EAAIC,WAIxBM,EAAQJ,OAAOI,EAAQJ,MAAMA,GAC1BA"}
1
+ {"version":3,"file":"jsxRuntime.module.js","sources":["../src/index.js"],"sourcesContent":["import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__self]\n * @param {string} [__source]\n */\nfunction createVNode(type, props, key, __self, __source) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {},\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'ref') {\n\t\t\tref = props[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n"],"names":["vnodeId","createVNode","type","props","key","__self","__source","ref","i","normalizedProps","vnode","undefined","constructor","defaultProps","options"],"mappings":"4EAIA,IAAIA,EAAU,EAqBd,SAASC,EAAYC,EAAMC,EAAOC,EAAKC,EAAQC,OAK7CC,EACAC,EAFGC,EAAkB,OAGjBD,KAAKL,EACA,OAALK,EACHD,EAAMJ,EAAMK,GAEZC,EAAgBD,GAAKL,EAAMK,OAIvBE,EAAQ,CACbR,KAAAA,EACAC,MAAOM,EACPL,IAAAA,EACAG,IAAAA,MACW,QACF,SACD,MACF,cACII,MACE,SACA,KACZC,iBAAaD,QACAX,EACbM,SAAAA,EACAD,OAAAA,MAKmB,mBAATH,IAAwBK,EAAML,EAAKW,kBACxCL,KAAKD,OACyB,IAAvBE,EAAgBD,KAC1BC,EAAgBD,GAAKD,EAAIC,WAIxBM,EAAQJ,OAAOI,EAAQJ,MAAMA,GAC1BA"}
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],n):n(e.jsxRuntime={},e.preact)}(this,function(e,n){var o=0;function r(e,r,t,_,f){var i,u,c={};for(u in r)"ref"==u?i=r[u]:c[u]=r[u];var l={type:e,props:c,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--o,__source:_,__self:f};if("function"==typeof e&&(i=e.defaultProps))for(u in i)void 0===c[u]&&(c[u]=i[u]);return n.options.vnode&&n.options.vnode(l),l}e.Fragment=n.Fragment,e.jsx=r,e.jsxs=r,e.jsxDEV=r});
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],n):n(e.jsxRuntime={},e.preact)}(this,function(e,n){var o=0;function r(e,r,t,_,f){var i,u,c={};for(u in r)"ref"==u?i=r[u]:c[u]=r[u];var l={type:e,props:c,key:t,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--o,__source:f,__self:_};if("function"==typeof e&&(i=e.defaultProps))for(u in i)void 0===c[u]&&(c[u]=i[u]);return n.options.vnode&&n.options.vnode(l),l}e.Fragment=n.Fragment,e.jsx=r,e.jsxs=r,e.jsxDEV=r});
2
2
  //# sourceMappingURL=jsxRuntime.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsxRuntime.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__source]\n * @param {string} [__self]\n */\nfunction createVNode(type, props, key, __source, __self) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {},\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'ref') {\n\t\t\tref = props[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n"],"names":["vnodeId","createVNode","type","props","key","__source","__self","ref","i","normalizedProps","vnode","undefined","constructor","defaultProps","options"],"mappings":"sNAIA,IAAIA,EAAU,EAqBd,SAASC,EAAYC,EAAMC,EAAOC,EAAKC,EAAUC,OAK/CC,EACAC,EAFGC,EAAkB,OAGjBD,KAAKL,EACA,OAALK,EACHD,EAAMJ,EAAMK,GAEZC,EAAgBD,GAAKL,EAAMK,OAIvBE,EAAQ,CACbR,KAAAA,EACAC,MAAOM,EACPL,IAAAA,EACAG,IAAAA,MACW,QACF,SACD,MACF,cACII,MACE,SACA,KACZC,iBAAaD,QACAX,EACbK,SAAAA,EACAC,OAAAA,MAKmB,mBAATJ,IAAwBK,EAAML,EAAKW,kBACxCL,KAAKD,OACyB,IAAvBE,EAAgBD,KAC1BC,EAAgBD,GAAKD,EAAIC,WAIxBM,UAAQJ,OAAOI,UAAQJ,MAAMA,GAC1BA"}
1
+ {"version":3,"file":"jsxRuntime.umd.js","sources":["../src/index.js"],"sourcesContent":["import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__self]\n * @param {string} [__source]\n */\nfunction createVNode(type, props, key, __self, __source) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {},\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'ref') {\n\t\t\tref = props[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref,\n\t\t_children: null,\n\t\t_parent: null,\n\t\t_depth: 0,\n\t\t_dom: null,\n\t\t_nextDom: undefined,\n\t\t_component: null,\n\t\t_hydrating: null,\n\t\tconstructor: undefined,\n\t\t_original: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tif (typeof type === 'function' && (ref = type.defaultProps)) {\n\t\tfor (i in ref)\n\t\t\tif (typeof normalizedProps[i] === 'undefined') {\n\t\t\t\tnormalizedProps[i] = ref[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n"],"names":["vnodeId","createVNode","type","props","key","__self","__source","ref","i","normalizedProps","vnode","undefined","constructor","defaultProps","options"],"mappings":"sNAIA,IAAIA,EAAU,EAqBd,SAASC,EAAYC,EAAMC,EAAOC,EAAKC,EAAQC,OAK7CC,EACAC,EAFGC,EAAkB,OAGjBD,KAAKL,EACA,OAALK,EACHD,EAAMJ,EAAMK,GAEZC,EAAgBD,GAAKL,EAAMK,OAIvBE,EAAQ,CACbR,KAAAA,EACAC,MAAOM,EACPL,IAAAA,EACAG,IAAAA,MACW,QACF,SACD,MACF,cACII,MACE,SACA,KACZC,iBAAaD,QACAX,EACbM,SAAAA,EACAD,OAAAA,MAKmB,mBAATH,IAAwBK,EAAML,EAAKW,kBACxCL,KAAKD,OACyB,IAAvBE,EAAgBD,KAC1BC,EAAgBD,GAAKD,EAAIC,WAIxBM,UAAQJ,OAAOI,UAAQJ,MAAMA,GAC1BA"}
@@ -20,10 +20,10 @@ let vnodeId = 0;
20
20
  * @param {VNode['type']} type
21
21
  * @param {VNode['props']} props
22
22
  * @param {VNode['key']} [key]
23
- * @param {string} [__source]
24
23
  * @param {string} [__self]
24
+ * @param {string} [__source]
25
25
  */
26
- function createVNode(type, props, key, __source, __self) {
26
+ function createVNode(type, props, key, __self, __source) {
27
27
  // We'll want to preserve `ref` in props to get rid of the need for
28
28
  // forwardRef components in the future, but that should happen via
29
29
  // a separate PR.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "preact",
3
3
  "amdName": "preact",
4
- "version": "10.6.6",
4
+ "version": "10.7.1",
5
5
  "private": false,
6
6
  "description": "Fast 3kb React-compatible Virtual DOM library.",
7
7
  "main": "dist/preact.js",
@@ -19,60 +19,64 @@
19
19
  "./compat": {
20
20
  "browser": "./compat/dist/compat.module.js",
21
21
  "umd": "./compat/dist/compat.umd.js",
22
- "require": "./compat/dist/compat.js",
23
- "import": "./compat/dist/compat.mjs"
22
+ "import": "./compat/dist/compat.mjs",
23
+ "require": "./compat/dist/compat.js"
24
24
  },
25
25
  "./debug": {
26
26
  "browser": "./debug/dist/debug.module.js",
27
27
  "umd": "./debug/dist/debug.umd.js",
28
- "require": "./debug/dist/debug.js",
29
- "import": "./debug/dist/debug.mjs"
28
+ "import": "./debug/dist/debug.mjs",
29
+ "require": "./debug/dist/debug.js"
30
30
  },
31
31
  "./devtools": {
32
32
  "browser": "./devtools/dist/devtools.module.js",
33
33
  "umd": "./devtools/dist/devtools.umd.js",
34
- "require": "./devtools/dist/devtools.js",
35
- "import": "./devtools/dist/devtools.mjs"
34
+ "import": "./devtools/dist/devtools.mjs",
35
+ "require": "./devtools/dist/devtools.js"
36
36
  },
37
37
  "./hooks": {
38
38
  "browser": "./hooks/dist/hooks.module.js",
39
39
  "umd": "./hooks/dist/hooks.umd.js",
40
- "require": "./hooks/dist/hooks.js",
41
- "import": "./hooks/dist/hooks.mjs"
40
+ "import": "./hooks/dist/hooks.mjs",
41
+ "require": "./hooks/dist/hooks.js"
42
42
  },
43
43
  "./test-utils": {
44
44
  "browser": "./test-utils/dist/testUtils.module.js",
45
45
  "umd": "./test-utils/dist/testUtils.umd.js",
46
- "require": "./test-utils/dist/testUtils.js",
47
- "import": "./test-utils/dist/testUtils.mjs"
46
+ "import": "./test-utils/dist/testUtils.mjs",
47
+ "require": "./test-utils/dist/testUtils.js"
48
48
  },
49
49
  "./jsx-runtime": {
50
50
  "browser": "./jsx-runtime/dist/jsxRuntime.module.js",
51
51
  "umd": "./jsx-runtime/dist/jsxRuntime.umd.js",
52
- "require": "./jsx-runtime/dist/jsxRuntime.js",
53
- "import": "./jsx-runtime/dist/jsxRuntime.mjs"
52
+ "import": "./jsx-runtime/dist/jsxRuntime.mjs",
53
+ "require": "./jsx-runtime/dist/jsxRuntime.js"
54
54
  },
55
55
  "./jsx-dev-runtime": {
56
56
  "browser": "./jsx-runtime/dist/jsxRuntime.module.js",
57
57
  "umd": "./jsx-runtime/dist/jsxRuntime.umd.js",
58
- "require": "./jsx-runtime/dist/jsxRuntime.js",
59
- "import": "./jsx-runtime/dist/jsxRuntime.mjs"
58
+ "import": "./jsx-runtime/dist/jsxRuntime.mjs",
59
+ "require": "./jsx-runtime/dist/jsxRuntime.js"
60
+ },
61
+ "./compat/client": {
62
+ "import": "./compat/client.mjs",
63
+ "require": "./compat/client.js"
60
64
  },
61
65
  "./compat/server": {
62
- "require": "./compat/server.js",
63
- "import": "./compat/server.mjs"
66
+ "import": "./compat/server.mjs",
67
+ "require": "./compat/server.js"
64
68
  },
65
69
  "./compat/jsx-runtime": {
66
- "require": "./compat/jsx-runtime.js",
67
- "import": "./compat/jsx-runtime.mjs"
70
+ "import": "./compat/jsx-runtime.mjs",
71
+ "require": "./compat/jsx-runtime.js"
68
72
  },
69
73
  "./compat/jsx-dev-runtime": {
70
- "require": "./compat/jsx-dev-runtime.js",
71
- "import": "./compat/jsx-dev-runtime.mjs"
74
+ "import": "./compat/jsx-dev-runtime.mjs",
75
+ "require": "./compat/jsx-dev-runtime.js"
72
76
  },
73
77
  "./compat/scheduler": {
74
- "require": "./compat/scheduler.js",
75
- "import": "./compat/scheduler.mjs"
78
+ "import": "./compat/scheduler.mjs",
79
+ "require": "./compat/scheduler.js"
76
80
  },
77
81
  "./package.json": "./package.json",
78
82
  "./compat/package.json": "./compat/package.json",
@@ -190,6 +194,8 @@
190
194
  "dist",
191
195
  "compat/dist",
192
196
  "compat/src",
197
+ "compat/client.js",
198
+ "compat/client.mjs",
193
199
  "compat/server.js",
194
200
  "compat/server.mjs",
195
201
  "compat/scheduler.js",
@@ -251,23 +257,22 @@
251
257
  "babel-plugin-transform-rename-properties": "0.1.0",
252
258
  "benchmark": "^2.1.4",
253
259
  "chai": "^4.1.2",
254
- "check-export-map": "^1.2.0",
260
+ "check-export-map": "^1.3.0",
255
261
  "coveralls": "^3.0.0",
256
262
  "cross-env": "^7.0.2",
257
- "csstype": "^3.0.5",
258
263
  "diff": "^5.0.0",
259
- "errorstacks": "^2.3.0",
260
- "esbuild": "^0.12.24",
264
+ "errorstacks": "^2.4.0",
265
+ "esbuild": "^0.14.25",
261
266
  "eslint": "5.15.1",
262
267
  "eslint-config-developit": "^1.1.1",
263
268
  "eslint-config-prettier": "^6.5.0",
264
269
  "eslint-plugin-react": "7.12.4",
265
270
  "husky": "^4.3.0",
266
- "karma": "^6.3.4",
271
+ "karma": "^6.3.16",
267
272
  "karma-chai-sinon": "^0.1.5",
268
273
  "karma-chrome-launcher": "^3.1.0",
269
- "karma-coverage": "^2.0.3",
270
- "karma-esbuild": "^2.2.0",
274
+ "karma-coverage": "^2.1.0",
275
+ "karma-esbuild": "^2.2.4",
271
276
  "karma-mocha": "^2.0.1",
272
277
  "karma-mocha-reporter": "^2.2.5",
273
278
  "karma-sauce-launcher": "^4.3.4",
@@ -4,8 +4,10 @@
4
4
  * @param {import('../internal').VNode} vnode The vnode that threw
5
5
  * the error that was caught (except for unmounting when this parameter
6
6
  * is the highest parent that was being unmounted)
7
+ * @param {import('../internal').VNode} [oldVNode]
8
+ * @param {import('../internal').ErrorInfo} [errorInfo]
7
9
  */
8
- export function _catchError(error, vnode) {
10
+ export function _catchError(error, vnode, oldVNode, errorInfo) {
9
11
  /** @type {import('../internal').Component} */
10
12
  let component, ctor, handled;
11
13
 
@@ -20,7 +22,7 @@ export function _catchError(error, vnode) {
20
22
  }
21
23
 
22
24
  if (component.componentDidCatch != null) {
23
- component.componentDidCatch(error);
25
+ component.componentDidCatch(error, errorInfo || {});
24
26
  handled = component._dirty;
25
27
  }
26
28
 
@@ -106,7 +106,7 @@ export function setProperty(dom, name, value, oldValue, isSvg) {
106
106
  // Normalize incorrect prop usage for SVG:
107
107
  // - xlink:href / xlinkHref --> href (xlink:href was removed from SVG and isn't needed)
108
108
  // - className --> class
109
- name = name.replace(/xlink[H:h]/, 'h').replace(/sName$/, 's');
109
+ name = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');
110
110
  } else if (
111
111
  name !== 'href' &&
112
112
  name !== 'list' &&
@@ -68,6 +68,10 @@ export interface PreactDOMAttributes {
68
68
  };
69
69
  }
70
70
 
71
+ export interface ErrorInfo {
72
+ componentStack?: string;
73
+ }
74
+
71
75
  export type RenderableProps<P, RefType = any> = P &
72
76
  Readonly<Attributes & { children?: ComponentChildren; ref?: Ref<RefType> }>;
73
77
 
@@ -130,7 +134,7 @@ export interface Component<P = {}, S = {}> {
130
134
  previousState: Readonly<S>,
131
135
  snapshot: any
132
136
  ): void;
133
- componentDidCatch?(error: any, errorInfo: any): void;
137
+ componentDidCatch?(error: any, errorInfo: ErrorInfo): void;
134
138
  }
135
139
 
136
140
  export abstract class Component<P, S> {
@@ -20,6 +20,10 @@ export interface DevSource {
20
20
  lineNumber: number;
21
21
  }
22
22
 
23
+ export interface ErrorInfo {
24
+ componentStack?: string;
25
+ }
26
+
23
27
  export interface Options extends preact.Options {
24
28
  /** Attach a hook that is invoked before render, mainly to check the arguments. */
25
29
  _root?(
@@ -37,7 +41,12 @@ export interface Options extends preact.Options {
37
41
  /** Bypass effect execution. Currenty only used in devtools for hooks inspection */
38
42
  _skipEffects?: boolean;
39
43
  /** Attach a hook that is invoked after an error is caught in a component but before calling lifecycle hooks */
40
- _catchError(error: any, vnode: VNode, oldVNode?: VNode | undefined): void;
44
+ _catchError(
45
+ error: any,
46
+ vnode: VNode,
47
+ oldVNode: VNode | undefined,
48
+ errorInfo: ErrorInfo | undefined
49
+ ): void;
41
50
  }
42
51
 
43
52
  export type ComponentChild =
@@ -661,6 +661,8 @@ export namespace JSXInternal {
661
661
  data?: string;
662
662
  dateTime?: string;
663
663
  default?: boolean;
664
+ defaultChecked?: boolean;
665
+ defaultValue?: string;
664
666
  defer?: boolean;
665
667
  dir?: 'auto' | 'rtl' | 'ltr';
666
668
  disabled?: boolean;
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(e){var t=String(e);return r.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var i=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},a=function(e,t,n){return String(e).length>(t||40)||!n&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var r in e){var o=e[r];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==r[0]?r:l[r]||(l[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===n.test(r)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var n in t)e[n]=t[n];return e}function p(e,t){return Array.isArray(t)?t.reduce(p,e):null!=t&&!1!==t&&e.push(t),e}var u={shallow:!0},c=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,d=/[\s\n\\/='"\0<>]/,v=function(){};y.render=y;var g=function(e,t){return y(e,t,u)},h=[];function y(e,n,r){n=n||{},r=r||{};var o=t.options.__s;t.options.__s=!0;var i=m(e,n,r);return t.options.__c&&t.options.__c(e,h),h.length=0,t.options.__s=o,i}function m(e,n,r,l,u,g){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return o(e);var h=r.pretty,y=h&&"string"==typeof h?h:"\t";if(Array.isArray(e)){for(var x="",b=0;b<e.length;b++)h&&b>0&&(x+="\n"),x+=m(e[b],n,r,l,u,g);return x}var S,w=e.type,k=e.props,O=!1;if("function"==typeof w){if(O=!0,!r.shallow||!l&&!1!==r.renderRootComponent){if(w===t.Fragment){var T=[];return p(T,e.props.children),m(T,n,r,!1!==r.shallowHighOrder,u,g)}var C,A=e.__c={__v:e,context:n,props:e.props,setState:v,forceUpdate:v,__h:[]};if(t.options.__b&&t.options.__b(e),t.options.__r&&t.options.__r(e),w.prototype&&"function"==typeof w.prototype.render){var j=w.contextType,F=j&&n[j.__c],H=null!=j?F?F.props.value:j.__:n;(A=e.__c=new w(k,H)).__v=e,A._dirty=A.__d=!0,A.props=k,null==A.state&&(A.state={}),null==A._nextState&&null==A.__s&&(A._nextState=A.__s=A.state),A.context=H,w.getDerivedStateFromProps?A.state=f(f({},A.state),w.getDerivedStateFromProps(A.props,A.state)):A.componentWillMount&&(A.componentWillMount(),A.state=A._nextState!==A.state?A._nextState:A.__s!==A.state?A.__s:A.state),C=A.render(A.props,A.state,A.context)}else{var M=w.contextType,$=M&&n[M.__c];C=w.call(e.__c,k,null!=M?$?$.props.value:M.__:n)}return A.getChildContext&&(n=f(f({},n),A.getChildContext())),t.options.diffed&&t.options.diffed(e),m(C,n,r,!1!==r.shallowHighOrder,u,g)}w=(S=w).displayName||S!==Function&&S.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var n=-1,r=c.length;r--;)if(c[r]===e){n=r;break}n<0&&(n=c.push(e)-1),t="UnnamedComponent"+n}return t}(S)}var L,R,E="<"+w;if(k){var q=Object.keys(k);r&&!0===r.sortAttributes&&q.sort();for(var D=0;D<q.length;D++){var N=q[D],P=k[N];if("children"!==N){if(!d.test(N)&&(r&&r.allAttributes||"key"!==N&&"ref"!==N&&"__self"!==N&&"__source"!==N)){if("defaultValue"===N)N="value";else if("className"===N){if(void 0!==k.class)continue;N="class"}else u&&N.match(/^xlink:?./)&&(N=N.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===N){if(k.for)continue;N="for"}"style"===N&&P&&"object"==typeof P&&(P=s(P)),"a"===N[0]&&"r"===N[1]&&"boolean"==typeof P&&(P=String(P));var U=r.attributeHook&&r.attributeHook(N,P,n,r,O);if(U||""===U)E+=U;else if("dangerouslySetInnerHTML"===N)R=P&&P.__html;else if("textarea"===w&&"value"===N)L=P;else if((P||0===P||""===P)&&"function"!=typeof P){if(!(!0!==P&&""!==P||(P=N,r&&r.xml))){E+=" "+N;continue}if("value"===N){if("select"===w){g=P;continue}"option"===w&&g==P&&(E+=" selected")}E+=" "+N+'="'+o(P)+'"'}}}else L=P}}if(h){var W=E.replace(/\n\s*/," ");W===E||~W.indexOf("\n")?h&&~E.indexOf("\n")&&(E+="\n"):E=W}if(E+=">",d.test(w))throw new Error(w+" is not a valid HTML tag name in "+E);var z,I=_.test(w)||r.voidElements&&r.voidElements.test(w),V=[];if(R)h&&a(R)&&(R="\n"+y+i(R,y)),E+=R;else if(null!=L&&p(z=[],L).length){for(var Z=h&&~E.indexOf("\n"),B=!1,G=0;G<z.length;G++){var J=z[G];if(null!=J&&!1!==J){var K=m(J,n,r,!0,"svg"===w||"foreignObject"!==w&&u,g);if(h&&!Z&&a(K)&&(Z=!0),K)if(h){var Q=K.length>0&&"<"!=K[0];B&&Q?V[V.length-1]+=K:V.push(K),B=Q}else V.push(K)}}if(h&&Z)for(var X=V.length;X--;)V[X]="\n"+y+i(V[X],y)}if(V.length||R)E+=V.join("");else if(r&&r.xml)return E.substring(0,E.length-1)+" />";return!I||z||R?(h&&~E.indexOf("\n")&&(E+="\n"),E+="</"+w+">"):E=E.replace(/>$/," />"),E}y.shallowRender=g,e.default=y,e.render=y,e.renderToStaticMarkup=y,e.renderToString=y,e.shallowRender=g});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact")):"function"==typeof define&&define.amd?define(["exports","preact"],t):t((e||self).preactRenderToString={},e.preact)}(this,function(e,t){var n=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i,r=/[&<>"]/;function o(e){var t=String(e);return r.test(t)?t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):t}var i=function(e,t){return String(e).replace(/(\n+)/g,"$1"+(t||"\t"))},a=function(e,t,n){return String(e).length>(t||40)||!n&&-1!==String(e).indexOf("\n")||-1!==String(e).indexOf("<")},l={};function s(e){var t="";for(var r in e){var o=e[r];null!=o&&""!==o&&(t&&(t+=" "),t+="-"==r[0]?r:l[r]||(l[r]=r.replace(/([A-Z])/g,"-$1").toLowerCase()),t+=": ",t+=o,"number"==typeof o&&!1===n.test(r)&&(t+="px"),t+=";")}return t||void 0}function f(e,t){for(var n in t)e[n]=t[n];return e}function p(e,t){return Array.isArray(t)?t.reduce(p,e):null!=t&&!1!==t&&e.push(t),e}var u={shallow:!0},c=[],_=/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/,d=/[\s\n\\/='"\0<>]/,v=function(){};y.render=y;var g=function(e,t){return y(e,t,u)},h=[];function y(e,n,r){n=n||{},r=r||{};var o=t.options.__s;t.options.__s=!0;var i=m(e,n,r);return t.options.__c&&t.options.__c(e,h),h.length=0,t.options.__s=o,i}function m(e,n,r,l,u,g){if(null==e||"boolean"==typeof e)return"";if("object"!=typeof e)return o(e);var h=r.pretty,y=h&&"string"==typeof h?h:"\t";if(Array.isArray(e)){for(var x="",b=0;b<e.length;b++)h&&b>0&&(x+="\n"),x+=m(e[b],n,r,l,u,g);return x}var S,w=e.type,k=e.props,O=!1;if("function"==typeof w){if(O=!0,!r.shallow||!l&&!1!==r.renderRootComponent){if(w===t.Fragment){var T=[];return p(T,e.props.children),m(T,n,r,!1!==r.shallowHighOrder,u,g)}var C,A=e.__c={__v:e,context:n,props:e.props,setState:v,forceUpdate:v,__h:[]};if(t.options.__b&&t.options.__b(e),t.options.__r&&t.options.__r(e),w.prototype&&"function"==typeof w.prototype.render){var j=w.contextType,F=j&&n[j.__c],H=null!=j?F?F.props.value:j.__:n;(A=e.__c=new w(k,H)).__v=e,A._dirty=A.__d=!0,A.props=k,null==A.state&&(A.state={}),null==A._nextState&&null==A.__s&&(A._nextState=A.__s=A.state),A.context=H,w.getDerivedStateFromProps?A.state=f(f({},A.state),w.getDerivedStateFromProps(A.props,A.state)):A.componentWillMount&&(A.componentWillMount(),A.state=A._nextState!==A.state?A._nextState:A.__s!==A.state?A.__s:A.state),C=A.render(A.props,A.state,A.context)}else{var M=w.contextType,$=M&&n[M.__c];C=w.call(e.__c,k,null!=M?$?$.props.value:M.__:n)}return A.getChildContext&&(n=f(f({},n),A.getChildContext())),t.options.diffed&&t.options.diffed(e),m(C,n,r,!1!==r.shallowHighOrder,u,g)}w=(S=w).displayName||S!==Function&&S.name||function(e){var t=(Function.prototype.toString.call(e).match(/^\s*function\s+([^( ]+)/)||"")[1];if(!t){for(var n=-1,r=c.length;r--;)if(c[r]===e){n=r;break}n<0&&(n=c.push(e)-1),t="UnnamedComponent"+n}return t}(S)}var L,R,E="<"+w;if(k){var q=Object.keys(k);r&&!0===r.sortAttributes&&q.sort();for(var D=0;D<q.length;D++){var N=q[D],P=k[N];if("children"!==N){if(!d.test(N)&&(r&&r.allAttributes||"key"!==N&&"ref"!==N&&"__self"!==N&&"__source"!==N)){if("defaultValue"===N)N="value";else if("className"===N){if(void 0!==k.class)continue;N="class"}else u&&N.match(/^xlink:?./)&&(N=N.toLowerCase().replace(/^xlink:?/,"xlink:"));if("htmlFor"===N){if(k.for)continue;N="for"}"style"===N&&P&&"object"==typeof P&&(P=s(P)),"a"===N[0]&&"r"===N[1]&&"boolean"==typeof P&&(P=String(P));var U=r.attributeHook&&r.attributeHook(N,P,n,r,O);if(U||""===U)E+=U;else if("dangerouslySetInnerHTML"===N)R=P&&P.__html;else if("textarea"===w&&"value"===N)L=P;else if((P||0===P||""===P)&&"function"!=typeof P){if(!(!0!==P&&""!==P||(P=N,r&&r.xml))){E+=" "+N;continue}if("value"===N){if("select"===w){g=P;continue}"option"===w&&g==P&&void 0===k.selected&&(E+=" selected")}E+=" "+N+'="'+o(P)+'"'}}}else L=P}}if(h){var W=E.replace(/\n\s*/," ");W===E||~W.indexOf("\n")?h&&~E.indexOf("\n")&&(E+="\n"):E=W}if(E+=">",d.test(w))throw new Error(w+" is not a valid HTML tag name in "+E);var z,I=_.test(w)||r.voidElements&&r.voidElements.test(w),V=[];if(R)h&&a(R)&&(R="\n"+y+i(R,y)),E+=R;else if(null!=L&&p(z=[],L).length){for(var Z=h&&~E.indexOf("\n"),B=!1,G=0;G<z.length;G++){var J=z[G];if(null!=J&&!1!==J){var K=m(J,n,r,!0,"svg"===w||"foreignObject"!==w&&u,g);if(h&&!Z&&a(K)&&(Z=!0),K)if(h){var Q=K.length>0&&"<"!=K[0];B&&Q?V[V.length-1]+=K:V.push(K),B=Q}else V.push(K)}}if(h&&Z)for(var X=V.length;X--;)V[X]="\n"+y+i(V[X],y)}if(V.length||R)E+=V.join("");else if(r&&r.xml)return E.substring(0,E.length-1)+" />";return!I||z||R?(h&&~E.indexOf("\n")&&(E+="\n"),E+="</"+w+">"):E=E.replace(/>$/," />"),E}y.shallowRender=g,e.default=y,e.render=y,e.renderToStaticMarkup=y,e.renderToString=y,e.shallowRender=g});
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\n}\n\nexport let indent = (s, char) =>\n\tString(s).replace(/(\\n+)/g, '$1' + (char || '\\t'));\n\nexport let isLargeString = (s, length, ignoreLines) =>\n\tString(s).length > (length || 40) ||\n\t(!ignoreLines && String(s).indexOf('\\n') !== -1) ||\n\tString(s).indexOf('<') !== -1;\n\nconst JS_TO_CSS = {};\n\n// Convert an Object style to a CSSText string\nexport function styleObjToCss(s) {\n\tlet str = '';\n\tfor (let prop in s) {\n\t\tlet val = s[prop];\n\t\tif (val != null && val !== '') {\n\t\t\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\n\t\t\t\tprop[0] == '-'\n\t\t\t\t\t? prop\n\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t (JS_TO_CSS[prop] = prop.replace(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/**\n * Get flattened children from the children prop\n * @param {Array} accumulator\n * @param {any} children A `props.children` opaque object.\n * @returns {Array} accumulator\n * @private\n */\nexport function getChildren(accumulator, children) {\n\tif (Array.isArray(children)) {\n\t\tchildren.reduce(getChildren, accumulator);\n\t} else if (children != null && children !== false) {\n\t\taccumulator.push(children);\n\t}\n\treturn accumulator;\n}\n","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS =\n\t/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nconst noop = () => {};\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\n\t// Performance optimization: `renderToString` is synchronous and we\n\t// therefore don't execute any effects. To do that we pass an empty\n\t// array to `options._commit` (`__c`). But we can go one step further\n\t// and avoid a lot of dirty checks and allocations by setting\n\t// `options._skipEffects` (`__s`) too.\n\tconst previousSkipEffects = options.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: noop,\n\t\t\t\tforceUpdate: noop,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tif (options.__r) options.__r(vnode);\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// stateless functional components\n\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (nodeName === 'option' && selectValue == v) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","noop","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","__d","state","_nextState","getDerivedStateFromProps","componentWillMount","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"wRACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAGG,QAAQ,SAAU,MAAQE,GAAQ,QAElCC,EAAgB,SAACN,EAAGO,EAAQC,UACtCP,OAAOD,GAAGO,QAAUA,GAAU,MAC5BC,IAA4C,IAA7BP,OAAOD,GAAGS,QAAQ,QACP,IAA5BR,OAAOD,GAAGS,QAAQ,MAEbC,EAAY,YAGFC,EAAcX,GAC7B,IAAIY,EAAM,GACV,IAAK,IAAIC,KAAQb,EAAG,CACnB,IAAIc,EAAMd,EAAEa,GACD,MAAPC,GAAuB,KAARA,IACdF,IAAKA,GAAO,KAEhBA,GACY,KAAXC,EAAK,GACFA,EACAH,EAAUG,KACTH,EAAUG,GAAQA,EAAKV,QAAQ,WAAY,OAAOY,eACvDH,GAAO,KACPA,GAAOE,EACY,iBAARA,IAAsD,IAAlClB,EAAmBM,KAAKW,KACtDD,GAAO,MAERA,GAAO,KAGT,OAAOA,QAAOI,WAUCC,EAAOC,EAAKC,GAC3B,IAAK,IAAIC,KAAKD,EAAOD,EAAIE,GAAKD,EAAMC,GACpC,OAAOF,WAUQG,EAAYC,EAAaC,GAMxC,OALIC,MAAMC,QAAQF,GACjBA,EAASG,OAAOL,E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,GAAcnF,OAC1C,CAID,IAHA,IAAIqG,EAAW1D,IAAWlD,EAAES,QAAQ,MAChCoG,GAAc,EAETzF,EAAI,EAAGA,EAAIG,EAAShB,OAAQa,IAAK,CACzC,IAAI0F,EAAQvF,EAASH,GAErB,GAAa,MAAT0F,IAA2B,IAAVA,EAAiB,CACrC,IAMCC,EAAMlE,EACLiE,EACAxE,EACAE,GACA,EATa,QAAbc,GAEgB,kBAAbA,GAEAN,EAOHC,GAMF,GAHIC,IAAW0D,GAAYtG,EAAcyG,KAAMH,GAAW,GAGtDG,EACH,GAAI7D,EAAQ,CACX,IAAI8D,EAASD,EAAIxG,OAAS,GAAe,KAAVwG,EAAI,GAI/BF,GAAeG,EAClBL,EAAOA,EAAOpG,OAAS,IAAMwG,EAE7BJ,EAAOhF,KAAKoF,GAGbF,EAAcG,OAEdL,EAAOhF,KAAKoF,IAKhB,GAAI7D,GAAU0D,EACb,IAAK,IAAIxF,EAAIuF,EAAOpG,OAAQa,KAC3BuF,EAAOvF,GAAK,KAAO+B,EAAa/C,EAAOuG,EAAOvF,GAAI+B,GAKrD,GAAIwD,EAAOpG,QAAUoF,EACpB3F,GAAK2G,EAAOM,KAAK,YACPzE,GAAQA,EAAK8D,IACvB,OAAOtG,EAAEkH,UAAU,EAAGlH,EAAEO,OAAS,GAAK,MAUvC,OAPIkG,GAAWlF,GAAaoE,GAGvBzC,IAAWlD,EAAES,QAAQ,QAAOT,GAAK,MACrCA,QAAUsD,OAHVtD,EAAIA,EAAEG,QAAQ,KAAM,OAMdH,EA+BRkC,EAAeE,cAAgBA"}
1
+ {"version":3,"file":"index.js","sources":["../src/util.js","../src/index.js"],"sourcesContent":["// DOM properties that should NOT have \"px\" added when numeric\nexport const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;\n\nconst ENCODED_ENTITIES = /[&<>\"]/;\n\nexport function encodeEntities(input) {\n\tconst s = String(input);\n\tif (!ENCODED_ENTITIES.test(s)) {\n\t\treturn s;\n\t}\n\treturn s\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;')\n\t\t.replace(/\"/g, '&quot;');\n}\n\nexport let indent = (s, char) =>\n\tString(s).replace(/(\\n+)/g, '$1' + (char || '\\t'));\n\nexport let isLargeString = (s, length, ignoreLines) =>\n\tString(s).length > (length || 40) ||\n\t(!ignoreLines && String(s).indexOf('\\n') !== -1) ||\n\tString(s).indexOf('<') !== -1;\n\nconst JS_TO_CSS = {};\n\n// Convert an Object style to a CSSText string\nexport function styleObjToCss(s) {\n\tlet str = '';\n\tfor (let prop in s) {\n\t\tlet val = s[prop];\n\t\tif (val != null && val !== '') {\n\t\t\tif (str) str += ' ';\n\t\t\t// str += jsToCss(prop);\n\t\t\tstr +=\n\t\t\t\tprop[0] == '-'\n\t\t\t\t\t? prop\n\t\t\t\t\t: JS_TO_CSS[prop] ||\n\t\t\t\t\t (JS_TO_CSS[prop] = prop.replace(/([A-Z])/g, '-$1').toLowerCase());\n\t\t\tstr += ': ';\n\t\t\tstr += val;\n\t\t\tif (typeof val === 'number' && IS_NON_DIMENSIONAL.test(prop) === false) {\n\t\t\t\tstr += 'px';\n\t\t\t}\n\t\t\tstr += ';';\n\t\t}\n\t}\n\treturn str || undefined;\n}\n\n/**\n * Copy all properties from `props` onto `obj`.\n * @param {object} obj Object onto which properties should be copied.\n * @param {object} props Object from which to copy properties.\n * @returns {object}\n * @private\n */\nexport function assign(obj, props) {\n\tfor (let i in props) obj[i] = props[i];\n\treturn obj;\n}\n\n/**\n * Get flattened children from the children prop\n * @param {Array} accumulator\n * @param {any} children A `props.children` opaque object.\n * @returns {Array} accumulator\n * @private\n */\nexport function getChildren(accumulator, children) {\n\tif (Array.isArray(children)) {\n\t\tchildren.reduce(getChildren, accumulator);\n\t} else if (children != null && children !== false) {\n\t\taccumulator.push(children);\n\t}\n\treturn accumulator;\n}\n","import {\n\tencodeEntities,\n\tindent,\n\tisLargeString,\n\tstyleObjToCss,\n\tassign,\n\tgetChildren\n} from './util';\nimport { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nconst SHALLOW = { shallow: true };\n\n// components without names, kept as a hash for later comparison to return consistent UnnamedComponentXX names.\nconst UNNAMED = [];\n\nconst VOID_ELEMENTS = /^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/;\n\nconst UNSAFE_NAME = /[\\s\\n\\\\/='\"\\0<>]/;\n\nconst noop = () => {};\n\n/** Render Preact JSX + Components to an HTML string.\n *\t@name render\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n *\t@param {Object} [options={}]\tRendering options\n *\t@param {Boolean} [options.shallow=false]\tIf `true`, renders nested Components as HTML elements (`<Foo a=\"b\" />`).\n *\t@param {Boolean} [options.xml=false]\t\tIf `true`, uses self-closing tags for elements without children.\n *\t@param {Boolean} [options.pretty=false]\t\tIf `true`, adds whitespace for readability\n *\t@param {RegExp|undefined} [options.voidElements] RegeEx that matches elements that are considered void (self-closing)\n */\nrenderToString.render = renderToString;\n\n/** Only render elements, leaving Components inline as `<ComponentName ... />`.\n *\tThis method is just a convenience alias for `render(vnode, context, { shallow:true })`\n *\t@name shallow\n *\t@function\n *\t@param {VNode} vnode\tJSX VNode to render.\n *\t@param {Object} [context={}]\tOptionally pass an initial context object through the render path.\n */\nlet shallowRender = (vnode, context) => renderToString(vnode, context, SHALLOW);\n\nconst EMPTY_ARR = [];\nfunction renderToString(vnode, context, opts) {\n\tcontext = context || {};\n\topts = opts || {};\n\n\t// Performance optimization: `renderToString` is synchronous and we\n\t// therefore don't execute any effects. To do that we pass an empty\n\t// array to `options._commit` (`__c`). But we can go one step further\n\t// and avoid a lot of dirty checks and allocations by setting\n\t// `options._skipEffects` (`__s`) too.\n\tconst previousSkipEffects = options.__s;\n\toptions.__s = true;\n\n\tconst res = _renderToString(vnode, context, opts);\n\n\t// options._commit, we don't schedule any effects in this library right now,\n\t// so we can pass an empty queue to this hook.\n\tif (options.__c) options.__c(vnode, EMPTY_ARR);\n\tEMPTY_ARR.length = 0;\n\toptions.__s = previousSkipEffects;\n\treturn res;\n}\n\n/** The default export is an alias of `render()`. */\nfunction _renderToString(vnode, context, opts, inner, isSvgMode, selectValue) {\n\tif (vnode == null || typeof vnode === 'boolean') {\n\t\treturn '';\n\t}\n\n\t// #text nodes\n\tif (typeof vnode !== 'object') {\n\t\treturn encodeEntities(vnode);\n\t}\n\n\tlet pretty = opts.pretty,\n\t\tindentChar = pretty && typeof pretty === 'string' ? pretty : '\\t';\n\n\tif (Array.isArray(vnode)) {\n\t\tlet rendered = '';\n\t\tfor (let i = 0; i < vnode.length; i++) {\n\t\t\tif (pretty && i > 0) rendered += '\\n';\n\t\t\trendered += _renderToString(\n\t\t\t\tvnode[i],\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\tinner,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t\treturn rendered;\n\t}\n\n\tlet nodeName = vnode.type,\n\t\tprops = vnode.props,\n\t\tisComponent = false;\n\n\t// components\n\tif (typeof nodeName === 'function') {\n\t\tisComponent = true;\n\t\tif (opts.shallow && (inner || opts.renderRootComponent === false)) {\n\t\t\tnodeName = getComponentName(nodeName);\n\t\t} else if (nodeName === Fragment) {\n\t\t\tconst children = [];\n\t\t\tgetChildren(children, vnode.props.children);\n\t\t\treturn _renderToString(\n\t\t\t\tchildren,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t} else {\n\t\t\tlet rendered;\n\n\t\t\tlet c = (vnode.__c = {\n\t\t\t\t__v: vnode,\n\t\t\t\tcontext,\n\t\t\t\tprops: vnode.props,\n\t\t\t\t// silently drop state updates\n\t\t\t\tsetState: noop,\n\t\t\t\tforceUpdate: noop,\n\t\t\t\t// hooks\n\t\t\t\t__h: []\n\t\t\t});\n\n\t\t\t// options._diff\n\t\t\tif (options.__b) options.__b(vnode);\n\n\t\t\t// options._render\n\t\t\tif (options.__r) options.__r(vnode);\n\n\t\t\tif (\n\t\t\t\t!nodeName.prototype ||\n\t\t\t\ttypeof nodeName.prototype.render !== 'function'\n\t\t\t) {\n\t\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t\t// the context value as `this.context` just for this component.\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// stateless functional components\n\t\t\t\trendered = nodeName.call(vnode.__c, props, cctx);\n\t\t\t} else {\n\t\t\t\t// class-based components\n\t\t\t\tlet cxType = nodeName.contextType;\n\t\t\t\tlet provider = cxType && context[cxType.__c];\n\t\t\t\tlet cctx =\n\t\t\t\t\tcxType != null\n\t\t\t\t\t\t? provider\n\t\t\t\t\t\t\t? provider.props.value\n\t\t\t\t\t\t\t: cxType.__\n\t\t\t\t\t\t: context;\n\n\t\t\t\t// c = new nodeName(props, context);\n\t\t\t\tc = vnode.__c = new nodeName(props, cctx);\n\t\t\t\tc.__v = vnode;\n\t\t\t\t// turn off stateful re-rendering:\n\t\t\t\tc._dirty = c.__d = true;\n\t\t\t\tc.props = props;\n\t\t\t\tif (c.state == null) c.state = {};\n\n\t\t\t\tif (c._nextState == null && c.__s == null) {\n\t\t\t\t\tc._nextState = c.__s = c.state;\n\t\t\t\t}\n\n\t\t\t\tc.context = cctx;\n\t\t\t\tif (nodeName.getDerivedStateFromProps)\n\t\t\t\t\tc.state = assign(\n\t\t\t\t\t\tassign({}, c.state),\n\t\t\t\t\t\tnodeName.getDerivedStateFromProps(c.props, c.state)\n\t\t\t\t\t);\n\t\t\t\telse if (c.componentWillMount) {\n\t\t\t\t\tc.componentWillMount();\n\n\t\t\t\t\t// If the user called setState in cWM we need to flush pending,\n\t\t\t\t\t// state updates. This is the same behaviour in React.\n\t\t\t\t\tc.state =\n\t\t\t\t\t\tc._nextState !== c.state\n\t\t\t\t\t\t\t? c._nextState\n\t\t\t\t\t\t\t: c.__s !== c.state\n\t\t\t\t\t\t\t? c.__s\n\t\t\t\t\t\t\t: c.state;\n\t\t\t\t}\n\n\t\t\t\trendered = c.render(c.props, c.state, c.context);\n\t\t\t}\n\n\t\t\tif (c.getChildContext) {\n\t\t\t\tcontext = assign(assign({}, context), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (options.diffed) options.diffed(vnode);\n\t\t\treturn _renderToString(\n\t\t\t\trendered,\n\t\t\t\tcontext,\n\t\t\t\topts,\n\t\t\t\topts.shallowHighOrder !== false,\n\t\t\t\tisSvgMode,\n\t\t\t\tselectValue\n\t\t\t);\n\t\t}\n\t}\n\n\t// render JSX to HTML\n\tlet s = '<' + nodeName,\n\t\tpropChildren,\n\t\thtml;\n\n\tif (props) {\n\t\tlet attrs = Object.keys(props);\n\n\t\t// allow sorting lexicographically for more determinism (useful for tests, such as via preact-jsx-chai)\n\t\tif (opts && opts.sortAttributes === true) attrs.sort();\n\n\t\tfor (let i = 0; i < attrs.length; i++) {\n\t\t\tlet name = attrs[i],\n\t\t\t\tv = props[name];\n\t\t\tif (name === 'children') {\n\t\t\t\tpropChildren = v;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (UNSAFE_NAME.test(name)) continue;\n\n\t\t\tif (\n\t\t\t\t!(opts && opts.allAttributes) &&\n\t\t\t\t(name === 'key' ||\n\t\t\t\t\tname === 'ref' ||\n\t\t\t\t\tname === '__self' ||\n\t\t\t\t\tname === '__source')\n\t\t\t)\n\t\t\t\tcontinue;\n\n\t\t\tif (name === 'defaultValue') {\n\t\t\t\tname = 'value';\n\t\t\t} else if (name === 'className') {\n\t\t\t\tif (typeof props.class !== 'undefined') continue;\n\t\t\t\tname = 'class';\n\t\t\t} else if (isSvgMode && name.match(/^xlink:?./)) {\n\t\t\t\tname = name.toLowerCase().replace(/^xlink:?/, 'xlink:');\n\t\t\t}\n\n\t\t\tif (name === 'htmlFor') {\n\t\t\t\tif (props.for) continue;\n\t\t\t\tname = 'for';\n\t\t\t}\n\n\t\t\tif (name === 'style' && v && typeof v === 'object') {\n\t\t\t\tv = styleObjToCss(v);\n\t\t\t}\n\n\t\t\t// always use string values instead of booleans for aria attributes\n\t\t\t// also see https://github.com/preactjs/preact/pull/2347/files\n\t\t\tif (name[0] === 'a' && name['1'] === 'r' && typeof v === 'boolean') {\n\t\t\t\tv = String(v);\n\t\t\t}\n\n\t\t\tlet hooked =\n\t\t\t\topts.attributeHook &&\n\t\t\t\topts.attributeHook(name, v, context, opts, isComponent);\n\t\t\tif (hooked || hooked === '') {\n\t\t\t\ts += hooked;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (name === 'dangerouslySetInnerHTML') {\n\t\t\t\thtml = v && v.__html;\n\t\t\t} else if (nodeName === 'textarea' && name === 'value') {\n\t\t\t\t// <textarea value=\"a&b\"> --> <textarea>a&amp;b</textarea>\n\t\t\t\tpropChildren = v;\n\t\t\t} else if ((v || v === 0 || v === '') && typeof v !== 'function') {\n\t\t\t\tif (v === true || v === '') {\n\t\t\t\t\tv = name;\n\t\t\t\t\t// in non-xml mode, allow boolean attributes\n\t\t\t\t\tif (!opts || !opts.xml) {\n\t\t\t\t\t\ts += ' ' + name;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (name === 'value') {\n\t\t\t\t\tif (nodeName === 'select') {\n\t\t\t\t\t\tselectValue = v;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (\n\t\t\t\t\t\t// If we're looking at an <option> and it's the currently selected one\n\t\t\t\t\t\tnodeName === 'option' &&\n\t\t\t\t\t\tselectValue == v &&\n\t\t\t\t\t\t// and the <option> doesn't already have a selected attribute on it\n\t\t\t\t\t\ttypeof props.selected === 'undefined'\n\t\t\t\t\t) {\n\t\t\t\t\t\ts += ` selected`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ts += ` ${name}=\"${encodeEntities(v)}\"`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// account for >1 multiline attribute\n\tif (pretty) {\n\t\tlet sub = s.replace(/\\n\\s*/, ' ');\n\t\tif (sub !== s && !~sub.indexOf('\\n')) s = sub;\n\t\telse if (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t}\n\n\ts += '>';\n\n\tif (UNSAFE_NAME.test(nodeName))\n\t\tthrow new Error(`${nodeName} is not a valid HTML tag name in ${s}`);\n\n\tlet isVoid =\n\t\tVOID_ELEMENTS.test(nodeName) ||\n\t\t(opts.voidElements && opts.voidElements.test(nodeName));\n\tlet pieces = [];\n\n\tlet children;\n\tif (html) {\n\t\t// if multiline, indent.\n\t\tif (pretty && isLargeString(html)) {\n\t\t\thtml = '\\n' + indentChar + indent(html, indentChar);\n\t\t}\n\t\ts += html;\n\t} else if (\n\t\tpropChildren != null &&\n\t\tgetChildren((children = []), propChildren).length\n\t) {\n\t\tlet hasLarge = pretty && ~s.indexOf('\\n');\n\t\tlet lastWasText = false;\n\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tlet child = children[i];\n\n\t\t\tif (child != null && child !== false) {\n\t\t\t\tlet childSvgMode =\n\t\t\t\t\t\tnodeName === 'svg'\n\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t: nodeName === 'foreignObject'\n\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t: isSvgMode,\n\t\t\t\t\tret = _renderToString(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\topts,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tchildSvgMode,\n\t\t\t\t\t\tselectValue\n\t\t\t\t\t);\n\n\t\t\t\tif (pretty && !hasLarge && isLargeString(ret)) hasLarge = true;\n\n\t\t\t\t// Skip if we received an empty string\n\t\t\t\tif (ret) {\n\t\t\t\t\tif (pretty) {\n\t\t\t\t\t\tlet isText = ret.length > 0 && ret[0] != '<';\n\n\t\t\t\t\t\t// We merge adjacent text nodes, otherwise each piece would be printed\n\t\t\t\t\t\t// on a new line.\n\t\t\t\t\t\tif (lastWasText && isText) {\n\t\t\t\t\t\t\tpieces[pieces.length - 1] += ret;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlastWasText = isText;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpieces.push(ret);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (pretty && hasLarge) {\n\t\t\tfor (let i = pieces.length; i--; ) {\n\t\t\t\tpieces[i] = '\\n' + indentChar + indent(pieces[i], indentChar);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pieces.length || html) {\n\t\ts += pieces.join('');\n\t} else if (opts && opts.xml) {\n\t\treturn s.substring(0, s.length - 1) + ' />';\n\t}\n\n\tif (isVoid && !children && !html) {\n\t\ts = s.replace(/>$/, ' />');\n\t} else {\n\t\tif (pretty && ~s.indexOf('\\n')) s += '\\n';\n\t\ts += `</${nodeName}>`;\n\t}\n\n\treturn s;\n}\n\nfunction getComponentName(component) {\n\treturn (\n\t\tcomponent.displayName ||\n\t\t(component !== Function && component.name) ||\n\t\tgetFallbackComponentName(component)\n\t);\n}\n\nfunction getFallbackComponentName(component) {\n\tlet str = Function.prototype.toString.call(component),\n\t\tname = (str.match(/^\\s*function\\s+([^( ]+)/) || '')[1];\n\tif (!name) {\n\t\t// search for an existing indexed name for the given component:\n\t\tlet index = -1;\n\t\tfor (let i = UNNAMED.length; i--; ) {\n\t\t\tif (UNNAMED[i] === component) {\n\t\t\t\tindex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// not found, create a new indexed name:\n\t\tif (index < 0) {\n\t\t\tindex = UNNAMED.push(component) - 1;\n\t\t}\n\t\tname = `UnnamedComponent${index}`;\n\t}\n\treturn name;\n}\nrenderToString.shallowRender = shallowRender;\n\nexport default renderToString;\n\nexport {\n\trenderToString as render,\n\trenderToString as renderToStaticMarkup,\n\trenderToString,\n\tshallowRender\n};\n"],"names":["IS_NON_DIMENSIONAL","ENCODED_ENTITIES","encodeEntities","input","s","String","test","replace","indent","char","isLargeString","length","ignoreLines","indexOf","JS_TO_CSS","styleObjToCss","str","prop","val","toLowerCase","undefined","assign","obj","props","i","getChildren","accumulator","children","Array","isArray","reduce","push","SHALLOW","shallow","UNNAMED","VOID_ELEMENTS","UNSAFE_NAME","noop","renderToString","render","shallowRender","vnode","context","EMPTY_ARR","opts","previousSkipEffects","options","__s","res","_renderToString","__c","inner","isSvgMode","selectValue","pretty","indentChar","rendered","component","nodeName","type","isComponent","renderRootComponent","Fragment","shallowHighOrder","c","__v","setState","forceUpdate","__h","__b","__r","prototype","cxType","contextType","provider","cctx","value","__","_dirty","__d","state","_nextState","getDerivedStateFromProps","componentWillMount","call","getChildContext","diffed","displayName","Function","name","toString","match","index","getFallbackComponentName","propChildren","html","attrs","Object","keys","sortAttributes","sort","v","allAttributes","hooked","attributeHook","__html","xml","selected","sub","Error","isVoid","voidElements","pieces","hasLarge","lastWasText","child","ret","isText","join","substring"],"mappings":"wRACaA,EAAqB,kEAE5BC,EAAmB,kBAETC,EAAeC,GAC9B,IAAMC,EAAIC,OAAOF,GACjB,OAAKF,EAAiBK,KAAKF,GAGpBA,EACLG,QAAQ,KAAM,SACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,QACdA,QAAQ,KAAM,UANRH,MASEI,EAAS,SAACJ,EAAGK,UACvBJ,OAAOD,GAAGG,QAAQ,SAAU,MAAQE,GAAQ,QAElCC,EAAgB,SAACN,EAAGO,EAAQC,UACtCP,OAAOD,GAAGO,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