diff --git a/assets/index-DjXjd-ji.js b/assets/index-CtTqF0HI.js similarity index 99% rename from assets/index-DjXjd-ji.js rename to assets/index-CtTqF0HI.js index 2eb5516..4466ed1 100644 --- a/assets/index-DjXjd-ji.js +++ b/assets/index-CtTqF0HI.js @@ -347,4 +347,4 @@ Error generating stack: `+i.message+` top: ${l}px !important; left: ${u}px !important; } - `),()=>{document.head.removeChild(c)}},[t]),T.jsx(RI,{isPresent:t,childRef:r,sizeRef:o,children:_.cloneElement(e,{ref:r})})}const MI=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:i,mode:s})=>{const a=ep(DI),l=_.useId(),u=_.useMemo(()=>({id:l,initial:t,isPresent:n,custom:o,onExitComplete:c=>{a.set(c,!0);for(const d of a.values())if(!d)return;r&&r()},register:c=>(a.set(c,!1),()=>a.delete(c))}),i?[Math.random()]:[n]);return _.useMemo(()=>{a.forEach((c,d)=>a.set(d,!1))},[n]),_.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),s==="popLayout"&&(e=T.jsx(zI,{isPresent:n,children:e})),T.jsx(Rs.Provider,{value:u,children:e})};function DI(){return new Map}const ya=e=>e.key||"";function mv(e){const t=[];return _.Children.forEach(e,n=>{_.isValidElement(n)&&t.push(n)}),t}const II=({children:e,exitBeforeEnter:t,custom:n,initial:r=!0,onExitComplete:o,presenceAffectsLayout:i=!0,mode:s="sync"})=>{const a=_.useMemo(()=>mv(e),[e]),l=a.map(ya),u=_.useRef(!0),c=_.useRef(a),d=ep(()=>new Map),[p,v]=_.useState(a),[b,y]=_.useState(a);US(()=>{u.current=!1,c.current=a;for(let h=0;h{const m=ya(h),x=a===b||l.includes(m),C=()=>{if(d.has(m))d.set(m,!0);else return;let A=!0;d.forEach($=>{$||(A=!1)}),A&&(f==null||f(),y(c.current),o&&o())};return T.jsx(MI,{isPresent:x,initial:!u.current||r?void 0:!1,custom:x?void 0:n,presenceAffectsLayout:i,mode:s,onExitComplete:x?void 0:C,children:h},m)})})};var FI={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},ax=_.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:o,requestClose:i=!1,position:s="bottom",duration:a=5e3,containerStyle:l,motionVariants:u=FI,toastSpacing:c="0.5rem"}=e,[d,p]=_.useState(a),v=OM();eg(()=>{v||r==null||r()},[v]),eg(()=>{p(a)},[a]);const b=()=>p(null),y=()=>p(a),S=()=>{v&&o()};_.useEffect(()=>{v&&i&&o()},[v,i,o]),l4(S,d);const f=_.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),h=_.useMemo(()=>i4(s),[s]);return T.jsx(sx.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:b,onHoverEnd:y,custom:{position:s},style:h,children:T.jsx(ue.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:f,children:Jt(n,{id:t,onClose:S})})})});ax.displayName="ToastComponent";function jI(e,t){var n;const r=e??"bottom",i={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=i==null?void 0:i[t])!=null?n:r}var gv={path:T.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[T.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),T.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),T.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Go=ze((e,t)=>{const{as:n,viewBox:r,color:o="currentColor",focusable:i=!1,children:s,className:a,__css:l,...u}=e,c=Ge("chakra-icon",a),d=Nr("Icon",e),p={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:o,...l,...d},v={ref:t,focusable:i,className:c,__css:p},b=r??gv.viewBox;if(n&&typeof n!="string")return T.jsx(ue.svg,{as:n,...v,...u});const y=s??gv.path;return T.jsx(ue.svg,{verticalAlign:"middle",viewBox:b,...v,...u,children:y})});Go.displayName="Icon";function ip(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,i=_.Children.toArray(e.path),s=ze((a,l)=>T.jsx(Go,{ref:l,viewBox:t,...o,...a,children:i.length?i:T.jsx("path",{fill:"currentColor",d:n})}));return s.displayName=r,s}function LI(e){return T.jsx(Go,{viewBox:"0 0 24 24",...e,children:T.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function BI(e){return T.jsx(Go,{viewBox:"0 0 24 24",...e,children:T.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function vv(e){return T.jsx(Go,{viewBox:"0 0 24 24",...e,children:T.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var VI=C2({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),sp=ze((e,t)=>{const n=Nr("Spinner",e),{label:r="Loading...",thickness:o="2px",speed:i="0.45s",emptyColor:s="transparent",className:a,...l}=Mn(e),u=Ge("chakra-spinner",a),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:o,borderBottomColor:s,borderLeftColor:s,animation:`${VI} ${i} linear infinite`,...n};return T.jsx(ue.div,{ref:t,__css:c,className:u,...l,children:r&&T.jsx(ue.span,{srOnly:!0,children:r})})});sp.displayName="Spinner";var[OI,ap]=lr({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[NI,lp]=lr({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),lx={info:{icon:BI,colorScheme:"blue"},warning:{icon:vv,colorScheme:"orange"},success:{icon:LI,colorScheme:"green"},error:{icon:vv,colorScheme:"red"},loading:{icon:sp,colorScheme:"blue"}};function WI(e){return lx[e].colorScheme}function UI(e){return lx[e].icon}var ux=ze(function(t,n){const r=lp(),{status:o}=ap(),i={display:"inline",...r.description};return T.jsx(ue.div,{ref:n,"data-status":o,...t,className:Ge("chakra-alert__desc",t.className),__css:i})});ux.displayName="AlertDescription";function cx(e){const{status:t}=ap(),n=UI(t),r=lp(),o=t==="loading"?r.spinner:r.icon;return T.jsx(ue.span,{display:"inherit","data-status":t,...e,className:Ge("chakra-alert__icon",e.className),__css:o,children:e.children||T.jsx(n,{h:"100%",w:"100%"})})}cx.displayName="AlertIcon";var dx=ze(function(t,n){const r=lp(),{status:o}=ap();return T.jsx(ue.div,{ref:n,"data-status":o,...t,className:Ge("chakra-alert__title",t.className),__css:r.title})});dx.displayName="AlertTitle";var fx=ze(function(t,n){var r;const{status:o="info",addRole:i=!0,...s}=Mn(t),a=(r=t.colorScheme)!=null?r:WI(o),l=Ah("Alert",{...t,colorScheme:a}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return T.jsx(OI,{value:{status:o},children:T.jsx(NI,{value:l,children:T.jsx(ue.div,{"data-status":o,role:i?"alert":void 0,ref:n,...s,className:Ge("chakra-alert",t.className),__css:u})})})});fx.displayName="Alert";function HI(e){return T.jsx(Go,{focusable:"false","aria-hidden":!0,...e,children:T.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var hx=ze(function(t,n){const r=Nr("CloseButton",t),{children:o,isDisabled:i,__css:s,...a}=Mn(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return T.jsx(ue.button,{type:"button","aria-label":"Close",ref:n,disabled:i,__css:{...l,...r,...s},...a,children:o||T.jsx(HI,{width:"1em",height:"1em"})})});hx.displayName="CloseButton";var KI={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},Zt=GI(KI);function GI(e){let t=e;const n=new Set,r=o=>{t=o(t),n.forEach(i=>i())};return{getState:()=>t,subscribe:o=>(n.add(o),()=>{r(()=>e),n.delete(o)}),removeToast:(o,i)=>{r(s=>({...s,[i]:s[i].filter(a=>a.id!=o)}))},notify:(o,i)=>{const s=YI(o,i),{position:a,id:l}=s;return r(u=>{var c,d;const v=a.includes("top")?[s,...(c=u[a])!=null?c:[]]:[...(d=u[a])!=null?d:[],s];return{...u,[a]:v}}),l},update:(o,i)=>{o&&r(s=>{const a={...s},{position:l,index:u}=J0(a,o);return l&&u!==-1&&(a[l][u]={...a[l][u],...i,message:px(i)}),a})},closeAll:({positions:o}={})=>{r(i=>(o??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=i[u].map(c=>({...c,requestClose:!0})),l),{...i}))},close:o=>{r(i=>{const s=Mb(i,o);return s?{...i,[s]:i[s].map(a=>a.id==o?{...a,requestClose:!0}:a)}:i})},isActive:o=>!!J0(Zt.getState(),o).position}}var yv=0;function YI(e,t={}){var n,r;yv+=1;const o=(n=t.id)!=null?n:yv,i=(r=t.position)!=null?r:"bottom";return{id:o,message:e,position:i,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>Zt.removeToast(String(o),i),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var XI=e=>{const{status:t,variant:n="solid",id:r,title:o,isClosable:i,onClose:s,description:a,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return T.jsxs(fx,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[T.jsx(cx,{children:u}),T.jsxs(ue.div,{flex:"1",maxWidth:"100%",children:[o&&T.jsx(dx,{id:c==null?void 0:c.title,children:o}),a&&T.jsx(ux,{id:c==null?void 0:c.description,display:"block",children:a})]}),i&&T.jsx(hx,{size:"sm",onClick:s,position:"absolute",insetEnd:1,top:1})]})};function px(e={}){const{render:t,toastComponent:n=XI}=e;return o=>typeof t=="function"?t({...o,...e}):T.jsx(n,{...o,...e})}function qI(e,t){const n=o=>{var i;return{...t,...o,position:jI((i=o==null?void 0:o.position)!=null?i:t==null?void 0:t.position,e)}},r=o=>{const i=n(o),s=px(i);return Zt.notify(s,i)};return r.update=(o,i)=>{Zt.update(o,n(i))},r.promise=(o,i)=>{const s=r({...i.loading,status:"loading",duration:null});o.then(a=>r.update(s,{status:"success",duration:5e3,...Jt(i.success,a)})).catch(a=>r.update(s,{status:"error",duration:5e3,...Jt(i.error,a)}))},r.closeAll=Zt.closeAll,r.close=Zt.close,r.isActive=Zt.isActive,r}var[QI,ZI]=lr({name:"ToastOptionsContext",strict:!1}),JI=e=>{const t=_.useSyncExternalStore(Zt.subscribe,Zt.getState,Zt.getState),{motionVariants:n,component:r=ax,portalProps:o}=e,s=Object.keys(t).map(a=>{const l=t[a];return T.jsx("div",{role:"region","aria-live":"polite","aria-label":`Notifications-${a}`,id:`chakra-toast-manager-${a}`,style:s4(a),children:T.jsx(II,{initial:!1,children:l.map(u=>T.jsx(r,{motionVariants:n,...u},u.id))})},a)});return T.jsx(du,{...o,children:s})};function eF(e){const{theme:t}=ib(),n=ZI();return _.useMemo(()=>qI(t.direction,{...n,...e}),[e,t.direction,n])}var tF=e=>function({children:n,theme:r=e,toastOptions:o,...i}){return T.jsxs(r4,{theme:r,...i,children:[T.jsx(QI,{value:o==null?void 0:o.defaultOptions,children:n}),T.jsx(JI,{...o})]})},nF=tF(T3);function rF(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function hf(...e){return t=>{e.forEach(n=>{rF(n,t)})}}function oF(...e){return _.useMemo(()=>hf(...e),e)}function iF(e){return _.Children.toArray(e).filter(t=>_.isValidElement(t))}var[zF,sF]=lr({strict:!1,name:"ButtonGroupContext"});function aF(e){const[t,n]=_.useState(!e);return{ref:_.useCallback(i=>{i&&n(i.tagName==="BUTTON")},[]),type:t?"button":void 0}}function pf(e){const{children:t,className:n,...r}=e,o=_.isValidElement(t)?_.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,i=Ge("chakra-button__icon",n);return T.jsx(ue.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:i,children:o})}pf.displayName="ButtonIcon";function mf(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=T.jsx(sp,{color:"currentColor",width:"1em",height:"1em"}),className:i,__css:s,...a}=e,l=Ge("chakra-button__spinner",i),u=n==="start"?"marginEnd":"marginStart",c=_.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[u]:t?r:0,fontSize:"1em",lineHeight:"normal",...s}),[s,t,u,r]);return T.jsx(ue.div,{className:l,...a,__css:c,children:o})}mf.displayName="ButtonSpinner";var up=ze((e,t)=>{const n=sF(),r=Nr("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:i,isActive:s,children:a,leftIcon:l,rightIcon:u,loadingText:c,iconSpacing:d="0.5rem",type:p,spinner:v,spinnerPlacement:b="start",className:y,as:S,...f}=Mn(e),h=_.useMemo(()=>{const A={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:A}}},[r,n]),{ref:m,type:x}=aF(S),C={rightIcon:u,leftIcon:l,iconSpacing:d,children:a};return T.jsxs(ue.button,{ref:oF(t,m),as:S,type:p??x,"data-active":Gt(s),"data-loading":Gt(i),__css:h,className:Ge("chakra-button",y),...f,disabled:o||i,children:[i&&b==="start"&&T.jsx(mf,{className:"chakra-button__spinner--start",label:c,placement:"start",spacing:d,children:v}),i?c||T.jsx(ue.span,{opacity:0,children:T.jsx(bv,{...C})}):T.jsx(bv,{...C}),i&&b==="end"&&T.jsx(mf,{className:"chakra-button__spinner--end",label:c,placement:"end",spacing:d,children:v})]})});up.displayName="Button";function bv(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return T.jsxs(T.Fragment,{children:[t&&T.jsx(pf,{marginEnd:o,children:t}),r,n&&T.jsx(pf,{marginStart:o,children:n})]})}var cp=ze((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":i,...s}=e,a=n||r,l=_.isValidElement(a)?_.cloneElement(a,{"aria-hidden":!0,focusable:!1}):null;return T.jsx(up,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":i,...s,children:l})});cp.displayName="IconButton";var[lF,uF]=lr({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[cF,mx]=lr({strict:!1,name:"FormControlContext"});function dF(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:i,...s}=e,a=_.useId(),l=t||`field-${a}`,u=`${l}-label`,c=`${l}-feedback`,d=`${l}-helptext`,[p,v]=_.useState(!1),[b,y]=_.useState(!1),[S,f]=_.useState(!1),h=_.useCallback(($={},P=null)=>({id:d,...$,ref:hf(P,D=>{D&&y(!0)})}),[d]),m=_.useCallback(($={},P=null)=>({...$,ref:P,"data-focus":Gt(S),"data-disabled":Gt(o),"data-invalid":Gt(r),"data-readonly":Gt(i),id:$.id!==void 0?$.id:u,htmlFor:$.htmlFor!==void 0?$.htmlFor:l}),[l,o,S,r,i,u]),x=_.useCallback(($={},P=null)=>({id:c,...$,ref:hf(P,D=>{D&&v(!0)}),"aria-live":"polite"}),[c]),C=_.useCallback(($={},P=null)=>({...$,...s,ref:P,role:"group","data-focus":Gt(S),"data-disabled":Gt(o),"data-invalid":Gt(r),"data-readonly":Gt(i)}),[s,o,S,r,i]),A=_.useCallback(($={},P=null)=>({...$,ref:P,role:"presentation","aria-hidden":!0,children:$.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!i,isDisabled:!!o,isFocused:!!S,onFocus:()=>f(!0),onBlur:()=>f(!1),hasFeedbackText:p,setHasFeedbackText:v,hasHelpText:b,setHasHelpText:y,id:l,labelId:u,feedbackId:c,helpTextId:d,htmlProps:s,getHelpTextProps:h,getErrorMessageProps:x,getRootProps:C,getLabelProps:m,getRequiredIndicatorProps:A}}var fF=ze(function(t,n){const r=Ah("Form",t),o=Mn(t),{getRootProps:i,htmlProps:s,...a}=dF(o),l=Ge("chakra-form-control",t.className);return T.jsx(cF,{value:a,children:T.jsx(lF,{value:r,children:T.jsx(ue.div,{...i({},n),className:l,__css:r.container})})})});fF.displayName="FormControl";var hF=ze(function(t,n){const r=mx(),o=uF(),i=Ge("chakra-form__helper-text",t.className);return T.jsx(ue.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:i})});hF.displayName="FormHelperText";function pF(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...i}=mF(e);return{...i,disabled:t,readOnly:r,required:o,"aria-invalid":hc(n),"aria-required":hc(o),"aria-readonly":hc(r)}}function mF(e){var t,n,r;const o=mx(),{id:i,disabled:s,readOnly:a,required:l,isRequired:u,isInvalid:c,isReadOnly:d,isDisabled:p,onFocus:v,onBlur:b,...y}=e,S=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&S.push(o.feedbackId),o!=null&&o.hasHelpText&&S.push(o.helpTextId),{...y,"aria-describedby":S.join(" ")||void 0,id:i??(o==null?void 0:o.id),isDisabled:(t=s??p)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=a??d)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=l??u)!=null?r:o==null?void 0:o.isRequired,isInvalid:c??(o==null?void 0:o.isInvalid),onFocus:a0(o==null?void 0:o.onFocus,v),onBlur:a0(o==null?void 0:o.onBlur,b)}}var dp=ze(function(t,n){const{htmlSize:r,...o}=t,i=Ah("Input",o),s=Mn(o),a=pF(s),l=Ge("chakra-input",t.className);return T.jsx(ue.input,{size:r,...a,__css:i.field,ref:n,className:l})});dp.displayName="Input";dp.id="Input";function gF(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Ot(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var gx=ue("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});gx.displayName="Spacer";var vx=ze(function(t,n){const r=Nr("Text",t),{className:o,align:i,decoration:s,casing:a,...l}=Mn(t),u=O3({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return T.jsx(ue.p,{ref:n,className:Ge("chakra-text",t.className),...u,...l,__css:r})});vx.displayName="Text";var yx=e=>T.jsx(ue.div,{className:"chakra-stack__divider",...e,__css:{...e.__css,borderWidth:0,alignSelf:"stretch",borderColor:"inherit",width:"auto",height:"auto"}});yx.displayName="StackDivider";var bx=e=>T.jsx(ue.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});bx.displayName="StackItem";function vF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":gF(n,o=>r[o])}}var fp=ze((e,t)=>{const{isInline:n,direction:r,align:o,justify:i,spacing:s="0.5rem",wrap:a,children:l,divider:u,className:c,shouldWrapChildren:d,...p}=e,v=n?"row":r??"column",b=_.useMemo(()=>vF({spacing:s,direction:v}),[s,v]),y=!!u,S=!d&&!y,f=_.useMemo(()=>{const m=iF(l);return S?m:m.map((x,C)=>{const A=typeof x.key<"u"?x.key:C,$=C+1===m.length,D=d?T.jsx(bx,{children:x},A):x;if(!y)return D;const z=_.cloneElement(u,{__css:b}),ne=$?null:z;return T.jsxs(_.Fragment,{children:[D,ne]},A)})},[u,b,y,S,d,l]),h=Ge("chakra-stack",c);return T.jsx(ue.div,{ref:t,display:"flex",alignItems:o,justifyContent:i,flexDirection:v,flexWrap:a,gap:y?void 0:s,className:h,...p,children:f})});fp.displayName="Stack";var hp=ze((e,t)=>T.jsx(fp,{align:"center",...e,direction:"column",ref:t}));hp.displayName="VStack";var pp=ze((e,t)=>T.jsx(fp,{align:"center",...e,direction:"row",ref:t}));pp.displayName="HStack";var Sx=ze(function(t,n){const r=Nr("Heading",t),{className:o,...i}=Mn(t);return T.jsx(ue.h2,{ref:n,className:Ge("chakra-heading",t.className),...i,__css:r})});Sx.displayName="Heading";var xx=ze(function(t,n){const r=Nr("Badge",t),{className:o,...i}=Mn(t);return T.jsx(ue.span,{ref:n,className:Ge("chakra-badge",t.className),...i,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});xx.displayName="Badge";const yF=({addTodo:e})=>{const t=_.useRef(null),n=eF(),r=i=>n({title:i,status:"error",duration:2e3,isClosable:!0}),o=i=>{if(i.preventDefault(),t.current===null)return;if(!t.current.value){r("This field is required.");return}const s=t.current.value;e(s),t.current.value=""};return T.jsx("form",{onSubmit:o,children:T.jsxs(pp,{m:"8",children:[T.jsx(dp,{variant:"filled",placeholder:"Add new todo",ref:t}),T.jsx(up,{type:"submit",colorScheme:"green",px:"8",children:"Add"})]})})};var bF=ip({displayName:"SunIcon",path:T.jsxs("g",{strokeLinejoin:"round",strokeLinecap:"round",strokeWidth:"2",fill:"none",stroke:"currentColor",children:[T.jsx("circle",{cx:"12",cy:"12",r:"5"}),T.jsx("path",{d:"M12 1v2"}),T.jsx("path",{d:"M12 21v2"}),T.jsx("path",{d:"M4.22 4.22l1.42 1.42"}),T.jsx("path",{d:"M18.36 18.36l1.42 1.42"}),T.jsx("path",{d:"M1 12h2"}),T.jsx("path",{d:"M21 12h2"}),T.jsx("path",{d:"M4.22 19.78l1.42-1.42"}),T.jsx("path",{d:"M18.36 5.64l1.42-1.42"})]})}),SF=ip({d:"M21.4,13.7C20.6,13.9,19.8,14,19,14c-5,0-9-4-9-9c0-0.8,0.1-1.6,0.3-2.4c0.1-0.3,0-0.7-0.3-1 c-0.3-0.3-0.6-0.4-1-0.3C4.3,2.7,1,7.1,1,12c0,6.1,4.9,11,11,11c4.9,0,9.3-3.3,10.6-8.1c0.1-0.3,0-0.7-0.3-1 C22.1,13.7,21.7,13.6,21.4,13.7z",displayName:"MoonIcon"}),xF=ip({displayName:"DeleteIcon",path:T.jsx("g",{fill:"currentColor",children:T.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});const wF=({todos:e,deleteTodo:t})=>{if(e.length===0)return T.jsx(xx,{colorScheme:"green",p:"4",m:"4",borderRadius:"lg",children:"No Todos, yay~"});const n={p:"4",w:"100%",maxW:{base:"90vw",sm:"80vw",lg:"50vw",xl:"40vw"},borderColor:"gray.100",borderWidth:"2px",borderRadius:"lg",alignItems:"stretch",divider:T.jsx(yx,{})};return T.jsx(hp,{...n,children:e.map(r=>T.jsxs(pp,{children:[T.jsx(vx,{children:r.body}),T.jsx(gx,{}),T.jsx(cp,{"aria-label":"Delete todo",icon:T.jsx(xF,{}),onClick:()=>t(r.id)})]},r.id))})},kF=({toggleTheme:e,theme:t})=>{const n={size:"lg",isRound:!0,variant:"ghost",icon:t==="light"?T.jsx(SF,{}):T.jsx(bF,{}),"aria-label":"Switch DarkMode"};return T.jsx(sx.div,{whileTap:{rotate:180},style:{display:"flex",alignSelf:"flex-end"},children:T.jsx(cp,{onClick:e,...n})})},mp=ql("light");mp.debugLabel="themeAtom";const CF="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let _F=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=CF[n[e]&63];return t};const Oo=ql([]);Oo.debugLabel="todosAtom";const TF=ql(null,(e,t,n)=>{const r={id:_F(),body:n};t(Oo,[...e(Oo),r])}),PF=ql(null,(e,t,n)=>{const o=e(Oo).filter(i=>i.id!==n);t(Oo,o)});function EF(){const{colorMode:e,toggleColorMode:t}=fu(),[n,r]=Ld(mp),[o]=Ld(Oo),i=jd(TF),s=jd(PF);_.useEffect(()=>{r(e)},[e,r]);const a=()=>{r(l=>l==="light"?"dark":"light"),t()};return T.jsxs(hp,{p:4,children:[T.jsx(kF,{toggleTheme:a,theme:n}),T.jsx(Sx,{size:"2xl",children:"Jotai-Todo App"}),T.jsx(yF,{addTodo:i}),T.jsx(wF,{todos:o,deleteTodo:s})]})}const $F=()=>{const[e]=Ld(mp);return T.jsxs(nF,{children:[T.jsx(W2,{initialColorMode:e}),T.jsx(EF,{})]})};z1(document.getElementById("root")).render(T.jsxs(_.StrictMode,{children:[T.jsx(C_,{}),T.jsx($F,{})]})); + `),()=>{document.head.removeChild(c)}},[t]),T.jsx(RI,{isPresent:t,childRef:r,sizeRef:o,children:_.cloneElement(e,{ref:r})})}const MI=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:o,presenceAffectsLayout:i,mode:s})=>{const a=ep(DI),l=_.useId(),u=_.useMemo(()=>({id:l,initial:t,isPresent:n,custom:o,onExitComplete:c=>{a.set(c,!0);for(const d of a.values())if(!d)return;r&&r()},register:c=>(a.set(c,!1),()=>a.delete(c))}),i?[Math.random()]:[n]);return _.useMemo(()=>{a.forEach((c,d)=>a.set(d,!1))},[n]),_.useEffect(()=>{!n&&!a.size&&r&&r()},[n]),s==="popLayout"&&(e=T.jsx(zI,{isPresent:n,children:e})),T.jsx(Rs.Provider,{value:u,children:e})};function DI(){return new Map}const ya=e=>e.key||"";function mv(e){const t=[];return _.Children.forEach(e,n=>{_.isValidElement(n)&&t.push(n)}),t}const II=({children:e,exitBeforeEnter:t,custom:n,initial:r=!0,onExitComplete:o,presenceAffectsLayout:i=!0,mode:s="sync"})=>{const a=_.useMemo(()=>mv(e),[e]),l=a.map(ya),u=_.useRef(!0),c=_.useRef(a),d=ep(()=>new Map),[p,v]=_.useState(a),[b,y]=_.useState(a);US(()=>{u.current=!1,c.current=a;for(let h=0;h{const m=ya(h),x=a===b||l.includes(m),C=()=>{if(d.has(m))d.set(m,!0);else return;let A=!0;d.forEach($=>{$||(A=!1)}),A&&(f==null||f(),y(c.current),o&&o())};return T.jsx(MI,{isPresent:x,initial:!u.current||r?void 0:!1,custom:x?void 0:n,presenceAffectsLayout:i,mode:s,onExitComplete:x?void 0:C,children:h},m)})})};var FI={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},ax=_.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:o,requestClose:i=!1,position:s="bottom",duration:a=5e3,containerStyle:l,motionVariants:u=FI,toastSpacing:c="0.5rem"}=e,[d,p]=_.useState(a),v=OM();eg(()=>{v||r==null||r()},[v]),eg(()=>{p(a)},[a]);const b=()=>p(null),y=()=>p(a),S=()=>{v&&o()};_.useEffect(()=>{v&&i&&o()},[v,i,o]),l4(S,d);const f=_.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),h=_.useMemo(()=>i4(s),[s]);return T.jsx(sx.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:b,onHoverEnd:y,custom:{position:s},style:h,children:T.jsx(ue.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:f,children:Jt(n,{id:t,onClose:S})})})});ax.displayName="ToastComponent";function jI(e,t){var n;const r=e??"bottom",i={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=i==null?void 0:i[t])!=null?n:r}var gv={path:T.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[T.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),T.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),T.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Go=ze((e,t)=>{const{as:n,viewBox:r,color:o="currentColor",focusable:i=!1,children:s,className:a,__css:l,...u}=e,c=Ge("chakra-icon",a),d=Nr("Icon",e),p={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:o,...l,...d},v={ref:t,focusable:i,className:c,__css:p},b=r??gv.viewBox;if(n&&typeof n!="string")return T.jsx(ue.svg,{as:n,...v,...u});const y=s??gv.path;return T.jsx(ue.svg,{verticalAlign:"middle",viewBox:b,...v,...u,children:y})});Go.displayName="Icon";function ip(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,i=_.Children.toArray(e.path),s=ze((a,l)=>T.jsx(Go,{ref:l,viewBox:t,...o,...a,children:i.length?i:T.jsx("path",{fill:"currentColor",d:n})}));return s.displayName=r,s}function LI(e){return T.jsx(Go,{viewBox:"0 0 24 24",...e,children:T.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function BI(e){return T.jsx(Go,{viewBox:"0 0 24 24",...e,children:T.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function vv(e){return T.jsx(Go,{viewBox:"0 0 24 24",...e,children:T.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var VI=C2({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),sp=ze((e,t)=>{const n=Nr("Spinner",e),{label:r="Loading...",thickness:o="2px",speed:i="0.45s",emptyColor:s="transparent",className:a,...l}=Mn(e),u=Ge("chakra-spinner",a),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:o,borderBottomColor:s,borderLeftColor:s,animation:`${VI} ${i} linear infinite`,...n};return T.jsx(ue.div,{ref:t,__css:c,className:u,...l,children:r&&T.jsx(ue.span,{srOnly:!0,children:r})})});sp.displayName="Spinner";var[OI,ap]=lr({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[NI,lp]=lr({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),lx={info:{icon:BI,colorScheme:"blue"},warning:{icon:vv,colorScheme:"orange"},success:{icon:LI,colorScheme:"green"},error:{icon:vv,colorScheme:"red"},loading:{icon:sp,colorScheme:"blue"}};function WI(e){return lx[e].colorScheme}function UI(e){return lx[e].icon}var ux=ze(function(t,n){const r=lp(),{status:o}=ap(),i={display:"inline",...r.description};return T.jsx(ue.div,{ref:n,"data-status":o,...t,className:Ge("chakra-alert__desc",t.className),__css:i})});ux.displayName="AlertDescription";function cx(e){const{status:t}=ap(),n=UI(t),r=lp(),o=t==="loading"?r.spinner:r.icon;return T.jsx(ue.span,{display:"inherit","data-status":t,...e,className:Ge("chakra-alert__icon",e.className),__css:o,children:e.children||T.jsx(n,{h:"100%",w:"100%"})})}cx.displayName="AlertIcon";var dx=ze(function(t,n){const r=lp(),{status:o}=ap();return T.jsx(ue.div,{ref:n,"data-status":o,...t,className:Ge("chakra-alert__title",t.className),__css:r.title})});dx.displayName="AlertTitle";var fx=ze(function(t,n){var r;const{status:o="info",addRole:i=!0,...s}=Mn(t),a=(r=t.colorScheme)!=null?r:WI(o),l=Ah("Alert",{...t,colorScheme:a}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return T.jsx(OI,{value:{status:o},children:T.jsx(NI,{value:l,children:T.jsx(ue.div,{"data-status":o,role:i?"alert":void 0,ref:n,...s,className:Ge("chakra-alert",t.className),__css:u})})})});fx.displayName="Alert";function HI(e){return T.jsx(Go,{focusable:"false","aria-hidden":!0,...e,children:T.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var hx=ze(function(t,n){const r=Nr("CloseButton",t),{children:o,isDisabled:i,__css:s,...a}=Mn(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return T.jsx(ue.button,{type:"button","aria-label":"Close",ref:n,disabled:i,__css:{...l,...r,...s},...a,children:o||T.jsx(HI,{width:"1em",height:"1em"})})});hx.displayName="CloseButton";var KI={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},Zt=GI(KI);function GI(e){let t=e;const n=new Set,r=o=>{t=o(t),n.forEach(i=>i())};return{getState:()=>t,subscribe:o=>(n.add(o),()=>{r(()=>e),n.delete(o)}),removeToast:(o,i)=>{r(s=>({...s,[i]:s[i].filter(a=>a.id!=o)}))},notify:(o,i)=>{const s=YI(o,i),{position:a,id:l}=s;return r(u=>{var c,d;const v=a.includes("top")?[s,...(c=u[a])!=null?c:[]]:[...(d=u[a])!=null?d:[],s];return{...u,[a]:v}}),l},update:(o,i)=>{o&&r(s=>{const a={...s},{position:l,index:u}=J0(a,o);return l&&u!==-1&&(a[l][u]={...a[l][u],...i,message:px(i)}),a})},closeAll:({positions:o}={})=>{r(i=>(o??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=i[u].map(c=>({...c,requestClose:!0})),l),{...i}))},close:o=>{r(i=>{const s=Mb(i,o);return s?{...i,[s]:i[s].map(a=>a.id==o?{...a,requestClose:!0}:a)}:i})},isActive:o=>!!J0(Zt.getState(),o).position}}var yv=0;function YI(e,t={}){var n,r;yv+=1;const o=(n=t.id)!=null?n:yv,i=(r=t.position)!=null?r:"bottom";return{id:o,message:e,position:i,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>Zt.removeToast(String(o),i),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var XI=e=>{const{status:t,variant:n="solid",id:r,title:o,isClosable:i,onClose:s,description:a,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return T.jsxs(fx,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[T.jsx(cx,{children:u}),T.jsxs(ue.div,{flex:"1",maxWidth:"100%",children:[o&&T.jsx(dx,{id:c==null?void 0:c.title,children:o}),a&&T.jsx(ux,{id:c==null?void 0:c.description,display:"block",children:a})]}),i&&T.jsx(hx,{size:"sm",onClick:s,position:"absolute",insetEnd:1,top:1})]})};function px(e={}){const{render:t,toastComponent:n=XI}=e;return o=>typeof t=="function"?t({...o,...e}):T.jsx(n,{...o,...e})}function qI(e,t){const n=o=>{var i;return{...t,...o,position:jI((i=o==null?void 0:o.position)!=null?i:t==null?void 0:t.position,e)}},r=o=>{const i=n(o),s=px(i);return Zt.notify(s,i)};return r.update=(o,i)=>{Zt.update(o,n(i))},r.promise=(o,i)=>{const s=r({...i.loading,status:"loading",duration:null});o.then(a=>r.update(s,{status:"success",duration:5e3,...Jt(i.success,a)})).catch(a=>r.update(s,{status:"error",duration:5e3,...Jt(i.error,a)}))},r.closeAll=Zt.closeAll,r.close=Zt.close,r.isActive=Zt.isActive,r}var[QI,ZI]=lr({name:"ToastOptionsContext",strict:!1}),JI=e=>{const t=_.useSyncExternalStore(Zt.subscribe,Zt.getState,Zt.getState),{motionVariants:n,component:r=ax,portalProps:o}=e,s=Object.keys(t).map(a=>{const l=t[a];return T.jsx("div",{role:"region","aria-live":"polite","aria-label":`Notifications-${a}`,id:`chakra-toast-manager-${a}`,style:s4(a),children:T.jsx(II,{initial:!1,children:l.map(u=>T.jsx(r,{motionVariants:n,...u},u.id))})},a)});return T.jsx(du,{...o,children:s})};function eF(e){const{theme:t}=ib(),n=ZI();return _.useMemo(()=>qI(t.direction,{...n,...e}),[e,t.direction,n])}var tF=e=>function({children:n,theme:r=e,toastOptions:o,...i}){return T.jsxs(r4,{theme:r,...i,children:[T.jsx(QI,{value:o==null?void 0:o.defaultOptions,children:n}),T.jsx(JI,{...o})]})},nF=tF(T3);function rF(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function hf(...e){return t=>{e.forEach(n=>{rF(n,t)})}}function oF(...e){return _.useMemo(()=>hf(...e),e)}function iF(e){return _.Children.toArray(e).filter(t=>_.isValidElement(t))}var[zF,sF]=lr({strict:!1,name:"ButtonGroupContext"});function aF(e){const[t,n]=_.useState(!e);return{ref:_.useCallback(i=>{i&&n(i.tagName==="BUTTON")},[]),type:t?"button":void 0}}function pf(e){const{children:t,className:n,...r}=e,o=_.isValidElement(t)?_.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,i=Ge("chakra-button__icon",n);return T.jsx(ue.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:i,children:o})}pf.displayName="ButtonIcon";function mf(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=T.jsx(sp,{color:"currentColor",width:"1em",height:"1em"}),className:i,__css:s,...a}=e,l=Ge("chakra-button__spinner",i),u=n==="start"?"marginEnd":"marginStart",c=_.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[u]:t?r:0,fontSize:"1em",lineHeight:"normal",...s}),[s,t,u,r]);return T.jsx(ue.div,{className:l,...a,__css:c,children:o})}mf.displayName="ButtonSpinner";var up=ze((e,t)=>{const n=sF(),r=Nr("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:i,isActive:s,children:a,leftIcon:l,rightIcon:u,loadingText:c,iconSpacing:d="0.5rem",type:p,spinner:v,spinnerPlacement:b="start",className:y,as:S,...f}=Mn(e),h=_.useMemo(()=>{const A={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:A}}},[r,n]),{ref:m,type:x}=aF(S),C={rightIcon:u,leftIcon:l,iconSpacing:d,children:a};return T.jsxs(ue.button,{ref:oF(t,m),as:S,type:p??x,"data-active":Gt(s),"data-loading":Gt(i),__css:h,className:Ge("chakra-button",y),...f,disabled:o||i,children:[i&&b==="start"&&T.jsx(mf,{className:"chakra-button__spinner--start",label:c,placement:"start",spacing:d,children:v}),i?c||T.jsx(ue.span,{opacity:0,children:T.jsx(bv,{...C})}):T.jsx(bv,{...C}),i&&b==="end"&&T.jsx(mf,{className:"chakra-button__spinner--end",label:c,placement:"end",spacing:d,children:v})]})});up.displayName="Button";function bv(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return T.jsxs(T.Fragment,{children:[t&&T.jsx(pf,{marginEnd:o,children:t}),r,n&&T.jsx(pf,{marginStart:o,children:n})]})}var cp=ze((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":i,...s}=e,a=n||r,l=_.isValidElement(a)?_.cloneElement(a,{"aria-hidden":!0,focusable:!1}):null;return T.jsx(up,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":i,...s,children:l})});cp.displayName="IconButton";var[lF,uF]=lr({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[cF,mx]=lr({strict:!1,name:"FormControlContext"});function dF(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:i,...s}=e,a=_.useId(),l=t||`field-${a}`,u=`${l}-label`,c=`${l}-feedback`,d=`${l}-helptext`,[p,v]=_.useState(!1),[b,y]=_.useState(!1),[S,f]=_.useState(!1),h=_.useCallback(($={},P=null)=>({id:d,...$,ref:hf(P,D=>{D&&y(!0)})}),[d]),m=_.useCallback(($={},P=null)=>({...$,ref:P,"data-focus":Gt(S),"data-disabled":Gt(o),"data-invalid":Gt(r),"data-readonly":Gt(i),id:$.id!==void 0?$.id:u,htmlFor:$.htmlFor!==void 0?$.htmlFor:l}),[l,o,S,r,i,u]),x=_.useCallback(($={},P=null)=>({id:c,...$,ref:hf(P,D=>{D&&v(!0)}),"aria-live":"polite"}),[c]),C=_.useCallback(($={},P=null)=>({...$,...s,ref:P,role:"group","data-focus":Gt(S),"data-disabled":Gt(o),"data-invalid":Gt(r),"data-readonly":Gt(i)}),[s,o,S,r,i]),A=_.useCallback(($={},P=null)=>({...$,ref:P,role:"presentation","aria-hidden":!0,children:$.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!i,isDisabled:!!o,isFocused:!!S,onFocus:()=>f(!0),onBlur:()=>f(!1),hasFeedbackText:p,setHasFeedbackText:v,hasHelpText:b,setHasHelpText:y,id:l,labelId:u,feedbackId:c,helpTextId:d,htmlProps:s,getHelpTextProps:h,getErrorMessageProps:x,getRootProps:C,getLabelProps:m,getRequiredIndicatorProps:A}}var fF=ze(function(t,n){const r=Ah("Form",t),o=Mn(t),{getRootProps:i,htmlProps:s,...a}=dF(o),l=Ge("chakra-form-control",t.className);return T.jsx(cF,{value:a,children:T.jsx(lF,{value:r,children:T.jsx(ue.div,{...i({},n),className:l,__css:r.container})})})});fF.displayName="FormControl";var hF=ze(function(t,n){const r=mx(),o=uF(),i=Ge("chakra-form__helper-text",t.className);return T.jsx(ue.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:i})});hF.displayName="FormHelperText";function pF(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...i}=mF(e);return{...i,disabled:t,readOnly:r,required:o,"aria-invalid":hc(n),"aria-required":hc(o),"aria-readonly":hc(r)}}function mF(e){var t,n,r;const o=mx(),{id:i,disabled:s,readOnly:a,required:l,isRequired:u,isInvalid:c,isReadOnly:d,isDisabled:p,onFocus:v,onBlur:b,...y}=e,S=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&S.push(o.feedbackId),o!=null&&o.hasHelpText&&S.push(o.helpTextId),{...y,"aria-describedby":S.join(" ")||void 0,id:i??(o==null?void 0:o.id),isDisabled:(t=s??p)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=a??d)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=l??u)!=null?r:o==null?void 0:o.isRequired,isInvalid:c??(o==null?void 0:o.isInvalid),onFocus:a0(o==null?void 0:o.onFocus,v),onBlur:a0(o==null?void 0:o.onBlur,b)}}var dp=ze(function(t,n){const{htmlSize:r,...o}=t,i=Ah("Input",o),s=Mn(o),a=pF(s),l=Ge("chakra-input",t.className);return T.jsx(ue.input,{size:r,...a,__css:i.field,ref:n,className:l})});dp.displayName="Input";dp.id="Input";function gF(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):Ot(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var gx=ue("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});gx.displayName="Spacer";var vx=ze(function(t,n){const r=Nr("Text",t),{className:o,align:i,decoration:s,casing:a,...l}=Mn(t),u=O3({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return T.jsx(ue.p,{ref:n,className:Ge("chakra-text",t.className),...u,...l,__css:r})});vx.displayName="Text";var yx=e=>T.jsx(ue.div,{className:"chakra-stack__divider",...e,__css:{...e.__css,borderWidth:0,alignSelf:"stretch",borderColor:"inherit",width:"auto",height:"auto"}});yx.displayName="StackDivider";var bx=e=>T.jsx(ue.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});bx.displayName="StackItem";function vF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":gF(n,o=>r[o])}}var fp=ze((e,t)=>{const{isInline:n,direction:r,align:o,justify:i,spacing:s="0.5rem",wrap:a,children:l,divider:u,className:c,shouldWrapChildren:d,...p}=e,v=n?"row":r??"column",b=_.useMemo(()=>vF({spacing:s,direction:v}),[s,v]),y=!!u,S=!d&&!y,f=_.useMemo(()=>{const m=iF(l);return S?m:m.map((x,C)=>{const A=typeof x.key<"u"?x.key:C,$=C+1===m.length,D=d?T.jsx(bx,{children:x},A):x;if(!y)return D;const z=_.cloneElement(u,{__css:b}),ne=$?null:z;return T.jsxs(_.Fragment,{children:[D,ne]},A)})},[u,b,y,S,d,l]),h=Ge("chakra-stack",c);return T.jsx(ue.div,{ref:t,display:"flex",alignItems:o,justifyContent:i,flexDirection:v,flexWrap:a,gap:y?void 0:s,className:h,...p,children:f})});fp.displayName="Stack";var hp=ze((e,t)=>T.jsx(fp,{align:"center",...e,direction:"column",ref:t}));hp.displayName="VStack";var pp=ze((e,t)=>T.jsx(fp,{align:"center",...e,direction:"row",ref:t}));pp.displayName="HStack";var Sx=ze(function(t,n){const r=Nr("Heading",t),{className:o,...i}=Mn(t);return T.jsx(ue.h2,{ref:n,className:Ge("chakra-heading",t.className),...i,__css:r})});Sx.displayName="Heading";var xx=ze(function(t,n){const r=Nr("Badge",t),{className:o,...i}=Mn(t);return T.jsx(ue.span,{ref:n,className:Ge("chakra-badge",t.className),...i,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});xx.displayName="Badge";const yF=({addTodo:e})=>{const t=_.useRef(null),n=eF(),r=i=>n({title:i,status:"error",duration:2e3,isClosable:!0}),o=i=>{if(i.preventDefault(),t.current===null)return;if(!t.current.value){r("This field is required.");return}const s=t.current.value;e(s),t.current.value=""};return T.jsx("form",{onSubmit:o,children:T.jsxs(pp,{m:"8",children:[T.jsx(dp,{variant:"filled",placeholder:"Add new todo",ref:t}),T.jsx(up,{type:"submit",colorScheme:"green",px:"8",children:"Add"})]})})};var bF=ip({displayName:"SunIcon",path:T.jsxs("g",{strokeLinejoin:"round",strokeLinecap:"round",strokeWidth:"2",fill:"none",stroke:"currentColor",children:[T.jsx("circle",{cx:"12",cy:"12",r:"5"}),T.jsx("path",{d:"M12 1v2"}),T.jsx("path",{d:"M12 21v2"}),T.jsx("path",{d:"M4.22 4.22l1.42 1.42"}),T.jsx("path",{d:"M18.36 18.36l1.42 1.42"}),T.jsx("path",{d:"M1 12h2"}),T.jsx("path",{d:"M21 12h2"}),T.jsx("path",{d:"M4.22 19.78l1.42-1.42"}),T.jsx("path",{d:"M18.36 5.64l1.42-1.42"})]})}),SF=ip({d:"M21.4,13.7C20.6,13.9,19.8,14,19,14c-5,0-9-4-9-9c0-0.8,0.1-1.6,0.3-2.4c0.1-0.3,0-0.7-0.3-1 c-0.3-0.3-0.6-0.4-1-0.3C4.3,2.7,1,7.1,1,12c0,6.1,4.9,11,11,11c4.9,0,9.3-3.3,10.6-8.1c0.1-0.3,0-0.7-0.3-1 C22.1,13.7,21.7,13.6,21.4,13.7z",displayName:"MoonIcon"}),xF=ip({displayName:"DeleteIcon",path:T.jsx("g",{fill:"currentColor",children:T.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});const wF=({todos:e,deleteTodo:t})=>{if(e.length===0)return T.jsx(xx,{colorScheme:"green",p:"4",m:"4",borderRadius:"lg",children:"No Todos, yay~"});const n={p:"4",w:"100%",maxW:{base:"90vw",sm:"80vw",lg:"50vw",xl:"40vw"},borderColor:"gray.100",borderWidth:"2px",borderRadius:"lg",alignItems:"stretch",divider:T.jsx(yx,{})};return T.jsx(hp,{...n,children:e.map(r=>T.jsxs(pp,{children:[T.jsx(vx,{children:r.body}),T.jsx(gx,{}),T.jsx(cp,{"aria-label":"Delete todo",icon:T.jsx(xF,{}),onClick:()=>t(r.id)})]},r.id))})},kF=({toggleTheme:e,theme:t})=>{const n={size:"lg",isRound:!0,variant:"ghost",icon:t==="light"?T.jsx(SF,{}):T.jsx(bF,{}),"aria-label":"Switch DarkMode"};return T.jsx(sx.div,{whileTap:{rotate:180},style:{display:"flex",alignSelf:"flex-end"},children:T.jsx(cp,{onClick:e,...n})})},mp=ql("light");mp.debugLabel="themeAtom";const CF="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let _F=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=CF[n[e]&63];return t};const Oo=ql([]);Oo.debugLabel="todosAtom";const TF=ql(null,(e,t,n)=>{const r={id:_F(),body:n};t(Oo,[...e(Oo),r])}),PF=ql(null,(e,t,n)=>{const o=e(Oo).filter(i=>i.id!==n);t(Oo,o)});function EF(){const{colorMode:e,toggleColorMode:t}=fu(),[n,r]=Ld(mp),[o]=Ld(Oo),i=jd(TF),s=jd(PF);_.useEffect(()=>{r(e)},[e,r]);const a=()=>{r(l=>l==="light"?"dark":"light"),t()};return T.jsxs(hp,{p:4,children:[T.jsx(kF,{toggleTheme:a,theme:n}),T.jsx(Sx,{size:"2xl",children:"Jotai-Todos App"}),T.jsx(yF,{addTodo:i}),T.jsx(wF,{todos:o,deleteTodo:s})]})}const $F=()=>{const[e]=Ld(mp);return T.jsxs(nF,{children:[T.jsx(W2,{initialColorMode:e}),T.jsx(EF,{})]})};z1(document.getElementById("root")).render(T.jsxs(_.StrictMode,{children:[T.jsx(C_,{}),T.jsx($F,{})]})); diff --git a/index.html b/index.html index 791beae..943aaff 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Vite + React + TS - +