authhero 8.27.0 → 9.0.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/LICENSE +661 -21
- package/dist/assets/u/js/client.js +2 -2
- package/dist/assets/u/widget/index.esm.js +1 -1
- package/dist/authhero.cjs +265 -251
- package/dist/authhero.d.ts +125 -63
- package/dist/authhero.mjs +24322 -17681
- package/dist/client.js +2 -2
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authentication-flows/passwordless.d.ts +3 -3
- package/dist/types/client/client-bundle.d.ts +1 -1
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
- package/dist/types/helpers/link-candidates.d.ts +28 -0
- package/dist/types/helpers/logging.d.ts +8 -0
- package/dist/types/helpers/scopes-permissions.d.ts +18 -0
- package/dist/types/helpers/signing-keys.d.ts +36 -0
- package/dist/types/helpers/users.d.ts +43 -0
- package/dist/types/hooks/codehooks.d.ts +9 -1
- package/dist/types/hooks/helpers/post-login-account-linking.d.ts +52 -0
- package/dist/types/hooks/pre-defined/account-linking.d.ts +20 -0
- package/dist/types/index.d.ts +62 -61
- package/dist/types/routes/auth-api/index.d.ts +28 -28
- package/dist/types/routes/auth-api/passwordless.d.ts +10 -10
- package/dist/types/routes/auth-api/register/index.d.ts +2 -2
- package/dist/types/routes/auth-api/revoke.d.ts +6 -6
- package/dist/types/routes/auth-api/token.d.ts +10 -10
- package/dist/types/routes/management-api/action-executions.d.ts +1 -1
- package/dist/types/routes/management-api/actions.d.ts +1 -1
- package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
- package/dist/types/routes/management-api/clients.d.ts +8 -8
- package/dist/types/routes/management-api/failed-events.d.ts +2 -1
- package/dist/types/routes/management-api/guardian.d.ts +5 -5
- package/dist/types/routes/management-api/index.d.ts +32 -31
- package/dist/types/routes/management-api/logs.d.ts +4 -4
- package/dist/types/routes/management-api/organizations.d.ts +1 -1
- package/dist/types/routes/management-api/prompts.d.ts +4 -4
- package/dist/types/routes/management-api/tenants.d.ts +6 -6
- package/dist/types/routes/management-api/users.d.ts +5 -5
- package/dist/types/routes/universal-login/common.d.ts +2 -2
- package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
- package/dist/types/types/Hooks.d.ts +8 -1
- package/package.json +7 -6
|
@@ -466,7 +466,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
466
466
|
custom_login_page_preview?: string | undefined;
|
|
467
467
|
form_template?: string | undefined;
|
|
468
468
|
addons?: Record<string, any> | undefined;
|
|
469
|
-
token_endpoint_auth_method?: "none" | "
|
|
469
|
+
token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
|
|
470
470
|
client_metadata?: Record<string, string> | undefined;
|
|
471
471
|
hide_sign_up_disabled_error?: boolean | undefined;
|
|
472
472
|
mobile?: Record<string, any> | undefined;
|
|
@@ -549,8 +549,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
|
|
|
549
549
|
} | undefined;
|
|
550
550
|
authenticated_at?: string | undefined;
|
|
551
551
|
};
|
|
552
|
-
connectionType: "
|
|
553
|
-
authConnection: "
|
|
552
|
+
connectionType: "email" | "sms" | "username";
|
|
553
|
+
authConnection: "email" | "sms" | "username";
|
|
554
554
|
session_id: string | undefined;
|
|
555
555
|
authParams: {
|
|
556
556
|
client_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const clientJs = "var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n={Stringify:1,BeforeStream:2,Stream:3},r=(e,t)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=t,n},i=/[&<>'\"]/,a=async(e,t)=>{let n=``;t||=[];let i=await Promise.all(e);for(let e=i.length-1;n+=i[e],e--,!(e<0);e--){let r=i[e];typeof r==`object`&&t.push(...r.callbacks||[]);let a=r.isEscaped;if(r=await(typeof r==`object`?r.toString():r),typeof r==`object`&&t.push(...r.callbacks||[]),r.isEscaped??a)n+=r;else{let e=[n];o(r,e),n=e[0]}}return r(n,t)},o=(e,t)=>{let n=e.search(i);if(n===-1){t[0]+=e;return}let r,a,o=0;for(a=n;a<e.length;a++){switch(e.charCodeAt(a)){case 34:r=`"`;break;case 39:r=`'`;break;case 38:r=`&`;break;case 60:r=`<`;break;case 62:r=`>`;break;default:continue}t[0]+=e.substring(o,a)+r,o=a+1}t[0]+=e.substring(o,a)},s=e=>{let t=e.callbacks;if(!t?.length)return e;let r=[e],i={};return t.forEach(e=>e({phase:n.Stringify,buffer:r,context:i})),r[0]},c=async(e,t,n,i,a)=>{typeof e==`object`&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let o=e.callbacks;if(!o?.length)return Promise.resolve(e);a?a[0]+=e:a=[e];let s=Promise.all(o.map(e=>e({phase:t,buffer:a,context:i}))).then(e=>Promise.all(e.filter(Boolean).map(e=>c(e,t,!1,i,a))).then(()=>a[0]));return n?r(await s,o):s},l=Symbol(`RENDERER`),u=Symbol(`ERROR_HANDLER`),d=Symbol(`STASH`),f=Symbol(`INTERNAL`),p=Symbol(`MEMO`),m=Symbol(`PERMALINK`),h=e=>(e[f]=!0,e),g=e=>({value:t,children:n})=>{if(!n)return;let r={children:[{tag:h(()=>{e.push(t)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:h(()=>{e.pop()}),props:{}});let i={tag:``,props:r,type:``};return i[u]=t=>{throw e.pop(),t},i},_=e=>{let t=[e],n=g(t);return n.values=t,n.Provider=n,v.push(n),n},v=[],y=!1,ee,te,ne=0,re=!1,ie=()=>{if(y)return ee;y=!0;let e=globalThis,t;for(let n of[()=>e.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncLocalStorage,()=>e.process?.mainModule?.require?.(`node:async_hooks`)?.AsyncLocalStorage]){try{t=n()}catch{}if(t)break}return t&&(ee=new t),ee},b=()=>ie()?.getStore()||te,ae=()=>{ne>0&&!re&&(re=!0,console.warn(`hono/jsx: AsyncLocalStorage is unavailable in this runtime, so useContext() after an await in an async component falls back to the context default value during server-side rendering. To get provided values across await boundaries, use a runtime with AsyncLocalStorage (Node.js >= 20.16, Deno, Bun, or Cloudflare Workers with the nodejs_compat flag).`))},oe=(e,t)=>{if(!e)return ae(),t.values;let n=e.get(t);return n||(n=[t.values[0]],e.set(t,n)),n},se=(e,t)=>{if(!e)return ae(),t.values.at(-1);let n=e.get(t);return n?.length?n.at(-1):t.values[0]},ce=e=>(e?v.filter(t=>e.has(t)):v).map(t=>[t,se(e,t)]),le=(e,t,n)=>ue(()=>{let t=b(),r=n.map(([e,n])=>{let r=oe(t,e);return r.push(n),r}),i=()=>{r.forEach(e=>{e.pop()})};try{let t=e();return t instanceof Promise?t.finally(i):(i(),t)}catch(e){throw i(),e}},t),ue=(e,t)=>{if(b())return e();let n=t??new WeakMap,r=ie();if(r)return r.run(n,e);te=n;let i;try{i=e()}finally{te=void 0}return!re&&i instanceof Promise&&(ne++,i=i.finally(()=>{ne--})),i},x=()=>{let e=b(),t=ce(e);return n=>le(n,e,t)},de=e=>{let t=[e],n=(e=>{let t=oe(b(),n);t.push(e.value);let i;try{i=e.children?(Array.isArray(e.children)?new Ke(``,{},e.children):e.children).toString():``}catch(e){throw t.pop(),e}return i instanceof Promise?i.finally(()=>t.pop()).then(e=>r(e,e.callbacks)):(t.pop(),r(i))});return n.values=t,n.Provider=n,n[l]=g(t),v.push(n),n},S=e=>se(b(),e),C={title:[],script:[`src`],style:[`data-href`],link:[`href`],meta:[`name`,`httpEquiv`,`charset`,`itemProp`]},fe={},pe=`data-precedence`,me=e=>e.rel===`stylesheet`&&`precedence`in e,he=(e,t)=>e===`link`?t:C[e].length>0,w=e=>Array.isArray(e)?e:[e],ge=t({button:()=>Oe,form:()=>Te,input:()=>De,link:()=>Se,meta:()=>Ce,script:()=>be,style:()=>xe,title:()=>ye}),_e=new WeakMap,ve=(e,t,n,r)=>({buffer:i,context:a})=>{if(!i)return;let o=_e.get(a)||{};_e.set(a,o);let s=o[e]||=[],c=!1,l=C[e],u=he(e,r!==void 0);if(u){LOOP:for(let[,t]of s)if(!(e===`link`&&!(t.rel===`stylesheet`&&t[`data-precedence`]!==void 0))){for(let e of l)if((t?.[e]??null)===n?.[e]){c=!0;break LOOP}}}if(c?i[0]=i[0].replaceAll(t,``):u||e===`link`?s.push([t,n,r]):s.unshift([t,n,r]),i[0].indexOf(`</head>`)!==-1){let t;if(e===`link`||r!==void 0){let e=[];t=s.map(([t,,n],r)=>{if(n===void 0)return[t,2**53-1,r];let i=e.indexOf(n);return i===-1&&(e.push(n),i=e.length-1),[t,i,r]}).sort((e,t)=>e[1]-t[1]||e[2]-t[2]).map(([e])=>e)}else t=s.map(([e])=>e);t.forEach(e=>{i[0]=i[0].replaceAll(e,``)}),i[0]=i[0].replace(/(?=<\\/head>)/,t.join(``))}},T=(e,t,n)=>r(new P(e,n,w(t??[])).toString()),E=(e,t,n,i)=>{if(`itemProp`in n)return T(e,t,n);let{precedence:a,blocking:o,...s}=n;a=i?a??``:void 0,i&&(s[pe]=a);let c=new P(e,s,w(t||[])).toString();return c instanceof Promise?c.then(t=>r(c,[...t.callbacks||[],ve(e,t,s,a)])):r(c,[ve(e,c,s,a)])},ye=({children:e,...t})=>{let n=M();if(n){let r=S(n);if(r===`svg`||r===`head`)return new P(`title`,t,w(e??[]))}return E(`title`,e,t,!1)},be=({children:e,...t})=>{let n=M();return[`src`,`async`].some(e=>!t[e])||n&&S(n)===`head`?T(`script`,e,t):E(`script`,e,t,!1)},xe=({children:e,...t})=>[`href`,`precedence`].every(e=>e in t)?(t[`data-href`]=t.href,delete t.href,E(`style`,e,t,!0)):T(`style`,e,t),Se=({children:e,...t})=>[`onLoad`,`onError`].some(e=>e in t)||t.rel===`stylesheet`&&(!(`precedence`in t)||`disabled`in t)?T(`link`,e,t):E(`link`,e,t,me(t)),Ce=({children:e,...t})=>{let n=M();return n&&S(n)===`head`?T(`meta`,e,t):E(`meta`,e,t,!1)},we=(e,{children:t,...n})=>new P(e,n,w(t??[])),Te=e=>(typeof e.action==`function`&&(e.action=m in e.action?e.action[m]:void 0),we(`form`,e)),Ee=(e,t)=>(typeof t.formAction==`function`&&(t.formAction=m in t.formAction?t.formAction[m]:void 0),we(e,t)),De=e=>Ee(`input`,e),Oe=e=>Ee(`button`,e),ke=new Map([[`className`,`class`],[`htmlFor`,`for`],[`crossOrigin`,`crossorigin`],[`httpEquiv`,`http-equiv`],[`itemProp`,`itemprop`],[`fetchPriority`,`fetchpriority`],[`noModule`,`nomodule`],[`formAction`,`formaction`]]),D=e=>ke.get(e)||e,Ae=/[\\s\"'<>/=`\\\\\\x00-\\x1f\\x7f-\\x9f]/,O=new Set,je=1024,Me=/^[!?]|[\\s\"'<>/=`\\\\\\x00-\\x1f\\x7f-\\x9f]/,Ne=new Set,Pe=256,k=(e,t,n)=>{e.size>=t&&e.clear(),e.add(n)},Fe=e=>Ne.has(e)?!0:typeof e==`string`?e.length===0?!0:Me.test(e)?!1:(k(Ne,Pe,e),!0):!1,Ie=e=>{if(O.has(e))return!0;let t=e.length;if(t===0)return!1;for(let n=0;n<t;n++){let t=e.charCodeAt(n);if(!(t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===45||t===95||t===46||t===58))return Ae.test(e)?!1:(k(O,je,e),!0)}return k(O,je,e),!0},Le=/[\\s\"'():;\\\\/\\[\\]{}\\x00-\\x1f\\x7f-\\x9f]/,A=new Set,Re=1024,ze=e=>{if(A.has(e))return!0;let t=e.length;if(t===0)return!1;for(let n=0;n<t;n++){let t=e.charCodeAt(n);if(!(t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===45||t===95))return Le.test(e)?!1:(k(A,Re,e),!0)}return k(A,Re,e),!0},Be=/[;\"'\\\\/\\[\\](){}]/,Ve=e=>{if(!Be.test(e))return!1;let t=0,n=[];for(let r=0,i=e.length;r<i;r++){let a=e.charCodeAt(r);if(a===92){if(r===i-1)return!0;r++}else if(t!==0){if(a===10||a===12||a===13)return!0;a===t&&(t=0)}else if(a===47&&e.charCodeAt(r+1)===42){let t=e.indexOf(`*/`,r+2);if(t===-1)return!0;r=t+1}else if(a===34||a===39)t=a;else if(a===40)n.push(41);else if(a===91)n.push(93);else if(a===123||a===125)return!0;else if(a===41||a===93){if(n[n.length-1]!==a)return!0;n.pop()}else if(a===59&&n.length===0)return!0}return t!==0||n.length!==0},He=(e,t)=>{for(let[n,r]of Object.entries(e)){let e=n[0]===`-`||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);if(!ze(e))continue;if(r==null){t(e,null);continue}let i;if(typeof r==`number`)i=e.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/)?`${r}`:`${r}px`;else if(typeof r==`string`){if(Ve(r))continue;i=r}else continue;t(e,i)}},j=void 0,M=()=>j,Ue=e=>/[A-Z]/.test(e)&&e.match(/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/)?e.replace(/([A-Z])/g,`-$1`).toLowerCase():e,We=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Ge=`allowfullscreen.async.autofocus.autoplay.checked.controls.default.defer.disabled.download.formnovalidate.hidden.inert.ismap.itemscope.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.selected`.split(`.`),N=(e,t)=>{for(let n=0,r=e.length;n<r;n++){let r=e[n];if(typeof r==`string`)o(r,t);else if(typeof r==`boolean`||r==null)continue;else r instanceof P?r.toStringToBuffer(t):typeof r==`number`||r.isEscaped?t[0]+=r:r instanceof Promise?t.unshift(``,r):N(r,t)}},P=class{tag;props;key;children;isEscaped=!0;suspendedContext;constructor(e,t,n){if(typeof e!=`function`&&!Fe(e))throw Error(`Invalid JSX tag name: ${e}`);this.tag=e,this.props=t,this.children=n}get type(){return this.tag}get ref(){return this.props.ref||null}toString(){let e=()=>{let e=[``];return this.toStringToBuffer(e),e.length===1?`callbacks`in e?s(r(e[0],e.callbacks)).toString():e[0]:a(e,e.callbacks)};return this.suspendedContext?this.suspendedContext(e):ue(e)}toStringToBuffer(e){let t=this.tag,n=this.props,{children:i}=this;e[0]+=`<${t}`;let a=t===`svg`||j&&S(j)===`svg`?e=>Ue(D(e)):e=>D(e);for(let[s,c]of Object.entries(n))if(s=a(s),Ie(s)&&s!==`children`){if(s===`style`&&typeof c==`object`){let t=``;He(c,(e,n)=>{n!=null&&(t+=`${t?`;`:``}${e}:${n}`)}),e[0]+=` style=\"`,o(t,e),e[0]+=`\"`}else if(typeof c==`string`)e[0]+=` ${s}=\"`,o(c,e),e[0]+=`\"`;else if(c!=null)if(typeof c==`number`||c.isEscaped)e[0]+=` ${s}=\"${c}\"`;else if(typeof c==`boolean`&&Ge.includes(s))c&&(e[0]+=` ${s}=\"\"`);else if(s===`dangerouslySetInnerHTML`){if(i.length>0)throw Error(\"Can only set one of `children` or `props.dangerouslySetInnerHTML`.\");i=[r(c.__html)]}else if(c instanceof Promise)e[0]+=` ${s}=\"`,e.unshift(`\"`,c);else if(typeof c==`function`){if(!s.startsWith(`on`)&&s!==`ref`)throw Error(`Invalid prop '${s}' of type 'function' supplied to '${t}'.`)}else e[0]+=` ${s}=\"`,o(c.toString(),e),e[0]+=`\"`}if(We.includes(t)&&i.length===0){e[0]+=`/>`;return}e[0]+=`>`,N(i,e),e[0]+=`</${t}>`}},F=class extends P{toStringToBuffer(e){let{children:t}=this,n={...this.props};t.length&&(n.children=t.length===1?t[0]:t);let r=this.tag.call(null,n);if(!(typeof r==`boolean`||r==null))if(r instanceof Promise)if(v.length===0)e.unshift(``,r);else{let t=x();e.unshift(``,r.then(e=>(e instanceof P&&(e.suspendedContext=t),e)))}else r instanceof P?r.toStringToBuffer(e):typeof r==`number`||r.isEscaped?(e[0]+=r,r.callbacks&&(e.callbacks||=[],e.callbacks.push(...r.callbacks))):o(r,e)}},Ke=class extends P{toStringToBuffer(e){N(this.children,e)}},qe=(e,t,...n)=>{t??={},n.length&&(t.children=n.length===1?n[0]:n);let r=t.key;delete t.key;let i=I(e,t,n);return i.key=r,i},Je=!1,I=(e,t,n)=>{if(!Je){for(let e in fe)ge[e][l]=fe[e];Je=!0}return typeof e==`function`?new F(e,t,n):ge[e]?new F(ge[e],t,n):e===`svg`||e===`head`?(j||=de(``),new P(e,t,[new F(j,{value:e},n)])):new P(e,t,n)},L=({children:e})=>new Ke(``,{children:e},Array.isArray(e)?e:e?[e]:[]),R=`_hp`,Ye={Change:`Input`,DoubleClick:`DblClick`},Xe={svg:`2000/svg`,math:`1998/Math/MathML`},z=[],Ze=new WeakMap,B=void 0,Qe=()=>B,V=e=>`t`in e,$e={onClick:[`click`,!1]},et=e=>{if(!e.startsWith(`on`))return;if($e[e])return $e[e];let t=e.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(t){let[,n,r]=t;return $e[e]=[(Ye[n]||n).toLowerCase(),!!r]}},tt=(e,t)=>B&&e instanceof SVGElement&&/[A-Z]/.test(t)&&(t in e.style||t.match(/^(?:o|pai|str|u|ve)/))?t.replace(/([A-Z])/g,`-$1`).toLowerCase():t,nt=e=>e==null||e===!1?null:e,rt=(e,t)=>{`value`in t&&(e.value=nt(t.value),!e.multiple&&e.selectedIndex===-1&&(e.selectedIndex=0))},it=e=>e instanceof DOMException&&e.name===`InvalidCharacterError`,at=(e,t,n)=>{t||={};for(let r in t){let i=t[r];if(r!==`children`&&(!n||n[r]!==i)){r=D(r);let t=et(r);if(t){if(n?.[r]!==i&&(n&&e.removeEventListener(t[0],n[r],t[1]),i!=null)){if(typeof i!=`function`)throw Error(`Event handler for \"${r}\" is not a function`);e.addEventListener(t[0],i,t[1])}}else if(r===`dangerouslySetInnerHTML`&&i)e.innerHTML=i.__html;else if(r===`ref`){let t;typeof i==`function`?t=i(e)||(()=>i(null)):i&&`current`in i&&(i.current=e,t=()=>i.current=null),Ze.set(e,t)}else if(r===`style`){let t=e.style;typeof i==`string`?t.cssText=i:(t.cssText=``,i!=null&&He(i,t.setProperty.bind(t)))}else{if(r===`value`){let t=e.nodeName;if(t===`SELECT`)continue;if((t===`INPUT`||t===`TEXTAREA`)&&(e.value=nt(i),t===`TEXTAREA`)){e.textContent=i;continue}}else(r===`checked`&&e.nodeName===`INPUT`||r===`selected`&&e.nodeName===`OPTION`)&&(e[r]=i);let t=tt(e,r);try{i==null||i===!1?e.removeAttribute(t):i===!0?e.setAttribute(t,``):typeof i==`string`||typeof i==`number`?e.setAttribute(t,i):e.setAttribute(t,i.toString())}catch(e){if(!it(e))throw e}}}}if(n)for(let r in n){let i=n[r];if(r!==`children`&&!(r in t)){r=D(r);let t=et(r);if(t)e.removeEventListener(t[0],i,t[1]);else if(r===`ref`)Ze.get(e)?.();else try{e.removeAttribute(tt(e,r))}catch(e){if(!it(e))throw e}}}},ot=(e,t)=>{t[d][0]=0,z.push([e,t]);let n=t.tag[l]||t.tag,r=n.defaultProps?{...n.defaultProps,...t.props}:t.props;try{return[n.call(null,r)]}finally{z.pop()}},st=(e,t,n,r,i)=>{e.vR?.length&&(r.push(...e.vR),delete e.vR),typeof e.tag==`function`&&e[d][1][1]?.forEach(e=>i.push(e)),e.vC.forEach(e=>{if(V(e))n.push(e);else if(typeof e.tag==`function`||e.tag===``){e.c=t;let a=n.length;if(st(e,t,n,r,i),e.s){for(let e=a;e<n.length;e++)n[e].s=!0;e.s=!1}}else n.push(e),e.vR?.length&&(r.push(...e.vR),delete e.vR)})},ct=e=>{for(;e&&(e.tag===R||!e.e);)e=e.tag===R||!e.vC?.[0]?e.nN:e.vC[0];return e?.e},lt=e=>{V(e)||(e[d]?.[1][1]?.forEach(e=>e[2]?.()),Ze.get(e.e)?.(),e.p===2&&e.vC?.forEach(e=>e.p=2),e.vC?.forEach(lt)),e.p||(e.e?.remove(),delete e.e),typeof e.tag==`function`&&(G.delete(e),U.delete(e),delete e[d][3],e.a=!0)},H=(e,t,n)=>{e.c=t,ft(e,t,n)},ut=(e,t)=>{if(t){for(let n=0,r=e.length;n<r;n++)if(e[n]===t)return n}},dt=Symbol(),ft=(e,t,n)=>{let r=[],i=[],a=[];st(e,t,r,i,a),i.forEach(lt);let o=n?void 0:t.childNodes,s,c=null;if(n)s=-1;else if(!o.length)s=0;else{let t=ut(o,ct(e.nN));t===void 0?s=ut(o,r.find(e=>e.tag!==R&&e.e)?.e)??-1:(c=o[t],s=t),s===-1&&(n=!0)}for(let e=0,i=r.length;e<i;e++,s++){let i=r[e],a;if(i.s&&i.e)a=i.e,i.s=!1;else{let e=n||!i.e;V(i)?(i.e&&i.d&&(i.e.textContent=i.t),i.d=!1,a=i.e||=document.createTextNode(i.t)):(a=i.e||=i.n?document.createElementNS(i.n,i.tag):document.createElement(i.tag),at(a,i.props,i.pP),ft(i,a,e),i.tag===`select`&&rt(a,i.props))}i.tag===R?s--:n?a.parentNode||t.appendChild(a):o[s]!==a&&o[s-1]!==a&&(o[s+1]===a?t.appendChild(o[s]):t.insertBefore(a,c||o[s]||null))}if(e.pP&&=void 0,a.length){let e=[],t=[];a.forEach(([,n,,r,i])=>{n&&e.push(n),r&&t.push(r),i?.()}),e.forEach(e=>e()),t.length&&requestAnimationFrame(()=>{t.forEach(e=>e())})}},pt=(e,t)=>!!(e&&e.length===t.length&&e.every((e,n)=>e[1]===t[n][1])),U=new WeakMap,W=(e,t,n)=>{let r=!n&&t.pC;n&&(t.pC||=t.vC);let i;try{n||=typeof t.tag==`function`?ot(e,t):w(t.props.children),n[0]?.tag===``&&n[0][u]&&(i=n[0][u],e[5].push([e,i,t]));let a=r?[...t.pC]:t.vC?[...t.vC]:void 0,o=[],s;for(let r=0;r<n.length;r++){if(Array.isArray(n[r])){n.splice(r,1,...n[r].flat(1/0)),r--;continue}let i=mt(n[r]);if(i){typeof i.tag==`function`&&!i.tag[f]&&(v.length>0&&(i[d][2]=v.map(e=>[e,e.values.at(-1)])),e[5]?.length&&(i[d][3]=e[5].at(-1)));let n;if(a&&a.length){let e=a.findIndex(V(i)?e=>V(e):i.key===void 0?e=>e.tag===i.tag:e=>e.key===i.key&&e.tag===i.tag);e!==-1&&(n=a[e],a.splice(e,1))}if(n)if(V(i))n.t!==i.t&&(n.t=i.t,n.d=!0),i=n;else{let e=n.pP=n.props;if(n.props=i.props,n.f||=i.f||t.f,typeof i.tag==`function`){let t=n[d][2];n[d][2]=i[d][2]||[],n[d][3]=i[d][3],!n.f&&((n.o||n)===i.o||n.tag[p]?.(e,n.props))&&pt(t,n[d][2])&&(n.s=!0)}i=n}else if(!V(i)&&B){let e=S(B);e&&(i.n=e)}if(!V(i)&&!i.s&&(W(e,i),delete i.f),o.push(i),s&&!s.s&&!i.s)for(let e=s;e&&!V(e);e=e.vC?.at(-1))e.nN=i;s=i}}t.vR=r?[...t.vC,...a||[]]:a||[],t.vC=o,r&&delete t.pC}catch(n){if(t.f=!0,n===dt){if(i)return;throw n}let[r,a,o]=t[d]?.[3]||[];if(a){let t=()=>K([0,!1,e[2]],o),i=U.get(o)||[];i.push(t),U.set(o,i);let s=a(n,()=>{let e=U.get(o);if(e){let n=e.indexOf(t);if(n!==-1)return e.splice(n,1),t()}});if(s){if(e[0]===1)e[1]=!0;else if(W(e,o,[s]),(a.length===1||e!==r)&&o.c){H(o,o.c,!1);return}throw dt}}throw n}finally{i&&e[5].pop()}},mt=e=>{if(!(e==null||typeof e==`boolean`)){if(typeof e==`string`||typeof e==`number`)return{t:e.toString(),d:!0};if(`vR`in e&&(e={tag:e.tag,props:e.props,key:e.key,f:e.f,type:e.tag,ref:e.props.ref,o:e.o||e}),typeof e.tag==`function`)e[d]=[0,[]];else{let t=Xe[e.tag];t&&(B||=_(``),e.props.children=[{tag:B,props:{value:e.n=`http://www.w3.org/${t}`,children:e.props.children}}])}return e}},ht=(e,t,n)=>{e.c===t&&(e.c=n,e.vC.forEach(e=>ht(e,t,n)))},gt=(e,t)=>{t[d][2]?.forEach(([e,t])=>{e.values.push(t)});try{W(e,t,void 0)}catch{return}if(t.a){delete t.a;return}t[d][2]?.forEach(([e])=>{e.values.pop()}),(e[0]!==1||!e[1])&&H(t,t.c,!1)},G=new WeakMap,_t=[],K=async(e,t)=>{e[5]||=[];let n=G.get(t);n&&n[0](void 0);let r,i=new Promise(e=>r=e);if(G.set(t,[r,()=>{e[2]?e[2](e,t,e=>{gt(e,t)}).then(()=>r(t)):(gt(e,t),r(t))}]),_t.length)_t.at(-1).add(t);else{await Promise.resolve();let e=G.get(t);e&&(G.delete(t),e[1]())}return i},vt=(e,t)=>{let n=[];n[5]=[],n[4]=!0,W(n,e,void 0),n[4]=!1;let r=document.createDocumentFragment();H(e,r,!0),ht(e,r,t),t.replaceChildren(r)},yt=(e,t,n)=>({tag:R,props:{children:e},key:n,e:t,p:1}),bt=0,xt=2,St=3,Ct=new WeakMap,wt=(e,t)=>!e||!t||e.length!==t.length||t.some((t,n)=>t!==e[n]),Tt=void 0,Et=[],Dt=e=>{let t=()=>typeof e==`function`?e():e,n=z.at(-1);if(!n)return[t(),()=>{}];let[,r]=n,i=r[d][1][bt]||=[],a=r[d][0]++;return i[a]||=[t(),e=>{let t=Tt,n=i[a];if(typeof e==`function`&&(e=e(n[0])),!Object.is(e,n[0]))if(n[0]=e,Et.length){let[e,n]=Et.at(-1);Promise.all([e===3?r:K([e,!1,t],r),n]).then(([n])=>{if(!n||!(e===2||e===3))return;let r=n.vC;requestAnimationFrame(()=>{setTimeout(()=>{r===n.vC&&K([+(e===3),!1,t],n)})})})}else K([0,!1,t],r)}]},Ot=(e,t,n)=>{let r=z.at(-1);if(!r)return;let[,i]=r,a=i[d][1][1]||=[],o=i[d][0]++,[s,,c]=a[o]||=[];if(wt(s,n)){c&&c();let r=()=>{i[e]=void 0,i[2]=t()},i=[n,void 0,void 0,void 0,void 0];i[e]=r,a[o]=i}},kt=(e,t)=>Ot(3,e,t),At=(e,t)=>{let n=z.at(-1);if(!n)return e;let[,r]=n,i=r[d][1][xt]||=[],a=r[d][0]++,o=i[a];return wt(o?.[1],t)?i[a]=[e,t]:e=i[a][0],e},jt=e=>{let t=Ct.get(e);if(t){if(t.length===2)throw t[1];return t[0]}throw e.then(t=>Ct.set(e,[t]),t=>Ct.set(e,[void 0,t])),e},Mt=(e,t)=>{let n=z.at(-1);if(!n)return e();let[,r]=n,i=r[d][1][St]||=[],a=r[d][0]++,o=i[a];return wt(o?.[1],t)&&(i[a]=[e(),t]),i[a][0]},Nt=_({pending:!1,data:null,method:null,action:null}),Pt=new Set,Ft=e=>{Pt.add(e),e.finally(()=>Pt.delete(e))},It=t({button:()=>Yt,clearCache:()=>Lt,composeRef:()=>q,form:()=>Kt,input:()=>Jt,link:()=>Ut,meta:()=>Wt,script:()=>Vt,style:()=>Ht,title:()=>Bt}),Lt=()=>{Rt=Object.create(null),zt=Object.create(null)},q=(e,t)=>Mt(()=>n=>{let r;e&&(typeof e==`function`?r=e(n)||(()=>{e(null)}):e&&`current`in e&&(e.current=n,r=()=>{e.current=null}));let i=t(n);return()=>{i?.(),r?.()}},[e]),Rt=Object.create(null),zt=Object.create(null),J=(e,t,n,r,i)=>{if(t?.itemProp)return{tag:e,props:t,type:e,ref:t.ref};let a=document.head,{onLoad:o,onError:s,precedence:c,blocking:l,...u}=t,d=null,f=!1,p=C[e],m=he(e,r),h=e=>e.getAttribute(`rel`)===`stylesheet`&&e.getAttribute(`data-precedence`)!==null,g;if(m){let n=a.querySelectorAll(e);LOOP:for(let r of n)if(!(e===`link`&&!h(r))){for(let e of p)if(r.getAttribute(e)===t[e]){d=r;break LOOP}}if(!d){let n=p.reduce((e,n)=>t[n]===void 0?e:`${e}-${n}-${t[n]}`,e);f=!zt[n],d=zt[n]||=(()=>{let n=document.createElement(e);for(let e of p)t[e]!==void 0&&n.setAttribute(e,t[e]);return t.rel&&n.setAttribute(`rel`,t.rel),n})()}}else g=a.querySelectorAll(e);c=r?c??``:void 0,r&&(u[pe]=c);let _=At(t=>{if(m){if(e===`link`&&c!==void 0){let n=!1;for(let r of a.querySelectorAll(e)){let e=r.getAttribute(pe);if(e===null){a.insertBefore(t,r);return}if(n&&e!==c){a.insertBefore(t,r);return}e===c&&(n=!0)}a.appendChild(t);return}let n=!1;for(let r of a.querySelectorAll(e)){if(n&&r.getAttribute(`data-precedence`)!==c){a.insertBefore(t,r);return}r.getAttribute(`data-precedence`)===c&&(n=!0)}a.appendChild(t)}else if(e===`link`)a.contains(t)||a.appendChild(t);else if(g){let n=!1;for(let e of g)if(e===t){n=!0;break}n||a.insertBefore(t,a.contains(g[0])?g[0]:a.querySelector(e)),g=void 0}},[m,c,e]),v=q(t.ref,e=>{let t=p[0];if(n===2&&(e.innerHTML=``),(f||g)&&_(e),!s&&!o||!t)return;let r=Rt[e.getAttribute(t)]||=new Promise((t,n)=>{e.addEventListener(`load`,t),e.addEventListener(`error`,n)});o&&(r=r.then(o)),s&&(r=r.catch(s)),r.catch(()=>{})});if(i&&l===`render`){let n=C[e][0];if(n&&t[n]){let e=t[n];jt(Rt[e]||=new Promise((e,t)=>{_(d),d.addEventListener(`load`,e),d.addEventListener(`error`,t)}))}}let y={tag:e,type:e,props:{...u,ref:v},ref:v};return y.p=n,d&&(y.e=d),yt(y,a)},Bt=e=>{let t=Qe();return(t&&S(t))?.endsWith(`svg`)?{tag:`title`,props:e,type:`title`,ref:e.ref}:J(`title`,e,void 0,!1,!1)},Vt=e=>!e||[`src`,`async`].some(t=>!e[t])?{tag:`script`,props:e,type:`script`,ref:e.ref}:J(`script`,e,1,!1,!0),Ht=e=>!e||![`href`,`precedence`].every(t=>t in e)?{tag:`style`,props:e,type:`style`,ref:e.ref}:(e[`data-href`]=e.href,delete e.href,J(`style`,e,2,!0,!0)),Ut=e=>!e||[`onLoad`,`onError`].some(t=>t in e)||e.rel===`stylesheet`&&(!(`precedence`in e)||`disabled`in e)?{tag:`link`,props:e,type:`link`,ref:e.ref}:J(`link`,e,1,me(e),!0),Wt=e=>J(`meta`,e,void 0,!1,!1),Gt=Symbol(),Kt=e=>{let{action:t,...n}=e;typeof t!=`function`&&(n.action=t);let[r,i]=Dt([null,!1]),a=At(async e=>{let n=e.isTrusted?t:e.detail[Gt];if(typeof n!=`function`)return;e.preventDefault();let r=new FormData(e.target);i([r,!0]);let a=n(r);a instanceof Promise&&(Ft(a),await a),i([null,!0])},[]),o=q(e.ref,e=>(e.addEventListener(`submit`,a),()=>{e.removeEventListener(`submit`,a)})),[s,c]=r;return r[1]=!1,{tag:Nt,props:{value:{pending:s!==null,data:s,method:s?`post`:null,action:s?t:null},children:{tag:`form`,props:{...n,ref:o},type:`form`,ref:o}},f:c}},qt=(e,{formAction:t,...n})=>{if(typeof t==`function`){let e=At(e=>{e.preventDefault(),e.currentTarget.form.dispatchEvent(new CustomEvent(`submit`,{detail:{[Gt]:t}}))},[]);n.ref=q(n.ref,t=>(t.addEventListener(`click`,e),()=>{t.removeEventListener(`click`,e)}))}return{tag:e,props:n,type:e,ref:n.ref}},Jt=e=>qt(`input`,e),Yt=e=>qt(`button`,e);Object.assign(fe,{title:Bt,script:Vt,style:Ht,link:Ut,meta:Wt,form:Kt,input:Jt,button:Yt});var Xt=(e,t,n)=>(typeof e==`string`&&It[e]&&(e=It[e]),{tag:e,type:e,props:t,key:n,ref:t.ref}),Zt=e=>Xt(``,e,void 0),Qt=(({children:e,fallback:t,fallbackRender:n,onError:r})=>{let i=Zt({children:e});return i[u]=e=>{if(e instanceof Promise)throw e;return r?.(e),n?.(e)||t},i}),$t=(({children:e,fallback:t})=>{let n=Zt({children:e});return n[u]=(e,n)=>{if(!(e instanceof Promise))throw e;return e.finally(n),t},n}),en=de(null),tn=0,nn=async({children:e,fallback:t})=>{Array.isArray(e)||(e=[e]);let i=S(en)?.scriptNonce,a=[],o={[d]:[0,[]]},s=()=>{z.pop()};try{o[d][0]=0,z.push([[],o]),a=e.map(e=>e==null||typeof e==`boolean`?``:e.toString())}catch(t){if(t instanceof Promise){let n=x();a=[t.then(()=>n(()=>(o[d][0]=0,z.push([[],o]),an(e).finally(s))))]}else throw t}finally{s()}if(a.some(e=>e instanceof Promise)){let e=tn++,o=await t.toString();return r(`<template id=\"H:${e}\"></template>${o}<!--/$-->`,[...o.callbacks||[],({phase:t,buffer:o,context:s})=>{if(t!==n.BeforeStream)return Promise.all(a).then(async a=>{a=a.flat();let l=a.join(``);o&&(o[0]=o[0].replace(RegExp(`<template id=\"H:${e}\"></template>.*?<!--/\\\\$-->`),l));let u=o?``:`<template data-hono-target=\"H:${e}\">${l}</template><script${i?` nonce=\"${i}\"`:``}>\n((d,c,n) => {\nc=d.currentScript.previousSibling\nd=d.getElementById('H:${e}')\nif(!d)return\ndo{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='/$')\nd.replaceWith(c.content)\n})(document)\n<\\/script>`,d=a.map(e=>e.callbacks||[]).flat();return d.length?(t===n.Stream&&(u=await c(u,n.BeforeStream,!0,s)),r(u,d)):u})}])}else return r(a.join(``))};nn[l]=$t,new TextEncoder;var rn=0,an=async e=>{try{return e.flat().map(e=>e==null||typeof e==`boolean`?``:e.toString())}catch(t){if(t instanceof Promise){let n=x();return await t,n(()=>an(e))}else throw t}},on=e=>{if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`)return e;{let t=e.toString();return t instanceof Promise?t:r(t)}},sn=async({children:e,fallback:t,fallbackRender:i,onError:a})=>{if(!e)return r(``);Array.isArray(e)||(e=[e]);let o=S(en)?.scriptNonce,s,l=()=>s||=x(),u,d=()=>u||=(async()=>{let e=await t;if(typeof e==`string`)return e;{let t=await l()(()=>e?.toString());if(typeof t==`string`)return r(t,t.callbacks||e?.callbacks)}})(),f=async e=>{let t=await d();return l()(async()=>{a?.(e);let n=t===void 0?i&&qe(L,{},i(e))||``:t,o=await L({children:n}).toString();return r(o,o.callbacks||n.callbacks)})},p=[];try{p=e.map(on)}catch(t){let n=l();p=t instanceof Promise?[t.then(()=>n(()=>an(e))).catch(e=>f(e))]:[await f(t)]}if(p.some(e=>e instanceof Promise)){l();let e=rn++,t=RegExp(`(<template id=\"E:${e}\"></template>.*?)(.*?)(<!--E:${e}-->)`),i=!1,a=async({error:n,buffer:a})=>{if(i)return``;i=!0;let o=await f(n),s=o.callbacks;return a?(a[0]=a[0].replace(t,o),s?.length?r(``,s):``):r(`<template data-hono-target=\"E:${e}\">${o}</template><script>\n((d,c,n) => {\nc=d.currentScript.previousSibling\nd=d.getElementById('E:${e}')\nif(!d)return\ndo{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='E:${e}')\nd.replaceWith(c.content)\n})(document)\n<\\/script>`,s)},s,u=Promise.all(p).catch(e=>s=e);return r(`<template id=\"E:${e}\"></template><!--E:${e}-->`,[({phase:i,buffer:l,context:d})=>{if(i!==n.BeforeStream)return u.then(async u=>{if(s)throw s;u=u.flat();let f=u.join(``),p=l?``:`<template data-hono-target=\"E:${e}\">${f}</template><script${o?` nonce=\"${o}\"`:``}>\n((d,c) => {\nc=d.currentScript.previousSibling\nd=d.getElementById('E:${e}')\nif(!d)return\nd.parentElement.insertBefore(c.content,d.nextSibling)\n})(document)\n<\\/script>`;if(u.every(e=>!e.callbacks?.length))return l&&(l[0]=l[0].replace(t,f)),p;l&&(l[0]=l[0].replace(t,(e,t,n,r)=>`${t}${f}${r}`));let m=u.map(e=>e.callbacks||[]).flat();i===n.Stream&&(p=await c(p,n.BeforeStream,!0,d));let h=0,g=m.map(n=>(...i)=>n(...i)?.then(n=>(h++,l?(h===m.length&&(l[0]=l[0].replace(t,(e,t,n)=>n)),l[0]+=n,r(``,n.callbacks)):r(n+(h===m.length?`<script>\n((d,c,n) => {\nd=d.getElementById('E:${e}')\nif(!d)return\nn=d.nextSibling\nwhile(n.nodeType!=8||n.nodeValue!='E:${e}'){n=n.nextSibling}\nn.remove()\nd.remove()\n})(document)\n<\\/script>`:``),n.callbacks))).catch(e=>a({error:e,buffer:l})));return r(p,g)}).catch(e=>a({error:e,buffer:l}))}])}else return L({children:p})};sn[l]=Qt;var cn=(e,t={})=>{let n;return Object.keys(t).length>0&&console.warn(`createRoot options are not supported yet`),{render(t){if(n===null)throw Error(`Cannot update an unmounted root`);n?n(t):vt(mt({tag:()=>{let[e,r]=Dt(t);return n=r,e},props:{}}),e)},unmount(){n?.(null),n=null}}},ln=(e,t,n={})=>{let r=cn(e,n);return r.render(t),r};function un(){return kt(()=>{let e=document.querySelectorAll(`form`),t=[];return e.forEach(e=>{let n=e=>{if(e.defaultPrevented)return;let t=e.submitter;t&&t.type===`submit`&&(t.classList.add(`is-loading`),t.disabled=!0)};e.addEventListener(`submit`,n);let r=t=>{t.persisted&&e.querySelectorAll(`button[type=submit]`).forEach(e=>{e.classList.remove(`is-loading`),e.disabled=!1})};window.addEventListener(`pageshow`,r),t.push(()=>{e.removeEventListener(`submit`,n),window.removeEventListener(`pageshow`,r)})}),()=>{t.forEach(e=>e())}},[]),null}function dn(){return kt(()=>{let e=document.querySelectorAll(`a[data-loading-link]`),t=[];return e.forEach(e=>{let n=t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||e.classList.add(`is-loading`)};e.addEventListener(`click`,n);let r=t=>{t.persisted&&e.classList.remove(`is-loading`)};window.addEventListener(`pageshow`,r),t.push(()=>{e.removeEventListener(`click`,n),window.removeEventListener(`pageshow`,r)})}),()=>{t.forEach(e=>e())}},[]),null}function fn(){return kt(()=>{let e=document.querySelectorAll(`[data-password-toggle]`),t=[];return e.forEach(e=>{let n=e.querySelector(`input[type='password'], input[data-password-input]`),r=e.querySelector(`[data-password-toggle-btn]`),i=r?.querySelector(`[data-show-icon]`),a=r?.querySelector(`[data-hide-icon]`);if(!n||!r||!i||!a)return;let o=e=>{e?(n.type=`text`,n.setAttribute(`data-password-input`,`text`),i.classList.add(`hidden`),a.classList.remove(`hidden`)):(n.type=`password`,n.setAttribute(`data-password-input`,`password`),a.classList.add(`hidden`),i.classList.remove(`hidden`))},s=e=>{e.preventDefault();let t=n.type===`password`;o(t)};r.addEventListener(`click`,s),t.push(()=>{r.removeEventListener(`click`,s)})}),()=>{t.forEach(e=>e())}},[]),null}function pn(){return document.querySelectorAll(`[data-input-otp-container]`).forEach(e=>{let t=Array.from(e.querySelectorAll(`[data-input-otp-slot]`));if(!t.length)return;let n=e.closest(`form`),r=null;if(n&&t.length>0){let e=t[0]?.getAttribute(`name`);e&&(r=n.querySelector(`input[name=\"${e}\"][type=\"hidden\"]`),r||(r=document.createElement(`input`),r.type=`hidden`,r.name=e,n.appendChild(r)),t.forEach(e=>e.removeAttribute(`name`)))}let i=()=>{if(r){let e=t.map(e=>e.value).join(``);r.value=e,e.length===t.length&&n&&setTimeout(()=>{n.requestSubmit()},100)}};t.forEach((e,n)=>{e.addEventListener(`input`,e=>{let r=e.target,a=r.value;a=a.replace(/[^0-9]/g,``),a.length>1&&(a=a.charAt(0)),r.value=a,a&&n<t.length-1&&t[n+1]?.focus(),i()}),e.addEventListener(`paste`,e=>{e.preventDefault();let r=(e.clipboardData?.getData(`text`)||``).replace(/[^0-9]/g,``);for(let e=0;e<Math.min(r.length,t.length-n);e++){let i=t[n+e],a=r.charAt(e);i&&a&&(i.value=a)}let a=t.findIndex((e,t)=>t>=n&&!e.value);a===-1?t[Math.min(n+r.length,t.length-1)]?.focus():t[a]?.focus(),i()}),e.addEventListener(`keydown`,e=>{if(e.key===`Backspace`){let r=e.target;if(!r.value&&n>0){e.preventDefault();let r=t[n-1];r&&(r.value=``,r.focus()),i()}else r.value&&setTimeout(()=>i(),0)}else e.key===`ArrowLeft`&&n>0?(e.preventDefault(),t[n-1]?.focus()):e.key===`ArrowRight`&&n<t.length-1&&(e.preventDefault(),t[n+1]?.focus())}),e.addEventListener(`focus`,()=>{e.select()})}),i()}),null}var mn={d:(e,t)=>{for(var n in t)mn.o(t,n)&&!mn.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},hn={};mn.d(hn,{A:()=>gn,k:()=>Z});var Y=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},X=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function Z(){return Y(this,void 0,Promise,function(){return X(this,function(e){switch(e.label){case 0:return[4,new Promise(function(e,t){var n=`Unknown`,r=!1;function i(t){r||(r=!0,e({isPrivate:t,browserName:n}))}function a(){var e=0,t=-1;try{t.toFixed(t)}catch(t){e=t.message.length}return e}function o(){return Y(this,void 0,void 0,function(){var e,t;return X(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return n.sent(),i(!1),[3,3];case 2:return e=n.sent(),t=e instanceof Error&&typeof e.message==`string`?e.message:String(e),i(t.includes(`unknown transient reason`)),[3,3];case 3:return[2]}})})}function s(){return Y(this,void 0,Promise,function(){return X(this,function(e){switch(e.label){case 0:return typeof navigator.storage?.getDirectory==`function`?[4,o()]:[3,2];case 1:return e.sent(),[3,3];case 2:navigator.maxTouchPoints===void 0?function(){var e=window.openDatabase,t=window.localStorage;try{e(null,null,null,null)}catch{i(!0);return}try{t.setItem(`test`,`1`),t.removeItem(`test`)}catch{i(!0);return}i(!1)}():function(){var e=String(Math.random());try{var t=indexedDB.open(e,1);t.onupgradeneeded=function(t){var n=t.target.result,r=function(e){i(e)};try{n.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),r(!1)}catch(e){(e instanceof Error&&typeof e.message==`string`?e.message:String(e)).includes(`are not yet supported`)?r(!0):r(!1)}finally{n.close(),indexedDB.deleteDatabase(e)}},t.onerror=function(){return i(!1)}}catch{i(!1)}}(),e.label=3;case 3:return[2]}})})}function c(){return Y(this,void 0,Promise,function(){var e,t,n;return X(this,function(r){switch(r.label){case 0:if(typeof navigator.storage?.getDirectory!=`function`)return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return r.sent(),i(!1),[3,4];case 3:return e=r.sent(),t=e instanceof Error&&typeof e.message==`string`?e.message:String(e),i(t.includes(`Security error`)),[2];case 4:return[3,6];case 5:(n=indexedDB.open(`inPrivate`)).onerror=function(e){n.error&&n.error.name===`InvalidStateError`&&e.preventDefault(),i(!0)},n.onsuccess=function(){indexedDB.deleteDatabase(`inPrivate`),i(!1)},r.label=6;case 6:return[2]}})})}(function(){return Y(this,void 0,Promise,function(){return X(this,function(e){switch(e.label){case 0:return a()!==44&&a()!==43?[3,2]:(n=`Safari`,[4,s()]);case 1:return e.sent(),[3,6];case 2:return a()===51?(o=navigator.userAgent,n=o.match(/Chrome/)?navigator.brave===void 0?o.match(/Edg/)?`Edge`:o.match(/OPR/)?`Opera`:`Chrome`:`Brave`:`Chromium`,(r=new Worker(URL.createObjectURL(new Blob([`(async()=>{try{const r=await navigator.storage.getDirectory(),f=await(await r.getFileHandle('_',{create:true})).createSyncAccessHandle(),b=new Uint8Array(1);let m=1/0;for(let i=0;i<3;i++){f.write(b,{at:0});const s=performance.now();f.flush();const dt=performance.now()-s;if(dt<m)m=dt}f.close();postMessage(m<.1)}catch{postMessage(false)}})()`])))).onmessage=function(e){r.terminate(),i(e.data)},[3,6]):[3,3];case 3:return a()===25?(n=`Firefox`,[4,c()]):[3,5];case 4:return e.sent(),[3,6];case 5:navigator.msSaveBlob===void 0?t(Error(`detectIncognito cannot determine the browser`)):(n=`Internet Explorer`,i(window.indexedDB===void 0)),e.label=6;case 6:return[2]}var r,o})})})().catch(t)})];case 1:return[2,e.sent()]}})})}typeof window<`u`&&(window.detectIncognito=Z);var gn=Z;hn.A;var _n=hn.k,Q=`authhero_incognito_mode`;function vn(){try{let e=sessionStorage.getItem(Q);return e===null?void 0:e===`true`}catch{return}}async function yn(){try{let e=sessionStorage.getItem(Q);if(e!==null)return e===`true`;let{isPrivate:t}=await _n();return sessionStorage.setItem(Q,t.toString()),t}catch{try{sessionStorage.setItem(Q,`false`)}catch{}return!1}}var bn=()=>{let e=vn();if(e!==void 0){e&&xn();return}yn().then(e=>{e&&xn()}).catch(()=>{})};function xn(){let e=document.getElementById(`incognito-warning-container`);e&&e.classList.remove(`hidden`)}function $(e,t,n){let r;if(!t||!(`children`in t))r=I(e,t,[]);else{let n=t.children;r=Array.isArray(n)?I(e,t,n):I(e,t,[n])}return r.key=n,r}bn();var Sn=document.getElementById(`client-root`);Sn&&ln(Sn,$(L,{children:[$(un,{}),$(dn,{}),$(fn,{}),$(pn,{})]}));";
|
|
1
|
+
export declare const clientJs = "var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n={Stringify:1,BeforeStream:2,Stream:3},r=(e,t)=>{let n=new String(e);return n.isEscaped=!0,n.callbacks=t,n},i=/[&<>'\"]/,a=async(e,t)=>{let n=``;t||=[];let i=await Promise.all(e);for(let e=i.length-1;n+=i[e],e--,!(e<0);e--){let r=i[e];typeof r==`object`&&t.push(...r.callbacks||[]);let a=r.isEscaped;if(r=await(typeof r==`object`?r.toString():r),typeof r==`object`&&t.push(...r.callbacks||[]),r.isEscaped??a)n+=r;else{let e=[n];o(r,e),n=e[0]}}return r(n,t)},o=(e,t)=>{let n=e.search(i);if(n===-1){t[0]+=e;return}let r,a,o=0;for(a=n;a<e.length;a++){switch(e.charCodeAt(a)){case 34:r=`"`;break;case 39:r=`'`;break;case 38:r=`&`;break;case 60:r=`<`;break;case 62:r=`>`;break;default:continue}t[0]+=e.substring(o,a)+r,o=a+1}t[0]+=e.substring(o,a)},s=e=>{let t=e.callbacks;if(!t?.length)return e;let r=[e],i={};return t.forEach(e=>e({phase:n.Stringify,buffer:r,context:i})),r[0]},c=async(e,t,n,i,a)=>{typeof e==`object`&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let o=e.callbacks;if(!o?.length)return Promise.resolve(e);a?a[0]+=e:a=[e];let s=Promise.all(o.map(e=>e({phase:t,buffer:a,context:i}))).then(e=>Promise.all(e.filter(Boolean).map(e=>c(e,t,!1,i,a))).then(()=>a[0]));return n?r(await s,o):s},l=Symbol(`RENDERER`),u=Symbol(`ERROR_HANDLER`),d=Symbol(`STASH`),f=Symbol(`INTERNAL`),p=Symbol(`MEMO`),m=Symbol(`PERMALINK`),h=e=>(e[f]=!0,e),g=e=>({value:t,children:n})=>{if(!n)return;let r={children:[{tag:h(()=>{e.push(t)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:h(()=>{e.pop()}),props:{}});let i={tag:``,props:r,type:``};return i[u]=t=>{throw e.pop(),t},i},_=e=>{let t=[e],n=g(t);return n.values=t,n.Provider=n,v.push(n),n},v=[],y=!1,ee,te,ne=0,re=!1,ie=()=>{if(y)return ee;y=!0;let e=globalThis,t;for(let n of[()=>e.process?.getBuiltinModule?.(`node:async_hooks`)?.AsyncLocalStorage,()=>e.process?.mainModule?.require?.(`node:async_hooks`)?.AsyncLocalStorage]){try{t=n()}catch{}if(t)break}return t&&(ee=new t),ee},b=()=>ie()?.getStore()||te,ae=()=>{ne>0&&!re&&(re=!0,console.warn(`hono/jsx: AsyncLocalStorage is unavailable in this runtime, so useContext() after an await in an async component falls back to the context default value during server-side rendering. To get provided values across await boundaries, use a runtime with AsyncLocalStorage (Node.js >= 20.16, Deno, Bun, or Cloudflare Workers with the nodejs_compat flag).`))},oe=(e,t)=>{if(!e)return ae(),t.values;let n=e.get(t);return n||(n=[t.values[0]],e.set(t,n)),n},se=(e,t)=>{if(!e)return ae(),t.values.at(-1);let n=e.get(t);return n?.length?n.at(-1):t.values[0]},ce=e=>(e?v.filter(t=>e.has(t)):v).map(t=>[t,se(e,t)]),le=(e,t,n)=>ue(()=>{let t=b(),r=n.map(([e,n])=>{let r=oe(t,e);return r.push(n),r}),i=()=>{r.forEach(e=>{e.pop()})};try{let t=e();return t instanceof Promise?t.finally(i):(i(),t)}catch(e){throw i(),e}},t),ue=(e,t)=>{if(b())return e();let n=t??new WeakMap,r=ie();if(r)return r.run(n,e);te=n;let i;try{i=e()}finally{te=void 0}return!re&&i instanceof Promise&&(ne++,i=i.finally(()=>{ne--})),i},x=()=>{let e=b(),t=ce(e);return n=>le(n,e,t)},de=e=>{let t=[e],n=(e=>{let t=oe(b(),n);t.push(e.value);let i;try{i=e.children?(Array.isArray(e.children)?new Ke(``,{},e.children):e.children).toString():``}catch(e){throw t.pop(),e}return i instanceof Promise?i.finally(()=>t.pop()).then(e=>r(e,e.callbacks)):(t.pop(),r(i))});return n.values=t,n.Provider=n,n[l]=g(t),v.push(n),n},S=e=>se(b(),e),C={title:[],script:[`src`],style:[`data-href`],link:[`href`],meta:[`name`,`httpEquiv`,`charset`,`itemProp`]},fe={},pe=`data-precedence`,me=e=>e.rel===`stylesheet`&&`precedence`in e,he=(e,t)=>e===`link`?t:C[e].length>0,w=e=>Array.isArray(e)?e:[e],ge=t({button:()=>Oe,form:()=>Te,input:()=>De,link:()=>Se,meta:()=>Ce,script:()=>be,style:()=>xe,title:()=>ye}),_e=new WeakMap,ve=(e,t,n,r)=>({buffer:i,context:a})=>{if(!i)return;let o=_e.get(a)||{};_e.set(a,o);let s=o[e]||=[],c=!1,l=C[e],u=he(e,r!==void 0);if(u){LOOP:for(let[,t]of s)if(!(e===`link`&&!(t.rel===`stylesheet`&&t[`data-precedence`]!==void 0))){for(let e of l)if((t?.[e]??null)===n?.[e]){c=!0;break LOOP}}}if(c?i[0]=i[0].replaceAll(t,``):u||e===`link`?s.push([t,n,r]):s.unshift([t,n,r]),i[0].indexOf(`</head>`)!==-1){let t;if(e===`link`||r!==void 0){let e=[];t=s.map(([t,,n],r)=>{if(n===void 0)return[t,2**53-1,r];let i=e.indexOf(n);return i===-1&&(e.push(n),i=e.length-1),[t,i,r]}).sort((e,t)=>e[1]-t[1]||e[2]-t[2]).map(([e])=>e)}else t=s.map(([e])=>e);t.forEach(e=>{i[0]=i[0].replaceAll(e,``)}),i[0]=i[0].replace(/(?=<\\/head>)/,t.join(``))}},T=(e,t,n)=>r(new P(e,n,w(t??[])).toString()),E=(e,t,n,i)=>{if(`itemProp`in n)return T(e,t,n);let{precedence:a,blocking:o,...s}=n;a=i?a??``:void 0,i&&(s[pe]=a);let c=new P(e,s,w(t||[])).toString();return c instanceof Promise?c.then(t=>r(c,[...t.callbacks||[],ve(e,t,s,a)])):r(c,[ve(e,c,s,a)])},ye=({children:e,...t})=>{let n=M();if(n){let r=S(n);if(r===`svg`||r===`head`)return new P(`title`,t,w(e??[]))}return E(`title`,e,t,!1)},be=({children:e,...t})=>{let n=M();return[`src`,`async`].some(e=>!t[e])||n&&S(n)===`head`?T(`script`,e,t):E(`script`,e,t,!1)},xe=({children:e,...t})=>[`href`,`precedence`].every(e=>e in t)?(t[`data-href`]=t.href,delete t.href,E(`style`,e,t,!0)):T(`style`,e,t),Se=({children:e,...t})=>[`onLoad`,`onError`].some(e=>e in t)||t.rel===`stylesheet`&&(!(`precedence`in t)||`disabled`in t)?T(`link`,e,t):E(`link`,e,t,me(t)),Ce=({children:e,...t})=>{let n=M();return n&&S(n)===`head`?T(`meta`,e,t):E(`meta`,e,t,!1)},we=(e,{children:t,...n})=>new P(e,n,w(t??[])),Te=e=>(typeof e.action==`function`&&(e.action=m in e.action?e.action[m]:void 0),we(`form`,e)),Ee=(e,t)=>(typeof t.formAction==`function`&&(t.formAction=m in t.formAction?t.formAction[m]:void 0),we(e,t)),De=e=>Ee(`input`,e),Oe=e=>Ee(`button`,e),ke=new Map([[`className`,`class`],[`htmlFor`,`for`],[`crossOrigin`,`crossorigin`],[`httpEquiv`,`http-equiv`],[`itemProp`,`itemprop`],[`fetchPriority`,`fetchpriority`],[`noModule`,`nomodule`],[`formAction`,`formaction`]]),D=e=>ke.get(e)||e,Ae=/[\\s\"'<>/=`\\\\\\x00-\\x1f\\x7f-\\x9f]/,O=new Set,je=1024,Me=/^[!?]|[\\s\"'<>/=`\\\\\\x00-\\x1f\\x7f-\\x9f]/,Ne=new Set,Pe=256,k=(e,t,n)=>{e.size>=t&&e.clear(),e.add(n)},Fe=e=>Ne.has(e)?!0:typeof e==`string`?e.length===0?!0:Me.test(e)?!1:(k(Ne,Pe,e),!0):!1,Ie=e=>{if(O.has(e))return!0;let t=e.length;if(t===0)return!1;for(let n=0;n<t;n++){let t=e.charCodeAt(n);if(!(t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===45||t===95||t===46||t===58))return Ae.test(e)?!1:(k(O,je,e),!0)}return k(O,je,e),!0},Le=/[\\s\"'():;\\\\/\\[\\]{}\\x00-\\x1f\\x7f-\\x9f]/,A=new Set,Re=1024,ze=e=>{if(A.has(e))return!0;let t=e.length;if(t===0)return!1;for(let n=0;n<t;n++){let t=e.charCodeAt(n);if(!(t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||t===45||t===95))return Le.test(e)?!1:(k(A,Re,e),!0)}return k(A,Re,e),!0},Be=/[;\"'\\\\/\\[\\](){}]/,Ve=e=>{if(!Be.test(e))return!1;let t=0,n=[];for(let r=0,i=e.length;r<i;r++){let a=e.charCodeAt(r);if(a===92){if(r===i-1)return!0;r++}else if(t!==0){if(a===10||a===12||a===13)return!0;a===t&&(t=0)}else if(a===47&&e.charCodeAt(r+1)===42){let t=e.indexOf(`*/`,r+2);if(t===-1)return!0;r=t+1}else if(a===34||a===39)t=a;else if(a===40)n.push(41);else if(a===91)n.push(93);else if(a===123||a===125)return!0;else if(a===41||a===93){if(n[n.length-1]!==a)return!0;n.pop()}else if(a===59&&n.length===0)return!0}return t!==0||n.length!==0},He=(e,t)=>{for(let[n,r]of Object.entries(e)){let e=n[0]===`-`||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);if(!ze(e))continue;if(r==null){t(e,null);continue}let i;if(typeof r==`number`)i=e.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/)?`${r}`:`${r}px`;else if(typeof r==`string`){if(Ve(r))continue;i=r}else continue;t(e,i)}},j=void 0,M=()=>j,Ue=e=>/[A-Z]/.test(e)&&e.match(/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/)?e.replace(/([A-Z])/g,`-$1`).toLowerCase():e,We=[`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],Ge=`allowfullscreen.async.autofocus.autoplay.checked.controls.default.defer.disabled.download.formnovalidate.hidden.inert.ismap.itemscope.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.selected`.split(`.`),N=(e,t)=>{for(let n=0,r=e.length;n<r;n++){let r=e[n];if(typeof r==`string`)o(r,t);else if(typeof r==`boolean`||r==null)continue;else r instanceof P?r.toStringToBuffer(t):typeof r==`number`||r.isEscaped?t[0]+=r:r instanceof Promise?t.unshift(``,r):N(r,t)}},P=class{tag;props;key;children;isEscaped=!0;suspendedContext;constructor(e,t,n){if(typeof e!=`function`&&!Fe(e))throw Error(`Invalid JSX tag name: ${e}`);this.tag=e,this.props=t,this.children=n}get type(){return this.tag}get ref(){return this.props.ref||null}toString(){let e=()=>{let e=[``];return this.toStringToBuffer(e),e.length===1?`callbacks`in e?s(r(e[0],e.callbacks)).toString():e[0]:a(e,e.callbacks)};return this.suspendedContext?this.suspendedContext(e):ue(e)}toStringToBuffer(e){let t=this.tag,n=this.props,{children:i}=this;e[0]+=`<${t}`;let a=t===`svg`||j&&S(j)===`svg`?e=>Ue(D(e)):e=>D(e);for(let[s,c]of Object.entries(n))if(s=a(s),Ie(s)&&s!==`children`){if(s===`style`&&typeof c==`object`){let t=``;He(c,(e,n)=>{n!=null&&(t+=`${t?`;`:``}${e}:${n}`)}),e[0]+=` style=\"`,o(t,e),e[0]+=`\"`}else if(typeof c==`string`)e[0]+=` ${s}=\"`,o(c,e),e[0]+=`\"`;else if(c!=null)if(typeof c==`number`||c.isEscaped)e[0]+=` ${s}=\"${c}\"`;else if(typeof c==`boolean`&&Ge.includes(s))c&&(e[0]+=` ${s}=\"\"`);else if(s===`dangerouslySetInnerHTML`){if(i.length>0)throw Error(\"Can only set one of `children` or `props.dangerouslySetInnerHTML`.\");i=[r(c.__html)]}else if(c instanceof Promise)e[0]+=` ${s}=\"`,e.unshift(`\"`,c);else if(typeof c==`function`){if(!s.startsWith(`on`)&&s!==`ref`)throw Error(`Invalid prop '${s}' of type 'function' supplied to '${t}'.`)}else e[0]+=` ${s}=\"`,o(c.toString(),e),e[0]+=`\"`}if(We.includes(t)&&i.length===0){e[0]+=`/>`;return}e[0]+=`>`,N(i,e),e[0]+=`</${t}>`}},F=class extends P{toStringToBuffer(e){let{children:t}=this,n={...this.props};t.length&&(n.children=t.length===1?t[0]:t);let r=this.tag.call(null,n);if(!(typeof r==`boolean`||r==null))if(r instanceof Promise)if(v.length===0)e.unshift(``,r);else{let t=x();e.unshift(``,r.then(e=>(e instanceof P&&(e.suspendedContext=t),e)))}else r instanceof P?r.toStringToBuffer(e):typeof r==`number`||r.isEscaped?(e[0]+=r,r.callbacks&&(e.callbacks||=[],e.callbacks.push(...r.callbacks))):o(r,e)}},Ke=class extends P{toStringToBuffer(e){N(this.children,e)}},qe=(e,t,...n)=>{t??={},n.length&&(t.children=n.length===1?n[0]:n);let r=t.key;delete t.key;let i=I(e,t,n);return i.key=r,i},Je=!1,I=(e,t,n)=>{if(!Je){for(let e in fe)ge[e][l]=fe[e];Je=!0}return typeof e==`function`?new F(e,t,n):ge[e]?new F(ge[e],t,n):e===`svg`||e===`head`?(j||=de(``),new P(e,t,[new F(j,{value:e},n)])):new P(e,t,n)},L=({children:e})=>new Ke(``,{children:e},Array.isArray(e)?e:e?[e]:[]),R=`_hp`,Ye={Change:`Input`,DoubleClick:`DblClick`},Xe={svg:`2000/svg`,math:`1998/Math/MathML`},z=[],Ze=new WeakMap,B=void 0,Qe=()=>B,V=e=>`t`in e,$e={onClick:[`click`,!1]},et=e=>{if(!e.startsWith(`on`))return;if($e[e])return $e[e];let t=e.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(t){let[,n,r]=t;return $e[e]=[(Ye[n]||n).toLowerCase(),!!r]}},tt=(e,t)=>B&&e instanceof SVGElement&&/[A-Z]/.test(t)&&(t in e.style||t.match(/^(?:o|pai|str|u|ve)/))?t.replace(/([A-Z])/g,`-$1`).toLowerCase():t,nt=e=>e==null||e===!1?null:e,rt=(e,t)=>{`value`in t&&(e.value=nt(t.value),!e.multiple&&e.selectedIndex===-1&&(e.selectedIndex=0))},it=e=>e instanceof DOMException&&e.name===`InvalidCharacterError`,at=(e,t,n)=>{t||={};for(let r in t){let i=t[r];if(r!==`children`&&(!n||n[r]!==i)){r=D(r);let t=et(r);if(t){if(n?.[r]!==i&&(n&&e.removeEventListener(t[0],n[r],t[1]),i!=null)){if(typeof i!=`function`)throw Error(`Event handler for \"${r}\" is not a function`);e.addEventListener(t[0],i,t[1])}}else if(r===`dangerouslySetInnerHTML`&&i)e.innerHTML=i.__html;else if(r===`ref`){let t;typeof i==`function`?t=i(e)||(()=>i(null)):i&&`current`in i&&(i.current=e,t=()=>i.current=null),Ze.set(e,t)}else if(r===`style`){let t=e.style;typeof i==`string`?t.cssText=i:(t.cssText=``,i!=null&&He(i,t.setProperty.bind(t)))}else{if(r===`value`){let t=e.nodeName;if(t===`SELECT`)continue;if((t===`INPUT`||t===`TEXTAREA`)&&(e.value=nt(i),t===`TEXTAREA`)){e.textContent=i;continue}}else (r===`checked`&&e.nodeName===`INPUT`||r===`selected`&&e.nodeName===`OPTION`)&&(e[r]=i);let t=tt(e,r);try{i==null||i===!1?e.removeAttribute(t):i===!0?e.setAttribute(t,``):typeof i==`string`||typeof i==`number`?e.setAttribute(t,i):e.setAttribute(t,i.toString())}catch(e){if(!it(e))throw e}}}}if(n)for(let r in n){let i=n[r];if(r!==`children`&&!(r in t)){r=D(r);let t=et(r);if(t)e.removeEventListener(t[0],i,t[1]);else if(r===`ref`)Ze.get(e)?.();else try{e.removeAttribute(tt(e,r))}catch(e){if(!it(e))throw e}}}},ot=(e,t)=>{t[d][0]=0,z.push([e,t]);let n=t.tag[l]||t.tag,r=n.defaultProps?{...n.defaultProps,...t.props}:t.props;try{return[n.call(null,r)]}finally{z.pop()}},st=(e,t,n,r,i)=>{e.vR?.length&&(r.push(...e.vR),delete e.vR),typeof e.tag==`function`&&e[d][1][1]?.forEach(e=>i.push(e)),e.vC.forEach(e=>{if(V(e))n.push(e);else if(typeof e.tag==`function`||e.tag===``){e.c=t;let a=n.length;if(st(e,t,n,r,i),e.s){for(let e=a;e<n.length;e++)n[e].s=!0;e.s=!1}}else n.push(e),e.vR?.length&&(r.push(...e.vR),delete e.vR)})},ct=e=>{for(;e&&(e.tag===R||!e.e);)e=e.tag===R||!e.vC?.[0]?e.nN:e.vC[0];return e?.e},lt=e=>{V(e)||(e[d]?.[1][1]?.forEach(e=>e[2]?.()),Ze.get(e.e)?.(),e.p===2&&e.vC?.forEach(e=>e.p=2),e.vC?.forEach(lt)),e.p||(e.e?.remove(),delete e.e),typeof e.tag==`function`&&(G.delete(e),U.delete(e),delete e[d][3],e.a=!0)},H=(e,t,n)=>{e.c=t,ft(e,t,n)},ut=(e,t)=>{if(t){for(let n=0,r=e.length;n<r;n++)if(e[n]===t)return n}},dt=Symbol(),ft=(e,t,n)=>{let r=[],i=[],a=[];st(e,t,r,i,a),i.forEach(lt);let o=n?void 0:t.childNodes,s,c=null;if(n)s=-1;else if(!o.length)s=0;else{let t=ut(o,ct(e.nN));t===void 0?s=ut(o,r.find(e=>e.tag!==R&&e.e)?.e)??-1:(c=o[t],s=t),s===-1&&(n=!0)}for(let e=0,i=r.length;e<i;e++,s++){let i=r[e],a;if(i.s&&i.e)a=i.e,i.s=!1;else{let e=n||!i.e;V(i)?(i.e&&i.d&&(i.e.textContent=i.t),i.d=!1,a=i.e||=document.createTextNode(i.t)):(a=i.e||=i.n?document.createElementNS(i.n,i.tag):document.createElement(i.tag),at(a,i.props,i.pP),ft(i,a,e),i.tag===`select`&&rt(a,i.props))}i.tag===R?s--:n?a.parentNode||t.appendChild(a):o[s]!==a&&o[s-1]!==a&&(o[s+1]===a?t.appendChild(o[s]):t.insertBefore(a,c||o[s]||null))}if(e.pP&&=void 0,a.length){let e=[],t=[];a.forEach(([,n,,r,i])=>{n&&e.push(n),r&&t.push(r),i?.()}),e.forEach(e=>e()),t.length&&requestAnimationFrame(()=>{t.forEach(e=>e())})}},pt=(e,t)=>!!(e&&e.length===t.length&&e.every((e,n)=>e[1]===t[n][1])),U=new WeakMap,W=(e,t,n)=>{let r=!n&&t.pC;n&&(t.pC||=t.vC);let i;try{n||=typeof t.tag==`function`?ot(e,t):w(t.props.children),n[0]?.tag===``&&n[0][u]&&(i=n[0][u],e[5].push([e,i,t]));let a=r?[...t.pC]:t.vC?[...t.vC]:void 0,o=[],s;for(let r=0;r<n.length;r++){if(Array.isArray(n[r])){n.splice(r,1,...n[r].flat(1/0)),r--;continue}let i=mt(n[r]);if(i){typeof i.tag==`function`&&!i.tag[f]&&(v.length>0&&(i[d][2]=v.map(e=>[e,e.values.at(-1)])),e[5]?.length&&(i[d][3]=e[5].at(-1)));let n;if(a&&a.length){let e=a.findIndex(V(i)?e=>V(e):i.key===void 0?e=>e.tag===i.tag:e=>e.key===i.key&&e.tag===i.tag);e!==-1&&(n=a[e],a.splice(e,1))}if(n)if(V(i))n.t!==i.t&&(n.t=i.t,n.d=!0),i=n;else{let e=n.pP=n.props;if(n.props=i.props,n.f||=i.f||t.f,typeof i.tag==`function`){let t=n[d][2];n[d][2]=i[d][2]||[],n[d][3]=i[d][3],!n.f&&((n.o||n)===i.o||n.tag[p]?.(e,n.props))&&pt(t,n[d][2])&&(n.s=!0)}i=n}else if(!V(i)&&B){let e=S(B);e&&(i.n=e)}if(!V(i)&&!i.s&&(W(e,i),delete i.f),o.push(i),s&&!s.s&&!i.s)for(let e=s;e&&!V(e);e=e.vC?.at(-1))e.nN=i;s=i}}t.vR=r?[...t.vC,...a||[]]:a||[],t.vC=o,r&&delete t.pC}catch(n){if(t.f=!0,n===dt){if(i)return;throw n}let[r,a,o]=t[d]?.[3]||[];if(a){let t=()=>K([0,!1,e[2]],o),i=U.get(o)||[];i.push(t),U.set(o,i);let s=a(n,()=>{let e=U.get(o);if(e){let n=e.indexOf(t);if(n!==-1)return e.splice(n,1),t()}});if(s){if(e[0]===1)e[1]=!0;else if(W(e,o,[s]),(a.length===1||e!==r)&&o.c){H(o,o.c,!1);return}throw dt}}throw n}finally{i&&e[5].pop()}},mt=e=>{if(!(e==null||typeof e==`boolean`)){if(typeof e==`string`||typeof e==`number`)return{t:e.toString(),d:!0};if(`vR`in e&&(e={tag:e.tag,props:e.props,key:e.key,f:e.f,type:e.tag,ref:e.props.ref,o:e.o||e}),typeof e.tag==`function`)e[d]=[0,[]];else{let t=Xe[e.tag];t&&(B||=_(``),e.props.children=[{tag:B,props:{value:e.n=`http://www.w3.org/${t}`,children:e.props.children}}])}return e}},ht=(e,t,n)=>{e.c===t&&(e.c=n,e.vC.forEach(e=>ht(e,t,n)))},gt=(e,t)=>{t[d][2]?.forEach(([e,t])=>{e.values.push(t)});try{W(e,t,void 0)}catch{return}if(t.a){delete t.a;return}t[d][2]?.forEach(([e])=>{e.values.pop()}),(e[0]!==1||!e[1])&&H(t,t.c,!1)},G=new WeakMap,_t=[],K=async(e,t)=>{e[5]||=[];let n=G.get(t);n&&n[0](void 0);let r,i=new Promise(e=>r=e);if(G.set(t,[r,()=>{e[2]?e[2](e,t,e=>{gt(e,t)}).then(()=>r(t)):(gt(e,t),r(t))}]),_t.length)_t.at(-1).add(t);else{await Promise.resolve();let e=G.get(t);e&&(G.delete(t),e[1]())}return i},vt=(e,t)=>{let n=[];n[5]=[],n[4]=!0,W(n,e,void 0),n[4]=!1;let r=document.createDocumentFragment();H(e,r,!0),ht(e,r,t),t.replaceChildren(r)},yt=(e,t,n)=>({tag:R,props:{children:e},key:n,e:t,p:1}),bt=0,xt=2,St=3,Ct=new WeakMap,wt=(e,t)=>!e||!t||e.length!==t.length||t.some((t,n)=>t!==e[n]),Tt=void 0,Et=[],Dt=e=>{let t=()=>typeof e==`function`?e():e,n=z.at(-1);if(!n)return[t(),()=>{}];let[,r]=n,i=r[d][1][bt]||=[],a=r[d][0]++;return i[a]||=[t(),e=>{let t=Tt,n=i[a];if(typeof e==`function`&&(e=e(n[0])),!Object.is(e,n[0]))if(n[0]=e,Et.length){let[e,n]=Et.at(-1);Promise.all([e===3?r:K([e,!1,t],r),n]).then(([n])=>{if(!n||!(e===2||e===3))return;let r=n.vC;requestAnimationFrame(()=>{setTimeout(()=>{r===n.vC&&K([+(e===3),!1,t],n)})})})}else K([0,!1,t],r)}]},Ot=(e,t,n)=>{let r=z.at(-1);if(!r)return;let[,i]=r,a=i[d][1][1]||=[],o=i[d][0]++,[s,,c]=a[o]||=[];if(wt(s,n)){c&&c();let r=()=>{i[e]=void 0,i[2]=t()},i=[n,void 0,void 0,void 0,void 0];i[e]=r,a[o]=i}},kt=(e,t)=>Ot(3,e,t),At=(e,t)=>{let n=z.at(-1);if(!n)return e;let[,r]=n,i=r[d][1][xt]||=[],a=r[d][0]++,o=i[a];return wt(o?.[1],t)?i[a]=[e,t]:e=i[a][0],e},jt=e=>{let t=Ct.get(e);if(t){if(t.length===2)throw t[1];return t[0]}throw e.then(t=>Ct.set(e,[t]),t=>Ct.set(e,[void 0,t])),e},Mt=(e,t)=>{let n=z.at(-1);if(!n)return e();let[,r]=n,i=r[d][1][St]||=[],a=r[d][0]++,o=i[a];return wt(o?.[1],t)&&(i[a]=[e(),t]),i[a][0]},Nt=_({pending:!1,data:null,method:null,action:null}),Pt=new Set,Ft=e=>{Pt.add(e),e.finally(()=>Pt.delete(e))},It=t({button:()=>Yt,clearCache:()=>Lt,composeRef:()=>q,form:()=>Kt,input:()=>Jt,link:()=>Ut,meta:()=>Wt,script:()=>Vt,style:()=>Ht,title:()=>Bt}),Lt=()=>{Rt=Object.create(null),zt=Object.create(null)},q=(e,t)=>Mt(()=>n=>{let r;e&&(typeof e==`function`?r=e(n)||(()=>{e(null)}):e&&`current`in e&&(e.current=n,r=()=>{e.current=null}));let i=t(n);return()=>{i?.(),r?.()}},[e]),Rt=Object.create(null),zt=Object.create(null),J=(e,t,n,r,i)=>{if(t?.itemProp)return{tag:e,props:t,type:e,ref:t.ref};let a=document.head,{onLoad:o,onError:s,precedence:c,blocking:l,...u}=t,d=null,f=!1,p=C[e],m=he(e,r),h=e=>e.getAttribute(`rel`)===`stylesheet`&&e.getAttribute(`data-precedence`)!==null,g;if(m){let n=a.querySelectorAll(e);LOOP:for(let r of n)if(!(e===`link`&&!h(r))){for(let e of p)if(r.getAttribute(e)===t[e]){d=r;break LOOP}}if(!d){let n=p.reduce((e,n)=>t[n]===void 0?e:`${e}-${n}-${t[n]}`,e);f=!zt[n],d=zt[n]||=(()=>{let n=document.createElement(e);for(let e of p)t[e]!==void 0&&n.setAttribute(e,t[e]);return t.rel&&n.setAttribute(`rel`,t.rel),n})()}}else g=a.querySelectorAll(e);c=r?c??``:void 0,r&&(u[pe]=c);let _=At(t=>{if(m){if(e===`link`&&c!==void 0){let n=!1;for(let r of a.querySelectorAll(e)){let e=r.getAttribute(pe);if(e===null){a.insertBefore(t,r);return}if(n&&e!==c){a.insertBefore(t,r);return}e===c&&(n=!0)}a.appendChild(t);return}let n=!1;for(let r of a.querySelectorAll(e)){if(n&&r.getAttribute(`data-precedence`)!==c){a.insertBefore(t,r);return}r.getAttribute(`data-precedence`)===c&&(n=!0)}a.appendChild(t)}else if(e===`link`)a.contains(t)||a.appendChild(t);else if(g){let n=!1;for(let e of g)if(e===t){n=!0;break}n||a.insertBefore(t,a.contains(g[0])?g[0]:a.querySelector(e)),g=void 0}},[m,c,e]),v=q(t.ref,e=>{let t=p[0];if(n===2&&(e.innerHTML=``),(f||g)&&_(e),!s&&!o||!t)return;let r=Rt[e.getAttribute(t)]||=new Promise((t,n)=>{e.addEventListener(`load`,t),e.addEventListener(`error`,n)});o&&(r=r.then(o)),s&&(r=r.catch(s)),r.catch(()=>{})});if(i&&l===`render`){let n=C[e][0];if(n&&t[n]){let e=t[n];jt(Rt[e]||=new Promise((e,t)=>{_(d),d.addEventListener(`load`,e),d.addEventListener(`error`,t)}))}}let y={tag:e,type:e,props:{...u,ref:v},ref:v};return y.p=n,d&&(y.e=d),yt(y,a)},Bt=e=>{let t=Qe();return(t&&S(t))?.endsWith(`svg`)?{tag:`title`,props:e,type:`title`,ref:e.ref}:J(`title`,e,void 0,!1,!1)},Vt=e=>!e||[`src`,`async`].some(t=>!e[t])?{tag:`script`,props:e,type:`script`,ref:e.ref}:J(`script`,e,1,!1,!0),Ht=e=>!e||![`href`,`precedence`].every(t=>t in e)?{tag:`style`,props:e,type:`style`,ref:e.ref}:(e[`data-href`]=e.href,delete e.href,J(`style`,e,2,!0,!0)),Ut=e=>!e||[`onLoad`,`onError`].some(t=>t in e)||e.rel===`stylesheet`&&(!(`precedence`in e)||`disabled`in e)?{tag:`link`,props:e,type:`link`,ref:e.ref}:J(`link`,e,1,me(e),!0),Wt=e=>J(`meta`,e,void 0,!1,!1),Gt=Symbol(),Kt=e=>{let{action:t,...n}=e;typeof t!=`function`&&(n.action=t);let[r,i]=Dt([null,!1]),a=At(async e=>{let n=e.isTrusted?t:e.detail[Gt];if(typeof n!=`function`)return;e.preventDefault();let r=new FormData(e.target);i([r,!0]);let a=n(r);a instanceof Promise&&(Ft(a),await a),i([null,!0])},[]),o=q(e.ref,e=>(e.addEventListener(`submit`,a),()=>{e.removeEventListener(`submit`,a)})),[s,c]=r;return r[1]=!1,{tag:Nt,props:{value:{pending:s!==null,data:s,method:s?`post`:null,action:s?t:null},children:{tag:`form`,props:{...n,ref:o},type:`form`,ref:o}},f:c}},qt=(e,{formAction:t,...n})=>{if(typeof t==`function`){let e=At(e=>{e.preventDefault(),e.currentTarget.form.dispatchEvent(new CustomEvent(`submit`,{detail:{[Gt]:t}}))},[]);n.ref=q(n.ref,t=>(t.addEventListener(`click`,e),()=>{t.removeEventListener(`click`,e)}))}return{tag:e,props:n,type:e,ref:n.ref}},Jt=e=>qt(`input`,e),Yt=e=>qt(`button`,e);Object.assign(fe,{title:Bt,script:Vt,style:Ht,link:Ut,meta:Wt,form:Kt,input:Jt,button:Yt});var Xt=(e,t,n)=>(typeof e==`string`&&It[e]&&(e=It[e]),{tag:e,type:e,props:t,key:n,ref:t.ref}),Zt=e=>Xt(``,e,void 0),Qt=(({children:e,fallback:t,fallbackRender:n,onError:r})=>{let i=Zt({children:e});return i[u]=e=>{if(e instanceof Promise)throw e;return r?.(e),n?.(e)||t},i}),$t=(({children:e,fallback:t})=>{let n=Zt({children:e});return n[u]=(e,n)=>{if(!(e instanceof Promise))throw e;return e.finally(n),t},n}),en=de(null),tn=0,nn=async({children:e,fallback:t})=>{Array.isArray(e)||(e=[e]);let i=S(en)?.scriptNonce,a=[],o={[d]:[0,[]]},s=()=>{z.pop()};try{o[d][0]=0,z.push([[],o]),a=e.map(e=>e==null||typeof e==`boolean`?``:e.toString())}catch(t){if(t instanceof Promise){let n=x();a=[t.then(()=>n(()=>(o[d][0]=0,z.push([[],o]),an(e).finally(s))))]}else throw t}finally{s()}if(a.some(e=>e instanceof Promise)){let e=tn++,o=await t.toString();return r(`<template id=\"H:${e}\"></template>${o}<!--/$-->`,[...o.callbacks||[],({phase:t,buffer:o,context:s})=>{if(t!==n.BeforeStream)return Promise.all(a).then(async a=>{a=a.flat();let l=a.join(``);o&&(o[0]=o[0].replace(RegExp(`<template id=\"H:${e}\"></template>.*?<!--/\\\\$-->`),l));let u=o?``:`<template data-hono-target=\"H:${e}\">${l}</template><script${i?` nonce=\"${i}\"`:``}>\n((d,c,n) => {\nc=d.currentScript.previousSibling\nd=d.getElementById('H:${e}')\nif(!d)return\ndo{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='/$')\nd.replaceWith(c.content)\n})(document)\n<\\/script>`,d=a.map(e=>e.callbacks||[]).flat();return d.length?(t===n.Stream&&(u=await c(u,n.BeforeStream,!0,s)),r(u,d)):u})}])}else return r(a.join(``))};nn[l]=$t,new TextEncoder;var rn=0,an=async e=>{try{return e.flat().map(e=>e==null||typeof e==`boolean`?``:e.toString())}catch(t){if(t instanceof Promise){let n=x();return await t,n(()=>an(e))}else throw t}},on=e=>{if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`)return e;{let t=e.toString();return t instanceof Promise?t:r(t)}},sn=async({children:e,fallback:t,fallbackRender:i,onError:a})=>{if(!e)return r(``);Array.isArray(e)||(e=[e]);let o=S(en)?.scriptNonce,s,l=()=>s||=x(),u,d=()=>u||=(async()=>{let e=await t;if(typeof e==`string`)return e;{let t=await l()(()=>e?.toString());if(typeof t==`string`)return r(t,t.callbacks||e?.callbacks)}})(),f=async e=>{let t=await d();return l()(async()=>{a?.(e);let n=t===void 0?i&&qe(L,{},i(e))||``:t,o=await L({children:n}).toString();return r(o,o.callbacks||n.callbacks)})},p=[];try{p=e.map(on)}catch(t){let n=l();p=t instanceof Promise?[t.then(()=>n(()=>an(e))).catch(e=>f(e))]:[await f(t)]}if(p.some(e=>e instanceof Promise)){l();let e=rn++,t=RegExp(`(<template id=\"E:${e}\"></template>.*?)(.*?)(<!--E:${e}-->)`),i=!1,a=async({error:n,buffer:a})=>{if(i)return``;i=!0;let o=await f(n),s=o.callbacks;return a?(a[0]=a[0].replace(t,o),s?.length?r(``,s):``):r(`<template data-hono-target=\"E:${e}\">${o}</template><script>\n((d,c,n) => {\nc=d.currentScript.previousSibling\nd=d.getElementById('E:${e}')\nif(!d)return\ndo{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='E:${e}')\nd.replaceWith(c.content)\n})(document)\n<\\/script>`,s)},s,u=Promise.all(p).catch(e=>s=e);return r(`<template id=\"E:${e}\"></template><!--E:${e}-->`,[({phase:i,buffer:l,context:d})=>{if(i!==n.BeforeStream)return u.then(async u=>{if(s)throw s;u=u.flat();let f=u.join(``),p=l?``:`<template data-hono-target=\"E:${e}\">${f}</template><script${o?` nonce=\"${o}\"`:``}>\n((d,c) => {\nc=d.currentScript.previousSibling\nd=d.getElementById('E:${e}')\nif(!d)return\nd.parentElement.insertBefore(c.content,d.nextSibling)\n})(document)\n<\\/script>`;if(u.every(e=>!e.callbacks?.length))return l&&(l[0]=l[0].replace(t,f)),p;l&&(l[0]=l[0].replace(t,(e,t,n,r)=>`${t}${f}${r}`));let m=u.map(e=>e.callbacks||[]).flat();i===n.Stream&&(p=await c(p,n.BeforeStream,!0,d));let h=0,g=m.map(n=>(...i)=>n(...i)?.then(n=>(h++,l?(h===m.length&&(l[0]=l[0].replace(t,(e,t,n)=>n)),l[0]+=n,r(``,n.callbacks)):r(n+(h===m.length?`<script>\n((d,c,n) => {\nd=d.getElementById('E:${e}')\nif(!d)return\nn=d.nextSibling\nwhile(n.nodeType!=8||n.nodeValue!='E:${e}'){n=n.nextSibling}\nn.remove()\nd.remove()\n})(document)\n<\\/script>`:``),n.callbacks))).catch(e=>a({error:e,buffer:l})));return r(p,g)}).catch(e=>a({error:e,buffer:l}))}])}else return L({children:p})};sn[l]=Qt;var cn=(e,t={})=>{let n;return Object.keys(t).length>0&&console.warn(`createRoot options are not supported yet`),{render(t){if(n===null)throw Error(`Cannot update an unmounted root`);n?n(t):vt(mt({tag:()=>{let[e,r]=Dt(t);return n=r,e},props:{}}),e)},unmount(){n?.(null),n=null}}},ln=(e,t,n={})=>{let r=cn(e,n);return r.render(t),r};function un(){return kt(()=>{let e=document.querySelectorAll(`form`),t=[];return e.forEach(e=>{let n=e=>{if(e.defaultPrevented)return;let t=e.submitter;t&&t.type===`submit`&&(t.classList.add(`is-loading`),t.disabled=!0)};e.addEventListener(`submit`,n);let r=t=>{t.persisted&&e.querySelectorAll(`button[type=submit]`).forEach(e=>{e.classList.remove(`is-loading`),e.disabled=!1})};window.addEventListener(`pageshow`,r),t.push(()=>{e.removeEventListener(`submit`,n),window.removeEventListener(`pageshow`,r)})}),()=>{t.forEach(e=>e())}},[]),null}function dn(){return kt(()=>{let e=document.querySelectorAll(`a[data-loading-link]`),t=[];return e.forEach(e=>{let n=t=>{t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||e.classList.add(`is-loading`)};e.addEventListener(`click`,n);let r=t=>{t.persisted&&e.classList.remove(`is-loading`)};window.addEventListener(`pageshow`,r),t.push(()=>{e.removeEventListener(`click`,n),window.removeEventListener(`pageshow`,r)})}),()=>{t.forEach(e=>e())}},[]),null}function fn(){return kt(()=>{let e=document.querySelectorAll(`[data-password-toggle]`),t=[];return e.forEach(e=>{let n=e.querySelector(`input[type='password'], input[data-password-input]`),r=e.querySelector(`[data-password-toggle-btn]`),i=r?.querySelector(`[data-show-icon]`),a=r?.querySelector(`[data-hide-icon]`);if(!n||!r||!i||!a)return;let o=e=>{e?(n.type=`text`,n.setAttribute(`data-password-input`,`text`),i.classList.add(`hidden`),a.classList.remove(`hidden`)):(n.type=`password`,n.setAttribute(`data-password-input`,`password`),a.classList.add(`hidden`),i.classList.remove(`hidden`))},s=e=>{e.preventDefault(),o(n.type===`password`)};r.addEventListener(`click`,s),t.push(()=>{r.removeEventListener(`click`,s)})}),()=>{t.forEach(e=>e())}},[]),null}function pn(){return document.querySelectorAll(`[data-input-otp-container]`).forEach(e=>{let t=Array.from(e.querySelectorAll(`[data-input-otp-slot]`));if(!t.length)return;let n=e.closest(`form`),r=null;if(n&&t.length>0){let e=t[0]?.getAttribute(`name`);e&&(r=n.querySelector(`input[name=\"${e}\"][type=\"hidden\"]`),r||(r=document.createElement(`input`),r.type=`hidden`,r.name=e,n.appendChild(r)),t.forEach(e=>e.removeAttribute(`name`)))}let i=()=>{if(r){let e=t.map(e=>e.value).join(``);r.value=e,e.length===t.length&&n&&setTimeout(()=>{n.requestSubmit()},100)}};t.forEach((e,n)=>{e.addEventListener(`input`,e=>{let r=e.target,a=r.value;a=a.replace(/[^0-9]/g,``),a.length>1&&(a=a.charAt(0)),r.value=a,a&&n<t.length-1&&t[n+1]?.focus(),i()}),e.addEventListener(`paste`,e=>{e.preventDefault();let r=(e.clipboardData?.getData(`text`)||``).replace(/[^0-9]/g,``);for(let e=0;e<Math.min(r.length,t.length-n);e++){let i=t[n+e],a=r.charAt(e);i&&a&&(i.value=a)}let a=t.findIndex((e,t)=>t>=n&&!e.value);a===-1?t[Math.min(n+r.length,t.length-1)]?.focus():t[a]?.focus(),i()}),e.addEventListener(`keydown`,e=>{if(e.key===`Backspace`){let r=e.target;if(!r.value&&n>0){e.preventDefault();let r=t[n-1];r&&(r.value=``,r.focus()),i()}else r.value&&setTimeout(()=>i(),0)}else e.key===`ArrowLeft`&&n>0?(e.preventDefault(),t[n-1]?.focus()):e.key===`ArrowRight`&&n<t.length-1&&(e.preventDefault(),t[n+1]?.focus())}),e.addEventListener(`focus`,()=>{e.select()})}),i()}),null}var mn={d:(e,t)=>{for(var n in t)mn.o(t,n)&&!mn.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},hn={};mn.d(hn,{A:()=>gn,k:()=>Z});var Y=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},X=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function Z(){return Y(this,void 0,Promise,function(){return X(this,function(e){switch(e.label){case 0:return[4,new Promise(function(e,t){var n=`Unknown`,r=!1;function i(t){r||(r=!0,e({isPrivate:t,browserName:n}))}function a(){var e=0,t=-1;try{t.toFixed(t)}catch(t){e=t.message.length}return e}function o(){return Y(this,void 0,void 0,function(){var e,t;return X(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,navigator.storage.getDirectory()];case 1:return n.sent(),i(!1),[3,3];case 2:return e=n.sent(),t=e instanceof Error&&typeof e.message==`string`?e.message:String(e),i(t.includes(`unknown transient reason`)),[3,3];case 3:return[2]}})})}function s(){return Y(this,void 0,Promise,function(){return X(this,function(e){switch(e.label){case 0:return typeof navigator.storage?.getDirectory==`function`?[4,o()]:[3,2];case 1:return e.sent(),[3,3];case 2:navigator.maxTouchPoints===void 0?function(){var e=window.openDatabase,t=window.localStorage;try{e(null,null,null,null)}catch{i(!0);return}try{t.setItem(`test`,`1`),t.removeItem(`test`)}catch{i(!0);return}i(!1)}():function(){var e=String(Math.random());try{var t=indexedDB.open(e,1);t.onupgradeneeded=function(t){var n=t.target.result,r=function(e){i(e)};try{n.createObjectStore(`t`,{autoIncrement:!0}).put(new Blob),r(!1)}catch(e){(e instanceof Error&&typeof e.message==`string`?e.message:String(e)).includes(`are not yet supported`)?r(!0):r(!1)}finally{n.close(),indexedDB.deleteDatabase(e)}},t.onerror=function(){return i(!1)}}catch{i(!1)}}(),e.label=3;case 3:return[2]}})})}function c(){navigator.webkitTemporaryStorage.queryUsageAndQuota(function(e,t){i(Math.round(t/1048576)<2*Math.round(function(){return window?.performance?.memory?.jsHeapSizeLimit??1073741824}()/1048576))},function(e){t(Error(`detectIncognito somehow failed to query storage quota: `+e.message))})}function l(){self.Promise!==void 0&&self.Promise.allSettled!==void 0?c():(0,window.webkitRequestFileSystem)(0,1,function(){i(!1)},function(){i(!0)})}function u(){return Y(this,void 0,Promise,function(){var e,t,n;return X(this,function(r){switch(r.label){case 0:if(typeof navigator.storage?.getDirectory!=`function`)return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,navigator.storage.getDirectory()];case 2:return r.sent(),i(!1),[3,4];case 3:return e=r.sent(),t=e instanceof Error&&typeof e.message==`string`?e.message:String(e),i(t.includes(`Security error`)),[2];case 4:return[3,6];case 5:(n=indexedDB.open(`inPrivate`)).onerror=function(e){n.error&&n.error.name===`InvalidStateError`&&e.preventDefault(),i(!0)},n.onsuccess=function(){indexedDB.deleteDatabase(`inPrivate`),i(!1)},r.label=6;case 6:return[2]}})})}(function(){return Y(this,void 0,Promise,function(){return X(this,function(e){switch(e.label){case 0:return a()!==44&&a()!==43?[3,2]:(n=`Safari`,[4,s()]);case 1:return e.sent(),[3,6];case 2:return a()===51?(r=navigator.userAgent,n=r.match(/Chrome/)?navigator.brave===void 0?r.match(/Edg/)?`Edge`:r.match(/OPR/)?`Opera`:`Chrome`:`Brave`:`Chromium`,l(),[3,6]):[3,3];case 3:return a()===25?(n=`Firefox`,[4,u()]):[3,5];case 4:return e.sent(),[3,6];case 5:navigator.msSaveBlob===void 0?t(Error(`detectIncognito cannot determine the browser`)):(n=`Internet Explorer`,i(window.indexedDB===void 0)),e.label=6;case 6:return[2]}var r})})})().catch(t)})];case 1:return[2,e.sent()]}})})}typeof window<`u`&&(window.detectIncognito=Z);var gn=Z;hn.A;var _n=hn.k,Q=`authhero_incognito_mode`;function vn(){try{let e=sessionStorage.getItem(Q);return e===null?void 0:e===`true`}catch{return}}async function yn(){try{let e=sessionStorage.getItem(Q);if(e!==null)return e===`true`;let{isPrivate:t}=await _n();return sessionStorage.setItem(Q,t.toString()),t}catch{try{sessionStorage.setItem(Q,`false`)}catch{}return!1}}var bn=()=>{let e=vn();if(e!==void 0){e&&xn();return}yn().then(e=>{e&&xn()}).catch(()=>{})};function xn(){let e=document.getElementById(`incognito-warning-container`);e&&e.classList.remove(`hidden`)}function $(e,t,n){let r;if(!t||!(`children`in t))r=I(e,t,[]);else{let n=t.children;r=Array.isArray(n)?I(e,t,n):I(e,t,[n])}return r.key=n,r}bn();var Sn=document.getElementById(`client-root`);Sn&&ln(Sn,$(L,{children:[$(un,{}),$(dn,{}),$(fn,{}),$(pn,{})]}));";
|
|
@@ -24,10 +24,10 @@ export declare const dcrRequestSchema: z.ZodObject<{
|
|
|
24
24
|
response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
25
|
token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
|
|
26
26
|
none: "none";
|
|
27
|
-
private_key_jwt: "private_key_jwt";
|
|
28
27
|
client_secret_post: "client_secret_post";
|
|
29
28
|
client_secret_basic: "client_secret_basic";
|
|
30
29
|
client_secret_jwt: "client_secret_jwt";
|
|
30
|
+
private_key_jwt: "private_key_jwt";
|
|
31
31
|
}>>;
|
|
32
32
|
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
33
33
|
jwks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LinkCandidate, User, UserDataAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the ordered pool of candidate *primary* users that the built-in
|
|
4
|
+
* email-based account-linking policy would consider for `user`, excluding the
|
|
5
|
+
* user themselves.
|
|
6
|
+
*
|
|
7
|
+
* Mirrors the selection in `hooks/pre-defined/account-linking.ts`:
|
|
8
|
+
* - prefer direct unlinked primaries that share the (normalized) email;
|
|
9
|
+
* - otherwise resolve each secondary's `linked_to` chain to its root and
|
|
10
|
+
* dedupe, so multiple chains for the same email collapse onto one primary;
|
|
11
|
+
* - sort by age (oldest first) so duplicate-primary races converge in a single
|
|
12
|
+
* pass.
|
|
13
|
+
*
|
|
14
|
+
* Returns `[]` when there is nothing to link to. The first element (if any) is
|
|
15
|
+
* the candidate the built-in "oldest account wins" policy would pick.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveLinkCandidates(params: {
|
|
18
|
+
userAdapter: UserDataAdapter;
|
|
19
|
+
tenantId: string;
|
|
20
|
+
user: User;
|
|
21
|
+
}): Promise<User[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Serialize resolved candidate primaries into the minimal, JSON-safe
|
|
24
|
+
* `event.link_candidates` shape exposed to `post-user-login` code hooks. The
|
|
25
|
+
* first candidate (oldest) is flagged `is_oldest` — the one the built-in policy
|
|
26
|
+
* would pick.
|
|
27
|
+
*/
|
|
28
|
+
export declare function toLinkCandidates(candidates: User[]): LinkCandidate[];
|
|
@@ -36,6 +36,14 @@ export type LogParams = {
|
|
|
36
36
|
client_name?: string;
|
|
37
37
|
audience?: string;
|
|
38
38
|
scope?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The login target — the RP's `redirect_uri` the authorization is completing
|
|
41
|
+
* for. Recorded on the request block so a `Successful Login` (or other auth
|
|
42
|
+
* event) can be attributed to a specific destination even when several flows
|
|
43
|
+
* share one `client_id` (e.g. a browser SPA and a server-side OIDC plugin
|
|
44
|
+
* both authorizing as the same client).
|
|
45
|
+
*/
|
|
46
|
+
redirect_uri?: string;
|
|
39
47
|
/**
|
|
40
48
|
* Response details to include in the log (for Management API operations)
|
|
41
49
|
*/
|
|
@@ -23,6 +23,24 @@ export interface ScopesAndPermissionsResult {
|
|
|
23
23
|
token_lifetime: number;
|
|
24
24
|
token_lifetime_for_web: number;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* True when the user holds the global `admin:organizations` escape hatch — the
|
|
28
|
+
* single canonical key for "may act on any organization without being a
|
|
29
|
+
* member". It is a management-plane permission, so it is always matched against
|
|
30
|
+
* the Management API audience, never the requested token's audience.
|
|
31
|
+
*
|
|
32
|
+
* "Global" means an assignment with an empty organization scope (`""`). Both
|
|
33
|
+
* directly-assigned user permissions AND role-derived permissions count, so a
|
|
34
|
+
* user granted the permission either way is treated consistently (see #1198).
|
|
35
|
+
*
|
|
36
|
+
* The caller is responsible for gating on the
|
|
37
|
+
* `inherit_global_permissions_in_organizations` tenant flag; this helper only
|
|
38
|
+
* answers whether the permission is present.
|
|
39
|
+
*/
|
|
40
|
+
export declare function userHasGlobalOrgAdminPermission(ctx: Context<{
|
|
41
|
+
Bindings: Bindings;
|
|
42
|
+
Variables: Variables;
|
|
43
|
+
}>, tenantId: string, userId: string): Promise<boolean>;
|
|
26
44
|
/**
|
|
27
45
|
* Calculates the scopes and permissions for a user based on the audience and resource server configuration.
|
|
28
46
|
* This function implements Auth0-like behavior for RBAC and token dialects.
|
|
@@ -15,3 +15,39 @@ export interface ResolveSigningKeysOptions {
|
|
|
15
15
|
type?: string;
|
|
16
16
|
}
|
|
17
17
|
export declare function resolveSigningKeys(keys: KeysAdapter, tenantId: string, modeOption: SigningKeyModeOption | undefined, opts: ResolveSigningKeysOptions): Promise<SigningKey[]>;
|
|
18
|
+
/** A key is signable only if it carries private material, not just a cert. */
|
|
19
|
+
export declare function isSignable(key: SigningKey): boolean;
|
|
20
|
+
export interface EnsureSigningKeyOptions {
|
|
21
|
+
/**
|
|
22
|
+
* When set, the key is created tenant-scoped (`tenant_id` stamped) and the
|
|
23
|
+
* existence check is scoped to that tenant. Omit for a control-plane key
|
|
24
|
+
* (no `tenant_id`), which `resolveSigningKeys` resolves in both modes — as
|
|
25
|
+
* the primary key in `"control-plane"` mode and as the fallback in
|
|
26
|
+
* `"tenant"` mode. Control-plane scope is the right default for a freshly
|
|
27
|
+
* provisioned WFP tenant.
|
|
28
|
+
*/
|
|
29
|
+
tenantId?: string;
|
|
30
|
+
/** Cert CN. Falls back to the tenant id, then to `"authhero"`. */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** Defaults to `"jwt_signing"`. */
|
|
33
|
+
type?: SigningKey["type"];
|
|
34
|
+
}
|
|
35
|
+
export interface EnsureSigningKeyResult {
|
|
36
|
+
/** True when a new key was minted; false when a signable key already existed. */
|
|
37
|
+
created: boolean;
|
|
38
|
+
key: SigningKey;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Guarantees the target scope holds at least one *signable* key — one carrying
|
|
42
|
+
* private material (`pkcs7` + `cert`), not merely a projected public verify key.
|
|
43
|
+
*
|
|
44
|
+
* A freshly provisioned WFP tenant inherits only the control plane's public
|
|
45
|
+
* keys (private material stripped at the boundary), so it can serve JWKS and
|
|
46
|
+
* `/authorize` but 500s at `/oauth/token` with nothing to sign — issue #1181.
|
|
47
|
+
* Calling this at provision time closes that gap by minting the tenant's own
|
|
48
|
+
* RS256 key locally (private material never crosses the control-plane boundary).
|
|
49
|
+
*
|
|
50
|
+
* Create-if-missing and idempotent: a scope that already has a signable key is
|
|
51
|
+
* left untouched, so it is safe to call on every provision and re-sync.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ensureSigningKey(keys: KeysAdapter, opts?: EnsureSigningKeyOptions): Promise<EnsureSigningKeyResult>;
|
|
@@ -44,6 +44,49 @@ interface RepointPrimaryParams {
|
|
|
44
44
|
* the linking logic recursively.
|
|
45
45
|
*/
|
|
46
46
|
export declare function repointPrimary({ userAdapter, tenant_id, formerPrimary, newPrimaryId, }: RepointPrimaryParams): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* True for identities whose *login identifier* is the email address: the native
|
|
49
|
+
* username-password providers (`auth0`/`auth2`) and the passwordless `email`
|
|
50
|
+
* connection. For these, `email` is a credential — it's how the login row is
|
|
51
|
+
* found (`getUserByProvider`), so it must stay consistent across a linked
|
|
52
|
+
* cluster.
|
|
53
|
+
*
|
|
54
|
+
* Social identities carry `email` as ordinary profile data (re-synced from the
|
|
55
|
+
* IdP on every login) and sms identities are keyed by `phone_number`, so neither
|
|
56
|
+
* is email-identified and neither should have its `email` rewritten by a cascade.
|
|
57
|
+
*/
|
|
58
|
+
export declare function isEmailIdentifiedUser(user: Pick<User, "provider" | "connection">): boolean;
|
|
59
|
+
interface CascadeEmailParams {
|
|
60
|
+
userAdapter: UserDataAdapter;
|
|
61
|
+
tenant_id: string;
|
|
62
|
+
/** The cluster root (primary) user_id — its secondaries are enumerated. */
|
|
63
|
+
primaryUserId: string;
|
|
64
|
+
/** The row whose email the caller already updated; skipped by the cascade. */
|
|
65
|
+
sourceUserId: string;
|
|
66
|
+
email: string;
|
|
67
|
+
email_verified: boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Propagate an email change across every *email-identified* identity in a linked
|
|
71
|
+
* cluster so a merged user keeps a single login email.
|
|
72
|
+
*
|
|
73
|
+
* Because account-linking matches on a shared email, at link time every
|
|
74
|
+
* email-identified identity in a cluster carries the same address. The only way
|
|
75
|
+
* they diverge is a later email change on one of them — and when they diverge,
|
|
76
|
+
* the login row for the *other* email-identified identities still carries the
|
|
77
|
+
* old address, so the user can no longer sign in with the address now shown on
|
|
78
|
+
* their profile (the classic "changed my email, can't log in with my password"
|
|
79
|
+
* bug).
|
|
80
|
+
*
|
|
81
|
+
* This re-establishes the invariant: only email-identified rows are touched
|
|
82
|
+
* ({@link isEmailIdentifiedUser}); sms (`phone_number`) and social (provider
|
|
83
|
+
* sub) identifiers are never rewritten. `sourceUserId` is skipped (the caller
|
|
84
|
+
* already wrote it). Each cascaded write goes through the normal decorated
|
|
85
|
+
* `update`, so every affected identity emits its own `user.updated` event for
|
|
86
|
+
* downstream propagation, and `email_verified` moves in lock-step so the whole
|
|
87
|
+
* cluster shares one verification state.
|
|
88
|
+
*/
|
|
89
|
+
export declare function cascadeEmailToLinkedIdentities({ userAdapter, tenant_id, primaryUserId, sourceUserId, email, email_verified, }: CascadeEmailParams): Promise<void>;
|
|
47
90
|
interface GetPrimaryUserByProviderParams {
|
|
48
91
|
userAdapter: UserDataAdapter;
|
|
49
92
|
tenant_id: string;
|
|
@@ -60,11 +60,19 @@ export type CodeHookApi = Record<string, CodeHookApiNamespace>;
|
|
|
60
60
|
/**
|
|
61
61
|
* Replay recorded API calls from code hook execution against real API objects.
|
|
62
62
|
* Handles calls like "accessToken.setCustomClaim" by navigating the api object.
|
|
63
|
+
*
|
|
64
|
+
* Awaits each replayed call. Most registered methods are synchronous (they
|
|
65
|
+
* mutate a token or throw), but some do async work — notably
|
|
66
|
+
* `user.setLinkedTo` at `post-user-login`, which paginates and writes user rows
|
|
67
|
+
* to perform the link. Since replay runs *after* the isolate returns, the login
|
|
68
|
+
* response is built from whatever this resolves to; awaiting guarantees such
|
|
69
|
+
* work completes before the caller proceeds. Synchronous methods return
|
|
70
|
+
* non-thenables, so awaiting them is a no-op.
|
|
63
71
|
*/
|
|
64
72
|
export declare function replayApiCalls(apiCalls: Array<{
|
|
65
73
|
method: string;
|
|
66
74
|
args: unknown[];
|
|
67
|
-
}>, api: CodeHookApi): void
|
|
75
|
+
}>, api: CodeHookApi): Promise<void>;
|
|
68
76
|
export type HandleCodeHookOutcome = {
|
|
69
77
|
result: ActionExecutionResult;
|
|
70
78
|
logs: CodeExecutionLog[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters, User } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../../types";
|
|
4
|
+
/**
|
|
5
|
+
* The `user` namespace exposed to `post-user-login` code hooks. `setLinkedTo`
|
|
6
|
+
* is the programmable account-linking verb (issue #1184): an action reads
|
|
7
|
+
* `event.link_candidates` and calls `api.user.setLinkedTo(candidate.user_id)`.
|
|
8
|
+
*/
|
|
9
|
+
export type PostLoginUserApi = {
|
|
10
|
+
user: {
|
|
11
|
+
setLinkedTo: (primaryUserId: string) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Builds the guarded `api.user.setLinkedTo` implementation for the
|
|
16
|
+
* `post-user-login` trigger, plus a getter for the resulting primary user id.
|
|
17
|
+
*
|
|
18
|
+
* The recording proxy captures the action's `setLinkedTo(id)` call; the host
|
|
19
|
+
* replays it against this implementation *after* the isolate returns
|
|
20
|
+
* (`replayApiCalls`, which awaits — so the DB writes complete before the login
|
|
21
|
+
* response is built).
|
|
22
|
+
*
|
|
23
|
+
* Guards, all enforced server-side so a malicious/buggy action cannot escalate:
|
|
24
|
+
* - **Candidate allowlist.** `primaryUserId` must be one of `candidates`
|
|
25
|
+
* (the same set serialized into `event.link_candidates`). Without this an
|
|
26
|
+
* action could link the current user to an arbitrary `user_id` —
|
|
27
|
+
* account-takeover. Rejections log `FAILED_HOOK` and mutate nothing.
|
|
28
|
+
* - **Verified-email gate.** When `requireVerifiedEmail` (the default), the
|
|
29
|
+
* logging-in user must have a verified email, regardless of what the action
|
|
30
|
+
* asserts.
|
|
31
|
+
* - **Direction.** Older account wins (`compareUsersByAge`): if the logging-in
|
|
32
|
+
* user pre-dates the target, the target is demoted via `repointPrimary`
|
|
33
|
+
* (avoiding 2-hop chains) instead.
|
|
34
|
+
* - **Idempotency.** A no-op when the user is already linked to the target.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createPostLoginUserApi(params: {
|
|
37
|
+
ctx: Context<{
|
|
38
|
+
Bindings: Bindings;
|
|
39
|
+
Variables: Variables;
|
|
40
|
+
}>;
|
|
41
|
+
data: DataAdapters;
|
|
42
|
+
tenantId: string;
|
|
43
|
+
user: User;
|
|
44
|
+
/** Resolved candidate primaries (same set as `event.link_candidates`). */
|
|
45
|
+
candidates: User[];
|
|
46
|
+
/** @default true */
|
|
47
|
+
requireVerifiedEmail?: boolean;
|
|
48
|
+
}): {
|
|
49
|
+
api: PostLoginUserApi;
|
|
50
|
+
/** The user id of the primary after linking, or null if nothing linked. */
|
|
51
|
+
getLinkedPrimaryId: () => string | null;
|
|
52
|
+
};
|
|
@@ -20,6 +20,26 @@ export interface AccountLinkingOptions {
|
|
|
20
20
|
* @default false
|
|
21
21
|
*/
|
|
22
22
|
copyUserMetadata?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* When the link is performed, fill in *absent* root profile fields on the
|
|
25
|
+
* primary from the secondary — e.g. a secondary that has a `birthdate` the
|
|
26
|
+
* primary lacks, or a phone number an email primary doesn't carry.
|
|
27
|
+
*
|
|
28
|
+
* Fill-if-absent only: a field already set on the primary is never
|
|
29
|
+
* overwritten (primary stays authoritative), matching `copyUserMetadata`.
|
|
30
|
+
* Identifier and verification fields are never touched — `email`,
|
|
31
|
+
* `email_verified`, `phone_verified`, `username`, `provider`, `connection`
|
|
32
|
+
* are excluded — so this can't rewrite a login identifier. In particular an
|
|
33
|
+
* sms primary already carries a `phone_number`, so its identifier is never
|
|
34
|
+
* filled over; the promotion only reaches a primary that has no phone yet.
|
|
35
|
+
*
|
|
36
|
+
* Off by default to match Auth0, which keeps a linked identity's own
|
|
37
|
+
* attributes under `identities[].profileData` rather than promoting them to
|
|
38
|
+
* the merged user's root profile.
|
|
39
|
+
*
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
copyProfileFields?: boolean;
|
|
23
43
|
}
|
|
24
44
|
/**
|
|
25
45
|
* Trigger-agnostic event handler used by all `account-linking` template
|