/*!
 * Copyright © 2018 Splunk Inc.
 * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
 * in part without a valid written license from Splunk Inc. is PROHIBITED.
 */(()=>{"use strict";var e={148:function(e,t,l){var a=this&&this.__createBinding||(Object.create?function(e,t,l,a){void 0===a&&(a=l);var n=Object.getOwnPropertyDescriptor(t,l);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[l]}}),Object.defineProperty(e,a,n)}:function(e,t,l,a){void 0===a&&(a=l),e[a]=t[l]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var l in e)"default"!==l&&Object.prototype.hasOwnProperty.call(e,l)&&a(t,e,l);return n(t,e),t},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SliderEditor=void 0;const i=o(l(9497)),u=r(l(232)),s=r(l(5309)),d=r(l(2782)),c=r(l(4008)),p=l(5592),f={flexBasis:92,flexGrow:0,flexShrink:0},b=(0,u.default)(s.default)`
    div:has(> [data-test='bar']) {
        min-width: 0;
    }
`;t.SliderEditor=({help:e,isDisabled:t=!1,label:l,labelPosition:a="top",labelWidth:n,max:o,maxLabel:r=null,min:u,minLabel:s=null,name:m,onChange:v,step:h,stepMarks:g="focus",value:y=null,defaultValue:_})=>{const C=i.useCallback(((e,{value:t})=>{(parseFloat(t)||0===t)&&v(e,m,t)}),[v,m]),x=i.useCallback(((e,t)=>{(parseFloat(t)||0===t)&&v(e,m,t)}),[v,m]),{currentValue:k,handleChange:O,handleBlur:P,handleFocus:j,handleKeyPress:E}=(0,p.useNumberInput)({value:y,min:u,max:o,defaultValue:_,onValueChange:x}),M=null!=k?Number(k):void 0,w="none"===g?"never":g;return i.createElement(c.default,{label:l,labelPosition:a,labelWidth:n,help:e},i.createElement(b,{"data-test":m,min:u,minLabel:s,max:o,maxLabel:r,step:h,stepMarks:w,value:M,disabled:t,onChange:C}),i.createElement(d.default,{inline:!0,min:u,max:o,step:h,onChange:O,onBlur:P,onFocus:j,onKeyDown:E,value:M,disabled:t,style:f}))},t.default=t.SliderEditor},5592:(e,t,l)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useNumberInput=void 0;const a=l(9497),n=l(4793);t.useNumberInput=({min:e=Number.NEGATIVE_INFINITY,max:t=Number.POSITIVE_INFINITY,value:l,defaultValue:o,onValueChange:r=n.noop})=>{const[i,u]=(0,a.useState)(l),s=(0,a.useRef)(!1),d=(0,a.useCallback)(((e,t)=>{null==t&&u(null!=o?o:l),r(e,t)}),[o,r,l]),c=(0,a.useMemo)((()=>(0,n.debounce)(((e,t)=>d(e,t.value)),250)),[d]);(0,a.useLayoutEffect)((()=>{u(l)}),[l]);return{handleChange:(0,a.useCallback)(((e,t)=>{u(t.value),s.current||c(e,t)}),[c]),handleBlur:(0,a.useCallback)((e=>{s.current=!1,l!==i&&d(e,i)}),[i,d,l]),handleFocus:(0,a.useCallback)((()=>{s.current=!0}),[]),handleKeyPress:(0,a.useCallback)((a=>{var o;if("string"==typeof a.key&&"enter"===a.key.toLowerCase()){const r=null===(o=a.target)||void 0===o?void 0:o.value,i=r?Number(r):void 0,u="number"==typeof i?(0,n.clamp)(i,e,t):void 0;l!==u&&d(a,u)}"string"==typeof a.key&&"escape"===a.key.toLowerCase()&&u(l)}),[d,l,e,t]),currentValue:i}}},4008:function(e,t,l){var a=this&&this.__createBinding||(Object.create?function(e,t,l,a){void 0===a&&(a=l);var n=Object.getOwnPropertyDescriptor(t,l);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[l]}}),Object.defineProperty(e,a,n)}:function(e,t,l,a){void 0===a&&(a=l),e[a]=t[l]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var l in e)"default"!==l&&Object.prototype.hasOwnProperty.call(e,l)&&a(t,e,l);return n(t,e),t},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdvancedConfigButton=void 0;const i=o(l(9497)),u=o(l(23)),s=r(l(232)),d=l(6649),c=r(l(6643)),p=l(3563),f=r(l(6379)),b=r(l(7020)),m=r(l(9250)),v=(0,s.default)(m.default)`
    margin-top: 0;
    padding: 0;
    // adjust bottom margin according to theme
    margin-bottom: ${p.variables.spacingMedium};
    width: 100%;

    // remove top margin of the first component in control group
    &:first-child {
        margin-top: 0;
    }

    // remove bottom margin of the last component in control group
    &:last-child {
        margin-bottom: 0;
    }
    // remove top padding on label of the first control group
    [data-test='label']:first-of-type {
        padding-top: 0;
    }
`,h=(0,s.default)(f.default)`
    display: flex;
    > span {
        display: flex;
        width: 35px;
    }
`,g=(0,s.default)(b.default)`
    color: ${p.variables.contentColorActive} !important;
    &:hover {
        background-color: ${p.variables.interactiveColorOverlayDrag} !important;
    }
`;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(h,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,d._)("Advanced configurations")},i.default.createElement(g,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(c.default,{"data-test":`${e}-advanced-config-button-icon`}),appearance:"subtle",onClick:t}));const y=({"data-test":e,children:l,isAdvanced:a=!1,label:n,hideLabel:o,labelPosition:r,labelWidth:u,tooltip:s,help:d,style:c,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:m})=>i.default.createElement(v,{"data-test":null!=e?e:"control-group",label:n,hideLabel:o,labelPosition:r,labelWidth:u,tooltip:s,help:d,error:p,style:c,onClick:b,controlsLayout:f},a?i.Children.toArray(l).filter(Boolean).map((e=>(0,i.cloneElement)(e,{style:{flex:1}}))):l,a?i.default.createElement(t.AdvancedConfigButton,{label:n,onClick:m}):null);y.propTypes={style:u.object,isAdvanced:u.bool,onClick:u.func,onAdvancedConfigButtonClick:u.func},t.default=y},6643:e=>{e.exports=require("@splunk/react-icons/SlidersDoubleHorizontal")},7020:e=>{e.exports=require("@splunk/react-ui/Button")},9250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},2782:e=>{e.exports=require("@splunk/react-ui/Number")},5309:e=>{e.exports=require("@splunk/react-ui/Slider")},6379:e=>{e.exports=require("@splunk/react-ui/Tooltip")},3563:e=>{e.exports=require("@splunk/themes")},6649:e=>{e.exports=require("@splunk/ui-utils/i18n")},4793:e=>{e.exports=require("lodash")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};var l=function l(a){var n=t[a];if(void 0!==n)return n.exports;var o=t[a]={exports:{}};return e[a].call(o.exports,o,o.exports,l),o.exports}(148);module.exports=l})();
//# sourceMappingURL=SliderEditor.js.map