likec4 1.55.1 → 1.56.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/__app__/chunks/ColorSchemeToggle.mjs +1 -0
- package/__app__/chunks/DiagramActorProvider.mjs +10 -0
- package/__app__/chunks/Fallback.mjs +1 -0
- package/__app__/chunks/Header.mjs +13 -0
- package/__app__/chunks/IconRenderer.mjs +1 -0
- package/__app__/chunks/LikeC4Diagram.mjs +19 -0
- package/__app__/chunks/LikeC4ModelContext.mjs +1 -0
- package/__app__/chunks/LikeC4ModelContext2.mjs +1 -0
- package/__app__/chunks/LikeC4Styles.mjs +48 -0
- package/__app__/chunks/NavigationPanel.mjs +1 -0
- package/__app__/chunks/StaticLikeC4Diagram.mjs +1 -0
- package/__app__/chunks/ViewReact.mjs +1 -0
- package/__app__/chunks/__root.mjs +1 -0
- package/__app__/chunks/adhoc-editor.mjs +1 -0
- package/__app__/chunks/hooks.mjs +1 -0
- package/__app__/chunks/libs/@dagrejs/dagre.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/core.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/dom.mjs +1 -0
- package/__app__/chunks/libs/@floating-ui/react.mjs +1 -0
- package/__app__/chunks/libs/@mantine/core.mjs +41 -0
- package/__app__/chunks/libs/@mantine/hooks.mjs +1 -0
- package/__app__/chunks/libs/@nanostores/react.mjs +1 -0
- package/__app__/chunks/libs/@react-hookz/web.mjs +1 -0
- package/__app__/chunks/libs/@tabler/icons-react.mjs +15 -0
- package/__app__/chunks/libs/@tanstack/history.mjs +1 -0
- package/__app__/chunks/libs/@tanstack/react-router.mjs +3 -0
- package/__app__/chunks/libs/@tanstack/router-core.mjs +1 -0
- package/__app__/chunks/libs/@xstate/react.mjs +1 -0
- package/__app__/chunks/libs/@xstate/store.mjs +1 -0
- package/__app__/chunks/libs/@xyflow/react.mjs +7 -0
- package/__app__/chunks/libs/@zag-js/anatomy.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/collection.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/core.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/react.mjs +1 -0
- package/__app__/chunks/libs/@zag-js/tree-view.mjs +1 -0
- package/__app__/chunks/libs/bezier-js.mjs +1 -0
- package/__app__/chunks/libs/d3-path.mjs +1 -0
- package/__app__/chunks/libs/d3-shape.mjs +1 -0
- package/__app__/chunks/libs/fast-equals.mjs +1 -0
- package/__app__/chunks/libs/framer-motion.mjs +9 -0
- package/__app__/chunks/libs/html-to-image.mjs +2 -0
- package/__app__/chunks/libs/motion-dom.mjs +1 -0
- package/__app__/chunks/libs/motion.mjs +1 -0
- package/__app__/chunks/libs/nanostores.mjs +1 -0
- package/__app__/chunks/libs/react-error-boundary.mjs +1 -0
- package/__app__/chunks/libs/react-resizable-panels.mjs +1 -0
- package/__app__/chunks/libs/remeda.mjs +1 -0
- package/__app__/chunks/libs/xstate.mjs +1 -0
- package/__app__/chunks/libs/zod.mjs +39 -0
- package/__app__/chunks/rolldown-runtime.mjs +1 -0
- package/__app__/chunks/safeCtx.mjs +1 -0
- package/__app__/chunks/searchParams.mjs +1 -0
- package/__app__/chunks/single-index.mjs +1 -0
- package/__app__/chunks/styled-system.mjs +1 -0
- package/__app__/chunks/styles.css.mjs +1 -0
- package/__app__/chunks/useLikeC4Project.mjs +1 -0
- package/__app__/chunks/useUpdateEffect.mjs +1 -0
- package/__app__/codegen/react.mjs +11 -0
- package/__app__/codegen/webcomponent.mjs +790 -0
- package/__app__/src/fonts.css +1 -1
- package/__app__/src/main.mjs +1 -0
- package/__app__/src/pages/AdHocViewEditor.mjs +1 -0
- package/__app__/src/pages/EmbedPage.mjs +1 -0
- package/__app__/src/pages/ExportPage.mjs +1 -0
- package/__app__/src/pages/ProjectsOverview.mjs +1 -0
- package/__app__/src/pages/ViewAsD2.mjs +1 -0
- package/__app__/src/pages/ViewAsDot.mjs +1 -0
- package/__app__/src/pages/ViewAsMmd.mjs +1 -0
- package/__app__/src/pages/ViewAsPuml.mjs +1 -0
- package/__app__/src/pages/ViewEditor.mjs +1 -0
- package/__app__/src/pages/ViewReact.mjs +1 -0
- package/__app__/src/routeTree.gen.mjs +1 -0
- package/__app__/src/routes/__root.mjs +1 -0
- package/__app__/src/routes/_single/adhoc.mjs +1 -0
- package/__app__/src/routes/_single/embed._viewId.mjs +1 -0
- package/__app__/src/routes/_single/export._viewId.mjs +1 -0
- package/__app__/src/routes/_single/route.mjs +1 -0
- package/__app__/src/routes/_single/single-index.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.d2.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.dot.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.index.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.mmd.mjs +1 -0
- package/__app__/src/routes/_single/view._viewId.puml.mjs +1 -0
- package/__app__/src/routes/_single/webcomponent._.mjs +33 -0
- package/__app__/src/routes/index.mjs +1 -0
- package/__app__/src/routes/project._projectId/-components.mjs +1 -0
- package/__app__/src/routes/project._projectId/adhoc.mjs +1 -0
- package/__app__/src/routes/project._projectId/embed._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/export._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/index.mjs +1 -0
- package/__app__/src/routes/project._projectId/route.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.d2.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.dot.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.index.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.mmd.mjs +1 -0
- package/__app__/src/routes/project._projectId/view._viewId.puml.mjs +1 -0
- package/__app__/src/routes/projects.mjs +1 -0
- package/__app__/src/style.css +1 -1
- package/dist/chunks/filenames.mjs +17 -0
- package/dist/{_chunks → chunks}/index.d.mts +2 -1
- package/dist/{_chunks → chunks}/index2.d.mts +70 -11
- package/dist/chunks/libs/@chevrotain/gast.mjs +1 -0
- package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +9 -0
- package/dist/chunks/libs/@chevrotain/utils.mjs +1 -0
- package/dist/chunks/libs/@hono/mcp.mjs +45 -0
- package/dist/chunks/libs/@hono/node-server.mjs +1 -0
- package/dist/{_chunks → chunks}/libs/@logtape/logtape.d.mts +2 -0
- package/dist/chunks/libs/@logtape/logtape.mjs +4 -0
- package/dist/chunks/libs/@lume/kiwi.mjs +1 -0
- package/dist/chunks/libs/@modelcontextprotocol/sdk.mjs +12 -0
- package/dist/chunks/libs/ajv.mjs +1 -0
- package/dist/chunks/libs/ansi-align.mjs +2 -0
- package/dist/chunks/libs/ansi-regex.mjs +1 -0
- package/dist/chunks/libs/ansi-styles.mjs +1 -0
- package/dist/chunks/libs/atomically.mjs +1 -0
- package/dist/chunks/libs/birpc.mjs +1 -0
- package/dist/chunks/libs/boxen.mjs +22 -0
- package/dist/chunks/libs/chevrotain-allstar.mjs +2 -0
- package/dist/chunks/libs/chevrotain.mjs +58 -0
- package/dist/chunks/libs/conf.mjs +1 -0
- package/dist/chunks/libs/defu.mjs +1 -0
- package/dist/chunks/libs/destr.mjs +1 -0
- package/dist/chunks/libs/eventemitter3.mjs +1 -0
- package/dist/chunks/libs/find-up-simple.mjs +1 -0
- package/dist/chunks/libs/get-port.mjs +1 -0
- package/dist/chunks/libs/hono.mjs +1 -0
- package/dist/chunks/libs/is-docker.mjs +1 -0
- package/dist/chunks/libs/is-error-instance.mjs +1 -0
- package/dist/chunks/libs/is-inside-container.mjs +1 -0
- package/dist/chunks/libs/is-plain-obj.mjs +1 -0
- package/dist/chunks/libs/isexe.mjs +1 -0
- package/dist/chunks/libs/json5.mjs +14 -0
- package/dist/chunks/libs/khroma.mjs +1 -0
- package/dist/chunks/libs/ky.mjs +3 -0
- package/dist/{_chunks → chunks}/libs/langium.d.mts +4 -4
- package/dist/chunks/libs/langium.mjs +32 -0
- package/dist/chunks/libs/merge-error-cause.mjs +2 -0
- package/dist/chunks/libs/p-debounce.mjs +1 -0
- package/dist/chunks/libs/p-limit.mjs +1 -0
- package/dist/chunks/libs/p-queue.mjs +1 -0
- package/dist/chunks/libs/p-timeout.mjs +1 -0
- package/dist/chunks/libs/package-manager-detector.mjs +1 -0
- package/dist/chunks/libs/package-up.mjs +1 -0
- package/dist/chunks/libs/pako.mjs +1 -0
- package/dist/chunks/libs/parse-ms.mjs +1 -0
- package/dist/chunks/libs/pathe.mjs +1 -0
- package/dist/chunks/libs/picomatch.mjs +1 -0
- package/dist/chunks/libs/pretty-ms.mjs +1 -0
- package/dist/chunks/libs/remeda.mjs +1 -0
- package/dist/chunks/libs/safe-stringify.mjs +1 -0
- package/dist/chunks/libs/strip-indent.mjs +1 -0
- package/dist/chunks/libs/tinyrainbow.mjs +1 -0
- package/dist/{_chunks → chunks}/libs/ts-graphviz.d.mts +2 -0
- package/dist/chunks/libs/ts-graphviz.mjs +4 -0
- package/dist/chunks/libs/ufo.mjs +1 -0
- package/dist/chunks/libs/unstorage.mjs +1 -0
- package/dist/chunks/libs/which.mjs +1 -0
- package/dist/chunks/libs/word-wrap.mjs +12 -0
- package/dist/{_chunks → chunks}/libs/zod.d.mts +2 -0
- package/dist/chunks/node.mjs +76 -0
- package/dist/chunks/plugin.mjs +400 -0
- package/dist/chunks/rolldown-runtime.mjs +1 -0
- package/dist/chunks/sequence-view.mjs +1 -0
- package/dist/cli/index.mjs +262 -136
- package/dist/config/index.d.mts +1 -2
- package/dist/config/index.mjs +1 -1
- package/dist/index.d.mts +4 -8
- package/dist/index.mjs +1 -1
- package/dist/model/index.d.mts +2 -1
- package/dist/model/index.mjs +1 -1
- package/dist/vite-plugin/index.d.mts +38 -8
- package/dist/vite-plugin/index.mjs +1 -1
- package/dist/{_chunks → vite-plugin/internal/chunks}/libs/@nanostores/react.d.mts +2 -56
- package/dist/vite-plugin/internal/chunks/libs/@nanostores/react.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/birpc.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/fast-equals.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/nanostores.d.mts +59 -0
- package/dist/vite-plugin/internal/chunks/libs/nanostores.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/libs/remeda.mjs +1 -0
- package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +1 -0
- package/dist/vite-plugin/{internal.d.mts → internal/index.d.mts} +12 -3
- package/dist/vite-plugin/internal/index.mjs +1 -0
- package/package.json +35 -55
- package/react/index.d.mts +2 -28
- package/react/index.mjs +50520 -53863
- package/vite-plugin/internal/package.json +2 -2
- package/vite-plugin-modules.d.ts +14 -0
- package/__app__/react/likec4.tsx +0 -25
- package/__app__/src/ProjectsOverview.js +0 -16
- package/__app__/src/const.js +0 -19
- package/__app__/src/likec4.js +0 -21254
- package/__app__/src/main.js +0 -7
- package/__app__/src/routes/index.js +0 -324
- package/__app__/src/routes/projects.js +0 -193
- package/__app__/src/routes/single.js +0 -1983
- package/__app__/src/vendors.js +0 -52683
- package/__app__/src/webcomponent.js +0 -68
- package/dist/THIRD-PARTY-LICENSES.md +0 -1609
- package/dist/_chunks/libs/@chevrotain/cst-dts-gen.mjs +0 -30
- package/dist/_chunks/libs/@chevrotain/regexp-to-ast.mjs +0 -9
- package/dist/_chunks/libs/@chevrotain/types.d.mts +0 -1
- package/dist/_chunks/libs/@chevrotain/utils.mjs +0 -1
- package/dist/_chunks/libs/@hono/mcp.mjs +0 -45
- package/dist/_chunks/libs/@hono/node-server.mjs +0 -1
- package/dist/_chunks/libs/@logtape/logtape.mjs +0 -4
- package/dist/_chunks/libs/@lume/kiwi.mjs +0 -1
- package/dist/_chunks/libs/@modelcontextprotocol/sdk.mjs +0 -12
- package/dist/_chunks/libs/@nanostores/react.mjs +0 -1
- package/dist/_chunks/libs/ajv.mjs +0 -1
- package/dist/_chunks/libs/ansi-align.mjs +0 -2
- package/dist/_chunks/libs/ansi-regex.mjs +0 -1
- package/dist/_chunks/libs/ansi-styles.mjs +0 -1
- package/dist/_chunks/libs/atomically.mjs +0 -1
- package/dist/_chunks/libs/birpc.mjs +0 -1
- package/dist/_chunks/libs/boxen.mjs +0 -22
- package/dist/_chunks/libs/chevrotain-allstar.mjs +0 -2
- package/dist/_chunks/libs/chevrotain.mjs +0 -58
- package/dist/_chunks/libs/conf.mjs +0 -1
- package/dist/_chunks/libs/defu.mjs +0 -1
- package/dist/_chunks/libs/destr.mjs +0 -1
- package/dist/_chunks/libs/esm-env.mjs +0 -1
- package/dist/_chunks/libs/eventemitter3.mjs +0 -1
- package/dist/_chunks/libs/fast-equals.mjs +0 -1
- package/dist/_chunks/libs/find-up-simple.mjs +0 -1
- package/dist/_chunks/libs/get-port.mjs +0 -1
- package/dist/_chunks/libs/is-docker.mjs +0 -1
- package/dist/_chunks/libs/is-error-instance.mjs +0 -1
- package/dist/_chunks/libs/is-inside-container.mjs +0 -1
- package/dist/_chunks/libs/is-plain-obj.mjs +0 -1
- package/dist/_chunks/libs/isexe.mjs +0 -1
- package/dist/_chunks/libs/json5.mjs +0 -14
- package/dist/_chunks/libs/khroma.mjs +0 -1
- package/dist/_chunks/libs/ky.mjs +0 -3
- package/dist/_chunks/libs/langium.mjs +0 -33
- package/dist/_chunks/libs/merge-error-cause.mjs +0 -2
- package/dist/_chunks/libs/p-limit.mjs +0 -1
- package/dist/_chunks/libs/p-queue.mjs +0 -1
- package/dist/_chunks/libs/p-timeout.mjs +0 -1
- package/dist/_chunks/libs/package-manager-detector.mjs +0 -1
- package/dist/_chunks/libs/package-up.mjs +0 -1
- package/dist/_chunks/libs/pako.mjs +0 -1
- package/dist/_chunks/libs/parse-ms.mjs +0 -1
- package/dist/_chunks/libs/pathe.mjs +0 -1
- package/dist/_chunks/libs/picomatch.mjs +0 -1
- package/dist/_chunks/libs/pretty-ms.mjs +0 -1
- package/dist/_chunks/libs/remeda.mjs +0 -2
- package/dist/_chunks/libs/safe-stringify.mjs +0 -1
- package/dist/_chunks/libs/strip-indent.mjs +0 -1
- package/dist/_chunks/libs/tinyrainbow.mjs +0 -1
- package/dist/_chunks/libs/ts-graphviz.mjs +0 -4
- package/dist/_chunks/libs/ufo.mjs +0 -1
- package/dist/_chunks/libs/unstorage.mjs +0 -1
- package/dist/_chunks/libs/which.mjs +0 -1
- package/dist/_chunks/libs/word-wrap.mjs +0 -12
- package/dist/_chunks/node.mjs +0 -76
- package/dist/_chunks/rolldown-runtime.mjs +0 -1
- package/dist/_chunks/sequence.mjs +0 -1
- package/dist/_chunks/src.mjs +0 -17
- package/dist/_chunks/src2.mjs +0 -499
- package/dist/vite-plugin/internal.mjs +0 -1
- /package/dist/{_chunks → chunks}/libs/vscode-languageserver.mjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";import{Bt as e,Lt as t,Wt as n}from"./core.mjs";import{useCallback as r,useEffect as i,useEffectEvent as a,useMemo as o,useRef as s,useState as c}from"react";function useDebouncedState(e,t,n={leading:!1}){let[a,o]=c(e),l=s(null),u=s(!0),clearTimeout=()=>window.clearTimeout(l.current);return i(()=>clearTimeout,[]),[a,r(e=>{clearTimeout(),u.current&&n.leading?o(e):l.current=window.setTimeout(()=>{u.current=!0,o(e)},t),u.current=!1},[n.leading,t])]}function useDebouncedValue(e,t,n={leading:!1}){let[a,o]=c(e),l=s(!1),u=s(null),d=s(!1),f=s(e);f.current=e;let p=r(()=>{window.clearTimeout(u.current),u.current=null,d.current=!1},[]),m=r(()=>{u.current&&(p(),d.current=!1,o(f.current))},[]);return i(()=>{l.current&&(!d.current&&n.leading?(d.current=!0,o(e)):(p(),u.current=window.setTimeout(()=>{d.current=!1,o(e)},t)))},[e,n.leading,t]),i(()=>(l.current=!0,p),[]),[a,p,{cancel:p,flush:m}]}function useDocumentTitle(t){e(()=>{typeof t==`string`&&t.trim().length>0&&(document.title=t.trim())},[t])}function serializeJSON(e,t=`use-local-storage`){try{return JSON.stringify(e)}catch{throw Error(`@mantine/hooks ${t}: Failed to serialize the value`)}}function deserializeJSON(e){try{return e&&JSON.parse(e)}catch{return e}}function createStorageHandler(e){let getItem=t=>{try{return window[e].getItem(t)}catch{return console.warn(`use-local-storage: Failed to get value from storage, localStorage is blocked`),null}},setItem=(t,n)=>{try{window[e].setItem(t,n)}catch{console.warn(`use-local-storage: Failed to set value to storage, localStorage is blocked`)}},removeItem=t=>{try{window[e].removeItem(t)}catch{console.warn(`use-local-storage: Failed to remove value from storage, localStorage is blocked`)}};return{getItem,setItem,removeItem}}function createStorage(e,n){let a=e===`localStorage`?`mantine-local-storage`:`mantine-session-storage`,{getItem:o,setItem:s,removeItem:l}=createStorageHandler(e);return function useStorage({key:u,defaultValue:d,getInitialValueInEffect:f=!0,sync:p=!0,deserialize:m=deserializeJSON,serialize:h=e=>serializeJSON(e,n)}){let g=r(t=>{let n;try{n=typeof window>`u`||!(e in window)||window[e]===null||!!t}catch{n=!0}if(n)return d;let r=o(u);return r===null?d:m(r)},[u,d]),[_,v]=c(g(f)),y=r(e=>{e instanceof Function?v(t=>{let n=e(t);return s(u,h(n)),queueMicrotask(()=>{window.dispatchEvent(new CustomEvent(a,{detail:{key:u,value:n}}))}),n}):(s(u,h(e)),window.dispatchEvent(new CustomEvent(a,{detail:{key:u,value:e}})),v(e))},[u]),b=r(()=>{l(u),v(d),window.dispatchEvent(new CustomEvent(a,{detail:{key:u,value:d}}))},[u,d]);return t(`storage`,t=>{p&&t.storageArea===window[e]&&t.key===u&&v(m(t.newValue??void 0))}),t(a,e=>{p&&e.detail.key===u&&v(e.detail.value)}),i(()=>{d!==void 0&&_===void 0&&y(d)},[d,_,y]),i(()=>{let e=g();e!==void 0&&y(e)},[u]),[_===void 0?d:_,y,b]}}function readValue(e){let{getItem:t}=createStorageHandler(e);return function read({key:n,defaultValue:r,deserialize:i=deserializeJSON}){let a;try{a=typeof window>`u`||!(e in window)||window[e]===null}catch{a=!0}if(a)return r;let o=t(n);return o===null?r:i(o)}}function useLocalStorage(e){return createStorage(`localStorage`,`use-local-storage`)(e)}readValue(`localStorage`);function useSessionStorage(e){return createStorage(`sessionStorage`,`use-session-storage`)(e)}readValue(`sessionStorage`);const l={passive:!0};function useViewportSize(){let[e,n]=c({width:0,height:0}),a=r(()=>{n({width:window.innerWidth||0,height:window.innerHeight||0})},[]);return t(`resize`,a,l),t(`orientationchange`,a,l),i(a,[]),e}const u={" ":`space`,ArrowLeft:`arrowleft`,ArrowRight:`arrowright`,ArrowUp:`arrowup`,ArrowDown:`arrowdown`,Escape:`escape`,Esc:`escape`,esc:`escape`,Enter:`enter`,Tab:`tab`,Backspace:`backspace`,Delete:`delete`,Insert:`insert`,Home:`home`,End:`end`,PageUp:`pageup`,PageDown:`pagedown`,"+":`plus`,"-":`minus`,"*":`asterisk`,"/":`slash`};function normalizeKey(e){let t=e.replace(`Key`,``).toLowerCase();return u[e]||t}function parseHotkey(e){let t=e.toLowerCase().split(`+`).map(e=>e.trim()),n={alt:t.includes(`alt`),ctrl:t.includes(`ctrl`),meta:t.includes(`meta`),mod:t.includes(`mod`),shift:t.includes(`shift`)},r=[`alt`,`ctrl`,`meta`,`shift`,`mod`],i=t.find(e=>!r.includes(e));return{...n,key:i===`[plus]`?`+`:i}}function isExactHotkey(e,t,n){let{alt:r,ctrl:i,meta:a,mod:o,shift:s,key:c}=e,{altKey:l,ctrlKey:u,metaKey:d,shiftKey:f,key:p,code:m}=t;if(r!==l)return!1;if(o){if(!u&&!d)return!1}else if(i!==u||a!==d)return!1;return s===f?!!(c&&(n?normalizeKey(m)===normalizeKey(c):normalizeKey(p??m)===normalizeKey(c))):!1}function getHotkeyMatcher(e,t){return n=>isExactHotkey(parseHotkey(e),n,t)}function getHotkeyHandler(e){return t=>{let n=`nativeEvent`in t?t.nativeEvent:t;e.forEach(([e,r,i={preventDefault:!0,usePhysicalKeys:!1}])=>{getHotkeyMatcher(e,i.usePhysicalKeys)(n)&&(i.preventDefault&&t.preventDefault(),r(n))})}}function shouldFireEvent(e,t,n=!1){return e.target instanceof HTMLElement?(n||!e.target.isContentEditable)&&!t.includes(e.target.tagName):!0}function useHotkeys(e,t=[`INPUT`,`TEXTAREA`,`SELECT`],n=!1){let r=a(r=>{e.forEach(([e,i,a={preventDefault:!0,usePhysicalKeys:!1}])=>{getHotkeyMatcher(e,a.usePhysicalKeys)(r)&&shouldFireEvent(r,t,n)&&(a.preventDefault&&r.preventDefault(),i(r))})});i(()=>(document.documentElement.addEventListener(`keydown`,r),()=>document.documentElement.removeEventListener(`keydown`,r)),[])}function useHover(){let[e,t]=c(!1),n=s(null),i=r(()=>{t(!0)},[]),a=r(()=>{t(!1)},[]);return{ref:r(e=>(n.current&&(n.current.removeEventListener(`mouseenter`,i),n.current.removeEventListener(`mouseleave`,a)),e&&(e.addEventListener(`mouseenter`,i),e.addEventListener(`mouseleave`,a)),n.current=e,()=>{n.current=null,t(!1)}),[i,a]),hovered:e}}function containsRelatedTarget(e){return e.currentTarget instanceof HTMLElement&&e.relatedTarget instanceof HTMLElement?e.currentTarget.contains(e.relatedTarget):!1}function useFocusWithin({onBlur:e,onFocus:t}={}){let[a,o]=c(!1),l=s(!1),u=s(null),d=n(t),f=n(e),p=r(e=>{o(e),l.current=e},[]),m=r(e=>{l.current||(p(!0),d(e))},[]),h=r(e=>{l.current&&!containsRelatedTarget(e)&&(p(!1),f(e))},[]),g=r(e=>{e&&(u.current&&(u.current.removeEventListener(`focusin`,m),u.current.removeEventListener(`focusout`,h)),e.addEventListener(`focusin`,m),e.addEventListener(`focusout`,h),u.current=e)},[m,h]);return i(()=>()=>{u.current&&(u.current.removeEventListener(`focusin`,m),u.current.removeEventListener(`focusout`,h))},[]),{ref:g,focused:a}}function useInViewport(){let e=s(null),[t,n]=c(!1);return{ref:r(t=>{typeof IntersectionObserver<`u`&&(e.current?.disconnect(),t?(e.current=new IntersectionObserver(e=>{let t=e[e.length-1];n(t.isIntersecting)}),e.current.observe(t)):(e.current=null,n(!1)))},[]),inViewport:t}}function useStateHistory(e){let[t,n]=c({history:[e],current:0}),i=r(e=>n(t=>{let n=[...t.history.slice(0,t.current+1),e];return{history:n,current:n.length-1}}),[]),a=r((e=1)=>n(t=>({history:t.history,current:Math.max(0,t.current-e)})),[]),s=r((e=1)=>n(t=>({history:t.history,current:Math.min(t.history.length-1,t.current+e)})),[]),l=r(()=>{n({history:[e],current:0})},[e]),u=o(()=>({back:a,forward:s,reset:l,set:i}),[a,s,l,i]);return[t.history[t.current],u,t]}function useThrottledCallbackWithClearTimeout(e,t){let a=n(e),o=s(null),c=s(null),l=s(!0),u=s(t),d=s(-1),clearTimeout=()=>window.clearTimeout(d.current),f=r((...e)=>{a(...e),o.current=e,c.current=e,l.current=!1},[a]),p=r(()=>{o.current&&o.current!==c.current?(f(...o.current),d.current=window.setTimeout(p,u.current)):l.current=!0},[f]),m=r((...e)=>{l.current?(f(...e),d.current=window.setTimeout(p,u.current)):o.current=e},[f,p]);return i(()=>{u.current=t},[t]),[m,clearTimeout]}function useThrottledCallback(e,t){let[n,r]=useThrottledCallbackWithClearTimeout(e,t);return i(()=>r,[]),n}export{useHover as a,useViewportSize as c,useDocumentTitle as d,useDebouncedValue as f,useFocusWithin as i,useSessionStorage as l,useStateHistory as n,useHotkeys as o,useDebouncedState as p,useInViewport as r,getHotkeyHandler as s,useThrottledCallback as t,useLocalStorage as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";import{useCallback as e,useRef as t,useSyncExternalStore as n}from"react";function listenKeys(e,t,n){let r=new Set(t).add(void 0);return e.listen((e,t,i)=>{r.has(i)&&n(e,t,i)})}let emit=(e,t)=>n=>{e.current!==n&&(e.current=n,t())};function useStore(r,{keys:i,deps:a=[r,i],ssr:o}={}){let s=t();s.current=r.get();let c=e(e=>(emit(s,e)(r.value),i?.length>0?listenKeys(r,i,emit(s,e)):r.listen(emit(s,e))),a),get=()=>s.current,l=get;return o&&`init`in r&&(l=o===`initial`?()=>r.init:o),n(c,get,l)}export{useStore as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";import{useCallback as e,useEffect as t,useLayoutEffect as n,useMemo as r,useRef as i,useState as a}from"react";function useSyncedRef(e){let t=i(e);return t.current=e,r(()=>Object.freeze({get current(){return t.current}}),[])}function useUnmountEffect(e){let n=useSyncedRef(e);t(()=>()=>{n.current()},[])}function useDebouncedCallback(e,n,a,o=0){let s=i(void 0),c=i(void 0),l=i(e),u=i(void 0),clear=()=>{s.current&&=(clearTimeout(s.current),void 0),c.current&&=(clearTimeout(c.current),void 0)};return useUnmountEffect(clear),t(()=>{l.current=e},n),r(()=>{let execute=()=>{if(clear(),!u.current)return;let e=u.current;u.current=void 0,l.current.apply(e.this,e.args)},wrapped=function(...e){s.current&&clearTimeout(s.current),u.current={args:e,this:this},s.current=setTimeout(execute,a),o>0&&!c.current&&(c.current=setTimeout(execute,o))};return Object.defineProperties(wrapped,{length:{value:e.length},name:{value:`${e.name||`anonymous`}__debounced__${a}`}}),wrapped},[a,o,...n])}const noop=()=>{},o=typeof globalThis<`u`&&typeof navigator<`u`&&typeof document<`u`;function useRafCallback(t){let n=useSyncedRef(t),a=i(0),s=e(()=>{o&&(a.current&&=(cancelAnimationFrame(a.current),0))},[]);return useUnmountEffect(s),[r(()=>{let wrapped=(...e)=>{o&&(s(),a.current=requestAnimationFrame(()=>{n.current(...e),a.current=0}))};return Object.defineProperties(wrapped,{length:{value:t.length},name:{value:`${t.name||`anonymous`}__raf`}}),wrapped},[]),s]}const basicDepsComparator=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(r!==t[n])return!1;return!0};function useCustomCompareEffect(e,n,r=basicDepsComparator,a=t,...s){let c=i(void 0);(c.current===void 0||o&&!r(c.current,n))&&(c.current=n),a(e,c.current,...s)}function useFirstMountState(){let e=i(!0);return t(()=>{e.current=!1},[]),e.current}function useIsMounted(n=!1){let r=i(n),a=e(()=>r.current,[]);return t(()=>(r.current=!0,()=>{r.current=!1}),[]),a}const s=o?n:t;function useMountEffect(e){t(()=>{e()},[])}function useRafEffect(e,n){let[r,i]=useRafCallback(e);t(()=>(r(),i),n)}const stateChanger=e=>(e+1)%(2**53-1);function useRerender(){let[,t]=a(0);return e(()=>{t(stateChanger)},[])}function useUpdateEffect(e,n){t(useFirstMountState()?noop:e,n)}const cancelTimeout=e=>{e&&clearTimeout(e)};function useTimeoutEffect(n,r){let a=useSyncedRef(n),o=useSyncedRef(r),s=i(null),c=e(()=>{cancelTimeout(s.current)},[]),l=e(()=>{o.current!==void 0&&(c(),s.current=setTimeout(()=>{a.current()},o.current))},[]);return t(()=>(l(),c),[r]),[c,l]}const useCustomCompareMemo=(e,t,n)=>{let a=i(void 0);return(a.current===void 0||!n(a.current,t))&&(a.current=t),r(e,a.current)};function useAsync(e,t){let[n,o]=a({status:`not-executed`,error:void 0,result:t}),s=i(void 0),c=i(void 0),l=useSyncedRef({async execute(...t){c.current=t;let n=e(...t);return s.current=n,o(e=>({...e,status:`loading`})),n.then(e=>{n===s.current&&o(t=>({...t,status:`success`,error:void 0,result:e}))},e=>{n===s.current&&o(t=>({...t,status:`error`,error:e}))}),n},reset(){o({status:`not-executed`,error:void 0,result:t}),s.current=void 0,c.current=void 0}});return[n,r(()=>({reset(){l.current.reset()},execute:async(...e)=>l.current.execute(...e)}),[]),{promise:s.current,lastArgs:c.current}]}export{useRerender as a,s as c,useCustomCompareEffect as d,useDebouncedCallback as f,useUpdateEffect as i,useIsMounted as l,useCustomCompareMemo as n,useRafEffect as o,useSyncedRef as p,useTimeoutEffect as r,useMountEffect as s,useAsync as t,useFirstMountState as u};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";import{createElement as e,forwardRef as t}from"react";
|
|
2
|
+
/**
|
|
3
|
+
* @license @tabler/icons-react v3.40.0 - MIT
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license.
|
|
6
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
var n={outline:{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},filled:{xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`currentColor`,stroke:`none`}};
|
|
9
|
+
/**
|
|
10
|
+
* @license @tabler/icons-react v3.40.0 - MIT
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license.
|
|
13
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
const createReactComponent=(r,i,a,o)=>{let s=t(({color:t=`currentColor`,size:a=24,stroke:s=2,title:c,className:l,children:u,...d},f)=>e(`svg`,{ref:f,...n[r],width:a,height:a,className:[`tabler-icon`,`tabler-icon-${i}`,l].join(` `),...r===`filled`?{fill:t}:{strokeWidth:s,stroke:t},...d},[c&&e(`title`,{key:`svg-title`},c),...o.map(([t,n])=>e(t,n)),...Array.isArray(u)?u:[u]]));return s.displayName=`${a}`,s},r=createReactComponent(`outline`,`alert-triangle`,`AlertTriangle`,[[`path`,{d:`M12 9v4`,key:`svg-0`}],[`path`,{d:`M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0`,key:`svg-1`}],[`path`,{d:`M12 16h.01`,key:`svg-2`}]]),i=createReactComponent(`outline`,`arrow-down-right`,`ArrowDownRight`,[[`path`,{d:`M7 7l10 10`,key:`svg-0`}],[`path`,{d:`M17 8l0 9l-9 0`,key:`svg-1`}]]),a=createReactComponent(`outline`,`arrow-left`,`ArrowLeft`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M5 12l6 6`,key:`svg-1`}],[`path`,{d:`M5 12l6 -6`,key:`svg-2`}]]),o=createReactComponent(`outline`,`arrow-right`,`ArrowRight`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M13 18l6 -6`,key:`svg-1`}],[`path`,{d:`M13 6l6 6`,key:`svg-2`}]]),s=createReactComponent(`outline`,`bolt`,`Bolt`,[[`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`,key:`svg-0`}]]),c=createReactComponent(`outline`,`browser`,`Browser`,[[`path`,{d:`M4 8h16`,key:`svg-0`}],[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-1`}],[`path`,{d:`M8 4v4`,key:`svg-2`}]]),l=createReactComponent(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),u=createReactComponent(`outline`,`chevron-down`,`ChevronDown`,[[`path`,{d:`M6 9l6 6l6 -6`,key:`svg-0`}]]),d=createReactComponent(`outline`,`chevron-left`,`ChevronLeft`,[[`path`,{d:`M15 6l-6 6l6 6`,key:`svg-0`}]]),f=createReactComponent(`outline`,`chevron-right`,`ChevronRight`,[[`path`,{d:`M9 6l6 6l-6 6`,key:`svg-0`}]]),p=createReactComponent(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),m=createReactComponent(`outline`,`cylinder`,`Cylinder`,[[`path`,{d:`M5 6a7 3 0 1 0 14 0a7 3 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M5 6v12c0 1.657 3.134 3 7 3s7 -1.343 7 -3v-12`,key:`svg-1`}]]),h=createReactComponent(`outline`,`device-mobile`,`DeviceMobile`,[[`path`,{d:`M6 5a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}],[`path`,{d:`M11 4h2`,key:`svg-1`}],[`path`,{d:`M12 17v.01`,key:`svg-2`}]]),g=createReactComponent(`outline`,`external-link`,`ExternalLink`,[[`path`,{d:`M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6`,key:`svg-0`}],[`path`,{d:`M11 13l9 -9`,key:`svg-1`}],[`path`,{d:`M15 4h5v5`,key:`svg-2`}]]),_=createReactComponent(`outline`,`file-code`,`FileCode`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M10 13l-1 2l1 2`,key:`svg-2`}],[`path`,{d:`M14 13l1 2l-1 2`,key:`svg-3`}]]),v=createReactComponent(`outline`,`file-symlink`,`FileSymlink`,[[`path`,{d:`M4 21v-4a3 3 0 0 1 3 -3h5`,key:`svg-0`}],[`path`,{d:`M9 17l3 -3l-3 -3`,key:`svg-1`}],[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-2`}],[`path`,{d:`M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5`,key:`svg-3`}]]),y=createReactComponent(`outline`,`file-text`,`FileText`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M9 9l1 0`,key:`svg-2`}],[`path`,{d:`M9 13l6 0`,key:`svg-3`}],[`path`,{d:`M9 17l6 0`,key:`svg-4`}]]),b=createReactComponent(`outline`,`focus-centered`,`FocusCentered`,[[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`,key:`svg-1`}],[`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`,key:`svg-2`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`,key:`svg-3`}],[`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`,key:`svg-4`}]]),x=createReactComponent(`outline`,`folder-open`,`FolderOpen`,[[`path`,{d:`M5 19l2.757 -7.351a1 1 0 0 1 .936 -.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1 -1.964 1.625h-14.026a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2`,key:`svg-0`}]]),S=createReactComponent(`outline`,`help-circle`,`HelpCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 16v.01`,key:`svg-1`}],[`path`,{d:`M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483`,key:`svg-2`}]]),C=createReactComponent(`outline`,`id`,`Id`,[[`path`,{d:`M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10`,key:`svg-0`}],[`path`,{d:`M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M15 8l2 0`,key:`svg-2`}],[`path`,{d:`M15 12l2 0`,key:`svg-3`}],[`path`,{d:`M7 16l10 0`,key:`svg-4`}]]),w=createReactComponent(`outline`,`info-circle`,`InfoCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 9h.01`,key:`svg-1`}],[`path`,{d:`M11 12h1v4h1`,key:`svg-2`}]]),T=createReactComponent(`outline`,`layout-align-bottom`,`LayoutAlignBottom`,[[`path`,{d:`M4 20l16 0`,key:`svg-0`}],[`path`,{d:`M9 6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-1`}]]),E=createReactComponent(`outline`,`layout-align-center`,`LayoutAlignCenter`,[[`path`,{d:`M12 4l0 5`,key:`svg-0`}],[`path`,{d:`M12 15l0 5`,key:`svg-1`}],[`path`,{d:`M6 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-2`}]]),D=createReactComponent(`outline`,`layout-align-left`,`LayoutAlignLeft`,[[`path`,{d:`M4 4l0 16`,key:`svg-0`}],[`path`,{d:`M8 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-1`}]]),O=createReactComponent(`outline`,`layout-align-middle`,`LayoutAlignMiddle`,[[`path`,{d:`M4 12l5 0`,key:`svg-0`}],[`path`,{d:`M15 12l5 0`,key:`svg-1`}],[`path`,{d:`M9 8a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-2`}]]),k=createReactComponent(`outline`,`layout-align-right`,`LayoutAlignRight`,[[`path`,{d:`M20 4l0 16`,key:`svg-0`}],[`path`,{d:`M4 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-1`}]]),A=createReactComponent(`outline`,`layout-align-top`,`LayoutAlignTop`,[[`path`,{d:`M4 4l16 0`,key:`svg-0`}],[`path`,{d:`M9 10a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-1`}]]),j=createReactComponent(`outline`,`layout-board-split`,`LayoutBoardSplit`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M4 12h8`,key:`svg-1`}],[`path`,{d:`M12 15h8`,key:`svg-2`}],[`path`,{d:`M12 9h8`,key:`svg-3`}],[`path`,{d:`M12 4v16`,key:`svg-4`}]]),M=createReactComponent(`outline`,`layout-collage`,`LayoutCollage`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M10 4l4 16`,key:`svg-1`}],[`path`,{d:`M12 12l-8 2`,key:`svg-2`}]]),N=createReactComponent(`outline`,`layout-dashboard`,`LayoutDashboard`,[[`path`,{d:`M5 4h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1`,key:`svg-0`}],[`path`,{d:`M5 16h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1`,key:`svg-1`}],[`path`,{d:`M15 12h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1`,key:`svg-2`}],[`path`,{d:`M15 4h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1`,key:`svg-3`}]]),ee=createReactComponent(`outline`,`link`,`Link`,[[`path`,{d:`M9 15l6 -6`,key:`svg-0`}],[`path`,{d:`M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464`,key:`svg-1`}],[`path`,{d:`M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463`,key:`svg-2`}]]),P=createReactComponent(`outline`,`lock-open-2`,`LockOpen2`,[[`path`,{d:`M3 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -6`,key:`svg-0`}],[`path`,{d:`M9 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0`,key:`svg-1`}],[`path`,{d:`M13 11v-4a4 4 0 1 1 8 0v4`,key:`svg-2`}]]),F=createReactComponent(`outline`,`lock`,`Lock`,[[`path`,{d:`M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6`,key:`svg-0`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 11v-4a4 4 0 1 1 8 0v4`,key:`svg-2`}]]),I=createReactComponent(`outline`,`moon-stars`,`MoonStars`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}],[`path`,{d:`M17 4a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`,key:`svg-1`}],[`path`,{d:`M19 11h2m-1 -1v2`,key:`svg-2`}]]),L=createReactComponent(`outline`,`rectangular-prism`,`RectangularPrism`,[[`path`,{d:`M21 14.008v-5.018a1.98 1.98 0 0 0 -1 -1.717l-4 -2.008a2.016 2.016 0 0 0 -2 0l-10 5.008c-.619 .355 -1 1.01 -1 1.718v5.018c0 .709 .381 1.363 1 1.717l4 2.008a2.016 2.016 0 0 0 2 0l10 -5.008c.619 -.355 1 -1.01 1 -1.718`,key:`svg-0`}],[`path`,{d:`M9 21v-7.5`,key:`svg-1`}],[`path`,{d:`M9 13.5l11.5 -5.5`,key:`svg-2`}],[`path`,{d:`M3.5 11l5.5 2.5`,key:`svg-3`}]]),R=createReactComponent(`outline`,`reorder`,`Reorder`,[[`path`,{d:`M3 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-0`}],[`path`,{d:`M10 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-1`}],[`path`,{d:`M17 16a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-2`}],[`path`,{d:`M5 11v-3a3 3 0 0 1 3 -3h8a3 3 0 0 1 3 3v3`,key:`svg-3`}],[`path`,{d:`M16.5 8.5l2.5 2.5l2.5 -2.5`,key:`svg-4`}]]),z=createReactComponent(`outline`,`route-off`,`RouteOff`,[[`path`,{d:`M4 19a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M16 5a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M12 19h4.5c.71 0 1.372 -.212 1.924 -.576m1.545 -2.459a3.5 3.5 0 0 0 -3.469 -3.965h-.499m-4 0h-3.501a3.5 3.5 0 0 1 -2.477 -5.972m2.477 -1.028h3.5`,key:`svg-2`}],[`path`,{d:`M3 3l18 18`,key:`svg-3`}]]),B=createReactComponent(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]),V=createReactComponent(`outline`,`selector`,`Selector`,[[`path`,{d:`M8 9l4 -4l4 4`,key:`svg-0`}],[`path`,{d:`M16 15l-4 4l-4 -4`,key:`svg-1`}]]),H=createReactComponent(`outline`,`share`,`Share`,[[`path`,{d:`M3 12a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-0`}],[`path`,{d:`M15 6a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-1`}],[`path`,{d:`M15 18a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-2`}],[`path`,{d:`M8.7 10.7l6.6 -3.4`,key:`svg-3`}],[`path`,{d:`M8.7 13.3l6.6 3.4`,key:`svg-4`}]]),U=createReactComponent(`outline`,`stack-2`,`Stack2`,[[`path`,{d:`M12 4l-8 4l8 4l8 -4l-8 -4`,key:`svg-0`}],[`path`,{d:`M4 12l8 4l8 -4`,key:`svg-1`}],[`path`,{d:`M4 16l8 4l8 -4`,key:`svg-2`}]]),W=createReactComponent(`outline`,`sun`,`Sun`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M3 12h1m8 -9v1m8 8h1m-9 8v1m-6.4 -15.4l.7 .7m12.1 -.7l-.7 .7m0 11.4l.7 .7m-12.1 -.7l-.7 .7`,key:`svg-1`}]]),G=createReactComponent(`outline`,`target`,`Target`,[[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M7 12a5 5 0 1 0 10 0a5 5 0 1 0 -10 0`,key:`svg-1`}],[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-2`}]]),K=createReactComponent(`outline`,`transform`,`Transform`,[[`path`,{d:`M3 6a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-0`}],[`path`,{d:`M21 11v-3a2 2 0 0 0 -2 -2h-6l3 3m0 -6l-3 3`,key:`svg-1`}],[`path`,{d:`M3 13v3a2 2 0 0 0 2 2h6l-3 -3m0 6l3 -3`,key:`svg-2`}],[`path`,{d:`M15 18a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-3`}]]),q=createReactComponent(`outline`,`trash`,`Trash`,[[`path`,{d:`M4 7l16 0`,key:`svg-0`}],[`path`,{d:`M10 11l0 6`,key:`svg-1`}],[`path`,{d:`M14 11l0 6`,key:`svg-2`}],[`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12`,key:`svg-3`}],[`path`,{d:`M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3`,key:`svg-4`}]]),J=createReactComponent(`outline`,`user`,`User`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`,key:`svg-1`}]]),Y=createReactComponent(`outline`,`x`,`X`,[[`path`,{d:`M18 6l-12 12`,key:`svg-0`}],[`path`,{d:`M6 6l12 12`,key:`svg-1`}]]),X=createReactComponent(`outline`,`zoom-scan`,`ZoomScan`,[[`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`,key:`svg-0`}],[`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`,key:`svg-1`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`,key:`svg-2`}],[`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`,key:`svg-3`}],[`path`,{d:`M8 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-4`}],[`path`,{d:`M16 16l-2.5 -2.5`,key:`svg-5`}]]),Z=createReactComponent(`filled`,`direction-sign-filled`,`DirectionSignFilled`,[[`path`,{d:`M10.52 2.614a2.095 2.095 0 0 1 2.835 -.117l.126 .117l7.905 7.905c.777 .777 .816 2.013 .117 2.836l-.117 .126l-7.905 7.905a2.094 2.094 0 0 1 -2.836 .117l-.126 -.117l-7.907 -7.906a2.096 2.096 0 0 1 -.115 -2.835l.117 -.126l7.905 -7.905zm5.969 9.535l.01 -.116l-.003 -.12l-.016 -.114l-.03 -.11l-.044 -.112l-.052 -.098l-.076 -.105l-.07 -.081l-3.5 -3.5l-.095 -.083a1 1 0 0 0 -1.226 0l-.094 .083l-.083 .094a1 1 0 0 0 0 1.226l.083 .094l1.792 1.793h-5.085l-.117 .007a1 1 0 0 0 0 1.986l.117 .007h5.085l-1.792 1.793l-.083 .094a1 1 0 0 0 1.403 1.403l.094 -.083l3.5 -3.5l.097 -.112l.05 -.074l.037 -.067l.05 -.112l.023 -.076l.025 -.117z`,key:`svg-0`}]]),Q=createReactComponent(`filled`,`folder-filled`,`FolderFilled`,[[`path`,{d:`M9 3a1 1 0 0 1 .608 .206l.1 .087l2.706 2.707h6.586a3 3 0 0 1 2.995 2.824l.005 .176v8a3 3 0 0 1 -2.824 2.995l-.176 .005h-14a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-11a3 3 0 0 1 2.824 -2.995l.176 -.005h4z`,key:`svg-0`}]]),$=createReactComponent(`filled`,`player-play-filled`,`PlayerPlayFilled`,[[`path`,{d:`M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z`,key:`svg-0`}]]),te=createReactComponent(`filled`,`player-skip-back-filled`,`PlayerSkipBackFilled`,[[`path`,{d:`M19.496 4.136l-12 7a1 1 0 0 0 0 1.728l12 7a1 1 0 0 0 1.504 -.864v-14a1 1 0 0 0 -1.504 -.864z`,key:`svg-0`}],[`path`,{d:`M4 4a1 1 0 0 1 .993 .883l.007 .117v14a1 1 0 0 1 -1.993 .117l-.007 -.117v-14a1 1 0 0 1 1 -1z`,key:`svg-1`}]]),ne=createReactComponent(`filled`,`player-skip-forward-filled`,`PlayerSkipForwardFilled`,[[`path`,{d:`M3 5v14a1 1 0 0 0 1.504 .864l12 -7a1 1 0 0 0 0 -1.728l-12 -7a1 1 0 0 0 -1.504 .864z`,key:`svg-0`}],[`path`,{d:`M20 4a1 1 0 0 1 .993 .883l.007 .117v14a1 1 0 0 1 -1.993 .117l-.007 -.117v-14a1 1 0 0 1 1 -1z`,key:`svg-1`}]]),re=createReactComponent(`filled`,`player-stop-filled`,`PlayerStopFilled`,[[`path`,{d:`M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z`,key:`svg-0`}]]),ie=createReactComponent(`filled`,`star-filled`,`StarFilled`,[[`path`,{d:`M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z`,key:`svg-0`}]]);export{o as $,k as A,y as B,F as C,M as D,N as E,w as F,m as G,_ as H,C as I,d as J,p as K,S as L,D as M,E as N,j as O,T as P,s as Q,x as R,I as S,ee as T,g as U,v as V,h as W,l as X,u as Y,c as Z,V as _,$ as a,R as b,X as c,q as d,a as et,K as f,H as g,U as h,te as i,O as j,A as k,Y as l,W as m,re as n,r as nt,Q as o,G as p,f as q,ne as r,Z as s,ie as t,i as tt,J as u,B as v,P as w,L as x,z as y,b as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";const e=`__TSR_index`,t=`popstate`,n=`beforeunload`;function createHistory(t){let n=t.getLocation(),r=new Set,notify=e=>{n=t.getLocation(),r.forEach(t=>t({location:n,action:e}))},handleIndexChange=e=>{t.notifyOnIndexChange??!0?notify(e):n=t.getLocation()},tryNavigation=async({task:e,navigateOpts:r,...i})=>{var a;if(r?.ignoreBlocker??!1){e();return}let o=t.getBlockers?.call(t)??[],s=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&o.length&&s)for(let e of o){let r=parseHref(i.path,i.state);if(await e.blockerFn({currentLocation:n,nextLocation:r,action:i.type})){(a=t.onBlocked)==null||a.call(t);return}}e()};return{get location(){return n},get length(){return t.getLength()},subscribers:r,subscribe:e=>(r.add(e),()=>{r.delete(e)}),push:(r,i,a)=>{let o=n.state[e];i=assignKeyAndIndex(o+1,i),tryNavigation({task:()=>{t.pushState(r,i),notify({type:`PUSH`})},navigateOpts:a,type:`PUSH`,path:r,state:i})},replace:(r,i,a)=>{let o=n.state[e];i=assignKeyAndIndex(o,i),tryNavigation({task:()=>{t.replaceState(r,i),notify({type:`REPLACE`})},navigateOpts:a,type:`REPLACE`,path:r,state:i})},go:(e,n)=>{tryNavigation({task:()=>{t.go(e),handleIndexChange({type:`GO`,index:e})},navigateOpts:n,type:`GO`})},back:e=>{tryNavigation({task:()=>{t.back(e?.ignoreBlocker??!1),handleIndexChange({type:`BACK`})},navigateOpts:e,type:`BACK`})},forward:e=>{tryNavigation({task:()=>{t.forward(e?.ignoreBlocker??!1),handleIndexChange({type:`FORWARD`})},navigateOpts:e,type:`FORWARD`})},canGoBack:()=>n.state[e]!==0,createHref:e=>t.createHref(e),block:e=>{if(!t.setBlockers)return()=>{};let n=t.getBlockers?.call(t)??[];return t.setBlockers([...n,e]),()=>{var n;let r=t.getBlockers?.call(t)??[];(n=t.setBlockers)==null||n.call(t,r.filter(t=>t!==e))}},flush:()=>t.flush?.call(t),destroy:()=>t.destroy?.call(t),notify}}function assignKeyAndIndex(t,n){return n||={},{...n,key:createRandomKey(),[e]:t}}function createBrowserHistory(r){let i=r?.window??(typeof document<`u`?window:void 0),a=i.history.pushState,o=i.history.replaceState,s=[],_getBlockers=()=>s,_setBlockers=e=>s=e,c=r?.createHref??(e=>e),l=r?.parseLocation??(()=>parseHref(`${i.location.pathname}${i.location.search}${i.location.hash}`,i.history.state));i.history.state?.key||i.history.replaceState({[e]:0,key:createRandomKey()},``);let u=l(),d,f=!1,p=!1,m=!1,h=!1,getLocation=()=>u,g,_,flush=()=>{g&&(v._ignoreSubscribers=!0,(g.isPush?i.history.pushState:i.history.replaceState)(g.state,``,g.href),v._ignoreSubscribers=!1,g=void 0,_=void 0,d=void 0)},queueHistoryAction=(e,t,n)=>{let r=c(t);_||(d=u),u=parseHref(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>flush())},onPushPop=e=>{u=l(),v.notify({type:e})},onPushPopEvent=async()=>{if(p){p=!1;return}let t=l(),n=t.state[e]-u.state[e],r=n===1,a=n===-1,o=!r&&!a||f;f=!1;let s=o?`GO`:a?`BACK`:`FORWARD`,c=o?{type:`GO`,index:n}:{type:a?`BACK`:`FORWARD`};if(m)m=!1;else{let e=_getBlockers();if(typeof document<`u`&&e.length){for(let n of e)if(await n.blockerFn({currentLocation:u,nextLocation:t,action:s})){p=!0,i.history.go(1),v.notify(c);return}}}u=l(),v.notify(c)},onBeforeUnload=e=>{if(h){h=!1;return}let t=!1,n=_getBlockers();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},v=createHistory({getLocation,getLength:()=>i.history.length,pushState:(e,t)=>queueHistoryAction(`push`,e,t),replaceState:(e,t)=>queueHistoryAction(`replace`,e,t),back:e=>(e&&(m=!0),h=!0,i.history.back()),forward:e=>{e&&(m=!0),h=!0,i.history.forward()},go:e=>{f=!0,i.history.go(e)},createHref:e=>c(e),flush,destroy:()=>{i.history.pushState=a,i.history.replaceState=o,i.removeEventListener(n,onBeforeUnload,{capture:!0}),i.removeEventListener(t,onPushPopEvent)},onBlocked:()=>{d&&u!==d&&(u=d)},getBlockers:_getBlockers,setBlockers:_setBlockers,notifyOnIndexChange:!1});return i.addEventListener(n,onBeforeUnload,{capture:!0}),i.addEventListener(t,onPushPopEvent),i.history.pushState=function(...e){let t=a.apply(i.history,e);return v._ignoreSubscribers||onPushPop(`PUSH`),t},i.history.replaceState=function(...e){let t=o.apply(i.history,e);return v._ignoreSubscribers||onPushPop(`REPLACE`),t},v}function createHashHistory(e){let t=e?.window??(typeof document<`u`?window:void 0);return createBrowserHistory({window:t,parseLocation:()=>{let e=t.location.hash.split(`#`).slice(1),n=e[0]??`/`,r=t.location.search,i=e.slice(1);return parseHref(`${n}${r}${i.length===0?``:`#${i.join(`#`)}`}`,t.history.state)},createHref:e=>`${t.location.pathname}${t.location.search}#${e}`})}function createMemoryHistory(e={initialEntries:[`/`]}){let t=e.initialEntries,n=e.initialIndex?Math.min(Math.max(e.initialIndex,0),t.length-1):t.length-1,r=t.map((e,t)=>assignKeyAndIndex(t,void 0)),getLocation=()=>parseHref(t[n],r[n]);return createHistory({getLocation,getLength:()=>t.length,pushState:(e,i)=>{n<t.length-1&&(t.splice(n+1),r.splice(n+1)),r.push(i),t.push(e),n=Math.max(t.length-1,0)},replaceState:(e,i)=>{r[n]=i,t[n]=e},back:()=>{n=Math.max(n-1,0)},forward:()=>{n=Math.min(n+1,t.length-1)},go:e=>{n=Math.min(Math.max(n+e,0),t.length-1)},createHref:e=>e})}function parseHref(t,n){let r=t.indexOf(`#`),i=t.indexOf(`?`);return{href:t,pathname:t.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:t.length),hash:r>-1?t.substring(r):``,search:i>-1?t.slice(i,r===-1?void 0:r):``,state:n||{[e]:0,key:createRandomKey()}}}function createRandomKey(){return(Math.random()+1).toString(36).substring(7)}export{parseHref as i,createHashHistory as n,createMemoryHistory as r,createBrowserHistory as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{s as e,t}from"../../rolldown-runtime.mjs";import{i as n,r,t as i}from"./history.mjs";import*as a from"react";import{useRef as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{flushSync as u}from"react-dom";var d=!0,f=`Invariant failed`;function invariant(e,t){if(!e){if(d)throw Error(f);var n=typeof t==`function`?t():t,r=n?`${f}: ${n}`:f;throw Error(r)}}var p=!0;function warning(e,t){if(!p){if(e)return;var n=`Warning: `+t;typeof console<`u`&&console.warn(n);try{throw Error(n)}catch{}}}const m=new WeakMap,h=new WeakMap,g={current:[]};let _=!1,v=0;const y=new Set,b=new Map;function __flush_internals(e){let t=Array.from(e).sort((e,t)=>e instanceof x&&e.options.deps.includes(t)?1:t instanceof x&&t.options.deps.includes(e)?-1:0);for(let e of t){if(g.current.includes(e))continue;g.current.push(e),e.recompute();let t=h.get(e);if(t)for(let e of t){let t=m.get(e);t&&__flush_internals(t)}}}function __notifyListeners(e){e.listeners.forEach(t=>t({prevVal:e.prevState,currentVal:e.state}))}function __notifyDerivedListeners(e){e.listeners.forEach(t=>t({prevVal:e.prevState,currentVal:e.state}))}function __flush(e){if(v>0&&!b.has(e)&&b.set(e,e.prevState),y.add(e),!(v>0)&&!_)try{for(_=!0;y.size>0;){let e=Array.from(y);y.clear();for(let t of e)t.prevState=b.get(t)??t.prevState,__notifyListeners(t);for(let t of e){let e=m.get(t);e&&(g.current.push(t),__flush_internals(e))}for(let t of e){let e=m.get(t);if(e)for(let t of e)__notifyDerivedListeners(t)}}}finally{_=!1,g.current=[],b.clear()}}function batch(e){v++;try{e()}finally{if(v--,v===0){let e=Array.from(y)[0];e&&__flush(e)}}}var Store=class{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t;this.listeners.add(e);let n=((t=this.options)?.onSubscribe)?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.setState=e=>{var t,n;this.prevState=this.state,this.state=this.options?.updateFn?this.options.updateFn(this.prevState)(e):e(this.prevState),(n=(t=this.options)?.onUpdate)==null||n.call(t),__flush(this)},this.prevState=e,this.state=e,this.options=t}},x=class Derived{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{let e=[],t=[];for(let n of this.options.deps)e.push(n.prevState),t.push(n.state);return this.lastSeenDepValues=t,{prevDepVals:e,currDepVals:t,prevVal:this.prevState??void 0}},this.recompute=()=>{var e,t;this.prevState=this.state;let{prevDepVals:n,currDepVals:r,prevVal:i}=this.getDepVals();this.state=this.options.fn({prevDepVals:n,currDepVals:r,prevVal:i}),(t=(e=this.options).onUpdate)==null||t.call(e)},this.checkIfRecalculationNeededDeeply=()=>{for(let e of this.options.deps)e instanceof Derived&&e.checkIfRecalculationNeededDeeply();let e=!1,t=this.lastSeenDepValues,{currDepVals:n}=this.getDepVals();for(let r=0;r<n.length;r++)if(n[r]!==t[r]){e=!0;break}e&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(let e of this._subscriptions)e()}),this.subscribe=e=>{var t;this.listeners.add(e);let n=(t=this.options).onSubscribe?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(let t of e)if(t instanceof Derived)t.registerOnGraph(),this.registerOnGraph(t.options.deps);else if(t instanceof Store){let e=m.get(t);e||(e=new Set,m.set(t,e)),e.add(this);let n=h.get(this);n||(n=new Set,h.set(this,n)),n.add(t)}}unregisterFromGraph(e=this.options.deps){for(let t of e)if(t instanceof Derived)this.unregisterFromGraph(t.options.deps);else if(t instanceof Store){let e=m.get(t);e&&e.delete(this);let n=h.get(this);n&&n.delete(t)}}};function last(e){return e[e.length-1]}function isFunction(e){return typeof e==`function`}function functionalUpdate(e,t){return isFunction(e)?e(t):e}function pick(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function replaceEqualDeep(e,t){if(e===t)return e;let n=t,r=isPlainArray(e)&&isPlainArray(n);if(r||isPlainObject(e)&&isPlainObject(n)){let t=r?e:Object.keys(e),i=t.length,a=r?n:Object.keys(n),o=a.length,s=r?[]:{},c=0;for(let i=0;i<o;i++){let o=r?i:a[i];(!r&&t.includes(o)||r)&&e[o]===void 0&&n[o]===void 0?(s[o]=void 0,c++):(s[o]=replaceEqualDeep(e[o],n[o]),s[o]===e[o]&&e[o]!==void 0&&c++)}return i===o&&c===i?e:s}return n}function isPlainObject(e){if(!hasObjectPrototype(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!hasObjectPrototype(n)||!n.hasOwnProperty(`isPrototypeOf`))}function hasObjectPrototype(e){return Object.prototype.toString.call(e)===`[object Object]`}function isPlainArray(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function getObjectKeys(e,t){let n=Object.keys(e);return t&&(n=n.filter(t=>e[t]!==void 0)),n}function deepEqual(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(isPlainObject(e)&&isPlainObject(t)){let r=n?.ignoreUndefined??!0,i=getObjectKeys(e,r),a=getObjectKeys(t,r);return!n?.partial&&i.length!==a.length?!1:a.every(r=>deepEqual(e[r],t[r],n))}return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length?!e.some((e,r)=>!deepEqual(e,t[r],n)):!1}function createControlledPromise(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function hasUriEncodedChars(e){return/%[0-9A-Fa-f]{2}/.test(e)}function joinPaths(e){return cleanPath(e.filter(e=>e!==void 0).join(`/`))}function cleanPath(e){return e.replace(/\/{2,}/g,`/`)}function trimPathLeft(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function trimPathRight(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function trimPath(e){return trimPathRight(trimPathLeft(e))}function removeTrailingSlash(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function exactPathTest(e,t,n){return removeTrailingSlash(e,n)===removeTrailingSlash(t,n)}function resolvePath({basepath:e,base:t,to:n,trailingSlash:r=`never`,caseSensitive:i}){t=removeBasepath(e,t,i),n=removeBasepath(e,n,i);let a=parsePathname(t),o=parsePathname(n);return a.length>1&&last(a)?.value===`/`&&a.pop(),o.forEach((e,t)=>{e.value===`/`?t?t===o.length-1&&a.push(e):a=[e]:e.value===`..`?a.pop():e.value===`.`||a.push(e)}),a.length>1&&(last(a)?.value===`/`?r===`never`&&a.pop():r===`always`&&a.push({type:`pathname`,value:`/`})),cleanPath(joinPaths([e,...a.map(e=>e.value)]))}function parsePathname(e){if(!e)return[];e=cleanPath(e);let t=[];if(e.slice(0,1)===`/`&&(e=e.substring(1),t.push({type:`pathname`,value:`/`})),!e)return t;let n=e.split(`/`).filter(Boolean);return t.push(...n.map(e=>e===`$`||e===`*`?{type:`wildcard`,value:e}:e.charAt(0)===`$`?{type:`param`,value:e}:{type:`pathname`,value:e.includes(`%25`)?e.split(`%25`).map(e=>decodeURI(e)).join(`%25`):decodeURI(e)})),e.slice(-1)===`/`&&(e=e.substring(1),t.push({type:`pathname`,value:`/`})),t}function interpolatePath({path:e,params:t,leaveWildcards:n,leaveParams:r,decodeCharMap:i}){let a=parsePathname(e);function encodeParam(e){let n=t[e],r=typeof n==`string`;return[`*`,`_splat`].includes(e)?r?encodeURI(n):n:r?encodePathParam(n,i):n}let o={};return{usedParams:o,interpolatedPath:joinPaths(a.map(e=>{if(e.type===`wildcard`){o._splat=t._splat;let r=encodeParam(`_splat`);return n?`${e.value}${r??``}`:r}if(e.type===`param`){let n=e.value.substring(1);if(o[n]=t[n],r){let t=encodeParam(e.value);return`${e.value}${t??``}`}return encodeParam(n)??`undefined`}return e.value}))}}function encodePathParam(e,t){let n=encodeURIComponent(e);if(t)for(let[e,r]of t)n=n.replaceAll(e,r);return n}function matchPathname(e,t,n){let r=matchByPath(e,t,n);if(!(n.to&&!r))return r??{}}function removeBasepath(e,t,n=!1){let r=n?e:e.toLowerCase(),i=n?t:t.toLowerCase();switch(!0){case r===`/`:return t;case i===r:return``;case t.length<e.length:return t;case i[r.length]!==`/`:return t;case i.startsWith(r):return t.slice(e.length);default:return t}}function matchByPath(e,t,n){if(e!==`/`&&!t.startsWith(e))return;t=removeBasepath(e,t,n.caseSensitive);let r=removeBasepath(e,`${n.to??`$`}`,n.caseSensitive),i=parsePathname(t),a=parsePathname(r);t.startsWith(`/`)||i.unshift({type:`pathname`,value:`/`}),r.startsWith(`/`)||a.unshift({type:`pathname`,value:`/`});let o={};return(()=>{for(let e=0;e<Math.max(i.length,a.length);e++){let t=i[e],r=a[e],s=e>=i.length-1,c=e>=a.length-1;if(r){if(r.type===`wildcard`){let t=decodeURI(joinPaths(i.slice(e).map(e=>e.value)));return o[`*`]=t,o._splat=t,!0}if(r.type===`pathname`){if(r.value===`/`&&!t?.value)return!0;if(t){if(n.caseSensitive){if(r.value!==t.value)return!1}else if(r.value.toLowerCase()!==t.value.toLowerCase())return!1}}if(!t)return!1;if(r.type===`param`){if(t.value===`/`)return!1;t.value.charAt(0)!==`$`&&(o[r.value.substring(1)]=decodeURIComponent(t.value))}}if(!s&&c)return o[`**`]=joinPaths(i.slice(e+1).map(e=>e.value)),!!n.fuzzy&&r?.value!==`/`}return!0})()?o:void 0}function notFound(e={}){if(e.isNotFound=!0,e.throw)throw e;return e}function isNotFound(e){return!!e?.isNotFound}const S=`tsr-scroll-restoration-v1_3`;let C=!1;try{C=typeof window<`u`&&typeof window.sessionStorage==`object`}catch{}const throttle=(e,t)=>{let n;return(...r)=>{n||=setTimeout(()=>{e(...r),n=null},t)}},w=C?{state:JSON.parse(window.sessionStorage.getItem(`tsr-scroll-restoration-v1_3`)||`null`)||{},set:e=>(w.state=functionalUpdate(e,w.state)||w.state,window.sessionStorage.setItem(S,JSON.stringify(w.state)))}:void 0,defaultGetScrollRestorationKey=e=>e.state.key||e.href;function getCssSelector(e){let t=[],n;for(;n=e.parentNode;)t.unshift(`${e.tagName}:nth-child(${[].indexOf.call(n.children,e)+1})`),e=n;return`${t.join(` > `)}`.toLowerCase()}let T=!1;function restoreScroll(e,t,n,r,i){let a;try{a=JSON.parse(sessionStorage.getItem(e)||`{}`)}catch(e){console.error(e);return}let o=t||window.history.state?.key,s=a[o];T=!0,(()=>{if(r&&s){for(let e in s){let t=s[e];if(e===`window`)window.scrollTo({top:t.scrollY,left:t.scrollX,behavior:n});else if(e){let n=document.querySelector(e);n&&(n.scrollLeft=t.scrollX,n.scrollTop=t.scrollY)}}return}let e=window.location.hash.split(`#`)[1];if(e){let t=(window.history.state||{}).__hashScrollIntoViewOptions??!0;if(t){let n=document.getElementById(e);n&&n.scrollIntoView(t)}return}[`window`,...i?.filter(e=>e!==`window`)??[]].forEach(e=>{let t=e===`window`?window:document.querySelector(e);t&&t.scrollTo({top:0,left:0,behavior:n})})})(),T=!1}function setupScrollRestoration(e,t){if((t??e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),typeof document>`u`||e.isScrollRestorationSetup)return;e.isScrollRestorationSetup=!0,T=!1;let n=e.options.getScrollRestorationKey||defaultGetScrollRestorationKey;window.history.scrollRestoration=`manual`;let onScroll=t=>{if(T||!e.isScrollRestoring)return;let r=``;if(t.target===document||t.target===window)r=`window`;else{let e=t.target.getAttribute(`data-scroll-restoration-id`);r=e?`[data-scroll-restoration-id="${e}"]`:getCssSelector(t.target)}let i=n(e.state.location);w.set(e=>{let t=e[i]=e[i]||{},n=t[r]=t[r]||{};if(r===`window`)n.scrollX=window.scrollX||0,n.scrollY=window.scrollY||0;else if(r){let e=document.querySelector(r);e&&(n.scrollX=e.scrollLeft||0,n.scrollY=e.scrollTop||0)}return e})};typeof document<`u`&&document.addEventListener(`scroll`,throttle(onScroll,100),!0),e.subscribe(`onRendered`,t=>{let r=n(t.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}restoreScroll(S,r,e.options.scrollRestorationBehavior||void 0,e.isScrollRestoring||void 0,e.options.scrollToTopSelectors||void 0),e.isScrollRestoring&&w.set(e=>(e[r]=e[r]||{},e))})}function encode(e,t){let n,r,i,a=``;for(n in e)if((i=e[n])!==void 0)if(Array.isArray(i))for(r=0;r<i.length;r++)a&&(a+=`&`),a+=encodeURIComponent(n)+`=`+encodeURIComponent(i[r]);else a&&(a+=`&`),a+=encodeURIComponent(n)+`=`+encodeURIComponent(i);return(t||``)+a}function toValue(e){if(!e)return``;let t=hasUriEncodedChars(e)?decodeURIComponent(e):decodeURIComponent(encodeURIComponent(e));return t===`false`?!1:t===`true`?!0:t*0==0&&+t+``===t?+t:t}function decode(e,t){let n,r,i={},a=(t?e.substr(t.length):e).split(`&`);for(;n=a.shift();){let e=n.indexOf(`=`);if(e!==-1){r=n.slice(0,e),r=decodeURIComponent(r);let t=n.slice(e+1);i[r]===void 0?i[r]=toValue(t):i[r]=[].concat(i[r],toValue(t))}else r=n,r=decodeURIComponent(r),i[r]=``}return i}const E=parseSearchWith(JSON.parse),D=stringifySearchWith(JSON.stringify,JSON.parse);function parseSearchWith(e){return t=>{t.substring(0,1)===`?`&&(t=t.substring(1));let n=decode(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function stringifySearchWith(e,t){function stringifyValue(n){if(typeof n==`object`&&n)try{return e(n)}catch{}else if(typeof n==`string`&&typeof t==`function`)try{return t(n),e(n)}catch{}return n}return e=>{e={...e},Object.keys(e).forEach(t=>{let n=e[t];n===void 0||n===void 0?delete e[t]:e[t]=stringifyValue(n)});let t=encode(e).toString();return t?`?${t}`:``}}const O=`__root__`;function redirect(e){if(e.isRedirect=!0,e.statusCode=e.statusCode||e.code||307,e.headers=e.headers||{},!e.reloadDocument){e.reloadDocument=!1;try{new URL(`${e.href}`),e.reloadDocument=!0}catch{}}if(e.throw)throw e;return e}function isRedirect(e){return!!e?.isRedirect}function isResolvedRedirect(e){return!!e?.isRedirect&&e.href}function getLocationChangeInfo(e){let t=e.resolvedLocation,n=e.location;return{fromLocation:t,toLocation:n,pathChanged:t?.pathname!==n.pathname,hrefChanged:t?.href!==n.href,hashChanged:t?.hash!==n.hash}}var RouterCore=class{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=e=>e(),this.update=e=>{e.notFoundRoute&&console.warn(`The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.`);let t=this.options;this.options={...this.options,...e},this.isServer=this.options.isServer??typeof document>`u`,this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(e=>[encodeURIComponent(e),e])):void 0,(!this.basepath||e.basepath&&e.basepath!==t.basepath)&&(e.basepath===void 0||e.basepath===``||e.basepath===`/`?this.basepath=`/`:this.basepath=`/${trimPath(e.basepath)}`),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history??(this.isServer?r({initialEntries:[this.basepath||`/`]}):i()),this.latestLocation=this.parseLocation()),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),this.__store||(this.__store=new Store(getInitialRouterState(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(e=>![`redirected`].includes(e.status))}}}),setupScrollRestoration(this)),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a)`))},this.buildRouteTree=()=>{this.routesById={},this.routesByPath={};let e=this.options.notFoundRoute;e&&(e.init({originalIndex:99999999999,defaultSsr:this.options.defaultSsr}),this.routesById[e.id]=e);let recurseRoutes=e=>{e.forEach((e,t)=>{e.init({originalIndex:t,defaultSsr:this.options.defaultSsr});let n=this.routesById[e.id];if(invariant(!n,`Duplicate routes found with id: ${String(e.id)}`),this.routesById[e.id]=e,!e.isRoot&&e.path){let t=trimPathRight(e.fullPath);(!this.routesByPath[t]||e.fullPath.endsWith(`/`))&&(this.routesByPath[t]=e)}let r=e.children;r?.length&&recurseRoutes(r)})};recurseRoutes([this.routeTree]);let t=[];Object.values(this.routesById).forEach((e,n)=>{if(e.isRoot||!e.path)return;let r=trimPathLeft(e.fullPath),i=parsePathname(r);for(;i.length>1&&i[0]?.value===`/`;)i.shift();let a=i.map(e=>e.value===`/`?.75:e.type===`param`?.5:e.type===`wildcard`?.25:1);t.push({child:e,trimmed:r,parsed:i,index:n,scores:a})}),this.flatRoutes=t.sort((e,t)=>{let n=Math.min(e.scores.length,t.scores.length);for(let r=0;r<n;r++)if(e.scores[r]!==t.scores[r])return t.scores[r]-e.scores[r];if(e.scores.length!==t.scores.length)return t.scores.length-e.scores.length;for(let r=0;r<n;r++)if(e.parsed[r].value!==t.parsed[r].value)return e.parsed[r].value>t.parsed[r].value?1:-1;return e.index-t.index}).map((e,t)=>(e.child.rank=t,e.child))},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let parse=({pathname:t,search:n,hash:r,state:i})=>{let a=this.options.parseSearch(n),o=this.options.stringifySearch(a);return{pathname:t,searchStr:o,search:replaceEqualDeep(e?.search,a),hash:r.split(`#`).reverse()[0]??``,href:`${t}${o}${r}`,state:replaceEqualDeep(e?.state,i)}},n=parse(t??this.history.location),{__tempLocation:r,__tempKey:i}=n.state;if(r&&(!i||i===this.tempLocationKey)){let e=parse(r);return e.state.key=n.state.key,delete e.state.__tempLocation,{...e,maskedLocation:n}}return n},this.resolvePathWithBase=(e,t)=>resolvePath({basepath:this.basepath,base:e,to:cleanPath(t),trailingSlash:this.options.trailingSlash,caseSensitive:this.options.caseSensitive}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=(e,t)=>{let n={},r=trimPathRight(e.pathname),getMatchedParams=e=>matchPathname(this.basepath,r,{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive,fuzzy:!0}),i=t?.to===void 0?void 0:this.routesByPath[t.to];i?n=getMatchedParams(i):i=this.flatRoutes.find(e=>{let t=getMatchedParams(e);return t?(n=t,!0):!1});let a=i||this.routesById.__root__,o=[a];for(;a.parentRoute;)a=a.parentRoute,o.unshift(a);return{matchedRoutes:o,routeParams:n,foundRoute:i}},this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t.pendingTimeout))},this.cancelMatches=()=>{var e;(e=this.state.pendingMatches)==null||e.forEach(e=>{this.cancelMatch(e.id)})},this.buildLocation=e=>{let build=(t={},n)=>{let r=t._fromLocation?this.matchRoutes(t._fromLocation,{_buildLocation:!0}):this.state.matches,i=t.from==null?void 0:r.find(e=>matchPathname(this.basepath,trimPathRight(e.pathname),{to:t.from,caseSensitive:!1,fuzzy:!1})),a=i?.pathname||this.latestLocation.pathname;invariant(t.from==null||i!=null,`Could not find match for from: `+t.from);let o=this.state.pendingMatches?.length?last(this.state.pendingMatches)?.search:last(r)?.search||this.latestLocation.search,s=n?.matchedRoutes.filter(e=>r.find(t=>t.routeId===e.id)),c;if(t.to){let e=i?.fullPath||last(r)?.fullPath||this.latestLocation.pathname;c=this.resolvePathWithBase(e,`${t.to}`)}else{let e=this.routesById[s?.find(e=>{let t=interpolatePath({path:e.fullPath,params:n?.routeParams??{},decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath;return joinPaths([this.basepath,t])===a})?.id];c=this.resolvePathWithBase(a,e?.to??a)}let l={...last(r)?.params},u=(t.params??!0)===!0?l:{...l,...functionalUpdate(t.params,l)};Object.keys(u).length>0&&n?.matchedRoutes.map(e=>e.options.params?.stringify??e.options.stringifyParams).filter(Boolean).forEach(e=>{u={...u,...e(u)}}),c=interpolatePath({path:c,params:u??{},leaveWildcards:!1,leaveParams:e.leaveParams,decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath;let d=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};n?.matchedRoutes.forEach(t=>{try{t.options.validateSearch&&(e={...e,...validateSearch(t.options.validateSearch,{...e,...d})??{}})}catch{}}),d=e}let applyMiddlewares=r=>{let i=n?.matchedRoutes.reduce((t,n)=>{let r=[];if(`search`in n.options)n.options.search?.middlewares&&r.push(...n.options.search.middlewares);else if(n.options.preSearchFilters||n.options.postSearchFilters){let legacyMiddleware=({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i};r.push(legacyMiddleware)}if(e._includeValidateSearch&&n.options.validateSearch){let validate=({search:e,next:t})=>{let r=t(e);try{return{...r,...validateSearch(n.options.validateSearch,r)??{}}}catch{return r}};r.push(validate)}return t.concat(r)},[])??[],final=({search:e})=>t.search?t.search===!0?e:functionalUpdate(t.search,e):{};i.push(final);let applyNext=(e,t)=>{if(e>=i.length)return t;let n=i[e],next=t=>applyNext(e+1,t);return n({search:t,next})};return applyNext(0,r)};d=applyMiddlewares(d),d=replaceEqualDeep(o,d);let f=this.options.stringifySearch(d),p=t.hash===!0?this.latestLocation.hash:t.hash?functionalUpdate(t.hash,this.latestLocation.hash):void 0,m=p?`#${p}`:``,h=t.state===!0?this.latestLocation.state:t.state?functionalUpdate(t.state,this.latestLocation.state):{};return h=replaceEqualDeep(this.latestLocation.state,h),{pathname:c,search:d,searchStr:f,state:h,hash:p??``,href:`${c}${f}${m}`,unmaskOnReload:t.unmaskOnReload}},buildWithMatches=(t={},n)=>{let r=build(t),i=n?build(n):void 0;if(!i){let t={},a=this.options.routeMasks?.find(e=>{let n=matchPathname(this.basepath,r.pathname,{to:e.from,caseSensitive:!1,fuzzy:!1});return n?(t=n,!0):!1});if(a){let{from:r,...o}=a;n={...pick(e,[`from`]),...o,params:t},i=build(n)}}let a=build(t,this.getMatchedRoutes(r,t));if(i){let e=this.getMatchedRoutes(i,n);a.maskedLocation=build(n,e)}return a};return e.mask?buildWithMatches(e,{...pick(e,[`from`]),...e.mask}):buildWithMatches(e)},this.commitLocation=({viewTransition:e,ignoreBlocker:t,...n})=>{let isSameState=()=>{let e=[`key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=deepEqual(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},r=this.latestLocation.href===n.href,i=this.commitLocationPromise;if(this.commitLocationPromise=createControlledPromise(()=>{i?.resolve()}),r&&isSameState())this.load();else{let{maskedLocation:r,hashScrollIntoView:i,...a}=n;r&&(a={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...a,search:a.searchStr,state:{...a.state,__tempKey:void 0,__tempLocation:void 0,key:void 0}}}},(a.unmaskOnReload??this.options.unmaskOnReload??!1)&&(a.state.__tempKey=this.tempLocationKey)),a.state.__hashScrollIntoViewOptions=i??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,this.history[n.replace?`replace`:`push`](a.href,a.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:r,viewTransition:i,ignoreBlocker:a,href:o,...s}={})=>{if(o){let t=this.history.location.state.__TSR_index,r=n(o,{__TSR_index:e?t:t+1});s.to=r.pathname,s.search=this.options.parseSearch(r.search),s.hash=r.hash.slice(1)}let c=this.buildLocation({...s,_includeValidateSearch:!0});return this.commitLocation({...c,viewTransition:i,replace:e,resetScroll:t,hashScrollIntoView:r,ignoreBlocker:a})},this.navigate=({to:e,reloadDocument:t,href:n,...r})=>{if(t){if(!n){let t=this.buildLocation({to:e,...r});n=this.history.createHref(t.href)}r.replace?window.location.replace(n):window.location.href=n;return}return this.buildAndCommitLocation({...r,href:n,to:e})},this.load=async e=>{this.latestLocation=this.parseLocation(this.latestLocation);let t,n,r;for(r=new Promise(i=>{this.startTransition(async()=>{var a;try{let t=this.latestLocation,n=this.state.resolvedLocation;this.cancelMatches();let r;batch(()=>{r=this.matchRoutes(t),this.__store.setState(e=>({...e,status:`pending`,isLoading:!0,location:t,pendingMatches:r,cachedMatches:e.cachedMatches.filter(e=>!r.find(t=>t.id===e.id))}))}),this.state.redirect||this.emit({type:`onBeforeNavigate`,...getLocationChangeInfo({resolvedLocation:n,location:t})}),this.emit({type:`onBeforeLoad`,...getLocationChangeInfo({resolvedLocation:n,location:t})}),await this.loadMatches({sync:e?.sync,matches:r,location:t,onReady:async()=>{this.startViewTransition(async()=>{let e,t,n;batch(()=>{this.__store.setState(r=>{let i=r.matches,a=r.pendingMatches||r.matches;return e=i.filter(e=>!a.find(t=>t.id===e.id)),t=a.filter(e=>!i.find(t=>t.id===e.id)),n=i.filter(e=>a.find(t=>t.id===e.id)),{...r,isLoading:!1,loadedAt:Date.now(),matches:a,pendingMatches:void 0,cachedMatches:[...r.cachedMatches,...e.filter(e=>e.status!==`error`)]}}),this.clearExpiredCache()}),[[e,`onLeave`],[t,`onEnter`],[n,`onStay`]].forEach(([e,t])=>{e.forEach(e=>{var n,r;(r=(n=this.looseRoutesById[e.routeId].options)[t])==null||r.call(n,e)})})})}})}catch(e){isResolvedRedirect(e)?(t=e,this.isServer||this.navigate({...t,replace:!0,ignoreBlocker:!0})):isNotFound(e)&&(n=e),this.__store.setState(e=>({...e,statusCode:t?t.statusCode:n?404:e.matches.some(e=>e.status===`error`)?500:200,redirect:t}))}this.latestLoadPromise===r&&((a=this.commitLocationPromise)==null||a.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),i()})}),this.latestLoadPromise=r,await r;this.latestLoadPromise&&r!==this.latestLoadPromise;)await this.latestLoadPromise;this.hasNotFoundMatch()&&this.__store.setState(e=>({...e,statusCode:404}))},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;n=typeof t==`object`&&this.isViewTransitionTypesSupported?{update:e,types:t.types}:e,document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{let n,r=this.state.pendingMatches?.find(t=>t.id===e),i=this.state.matches.find(t=>t.id===e),a=this.state.cachedMatches.find(t=>t.id===e),o=r?`pendingMatches`:i?`matches`:a?`cachedMatches`:``;return o&&this.__store.setState(r=>({...r,[o]:r[o]?.map(r=>r.id===e?n=t(r):r)})),n},this.getMatch=e=>[...this.state.cachedMatches,...this.state.pendingMatches??[],...this.state.matches].find(t=>t.id===e),this.loadMatches=async({location:e,matches:t,preload:n,onReady:r,updateMatch:i=this.updateMatch,sync:a})=>{let o,s=!1,triggerOnReady=async()=>{s||(s=!0,await r?.())},resolvePreload=e=>!!(n&&!this.state.matches.find(t=>t.id===e));!this.isServer&&!this.state.matches.length&&triggerOnReady();let handleRedirectAndNotFound=(n,r)=>{var a,o,c,l;if(isResolvedRedirect(r)&&!r.reloadDocument)throw r;if(isRedirect(r)||isNotFound(r)){if(i(n.id,e=>({...e,status:isRedirect(r)?`redirected`:isNotFound(r)?`notFound`:`error`,isFetching:!1,error:r,beforeLoadPromise:void 0,loaderPromise:void 0})),r.routeId||=n.routeId,(a=n.beforeLoadPromise)==null||a.resolve(),(o=n.loaderPromise)==null||o.resolve(),(c=n.loadPromise)==null||c.resolve(),isRedirect(r))throw s=!0,r=this.resolveRedirect({...r,_fromLocation:e}),r;if(isNotFound(r))throw this._handleNotFound(t,r,{updateMatch:i}),(l=this.serverSsr)==null||l.onMatchSettled({router:this,match:this.getMatch(n.id)}),r}};try{await new Promise((n,s)=>{(async()=>{var c;try{let handleSerialError=(e,n,r)=>{var a,s;let{id:c,routeId:l}=t[e],u=this.looseRoutesById[l];if(n instanceof Promise)throw n;n.routerCode=r,o??=e,handleRedirectAndNotFound(this.getMatch(c),n);try{(s=(a=u.options).onError)==null||s.call(a,n)}catch(e){n=e,handleRedirectAndNotFound(this.getMatch(c),n)}i(c,e=>{var t,r;return(t=e.beforeLoadPromise)==null||t.resolve(),(r=e.loadPromise)==null||r.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController,beforeLoadPromise:void 0}})};for(let[n,{id:a,routeId:o}]of t.entries()){let s=this.getMatch(a),l=t[n-1]?.id,u=this.looseRoutesById[o],d=u.options.pendingMs??this.options.defaultPendingMs,f=!!(r&&!this.isServer&&!resolvePreload(a)&&(u.options.loader||u.options.beforeLoad)&&typeof d==`number`&&d!==1/0&&(u.options.pendingComponent??this.options?.defaultPendingComponent)),p=!0;if((s.beforeLoadPromise||s.loaderPromise)&&(f&&setTimeout(()=>{try{triggerOnReady()}catch{}},d),await s.beforeLoadPromise,p=this.getMatch(a).status!==`success`),p){try{i(a,e=>{let t=e.loadPromise;return{...e,loadPromise:createControlledPromise(()=>{t?.resolve()}),beforeLoadPromise:createControlledPromise()}});let r=new AbortController,o;f&&(o=setTimeout(()=>{try{triggerOnReady()}catch{}},d));let{paramsError:s,searchError:p}=this.getMatch(a);s&&handleSerialError(n,s,`PARSE_PARAMS`),p&&handleSerialError(n,p,`VALIDATE_SEARCH`);let getParentMatchContext=()=>l?this.getMatch(l).context:this.options.context??{};i(a,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:r,pendingTimeout:o,context:{...getParentMatchContext(),...e.__routeContext}}));let{search:m,params:h,context:g,cause:_}=this.getMatch(a),v=resolvePreload(a),y={search:m,abortController:r,params:h,preload:v,context:g,location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:v?`preload`:_,matches:t},b=await(c=u.options).beforeLoad?.call(c,y)??{};(isRedirect(b)||isNotFound(b))&&handleSerialError(n,b,`BEFORE_LOAD`),i(a,e=>({...e,__beforeLoadContext:b,context:{...getParentMatchContext(),...e.__routeContext,...b},abortController:r}))}catch(e){handleSerialError(n,e,`BEFORE_LOAD`)}i(a,e=>{var t;return(t=e.beforeLoadPromise)==null||t.resolve(),{...e,beforeLoadPromise:void 0,isFetching:!1}})}}let s=t.slice(0,o),l=[];s.forEach(({id:n,routeId:r},o)=>{l.push((async()=>{let{loaderPromise:s}=this.getMatch(n),c=!1,u=!1;if(s){await s;let e=this.getMatch(n);e.error&&handleRedirectAndNotFound(e,e.error)}else{let s=l[o-1],d=this.looseRoutesById[r],getLoaderContext=()=>{let{params:t,loaderDeps:r,abortController:i,context:a,cause:o}=this.getMatch(n),c=resolvePreload(n);return{params:t,deps:r,preload:!!c,parentMatchPromise:s,abortController:i,context:a,location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),cause:c?`preload`:o,route:d}},f=Date.now()-this.getMatch(n).updatedAt,p=resolvePreload(n),m=p?d.options.preloadStaleTime??this.options.defaultPreloadStaleTime??3e4:d.options.staleTime??this.options.defaultStaleTime??0,h=d.options.shouldReload,g=typeof h==`function`?h(getLoaderContext()):h;i(n,e=>({...e,loaderPromise:createControlledPromise(),preload:!!p&&!this.state.matches.find(e=>e.id===n)}));let runLoader=async()=>{var e,r,a,o,s,c,l;try{let potentialPendingMinPromise=async()=>{let e=this.getMatch(n);e.minPendingPromise&&await e.minPendingPromise};try{this.loadRouteChunk(d),i(n,e=>({...e,isFetching:`loader`}));let s=await(e=d.options).loader?.call(e,getLoaderContext());handleRedirectAndNotFound(this.getMatch(n),s),await d._lazyPromise,await potentialPendingMinPromise();let c={matches:t,match:this.getMatch(n),params:this.getMatch(n).params,loaderData:s},l=(r=d.options).head?.call(r,c),u=l?.meta,f=l?.links,p=l?.scripts,m=(a=d.options).scripts?.call(a,c),h=(o=d.options).headers?.call(o,{loaderData:s});i(n,e=>({...e,error:void 0,status:`success`,isFetching:!1,updatedAt:Date.now(),loaderData:s,meta:u,links:f,headScripts:p,headers:h,scripts:m}))}catch(e){let t=e;await potentialPendingMinPromise(),handleRedirectAndNotFound(this.getMatch(n),e);try{(c=(s=d.options).onError)==null||c.call(s,e)}catch(e){t=e,handleRedirectAndNotFound(this.getMatch(n),e)}i(n,e=>({...e,error:t,status:`error`,isFetching:!1}))}(l=this.serverSsr)==null||l.onMatchSettled({router:this,match:this.getMatch(n)}),await d._componentsPromise}catch(e){i(n,e=>({...e,loaderPromise:void 0})),handleRedirectAndNotFound(this.getMatch(n),e)}},{status:_,invalid:v}=this.getMatch(n);c=_===`success`&&(v||(g??f>m)),p&&d.options.preload===!1||(c&&!a?(u=!0,(async()=>{try{await runLoader();let{loaderPromise:e,loadPromise:t}=this.getMatch(n);e?.resolve(),t?.resolve(),i(n,e=>({...e,loaderPromise:void 0}))}catch(e){isResolvedRedirect(e)&&await this.navigate(e)}})()):(_!==`success`||c&&a)&&await runLoader())}if(!u){let{loaderPromise:e,loadPromise:t}=this.getMatch(n);e?.resolve(),t?.resolve()}return i(n,e=>({...e,isFetching:u?e.isFetching:!1,loaderPromise:u?e.loaderPromise:void 0,invalid:!1})),this.getMatch(n)})())}),await Promise.all(l),n()}catch(e){s(e)}})()}),await triggerOnReady()}catch(e){if(isRedirect(e)||isNotFound(e))throw isNotFound(e)&&!n&&await triggerOnReady(),e}return t},this.invalidate=e=>{let invalidate=t=>(e?.filter)?.call(e,t)??!0?{...t,invalid:!0,...t.status===`error`?{status:`pending`,error:void 0}:{}}:t;return this.__store.setState(e=>({...e,matches:e.matches.map(invalidate),cachedMatches:e.cachedMatches.map(invalidate),pendingMatches:e.pendingMatches?.map(invalidate)})),this.load({sync:e?.sync})},this.resolveRedirect=e=>{let t=e;return t.href||=this.buildLocation(t).href,t},this.clearCache=e=>{let t=e?.filter;t===void 0?this.__store.setState(e=>({...e,cachedMatches:[]})):this.__store.setState(e=>({...e,cachedMatches:e.cachedMatches.filter(e=>!t(e))}))},this.clearExpiredCache=()=>{let filter=e=>{let t=this.looseRoutesById[e.routeId];if(!t.options.loader)return!0;let n=(e.preload?t.options.preloadGcTime??this.options.defaultPreloadGcTime:t.options.gcTime??this.options.defaultGcTime)??300*1e3;return!(e.status!==`error`&&Date.now()-e.updatedAt<n)};this.clearCache({filter})},this.loadRouteChunk=e=>(e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r)}):e._lazyPromise=Promise.resolve()),e._componentsPromise===void 0&&(e._componentsPromise=e._lazyPromise.then(()=>Promise.all(k.map(async t=>{let n=e.options[t];n?.preload&&await n.preload()})))),e._componentsPromise),this.preloadRoute=async e=>{let t=this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(e=>e.id)),i=new Set([...r,...this.state.cachedMatches.map(e=>e.id)]);batch(()=>{n.forEach(e=>{i.has(e.id)||this.__store.setState(t=>({...t,cachedMatches:[...t.cachedMatches,e]}))})});try{return n=await this.loadMatches({matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(isRedirect(e))return e.reloadDocument?void 0:await this.preloadRoute({...e,_fromLocation:t});isNotFound(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.state.status!==`pending`)return!1;let i=(t?.pending===void 0?!this.state.isLoading:t.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,a=matchPathname(this.basepath,i.pathname,{...t,to:r.pathname});return!a||e.params&&!deepEqual(a,e.params,{partial:!0})?!1:a&&(t?.includeSearch??!0)?deepEqual(i.search,r.search,{partial:!0})?a:!1:a},this._handleNotFound=(e,t,{updateMatch:n=this.updateMatch}={})=>{let r=this.routesById[t.routeId??``]??this.routeTree,i={};for(let t of e)i[t.routeId]=t;!r.options.notFoundComponent&&this.options?.defaultNotFoundComponent&&(r.options.notFoundComponent=this.options.defaultNotFoundComponent),invariant(r.options.notFoundComponent,`No notFoundComponent found. Please set a notFoundComponent on your route or provide a defaultNotFoundComponent to the router.`);let a=i[r.id];invariant(a,`Could not find match for route: `+r.id),n(a.id,e=>({...e,status:`notFound`,error:t,isFetching:!1})),t.routerCode===`BEFORE_LOAD`&&r.parentRoute&&(t.routeId=r.parentRoute.id,this._handleNotFound(e,t,{updateMatch:n}))},this.hasNotFoundMatch=()=>this.__store.state.matches.some(e=>e.status===`notFound`||e.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??D,parseSearch:e.parseSearch??E}),typeof document<`u`&&(window.__TSR_ROUTER__=this)}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(e,t){let{foundRoute:n,matchedRoutes:r,routeParams:i}=this.getMatchedRoutes(e,t?.dest),a=!1;(n?n.path!==`/`&&i[`**`]:trimPathRight(e.pathname))&&(this.options.notFoundRoute?r.push(this.options.notFoundRoute):a=!0);let o=(()=>{if(a){if(this.options.notFoundMode!==`root`)for(let e=r.length-1;e>=0;e--){let t=r[e];if(t.children)return t.id}return O}})(),s=r.map(e=>{let n,r=e.options.params?.parse??e.options.parseParams;if(r)try{let e=r(i);Object.assign(i,e)}catch(e){if(n=new PathParamError(e.message,{cause:e}),t?.throwOnError)throw n;return n}}),c=[],getParentContext=e=>e?.id?e.context??this.options.context??{}:this.options.context??{};return r.forEach((n,r)=>{var a;let l=c[r-1],[u,d,f]=(()=>{let r=l?.search??e.search,i=l?._strictSearch??{};try{let e=validateSearch(n.options.validateSearch,{...r})??{};return[{...r,...e},{...i,...e},void 0]}catch(e){let n=e;if(e instanceof SearchParamError||(n=new SearchParamError(e.message,{cause:e})),t?.throwOnError)throw n;return[r,{},n]}})(),p=(a=n.options).loaderDeps?.call(a,{search:u})??``,m=p?JSON.stringify(p):``,{usedParams:h,interpolatedPath:g}=interpolatePath({path:n.fullPath,params:i,decodeCharMap:this.pathParamsDecodeCharMap}),_=interpolatePath({path:n.id,params:i,leaveWildcards:!0,decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath+m,v=this.getMatch(_),y=this.state.matches.find(e=>e.routeId===n.id),b=y?`stay`:`enter`,x;if(v)x={...v,cause:b,params:y?replaceEqualDeep(y.params,i):i,_strictParams:h,search:replaceEqualDeep(y?y.search:v.search,u),_strictSearch:d};else{let e=n.options.loader||n.options.beforeLoad||n.lazyFn||routeNeedsPreload(n)?`pending`:`success`;x={id:_,index:r,routeId:n.id,params:y?replaceEqualDeep(y.params,i):i,_strictParams:h,pathname:joinPaths([this.basepath,g]),updatedAt:Date.now(),search:y?replaceEqualDeep(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:s[r],__routeContext:{},__beforeLoadContext:{},context:{},abortController:new AbortController,fetchCount:0,cause:b,loaderDeps:y?replaceEqualDeep(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:n.options.staticData||{},loadPromise:createControlledPromise(),fullPath:n.fullPath}}t?.preload||(x.globalNotFound=o===n.id),x.searchError=f;let S=getParentContext(l);x.context={...S,...x.__routeContext,...x.__beforeLoadContext},c.push(x)}),c.forEach((n,r)=>{var i,a,o,s;let l=this.looseRoutesById[n.routeId];if(!this.getMatch(n.id)&&t?._buildLocation!==!0){let t=c[r-1],a=getParentContext(t),o={deps:n.loaderDeps,params:n.params,context:a,location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c};n.__routeContext=(i=l.options).context?.call(i,o)??{},n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}if(n.status===`success`){n.headers=(a=l.options).headers?.call(a,{loaderData:n.loaderData});let e={matches:c,match:n,params:n.params,loaderData:n.loaderData},t=(o=l.options).head?.call(o,e);n.links=t?.links,n.headScripts=t?.scripts,n.meta=t?.meta,n.scripts=(s=l.options).scripts?.call(s,e)}}),c}},SearchParamError=class extends Error{},PathParamError=class extends Error{};function getInitialRouterState(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function validateSearch(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new SearchParamError(`Async validation not supported`);if(n.issues)throw new SearchParamError(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}const k=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function routeNeedsPreload(e){for(let t of k)if(e.options[t]?.preload)return!0;return!1}var BaseRoute=class{constructor(e){if(this.init=e=>{var t;this.originalIndex=e.originalIndex;let n=this.options,r=!n?.path&&!n?.id;if(this.parentRoute=(t=this.options).getParentRoute?.call(t),r)this._path=O;else if(!this.parentRoute)throw Error(`Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.`);let i=r?O:n?.path;i&&i!==`/`&&(i=trimPathLeft(i));let a=n?.id||i,o=r?O:joinPaths([this.parentRoute.id===`__root__`?``:this.parentRoute.id,a]);i===`__root__`&&(i=`/`),o!==`__root__`&&(o=joinPaths([`/`,o]));let s=o===`__root__`?`/`:joinPaths([this.parentRoute.fullPath,i]);this._path=i,this._id=o,this._fullPath=s,this._to=s,this._ssr=n?.ssr??e.defaultSsr??!0},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}get ssr(){return this._ssr}},BaseRootRoute=class extends BaseRoute{constructor(e){super(e)}};function CatchBoundary(e){let t=e.errorComponent??ErrorComponent;return c(CatchBoundaryImpl,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?a.createElement(t,{error:n,reset:r}):e.children})}var CatchBoundaryImpl=class extends a.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey===this.props.getResetKey()?this.state.error:null,reset:()=>{this.reset()}})}};function ErrorComponent({error:e}){let[t,n]=a.useState(!1);return l(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[l(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[c(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),c(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),c(`div`,{style:{height:`.25rem`}}),t?c(`div`,{children:c(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?c(`code`,{children:e.message}):null})}):null]})}var A=t(((e,t)=>{t.exports={...a}})),j=t((e=>{var t=A();function is(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var n=typeof Object.is==`function`?Object.is:is,r=t.useState,i=t.useEffect,a=t.useLayoutEffect,o=t.useDebugValue;function useSyncExternalStore$2(e,t){var n=t(),s=r({inst:{value:n,getSnapshot:t}}),c=s[0].inst,l=s[1];return a(function(){c.value=n,c.getSnapshot=t,checkIfSnapshotChanged(c)&&l({inst:c})},[e,n,t]),i(function(){return checkIfSnapshotChanged(c)&&l({inst:c}),e(function(){checkIfSnapshotChanged(c)&&l({inst:c})})},[e]),o(n),n}function checkIfSnapshotChanged(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch{return!0}}function useSyncExternalStore$1(e,t){return t()}var s=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?useSyncExternalStore$1:useSyncExternalStore$2;e.useSyncExternalStore=t.useSyncExternalStore===void 0?s:t.useSyncExternalStore})),M=t(((e,t)=>{t.exports=j()})),N=t((e=>{var t=A(),n=M();function is(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:is,i=n.useSyncExternalStore,a=t.useRef,o=t.useEffect,s=t.useMemo,c=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,l,u){var d=a(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function memoizedSelector(t){if(!e){if(e=!0,i=t,t=l(t),u!==void 0&&f.hasValue){var n=f.value;if(u(n,t))return a=n}return a=t}if(n=a,r(i,t))return n;var o=l(t);return u!==void 0&&u(n,o)?(i=t,n):(i=t,a=o)}var e=!1,i,a,o=n===void 0?null:n;return[function(){return memoizedSelector(t())},o===null?void 0:function(){return memoizedSelector(o())}]},[t,n,l,u]);var p=i(e,d[0],d[1]);return o(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}})),P=t(((e,t)=>{t.exports=N()})),F=e(P(),1);function useStore(e,t=e=>e){return(0,F.useSyncExternalStoreWithSelector)(e.subscribe,()=>e.state,()=>e.state,t,shallow)}function shallow(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}const I=a.createContext(null);function getRouterContext(){return typeof document>`u`?I:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=I,I)}function useRouter(e){let t=a.useContext(getRouterContext());return warning(!((e?.warn??!0)&&!t),`useRouter must be used inside a <RouterProvider> component!`),t}function useRouterState(e){let t=useRouter({warn:e?.router===void 0}),n=e?.router||t,r=o(void 0);return useStore(n.__store,t=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){let n=replaceEqualDeep(r.current,e.select(t));return r.current=n,n}return e.select(t)}return t})}const L=a.createContext(void 0),R=a.createContext(void 0);function useMatch(e){let t=a.useContext(e.from?R:L);return useRouterState({select:n=>{let r=n.matches.find(n=>e.from?e.from===n.routeId:n.id===t);if(invariant(!((e.shouldThrow??!0)&&!r),`Could not find ${e.from?`an active match from "${e.from}"`:`a nearest match!`}`),r!==void 0)return e.select?e.select(r):r},structuralSharing:e.structuralSharing})}function useLoaderData(e){return useMatch({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function useLoaderDeps(e){let{select:t,...n}=e;return useMatch({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function useParams(e){return useMatch({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.params):t.params})}function useSearch(e){return useMatch({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function useNavigate(e){let{navigate:t}=useRouter();return a.useCallback(n=>t({from:e?.from,...n}),[e?.from,t])}function Navigate(e){let t=useRouter(),n=a.useRef(null);return a.useEffect(()=>{n.current!==e&&(t.navigate({...e}),n.current=e)},[t,e]),null}var Route=class extends BaseRoute{constructor(e){super(e),this.useMatch=e=>useMatch({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>useMatch({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>useSearch({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>useParams({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>useLoaderDeps({...e,from:this.id}),this.useLoaderData=e=>useLoaderData({...e,from:this.id}),this.useNavigate=()=>useNavigate({from:this.fullPath}),this.$$typeof=Symbol.for(`react.memo`)}};function createRoute(e){return new Route(e)}function createRootRouteWithContext(){return e=>createRootRoute(e)}var RootRoute=class extends BaseRootRoute{constructor(e){super(e),this.useMatch=e=>useMatch({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>useMatch({...e,from:this.id,select:t=>e?.select?e.select(t.context):t.context}),this.useSearch=e=>useSearch({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>useParams({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>useLoaderDeps({...e,from:this.id}),this.useLoaderData=e=>useLoaderData({...e,from:this.id}),this.useNavigate=()=>useNavigate({from:this.fullPath})}};function createRootRoute(e){return new RootRoute(e)}function createFileRoute(e){return new FileRoute(e,{silent:!0}).createRoute}var FileRoute=class{constructor(e,t){this.path=e,this.createRoute=e=>{warning(this.silent,`FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.`);let t=createRoute(e);return t.isRoot=!1,t},this.silent=t?.silent}};function CatchNotFound(e){let t=useRouterState({select:e=>`not-found-${e.location.pathname}-${e.status}`});return c(CatchBoundary,{getResetKey:()=>t,onCatch:(t,n)=>{var r;if(isNotFound(t))(r=e.onCatch)==null||r.call(e,t,n);else throw t},errorComponent:({error:t})=>{if(isNotFound(t))return e.fallback?.call(e,t);throw t},children:e.children})}function DefaultGlobalNotFound(){return c(`p`,{children:`Not Found`})}function SafeFragment(e){return c(s,{children:e.children})}function renderRouteNotFound(e,t,n){return t.options.notFoundComponent?c(t.options.notFoundComponent,{data:n}):e.options.defaultNotFoundComponent?c(e.options.defaultNotFoundComponent,{data:n}):c(DefaultGlobalNotFound,{})}t(((e,t)=>{let n={},r=n.hasOwnProperty,forOwn=(e,t)=>{for(let n in e)r.call(e,n)&&t(n,e[n])},extend=(e,t)=>(t&&forOwn(t,(t,n)=>{e[t]=n}),e),forEach=(e,t)=>{let n=e.length,r=-1;for(;++r<n;)t(e[r])},fourHexEscape=e=>`\\u`+(`0000`+e).slice(-4),hexadecimal=(e,t)=>{let n=e.toString(16);return t?n:n.toUpperCase()},i=n.toString,a=Array.isArray,isBuffer=e=>typeof Buffer==`function`&&Buffer.isBuffer(e),isObject=e=>i.call(e)==`[object Object]`,isString=e=>typeof e==`string`||i.call(e)==`[object String]`,isNumber=e=>typeof e==`number`||i.call(e)==`[object Number]`,isBigInt=e=>typeof e==`bigint`,isFunction=e=>typeof e==`function`,isMap=e=>i.call(e)==`[object Map]`,isSet=e=>i.call(e)==`[object Set]`,o={"\\":`\\\\`,"\b":`\\b`,"\f":`\\f`,"\n":`\\n`,"\r":`\\r`," ":`\\t`},s=/[\\\b\f\n\r\t]/,c=/[0-9]/,l=/[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,u=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^]/g,d=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^ !#-&\(-\[\]-_a-~]/g,jsesc=(e,t)=>{let increaseIndentation=()=>{h=m,++t.indentLevel,m=t.indent.repeat(t.indentLevel)},n={escapeEverything:!1,minimal:!1,isScriptContext:!1,quotes:`single`,wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:`decimal`,indent:` `,indentLevel:0,__inline1__:!1,__inline2__:!1},r=t&&t.json;r&&(n.quotes=`double`,n.wrap=!0),t=extend(n,t),t.quotes!=`single`&&t.quotes!=`double`&&t.quotes!=`backtick`&&(t.quotes=`single`);let i=t.quotes==`double`?`"`:t.quotes==`backtick`?"`":`'`,f=t.compact,p=t.lowercaseHex,m=t.indent.repeat(t.indentLevel),h=``,g=t.__inline1__,_=t.__inline2__,v=f?``:`
|
|
2
|
+
`,y,b=!0,x=t.numbers==`binary`,S=t.numbers==`octal`,C=t.numbers==`decimal`,w=t.numbers==`hexadecimal`;if(r&&e&&isFunction(e.toJSON)&&(e=e.toJSON()),!isString(e)){if(isMap(e))return e.size==0?`new Map()`:(f||(t.__inline1__=!0,t.__inline2__=!1),`new Map(`+jsesc(Array.from(e),t)+`)`);if(isSet(e))return e.size==0?`new Set()`:`new Set(`+jsesc(Array.from(e),t)+`)`;if(isBuffer(e))return e.length==0?`Buffer.from([])`:`Buffer.from(`+jsesc(Array.from(e),t)+`)`;if(a(e))return y=[],t.wrap=!0,g&&(t.__inline1__=!1,t.__inline2__=!0),_||increaseIndentation(),forEach(e,e=>{b=!1,_&&(t.__inline2__=!1),y.push((f||_?``:m)+jsesc(e,t))}),b?`[]`:_?`[`+y.join(`, `)+`]`:`[`+v+y.join(`,`+v)+v+(f?``:h)+`]`;if(isNumber(e)||isBigInt(e)){if(r)return JSON.stringify(Number(e));let t;if(C)t=String(e);else if(w){let n=e.toString(16);p||(n=n.toUpperCase()),t=`0x`+n}else x?t=`0b`+e.toString(2):S&&(t=`0o`+e.toString(8));return isBigInt(e)?t+`n`:t}else if(isBigInt(e))return r?JSON.stringify(Number(e)):e+`n`;else if(isObject(e))return y=[],t.wrap=!0,increaseIndentation(),forOwn(e,(e,n)=>{b=!1,y.push((f?``:m)+jsesc(e,t)+`:`+(f?``:` `)+jsesc(n,t))}),b?`{}`:`{`+v+y.join(`,`+v)+v+(f?``:h)+`}`;else return r?JSON.stringify(e)||`null`:String(e)}let T=t.escapeEverything?u:d;return y=e.replace(T,(e,n,a,u,d,f)=>{if(n){if(t.minimal)return n;let e=n.charCodeAt(0),r=n.charCodeAt(1);return t.es6?`\\u{`+hexadecimal((e-55296)*1024+r-56320+65536,p)+`}`:fourHexEscape(hexadecimal(e,p))+fourHexEscape(hexadecimal(r,p))}if(a)return fourHexEscape(hexadecimal(a.charCodeAt(0),p));if(e==`\0`&&!r&&!c.test(f.charAt(d+1)))return`\\0`;if(u)return u==i||t.escapeEverything?`\\`+u:u;if(s.test(e))return o[e];if(t.minimal&&!l.test(e))return e;let m=hexadecimal(e.charCodeAt(0),p);return r||m.length>2?fourHexEscape(m):`\\x`+(`00`+m).slice(-2)}),i=="`"&&(y=y.replace(/\$\{/g,"\\${")),t.isScriptContext&&(y=y.replace(/<\/(script|style)/gi,`<\\/$1`).replace(/<!--/g,r?`\\u003C!--`:`\\x3C!--`)),t.wrap&&(y=i+y+i),y};jsesc.version=`3.0.2`,t.exports=jsesc}))();function ScriptOnce({children:e,log:t}){return typeof document<`u`?null:c(`script`,{className:`tsr-once`,dangerouslySetInnerHTML:{__html:[e,``,`if (typeof __TSR_SSR__ !== "undefined") __TSR_SSR__.cleanScripts()`].filter(Boolean).join(`
|
|
3
|
+
`)}})}function ScrollRestoration(){let e=useRouter(),t=(e.options.getScrollRestorationKey||defaultGetScrollRestorationKey)(e.latestLocation),n=t===defaultGetScrollRestorationKey(e.latestLocation)?null:t;return!e.isScrollRestoring||!e.isServer?null:c(ScriptOnce,{children:`(${restoreScroll.toString()})(${JSON.stringify(S)},${JSON.stringify(n)}, undefined, true)`,log:!1})}const z=a.memo(function MatchImpl({matchId:e}){let t=useRouter(),n=useRouterState({select:t=>t.matches.find(t=>t.id===e)?.routeId});invariant(n,`Could not find routeId for matchId "${e}". Please file an issue!`);let r=t.routesById[n],i=r.options.pendingComponent??t.options.defaultPendingComponent,o=i?c(i,{}):null,u=r.options.errorComponent??t.options.defaultErrorComponent,d=r.options.onCatch??t.options.defaultOnCatch,f=r.isRoot?r.options.notFoundComponent??t.options.notFoundRoute?.options.component:r.options.notFoundComponent,p=(!r.isRoot||r.options.wrapInSuspense)&&(r.options.wrapInSuspense??i??r.options.errorComponent?.preload)?a.Suspense:SafeFragment,m=u?CatchBoundary:SafeFragment,h=f?CatchNotFound:SafeFragment,g=useRouterState({select:e=>e.loadedAt}),_=useRouterState({select:t=>{let n=t.matches.findIndex(t=>t.id===e);return t.matches[n-1]?.routeId}});return l(s,{children:[c(L.Provider,{value:e,children:c(p,{fallback:o,children:c(m,{getResetKey:()=>g,errorComponent:u||ErrorComponent,onCatch:(t,n)=>{if(isNotFound(t))throw t;warning(!1,`Error in route match: ${e}`),d?.(t,n)},children:c(h,{fallback:e=>{if(!f||e.routeId&&e.routeId!==n||!e.routeId&&!r.isRoot)throw e;return a.createElement(f,e)},children:c(B,{matchId:e})})})})}),_===`__root__`&&t.options.scrollRestoration?l(s,{children:[c(OnRendered,{}),c(ScrollRestoration,{})]}):null]})});function OnRendered(){let e=useRouter(),t=a.useRef(void 0);return c(`script`,{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.state.resolvedLocation?.href)&&(e.emit({type:`onRendered`,...getLocationChangeInfo(e.state)}),t.current=e.state.resolvedLocation)}},e.state.resolvedLocation?.state.key)}const B=a.memo(function MatchInnerImpl({matchId:e}){let t=useRouter(),{match:n,key:r,routeId:i}=useRouterState({select:n=>{let r=n.matches.findIndex(t=>t.id===e),i=n.matches[r],a=i.routeId,o=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return{key:o?JSON.stringify(o):void 0,routeId:a,match:pick(i,[`id`,`status`,`error`])}},structuralSharing:!0}),o=t.routesById[i],s=a.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?c(e,{},r):c(V,{})},[r,o.options.component,t.options.defaultComponent]),l=(o.options.errorComponent??t.options.defaultErrorComponent)||ErrorComponent;if(n.status===`notFound`)return invariant(isNotFound(n.error),`Expected a notFound error`),renderRouteNotFound(t,o,n.error);if(n.status===`redirected`)throw invariant(isRedirect(n.error),`Expected a redirect error`),t.getMatch(n.id)?.loadPromise;if(n.status===`error`){if(t.isServer)return c(l,{error:n.error,reset:void 0,info:{componentStack:``}});throw n.error}if(n.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e&&!t.getMatch(n.id)?.minPendingPromise&&!t.isServer){let r=createControlledPromise();Promise.resolve().then(()=>{t.updateMatch(n.id,e=>({...e,minPendingPromise:r}))}),setTimeout(()=>{r.resolve(),t.updateMatch(n.id,e=>({...e,minPendingPromise:void 0}))},e)}throw t.getMatch(n.id)?.loadPromise}return s}),V=a.memo(function OutletImpl(){let e=useRouter(),t=a.useContext(L),n=useRouterState({select:e=>e.matches.find(e=>e.id===t)?.routeId}),r=e.routesById[n],i=useRouterState({select:e=>{let n=e.matches.find(e=>e.id===t);return invariant(n,`Could not find parent match for matchId "${t}"`),n.globalNotFound}}),o=useRouterState({select:e=>{let n=e.matches;return n[n.findIndex(e=>e.id===t)+1]?.id}});if(i)return renderRouteNotFound(e,r,void 0);if(!o)return null;let s=c(z,{matchId:o}),l=e.options.defaultPendingComponent?c(e.options.defaultPendingComponent,{}):null;return t===`__root__`?c(a.Suspense,{fallback:l,children:s}):s}),H=typeof window<`u`?a.useLayoutEffect:a.useEffect;function usePrevious(e){let t=a.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function useIntersectionObserver(e,t,n={},r={}){let i=a.useRef(typeof IntersectionObserver==`function`),o=a.useRef(null);return a.useEffect(()=>{if(!(!e.current||!i.current||r.disabled))return o.current=new IntersectionObserver(([e])=>{t(e)},n),o.current.observe(e.current),()=>{var e;(e=o.current)==null||e.disconnect()}},[t,n,r.disabled,e]),o.current}function useForwardedRef(e){let t=a.useRef(null);return a.useImperativeHandle(e,()=>t.current,[]),t}function Transitioner(){let e=useRouter(),t=a.useRef({router:e,mounted:!1}),n=useRouterState({select:({isLoading:e})=>e}),[r,i]=a.useState(!1),o=useRouterState({select:e=>e.matches.some(e=>e.status===`pending`),structuralSharing:!0}),s=usePrevious(n),c=n||r||o,l=usePrevious(c),u=n||o,d=usePrevious(u);return e.isServer||(e.startTransition=e=>{i(!0),a.startTransition(()=>{e(),i(!1)})}),a.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return trimPathRight(e.latestLocation.href)!==trimPathRight(n.href)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),H(()=>{if(typeof window<`u`&&e.clientSsr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0};let tryLoad=async()=>{try{await e.load()}catch(e){console.error(e)}};tryLoad()},[e]),H(()=>{s&&!n&&e.emit({type:`onLoad`,...getLocationChangeInfo(e.state)})},[s,e,n]),H(()=>{d&&!u&&e.emit({type:`onBeforeRouteMount`,...getLocationChangeInfo(e.state)})},[u,d,e]),H(()=>{l&&!c&&(e.emit({type:`onResolved`,...getLocationChangeInfo(e.state)}),e.__store.setState(e=>({...e,status:`idle`,resolvedLocation:e.location})))},[c,l,e]),null}function Matches(){let e=useRouter(),t=e.options.defaultPendingComponent?c(e.options.defaultPendingComponent,{}):null,n=l(e.isServer||typeof document<`u`&&e.clientSsr?SafeFragment:a.Suspense,{fallback:t,children:[c(Transitioner,{}),c(MatchesInner,{})]});return e.options.InnerWrap?c(e.options.InnerWrap,{children:n}):n}function MatchesInner(){let e=useRouterState({select:e=>e.matches[0]?.id}),t=useRouterState({select:e=>e.loadedAt});return c(L.Provider,{value:e,children:c(CatchBoundary,{getResetKey:()=>t,errorComponent:ErrorComponent,onCatch:e=>{warning(!1,`The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!`),warning(!1,e.message||e.toString())},children:e?c(z,{matchId:e}):null})})}function useMatches(e){return useRouterState({select:t=>{let n=t.matches;return e?.select?e.select(n):n},structuralSharing:e?.structuralSharing})}function useLinkProps(e,t){let n=useRouter(),[r,i]=a.useState(!1),o=a.useRef(!1),s=useForwardedRef(t),{activeProps=()=>({className:`active`}),inactiveProps=()=>({}),activeOptions:c,to:l,preload:d,preloadDelay:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:S,onClick:C,onFocus:w,onMouseEnter:T,onMouseLeave:E,onTouchStart:D,ignoreBlocker:O,...k}=e,{params:A,search:j,hash:M,state:N,mask:P,reloadDocument:F,...I}=k,L=a.useMemo(()=>{try{return new URL(`${l}`),`external`}catch{}return`internal`},[l]),R=useRouterState({select:e=>e.location.search,structuralSharing:!0}),z=useMatches({select:t=>e.from??t[t.length-1]?.fullPath}),B=a.useMemo(()=>({...e,from:z}),[e,z]),V=a.useMemo(()=>n.buildLocation(B),[n,B,R]),U=a.useMemo(()=>B.reloadDocument?!1:d??n.options.defaultPreload,[n.options.defaultPreload,d,B.reloadDocument]),W=f??n.options.defaultPreloadDelay??0,G=useRouterState({select:e=>{if(c?.exact){if(!exactPathTest(e.location.pathname,V.pathname,n.basepath))return!1}else{let t=removeTrailingSlash(e.location.pathname,n.basepath).split(`/`);if(!removeTrailingSlash(V.pathname,n.basepath).split(`/`).every((e,n)=>e===t[n]))return!1}return(c?.includeSearch??!0)&&!deepEqual(e.location.search,V.search,{partial:!c?.exact,ignoreUndefined:!c?.explicitUndefined})?!1:c?.includeHash?e.location.hash===V.hash:!0}}),K=a.useCallback(()=>{n.preloadRoute(B).catch(e=>{console.warn(e),console.warn(`Error preloading route! ☝️`)})},[B,n]);if(useIntersectionObserver(s,a.useCallback(e=>{e?.isIntersecting&&K()},[K]),{rootMargin:`100px`},{disabled:!!b||U!==`viewport`}),H(()=>{o.current||!b&&U===`render`&&(K(),o.current=!0)},[b,K,U]),L===`external`)return{...I,ref:s,type:L,href:l,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onFocus:w},...T&&{onMouseEnter:T},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};let handleClick=e=>{if(!b&&!isCtrlEvent(e)&&!e.defaultPrevented&&(!y||y===`_self`)&&e.button===0){e.preventDefault(),u(()=>{i(!0)});let t=n.subscribe(`onResolved`,()=>{t(),i(!1)});return n.navigate({...B,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:O})}},handleFocus=e=>{b||U&&K()},q=handleFocus,handleEnter=e=>{if(b)return;let t=e.target||{};if(U){if(t.preloadTimeout)return;t.preloadTimeout=setTimeout(()=>{t.preloadTimeout=null,K()},W)}},handleLeave=e=>{if(b)return;let t=e.target||{};t.preloadTimeout&&=(clearTimeout(t.preloadTimeout),null)},composeHandlers=e=>t=>{var n;(n=t.persist)==null||n.call(t),e.filter(Boolean).forEach(e=>{t.defaultPrevented||e(t)})},J=G?functionalUpdate(activeProps,{})??{}:{},Y=G?{}:functionalUpdate(inactiveProps,{}),X=[S,J.className,Y.className].filter(Boolean).join(` `),Z={...x,...J.style,...Y.style};return{...I,...J,...Y,href:b?void 0:V.maskedLocation?n.history.createHref(V.maskedLocation.href):n.history.createHref(V.href),ref:s,onClick:composeHandlers([C,handleClick]),onFocus:composeHandlers([w,handleFocus]),onMouseEnter:composeHandlers([T,handleEnter]),onMouseLeave:composeHandlers([E,handleLeave]),onTouchStart:composeHandlers([D,q]),disabled:!!b,target:y,...Object.keys(Z).length&&{style:Z},...X&&{className:X},...b&&{role:`link`,"aria-disabled":!0},...G&&{"data-status":`active`,"aria-current":`page`},...r&&{"data-transitioning":`transitioning`}}}const U=a.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,ref:o,...s}=useLinkProps(r,t),c=typeof r.children==`function`?r.children({isActive:s[`data-status`]===`active`}):r.children;return n===void 0&&delete s.disabled,a.createElement(n||`a`,{...s,ref:o},c)});function isCtrlEvent(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}const createRouter=e=>new Router(e);var Router=class extends RouterCore{constructor(e){super(e)}};function RouterContextProvider({router:e,children:t,...n}){e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=c(getRouterContext().Provider,{value:e,children:t});return e.options.Wrap?c(e.options.Wrap,{children:r}):r}function RouterProvider({router:e,...t}){return c(RouterContextProvider,{router:e,...t,children:c(Matches,{})})}export{isNotFound as _,V as a,Navigate as c,useParams as d,useRouter as f,redirect as g,A as h,useMatches as i,useNavigate as l,M as m,createRouter as n,createFileRoute as o,P as p,U as r,createRootRouteWithContext as s,RouterProvider as t,useSearch as u,notFound as v,deepEqual as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../../rolldown-runtime.mjs";import{y as e}from"./react-router.mjs";function stripSearchParams(t){return({search:n,next:r})=>{if(t===!0)return{};let i=r(n);return Array.isArray(t)?t.forEach(e=>{delete i[e]}):Object.entries(t).forEach(([t,n])=>{e(i[t],n)&&delete i[t]}),i}}export{stripSearchParams as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t,r as n,t as r}from"../../rolldown-runtime.mjs";import{h as i,m as a,p as o}from"../@tanstack/react-router.mjs";var s=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=i().useLayoutEffect})),c=r((e=>{e._default=s().default})),l=n({default:()=>u._default}),u,d=e((()=>{s(),u=c()})),f=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});function getGlobal(){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 getDevTools(){let e=getGlobal();if(e.__xstate__)return e.__xstate__}function registerService(e){if(typeof window>`u`)return;let t=getDevTools();t&&t.register(e)}let devToolsAdapter=e=>{if(typeof window>`u`)return;let t=getDevTools();t&&t.register(e)};e.devToolsAdapter=devToolsAdapter,e.getGlobal=getGlobal,e.registerService=registerService})),p=r((e=>{var t=f(),Mailbox=class{constructor(e){this._process=e,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(e){let t={value:e,next:null};if(this._current){this._last.next=t,this._last=t;return}this._current=t,this._last=t,this._active&&this.flush()}flush(){for(;this._current;){let e=this._current;this._process(e.value),this._current=e.next}this._last=null}};let n=`xstate.init`,r=`xstate.stop`;function createAfterEvent(e,t){return{type:`xstate.after.${e}.${t}`}}function createDoneStateEvent(e,t){return{type:`xstate.done.state.${e}`,output:t}}function createDoneActorEvent(e,t){return{type:`xstate.done.actor.${e}`,output:t,actorId:e}}function createErrorActorEvent(e,t){return{type:`xstate.error.actor.${e}`,error:t,actorId:e}}function createInitEvent(e){return{type:n,input:e}}function reportUnhandledError(e){setTimeout(()=>{throw e})}let i=typeof Symbol==`function`&&Symbol.observable||`@@observable`;function matchesState(e,t){let n=toStateValue(e),r=toStateValue(t);return typeof r==`string`?typeof n==`string`?r===n:!1:typeof n==`string`?n in r:Object.keys(n).every(e=>e in r?matchesState(n[e],r[e]):!1)}function toStatePath(e){if(isArray(e))return e;let t=[],n=``;for(let r=0;r<e.length;r++){switch(e.charCodeAt(r)){case 92:n+=e[r+1],r++;continue;case 46:t.push(n),n=``;continue}n+=e[r]}return t.push(n),t}function toStateValue(e){return isMachineSnapshot(e)?e.value:typeof e==`string`?pathToStateValue(toStatePath(e)):e}function pathToStateValue(e){if(e.length===1)return e[0];let t={},n=t;for(let t=0;t<e.length-1;t++)if(t===e.length-2)n[e[t]]=e[t+1];else{let r=n;n={},r[e[t]]=n}return t}function mapValues(e,t){let n={},r=Object.keys(e);for(let i=0;i<r.length;i++){let a=r[i];n[a]=t(e[a],a,e,i)}return n}function toArrayStrict(e){return isArray(e)?e:[e]}function toArray(e){return e===void 0?[]:toArrayStrict(e)}function resolveOutput(e,t,n,r){return typeof e==`function`?e({context:t,event:n,self:r}):e}function isArray(e){return Array.isArray(e)}function isErrorActorEvent(e){return e.type.startsWith(`xstate.error.actor`)}function toTransitionConfigArray(e){return toArrayStrict(e).map(e=>e===void 0||typeof e==`string`?{target:e}:e)}function normalizeTarget(e){if(!(e===void 0||e===``))return toArray(e)}function toObserver(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}function createInvokeId(e,t){return`${t}.${e}`}function resolveReferencedActor(e,t){let n=t.match(/^xstate\.invoke\.(\d+)\.(.*)/);if(!n)return e.implementations.actors[t];let[,r,i]=n,a=e.getStateNodeById(i).config.invoke;return(Array.isArray(a)?a[r]:a).src}function getAllOwnEventDescriptors(e){return[...new Set([...e._nodes.flatMap(e=>e.ownEvents)])]}function matchesEventDescriptor(e,t){if(t===e||t===`*`)return!0;if(!t.endsWith(`.*`))return!1;let n=t.split(`.`),r=e.split(`.`);for(let e=0;e<n.length;e++){let t=n[e],i=r[e];if(t===`*`)return e===n.length-1;if(t!==i)return!1}return!0}function createScheduledEventId(e,t){return`${e.sessionId}.${t}`}let a=0;function createSystem(e,t){let n=new Map,r=new Map,i=new WeakMap,o=new Set,s={},{clock:c,logger:l}=t,u={schedule:(e,t,n,r,i=Math.random().toString(36).slice(2))=>{let a={source:e,target:t,event:n,delay:r,id:i,startedAt:Date.now()},o=createScheduledEventId(e,i);d._snapshot._scheduledEvents[o]=a,s[o]=c.setTimeout(()=>{delete s[o],delete d._snapshot._scheduledEvents[o],d._relay(e,t,n)},r)},cancel:(e,t)=>{let n=createScheduledEventId(e,t),r=s[n];delete s[n],delete d._snapshot._scheduledEvents[n],r!==void 0&&c.clearTimeout(r)},cancelAll:e=>{for(let t in d._snapshot._scheduledEvents){let n=d._snapshot._scheduledEvents[t];n.source===e&&u.cancel(e,n.id)}}},sendInspectionEvent=t=>{if(!o.size)return;let n={...t,rootId:e.sessionId};o.forEach(e=>e.next?.(n))},d={_snapshot:{_scheduledEvents:(t?.snapshot&&t.snapshot.scheduler)??{}},_bookId:()=>`x:${a++}`,_register:(e,t)=>(n.set(e,t),e),_unregister:e=>{n.delete(e.sessionId);let t=i.get(e);t!==void 0&&(r.delete(t),i.delete(e))},get:e=>r.get(e),getAll:()=>Object.fromEntries(r.entries()),_set:(e,t)=>{let n=r.get(e);if(n&&n!==t)throw Error(`Actor with system ID '${e}' already exists.`);r.set(e,t),i.set(t,e)},inspect:e=>{let t=toObserver(e);return o.add(t),{unsubscribe(){o.delete(t)}}},_sendInspectionEvent:sendInspectionEvent,_relay:(e,t,n)=>{d._sendInspectionEvent({type:`@xstate.event`,sourceRef:e,actorRef:t,event:n}),t._send(n)},scheduler:u,getSnapshot:()=>({_scheduledEvents:{...d._snapshot._scheduledEvents}}),start:()=>{let e=d._snapshot._scheduledEvents;d._snapshot._scheduledEvents={};for(let t in e){let{source:n,target:r,event:i,delay:a,id:o}=e[t];u.schedule(n,r,i,a,o)}},_clock:c,_logger:l};return d}let o=!1,s=function(e){return e[e.NotStarted=0]=`NotStarted`,e[e.Running=1]=`Running`,e[e.Stopped=2]=`Stopped`,e}({}),c={clock:{setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e)},logger:console.log.bind(console),devTools:!1};var Actor=class{constructor(e,t){this.logic=e,this._snapshot=void 0,this.clock=void 0,this.options=void 0,this.id=void 0,this.mailbox=new Mailbox(this._process.bind(this)),this.observers=new Set,this.eventListeners=new Map,this.logger=void 0,this._processingStatus=s.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=[];let n={...c,...t},{clock:r,logger:i,parent:a,syncSnapshot:l,id:u,systemId:d,inspect:f}=n;this.system=a?a.system:createSystem(this,{clock:r,logger:i}),f&&!a&&this.system.inspect(toObserver(f)),this.sessionId=this.system._bookId(),this.id=u??this.sessionId,this.logger=t?.logger??this.system._logger,this.clock=t?.clock??this.system._clock,this._parent=a,this._syncSnapshot=l,this.options=n,this.src=n.src??e,this.ref=this,this._actorScope={self:this,id:this.id,sessionId:this.sessionId,logger:this.logger,defer:e=>{this._deferred.push(e)},system:this.system,stopChild:e=>{if(e._parent!==this)throw Error(`Cannot stop child actor ${e.id} of ${this.id} because it is not a child`);e._stop()},emit:e=>{let t=this.eventListeners.get(e.type),n=this.eventListeners.get(`*`);if(!t&&!n)return;let r=[...t?t.values():[],...n?n.values():[]];for(let t of r)try{t(e)}catch(e){reportUnhandledError(e)}},actionExecutor:e=>{let exec=()=>{if(this._actorScope.system._sendInspectionEvent({type:`@xstate.action`,actorRef:this,action:{type:e.type,params:e.params}}),!e.exec)return;let t=o;try{o=!0,e.exec(e.info,e.params)}finally{o=t}};this._processingStatus===s.Running?exec():this._deferred.push(exec)}},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(t?.snapshot??t?.state),d&&this._snapshot.status!==`active`&&this.system._unregister(this)}_initState(e){try{this._snapshot=e?this.logic.restoreSnapshot?this.logic.restoreSnapshot(e,this._actorScope):e:this.logic.getInitialSnapshot(this._actorScope,this.options?.input)}catch(e){this._snapshot={status:`error`,output:void 0,error:e}}}update(e,t){this._snapshot=e;let n;for(;n=this._deferred.shift();)try{n()}catch(t){this._deferred.length=0,this._snapshot={...e,status:`error`,error:t}}switch(this._snapshot.status){case`active`:for(let t of this.observers)try{t.next?.(e)}catch(e){reportUnhandledError(e)}break;case`done`:for(let t of this.observers)try{t.next?.(e)}catch(e){reportUnhandledError(e)}this._stopProcedure(),this._complete(),this._doneEvent=createDoneActorEvent(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:t,snapshot:e})}subscribe(e,t,n){let r=toObserver(e,t,n);if(this._processingStatus!==s.Stopped)this.observers.add(r);else switch(this._snapshot.status){case`done`:try{r.complete?.()}catch(e){reportUnhandledError(e)}break;case`error`:{let e=this._snapshot.error;if(!r.error)reportUnhandledError(e);else try{r.error(e)}catch(e){reportUnhandledError(e)}break}}return{unsubscribe:()=>{this.observers.delete(r)}}}on(e,t){let n=this.eventListeners.get(e);n||(n=new Set,this.eventListeners.set(e,n));let r=t.bind(void 0);return n.add(r),{unsubscribe:()=>{n.delete(r)}}}select(e,t=Object.is){return{subscribe:n=>{let r=toObserver(n),i=e(this.getSnapshot());return this.subscribe(n=>{let a=e(n);t(i,a)||(i=a,r.next?.(a))})},get:()=>e(this.getSnapshot())}}start(){if(this._processingStatus===s.Running)return this;this._syncSnapshot&&this.subscribe({next:e=>{e.status===`active`&&this.system._relay(this,this._parent,{type:`xstate.snapshot.${this.id}`,snapshot:e})},error:()=>{}}),this.system._register(this.sessionId,this),this.systemId&&this.system._set(this.systemId,this),this._processingStatus=s.Running;let e=createInitEvent(this.options.input);switch(this.system._sendInspectionEvent({type:`@xstate.event`,sourceRef:this._parent,actorRef:this,event:e}),this._snapshot.status){case`done`:return this.update(this._snapshot,e),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(e){return this._snapshot={...this._snapshot,status:`error`,error:e},this._error(e),this}return this.update(this._snapshot,e),this.options.devTools&&this.attachDevTools(),this.mailbox.start(),this}_process(e){let t,n;try{t=this.logic.transition(this._snapshot,e,this._actorScope)}catch(e){n={err:e}}if(n){let{err:e}=n;this._snapshot={...this._snapshot,status:`error`,error:e},this._error(e);return}this.update(t,e),e.type===r&&(this._stopProcedure(),this._complete())}_stop(){return this._processingStatus===s.Stopped?this:(this.mailbox.clear(),this._processingStatus===s.NotStarted?(this._processingStatus=s.Stopped,this):(this.mailbox.enqueue({type:r}),this))}stop(){if(this._parent)throw Error(`A non-root actor cannot be stopped directly.`);return this._stop()}_complete(){for(let e of this.observers)try{e.complete?.()}catch(e){reportUnhandledError(e)}this.observers.clear(),this.eventListeners.clear()}_reportError(e){if(!this.observers.size){this._parent||reportUnhandledError(e),this.eventListeners.clear();return}let t=!1;for(let n of this.observers){let r=n.error;t||=!r;try{r?.(e)}catch(e){reportUnhandledError(e)}}this.observers.clear(),this.eventListeners.clear(),t&&reportUnhandledError(e)}_error(e){this._stopProcedure(),this._reportError(e),this._parent&&this.system._relay(this,this._parent,createErrorActorEvent(this.id,e))}_stopProcedure(){return this._processingStatus===s.Running?(this.system.scheduler.cancelAll(this),this.mailbox.clear(),this.mailbox=new Mailbox(this._process.bind(this)),this._processingStatus=s.Stopped,this.system._unregister(this),this):this}_send(e){this._processingStatus!==s.Stopped&&this.mailbox.enqueue(e)}send(e){this.system._relay(void 0,this,e)}attachDevTools(){let{devTools:e}=this.options;e&&(typeof e==`function`?e:t.devToolsAdapter)(this)}toJSON(){return{xstate$$type:1,id:this.id}}getPersistedSnapshot(e){return this.logic.getPersistedSnapshot(this._snapshot,e)}[i](){return this}getSnapshot(){return this._snapshot}};function createActor(e,...[t]){return new Actor(e,t)}let l=createActor;function resolveCancel(e,t,n,r,{sendId:i}){return[t,{sendId:typeof i==`function`?i(n,r):i},void 0]}function executeCancel(e,t){e.defer(()=>{e.system.scheduler.cancel(e.self,t.sendId)})}function cancel(e){function cancel(e,t){}return cancel.type=`xstate.cancel`,cancel.sendId=e,cancel.resolve=resolveCancel,cancel.execute=executeCancel,cancel}function resolveSpawn(e,t,n,r,{id:i,systemId:a,src:o,input:s,syncSnapshot:c}){let l=typeof o==`string`?resolveReferencedActor(t.machine,o):o,u=typeof i==`function`?i(n):i,d,f;return l&&(f=typeof s==`function`?s({context:t.context,event:n.event,self:e.self}):s,d=createActor(l,{id:u,src:o,parent:e.self,syncSnapshot:c,systemId:a,input:f})),[cloneMachineSnapshot(t,{children:{...t.children,[u]:d}}),{id:i,systemId:a,actorRef:d,src:o,input:f},void 0]}function executeSpawn(e,{actorRef:t}){t&&e.defer(()=>{t._processingStatus!==s.Stopped&&t.start()})}function spawnChild(...[e,{id:t,systemId:n,input:r,syncSnapshot:i=!1}={}]){function spawnChild(e,t){}return spawnChild.type=`xstate.spawnChild`,spawnChild.id=t,spawnChild.systemId=n,spawnChild.src=e,spawnChild.input=r,spawnChild.syncSnapshot=i,spawnChild.resolve=resolveSpawn,spawnChild.execute=executeSpawn,spawnChild}function resolveStop(e,t,n,r,{actorRef:i}){let a=typeof i==`function`?i(n,r):i,o=typeof a==`string`?t.children[a]:a,s=t.children;return o&&(s={...s},delete s[o.id]),[cloneMachineSnapshot(t,{children:s}),o,void 0]}function unregisterRecursively(e,t){let n=t.getSnapshot();if(n&&`children`in n)for(let t of Object.values(n.children))unregisterRecursively(e,t);e.system._unregister(t)}function executeStop(e,t){if(t){if(unregisterRecursively(e,t),t._processingStatus!==s.Running){e.stopChild(t);return}e.defer(()=>{e.stopChild(t)})}}function stopChild(e){function stop(e,t){}return stop.type=`xstate.stopChild`,stop.actorRef=e,stop.resolve=resolveStop,stop.execute=executeStop,stop}let u=stopChild;function checkStateIn(e,t,{stateValue:n}){if(typeof n==`string`&&isStateId(n)){let t=e.machine.getStateNodeById(n);return e._nodes.some(e=>e===t)}return e.matches(n)}function stateIn(e){function stateIn(){return!1}return stateIn.check=checkStateIn,stateIn.stateValue=e,stateIn}function checkNot(e,{context:t,event:n},{guards:r}){return!evaluateGuard(r[0],t,n,e)}function not(e){function not(e,t){return!1}return not.check=checkNot,not.guards=[e],not}function checkAnd(e,{context:t,event:n},{guards:r}){return r.every(r=>evaluateGuard(r,t,n,e))}function and(e){function and(e,t){return!1}return and.check=checkAnd,and.guards=e,and}function checkOr(e,{context:t,event:n},{guards:r}){return r.some(r=>evaluateGuard(r,t,n,e))}function or(e){function or(e,t){return!1}return or.check=checkOr,or.guards=e,or}function evaluateGuard(e,t,n,r){let{machine:i}=r,a=typeof e==`function`,o=a?e:i.implementations.guards[typeof e==`string`?e:e.type];if(!a&&!o)throw Error(`Guard '${typeof e==`string`?e:e.type}' is not implemented.'.`);if(typeof o!=`function`)return evaluateGuard(o,t,n,r);let s={context:t,event:n},c=a||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 o?o.check(r,s,o):o(s,c)}function isAtomicStateNode(e){return e.type===`atomic`||e.type===`final`}function getChildren(e){return Object.values(e.states).filter(e=>e.type!==`history`)}function getProperAncestors(e,t){let n=[];if(t===e)return n;let r=e.parent;for(;r&&r!==t;)n.push(r),r=r.parent;return n}function getAllStateNodes(e){let t=new Set(e),n=getAdjList(t);for(let e of t)if(e.type===`compound`&&(!n.get(e)||!n.get(e).length))getInitialStateNodesWithTheirAncestors(e).forEach(e=>t.add(e));else if(e.type===`parallel`){for(let n of getChildren(e))if(n.type!==`history`&&!t.has(n)){let e=getInitialStateNodesWithTheirAncestors(n);for(let n of e)t.add(n)}}for(let e of t){let n=e.parent;for(;n;)t.add(n),n=n.parent}return t}function getValueFromAdj(e,t){let n=t.get(e);if(!n)return{};if(e.type===`compound`){let e=n[0];if(e){if(isAtomicStateNode(e))return e.key}else return{}}let r={};for(let e of n)r[e.key]=getValueFromAdj(e,t);return r}function getAdjList(e){let t=new Map;for(let 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 getStateValue(e,t){return getValueFromAdj(e,getAdjList(getAllStateNodes(t)))}function isInFinalState(e,t){return t.type===`compound`?getChildren(t).some(t=>t.type===`final`&&e.has(t)):t.type===`parallel`?getChildren(t).every(t=>isInFinalState(e,t)):t.type===`final`}let isStateId=e=>e[0]===`#`;function getCandidates(e,t){return e.transitions.get(t)||[...e.transitions.keys()].filter(e=>matchesEventDescriptor(t,e)).sort((e,t)=>t.length-e.length).flatMap(t=>e.transitions.get(t))}function getDelayedTransitions(e){let t=e.config.after;if(!t)return[];let mutateEntryExit=t=>{let n=createAfterEvent(t,e.id),r=n.type;return e.entry.push(raise(n,{id:r,delay:t})),e.exit.push(cancel(r)),r};return Object.keys(t).flatMap(e=>{let n=t[e],r=typeof n==`string`?{target:n}:n,i=Number.isNaN(+e)?e:+e,a=mutateEntryExit(i);return toArray(r).map(e=>({...e,event:a,delay:i}))}).map(t=>{let{delay:n}=t;return{...formatTransition(e,t.event,t),delay:n}})}function formatTransition(e,t,n){let r=normalizeTarget(n.target),i=n.reenter??!1,a=resolveTarget(e,r),o={...n,actions:toArray(n.actions),guard:n.guard,target:a,source:e,reenter:i,eventType:t,toJSON:()=>({...o,source:`#${e.id}`,target:a?a.map(e=>`#${e.id}`):void 0})};return o}function formatTransitions(e){let t=new Map;if(e.config.on)for(let n of Object.keys(e.config.on)){if(n===``)throw Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');let r=e.config.on[n];t.set(n,toTransitionConfigArray(r).map(t=>formatTransition(e,n,t)))}if(e.config.onDone){let n=`xstate.done.state.${e.id}`;t.set(n,toTransitionConfigArray(e.config.onDone).map(t=>formatTransition(e,n,t)))}for(let n of e.invoke){if(n.onDone){let r=`xstate.done.actor.${n.id}`;t.set(r,toTransitionConfigArray(n.onDone).map(t=>formatTransition(e,r,t)))}if(n.onError){let r=`xstate.error.actor.${n.id}`;t.set(r,toTransitionConfigArray(n.onError).map(t=>formatTransition(e,r,t)))}if(n.onSnapshot){let r=`xstate.snapshot.${n.id}`;t.set(r,toTransitionConfigArray(n.onSnapshot).map(t=>formatTransition(e,r,t)))}}for(let n of e.after){let e=t.get(n.eventType);e||(e=[],t.set(n.eventType,e)),e.push(n)}return t}function formatRouteTransitions(e){let t=[],collectRoutes=n=>{Object.values(n).forEach(n=>{if(n.config.route&&n.config.id){let r=n.config.id,i=n.config.route.guard,routeGuard=(e,t)=>e.event.to===`#${r}`?i&&typeof i==`function`?i(e,t):!0:!1,a={...n.config.route,guard:routeGuard,target:`#${r}`};t.push(formatTransition(e,`xstate.route`,a))}n.states&&collectRoutes(n.states)})};collectRoutes(e.states),t.length>0&&e.transitions.set(`xstate.route`,t)}function formatInitialTransition(e,t){let n=typeof t==`string`?e.states[t]:t?e.states[t.target]:void 0;if(!n&&t)throw Error(`Initial state node "${t}" not found on parent state node #${e.id}`);let r={source:e,actions:!t||typeof t==`string`?[]:toArray(t.actions),eventType:null,reenter:!1,target:n?[n]:[],toJSON:()=>({...r,source:`#${e.id}`,target:n?[`#${n.id}`]:[]})};return r}function resolveTarget(e,t){if(t!==void 0)return t.map(t=>{if(typeof t!=`string`)return t;if(isStateId(t))return e.machine.getStateNodeById(t);let n=t[0]===`.`;if(n&&!e.parent)return getStateNodeByPath(e,t.slice(1));let r=n?e.key+t:t;if(e.parent)try{return getStateNodeByPath(e.parent,r)}catch(t){throw Error(`Invalid transition definition for state node '${e.id}':\n${t.message}`)}else throw Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`)})}function resolveHistoryDefaultTransition(e){let t=normalizeTarget(e.config.target);return t?{target:t.map(t=>typeof t==`string`?getStateNodeByPath(e.parent,t):t)}:e.parent.initial}function isHistoryNode(e){return e.type===`history`}function getInitialStateNodesWithTheirAncestors(e){let t=getInitialStateNodes(e);for(let n of t)for(let r of getProperAncestors(n,e))t.add(r);return t}function getInitialStateNodes(e){let t=new Set;function iter(e){if(!t.has(e)){if(t.add(e),e.type===`compound`)iter(e.initial.target[0]);else if(e.type===`parallel`)for(let t of getChildren(e))iter(t)}}return iter(e),t}function getStateNode(e,t){if(isStateId(t))return e.machine.getStateNodeById(t);if(!e.states)throw Error(`Unable to retrieve child state '${t}' from '${e.id}'; no child states exist.`);let n=e.states[t];if(!n)throw Error(`Child state '${t}' does not exist on '${e.id}'`);return n}function getStateNodeByPath(e,t){if(typeof t==`string`&&isStateId(t))try{return e.machine.getStateNodeById(t)}catch{}let n=toStatePath(t).slice(),r=e;for(;n.length;){let e=n.shift();if(!e.length)break;r=getStateNode(r,e)}return r}function getStateNodes(e,t){if(typeof t==`string`){let n=e.states[t];if(!n)throw Error(`State '${t}' does not exist on '${e.id}'`);return[e,n]}let n=Object.keys(t),r=n.map(t=>getStateNode(e,t)).filter(Boolean);return[e.machine.root,e].concat(r,n.reduce((n,r)=>{let i=getStateNode(e,r);if(!i)return n;let a=getStateNodes(i,t[r]);return n.concat(a)},[]))}function transitionAtomicNode(e,t,n,r){let i=getStateNode(e,t).next(n,r);return!i||!i.length?e.next(n,r):i}function transitionCompoundNode(e,t,n,r){let i=Object.keys(t),a=transitionNode(getStateNode(e,i[0]),t[i[0]],n,r);return!a||!a.length?e.next(n,r):a}function transitionParallelNode(e,t,n,r){let i=[];for(let a of Object.keys(t)){let o=t[a];if(!o)continue;let s=transitionNode(getStateNode(e,a),o,n,r);s&&i.push(...s)}return i.length?i:e.next(n,r)}function transitionNode(e,t,n,r){return typeof t==`string`?transitionAtomicNode(e,t,n,r):Object.keys(t).length===1?transitionCompoundNode(e,t,n,r):transitionParallelNode(e,t,n,r)}function getHistoryNodes(e){return Object.keys(e.states).map(t=>e.states[t]).filter(e=>e.type===`history`)}function isDescendant(e,t){let n=e;for(;n.parent&&n.parent!==t;)n=n.parent;return n.parent===t}function hasIntersection(e,t){let n=new Set(e),r=new Set(t);for(let e of n)if(r.has(e))return!0;for(let e of r)if(n.has(e))return!0;return!1}function removeConflictingTransitions(e,t,n){let r=new Set;for(let i of e){let e=!1,a=new Set;for(let o of r)if(hasIntersection(computeExitSet([i],t,n),computeExitSet([o],t,n)))if(isDescendant(i.source,o.source))a.add(o);else{e=!0;break}if(!e){for(let e of a)r.delete(e);r.add(i)}}return Array.from(r)}function findLeastCommonAncestor(e){let[t,...n]=e;for(let e of getProperAncestors(t,void 0))if(n.every(t=>isDescendant(t,e)))return e}function getEffectiveTargetStates(e,t){if(!e.target)return[];let n=new Set;for(let r of e.target)if(isHistoryNode(r))if(t[r.id])for(let e of t[r.id])n.add(e);else for(let e of getEffectiveTargetStates(resolveHistoryDefaultTransition(r),t))n.add(e);else n.add(r);return[...n]}function getTransitionDomain(e,t){let n=getEffectiveTargetStates(e,t);if(!n)return;if(!e.reenter&&n.every(t=>t===e.source||isDescendant(t,e.source)))return e.source;let r=findLeastCommonAncestor(n.concat(e.source));if(r)return r;if(!e.reenter)return e.source.machine.root}function computeExitSet(e,t,n){let r=new Set;for(let i of e)if(i.target?.length){let e=getTransitionDomain(i,n);i.reenter&&i.source===e&&r.add(e);for(let n of t)isDescendant(n,e)&&r.add(n)}return[...r]}function areStateNodeCollectionsEqual(e,t){if(e.length!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function initialMicrostep(e,t,n,r,i){return microstep([{target:[...getInitialStateNodes(e)],source:e,reenter:!0,actions:[],eventType:null,toJSON:null}],t,n,r,!0,i)}function microstep(e,t,n,r,i,a){let o=[];if(!e.length)return[t,o];let s=n.actionExecutor;n.actionExecutor=e=>{o.push(e),s(e)};try{let s=new Set(t._nodes),c=t.historyValue,l=removeConflictingTransitions(e,s,c),u=t;i||([u,c]=exitStates(u,r,n,l,s,c,a,n.actionExecutor)),u=resolveActionsAndContext(u,r,n,l.flatMap(e=>e.actions),a,void 0),u=enterStates(u,r,n,l,s,a,c,i);let d=[...s];u.status===`done`&&(u=resolveActionsAndContext(u,r,n,d.sort((e,t)=>t.order-e.order).flatMap(e=>e.exit),a,void 0));try{return c===t.historyValue&&areStateNodeCollectionsEqual(t._nodes,s)?[u,o]:[cloneMachineSnapshot(u,{_nodes:d,historyValue:c}),o]}catch(e){throw e}}finally{n.actionExecutor=s}}function getMachineOutput(e,t,n,r,i){if(r.output===void 0)return;let a=createDoneStateEvent(i.id,i.output!==void 0&&i.parent?resolveOutput(i.output,e.context,t,n.self):void 0);return resolveOutput(r.output,e.context,a,n.self)}function enterStates(e,t,n,r,i,a,o,s){let c=e,l=new Set,u=new Set;computeEntrySet(r,o,u,l),s&&u.add(e.machine.root);let d=new Set;for(let e of[...l].sort((e,t)=>e.order-t.order)){i.add(e);let r=[];r.push(...e.entry);for(let t of e.invoke)r.push(spawnChild(t.src,{...t,syncSnapshot:!!t.onSnapshot}));if(u.has(e)){let t=e.initial.actions;r.push(...t)}if(c=resolveActionsAndContext(c,t,n,r,a,e.invoke.map(e=>e.id)),e.type===`final`){let r=e.parent,o=r?.type===`parallel`?r:r?.parent,s=o||e;for(r?.type===`compound`&&a.push(createDoneStateEvent(r.id,e.output===void 0?void 0:resolveOutput(e.output,c.context,t,n.self)));o?.type===`parallel`&&!d.has(o)&&isInFinalState(i,o);)d.add(o),a.push(createDoneStateEvent(o.id)),s=o,o=o.parent;if(o)continue;c=cloneMachineSnapshot(c,{status:`done`,output:getMachineOutput(c,t,n,c.machine.root,s)})}}return c}function computeEntrySet(e,t,n,r){for(let i of e){let e=getTransitionDomain(i,t);for(let a of i.target||[])!isHistoryNode(a)&&(i.source!==a||i.source!==e||i.reenter)&&(r.add(a),n.add(a)),addDescendantStatesToEnter(a,t,n,r);let a=getEffectiveTargetStates(i,t);for(let o of a){let a=getProperAncestors(o,e);e?.type===`parallel`&&a.push(e),addAncestorStatesToEnter(r,t,n,a,!i.source.parent&&i.reenter?void 0:e)}}}function addDescendantStatesToEnter(e,t,n,r){if(isHistoryNode(e))if(t[e.id]){let i=t[e.id];for(let e of i)r.add(e),addDescendantStatesToEnter(e,t,n,r);for(let a of i)addProperAncestorStatesToEnter(a,e.parent,r,t,n)}else{let i=resolveHistoryDefaultTransition(e);for(let a of i.target)r.add(a),i===e.parent?.initial&&n.add(e.parent),addDescendantStatesToEnter(a,t,n,r);for(let a of i.target)addProperAncestorStatesToEnter(a,e.parent,r,t,n)}else if(e.type===`compound`){let[i]=e.initial.target;isHistoryNode(i)||(r.add(i),n.add(i)),addDescendantStatesToEnter(i,t,n,r),addProperAncestorStatesToEnter(i,e,r,t,n)}else if(e.type===`parallel`)for(let i of getChildren(e).filter(e=>!isHistoryNode(e)))[...r].some(e=>isDescendant(e,i))||(isHistoryNode(i)||(r.add(i),n.add(i)),addDescendantStatesToEnter(i,t,n,r))}function addAncestorStatesToEnter(e,t,n,r,i){for(let a of r)if((!i||isDescendant(a,i))&&e.add(a),a.type===`parallel`)for(let r of getChildren(a).filter(e=>!isHistoryNode(e)))[...e].some(e=>isDescendant(e,r))||(e.add(r),addDescendantStatesToEnter(r,t,n,e))}function addProperAncestorStatesToEnter(e,t,n,r,i){addAncestorStatesToEnter(n,r,i,getProperAncestors(e,t))}function exitStates(e,t,n,r,i,a,o,s){let c=e,l=computeExitSet(r,i,a);l.sort((e,t)=>t.order-e.order);let u;for(let e of l)for(let t of getHistoryNodes(e)){let n;n=t.history===`deep`?t=>isAtomicStateNode(t)&&isDescendant(t,e):t=>t.parent===e,u??={...a},u[t.id]=Array.from(i).filter(n)}for(let e of l)c=resolveActionsAndContext(c,t,n,[...e.exit,...e.invoke.map(e=>stopChild(e.id))],o,void 0),i.delete(e);return[c,u||a]}function getAction(e,t){return e.implementations.actions[t]}function resolveAndExecuteActionsWithContext(e,t,n,r,i,a){let{machine:o}=e,s=e;for(let e of r){let r=typeof e==`function`,c=r?e:getAction(o,typeof e==`string`?e:e.type),l={context:s.context,event:t,self:n.self,system:n.system},u=r||typeof e==`string`?void 0:`params`in e?typeof e.params==`function`?e.params({context:s.context,event:t}):e.params:void 0;if(!c||!(`resolve`in c)){n.actionExecutor({type:typeof e==`string`?e:typeof e==`object`?e.type:e.name||`(anonymous)`,info:l,params:u,exec:c});continue}let d=c,[f,p,m]=d.resolve(n,s,l,u,c,i);s=f,`retryResolve`in d&&a?.push([d,p]),`execute`in d&&n.actionExecutor({type:d.type,info:l,params:p,exec:d.execute.bind(null,n,p)}),m&&(s=resolveAndExecuteActionsWithContext(s,t,n,m,i,a))}return s}function resolveActionsAndContext(e,t,n,r,i,a){let o=a?[]:void 0,s=resolveAndExecuteActionsWithContext(e,t,n,r,{internalQueue:i,deferredActorIds:a},o);return o?.forEach(([e,t])=>{e.retryResolve(n,s,t)}),s}function macrostep(e,t,i,a){let o=e,s=[];function addMicrostep(e,t,n){i.system._sendInspectionEvent({type:`@xstate.microstep`,actorRef:i.self,event:t,snapshot:e[0],_transitions:n}),s.push(e)}if(t.type===r)return o=cloneMachineSnapshot(stopChildren(o,t,i),{status:`stopped`}),addMicrostep([o,[]],t,[]),{snapshot:o,microsteps:s};let c=t;if(c.type!==n){let t=c,n=isErrorActorEvent(t),r=selectTransitions(t,o);if(n&&!r.length)return o=cloneMachineSnapshot(e,{status:`error`,error:t.error}),addMicrostep([o,[]],t,[]),{snapshot:o,microsteps:s};let l=microstep(r,e,i,c,!1,a);o=l[0],addMicrostep(l,t,r)}let l=!0;for(;o.status===`active`;){let e=l?selectEventlessTransitions(o,c):[],t=e.length?o:void 0;if(!e.length){if(!a.length)break;c=a.shift(),e=selectTransitions(c,o)}let n=microstep(e,o,i,c,!1,a);o=n[0],l=o!==t,addMicrostep(n,c,e)}return o.status!==`active`&&stopChildren(o,c,i),{snapshot:o,microsteps:s}}function stopChildren(e,t,n){return resolveActionsAndContext(e,t,n,Object.values(e.children).map(e=>stopChild(e)),[],void 0)}function selectTransitions(e,t){return t.machine.getTransitionData(t,e)}function selectEventlessTransitions(e,t){let n=new Set,r=e._nodes.filter(isAtomicStateNode);for(let i of r)loop:for(let r of[i].concat(getProperAncestors(i,void 0)))if(r.always){for(let i of r.always)if(i.guard===void 0||evaluateGuard(i.guard,e.context,t,e)){n.add(i);break loop}}return removeConflictingTransitions(Array.from(n),new Set(e._nodes),e.historyValue)}function resolveStateValue(e,t){return getStateValue(e,[...getAllStateNodes(getStateNodes(e,t))])}function isMachineSnapshot(e){return!!e&&typeof e==`object`&&`machine`in e&&`value`in e}let d=function matches(e){return matchesState(e,this.value)},p=function hasTag(e){return this.tags.has(e)},m=function can(e){let t=this.machine.getTransitionData(this,e);return!!t?.length&&t.some(e=>e.target!==void 0||e.actions.length)},h=function toJSON(){let{_nodes:e,tags:t,machine:n,getMeta:r,toJSON:i,can:a,hasTag:o,matches:s,...c}=this;return{...c,tags:Array.from(t)}},g=function getMeta(){return this._nodes.reduce((e,t)=>(t.meta!==void 0&&(e[t.id]=t.meta),e),{})};function createMachineSnapshot(e,t){return{status:e.status,output:e.output,error:e.error,machine:t,context:e.context,_nodes:e._nodes,value:getStateValue(t.root,e._nodes),tags:new Set(e._nodes.flatMap(e=>e.tags)),children:e.children,historyValue:e.historyValue||{},matches:d,hasTag:p,can:m,getMeta:g,toJSON:h}}function cloneMachineSnapshot(e,t={}){return createMachineSnapshot({...e,...t},e.machine)}function serializeHistoryValue(e){if(typeof e!=`object`||!e)return{};let t={};for(let n in e){let r=e[n];Array.isArray(r)&&(t[n]=r.map(e=>({id:e.id})))}return t}function getPersistedSnapshot(e,t){let{_nodes:n,tags:r,machine:i,children:a,context:o,can:s,hasTag:c,matches:l,getMeta:u,toJSON:d,...f}=e,p={};for(let e in a){let n=a[e];p[e]={snapshot:n.getPersistedSnapshot(t),src:n.src,systemId:n.systemId,syncSnapshot:n._syncSnapshot}}return{...f,context:persistContext(o),children:p,historyValue:serializeHistoryValue(f.historyValue)}}function persistContext(e){let t;for(let n in e){let r=e[n];if(r&&typeof r==`object`)if(`sessionId`in r&&`send`in r&&`ref`in r)t??=Array.isArray(e)?e.slice():{...e},t[n]={xstate$$type:1,id:r.id};else{let i=persistContext(r);i!==r&&(t??=Array.isArray(e)?e.slice():{...e},t[n]=i)}}return t??e}function resolveRaise(e,t,n,r,{event:i,id:a,delay:o},{internalQueue:s}){let c=t.machine.implementations.delays;if(typeof i==`string`)throw Error(`Only event objects may be used with raise; use raise({ type: "${i}" }) instead`);let l=typeof i==`function`?i(n,r):i,u;if(typeof o==`string`){let e=c&&c[o];u=typeof e==`function`?e(n,r):e}else u=typeof o==`function`?o(n,r):o;return typeof u!=`number`&&s.push(l),[t,{event:l,id:a,delay:u},void 0]}function executeRaise(e,t){let{event:n,delay:r,id:i}=t;if(typeof r==`number`){e.defer(()=>{let t=e.self;e.system.scheduler.schedule(t,t,n,r,i)});return}}function raise(e,t){function raise(e,t){}return raise.type=`xstate.raise`,raise.event=e,raise.id=t?.id,raise.delay=t?.delay,raise.resolve=resolveRaise,raise.execute=executeRaise,raise}e.$$ACTOR_TYPE=1,e.Actor=Actor,e.NULL_EVENT=``,e.ProcessingStatus=s,e.STATE_DELIMITER=`.`,e.XSTATE_ERROR=`xstate.error`,e.XSTATE_STOP=r,e.and=and,e.cancel=cancel,e.cloneMachineSnapshot=cloneMachineSnapshot,e.createActor=createActor,e.createErrorActorEvent=createErrorActorEvent,e.createInitEvent=createInitEvent,e.createInvokeId=createInvokeId,e.createMachineSnapshot=createMachineSnapshot,e.evaluateGuard=evaluateGuard,e.formatInitialTransition=formatInitialTransition,e.formatRouteTransitions=formatRouteTransitions,e.formatTransition=formatTransition,e.formatTransitions=formatTransitions,e.getAllOwnEventDescriptors=getAllOwnEventDescriptors,e.getAllStateNodes=getAllStateNodes,e.getCandidates=getCandidates,e.getDelayedTransitions=getDelayedTransitions,e.getPersistedSnapshot=getPersistedSnapshot,e.getProperAncestors=getProperAncestors,e.getStateNodeByPath=getStateNodeByPath,e.getStateNodes=getStateNodes,e.initialMicrostep=initialMicrostep,e.interpret=l,e.isAtomicStateNode=isAtomicStateNode,e.isInFinalState=isInFinalState,e.isMachineSnapshot=isMachineSnapshot,e.isStateId=isStateId,e.macrostep=macrostep,e.mapValues=mapValues,e.matchesEventDescriptor=matchesEventDescriptor,e.matchesState=matchesState,e.not=not,e.or=or,e.pathToStateValue=pathToStateValue,e.raise=raise,e.resolveActionsAndContext=resolveActionsAndContext,e.resolveReferencedActor=resolveReferencedActor,e.resolveStateValue=resolveStateValue,e.spawnChild=spawnChild,e.stateIn=stateIn,e.stop=u,e.stopChild=stopChild,e.toArray=toArray,e.toObserver=toObserver,e.toStatePath=toStatePath,e.toTransitionConfigArray=toTransitionConfigArray,e.transitionNode=transitionNode})),m=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=p();f();function fromTransition(e,t){return{config:e,transition:(t,n,r)=>({...t,context:e(t.context,n,r)}),getInitialSnapshot:(e,n)=>({status:`active`,output:void 0,error:void 0,context:typeof t==`function`?t({input:n}):t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}let n=new WeakMap;function fromCallback(e){return{config:e,start:(t,r)=>{let{self:i,system:a,emit:o}=r,s={receivers:void 0,dispose:void 0};n.set(i,s),s.dispose=e({input:t.input,system:a,self:i,sendBack:e=>{i.getSnapshot().status!==`stopped`&&i._parent&&a._relay(i,i._parent,e)},receive:e=>{s.receivers??=new Set,s.receivers.add(e)},emit:o})},transition:(e,r,i)=>{let a=n.get(i.self);return r.type===t.XSTATE_STOP?(e={...e,status:`stopped`,error:void 0},n.delete(i.self),a.receivers?.clear(),a.dispose?.(),e):(a.receivers?.forEach(e=>e(r)),e)},getInitialSnapshot:(e,t)=>({status:`active`,output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}let r=`xstate.observable.next`,i=`xstate.observable.error`,a=`xstate.observable.complete`;function fromObservable(e){return{config:e,transition:(e,n)=>{if(e.status!==`active`)return e;switch(n.type){case r:return{...e,context:n.data};case i:return{...e,status:`error`,error:n.data,input:void 0,_subscription:void 0};case a:return{...e,status:`done`,input:void 0,_subscription:void 0};case t.XSTATE_STOP:return e._subscription.unsubscribe(),{...e,status:`stopped`,input:void 0,_subscription:void 0};default:return e}},getInitialSnapshot:(e,t)=>({status:`active`,output:void 0,error:void 0,context:void 0,input:t,_subscription:void 0}),start:(t,{self:n,system:o,emit:s})=>{t.status!==`done`&&(t._subscription=e({input:t.input,system:o,self:n,emit:s}).subscribe({next:e=>{o._relay(n,n,{type:r,data:e})},error:e=>{o._relay(n,n,{type:i,data:e})},complete:()=>{o._relay(n,n,{type:a})}}))},getPersistedSnapshot:({_subscription:e,...t})=>t,restoreSnapshot:e=>({...e,_subscription:void 0})}}function fromEventObservable(e){return{config:e,transition:(e,n)=>{if(e.status!==`active`)return e;switch(n.type){case i:return{...e,status:`error`,error:n.data,input:void 0,_subscription:void 0};case a:return{...e,status:`done`,input:void 0,_subscription:void 0};case t.XSTATE_STOP:return e._subscription.unsubscribe(),{...e,status:`stopped`,input:void 0,_subscription:void 0};default:return e}},getInitialSnapshot:(e,t)=>({status:`active`,output:void 0,error:void 0,context:void 0,input:t,_subscription:void 0}),start:(t,{self:n,system:r,emit:o})=>{t.status!==`done`&&(t._subscription=e({input:t.input,system:r,self:n,emit:o}).subscribe({next:e=>{n._parent&&r._relay(n,n._parent,e)},error:e=>{r._relay(n,n,{type:i,data:e})},complete:()=>{r._relay(n,n,{type:a})}}))},getPersistedSnapshot:({_subscription:e,...t})=>t,restoreSnapshot:e=>({...e,_subscription:void 0})}}let o=`xstate.promise.resolve`,s=`xstate.promise.reject`,c=new WeakMap;function fromPromise(e){return{config:e,transition:(e,n,r)=>{if(e.status!==`active`)return e;switch(n.type){case o:{let t=n.data;return{...e,status:`done`,output:t,input:void 0}}case s:return{...e,status:`error`,error:n.data,input:void 0};case t.XSTATE_STOP:return c.get(r.self)?.abort(),c.delete(r.self),{...e,status:`stopped`,input:void 0};default:return e}},start:(t,{self:n,system:r,emit:i})=>{if(t.status!==`active`)return;let a=new AbortController;c.set(n,a),Promise.resolve(e({input:t.input,system:r,self:n,signal:a.signal,emit:i})).then(e=>{n.getSnapshot().status===`active`&&(c.delete(n),r._relay(n,n,{type:o,data:e}))},e=>{n.getSnapshot().status===`active`&&(c.delete(n),r._relay(n,n,{type:s,data:e}))})},getInitialSnapshot:(e,t)=>({status:`active`,output:void 0,error:void 0,input:t}),getPersistedSnapshot:e=>e,restoreSnapshot:e=>e}}let l=fromTransition(e=>void 0,void 0);function createEmptyActor(){return t.createActor(l)}e.createEmptyActor=createEmptyActor,e.fromCallback=fromCallback,e.fromEventObservable=fromEventObservable,e.fromObservable=fromObservable,e.fromPromise=fromPromise,e.fromTransition=fromTransition})),h=r((e=>{var t=p();function createSpawner(e,{machine:n,context:r},i,a){let spawn=(o,s)=>{if(typeof o==`string`){let c=t.resolveReferencedActor(n,o);if(!c)throw Error(`Actor logic '${o}' not implemented in machine '${n.id}'`);let l=t.createActor(c,{id:s?.id,parent:e.self,syncSnapshot:s?.syncSnapshot,input:typeof s?.input==`function`?s.input({context:r,event:i,self:e.self}):s?.input,src:o,systemId:s?.systemId});return a[l.id]=l,l}else return t.createActor(o,{id:s?.id,parent:e.self,syncSnapshot:s?.syncSnapshot,input:s?.input,src:o,systemId:s?.systemId})};return(n,r)=>{let i=spawn(n,r);return a[i.id]=i,e.defer(()=>{i._processingStatus!==t.ProcessingStatus.Stopped&&i.start()}),i}}function resolveAssign(e,n,r,i,{assignment:a}){if(!n.context)throw Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");let o={},s={context:n.context,event:r.event,spawn:createSpawner(e,n,r.event,o),self:e.self,system:e.system},c={};if(typeof a==`function`)c=a(s,i);else for(let e of Object.keys(a)){let t=a[e];c[e]=typeof t==`function`?t(s,i):t}let l=Object.assign({},n.context,c);return[t.cloneMachineSnapshot(n,{context:l,children:Object.keys(o).length?{...n.children,...o}:n.children}),void 0,void 0]}function assign(e){function assign(e,t){}return assign.type=`xstate.assign`,assign.assignment=e,assign.resolve=resolveAssign,assign}e.assign=assign})),g=r((e=>{var t=p(),n=h();let r=new WeakMap;function memo(e,t,n){let i=r.get(e);return i?t in i||(i[t]=n()):(i={[t]:n()},r.set(e,i)),i[t]}let i={},toSerializableAction=e=>typeof e==`string`?{type:e}:typeof e==`function`?`resolve`in e?{type:e.type}:{type:e.name}:e;var a=class StateNode{constructor(e,n){if(this.config=e,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(t.STATE_DELIMITER),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?t.mapValues(this.config.states,(e,t)=>new StateNode(e,{_parent:this,_key:t,_machine:this.machine})):i,this.type===`compound`&&!this.config.initial)throw 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=t.toArray(this.config.entry).slice(),this.exit=t.toArray(this.config.exit).slice(),this.meta=this.config.meta,this.output=this.type===`final`||!this.parent?this.config.output:void 0,this.tags=t.toArray(e.tags).slice()}_initialize(){this.transitions=t.formatTransitions(this),this.config.always&&(this.always=t.toTransitionConfigArray(this.config.always).map(e=>t.formatTransition(this,t.NULL_EVENT,e))),Object.keys(this.states).forEach(e=>{this.states[e]._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(toSerializableAction),eventType:null,reenter:!1,toJSON:()=>({target:this.initial.target.map(e=>`#${e.id}`),source:`#${this.id}`,actions:this.initial.actions.map(toSerializableAction),eventType:null})}:void 0,history:this.history,states:t.mapValues(this.states,e=>e.definition),on:this.on,transitions:[...this.transitions.values()].flat().map(e=>({...e,actions:e.actions.map(toSerializableAction)})),entry:this.entry.map(toSerializableAction),exit:this.exit.map(toSerializableAction),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 memo(this,`invoke`,()=>t.toArray(this.config.invoke).map((e,n)=>{let{src:r,systemId:i}=e,a=e.id??t.createInvokeId(this.id,n),o=typeof r==`string`?r:`xstate.invoke.${t.createInvokeId(this.id,n)}`;return{...e,src:o,id:a,systemId:i,toJSON(){let{onDone:t,onError:n,...r}=e;return{...r,type:`xstate.invoke`,src:o,id:a}}}}))}get on(){return memo(this,`on`,()=>[...this.transitions].flatMap(([e,t])=>t.map(t=>[e,t])).reduce((e,[t,n])=>(e[t]=e[t]||[],e[t].push(n),e),{}))}get after(){return memo(this,`delayedTransitions`,()=>t.getDelayedTransitions(this))}get initial(){return memo(this,`initial`,()=>t.formatInitialTransition(this,this.config.initial))}next(e,n){let r=n.type,i=[],a,o=memo(this,`candidates-${r}`,()=>t.getCandidates(this,r));for(let s of o){let{guard:o}=s,c=e.context,l=!1;try{l=!o||t.evaluateGuard(o,c,n,e)}catch(e){let t=typeof o==`string`?o:typeof o==`object`?o.type:void 0;throw Error(`Unable to evaluate guard ${t?`'${t}' `:``}in transition for event '${r}' in state node '${this.id}':\n${e.message}`)}if(l){i.push(...s.actions),a=s;break}}return a?[a]:void 0}get events(){return memo(this,`events`,()=>{let{states:e}=this,t=new Set(this.ownEvents);if(e)for(let n of Object.keys(e)){let r=e[n];if(r.states)for(let e of r.events)t.add(`${e}`)}return Array.from(t)})}get ownEvents(){let e=Object.keys(Object.fromEntries(this.transitions)),t=new Set(e.filter(e=>this.transitions.get(e).some(e=>!(!e.target&&!e.actions.length&&!e.reenter))));return Array.from(t)}};e.StateMachine=class StateMachine{constructor(e,n){this.config=e,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=e.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 a(e,{_key:this.id,_machine:this}),this.root._initialize(),t.formatRouteTransitions(this.root),this.states=this.root.states,this.events=this.root.events}provide(e){let{actions:t,guards:n,actors:r,delays:i}=this.implementations;return new StateMachine(this.config,{actions:{...t,...e.actions},guards:{...n,...e.guards},actors:{...r,...e.actors},delays:{...i,...e.delays}})}resolveState(e){let n=t.resolveStateValue(this.root,e.value),r=t.getAllStateNodes(t.getStateNodes(this.root,n));return t.createMachineSnapshot({_nodes:[...r],context:e.context||{},children:{},status:t.isInFinalState(r,this.root)?`done`:e.status||`active`,output:e.output,error:e.error,historyValue:e.historyValue},this)}transition(e,n,r){return t.macrostep(e,n,r,[]).snapshot}microstep(e,n,r){return t.macrostep(e,n,r,[]).microsteps.map(([e])=>e)}getTransitionData(e,n){return t.transitionNode(this.root,e.value,e,n)||[]}_getPreInitialState(e,r,i){let{context:a}=this.config,o=t.createMachineSnapshot({context:typeof a!=`function`&&a?a:{},_nodes:[this.root],children:{},status:`active`},this);if(typeof a==`function`){let assignment=({spawn:e,event:t,self:n})=>a({spawn:e,input:t.input,self:n});return t.resolveActionsAndContext(o,r,e,[n.assign(assignment)],i,void 0)}return o}getInitialSnapshot(e,n){let r=t.createInitEvent(n),i=[],a=this._getPreInitialState(e,r,i),[o]=t.initialMicrostep(this.root,a,e,r,i),{snapshot:s}=t.macrostep(o,r,e,i);return s}start(e){Object.values(e.children).forEach(e=>{e.getSnapshot().status===`active`&&e.start()})}getStateNodeById(e){let n=t.toStatePath(e),r=n.slice(1),i=t.isStateId(n[0])?n[0].slice(1):n[0],a=this.idMap.get(i);if(!a)throw Error(`Child state node '#${i}' does not exist on machine '${this.id}'`);return t.getStateNodeByPath(a,r)}get definition(){return this.root.definition}toJSON(){return this.definition}getPersistedSnapshot(e,n){return t.getPersistedSnapshot(e,n)}restoreSnapshot(e,n){let r={},i=e.children;Object.keys(i).forEach(e=>{let a=i[e],o=a.snapshot,s=a.src,c=typeof s==`string`?t.resolveReferencedActor(this,s):s;c&&(r[e]=t.createActor(c,{id:e,parent:n.self,syncSnapshot:a.syncSnapshot,snapshot:o,src:s,systemId:a.systemId}))});function resolveHistoryReferencedState(e,t){if(t instanceof a)return t;try{return e.machine.getStateNodeById(t.id)}catch{}}function reviveHistoryValue(e,t){if(!t||typeof t!=`object`)return{};let n={};for(let r in t){let i=t[r];for(let t of i){let i=resolveHistoryReferencedState(e,t);i&&(n[r]??=[],n[r].push(i))}}return n}let o=reviveHistoryValue(this.root,e.historyValue),s=t.createMachineSnapshot({...e,children:r,_nodes:Array.from(t.getAllStateNodes(t.getStateNodes(this.root,e.value))),historyValue:o},this),c=new Set;function reviveContext(e,n){if(!c.has(e)){c.add(e);for(let r in e){let i=e[r];if(i&&typeof i==`object`){if(`xstate$$type`in i&&i.xstate$$type===t.$$ACTOR_TYPE){e[r]=n[i.id];continue}reviveContext(i,n)}}}}return reviveContext(s.context,r),s}},e.StateNode=a})),_=r((e=>{var t=p(),n=h();function resolveEmit(e,t,n,r,{event:i}){return[t,{event:typeof i==`function`?i(n,r):i},void 0]}function executeEmit(e,{event:t}){e.defer(()=>e.emit(t))}function emit(e){function emit(e,t){}return emit.type=`xstate.emit`,emit.event=e,emit.resolve=resolveEmit,emit.execute=executeEmit,emit}let r=function(e){return e.Parent=`#_parent`,e.Internal=`#_internal`,e}({});function resolveSendTo(e,t,n,i,{to:a,event:o,id:s,delay:c},l){let u=t.machine.implementations.delays;if(typeof o==`string`)throw Error(`Only event objects may be used with sendTo; use sendTo({ type: "${o}" }) instead`);let d=typeof o==`function`?o(n,i):o,f;if(typeof c==`string`){let e=u&&u[c];f=typeof e==`function`?e(n,i):e}else f=typeof c==`function`?c(n,i):c;let p=typeof a==`function`?a(n,i):a,m;if(typeof p==`string`){if(m=p===r.Parent?e.self._parent:p===r.Internal?e.self:p.startsWith(`#_`)?t.children[p.slice(2)]:l.deferredActorIds?.includes(p)?p:t.children[p],!m)throw Error(`Unable to send event to actor '${p}' from machine '${t.machine.id}'.`)}else m=p||e.self;return[t,{to:m,targetId:typeof p==`string`?p:void 0,event:d,id:s,delay:f},void 0]}function retryResolveSendTo(e,t,n){typeof n.to==`string`&&(n.to=t.children[n.to])}function executeSendTo(e,n){e.defer(()=>{let{to:r,event:i,delay:a,id:o}=n;if(typeof a==`number`){e.system.scheduler.schedule(e.self,r,i,a,o);return}e.system._relay(e.self,r,i.type===t.XSTATE_ERROR?t.createErrorActorEvent(e.self.id,i.data):i)})}function sendTo(e,t,n){function sendTo(e,t){}return sendTo.type=`xstate.sendTo`,sendTo.to=e,sendTo.event=t,sendTo.id=n?.id,sendTo.delay=n?.delay,sendTo.resolve=resolveSendTo,sendTo.retryResolve=retryResolveSendTo,sendTo.execute=executeSendTo,sendTo}function sendParent(e,t){return sendTo(r.Parent,e,t)}function forwardTo(e,t){return sendTo(e,({event:e})=>e,t)}function resolveEnqueueActions(e,r,i,a,{collect:o}){let s=[],c=function enqueue(e){s.push(e)};return c.assign=(...e)=>{s.push(n.assign(...e))},c.cancel=(...e)=>{s.push(t.cancel(...e))},c.raise=(...e)=>{s.push(t.raise(...e))},c.sendTo=(...e)=>{s.push(sendTo(...e))},c.sendParent=(...e)=>{s.push(sendParent(...e))},c.spawnChild=(...e)=>{s.push(t.spawnChild(...e))},c.stopChild=(...e)=>{s.push(t.stopChild(...e))},c.emit=(...e)=>{s.push(emit(...e))},o({context:i.context,event:i.event,enqueue:c,check:e=>t.evaluateGuard(e,r.context,i.event,r),self:e.self,system:e.system},a),[r,void 0,s]}function enqueueActions(e){function enqueueActions(e,t){}return enqueueActions.type=`xstate.enqueueActions`,enqueueActions.collect=e,enqueueActions.resolve=resolveEnqueueActions,enqueueActions}function resolveLog(e,t,n,r,{value:i,label:a}){return[t,{value:typeof i==`function`?i(n,r):i,label:a},void 0]}function executeLog({logger:e},{value:t,label:n}){n?e(n,t):e(t)}function log(e=({context:e,event:t})=>({context:e,event:t}),t){function log(e,t){}return log.type=`xstate.log`,log.value=e,log.label=t,log.resolve=resolveLog,log.execute=executeLog,log}e.SpecialTargets=r,e.emit=emit,e.enqueueActions=enqueueActions,e.forwardTo=forwardTo,e.log=log,e.sendParent=sendParent,e.sendTo=sendTo})),v=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=m(),n=p(),r=g(),i=h(),a=_();f();function assertEvent(e,t){let r=n.toArray(t);if(!r.some(t=>n.matchesEventDescriptor(e.type,t))){let t=r.length===1?`type matching "${r[0]}"`:`one of types matching "${r.join(`", "`)}"`;throw Error(`Expected event ${JSON.stringify(e)} to have ${t}`)}}function createMachine(e,t){return new r.StateMachine(e,t)}function createInertActorScope(e){let t=n.createActor(e);return{self:t,defer:()=>{},id:``,logger:()=>{},sessionId:``,stopChild:()=>{},system:t.system,emit:()=>{},actionExecutor:()=>{}}}function getInitialSnapshot(e,...[t]){let n=createInertActorScope(e);return e.getInitialSnapshot(n,t)}function getNextSnapshot(e,t,n){let r=createInertActorScope(e);return r.self._snapshot=t,e.transition(t,n,r)}function setup({schemas:e,actors:t,actions:r,guards:o,delays:s}){return{assign:i.assign,sendTo:a.sendTo,raise:n.raise,log:a.log,cancel:n.cancel,stopChild:n.stopChild,enqueueActions:a.enqueueActions,emit:a.emit,spawnChild:n.spawnChild,createStateConfig:e=>e,createAction:e=>e,createMachine:n=>createMachine({...n,schemas:e},{actors:t,actions:r,guards:o,delays:s}),extend:n=>setup({schemas:e,actors:t,actions:{...r,...n.actions},guards:{...o,...n.guards},delays:{...s,...n.delays}})}}var SimulatedClock=class{constructor(){this.timeouts=new Map,this._now=0,this._id=0,this._flushing=!1,this._flushingInvalidated=!1}now(){return this._now}getId(){return this._id++}setTimeout(e,t){this._flushingInvalidated=this._flushing;let n=this.getId();return this.timeouts.set(n,{start:this.now(),timeout:t,fn:e}),n}clearTimeout(e){this._flushingInvalidated=this._flushing,this.timeouts.delete(e)}set(e){if(this._now>e)throw Error(`Unable to travel back in time`);this._now=e,this.flushTimeouts()}flushTimeouts(){if(this._flushing){this._flushingInvalidated=!0;return}this._flushing=!0;let e=[...this.timeouts].sort(([e,t],[n,r])=>{let i=t.start+t.timeout;return r.start+r.timeout>i?-1:1});for(let[t,n]of e){if(this._flushingInvalidated){this._flushingInvalidated=!1,this._flushing=!1,this.flushTimeouts();return}this.now()-n.start>=n.timeout&&(this.timeouts.delete(t),n.fn.call(null))}this._flushing=!1}increment(e){this._now+=e,this.flushTimeouts()}};function toPromise(e){return new Promise((t,n)=>{e.subscribe({complete:()=>{t(e.getSnapshot().output)},error:n})})}function transition(e,t,n){let r=[],i=createInertActorScope(e);return i.actionExecutor=e=>{r.push(e)},[e.transition(t,n,i),r]}function initialTransition(e,...[t]){let n=[],r=createInertActorScope(e);return r.actionExecutor=e=>{n.push(e)},[e.getInitialSnapshot(r,t),n]}function getMicrosteps(e,t,r){let i=createInertActorScope(e),{microsteps:a}=n.macrostep(t,r,i,[]);return a}function getInitialMicrosteps(e,...[t]){let r=createInertActorScope(e),i=n.createInitEvent(t),a=[],o=e._getPreInitialState(r,i,a),s=n.initialMicrostep(e.root,o,r,i,a),{microsteps:c}=n.macrostep(s[0],i,r,a);return[s,...c]}function getNextTransitions(e){let t=[],r=e._nodes.filter(n.isAtomicStateNode),i=new Set;for(let e of r)for(let r of[e].concat(n.getProperAncestors(e,void 0)))if(!i.has(r.id)){i.add(r.id);for(let[,e]of r.transitions)t.push(...e);r.always&&t.push(...r.always)}return t}let o={timeout:1/0};function waitFor(e,t,n){let r={...o,...n};return new Promise((n,i)=>{let{signal:a}=r;if(a?.aborted){i(a.reason);return}let o=!1,s=r.timeout===1/0?void 0:setTimeout(()=>{dispose(),i(Error(`Timeout of ${r.timeout} ms exceeded`))},r.timeout),dispose=()=>{clearTimeout(s),o=!0,c?.unsubscribe(),abortListener&&a.removeEventListener(`abort`,abortListener)};function checkEmitted(e){t(e)&&(dispose(),n(e))}let abortListener,c;checkEmitted(e.getSnapshot()),!o&&(a&&(abortListener=()=>{dispose(),i(a.reason)},a.addEventListener(`abort`,abortListener)),c=e.subscribe({next:checkEmitted,error:e=>{dispose(),i(e)},complete:()=>{dispose(),i(Error(`Actor terminated without satisfying predicate`))}}),o&&c.unsubscribe())})}e.createEmptyActor=t.createEmptyActor,e.fromCallback=t.fromCallback,e.fromEventObservable=t.fromEventObservable,e.fromObservable=t.fromObservable,e.fromPromise=t.fromPromise,e.fromTransition=t.fromTransition,e.Actor=n.Actor,e.__unsafe_getAllOwnEventDescriptors=n.getAllOwnEventDescriptors,e.and=n.and,e.cancel=n.cancel,e.createActor=n.createActor,e.getStateNodes=n.getStateNodes,e.interpret=n.interpret,e.isMachineSnapshot=n.isMachineSnapshot,e.matchesState=n.matchesState,e.not=n.not,e.or=n.or,e.pathToStateValue=n.pathToStateValue,e.raise=n.raise,e.spawnChild=n.spawnChild,e.stateIn=n.stateIn,e.stop=n.stop,e.stopChild=n.stopChild,e.toObserver=n.toObserver,e.StateMachine=r.StateMachine,e.StateNode=r.StateNode,e.assign=i.assign,e.SpecialTargets=a.SpecialTargets,e.emit=a.emit,e.enqueueActions=a.enqueueActions,e.forwardTo=a.forwardTo,e.log=a.log,e.sendParent=a.sendParent,e.sendTo=a.sendTo,e.SimulatedClock=SimulatedClock,e.assertEvent=assertEvent,e.createMachine=createMachine,e.getInitialMicrosteps=getInitialMicrosteps,e.getInitialSnapshot=getInitialSnapshot,e.getMicrosteps=getMicrosteps,e.getNextSnapshot=getNextSnapshot,e.getNextTransitions=getNextTransitions,e.initialTransition=initialTransition,e.setup=setup,e.toPromise=toPromise,e.transition=transition,e.waitFor=waitFor})),y=n({Actor:()=>b.Actor,SimulatedClock:()=>b.SimulatedClock,SpecialTargets:()=>b.SpecialTargets,StateMachine:()=>b.StateMachine,StateNode:()=>b.StateNode,__unsafe_getAllOwnEventDescriptors:()=>b.__unsafe_getAllOwnEventDescriptors,and:()=>b.and,assertEvent:()=>b.assertEvent,assign:()=>b.assign,cancel:()=>b.cancel,createActor:()=>b.createActor,createEmptyActor:()=>b.createEmptyActor,createMachine:()=>b.createMachine,emit:()=>b.emit,enqueueActions:()=>b.enqueueActions,forwardTo:()=>b.forwardTo,fromCallback:()=>b.fromCallback,fromEventObservable:()=>b.fromEventObservable,fromObservable:()=>b.fromObservable,fromPromise:()=>b.fromPromise,fromTransition:()=>b.fromTransition,getInitialMicrosteps:()=>b.getInitialMicrosteps,getInitialSnapshot:()=>b.getInitialSnapshot,getMicrosteps:()=>b.getMicrosteps,getNextSnapshot:()=>b.getNextSnapshot,getNextTransitions:()=>b.getNextTransitions,getStateNodes:()=>b.getStateNodes,initialTransition:()=>b.initialTransition,interpret:()=>b.interpret,isMachineSnapshot:()=>b.isMachineSnapshot,log:()=>b.log,matchesState:()=>b.matchesState,not:()=>b.not,or:()=>b.or,pathToStateValue:()=>b.pathToStateValue,raise:()=>b.raise,sendParent:()=>b.sendParent,sendTo:()=>b.sendTo,setup:()=>b.setup,spawnChild:()=>b.spawnChild,stateIn:()=>b.stateIn,stop:()=>b.stop,stopChild:()=>b.stopChild,toObserver:()=>b.toObserver,toPromise:()=>b.toPromise,transition:()=>b.transition,waitFor:()=>b.waitFor}),b,x=e((()=>{b=v()})),S=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=i(),r=(d(),t(l)),s=(x(),t(y)),c=o();a();function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var u=_interopDefault(r);let forEachActor=(e,t)=>{t(e);let n=e.getSnapshot().children;n&&Object.values(n).forEach(e=>{forEachActor(e,t)})};function stopRootWithRehydration(e){let t=[];forEachActor(e,e=>{t.push([e,e.getSnapshot()]),e.observers=new Set});let n=e.system.getSnapshot?.();e.stop(),e.system._snapshot=n,t.forEach(([e,t])=>{e._processingStatus=0,e._snapshot=t})}function useIdleActorRef(e,...[t]){let[[r,i],a]=n.useState(()=>{let n=s.createActor(e,t);return[e.config,n]});if(e.config!==r){let n=s.createActor(e,{...t,snapshot:i.getPersistedSnapshot({__unsafeAllowInlineActors:!0})});a([e.config,n]),i=n}return u.default(()=>{i.logic.implementations=e.implementations}),i}function useActorRef(e,...[t,r]){let i=useIdleActorRef(e,t);return n.useEffect(()=>{if(!r)return;let e=i.subscribe(s.toObserver(r));return()=>{e.unsubscribe()}},[r]),n.useEffect(()=>(i.start(),()=>{stopRootWithRehydration(i)}),[i]),i}function defaultCompare(e,t){return e===t}function useSelector(e,t,r=defaultCompare){let i=n.useCallback(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe({next:t,error:t});return n},[e]),a=n.useCallback(()=>{let t=e?.getSnapshot();if(t&&`status`in t&&t.status===`error`)throw t.error;return t},[e]);return c.useSyncExternalStoreWithSelector(i,a,a,t,r)}e.useActorRef=useActorRef,e.useSelector=useSelector}))();export{h as a,_ as i,b as n,p as o,x as r,f as s,S as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"../../rolldown-runtime.mjs";import{h as t}from"../@tanstack/react-router.mjs";var n=e((e=>{let t=function(e){return e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e}({});function createReactiveSystem({update:e,notify:n,unwatched:r}){return{link,unlink,propagate,checkDirty,shallowPropagate};function link(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function unlink(e,t=e.sub){let n=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?n.subsTail=s:o.prevSub=s,s===void 0?(n.subs=o)===void 0&&r(n):s.nextSub=o,a}function propagate(e){let r=e.nextSub,i;top:do{let a=e.sub,o=a.flags;if(o&(t.RecursedCheck|t.Recursed|t.Dirty|t.Pending)?o&(t.RecursedCheck|t.Recursed)?o&t.RecursedCheck?!(o&(t.Dirty|t.Pending))&&isValidLink(e,a)?(a.flags=o|(t.Recursed|t.Pending),o&=t.Mutable):o=t.None:a.flags=o&~t.Recursed|t.Pending:o=t.None:a.flags=o|t.Pending,o&t.Watching&&n(a),o&t.Mutable){let t=a.subs;if(t!==void 0){let n=(e=t).nextSub;n!==void 0&&(i={value:r,prev:i},r=n);continue}}if((e=r)!==void 0){r=e.nextSub;continue}for(;i!==void 0;)if(e=i.value,i=i.prev,e!==void 0){r=e.nextSub;continue top}break}while(!0)}function checkDirty(n,r){let i,a=0,o=!1;top:do{let s=n.dep,c=s.flags;if(r.flags&t.Dirty)o=!0;else if((c&(t.Mutable|t.Dirty))===(t.Mutable|t.Dirty)){if(e(s)){let e=s.subs;e.nextSub!==void 0&&shallowPropagate(e),o=!0}}else if((c&(t.Mutable|t.Pending))===(t.Mutable|t.Pending)){(n.nextSub!==void 0||n.prevSub!==void 0)&&(i={value:n,prev:i}),n=s.deps,r=s,++a;continue}if(!o){let e=n.nextDep;if(e!==void 0){n=e;continue}}for(;a--;){let a=r.subs,s=a.nextSub!==void 0;if(s?(n=i.value,i=i.prev):n=a,o){if(e(r)){s&&shallowPropagate(a),r=n.sub;continue}o=!1}else r.flags&=~t.Pending;r=n.sub;let c=n.nextDep;if(c!==void 0){n=c;continue top}}return o}while(!0)}function shallowPropagate(e){do{let r=e.sub,i=r.flags;(i&(t.Pending|t.Dirty))===t.Pending&&(r.flags=i|t.Dirty,(i&(t.Watching|t.RecursedCheck))===t.Watching&&n(r))}while((e=e.nextSub)!==void 0)}function isValidLink(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function toObserver(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}let n=[],r=0,{link:i,unlink:a,propagate:o,checkDirty:s,shallowPropagate:c}=createReactiveSystem({update(e){return e._update()},notify(e){n[u++]=e,e.flags&=~t.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=t.Mutable|t.Dirty,purgeDeps(e))}}),l=0,u=0,d;function purgeDeps(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=a(n,e)}function flush(){for(;l<u;){let e=n[l];n[l++]=void 0,e.notify()}l=0,u=0}function createAsyncAtom(e,t){let n={},r=createAtom(()=>(e().then(e=>{let t=n.current;if(t._update({status:`done`,data:e})){let e=t.subs;e!==void 0&&(o(e),c(e),flush())}},e=>{let t=n.current;if(t._update({status:`error`,error:e})){let e=t.subs;e!==void 0&&(o(e),c(e),flush())}}),{status:`pending`}),t);return n.current=r,r}function createAtom(e,n){let a=typeof e==`function`,l=e,u={_snapshot:a?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:a?t.None:t.Mutable,get(){return d!==void 0&&i(u,d,r),u._snapshot},subscribe(e){let t=toObserver(e),n={current:!1},r=effect(()=>{u.get(),n.current?t.next?.(u._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let i=d,o=n?.compare??Object.is;d=u,++r,u.depsTail=void 0,a&&(u.flags=t.Mutable|t.RecursedCheck);try{let t=u._snapshot,read=e=>e.get(),n=typeof e==`function`?e(t):e===void 0&&a?l(read,t):e;return t===void 0||!o(t,n)?(u._snapshot=n,!0):!1}finally{d=i,a&&(u.flags&=~t.RecursedCheck),purgeDeps(u)}}};return a?(u.flags=t.Mutable|t.Dirty,u.get=function(){let e=u.flags;if(e&t.Dirty||e&t.Pending&&s(u.deps,u)){if(u._update()){let e=u.subs;e!==void 0&&c(e)}}else e&t.Pending&&(u.flags=e&~t.Pending);return d!==void 0&&i(u,d,r),u._snapshot}):u.set=function(e){if(u._update(e)){let e=u.subs;e!==void 0&&(o(e),c(e),flush())}},u}function effect(e){let run=()=>{let i=d;d=n,++r,n.depsTail=void 0,n.flags=t.Watching|t.RecursedCheck;try{return e()}finally{d=i,n.flags&=~t.RecursedCheck,purgeDeps(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:t.Watching|t.RecursedCheck,notify(){let e=this.flags;e&t.Dirty||e&t.Pending&&s(this.deps,this)?run():this.flags=t.Watching},stop(){this.flags=t.None,this.depsTail=void 0,purgeDeps(this)}};return run(),n}let f=typeof Symbol==`function`&&Symbol.observable||`@@observable`,p=new WeakMap;function createStoreCore(e,t){let n,r=e.getInitialSnapshot(),i=r,a=createAtom(i),emit=e=>{if(!n)return;let t=e.type,r=n.get(t);r&&r.forEach(t=>t(e));let i=n.get(`*`);i&&i.forEach(t=>t(e))},o=e.transition;function receive(e){let[n,r]=o(i,e);i=n,p.get(s)?.forEach(t=>{t.next?.({type:`@xstate.snapshot`,event:e,snapshot:n,actorRef:s,rootId:s.sessionId})}),a.set(n);for(let e of r)typeof e==`function`?e():(t?.[e.type]?.(e),emit(e))}let s={get _snapshot(){return a._snapshot},on(e,t){n||=new Map;let r=n.get(e);r||(r=new Set,n.set(e,r));let i=t.bind(void 0);return r.add(i),{unsubscribe(){r.delete(i)}}},transition:e.transition,sessionId:uniqueId(),send(e){p.get(s)?.forEach(t=>{t.next?.({type:`@xstate.event`,event:e,sourceRef:void 0,actorRef:s,rootId:s.sessionId})}),receive(e)},getSnapshot(){return i},get(){return a.get()},getInitialSnapshot(){return r},subscribe:a.subscribe.bind(a),[f](){return this},inspect:e=>{let t=toObserver(e);return p.set(s,p.get(s)??new Set),p.get(s).add(t),t.next?.({type:`@xstate.actor`,actorRef:s,rootId:s.sessionId}),t.next?.({type:`@xstate.snapshot`,snapshot:r,event:{type:`@xstate.init`},actorRef:s,rootId:s.sessionId}),{unsubscribe(){return p.get(s)?.delete(t)}}},trigger:new Proxy({},{get:(e,t)=>e=>{s.send({...e,type:t})}}),select(e,t=Object.is){return createAtom(()=>e(s.get().context),{compare:t})},with(n){return createStoreCore(n(e),t)}};return s}function createStore(e){return`transition`in e?createStoreCore(e):createStoreCore({getInitialSnapshot:()=>({status:`active`,context:e.context,output:void 0,error:void 0}),transition:createStoreTransition(e.on)},e.emits)}function _createStoreConfig(e){return e}let m=_createStoreConfig;function createStoreWithProducer(e,t){return createStoreCore({getInitialSnapshot:()=>({status:`active`,context:t.context,output:void 0,error:void 0}),transition:createStoreTransition(t.on,e)},t.emits)}function createStoreTransition(e,t){return(n,r)=>{let i=n.context,a=e?.[r.type],o=[],s={emit:new Proxy({},{get:(e,t)=>e=>{o.push({...e,type:t})}}),effect:e=>{o.push(e)}};if(!a)return[n,o];let c=t?t(i,e=>a(e,r,s)):a(i,r,s)??i;return[c===i?n:{...n,context:c},o]}}function uniqueId(){return Math.random().toString(36).slice(6)}e.createAsyncAtom=createAsyncAtom,e.createAtom=createAtom,e.createStore=createStore,e.createStoreConfig=m,e.createStoreTransition=createStoreTransition,e.createStoreWithProducer=createStoreWithProducer})),r=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=n();function is(e,t){return e===t?e!==0||t!==0||1/e==1/t:e!==e&&t!==t}function shallowEqual(e,t){if(is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!is(e[n[r]],t[n[r]]))return!1;return!0}e.createAsyncAtom=t.createAsyncAtom,e.createAtom=t.createAtom,e.createStore=t.createStore,e.createStoreConfig=t.createStoreConfig,e.createStoreWithProducer=t.createStoreWithProducer,e.shallowEqual=shallowEqual}))(),i=e((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var r=t();n();function defaultCompare(e,t){return e===t}function identity(e){return e}function useSelectorWithCompare(e,t){let n=r.useRef(void 0);return r=>{let i=e(r);return n.current&&t(n.current,i)?n.current:n.current=i}}function useSelector(e,t=identity,n=defaultCompare){let i=useSelectorWithCompare(t,n);return r.useSyncExternalStore(r.useCallback(t=>e.subscribe(t).unsubscribe,[e]),()=>i(e.get()),()=>i(e.get()))}e.useSelector=useSelector}))();export{r as n,i as t};
|