2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
/*! For license information please see 875.js.LICENSE.txt */
|
|
"use strict";(self.webpackChunkkms=self.webpackChunkkms||[]).push([[875],{1020:(t,e,n)=>{var i=n(4914),o=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,n){var i,r={},c=null,l=null;for(i in void 0!==n&&(c=""+n),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(l=e.ref),e)a.call(e,i)&&!u.hasOwnProperty(i)&&(r[i]=e[i]);if(t&&t.defaultProps)for(i in e=t.defaultProps)void 0===r[i]&&(r[i]=e[i]);return{$$typeof:o,type:t,key:c,ref:l,props:r,_owner:s.current}}e.Fragment=r,e.jsx=c,e.jsxs=c},3875:(t,e,n)=>{n.r(e),n.d(e,{Notifications:()=>Y,cleanNotifications:()=>f,cleanNotificationsQueue:()=>h,createNotificationsStore:()=>a,hideNotification:()=>d,notifications:()=>m,notificationsStore:()=>s,showNotification:()=>l,updateNotification:()=>p,updateNotificationsState:()=>c,useNotifications:()=>u});var i=n(8705),o=n(4914),r=n.n(o);const a=()=>function(){let t={notifications:[],queue:[],defaultPosition:"bottom-right",limit:5},e=!1;const n=new Set;return{getState:()=>t,updateState(e){t="function"==typeof e?e(t):e},setState(e){this.updateState(e),n.forEach(e=>e(t))},initialize(n){e||(t=n,e=!0)},subscribe:t=>(n.add(t),()=>n.delete(t))}}(),s=a(),u=(t=s)=>function(t){return(0,o.useSyncExternalStore)(t.subscribe,()=>t.getState(),()=>t.getState())}(t);function c(t,e){const n=t.getState(),i=function(t,e,n){const i=[],o=[],r={};for(const a of t){const t=a.position||e;r[t]=r[t]||0,r[t]+=1,r[t]<=n?o.push(a):i.push(a)}return{notifications:o,queue:i}}(e([...n.notifications,...n.queue]),n.defaultPosition,n.limit);t.setState({notifications:i.notifications,queue:i.queue,limit:n.limit,defaultPosition:n.defaultPosition})}function l(t,e=s){const n=t.id||(0,i.randomId)();return c(e,e=>t.id&&e.some(e=>e.id===t.id)?e:[...e,{...t,id:n}]),n}function d(t,e=s){return c(e,e=>e.filter(e=>e.id!==t||(e.onClose?.(e),!1))),t}function p(t,e=s){return c(e,e=>e.map(e=>e.id===t.id?{...e,...t}:e)),t.id}function f(t=s){c(t,()=>[])}function h(t=s){c(t,e=>e.slice(0,t.getState().limit))}const m={show:l,hide:d,update:p,clean:f,cleanQueue:h,updateState:c};var x=n(4848),E=n(8587);function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function b(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,v(t,e)}var g=n(6672),y=n.n(g);const S=r().createContext(null);var N="unmounted",O="exited",C="entering",k="entered",R="exiting",j=function(t){function e(e,n){var i;i=t.call(this,e,n)||this;var o,r=n&&!n.isMounting?e.enter:e.appear;return i.appearStatus=null,e.in?r?(o=O,i.appearStatus=C):o=k:o=e.unmountOnExit||e.mountOnEnter?N:O,i.state={status:o},i.nextCallback=null,i}b(e,t),e.getDerivedStateFromProps=function(t,e){return t.in&&e.status===N?{status:O}:null};var n=e.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(t){var e=null;if(t!==this.props){var n=this.state.status;this.props.in?n!==C&&n!==k&&(e=C):n!==C&&n!==k||(e=R)}this.updateStatus(!1,e)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var t,e,n,i=this.props.timeout;return t=e=n=i,null!=i&&"number"!=typeof i&&(t=i.exit,e=i.enter,n=void 0!==i.appear?i.appear:e),{exit:t,enter:e,appear:n}},n.updateStatus=function(t,e){if(void 0===t&&(t=!1),null!==e)if(this.cancelNextCallback(),e===C){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:y().findDOMNode(this);n&&function(t){t.scrollTop}(n)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===O&&this.setState({status:N})},n.performEnter=function(t){var e=this,n=this.props.enter,i=this.context?this.context.isMounting:t,o=this.props.nodeRef?[i]:[y().findDOMNode(this),i],r=o[0],a=o[1],s=this.getTimeouts(),u=i?s.appear:s.enter;t||n?(this.props.onEnter(r,a),this.safeSetState({status:C},function(){e.props.onEntering(r,a),e.onTransitionEnd(u,function(){e.safeSetState({status:k},function(){e.props.onEntered(r,a)})})})):this.safeSetState({status:k},function(){e.props.onEntered(r)})},n.performExit=function(){var t=this,e=this.props.exit,n=this.getTimeouts(),i=this.props.nodeRef?void 0:y().findDOMNode(this);e?(this.props.onExit(i),this.safeSetState({status:R},function(){t.props.onExiting(i),t.onTransitionEnd(n.exit,function(){t.safeSetState({status:O},function(){t.props.onExited(i)})})})):this.safeSetState({status:O},function(){t.props.onExited(i)})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(t,e){e=this.setNextCallback(e),this.setState(t,e)},n.setNextCallback=function(t){var e=this,n=!0;return this.nextCallback=function(i){n&&(n=!1,e.nextCallback=null,t(i))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(t,e){this.setNextCallback(e);var n=this.props.nodeRef?this.props.nodeRef.current:y().findDOMNode(this),i=null==t&&!this.props.addEndListener;if(n&&!i){if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],r=o[0],a=o[1];this.props.addEndListener(r,a)}null!=t&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},n.render=function(){var t=this.state.status;if(t===N)return null;var e=this.props,n=e.children,i=(e.in,e.mountOnEnter,e.unmountOnExit,e.appear,e.enter,e.exit,e.timeout,e.addEndListener,e.onEnter,e.onEntering,e.onEntered,e.onExit,e.onExiting,e.onExited,e.nodeRef,(0,E.A)(e,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return r().createElement(S.Provider,{value:null},"function"==typeof n?n(t,i):r().cloneElement(r().Children.only(n),i))},e}(r().Component);function P(){}j.contextType=S,j.propTypes={},j.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:P,onEntering:P,onEntered:P,onExit:P,onExiting:P,onExited:P},j.UNMOUNTED=N,j.EXITED=O,j.ENTERING=C,j.ENTERED=k,j.EXITING=R;const T=j;var w=n(8168);function _(t,e){var n=Object.create(null);return t&&o.Children.map(t,function(t){return t}).forEach(function(t){n[t.key]=function(t){return e&&(0,o.isValidElement)(t)?e(t):t}(t)}),n}function D(t,e,n){return null!=n[e]?n[e]:t.props[e]}function M(t,e,n){var i=_(t.children),r=function(t,e){function n(n){return n in e?e[n]:t[n]}t=t||{},e=e||{};var i,o=Object.create(null),r=[];for(var a in t)a in e?r.length&&(o[a]=r,r=[]):r.push(a);var s={};for(var u in e){if(o[u])for(i=0;i<o[u].length;i++){var c=o[u][i];s[o[u][i]]=n(c)}s[u]=n(u)}for(i=0;i<r.length;i++)s[r[i]]=n(r[i]);return s}(e,i);return Object.keys(r).forEach(function(a){var s=r[a];if((0,o.isValidElement)(s)){var u=a in e,c=a in i,l=e[a],d=(0,o.isValidElement)(l)&&!l.props.in;!c||u&&!d?c||!u||d?c&&u&&(0,o.isValidElement)(l)&&(r[a]=(0,o.cloneElement)(s,{onExited:n.bind(null,s),in:l.props.in,exit:D(s,"exit",t),enter:D(s,"enter",t)})):r[a]=(0,o.cloneElement)(s,{in:!1}):r[a]=(0,o.cloneElement)(s,{onExited:n.bind(null,s),in:!0,exit:D(s,"exit",t),enter:D(s,"enter",t)})}}),r}var I=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},F=function(t){function e(e,n){var i,o=(i=t.call(this,e,n)||this).handleExited.bind(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i));return i.state={contextValue:{isMounting:!0},handleExited:o,firstRender:!0},i}b(e,t);var n=e.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(t,e){var n,i,r=e.children,a=e.handleExited;return{children:e.firstRender?(n=t,i=a,_(n.children,function(t){return(0,o.cloneElement)(t,{onExited:i.bind(null,t),in:!0,appear:D(t,"appear",n),enter:D(t,"enter",n),exit:D(t,"exit",n)})})):M(t,r,a),firstRender:!1}},n.handleExited=function(t,e){var n=_(this.props.children);t.key in n||(t.props.onExited&&t.props.onExited(e),this.mounted&&this.setState(function(e){var n=(0,w.A)({},e.children);return delete n[t.key],{children:n}}))},n.render=function(){var t=this.props,e=t.component,n=t.childFactory,i=(0,E.A)(t,["component","childFactory"]),o=this.state.contextValue,a=I(this.state.children).map(n);return delete i.appear,delete i.enter,delete i.exit,null===e?r().createElement(S.Provider,{value:o},a):r().createElement(S.Provider,{value:o},r().createElement(e,i,a))},e}(r().Component);F.propTypes={},F.defaultProps={component:"div",childFactory:function(t){return t}};const H=F;var L=n(7435);const U=["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right"],V={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},W={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function z({state:t,maxHeight:e,position:n,transitionDuration:i}){const[o,r]=n.split("-"),a="center"===r?`${o}-center`:r,s={opacity:1,transform:W[a]},u={opacity:0,maxHeight:0,transform:V[a]};return{opacity:0,maxHeight:e,transform:V[a],transitionDuration:`${i}ms, ${i}ms, ${i}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height",...{entering:s,entered:s,exiting:u,exited:u}[t]}}const B=(0,o.forwardRef)(({data:t,onHide:e,autoClose:n,...i},r)=>{const{autoClose:a,message:s,...u}=t,c=function(t,e){return"number"==typeof e?e:!1!==e&&!1!==t&&t}(n,t.autoClose),l=(0,o.useRef)(-1),d=()=>window.clearTimeout(l.current),p=()=>{e(t.id),d()},f=()=>{"number"==typeof c&&(l.current=window.setTimeout(p,c))};return(0,o.useEffect)(()=>{t.onOpen?.(t)},[]),(0,o.useEffect)(()=>(f(),d),[c]),(0,x.jsx)(L.Notification,{...i,...u,onClose:p,ref:r,onMouseEnter:d,onMouseLeave:f,children:s})});B.displayName="@mantine/notifications/NotificationContainer";var A={root:"m_b37d9ac7",notification:"m_5ed0edd0"};const X=T,$={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:(0,L.getDefaultZIndex)("overlay"),store:s,withinPortal:!0},q=(0,L.createVarsResolver)((t,{zIndex:e,containerWidth:n})=>({root:{"--notifications-z-index":e?.toString(),"--notifications-container-width":(0,L.rem)(n)}})),Y=(0,L.factory)((t,e)=>{const n=(0,L.useProps)("Notifications",$,t),{classNames:r,className:a,style:s,styles:c,unstyled:l,vars:p,position:f,autoClose:h,transitionDuration:m,containerWidth:E,notificationMaxHeight:v,limit:b,zIndex:g,store:y,portalProps:S,withinPortal:N,...O}=n,C=(0,L.useMantineTheme)(),k=u(y),R=(0,i.useForceUpdate)(),j=(0,i.useReducedMotion)(),P=(0,o.useRef)({}),T=(0,o.useRef)(0),w=C.respectReducedMotion&&j?1:m,_=(0,L.useStyles)({name:"Notifications",classes:A,props:n,className:a,style:s,classNames:r,styles:c,unstyled:l,vars:p,varsResolver:q});(0,o.useEffect)(()=>{y?.updateState(t=>({...t,limit:b||5,defaultPosition:f}))},[b,f]),(0,i.useDidUpdate)(()=>{k.notifications.length>T.current&&setTimeout(()=>R(),0),T.current=k.notifications.length},[k.notifications]);const D=function(t,e){return t.reduce((t,n)=>(t[n.position||e].push(n),t),U.reduce((t,e)=>(t[e]=[],t),{}))}(k.notifications,f),M=U.reduce((t,e)=>(t[e]=D[e].map(({style:t,...n})=>(0,x.jsx)(X,{timeout:w,onEnter:()=>P.current[n.id].offsetHeight,nodeRef:{current:P.current[n.id]},children:i=>(0,x.jsx)(B,{ref:t=>{P.current[n.id]=t},data:n,onHide:t=>d(t,y),autoClose:h,..._("notification",{style:{...z({state:i,position:e,transitionDuration:w,maxHeight:v}),...t}})})},n.id)),t),{});return(0,x.jsxs)(L.OptionalPortal,{withinPortal:N,...S,children:[(0,x.jsx)(L.Box,{..._("root"),"data-position":"top-center",ref:e,...O,children:(0,x.jsx)(H,{children:M["top-center"]})}),(0,x.jsx)(L.Box,{..._("root"),"data-position":"top-left",...O,children:(0,x.jsx)(H,{children:M["top-left"]})}),(0,x.jsx)(L.Box,{..._("root",{className:L.RemoveScroll.classNames.fullWidth}),"data-position":"top-right",...O,children:(0,x.jsx)(H,{children:M["top-right"]})}),(0,x.jsx)(L.Box,{..._("root",{className:L.RemoveScroll.classNames.fullWidth}),"data-position":"bottom-right",...O,children:(0,x.jsx)(H,{children:M["bottom-right"]})}),(0,x.jsx)(L.Box,{..._("root"),"data-position":"bottom-left",...O,children:(0,x.jsx)(H,{children:M["bottom-left"]})}),(0,x.jsx)(L.Box,{..._("root"),"data-position":"bottom-center",...O,children:(0,x.jsx)(H,{children:M["bottom-center"]})})]})});Y.classes=A,Y.displayName="@mantine/notifications/Notifications",Y.show=m.show,Y.hide=m.hide,Y.update=m.update,Y.clean=m.clean,Y.cleanQueue=m.cleanQueue,Y.updateState=m.updateState},4848:(t,e,n)=>{t.exports=n(1020)},8168:(t,e,n)=>{function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},i.apply(null,arguments)}n.d(e,{A:()=>i})},8587:(t,e,n)=>{function i(t,e){if(null==t)return{};var n={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;n[i]=t[i]}return n}n.d(e,{A:()=>i})}}]); |