authhero 8.27.0 → 9.1.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.
Files changed (68) hide show
  1. package/LICENSE +661 -21
  2. package/dist/assets/u/js/client.js +2 -2
  3. package/dist/assets/u/widget/authhero-widget.esm.js +1 -1
  4. package/dist/assets/u/widget/index.esm.js +1 -1
  5. package/dist/assets/u/widget/{p-52a70476.entry.js → p-cdfc4555.entry.js} +1 -1
  6. package/dist/assets/u/widget/{p-f6babd26.entry.js → p-eca60302.entry.js} +1 -1
  7. package/dist/authhero.cjs +268 -251
  8. package/dist/authhero.d.ts +186 -95
  9. package/dist/authhero.mjs +26150 -18257
  10. package/dist/client.js +2 -2
  11. package/dist/tsconfig.types.tsbuildinfo +1 -1
  12. package/dist/types/authentication-flows/passwordless.d.ts +4 -3
  13. package/dist/types/client/client-bundle.d.ts +1 -1
  14. package/dist/types/constants.d.ts +2 -0
  15. package/dist/types/generated/locale-types.d.ts +2 -0
  16. package/dist/types/helpers/client.d.ts +2 -2
  17. package/dist/types/helpers/dcr/metadata-mapping.d.ts +1 -1
  18. package/dist/types/helpers/link-candidates.d.ts +28 -0
  19. package/dist/types/helpers/logging.d.ts +8 -0
  20. package/dist/types/helpers/revoke-user-sessions.d.ts +15 -0
  21. package/dist/types/helpers/scim/default-mapping.d.ts +10 -0
  22. package/dist/types/helpers/scim/discovery.d.ts +49 -0
  23. package/dist/types/helpers/scim/filter.d.ts +58 -0
  24. package/dist/types/helpers/scim/mint-token.d.ts +11 -0
  25. package/dist/types/helpers/scim/patch.d.ts +23 -0
  26. package/dist/types/helpers/scim/responses.d.ts +36 -0
  27. package/dist/types/helpers/scim/user-mapping.d.ts +76 -0
  28. package/dist/types/helpers/scopes-permissions.d.ts +18 -0
  29. package/dist/types/helpers/signing-keys.d.ts +36 -0
  30. package/dist/types/helpers/users.d.ts +116 -1
  31. package/dist/types/hooks/codehooks.d.ts +9 -1
  32. package/dist/types/hooks/helpers/post-login-account-linking.d.ts +52 -0
  33. package/dist/types/hooks/pre-defined/account-linking.d.ts +20 -0
  34. package/dist/types/hooks/user-registration.d.ts +1 -0
  35. package/dist/types/index.d.ts +121 -91
  36. package/dist/types/middlewares/scim-auth.d.ts +19 -0
  37. package/dist/types/routes/auth-api/index.d.ts +34 -34
  38. package/dist/types/routes/auth-api/passwordless.d.ts +16 -16
  39. package/dist/types/routes/auth-api/register/index.d.ts +2 -2
  40. package/dist/types/routes/auth-api/revoke.d.ts +6 -6
  41. package/dist/types/routes/auth-api/token.d.ts +10 -10
  42. package/dist/types/routes/management-api/action-executions.d.ts +1 -1
  43. package/dist/types/routes/management-api/actions.d.ts +1 -1
  44. package/dist/types/routes/management-api/authentication-methods.d.ts +1 -1
  45. package/dist/types/routes/management-api/branding.d.ts +1 -1
  46. package/dist/types/routes/management-api/clients.d.ts +8 -8
  47. package/dist/types/routes/management-api/email-templates.d.ts +18 -18
  48. package/dist/types/routes/management-api/failed-events.d.ts +2 -1
  49. package/dist/types/routes/management-api/forms.d.ts +14 -0
  50. package/dist/types/routes/management-api/guardian.d.ts +5 -5
  51. package/dist/types/routes/management-api/index.d.ts +76 -50
  52. package/dist/types/routes/management-api/logs.d.ts +4 -4
  53. package/dist/types/routes/management-api/organizations.d.ts +1 -1
  54. package/dist/types/routes/management-api/prompts.d.ts +6 -4
  55. package/dist/types/routes/management-api/scim.d.ts +187 -0
  56. package/dist/types/routes/management-api/tenants.d.ts +1 -1
  57. package/dist/types/routes/management-api/users-by-email.d.ts +1 -0
  58. package/dist/types/routes/management-api/users.d.ts +13 -5
  59. package/dist/types/routes/scim/index.d.ts +6 -0
  60. package/dist/types/routes/universal-login/common.d.ts +3 -2
  61. package/dist/types/routes/universal-login/flow-api.d.ts +4 -4
  62. package/dist/types/routes/universal-login/screens/types.d.ts +9 -0
  63. package/dist/types/routes/universal-login/u2-index.d.ts +5 -5
  64. package/dist/types/routes/universal-login/u2-routes.d.ts +5 -5
  65. package/dist/types/types/AuthError.d.ts +1 -1
  66. package/dist/types/types/Hooks.d.ts +8 -1
  67. package/dist/types/utils/cookies.d.ts +11 -0
  68. package/package.json +7 -6
@@ -83,6 +83,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
83
83
  verify_email?: boolean | undefined;
84
84
  last_ip?: string | undefined;
85
85
  last_login?: string | undefined;
86
+ blocked?: boolean | undefined;
86
87
  registration_completed_at?: string | undefined;
87
88
  email?: string | undefined;
88
89
  identities?: {
@@ -466,7 +467,7 @@ export declare function passwordlessGrantUser(ctx: Context<{
466
467
  custom_login_page_preview?: string | undefined;
467
468
  form_template?: string | undefined;
468
469
  addons?: Record<string, any> | undefined;
469
- token_endpoint_auth_method?: "none" | "private_key_jwt" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | undefined;
470
+ token_endpoint_auth_method?: "none" | "client_secret_post" | "client_secret_basic" | "client_secret_jwt" | "private_key_jwt" | undefined;
470
471
  client_metadata?: Record<string, string> | undefined;
471
472
  hide_sign_up_disabled_error?: boolean | undefined;
472
473
  mobile?: Record<string, any> | undefined;
@@ -549,8 +550,8 @@ export declare function passwordlessGrantUser(ctx: Context<{
549
550
  } | undefined;
550
551
  authenticated_at?: string | undefined;
551
552
  };
552
- connectionType: "username" | "sms" | "email";
553
- authConnection: "username" | "sms" | "email";
553
+ connectionType: "username" | "email" | "sms";
554
+ authConnection: "username" | "email" | "sms";
554
555
  session_id: string | undefined;
555
556
  authParams: {
556
557
  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=`&quot;`;break;case 39:r=`&#39;`;break;case 38:r=`&amp;`;break;case 60:r=`&lt;`;break;case 62:r=`&gt;`;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=`&quot;`;break;case 39:r=`&#39;`;break;case 38:r=`&amp;`;break;case 60:r=`&lt;`;break;case 62:r=`&gt;`;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,{})]}));";
@@ -3,6 +3,8 @@ export declare const JWKS_CACHE_TIMEOUT_IN_SECONDS: number;
3
3
  export declare const SILENT_AUTH_MAX_AGE_IN_SECONDS: number;
4
4
  export declare const UNIVERSAL_AUTH_SESSION_EXPIRES_IN_SECONDS: number;
5
5
  export declare const SILENT_COOKIE_NAME = "auth-token";
6
+ export declare const LAST_USED_CONNECTION_COOKIE_NAME = "last-used-connection";
7
+ export declare const LAST_USED_CONNECTION_MAX_AGE_IN_SECONDS: number;
6
8
  export declare const OTP_EXPIRATION_TIME: number;
7
9
  export declare const EMAIL_VERIFICATION_EXPIRATION_TIME: number;
8
10
  export declare const AUTHORIZATION_CODE_EXPIRES_IN_SECONDS: number;
@@ -101,6 +101,7 @@ export interface LoginScreen {
101
101
  federatedConnectionButtonText: (vars: {
102
102
  connectionName: string;
103
103
  }) => string;
104
+ lastUsedText: () => string;
104
105
  footerLinkText: () => string;
105
106
  footerText: () => string;
106
107
  forgotPasswordText: () => string;
@@ -162,6 +163,7 @@ export interface LoginIdScreen {
162
163
  federatedConnectionButtonText: (vars: {
163
164
  connectionName: string;
164
165
  }) => string;
166
+ lastUsedText: () => string;
165
167
  footerLinkText: () => string;
166
168
  footerText: () => string;
167
169
  forgotPasswordText: () => string;
@@ -500,8 +500,8 @@ export declare const enrichedClientSchema: z.ZodObject<{
500
500
  }>>;
501
501
  }, z.core.$strip>>>;
502
502
  enabled_clients: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
503
- response_type: z.ZodOptional<z.ZodCustom<import("@authhero/adapter-interfaces").AuthorizationResponseType, import("@authhero/adapter-interfaces").AuthorizationResponseType>>;
504
- response_mode: z.ZodOptional<z.ZodCustom<import("@authhero/adapter-interfaces").AuthorizationResponseMode, import("@authhero/adapter-interfaces").AuthorizationResponseMode>>;
503
+ response_type: z.ZodOptional<z.ZodEnum<typeof import("@authhero/adapter-interfaces").AuthorizationResponseType>>;
504
+ response_mode: z.ZodOptional<z.ZodEnum<typeof import("@authhero/adapter-interfaces").AuthorizationResponseMode>>;
505
505
  is_domain_connection: z.ZodOptional<z.ZodBoolean>;
506
506
  show_as_button: z.ZodOptional<z.ZodBoolean>;
507
507
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
@@ -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
  */
@@ -0,0 +1,15 @@
1
+ import { Context } from "hono";
2
+ import { Bindings, Variables } from "../types";
3
+ /**
4
+ * Revoke all of a user's sessions and the refresh tokens issued under them.
5
+ * Used when a user is blocked — Auth0 terminates a user's sessions on block —
6
+ * and reused by SCIM deactivation (Phase 2, #1191).
7
+ *
8
+ * Returns the number of refresh tokens revoked. Sessions are gathered up front
9
+ * (across pages) before any mutation, so revoking in place cannot interfere
10
+ * with pagination.
11
+ */
12
+ export declare function revokeUserSessions(ctx: Context<{
13
+ Bindings: Bindings;
14
+ Variables: Variables;
15
+ }>, tenant_id: string, user_id: string): Promise<number>;
@@ -0,0 +1,10 @@
1
+ import { ScimMappingEntry } from "@authhero/adapter-interfaces";
2
+ /**
3
+ * Default SCIM ↔ AuthHero attribute mapping, mirroring Auth0's default
4
+ * inbound-provisioning mapping. `scim` is the SCIM resource attribute path,
5
+ * `auth0` the AuthHero user field. The `active` → `blocked` entry maps SCIM
6
+ * account status onto AuthHero's block flag; the inversion (active=false ⇒
7
+ * blocked=true) is applied by the provisioning layer in Phase 2, not here.
8
+ */
9
+ export declare const DEFAULT_SCIM_MAPPING: ScimMappingEntry[];
10
+ export declare const DEFAULT_USER_ID_ATTRIBUTE = "externalId";
@@ -0,0 +1,49 @@
1
+ import { ScimListResponse } from "./responses";
2
+ /**
3
+ * Static SCIM discovery documents (RFC 7643 §5–7). The capability set mirrors
4
+ * what AuthHero actually implements and what Auth0 advertises: PATCH and
5
+ * filtering yes; bulk, sort, etag, changePassword no.
6
+ */
7
+ /**
8
+ * Largest page the `/Users` endpoints return, advertised as
9
+ * `filter.maxResults` in ServiceProviderConfig. The route clamps `count` to
10
+ * this so the advertised ceiling and the served page size can't drift apart.
11
+ */
12
+ export declare const SCIM_MAX_RESULTS = 200;
13
+ export declare function serviceProviderConfig(location: string): {
14
+ schemas: string[];
15
+ documentationUri: string;
16
+ patch: {
17
+ supported: boolean;
18
+ };
19
+ bulk: {
20
+ supported: boolean;
21
+ maxOperations: number;
22
+ maxPayloadSize: number;
23
+ };
24
+ filter: {
25
+ supported: boolean;
26
+ maxResults: number;
27
+ };
28
+ changePassword: {
29
+ supported: boolean;
30
+ };
31
+ sort: {
32
+ supported: boolean;
33
+ };
34
+ etag: {
35
+ supported: boolean;
36
+ };
37
+ authenticationSchemes: {
38
+ type: string;
39
+ name: string;
40
+ description: string;
41
+ primary: boolean;
42
+ }[];
43
+ meta: {
44
+ resourceType: string;
45
+ location: string;
46
+ };
47
+ };
48
+ export declare function resourceTypes(baseUrl: string): ScimListResponse<unknown>;
49
+ export declare function schemas(baseUrl: string): ScimListResponse<unknown>;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Minimal SCIM 2.0 filter support (RFC 7644 §3.4.2.2), scoped to what Okta and
3
+ * Microsoft Entra actually send when provisioning: equality (`eq`) on a small
4
+ * set of attributes, optionally combined with `and` / `or` and parentheses.
5
+ * Anything outside this subset throws `UnsupportedFilterError`, which the route
6
+ * layer turns into a SCIM 501 error — we never silently mis-evaluate a filter.
7
+ *
8
+ * Auth0's inbound SCIM documents exactly this operator set (eq / and / or), so
9
+ * the subset is also the parity target.
10
+ */
11
+ export declare class UnsupportedFilterError extends Error {
12
+ }
13
+ export declare class InvalidFilterError extends Error {
14
+ }
15
+ export type ScimFilterValue = string | boolean | number;
16
+ export type ScimFilterNode = {
17
+ type: "eq";
18
+ attribute: string;
19
+ value: ScimFilterValue;
20
+ } | {
21
+ type: "and";
22
+ left: ScimFilterNode;
23
+ right: ScimFilterNode;
24
+ } | {
25
+ type: "or";
26
+ left: ScimFilterNode;
27
+ right: ScimFilterNode;
28
+ };
29
+ /**
30
+ * Recursive-descent parser. Grammar (precedence: or < and < comparison):
31
+ * filter := orExpr
32
+ * orExpr := andExpr ( "or" andExpr )*
33
+ * andExpr := primary ( "and" primary )*
34
+ * primary := "(" filter ")" | comparison
35
+ * comparison := ATTR "eq" VALUE
36
+ */
37
+ export declare function parseScimFilter(input: string): ScimFilterNode;
38
+ /**
39
+ * Evaluate a parsed filter against a flat attribute map (a SCIM resource
40
+ * projected to the attributes we support: `userName`, `externalId`, `active`,
41
+ * `emails.value`/`emails`). Attribute matching is case-insensitive on the name
42
+ * (SCIM attribute names are case-insensitive), and so is string value
43
+ * comparison: `userName` and `emails.value` are `caseExact: false` in our
44
+ * schema, and the targeted `userName` lookup is case-insensitive too, so an
45
+ * exact comparison here would make the same filter behave differently
46
+ * depending on which path served it.
47
+ */
48
+ export declare function evaluateScimFilter(node: ScimFilterNode, attributes: Record<string, ScimFilterValue | undefined>): boolean;
49
+ /**
50
+ * If the filter is a single `attr eq "value"` (the overwhelmingly common IdP
51
+ * case — lookup before create), return that pair so the route can do a
52
+ * targeted DB lookup instead of scanning the connection. Returns null for
53
+ * compound filters.
54
+ */
55
+ export declare function asSingleEquality(node: ScimFilterNode): {
56
+ attribute: string;
57
+ value: ScimFilterValue;
58
+ } | null;
@@ -0,0 +1,11 @@
1
+ export interface GeneratedScimToken {
2
+ token_id: string;
3
+ token: string;
4
+ token_hash: string;
5
+ }
6
+ /**
7
+ * SHA-256 hex of the raw bearer token. The SCIM auth middleware (Phase 2)
8
+ * hashes the presented token the same way and looks it up via `getByHash`.
9
+ */
10
+ export declare function hashScimToken(token: string): Promise<string>;
11
+ export declare function mintScimToken(): Promise<GeneratedScimToken>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Minimal SCIM 2.0 PATCH support (RFC 7644 §3.5.2), scoped to what Okta and
3
+ * Microsoft Entra send when provisioning users: `add` / `replace` / `remove`
4
+ * with either no path (a value object merged into the resource), a simple
5
+ * dotted path (`active`, `name.givenName`, `displayName`), or a single
6
+ * value-filtered multi-valued path (`emails[type eq "work"].value`).
7
+ *
8
+ * Operates on and returns a plain SCIM resource object; the route layer maps
9
+ * the patched resource back to AuthHero user fields. Anything outside the
10
+ * supported shape throws, which the route turns into a SCIM 400/501.
11
+ */
12
+ export declare class InvalidPatchError extends Error {
13
+ }
14
+ export declare class UnsupportedPatchError extends Error {
15
+ }
16
+ export interface ScimPatchOperation {
17
+ op: string;
18
+ path?: string;
19
+ value?: unknown;
20
+ }
21
+ type Json = Record<string, unknown>;
22
+ export declare function applyScimPatch(resource: Json, operations: ScimPatchOperation[]): Json;
23
+ export {};
@@ -0,0 +1,36 @@
1
+ import { ContentfulStatusCode } from "hono/utils/http-status";
2
+ export declare const SCIM_ERROR_URN = "urn:ietf:params:scim:api:messages:2.0:Error";
3
+ export declare const SCIM_LIST_URN = "urn:ietf:params:scim:api:messages:2.0:ListResponse";
4
+ export declare const SCIM_PATCH_OP_URN = "urn:ietf:params:scim:api:messages:2.0:PatchOp";
5
+ export declare const SCIM_CONTENT_TYPE = "application/scim+json";
6
+ export interface ScimErrorBody {
7
+ schemas: string[];
8
+ detail: string;
9
+ status: string;
10
+ scimType?: string;
11
+ }
12
+ /**
13
+ * SCIM error object (RFC 7644 §3.12). `status` is a string, and `scimType` is
14
+ * only meaningful for 400s (e.g. `uniqueness`, `invalidFilter`).
15
+ */
16
+ export declare function scimErrorBody(status: number, detail: string, scimType?: string): ScimErrorBody;
17
+ /**
18
+ * Thrown from SCIM middleware/helpers; rendered by the SCIM app's `onError`
19
+ * into a proper SCIM error object with the SCIM content type.
20
+ */
21
+ export declare class ScimError extends Error {
22
+ status: ContentfulStatusCode;
23
+ scimType?: string;
24
+ constructor(status: ContentfulStatusCode, detail: string, scimType?: string);
25
+ }
26
+ export interface ScimListResponse<T> {
27
+ schemas: string[];
28
+ totalResults: number;
29
+ startIndex: number;
30
+ itemsPerPage: number;
31
+ Resources: T[];
32
+ }
33
+ /**
34
+ * SCIM ListResponse envelope (RFC 7644 §3.4.2). `startIndex` is 1-based.
35
+ */
36
+ export declare function scimListResponse<T>(resources: T[], totalResults: number, startIndex: number, itemsPerPage: number): ScimListResponse<T>;
@@ -0,0 +1,76 @@
1
+ import { User } from "@authhero/adapter-interfaces";
2
+ import { ScimFilterValue } from "./filter";
3
+ export declare const SCIM_USER_SCHEMA_URN = "urn:ietf:params:scim:schemas:core:2.0:User";
4
+ export interface ScimEmail {
5
+ value: string;
6
+ primary?: boolean;
7
+ type?: string;
8
+ }
9
+ export interface ScimUserResource {
10
+ schemas: string[];
11
+ id: string;
12
+ externalId?: string;
13
+ userName?: string;
14
+ name?: {
15
+ givenName?: string;
16
+ familyName?: string;
17
+ };
18
+ displayName?: string;
19
+ emails?: ScimEmail[];
20
+ active: boolean;
21
+ meta: {
22
+ resourceType: "User";
23
+ created?: string;
24
+ lastModified?: string;
25
+ location: string;
26
+ };
27
+ }
28
+ /**
29
+ * The subset of user fields SCIM writes. `blocked` carries the inverse of the
30
+ * SCIM `active` attribute (active:false → blocked:true); `externalId` is
31
+ * persisted out-of-band in the scim_external_ids table by the route, not on
32
+ * the user row.
33
+ */
34
+ export interface MappedUserFields {
35
+ email?: string;
36
+ username?: string;
37
+ given_name?: string;
38
+ family_name?: string;
39
+ name?: string;
40
+ blocked?: boolean;
41
+ externalId?: string;
42
+ }
43
+ /**
44
+ * Project an AuthHero user to a SCIM User resource. Mirrors Auth0's default
45
+ * mapping: SCIM `id` is the AuthHero `user_id`, `active` is the inverse of
46
+ * `blocked`, and `externalId` comes from the connection's external-id table.
47
+ */
48
+ export declare function userToScimResource(user: User, externalId: string | undefined, location: string): ScimUserResource;
49
+ /**
50
+ * Map a SCIM User resource (as sent on create/replace, or the result of
51
+ * applying a PATCH) to AuthHero user fields. `userName` becomes `email` when it
52
+ * looks like an address, otherwise `username`. `active` maps to the inverse of
53
+ * `blocked`.
54
+ *
55
+ * Attributes the resource does not carry are **omitted from the result**, not
56
+ * set to `undefined`: the callers spread this straight into `users.update`, and
57
+ * an explicit key would be indistinguishable from "clear this field". Absent
58
+ * therefore means "leave unchanged" — a partial PATCH never unblocks a user or
59
+ * wipes their name.
60
+ */
61
+ export declare function scimResourceToUserFields(resource: {
62
+ userName?: string;
63
+ externalId?: string;
64
+ name?: {
65
+ givenName?: string;
66
+ familyName?: string;
67
+ };
68
+ displayName?: string;
69
+ emails?: ScimEmail[];
70
+ active?: boolean;
71
+ }): MappedUserFields;
72
+ /**
73
+ * Flatten a user (+ its externalId) to the attribute map the filter evaluator
74
+ * expects. Keys mirror the SCIM attribute names real IdPs filter on.
75
+ */
76
+ export declare function userToFilterAttributes(user: User, externalId: string | undefined): Record<string, ScimFilterValue | undefined>;
@@ -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.