Files
aso/public/dashboard/assets/Autocomplete.9c94adb2.js
2023-02-15 10:47:39 +07:00

2 lines
21 KiB
JavaScript

import{aM as It,r as I,N as Ze,aN as Ne,aK as Ot,z as d,w as Ct,v as Pt,t as F,O as bt,bM as et,bN as Fe,bO as ut,bP as Ee,g as ht,bQ as mt,P as xt,V as tt,bR as $t,x as vt,f as v,bS as yt,bT as St,y as At,j as Me,D as ve,E as Lt}from"./index.eaf14aef.js";import{C as wt}from"./Chip.35ff2c8a.js";function ct(o){return typeof o.normalize<"u"?o.normalize("NFD").replace(/[\u0300-\u036f]/g,""):o}function Rt(o={}){const{ignoreAccents:r=!0,ignoreCase:f=!0,limit:y,matchFrom:E="any",stringify:D,trim:L=!1}=o;return(b,{inputValue:oe,getOptionLabel:j})=>{let w=L?oe.trim():oe;f&&(w=w.toLowerCase()),r&&(w=ct(w));const pe=w?b.filter(ue=>{let M=(D||j)(ue);return f&&(M=M.toLowerCase()),r&&(M=ct(M)),E==="start"?M.indexOf(w)===0:M.indexOf(w)>-1}):b;return typeof y=="number"?pe.slice(0,y):pe}}function ot(o,r){for(let f=0;f<o.length;f+=1)if(r(o[f]))return f;return-1}const Tt=Rt(),dt=5,kt=o=>{var r;return o.current!==null&&((r=o.current.parentElement)==null?void 0:r.contains(document.activeElement))};function Dt(o){const{unstable_isActiveElementInListbox:r=kt,unstable_classNamePrefix:f="Mui",autoComplete:y=!1,autoHighlight:E=!1,autoSelect:D=!1,blurOnSelect:L=!1,clearOnBlur:b=!o.freeSolo,clearOnEscape:oe=!1,componentName:j="useAutocomplete",defaultValue:w=o.multiple?[]:null,disableClearable:pe=!1,disableCloseOnSelect:ue=!1,disabled:M,disabledItemsFocusable:ze=!1,disableListWrap:He=!1,filterOptions:nt=Tt,filterSelectedOptions:ce=!1,freeSolo:Q=!1,getOptionDisabled:W,getOptionLabel:Ve=t=>{var e;return(e=t.label)!=null?e:t},groupBy:re,handleHomeEndKeys:We=!o.freeSolo,id:ne,includeInputInList:Be=!1,inputValue:rt,isOptionEqualToValue:J=(t,e)=>t===e,multiple:c=!1,onChange:de,onClose:fe,onHighlightChange:ye,onInputChange:B,onOpen:ge,open:_e,openOnFocus:at=!1,options:lt,readOnly:_=!1,selectOnFocus:Ue=!o.freeSolo,value:Ge}=o,$=It(ne);let U=Ve;U=t=>{const e=Ve(t);return typeof e!="string"?String(e):e};const be=I.exports.useRef(!1),he=I.exports.useRef(!0),O=I.exports.useRef(null),R=I.exports.useRef(null),[me,Ke]=I.exports.useState(null),[S,ae]=I.exports.useState(-1),Se=E?0:-1,T=I.exports.useRef(Se),[l,Ae]=Ze({controlled:Ge,default:w,name:j}),[u,X]=Ze({controlled:rt,default:"",name:j,state:"inputValue"}),[G,Le]=I.exports.useState(!1),le=I.exports.useCallback((t,e)=>{if(!(c?l.length<e.length:e!==null)&&!b)return;let a;if(c)a="";else if(e==null)a="";else{const p=U(e);a=typeof p=="string"?p:""}u!==a&&(X(a),B&&B(t,a,"reset"))},[U,u,c,B,X,b,l]),xe=I.exports.useRef();I.exports.useEffect(()=>{const t=l!==xe.current;xe.current=l,!(G&&!t)&&(Q&&!t||le(null,l))},[l,le,G,xe,Q]);const[Y,we]=Ze({controlled:_e,default:!1,name:j,state:"open"}),[qe,Re]=I.exports.useState(!0),Te=!c&&l!=null&&u===U(l),A=Y&&!_,g=A?nt(lt.filter(t=>!(ce&&(c?l:[l]).some(e=>e!==null&&J(t,e)))),{inputValue:Te&&qe?"":u,getOptionLabel:U}):[],Ie=Y&&g.length>0&&!_,se=Ne(t=>{t===-1?O.current.focus():me.querySelector(`[data-tag-index="${t}"]`).focus()});I.exports.useEffect(()=>{c&&S>l.length-1&&(ae(-1),se(-1))},[l,c,S,se]);function ie(t,e){if(!R.current||t===-1)return-1;let n=t;for(;;){if(e==="next"&&n===g.length||e==="previous"&&n===-1)return-1;const a=R.current.querySelector(`[data-option-index="${n}"]`),p=ze?!1:!a||a.disabled||a.getAttribute("aria-disabled")==="true";if(a&&!a.hasAttribute("tabindex")||p)n+=e==="next"?1:-1;else return n}}const K=Ne(({event:t,index:e,reason:n="auto"})=>{if(T.current=e,e===-1?O.current.removeAttribute("aria-activedescendant"):O.current.setAttribute("aria-activedescendant",`${$}-option-${e}`),ye&&ye(t,e===-1?null:g[e],n),!R.current)return;const a=R.current.querySelector(`[role="option"].${f}-focused`);a&&(a.classList.remove(`${f}-focused`),a.classList.remove(`${f}-focusVisible`));const p=R.current.parentElement.querySelector('[role="listbox"]');if(!p)return;if(e===-1){p.scrollTop=0;return}const C=R.current.querySelector(`[data-option-index="${e}"]`);if(!!C&&(C.classList.add(`${f}-focused`),n==="keyboard"&&C.classList.add(`${f}-focusVisible`),p.scrollHeight>p.clientHeight&&n!=="mouse")){const m=C,V=p.clientHeight+p.scrollTop,pt=m.offsetTop+m.offsetHeight;pt>V?p.scrollTop=pt-p.clientHeight:m.offsetTop-m.offsetHeight*(re?1.3:0)<p.scrollTop&&(p.scrollTop=m.offsetTop-m.offsetHeight*(re?1.3:0))}}),N=Ne(({event:t,diff:e,direction:n="next",reason:a="auto"})=>{if(!A)return;const C=ie((()=>{const m=g.length-1;if(e==="reset")return Se;if(e==="start")return 0;if(e==="end")return m;const V=T.current+e;return V<0?V===-1&&Be?-1:He&&T.current!==-1||Math.abs(e)>1?0:m:V>m?V===m+1&&Be?-1:He||Math.abs(e)>1?m:0:V})(),n);if(K({index:C,reason:a,event:t}),y&&e!=="reset")if(C===-1)O.current.value=u;else{const m=U(g[C]);O.current.value=m,m.toLowerCase().indexOf(u.toLowerCase())===0&&u.length>0&&O.current.setSelectionRange(u.length,m.length)}}),Z=I.exports.useCallback(()=>{if(!A)return;const t=c?l[0]:l;if(g.length===0||t==null){N({diff:"reset"});return}if(!!R.current){if(t!=null){const e=g[T.current];if(c&&e&&ot(l,a=>J(e,a))!==-1)return;const n=ot(g,a=>J(a,t));n===-1?N({diff:"reset"}):K({index:n});return}if(T.current>=g.length-1){K({index:g.length-1});return}K({index:T.current})}},[g.length,c?!1:l,ce,N,K,A,u,c]),je=Ne(t=>{Ot(R,t),t&&Z()});I.exports.useEffect(()=>{Z()},[Z]);const q=t=>{Y||(we(!0),Re(!0),ge&&ge(t))},z=(t,e)=>{!Y||(we(!1),fe&&fe(t,e))},H=(t,e,n,a)=>{if(c){if(l.length===e.length&&l.every((p,C)=>p===e[C]))return}else if(l===e)return;de&&de(t,e,n,a),Ae(e)},ee=I.exports.useRef(!1),h=(t,e,n="selectOption",a="options")=>{let p=n,C=e;if(c){C=Array.isArray(l)?l.slice():[];const m=ot(C,V=>J(e,V));m===-1?C.push(e):a!=="freeSolo"&&(C.splice(m,1),p="removeOption")}le(t,C),H(t,C,p,{option:e}),!ue&&(!t||!t.ctrlKey&&!t.metaKey)&&z(t,p),(L===!0||L==="touch"&&ee.current||L==="mouse"&&!ee.current)&&O.current.blur()};function x(t,e){if(t===-1)return-1;let n=t;for(;;){if(e==="next"&&n===l.length||e==="previous"&&n===-1)return-1;const a=me.querySelector(`[data-tag-index="${n}"]`);if(!a||!a.hasAttribute("tabindex")||a.disabled||a.getAttribute("aria-disabled")==="true")n+=e==="next"?1:-1;else return n}}const k=(t,e)=>{if(!c)return;u===""&&z(t,"toggleInput");let n=S;S===-1?u===""&&e==="previous"&&(n=l.length-1):(n+=e==="next"?1:-1,n<0&&(n=0),n===l.length&&(n=-1)),n=x(n,e),ae(n),se(n)},Qe=t=>{be.current=!0,X(""),B&&B(t,"","clear"),H(t,c?[]:null,"clear")},Je=t=>e=>{if(t.onKeyDown&&t.onKeyDown(e),!e.defaultMuiPrevented&&(S!==-1&&["ArrowLeft","ArrowRight"].indexOf(e.key)===-1&&(ae(-1),se(-1)),e.which!==229))switch(e.key){case"Home":A&&We&&(e.preventDefault(),N({diff:"start",direction:"next",reason:"keyboard",event:e}));break;case"End":A&&We&&(e.preventDefault(),N({diff:"end",direction:"previous",reason:"keyboard",event:e}));break;case"PageUp":e.preventDefault(),N({diff:-dt,direction:"previous",reason:"keyboard",event:e}),q(e);break;case"PageDown":e.preventDefault(),N({diff:dt,direction:"next",reason:"keyboard",event:e}),q(e);break;case"ArrowDown":e.preventDefault(),N({diff:1,direction:"next",reason:"keyboard",event:e}),q(e);break;case"ArrowUp":e.preventDefault(),N({diff:-1,direction:"previous",reason:"keyboard",event:e}),q(e);break;case"ArrowLeft":k(e,"previous");break;case"ArrowRight":k(e,"next");break;case"Enter":if(T.current!==-1&&A){const n=g[T.current],a=W?W(n):!1;if(e.preventDefault(),a)return;h(e,n,"selectOption"),y&&O.current.setSelectionRange(O.current.value.length,O.current.value.length)}else Q&&u!==""&&Te===!1&&(c&&e.preventDefault(),h(e,u,"createOption","freeSolo"));break;case"Escape":A?(e.preventDefault(),e.stopPropagation(),z(e,"escape")):oe&&(u!==""||c&&l.length>0)&&(e.preventDefault(),e.stopPropagation(),Qe(e));break;case"Backspace":if(c&&!_&&u===""&&l.length>0){const n=S===-1?l.length-1:S,a=l.slice();a.splice(n,1),H(e,a,"removeOption",{option:l[n]})}break;case"Delete":if(c&&!_&&u===""&&l.length>0&&S!==-1){const n=S,a=l.slice();a.splice(n,1),H(e,a,"removeOption",{option:l[n]})}break}},st=t=>{Le(!0),at&&!be.current&&q(t)},ke=t=>{if(r(R)){O.current.focus();return}Le(!1),he.current=!0,be.current=!1,D&&T.current!==-1&&A?h(t,g[T.current],"blur"):D&&Q&&u!==""?h(t,u,"blur","freeSolo"):b&&le(t,l),z(t,"blur")},De=t=>{const e=t.target.value;u!==e&&(X(e),Re(!1),B&&B(t,e,"input")),e===""?!pe&&!c&&H(t,null,"clear"):q(t)},Oe=t=>{K({event:t,index:Number(t.currentTarget.getAttribute("data-option-index")),reason:"mouse"})},Ce=()=>{ee.current=!0},Pe=t=>{const e=Number(t.currentTarget.getAttribute("data-option-index"));h(t,g[e],"selectOption"),ee.current=!1},$e=t=>e=>{const n=l.slice();n.splice(t,1),H(e,n,"removeOption",{option:l[t]})},i=t=>{Y?z(t,"toggleInput"):q(t)},P=t=>{t.target.getAttribute("id")!==$&&t.preventDefault()},te=()=>{O.current.focus(),Ue&&he.current&&O.current.selectionEnd-O.current.selectionStart===0&&O.current.select(),he.current=!1},Xe=t=>{(u===""||!Y)&&i(t)};let Ye=Q&&u.length>0;Ye=Ye||(c?l.length>0:l!==null);let it=g;return re&&(it=g.reduce((t,e,n)=>{const a=re(e);return t.length>0&&t[t.length-1].group===a?t[t.length-1].options.push(e):t.push({key:n,index:n,group:a,options:[e]}),t},[])),M&&G&&ke(),{getRootProps:(t={})=>d({"aria-owns":Ie?`${$}-listbox`:null},t,{onKeyDown:Je(t),onMouseDown:P,onClick:te}),getInputLabelProps:()=>({id:`${$}-label`,htmlFor:$}),getInputProps:()=>({id:$,value:u,onBlur:ke,onFocus:st,onChange:De,onMouseDown:Xe,"aria-activedescendant":A?"":null,"aria-autocomplete":y?"both":"list","aria-controls":Ie?`${$}-listbox`:void 0,"aria-expanded":Ie,autoComplete:"off",ref:O,autoCapitalize:"none",spellCheck:"false",role:"combobox"}),getClearProps:()=>({tabIndex:-1,onClick:Qe}),getPopupIndicatorProps:()=>({tabIndex:-1,onClick:i}),getTagProps:({index:t})=>d({key:t,"data-tag-index":t,tabIndex:-1},!_&&{onDelete:$e(t)}),getListboxProps:()=>({role:"listbox",id:`${$}-listbox`,"aria-labelledby":`${$}-label`,ref:je,onMouseDown:t=>{t.preventDefault()}}),getOptionProps:({index:t,option:e})=>{const n=(c?l:[l]).some(p=>p!=null&&J(e,p)),a=W?W(e):!1;return{key:U(e),tabIndex:-1,role:"option",id:`${$}-option-${t}`,onMouseOver:Oe,onClick:Pe,onTouchStart:Ce,"data-option-index":t,"aria-disabled":a,"aria-selected":n}},id:$,inputValue:u,value:l,dirty:Ye,popupOpen:A,focused:G||S!==-1,anchorEl:me,setAnchorEl:Ke,focusedTag:S,groupedOptions:it}}function Nt(o){return Pt("MuiAutocomplete",o)}const Ft=Ct("MuiAutocomplete",["root","fullWidth","focused","focusVisible","tag","tagSizeSmall","tagSizeMedium","hasPopupIcon","hasClearIcon","inputRoot","input","inputFocused","endAdornment","clearIndicator","popupIndicator","popupIndicatorOpen","popper","popperDisablePortal","paper","listbox","loading","noOptions","option","groupLabel","groupUl"]),s=Ft;var ft,gt;const Et=["autoComplete","autoHighlight","autoSelect","blurOnSelect","ChipProps","className","clearIcon","clearOnBlur","clearOnEscape","clearText","closeText","componentsProps","defaultValue","disableClearable","disableCloseOnSelect","disabled","disabledItemsFocusable","disableListWrap","disablePortal","filterOptions","filterSelectedOptions","forcePopupIcon","freeSolo","fullWidth","getLimitTagsText","getOptionDisabled","getOptionLabel","isOptionEqualToValue","groupBy","handleHomeEndKeys","id","includeInputInList","inputValue","limitTags","ListboxComponent","ListboxProps","loading","loadingText","multiple","noOptionsText","onChange","onClose","onHighlightChange","onInputChange","onOpen","open","openOnFocus","openText","options","PaperComponent","PopperComponent","popupIcon","readOnly","renderGroup","renderInput","renderOption","renderTags","selectOnFocus","size","slotProps","value"],Mt=o=>{const{classes:r,disablePortal:f,focused:y,fullWidth:E,hasClearIcon:D,hasPopupIcon:L,inputFocused:b,popupOpen:oe,size:j}=o,w={root:["root",y&&"focused",E&&"fullWidth",D&&"hasClearIcon",L&&"hasPopupIcon"],inputRoot:["inputRoot"],input:["input",b&&"inputFocused"],tag:["tag",`tagSize${bt(j)}`],endAdornment:["endAdornment"],clearIndicator:["clearIndicator"],popupIndicator:["popupIndicator",oe&&"popupIndicatorOpen"],popper:["popper",f&&"popperDisablePortal"],paper:["paper"],listbox:["listbox"],loading:["loading"],noOptions:["noOptions"],option:["option"],groupLabel:["groupLabel"],groupUl:["groupUl"]};return Lt(w,Nt,r)},zt=F("div",{name:"MuiAutocomplete",slot:"Root",overridesResolver:(o,r)=>{const{ownerState:f}=o,{fullWidth:y,hasClearIcon:E,hasPopupIcon:D,inputFocused:L,size:b}=f;return[{[`& .${s.tag}`]:r.tag},{[`& .${s.tag}`]:r[`tagSize${bt(b)}`]},{[`& .${s.inputRoot}`]:r.inputRoot},{[`& .${s.input}`]:r.input},{[`& .${s.input}`]:L&&r.inputFocused},r.root,y&&r.fullWidth,D&&r.hasPopupIcon,E&&r.hasClearIcon]}})(({ownerState:o})=>d({[`&.${s.focused} .${s.clearIndicator}`]:{visibility:"visible"},"@media (pointer: fine)":{[`&:hover .${s.clearIndicator}`]:{visibility:"visible"}}},o.fullWidth&&{width:"100%"},{[`& .${s.tag}`]:d({margin:3,maxWidth:"calc(100% - 6px)"},o.size==="small"&&{margin:2,maxWidth:"calc(100% - 4px)"}),[`& .${s.inputRoot}`]:{flexWrap:"wrap",[`.${s.hasPopupIcon}&, .${s.hasClearIcon}&`]:{paddingRight:26+4},[`.${s.hasPopupIcon}.${s.hasClearIcon}&`]:{paddingRight:52+4},[`& .${s.input}`]:{width:0,minWidth:30}},[`& .${et.root}`]:{paddingBottom:1,"& .MuiInput-input":{padding:"4px 4px 4px 0px"}},[`& .${et.root}.${Fe.sizeSmall}`]:{[`& .${et.input}`]:{padding:"2px 4px 3px 0"}},[`& .${ut.root}`]:{padding:9,[`.${s.hasPopupIcon}&, .${s.hasClearIcon}&`]:{paddingRight:26+4+9},[`.${s.hasPopupIcon}.${s.hasClearIcon}&`]:{paddingRight:52+4+9},[`& .${s.input}`]:{padding:"7.5px 4px 7.5px 6px"},[`& .${s.endAdornment}`]:{right:9}},[`& .${ut.root}.${Fe.sizeSmall}`]:{paddingTop:6,paddingBottom:6,paddingLeft:6,[`& .${s.input}`]:{padding:"2.5px 4px 2.5px 6px"}},[`& .${Ee.root}`]:{paddingTop:19,paddingLeft:8,[`.${s.hasPopupIcon}&, .${s.hasClearIcon}&`]:{paddingRight:26+4+9},[`.${s.hasPopupIcon}.${s.hasClearIcon}&`]:{paddingRight:52+4+9},[`& .${Ee.input}`]:{padding:"7px 4px"},[`& .${s.endAdornment}`]:{right:9}},[`& .${Ee.root}.${Fe.sizeSmall}`]:{paddingBottom:1,[`& .${Ee.input}`]:{padding:"2.5px 4px"}},[`& .${Fe.hiddenLabel}`]:{paddingTop:8},[`& .${s.input}`]:d({flexGrow:1,textOverflow:"ellipsis",opacity:0},o.inputFocused&&{opacity:1})})),Ht=F("div",{name:"MuiAutocomplete",slot:"EndAdornment",overridesResolver:(o,r)=>r.endAdornment})({position:"absolute",right:0,top:"calc(50% - 14px)"}),Vt=F(ht,{name:"MuiAutocomplete",slot:"ClearIndicator",overridesResolver:(o,r)=>r.clearIndicator})({marginRight:-2,padding:4,visibility:"hidden"}),Wt=F(ht,{name:"MuiAutocomplete",slot:"PopupIndicator",overridesResolver:({ownerState:o},r)=>d({},r.popupIndicator,o.popupOpen&&r.popupIndicatorOpen)})(({ownerState:o})=>d({padding:2,marginRight:-2},o.popupOpen&&{transform:"rotate(180deg)"})),Bt=F(mt,{name:"MuiAutocomplete",slot:"Popper",overridesResolver:(o,r)=>{const{ownerState:f}=o;return[{[`& .${s.option}`]:r.option},r.popper,f.disablePortal&&r.popperDisablePortal]}})(({theme:o,ownerState:r})=>d({zIndex:(o.vars||o).zIndex.modal},r.disablePortal&&{position:"absolute"})),_t=F(xt,{name:"MuiAutocomplete",slot:"Paper",overridesResolver:(o,r)=>r.paper})(({theme:o})=>d({},o.typography.body1,{overflow:"auto"})),Ut=F("div",{name:"MuiAutocomplete",slot:"Loading",overridesResolver:(o,r)=>r.loading})(({theme:o})=>({color:(o.vars||o).palette.text.secondary,padding:"14px 16px"})),Gt=F("div",{name:"MuiAutocomplete",slot:"NoOptions",overridesResolver:(o,r)=>r.noOptions})(({theme:o})=>({color:(o.vars||o).palette.text.secondary,padding:"14px 16px"})),Kt=F("div",{name:"MuiAutocomplete",slot:"Listbox",overridesResolver:(o,r)=>r.listbox})(({theme:o})=>({listStyle:"none",margin:0,padding:"8px 0",maxHeight:"40vh",overflow:"auto",position:"relative",[`& .${s.option}`]:{minHeight:48,display:"flex",overflow:"hidden",justifyContent:"flex-start",alignItems:"center",cursor:"pointer",paddingTop:6,boxSizing:"border-box",outline:"0",WebkitTapHighlightColor:"transparent",paddingBottom:6,paddingLeft:16,paddingRight:16,[o.breakpoints.up("sm")]:{minHeight:"auto"},[`&.${s.focused}`]:{backgroundColor:(o.vars||o).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},'&[aria-disabled="true"]':{opacity:(o.vars||o).palette.action.disabledOpacity,pointerEvents:"none"},[`&.${s.focusVisible}`]:{backgroundColor:(o.vars||o).palette.action.focus},'&[aria-selected="true"]':{backgroundColor:o.vars?`rgba(${o.vars.palette.primary.mainChannel} / ${o.vars.palette.action.selectedOpacity})`:tt(o.palette.primary.main,o.palette.action.selectedOpacity),[`&.${s.focused}`]:{backgroundColor:o.vars?`rgba(${o.vars.palette.primary.mainChannel} / calc(${o.vars.palette.action.selectedOpacity} + ${o.vars.palette.action.hoverOpacity}))`:tt(o.palette.primary.main,o.palette.action.selectedOpacity+o.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:(o.vars||o).palette.action.selected}},[`&.${s.focusVisible}`]:{backgroundColor:o.vars?`rgba(${o.vars.palette.primary.mainChannel} / calc(${o.vars.palette.action.selectedOpacity} + ${o.vars.palette.action.focusOpacity}))`:tt(o.palette.primary.main,o.palette.action.selectedOpacity+o.palette.action.focusOpacity)}}}})),qt=F($t,{name:"MuiAutocomplete",slot:"GroupLabel",overridesResolver:(o,r)=>r.groupLabel})(({theme:o})=>({backgroundColor:(o.vars||o).palette.background.paper,top:-8})),jt=F("ul",{name:"MuiAutocomplete",slot:"GroupUl",overridesResolver:(o,r)=>r.groupUl})({padding:0,[`& .${s.option}`]:{paddingLeft:24}}),Qt=I.exports.forwardRef(function(r,f){var y,E,D,L;const b=vt({props:r,name:"MuiAutocomplete"}),{autoComplete:oe=!1,autoHighlight:j=!1,autoSelect:w=!1,blurOnSelect:pe=!1,ChipProps:ue,className:M,clearIcon:ze=ft||(ft=v(yt,{fontSize:"small"})),clearOnBlur:He=!b.freeSolo,clearOnEscape:nt=!1,clearText:ce="Clear",closeText:Q="Close",componentsProps:W={},defaultValue:Ve=b.multiple?[]:null,disableClearable:re=!1,disableCloseOnSelect:We=!1,disabled:ne=!1,disabledItemsFocusable:Be=!1,disableListWrap:rt=!1,disablePortal:J=!1,filterSelectedOptions:c=!1,forcePopupIcon:de="auto",freeSolo:fe=!1,fullWidth:ye=!1,getLimitTagsText:B=i=>`+${i}`,getOptionLabel:ge=i=>{var P;return(P=i.label)!=null?P:i},groupBy:_e,handleHomeEndKeys:at=!b.freeSolo,includeInputInList:lt=!1,limitTags:_=-1,ListboxComponent:Ue="ul",ListboxProps:Ge,loading:$=!1,loadingText:U="Loading\u2026",multiple:be=!1,noOptionsText:he="No options",openOnFocus:O=!1,openText:R="Open",PaperComponent:me=xt,PopperComponent:Ke=mt,popupIcon:S=gt||(gt=v(St,{})),readOnly:ae=!1,renderGroup:Se,renderInput:T,renderOption:l,renderTags:Ae,selectOnFocus:u=!b.freeSolo,size:X="medium",slotProps:G={}}=b,Le=At(b,Et),{getRootProps:le,getInputProps:xe,getInputLabelProps:Y,getPopupIndicatorProps:we,getClearProps:qe,getTagProps:Re,getListboxProps:Te,getOptionProps:A,value:g,dirty:Ie,id:se,popupOpen:ie,focused:K,focusedTag:N,anchorEl:Z,setAnchorEl:je,inputValue:q,groupedOptions:z}=Dt(d({},b,{componentName:"Autocomplete"})),H=!re&&!ne&&Ie&&!ae,ee=(!fe||de===!0)&&de!==!1,h=d({},b,{disablePortal:J,focused:K,fullWidth:ye,hasClearIcon:H,hasPopupIcon:ee,inputFocused:N===-1,popupOpen:ie,size:X}),x=Mt(h);let k;if(be&&g.length>0){const i=P=>d({className:x.tag,disabled:ne},Re(P));Ae?k=Ae(g,i,h):k=g.map((P,te)=>v(wt,d({label:ge(P),size:X},i({index:te}),ue)))}if(_>-1&&Array.isArray(k)){const i=k.length-_;!K&&i>0&&(k=k.splice(0,_),k.push(v("span",{className:x.tag,children:B(i)},k.length)))}const Je=Se||(i=>Me("li",{children:[v(qt,{className:x.groupLabel,ownerState:h,component:"div",children:i.group}),v(jt,{className:x.groupUl,ownerState:h,children:i.children})]},i.key)),ke=l||((i,P)=>v("li",d({},i,{children:ge(P)}))),De=(i,P)=>{const te=A({option:i,index:P});return ke(d({},te,{className:x.option}),i,{selected:te["aria-selected"],index:P,inputValue:q})},Oe=(y=G.clearIndicator)!=null?y:W.clearIndicator,Ce=(E=G.paper)!=null?E:W.paper,Pe=(D=G.popper)!=null?D:W.popper,$e=(L=G.popupIndicator)!=null?L:W.popupIndicator;return Me(I.exports.Fragment,{children:[v(zt,d({ref:f,className:ve(x.root,M),ownerState:h},le(Le),{children:T({id:se,disabled:ne,fullWidth:!0,size:X==="small"?"small":void 0,InputLabelProps:Y(),InputProps:d({ref:je,className:x.inputRoot,startAdornment:k},(H||ee)&&{endAdornment:Me(Ht,{className:x.endAdornment,ownerState:h,children:[H?v(Vt,d({},qe(),{"aria-label":ce,title:ce,ownerState:h},Oe,{className:ve(x.clearIndicator,Oe==null?void 0:Oe.className),children:ze})):null,ee?v(Wt,d({},we(),{disabled:ne,"aria-label":ie?Q:R,title:ie?Q:R,ownerState:h},$e,{className:ve(x.popupIndicator,$e==null?void 0:$e.className),children:S})):null]})}),inputProps:d({className:x.input,disabled:ne,readOnly:ae},xe())})})),Z?v(Bt,d({as:Ke,disablePortal:J,style:{width:Z?Z.clientWidth:null},ownerState:h,role:"presentation",anchorEl:Z,open:ie},Pe,{className:ve(x.popper,Pe==null?void 0:Pe.className),children:Me(_t,d({ownerState:h,as:me},Ce,{className:ve(x.paper,Ce==null?void 0:Ce.className),children:[$&&z.length===0?v(Ut,{className:x.loading,ownerState:h,children:U}):null,z.length===0&&!fe&&!$?v(Gt,{className:x.noOptions,ownerState:h,role:"presentation",onMouseDown:i=>{i.preventDefault()},children:he}):null,z.length>0?v(Kt,d({as:Ue,className:x.listbox,ownerState:h},Te(),Ge,{children:z.map((i,P)=>_e?Je({key:i.key,group:i.group,children:i.options.map((te,Xe)=>De(te,i.index+Xe))}):De(i,P))})):null]}))})):null]})}),Yt=Qt;export{Yt as A};