···11+/* esm.sh - @atcute/identity-resolver@1.2.2 */
22+import{getAtprotoHandle as H,getPdsEndpoint as S}from"../../identity@1.1.4/es2022/identity.mjs";import{isDid as X}from"../../lexicons@1.2.10/es2022/syntax.mjs";var v=class extends Error{name="DidResolutionError"},h=class extends v{did;name="UnsupportedDidMethodError";constructor(e){super(`unsupported did method; did=${e}`),this.did=e}},U=class extends v{did;name="ImproperDidError";constructor(e){super(`improper did; did=${e}`),this.did=e}},p=class extends v{did;name="DocumentNotFoundError";constructor(e){super(`did document not found; did=${e}`),this.did=e}},u=class extends v{did;name="FailedDocumentResolutionError";constructor(e,r){super(`failed to resolve did document; did=${e}`,r),this.did=e}},E=class extends Error{name="HandleResolutionError"},f=class extends E{handle;name="DidNotFoundError";constructor(e){super(`handle returned no did; handle=${e}`),this.handle=e}},m=class extends E{handle;name="FailedHandleResolutionError";constructor(e,r){super(`failed to resolve handle; handle=${e}`,r),this.handle=e}},g=class extends E{handle;did;name="InvalidResolvedHandleError";constructor(e,r){super(`handle returned invalid did; handle=${e}; did=${r}`),this.handle=e,this.did=r}},R=class extends E{name="AmbiguousHandleError";constructor(e){super(`handle returned multiple did values; handle=${e}`)}},y=class extends Error{name="ActorResolutionError"};var A=class{handleResolver;didDocumentResolver;constructor(e){this.handleResolver=e.handleResolver,this.didDocumentResolver=e.didDocumentResolver}async resolve(e,r){let n=X(e),t;if(n)t=e;else try{t=await this.handleResolver.resolve(e,r)}catch(c){throw new y("failed to resolve handle",{cause:c})}let s;try{s=await this.didDocumentResolver.resolve(t,r)}catch(c){throw new y("failed to resolve did document",{cause:c})}let o=S(s);if(!o)throw new y("missing pds endpoint");let a="handle.invalid";if(n){let c=H(s);if(c)try{await this.handleResolver.resolve(c,r)===t&&(a=c)}catch{}}else H(s)===e&&(a=e);return{did:t,handle:a,pds:new URL(o).href}}};import{extractDidMethod as B}from"../../identity@1.1.4/es2022/identity.mjs";var T=class{#e;constructor({methods:e}){this.#e=new Map(Object.entries(e))}async resolve(e,r){let n=B(e),t=this.#e.get(n);if(t===void 0)throw new h(e);return await t.resolve(e,r)}};import{FailedResponseError as Q}from"../../util-fetch@1.0.5/es2022/util-fetch.mjs";import{defs as _}from"../../identity@1.1.4/es2022/identity.mjs";import{isResponseOk as q,parseResponseAsJson as z,pipe as G,validateJsonWith as K}from"../../util-fetch@1.0.5/es2022/util-fetch.mjs";var j=G(q,z(/^application\/(did\+ld\+)?json$/,20*1024),K(_.didDocument,{mode:"passthrough"}));var N=class{apiUrl;#e;constructor({apiUrl:e="https://plc.directory",fetch:r=fetch}={}){this.apiUrl=e,this.#e=r}async resolve(e,r){if(!e.startsWith("did:plc:"))throw new h(e);let n;try{let t=new URL(`/${encodeURIComponent(e)}`,this.apiUrl),s=await(0,this.#e)(t,{signal:r?.signal,cache:r?.noCache?"no-cache":void 0,redirect:"manual",headers:{accept:"application/did+ld+json,application/json"}});if(s.status>=300&&s.status<400)throw new TypeError("unexpected redirect");n=(await j(s)).json}catch(t){throw t instanceof Q&&t.status===404?new p(e):new u(e,{cause:t})}return n}};import{webDidToDocumentUrl as V}from"../../identity@1.1.4/es2022/identity.mjs";import{FailedResponseError as I}from"../../util-fetch@1.0.5/es2022/util-fetch.mjs";var P=class{#e;constructor({fetch:e=fetch}={}){this.#e=e}async resolve(e,r){if(!e.startsWith("did:web:"))throw new h(e);let n;try{let t=V(e),s=await(0,this.#e)(t,{signal:r?.signal,cache:r?.noCache?"no-cache":void 0,redirect:"manual",headers:{accept:"application/did+ld+json,application/json"}});if(s.status>=300&&s.status<400)throw new TypeError("unexpected redirect");n=(await j(s)).json}catch(t){throw t instanceof I&&t.status===404?new p(e):new u(e,{cause:t})}return n}},C=class{#e;constructor({fetch:e=fetch}={}){this.#e=e}async resolve(e,r){if(!e.startsWith("did:web:"))throw new h(e);let[n,...t]=e.slice(8).split(":").map(decodeURIComponent),s=new URL(`https://${n}/.well-known/did.json`);if(t.length>0)throw new U(e);let o;try{let a=await(0,this.#e)(s,{signal:r?.signal,cache:r?.noCache?"no-cache":void 0,redirect:"manual",headers:{accept:"application/did+ld+json,application/json"}});if(a.status>=300&&a.status<400)throw new TypeError("unexpected redirect");o=(await j(a)).json}catch(a){throw a instanceof I&&a.status===404?new p(e):new u(e,{cause:a})}return o}};import{defs as Y}from"../../identity@1.1.4/es2022/identity.mjs";import{FailedResponseError as Z,isResponseOk as ee,parseResponseAsJson as re,pipe as te,validateJsonWith as oe}from"../../util-fetch@1.0.5/es2022/util-fetch.mjs";import*as M from"../../../@badrap/valita@0.4.6/es2022/valita.mjs";var se=te(ee,re(/^application\/json$/,20*1024+16),oe(M.object({didDoc:Y.didDocument}),{mode:"passthrough"})),L=class{serviceUrl;#e;constructor({serviceUrl:e,fetch:r=fetch}){this.serviceUrl=e,this.#e=r}async resolve(e,r){let n;try{let t=new URL("/xrpc/com.atproto.identity.resolveDid",this.serviceUrl);t.searchParams.set("did",e);let s=await(0,this.#e)(t,{signal:r?.signal,cache:r?.noCache?"no-cache":void 0,headers:{accept:"application/json"}});n=(await se(s)).json.didDoc}catch(t){throw t instanceof Z&&t.status===404?new p(e):new u(e,{cause:t})}return n}};var k=class{#e;strategy;constructor({methods:e,strategy:r="race"}){this.#e=e,this.strategy=r}async resolve(e,r){let{http:n,dns:t}=this.#e,s=r?.signal,o=new AbortController;s&&s.addEventListener("abort",()=>o.abort(),{signal:o.signal});let a=t.resolve(e,{...r,signal:o.signal}),c=n.resolve(e,{...r,signal:o.signal});switch(this.strategy){case"race":return new Promise(d=>{a.then(l=>{o.abort(),d(l)},()=>d(c)),c.then(l=>{o.abort(),d(l)},()=>d(a))});case"dns-first":{c.catch(F);let d=await a.catch(F);return d?(o.abort(),d):c}case"http-first":{a.catch(F);let d=await c.catch(F);return d?(o.abort(),d):a}case"both":{let[d,l]=await Promise.allSettled([a,c]),x=d.status==="fulfilled"?d.value:void 0,D=l.status==="fulfilled"?l.value:void 0;if(x&&D&&x!==D)throw new R(e);return x||D||a}}}},F=()=>{};import{isAtprotoDid as ne}from"../../identity@1.1.4/es2022/identity.mjs";import{fetchDohJsonTxt as ae}from"../../util-fetch@1.0.5/es2022/util-fetch.mjs";var ie="_atproto",b="did=",J=class{dohUrl;#e;constructor({dohUrl:e,fetch:r=fetch}){this.dohUrl=e,this.#e=r}async resolve(e,r){let n;try{let o=new URL(this.dohUrl);o.searchParams.set("name",`${ie}.${e}`),o.searchParams.set("type","TXT");let a=await(0,this.#e)(o,{signal:r?.signal,cache:r?.noCache?"no-cache":void 0,headers:{accept:"application/dns-json"}});n=(await ae(a)).json}catch(o){throw new m(e,{cause:o})}let t=n.Status,s=n.Answer;if(t!==0)throw t===3?new f(e):new m(e,{cause:new TypeError(`dns returned ${t}`)});for(let o=0,a=s.length;o<a;o++){let d=s[o].data;if(!d.startsWith(b))continue;for(let x=o+1;x<a;x++)if(s[x].data.startsWith(b))throw new R(e);let l=d.slice(b.length);if(!ne(l))throw new g(e,l);return l}throw new f(e)}};import{isAtprotoDid as ce}from"../../identity@1.1.4/es2022/identity.mjs";import{FailedResponseError as de,isResponseOk as le,pipe as he,readResponseAsText as pe}from"../../util-fetch@1.0.5/es2022/util-fetch.mjs";var ue=he(le,pe(2064)),O=class{#e;constructor({fetch:e=fetch}={}){this.#e=e}async resolve(e,r){let n;try{let s=new URL("/.well-known/atproto-did",`https://${e}`),o=await(0,this.#e)(s,{signal:r?.signal,cache:r?.noCache?"no-cache":void 0,redirect:"manual"});if(o.status>=300&&o.status<400)throw new TypeError("unexpected redirect");n=(await ue(o)).text}catch(s){throw s instanceof de&&s.status===404?new f(e):new m(e,{cause:s})}let t=n.split(`
33+`)[0].trim();if(!ce(t))throw new g(e,t);return t}};import*as $ from"../../../@badrap/valita@0.4.6/es2022/valita.mjs";import{isAtprotoDid as fe}from"../../identity@1.1.4/es2022/identity.mjs";import{FailedResponseError as me,isResponseOk as we,parseResponseAsJson as xe,pipe as ve,validateJsonWith as Ee}from"../../util-fetch@1.0.5/es2022/util-fetch.mjs";var ge=$.object({did:$.string().assert(i=>fe(i))}),Re=ve(we,xe(/^application\/json$/,4*1024),Ee(ge,{mode:"passthrough"})),W=class{serviceUrl;#e;constructor({serviceUrl:e,fetch:r=fetch}){this.serviceUrl=e,this.#e=r}async resolve(e,r){let n;try{let t=new URL("/xrpc/com.atproto.identity.resolveHandle",this.serviceUrl);t.searchParams.set("handle",e);let s=await(0,this.#e)(t,{signal:r?.signal,cache:r?.noCache?"no-cache":void 0,headers:{accept:"application/json"}});n=(await Re(s)).json}catch(t){throw t instanceof me&&t.status===400?new f(e):new m(e,{cause:t})}return n.did}};export{y as ActorResolutionError,R as AmbiguousHandleError,C as AtprotoWebDidDocumentResolver,T as CompositeDidDocumentResolver,k as CompositeHandleResolver,v as DidDocumentResolutionError,f as DidNotFoundError,p as DocumentNotFoundError,J as DohJsonHandleResolver,u as FailedDocumentResolutionError,m as FailedHandleResolutionError,E as HandleResolutionError,U as ImproperDidError,g as InvalidResolvedHandleError,A as LocalActorResolver,N as PlcDidDocumentResolver,h as UnsupportedDidMethodError,P as WebDidDocumentResolver,O as WellKnownHandleResolver,L as XrpcDidDocumentResolver,W as XrpcHandleResolver};
44+//# sourceMappingURL=./identity-resolver.mjs.map
···11+/* esm.sh - @atcute/identity@1.1.4 */
22+var E=Object.defineProperty;var D=(e,t)=>{for(var o in t)E(e,o,{get:t[o],enumerable:!0})};var g={};D(g,{FRAGMENT_RE:()=>h,MULTIBASE_RE:()=>m,didDocument:()=>_,didRelativeUri:()=>f,didString:()=>d,multibaseString:()=>y,rfc3968UriSchema:()=>l,service:()=>x,verificationMethod:()=>u});import{isDid as R}from"../../lexicons@1.2.10/es2022/syntax.mjs";import*as r from"../../../@badrap/valita@0.4.6/es2022/valita.mjs";var h=/^#[^#]+$/,m=/^z[a-km-zA-HJ-NP-Z1-9]+$/,l=r.string().assert(e=>URL.canParse(e),"must be a url"),f=r.string().assert(e=>h.test(e)||URL.canParse(e),"must be a did relative uri"),y=r.string().assert(e=>m.test(e),"must be a base58 multibase"),d=r.string().assert(R,"must be a did"),u=r.object({id:f,type:r.string(),controller:d,publicKeyMultibase:y.optional(),publicKeyJwk:r.record().optional()}).chain(e=>{switch(e.type){case"Multikey":{if(e.publicKeyMultibase===void 0)return r.err({message:"missing multikey",path:["publicKeyMultibase"]});break}case"EcdsaSecp256k1VerificationKey2019":case"EcdsaSecp256r1VerificationKey2019":{if(e.publicKeyMultibase===void 0)return r.err({message:"missing multibase key",path:["publicKeyMultibase"]});break}}return r.ok(e)}),x=r.object({id:f,type:r.union(r.string(),r.array(r.string())),serviceEndpoint:r.union(l,r.record(l),r.array(r.union(l,r.record(l))))}),_=r.object({"@context":r.array(l).optional(),id:d,alsoKnownAs:r.array(l).chain(e=>{for(let t=0,o=e.length;t<o;t++){let n=e[t];for(let i=0;i<t;i++)if(n===e[i])return r.err({message:`duplicate "${n}" aka entry`,path:[t]})}return r.ok(e)}).optional(),verificationMethod:r.array(u).chain(e=>{for(let t=0,o=e.length;t<o;t++){let i=e[t].id;for(let s=0;s<t;s++)if(i===e[s].id)return r.err({message:`duplicate "${i}" verification method`,path:[t,"id"]})}return r.ok(e)}).optional(),service:r.array(x).optional(),controller:r.union(d,r.array(d)).optional(),authentication:r.array(r.union(f,u)).optional()}).chain(e=>{let{id:t,service:o}=e;if(o?.length){let n=o.length,i=new Array(n);for(let s=0;s<n;s++){let a=o[s].id;a[0]==="#"&&(a=t+a),i[s]=a}for(let s=0;s<n;s++){let c=i[s];for(let a=0;a<s;a++)if(c===i[a])return r.err({message:`duplicate "${c}" service`,path:["service",s,"id"]})}}return r.ok(e)});import{isHandle as M}from"../../lexicons@1.2.10/es2022/syntax.mjs";var $="parse"in URL,w=e=>{let t=null;if($)t=URL.parse(e);else try{t=new URL(e)}catch{}return t!==null&&(t.protocol==="https:"||t.protocol==="http:")&&t.pathname==="/"&&t.search===""&&t.hash===""},b=(e,t)=>{let o=e.verificationMethod;if(!o)return;let n=`${e.id}${t}`;for(let i=0,s=o.length;i<s;i++){let{id:c,type:a,publicKeyMultibase:v}=o[i];if(c===n&&v!==void 0)return{type:a,publicKeyMultibase:v}}},W=e=>b(e,"#atproto"),F=e=>b(e,"#atproto_label"),N=e=>{let t=e.alsoKnownAs;if(!t)return null;let o="at://";for(let n=0,i=t.length;n<i;n++){let s=t[n];if(!s.startsWith(o))continue;let c=s.slice(o.length);return M(c)?c:void 0}return null},p=(e,t)=>{let o=e.service;if(o)for(let n=0,i=o.length;n<i;n++){let{id:s,type:c,serviceEndpoint:a}=o[n];if(!(s!==t.id&&s!==e.id+t.id)){if(t.type!==void 0){if(Array.isArray(c)){if(!c.includes(t.type))continue}else if(c!==t.type)continue}if(!(typeof a!="string"||!w(a)))return a}}},T=e=>p(e,{id:"#atproto_pds",type:"AtprotoPersonalDataServer"}),V=e=>p(e,{id:"#atproto_labeler",type:"AtprotoLabeler"}),H=e=>p(e,{id:"#bsky_chat",type:"BskyChatService"}),O=e=>p(e,{id:"#bsky_fg",type:"BskyFeedGenerator"}),G=e=>p(e,{id:"#bsky_notif",type:"BskyNotificationService"});var z=/^did:plc:([a-z2-7]{24})$/,A=e=>e.length===32&&z.test(e);var K=/^did:web:([a-zA-Z0-9%-]+(?:(?:\.[a-zA-Z0-9%-]+)*(?:\.[a-zA-Z]{2,}))?)?((?::[a-zA-Z0-9\-%.]+)+)?$/,U=/^did:web:([a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*(?:\.[a-zA-Z]{2,})|localhost(?:%3[aA]\d+)?)$/,Y=e=>e.length>=9&&K.test(e),k=e=>e.length>=12&&U.test(e),q=e=>{let[t,...o]=e.slice(8).split(":").map(decodeURIComponent),n=`did:web:${encodeURIComponent(t.toLowerCase())}`;return o.length>0&&(n+=`:${o.join(":")}`),n},Q=e=>{let[t,...o]=e.slice(8).split(":").map(decodeURIComponent),n="/"+o.join("/");n==="/"?n="/.well-known/did.json":n+="/did.json";let i=new URL(`https://${t}${n}`);return i.hostname==="localhost"&&(i.protocol="http:"),i};var L=/^(?:[A-Za-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*$/,P=e=>A(e)||k(e),oe=e=>{if(e.length<14)return!1;let t=e.indexOf("#",12);return t===-1?!1:L.test(e.slice(t+1))&&P(e.slice(0,t))},ne=e=>{let t=e.indexOf(":",4);return e.slice(4,t)};var S=/^did:key:z[a-km-zA-HJ-NP-Z1-9]+$/,se=e=>e.length>=10&&S.test(e);export{U as ATPROTO_WEB_DID_RE,z as PLC_DID_RE,K as WEB_DID_RE,g as defs,ne as extractDidMethod,N as getAtprotoHandle,F as getAtprotoLabelerVerificationMaterial,p as getAtprotoServiceEndpoint,W as getAtprotoVerificationMaterial,H as getBlueskyChatEndpoint,O as getBlueskyFeedgenEndpoint,G as getBlueskyNotificationEndpoint,V as getLabelerEndpoint,T as getPdsEndpoint,b as getVerificationMaterial,oe as isAtprotoAudience,P as isAtprotoDid,w as isAtprotoServiceEndpoint,k as isAtprotoWebDid,se as isKeyDid,A as isPlcDid,Y as isWebDid,q as normalizeWebDid,Q as webDidToDocumentUrl};
33+//# sourceMappingURL=./identity.mjs.map
···11+/* esm.sh - @atcute/lexicons@1.2.10/dist/syntax/at-identifier */
22+import{isDid as i}from"./did.mjs";import{isHandle as o}from"./handle.mjs";var m=r=>i(r)||o(r);export{m as isActorIdentifier};
33+//# sourceMappingURL=./at-identifier.mjs.map
···11+{"mappings":";AAAA,OAAS,SAAAA,MAAuB,YAChC,OAAS,YAAAC,MAA6B,eAS/B,IAAMC,EAAqBC,GAC1BH,EAAMG,CAAK,GAAKF,EAASE,CAAK","names":["isDid","isHandle","isActorIdentifier","input"],"sources":["../esm/npm/@atcute/lexicons@1.2.10/node_modules/@atcute/lexicons/lib/syntax/at-identifier.ts"],"sourcesContent":["import { isDid, type Did } from './did.ts';\nimport { isHandle, type Handle } from './handle.ts';\n\n/**\n * represents an account's identifier, either a {@link Did} or a\n * {@link Handle}\n */\nexport type ActorIdentifier = Did | Handle;\n\n// #__NO_SIDE_EFFECTS__\nexport const isActorIdentifier = (input: unknown): input is ActorIdentifier =\u003e {\n\treturn isDid(input) || isHandle(input);\n};\n"],"version":3}
···11+/* esm.sh - @atcute/multibase@1.2.0 */
22+var H=t=>Uint8Array.fromHex(t),N=t=>t.toHex();import{alloc as T,allocUnsafe as b}from"../../uint8array@1.1.1/es2022/uint8array.mjs";var w=(t,a,i)=>x=>{let e=(1<<a)-1,B="",o=0,r=0;for(let n=0;n<x.length;++n)for(r=r<<8|x[n],o+=8;o>a;)o-=a,B+=t[e&r>>o];if(o!==0&&(B+=t[e&r<<a-o]),i)for(;(B.length*a&7)!==0;)B+="=";return B},E=(t,a,i)=>{let x={};for(let e=0;e<t.length;++e)x[t[e]]=e;return e=>{let B=e.length;for(;i&&e[B-1]==="=";)--B;let o=b(B*a/8|0),r=0,n=0,s=0;for(let f=0;f<B;++f){let l=x[e[f]];if(l===void 0)throw new SyntaxError("invalid base string");n=n<<a|l,r+=a,r>=8&&(r-=8,o[s++]=255&n>>r)}if(r>=a||(255&n<<8-r)!==0)throw new SyntaxError("unexpected end of data");return o}},_=t=>{if(t.length>=255)throw new RangeError("alphabet too long");let a=t.length,i=t.charAt(0),x=Math.log(256)/Math.log(a);return e=>{if(e.length===0)return"";let B=0,o=0,r=0,n=e.length;for(;r!==n&&e[r]===0;)r++,B++;let s=n-r,f=s*x+1>>>0,l=T(f);{let p=s%3,m=n-p;for(;r<m;){let d=e[r]<<16|e[r+1]<<8|e[r+2],A=0;for(let g=f-1;(d!==0||A<o)&&g!==-1;g--,A++)d=d+16777216*l[g],l[g]=d%a|0,d=d/a|0;o=A,r+=3}}for(;r!==n;){let p=e[r],m=0;for(let d=f-1;(p!==0||m<o)&&d!==-1;d--,m++)p=p+256*l[d],l[d]=p%a|0,p=p/a|0;o=m,r++}let c=f-o;for(;c!==f&&l[c]===0;)c++;let h=i.repeat(B);for(;c<f;++c)h+=t.charAt(l[c]);return h}},z=t=>{if(t.length>=255)throw new RangeError("alphabet too long");let a=new Uint8Array(128).fill(255);for(let o=0;o<t.length;o++){let r=t.charCodeAt(o);if(r>=128)throw new RangeError("non-ASCII character in alphabet");if(a[r]!==255)throw new RangeError(`${t[o]} is ambiguous`);a[r]=o}let i=t.length,x=i*i,e=t.charAt(0),B=Math.log(i)/Math.log(256);return o=>{if(o.length===0)return b(0);let r=0,n=0,s=0;for(;o[r]===e;)n++,r++;let f=o.length-r,l=f*B+1>>>0,c=T(l);{let m=f&1,d=o.length-m;for(;r<d;){let A=a[o.charCodeAt(r)],g=a[o.charCodeAt(r+1)];if(A===255||g===255)throw new Error("invalid string");let u=A*i+g,y=0;for(let C=l-1;(u!==0||y<s)&&C!==-1;C--,y++)u+=x*c[C],c[C]=u&255,u=(u-(u&255))/256;if(u!==0)throw new Error("non-zero carry");s=y,r+=2}}if(r<o.length){let m=a[o.charCodeAt(r)];if(m===255)throw new Error("invalid string");let d=0;for(let A=l-1;(m!==0||d<s)&&A!==-1;A--,d++)m+=i*c[A],c[A]=m&255,m=m>>>8;if(m!==0)throw new Error("non-zero carry");s=d}let h=l-s;for(;h!==l&&c[h]===0;)h++;if(h===n)return c;let p=b(n+(l-h));return p.fill(0,0,n),p.set(c.subarray(h),n),p}};var k="0123456789abcdef",D=E(k,4,!1),L=w(k,4,!1);var M="fromHex"in Uint8Array,rt=M?H:D,at=M?N:L;var I=t=>Uint8Array.fromBase64(t,{alphabet:"base64",lastChunkHandling:"loose"}),O=t=>t.toBase64({alphabet:"base64",omitPadding:!0}),j=t=>Uint8Array.fromBase64(t,{alphabet:"base64",lastChunkHandling:"strict"}),q=t=>t.toBase64({alphabet:"base64",omitPadding:!1}),F=t=>Uint8Array.fromBase64(t,{alphabet:"base64url",lastChunkHandling:"loose"}),V=t=>t.toBase64({alphabet:"base64url",omitPadding:!0}),G=t=>Uint8Array.fromBase64(t,{alphabet:"base64url",lastChunkHandling:"strict"}),J=t=>t.toBase64({alphabet:"base64url",omitPadding:!1});var S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",K=E(S,6,!1),Q=w(S,6,!1),W=E(S,6,!0),X=w(S,6,!0),Y=E(R,6,!1),Z=w(R,6,!1),$=E(R,6,!0),tt=w(R,6,!0);var P="fromBase64"in Uint8Array,nt=P?I:K,st=P?O:Q,ft=P?j:W,lt=P?q:X,ct=P?F:Y,it=P?V:Z,Bt=P?G:$,dt=P?J:tt;import{allocUnsafe as ht}from"../../uint8array@1.1.1/es2022/uint8array.mjs";var xt="abcdefghijklmnopqrstuvwxyz234567",mt=(()=>{let t=new Uint8Array(32);for(let a=0;a<32;a++)t[a]=xt.charCodeAt(a);return t})(),v=String.fromCharCode,et=t=>{let a=t.length,i=a/5|0,x=a-i*5,e=mt,B="",o=0,r=i/2|0;for(let n=0;n<r;n++){let s=t[o],f=t[o+1],l=t[o+2],c=t[o+3],h=t[o+4],p=t[o+5],m=t[o+6],d=t[o+7],A=t[o+8],g=t[o+9];B+=v(e[s>>>3],e[(s<<2|f>>>6)&31],e[f>>>1&31],e[(f<<4|l>>>4)&31],e[(l<<1|c>>>7)&31],e[c>>>2&31],e[(c<<3|h>>>5)&31],e[h&31],e[p>>>3],e[(p<<2|m>>>6)&31],e[m>>>1&31],e[(m<<4|d>>>4)&31],e[(d<<1|A>>>7)&31],e[A>>>2&31],e[(A<<3|g>>>5)&31],e[g&31]),o+=10}if(i&1){let n=t[o],s=t[o+1],f=t[o+2],l=t[o+3],c=t[o+4];B+=v(e[n>>>3],e[(n<<2|s>>>6)&31],e[s>>>1&31],e[(s<<4|f>>>4)&31],e[(f<<1|l>>>7)&31],e[l>>>2&31],e[(l<<3|c>>>5)&31],e[c&31]),o+=5}if(x>0){let n=0,s=0;for(let f=o;f<a;f++)n=n<<8|t[f],s+=8;for(;s>=5;)s-=5,B+=v(e[n>>>s&31]);s>0&&(B+=v(e[n<<5-s&31]))}return B};var pt="abcdefghijklmnopqrstuvwxyz234567",U=(()=>{let t=new Uint8Array(128).fill(255);for(let a=0;a<32;a++)t[pt.charCodeAt(a)]=a;return t})(),At=t=>{let a=t.length,i=ht(a*5/8|0),x=0,e=0,B=a-a%8;for(;e<B;e+=8){let o=U[t.charCodeAt(e)],r=U[t.charCodeAt(e+1)],n=U[t.charCodeAt(e+2)],s=U[t.charCodeAt(e+3)],f=U[t.charCodeAt(e+4)],l=U[t.charCodeAt(e+5)],c=U[t.charCodeAt(e+6)],h=U[t.charCodeAt(e+7)];if((o|r|n|s|f|l|c|h)&224)throw new SyntaxError("invalid base string");i[x]=o<<3|r>>>2,i[x+1]=(r<<6|n<<1|s>>>4)&255,i[x+2]=(s<<4|f>>>1)&255,i[x+3]=(f<<7|l<<2|c>>>3)&255,i[x+4]=(c<<5|h)&255,x+=5}if(e<a){let o=0,r=0;for(;e<a;++e){let n=U[t.charCodeAt(e)];if(n&224)throw new SyntaxError("invalid base string");r=r<<5|n,o+=5,o>=8&&(o-=8,i[x++]=255&r>>o)}if(o>=5||(255&r<<8-o)!==0)throw new SyntaxError("unexpected end of data")}return i};var ot="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",gt=z(ot),Ut=_(ot);export{rt as fromBase16,At as fromBase32,gt as fromBase58Btc,nt as fromBase64,ft as fromBase64Pad,ct as fromBase64Url,Bt as fromBase64UrlPad,at as toBase16,et as toBase32,Ut as toBase58Btc,st as toBase64,lt as toBase64Pad,it as toBase64Url,dt as toBase64UrlPad};
33+//# sourceMappingURL=./multibase.mjs.map
···11+/* esm.sh - @atcute/oauth-browser-client@3.0.0 */
22+var b=typeof navigator<"u"?navigator.locks:void 0;var ee=t=>{if(t!=null){let e=JSON.parse(t);if(e!=null)return e}return{}},M=({name:t})=>{let e=new AbortController,r=e.signal,s=(o,i,a=!1)=>{let n,u=`${t}:${o}`,h=()=>n&&localStorage.setItem(u,JSON.stringify(n)),d=()=>{if(r.aborted)throw new Error("store closed");return n??=ee(localStorage.getItem(u))};{let p=c=>{c.key===u&&(n=void 0)};globalThis.addEventListener("storage",p,{signal:r})}{let p=async c=>{if(!c||r.aborted||(await new Promise(l=>setTimeout(l,1e4)),r.aborted))return;let f=Date.now(),y=!1;d();for(let l in n){let S=n[l].expiresAt;S!==null&&f>S&&(y=!0,delete n[l])}y&&h()};b?b.request(`${u}:cleanup`,{ifAvailable:!0},p):p(!0)}return{get(p){d();let c=n[p];if(!c)return;let f=c.expiresAt;if(f!==null&&Date.now()>f){delete n[p],h();return}return c.value},getWithLapsed(p){d();let c=n[p],f=Date.now();if(!c)return[void 0,1/0];let y=c.updatedAt;return y===void 0?[c.value,1/0]:[c.value,f-y]},set(p,c){d();let f={value:c,expiresAt:i(c),updatedAt:a?Date.now():void 0};n[p]=f,h()},delete(p){d(),n[p]!==void 0&&(delete n[p],h())},keys(){return d(),Object.keys(n)}}};return{dispose:()=>{e.abort()},sessions:s("sessions",({token:o})=>o.refresh?null:o.expires_at??null),states:s("states",o=>Date.now()+600*1e3),dpopNonces:s("dpopNonces",o=>Date.now()+1440*60*1e3,!0),inflightDpop:new Map}};var A,P,T,w,$,te=t=>{({identityResolver:$,fetchClientAssertion:T}=t),{client_id:A,redirect_uri:P}=t.metadata,w=M({name:t.storageName??"atcute-oauth"})};var x=class extends Error{name="LoginError"},I=class extends Error{name="AuthorizationError"},m=class extends Error{name="ResolverError"},v=class extends Error{sub;name="TokenRefreshError";constructor(e,r,s){super(r,s),this.sub=e}},E=class extends Error{response;data;name="OAuthResponseError";error;description;constructor(e,r){let s=W(B(r)?.error),o=W(B(r)?.error_description),i=s?`"${s}"`:"unknown",a=o?`: ${o}`:"",n=`OAuth ${i} error${a}`;super(n),this.response=e,this.data=r,this.error=s,this.description=o}get status(){return this.response.status}get headers(){return this.response.headers}},j=class extends Error{response;status;name="FetchResponseError";constructor(e,r,s){super(s),this.response=e,this.status=r}},W=t=>typeof t=="string"?t:void 0,B=t=>typeof t=="object"&&t!==null&&!Array.isArray(t)?t:void 0;import{generateDpopKey as ye,generatePkce as ge}from"../../oauth-crypto@0.1.0/es2022/oauth-crypto.mjs";import{nanoid as _e}from"../../../nanoid@5.1.7/es2022/nanoid.mjs";var k=t=>t.get("content-type")?.split(";")[0];var re="parse"in URL,H=t=>{let e=null;if(re)e=URL.parse(t);else try{e=new URL(t)}catch{}return e!==null?e.protocol==="https:"||e.protocol==="http:":!1};var L=async t=>{let e=await $.resolve(t);return{identity:e,metadata:await G(e.pds)}},J=async t=>{try{return{metadata:await G(t)}}catch(e){if(e instanceof m)try{return{metadata:await V(t)}}catch{}throw e}},se=async t=>{let e=new URL("/.well-known/oauth-protected-resource",t),r=await fetch(e.href,{redirect:"manual",headers:{accept:"application/json"}});if(r.status!==200||k(r.headers)!=="application/json")throw new m("unexpected response");let s=await r.json();if(s.resource!==e.origin)throw new m("unexpected issuer");return s},V=async t=>{let e=new URL("/.well-known/oauth-authorization-server",t),r=await fetch(e.href,{redirect:"manual",headers:{accept:"application/json"}});if(r.status!==200||k(r.headers)!=="application/json")throw new m("unexpected response");let s=await r.json();if(s.issuer!==e.origin)throw new m("unexpected issuer");if(!H(s.authorization_endpoint))throw new m("authorization server provided incorrect authorization endpoint");if(!s.client_id_metadata_document_supported)throw new m("authorization server does not support 'client_id_metadata_document'");if(!s.pushed_authorization_request_endpoint)throw new m("authorization server does not support 'pushed_authorization request'");if(s.response_types_supported&&!s.response_types_supported.includes("code"))throw new m("authorization server does not support 'code' response type");return s},G=async t=>{let e=await se(t);if(e.authorization_servers?.length!==1)throw new m("expected exactly one authorization server in the listing");let r=e.authorization_servers[0],s=await V(r);if(s.protected_resources&&!s.protected_resources.includes(e.resource))throw new m("server is not in authorization server's jurisdiction");return s};import{createDpopProofSigner as ae}from"../../oauth-crypto@0.1.0/es2022/oauth-crypto.mjs";import{createDpopProofSigner as oe,sha256Base64Url as ne}from"../../oauth-crypto@0.1.0/es2022/oauth-crypto.mjs";var U=(t,e)=>{let r=w.dpopNonces,s=w.inflightDpop,o=oe(t);return async(i,a)=>{let n=new Request(i,a),u=n.headers.get("authorization"),h=u?.startsWith("DPoP ")?await ne(u.slice(5)):void 0,{method:d,url:p}=n,{origin:c,pathname:f}=new URL(p),y=c+f,l=s.get(c);l&&(await l.promise,l=void 0);let z,S=!1;try{let[D,g]=r.getWithLapsed(c);z=D,S=g>180*1e3}catch{}S&&s.set(c,l=Promise.withResolvers());let R;try{let D=await o(d,y,z,h);n.headers.set("dpop",D);let g=await fetch(n);if(R=g.headers.get("dpop-nonce"),R===null||R===z)return g;try{r.set(c,R)}catch{}if(!await ie(g,e)||i===n||a?.body instanceof ReadableStream)return g}finally{l&&(s.delete(c),l.resolve())}{let D=await o(d,y,R,h),g=new Request(i,a);g.headers.set("dpop",D);let C=await fetch(g),O=C.headers.get("dpop-nonce");if(O!==null&&O!==R)try{r.set(c,O)}catch{}return C}}},ie=async(t,e)=>{if((e===void 0||e===!1)&&t.status===401){let r=t.headers.get("www-authenticate");if(r?.startsWith("DPoP"))return r.includes('error="use_dpop_nonce"')}if((e===void 0||e===!0)&&t.status===400&&k(t.headers)==="application/json")try{let r=await t.clone().json();return typeof r=="object"&&r?.error==="use_dpop_nonce"}catch{return!1}return!1};var Q=(t,e)=>{let r={};for(let s=0,o=e.length;s<o;s++){let i=e[s];r[i]=t[i]}return r};var _=class{#t;#e;#r;constructor(e,r){this.#e=e,this.#r=r,this.#t=U(r,!0)}async request(e,r){let s=this.#e[`${e}_endpoint`];if(!s)throw new Error(`no endpoint for ${e}`);if((e==="token"||e==="pushed_authorization_request")&&T!==void 0){let a=ae(this.#r),n=await T({aud:this.#e.issuer,createDpopProof:async(u,h)=>await a("POST",u,h,void 0)});r={...r,...n}}let o=await this.#t(s,{method:"post",headers:{"content-type":"application/json"},body:JSON.stringify({...r,client_id:A})});if(k(o.headers)!=="application/json")throw new j(o,2,"unexpected content-type");let i=await o.json();if(o.ok)return i;throw new E(o,i)}async revoke(e){try{await this.request("revocation",{token:e})}catch{}}async exchangeCode(e,r){let s=await this.request("token",{grant_type:"authorization_code",redirect_uri:P,code:e,code_verifier:r});try{return await this.#o(s)}catch(o){throw await this.revoke(s.access_token),o}}async refresh({sub:e,token:r}){if(!r.refresh)throw new v(e,"no refresh token available");let s=await this.request("token",{grant_type:"refresh_token",refresh_token:r.refresh});try{if(e!==s.sub)throw new v(e,`sub mismatch in token response; got ${s.sub}`);return this.#s(s)}catch(o){throw await this.revoke(s.access_token),o}}#s(e){if(!e.sub)throw new TypeError("missing sub field in token response");if(!e.scope)throw new TypeError("missing scope field in token response");if(e.token_type!=="DPoP")throw new TypeError("token response returned a non-dpop token");return{scope:e.scope,refresh:e.refresh_token,access:e.access_token,type:e.token_type,expires_at:typeof e.expires_in=="number"?Date.now()+e.expires_in*1e3:void 0}}async#o(e){let r=e.sub;if(!r)throw new TypeError("missing sub field in token response");let s=this.#s(e),o=await L(r);if(o.metadata.issuer!==this.#e.issuer)throw new TypeError(`issuer mismatch; got ${o.metadata.issuer}`);return{token:s,info:{sub:r,aud:o.identity.pds,server:Q(o.metadata,["issuer","authorization_endpoint","introspection_endpoint","pushed_authorization_request_endpoint","revocation_endpoint","token_endpoint"])}}}};import{fromBase64Url as ce}from"../../multibase@1.2.0/es2022/multibase.mjs";var pe={name:"ECDSA",namedCurve:"P-256"},X=t=>typeof t.key=="string"&&typeof t.jwt=="string",Y=async t=>{let e=ce(t.key),r=await crypto.subtle.importKey("pkcs8",e,pe,!0,["sign"]),s=await crypto.subtle.exportKey("jwk",r);return s.alg="ES256",s};var q=new Map,K=async(t,e)=>{e?.signal?.throwIfAborted();let r=we;e?.noCache?r=le:e?.allowStale&&(r=de);let s;for(;s=q.get(t);){try{let{isFresh:n,value:u}=await s;if(n||r(u))return u}catch{}e?.signal?.throwIfAborted()}let o=async()=>{let n=await me(t,w.sessions.get(t));if(n&&r(n))return{isFresh:!1,value:n};let u=await he(t,n);return await F(t,u),{isFresh:!0,value:u}},i;if(b?i=b.request(`atcute-oauth:${t}`,o):i=o(),i=i.finally(()=>q.delete(t)),q.has(t))throw new Error("concurrent request for the same key");q.set(t,i);let{value:a}=await i;return a},F=async(t,e)=>{try{w.sessions.set(t,e)}catch(r){throw await fe(e),r}},N=t=>{w.sessions.delete(t)},ue=()=>w.sessions.keys(),de=()=>!0,le=()=>!1,he=async(t,e)=>{if(e===void 0)throw new v(t,"session deleted by another tab");let{dpopKey:r,info:s,token:o}=e,i=new _(s.server,r);try{let a=await i.refresh({sub:s.sub,token:o});return{dpopKey:r,info:s,token:a}}catch(a){throw a instanceof E&&a.status===400&&a.error==="invalid_grant"?new v(t,"session was revoked",{cause:a}):a}},fe=async({dpopKey:t,info:e,token:r})=>{await new _(e.server,t).revoke(r.refresh??r.access)},we=({token:t})=>{let e=t.expires_at;return e==null||Date.now()+6e4<=e},me=async(t,e)=>{if(!e||!X(e.dpopKey))return e;let r=await Y(e.dpopKey),s={...e,dpopKey:r};try{w.sessions.set(t,s)}catch{}return s};var ct=async t=>{let{target:e,scope:r,state:s=null,...o}=t,i;switch(e.type){case"account":{i=await L(e.identifier);break}case"pds":i=await J(e.serviceUrl)}let{identity:a,metadata:n}=i,u=a?a.handle!=="handle.invalid"?a.handle:a.did:void 0,h=_e(24),d=await ge(),p=await ye(["ES256"]),c={display:o.display,ui_locales:o.locale,prompt:o.prompt,redirect_uri:P,code_challenge:d.challenge,code_challenge_method:d.method,state:h,login_hint:u,response_mode:"fragment",response_type:"code",scope:r};w.states.set(h,{dpopKey:p,metadata:n,verifier:d.verifier,state:s});let y=await new _(n,p).request("pushed_authorization_request",c),l=new URL(n.authorization_endpoint);return l.searchParams.set("client_id",A),l.searchParams.set("request_uri",y.request_uri),l},pt=async t=>{let e=t.get("iss"),r=t.get("state"),s=t.get("code"),o=t.get("error");if(!r||!(s||o))throw new x("missing parameters");let i=w.states.get(r);if(i)w.states.delete(r);else throw new x("unknown state provided");if(o)throw new I(t.get("error_description")||o);if(!s)throw new x("missing code parameter");let a=i.dpopKey,n=i.metadata,u=i.state??null;if(e===null)throw new x("missing issuer parameter");if(e!==n.issuer)throw new x("issuer mismatch");let h=new _(n,a),{info:d,token:p}=await h.exchangeCode(s,i.verifier),c=d.sub,f={dpopKey:a,info:d,token:p};return await F(c,f),{session:f,state:u}};var Z=class{session;#t;#e;constructor(e){this.session=e,this.#t=U(e.dpopKey,!1)}get sub(){return this.session.info.sub}getSession(e){let r=K(this.session.info.sub,e);return r.then(s=>{this.session=s}).finally(()=>{this.#e=void 0}),this.#e=r}async signOut(){let e=this.session.info.sub;try{let{dpopKey:r,info:s,token:o}=await K(e,{allowStale:!0});await new _(s.server,r).revoke(o.refresh??o.access)}finally{N(e)}}async handle(e,r){await this.#e;let s=new Headers(r?.headers),o=this.session,i=new URL(e,o.info.aud);s.set("authorization",`${o.token.type} ${o.token.access}`);let a=await this.#t(i.href,{...r,headers:s});if(!xe(a))return a;try{this.#e?o=await this.#e:o=await this.getSession()}catch{return a}return r?.body instanceof ReadableStream?a:(i=new URL(e,o.info.aud),s.set("authorization",`${o.token.type} ${o.token.access}`),await this.#t(i.href,{...r,headers:s}))}},xe=t=>{if(t.status!==401)return!1;let e=t.headers.get("www-authenticate");return e!=null&&(e.startsWith("Bearer ")||e.startsWith("DPoP "))&&e.includes('error="invalid_token"')};export{I as AuthorizationError,j as FetchResponseError,x as LoginError,E as OAuthResponseError,Z as OAuthUserAgent,m as ResolverError,v as TokenRefreshError,te as configureOAuth,ct as createAuthorizationUrl,N as deleteStoredSession,pt as finalizeAuthorization,K as getSession,ue as listStoredSessions};
33+//# sourceMappingURL=./oauth-browser-client.mjs.map
···11+{"mappings":";AAEA,IAAMA,EAAeC,OAAU,IAAC,gBAAA,EAsChC,SAASC,GAAAA,CACR,GAAIC,EAAa,EAChBA,QADD,CAKA,IAAIC,EACAC,EAAAA,GAGJ,KAkHD,UAAA,CACC,IAAIC,EAAYC,EAGhB,IAFAA,EAAAA,OAEOD,IAAP,QACKA,EAAUE,EAAQC,IAAWH,EAAUG,IAC1CH,EAAUE,EAAQE,EAAWJ,EAAUI,GAExCJ,EAAYA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,EAAsB/E,EAC1BA,OAAAA,EAAkB,CAAA,EAEX,UAAA,CACN,IAAIgF,EAAehF,EACnB,OAAIA,GAAmB+E,IACtBA,EAAsBA,EAAoBE,OAAOjF,CAAAA,GAGlDA,EAAkB+E,EAEXC,CACR,CACD,CAEA,IAAME,EAAe,SAACnE,EAAAA,CACrB,QAAWoE,KAAOpE,EAAO,CACxB,IAAMqE,EAAMrE,EAAMoE,CAAAA,EACC,OAARC,GAAQ,WAClBrE,EAAMoE,CAAAA,EAAOX,EAAOY,CAAAA,EACK,OAARA,GAAQ,UAAYA,IAAQ,MAARA,EAAkB,UAAWA,IAGlEF,EAAaE,CAAAA,CAEf,CACD,EAEA,SAASC,EACRC,EAAAA,CAEA,OAAA,UAAA,CACC,IAAIN,EACAO,EAEEC,EAAuBV,EAAAA,EAC7B,GAAA,CACCS,EAAQD,EAAYV,MAAAA,OAAA,CAAA,EAAAC,MAAA9C,KAAA2C,SAAAA,CAAAA,CASrB,OARSlF,EAAAA,CAIRQ,MAAAA,EAAAA,OACMR,CACP,QAAC,CACAwF,EAAeQ,EAAAA,CAChB,CAEAN,OAAAA,EAAaK,CAAAA,EAEbA,EAAMnH,OAAOmG,OAAAA,EAAWC,EAAO,UAAA,CAC9B,GAAIQ,EACH,QAASS,EAAI,EAAGA,EAAIT,EAAaU,OAAQD,IACxCT,EAAaS,CAAAA,EAAGlB,QAAAA,EAIlBS,EAAAA,MACD,CAAA,EAEOO,CACR,CACD","names":["BRAND_SYMBOL","Symbol","endBatch","batchDepth","error","hasError","snapshots","batchSnapshots","_source","_value","_version","_next","reconcileBatchSnapshots","batchedEffect","effect","batchIteration","next","_nextBatchedEffect","_flags","needsToRecompute","_callback","err","batch","fn","currentBatchSnapshotVersion","batchSnapshotVersion","evalContext","untracked","prevContext","capturedEffects","globalVersion","addDependency","signal","node","_node","_target","_prevSource","_sources","_nextSource","_prevTarget","_nextTarget","_rollbackNode","_subscribe","Signal","value","options","this","_targets","_batchSnapshotVersion","_watched","watched","_unwatched","unwatched","name","prototype","brand","_refresh","_this","targets","_this$_watched","call","_unsubscribe","_this2","prev","_this2$_unwatched","subscribe","_this3","valueOf","toString","toJSON","peek","Object","defineProperty","get","set","Error","source","_notify","target","prepareSources","rollbackNode","cleanupSources","head","Computed","undefined","_fn","_globalVersion","OUTDATED","computed","cleanupEffect","cleanup","_cleanup","disposeEffect","endEffect","Effect","push","finish","_start","bind","_dispose","dispose","action","_arguments","arguments","_this4","apply","slice","startCapturingEffects","prevCapturedEffects","modelEffects","concat","wrapInAction","key","val","createModel","modelFactory","model","stopCapturingEffects","i","length"],"sources":["../esm/npm/@preact/signals-core@1.14.1/node_modules/@preact/signals-core/src/index.ts"],"sourcesContent":["// An named symbol/brand for detecting Signal instances even when they weren't\n// created using the same signals library version.\nconst BRAND_SYMBOL = Symbol.for(\"preact-signals\");\n\n// Flags for Computed and Effect.\nconst RUNNING = 1 \u003c\u003c 0;\nconst NOTIFIED = 1 \u003c\u003c 1;\nconst OUTDATED = 1 \u003c\u003c 2;\nconst DISPOSED = 1 \u003c\u003c 3;\nconst HAS_ERROR = 1 \u003c\u003c 4;\nconst TRACKING = 1 \u003c\u003c 5;\n\n// A linked list node used to track dependencies (sources) and dependents (targets).\n// Also used to remember the source's last version number that the target saw.\ntype Node = {\n\t// A source whose value the target depends on.\n\t_source: Signal;\n\t_prevSource?: Node;\n\t_nextSource?: Node;\n\n\t// A target that depends on the source and should be notified when the source changes.\n\t_target: Computed | Effect;\n\t_prevTarget?: Node;\n\t_nextTarget?: Node;\n\n\t// The version number of the source that target has last seen. We use version numbers\n\t// instead of storing the source value, because source values can take arbitrary amount\n\t// of memory, and computeds could hang on to them forever because they're lazily evaluated.\n\t// Use the special value -1 to mark potentially unused but recyclable nodes.\n\t_version: number;\n\n\t// Used to remember \u0026 roll back the source's previous `._node` value when entering \u0026\n\t// exiting a new evaluation context.\n\t_rollbackNode?: Node;\n};\n\nfunction startBatch() {\n\tbatchDepth++;\n}\n\nfunction endBatch() {\n\tif (batchDepth \u003e 1) {\n\t\tbatchDepth--;\n\t\treturn;\n\t}\n\n\tlet error: unknown;\n\tlet hasError = false;\n\treconcileBatchSnapshots();\n\n\twhile (batchedEffect !== undefined) {\n\t\tlet effect: Effect | undefined = batchedEffect;\n\t\tbatchedEffect = undefined;\n\n\t\tbatchIteration++;\n\n\t\twhile (effect !== undefined) {\n\t\t\tconst next: Effect | undefined = effect._nextBatchedEffect;\n\t\t\teffect._nextBatchedEffect = undefined;\n\t\t\teffect._flags \u0026= ~NOTIFIED;\n\n\t\t\tif (!(effect._flags \u0026 DISPOSED) \u0026\u0026 needsToRecompute(effect)) {\n\t\t\t\ttry {\n\t\t\t\t\teffect._callback();\n\t\t\t\t} catch (err) {\n\t\t\t\t\tif (!hasError) {\n\t\t\t\t\t\terror = err;\n\t\t\t\t\t\thasError = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\teffect = next;\n\t\t}\n\t}\n\tbatchIteration = 0;\n\tbatchDepth--;\n\n\tif (hasError) {\n\t\tthrow error;\n\t}\n}\n\n/**\n * Combine multiple value updates into one \"commit\" at the end of the provided callback.\n *\n * Batches can be nested and changes are only flushed once the outermost batch callback\n * completes.\n *\n * Accessing a signal that has been modified within a batch will reflect its updated\n * value.\n *\n * @param fn The callback function.\n * @returns The value returned by the callback.\n */\nfunction batch\u003cT\u003e(fn: () =\u003e T): T {\n\tif (batchDepth \u003e 0) {\n\t\treturn fn();\n\t}\n\tcurrentBatchSnapshotVersion = ++batchSnapshotVersion;\n\t/*@__INLINE__**/ startBatch();\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tendBatch();\n\t}\n}\n\n// Currently evaluated computed or effect.\nlet evalContext: Computed | Effect | undefined = undefined;\n\n/**\n * Run a callback function that can access signal values without\n * subscribing to the signal updates.\n *\n * @param fn The callback function.\n * @returns The value returned by the callback.\n */\nfunction untracked\u003cT\u003e(fn: () =\u003e T): T {\n\tconst prevContext = evalContext;\n\tevalContext = undefined;\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tevalContext = prevContext;\n\t}\n}\n\n// Effects collected into a batch.\nlet batchedEffect: Effect | undefined = undefined;\nlet batchDepth = 0;\nlet batchIteration = 0;\n\ntype BatchSnapshot = {\n\t_source: Signal;\n\t_value: unknown;\n\t_version: number;\n\t_next?: BatchSnapshot;\n};\n\nlet batchSnapshotVersion = 0;\nlet currentBatchSnapshotVersion = 0;\nlet batchSnapshots: BatchSnapshot | undefined = undefined;\n\n// A global version number for signals, used for fast-pathing repeated\n// computed.peek()/computed.value calls when nothing has changed globally.\nlet globalVersion = 0;\n\nfunction recordBatchSnapshot(source: Signal) {\n\t// Only capture writes during the user-visible batch callback, not during effect flush.\n\tif (batchDepth === 0 || batchIteration !== 0) {\n\t\treturn;\n\t}\n\n\tif (source._batchSnapshotVersion !== currentBatchSnapshotVersion) {\n\t\tsource._batchSnapshotVersion = currentBatchSnapshotVersion;\n\t\tbatchSnapshots = {\n\t\t\t_source: source,\n\t\t\t_value: source._value,\n\t\t\t_version: source._version,\n\t\t\t_next: batchSnapshots,\n\t\t};\n\t}\n}\n\nfunction reconcileBatchSnapshots() {\n\tlet snapshots = batchSnapshots;\n\tbatchSnapshots = undefined;\n\n\twhile (snapshots !== undefined) {\n\t\tif (snapshots._source._value === snapshots._value) {\n\t\t\tsnapshots._source._version = snapshots._version;\n\t\t}\n\t\tsnapshots = snapshots._next;\n\t}\n}\n\nfunction addDependency(signal: Signal): Node | undefined {\n\tif (evalContext === undefined) {\n\t\treturn undefined;\n\t}\n\n\tlet node = signal._node;\n\tif (node === undefined || node._target !== evalContext) {\n\t\t/**\n\t\t * `signal` is a new dependency. Create a new dependency node, and set it\n\t\t * as the tail of the current context's dependency list. e.g:\n\t\t *\n\t\t * { A \u003c-\u003e B }\n\t\t * ↑ ↑\n\t\t * tail node (new)\n\t\t * ↓\n\t\t * { A \u003c-\u003e B \u003c-\u003e C }\n\t\t * ↑\n\t\t * tail (evalContext._sources)\n\t\t */\n\t\tnode = {\n\t\t\t_version: 0,\n\t\t\t_source: signal,\n\t\t\t_prevSource: evalContext._sources,\n\t\t\t_nextSource: undefined,\n\t\t\t_target: evalContext,\n\t\t\t_prevTarget: undefined,\n\t\t\t_nextTarget: undefined,\n\t\t\t_rollbackNode: node,\n\t\t};\n\n\t\tif (evalContext._sources !== undefined) {\n\t\t\tevalContext._sources._nextSource = node;\n\t\t}\n\t\tevalContext._sources = node;\n\t\tsignal._node = node;\n\n\t\t// Subscribe to change notifications from this dependency if we're in an effect\n\t\t// OR evaluating a computed signal that in turn has subscribers.\n\t\tif (evalContext._flags \u0026 TRACKING) {\n\t\t\tsignal._subscribe(node);\n\t\t}\n\t\treturn node;\n\t} else if (node._version === -1) {\n\t\t// `signal` is an existing dependency from a previous evaluation. Reuse it.\n\t\tnode._version = 0;\n\n\t\t/**\n\t\t * If `node` is not already the current tail of the dependency list (i.e.\n\t\t * there is a next node in the list), then make the `node` the new tail. e.g:\n\t\t *\n\t\t * { A \u003c-\u003e B \u003c-\u003e C \u003c-\u003e D }\n\t\t * ↑ ↑\n\t\t * node ┌─── tail (evalContext._sources)\n\t\t * └─────│─────┐\n\t\t * ↓ ↓\n\t\t * { A \u003c-\u003e C \u003c-\u003e D \u003c-\u003e B }\n\t\t * ↑\n\t\t * tail (evalContext._sources)\n\t\t */\n\t\tif (node._nextSource !== undefined) {\n\t\t\tnode._nextSource._prevSource = node._prevSource;\n\n\t\t\tif (node._prevSource !== undefined) {\n\t\t\t\tnode._prevSource._nextSource = node._nextSource;\n\t\t\t}\n\n\t\t\tnode._prevSource = evalContext._sources;\n\t\t\tnode._nextSource = undefined;\n\n\t\t\tevalContext._sources!._nextSource = node;\n\t\t\tevalContext._sources = node;\n\t\t}\n\n\t\t// We can assume that the currently evaluated effect / computed signal is already\n\t\t// subscribed to change notifications from `signal` if needed.\n\t\treturn node;\n\t}\n\treturn undefined;\n}\n\n//#region Signal\n\n/**\n * The base class for plain and computed signals.\n */\n//\n// A function with the same name is defined later, so we need to ignore TypeScript's\n// warning about a redeclared variable.\n//\n// The class is declared here, but later implemented with ES5-style prototypes.\n// This enables better control of the transpiled output size.\n// @ts-ignore: \"Cannot redeclare exported variable 'Signal'.\"\ndeclare class Signal\u003cT = any\u003e {\n\t/** @internal */\n\t_value: unknown;\n\n\t/**\n\t * @internal\n\t * Version numbers should always be \u003e= 0, because the special value -1 is used\n\t * by Nodes to signify potentially unused but recyclable nodes.\n\t */\n\t_version: number;\n\n\t/** @internal */\n\t_node?: Node;\n\n\t/** @internal */\n\t_targets?: Node;\n\n\t/** @internal */\n\t_batchSnapshotVersion: number;\n\n\tconstructor(value?: T, options?: SignalOptions\u003cT\u003e);\n\n\t/** @internal */\n\t_refresh(): boolean;\n\n\t/** @internal */\n\t_subscribe(node: Node): void;\n\n\t/** @internal */\n\t_unsubscribe(node: Node): void;\n\n\t/** @internal */\n\t_watched?(this: Signal\u003cT\u003e): void;\n\n\t/** @internal */\n\t_unwatched?(this: Signal\u003cT\u003e): void;\n\n\tsubscribe(fn: (value: T) =\u003e void): () =\u003e void;\n\n\tname?: string;\n\n\tvalueOf(): T;\n\n\ttoString(): string;\n\n\ttoJSON(): T;\n\n\tpeek(): T;\n\n\tbrand: typeof BRAND_SYMBOL;\n\n\tget value(): T;\n\tset value(value: T);\n}\n\nexport interface SignalOptions\u003cT = any\u003e {\n\twatched?: (this: Signal\u003cT\u003e) =\u003e void;\n\tunwatched?: (this: Signal\u003cT\u003e) =\u003e void;\n\tname?: string;\n}\n\n/** @internal */\n// A class with the same name has already been declared, so we need to ignore\n// TypeScript's warning about a redeclared variable.\n//\n// The previously declared class is implemented here with ES5-style prototypes.\n// This enables better control of the transpiled output size.\n// @ts-ignore: \"Cannot redeclare exported variable 'Signal'.\"\nfunction Signal(this: Signal, value?: unknown, options?: SignalOptions) {\n\tthis._value = value;\n\tthis._version = 0;\n\tthis._node = undefined;\n\tthis._targets = undefined;\n\tthis._batchSnapshotVersion = 0;\n\tthis._watched = options?.watched;\n\tthis._unwatched = options?.unwatched;\n\tthis.name = options?.name;\n}\n\nSignal.prototype.brand = BRAND_SYMBOL;\n\nSignal.prototype._refresh = function () {\n\treturn true;\n};\n\nSignal.prototype._subscribe = function (node) {\n\tconst targets = this._targets;\n\tif (targets !== node \u0026\u0026 node._prevTarget === undefined) {\n\t\tnode._nextTarget = targets;\n\t\tthis._targets = node;\n\n\t\tif (targets !== undefined) {\n\t\t\ttargets._prevTarget = node;\n\t\t} else {\n\t\t\tuntracked(() =\u003e {\n\t\t\t\tthis._watched?.call(this);\n\t\t\t});\n\t\t}\n\t}\n};\n\nSignal.prototype._unsubscribe = function (node) {\n\t// Only run the unsubscribe step if the signal has any subscribers to begin with.\n\tif (this._targets !== undefined) {\n\t\tconst prev = node._prevTarget;\n\t\tconst next = node._nextTarget;\n\t\tif (prev !== undefined) {\n\t\t\tprev._nextTarget = next;\n\t\t\tnode._prevTarget = undefined;\n\t\t}\n\n\t\tif (next !== undefined) {\n\t\t\tnext._prevTarget = prev;\n\t\t\tnode._nextTarget = undefined;\n\t\t}\n\n\t\tif (node === this._targets) {\n\t\t\tthis._targets = next;\n\t\t\tif (next === undefined) {\n\t\t\t\tuntracked(() =\u003e {\n\t\t\t\t\tthis._unwatched?.call(this);\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n};\n\nSignal.prototype.subscribe = function (fn) {\n\treturn effect(\n\t\t() =\u003e {\n\t\t\tconst value = this.value;\n\t\t\tconst prevContext = evalContext;\n\t\t\tevalContext = undefined;\n\t\t\ttry {\n\t\t\t\tfn(value);\n\t\t\t} finally {\n\t\t\t\tevalContext = prevContext;\n\t\t\t}\n\t\t},\n\t\t{ name: \"sub\" }\n\t);\n};\n\nSignal.prototype.valueOf = function () {\n\treturn this.value;\n};\n\nSignal.prototype.toString = function () {\n\treturn this.value + \"\";\n};\n\nSignal.prototype.toJSON = function () {\n\treturn this.value;\n};\n\nSignal.prototype.peek = function () {\n\tconst prevContext = evalContext;\n\tevalContext = undefined;\n\ttry {\n\t\treturn this.value;\n\t} finally {\n\t\tevalContext = prevContext;\n\t}\n};\n\nObject.defineProperty(Signal.prototype, \"value\", {\n\tget(this: Signal) {\n\t\tconst node = addDependency(this);\n\t\tif (node !== undefined) {\n\t\t\tnode._version = this._version;\n\t\t}\n\t\treturn this._value;\n\t},\n\tset(this: Signal, value) {\n\t\tif (value !== this._value) {\n\t\t\tif (batchIteration \u003e 100) {\n\t\t\t\tthrow new Error(\"Cycle detected\");\n\t\t\t}\n\n\t\t\trecordBatchSnapshot(this);\n\t\t\tthis._value = value;\n\t\t\tthis._version++;\n\t\t\tglobalVersion++;\n\n\t\t\t/**@__INLINE__*/ startBatch();\n\t\t\ttry {\n\t\t\t\tfor (\n\t\t\t\t\tlet node = this._targets;\n\t\t\t\t\tnode !== undefined;\n\t\t\t\t\tnode = node._nextTarget\n\t\t\t\t) {\n\t\t\t\t\tnode._target._notify();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tendBatch();\n\t\t\t}\n\t\t}\n\t},\n});\n\n/**\n * Create a new plain signal.\n *\n * @param value The initial value for the signal.\n * @returns A new signal.\n */\nexport function signal\u003cT\u003e(value: T, options?: SignalOptions\u003cT\u003e): Signal\u003cT\u003e;\nexport function signal\u003cT = undefined\u003e(): Signal\u003cT | undefined\u003e;\nexport function signal\u003cT\u003e(value?: T, options?: SignalOptions\u003cT\u003e): Signal\u003cT\u003e {\n\treturn new Signal(value, options);\n}\n\n//#endregion Signal\n\n//#region Computed\n\nfunction needsToRecompute(target: Computed | Effect): boolean {\n\t// Check the dependencies for changed values. The dependency list is already\n\t// in order of use. Therefore if multiple dependencies have changed values, only\n\t// the first used dependency is re-evaluated at this point.\n\tfor (\n\t\tlet node = target._sources;\n\t\tnode !== undefined;\n\t\tnode = node._nextSource\n\t) {\n\t\tif (\n\t\t\t// If the dependency has definitely been updated since its version number\n\t\t\t// was observed, then we need to recompute. This first check is not strictly\n\t\t\t// necessary for correctness, but allows us to skip the refresh call if the\n\t\t\t// dependency has already been updated.\n\t\t\tnode._source._version !== node._version ||\n\t\t\t// Refresh the dependency. If there's something blocking the refresh (e.g. a\n\t\t\t// dependency cycle), then we need to recompute.\n\t\t\t!node._source._refresh() ||\n\t\t\t// If the dependency got a new version after the refresh, then we need to recompute.\n\t\t\tnode._source._version !== node._version\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t}\n\t// If none of the dependencies have changed values since last recompute then\n\t// there's no need to recompute.\n\treturn false;\n}\n\nfunction prepareSources(target: Computed | Effect) {\n\t/**\n\t * 1. Mark all current sources as re-usable nodes (version: -1)\n\t * 2. Set a rollback node if the current node is being used in a different context\n\t * 3. Point 'target._sources' to the tail of the doubly-linked list, e.g:\n\t *\n\t * { undefined \u003c- A \u003c-\u003e B \u003c-\u003e C -\u003e undefined }\n\t * ↑ ↑\n\t * │ └──────┐\n\t * target._sources = A; (node is head) │\n\t * ↓ │\n\t * target._sources = C; (node is tail) ─┘\n\t */\n\tfor (\n\t\tlet node = target._sources;\n\t\tnode !== undefined;\n\t\tnode = node._nextSource\n\t) {\n\t\tconst rollbackNode = node._source._node;\n\t\tif (rollbackNode !== undefined) {\n\t\t\tnode._rollbackNode = rollbackNode;\n\t\t}\n\t\tnode._source._node = node;\n\t\tnode._version = -1;\n\n\t\tif (node._nextSource === undefined) {\n\t\t\ttarget._sources = node;\n\t\t\tbreak;\n\t\t}\n\t}\n}\n\nfunction cleanupSources(target: Computed | Effect) {\n\tlet node = target._sources;\n\tlet head: Node | undefined = undefined;\n\n\t/**\n\t * At this point 'target._sources' points to the tail of the doubly-linked list.\n\t * It contains all existing sources + new sources in order of use.\n\t * Iterate backwards until we find the head node while dropping old dependencies.\n\t */\n\twhile (node !== undefined) {\n\t\tconst prev = node._prevSource;\n\n\t\t/**\n\t\t * The node was not re-used, unsubscribe from its change notifications and remove itself\n\t\t * from the doubly-linked list. e.g:\n\t\t *\n\t\t * { A \u003c-\u003e B \u003c-\u003e C }\n\t\t * ↓\n\t\t * { A \u003c-\u003e C }\n\t\t */\n\t\tif (node._version === -1) {\n\t\t\tnode._source._unsubscribe(node);\n\n\t\t\tif (prev !== undefined) {\n\t\t\t\tprev._nextSource = node._nextSource;\n\t\t\t}\n\t\t\tif (node._nextSource !== undefined) {\n\t\t\t\tnode._nextSource._prevSource = prev;\n\t\t\t}\n\t\t} else {\n\t\t\t/**\n\t\t\t * The new head is the last node seen which wasn't removed/unsubscribed\n\t\t\t * from the doubly-linked list. e.g:\n\t\t\t *\n\t\t\t * { A \u003c-\u003e B \u003c-\u003e C }\n\t\t\t * ↑ ↑ ↑\n\t\t\t * │ │ └ head = node\n\t\t\t * │ └ head = node\n\t\t\t * └ head = node\n\t\t\t */\n\t\t\thead = node;\n\t\t}\n\n\t\tnode._source._node = node._rollbackNode;\n\t\tif (node._rollbackNode !== undefined) {\n\t\t\tnode._rollbackNode = undefined;\n\t\t}\n\n\t\tnode = prev;\n\t}\n\n\ttarget._sources = head;\n}\n\n/**\n * The base class for computed signals.\n */\ndeclare class Computed\u003cT = any\u003e extends Signal\u003cT\u003e {\n\t_fn: () =\u003e T;\n\t_sources?: Node;\n\t_globalVersion: number;\n\t_flags: number;\n\n\tconstructor(fn: () =\u003e T, options?: SignalOptions\u003cT\u003e);\n\n\t_notify(): void;\n\tget value(): T;\n}\n\n/** @internal */\nfunction Computed(this: Computed, fn: () =\u003e unknown, options?: SignalOptions) {\n\tSignal.call(this, undefined);\n\n\tthis._fn = fn;\n\tthis._sources = undefined;\n\tthis._globalVersion = globalVersion - 1;\n\tthis._flags = OUTDATED;\n\tthis._watched = options?.watched;\n\tthis._unwatched = options?.unwatched;\n\tthis.name = options?.name;\n}\n\nComputed.prototype = new Signal() as Computed;\n\nComputed.prototype._refresh = function () {\n\tthis._flags \u0026= ~NOTIFIED;\n\n\tif (this._flags \u0026 RUNNING) {\n\t\treturn false;\n\t}\n\n\t// If this computed signal has subscribed to updates from its dependencies\n\t// (TRACKING flag set) and none of them have notified about changes (OUTDATED\n\t// flag not set), then the computed value can't have changed.\n\tif ((this._flags \u0026 (OUTDATED | TRACKING)) === TRACKING) {\n\t\treturn true;\n\t}\n\tthis._flags \u0026= ~OUTDATED;\n\n\tif (this._globalVersion === globalVersion) {\n\t\treturn true;\n\t}\n\tthis._globalVersion = globalVersion;\n\n\t// Mark this computed signal running before checking the dependencies for value\n\t// changes, so that the RUNNING flag can be used to notice cyclical dependencies.\n\tthis._flags |= RUNNING;\n\tif (this._version \u003e 0 \u0026\u0026 !needsToRecompute(this)) {\n\t\tthis._flags \u0026= ~RUNNING;\n\t\treturn true;\n\t}\n\n\tconst prevContext = evalContext;\n\ttry {\n\t\tprepareSources(this);\n\t\tevalContext = this;\n\t\tconst value = this._fn();\n\t\tif (\n\t\t\tthis._flags \u0026 HAS_ERROR ||\n\t\t\tthis._value !== value ||\n\t\t\tthis._version === 0\n\t\t) {\n\t\t\tthis._value = value;\n\t\t\tthis._flags \u0026= ~HAS_ERROR;\n\t\t\tthis._version++;\n\t\t}\n\t} catch (err) {\n\t\tthis._value = err;\n\t\tthis._flags |= HAS_ERROR;\n\t\tthis._version++;\n\t}\n\tevalContext = prevContext;\n\tcleanupSources(this);\n\tthis._flags \u0026= ~RUNNING;\n\treturn true;\n};\n\nComputed.prototype._subscribe = function (node) {\n\tif (this._targets === undefined) {\n\t\tthis._flags |= OUTDATED | TRACKING;\n\n\t\t// A computed signal subscribes lazily to its dependencies when it\n\t\t// gets its first subscriber.\n\t\tfor (\n\t\t\tlet node = this._sources;\n\t\t\tnode !== undefined;\n\t\t\tnode = node._nextSource\n\t\t) {\n\t\t\tnode._source._subscribe(node);\n\t\t}\n\t}\n\tSignal.prototype._subscribe.call(this, node);\n};\n\nComputed.prototype._unsubscribe = function (node) {\n\t// Only run the unsubscribe step if the computed signal has any subscribers.\n\tif (this._targets !== undefined) {\n\t\tSignal.prototype._unsubscribe.call(this, node);\n\n\t\t// Computed signal unsubscribes from its dependencies when it loses its last subscriber.\n\t\t// This makes it possible for unreferences subgraphs of computed signals to get garbage collected.\n\t\tif (this._targets === undefined) {\n\t\t\tthis._flags \u0026= ~TRACKING;\n\n\t\t\tfor (\n\t\t\t\tlet node = this._sources;\n\t\t\t\tnode !== undefined;\n\t\t\t\tnode = node._nextSource\n\t\t\t) {\n\t\t\t\tnode._source._unsubscribe(node);\n\t\t\t}\n\t\t}\n\t}\n};\n\nComputed.prototype._notify = function () {\n\tif (!(this._flags \u0026 NOTIFIED)) {\n\t\tthis._flags |= OUTDATED | NOTIFIED;\n\n\t\tfor (\n\t\t\tlet node = this._targets;\n\t\t\tnode !== undefined;\n\t\t\tnode = node._nextTarget\n\t\t) {\n\t\t\tnode._target._notify();\n\t\t}\n\t}\n};\n\nObject.defineProperty(Computed.prototype, \"value\", {\n\tget(this: Computed) {\n\t\tif (this._flags \u0026 RUNNING) {\n\t\t\tthrow new Error(\"Cycle detected\");\n\t\t}\n\t\tconst node = addDependency(this);\n\t\tthis._refresh();\n\t\tif (node !== undefined) {\n\t\t\tnode._version = this._version;\n\t\t}\n\t\tif (this._flags \u0026 HAS_ERROR) {\n\t\t\tthrow this._value;\n\t\t}\n\t\treturn this._value;\n\t},\n});\n\n/**\n * An interface for read-only signals.\n */\ninterface ReadonlySignal\u003cT = any\u003e {\n\treadonly value: T;\n\tpeek(): T;\n\n\tsubscribe(fn: (value: T) =\u003e void): () =\u003e void;\n\tvalueOf(): T;\n\ttoString(): string;\n\ttoJSON(): T;\n\tbrand: typeof BRAND_SYMBOL;\n}\n\n/**\n * Create a new signal that is computed based on the values of other signals.\n *\n * The returned computed signal is read-only, and its value is automatically\n * updated when any signals accessed from within the callback function change.\n *\n * @param fn The effect callback.\n * @returns A new read-only signal.\n */\nfunction computed\u003cT\u003e(\n\tfn: () =\u003e T,\n\toptions?: SignalOptions\u003cT\u003e\n): ReadonlySignal\u003cT\u003e {\n\treturn new Computed(fn, options);\n}\n\n//#endregion Computed\n\n//#region Effect\n\nfunction cleanupEffect(effect: Effect) {\n\tconst cleanup = effect._cleanup;\n\teffect._cleanup = undefined;\n\n\tif (typeof cleanup === \"function\") {\n\t\t/*@__INLINE__**/ startBatch();\n\n\t\t// Run cleanup functions always outside of any context.\n\t\tconst prevContext = evalContext;\n\t\tevalContext = undefined;\n\t\ttry {\n\t\t\tcleanup();\n\t\t} catch (err) {\n\t\t\teffect._flags \u0026= ~RUNNING;\n\t\t\teffect._flags |= DISPOSED;\n\t\t\tdisposeEffect(effect);\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tevalContext = prevContext;\n\t\t\tendBatch();\n\t\t}\n\t}\n}\n\nfunction disposeEffect(effect: Effect) {\n\tfor (\n\t\tlet node = effect._sources;\n\t\tnode !== undefined;\n\t\tnode = node._nextSource\n\t) {\n\t\tnode._source._unsubscribe(node);\n\t}\n\teffect._fn = undefined;\n\teffect._sources = undefined;\n\n\tcleanupEffect(effect);\n}\n\nfunction endEffect(this: Effect, prevContext?: Computed | Effect) {\n\tif (evalContext !== this) {\n\t\tthrow new Error(\"Out-of-order effect\");\n\t}\n\tcleanupSources(this);\n\tevalContext = prevContext;\n\n\tthis._flags \u0026= ~RUNNING;\n\tif (this._flags \u0026 DISPOSED) {\n\t\tdisposeEffect(this);\n\t}\n\tendBatch();\n}\n\ntype EffectFn =\n\t| ((this: { dispose: () =\u003e void }) =\u003e void | (() =\u003e void))\n\t| (() =\u003e void | (() =\u003e void));\n\n// Avoid hard-requiring the ESNext.Disposable lib in consuming tsconfigs.\n// When `Symbol.dispose` is available, this becomes a symbol-keyed disposer type.\ntype DisposeSymbol = typeof Symbol extends { readonly dispose: infer TDispose }\n\t? TDispose\n\t: never;\ntype DisposableLike = {\n\t[K in DisposeSymbol \u0026 PropertyKey]: () =\u003e void;\n};\ntype DisposeFn = (() =\u003e void) \u0026 DisposableLike;\n\n/**\n * The base class for reactive effects.\n */\ndeclare class Effect {\n\t_fn?: EffectFn;\n\t_cleanup?: () =\u003e void;\n\t_sources?: Node;\n\t_nextBatchedEffect?: Effect;\n\t_flags: number;\n\t_debugCallback?: () =\u003e void;\n\tname?: string;\n\n\tconstructor(fn: EffectFn, options?: EffectOptions);\n\n\t_callback(): void;\n\t_start(): () =\u003e void;\n\t_notify(): void;\n\t_dispose(): void;\n\tdispose(): void;\n}\n\nexport interface EffectOptions {\n\tname?: string;\n}\n\nlet capturedEffects: Effect[] | undefined;\n\n/** @internal */\nfunction Effect(this: Effect, fn: EffectFn, options?: EffectOptions) {\n\tthis._fn = fn;\n\tthis._cleanup = undefined;\n\tthis._sources = undefined;\n\tthis._nextBatchedEffect = undefined;\n\tthis._flags = TRACKING;\n\tthis.name = options?.name;\n\n\tif (capturedEffects) {\n\t\tcapturedEffects.push(this);\n\t}\n}\n\nEffect.prototype._callback = function () {\n\tconst finish = this._start();\n\ttry {\n\t\tif (this._flags \u0026 DISPOSED) return;\n\t\tif (this._fn === undefined) return;\n\n\t\tconst cleanup = this._fn();\n\t\tif (typeof cleanup === \"function\") {\n\t\t\tthis._cleanup = cleanup;\n\t\t}\n\t} finally {\n\t\tfinish();\n\t}\n};\n\nEffect.prototype._start = function () {\n\tif (this._flags \u0026 RUNNING) {\n\t\tthrow new Error(\"Cycle detected\");\n\t}\n\tthis._flags |= RUNNING;\n\tthis._flags \u0026= ~DISPOSED;\n\tcleanupEffect(this);\n\tprepareSources(this);\n\n\t/*@__INLINE__**/ startBatch();\n\tconst prevContext = evalContext;\n\tevalContext = this;\n\treturn endEffect.bind(this, prevContext);\n};\n\nEffect.prototype._notify = function () {\n\tif (!(this._flags \u0026 NOTIFIED)) {\n\t\tthis._flags |= NOTIFIED;\n\t\tthis._nextBatchedEffect = batchedEffect;\n\t\tbatchedEffect = this;\n\t}\n};\n\nEffect.prototype._dispose = function () {\n\tthis._flags |= DISPOSED;\n\n\tif (!(this._flags \u0026 RUNNING)) {\n\t\tdisposeEffect(this);\n\t}\n};\n\nEffect.prototype.dispose = function () {\n\tthis._dispose();\n};\n/**\n * Create an effect to run arbitrary code in response to signal changes.\n *\n * An effect tracks which signals are accessed within the given callback\n * function `fn`, and re-runs the callback when those signals change.\n *\n * The callback may return a cleanup function. The cleanup function gets\n * run once, either when the callback is next called or when the effect\n * gets disposed, whichever happens first.\n *\n * @param fn The effect callback.\n * @returns A function for disposing the effect.\n */\nfunction effect(fn: EffectFn, options?: EffectOptions): DisposeFn {\n\tconst effect = new Effect(fn, options);\n\ttry {\n\t\teffect._callback();\n\t} catch (err) {\n\t\teffect._dispose();\n\t\tthrow err;\n\t}\n\t// Return a bound function instead of a wrapper like `() =\u003e effect._dispose()`,\n\t// because bound functions seem to be just as fast and take up a lot less memory.\n\tconst dispose = effect._dispose.bind(effect);\n\t(dispose as any)[Symbol.dispose] = dispose;\n\treturn dispose as DisposeFn;\n}\n\n//#endregion Effect\n\n//#region Action\n\nfunction action\u003cTArgs extends unknown[], TReturn\u003e(\n\tfn: (...args: TArgs) =\u003e TReturn\n): (...args: TArgs) =\u003e TReturn {\n\treturn function actionWrapper(this: unknown, ...args: TArgs) {\n\t\treturn batch(() =\u003e untracked(() =\u003e fn.apply(this, args)));\n\t};\n}\n\n//#endregion Action\n\n//#region createModel\n\n/** Models should only contain signals, actions, and nested objects containing only signals and actions. */\ntype ValidateModel\u003cTModel\u003e = {\n\t[Key in keyof TModel]: TModel[Key] extends ReadonlySignal\u003cunknown\u003e\n\t\t? TModel[Key]\n\t\t: TModel[Key] extends (...args: any[]) =\u003e any\n\t\t\t? TModel[Key]\n\t\t\t: TModel[Key] extends object\n\t\t\t\t? ValidateModel\u003cTModel[Key]\u003e\n\t\t\t\t: `Property ${Key extends string ? `'${Key}' ` : \"\"}is not a Signal, Action, or an object that contains only Signals and Actions.`;\n};\n\nexport type Model\u003cTModel\u003e = ValidateModel\u003cTModel\u003e \u0026 DisposableLike;\n\nexport type ModelFactory\u003cTModel, TFactoryArgs extends any[] = []\u003e = (\n\t...args: TFactoryArgs\n) =\u003e ValidateModel\u003cTModel\u003e;\nexport type ModelConstructor\u003cTModel, TFactoryArgs extends any[] = []\u003e = new (\n\t...args: TFactoryArgs\n) =\u003e Model\u003cTModel\u003e;\n\n/**\n * The public types for ModelConstructor require using `new` to help\n * disambiguate the function passed into `createModel` and the returned\n * constructor function. It is easier to say that `createModel` accepts\n * a factory and returns a class, then to say it accepts a factory and\n * returns a factory. In other words, this example:\n *\n * ```ts\n * const PersonModel = createModel((name: string) =\u003e ({ ... }));\n * const person = new PersonModel(\"John\");\n * ```\n *\n * is easier to understand than this example:\n *\n * ```ts\n * const createPerson = createModel((name: string) =\u003e ({ ... }));\n * const person = createPerson(\"John\");\n * ```\n *\n * However, internally we implement `createModel` to return a function\n * that can be called without `new` for simplicity. To bridge the gap\n * between the public types and the internal implementation, we define\n * this internal interface that extends the public interface but also\n * allows calling without `new`.\n *\n * This pattern is used by the Preact \u0026 React adapters to make instantiating\n * a model or a function that returns a model easier.\n *\n * @internal\n */\ninterface InternalModelConstructor\u003c\n\tTModel,\n\tTFactoryArgs extends any[],\n\u003e extends ModelConstructor\u003cTModel, TFactoryArgs\u003e {\n\t(...args: TFactoryArgs): Model\u003cTModel\u003e;\n}\n\nfunction startCapturingEffects(): () =\u003e Effect[] | undefined {\n\tlet prevCapturedEffects = capturedEffects;\n\tcapturedEffects = [];\n\n\treturn function stopCapturingEffects() {\n\t\tlet modelEffects = capturedEffects;\n\t\tif (capturedEffects \u0026\u0026 prevCapturedEffects) {\n\t\t\tprevCapturedEffects = prevCapturedEffects.concat(capturedEffects);\n\t\t}\n\n\t\tcapturedEffects = prevCapturedEffects;\n\n\t\treturn modelEffects;\n\t};\n}\n\nconst wrapInAction = (value: Record\u003cstring, unknown\u003e) =\u003e {\n\tfor (const key in value) {\n\t\tconst val = value[key];\n\t\tif (typeof val === \"function\") {\n\t\t\tvalue[key] = action(val as (...args: unknown[]) =\u003e unknown);\n\t\t} else if (typeof val === \"object\" \u0026\u0026 val !== null \u0026\u0026 !(\"brand\" in val)) {\n\t\t\t// Recursively wrap nested object properties in actions. This allows users to write\n\t\t\t// nested models without worrying about wrapping their functions in `action`.\n\t\t\twrapInAction(val as Record\u003cstring, unknown\u003e);\n\t\t}\n\t}\n};\n\nfunction createModel\u003cTModel, TFactoryArgs extends any[] = []\u003e(\n\tmodelFactory: ModelFactory\u003cTModel, TFactoryArgs\u003e\n): ModelConstructor\u003cTModel, TFactoryArgs\u003e {\n\treturn function SignalModel(...args: TFactoryArgs): Model\u003cTModel\u003e {\n\t\tlet modelEffects: Effect[] | undefined;\n\t\tlet model: Model\u003cTModel\u003e;\n\n\t\tconst stopCapturingEffects = startCapturingEffects();\n\t\ttry {\n\t\t\tmodel = modelFactory(...args) as Model\u003cTModel\u003e;\n\t\t} catch (err) {\n\t\t\t// Drop any captured effects on error. Errors from nested models will bubble\n\t\t\t// up here and recursively reset `capturedEffects` to `undefined` preventing\n\t\t\t// any captured effects from leaking\n\t\t\tcapturedEffects = undefined;\n\t\t\tthrow err;\n\t\t} finally {\n\t\t\tmodelEffects = stopCapturingEffects();\n\t\t}\n\n\t\twrapInAction(model);\n\n\t\tmodel[Symbol.dispose] = action(function disposeModel() {\n\t\t\tif (modelEffects) {\n\t\t\t\tfor (let i = 0; i \u003c modelEffects.length; i++) {\n\t\t\t\t\tmodelEffects[i].dispose();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmodelEffects = undefined;\n\t\t});\n\n\t\treturn model;\n\t} as InternalModelConstructor\u003cTModel, TFactoryArgs\u003e;\n}\n\n//#endregion createModel\n\nexport {\n\tcomputed,\n\teffect,\n\tbatch,\n\tuntracked,\n\taction,\n\tcreateModel,\n\tSignal,\n\tReadonlySignal,\n\tEffect,\n\tComputed,\n};\n"],"version":3}
···11+/* esm.sh - @preact/signals@2.9.0 */
22+import{Component as U,options as m,isValidElement as x,Fragment as C}from"preact";import{useMemo as y,useRef as A,useEffect as S}from"preact/hooks";import{effect as l,Signal as k,computed as $,signal as w,batch as N}from"../../../signals-core@1.14.1/es2022/signals-core.mjs";import{Signal as X,action as Y,batch as Z,computed as ee,createModel as ie,effect as te,signal as ne,untracked as re}from"../../../signals-core@1.14.1/es2022/signals-core.mjs";var b,g,d,R=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__,T=[],q=[];l(function(){b=this.N})();function s(i,e){m[i]=e.bind(null,m[i]||function(){})}function h(i){if(d){var e=d;d=void 0,e()}d=i&&i.S()}function F(i){var e=this,t=i.data,n=V(t);n.value=t;var f=y(function(){for(var o=e,a=e.__v;a=a.__;)if(a.__c){a.__c.__$f|=4;break}var _=$(function(){var v=n.value.value;return v===0?0:v===!0?"":v||""}),c=$(function(){return!Array.isArray(_.value)&&!x(_.value)}),p=l(function(){if(this.N=E,c.value){var v=_.value;o.__v&&o.__v.__e&&o.__v.__e.nodeType===3&&(o.__v.__e.data=v)}}),M=e.__$u.d;return e.__$u.d=function(){p(),M.call(this)},[c,_]},[]),r=f[0],u=f[1];return r.value?u.peek():u.value}F.displayName="ReactiveTextNode";Object.defineProperties(k.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:F},props:{configurable:!0,get:function(){var i=this;return{data:{get value(){return i.value}}}}},__b:{configurable:!0,value:1}});s("__b",function(i,e){if(typeof e.type=="string"){var t,n=e.props;for(var f in n)if(f!=="children"){var r=n[f];r instanceof k&&(t||(e.__np=t={}),t[f]=r,n[f]=r.peek())}}i(e)});s("__r",function(i,e){if(i(e),e.type!==C){h();var t,n=e.__c;n&&(n.__$f&=-2,(t=n.__$u)===void 0&&(n.__$u=t=(function(f,r){var u;return l(function(){u=this},{name:r}),u.c=f,u})(function(){var f;R&&((f=t.y)==null||f.call(t)),n.__$f|=1,n.setState({})},typeof e.type=="function"?e.type.displayName||e.type.name:""))),g=n,h(t)}});s("__e",function(i,e,t,n){h(),g=void 0,i(e,t,n)});s("diffed",function(i,e){h(),g=void 0;var t;if(typeof e.type=="string"&&(t=e.__e)){var n=e.__np,f=e.props;if(n){var r=t.U;if(r)for(var u in r){var o=r[u];o!==void 0&&!(u in n)&&(o.d(),r[u]=void 0)}else r={},t.U=r;for(var a in n){var _=r[a],c=n[a];_===void 0?(_=O(t,a,c),r[a]=_):_.o(c,f)}for(var p in n)f[p]=n[p]}}i(e)});function O(i,e,t,n){var f=e in i&&i.ownerSVGElement===void 0,r=w(t),u=t.peek();return{o:function(o,a){r.value=o,u=o.peek()},d:l(function(){this.N=E;var o=r.value.value;u!==o?(u=void 0,f?i[e]=o:o!=null&&(o!==!1||e[4]==="-")?i.setAttribute(e,o):i.removeAttribute(e)):u=void 0})}}s("unmount",function(i,e){if(typeof e.type=="string"){var t=e.__e;if(t){var n=t.U;if(n){t.U=void 0;for(var f in n){var r=n[f];r&&r.d()}}}e.__np=void 0}else{var u=e.__c;if(u){var o=u.__$u;o&&(u.__$u=void 0,o.d())}}i(e)});s("__h",function(i,e,t,n){(n<3||n===9)&&(e.__$f|=2),i(e,t,n)});U.prototype.shouldComponentUpdate=function(i,e){if(this.__R)return!0;var t=this.__$u,n=t&&t.s!==void 0;for(var f in e)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var r=2&this.__$f;if(!(n||r||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var u in i)if(u!=="__source"&&i[u]!==this.props[u])return!0;for(var o in this.props)if(!(o in i))return!0;return!1};function V(i,e){return y(function(){return w(i,e)},[])}function H(i,e){var t=A(i);return t.current=i,g.__$f|=4,y(function(){return $(function(){return t.current()},e)},[])}var G=typeof requestAnimationFrame>"u"?setTimeout:function(i){var e=function(){clearTimeout(t),cancelAnimationFrame(n),i()},t=setTimeout(e,35),n=requestAnimationFrame(e)},L=function(i){queueMicrotask(function(){queueMicrotask(i)})};function P(){N(function(){for(var i;i=T.shift();)b.call(i)})}function j(){T.push(this)===1&&(m.requestAnimationFrame||G)(P)}function D(){N(function(){for(var i;i=q.shift();)b.call(i)})}function E(){q.push(this)===1&&(m.requestAnimationFrame||L)(D)}function J(i,e){var t=A(i);t.current=i,S(function(){return l(function(){return this.N=j,t.current()},e)},[])}function K(i){var e=y(function(){return i()},[]);return S(function(){return e[Symbol.dispose]},[e]),e}export{X as Signal,Y as action,Z as batch,ee as computed,ie as createModel,te as effect,ne as signal,re as untracked,H as useComputed,K as useModel,V as useSignal,J as useSignalEffect};
33+//# sourceMappingURL=./signals.mjs.map
···11+{"mappings":";ibAyCA,IAOIA,EAiBAC,EACAC,EAzBEC,EACa,OAAXC,OAAW,KAAXA,CAAAA,CAA4BA,OAAOC,4BAO1CC,EAA8B,CAAA,EAC9BC,EAA0B,CAAA,EAK3BC,EAAO,UAAA,CACNR,EAAYS,KAAKC,CAClB,CAAA,EAFAF,EAKA,SAASG,EAA6BC,EAAaC,EAAAA,CAElDC,EAAQF,CAAAA,EAAYC,EAAOE,KAAK,KAAMD,EAAQF,CAAAA,GAAc,UAAA,CAAO,CAAA,CACpE,CAKA,SAASI,EAAkBC,EAAAA,CAE1B,GAAIf,EAAc,CACjB,IAAMgB,EAAShB,EACfA,EAAAA,OACAgB,EAAAA,CACD,CAEAhB,EAAee,GAAWA,EAAQE,EAAAA,CACnC,CA2BA,SAASC,EAAWC,EAAAA,CAAqDC,IAAAA,EAAxBb,KAAAc,EAAIF,EAAJE,KAK1CC,EAAgBC,EAAUF,CAAAA,EAChCC,EAAcE,MAAQH,EAEtB,IAAAI,EAAoBC,EAAQ,UAAA,CAI3B,QAHIC,EAAOP,EAEPQ,EAAIR,EAAKS,IACLD,EAAIA,EAAEE,IACb,GAAIF,EAAEG,IAAK,CACVH,EAAEG,IAAIC,MAxEY,EAyElB,KACD,CAGD,IAAMC,EAAgBC,EAAS,UAAA,CAC9B,IAAIC,EAAIb,EAAcE,MAAMA,MAC5B,OAAOW,IAAM,EAAI,EAAIA,IAAJ,GAAiB,GAAKA,GAAK,EAC7C,CAAA,EAEMC,EAASF,EACd,UAAA,CAAA,MAAA,CACEG,MAAMC,QAAQL,EAAcT,KAAAA,GAAAA,CAC5Be,EAAeN,EAAcT,KAAAA,CAAM,CAAA,EAIhCgB,EAAUlC,EAAO,UAAA,CAItB,GAHAC,K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OAAO1H,EAAO,UAAA,CACbC,YAAKC,EAAUoH,EACRb,EAASJ,QAAAA,CACjB,EAAG/F,CAAAA,CACJ,EAAG,CAAA,CAAA,CACJ,CAUgB,SAAAqH,EACfC,EAAAA,CAMA,IAAMR,EAAOhG,EAAQ,UAAA,CAAA,OAAOwG,EAAAA,CAA6B,EAAE,CAAA,CAAA,EAC3DF,OAAAA,EAAU,UAAA,CAAM,OAAAN,EAAKS,OAAO3F,OAAAA,CAAQ,EAAE,CAACkF,CAAAA,CAAAA,EAChCA,CACR","names":["oldNotify","currentComponent","finishUpdate","DEVTOOLS_ENABLED","window","__PREACT_SIGNALS_DEVTOOLS__","effectsQueue","domQueue","effect","this","_notify","hook","hookName","hookFn","options","bind","setCurrentUpdater","updater","finish","_start","SignalValue","_ref","_this","data","currentSignal","useSignal","value","_useMemo","useMemo","self","v","__v","__","__c","_updateFlags","wrappedSignal","computed","s","isText","Array","isArray","isValidElement","dispose","notifyDomUpdates","__e","nodeType","oldDispose","_updater","_dispose","call","peek","displayName","Object","defineProperties","Signal","prototype","constructor","configurable","undefined","type","props","get","__b","old","vnode","signalProps","i","__np","Fragment","component","update","name","_callback","_updater$_debugCallba","_debugCallback","setState","error","oldVNode","dom","renderedProps","updaters","_updaters","prop","signal","createPropUpdater","_update","propSignal","setAsProperty","ownerSVGElement","changeSignal","lastRenderedValue","newSignal","newProps","setAttribute","removeAttribute","index","Component","shouldComponentUpdate","state","__R","hasSignals","_sources","__f","u","hasHooksState","useComputed","compute","$compute","useRef","current","deferEffects","requestAnimationFrame","setTimeout","callback","done","clearTimeout","timeout","cancelAnimationFrame","raf","deferDomUpdates","cb","queueMicrotask","flushEffects","batch","inst","shift","notifyEffects","push","flushDomUpdates","useSignalEffect","useEffect","useModel","factory","Symbol"],"sources":["../esm/npm/@preact/signals@2.9.0/node_modules/@preact/signals/src/index.ts"],"sourcesContent":["import { options, Component, isValidElement, Fragment } from \"preact\";\nimport { useRef, useMemo, useEffect } from \"preact/hooks\";\nimport {\n\tsignal,\n\tcomputed,\n\tbatch,\n\teffect,\n\taction,\n\tcreateModel,\n\ttype Model,\n\ttype ModelConstructor,\n\tSignal,\n\ttype ReadonlySignal,\n\tuntracked,\n\tSignalOptions,\n\tEffectOptions,\n} from \"@preact/signals-core\";\nimport {\n\tVNode,\n\tOptionsTypes,\n\tHookFn,\n\tEffect,\n\tPropertyUpdater,\n\tAugmentedComponent,\n\tAugmentedElement as Element,\n} from \"./internal\";\n\nexport {\n\tsignal,\n\tcomputed,\n\tbatch,\n\teffect,\n\taction,\n\ttype Model,\n\ttype ModelConstructor,\n\tcreateModel,\n\tSignal,\n\ttype ReadonlySignal,\n\tuntracked,\n};\n\nconst DEVTOOLS_ENABLED =\n\ttypeof window !== \"undefined\" \u0026\u0026 !!window.__PREACT_SIGNALS_DEVTOOLS__;\n\nconst HAS_PENDING_UPDATE = 1 \u003c\u003c 0;\nconst HAS_HOOK_STATE = 1 \u003c\u003c 1;\nconst HAS_COMPUTEDS = 1 \u003c\u003c 2;\n\nlet oldNotify: (this: Effect) =\u003e void,\n\teffectsQueue: Array\u003cEffect\u003e = [],\n\tdomQueue: Array\u003cEffect\u003e = [];\n\n// Capture the original `Effect.prototype._notify` method so that we can install\n// custom `._notify`s for each different use-case but still call the original\n// implementation in the end. Dispose the temporary effect immediately afterwards.\neffect(function (this: Effect) {\n\toldNotify = this._notify;\n})();\n\n// Install a Preact options hook\nfunction hook\u003cT extends OptionsTypes\u003e(hookName: T, hookFn: HookFn\u003cT\u003e) {\n\t// @ts-ignore-next-line private options hooks usage\n\toptions[hookName] = hookFn.bind(null, options[hookName] || (() =\u003e {}));\n}\n\nlet currentComponent: AugmentedComponent | undefined;\nlet finishUpdate: (() =\u003e void) | undefined;\n\nfunction setCurrentUpdater(updater?: Effect) {\n\t// end tracking for the current update:\n\tif (finishUpdate) {\n\t\tconst finish = finishUpdate;\n\t\tfinishUpdate = undefined;\n\t\tfinish();\n\t}\n\t// start tracking the new update:\n\tfinishUpdate = updater \u0026\u0026 updater._start();\n}\n\nfunction createUpdater(update: () =\u003e void, name: string) {\n\tlet updater!: Effect;\n\teffect(\n\t\tfunction (this: Effect) {\n\t\t\tupdater = this;\n\t\t},\n\t\t{ name }\n\t);\n\tupdater._callback = update;\n\treturn updater;\n}\n\n/** @todo This may be needed for complex prop value detection. */\n// function isSignalValue(value: any): value is Signal {\n// \tif (typeof value !== \"object\" || value == null) return false;\n// \tif (value instanceof Signal) return true;\n// \t// @TODO: uncomment this when we land Reactive (ideally behind a brand check)\n// \t// for (let i in value) if (value[i] instanceof Signal) return true;\n// \treturn false;\n// }\n\n/**\n * A wrapper component that renders a Signal directly as a Text node.\n * @todo: in Preact 11, just decorate Signal with `type:null`\n */\nfunction SignalValue(this: AugmentedComponent, { data }: { data: Signal }) {\n\t// hasComputeds.add(this);\n\n\t// Store the props.data signal in another signal so that\n\t// passing a new signal reference re-runs the text computed:\n\tconst currentSignal = useSignal(data);\n\tcurrentSignal.value = data;\n\n\tconst [isText, s] = useMemo(() =\u003e {\n\t\tlet self = this;\n\t\t// mark the parent component as having computeds so it gets optimized\n\t\tlet v = this.__v;\n\t\twhile ((v = v.__!)) {\n\t\t\tif (v.__c) {\n\t\t\t\tv.__c._updateFlags |= HAS_COMPUTEDS;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tconst wrappedSignal = computed(() =\u003e {\n\t\t\tlet s = currentSignal.value.value;\n\t\t\treturn s === 0 ? 0 : s === true ? \"\" : s || \"\";\n\t\t});\n\n\t\tconst isText = computed(\n\t\t\t() =\u003e\n\t\t\t\t!Array.isArray(wrappedSignal.value) \u0026\u0026\n\t\t\t\t!isValidElement(wrappedSignal.value)\n\t\t);\n\t\t// Update text nodes directly without rerendering when the new value\n\t\t// is also text.\n\t\tconst dispose = effect(function (this: Effect) {\n\t\t\tthis._notify = notifyDomUpdates;\n\n\t\t\t// Subscribe to wrappedSignal updates only when its values are text...\n\t\t\tif (isText.value) {\n\t\t\t\t// ...but regardless of `self.base`'s current value, as it can be\n\t\t\t\t// undefined before mounting or a non-text node. In both of those cases\n\t\t\t\t// the update gets handled by a full rerender.\n\t\t\t\tconst value = wrappedSignal.value;\n\t\t\t\tif (self.__v \u0026\u0026 self.__v.__e \u0026\u0026 self.__v.__e.nodeType === 3) {\n\t\t\t\t\t(self.__v.__e as Text).data = value;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// Piggyback this._updater's disposal to ensure that the text updater effect\n\t\t// above also gets disposed on unmount.\n\t\tconst oldDispose = this._updater!._dispose;\n\t\tthis._updater!._dispose = function () {\n\t\t\tdispose();\n\t\t\toldDispose.call(this);\n\t\t};\n\n\t\treturn [isText, wrappedSignal];\n\t}, []);\n\n\t// Rerender the component whenever `data.value` changes from a VNode\n\t// to another VNode, from text to a VNode, or from a VNode to text.\n\t// That is, everything else except text-to-text updates.\n\t//\n\t// This also ensures that the backing DOM node types gets updated to\n\t// text nodes and back when needed.\n\t//\n\t// For text-to-text updates, `.peek()` is used to skip full rerenders,\n\t// leaving them to the optimized path above.\n\treturn isText.value ? s.peek() : s.value;\n}\n\nSignalValue.displayName = \"ReactiveTextNode\";\n\nObject.defineProperties(Signal.prototype, {\n\tconstructor: { configurable: true, value: undefined },\n\ttype: { configurable: true, value: SignalValue },\n\tprops: {\n\t\tconfigurable: true,\n\t\tget() {\n\t\t\tconst s: Signal = this;\n\t\t\treturn {\n\t\t\t\tdata: {\n\t\t\t\t\tget value() {\n\t\t\t\t\t\treturn s.value;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t},\n\t// Setting a VNode's _depth to 1 forces Preact to clone it before modifying:\n\t// https://github.com/preactjs/preact/blob/d7a433ee8463a7dc23a05111bb47de9ec729ad4d/src/diff/children.js#L77\n\t// @todo remove this for Preact 11\n\t__b: { configurable: true, value: 1 },\n});\n\n/** Inject low-level property/attribute bindings for Signals into Preact's diff */\nhook(OptionsTypes.DIFF, (old, vnode) =\u003e {\n\tif (typeof vnode.type === \"string\") {\n\t\tlet signalProps: Record\u003cstring, any\u003e | undefined;\n\n\t\tlet props = vnode.props;\n\t\tfor (let i in props) {\n\t\t\tif (i === \"children\") continue;\n\n\t\t\tlet value = props[i];\n\t\t\tif (value instanceof Signal) {\n\t\t\t\tif (!signalProps) vnode.__np = signalProps = {};\n\t\t\t\tsignalProps[i] = value;\n\t\t\t\tprops[i] = value.peek();\n\t\t\t}\n\t\t}\n\t}\n\n\told(vnode);\n});\n\n/** Set up Updater before rendering a component */\nhook(OptionsTypes.RENDER, (old, vnode) =\u003e {\n\told(vnode);\n\t// Ignore the Fragment inserted by preact.createElement().\n\tif (vnode.type !== Fragment) {\n\t\tsetCurrentUpdater();\n\n\t\tlet updater: Effect | undefined;\n\n\t\tlet component = vnode.__c;\n\t\tif (component) {\n\t\t\tcomponent._updateFlags \u0026= ~HAS_PENDING_UPDATE;\n\n\t\t\tupdater = component._updater;\n\t\t\tif (updater === undefined) {\n\t\t\t\tcomponent._updater = updater = createUpdater(\n\t\t\t\t\t() =\u003e {\n\t\t\t\t\t\tif (DEVTOOLS_ENABLED) updater!._debugCallback?.call(updater);\n\t\t\t\t\t\tcomponent._updateFlags |= HAS_PENDING_UPDATE;\n\t\t\t\t\t\tcomponent.setState({});\n\t\t\t\t\t},\n\t\t\t\t\ttypeof vnode.type === \"function\"\n\t\t\t\t\t\t? vnode.type.displayName || vnode.type.name\n\t\t\t\t\t\t: \"\"\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tcurrentComponent = component;\n\t\tsetCurrentUpdater(updater);\n\t}\n});\n\n/** Finish current updater if a component errors */\nhook(OptionsTypes.CATCH_ERROR, (old, error, vnode, oldVNode) =\u003e {\n\tsetCurrentUpdater();\n\tcurrentComponent = undefined;\n\told(error, vnode, oldVNode);\n});\n\n/** Finish current updater after rendering any VNode */\nhook(OptionsTypes.DIFFED, (old, vnode) =\u003e {\n\tsetCurrentUpdater();\n\tcurrentComponent = undefined;\n\n\tlet dom: Element;\n\n\t// vnode._dom is undefined during string rendering,\n\t// so we use this to skip prop subscriptions during SSR.\n\tif (typeof vnode.type === \"string\" \u0026\u0026 (dom = vnode.__e as Element)) {\n\t\tlet props = vnode.__np;\n\t\tlet renderedProps = vnode.props;\n\t\tif (props) {\n\t\t\tlet updaters = dom._updaters;\n\t\t\tif (updaters) {\n\t\t\t\tfor (let prop in updaters) {\n\t\t\t\t\tlet updater = updaters[prop];\n\t\t\t\t\tif (updater !== undefined \u0026\u0026 !(prop in props)) {\n\t\t\t\t\t\tupdater._dispose();\n\t\t\t\t\t\t// @todo we could just always invoke _dispose() here\n\t\t\t\t\t\tupdaters[prop] = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tupdaters = {};\n\t\t\t\tdom._updaters = updaters;\n\t\t\t}\n\n\t\t\tfor (let prop in props) {\n\t\t\t\tlet updater = updaters[prop];\n\t\t\t\tlet signal = props[prop];\n\t\t\t\tif (updater === undefined) {\n\t\t\t\t\tupdater = createPropUpdater(dom, prop, signal, renderedProps);\n\t\t\t\t\tupdaters[prop] = updater;\n\t\t\t\t} else {\n\t\t\t\t\tupdater._update(signal, renderedProps);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (let prop in props) {\n\t\t\t\trenderedProps[prop] = props[prop];\n\t\t\t}\n\t\t}\n\t}\n\told(vnode);\n});\n\nfunction createPropUpdater(\n\tdom: Element,\n\tprop: string,\n\tpropSignal: Signal,\n\tprops: Record\u003cstring, any\u003e\n): PropertyUpdater {\n\tconst setAsProperty =\n\t\tprop in dom \u0026\u0026\n\t\t// SVG elements need to go through `setAttribute` because they\n\t\t// expect things like SVGAnimatedTransformList instead of strings.\n\t\t// @ts-ignore\n\t\tdom.ownerSVGElement === undefined;\n\n\tconst changeSignal = signal(propSignal);\n\t// Track the last value we know was applied to the DOM, so we can skip\n\t// redundant updates without writing back to vnode.props (which would\n\t// clobber the Signal reference and break unmount/remount cycles).\n\tlet lastRenderedValue: any = propSignal.peek();\n\treturn {\n\t\t_update: (newSignal: Signal, newProps: typeof props) =\u003e {\n\t\t\tchangeSignal.value = newSignal;\n\t\t\tprops = newProps;\n\t\t\tlastRenderedValue = newSignal.peek();\n\t\t},\n\t\t_dispose: effect(function (this: Effect) {\n\t\t\tthis._notify = notifyDomUpdates;\n\t\t\tconst value = changeSignal.value.value;\n\t\t\t// If Preact just rendered this value, don't render it again:\n\t\t\tif (lastRenderedValue === value) {\n\t\t\t\tlastRenderedValue = undefined;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tlastRenderedValue = undefined;\n\t\t\tif (setAsProperty) {\n\t\t\t\t// @ts-ignore-next-line silly\n\t\t\t\tdom[prop] = value;\n\t\t\t\t// Match Preact's attribute handling: data-* and aria-* attributes\n\t\t\t\t// https://github.com/preactjs/preact/blob/main/src/diff/props.js#L132\n\t\t\t} else if (value != null \u0026\u0026 (value !== false || prop[4] === \"-\")) {\n\t\t\t\tdom.setAttribute(prop, value);\n\t\t\t} else {\n\t\t\t\tdom.removeAttribute(prop);\n\t\t\t}\n\t\t}),\n\t};\n}\n\n/** Unsubscribe from Signals when unmounting components/vnodes */\nhook(OptionsTypes.UNMOUNT, (old, vnode: VNode) =\u003e {\n\tif (typeof vnode.type === \"string\") {\n\t\tlet dom = vnode.__e as Element | undefined;\n\t\t// vnode._dom is undefined during string rendering\n\t\tif (dom) {\n\t\t\tconst updaters = dom._updaters;\n\t\t\tif (updaters) {\n\t\t\t\tdom._updaters = undefined;\n\t\t\t\tfor (let prop in updaters) {\n\t\t\t\t\tlet updater = updaters[prop];\n\t\t\t\t\tif (updater) updater._dispose();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvnode.__np = undefined;\n\t} else {\n\t\tlet component = vnode.__c;\n\t\tif (component) {\n\t\t\tconst updater = component._updater;\n\t\t\tif (updater) {\n\t\t\t\tcomponent._updater = undefined;\n\t\t\t\tupdater._dispose();\n\t\t\t}\n\t\t}\n\t}\n\told(vnode);\n});\n\n/** Mark components that use hook state so we can skip sCU optimization. */\nhook(OptionsTypes.HOOK, (old, component, index, type) =\u003e {\n\tif (type \u003c 3 || type === 9)\n\t\t(component as AugmentedComponent)._updateFlags |= HAS_HOOK_STATE;\n\told(component, index, type);\n});\n\n/**\n * Auto-memoize components that use Signals/Computeds.\n * Note: Does _not_ optimize components that use hook/class state.\n */\nComponent.prototype.shouldComponentUpdate = function (\n\tthis: AugmentedComponent,\n\tprops,\n\tstate\n) {\n\t// Suspended vnodes should always update:\n\tif (this.__R) return true;\n\n\t// @todo: Once preactjs/preact#3671 lands, this could just use `currentUpdater`:\n\tconst updater = this._updater;\n\tconst hasSignals = updater \u0026\u0026 updater._sources !== undefined;\n\n\t// If this is a component using state, rerender\n\t// @ts-ignore\n\tfor (let i in state) return true;\n\n\tif (this.__f || (typeof this.u == \"boolean\" \u0026\u0026 this.u === true)) {\n\t\tconst hasHooksState = this._updateFlags \u0026 HAS_HOOK_STATE;\n\t\t// if this component used no signals or computeds and no hooks state, update:\n\t\tif (!hasSignals \u0026\u0026 !hasHooksState \u0026\u0026 !(this._updateFlags \u0026 HAS_COMPUTEDS))\n\t\t\treturn true;\n\n\t\t// if there is a pending re-render triggered from Signals,\n\t\t// or if there is hooks state, update:\n\t\tif (this._updateFlags \u0026 HAS_PENDING_UPDATE) return true;\n\t} else {\n\t\t// if this component used no signals or computeds, update:\n\t\tif (!hasSignals \u0026\u0026 !(this._updateFlags \u0026 HAS_COMPUTEDS)) return true;\n\n\t\t// if there is a pending re-render triggered from Signals,\n\t\t// or if there is hooks state, update:\n\t\tif (this._updateFlags \u0026 (HAS_PENDING_UPDATE | HAS_HOOK_STATE)) return true;\n\t}\n\n\t// if any non-Signal props changed, update:\n\tfor (let i in props) {\n\t\tif (i !== \"__source\" \u0026\u0026 props[i] !== this.props[i]) return true;\n\t}\n\tfor (let i in this.props) if (!(i in props)) return true;\n\n\t// this is a purely Signal-driven component, don't update:\n\treturn false;\n};\n\nexport function useSignal\u003cT\u003e(value: T, options?: SignalOptions\u003cT\u003e): Signal\u003cT\u003e;\nexport function useSignal\u003cT = undefined\u003e(): Signal\u003cT | undefined\u003e;\nexport function useSignal\u003cT\u003e(value?: T, options?: SignalOptions\u003cT\u003e) {\n\treturn useMemo(\n\t\t() =\u003e signal\u003cT | undefined\u003e(value, options as SignalOptions),\n\t\t[]\n\t);\n}\n\nexport function useComputed\u003cT\u003e(compute: () =\u003e T, options?: SignalOptions\u003cT\u003e) {\n\tconst $compute = useRef(compute);\n\t$compute.current = compute;\n\t(currentComponent as AugmentedComponent)._updateFlags |= HAS_COMPUTEDS;\n\treturn useMemo(() =\u003e computed\u003cT\u003e(() =\u003e $compute.current(), options), []);\n}\n\nfunction safeRaf(callback: () =\u003e void) {\n\tconst done = () =\u003e {\n\t\tclearTimeout(timeout);\n\t\tcancelAnimationFrame(raf);\n\t\tcallback();\n\t};\n\n\tconst timeout = setTimeout(done, 35);\n\tconst raf = requestAnimationFrame(done);\n}\n\nconst deferEffects =\n\ttypeof requestAnimationFrame === \"undefined\" ? setTimeout : safeRaf;\n\nconst deferDomUpdates = (cb: any) =\u003e {\n\tqueueMicrotask(() =\u003e {\n\t\tqueueMicrotask(cb);\n\t});\n};\n\nfunction flushEffects() {\n\tbatch(() =\u003e {\n\t\tlet inst: Effect | undefined;\n\t\twhile ((inst = effectsQueue.shift())) {\n\t\t\toldNotify.call(inst);\n\t\t}\n\t});\n}\n\nfunction notifyEffects(this: Effect) {\n\tif (effectsQueue.push(this) === 1) {\n\t\t(options.requestAnimationFrame || deferEffects)(flushEffects);\n\t}\n}\n\nfunction flushDomUpdates() {\n\tbatch(() =\u003e {\n\t\tlet inst: Effect | undefined;\n\t\twhile ((inst = domQueue.shift())) {\n\t\t\toldNotify.call(inst);\n\t\t}\n\t});\n}\n\nfunction notifyDomUpdates(this: Effect) {\n\tif (domQueue.push(this) === 1) {\n\t\t(options.requestAnimationFrame || deferDomUpdates)(flushDomUpdates);\n\t}\n}\n\nexport function useSignalEffect(\n\tcb: () =\u003e void | (() =\u003e void),\n\toptions?: EffectOptions\n) {\n\tconst callback = useRef(cb);\n\tcallback.current = cb;\n\n\tuseEffect(() =\u003e {\n\t\treturn effect(function (this: Effect) {\n\t\t\tthis._notify = notifyEffects;\n\t\t\treturn callback.current();\n\t\t}, options);\n\t}, []);\n}\n\n/** See comment in packages/core/src/index.ts on the same interface for an explanation */\ninterface InternalModelConstructor\u003c\n\tTModel,\n\tTArgs extends any[],\n\u003e extends ModelConstructor\u003cTModel, TArgs\u003e {\n\t(...args: TArgs): Model\u003cTModel\u003e;\n}\n\nexport function useModel\u003cTModel\u003e(\n\tfactory: ModelConstructor\u003cTModel, []\u003e | (() =\u003e Model\u003cTModel\u003e)\n): Model\u003cTModel\u003e {\n\ttype InternalFactory =\n\t\t| InternalModelConstructor\u003cTModel, []\u003e\n\t\t| (() =\u003e Model\u003cTModel\u003e);\n\n\tconst inst = useMemo(() =\u003e (factory as InternalFactory)(), []);\n\tuseEffect(() =\u003e inst[Symbol.dispose], [inst]);\n\treturn inst;\n}\n\n/**\n * @todo Determine which Reactive implementation we'll be using.\n * @internal\n */\n// export function useReactive\u003cT extends object\u003e(value: T): Reactive\u003cT\u003e {\n// \treturn useMemo(() =\u003e reactive\u003cT\u003e(value), []);\n// }\n\n/**\n * @internal\n * Update a Reactive's using the properties of an object or other Reactive.\n * Also works for Signals.\n * @example\n * // Update a Reactive with Object.assign()-like syntax:\n * const r = reactive({ name: \"Alice\" });\n * update(r, { name: \"Bob\" });\n * update(r, { age: 42 }); // property 'age' does not exist in type '{ name?: string }'\n * update(r, 2); // '2' has no properties in common with '{ name?: string }'\n * console.log(r.name.value); // \"Bob\"\n *\n * @example\n * // Update a Reactive with the properties of another Reactive:\n * const A = reactive({ name: \"Alice\" });\n * const B = reactive({ name: \"Bob\", age: 42 });\n * update(A, B);\n * console.log(`${A.name} is ${A.age}`); // \"Bob is 42\"\n *\n * @example\n * // Update a signal with assign()-like syntax:\n * const s = signal(42);\n * update(s, \"hi\"); // Argument type 'string' not assignable to type 'number'\n * update(s, {}); // Argument type '{}' not assignable to type 'number'\n * update(s, 43);\n * console.log(s.value); // 43\n *\n * @param obj The Reactive or Signal to be updated\n * @param update The value, Signal, object or Reactive to update `obj` to match\n * @param overwrite If `true`, any properties `obj` missing from `update` are set to `undefined`\n */\n/*\nexport function update\u003cT extends SignalOrReactive\u003e(\n\tobj: T,\n\tupdate: Partial\u003cUnwrap\u003cT\u003e\u003e,\n\toverwrite = false\n) {\n\tif (obj instanceof Signal) {\n\t\tobj.value = peekValue(update);\n\t} else {\n\t\tfor (let i in update) {\n\t\t\tif (i in obj) {\n\t\t\t\tobj[i].value = peekValue(update[i]);\n\t\t\t} else {\n\t\t\t\tlet sig = signal(peekValue(update[i]));\n\t\t\t\tsig[KEY] = i;\n\t\t\t\tobj[i] = sig;\n\t\t\t}\n\t\t}\n\t\tif (overwrite) {\n\t\t\tfor (let i in obj) {\n\t\t\t\tif (!(i in update)) {\n\t\t\t\t\tobj[i].value = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n*/\n"],"version":3}
···11+/* esm.sh - htm@3.1.1/preact */
22+import{h as r}from"preact";import{h as d,render as f,Component as h}from"preact";import o from"./htm.mjs";var p=o.bind(r);export{h as Component,d as h,p as html,f as render};
33+//# sourceMappingURL=./preact.mjs.map
···11+{"mappings":";AAAA,OAAO,KAAK,MAAiC,SAAS,OAAO,KAAAA,EAAE,UAAAC,EAAO,aAAAC,MAAc,SAAS,OAAOC,MAAM,YAAM,IAAIC,EAAED,EAAE,KAAK,CAAC","names":["h","render","Component","e","m"],"sources":["../esm/npm/htm@3.1.1/node_modules/htm/preact/index.module.js"],"sourcesContent":["import{h as r,Component as o,render as t}from\"preact\";export{h,render,Component}from\"preact\";import e from\"htm\";var m=e.bind(r);export{m as html};\n"],"version":3}
+3
vendor/esm.sh/nanoid@5.1.7/es2022/nanoid.mjs
···11+/* esm.sh - nanoid@5.1.7 */
22+var o="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var u=t=>crypto.getRandomValues(new Uint8Array(t)),s=(t,e,l)=>{let n=(2<<Math.log2(t.length-1))-1,p=-~(1.6*n*e/t.length);return(h=e)=>{let r="";for(;;){let m=l(p),a=p|0;for(;a--;)if(r+=t[m[a]&n]||"",r.length>=h)return r}}},A=(t,e=21)=>s(t,e|0,u),g=(t=21)=>{let e="",l=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=o[l[t]&63];return e};export{A as customAlphabet,s as customRandom,g as nanoid,u as random,o as urlAlphabet};
33+//# sourceMappingURL=./nanoid.mjs.map
+1
vendor/esm.sh/nanoid@5.1.7/es2022/nanoid.mjs.map
···11+{"mappings":";AAAO,IAAIA,EACT,mECEK,IAAIC,EAASC,GAAS,OAAO,gBAAgB,IAAI,WAAWA,CAAK,CAAC,EAC9DC,EAAe,CAACC,EAAUC,EAAaC,IAAc,CAC9D,IAAIC,GAAQ,GAAK,KAAK,KAAKH,EAAS,OAAS,CAAC,GAAK,EAC/CI,EAAO,CAAC,EAAG,IAAMD,EAAOF,EAAeD,EAAS,QACpD,MAAO,CAACK,EAAOJ,IAAgB,CAC7B,IAAIK,EAAK,GACT,OAAa,CACX,IAAIR,EAAQI,EAAUE,CAAI,EACtBG,EAAIH,EAAO,EACf,KAAOG,KAEL,GADAD,GAAMN,EAASF,EAAMS,CAAC,EAAIJ,CAAI,GAAK,GAC/BG,EAAG,QAAUD,EAAM,OAAOC,CAElC,CACF,CACF,EACWE,EAAiB,CAACR,EAAUK,EAAO,KAC5CN,EAAaC,EAAUK,EAAO,EAAGR,CAAM,EAC9BY,EAAS,CAACJ,EAAO,KAAO,CACjC,IAAIC,EAAK,GACLR,EAAQ,OAAO,gBAAgB,IAAI,WAAYO,GAAQ,CAAE,CAAC,EAC9D,KAAOA,KACLC,GAAMI,EAAkBZ,EAAMO,CAAI,EAAI,EAAE,EAE1C,OAAOC,CACT","names":["urlAlphabet","random","bytes","customRandom","alphabet","defaultSize","getRandom","mask","step","size","id","j","customAlphabet","nanoid","urlAlphabet"],"sources":["../esm/npm/nanoid@5.1.7/node_modules/nanoid/url-alphabet/index.js","../esm/npm/nanoid@5.1.7/node_modules/nanoid/index.browser.js"],"sourcesContent":["export let urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n","/* @ts-self-types=\"./index.d.ts\" */\nimport { urlAlphabet as scopedUrlAlphabet } from './url-alphabet/index.js'\nexport { urlAlphabet } from './url-alphabet/index.js'\nexport let random = bytes =\u003e crypto.getRandomValues(new Uint8Array(bytes))\nexport let customRandom = (alphabet, defaultSize, getRandom) =\u003e {\n let mask = (2 \u003c\u003c Math.log2(alphabet.length - 1)) - 1\n let step = -~((1.6 * mask * defaultSize) / alphabet.length)\n return (size = defaultSize) =\u003e {\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step | 0\n while (j--) {\n id += alphabet[bytes[j] \u0026 mask] || ''\n if (id.length \u003e= size) return id\n }\n }\n }\n}\nexport let customAlphabet = (alphabet, size = 21) =\u003e\n customRandom(alphabet, size | 0, random)\nexport let nanoid = (size = 21) =\u003e {\n let id = ''\n let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))\n while (size--) {\n id += scopedUrlAlphabet[bytes[size] \u0026 63]\n }\n return id\n}\n"],"version":3}
+3
vendor/esm.sh/preact@10.29.1/es2022/hooks.mjs
···11+/* esm.sh - preact@10.29.1/hooks */
22+import{options as V}from"./preact.mjs";var c,e,d,g,v=0,T=[],o=V,C=o.__b,A=o.__r,D=o.diffed,F=o.__c,k=o.unmount,q=o.__;function m(t,_){o.__h&&o.__h(e,t,v||_),v=0;var u=e.__H||(e.__H={__:[],__h:[]});return t>=u.__.length&&u.__.push({}),u.__[t]}function B(t){return v=1,I(E,t)}function I(t,_,u){var n=m(c++,2);if(n.t=t,!n.__c&&(n.__=[u?u(_):E(void 0,_),function(f){var a=n.__N?n.__N[0]:n.__[0],s=n.t(a,f);a!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=e,!e.__f)){var i=function(f,a,s){if(!n.__c.__H)return!0;var h=n.__c.__H.__.filter(function(r){return r.__c});if(h.every(function(r){return!r.__N}))return!l||l.call(this,f,a,s);var b=n.__c.props!==f;return h.some(function(r){if(r.__N){var P=r.__[0];r.__=r.__N,r.__N=void 0,P!==r.__[0]&&(b=!0)}}),l&&l.call(this,f,a,s)||b};e.__f=!0;var l=e.shouldComponentUpdate,N=e.componentWillUpdate;e.componentWillUpdate=function(f,a,s){if(this.__e){var h=l;l=void 0,i(f,a,s),l=h}N&&N.call(this,f,a,s)},e.shouldComponentUpdate=i}return n.__N||n.__}function w(t,_){var u=m(c++,3);!o.__s&&y(u.__H,_)&&(u.__=t,u.u=_,e.__H.__h.push(u))}function R(t,_){var u=m(c++,4);!o.__s&&y(u.__H,_)&&(u.__=t,u.u=_,e.__h.push(u))}function z(t){return v=5,U(function(){return{current:t}},[])}function L(t,_,u){v=6,R(function(){if(typeof t=="function"){var n=t(_());return function(){t(null),n&&typeof n=="function"&&n()}}if(t)return t.current=_(),function(){return t.current=null}},u==null?u:u.concat(t))}function U(t,_){var u=m(c++,7);return y(u.__H,_)&&(u.__=t(),u.__H=_,u.__h=t),u.__}function M(t,_){return v=8,U(function(){return t},_)}function G(t){var _=e.context[t.__c],u=m(c++,9);return u.c=t,_?(u.__==null&&(u.__=!0,_.sub(e)),_.props.value):t.__}function J(t,_){o.useDebugValue&&o.useDebugValue(_?_(t):t)}function K(t){var _=m(c++,10),u=B();return _.__=t,e.componentDidCatch||(e.componentDidCatch=function(n,i){_.__&&_.__(n,i),u[1](n)}),[u[0],function(){u[1](void 0)}]}function O(){var t=m(c++,11);if(!t.__){for(var _=e.__v;_!==null&&!_.__m&&_.__!==null;)_=_.__;var u=_.__m||(_.__m=[0,0]);t.__="P"+u[0]+"-"+u[1]++}return t.__}function S(){for(var t;t=T.shift();){var _=t.__H;if(t.__P&&_)try{_.__h.some(p),_.__h.some(H),_.__h=[]}catch(u){_.__h=[],o.__e(u,t.__v)}}}o.__b=function(t){e=null,C&&C(t)},o.__=function(t,_){t&&_.__k&&_.__k.__m&&(t.__m=_.__k.__m),q&&q(t,_)},o.__r=function(t){A&&A(t),c=0;var _=(e=t.__c).__H;_&&(d===e?(_.__h=[],e.__h=[],_.__.some(function(u){u.__N&&(u.__=u.__N),u.u=u.__N=void 0})):(_.__h.some(p),_.__h.some(H),_.__h=[],c=0)),d=e},o.diffed=function(t){D&&D(t);var _=t.__c;_&&_.__H&&(_.__H.__h.length&&(T.push(_)!==1&&g===o.requestAnimationFrame||((g=o.requestAnimationFrame)||W)(S)),_.__H.__.some(function(u){u.u&&(u.__H=u.u),u.u=void 0})),d=e=null},o.__c=function(t,_){_.some(function(u){try{u.__h.some(p),u.__h=u.__h.filter(function(n){return!n.__||H(n)})}catch(n){_.some(function(i){i.__h&&(i.__h=[])}),_=[],o.__e(n,u.__v)}}),F&&F(t,_)},o.unmount=function(t){k&&k(t);var _,u=t.__c;u&&u.__H&&(u.__H.__.some(function(n){try{p(n)}catch(i){_=i}}),u.__H=void 0,_&&o.__e(_,u.__v))};var x=typeof requestAnimationFrame=="function";function W(t){var _,u=function(){clearTimeout(n),x&&cancelAnimationFrame(_),setTimeout(t)},n=setTimeout(u,35);x&&(_=requestAnimationFrame(u))}function p(t){var _=e,u=t.__c;typeof u=="function"&&(t.__c=void 0,u()),e=_}function H(t){var _=e;t.__c=t.__(),e=_}function y(t,_){return!t||t.length!==_.length||_.some(function(u,n){return u!==t[n]})}function E(t,_){return typeof _=="function"?_(t):_}export{M as useCallback,G as useContext,J as useDebugValue,w as useEffect,K as useErrorBoundary,O as useId,L as useImperativeHandle,R as useLayoutEffect,U as useMemo,I as useReducer,z as useRef,B as useState};
33+//# sourceMappingURL=./hooks.mjs.map
+1
vendor/esm.sh/preact@10.29.1/es2022/hooks.mjs.map
···11+{"mappings":";uCAGA,IAAIA,EAGAC,EA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WJ,EAlcR,EAAA,EAqcfF,IACHC,EAAML,sBAAsBM,CAAAA,EAE9B,CAqBA,SAASZ,EAAciB,EAAAA,CAGtB,IAAMC,EAAO1H,EACT2H,EAAUF,EAAI3G,IACI,OAAX6G,GAAW,aACrBF,EAAI3G,IAAAA,OACJ6G,EAAAA,GAGD3H,EAAmB0H,CACpB,CAOA,SAASjB,EAAagB,EAAAA,CAGrB,IAAMC,EAAO1H,EACbyH,EAAI3G,IAAY2G,EAAIvG,GAAAA,EACpBlB,EAAmB0H,CACpB,CAOA,SAASxD,EAAY0D,EAASC,EAAAA,CAC7B,MAAA,CACED,GACDA,EAAQnG,SAAWoG,EAAQpG,QAC3BoG,EAAQvE,KAAK,SAACwE,EAAK1G,EAAAA,CAAU,OAAA0G,IAAQF,EAAQxG,CAAAA,CAAM,CAAA,CAErD,CAQA,SAASU,EAAegG,EAAKC,EAAAA,CAC5B,OAAmB,OAALA,GAAK,WAAaA,EAAED,CAAAA,EAAOC,CAC1C","names":["currentIndex","currentComponent","previousComponent","prevRaf","currentHook","afterPaintEffects","options","_options","oldBeforeDiff","__b","oldBeforeRender","__r","oldAfterDiff","diffed","oldCommit","__c","oldBeforeUnmount","unmount","oldRoot","__","getHookState","index","type","__h","hooks","__H","length","push","useState","initialState","useReducer","invokeOrReturn","reducer","init","hookState","_reducer","action","currentValue","__N","nextValue","setState","__f","updateHookState","p","s","c","stateHooks","filter","x","every","prevScu","call","this","shouldUpdate","props","some","hookItem","shouldComponentUpdate","prevCWU","componentWillUpdate","__e","tmp","useEffect","callback","args","state","__s","argsChanged","_pendingArgs","useLayoutEffect","useRef","initialValue","useMemo","current","useImperativeHandle","ref","createHandle","result","concat","factory","useCallback","useContext","context","provider","sub","value","useDebugValue","formatter","n","useErrorBoundary","cb","errState","componentDidCatch","err","errorInfo","undefined","useId","root","__v","__m","mask","flushAfterPaintEffects","component","shift","__P","invokeCleanup","invokeEffect","e","vnode","parentDom","__k","requestAnimationFrame","afterNextFrame","commitQueue","hasErrored","HAS_RAF","raf","done","clearTimeout","timeout","cancelAnimationFrame","setTimeout","hook","comp","cleanup","oldArgs","newArgs","arg","f"],"sources":["../esm/npm/preact@10.29.1/node_modules/preact/hooks/src/index.js"],"sourcesContent":["import { options as _options } from 'preact';\n\n/** @type {number} */\nlet currentIndex;\n\n/** @type {import('./internal').Component} */\nlet currentComponent;\n\n/** @type {import('./internal').Component} */\nlet previousComponent;\n\n/** @type {number} */\nlet currentHook = 0;\n\n/** @type {Array\u003cimport('./internal').Component\u003e} */\nlet afterPaintEffects = [];\n\n// Cast to use internal Options type\nconst options = /** @type {import('./internal').Options} */ (_options);\n\nlet oldBeforeDiff = options._diff;\nlet oldBeforeRender = options._render;\nlet oldAfterDiff = options.diffed;\nlet oldCommit = options._commit;\nlet oldBeforeUnmount = options.unmount;\nlet oldRoot = options._root;\n\n// We take the minimum timeout for requestAnimationFrame to ensure that\n// the callback is invoked after the next frame. 35ms is based on a 30hz\n// refresh rate, which is the minimum rate for a smooth user experience.\nconst RAF_TIMEOUT = 35;\nlet prevRaf;\n\n/** @type {(vnode: import('./internal').VNode) =\u003e void} */\noptions._diff = vnode =\u003e {\n\tcurrentComponent = null;\n\tif (oldBeforeDiff) oldBeforeDiff(vnode);\n};\n\noptions._root = (vnode, parentDom) =\u003e {\n\tif (vnode \u0026\u0026 parentDom._children \u0026\u0026 parentDom._children._mask) {\n\t\tvnode._mask = parentDom._children._mask;\n\t}\n\n\tif (oldRoot) oldRoot(vnode, parentDom);\n};\n\n/** @type {(vnode: import('./internal').VNode) =\u003e void} */\noptions._render = vnode =\u003e {\n\tif (oldBeforeRender) oldBeforeRender(vnode);\n\n\tcurrentComponent = vnode._component;\n\tcurrentIndex = 0;\n\n\tconst hooks = currentComponent.__hooks;\n\tif (hooks) {\n\t\tif (previousComponent === currentComponent) {\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentComponent._renderCallbacks = [];\n\t\t\thooks._list.some(hookItem =\u003e {\n\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t}\n\t\t\t\thookItem._pendingArgs = hookItem._nextValue = undefined;\n\t\t\t});\n\t\t} else {\n\t\t\thooks._pendingEffects.some(invokeCleanup);\n\t\t\thooks._pendingEffects.some(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t\tcurrentIndex = 0;\n\t\t}\n\t}\n\tpreviousComponent = currentComponent;\n};\n\n/** @type {(vnode: import('./internal').VNode) =\u003e void} */\noptions.diffed = vnode =\u003e {\n\tif (oldAfterDiff) oldAfterDiff(vnode);\n\n\tconst c = vnode._component;\n\tif (c \u0026\u0026 c.__hooks) {\n\t\tif (c.__hooks._pendingEffects.length) afterPaint(afterPaintEffects.push(c));\n\t\tc.__hooks._list.some(hookItem =\u003e {\n\t\t\tif (hookItem._pendingArgs) {\n\t\t\t\thookItem._args = hookItem._pendingArgs;\n\t\t\t}\n\t\t\thookItem._pendingArgs = undefined;\n\t\t});\n\t}\n\tpreviousComponent = currentComponent = null;\n};\n\n// TODO: Improve typing of commitQueue parameter\n/** @type {(vnode: import('./internal').VNode, commitQueue: any) =\u003e void} */\noptions._commit = (vnode, commitQueue) =\u003e {\n\tcommitQueue.some(component =\u003e {\n\t\ttry {\n\t\t\tcomponent._renderCallbacks.some(invokeCleanup);\n\t\t\tcomponent._renderCallbacks = component._renderCallbacks.filter(cb =\u003e\n\t\t\t\tcb._value ? invokeEffect(cb) : true\n\t\t\t);\n\t\t} catch (e) {\n\t\t\tcommitQueue.some(c =\u003e {\n\t\t\t\tif (c._renderCallbacks) c._renderCallbacks = [];\n\t\t\t});\n\t\t\tcommitQueue = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t});\n\n\tif (oldCommit) oldCommit(vnode, commitQueue);\n};\n\n/** @type {(vnode: import('./internal').VNode) =\u003e void} */\noptions.unmount = vnode =\u003e {\n\tif (oldBeforeUnmount) oldBeforeUnmount(vnode);\n\n\tconst c = vnode._component;\n\tif (c \u0026\u0026 c.__hooks) {\n\t\tlet hasErrored;\n\t\tc.__hooks._list.some(s =\u003e {\n\t\t\ttry {\n\t\t\t\tinvokeCleanup(s);\n\t\t\t} catch (e) {\n\t\t\t\thasErrored = e;\n\t\t\t}\n\t\t});\n\t\tc.__hooks = undefined;\n\t\tif (hasErrored) options._catchError(hasErrored, c._vnode);\n\t}\n};\n\n/**\n * Get a hook's state from the currentComponent\n * @param {number} index The index of the hook to get\n * @param {number} type The index of the hook to get\n * @returns {any}\n */\nfunction getHookState(index, type) {\n\tif (options._hook) {\n\t\toptions._hook(currentComponent, index, currentHook || type);\n\t}\n\tcurrentHook = 0;\n\n\t// Largely inspired by:\n\t// * https://github.com/michael-klein/funcy.js/blob/f6be73468e6ec46b0ff5aa3cc4c9baf72a29025a/src/hooks/core_hooks.mjs\n\t// * https://github.com/michael-klein/funcy.js/blob/650beaa58c43c33a74820a3c98b3c7079cf2e333/src/renderer.mjs\n\t// Other implementations to look at:\n\t// * https://codesandbox.io/s/mnox05qp8\n\tconst hooks =\n\t\tcurrentComponent.__hooks ||\n\t\t(currentComponent.__hooks = {\n\t\t\t_list: [],\n\t\t\t_pendingEffects: []\n\t\t});\n\n\tif (index \u003e= hooks._list.length) {\n\t\thooks._list.push({});\n\t}\n\n\treturn hooks._list[index];\n}\n\n/**\n * @template {unknown} S\n * @param {import('./index').Dispatch\u003cimport('./index').StateUpdater\u003cS\u003e\u003e} [initialState]\n * @returns {[S, (state: S) =\u003e void]}\n */\nexport function useState(initialState) {\n\tcurrentHook = 1;\n\treturn useReducer(invokeOrReturn, initialState);\n}\n\n/**\n * @template {unknown} S\n * @template {unknown} A\n * @param {import('./index').Reducer\u003cS, A\u003e} reducer\n * @param {import('./index').Dispatch\u003cimport('./index').StateUpdater\u003cS\u003e\u003e} initialState\n * @param {(initialState: any) =\u003e void} [init]\n * @returns {[ S, (state: S) =\u003e void ]}\n */\nexport function useReducer(reducer, initialState, init) {\n\t/** @type {import('./internal').ReducerHookState} */\n\tconst hookState = getHookState(currentIndex++, 2);\n\thookState._reducer = reducer;\n\tif (!hookState._component) {\n\t\thookState._value = [\n\t\t\t!init ? invokeOrReturn(undefined, initialState) : init(initialState),\n\n\t\t\taction =\u003e {\n\t\t\t\tconst currentValue = hookState._nextValue\n\t\t\t\t\t? hookState._nextValue[0]\n\t\t\t\t\t: hookState._value[0];\n\t\t\t\tconst nextValue = hookState._reducer(currentValue, action);\n\n\t\t\t\tif (currentValue !== nextValue) {\n\t\t\t\t\thookState._nextValue = [nextValue, hookState._value[1]];\n\t\t\t\t\thookState._component.setState({});\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\n\t\thookState._component = currentComponent;\n\n\t\tif (!currentComponent._hasScuFromHooks) {\n\t\t\tcurrentComponent._hasScuFromHooks = true;\n\t\t\tlet prevScu = currentComponent.shouldComponentUpdate;\n\t\t\tconst prevCWU = currentComponent.componentWillUpdate;\n\n\t\t\t// If we're dealing with a forced update `shouldComponentUpdate` will\n\t\t\t// not be called. But we use that to update the hook values, so we\n\t\t\t// need to call it.\n\t\t\tcurrentComponent.componentWillUpdate = function (p, s, c) {\n\t\t\t\tif (this._force) {\n\t\t\t\t\tlet tmp = prevScu;\n\t\t\t\t\t// Clear to avoid other sCU hooks from being called\n\t\t\t\t\tprevScu = undefined;\n\t\t\t\t\tupdateHookState(p, s, c);\n\t\t\t\t\tprevScu = tmp;\n\t\t\t\t}\n\n\t\t\t\tif (prevCWU) prevCWU.call(this, p, s, c);\n\t\t\t};\n\n\t\t\t// This SCU has the purpose of bailing out after repeated updates\n\t\t\t// to stateful hooks.\n\t\t\t// we store the next value in _nextValue[0] and keep doing that for all\n\t\t\t// state setters, if we have next states and\n\t\t\t// all next states within a component end up being equal to their original state\n\t\t\t// we are safe to bail out for this specific component.\n\t\t\t/**\n\t\t\t *\n\t\t\t * @type {import('./internal').Component[\"shouldComponentUpdate\"]}\n\t\t\t */\n\t\t\t// @ts-ignore - We don't use TS to downtranspile\n\t\t\t// eslint-disable-next-line no-inner-declarations\n\t\t\tfunction updateHookState(p, s, c) {\n\t\t\t\tif (!hookState._component.__hooks) return true;\n\n\t\t\t\tconst stateHooks = hookState._component.__hooks._list.filter(\n\t\t\t\t\tx =\u003e x._component\n\t\t\t\t);\n\n\t\t\t\tconst allHooksEmpty = stateHooks.every(x =\u003e !x._nextValue);\n\t\t\t\t// When we have no updated hooks in the component we invoke the previous SCU or\n\t\t\t\t// traverse the VDOM tree further.\n\t\t\t\tif (allHooksEmpty) {\n\t\t\t\t\treturn prevScu ? prevScu.call(this, p, s, c) : true;\n\t\t\t\t}\n\n\t\t\t\t// We check whether we have components with a nextValue set that\n\t\t\t\t// have values that aren't equal to one another this pushes\n\t\t\t\t// us to update further down the tree\n\t\t\t\tlet shouldUpdate = hookState._component.props !== p;\n\t\t\t\tstateHooks.some(hookItem =\u003e {\n\t\t\t\t\tif (hookItem._nextValue) {\n\t\t\t\t\t\tconst currentValue = hookItem._value[0];\n\t\t\t\t\t\thookItem._value = hookItem._nextValue;\n\t\t\t\t\t\thookItem._nextValue = undefined;\n\t\t\t\t\t\tif (currentValue !== hookItem._value[0]) shouldUpdate = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn prevScu\n\t\t\t\t\t? prevScu.call(this, p, s, c) || shouldUpdate\n\t\t\t\t\t: shouldUpdate;\n\t\t\t}\n\n\t\t\tcurrentComponent.shouldComponentUpdate = updateHookState;\n\t\t}\n\t}\n\n\treturn hookState._nextValue || hookState._value;\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 3);\n\tif (!options._skipEffects \u0026\u0026 argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent.__hooks._pendingEffects.push(state);\n\t}\n}\n\n/**\n * @param {import('./internal').Effect} callback\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useLayoutEffect(callback, args) {\n\t/** @type {import('./internal').EffectHookState} */\n\tconst state = getHookState(currentIndex++, 4);\n\tif (!options._skipEffects \u0026\u0026 argsChanged(state._args, args)) {\n\t\tstate._value = callback;\n\t\tstate._pendingArgs = args;\n\n\t\tcurrentComponent._renderCallbacks.push(state);\n\t}\n}\n\n/** @type {(initialValue: unknown) =\u003e unknown} */\nexport function useRef(initialValue) {\n\tcurrentHook = 5;\n\treturn useMemo(() =\u003e ({ current: initialValue }), []);\n}\n\n/**\n * @param {object} ref\n * @param {() =\u003e object} createHandle\n * @param {unknown[]} args\n * @returns {void}\n */\nexport function useImperativeHandle(ref, createHandle, args) {\n\tcurrentHook = 6;\n\tuseLayoutEffect(\n\t\t() =\u003e {\n\t\t\tif (typeof ref == 'function') {\n\t\t\t\tconst result = ref(createHandle());\n\t\t\t\treturn () =\u003e {\n\t\t\t\t\tref(null);\n\t\t\t\t\tif (result \u0026\u0026 typeof result == 'function') result();\n\t\t\t\t};\n\t\t\t} else if (ref) {\n\t\t\t\tref.current = createHandle();\n\t\t\t\treturn () =\u003e (ref.current = null);\n\t\t\t}\n\t\t},\n\t\targs == null ? args : args.concat(ref)\n\t);\n}\n\n/**\n * @template {unknown} T\n * @param {() =\u003e T} factory\n * @param {unknown[]} args\n * @returns {T}\n */\nexport function useMemo(factory, args) {\n\t/** @type {import('./internal').MemoHookState\u003cT\u003e} */\n\tconst state = getHookState(currentIndex++, 7);\n\tif (argsChanged(state._args, args)) {\n\t\tstate._value = factory();\n\t\tstate._args = args;\n\t\tstate._factory = factory;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * @param {() =\u003e void} callback\n * @param {unknown[]} args\n * @returns {() =\u003e void}\n */\nexport function useCallback(callback, args) {\n\tcurrentHook = 8;\n\treturn useMemo(() =\u003e callback, args);\n}\n\n/**\n * @param {import('./internal').PreactContext} context\n */\nexport function useContext(context) {\n\tconst provider = currentComponent.context[context._id];\n\t// We could skip this call here, but than we'd not call\n\t// `options._hook`. We need to do that in order to make\n\t// the devtools aware of this hook.\n\t/** @type {import('./internal').ContextHookState} */\n\tconst state = getHookState(currentIndex++, 9);\n\t// The devtools needs access to the context object to\n\t// be able to pull of the default value when no provider\n\t// is present in the tree.\n\tstate._context = context;\n\tif (!provider) return context._defaultValue;\n\t// This is probably not safe to convert to \"!\"\n\tif (state._value == null) {\n\t\tstate._value = true;\n\t\tprovider.sub(currentComponent);\n\t}\n\treturn provider.props.value;\n}\n\n/**\n * Display a custom label for a custom hook for the devtools panel\n * @type {\u003cT\u003e(value: T, cb?: (value: T) =\u003e string | number) =\u003e void}\n */\nexport function useDebugValue(value, formatter) {\n\tif (options.useDebugValue) {\n\t\toptions.useDebugValue(\n\t\t\tformatter ? formatter(value) : /** @type {any}*/ (value)\n\t\t);\n\t}\n}\n\n/**\n * @param {(error: unknown, errorInfo: import('preact').ErrorInfo) =\u003e void} cb\n * @returns {[unknown, () =\u003e void]}\n */\nexport function useErrorBoundary(cb) {\n\t/** @type {import('./internal').ErrorBoundaryHookState} */\n\tconst state = getHookState(currentIndex++, 10);\n\tconst errState = useState();\n\tstate._value = cb;\n\tif (!currentComponent.componentDidCatch) {\n\t\tcurrentComponent.componentDidCatch = (err, errorInfo) =\u003e {\n\t\t\tif (state._value) state._value(err, errorInfo);\n\t\t\terrState[1](err);\n\t\t};\n\t}\n\treturn [\n\t\terrState[0],\n\t\t() =\u003e {\n\t\t\terrState[1](undefined);\n\t\t}\n\t];\n}\n\n/** @type {() =\u003e string} */\nexport function useId() {\n\t/** @type {import('./internal').IdHookState} */\n\tconst state = getHookState(currentIndex++, 11);\n\tif (!state._value) {\n\t\t// Grab either the root node or the nearest async boundary node.\n\t\t/** @type {import('./internal').VNode} */\n\t\tlet root = currentComponent._vnode;\n\t\twhile (root !== null \u0026\u0026 !root._mask \u0026\u0026 root._parent !== null) {\n\t\t\troot = root._parent;\n\t\t}\n\n\t\tlet mask = root._mask || (root._mask = [0, 0]);\n\t\tstate._value = 'P' + mask[0] + '-' + mask[1]++;\n\t}\n\n\treturn state._value;\n}\n\n/**\n * After paint effects consumer.\n */\nfunction flushAfterPaintEffects() {\n\tlet component;\n\twhile ((component = afterPaintEffects.shift())) {\n\t\tconst hooks = component.__hooks;\n\t\tif (!component._parentDom || !hooks) continue;\n\t\ttry {\n\t\t\thooks._pendingEffects.some(invokeCleanup);\n\t\t\thooks._pendingEffects.some(invokeEffect);\n\t\t\thooks._pendingEffects = [];\n\t\t} catch (e) {\n\t\t\thooks._pendingEffects = [];\n\t\t\toptions._catchError(e, component._vnode);\n\t\t}\n\t}\n}\n\nlet HAS_RAF = typeof requestAnimationFrame == 'function';\n\n/**\n * Schedule a callback to be invoked after the browser has a chance to paint a new frame.\n * Do this by combining requestAnimationFrame (rAF) + setTimeout to invoke a callback after\n * the next browser frame.\n *\n * Also, schedule a timeout in parallel to the the rAF to ensure the callback is invoked\n * even if RAF doesn't fire (for example if the browser tab is not visible)\n *\n * @param {() =\u003e void} callback\n */\nfunction afterNextFrame(callback) {\n\tconst done = () =\u003e {\n\t\tclearTimeout(timeout);\n\t\tif (HAS_RAF) cancelAnimationFrame(raf);\n\t\tsetTimeout(callback);\n\t};\n\tconst timeout = setTimeout(done, RAF_TIMEOUT);\n\n\tlet raf;\n\tif (HAS_RAF) {\n\t\traf = requestAnimationFrame(done);\n\t}\n}\n\n// Note: if someone used options.debounceRendering = requestAnimationFrame,\n// then effects will ALWAYS run on the NEXT frame instead of the current one, incurring a ~16ms delay.\n// Perhaps this is not such a big deal.\n/**\n * Schedule afterPaintEffects flush after the browser paints\n * @param {number} newQueueLength\n * @returns {void}\n */\nfunction afterPaint(newQueueLength) {\n\tif (newQueueLength === 1 || prevRaf !== options.requestAnimationFrame) {\n\t\tprevRaf = options.requestAnimationFrame;\n\t\t(prevRaf || afterNextFrame)(flushAfterPaintEffects);\n\t}\n}\n\n/**\n * @param {import('./internal').HookState} hook\n * @returns {void}\n */\nfunction invokeCleanup(hook) {\n\t// A hook cleanup can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\tlet cleanup = hook._cleanup;\n\tif (typeof cleanup == 'function') {\n\t\thook._cleanup = undefined;\n\t\tcleanup();\n\t}\n\n\tcurrentComponent = comp;\n}\n\n/**\n * Invoke a Hook's effect\n * @param {import('./internal').EffectHookState} hook\n * @returns {void}\n */\nfunction invokeEffect(hook) {\n\t// A hook call can introduce a call to render which creates a new root, this will call options.vnode\n\t// and move the currentComponent away.\n\tconst comp = currentComponent;\n\thook._cleanup = hook._value();\n\tcurrentComponent = comp;\n}\n\n/**\n * @param {unknown[]} oldArgs\n * @param {unknown[]} newArgs\n * @returns {boolean}\n */\nfunction argsChanged(oldArgs, newArgs) {\n\treturn (\n\t\t!oldArgs ||\n\t\toldArgs.length !== newArgs.length ||\n\t\tnewArgs.some((arg, index) =\u003e arg !== oldArgs[index])\n\t);\n}\n\n/**\n * @template Arg\n * @param {Arg} arg\n * @param {(arg: Arg) =\u003e any} f\n * @returns {any}\n */\nfunction invokeOrReturn(arg, f) {\n\treturn typeof f == 'function' ? f(arg) : f;\n}\n"],"version":3}
+3
vendor/esm.sh/preact@10.29.1/es2022/preact.mjs
···11+/* esm.sh - preact@10.29.1 */
22+var E,v,ee,pe,x,X,_e,te,B,F,T,ne,q,O,j,re,N={},H=[],fe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,D=Array.isArray;function b(_,e){for(var t in e)_[t]=e[t];return _}function G(_){_&&_.parentNode&&_.parentNode.removeChild(_)}function ae(_,e,t){var o,l,n,i={};for(n in e)n=="key"?o=e[n]:n=="ref"?l=e[n]:i[n]=e[n];if(arguments.length>2&&(i.children=arguments.length>3?E.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(n in _.defaultProps)i[n]===void 0&&(i[n]=_.defaultProps[n]);return M(_,i,o,l,null)}function M(_,e,t,o,l){var n={type:_,props:e,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:l??++ee,__i:-1,__u:0};return l==null&&v.vnode!=null&&v.vnode(n),n}function we(){return{current:null}}function R(_){return _.children}function L(_,e){this.props=_,this.context=e}function S(_,e){if(e==null)return _.__?S(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?S(_):null}function he(_){if(_.__P&&_.__d){var e=_.__v,t=e.__e,o=[],l=[],n=b({},e);n.__v=e.__v+1,v.vnode&&v.vnode(n),J(_.__P,n,e,_.__n,_.__P.namespaceURI,32&e.__u?[t]:null,o,t??S(e),!!(32&e.__u),l),n.__v=e.__v,n.__.__k[n.__i]=n,se(o,n,l),e.__e=e.__=null,n.__e!=t&&oe(n)}}function oe(_){if((_=_.__)!=null&&_.__c!=null)return _.__e=_.__c.base=null,_.__k.some(function(e){if(e!=null&&e.__e!=null)return _.__e=_.__c.base=e.__e}),oe(_)}function V(_){(!_.__d&&(_.__d=!0)&&x.push(_)&&!I.__r++||X!=v.debounceRendering)&&((X=v.debounceRendering)||_e)(I)}function I(){try{for(var _,e=1;x.length;)x.length>e&&x.sort(te),_=x.shift(),e=x.length,he(_)}finally{x.length=I.__r=0}}function le(_,e,t,o,l,n,i,c,f,s,p){var r,d,u,y,g,m,a,h=o&&o.__k||H,w=e.length;for(f=de(t,e,h,f,w),r=0;r<w;r++)(u=t.__k[r])!=null&&(d=u.__i!=-1&&h[u.__i]||N,u.__i=r,m=J(_,u,d,l,n,i,c,f,s,p),y=u.__e,u.ref&&d.ref!=u.ref&&(d.ref&&K(d.ref,null,u),p.push(u.ref,u.__c||y,u)),g==null&&y!=null&&(g=y),(a=!!(4&u.__u))||d.__k===u.__k?(f=ie(u,f,_,a),a&&d.__e&&(d.__e=null)):typeof u.type=="function"&&m!==void 0?f=m:y&&(f=y.nextSibling),u.__u&=-7);return t.__e=g,f}function de(_,e,t,o,l){var n,i,c,f,s,p=t.length,r=p,d=0;for(_.__k=new Array(l),n=0;n<l;n++)(i=e[n])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?i=_.__k[n]=M(null,i,null,null,null):D(i)?i=_.__k[n]=M(R,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?i=_.__k[n]=M(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):_.__k[n]=i,f=n+d,i.__=_,i.__b=_.__b+1,c=null,(s=i.__i=ye(i,t,f,r))!=-1&&(r--,(c=t[s])&&(c.__u|=2)),c==null||c.__v==null?(s==-1&&(l>p?d--:l<p&&d++),typeof i.type!="function"&&(i.__u|=4)):s!=f&&(s==f-1?d--:s==f+1?d++:(s>f?d--:d++,i.__u|=4))):_.__k[n]=null;if(r)for(n=0;n<p;n++)(c=t[n])!=null&&(2&c.__u)==0&&(c.__e==o&&(o=S(c)),ue(c,c));return o}function ie(_,e,t,o){var l,n;if(typeof _.type=="function"){for(l=_.__k,n=0;l&&n<l.length;n++)l[n]&&(l[n].__=_,e=ie(l[n],e,t,o));return e}_.__e!=e&&(o&&(e&&_.type&&!e.parentNode&&(e=S(_)),t.insertBefore(_.__e,e||null)),e=_.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ve(_,e){return e=e||[],_==null||typeof _=="boolean"||(D(_)?_.some(function(t){ve(t,e)}):e.push(_)),e}function ye(_,e,t,o){var l,n,i,c=_.key,f=_.type,s=e[t],p=s!=null&&(2&s.__u)==0;if(s===null&&c==null||p&&c==s.key&&f==s.type)return t;if(o>(p?1:0)){for(l=t-1,n=t+1;l>=0||n<e.length;)if((s=e[i=l>=0?l--:n++])!=null&&(2&s.__u)==0&&c==s.key&&f==s.type)return i}return-1}function Y(_,e,t){e[0]=="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||fe.test(e)?t:t+"px"}function A(_,e,t,o,l){var n,i;e:if(e=="style")if(typeof t=="string")_.style.cssText=t;else{if(typeof o=="string"&&(_.style.cssText=o=""),o)for(e in o)t&&e in t||Y(_.style,e,"");if(t)for(e in t)o&&t[e]==o[e]||Y(_.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(ne,"$1")),i=e.toLowerCase(),e=i in _||e=="onFocusOut"||e=="onFocusIn"?i.slice(2):e.slice(2),_.l||(_.l={}),_.l[e+n]=t,t?o?t[T]=o[T]:(t[T]=q,_.addEventListener(e,n?j:O,n)):_.removeEventListener(e,n?j:O,n);else{if(l=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in _)try{_[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?_.removeAttribute(e):_.setAttribute(e,e=="popover"&&t==1?"":t))}}function Z(_){return function(e){if(this.l){var t=this.l[e.type+_];if(e[F]==null)e[F]=q++;else if(e[F]<t[T])return;return t(v.event?v.event(e):e)}}}function J(_,e,t,o,l,n,i,c,f,s){var p,r,d,u,y,g,m,a,h,w,C,U,Q,W,$,k=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(f=!!(32&t.__u),n=[c=e.__e=t.__e]),(p=v.__b)&&p(e);e:if(typeof k=="function")try{if(a=e.props,h=k.prototype&&k.prototype.render,w=(p=k.contextType)&&o[p.__c],C=p?w?w.props.value:p.__:o,t.__c?m=(r=e.__c=t.__c).__=r.__E:(h?e.__c=r=new k(a,C):(e.__c=r=new L(a,C),r.constructor=k,r.render=ge),w&&w.sub(r),r.state||(r.state={}),r.__n=o,d=r.__d=!0,r.__h=[],r._sb=[]),h&&r.__s==null&&(r.__s=r.state),h&&k.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=b({},r.__s)),b(r.__s,k.getDerivedStateFromProps(a,r.__s))),u=r.props,y=r.state,r.__v=e,d)h&&k.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),h&&r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(h&&k.getDerivedStateFromProps==null&&a!==u&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(a,C),e.__v==t.__v||!r.__e&&r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(a,r.__s,C)===!1){e.__v!=t.__v&&(r.props=a,r.state=r.__s,r.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(P){P&&(P.__=e)}),H.push.apply(r.__h,r._sb),r._sb=[],r.__h.length&&i.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(a,r.__s,C),h&&r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(u,y,g)})}if(r.context=C,r.props=a,r.__P=_,r.__e=!1,U=v.__r,Q=0,h)r.state=r.__s,r.__d=!1,U&&U(e),p=r.render(r.props,r.state,r.context),H.push.apply(r.__h,r._sb),r._sb=[];else do r.__d=!1,U&&U(e),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Q<25);r.state=r.__s,r.getChildContext!=null&&(o=b(b({},o),r.getChildContext())),h&&!d&&r.getSnapshotBeforeUpdate!=null&&(g=r.getSnapshotBeforeUpdate(u,y)),W=p!=null&&p.type===R&&p.key==null?ce(p.props.children):p,c=le(_,D(W)?W:[W],e,t,o,l,n,i,c,f,s),r.base=e.__e,e.__u&=-161,r.__h.length&&i.push(r),m&&(r.__E=r.__=null)}catch(P){if(e.__v=null,f||n!=null)if(P.then){for(e.__u|=f?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;n[n.indexOf(c)]=null,e.__e=c}else{for($=n.length;$--;)G(n[$]);z(e)}else e.__e=t.__e,e.__k=t.__k,P.then||z(e);v.__e(P,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):c=e.__e=me(t.__e,e,t,o,l,n,i,f,s);return(p=v.diffed)&&p(e),128&e.__u?void 0:c}function z(_){_&&(_.__c&&(_.__c.__e=!0),_.__k&&_.__k.some(z))}function se(_,e,t){for(var o=0;o<t.length;o++)K(t[o],t[++o],t[++o]);v.__c&&v.__c(e,_),_.some(function(l){try{_=l.__h,l.__h=[],_.some(function(n){n.call(l)})}catch(n){v.__e(n,l.__v)}})}function ce(_){return typeof _!="object"||_==null||_.__b>0?_:D(_)?_.map(ce):b({},_)}function me(_,e,t,o,l,n,i,c,f){var s,p,r,d,u,y,g,m=t.props||N,a=e.props,h=e.type;if(h=="svg"?l="http://www.w3.org/2000/svg":h=="math"?l="http://www.w3.org/1998/Math/MathML":l||(l="http://www.w3.org/1999/xhtml"),n!=null){for(s=0;s<n.length;s++)if((u=n[s])&&"setAttribute"in u==!!h&&(h?u.localName==h:u.nodeType==3)){_=u,n[s]=null;break}}if(_==null){if(h==null)return document.createTextNode(a);_=document.createElementNS(l,h,a.is&&a),c&&(v.__m&&v.__m(e,n),c=!1),n=null}if(h==null)m===a||c&&_.data==a||(_.data=a);else{if(n=n&&E.call(_.childNodes),!c&&n!=null)for(m={},s=0;s<_.attributes.length;s++)m[(u=_.attributes[s]).name]=u.value;for(s in m)u=m[s],s=="dangerouslySetInnerHTML"?r=u:s=="children"||s in a||s=="value"&&"defaultValue"in a||s=="checked"&&"defaultChecked"in a||A(_,s,null,u,l);for(s in a)u=a[s],s=="children"?d=u:s=="dangerouslySetInnerHTML"?p=u:s=="value"?y=u:s=="checked"?g=u:c&&typeof u!="function"||m[s]===u||A(_,s,u,m[s],l);if(p)c||r&&(p.__html==r.__html||p.__html==_.innerHTML)||(_.innerHTML=p.__html),e.__k=[];else if(r&&(_.innerHTML=""),le(e.type=="template"?_.content:_,D(d)?d:[d],e,t,o,h=="foreignObject"?"http://www.w3.org/1999/xhtml":l,n,i,n?n[0]:t.__k&&S(t,0),c,f),n!=null)for(s=n.length;s--;)G(n[s]);c||(s="value",h=="progress"&&y==null?_.removeAttribute("value"):y!=null&&(y!==_[s]||h=="progress"&&!y||h=="option"&&y!=m[s])&&A(_,s,y,m[s],l),s="checked",g!=null&&g!=_[s]&&A(_,s,g,m[s],l))}return _}function K(_,e,t){try{if(typeof _=="function"){var o=typeof _.__u=="function";o&&_.__u(),o&&e==null||(_.__u=_(e))}else _.current=e}catch(l){v.__e(l,t)}}function ue(_,e,t){var o,l;if(v.unmount&&v.unmount(_),(o=_.ref)&&(o.current&&o.current!=_.__e||K(o,null,e)),(o=_.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(n){v.__e(n,e)}o.base=o.__P=null}if(o=_.__k)for(l=0;l<o.length;l++)o[l]&&ue(o[l],e,t||typeof _.type!="function");t||G(_.__e),_.__c=_.__=_.__e=void 0}function ge(_,e,t){return this.constructor(_,t)}function ke(_,e,t){var o,l,n,i;e==document&&(e=document.documentElement),v.__&&v.__(_,e),l=(o=typeof t=="function")?null:t&&t.__k||e.__k,n=[],i=[],J(e,_=(!o&&t||e).__k=ae(R,null,[_]),l||N,N,e.namespaceURI,!o&&t?[t]:l?null:e.firstChild?E.call(e.childNodes):null,n,!o&&t?t:l?l.__e:e.firstChild,o,i),se(n,_,i)}function be(_,e){ke(_,e,be)}function xe(_,e,t){var o,l,n,i,c=b({},_.props);for(n in _.type&&_.type.defaultProps&&(i=_.type.defaultProps),e)n=="key"?o=e[n]:n=="ref"?l=e[n]:c[n]=e[n]===void 0&&i!=null?i[n]:e[n];return arguments.length>2&&(c.children=arguments.length>3?E.call(arguments,2):t),M(_.type,c,o||_.key,l||_.ref,null)}function Ce(_){function e(t){var o,l;return this.getChildContext||(o=new Set,(l={})[e.__c]=this,this.getChildContext=function(){return l},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&o.forEach(function(i){i.__e=!0,V(i)})},this.sub=function(n){o.add(n);var i=n.componentWillUnmount;n.componentWillUnmount=function(){o&&o.delete(n),i&&i.call(n)}}),t.children}return e.__c="__cC"+re++,e.__=_,e.Provider=e.__l=(e.Consumer=function(t,o){return t.children(o)}).contextType=e,e}E=H.slice,v={__e:function(_,e,t,o){for(var l,n,i;e=e.__;)if((l=e.__c)&&!l.__)try{if((n=l.constructor)&&n.getDerivedStateFromError!=null&&(l.setState(n.getDerivedStateFromError(_)),i=l.__d),l.componentDidCatch!=null&&(l.componentDidCatch(_,o||{}),i=l.__d),i)return l.__E=l}catch(c){_=c}throw _}},ee=0,pe=function(_){return _!=null&&_.constructor===void 0},L.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=b({},this.state),typeof _=="function"&&(_=_(b({},t),this.props)),_&&b(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),V(this))},L.prototype.forceUpdate=function(_){this.__v&&(this.__e=!0,_&&this.__h.push(_),V(this))},L.prototype.render=R,x=[],_e=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,te=function(_,e){return _.__v.__b-e.__v.__b},I.__r=0,B=Math.random().toString(8),F="__d"+B,T="__a"+B,ne=/(PointerCapture)$|Capture$/i,q=0,O=Z(!1),j=Z(!0),re=0;export{L as Component,R as Fragment,xe as cloneElement,Ce as createContext,ae as createElement,we as createRef,ae as h,be as hydrate,pe as isValidElement,v as options,ke as render,ve as toChildArray};
33+//# sourceMappingURL=./preact.mjs.map
···11+{"mappings":";AACO,IC0BMA,EChBPC,ECPFC,GA2FSC,GCiFTC,EAWAC,EAEEC,GA0BAC,GC7MFC,EACHC,EACAC,EAcKC,GAaFC,EA+IEC,EACAC,ECpLKC,GNeEC,EAAgC,CAAG,EACnCC,EAAY,CAAA,EACZC,GACZ,oECnBYC,EAAUC,MAAMD,QAStB,SAASE,EAAOC,EAAKC,EAAAA,CAE3B,QAASR,KAAKQ,EAAOD,EAAIP,CAAAA,EAAKQ,EAAMR,CAAAA,EACpC,OAA6BO,CAC9B,CAQgB,SAAAE,EAAWC,EAAAA,CACtBA,GAAQA,EAAKC,YAAYD,EAAKC,WAAWC,YAAYF,CAA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,EAAa,EA+IXC,EAAa+H,EAAAA,EAAiB,EAC9B9H,EAAoB8H,EAAAA,EAAiB,ECpLhC7H,GAAI","names":["slice","options","vnodeId","isValidElement","rerenderQueue","prevDebounce","defer","depthSort","_id","EVENT_DISPATCHED","EVENT_ATTACHED","CAPTURE_REGEX","eventClock","eventProxy","eventProxyCapture","i","EMPTY_OBJ","EMPTY_ARR","IS_NON_DIMENSIONAL","isArray","Array","assign","obj","props","removeNode","node","parentNode","removeChild","createElement","type","children","key","ref","normalizedProps","arguments","length","call","defaultProps","createVNode","original","vnode","__k","__","__b","__e","__c","constructor","__v","__i","__u","createRef","current","Fragment","BaseComponent","context","this","getDomSibling","childIndex","sibling","renderComponent","component","__P","__d","oldVNode","oldDom","commitQueue","refQueue","newVNode","diff","__n","namespaceURI","commitRoot","updateParentDomPointers","base","some","child","enqueueRender","c","push","process","__r","debounceRendering","l","sort","shift","diffChildren","parentDom","renderResult","newParentVNode","oldParentVNode","globalContext","namespace","excessDomChildren","isHydrating","childVNode","newDom","firstChildDom","result","shouldPlace","oldChildren","newChildrenLength","constructNewChildrenArray","applyRef","insert","nextSibling","skewedIndex","matchingIndex","oldChildrenLength","remainingOldChildren","skew","String","findMatchingIndex","unmount","parentVNode","insertBefore","nodeType","toChildArray","out","x","y","matched","setStyle","style","value","setProperty","test","dom","name","oldValue","useCapture","lowerCaseName","o","cssText","replace","toLowerCase","addEventListener","removeEventListener","e","removeAttribute","setAttribute","createEventProxy","eventHandler","event","tmp","isNew","oldProps","oldState","snapshot","clearProcessingException","newProps","isClassComponent","provider","componentContext","renderHook","count","newType","outer","prototype","render","contextType","__E","doRender","sub","state","__h","_sb","__s","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","apply","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","cloneNode","then","MODE_HYDRATE","indexOf","markAsForce","diffElementNodes","diffed","root","cb","map","newHtml","oldHtml","newChildren","inputValue","checked","localName","document","createTextNode","createElementNS","is","__m","data","childNodes","attributes","__html","innerHTML","content","undefined","hasRefUnmount","skipRemove","r","componentWillUnmount","replaceNode","documentElement","firstChild","hydrate","cloneElement","createContext","defaultValue","Context","subs","ctx","Set","_props","forEach","add","old","delete","Provider","__l","Consumer","contextValue","error","errorInfo","ctor","handled","getDerivedStateFromError","setState","componentDidCatch","update","callback","s","forceUpdate","Promise","bind","resolve","setTimeout","a","b","Math","random","toString"],"sources":["../esm/npm/preact@10.29.1/node_modules/preact/src/constants.js","../esm/npm/preact@10.29.1/node_modules/preact/src/util.js","../esm/npm/preact@10.29.1/node_modules/preact/src/options.js","../esm/npm/preact@10.29.1/node_modules/preact/src/create-element.js","../esm/npm/preact@10.29.1/node_modules/preact/src/component.js","../esm/npm/preact@10.29.1/node_modules/preact/src/diff/props.js","../esm/npm/preact@10.29.1/node_modules/preact/src/create-context.js","../esm/npm/preact@10.29.1/node_modules/preact/src/diff/children.js","../esm/npm/preact@10.29.1/node_modules/preact/src/diff/index.js","../esm/npm/preact@10.29.1/node_modules/preact/src/render.js","../esm/npm/preact@10.29.1/node_modules/preact/src/clone-element.js","../esm/npm/preact@10.29.1/node_modules/preact/src/diff/catch-error.js"],"sourcesContent":["/** Normal hydration that attaches to a DOM tree but does not diff it. */\nexport const MODE_HYDRATE = 1 \u003c\u003c 5;\n/** Signifies this VNode suspended on the previous render */\nexport const MODE_SUSPENDED = 1 \u003c\u003c 7;\n/** Indicates that this node needs to be inserted while patching children */\nexport const INSERT_VNODE = 1 \u003c\u003c 2;\n/** Indicates a VNode has been matched with another VNode in the diff */\nexport const MATCHED = 1 \u003c\u003c 1;\n\n/** Reset all mode flags */\nexport const RESET_MODE = ~(MODE_HYDRATE | MODE_SUSPENDED);\n\nexport const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nexport const XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\nexport const MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n\nexport const NULL = null;\nexport const UNDEFINED = undefined;\nexport const EMPTY_OBJ = /** @type {any} */ ({});\nexport const EMPTY_ARR = [];\nexport const IS_NON_DIMENSIONAL =\n\t/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;\n","import { EMPTY_ARR } from './constants';\n\nexport const isArray = Array.isArray;\n\n/**\n * Assign properties from `props` to `obj`\n * @template O, P The obj and props types\n * @param {O} obj The object to copy properties to\n * @param {P} props The object to copy properties from\n * @returns {O \u0026 P}\n */\nexport function assign(obj, props) {\n\t// @ts-expect-error We change the type of `obj` to be `O \u0026 P`\n\tfor (let i in props) obj[i] = props[i];\n\treturn /** @type {O \u0026 P} */ (obj);\n}\n\n/**\n * Remove a child node from its parent if attached. This is a workaround for\n * IE11 which doesn't support `Element.prototype.remove()`. Using this function\n * is smaller than including a dedicated polyfill.\n * @param {import('./index').ContainerNode} node The node to remove\n */\nexport function removeNode(node) {\n\tif (node \u0026\u0026 node.parentNode) node.parentNode.removeChild(node);\n}\n\nexport const slice = EMPTY_ARR.slice;\n","import { _catchError } from './diff/catch-error';\n\n/**\n * The `option` object can potentially contain callback functions\n * that are called during various stages of our renderer. This is the\n * foundation on which all our addons like `preact/debug`, `preact/compat`,\n * and `preact/hooks` are based on. See the `Options` type in `internal.d.ts`\n * for a full list of available option hooks (most editors/IDEs allow you to\n * ctrl+click or cmd+click on mac the type definition below).\n * @type {import('./internal').Options}\n */\nconst options = {\n\t_catchError\n};\n\nexport default options;\n","import { slice } from './util';\nimport options from './options';\nimport { NULL, UNDEFINED } from './constants';\n\nlet vnodeId = 0;\n\n/**\n * Create an virtual node (used for JSX)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component constructor for this\n * virtual node\n * @param {object | null | undefined} [props] The properties of the virtual node\n * @param {Array\u003cimport('.').ComponentChildren\u003e} [children] The children of the\n * virtual node\n * @returns {import('./internal').VNode}\n */\nexport function createElement(type, props, children) {\n\tlet normalizedProps = {},\n\t\tkey,\n\t\tref,\n\t\ti;\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse normalizedProps[i] = props[i];\n\t}\n\n\tif (arguments.length \u003e 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length \u003e 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\t// If a Component VNode, check for and apply defaultProps\n\t// Note: type may be undefined in development, must never error here.\n\tif (typeof type == 'function' \u0026\u0026 type.defaultProps != NULL) {\n\t\tfor (i in type.defaultProps) {\n\t\t\tif (normalizedProps[i] === UNDEFINED) {\n\t\t\t\tnormalizedProps[i] = type.defaultProps[i];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn createVNode(type, normalizedProps, key, ref, NULL);\n}\n\n/**\n * Create a VNode (used internally by Preact)\n * @param {import('./internal').VNode[\"type\"]} type The node name or Component\n * Constructor for this virtual node\n * @param {object | string | number | null} props The properties of this virtual node.\n * If this virtual node represents a text node, this is the text of the node (string or number).\n * @param {string | number | null} key The key for this virtual node, used when\n * diffing it against its children\n * @param {import('./internal').VNode[\"ref\"]} ref The ref property that will\n * receive a reference to its created child\n * @returns {import('./internal').VNode}\n */\nexport function createVNode(type, props, key, ref, original) {\n\t// V8 seems to be better at detecting type shapes if the object is allocated from the same call site\n\t// Do not inline into createElement and coerceToVNode!\n\t/** @type {import('./internal').VNode} */\n\tconst vnode = {\n\t\ttype,\n\t\tprops,\n\t\tkey,\n\t\tref,\n\t\t_children: NULL,\n\t\t_parent: NULL,\n\t\t_depth: 0,\n\t\t_dom: NULL,\n\t\t_component: NULL,\n\t\tconstructor: UNDEFINED,\n\t\t_original: original == NULL ? ++vnodeId : original,\n\t\t_index: -1,\n\t\t_flags: 0\n\t};\n\n\t// Only invoke the vnode hook if this was *not* a direct copy:\n\tif (original == NULL \u0026\u0026 options.vnode != NULL) options.vnode(vnode);\n\n\treturn vnode;\n}\n\nexport function createRef() {\n\treturn { current: NULL };\n}\n\nexport function Fragment(props) {\n\treturn props.children;\n}\n\n/**\n * Check if a the argument is a valid Preact VNode.\n * @param {*} vnode\n * @returns {vnode is VNode}\n */\nexport const isValidElement = vnode =\u003e\n\tvnode != NULL \u0026\u0026 vnode.constructor === UNDEFINED;\n","import { assign } from './util';\nimport { diff, commitRoot } from './diff/index';\nimport options from './options';\nimport { Fragment } from './create-element';\nimport { MODE_HYDRATE, NULL } from './constants';\n\n/**\n * Base Component class. Provides `setState()` and `forceUpdate()`, which\n * trigger rendering\n * @param {object} props The initial component props\n * @param {object} context The initial context from parent components'\n * getChildContext\n */\nexport function BaseComponent(props, context) {\n\tthis.props = props;\n\tthis.context = context;\n}\n\n/**\n * Update component state and schedule a re-render.\n * @this {import('./internal').Component}\n * @param {object | ((s: object, p: object) =\u003e object)} update A hash of state\n * properties to update with new values or a function that given the current\n * state and props returns a new partial state\n * @param {() =\u003e void} [callback] A function to be called once component state is\n * updated\n */\nBaseComponent.prototype.setState = function (update, callback) {\n\t// only clone state when copying to nextState the first time.\n\tlet s;\n\tif (this._nextState != NULL \u0026\u0026 this._nextState != this.state) {\n\t\ts = this._nextState;\n\t} else {\n\t\ts = this._nextState = assign({}, this.state);\n\t}\n\n\tif (typeof update == 'function') {\n\t\t// Some libraries like `immer` mark the current state as readonly,\n\t\t// preventing us from mutating it, so we need to clone it. See #2716\n\t\tupdate = update(assign({}, s), this.props);\n\t}\n\n\tif (update) {\n\t\tassign(s, update);\n\t}\n\n\t// Skip update if updater function returned null\n\tif (update == NULL) return;\n\n\tif (this._vnode) {\n\t\tif (callback) {\n\t\t\tthis._stateCallbacks.push(callback);\n\t\t}\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Immediately perform a synchronous re-render of the component\n * @this {import('./internal').Component}\n * @param {() =\u003e void} [callback] A function to be called after component is\n * re-rendered\n */\nBaseComponent.prototype.forceUpdate = function (callback) {\n\tif (this._vnode) {\n\t\t// Set render mode so that we can differentiate where the render request\n\t\t// is coming from. We need this because forceUpdate should never call\n\t\t// shouldComponentUpdate\n\t\tthis._force = true;\n\t\tif (callback) this._renderCallbacks.push(callback);\n\t\tenqueueRender(this);\n\t}\n};\n\n/**\n * Accepts `props` and `state`, and returns a new Virtual DOM tree to build.\n * Virtual DOM is generally constructed via [JSX](https://jasonformat.com/wtf-is-jsx).\n * @param {object} props Props (eg: JSX attributes) received from parent\n * element/component\n * @param {object} state The component's current state\n * @param {object} context Context object, as returned by the nearest\n * ancestor's `getChildContext()`\n * @returns {ComponentChildren | void}\n */\nBaseComponent.prototype.render = Fragment;\n\n/**\n * @param {import('./internal').VNode} vnode\n * @param {number | null} [childIndex]\n */\nexport function getDomSibling(vnode, childIndex) {\n\tif (childIndex == NULL) {\n\t\t// Use childIndex==null as a signal to resume the search from the vnode's sibling\n\t\treturn vnode._parent\n\t\t\t? getDomSibling(vnode._parent, vnode._index + 1)\n\t\t\t: NULL;\n\t}\n\n\tlet sibling;\n\tfor (; childIndex \u003c vnode._children.length; childIndex++) {\n\t\tsibling = vnode._children[childIndex];\n\n\t\tif (sibling != NULL \u0026\u0026 sibling._dom != NULL) {\n\t\t\t// Since updateParentDomPointers keeps _dom pointer correct,\n\t\t\t// we can rely on _dom to tell us if this subtree contains a\n\t\t\t// rendered DOM node, and what the first rendered DOM node is\n\t\t\treturn sibling._dom;\n\t\t}\n\t}\n\n\t// If we get here, we have not found a DOM node in this vnode's children.\n\t// We must resume from this vnode's sibling (in it's parent _children array)\n\t// Only climb up and search the parent if we aren't searching through a DOM\n\t// VNode (meaning we reached the DOM parent of the original vnode that began\n\t// the search)\n\treturn typeof vnode.type == 'function' ? getDomSibling(vnode) : NULL;\n}\n\n/**\n * Trigger in-place re-rendering of a component.\n * @param {import('./internal').Component} component The component to rerender\n */\nfunction renderComponent(component) {\n\tif (component._parentDom \u0026\u0026 component._dirty) {\n\t\tlet oldVNode = component._vnode,\n\t\t\toldDom = oldVNode._dom,\n\t\t\tcommitQueue = [],\n\t\t\trefQueue = [],\n\t\t\tnewVNode = assign({}, oldVNode);\n\t\tnewVNode._original = oldVNode._original + 1;\n\t\tif (options.vnode) options.vnode(newVNode);\n\n\t\tdiff(\n\t\t\tcomponent._parentDom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tcomponent._globalContext,\n\t\t\tcomponent._parentDom.namespaceURI,\n\t\t\toldVNode._flags \u0026 MODE_HYDRATE ? [oldDom] : NULL,\n\t\t\tcommitQueue,\n\t\t\toldDom == NULL ? getDomSibling(oldVNode) : oldDom,\n\t\t\t!!(oldVNode._flags \u0026 MODE_HYDRATE),\n\t\t\trefQueue\n\t\t);\n\n\t\tnewVNode._original = oldVNode._original;\n\t\tnewVNode._parent._children[newVNode._index] = newVNode;\n\t\tcommitRoot(commitQueue, newVNode, refQueue);\n\t\toldVNode._dom = oldVNode._parent = null;\n\n\t\tif (newVNode._dom != oldDom) {\n\t\t\tupdateParentDomPointers(newVNode);\n\t\t}\n\t}\n}\n\n/**\n * @param {import('./internal').VNode} vnode\n */\nfunction updateParentDomPointers(vnode) {\n\tif ((vnode = vnode._parent) != NULL \u0026\u0026 vnode._component != NULL) {\n\t\tvnode._dom = vnode._component.base = NULL;\n\t\tvnode._children.some(child =\u003e {\n\t\t\tif (child != NULL \u0026\u0026 child._dom != NULL) {\n\t\t\t\treturn (vnode._dom = vnode._component.base = child._dom);\n\t\t\t}\n\t\t});\n\n\t\treturn updateParentDomPointers(vnode);\n\t}\n}\n\n/**\n * The render queue\n * @type {Array\u003cimport('./internal').Component\u003e}\n */\nlet rerenderQueue = [];\n\n/*\n * The value of `Component.debounce` must asynchronously invoke the passed in callback. It is\n * important that contributors to Preact can consistently reason about what calls to `setState`, etc.\n * do, and when their effects will be applied. See the links below for some further reading on designing\n * asynchronous APIs.\n * * [Designing APIs for Asynchrony](https://blog.izs.me/2013/08/designing-apis-for-asynchrony)\n * * [Callbacks synchronous and asynchronous](https://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/)\n */\n\nlet prevDebounce;\n\nconst defer =\n\ttypeof Promise == 'function'\n\t\t? Promise.prototype.then.bind(Promise.resolve())\n\t\t: setTimeout;\n\n/**\n * Enqueue a rerender of a component\n * @param {import('./internal').Component} c The component to rerender\n */\nexport function enqueueRender(c) {\n\tif (\n\t\t(!c._dirty \u0026\u0026\n\t\t\t(c._dirty = true) \u0026\u0026\n\t\t\trerenderQueue.push(c) \u0026\u0026\n\t\t\t!process._rerenderCount++) ||\n\t\tprevDebounce != options.debounceRendering\n\t) {\n\t\tprevDebounce = options.debounceRendering;\n\t\t(prevDebounce || defer)(process);\n\t}\n}\n\n/**\n * @param {import('./internal').Component} a\n * @param {import('./internal').Component} b\n */\nconst depthSort = (a, b) =\u003e a._vnode._depth - b._vnode._depth;\n\n/** Flush the render queue by rerendering all queued components */\nfunction process() {\n\ttry {\n\t\tlet c,\n\t\t\tl = 1;\n\n\t\t// Don't update `renderCount` yet. Keep its value non-zero to prevent unnecessary\n\t\t// process() calls from getting scheduled while `queue` is still being consumed.\n\t\twhile (rerenderQueue.length) {\n\t\t\t// Keep the rerender queue sorted by (depth, insertion order). The queue\n\t\t\t// will initially be sorted on the first iteration only if it has more than 1 item.\n\t\t\t//\n\t\t\t// New items can be added to the queue e.g. when rerendering a provider, so we want to\n\t\t\t// keep the order from top to bottom with those new items so we can handle them in a\n\t\t\t// single pass\n\t\t\tif (rerenderQueue.length \u003e l) {\n\t\t\t\trerenderQueue.sort(depthSort);\n\t\t\t}\n\n\t\t\tc = rerenderQueue.shift();\n\t\t\tl = rerenderQueue.length;\n\n\t\t\trenderComponent(c);\n\t\t}\n\t} finally {\n\t\trerenderQueue.length = process._rerenderCount = 0;\n\t}\n}\n\nprocess._rerenderCount = 0;\n","import { IS_NON_DIMENSIONAL, NULL, SVG_NAMESPACE } from '../constants';\nimport options from '../options';\n\n// Per-instance unique key for event clock stamps. Each Preact copy on the page\n// gets its own random suffix so that `_dispatched` / `_attached` properties on\n// shared event objects and handler functions cannot collide across instances.\n// ~1 in 60M collision odds - if you have that many praect versions on the page,\n// you deserve some weird bugs.\n// In 11 we can replace this with a\n// Symbol\nlet _id = Math.random().toString(8),\n\tEVENT_DISPATCHED = '__d' + _id,\n\tEVENT_ATTACHED = '__a' + _id;\n\nfunction setStyle(style, key, value) {\n\tif (key[0] == '-') {\n\t\tstyle.setProperty(key, value == NULL ? '' : value);\n\t} else if (value == NULL) {\n\t\tstyle[key] = '';\n\t} else if (typeof value != 'number' || IS_NON_DIMENSIONAL.test(key)) {\n\t\tstyle[key] = value;\n\t} else {\n\t\tstyle[key] = value + 'px';\n\t}\n}\n\nconst CAPTURE_REGEX = /(PointerCapture)$|Capture$/i;\n\n// A logical clock to solve issues like https://github.com/preactjs/preact/issues/3927.\n// When the DOM performs an event it leaves micro-ticks in between bubbling up which means that\n// an event can trigger on a newly reated DOM-node while the event bubbles up.\n//\n// Originally inspired by Vue\n// (https://github.com/vuejs/core/blob/caeb8a68811a1b0f79/packages/runtime-dom/src/modules/events.ts#L90-L101),\n// but modified to use a logical clock instead of Date.now() in case event handlers get attached\n// and events get dispatched during the same millisecond.\n//\n// The clock is incremented after each new event dispatch. This allows 1 000 000 new events\n// per second for over 280 years before the value reaches Number.MAX_SAFE_INTEGER (2**53 - 1).\nlet eventClock = 0;\n\n/**\n * Set a property value on a DOM node\n * @param {import('../internal').PreactElement} dom The DOM node to modify\n * @param {string} name The name of the property to set\n * @param {*} value The value to set the property to\n * @param {*} oldValue The old value the property had\n * @param {string} namespace Whether or not this DOM node is an SVG node or not\n */\nexport function setProperty(dom, name, value, oldValue, namespace) {\n\tlet useCapture;\n\n\to: if (name == 'style') {\n\t\tif (typeof value == 'string') {\n\t\t\tdom.style.cssText = value;\n\t\t} else {\n\t\t\tif (typeof oldValue == 'string') {\n\t\t\t\tdom.style.cssText = oldValue = '';\n\t\t\t}\n\n\t\t\tif (oldValue) {\n\t\t\t\tfor (name in oldValue) {\n\t\t\t\t\tif (!(value \u0026\u0026 name in value)) {\n\t\t\t\t\t\tsetStyle(dom.style, name, '');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\tfor (name in value) {\n\t\t\t\t\tif (!oldValue || value[name] != oldValue[name]) {\n\t\t\t\t\t\tsetStyle(dom.style, name, value[name]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t// Benchmark for comparison: https://esbench.com/bench/574c954bdb965b9a00965ac6\n\telse if (name[0] == 'o' \u0026\u0026 name[1] == 'n') {\n\t\tuseCapture = name != (name = name.replace(CAPTURE_REGEX, '$1'));\n\t\tconst lowerCaseName = name.toLowerCase();\n\n\t\t// Infer correct casing for DOM built-in events:\n\t\tif (lowerCaseName in dom || name == 'onFocusOut' || name == 'onFocusIn')\n\t\t\tname = lowerCaseName.slice(2);\n\t\telse name = name.slice(2);\n\n\t\tif (!dom._listeners) dom._listeners = {};\n\t\tdom._listeners[name + useCapture] = value;\n\n\t\tif (value) {\n\t\t\tif (!oldValue) {\n\t\t\t\tvalue[EVENT_ATTACHED] = eventClock;\n\t\t\t\tdom.addEventListener(\n\t\t\t\t\tname,\n\t\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\t\tuseCapture\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tvalue[EVENT_ATTACHED] = oldValue[EVENT_ATTACHED];\n\t\t\t}\n\t\t} else {\n\t\t\tdom.removeEventListener(\n\t\t\t\tname,\n\t\t\t\tuseCapture ? eventProxyCapture : eventProxy,\n\t\t\t\tuseCapture\n\t\t\t);\n\t\t}\n\t} else {\n\t\tif (namespace == SVG_NAMESPACE) {\n\t\t\t// Normalize incorrect prop usage for SVG:\n\t\t\t// - xlink:href / xlinkHref --\u003e href (xlink:href was removed from SVG and isn't needed)\n\t\t\t// - className --\u003e class\n\t\t\tname = name.replace(/xlink(H|:h)/, 'h').replace(/sName$/, 's');\n\t\t} else if (\n\t\t\tname != 'width' \u0026\u0026\n\t\t\tname != 'height' \u0026\u0026\n\t\t\tname != 'href' \u0026\u0026\n\t\t\tname != 'list' \u0026\u0026\n\t\t\tname != 'form' \u0026\u0026\n\t\t\t// Default value in browsers is `-1` and an empty string is\n\t\t\t// cast to `0` instead\n\t\t\tname != 'tabIndex' \u0026\u0026\n\t\t\tname != 'download' \u0026\u0026\n\t\t\tname != 'rowSpan' \u0026\u0026\n\t\t\tname != 'colSpan' \u0026\u0026\n\t\t\tname != 'role' \u0026\u0026\n\t\t\tname != 'popover' \u0026\u0026\n\t\t\tname in dom\n\t\t) {\n\t\t\ttry {\n\t\t\t\tdom[name] = value == NULL ? '' : value;\n\t\t\t\t// labelled break is 1b smaller here than a return statement (sorry)\n\t\t\t\tbreak o;\n\t\t\t} catch (e) {}\n\t\t}\n\n\t\t// aria- and data- attributes have no boolean representation.\n\t\t// A `false` value is different from the attribute not being\n\t\t// present, so we can't remove it. For non-boolean aria\n\t\t// attributes we could treat false as a removal, but the\n\t\t// amount of exceptions would cost too many bytes. On top of\n\t\t// that other frameworks generally stringify `false`.\n\n\t\tif (typeof value == 'function') {\n\t\t\t// never serialize functions as attribute values\n\t\t} else if (value != NULL \u0026\u0026 (value !== false || name[4] == '-')) {\n\t\t\tdom.setAttribute(name, name == 'popover' \u0026\u0026 value == true ? '' : value);\n\t\t} else {\n\t\t\tdom.removeAttribute(name);\n\t\t}\n\t}\n}\n\n/**\n * Create an event proxy function.\n * @param {boolean} useCapture Is the event handler for the capture phase.\n * @private\n */\nfunction createEventProxy(useCapture) {\n\t/**\n\t * Proxy an event to hooked event handlers\n\t * @param {import('../internal').PreactEvent} e The event object from the browser\n\t * @private\n\t */\n\treturn function (e) {\n\t\tif (this._listeners) {\n\t\t\tconst eventHandler = this._listeners[e.type + useCapture];\n\t\t\tif (e[EVENT_DISPATCHED] == NULL) {\n\t\t\t\te[EVENT_DISPATCHED] = eventClock++;\n\n\t\t\t\t// When `e[EVENT_DISPATCHED]` is smaller than the time when the targeted event\n\t\t\t\t// handler was attached we know we have bubbled up to an element that was added\n\t\t\t\t// during patching the DOM.\n\t\t\t} else if (e[EVENT_DISPATCHED] \u003c eventHandler[EVENT_ATTACHED]) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn eventHandler(options.event ? options.event(e) : e);\n\t\t}\n\t};\n}\n\nconst eventProxy = createEventProxy(false);\nconst eventProxyCapture = createEventProxy(true);\n","import { enqueueRender } from './component';\nimport { NULL } from './constants';\n\nexport let i = 0;\n\nexport function createContext(defaultValue) {\n\tfunction Context(props) {\n\t\tif (!this.getChildContext) {\n\t\t\t/** @type {Set\u003cimport('./internal').Component\u003e | null} */\n\t\t\tlet subs = new Set();\n\t\t\tlet ctx = {};\n\t\t\tctx[Context._id] = this;\n\n\t\t\tthis.getChildContext = () =\u003e ctx;\n\n\t\t\tthis.componentWillUnmount = () =\u003e {\n\t\t\t\tsubs = NULL;\n\t\t\t};\n\n\t\t\tthis.shouldComponentUpdate = function (_props) {\n\t\t\t\t// @ts-expect-error even\n\t\t\t\tif (this.props.value != _props.value) {\n\t\t\t\t\tsubs.forEach(c =\u003e {\n\t\t\t\t\t\tc._force = true;\n\t\t\t\t\t\tenqueueRender(c);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.sub = c =\u003e {\n\t\t\t\tsubs.add(c);\n\t\t\t\tlet old = c.componentWillUnmount;\n\t\t\t\tc.componentWillUnmount = () =\u003e {\n\t\t\t\t\tif (subs) {\n\t\t\t\t\t\tsubs.delete(c);\n\t\t\t\t\t}\n\t\t\t\t\tif (old) old.call(c);\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\treturn props.children;\n\t}\n\n\tContext._id = '__cC' + i++;\n\tContext._defaultValue = defaultValue;\n\n\t/** @type {import('./internal').FunctionComponent} */\n\tContext.Consumer = (props, contextValue) =\u003e {\n\t\treturn props.children(contextValue);\n\t};\n\n\t// we could also get rid of _contextRef entirely\n\tContext.Provider =\n\t\tContext._contextRef =\n\t\tContext.Consumer.contextType =\n\t\t\tContext;\n\n\treturn Context;\n}\n","import { diff, unmount, applyRef } from './index';\nimport { createVNode, Fragment } from '../create-element';\nimport {\n\tEMPTY_OBJ,\n\tEMPTY_ARR,\n\tINSERT_VNODE,\n\tMATCHED,\n\tUNDEFINED,\n\tNULL\n} from '../constants';\nimport { isArray } from '../util';\nimport { getDomSibling } from '../component';\n\n/**\n * @typedef {import('../internal').ComponentChildren} ComponentChildren\n * @typedef {import('../internal').Component} Component\n * @typedef {import('../internal').PreactElement} PreactElement\n * @typedef {import('../internal').VNode} VNode\n */\n\n/**\n * Diff the children of a virtual node\n * @param {PreactElement} parentDom The DOM element whose children are being\n * diffed\n * @param {ComponentChildren[]} renderResult\n * @param {VNode} newParentVNode The new virtual node whose children should be\n * diff'ed against oldParentVNode\n * @param {VNode} oldParentVNode The old virtual node whose children should be\n * diff'ed against newParentVNode\n * @param {object} globalContext The current context object - modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array\u003cPreactElement\u003e} excessDomChildren\n * @param {Array\u003cComponent\u003e} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diffChildren(\n\tparentDom,\n\trenderResult,\n\tnewParentVNode,\n\toldParentVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\tlet i,\n\t\t/** @type {VNode} */\n\t\toldVNode,\n\t\t/** @type {VNode} */\n\t\tchildVNode,\n\t\t/** @type {PreactElement} */\n\t\tnewDom,\n\t\t/** @type {PreactElement} */\n\t\tfirstChildDom;\n\n\t// This is a compression of oldParentVNode!=null \u0026\u0026 oldParentVNode != EMPTY_OBJ \u0026\u0026 oldParentVNode._children || EMPTY_ARR\n\t// as EMPTY_OBJ._children should be `undefined`.\n\t/** @type {VNode[]} */\n\tlet oldChildren = (oldParentVNode \u0026\u0026 oldParentVNode._children) || EMPTY_ARR;\n\n\tlet newChildrenLength = renderResult.length;\n\n\toldDom = constructNewChildrenArray(\n\t\tnewParentVNode,\n\t\trenderResult,\n\t\toldChildren,\n\t\toldDom,\n\t\tnewChildrenLength\n\t);\n\n\tfor (i = 0; i \u003c newChildrenLength; i++) {\n\t\tchildVNode = newParentVNode._children[i];\n\t\tif (childVNode == NULL) continue;\n\n\t\t// At this point, constructNewChildrenArray has assigned _index to be the\n\t\t// matchingIndex for this VNode's oldVNode (or -1 if there is no oldVNode).\n\t\toldVNode =\n\t\t\t(childVNode._index != -1 \u0026\u0026 oldChildren[childVNode._index]) || EMPTY_OBJ;\n\n\t\t// Update childVNode._index to its final index\n\t\tchildVNode._index = i;\n\n\t\t// Morph the old element into the new one, but don't append it to the dom yet\n\t\tlet result = diff(\n\t\t\tparentDom,\n\t\t\tchildVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\toldDom,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\n\t\t// Adjust DOM nodes\n\t\tnewDom = childVNode._dom;\n\t\tif (childVNode.ref \u0026\u0026 oldVNode.ref != childVNode.ref) {\n\t\t\tif (oldVNode.ref) {\n\t\t\t\tapplyRef(oldVNode.ref, NULL, childVNode);\n\t\t\t}\n\t\t\trefQueue.push(\n\t\t\t\tchildVNode.ref,\n\t\t\t\tchildVNode._component || newDom,\n\t\t\t\tchildVNode\n\t\t\t);\n\t\t}\n\n\t\tif (firstChildDom == NULL \u0026\u0026 newDom != NULL) {\n\t\t\tfirstChildDom = newDom;\n\t\t}\n\n\t\tlet shouldPlace = !!(childVNode._flags \u0026 INSERT_VNODE);\n\t\tif (shouldPlace || oldVNode._children === childVNode._children) {\n\t\t\toldDom = insert(childVNode, oldDom, parentDom, shouldPlace);\n\n\t\t\t// When a matched VNode is physically moved via INSERT_VNODE, its old\n\t\t\t// _dom pointer becomes a stale positional reference. Clear it so that\n\t\t\t// getDomSibling (called from nested diffs) won't return this stale\n\t\t\t// reference and mis-place subsequent DOM nodes. See #5065.\n\t\t\tif (shouldPlace \u0026\u0026 oldVNode._dom) {\n\t\t\t\toldVNode._dom = NULL;\n\t\t\t}\n\t\t} else if (typeof childVNode.type == 'function' \u0026\u0026 result !== UNDEFINED) {\n\t\t\toldDom = result;\n\t\t} else if (newDom) {\n\t\t\toldDom = newDom.nextSibling;\n\t\t}\n\n\t\t// Unset diffing flags\n\t\tchildVNode._flags \u0026= ~(INSERT_VNODE | MATCHED);\n\t}\n\n\tnewParentVNode._dom = firstChildDom;\n\n\treturn oldDom;\n}\n\n/**\n * @param {VNode} newParentVNode\n * @param {ComponentChildren[]} renderResult\n * @param {VNode[]} oldChildren\n */\nfunction constructNewChildrenArray(\n\tnewParentVNode,\n\trenderResult,\n\toldChildren,\n\toldDom,\n\tnewChildrenLength\n) {\n\t/** @type {number} */\n\tlet i;\n\t/** @type {VNode} */\n\tlet childVNode;\n\t/** @type {VNode} */\n\tlet oldVNode;\n\n\tlet oldChildrenLength = oldChildren.length,\n\t\tremainingOldChildren = oldChildrenLength;\n\n\tlet skew = 0;\n\n\tnewParentVNode._children = new Array(newChildrenLength);\n\tfor (i = 0; i \u003c newChildrenLength; i++) {\n\t\t// @ts-expect-error We are reusing the childVNode variable to hold both the\n\t\t// pre and post normalized childVNode\n\t\tchildVNode = renderResult[i];\n\n\t\tif (\n\t\t\tchildVNode == NULL ||\n\t\t\ttypeof childVNode == 'boolean' ||\n\t\t\ttypeof childVNode == 'function'\n\t\t) {\n\t\t\tnewParentVNode._children[i] = NULL;\n\t\t\tcontinue;\n\t\t}\n\t\t// If this newVNode is being reused (e.g. \u003cdiv\u003e{reuse}{reuse}\u003c/div\u003e) in the same diff,\n\t\t// or we are rendering a component (e.g. setState) copy the oldVNodes so it can have\n\t\t// it's own DOM \u0026 etc. pointers\n\t\telse if (\n\t\t\ttypeof childVNode == 'string' ||\n\t\t\ttypeof childVNode == 'number' ||\n\t\t\t// eslint-disable-next-line valid-typeof\n\t\t\ttypeof childVNode == 'bigint' ||\n\t\t\tchildVNode.constructor == String\n\t\t) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tNULL,\n\t\t\t\tchildVNode,\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (isArray(childVNode)) {\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tFragment,\n\t\t\t\t{ children: childVNode },\n\t\t\t\tNULL,\n\t\t\t\tNULL,\n\t\t\t\tNULL\n\t\t\t);\n\t\t} else if (childVNode.constructor === UNDEFINED \u0026\u0026 childVNode._depth \u003e 0) {\n\t\t\t// VNode is already in use, clone it. This can happen in the following\n\t\t\t// scenario:\n\t\t\t// const reuse = \u003cdiv /\u003e\n\t\t\t// \u003cdiv\u003e{reuse}\u003cspan /\u003e{reuse}\u003c/div\u003e\n\t\t\tchildVNode = newParentVNode._children[i] = createVNode(\n\t\t\t\tchildVNode.type,\n\t\t\t\tchildVNode.props,\n\t\t\t\tchildVNode.key,\n\t\t\t\tchildVNode.ref ? childVNode.ref : NULL,\n\t\t\t\tchildVNode._original\n\t\t\t);\n\t\t} else {\n\t\t\tnewParentVNode._children[i] = childVNode;\n\t\t}\n\n\t\tconst skewedIndex = i + skew;\n\t\tchildVNode._parent = newParentVNode;\n\t\tchildVNode._depth = newParentVNode._depth + 1;\n\n\t\t// Temporarily store the matchingIndex on the _index property so we can pull\n\t\t// out the oldVNode in diffChildren. We'll override this to the VNode's\n\t\t// final index after using this property to get the oldVNode\n\t\tconst matchingIndex = (childVNode._index = findMatchingIndex(\n\t\t\tchildVNode,\n\t\t\toldChildren,\n\t\t\tskewedIndex,\n\t\t\tremainingOldChildren\n\t\t));\n\n\t\toldVNode = NULL;\n\t\tif (matchingIndex != -1) {\n\t\t\toldVNode = oldChildren[matchingIndex];\n\t\t\tremainingOldChildren--;\n\t\t\tif (oldVNode) {\n\t\t\t\toldVNode._flags |= MATCHED;\n\t\t\t}\n\t\t}\n\n\t\t// Here, we define isMounting for the purposes of the skew diffing\n\t\t// algorithm. Nodes that are unsuspending are considered mounting and we detect\n\t\t// this by checking if oldVNode._original == null\n\t\tconst isMounting = oldVNode == NULL || oldVNode._original == NULL;\n\n\t\tif (isMounting) {\n\t\t\tif (matchingIndex == -1) {\n\t\t\t\t// When the array of children is growing we need to decrease the skew\n\t\t\t\t// as we are adding a new element to the array.\n\t\t\t\t// Example:\n\t\t\t\t// [1, 2, 3] --\u003e [0, 1, 2, 3]\n\t\t\t\t// oldChildren newChildren\n\t\t\t\t//\n\t\t\t\t// The new element is at index 0, so our skew is 0,\n\t\t\t\t// we need to decrease the skew as we are adding a new element.\n\t\t\t\t// The decrease will cause us to compare the element at position 1\n\t\t\t\t// with value 1 with the element at position 0 with value 0.\n\t\t\t\t//\n\t\t\t\t// A linear concept is applied when the array is shrinking,\n\t\t\t\t// if the length is unchanged we can assume that no skew\n\t\t\t\t// changes are needed.\n\t\t\t\tif (newChildrenLength \u003e oldChildrenLength) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else if (newChildrenLength \u003c oldChildrenLength) {\n\t\t\t\t\tskew++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we are mounting a DOM VNode, mark it for insertion\n\t\t\tif (typeof childVNode.type != 'function') {\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t} else if (matchingIndex != skewedIndex) {\n\t\t\t// When we move elements around i.e. [0, 1, 2] --\u003e [1, 0, 2]\n\t\t\t// --\u003e we diff 1, we find it at position 1 while our skewed index is 0 and our skew is 0\n\t\t\t// we set the skew to 1 as we found an offset.\n\t\t\t// --\u003e we diff 0, we find it at position 0 while our skewed index is at 2 and our skew is 1\n\t\t\t// this makes us increase the skew again.\n\t\t\t// --\u003e we diff 2, we find it at position 2 while our skewed index is at 4 and our skew is 2\n\t\t\t//\n\t\t\t// this becomes an optimization question where currently we see a 1 element offset as an insertion\n\t\t\t// or deletion i.e. we optimize for [0, 1, 2] --\u003e [9, 0, 1, 2]\n\t\t\t// while a more than 1 offset we see as a swap.\n\t\t\t// We could probably build heuristics for having an optimized course of action here as well, but\n\t\t\t// might go at the cost of some bytes.\n\t\t\t//\n\t\t\t// If we wanted to optimize for i.e. only swaps we'd just do the last two code-branches and have\n\t\t\t// only the first item be a re-scouting and all the others fall in their skewed counter-part.\n\t\t\t// We could also further optimize for swaps\n\t\t\tif (matchingIndex == skewedIndex - 1) {\n\t\t\t\tskew--;\n\t\t\t} else if (matchingIndex == skewedIndex + 1) {\n\t\t\t\tskew++;\n\t\t\t} else {\n\t\t\t\tif (matchingIndex \u003e skewedIndex) {\n\t\t\t\t\tskew--;\n\t\t\t\t} else {\n\t\t\t\t\tskew++;\n\t\t\t\t}\n\n\t\t\t\t// Move this VNode's DOM if the original index (matchingIndex) doesn't\n\t\t\t\t// match the new skew index (i + new skew)\n\t\t\t\t// In the former two branches we know that it matches after skewing\n\t\t\t\tchildVNode._flags |= INSERT_VNODE;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove remaining oldChildren if there are any. Loop forwards so that as we\n\t// unmount DOM from the beginning of the oldChildren, we can adjust oldDom to\n\t// point to the next child, which needs to be the first DOM node that won't be\n\t// unmounted.\n\tif (remainingOldChildren) {\n\t\tfor (i = 0; i \u003c oldChildrenLength; i++) {\n\t\t\toldVNode = oldChildren[i];\n\t\t\tif (oldVNode != NULL \u0026\u0026 (oldVNode._flags \u0026 MATCHED) == 0) {\n\t\t\t\tif (oldVNode._dom == oldDom) {\n\t\t\t\t\toldDom = getDomSibling(oldVNode);\n\t\t\t\t}\n\n\t\t\t\tunmount(oldVNode, oldVNode);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn oldDom;\n}\n\n/**\n * @param {VNode} parentVNode\n * @param {PreactElement} oldDom\n * @param {PreactElement} parentDom\n * @param {boolean} shouldPlace\n * @returns {PreactElement}\n */\nfunction insert(parentVNode, oldDom, parentDom, shouldPlace) {\n\t// Note: VNodes in nested suspended trees may be missing _children.\n\n\tif (typeof parentVNode.type == 'function') {\n\t\tlet children = parentVNode._children;\n\t\tfor (let i = 0; children \u0026\u0026 i \u003c children.length; i++) {\n\t\t\tif (children[i]) {\n\t\t\t\t// If we enter this code path on sCU bailout, where we copy\n\t\t\t\t// oldVNode._children to newVNode._children, we need to update the old\n\t\t\t\t// children's _parent pointer to point to the newVNode (parentVNode\n\t\t\t\t// here).\n\t\t\t\tchildren[i]._parent = parentVNode;\n\t\t\t\toldDom = insert(children[i], oldDom, parentDom, shouldPlace);\n\t\t\t}\n\t\t}\n\n\t\treturn oldDom;\n\t} else if (parentVNode._dom != oldDom) {\n\t\tif (shouldPlace) {\n\t\t\tif (oldDom \u0026\u0026 parentVNode.type \u0026\u0026 !oldDom.parentNode) {\n\t\t\t\toldDom = getDomSibling(parentVNode);\n\t\t\t}\n\t\t\tparentDom.insertBefore(parentVNode._dom, oldDom || NULL);\n\t\t}\n\t\toldDom = parentVNode._dom;\n\t}\n\n\tdo {\n\t\toldDom = oldDom \u0026\u0026 oldDom.nextSibling;\n\t} while (oldDom != NULL \u0026\u0026 oldDom.nodeType == 8);\n\n\treturn oldDom;\n}\n\n/**\n * Flatten and loop through the children of a virtual node\n * @param {ComponentChildren} children The unflattened children of a virtual\n * node\n * @returns {VNode[]}\n */\nexport function toChildArray(children, out) {\n\tout = out || [];\n\tif (children == NULL || typeof children == 'boolean') {\n\t} else if (isArray(children)) {\n\t\tchildren.some(child =\u003e {\n\t\t\ttoChildArray(child, out);\n\t\t});\n\t} else {\n\t\tout.push(children);\n\t}\n\treturn out;\n}\n\n/**\n * @param {VNode} childVNode\n * @param {VNode[]} oldChildren\n * @param {number} skewedIndex\n * @param {number} remainingOldChildren\n * @returns {number}\n */\nfunction findMatchingIndex(\n\tchildVNode,\n\toldChildren,\n\tskewedIndex,\n\tremainingOldChildren\n) {\n\tconst key = childVNode.key;\n\tconst type = childVNode.type;\n\tlet oldVNode = oldChildren[skewedIndex];\n\tconst matched = oldVNode != NULL \u0026\u0026 (oldVNode._flags \u0026 MATCHED) == 0;\n\n\t// We only need to perform a search if there are more children\n\t// (remainingOldChildren) to search. However, if the oldVNode we just looked\n\t// at skewedIndex was not already used in this diff, then there must be at\n\t// least 1 other (so greater than 1) remainingOldChildren to attempt to match\n\t// against. So the following condition checks that ensuring\n\t// remainingOldChildren \u003e 1 if the oldVNode is not already used/matched. Else\n\t// if the oldVNode was null or matched, then there could needs to be at least\n\t// 1 (aka `remainingOldChildren \u003e 0`) children to find and compare against.\n\t//\n\t// If there is an unkeyed functional VNode, that isn't a built-in like our Fragment,\n\t// we should not search as we risk re-using state of an unrelated VNode. (reverted for now)\n\tlet shouldSearch =\n\t\t// (typeof type != 'function' || type === Fragment || key) \u0026\u0026\n\t\tremainingOldChildren \u003e (matched ? 1 : 0);\n\n\tif (\n\t\t(oldVNode === NULL \u0026\u0026 key == null) ||\n\t\t(matched \u0026\u0026 key == oldVNode.key \u0026\u0026 type == oldVNode.type)\n\t) {\n\t\treturn skewedIndex;\n\t} else if (shouldSearch) {\n\t\tlet x = skewedIndex - 1;\n\t\tlet y = skewedIndex + 1;\n\t\twhile (x \u003e= 0 || y \u003c oldChildren.length) {\n\t\t\tconst childIndex = x \u003e= 0 ? x-- : y++;\n\t\t\toldVNode = oldChildren[childIndex];\n\t\t\tif (\n\t\t\t\toldVNode != NULL \u0026\u0026\n\t\t\t\t(oldVNode._flags \u0026 MATCHED) == 0 \u0026\u0026\n\t\t\t\tkey == oldVNode.key \u0026\u0026\n\t\t\t\ttype == oldVNode.type\n\t\t\t) {\n\t\t\t\treturn childIndex;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn -1;\n}\n","import {\n\tEMPTY_ARR,\n\tEMPTY_OBJ,\n\tMATH_NAMESPACE,\n\tMODE_HYDRATE,\n\tMODE_SUSPENDED,\n\tNULL,\n\tRESET_MODE,\n\tSVG_NAMESPACE,\n\tUNDEFINED,\n\tXHTML_NAMESPACE\n} from '../constants';\nimport { BaseComponent, getDomSibling } from '../component';\nimport { Fragment } from '../create-element';\nimport { diffChildren } from './children';\nimport { setProperty } from './props';\nimport { assign, isArray, removeNode, slice } from '../util';\nimport options from '../options';\n\n/**\n * @typedef {import('../internal').ComponentChildren} ComponentChildren\n * @typedef {import('../internal').Component} Component\n * @typedef {import('../internal').PreactElement} PreactElement\n * @typedef {import('../internal').VNode} VNode\n */\n\n/**\n * @template {any} T\n * @typedef {import('../internal').Ref\u003cT\u003e} Ref\u003cT\u003e\n */\n\n/**\n * Diff two virtual nodes and apply proper changes to the DOM\n * @param {PreactElement} parentDom The parent of the DOM element\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object. Modified by\n * getChildContext\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array\u003cPreactElement\u003e} excessDomChildren\n * @param {Array\u003cComponent\u003e} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {PreactElement} oldDom The current attached DOM element any new dom\n * elements should be placed around. Likely `null` on first render (except when\n * hydrating). Can be a sibling DOM element when diffing Fragments that have\n * siblings. In most cases, it starts out as `oldChildren[0]._dom`.\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n */\nexport function diff(\n\tparentDom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\toldDom,\n\tisHydrating,\n\trefQueue\n) {\n\t/** @type {any} */\n\tlet tmp,\n\t\tnewType = newVNode.type;\n\n\t// When passing through createElement it assigns the object\n\t// constructor as undefined. This to prevent JSON-injection.\n\tif (newVNode.constructor !== UNDEFINED) return NULL;\n\n\t// If the previous diff bailed out, resume creating/hydrating.\n\tif (oldVNode._flags \u0026 MODE_SUSPENDED) {\n\t\tisHydrating = !!(oldVNode._flags \u0026 MODE_HYDRATE);\n\t\toldDom = newVNode._dom = oldVNode._dom;\n\t\texcessDomChildren = [oldDom];\n\t}\n\n\tif ((tmp = options._diff)) tmp(newVNode);\n\n\touter: if (typeof newType == 'function') {\n\t\ttry {\n\t\t\tlet c, isNew, oldProps, oldState, snapshot, clearProcessingException;\n\t\t\tlet newProps = newVNode.props;\n\t\t\tconst isClassComponent = newType.prototype \u0026\u0026 newType.prototype.render;\n\n\t\t\t// Necessary for createContext api. Setting this property will pass\n\t\t\t// the context value as `this.context` just for this component.\n\t\t\ttmp = newType.contextType;\n\t\t\tlet provider = tmp \u0026\u0026 globalContext[tmp._id];\n\t\t\tlet componentContext = tmp\n\t\t\t\t? provider\n\t\t\t\t\t? provider.props.value\n\t\t\t\t\t: tmp._defaultValue\n\t\t\t\t: globalContext;\n\n\t\t\t// Get component and set it to `c`\n\t\t\tif (oldVNode._component) {\n\t\t\t\tc = newVNode._component = oldVNode._component;\n\t\t\t\tclearProcessingException = c._processingException = c._pendingError;\n\t\t\t} else {\n\t\t\t\t// Instantiate the new component\n\t\t\t\tif (isClassComponent) {\n\t\t\t\t\t// @ts-expect-error The check above verifies that newType is suppose to be constructed\n\t\t\t\t\tnewVNode._component = c = new newType(newProps, componentContext); // eslint-disable-line new-cap\n\t\t\t\t} else {\n\t\t\t\t\t// @ts-expect-error Trust me, Component implements the interface we want\n\t\t\t\t\tnewVNode._component = c = new BaseComponent(\n\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t);\n\t\t\t\t\tc.constructor = newType;\n\t\t\t\t\tc.render = doRender;\n\t\t\t\t}\n\t\t\t\tif (provider) provider.sub(c);\n\n\t\t\t\tif (!c.state) c.state = {};\n\t\t\t\tc._globalContext = globalContext;\n\t\t\t\tisNew = c._dirty = true;\n\t\t\t\tc._renderCallbacks = [];\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t}\n\n\t\t\t// Invoke getDerivedStateFromProps\n\t\t\tif (isClassComponent \u0026\u0026 c._nextState == NULL) {\n\t\t\t\tc._nextState = c.state;\n\t\t\t}\n\n\t\t\tif (isClassComponent \u0026\u0026 newType.getDerivedStateFromProps != NULL) {\n\t\t\t\tif (c._nextState == c.state) {\n\t\t\t\t\tc._nextState = assign({}, c._nextState);\n\t\t\t\t}\n\n\t\t\t\tassign(\n\t\t\t\t\tc._nextState,\n\t\t\t\t\tnewType.getDerivedStateFromProps(newProps, c._nextState)\n\t\t\t\t);\n\t\t\t}\n\n\t\t\toldProps = c.props;\n\t\t\toldState = c.state;\n\t\t\tc._vnode = newVNode;\n\n\t\t\t// Invoke pre-render lifecycle methods\n\t\t\tif (isNew) {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent \u0026\u0026\n\t\t\t\t\tnewType.getDerivedStateFromProps == NULL \u0026\u0026\n\t\t\t\t\tc.componentWillMount != NULL\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillMount();\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent \u0026\u0026 c.componentDidMount != NULL) {\n\t\t\t\t\tc._renderCallbacks.push(c.componentDidMount);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (\n\t\t\t\t\tisClassComponent \u0026\u0026\n\t\t\t\t\tnewType.getDerivedStateFromProps == NULL \u0026\u0026\n\t\t\t\t\tnewProps !== oldProps \u0026\u0026\n\t\t\t\t\tc.componentWillReceiveProps != NULL\n\t\t\t\t) {\n\t\t\t\t\tc.componentWillReceiveProps(newProps, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\tnewVNode._original == oldVNode._original ||\n\t\t\t\t\t(!c._force \u0026\u0026\n\t\t\t\t\t\tc.shouldComponentUpdate != NULL \u0026\u0026\n\t\t\t\t\t\tc.shouldComponentUpdate(\n\t\t\t\t\t\t\tnewProps,\n\t\t\t\t\t\t\tc._nextState,\n\t\t\t\t\t\t\tcomponentContext\n\t\t\t\t\t\t) === false)\n\t\t\t\t) {\n\t\t\t\t\t// More info about this here: https://gist.github.com/JoviDeCroock/bec5f2ce93544d2e6070ef8e0036e4e8\n\t\t\t\t\tif (newVNode._original != oldVNode._original) {\n\t\t\t\t\t\t// When we are dealing with a bail because of sCU we have to update\n\t\t\t\t\t\t// the props, state and dirty-state.\n\t\t\t\t\t\t// when we are dealing with strict-equality we don't as the child could still\n\t\t\t\t\t\t// be dirtied see #3883\n\t\t\t\t\t\tc.props = newProps;\n\t\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t\t\tc._dirty = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\t\tnewVNode._children.some(vnode =\u003e {\n\t\t\t\t\t\tif (vnode) vnode._parent = newVNode;\n\t\t\t\t\t});\n\n\t\t\t\t\tEMPTY_ARR.push.apply(c._renderCallbacks, c._stateCallbacks);\n\t\t\t\t\tc._stateCallbacks = [];\n\n\t\t\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\t\t\tcommitQueue.push(c);\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak outer;\n\t\t\t\t}\n\n\t\t\t\tif (c.componentWillUpdate != NULL) {\n\t\t\t\t\tc.componentWillUpdate(newProps, c._nextState, componentContext);\n\t\t\t\t}\n\n\t\t\t\tif (isClassComponent \u0026\u0026 c.componentDidUpdate != NULL) {\n\t\t\t\t\tc._renderCallbacks.push(() =\u003e {\n\t\t\t\t\t\tc.componentDidUpdate(oldProps, oldState, snapshot);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tc.context = componentContext;\n\t\t\tc.props = newProps;\n\t\t\tc._parentDom = parentDom;\n\t\t\tc._force = false;\n\n\t\t\tlet renderHook = options._render,\n\t\t\t\tcount = 0;\n\t\t\tif (isClassComponent) {\n\t\t\t\tc.state = c._nextState;\n\t\t\t\tc._dirty = false;\n\n\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\tEMPTY_ARR.push.apply(c._renderCallbacks, c._stateCallbacks);\n\t\t\t\tc._stateCallbacks = [];\n\t\t\t} else {\n\t\t\t\tdo {\n\t\t\t\t\tc._dirty = false;\n\t\t\t\t\tif (renderHook) renderHook(newVNode);\n\n\t\t\t\t\ttmp = c.render(c.props, c.state, c.context);\n\n\t\t\t\t\t// Handle setState called in render, see #2553\n\t\t\t\t\tc.state = c._nextState;\n\t\t\t\t} while (c._dirty \u0026\u0026 ++count \u003c 25);\n\t\t\t}\n\n\t\t\t// Handle setState called in render, see #2553\n\t\t\tc.state = c._nextState;\n\n\t\t\tif (c.getChildContext != NULL) {\n\t\t\t\tglobalContext = assign(assign({}, globalContext), c.getChildContext());\n\t\t\t}\n\n\t\t\tif (isClassComponent \u0026\u0026 !isNew \u0026\u0026 c.getSnapshotBeforeUpdate != NULL) {\n\t\t\t\tsnapshot = c.getSnapshotBeforeUpdate(oldProps, oldState);\n\t\t\t}\n\n\t\t\tlet renderResult =\n\t\t\t\ttmp != NULL \u0026\u0026 tmp.type === Fragment \u0026\u0026 tmp.key == NULL\n\t\t\t\t\t? cloneNode(tmp.props.children)\n\t\t\t\t\t: tmp;\n\n\t\t\toldDom = diffChildren(\n\t\t\t\tparentDom,\n\t\t\t\tisArray(renderResult) ? renderResult : [renderResult],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnamespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\toldDom,\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\tc.base = newVNode._dom;\n\n\t\t\t// We successfully rendered this VNode, unset any stored hydration/bailout state:\n\t\t\tnewVNode._flags \u0026= RESET_MODE;\n\n\t\t\tif (c._renderCallbacks.length) {\n\t\t\t\tcommitQueue.push(c);\n\t\t\t}\n\n\t\t\tif (clearProcessingException) {\n\t\t\t\tc._pendingError = c._processingException = NULL;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tnewVNode._original = NULL;\n\t\t\t// if hydrating or creating initial tree, bailout preserves DOM:\n\t\t\tif (isHydrating || excessDomChildren != NULL) {\n\t\t\t\tif (e.then) {\n\t\t\t\t\tnewVNode._flags |= isHydrating\n\t\t\t\t\t\t? MODE_HYDRATE | MODE_SUSPENDED\n\t\t\t\t\t\t: MODE_SUSPENDED;\n\n\t\t\t\t\twhile (oldDom \u0026\u0026 oldDom.nodeType == 8 \u0026\u0026 oldDom.nextSibling) {\n\t\t\t\t\t\toldDom = oldDom.nextSibling;\n\t\t\t\t\t}\n\n\t\t\t\t\texcessDomChildren[excessDomChildren.indexOf(oldDom)] = NULL;\n\t\t\t\t\tnewVNode._dom = oldDom;\n\t\t\t\t} else {\n\t\t\t\t\tfor (let i = excessDomChildren.length; i--; ) {\n\t\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t\t}\n\t\t\t\t\tmarkAsForce(newVNode);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewVNode._dom = oldVNode._dom;\n\t\t\t\tnewVNode._children = oldVNode._children;\n\t\t\t\tif (!e.then) markAsForce(newVNode);\n\t\t\t}\n\t\t\toptions._catchError(e, newVNode, oldVNode);\n\t\t}\n\t} else if (\n\t\texcessDomChildren == NULL \u0026\u0026\n\t\tnewVNode._original == oldVNode._original\n\t) {\n\t\tnewVNode._children = oldVNode._children;\n\t\tnewVNode._dom = oldVNode._dom;\n\t} else {\n\t\toldDom = newVNode._dom = diffElementNodes(\n\t\t\toldVNode._dom,\n\t\t\tnewVNode,\n\t\t\toldVNode,\n\t\t\tglobalContext,\n\t\t\tnamespace,\n\t\t\texcessDomChildren,\n\t\t\tcommitQueue,\n\t\t\tisHydrating,\n\t\t\trefQueue\n\t\t);\n\t}\n\n\tif ((tmp = options.diffed)) tmp(newVNode);\n\n\treturn newVNode._flags \u0026 MODE_SUSPENDED ? undefined : oldDom;\n}\n\nfunction markAsForce(vnode) {\n\tif (vnode) {\n\t\tif (vnode._component) vnode._component._force = true;\n\t\tif (vnode._children) vnode._children.some(markAsForce);\n\t}\n}\n\n/**\n * @param {Array\u003cComponent\u003e} commitQueue List of components\n * which have callbacks to invoke in commitRoot\n * @param {VNode} root\n */\nexport function commitRoot(commitQueue, root, refQueue) {\n\tfor (let i = 0; i \u003c refQueue.length; i++) {\n\t\tapplyRef(refQueue[i], refQueue[++i], refQueue[++i]);\n\t}\n\n\tif (options._commit) options._commit(root, commitQueue);\n\n\tcommitQueue.some(c =\u003e {\n\t\ttry {\n\t\t\t// @ts-expect-error Reuse the commitQueue variable here so the type changes\n\t\t\tcommitQueue = c._renderCallbacks;\n\t\t\tc._renderCallbacks = [];\n\t\t\tcommitQueue.some(cb =\u003e {\n\t\t\t\t// @ts-expect-error See above comment on commitQueue\n\t\t\t\tcb.call(c);\n\t\t\t});\n\t\t} catch (e) {\n\t\t\toptions._catchError(e, c._vnode);\n\t\t}\n\t});\n}\n\nfunction cloneNode(node) {\n\tif (typeof node != 'object' || node == NULL || node._depth \u003e 0) {\n\t\treturn node;\n\t}\n\n\tif (isArray(node)) {\n\t\treturn node.map(cloneNode);\n\t}\n\n\treturn assign({}, node);\n}\n\n/**\n * Diff two virtual nodes representing DOM element\n * @param {PreactElement} dom The DOM element representing the virtual nodes\n * being diffed\n * @param {VNode} newVNode The new virtual node\n * @param {VNode} oldVNode The old virtual node\n * @param {object} globalContext The current context object\n * @param {string} namespace Current namespace of the DOM node (HTML, SVG, or MathML)\n * @param {Array\u003cPreactElement\u003e} excessDomChildren\n * @param {Array\u003cComponent\u003e} commitQueue List of components which have callbacks\n * to invoke in commitRoot\n * @param {boolean} isHydrating Whether or not we are in hydration\n * @param {any[]} refQueue an array of elements needed to invoke refs\n * @returns {PreactElement}\n */\nfunction diffElementNodes(\n\tdom,\n\tnewVNode,\n\toldVNode,\n\tglobalContext,\n\tnamespace,\n\texcessDomChildren,\n\tcommitQueue,\n\tisHydrating,\n\trefQueue\n) {\n\tlet oldProps = oldVNode.props || EMPTY_OBJ;\n\tlet newProps = newVNode.props;\n\tlet nodeType = /** @type {string} */ (newVNode.type);\n\t/** @type {any} */\n\tlet i;\n\t/** @type {{ __html?: string }} */\n\tlet newHtml;\n\t/** @type {{ __html?: string }} */\n\tlet oldHtml;\n\t/** @type {ComponentChildren} */\n\tlet newChildren;\n\tlet value;\n\tlet inputValue;\n\tlet checked;\n\n\t// Tracks entering and exiting namespaces when descending through the tree.\n\tif (nodeType == 'svg') namespace = SVG_NAMESPACE;\n\telse if (nodeType == 'math') namespace = MATH_NAMESPACE;\n\telse if (!namespace) namespace = XHTML_NAMESPACE;\n\n\tif (excessDomChildren != NULL) {\n\t\tfor (i = 0; i \u003c excessDomChildren.length; i++) {\n\t\t\tvalue = excessDomChildren[i];\n\n\t\t\t// if newVNode matches an element in excessDomChildren or the `dom`\n\t\t\t// argument matches an element in excessDomChildren, remove it from\n\t\t\t// excessDomChildren so it isn't later removed in diffChildren\n\t\t\tif (\n\t\t\t\tvalue \u0026\u0026\n\t\t\t\t'setAttribute' in value == !!nodeType \u0026\u0026\n\t\t\t\t(nodeType ? value.localName == nodeType : value.nodeType == 3)\n\t\t\t) {\n\t\t\t\tdom = value;\n\t\t\t\texcessDomChildren[i] = NULL;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (dom == NULL) {\n\t\tif (nodeType == NULL) {\n\t\t\treturn document.createTextNode(newProps);\n\t\t}\n\n\t\tdom = document.createElementNS(\n\t\t\tnamespace,\n\t\t\tnodeType,\n\t\t\tnewProps.is \u0026\u0026 newProps\n\t\t);\n\n\t\t// we are creating a new node, so we can assume this is a new subtree (in\n\t\t// case we are hydrating), this deopts the hydrate\n\t\tif (isHydrating) {\n\t\t\tif (options._hydrationMismatch)\n\t\t\t\toptions._hydrationMismatch(newVNode, excessDomChildren);\n\t\t\tisHydrating = false;\n\t\t}\n\t\t// we created a new parent, so none of the previously attached children can be reused:\n\t\texcessDomChildren = NULL;\n\t}\n\n\tif (nodeType == NULL) {\n\t\t// During hydration, we still have to split merged text from SSR'd HTML.\n\t\tif (oldProps !== newProps \u0026\u0026 (!isHydrating || dom.data != newProps)) {\n\t\t\tdom.data = newProps;\n\t\t}\n\t} else {\n\t\t// If excessDomChildren was not null, repopulate it with the current element's children:\n\t\texcessDomChildren = excessDomChildren \u0026\u0026 slice.call(dom.childNodes);\n\n\t\t// If we are in a situation where we are not hydrating but are using\n\t\t// existing DOM (e.g. replaceNode) we should read the existing DOM\n\t\t// attributes to diff them\n\t\tif (!isHydrating \u0026\u0026 excessDomChildren != NULL) {\n\t\t\toldProps = {};\n\t\t\tfor (i = 0; i \u003c dom.attributes.length; i++) {\n\t\t\t\tvalue = dom.attributes[i];\n\t\t\t\toldProps[value.name] = value.value;\n\t\t\t}\n\t\t}\n\n\t\tfor (i in oldProps) {\n\t\t\tvalue = oldProps[i];\n\t\t\tif (i == 'dangerouslySetInnerHTML') {\n\t\t\t\toldHtml = value;\n\t\t\t} else if (\n\t\t\t\ti != 'children' \u0026\u0026\n\t\t\t\t!(i in newProps) \u0026\u0026\n\t\t\t\t!(i == 'value' \u0026\u0026 'defaultValue' in newProps) \u0026\u0026\n\t\t\t\t!(i == 'checked' \u0026\u0026 'defaultChecked' in newProps)\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, NULL, value, namespace);\n\t\t\t}\n\t\t}\n\n\t\t// During hydration, props are not diffed at all (including dangerouslySetInnerHTML)\n\t\t// @TODO we should warn in debug mode when props don't match here.\n\t\tfor (i in newProps) {\n\t\t\tvalue = newProps[i];\n\t\t\tif (i == 'children') {\n\t\t\t\tnewChildren = value;\n\t\t\t} else if (i == 'dangerouslySetInnerHTML') {\n\t\t\t\tnewHtml = value;\n\t\t\t} else if (i == 'value') {\n\t\t\t\tinputValue = value;\n\t\t\t} else if (i == 'checked') {\n\t\t\t\tchecked = value;\n\t\t\t} else if (\n\t\t\t\t(!isHydrating || typeof value == 'function') \u0026\u0026\n\t\t\t\toldProps[i] !== value\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, value, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\n\t\t// If the new vnode didn't have dangerouslySetInnerHTML, diff its children\n\t\tif (newHtml) {\n\t\t\t// Avoid re-applying the same '__html' if it did not changed between re-render\n\t\t\tif (\n\t\t\t\t!isHydrating \u0026\u0026\n\t\t\t\t(!oldHtml ||\n\t\t\t\t\t(newHtml.__html != oldHtml.__html \u0026\u0026 newHtml.__html != dom.innerHTML))\n\t\t\t) {\n\t\t\t\tdom.innerHTML = newHtml.__html;\n\t\t\t}\n\n\t\t\tnewVNode._children = [];\n\t\t} else {\n\t\t\tif (oldHtml) dom.innerHTML = '';\n\n\t\t\tdiffChildren(\n\t\t\t\t// @ts-expect-error\n\t\t\t\tnewVNode.type == 'template' ? dom.content : dom,\n\t\t\t\tisArray(newChildren) ? newChildren : [newChildren],\n\t\t\t\tnewVNode,\n\t\t\t\toldVNode,\n\t\t\t\tglobalContext,\n\t\t\t\tnodeType == 'foreignObject' ? XHTML_NAMESPACE : namespace,\n\t\t\t\texcessDomChildren,\n\t\t\t\tcommitQueue,\n\t\t\t\texcessDomChildren\n\t\t\t\t\t? excessDomChildren[0]\n\t\t\t\t\t: oldVNode._children \u0026\u0026 getDomSibling(oldVNode, 0),\n\t\t\t\tisHydrating,\n\t\t\t\trefQueue\n\t\t\t);\n\n\t\t\t// Remove children that are not part of any vnode.\n\t\t\tif (excessDomChildren != NULL) {\n\t\t\t\tfor (i = excessDomChildren.length; i--; ) {\n\t\t\t\t\tremoveNode(excessDomChildren[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// As above, don't diff props during hydration\n\t\tif (!isHydrating) {\n\t\t\ti = 'value';\n\t\t\tif (nodeType == 'progress' \u0026\u0026 inputValue == NULL) {\n\t\t\t\tdom.removeAttribute('value');\n\t\t\t} else if (\n\t\t\t\tinputValue != UNDEFINED \u0026\u0026\n\t\t\t\t// #2756 For the \u003cprogress\u003e-element the initial value is 0,\n\t\t\t\t// despite the attribute not being present. When the attribute\n\t\t\t\t// is missing the progress bar is treated as indeterminate.\n\t\t\t\t// To fix that we'll always update it when it is 0 for progress elements\n\t\t\t\t(inputValue !== dom[i] ||\n\t\t\t\t\t(nodeType == 'progress' \u0026\u0026 !inputValue) ||\n\t\t\t\t\t// This is only for IE 11 to fix \u003cselect\u003e value not being updated.\n\t\t\t\t\t// To avoid a stale select value we need to set the option.value\n\t\t\t\t\t// again, which triggers IE11 to re-evaluate the select value\n\t\t\t\t\t(nodeType == 'option' \u0026\u0026 inputValue != oldProps[i]))\n\t\t\t) {\n\t\t\t\tsetProperty(dom, i, inputValue, oldProps[i], namespace);\n\t\t\t}\n\n\t\t\ti = 'checked';\n\t\t\tif (checked != UNDEFINED \u0026\u0026 checked != dom[i]) {\n\t\t\t\tsetProperty(dom, i, checked, oldProps[i], namespace);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dom;\n}\n\n/**\n * Invoke or update a ref, depending on whether it is a function or object ref.\n * @param {Ref\u003cany\u003e \u0026 { _unmount?: unknown }} ref\n * @param {any} value\n * @param {VNode} vnode\n */\nexport function applyRef(ref, value, vnode) {\n\ttry {\n\t\tif (typeof ref == 'function') {\n\t\t\tlet hasRefUnmount = typeof ref._unmount == 'function';\n\t\t\tif (hasRefUnmount) {\n\t\t\t\t// @ts-ignore TS doesn't like moving narrowing checks into variables\n\t\t\t\tref._unmount();\n\t\t\t}\n\n\t\t\tif (!hasRefUnmount || value != NULL) {\n\t\t\t\t// Store the cleanup function on the function\n\t\t\t\t// instance object itself to avoid shape\n\t\t\t\t// transitioning vnode\n\t\t\t\tref._unmount = ref(value);\n\t\t\t}\n\t\t} else ref.current = value;\n\t} catch (e) {\n\t\toptions._catchError(e, vnode);\n\t}\n}\n\n/**\n * Unmount a virtual node from the tree and apply DOM changes\n * @param {VNode} vnode The virtual node to unmount\n * @param {VNode} parentVNode The parent of the VNode that initiated the unmount\n * @param {boolean} [skipRemove] Flag that indicates that a parent node of the\n * current element is already detached from the DOM.\n */\nexport function unmount(vnode, parentVNode, skipRemove) {\n\tlet r;\n\tif (options.unmount) options.unmount(vnode);\n\n\tif ((r = vnode.ref)) {\n\t\tif (!r.current || r.current == vnode._dom) {\n\t\t\tapplyRef(r, NULL, parentVNode);\n\t\t}\n\t}\n\n\tif ((r = vnode._component) != NULL) {\n\t\tif (r.componentWillUnmount) {\n\t\t\ttry {\n\t\t\t\tr.componentWillUnmount();\n\t\t\t} catch (e) {\n\t\t\t\toptions._catchError(e, parentVNode);\n\t\t\t}\n\t\t}\n\n\t\tr.base = r._parentDom = NULL;\n\t}\n\n\tif ((r = vnode._children)) {\n\t\tfor (let i = 0; i \u003c r.length; i++) {\n\t\t\tif (r[i]) {\n\t\t\t\tunmount(\n\t\t\t\t\tr[i],\n\t\t\t\t\tparentVNode,\n\t\t\t\t\tskipRemove || typeof vnode.type != 'function'\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!skipRemove) {\n\t\tremoveNode(vnode._dom);\n\t}\n\n\tvnode._component = vnode._parent = vnode._dom = UNDEFINED;\n}\n\n/** The `.render()` method for a PFC backing instance. */\nfunction doRender(props, state, context) {\n\treturn this.constructor(props, context);\n}\n","import { EMPTY_OBJ, NULL } from './constants';\nimport { commitRoot, diff } from './diff/index';\nimport { createElement, Fragment } from './create-element';\nimport options from './options';\nimport { slice } from './util';\n\n/**\n * Render a Preact virtual node into a DOM element\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to render into\n * @param {import('./internal').PreactElement | object} [replaceNode] Optional: Attempt to re-use an\n * existing DOM tree rooted at `replaceNode`\n */\nexport function render(vnode, parentDom, replaceNode) {\n\t// https://github.com/preactjs/preact/issues/3794\n\tif (parentDom == document) {\n\t\tparentDom = document.documentElement;\n\t}\n\n\tif (options._root) options._root(vnode, parentDom);\n\n\t// We abuse the `replaceNode` parameter in `hydrate()` to signal if we are in\n\t// hydration mode or not by passing the `hydrate` function instead of a DOM\n\t// element..\n\tlet isHydrating = typeof replaceNode == 'function';\n\n\t// To be able to support calling `render()` multiple times on the same\n\t// DOM node, we need to obtain a reference to the previous tree. We do\n\t// this by assigning a new `_children` property to DOM nodes which points\n\t// to the last rendered tree. By default this property is not present, which\n\t// means that we are mounting a new tree for the first time.\n\tlet oldVNode = isHydrating\n\t\t? NULL\n\t\t: (replaceNode \u0026\u0026 replaceNode._children) || parentDom._children;\n\n\tvnode = ((!isHydrating \u0026\u0026 replaceNode) || parentDom)._children =\n\t\tcreateElement(Fragment, NULL, [vnode]);\n\n\t// List of effects that need to be called after diffing.\n\tlet commitQueue = [],\n\t\trefQueue = [];\n\tdiff(\n\t\tparentDom,\n\t\t// Determine the new vnode tree and store it on the DOM element on\n\t\t// our custom `_children` property.\n\t\tvnode,\n\t\toldVNode || EMPTY_OBJ,\n\t\tEMPTY_OBJ,\n\t\tparentDom.namespaceURI,\n\t\t!isHydrating \u0026\u0026 replaceNode\n\t\t\t? [replaceNode]\n\t\t\t: oldVNode\n\t\t\t\t? NULL\n\t\t\t\t: parentDom.firstChild\n\t\t\t\t\t? slice.call(parentDom.childNodes)\n\t\t\t\t\t: NULL,\n\t\tcommitQueue,\n\t\t!isHydrating \u0026\u0026 replaceNode\n\t\t\t? replaceNode\n\t\t\t: oldVNode\n\t\t\t\t? oldVNode._dom\n\t\t\t\t: parentDom.firstChild,\n\t\tisHydrating,\n\t\trefQueue\n\t);\n\n\t// Flush all queued effects\n\tcommitRoot(commitQueue, vnode, refQueue);\n}\n\n/**\n * Update an existing DOM element with data from a Preact virtual node\n * @param {import('./internal').ComponentChild} vnode The virtual node to render\n * @param {import('./internal').PreactElement} parentDom The DOM element to update\n */\nexport function hydrate(vnode, parentDom) {\n\trender(vnode, parentDom, hydrate);\n}\n","import { assign, slice } from './util';\nimport { createVNode } from './create-element';\nimport { NULL, UNDEFINED } from './constants';\n\n/**\n * Clones the given VNode, optionally adding attributes/props and replacing its\n * children.\n * @param {import('./internal').VNode} vnode The virtual DOM element to clone\n * @param {object} props Attributes/props to add when cloning\n * @param {Array\u003cimport('./internal').ComponentChildren\u003e} rest Any additional arguments will be used\n * as replacement children.\n * @returns {import('./internal').VNode}\n */\nexport function cloneElement(vnode, props, children) {\n\tlet normalizedProps = assign({}, vnode.props),\n\t\tkey,\n\t\tref,\n\t\ti;\n\n\tlet defaultProps;\n\n\tif (vnode.type \u0026\u0026 vnode.type.defaultProps) {\n\t\tdefaultProps = vnode.type.defaultProps;\n\t}\n\n\tfor (i in props) {\n\t\tif (i == 'key') key = props[i];\n\t\telse if (i == 'ref') ref = props[i];\n\t\telse if (props[i] === UNDEFINED \u0026\u0026 defaultProps != UNDEFINED) {\n\t\t\tnormalizedProps[i] = defaultProps[i];\n\t\t} else {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tif (arguments.length \u003e 2) {\n\t\tnormalizedProps.children =\n\t\t\targuments.length \u003e 3 ? slice.call(arguments, 2) : children;\n\t}\n\n\treturn createVNode(\n\t\tvnode.type,\n\t\tnormalizedProps,\n\t\tkey || vnode.key,\n\t\tref || vnode.ref,\n\t\tNULL\n\t);\n}\n","import { NULL } from '../constants';\n\n/**\n * Find the closest error boundary to a thrown error and call it\n * @param {object} error The thrown value\n * @param {import('../internal').VNode} vnode The vnode that threw the error that was caught (except\n * for unmounting when this parameter is the highest parent that was being\n * unmounted)\n * @param {import('../internal').VNode} [oldVNode]\n * @param {import('../internal').ErrorInfo} [errorInfo]\n */\nexport function _catchError(error, vnode, oldVNode, errorInfo) {\n\t/** @type {import('../internal').Component} */\n\tlet component,\n\t\t/** @type {import('../internal').ComponentType} */\n\t\tctor,\n\t\t/** @type {boolean} */\n\t\thandled;\n\n\tfor (; (vnode = vnode._parent); ) {\n\t\tif ((component = vnode._component) \u0026\u0026 !component._processingException) {\n\t\t\ttry {\n\t\t\t\tctor = component.constructor;\n\n\t\t\t\tif (ctor \u0026\u0026 ctor.getDerivedStateFromError != NULL) {\n\t\t\t\t\tcomponent.setState(ctor.getDerivedStateFromError(error));\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\tif (component.componentDidCatch != NULL) {\n\t\t\t\t\tcomponent.componentDidCatch(error, errorInfo || {});\n\t\t\t\t\thandled = component._dirty;\n\t\t\t\t}\n\n\t\t\t\t// This is an error boundary. Mark it as having bailed out, and whether it was mid-hydration.\n\t\t\t\tif (handled) {\n\t\t\t\t\treturn (component._pendingError = component);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\terror = e;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow error;\n}\n"],"version":3}