bonuspluscomponents 0.0.163 → 0.0.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -235,4 +235,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
235
235
  `)),"")}function aD(e,t,n,r){if(!e)return!1;const a=r.formatByString(r.date(ef),t).replace(n,ma),i=r.formatByString(r.date(Jd),t).replace(n,"_"),s=i===a&&e===i;return!s&&r.lib!=="luxon"&&process.env.NODE_ENV!=="production"&&(t.includes("MMM")?console.warn(["Mask does not support literals such as 'MMM'.","Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop","Falling down to uncontrolled no-mask input."].join(`
236
236
  `)):i&&i!==a?console.warn(["Mask does not support numbers with variable length such as 'M'.","Either use numbers with fix length or disable mask feature with 'disableMaskedInput' prop","Falling down to uncontrolled no-mask input."].join(`
237
237
  `)):e&&console.warn([`The mask "${e}" you passed is not valid for the format used ${t}.`,"Falling down to uncontrolled no-mask input."].join(`
238
- `))),s}const iD=(e,t)=>n=>{let r=0;return n.split("").map((o,a)=>{if(t.lastIndex=0,r>e.length-1)return"";const i=e[r],s=e[r+1],l=t.test(o)?o:"",c=i===ma?l:i+l;return r+=c.length,a===n.length-1&&s&&s!==ma?c?c+s:"":c}).join("")},sD=({acceptRegex:e=/[\d]/gi,disabled:t,disableMaskedInput:n,ignoreInvalidInputs:r,inputFormat:o,inputProps:a,label:i,mask:s,onChange:l,rawValue:c,readOnly:d,rifmFormatter:p,TextFieldProps:h,validationError:g})=>{const v=Je(),m=v.getFormatHelperText(o),{shouldUseMaskedInput:y,maskToUse:T}=w.useMemo(()=>{if(n)return{shouldUseMaskedInput:!1,maskToUse:""};const j=oD(s,o,e,v);return{shouldUseMaskedInput:aD(j,o,e,v),maskToUse:j}},[e,n,o,s,v]),k=w.useMemo(()=>y&&T?iD(T,e):j=>j,[e,T,y]),x=c===null?null:v.date(c),[C,b]=w.useState(x),[E,O]=w.useState(Zd(v,c,o)),R=w.useRef(),L=w.useRef(v.locale),$=w.useRef(o);w.useEffect(()=>{const j=c!==R.current,N=v.locale!==L.current,I=o!==$.current;if(R.current=c,L.current=v.locale,$.current=o,!j&&!N&&!I)return;const F=c===null?null:v.date(c),H=c===null||v.isValid(F);let z=C===null&&F===null;if(C!==null&&F!==null){const B=v.isEqual(C,F);if(B)z=!0;else{const J=Math.abs(v.getDiff(C,F));z=J===0?B:J<1e3}}if(!N&&!I&&(!H||z))return;const _=Zd(v,c,o);b(F),O(_)},[v,c,o,C]);const W=j=>{const N=j===""||j===s?"":j;O(N);const I=N===null?null:v.parse(N,o);r&&!v.isValid(I)||(b(I),l(I,N||void 0))},X=rD({value:E,onChange:W,format:p||k});return D({label:i,disabled:t,error:g,inputProps:D({},y?X:{value:E,onChange:j=>{W(j.currentTarget.value)}},{disabled:t,placeholder:m,readOnly:d,type:y?"tel":"text"},a)},h)},uD=["className","components","disableOpenPicker","getOpenDialogAriaText","InputAdornmentProps","InputProps","inputRef","openPicker","OpenPickerButtonProps","renderInput"],tf=w.forwardRef(function(t,n){const{className:r,components:o={},disableOpenPicker:a,getOpenDialogAriaText:i,InputAdornmentProps:s,InputProps:l,inputRef:c,openPicker:d,OpenPickerButtonProps:p,renderInput:h}=t,g=de(t,uD),v=rr(),m=i??v.openDatePickerDialogue,y=Je(),T=sD(g),k=(s==null?void 0:s.position)||"end",x=o.OpenPickerIcon||Dd;return h(D({ref:n,inputRef:c,className:r},T,{InputProps:D({},l,{[`${k}Adornment`]:a?void 0:f.jsx(nD,D({position:k},s,{children:f.jsx(or,D({edge:k,disabled:g.disabled||g.readOnly,"aria-label":m(g.rawValue,y)},p,{onClick:d,children:f.jsx(x,{})}))}))})}))});function nf(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const lD=(e,t)=>{const[n,r]=w.useState(nf);return It(()=>{const a=()=>{r(nf())};return window.addEventListener("orientationchange",a),()=>{window.removeEventListener("orientationchange",a)}},[]),ud(e,["hours","minutes","seconds"])?!1:(t||n)==="landscape"},cD=({autoFocus:e,openView:t})=>{const[n,r]=w.useState(e?t:null),o=w.useCallback(a=>i=>{r(i?a:s=>a===s?null:s)},[]);return{focusedView:n,setFocusedView:o}};function dD(e){return V.generateUtilityClass("MuiCalendarOrClockPicker",e)}V.generateUtilityClasses("MuiCalendarOrClockPicker",["root","mobileKeyboardInputView"]);const fD=["autoFocus","className","parsedValue","DateInputProps","isMobileKeyboardViewOpen","onDateChange","onViewChange","openTo","orientation","showToolbar","toggleMobileKeyboardView","ToolbarComponent","toolbarFormat","toolbarPlaceholder","toolbarTitle","views","dateRangeIcon","timeIcon","hideTabs","classes"],pD=e=>{const{classes:t}=e,n={root:["root"],mobileKeyboardInputView:["mobileKeyboardInputView"]};return V.unstable_composeClasses(n,dD,t)},hD=le("div",{name:"MuiCalendarOrClockPicker",slot:"MobileKeyboardInputView",overridesResolver:(e,t)=>t.mobileKeyboardInputView})({padding:"16px 24px"}),mD=le("div",{name:"MuiCalendarOrClockPicker",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e})=>D({display:"flex",flexDirection:"column"},e.isLandscape&&{flexDirection:"row"})),vD={fullWidth:!0},rf=e=>e==="year"||e==="month"||e==="day",of=e=>e==="hours"||e==="minutes"||e==="seconds";let af=!1;function gD(e){var t,n;const r=Se({props:e,name:"MuiCalendarOrClockPicker"}),{autoFocus:o,parsedValue:a,DateInputProps:i,isMobileKeyboardViewOpen:s,onDateChange:l,onViewChange:c,openTo:d,orientation:p,showToolbar:h,toggleMobileKeyboardView:g,ToolbarComponent:v=()=>null,toolbarFormat:m,toolbarPlaceholder:y,toolbarTitle:T,views:k,dateRangeIcon:x,timeIcon:C,hideTabs:b}=r,E=de(r,fD),O=(t=E.components)==null?void 0:t.Tabs,R=lD(k,p),L=w.useContext(ar),$=pD(r),W=h??L!=="desktop",X=!b&&typeof window<"u"&&window.innerHeight>667,Z=w.useCallback((_,B)=>{l(_,L,B)},[l,L]),j=w.useCallback(_=>{s&&g(),c&&c(_)},[s,c,g]);process.env.NODE_ENV!=="production"&&!af&&!k.includes(d)&&(console.warn(`MUI: \`openTo="${d}"\` is not a valid prop.`,`It must be an element of \`views=["${k.join('", "')}"]\`.`),af=!0);const{openView:N,setOpenView:I,handleChangeAndOpenNext:F}=gs({view:void 0,views:k,openTo:d,onChange:Z,onViewChange:j}),{focusedView:H,setFocusedView:z}=cD({autoFocus:o,openView:N});return f.jsxs(mD,{ownerState:{isLandscape:R},className:$.root,children:[W&&f.jsx(v,D({},E,{views:k,isLandscape:R,parsedValue:a,onChange:Z,setOpenView:I,openView:N,toolbarTitle:T,toolbarFormat:m,toolbarPlaceholder:y,isMobileKeyboardViewOpen:s,toggleMobileKeyboardView:g})),X&&!!O&&f.jsx(O,D({dateRangeIcon:x,timeIcon:C,view:N,onChange:I},(n=E.componentsProps)==null?void 0:n.tabs)),f.jsx(bs,{children:s?f.jsx(hD,{className:$.mobileKeyboardInputView,children:f.jsx(tf,D({},i,{ignoreInvalidInputs:!0,disableOpenPicker:!0,TextFieldProps:vD}))}):f.jsxs(w.Fragment,{children:[rf(N)&&f.jsx(Nd,D({autoFocus:o,date:a,onViewChange:I,onChange:F,view:N,views:k.filter(rf),focusedView:H,onFocusedViewChange:z},E)),of(N)&&f.jsx(Ld,D({},E,{autoFocus:o,date:a,view:N,views:k.filter(of),onChange:F,onViewChange:I,showViewSwitcher:L==="desktop"}))]})})]})}const yD=({open:e,onOpen:t,onClose:n})=>{const r=w.useRef(typeof e=="boolean").current,[o,a]=w.useState(!1);w.useEffect(()=>{if(r){if(typeof e!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");a(e)}},[r,e]);const i=w.useCallback(s=>{r||a(s),s&&t&&t(),!s&&n&&n()},[r,t,n]);return{isOpen:o,setIsOpen:i}},bD=(e,t)=>{const{onAccept:n,onChange:r,value:o,closeOnSelect:a}=e,i=Je(),{isOpen:s,setIsOpen:l}=yD(e),c=w.useMemo(()=>t.parseInput(i,o),[t,i,o]),[d,p]=w.useState(c),[h,g]=w.useState(()=>({committed:c,draft:c,resetFallback:c})),v=w.useCallback(E=>{g(O=>{switch(E.action){case"setAll":case"acceptAndClose":return{draft:E.value,committed:E.value,resetFallback:E.value};case"setCommitted":return D({},O,{draft:E.value,committed:E.value});case"setDraft":return D({},O,{draft:E.value});default:return O}}),(E.forceOnChangeCall||!E.skipOnChangeCall&&!t.areValuesEqual(i,h.committed,E.value))&&r(E.value),E.action==="acceptAndClose"&&(l(!1),n&&!t.areValuesEqual(i,h.resetFallback,E.value)&&n(E.value))},[n,r,l,h,i,t]);w.useEffect(()=>{i.isValid(c)&&p(c)},[i,c]),w.useEffect(()=>{s&&v({action:"setAll",value:c,skipOnChangeCall:!0})},[s]),t.areValuesEqual(i,h.committed,c)||v({action:"setCommitted",value:c,skipOnChangeCall:!0});const m=w.useMemo(()=>({open:s,onClear:()=>{v({value:t.emptyValue,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,t.emptyValue)})},onAccept:()=>{v({value:h.draft,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,c)})},onDismiss:()=>{v({value:h.committed,action:"acceptAndClose"})},onCancel:()=>{v({value:h.resetFallback,action:"acceptAndClose"})},onSetToday:()=>{v({value:t.getTodayValue(i),action:"acceptAndClose"})}}),[v,s,i,h,t,o,c]),[y,T]=w.useState(!1),k=w.useMemo(()=>({parsedValue:h.draft,isMobileKeyboardViewOpen:y,toggleMobileKeyboardView:()=>T(!y),onDateChange:(E,O,R="partial")=>{switch(R){case"shallow":return v({action:"setDraft",value:E,skipOnChangeCall:!0});case"partial":return v({action:"setDraft",value:E});case"finish":return v(a??O==="desktop"?{value:E,action:"acceptAndClose"}:{value:E,action:"setCommitted"});default:throw new Error("MUI: Invalid selectionState passed to `onDateChange`")}}}),[v,y,h.draft,a]),x=w.useCallback((E,O)=>{const R=t.valueReducer?t.valueReducer(i,d,E):E;r(R,O)},[r,t,d,i]),C=w.useMemo(()=>({onChange:x,open:s,rawValue:o,openPicker:()=>l(!0)}),[x,s,o,l]),b={pickerProps:k,inputProps:C,wrapperProps:m};return w.useDebugValue(b,()=>({MuiPickerState:{dateState:h,other:b}})),b},xD=["onChange","PopperProps","PaperProps","ToolbarComponent","TransitionComponent","value","components","componentsProps"],sf=w.forwardRef(function(t,n){const r=qT(t,"MuiDesktopDatePicker"),o=YC(r)!==null,{pickerProps:a,inputProps:i,wrapperProps:s}=bD(r,GT),{PopperProps:l,PaperProps:c,ToolbarComponent:d=CP,TransitionComponent:p,components:h,componentsProps:g}=r,v=de(r,xD),m=D({},i,v,{components:h,componentsProps:g,ref:n,validationError:o});return f.jsx(KP,D({},s,{DateInputProps:m,KeyboardDateInputComponent:tf,PopperProps:l,PaperProps:c,TransitionComponent:p,components:h,componentsProps:g,children:f.jsx(gD,D({},a,{autoFocus:!0,toolbarTitle:r.label||r.toolbarTitle,ToolbarComponent:d,DateInputProps:m,components:h,componentsProps:g},v))}))});process.env.NODE_ENV!=="production"&&(sf.propTypes={acceptRegex:u.instanceOf(RegExp),autoFocus:u.bool,children:u.node,className:u.string,closeOnSelect:u.bool,components:u.object,componentsProps:u.object,dayOfWeekFormatter:u.func,defaultCalendarMonth:u.any,disabled:u.bool,disableFuture:u.bool,disableHighlightToday:u.bool,disableMaskedInput:u.bool,disableOpenPicker:u.bool,disablePast:u.bool,getOpenDialogAriaText:u.func,getViewSwitchingButtonText:u.func,ignoreInvalidInputs:u.bool,InputAdornmentProps:u.object,inputFormat:u.string,InputProps:u.object,inputRef:u.oneOfType([u.func,u.shape({current:u.object})]),label:u.node,leftArrowButtonText:u.string,loading:u.bool,mask:u.string,maxDate:u.any,minDate:u.any,onAccept:u.func,onChange:u.func.isRequired,onClose:u.func,onError:u.func,onMonthChange:u.func,onOpen:u.func,onViewChange:u.func,onYearChange:u.func,open:u.bool,OpenPickerButtonProps:u.object,openTo:u.oneOf(["day","month","year"]),orientation:u.oneOf(["landscape","portrait"]),PaperProps:u.object,PopperProps:u.object,readOnly:u.bool,reduceAnimations:u.bool,renderDay:u.func,renderInput:u.func.isRequired,renderLoading:u.func,rifmFormatter:u.func,rightArrowButtonText:u.string,shouldDisableDate:u.func,shouldDisableMonth:u.func,shouldDisableYear:u.func,showDaysOutsideCurrentMonth:u.bool,showToolbar:u.bool,ToolbarComponent:u.elementType,toolbarFormat:u.string,toolbarPlaceholder:u.node,toolbarTitle:u.node,TransitionComponent:u.elementType,value:u.any,views:u.arrayOf(u.oneOf(["day","month","year"]).isRequired)});const Es=({title:e,value:t,readonly:n,onChange:r,required:o,id:a,fullWidth:i=!0})=>f.jsx(sf,{disabled:n,label:e,value:t,onChange:s=>r(s),renderInput:s=>{var c,d,p;let l;return(c=s.inputProps)!=null&&c.placeholder&&(l=(p=(d=s.inputProps)==null?void 0:d.placeholder)==null?void 0:p.slice(),s.inputProps.placeholder=void 0),f.jsx(V.TextField,{...s,required:o,sx:{width:"100%"},placeholder:l,autoComplete:"off",variant:"standard",error:!1})}});var Ts={},wD=pt;Object.defineProperty(Ts,"__esModule",{value:!0});var Ps=Ts.default=void 0,CD=wD(yt()),ED=f,TD=(0,CD.default)((0,ED.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Ps=Ts.default=TD;var Ds={},PD=pt;Object.defineProperty(Ds,"__esModule",{value:!0});var uf=Ds.default=void 0,DD=PD(yt()),OD=f,MD=(0,DD.default)((0,OD.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");uf=Ds.default=MD;const kD=({dates:e,readonly:t,onChange:n,title:r})=>{const[o,a]=S.useState(Math.random()),[i,s]=S.useState(e??[null]),{ToIsoWithoutTimeZone:l,ParseDataToRusLocale:c}=Lr();S.useEffect(()=>{n(i.filter(h=>!!h&&Date.parse(h)).map(h=>l(h)).join(","))},[i]);const d=()=>{s(h=>[...h,null]),a(Math.random())},p=h=>{s(g=>[...g.filter((v,m)=>m!==h)]),a(Math.random())};return i.length<2?f.jsx(Xo,{dateAdapter:ds,locale:ps,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Es,{id:"",title:r??"День рождения родственника",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(g=>(g[i.length-1]=h,[...g]))}),!!Date.parse(i[0]??"")&&!t&&f.jsx(V.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Ps,{})})]})}):f.jsxs("div",{children:[f.jsx("div",{style:{marginBottom:"1em"},children:"День рождения родственников"}),f.jsx("div",{style:{borderLeft:"solid 1px #cccccc50",paddingLeft:"1em"},children:f.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{display:"flex",gap:"1em",flexWrap:"wrap"},children:i.filter((h,g)=>g<i.length-1).map((h,g)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em",backgroundColor:"rgba(204, 204, 204, 0.5)",padding:"0 .5em",borderRadius:"5px"},children:[f.jsx("div",{children:h&&c(h.toString())}),f.jsx("div",{children:!t&&f.jsx(V.IconButton,{size:"small",color:"primary",onClick:()=>p(g),children:f.jsx(uf,{})})})]},g))}),f.jsx("div",{children:f.jsx(Xo,{dateAdapter:ds,locale:ps,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Es,{id:"",title:"День рождения",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(g=>(g[i.length-1]=h,[...g]))}),!t&&f.jsx(V.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Ps,{})})]})})})]})})]})},_D=({id:e,defaultChecked:t,title:n,readonly:r,required:o,onChange:a,value:i})=>{const s=V.useTheme(),l=(c,d=!1)=>{if(!o)return;const p=new CustomEvent(Br,{detail:{id:e,empty:!c,label:n}});document.dispatchEvent(p)};return S.useEffect(()=>{setTimeout(()=>l(i),1)},[]),S.useEffect(()=>{l(i,!0)},[i]),f.jsxs("div",{style:{display:"flex",gap:"1em",alignItems:"center"},children:[f.jsx(V.Checkbox,{required:o,sx:{padding:0},readOnly:r,checked:i,onChange:()=>a(!i)}),f.jsx(V.Box,{sx:{fontSize:"1rem",a:{color:s.palette.info.main,textDecoration:"none"}},component:"div",dangerouslySetInnerHTML:{__html:n}})]})},SD=({control:e,isReg:t,readonlyControls:n,onChangeRadio:r})=>{var a,i,s,l,c,d;const o=(p,h=!1)=>{if(!e.validation.required)return;const g=new CustomEvent(Br,{detail:{id:e.id,empty:!p,label:e.title}});document.dispatchEvent(g)};return S.useEffect(()=>{setTimeout(()=>{var p,h;return o((h=(p=e.values)==null?void 0:p.find(g=>g.selected))==null?void 0:h.id)},1)},[]),f.jsx(V.Box,{sx:{minWidth:120},children:f.jsxs(V.FormControl,{fullWidth:!0,variant:"standard",required:(a=e==null?void 0:e.validation)==null?void 0:a.required,children:[f.jsx(V.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(V.Select,{required:(i=e==null?void 0:e.validation)==null?void 0:i.required,readOnly:!t&&((s=e==null?void 0:e.validation)==null?void 0:s.readOnly)&&(n==null?void 0:n.includes(e.id)),labelId:`select-${e.id}`,value:((c=(l=e.values)==null?void 0:l.find(p=>p.selected))==null?void 0:c.id)||"",label:e.title,onChange:p=>{var g,v;(g=e.values)==null||g.filter(m=>m.id!==p.target.value).forEach(m=>m.selected=!1);let h=(v=e.values)==null?void 0:v.find(m=>m.id===p.target.value);h&&(o(!0,!0),h.selected=!0),r({...e,values:e.values})},children:(d=e.values)==null?void 0:d.map(p=>f.jsx(V.MenuItem,{value:p.id,children:p.text},p.id))})]})})},$D=({control:e,value:t,onChange:n,onChangeRadio:r,onChangeChecked:o,isReg:a,readonlyControls:i})=>{var s,l,c,d,p,h,g,v;switch(e.type){case Nn.Textbox:return f.jsx(Yo,{value:t,onChange:m=>n(m.target.value),required:(s=e==null?void 0:e.validation)==null?void 0:s.required,id:e.id,label:e.title,disabled:!a&&((l=e==null?void 0:e.validation)==null?void 0:l.readOnly)&&(i==null?void 0:i.includes(e.id)),autoComplete:"off",variant:"standard",fullWidth:!0});case Nn.RadiobuttonGroup:return f.jsx(SD,{control:e,isReg:a,readonlyControls:i,onChangeRadio:r});case Nn.Select:return f.jsx(V.Box,{sx:{minWidth:120,maxHeight:"400px"},children:f.jsxs(V.FormControl,{fullWidth:!0,variant:"standard",required:(c=e==null?void 0:e.validation)==null?void 0:c.required,children:[f.jsx(V.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(V.Select,{sx:{maxHeight:"300px"},readOnly:!a&&((d=e==null?void 0:e.validation)==null?void 0:d.readOnly)&&(i==null?void 0:i.includes(e.id)),labelId:`select-${e.id}`,value:e.text,label:e.title,onChange:m=>n(m.target.value),children:(p=e.values)==null?void 0:p.map(m=>f.jsx(V.MenuItem,{value:m.id,children:m.text},m.id))})]})});case Nn.Date:return f.jsx(Xo,{dateAdapter:ds,locale:ps,children:f.jsx(Es,{id:e.id,title:e.title,value:t,readonly:!a&&((h=e==null?void 0:e.validation)==null?void 0:h.readOnly)&&!!(i!=null&&i.includes(e.id)),onChange:m=>n(m),required:(g=e==null?void 0:e.validation)==null?void 0:g.required})});case Nn.ParentBirthday:return f.jsx(kD,{title:e.title,onChange:m=>n(m),readonly:!a,dates:e.dates??[null]});case Nn.Checkbox:return f.jsx(_D,{id:e.id,onChange:m=>o(m),required:(v=e==null?void 0:e.validation)==null?void 0:v.required,readonly:!a,value:e.checked,title:e.title,defaultChecked:e.defaultChecked})}return f.jsx("div",{})},ND=e=>{const t=()=>{const r=new RegExp(/^\.*/);return e.type!==null?e.type===Hr.Email?new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/):e.type===Hr.Url||e.type===Hr.Date?r:e.type===Hr.Phone?new RegExp(/^[+]?[\d]{10,11}$/):r:r},n=r=>{let o=!0;return e!=null&&e.minTextLength&&(o=o&&r.length>=(e==null?void 0:e.minTextLength)),e!=null&&e.maxTextLength&&(o=o&&r.length<=(e==null?void 0:e.maxTextLength)),o};return r=>t().test(r)?n(r)?{isError:!1}:{isError:!0,message:`Строка не удовлетворяет нужному размеру (${e.minTextLength??0}-${e.maxTextLength??255})`}:{isError:!0,message:"Строка введена неверно"}},RD=({onControlsGet:e,buttonSaveText:t,isReg:n=!1,previewControls:r})=>{const{apiAxios:o,additionalData:a,VKUserId:i,setCabinetSettings:s,setPhoneNumber:l,telegramInfo:c}=S.useContext(ft),{setIsLoading:d}=S.useContext(ln),{showErrorAlert:p}=S.useContext(tn),{setOpenedPage:h}=S.useContext(hr),[g,v]=S.useState(!1),[m,y]=S.useState(r??[]);S.useEffect(()=>{y(r??[])},[r]);const[T,k]=S.useState([]),[x,C]=S.useState(Math.random()),[b,E]=S.useState(!1),{validationPopup:O,formIsValid:R,setValidations:L}=zi({}),{ToIsoWithoutTimeZone:$}=Lr();S.useEffect(()=>{L(m.map(F=>({id:F.id,label:F.title,validator:ND(F.validation)})))},[m]);const W=()=>{const F={};return m.map(H=>F[H.id]=H.text),F};S.useEffect(()=>{r||(async()=>{d("GetControls",!0);const H=await o().post("/externalCustomerCabinet/form/registration",{});e==null||e(H.data.controls),y(H.data.controls),k(H.data.controls.filter(z=>{var _;return((_=z.validation)==null?void 0:_.readOnly)&&!!z.text})),d("GetControls",!1)})()},[]);const X=()=>{R()&&!r&&(E(!0),o().patch("/externalCustomerCabinet/form/registration",{controls:m,...a,VKUserId:i,...c??{}}).then(F=>{s(H=>({...H,isReg:!1})),l(F.data.phoneNumber),v(!0),h("info"),k(m.filter(H=>{var z;return((z=H.validation)==null?void 0:z.readOnly)&&!!H.text}))}).catch(F=>{p(F.response.data.msg)}).finally(()=>{E(!1)}))},Z=(F,H)=>{Date.parse(H)&&(H=$(H)),y(z=>{const _=z.find(B=>B.id===F);return _&&(_.text=H),[...z]})},j=(F,H)=>{y(z=>{const _=z.find(B=>B.id===F);return _&&(_.checked=H),[...z]})},N=F=>{y(H=>{let z=H.find(_=>_.id===F.id);return z&&(z={...F},C(Math.random())),[...H]})};return{controlsForm:f.jsxs(V.Container,{maxWidth:"sm",children:[O,f.jsxs(V.Typography,{component:"div",style:{display:"flex",flexDirection:"column",gap:"1.5em",marginBottom:"1em"},children:[f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:m==null?void 0:m.map((F,H)=>f.jsx("div",{children:f.jsx($D,{isReg:n,control:F,onChange:z=>Z(F.id,z),onChangeChecked:z=>j(F.id,z),onChangeRadio:z=>N(z),value:F.text??"",readonlyControls:T.map(z=>z.id)})},H))}),f.jsx("div",{style:{display:"flex",justifyContent:"center"},children:f.jsx(Hi,{isLoading:b,onClick:()=>X(),children:t||"Сохранить анкету"})})]})]}),setControls:y,saved:g,setSaved:v,GetObjectByControls:W}},jD=()=>{S.useContext(ft);const{controlsForm:e,saved:t,setSaved:n}=RD({buttonSaveText:"Регистрация",isReg:!0});return f.jsx("div",{children:f.jsxs("div",{children:[f.jsx(Vo,{style:{marginBottom:"1em"},children:"Для использования полного функционала бота необходимо зарегистрироваться"}),e]})})},AD={theme:null,toggleColorMode:null,setTheme:()=>{}},Os=S.createContext(AD),ID=()=>{const[e,t]=S.useState(Pa);return{theme:e,setTheme:t,toggleColorMode:r=>{const o=V.createTheme({palette:{mode:r}});t(a=>({...o,palette:{...o.palette,primary:{...o.palette.primary,main:a.palette.primary.main}}}))}}},LD=({children:e})=>{const t=ID();return f.jsx(Os.Provider,{value:t,children:f.jsx(V.ThemeProvider,{theme:t.theme,children:e})})},BD=({showHeader:e})=>{var g;const{cabinetSettings:t,cabinetUISettings:n}=S.useContext(ft),{setTheme:r,theme:o}=S.useContext(Os),{isLoading:a}=S.useContext(ln),{openedPage:i,setOpenedPage:s}=S.useContext(hr),l=(v,m)=>{s(m)};S.useEffect(()=>{r(v=>({...Pa,palette:{...v.palette,primary:{...v.palette.primary,main:(n==null?void 0:n.themeColor)||"#6c97a9"}}}))},[n]);const{popups:c,closePopupById:d}=S.useContext(tn),h=[{icon:f.jsx($l,{}),value:"info",label:"Карта",page:f.jsx(k0,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Sl,{}),value:"receipt",label:"История",page:f.jsx(sb,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Nl,{}),value:"appeals",label:"Обращения",page:f.jsx(Vb,{}),active:t==null?void 0:t.canShowAppeals,disabled:t==null?void 0:t.isReg},{icon:f.jsx(jo,{}),value:"businessInfo",label:"Информация",page:f.jsx(ub,{}),active:t==null?void 0:t.canShowBusinessInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Rl,{}),value:"registration",label:"Регистрация",page:f.jsx(jD,{}),active:t==null?void 0:t.isReg,disabled:!1}].filter(v=>v.active&&!v.disabled);return f.jsxs(V.Box,{sx:{bgcolor:"background.default"},className:"page_view",children:[e&&f.jsx(As,{}),f.jsx(Ub,{show:a}),c.map((v,m)=>f.jsx(sc,{title:v.title,opened:!0,setOpened:()=>d(v.id),children:f.jsx("div",{children:v.content})})),f.jsx("div",{className:"page_view__page scrollbar",children:(g=h.find(v=>v.value===i))==null?void 0:g.page}),f.jsx("div",{className:"page_view__navigation",children:f.jsx("div",{children:f.jsx(V.BottomNavigation,{sx:{paddingBottom:"2em",borderTop:"solid 1px #cccccc50"},value:i,onChange:l,children:h.map((v,m)=>f.jsx(V.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:v.label,value:v.value,icon:v.icon},m))})})})]})};Ye.AppContext=ft,Ye.AppProvider=_f,Ye.BonusPlusThemeContext=Os,Ye.BonusPlusThemeProvider=LD,Ye.ErrorBoundary=Sf,Ye.Header=As,Ye.LoadingContext=ln,Ye.LoadingProvider=Tf,Ye.PageContext=hr,Ye.PageProvider=Of,Ye.PopupContext=tn,Ye.PopupProvider=Ky,Ye.Router=BD,Object.defineProperty(Ye,Symbol.toStringTag,{value:"Module"})});
238
+ `))),s}const iD=(e,t)=>n=>{let r=0;return n.split("").map((o,a)=>{if(t.lastIndex=0,r>e.length-1)return"";const i=e[r],s=e[r+1],l=t.test(o)?o:"",c=i===ma?l:i+l;return r+=c.length,a===n.length-1&&s&&s!==ma?c?c+s:"":c}).join("")},sD=({acceptRegex:e=/[\d]/gi,disabled:t,disableMaskedInput:n,ignoreInvalidInputs:r,inputFormat:o,inputProps:a,label:i,mask:s,onChange:l,rawValue:c,readOnly:d,rifmFormatter:p,TextFieldProps:h,validationError:g})=>{const v=Je(),m=v.getFormatHelperText(o),{shouldUseMaskedInput:y,maskToUse:T}=w.useMemo(()=>{if(n)return{shouldUseMaskedInput:!1,maskToUse:""};const j=oD(s,o,e,v);return{shouldUseMaskedInput:aD(j,o,e,v),maskToUse:j}},[e,n,o,s,v]),k=w.useMemo(()=>y&&T?iD(T,e):j=>j,[e,T,y]),x=c===null?null:v.date(c),[C,b]=w.useState(x),[E,O]=w.useState(Zd(v,c,o)),R=w.useRef(),L=w.useRef(v.locale),$=w.useRef(o);w.useEffect(()=>{const j=c!==R.current,N=v.locale!==L.current,I=o!==$.current;if(R.current=c,L.current=v.locale,$.current=o,!j&&!N&&!I)return;const F=c===null?null:v.date(c),H=c===null||v.isValid(F);let z=C===null&&F===null;if(C!==null&&F!==null){const B=v.isEqual(C,F);if(B)z=!0;else{const J=Math.abs(v.getDiff(C,F));z=J===0?B:J<1e3}}if(!N&&!I&&(!H||z))return;const _=Zd(v,c,o);b(F),O(_)},[v,c,o,C]);const W=j=>{const N=j===""||j===s?"":j;O(N);const I=N===null?null:v.parse(N,o);r&&!v.isValid(I)||(b(I),l(I,N||void 0))},X=rD({value:E,onChange:W,format:p||k});return D({label:i,disabled:t,error:g,inputProps:D({},y?X:{value:E,onChange:j=>{W(j.currentTarget.value)}},{disabled:t,placeholder:m,readOnly:d,type:y?"tel":"text"},a)},h)},uD=["className","components","disableOpenPicker","getOpenDialogAriaText","InputAdornmentProps","InputProps","inputRef","openPicker","OpenPickerButtonProps","renderInput"],tf=w.forwardRef(function(t,n){const{className:r,components:o={},disableOpenPicker:a,getOpenDialogAriaText:i,InputAdornmentProps:s,InputProps:l,inputRef:c,openPicker:d,OpenPickerButtonProps:p,renderInput:h}=t,g=de(t,uD),v=rr(),m=i??v.openDatePickerDialogue,y=Je(),T=sD(g),k=(s==null?void 0:s.position)||"end",x=o.OpenPickerIcon||Dd;return h(D({ref:n,inputRef:c,className:r},T,{InputProps:D({},l,{[`${k}Adornment`]:a?void 0:f.jsx(nD,D({position:k},s,{children:f.jsx(or,D({edge:k,disabled:g.disabled||g.readOnly,"aria-label":m(g.rawValue,y)},p,{onClick:d,children:f.jsx(x,{})}))}))})}))});function nf(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const lD=(e,t)=>{const[n,r]=w.useState(nf);return It(()=>{const a=()=>{r(nf())};return window.addEventListener("orientationchange",a),()=>{window.removeEventListener("orientationchange",a)}},[]),ud(e,["hours","minutes","seconds"])?!1:(t||n)==="landscape"},cD=({autoFocus:e,openView:t})=>{const[n,r]=w.useState(e?t:null),o=w.useCallback(a=>i=>{r(i?a:s=>a===s?null:s)},[]);return{focusedView:n,setFocusedView:o}};function dD(e){return V.generateUtilityClass("MuiCalendarOrClockPicker",e)}V.generateUtilityClasses("MuiCalendarOrClockPicker",["root","mobileKeyboardInputView"]);const fD=["autoFocus","className","parsedValue","DateInputProps","isMobileKeyboardViewOpen","onDateChange","onViewChange","openTo","orientation","showToolbar","toggleMobileKeyboardView","ToolbarComponent","toolbarFormat","toolbarPlaceholder","toolbarTitle","views","dateRangeIcon","timeIcon","hideTabs","classes"],pD=e=>{const{classes:t}=e,n={root:["root"],mobileKeyboardInputView:["mobileKeyboardInputView"]};return V.unstable_composeClasses(n,dD,t)},hD=le("div",{name:"MuiCalendarOrClockPicker",slot:"MobileKeyboardInputView",overridesResolver:(e,t)=>t.mobileKeyboardInputView})({padding:"16px 24px"}),mD=le("div",{name:"MuiCalendarOrClockPicker",slot:"Root",overridesResolver:(e,t)=>t.root})(({ownerState:e})=>D({display:"flex",flexDirection:"column"},e.isLandscape&&{flexDirection:"row"})),vD={fullWidth:!0},rf=e=>e==="year"||e==="month"||e==="day",of=e=>e==="hours"||e==="minutes"||e==="seconds";let af=!1;function gD(e){var t,n;const r=Se({props:e,name:"MuiCalendarOrClockPicker"}),{autoFocus:o,parsedValue:a,DateInputProps:i,isMobileKeyboardViewOpen:s,onDateChange:l,onViewChange:c,openTo:d,orientation:p,showToolbar:h,toggleMobileKeyboardView:g,ToolbarComponent:v=()=>null,toolbarFormat:m,toolbarPlaceholder:y,toolbarTitle:T,views:k,dateRangeIcon:x,timeIcon:C,hideTabs:b}=r,E=de(r,fD),O=(t=E.components)==null?void 0:t.Tabs,R=lD(k,p),L=w.useContext(ar),$=pD(r),W=h??L!=="desktop",X=!b&&typeof window<"u"&&window.innerHeight>667,Z=w.useCallback((_,B)=>{l(_,L,B)},[l,L]),j=w.useCallback(_=>{s&&g(),c&&c(_)},[s,c,g]);process.env.NODE_ENV!=="production"&&!af&&!k.includes(d)&&(console.warn(`MUI: \`openTo="${d}"\` is not a valid prop.`,`It must be an element of \`views=["${k.join('", "')}"]\`.`),af=!0);const{openView:N,setOpenView:I,handleChangeAndOpenNext:F}=gs({view:void 0,views:k,openTo:d,onChange:Z,onViewChange:j}),{focusedView:H,setFocusedView:z}=cD({autoFocus:o,openView:N});return f.jsxs(mD,{ownerState:{isLandscape:R},className:$.root,children:[W&&f.jsx(v,D({},E,{views:k,isLandscape:R,parsedValue:a,onChange:Z,setOpenView:I,openView:N,toolbarTitle:T,toolbarFormat:m,toolbarPlaceholder:y,isMobileKeyboardViewOpen:s,toggleMobileKeyboardView:g})),X&&!!O&&f.jsx(O,D({dateRangeIcon:x,timeIcon:C,view:N,onChange:I},(n=E.componentsProps)==null?void 0:n.tabs)),f.jsx(bs,{children:s?f.jsx(hD,{className:$.mobileKeyboardInputView,children:f.jsx(tf,D({},i,{ignoreInvalidInputs:!0,disableOpenPicker:!0,TextFieldProps:vD}))}):f.jsxs(w.Fragment,{children:[rf(N)&&f.jsx(Nd,D({autoFocus:o,date:a,onViewChange:I,onChange:F,view:N,views:k.filter(rf),focusedView:H,onFocusedViewChange:z},E)),of(N)&&f.jsx(Ld,D({},E,{autoFocus:o,date:a,view:N,views:k.filter(of),onChange:F,onViewChange:I,showViewSwitcher:L==="desktop"}))]})})]})}const yD=({open:e,onOpen:t,onClose:n})=>{const r=w.useRef(typeof e=="boolean").current,[o,a]=w.useState(!1);w.useEffect(()=>{if(r){if(typeof e!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");a(e)}},[r,e]);const i=w.useCallback(s=>{r||a(s),s&&t&&t(),!s&&n&&n()},[r,t,n]);return{isOpen:o,setIsOpen:i}},bD=(e,t)=>{const{onAccept:n,onChange:r,value:o,closeOnSelect:a}=e,i=Je(),{isOpen:s,setIsOpen:l}=yD(e),c=w.useMemo(()=>t.parseInput(i,o),[t,i,o]),[d,p]=w.useState(c),[h,g]=w.useState(()=>({committed:c,draft:c,resetFallback:c})),v=w.useCallback(E=>{g(O=>{switch(E.action){case"setAll":case"acceptAndClose":return{draft:E.value,committed:E.value,resetFallback:E.value};case"setCommitted":return D({},O,{draft:E.value,committed:E.value});case"setDraft":return D({},O,{draft:E.value});default:return O}}),(E.forceOnChangeCall||!E.skipOnChangeCall&&!t.areValuesEqual(i,h.committed,E.value))&&r(E.value),E.action==="acceptAndClose"&&(l(!1),n&&!t.areValuesEqual(i,h.resetFallback,E.value)&&n(E.value))},[n,r,l,h,i,t]);w.useEffect(()=>{i.isValid(c)&&p(c)},[i,c]),w.useEffect(()=>{s&&v({action:"setAll",value:c,skipOnChangeCall:!0})},[s]),t.areValuesEqual(i,h.committed,c)||v({action:"setCommitted",value:c,skipOnChangeCall:!0});const m=w.useMemo(()=>({open:s,onClear:()=>{v({value:t.emptyValue,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,t.emptyValue)})},onAccept:()=>{v({value:h.draft,action:"acceptAndClose",forceOnChangeCall:!t.areValuesEqual(i,o,c)})},onDismiss:()=>{v({value:h.committed,action:"acceptAndClose"})},onCancel:()=>{v({value:h.resetFallback,action:"acceptAndClose"})},onSetToday:()=>{v({value:t.getTodayValue(i),action:"acceptAndClose"})}}),[v,s,i,h,t,o,c]),[y,T]=w.useState(!1),k=w.useMemo(()=>({parsedValue:h.draft,isMobileKeyboardViewOpen:y,toggleMobileKeyboardView:()=>T(!y),onDateChange:(E,O,R="partial")=>{switch(R){case"shallow":return v({action:"setDraft",value:E,skipOnChangeCall:!0});case"partial":return v({action:"setDraft",value:E});case"finish":return v(a??O==="desktop"?{value:E,action:"acceptAndClose"}:{value:E,action:"setCommitted"});default:throw new Error("MUI: Invalid selectionState passed to `onDateChange`")}}}),[v,y,h.draft,a]),x=w.useCallback((E,O)=>{const R=t.valueReducer?t.valueReducer(i,d,E):E;r(R,O)},[r,t,d,i]),C=w.useMemo(()=>({onChange:x,open:s,rawValue:o,openPicker:()=>l(!0)}),[x,s,o,l]),b={pickerProps:k,inputProps:C,wrapperProps:m};return w.useDebugValue(b,()=>({MuiPickerState:{dateState:h,other:b}})),b},xD=["onChange","PopperProps","PaperProps","ToolbarComponent","TransitionComponent","value","components","componentsProps"],sf=w.forwardRef(function(t,n){const r=qT(t,"MuiDesktopDatePicker"),o=YC(r)!==null,{pickerProps:a,inputProps:i,wrapperProps:s}=bD(r,GT),{PopperProps:l,PaperProps:c,ToolbarComponent:d=CP,TransitionComponent:p,components:h,componentsProps:g}=r,v=de(r,xD),m=D({},i,v,{components:h,componentsProps:g,ref:n,validationError:o});return f.jsx(KP,D({},s,{DateInputProps:m,KeyboardDateInputComponent:tf,PopperProps:l,PaperProps:c,TransitionComponent:p,components:h,componentsProps:g,children:f.jsx(gD,D({},a,{autoFocus:!0,toolbarTitle:r.label||r.toolbarTitle,ToolbarComponent:d,DateInputProps:m,components:h,componentsProps:g},v))}))});process.env.NODE_ENV!=="production"&&(sf.propTypes={acceptRegex:u.instanceOf(RegExp),autoFocus:u.bool,children:u.node,className:u.string,closeOnSelect:u.bool,components:u.object,componentsProps:u.object,dayOfWeekFormatter:u.func,defaultCalendarMonth:u.any,disabled:u.bool,disableFuture:u.bool,disableHighlightToday:u.bool,disableMaskedInput:u.bool,disableOpenPicker:u.bool,disablePast:u.bool,getOpenDialogAriaText:u.func,getViewSwitchingButtonText:u.func,ignoreInvalidInputs:u.bool,InputAdornmentProps:u.object,inputFormat:u.string,InputProps:u.object,inputRef:u.oneOfType([u.func,u.shape({current:u.object})]),label:u.node,leftArrowButtonText:u.string,loading:u.bool,mask:u.string,maxDate:u.any,minDate:u.any,onAccept:u.func,onChange:u.func.isRequired,onClose:u.func,onError:u.func,onMonthChange:u.func,onOpen:u.func,onViewChange:u.func,onYearChange:u.func,open:u.bool,OpenPickerButtonProps:u.object,openTo:u.oneOf(["day","month","year"]),orientation:u.oneOf(["landscape","portrait"]),PaperProps:u.object,PopperProps:u.object,readOnly:u.bool,reduceAnimations:u.bool,renderDay:u.func,renderInput:u.func.isRequired,renderLoading:u.func,rifmFormatter:u.func,rightArrowButtonText:u.string,shouldDisableDate:u.func,shouldDisableMonth:u.func,shouldDisableYear:u.func,showDaysOutsideCurrentMonth:u.bool,showToolbar:u.bool,ToolbarComponent:u.elementType,toolbarFormat:u.string,toolbarPlaceholder:u.node,toolbarTitle:u.node,TransitionComponent:u.elementType,value:u.any,views:u.arrayOf(u.oneOf(["day","month","year"]).isRequired)});const Es=({title:e,value:t,readonly:n,onChange:r,required:o,id:a,fullWidth:i=!0})=>f.jsx(sf,{disabled:n,label:e,value:t,onChange:s=>r(s),renderInput:s=>{var c,d,p;let l;return(c=s.inputProps)!=null&&c.placeholder&&(l=(p=(d=s.inputProps)==null?void 0:d.placeholder)==null?void 0:p.slice(),s.inputProps.placeholder=void 0),f.jsx(V.TextField,{...s,required:o,sx:{width:"100%"},placeholder:l,autoComplete:"off",variant:"standard",error:!1})}});var Ts={},wD=pt;Object.defineProperty(Ts,"__esModule",{value:!0});var Ps=Ts.default=void 0,CD=wD(yt()),ED=f,TD=(0,CD.default)((0,ED.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");Ps=Ts.default=TD;var Ds={},PD=pt;Object.defineProperty(Ds,"__esModule",{value:!0});var uf=Ds.default=void 0,DD=PD(yt()),OD=f,MD=(0,DD.default)((0,OD.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}),"Delete");uf=Ds.default=MD;const kD=({dates:e,readonly:t,onChange:n,title:r})=>{const[o,a]=S.useState(Math.random()),[i,s]=S.useState(e??[null]),{ToIsoWithoutTimeZone:l,ParseDataToRusLocale:c}=Lr();S.useEffect(()=>{n(i.filter(h=>!!h&&Date.parse(h)).map(h=>l(h)).join(","))},[i]);const d=()=>{s(h=>[...h,null]),a(Math.random())},p=h=>{s(g=>[...g.filter((v,m)=>m!==h)]),a(Math.random())};return i.length<2?f.jsx(Xo,{dateAdapter:ds,locale:ps,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Es,{id:"",title:r??"День рождения родственника",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(g=>(g[i.length-1]=h,[...g]))}),!!Date.parse(i[0]??"")&&!t&&f.jsx(V.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Ps,{})})]})}):f.jsxs("div",{children:[f.jsx("div",{style:{marginBottom:"1em"},children:"День рождения родственников"}),f.jsx("div",{style:{borderLeft:"solid 1px #cccccc50",paddingLeft:"1em"},children:f.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[f.jsx("div",{style:{display:"flex",gap:"1em",flexWrap:"wrap"},children:i.filter((h,g)=>g<i.length-1).map((h,g)=>f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em",backgroundColor:"rgba(204, 204, 204, 0.5)",padding:"0 .5em",borderRadius:"5px"},children:[f.jsx("div",{children:h&&c(h.toString())}),f.jsx("div",{children:!t&&f.jsx(V.IconButton,{size:"small",color:"primary",onClick:()=>p(g),children:f.jsx(uf,{})})})]},g))}),f.jsx("div",{children:f.jsx(Xo,{dateAdapter:ds,locale:ps,children:f.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1em"},children:[f.jsx(Es,{id:"",title:"День рождения",value:i[i.length-1],required:!1,readonly:t,fullWidth:!1,onChange:h=>s(g=>(g[i.length-1]=h,[...g]))}),!t&&f.jsx(V.IconButton,{sx:{marginTop:"12px"},color:"primary",onClick:()=>d(),children:f.jsx(Ps,{})})]})})})]})})]})},_D=({id:e,defaultChecked:t,title:n,readonly:r,required:o,onChange:a,value:i})=>{const s=V.useTheme(),l=(c,d=!1)=>{if(!o)return;const p=new CustomEvent(Br,{detail:{id:e,empty:!c,label:n}});document.dispatchEvent(p)};return S.useEffect(()=>{setTimeout(()=>l(i),1)},[]),S.useEffect(()=>{l(i,!0)},[i]),f.jsxs("div",{style:{display:"flex",gap:"1em",alignItems:"center"},children:[f.jsx(V.Checkbox,{required:o,sx:{padding:0},readOnly:r,checked:i,onChange:()=>a(!i)}),f.jsx(V.Box,{sx:{fontSize:"1rem",a:{color:s.palette.info.main,textDecoration:"none"}},component:"div",dangerouslySetInnerHTML:{__html:n}})]})},SD=({control:e,isReg:t,readonlyControls:n,onChangeRadio:r})=>{var a,i,s,l,c,d;const o=(p,h=!1)=>{if(!e.validation.required)return;const g=new CustomEvent(Br,{detail:{id:e.id,empty:!p,label:e.title}});document.dispatchEvent(g)};return S.useEffect(()=>{setTimeout(()=>{var p,h;return o((h=(p=e.values)==null?void 0:p.find(g=>g.selected))==null?void 0:h.id)},1)},[]),f.jsx(V.Box,{sx:{minWidth:120},children:f.jsxs(V.FormControl,{fullWidth:!0,variant:"standard",required:(a=e==null?void 0:e.validation)==null?void 0:a.required,children:[f.jsx(V.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(V.Select,{required:(i=e==null?void 0:e.validation)==null?void 0:i.required,readOnly:!t&&((s=e==null?void 0:e.validation)==null?void 0:s.readOnly)&&(n==null?void 0:n.includes(e.id)),labelId:`select-${e.id}`,value:((c=(l=e.values)==null?void 0:l.find(p=>p.selected))==null?void 0:c.id)||"",label:e.title,onChange:p=>{var g,v;(g=e.values)==null||g.filter(m=>m.id!==p.target.value).forEach(m=>m.selected=!1);let h=(v=e.values)==null?void 0:v.find(m=>m.id===p.target.value);h&&(o(!0,!0),h.selected=!0),r({...e,values:e.values})},children:(d=e.values)==null?void 0:d.map(p=>f.jsx(V.MenuItem,{value:p.id,children:p.text},p.id))})]})})},$D=({control:e,value:t,onChange:n,onChangeRadio:r,onChangeChecked:o,isReg:a,readonlyControls:i})=>{var s,l,c,d,p,h,g,v;switch(e.type){case Nn.Textbox:return f.jsx(Yo,{value:t,onChange:m=>n(m.target.value),required:(s=e==null?void 0:e.validation)==null?void 0:s.required,id:e.id,label:e.title,disabled:!a&&((l=e==null?void 0:e.validation)==null?void 0:l.readOnly)&&(i==null?void 0:i.includes(e.id)),autoComplete:"off",variant:"standard",fullWidth:!0});case Nn.RadiobuttonGroup:return f.jsx(SD,{control:e,isReg:a,readonlyControls:i,onChangeRadio:r});case Nn.Select:return f.jsx(V.Box,{sx:{minWidth:120,maxHeight:"400px"},children:f.jsxs(V.FormControl,{fullWidth:!0,variant:"standard",required:(c=e==null?void 0:e.validation)==null?void 0:c.required,children:[f.jsx(V.InputLabel,{id:`select-${e.id}`,children:e.title}),f.jsx(V.Select,{sx:{maxHeight:"300px"},readOnly:!a&&((d=e==null?void 0:e.validation)==null?void 0:d.readOnly)&&(i==null?void 0:i.includes(e.id)),labelId:`select-${e.id}`,value:e.text,label:e.title,onChange:m=>n(m.target.value),children:(p=e.values)==null?void 0:p.map(m=>f.jsx(V.MenuItem,{value:m.id,children:m.text},m.id))})]})});case Nn.Date:return f.jsx(Xo,{dateAdapter:ds,locale:ps,children:f.jsx(Es,{id:e.id,title:e.title,value:t,readonly:!a&&((h=e==null?void 0:e.validation)==null?void 0:h.readOnly)&&!!(i!=null&&i.includes(e.id)),onChange:m=>n(m),required:(g=e==null?void 0:e.validation)==null?void 0:g.required})});case Nn.ParentBirthday:return f.jsx(kD,{title:e.title,onChange:m=>n(m),readonly:!a,dates:e.dates??[null]});case Nn.Checkbox:return f.jsx(_D,{id:e.id,onChange:m=>o(m),required:(v=e==null?void 0:e.validation)==null?void 0:v.required,readonly:!a,value:e.checked,title:e.title,defaultChecked:e.defaultChecked})}return f.jsx("div",{})},ND=e=>{const t=()=>{const r=new RegExp(/^\.*/);return e.type!==null?e.type===Hr.Email?new RegExp(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/):e.type===Hr.Url||e.type===Hr.Date?r:e.type===Hr.Phone?new RegExp(/^[+]?[\d]{10,11}$/):r:r},n=r=>{let o=!0;return e!=null&&e.minTextLength&&(o=o&&r.length>=(e==null?void 0:e.minTextLength)),e!=null&&e.maxTextLength&&(o=o&&r.length<=(e==null?void 0:e.maxTextLength)),o};return r=>t().test(r)?n(r)?{isError:!1}:{isError:!0,message:`Строка не удовлетворяет нужному размеру (${e.minTextLength??0}-${e.maxTextLength??255})`}:{isError:!0,message:"Строка введена неверно"}},RD=({onControlsGet:e,buttonSaveText:t,isReg:n=!1,previewControls:r})=>{const{apiAxios:o,additionalData:a,VKUserId:i,setCabinetSettings:s,setPhoneNumber:l,telegramInfo:c}=S.useContext(ft),{setIsLoading:d}=S.useContext(ln),{showErrorAlert:p}=S.useContext(tn),{setOpenedPage:h}=S.useContext(hr),[g,v]=S.useState(!1),[m,y]=S.useState(r??[]);S.useEffect(()=>{y(r??[])},[r]);const[T,k]=S.useState([]),[x,C]=S.useState(Math.random()),[b,E]=S.useState(!1),{validationPopup:O,formIsValid:R,setValidations:L}=zi({}),{ToIsoWithoutTimeZone:$}=Lr();S.useEffect(()=>{L(m.map(F=>({id:F.id,label:F.title,validator:ND(F.validation)})))},[m]);const W=()=>{const F={};return m.map(H=>F[H.id]=H.text),F};S.useEffect(()=>{r||(async()=>{d("GetControls",!0);const H=await o().post("/externalCustomerCabinet/form/registration",{});e==null||e(H.data.controls),y(H.data.controls),k(H.data.controls.filter(z=>{var _;return((_=z.validation)==null?void 0:_.readOnly)&&!!z.text})),d("GetControls",!1)})()},[]);const X=()=>{R()&&!r&&(E(!0),o().patch("/externalCustomerCabinet/form/registration",{controls:m,...a,VKUserId:i,...c??{}}).then(F=>{s(H=>({...H,isReg:!1})),l(F.data.phoneNumber),v(!0),h("info"),k(m.filter(H=>{var z;return((z=H.validation)==null?void 0:z.readOnly)&&!!H.text}))}).catch(F=>{p(F.response.data.msg)}).finally(()=>{E(!1)}))},Z=(F,H)=>{Date.parse(H)&&(H=$(H)),y(z=>{const _=z.find(B=>B.id===F);return _&&(_.text=H),[...z]})},j=(F,H)=>{y(z=>{const _=z.find(B=>B.id===F);return _&&(_.checked=H),[...z]})},N=F=>{y(H=>{let z=H.find(_=>_.id===F.id);return z&&(z={...F},C(Math.random())),[...H]})};return{controlsForm:f.jsxs(V.Container,{maxWidth:"sm",children:[O,f.jsxs(V.Typography,{component:"div",style:{display:"flex",flexDirection:"column",gap:"1.5em",marginBottom:"1em"},children:[f.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1em"},children:m==null?void 0:m.map((F,H)=>f.jsx("div",{children:f.jsx($D,{isReg:n,control:F,onChange:z=>Z(F.id,z),onChangeChecked:z=>j(F.id,z),onChangeRadio:z=>N(z),value:F.text??"",readonlyControls:T.map(z=>z.id)})},H))}),f.jsx("div",{style:{display:"flex",justifyContent:"center"},children:f.jsx(Hi,{isLoading:b,onClick:()=>X(),children:t||"Сохранить анкету"})})]})]}),setControls:y,saved:g,setSaved:v,GetObjectByControls:W}},jD=()=>{S.useContext(ft);const{controlsForm:e,saved:t,setSaved:n}=RD({buttonSaveText:"Регистрация",isReg:!0});return f.jsx("div",{children:f.jsxs("div",{children:[f.jsx(Vo,{style:{marginBottom:"1em"},children:"Для использования полного функционала бота необходимо зарегистрироваться"}),e]})})},AD={theme:null,toggleColorMode:null,setTheme:()=>{}},Os=S.createContext(AD),ID=()=>{const[e,t]=S.useState(Pa);return{theme:e,setTheme:t,toggleColorMode:r=>{const o=V.createTheme({palette:{mode:r}});t(a=>({...o,palette:{...o.palette,primary:{...o.palette.primary,main:a.palette.primary.main}}}))}}},LD=({children:e})=>{const t=ID();return f.jsx(Os.Provider,{value:t,children:f.jsxs(V.ThemeProvider,{theme:t.theme,children:[f.jsx(V.CssBaseline,{}),e]})})},BD=({showHeader:e})=>{var g;const{cabinetSettings:t,cabinetUISettings:n}=S.useContext(ft),{setTheme:r,theme:o}=S.useContext(Os),{isLoading:a}=S.useContext(ln),{openedPage:i,setOpenedPage:s}=S.useContext(hr),l=(v,m)=>{s(m)};S.useEffect(()=>{r(v=>({...Pa,palette:{...v.palette,primary:{...v.palette.primary,main:(n==null?void 0:n.themeColor)||"#6c97a9"}}}))},[n]);const{popups:c,closePopupById:d}=S.useContext(tn),h=[{icon:f.jsx($l,{}),value:"info",label:"Карта",page:f.jsx(k0,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Sl,{}),value:"receipt",label:"История",page:f.jsx(sb,{}),active:!0,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Nl,{}),value:"appeals",label:"Обращения",page:f.jsx(Vb,{}),active:t==null?void 0:t.canShowAppeals,disabled:t==null?void 0:t.isReg},{icon:f.jsx(jo,{}),value:"businessInfo",label:"Информация",page:f.jsx(ub,{}),active:t==null?void 0:t.canShowBusinessInfo,disabled:t==null?void 0:t.isReg},{icon:f.jsx(Rl,{}),value:"registration",label:"Регистрация",page:f.jsx(jD,{}),active:t==null?void 0:t.isReg,disabled:!1}].filter(v=>v.active&&!v.disabled);return f.jsxs(V.Box,{sx:{bgcolor:"background.default"},className:"page_view",children:[e&&f.jsx(As,{}),f.jsx(Ub,{show:a}),c.map((v,m)=>f.jsx(sc,{title:v.title,opened:!0,setOpened:()=>d(v.id),children:f.jsx("div",{children:v.content})})),f.jsx("div",{className:"page_view__page scrollbar",children:(g=h.find(v=>v.value===i))==null?void 0:g.page}),f.jsx("div",{className:"page_view__navigation",children:f.jsx("div",{children:f.jsx(V.BottomNavigation,{sx:{paddingBottom:"2em",borderTop:"solid 1px #cccccc50"},value:i,onChange:l,children:h.map((v,m)=>f.jsx(V.BottomNavigationAction,{sx:{padding:"0",minWidth:"56px"},label:v.label,value:v.value,icon:v.icon},m))})})})]})};Ye.AppContext=ft,Ye.AppProvider=_f,Ye.BonusPlusThemeContext=Os,Ye.BonusPlusThemeProvider=LD,Ye.ErrorBoundary=Sf,Ye.Header=As,Ye.LoadingContext=ln,Ye.LoadingProvider=Tf,Ye.PageContext=hr,Ye.PageProvider=Of,Ye.PopupContext=tn,Ye.PopupProvider=Ky,Ye.Router=BD,Object.defineProperty(Ye,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bonuspluscomponents",
3
3
  "private": false,
4
- "version": "0.0.163",
4
+ "version": "0.0.164",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",