You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
57 KiB
1 line
57 KiB
2 years ago
|
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[536],{5949:function(e,t,o){o.d(t,{D:function(){return p},Z:function(){return f}});var n=o(7462),r=o(7294),i=o(7579),a=o(8925),l=o(3633),s=o(7960);function c(e){return"undefined"!==typeof e.normalize?e.normalize("NFD").replace(/[\u0300-\u036f]/g,""):e}function p(e={}){const{ignoreAccents:t=!0,ignoreCase:o=!0,limit:n,matchFrom:r="any",stringify:i,trim:a=!1}=e;return(e,{inputValue:l,getOptionLabel:s})=>{let p=a?l.trim():l;o&&(p=p.toLowerCase()),t&&(p=c(p));const u=e.filter((e=>{let n=(i||s)(e);return o&&(n=n.toLowerCase()),t&&(n=c(n)),"start"===r?0===n.indexOf(p):n.indexOf(p)>-1}));return"number"===typeof n?u.slice(0,n):u}}function u(e,t){for(let o=0;o<e.length;o+=1)if(t(e[o]))return o;return-1}const d=p();function f(e){const{autoComplete:t=!1,autoHighlight:o=!1,autoSelect:c=!1,blurOnSelect:p=!1,disabled:f,clearOnBlur:m=!e.freeSolo,clearOnEscape:g=!1,componentName:h="useAutocomplete",defaultValue:b=(e.multiple?[]:null),disableClearable:v=!1,disableCloseOnSelect:x=!1,disabledItemsFocusable:y=!1,disableListWrap:w=!1,filterOptions:Z=d,filterSelectedOptions:S=!1,freeSolo:O=!1,getOptionDisabled:$,getOptionLabel:k=(e=>{var t;return null!=(t=e.label)?t:e}),isOptionEqualToValue:C=((e,t)=>e===t),groupBy:P,handleHomeEndKeys:I=!e.freeSolo,id:R,includeInputInList:L=!1,inputValue:M,multiple:A=!1,onChange:E,onClose:D,onHighlightChange:T,onInputChange:j,onOpen:z,open:N,openOnFocus:W=!1,options:F,readOnly:H=!1,selectOnFocus:V=!e.freeSolo,value:B}=e,q=(0,i.Z)(R);let G=k;G=e=>{const t=k(e);return"string"!==typeof t?String(t):t};const U=r.useRef(!1),K=r.useRef(!0),_=r.useRef(null),X=r.useRef(null),[Y,Q]=r.useState(null),[J,ee]=r.useState(-1),te=o?0:-1,oe=r.useRef(te),[ne,re]=(0,a.Z)({controlled:B,default:b,name:h}),[ie,ae]=(0,a.Z)({controlled:M,default:"",name:h,state:"inputValue"}),[le,se]=r.useState(!1),ce=r.useCallback(((e,t)=>{if(!(A?ne.length<t.length:null!==t)&&!m)return;let o;if(A)o="";else if(null==t)o="";else{const e=G(t);o="string"===typeof e?e:""}ie!==o&&(ae(o),j&&j(e,o,"reset"))}),[G,ie,A,j,ae,m,ne]),pe=r.useRef();r.useEffect((()=>{const e=ne!==pe.current;pe.current=ne,le&&!e||O&&!e||ce(null,ne)}),[ne,ce,le,pe,O]);const[ue,de]=(0,a.Z)({controlled:N,default:!1,name:h,state:"open"}),[fe,me]=r.useState(!0),ge=!A&&null!=ne&&ie===G(ne),he=ue&&!H,be=he?Z(F.filter((e=>!S||!(A?ne:[ne]).some((t=>null!==t&&C(e,t))))),{inputValue:ge&&fe?"":ie,getOptionLabel:G}):[],ve=ue&&be.length>0&&!H;const xe=(0,l.Z)((e=>{-1===e?_.current.focus():Y.querySelector(`[data-tag-index="${e}"]`).focus()}));r.useEffect((()=>{A&&J>ne.length-1&&(ee(-1),xe(-1))}),[ne,A,J,xe]);const ye=(0,l.Z)((({event:e,index:t,reason:o="auto"})=>{if(oe.current=t,-1===t?_.current.removeAttribute("aria-activedescendant"):_.current.setAttribute("aria-activedescendant",`${q}-option-${t}`),T&&T(e,-1===t?null:be[t],o),!X.current)return;const n=X.current.querySelector('[role="option"].Mui-focused');n&&(n.classList.remove("Mui-focused"),n.classList.remove("Mui-focusVisible"));const r=X.current.parentElement.querySelector('[role="listbox"]');if(!r)return;if(-1===t)return void(r.scrollTop=0);const i=X.current.querySelector(`[data-option-index="${t}"]`);if(i&&(i.classList.add("Mui-focused"),"keyboard"===o&&i.classList.add("Mui-focusVisible"),r.scrollHeight>r.clientHeight&&"mouse"!==o)){const e=i,t=r.clientHeight+r.scrollTop,o=e.offsetTop+e.offsetHeight;o>t?r.scrollTop=o-r.clientHeight:e.offsetTop-e.offsetHeight*(P?1.3:0)<r.scrollTop&&(r.scrollTop=e.offsetTop-e.offsetHeight*(P?1.3:0))}})),we=(0,l.Z)((({event:e,diff:o,direction:n="next",reason:r="auto"})=>{if(!he)return;const i=function(e,t){if(!X.current||-1===e)return-1;let o=e;for(;;){if("next"===t&&o===be.length||"previous"===t&&-1===o)return-1;const e=X.current.querySelector(`[data-option-index="${o}"]`),n=!y&&(!e||e.disabled||"true"===e.getAttribute("aria-disabled"));if(!(e&&!e.hasAttribute("tabindex")||n))return o;o+="next"===t?1:-1}}((()=>{const e=be.length-1;if("reset"===o)return te;if("start"===o)return 0;if("end"===o)return e;const t=oe.current+o;return t<0?-1===t
|