@webqit/webflo 0.11.61-0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/.gitignore +7 -7
  2. package/LICENSE +20 -20
  3. package/README.md +2079 -2074
  4. package/docker/Dockerfile +42 -42
  5. package/docker/README.md +91 -91
  6. package/docker/package.json +2 -2
  7. package/package.json +80 -81
  8. package/src/{Context.js → AbstractContext.js} +71 -79
  9. package/src/config-pi/deployment/Env.js +68 -68
  10. package/src/config-pi/deployment/Layout.js +63 -63
  11. package/src/config-pi/deployment/Origins.js +139 -139
  12. package/src/config-pi/deployment/Proxy.js +74 -74
  13. package/src/config-pi/deployment/index.js +17 -17
  14. package/src/config-pi/index.js +15 -15
  15. package/src/config-pi/runtime/Client.js +116 -98
  16. package/src/config-pi/runtime/Server.js +125 -125
  17. package/src/config-pi/runtime/client/Worker.js +109 -134
  18. package/src/config-pi/runtime/client/index.js +11 -11
  19. package/src/config-pi/runtime/index.js +17 -17
  20. package/src/config-pi/runtime/server/Headers.js +74 -74
  21. package/src/config-pi/runtime/server/Redirects.js +69 -69
  22. package/src/config-pi/runtime/server/index.js +13 -13
  23. package/src/config-pi/static/Manifest.js +319 -319
  24. package/src/config-pi/static/Ssg.js +49 -49
  25. package/src/config-pi/static/index.js +13 -13
  26. package/src/deployment-pi/index.js +10 -10
  27. package/src/deployment-pi/origins/index.js +216 -216
  28. package/src/index.js +11 -19
  29. package/src/runtime-pi/HttpEvent.js +126 -106
  30. package/src/runtime-pi/HttpUser.js +126 -0
  31. package/src/runtime-pi/MessagingOverBroadcast.js +9 -0
  32. package/src/runtime-pi/MessagingOverChannel.js +85 -0
  33. package/src/runtime-pi/MessagingOverSocket.js +106 -0
  34. package/src/runtime-pi/MultiportMessagingAPI.js +81 -0
  35. package/src/runtime-pi/WebfloCookieStorage.js +27 -0
  36. package/src/runtime-pi/WebfloEventTarget.js +39 -0
  37. package/src/runtime-pi/WebfloMessageEvent.js +58 -0
  38. package/src/runtime-pi/WebfloMessagingAPI.js +69 -0
  39. package/src/runtime-pi/{Router.js → WebfloRouter.js} +99 -130
  40. package/src/runtime-pi/WebfloRuntime.js +52 -0
  41. package/src/runtime-pi/WebfloStorage.js +109 -0
  42. package/src/runtime-pi/client/ClientMessaging.js +5 -0
  43. package/src/runtime-pi/client/Context.js +3 -7
  44. package/src/runtime-pi/client/CookieStorage.js +17 -0
  45. package/src/runtime-pi/client/Router.js +38 -48
  46. package/src/runtime-pi/client/SessionStorage.js +33 -0
  47. package/src/runtime-pi/client/Url.js +156 -205
  48. package/src/runtime-pi/client/WebfloClient.js +544 -0
  49. package/src/runtime-pi/client/WebfloRootClient1.js +179 -0
  50. package/src/runtime-pi/client/WebfloRootClient2.js +109 -0
  51. package/src/runtime-pi/client/WebfloSubClient.js +165 -0
  52. package/src/runtime-pi/client/Workport.js +118 -178
  53. package/src/runtime-pi/client/generate.js +480 -471
  54. package/src/runtime-pi/client/index.js +16 -21
  55. package/src/runtime-pi/client/worker/ClientMessaging.js +5 -0
  56. package/src/runtime-pi/client/worker/Context.js +3 -7
  57. package/src/runtime-pi/client/worker/CookieStorage.js +17 -0
  58. package/src/runtime-pi/client/worker/SessionStorage.js +13 -0
  59. package/src/runtime-pi/client/worker/WebfloWorker.js +294 -0
  60. package/src/runtime-pi/client/worker/Workport.js +17 -85
  61. package/src/runtime-pi/client/worker/index.js +10 -21
  62. package/src/runtime-pi/index.js +6 -13
  63. package/src/runtime-pi/server/ClientMessaging.js +18 -0
  64. package/src/runtime-pi/server/ClientMessagingRegistry.js +57 -0
  65. package/src/runtime-pi/server/Context.js +11 -15
  66. package/src/runtime-pi/server/CookieStorage.js +17 -0
  67. package/src/runtime-pi/server/Router.js +93 -159
  68. package/src/runtime-pi/server/SessionStorage.js +53 -0
  69. package/src/runtime-pi/server/WebfloServer.js +755 -0
  70. package/src/runtime-pi/server/index.js +10 -21
  71. package/src/runtime-pi/util-http.js +322 -86
  72. package/src/runtime-pi/util-url.js +146 -146
  73. package/src/runtime-pi/xURL.js +108 -105
  74. package/src/runtime-pi/xfetch.js +22 -22
  75. package/src/services-pi/cert/http-auth-hook.js +22 -22
  76. package/src/services-pi/cert/http-cleanup-hook.js +22 -22
  77. package/src/services-pi/cert/index.js +79 -79
  78. package/src/services-pi/index.js +8 -8
  79. package/src/static-pi/index.js +10 -10
  80. package/src/webflo.js +30 -30
  81. package/test/index.test.js +26 -26
  82. package/test/site/package.json +9 -9
  83. package/test/site/public/bundle.html +5 -5
  84. package/test/site/public/bundle.html.json +3 -3
  85. package/test/site/public/bundle.js +2 -2
  86. package/test/site/public/bundle.webflo.js +15 -15
  87. package/test/site/public/index.html +29 -29
  88. package/test/site/public/index1.html +34 -34
  89. package/test/site/public/page-2/bundle.html +4 -4
  90. package/test/site/public/page-2/bundle.js +2 -2
  91. package/test/site/public/page-2/index.html +45 -45
  92. package/test/site/public/page-2/main.html +2 -2
  93. package/test/site/public/page-4/subpage/bundle.js +2 -2
  94. package/test/site/public/page-4/subpage/index.html +30 -30
  95. package/test/site/public/sparoots.json +4 -4
  96. package/test/site/public/worker.js +3 -3
  97. package/test/site/server/index.js +15 -15
  98. package/src/runtime-pi/Application.js +0 -29
  99. package/src/runtime-pi/Cookies.js +0 -82
  100. package/src/runtime-pi/Runtime.js +0 -21
  101. package/src/runtime-pi/client/Application.js +0 -100
  102. package/src/runtime-pi/client/Runtime.js +0 -332
  103. package/src/runtime-pi/client/createStorage.js +0 -57
  104. package/src/runtime-pi/client/oohtml/full.js +0 -7
  105. package/src/runtime-pi/client/oohtml/namespacing.js +0 -7
  106. package/src/runtime-pi/client/oohtml/scripting.js +0 -8
  107. package/src/runtime-pi/client/oohtml/templating.js +0 -8
  108. package/src/runtime-pi/client/worker/Application.js +0 -44
  109. package/src/runtime-pi/client/worker/Runtime.js +0 -269
  110. package/src/runtime-pi/server/Application.js +0 -116
  111. package/src/runtime-pi/server/Runtime.js +0 -557
  112. package/src/runtime-pi/xFormData.js +0 -24
  113. package/src/runtime-pi/xHeaders.js +0 -146
  114. package/src/runtime-pi/xRequest.js +0 -46
  115. package/src/runtime-pi/xRequestHeaders.js +0 -109
  116. package/src/runtime-pi/xResponse.js +0 -33
  117. package/src/runtime-pi/xResponseHeaders.js +0 -117
  118. package/src/runtime-pi/xxHttpMessage.js +0 -102
@@ -1,3 +1,3 @@
1
- /** @webqit/webflo */(async () => {
2
- var _r=Object.defineProperty;var yr=(t,e)=>()=>(t&&(e=t(t=0)),e);var xr=(t,e)=>{for(var r in e)_r(t,r,{get:e[r],enumerable:!0})};var qt={};xr(qt,{URLPattern:()=>Wt});function Tr(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function Rt(t,e=!1){let r=[],n=0;for(;n<t.length;){let i=t[n],s=function(o){if(!e)throw new TypeError(o);r.push({type:"INVALID_CHAR",index:n,value:t[n++]})};if(i==="*"){r.push({type:"ASTERISK",index:n,value:t[n++]});continue}if(i==="+"||i==="?"){r.push({type:"MODIFIER",index:n,value:t[n++]});continue}if(i==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});continue}if(i==="{"){r.push({type:"OPEN",index:n,value:t[n++]});continue}if(i==="}"){r.push({type:"CLOSE",index:n,value:t[n++]});continue}if(i===":"){let o="",f=n+1;for(;f<t.length;){let a=t.substr(f,1);if(f===n+1&&Ar.test(a)||f!==n+1&&Rr.test(a)){o+=t[f++];continue}break}if(!o){s(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:o}),n=f;continue}if(i==="("){let o=1,f="",a=n+1,u=!1;if(t[a]==="?"){s(`Pattern cannot start with "?" at ${a}`);continue}for(;a<t.length;){if(!Tr(t[a],!1)){s(`Invalid character '${t[a]}' at ${a}.`),u=!0;break}if(t[a]==="\\"){f+=t[a++]+t[a++];continue}if(t[a]===")"){if(o--,o===0){a++;break}}else if(t[a]==="("&&(o++,t[a+1]!=="?")){s(`Capturing groups are not allowed at ${a}`),u=!0;break}f+=t[a++]}if(u)continue;if(o){s(`Unbalanced pattern at ${n}`);continue}if(!f){s(`Missing pattern at ${n}`);continue}r.push({type:"PATTERN",index:n,value:f}),n=a;continue}r.push({type:"CHAR",index:n,value:t[n++]})}return r.push({type:"END",index:n,value:""}),r}function Tt(t,e={}){let r=Rt(t),{prefixes:n="./"}=e,i=`[^${le(e.delimiter||"/#?")}]+?`,s=[],o=0,f=0,a="",u=new Set,c=w=>{if(f<r.length&&r[f].type===w)return r[f++].value},l=()=>{let w=c("MODIFIER");return w||c("ASTERISK")},p=w=>{let L=c(w);if(L!==void 0)return L;let{type:v,index:k}=r[f];throw new TypeError(`Unexpected ${v} at ${k}, expected ${w}`)},h=()=>{let w="",L;for(;L=c("CHAR")||c("ESCAPED_CHAR");)w+=L;return w},R=w=>w,O=e.encodePart||R;for(;f<r.length;){let w=c("CHAR"),L=c("NAME"),v=c("PATTERN");if(!L&&!v&&c("ASTERISK")&&(v=".*"),L||v){let b=w||"";n.indexOf(b)===-1&&(a+=b,b=""),a&&(s.push(O(a)),a="");let F=L||o++;if(u.has(F))throw new TypeError(`Duplicate name '${F}'.`);u.add(F),s.push({name:F,prefix:O(b),suffix:"",pattern:v||i,modifier:l()||""});continue}let k=w||c("ESCAPED_CHAR");if(k){a+=k;continue}if(c("OPEN")){let b=h(),F=c("NAME")||"",W=c("PATTERN")||"";!F&&!W&&c("ASTERISK")&&(W=".*");let Ie=h();p("CLOSE");let vt=l()||"";if(!F&&!W&&!vt){a+=b;continue}if(!F&&!W&&!b)continue;a&&(s.push(O(a)),a=""),s.push({name:F||(W?o++:""),pattern:F&&!W?i:W,prefix:O(b),suffix:O(Ie),modifier:vt});continue}a&&(s.push(O(a)),a=""),p("END")}return s}function le(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function jt(t){return t&&t.sensitive?"u":"ui"}function jr(t,e){if(!e)return t;let r=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=r.exec(t.source);for(;i;)e.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=r.exec(t.source);return t}function Lr(t,e,r){let n=t.map(i=>Ft(i,e,r).source);return new RegExp(`(?:${n.join("|")})`,jt(r))}function Fr(t,e,r){return Lt(Tt(t,r),e,r)}function Lt(t,e,r={}){let{strict:n=!1,start:i=!0,end:s=!0,encode:o=c=>c}=r,f=`[${le(r.endsWith||"")}]|$`,a=`[${le(r.delimiter||"/#?")}]`,u=i?"^":"";for(let c of t)if(typeof c=="string")u+=le(o(c));else{let l=le(o(c.prefix)),p=le(o(c.suffix));if(c.pattern)if(e&&e.push(c),l||p)if(c.modifier==="+"||c.modifier==="*"){let h=c.modifier==="*"?"?":"";u+=`(?:${l}((?:${c.pattern})(?:${p}${l}(?:${c.pattern}))*)${p})${h}`}else u+=`(?:${l}(${c.pattern})${p})${c.modifier}`;else c.modifier==="+"||c.modifier==="*"?u+=`((?:${c.pattern})${c.modifier})`:u+=`(${c.pattern})${c.modifier}`;else u+=`(?:${l}${p})${c.modifier}`}if(s)n||(u+=`${a}?`),u+=r.endsWith?`(?=${f})`:"$";else{let c=t[t.length-1],l=typeof c=="string"?a.indexOf(c[c.length-1])>-1:c===void 0;n||(u+=`(?:${a}(?=${f}))?`),l||(u+=`(?=${a}|${f})`)}return new RegExp(u,jt(r))}function Ft(t,e,r){return t instanceof RegExp?jr(t,e):Array.isArray(t)?Lr(t,e,r):Fr(t,e,r)}function $r(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1}function It(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function Nr(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}function kt(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}function Nt(t){if(!t)return!0;for(let e of $t)if(t.test(e))return!0;return!1}function Dr(t,e){if(t=It(t,"#"),e||t==="")return t;let r=new URL("https://example.com");return r.hash=t,r.hash?r.hash.substring(1,r.hash.length):""}function Ur(t,e){if(t=It(t,"?"),e||t==="")return t;let r=new URL("https://example.com");return r.search=t,r.search?r.search.substring(1,r.search.length):""}function Mr(t,e){return e||t===""?t:kt(t)?Mt(t):Ut(t)}function Hr(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.password=t,r.password}function Wr(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.username=t,r.username}function qr(t,e,r){if(r||t==="")return t;if(e&&!$t.includes(e))return new URL(`${e}:${t}`).pathname;let n=t[0]=="/";return t=new URL(n?t:"/-"+t,"https://example.com").pathname,n||(t=t.substring(2,t.length)),t}function zr(t,e,r){return Dt(e)===t&&(t=""),r||t===""?t:Ht(t)}function Br(t,e){return t=Nr(t,":"),e||t===""?t:lt(t)}function Dt(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function lt(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function Gr(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}function Vr(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}function Ut(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}function Mt(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function Ht(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function Qr(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname}function Kr(t){return t===""?t:new URL(`data:${t}`).pathname}function Xr(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function Zr(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}function At(t,e){if(typeof t!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(t,e);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!=""?r.search.substring(1,r.search.length):void 0,hash:r.hash!=""?r.hash.substring(1,r.hash.length):void 0}}function Se(t,e,r){let n;if(typeof e.baseURL=="string")try{n=new URL(e.baseURL),t.protocol=n.protocol?n.protocol.substring(0,n.protocol.length-1):"",t.username=n.username,t.password=n.password,t.hostname=n.hostname,t.port=n.port,t.pathname=n.pathname,t.search=n.search?n.search.substring(1,n.search.length):"",t.hash=n.hash?n.hash.substring(1,n.hash.length):""}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=Br(e.protocol,r)),typeof e.username=="string"&&(t.username=Wr(e.username,r)),typeof e.password=="string"&&(t.password=Hr(e.password,r)),typeof e.hostname=="string"&&(t.hostname=Mr(e.hostname,r)),typeof e.port=="string"&&(t.port=zr(e.port,t.protocol,r)),typeof e.pathname=="string"){if(t.pathname=e.pathname,n&&!$r(t.pathname,r)){let i=n.pathname.lastIndexOf("/");i>=0&&(t.pathname=n.pathname.substring(0,i+1)+t.pathname)}t.pathname=qr(t.pathname,t.protocol,r)}return typeof e.search=="string"&&(t.search=Ur(e.search,r)),typeof e.hash=="string"&&(t.hash=Dr(e.hash,r)),t}function Pe(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function en(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function tn(t,e){let r=".*",n=`[^${en(e.delimiter||"/#?")}]+?`,i=/[$_\u200C\u200D\p{ID_Continue}]/u,s="";for(let o=0;o<t.length;++o){let f=t[o],a=o>0?t[o-1]:null,u=o<t.length-1?t[o+1]:null;if(typeof f=="string"){s+=Pe(f);continue}if(f.pattern===""){if(f.modifier===""){s+=Pe(f.prefix);continue}s+=`{${Pe(f.prefix)}}${f.modifier}`;continue}let c=typeof f.name!="number",l=e.prefixes!==void 0?e.prefixes:"./",p=f.suffix!==""||f.prefix!==""&&(f.prefix.length!==1||!l.includes(f.prefix));if(!p&&c&&f.pattern===n&&f.modifier===""&&u&&!u.prefix&&!u.suffix)if(typeof u=="string"){let h=u.length>0?u[0]:"";p=i.test(h)}else p=typeof u.name=="number";if(!p&&f.prefix===""&&a&&typeof a=="string"&&a.length>0){let h=a[a.length-1];p=l.includes(h)}p&&(s+="{"),s+=Pe(f.prefix),c&&(s+=`:${f.name}`),f.pattern===r?!c&&(!a||typeof a=="string"||a.modifier||p||f.prefix!=="")?s+="*":s+=`(${r})`:f.pattern===n?c||(s+=`(${n})`):s+=`(${f.pattern})`,f.pattern===n&&c&&f.suffix!==""&&i.test(f.suffix[0])&&(s+="\\"),s+=Pe(f.suffix),p&&(s+="}"),s+=f.modifier}return s}var Ar,Rr,Q,Ir,kr,$t,Yr,Jr,V,Wt,zt=yr(()=>{Ar=/[$_\p{ID_Start}]/u,Rr=/[$_\u200C\u200D\p{ID_Continue}]/u;Q={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ir={delimiter:".",prefixes:"",sensitive:!0,strict:!0},kr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};$t=["ftp","file","http","https","ws","wss"];Yr=class{constructor(t){this.tokenList=[],this.internalResult={},this.tokenIndex=0,this.tokenIncrement=1,this.componentStart=0,this.state=0,this.groupDepth=0,this.hostnameIPv6BracketDepth=0,this.shouldTreatAsStandardURL=!1,this.input=t}get result(){return this.internalResult}parse(){for(this.tokenList=Rt(this.input,!0);this.tokenIndex<this.tokenList.length;this.tokenIndex+=this.tokenIncrement){if(this.tokenIncrement=1,this.tokenList[this.tokenIndex].type==="END"){if(this.state===0){this.rewind(),this.isHashPrefix()?this.changeState(9,1):this.isSearchPrefix()?(this.changeState(8,1),this.internalResult.hash=""):(this.changeState(7,0),this.internalResult.search="",this.internalResult.hash="");continue}else if(this.state===2){this.rewindAndSetState(5);continue}this.changeState(10,0);break}if(this.groupDepth>0)if(this.isGroupClose())this.groupDepth-=1;else continue;if(this.isGroupOpen()){this.groupDepth+=1;continue}switch(this.state){case 0:this.isProtocolSuffix()&&(this.internalResult.username="",this.internalResult.password="",this.internalResult.hostname="",this.internalResult.port="",this.internalResult.pathname="",this.internalResult.search="",this.internalResult.hash="",this.rewindAndSetState(1));break;case 1:if(this.isProtocolSuffix()){this.computeShouldTreatAsStandardURL();let t=7,e=1;this.shouldTreatAsStandardURL&&(this.internalResult.pathname="/"),this.nextIsAuthoritySlashes()?(t=2,e=3):this.shouldTreatAsStandardURL&&(t=2),this.changeState(t,e)}break;case 2:this.isIdentityTerminator()?this.rewindAndSetState(3):(this.isPathnameStart()||this.isSearchPrefix()||this.isHashPrefix())&&this.rewindAndSetState(5);break;case 3:this.isPasswordPrefix()?this.changeState(4,1):this.isIdentityTerminator()&&this.changeState(5,1);break;case 4:this.isIdentityTerminator()&&this.changeState(5,1);break;case 5:this.isIPv6Open()?this.hostnameIPv6BracketDepth+=1:this.isIPv6Close()&&(this.hostnameIPv6BracketDepth-=1),this.isPortPrefix()&&!this.hostnameIPv6BracketDepth?this.changeState(6,1):this.isPathnameStart()?this.changeState(7,0):this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 6:this.isPathnameStart()?this.changeState(7,0):this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 7:this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 8:this.isHashPrefix()&&this.changeState(9,1);break;case 9:break;case 10:break}}}changeState(t,e){switch(this.state){case 0:break;case 1:this.internalResult.protocol=this.makeComponentString();break;case 2:break;case 3:this.internalResult.username=this.makeComponentString();break;case 4:this.internalResult.password=this.makeComponentString();break;case 5:this.internalResult.hostname=this.makeComponentString();break;case 6:this.internalResult.port=this.makeComponentString();break;case 7:this.internalResult.pathname=this.makeComponentString();break;case 8:this.internalResult.search=this.makeComponentString();break;case 9:this.internalResult.hash=this.makeComponentString();break;case 10:break}this.changeStateWithoutSettingComponent(t,e)}changeStateWithoutSettingComponent(t,e){this.state=t,this.componentStart=this.tokenIndex+e,this.tokenIndex+=e,this.tokenIncrement=0}rewind(){this.tokenIndex=this.componentStart,this.tokenIncrement=0}rewindAndSetState(t){this.rewind(),this.state=t}safeToken(t){return t<0&&(t=this.tokenList.length-t),t<this.tokenList.length?this.tokenList[t]:this.tokenList[this.tokenList.length-1]}isNonSpecialPatternChar(t,e){let r=this.safeToken(t);return r.value===e&&(r.type==="CHAR"||r.type==="ESCAPED_CHAR"||r.type==="INVALID_CHAR")}isProtocolSuffix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}nextIsAuthoritySlashes(){return this.isNonSpecialPatternChar(this.tokenIndex+1,"/")&&this.isNonSpecialPatternChar(this.tokenIndex+2,"/")}isIdentityTerminator(){return this.isNonSpecialPatternChar(this.tokenIndex,"@")}isPasswordPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}isPortPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}isPathnameStart(){return this.isNonSpecialPatternChar(this.tokenIndex,"/")}isSearchPrefix(){if(this.isNonSpecialPatternChar(this.tokenIndex,"?"))return!0;if(this.tokenList[this.tokenIndex].value!=="?")return!1;let t=this.safeToken(this.tokenIndex-1);return t.type!=="NAME"&&t.type!=="PATTERN"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}isHashPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,"#")}isGroupOpen(){return this.tokenList[this.tokenIndex].type=="OPEN"}isGroupClose(){return this.tokenList[this.tokenIndex].type=="CLOSE"}isIPv6Open(){return this.isNonSpecialPatternChar(this.tokenIndex,"[")}isIPv6Close(){return this.isNonSpecialPatternChar(this.tokenIndex,"]")}makeComponentString(){let t=this.tokenList[this.tokenIndex],e=this.safeToken(this.componentStart).index;return this.input.substring(e,t.index)}computeShouldTreatAsStandardURL(){let t={};Object.assign(t,Q),t.encodePart=lt;let e=Ft(this.makeComponentString(),void 0,t);this.shouldTreatAsStandardURL=Nt(e)}},Jr=["protocol","username","password","hostname","port","pathname","search","hash"],V="*";Wt=class{constructor(t={},e){this.regexp={},this.keys={},this.component_pattern={};try{if(typeof t=="string"){let i=new Yr(t);if(i.parse(),t=i.result,e)if(typeof e=="string")t.baseURL=e;else throw new TypeError("'baseURL' parameter is not of type 'string'.");else if(typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.")}else if(e)throw new TypeError("parameter 1 is not of type 'string'.");if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");let r={pathname:V,protocol:V,username:V,password:V,hostname:V,port:V,search:V,hash:V};this.pattern=Se(r,t,!0),Dt(this.pattern.protocol)===this.pattern.port&&(this.pattern.port="");let n;for(n of Jr){if(!(n in this.pattern))continue;let i={},s=this.pattern[n];switch(this.keys[n]=[],n){case"protocol":Object.assign(i,Q),i.encodePart=lt;break;case"username":Object.assign(i,Q),i.encodePart=Gr;break;case"password":Object.assign(i,Q),i.encodePart=Vr;break;case"hostname":Object.assign(i,Ir),kt(s)?i.encodePart=Mt:i.encodePart=Ut;break;case"port":Object.assign(i,Q),i.encodePart=Ht;break;case"pathname":Nt(this.regexp.protocol)?(Object.assign(i,kr),i.encodePart=Qr):(Object.assign(i,Q),i.encodePart=Kr);break;case"search":Object.assign(i,Q),i.encodePart=Xr;break;case"hash":Object.assign(i,Q),i.encodePart=Zr;break}try{let o=Tt(s,i);this.regexp[n]=Lt(o,this.keys[n],i),this.component_pattern[n]=tn(o,i)}catch{throw new TypeError(`invalid ${n} pattern '${this.pattern[n]}'.`)}}}catch(r){throw new TypeError(`Failed to construct 'URLPattern': ${r.message}`)}}test(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{typeof t=="object"?r=Se(r,t,!1):r=Se(r,At(t,e),!1)}catch{return!1}let n;for(n in this.pattern)if(!this.regexp[n].exec(r[n]))return!1;return!0}exec(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?r=Se(r,t,!1):r=Se(r,At(t,e),!1)}catch{return null}let n={};e?n.inputs=[t,e]:n.inputs=[t];let i;for(i in this.pattern){let s=this.regexp[i].exec(r[i]);if(!s)return null;let o={};for(let[f,a]of this.keys[i].entries())if(typeof a.name=="string"||typeof a.name=="number"){let u=s[f+1];o[a.name]=u}n[i]={input:r[i]||"",groups:o}}return n}get protocol(){return this.component_pattern.protocol}get username(){return this.component_pattern.username}get password(){return this.component_pattern.password}get hostname(){return this.component_pattern.hostname}get port(){return this.component_pattern.port}get pathname(){return this.component_pattern.pathname}get search(){return this.component_pattern.search}get hash(){return this.component_pattern.hash}};globalThis.URLPattern||(globalThis.URLPattern=Wt)});var ge=class{constructor(e,r=null){Object.defineProperty(this,"dict",{value:Object.create(e)});for(let n in this.dict)n in this||(this[n]=this.dict[n]);arguments.length>1&&Object.defineProperty(this.dict,"CWD",{get:()=>r})}get name(){return"webflo"}static create(...e){return new this(...e)}get CWD(){return this.dict.CWD||""}get meta(){return this.dict.meta||{}}get app(){return this.dict.app||{}}get config(){return this.dict.config||{}}get flags(){return this.dict.flags||{}}set flags(e){this.dict.flags=e}get layout(){return this.dict.layout||{}}set layout(e){this.dict.layout=e}get logger(){return this.dict.logger}set logger(e){this.dict.logger=e}};var _e=class extends ge{};var ye=class extends _e{};function d(t){return!Array.isArray(t)&&typeof t=="object"&&t}function S(t){return typeof t}function x(t,...e){globalThis.WebQitInternalsRegistry||(globalThis.WebQitInternalsRegistry=new Map);var r=globalThis.WebQitInternalsRegistry.get(t);if(!r){if(r=new Map,e[0]===!1)return r;globalThis.WebQitInternalsRegistry.set(t,r)}for(var n,i;n=e.shift();)if((i=r)&&!(r=r.get(n))){if(r=new Map,e[0]===!1)return r;i.set(n,r)}return r}function m(t){return Array.isArray(t)}function te(t){return typeof t=="function"}function it(t){return te(t)&&/^class\s?/.test(Function.prototype.toString.call(t))}function ke(t){return t===null||t===""}function N(t){return arguments.length&&(t===void 0||typeof t>"u")}function g(t){return Array.isArray(t)||typeof t=="object"&&t||te(t)}function B(t){return ke(t)||N(t)||t===!1||t===0||g(t)&&!Object.keys(t).length}function _(t){return te(t)||t&&{}.toString.call(t)==="[object function]"}function q(t){return t instanceof Number||typeof t=="number"}function P(t){return q(t)||t!==!0&&t!==!1&&t!==null&&t!==""&&!isNaN(t*1)}function st(t){return m(t)&&Object.getPrototypeOf(t)===Array.prototype}function $e(t){return d(t)&&Object.getPrototypeOf(t)===Object.prototype}function I(t){return t instanceof String||typeof t=="string"&&t!==null}function ot(t){return!I(t)&&!N(t.length)}function xe(t,e=1){var r=0;t.forEach(i=>{r++});var n=t.slice(t.length-r,e);return arguments.length>1?n:n[0]}function we(t,e=1){return arguments.length>1?xe(t.slice().reverse(),e).reverse():xe(t.slice().reverse())}function Ne(t,...e){return e.forEach(r=>{t.indexOf(r)<0&&t.push(r)}),t}function at(n,e){e=e||Object.prototype,e=e&&!m(e)?[e]:e;for(var r=[],n=n;n&&(!e||e.indexOf(n)<0)&&n.name!=="default";)r.push(n),n=n?Object.getPrototypeOf(n):null;return r}function ft(t,e){var r=[];return at(t,e).forEach(n=>{Ne(r,...Object.getOwnPropertyNames(n))}),r}function U(t,e,r=!1,n=!1,i=!1){var s=0,o=t.shift();if((P(o)||o===!0||o===!1)&&(s=o,o=t.shift()),!t.length)throw new Error("_merge() requires two or more array/objects.");return t.forEach((f,a)=>{!g(f)&&!_(f)||(r?ft(f):Object.keys(f)).forEach(u=>{if(!!e(u,o,f,a)){var c=o[u],l=f[u];if((m(c)&&m(l)||d(c)&&d(l))&&(s===!0||s>0))o[u]=m(c)&&m(l)?[]:{},U([P(s)?s-1:s,o[u],c,l],e,r,n,i);else if(m(o)&&m(f))n?o[u]=l:o.push(l);else try{i?Object.defineProperty(o,u,Object.getOwnPropertyDescriptor(f,u)):o[u]=f[u]}catch{}}})}),o}function H(t,e){var r=void 0;return g(t)&&Object.keys(t).forEach((n,i)=>{r!==!1&&(r=e(P(n)?parseFloat(n):n,t[n],i))}),r}function re(...t){return U(t,(e,r,n)=>!0,!1,!1,!1)}function z(t,e,r=!1){if(e=="")return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?"":t.substr(n+e.length)}function ut(t,e){return z(t,e,!0)}function fe(t,e,r=!1){if(e=="")return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?t:t.substr(0,n)}function ne(t,e){return fe(t,e,!0)}function ue(t,e,r=null,n=!1){return e.length>t.length?-1:(typeof r=="number"?n?t.slice(0,r+1+(r<0?t.length:0)):t.slice(r):t).reduce((i,s,o)=>{var[f,a,u]=i;if(!n&&f>-1)return[f,a,u];var c=u+1,l=s===e[c]?c===0?[o,0]:[a,c]:[-1,-1];return l[1]===e.length-1&&(l[1]=-1,l[0]>-1)?[l[0]].concat(l):[f].concat(l)},[-1,-1,-1])[0]+(n||typeof r!="number"?0:r>-1?r:t.length-r)}function ce(t,e,r=null,n=!1){var i=ue(t,e,r,n);return i===-1?[]:t.slice(i+e.length)}function be(t,e){return t.reduce((r,n,i)=>r||e(n,i),!1)}function y(t,e=!0){return m(t)?t:!e&&d(t)?[t]:t!==!1&&t!==0&&B(t)?[]:ot(t)?Array.prototype.slice.call(t):d(t)?Object.values(t):[t]}function G(t,e,r=null){return r||r!==!1&&t.dotSafe&&e.dotSafe?t.join(".")===e.join("."):t.length===e.length&&t.reduce((n,i,s)=>n&&i===e[s],!0)}function ve(t,e,r=null){return m(e)?t.filter(n=>r?e.filter(i=>r(n,i)).length:e.indexOf(n)!==-1):[]}function Oe(t,e,r=null){return r||r!==!1&&t.dotSafe&&e.dotSafe?(t.join(".")+".").startsWith(e.join(".")+"."):e.reduce((n,i,s)=>n&&i===t[s],!0)}function ct(t){let e=(r,n,i)=>i.indexOf(r)===n;return t.filter(e)}typeof URLPattern>"u"&&await Promise.resolve().then(()=>(zt(),qt));function Bt(t,e,r,n=!1){if(I(e)&&e.endsWith("]")){var i=ne(ut(e,"["),"]")||0;return P(i)&&(i=parseInt(i)),e=ne(e,"[")||0,P(e)&&(e=parseInt(e)),Bt(t,e,(s,o)=>{if(!s[o]){if(!n)return r();s[o]=P(i)?[]:{}}return r(s[o],i)},n)}else return r(t,e)}function De(t,e,r,n=!0){Bt(t,e,(i,s)=>{P(s)?(s=s||m(i)?i.length:Object.keys(i).filter(P).length,y(r,!1).forEach((o,f)=>{i[s+f]=o})):i[s]=n&&s in i?y(i[s],!1).concat(r):r},!0)}function ie(t,e={},r="&"){return t=t||"",(t.startsWith("?")?t.substr(1):t).split(r).filter(n=>n).map(n=>n.split("=").map(i=>i.trim())).forEach(n=>De(e,n[0],decodeURIComponent(n[1]))),e}function Ue(t,e,r,n=null){if((d(e)||m(e))&&(!n||n(e,t))){var i=m(e);Object.keys(e).forEach(s=>{Ue(`${t}[${s}]`,e[s],r,n)})}else r(t,!e&&e!==0?"":e)}function pe(t,e="&",r=null){var n=[];return Object.keys(t).forEach(i=>{Ue(i,t[i],(s,o)=>{n.push(`${s}=${encodeURIComponent(o)}`)},r)}),n.join(e)}var Gt={join(){for(var t=[],e=0,r=0,n=arguments.length;r<n;r++)t=t.concat(arguments[r].split("/"));var i=[];for(r=0,n=t.length;r<n;r++){var s=t[r];!s||s==="."||(s===".."?i.length?i.pop():e++:i.push(s))}return t[0]===""&&i.unshift(""),"../".repeat(e)+i.join("/")||(i.length?"/":".")},dirname(t){return this.join(t,"..")}},pt=(t,e=null)=>({pattern:new URLPattern(t,e),isPattern(){return Object.keys(this.pattern.keys||{}).some(r=>this.pattern.keys[r].length)},test(...r){return this.pattern.test(...r)},exec(...r){let n=this.pattern.exec(...r);if(!!n)return n.vars=Object.keys(this.pattern.keys).reduce(({named:i,unnamed:s},o)=>(this.pattern.keys[o].forEach(f=>{let a=n[o].groups[f.name];typeof f.name=="number"?s.push(a):i[f.name]=a}),{named:i,unnamed:s}),{named:{},unnamed:[]}),n.render=i=>i.replace(/\$(\$|[0-9A-Z]+)/gi,(s,o)=>o==="$"?"$":(P(o)?n.vars.unnamed[o-1]:n.vars.named[o])||""),n}});var Ee=class{constructor(e,r){this.cx=e,this.path=m(r)?r:(r+"").split("/").filter(n=>n)}async route(e,r,n,i,s=null){let o=this,f=async function(a){let u={};if(!a.trail||a.trail.length<a.destination.length){if(a=await o.readTick(a),u.pathname=`/${a.trail.join("/")}`,u.stepname=a.trail[a.trail.length-1],o.finalizeHandlerContext(u,a),a.exports){a.exports.hints&&await r.port.post({...a.exports.hints,$type:"handler:hints"});let c=y(a.method),l=_(a.exports)&&c.includes("default")?a.exports:c.reduce((p,h)=>p||a.exports[h.toLowerCase()],null);if(l){let p=async(...R)=>{let O={...a,arg:R[0]};if(R.length>1){var w=R[1],L,v={...R[2]||{}};if(R[1]instanceof O.event.Request)L=R[1],w=L.url;else if(!I(w))throw new Error("Router redirect url must be a string!");var k=w.startsWith("/")?w:o.pathJoin(`/${a.trail.join("/")}`,w);if(k.startsWith("../"))throw new Error("Router redirect cannot traverse beyond the routing directory! ("+w+" >> "+k+")");v.method&&(O.method=v.method,m(v.method)&&(v.method=v.method[0])),L?O.event=a.event.retarget(L,{...v,_proxy:{url:k}}):O.event=a.event.retarget(k,v),O.source=a.destination.join("/"),O.destination=k.split("?").shift().split("/").map($=>$.trim()).filter($=>$),O.trail=R[1].startsWith("/")?[]:a.trail.reduce(($,b,F)=>$.length===F&&b===O.destination[F]?$.concat(b):$,[]),O.trailOnFile=a.trailOnFile.slice(0,O.trail.length)}return f(O)},h=a.destination.slice(a.trail.length);return p.pathname=h.join("/"),p.stepname=h[0],await l.call(u,a.event,a.arg,p,s)}return f(a)}else if((a.currentSegmentOnFile||{}).dirExists)return f(a)}if(i)return await i.call(u,a.event,a.arg,s)};return f({destination:this.path,event:r,method:e,arg:n})}};var Ce=class extends Ee{async readTick(e){var r=this.cx.layout,n=Object.keys(this.cx.layout);return e.trail?(e.currentSegment=e.destination[e.trail.length],e.currentSegmentOnFile=[e.currentSegment,"-"].reduce((i,s)=>{if(i.index)return i;var o=`/${e.trailOnFile.concat(s).join("/")}`;return r[o]?{seg:s,index:o}:n.filter(f=>f.startsWith(`${o}/`)).length?{seg:s,dirExists:!0}:i},{seg:null}),e.trail.push(e.currentSegment),e.trailOnFile.push(e.currentSegmentOnFile.seg),e.exports=r[e.currentSegmentOnFile.index]):(e.trail=[],e.trailOnFile=[],e.currentSegmentOnFile={index:"/"},e.exports=r["/"]),e}finalizeHandlerContext(e,r){return e.dirname=r.currentSegmentOnFile.index}pathJoin(...e){return Gt.join(...e)}};var Ae=class{constructor(e){this.cx=e}async handle(e,r){let n=new Ce(this.cx,e.url.pathname);return(async()=>{let s=e.request.method.toLowerCase(),o=await n.route([s==="delete"?"del":s,"default"],e,{},async f=>r(f.request),r);return o instanceof e.Response||(o=e.Response.compat(o)),o})()}};function se(t){return(ht(t)?t:y(t).length?[t]:[]).reduce((e,r)=>e.concat([y(r)]),[]).map(e=>K.resolve(e))}var K=class extends Array{static resolve(e){return e.every(r=>!(r+"").includes("."))?new K().concat(e):e}get dotSafe(){return!0}};function ht(t){return y(t).reduce((e,r)=>e||m(r),!1)}function mt(t){return t.filter(e=>e||e===0).length!==t.length}function Vt(t){return t.filter(e=>mt(y(e))).length>0}var oe=class{constructor(e){this.target=e,this.fireables=[],this.currentlyFiring=[]}add(e){return this.fireables.push(e),e}remove(e){this.fireables=this.fireables.filter(r=>r!==e)}removeMatches(e){this.match(e).forEach(r=>{this.fireables=this.fireables.filter(n=>n!==r)})}match(e){return this.fireables.filter(r=>{var n=se(r.filter),i=y((r.params||{}).tags),s=se(e.filter),o=y((e.params||{}).tags);return(!e.originalHandler||r.handler===e.originalHandler)&&(!s.length||G(s,n))&&(!o.length||o.length===i.length&&ve(i,o).length===o.length)})}static _getFirebase(e,r,n=!0,i=this.__namespace){if(!g(r))throw new Error('Subject must be of type object; "'+S(r)+'" given!');var s=this;return i&&globalThis.WebQitObserverNamespaceRegistry.has(e+"-"+i)&&(s=globalThis.WebQitObserverNamespaceRegistry.get(e+"-"+i),e+="-"+i),!x(r,"firebases").has(e)&&n&&x(r,"firebases").set(e,new s(r)),x(r,"firebases").get(e)}static _namespace(e,r,n=null){if(e+="-"+r,arguments.length===2)return globalThis.WebQitObserverNamespaceRegistry.get(e);if(!(n.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${r} must be a subclass of ${this.name}.`);globalThis.WebQitObserverNamespaceRegistry.set(e,n),n.__namespace=r}};globalThis.WebQitObserverNamespaceRegistry||(globalThis.WebQitObserverNamespaceRegistry=new Map);var ae=class{constructor(e,r){this.target=e,this.handler=r.handler,this.filter=r.filter,this.params=r.params}disconnect(){this.disconnected=!0}};var Re=class extends ae{fire(e,r,n){return this.disconnected||this.filter&&!ve(y(this.filter),[e.type]).length?r(...Array.prototype.slice.call(arguments,2)):this.handler(e,n,r)}};function Me(t,e=[],r=!0){var n=0;return P(arguments[0])&&g(arguments[1])&&(n=arguments[0],t=arguments[1],e=arguments[2]||[]),U([n,{},t],(i,s,o)=>_(e)?e(i):m(e)&&e.length?e.indexOf(i)>-1:!0,!1,!1,r)}var he=class{constructor(e,r){if(this.target=e,!r.type)throw new Error("Action type must be given in definition!");H(r,(n,i)=>{Object.defineProperty(this,n,{value:i,enumerable:!0})}),Object.seal(this)}};var T=class extends oe{add(e){return super.add(new Re(this.target,e))}fire(e,r=null){if(e instanceof he||(e=new he(this.target,e)),this.currentlyFiring.filter(s=>s.type===e.type&&s.name===e.name).length)return r?r():void 0;this.currentlyFiring.push(e);let n=(s,...o)=>{var f=this.fireables[s];return f?f.fire(e,(...a)=>n(s+1,...a),...o):r?r(...o):o[0]};var i=n(0);return this.currentlyFiring.pop(),i}static getFirebase(e,r=!0,n=null){return super._getFirebase("interceptor",...arguments)}static namespace(e,r=null){return super._namespace("interceptor",...arguments)}};function A(t){return x(t,!1).get(t)||t}function j(t,e,r={},n={}){if(!e||!g(e))throw new Error("Target must be of type object!");e=A(e);var i,s=function(o){return arguments.length?o:Reflect[t](e,...Object.values(r))};return(i=T.getFirebase(e,!1,n.namespace))?i.fire({type:t,...r},s):s()}function We(t,e,r,n={}){return j("apply",t,{thisArgument:e,argumentsList:r},n)}function qe(t,e,r=null,n={}){return j("construct",t,arguments.length>2?{argumentsList:e,newTarget:r}:{argumentsList:e},n)}var M=class{constructor(e,r=!1){this._={},this._.target=e,this._.cancellable=r,this._.propagationStopped=!1,this._.defaultPrevented=!1,this._.promisesInstance=null,this._.promises=[]}get target(){return this._.target}get cancellable(){return this._.cancellable}stopPropagation(){this._.propagationStopped=!0}get propagationStopped(){return this._.propagationStopped}preventDefault(){this._.defaultPrevented=!0}get defaultPrevented(){return this._.defaultPrevented}waitUntil(e){e instanceof Promise&&(this._.promises.push(e),this._.promisesInstance=null)}get promises(){return!this._.promisesInstance&&this._.promises.length&&(this._.promisesInstance=Promise.all(this._.promises)),this._.promisesInstance}respondWith(e){var r,n=d(e)&&!N(e.propagationStopped)&&!N(e.defaultPrevented);e===!1||n&&e.propagationStopped?this.stopPropagation():e===!1||n&&e.defaultPrevented?this.preventDefault():(e instanceof Promise&&(r=e)||n&&(r=e.promises))&&this.waitUntil(r)}};var Te=class extends ae{constructor(e,r){if(super(e,r),this.filters2D=se(this.filter),this.filtersIsOriginally2D=ht(this.filter),this.filtersIsDynamic=Vt(this.filters2D),this.filtersIsDynamic&&this.filters2D.length>1)throw new Error('Only one "Dynamic Filter" must be observed at a time! "'+this.filters2D.map(n=>"["+n.join(", ")+"]").join(", ")+'" have been bound together.')}fire(e){if(this.disconnected||this.params.type&&!be(e,o=>this.params.type===o.type))return;let r=o=>!["set","def"].includes(o.type)||!this.params.diff||(_(this.params.diff)?this.params.diff(o.value,o.oldValue):o.value!==o.oldValue);var n=new M(this.target);if(this.filters2D.length){var i=e.filter(o=>this.filters2D.filter((f,a)=>{var u=f.slice();return this.filtersIsDynamic&&o.path.forEach((c,l)=>{u[l]=u[l]||u[l]===0?u[l]:c}),(!this.filtersIsDynamic||!mt(u))&&r(o)&&(!this.params.subtree&&G(u,o.path)||this.params.suptree&&Oe(u,o.path)&&(!P(this.params.suptree)||ce(u,o.path).length<=this.params.suptree)||this.params.subtree&&o.path.length>=u.length&&Oe(o.path,u)&&(!P(this.params.subtree)||ce(o.path,u).length<=this.params.subtree))}).length);if(i.length)if(this.filtersIsOriginally2D||this.params.subtree){var s=i;d(this.filter)&&(s={...this.filter},i.forEach((o,f)=>{s[o.name]=o})),n.respondWith(this.handler(s,n))}else i.forEach((o,f)=>{n.respondWith(this.handler(o,n))})}else(this.params.subtree||e.filter(o=>G(o.path,[o.name])).length===e.length)&&e.filter(o=>r(o)).length&&n.respondWith(this.handler(e,n));return n}};var X=class{constructor(e,r){if(this.target=e,r.originalSubject||(this.originalSubject=e),!("type"in r))throw new Error("Mutation type must be given in definition!");if(!("name"in r))throw new Error("Property name must be given in definition!");H(r,(n,i)=>{n==="path"&&(i=K.resolve(i)),Object.defineProperty(this,n,{value:i,enumerable:!0})}),this.path||Object.defineProperty(this,"path",{value:K.resolve([r.name]),enumerable:!0}),Object.seal(this)}};var E=class extends oe{constructor(e){super(e),this.buffers=[]}add(e){return super.add(new Te(this.target,e))}fire(e,r){var n=new M(this.target,r);return e=y(e,!1).map(i=>i instanceof X?i:new X(this.target,i)),this.buffers.length?(we(this.buffers)(e),n):(this.currentlyFiring.filter(i=>e.filter(s=>i.type===s.type&&i.name===s.name).length).length,this.fireables.forEach(i=>{if(n.propagationStopped&&r)return n;n.respondWith(i.fire(e))}),n)}static getFirebase(e,r=!0,n=null){return super._getFirebase("observer",...arguments)}static namespace(e,r=null){return super._namespace("observer",...arguments)}};function D(t,e,r=null,n={}){if(t=r||t,!t||!g(t))throw new Error("Target must be of type object!");t=A(t);var i=y(e),s=i.map(o=>{var f,a=function(u){return arguments.length?u:x(t,"accessorizedProps").has(o)&&x(t,"accessorizedProps").get(o).touch(!0)?x(t,"accessorizedProps").get(o).get():r?Reflect.get(t,o,r):Reflect.get(t,o)};return(f=T.getFirebase(t,!0,n.namespace))?f.fire({type:"get",name:o,related:i,receiver:r},a):a()});return m(e)?s:s[0]}function ze(t,e,r=null,n={}){if(t=A(t),!t||!g(t))throw new Error('Observable subjects must be of type object; "'+S(t)+'" given!');if(_(e)&&(n=arguments.length>2?r:{},r=e,e=null),!_(r))throw new Error('Handler must be a function; "'+S(r)+'" given!');var i,s=E.getFirebase(t,!0,n.namespace),o={filter:e,handler:r,params:n};if((o.filter||o.params.subtree==="*"||o.params.subtree&&me(t))&&Z(t,o.filter,o.params.subtree,n.namespace),o.params.unique&&(i=s.match({filter:e,params:n})).length){if(o.params.unique!=="replace")return i[0];s.remove(i[0])}return s.add(o)}function Y(t,e,r,n=null,i={}){if(t!==r){var s;if(ze(r,(f,a)=>{if(s=E.getFirebase(t,!1,i.namespace)){var u=f.map(c=>{var l=c;do if(l.target===t)return;while(l=l.src);var p={};return H(c,(h,R)=>{h!=="target"&&h!=="name"&&h!=="path"&&h!=="src"&&(p[h]=R)}),p.name=e,p.path=[e].concat(c.path),p.originalSubject=c.originalSubject,p.src=c,new X(t,p)}).filter(c=>c);if(u.length)return s.fire(u,a.cancellable)}},{subtree:!0,...i,unique:!0,tags:[gt,e,t]}),d(n)&&(s=E.getFirebase(t,!1,i.namespace))){var o=re({name:e,type:"set",value:r,related:[e]},n);let f=s.fire(o,i.cancellable);if(i.eventTypeReturn)return f}}}var gt={};function Z(t,e=null,r=!1,n=null){if(!t||!g(t))throw new Error("Target must be of type object!");var i=E.getFirebase(t,!0,n);if(!(!i||i.build)){i.build=r;var s=se(e),o=!s.length||s.filter(a=>!a[0]&&a[0]!==0).length?Object.keys(t):s.map(a=>a[0]),f=s.length?s.map(a=>a.slice(1)).filter(a=>a.length):null;i.subBuild=f&&f.length?f:null,o.forEach(a=>{var u=D(t,a,null,{namespace:n});try{g(u)&&(Y(t,a,u,null,params),(i.subBuild&&me(u)||(_isFunction(r)?r(u):r&&me(u)))&&Z(u,i.subBuild,r,n))}catch{}})}}var me=t=>(t instanceof Object||t instanceof Array||t instanceof Function)&&(typeof window>"u"||t!==window);function Be(t,e,r=null,n={}){if(t=A(t),!t||!g(t))throw new Error('Observable subjects must be of type object; "'+S(t)+'" given!');if(_(e)&&(n=arguments.length>2?r:{},r=e,e=null),r&&!_(r))throw new Error('Handler must be a function; "'+S(r)+'" given!');var i;if(i=E.getFirebase(t,!1,n.namespace))return i.removeMatches({filter:e,originalHandler:r,params:n})}function J(t,e,r,n=null,i={}){Be(r,null,null,{...i,tags:[gt,e,t]});var s;if(d(n)&&(s=E.getFirebase(t,!1,i.namespace))){var o=re({name:e,type:"del",oldValue:r,related:[e]},n);s.fire(o,i.cancellable)}}function ee(t,e,r={}){return j("has",t,{name:e},r)}function Ge(t,e,r,n={}){e=r.receiver||e;var i=r.keysOrPayload,s=r.value;if(!e||!g(e))throw new Error("Target must be of type object!");d(i)&&(n=s||{},s=null),e=A(e);var o=T.getFirebase(e,!1,n.namespace),f=E.getFirebase(e,!1,n.namespace);let a=(h,R,O,w)=>{var L="set",v;t&&(L="defineProperty",v=R||{},R=v.value);var k=!1,$;ee(e,h,n)&&(k=!0,$=D(e,h,r.receiver,n));var b={name:h,type:L,value:R,receiver:r.receiver,related:O,detail:w,isUpdate:k,oldValue:$},F=function(Ie){return arguments.length&&(v?v=Ie:R=Ie),v?x(e,"accessorizedProps",!1).has(h)&&!x(e,"accessorizedProps").get(h).restore()?!1:(Object.defineProperty(e,h,v),!0):x(e,"accessorizedProps",!1).has(h)?x(e,"accessorizedProps").get(h).set(R):(e[h]=R,!0)};if(o){var W=v?{type:"defineProperty",name:h,descriptor:v,receiver:r.receiver,related:O,detail:w,isUpdate:k,oldValue:$}:{type:"set",name:h,value:R,receiver:r.receiver,related:O,detail:w,isUpdate:k,oldValue:$};b.success=o.fire(W,F)}else b.success=F();return b.success&&b.value!==b.oldValue&&(g(b.oldValue)&&J(e,h,b.oldValue,null,n),g(b.value)&&(Y(e,h,b.value,null,n),f&&(f.subBuild||f.build&&me(b.value))&&Z(b.value,f.subBuild,f.build,n.namespace))),b};var u,c=[];m(i)||(I(i)||q(i))&&(u=y(i))?c=u.map(h=>a(h,s,u,n.detail)):d(i)&&(u=Object.keys(i))&&(c=u.map(h=>a(h,i[h],u,n.detail)));var l=c.filter(h=>h.success!==!1),p;return f?(p=f.fire(l,n.cancellable),p.successCount=l.length):n.eventTypeReturn&&(p=new M(e)),n.eventTypeReturn?p:l.length>0}function Ve(t,e,r=null,n={}){return Ge(!0,t,{keysOrPayload:e,value:r},n)}function Qe(t,e,r={}){if(!t||!g(t))throw new Error("Target must be of type object!");t=A(t);var n=y(e),i=n.map(a=>{var u;ee(t,a,r)&&(u=D(t,a,null,r));var c={name:a,type:"deleteProperty",related:n,detail:r.detail,oldValue:u},l,p=function(h){return arguments.length?h:x(t,"accessorizedProps",!1).has(a)&&!x(t,"accessorizedProps").get(a).restore()?!1:(delete t[a],!0)};return(l=T.getFirebase(t,!1,r.namespace))?c.success=l.fire({type:"deleteProperty",name:a,oldValue:u,related:n},p):c.success=p(),c.success&&g(c.oldValue)&&J(t,a,c.oldValue,null,r),c}),s=i.filter(a=>a.success!==!1),o,f;return(o=E.getFirebase(t,!1,r.namespace))?(f=o.fire(s,r.cancellable),f.successCount=s.length):r.eventTypeReturn&&(f=new M(t)),r.eventTypeReturn?f:s.length>0}function Ke(t,e,r={}){return j("getOwnPropertyDescriptor",t,{name:e},r)}function Xe(t,e={}){return j("getPrototypeOf",t,{},e)}function Ze(t,e={}){return j("isExtensible",t,{},e)}function Ye(t,e={}){return j("ownKeys",t,{},e)}function Je(t,e={}){return j("preventExtensions",t,{},e)}function de(t,e,r=null,n=null,i={}){return Ge(!1,t,arguments.length>3?{keysOrPayload:e,value:r,receiver:n}:{keysOrPayload:e,value:r},i)}function et(t,e,r={}){return j("setPrototypeOf",t,{prototype:e},r)}function Qt(t,e=[],r={}){r=d(e)?e:r;var n=(arguments.length===1?Object.keys(t):y(e)).map(i=>{if(x(t,"accessorizedProps").has(i)&&x(t,"accessorizedProps").get(i).touch(!0))return!1;let s=()=>{for(var p,h=t;!p&&(h=Object.getPrototypeOf(h));)p=Object.getOwnPropertyDescriptor(h,i);return p};var o=Object.getOwnPropertyDescriptor(t,i),f,a;o||(f={writable:!0,enumerable:!(i in t),configurable:r.configurable!==!1});var u={...o||f};"value"in u&&delete u.value,"writable"in u&&delete u.writable,u.get=()=>{if(l.ongoingGets.length)return l.get();l.ongoingGets.push(1);var p=D(t,i,null,r);return l.ongoingGets.pop(),p};var c;u.set=p=>{if(l.ongoingSets.length)return l.set(p);l.ongoingSets.push(1);var h=de(t,i,p,null,r);return l.ongoingSets.pop(),h};var l={ongoingGets:[],ongoingSets:[],get:function(){var p=o;return p||(a?p=f:p=s()||f),p.get?p.get.call(t):p.value},set:function(p){var h=o;return h||(a?h=f:(h=s())?"value"in h&&(h=f,a=!0):(h=f,a=!0)),h.set||h.get?h.set?h.set.call(t,p):!1:(h.value=p,!0)},restore:function(){try{return this.intact()&&(o||a?Object.defineProperty(t,i,o||f):delete t[i],x(t,"accessorizedProps").delete(i)),!0}catch{}return!1},intact:function(){return(Object.getOwnPropertyDescriptor(t,i)||{}).get===u.get},touch:function(p=!1){return this.intact()||(p?!this.restore():!1)}};try{return Object.defineProperty(t,i,u),x(t,"accessorizedProps").set(i,l),!0}catch{}return!1});return m(e)?n:n[0]}function Kt(t,e=[],r={}){r=d(e)?e:r;var n=(arguments.length===1?Object.keys(t):y(e)).map(i=>x(t,"accessorizedProps",!1).has(i)?x(t,"accessorizedProps").get(i).restore():!0);return m(e)?n:n[0]}function Xt(t,e={}){if(!g(t))throw new Error('Object must be of type target; "'+S(t)+'" given!');var r=new Proxy(t,{apply:(n,i,s)=>We(n,i,s,e),construct:(n,i,s=null)=>qe(n,i,s,e),defineProperty:(n,i,s)=>Ve(n,i,s,e),deleteProperty:(n,i)=>Qe(n,i,e),get:(n,i,s=null)=>{var o=D(n,i,s,e);return e.proxyAutoBinding!==!1&&_(o)&&!it(o)?o.bind(r):o},getOwnPropertyDescriptor:(n,i)=>Ke(n,i,e),getPrototypeOf:n=>Xe(n,e),has:(n,i)=>ee(n,i,e),isExtensible:n=>Ze(n,e),ownKeys:n=>Ye(n,e),preventExtensions:n=>Je(n,e),set:(n,i,s,o=null)=>de(n,i,s,o,e),setPrototypeOf:(n,i)=>et(n,i,e)});return x(r).set(r,t),r}function Zt(t,e,r={}){if(t=A(t),!g(t))throw new Error('Object must be of type target; "'+S(handler)+'" given!');var n={},i=!0;d(e)||(_(e)?e={"":e}:_(r)&&(e={[e]:r},r=arguments.length>3?arguments[3]:{}),i=!1);var s=T.getFirebase(t,!0,r.namespace);return Object.keys(e).forEach(o=>{if(!_(e[o]))throw new Error("Callback"+(o===null?"":" for "+o)+' must be a function; "'+S(e[o])+'" given!');var f={filter:o,handler:e[o],params:r},a;if(f.params.unique&&(a=s.match(f)).length){if(f.params.unique!=="replace")return a[0];s.remove(a[0])}i?n[o]=s.add(f):n=s.add(f)}),n}function Yt(t,e=null,r={}){if(t=A(t),!t||!g(t))throw new Error('Object must be of type target; "'+S(t)+'" given!');var n=T.getFirebase(t,!1,r.namespace);_isObject(e)||(_(e)?e={[null]:e}:_(r)&&(e={[e]:r},r=arguments.length>3?arguments[3]:{}),isOriginallyObj=!1),(n=T.getFirebase(t,!1,r.namespace))&&Object.keys(e).forEach(i=>{if(!_(e[i]))throw new Error("Callback"+(i===null?"":" for "+i)+' must be a function; "'+S(e[i])+'" given!');var s={filter:i,originalHandler:e[i],params:r};return n.removeMatches(s)})}function Jt(t,...e){var r=e.map(s=>{if(s=A(s),!g(s))throw new Error("Target must be of type object!");return{target:s,subjectCopy:m(s)?s.slice(0):Me(s)}}),n=t(...e);let i=()=>{r.map(s=>{var o=Object.keys(s.subjectCopy),f=Object.keys(s.target),a=[],u=ct(o.concat(f)).map(l=>{if(s.subjectCopy[l]!==s.target[l]){a.push(l);var p={name:l,related:a,buffered:!0};return f.includes(l)?(p.type="set",p.value=s.target[l],o.includes(l)&&(p.isUpdate=!0)):p.type="del",o.includes(l)&&(p.oldValue=s.subjectCopy[l]),g(s.subjectCopy[l])&&J(s.target,l,s.subjectCopy[l]),g(s.target[l])&&Y(s.target,l,s.target[l]),p}}).filter(l=>l),c;if(u.length&&(c=E.getFirebase(s.target,!1)))return c.fire(u)})};return n instanceof Promise?n.then(i):i(),n}var C={apply:We,construct:qe,defineProperty:Ve,deleteProperty:Qe,get:D,getOwnPropertyDescriptor:Ke,getPrototypeOf:Xe,has:ee,isExtensible:Ze,ownKeys:Ye,preventExtensions:Je,set:de,setPrototypeOf:et,accessorize:Qt,unaccessorize:Kt,proxy:Xt,unproxy:A,observe:ze,unobserve:Be,intercept:Zt,unintercept:Yt,closure:Jt,build:Z,link:Y,unlink:J,Observers:E,Interceptors:T};var{URL:er,fetch:tr,Headers:_t,Request:rr,Response:nr,FormData:ir,ReadableStream:on,File:_d,Blob:yt}=globalThis;var fn=t=>{let e=class extends t{constructor(...r){super(...r);var n=ie(this.search);let i=s=>{var o=pe(s);o=o?"?"+o:"",o!==this.search&&(this.search=o)};this.__query={value:n,proxy:new Proxy(n,{set(s,o,f){return s[o]=f,i(s),!0},deleteProperty(s,o){return delete s[o],i(s),!0}})}}set search(r){super.search=r;var n=ie(r);xt(n,this.query)||(this.query=n)}get search(){return super.search}get query(){return this.__query.proxy}};return e.Observable=class extends e{constructor(){super(...arguments);let{Observer:r}=WebQit;r.accessorize(this,["protocol","username","password","host","hostname","port","origin","pathname","search","query","hash","href"])}},e},xt=(t,e)=>d(t)&&d(e)?xt(Object.keys(t),Object.keys(e))&&xt(Object.values(t),Object.values(e)):m(t)&&m(e)?t.length===e.length&&t.reduce((r,n,i)=>r&&n===e[i],!0):t===e,sr=fn;var un=t=>class extends t{tee(e=null){let r=new this.constructor,n=new this.constructor;for(var[i,s]of this.entries()){let o=o(s);e&&e(s,i,o)||!e&&!o?r.append(i,s):n.append(i,s)}return[r,n]}json(e={},r=null){if(arguments.length){Object.keys(e).forEach(o=>{Ue(o,e[o],(f,a)=>{(!r||r(f,a,g(a)))&&this.append(f,a)},f=>!wt(f))});return}var n;for(var[i,s]of this.entries())n||(n=P(fe(i,"["))?[]:{}),De(n,i,s);return n}},or=un,wt=(t,e=null)=>{if(!g(t))return;let r=t[Symbol.toStringTag];return(e||["Uint8Array","Uint16Array","Uint32Array","ArrayBuffer","Blob","File","FormData","Stream"]).reduce((n,i)=>n||(r===i?i:null),null)};var cn=t=>class extends t{constructor(e={}){e instanceof t?super(e):(super(),this.json(e))}json(e={},r=!0){if(arguments.length){let o=ar(this),f=Object.keys(o).reduce((a,u)=>a.concat(typeof u!="symbol"&&"set"in o[u]?u:[]),[]);Object.keys(e).forEach(a=>{var u=f.reduce((c,l)=>c||(l===a||l.toLocaleLowerCase()===a?l:null),null);u?(r||this[u]===void 0)&&(this[u]=e[a]):(r||!this.has(a))&&this.set(a,e[a])});return}let n={};for(var[i,s]of this)n[i]=s;return n}set cacheControl(e){return this.set("Cache-Control",e)}get cacheControl(){return this.get("Cache-Control")}set contentLength(e){return this.set("Content-Length",e)}get contentLength(){return this.get("Content-Length")}set contentType(e){return this.set("Content-Type",e)}get contentType(){return this.get("Content-Type")}},tt=cn;function ar(t){if(t){let e=Object.getPrototypeOf(t);return e===Object.prototype?{}:{...ar(e),...Object.getOwnPropertyDescriptors(t)}}else return Object.create(null)}var ln=t=>class extends tt(t){set accept(e){return this.set("Accept",e)}get accept(){let e=this.get("Accept"),r=e&&e.split(",").map(n=>(n=n.trim().split(";").map(i=>i.trim()),[n.shift(),parseFloat((n.pop()||"1").replace("q=",""))])).sort((n,i)=>n[1]>i[1]?-1:1)||[];return{match(n){return n=(n+"").split("/"),r.reduce((i,s)=>i||(s=s[0].split("/"))&&[0,1].every(o=>n[o]===s[o]||n[o]==="*"||s[o]==="*"),!1)},toString(){return e}}}set cookies(e){if(!d(e))throw new Error(`Cookies must be of type object. Received type: ${S(e)}.`);return this.set("Cookie",pe(e,";")),this._cookies=null,!0}get cookies(){return this._cookies||(this._cookies=ie(this.get("cookie"),{},";")),this._cookies}set range(e){let r=[];return y(e).forEach((n,i)=>{let s=Array.isArray(n)?n.join("-"):n+"";i===0&&!s.includes("bytes=")&&(s=`bytes=${s}`),r.push(s)}),this.set("Range",r.join(", "))}get range(){let e=this.get("Range");return e?z(e,"bytes=").split(",").map(n=>{let i=n.trim().split("-");return i[0]=i[0]?parseInt(i[0],10):void 0,i[1]&&(i[1]=parseInt(i[1],10)),i.clamp=s=>{(i[1]>s-1||i[1]===void 0)&&(i[1]=s-1),i[0]===void 0&&(i[0]=i[1]?s-i[1]-1:0)},i}):void 0}set cors(e){return this.set("Access-Control-Allow-Origin",e===!0?"*":e===!1?"":e)}get cors(){return this.get("Access-Control-Allow-Origin")}},fr=ln;var pn=t=>class extends tt(t){set cookies(e){if(!d(e))throw new Error(`The "cookies" response directive cannot be of type: ${S(e)}`);for(let r in e){let n=e[r];if(d(n)){let i=[n.value];for(let s in n){if(s==="value")continue;let o=s[0].toUpperCase()+s.substring(1);o==="MaxAge"&&(o="Max-Age"),i.push(n[s]===!0?o:`${o}=${n[s]}`)}n=i.join("; ")}this.append("Set-Cookie",`${r}=${n}`)}return!0}get cookies(){let e=this.get("Set-Cookie");return e&&e.split(",").reduce((r,n)=>{let[i,s]=n.split(";"),[o,f]=i.trim().split("=");return r[o]={value:f},s&&(s||"").split(/\;/g).map(a=>a.trim().split("=")).forEach(a=>{r[o][a[0][0].toLowerCase()+a[0].substring(1).replace("-","")]=a.length===1?!0:a[1]}),r},{})}set contentRange(e){if(Array.isArray(e)){if(e.length===2&&!e[0].includes("-")||e.length<2)throw new Error("A Content-Range array must be in the format: [ 'start-end', 'total' ]");return this.set("Content-Range",`bytes ${e.join("/")}`)}return this.set("Content-Range",e)}get contentRange(){let e=this.get("Content-Range");return e&&z(e,"bytes ").split("/")}set cors(e){return this.set("Access-Control-Allow-Origin",e===!0?"*":e===!1?"":e)}get cors(){return this.get("Access-Control-Allow-Origin")}set attachment(e){if(e=e===!0?"attachment":e===!1?"inline":e,!I(e))throw new Error(`The "download" response directive does not support the type: ${S(e)}`);return["attachment","inline"].includes(e)||(e=`attachment; filename="${e}"`),this.set("Content-Disposition",e)}get attachment(){var e=(this.get("Content-Disposition")||"").trim();return e=e==="attachment"?!0:e==="inline"?!1:z(ne(e,'"'),'filename="'),e}get location(){return this.get("Location")}set location(e){return this.set("Location",e)}get redirect(){return this.get("Location")}set redirect(e){return this.set("Location",e)}},ur=pn;var hn=(t,e,r)=>{let n=class extends t{constructor(i,s,o){"headers"in s&&!(s.headers instanceof e)&&(s={...s},s.headers=new e(s.headers),arguments[1]=s),B(s)?super(i):super(i,s),this._headers=s.headers,o.headers&&this.headers.json(o.headers);let f={};Object.defineProperty(this,"attrs",{get:()=>f}),Object.defineProperty(this,"bodyAttrs",{get:()=>o})}clone(){return new this.constructor(super.clone())}get headers(){return this._headers||(this._headers=new e(super.headers)),this._headers}get attrs(){return this.attrs}get url(){return"url"in this.attrs?this.attrs.url:super.url}async arrayBuffer(){return this.bodyAttrs.arrayBuffer?this.bodyAttrs.arrayBuffer:super.arrayBuffer()}async blob(){return this.bodyAttrs.blob?this.bodyAttrs.blob:super.blob()}async formData(){if(this.bodyAttrs.formData)return this.bodyAttrs.formData;let i=await super.formData();return i.tee=r.prototype.tee.bind(i),i.json=r.prototype.json.bind(i),i}async json(){return this.bodyAttrs.json?this.bodyAttrs.json:super.json()}async text(){return this.bodyAttrs.text?this.bodyAttrs.text:super.text()}jsonfy(i=!1){return(!this.bodyAttrs.jsonfied||i)&&(this.bodyAttrs.jsonfied=new Promise(async(s,o)=>{var f=this,a,u=f.headers.get("content-type")||"",c=u==="application/json"||this.bodyAttrs.json?"json":u==="application/x-www-form-urlencoded"||u.startsWith("multipart/form-data")||this.bodyAttrs.formData?"formData":u==="text/plain"?"plain":"other";try{c==="formData"?a=(await f.formData()).json():a=c==="json"?await f.json():c==="plain"?await f.text():f.body,s(a)}catch(l){o(l)}})),this.bodyAttrs.jsonfied}};return n.Headers=e,n},rt=hn;function nt(t,e,r){let n={body:t,input:t},i=(f,a)=>{if(!e.encode)return;let[u,c]=e.encode(a);f.body=u,f.headers=c};if(I(t)||q(t))return n.inputType="text",n.text=t,n.headers={contentLength:(t+"").length},n;if(n.inputType=wt(t),["Blob","File"].includes(n.inputType))n.blob=t,n.headers={contentType:t.type,contentLength:t.size};else if(["Uint8Array","Uint16Array","Uint32Array","ArrayBuffer"].includes(n.inputType))n.arrayBuffer=t,n.headers={contentLength:t.byteLength};else if(n.inputType==="FormData")n.formData=t,i(n,t);else if(d(t)&&$e(t)||m(t)&&st(t)){n.inputType="object";var s,o=new e;o.json(t,(f,a,u)=>(s=s||u,!0)),s?(n.formData=o,i(n,o)):(n.json=t,n.body=JSON.stringify(t),n.headers={contentType:"application/json",contentLength:new r([n.body]).size}),n.jsonfied=t}return n}var mn=(t,e,r,n)=>class extends rt(t,e,r){constructor(i,s={}){s={...s};let o={};i instanceof t&&(s.method&&i.method!==s.method.toUpperCase()&&["GET","HEAD"].includes(s.method.toUpperCase())?(i=i.url,["headers","mode","credentials","cache","redirect","referrer","integrity"].forEach(a=>{a in s||(s[a]=i[a])})):o=i.bodyAttrs||{}),"body"in s&&(o=nt(s.body,r,n),s.body=o.body);let f;s.mode==="navigate"&&(f=!0,s={...s},delete s.mode),super(i,s,o),f&&(this.attrs.mode="navigate")}get mode(){return"mode"in this.attrs?this.attrs.mode:super.mode}get cache(){return"cache"in this.attrs?this.attrs.cache:super.cache}get destination(){return"destination"in this.attrs?this.attrs.destination:super.destination}get referrer(){return"referrer"in this.attrs?this.attrs.referrer:super.referrer}static compat(i,s=null){return i instanceof t?Object.setPrototypeOf(i,new this):new this(s,i)}},cr=mn;var dn=(t,e,r,n)=>class extends rt(t,e,r){constructor(i=null,s={}){let o={},f;arguments.length&&(i instanceof t?(f=i,s={status:i.status,statusText:i.statusText,headers:i.headers,...s},i.status===0&&delete s.status,o=i.bodyAttrs||{},i=i.body):(o=nt(i,r,n),i=o.body)),super(i,s,o),f&&(this.attrs.url=f.url,this.attrs.ok=f.ok,this.attrs.status=f.status,this.attrs.type=f.type,this.attrs.redirected=f.redirected)}get ok(){return"ok"in this.attrs?this.attrs.ok:super.ok}get status(){return"status"in this.attrs?this.attrs.status:super.status}get statusText(){return"statusText"in this.attrs?this.attrs.statusText:super.statusText}get type(){return"type"in this.attrs?this.attrs.type:super.type}get redirected(){return"redirected"in this.attrs?this.attrs.redirected:super.redirected}static compat(i){return i instanceof t?Object.setPrototypeOf(i,new this):new this(i)}},lr=dn;var gn=t=>t,pr=gn;var _n=(t,e,r)=>{let n=class{constructor(i,s,o){this._request=i,this._detail=s||{},this._sessionFactory=o,this.Request=t,this.Response=e,this.URL=r,this.port={listeners:[],post(f){let a=this.listeners.map(u=>u(f)).filter(u=>u instanceof Promise);if(process.length)return Promise.all(a)},listen(f){this.listeners.push(f)}}}get url(){return this._url||(this._url=new this.URL(this._request.url)),this._url}get request(){return this._request}get detail(){return this._detail}get session(){return this._session||(this._session=this.sessionFactory().get()),this._session}sessionFactory(...i){return this._sessionFactory(...i)}retarget(i,s={}){var o;return i instanceof t?B(s)?o=i:o=new t(i,s):(o=new t(this._request,s),o.attrs.url=`${this.url.origin}${i}`,o.attrs.referrer=this.request.url),new n(o,this.detail)}};return n},hr=_n;var yn=sr(er),mr=or(ir);var xn=fr(_t),wn=ur(_t),bt=cr(rr,xn,mr,yt),je=lr(nr,wn,mr,yt),Fg=pr(tr),dr=hr(bt,je,yn);var Le=class{constructor(){this.messaging={post:(e,r=this.client)=>{if(!r)throw new Error("No client for this operation.");return r.postMessage(e),this.post},listen:(e,r=this.client)=>r?(r.addEventListener("message",e),this.post):(self.addEventListener("message",n=>{this.client=n.source,e(n)}),this.post),request:(e,r=this.client)=>{if(!r)throw new Error("No client for this operation.");return new Promise(n=>{let i=new MessageChannel;r.postMessage(e,[i.port2]),i.port1.onmessage=s=>n(s.data)})},channel(e){this.channels.has(e)||this.channels.set(e,new BroadcastChannel(r));let r=this.channels.get(e);return{broadcast:n=>r.postMessage(n),listen:n=>r.addEventListener("message",n)}},channels:new Map},this.notifications={fire:(e,r={})=>new Promise((n,i)=>{if(!(self.Notification&&self.Notification.permission==="granted"))return i(self.Notification&&self.Notification.permission);s.addEventListener("error",i);let s=new self.Notification(e,r);s.addEventListener("click",n),s.addEventListener("close",n)}),listen:e=>(self.addEventListener("notificationclick",e),this.notifications)},this.push={listen:e=>(self.addEventListener("push",e),this.post)}}setCurrentClient(e){this.client=e}};var Fe=class{constructor(e,r){this.cx=e,this.clients=new Map,this.mockSessionStore={},this.cx.runtime=this;let n=r(this.cx,"*");if(!n||!n.handle)throw new Error('Application instance must define a ".handle()" method.');this.clients.set("*",n),self.addEventListener("install",s=>{this.cx.params.skip_waiting&&self.skipWaiting(),this.cx.params.cache_name&&(this.cx.params.cache_only_urls||[]).length&&s.waitUntil(self.caches.open(this.cx.params.cache_name).then(o=>{this.cx.logger&&this.cx.logger.log("[ServiceWorker] Pre-caching resources.");let f=(this.cx.params.cache_only_urls||[]).map(a=>a.trim()).filter(a=>a&&!pt(a,self.origin).isPattern());return o.addAll(f)}))}),self.addEventListener("activate",s=>{s.waitUntil(new Promise(async o=>{this.cx.params.skip_waiting&&await self.clients.claim(),this.cx.params.cache_name&&await self.caches.keys().then(f=>Promise.all(f.map(a=>{if(a!==this.cx.params.cache_name&&a!==this.cx.params.cache_name+"_json")return this.cx.logger&&this.cx.logger.log("[ServiceWorker] Removing old cache:",a),self.caches.delete(a)}))),o()}))}),self.addEventListener("fetch",s=>{!s.request.url.startsWith("http")||s.respondWith((async(o,f)=>{let a=await self.clients.get(s.clientId);this.workport.setCurrentClient(a);let u=["method","headers","mode","credentials","cache","redirect","referrer","integrity"].reduce((c,l)=>({[l]:o[l],...c}),{});return["GET","HEAD"].includes(o.method)||(u.body=await o.text()),o.cache==="force-cache"&&(u.cache="default"),this.go(o.url,u,{event:f})})(s.request,s))});let i=new Le;C.set(this,"workport",i),i.messaging.listen(async s=>{let o=s.ports[0],f=this.clients.get("*"),a=f.alert&&await f.alert(s);o&&(a instanceof Promise?a.then(u=>{o.postMessage(u)}):o.postMessage(a))}),i.notifications.listen(async s=>{let o=this.clients.get("*");o.alert&&await o.alert(s)}),i.push.listen(async s=>{let o=this.clients.get("*");o.alert&&await o.alert(s)}),C.set(this,"location",{}),C.set(this,"network",{}),C.observe(this.network,s=>{})}async go(e,r={},n={}){e=typeof e=="string"?new URL(e):e,r={referrer:this.location.href,...r};let i=await this.generateRequest(e.href,r);n.event&&Object.defineProperty(n.event,"request",{value:i});let s=new dr(i,n,(a=null,u=!1)=>this.getSession(s,a,u));s.port.listen(a=>{if(a.$type==="handler:hints"&&a.session)return Promise.resolve()});let o;return s.request.url.startsWith(self.origin)?o=await this.clients.get("*").handle(s,(...a)=>this.remoteFetch(...a)):o=await this.remoteFetch(s.request),this.handleResponse(s,o)}generateRequest(e,r){return new bt(e,r)}getSession(e,r=null,n=!1){return{get:()=>this.mockSessionStore,set:i=>{this.mockSessionStore=i}}}remoteFetch(e,...r){arguments.length>1&&(e=this.generateRequest(e,...r));let n=(o,f)=>be((o||[]).map(a=>a.trim()).filter(a=>a),a=>pt(a,self.origin).test(f)),s=(()=>{if(!this.cx.params.default_fetching_strategy||this.cx.params.default_fetching_strategy==="network-first"||n(this.cx.params.network_first_urls,e.url))return C.set(this.network,"strategy","network-first"),this.networkFetch(e,{cacheFallback:!0,cacheRefresh:!0});if(this.cx.params.default_fetching_strategy==="cache-first"||n(this.cx.params.cache_first_urls,e.url))return C.set(this.network,"strategy","cache-first"),this.cacheFetch(e,{networkFallback:!0,cacheRefresh:!0});if(this.cx.params.default_fetching_strategy==="network-only"||n(this.cx.params.network_only_urls,e.url))return C.set(this.network,"strategy","network-only"),this.networkFetch(e,{cacheFallback:!1,cacheRefresh:!1});if(this.cx.params.default_fetching_strategy==="cache-only"||n(this.cx.params.cache_only_urls,e.url))return C.set(this.network,"strategy","cache-only"),this.cacheFetch(e,{networkFallback:!1,cacheRefresh:!1})})(e);return s.catch(o=>C.set(this.network,"error",o.message)),s.then(o=>je.compat(o))}networkFetch(e,r={}){return r.cacheFallback?self.fetch(e).then(n=>(r.cacheRefresh&&this.refreshCache(e,n),C.set(this.network,"remote",!0),n)).catch(()=>this.getRequestCache(e).then(n=>(C.set(this.network,"cache",!0),n.match(e)))):(C.set(this.network,"remote",!0),self.fetch(e))}cacheFetch(e,r={}){return this.getRequestCache(e).then(n=>n.match(e).then(i=>!i&&r.networkFallback?this.networkFetch(e,{...r,cacheFallback:!1}):(i&&r.cacheRefresh&&this.networkFetch(e,{...r,justRefreshing:!0}),C.set(this.network,"cache",!0),i)))}refreshCache(e,r){if(e.method!=="GET"||!r||r.status!==200||r.type!=="basic"&&r.type!=="cors")return r;var n=r.clone();return this.getRequestCache(e).then(i=>{C.set(this.network,"cacheRefresh",!0),i.put(e,n)}),r}getRequestCache(e){let r=e.headers.get("Accept")==="application/json"?this.cx.params.cache_name+"_json":this.cx.params.cache_name;return self.caches.open(r)}handleResponse(e,r){return r instanceof je||(r=je.compat(r)),r}};async function gr(t=null){let e=this||{},r=n=>new Ae(n);return new Fe(ye.create(e),(...n)=>t?t(...n.concat(r)):r(...n))}var bn={},vn={cache_name:"cache_v0",default_fetching_strategy:"network-first",network_first_urls:[],cache_first_urls:[],network_only_urls:[],cache_only_urls:["/page-3/.webqit/oohtml-cli/bundler.json"],skip_waiting:!1,support_push:!1,push_registration_url:"",push_deregistration_url:"",push_public_key:"",routing:{root:"/",subroots:[],targets:3}};gr.call({layout:bn,params:vn});
3
- })();
1
+ /** @webqit/webflo */(async () => {
2
+ var _r=Object.defineProperty;var yr=(t,e)=>()=>(t&&(e=t(t=0)),e);var xr=(t,e)=>{for(var r in e)_r(t,r,{get:e[r],enumerable:!0})};var qt={};xr(qt,{URLPattern:()=>Wt});function Tr(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function Rt(t,e=!1){let r=[],n=0;for(;n<t.length;){let i=t[n],s=function(o){if(!e)throw new TypeError(o);r.push({type:"INVALID_CHAR",index:n,value:t[n++]})};if(i==="*"){r.push({type:"ASTERISK",index:n,value:t[n++]});continue}if(i==="+"||i==="?"){r.push({type:"MODIFIER",index:n,value:t[n++]});continue}if(i==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});continue}if(i==="{"){r.push({type:"OPEN",index:n,value:t[n++]});continue}if(i==="}"){r.push({type:"CLOSE",index:n,value:t[n++]});continue}if(i===":"){let o="",f=n+1;for(;f<t.length;){let a=t.substr(f,1);if(f===n+1&&Ar.test(a)||f!==n+1&&Rr.test(a)){o+=t[f++];continue}break}if(!o){s(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:o}),n=f;continue}if(i==="("){let o=1,f="",a=n+1,u=!1;if(t[a]==="?"){s(`Pattern cannot start with "?" at ${a}`);continue}for(;a<t.length;){if(!Tr(t[a],!1)){s(`Invalid character '${t[a]}' at ${a}.`),u=!0;break}if(t[a]==="\\"){f+=t[a++]+t[a++];continue}if(t[a]===")"){if(o--,o===0){a++;break}}else if(t[a]==="("&&(o++,t[a+1]!=="?")){s(`Capturing groups are not allowed at ${a}`),u=!0;break}f+=t[a++]}if(u)continue;if(o){s(`Unbalanced pattern at ${n}`);continue}if(!f){s(`Missing pattern at ${n}`);continue}r.push({type:"PATTERN",index:n,value:f}),n=a;continue}r.push({type:"CHAR",index:n,value:t[n++]})}return r.push({type:"END",index:n,value:""}),r}function Tt(t,e={}){let r=Rt(t),{prefixes:n="./"}=e,i=`[^${le(e.delimiter||"/#?")}]+?`,s=[],o=0,f=0,a="",u=new Set,c=w=>{if(f<r.length&&r[f].type===w)return r[f++].value},l=()=>{let w=c("MODIFIER");return w||c("ASTERISK")},p=w=>{let L=c(w);if(L!==void 0)return L;let{type:v,index:k}=r[f];throw new TypeError(`Unexpected ${v} at ${k}, expected ${w}`)},h=()=>{let w="",L;for(;L=c("CHAR")||c("ESCAPED_CHAR");)w+=L;return w},R=w=>w,O=e.encodePart||R;for(;f<r.length;){let w=c("CHAR"),L=c("NAME"),v=c("PATTERN");if(!L&&!v&&c("ASTERISK")&&(v=".*"),L||v){let b=w||"";n.indexOf(b)===-1&&(a+=b,b=""),a&&(s.push(O(a)),a="");let F=L||o++;if(u.has(F))throw new TypeError(`Duplicate name '${F}'.`);u.add(F),s.push({name:F,prefix:O(b),suffix:"",pattern:v||i,modifier:l()||""});continue}let k=w||c("ESCAPED_CHAR");if(k){a+=k;continue}if(c("OPEN")){let b=h(),F=c("NAME")||"",W=c("PATTERN")||"";!F&&!W&&c("ASTERISK")&&(W=".*");let Ie=h();p("CLOSE");let vt=l()||"";if(!F&&!W&&!vt){a+=b;continue}if(!F&&!W&&!b)continue;a&&(s.push(O(a)),a=""),s.push({name:F||(W?o++:""),pattern:F&&!W?i:W,prefix:O(b),suffix:O(Ie),modifier:vt});continue}a&&(s.push(O(a)),a=""),p("END")}return s}function le(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function jt(t){return t&&t.sensitive?"u":"ui"}function jr(t,e){if(!e)return t;let r=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=r.exec(t.source);for(;i;)e.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=r.exec(t.source);return t}function Lr(t,e,r){let n=t.map(i=>Ft(i,e,r).source);return new RegExp(`(?:${n.join("|")})`,jt(r))}function Fr(t,e,r){return Lt(Tt(t,r),e,r)}function Lt(t,e,r={}){let{strict:n=!1,start:i=!0,end:s=!0,encode:o=c=>c}=r,f=`[${le(r.endsWith||"")}]|$`,a=`[${le(r.delimiter||"/#?")}]`,u=i?"^":"";for(let c of t)if(typeof c=="string")u+=le(o(c));else{let l=le(o(c.prefix)),p=le(o(c.suffix));if(c.pattern)if(e&&e.push(c),l||p)if(c.modifier==="+"||c.modifier==="*"){let h=c.modifier==="*"?"?":"";u+=`(?:${l}((?:${c.pattern})(?:${p}${l}(?:${c.pattern}))*)${p})${h}`}else u+=`(?:${l}(${c.pattern})${p})${c.modifier}`;else c.modifier==="+"||c.modifier==="*"?u+=`((?:${c.pattern})${c.modifier})`:u+=`(${c.pattern})${c.modifier}`;else u+=`(?:${l}${p})${c.modifier}`}if(s)n||(u+=`${a}?`),u+=r.endsWith?`(?=${f})`:"$";else{let c=t[t.length-1],l=typeof c=="string"?a.indexOf(c[c.length-1])>-1:c===void 0;n||(u+=`(?:${a}(?=${f}))?`),l||(u+=`(?=${a}|${f})`)}return new RegExp(u,jt(r))}function Ft(t,e,r){return t instanceof RegExp?jr(t,e):Array.isArray(t)?Lr(t,e,r):Fr(t,e,r)}function $r(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1}function It(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function Nr(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}function kt(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}function Nt(t){if(!t)return!0;for(let e of $t)if(t.test(e))return!0;return!1}function Dr(t,e){if(t=It(t,"#"),e||t==="")return t;let r=new URL("https://example.com");return r.hash=t,r.hash?r.hash.substring(1,r.hash.length):""}function Ur(t,e){if(t=It(t,"?"),e||t==="")return t;let r=new URL("https://example.com");return r.search=t,r.search?r.search.substring(1,r.search.length):""}function Mr(t,e){return e||t===""?t:kt(t)?Mt(t):Ut(t)}function Hr(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.password=t,r.password}function Wr(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.username=t,r.username}function qr(t,e,r){if(r||t==="")return t;if(e&&!$t.includes(e))return new URL(`${e}:${t}`).pathname;let n=t[0]=="/";return t=new URL(n?t:"/-"+t,"https://example.com").pathname,n||(t=t.substring(2,t.length)),t}function zr(t,e,r){return Dt(e)===t&&(t=""),r||t===""?t:Ht(t)}function Br(t,e){return t=Nr(t,":"),e||t===""?t:lt(t)}function Dt(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function lt(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function Gr(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}function Vr(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}function Ut(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}function Mt(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function Ht(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function Qr(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname}function Kr(t){return t===""?t:new URL(`data:${t}`).pathname}function Xr(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function Zr(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}function At(t,e){if(typeof t!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(t,e);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!=""?r.search.substring(1,r.search.length):void 0,hash:r.hash!=""?r.hash.substring(1,r.hash.length):void 0}}function Se(t,e,r){let n;if(typeof e.baseURL=="string")try{n=new URL(e.baseURL),t.protocol=n.protocol?n.protocol.substring(0,n.protocol.length-1):"",t.username=n.username,t.password=n.password,t.hostname=n.hostname,t.port=n.port,t.pathname=n.pathname,t.search=n.search?n.search.substring(1,n.search.length):"",t.hash=n.hash?n.hash.substring(1,n.hash.length):""}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=Br(e.protocol,r)),typeof e.username=="string"&&(t.username=Wr(e.username,r)),typeof e.password=="string"&&(t.password=Hr(e.password,r)),typeof e.hostname=="string"&&(t.hostname=Mr(e.hostname,r)),typeof e.port=="string"&&(t.port=zr(e.port,t.protocol,r)),typeof e.pathname=="string"){if(t.pathname=e.pathname,n&&!$r(t.pathname,r)){let i=n.pathname.lastIndexOf("/");i>=0&&(t.pathname=n.pathname.substring(0,i+1)+t.pathname)}t.pathname=qr(t.pathname,t.protocol,r)}return typeof e.search=="string"&&(t.search=Ur(e.search,r)),typeof e.hash=="string"&&(t.hash=Dr(e.hash,r)),t}function Pe(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function en(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function tn(t,e){let r=".*",n=`[^${en(e.delimiter||"/#?")}]+?`,i=/[$_\u200C\u200D\p{ID_Continue}]/u,s="";for(let o=0;o<t.length;++o){let f=t[o],a=o>0?t[o-1]:null,u=o<t.length-1?t[o+1]:null;if(typeof f=="string"){s+=Pe(f);continue}if(f.pattern===""){if(f.modifier===""){s+=Pe(f.prefix);continue}s+=`{${Pe(f.prefix)}}${f.modifier}`;continue}let c=typeof f.name!="number",l=e.prefixes!==void 0?e.prefixes:"./",p=f.suffix!==""||f.prefix!==""&&(f.prefix.length!==1||!l.includes(f.prefix));if(!p&&c&&f.pattern===n&&f.modifier===""&&u&&!u.prefix&&!u.suffix)if(typeof u=="string"){let h=u.length>0?u[0]:"";p=i.test(h)}else p=typeof u.name=="number";if(!p&&f.prefix===""&&a&&typeof a=="string"&&a.length>0){let h=a[a.length-1];p=l.includes(h)}p&&(s+="{"),s+=Pe(f.prefix),c&&(s+=`:${f.name}`),f.pattern===r?!c&&(!a||typeof a=="string"||a.modifier||p||f.prefix!=="")?s+="*":s+=`(${r})`:f.pattern===n?c||(s+=`(${n})`):s+=`(${f.pattern})`,f.pattern===n&&c&&f.suffix!==""&&i.test(f.suffix[0])&&(s+="\\"),s+=Pe(f.suffix),p&&(s+="}"),s+=f.modifier}return s}var Ar,Rr,Q,Ir,kr,$t,Yr,Jr,V,Wt,zt=yr(()=>{Ar=/[$_\p{ID_Start}]/u,Rr=/[$_\u200C\u200D\p{ID_Continue}]/u;Q={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ir={delimiter:".",prefixes:"",sensitive:!0,strict:!0},kr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};$t=["ftp","file","http","https","ws","wss"];Yr=class{constructor(t){this.tokenList=[],this.internalResult={},this.tokenIndex=0,this.tokenIncrement=1,this.componentStart=0,this.state=0,this.groupDepth=0,this.hostnameIPv6BracketDepth=0,this.shouldTreatAsStandardURL=!1,this.input=t}get result(){return this.internalResult}parse(){for(this.tokenList=Rt(this.input,!0);this.tokenIndex<this.tokenList.length;this.tokenIndex+=this.tokenIncrement){if(this.tokenIncrement=1,this.tokenList[this.tokenIndex].type==="END"){if(this.state===0){this.rewind(),this.isHashPrefix()?this.changeState(9,1):this.isSearchPrefix()?(this.changeState(8,1),this.internalResult.hash=""):(this.changeState(7,0),this.internalResult.search="",this.internalResult.hash="");continue}else if(this.state===2){this.rewindAndSetState(5);continue}this.changeState(10,0);break}if(this.groupDepth>0)if(this.isGroupClose())this.groupDepth-=1;else continue;if(this.isGroupOpen()){this.groupDepth+=1;continue}switch(this.state){case 0:this.isProtocolSuffix()&&(this.internalResult.username="",this.internalResult.password="",this.internalResult.hostname="",this.internalResult.port="",this.internalResult.pathname="",this.internalResult.search="",this.internalResult.hash="",this.rewindAndSetState(1));break;case 1:if(this.isProtocolSuffix()){this.computeShouldTreatAsStandardURL();let t=7,e=1;this.shouldTreatAsStandardURL&&(this.internalResult.pathname="/"),this.nextIsAuthoritySlashes()?(t=2,e=3):this.shouldTreatAsStandardURL&&(t=2),this.changeState(t,e)}break;case 2:this.isIdentityTerminator()?this.rewindAndSetState(3):(this.isPathnameStart()||this.isSearchPrefix()||this.isHashPrefix())&&this.rewindAndSetState(5);break;case 3:this.isPasswordPrefix()?this.changeState(4,1):this.isIdentityTerminator()&&this.changeState(5,1);break;case 4:this.isIdentityTerminator()&&this.changeState(5,1);break;case 5:this.isIPv6Open()?this.hostnameIPv6BracketDepth+=1:this.isIPv6Close()&&(this.hostnameIPv6BracketDepth-=1),this.isPortPrefix()&&!this.hostnameIPv6BracketDepth?this.changeState(6,1):this.isPathnameStart()?this.changeState(7,0):this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 6:this.isPathnameStart()?this.changeState(7,0):this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 7:this.isSearchPrefix()?this.changeState(8,1):this.isHashPrefix()&&this.changeState(9,1);break;case 8:this.isHashPrefix()&&this.changeState(9,1);break;case 9:break;case 10:break}}}changeState(t,e){switch(this.state){case 0:break;case 1:this.internalResult.protocol=this.makeComponentString();break;case 2:break;case 3:this.internalResult.username=this.makeComponentString();break;case 4:this.internalResult.password=this.makeComponentString();break;case 5:this.internalResult.hostname=this.makeComponentString();break;case 6:this.internalResult.port=this.makeComponentString();break;case 7:this.internalResult.pathname=this.makeComponentString();break;case 8:this.internalResult.search=this.makeComponentString();break;case 9:this.internalResult.hash=this.makeComponentString();break;case 10:break}this.changeStateWithoutSettingComponent(t,e)}changeStateWithoutSettingComponent(t,e){this.state=t,this.componentStart=this.tokenIndex+e,this.tokenIndex+=e,this.tokenIncrement=0}rewind(){this.tokenIndex=this.componentStart,this.tokenIncrement=0}rewindAndSetState(t){this.rewind(),this.state=t}safeToken(t){return t<0&&(t=this.tokenList.length-t),t<this.tokenList.length?this.tokenList[t]:this.tokenList[this.tokenList.length-1]}isNonSpecialPatternChar(t,e){let r=this.safeToken(t);return r.value===e&&(r.type==="CHAR"||r.type==="ESCAPED_CHAR"||r.type==="INVALID_CHAR")}isProtocolSuffix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}nextIsAuthoritySlashes(){return this.isNonSpecialPatternChar(this.tokenIndex+1,"/")&&this.isNonSpecialPatternChar(this.tokenIndex+2,"/")}isIdentityTerminator(){return this.isNonSpecialPatternChar(this.tokenIndex,"@")}isPasswordPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}isPortPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,":")}isPathnameStart(){return this.isNonSpecialPatternChar(this.tokenIndex,"/")}isSearchPrefix(){if(this.isNonSpecialPatternChar(this.tokenIndex,"?"))return!0;if(this.tokenList[this.tokenIndex].value!=="?")return!1;let t=this.safeToken(this.tokenIndex-1);return t.type!=="NAME"&&t.type!=="PATTERN"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}isHashPrefix(){return this.isNonSpecialPatternChar(this.tokenIndex,"#")}isGroupOpen(){return this.tokenList[this.tokenIndex].type=="OPEN"}isGroupClose(){return this.tokenList[this.tokenIndex].type=="CLOSE"}isIPv6Open(){return this.isNonSpecialPatternChar(this.tokenIndex,"[")}isIPv6Close(){return this.isNonSpecialPatternChar(this.tokenIndex,"]")}makeComponentString(){let t=this.tokenList[this.tokenIndex],e=this.safeToken(this.componentStart).index;return this.input.substring(e,t.index)}computeShouldTreatAsStandardURL(){let t={};Object.assign(t,Q),t.encodePart=lt;let e=Ft(this.makeComponentString(),void 0,t);this.shouldTreatAsStandardURL=Nt(e)}},Jr=["protocol","username","password","hostname","port","pathname","search","hash"],V="*";Wt=class{constructor(t={},e){this.regexp={},this.keys={},this.component_pattern={};try{if(typeof t=="string"){let i=new Yr(t);if(i.parse(),t=i.result,e)if(typeof e=="string")t.baseURL=e;else throw new TypeError("'baseURL' parameter is not of type 'string'.");else if(typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.")}else if(e)throw new TypeError("parameter 1 is not of type 'string'.");if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");let r={pathname:V,protocol:V,username:V,password:V,hostname:V,port:V,search:V,hash:V};this.pattern=Se(r,t,!0),Dt(this.pattern.protocol)===this.pattern.port&&(this.pattern.port="");let n;for(n of Jr){if(!(n in this.pattern))continue;let i={},s=this.pattern[n];switch(this.keys[n]=[],n){case"protocol":Object.assign(i,Q),i.encodePart=lt;break;case"username":Object.assign(i,Q),i.encodePart=Gr;break;case"password":Object.assign(i,Q),i.encodePart=Vr;break;case"hostname":Object.assign(i,Ir),kt(s)?i.encodePart=Mt:i.encodePart=Ut;break;case"port":Object.assign(i,Q),i.encodePart=Ht;break;case"pathname":Nt(this.regexp.protocol)?(Object.assign(i,kr),i.encodePart=Qr):(Object.assign(i,Q),i.encodePart=Kr);break;case"search":Object.assign(i,Q),i.encodePart=Xr;break;case"hash":Object.assign(i,Q),i.encodePart=Zr;break}try{let o=Tt(s,i);this.regexp[n]=Lt(o,this.keys[n],i),this.component_pattern[n]=tn(o,i)}catch{throw new TypeError(`invalid ${n} pattern '${this.pattern[n]}'.`)}}}catch(r){throw new TypeError(`Failed to construct 'URLPattern': ${r.message}`)}}test(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{typeof t=="object"?r=Se(r,t,!1):r=Se(r,At(t,e),!1)}catch{return!1}let n;for(n in this.pattern)if(!this.regexp[n].exec(r[n]))return!1;return!0}exec(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?r=Se(r,t,!1):r=Se(r,At(t,e),!1)}catch{return null}let n={};e?n.inputs=[t,e]:n.inputs=[t];let i;for(i in this.pattern){let s=this.regexp[i].exec(r[i]);if(!s)return null;let o={};for(let[f,a]of this.keys[i].entries())if(typeof a.name=="string"||typeof a.name=="number"){let u=s[f+1];o[a.name]=u}n[i]={input:r[i]||"",groups:o}}return n}get protocol(){return this.component_pattern.protocol}get username(){return this.component_pattern.username}get password(){return this.component_pattern.password}get hostname(){return this.component_pattern.hostname}get port(){return this.component_pattern.port}get pathname(){return this.component_pattern.pathname}get search(){return this.component_pattern.search}get hash(){return this.component_pattern.hash}};globalThis.URLPattern||(globalThis.URLPattern=Wt)});var ge=class{constructor(e,r=null){Object.defineProperty(this,"dict",{value:Object.create(e)});for(let n in this.dict)n in this||(this[n]=this.dict[n]);arguments.length>1&&Object.defineProperty(this.dict,"CWD",{get:()=>r})}get name(){return"webflo"}static create(...e){return new this(...e)}get CWD(){return this.dict.CWD||""}get meta(){return this.dict.meta||{}}get app(){return this.dict.app||{}}get config(){return this.dict.config||{}}get flags(){return this.dict.flags||{}}set flags(e){this.dict.flags=e}get layout(){return this.dict.layout||{}}set layout(e){this.dict.layout=e}get logger(){return this.dict.logger}set logger(e){this.dict.logger=e}};var _e=class extends ge{};var ye=class extends _e{};function d(t){return!Array.isArray(t)&&typeof t=="object"&&t}function S(t){return typeof t}function x(t,...e){globalThis.WebQitInternalsRegistry||(globalThis.WebQitInternalsRegistry=new Map);var r=globalThis.WebQitInternalsRegistry.get(t);if(!r){if(r=new Map,e[0]===!1)return r;globalThis.WebQitInternalsRegistry.set(t,r)}for(var n,i;n=e.shift();)if((i=r)&&!(r=r.get(n))){if(r=new Map,e[0]===!1)return r;i.set(n,r)}return r}function m(t){return Array.isArray(t)}function te(t){return typeof t=="function"}function it(t){return te(t)&&/^class\s?/.test(Function.prototype.toString.call(t))}function ke(t){return t===null||t===""}function N(t){return arguments.length&&(t===void 0||typeof t>"u")}function g(t){return Array.isArray(t)||typeof t=="object"&&t||te(t)}function B(t){return ke(t)||N(t)||t===!1||t===0||g(t)&&!Object.keys(t).length}function _(t){return te(t)||t&&{}.toString.call(t)==="[object function]"}function q(t){return t instanceof Number||typeof t=="number"}function P(t){return q(t)||t!==!0&&t!==!1&&t!==null&&t!==""&&!isNaN(t*1)}function st(t){return m(t)&&Object.getPrototypeOf(t)===Array.prototype}function $e(t){return d(t)&&Object.getPrototypeOf(t)===Object.prototype}function I(t){return t instanceof String||typeof t=="string"&&t!==null}function ot(t){return!I(t)&&!N(t.length)}function xe(t,e=1){var r=0;t.forEach(i=>{r++});var n=t.slice(t.length-r,e);return arguments.length>1?n:n[0]}function we(t,e=1){return arguments.length>1?xe(t.slice().reverse(),e).reverse():xe(t.slice().reverse())}function Ne(t,...e){return e.forEach(r=>{t.indexOf(r)<0&&t.push(r)}),t}function at(n,e){e=e||Object.prototype,e=e&&!m(e)?[e]:e;for(var r=[],n=n;n&&(!e||e.indexOf(n)<0)&&n.name!=="default";)r.push(n),n=n?Object.getPrototypeOf(n):null;return r}function ft(t,e){var r=[];return at(t,e).forEach(n=>{Ne(r,...Object.getOwnPropertyNames(n))}),r}function U(t,e,r=!1,n=!1,i=!1){var s=0,o=t.shift();if((P(o)||o===!0||o===!1)&&(s=o,o=t.shift()),!t.length)throw new Error("_merge() requires two or more array/objects.");return t.forEach((f,a)=>{!g(f)&&!_(f)||(r?ft(f):Object.keys(f)).forEach(u=>{if(!!e(u,o,f,a)){var c=o[u],l=f[u];if((m(c)&&m(l)||d(c)&&d(l))&&(s===!0||s>0))o[u]=m(c)&&m(l)?[]:{},U([P(s)?s-1:s,o[u],c,l],e,r,n,i);else if(m(o)&&m(f))n?o[u]=l:o.push(l);else try{i?Object.defineProperty(o,u,Object.getOwnPropertyDescriptor(f,u)):o[u]=f[u]}catch{}}})}),o}function H(t,e){var r=void 0;return g(t)&&Object.keys(t).forEach((n,i)=>{r!==!1&&(r=e(P(n)?parseFloat(n):n,t[n],i))}),r}function re(...t){return U(t,(e,r,n)=>!0,!1,!1,!1)}function z(t,e,r=!1){if(e=="")return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?"":t.substr(n+e.length)}function ut(t,e){return z(t,e,!0)}function fe(t,e,r=!1){if(e=="")return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?t:t.substr(0,n)}function ne(t,e){return fe(t,e,!0)}function ue(t,e,r=null,n=!1){return e.length>t.length?-1:(typeof r=="number"?n?t.slice(0,r+1+(r<0?t.length:0)):t.slice(r):t).reduce((i,s,o)=>{var[f,a,u]=i;if(!n&&f>-1)return[f,a,u];var c=u+1,l=s===e[c]?c===0?[o,0]:[a,c]:[-1,-1];return l[1]===e.length-1&&(l[1]=-1,l[0]>-1)?[l[0]].concat(l):[f].concat(l)},[-1,-1,-1])[0]+(n||typeof r!="number"?0:r>-1?r:t.length-r)}function ce(t,e,r=null,n=!1){var i=ue(t,e,r,n);return i===-1?[]:t.slice(i+e.length)}function be(t,e){return t.reduce((r,n,i)=>r||e(n,i),!1)}function y(t,e=!0){return m(t)?t:!e&&d(t)?[t]:t!==!1&&t!==0&&B(t)?[]:ot(t)?Array.prototype.slice.call(t):d(t)?Object.values(t):[t]}function G(t,e,r=null){return r||r!==!1&&t.dotSafe&&e.dotSafe?t.join(".")===e.join("."):t.length===e.length&&t.reduce((n,i,s)=>n&&i===e[s],!0)}function ve(t,e,r=null){return m(e)?t.filter(n=>r?e.filter(i=>r(n,i)).length:e.indexOf(n)!==-1):[]}function Oe(t,e,r=null){return r||r!==!1&&t.dotSafe&&e.dotSafe?(t.join(".")+".").startsWith(e.join(".")+"."):e.reduce((n,i,s)=>n&&i===t[s],!0)}function ct(t){let e=(r,n,i)=>i.indexOf(r)===n;return t.filter(e)}typeof URLPattern>"u"&&await Promise.resolve().then(()=>(zt(),qt));function Bt(t,e,r,n=!1){if(I(e)&&e.endsWith("]")){var i=ne(ut(e,"["),"]")||0;return P(i)&&(i=parseInt(i)),e=ne(e,"[")||0,P(e)&&(e=parseInt(e)),Bt(t,e,(s,o)=>{if(!s[o]){if(!n)return r();s[o]=P(i)?[]:{}}return r(s[o],i)},n)}else return r(t,e)}function De(t,e,r,n=!0){Bt(t,e,(i,s)=>{P(s)?(s=s||m(i)?i.length:Object.keys(i).filter(P).length,y(r,!1).forEach((o,f)=>{i[s+f]=o})):i[s]=n&&s in i?y(i[s],!1).concat(r):r},!0)}function ie(t,e={},r="&"){return t=t||"",(t.startsWith("?")?t.substr(1):t).split(r).filter(n=>n).map(n=>n.split("=").map(i=>i.trim())).forEach(n=>De(e,n[0],decodeURIComponent(n[1]))),e}function Ue(t,e,r,n=null){if((d(e)||m(e))&&(!n||n(e,t))){var i=m(e);Object.keys(e).forEach(s=>{Ue(`${t}[${s}]`,e[s],r,n)})}else r(t,!e&&e!==0?"":e)}function pe(t,e="&",r=null){var n=[];return Object.keys(t).forEach(i=>{Ue(i,t[i],(s,o)=>{n.push(`${s}=${encodeURIComponent(o)}`)},r)}),n.join(e)}var Gt={join(){for(var t=[],e=0,r=0,n=arguments.length;r<n;r++)t=t.concat(arguments[r].split("/"));var i=[];for(r=0,n=t.length;r<n;r++){var s=t[r];!s||s==="."||(s===".."?i.length?i.pop():e++:i.push(s))}return t[0]===""&&i.unshift(""),"../".repeat(e)+i.join("/")||(i.length?"/":".")},dirname(t){return this.join(t,"..")}},pt=(t,e=null)=>({pattern:new URLPattern(t,e),isPattern(){return Object.keys(this.pattern.keys||{}).some(r=>this.pattern.keys[r].length)},test(...r){return this.pattern.test(...r)},exec(...r){let n=this.pattern.exec(...r);if(!!n)return n.vars=Object.keys(this.pattern.keys).reduce(({named:i,unnamed:s},o)=>(this.pattern.keys[o].forEach(f=>{let a=n[o].groups[f.name];typeof f.name=="number"?s.push(a):i[f.name]=a}),{named:i,unnamed:s}),{named:{},unnamed:[]}),n.render=i=>i.replace(/\$(\$|[0-9A-Z]+)/gi,(s,o)=>o==="$"?"$":(P(o)?n.vars.unnamed[o-1]:n.vars.named[o])||""),n}});var Ee=class{constructor(e,r){this.cx=e,this.path=m(r)?r:(r+"").split("/").filter(n=>n)}async route(e,r,n,i,s=null){let o=this,f=async function(a){let u={};if(!a.trail||a.trail.length<a.destination.length){if(a=await o.readTick(a),u.pathname=`/${a.trail.join("/")}`,u.stepname=a.trail[a.trail.length-1],o.finalizeHandlerContext(u,a),a.exports){a.exports.hints&&await r.port.post({...a.exports.hints,$type:"handler:hints"});let c=y(a.method),l=_(a.exports)&&c.includes("default")?a.exports:c.reduce((p,h)=>p||a.exports[h.toLowerCase()],null);if(l){let p=async(...R)=>{let O={...a,arg:R[0]};if(R.length>1){var w=R[1],L,v={...R[2]||{}};if(R[1]instanceof O.event.Request)L=R[1],w=L.url;else if(!I(w))throw new Error("Router redirect url must be a string!");var k=w.startsWith("/")?w:o.pathJoin(`/${a.trail.join("/")}`,w);if(k.startsWith("../"))throw new Error("Router redirect cannot traverse beyond the routing directory! ("+w+" >> "+k+")");v.method&&(O.method=v.method,m(v.method)&&(v.method=v.method[0])),L?O.event=a.event.retarget(L,{...v,_proxy:{url:k}}):O.event=a.event.retarget(k,v),O.source=a.destination.join("/"),O.destination=k.split("?").shift().split("/").map($=>$.trim()).filter($=>$),O.trail=R[1].startsWith("/")?[]:a.trail.reduce(($,b,F)=>$.length===F&&b===O.destination[F]?$.concat(b):$,[]),O.trailOnFile=a.trailOnFile.slice(0,O.trail.length)}return f(O)},h=a.destination.slice(a.trail.length);return p.pathname=h.join("/"),p.stepname=h[0],await l.call(u,a.event,a.arg,p,s)}return f(a)}else if((a.currentSegmentOnFile||{}).dirExists)return f(a)}if(i)return await i.call(u,a.event,a.arg,s)};return f({destination:this.path,event:r,method:e,arg:n})}};var Ce=class extends Ee{async readTick(e){var r=this.cx.layout,n=Object.keys(this.cx.layout);return e.trail?(e.currentSegment=e.destination[e.trail.length],e.currentSegmentOnFile=[e.currentSegment,"-"].reduce((i,s)=>{if(i.index)return i;var o=`/${e.trailOnFile.concat(s).join("/")}`;return r[o]?{seg:s,index:o}:n.filter(f=>f.startsWith(`${o}/`)).length?{seg:s,dirExists:!0}:i},{seg:null}),e.trail.push(e.currentSegment),e.trailOnFile.push(e.currentSegmentOnFile.seg),e.exports=r[e.currentSegmentOnFile.index]):(e.trail=[],e.trailOnFile=[],e.currentSegmentOnFile={index:"/"},e.exports=r["/"]),e}finalizeHandlerContext(e,r){return e.dirname=r.currentSegmentOnFile.index}pathJoin(...e){return Gt.join(...e)}};var Ae=class{constructor(e){this.cx=e}async handle(e,r){let n=new Ce(this.cx,e.url.pathname);return(async()=>{let s=e.request.method.toLowerCase(),o=await n.route([s==="delete"?"del":s,"default"],e,{},async f=>r(f.request),r);return o instanceof e.Response||(o=e.Response.compat(o)),o})()}};function se(t){return(ht(t)?t:y(t).length?[t]:[]).reduce((e,r)=>e.concat([y(r)]),[]).map(e=>K.resolve(e))}var K=class extends Array{static resolve(e){return e.every(r=>!(r+"").includes("."))?new K().concat(e):e}get dotSafe(){return!0}};function ht(t){return y(t).reduce((e,r)=>e||m(r),!1)}function mt(t){return t.filter(e=>e||e===0).length!==t.length}function Vt(t){return t.filter(e=>mt(y(e))).length>0}var oe=class{constructor(e){this.target=e,this.fireables=[],this.currentlyFiring=[]}add(e){return this.fireables.push(e),e}remove(e){this.fireables=this.fireables.filter(r=>r!==e)}removeMatches(e){this.match(e).forEach(r=>{this.fireables=this.fireables.filter(n=>n!==r)})}match(e){return this.fireables.filter(r=>{var n=se(r.filter),i=y((r.params||{}).tags),s=se(e.filter),o=y((e.params||{}).tags);return(!e.originalHandler||r.handler===e.originalHandler)&&(!s.length||G(s,n))&&(!o.length||o.length===i.length&&ve(i,o).length===o.length)})}static _getFirebase(e,r,n=!0,i=this.__namespace){if(!g(r))throw new Error('Subject must be of type object; "'+S(r)+'" given!');var s=this;return i&&globalThis.WebQitObserverNamespaceRegistry.has(e+"-"+i)&&(s=globalThis.WebQitObserverNamespaceRegistry.get(e+"-"+i),e+="-"+i),!x(r,"firebases").has(e)&&n&&x(r,"firebases").set(e,new s(r)),x(r,"firebases").get(e)}static _namespace(e,r,n=null){if(e+="-"+r,arguments.length===2)return globalThis.WebQitObserverNamespaceRegistry.get(e);if(!(n.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${r} must be a subclass of ${this.name}.`);globalThis.WebQitObserverNamespaceRegistry.set(e,n),n.__namespace=r}};globalThis.WebQitObserverNamespaceRegistry||(globalThis.WebQitObserverNamespaceRegistry=new Map);var ae=class{constructor(e,r){this.target=e,this.handler=r.handler,this.filter=r.filter,this.params=r.params}disconnect(){this.disconnected=!0}};var Re=class extends ae{fire(e,r,n){return this.disconnected||this.filter&&!ve(y(this.filter),[e.type]).length?r(...Array.prototype.slice.call(arguments,2)):this.handler(e,n,r)}};function Me(t,e=[],r=!0){var n=0;return P(arguments[0])&&g(arguments[1])&&(n=arguments[0],t=arguments[1],e=arguments[2]||[]),U([n,{},t],(i,s,o)=>_(e)?e(i):m(e)&&e.length?e.indexOf(i)>-1:!0,!1,!1,r)}var he=class{constructor(e,r){if(this.target=e,!r.type)throw new Error("Action type must be given in definition!");H(r,(n,i)=>{Object.defineProperty(this,n,{value:i,enumerable:!0})}),Object.seal(this)}};var T=class extends oe{add(e){return super.add(new Re(this.target,e))}fire(e,r=null){if(e instanceof he||(e=new he(this.target,e)),this.currentlyFiring.filter(s=>s.type===e.type&&s.name===e.name).length)return r?r():void 0;this.currentlyFiring.push(e);let n=(s,...o)=>{var f=this.fireables[s];return f?f.fire(e,(...a)=>n(s+1,...a),...o):r?r(...o):o[0]};var i=n(0);return this.currentlyFiring.pop(),i}static getFirebase(e,r=!0,n=null){return super._getFirebase("interceptor",...arguments)}static namespace(e,r=null){return super._namespace("interceptor",...arguments)}};function A(t){return x(t,!1).get(t)||t}function j(t,e,r={},n={}){if(!e||!g(e))throw new Error("Target must be of type object!");e=A(e);var i,s=function(o){return arguments.length?o:Reflect[t](e,...Object.values(r))};return(i=T.getFirebase(e,!1,n.namespace))?i.fire({type:t,...r},s):s()}function We(t,e,r,n={}){return j("apply",t,{thisArgument:e,argumentsList:r},n)}function qe(t,e,r=null,n={}){return j("construct",t,arguments.length>2?{argumentsList:e,newTarget:r}:{argumentsList:e},n)}var M=class{constructor(e,r=!1){this._={},this._.target=e,this._.cancellable=r,this._.propagationStopped=!1,this._.defaultPrevented=!1,this._.promisesInstance=null,this._.promises=[]}get target(){return this._.target}get cancellable(){return this._.cancellable}stopPropagation(){this._.propagationStopped=!0}get propagationStopped(){return this._.propagationStopped}preventDefault(){this._.defaultPrevented=!0}get defaultPrevented(){return this._.defaultPrevented}waitUntil(e){e instanceof Promise&&(this._.promises.push(e),this._.promisesInstance=null)}get promises(){return!this._.promisesInstance&&this._.promises.length&&(this._.promisesInstance=Promise.all(this._.promises)),this._.promisesInstance}respondWith(e){var r,n=d(e)&&!N(e.propagationStopped)&&!N(e.defaultPrevented);e===!1||n&&e.propagationStopped?this.stopPropagation():e===!1||n&&e.defaultPrevented?this.preventDefault():(e instanceof Promise&&(r=e)||n&&(r=e.promises))&&this.waitUntil(r)}};var Te=class extends ae{constructor(e,r){if(super(e,r),this.filters2D=se(this.filter),this.filtersIsOriginally2D=ht(this.filter),this.filtersIsDynamic=Vt(this.filters2D),this.filtersIsDynamic&&this.filters2D.length>1)throw new Error('Only one "Dynamic Filter" must be observed at a time! "'+this.filters2D.map(n=>"["+n.join(", ")+"]").join(", ")+'" have been bound together.')}fire(e){if(this.disconnected||this.params.type&&!be(e,o=>this.params.type===o.type))return;let r=o=>!["set","def"].includes(o.type)||!this.params.diff||(_(this.params.diff)?this.params.diff(o.value,o.oldValue):o.value!==o.oldValue);var n=new M(this.target);if(this.filters2D.length){var i=e.filter(o=>this.filters2D.filter((f,a)=>{var u=f.slice();return this.filtersIsDynamic&&o.path.forEach((c,l)=>{u[l]=u[l]||u[l]===0?u[l]:c}),(!this.filtersIsDynamic||!mt(u))&&r(o)&&(!this.params.subtree&&G(u,o.path)||this.params.suptree&&Oe(u,o.path)&&(!P(this.params.suptree)||ce(u,o.path).length<=this.params.suptree)||this.params.subtree&&o.path.length>=u.length&&Oe(o.path,u)&&(!P(this.params.subtree)||ce(o.path,u).length<=this.params.subtree))}).length);if(i.length)if(this.filtersIsOriginally2D||this.params.subtree){var s=i;d(this.filter)&&(s={...this.filter},i.forEach((o,f)=>{s[o.name]=o})),n.respondWith(this.handler(s,n))}else i.forEach((o,f)=>{n.respondWith(this.handler(o,n))})}else(this.params.subtree||e.filter(o=>G(o.path,[o.name])).length===e.length)&&e.filter(o=>r(o)).length&&n.respondWith(this.handler(e,n));return n}};var X=class{constructor(e,r){if(this.target=e,r.originalSubject||(this.originalSubject=e),!("type"in r))throw new Error("Mutation type must be given in definition!");if(!("name"in r))throw new Error("Property name must be given in definition!");H(r,(n,i)=>{n==="path"&&(i=K.resolve(i)),Object.defineProperty(this,n,{value:i,enumerable:!0})}),this.path||Object.defineProperty(this,"path",{value:K.resolve([r.name]),enumerable:!0}),Object.seal(this)}};var E=class extends oe{constructor(e){super(e),this.buffers=[]}add(e){return super.add(new Te(this.target,e))}fire(e,r){var n=new M(this.target,r);return e=y(e,!1).map(i=>i instanceof X?i:new X(this.target,i)),this.buffers.length?(we(this.buffers)(e),n):(this.currentlyFiring.filter(i=>e.filter(s=>i.type===s.type&&i.name===s.name).length).length,this.fireables.forEach(i=>{if(n.propagationStopped&&r)return n;n.respondWith(i.fire(e))}),n)}static getFirebase(e,r=!0,n=null){return super._getFirebase("observer",...arguments)}static namespace(e,r=null){return super._namespace("observer",...arguments)}};function D(t,e,r=null,n={}){if(t=r||t,!t||!g(t))throw new Error("Target must be of type object!");t=A(t);var i=y(e),s=i.map(o=>{var f,a=function(u){return arguments.length?u:x(t,"accessorizedProps").has(o)&&x(t,"accessorizedProps").get(o).touch(!0)?x(t,"accessorizedProps").get(o).get():r?Reflect.get(t,o,r):Reflect.get(t,o)};return(f=T.getFirebase(t,!0,n.namespace))?f.fire({type:"get",name:o,related:i,receiver:r},a):a()});return m(e)?s:s[0]}function ze(t,e,r=null,n={}){if(t=A(t),!t||!g(t))throw new Error('Observable subjects must be of type object; "'+S(t)+'" given!');if(_(e)&&(n=arguments.length>2?r:{},r=e,e=null),!_(r))throw new Error('Handler must be a function; "'+S(r)+'" given!');var i,s=E.getFirebase(t,!0,n.namespace),o={filter:e,handler:r,params:n};if((o.filter||o.params.subtree==="*"||o.params.subtree&&me(t))&&Z(t,o.filter,o.params.subtree,n.namespace),o.params.unique&&(i=s.match({filter:e,params:n})).length){if(o.params.unique!=="replace")return i[0];s.remove(i[0])}return s.add(o)}function Y(t,e,r,n=null,i={}){if(t!==r){var s;if(ze(r,(f,a)=>{if(s=E.getFirebase(t,!1,i.namespace)){var u=f.map(c=>{var l=c;do if(l.target===t)return;while(l=l.src);var p={};return H(c,(h,R)=>{h!=="target"&&h!=="name"&&h!=="path"&&h!=="src"&&(p[h]=R)}),p.name=e,p.path=[e].concat(c.path),p.originalSubject=c.originalSubject,p.src=c,new X(t,p)}).filter(c=>c);if(u.length)return s.fire(u,a.cancellable)}},{subtree:!0,...i,unique:!0,tags:[gt,e,t]}),d(n)&&(s=E.getFirebase(t,!1,i.namespace))){var o=re({name:e,type:"set",value:r,related:[e]},n);let f=s.fire(o,i.cancellable);if(i.eventTypeReturn)return f}}}var gt={};function Z(t,e=null,r=!1,n=null){if(!t||!g(t))throw new Error("Target must be of type object!");var i=E.getFirebase(t,!0,n);if(!(!i||i.build)){i.build=r;var s=se(e),o=!s.length||s.filter(a=>!a[0]&&a[0]!==0).length?Object.keys(t):s.map(a=>a[0]),f=s.length?s.map(a=>a.slice(1)).filter(a=>a.length):null;i.subBuild=f&&f.length?f:null,o.forEach(a=>{var u=D(t,a,null,{namespace:n});try{g(u)&&(Y(t,a,u,null,params),(i.subBuild&&me(u)||(_isFunction(r)?r(u):r&&me(u)))&&Z(u,i.subBuild,r,n))}catch{}})}}var me=t=>(t instanceof Object||t instanceof Array||t instanceof Function)&&(typeof window>"u"||t!==window);function Be(t,e,r=null,n={}){if(t=A(t),!t||!g(t))throw new Error('Observable subjects must be of type object; "'+S(t)+'" given!');if(_(e)&&(n=arguments.length>2?r:{},r=e,e=null),r&&!_(r))throw new Error('Handler must be a function; "'+S(r)+'" given!');var i;if(i=E.getFirebase(t,!1,n.namespace))return i.removeMatches({filter:e,originalHandler:r,params:n})}function J(t,e,r,n=null,i={}){Be(r,null,null,{...i,tags:[gt,e,t]});var s;if(d(n)&&(s=E.getFirebase(t,!1,i.namespace))){var o=re({name:e,type:"del",oldValue:r,related:[e]},n);s.fire(o,i.cancellable)}}function ee(t,e,r={}){return j("has",t,{name:e},r)}function Ge(t,e,r,n={}){e=r.receiver||e;var i=r.keysOrPayload,s=r.value;if(!e||!g(e))throw new Error("Target must be of type object!");d(i)&&(n=s||{},s=null),e=A(e);var o=T.getFirebase(e,!1,n.namespace),f=E.getFirebase(e,!1,n.namespace);let a=(h,R,O,w)=>{var L="set",v;t&&(L="defineProperty",v=R||{},R=v.value);var k=!1,$;ee(e,h,n)&&(k=!0,$=D(e,h,r.receiver,n));var b={name:h,type:L,value:R,receiver:r.receiver,related:O,detail:w,isUpdate:k,oldValue:$},F=function(Ie){return arguments.length&&(v?v=Ie:R=Ie),v?x(e,"accessorizedProps",!1).has(h)&&!x(e,"accessorizedProps").get(h).restore()?!1:(Object.defineProperty(e,h,v),!0):x(e,"accessorizedProps",!1).has(h)?x(e,"accessorizedProps").get(h).set(R):(e[h]=R,!0)};if(o){var W=v?{type:"defineProperty",name:h,descriptor:v,receiver:r.receiver,related:O,detail:w,isUpdate:k,oldValue:$}:{type:"set",name:h,value:R,receiver:r.receiver,related:O,detail:w,isUpdate:k,oldValue:$};b.success=o.fire(W,F)}else b.success=F();return b.success&&b.value!==b.oldValue&&(g(b.oldValue)&&J(e,h,b.oldValue,null,n),g(b.value)&&(Y(e,h,b.value,null,n),f&&(f.subBuild||f.build&&me(b.value))&&Z(b.value,f.subBuild,f.build,n.namespace))),b};var u,c=[];m(i)||(I(i)||q(i))&&(u=y(i))?c=u.map(h=>a(h,s,u,n.detail)):d(i)&&(u=Object.keys(i))&&(c=u.map(h=>a(h,i[h],u,n.detail)));var l=c.filter(h=>h.success!==!1),p;return f?(p=f.fire(l,n.cancellable),p.successCount=l.length):n.eventTypeReturn&&(p=new M(e)),n.eventTypeReturn?p:l.length>0}function Ve(t,e,r=null,n={}){return Ge(!0,t,{keysOrPayload:e,value:r},n)}function Qe(t,e,r={}){if(!t||!g(t))throw new Error("Target must be of type object!");t=A(t);var n=y(e),i=n.map(a=>{var u;ee(t,a,r)&&(u=D(t,a,null,r));var c={name:a,type:"deleteProperty",related:n,detail:r.detail,oldValue:u},l,p=function(h){return arguments.length?h:x(t,"accessorizedProps",!1).has(a)&&!x(t,"accessorizedProps").get(a).restore()?!1:(delete t[a],!0)};return(l=T.getFirebase(t,!1,r.namespace))?c.success=l.fire({type:"deleteProperty",name:a,oldValue:u,related:n},p):c.success=p(),c.success&&g(c.oldValue)&&J(t,a,c.oldValue,null,r),c}),s=i.filter(a=>a.success!==!1),o,f;return(o=E.getFirebase(t,!1,r.namespace))?(f=o.fire(s,r.cancellable),f.successCount=s.length):r.eventTypeReturn&&(f=new M(t)),r.eventTypeReturn?f:s.length>0}function Ke(t,e,r={}){return j("getOwnPropertyDescriptor",t,{name:e},r)}function Xe(t,e={}){return j("getPrototypeOf",t,{},e)}function Ze(t,e={}){return j("isExtensible",t,{},e)}function Ye(t,e={}){return j("ownKeys",t,{},e)}function Je(t,e={}){return j("preventExtensions",t,{},e)}function de(t,e,r=null,n=null,i={}){return Ge(!1,t,arguments.length>3?{keysOrPayload:e,value:r,receiver:n}:{keysOrPayload:e,value:r},i)}function et(t,e,r={}){return j("setPrototypeOf",t,{prototype:e},r)}function Qt(t,e=[],r={}){r=d(e)?e:r;var n=(arguments.length===1?Object.keys(t):y(e)).map(i=>{if(x(t,"accessorizedProps").has(i)&&x(t,"accessorizedProps").get(i).touch(!0))return!1;let s=()=>{for(var p,h=t;!p&&(h=Object.getPrototypeOf(h));)p=Object.getOwnPropertyDescriptor(h,i);return p};var o=Object.getOwnPropertyDescriptor(t,i),f,a;o||(f={writable:!0,enumerable:!(i in t),configurable:r.configurable!==!1});var u={...o||f};"value"in u&&delete u.value,"writable"in u&&delete u.writable,u.get=()=>{if(l.ongoingGets.length)return l.get();l.ongoingGets.push(1);var p=D(t,i,null,r);return l.ongoingGets.pop(),p};var c;u.set=p=>{if(l.ongoingSets.length)return l.set(p);l.ongoingSets.push(1);var h=de(t,i,p,null,r);return l.ongoingSets.pop(),h};var l={ongoingGets:[],ongoingSets:[],get:function(){var p=o;return p||(a?p=f:p=s()||f),p.get?p.get.call(t):p.value},set:function(p){var h=o;return h||(a?h=f:(h=s())?"value"in h&&(h=f,a=!0):(h=f,a=!0)),h.set||h.get?h.set?h.set.call(t,p):!1:(h.value=p,!0)},restore:function(){try{return this.intact()&&(o||a?Object.defineProperty(t,i,o||f):delete t[i],x(t,"accessorizedProps").delete(i)),!0}catch{}return!1},intact:function(){return(Object.getOwnPropertyDescriptor(t,i)||{}).get===u.get},touch:function(p=!1){return this.intact()||(p?!this.restore():!1)}};try{return Object.defineProperty(t,i,u),x(t,"accessorizedProps").set(i,l),!0}catch{}return!1});return m(e)?n:n[0]}function Kt(t,e=[],r={}){r=d(e)?e:r;var n=(arguments.length===1?Object.keys(t):y(e)).map(i=>x(t,"accessorizedProps",!1).has(i)?x(t,"accessorizedProps").get(i).restore():!0);return m(e)?n:n[0]}function Xt(t,e={}){if(!g(t))throw new Error('Object must be of type target; "'+S(t)+'" given!');var r=new Proxy(t,{apply:(n,i,s)=>We(n,i,s,e),construct:(n,i,s=null)=>qe(n,i,s,e),defineProperty:(n,i,s)=>Ve(n,i,s,e),deleteProperty:(n,i)=>Qe(n,i,e),get:(n,i,s=null)=>{var o=D(n,i,s,e);return e.proxyAutoBinding!==!1&&_(o)&&!it(o)?o.bind(r):o},getOwnPropertyDescriptor:(n,i)=>Ke(n,i,e),getPrototypeOf:n=>Xe(n,e),has:(n,i)=>ee(n,i,e),isExtensible:n=>Ze(n,e),ownKeys:n=>Ye(n,e),preventExtensions:n=>Je(n,e),set:(n,i,s,o=null)=>de(n,i,s,o,e),setPrototypeOf:(n,i)=>et(n,i,e)});return x(r).set(r,t),r}function Zt(t,e,r={}){if(t=A(t),!g(t))throw new Error('Object must be of type target; "'+S(handler)+'" given!');var n={},i=!0;d(e)||(_(e)?e={"":e}:_(r)&&(e={[e]:r},r=arguments.length>3?arguments[3]:{}),i=!1);var s=T.getFirebase(t,!0,r.namespace);return Object.keys(e).forEach(o=>{if(!_(e[o]))throw new Error("Callback"+(o===null?"":" for "+o)+' must be a function; "'+S(e[o])+'" given!');var f={filter:o,handler:e[o],params:r},a;if(f.params.unique&&(a=s.match(f)).length){if(f.params.unique!=="replace")return a[0];s.remove(a[0])}i?n[o]=s.add(f):n=s.add(f)}),n}function Yt(t,e=null,r={}){if(t=A(t),!t||!g(t))throw new Error('Object must be of type target; "'+S(t)+'" given!');var n=T.getFirebase(t,!1,r.namespace);_isObject(e)||(_(e)?e={[null]:e}:_(r)&&(e={[e]:r},r=arguments.length>3?arguments[3]:{}),isOriginallyObj=!1),(n=T.getFirebase(t,!1,r.namespace))&&Object.keys(e).forEach(i=>{if(!_(e[i]))throw new Error("Callback"+(i===null?"":" for "+i)+' must be a function; "'+S(e[i])+'" given!');var s={filter:i,originalHandler:e[i],params:r};return n.removeMatches(s)})}function Jt(t,...e){var r=e.map(s=>{if(s=A(s),!g(s))throw new Error("Target must be of type object!");return{target:s,subjectCopy:m(s)?s.slice(0):Me(s)}}),n=t(...e);let i=()=>{r.map(s=>{var o=Object.keys(s.subjectCopy),f=Object.keys(s.target),a=[],u=ct(o.concat(f)).map(l=>{if(s.subjectCopy[l]!==s.target[l]){a.push(l);var p={name:l,related:a,buffered:!0};return f.includes(l)?(p.type="set",p.value=s.target[l],o.includes(l)&&(p.isUpdate=!0)):p.type="del",o.includes(l)&&(p.oldValue=s.subjectCopy[l]),g(s.subjectCopy[l])&&J(s.target,l,s.subjectCopy[l]),g(s.target[l])&&Y(s.target,l,s.target[l]),p}}).filter(l=>l),c;if(u.length&&(c=E.getFirebase(s.target,!1)))return c.fire(u)})};return n instanceof Promise?n.then(i):i(),n}var C={apply:We,construct:qe,defineProperty:Ve,deleteProperty:Qe,get:D,getOwnPropertyDescriptor:Ke,getPrototypeOf:Xe,has:ee,isExtensible:Ze,ownKeys:Ye,preventExtensions:Je,set:de,setPrototypeOf:et,accessorize:Qt,unaccessorize:Kt,proxy:Xt,unproxy:A,observe:ze,unobserve:Be,intercept:Zt,unintercept:Yt,closure:Jt,build:Z,link:Y,unlink:J,Observers:E,Interceptors:T};var{URL:er,fetch:tr,Headers:_t,Request:rr,Response:nr,FormData:ir,ReadableStream:on,File:_d,Blob:yt}=globalThis;var fn=t=>{let e=class extends t{constructor(...r){super(...r);var n=ie(this.search);let i=s=>{var o=pe(s);o=o?"?"+o:"",o!==this.search&&(this.search=o)};this.__query={value:n,proxy:new Proxy(n,{set(s,o,f){return s[o]=f,i(s),!0},deleteProperty(s,o){return delete s[o],i(s),!0}})}}set search(r){super.search=r;var n=ie(r);xt(n,this.query)||(this.query=n)}get search(){return super.search}get query(){return this.__query.proxy}};return e.Observable=class extends e{constructor(){super(...arguments);let{Observer:r}=WebQit;r.accessorize(this,["protocol","username","password","host","hostname","port","origin","pathname","search","query","hash","href"])}},e},xt=(t,e)=>d(t)&&d(e)?xt(Object.keys(t),Object.keys(e))&&xt(Object.values(t),Object.values(e)):m(t)&&m(e)?t.length===e.length&&t.reduce((r,n,i)=>r&&n===e[i],!0):t===e,sr=fn;var un=t=>class extends t{tee(e=null){let r=new this.constructor,n=new this.constructor;for(var[i,s]of this.entries()){let o=o(s);e&&e(s,i,o)||!e&&!o?r.append(i,s):n.append(i,s)}return[r,n]}json(e={},r=null){if(arguments.length){Object.keys(e).forEach(o=>{Ue(o,e[o],(f,a)=>{(!r||r(f,a,g(a)))&&this.append(f,a)},f=>!wt(f))});return}var n;for(var[i,s]of this.entries())n||(n=P(fe(i,"["))?[]:{}),De(n,i,s);return n}},or=un,wt=(t,e=null)=>{if(!g(t))return;let r=t[Symbol.toStringTag];return(e||["Uint8Array","Uint16Array","Uint32Array","ArrayBuffer","Blob","File","FormData","Stream"]).reduce((n,i)=>n||(r===i?i:null),null)};var cn=t=>class extends t{constructor(e={}){e instanceof t?super(e):(super(),this.json(e))}json(e={},r=!0){if(arguments.length){let o=ar(this),f=Object.keys(o).reduce((a,u)=>a.concat(typeof u!="symbol"&&"set"in o[u]?u:[]),[]);Object.keys(e).forEach(a=>{var u=f.reduce((c,l)=>c||(l===a||l.toLocaleLowerCase()===a?l:null),null);u?(r||this[u]===void 0)&&(this[u]=e[a]):(r||!this.has(a))&&this.set(a,e[a])});return}let n={};for(var[i,s]of this)n[i]=s;return n}set cacheControl(e){return this.set("Cache-Control",e)}get cacheControl(){return this.get("Cache-Control")}set contentLength(e){return this.set("Content-Length",e)}get contentLength(){return this.get("Content-Length")}set contentType(e){return this.set("Content-Type",e)}get contentType(){return this.get("Content-Type")}},tt=cn;function ar(t){if(t){let e=Object.getPrototypeOf(t);return e===Object.prototype?{}:{...ar(e),...Object.getOwnPropertyDescriptors(t)}}else return Object.create(null)}var ln=t=>class extends tt(t){set accept(e){return this.set("Accept",e)}get accept(){let e=this.get("Accept"),r=e&&e.split(",").map(n=>(n=n.trim().split(";").map(i=>i.trim()),[n.shift(),parseFloat((n.pop()||"1").replace("q=",""))])).sort((n,i)=>n[1]>i[1]?-1:1)||[];return{match(n){return n=(n+"").split("/"),r.reduce((i,s)=>i||(s=s[0].split("/"))&&[0,1].every(o=>n[o]===s[o]||n[o]==="*"||s[o]==="*"),!1)},toString(){return e}}}set cookies(e){if(!d(e))throw new Error(`Cookies must be of type object. Received type: ${S(e)}.`);return this.set("Cookie",pe(e,";")),this._cookies=null,!0}get cookies(){return this._cookies||(this._cookies=ie(this.get("cookie"),{},";")),this._cookies}set range(e){let r=[];return y(e).forEach((n,i)=>{let s=Array.isArray(n)?n.join("-"):n+"";i===0&&!s.includes("bytes=")&&(s=`bytes=${s}`),r.push(s)}),this.set("Range",r.join(", "))}get range(){let e=this.get("Range");return e?z(e,"bytes=").split(",").map(n=>{let i=n.trim().split("-");return i[0]=i[0]?parseInt(i[0],10):void 0,i[1]&&(i[1]=parseInt(i[1],10)),i.clamp=s=>{(i[1]>s-1||i[1]===void 0)&&(i[1]=s-1),i[0]===void 0&&(i[0]=i[1]?s-i[1]-1:0)},i}):void 0}set cors(e){return this.set("Access-Control-Allow-Origin",e===!0?"*":e===!1?"":e)}get cors(){return this.get("Access-Control-Allow-Origin")}},fr=ln;var pn=t=>class extends tt(t){set cookies(e){if(!d(e))throw new Error(`The "cookies" response directive cannot be of type: ${S(e)}`);for(let r in e){let n=e[r];if(d(n)){let i=[n.value];for(let s in n){if(s==="value")continue;let o=s[0].toUpperCase()+s.substring(1);o==="MaxAge"&&(o="Max-Age"),i.push(n[s]===!0?o:`${o}=${n[s]}`)}n=i.join("; ")}this.append("Set-Cookie",`${r}=${n}`)}return!0}get cookies(){let e=this.get("Set-Cookie");return e&&e.split(",").reduce((r,n)=>{let[i,s]=n.split(";"),[o,f]=i.trim().split("=");return r[o]={value:f},s&&(s||"").split(/\;/g).map(a=>a.trim().split("=")).forEach(a=>{r[o][a[0][0].toLowerCase()+a[0].substring(1).replace("-","")]=a.length===1?!0:a[1]}),r},{})}set contentRange(e){if(Array.isArray(e)){if(e.length===2&&!e[0].includes("-")||e.length<2)throw new Error("A Content-Range array must be in the format: [ 'start-end', 'total' ]");return this.set("Content-Range",`bytes ${e.join("/")}`)}return this.set("Content-Range",e)}get contentRange(){let e=this.get("Content-Range");return e&&z(e,"bytes ").split("/")}set cors(e){return this.set("Access-Control-Allow-Origin",e===!0?"*":e===!1?"":e)}get cors(){return this.get("Access-Control-Allow-Origin")}set attachment(e){if(e=e===!0?"attachment":e===!1?"inline":e,!I(e))throw new Error(`The "download" response directive does not support the type: ${S(e)}`);return["attachment","inline"].includes(e)||(e=`attachment; filename="${e}"`),this.set("Content-Disposition",e)}get attachment(){var e=(this.get("Content-Disposition")||"").trim();return e=e==="attachment"?!0:e==="inline"?!1:z(ne(e,'"'),'filename="'),e}get location(){return this.get("Location")}set location(e){return this.set("Location",e)}get redirect(){return this.get("Location")}set redirect(e){return this.set("Location",e)}},ur=pn;var hn=(t,e,r)=>{let n=class extends t{constructor(i,s,o){"headers"in s&&!(s.headers instanceof e)&&(s={...s},s.headers=new e(s.headers),arguments[1]=s),B(s)?super(i):super(i,s),this._headers=s.headers,o.headers&&this.headers.json(o.headers);let f={};Object.defineProperty(this,"attrs",{get:()=>f}),Object.defineProperty(this,"bodyAttrs",{get:()=>o})}clone(){return new this.constructor(super.clone())}get headers(){return this._headers||(this._headers=new e(super.headers)),this._headers}get attrs(){return this.attrs}get url(){return"url"in this.attrs?this.attrs.url:super.url}async arrayBuffer(){return this.bodyAttrs.arrayBuffer?this.bodyAttrs.arrayBuffer:super.arrayBuffer()}async blob(){return this.bodyAttrs.blob?this.bodyAttrs.blob:super.blob()}async formData(){if(this.bodyAttrs.formData)return this.bodyAttrs.formData;let i=await super.formData();return i.tee=r.prototype.tee.bind(i),i.json=r.prototype.json.bind(i),i}async json(){return this.bodyAttrs.json?this.bodyAttrs.json:super.json()}async text(){return this.bodyAttrs.text?this.bodyAttrs.text:super.text()}jsonfy(i=!1){return(!this.bodyAttrs.jsonfied||i)&&(this.bodyAttrs.jsonfied=new Promise(async(s,o)=>{var f=this,a,u=f.headers.get("content-type")||"",c=u==="application/json"||this.bodyAttrs.json?"json":u==="application/x-www-form-urlencoded"||u.startsWith("multipart/form-data")||this.bodyAttrs.formData?"formData":u==="text/plain"?"plain":"other";try{c==="formData"?a=(await f.formData()).json():a=c==="json"?await f.json():c==="plain"?await f.text():f.body,s(a)}catch(l){o(l)}})),this.bodyAttrs.jsonfied}};return n.Headers=e,n},rt=hn;function nt(t,e,r){let n={body:t,input:t},i=(f,a)=>{if(!e.encode)return;let[u,c]=e.encode(a);f.body=u,f.headers=c};if(I(t)||q(t))return n.inputType="text",n.text=t,n.headers={contentLength:(t+"").length},n;if(n.inputType=wt(t),["Blob","File"].includes(n.inputType))n.blob=t,n.headers={contentType:t.type,contentLength:t.size};else if(["Uint8Array","Uint16Array","Uint32Array","ArrayBuffer"].includes(n.inputType))n.arrayBuffer=t,n.headers={contentLength:t.byteLength};else if(n.inputType==="FormData")n.formData=t,i(n,t);else if(d(t)&&$e(t)||m(t)&&st(t)){n.inputType="object";var s,o=new e;o.json(t,(f,a,u)=>(s=s||u,!0)),s?(n.formData=o,i(n,o)):(n.json=t,n.body=JSON.stringify(t),n.headers={contentType:"application/json",contentLength:new r([n.body]).size}),n.jsonfied=t}return n}var mn=(t,e,r,n)=>class extends rt(t,e,r){constructor(i,s={}){s={...s};let o={};i instanceof t&&(s.method&&i.method!==s.method.toUpperCase()&&["GET","HEAD"].includes(s.method.toUpperCase())?(i=i.url,["headers","mode","credentials","cache","redirect","referrer","integrity"].forEach(a=>{a in s||(s[a]=i[a])})):o=i.bodyAttrs||{}),"body"in s&&(o=nt(s.body,r,n),s.body=o.body);let f;s.mode==="navigate"&&(f=!0,s={...s},delete s.mode),super(i,s,o),f&&(this.attrs.mode="navigate")}get mode(){return"mode"in this.attrs?this.attrs.mode:super.mode}get cache(){return"cache"in this.attrs?this.attrs.cache:super.cache}get destination(){return"destination"in this.attrs?this.attrs.destination:super.destination}get referrer(){return"referrer"in this.attrs?this.attrs.referrer:super.referrer}static compat(i,s=null){return i instanceof t?Object.setPrototypeOf(i,new this):new this(s,i)}},cr=mn;var dn=(t,e,r,n)=>class extends rt(t,e,r){constructor(i=null,s={}){let o={},f;arguments.length&&(i instanceof t?(f=i,s={status:i.status,statusText:i.statusText,headers:i.headers,...s},i.status===0&&delete s.status,o=i.bodyAttrs||{},i=i.body):(o=nt(i,r,n),i=o.body)),super(i,s,o),f&&(this.attrs.url=f.url,this.attrs.ok=f.ok,this.attrs.status=f.status,this.attrs.type=f.type,this.attrs.redirected=f.redirected)}get ok(){return"ok"in this.attrs?this.attrs.ok:super.ok}get status(){return"status"in this.attrs?this.attrs.status:super.status}get statusText(){return"statusText"in this.attrs?this.attrs.statusText:super.statusText}get type(){return"type"in this.attrs?this.attrs.type:super.type}get redirected(){return"redirected"in this.attrs?this.attrs.redirected:super.redirected}static compat(i){return i instanceof t?Object.setPrototypeOf(i,new this):new this(i)}},lr=dn;var gn=t=>t,pr=gn;var _n=(t,e,r)=>{let n=class{constructor(i,s,o){this._request=i,this._detail=s||{},this._sessionFactory=o,this.Request=t,this.Response=e,this.URL=r,this.port={listeners:[],post(f){let a=this.listeners.map(u=>u(f)).filter(u=>u instanceof Promise);if(process.length)return Promise.all(a)},listen(f){this.listeners.push(f)}}}get url(){return this._url||(this._url=new this.URL(this._request.url)),this._url}get request(){return this._request}get detail(){return this._detail}get session(){return this._session||(this._session=this.sessionFactory().get()),this._session}sessionFactory(...i){return this._sessionFactory(...i)}retarget(i,s={}){var o;return i instanceof t?B(s)?o=i:o=new t(i,s):(o=new t(this._request,s),o.attrs.url=`${this.url.origin}${i}`,o.attrs.referrer=this.request.url),new n(o,this.detail)}};return n},hr=_n;var yn=sr(er),mr=or(ir);var xn=fr(_t),wn=ur(_t),bt=cr(rr,xn,mr,yt),je=lr(nr,wn,mr,yt),Fg=pr(tr),dr=hr(bt,je,yn);var Le=class{constructor(){this.messaging={post:(e,r=this.client)=>{if(!r)throw new Error("No client for this operation.");return r.postMessage(e),this.post},listen:(e,r=this.client)=>r?(r.addEventListener("message",e),this.post):(self.addEventListener("message",n=>{this.client=n.source,e(n)}),this.post),request:(e,r=this.client)=>{if(!r)throw new Error("No client for this operation.");return new Promise(n=>{let i=new MessageChannel;r.postMessage(e,[i.port2]),i.port1.onmessage=s=>n(s.data)})},channel(e){this.channels.has(e)||this.channels.set(e,new BroadcastChannel(r));let r=this.channels.get(e);return{broadcast:n=>r.postMessage(n),listen:n=>r.addEventListener("message",n)}},channels:new Map},this.notifications={fire:(e,r={})=>new Promise((n,i)=>{if(!(self.Notification&&self.Notification.permission==="granted"))return i(self.Notification&&self.Notification.permission);s.addEventListener("error",i);let s=new self.Notification(e,r);s.addEventListener("click",n),s.addEventListener("close",n)}),listen:e=>(self.addEventListener("notificationclick",e),this.notifications)},this.push={listen:e=>(self.addEventListener("push",e),this.post)}}setCurrentClient(e){this.client=e}};var Fe=class{constructor(e,r){this.cx=e,this.clients=new Map,this.mockSessionStore={},this.cx.runtime=this;let n=r(this.cx,"*");if(!n||!n.handle)throw new Error('Application instance must define a ".handle()" method.');this.clients.set("*",n),self.addEventListener("install",s=>{this.cx.params.skip_waiting&&self.skipWaiting(),this.cx.params.cache_name&&(this.cx.params.cache_only_urls||[]).length&&s.waitUntil(self.caches.open(this.cx.params.cache_name).then(o=>{this.cx.logger&&this.cx.logger.log("[ServiceWorker] Pre-caching resources.");let f=(this.cx.params.cache_only_urls||[]).map(a=>a.trim()).filter(a=>a&&!pt(a,self.origin).isPattern());return o.addAll(f)}))}),self.addEventListener("activate",s=>{s.waitUntil(new Promise(async o=>{this.cx.params.skip_waiting&&await self.clients.claim(),this.cx.params.cache_name&&await self.caches.keys().then(f=>Promise.all(f.map(a=>{if(a!==this.cx.params.cache_name&&a!==this.cx.params.cache_name+"_json")return this.cx.logger&&this.cx.logger.log("[ServiceWorker] Removing old cache:",a),self.caches.delete(a)}))),o()}))}),self.addEventListener("fetch",s=>{!s.request.url.startsWith("http")||s.respondWith((async(o,f)=>{let a=await self.clients.get(s.clientId);this.workport.setCurrentClient(a);let u=["method","headers","mode","credentials","cache","redirect","referrer","integrity"].reduce((c,l)=>({[l]:o[l],...c}),{});return["GET","HEAD"].includes(o.method)||(u.body=await o.text()),o.cache==="force-cache"&&(u.cache="default"),this.go(o.url,u,{event:f})})(s.request,s))});let i=new Le;C.set(this,"workport",i),i.messaging.listen(async s=>{let o=s.ports[0],f=this.clients.get("*"),a=f.alert&&await f.alert(s);o&&(a instanceof Promise?a.then(u=>{o.postMessage(u)}):o.postMessage(a))}),i.notifications.listen(async s=>{let o=this.clients.get("*");o.alert&&await o.alert(s)}),i.push.listen(async s=>{let o=this.clients.get("*");o.alert&&await o.alert(s)}),C.set(this,"location",{}),C.set(this,"network",{}),C.observe(this.network,s=>{})}async go(e,r={},n={}){e=typeof e=="string"?new URL(e):e,r={referrer:this.location.href,...r};let i=await this.generateRequest(e.href,r);n.event&&Object.defineProperty(n.event,"request",{value:i});let s=new dr(i,n,(a=null,u=!1)=>this.getSession(s,a,u));s.port.listen(a=>{if(a.$type==="handler:hints"&&a.session)return Promise.resolve()});let o;return s.request.url.startsWith(self.origin)?o=await this.clients.get("*").handle(s,(...a)=>this.remoteFetch(...a)):o=await this.remoteFetch(s.request),this.handleResponse(s,o)}generateRequest(e,r){return new bt(e,r)}getSession(e,r=null,n=!1){return{get:()=>this.mockSessionStore,set:i=>{this.mockSessionStore=i}}}remoteFetch(e,...r){arguments.length>1&&(e=this.generateRequest(e,...r));let n=(o,f)=>be((o||[]).map(a=>a.trim()).filter(a=>a),a=>pt(a,self.origin).test(f)),s=(()=>{if(!this.cx.params.default_fetching_strategy||this.cx.params.default_fetching_strategy==="network-first"||n(this.cx.params.network_first_urls,e.url))return C.set(this.network,"strategy","network-first"),this.networkFetch(e,{cacheFallback:!0,cacheRefresh:!0});if(this.cx.params.default_fetching_strategy==="cache-first"||n(this.cx.params.cache_first_urls,e.url))return C.set(this.network,"strategy","cache-first"),this.cacheFetch(e,{networkFallback:!0,cacheRefresh:!0});if(this.cx.params.default_fetching_strategy==="network-only"||n(this.cx.params.network_only_urls,e.url))return C.set(this.network,"strategy","network-only"),this.networkFetch(e,{cacheFallback:!1,cacheRefresh:!1});if(this.cx.params.default_fetching_strategy==="cache-only"||n(this.cx.params.cache_only_urls,e.url))return C.set(this.network,"strategy","cache-only"),this.cacheFetch(e,{networkFallback:!1,cacheRefresh:!1})})(e);return s.catch(o=>C.set(this.network,"error",o.message)),s.then(o=>je.compat(o))}networkFetch(e,r={}){return r.cacheFallback?self.fetch(e).then(n=>(r.cacheRefresh&&this.refreshCache(e,n),C.set(this.network,"remote",!0),n)).catch(()=>this.getRequestCache(e).then(n=>(C.set(this.network,"cache",!0),n.match(e)))):(C.set(this.network,"remote",!0),self.fetch(e))}cacheFetch(e,r={}){return this.getRequestCache(e).then(n=>n.match(e).then(i=>!i&&r.networkFallback?this.networkFetch(e,{...r,cacheFallback:!1}):(i&&r.cacheRefresh&&this.networkFetch(e,{...r,justRefreshing:!0}),C.set(this.network,"cache",!0),i)))}refreshCache(e,r){if(e.method!=="GET"||!r||r.status!==200||r.type!=="basic"&&r.type!=="cors")return r;var n=r.clone();return this.getRequestCache(e).then(i=>{C.set(this.network,"cacheRefresh",!0),i.put(e,n)}),r}getRequestCache(e){let r=e.headers.get("Accept")==="application/json"?this.cx.params.cache_name+"_json":this.cx.params.cache_name;return self.caches.open(r)}handleResponse(e,r){return r instanceof je||(r=je.compat(r)),r}};async function gr(t=null){let e=this||{},r=n=>new Ae(n);return new Fe(ye.create(e),(...n)=>t?t(...n.concat(r)):r(...n))}var bn={},vn={cache_name:"cache_v0",default_fetching_strategy:"network-first",network_first_urls:[],cache_first_urls:[],network_only_urls:[],cache_only_urls:["/page-3/.webqit/oohtml-cli/bundler.json"],skip_waiting:!1,support_push:!1,push_registration_url:"",push_deregistration_url:"",push_public_key:"",routing:{root:"/",subroots:[],targets:3}};gr.call({layout:bn,params:vn});
3
+ })();
@@ -1,16 +1,16 @@
1
- export default function(e, c, n) {
2
- if (n.pathname === 'page-1') {
3
- return new Promise(res => {
4
- setTimeout(() => {
5
- res({});
6
- }, 4000);
7
- });
8
- }
9
- if (!n.pathname || ['page-3', 'page-4'].includes(n.pathname)) {
10
- return {};
11
- }
12
- if (n.pathname === 'page-5') {
13
- return new e.Response(null, { status: 302, headers: { Location: '/page-4/subpage', } });
14
- }
15
- if (n.stepname) return n();
1
+ export default function(e, c, n) {
2
+ if (n.pathname === 'page-1') {
3
+ return new Promise(res => {
4
+ setTimeout(() => {
5
+ res({});
6
+ }, 4000);
7
+ });
8
+ }
9
+ if (!n.pathname || ['page-3', 'page-4'].includes(n.pathname)) {
10
+ return {};
11
+ }
12
+ if (n.pathname === 'page-5') {
13
+ return new e.Response(null, { status: 302, headers: { Location: '/page-4/subpage', } });
14
+ }
15
+ if (n.stepname) return n();
16
16
  }
@@ -1,29 +0,0 @@
1
-
2
- /**
3
- * ---------------------------
4
- * The base Application class
5
- * ---------------------------
6
- */
7
-
8
- export default class Application {
9
-
10
- constructor(cx) {
11
- this.cx = cx;
12
- }
13
-
14
- /**
15
- * Initializes application itself.
16
- *
17
- * @param HttpEvent httpEvent
18
- * @param Function remoteFetch
19
- *
20
- * @return Boolean|undefined
21
- */
22
- async init(httpEvent, remoteFetch) {
23
- // The app router
24
- const router = new this.Router(this.cx, '/');
25
- return router.route(['init'], httpEvent, {}, async event => {
26
- }, remoteFetch);
27
- }
28
-
29
- }
@@ -1,82 +0,0 @@
1
-
2
- /**
3
- * @imports
4
- */
5
- import { _isString, _isObject } from "@webqit/util/js/index.js";
6
-
7
- export default class Cookies extends Map {
8
-
9
- constructor(...args) {
10
- super(...args);
11
- Object.defineProperty(this, 'inLock', { value: false, writable: true });
12
- Object.defineProperty(this, 'outLock', { value: false, writable: true });
13
- }
14
-
15
- set(name, value) {
16
- if (this.inLock) return;
17
- if (this.has(name)) this.delete(name);
18
- this.inLock = true;
19
- // -----------------
20
- let valueObj = value, valueStr = value, retrn;
21
- if (_isString(value)) { valueObj = this.parseEntry(`=${ value }`)[1]; }
22
- retrn = super.set(name, valueObj);
23
- if (!this.outLock) {
24
- if (_isObject(value)) { valueStr = this.stringifyEntry(value); }
25
- append(this.headers, `${ name }=${ valueStr }`);
26
- }
27
- // -----------------
28
- this.inLock = false;
29
- return retrn;
30
- }
31
-
32
- delete(name) {
33
- if (this.inLock) return;
34
- this.inLock = true;
35
- // -----------------
36
- let retrn = super.delete(name);
37
- this.headers.delete(this.headers.cookieHeaderName);
38
- for (let [ name, definition ] of this) {
39
- append(this.headers, `${ name }=${ this.stringifyEntry(definition) }`);
40
- }
41
- // -----------------
42
- this.inLock = false;
43
- return retrn;
44
- }
45
-
46
- clear() {
47
- if (this.inLock) return;
48
- this.inLock = true;
49
- // -----------------
50
- let retrn = super.clear();
51
- this.headers.delete(this.headers.cookieHeaderName);
52
- // -----------------
53
- this.inLock = false;
54
- return retrn;
55
- }
56
-
57
- json(json = {}) {
58
- if (arguments.length) {
59
- this.clear();
60
- for (let name in json) {
61
- this.set(name, json[name])
62
- }
63
- return;
64
- }
65
- for (let [ name, definition ] of this) {
66
- json[name] = definition;
67
- }
68
- return json;
69
- }
70
-
71
- toString() {
72
- return this.headers.get(this.headers.cookieHeaderName);
73
- }
74
-
75
- }
76
-
77
- function append(headers, value) {
78
- let values = [value];
79
- let currentValue = headers.get(headers.cookieHeaderName);
80
- if (currentValue) { values.unshift(currentValue); }
81
- headers.set(headers.cookieHeaderName, values.join(headers.cookieHeaderSeparator));
82
- }
@@ -1,21 +0,0 @@
1
-
2
- /**
3
- * @imports
4
- */
5
-
6
- import { _isFunction } from "@webqit/util/js/index.js";
7
-
8
- /**
9
- * ---------------------------
10
- * The base Runtime class
11
- * ---------------------------
12
- */
13
-
14
- export default class Runtime {
15
- constructor(cx, applicationInstance) {
16
- this.cx = cx;
17
- this.cx.runtime = this;
18
- this.app = _isFunction(applicationInstance) ? applicationInstance(this.cx) : applicationInstance;
19
- if (!this.app || !this.app.handle) throw new Error(`Application instance must define a ".handle()" method.`);
20
- }
21
- }
@@ -1,100 +0,0 @@
1
-
2
- /**
3
- * @imports
4
- */
5
- import Router from './Router.js';
6
- import _Application from '../Application.js';
7
-
8
- export default class Application extends _Application {
9
-
10
- // Returns router class
11
- get Router() {
12
- return Router;
13
- }
14
-
15
- /**
16
- * Handles HTTP events.
17
- *
18
- * @param HttpEvent httpEvent
19
- * @param Function remoteFetch
20
- *
21
- * @return Response
22
- */
23
- async handle(httpEvent, remoteFetch) {
24
- // The app router
25
- const router = new this.Router(this.cx, httpEvent.url.pathname);
26
- const handle = async () => {
27
- // --------
28
- // ROUTE FOR DATA
29
- // --------
30
- return router.route([httpEvent.request.method, 'default'], httpEvent, { ...( document.state?.data || {} ) }, async event => {
31
- if (event !== httpEvent) {
32
- // This was nexted()
33
- if (!event.request.headers.has('Accept')) {
34
- event.request.headers.set('Accept', 'application/json');
35
- }
36
- }
37
- return remoteFetch(event.request);
38
- }, remoteFetch);
39
- };
40
- // --------
41
- // PIPE THROUGH MIDDLEWARES
42
- // --------
43
- return await (this.cx.middlewares || []).concat(handle).reverse().reduce((next, fn) => {
44
- return () => fn.call(this.cx, httpEvent, router, next);
45
- }, null)();
46
- }
47
-
48
- // Renderer
49
- async render(httpEvent, response) {
50
- let data = await response.jsonfy();
51
- const router = new this.Router(this.cx, httpEvent.url.pathname);
52
- return router.route('render', httpEvent, data, async (httpEvent, data) => {
53
- // --------
54
- // OOHTML would waiting for DOM-ready in order to be initialized
55
- if (window.WebQit.DOM) {
56
- await new Promise(res => window.WebQit.DOM.ready(res));
57
- }
58
- if (window.document.state) {
59
- if (!window.document.state.env) {
60
- window.document.setState({
61
- env: 'client',
62
- onHydration: (httpEvent.detail || {}).srcType === 'hydration',
63
- network: this.cx.runtime.network,
64
- url: this.cx.runtime.location,
65
- }, { update: true });
66
- }
67
- window.document.setState({ data }, { update: 'merge' });
68
- }
69
- if (window.document.templates) {
70
- window.document.body.setAttribute('template', 'routes/' + httpEvent.url.pathname.split('/').filter(a => a).map(a => a + '+-').join('/'));
71
- await new Promise(res => (window.document.templatesReadyState === 'complete' && res(), window.document.addEventListener('templatesreadystatechange', res)));
72
- }
73
- await this.scrollIntoView(httpEvent);
74
- return window;
75
- });
76
- }
77
-
78
- // Unrender
79
- async unrender(httpEvent) {
80
- if (window.document.state) {
81
- window.document.setState({ data: {} }, { update: 'merge' });
82
- }
83
- }
84
-
85
- // Normalize scroll position
86
- async scrollIntoView(httpEvent) {
87
- if (!(httpEvent.detail.srcType === 'link')) return;
88
- await new Promise(res => setTimeout(res, 10));
89
- let viewportTop, urlTarget;
90
- if (httpEvent.url.hash && (urlTarget = document.querySelector(httpEvent.url.hash))) {
91
- urlTarget.scrollIntoView();
92
- } else if (viewportTop = Array.from(document.querySelectorAll('[data-viewport-top]')).pop()) {
93
- viewportTop.focus();
94
- } else {
95
- document.body.scrollIntoView();
96
- }
97
- }
98
-
99
- }
100
-