/*!
 * 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)),c=o(l(5777)),d=o(l(8631)),s=o(l(6379)),f=l(3563),p=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)(c.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: ${f.variables.spacingXSmall};
    color: ${f.variables.contentColorDefault};
    font-size: ${f.variables.fontSizeSmall};
`,y=(0,u.default)(d.default)`
    margin-left: auto;
`,_=u.default.span`
    display: inline-flex;
    align-items: center;
    min-height: ${f.variables.inputHeight};
    line-height: 0;
`,k=(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:c="right",labelWidth:d,label:s,appearance:f="checkbox",isDisabled:x=!1,helpTextLink:C,chipText:O})=>{const j=(0,b.hasTokens)(n)||x;let E;if(Array.isArray(r)&&2===r.length)E=k(r.map((e=>e.value)),u);else if(Array.isArray(o.enum)&&2===o.enum.length)E=k(o.enum,u);else{if("boolean"!==o.type)throw Error(`No valid values provided to CheckboxEditor: ${JSON.stringify(o)}`);E=[!1,!0]}const P=(0,i.useCallback)((e=>l(e,a,n===E[1]?E[0]:E[1])),[l,E,a,n]);return"right"===c?i.default.createElement(i.default.Fragment,null,i.default.createElement(g,{"data-test":a,disabled:j,value:a,onClick:P,selected:n===E[1],appearance:f,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(p.default,{"data-test":"help-text-link",to:(null==C?void 0:C.href)||null},C.label)))):i.default.createElement(m.default,{label:s,labelPosition:c,labelWidth:d,tooltip:e},i.default.createElement(g,{"data-test":a,disabled:j,value:a,onClick:P,selected:n===E[1],appearance:f}))}},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)),c=o(l(232)),d=l(6649),s=o(l(6643)),f=l(3563),p=o(l(6379)),b=o(l(7020)),m=o(l(9250)),h=(0,c.default)(m.default)`
    margin-top: 0;
    padding: 0;
    // adjust bottom margin according to theme
    margin-bottom: ${f.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,c.default)(p.default)`
    display: flex;
    > span {
        display: flex;
        width: 35px;
    }
`,v=(0,c.default)(b.default)`
    color: ${f.variables.contentColorActive} !important;
    &:hover {
        background-color: ${f.variables.interactiveColorOverlayDrag} !important;
    }
`;t.AdvancedConfigButton=({label:e="",onClick:t})=>i.default.createElement(g,{"data-test":`${e}-advanced-config-button-tooltip`,content:(0,d._)("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:c,help:d,style:s,error:f,controlsLayout:p,onClick:b,onAdvancedConfigButtonClick:m})=>i.default.createElement(h,{"data-test":null!=e?e:"control-group",label:n,hideLabel:r,labelPosition:o,labelWidth:u,tooltip:c,help:d,error:f,style:s,onClick:b,controlsLayout:p},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")},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.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(2749);module.exports=a})();
//# sourceMappingURL=CheckboxEditor.js.map