omegga 1.5.2 → 1.6.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/CHANGELOG.md +19 -2
- package/bin/omegga +1 -1
- package/dist/cli/terminal.js +46 -0
- package/dist/cli/terminal.js.map +1 -1
- package/dist/omegga/commandInjector.js +13 -6
- package/dist/omegga/commandInjector.js.map +1 -1
- package/dist/omegga/player.js +2 -2
- package/dist/omegga/player.js.map +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/webserver/backend/database.js +219 -7
- package/dist/webserver/backend/database.js.map +1 -1
- package/dist/webserver/backend/events.js +1 -1
- package/dist/webserver/backend/events.js.map +1 -1
- package/dist/webserver/backend/index.js +120 -2
- package/dist/webserver/backend/index.js.map +1 -1
- package/dist/webserver/backend/permissions.js +74 -0
- package/dist/webserver/backend/permissions.js.map +1 -0
- package/dist/webserver/backend/router/chat.js +9 -7
- package/dist/webserver/backend/router/chat.js.map +1 -1
- package/dist/webserver/backend/router/index.js +3 -1
- package/dist/webserver/backend/router/index.js.map +1 -1
- package/dist/webserver/backend/router/mfa.js +162 -0
- package/dist/webserver/backend/router/mfa.js.map +1 -0
- package/dist/webserver/backend/router/player.js +7 -6
- package/dist/webserver/backend/router/player.js.map +1 -1
- package/dist/webserver/backend/router/plugin.js +14 -10
- package/dist/webserver/backend/router/plugin.js.map +1 -1
- package/dist/webserver/backend/router/role.js +2 -1
- package/dist/webserver/backend/router/role.js.map +1 -1
- package/dist/webserver/backend/router/server.js +85 -71
- package/dist/webserver/backend/router/server.js.map +1 -1
- package/dist/webserver/backend/router/session.js +11 -2
- package/dist/webserver/backend/router/session.js.map +1 -1
- package/dist/webserver/backend/router/user.js +175 -13
- package/dist/webserver/backend/router/user.js.map +1 -1
- package/dist/webserver/backend/router/world.js +10 -9
- package/dist/webserver/backend/router/world.js.map +1 -1
- package/dist/webserver/backend/scopes.js +303 -0
- package/dist/webserver/backend/scopes.js.map +1 -0
- package/dist/webserver/backend/totp.js +32 -0
- package/dist/webserver/backend/totp.js.map +1 -0
- package/dist/webserver/backend/trpc.js +47 -4
- package/dist/webserver/backend/trpc.js.map +1 -1
- package/doc/permissions.md +193 -0
- package/package.json +7 -2
- package/public/app.html +932 -526
- package/public/assets/IconShieldCheck-Bjlm8mX2.js +2 -0
- package/public/assets/IconShieldCheck-Bjlm8mX2.js.map +1 -0
- package/public/assets/IconWorld-XmQNg6JI.js +2 -0
- package/public/assets/IconWorld-XmQNg6JI.js.map +1 -0
- package/public/assets/IconWorldPlus-CxGGv2eD.js +2 -0
- package/public/assets/IconWorldPlus-CxGGv2eD.js.map +1 -0
- package/public/assets/app-DMr_-wik.js +7 -0
- package/public/assets/app-DMr_-wik.js.map +1 -0
- package/public/assets/auth-CEYiizOt.js +2 -0
- package/public/assets/auth-CEYiizOt.js.map +1 -0
- package/public/assets/index-BDkarAkX.js +3 -0
- package/public/assets/index-BDkarAkX.js.map +1 -0
- package/public/assets/{index-2cgXLhrt.js → index-DEL-PD_8.js} +2 -2
- package/public/assets/{index-2cgXLhrt.js.map → index-DEL-PD_8.js.map} +1 -1
- package/public/assets/index-D_STNela.js +2 -0
- package/public/assets/index-D_STNela.js.map +1 -0
- package/public/assets/index-Dkh3HiBz.js +4 -0
- package/public/assets/index-Dkh3HiBz.js.map +1 -0
- package/public/assets/shared/@components-CgsSYMe6.js +2 -0
- package/public/assets/shared/@components-CgsSYMe6.js.map +1 -0
- package/public/assets/shared/@hooks-DT93N7wd.js +2 -0
- package/public/assets/shared/{@hooks-Ch_hJYh0.js.map → @hooks-DT93N7wd.js.map} +1 -1
- package/public/assets/shared/@tabler_icons-react-DrVFX3uL.js +3 -0
- package/public/assets/shared/{@tabler_icons-react-iQk11eD_.js.map → @tabler_icons-react-DrVFX3uL.js.map} +1 -1
- package/public/assets/shared/{wouter-CUC1caxu.js → wouter-CNISJ5i6.js} +2 -2
- package/public/assets/shared/wouter-CNISJ5i6.js.map +1 -0
- package/public/assets/useHasScope-BOdFktko.js +2 -0
- package/public/assets/useHasScope-BOdFktko.js.map +1 -0
- package/public/auth.html +97 -33
- package/templates/safe-ts/omegga.d.ts +1 -1
- package/public/assets/IconArrowRight-BuVxhqKX.js +0 -2
- package/public/assets/IconArrowRight-BuVxhqKX.js.map +0 -1
- package/public/assets/IconWorld-B6GK5qpx.js +0 -2
- package/public/assets/IconWorld-B6GK5qpx.js.map +0 -1
- package/public/assets/IconWorldPlus-Dkos72Ws.js +0 -2
- package/public/assets/IconWorldPlus-Dkos72Ws.js.map +0 -1
- package/public/assets/app-CLZ-5FIi.js +0 -6
- package/public/assets/app-CLZ-5FIi.js.map +0 -1
- package/public/assets/auth-6N37o421.js +0 -2
- package/public/assets/auth-6N37o421.js.map +0 -1
- package/public/assets/index-DLZ8-XzO.js +0 -4
- package/public/assets/index-DLZ8-XzO.js.map +0 -1
- package/public/assets/index-DY750sgZ.js +0 -2
- package/public/assets/index-DY750sgZ.js.map +0 -1
- package/public/assets/shared/@components-DPHARroA.js +0 -2
- package/public/assets/shared/@components-DPHARroA.js.map +0 -1
- package/public/assets/shared/@hooks-Ch_hJYh0.js +0 -2
- package/public/assets/shared/@tabler_icons-react-iQk11eD_.js +0 -3
- package/public/assets/shared/wouter-CUC1caxu.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as F}from"./client-BT1QYH0O.js";import{_ as U,I as b,a as J,b as M,c as W}from"./IconShieldCheck-Bjlm8mX2.js";import{j as e}from"./jsx-runtime-BX5r4UiA.js";import{r as t}from"./index-CrN8I5Az.js";import{B as H,M as z,H as S,P,I as x,F as I,a as c,L as K}from"./index-D_STNela.js";import V from"./IconLockOpen-Bs7Tsf6u.js";import"./index-D0OPOe3j.js";import"./index-CtCtK5BX.js";import"./IconCheck-DOe3u7iH.js";import"./jsx-runtime-DldvXD6N.js";import"./_commonjsHelpers-CE1G-McA.js";import"./shared/@nanostores_react-DJPF1Eqx.js";import"./index-CJ4e7_2M.js";import"./index-CSV4ZXsq.js";import"./IconX-CvmO0bbE.js";const $="/assets/turkey-BW4gu-4u.webp",q=typeof window<"u"&&!!window.PublicKeyCredential&&(location.protocol==="https:"||location.hostname==="localhost"),D=()=>{const[v,s]=t.useState(!0),[r,R]=t.useState(!0),[g,A]=t.useState("login"),[h,o]=t.useState(""),[i,E]=t.useState(""),[n,O]=t.useState(""),[p,T]=t.useState(""),[l,w]=t.useState(""),[m,L]=t.useState(!1);t.useEffect(()=>{fetch("/api/v1/first").then(a=>a.json()).then(a=>{R(a),s(!1)})},[]);const d=t.useCallback(async(a,u)=>{s(!0),o("");try{const y=await fetch("/api/v1/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:a,password:u})}),j=await y.json();y.status===200?j.mfaRequired?(A("mfa-totp"),s(!1)):location.reload():(o(j.message||"Authentication failed"),s(!1))}catch{o("Connection failed"),s(!1)}},[]),C=t.useCallback(async()=>{s(!0),o("");try{const a=await fetch("/api/v1/auth/mfa/totp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:l})});if(a.status===200)location.reload();else{const u=await a.json();o(u.message||"Invalid code"),s(!1)}}catch{o("Connection failed"),s(!1)}},[l]),N=t.useCallback(async()=>{s(!0),o("");try{const u=await(await fetch("/api/v1/auth/webauthn/options")).json(),{startAuthentication:y}=await U(async()=>{const{startAuthentication:B}=await import("./index-BDkarAkX.js");return{startAuthentication:B}},[]),j=await y({optionsJSON:u});(await fetch("/api/v1/auth/webauthn/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({credential:j})})).status===200?location.reload():(o("Passkey verification failed"),s(!1))}catch(a){if(a?.name==="NotAllowedError"){s(!1);return}o("Passkey authentication failed"),s(!1)}},[]),k=i.length===0&&n.length===0,f=i.match(/^\w{0,32}$/)&&!k,_=t.useMemo(()=>({top:`${Math.random()*50+25}%`}),[]);return e.jsxs("div",{children:[e.jsx(H,{children:e.jsx("div",{className:"turkey",style:_,children:e.jsx("img",{src:$})})}),e.jsxs(z,{visible:!v,children:[g==="login"&&e.jsxs(e.Fragment,{children:[e.jsx(S,{attached:!0,children:"Brickadia Server Login"}),e.jsxs(P,{children:[e.jsx("p",{children:"Welcome to the Omegga Web UI."}),r&&e.jsx("p",{children:"Enter credentials for an Admin user. You can also skip this step if you don't want to use a password."}),h&&e.jsx("p",{style:{color:"#f66",textTransform:"capitalize"},children:h})]}),e.jsxs("div",{className:"popout-inputs",children:[e.jsx(x,{placeholder:"Username",type:"text",value:i,onChange:E}),e.jsx(x,{placeholder:"Password",type:"password",value:n,onChange:O,onSubmit:!r&&f?()=>d(i,n):void 0}),r&&e.jsx(x,{placeholder:"Confirm Password",type:"password",value:p,onChange:T,onSubmit:f&&p===n?()=>d(i,n):void 0})]}),e.jsxs(I,{attached:!0,children:[r&&e.jsxs(c,{main:!0,disabled:!f||p!==n,onClick:()=>d(i,n),children:[e.jsx(b,{})," Create"]}),!r&&e.jsxs(c,{main:!0,disabled:!f,onClick:()=>d(i,n),children:[e.jsx(b,{})," Login"]}),e.jsx("div",{style:{flex:1}}),!r&&q&&e.jsxs(c,{normal:!0,onClick:N,children:[e.jsx(J,{})," Passkey"]}),r&&e.jsxs(c,{warn:!0,disabled:!k||p!==n,onClick:()=>d("",""),children:[e.jsx(V,{})," Skip"]})]})]}),g==="mfa-totp"&&e.jsxs(e.Fragment,{children:[e.jsx(S,{attached:!0,children:"Two-Factor Authentication"}),e.jsxs(P,{children:[e.jsx("p",{children:m?"Enter a recovery code to sign in.":"Enter the 6-digit code from your authenticator app."}),h&&e.jsx("p",{style:{color:"#f66"},children:h})]}),e.jsx("div",{className:"popout-inputs",children:e.jsx(x,{placeholder:m?"Recovery code":"000000",type:"text",value:l,onChange:w,onSubmit:l?C:void 0})}),e.jsxs(I,{attached:!0,children:[e.jsxs(c,{main:!0,disabled:!l,onClick:C,children:[e.jsx(M,{})," Verify"]}),e.jsx("div",{style:{flex:1}}),e.jsxs(c,{normal:!0,onClick:()=>{L(!m),w(""),o("")},children:[e.jsx(W,{}),m?"Use app":"Use recovery code"]})]})]}),e.jsx(K,{active:v,blur:!0,size:"huge",children:e.jsx("b",{children:"AUTHORIZING"})})]})]})};F.createRoot(document.getElementById("root")).render(e.jsx(D,{}));
|
|
2
|
+
//# sourceMappingURL=auth-CEYiizOt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":"+mBAAA,MAAAA,EAAe,+BCqBTC,EACJ,OAAO,OAAW,KAClB,CAAC,CAAC,OAAO,sBACR,SAAS,WAAa,UAAY,SAAS,WAAa,aAErDC,EAAO,IAAM,CACjB,KAAM,CAACC,EAASC,CAAU,EAAIC,WAAS,EAAI,EACrC,CAACC,EAAWC,CAAY,EAAIF,WAAS,EAAI,EACzC,CAACG,EAAOC,CAAQ,EAAIJ,WAAoB,OAAO,EAC/C,CAACK,EAAOC,CAAQ,EAAIN,WAAS,EAAE,EAE/B,CAACO,EAAUC,CAAW,EAAIR,WAAS,EAAE,EACrC,CAACS,EAAUC,CAAW,EAAIV,WAAS,EAAE,EACrC,CAACW,EAASC,CAAU,EAAIZ,WAAS,EAAE,EACnC,CAACa,EAAUC,CAAW,EAAId,WAAS,EAAE,EACrC,CAACe,EAAaC,CAAc,EAAIhB,WAAS,EAAK,EAEpDiB,YAAU,IAAM,CACd,MAAM,eAAe,EAClB,KAAKC,GAAYA,EAAS,MAAM,EAChC,KAAKC,GAAQ,CACZjB,EAAaiB,CAAI,EACjBpB,EAAW,EAAK,CAClB,CAAC,CACL,EAAG,EAAE,EAEL,MAAMqB,EAAUC,cAAY,MAAOd,EAAkBE,IAAqB,CACxEV,EAAW,EAAI,EACfO,EAAS,EAAE,EACX,GAAI,CACF,MAAMgB,EAAM,MAAM,MAAM,eAAgB,CACtC,OAAQ,OACR,QAAS,CAAE,eAAgB,oBAC3B,KAAM,KAAK,UAAU,CAAE,SAAAf,EAAU,SAAAE,EAAU,EAC5C,EACKU,EAAO,MAAMG,EAAI,OACnBA,EAAI,SAAW,IACbH,EA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,GACF,CAEJ,EAEAgB,aAAW,SAAS,eAAe,MAAM,CAAE,EAAE,OAAOhB,MAACrC,IAAK,CAAE","names":["turkeyImage","canWebAuthn","Auth","loading","setLoading","useState","firstLoad","setFirstLoad","phase","setPhase","error","setError","username","setUsername","password","setPassword","confirm","setConfirm","totpCode","setTotpCode","useRecovery","setUseRecovery","useEffect","response","data","tryAuth","useCallback","res","submitTotp","tryPasskey","options","startAuthentication","__vitePreload","credential","e","authBlank","authOk","turkeyStyle","useMemo","jsx","Background","jsxs","Modal","Fragment","Header","PopoutContent","Input","Footer","Button","IconArrowRight","IconFingerprint","IconLockOpen","IconShieldCheck","IconKey","Loader","createRoot"],"ignoreList":[],"sources":["../../frontend/assets/img/turkey.webp","../../frontend/src/auth/index.tsx"],"sourcesContent":["export default \"__VITE_ASSET__CArnIZrw__\"","import {\n IconArrowRight,\n IconFingerprint,\n IconKey,\n IconLockOpen,\n IconShieldCheck,\n} from '@tabler/icons-react';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport turkeyImage from '../../assets/img/turkey.webp';\nimport { Background } from '../components/background';\nimport { Button } from '../components/button';\nimport { Footer } from '../components/footer';\nimport { Header } from '../components/header';\nimport { Input } from '../components/input';\nimport { Loader } from '../components/loader';\nimport { Modal } from '../components/modal';\nimport { PopoutContent } from '../components/popout';\n\ntype AuthPhase = 'login' | 'mfa-totp';\n\nconst canWebAuthn =\n typeof window !== 'undefined' &&\n !!window.PublicKeyCredential &&\n (location.protocol === 'https:' || location.hostname === 'localhost');\n\nconst Auth = () => {\n const [loading, setLoading] = useState(true);\n const [firstLoad, setFirstLoad] = useState(true);\n const [phase, setPhase] = useState<AuthPhase>('login');\n const [error, setError] = useState('');\n\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirm, setConfirm] = useState('');\n const [totpCode, setTotpCode] = useState('');\n const [useRecovery, setUseRecovery] = useState(false);\n\n useEffect(() => {\n fetch('/api/v1/first')\n .then(response => response.json())\n .then(data => {\n setFirstLoad(data);\n setLoading(false);\n });\n }, []);\n\n const tryAuth = useCallback(async (username: string, password: string) => {\n setLoading(true);\n setError('');\n try {\n const res = await fetch('/api/v1/auth', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ username, password }),\n });\n const data = await res.json();\n if (res.status === 200) {\n if (data.mfaRequired) {\n setPhase('mfa-totp');\n setLoading(false);\n } else {\n location.reload();\n }\n } else {\n setError(data.message || 'Authentication failed');\n setLoading(false);\n }\n } catch {\n setError('Connection failed');\n setLoading(false);\n }\n }, []);\n\n const submitTotp = useCallback(async () => {\n setLoading(true);\n setError('');\n try {\n const res = await fetch('/api/v1/auth/mfa/totp', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ code: totpCode }),\n });\n if (res.status === 200) {\n location.reload();\n } else {\n const data = await res.json();\n setError(data.message || 'Invalid code');\n setLoading(false);\n }\n } catch {\n setError('Connection failed');\n setLoading(false);\n }\n }, [totpCode]);\n\n const tryPasskey = useCallback(async () => {\n setLoading(true);\n setError('');\n try {\n const optRes = await fetch('/api/v1/auth/webauthn/options');\n const options = await optRes.json();\n\n const { startAuthentication } = await import('@simplewebauthn/browser');\n const credential = await startAuthentication({ optionsJSON: options });\n\n const verifyRes = await fetch('/api/v1/auth/webauthn/verify', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ credential }),\n });\n if (verifyRes.status === 200) {\n location.reload();\n } else {\n setError('Passkey verification failed');\n setLoading(false);\n }\n } catch (e: any) {\n if (e?.name === 'NotAllowedError') {\n setLoading(false);\n return;\n }\n setError('Passkey authentication failed');\n setLoading(false);\n }\n }, []);\n\n const authBlank = username.length === 0 && password.length === 0;\n const authOk = username.match(/^\\w{0,32}$/) && !authBlank;\n\n const turkeyStyle = useMemo(\n () => ({ top: `${Math.random() * 50 + 25}%` }),\n [],\n );\n\n return (\n <div>\n <Background>\n <div className=\"turkey\" style={turkeyStyle}>\n <img src={turkeyImage} />\n </div>\n </Background>\n <Modal visible={!loading}>\n {phase === 'login' && (\n <>\n <Header attached>Brickadia Server Login</Header>\n <PopoutContent>\n <p>Welcome to the Omegga Web UI.</p>\n {firstLoad && (\n <p>\n Enter credentials for an Admin user. You can also skip this\n step if you don't want to use a password.\n </p>\n )}\n {error && (\n <p style={{ color: '#f66', textTransform: 'capitalize' }}>\n {error}\n </p>\n )}\n </PopoutContent>\n <div className=\"popout-inputs\">\n <Input\n placeholder=\"Username\"\n type=\"text\"\n value={username}\n onChange={setUsername}\n />\n <Input\n placeholder=\"Password\"\n type=\"password\"\n value={password}\n onChange={setPassword}\n onSubmit={\n !firstLoad && authOk\n ? () => tryAuth(username, password)\n : undefined\n }\n />\n {firstLoad && (\n <Input\n placeholder=\"Confirm Password\"\n type=\"password\"\n value={confirm}\n onChange={setConfirm}\n onSubmit={\n authOk && confirm === password\n ? () => tryAuth(username, password)\n : undefined\n }\n />\n )}\n </div>\n <Footer attached>\n {firstLoad && (\n <Button\n main\n disabled={!authOk || confirm !== password}\n onClick={() => tryAuth(username, password)}\n >\n <IconArrowRight /> Create\n </Button>\n )}\n {!firstLoad && (\n <Button\n main\n disabled={!authOk}\n onClick={() => tryAuth(username, password)}\n >\n <IconArrowRight /> Login\n </Button>\n )}\n <div style={{ flex: 1 }} />\n {!firstLoad && canWebAuthn && (\n <Button normal onClick={tryPasskey}>\n <IconFingerprint /> Passkey\n </Button>\n )}\n {firstLoad && (\n <Button\n warn\n disabled={!authBlank || confirm !== password}\n onClick={() => tryAuth('', '')}\n >\n <IconLockOpen /> Skip\n </Button>\n )}\n </Footer>\n </>\n )}\n {phase === 'mfa-totp' && (\n <>\n <Header attached>Two-Factor Authentication</Header>\n <PopoutContent>\n <p>\n {useRecovery\n ? 'Enter a recovery code to sign in.'\n : 'Enter the 6-digit code from your authenticator app.'}\n </p>\n {error && <p style={{ color: '#f66' }}>{error}</p>}\n </PopoutContent>\n <div className=\"popout-inputs\">\n <Input\n placeholder={useRecovery ? 'Recovery code' : '000000'}\n type=\"text\"\n value={totpCode}\n onChange={setTotpCode}\n onSubmit={totpCode ? submitTotp : undefined}\n />\n </div>\n <Footer attached>\n <Button main disabled={!totpCode} onClick={submitTotp}>\n <IconShieldCheck /> Verify\n </Button>\n <div style={{ flex: 1 }} />\n <Button\n normal\n onClick={() => {\n setUseRecovery(!useRecovery);\n setTotpCode('');\n setError('');\n }}\n >\n <IconKey />\n {useRecovery ? 'Use app' : 'Use recovery code'}\n </Button>\n </Footer>\n </>\n )}\n <Loader active={loading} blur size=\"huge\">\n <b>AUTHORIZING</b>\n </Loader>\n </Modal>\n </div>\n );\n};\n\ncreateRoot(document.getElementById('root')!).render(<Auth />);\n"],"file":"auth-CEYiizOt.js"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function u(e){const t=new Uint8Array(e);let n="";for(const r of t)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function g(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4,a=t.padEnd(t.length+n,"="),r=atob(a),l=new ArrayBuffer(r.length),d=new Uint8Array(l);for(let o=0;o<r.length;o++)d[o]=r.charCodeAt(o);return l}function R(){return S.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential=="function")}const S={stubThis:e=>e};function m(e){const{id:t}=e;return{...e,id:g(t),transports:e.transports}}function y(e){return e==="localhost"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}class i extends Error{constructor({message:t,code:n,cause:a,name:r}){super(t,{cause:a}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??a.name,this.code=n}}function I({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new i({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(n.authenticatorSelection?.requireResidentKey===!0)return new i({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&n.authenticatorSelection?.userVerification==="required")return new i({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(n.authenticatorSelection?.userVerification==="required")return new i({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new i({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new i({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return n.pubKeyCredParams.filter(r=>r.type==="public-key").length===0?new i({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new i({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const a=globalThis.location.hostname;if(y(a)){if(n.rp.id!==a)return new i({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new i({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new i({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new i({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}class T{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const O=new T,P=["cross-platform","platform"];function _(e){if(e&&!(P.indexOf(e)<0))return e}async function D(e){!e.optionsJSON&&e.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});const{optionsJSON:t,useAutoRegister:n=!1}=e;if(!R())throw new Error("WebAuthn is not supported in this browser");const a={...t,challenge:g(t.challenge),user:{...t.user,id:g(t.user.id)},excludeCredentials:t.excludeCredentials?.map(m)},r={};n&&(r.mediation="conditional"),r.publicKey=a,r.signal=O.createNewAbortSignal();let l;try{l=await navigator.credentials.create(r)}catch(c){throw I({error:c,options:r})}if(!l)throw new Error("Registration was not completed");const{id:d,rawId:o,response:s,type:w}=l;let h;typeof s.getTransports=="function"&&(h=s.getTransports());let p;if(typeof s.getPublicKeyAlgorithm=="function")try{p=s.getPublicKeyAlgorithm()}catch(c){A("getPublicKeyAlgorithm()",c)}let f;if(typeof s.getPublicKey=="function")try{const c=s.getPublicKey();c!==null&&(f=u(c))}catch(c){A("getPublicKey()",c)}let b;if(typeof s.getAuthenticatorData=="function")try{b=u(s.getAuthenticatorData())}catch(c){A("getAuthenticatorData()",c)}return{id:d,rawId:u(o),response:{attestationObject:u(s.attestationObject),clientDataJSON:u(s.clientDataJSON),transports:h,publicKeyAlgorithm:p,publicKey:f,authenticatorData:b},type:w,clientExtensionResults:l.getClientExtensionResults(),authenticatorAttachment:_(l.authenticatorAttachment)}}function A(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
|
|
2
|
+
`,t)}function C(){if(!R())return E.stubThis(new Promise(t=>t(!1)));const e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?E.stubThis(new Promise(t=>t(!1))):E.stubThis(e.isConditionalMediationAvailable())}const E={stubThis:e=>e};function N({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new i({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new i({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const a=globalThis.location.hostname;if(y(a)){if(n.rpId!==a)return new i({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new i({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new i({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}async function v(e){!e.optionsJSON&&e.challenge&&(console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});const{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:a=!0}=e;if(!R())throw new Error("WebAuthn is not supported in this browser");let r;t.allowCredentials?.length!==0&&(r=t.allowCredentials?.map(m));const l={...t,challenge:g(t.challenge),allowCredentials:r},d={};if(n){if(!await C())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&a)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');d.mediation="conditional",l.allowCredentials=[]}d.publicKey=l,d.signal=O.createNewAbortSignal();let o;try{o=await navigator.credentials.get(d)}catch(b){throw N({error:b,options:d})}if(!o)throw new Error("Authentication was not completed");const{id:s,rawId:w,response:h,type:p}=o;let f;return h.userHandle&&(f=u(h.userHandle)),{id:s,rawId:u(w),response:{authenticatorData:u(h.authenticatorData),clientDataJSON:u(h.clientDataJSON),signature:u(h.signature),userHandle:f},type:p,clientExtensionResults:o.getClientExtensionResults(),authenticatorAttachment:_(o.authenticatorAttachment)}}function K(){return R()?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():new Promise(e=>e(!1))}export{O as WebAuthnAbortService,i as WebAuthnError,E as _browserSupportsWebAuthnAutofillInternals,S as _browserSupportsWebAuthnInternals,g as base64URLStringToBuffer,R as browserSupportsWebAuthn,C as browserSupportsWebAuthnAutofill,u as bufferToBase64URLString,K as platformAuthenticatorIsAvailable,v as startAuthentication,D as startRegistration};
|
|
3
|
+
//# sourceMappingURL=index-BDkarAkX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BDkarAkX.js","sources":["../../node_modules/@simplewebauthn/browser/esm/helpers/bufferToBase64URLString.js","../../node_modules/@simplewebauthn/browser/esm/helpers/base64URLStringToBuffer.js","../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthn.js","../../node_modules/@simplewebauthn/browser/esm/helpers/toPublicKeyCredentialDescriptor.js","../../node_modules/@simplewebauthn/browser/esm/helpers/isValidDomain.js","../../node_modules/@simplewebauthn/browser/esm/helpers/webAuthnError.js","../../node_modules/@simplewebauthn/browser/esm/helpers/identifyRegistrationError.js","../../node_modules/@simplewebauthn/browser/esm/helpers/webAuthnAbortService.js","../../node_modules/@simplewebauthn/browser/esm/helpers/toAuthenticatorAttachment.js","../../node_modules/@simplewebauthn/browser/esm/methods/startRegistration.js","../../node_modules/@simplewebauthn/browser/esm/helpers/browserSupportsWebAuthnAutofill.js","../../node_modules/@simplewebauthn/browser/esm/helpers/identifyAuthenticationError.js","../../node_modules/@simplewebauthn/browser/esm/methods/startAuthentication.js","../../node_modules/@simplewebauthn/browser/esm/helpers/platformAuthenticatorIsAvailable.js"],"sourcesContent":["/**\n * Convert the given array buffer into a Base64URL-encoded string. Ideal for converting various\n * credential response ArrayBuffers to string for sending back to the server as JSON.\n *\n * Helper method to compliment `base64URLStringToBuffer`\n */\nexport function bufferToBase64URLString(buffer) {\n const bytes = new Uint8Array(buffer);\n let str = '';\n for (const charCode of bytes) {\n str += String.fromCharCode(charCode);\n }\n const base64String = btoa(str);\n return base64String.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=/g, '');\n}\n","/**\n * Convert from a Base64URL-encoded string to an Array Buffer. Best used when converting a\n * credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or\n * excludeCredentials\n *\n * Helper method to compliment `bufferToBase64URLString`\n */\nexport function base64URLStringToBuffer(base64URLString) {\n // Convert from Base64URL to Base64\n const base64 = base64URLString.replace(/-/g, '+').replace(/_/g, '/');\n /**\n * Pad with '=' until it's a multiple of four\n * (4 - (85 % 4 = 1) = 3) % 4 = 3 padding\n * (4 - (86 % 4 = 2) = 2) % 4 = 2 padding\n * (4 - (87 % 4 = 3) = 1) % 4 = 1 padding\n * (4 - (88 % 4 = 0) = 4) % 4 = 0 padding\n */\n const padLength = (4 - (base64.length % 4)) % 4;\n const padded = base64.padEnd(base64.length + padLength, '=');\n // Convert to a binary string\n const binary = atob(padded);\n // Convert binary string to buffer\n const buffer = new ArrayBuffer(binary.length);\n const bytes = new Uint8Array(buffer);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return buffer;\n}\n","/**\n * Determine if the browser is capable of Webauthn\n */\nexport function browserSupportsWebAuthn() {\n return _browserSupportsWebAuthnInternals.stubThis(globalThis?.PublicKeyCredential !== undefined &&\n typeof globalThis.PublicKeyCredential === 'function');\n}\n/**\n * Make it possible to stub the return value during testing\n * @ignore Don't include this in docs output\n */\nexport const _browserSupportsWebAuthnInternals = {\n stubThis: (value) => value,\n};\n","import { base64URLStringToBuffer } from './base64URLStringToBuffer.js';\nexport function toPublicKeyCredentialDescriptor(descriptor) {\n const { id } = descriptor;\n return {\n ...descriptor,\n id: base64URLStringToBuffer(id),\n /**\n * `descriptor.transports` is an array of our `AuthenticatorTransportFuture` that includes newer\n * transports that TypeScript's DOM lib is ignorant of. Convince TS that our list of transports\n * are fine to pass to WebAuthn since browsers will recognize the new value.\n */\n transports: descriptor.transports,\n };\n}\n","/**\n * A simple test to determine if a hostname is a properly-formatted domain name\n *\n * A \"valid domain\" is defined here: https://url.spec.whatwg.org/#valid-domain\n *\n * Regex was originally sourced from here, then remixed to add punycode support:\n * https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html\n */\nexport function isValidDomain(hostname) {\n return (\n // Consider localhost valid as well since it's okay wrt Secure Contexts\n hostname === 'localhost' ||\n // Support punycode (ACE) or ascii labels and domains\n /^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(hostname));\n}\n","/**\n * A custom Error used to return a more nuanced error detailing _why_ one of the eight documented\n * errors in the spec was raised after calling `navigator.credentials.create()` or\n * `navigator.credentials.get()`:\n *\n * - `AbortError`\n * - `ConstraintError`\n * - `InvalidStateError`\n * - `NotAllowedError`\n * - `NotSupportedError`\n * - `SecurityError`\n * - `TypeError`\n * - `UnknownError`\n *\n * Error messages were determined through investigation of the spec to determine under which\n * scenarios a given error would be raised.\n */\nexport class WebAuthnError extends Error {\n constructor({ message, code, cause, name, }) {\n // @ts-ignore: help Rollup understand that `cause` is okay to set\n super(message, { cause });\n Object.defineProperty(this, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.name = name ?? cause.name;\n this.code = code;\n }\n}\n","import { isValidDomain } from './isValidDomain.js';\nimport { WebAuthnError } from './webAuthnError.js';\n/**\n * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.create()`\n */\nexport function identifyRegistrationError({ error, options, }) {\n const { publicKey } = options;\n if (!publicKey) {\n throw Error('options was missing required publicKey property');\n }\n if (error.name === 'AbortError') {\n if (options.signal instanceof AbortSignal) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)\n return new WebAuthnError({\n message: 'Registration ceremony was sent an abort signal',\n code: 'ERROR_CEREMONY_ABORTED',\n cause: error,\n });\n }\n }\n else if (error.name === 'ConstraintError') {\n if (publicKey.authenticatorSelection?.requireResidentKey === true) {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 4)\n return new WebAuthnError({\n message: 'Discoverable credentials were required but no available authenticator supported it',\n code: 'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',\n cause: error,\n });\n }\n else if (\n // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024\n options.mediation === 'conditional' &&\n publicKey.authenticatorSelection?.userVerification === 'required') {\n // https://w3c.github.io/webauthn/#sctn-createCredential (Step 22.4)\n return new WebAuthnError({\n message: 'User verification was required during automatic registration but it could not be performed',\n code: 'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',\n cause: error,\n });\n }\n else if (publicKey.authenticatorSelection?.userVerification === 'required') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 5)\n return new WebAuthnError({\n message: 'User verification was required but no available authenticator supported it',\n code: 'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',\n cause: error,\n });\n }\n }\n else if (error.name === 'InvalidStateError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 20)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 3)\n return new WebAuthnError({\n message: 'The authenticator was previously registered',\n code: 'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',\n cause: error,\n });\n }\n else if (error.name === 'NotAllowedError') {\n /**\n * Pass the error directly through. Platforms are overloading this error beyond what the spec\n * defines and we don't want to overwrite potentially useful error messages.\n */\n return new WebAuthnError({\n message: error.message,\n code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',\n cause: error,\n });\n }\n else if (error.name === 'NotSupportedError') {\n const validPubKeyCredParams = publicKey.pubKeyCredParams.filter((param) => param.type === 'public-key');\n if (validPubKeyCredParams.length === 0) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 10)\n return new WebAuthnError({\n message: 'No entry in pubKeyCredParams was of type \"public-key\"',\n code: 'ERROR_MALFORMED_PUBKEYCREDPARAMS',\n cause: error,\n });\n }\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 2)\n return new WebAuthnError({\n message: 'No available authenticator supported any of the specified pubKeyCredParams algorithms',\n code: 'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',\n cause: error,\n });\n }\n else if (error.name === 'SecurityError') {\n const effectiveDomain = globalThis.location.hostname;\n if (!isValidDomain(effectiveDomain)) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 7)\n return new WebAuthnError({\n message: `${globalThis.location.hostname} is an invalid domain`,\n code: 'ERROR_INVALID_DOMAIN',\n cause: error,\n });\n }\n else if (publicKey.rp.id !== effectiveDomain) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 8)\n return new WebAuthnError({\n message: `The RP ID \"${publicKey.rp.id}\" is invalid for this domain`,\n code: 'ERROR_INVALID_RP_ID',\n cause: error,\n });\n }\n }\n else if (error.name === 'TypeError') {\n if (publicKey.user.id.byteLength < 1 || publicKey.user.id.byteLength > 64) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 5)\n return new WebAuthnError({\n message: 'User ID was not between 1 and 64 characters',\n code: 'ERROR_INVALID_USER_ID_LENGTH',\n cause: error,\n });\n }\n }\n else if (error.name === 'UnknownError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 1)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-make-cred (Step 8)\n return new WebAuthnError({\n message: 'The authenticator was unable to process the specified options, or could not create a new credential',\n code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',\n cause: error,\n });\n }\n return error;\n}\n","class BaseWebAuthnAbortService {\n constructor() {\n Object.defineProperty(this, \"controller\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n }\n createNewAbortSignal() {\n // Abort any existing calls to navigator.credentials.create() or navigator.credentials.get()\n if (this.controller) {\n const abortError = new Error('Cancelling existing WebAuthn API call for new one');\n abortError.name = 'AbortError';\n this.controller.abort(abortError);\n }\n const newController = new AbortController();\n this.controller = newController;\n return newController.signal;\n }\n cancelCeremony() {\n if (this.controller) {\n const abortError = new Error('Manually cancelling existing WebAuthn API call');\n abortError.name = 'AbortError';\n this.controller.abort(abortError);\n this.controller = undefined;\n }\n }\n}\n/**\n * A service singleton to help ensure that only a single WebAuthn ceremony is active at a time.\n *\n * Users of **@simplewebauthn/browser** shouldn't typically need to use this, but it can help e.g.\n * developers building projects that use client-side routing to better control the behavior of\n * their UX in response to router navigation events.\n */\nexport const WebAuthnAbortService = new BaseWebAuthnAbortService();\n","const attachments = ['cross-platform', 'platform'];\n/**\n * If possible coerce a `string` value into a known `AuthenticatorAttachment`\n */\nexport function toAuthenticatorAttachment(attachment) {\n if (!attachment) {\n return;\n }\n if (attachments.indexOf(attachment) < 0) {\n return;\n }\n return attachment;\n}\n","import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString.js';\nimport { base64URLStringToBuffer } from '../helpers/base64URLStringToBuffer.js';\nimport { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn.js';\nimport { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor.js';\nimport { identifyRegistrationError } from '../helpers/identifyRegistrationError.js';\nimport { WebAuthnAbortService } from '../helpers/webAuthnAbortService.js';\nimport { toAuthenticatorAttachment } from '../helpers/toAuthenticatorAttachment.js';\n/**\n * Begin authenticator \"registration\" via WebAuthn attestation\n *\n * @param optionsJSON Output from **@simplewebauthn/server**'s `generateRegistrationOptions()`\n * @param useAutoRegister (Optional) Try to silently create a passkey with the password manager that the user just signed in with. Defaults to `false`.\n */\nexport async function startRegistration(options) {\n // @ts-ignore: Intentionally check for old call structure to warn about improper API call\n if (!options.optionsJSON && options.challenge) {\n console.warn('startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.');\n // @ts-ignore: Reassign the options, passed in as a positional argument, to the expected variable\n options = { optionsJSON: options };\n }\n const { optionsJSON, useAutoRegister = false } = options;\n if (!browserSupportsWebAuthn()) {\n throw new Error('WebAuthn is not supported in this browser');\n }\n // We need to convert some values to Uint8Arrays before passing the credentials to the navigator\n const publicKey = {\n ...optionsJSON,\n challenge: base64URLStringToBuffer(optionsJSON.challenge),\n user: {\n ...optionsJSON.user,\n id: base64URLStringToBuffer(optionsJSON.user.id),\n },\n excludeCredentials: optionsJSON.excludeCredentials?.map(toPublicKeyCredentialDescriptor),\n };\n // Prepare options for `.create()`\n const createOptions = {};\n /**\n * Try to use conditional create to register a passkey for the user with the password manager\n * the user just used to authenticate with. The user won't be shown any prominent UI by the\n * browser.\n */\n if (useAutoRegister) {\n // @ts-ignore: `mediation` doesn't yet exist on CredentialCreationOptions but it's possible as of Sept 2024\n createOptions.mediation = 'conditional';\n }\n // Finalize options\n createOptions.publicKey = publicKey;\n // Set up the ability to cancel this request if the user attempts another\n createOptions.signal = WebAuthnAbortService.createNewAbortSignal();\n // Wait for the user to complete attestation\n let credential;\n try {\n credential = (await navigator.credentials.create(createOptions));\n }\n catch (err) {\n throw identifyRegistrationError({ error: err, options: createOptions });\n }\n if (!credential) {\n throw new Error('Registration was not completed');\n }\n const { id, rawId, response, type } = credential;\n // Continue to play it safe with `getTransports()` for now, even when L3 types say it's required\n let transports = undefined;\n if (typeof response.getTransports === 'function') {\n transports = response.getTransports();\n }\n // L3 says this is required, but browser and webview support are still not guaranteed.\n let responsePublicKeyAlgorithm = undefined;\n if (typeof response.getPublicKeyAlgorithm === 'function') {\n try {\n responsePublicKeyAlgorithm = response.getPublicKeyAlgorithm();\n }\n catch (error) {\n warnOnBrokenImplementation('getPublicKeyAlgorithm()', error);\n }\n }\n let responsePublicKey = undefined;\n if (typeof response.getPublicKey === 'function') {\n try {\n const _publicKey = response.getPublicKey();\n if (_publicKey !== null) {\n responsePublicKey = bufferToBase64URLString(_publicKey);\n }\n }\n catch (error) {\n warnOnBrokenImplementation('getPublicKey()', error);\n }\n }\n // L3 says this is required, but browser and webview support are still not guaranteed.\n let responseAuthenticatorData;\n if (typeof response.getAuthenticatorData === 'function') {\n try {\n responseAuthenticatorData = bufferToBase64URLString(response.getAuthenticatorData());\n }\n catch (error) {\n warnOnBrokenImplementation('getAuthenticatorData()', error);\n }\n }\n return {\n id,\n rawId: bufferToBase64URLString(rawId),\n response: {\n attestationObject: bufferToBase64URLString(response.attestationObject),\n clientDataJSON: bufferToBase64URLString(response.clientDataJSON),\n transports,\n publicKeyAlgorithm: responsePublicKeyAlgorithm,\n publicKey: responsePublicKey,\n authenticatorData: responseAuthenticatorData,\n },\n type,\n clientExtensionResults: credential.getClientExtensionResults(),\n authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),\n };\n}\n/**\n * Visibly warn when we detect an issue related to a passkey provider intercepting WebAuthn API\n * calls\n */\nfunction warnOnBrokenImplementation(methodName, cause) {\n console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${methodName}. You should report this error to them.\\n`, cause);\n}\n","import { browserSupportsWebAuthn } from './browserSupportsWebAuthn.js';\n/**\n * Determine if the browser supports conditional UI, so that WebAuthn credentials can\n * be shown to the user in the browser's typical password autofill popup.\n */\nexport function browserSupportsWebAuthnAutofill() {\n if (!browserSupportsWebAuthn()) {\n return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));\n }\n /**\n * I don't like the `as unknown` here but there's a `declare var PublicKeyCredential` in\n * TS' DOM lib that's making it difficult for me to just go `as PublicKeyCredentialFuture` as I\n * want. I think I'm fine with this for now since it's _supposed_ to be temporary, until TS types\n * have a chance to catch up.\n */\n const globalPublicKeyCredential = globalThis\n .PublicKeyCredential;\n if (globalPublicKeyCredential?.isConditionalMediationAvailable === undefined) {\n return _browserSupportsWebAuthnAutofillInternals.stubThis(new Promise((resolve) => resolve(false)));\n }\n return _browserSupportsWebAuthnAutofillInternals.stubThis(globalPublicKeyCredential.isConditionalMediationAvailable());\n}\n// Make it possible to stub the return value during testing\nexport const _browserSupportsWebAuthnAutofillInternals = {\n stubThis: (value) => value,\n};\n","import { isValidDomain } from './isValidDomain.js';\nimport { WebAuthnError } from './webAuthnError.js';\n/**\n * Attempt to intuit _why_ an error was raised after calling `navigator.credentials.get()`\n */\nexport function identifyAuthenticationError({ error, options, }) {\n const { publicKey } = options;\n if (!publicKey) {\n throw Error('options was missing required publicKey property');\n }\n if (error.name === 'AbortError') {\n if (options.signal instanceof AbortSignal) {\n // https://www.w3.org/TR/webauthn-2/#sctn-createCredential (Step 16)\n return new WebAuthnError({\n message: 'Authentication ceremony was sent an abort signal',\n code: 'ERROR_CEREMONY_ABORTED',\n cause: error,\n });\n }\n }\n else if (error.name === 'NotAllowedError') {\n /**\n * Pass the error directly through. Platforms are overloading this error beyond what the spec\n * defines and we don't want to overwrite potentially useful error messages.\n */\n return new WebAuthnError({\n message: error.message,\n code: 'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',\n cause: error,\n });\n }\n else if (error.name === 'SecurityError') {\n const effectiveDomain = globalThis.location.hostname;\n if (!isValidDomain(effectiveDomain)) {\n // https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 5)\n return new WebAuthnError({\n message: `${globalThis.location.hostname} is an invalid domain`,\n code: 'ERROR_INVALID_DOMAIN',\n cause: error,\n });\n }\n else if (publicKey.rpId !== effectiveDomain) {\n // https://www.w3.org/TR/webauthn-2/#sctn-discover-from-external-source (Step 6)\n return new WebAuthnError({\n message: `The RP ID \"${publicKey.rpId}\" is invalid for this domain`,\n code: 'ERROR_INVALID_RP_ID',\n cause: error,\n });\n }\n }\n else if (error.name === 'UnknownError') {\n // https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 1)\n // https://www.w3.org/TR/webauthn-2/#sctn-op-get-assertion (Step 12)\n return new WebAuthnError({\n message: 'The authenticator was unable to process the specified options, or could not create a new assertion signature',\n code: 'ERROR_AUTHENTICATOR_GENERAL_ERROR',\n cause: error,\n });\n }\n return error;\n}\n","import { bufferToBase64URLString } from '../helpers/bufferToBase64URLString.js';\nimport { base64URLStringToBuffer } from '../helpers/base64URLStringToBuffer.js';\nimport { browserSupportsWebAuthn } from '../helpers/browserSupportsWebAuthn.js';\nimport { browserSupportsWebAuthnAutofill } from '../helpers/browserSupportsWebAuthnAutofill.js';\nimport { toPublicKeyCredentialDescriptor } from '../helpers/toPublicKeyCredentialDescriptor.js';\nimport { identifyAuthenticationError } from '../helpers/identifyAuthenticationError.js';\nimport { WebAuthnAbortService } from '../helpers/webAuthnAbortService.js';\nimport { toAuthenticatorAttachment } from '../helpers/toAuthenticatorAttachment.js';\n/**\n * Begin authenticator \"login\" via WebAuthn assertion\n *\n * @param optionsJSON Output from **@simplewebauthn/server**'s `generateAuthenticationOptions()`\n * @param useBrowserAutofill (Optional) Initialize conditional UI to enable logging in via browser autofill prompts. Defaults to `false`.\n * @param verifyBrowserAutofillInput (Optional) Ensure a suitable `<input>` element is present when `useBrowserAutofill` is `true`. Defaults to `true`.\n */\nexport async function startAuthentication(options) {\n // @ts-ignore: Intentionally check for old call structure to warn about improper API call\n if (!options.optionsJSON && options.challenge) {\n console.warn('startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.');\n // @ts-ignore: Reassign the options, passed in as a positional argument, to the expected variable\n options = { optionsJSON: options };\n }\n const { optionsJSON, useBrowserAutofill = false, verifyBrowserAutofillInput = true, } = options;\n if (!browserSupportsWebAuthn()) {\n throw new Error('WebAuthn is not supported in this browser');\n }\n // We need to avoid passing empty array to avoid blocking retrieval\n // of public key\n let allowCredentials;\n if (optionsJSON.allowCredentials?.length !== 0) {\n allowCredentials = optionsJSON.allowCredentials?.map(toPublicKeyCredentialDescriptor);\n }\n // We need to convert some values to Uint8Arrays before passing the credentials to the navigator\n const publicKey = {\n ...optionsJSON,\n challenge: base64URLStringToBuffer(optionsJSON.challenge),\n allowCredentials,\n };\n // Prepare options for `.get()`\n const getOptions = {};\n /**\n * Set up the page to prompt the user to select a credential for authentication via the browser's\n * input autofill mechanism.\n */\n if (useBrowserAutofill) {\n if (!(await browserSupportsWebAuthnAutofill())) {\n throw Error('Browser does not support WebAuthn autofill');\n }\n // Check for an <input> with \"webauthn\" in its `autocomplete` attribute\n const eligibleInputs = document.querySelectorAll(\"input[autocomplete$='webauthn']\");\n // WebAuthn autofill requires at least one valid input\n if (eligibleInputs.length < 1 && verifyBrowserAutofillInput) {\n throw Error('No <input> with \"webauthn\" as the only or last value in its `autocomplete` attribute was detected');\n }\n // `CredentialMediationRequirement` doesn't know about \"conditional\" yet as of\n // typescript@4.6.3\n getOptions.mediation = 'conditional';\n // Conditional UI requires an empty allow list\n publicKey.allowCredentials = [];\n }\n // Finalize options\n getOptions.publicKey = publicKey;\n // Set up the ability to cancel this request if the user attempts another\n getOptions.signal = WebAuthnAbortService.createNewAbortSignal();\n // Wait for the user to complete assertion\n let credential;\n try {\n credential = (await navigator.credentials.get(getOptions));\n }\n catch (err) {\n throw identifyAuthenticationError({ error: err, options: getOptions });\n }\n if (!credential) {\n throw new Error('Authentication was not completed');\n }\n const { id, rawId, response, type } = credential;\n let userHandle = undefined;\n if (response.userHandle) {\n userHandle = bufferToBase64URLString(response.userHandle);\n }\n // Convert values to base64 to make it easier to send back to the server\n return {\n id,\n rawId: bufferToBase64URLString(rawId),\n response: {\n authenticatorData: bufferToBase64URLString(response.authenticatorData),\n clientDataJSON: bufferToBase64URLString(response.clientDataJSON),\n signature: bufferToBase64URLString(response.signature),\n userHandle,\n },\n type,\n clientExtensionResults: credential.getClientExtensionResults(),\n authenticatorAttachment: toAuthenticatorAttachment(credential.authenticatorAttachment),\n };\n}\n","import { browserSupportsWebAuthn } from './browserSupportsWebAuthn.js';\n/**\n * Determine whether the browser can communicate with a built-in authenticator, like\n * Touch ID, Android fingerprint scanner, or Windows Hello.\n *\n * This method will _not_ be able to tell you the name of the platform authenticator.\n */\nexport function platformAuthenticatorIsAvailable() {\n if (!browserSupportsWebAuthn()) {\n return new Promise((resolve) => resolve(false));\n }\n return PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable();\n}\n"],"names":["bufferToBase64URLString","buffer","bytes","str","charCode","base64URLStringToBuffer","base64URLString","base64","padLength","padded","binary","i","browserSupportsWebAuthn","_browserSupportsWebAuthnInternals","value","toPublicKeyCredentialDescriptor","descriptor","id","isValidDomain","hostname","WebAuthnError","message","code","cause","name","identifyRegistrationError","error","options","publicKey","param","effectiveDomain","BaseWebAuthnAbortService","abortError","newController","WebAuthnAbortService","attachments","toAuthenticatorAttachment","attachment","startRegistration","optionsJSON","useAutoRegister","createOptions","credential","err","rawId","response","type","transports","responsePublicKeyAlgorithm","warnOnBrokenImplementation","responsePublicKey","_publicKey","responseAuthenticatorData","methodName","browserSupportsWebAuthnAutofill","_browserSupportsWebAuthnAutofillInternals","resolve","globalPublicKeyCredential","identifyAuthenticationError","startAuthentication","useBrowserAutofill","verifyBrowserAutofillInput","allowCredentials","getOptions","userHandle","platformAuthenticatorIsAvailable"],"mappings":"AAMO,SAASA,EAAwBC,EAAQ,CAC5C,MAAMC,EAAQ,IAAI,WAAWD,CAAM,EACnC,IAAIE,EAAM,GACV,UAAWC,KAAYF,EACnBC,GAAO,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,CAAE,MAAOf,EAAK,QAASoB,CAAU,CAAE,CACzE,CACA,GAAI,CAACrB,EACD,MAAM,IAAI,MAAM,kCAAkC,EAEtD,KAAM,CAAE,GAAAzB,EAAI,MAAA2B,EAAO,SAAAC,EAAU,KAAAC,CAAI,EAAKJ,EACtC,IAAIsB,EACJ,OAAInB,EAAS,aACTmB,EAAahE,EAAwB6C,EAAS,UAAU,GAGrD,CACH,GAAA5B,EACA,MAAOjB,EAAwB4C,CAAK,EACpC,SAAU,CACN,kBAAmB5C,EAAwB6C,EAAS,iBAAiB,EACrE,eAAgB7C,EAAwB6C,EAAS,cAAc,EAC/D,UAAW7C,EAAwB6C,EAAS,SAAS,EACrD,WAAAmB,CACZ,EACQ,KAAAlB,EACA,uBAAwBJ,EAAW,0BAAyB,EAC5D,wBAAyBN,EAA0BM,EAAW,uBAAuB,CAC7F,CACA,CCvFO,SAASuB,GAAmC,CAC/C,OAAKrD,EAAuB,EAGrB,oBAAoB,8CAA6C,EAF7D,IAAI,QAAS4C,GAAYA,EAAQ,EAAK,CAAC,CAGtD","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as u,R as B}from"./index-CrN8I5Az.js";import{r as F}from"./index-D0OPOe3j.js";function N(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,s,r,a,o=[],f="",h=e.split("/");for(h[0]||h.shift();r=h.shift();)n=r[0],n==="*"?(o.push(n),f+=r[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(s=r.indexOf("?",1),a=r.indexOf(".",1),o.push(r.substring(1,~s?s:~a?a:r.length)),f+=~s&&!~a?"(?:/([^/]+?))?":"/([^/]+?)",~a&&(f+=(~s?"?":"")+"\\"+r.substring(a))):f+="/"+r;return{keys:o,pattern:new RegExp("^"+f+(t?"(?=$|/)":"/?$"),"i")}}var w={exports:{}},x={};var L;function T(){if(L)return x;L=1;var e=F();function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,a=e.useLayoutEffect,o=e.useDebugValue;function f(c,d){var y=d(),E=s({inst:{value:y,getSnapshot:d}}),p=E[0].inst,m=E[1];return a(function(){p.value=y,p.getSnapshot=d,h(p)&&m({inst:p})},[c,y,d]),r(function(){return h(p)&&m({inst:p}),c(function(){h(p)&&m({inst:p})})},[c]),o(y),y}function h(c){var d=c.getSnapshot;c=c.value;try{var y=d();return!n(c,y)}catch{return!0}}function l(c,d){return d()}var i=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:f;return x.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:i,x}var C;function z(){return C||(C=1,w.exports=T()),w.exports}var G=z();const Q=B.useInsertionEffect,J=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$=J?u.useLayoutEffect:u.useEffect,W=Q||$,g=e=>{const t=u.useRef([e,(...n)=>t[0](...n)]).current;return W(()=>{t[0]=e}),t[1]},X="popstate",R="pushState",b="replaceState",Y="hashchange",O=[X,R,b,Y],Z=e=>{for(const t of O)addEventListener(t,e);return()=>{for(const t of O)removeEventListener(t,e)}},q=(e,t)=>G.useSyncExternalStore(Z,e,t),ee=()=>location.search,te=({ssrSearch:e=""}={})=>q(ee,()=>e),j=()=>location.pathname,ne=({ssrPath:e}={})=>q(j,e?()=>e:j),re=(e,{replace:t=!1,state:n=null}={})=>history[t?b:R](n,"",e),se=(e={})=>[ne(e),re],_=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[_]>"u"){for(const e of[R,b]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),n}}Object.defineProperty(window,_,{value:!0})}const oe=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",D=(e="")=>e==="/"?"":e,ae=(e,t)=>e[0]==="~"?e.slice(1):D(t)+e,ce=(e="",t)=>oe(P(D(e)),P(t)),ue=e=>e[0]==="?"?e.slice(1):e,P=e=>{try{return decodeURI(e)}catch{return e}},ie=e=>P(ue(e)),I={hook:se,searchHook:te,parser:N,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},K=u.createContext(I),S=()=>u.useContext(K),V={},H=u.createContext(V),fe=()=>u.useContext(H),v=e=>{const[t,n]=e.hook(e);return[ce(e.base,t),g((s,r)=>n(ae(s,e.base),r))]},M=()=>v(S()),le=()=>{const e=S();return ie(e.searchHook(e))},k=(e,t,n,s)=>{const{pattern:r,keys:a}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",s),o=r.exec(n)||[],[f,...h]=o;return f!==void 0?[!0,(()=>{const l=a!==!1?Object.fromEntries(a.map((c,d)=>[c,h[d]])):o.groups;let i={...h};return l&&Object.assign(i,l),i})(),...s?[f]:[]]:[!1,null]},ye=e=>k(S().parser,e,M()[0]),he=({children:e,...t})=>{const n=S(),s=t.hook?I:n;let r=s;const[a,o]=t.ssrPath?.split("?")??[];o&&(t.ssrSearch=o,t.ssrPath=a),t.hrefs=t.hrefs??t.hook?.hrefs;let f=u.useRef({}),h=f.current,l=h;for(let i in s){const c=i==="base"?s[i]+(t[i]||""):t[i]||s[i];h===l&&c!==l[i]&&(f.current=l={...l}),l[i]=c,(c!==s[i]||c!==r[i])&&(r=l)}return u.createElement(K.Provider,{value:r,children:e})},U=({children:e,component:t},n)=>t?u.createElement(t,{params:n}):typeof e=="function"?e(n):e,de=e=>{let t=u.useRef(V);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([s,r])=>r!==n[s])?e:n};function Se(){const[e,t]=M(),n=le(),s=u.useMemo(()=>new URLSearchParams(n),[n]);let r=s;const a=g((o,f)=>{r=new URLSearchParams(typeof o=="function"?o(r):o),t(e+"?"+r,f)});return[s,a]}const Ee=({path:e,nest:t,match:n,...s})=>{const r=S(),[a]=v(r),[o,f,h]=n??k(r.parser,e,a,t),l=de({...fe(),...f});if(!o)return null;const i=h?u.createElement(he,{base:h},U(s,l)):U(s,l);return u.createElement(H.Provider,{value:l,children:i})},ve=u.forwardRef((e,t)=>{const n=S(),[s,r]=v(n),{to:a="",href:o=a,onClick:f,asChild:h,children:l,className:i,replace:c,state:d,...y}=e,E=g(m=>{m.ctrlKey||m.metaKey||m.altKey||m.shiftKey||m.button!==0||(f?.(m),m.defaultPrevented||(m.preventDefault(),r(o,e)))}),p=n.hrefs(o[0]==="~"?o.slice(1):n.base+o,n);return h&&u.isValidElement(l)?u.cloneElement(l,{onClick:E,href:p}):u.createElement("a",{...y,onClick:E,href:p,className:i?.call?i(s===o):i,children:l,ref:t})}),A=e=>Array.isArray(e)?e.flatMap(t=>A(t&&t.type===u.Fragment?t.props.children:t)):[e],ge=({children:e,location:t})=>{const n=S(),[s]=v(n);for(const r of A(e)){let a=0;if(u.isValidElement(r)&&(a=k(n.parser,r.props.path,t||s,r.props.nest))[0])return u.cloneElement(r,{match:a})}return null},we=e=>{const{to:t,href:n=t}=e,s=S(),[,r]=v(s),a=g(()=>r(t||n,e)),{ssrContext:o}=s;return $(()=>{a()},[]),o&&(o.redirectTo=t),null};export{ve as L,Ee as R,ge as S,
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{r as u,R as B}from"./index-CrN8I5Az.js";import{r as F}from"./index-D0OPOe3j.js";function N(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,s,r,a,o=[],f="",h=e.split("/");for(h[0]||h.shift();r=h.shift();)n=r[0],n==="*"?(o.push(n),f+=r[1]==="?"?"(?:/(.*))?":"/(.*)"):n===":"?(s=r.indexOf("?",1),a=r.indexOf(".",1),o.push(r.substring(1,~s?s:~a?a:r.length)),f+=~s&&!~a?"(?:/([^/]+?))?":"/([^/]+?)",~a&&(f+=(~s?"?":"")+"\\"+r.substring(a))):f+="/"+r;return{keys:o,pattern:new RegExp("^"+f+(t?"(?=$|/)":"/?$"),"i")}}var w={exports:{}},x={};var L;function T(){if(L)return x;L=1;var e=F();function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,r=e.useEffect,a=e.useLayoutEffect,o=e.useDebugValue;function f(c,d){var y=d(),E=s({inst:{value:y,getSnapshot:d}}),p=E[0].inst,m=E[1];return a(function(){p.value=y,p.getSnapshot=d,h(p)&&m({inst:p})},[c,y,d]),r(function(){return h(p)&&m({inst:p}),c(function(){h(p)&&m({inst:p})})},[c]),o(y),y}function h(c){var d=c.getSnapshot;c=c.value;try{var y=d();return!n(c,y)}catch{return!0}}function l(c,d){return d()}var i=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:f;return x.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:i,x}var C;function z(){return C||(C=1,w.exports=T()),w.exports}var G=z();const Q=B.useInsertionEffect,J=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$=J?u.useLayoutEffect:u.useEffect,W=Q||$,g=e=>{const t=u.useRef([e,(...n)=>t[0](...n)]).current;return W(()=>{t[0]=e}),t[1]},X="popstate",R="pushState",b="replaceState",Y="hashchange",O=[X,R,b,Y],Z=e=>{for(const t of O)addEventListener(t,e);return()=>{for(const t of O)removeEventListener(t,e)}},q=(e,t)=>G.useSyncExternalStore(Z,e,t),ee=()=>location.search,te=({ssrSearch:e=""}={})=>q(ee,()=>e),j=()=>location.pathname,ne=({ssrPath:e}={})=>q(j,e?()=>e:j),re=(e,{replace:t=!1,state:n=null}={})=>history[t?b:R](n,"",e),se=(e={})=>[ne(e),re],_=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[_]>"u"){for(const e of[R,b]){const t=history[e];history[e]=function(){const n=t.apply(this,arguments),s=new Event(e);return s.arguments=arguments,dispatchEvent(s),n}}Object.defineProperty(window,_,{value:!0})}const oe=(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())?"~"+t:t.slice(e.length)||"/",D=(e="")=>e==="/"?"":e,ae=(e,t)=>e[0]==="~"?e.slice(1):D(t)+e,ce=(e="",t)=>oe(P(D(e)),P(t)),ue=e=>e[0]==="?"?e.slice(1):e,P=e=>{try{return decodeURI(e)}catch{return e}},ie=e=>P(ue(e)),I={hook:se,searchHook:te,parser:N,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:e=>e},K=u.createContext(I),S=()=>u.useContext(K),V={},H=u.createContext(V),fe=()=>u.useContext(H),v=e=>{const[t,n]=e.hook(e);return[ce(e.base,t),g((s,r)=>n(ae(s,e.base),r))]},M=()=>v(S()),le=()=>{const e=S();return ie(e.searchHook(e))},k=(e,t,n,s)=>{const{pattern:r,keys:a}=t instanceof RegExp?{keys:!1,pattern:t}:e(t||"*",s),o=r.exec(n)||[],[f,...h]=o;return f!==void 0?[!0,(()=>{const l=a!==!1?Object.fromEntries(a.map((c,d)=>[c,h[d]])):o.groups;let i={...h};return l&&Object.assign(i,l),i})(),...s?[f]:[]]:[!1,null]},ye=e=>k(S().parser,e,M()[0]),he=({children:e,...t})=>{const n=S(),s=t.hook?I:n;let r=s;const[a,o]=t.ssrPath?.split("?")??[];o&&(t.ssrSearch=o,t.ssrPath=a),t.hrefs=t.hrefs??t.hook?.hrefs;let f=u.useRef({}),h=f.current,l=h;for(let i in s){const c=i==="base"?s[i]+(t[i]||""):t[i]||s[i];h===l&&c!==l[i]&&(f.current=l={...l}),l[i]=c,(c!==s[i]||c!==r[i])&&(r=l)}return u.createElement(K.Provider,{value:r,children:e})},U=({children:e,component:t},n)=>t?u.createElement(t,{params:n}):typeof e=="function"?e(n):e,de=e=>{let t=u.useRef(V);const n=t.current;return t.current=Object.keys(e).length!==Object.keys(n).length||Object.entries(e).some(([s,r])=>r!==n[s])?e:n};function Se(){const[e,t]=M(),n=le(),s=u.useMemo(()=>new URLSearchParams(n),[n]);let r=s;const a=g((o,f)=>{r=new URLSearchParams(typeof o=="function"?o(r):o),t(e+"?"+r,f)});return[s,a]}const Ee=({path:e,nest:t,match:n,...s})=>{const r=S(),[a]=v(r),[o,f,h]=n??k(r.parser,e,a,t),l=de({...fe(),...f});if(!o)return null;const i=h?u.createElement(he,{base:h},U(s,l)):U(s,l);return u.createElement(H.Provider,{value:l,children:i})},ve=u.forwardRef((e,t)=>{const n=S(),[s,r]=v(n),{to:a="",href:o=a,onClick:f,asChild:h,children:l,className:i,replace:c,state:d,...y}=e,E=g(m=>{m.ctrlKey||m.metaKey||m.altKey||m.shiftKey||m.button!==0||(f?.(m),m.defaultPrevented||(m.preventDefault(),r(o,e)))}),p=n.hrefs(o[0]==="~"?o.slice(1):n.base+o,n);return h&&u.isValidElement(l)?u.cloneElement(l,{onClick:E,href:p}):u.createElement("a",{...y,onClick:E,href:p,className:i?.call?i(s===o):i,children:l,ref:t})}),A=e=>Array.isArray(e)?e.flatMap(t=>A(t&&t.type===u.Fragment?t.props.children:t)):[e],ge=({children:e,location:t})=>{const n=S(),[s]=v(n);for(const r of A(e)){let a=0;if(u.isValidElement(r)&&(a=k(n.parser,r.props.path,t||s,r.props.nest))[0])return u.cloneElement(r,{match:a})}return null},we=e=>{const{to:t,href:n=t}=e,s=S(),[,r]=v(s),a=g(()=>r(t||n,e)),{ssrContext:o}=s;return $(()=>{a()},[]),o&&(o.redirectTo=t),null};export{ve as L,Ee as R,ge as S,ye as a,he as b,se as c,we as d,fe as e,S as f,le as g,Se as h,k as m,M as u};
|
|
2
|
+
//# sourceMappingURL=index-DEL-PD_8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-2cgXLhrt.js","sources":["../../node_modules/regexparam/dist/index.mjs","../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../../node_modules/use-sync-external-store/shim/index.js","../../node_modules/wouter/esm/react-deps.js","../../node_modules/wouter/esm/use-browser-location.js","../../node_modules/wouter/esm/index.js"],"sourcesContent":["/**\n * @param {string|RegExp} input The route pattern\n * @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.\n */\nexport function parse(input, loose) {\n\tif (input instanceof RegExp) return { keys:false, pattern:input };\n\tvar c, o, tmp, ext, keys=[], pattern='', arr = input.split('/');\n\tarr[0] || arr.shift();\n\n\twhile (tmp = arr.shift()) {\n\t\tc = tmp[0];\n\t\tif (c === '*') {\n\t\t\tkeys.push(c);\n\t\t\tpattern += tmp[1] === '?' ? '(?:/(.*))?' : '/(.*)';\n\t\t} else if (c === ':') {\n\t\t\to = tmp.indexOf('?', 1);\n\t\t\text = tmp.indexOf('.', 1);\n\t\t\tkeys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) );\n\t\t\tpattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';\n\t\t\tif (!!~ext) pattern += (!!~o ? '?' : '') + '\\\\' + tmp.substring(ext);\n\t\t} else {\n\t\t\tpattern += '/' + tmp;\n\t\t}\n\t}\n\n\treturn {\n\t\tkeys: keys,\n\t\tpattern: new RegExp('^' + pattern + (loose ? '(?=$|\\/)' : '\\/?$'), 'i')\n\t};\n}\n\nvar RGX = /(\\/|^)([:*][^/]*?)(\\?)?(?=[/.]|$)/g;\n\n// error if key missing?\nexport function inject(route, values) {\n\treturn route.replace(RGX, (x, lead, key, optional) => {\n\t\tx = values[key=='*' ? key : key.substring(1)];\n\t\treturn x ? '/'+x : (optional || key=='*') ? '' : '/' + key;\n\t});\n}\n","/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","import * as React from 'react';\nexport { Fragment, cloneElement, createContext, createElement, forwardRef, isValidElement, useContext, useMemo, useRef, useState } from 'react';\nexport { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';\n\n// React.useInsertionEffect is not available in React <18\n// This hack fixes a transpilation issue on some apps\nconst useBuiltinInsertionEffect = React[\"useInsertion\" + \"Effect\"];\n\n// Copied from:\n// https://github.com/facebook/react/blob/main/packages/shared/ExecutionEnvironment.js\nconst canUseDOM = !!(\n typeof window !== \"undefined\" &&\n typeof window.document !== \"undefined\" &&\n typeof window.document.createElement !== \"undefined\"\n);\n\n// Copied from:\n// https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.ts\n// \"React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\"\nconst useIsomorphicLayoutEffect = canUseDOM\n ? React.useLayoutEffect\n : React.useEffect;\n\n// useInsertionEffect is already a noop on the server.\n// See: https://github.com/facebook/react/blob/main/packages/react-server/src/ReactFizzHooks.js\nconst useInsertionEffect =\n useBuiltinInsertionEffect || useIsomorphicLayoutEffect;\n\n// Userland polyfill while we wait for the forthcoming\n// https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md\n// Note: \"A high-fidelity polyfill for useEvent is not possible because\n// there is no lifecycle or Hook in React that we can use to switch\n// .current at the right timing.\"\n// So we will have to make do with this \"close enough\" approach for now.\nconst useEvent = (fn) => {\n const ref = React.useRef([fn, (...args) => ref[0](...args)]).current;\n // Per Dan Abramov: useInsertionEffect executes marginally closer to the\n // correct timing for ref synchronization than useLayoutEffect on React 18.\n // See: https://github.com/facebook/react/pull/25881#issuecomment-1356244360\n useInsertionEffect(() => {\n ref[0] = fn;\n });\n return ref[1];\n};\n\nexport { useEvent, useInsertionEffect, useIsomorphicLayoutEffect };\n","import { useSyncExternalStore } from './react-deps.js';\n\n/**\n * History API docs @see https://developer.mozilla.org/en-US/docs/Web/API/History\n */\nconst eventPopstate = \"popstate\";\nconst eventPushState = \"pushState\";\nconst eventReplaceState = \"replaceState\";\nconst eventHashchange = \"hashchange\";\nconst events = [\n eventPopstate,\n eventPushState,\n eventReplaceState,\n eventHashchange,\n];\n\nconst subscribeToLocationUpdates = (callback) => {\n for (const event of events) {\n addEventListener(event, callback);\n }\n return () => {\n for (const event of events) {\n removeEventListener(event, callback);\n }\n };\n};\n\nconst useLocationProperty = (fn, ssrFn) =>\n useSyncExternalStore(subscribeToLocationUpdates, fn, ssrFn);\n\nconst currentSearch = () => location.search;\n\nconst useSearch = ({ ssrSearch = \"\" } = {}) =>\n useLocationProperty(currentSearch, () => ssrSearch);\n\nconst currentPathname = () => location.pathname;\n\nconst usePathname = ({ ssrPath } = {}) =>\n useLocationProperty(\n currentPathname,\n ssrPath ? () => ssrPath : currentPathname\n );\n\nconst currentHistoryState = () => history.state;\nconst useHistoryState = () =>\n useLocationProperty(currentHistoryState, () => null);\n\nconst navigate = (to, { replace = false, state = null } = {}) =>\n history[replace ? eventReplaceState : eventPushState](state, \"\", to);\n\n// the 2nd argument of the `useBrowserLocation` return value is a function\n// that allows to perform a navigation.\nconst useBrowserLocation = (opts = {}) => [usePathname(opts), navigate];\n\nconst patchKey = Symbol.for(\"wouter_v3\");\n\n// While History API does have `popstate` event, the only\n// proper way to listen to changes via `push/replaceState`\n// is to monkey-patch these methods.\n//\n// See https://stackoverflow.com/a/4585031\nif (typeof history !== \"undefined\" && typeof window[patchKey] === \"undefined\") {\n for (const type of [eventPushState, eventReplaceState]) {\n const original = history[type];\n // TODO: we should be using unstable_batchedUpdates to avoid multiple re-renders,\n // however that will require an additional peer dependency on react-dom.\n // See: https://github.com/reactwg/react-18/discussions/86#discussioncomment-1567149\n history[type] = function () {\n const result = original.apply(this, arguments);\n const event = new Event(type);\n event.arguments = arguments;\n\n dispatchEvent(event);\n return result;\n };\n }\n\n // patch history object only once\n // See: https://github.com/molefrog/wouter/issues/167\n Object.defineProperty(window, patchKey, { value: true });\n}\n\nexport { navigate, useBrowserLocation, useHistoryState, useLocationProperty, usePathname, useSearch };\n","import { parse } from 'regexparam';\nimport { useBrowserLocation, useSearch as useSearch$1 } from './use-browser-location.js';\nimport { createContext, forwardRef, useEvent, isValidElement, cloneElement, createElement, useContext, useRef, useMemo, useIsomorphicLayoutEffect, Fragment } from './react-deps.js';\n\n/*\n * Transforms `path` into its relative `base` version\n * If base isn't part of the path provided returns absolute path e.g. `~/app`\n */\nconst _relativePath = (base, path) =>\n !path.toLowerCase().indexOf(base.toLowerCase())\n ? path.slice(base.length) || \"/\"\n : \"~\" + path;\n\n/**\n * When basepath is `undefined` or '/' it is ignored (we assume it's empty string)\n */\nconst baseDefaults = (base = \"\") => (base === \"/\" ? \"\" : base);\n\nconst absolutePath = (to, base) =>\n to[0] === \"~\" ? to.slice(1) : baseDefaults(base) + to;\n\nconst relativePath = (base = \"\", path) =>\n _relativePath(unescape(baseDefaults(base)), unescape(path));\n\n/*\n * Removes leading question mark\n */\nconst stripQm = (str) => (str[0] === \"?\" ? str.slice(1) : str);\n\n/*\n * decodes escape sequences such as %20\n */\nconst unescape = (str) => {\n try {\n return decodeURI(str);\n } catch (_e) {\n // fail-safe mode: if string can't be decoded do nothing\n return str;\n }\n};\n\nconst sanitizeSearch = (search) => unescape(stripQm(search));\n\n/*\n * Router and router context. Router is a lightweight object that represents the current\n * routing options: how location is managed, base path etc.\n *\n * There is a default router present for most of the use cases, however it can be overridden\n * via the <Router /> component.\n */\n\nconst defaultRouter = {\n hook: useBrowserLocation,\n searchHook: useSearch$1,\n parser: parse,\n base: \"\",\n // this option is used to override the current location during SSR\n ssrPath: undefined,\n ssrSearch: undefined,\n // optional context to track render state during SSR\n ssrContext: undefined,\n // customizes how `href` props are transformed for <Link />\n hrefs: (x) => x,\n};\n\nconst RouterCtx = createContext(defaultRouter);\n\n// gets the closest parent router from the context\nconst useRouter = () => useContext(RouterCtx);\n\n/**\n * Parameters context. Used by `useParams()` to get the\n * matched params from the innermost `Route` component.\n */\n\nconst Params0 = {},\n ParamsCtx = createContext(Params0);\n\nconst useParams = () => useContext(ParamsCtx);\n\n/*\n * Part 1, Hooks API: useRoute and useLocation\n */\n\n// Internal version of useLocation to avoid redundant useRouter calls\n\nconst useLocationFromRouter = (router) => {\n const [location, navigate] = router.hook(router);\n\n // the function reference should stay the same between re-renders, so that\n // it can be passed down as an element prop without any performance concerns.\n // (This is achieved via `useEvent`.)\n return [\n relativePath(router.base, location),\n useEvent((to, navOpts) => navigate(absolutePath(to, router.base), navOpts)),\n ];\n};\n\nconst useLocation = () => useLocationFromRouter(useRouter());\n\nconst useSearch = () => {\n const router = useRouter();\n return sanitizeSearch(router.searchHook(router));\n};\n\nconst matchRoute = (parser, route, path, loose) => {\n // if the input is a regexp, skip parsing\n const { pattern, keys } =\n route instanceof RegExp\n ? { keys: false, pattern: route }\n : parser(route || \"*\", loose);\n\n // array destructuring loses keys, so this is done in two steps\n const result = pattern.exec(path) || [];\n\n // when parser is in \"loose\" mode, `$base` is equal to the\n // first part of the route that matches the pattern\n // (e.g. for pattern `/a/:b` and path `/a/1/2/3` the `$base` is `a/1`)\n // we use this for route nesting\n const [$base, ...matches] = result;\n\n return $base !== undefined\n ? [\n true,\n\n (() => {\n // for regex paths, `keys` will always be false\n\n // an object with parameters matched, e.g. { foo: \"bar\" } for \"/:foo\"\n // we \"zip\" two arrays here to construct the object\n // [\"foo\"], [\"bar\"] → { foo: \"bar\" }\n const groups =\n keys !== false\n ? Object.fromEntries(keys.map((key, i) => [key, matches[i]]))\n : result.groups;\n\n // convert the array to an instance of object\n // this makes it easier to integrate with the existing param implementation\n let obj = { ...matches };\n\n // merge named capture groups with matches array\n groups && Object.assign(obj, groups);\n\n return obj;\n })(),\n\n // the third value if only present when parser is in \"loose\" mode,\n // so that we can extract the base path for nested routes\n ...(loose ? [$base] : []),\n ]\n : [false, null];\n};\n\nconst useRoute = (pattern) =>\n matchRoute(useRouter().parser, pattern, useLocation()[0]);\n\n/*\n * Part 2, Low Carb Router API: Router, Route, Link, Switch\n */\n\nconst Router = ({ children, ...props }) => {\n // the router we will inherit from - it is the closest router in the tree,\n // unless the custom `hook` is provided (in that case it's the default one)\n const parent_ = useRouter();\n const parent = props.hook ? defaultRouter : parent_;\n\n // holds to the context value: the router object\n let value = parent;\n\n // when `ssrPath` contains a `?` character, we can extract the search from it\n const [path, search] = props.ssrPath?.split(\"?\") ?? [];\n if (search) (props.ssrSearch = search), (props.ssrPath = path);\n\n // hooks can define their own `href` formatter (e.g. for hash location)\n props.hrefs = props.hrefs ?? props.hook?.hrefs;\n\n // what is happening below: to avoid unnecessary rerenders in child components,\n // we ensure that the router object reference is stable, unless there are any\n // changes that require reload (e.g. `base` prop changes -> all components that\n // get the router from the context should rerender, even if the component is memoized).\n // the expected behaviour is:\n //\n // 1) when the resulted router is no different from the parent, use parent\n // 2) if the custom `hook` prop is provided, we always inherit from the\n // default router instead. this resets all previously overridden options.\n // 3) when the router is customized here, it should stay stable between renders\n let ref = useRef({}),\n prev = ref.current,\n next = prev;\n\n for (let k in parent) {\n const option =\n k === \"base\"\n ? /* base is special case, it is appended to the parent's base */\n parent[k] + (props[k] || \"\")\n : props[k] || parent[k];\n\n if (prev === next && option !== next[k]) {\n ref.current = next = { ...next };\n }\n\n next[k] = option;\n\n // the new router is no different from the parent or from the memoized value, use parent\n if (option !== parent[k] || option !== value[k]) value = next;\n }\n\n return createElement(RouterCtx.Provider, { value, children });\n};\n\nconst h_route = ({ children, component }, params) => {\n // React-Router style `component` prop\n if (component) return createElement(component, { params });\n\n // support render prop or plain children\n return typeof children === \"function\" ? children(params) : children;\n};\n\n// Cache params object between renders if values are shallow equal\nconst useCachedParams = (value) => {\n let prev = useRef(Params0);\n const curr = prev.current;\n return (prev.current =\n // Update cache if number of params changed or any value changed\n Object.keys(value).length !== Object.keys(curr).length ||\n Object.entries(value).some(([k, v]) => v !== curr[k])\n ? value // Return new value if there are changes\n : curr); // Return cached value if nothing changed\n};\n\nfunction useSearchParams() {\n const [location, navigate] = useLocation();\n\n const search = useSearch();\n const searchParams = useMemo(() => new URLSearchParams(search), [search]);\n\n // cached value before next render, so you can call setSearchParams multiple times\n let tempSearchParams = searchParams;\n\n const setSearchParams = useEvent((nextInit, options) => {\n tempSearchParams = new URLSearchParams(\n typeof nextInit === \"function\" ? nextInit(tempSearchParams) : nextInit\n );\n navigate(location + \"?\" + tempSearchParams, options);\n });\n\n return [searchParams, setSearchParams];\n}\n\nconst Route = ({ path, nest, match, ...renderProps }) => {\n const router = useRouter();\n const [location] = useLocationFromRouter(router);\n\n const [matches, routeParams, base] =\n // `match` is a special prop to give up control to the parent,\n // it is used by the `Switch` to avoid double matching\n match ?? matchRoute(router.parser, path, location, nest);\n\n // when `routeParams` is `null` (there was no match), the argument\n // below becomes {...null} = {}, see the Object Spread specs\n // https://tc39.es/proposal-object-rest-spread/#AbstractOperations-CopyDataProperties\n const params = useCachedParams({ ...useParams(), ...routeParams });\n\n if (!matches) return null;\n\n const children = base\n ? createElement(Router, { base }, h_route(renderProps, params))\n : h_route(renderProps, params);\n\n return createElement(ParamsCtx.Provider, { value: params, children });\n};\n\nconst Link = forwardRef((props, ref) => {\n const router = useRouter();\n const [currentPath, navigate] = useLocationFromRouter(router);\n\n const {\n to = \"\",\n href: targetPath = to,\n onClick: _onClick,\n asChild,\n children,\n className: cls,\n /* eslint-disable no-unused-vars */\n replace /* ignore nav props */,\n state /* ignore nav props */,\n /* eslint-enable no-unused-vars */\n\n ...restProps\n } = props;\n\n const onClick = useEvent((event) => {\n // ignores the navigation when clicked using right mouse button or\n // by holding a special modifier key: ctrl, command, win, alt, shift\n if (\n event.ctrlKey ||\n event.metaKey ||\n event.altKey ||\n event.shiftKey ||\n event.button !== 0\n )\n return;\n\n _onClick?.(event);\n if (!event.defaultPrevented) {\n event.preventDefault();\n navigate(targetPath, props);\n }\n });\n\n // handle nested routers and absolute paths\n const href = router.hrefs(\n targetPath[0] === \"~\" ? targetPath.slice(1) : router.base + targetPath,\n router // pass router as a second argument for convinience\n );\n\n return asChild && isValidElement(children)\n ? cloneElement(children, { onClick, href })\n : createElement(\"a\", {\n ...restProps,\n onClick,\n href,\n // `className` can be a function to apply the class if this link is active\n className: cls?.call ? cls(currentPath === targetPath) : cls,\n children,\n ref,\n });\n});\n\nconst flattenChildren = (children) =>\n Array.isArray(children)\n ? children.flatMap((c) =>\n flattenChildren(c && c.type === Fragment ? c.props.children : c)\n )\n : [children];\n\nconst Switch = ({ children, location }) => {\n const router = useRouter();\n const [originalLocation] = useLocationFromRouter(router);\n\n for (const element of flattenChildren(children)) {\n let match = 0;\n\n if (\n isValidElement(element) &&\n // we don't require an element to be of type Route,\n // but we do require it to contain a truthy `path` prop.\n // this allows to use different components that wrap Route\n // inside of a switch, for example <AnimatedRoute />.\n (match = matchRoute(\n router.parser,\n element.props.path,\n location || originalLocation,\n element.props.nest\n ))[0]\n )\n return cloneElement(element, { match });\n }\n\n return null;\n};\n\nconst Redirect = (props) => {\n const { to, href = to } = props;\n const router = useRouter();\n const [, navigate] = useLocationFromRouter(router);\n const redirect = useEvent(() => navigate(to || href, props));\n const { ssrContext } = router;\n\n // redirect is guaranteed to be stable since it is returned from useEvent\n useIsomorphicLayoutEffect(() => {\n redirect();\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n if (ssrContext) {\n ssrContext.redirectTo = to;\n }\n\n return null;\n};\n\nexport { Link, Redirect, Route, Router, Switch, matchRoute, useLocation, useParams, useRoute, useRouter, useSearch, useSearchParams };\n"],"names":["parse","input","loose","c","o","tmp","ext","keys","pattern","arr","React","require$$0","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","useSyncExternalStore$2","subscribe","getSnapshot","value","_useState","inst","forceUpdate","checkIfSnapshotChanged","latestGetSnapshot","nextValue","useSyncExternalStore$1","shim","useSyncExternalStoreShim_production","shimModule","useBuiltinInsertionEffect","canUseDOM","useIsomorphicLayoutEffect","React.useLayoutEffect","React.useEffect","useInsertionEffect","useEvent","fn","ref","React.useRef","args","eventPopstate","eventPushState","eventReplaceState","eventHashchange","events","subscribeToLocationUpdates","callback","event","useLocationProperty","ssrFn","useSyncExternalStore","currentSearch","useSearch","ssrSearch","currentPathname","usePathname","ssrPath","navigate","to","replace","state","useBrowserLocation","opts","patchKey","type","original","result","_relativePath","base","path","baseDefaults","absolutePath","relativePath","unescape","stripQm","str","sanitizeSearch","search","defaultRouter","useSearch$1","RouterCtx","createContext","useRouter","useContext","Params0","ParamsCtx","useParams","useLocationFromRouter","router","location","navOpts","useLocation","matchRoute","parser","route","$base","matches","groups","key","i","obj","useRoute","Router","children","props","parent_","parent","useRef","prev","next","k","option","createElement","h_route","component","params","useCachedParams","curr","v","useSearchParams","searchParams","useMemo","tempSearchParams","setSearchParams","nextInit","options","Route","nest","match","renderProps","routeParams","Link","forwardRef","currentPath","targetPath","_onClick","asChild","cls","restProps","onClick","href","isValidElement","cloneElement","flattenChildren","Fragment","Switch","originalLocation","element","Redirect","redirect","ssrContext"],"mappings":"uFAIO,SAASA,EAAMC,EAAOC,EAAO,CACnC,GAAID,aAAiB,OAAQ,MAAO,CAAE,KAAK,GAAO,QAAQA,CAAK,EAC/D,IAAIE,EAAGC,EAAGC,EAAKC,EAAKC,EAAK,CAAA,EAAIC,EAAQ,GAAIC,EAAMR,EAAM,MAAM,GAAG,EAG9D,IAFAQ,EAAI,CAAC,GAAKA,EAAI,MAAK,EAEZJ,EAAMI,EAAI,SAChBN,EAAIE,EAAI,CAAC,EACLF,IAAM,KACTI,EAAK,KAAKJ,CAAC,EACXK,GAAWH,EAAI,CAAC,IAAM,IAAM,aAAe,SACjCF,IAAM,KAChBC,EAAIC,EAAI,QAAQ,IAAK,CAAC,EACtBC,EAAMD,EAAI,QAAQ,IAAK,CAAC,EACxBE,EAAK,KAAMF,EAAI,UAAU,EAAK,CAACD,EAAIA,EAAM,CAACE,EAAMA,EAAMD,EAAI,MAAM,CAAC,EACjEG,GAAa,CAACJ,GAAK,CAAC,CAACE,EAAM,iBAAmB,YACxC,CAACA,IAAKE,IAAc,CAACJ,EAAI,IAAM,IAAM,KAAOC,EAAI,UAAUC,CAAG,IAEnEE,GAAW,IAAMH,EAInB,MAAO,CACN,KAAME,EACN,QAAS,IAAI,OAAO,IAAMC,GAAWN,EAAQ,UAAa,OAAS,GAAG,CACxE,CACA,8DClBA,IAAIQ,EAAQC,EAAA,EACZ,SAASC,EAAGC,EAAGC,EAAG,CAChB,OAAQD,IAAMC,IAAYD,IAAN,GAAW,EAAIA,IAAM,EAAIC,IAAQD,IAAMA,GAAKC,IAAMA,CACxE,CACA,IAAI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AASN,EAAS,EAClB,EAAGzB,CAAQ,EAAI8B,EAAsBC,CAAM,EAC3C6D,EAAWlH,EAAS,IAAMsB,EAASC,GAAMkF,EAAMpC,CAAK,CAAC,EACrD,CAAE,WAAA8C,CAAU,EAAK9D,EAGvB,OAAAzD,EAA0B,IAAM,CAC9BsH,EAAQ,CACV,EAAG,CAAA,CAAE,EAEDC,IACFA,EAAW,WAAa5F,GAGnB,IACT","x_google_ignoreList":[0,1,2,3,4,5]}
|
|
1
|
+
{"version":3,"file":"index-DEL-PD_8.js","sources":["../../node_modules/regexparam/dist/index.mjs","../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../../node_modules/use-sync-external-store/shim/index.js","../../node_modules/wouter/esm/react-deps.js","../../node_modules/wouter/esm/use-browser-location.js","../../node_modules/wouter/esm/index.js"],"sourcesContent":["/**\n * @param {string|RegExp} input The route pattern\n * @param {boolean} [loose] Allow open-ended matching. Ignored with `RegExp` input.\n */\nexport function parse(input, loose) {\n\tif (input instanceof RegExp) return { keys:false, pattern:input };\n\tvar c, o, tmp, ext, keys=[], pattern='', arr = input.split('/');\n\tarr[0] || arr.shift();\n\n\twhile (tmp = arr.shift()) {\n\t\tc = tmp[0];\n\t\tif (c === '*') {\n\t\t\tkeys.push(c);\n\t\t\tpattern += tmp[1] === '?' ? '(?:/(.*))?' : '/(.*)';\n\t\t} else if (c === ':') {\n\t\t\to = tmp.indexOf('?', 1);\n\t\t\text = tmp.indexOf('.', 1);\n\t\t\tkeys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) );\n\t\t\tpattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';\n\t\t\tif (!!~ext) pattern += (!!~o ? '?' : '') + '\\\\' + tmp.substring(ext);\n\t\t} else {\n\t\t\tpattern += '/' + tmp;\n\t\t}\n\t}\n\n\treturn {\n\t\tkeys: keys,\n\t\tpattern: new RegExp('^' + pattern + (loose ? '(?=$|\\/)' : '\\/?$'), 'i')\n\t};\n}\n\nvar RGX = /(\\/|^)([:*][^/]*?)(\\?)?(?=[/.]|$)/g;\n\n// error if key missing?\nexport function inject(route, values) {\n\treturn route.replace(RGX, (x, lead, key, optional) => {\n\t\tx = values[key=='*' ? key : key.substring(1)];\n\t\treturn x ? '/'+x : (optional || key=='*') ? '' : '/' + key;\n\t});\n}\n","/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","import * as React from 'react';\nexport { Fragment, cloneElement, createContext, createElement, forwardRef, isValidElement, useContext, useMemo, useRef, useState } from 'react';\nexport { useSyncExternalStore } from 'use-sync-external-store/shim/index.js';\n\n// React.useInsertionEffect is not available in React <18\n// This hack fixes a transpilation issue on some apps\nconst useBuiltinInsertionEffect = React[\"useInsertion\" + \"Effect\"];\n\n// Copied from:\n// https://github.com/facebook/react/blob/main/packages/shared/ExecutionEnvironment.js\nconst canUseDOM = !!(\n typeof window !== \"undefined\" &&\n typeof window.document !== \"undefined\" &&\n typeof window.document.createElement !== \"undefined\"\n);\n\n// Copied from:\n// https://github.com/reduxjs/react-redux/blob/master/src/utils/useIsomorphicLayoutEffect.ts\n// \"React currently throws a warning when using useLayoutEffect on the server.\n// To get around it, we can conditionally useEffect on the server (no-op) and\n// useLayoutEffect in the browser.\"\nconst useIsomorphicLayoutEffect = canUseDOM\n ? React.useLayoutEffect\n : React.useEffect;\n\n// useInsertionEffect is already a noop on the server.\n// See: https://github.com/facebook/react/blob/main/packages/react-server/src/ReactFizzHooks.js\nconst useInsertionEffect =\n useBuiltinInsertionEffect || useIsomorphicLayoutEffect;\n\n// Userland polyfill while we wait for the forthcoming\n// https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md\n// Note: \"A high-fidelity polyfill for useEvent is not possible because\n// there is no lifecycle or Hook in React that we can use to switch\n// .current at the right timing.\"\n// So we will have to make do with this \"close enough\" approach for now.\nconst useEvent = (fn) => {\n const ref = React.useRef([fn, (...args) => ref[0](...args)]).current;\n // Per Dan Abramov: useInsertionEffect executes marginally closer to the\n // correct timing for ref synchronization than useLayoutEffect on React 18.\n // See: https://github.com/facebook/react/pull/25881#issuecomment-1356244360\n useInsertionEffect(() => {\n ref[0] = fn;\n });\n return ref[1];\n};\n\nexport { useEvent, useInsertionEffect, useIsomorphicLayoutEffect };\n","import { useSyncExternalStore } from './react-deps.js';\n\n/**\n * History API docs @see https://developer.mozilla.org/en-US/docs/Web/API/History\n */\nconst eventPopstate = \"popstate\";\nconst eventPushState = \"pushState\";\nconst eventReplaceState = \"replaceState\";\nconst eventHashchange = \"hashchange\";\nconst events = [\n eventPopstate,\n eventPushState,\n eventReplaceState,\n eventHashchange,\n];\n\nconst subscribeToLocationUpdates = (callback) => {\n for (const event of events) {\n addEventListener(event, callback);\n }\n return () => {\n for (const event of events) {\n removeEventListener(event, callback);\n }\n };\n};\n\nconst useLocationProperty = (fn, ssrFn) =>\n useSyncExternalStore(subscribeToLocationUpdates, fn, ssrFn);\n\nconst currentSearch = () => location.search;\n\nconst useSearch = ({ ssrSearch = \"\" } = {}) =>\n useLocationProperty(currentSearch, () => ssrSearch);\n\nconst currentPathname = () => location.pathname;\n\nconst usePathname = ({ ssrPath } = {}) =>\n useLocationProperty(\n currentPathname,\n ssrPath ? () => ssrPath : currentPathname\n );\n\nconst currentHistoryState = () => history.state;\nconst useHistoryState = () =>\n useLocationProperty(currentHistoryState, () => null);\n\nconst navigate = (to, { replace = false, state = null } = {}) =>\n history[replace ? eventReplaceState : eventPushState](state, \"\", to);\n\n// the 2nd argument of the `useBrowserLocation` return value is a function\n// that allows to perform a navigation.\nconst useBrowserLocation = (opts = {}) => [usePathname(opts), navigate];\n\nconst patchKey = Symbol.for(\"wouter_v3\");\n\n// While History API does have `popstate` event, the only\n// proper way to listen to changes via `push/replaceState`\n// is to monkey-patch these methods.\n//\n// See https://stackoverflow.com/a/4585031\nif (typeof history !== \"undefined\" && typeof window[patchKey] === \"undefined\") {\n for (const type of [eventPushState, eventReplaceState]) {\n const original = history[type];\n // TODO: we should be using unstable_batchedUpdates to avoid multiple re-renders,\n // however that will require an additional peer dependency on react-dom.\n // See: https://github.com/reactwg/react-18/discussions/86#discussioncomment-1567149\n history[type] = function () {\n const result = original.apply(this, arguments);\n const event = new Event(type);\n event.arguments = arguments;\n\n dispatchEvent(event);\n return result;\n };\n }\n\n // patch history object only once\n // See: https://github.com/molefrog/wouter/issues/167\n Object.defineProperty(window, patchKey, { value: true });\n}\n\nexport { navigate, useBrowserLocation, useHistoryState, useLocationProperty, usePathname, useSearch };\n","import { parse } from 'regexparam';\nimport { useBrowserLocation, useSearch as useSearch$1 } from './use-browser-location.js';\nimport { createContext, forwardRef, useEvent, isValidElement, cloneElement, createElement, useContext, useRef, useMemo, useIsomorphicLayoutEffect, Fragment } from './react-deps.js';\n\n/*\n * Transforms `path` into its relative `base` version\n * If base isn't part of the path provided returns absolute path e.g. `~/app`\n */\nconst _relativePath = (base, path) =>\n !path.toLowerCase().indexOf(base.toLowerCase())\n ? path.slice(base.length) || \"/\"\n : \"~\" + path;\n\n/**\n * When basepath is `undefined` or '/' it is ignored (we assume it's empty string)\n */\nconst baseDefaults = (base = \"\") => (base === \"/\" ? \"\" : base);\n\nconst absolutePath = (to, base) =>\n to[0] === \"~\" ? to.slice(1) : baseDefaults(base) + to;\n\nconst relativePath = (base = \"\", path) =>\n _relativePath(unescape(baseDefaults(base)), unescape(path));\n\n/*\n * Removes leading question mark\n */\nconst stripQm = (str) => (str[0] === \"?\" ? str.slice(1) : str);\n\n/*\n * decodes escape sequences such as %20\n */\nconst unescape = (str) => {\n try {\n return decodeURI(str);\n } catch (_e) {\n // fail-safe mode: if string can't be decoded do nothing\n return str;\n }\n};\n\nconst sanitizeSearch = (search) => unescape(stripQm(search));\n\n/*\n * Router and router context. Router is a lightweight object that represents the current\n * routing options: how location is managed, base path etc.\n *\n * There is a default router present for most of the use cases, however it can be overridden\n * via the <Router /> component.\n */\n\nconst defaultRouter = {\n hook: useBrowserLocation,\n searchHook: useSearch$1,\n parser: parse,\n base: \"\",\n // this option is used to override the current location during SSR\n ssrPath: undefined,\n ssrSearch: undefined,\n // optional context to track render state during SSR\n ssrContext: undefined,\n // customizes how `href` props are transformed for <Link />\n hrefs: (x) => x,\n};\n\nconst RouterCtx = createContext(defaultRouter);\n\n// gets the closest parent router from the context\nconst useRouter = () => useContext(RouterCtx);\n\n/**\n * Parameters context. Used by `useParams()` to get the\n * matched params from the innermost `Route` component.\n */\n\nconst Params0 = {},\n ParamsCtx = createContext(Params0);\n\nconst useParams = () => useContext(ParamsCtx);\n\n/*\n * Part 1, Hooks API: useRoute and useLocation\n */\n\n// Internal version of useLocation to avoid redundant useRouter calls\n\nconst useLocationFromRouter = (router) => {\n const [location, navigate] = router.hook(router);\n\n // the function reference should stay the same between re-renders, so that\n // it can be passed down as an element prop without any performance concerns.\n // (This is achieved via `useEvent`.)\n return [\n relativePath(router.base, location),\n useEvent((to, navOpts) => navigate(absolutePath(to, router.base), navOpts)),\n ];\n};\n\nconst useLocation = () => useLocationFromRouter(useRouter());\n\nconst useSearch = () => {\n const router = useRouter();\n return sanitizeSearch(router.searchHook(router));\n};\n\nconst matchRoute = (parser, route, path, loose) => {\n // if the input is a regexp, skip parsing\n const { pattern, keys } =\n route instanceof RegExp\n ? { keys: false, pattern: route }\n : parser(route || \"*\", loose);\n\n // array destructuring loses keys, so this is done in two steps\n const result = pattern.exec(path) || [];\n\n // when parser is in \"loose\" mode, `$base` is equal to the\n // first part of the route that matches the pattern\n // (e.g. for pattern `/a/:b` and path `/a/1/2/3` the `$base` is `a/1`)\n // we use this for route nesting\n const [$base, ...matches] = result;\n\n return $base !== undefined\n ? [\n true,\n\n (() => {\n // for regex paths, `keys` will always be false\n\n // an object with parameters matched, e.g. { foo: \"bar\" } for \"/:foo\"\n // we \"zip\" two arrays here to construct the object\n // [\"foo\"], [\"bar\"] → { foo: \"bar\" }\n const groups =\n keys !== false\n ? Object.fromEntries(keys.map((key, i) => [key, matches[i]]))\n : result.groups;\n\n // convert the array to an instance of object\n // this makes it easier to integrate with the existing param implementation\n let obj = { ...matches };\n\n // merge named capture groups with matches array\n groups && Object.assign(obj, groups);\n\n return obj;\n })(),\n\n // the third value if only present when parser is in \"loose\" mode,\n // so that we can extract the base path for nested routes\n ...(loose ? [$base] : []),\n ]\n : [false, null];\n};\n\nconst useRoute = (pattern) =>\n matchRoute(useRouter().parser, pattern, useLocation()[0]);\n\n/*\n * Part 2, Low Carb Router API: Router, Route, Link, Switch\n */\n\nconst Router = ({ children, ...props }) => {\n // the router we will inherit from - it is the closest router in the tree,\n // unless the custom `hook` is provided (in that case it's the default one)\n const parent_ = useRouter();\n const parent = props.hook ? defaultRouter : parent_;\n\n // holds to the context value: the router object\n let value = parent;\n\n // when `ssrPath` contains a `?` character, we can extract the search from it\n const [path, search] = props.ssrPath?.split(\"?\") ?? [];\n if (search) (props.ssrSearch = search), (props.ssrPath = path);\n\n // hooks can define their own `href` formatter (e.g. for hash location)\n props.hrefs = props.hrefs ?? props.hook?.hrefs;\n\n // what is happening below: to avoid unnecessary rerenders in child components,\n // we ensure that the router object reference is stable, unless there are any\n // changes that require reload (e.g. `base` prop changes -> all components that\n // get the router from the context should rerender, even if the component is memoized).\n // the expected behaviour is:\n //\n // 1) when the resulted router is no different from the parent, use parent\n // 2) if the custom `hook` prop is provided, we always inherit from the\n // default router instead. this resets all previously overridden options.\n // 3) when the router is customized here, it should stay stable between renders\n let ref = useRef({}),\n prev = ref.current,\n next = prev;\n\n for (let k in parent) {\n const option =\n k === \"base\"\n ? /* base is special case, it is appended to the parent's base */\n parent[k] + (props[k] || \"\")\n : props[k] || parent[k];\n\n if (prev === next && option !== next[k]) {\n ref.current = next = { ...next };\n }\n\n next[k] = option;\n\n // the new router is no different from the parent or from the memoized value, use parent\n if (option !== parent[k] || option !== value[k]) value = next;\n }\n\n return createElement(RouterCtx.Provider, { value, children });\n};\n\nconst h_route = ({ children, component }, params) => {\n // React-Router style `component` prop\n if (component) return createElement(component, { params });\n\n // support render prop or plain children\n return typeof children === \"function\" ? children(params) : children;\n};\n\n// Cache params object between renders if values are shallow equal\nconst useCachedParams = (value) => {\n let prev = useRef(Params0);\n const curr = prev.current;\n return (prev.current =\n // Update cache if number of params changed or any value changed\n Object.keys(value).length !== Object.keys(curr).length ||\n Object.entries(value).some(([k, v]) => v !== curr[k])\n ? value // Return new value if there are changes\n : curr); // Return cached value if nothing changed\n};\n\nfunction useSearchParams() {\n const [location, navigate] = useLocation();\n\n const search = useSearch();\n const searchParams = useMemo(() => new URLSearchParams(search), [search]);\n\n // cached value before next render, so you can call setSearchParams multiple times\n let tempSearchParams = searchParams;\n\n const setSearchParams = useEvent((nextInit, options) => {\n tempSearchParams = new URLSearchParams(\n typeof nextInit === \"function\" ? nextInit(tempSearchParams) : nextInit\n );\n navigate(location + \"?\" + tempSearchParams, options);\n });\n\n return [searchParams, setSearchParams];\n}\n\nconst Route = ({ path, nest, match, ...renderProps }) => {\n const router = useRouter();\n const [location] = useLocationFromRouter(router);\n\n const [matches, routeParams, base] =\n // `match` is a special prop to give up control to the parent,\n // it is used by the `Switch` to avoid double matching\n match ?? matchRoute(router.parser, path, location, nest);\n\n // when `routeParams` is `null` (there was no match), the argument\n // below becomes {...null} = {}, see the Object Spread specs\n // https://tc39.es/proposal-object-rest-spread/#AbstractOperations-CopyDataProperties\n const params = useCachedParams({ ...useParams(), ...routeParams });\n\n if (!matches) return null;\n\n const children = base\n ? createElement(Router, { base }, h_route(renderProps, params))\n : h_route(renderProps, params);\n\n return createElement(ParamsCtx.Provider, { value: params, children });\n};\n\nconst Link = forwardRef((props, ref) => {\n const router = useRouter();\n const [currentPath, navigate] = useLocationFromRouter(router);\n\n const {\n to = \"\",\n href: targetPath = to,\n onClick: _onClick,\n asChild,\n children,\n className: cls,\n /* eslint-disable no-unused-vars */\n replace /* ignore nav props */,\n state /* ignore nav props */,\n /* eslint-enable no-unused-vars */\n\n ...restProps\n } = props;\n\n const onClick = useEvent((event) => {\n // ignores the navigation when clicked using right mouse button or\n // by holding a special modifier key: ctrl, command, win, alt, shift\n if (\n event.ctrlKey ||\n event.metaKey ||\n event.altKey ||\n event.shiftKey ||\n event.button !== 0\n )\n return;\n\n _onClick?.(event);\n if (!event.defaultPrevented) {\n event.preventDefault();\n navigate(targetPath, props);\n }\n });\n\n // handle nested routers and absolute paths\n const href = router.hrefs(\n targetPath[0] === \"~\" ? targetPath.slice(1) : router.base + targetPath,\n router // pass router as a second argument for convinience\n );\n\n return asChild && isValidElement(children)\n ? cloneElement(children, { onClick, href })\n : createElement(\"a\", {\n ...restProps,\n onClick,\n href,\n // `className` can be a function to apply the class if this link is active\n className: cls?.call ? cls(currentPath === targetPath) : cls,\n children,\n ref,\n });\n});\n\nconst flattenChildren = (children) =>\n Array.isArray(children)\n ? children.flatMap((c) =>\n flattenChildren(c && c.type === Fragment ? c.props.children : c)\n )\n : [children];\n\nconst Switch = ({ children, location }) => {\n const router = useRouter();\n const [originalLocation] = useLocationFromRouter(router);\n\n for (const element of flattenChildren(children)) {\n let match = 0;\n\n if (\n isValidElement(element) &&\n // we don't require an element to be of type Route,\n // but we do require it to contain a truthy `path` prop.\n // this allows to use different components that wrap Route\n // inside of a switch, for example <AnimatedRoute />.\n (match = matchRoute(\n router.parser,\n element.props.path,\n location || originalLocation,\n element.props.nest\n ))[0]\n )\n return cloneElement(element, { match });\n }\n\n return null;\n};\n\nconst Redirect = (props) => {\n const { to, href = to } = props;\n const router = useRouter();\n const [, navigate] = useLocationFromRouter(router);\n const redirect = useEvent(() => navigate(to || href, props));\n const { ssrContext } = router;\n\n // redirect is guaranteed to be stable since it is returned from useEvent\n useIsomorphicLayoutEffect(() => {\n redirect();\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n if (ssrContext) {\n ssrContext.redirectTo = to;\n }\n\n return null;\n};\n\nexport { Link, Redirect, Route, Router, Switch, matchRoute, useLocation, useParams, useRoute, useRouter, useSearch, useSearchParams };\n"],"names":["parse","input","loose","c","o","tmp","ext","keys","pattern","arr","React","require$$0","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","useSyncExternalStore$2","subscribe","getSnapshot","value","_useState","inst","forceUpdate","checkIfSnapshotChanged","latestGetSnapshot","nextValue","useSyncExternalStore$1","shim","useSyncExternalStoreShim_production","shimModule","useBuiltinInsertionEffect","canUseDOM","useIsomorphicLayoutEffect","React.useLayoutEffect","React.useEffect","useInsertionEffect","useEvent","fn","ref","React.useRef","args","eventPopstate","eventPushState","eventReplaceState","eventHashchange","events","subscribeToLocationUpdates","callback","event","useLocationProperty","ssrFn","useSyncExternalStore","currentSearch","useSearch","ssrSearch","currentPathname","usePathname","ssrPath","navigate","to","replace","state","useBrowserLocation","opts","patchKey","type","original","result","_relativePath","base","path","baseDefaults","absolutePath","relativePath","unescape","stripQm","str","sanitizeSearch","search","defaultRouter","useSearch$1","RouterCtx","createContext","useRouter","useContext","Params0","ParamsCtx","useParams","useLocationFromRouter","router","location","navOpts","useLocation","matchRoute","parser","route","$base","matches","groups","key","i","obj","useRoute","Router","children","props","parent_","parent","useRef","prev","next","k","option","createElement","h_route","component","params","useCachedParams","curr","v","useSearchParams","searchParams","useMemo","tempSearchParams","setSearchParams","nextInit","options","Route","nest","match","renderProps","routeParams","Link","forwardRef","currentPath","targetPath","_onClick","asChild","cls","restProps","onClick","href","isValidElement","cloneElement","flattenChildren","Fragment","Switch","originalLocation","element","Redirect","redirect","ssrContext"],"mappings":"uFAIO,SAASA,EAAMC,EAAOC,EAAO,CACnC,GAAID,aAAiB,OAAQ,MAAO,CAAE,KAAK,GAAO,QAAQA,CAAK,EAC/D,IAAIE,EAAGC,EAAGC,EAAKC,EAAKC,EAAK,CAAA,EAAIC,EAAQ,GAAIC,EAAMR,EAAM,MAAM,GAAG,EAG9D,IAFAQ,EAAI,CAAC,GAAKA,EAAI,MAAK,EAEZJ,EAAMI,EAAI,SAChBN,EAAIE,EAAI,CAAC,EACLF,IAAM,KACTI,EAAK,KAAKJ,CAAC,EACXK,GAAWH,EAAI,CAAC,IAAM,IAAM,aAAe,SACjCF,IAAM,KAChBC,EAAIC,EAAI,QAAQ,IAAK,CA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J,EAAE,MAAM,SAAWA,CAAC,CACvE,EACM,CAACyG,CAAQ,EAET0C,GAAS,CAAC,CAAE,SAAA1C,EAAU,SAAAd,KAAe,CACzC,MAAMD,EAASN,EAAS,EAClB,CAACgE,CAAgB,EAAI3D,EAAsBC,CAAM,EAEvD,UAAW2D,KAAWJ,EAAgBxC,CAAQ,EAAG,CAC/C,IAAIyB,EAAQ,EAEZ,GACEa,EAAAA,eAAeM,CAAO,IAKrBnB,EAAQpC,EACPJ,EAAO,OACP2D,EAAQ,MAAM,KACd1D,GAAYyD,EACZC,EAAQ,MAAM,IACtB,GAAS,CAAC,EAEJ,OAAOL,eAAaK,EAAS,CAAE,MAAAnB,EAAO,CAC1C,CAEA,OAAO,IACT,EAEMoB,GAAY5C,GAAU,CAC1B,KAAM,CAAE,GAAA9C,EAAI,KAAAkF,EAAOlF,CAAE,EAAK8C,EACpBhB,EAASN,EAAS,EAClB,EAAGzB,CAAQ,EAAI8B,EAAsBC,CAAM,EAC3C6D,EAAWlH,EAAS,IAAMsB,EAASC,GAAMkF,EAAMpC,CAAK,CAAC,EACrD,CAAE,WAAA8C,CAAU,EAAK9D,EAGvB,OAAAzD,EAA0B,IAAM,CAC9BsH,EAAQ,CACV,EAAG,CAAA,CAAE,EAEDC,IACFA,EAAW,WAAa5F,GAGnB,IACT","x_google_ignoreList":[0,1,2,3,4,5]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as s}from"./jsx-runtime-BX5r4UiA.js";import{useStore as j}from"./shared/@nanostores_react-DJPF1Eqx.js";import{a as f}from"./index-CSV4ZXsq.js";import{I as p,a as g}from"./IconX-CvmO0bbE.js";import{r as v}from"./index-CrN8I5Az.js";import{I as N}from"./IconCheck-DOe3u7iH.js";const b=f(null),$="/assets/dark_bg-uu5tZDxN.webp",k="/assets/auth_bg-DJZN1T-H.webp",z=({children:e})=>{const o=j(b);return s.jsxs("div",{className:"background",children:[s.jsx("img",{className:"bg-img dark",src:$}),s.jsx("img",{className:"bg-img light",src:k}),o&&s.jsxs("div",{className:"version",children:["Omegga v",o]}),e]})},x=({children:e,warn:o,main:r,error:n,info:a,normal:l,disabled:m=!1,icon:t,boxy:c,onClick:d,className:u,...i})=>s.jsx("div",{className:["button",u??"",o&&"warn",r&&"main",n&&"error",a&&"info",l&&"normal",m&&"disabled",c&&"boxy",t&&"icon"].filter(Boolean).join(" "),onClick:d,...i,children:s.jsx("div",{className:"button-content",children:e})}),w=({children:e,className:o,attached:r,...n})=>s.jsx("div",{className:`footer ${r?"attached":""} ${o??""}`,...n,children:e}),C=({children:e,className:o,attached:r,...n})=>s.jsx("div",{className:`header ${r?"attached":""} ${o??""}`,...n,children:e});function M({placeholder:e,tooltip:o,disabled:r,type:n="text",value:a,roboto:l,onBlur:m,onFocus:t,onSubmit:c,onChange:d,...u}){return s.jsx("div",{className:`input ${r?"disabled":""} ${l?"roboto":""}`,"data-tooltip":o,children:s.jsx("input",{spellCheck:"false",type:n,placeholder:e,disabled:r,value:a,onChange:i=>{const h=n==="number"?Number(i.target.value):i.target.value;d&&d(h)},onKeyDown:c?i=>{i.key==="Enter"&&(i.preventDefault(),c())}:void 0,...u})})}const y={small:"24",normal:"30",huge:"60",massive:"120"},Z=({children:e,onClick:o,blur:r,active:n=!0,inline:a=!1,size:l="normal"})=>s.jsx("div",{className:`loader ${n?"active":""} ${a?"inline":""}`,onClick:o,children:s.jsxs("div",{className:`loader-container ${r?"blur":""}`,children:[s.jsx(p,{className:"loader-icon",size:y[l]}),s.jsx("div",{children:e})]})}),B=({visible:e,children:o})=>s.jsx("div",{className:`dimmer ${e?"visible":""}`,children:s.jsx("div",{className:"dimmer-content",children:o})}),I=({children:e})=>s.jsx("div",{className:"popout-content",children:e}),D=({visible:e,children:o})=>s.jsx("div",{className:`modal ${e?"visible":""}`,children:s.jsx("div",{className:"modal-content",children:o})}),A=({leftButton:e,rightButton:o,title:r,content:n}={})=>{const[a,l]=v.useState({show:!1,message:"",children:null,resolve:t=>{}});return{prompt:v.useCallback(t=>new Promise(c=>{l({message:typeof t=="string"?t:"",children:typeof t!="string"&&t?t:null,show:!0,resolve(d){c(d),l({show:!1,message:"",children:null,resolve:()=>{}})}})}),[]),children:s.jsx(B,{visible:a.show,children:s.jsxs(D,{visible:!0,children:[s.jsx(C,{attached:!0,children:r??"Confirmation"}),s.jsx(I,{children:n??a.children??s.jsxs("p",{children:["Are you sure you want to ",a.message,"?"]})}),s.jsxs(w,{attached:!0,children:[e?.(a.resolve)??s.jsxs(x,{main:!0,onClick:()=>a.resolve(!0),children:[s.jsx(N,{}),"Yes"]}),s.jsx("div",{style:{flex:1}}),o?.(a.resolve)??s.jsxs(x,{normal:!0,onClick:()=>a.resolve(!1),children:[s.jsx(g,{}),"No"]})]})]})})}};export{b as $,z as B,B as D,w as F,C as H,M as I,Z as L,D as M,I as P,x as a,A as u};
|
|
2
|
+
//# sourceMappingURL=index-D_STNela.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D_STNela.js","sources":["../../frontend/src/stores/version.ts","../../frontend/assets/img/dark_bg.webp","../../frontend/assets/img/auth_bg.webp","../../frontend/src/components/background/index.tsx","../../frontend/src/components/button/index.tsx","../../frontend/src/components/footer/index.tsx","../../frontend/src/components/header/index.tsx","../../frontend/src/components/input/index.tsx","../../frontend/src/components/loader/index.tsx","../../frontend/src/components/dimmer/index.tsx","../../frontend/src/components/popout/index.tsx","../../frontend/src/components/modal/index.tsx"],"sourcesContent":["import { atom } from 'nanostores';\n\nexport const $version = atom<string | null>(null);\n","export default \"__VITE_ASSET__DZw7aIWt__\"","export default \"__VITE_ASSET__CbOwMhlW__\"","import { useStore } from '@nanostores/react';\nimport type React from 'react';\nimport { $version } from '../../stores/version';\nimport darkBg from '../../../assets/img/dark_bg.webp';\nimport lightBg from '../../../assets/img/auth_bg.webp';\n\nexport const Background = ({ children }: React.PropsWithChildren) => {\n const version = useStore($version);\n return (\n <div className=\"background\">\n <img className=\"bg-img dark\" src={darkBg} />\n <img className=\"bg-img light\" src={lightBg} />\n {version && <div className=\"version\">Omegga v{version}</div>}\n {children}\n </div>\n );\n};\n","import type React from 'react';\nimport type { HTMLAttributes, MouseEventHandler } from 'react';\n\nexport const Button = ({\n children,\n warn,\n main,\n error,\n info,\n normal,\n disabled = false,\n icon,\n boxy,\n onClick,\n className,\n ...props\n}: React.PropsWithChildren<{\n warn?: boolean;\n main?: boolean;\n error?: boolean;\n info?: boolean;\n normal?: boolean;\n disabled?: boolean;\n icon?: boolean;\n boxy?: boolean;\n onClick?: MouseEventHandler;\n}> &\n HTMLAttributes<HTMLDivElement>) => (\n <div\n className={[\n 'button',\n className ?? '',\n warn && 'warn',\n main && 'main',\n error && 'error',\n info && 'info',\n normal && 'normal',\n disabled && 'disabled',\n boxy && 'boxy',\n icon && 'icon',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={onClick}\n {...props}\n >\n <div className=\"button-content\">{children}</div>\n </div>\n);\n","import type { HTMLAttributes } from 'react';\n\nexport const Footer = ({\n children,\n className,\n attached,\n ...props\n}: HTMLAttributes<HTMLDivElement> & {\n attached?: boolean;\n}) => (\n <div\n className={`footer ${attached ? 'attached' : ''} ${className ?? ''}`}\n {...props}\n >\n {children}\n </div>\n);\n","import type { HTMLAttributes } from 'react';\nimport type React from 'react';\n\nexport const Header = ({\n children,\n className,\n attached,\n ...props\n}: React.PropsWithChildren &\n HTMLAttributes<HTMLDivElement> & { attached?: boolean }) => (\n <div\n className={`header ${attached ? 'attached' : ''} ${className ?? ''}`}\n {...props}\n >\n {children}\n </div>\n);\n","import type { HTMLAttributes } from 'react';\n\nexport function Input<T extends 'text' | 'number' | 'password'>({\n placeholder,\n tooltip,\n disabled,\n type = 'text' as T,\n value,\n roboto,\n onBlur,\n onFocus,\n onSubmit,\n onChange,\n ...props\n}: {\n placeholder?: string;\n tooltip?: string;\n disabled?: boolean;\n roboto?: boolean;\n type?: T;\n value: T extends 'number' ? number : string;\n onSubmit?: () => void;\n onChange?: (v: T extends 'number' ? number : string) => void;\n} & Omit<HTMLAttributes<HTMLInputElement>, 'onChange' | 'onSubmit'>) {\n return (\n <div\n className={`input ${disabled ? 'disabled' : ''} ${roboto ? 'roboto' : ''}`}\n data-tooltip={tooltip}\n >\n <input\n spellCheck=\"false\"\n type={type}\n placeholder={placeholder}\n disabled={disabled}\n value={value}\n onChange={e => {\n const newValue =\n type === 'number' ? Number(e.target.value) : e.target.value;\n if (onChange)\n onChange(newValue as T extends 'number' ? number : string);\n }}\n onKeyDown={\n onSubmit\n ? e => {\n if (e.key === 'Enter') {\n e.preventDefault();\n onSubmit();\n }\n }\n : undefined\n }\n {...props}\n />\n </div>\n );\n}\n","import { IconLoader } from '@tabler/icons-react';\nimport type React from 'react';\nimport type { MouseEventHandler } from 'react';\n\nconst sizes = {\n small: '24',\n normal: '30',\n huge: '60',\n massive: '120',\n};\n\nexport const Loader = ({\n children,\n onClick,\n blur,\n active = true,\n inline = false,\n size = 'normal',\n}: React.PropsWithChildren<{\n active?: boolean;\n inline?: boolean;\n blur?: boolean;\n size?: 'small' | 'normal' | 'huge' | 'massive';\n onClick?: MouseEventHandler;\n}>) => {\n return (\n <div\n className={`loader ${active ? 'active' : ''} ${inline ? 'inline' : ''}`}\n onClick={onClick}\n >\n <div className={`loader-container ${blur ? 'blur' : ''}`}>\n <IconLoader className=\"loader-icon\" size={sizes[size]} />\n <div>{children}</div>\n </div>\n </div>\n );\n};\n","import type { PropsWithChildren } from 'react';\n\nexport const Dimmer = ({\n visible,\n children,\n}: PropsWithChildren<{ visible: boolean }>) => (\n <div className={`dimmer ${visible ? 'visible' : ''}`}>\n <div className=\"dimmer-content\">{children}</div>\n </div>\n);\n","export const PopoutContent = ({ children }: React.PropsWithChildren) => (\n <div className=\"popout-content\">{children}</div>\n);\n","import { IconCheck, IconX } from '@tabler/icons-react';\nimport {\n useCallback,\n useState,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\nimport { Button } from '../button';\nimport { Dimmer } from '../dimmer';\nimport { Footer } from '../footer';\nimport { Header } from '../header';\nimport { PopoutContent } from '../popout';\n\nexport const Modal = ({\n visible,\n children,\n}: PropsWithChildren<{ visible: boolean }>) => (\n <div className={`modal ${visible ? 'visible' : ''}`}>\n <div className=\"modal-content\">{children}</div>\n </div>\n);\n\nexport const useConfirm = <T = boolean,>({\n leftButton,\n rightButton,\n title,\n content,\n}: {\n title?: string;\n content?: ReactNode;\n leftButton?: (confirm: (ok: T) => void) => React.ReactNode;\n rightButton?: (confirm: (ok: T) => void) => React.ReactNode;\n} = {}) => {\n const [confirm, setConfim] = useState({\n show: false,\n message: '',\n children: null as ReactNode | null,\n resolve: (_val: T) => {},\n });\n const prompt = useCallback(\n (message?: string | ReactNode) =>\n new Promise<T>(resolve => {\n setConfim({\n message: typeof message === 'string' ? message : '',\n children: typeof message !== 'string' && message ? message : null,\n show: true,\n resolve(val: T) {\n resolve(val);\n setConfim({\n show: false,\n message: '',\n children: null,\n resolve: () => {},\n });\n },\n });\n }),\n [],\n );\n\n return {\n prompt,\n children: (\n <Dimmer visible={confirm.show}>\n <Modal visible>\n <Header attached>{title ?? 'Confirmation'}</Header>\n <PopoutContent>\n {content ?? confirm.children ?? (\n <p>Are you sure you want to {confirm.message}?</p>\n )}\n </PopoutContent>\n <Footer attached>\n {leftButton?.(confirm.resolve) ?? (\n <Button main onClick={() => confirm.resolve(true as T)}>\n <IconCheck />\n Yes\n </Button>\n )}\n <div style={{ flex: 1 }} />\n {rightButton?.(confirm.resolve) ?? (\n <Button normal onClick={() => confirm.resolve(false as T)}>\n <IconX />\n No\n </Button>\n )}\n </Footer>\n </Modal>\n </Dimmer>\n ),\n };\n};\n"],"names":["$version","atom","darkBg","lightBg","Background","children","version","useStore","jsxs","jsx","Button","warn","main","error","info","normal","disabled","icon","boxy","onClick","className","props","Footer","attached","Header","Input","placeholder","tooltip","type","value","roboto","onBlur","onFocus","onSubmit","onChange","e","newValue","sizes","Loader","blur","active","inline","size","IconLoader","Dimmer","visible","PopoutContent","Modal","useConfirm","leftButton","rightButton","title","content","confirm","setConfim","useState","_val","useCallback","message","resolve","val","IconCheck","IconX"],"mappings":"2RAEO,MAAMA,EAAWC,EAAoB,IAAI,ECFhDC,EAAe,gCCAfC,EAAe,gCCMFC,EAAa,CAAC,CAAE,SAAAC,KAAwC,CACnE,MAAMC,EAAUC,EAASP,CAAQ,EACjC,OACEQ,EAAAA,KAAC,MAAA,CAAI,UAAU,aACb,SAAA,CAAAC,EAAAA,IAAC,MAAA,CAAI,UAAU,cAAc,IAAKP,EAAQ,EAC1CO,EAAAA,IAAC,MAAA,CAAI,UAAU,eAAe,IAAKN,EAAS,EAC3CG,GAAWE,EAAAA,KAAC,MAAA,CAAI,UAAU,UAAU,SAAA,CAAA,WAASF,CAAA,EAAQ,EACrDD,CAAA,EACH,CAEJ,ECbaK,EAAS,CAAC,CACrB,SAAAL,EACA,KAAAM,EACA,KAAAC,EACA,MAAAC,EACA,KAAAC,EACA,OAAAC,EACA,SAAAC,EAAW,GACX,KAAAC,EACA,KAAAC,EACA,QAAAC,EACA,UAAAC,EACA,GAAGC,CACL,IAYEZ,EAAAA,IAAC,MAAA,CACC,UAAW,CACT,SACAW,GAAa,GACbT,GAAQ,OACRC,GAAQ,OACRC,GAAS,QACTC,GAAQ,OACRC,GAAU,SACVC,GAAY,WACZE,GAAQ,OACRD,GAAQ,MAAA,EAEP,OAAO,OAAO,EACd,KAAK,GAAG,EACX,QAAAE,EACC,GAAGE,EAEJ,SAAAZ,EAAAA,IAAC,MAAA,CAAI,UAAU,iBAAkB,SAAAJ,CAAA,CAAS,CAAA,CAC5C,EC7CWiB,EAAS,CAAC,CACrB,SAAAjB,EACA,UAAAe,EACA,SAAAG,EACA,GAAGF,CACL,IAGEZ,EAAAA,IAAC,MAAA,CACC,UAAW,UAAUc,EAAW,WAAa,EAAE,IAAIH,GAAa,EAAE,GACjE,GAAGC,EAEH,SAAAhB,CAAA,CACH,ECZWmB,EAAS,CAAC,CACrB,SAAAnB,EACA,UA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