PageSourceSearch

https://ridemtu.com/assets/toast.provider-DpVvjpUZ.js

js ridemtu.com collected 2026-09-27 13:01:24 UTC 8,498 bytes, 1 lines download raw bytes

1import{r as m,j as r}from"./chunk-LFPYN7LY-BYCOceFh.js";import{c as f,r as z,f as p,o as k,m as H,a as y,u as V}from"./use-style-config-ZxeY2J_M.js";import{u as K,m as U,A as F}from"./proxy-Cqc5MAPz.js";import{a as G,b as T}from"./use-update-effect-NPvO9y9c.js";import{I as S}from"./icon-BoqpEvxL.js";import{S as J,c as C,d as w}from"./spinner-WEkHiO-h.js";import{P as Q}from"./portal-Ty30PHP7.js";function X(e,t){const n=G(e);m.useEffect(()=>{if(t==null)return;let o=null;return o=window.setTimeout(()=>{n()},t),()=>{o&&window.clearTimeout(o)}},[t,n])}const Y=(e,t)=>e.find(n=>n.id===t);function _(e,t){const n=P(e,t),o=n?e[n].findIndex(s=>s.id===t):-1;return{position:n,index:o}}function P(e,t){for(const[n,o]of Object.entries(e))if(Y(o,t))return n}function tt(e){const t=e.includes("right"),n=e.includes("left");let o="center";return t&&(o="flex-end"),n&&(o="flex-start"),{display:"flex",flexDirection:"column",alignItems:o}}function et(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,o=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,s=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,i=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",c=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:o,bottom:s,right:i,left:c}}const ot={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let o=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(o=1),{opacity:0,[n]:o*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]}}},E=m.memo(e=>{const{id:t,message:n,onCloseComplete:o,onRequestRemove:s,requestClose:i=!1,position:c="bottom",duration:a=5e3,containerStyle:l,motionVariants:d=ot,toastSpacing:u="0.5rem"}=e,[g,v]=m.useState(a),h=K();T(()=>{h||o==null||o()},[h]),T(()=>{v(a)},[a]);const O=()=>v(null),q=()=>v(a),j=()=>{h&&s()};m.useEffect(()=>{h&&i&&s()},[h,i,s]),X(j,g);const $=m.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:u,...l}),[l,u]),W=m.useMemo(()=>tt(c),[c]);return r.jsx(U.div,{layout:!0,className:"chakra-toast",variants:d,initial:"initial",animate:"animate",exit:"exit",onHoverStart:O,onHoverEnd:q,custom:{position:c},style:W,children:r.jsx(f.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:$,children:z(n,{id:t,onClose:j})})})});E.displayName="ToastComponent";function st(e){return r.jsx(S,{viewBox:"0 0 24 24",...e,children:r.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 nt(e){return r.jsx(S,{viewBox:"0 0 24 24",...e,children:r.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 I(e){return r.jsx(S,{viewBox:"0 0 24 24",...e,children:r.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"})})}const[it,b]=C({name:"AlertContext",hookName:"useAlertContext",providerName:"<Alert />"}),[at,A]=C({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:"<Alert />"}),M={info:{icon:nt,colorScheme:"blue"},warning:{icon:I,colorScheme:"orange"},success:{icon:st,colorScheme:"green"},error:{icon:I,colorScheme:"red"},loading:{icon:J,colorScheme:"blue"}};function rt(e){return M[e].colorScheme}function ct(e){return M[e].icon}const B=p(function(t,n){const{status:o="info",addRole:s=!0,...i}=k(t),c=t.colorScheme??rt(o),a=H("Alert",{...t,colorScheme:c}),l=w({width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...a.container});return r.jsx(it,{value:{status:o},children:r.jsx(at,{value:a,children:r.jsx(f.div,{"data-status":o,role:s?"alert":void 0,ref:n,...i,className:y("chakra-alert",t.className),__css:l})})})});B.displayName="Alert";function R(e){const{status:t}=b(),n=ct(t),o=A(),s=t==="loading"?o.spinner:o.icon;return r.jsx(f.span,{display:"inherit","data-status":t,...e,className:y("chakra-alert__icon",e.className),__css:s,children:e.children||r.jsx(n,{h:"100%",w:"100%"})})}R.displayName="AlertIcon";const L=p(function(t,n){const o=A(),{status:s}=b();return r.jsx(f.div,{ref:n,"data-status":s,...t,className:y("chakra-alert__title",t.className),__css:o.title})});L.displayName="AlertTitle";const Z=p(function(t,n){const{status:o}
1=b(),s=A(),i=w({display:"inline",...s.description});return r.jsx(f.div,{ref:n,"data-status":o,...t,className:y("chakra-alert__desc",t.className),__css:i})});Z.displayName="AlertDescription";function lt(e){return r.jsx(S,{focusable:"false","aria-hidden":!0,...e,children:r.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"})})}const D=p(function(t,n){const o=V("CloseButton",t),{children:s,isDisabled:i,__css:c,...a}=k(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return r.jsx(f.button,{type:"button","aria-label":"Close",ref:n,disabled:i,__css:{...l,...o,...c},...a,children:s||r.jsx(lt,{width:"1em",height:"1em"})})});D.displayName="CloseButton";const ut=e=>{const{status:t,variant:n="solid",id:o,title:s,isClosable:i,onClose:c,description:a,colorScheme:l,icon:d}=e,u=o?{root:`toast-${o}`,title:`toast-${o}-title`,description:`toast-${o}-description`}:void 0;return r.jsxs(B,{addRole:!1,status:t,variant:n,id:u==null?void 0:u.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[r.jsx(R,{children:d}),r.jsxs(f.div,{flex:"1",maxWidth:"100%",children:[s&&r.jsx(L,{id:u==null?void 0:u.title,children:s}),a&&r.jsx(Z,{id:u==null?void 0:u.description,display:"block",children:a})]}),i&&r.jsx(D,{size:"sm",onClick:c,position:"absolute",insetEnd:1,top:1})]})};function dt(e={}){const{render:t,toastComponent:n=ut}=e;return s=>typeof t=="function"?t({...s,...e}):r.jsx(n,{...s,...e})}const mt={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},x=ft(mt);function ft(e){let t=e;const n=new Set,o=s=>{t=s(t),n.forEach(i=>i())};return{getState:()=>t,subscribe:s=>(n.add(s),()=>{o(()=>e),n.delete(s)}),removeToast:(s,i)=>{o(c=>({...c,[i]:c[i].filter(a=>a.id!=s)}))},notify:(s,i)=>{const c=ht(s,i),{position:a,id:l}=c;return o(d=>{const g=a.includes("top")?[c,...d[a]??[]]:[...d[a]??[],c];return{...d,[a]:g}}),l},update:(s,i)=>{s&&o(c=>{const a={...c},{position:l,index:d}=_(a,s);return l&&d!==-1&&(a[l][d]={...a[l][d],...i,message:dt(i)}),a})},closeAll:({positions:s}={})=>{o(i=>(s??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,d)=>(l[d]=i[d].map(u=>({...u,requestClose:!0})),l),{...i}))},close:s=>{o(i=>{const c=P(i,s);return c?{...i,[c]:i[c].map(a=>a.id==s?{...a,requestClose:!0}:a)}:i})},isActive:s=>!!_(x.getState(),s).position}}let N=0;function ht(e,t={}){N+=1;const n=t.id??N,o=t.position??"bottom";return{id:n,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>x.removeToast(String(n),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}const[bt,At]=C({name:"ToastOptionsContext",strict:!1}),jt=e=>{const t=m.useSyncExternalStore(x.subscribe,x.getState,x.getState),{motionVariants:n,component:o=E,portalProps:s,animatePresenceProps:i}=e,a=Object.keys(t).map(l=>{const d=t[l];return r.jsx("div",{role:"region","aria-live":"polite","aria-label":`Notifications-${l}`,id:`chakra-toast-manager-${l}`,style:et(l),children:r.jsx(F,{...i,initial:!1,children:d.map(u=>r.jsx(o,{motionVariants:n,...u},u.id))})},l)});return r.jsx(Q,{...s,children:a})};export{bt as T,jt as a,dt as c,x as t,At as u};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.