native-forms-react
Version:
Build forms, surveys and polls for React.
26 lines (25 loc) • 32.9 kB
JavaScript
"use strict";var e,t=require("./index-8e695942.js"),n=require("react"),r=(e=n)&&"object"==typeof e&&"default"in e?e.default:e,o=require("./_react_commonjs-external-dd9e1409.js");var i=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o},a=t.createCommonjsModule((function(e){function t(){return e.exports=t=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},t.apply(this,arguments)}e.exports=t}));var s=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t};var p=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var f=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},u="undefined"!=typeof window&&"undefined"!=typeof document&&"undefined"!=typeof navigator,c=function(){for(var e=["Edge","Trident","Firefox"],t=0;t<e.length;t+=1)if(u&&navigator.userAgent.indexOf(e[t])>=0)return 1;return 0}();
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.1
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/var l=u&&window.Promise?function(e){var t=!1;return function(){t||(t=!0,window.Promise.resolve().then((function(){t=!1,e()})))}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout((function(){t=!1,e()}),c))}};function d(e){return e&&"[object Function]"==={}.toString.call(e)}function h(e,t){if(1!==e.nodeType)return[];var n=e.ownerDocument.defaultView.getComputedStyle(e,null);return t?n[t]:n}function m(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function v(e){if(!e)return document.body;switch(e.nodeName){case"HTML":case"BODY":return e.ownerDocument.body;case"#document":return e.body}var t=h(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/(auto|scroll|overlay)/.test(n+o+r)?e:v(m(e))}function g(e){return e&&e.referenceNode?e.referenceNode:e}var b=u&&!(!window.MSInputMethodContext||!document.documentMode),y=u&&/MSIE 10/.test(navigator.userAgent);function w(e){return 11===e?b:10===e?y:b||y}function E(e){if(!e)return document.documentElement;for(var t=w(10)?document.body:null,n=e.offsetParent||null;n===t&&e.nextElementSibling;)n=(e=e.nextElementSibling).offsetParent;var r=n&&n.nodeName;return r&&"BODY"!==r&&"HTML"!==r?-1!==["TH","TD","TABLE"].indexOf(n.nodeName)&&"static"===h(n,"position")?E(n):n:e?e.ownerDocument.documentElement:document.documentElement}function x(e){return null!==e.parentNode?x(e.parentNode):e}function O(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,r=n?e:t,o=n?t:e,i=document.createRange();i.setStart(r,0),i.setEnd(o,0);var a,s,p=i.commonAncestorContainer;if(e!==p&&t!==p||r.contains(o))return"BODY"===(s=(a=p).nodeName)||"HTML"!==s&&E(a.firstElementChild)!==a?E(p):p;var f=x(e);return f.host?O(f.host,t):O(e,x(t).host)}function N(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",n="top"===t?"scrollTop":"scrollLeft",r=e.nodeName;if("BODY"===r||"HTML"===r){var o=e.ownerDocument.documentElement,i=e.ownerDocument.scrollingElement||o;return i[n]}return e[n]}function M(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=N(t,"top"),o=N(t,"left"),i=n?-1:1;return e.top+=r*i,e.bottom+=r*i,e.left+=o*i,e.right+=o*i,e}function P(e,t){var n="x"===t?"Left":"Top",r="Left"===n?"Right":"Bottom";return parseFloat(e["border"+n+"Width"])+parseFloat(e["border"+r+"Width"])}function L(e,t,n,r){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],w(10)?parseInt(n["offset"+e])+parseInt(r["margin"+("Height"===e?"Top":"Left")])+parseInt(r["margin"+("Height"===e?"Bottom":"Right")]):0)}function T(e){var t=e.body,n=e.documentElement,r=w(10)&&getComputedStyle(n);return{height:L("Height",t,n,r),width:L("Width",t,n,r)}}var C=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},A=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),D=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},F=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};function S(e){return F({},e,{right:e.left+e.width,bottom:e.top+e.height})}function _(e){var t={};try{if(w(10)){t=e.getBoundingClientRect();var n=N(e,"top"),r=N(e,"left");t.top+=n,t.left+=r,t.bottom+=n,t.right+=r}else t=e.getBoundingClientRect()}catch(e){}var o={left:t.left,top:t.top,width:t.right-t.left,height:t.bottom-t.top},i="HTML"===e.nodeName?T(e.ownerDocument):{},a=i.width||e.clientWidth||o.width,s=i.height||e.clientHeight||o.height,p=e.offsetWidth-a,f=e.offsetHeight-s;if(p||f){var u=h(e);p-=P(u,"x"),f-=P(u,"y"),o.width-=p,o.height-=f}return S(o)}function j(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=w(10),o="HTML"===t.nodeName,i=_(e),a=_(t),s=v(e),p=h(t),f=parseFloat(p.borderTopWidth),u=parseFloat(p.borderLeftWidth);n&&o&&(a.top=Math.max(a.top,0),a.left=Math.max(a.left,0));var c=S({top:i.top-a.top-f,left:i.left-a.left-u,width:i.width,height:i.height});if(c.marginTop=0,c.marginLeft=0,!r&&o){var l=parseFloat(p.marginTop),d=parseFloat(p.marginLeft);c.top-=f-l,c.bottom-=f-l,c.left-=u-d,c.right-=u-d,c.marginTop=l,c.marginLeft=d}return(r&&!n?t.contains(s):t===s&&"BODY"!==s.nodeName)&&(c=M(c,t)),c}function R(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.ownerDocument.documentElement,r=j(e,n),o=Math.max(n.clientWidth,window.innerWidth||0),i=Math.max(n.clientHeight,window.innerHeight||0),a=t?0:N(n),s=t?0:N(n,"left"),p={top:a-r.top+r.marginTop,left:s-r.left+r.marginLeft,width:o,height:i};return S(p)}function B(e){var t=e.nodeName;if("BODY"===t||"HTML"===t)return!1;if("fixed"===h(e,"position"))return!0;var n=m(e);return!!n&&B(n)}function I(e){if(!e||!e.parentElement||w())return document.documentElement;for(var t=e.parentElement;t&&"none"===h(t,"transform");)t=t.parentElement;return t||document.documentElement}function W(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i={top:0,left:0},a=o?I(e):O(e,g(t));if("viewport"===r)i=R(a,o);else{var s=void 0;"scrollParent"===r?"BODY"===(s=v(m(t))).nodeName&&(s=e.ownerDocument.documentElement):s="window"===r?e.ownerDocument.documentElement:r;var p=j(s,a,o);if("HTML"!==s.nodeName||B(a))i=p;else{var f=T(e.ownerDocument),u=f.height,c=f.width;i.top+=p.top-p.marginTop,i.bottom=u+p.top,i.left+=p.left-p.marginLeft,i.right=c+p.left}}var l="number"==typeof(n=n||0);return i.left+=l?n:n.left||0,i.top+=l?n:n.top||0,i.right-=l?n:n.right||0,i.bottom-=l?n:n.bottom||0,i}function k(e){return e.width*e.height}function H(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf("auto"))return e;var a=W(n,r,i,o),s={top:{width:a.width,height:t.top-a.top},right:{width:a.right-t.right,height:a.height},bottom:{width:a.width,height:a.bottom-t.bottom},left:{width:t.left-a.left,height:a.height}},p=Object.keys(s).map((function(e){return F({key:e},s[e],{area:k(s[e])})})).sort((function(e,t){return t.area-e.area})),f=p.filter((function(e){var t=e.width,r=e.height;return t>=n.clientWidth&&r>=n.clientHeight})),u=f.length>0?f[0].key:p[0].key,c=e.split("-")[1];return u+(c?"-"+c:"")}function U(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=r?I(t):O(t,g(n));return j(n,o,r)}function V(e){var t=e.ownerDocument.defaultView.getComputedStyle(e),n=parseFloat(t.marginTop||0)+parseFloat(t.marginBottom||0),r=parseFloat(t.marginLeft||0)+parseFloat(t.marginRight||0);return{width:e.offsetWidth+r,height:e.offsetHeight+n}}function q(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,(function(e){return t[e]}))}function Y(e,t,n){n=n.split("-")[0];var r=V(e),o={width:r.width,height:r.height},i=-1!==["right","left"].indexOf(n),a=i?"top":"left",s=i?"left":"top",p=i?"height":"width",f=i?"width":"height";return o[a]=t[a]+t[p]/2-r[p]/2,o[s]=n===s?t[s]-r[f]:t[q(s)],o}function G(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function z(e,t,n){return(void 0===n?e:e.slice(0,function(e,t,n){if(Array.prototype.findIndex)return e.findIndex((function(e){return e[t]===n}));var r=G(e,(function(e){return e[t]===n}));return e.indexOf(r)}(e,"name",n))).forEach((function(e){e.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var n=e.function||e.fn;e.enabled&&d(n)&&(t.offsets.popper=S(t.offsets.popper),t.offsets.reference=S(t.offsets.reference),t=n(t,e))})),t}function X(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=U(this.state,this.popper,this.reference,this.options.positionFixed),e.placement=H(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.positionFixed=this.options.positionFixed,e.offsets.popper=Y(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position=this.options.positionFixed?"fixed":"absolute",e=z(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}function J(e,t){return e.some((function(e){var n=e.name;return e.enabled&&n===t}))}function K(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),r=0;r<t.length;r++){var o=t[r],i=o?""+o+n:e;if(void 0!==document.body.style[i])return i}return null}function Q(){return this.state.isDestroyed=!0,J(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.position="",this.popper.style.top="",this.popper.style.left="",this.popper.style.right="",this.popper.style.bottom="",this.popper.style.willChange="",this.popper.style[K("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}function Z(e){var t=e.ownerDocument;return t?t.defaultView:window}function $(e,t,n,r){n.updateBound=r,Z(e).addEventListener("resize",n.updateBound,{passive:!0});var o=v(e);return function e(t,n,r,o){var i="BODY"===t.nodeName,a=i?t.ownerDocument.defaultView:t;a.addEventListener(n,r,{passive:!0}),i||e(v(a.parentNode),n,r,o),o.push(a)}(o,"scroll",n.updateBound,n.scrollParents),n.scrollElement=o,n.eventsEnabled=!0,n}function ee(){this.state.eventsEnabled||(this.state=$(this.reference,this.options,this.state,this.scheduleUpdate))}function te(){var e,t;this.state.eventsEnabled&&(cancelAnimationFrame(this.scheduleUpdate),this.state=(e=this.reference,t=this.state,Z(e).removeEventListener("resize",t.updateBound),t.scrollParents.forEach((function(e){e.removeEventListener("scroll",t.updateBound)})),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t))}function ne(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function re(e,t){Object.keys(t).forEach((function(n){var r="";-1!==["width","height","top","right","bottom","left"].indexOf(n)&&ne(t[n])&&(r="px"),e.style[n]=t[n]+r}))}var oe=u&&/Firefox/i.test(navigator.userAgent);function ie(e,t,n){var r=G(e,(function(e){return e.name===t})),o=!!r&&e.some((function(e){return e.name===n&&e.enabled&&e.order<r.order}));if(!o){var i="`"+t+"`",a="`"+n+"`";console.warn(a+" modifier is required by "+i+" modifier in order to work, be sure to include it before "+i+"!")}return o}var ae=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],se=ae.slice(3);function pe(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=se.indexOf(e),r=se.slice(n+1).concat(se.slice(0,n));return t?r.reverse():r}var fe="flip",ue="clockwise",ce="counterclockwise";function le(e,t,n,r){var o=[0,0],i=-1!==["right","left"].indexOf(r),a=e.split(/(\+|\-)/).map((function(e){return e.trim()})),s=a.indexOf(G(a,(function(e){return-1!==e.search(/,|\s/)})));a[s]&&-1===a[s].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var p=/\s*,\s*|\s+/,f=-1!==s?[a.slice(0,s).concat([a[s].split(p)[0]]),[a[s].split(p)[1]].concat(a.slice(s+1))]:[a];return(f=f.map((function(e,r){var o=(1===r?!i:i)?"height":"width",a=!1;return e.reduce((function(e,t){return""===e[e.length-1]&&-1!==["+","-"].indexOf(t)?(e[e.length-1]=t,a=!0,e):a?(e[e.length-1]+=t,a=!1,e):e.concat(t)}),[]).map((function(e){return function(e,t,n,r){var o=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+o[1],a=o[2];if(!i)return e;if(0===a.indexOf("%")){var s=void 0;switch(a){case"%p":s=n;break;case"%":case"%r":default:s=r}return S(s)[t]/100*i}if("vh"===a||"vw"===a){return("vh"===a?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*i}return i}(e,o,t,n)}))}))).forEach((function(e,t){e.forEach((function(n,r){ne(n)&&(o[t]+=n*("-"===e[r-1]?-1:1))}))})),o}var de={placement:"bottom",positionFixed:!1,eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,n=t.split("-")[0],r=t.split("-")[1];if(r){var o=e.offsets,i=o.reference,a=o.popper,s=-1!==["bottom","top"].indexOf(n),p=s?"left":"top",f=s?"width":"height",u={start:D({},p,i[p]),end:D({},p,i[p]+i[f]-a[f])};e.offsets.popper=F({},a,u[r])}return e}},offset:{order:200,enabled:!0,fn:function(e,t){var n=t.offset,r=e.placement,o=e.offsets,i=o.popper,a=o.reference,s=r.split("-")[0],p=void 0;return p=ne(+n)?[+n,0]:le(n,i,a,s),"left"===s?(i.top+=p[0],i.left-=p[1]):"right"===s?(i.top+=p[0],i.left+=p[1]):"top"===s?(i.left+=p[0],i.top-=p[1]):"bottom"===s&&(i.left+=p[0],i.top+=p[1]),e.popper=i,e},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var n=t.boundariesElement||E(e.instance.popper);e.instance.reference===n&&(n=E(n));var r=K("transform"),o=e.instance.popper.style,i=o.top,a=o.left,s=o[r];o.top="",o.left="",o[r]="";var p=W(e.instance.popper,e.instance.reference,t.padding,n,e.positionFixed);o.top=i,o.left=a,o[r]=s,t.boundaries=p;var f=t.priority,u=e.offsets.popper,c={primary:function(e){var n=u[e];return u[e]<p[e]&&!t.escapeWithReference&&(n=Math.max(u[e],p[e])),D({},e,n)},secondary:function(e){var n="right"===e?"left":"top",r=u[n];return u[e]>p[e]&&!t.escapeWithReference&&(r=Math.min(u[n],p[e]-("right"===e?u.width:u.height))),D({},n,r)}};return f.forEach((function(e){var t=-1!==["left","top"].indexOf(e)?"primary":"secondary";u=F({},u,c[t](e))})),e.offsets.popper=u,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,n=t.popper,r=t.reference,o=e.placement.split("-")[0],i=Math.floor,a=-1!==["top","bottom"].indexOf(o),s=a?"right":"bottom",p=a?"left":"top",f=a?"width":"height";return n[s]<i(r[p])&&(e.offsets.popper[p]=i(r[p])-n[f]),n[p]>i(r[s])&&(e.offsets.popper[p]=i(r[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){var n;if(!ie(e.instance.modifiers,"arrow","keepTogether"))return e;var r=t.element;if("string"==typeof r){if(!(r=e.instance.popper.querySelector(r)))return e}else if(!e.instance.popper.contains(r))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),e;var o=e.placement.split("-")[0],i=e.offsets,a=i.popper,s=i.reference,p=-1!==["left","right"].indexOf(o),f=p?"height":"width",u=p?"Top":"Left",c=u.toLowerCase(),l=p?"left":"top",d=p?"bottom":"right",m=V(r)[f];s[d]-m<a[c]&&(e.offsets.popper[c]-=a[c]-(s[d]-m)),s[c]+m>a[d]&&(e.offsets.popper[c]+=s[c]+m-a[d]),e.offsets.popper=S(e.offsets.popper);var v=s[c]+s[f]/2-m/2,g=h(e.instance.popper),b=parseFloat(g["margin"+u]),y=parseFloat(g["border"+u+"Width"]),w=v-e.offsets.popper[c]-b-y;return w=Math.max(Math.min(a[f]-m,w),0),e.arrowElement=r,e.offsets.arrow=(D(n={},c,Math.round(w)),D(n,l,""),n),e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(e,t){if(J(e.instance.modifiers,"inner"))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var n=W(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement,e.positionFixed),r=e.placement.split("-")[0],o=q(r),i=e.placement.split("-")[1]||"",a=[];switch(t.behavior){case fe:a=[r,o];break;case ue:a=pe(r);break;case ce:a=pe(r,!0);break;default:a=t.behavior}return a.forEach((function(s,p){if(r!==s||a.length===p+1)return e;r=e.placement.split("-")[0],o=q(r);var f=e.offsets.popper,u=e.offsets.reference,c=Math.floor,l="left"===r&&c(f.right)>c(u.left)||"right"===r&&c(f.left)<c(u.right)||"top"===r&&c(f.bottom)>c(u.top)||"bottom"===r&&c(f.top)<c(u.bottom),d=c(f.left)<c(n.left),h=c(f.right)>c(n.right),m=c(f.top)<c(n.top),v=c(f.bottom)>c(n.bottom),g="left"===r&&d||"right"===r&&h||"top"===r&&m||"bottom"===r&&v,b=-1!==["top","bottom"].indexOf(r),y=!!t.flipVariations&&(b&&"start"===i&&d||b&&"end"===i&&h||!b&&"start"===i&&m||!b&&"end"===i&&v),w=!!t.flipVariationsByContent&&(b&&"start"===i&&h||b&&"end"===i&&d||!b&&"start"===i&&v||!b&&"end"===i&&m),E=y||w;(l||g||E)&&(e.flipped=!0,(l||g)&&(r=a[p+1]),E&&(i=function(e){return"end"===e?"start":"start"===e?"end":e}(i)),e.placement=r+(i?"-"+i:""),e.offsets.popper=F({},e.offsets.popper,Y(e.instance.popper,e.offsets.reference,e.placement)),e=z(e.instance.modifiers,e,"flip"))})),e},behavior:"flip",padding:5,boundariesElement:"viewport",flipVariations:!1,flipVariationsByContent:!1},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,n=t.split("-")[0],r=e.offsets,o=r.popper,i=r.reference,a=-1!==["left","right"].indexOf(n),s=-1===["top","left"].indexOf(n);return o[a?"left":"top"]=i[n]-(s?o[a?"width":"height"]:0),e.placement=q(t),e.offsets.popper=S(o),e}},hide:{order:800,enabled:!0,fn:function(e){if(!ie(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=G(e.instance.modifiers,(function(e){return"preventOverflow"===e.name})).boundaries;if(t.bottom<n.top||t.left>n.right||t.top>n.bottom||t.right<n.left){if(!0===e.hide)return e;e.hide=!0,e.attributes["x-out-of-boundaries"]=""}else{if(!1===e.hide)return e;e.hide=!1,e.attributes["x-out-of-boundaries"]=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var n=t.x,r=t.y,o=e.offsets.popper,i=G(e.instance.modifiers,(function(e){return"applyStyle"===e.name})).gpuAcceleration;void 0!==i&&console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");var a=void 0!==i?i:t.gpuAcceleration,s=E(e.instance.popper),p=_(s),f={position:o.position},u=function(e,t){var n=e.offsets,r=n.popper,o=n.reference,i=Math.round,a=Math.floor,s=function(e){return e},p=i(o.width),f=i(r.width),u=-1!==["left","right"].indexOf(e.placement),c=-1!==e.placement.indexOf("-"),l=t?u||c||p%2==f%2?i:a:s,d=t?i:s;return{left:l(p%2==1&&f%2==1&&!c&&t?r.left-1:r.left),top:d(r.top),bottom:d(r.bottom),right:l(r.right)}}(e,window.devicePixelRatio<2||!oe),c="bottom"===n?"top":"bottom",l="right"===r?"left":"right",d=K("transform"),h=void 0,m=void 0;if(m="bottom"===c?"HTML"===s.nodeName?-s.clientHeight+u.bottom:-p.height+u.bottom:u.top,h="right"===l?"HTML"===s.nodeName?-s.clientWidth+u.right:-p.width+u.right:u.left,a&&d)f[d]="translate3d("+h+"px, "+m+"px, 0)",f[c]=0,f[l]=0,f.willChange="transform";else{var v="bottom"===c?-1:1,g="right"===l?-1:1;f[c]=m*v,f[l]=h*g,f.willChange=c+", "+l}var b={"x-placement":e.placement};return e.attributes=F({},b,e.attributes),e.styles=F({},f,e.styles),e.arrowStyles=F({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(e){var t,n;return re(e.instance.popper,e.styles),t=e.instance.popper,n=e.attributes,Object.keys(n).forEach((function(e){!1!==n[e]?t.setAttribute(e,n[e]):t.removeAttribute(e)})),e.arrowElement&&Object.keys(e.arrowStyles).length&&re(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,n,r,o){var i=U(o,t,e,n.positionFixed),a=H(n.placement,i,t,e,n.modifiers.flip.boundariesElement,n.modifiers.flip.padding);return t.setAttribute("x-placement",a),re(t,{position:n.positionFixed?"fixed":"absolute"}),n},gpuAcceleration:void 0}}},he=function(){function e(t,n){var r=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};C(this,e),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=l(this.update.bind(this)),this.options=F({},e.Defaults,o),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=t&&t.jquery?t[0]:t,this.popper=n&&n.jquery?n[0]:n,this.options.modifiers={},Object.keys(F({},e.Defaults.modifiers,o.modifiers)).forEach((function(t){r.options.modifiers[t]=F({},e.Defaults.modifiers[t]||{},o.modifiers?o.modifiers[t]:{})})),this.modifiers=Object.keys(this.options.modifiers).map((function(e){return F({name:e},r.options.modifiers[e])})).sort((function(e,t){return e.order-t.order})),this.modifiers.forEach((function(e){e.enabled&&d(e.onLoad)&&e.onLoad(r.reference,r.popper,r.options,e,r.state)})),this.update();var i=this.options.eventsEnabled;i&&this.enableEventListeners(),this.state.eventsEnabled=i}return A(e,[{key:"update",value:function(){return X.call(this)}},{key:"destroy",value:function(){return Q.call(this)}},{key:"enableEventListeners",value:function(){return ee.call(this)}},{key:"disableEventListeners",value:function(){return te.call(this)}}]),e}();he.Utils=("undefined"!=typeof window?window:global).PopperUtils,he.placements=ae,he.Defaults=de;var me="__global_unique_id__",ve=function(){return t.commonjsGlobal[me]=(t.commonjsGlobal[me]||0)+1};function ge(e){return function(){return e}}var be=function(){};be.thatReturns=ge,be.thatReturnsFalse=ge(!1),be.thatReturnsTrue=ge(!0),be.thatReturnsNull=ge(null),be.thatReturnsThis=function(){return this},be.thatReturnsArgument=function(e){return e};var ye=be;if("production"!==process.env.NODE_ENV){var we=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,(function(){return n[o++]}));"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};ye=function(e,t){if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==t.indexOf("Failed Composite propType: ")&&!e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];we.apply(void 0,[t].concat(r))}}}var Ee=ye,xe=t.createCommonjsModule((function(e,t){t.__esModule=!0;s(r);var n=s(o._propTypes),i=s(ve),a=s(Ee);function s(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function c(e){var t=[];return{on:function(e){t.push(e)},off:function(e){t=t.filter((function(t){return t!==e}))},get:function(){return e},set:function(n,r){e=n,t.forEach((function(t){return t(e,r)}))}}}t.default=function(e,t){var o,s,l="__create-react-context-"+(0,i.default)()+"__",d=function(e){function n(){var t,r;p(this,n);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return t=r=f(this,e.call.apply(e,[this].concat(i))),r.emitter=c(r.props.value),f(r,t)}return u(n,e),n.prototype.getChildContext=function(){var e;return(e={})[l]=this.emitter,e},n.prototype.componentWillReceiveProps=function(e){if(this.props.value!==e.value){var n=this.props.value,r=e.value,o=void 0;((i=n)===(s=r)?0!==i||1/i==1/s:i!=i&&s!=s)?o=0:(o="function"==typeof t?t(n,r):1073741823,"production"!==process.env.NODE_ENV&&(0,a.default)((1073741823&o)===o,"calculateChangedBits: Expected the return value to be a 31-bit integer. Instead received: %s",o),0!==(o|=0)&&this.emitter.set(e.value,o))}var i,s},n.prototype.render=function(){return this.props.children},n}(r.Component);d.childContextTypes=((o={})[l]=n.default.object.isRequired,o);var h=function(t){function n(){var e,r;p(this,n);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return e=r=f(this,t.call.apply(t,[this].concat(i))),r.state={value:r.getValue()},r.onUpdate=function(e,t){0!=((0|r.observedBits)&t)&&r.setState({value:r.getValue()})},f(r,e)}return u(n,t),n.prototype.componentWillReceiveProps=function(e){var t=e.observedBits;this.observedBits=null==t?1073741823:t},n.prototype.componentDidMount=function(){this.context[l]&&this.context[l].on(this.onUpdate);var e=this.props.observedBits;this.observedBits=null==e?1073741823:e},n.prototype.componentWillUnmount=function(){this.context[l]&&this.context[l].off(this.onUpdate)},n.prototype.getValue=function(){return this.context[l]?this.context[l].get():e},n.prototype.render=function(){return(e=this.props.children,Array.isArray(e)?e[0]:e)(this.state.value);var e},n}(r.Component);return h.contextTypes=((s={})[l]=n.default.object,s),{Provider:d,Consumer:h}},e.exports=t.default}));t.unwrapExports(xe);var Oe=t.createCommonjsModule((function(e,t){t.__esModule=!0;var n=i(r),o=i(xe);function i(e){return e&&e.__esModule?e:{default:e}}t.default=n.default.createContext||o.default,e.exports=t.default})),Ne=t.unwrapExports(Oe)({setReferenceNode:void 0,referenceNode:void 0}),Me=function(e){function t(){var t;return t=e.call(this)||this,f(p(p(t)),"setReferenceNode",(function(e){e&&t.state.context.referenceNode!==e&&t.setState((function(t){var n=t.context;return{context:a({},n,{referenceNode:e})}}))})),t.state={context:{setReferenceNode:t.setReferenceNode,referenceNode:void 0}},t}return s(t,e),t.prototype.render=function(){return n.createElement(Ne.Provider,{value:this.state.context},this.props.children)},t}(n.Component),Pe=function(e){return Array.isArray(e)?e[0]:e},Le=function(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}},Te={position:"absolute",top:0,left:0,opacity:0,pointerEvents:"none"},Ce={},Ae=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t=e.call.apply(e,[this].concat(r))||this,f(p(p(t)),"state",{data:void 0,placement:void 0}),f(p(p(t)),"popperInstance",void 0),f(p(p(t)),"popperNode",null),f(p(p(t)),"arrowNode",null),f(p(p(t)),"setPopperNode",(function(e){e&&t.popperNode!==e&&(Le(t.props.innerRef,e),t.popperNode=e,t.updatePopperInstance())})),f(p(p(t)),"setArrowNode",(function(e){t.arrowNode=e})),f(p(p(t)),"updateStateModifier",{enabled:!0,order:900,fn:function(e){var n=e.placement;return t.setState({data:e,placement:n}),e}}),f(p(p(t)),"getOptions",(function(){return{placement:t.props.placement,eventsEnabled:t.props.eventsEnabled,positionFixed:t.props.positionFixed,modifiers:a({},t.props.modifiers,{arrow:a({},t.props.modifiers&&t.props.modifiers.arrow,{enabled:!!t.arrowNode,element:t.arrowNode}),applyStyle:{enabled:!1},updateStateModifier:t.updateStateModifier})}})),f(p(p(t)),"getPopperStyle",(function(){return t.popperNode&&t.state.data?a({position:t.state.data.offsets.popper.position},t.state.data.styles):Te})),f(p(p(t)),"getPopperPlacement",(function(){return t.state.data?t.state.placement:void 0})),f(p(p(t)),"getArrowStyle",(function(){return t.arrowNode&&t.state.data?t.state.data.arrowStyles:Ce})),f(p(p(t)),"getOutOfBoundariesState",(function(){return t.state.data?t.state.data.hide:void 0})),f(p(p(t)),"destroyPopperInstance",(function(){t.popperInstance&&(t.popperInstance.destroy(),t.popperInstance=null)})),f(p(p(t)),"updatePopperInstance",(function(){t.destroyPopperInstance();var e=p(p(t)).popperNode,n=t.props.referenceElement;n&&e&&(t.popperInstance=new he(n,e,t.getOptions()))})),f(p(p(t)),"scheduleUpdate",(function(){t.popperInstance&&t.popperInstance.scheduleUpdate()})),t}s(t,e);var n=t.prototype;return n.componentDidUpdate=function(e,t){this.props.placement!==e.placement||this.props.referenceElement!==e.referenceElement||this.props.positionFixed!==e.positionFixed?this.updatePopperInstance():this.props.eventsEnabled!==e.eventsEnabled&&this.popperInstance&&(this.props.eventsEnabled?this.popperInstance.enableEventListeners():this.popperInstance.disableEventListeners()),t.placement!==this.state.placement&&this.scheduleUpdate()},n.componentWillUnmount=function(){Le(this.props.innerRef,null),this.destroyPopperInstance()},n.render=function(){return Pe(this.props.children)({ref:this.setPopperNode,style:this.getPopperStyle(),placement:this.getPopperPlacement(),outOfBoundaries:this.getOutOfBoundariesState(),scheduleUpdate:this.scheduleUpdate,arrowProps:{ref:this.setArrowNode,style:this.getArrowStyle()}})},t}(n.Component);function De(e){var t=e.referenceElement,r=i(e,["referenceElement"]);return n.createElement(Ne.Consumer,null,(function(e){var o=e.referenceNode;return n.createElement(Ae,a({referenceElement:void 0!==t?t:o},r))}))}f(Ae,"defaultProps",{placement:"bottom",eventsEnabled:!0,referenceElement:void 0,positionFixed:!1});var Fe=function(){};if("production"!==process.env.NODE_ENV){var Se=function(e,t){var n=arguments.length;t=new Array(n>1?n-1:0);for(var r=1;r<n;r++)t[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,(function(){return t[o++]}));"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};Fe=function(e,t,n){var r=arguments.length;n=new Array(r>2?r-2:0);for(var o=2;o<r;o++)n[o-2]=arguments[o];if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");e||Se.apply(null,[t].concat(n))}}var _e=Fe,je=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t=e.call.apply(e,[this].concat(r))||this,f(p(p(t)),"refHandler",(function(e){Le(t.props.innerRef,e),Le(t.props.setReferenceNode,e)})),t}return s(t,e),t.prototype.render=function(){return _e(Boolean(this.props.setReferenceNode),"`Reference` should not be used outside of a `Manager` component."),Pe(this.props.children)({ref:this.refHandler})},t}(n.Component);function Re(e){return n.createElement(Ne.Consumer,null,(function(t){var r=t.setReferenceNode;return n.createElement(je,a({setReferenceNode:r},e))}))}exports.default=function(e){var o=e.isVisible,i=e.children,a=e.triggerRenderer,s=e.placement,p=e.eventsEnabled,f=e.positionFixed,u=e.referenceElement,c=e.modifiers,l=e.onClose,d=e.hideOnLeave,h=void 0===d||d,m=n.useState(),v=t._slicedToArray(m,2),g=v[0],b=v[1];n.useEffect((function(){var e=function(e){l&&g&&!g.contains(e.target)&&l()};return document.addEventListener("click",e),function(){document.removeEventListener("click",e)}}),[l,g]);var y=function(){h&&l&&l()};return r.createElement(Me,null,r.createElement(Re,null,a),o&&r.createElement(De,{innerRef:function(e){return b(e)},placement:s||"bottom-start",eventsEnabled:p,positionFixed:f,referenceElement:u,modifiers:c},(function(e){var n=e.ref,o=e.style,a=t._objectWithoutProperties(e,["ref","style"]);return r.createElement("div",{ref:n,style:t._objectSpread2({},o,{zIndex:99999,width:"100%"}),"data-placement":a.placement,onMouseLeave:y},i)})))};