/*!
 * 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={2166:(e,t,l)=>{l.r(t),l.d(t,{hasTokens:()=>n});const a=new RegExp(/\$/.source+/(\w+:)?/.source+/([^$|:]+?)(\|[|\w]+)?/.source+/\$/.source),n=e=>"string"==typeof e&&a.test(e)},2749: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}),r=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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(l(9497)),u=o(l(232)),d=o(l(5777)),c=o(l(8631)),s=o(l(6379)),p=l(3563),f=o(l(451)),b=l(2166),m=o(l(4008)),h=(0,u.default)(s.default)`
    float: right;
    [data-test='clickable'] {
        padding-block: 0;
    }
`,g=(0,u.default)(d.default)`
    padding-block: 0;

    ${({hasChip:e})=>e&&"\n        display: inline-flex;\n        align-items: center;\n        label {\n            display: inline-flex;\n            align-items: center;\n            vertical-align: middle;\n        }\n    "}
`,v=u.default.div`
    margin-top: ${p.variables.spacingXSmall};
    color: ${p.variables.contentColorDefault};
    font-size: ${p.variables.fontSizeSmall};
`,y=(0,u.default)(c.default)`
    margin-left: auto;
`,_=u.default.span`
    display: inline-flex;
    align-items: center;
    min-height: ${p.variables.inputHeight};
    line-height: 0;
`,x=(e,t)=>t?[e.find((e=>e!==t)),t]:e;t.default=({help:e,helpFormat:t="tooltip",onChange:l,name:a,value:n,values:r,itemSchema:o,variantForSelectedState:u,labelPosition:d="right",labelWidth:c,label:s,appearance:p="checkbox",isDisabled:k=!1,helpTextLink:C,chipText:O})=>{const E=(0,b.hasTokens)(n)||k;let j;if(Array.isArray(r)&&2===r.length)j=x(r.map((e=>e.value)),u);else if(Array.isArray(o.enum)&&2===o.enum.length)j=x(o.enum,u);else{if("boolean"!==o.type)throw Error(`No valid values provided to CheckboxEditor: ${JSON.stringify(o)}`);j=[!1,!0]}const P=(0,i.useCallback)((e=>l(e,a,n===j[1]?j[0]:j[1])),[l,j,a,n]);return"right"===d?i.default.createElement(i.default.Fragment,null,i.default.createElement(g,{"data-test":a,disabled:E,value:a,onClick:P,selected:n===j[1],appearance:p,hasChip:!!O},i.default.createElement(_,null,s),O&&i.default.createElement(y,{"data-test":"beta-chip"},O),e&&"tooltip"===t&&i.default.createElement(h,{content:e})),e&&"under"===t&&i.default.createElement(v,null,e," ",(null==C?void 0:C.label)&&i.default.createElement(i.default.Fragment,null,i.default.createElement("br",null),i.default.createElement(f.default,{"data-test":"help-text-link",to:(null==C?void 0:C.href)||null},C.label)))):i.default.createElement(m.default,{label:s,labelPosition:d,labelWidth:c,tooltip:e},i.default.createElement(g,{"data-test":a,disabled:E,value:a,onClick:P,selected:n===j[1],appearance:p}))}},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}),r=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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.AdvancedConfigButton=void 0;const i=r(l(9497)),u=r(l(23)),d=o(l(232)),c=l(6649),s=o(l(6643)),p=l(3563),f=o(l(6379)),b=o(l(7020)),m=o(l(9250)),h=(0,d.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;
    }
`,g=(0,d.default)(f.default)`
    display: flex;
    > span {
        display: flex;
        width: 35px;
    }
`,v=(0,d.default)(b.default)`
    color: ${p.variables.contentColorActive} !important;
    &:hover {
        background-color: ${p.variables.interactiveColorOverlayDrag} !important;
    }
`;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(g,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,c._)("Advanced configurations")},i.default.createElement(v,{"data-test":`${e}-advanced-config-button`,icon:i.default.createElement(s.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:r,labelPosition:o,labelWidth:u,tooltip:d,help:c,style:s,error:p,controlsLayout:f,onClick:b,onAdvancedConfigButtonClick:m})=>i.default.createElement(h,{"data-test":null!=e?e:"control-group",label:n,hideLabel:r,labelPosition:o,labelWidth:u,tooltip:d,help:c,error:p,style:s,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},2649:e=>{e.exports=require("@babel/runtime/helpers/extends")},6643:e=>{e.exports=require("@splunk/react-icons/SlidersDoubleHorizontal")},7020:e=>{e.exports=require("@splunk/react-ui/Button")},8631:e=>{e.exports=require("@splunk/react-ui/Chip")},9250:e=>{e.exports=require("@splunk/react-ui/ControlGroup")},451:e=>{e.exports=require("@splunk/react-ui/Link")},5777:e=>{e.exports=require("@splunk/react-ui/Switch")},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")},23:e=>{e.exports=require("prop-types")},9497:e=>{e.exports=require("react")},232:e=>{e.exports=require("styled-components")}},t={};function l(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a].call(r.exports,r,r.exports,l),r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var a in t)l.o(t,a)&&!l.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{l.r(a),l.d(a,{default:()=>u});var e=l(2649),t=l.n(e),n=l(9497),r=l.n(n),o=l(2749),i=l.n(o);const u=e=>r().createElement(i(),t()({},e,{appearance:"toggle"}))})(),module.exports=a})();
//# sourceMappingURL=ToggleEditor.js.map