/*!
 * 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,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return r(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SliderEditor=void 0;const i=a(n(9497)),u=a(n(23)),s=l(n(232)),c=l(n(5309)),d=l(n(2782)),p=l(n(4008)),f=n(6801),b=n(5592),m={flexBasis:92,flexGrow:0,flexShrink:0},v=(0,s.default)(c.default)`
    div:has(> [data-test='bar']) {
        min-width: 0;
    }
`,h=Object.assign(Object.assign({},f.BaseEditorPropTypes),{help:u.string,max:u.number,maxLabel:u.oneOfType([u.element,u.string]),min:u.number,minLabel:u.oneOfType([u.element,u.string]),step:u.number,stepMarks:u.oneOf(["focus","always","none"]),value:u.number,defaultValue:u.number});t.SliderEditor=({help:e,isDisabled:t=!1,label:n,labelPosition:o="top",labelWidth:r,max:a,maxLabel:l=null,min:u,minLabel:s=null,name:c,onChange:f,step:h,stepMarks:g="focus",value:y=null,defaultValue:_})=>{const O=i.useCallback(((e,{value:t})=>{(parseFloat(t)||0===t)&&f(e,c,t)}),[f,c]),x=i.useCallback(((e,t)=>{(parseFloat(t)||0===t)&&f(e,c,t)}),[f,c]),{currentValue:C,handleChange:k,handleBlur:j,handleFocus:P,handleKeyPress:E}=(0,b.useNumberInput)({value:y,min:u,max:a,defaultValue:_,onValueChange:x}),M=null!=C?Number(C):void 0,B="none"===g?"never":g;return i.createElement(p.default,{label:n,labelPosition:o,labelWidth:r,help:e},i.createElement(v,{"data-test":c,min:u,minLabel:s,max:a,maxLabel:l,step:h,stepMarks:B,value:M,disabled:t,onChange:O}),i.createElement(d.default,{inline:!0,min:u,max:a,step:h,onChange:k,onBlur:j,onFocus:P,onKeyDown:E,value:M,disabled:t,style:m}))},t.SliderEditor.propTypes=h,t.default=t.SliderEditor},5592:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.useNumberInput=void 0;const o=n(9497),r=n(4793);t.useNumberInput=({min:e=Number.NEGATIVE_INFINITY,max:t=Number.POSITIVE_INFINITY,value:n,defaultValue:a,onValueChange:l=r.noop})=>{const[i,u]=(0,o.useState)(n),s=(0,o.useRef)(!1),c=(0,o.useCallback)(((e,t)=>{null==t&&u(null!=a?a:n),l(e,t)}),[a,l,n]),d=(0,o.useMemo)((()=>(0,r.debounce)(((e,t)=>c(e,t.value)),250)),[c]);(0,o.useLayoutEffect)((()=>{u(n)}),[n]);return{handleChange:(0,o.useCallback)(((e,t)=>{u(t.value),s.current||d(e,t)}),[d]),handleBlur:(0,o.useCallback)((e=>{s.current=!1,n!==i&&c(e,i)}),[i,c,n]),handleFocus:(0,o.useCallback)((()=>{s.current=!0}),[]),handleKeyPress:(0,o.useCallback)((o=>{var a;if("string"==typeof o.key&&"enter"===o.key.toLowerCase()){const l=null===(a=o.target)||void 0===a?void 0:a.value,i=l?Number(l):void 0,u="number"==typeof i?(0,r.clamp)(i,e,t):void 0;n!==u&&c(o,u)}"string"==typeof o.key&&"escape"===o.key.toLowerCase()&&u(n)}),[c,n,e,t]),currentValue:i}}},6801:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseEditorPropTypes=void 0;const l=a(n(23));t.BaseEditorPropTypes={name:l.string.isRequired,value:l.oneOfType([l.string,l.object,l.arrayOf(l.string)]),context:l.object,label:l.string,labelPosition:l.oneOf(["top","left"]),labelWidth:l.number,onChange:l.func,isAdvanced:l.bool,isDisabled:l.bool,dataSourceBindings:l.object,options:l.object,optionsSchema:l.object}},4008:function(e,t,n){var o=this&&this.__createBinding||(Object.create?function(e,t,n,o){void 0===o&&(o=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,o,r)}:function(e,t,n,o){void 0===o&&(o=n),e[o]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return r(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdvancedConfigButton=void 0;const i=a(n(9497)),u=a(n(23)),s=l(n(232)),c=n(6649),d=l(n(6643)),p=n(3563),f=l(n(6379)),b=l(n(7020)),m=l(n(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,c._)("Advanced configurations")},i.default.createElement(g,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(d.default,{"data-test":`${e}-advanced-config-button-icon`}),appearance:"subtle",onClick:t}));const y=({"data-test":e,children:n,isAdvanced:o=!1,label:r,hideLabel:a,labelPosition:l,labelWidth:u,tooltip:s,help:c,style:d,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:m})=>i.default.createElement(v,{"data-test":null!=e?e:"control-group",label:r,hideLabel:a,labelPosition:l,labelWidth:u,tooltip:s,help:c,error:p,style:d,onClick:b,controlsLayout:f},o?i.Children.toArray(n).filter(Boolean).map((e=>(0,i.cloneElement)(e,{style:{flex:1}}))):n,o?i.default.createElement(t.AdvancedConfigButton,{label:r,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 n=function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o].call(a.exports,a,a.exports,n),a.exports}(148);module.exports=n})();
//# sourceMappingURL=SliderEditor.js.map