From e9dc96f61a13a86323d3ec6b62afabac665db386 Mon Sep 17 00:00:00 2001 From: Dimitri Nicolas <dimitri@ooeo.fr> Date: Sun, 10 Mar 2019 17:24:06 +0100 Subject: [PATCH] Add timeout option. --- CHANGELOG.md | 4 ++++ README.md | 2 ++ example/dist/index.js | 4 ++-- example/src/index.jsx | 22 ++++++++++++---------- example/style.css | 1 + package.json | 2 +- src/index.ts | 11 ++++++----- src/types/options.ts | 6 ++++++ 8 files changed, 34 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7070c7..eaa1d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.1.0 - 2019-03-10 + +- Add `timeout` option. + ## 1.0.1 - 2019-03-09 - Move react to peer-dependency. diff --git a/README.md b/README.md index be2fa5a..8f67887 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ The `useMouseDown` and `useMouseUp` are both a shortcut to respectively set the - `up` (default: `false`): If the element should listen to mouseup event. - `touch` (default: `true`): If the element should listen to touch equivalent events. +- `timeout` (default: `10`): Short timeout in milliseconds to prevents multiple +events. You can provide functions that should listen to each event with theses options: diff --git a/example/dist/index.js b/example/dist/index.js index ae8f695..9d325f1 100644 --- a/example/dist/index.js +++ b/example/dist/index.js @@ -1,4 +1,4 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=53)}([function(e,t,n){"use strict";e.exports=n(19)},function(e,t,n){"use strict";var r=n(4),a=n(9),l=n(10);e.exports=function(e){var t,n,o=e.space,i=e.mustUseProperty||[],u=e.attributes||{},c=e.properties,s=e.transform,f={},d={};for(t in c)n=new l(t,s(u,t),c[t],o),-1!==i.indexOf(t)&&(n.mustUseProperty=!0),f[t]=n,d[r(t)]=t,d[r(n.attribute)]=t;return new a(f,d,o)}},function(e,t,n){var r=n(52);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){r(e,t,n[t])})}return e}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";e.exports=function(e){return e.toLowerCase()}},function(e,t,n){"use strict";var r=0;function a(){return Math.pow(2,++r)}t.boolean=a(),t.booleanish=a(),t.overloadedBoolean=a(),t.number=a(),t.spaceSeparated=a(),t.commaSeparated=a(),t.commaOrSpaceSeparated=a()},function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,l=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw l}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),l={down:!1,up:!1,touch:!0},o=function(e){return 0===e.button};t.useMouseAction=function(e){if("function"==typeof e)return t.useMouseAction({onAction:e});var n=Object.assign({},l,e),i=n.onAction,u=n.down,c=n.up,s=n.touch,f=n.onClick,d=n.onMouseDown,p=n.onMouseUp,m=n.onTouchStart,h=n.onTouchEnd;if("function"!=typeof i)throw new Error("You must provide a callback function.");var g=r(a.useState(!1),2),y=g[0],v=g[1],b=function(){setTimeout(function(){return v(!1)},10)},k=r(a.useState(!1),2),x=k[0],w=k[1],S=function(){w(!0),setTimeout(function(){return w(!1)},10)};a.useEffect(function(){if(u){var e=function(e){o(e)&&b()};return document.addEventListener("mouseup",e),function(){document.removeEventListener("mouseup",e)}}return function(){}},[]),a.useEffect(function(){if(u&&s){var e=function(){return b()};return document.addEventListener("touchend",e),function(){document.removeEventListener("touchend",e)}}return function(){}},[]);var T=a.useCallback(function(){return(!u||!y)&&(!c||!x)},[y,x]),E={onClick:function(e){"function"==typeof f&&f(e),T()&&i(e)},onMouseDown:function(e){"function"==typeof d&&d(e),u&&T()&&o(e)&&(v(!0),i(e))},onTouchStart:function(e){"function"==typeof m&&m(e),u&&s&&T()&&(v(!0),i(e))},onMouseUp:function(e){"function"==typeof p&&p(e),c&&T()&&o(e)&&(S(),setTimeout(function(){return i(e)},10))},onTouchEnd:function(e){"function"==typeof h&&h(e),c&&s&&T()&&(S(),setTimeout(function(){return i(e)},10))}};return E},t.useMouseDown=function(e){return"function"==typeof e?t.useMouseDown({onAction:e}):t.useMouseAction(Object.assign({},e,{down:!0}))},t.useMouseUp=function(e){return"function"==typeof e?t.useMouseUp({onAction:e}):t.useMouseAction(Object.assign({},e,{up:!0}))},t.default=t.useMouseAction},function(e,t,n){"use strict";(function(t){var r=function(){var e="Prism"in t,n=e?t.Prism:void 0;return function(){e?t.Prism=n:delete t.Prism;e=void 0,n=void 0}}();("undefined"==typeof window?"undefined"==typeof self?{}:self:window).Prism={manual:!0,disableWorkerMessageHandler:!0};var a=n(23),l=n(39),o=n(46),i=n(47),u=n(48),c=n(49),s=n(50);r();var f={}.hasOwnProperty;function d(){}d.prototype=o;var p=new d;function m(e){if("function"!=typeof e||!e.displayName)throw new Error("Expected `function` for `grammar`, got `"+e+"`");void 0===p.languages[e.displayName]&&e(p)}e.exports=p,p.highlight=function(e,t){var n,r=o.highlight;if("string"!=typeof e)throw new Error("Expected `string` for `value`, got `"+e+"`");if("Object"===p.util.type(t))n=t,t=null;else{if("string"!=typeof t)throw new Error("Expected `string` for `name`, got `"+t+"`");if(!f.call(p.languages,t))throw new Error("Unknown language: `"+t+"` is not registered");n=p.languages[t]}return r.call(this,e,n,t)},p.register=m,p.registered=function(e){if("string"!=typeof e)throw new Error("Expected `string` for `language`, got `"+e+"`");return f.call(p.languages,e)},m(i),m(u),m(c),m(s),p.util.encode=function(e){return e},p.Token.stringify=function(e,t,n){var r;if("string"==typeof e)return{type:"text",value:e};if("Array"===p.util.type(e))return function(e,t){var n,r=[],a=e.length,l=-1;for(;++l<a;)""!==(n=e[l])&&null!=n&&r.push(n);l=-1,a=r.length;for(;++l<a;)n=r[l],r[l]=p.Token.stringify(n,t,r);return r}(e,t);r={type:e.type,content:p.Token.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n},e.alias&&(r.classes=r.classes.concat(e.alias));return p.hooks.run("wrap",r),a(r.tag+"."+r.classes.join("."),function(e){var t;for(t in e)e[t]=l(e[t]);return e}(r.attributes),r.content)}}).call(this,n(3))},function(e,t,n){"use strict"; +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=53)}([function(e,t,n){"use strict";e.exports=n(19)},function(e,t,n){"use strict";var r=n(4),a=n(9),l=n(10);e.exports=function(e){var t,n,o=e.space,i=e.mustUseProperty||[],u=e.attributes||{},c=e.properties,s=e.transform,f={},d={};for(t in c)n=new l(t,s(u,t),c[t],o),-1!==i.indexOf(t)&&(n.mustUseProperty=!0),f[t]=n,d[r(t)]=t,d[r(n.attribute)]=t;return new a(f,d,o)}},function(e,t,n){var r=n(52);e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},a=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),a.forEach(function(t){r(e,t,n[t])})}return e}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";e.exports=function(e){return e.toLowerCase()}},function(e,t,n){"use strict";var r=0;function a(){return Math.pow(2,++r)}t.boolean=a(),t.booleanish=a(),t.overloadedBoolean=a(),t.number=a(),t.spaceSeparated=a(),t.commaSeparated=a(),t.commaOrSpaceSeparated=a()},function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,l=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw l}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}Object.defineProperty(t,"__esModule",{value:!0});var a=n(0),l={down:!1,up:!1,touch:!0,timeout:10},o=function(e){return 0===e.button};t.useMouseAction=function(e){if("function"==typeof e)return t.useMouseAction({onAction:e});var n=Object.assign({},l,e),i=n.onAction,u=n.down,c=n.up,s=n.touch,f=n.timeout,d=n.onClick,p=n.onMouseDown,m=n.onMouseUp,h=n.onTouchStart,g=n.onTouchEnd;if("function"!=typeof i)throw new Error("You must provide a callback function.");var y=r(a.useState(!1),2),v=y[0],b=y[1],k=function(){setTimeout(function(){return b(!1)},f)},x=r(a.useState(!1),2),w=x[0],S=x[1],T=function(){S(!0),setTimeout(function(){return S(!1)},f)};a.useEffect(function(){if(u){var e=function(e){o(e)&&k()};return document.addEventListener("mouseup",e),function(){document.removeEventListener("mouseup",e)}}return function(){}},[]),a.useEffect(function(){if(u&&s){var e=function(){return k()};return document.addEventListener("touchend",e),function(){document.removeEventListener("touchend",e)}}return function(){}},[]);var E=a.useCallback(function(){return(!u||!v)&&(!c||!w)},[v,w]),C={onClick:function(e){"function"==typeof d&&d(e),E()&&i(e)},onMouseDown:function(e){"function"==typeof p&&p(e),u&&E()&&o(e)&&(b(!0),i(e))},onTouchStart:function(e){"function"==typeof h&&h(e),u&&s&&E()&&(b(!0),i(e))},onMouseUp:function(e){"function"==typeof m&&m(e),c&&E()&&o(e)&&(T(),setTimeout(function(){return i(e)},f))},onTouchEnd:function(e){"function"==typeof g&&g(e),c&&s&&E()&&(T(),setTimeout(function(){return i(e)},f))}};return C},t.useMouseDown=function(e){return"function"==typeof e?t.useMouseDown({onAction:e}):t.useMouseAction(Object.assign({},e,{down:!0}))},t.useMouseUp=function(e){return"function"==typeof e?t.useMouseUp({onAction:e}):t.useMouseAction(Object.assign({},e,{up:!0}))},t.default=t.useMouseAction},function(e,t,n){"use strict";(function(t){var r=function(){var e="Prism"in t,n=e?t.Prism:void 0;return function(){e?t.Prism=n:delete t.Prism;e=void 0,n=void 0}}();("undefined"==typeof window?"undefined"==typeof self?{}:self:window).Prism={manual:!0,disableWorkerMessageHandler:!0};var a=n(23),l=n(39),o=n(46),i=n(47),u=n(48),c=n(49),s=n(50);r();var f={}.hasOwnProperty;function d(){}d.prototype=o;var p=new d;function m(e){if("function"!=typeof e||!e.displayName)throw new Error("Expected `function` for `grammar`, got `"+e+"`");void 0===p.languages[e.displayName]&&e(p)}e.exports=p,p.highlight=function(e,t){var n,r=o.highlight;if("string"!=typeof e)throw new Error("Expected `string` for `value`, got `"+e+"`");if("Object"===p.util.type(t))n=t,t=null;else{if("string"!=typeof t)throw new Error("Expected `string` for `name`, got `"+t+"`");if(!f.call(p.languages,t))throw new Error("Unknown language: `"+t+"` is not registered");n=p.languages[t]}return r.call(this,e,n,t)},p.register=m,p.registered=function(e){if("string"!=typeof e)throw new Error("Expected `string` for `language`, got `"+e+"`");return f.call(p.languages,e)},m(i),m(u),m(c),m(s),p.util.encode=function(e){return e},p.Token.stringify=function(e,t,n){var r;if("string"==typeof e)return{type:"text",value:e};if("Array"===p.util.type(e))return function(e,t){var n,r=[],a=e.length,l=-1;for(;++l<a;)""!==(n=e[l])&&null!=n&&r.push(n);l=-1,a=r.length;for(;++l<a;)n=r[l],r[l]=p.Token.stringify(n,t,r);return r}(e,t);r={type:e.type,content:p.Token.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n},e.alias&&(r.classes=r.classes.concat(e.alias));return p.hooks.run("wrap",r),a(r.tag+"."+r.classes.join("."),function(e){var t;for(t in e)e[t]=l(e[t]);return e}(r.attributes),r.content)}}).call(this,n(3))},function(e,t,n){"use strict"; /* object-assign (c) Sindre Sorhus @@ -28,4 +28,4 @@ object-assign * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -Object.defineProperty(t,"__esModule",{value:!0});var n=null,r=!1,a=3,l=-1,o=-1,i=!1,u=!1;function c(){if(!i){var e=n.expirationTime;u?S():u=!0,w(d,e)}}function s(){var e=n,t=n.next;if(n===t)n=null;else{var r=n.previous;n=r.next=t,t.previous=r}e.next=e.previous=null,r=e.callback,t=e.expirationTime,e=e.priorityLevel;var l=a,i=o;a=e,o=t;try{var u=r()}finally{a=l,o=i}if("function"==typeof u)if(u={callback:u,priorityLevel:e,expirationTime:t,next:null,previous:null},null===n)n=u.next=u.previous=u;else{r=null,e=n;do{if(e.expirationTime>=t){r=e;break}e=e.next}while(e!==n);null===r?r=n:r===n&&(n=u,c()),(t=r.previous).next=r.previous=u,u.next=r,u.previous=t}}function f(){if(-1===l&&null!==n&&1===n.priorityLevel){i=!0;try{do{s()}while(null!==n&&1===n.priorityLevel)}finally{i=!1,null!==n?c():u=!1}}}function d(e){i=!0;var a=r;r=e;try{if(e)for(;null!==n;){var l=t.unstable_now();if(!(n.expirationTime<=l))break;do{s()}while(null!==n&&n.expirationTime<=l)}else if(null!==n)do{s()}while(null!==n&&!T())}finally{i=!1,r=a,null!==n?c():u=!1,f()}}var p,m,h=Date,g="function"==typeof setTimeout?setTimeout:void 0,y="function"==typeof clearTimeout?clearTimeout:void 0,v="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,b="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0;function k(e){p=v(function(t){y(m),e(t)}),m=g(function(){b(p),e(t.unstable_now())},100)}if("object"==typeof performance&&"function"==typeof performance.now){var x=performance;t.unstable_now=function(){return x.now()}}else t.unstable_now=function(){return h.now()};var w,S,T,E=null;if("undefined"!=typeof window?E=window:void 0!==e&&(E=e),E&&E._schedMock){var C=E._schedMock;w=C[0],S=C[1],T=C[2],t.unstable_now=C[3]}else if("undefined"==typeof window||"function"!=typeof MessageChannel){var _=null,P=function(e){if(null!==_)try{_(e)}finally{_=null}};w=function(e){null!==_?setTimeout(w,0,e):(_=e,setTimeout(P,0,!1))},S=function(){_=null},T=function(){return!1}}else{"undefined"!=typeof console&&("function"!=typeof v&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof b&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var N=null,O=!1,M=-1,A=!1,D=!1,I=0,j=33,z=33;T=function(){return I<=t.unstable_now()};var F=new MessageChannel,L=F.port2;F.port1.onmessage=function(){O=!1;var e=N,n=M;N=null,M=-1;var r=t.unstable_now(),a=!1;if(0>=I-r){if(!(-1!==n&&n<=r))return A||(A=!0,k(U)),N=e,void(M=n);a=!0}if(null!==e){D=!0;try{e(a)}finally{D=!1}}};var U=function(e){if(null!==N){k(U);var t=e-I+z;t<z&&j<z?(8>t&&(t=8),z=t<j?j:t):j=t,I=e+z,O||(O=!0,L.postMessage(void 0))}else A=!1};w=function(e,t){N=e,M=t,D||0>t?L.postMessage(void 0):A||(A=!0,k(U))},S=function(){N=null,O=!1,M=-1}}t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,n){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=a,o=l;a=e,l=t.unstable_now();try{return n()}finally{a=r,l=o,f()}},t.unstable_next=function(e){switch(a){case 1:case 2:case 3:var n=3;break;default:n=a}var r=a,o=l;a=n,l=t.unstable_now();try{return e()}finally{a=r,l=o,f()}},t.unstable_scheduleCallback=function(e,r){var o=-1!==l?l:t.unstable_now();if("object"==typeof r&&null!==r&&"number"==typeof r.timeout)r=o+r.timeout;else switch(a){case 1:r=o+-1;break;case 2:r=o+250;break;case 5:r=o+1073741823;break;case 4:r=o+1e4;break;default:r=o+5e3}if(e={callback:e,priorityLevel:a,expirationTime:r,next:null,previous:null},null===n)n=e.next=e.previous=e,c();else{o=null;var i=n;do{if(i.expirationTime>r){o=i;break}i=i.next}while(i!==n);null===o?o=n:o===n&&(n=e,c()),(r=o.previous).next=o.previous=e,e.next=o,e.previous=r}return e},t.unstable_cancelCallback=function(e){var t=e.next;if(null!==t){if(t===e)n=null;else{e===n&&(n=t);var r=e.previous;r.next=t,t.previous=r}e.next=e.previous=null}},t.unstable_wrapCallback=function(e){var n=a;return function(){var r=a,o=l;a=n,l=t.unstable_now();try{return e.apply(this,arguments)}finally{a=r,l=o,f()}}},t.unstable_getCurrentPriorityLevel=function(){return a},t.unstable_shouldYield=function(){return!r&&(null!==n&&n.expirationTime<o||T())},t.unstable_continueExecution=function(){null!==n&&c()},t.unstable_pauseExecution=function(){},t.unstable_getFirstCallbackNode=function(){return n}}).call(this,n(3))},function(e,t,n){"use strict";e.exports=n(24)},function(e,t,n){"use strict";var r=n(25),a=n(34)(r,"div");a.displayName="html",e.exports=a},function(e,t,n){"use strict";var r=n(26),a=n(28),l=n(29),o=n(30),i=n(32),u=n(33);e.exports=r([l,a,o,i,u])},function(e,t,n){"use strict";var r=n(27),a=n(9);e.exports=function(e){var t,n,l=e.length,o=[],i=[],u=-1;for(;++u<l;)t=e[u],o.push(t.property),i.push(t.normal),n=t.space;return new a(r.apply(null,o),r.apply(null,i),n)}},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var a in r)n.call(r,a)&&(e[a]=r[a])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";var r=n(1);e.exports=r({space:"xlink",transform:function(e,t){return"xlink:"+t.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}})},function(e,t,n){"use strict";var r=n(1);e.exports=r({space:"xml",transform:function(e,t){return"xml:"+t.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}})},function(e,t,n){"use strict";var r=n(1),a=n(12);e.exports=r({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:a,properties:{xmlns:null,xmlnsXLink:null}})},function(e,t,n){"use strict";e.exports=function(e,t){return t in e?e[t]:t}},function(e,t,n){"use strict";var r=n(5),a=n(1),l=r.booleanish,o=r.number,i=r.spaceSeparated;e.exports=a({transform:function(e,t){return"role"===t?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:l,ariaAutoComplete:null,ariaBusy:l,ariaChecked:l,ariaColCount:o,ariaColIndex:o,ariaColSpan:o,ariaControls:i,ariaCurrent:null,ariaDescribedBy:i,ariaDetails:null,ariaDisabled:l,ariaDropEffect:i,ariaErrorMessage:null,ariaExpanded:l,ariaFlowTo:i,ariaGrabbed:l,ariaHasPopup:null,ariaHidden:l,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:i,ariaLevel:o,ariaLive:null,ariaModal:l,ariaMultiLine:l,ariaMultiSelectable:l,ariaOrientation:null,ariaOwns:i,ariaPlaceholder:null,ariaPosInSet:o,ariaPressed:l,ariaReadOnly:l,ariaRelevant:null,ariaRequired:l,ariaRoleDescription:i,ariaRowCount:o,ariaRowIndex:o,ariaRowSpan:o,ariaSelected:l,ariaSetSize:o,ariaSort:null,ariaValueMax:o,ariaValueMin:o,ariaValueNow:o,ariaValueText:null,role:null}})},function(e,t,n){"use strict";var r=n(5),a=n(1),l=n(12),o=r.boolean,i=r.overloadedBoolean,u=r.booleanish,c=r.number,s=r.spaceSeparated,f=r.commaSeparated;e.exports=a({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:l,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:f,acceptCharset:s,accessKey:s,action:null,allowFullScreen:o,allowPaymentRequest:o,allowUserMedia:o,alt:null,as:null,async:o,autoCapitalize:null,autoComplete:s,autoFocus:o,autoPlay:o,capture:o,charSet:null,checked:o,cite:null,className:s,cols:c,colSpan:null,content:null,contentEditable:u,controls:o,controlsList:s,coords:c|f,crossOrigin:null,data:null,dateTime:null,decoding:null,default:o,defer:o,dir:null,dirName:null,disabled:o,download:i,draggable:u,encType:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:o,formTarget:null,headers:s,height:c,hidden:o,high:c,href:null,hrefLang:null,htmlFor:s,httpEquiv:s,id:null,inputMode:null,integrity:null,is:null,isMap:o,itemId:null,itemProp:s,itemRef:s,itemScope:o,itemType:s,kind:null,label:null,lang:null,language:null,list:null,loop:o,low:c,manifest:null,max:null,maxLength:c,media:null,method:null,min:null,minLength:c,multiple:o,muted:o,name:null,nonce:null,noModule:o,noValidate:o,open:o,optimum:c,pattern:null,ping:s,placeholder:null,playsInline:o,poster:null,preload:null,readOnly:o,referrerPolicy:null,rel:s,required:o,reversed:o,rows:c,rowSpan:c,sandbox:s,scope:null,scoped:o,seamless:o,selected:o,shape:null,size:c,sizes:null,slot:null,span:c,spellCheck:u,src:null,srcDoc:null,srcLang:null,srcSet:f,start:c,step:null,style:null,tabIndex:c,target:null,title:null,translate:null,type:null,typeMustMatch:o,useMap:null,value:u,width:c,wrap:null,align:null,aLink:null,archive:s,axis:null,background:null,bgColor:null,border:c,borderColor:null,bottomMargin:c,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:o,declare:o,event:null,face:null,frame:null,frameBorder:null,hSpace:c,leftMargin:c,link:null,longDesc:null,lowSrc:null,marginHeight:c,marginWidth:c,noResize:o,noHref:o,noShade:o,noWrap:o,object:null,profile:null,prompt:null,rev:null,rightMargin:c,rules:null,scheme:null,scrolling:u,standby:null,summary:null,text:null,topMargin:c,valueType:null,version:null,vAlign:null,vLink:null,vSpace:c,allowTransparency:null,autoCorrect:null,autoSave:null,prefix:null,property:null,results:c,security:null,unselectable:null}})},function(e,t,n){"use strict";var r=n(35),a=n(4),l=n(36),o=n(37).parse,i=n(38).parse;function u(e,t,n){var r=n;return e.number||e.positiveNumber?isNaN(r)||""===r||(r=Number(r)):(e.boolean||e.overloadedBoolean)&&("string"!=typeof r||""!==r&&a(n)!==a(t)||(r=!0)),r}e.exports=function(e,t){return function(e,r){var a,o=l(e,t),i=Array.prototype.slice.call(arguments,2);r&&function(e,t){return"string"==typeof e||"length"in e||function(e,t){var n=t.type;if("input"===e||!n||"string"!=typeof n)return!1;if("object"==typeof t.children&&"length"in t.children)return!0;if(n=n.toLowerCase(),"button"===e)return"menu"!==n&&"submit"!==n&&"reset"!==n&&"button"!==n;return"value"in t}(t.tagName,e)}(r,o)&&(i.unshift(r),r=null);if(r)for(a in r)n(o.properties,a,r[a]);(function e(t,n){var r,a;if("string"!=typeof n&&"number"!=typeof n)if("object"==typeof n&&"length"in n)for(r=-1,a=n.length;++r<a;)e(t,n[r]);else{if("object"!=typeof n||!("type"in n))throw new Error("Expected node, nodes, or string, got `"+n+"`");t.push(n)}else t.push({type:"text",value:String(n)})})(o.children,i),"template"===o.tagName&&(o.content={type:"root",children:o.children},o.children=[]);return o};function n(t,n,a){var l,c,s;null!=a&&a==a&&(l=r(e,n),c=l.property,"string"==typeof(s=a)&&(l.spaceSeparated?s=o(s):l.commaSeparated?s=i(s):l.commaOrSpaceSeparated&&(s=o(i(s).join(" ")))),"style"===c&&"string"!=typeof a&&(s=function(e){var t,n=[];for(t in e)n.push([t,e[t]].join(": "));return n.join("; ")}(s)),"className"===c&&t.className&&(s=t.className.concat(s)),t[c]=function(e,t,n){var r,a,l;if("object"!=typeof n||!("length"in n))return u(e,t,n);a=n.length,r=-1,l=[];for(;++r<a;)l[r]=u(e,t,n[r]);return l}(l,c,s))}}},function(e,t,n){"use strict";var r=n(4),a=n(10),l=n(11),o="data";e.exports=function(e,t){var n=r(t),d=t,p=l;if(n in e.normal)return e.property[e.normal[n]];n.length>4&&n.slice(0,4)===o&&i.test(t)&&("-"===t.charAt(4)?d=function(e){var t=e.slice(5).replace(u,f);return o+t.charAt(0).toUpperCase()+t.slice(1)}(t):t=function(e){var t=e.slice(4);if(u.test(t))return e;"-"!==(t=t.replace(c,s)).charAt(0)&&(t="-"+t);return o+t}(t),p=a);return new p(d,t)};var i=/^data[-a-z0-9.:_]+$/i,u=/-[a-z]/g,c=/[A-Z]/g;function s(e){return"-"+e.toLowerCase()}function f(e){return e.charAt(1).toUpperCase()}},function(e,t,n){"use strict";e.exports=function(e,t){var n,l,o,i,u,c=e||"",s=t||"div",f={},d=-1,p=c.length;for(;++d<=p;)(o=c.charCodeAt(d))&&o!==r&&o!==a||((i=c.slice(u,d))&&(l===r?n?n.push(i):(n=[i],f.className=n):l===a?f.id=i:s=i),u=d+1,l=o);return{type:"element",tagName:s,properties:f,children:[]}};var r=".".charCodeAt(0),a="#".charCodeAt(0)},function(e,t,n){"use strict";var r=n(13);t.parse=function(e){var t=r(String(e||a));return t===a?[]:t.split(o)},t.stringify=function(e){return r(e.join(l))};var a="",l=" ",o=/[ \t\n\r\f]+/g},function(e,t,n){"use strict";t.parse=function(e){var t,n=[],l=String(e||o),i=l.indexOf(a),u=0,c=!1;for(;!c;)-1===i&&(i=l.length,c=!0),!(t=r(l.slice(u,i)))&&c||n.push(t),u=i+1,i=l.indexOf(a,u);return n},t.stringify=function(e,t){var n=t||{},i=!1===n.padLeft?o:l,u=n.padRight?l:o;e[e.length-1]===o&&(e=e.concat(o));return r(e.join(u+a+i))};var r=n(13),a=",",l=" ",o=""},function(e,t,n){"use strict";var r=n(40),a=n(41),l=n(14),o=n(42),i=n(43),u=n(45);e.exports=function(e,t){var n,l,o={};t||(t={});for(l in d)n=t[l],o[l]=null==n?d[l]:n;(o.position.indent||o.position.start)&&(o.indent=o.position.indent||[],o.position=o.position.start);return function(e,t){var n,l,o,d,_,P,N,O,M,A,D,I,j,z,F,L,U,R,W,B=t.additional,V=t.nonTerminated,$=t.text,H=t.reference,Q=t.warning,q=t.textContext,K=t.referenceContext,Y=t.warningContext,G=t.position,X=t.indent||[],Z=e.length,J=0,ee=-1,te=G.column||1,ne=G.line||1,re="",ae=[];L=oe(),O=Q?function(e,t){var n=oe();n.column+=t,n.offset+=t,Q.call(Y,E[e],n,e)}:f,J--,Z++;for(;++J<Z;)if("\n"===_&&(te=X[ee]||1),"&"!==(_=ie(J)))"\n"===_&&(ne++,ee++,te=0),_?(re+=_,te++):ue();else{if("\t"===(N=ie(J+1))||"\n"===N||"\f"===N||" "===N||"<"===N||"&"===N||""===N||B&&N===B){re+=_,te++;continue}for(I=j=J+1,W=j,"#"!==N?z=p:(W=++I,"x"===(N=ie(W))||"X"===N?(z=m,W=++I):z=h),n="",D="",d="",F=y[z],W--;++W<Z&&(N=ie(W),F(N));)d+=N,z===p&&c.call(r,d)&&(n=d,D=r[d]);(o=";"===ie(W))&&(W++,(l=z===p&&u(d))&&(n=d,D=l)),R=1+W-j,(o||V)&&(d?z===p?(o&&!D?O(w,1):(n!==d&&(W=I+n.length,R=1+W-I,o=!1),o||(M=n?v:k,t.attribute?"="===(N=ie(W))?(O(M,R),D=null):i(N)?D=null:O(M,R):O(M,R))),P=D):(o||O(b,R),P=parseInt(d,g[z]),(le=P)>=55296&&le<=57343||le>1114111?(O(T,R),P="�"):P in a?(O(S,R),P=a[P]):(A="",C(P)&&O(S,R),P>65535&&(A+=s((P-=65536)>>>10|55296),P=56320|1023&P),P=A+s(P))):z!==p&&O(x,R)),P?(ue(),L=oe(),J=W-1,te+=W-j+1,ae.push(P),(U=oe()).offset++,H&&H.call(K,P,{start:L,end:U},e.slice(j-1,W)),L=U):(d=e.slice(j-1,W),re+=d,te+=d.length,J=W-1)}var le;return ae.join("");function oe(){return{line:ne,column:te,offset:J+(G.offset||0)}}function ie(t){return e.charAt(t)}function ue(){re&&(ae.push(re),$&&$.call(q,re,{start:L,end:oe()}),re="")}}(e,o)};var c={}.hasOwnProperty,s=String.fromCharCode,f=Function.prototype,d={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},p="named",m="hexadecimal",h="decimal",g={};g[m]=16,g[h]=10;var y={};y[p]=i,y[h]=l,y[m]=o;var v=1,b=2,k=3,x=4,w=5,S=6,T=7,E={};function C(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||65535==(65535&e)||65534==(65535&e)}E[v]="Named character references must be terminated by a semicolon",E[b]="Numeric character references must be terminated by a semicolon",E[k]="Named character references cannot be empty",E[x]="Numeric character references cannot be empty",E[w]="Named character references must be known",E[S]="Numeric character references cannot be disallowed",E[T]="Numeric character references cannot be outside the permissible Unicode range"},function(e){e.exports={AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"}},function(e){e.exports={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"}},function(e,t,n){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}},function(e,t,n){"use strict";var r=n(44),a=n(14);e.exports=function(e){return r(e)||a(e)}},function(e,t,n){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}},function(e,t,n){"use strict";var r;e.exports=function(e){var t,n="&"+e+";";if((r=r||document.createElement("i")).innerHTML=n,";"===(t=r.textContent).slice(-1)&&"semi"!==e)return!1;return t!==n&&t}},function(e,t,n){(function(t){var n="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},r=function(){var e=/\blang(?:uage)?-([\w-]+)\b/i,t=0,r=n.Prism={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof a?new a(e.type,r.util.encode(e.content),e.alias):"Array"===r.util.type(e)?e.map(r.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e,t){var n=r.util.type(e);switch(t=t||{},n){case"Object":if(t[r.util.objId(e)])return t[r.util.objId(e)];var a={};for(var l in t[r.util.objId(e)]=a,e)e.hasOwnProperty(l)&&(a[l]=r.util.clone(e[l],t));return a;case"Array":if(t[r.util.objId(e)])return t[r.util.objId(e)];a=[];return t[r.util.objId(e)]=a,e.forEach(function(e,n){a[n]=r.util.clone(e,t)}),a}return e}},languages:{extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var l=(a=a||r.languages)[e];if(2==arguments.length){for(var o in n=arguments[1])n.hasOwnProperty(o)&&(l[o]=n[o]);return l}var i={};for(var u in l)if(l.hasOwnProperty(u)){if(u==t)for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);i[u]=l[u]}return r.languages.DFS(r.languages,function(t,n){n===a[e]&&t!=e&&(this[t]=i)}),a[e]=i},DFS:function(e,t,n,a){for(var l in a=a||{},e)e.hasOwnProperty(l)&&(t.call(e,l,e[l],n||l),"Object"!==r.util.type(e[l])||a[r.util.objId(e[l])]?"Array"!==r.util.type(e[l])||a[r.util.objId(e[l])]||(a[r.util.objId(e[l])]=!0,r.languages.DFS(e[l],t,l,a)):(a[r.util.objId(e[l])]=!0,r.languages.DFS(e[l],t,null,a)))}},plugins:{},highlightAll:function(e,t){r.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var a={callback:n,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",a);for(var l,o=a.elements||e.querySelectorAll(a.selector),i=0;l=o[i++];)r.highlightElement(l,!0===t,a.callback)},highlightElement:function(t,a,l){for(var o,i,u=t;u&&!e.test(u.className);)u=u.parentNode;u&&(o=(u.className.match(e)||[,""])[1].toLowerCase(),i=r.languages[o]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+o,t.parentNode&&(u=t.parentNode,/pre/i.test(u.nodeName)&&(u.className=u.className.replace(e,"").replace(/\s+/g," ")+" language-"+o));var c={element:t,language:o,grammar:i,code:t.textContent};if(r.hooks.run("before-sanity-check",c),!c.code||!c.grammar)return c.code&&(r.hooks.run("before-highlight",c),c.element.textContent=c.code,r.hooks.run("after-highlight",c)),void r.hooks.run("complete",c);if(r.hooks.run("before-highlight",c),a&&n.Worker){var s=new Worker(r.filename);s.onmessage=function(e){c.highlightedCode=e.data,r.hooks.run("before-insert",c),c.element.innerHTML=c.highlightedCode,l&&l.call(c.element),r.hooks.run("after-highlight",c),r.hooks.run("complete",c)},s.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else c.highlightedCode=r.highlight(c.code,c.grammar,c.language),r.hooks.run("before-insert",c),c.element.innerHTML=c.highlightedCode,l&&l.call(t),r.hooks.run("after-highlight",c),r.hooks.run("complete",c)},highlight:function(e,t,n){var l={code:e,grammar:t,language:n};return r.hooks.run("before-tokenize",l),l.tokens=r.tokenize(l.code,l.grammar),r.hooks.run("after-tokenize",l),a.stringify(r.util.encode(l.tokens),l.language)},matchGrammar:function(e,t,n,a,l,o,i){var u=r.Token;for(var c in n)if(n.hasOwnProperty(c)&&n[c]){if(c==i)return;var s=n[c];s="Array"===r.util.type(s)?s:[s];for(var f=0;f<s.length;++f){var d=s[f],p=d.inside,m=!!d.lookbehind,h=!!d.greedy,g=0,y=d.alias;if(h&&!d.pattern.global){var v=d.pattern.toString().match(/[imuy]*$/)[0];d.pattern=RegExp(d.pattern.source,v+"g")}d=d.pattern||d;for(var b=a,k=l;b<t.length;k+=t[b].length,++b){var x=t[b];if(t.length>e.length)return;if(!(x instanceof u)){if(h&&b!=t.length-1){if(d.lastIndex=k,!(_=d.exec(e)))break;for(var w=_.index+(m?_[1].length:0),S=_.index+_[0].length,T=b,E=k,C=t.length;T<C&&(E<S||!t[T].type&&!t[T-1].greedy);++T)w>=(E+=t[T].length)&&(++b,k=E);if(t[b]instanceof u)continue;P=T-b,x=e.slice(k,E),_.index-=k}else{d.lastIndex=0;var _=d.exec(x),P=1}if(_){m&&(g=_[1]?_[1].length:0);S=(w=_.index+g)+(_=_[0].slice(g)).length;var N=x.slice(0,w),O=x.slice(S),M=[b,P];N&&(++b,k+=N.length,M.push(N));var A=new u(c,p?r.tokenize(_,p):_,y,_,h);if(M.push(A),O&&M.push(O),Array.prototype.splice.apply(t,M),1!=P&&r.matchGrammar(e,t,n,b,k,!0,c),o)break}else if(o)break}}}}},tokenize:function(e,t,n){var a=[e],l=t.rest;if(l){for(var o in l)t[o]=l[o];delete t.rest}return r.matchGrammar(e,a,t,0,0,!1),a},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var a,l=0;a=n[l++];)a(t)}}},a=r.Token=function(e,t,n,r,a){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!a};if(a.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if(e.alias){var o="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,o)}r.hooks.run("wrap",l);var i=Object.keys(l.attributes).map(function(e){return e+'="'+(l.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+l.tag+' class="'+l.classes.join(" ")+'"'+(i?" "+i:"")+">"+l.content+"</"+l.tag+">"},!n.document)return n.addEventListener?(r.disableWorkerMessageHandler||n.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,l=t.code,o=t.immediateClose;n.postMessage(r.highlight(l,r.languages[a],a)),o&&n.close()},!1),n.Prism):n.Prism;var l=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return l&&(r.filename=l.src,r.manual||l.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(r.highlightAll):window.setTimeout(r.highlightAll,16):document.addEventListener("DOMContentLoaded",r.highlightAll))),n.Prism}();e.exports&&(e.exports=r),void 0!==t&&(t.Prism=r)}).call(this,n(3))},function(e,t,n){"use strict";function r(e){e.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:/<!DOCTYPE[\s\S]+?>/i,cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.value.replace(/&/,"&"))}),e.languages.xml=e.languages.markup,e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup}e.exports=r,r.displayName="markup",r.aliases=["xml","html","mathml","svg"]},function(e,t,n){"use strict";function r(e){e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup&&(e.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:e.languages.css,alias:"language-css",greedy:!0}}),e.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:e.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:e.languages.css}},alias:"language-css"}},e.languages.markup.tag))}e.exports=r,r.displayName="css",r.aliases=[]},function(e,t,n){"use strict";function r(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}}e.exports=r,r.displayName="clike",r.aliases=[]},function(e,t,n){"use strict";function r(e){e.languages.javascript=e.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,function:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),e.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"},constant:/\b[A-Z][A-Z\d_]*\b/}),e.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\${[^}]+}/,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}}}),e.languages.javascript["template-string"].inside.interpolation.inside.rest=e.languages.javascript,e.languages.markup&&e.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:e.languages.javascript,alias:"language-javascript",greedy:!0}}),e.languages.js=e.languages.javascript}e.exports=r,r.displayName="javascript",r.aliases=["js"]},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),l=n(15),o=n.n(l),i=n(16),u=n.n(i),c=n(17),s=n.n(c),f=n(2),d=n.n(f);function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return e.reduce(function(e,t){return d()({},e,n[t])},t)}function m(e){var t,n=e.node,r=e.stylesheet,l=e.style,o=void 0===l?{}:l,i=e.useInlineStyles,u=e.key,c=n.properties,f=n.type,h=n.tagName,g=n.value;if("text"===f)return g;if(h){var y=function(e,t){var n=0;return function(r){return n+=1,r.map(function(r,a){return m({node:r,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(a)})})}}(r,i),v=i&&c.className&&c.className.filter(function(e){return!r[e]}),b=v&&v.length?v:void 0,k=i?d()({},c,{className:b},{style:p(c.className,Object.assign({},c.style,o),r)}):d()({},c,{className:(t=c.className,t.join(" "))}),x=y(n.children);return a.a.createElement(h,s()({key:u},k),x)}}var h=/\n/g;function g(e){var t=e.codeString,n=e.codeStyle,r=e.containerStyle,l=void 0===r?{float:"left",paddingRight:"10px"}:r,o=e.numberStyle,i=void 0===o?{}:o,u=e.startingLineNumber;return a.a.createElement("code",{style:Object.assign({},n,l)},function(e){var t=e.lines,n=e.startingLineNumber,r=e.style;return t.map(function(e,t){var l=t+n;return a.a.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof r?r(l):r},"".concat(l,"\n"))})}({lines:t.replace(/\n$/,"").split("\n"),style:i,startingLineNumber:u}))}function y(e){var t=e.children,n=e.lineNumber,r=e.lineProps,a=e.className,l=void 0===a?[]:a,o=("function"==typeof r?r(n):r)||{};return o.className=o.className?l.concat(o.className):l,{type:"element",tagName:"span",properties:o,children:t}}function v(e,t){for(var n=function e(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=0;a<t.length;a++){var l=t[a];if("text"===l.type)r.push(y({children:[l],className:n}));else if(l.children){var o=n.concat(l.properties.className);r=r.concat(e(l.children,o))}}return r}(e.value),r=[],a=-1,l=0,o=function(){var e=n[l],o=e.children[0].value;if(o.match(h)){var i=o.split("\n");i.forEach(function(o,u){var c=r.length+1,s={type:"text",value:"".concat(o,"\n")};if(0===u){var f=n.slice(a+1,l).concat(y({children:[s],className:e.properties.className}));r.push(y({children:f,lineNumber:c,lineProps:t}))}else if(u===i.length-1){if(n[l+1]&&n[l+1].children&&n[l+1].children[0]){var d=y({children:[{type:"text",value:"".concat(o)}],className:e.properties.className});n.splice(l+1,0,d)}else r.push(y({children:[s],lineNumber:c,lineProps:t,className:e.properties.className}))}else r.push(y({children:[s],lineNumber:c,lineProps:t,className:e.properties.className}))}),a=l}l++};l<n.length;)o();if(a!==n.length-1){var i=n.slice(a+1,n.length);i&&i.length&&r.push(y({children:i,lineNumber:r.length+1,lineProps:t}))}return r}function b(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map(function(e,t){return m({node:e,stylesheet:n,useInlineStyles:r,key:"code-segement".concat(t)})})}var k,x,w=n(7),S=n.n(w),T=(k=S.a,x={},function(e){var t=e.language,n=e.children,r=e.style,l=void 0===r?x:r,o=e.customStyle,i=void 0===o?{}:o,c=e.codeTagProps,s=void 0===c?{style:l['code[class*="language-"]']}:c,f=e.useInlineStyles,d=void 0===f||f,p=e.showLineNumbers,m=void 0!==p&&p,h=e.startingLineNumber,y=void 0===h?1:h,w=e.lineNumberContainerStyle,S=e.lineNumberStyle,T=e.wrapLines,E=e.lineProps,C=void 0===E?{}:E,_=e.renderer,P=e.PreTag,N=void 0===P?"pre":P,O=e.CodeTag,M=void 0===O?"code":O,A=e.code,D=void 0===A?Array.isArray(n)?n[0]:n:A,I=e.astGenerator,j=u()(e,["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"]);I=I||k;var z=m?a.a.createElement(g,{containerStyle:w,codeStyle:s.style||{},numberStyle:S,startingLineNumber:y,codeString:D}):null,F=l.hljs||l['pre[class*="language-"]']||{backgroundColor:"#fff"},L=d?Object.assign({},j,{style:Object.assign({},F,i)}):Object.assign({},j,{className:"hljs"});if(!I)return a.a.createElement(N,L,z,a.a.createElement(M,s,D));T=!(!_||void 0!==T)||T,_=_||b;var U=[{type:"text",value:D}],R=function(e){var t=e.astGenerator,n=e.language,r=e.code,a=e.defaultCodeValue;if(t.getLanguage){var l=n&&t.getLanguage(n);return"text"===n?{value:a,language:"text"}:l?t.highlight(n,r):t.highlightAuto(r)}try{return n&&"text"!==n?{value:t.highlight(r,n)}:{value:a}}catch(e){return{value:a}}}({astGenerator:I,language:t,code:D,defaultCodeValue:U});null===R.language&&(R.value=U);var W=T?v(R,C):R.value;return a.a.createElement(N,L,z,a.a.createElement(M,s,_({rows:W,stylesheet:l,useInlineStyles:d})))});T.registerLanguage=function(e,t){return S.a.register(t)};var E=T,C=n(18),_=n.n(C).a,P={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},".namespace":{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},N=n(6);function O(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,l=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw l}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function A(){return(A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}E.registerLanguage("jsx",_);var D=function(e){var t=e.children,n=e.handleClick,r=Object(N.useMouseUp)(n);return a.a.createElement("li",null,a.a.createElement("button",A({type:"button"},r),t))},I=function(e){var t=e.children,n=O(e,["children"]);return a.a.createElement("li",null,a.a.createElement("button",A({type:"button"},n),t))};o.a.render(a.a.createElement(a.a.Fragment,null,a.a.createElement("main",null,a.a.createElement("section",null,a.a.createElement("h1",null,"Classic drop-down"),a.a.createElement(function(){var e=M(Object(r.useState)(!1),2),t=e[0],n=e[1];return a.a.createElement("div",{className:"dropdown"},a.a.createElement("button",{type:"button",onClick:function(){return n(function(e){return!e})}},"Open drop-down"),a.a.createElement("ul",{style:{display:t?"block":"none"}},a.a.createElement(I,{onClick:function(){return n(!1)}},"Action #1"),a.a.createElement(I,{onClick:function(){return n(!1)}},"Action #2"),a.a.createElement(I,{onClick:function(){return n(!1)}},"Action #3")))},null),a.a.createElement("h2",null,"Source Code"),a.a.createElement(E,{language:"jsx",style:P},'const DropDownItem = ({ children, ...rest }) => (\n <li>\n <button type="button" {...rest}>\n {children}\n </button>\n </li>\n);\n\nconst DropDown = () => {\n const [open, setOpen] = useState(false);\n\n return (\n <div className="dropdown">\n <button type="button" onClick={() => setOpen(state => !state)}>\n Open drop-down\n </button>\n <ul style={{ display: open ? \'block\' : \'none\' }}>\n <DropDownItem onClick={() => setOpen(false)}>Action #1</DropDownItem>\n <DropDownItem onClick={() => setOpen(false)}>Action #2</DropDownItem>\n <DropDownItem onClick={() => setOpen(false)}>Action #3</DropDownItem>\n </ul>\n </div>\n );\n};')),a.a.createElement("section",null,a.a.createElement("h1",null,"Faster usable drop-down"),a.a.createElement("p",null,"On desktop, you can simply keep mouse button down, drag down and release the button on the wanted item."),a.a.createElement(function(){var e=M(Object(r.useState)(!1),2),t=e[0],n=e[1],l=Object(N.useMouseDown)(function(){return n(function(e){return!e})});return a.a.createElement("div",{className:"dropdown"},a.a.createElement("button",A({type:"button"},l),"Open drop-down"),a.a.createElement("ul",{style:{display:t?"block":"none"}},a.a.createElement(D,{handleClick:function(){return n(!1)}},"Action #1"),a.a.createElement(D,{handleClick:function(){return n(!1)}},"Action #2"),a.a.createElement(D,{handleClick:function(){return n(!1)}},"Action #3")))},null),a.a.createElement("h2",null,"Source Code"),a.a.createElement(E,{language:"jsx",style:P},'const DropDownItem = ({ children, handleClick }) => {\n const props = useMouseUp(handleClick);\n\n return (\n <li>\n <button type="button" {...props}>\n {children}\n </button>\n </li>\n );\n};\n\nconst DropDown = () => {\n const [open, setOpen] = useState(false);\n\n const props = useMouseDown(() => setOpen(state => !state));\n\n return (\n <div className="dropdown">\n <button type="button" {...props}>\n Open drop-down\n </button>\n <ul style={{ display: open ? \'block\' : \'none\' }}>\n <DropDownItem handleClick={() => setOpen(false)}>Action #1</DropDownItem>\n <DropDownItem handleClick={() => setOpen(false)}>Action #2</DropDownItem>\n <DropDownItem handleClick={() => setOpen(false)}>Action #3</DropDownItem>\n </ul>\n </div>\n );\n};')))),document.getElementById("app"))}]); \ No newline at end of file +Object.defineProperty(t,"__esModule",{value:!0});var n=null,r=!1,a=3,l=-1,o=-1,i=!1,u=!1;function c(){if(!i){var e=n.expirationTime;u?S():u=!0,w(d,e)}}function s(){var e=n,t=n.next;if(n===t)n=null;else{var r=n.previous;n=r.next=t,t.previous=r}e.next=e.previous=null,r=e.callback,t=e.expirationTime,e=e.priorityLevel;var l=a,i=o;a=e,o=t;try{var u=r()}finally{a=l,o=i}if("function"==typeof u)if(u={callback:u,priorityLevel:e,expirationTime:t,next:null,previous:null},null===n)n=u.next=u.previous=u;else{r=null,e=n;do{if(e.expirationTime>=t){r=e;break}e=e.next}while(e!==n);null===r?r=n:r===n&&(n=u,c()),(t=r.previous).next=r.previous=u,u.next=r,u.previous=t}}function f(){if(-1===l&&null!==n&&1===n.priorityLevel){i=!0;try{do{s()}while(null!==n&&1===n.priorityLevel)}finally{i=!1,null!==n?c():u=!1}}}function d(e){i=!0;var a=r;r=e;try{if(e)for(;null!==n;){var l=t.unstable_now();if(!(n.expirationTime<=l))break;do{s()}while(null!==n&&n.expirationTime<=l)}else if(null!==n)do{s()}while(null!==n&&!T())}finally{i=!1,r=a,null!==n?c():u=!1,f()}}var p,m,h=Date,g="function"==typeof setTimeout?setTimeout:void 0,y="function"==typeof clearTimeout?clearTimeout:void 0,v="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,b="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0;function k(e){p=v(function(t){y(m),e(t)}),m=g(function(){b(p),e(t.unstable_now())},100)}if("object"==typeof performance&&"function"==typeof performance.now){var x=performance;t.unstable_now=function(){return x.now()}}else t.unstable_now=function(){return h.now()};var w,S,T,E=null;if("undefined"!=typeof window?E=window:void 0!==e&&(E=e),E&&E._schedMock){var C=E._schedMock;w=C[0],S=C[1],T=C[2],t.unstable_now=C[3]}else if("undefined"==typeof window||"function"!=typeof MessageChannel){var _=null,P=function(e){if(null!==_)try{_(e)}finally{_=null}};w=function(e){null!==_?setTimeout(w,0,e):(_=e,setTimeout(P,0,!1))},S=function(){_=null},T=function(){return!1}}else{"undefined"!=typeof console&&("function"!=typeof v&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof b&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var N=null,O=!1,M=-1,A=!1,D=!1,I=0,j=33,z=33;T=function(){return I<=t.unstable_now()};var F=new MessageChannel,L=F.port2;F.port1.onmessage=function(){O=!1;var e=N,n=M;N=null,M=-1;var r=t.unstable_now(),a=!1;if(0>=I-r){if(!(-1!==n&&n<=r))return A||(A=!0,k(U)),N=e,void(M=n);a=!0}if(null!==e){D=!0;try{e(a)}finally{D=!1}}};var U=function(e){if(null!==N){k(U);var t=e-I+z;t<z&&j<z?(8>t&&(t=8),z=t<j?j:t):j=t,I=e+z,O||(O=!0,L.postMessage(void 0))}else A=!1};w=function(e,t){N=e,M=t,D||0>t?L.postMessage(void 0):A||(A=!0,k(U))},S=function(){N=null,O=!1,M=-1}}t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,n){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=a,o=l;a=e,l=t.unstable_now();try{return n()}finally{a=r,l=o,f()}},t.unstable_next=function(e){switch(a){case 1:case 2:case 3:var n=3;break;default:n=a}var r=a,o=l;a=n,l=t.unstable_now();try{return e()}finally{a=r,l=o,f()}},t.unstable_scheduleCallback=function(e,r){var o=-1!==l?l:t.unstable_now();if("object"==typeof r&&null!==r&&"number"==typeof r.timeout)r=o+r.timeout;else switch(a){case 1:r=o+-1;break;case 2:r=o+250;break;case 5:r=o+1073741823;break;case 4:r=o+1e4;break;default:r=o+5e3}if(e={callback:e,priorityLevel:a,expirationTime:r,next:null,previous:null},null===n)n=e.next=e.previous=e,c();else{o=null;var i=n;do{if(i.expirationTime>r){o=i;break}i=i.next}while(i!==n);null===o?o=n:o===n&&(n=e,c()),(r=o.previous).next=o.previous=e,e.next=o,e.previous=r}return e},t.unstable_cancelCallback=function(e){var t=e.next;if(null!==t){if(t===e)n=null;else{e===n&&(n=t);var r=e.previous;r.next=t,t.previous=r}e.next=e.previous=null}},t.unstable_wrapCallback=function(e){var n=a;return function(){var r=a,o=l;a=n,l=t.unstable_now();try{return e.apply(this,arguments)}finally{a=r,l=o,f()}}},t.unstable_getCurrentPriorityLevel=function(){return a},t.unstable_shouldYield=function(){return!r&&(null!==n&&n.expirationTime<o||T())},t.unstable_continueExecution=function(){null!==n&&c()},t.unstable_pauseExecution=function(){},t.unstable_getFirstCallbackNode=function(){return n}}).call(this,n(3))},function(e,t,n){"use strict";e.exports=n(24)},function(e,t,n){"use strict";var r=n(25),a=n(34)(r,"div");a.displayName="html",e.exports=a},function(e,t,n){"use strict";var r=n(26),a=n(28),l=n(29),o=n(30),i=n(32),u=n(33);e.exports=r([l,a,o,i,u])},function(e,t,n){"use strict";var r=n(27),a=n(9);e.exports=function(e){var t,n,l=e.length,o=[],i=[],u=-1;for(;++u<l;)t=e[u],o.push(t.property),i.push(t.normal),n=t.space;return new a(r.apply(null,o),r.apply(null,i),n)}},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var a in r)n.call(r,a)&&(e[a]=r[a])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";var r=n(1);e.exports=r({space:"xlink",transform:function(e,t){return"xlink:"+t.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}})},function(e,t,n){"use strict";var r=n(1);e.exports=r({space:"xml",transform:function(e,t){return"xml:"+t.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}})},function(e,t,n){"use strict";var r=n(1),a=n(12);e.exports=r({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:a,properties:{xmlns:null,xmlnsXLink:null}})},function(e,t,n){"use strict";e.exports=function(e,t){return t in e?e[t]:t}},function(e,t,n){"use strict";var r=n(5),a=n(1),l=r.booleanish,o=r.number,i=r.spaceSeparated;e.exports=a({transform:function(e,t){return"role"===t?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:l,ariaAutoComplete:null,ariaBusy:l,ariaChecked:l,ariaColCount:o,ariaColIndex:o,ariaColSpan:o,ariaControls:i,ariaCurrent:null,ariaDescribedBy:i,ariaDetails:null,ariaDisabled:l,ariaDropEffect:i,ariaErrorMessage:null,ariaExpanded:l,ariaFlowTo:i,ariaGrabbed:l,ariaHasPopup:null,ariaHidden:l,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:i,ariaLevel:o,ariaLive:null,ariaModal:l,ariaMultiLine:l,ariaMultiSelectable:l,ariaOrientation:null,ariaOwns:i,ariaPlaceholder:null,ariaPosInSet:o,ariaPressed:l,ariaReadOnly:l,ariaRelevant:null,ariaRequired:l,ariaRoleDescription:i,ariaRowCount:o,ariaRowIndex:o,ariaRowSpan:o,ariaSelected:l,ariaSetSize:o,ariaSort:null,ariaValueMax:o,ariaValueMin:o,ariaValueNow:o,ariaValueText:null,role:null}})},function(e,t,n){"use strict";var r=n(5),a=n(1),l=n(12),o=r.boolean,i=r.overloadedBoolean,u=r.booleanish,c=r.number,s=r.spaceSeparated,f=r.commaSeparated;e.exports=a({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:l,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:f,acceptCharset:s,accessKey:s,action:null,allowFullScreen:o,allowPaymentRequest:o,allowUserMedia:o,alt:null,as:null,async:o,autoCapitalize:null,autoComplete:s,autoFocus:o,autoPlay:o,capture:o,charSet:null,checked:o,cite:null,className:s,cols:c,colSpan:null,content:null,contentEditable:u,controls:o,controlsList:s,coords:c|f,crossOrigin:null,data:null,dateTime:null,decoding:null,default:o,defer:o,dir:null,dirName:null,disabled:o,download:i,draggable:u,encType:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:o,formTarget:null,headers:s,height:c,hidden:o,high:c,href:null,hrefLang:null,htmlFor:s,httpEquiv:s,id:null,inputMode:null,integrity:null,is:null,isMap:o,itemId:null,itemProp:s,itemRef:s,itemScope:o,itemType:s,kind:null,label:null,lang:null,language:null,list:null,loop:o,low:c,manifest:null,max:null,maxLength:c,media:null,method:null,min:null,minLength:c,multiple:o,muted:o,name:null,nonce:null,noModule:o,noValidate:o,open:o,optimum:c,pattern:null,ping:s,placeholder:null,playsInline:o,poster:null,preload:null,readOnly:o,referrerPolicy:null,rel:s,required:o,reversed:o,rows:c,rowSpan:c,sandbox:s,scope:null,scoped:o,seamless:o,selected:o,shape:null,size:c,sizes:null,slot:null,span:c,spellCheck:u,src:null,srcDoc:null,srcLang:null,srcSet:f,start:c,step:null,style:null,tabIndex:c,target:null,title:null,translate:null,type:null,typeMustMatch:o,useMap:null,value:u,width:c,wrap:null,align:null,aLink:null,archive:s,axis:null,background:null,bgColor:null,border:c,borderColor:null,bottomMargin:c,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:o,declare:o,event:null,face:null,frame:null,frameBorder:null,hSpace:c,leftMargin:c,link:null,longDesc:null,lowSrc:null,marginHeight:c,marginWidth:c,noResize:o,noHref:o,noShade:o,noWrap:o,object:null,profile:null,prompt:null,rev:null,rightMargin:c,rules:null,scheme:null,scrolling:u,standby:null,summary:null,text:null,topMargin:c,valueType:null,version:null,vAlign:null,vLink:null,vSpace:c,allowTransparency:null,autoCorrect:null,autoSave:null,prefix:null,property:null,results:c,security:null,unselectable:null}})},function(e,t,n){"use strict";var r=n(35),a=n(4),l=n(36),o=n(37).parse,i=n(38).parse;function u(e,t,n){var r=n;return e.number||e.positiveNumber?isNaN(r)||""===r||(r=Number(r)):(e.boolean||e.overloadedBoolean)&&("string"!=typeof r||""!==r&&a(n)!==a(t)||(r=!0)),r}e.exports=function(e,t){return function(e,r){var a,o=l(e,t),i=Array.prototype.slice.call(arguments,2);r&&function(e,t){return"string"==typeof e||"length"in e||function(e,t){var n=t.type;if("input"===e||!n||"string"!=typeof n)return!1;if("object"==typeof t.children&&"length"in t.children)return!0;if(n=n.toLowerCase(),"button"===e)return"menu"!==n&&"submit"!==n&&"reset"!==n&&"button"!==n;return"value"in t}(t.tagName,e)}(r,o)&&(i.unshift(r),r=null);if(r)for(a in r)n(o.properties,a,r[a]);(function e(t,n){var r,a;if("string"!=typeof n&&"number"!=typeof n)if("object"==typeof n&&"length"in n)for(r=-1,a=n.length;++r<a;)e(t,n[r]);else{if("object"!=typeof n||!("type"in n))throw new Error("Expected node, nodes, or string, got `"+n+"`");t.push(n)}else t.push({type:"text",value:String(n)})})(o.children,i),"template"===o.tagName&&(o.content={type:"root",children:o.children},o.children=[]);return o};function n(t,n,a){var l,c,s;null!=a&&a==a&&(l=r(e,n),c=l.property,"string"==typeof(s=a)&&(l.spaceSeparated?s=o(s):l.commaSeparated?s=i(s):l.commaOrSpaceSeparated&&(s=o(i(s).join(" ")))),"style"===c&&"string"!=typeof a&&(s=function(e){var t,n=[];for(t in e)n.push([t,e[t]].join(": "));return n.join("; ")}(s)),"className"===c&&t.className&&(s=t.className.concat(s)),t[c]=function(e,t,n){var r,a,l;if("object"!=typeof n||!("length"in n))return u(e,t,n);a=n.length,r=-1,l=[];for(;++r<a;)l[r]=u(e,t,n[r]);return l}(l,c,s))}}},function(e,t,n){"use strict";var r=n(4),a=n(10),l=n(11),o="data";e.exports=function(e,t){var n=r(t),d=t,p=l;if(n in e.normal)return e.property[e.normal[n]];n.length>4&&n.slice(0,4)===o&&i.test(t)&&("-"===t.charAt(4)?d=function(e){var t=e.slice(5).replace(u,f);return o+t.charAt(0).toUpperCase()+t.slice(1)}(t):t=function(e){var t=e.slice(4);if(u.test(t))return e;"-"!==(t=t.replace(c,s)).charAt(0)&&(t="-"+t);return o+t}(t),p=a);return new p(d,t)};var i=/^data[-a-z0-9.:_]+$/i,u=/-[a-z]/g,c=/[A-Z]/g;function s(e){return"-"+e.toLowerCase()}function f(e){return e.charAt(1).toUpperCase()}},function(e,t,n){"use strict";e.exports=function(e,t){var n,l,o,i,u,c=e||"",s=t||"div",f={},d=-1,p=c.length;for(;++d<=p;)(o=c.charCodeAt(d))&&o!==r&&o!==a||((i=c.slice(u,d))&&(l===r?n?n.push(i):(n=[i],f.className=n):l===a?f.id=i:s=i),u=d+1,l=o);return{type:"element",tagName:s,properties:f,children:[]}};var r=".".charCodeAt(0),a="#".charCodeAt(0)},function(e,t,n){"use strict";var r=n(13);t.parse=function(e){var t=r(String(e||a));return t===a?[]:t.split(o)},t.stringify=function(e){return r(e.join(l))};var a="",l=" ",o=/[ \t\n\r\f]+/g},function(e,t,n){"use strict";t.parse=function(e){var t,n=[],l=String(e||o),i=l.indexOf(a),u=0,c=!1;for(;!c;)-1===i&&(i=l.length,c=!0),!(t=r(l.slice(u,i)))&&c||n.push(t),u=i+1,i=l.indexOf(a,u);return n},t.stringify=function(e,t){var n=t||{},i=!1===n.padLeft?o:l,u=n.padRight?l:o;e[e.length-1]===o&&(e=e.concat(o));return r(e.join(u+a+i))};var r=n(13),a=",",l=" ",o=""},function(e,t,n){"use strict";var r=n(40),a=n(41),l=n(14),o=n(42),i=n(43),u=n(45);e.exports=function(e,t){var n,l,o={};t||(t={});for(l in d)n=t[l],o[l]=null==n?d[l]:n;(o.position.indent||o.position.start)&&(o.indent=o.position.indent||[],o.position=o.position.start);return function(e,t){var n,l,o,d,_,P,N,O,M,A,D,I,j,z,F,L,U,R,W,B=t.additional,V=t.nonTerminated,$=t.text,H=t.reference,Q=t.warning,q=t.textContext,K=t.referenceContext,Y=t.warningContext,G=t.position,X=t.indent||[],Z=e.length,J=0,ee=-1,te=G.column||1,ne=G.line||1,re="",ae=[];L=oe(),O=Q?function(e,t){var n=oe();n.column+=t,n.offset+=t,Q.call(Y,E[e],n,e)}:f,J--,Z++;for(;++J<Z;)if("\n"===_&&(te=X[ee]||1),"&"!==(_=ie(J)))"\n"===_&&(ne++,ee++,te=0),_?(re+=_,te++):ue();else{if("\t"===(N=ie(J+1))||"\n"===N||"\f"===N||" "===N||"<"===N||"&"===N||""===N||B&&N===B){re+=_,te++;continue}for(I=j=J+1,W=j,"#"!==N?z=p:(W=++I,"x"===(N=ie(W))||"X"===N?(z=m,W=++I):z=h),n="",D="",d="",F=y[z],W--;++W<Z&&(N=ie(W),F(N));)d+=N,z===p&&c.call(r,d)&&(n=d,D=r[d]);(o=";"===ie(W))&&(W++,(l=z===p&&u(d))&&(n=d,D=l)),R=1+W-j,(o||V)&&(d?z===p?(o&&!D?O(w,1):(n!==d&&(W=I+n.length,R=1+W-I,o=!1),o||(M=n?v:k,t.attribute?"="===(N=ie(W))?(O(M,R),D=null):i(N)?D=null:O(M,R):O(M,R))),P=D):(o||O(b,R),P=parseInt(d,g[z]),(le=P)>=55296&&le<=57343||le>1114111?(O(T,R),P="�"):P in a?(O(S,R),P=a[P]):(A="",C(P)&&O(S,R),P>65535&&(A+=s((P-=65536)>>>10|55296),P=56320|1023&P),P=A+s(P))):z!==p&&O(x,R)),P?(ue(),L=oe(),J=W-1,te+=W-j+1,ae.push(P),(U=oe()).offset++,H&&H.call(K,P,{start:L,end:U},e.slice(j-1,W)),L=U):(d=e.slice(j-1,W),re+=d,te+=d.length,J=W-1)}var le;return ae.join("");function oe(){return{line:ne,column:te,offset:J+(G.offset||0)}}function ie(t){return e.charAt(t)}function ue(){re&&(ae.push(re),$&&$.call(q,re,{start:L,end:oe()}),re="")}}(e,o)};var c={}.hasOwnProperty,s=String.fromCharCode,f=Function.prototype,d={warning:null,reference:null,text:null,warningContext:null,referenceContext:null,textContext:null,position:{},additional:null,attribute:!1,nonTerminated:!0},p="named",m="hexadecimal",h="decimal",g={};g[m]=16,g[h]=10;var y={};y[p]=i,y[h]=l,y[m]=o;var v=1,b=2,k=3,x=4,w=5,S=6,T=7,E={};function C(e){return e>=1&&e<=8||11===e||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||65535==(65535&e)||65534==(65535&e)}E[v]="Named character references must be terminated by a semicolon",E[b]="Numeric character references must be terminated by a semicolon",E[k]="Named character references cannot be empty",E[x]="Numeric character references cannot be empty",E[w]="Named character references must be known",E[S]="Numeric character references cannot be disallowed",E[T]="Numeric character references cannot be outside the permissible Unicode range"},function(e){e.exports={AElig:"Æ",AMP:"&",Aacute:"Á",Acirc:"Â",Agrave:"À",Aring:"Å",Atilde:"Ã",Auml:"Ä",COPY:"©",Ccedil:"Ç",ETH:"Ð",Eacute:"É",Ecirc:"Ê",Egrave:"È",Euml:"Ë",GT:">",Iacute:"Í",Icirc:"Î",Igrave:"Ì",Iuml:"Ï",LT:"<",Ntilde:"Ñ",Oacute:"Ó",Ocirc:"Ô",Ograve:"Ò",Oslash:"Ø",Otilde:"Õ",Ouml:"Ö",QUOT:'"',REG:"®",THORN:"Þ",Uacute:"Ú",Ucirc:"Û",Ugrave:"Ù",Uuml:"Ü",Yacute:"Ý",aacute:"á",acirc:"â",acute:"´",aelig:"æ",agrave:"à",amp:"&",aring:"å",atilde:"ã",auml:"ä",brvbar:"¦",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",curren:"¤",deg:"°",divide:"÷",eacute:"é",ecirc:"ê",egrave:"è",eth:"ð",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",iacute:"í",icirc:"î",iexcl:"¡",igrave:"ì",iquest:"¿",iuml:"ï",laquo:"«",lt:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",ntilde:"ñ",oacute:"ó",ocirc:"ô",ograve:"ò",ordf:"ª",ordm:"º",oslash:"ø",otilde:"õ",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',raquo:"»",reg:"®",sect:"§",shy:"",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",thorn:"þ",times:"×",uacute:"ú",ucirc:"û",ugrave:"ù",uml:"¨",uuml:"ü",yacute:"ý",yen:"¥",yuml:"ÿ"}},function(e){e.exports={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"}},function(e,t,n){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}},function(e,t,n){"use strict";var r=n(44),a=n(14);e.exports=function(e){return r(e)||a(e)}},function(e,t,n){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}},function(e,t,n){"use strict";var r;e.exports=function(e){var t,n="&"+e+";";if((r=r||document.createElement("i")).innerHTML=n,";"===(t=r.textContent).slice(-1)&&"semi"!==e)return!1;return t!==n&&t}},function(e,t,n){(function(t){var n="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},r=function(){var e=/\blang(?:uage)?-([\w-]+)\b/i,t=0,r=n.Prism={manual:n.Prism&&n.Prism.manual,disableWorkerMessageHandler:n.Prism&&n.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof a?new a(e.type,r.util.encode(e.content),e.alias):"Array"===r.util.type(e)?e.map(r.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function(e,t){var n=r.util.type(e);switch(t=t||{},n){case"Object":if(t[r.util.objId(e)])return t[r.util.objId(e)];var a={};for(var l in t[r.util.objId(e)]=a,e)e.hasOwnProperty(l)&&(a[l]=r.util.clone(e[l],t));return a;case"Array":if(t[r.util.objId(e)])return t[r.util.objId(e)];a=[];return t[r.util.objId(e)]=a,e.forEach(function(e,n){a[n]=r.util.clone(e,t)}),a}return e}},languages:{extend:function(e,t){var n=r.util.clone(r.languages[e]);for(var a in t)n[a]=t[a];return n},insertBefore:function(e,t,n,a){var l=(a=a||r.languages)[e];if(2==arguments.length){for(var o in n=arguments[1])n.hasOwnProperty(o)&&(l[o]=n[o]);return l}var i={};for(var u in l)if(l.hasOwnProperty(u)){if(u==t)for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);i[u]=l[u]}return r.languages.DFS(r.languages,function(t,n){n===a[e]&&t!=e&&(this[t]=i)}),a[e]=i},DFS:function(e,t,n,a){for(var l in a=a||{},e)e.hasOwnProperty(l)&&(t.call(e,l,e[l],n||l),"Object"!==r.util.type(e[l])||a[r.util.objId(e[l])]?"Array"!==r.util.type(e[l])||a[r.util.objId(e[l])]||(a[r.util.objId(e[l])]=!0,r.languages.DFS(e[l],t,l,a)):(a[r.util.objId(e[l])]=!0,r.languages.DFS(e[l],t,null,a)))}},plugins:{},highlightAll:function(e,t){r.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var a={callback:n,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};r.hooks.run("before-highlightall",a);for(var l,o=a.elements||e.querySelectorAll(a.selector),i=0;l=o[i++];)r.highlightElement(l,!0===t,a.callback)},highlightElement:function(t,a,l){for(var o,i,u=t;u&&!e.test(u.className);)u=u.parentNode;u&&(o=(u.className.match(e)||[,""])[1].toLowerCase(),i=r.languages[o]),t.className=t.className.replace(e,"").replace(/\s+/g," ")+" language-"+o,t.parentNode&&(u=t.parentNode,/pre/i.test(u.nodeName)&&(u.className=u.className.replace(e,"").replace(/\s+/g," ")+" language-"+o));var c={element:t,language:o,grammar:i,code:t.textContent};if(r.hooks.run("before-sanity-check",c),!c.code||!c.grammar)return c.code&&(r.hooks.run("before-highlight",c),c.element.textContent=c.code,r.hooks.run("after-highlight",c)),void r.hooks.run("complete",c);if(r.hooks.run("before-highlight",c),a&&n.Worker){var s=new Worker(r.filename);s.onmessage=function(e){c.highlightedCode=e.data,r.hooks.run("before-insert",c),c.element.innerHTML=c.highlightedCode,l&&l.call(c.element),r.hooks.run("after-highlight",c),r.hooks.run("complete",c)},s.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else c.highlightedCode=r.highlight(c.code,c.grammar,c.language),r.hooks.run("before-insert",c),c.element.innerHTML=c.highlightedCode,l&&l.call(t),r.hooks.run("after-highlight",c),r.hooks.run("complete",c)},highlight:function(e,t,n){var l={code:e,grammar:t,language:n};return r.hooks.run("before-tokenize",l),l.tokens=r.tokenize(l.code,l.grammar),r.hooks.run("after-tokenize",l),a.stringify(r.util.encode(l.tokens),l.language)},matchGrammar:function(e,t,n,a,l,o,i){var u=r.Token;for(var c in n)if(n.hasOwnProperty(c)&&n[c]){if(c==i)return;var s=n[c];s="Array"===r.util.type(s)?s:[s];for(var f=0;f<s.length;++f){var d=s[f],p=d.inside,m=!!d.lookbehind,h=!!d.greedy,g=0,y=d.alias;if(h&&!d.pattern.global){var v=d.pattern.toString().match(/[imuy]*$/)[0];d.pattern=RegExp(d.pattern.source,v+"g")}d=d.pattern||d;for(var b=a,k=l;b<t.length;k+=t[b].length,++b){var x=t[b];if(t.length>e.length)return;if(!(x instanceof u)){if(h&&b!=t.length-1){if(d.lastIndex=k,!(_=d.exec(e)))break;for(var w=_.index+(m?_[1].length:0),S=_.index+_[0].length,T=b,E=k,C=t.length;T<C&&(E<S||!t[T].type&&!t[T-1].greedy);++T)w>=(E+=t[T].length)&&(++b,k=E);if(t[b]instanceof u)continue;P=T-b,x=e.slice(k,E),_.index-=k}else{d.lastIndex=0;var _=d.exec(x),P=1}if(_){m&&(g=_[1]?_[1].length:0);S=(w=_.index+g)+(_=_[0].slice(g)).length;var N=x.slice(0,w),O=x.slice(S),M=[b,P];N&&(++b,k+=N.length,M.push(N));var A=new u(c,p?r.tokenize(_,p):_,y,_,h);if(M.push(A),O&&M.push(O),Array.prototype.splice.apply(t,M),1!=P&&r.matchGrammar(e,t,n,b,k,!0,c),o)break}else if(o)break}}}}},tokenize:function(e,t,n){var a=[e],l=t.rest;if(l){for(var o in l)t[o]=l[o];delete t.rest}return r.matchGrammar(e,a,t,0,0,!1),a},hooks:{all:{},add:function(e,t){var n=r.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=r.hooks.all[e];if(n&&n.length)for(var a,l=0;a=n[l++];)a(t)}}},a=r.Token=function(e,t,n,r,a){this.type=e,this.content=t,this.alias=n,this.length=0|(r||"").length,this.greedy=!!a};if(a.stringify=function(e,t,n){if("string"==typeof e)return e;if("Array"===r.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var l={type:e.type,content:a.stringify(e.content,t,n),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:n};if(e.alias){var o="Array"===r.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,o)}r.hooks.run("wrap",l);var i=Object.keys(l.attributes).map(function(e){return e+'="'+(l.attributes[e]||"").replace(/"/g,""")+'"'}).join(" ");return"<"+l.tag+' class="'+l.classes.join(" ")+'"'+(i?" "+i:"")+">"+l.content+"</"+l.tag+">"},!n.document)return n.addEventListener?(r.disableWorkerMessageHandler||n.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,l=t.code,o=t.immediateClose;n.postMessage(r.highlight(l,r.languages[a],a)),o&&n.close()},!1),n.Prism):n.Prism;var l=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return l&&(r.filename=l.src,r.manual||l.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(r.highlightAll):window.setTimeout(r.highlightAll,16):document.addEventListener("DOMContentLoaded",r.highlightAll))),n.Prism}();e.exports&&(e.exports=r),void 0!==t&&(t.Prism=r)}).call(this,n(3))},function(e,t,n){"use strict";function r(e){e.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:/<!DOCTYPE[\s\S]+?>/i,cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/(^|[^\\])["']/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.value.replace(/&/,"&"))}),e.languages.xml=e.languages.markup,e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup}e.exports=r,r.displayName="markup",r.aliases=["xml","html","mathml","svg"]},function(e,t,n){"use strict";function r(e){e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^{}\s][^{};]*?(?=\s*\{)/,string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/\B!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},e.languages.css.atrule.inside.rest=e.languages.css,e.languages.markup&&(e.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,lookbehind:!0,inside:e.languages.css,alias:"language-css",greedy:!0}}),e.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:e.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:e.languages.css}},alias:"language-css"}},e.languages.markup.tag))}e.exports=r,r.displayName="css",r.aliases=[]},function(e,t,n){"use strict";function r(e){e.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/[a-z0-9_]+(?=\()/i,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}}e.exports=r,r.displayName="clike",r.aliases=[]},function(e,t,n){"use strict";function r(e){e.languages.javascript=e.languages.extend("clike",{keyword:/\b(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,function:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\()/i,operator:/-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),e.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[[^\]\r\n]+]|\\.|[^\/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=\s*(?:function\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,alias:"function"},constant:/\b[A-Z][A-Z\d_]*\b/}),e.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\${[^}]+}/,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}}}),e.languages.javascript["template-string"].inside.interpolation.inside.rest=e.languages.javascript,e.languages.markup&&e.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,lookbehind:!0,inside:e.languages.javascript,alias:"language-javascript",greedy:!0}}),e.languages.js=e.languages.javascript}e.exports=r,r.displayName="javascript",r.aliases=["js"]},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),l=n(15),o=n.n(l),i=n(16),u=n.n(i),c=n(17),s=n.n(c),f=n(2),d=n.n(f);function p(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return e.reduce(function(e,t){return d()({},e,n[t])},t)}function m(e){var t,n=e.node,r=e.stylesheet,l=e.style,o=void 0===l?{}:l,i=e.useInlineStyles,u=e.key,c=n.properties,f=n.type,h=n.tagName,g=n.value;if("text"===f)return g;if(h){var y=function(e,t){var n=0;return function(r){return n+=1,r.map(function(r,a){return m({node:r,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(n,"-").concat(a)})})}}(r,i),v=i&&c.className&&c.className.filter(function(e){return!r[e]}),b=v&&v.length?v:void 0,k=i?d()({},c,{className:b},{style:p(c.className,Object.assign({},c.style,o),r)}):d()({},c,{className:(t=c.className,t.join(" "))}),x=y(n.children);return a.a.createElement(h,s()({key:u},k),x)}}var h=/\n/g;function g(e){var t=e.codeString,n=e.codeStyle,r=e.containerStyle,l=void 0===r?{float:"left",paddingRight:"10px"}:r,o=e.numberStyle,i=void 0===o?{}:o,u=e.startingLineNumber;return a.a.createElement("code",{style:Object.assign({},n,l)},function(e){var t=e.lines,n=e.startingLineNumber,r=e.style;return t.map(function(e,t){var l=t+n;return a.a.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof r?r(l):r},"".concat(l,"\n"))})}({lines:t.replace(/\n$/,"").split("\n"),style:i,startingLineNumber:u}))}function y(e){var t=e.children,n=e.lineNumber,r=e.lineProps,a=e.className,l=void 0===a?[]:a,o=("function"==typeof r?r(n):r)||{};return o.className=o.className?l.concat(o.className):l,{type:"element",tagName:"span",properties:o,children:t}}function v(e,t){for(var n=function e(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],a=0;a<t.length;a++){var l=t[a];if("text"===l.type)r.push(y({children:[l],className:n}));else if(l.children){var o=n.concat(l.properties.className);r=r.concat(e(l.children,o))}}return r}(e.value),r=[],a=-1,l=0,o=function(){var e=n[l],o=e.children[0].value;if(o.match(h)){var i=o.split("\n");i.forEach(function(o,u){var c=r.length+1,s={type:"text",value:"".concat(o,"\n")};if(0===u){var f=n.slice(a+1,l).concat(y({children:[s],className:e.properties.className}));r.push(y({children:f,lineNumber:c,lineProps:t}))}else if(u===i.length-1){if(n[l+1]&&n[l+1].children&&n[l+1].children[0]){var d=y({children:[{type:"text",value:"".concat(o)}],className:e.properties.className});n.splice(l+1,0,d)}else r.push(y({children:[s],lineNumber:c,lineProps:t,className:e.properties.className}))}else r.push(y({children:[s],lineNumber:c,lineProps:t,className:e.properties.className}))}),a=l}l++};l<n.length;)o();if(a!==n.length-1){var i=n.slice(a+1,n.length);i&&i.length&&r.push(y({children:i,lineNumber:r.length+1,lineProps:t}))}return r}function b(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map(function(e,t){return m({node:e,stylesheet:n,useInlineStyles:r,key:"code-segement".concat(t)})})}var k,x,w=n(7),S=n.n(w),T=(k=S.a,x={},function(e){var t=e.language,n=e.children,r=e.style,l=void 0===r?x:r,o=e.customStyle,i=void 0===o?{}:o,c=e.codeTagProps,s=void 0===c?{style:l['code[class*="language-"]']}:c,f=e.useInlineStyles,d=void 0===f||f,p=e.showLineNumbers,m=void 0!==p&&p,h=e.startingLineNumber,y=void 0===h?1:h,w=e.lineNumberContainerStyle,S=e.lineNumberStyle,T=e.wrapLines,E=e.lineProps,C=void 0===E?{}:E,_=e.renderer,P=e.PreTag,N=void 0===P?"pre":P,O=e.CodeTag,M=void 0===O?"code":O,A=e.code,D=void 0===A?Array.isArray(n)?n[0]:n:A,I=e.astGenerator,j=u()(e,["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"]);I=I||k;var z=m?a.a.createElement(g,{containerStyle:w,codeStyle:s.style||{},numberStyle:S,startingLineNumber:y,codeString:D}):null,F=l.hljs||l['pre[class*="language-"]']||{backgroundColor:"#fff"},L=d?Object.assign({},j,{style:Object.assign({},F,i)}):Object.assign({},j,{className:"hljs"});if(!I)return a.a.createElement(N,L,z,a.a.createElement(M,s,D));T=!(!_||void 0!==T)||T,_=_||b;var U=[{type:"text",value:D}],R=function(e){var t=e.astGenerator,n=e.language,r=e.code,a=e.defaultCodeValue;if(t.getLanguage){var l=n&&t.getLanguage(n);return"text"===n?{value:a,language:"text"}:l?t.highlight(n,r):t.highlightAuto(r)}try{return n&&"text"!==n?{value:t.highlight(r,n)}:{value:a}}catch(e){return{value:a}}}({astGenerator:I,language:t,code:D,defaultCodeValue:U});null===R.language&&(R.value=U);var W=T?v(R,C):R.value;return a.a.createElement(N,L,z,a.a.createElement(M,s,_({rows:W,stylesheet:l,useInlineStyles:d})))});T.registerLanguage=function(e,t){return S.a.register(t)};var E=T,C=n(18),_=n.n(C).a,P={'code[class*="language-"]':{color:"black",background:"none",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none"},'pre[class*="language-"]':{color:"black",background:"#f5f2f0",textShadow:"0 1px white",fontFamily:"Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",wordWrap:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",margin:".5em 0",overflow:"auto"},'pre[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::-moz-selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'pre[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"]::selection':{textShadow:"none",background:"#b3d4fc"},'code[class*="language-"] ::selection':{textShadow:"none",background:"#b3d4fc"},':not(pre) > code[class*="language-"]':{background:"#f5f2f0",padding:".1em",borderRadius:".3em",whiteSpace:"normal"},comment:{color:"slategray"},prolog:{color:"slategray"},doctype:{color:"slategray"},cdata:{color:"slategray"},punctuation:{color:"#999"},".namespace":{Opacity:".7"},property:{color:"#905"},tag:{color:"#905"},boolean:{color:"#905"},number:{color:"#905"},constant:{color:"#905"},symbol:{color:"#905"},deleted:{color:"#905"},selector:{color:"#690"},"attr-name":{color:"#690"},string:{color:"#690"},char:{color:"#690"},builtin:{color:"#690"},inserted:{color:"#690"},operator:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},entity:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)",cursor:"help"},url:{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".language-css .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},".style .token.string":{color:"#9a6e3a",background:"hsla(0, 0%, 100%, .5)"},atrule:{color:"#07a"},"attr-value":{color:"#07a"},keyword:{color:"#07a"},function:{color:"#DD4A68"},"class-name":{color:"#DD4A68"},regex:{color:"#e90"},important:{color:"#e90",fontWeight:"bold"},variable:{color:"#e90"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},N=n(6);function O(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,l=void 0;try{for(var o,i=e[Symbol.iterator]();!(r=(o=i.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,l=e}finally{try{r||null==i.return||i.return()}finally{if(a)throw l}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function A(){return(A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}E.registerLanguage("jsx",_);var D=function(e){var t=e.children,n=e.handleClick,r=Object(N.useMouseUp)(n);return a.a.createElement("li",null,a.a.createElement("button",A({type:"button"},r),t))},I=function(e){var t=e.children,n=O(e,["children"]);return a.a.createElement("li",null,a.a.createElement("button",A({type:"button"},n),t))};o.a.render(a.a.createElement(a.a.Fragment,null,a.a.createElement("main",null,a.a.createElement("section",null,a.a.createElement("h1",null,"Classic drop-down"),a.a.createElement(function(){var e=M(Object(r.useState)(!1),2),t=e[0],n=e[1];return a.a.createElement("div",{className:"dropdown"},a.a.createElement("button",{type:"button",onClick:function(){return n(function(e){return!e})}},"Open drop-down"),a.a.createElement("ul",{style:{display:t?"block":"none"}},a.a.createElement(I,{onClick:function(){return n(!1)}},"Action #1"),a.a.createElement(I,{onClick:function(){return n(!1)}},"Action #2"),a.a.createElement(I,{onClick:function(){return n(!1)}},"Action #3")))},null),a.a.createElement("h2",null,"Source Code"),a.a.createElement(E,{language:"jsx",style:P},'const DropDownItem = ({ children, ...rest }) => (\n <li>\n <button type="button" {...rest}>\n {children}\n </button>\n </li>\n);\n\nconst DropDown = () => {\n const [open, setOpen] = useState(false);\n\n return (\n <div className="dropdown">\n <button type="button" onClick={() => setOpen(state => !state)}>\n Open drop-down\n </button>\n <ul style={{ display: open ? \'block\' : \'none\' }}>\n <DropDownItem onClick={() => setOpen(false)}>Action #1</DropDownItem>\n <DropDownItem onClick={() => setOpen(false)}>Action #2</DropDownItem>\n <DropDownItem onClick={() => setOpen(false)}>Action #3</DropDownItem>\n </ul>\n </div>\n );\n};')),a.a.createElement("section",null,a.a.createElement("h1",null,"Faster usable drop-down"),a.a.createElement("p",null,"On desktop, you can simply keep mouse button down, drag down and release the button on the wanted item."),a.a.createElement(function(){var e=M(Object(r.useState)(!1),2),t=e[0],n=e[1],l=Object(N.useMouseDown)(function(){return n(function(e){return!e})});return a.a.createElement(a.a.Fragment,null,a.a.createElement("div",{className:"dropdown"},a.a.createElement("button",A({type:"button"},l),"Open drop-down"),a.a.createElement("ul",{style:{display:t?"block":"none"}},a.a.createElement(D,{handleClick:function(){return n(!1)}},"Action #1"),a.a.createElement(D,{handleClick:function(){return n(!1)}},"Action #2"),a.a.createElement(D,{handleClick:function(){return n(!1)}},"Action #3"))))},null),a.a.createElement("h2",null,"Source Code"),a.a.createElement(E,{language:"jsx",style:P},'const DropDownItem = ({ children, handleClick }) => {\n const props = useMouseUp(handleClick);\n\n return (\n <li>\n <button type="button" {...props}>\n {children}\n </button>\n </li>\n );\n};\n\nconst DropDown = () => {\n const [open, setOpen] = useState(false);\n\n const props = useMouseDown(() => setOpen(state => !state));\n\n return (\n <div className="dropdown">\n <button type="button" {...props}>\n Open drop-down\n </button>\n <ul style={{ display: open ? \'block\' : \'none\' }}>\n <DropDownItem handleClick={() => setOpen(false)}>Action #1</DropDownItem>\n <DropDownItem handleClick={() => setOpen(false)}>Action #2</DropDownItem>\n <DropDownItem handleClick={() => setOpen(false)}>Action #3</DropDownItem>\n </ul>\n </div>\n );\n};')))),document.getElementById("app"))}]); \ No newline at end of file diff --git a/example/src/index.jsx b/example/src/index.jsx index 3438b15..77dc031 100644 --- a/example/src/index.jsx +++ b/example/src/index.jsx @@ -29,16 +29,18 @@ const DropDown = () => { const props = useMouseDown(() => setOpen(state => !state)); return ( - <div className="dropdown"> - <button type="button" {...props}> - Open drop-down - </button> - <ul style={{ display: open ? 'block' : 'none' }}> - <DropDownItem handleClick={() => setOpen(false)}>Action #1</DropDownItem> - <DropDownItem handleClick={() => setOpen(false)}>Action #2</DropDownItem> - <DropDownItem handleClick={() => setOpen(false)}>Action #3</DropDownItem> - </ul> - </div> + <> + <div className="dropdown"> + <button type="button" {...props}> + Open drop-down + </button> + <ul style={{ display: open ? 'block' : 'none' }}> + <DropDownItem handleClick={() => setOpen(false)}>Action #1</DropDownItem> + <DropDownItem handleClick={() => setOpen(false)}>Action #2</DropDownItem> + <DropDownItem handleClick={() => setOpen(false)}>Action #3</DropDownItem> + </ul> + </div> + </> ); }; diff --git a/example/style.css b/example/style.css index 9fa0b65..9425122 100644 --- a/example/style.css +++ b/example/style.css @@ -90,6 +90,7 @@ pre { text-align: left; border: none; cursor: pointer; + background-color: white; transition: 0.12s; } .dropdown ul li button:hover { diff --git a/package.json b/package.json index 1d1e931..50a066e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "use-mouse-action", - "version": "1.0.1", + "version": "1.1.0", "description": "React Hooks to listen to both mouse down or up and click events with a once called function.", "author": "Dimitri NICOLAS <dimitri@ooeo.fr>", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index 481dc83..b69292e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react'; import { HooksInput } from './types/options'; import { IProps } from './types/props'; -const DEFAULT_OPTIONS = { down: false, up: false, touch: true }; +const DEFAULT_OPTIONS = { down: false, up: false, touch: true, timeout: 10 }; /** * Test if a mouse event can trigger a click. @@ -26,6 +26,7 @@ export const useMouseAction = (options: HooksInput): IProps => { down, up, touch, + timeout, onClick, onMouseDown, onMouseUp, @@ -52,7 +53,7 @@ export const useMouseAction = (options: HooksInput): IProps => { * */ const onMouseDownEnd = () => { - setTimeout(() => setMouseDown(false), 10); + setTimeout(() => setMouseDown(false), timeout); }; /** @@ -71,7 +72,7 @@ export const useMouseAction = (options: HooksInput): IProps => { */ const onMouseUpTriggered = () => { setMouseUpTriggered(true); - setTimeout(() => setMouseUpTriggered(false), 10); + setTimeout(() => setMouseUpTriggered(false), timeout); }; /** @@ -199,7 +200,7 @@ export const useMouseAction = (options: HooksInput): IProps => { * prevent next coming click event to be catched * by a newly rendered element above the button. */ - setTimeout(() => onAction(event), 10); + setTimeout(() => onAction(event), timeout); } }; @@ -220,7 +221,7 @@ export const useMouseAction = (options: HooksInput): IProps => { * to be catched by a newly rendered element * above the button. */ - setTimeout(() => onAction(event), 10); + setTimeout(() => onAction(event), timeout); } }; diff --git a/src/types/options.ts b/src/types/options.ts index ac4c752..e6a7a06 100644 --- a/src/types/options.ts +++ b/src/types/options.ts @@ -32,6 +32,12 @@ interface IOptions { */ touch?: boolean; + /** + * Short time to prevent multiple events. + * @default 10 + */ + timeout?: number; + /** * Native click event handler passed into returned props. */