import{K,u as G,h as m}from"./OdysseyThemeProvider-Bh0Bu-2o.js";import{r as c}from"./index-NdkWRN8K.js";import{a as J,j as q}from"./Typography-Cz6D417Y.js";import{u as Q,M as U}from"./useAutocomplete-BRetTkpF.js";import{j as t}from"./jsx-runtime-CnH95YSl.js";import{A as X}from"./Autocomplete-CxtGbb8j.js";const ye=["small","large"],Y=({ariaDescribedBy:e,defaultValue:o,emptyOptionsText:s,errorMessage:n,errorMessageList:a,getIsOptionEqualToValue:i,getOptionLabel:f,groupOptionsBy:b,hasMultipleChoices:p,id:x,inputValue:O,isCustomValueAllowed:j,isDisabled:u,isFullWidth:y=!1,isLoading:k,isOptional:D=!1,isReadOnly:T,isVirtualized:C=!1,hint:P,HintLinkComponent:M,label:V,name:I,onBlur:L,onChange:S,onInputChange:z,onFocus:v,options:w,renderOption:F,renderTags:l,value:B,testId:d,translate:r})=>{const{t:h}=K(),{inputValueProp:g,isVirtualizedRef:A,renderInput:$,valueProps:W}=Q({ariaDescribedBy:e,defaultValue:o,errorMessage:n,errorMessageList:a,hasMultipleChoices:p,hint:P,HintLinkComponent:M,inputValue:O,isFullWidth:y,isOptional:D,isVirtualized:C,label:V,name:I,testId:d,value:B});return t.jsx(X,{...W,...g,...A.current&&{ListboxComponent:U},"aria-disabled":u,clearText:h("clear.text"),closeText:h("close.text"),disableCloseOnSelect:p,disabled:u,filterSelectedOptions:!0,freeSolo:j,fullWidth:y,getOptionLabel:f,groupBy:b,id:x,isOptionEqualToValue:i,loading:k,multiple:p,noOptionsText:s,onBlur:L,onChange:S,onFocus:v,onInputChange:z,options:w,readOnly:T,renderInput:$,renderOption:F,renderTags:l,translate:r})},H=c.memo(Y);H.displayName="ComposablePicker";/*!
 * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */const Z=m.li(({hasAdornment:e})=>({...!e&&{display:"block !important"}})),E=m("div",{shouldForwardProp:e=>e!=="odysseyDesignTokens"})(()=>({p:{margin:0}})),_=m("p",{shouldForwardProp:e=>e!=="odysseyDesignTokens"})(({odysseyDesignTokens:e})=>({margin:`${e.Spacing1} 0 0 !important`,color:e.TypographyColorSubordinate})),ee=m("div",{shouldForwardProp:e=>e!=="odysseyDesignTokens"})(({odysseyDesignTokens:e})=>({display:"flex",gap:e.Spacing3,marginBlockStart:e.Spacing2})),te=m("div",{shouldForwardProp:e=>e!=="odysseyDesignTokens"})(({odysseyDesignTokens:e})=>({display:"flex",alignItems:"center",gap:e.Spacing1,svg:{width:e.Spacing4,color:e.HueNeutral400}})),R=({children:e,hasAdornment:o=!1,muiProps:s})=>{const{key:n,...a}=s;return c.createElement(Z,{...a,hasAdornment:o,key:n},e)},oe=({metaData:e,odysseyDesignTokens:o})=>t.jsx(ee,{odysseyDesignTokens:o,children:e.map((s,n)=>{const{detailText:a,icon:i}=s;return t.jsxs(te,{odysseyDesignTokens:o,children:[i,a]},`${a}-${n}`)})}),N=({description:e,odysseyDesignTokens:o})=>e&&t.jsx(_,{odysseyDesignTokens:o,children:e}),se=({muiProps:e,odysseyDesignTokens:o,option:s})=>{const{label:n}=s;return t.jsx(R,{muiProps:e,children:t.jsx(E,{odysseyDesignTokens:o,children:t.jsx(J,{children:n})})})},ne=({muiProps:e,odysseyDesignTokens:o,option:s})=>{const{description:n,label:a}=s;return t.jsx(R,{muiProps:e,children:t.jsxs(E,{odysseyDesignTokens:o,children:[t.jsx(q,{component:"p",children:a}),t.jsx(N,{description:n,odysseyDesignTokens:o})]})})},ae=({muiProps:e,odysseyDesignTokens:o,option:s})=>{const{description:n,label:a,metaData:i}=s;return t.jsxs(R,{muiProps:e,children:[t.jsxs(E,{odysseyDesignTokens:o,children:[t.jsx(q,{component:"p",children:a}),t.jsx(N,{description:n,odysseyDesignTokens:o})]}),t.jsx(oe,{metaData:i,odysseyDesignTokens:o})]})},re=({ariaDescribedBy:e,defaultValue:o,emptyOptionsText:s,errorMessage:n,errorMessageList:a,getIsOptionEqualToValue:i,hasMultipleChoices:f,id:b,inputValue:p,isCustomValueAllowed:x,isDisabled:O,isFullWidth:j=!1,isLoading:u,isOptional:y=!1,isReadOnly:k,isVirtualized:D=!1,hint:T,HintLinkComponent:C,label:P,name:M,onBlur:V,onChange:I,onInputChange:L,onFocus:S,options:z,value:v,testId:w,translate:F})=>{const l=G(),B=c.useCallback((d,r)=>{const h="description"in r&&r.description,g="metaData"in r&&r.metaData,A=!g&&!h;return t.jsx(c.Fragment,{children:A?t.jsx(se,{muiProps:d,odysseyDesignTokens:l,option:r}):g?t.jsx(ae,{muiProps:d,odysseyDesignTokens:l,option:r}):t.jsx(ne,{muiProps:d,odysseyDesignTokens:l,option:r})},r.value)},[l]);return t.jsx(H,{ariaDescribedBy:e,defaultValue:o,emptyOptionsText:s,errorMessage:n,errorMessageList:a,getIsOptionEqualToValue:i,hasMultipleChoices:f,hint:T,HintLinkComponent:C,id:b,inputValue:p,isCustomValueAllowed:x,isDisabled:O,isFullWidth:j,isLoading:u,isOptional:y,isReadOnly:k,isVirtualized:D,label:P,name:M,onBlur:V,onChange:I,onFocus:S,onInputChange:L,options:z,renderOption:B,testId:w,translate:F,value:v})},ie=c.memo(re);ie.displayName="Picker";/*!
 * Copyright (c) 2021-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */const he={errorMessage:{control:"text",description:"If `error` is not undefined, the `input` will indicate an error",table:{type:{summary:"string"}}},errorMessageList:{description:"The list of error messages rendered at the bottom of the `error` message",table:{type:{summary:"array"}}},id:{control:"text",description:"The id of the `input` element.",table:{type:{summary:"string"}}},isDisabled:{control:"boolean",description:"If `true`, the component is disabled",table:{type:{summary:"boolean"},defaultValue:{summary:!1}}},isFullWidth:{control:"boolean",description:"If `true`, the component can stretch to fill the width of the container",table:{type:{summary:"boolean"},defaultValue:{summary:!1}}},isOptional:{control:"boolean",description:"If `true`, the `input` element is not required",table:{type:{summary:"boolean"},defaultValue:{summary:!1}}},isReadOnly:{control:"boolean",description:"It prevents the user from changing the value of the field",table:{type:{summary:"boolean"}}},name:{control:"text",description:"The name of the `input` element. Defaults to the `id` if not set.",table:{type:{summary:"string"}}}};export{ie as M,R as O,H as a,E as b,N as c,oe as d,ye as e,he as p};
