diff --git a/build/main.js b/build/main.js new file mode 100644 index 0000000..385a33a --- /dev/null +++ b/build/main.js @@ -0,0 +1 @@ +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));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=40)}([function(e,t){e.exports=React},function(e,t,n){e.exports=n(37)()},function(e,t){e.exports=ReactDOM},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,i,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,i,a,s],u=0;(l=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw l.framesToPop=1,l}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(this.props,[]);return function(e){u.forEach((function(t){return delete e[t]}))}(o),o.className=this.props.inputClassName,o.id=this.state.inputId,o.style=n,a.default.createElement("div",{className:this.props.className,style:t},this.renderStyles(),a.default.createElement("input",r({},o,{ref:this.inputRef})),a.default.createElement("div",{ref:this.sizerRef,style:c},e),this.props.placeholder?a.default.createElement("div",{ref:this.placeHolderSizerRef,style:c},this.props.placeholder):null)}}]),t}(i.Component);h.propTypes={className:s.default.string,defaultValue:s.default.any,extraWidth:s.default.oneOfType([s.default.number,s.default.string]),id:s.default.string,injectStyles:s.default.bool,inputClassName:s.default.string,inputRef:s.default.func,inputStyle:s.default.object,minWidth:s.default.oneOfType([s.default.number,s.default.string]),onAutosize:s.default.func,onChange:s.default.func,placeholder:s.default.string,placeholderIsMinWidth:s.default.bool,style:s.default.object,value:s.default.any},h.defaultProps={minWidth:1,injectStyles:!0},t.default=h},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){function n(t){return"function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){e.exports=wp.apiFetch},function(e,t){e.exports=wp.url},function(e,t,n){var r=n(24),o=n(25),i=n(14),a=n(26);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||a()}},function(e,t){e.exports=function(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}},function(e,t){e.exports=lodash},function(e,t){e.exports=wp.data},function(e,t,n){var r=n(22);e.exports=function(e,t){if(null==e)return{};var n,o,i=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}},function(e,t,n){var r=n(15);e.exports=function(e,t){if(e){if("string"===typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(o[n]=e[n]);return o}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;td)&&(F=(U=U.replace(" ",":")).length),0r&&(r=(t=t.trim()).charCodeAt(0)),r){case 38:return t.replace(m,"$1"+e.trim());case 58:return e.trim()+t.replace(m,"$1"+e.trim());default:if(0<1*n&&0l.charCodeAt(8))break;case 115:a=a.replace(l,"-webkit-"+l)+";"+a;break;case 207:case 102:a=a.replace(l,"-webkit-"+(102r.charCodeAt(0)&&(r=r.trim()),r=[r],0=4;++r,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(r)|(255&e.charCodeAt(++r))<<8|(255&e.charCodeAt(++r))<<16|(255&e.charCodeAt(++r))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(r+2))<<16;case 2:n^=(255&e.charCodeAt(r+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(r)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)},S={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};var C=/[A-Z]|^ms/g,k=/_EMO_([^_]+?)_([^]*?)_EMO_/g,E=function(e){return 45===e.charCodeAt(1)},P=function(e){return null!=e&&"boolean"!==typeof e},I=function(e){var t={};return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}((function(e){return E(e)?e:e.replace(C,"-$&").toLowerCase()})),T=function(e,t){switch(e){case"animation":case"animationName":if("string"===typeof t)return t.replace(k,(function(e,t,n){return A={name:t,styles:n,next:A},t}))}return 1===S[e]||E(e)||"number"!==typeof t||0===t?t:t+"px"};function D(e,t,n,r){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return A={name:n.name,styles:n.styles,next:A},n.name;if(void 0!==n.styles){var o=n.next;if(void 0!==o)for(;void 0!==o;)A={name:o.name,styles:o.styles,next:A},o=o.next;return n.styles+";"}return function(e,t,n){var r="";if(Array.isArray(n))for(var o=0;o=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function X(){return(X=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n-1}function ye(e){return be(e)?window.pageYOffset:e.scrollTop}function Oe(e,t){be(e)?window.scrollTo(0,t):e.scrollTop=t}function we(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function xe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:he,o=ye(e),i=t-o,a=10,s=0;function l(){var t=we(s+=a,o,i,n);Oe(e,t),s=d)return{placement:"bottom",maxHeight:t};if(S>=d&&!a)return i&&xe(l,C,E),{placement:"bottom",maxHeight:t};if(!a&&S>=r||a&&w>=r)return i&&xe(l,C,E),{placement:"bottom",maxHeight:a?w-b:S-b};if("auto"===o||a){var P=t,I=a?O:x;return I>=r&&(P=Math.min(I-b-s.controlHeight,t)),{placement:"top",maxHeight:P}}if("bottom"===o)return Oe(l,C),{placement:"bottom",maxHeight:t};break;case"top":if(O>=d)return{placement:"top",maxHeight:t};if(x>=d&&!a)return i&&xe(l,k,E),{placement:"top",maxHeight:t};if(!a&&x>=r||a&&O>=r){var T=t;return(!a&&x>=r||a&&O>=r)&&(T=a?O-y:x-y),i&&xe(l,k,E),{placement:"top",maxHeight:T}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(o,'".'))}return c}var Ie=function(e){return"auto"===e?"bottom":e},Te=Object(o.createContext)({getPortalPlacement:null}),De=function(e){ae(n,e);var t=Ee(n);function n(){var e;te(this,n);for(var r=arguments.length,o=new Array(r),i=0;i0,h=u-p-c,v=!1;h>n&&e.isBottom&&(i&&i(t),e.isBottom=!1),d&&e.isTop&&(s&&s(t),e.isTop=!1),d&&n>h?(o&&!e.isBottom&&o(t),f.scrollTop=u,v=!0,e.isBottom=!0):!d&&-n>c&&(a&&!e.isTop&&a(t),f.scrollTop=0,v=!0,e.isTop=!0),v&&e.cancelScroll(t)},e.onWheel=function(t){e.handleEventDelta(t,t.deltaY)},e.onTouchStart=function(t){e.touchStart=t.changedTouches[0].clientY},e.onTouchMove=function(t){var n=e.touchStart-t.changedTouches[0].clientY;e.handleEventDelta(t,n)},e.getScrollTarget=function(t){e.scrollTarget=t},e}return re(n,[{key:"componentDidMount",value:function(){this.startListening(this.scrollTarget)}},{key:"componentWillUnmount",value:function(){this.stopListening(this.scrollTarget)}},{key:"startListening",value:function(e){e&&("function"===typeof e.addEventListener&&e.addEventListener("wheel",this.onWheel,!1),"function"===typeof e.addEventListener&&e.addEventListener("touchstart",this.onTouchStart,!1),"function"===typeof e.addEventListener&&e.addEventListener("touchmove",this.onTouchMove,!1))}},{key:"stopListening",value:function(e){e&&("function"===typeof e.removeEventListener&&e.removeEventListener("wheel",this.onWheel,!1),"function"===typeof e.removeEventListener&&e.removeEventListener("touchstart",this.onTouchStart,!1),"function"===typeof e.removeEventListener&&e.removeEventListener("touchmove",this.onTouchMove,!1))}},{key:"render",value:function(){return i.a.createElement(Pt,{innerRef:this.getScrollTarget},this.props.children)}}]),n}(o.Component);function zt(e){var t=e.isEnabled,n=void 0===t||t,r=$(e,["isEnabled"]);return n?i.a.createElement(Ut,r):r.children}var Bt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.isSearchable,r=t.isMulti,o=t.label,i=t.isDisabled,a=t.tabSelectsValue;switch(e){case"menu":return"Use Up and Down to choose options".concat(i?"":", press Enter to select the currently focused option",", press Escape to exit the menu").concat(a?", press Tab to select the option and exit the menu":"",".");case"input":return"".concat(o||"Select"," is focused ").concat(n?",type to refine list":"",", press Down to open the menu, ").concat(r?" press left to focus selected values":"");case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value"}},Gt=function(e,t){var n=t.value,r=t.isDisabled;if(n)switch(e){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(n,", deselected.");case"select-option":return"option ".concat(n,r?" is disabled. Select another option.":", selected.")}},Yt=function(e){return!!e.isDisabled};var Kt={clearIndicator:Xe,container:function(e){var t=e.isDisabled;return{label:"container",direction:e.isRtl?"rtl":null,pointerEvents:t?"none":null,position:"relative"}},control:function(e){var t=e.isDisabled,n=e.isFocused,r=e.theme,o=r.colors,i=r.borderRadius,a=r.spacing;return{label:"control",alignItems:"center",backgroundColor:t?o.neutral5:o.neutral0,borderColor:t?o.neutral10:n?o.primary:o.neutral20,borderRadius:i,borderStyle:"solid",borderWidth:1,boxShadow:n?"0 0 0 1px ".concat(o.primary):null,cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:a.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms","&:hover":{borderColor:n?o.primary:o.neutral30}}},dropdownIndicator:$e,group:function(e){var t=e.theme.spacing;return{paddingBottom:2*t.baseUnit,paddingTop:2*t.baseUnit}},groupHeading:function(e){var t=e.theme.spacing;return{label:"group",color:"#999",cursor:"default",display:"block",fontSize:"75%",fontWeight:"500",marginBottom:"0.25em",paddingLeft:3*t.baseUnit,paddingRight:3*t.baseUnit,textTransform:"uppercase"}},indicatorsContainer:function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},indicatorSeparator:function(e){var t=e.isDisabled,n=e.theme,r=n.spacing.baseUnit,o=n.colors;return{label:"indicatorSeparator",alignSelf:"stretch",backgroundColor:t?o.neutral10:o.neutral20,marginBottom:2*r,marginTop:2*r,width:1}},input:function(e){var t=e.isDisabled,n=e.theme,r=n.spacing,o=n.colors;return{margin:r.baseUnit/2,paddingBottom:r.baseUnit/2,paddingTop:r.baseUnit/2,visibility:t?"hidden":"visible",color:o.neutral80}},loadingIndicator:function(e){var t=e.isFocused,n=e.size,r=e.theme,o=r.colors,i=r.spacing.baseUnit;return{label:"loadingIndicator",color:t?o.neutral60:o.neutral20,display:"flex",padding:2*i,transition:"color 150ms",alignSelf:"center",fontSize:n,lineHeight:1,marginRight:n,textAlign:"center",verticalAlign:"middle"}},loadingMessage:Me,menu:function(e){var t,n=e.placement,r=e.theme,o=r.borderRadius,i=r.spacing,a=r.colors;return ee(t={label:"menu"},function(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}(n),"100%"),ee(t,"backgroundColor",a.neutral0),ee(t,"borderRadius",o),ee(t,"boxShadow","0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)"),ee(t,"marginBottom",i.menuGutter),ee(t,"marginTop",i.menuGutter),ee(t,"position","absolute"),ee(t,"width","100%"),ee(t,"zIndex",1),t},menuList:function(e){var t=e.maxHeight,n=e.theme.spacing.baseUnit;return{maxHeight:t,overflowY:"auto",paddingBottom:n,paddingTop:n,position:"relative",WebkitOverflowScrolling:"touch"}},menuPortal:function(e){var t=e.rect,n=e.offset,r=e.position;return{left:t.left,position:r,top:n,width:t.width,zIndex:1}},multiValue:function(e){var t=e.theme,n=t.spacing,r=t.borderRadius;return{label:"multiValue",backgroundColor:t.colors.neutral10,borderRadius:r/2,display:"flex",margin:n.baseUnit/2,minWidth:0}},multiValueLabel:function(e){var t=e.theme,n=t.borderRadius,r=t.colors,o=e.cropWithEllipsis;return{borderRadius:n/2,color:r.neutral80,fontSize:"85%",overflow:"hidden",padding:3,paddingLeft:6,textOverflow:o?"ellipsis":null,whiteSpace:"nowrap"}},multiValueRemove:function(e){var t=e.theme,n=t.spacing,r=t.borderRadius,o=t.colors;return{alignItems:"center",borderRadius:r/2,backgroundColor:e.isFocused&&o.dangerLight,display:"flex",paddingLeft:n.baseUnit,paddingRight:n.baseUnit,":hover":{backgroundColor:o.dangerLight,color:o.danger}}},noOptionsMessage:Re,option:function(e){var t=e.isDisabled,n=e.isFocused,r=e.isSelected,o=e.theme,i=o.spacing,a=o.colors;return{label:"option",backgroundColor:r?a.primary:n?a.primary25:"transparent",color:t?a.neutral20:r?a.neutral0:"inherit",cursor:"default",display:"block",fontSize:"inherit",padding:"".concat(2*i.baseUnit,"px ").concat(3*i.baseUnit,"px"),width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",":active":{backgroundColor:!t&&(r?a.primary:a.primary50)}}},placeholder:function(e){var t=e.theme,n=t.spacing;return{label:"placeholder",color:t.colors.neutral50,marginLeft:n.baseUnit/2,marginRight:n.baseUnit/2,position:"absolute",top:"50%",transform:"translateY(-50%)"}},singleValue:function(e){var t=e.isDisabled,n=e.theme,r=n.spacing,o=n.colors;return{label:"singleValue",color:t?o.neutral40:o.neutral80,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2,maxWidth:"calc(100% - ".concat(2*r.baseUnit,"px)"),overflow:"hidden",position:"absolute",textOverflow:"ellipsis",whiteSpace:"nowrap",top:"50%",transform:"translateY(-50%)"}},valueContainer:function(e){var t=e.theme.spacing;return{alignItems:"center",display:"flex",flex:1,flexWrap:"wrap",padding:"".concat(t.baseUnit/2,"px ").concat(2*t.baseUnit,"px"),WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"}}};var $t={borderRadius:4,colors:{primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},spacing:{baseUnit:4,controlHeight:38,menuGutter:8}};function Xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function qt(e){for(var t=1;t-1},formatGroupLabel:function(e){return e.label},getOptionLabel:function(e){return e.label},getOptionValue:function(e){return e.value},isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:Yt,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!function(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch(e){return!1}}(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return"".concat(t," result").concat(1!==t?"s":""," available")},styles:{},tabIndex:"0",tabSelectsValue:!0},en=1,tn=function(e){ae(n,e);var t=Qt(n);function n(e){var r;te(this,n),(r=t.call(this,e)).state={ariaLiveSelection:"",ariaLiveContext:"",focusedOption:null,focusedValue:null,inputIsHidden:!1,isFocused:!1,menuOptions:{render:[],focusable:[]},selectValue:[]},r.blockOptionHover=!1,r.isComposing=!1,r.clearFocusValueOnUpdate=!1,r.commonProps=void 0,r.components=void 0,r.hasGroups=!1,r.initialTouchX=0,r.initialTouchY=0,r.inputIsHiddenAfterUpdate=void 0,r.instancePrefix="",r.openAfterFocus=!1,r.scrollToFocusedOptionOnUpdate=!1,r.userIsDragging=void 0,r.controlRef=null,r.getControlRef=function(e){r.controlRef=e},r.focusedOptionRef=null,r.getFocusedOptionRef=function(e){r.focusedOptionRef=e},r.menuListRef=null,r.getMenuListRef=function(e){r.menuListRef=e},r.inputRef=null,r.getInputRef=function(e){r.inputRef=e},r.cacheComponents=function(e){var t;r.components=(t={components:e},pt(pt({},ft),t.components))},r.focus=r.focusInput,r.blur=r.blurInput,r.onChange=function(e,t){var n=r.props,o=n.onChange,i=n.name;o(e,qt(qt({},t),{},{name:i}))},r.setValue=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"set-value",n=arguments.length>2?arguments[2]:void 0,o=r.props,i=o.closeMenuOnSelect,a=o.isMulti;r.onInputChange("",{action:"set-value"}),i&&(r.inputIsHiddenAfterUpdate=!a,r.onMenuClose()),r.clearFocusValueOnUpdate=!0,r.onChange(e,{action:t,option:n})},r.selectOption=function(e){var t=r.props,n=t.blurInputOnSelect,o=t.isMulti,i=r.state.selectValue;if(o)if(r.isOptionSelected(e,i)){var a=r.getOptionValue(e);r.setValue(i.filter((function(e){return r.getOptionValue(e)!==a})),"deselect-option",e),r.announceAriaLiveSelection({event:"deselect-option",context:{value:r.getOptionLabel(e)}})}else r.isOptionDisabled(e,i)?r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e),isDisabled:!0}}):(r.setValue([].concat(J(i),[e]),"select-option",e),r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e)}}));else r.isOptionDisabled(e,i)?r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e),isDisabled:!0}}):(r.setValue(e,"select-option"),r.announceAriaLiveSelection({event:"select-option",context:{value:r.getOptionLabel(e)}}));n&&r.blurInput()},r.removeValue=function(e){var t=r.state.selectValue,n=r.getOptionValue(e),o=t.filter((function(e){return r.getOptionValue(e)!==n}));r.onChange(o.length?o:null,{action:"remove-value",removedValue:e}),r.announceAriaLiveSelection({event:"remove-value",context:{value:e?r.getOptionLabel(e):""}}),r.focusInput()},r.clearValue=function(){r.onChange(null,{action:"clear"})},r.popValue=function(){var e=r.state.selectValue,t=e[e.length-1],n=e.slice(0,e.length-1);r.announceAriaLiveSelection({event:"pop-value",context:{value:t?r.getOptionLabel(t):""}}),r.onChange(n.length?n:null,{action:"pop-value",removedValue:t})},r.getValue=function(){return r.state.selectValue},r.cx=function(){for(var e=arguments.length,t=new Array(e),n=0;n5||i>5}},r.onTouchEnd=function(e){r.userIsDragging||(r.controlRef&&!r.controlRef.contains(e.target)&&r.menuListRef&&!r.menuListRef.contains(e.target)&&r.blurInput(),r.initialTouchX=0,r.initialTouchY=0)},r.onControlTouchEnd=function(e){r.userIsDragging||r.onControlMouseDown(e)},r.onClearIndicatorTouchEnd=function(e){r.userIsDragging||r.onClearIndicatorMouseDown(e)},r.onDropdownIndicatorTouchEnd=function(e){r.userIsDragging||r.onDropdownIndicatorMouseDown(e)},r.handleInputChange=function(e){var t=e.currentTarget.value;r.inputIsHiddenAfterUpdate=!1,r.onInputChange(t,{action:"input-change"}),r.props.menuIsOpen||r.onMenuOpen()},r.onInputFocus=function(e){var t=r.props,n=t.isSearchable,o=t.isMulti;r.props.onFocus&&r.props.onFocus(e),r.inputIsHiddenAfterUpdate=!1,r.announceAriaLiveContext({event:"input",context:{isSearchable:n,isMulti:o}}),r.setState({isFocused:!0}),(r.openAfterFocus||r.props.openMenuOnFocus)&&r.openMenu("first"),r.openAfterFocus=!1},r.onInputBlur=function(e){r.menuListRef&&r.menuListRef.contains(document.activeElement)?r.inputRef.focus():(r.props.onBlur&&r.props.onBlur(e),r.onInputChange("",{action:"input-blur"}),r.onMenuClose(),r.setState({focusedValue:null,isFocused:!1}))},r.onOptionHover=function(e){r.blockOptionHover||r.state.focusedOption===e||r.setState({focusedOption:e})},r.shouldHideSelectedOptions=function(){var e=r.props,t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},r.onKeyDown=function(e){var t=r.props,n=t.isMulti,o=t.backspaceRemovesValue,i=t.escapeClearsValue,a=t.inputValue,s=t.isClearable,l=t.isDisabled,c=t.menuIsOpen,u=t.onKeyDown,p=t.tabSelectsValue,f=t.openMenuOnFocus,d=r.state,h=d.focusedOption,v=d.focusedValue,m=d.selectValue;if(!l&&("function"!==typeof u||(u(e),!e.defaultPrevented))){switch(r.blockOptionHover=!0,e.key){case"ArrowLeft":if(!n||a)return;r.focusValue("previous");break;case"ArrowRight":if(!n||a)return;r.focusValue("next");break;case"Delete":case"Backspace":if(a)return;if(v)r.removeValue(v);else{if(!o)return;n?r.popValue():s&&r.clearValue()}break;case"Tab":if(r.isComposing)return;if(e.shiftKey||!c||!p||!h||f&&r.isOptionSelected(h,m))return;r.selectOption(h);break;case"Enter":if(229===e.keyCode)break;if(c){if(!h)return;if(r.isComposing)return;r.selectOption(h);break}return;case"Escape":c?(r.inputIsHiddenAfterUpdate=!1,r.onInputChange("",{action:"menu-close"}),r.onMenuClose()):s&&i&&r.clearValue();break;case" ":if(a)return;if(!c){r.openMenu("first");break}if(!h)return;r.selectOption(h);break;case"ArrowUp":c?r.focusOption("up"):r.openMenu("last");break;case"ArrowDown":c?r.focusOption("down"):r.openMenu("first");break;case"PageUp":if(!c)return;r.focusOption("pageup");break;case"PageDown":if(!c)return;r.focusOption("pagedown");break;case"Home":if(!c)return;r.focusOption("first");break;case"End":if(!c)return;r.focusOption("last");break;default:return}e.preventDefault()}},r.buildMenuOptions=function(e,t){var n=e.inputValue,o=void 0===n?"":n,i=e.options,a=function(e,n){var i=r.isOptionDisabled(e,t),a=r.isOptionSelected(e,t),s=r.getOptionLabel(e),l=r.getOptionValue(e);if(!(r.shouldHideSelectedOptions()&&a||!r.filterOption({label:s,value:l,data:e},o))){var c=i?void 0:function(){return r.onOptionHover(e)},u=i?void 0:function(){return r.selectOption(e)},p="".concat(r.getElementId("option"),"-").concat(n);return{innerProps:{id:p,onClick:u,onMouseMove:c,onMouseOver:c,tabIndex:-1},data:e,isDisabled:i,isSelected:a,key:p,label:s,type:"option",value:l}}};return i.reduce((function(e,t,n){if(t.options){r.hasGroups||(r.hasGroups=!0);var o=t.options.map((function(t,r){var o=a(t,"".concat(n,"-").concat(r));return o&&e.focusable.push(t),o})).filter(Boolean);if(o.length){var i="".concat(r.getElementId("group"),"-").concat(n);e.render.push({type:"group",key:i,data:t,options:o})}}else{var s=a(t,"".concat(n));s&&(e.render.push(s),e.focusable.push(t))}return e}),{render:[],focusable:[]})};var o=e.value;r.cacheComponents=pe(r.cacheComponents,We).bind(oe(r)),r.cacheComponents(e.components),r.instancePrefix="react-select-"+(r.props.instanceId||++en);var i=ge(o);r.buildMenuOptions=pe(r.buildMenuOptions,(function(e,t){var n=Z(e,2),r=n[0],o=n[1],i=Z(t,2),a=i[0];return o===i[1]&&r.inputValue===a.inputValue&&r.options===a.options})).bind(oe(r));var a=e.menuIsOpen?r.buildMenuOptions(e,i):{render:[],focusable:[]};return r.state.menuOptions=a,r.state.selectValue=i,r}return re(n,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput()}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){var t=this.props,n=t.options,r=t.value,o=t.menuIsOpen,i=t.inputValue;if(this.cacheComponents(e.components),e.value!==r||e.options!==n||e.menuIsOpen!==o||e.inputValue!==i){var a=ge(e.value),s=e.menuIsOpen?this.buildMenuOptions(e,a):{render:[],focusable:[]},l=this.getNextFocusedValue(a),c=this.getNextFocusedOption(s.focusable);this.setState({menuOptions:s,selectValue:a,focusedOption:c,focusedValue:l})}null!=this.inputIsHiddenAfterUpdate&&(this.setState({inputIsHidden:this.inputIsHiddenAfterUpdate}),delete this.inputIsHiddenAfterUpdate)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isDisabled,r=t.menuIsOpen,o=this.state.isFocused;(o&&!n&&e.isDisabled||o&&r&&!e.menuIsOpen)&&this.focusInput(),o&&n&&!e.isDisabled&&this.setState({isFocused:!1},this.onMenuClose),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(!function(e,t){var n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),o=t.offsetHeight/3;r.bottom+o>n.bottom?Oe(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+o,e.scrollHeight)):r.top-o-1&&(c=u)}this.scrollToFocusedOptionOnUpdate=!(o&&this.menuListRef),this.inputIsHiddenAfterUpdate=!1,this.setState({menuOptions:i,focusedValue:null,focusedOption:i.focusable[c]},(function(){t.onMenuOpen(),t.announceAriaLiveContext({event:"menu",context:{tabSelectsValue:l}})}))}},{key:"focusValue",value:function(e){var t=this.props,n=t.isMulti,r=t.isSearchable,o=this.state,i=o.selectValue,a=o.focusedValue;if(n){this.setState({focusedOption:null});var s=i.indexOf(a);a||(s=-1,this.announceAriaLiveContext({event:"value"}));var l=i.length-1,c=-1;if(i.length){switch(e){case"previous":c=0===s?0:-1===s?l:s-1;break;case"next":s>-1&&s0&&void 0!==arguments[0]?arguments[0]:"first",t=this.props,n=t.pageSize,r=t.tabSelectsValue,o=this.state,i=o.focusedOption,a=o.menuOptions,s=a.focusable;if(s.length){var l=0,c=s.indexOf(i);i||(c=-1,this.announceAriaLiveContext({event:"menu",context:{tabSelectsValue:r}})),"up"===e?l=c>0?c-1:s.length-1:"down"===e?l=(c+1)%s.length:"pageup"===e?(l=c-n)<0&&(l=0):"pagedown"===e?(l=c+n)>s.length-1&&(l=s.length-1):"last"===e&&(l=s.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:s[l],focusedValue:null}),this.announceAriaLiveContext({event:"menu",context:{isDisabled:Yt(s[l]),tabSelectsValue:r}})}}},{key:"getTheme",value:function(){return this.props.theme?"function"===typeof this.props.theme?this.props.theme($t):qt(qt({},$t),this.props.theme):$t}},{key:"getCommonProps",value:function(){var e=this.clearValue,t=this.cx,n=this.getStyles,r=this.getValue,o=this.setValue,i=this.selectOption,a=this.props,s=a.isMulti,l=a.isRtl,c=a.options;return{cx:t,clearValue:e,getStyles:n,getValue:r,hasValue:this.hasValue(),isMulti:s,isRtl:l,options:c,selectOption:i,setValue:o,selectProps:a,theme:this.getTheme()}}},{key:"getNextFocusedValue",value:function(e){if(this.clearFocusValueOnUpdate)return this.clearFocusValueOnUpdate=!1,null;var t=this.state,n=t.focusedValue,r=t.selectValue.indexOf(n);if(r>-1){if(e.indexOf(n)>-1)return n;if(r-1?t:e[0]}},{key:"hasValue",value:function(){return this.state.selectValue.length>0}},{key:"hasOptions",value:function(){return!!this.state.menuOptions.render.length}},{key:"countOptions",value:function(){return this.state.menuOptions.focusable.length}},{key:"isClearable",value:function(){var e=this.props,t=e.isClearable,n=e.isMulti;return void 0===t?n:t}},{key:"isOptionDisabled",value:function(e,t){return"function"===typeof this.props.isOptionDisabled&&this.props.isOptionDisabled(e,t)}},{key:"isOptionSelected",value:function(e,t){var n=this;if(t.indexOf(e)>-1)return!0;if("function"===typeof this.props.isOptionSelected)return this.props.isOptionSelected(e,t);var r=this.getOptionValue(e);return t.some((function(e){return n.getOptionValue(e)===r}))}},{key:"filterOption",value:function(e,t){return!this.props.filterOption||this.props.filterOption(e,t)}},{key:"formatOptionLabel",value:function(e,t){if("function"===typeof this.props.formatOptionLabel){var n=this.props.inputValue,r=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:n,selectValue:r})}return this.getOptionLabel(e)}},{key:"formatGroupLabel",value:function(e){return this.props.formatGroupLabel(e)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"constructAriaLiveMessage",value:function(){var e=this.state,t=e.ariaLiveContext,n=e.selectValue,r=e.focusedValue,o=e.focusedOption,i=this.props,a=i.options,s=i.menuIsOpen,l=i.inputValue,c=i.screenReaderStatus,u=r?function(e){var t=e.focusedValue,n=e.getOptionLabel,r=e.selectValue;return"value ".concat(n(t)," focused, ").concat(r.indexOf(t)+1," of ").concat(r.length,".")}({focusedValue:r,getOptionLabel:this.getOptionLabel,selectValue:n}):"",p=o&&s?function(e){var t=e.focusedOption,n=e.getOptionLabel,r=e.options;return"option ".concat(n(t)," focused").concat(t.isDisabled?" disabled":"",", ").concat(r.indexOf(t)+1," of ").concat(r.length,".")}({focusedOption:o,getOptionLabel:this.getOptionLabel,options:a}):"",f=function(e){var t=e.inputValue,n=e.screenReaderMessage;return"".concat(n).concat(t?" for search term "+t:"",".")}({inputValue:l,screenReaderMessage:c({count:this.countOptions()})});return"".concat(u," ").concat(p," ").concat(f," ").concat(t)}},{key:"renderInput",value:function(){var e=this.props,t=e.isDisabled,n=e.isSearchable,r=e.inputId,o=e.inputValue,a=e.tabIndex,s=e.form,l=this.components.Input,c=this.state.inputIsHidden,u=r||this.getElementId("input"),p={"aria-autocomplete":"list","aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"]};if(!n)return i.a.createElement(kt,X({id:u,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:he,onFocus:this.onInputFocus,readOnly:!0,disabled:t,tabIndex:a,form:s,value:""},p));var f=this.commonProps,d=f.cx,h=f.theme,v=f.selectProps;return i.a.createElement(l,X({autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",cx:d,getStyles:this.getStyles,id:u,innerRef:this.getInputRef,isDisabled:t,isHidden:c,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,selectProps:v,spellCheck:"false",tabIndex:a,form:s,theme:h,type:"text",value:o},p))}},{key:"renderPlaceholderOrValue",value:function(){var e=this,t=this.components,n=t.MultiValue,r=t.MultiValueContainer,o=t.MultiValueLabel,a=t.MultiValueRemove,s=t.SingleValue,l=t.Placeholder,c=this.commonProps,u=this.props,p=u.controlShouldRenderValue,f=u.isDisabled,d=u.isMulti,h=u.inputValue,v=u.placeholder,m=this.state,g=m.selectValue,b=m.focusedValue,y=m.isFocused;if(!this.hasValue()||!p)return h?null:i.a.createElement(l,X({},c,{key:"placeholder",isDisabled:f,isFocused:y}),v);if(d)return g.map((function(t,s){var l=t===b;return i.a.createElement(n,X({},c,{components:{Container:r,Label:o,Remove:a},isFocused:l,isDisabled:f,key:"".concat(e.getOptionValue(t)).concat(s),index:s,removeProps:{onClick:function(){return e.removeValue(t)},onTouchEnd:function(){return e.removeValue(t)},onMouseDown:function(e){e.preventDefault(),e.stopPropagation()}},data:t}),e.formatOptionLabel(t,"value"))}));if(h)return null;var O=g[0];return i.a.createElement(s,X({},c,{data:O,isDisabled:f}),this.formatOptionLabel(O,"value"))}},{key:"renderClearIndicator",value:function(){var e=this.components.ClearIndicator,t=this.commonProps,n=this.props,r=n.isDisabled,o=n.isLoading,a=this.state.isFocused;if(!this.isClearable()||!e||r||!this.hasValue()||o)return null;var s={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return i.a.createElement(e,X({},t,{innerProps:s,isFocused:a}))}},{key:"renderLoadingIndicator",value:function(){var e=this.components.LoadingIndicator,t=this.commonProps,n=this.props,r=n.isDisabled,o=n.isLoading,a=this.state.isFocused;if(!e||!o)return null;return i.a.createElement(e,X({},t,{innerProps:{"aria-hidden":"true"},isDisabled:r,isFocused:a}))}},{key:"renderIndicatorSeparator",value:function(){var e=this.components,t=e.DropdownIndicator,n=e.IndicatorSeparator;if(!t||!n)return null;var r=this.commonProps,o=this.props.isDisabled,a=this.state.isFocused;return i.a.createElement(n,X({},r,{isDisabled:o,isFocused:a}))}},{key:"renderDropdownIndicator",value:function(){var e=this.components.DropdownIndicator;if(!e)return null;var t=this.commonProps,n=this.props.isDisabled,r=this.state.isFocused,o={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return i.a.createElement(e,X({},t,{innerProps:o,isDisabled:n,isFocused:r}))}},{key:"renderMenu",value:function(){var e=this,t=this.components,n=t.Group,r=t.GroupHeading,o=t.Menu,a=t.MenuList,s=t.MenuPortal,l=t.LoadingMessage,c=t.NoOptionsMessage,u=t.Option,p=this.commonProps,f=this.state,d=f.focusedOption,h=f.menuOptions,v=this.props,m=v.captureMenuScroll,g=v.inputValue,b=v.isLoading,y=v.loadingMessage,O=v.minMenuHeight,w=v.maxMenuHeight,x=v.menuIsOpen,S=v.menuPlacement,C=v.menuPosition,k=v.menuPortalTarget,E=v.menuShouldBlockScroll,P=v.menuShouldScrollIntoView,I=v.noOptionsMessage,T=v.onMenuScrollToTop,D=v.onMenuScrollToBottom;if(!x)return null;var A,R=function(t){var n=d===t.data;return t.innerRef=n?e.getFocusedOptionRef:void 0,i.a.createElement(u,X({},p,t,{isFocused:n}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())A=h.render.map((function(t){if("group"===t.type){t.type;var o=$(t,["type"]),a="".concat(t.key,"-heading");return i.a.createElement(n,X({},p,o,{Heading:r,headingProps:{id:a,data:t.data},label:e.formatGroupLabel(t.data)}),t.options.map((function(e){return R(e)})))}if("option"===t.type)return R(t)}));else if(b){var M=y({inputValue:g});if(null===M)return null;A=i.a.createElement(l,p,M)}else{var j=I({inputValue:g});if(null===j)return null;A=i.a.createElement(c,p,j)}var L={minMenuHeight:O,maxMenuHeight:w,menuPlacement:S,menuPosition:C,menuShouldScrollIntoView:P},V=i.a.createElement(De,X({},p,L),(function(t){var n=t.ref,r=t.placerProps,s=r.placement,l=r.maxHeight;return i.a.createElement(o,X({},p,L,{innerRef:n,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:b,placement:s}),i.a.createElement(zt,{isEnabled:m,onTopArrive:T,onBottomArrive:D},i.a.createElement(_t,{isEnabled:E},i.a.createElement(a,X({},p,{innerRef:e.getMenuListRef,isLoading:b,maxHeight:l}),A))))}));return k||"fixed"===C?i.a.createElement(s,X({},p,{appendTo:k,controlElement:this.controlRef,menuPlacement:S,menuPosition:C}),V):V}},{key:"renderFormField",value:function(){var e=this,t=this.props,n=t.delimiter,r=t.isDisabled,o=t.isMulti,a=t.name,s=this.state.selectValue;if(a&&!r){if(o){if(n){var l=s.map((function(t){return e.getOptionValue(t)})).join(n);return i.a.createElement("input",{name:a,type:"hidden",value:l})}var c=s.length>0?s.map((function(t,n){return i.a.createElement("input",{key:"i-".concat(n),name:a,type:"hidden",value:e.getOptionValue(t)})})):i.a.createElement("input",{name:a,type:"hidden"});return i.a.createElement("div",null,c)}var u=s[0]?this.getOptionValue(s[0]):"";return i.a.createElement("input",{name:a,type:"hidden",value:u})}}},{key:"renderLiveRegion",value:function(){return this.state.isFocused?i.a.createElement(Ct,{"aria-live":"polite"},i.a.createElement("span",{id:"aria-selection-event"},"\xa0",this.state.ariaLiveSelection),i.a.createElement("span",{id:"aria-context"},"\xa0",this.constructAriaLiveMessage())):null}},{key:"render",value:function(){var e=this.components,t=e.Control,n=e.IndicatorsContainer,r=e.SelectContainer,o=e.ValueContainer,a=this.props,s=a.className,l=a.id,c=a.isDisabled,u=a.menuIsOpen,p=this.state.isFocused,f=this.commonProps=this.getCommonProps();return i.a.createElement(r,X({},f,{className:s,innerProps:{id:l,onKeyDown:this.onKeyDown},isDisabled:c,isFocused:p}),this.renderLiveRegion(),i.a.createElement(t,X({},f,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:c,isFocused:p,menuIsOpen:u}),i.a.createElement(o,X({},f,{isDisabled:c}),this.renderPlaceholderOrValue(),this.renderInput()),i.a.createElement(n,X({},f,{isDisabled:c}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}]),n}(o.Component);tn.defaultProps=Jt;n(10);function nn(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ce(e);if(t){var o=ce(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return le(this,n)}}var rn={defaultInputValue:"",defaultMenuIsOpen:!1,defaultValue:null},on=function(e){var t,n;return n=t=function(t){ae(r,t);var n=nn(r);function r(){var e;te(this,r);for(var t=arguments.length,o=new Array(t),i=0;i1?n-1:0),o=1;o0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=String(e).toLowerCase(),r=String(t.value).toLowerCase(),o=String(t.label).toLowerCase();return r===n||o===n},fn=function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:this.active.collection;return this.refs[e].sort(wn)}}]),e}();function wn(e,t){return e.node.sortableInfo.index-t.node.sortableInfo.index}function xn(e,t){return Object.keys(e).reduce((function(n,r){return-1===t.indexOf(r)&&(n[r]=e[r]),n}),{})}var Sn={end:["touchend","touchcancel","mouseup"],move:["touchmove","mousemove"],start:["touchstart","mousedown"]},Cn=function(){if("undefined"===typeof window||"undefined"===typeof document)return"";var e=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1];switch(t){case"ms":return"ms";default:return t&&t.length?t[0].toUpperCase()+t.substr(1):""}}();function kn(e,t){Object.keys(t).forEach((function(n){e.style[n]=t[n]}))}function En(e,t){e.style["".concat(Cn,"Transform")]=null==t?"":"translate3d(".concat(t.x,"px,").concat(t.y,"px,0)")}function Pn(e,t){e.style["".concat(Cn,"TransitionDuration")]=null==t?"":"".concat(t,"ms")}function In(e,t){for(;e;){if(t(e))return e;e=e.parentNode}return null}function Tn(e,t,n){return Math.max(e,Math.min(n,t))}function Dn(e){return"px"===e.substr(-2)?parseFloat(e):0}function An(e){var t=window.getComputedStyle(e);return{bottom:Dn(t.marginBottom),left:Dn(t.marginLeft),right:Dn(t.marginRight),top:Dn(t.marginTop)}}function Rn(e,t){var n=t.displayName||t.name;return n?"".concat(e,"(").concat(n,")"):e}function Mn(e,t){var n=e.getBoundingClientRect();return{top:n.top+t.top,left:n.left+t.left}}function jn(e){return e.touches&&e.touches.length?{x:e.touches[0].pageX,y:e.touches[0].pageY}:e.changedTouches&&e.changedTouches.length?{x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY}:{x:e.pageX,y:e.pageY}}function Ln(e){return e.touches&&e.touches.length||e.changedTouches&&e.changedTouches.length}function Vn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){var r={left:n.left+e.offsetLeft,top:n.top+e.offsetTop};return e.parentNode===t?r:Vn(e.parentNode,t,r)}}function Nn(e,t,n){return et?e-1:e>n&&e0&&n[t].height>0)&&e.getContext("2d").drawImage(n[t],0,0)})),r}function nr(e){return null!=e.sortableHandle}var rr=function(){function e(t,n){te(this,e),this.container=t,this.onScrollCallback=n}return re(e,[{key:"clear",value:function(){null!=this.interval&&(clearInterval(this.interval),this.interval=null)}},{key:"update",value:function(e){var t=this,n=e.translate,r=e.minTranslate,o=e.maxTranslate,i=e.width,a=e.height,s={x:0,y:0},l={x:1,y:1},c=10,u=10,p=this.container,f=p.scrollTop,d=p.scrollLeft,h=p.scrollHeight,v=p.scrollWidth,m=0===f,g=h-f-p.clientHeight===0,b=0===d,y=v-d-p.clientWidth===0;n.y>=o.y-a/2&&!g?(s.y=1,l.y=u*Math.abs((o.y-a/2-n.y)/a)):n.x>=o.x-i/2&&!y?(s.x=1,l.x=c*Math.abs((o.x-i/2-n.x)/i)):n.y<=r.y+a/2&&!m?(s.y=-1,l.y=u*Math.abs((n.y-a/2-r.y)/a)):n.x<=r.x+i/2&&!b&&(s.x=-1,l.x=c*Math.abs((n.x-i/2-r.x)/i)),this.interval&&(this.clear(),this.isAutoScrolling=!1),0===s.x&&0===s.y||(this.interval=setInterval((function(){t.isAutoScrolling=!0;var e={left:l.x*s.x,top:l.y*s.y};t.container.scrollTop+=e.top,t.container.scrollLeft+=e.left,t.onScrollCallback(e)}),5))}}]),e}();var or={axis:yn.a.oneOf(["x","y","xy"]),contentWindow:yn.a.any,disableAutoscroll:yn.a.bool,distance:yn.a.number,getContainer:yn.a.func,getHelperDimensions:yn.a.func,helperClass:yn.a.string,helperContainer:yn.a.oneOfType([yn.a.func,"undefined"===typeof HTMLElement?yn.a.any:yn.a.instanceOf(HTMLElement)]),hideSortableGhost:yn.a.bool,keyboardSortingTransitionDuration:yn.a.number,lockAxis:yn.a.string,lockOffset:yn.a.oneOfType([yn.a.number,yn.a.string,yn.a.arrayOf(yn.a.oneOfType([yn.a.number,yn.a.string]))]),lockToContainerEdges:yn.a.bool,onSortEnd:yn.a.func,onSortMove:yn.a.func,onSortOver:yn.a.func,onSortStart:yn.a.func,pressDelay:yn.a.number,pressThreshold:yn.a.number,keyCodes:yn.a.shape({lift:yn.a.arrayOf(yn.a.number),drop:yn.a.arrayOf(yn.a.number),cancel:yn.a.arrayOf(yn.a.number),up:yn.a.arrayOf(yn.a.number),down:yn.a.arrayOf(yn.a.number)}),shouldCancelStart:yn.a.func,transitionDuration:yn.a.number,updateBeforeSortStart:yn.a.func,useDragHandle:yn.a.bool,useWindowAsScrollContainer:yn.a.bool},ir={lift:[zn],drop:[zn],cancel:[Un],up:[Gn,Bn],down:[Kn,Yn]},ar={axis:"y",disableAutoscroll:!1,distance:0,getHelperDimensions:function(e){var t=e.node;return{height:t.offsetHeight,width:t.offsetWidth}},hideSortableGhost:!0,lockOffset:"50%",lockToContainerEdges:!1,pressDelay:0,pressThreshold:5,keyCodes:ir,shouldCancelStart:function(e){return-1!==[Qn,Jn,er,Zn,Xn].indexOf(e.target.tagName)||!!In(e.target,(function(e){return"true"===e.contentEditable}))},transitionDuration:300,useWindowAsScrollContainer:!1},sr=Object.keys(or);function lr(e){gn()(!(e.distance&&e.pressDelay),"Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time.")}function cr(e,t){try{var n=e()}catch(r){return t(!0,r)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,value)}var ur=Object(o.createContext)({manager:{}});var pr={index:yn.a.number.isRequired,collection:yn.a.oneOfType([yn.a.number,yn.a.string]),disabled:yn.a.bool},fr=Object.keys(pr);var dr=n(21);const{MultiValue:hr}=ft;const vr={MultiValue:function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return n=t=function(t){function n(){var e,t;te(this,n);for(var r=arguments.length,i=new Array(r),a=0;a0&&void 0!==arguments[0]?arguments[0]:this.props.collection;this.context.manager.remove(e,this.ref)}},{key:"getWrappedInstance",value:function(){return gn()(r.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call"),this.wrappedInstance.current}},{key:"render",value:function(){var t=r.withRef?this.wrappedInstance:null;return Object(o.createElement)(e,X({ref:t},xn(this.props,fr)))}}]),n}(o.Component),ee(t,"displayName",Rn("sortableElement",e)),ee(t,"contextType",ur),ee(t,"propTypes",pr),ee(t,"defaultProps",{collection:0}),n}((e=>{const t={onMouseDown(e){e.preventDefault(),e.stopPropagation()}};return i.a.createElement(hr,Object.assign({},e,{innerProps:t}))}))},mr=e=>e.length>=2,gr=Object(dr.__)("Select authors\u2026","authorship"),br="authorship-select-container",yr="authorship-select",Or=e=>i.a.createElement(i.a.Fragment,null,e.avatar&&i.a.createElement("div",{className:"authorship-select__multi-value__avatar"},i.a.createElement("img",{alt:"",src:e.avatar})),i.a.createElement("div",null,e.label));var wr=function(e){var t,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return n=t=function(t){function n(e){var t;te(this,n),ee(oe(oe(t=le(this,ce(n).call(this,e)))),"state",{}),ee(oe(oe(t)),"handleStart",(function(e){var n=t.props,r=n.distance,o=n.shouldCancelStart;if(2!==e.button&&!o(e)){t.touched=!0,t.position=jn(e);var i=In(e.target,(function(e){return null!=e.sortableInfo}));if(i&&i.sortableInfo&&t.nodeIsChild(i)&&!t.state.sorting){var a=t.props.useDragHandle,s=i.sortableInfo,l=s.index,c=s.collection;if(s.disabled)return;if(a&&!In(e.target,nr))return;t.manager.active={collection:c,index:l},Ln(e)||e.target.tagName!==$n||e.preventDefault(),r||(0===t.props.pressDelay?t.handlePress(e):t.pressTimer=setTimeout((function(){return t.handlePress(e)}),t.props.pressDelay))}}})),ee(oe(oe(t)),"nodeIsChild",(function(e){return e.sortableInfo.manager===t.manager})),ee(oe(oe(t)),"handleMove",(function(e){var n=t.props,r=n.distance,o=n.pressThreshold;if(!t.state.sorting&&t.touched&&!t._awaitingUpdateBeforeSortStart){var i=jn(e),a={x:t.position.x-i.x,y:t.position.y-i.y},s=Math.abs(a.x)+Math.abs(a.y);t.delta=a,r||o&&!(s>=o)?r&&s>=r&&t.manager.isActive()&&t.handlePress(e):(clearTimeout(t.cancelTimer),t.cancelTimer=setTimeout(t.cancel,0))}})),ee(oe(oe(t)),"handleEnd",(function(){t.touched=!1,t.cancel()})),ee(oe(oe(t)),"cancel",(function(){var e=t.props.distance;t.state.sorting||(e||clearTimeout(t.pressTimer),t.manager.active=null)})),ee(oe(oe(t)),"handlePress",(function(e){try{var n=t.manager.getActive(),r=function(){if(n){var r=function(){var n=f.sortableInfo.index,r=An(f),o=Wn(t.container),c=t.scrollContainer.getBoundingClientRect(),v=a({index:n,node:f,collection:d});if(t.node=f,t.margin=r,t.gridGap=o,t.width=v.width,t.height=v.height,t.marginOffset={x:t.margin.left+t.margin.right+t.gridGap.x,y:Math.max(t.margin.top,t.margin.bottom,t.gridGap.y)},t.boundingClientRect=f.getBoundingClientRect(),t.containerBoundingRect=c,t.index=n,t.newIndex=n,t.axis={x:i.indexOf("x")>=0,y:i.indexOf("y")>=0},t.offsetEdge=Vn(f,t.container),t.initialOffset=jn(h?vn({},e,{pageX:t.boundingClientRect.left,pageY:t.boundingClientRect.top}):e),t.initialScroll={left:t.scrollContainer.scrollLeft,top:t.scrollContainer.scrollTop},t.initialWindowScroll={left:window.pageXOffset,top:window.pageYOffset},t.helper=t.helperContainer.appendChild(tr(f)),kn(t.helper,{boxSizing:"border-box",height:"".concat(t.height,"px"),left:"".concat(t.boundingClientRect.left-r.left,"px"),pointerEvents:"none",position:"fixed",top:"".concat(t.boundingClientRect.top-r.top,"px"),width:"".concat(t.width,"px")}),h&&t.helper.focus(),l&&(t.sortableGhost=f,kn(f,{opacity:0,visibility:"hidden"})),t.minTranslate={},t.maxTranslate={},h){var m=p?{top:0,left:0,width:t.contentWindow.innerWidth,height:t.contentWindow.innerHeight}:t.containerBoundingRect,g=m.top,b=m.left,y=m.width,O=g+m.height,w=b+y;t.axis.x&&(t.minTranslate.x=b-t.boundingClientRect.left,t.maxTranslate.x=w-(t.boundingClientRect.left+t.width)),t.axis.y&&(t.minTranslate.y=g-t.boundingClientRect.top,t.maxTranslate.y=O-(t.boundingClientRect.top+t.height))}else t.axis.x&&(t.minTranslate.x=(p?0:c.left)-t.boundingClientRect.left-t.width/2,t.maxTranslate.x=(p?t.contentWindow.innerWidth:c.left+c.width)-t.boundingClientRect.left-t.width/2),t.axis.y&&(t.minTranslate.y=(p?0:c.top)-t.boundingClientRect.top-t.height/2,t.maxTranslate.y=(p?t.contentWindow.innerHeight:c.top+c.height)-t.boundingClientRect.top-t.height/2);s&&s.split(" ").forEach((function(e){return t.helper.classList.add(e)})),t.listenerNode=e.touches?e.target:t.contentWindow,h?(t.listenerNode.addEventListener("wheel",t.handleKeyEnd,!0),t.listenerNode.addEventListener("mousedown",t.handleKeyEnd,!0),t.listenerNode.addEventListener("keydown",t.handleKeyDown)):(Sn.move.forEach((function(e){return t.listenerNode.addEventListener(e,t.handleSortMove,!1)})),Sn.end.forEach((function(e){return t.listenerNode.addEventListener(e,t.handleSortEnd,!1)}))),t.setState({sorting:!0,sortingIndex:n}),u&&u({node:f,index:n,collection:d,isKeySorting:h,nodes:t.manager.getOrderedRefs(),helper:t.helper},e),h&&t.keyMove(0)},o=t.props,i=o.axis,a=o.getHelperDimensions,s=o.helperClass,l=o.hideSortableGhost,c=o.updateBeforeSortStart,u=o.onSortStart,p=o.useWindowAsScrollContainer,f=n.node,d=n.collection,h=t.manager.isKeySorting,v=function(){if("function"===typeof c){t._awaitingUpdateBeforeSortStart=!0;var n=cr((function(){var t=f.sortableInfo.index;return Promise.resolve(c({collection:d,index:t,node:f,isKeySorting:h},e)).then((function(){}))}),(function(e,n){if(t._awaitingUpdateBeforeSortStart=!1,e)throw n;return n}));if(n&&n.then)return n.then((function(){}))}}();return v&&v.then?v.then(r):r()}}();return Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(o){return Promise.reject(o)}})),ee(oe(oe(t)),"handleSortMove",(function(e){var n=t.props.onSortMove;"function"===typeof e.preventDefault&&e.cancelable&&e.preventDefault(),t.updateHelperPosition(e),t.animateNodes(),t.autoscroll(),n&&n(e)})),ee(oe(oe(t)),"handleSortEnd",(function(e){var n=t.props,r=n.hideSortableGhost,o=n.onSortEnd,i=t.manager,a=i.active.collection,s=i.isKeySorting,l=t.manager.getOrderedRefs();t.listenerNode&&(s?(t.listenerNode.removeEventListener("wheel",t.handleKeyEnd,!0),t.listenerNode.removeEventListener("mousedown",t.handleKeyEnd,!0),t.listenerNode.removeEventListener("keydown",t.handleKeyDown)):(Sn.move.forEach((function(e){return t.listenerNode.removeEventListener(e,t.handleSortMove)})),Sn.end.forEach((function(e){return t.listenerNode.removeEventListener(e,t.handleSortEnd)})))),t.helper.parentNode.removeChild(t.helper),r&&t.sortableGhost&&kn(t.sortableGhost,{opacity:"",visibility:""});for(var c=0,u=l.length;cr)){t.prevIndex=i,t.newIndex=o;var a=Nn(t.newIndex,t.prevIndex,t.index),s=n.find((function(e){return e.node.sortableInfo.index===a})),l=s.node,c=t.containerScrollDelta,u=s.boundingClientRect||Mn(l,c),p=s.translate||{x:0,y:0},f=u.top+p.y-c.top,d=u.left+p.x-c.left,h=im?m/2:this.height/2,width:this.width>v?v/2:this.width/2},b=c&&h>this.index&&h<=u,y=c&&h=u,O={x:0,y:0},w=a[p].edgeOffset;w||(w=Vn(d,this.container),a[p].edgeOffset=w,c&&(a[p].boundingClientRect=Mn(d,o)));var x=p0&&a[p-1];x&&!x.edgeOffset&&(x.edgeOffset=Vn(x.node,this.container),c&&(x.boundingClientRect=Mn(x.node,o))),h!==this.index?(t&&Pn(d,t),this.axis.x?this.axis.y?y||hthis.containerBoundingRect.width-g.width&&x&&(O.x=x.edgeOffset.left-w.left,O.y=x.edgeOffset.top-w.top),null===this.newIndex&&(this.newIndex=h)):(b||h>this.index&&(s+i.left+g.width>=w.left&&l+i.top+g.height>=w.top||l+i.top+g.height>=w.top+m))&&(O.x=-(this.width+this.marginOffset.x),w.left+O.xthis.index&&s+i.left+g.width>=w.left?(O.x=-(this.width+this.marginOffset.x),this.newIndex=h):(y||hthis.index&&l+i.top+g.height>=w.top?(O.y=-(this.height+this.marginOffset.y),this.newIndex=h):(y||hi.a.createElement(hn,Object.assign({cacheOptions:!0,className:br,classNamePrefix:yr,components:vr,formatOptionLabel:Or,isClearable:!1,isMulti:!0,isValidNewOption:mr,placeholder:gr},e))));const xr=e=>{var t;return{value:e.id,label:e.name,avatar:(null===(t=null===e||void 0===e?void 0:e.avatar_urls)||void 0===t?void 0:t[48])||null}},Sr=()=>document.querySelector(".authorship-select-container");var Cr=Object(u.compose)([Object(p.withDispatch)((e=>({onError(t){e("core/notices").createErrorNotice(t)},onUpdate(t){e("core/editor").editPost({authorship:t})}}))),Object(p.withSelect)((e=>({currentAuthorIDs:e("core/editor").getEditedPostAttribute("authorship"),postType:e("core/editor").getCurrentPostType(),preloadedAuthorOptions:authorshipData,hasAssignAuthorAction:Boolean(Object(s.get)(e("core/editor").getCurrentPost(),["_links","authorship:action-assign-authorship"],!1))})))])((e=>{const{currentAuthorIDs:t,hasAssignAuthorAction:n,onError:r,onUpdate:a,postType:l,preloadedAuthorOptions:u}=e,p=!n,[d,h]=Object(o.useState)([]),v=u.authors.map((e=>e.value));if(!d.length&&Object(s.isEqual)(v,t))h(u.authors);else if(void 0!==t&&t.length&&!d.length){const e=Object(f.addQueryArgs)("/authorship/v1/users/",{include:t,orderby:"include",post_type:l});c()({path:e}).then((e=>{h(e.map(xr))})).catch((e=>{r(e.message)}))}return i.a.createElement(wr,{axis:"y",distance:4,helperContainer:Sr,isDisabled:p,loadOptions:e=>{const t=Object(f.addQueryArgs)("/authorship/v1/users/",{search:e,post_type:l});return c()({path:t}).then((e=>e.map(xr))).catch((e=>(r(e.message),[])))},lockAxis:"y",lockToContainerEdges:!0,styles:{input:()=>({margin:0,width:"100%"})},value:d,onChange:e=>{h(e||[]),a(e?e.map((e=>e.value)):[])},onCreateOption:e=>{const t=Object(f.addQueryArgs)("/authorship/v1/users/",{name:e});return c()({method:"POST",path:t}).then((e=>{const t=[...d,xr(e)];h(t),a(t.map((e=>e.value)))})).catch((e=>{r(e.message)}))},onSortEnd:e=>{const t=(n=d,r=e.oldIndex,o=e.newIndex,(n=n.slice()).splice(o<0?n.length+o:o,0,n.splice(r,1)[0]),n);var n,r,o;h(t),a(t.map((e=>e.value)))}})}));const kr={icon:null,render:()=>i.a.createElement(a.PluginPostStatusInfo,null,i.a.createElement(Cr,null))};Object(r.registerPlugin)("authorship",kr)}]); \ No newline at end of file diff --git a/build/src/components/AuthorsSelect.d.ts b/build/src/components/AuthorsSelect.d.ts new file mode 100644 index 0000000..7f8537c --- /dev/null +++ b/build/src/components/AuthorsSelect.d.ts @@ -0,0 +1,3 @@ +declare const _default: any; +export default _default; +//# sourceMappingURL=AuthorsSelect.d.ts.map \ No newline at end of file diff --git a/build/src/components/AuthorsSelect.d.ts.map b/build/src/components/AuthorsSelect.d.ts.map new file mode 100644 index 0000000..5660200 --- /dev/null +++ b/build/src/components/AuthorsSelect.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"AuthorsSelect.d.ts","sourceRoot":"","sources":["../../../src/components/AuthorsSelect.tsx"],"names":[],"mappings":";AA4MA,wBAGqB"} \ No newline at end of file diff --git a/build/src/components/SortableMultiValueElement.d.ts b/build/src/components/SortableMultiValueElement.d.ts new file mode 100644 index 0000000..6d08ccc --- /dev/null +++ b/build/src/components/SortableMultiValueElement.d.ts @@ -0,0 +1,21 @@ +import React, { ReactElement } from 'react'; +import { MultiValueProps } from 'react-select'; +import { Option } from '../types'; +declare const MultiValueElement: (props: MultiValueProps