@saga-ai/cli 2.13.0 → 2.15.0
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.
- package/dist/cli.cjs +2331 -1832
- package/dist/client/assets/index-C7C0BG0A.js +11 -0
- package/dist/client/assets/index-gxuuoUZf.css +1 -0
- package/dist/client/assets/vendor-markdown-DYPIbB23.js +29 -0
- package/dist/client/assets/vendor-radix-Cn9lyvpX.js +6 -0
- package/dist/client/assets/vendor-react-Ca05HUaC.js +3 -0
- package/dist/client/assets/vendor-xstate-Dogcz2PC.js +3 -0
- package/dist/client/index.html +6 -2
- package/package.json +27 -23
- package/dist/client/assets/index-CQYbaS_0.js +0 -198
- package/dist/client/assets/index-DjgOmj3i.css +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as Ft,g as Lt,r as i,R as $,b as ye}from"./vendor-xstate-Dogcz2PC.js";var ie={exports:{}},B={};var Ae;function Mt(){if(Ae)return B;Ae=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(n,s,a){var u=null;if(a!==void 0&&(u=""+a),s.key!==void 0&&(u=""+s.key),"key"in s){a={};for(var l in s)l!=="key"&&(a[l]=s[l])}else a=s;return s=a.ref,{$$typeof:e,type:n,key:u,ref:s!==void 0?s:null,props:a}}return B.Fragment=t,B.jsx=r,B.jsxs=r,B}var Oe;function jt(){return Oe||(Oe=1,ie.exports=Mt()),ie.exports}var v=jt(),ae={exports:{}},A={};var De;function $t(){if(De)return A;De=1;var e=Ft();function t(c){var o="https://react.dev/errors/"+c;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+c+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(c,o,d){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:f==null?null:""+f,children:c,containerInfo:o,implementation:d}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(c,o){if(c==="font")return"";if(typeof o=="string")return o==="use-credentials"?o:""}return A.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,A.createPortal=function(c,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)throw Error(t(299));return a(c,o,null,d)},A.flushSync=function(c){var o=u.T,d=n.p;try{if(u.T=null,n.p=2,c)return c()}finally{u.T=o,n.p=d,n.d.f()}},A.preconnect=function(c,o){typeof c=="string"&&(o?(o=o.crossOrigin,o=typeof o=="string"?o==="use-credentials"?o:"":void 0):o=null,n.d.C(c,o))},A.prefetchDNS=function(c){typeof c=="string"&&n.d.D(c)},A.preinit=function(c,o){if(typeof c=="string"&&o&&typeof o.as=="string"){var d=o.as,f=l(d,o.crossOrigin),y=typeof o.integrity=="string"?o.integrity:void 0,T=typeof o.fetchPriority=="string"?o.fetchPriority:void 0;d==="style"?n.d.S(c,typeof o.precedence=="string"?o.precedence:void 0,{crossOrigin:f,integrity:y,fetchPriority:T}):d==="script"&&n.d.X(c,{crossOrigin:f,integrity:y,fetchPriority:T,nonce:typeof o.nonce=="string"?o.nonce:void 0})}},A.preinitModule=function(c,o){if(typeof c=="string")if(typeof o=="object"&&o!==null){if(o.as==null||o.as==="script"){var d=l(o.as,o.crossOrigin);n.d.M(c,{crossOrigin:d,integrity:typeof o.integrity=="string"?o.integrity:void 0,nonce:typeof o.nonce=="string"?o.nonce:void 0})}}else o==null&&n.d.M(c)},A.preload=function(c,o){if(typeof c=="string"&&typeof o=="object"&&o!==null&&typeof o.as=="string"){var d=o.as,f=l(d,o.crossOrigin);n.d.L(c,d,{crossOrigin:f,integrity:typeof o.integrity=="string"?o.integrity:void 0,nonce:typeof o.nonce=="string"?o.nonce:void 0,type:typeof o.type=="string"?o.type:void 0,fetchPriority:typeof o.fetchPriority=="string"?o.fetchPriority:void 0,referrerPolicy:typeof o.referrerPolicy=="string"?o.referrerPolicy:void 0,imageSrcSet:typeof o.imageSrcSet=="string"?o.imageSrcSet:void 0,imageSizes:typeof o.imageSizes=="string"?o.imageSizes:void 0,media:typeof o.media=="string"?o.media:void 0})}},A.preloadModule=function(c,o){if(typeof c=="string")if(o){var d=l(o.as,o.crossOrigin);n.d.m(c,{as:typeof o.as=="string"&&o.as!=="script"?o.as:void 0,crossOrigin:d,integrity:typeof o.integrity=="string"?o.integrity:void 0})}else n.d.m(c)},A.requestFormReset=function(c){n.d.r(c)},A.unstable_batchedUpdates=function(c,o){return c(o)},A.useFormState=function(c,o,d){return u.H.useFormState(c,o,d)},A.useFormStatus=function(){return u.H.useHostTransitionStatus()},A.version="19.2.4",A}var Fe;function kt(){if(Fe)return ae.exports;Fe=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ae.exports=$t(),ae.exports}var Ee=kt();const Vt=Lt(Ee);function S(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s.defaultPrevented)return t?.(s)}}function Le(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ge(...e){return t=>{let r=!1;const n=e.map(s=>{const a=Le(s,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let s=0;s<n.length;s++){const a=n[s];typeof a=="function"?a():Le(e[s],null)}}}}function M(...e){return i.useCallback(ge(...e),e)}function K(e,t=[]){let r=[];function n(a,u){const l=i.createContext(u),c=r.length;r=[...r,u];const o=f=>{const{scope:y,children:T,...x}=f,m=y?.[e]?.[c]||l,p=i.useMemo(()=>x,Object.values(x));return v.jsx(m.Provider,{value:p,children:T})};o.displayName=a+"Provider";function d(f,y){const T=y?.[e]?.[c]||l,x=i.useContext(T);if(x)return x;if(u!==void 0)return u;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[o,d]}const s=()=>{const a=r.map(u=>i.createContext(u));return function(l){const c=l?.[e]||a;return i.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,Ut(s,...t)]}function Ut(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const u=n.reduce((l,{useScope:c,scopeName:o})=>{const f=c(a)[`__scope${o}`];return{...l,...f}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function le(e){const t=Wt(e),r=i.forwardRef((n,s)=>{const{children:a,...u}=n,l=i.Children.toArray(a),c=l.find(Kt);if(c){const o=c.props.children,d=l.map(f=>f===c?i.Children.count(o)>1?i.Children.only(null):i.isValidElement(o)?o.props.children:null:f);return v.jsx(t,{...u,ref:s,children:i.isValidElement(o)?i.cloneElement(o,void 0,d):null})}return v.jsx(t,{...u,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function Wt(e){const t=i.forwardRef((r,n)=>{const{children:s,...a}=r;if(i.isValidElement(s)){const u=Gt(s),l=Ht(a,s.props);return s.type!==i.Fragment&&(l.ref=n?ge(n,u):u),i.cloneElement(s,l)}return i.Children.count(s)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bt=Symbol("radix.slottable");function Kt(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Bt}function Ht(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function Gt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Ue(e){const t=e+"CollectionProvider",[r,n]=K(t),[s,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=m=>{const{scope:p,children:C}=m,E=$.useRef(null),g=$.useRef(new Map).current;return v.jsx(s,{scope:p,itemMap:g,collectionRef:E,children:C})};u.displayName=t;const l=e+"CollectionSlot",c=le(l),o=$.forwardRef((m,p)=>{const{scope:C,children:E}=m,g=a(l,C),b=M(p,g.collectionRef);return v.jsx(c,{ref:b,children:E})});o.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",y=le(d),T=$.forwardRef((m,p)=>{const{scope:C,children:E,...g}=m,b=$.useRef(null),_=M(p,b),w=a(d,C);return $.useEffect(()=>(w.itemMap.set(b,{ref:b,...g}),()=>{w.itemMap.delete(b)})),v.jsx(y,{[f]:"",ref:_,children:E})});T.displayName=d;function x(m){const p=a(e+"CollectionConsumer",m);return $.useCallback(()=>{const E=p.collectionRef.current;if(!E)return[];const g=Array.from(E.querySelectorAll(`[${f}]`));return Array.from(p.itemMap.values()).sort((w,R)=>g.indexOf(w.ref.current)-g.indexOf(R.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:u,Slot:o,ItemSlot:T},x,n]}var Yt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],I=Yt.reduce((e,t)=>{const r=le(`Primitive.${t}`),n=i.forwardRef((s,a)=>{const{asChild:u,...l}=s,c=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function We(e,t){e&&Ee.flushSync(()=>e.dispatchEvent(t))}function j(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...r)=>t.current?.(...r),[])}function qt(e,t=globalThis?.document){const r=j(e);i.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var zt="DismissableLayer",de="dismissableLayer.update",Xt="dismissableLayer.pointerDownOutside",Jt="dismissableLayer.focusOutside",Me,Be=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ke=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:u,onDismiss:l,...c}=e,o=i.useContext(Be),[d,f]=i.useState(null),y=d?.ownerDocument??globalThis?.document,[,T]=i.useState({}),x=M(t,R=>f(R)),m=Array.from(o.layers),[p]=[...o.layersWithOutsidePointerEventsDisabled].slice(-1),C=m.indexOf(p),E=d?m.indexOf(d):-1,g=o.layersWithOutsidePointerEventsDisabled.size>0,b=E>=C,_=Qt(R=>{const P=R.target,L=[...o.branches].some(O=>O.contains(P));!b||L||(s?.(R),u?.(R),R.defaultPrevented||l?.())},y),w=en(R=>{const P=R.target;[...o.branches].some(O=>O.contains(P))||(a?.(R),u?.(R),R.defaultPrevented||l?.())},y);return qt(R=>{E===o.layers.size-1&&(n?.(R),!R.defaultPrevented&&l&&(R.preventDefault(),l()))},y),i.useEffect(()=>{if(d)return r&&(o.layersWithOutsidePointerEventsDisabled.size===0&&(Me=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),o.layersWithOutsidePointerEventsDisabled.add(d)),o.layers.add(d),je(),()=>{r&&o.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Me)}},[d,y,r,o]),i.useEffect(()=>()=>{d&&(o.layers.delete(d),o.layersWithOutsidePointerEventsDisabled.delete(d),je())},[d,o]),i.useEffect(()=>{const R=()=>T({});return document.addEventListener(de,R),()=>document.removeEventListener(de,R)},[]),v.jsx(I.div,{...c,ref:x,style:{pointerEvents:g?b?"auto":"none":void 0,...e.style},onFocusCapture:S(e.onFocusCapture,w.onFocusCapture),onBlurCapture:S(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:S(e.onPointerDownCapture,_.onPointerDownCapture)})});Ke.displayName=zt;var Zt="DismissableLayerBranch",He=i.forwardRef((e,t)=>{const r=i.useContext(Be),n=i.useRef(null),s=M(t,n);return i.useEffect(()=>{const a=n.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),v.jsx(I.div,{...e,ref:s})});He.displayName=Zt;function Qt(e,t=globalThis?.document){const r=j(e),n=i.useRef(!1),s=i.useRef(()=>{});return i.useEffect(()=>{const a=l=>{if(l.target&&!n.current){let c=function(){Ge(Xt,r,o,{discrete:!0})};const o={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function en(e,t=globalThis?.document){const r=j(e),n=i.useRef(!1);return i.useEffect(()=>{const s=a=>{a.target&&!n.current&&Ge(Jt,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function je(){const e=new CustomEvent(de);document.dispatchEvent(e)}function Ge(e,t,r,{discrete:n}){const s=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?We(s,a):s.dispatchEvent(a)}var tn=Ke,nn=He,k=globalThis?.document?i.useLayoutEffect:()=>{},rn="Portal",Ye=i.forwardRef((e,t)=>{const{container:r,...n}=e,[s,a]=i.useState(!1);k(()=>a(!0),[]);const u=r||s&&globalThis?.document?.body;return u?Vt.createPortal(v.jsx(I.div,{...n,ref:t}),u):null});Ye.displayName=rn;function on(e,t){return i.useReducer((r,n)=>t[r][n]??r,e)}var ee=e=>{const{present:t,children:r}=e,n=sn(t),s=typeof r=="function"?r({present:n.isPresent}):i.Children.only(r),a=M(n.ref,an(s));return typeof r=="function"||n.isPresent?i.cloneElement(s,{ref:a}):null};ee.displayName="Presence";function sn(e){const[t,r]=i.useState(),n=i.useRef(null),s=i.useRef(e),a=i.useRef("none"),u=e?"mounted":"unmounted",[l,c]=on(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const o=X(n.current);a.current=l==="mounted"?o:"none"},[l]),k(()=>{const o=n.current,d=s.current;if(d!==e){const y=a.current,T=X(o);e?c("MOUNT"):T==="none"||o?.display==="none"?c("UNMOUNT"):c(d&&y!==T?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),k(()=>{if(t){let o;const d=t.ownerDocument.defaultView??window,f=T=>{const m=X(n.current).includes(CSS.escape(T.animationName));if(T.target===t&&m&&(c("ANIMATION_END"),!s.current)){const p=t.style.animationFillMode;t.style.animationFillMode="forwards",o=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=p)})}},y=T=>{T.target===t&&(a.current=X(n.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(o),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:i.useCallback(o=>{n.current=o?getComputedStyle(o):null,r(o)},[])}}function X(e){return e?.animationName||"none"}function an(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var cn=ye[" useInsertionEffect ".trim().toString()]||k;function te({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,a,u]=un({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:s;{const d=i.useRef(e!==void 0);i.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,n])}const o=i.useCallback(d=>{if(l){const f=ln(d)?d(e):d;f!==e&&u.current?.(f)}else a(d)},[l,e,a,u]);return[c,o]}function un({defaultProp:e,onChange:t}){const[r,n]=i.useState(e),s=i.useRef(r),a=i.useRef(t);return cn(()=>{a.current=t},[t]),i.useEffect(()=>{s.current!==r&&(a.current?.(r),s.current=r)},[r,s]),[r,n,a]}function ln(e){return typeof e=="function"}var dn=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),fn="VisuallyHidden",Te=i.forwardRef((e,t)=>v.jsx(I.span,{...e,ref:t,style:{...dn,...e.style}}));Te.displayName=fn;var Ce="ToastProvider",[he,pn,vn]=Ue("Toast"),[qe]=K("Toast",[vn]),[mn,ne]=qe(Ce),ze=e=>{const{__scopeToast:t,label:r="Notification",duration:n=5e3,swipeDirection:s="right",swipeThreshold:a=50,children:u}=e,[l,c]=i.useState(null),[o,d]=i.useState(0),f=i.useRef(!1),y=i.useRef(!1);return r.trim()||console.error(`Invalid prop \`label\` supplied to \`${Ce}\`. Expected non-empty \`string\`.`),v.jsx(he.Provider,{scope:t,children:v.jsx(mn,{scope:t,label:r,duration:n,swipeDirection:s,swipeThreshold:a,toastCount:o,viewport:l,onViewportChange:c,onToastAdd:i.useCallback(()=>d(T=>T+1),[]),onToastRemove:i.useCallback(()=>d(T=>T-1),[]),isFocusedToastEscapeKeyDownRef:f,isClosePausedRef:y,children:u})})};ze.displayName=Ce;var Xe="ToastViewport",yn=["F8"],fe="toast.viewportPause",pe="toast.viewportResume",Je=i.forwardRef((e,t)=>{const{__scopeToast:r,hotkey:n=yn,label:s="Notifications ({hotkey})",...a}=e,u=ne(Xe,r),l=pn(r),c=i.useRef(null),o=i.useRef(null),d=i.useRef(null),f=i.useRef(null),y=M(t,f,u.onViewportChange),T=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=u.toastCount>0;i.useEffect(()=>{const p=C=>{n.length!==0&&n.every(g=>C[g]||C.code===g)&&f.current?.focus()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[n]),i.useEffect(()=>{const p=c.current,C=f.current;if(x&&p&&C){const E=()=>{if(!u.isClosePausedRef.current){const w=new CustomEvent(fe);C.dispatchEvent(w),u.isClosePausedRef.current=!0}},g=()=>{if(u.isClosePausedRef.current){const w=new CustomEvent(pe);C.dispatchEvent(w),u.isClosePausedRef.current=!1}},b=w=>{!p.contains(w.relatedTarget)&&g()},_=()=>{p.contains(document.activeElement)||g()};return p.addEventListener("focusin",E),p.addEventListener("focusout",b),p.addEventListener("pointermove",E),p.addEventListener("pointerleave",_),window.addEventListener("blur",E),window.addEventListener("focus",g),()=>{p.removeEventListener("focusin",E),p.removeEventListener("focusout",b),p.removeEventListener("pointermove",E),p.removeEventListener("pointerleave",_),window.removeEventListener("blur",E),window.removeEventListener("focus",g)}}},[x,u.isClosePausedRef]);const m=i.useCallback(({tabbingDirection:p})=>{const E=l().map(g=>{const b=g.ref.current,_=[b,...In(b)];return p==="forwards"?_:_.reverse()});return(p==="forwards"?E.reverse():E).flat()},[l]);return i.useEffect(()=>{const p=f.current;if(p){const C=E=>{const g=E.altKey||E.ctrlKey||E.metaKey;if(E.key==="Tab"&&!g){const _=document.activeElement,w=E.shiftKey;if(E.target===p&&w){o.current?.focus();return}const L=m({tabbingDirection:w?"backwards":"forwards"}),O=L.findIndex(D=>D===_);ce(L.slice(O+1))?E.preventDefault():w?o.current?.focus():d.current?.focus()}};return p.addEventListener("keydown",C),()=>p.removeEventListener("keydown",C)}},[l,m]),v.jsxs(nn,{ref:c,role:"region","aria-label":s.replace("{hotkey}",T),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&v.jsx(ve,{ref:o,onFocusFromOutsideViewport:()=>{const p=m({tabbingDirection:"forwards"});ce(p)}}),v.jsx(he.Slot,{scope:r,children:v.jsx(I.ol,{tabIndex:-1,...a,ref:y})}),x&&v.jsx(ve,{ref:d,onFocusFromOutsideViewport:()=>{const p=m({tabbingDirection:"backwards"});ce(p)}})]})});Je.displayName=Xe;var Ze="ToastFocusProxy",ve=i.forwardRef((e,t)=>{const{__scopeToast:r,onFocusFromOutsideViewport:n,...s}=e,a=ne(Ze,r);return v.jsx(Te,{tabIndex:0,...s,ref:t,style:{position:"fixed"},onFocus:u=>{const l=u.relatedTarget;!a.viewport?.contains(l)&&n()}})});ve.displayName=Ze;var H="Toast",En="toast.swipeStart",gn="toast.swipeMove",Tn="toast.swipeCancel",Cn="toast.swipeEnd",Qe=i.forwardRef((e,t)=>{const{forceMount:r,open:n,defaultOpen:s,onOpenChange:a,...u}=e,[l,c]=te({prop:n,defaultProp:s??!0,onChange:a,caller:H});return v.jsx(ee,{present:r||l,children:v.jsx(bn,{open:l,...u,ref:t,onClose:()=>c(!1),onPause:j(e.onPause),onResume:j(e.onResume),onSwipeStart:S(e.onSwipeStart,o=>{o.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:S(e.onSwipeMove,o=>{const{x:d,y:f}=o.detail.delta;o.currentTarget.setAttribute("data-swipe","move"),o.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),o.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:S(e.onSwipeCancel,o=>{o.currentTarget.setAttribute("data-swipe","cancel"),o.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),o.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),o.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),o.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:S(e.onSwipeEnd,o=>{const{x:d,y:f}=o.detail.delta;o.currentTarget.setAttribute("data-swipe","end"),o.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),o.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),o.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),o.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})});Qe.displayName=H;var[hn,xn]=qe(H,{onClose(){}}),bn=i.forwardRef((e,t)=>{const{__scopeToast:r,type:n="foreground",duration:s,open:a,onClose:u,onEscapeKeyDown:l,onPause:c,onResume:o,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:y,onSwipeEnd:T,...x}=e,m=ne(H,r),[p,C]=i.useState(null),E=M(t,h=>C(h)),g=i.useRef(null),b=i.useRef(null),_=s||m.duration,w=i.useRef(0),R=i.useRef(_),P=i.useRef(0),{onToastAdd:L,onToastRemove:O}=m,D=j(()=>{p?.contains(document.activeElement)&&m.viewport?.focus(),u()}),V=i.useCallback(h=>{!h||h===1/0||(window.clearTimeout(P.current),w.current=new Date().getTime(),P.current=window.setTimeout(D,h))},[D]);i.useEffect(()=>{const h=m.viewport;if(h){const F=()=>{V(R.current),o?.()},N=()=>{const U=new Date().getTime()-w.current;R.current=R.current-U,window.clearTimeout(P.current),c?.()};return h.addEventListener(fe,N),h.addEventListener(pe,F),()=>{h.removeEventListener(fe,N),h.removeEventListener(pe,F)}}},[m.viewport,_,c,o,V]),i.useEffect(()=>{a&&!m.isClosePausedRef.current&&V(_)},[a,_,m.isClosePausedRef,V]),i.useEffect(()=>(L(),()=>O()),[L,O]);const Y=i.useMemo(()=>p?it(p):null,[p]);return m.viewport?v.jsxs(v.Fragment,{children:[Y&&v.jsx(Rn,{__scopeToast:r,role:"status","aria-live":n==="foreground"?"assertive":"polite",children:Y}),v.jsx(hn,{scope:r,onClose:D,children:Ee.createPortal(v.jsx(he.ItemSlot,{scope:r,children:v.jsx(tn,{asChild:!0,onEscapeKeyDown:S(l,()=>{m.isFocusedToastEscapeKeyDownRef.current||D(),m.isFocusedToastEscapeKeyDownRef.current=!1}),children:v.jsx(I.li,{tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":m.swipeDirection,...x,ref:E,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:S(e.onKeyDown,h=>{h.key==="Escape"&&(l?.(h.nativeEvent),h.nativeEvent.defaultPrevented||(m.isFocusedToastEscapeKeyDownRef.current=!0,D()))}),onPointerDown:S(e.onPointerDown,h=>{h.button===0&&(g.current={x:h.clientX,y:h.clientY})}),onPointerMove:S(e.onPointerMove,h=>{if(!g.current)return;const F=h.clientX-g.current.x,N=h.clientY-g.current.y,U=!!b.current,W=["left","right"].includes(m.swipeDirection),q=["left","up"].includes(m.swipeDirection)?Math.min:Math.max,Ot=W?q(0,F):0,Dt=W?0:q(0,N),se=h.pointerType==="touch"?10:2,z={x:Ot,y:Dt},Ne={originalEvent:h,delta:z};U?(b.current=z,J(gn,f,Ne,{discrete:!1})):$e(z,m.swipeDirection,se)?(b.current=z,J(En,d,Ne,{discrete:!1}),h.target.setPointerCapture(h.pointerId)):(Math.abs(F)>se||Math.abs(N)>se)&&(g.current=null)}),onPointerUp:S(e.onPointerUp,h=>{const F=b.current,N=h.target;if(N.hasPointerCapture(h.pointerId)&&N.releasePointerCapture(h.pointerId),b.current=null,g.current=null,F){const U=h.currentTarget,W={originalEvent:h,delta:F};$e(F,m.swipeDirection,m.swipeThreshold)?J(Cn,T,W,{discrete:!0}):J(Tn,y,W,{discrete:!0}),U.addEventListener("click",q=>q.preventDefault(),{once:!0})}})})})}),m.viewport)})]}):null}),Rn=e=>{const{__scopeToast:t,children:r,...n}=e,s=ne(H,t),[a,u]=i.useState(!1),[l,c]=i.useState(!1);return Sn(()=>u(!0)),i.useEffect(()=>{const o=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(o)},[]),l?null:v.jsx(Ye,{asChild:!0,children:v.jsx(Te,{...n,children:a&&v.jsxs(v.Fragment,{children:[s.label," ",r]})})})},wn="ToastTitle",et=i.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return v.jsx(I.div,{...n,ref:t})});et.displayName=wn;var Pn="ToastDescription",tt=i.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e;return v.jsx(I.div,{...n,ref:t})});tt.displayName=Pn;var nt="ToastAction",rt=i.forwardRef((e,t)=>{const{altText:r,...n}=e;return r.trim()?v.jsx(st,{altText:r,asChild:!0,children:v.jsx(xe,{...n,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${nt}\`. Expected non-empty \`string\`.`),null)});rt.displayName=nt;var ot="ToastClose",xe=i.forwardRef((e,t)=>{const{__scopeToast:r,...n}=e,s=xn(ot,r);return v.jsx(st,{asChild:!0,children:v.jsx(I.button,{type:"button",...n,ref:t,onClick:S(e.onClick,s.onClose)})})});xe.displayName=ot;var st=i.forwardRef((e,t)=>{const{__scopeToast:r,altText:n,...s}=e;return v.jsx(I.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":n||void 0,...s,ref:t})});function it(e){const t=[];return Array.from(e.childNodes).forEach(n=>{if(n.nodeType===n.TEXT_NODE&&n.textContent&&t.push(n.textContent),_n(n)){const s=n.ariaHidden||n.hidden||n.style.display==="none",a=n.dataset.radixToastAnnounceExclude==="";if(!s)if(a){const u=n.dataset.radixToastAnnounceAlt;u&&t.push(u)}else t.push(...it(n))}}),t}function J(e,t,r,{discrete:n}){const s=r.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?We(s,a):s.dispatchEvent(a)}var $e=(e,t,r=0)=>{const n=Math.abs(e.x),s=Math.abs(e.y),a=n>s;return t==="left"||t==="right"?a&&n>r:!a&&s>r};function Sn(e=()=>{}){const t=j(e);k(()=>{let r=0,n=0;return r=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(r),window.cancelAnimationFrame(n)}},[t])}function _n(e){return e.nodeType===e.ELEMENT_NODE}function In(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function ce(e){const t=document.activeElement;return e.some(r=>r===t?!0:(r.focus(),document.activeElement!==t))}var yr=ze,Er=Je,gr=Qe,Tr=et,Cr=tt,hr=rt,xr=xe,Nn=ye[" useId ".trim().toString()]||(()=>{}),An=0;function be(e){const[t,r]=i.useState(Nn());return k(()=>{r(n=>n??String(An++))},[e]),e||(t?`radix-${t}`:"")}var re="Collapsible",[On]=K(re),[Dn,Re]=On(re),at=i.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:a,onOpenChange:u,...l}=e,[c,o]=te({prop:n,defaultProp:s??!1,onChange:u,caller:re});return v.jsx(Dn,{scope:r,disabled:a,contentId:be(),open:c,onOpenToggle:i.useCallback(()=>o(d=>!d),[o]),children:v.jsx(I.div,{"data-state":Pe(c),"data-disabled":a?"":void 0,...l,ref:t})})});at.displayName=re;var ct="CollapsibleTrigger",Fn=i.forwardRef((e,t)=>{const{__scopeCollapsible:r,...n}=e,s=Re(ct,r);return v.jsx(I.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Pe(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:S(e.onClick,s.onOpenToggle)})});Fn.displayName=ct;var we="CollapsibleContent",Ln=i.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=Re(we,e.__scopeCollapsible);return v.jsx(ee,{present:r||s.open,children:({present:a})=>v.jsx(Mn,{...n,ref:t,present:a})})});Ln.displayName=we;var Mn=i.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:n,children:s,...a}=e,u=Re(we,r),[l,c]=i.useState(n),o=i.useRef(null),d=M(t,o),f=i.useRef(0),y=f.current,T=i.useRef(0),x=T.current,m=u.open||l,p=i.useRef(m),C=i.useRef(void 0);return i.useEffect(()=>{const E=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(E)},[]),k(()=>{const E=o.current;if(E){C.current=C.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const g=E.getBoundingClientRect();f.current=g.height,T.current=g.width,p.current||(E.style.transitionDuration=C.current.transitionDuration,E.style.animationName=C.current.animationName),c(n)}},[u.open,n]),v.jsx(I.div,{"data-state":Pe(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!m,...a,ref:d,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:m&&s})});function Pe(e){return e?"open":"closed"}var br=at;function jn(e,t=[]){let r=[];function n(a,u){const l=i.createContext(u);l.displayName=a+"Context";const c=r.length;r=[...r,u];const o=f=>{const{scope:y,children:T,...x}=f,m=y?.[e]?.[c]||l,p=i.useMemo(()=>x,Object.values(x));return v.jsx(m.Provider,{value:p,children:T})};o.displayName=a+"Provider";function d(f,y){const T=y?.[e]?.[c]||l,x=i.useContext(T);if(x)return x;if(u!==void 0)return u;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[o,d]}const s=()=>{const a=r.map(u=>i.createContext(u));return function(l){const c=l?.[e]||a;return i.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,$n(s,...t)]}function $n(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const u=n.reduce((l,{useScope:c,scopeName:o})=>{const f=c(a)[`__scope${o}`];return{...l,...f}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}var kn=Symbol.for("react.lazy"),Z=ye[" use ".trim().toString()];function Vn(e){return typeof e=="object"&&e!==null&&"then"in e}function ut(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===kn&&"_payload"in e&&Vn(e._payload)}function Un(e){const t=Wn(e),r=i.forwardRef((n,s)=>{let{children:a,...u}=n;ut(a)&&typeof Z=="function"&&(a=Z(a._payload));const l=i.Children.toArray(a),c=l.find(Kn);if(c){const o=c.props.children,d=l.map(f=>f===c?i.Children.count(o)>1?i.Children.only(null):i.isValidElement(o)?o.props.children:null:f);return v.jsx(t,{...u,ref:s,children:i.isValidElement(o)?i.cloneElement(o,void 0,d):null})}return v.jsx(t,{...u,ref:s,children:a})});return r.displayName=`${e}.Slot`,r}function Wn(e){const t=i.forwardRef((r,n)=>{let{children:s,...a}=r;if(ut(s)&&typeof Z=="function"&&(s=Z(s._payload)),i.isValidElement(s)){const u=Gn(s),l=Hn(a,s.props);return s.type!==i.Fragment&&(l.ref=n?ge(n,u):u),i.cloneElement(s,l)}return i.Children.count(s)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bn=Symbol("radix.slottable");function Kn(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Bn}function Hn(e,t){const r={...t};for(const n in t){const s=e[n],a=t[n];/^on[A-Z]/.test(n)?s&&a?r[n]=(...l)=>{const c=a(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...a}:n==="className"&&(r[n]=[s,a].filter(Boolean).join(" "))}return{...e,...r}}function Gn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Yn=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lt=Yn.reduce((e,t)=>{const r=Un(`Primitive.${t}`),n=i.forwardRef((s,a)=>{const{asChild:u,...l}=s,c=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(c,{...l,ref:a})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Se="Progress",_e=100,[qn]=jn(Se),[zn,Xn]=qn(Se),dt=i.forwardRef((e,t)=>{const{__scopeProgress:r,value:n=null,max:s,getValueLabel:a=Jn,...u}=e;(s||s===0)&&!ke(s)&&console.error(Zn(`${s}`,"Progress"));const l=ke(s)?s:_e;n!==null&&!Ve(n,l)&&console.error(Qn(`${n}`,"Progress"));const c=Ve(n,l)?n:null,o=Q(c)?a(c,l):void 0;return v.jsx(zn,{scope:r,value:c,max:l,children:v.jsx(lt.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Q(c)?c:void 0,"aria-valuetext":o,role:"progressbar","data-state":vt(c,l),"data-value":c??void 0,"data-max":l,...u,ref:t})})});dt.displayName=Se;var ft="ProgressIndicator",pt=i.forwardRef((e,t)=>{const{__scopeProgress:r,...n}=e,s=Xn(ft,r);return v.jsx(lt.div,{"data-state":vt(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...n,ref:t})});pt.displayName=ft;function Jn(e,t){return`${Math.round(e/t*100)}%`}function vt(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Q(e){return typeof e=="number"}function ke(e){return Q(e)&&!isNaN(e)&&e>0}function Ve(e,t){return Q(e)&&!isNaN(e)&&e<=t&&e>=0}function Zn(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${_e}\`.`}function Qn(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2
|
+
- a positive number
|
|
3
|
+
- less than the value passed to \`max\` (or ${_e} if no \`max\` prop is set)
|
|
4
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5
|
+
|
|
6
|
+
Defaulting to \`null\`.`}var Rr=dt,wr=pt,er=i.createContext(void 0);function mt(e){const t=i.useContext(er);return e||t||"ltr"}var ue="rovingFocusGroup.onEntryFocus",tr={bubbles:!1,cancelable:!0},G="RovingFocusGroup",[me,yt,nr]=Ue(G),[rr,Et]=K(G,[nr]),[or,sr]=rr(G),gt=i.forwardRef((e,t)=>v.jsx(me.Provider,{scope:e.__scopeRovingFocusGroup,children:v.jsx(me.Slot,{scope:e.__scopeRovingFocusGroup,children:v.jsx(ir,{...e,ref:t})})}));gt.displayName=G;var ir=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:a,currentTabStopId:u,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:o,preventScrollOnEntryFocus:d=!1,...f}=e,y=i.useRef(null),T=M(t,y),x=mt(a),[m,p]=te({prop:u,defaultProp:l??null,onChange:c,caller:G}),[C,E]=i.useState(!1),g=j(o),b=yt(r),_=i.useRef(!1),[w,R]=i.useState(0);return i.useEffect(()=>{const P=y.current;if(P)return P.addEventListener(ue,g),()=>P.removeEventListener(ue,g)},[g]),v.jsx(or,{scope:r,orientation:n,dir:x,loop:s,currentTabStopId:m,onItemFocus:i.useCallback(P=>p(P),[p]),onItemShiftTab:i.useCallback(()=>E(!0),[]),onFocusableItemAdd:i.useCallback(()=>R(P=>P+1),[]),onFocusableItemRemove:i.useCallback(()=>R(P=>P-1),[]),children:v.jsx(I.div,{tabIndex:C||w===0?-1:0,"data-orientation":n,...f,ref:T,style:{outline:"none",...e.style},onMouseDown:S(e.onMouseDown,()=>{_.current=!0}),onFocus:S(e.onFocus,P=>{const L=!_.current;if(P.target===P.currentTarget&&L&&!C){const O=new CustomEvent(ue,tr);if(P.currentTarget.dispatchEvent(O),!O.defaultPrevented){const D=b().filter(N=>N.focusable),V=D.find(N=>N.active),Y=D.find(N=>N.id===m),F=[V,Y,...D].filter(Boolean).map(N=>N.ref.current);ht(F,d)}}_.current=!1}),onBlur:S(e.onBlur,()=>E(!1))})})}),Tt="RovingFocusGroupItem",Ct=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:a,children:u,...l}=e,c=be(),o=a||c,d=sr(Tt,r),f=d.currentTabStopId===o,y=yt(r),{onFocusableItemAdd:T,onFocusableItemRemove:x,currentTabStopId:m}=d;return i.useEffect(()=>{if(n)return T(),()=>x()},[n,T,x]),v.jsx(me.ItemSlot,{scope:r,id:o,focusable:n,active:s,children:v.jsx(I.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:S(e.onMouseDown,p=>{n?d.onItemFocus(o):p.preventDefault()}),onFocus:S(e.onFocus,()=>d.onItemFocus(o)),onKeyDown:S(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){d.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const C=ur(p,d.orientation,d.dir);if(C!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let g=y().filter(b=>b.focusable).map(b=>b.ref.current);if(C==="last")g.reverse();else if(C==="prev"||C==="next"){C==="prev"&&g.reverse();const b=g.indexOf(p.currentTarget);g=d.loop?lr(g,b+1):g.slice(b+1)}setTimeout(()=>ht(g))}}),children:typeof u=="function"?u({isCurrentTabStop:f,hasTabStop:m!=null}):u})})});Ct.displayName=Tt;var ar={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cr(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ur(e,t,r){const n=cr(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return ar[n]}function ht(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function lr(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var dr=gt,fr=Ct,oe="Tabs",[pr]=K(oe,[Et]),xt=Et(),[vr,Ie]=pr(oe),bt=i.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,onValueChange:s,defaultValue:a,orientation:u="horizontal",dir:l,activationMode:c="automatic",...o}=e,d=mt(l),[f,y]=te({prop:n,onChange:s,defaultProp:a??"",caller:oe});return v.jsx(vr,{scope:r,baseId:be(),value:f,onValueChange:y,orientation:u,dir:d,activationMode:c,children:v.jsx(I.div,{dir:d,"data-orientation":u,...o,ref:t})})});bt.displayName=oe;var Rt="TabsList",wt=i.forwardRef((e,t)=>{const{__scopeTabs:r,loop:n=!0,...s}=e,a=Ie(Rt,r),u=xt(r);return v.jsx(dr,{asChild:!0,...u,orientation:a.orientation,dir:a.dir,loop:n,children:v.jsx(I.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});wt.displayName=Rt;var Pt="TabsTrigger",St=i.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,disabled:s=!1,...a}=e,u=Ie(Pt,r),l=xt(r),c=Nt(u.baseId,n),o=At(u.baseId,n),d=n===u.value;return v.jsx(fr,{asChild:!0,...l,focusable:!s,active:d,children:v.jsx(I.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":o,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...a,ref:t,onMouseDown:S(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?u.onValueChange(n):f.preventDefault()}),onKeyDown:S(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&u.onValueChange(n)}),onFocus:S(e.onFocus,()=>{const f=u.activationMode!=="manual";!d&&!s&&f&&u.onValueChange(n)})})})});St.displayName=Pt;var _t="TabsContent",It=i.forwardRef((e,t)=>{const{__scopeTabs:r,value:n,forceMount:s,children:a,...u}=e,l=Ie(_t,r),c=Nt(l.baseId,n),o=At(l.baseId,n),d=n===l.value,f=i.useRef(d);return i.useEffect(()=>{const y=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(y)},[]),v.jsx(ee,{present:s||d,children:({present:y})=>v.jsx(I.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!y,id:o,tabIndex:0,...u,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:y&&a})})});It.displayName=_t;function Nt(e,t){return`${e}-trigger-${t}`}function At(e,t){return`${e}-content-${t}`}var Pr=bt,Sr=wt,_r=St,Ir=It;export{hr as A,xr as C,Cr as D,wr as I,Sr as L,yr as P,gr as R,Tr as T,Er as V,br as a,Fn as b,Ln as c,Rr as d,Pr as e,_r as f,Ir as g,v as j,kt as r};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as i}from"./vendor-xstate-Dogcz2PC.js";var ae="popstate";function Te(e={}){function t(n,a){let{pathname:o,search:l,hash:u}=n.location;return X("",{pathname:o,search:l,hash:u},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:_(a)}return Fe(t,r,null,e)}function E(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function P(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Oe(){return Math.random().toString(36).substring(2,10)}function oe(e,t){return{usr:e.state,key:e.key,idx:t}}function X(e,t,r=null,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?I(t):t,state:r,key:t&&t.key||n||Oe()}}function _({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function I(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function Fe(e,t,r,n={}){let{window:a=document.defaultView,v5Compat:o=!1}=n,l=a.history,u="POP",s=null,c=d();c==null&&(c=0,l.replaceState({...l.state,idx:c},""));function d(){return(l.state||{idx:null}).idx}function f(){u="POP";let p=d(),v=p==null?null:p-c;c=p,s&&s({action:u,location:g.location,delta:v})}function m(p,v){u="PUSH";let h=X(g.location,p,v);c=d()+1;let R=oe(h,c),C=g.createHref(h);try{l.pushState(R,"",C)}catch(x){if(x instanceof DOMException&&x.name==="DataCloneError")throw x;a.location.assign(C)}o&&s&&s({action:u,location:g.location,delta:1})}function y(p,v){u="REPLACE";let h=X(g.location,p,v);c=d();let R=oe(h,c),C=g.createHref(h);l.replaceState(R,"",C),o&&s&&s({action:u,location:g.location,delta:0})}function w(p){return De(p)}let g={get action(){return u},get location(){return e(a,l)},listen(p){if(s)throw new Error("A history only accepts one active listener");return a.addEventListener(ae,f),s=p,()=>{a.removeEventListener(ae,f),s=null}},createHref(p){return t(a,p)},createURL:w,encodeLocation(p){let v=w(p);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:m,replace:y,go(p){return l.go(p)}};return g}function De(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),E(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:_(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function ce(e,t,r="/"){return Ie(e,t,r,!1)}function Ie(e,t,r,n){let a=typeof t=="string"?I(t):t,o=$(a.pathname||"/",r);if(o==null)return null;let l=fe(e);Ne(l);let u=null;for(let s=0;u==null&&s<l.length;++s){let c=Je(o);u=ze(l[s],c,n)}return u}function fe(e,t=[],r=[],n="",a=!1){let o=(l,u,s=a,c)=>{let d={relativePath:c===void 0?l.path||"":c,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(n)&&s)return;E(d.relativePath.startsWith(n),`Absolute route path "${d.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(n.length)}let f=L([n,d.relativePath]),m=r.concat(d);l.children&&l.children.length>0&&(E(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${f}".`),fe(l.children,t,m,f,s)),!(l.path==null&&!l.index)&&t.push({path:f,score:He(f,l.index),routesMeta:m})};return e.forEach((l,u)=>{if(l.path===""||!l.path?.includes("?"))o(l,u);else for(let s of de(l.path))o(l,u,!0,s)}),t}function de(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,a=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return a?[o,""]:[o];let l=de(n.join("/")),u=[];return u.push(...l.map(s=>s===""?o:[o,s].join("/"))),a&&u.push(...l),u.map(s=>e.startsWith("/")&&s===""?"/":s)}function Ne(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:je(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var Me=/^:[\w-]+$/,Be=3,_e=2,Ue=1,Ae=10,We=-2,le=e=>e==="*";function He(e,t){let r=e.split("/"),n=r.length;return r.some(le)&&(n+=We),t&&(n+=_e),r.filter(a=>!le(a)).reduce((a,o)=>a+(Me.test(o)?Be:o===""?Ue:Ae),n)}function je(e,t){return e.length===t.length&&e.slice(0,-1).every((n,a)=>n===t[a])?e[e.length-1]-t[t.length-1]:0}function ze(e,t,r=!1){let{routesMeta:n}=e,a={},o="/",l=[];for(let u=0;u<n.length;++u){let s=n[u],c=u===n.length-1,d=o==="/"?t:t.slice(o.length)||"/",f=V({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d),m=s.route;if(!f&&c&&r&&!n[n.length-1].route.index&&(f=V({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},d)),!f)return null;Object.assign(a,f.params),l.push({params:a,pathname:L([o,f.pathname]),pathnameBase:qe(L([o,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(o=L([o,f.pathnameBase]))}return l}function V(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=Ve(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let o=a[0],l=o.replace(/(.)\/+$/,"$1"),u=a.slice(1);return{params:n.reduce((c,{paramName:d,isOptional:f},m)=>{if(d==="*"){let w=u[m]||"";l=o.slice(0,o.length-w.length).replace(/(.)\/+$/,"$1")}const y=u[m];return f&&!y?c[d]=void 0:c[d]=(y||"").replace(/%2F/g,"/"),c},{}),pathname:o,pathnameBase:l,pattern:e}}function Ve(e,t=!1,r=!0){P(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,s)=>(n.push({paramName:u,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(n.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),n]}function Je(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return P(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function $(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}var Ke=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function Ye(e,t="/"){let{pathname:r,search:n="",hash:a=""}=typeof e=="string"?I(e):e,o;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?o=ie(r.substring(1),"/"):o=ie(r,t)):o=t,{pathname:o,search:Xe(n),hash:Qe(a)}}function ie(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Y(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Ge(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function he(e){let t=Ge(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function pe(e,t,r,n=!1){let a;typeof e=="string"?a=I(e):(a={...e},E(!a.pathname||!a.pathname.includes("?"),Y("?","pathname","search",a)),E(!a.pathname||!a.pathname.includes("#"),Y("#","pathname","hash",a)),E(!a.search||!a.search.includes("#"),Y("#","search","hash",a)));let o=e===""||a.pathname==="",l=o?"/":a.pathname,u;if(l==null)u=r;else{let f=t.length-1;if(!n&&l.startsWith("..")){let m=l.split("/");for(;m[0]==="..";)m.shift(),f-=1;a.pathname=m.join("/")}u=f>=0?t[f]:"/"}let s=Ye(a,u),c=l&&l!=="/"&&l.endsWith("/"),d=(o||l===".")&&r.endsWith("/");return!s.pathname.endsWith("/")&&(c||d)&&(s.pathname+="/"),s}var L=e=>e.join("/").replace(/\/\/+/g,"/"),qe=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Xe=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Qe=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Ze=class{constructor(e,t,r,n=!1){this.status=e,this.statusText=t||"",this.internal=n,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function et(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function tt(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var me=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ye(e,t){let r=e;if(typeof r!="string"||!Ke.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let n=r,a=!1;if(me)try{let o=new URL(window.location.href),l=r.startsWith("//")?new URL(o.protocol+r):new URL(r),u=$(l.pathname,t);l.origin===o.origin&&u!=null?r=u+l.search+l.hash:a=!0}catch{P(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:n,isExternal:a,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ge=["POST","PUT","PATCH","DELETE"];new Set(ge);var rt=["GET",...ge];new Set(rt);var N=i.createContext(null);N.displayName="DataRouter";var J=i.createContext(null);J.displayName="DataRouterState";var nt=i.createContext(!1),ve=i.createContext({isTransitioning:!1});ve.displayName="ViewTransition";var at=i.createContext(new Map);at.displayName="Fetchers";var ot=i.createContext(null);ot.displayName="Await";var b=i.createContext(null);b.displayName="Navigation";var U=i.createContext(null);U.displayName="Location";var S=i.createContext({outlet:null,matches:[],isDataRoute:!1});S.displayName="Route";var Z=i.createContext(null);Z.displayName="RouteError";var we="REACT_ROUTER_ERROR",lt="REDIRECT",it="ROUTE_ERROR_RESPONSE";function ut(e){if(e.startsWith(`${we}:${lt}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function st(e){if(e.startsWith(`${we}:${it}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Ze(t.status,t.statusText,t.data)}catch{}}function ct(e,{relative:t}={}){E(A(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=i.useContext(b),{hash:a,pathname:o,search:l}=W(e,{relative:t}),u=o;return r!=="/"&&(u=o==="/"?r:L([r,o])),n.createHref({pathname:u,search:l,hash:a})}function A(){return i.useContext(U)!=null}function O(){return E(A(),"useLocation() may be used only in the context of a <Router> component."),i.useContext(U).location}var Re="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ee(e){i.useContext(b).static||i.useLayoutEffect(e)}function ft(){let{isDataRoute:e}=i.useContext(S);return e?Pt():dt()}function dt(){E(A(),"useNavigate() may be used only in the context of a <Router> component.");let e=i.useContext(N),{basename:t,navigator:r}=i.useContext(b),{matches:n}=i.useContext(S),{pathname:a}=O(),o=JSON.stringify(he(n)),l=i.useRef(!1);return Ee(()=>{l.current=!0}),i.useCallback((s,c={})=>{if(P(l.current,Re),!l.current)return;if(typeof s=="number"){r.go(s);return}let d=pe(s,JSON.parse(o),a,c.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:L([t,d.pathname])),(c.replace?r.replace:r.push)(d,c.state,c)},[t,r,o,a,e])}var ht=i.createContext(null);function pt(e){let t=i.useContext(S).outlet;return i.useMemo(()=>t&&i.createElement(ht.Provider,{value:e},t),[t,e])}function sr(){let{matches:e}=i.useContext(S),t=e[e.length-1];return t?t.params:{}}function W(e,{relative:t}={}){let{matches:r}=i.useContext(S),{pathname:n}=O(),a=JSON.stringify(he(r));return i.useMemo(()=>pe(e,JSON.parse(a),n,t==="path"),[e,a,n,t])}function mt(e,t){return xe(e,t)}function xe(e,t,r,n,a){E(A(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=i.useContext(b),{matches:l}=i.useContext(S),u=l[l.length-1],s=u?u.params:{},c=u?u.pathname:"/",d=u?u.pathnameBase:"/",f=u&&u.route;{let h=f&&f.path||"";be(c,!f||h.endsWith("*")||h.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
2
|
+
|
|
3
|
+
Please change the parent <Route path="${h}"> to <Route path="${h==="/"?"*":`${h}/*`}">.`)}let m=O(),y;if(t){let h=typeof t=="string"?I(t):t;E(d==="/"||h.pathname?.startsWith(d),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${h.pathname}" was given in the \`location\` prop.`),y=h}else y=m;let w=y.pathname||"/",g=w;if(d!=="/"){let h=d.replace(/^\//,"").split("/");g="/"+w.replace(/^\//,"").split("/").slice(h.length).join("/")}let p=ce(e,{pathname:g});P(f||p!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),P(p==null||p[p.length-1].route.element!==void 0||p[p.length-1].route.Component!==void 0||p[p.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let v=Rt(p&&p.map(h=>Object.assign({},h,{params:Object.assign({},s,h.params),pathname:L([d,o.encodeLocation?o.encodeLocation(h.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathname]),pathnameBase:h.pathnameBase==="/"?d:L([d,o.encodeLocation?o.encodeLocation(h.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:h.pathnameBase])})),l,r,n,a);return t&&v?i.createElement(U.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},v):v}function yt(){let e=St(),t=et(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=i.createElement(i.Fragment,null,i.createElement("p",null,"💿 Hey developer 👋"),i.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",i.createElement("code",{style:o},"ErrorBoundary")," or"," ",i.createElement("code",{style:o},"errorElement")," prop on your route.")),i.createElement(i.Fragment,null,i.createElement("h2",null,"Unexpected Application Error!"),i.createElement("h3",{style:{fontStyle:"italic"}},t),r?i.createElement("pre",{style:a},r):null,l)}var gt=i.createElement(yt,null),Ce=class extends i.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=st(e.digest);r&&(e=r)}let t=e!==void 0?i.createElement(S.Provider,{value:this.props.routeContext},i.createElement(Z.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?i.createElement(vt,{error:e},t):t}};Ce.contextType=nt;var G=new WeakMap;function vt({children:e,error:t}){let{basename:r}=i.useContext(b);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let n=ut(t.digest);if(n){let a=G.get(t);if(a)throw a;let o=ye(n.location,r);if(me&&!G.get(t))if(o.isExternal||n.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const l=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:n.replace}));throw G.set(t,l),l}return i.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function wt({routeContext:e,match:t,children:r}){let n=i.useContext(N);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),i.createElement(S.Provider,{value:e},r)}function Rt(e,t=[],r=null,n=null,a=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let o=e,l=r?.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&l?.[f.route.id]!==void 0);E(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),o=o.slice(0,Math.min(o.length,d+1))}let u=!1,s=-1;if(r)for(let d=0;d<o.length;d++){let f=o[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(s=d),f.route.id){let{loaderData:m,errors:y}=r,w=f.route.loader&&!m.hasOwnProperty(f.route.id)&&(!y||y[f.route.id]===void 0);if(f.route.lazy||w){u=!0,s>=0?o=o.slice(0,s+1):o=[o[0]];break}}}let c=r&&n?(d,f)=>{n(d,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:tt(r.matches),errorInfo:f})}:void 0;return o.reduceRight((d,f,m)=>{let y,w=!1,g=null,p=null;r&&(y=l&&f.route.id?l[f.route.id]:void 0,g=f.route.errorElement||gt,u&&(s<0&&m===0?(be("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,p=null):s===m&&(w=!0,p=f.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,m+1)),h=()=>{let R;return y?R=g:w?R=p:f.route.Component?R=i.createElement(f.route.Component,null):f.route.element?R=f.route.element:R=d,i.createElement(wt,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:r!=null},children:R})};return r&&(f.route.ErrorBoundary||f.route.errorElement||m===0)?i.createElement(Ce,{location:r.location,revalidation:r.revalidation,component:g,error:y,children:h(),routeContext:{outlet:null,matches:v,isDataRoute:!0},onError:c}):h()},null)}function ee(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Et(e){let t=i.useContext(N);return E(t,ee(e)),t}function xt(e){let t=i.useContext(J);return E(t,ee(e)),t}function Ct(e){let t=i.useContext(S);return E(t,ee(e)),t}function te(e){let t=Ct(e),r=t.matches[t.matches.length-1];return E(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function bt(){return te("useRouteId")}function St(){let e=i.useContext(Z),t=xt("useRouteError"),r=te("useRouteError");return e!==void 0?e:t.errors?.[r]}function Pt(){let{router:e}=Et("useNavigate"),t=te("useNavigate"),r=i.useRef(!1);return Ee(()=>{r.current=!0}),i.useCallback(async(a,o={})=>{P(r.current,Re),r.current&&(typeof a=="number"?await e.navigate(a):await e.navigate(a,{fromRouteId:t,...o}))},[e,t])}var ue={};function be(e,t,r){!t&&!ue[e]&&(ue[e]=!0,P(!1,r))}i.memo(Lt);function Lt({routes:e,future:t,state:r,onError:n}){return xe(e,void 0,r,n,t)}function cr(e){return pt(e.context)}function $t(e){E(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function kt({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:a,static:o=!1,unstable_useTransitions:l}){E(!A(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),s=i.useMemo(()=>({basename:u,navigator:a,static:o,unstable_useTransitions:l,future:{}}),[u,a,o,l]);typeof r=="string"&&(r=I(r));let{pathname:c="/",search:d="",hash:f="",state:m=null,key:y="default"}=r,w=i.useMemo(()=>{let g=$(c,u);return g==null?null:{location:{pathname:g,search:d,hash:f,state:m,key:y},navigationType:n}},[u,c,d,f,m,y,n]);return P(w!=null,`<Router basename="${u}"> is not able to match the URL "${c}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:i.createElement(b.Provider,{value:s},i.createElement(U.Provider,{children:t,value:w}))}function fr({children:e,location:t}){return mt(Q(e),t)}function Q(e,t=[]){let r=[];return i.Children.forEach(e,(n,a)=>{if(!i.isValidElement(n))return;let o=[...t,a];if(n.type===i.Fragment){r.push.apply(r,Q(n.props.children,o));return}E(n.type===$t,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!n.props.index||!n.props.children,"An index route cannot have child routes.");let l={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(l.children=Q(n.props.children,o)),r.push(l)}),r}var j="get",z="application/x-www-form-urlencoded";function K(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Tt(e){return K(e)&&e.tagName.toLowerCase()==="button"}function Ot(e){return K(e)&&e.tagName.toLowerCase()==="form"}function Ft(e){return K(e)&&e.tagName.toLowerCase()==="input"}function Dt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function It(e,t){return e.button===0&&(!t||t==="_self")&&!Dt(e)}var H=null;function Nt(){if(H===null)try{new FormData(document.createElement("form"),0),H=!1}catch{H=!0}return H}var Mt=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function q(e){return e!=null&&!Mt.has(e)?(P(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${z}"`),null):e}function Bt(e,t){let r,n,a,o,l;if(Ot(e)){let u=e.getAttribute("action");n=u?$(u,t):null,r=e.getAttribute("method")||j,a=q(e.getAttribute("enctype"))||z,o=new FormData(e)}else if(Tt(e)||Ft(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let s=e.getAttribute("formaction")||u.getAttribute("action");if(n=s?$(s,t):null,r=e.getAttribute("formmethod")||u.getAttribute("method")||j,a=q(e.getAttribute("formenctype"))||q(u.getAttribute("enctype"))||z,o=new FormData(u,e),!Nt()){let{name:c,type:d,value:f}=e;if(d==="image"){let m=c?`${c}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else c&&o.append(c,f)}}else{if(K(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=j,n=null,a=z,l=e}return o&&a==="text/plain"&&(l=o,o=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:o,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function re(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function _t(e,t,r,n){let a=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${n}`:a.pathname=`${a.pathname}.${n}`:a.pathname==="/"?a.pathname=`_root.${n}`:t&&$(a.pathname,t)==="/"?a.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${n}`,a}async function Ut(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function At(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Wt(e,t,r){let n=await Promise.all(e.map(async a=>{let o=t.routes[a.route.id];if(o){let l=await Ut(o,r);return l.links?l.links():[]}return[]}));return Vt(n.flat(1).filter(At).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function se(e,t,r,n,a,o){let l=(s,c)=>r[c]?s.route.id!==r[c].route.id:!0,u=(s,c)=>r[c].pathname!==s.pathname||r[c].route.path?.endsWith("*")&&r[c].params["*"]!==s.params["*"];return o==="assets"?t.filter((s,c)=>l(s,c)||u(s,c)):o==="data"?t.filter((s,c)=>{let d=n.routes[s.route.id];if(!d||!d.hasLoader)return!1;if(l(s,c)||u(s,c))return!0;if(s.route.shouldRevalidate){let f=s.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:s.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function Ht(e,t,{includeHydrateFallback:r}={}){return jt(e.map(n=>{let a=t.routes[n.route.id];if(!a)return[];let o=[a.module];return a.clientActionModule&&(o=o.concat(a.clientActionModule)),a.clientLoaderModule&&(o=o.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(o=o.concat(a.hydrateFallbackModule)),a.imports&&(o=o.concat(a.imports)),o}).flat(1))}function jt(e){return[...new Set(e)]}function zt(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function Vt(e,t){let r=new Set;return new Set(t),e.reduce((n,a)=>{let o=JSON.stringify(zt(a));return r.has(o)||(r.add(o),n.push({key:o,link:a})),n},[])}function Se(){let e=i.useContext(N);return re(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Jt(){let e=i.useContext(J);return re(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ne=i.createContext(void 0);ne.displayName="FrameworkContext";function Pe(){let e=i.useContext(ne);return re(e,"You must render this element inside a <HydratedRouter> element"),e}function Kt(e,t){let r=i.useContext(ne),[n,a]=i.useState(!1),[o,l]=i.useState(!1),{onFocus:u,onBlur:s,onMouseEnter:c,onMouseLeave:d,onTouchStart:f}=t,m=i.useRef(null);i.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let g=v=>{v.forEach(h=>{l(h.isIntersecting)})},p=new IntersectionObserver(g,{threshold:.5});return m.current&&p.observe(m.current),()=>{p.disconnect()}}},[e]),i.useEffect(()=>{if(n){let g=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(g)}}},[n]);let y=()=>{a(!0)},w=()=>{a(!1),l(!1)};return r?e!=="intent"?[o,m,{}]:[o,m,{onFocus:B(u,y),onBlur:B(s,w),onMouseEnter:B(c,y),onMouseLeave:B(d,w),onTouchStart:B(f,y)}]:[!1,m,{}]}function B(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Yt({page:e,...t}){let{router:r}=Se(),n=i.useMemo(()=>ce(r.routes,e,r.basename),[r.routes,e,r.basename]);return n?i.createElement(qt,{page:e,matches:n,...t}):null}function Gt(e){let{manifest:t,routeModules:r}=Pe(),[n,a]=i.useState([]);return i.useEffect(()=>{let o=!1;return Wt(e,t,r).then(l=>{o||a(l)}),()=>{o=!0}},[e,t,r]),n}function qt({page:e,matches:t,...r}){let n=O(),{future:a,manifest:o,routeModules:l}=Pe(),{basename:u}=Se(),{loaderData:s,matches:c}=Jt(),d=i.useMemo(()=>se(e,t,c,o,n,"data"),[e,t,c,o,n]),f=i.useMemo(()=>se(e,t,c,o,n,"assets"),[e,t,c,o,n]),m=i.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let g=new Set,p=!1;if(t.forEach(h=>{let R=o.routes[h.route.id];!R||!R.hasLoader||(!d.some(C=>C.route.id===h.route.id)&&h.route.id in s&&l[h.route.id]?.shouldRevalidate||R.hasClientLoader?p=!0:g.add(h.route.id))}),g.size===0)return[];let v=_t(e,u,a.unstable_trailingSlashAwareDataRequests,"data");return p&&g.size>0&&v.searchParams.set("_routes",t.filter(h=>g.has(h.route.id)).map(h=>h.route.id).join(",")),[v.pathname+v.search]},[u,a.unstable_trailingSlashAwareDataRequests,s,n,o,d,t,e,l]),y=i.useMemo(()=>Ht(f,o),[f,o]),w=Gt(f);return i.createElement(i.Fragment,null,m.map(g=>i.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...r})),y.map(g=>i.createElement("link",{key:g,rel:"modulepreload",href:g,...r})),w.map(({key:g,link:p})=>i.createElement("link",{key:g,nonce:r.nonce,...p,crossOrigin:p.crossOrigin??r.crossOrigin})))}function Xt(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Qt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Qt&&(window.__reactRouterVersion="7.13.0")}catch{}function dr({basename:e,children:t,unstable_useTransitions:r,window:n}){let a=i.useRef();a.current==null&&(a.current=Te({window:n,v5Compat:!0}));let o=a.current,[l,u]=i.useState({action:o.action,location:o.location}),s=i.useCallback(c=>{r===!1?u(c):i.startTransition(()=>u(c))},[r]);return i.useLayoutEffect(()=>o.listen(s),[o,s]),i.createElement(kt,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:o,unstable_useTransitions:r})}var Le=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,$e=i.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:o,replace:l,state:u,target:s,to:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m,...y},w){let{basename:g,unstable_useTransitions:p}=i.useContext(b),v=typeof c=="string"&&Le.test(c),h=ye(c,g);c=h.to;let R=ct(c,{relative:a}),[C,x,k]=Kt(n,y),T=rr(c,{replace:l,state:u,target:s,preventScrollReset:d,relative:a,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:p});function F(M){t&&t(M),M.defaultPrevented||T(M)}let D=i.createElement("a",{...y,...k,href:h.absoluteURL||R,onClick:h.isExternal||o?t:F,ref:Xt(w,x),target:s,"data-discover":!v&&r==="render"?"true":void 0});return C&&!v?i.createElement(i.Fragment,null,D,i.createElement(Yt,{page:R})):D});$e.displayName="Link";var Zt=i.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:o,to:l,viewTransition:u,children:s,...c},d){let f=W(l,{relative:c.relative}),m=O(),y=i.useContext(J),{navigator:w,basename:g}=i.useContext(b),p=y!=null&&ir(f)&&u===!0,v=w.encodeLocation?w.encodeLocation(f).pathname:f.pathname,h=m.pathname,R=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;r||(h=h.toLowerCase(),R=R?R.toLowerCase():null,v=v.toLowerCase()),R&&g&&(R=$(R,g)||R);const C=v!=="/"&&v.endsWith("/")?v.length-1:v.length;let x=h===v||!a&&h.startsWith(v)&&h.charAt(C)==="/",k=R!=null&&(R===v||!a&&R.startsWith(v)&&R.charAt(v.length)==="/"),T={isActive:x,isPending:k,isTransitioning:p},F=x?t:void 0,D;typeof n=="function"?D=n(T):D=[n,x?"active":null,k?"pending":null,p?"transitioning":null].filter(Boolean).join(" ");let M=typeof o=="function"?o(T):o;return i.createElement($e,{...c,"aria-current":F,className:D,ref:d,style:M,to:l,viewTransition:u},typeof s=="function"?s(T):s)});Zt.displayName="NavLink";var er=i.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:a,state:o,method:l=j,action:u,onSubmit:s,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m,...y},w)=>{let{unstable_useTransitions:g}=i.useContext(b),p=or(),v=lr(u,{relative:c}),h=l.toLowerCase()==="get"?"get":"post",R=typeof u=="string"&&Le.test(u),C=x=>{if(s&&s(x),x.defaultPrevented)return;x.preventDefault();let k=x.nativeEvent.submitter,T=k?.getAttribute("formmethod")||l,F=()=>p(k||x.currentTarget,{fetcherKey:t,method:T,navigate:r,replace:a,state:o,relative:c,preventScrollReset:d,viewTransition:f,unstable_defaultShouldRevalidate:m});g&&r!==!1?i.startTransition(()=>F()):F()};return i.createElement("form",{ref:w,method:h,action:v,onSubmit:n?s:C,...y,"data-discover":!R&&e==="render"?"true":void 0})});er.displayName="Form";function tr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ke(e){let t=i.useContext(N);return E(t,tr(e)),t}function rr(e,{target:t,replace:r,state:n,preventScrollReset:a,relative:o,viewTransition:l,unstable_defaultShouldRevalidate:u,unstable_useTransitions:s}={}){let c=ft(),d=O(),f=W(e,{relative:o});return i.useCallback(m=>{if(It(m,t)){m.preventDefault();let y=r!==void 0?r:_(d)===_(f),w=()=>c(e,{replace:y,state:n,preventScrollReset:a,relative:o,viewTransition:l,unstable_defaultShouldRevalidate:u});s?i.startTransition(()=>w()):w()}},[d,c,f,r,n,t,e,a,o,l,u,s])}var nr=0,ar=()=>`__${String(++nr)}__`;function or(){let{router:e}=ke("useSubmit"),{basename:t}=i.useContext(b),r=bt(),n=e.fetch,a=e.navigate;return i.useCallback(async(o,l={})=>{let{action:u,method:s,encType:c,formData:d,body:f}=Bt(o,t);if(l.navigate===!1){let m=l.fetcherKey||ar();await n(m,r,l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:d,body:f,formMethod:l.method||s,formEncType:l.encType||c,flushSync:l.flushSync})}else await a(l.action||u,{unstable_defaultShouldRevalidate:l.unstable_defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:d,body:f,formMethod:l.method||s,formEncType:l.encType||c,replace:l.replace,state:l.state,fromRouteId:r,flushSync:l.flushSync,viewTransition:l.viewTransition})},[n,a,t,r])}function lr(e,{relative:t}={}){let{basename:r}=i.useContext(b),n=i.useContext(S);E(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),o={...W(e||".",{relative:t})},l=O();if(e==null){o.search=l.search;let u=new URLSearchParams(o.search),s=u.getAll("index");if(s.some(d=>d==="")){u.delete("index"),s.filter(f=>f).forEach(f=>u.append("index",f));let d=u.toString();o.search=d?`?${d}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:L([r,o.pathname])),_(o)}function ir(e,{relative:t}={}){let r=i.useContext(ve);E(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=ke("useViewTransitionState"),a=W(e,{relative:t});if(!r.isTransitioning)return!1;let o=$(r.currentLocation.pathname,n)||r.currentLocation.pathname,l=$(r.nextLocation.pathname,n)||r.nextLocation.pathname;return V(a.pathname,l)!=null||V(a.pathname,o)!=null}export{dr as B,$e as L,cr as O,fr as R,$t as a,sr as u};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function je(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const r in s)if(r!=="default"&&!(r in e)){const i=Object.getOwnPropertyDescriptor(s,r);i&&Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:()=>s[r]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lt={exports:{}},g={};var Wt;function De(){if(Wt)return g;Wt=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),u=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),a=Symbol.iterator;function p(o){return o===null||typeof o!="object"?null:(o=a&&o[a]||o["@@iterator"],typeof o=="function"?o:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,E={};function A(o,l,S){this.props=o,this.context=l,this.refs=E,this.updater=S||y}A.prototype.isReactComponent={},A.prototype.setState=function(o,l){if(typeof o!="object"&&typeof o!="function"&&o!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,o,l,"setState")},A.prototype.forceUpdate=function(o){this.updater.enqueueForceUpdate(this,o,"forceUpdate")};function $(){}$.prototype=A.prototype;function O(o,l,S){this.props=o,this.context=l,this.refs=E,this.updater=S||y}var D=O.prototype=new $;D.constructor=O,m(D,A.prototype),D.isPureReactComponent=!0;var X=Array.isArray;function k(){}var b={H:null,A:null,T:null,S:null},Z=Object.prototype.hasOwnProperty;function ft(o,l,S){var _=S.ref;return{$$typeof:e,type:o,key:l,ref:_!==void 0?_:null,props:S}}function Ie(o,l){return ft(o.type,l,o.props)}function ht(o){return typeof o=="object"&&o!==null&&o.$$typeof===e}function Re(o){var l={"=":"=0",":":"=2"};return"$"+o.replace(/[=:]/g,function(S){return l[S]})}var Ut=/\/+/g;function dt(o,l){return typeof o=="object"&&o!==null&&o.key!=null?Re(""+o.key):l.toString(36)}function ke(o){switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:switch(typeof o.status=="string"?o.then(k,k):(o.status="pending",o.then(function(l){o.status==="pending"&&(o.status="fulfilled",o.value=l)},function(l){o.status==="pending"&&(o.status="rejected",o.reason=l)})),o.status){case"fulfilled":return o.value;case"rejected":throw o.reason}}throw o}function U(o,l,S,_,w){var T=typeof o;(T==="undefined"||T==="boolean")&&(o=null);var x=!1;if(o===null)x=!0;else switch(T){case"bigint":case"string":case"number":x=!0;break;case"object":switch(o.$$typeof){case e:case t:x=!0;break;case v:return x=o._init,U(x(o._payload),l,S,_,w)}}if(x)return w=w(o),x=_===""?"."+dt(o,0):_,X(w)?(S="",x!=null&&(S=x.replace(Ut,"$&/")+"/"),U(w,l,S,"",function(Oe){return Oe})):w!=null&&(ht(w)&&(w=Ie(w,S+(w.key==null||o&&o.key===w.key?"":(""+w.key).replace(Ut,"$&/")+"/")+x)),l.push(w)),1;x=0;var j=_===""?".":_+":";if(X(o))for(var I=0;I<o.length;I++)_=o[I],T=j+dt(_,I),x+=U(_,l,S,T,w);else if(I=p(o),typeof I=="function")for(o=I.call(o),I=0;!(_=o.next()).done;)_=_.value,T=j+dt(_,I++),x+=U(_,l,S,T,w);else if(T==="object"){if(typeof o.then=="function")return U(ke(o),l,S,_,w);throw l=String(o),Error("Objects are not valid as a React child (found: "+(l==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":l)+"). If you meant to render a collection of children, use an array instead.")}return x}function F(o,l,S){if(o==null)return o;var _=[],w=0;return U(o,_,"","",function(T){return l.call(S,T,w++)}),_}function $e(o){if(o._status===-1){var l=o._result;l=l(),l.then(function(S){(o._status===0||o._status===-1)&&(o._status=1,o._result=S)},function(S){(o._status===0||o._status===-1)&&(o._status=2,o._result=S)}),o._status===-1&&(o._status=0,o._result=l)}if(o._status===1)return o._result.default;throw o._result}var Yt=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Ce={map:F,forEach:function(o,l,S){F(o,function(){l.apply(this,arguments)},S)},count:function(o){var l=0;return F(o,function(){l++}),l},toArray:function(o){return F(o,function(l){return l})||[]},only:function(o){if(!ht(o))throw Error("React.Children.only expected to receive a single React element child.");return o}};return g.Activity=f,g.Children=Ce,g.Component=A,g.Fragment=n,g.Profiler=r,g.PureComponent=O,g.StrictMode=s,g.Suspense=h,g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=b,g.__COMPILER_RUNTIME={__proto__:null,c:function(o){return b.H.useMemoCache(o)}},g.cache=function(o){return function(){return o.apply(null,arguments)}},g.cacheSignal=function(){return null},g.cloneElement=function(o,l,S){if(o==null)throw Error("The argument must be a React element, but you passed "+o+".");var _=m({},o.props),w=o.key;if(l!=null)for(T in l.key!==void 0&&(w=""+l.key),l)!Z.call(l,T)||T==="key"||T==="__self"||T==="__source"||T==="ref"&&l.ref===void 0||(_[T]=l[T]);var T=arguments.length-2;if(T===1)_.children=S;else if(1<T){for(var x=Array(T),j=0;j<T;j++)x[j]=arguments[j+2];_.children=x}return ft(o.type,w,_)},g.createContext=function(o){return o={$$typeof:u,_currentValue:o,_currentValue2:o,_threadCount:0,Provider:null,Consumer:null},o.Provider=o,o.Consumer={$$typeof:i,_context:o},o},g.createElement=function(o,l,S){var _,w={},T=null;if(l!=null)for(_ in l.key!==void 0&&(T=""+l.key),l)Z.call(l,_)&&_!=="key"&&_!=="__self"&&_!=="__source"&&(w[_]=l[_]);var x=arguments.length-2;if(x===1)w.children=S;else if(1<x){for(var j=Array(x),I=0;I<x;I++)j[I]=arguments[I+2];w.children=j}if(o&&o.defaultProps)for(_ in x=o.defaultProps,x)w[_]===void 0&&(w[_]=x[_]);return ft(o,T,w)},g.createRef=function(){return{current:null}},g.forwardRef=function(o){return{$$typeof:c,render:o}},g.isValidElement=ht,g.lazy=function(o){return{$$typeof:v,_payload:{_status:-1,_result:o},_init:$e}},g.memo=function(o,l){return{$$typeof:d,type:o,compare:l===void 0?null:l}},g.startTransition=function(o){var l=b.T,S={};b.T=S;try{var _=o(),w=b.S;w!==null&&w(S,_),typeof _=="object"&&_!==null&&typeof _.then=="function"&&_.then(k,Yt)}catch(T){Yt(T)}finally{l!==null&&S.types!==null&&(l.types=S.types),b.T=l}},g.unstable_useCacheRefresh=function(){return b.H.useCacheRefresh()},g.use=function(o){return b.H.use(o)},g.useActionState=function(o,l,S){return b.H.useActionState(o,l,S)},g.useCallback=function(o,l){return b.H.useCallback(o,l)},g.useContext=function(o){return b.H.useContext(o)},g.useDebugValue=function(){},g.useDeferredValue=function(o,l){return b.H.useDeferredValue(o,l)},g.useEffect=function(o,l){return b.H.useEffect(o,l)},g.useEffectEvent=function(o){return b.H.useEffectEvent(o)},g.useId=function(){return b.H.useId()},g.useImperativeHandle=function(o,l,S){return b.H.useImperativeHandle(o,l,S)},g.useInsertionEffect=function(o,l){return b.H.useInsertionEffect(o,l)},g.useLayoutEffect=function(o,l){return b.H.useLayoutEffect(o,l)},g.useMemo=function(o,l){return b.H.useMemo(o,l)},g.useOptimistic=function(o,l){return b.H.useOptimistic(o,l)},g.useReducer=function(o,l,S){return b.H.useReducer(o,l,S)},g.useRef=function(o){return b.H.useRef(o)},g.useState=function(o){return b.H.useState(o)},g.useSyncExternalStore=function(o,l,S){return b.H.useSyncExternalStore(o,l,S)},g.useTransition=function(){return b.H.useTransition()},g.version="19.2.4",g}var Jt;function It(){return Jt||(Jt=1,lt.exports=De()),lt.exports}var C=It();const Pe=Me(C),as=je({__proto__:null,default:Pe},[C]);var Le=C.useLayoutEffect;function He(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global}function qe(){const e=He();if(e.__xstate__)return e.__xstate__}const ze=e=>{if(typeof window>"u")return;const t=qe();t&&t.register(e)};class Gt{constructor(t){this._process=t,this._active=!1,this._current=null,this._last=null}start(){this._active=!0,this.flush()}clear(){this._current&&(this._current.next=null,this._last=this._current)}enqueue(t){const n={value:t,next:null};if(this._current){this._last.next=n,this._last=n;return}this._current=n,this._last=n,this._active&&this.flush()}flush(){for(;this._current;){const t=this._current;this._process(t.value),this._current=t.next}this._last=null}}const re=".",Ue="",ie="",Ye="#",We="*",oe="xstate.init",Je="xstate.error",et="xstate.stop";function Ge(e,t){return{type:`xstate.after.${e}.${t}`}}function bt(e,t){return{type:`xstate.done.state.${e}`,output:t}}function Be(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function ce(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function ue(e){return{type:oe,input:e}}function M(e){setTimeout(()=>{throw e})}const Ne=typeof Symbol=="function"&&Symbol.observable||"@@observable";function ae(e,t){const n=Bt(e),s=Bt(t);return typeof s=="string"?typeof n=="string"?s===n:!1:typeof n=="string"?n in s:Object.keys(n).every(r=>r in s?ae(n[r],s[r]):!1)}function Rt(e){if(he(e))return e;const t=[];let n="";for(let s=0;s<e.length;s++){switch(e.charCodeAt(s)){case 92:n+=e[s+1],s++;continue;case 46:t.push(n),n="";continue}n+=e[s]}return t.push(n),t}function Bt(e){if(In(e))return e.value;if(typeof e!="string")return e;const t=Rt(e);return Ke(t)}function Ke(e){if(e.length===1)return e[0];const t={};let n=t;for(let s=0;s<e.length-1;s++)if(s===e.length-2)n[e[s]]=e[s+1];else{const r=n;n={},r[e[s]]=n}return t}function Nt(e,t){const n={},s=Object.keys(e);for(let r=0;r<s.length;r++){const i=s[r];n[i]=t(e[i],i,e,r)}return n}function fe(e){return he(e)?e:[e]}function P(e){return e===void 0?[]:fe(e)}function wt(e,t,n,s){return typeof e=="function"?e({context:t,event:n,self:s}):e}function he(e){return Array.isArray(e)}function Xe(e){return e.type.startsWith("xstate.error.actor")}function W(e){return fe(e).map(t=>typeof t>"u"||typeof t=="string"?{target:t}:t)}function de(e){if(!(e===void 0||e===Ue))return P(e)}function nt(e,t,n){const s=typeof e=="object",r=s?e:void 0;return{next:(s?e.next:e)?.bind(r),error:(s?e.error:t)?.bind(r),complete:(s?e.complete:n)?.bind(r)}}function Kt(e,t){return`${t}.${e}`}function kt(e,t){const n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];const[,s,r]=n,u=e.getStateNodeById(r).config.invoke;return(Array.isArray(u)?u[s]:u).src}function Ze(e,t){if(t===e||t===We)return!0;if(!t.endsWith(".*"))return!1;const n=t.split("."),s=e.split(".");for(let r=0;r<n.length;r++){const i=n[r],u=s[r];if(i==="*")return r===n.length-1;if(i!==u)return!1}return!0}function Xt(e,t){return`${e.sessionId}.${t}`}let Ve=0;function Qe(e,t){const n=new Map,s=new Map,r=new WeakMap,i=new Set,u={},{clock:c,logger:h}=t,d={schedule:(a,p,y,m,E=Math.random().toString(36).slice(2))=>{const A={source:a,target:p,event:y,delay:m,id:E,startedAt:Date.now()},$=Xt(a,E);f._snapshot._scheduledEvents[$]=A;const O=c.setTimeout(()=>{delete u[$],delete f._snapshot._scheduledEvents[$],f._relay(a,p,y)},m);u[$]=O},cancel:(a,p)=>{const y=Xt(a,p),m=u[y];delete u[y],delete f._snapshot._scheduledEvents[y],m!==void 0&&c.clearTimeout(m)},cancelAll:a=>{for(const p in f._snapshot._scheduledEvents){const y=f._snapshot._scheduledEvents[p];y.source===a&&d.cancel(a,y.id)}}},v=a=>{if(!i.size)return;const p={...a,rootId:e.sessionId};i.forEach(y=>y.next?.(p))},f={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${Ve++}`,_register:(a,p)=>(n.set(a,p),a),_unregister:a=>{n.delete(a.sessionId);const p=r.get(a);p!==void 0&&(s.delete(p),r.delete(a))},get:a=>s.get(a),getAll:()=>Object.fromEntries(s.entries()),_set:(a,p)=>{const y=s.get(a);if(y&&y!==p)throw new Error(`Actor with system ID '${a}' already exists.`);s.set(a,p),r.set(p,a)},inspect:a=>{const p=nt(a);return i.add(p),{unsubscribe(){i.delete(p)}}},_sendInspectionEvent:v,_relay:(a,p,y)=>{f._sendInspectionEvent({type:"@xstate.event",sourceRef:a,actorRef:p,event:y}),p._send(y)},scheduler:d,getSnapshot:()=>({_scheduledEvents:{...f._snapshot._scheduledEvents}}),start:()=>{const a=f._snapshot._scheduledEvents;f._snapshot._scheduledEvents={};for(const p in a){const{source:y,target:m,event:E,delay:A,id:$}=a[p];d.schedule(y,m,E,A,$)}},_clock:c,_logger:h};return f}let pt=!1;const $t=1;let R=(function(e){return e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped",e})({});const Fe={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};class tn{constructor(t,n){this.logic=t,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new Gt(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=R.NotStarted,this._parent=void 0,this._syncSnapshot=void 0,this.ref=void 0,this._actorScope=void 0,this.systemId=void 0,this.sessionId=void 0,this.system=void 0,this._doneEvent=void 0,this.src=void 0,this._deferred=[];const s={...Fe,...n},{clock:r,logger:i,parent:u,syncSnapshot:c,id:h,systemId:d,inspect:v}=s;this.system=u?u.system:Qe(this,{clock:r,logger:i}),v&&!u&&this.system.inspect(nt(v)),this.sessionId=this.system._bookId(),this.id=h??this.sessionId,this.logger=n?.logger??this.system._logger,this.clock=n?.clock??this.system._clock,this._parent=u,this._syncSnapshot=c,this.options=s,this.src=s.src??t,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:f=>{this._deferred.push(f)},system:this.system,stopChild:f=>{if(f._parent!==this)throw new Error(`Cannot stop child actor ${f.id} of ${this.id} because it is not a child`);f._stop()},emit:f=>{const a=this.eventListeners.get(f.type),p=this.eventListeners.get("*");if(!a&&!p)return;const y=[...a?a.values():[],...p?p.values():[]];for(const m of y)try{m(f)}catch(E){M(E)}},actionExecutor:f=>{const a=()=>{if(this._actorScope.system._sendInspectionEvent({type:"@xstate.action",actorRef:this,action:{type:f.type,params:f.params}}),!f.exec)return;const p=pt;try{pt=!0,f.exec(f.info,f.params)}finally{pt=p}};this._processingStatus===R.Running?a():this._deferred.push(a)}},this.send=this.send.bind(this),this.system._sendInspectionEvent({type:"@xstate.actor",actorRef:this}),d&&(this.systemId=d,this.system._set(d,this)),this._initState(n?.snapshot??n?.state),d&&this._snapshot.status!=="active"&&this.system._unregister(this)}_initState(t){try{this._snapshot=t?this.logic.restoreSnapshot?this.logic.restoreSnapshot(t,this._actorScope):t:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(n){this._snapshot={status:"error",output:void 0,error:n}}}update(t,n){this._snapshot=t;let s;for(;s=this._deferred.shift();)try{s()}catch(r){this._deferred.length=0,this._snapshot={...t,status:"error",error:r}}switch(this._snapshot.status){case"active":for(const r of this.observers)try{r.next?.(t)}catch(i){M(i)}break;case"done":for(const r of this.observers)try{r.next?.(t)}catch(i){M(i)}this._stopProcedure(),this._complete(),this._doneEvent=Be(this.id,this._snapshot.output),this._parent&&this.system._relay(this,this._parent,this._doneEvent);break;case"error":this._error(this._snapshot.error);break}this.system._sendInspectionEvent({type:"@xstate.snapshot",actorRef:this,event:n,snapshot:t})}subscribe(t,n,s){const r=nt(t,n,s);if(this._processingStatus!==R.Stopped)this.observers.add(r);else switch(this._snapshot.status){case"done":try{r.complete?.()}catch(i){M(i)}break;case"error":{const i=this._snapshot.error;if(!r.error)M(i);else try{r.error(i)}catch(u){M(u)}break}}return{unsubscribe:()=>{this.observers.delete(r)}}}on(t,n){let s=this.eventListeners.get(t);s||(s=new Set,this.eventListeners.set(t,s));const r=n.bind(void 0);return s.add(r),{unsubscribe:()=>{s.delete(r)}}}start(){if(this._processingStatus===R.Running)return this;this._syncSnapshot&&this.subscribe({next:s=>{s.status==="active"&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:s})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=R.Running;const t=ue(this.options.input);switch(this.system._sendInspectionEvent({type:"@xstate.event",sourceRef:this._parent,actorRef:this,event:t}),this._snapshot.status){case"done":return this.update(this._snapshot,t),this;case"error":return this._error(this._snapshot.error),this}if(this._parent||this.system.start(),this.logic.start)try{this.logic.start(this._snapshot,this._actorScope)}catch(s){return this._snapshot={...this._snapshot,status:"error",error:s},this._error(s),this}return this.update(this._snapshot,t),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(t){let n,s;try{n=this.logic.transition(this._snapshot,t,this._actorScope)}catch(r){s={err:r}}if(s){const{err:r}=s;this._snapshot={...this._snapshot,status:"error",error:r},this._error(r);return}this.update(n,t),t.type===et&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===R.Stopped?this:(this.mailbox.clear(),this._processingStatus===R.NotStarted?(this._processingStatus=R.Stopped,this):(this.mailbox.enqueue({type:et}),this))}stop(){if(this._parent)throw new Error("A non-root actor cannot be stopped directly.");return this._stop()}_complete(){for(const t of this.observers)try{t.complete?.()}catch(n){M(n)}this.observers.clear(),this.eventListeners.clear()}_reportError(t){if(!this.observers.size){this._parent||M(t),this.eventListeners.clear();return}let n=!1;for(const s of this.observers){const r=s.error;n||=!r;try{r?.(t)}catch(i){M(i)}}this.observers.clear(),this.eventListeners.clear(),n&&M(t)}_error(t){this._stopProcedure(),this._reportError(t),this._parent&&this.system._relay(this,this._parent,ce(this.id,t))}_stopProcedure(){return this._processingStatus!==R.Running?this:(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new Gt(this._process.bind(this)),this._processingStatus=R.Stopped,this.system._unregister(this),this)}_send(t){this._processingStatus!==R.Stopped&&this.mailbox.enqueue(t)}send(t){this.system._relay(void 0,this,t)}attachDevTools(){const{devTools:t}=this.options;t&&(typeof t=="function"?t:ze)(this)}toJSON(){return{xstate$$type:$t,id:this.id}}getPersistedSnapshot(t){return this.logic.getPersistedSnapshot(this._snapshot,t)}[Ne](){return this}getSnapshot(){return this._snapshot}}function G(e,...[t]){return new tn(e,t)}function en(e,t,n,s,{sendId:r}){const i=typeof r=="function"?r(n,s):r;return[t,{sendId:i},void 0]}function nn(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function Ct(e){function t(n,s){}return t.type="xstate.cancel",t.sendId=e,t.resolve=en,t.execute=nn,t}function sn(e,t,n,s,{id:r,systemId:i,src:u,input:c,syncSnapshot:h}){const d=typeof u=="string"?kt(t.machine,u):u,v=typeof r=="function"?r(n):r;let f,a;return d&&(a=typeof c=="function"?c({context:t.context,event:n.event,self:e.self}):c,f=G(d,{id:v,src:u,parent:e.self,syncSnapshot:h,systemId:i,input:a})),[z(t,{children:{...t.children,[v]:f}}),{id:r,systemId:i,actorRef:f,src:u,input:a},void 0]}function rn(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==R.Stopped&&t.start()})}function Ot(...[e,{id:t,systemId:n,input:s,syncSnapshot:r=!1}={}]){function i(u,c){}return i.type="xstate.spawnChild",i.id=t,i.systemId=n,i.src=e,i.input=s,i.syncSnapshot=r,i.resolve=sn,i.execute=rn,i}function on(e,t,n,s,{actorRef:r}){const i=typeof r=="function"?r(n,s):r,u=typeof i=="string"?t.children[i]:i;let c=t.children;return u&&(c={...c},delete c[u.id]),[z(t,{children:c}),u,void 0]}function le(e,t){const n=t.getSnapshot();if(n&&"children"in n)for(const s of Object.values(n.children))le(e,s);e.system._unregister(t)}function cn(e,t){if(t){if(le(e,t),t._processingStatus!==R.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}}function ct(e){function t(n,s){}return t.type="xstate.stopChild",t.actorRef=e,t.resolve=on,t.execute=cn,t}function ut(e,t,n,s){const{machine:r}=s,i=typeof e=="function",u=i?e:r.implementations.guards[typeof e=="string"?e:e.type];if(!i&&!u)throw new Error(`Guard '${typeof e=="string"?e:e.type}' is not implemented.'.`);if(typeof u!="function")return ut(u,t,n,s);const c={context:t,event:n},h=i||typeof e=="string"?void 0:"params"in e?typeof e.params=="function"?e.params({context:t,event:n}):e.params:void 0;return"check"in u?u.check(s,c,u):u(c,h)}function jt(e){return e.type==="atomic"||e.type==="final"}function B(e){return Object.values(e.states).filter(t=>t.type!=="history")}function Q(e,t){const n=[];if(t===e)return n;let s=e.parent;for(;s&&s!==t;)n.push(s),s=s.parent;return n}function st(e){const t=new Set(e),n=ye(t);for(const s of t)if(s.type==="compound"&&(!n.get(s)||!n.get(s).length))Zt(s).forEach(r=>t.add(r));else if(s.type==="parallel"){for(const r of B(s))if(r.type!=="history"&&!t.has(r)){const i=Zt(r);for(const u of i)t.add(u)}}for(const s of t){let r=s.parent;for(;r;)t.add(r),r=r.parent}return t}function pe(e,t){const n=t.get(e);if(!n)return{};if(e.type==="compound"){const r=n[0];if(r){if(jt(r))return r.key}else return{}}const s={};for(const r of n)s[r.key]=pe(r,t);return s}function ye(e){const t=new Map;for(const n of e)t.has(n)||t.set(n,[]),n.parent&&(t.has(n.parent)||t.set(n.parent,[]),t.get(n.parent).push(n));return t}function ve(e,t){const n=st(t);return pe(e,ye(n))}function Mt(e,t){return t.type==="compound"?B(t).some(n=>n.type==="final"&&e.has(n)):t.type==="parallel"?B(t).every(n=>Mt(e,n)):t.type==="final"}const at=e=>e[0]===Ye;function un(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(s=>Ze(t,s)).sort((s,r)=>r.length-s.length).flatMap(s=>e.transitions.get(s))}function an(e){const t=e.config.after;if(!t)return[];const n=r=>{const i=Ge(r,e.id),u=i.type;return e.entry.push(Lt(i,{id:u,delay:r})),e.exit.push(Ct(u)),u};return Object.keys(t).flatMap(r=>{const i=t[r],u=typeof i=="string"?{target:i}:i,c=Number.isNaN(+r)?r:+r,h=n(c);return P(u).map(d=>({...d,event:h,delay:c}))}).map(r=>{const{delay:i}=r;return{...H(e,r.event,r),delay:i}})}function H(e,t,n){const s=de(n.target),r=n.reenter??!1,i=dn(e,s),u={...n,actions:P(n.actions),guard:n.guard,target:i,source:e,reenter:r,eventType:t,toJSON:()=>({...u,source:`#${e.id}`,target:i?i.map(c=>`#${c.id}`):void 0})};return u}function fn(e){const t=new Map;if(e.config.on)for(const n of Object.keys(e.config.on)){if(n===ie)throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');const s=e.config.on[n];t.set(n,W(s).map(r=>H(e,n,r)))}if(e.config.onDone){const n=`xstate.done.state.${e.id}`;t.set(n,W(e.config.onDone).map(s=>H(e,n,s)))}for(const n of e.invoke){if(n.onDone){const s=`xstate.done.actor.${n.id}`;t.set(s,W(n.onDone).map(r=>H(e,s,r)))}if(n.onError){const s=`xstate.error.actor.${n.id}`;t.set(s,W(n.onError).map(r=>H(e,s,r)))}if(n.onSnapshot){const s=`xstate.snapshot.${n.id}`;t.set(s,W(n.onSnapshot).map(r=>H(e,s,r)))}}for(const n of e.after){let s=t.get(n.eventType);s||(s=[],t.set(n.eventType,s)),s.push(n)}return t}function hn(e,t){const n=typeof t=="string"?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw new Error(`Initial state node "${t}" not found on parent state node #${e.id}`);const s={source:e,actions:!t||typeof t=="string"?[]:P(t.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...s,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return s}function dn(e,t){if(t!==void 0)return t.map(n=>{if(typeof n!="string")return n;if(at(n))return e.machine.getStateNodeById(n);const s=n[0]===re;if(s&&!e.parent)return rt(e,n.slice(1));const r=s?e.key+n:n;if(e.parent)try{return rt(e.parent,r)}catch(i){throw new Error(`Invalid transition definition for state node '${e.id}':
|
|
2
|
+
${i.message}`)}else throw new Error(`Invalid target: "${n}" is not a valid target from the root node. Did you mean ".${n}"?`)})}function me(e){const t=de(e.config.target);return t?{target:t.map(n=>typeof n=="string"?rt(e.parent,n):n)}:e.parent.initial}function q(e){return e.type==="history"}function Zt(e){const t=ge(e);for(const n of t)for(const s of Q(n,e))t.add(s);return t}function ge(e){const t=new Set;function n(s){if(!t.has(s)){if(t.add(s),s.type==="compound")n(s.initial.target[0]);else if(s.type==="parallel")for(const r of B(s))n(r)}}return n(e),t}function N(e,t){if(at(t))return e.machine.getStateNodeById(t);if(!e.states)throw new Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);const n=e.states[t];if(!n)throw new Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function rt(e,t){if(typeof t=="string"&&at(t))try{return e.machine.getStateNodeById(t)}catch{}const n=Rt(t).slice();let s=e;for(;n.length;){const r=n.shift();if(!r.length)break;s=N(s,r)}return s}function it(e,t){if(typeof t=="string"){const r=e.states[t];if(!r)throw new Error(`State '${t}' does not exist on '${e.id}'`);return[e,r]}const n=Object.keys(t),s=n.map(r=>N(e,r)).filter(Boolean);return[e.machine.root,e].concat(s,n.reduce((r,i)=>{const u=N(e,i);if(!u)return r;const c=it(u,t[i]);return r.concat(c)},[]))}function ln(e,t,n,s){const i=N(e,t).next(n,s);return!i||!i.length?e.next(n,s):i}function pn(e,t,n,s){const r=Object.keys(t),i=N(e,r[0]),u=Dt(i,t[r[0]],n,s);return!u||!u.length?e.next(n,s):u}function yn(e,t,n,s){const r=[];for(const i of Object.keys(t)){const u=t[i];if(!u)continue;const c=N(e,i),h=Dt(c,u,n,s);h&&r.push(...h)}return r.length?r:e.next(n,s)}function Dt(e,t,n,s){return typeof t=="string"?ln(e,t,n,s):Object.keys(t).length===1?pn(e,t,n,s):yn(e,t,n,s)}function vn(e){return Object.keys(e.states).map(t=>e.states[t]).filter(t=>t.type==="history")}function L(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function mn(e,t){const n=new Set(e),s=new Set(t);for(const r of n)if(s.has(r))return!0;for(const r of s)if(n.has(r))return!0;return!1}function _e(e,t,n){const s=new Set;for(const r of e){let i=!1;const u=new Set;for(const c of s)if(mn(Tt([r],t,n),Tt([c],t,n)))if(L(r.source,c.source))u.add(c);else{i=!0;break}if(!i){for(const c of u)s.delete(c);s.add(r)}}return Array.from(s)}function gn(e){const[t,...n]=e;for(const s of Q(t,void 0))if(n.every(r=>L(r,s)))return s}function Pt(e,t){if(!e.target)return[];const n=new Set;for(const s of e.target)if(q(s))if(t[s.id])for(const r of t[s.id])n.add(r);else for(const r of Pt(me(s),t))n.add(r);else n.add(s);return[...n]}function Se(e,t){const n=Pt(e,t);if(!n)return;if(!e.reenter&&n.every(r=>r===e.source||L(r,e.source)))return e.source;const s=gn(n.concat(e.source));if(s)return s;if(!e.reenter)return e.source.machine.root}function Tt(e,t,n){const s=new Set;for(const r of e)if(r.target?.length){const i=Se(r,n);r.reenter&&r.source===i&&s.add(i);for(const u of t)L(u,i)&&s.add(u)}return[...s]}function _n(e,t){if(e.length!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function xt(e,t,n,s,r,i){if(!e.length)return t;const u=new Set(t._nodes);let c=t.historyValue;const h=_e(e,u,c);let d=t;r||([d,c]=wn(d,s,n,h,u,c,i,n.actionExecutor)),d=K(d,s,n,h.flatMap(f=>f.actions),i,void 0),d=En(d,s,n,h,u,i,c,r);const v=[...u];d.status==="done"&&(d=K(d,s,n,v.sort((f,a)=>a.order-f.order).flatMap(f=>f.exit),i,void 0));try{return c===t.historyValue&&_n(t._nodes,u)?d:z(d,{_nodes:v,historyValue:c})}catch(f){throw f}}function Sn(e,t,n,s,r){if(s.output===void 0)return;const i=bt(r.id,r.output!==void 0&&r.parent?wt(r.output,e.context,t,n.self):void 0);return wt(s.output,e.context,i,n.self)}function En(e,t,n,s,r,i,u,c){let h=e;const d=new Set,v=new Set;bn(s,u,v,d),c&&v.add(e.machine.root);const f=new Set;for(const a of[...d].sort((p,y)=>p.order-y.order)){r.add(a);const p=[];p.push(...a.entry);for(const y of a.invoke)p.push(Ot(y.src,{...y,syncSnapshot:!!y.onSnapshot}));if(v.has(a)){const y=a.initial.actions;p.push(...y)}if(h=K(h,t,n,p,i,a.invoke.map(y=>y.id)),a.type==="final"){const y=a.parent;let m=y?.type==="parallel"?y:y?.parent,E=m||a;for(y?.type==="compound"&&i.push(bt(y.id,a.output!==void 0?wt(a.output,h.context,t,n.self):void 0));m?.type==="parallel"&&!f.has(m)&&Mt(r,m);)f.add(m),i.push(bt(m.id)),E=m,m=m.parent;if(m)continue;h=z(h,{status:"done",output:Sn(h,t,n,h.machine.root,E)})}}return h}function bn(e,t,n,s){for(const r of e){const i=Se(r,t);for(const c of r.target||[])!q(c)&&(r.source!==c||r.source!==i||r.reenter)&&(s.add(c),n.add(c)),J(c,t,n,s);const u=Pt(r,t);for(const c of u){const h=Q(c,i);i?.type==="parallel"&&h.push(i),Ee(s,t,n,h,!r.source.parent&&r.reenter?void 0:i)}}}function J(e,t,n,s){if(q(e))if(t[e.id]){const r=t[e.id];for(const i of r)s.add(i),J(i,t,n,s);for(const i of r)yt(i,e.parent,s,t,n)}else{const r=me(e);for(const i of r.target)s.add(i),r===e.parent?.initial&&n.add(e.parent),J(i,t,n,s);for(const i of r.target)yt(i,e.parent,s,t,n)}else if(e.type==="compound"){const[r]=e.initial.target;q(r)||(s.add(r),n.add(r)),J(r,t,n,s),yt(r,e,s,t,n)}else if(e.type==="parallel")for(const r of B(e).filter(i=>!q(i)))[...s].some(i=>L(i,r))||(q(r)||(s.add(r),n.add(r)),J(r,t,n,s))}function Ee(e,t,n,s,r){for(const i of s)if((!r||L(i,r))&&e.add(i),i.type==="parallel")for(const u of B(i).filter(c=>!q(c)))[...e].some(c=>L(c,u))||(e.add(u),J(u,t,n,e))}function yt(e,t,n,s,r){Ee(n,s,r,Q(e,t))}function wn(e,t,n,s,r,i,u,c){let h=e;const d=Tt(s,r,i);d.sort((f,a)=>a.order-f.order);let v;for(const f of d)for(const a of vn(f)){let p;a.history==="deep"?p=y=>jt(y)&&L(y,f):p=y=>y.parent===f,v??={...i},v[a.id]=Array.from(r).filter(p)}for(const f of d)h=K(h,t,n,[...f.exit,...f.invoke.map(a=>ct(a.id))],u,void 0),r.delete(f);return[h,v||i]}function Tn(e,t){return e.implementations.actions[t]}function be(e,t,n,s,r,i){const{machine:u}=e;let c=e;for(const h of s){const d=typeof h=="function",v=d?h:Tn(u,typeof h=="string"?h:h.type),f={context:c.context,event:t,self:n.self,system:n.system},a=d||typeof h=="string"?void 0:"params"in h?typeof h.params=="function"?h.params({context:c.context,event:t}):h.params:void 0;if(!v||!("resolve"in v)){n.actionExecutor({type:typeof h=="string"?h:typeof h=="object"?h.type:h.name||"(anonymous)",info:f,params:a,exec:v});continue}const p=v,[y,m,E]=p.resolve(n,c,f,a,v,r);c=y,"retryResolve"in p&&i?.push([p,m]),"execute"in p&&n.actionExecutor({type:p.type,info:f,params:m,exec:p.execute.bind(null,n,m)}),E&&(c=be(c,t,n,E,r,i))}return c}function K(e,t,n,s,r,i){const u=i?[]:void 0,c=be(e,t,n,s,{internalQueue:r,deferredActorIds:i},u);return u?.forEach(([h,d])=>{h.retryResolve(n,c,d)}),c}function vt(e,t,n,s){let r=e;const i=[];function u(d,v,f){n.system._sendInspectionEvent({type:"@xstate.microstep",actorRef:n.self,event:v,snapshot:d,_transitions:f}),i.push(d)}if(t.type===et)return r=z(Vt(r,t,n),{status:"stopped"}),u(r,t,[]),{snapshot:r,microstates:i};let c=t;if(c.type!==oe){const d=c,v=Xe(d),f=Qt(d,r);if(v&&!f.length)return r=z(e,{status:"error",error:d.error}),u(r,d,[]),{snapshot:r,microstates:i};r=xt(f,e,n,c,!1,s),u(r,d,f)}let h=!0;for(;r.status==="active";){let d=h?xn(r,c):[];const v=d.length?r:void 0;if(!d.length){if(!s.length)break;c=s.shift(),d=Qt(c,r)}r=xt(d,r,n,c,!1,s),h=r!==v,u(r,c,d)}return r.status!=="active"&&Vt(r,c,n),{snapshot:r,microstates:i}}function Vt(e,t,n){return K(e,t,n,Object.values(e.children).map(s=>ct(s)),[],void 0)}function Qt(e,t){return t.machine.getTransitionData(t,e)}function xn(e,t){const n=new Set,s=e._nodes.filter(jt);for(const r of s)t:for(const i of[r].concat(Q(r,void 0)))if(i.always){for(const u of i.always)if(u.guard===void 0||ut(u.guard,e.context,t,e)){n.add(u);break t}}return _e(Array.from(n),new Set(e._nodes),e.historyValue)}function An(e,t){const n=st(it(e,t));return ve(e,[...n])}function In(e){return!!e&&typeof e=="object"&&"machine"in e&&"value"in e}const Rn=function(t){return ae(t,this.value)},kn=function(t){return this.tags.has(t)},$n=function(t){const n=this.machine.getTransitionData(this,t);return!!n?.length&&n.some(s=>s.target!==void 0||s.actions.length)},Cn=function(){const{_nodes:t,tags:n,machine:s,getMeta:r,toJSON:i,can:u,hasTag:c,matches:h,...d}=this;return{...d,tags:Array.from(n)}},On=function(){return this._nodes.reduce((t,n)=>(n.meta!==void 0&&(t[n.id]=n.meta),t),{})};function tt(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:ve(t.root,e._nodes),tags:new Set(e._nodes.flatMap(n=>n.tags)),children:e.children,historyValue:e.historyValue||{},matches:Rn,hasTag:kn,can:$n,getMeta:On,toJSON:Cn}}function z(e,t={}){return tt({...e,...t},e.machine)}function jn(e){if(typeof e!="object"||e===null)return{};const t={};for(const n in e){const s=e[n];Array.isArray(s)&&(t[n]=s.map(r=>({id:r.id})))}return t}function Mn(e,t){const{_nodes:n,tags:s,machine:r,children:i,context:u,can:c,hasTag:h,matches:d,getMeta:v,toJSON:f,...a}=e,p={};for(const m in i){const E=i[m];p[m]={snapshot:E.getPersistedSnapshot(t),src:E.src,systemId:E.systemId,syncSnapshot:E._syncSnapshot}}return{...a,context:we(u),children:p,historyValue:jn(a.historyValue)}}function we(e){let t;for(const n in e){const s=e[n];if(s&&typeof s=="object")if("sessionId"in s&&"send"in s&&"ref"in s)t??=Array.isArray(e)?e.slice():{...e},t[n]={xstate$$type:$t,id:s.id};else{const r=we(s);r!==s&&(t??=Array.isArray(e)?e.slice():{...e},t[n]=r)}}return t??e}function Dn(e,t,n,s,{event:r,id:i,delay:u},{internalQueue:c}){const h=t.machine.implementations.delays;if(typeof r=="string")throw new Error(`Only event objects may be used with raise; use raise({ type: "${r}" }) instead`);const d=typeof r=="function"?r(n,s):r;let v;if(typeof u=="string"){const f=h&&h[u];v=typeof f=="function"?f(n,s):f}else v=typeof u=="function"?u(n,s):u;return typeof v!="number"&&c.push(d),[t,{event:d,id:i,delay:v},void 0]}function Pn(e,t){const{event:n,delay:s,id:r}=t;if(typeof s=="number"){e.defer(()=>{const i=e.self;e.system.scheduler.schedule(i,i,n,s,r)});return}}function Lt(e,t){function n(s,r){}return n.type="xstate.raise",n.event=e,n.id=t?.id,n.delay=t?.delay,n.resolve=Dn,n.execute=Pn,n}const mt=new WeakMap;function fs(e){return{config:e,start:(n,s)=>{const{self:r,system:i,emit:u}=s,c={receivers:void 0,dispose:void 0};mt.set(r,c),c.dispose=e({input:n.input,system:i,self:r,sendBack:h=>{r.getSnapshot().status!=="stopped"&&r._parent&&i._relay(r,r._parent,h)},receive:h=>{c.receivers??=new Set,c.receivers.add(h)},emit:u})},transition:(n,s,r)=>{const i=mt.get(r.self);return s.type===et?(n={...n,status:"stopped",error:void 0},mt.delete(r.self),i.receivers?.clear(),i.dispose?.(),n):(i.receivers?.forEach(u=>u(s)),n)},getInitialSnapshot:(n,s)=>({status:"active",output:void 0,error:void 0,input:s}),getPersistedSnapshot:n=>n,restoreSnapshot:n=>n}}function Ln(e,{machine:t,context:n},s,r){const i=(u,c)=>{if(typeof u=="string"){const h=kt(t,u);if(!h)throw new Error(`Actor logic '${u}' not implemented in machine '${t.id}'`);const d=G(h,{id:c?.id,parent:e.self,syncSnapshot:c?.syncSnapshot,input:typeof c?.input=="function"?c.input({context:n,event:s,self:e.self}):c?.input,src:u,systemId:c?.systemId});return r[d.id]=d,d}else return G(u,{id:c?.id,parent:e.self,syncSnapshot:c?.syncSnapshot,input:c?.input,src:u,systemId:c?.systemId})};return(u,c)=>{const h=i(u,c);return r[h.id]=h,e.defer(()=>{h._processingStatus!==R.Stopped&&h.start()}),h}}function Hn(e,t,n,s,{assignment:r}){if(!t.context)throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");const i={},u={context:t.context,event:n.event,spawn:Ln(e,t,n.event,i),self:e.self,system:e.system};let c={};if(typeof r=="function")c=r(u,s);else for(const d of Object.keys(r)){const v=r[d];c[d]=typeof v=="function"?v(u,s):v}const h=Object.assign({},t.context,c);return[z(t,{context:h,children:Object.keys(i).length?{...t.children,...i}:t.children}),void 0,void 0]}function Ht(e){function t(n,s){}return t.type="xstate.assign",t.assignment=e,t.resolve=Hn,t}const Ft=new WeakMap;function Y(e,t,n){let s=Ft.get(e);return s?t in s||(s[t]=n()):(s={[t]:n()},Ft.set(e,s)),s[t]}const qn={},V=e=>typeof e=="string"?{type:e}:typeof e=="function"?"resolve"in e?{type:e.type}:{type:e.name}:e;class ot{constructor(t,n){if(this.config=t,this.key=void 0,this.id=void 0,this.type=void 0,this.path=void 0,this.states=void 0,this.history=void 0,this.entry=void 0,this.exit=void 0,this.parent=void 0,this.machine=void 0,this.meta=void 0,this.output=void 0,this.order=-1,this.description=void 0,this.tags=[],this.transitions=void 0,this.always=void 0,this.parent=n._parent,this.key=n._key,this.machine=n._machine,this.path=this.parent?this.parent.path.concat(this.key):[],this.id=this.config.id||[this.machine.id,...this.path].join(re),this.type=this.config.type||(this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.description=this.config.description,this.order=this.machine.idMap.size,this.machine.idMap.set(this.id,this),this.states=this.config.states?Nt(this.config.states,(s,r)=>new ot(s,{_parent:this,_key:r,_machine:this.machine})):qn,this.type==="compound"&&!this.config.initial)throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);this.history=this.config.history===!0?"shallow":this.config.history||!1,this.entry=P(this.config.entry).slice(),this.exit=P(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type==="final"||!this.parent?this.config.output:void 0,this.tags=P(t.tags).slice()}_initialize(){this.transitions=fn(this),this.config.always&&(this.always=W(this.config.always).map(t=>H(this,ie,t))),Object.keys(this.states).forEach(t=>{this.states[t]._initialize()})}get definition(){return{id:this.id,key:this.key,version:this.machine.version,type:this.type,initial:this.initial?{target:this.initial.target,source:this,actions:this.initial.actions.map(V),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(t=>`#${t.id}`),source:`#${this.id}`,actions:this.initial.actions.map(V),eventType:null})}:void 0,history:this.history,states:Nt(this.states,t=>t.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(t=>({...t,actions:t.actions.map(V)})),entry:this.entry.map(V),exit:this.exit.map(V),meta:this.meta,order:this.order||-1,output:this.output,invoke:this.invoke,description:this.description,tags:this.tags}}toJSON(){return this.definition}get invoke(){return Y(this,"invoke",()=>P(this.config.invoke).map((t,n)=>{const{src:s,systemId:r}=t,i=t.id??Kt(this.id,n),u=typeof s=="string"?s:`xstate.invoke.${Kt(this.id,n)}`;return{...t,src:u,id:i,systemId:r,toJSON(){const{onDone:c,onError:h,...d}=t;return{...d,type:"xstate.invoke",src:u,id:i}}}}))}get on(){return Y(this,"on",()=>[...this.transitions].flatMap(([n,s])=>s.map(r=>[n,r])).reduce((n,[s,r])=>(n[s]=n[s]||[],n[s].push(r),n),{}))}get after(){return Y(this,"delayedTransitions",()=>an(this))}get initial(){return Y(this,"initial",()=>hn(this,this.config.initial))}next(t,n){const s=n.type,r=[];let i;const u=Y(this,`candidates-${s}`,()=>un(this,s));for(const c of u){const{guard:h}=c,d=t.context;let v=!1;try{v=!h||ut(h,d,n,t)}catch(f){const a=typeof h=="string"?h:typeof h=="object"?h.type:void 0;throw new Error(`Unable to evaluate guard ${a?`'${a}' `:""}in transition for event '${s}' in state node '${this.id}':
|
|
3
|
+
${f.message}`)}if(v){r.push(...c.actions),i=c;break}}return i?[i]:void 0}get events(){return Y(this,"events",()=>{const{states:t}=this,n=new Set(this.ownEvents);if(t)for(const s of Object.keys(t)){const r=t[s];if(r.states)for(const i of r.events)n.add(`${i}`)}return Array.from(n)})}get ownEvents(){const t=Object.keys(Object.fromEntries(this.transitions)),n=new Set(t.filter(s=>this.transitions.get(s).some(r=>!(!r.target&&!r.actions.length&&!r.reenter))));return Array.from(n)}}const zn="#";class qt{constructor(t,n){this.config=t,this.version=void 0,this.schemas=void 0,this.implementations=void 0,this.__xstatenode=!0,this.idMap=new Map,this.root=void 0,this.id=void 0,this.states=void 0,this.events=void 0,this.id=t.id||"(machine)",this.implementations={actors:n?.actors??{},actions:n?.actions??{},delays:n?.delays??{},guards:n?.guards??{}},this.version=this.config.version,this.schemas=this.config.schemas,this.transition=this.transition.bind(this),this.getInitialSnapshot=this.getInitialSnapshot.bind(this),this.getPersistedSnapshot=this.getPersistedSnapshot.bind(this),this.restoreSnapshot=this.restoreSnapshot.bind(this),this.start=this.start.bind(this),this.root=new ot(t,{_key:this.id,_machine:this}),this.root._initialize(),this.states=this.root.states,this.events=this.root.events}provide(t){const{actions:n,guards:s,actors:r,delays:i}=this.implementations;return new qt(this.config,{actions:{...n,...t.actions},guards:{...s,...t.guards},actors:{...r,...t.actors},delays:{...i,...t.delays}})}resolveState(t){const n=An(this.root,t.value),s=st(it(this.root,n));return tt({_nodes:[...s],context:t.context||{},children:{},status:Mt(s,this.root)?"done":t.status||"active",output:t.output,error:t.error,historyValue:t.historyValue},this)}transition(t,n,s){return vt(t,n,s,[]).snapshot}microstep(t,n,s){return vt(t,n,s,[]).microstates}getTransitionData(t,n){return Dt(this.root,t.value,t,n)||[]}getPreInitialState(t,n,s){const{context:r}=this.config,i=tt({context:typeof r!="function"&&r?r:{},_nodes:[this.root],children:{},status:"active"},this);return typeof r=="function"?K(i,n,t,[Ht(({spawn:c,event:h,self:d})=>r({spawn:c,input:h.input,self:d}))],s,void 0):i}getInitialSnapshot(t,n){const s=ue(n),r=[],i=this.getPreInitialState(t,s,r),u=xt([{target:[...ge(this.root)],source:this.root,reenter:!0,actions:[],eventType:null,toJSON:null}],i,t,s,!0,r),{snapshot:c}=vt(u,s,t,r);return c}start(t){Object.values(t.children).forEach(n=>{n.getSnapshot().status==="active"&&n.start()})}getStateNodeById(t){const n=Rt(t),s=n.slice(1),r=at(n[0])?n[0].slice(zn.length):n[0],i=this.idMap.get(r);if(!i)throw new Error(`Child state node '#${r}' does not exist on machine '${this.id}'`);return rt(i,s)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(t,n){return Mn(t,n)}restoreSnapshot(t,n){const s={},r=t.children;Object.keys(r).forEach(f=>{const a=r[f],p=a.snapshot,y=a.src,m=typeof y=="string"?kt(this,y):y;if(!m)return;const E=G(m,{id:f,parent:n.self,syncSnapshot:a.syncSnapshot,snapshot:p,src:y,systemId:a.systemId});s[f]=E});function i(f,a){if(a instanceof ot)return a;try{return f.machine.getStateNodeById(a.id)}catch{}}function u(f,a){if(!a||typeof a!="object")return{};const p={};for(const y in a){const m=a[y];for(const E of m){const A=i(f,E);A&&(p[y]??=[],p[y].push(A))}}return p}const c=u(this.root,t.historyValue),h=tt({...t,children:s,_nodes:Array.from(st(it(this.root,t.value))),historyValue:c},this),d=new Set;function v(f,a){if(!d.has(f)){d.add(f);for(const p in f){const y=f[p];if(y&&typeof y=="object"){if("xstate$$type"in y&&y.xstate$$type===$t){f[p]=a[y.id];continue}v(y,a)}}}}return v(h.context,s),h}}function Un(e,t,n,s,{event:r}){const i=typeof r=="function"?r(n,s):r;return[t,{event:i},void 0]}function Yn(e,{event:t}){e.defer(()=>e.emit(t))}function Te(e){function t(n,s){}return t.type="xstate.emit",t.event=e,t.resolve=Un,t.execute=Yn,t}let At=(function(e){return e.Parent="#_parent",e.Internal="#_internal",e})({});function Wn(e,t,n,s,{to:r,event:i,id:u,delay:c},h){const d=t.machine.implementations.delays;if(typeof i=="string")throw new Error(`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`);const v=typeof i=="function"?i(n,s):i;let f;if(typeof c=="string"){const y=d&&d[c];f=typeof y=="function"?y(n,s):y}else f=typeof c=="function"?c(n,s):c;const a=typeof r=="function"?r(n,s):r;let p;if(typeof a=="string"){if(a===At.Parent?p=e.self._parent:a===At.Internal?p=e.self:a.startsWith("#_")?p=t.children[a.slice(2)]:p=h.deferredActorIds?.includes(a)?a:t.children[a],!p)throw new Error(`Unable to send event to actor '${a}' from machine '${t.machine.id}'.`)}else p=a||e.self;return[t,{to:p,targetId:typeof a=="string"?a:void 0,event:v,id:u,delay:f},void 0]}function Jn(e,t,n){typeof n.to=="string"&&(n.to=t.children[n.to])}function Gn(e,t){e.defer(()=>{const{to:n,event:s,delay:r,id:i}=t;if(typeof r=="number"){e.system.scheduler.schedule(e.self,n,s,r,i);return}e.system._relay(e.self,n,s.type===Je?ce(e.self.id,s.data):s)})}function zt(e,t,n){function s(r,i){}return s.type="xstate.sendTo",s.to=e,s.event=t,s.id=n?.id,s.delay=n?.delay,s.resolve=Wn,s.retryResolve=Jn,s.execute=Gn,s}function Bn(e,t){return zt(At.Parent,e,t)}function Nn(e,t,n,s,{collect:r}){const i=[],u=function(h){i.push(h)};return u.assign=(...c)=>{i.push(Ht(...c))},u.cancel=(...c)=>{i.push(Ct(...c))},u.raise=(...c)=>{i.push(Lt(...c))},u.sendTo=(...c)=>{i.push(zt(...c))},u.sendParent=(...c)=>{i.push(Bn(...c))},u.spawnChild=(...c)=>{i.push(Ot(...c))},u.stopChild=(...c)=>{i.push(ct(...c))},u.emit=(...c)=>{i.push(Te(...c))},r({context:n.context,event:n.event,enqueue:u,check:c=>ut(c,t.context,n.event,t),self:e.self,system:e.system},s),[t,void 0,i]}function Kn(e){function t(n,s){}return t.type="xstate.enqueueActions",t.collect=e,t.resolve=Nn,t}function Xn(e,t,n,s,{value:r,label:i}){return[t,{value:typeof r=="function"?r(n,s):r,label:i},void 0]}function Zn({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function Vn(e=({context:n,event:s})=>({context:n,event:s}),t){function n(s,r){}return n.type="xstate.log",n.value=e,n.label=t,n.resolve=Xn,n.execute=Zn,n}function Qn(e,t){return new qt(e,t)}function Fn({schemas:e,actors:t,actions:n,guards:s,delays:r}){return{assign:Ht,sendTo:zt,raise:Lt,log:Vn,cancel:Ct,stopChild:ct,enqueueActions:Kn,emit:Te,spawnChild:Ot,createStateConfig:i=>i,createAction:i=>i,createMachine:i=>Qn({...i,schemas:e},{actors:t,actions:n,guards:s,delays:r}),extend:i=>Fn({schemas:e,actors:t,actions:{...n,...i.actions},guards:{...s,...i.guards},delays:{...r,...i.delays}})}}var gt={exports:{}},_t={},St={exports:{}},Et={};var te;function ts(){if(te)return Et;te=1;var e=It();function t(f,a){return f===a&&(f!==0||1/f===1/a)||f!==f&&a!==a}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,i=e.useLayoutEffect,u=e.useDebugValue;function c(f,a){var p=a(),y=s({inst:{value:p,getSnapshot:a}}),m=y[0].inst,E=y[1];return i(function(){m.value=p,m.getSnapshot=a,h(m)&&E({inst:m})},[f,p,a]),r(function(){return h(m)&&E({inst:m}),f(function(){h(m)&&E({inst:m})})},[f]),u(p),p}function h(f){var a=f.getSnapshot;f=f.value;try{var p=a();return!n(f,p)}catch{return!0}}function d(f,a){return a()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return Et.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,Et}var ee;function xe(){return ee||(ee=1,St.exports=ts()),St.exports}var ne;function es(){if(ne)return _t;ne=1;var e=It(),t=xe();function n(d,v){return d===v&&(d!==0||1/d===1/v)||d!==d&&v!==v}var s=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,u=e.useEffect,c=e.useMemo,h=e.useDebugValue;return _t.useSyncExternalStoreWithSelector=function(d,v,f,a,p){var y=i(null);if(y.current===null){var m={hasValue:!1,value:null};y.current=m}else m=y.current;y=c(function(){function A(k){if(!$){if($=!0,O=k,k=a(k),p!==void 0&&m.hasValue){var b=m.value;if(p(b,k))return D=b}return D=k}if(b=D,s(O,k))return b;var Z=a(k);return p!==void 0&&p(b,Z)?(O=k,b):(O=k,D=Z)}var $=!1,O,D,X=f===void 0?null:f;return[function(){return A(v())},X===null?void 0:function(){return A(X())}]},[v,f,a,p]);var E=r(d,y[0],y[1]);return u(function(){m.hasValue=!0,m.value=E},[E]),h(E),E},_t}var se;function ns(){return se||(se=1,gt.exports=es()),gt.exports}var ss=ns();xe();const Ae=(e,t)=>{t(e);const n=e.getSnapshot().children;n&&Object.values(n).forEach(s=>{Ae(s,t)})};function rs(e){const t=[];Ae(e,s=>{t.push([s,s.getSnapshot()]),s.observers=new Set});const n=e.system.getSnapshot?.();e.stop(),e.system._snapshot=n,t.forEach(([s,r])=>{s._processingStatus=0,s._snapshot=r})}function is(e,...[t]){let[[n,s],r]=C.useState(()=>{const i=G(e,t);return[e.config,i]});if(e.config!==n){const i=G(e,{...t,snapshot:s.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});r([e.config,i]),s=i}return Le(()=>{s.logic.implementations=e.implementations}),s}function os(e,...[t,n]){const s=is(e,t);return C.useEffect(()=>{if(!n)return;const r=s.subscribe(nt(n));return()=>{r.unsubscribe()}},[n]),C.useEffect(()=>(s.start(),()=>{rs(s)}),[s]),s}function cs(e,t){return e===t}function us(e,t,n=cs){const s=C.useCallback(u=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(u);return c},[e]),r=C.useCallback(()=>e?.getSnapshot(),[e]);return ss.useSyncExternalStoreWithSelector(s,r,r,t,n)}function hs(e,t){const n=C.createContext(null),s=n.Provider;function r({children:c,logic:h=e,machine:d,options:v}){if(d)throw new Error('The "machine" prop has been deprecated. Please use "logic" instead.');const f=os(h,{...t,...v});return C.createElement(s,{value:f,children:c})}r.displayName="ActorProvider";function i(){const c=C.useContext(n);if(!c)throw new Error(`You used a hook from "${r.displayName}" but it's not inside a <${r.displayName}> component.`);return c}function u(c,h){const d=i();return us(d,c,h)}return{Provider:r,useActorRef:i,useSelector:u}}export{Pe as R,It as a,as as b,zt as c,Ht as d,hs as e,fs as f,Me as g,C as r,Fn as s};
|
package/dist/client/index.html
CHANGED
|
@@ -5,8 +5,12 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>SAGA Dashboard</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-C7C0BG0A.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-xstate-Dogcz2PC.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-radix-Cn9lyvpX.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-react-Ca05HUaC.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-markdown-DYPIbB23.js">
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-gxuuoUZf.css">
|
|
10
14
|
</head>
|
|
11
15
|
<body>
|
|
12
16
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saga-ai/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "CLI for SAGA - Structured Autonomous Goal Achievement",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"homepage": "https://github.com/Roeia1/saga#readme",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"chokidar": "^5.0.0",
|
|
27
|
-
"commander": "^
|
|
27
|
+
"commander": "^14.0.2",
|
|
28
28
|
"express": "^5.2.1",
|
|
29
29
|
"fuse.js": "^7.1.0",
|
|
30
30
|
"gray-matter": "^4.0.3",
|
|
@@ -43,40 +43,43 @@
|
|
|
43
43
|
"@storybook/addon-onboarding": "^10.2.1",
|
|
44
44
|
"@storybook/addon-vitest": "^10.2.1",
|
|
45
45
|
"@storybook/react-vite": "^10.2.1",
|
|
46
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
46
47
|
"@tailwindcss/typography": "^0.5.19",
|
|
48
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
49
|
+
"@tanstack/react-virtual": "^3.13.18",
|
|
47
50
|
"@testing-library/jest-dom": "^6.9.1",
|
|
48
51
|
"@testing-library/react": "^16.3.2",
|
|
49
52
|
"@types/express": "^5.0.6",
|
|
50
|
-
"@types/node": "^
|
|
51
|
-
"@types/react": "^
|
|
52
|
-
"@types/react-dom": "^
|
|
53
|
+
"@types/node": "^25.1.0",
|
|
54
|
+
"@types/react": "^19.2.10",
|
|
55
|
+
"@types/react-dom": "^19.2.3",
|
|
53
56
|
"@types/supertest": "^6.0.3",
|
|
54
57
|
"@types/ws": "^8.18.1",
|
|
55
|
-
"@vitejs/plugin-react": "^
|
|
56
|
-
"@vitest/browser": "^
|
|
58
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
59
|
+
"@vitest/browser": "^4.0.18",
|
|
60
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
57
61
|
"@xstate/react": "^6.0.0",
|
|
58
|
-
"autoprefixer": "^10.4.23",
|
|
59
62
|
"class-variance-authority": "^0.7.1",
|
|
60
63
|
"clsx": "^2.1.1",
|
|
61
64
|
"concurrently": "^9.2.1",
|
|
62
|
-
"esbuild": "^0.
|
|
65
|
+
"esbuild": "^0.27.2",
|
|
63
66
|
"jsdom": "^27.4.0",
|
|
64
67
|
"lucide-react": "^0.563.0",
|
|
65
68
|
"playwright": "^1.58.0",
|
|
66
69
|
"postcss": "^8.5.6",
|
|
67
|
-
"react": "^
|
|
68
|
-
"react-dom": "^
|
|
70
|
+
"react": "^19.2.4",
|
|
71
|
+
"react-dom": "^19.2.4",
|
|
69
72
|
"react-markdown": "^10.1.0",
|
|
70
|
-
"react-router
|
|
73
|
+
"react-router": "^7.13.0",
|
|
71
74
|
"remark-gfm": "^4.0.1",
|
|
72
75
|
"storybook": "^10.2.1",
|
|
73
76
|
"supertest": "^7.2.2",
|
|
74
77
|
"tailwind-merge": "^3.4.0",
|
|
75
|
-
"tailwindcss": "^
|
|
76
|
-
"
|
|
78
|
+
"tailwindcss": "^4.1.18",
|
|
79
|
+
"tw-animate-css": "^1.4.0",
|
|
77
80
|
"typescript": "^5.7.0",
|
|
78
|
-
"vite": "^
|
|
79
|
-
"vitest": "^
|
|
81
|
+
"vite": "^7.3.1",
|
|
82
|
+
"vitest": "^4.0.18",
|
|
80
83
|
"xstate": "^5.26.0"
|
|
81
84
|
},
|
|
82
85
|
"engines": {
|
|
@@ -87,12 +90,10 @@
|
|
|
87
90
|
"README.md"
|
|
88
91
|
],
|
|
89
92
|
"scripts": {
|
|
90
|
-
"build": "esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.cjs --format=cjs --banner:js='#!/usr/bin/env node' --external:express --external:ws --external:chokidar --external:gray-matter --external:fuse.js --external:commander",
|
|
93
|
+
"build:cli": "esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.cjs --format=cjs --banner:js='#!/usr/bin/env node' --external:express --external:ws --external:chokidar --external:gray-matter --external:fuse.js --external:commander",
|
|
91
94
|
"build:client": "vite build --config src/client/vite.config.ts",
|
|
92
|
-
"build
|
|
93
|
-
"
|
|
94
|
-
"dev:client": "vite --config src/client/vite.config.ts",
|
|
95
|
-
"test": "concurrently -g \"vitest run\" \"pnpm run test:integration\" \"pnpm run test:e2e\"",
|
|
95
|
+
"build": "pnpm lint && concurrently -g \"pnpm build:cli\" \"pnpm build:client\"",
|
|
96
|
+
"test": "pnpm build && vitest run && pnpm run test:integration && pnpm run test:e2e",
|
|
96
97
|
"test:watch": "vitest",
|
|
97
98
|
"test:integration": "playwright test --config src/client/playwright.config.ts",
|
|
98
99
|
"test:integration:ui": "playwright test --config src/client/playwright.config.ts --ui",
|
|
@@ -101,8 +102,11 @@
|
|
|
101
102
|
"test-storybook": "vitest --project=storybook",
|
|
102
103
|
"test:storybook": "vitest run --project=storybook",
|
|
103
104
|
"test:storybook:update": "vitest run --project=storybook --update",
|
|
104
|
-
"publish:npm": "pnpm build
|
|
105
|
+
"publish:npm": "pnpm build && pnpm test && pnpm publish --access public",
|
|
105
106
|
"storybook": "storybook dev -p 6006 -c src/client/.storybook",
|
|
106
|
-
"build-storybook": "storybook build -c src/client/.storybook -o storybook-static"
|
|
107
|
+
"build-storybook": "storybook build -c src/client/.storybook -o storybook-static",
|
|
108
|
+
"lint": "biome check .",
|
|
109
|
+
"lint:fix": "biome check --write .",
|
|
110
|
+
"format": "biome format --write ."
|
|
107
111
|
}
|
|
108
112
|
}
|