imba
Version:
12 lines (10 loc) • 150 kB
JavaScript
var ue=Symbol.for("#__init__"),vl=Symbol.for("#__initor__"),su=Symbol.for("#__inited__"),bl=Symbol.for("#__hooks__"),Vp=Symbol.for("#__patch__"),nu=Symbol.for("#has"),ou=Symbol.for("#meta"),mi=Symbol.for("imba"),Dp=Symbol.for("#__mixin__"),lu=Symbol.for("#matcher"),sr=Symbol.for("#L"),jp=Symbol.for("#appendChild"),Gp=Symbol.for("#afterVisit"),zp=Symbol.for("#beforeReconcile"),Bp=Symbol.for("#afterReconcile"),Up=Symbol.for("##up"),Kp={SUPERCALLS:1<<3,CONSTRUCTOR:1<<4},nr={IsExtension:1<<0,IsTag:1<<1,HasDescriptors:1<<2,HasSuperCalls:1<<3,HasConstructor:1<<4,HasFields:1<<5,HasMixins:1<<6,HasInitor:1<<7,HasDecorators:1<<8,IsObjectExtension:1<<9},zt=new Map,hu=globalThis[mi]||(globalThis[mi]={counter:0,classes:zt});function Bt(i,t={}){return zt.has(i)||zt.set(i,{symbol:Symbol(i.name),parent:Object.getPrototypeOf(i.prototype)?.constructor,for:i,uses:null,inits:null,id:hu.counter++,...t}),zt.get(i)}var $l=new WeakMap;function qp(i,t){return i===t||t?.[lu]?.(i)}function Yp(i,t){return typeof t=="string"?typeof i===t:t?.[Symbol.hasInstance]?.(i)}function Wp(i,t){return t?.[nu]?.(i)??t?.includes?.(i)??t?.has?.(i)??!1}function Xp(i,t){return t?.indexOf?t.indexOf(i):Array.prototype.indexOf.call(i,t)}function Qp(i,t,...e){return t&&t[sr]instanceof Function?i=t[sr](i,t,...e):globalThis[sr]instanceof Function&&(i=globalThis[sr](i,t,...e)),i}function Jp(i){return $l.get(i)||$l.set(i,{}).get(i)}function xl(i){return i?.toIterable?.()||i}function Zp(i,t,e,r){let s,n=arguments.length,o=i.length,l=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r;for(;o>0;)(s=i[--o])&&(l=(n<3?s(l):n>3?s(t,e,l):s(t,e))||l);return n>3&&l&&Object.defineProperty(t,e,l),l}function au(i,t){if(!i||!t)return!1;if(i.get)return t.get===i.get;if(i.set)return t.set===i.set;if(i.value)return i.value===t.value}function Sl(i,t,e,r={}){let s=i.constructor;!e&&t&&(e=Object.getOwnPropertyDescriptors(t),delete e.constructor,e[ue]&&(console.warn(`Cannot define plain fields when extending class ${s.name}`),delete e[ue]));let n=Bt(s);if(n&&n.augments){let o=new Map;for(let l of Object.keys(e)){let h=Object.getOwnPropertyDescriptor(i,l);for(let u of n.augments){let f=o.get(u);f||o.set(u,f={});let c=Object.getOwnPropertyDescriptor(u.prototype,l);c&&!au(h,c)?console.warn("wont extend",l,c,h):f[l]=e[l]}}for(let[l,h]of o)Object.keys(h).length&&Sl(l.prototype,null,h)}return Object.defineProperties(i,e),i}function gi(i,t){let e=Bt(i),r=Bt(t);if(r.parent&&!(i.prototype instanceof r.parent))throw new Error(`Mixin ${t.name} has superclass not present in target class`);if(!r.augments){r.augments=new Set;let n=r.ref=Symbol(t.name),o=Object[Symbol.hasInstance];t.prototype[n]=!0,Object.defineProperty(t,Symbol.hasInstance,{value:function(l){return this===t?l&&!!l[n]:o.call(this,l)}})}if(i.prototype[r.ref])return i;if(r.uses)for(let n of r.uses)gi(i,n);r.augments.add(i),e.uses||(e.uses=[]),e.uses.push(t);let s=Object.getOwnPropertyDescriptors(t.prototype);return delete s.constructor,s[ue]&&(e.inits||(e.inits=[]),e.inits.push(t.prototype[ue]),delete s[ue]),Object.defineProperties(i.prototype,s),t?.mixed instanceof Function&&t.mixed(i),i}function tm(i,t,...e){let r=t?class extends t{}:class{},s=Bt(r,{symbol:i});for(let n of e)gi(r,n);return r.prototype[i]=function(n,o,l){if(s.inits)for(let h of s.inits)h.call(this,n,!1,l)},r}var X={cache:{},self:null,target:null,proxy:new Proxy({},{apply:(i,t,...e)=>X.target[t].apply(X.self,e),get:(i,t)=>Reflect.get(X.target,t,X.self),set:(i,t,e,r)=>Reflect.set(X.target,t,e,X.self)})};function em(i,t){return X.self=i,X.target=X.cache[t],X.proxy}function a(i,t,e,r,s=null){let n=Object.getPrototypeOf(i.prototype),o=r&nr.HasMixins,l;if(o&&(zt.set(i,zt.get(n.constructor)),n=Object.getPrototypeOf(n)),s){let u=r&nr.IsObjectExtension?s:s.prototype,f=Bt(i);if(f.uses){s===u&&console.warn("Cannot extend object with mixins");for(let c of f.uses)gi(s,c)}return r&nr.HasSuperCalls&&(X.cache[t]=Object.create(Object.getPrototypeOf(u),Object.getOwnPropertyDescriptors(u))),Sl(u,i.prototype),s}let h=n?.constructor;if(l=Bt(i,{symbol:t}),Object.defineProperty(i,ou,{value:l,enumerable:!1,configurable:!0}),e&&i.name!==e&&Object.defineProperty(i,"name",{value:e,configurable:!0}),l.flags=r,r&nr.HasConstructor&&(i.prototype[vl]=t),l.uses)for(let u of l.uses)u.mixes?.(i);return h?.inherited instanceof Function&&h.inherited(i),i}function rm(i,t){i[vl]===t&&(i[su]?.(),i[bl]&&i[bl].inited(i))}var ce=Symbol.for("#__listeners__"),uu=/-./g,lm=new Set,cu=Symbol(),$i=class{static for(t){return new Proxy({},new this(t))}constructor(t){this.getter=t}get target(){return this.getter()}get(t,e){return this.target[e]}set(t,e,r){return this.target[e]=r,!0}},yi=$i;(()=>{a($i,cu,"LazyProxy",16)})();function _l(i,t={}){return new Proxy(t,new yi(i))}function fe(i){let t=typeof i;if(t=="number")return i;if(t=="string"){if(/^\d+fps$/.test(i))return 1e3/parseFloat(i);if(/^([-+]?[\d\.]+)s$/.test(i))return parseFloat(i)*1e3;if(/^([-+]?[\d\.]+)ms$/.test(i))return parseFloat(i)}return null}function hm(i){return i.indexOf("-")>=0?i.replace(uu,function(t){return t.charAt(1).toUpperCase()}):i}function bi(i,t,e){if(!i)return;let r=Object.getOwnPropertyDescriptor(i,t);return r||i==e?r||void 0:bi(Reflect.getPrototypeOf(i),t,e)}var wl=function(i,t,e){let r,s,n;for(;(r=e)&&(e=e.next);)(s=e.listener)&&(e.path&&s[e.path]?n=t?s[e.path].apply(s,t):s[e.path]():n=t?s.apply(e,t):s.call(e)),e.times&&--e.times<=0&&(r.next=e.next,e.listener=null)};function j(i,t,e,r){let s,n,o;return s=i[ce]||(i[ce]={}),n=s[t]||(s[t]={}),o=n.tail||(n.tail=n.next={}),o.listener=e,o.path=r,n.tail=o.next={},o}function O(i,t,e){let r=j(i,t,e);return r.times=1,r}function Mt(i,t,e,r){if(!e)return;let s,n,o=i[ce];if(!!o&&(s=o[t])){for(;(n=s)&&(s=s.next);)if(s==e||s.listener==e){n.next=s.next,s.listener=null;break}}}function G(i,t,e=null){let r;(r=i[ce])&&(r[t]&&wl(t,e,r[t]),r.all&&wl(t,[t,e],r.all))}var fu=Symbol(),vi=class{emit(t,...e){return G(this,t,e)}on(t,...e){return j(this,t,...e)}once(t,...e){return O(this,t,...e)}un(t,...e){return Mt(this,t,...e)}},Ut=vi;(()=>{a(vi,fu,"Emitter",0)})();function am(i){return i}function xi(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}function du(i){let t;return i&&((t=i.toIterable)?t.call(i):i)}var Tl=Symbol.for("#__init__"),Ll=Symbol.for("#schedule"),Si=Symbol.for("#frames"),or=Symbol.for("#interval"),Kt=Symbol.for("#stage"),qt=Symbol.for("#scheduled"),lr=Symbol.for("#version"),pu=Symbol.for("#fps"),Cl=Symbol.for("#ticker"),mu=globalThis.requestAnimationFrame||function(i){return globalThis.setTimeout(i,1e3/60)};var fm=1/60,gu=Symbol(),Ti=class{constructor(t=null){this[Tl](t)}[Tl](t=null,e=!0,r=!0){var s;this.owner=t&&(s=t.owner)!==void 0?s:null,this.target=t&&(s=t.target)!==void 0?s:null,this.active=t&&(s=t.active)!==void 0?s:!1,this.value=t&&(s=t.value)!==void 0?s:void 0,this.skip=t&&(s=t.skip)!==void 0?s:0,this.last=t&&(s=t.last)!==void 0?s:0}tick(t,e){return this.last=this.owner[Si],this.target.tick(this,e),1}update(t,e){let r=this.active,s=t.value;return this.value!=s&&(this.deactivate(),this.value=s),(this.value||r||e)&&this.activate(),this}queue(){this.owner.add(this)}activate(){return this.value===!0?this.owner.on("commit",this):this.value===!1||typeof this.value=="number"&&(this.value/16.666666666666668<=2?this.owner.on("raf",this):this[or]=globalThis.setInterval(this.queue.bind(this),this.value)),this.active=!0,this}deactivate(){return this.value===!0&&this.owner.un("commit",this),this.owner.un("raf",this),this[or]&&(globalThis.clearInterval(this[or]),this[or]=null),this.active=!1,this}},wi=Ti;(()=>{a(Ti,gu,"Scheduled",16)})();var yu=Symbol(),Li=class{constructor(){var t=this;this.id=Symbol(),this.queue=[],this.stage=-1,this[Kt]=-1,this[Si]=0,this[qt]=!1,this[lr]=0,this.listeners={},this.intervals={},this.commit=function(){return t.add("commit"),t},this[pu]=0,this.$promise=null,this.$resolve=null,this[Cl]=function(e){return t[qt]=!1,t.tick(e)}}touch(){return this[lr]++}get version(){return this[lr]}add(t,e=!1){return(e||this.queue.indexOf(t)==-1)&&this.queue.push(t),this[qt]||this[Ll](),this}get committingΦ(){return this.queue.indexOf("commit")>=0}get syncingΦ(){return this[Kt]==1}listen(t,e){let r=this.listeners[t],s=!r;return r||(r=this.listeners[t]=new Set),r.add(e),t=="raf"&&s&&this.add("raf"),this}unlisten(t,e){var r;let s=this.listeners[t];return s&&s.delete(e),t=="raf"&&s&&s.size==0&&(r=this.listeners.raf,delete this.listeners.raf),this}on(t,e){return this.listen(t,e)}un(t,e){return this.unlisten(t,e)}get promise(){var t=this;return this.$promise||(this.$promise=new Promise(function(e){return t.$resolve=e}))}tick(t){var e=this;let r=this.queue,s=this[Si]++;if(this.ts||(this.ts=t),this.dt=t-this.ts,this.ts=t,this.queue=[],this[Kt]=1,this[lr]++,r.length)for(let n=0,o=du(r),l=o.length;n<l;n++){let h=o[n];typeof h=="string"&&this.listeners[h]?this.listeners[h].forEach(function(u){if(xi(u.tick,Function))return u.tick(e,h);if(xi(u,Function))return u(e,h)}):xi(h,Function)?h(this.dt,this):h.tick&&h.tick(this.dt,this)}return this[Kt]=this[qt]?0:-1,this.$promise&&(this.$resolve(this),this.$promise=this.$resolve=null),this.listeners.raf&&this.add("raf"),this}[Ll](){return this[qt]||(this[qt]=!0,this[Kt]==-1&&(this[Kt]=0),mu(this[Cl])),this}schedule(t,e){var s,n;return e||(e=t[s=this.id]||(t[s]={value:!0})),(e[n=this.id]||(e[n]=new wi({owner:this,target:t}))).update(e,!0)}unschedule(t,e={}){e||(e=t[this.id]);let r=e&&e[this.id];return r&&r.active&&r.deactivate(),this}},_i=Li;(()=>{a(Li,yu,"Scheduler",16)})();var N=new _i;function F(){return N.add("commit").promise}function bu(i,t){return globalThis.setTimeout(function(){i(),F()},t)}function $u(i,t){return globalThis.setInterval(function(){i(),F()},t)}var vu=globalThis.clearInterval,xu=globalThis.clearTimeout,de=globalThis.imba||(globalThis.imba={});de.commit=F;de.setTimeout=bu;de.setInterval=$u;de.clearInterval=vu;de.clearTimeout=xu;var Nl={on:function(i,t){return j(this,i,t)},inited:function(i){return G(this,"inited",[i])}};function mm(){return!0}function Ml(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}function ym(i,t,e){if(e.get){let r=e.get;e.get=function(){let s=r.call(this);return Object.defineProperty(this,t,{enumerable:!1,value:s}),s}}return e}function bm(i,t,e){var r,s;if(Ml(e.value,Function)){let n=e.value;e.get=function(){if(this==i)return n;let o=n.bind(this);return Object.defineProperty(this,t,{enumerable:!1,value:o}),o},r=e.value,delete e.value,s=e.writable,delete e.writable}return e}var El=new WeakMap;function $m(i,t,e){let r=this[0]||{},s=e.value,n=Symbol(),o=new WeakMap,l=El.get(i),h=r.timeout||20*1e3,u=""+(i.constructor?.name||"")+"."+String(typeof t=="symbol"?t.description:t);if(l||El.set(i,l={}),l.key)throw new Error("@thenable "+u+" not allowed - @thenable "+l.key+" already defined");if(!Ml(s,Function))throw new Error("@thenable "+u+" only supports functions");if(s.length>0)throw new Error("@thenable "+u+" methods cannot be called with arguments");let f=function(g){return console.trace("@thenable "+u+" took more than "+h+"ms - make sure method does not return self.",g)},c=function(g){let d=o.get(g);return d||o.set(g,d={}),d},m=function(g,d){let p=this,$=c(p);return($.promise||($.promise=new Promise(function(M,he){let S=r.timeout!==!1?setTimeout(f,r.timeout||2e4,p):null,W=function(dt){return S&&clearTimeout(S),$.met=!0,$.error=dt,console.trace("@thenable "+u+" threw error",dt),he(dt)};return p[t]().then(function(){return S&&clearTimeout(S),$.met=!0,M(p)},W)}))).then(g,d)};return Object.defineProperty(i,"then",{enumerable:!1,configurable:!0,get:function(){return c(this).met?null:m}}),e.value=function(g){let d=c(this);return d.wrapped??(d.wrapped=Promise.resolve(s.call(this,d))),d.wrapped},e.value.reset=function(g){let d=c(g);o.delete(g)},e.value.check=c,e}import Hl from"cluster";import Q from"fs";import Yt from"path";import{EventEmitter as Tu}from"events";import Ol from"path";var Su=Symbol(),pe,Pl=new(pe=class{get rootDir(){return process.env.IMBA_OUTDIR||Ol.dirname(process.env.pm_exec_path||process.argv[1])}get publicPath(){return Ol.resolve(this.rootDir,process.env.IMBA_PUBDIR||globalThis.IMBA_PUBDIR||"public")}},(()=>{a(pe,Su,"Env",0)})(),pe);import Lu from"http";function U(i){let t;return i&&((t=i.toIterable)?t.call(i):i)}function Al(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}var Rl=Symbol.for("#setup"),Il=Symbol.for("#setup?"),wu=Symbol.for("#dom"),_u=Symbol.for("#server"),me={html:{"Content-Type":"text/html; charset=utf-8"},txt:{"Content-Type":"text/plain; charset=utf-8"},js:{"Content-Type":"text/javascript; charset=utf-8"},cjs:{"Content-Type":"text/javascript; charset=utf-8"},mjs:{"Content-Type":"text/javascript; charset=utf-8"},json:{"Content-Type":"application/json; charset=utf-8"},css:{"Content-Type":"text/css; charset=utf-8"},map:{"Content-Type":"application/json; charset=utf-8"},otf:{"Content-Type":"font/otf"},ttf:{"Content-Type":"font/ttf"},woff:{"Content-Type":"font/woff"},woff2:{"Content-Type":"font/woff2"},svg:{"Content-Type":"image/svg+xml"},avif:{"Content-Type":"image/avif"},gif:{"Content-Type":"image/gif"},png:{"Content-Type":"image/png"},apng:{"Content-Type":"image/apng"},webp:{"Content-Type":"image/webp"},jpg:{"Content-Type":"image/jpeg"},jpeg:{"Content-Type":"image/jpeg"},ico:{"Content-Type":"image/x-icon"},bmp:{"Content-Type":"image/bmp"},pdf:{"Content-Type":"application/pdf"},webm:{"Content-Type":"video/webm"},weba:{"Content-Type":"audio/webm"},avi:{"Content-Type":"video/x-msvideo"},mp3:{"Content-Type":"audio/mpeg"},mp4:{"Content-Type":"video/mp4"},m4a:{"Content-Type":"audio/m4a"},mov:{"Content-Type":"video/quicktime"},wmv:{"Content-Type":"video/x-ms-wmv"},mpeg:{"Content-Type":"video/mpeg"},wav:{"Content-Type":"audio/wav"},ogg:{"Content-Type":"audio/ogg"},ogv:{"Content-Type":"video/ogg"},oga:{"Content-Type":"audio/ogg"},opus:{"Content-Type":"audio/opus"}},kl={id:Date.now()},z=globalThis.process,Cu=Symbol(),Mi=class extends Set{call(t,...e){var r;r=[];for(let s of U(this))r.push(s[t](...e));return r}close(t={}){var e;e=[];for(let r of U(this))e.push(r.close(t));return e}reload(t={}){var e;e=[];for(let r of U(this))e.push(r.reload(t));return e}broadcast(t,...e){var r;r=[];for(let s of U(this))r.push(s.broadcast(t,...e));return r}emit(t,e){var r;r=[];for(let s of U(this))r.push(s.emit(t,e));return r}sseEnd(){let t=[];for(let e of U(this))for(let r of U(e.clients))t.push(new Promise(function(s){return r.on("finish",s),r.end()}));return Promise.all(t)}},Ci=Mi;(()=>{a(Mi,Cu,"Servers",0)})();var Ot=new Ci,Nu=Symbol(),ge,Fl=new(ge=class extends Tu{constructor(){var t;super(...arguments),t=this,this.autoreload=!1,this.state={},globalThis.IMBA_RUN&&(Hl.isWorker?z.on("message",function(e){if(t.emit("message",e),e[0]=="emit")return t.emit(...e.slice(1))}):z.on("message",function(e){if(e[0]=="emit")return t.emit(...e.slice(1))}))}[Rl](){var t=this;if(this[Il]!=!0&&(this[Il]=!0,!0))return this.on("rebuild",function(e){let r=globalThis.IMBA_MANIFEST;return globalThis.IMBA_MANIFEST=e,Ot.broadcast("rebuild",e)}),this.on("reloadHard",async function(e){return Ot.broadcast("reloadHard",e),await Ot.sseEnd(),z.exit(0)}),this.on("reloading",function(e){var r;t.state.reloading=!0,r=[];for(let s of U(Ot))r.push(s.pause());return r}),this.on("reloaded",async function(e){var r;t.state.reloaded=!0,Ot.broadcast("reloaded"),await new Promise(function(n){return setTimeout(n,100)}),r=[];for(let n of U(Ot))r.push(n.close());let s=r;return setTimeout(function(){return z.exit(0)},100),await Promise.all(s),z.exit(0)}),!0}send(t){if(Al(z.send,Function))return z.send(t)}on(t,e){return super.on(...arguments)}reload(){if(!(this.isReloading!=!0&&(this.isReloading=!0,!0)))return this;if(this.state.reloading=!0,!z.env.IMBA_SERVE){console.warn("not possible to gracefully reload servers not started via imba start");return}this.send("reload")}},(()=>{a(ge,Nu,"Process",24)})(),ge);function Vl(i,t=[],e=0){let r=globalThis.IMBA_MANIFEST[i];if(t.indexOf(i)>=0)return t;if(r?.imports)for(let s=0,n=U(r?.imports),o=n.length;s<o;s++){let l=n[s];t.push(l),Vl(l,t,e+1)}return t}var Eu=Symbol(),Oi=class{constructor(t,e,r={}){this.server=t,this.url=e,[this.pathname,this.query]=e.split("?"),this.ext=Yt.extname(this.pathname),this.headers={"Content-Type":"text/plain","Access-Control-Allow-Origin":"*","cache-control":"public, max-age=31536000"},Object.assign(this.headers,t.options.assetHeaders||{}),Object.assign(this.headers,me[this.ext.slice(1)]||{}),this.headers["max-age"]=864e5,r.imports&&t.options.preload!==!1&&(this.headers.Link=Vl(e).map(function(s){return"<"+s+">; rel=modulepreload; as=script"}).join(", ")),this.path=t.localPathForUrl(e)}respond(t,e){var r=this;return Q.access(this.path,Q.constants.R_OK,function(s){if(s)return e.writeHead(404,{}),e.end();try{if(r.server.options.setHeaders&&r.server.options.setHeaders(e,r.path),globalThis.BUN)return Q.readFile(r.path,function(n,o){return e.writeHead(200,r.headers),e.end(o)});{let n=Q.createReadStream(r.path);return e.writeHead(200,r.headers),n.pipe(e)}}catch{return e.writeHead(503,{}),e.end()}})}createReadStream(){return Q.createReadStream(this.path)}pipe(t){return this.createReadStream().pipe(t)}},Ni=Oi;(()=>{a(Oi,Eu,"AssetResponder",16)})();var Mu=Symbol(),Pi=class{static wrap(t,e={}){return new this(t,e)}localPathForUrl(t){var n;let e,r,s=t.replace(/\?.*$/,"");return(n=this.urlToLocalPathMap)[s]??(n[s]=(e=Yt.resolve(Pl.publicPath,"."+s),r=Q.existsSync(e)&&e,!r&&this.staticDir&&(e=Yt.resolve(this.staticDir,"."+s),r=Q.existsSync(e)&&e),r))}headersForAsset(t){let e,r=Yt.extname(t);return e=Object.assign({"Content-Type":"text/plain","Access-Control-Allow-Origin":"*","cache-control":"public"},me[r.slice(1)]||{})}get manifest(){return globalThis.IMBA_MANIFEST||{}}constructor(t,e={}){var r=this;Ot.add(this),this.id=Math.random(),this.startedAt=Date.now(),this.options=e,this.closed=!1,this.paused=!1,this.server=t,this.clients=new Set,this.stalledResponses=[],this.assetResponders={},this.urlToLocalPathMap={},this.publicExistsMap={},this.staticDir=globalThis.IMBA_STATICDIR||"",z.env.IMBA_PATH&&(this.devtoolsPath=Yt.resolve(z.env.IMBA_PATH,"hmr.js")),this.scheme=Al(t,Lu.Server)?"http":"https";let s=this.server._events.request,n=globalThis[wu];t.off("request",s),s[_u]=this,t.on("listening",function(){let o=r.server.address(),l=o.address;(l=="::"||l=="0.0.0.0")&&(l="localhost");let h=""+r.scheme+"://"+l+":"+o.port+"/";if(!z.env.IMBA_CLUSTER)return console.log("listening on "+h)}),globalThis.IMBA_HMR&&(globalThis.IMBA_HMR_PATH="/__hmr__.js"),this.handler=function(o,l){var d;let h,u=o.constructor.name=="Http2ServerRequest",f=o.url;if(r.paused||r.closed)return l.statusCode=302,l.setHeader("Location",o.url),u||l.setHeader("Connection","close"),r.closed?(u&&o.stream.session.close(),l.end()):r.stalledResponses.push(l);if(f=="/__imba__.mjs"){l.writeHead(200,me.mjs);let p=Yt.resolve(z.env.IMBA_PATH,"dist","imba.mjs");return Q.createReadStream(p).pipe(l)}if(globalThis.IMBA_HMR){if(f=="/__hmr__.json")return l.writeHead(200,me.json),l.end(JSON.stringify(kl));if(f=="/__hmr__.js"&&r.devtoolsPath){let p=Q.createReadStream(r.devtoolsPath);return l.writeHead(200,me.js),p.pipe(l)}if(f=="/__hmr__"){let p={"Content-Type":"text/event-stream","Cache-Control":"no-cache"};return u||(p.Connection="keep-alive"),l.writeHead(200,p),r.clients.add(l),r.broadcast("init",globalThis.IMBA_MANIFEST,[l]),r.broadcast("state",kl,[l]),o.on("close",function(){return r.clients.delete(l)}),!0}}let c=o.headers,m;u?m=c[":scheme"]+"://"+c[":authority"]:m=(o.connection.encrypted?"https":"http")+"://"+c.host;let g=r.manifest[f];if(g&&r.localPathForUrl(f))return((d=r.assetResponders)[f]||(d[f]=new Ni(r,f,g))).respond(o,l);if((f.match(/\.[A-Z\d]{8}\./)||f.match(/\.\w{1,4}($|\?)/))&&(h=r.localPathForUrl(f)))try{let p=r.headersForAsset(h);if(e.setHeaders&&e.setHeaders(l,h),globalThis.BUN)return Q.readFile(h,function($,_){return $?(l.writeHead(500,{}),l.write("Error getting the file: "+$)):(l.writeHead(200,p),l.end(_))});{let $=Q.createReadStream(h);return l.writeHead(200,p),$.pipe(l)}}catch{return l.writeHead(503,{}),l.end()}if(n){let p=new n.Location(o.url,m);return n.Document.create({location:p},function(){return s(o,l)})}else return s(o,l)},t.on("request",this.handler),t.on("close",function(){return console.log("server is closing!")}),globalThis.IMBA_RUN&&(Hl.isWorker||z.env.IMBA_WATCH)&&(Fl[Rl](),Fl.send("serve"))}broadcast(t,e={},r=this.clients){e=JSON.stringify(e);let s="data: "+e+`
`;for(let n of U(r))n.write("event: "+t+`
`),n.write(`id: imba
`),n.write(s);return this}pause(){return this.paused!=!0&&(this.paused=!0,!0)&&this.broadcast("paused"),this}resume(){if(this.paused!=!1&&(this.paused=!1,!0))return this.broadcast("resumed"),this.flushStalledResponses()}flushStalledResponses(){for(let t=0,e=U(this.stalledResponses),r=e.length;t<r;t++)e[t].end();return this.stalledResponses=[]}close(){var t=this;return this.pause(),new Promise(function(e){return t.closed=!0,t.server.close(e),t.flushStalledResponses()})}},Ei=Pi;(()=>{a(Pi,Mu,"Server",16)})();function Om(i,...t){return Ei.wrap(i,...t)}var Ii={};function Im(i,t,e){if(t!=null){let r=Ii[i]||(Ii[i]=new WeakMap);return r.get(t)||r.set(t,(e.memoized=i)&&e).get(t)}return e}function Ou(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}var ye=Symbol.for("#idler"),be=Symbol.for("#resolve"),Pu=Symbol(),ki=class extends Set{constructor(){super(),this[ye]=Promise.resolve(this)}emit(t,...e){return G(this,t,e)}on(t,...e){return j(this,t,...e)}once(t,...e){return O(this,t,...e)}un(t,...e){return Mt(this,t,...e)}add(t){var e=this;if(Ou(t,Function)&&(t=t()),!this.has(t)){let r=this.size==0;super.add(t),r&&(this[ye]=this[be]=null,this.emit("busy",this)),this.emit("add",t,this);let s=function(){return e.delete(t)};t.then(s,s)}return t}delete(t){return super.delete(t)?(this.emit("delete",t,this),this.size==0&&(this[be]&&(this[be](!0),this[be]=null),this.emit("idle",this)),!0):!1}get idle(){var t=this;return this[ye]||(this[ye]=new Promise(function(e){return t.size==0?e(!0):t[be]=e}))}get idleΦ(){return this.size==0}then(t,e){return this.idle.then(t,e)}},hr=ki;(()=>{a(ki,Pu,"Queue",24)})();function Iu(i,t){if(t?.debugΦ==!1)return;let e=[],r=[];for(let s=0,n=xl(i),o=n.length;s<o;s++){let l=n[s];if(s%2!=0)continue;let h=i[s+1];if(l==""){r.push("%s");let u="\x1B[40m\x1B[32m";e.push(""+u+h+"\x1B[0m")}else r.push("%s %O"),e.push("\x1B[44m\x1B[97m"+l+"\x1B[0m"),e.push(h)}return[r.join(" "),...e]}var ar=Symbol.for("#L");function Vm(){return globalThis[ar]||(globalThis[ar]=globalThis[ar]||Iu),!0}function ku(i){let t;return i&&((t=i.toIterable)?t.call(i):i)}var J={"":[-1,{id:1,slot:1,part:1,elementTiming:"elementtiming"}],HTML:[-1,{title:1,lang:1,translate:1,dir:1,accessKey:"accesskey",draggable:1,spellcheck:1,autocapitalize:1,inputMode:"inputmode",style:1,tabIndex:"tabindex",enterKeyHint:"enterkeyhint"}],HTMLAnchor:[1,{target:1,download:1,ping:1,rel:1,relList:"rel",hreflang:1,type:1,referrerPolicy:"referrerpolicy",coords:1,charset:1,name:1,rev:1,shape:1,href:1}],HTMLArea:[1,{alt:1,coords:1,download:1,shape:1,target:1,ping:1,rel:1,relList:"rel",referrerPolicy:"referrerpolicy",href:1}],HTMLMedia:[1,{src:1,crossOrigin:"crossorigin",preload:1,controlsList:"controlslist"}],HTMLAudio:[4,{}],HTMLBase:[1,{href:1,target:1}],HTMLQuote:[1,{cite:1}],HTMLBody:[1,{text:1,link:1,vLink:"vlink",aLink:"alink",bgColor:"bgcolor",background:1}],HTMLBR:[1,{clear:1}],HTMLButton:[1,{formAction:"formaction",formEnctype:"formenctype",formMethod:"formmethod",formTarget:"formtarget",name:1,type:1,value:1}],HTMLCanvas:[1,{width:1,height:1}],HTMLTableCaption:[1,{align:1}],HTMLTableCol:[1,{span:1,align:1,ch:"char",chOff:"charoff",vAlign:"valign",width:1}],HTMLData:[1,{value:1}],HTMLDataList:[1,{}],HTMLMod:[1,{cite:1,dateTime:"datetime"}],HTMLDetails:[1,{}],HTMLDialog:[1,{}],HTMLDiv:[1,{align:1}],HTMLDList:[1,{}],HTMLEmbed:[1,{src:1,type:1,width:1,height:1,align:1,name:1}],HTMLFieldSet:[1,{name:1}],HTMLForm:[1,{acceptCharset:"accept-charset",action:1,autocomplete:1,enctype:1,encoding:"enctype",method:1,name:1,target:1}],HTMLHeading:[1,{align:1}],HTMLHead:[1,{}],HTMLHR:[1,{align:1,color:1,size:1,width:1}],HTMLHtml:[1,{version:1}],HTMLIFrame:[1,{src:1,srcdoc:1,name:1,sandbox:1,width:1,height:1,referrerPolicy:"referrerpolicy",csp:1,allow:1,align:1,scrolling:1,frameBorder:"frameborder",longDesc:"longdesc",marginHeight:"marginheight",marginWidth:"marginwidth",loading:1}],HTMLImage:[1,{alt:1,src:1,srcset:1,sizes:1,crossOrigin:"crossorigin",useMap:"usemap",width:1,height:1,referrerPolicy:"referrerpolicy",decoding:1,name:1,lowsrc:1,align:1,hspace:1,vspace:1,longDesc:"longdesc",border:1,loading:1}],HTMLInput:[1,{accept:1,alt:1,autocomplete:1,dirName:"dirname",formAction:"formaction",formEnctype:"formenctype",formMethod:"formmethod",formTarget:"formtarget",height:1,max:1,maxLength:"maxlength",min:1,minLength:"minlength",name:1,pattern:1,placeholder:1,src:1,step:1,type:1,defaultValue:"value",value:1,width:1,align:1,useMap:"usemap",required:1}],HTMLLabel:[1,{htmlFor:"for"}],HTMLLegend:[1,{align:1}],HTMLLI:[1,{value:1,type:1}],HTMLLink:[1,{href:1,crossOrigin:"crossorigin",rel:1,relList:"rel",media:1,hreflang:1,type:1,as:1,referrerPolicy:"referrerpolicy",sizes:1,imageSrcset:"imagesrcset",imageSizes:"imagesizes",charset:1,rev:1,target:1,integrity:1}],HTMLMap:[1,{name:1}],HTMLMenu:[1,{}],HTMLMeta:[1,{name:1,httpEquiv:"http-equiv",content:1,scheme:1,property:1,charset:1}],HTMLMeter:[1,{value:1,min:1,max:1,low:1,high:1,optimum:1}],HTMLObject:[1,{data:1,type:1,name:1,useMap:"usemap",width:1,height:1,align:1,archive:1,code:1,hspace:1,standby:1,vspace:1,codeBase:"codebase",codeType:"codetype",border:1}],HTMLOList:[1,{start:1,type:1}],HTMLOptGroup:[1,{label:1}],HTMLOption:[1,{label:1,value:1}],HTMLOutput:[1,{htmlFor:"for",name:1}],HTMLParagraph:[1,{align:1}],HTMLParam:[1,{name:1,value:1,type:1,valueType:"valuetype"}],HTMLPicture:[1,{}],HTMLPre:[1,{width:1}],HTMLProgress:[1,{value:1,max:1}],HTMLScript:[1,{src:1,type:1,charset:1,crossOrigin:"crossorigin",referrerPolicy:"referrerpolicy",event:1,htmlFor:"for",integrity:1,defer:1,async:1}],HTMLSelect:[1,{autocomplete:1,name:1,size:1,value:1,required:1}],HTMLSlot:[1,{name:1}],HTMLSource:[1,{src:1,type:1,srcset:1,sizes:1,media:1}],HTMLSpan:[1,{}],HTMLStyle:[1,{media:1,type:1}],HTMLTable:[1,{align:1,border:1,frame:1,rules:1,summary:1,width:1,bgColor:"bgcolor",cellPadding:"cellpadding",cellSpacing:"cellspacing"}],HTMLTableSection:[1,{align:1,ch:"char",chOff:"charoff",vAlign:"valign"}],HTMLTableCell:[1,{colSpan:"colspan",rowSpan:"rowspan",headers:1,align:1,axis:1,height:1,width:1,ch:"char",chOff:"charoff",vAlign:"valign",bgColor:"bgcolor",abbr:1,scope:1}],HTMLTemplate:[1,{}],HTMLTextArea:[1,{autocomplete:1,cols:1,dirName:"dirname",maxLength:"maxlength",minLength:"minlength",name:1,placeholder:1,rows:1,wrap:1}],HTMLTime:[1,{dateTime:"datetime"}],HTMLTitle:[1,{}],HTMLTableRow:[1,{align:1,ch:"char",chOff:"charoff",vAlign:"valign",bgColor:"bgcolor"}],HTMLTrack:[1,{kind:1,src:1,srclang:1,label:1}],HTMLUList:[1,{type:1}],HTMLVideo:[4,{width:1,height:1,poster:1}],SVG:[-1,{}],SVGGraphics:[66,{transform:1}],SVGA:[67,{}],SVGAnimation:[66,{}],SVGAnimate:[69,{}],SVGAnimateMotion:[69,{}],SVGAnimateTransform:[69,{}],SVGGeometry:[67,{}],SVGCircle:[73,{cx:1,cy:1,r:1}],SVGClipPath:[67,{clipPathUnits:1}],SVGDefs:[67,{}],SVGDesc:[66,{}],SVGDiscard:[66,{}],SVGEllipse:[73,{cx:1,cy:1,rx:1,ry:1}],SVGFEBlend:[66,{mode:1,x:1,y:1,width:1,height:1}],SVGFEColorMatrix:[66,{type:1,values:1,x:1,y:1,width:1,height:1}],SVGFEComponentTransfer:[66,{x:1,y:1,width:1,height:1}],SVGFEComposite:[66,{operator:1,x:1,y:1,width:1,height:1}],SVGFEConvolveMatrix:[66,{orderX:1,orderY:1,kernelMatrix:1,divisor:1,edgeMode:1,x:1,y:1,width:1,height:1}],SVGFEDiffuseLighting:[66,{surfaceScale:1,diffuseConstant:1,x:1,y:1,width:1,height:1}],SVGFEDisplacementMap:[66,{xChannelSelector:1,yChannelSelector:1,x:1,y:1,width:1,height:1}],SVGFEDistantLight:[66,{}],SVGFEDropShadow:[66,{dx:1,dy:1,stdDeviationX:1,stdDeviationY:1,x:1,y:1,width:1,height:1}],SVGFEFlood:[66,{x:1,y:1,width:1,height:1}],SVGComponentTransferFunction:[66,{type:1,tableValues:1,slope:1,amplitude:1,exponent:1}],SVGFEFuncA:[90,{}],SVGFEFuncB:[90,{}],SVGFEFuncG:[90,{}],SVGFEFuncR:[90,{}],SVGFEGaussianBlur:[66,{x:1,y:1,width:1,height:1}],SVGFEImage:[66,{preserveAspectRatio:1,x:1,y:1,width:1,height:1}],SVGFEMerge:[66,{x:1,y:1,width:1,height:1}],SVGFEMergeNode:[66,{}],SVGFEMorphology:[66,{operator:1,x:1,y:1,width:1,height:1}],SVGFEOffset:[66,{x:1,y:1,width:1,height:1}],SVGFEPointLight:[66,{}],SVGFESpecularLighting:[66,{surfaceScale:1,specularConstant:1,specularExponent:1,x:1,y:1,width:1,height:1}],SVGFESpotLight:[66,{specularExponent:1}],SVGFETile:[66,{x:1,y:1,width:1,height:1}],SVGFETurbulence:[66,{numOctaves:1,stitchTiles:1,type:1,x:1,y:1,width:1,height:1}],SVGFilter:[66,{filterUnits:1,primitiveUnits:1,x:1,y:1,width:1,height:1}],SVGForeignObject:[67,{x:1,y:1,width:1,height:1}],SVGG:[67,{}],SVGImage:[67,{x:1,y:1,width:1,height:1,preserveAspectRatio:1}],SVGLine:[73,{x1:1,y1:1,x2:1,y2:1}],SVGGradient:[66,{gradientUnits:1,gradientTransform:1,spreadMethod:1}],SVGLinearGradient:[111,{x1:1,y1:1,x2:1,y2:1}],SVGMarker:[66,{refX:1,refY:1,markerUnits:1,markerWidth:1,markerHeight:1,orientType:1,orientAngle:1,viewBox:1,preserveAspectRatio:1}],SVGMask:[66,{maskUnits:1,maskContentUnits:1,x:1,y:1,width:1,height:1}],SVGMetadata:[66,{}],SVGMPath:[66,{}],SVGPath:[73,{}],SVGPattern:[66,{patternUnits:1,patternContentUnits:1,patternTransform:1,x:1,y:1,width:1,height:1,viewBox:1,preserveAspectRatio:1}],SVGPolygon:[73,{}],SVGPolyline:[73,{}],SVGRadialGradient:[111,{cx:1,cy:1,r:1,fx:1,fy:1,fr:1}],SVGRect:[73,{x:1,y:1,width:1,height:1,rx:1,ry:1}],SVGScript:[66,{}],SVGSet:[69,{}],SVGStop:[66,{}],SVGStyle:[66,{}],SVGSVG:[67,{x:1,y:1,width:1,height:1,viewBox:1,preserveAspectRatio:1}],SVGSwitch:[67,{}],SVGSymbol:[66,{viewBox:1,preserveAspectRatio:1}],SVGTextContent:[67,{textLength:1,lengthAdjust:1}],SVGTextPositioning:[130,{x:1,y:1,dx:1,dy:1,rotate:1}],SVGText:[131,{}],SVGTextPath:[130,{startOffset:1,method:1,spacing:1}],SVGTitle:[66,{}],SVGTSpan:[131,{}],SVGUse:[67,{x:1,y:1,width:1,height:1}],SVGView:[66,{viewBox:1,preserveAspectRatio:1}]},L={a:2,abbr:1,address:1,area:3,article:1,aside:1,audio:5,b:1,base:6,bdi:1,bdo:1,blockquote:7,body:8,br:9,button:10,canvas:11,caption:12,cite:1,code:1,col:13,colgroup:13,data:14,datalist:15,dd:1,del:16,details:17,dfn:1,dialog:18,div:19,dl:20,dt:1,em:1,embed:21,fieldset:22,figcaption:1,figure:1,footer:1,form:23,h1:24,h2:24,h3:24,h4:24,h5:24,h6:24,head:25,header:1,hgroup:1,hr:26,html:27,i:1,iframe:28,img:29,input:30,ins:16,kbd:1,label:31,legend:32,li:33,link:34,main:1,map:35,mark:1,menu:36,meta:37,meter:38,nav:1,noscript:1,object:39,ol:40,optgroup:41,option:42,output:43,p:44,param:45,picture:46,pre:47,progress:48,q:7,rp:1,rt:1,ruby:1,s:1,samp:1,script:49,section:1,select:50,slot:51,small:1,source:52,span:53,strike:1,strong:1,style:54,sub:1,summary:1,sup:1,table:55,tbody:56,td:57,template:58,textarea:59,tfoot:56,th:57,thead:56,time:60,title:61,tr:62,track:63,u:1,ul:64,var:1,video:65,wbr:1,svg_a:68,svg_animate:70,svg_animateMotion:71,svg_animateTransform:72,svg_audio:66,svg_canvas:66,svg_circle:74,svg_clipPath:75,svg_defs:76,svg_desc:77,svg_discard:78,svg_ellipse:79,svg_feBlend:80,svg_feColorMatrix:81,svg_feComponentTransfer:82,svg_feComposite:83,svg_feConvolveMatrix:84,svg_feDiffuseLighting:85,svg_feDisplacementMap:86,svg_feDistantLight:87,svg_feDropShadow:88,svg_feFlood:89,svg_feFuncA:91,svg_feFuncB:92,svg_feFuncG:93,svg_feFuncR:94,svg_feGaussianBlur:95,svg_feImage:96,svg_feMerge:97,svg_feMergeNode:98,svg_feMorphology:99,svg_feOffset:100,svg_fePointLight:101,svg_feSpecularLighting:102,svg_feSpotLight:103,svg_feTile:104,svg_feTurbulence:105,svg_filter:106,svg_foreignObject:107,svg_g:108,svg_iframe:66,svg_image:109,svg_line:110,svg_linearGradient:112,svg_marker:113,svg_mask:114,svg_metadata:115,svg_mpath:116,svg_path:117,svg_pattern:118,svg_polygon:119,svg_polyline:120,svg_radialGradient:121,svg_rect:122,svg_script:123,svg_set:124,svg_stop:125,svg_style:126,svg_svg:127,svg_switch:128,svg_symbol:129,svg_text:132,svg_textPath:133,svg_title:134,svg_tspan:135,svg_unknown:66,svg_use:136,svg_video:66,svg_view:137},Fi=Object.keys(J);for(let i=0,t=ku(Fi),e=t.length;i<e;i++){let r=t[i],s=J[r];s.name=r+"Element",s.up=J[Fi[s[0]]]}for(let i=0,t=Object.keys(L),e=t.length,r,s;i<e;i++)r=t[i],s=L[r],L[r]=J[Fi[s]],r.indexOf("svg_")==0&&(L[r.replace("_",":")]=L[r]);import{AsyncLocalStorage as Dl}from"async_hooks";var jl=Symbol.for("#toStringDeopt"),Gl=Symbol.for("#symbols"),zl=Symbol.for("#batches"),Bl=Symbol.for("#extras"),Ai=Symbol.for("#stacks"),Fu=Symbol(),Ri=class{constructor(t){this.dom=t,this.string=""}contains(t){return this.dom.classList.contains(t)}has(t){return this.dom.classList.contains(t)}add(t){return this.contains(t)?this:(this.string+=(this.string?" ":"")+t,this.dom.classList.add(t),this)}remove(t){if(!this.contains(t))return this;let e=new RegExp("(^|\\s)"+t+"(?=\\s|$)","g");return this.string=this.string.replace(e,""),this.dom.classList.remove(t),this}toggle(t,e){return e===void 0&&(e=!this.contains(t)),e?this.add(t):this.remove(t)}incr(t,e=0){var r=this;let s=this.stacks,n=s[t]||0;return n<1&&this.add(t),e>0&&setTimeout(function(){return r.decr(t)},e),s[t]=Math.max(n,0)+1}decr(t){let e=this.stacks,r=e[t]||0;return r==1&&this.remove(t),e[t]=Math.max(r,1)-1}reconcile(t,e){let r=this[Gl],s=this[zl],n=!0;if(!r)r=this[Gl]=[t],s=this[zl]=[e||""],this.toString=this.valueOf=this[jl];else{let o=r.indexOf(t),l=e||"";o==-1?(r.push(t),s.push(l)):s[o]!=l?s[o]=l:n=!1}n&&(this[Bl]=" "+s.join(" "),this.sync())}valueOf(){return this.string}toString(){return this.string}[jl](){return this.string+(this[Bl]||"")}sync(){return this.dom.flagSync$()}get stacks(){return this[Ai]||(this[Ai]={})}},Pt=Ri;(()=>{a(Ri,Fu,"Flags",16)})();var Ul=Symbol.for("#__init__"),Hi=Symbol.for("#getRenderContext"),Au=Symbol.for("#getDynamicContext"),P={context:null},Ru=Symbol(),Di=class{constructor(t=null){this[Ul](t)}[Ul](t=null,e=!0,r=!0){var s;this.stack=t&&(s=t.stack)!==void 0?s:[]}push(t){return this.stack.push(t)}pop(t){return this.stack.pop()}},Vi=Di;(()=>{a(Di,Ru,"Renderer",16)})();var $e=new Vi,Hu=Symbol(),ur=class extends Map{constructor(t,e=null){super(),this._=t,this.sym=e}pop(){return P.context=null}[Hi](t){let e=this.get(t);return e||this.set(t,e=new ur(this._,t)),P.context=e}[Au](t,e){return this[Hi](t)[Hi](e)}run(t){return this.value=t,P.context==this&&(P.context=null),this.get(t)}cache(t){return this.set(this.value,t),t}},pt=ur;(()=>{a(ur,Hu,"RenderContext",16)})();function cr(i,t=Symbol(),e=i){return P.context=i[t]||(i[t]=new pt(e,t))}function qm(){let i=P.context,t=i||new pt(null);return globalThis.DEBUG_IMBA&&!i&&$e.stack.length>0&&console.trace("detected unmemoized nodes in",$e.stack.slice(0),"see https://imba.io",t),i&&(P.context=null),t}function tt(i,t){return typeof t=="string"?typeof i===t:t[Symbol.hasInstance]?.(i)}function Te(i){let t;return i&&((t=i.toIterable)?t.call(i):i)}var Ji=Symbol.for("#parent"),rh=Symbol.for("#context"),Kl=Symbol.for("#closestNode"),Vu=Symbol.for("#parentNode"),It=Symbol.for("#__init__"),Du=Symbol.for("##inited"),ji=Symbol.for("#getRenderContext"),ju=Symbol.for("#getDynamicContext"),Gi=Symbol.for("#replaceChild"),Ce=Symbol.for("#appendChild"),ql=Symbol.for("#removeChild"),mt=Symbol.for("#insertInto"),Yl=Symbol.for("#insertChild"),ve=Symbol.for("#removeFrom"),Wl=Symbol.for("#removeFromDeopt"),Wt=Symbol.for("#replaceWith"),Xl=Symbol.for("#replaceWithDeopt"),zi=Symbol.for("#placeholderNode"),Gu=Symbol.for("#attachToParent"),zu=Symbol.for("#detachFromParent"),Bu=Symbol.for("#placeChild"),Uu=Symbol.for("#beforeReconcile"),Ku=Symbol.for("#afterReconcile"),qu=Symbol.for("#afterVisit"),Yu=Symbol.for("#visitContext"),Bi=Symbol.for("#document"),pr=Symbol.for("#htmlNodeName"),Ql=Symbol.for("#ImbaElement"),Ui=Symbol.for("#flags"),Xt=Symbol.for("#scripts"),fr=Symbol.for("#location"),Ki=Symbol.for("##document"),ih=Symbol.for("##parent"),Wu=Symbol.for("##up"),qi=Symbol.for("##context"),xe=Symbol.for("#domNode"),Se=Symbol.for("##placeholderNode"),Jl=Symbol.for("#domDeopt"),Xu=Symbol.for("#insertIntoDeopt"),Yi=Symbol.for("##classList"),we=Symbol.for("##style"),Wi=Symbol.for("##dataset"),ht=Symbol.for("#asset"),Xi=Symbol.for("#innerHTML"),_e=Symbol.for("##visitContext"),Qu=Symbol.for("#isRichElement"),Le=Symbol.for("#src"),Ju=Symbol.for("#getSlot"),Zu=Symbol.for("#cssns"),tc=Symbol.for("#cssid"),ec=Symbol.for("#dom"),rc={},mr=null,ic=Symbol(),as=class extends URL{},Ne=as;(()=>{a(as,ic,"Location",0)})();var sc=Symbol(),us=class{get document(){return this[Bi]||(this[Bi]=new this.Document(this))}get location(){return this.document.location}},Zl=us;(()=>{a(us,sc,"Window",0)})();function eg(){return globalThis.imba.uses_window=!0,!0}var nc={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Z=null,sh={},oc=Symbol(),cs=class{define(){return this}get(){return this}upgrade(){}whenDefined(){}},Zi=cs;(()=>{a(cs,oc,"CustomElementRegistry",0)})();var rg=new Zi,lc={};function gt(i,t){let e=i;if(typeof i=="string"&&(i=J[i]||L[i]||J[i+"Element"]||L["svg_"+i]),tt(i,I))return i;if(!i)return gt("HTML");if(i&&!i.klass){let r=Symbol(),n=class extends gt(i.up){},s=n;(()=>{a(n,r,"element",0)})(),i.klass=s}if(i&&!i.idl){i.idl=!0;let r=Object.getOwnPropertyDescriptors(i.klass.prototype);for(let s=i[1],n=0,o=Object.keys(s),l=o.length,h,u;n<l;n++){h=o[n],u=s[h];let f=u==1?h:u;r[f]||f=="style"||Object.defineProperty(i.klass.prototype,h,{set:function(c){this.setAttribute(f,c)},get:function(){return this.getAttribute(f)}})}}return i.klass}function ig(i,t,e){var n;let r=gt(i,t);if(!(r==e||tt(r.prototype,e)||r.prototype[pr])){let o=r.prototype[Ql];if(!o){let l=Symbol();o=(n=class extends r{constructor(){super(...arguments),this.__slots={},this.__F=0}},(()=>{a(n,l,"CustomBuiltInElement",16)})(),n),r.prototype[Ql]=o;let h=Object.getOwnPropertyDescriptors(e.prototype);Object.defineProperties(o.prototype,h),o.prototype[pr]=i}return o}return r}var dr=function(i){let t=typeof i=="string"?i:String(i);return t.indexOf('"')>=0&&(t=t.replace(/\"/g,""")),t},ts=function(i,t){let e=typeof i=="string"?i:String(i);return t=="script"||(e.indexOf('"')>=0&&(e=e.replace(/\"/g,""")),e.indexOf("<")>=0&&(e=e.replace(/\</g,"<")),e.indexOf(">")>=0&&(e=e.replace(/\>/g,">"))),e},hc=Symbol(),xr=class{static create(t,e){let r=new xr;return r[rh]=t,r.location=t.location,mr||(mr=new Dl),mr.run(r,e),r}constructor(){}get flags(){return this[Ui]||(this[Ui]=new Pt({classList:new gr(this)}))}get scripts(){return this[Xt]||(this[Xt]=[])}set location(t){typeof t=="string"&&(t=new Ne(t)),this[fr]=t}get location(){return this[fr]||(this[fr]=new Ne("http://localhost/"))}createElement(t){let e=gt(t),r=new e(t);return r.nodeName=t,r}createElementNS(t,e){if(t=="http://www.w3.org/2000/svg"){let r=gt("svg_"+e),s=new r;return s.nodeName=e,s}return this.createElement(e)}createTextNode(t){return new Qt(t)}createComment(t){return new bt(t)}createDocumentFragment(){return new yr}getElementById(t){return null}},yt=xr;(()=>{a(xr,hc,"Document",16)})();var at=new yt,th=at;function Re(){return mr&&mr?.getStore?.()||at}var ac=Symbol(),Sr=class{constructor(t,e){this.classes=e||[],this.dom=t}add(t){return this.classes.indexOf(t)<0&&this.classes.push(t),this}remove(t){let e=this.classes.indexOf(t);return e>=0&&(this.classes[e]=""),this}toggle(t){return this.contains(t)?this.remove(t):this.add(t),this}contains(t){return this.classes.indexOf(t)>=0}clone(t){return new Sr(t,this.classes.slice(0))}toString(){return this.classes.join(" ").trim()}},gr=Sr;(()=>{a(Sr,ac,"DOMTokenList",16)})();var uc=Symbol(),fs=class{constructor(){}removeProperty(t){var e;return e=this[t],delete this[t],e}setProperty(t,e){return this[t]=e}toString(){let t=[];for(let e=this,r=0,s=Object.keys(e),n=s.length,o,l;r<n;r++)o=s[r],l=e[o],tt(l,Function)||t.push(""+o+": "+l);return t.join(";")}},es=fs;(()=>{a(fs,uc,"StyleDeclaration",16)})();var cc=Symbol(),wr=class{static wrap(t){return new Proxy(t.attributes,new wr)}set(t,e,r){return t["data-"+e]=r,!0}get(t,e){return t["data-"+e]}},rs=wr;(()=>{a(wr,cc,"DataSet",0)})();var fc={get(i,t){let e=i,r;for(;e&&r==null;)(e=e[Ji])&&(r=e[t]);return r}},dc=Symbol(),ds=class{toString(){return this.outerHTML}get outerHTML(){return""}text$(t){return this.textContent=t,this}get ownerDocument(){return this[Ki]||(this[Ki]=Re())}get[Ji](){return this[ih]||this.parentNode||this[Wu]}get[rh](){return this[qi]||(this[qi]=new Proxy(this,fc))}get[Kl](){return this}get[Vu](){return this[Ji]?.[Kl]}[It](){return this}[Du](){return this}[ji](t){return cr(this,t)}[ju](t,e){return this[ji](t)[ji](e)}[Gi](t,e){let r=this[Yl](t,e);return this[ql](e),r}[Ce](t){return t[mt](this,null)}[ql](t){return t[ve](this)}[mt](t,e){return e?t.insertBefore(this,e):t.appendChild(this),this}[Yl](t,e){return t[mt](this,e)}[ve](t){return t.removeChild(this)}[Wl](t){return t.removeChild(this[xe]||this)}[Wt](t,e){return e[Gi](t,this)}[Xl](t,e){return e[Gi](t,this[xe]||this)}get[zi](){return this[Se]||(this[Se]=at.createComment("placeholder"))}set[zi](t){let e=this[Se];this[Se]=t,e&&e!=t&&e.parentNode&&e[Wt](t)}[Gu](){let t=this[xe],e=t&&t.parentNode;return t&&e&&t!=this&&(this[xe]=null,this[mt](e,t),t[ve](e)),this}[zu](){this[Jl]!=!0&&(this[Jl]=!0,!0)&&(this[Wt]=this[Xl],this[ve]=this[Wl],this[mt]=this[Xu]);let t=this[zi];return this.parentNode&&t!=this&&(t[mt](this.parentNode,this),this[ve](this.parentNode)),this[xe]=t,this}[Bu](t,e,r){let s=typeof t;if(s==="undefined"||t===null){if(r&&tt(r,bt))return r;let n=new bt("");return r?r[Wt](n,this):n[mt](this,null)}if(t===r)return t;if(s!=="object"){let n,o=t;return e&128&&e&256,r?tt(r,Qt)?(r.textContent=o,r):(n=th.createTextNode(o),r[Wt](n,this),n):(this.appendChild(n=th.createTextNode(o)),n)}else return r?r[Wt](t,this):t[mt](this,null)}},I=ds;(()=>{a(ds,dc,"Node",0)})();var pc=Symbol(),ps=class extends I{constructor(t){super(),this.textContent=t??""}get outerHTML(){return this.textContent}},Qt=ps;(()=>{a(ps,pc,"Text",16)})();var mc=Symbol(),ms=class extends I{constructor(t){super(),this.value=t}get outerHTML(){return"<!-- "+ts(this.value)+" -->"}toString(){return this.tag&&this.tag.toNodeString?this.tag.toNodeString():this.outerHTML}},bt=ms;(()=>{a(ms,mc,"Comment",16)})();var gc=Symbol(),kt=class extends I{constructor(t){super(),this.nodeName=t,this.childNodes=[],this.attributes={}}emit(t,e,r={bubbles:!0}){console.warn("Element#emit not supported on node")}get classList(){return this[Yi]||(this[Yi]=new gr(this))}get style(){return this[we]||(this[we]=new es)}get dataset(){return this[Wi]||(this[Wi]=rs.wrap(this))}get richValue(){return this.value}set richValue(t){this.value=t}set asset(t){this[ht]=t}get asset(){return this[ht]}flag$(){return this}flagIf$(){return this}appendChild(t){return this.childNodes.push(t),t.parentNode=this,t}removeChild(t){let e=this.childNodes.indexOf(t);return e>=0&&this.childNodes.splice(e,1),this}replaceChild(t,e){let r=this.childNodes.indexOf(e);return r>=0&&(this.childNodes.splice(r,1,t),t.parentNode=this),e}insertBefore(t,e){let r=this.childNodes.indexOf(e);return this.childNodes.splice(r,0,t),this}setAttribute(t,e){return this.attributes[t]=e,this}setAttributeNS(t,e,r){return this.setAttribute(t+":"+e,r)}getAttribute(t){return this.attributes?this.attributes[t]:void 0}getAttributeNS(t,e){return this.getAttribute(t+":"+e)}removeAttribute(t){var e;return e=this.attributes[t],delete this.attributes[t],!0}addEventListener(){return this}removeEventListener(){return this}resolve(){return this}set innerHTML(t){this[Xi]=t}get innerHTML(){let t="";if(this[Xi])return this[Xi];if(this.textContent!=null)return ts(this.textContent);for(let e=0,r=Te(this.childNodes),s=r.length;e<s;e++){let n=r[e];typeof n=="string"?t+=ts(n,this.nodeName):tt(n,Number)?t+=""+n:n&&(t+=n.outerHTML)}return t}get outerHTML(){let t=this.nodeName,e=this[pr],r=""+t;e&&(r=""+e+" is='"+t+"'",t=e);let s,n=this.classList.toString();this.dehydrate&&(n=n?"_ssr_ "+n:"_ssr_",this.dehydrate()),(s=this.id)&&(r+=' id="'+dr(s)+'"'),n&&(r+=' class="'+dr(n)+'"');for(let o=this.attributes,l=0,h=Object.keys(o),u=h.length,f,c;l<u;l++)f=h[l],c=o[f],r+=" "+f+'="'+dr(c)+'"';return this[we]&&(r+=' style="'+dr(this[we].toString())+'"'),nc[t]?"<"+r+">":"<"+r+">"+this.innerHTML+"</"+t+">"}get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes[this.childNodes.length-1]}get firstElementChild(){let t=this.childNodes.length,e=0;for(;e<t;){let r=this.childNodes[e++];if(tt(r,kt))return r}return null}get lastElementChild(){let t=this.childNodes.length;for(;t>0;){let e=this.childNodes[--t];if(tt(e,kt))return e}return null}get className(){return this.classList.toString()}set className(t){this.classList.classes=(t||"").split(" "),this.classList.toString()}log(...t){return console.log(...t)}text$(t){return this.textContent=t,this}[Uu](){return this}[Ku](){return this}[qu](){this.render&&this.render(),this[_e]&&(this[_e]=null)}get[Yu](){return this[_e]||(this[_e]={})}get flags(){return this.$flags||(this.$flags=new Pt(this),this.flag$==kt.prototype.flag$&&(this.flags$ext=this.className),this.flagDeopt$()),this.$flags}flag$(t){let e=this.flags$ns;this.className=e?e+(this.flags$ext=t):this.flags$ext=t}flagDeopt$(){var t=this;this.flag$=this.flagExt$,this.flagSelf$=function(e){return t.flagSync$(t.flags$own=e)}}flagExt$(t){return this.flagSync$(this.flags$ext=t)}flagSelf$(t){return this.flagDeopt$(),this.flagSelf$(t)}flagSync$(){return this.className=(this.flags$ns||"")+(this.flags$ext||"")+" "+(this.flags$own||"")+" "+(this.$flags||"")}set$(t,e){let r=bi(this,t,kt);!r||!r.set?this.setAttribute(t,e):this[t]=e}},y=kt;(()=>{a(kt,gc,"Element",16)})();y.prototype.setns$=y.prototype.setAttributeNS;y.prototype[Qu]=!0;var yc=Symbol(),gs=class extends y{constructor(){super(null)}get outerHTML(){return this.innerHTML}},yr=gs;(()=>{a(gs,yc,"DocumentFragment",16)})();var bc=Symbol(),ys=class extends yr{get outerHTML(){return this.innerHTML}},eh=ys;(()=>{a(ys,bc,"ShadowRoot",0)})();var $c=Symbol(),bs=class extends y{},A=bs;(()=>{a(bs,$c,"HTMLElement",0)})();var vc=Symbol(),$s=class extends A{constructor(){super(...arguments),super[It]||this[It]()}[It](t=null,e=!0,r=!0){e&&super[It]&&super[It](...arguments),this.hmr=t?t.hmr:void 0}get scripts(){return this[Xt]||(this[Xt]=[])}get outerHTML(){let t=Z;Z=this;let e=super.outerHTML,r=new Set,s=[],n=[];if(globalThis.IMBA_HMR_PATH&&this.hmr!==!1&&n.push("<script src='/__hmr__.js'><\/script>"),globalThis.__vite_manifest__)for(let o=0,l=Te(this.scripts),h=l.length;o<h;o++){let u=l[o];if(!!(this.src=globalThis.__vite_manifest__[u.src])){n.push('<script type="module" src="'+this.src.file+'"><\/script>');for(let f=0,c=Te(this.src.css),m=c.length;f<m;f++){let g=c[f];r.add({url:g})}}}else globalThis.__vite__&&n.push(`<link rel='stylesheet' id='imba-dev-ssr' href='.dev-ssr/all.css'>
<script>addEventListener('DOMContentLoaded', (event) => {
document.getElementById("imba-dev-ssr").remove()
});<\/script>`);if(!this.styles){for(let o=0,l=Te(this.scripts),h=l.length;o<h;o++){let f=l[o].src,c=rc[f];c&&c.css&&r.add(c.css)}for(let o of Te(r))n.push("<link rel='stylesheet' href='"+o.url+"'>")}if(Z=t,n.length){let o=e.indexOf("</head>");o==-1&&(o=e.indexOf("<body>")),o==-1&&(o=0),e=e.slice(0,o)+`
`+n.join(`
`)+`
`+e.slice(o)}return"<!DOCTYPE html>"+e}},is=$s;(()=>{a($s,vc,"HTMLHtmlElement",24)})();var xc=Symbol(),vs=class extends A{},Ee=vs;(()=>{a(vs,xc,"HTMLSelectElement",0)})();var Sc=Symbol(),xs=class extends A{},Me=xs;(()=>{a(xs,Sc,"HTMLInputElement",0)})();var wc=Symbol(),Ss=class extends A{},Oe=Ss;(()=>{a(Ss,wc,"HTMLTextAreaElement",0)})();var _c=Symbol(),ws=class extends A{},Pe=ws;(()=>{a(ws,_c,"HTMLButtonElement",0)})();var Tc=Symbol(),_s=class extends A{},Ie=_s;(()=>{a(_s,Tc,"HTMLOptionElement",0)})();var Lc=Symbol(),Ts=class extends A{get outerHTML(){return Z&&((Z.scripts||(Z.scripts=[])).push(this),globalThis.__vite_manifest__&&globalThis.__vite_manifest__[this.src])?"":(this[ht]&&(this[ht].js?(this.setAttribute("src",this[ht].js.url),this.setAttribute("type","module")):console.warn("could not find browser entrypoint for "+this[ht].path)),super.outerHTML)}},ss=Ts;(()=>{a(Ts,Lc,"HTMLScriptElement",8)})();var Cc=Symbol(),Ls=class extends A{get outerHTML(){if(this[ht]){let t=this.getAttribute("rel"),e;t=="stylesheet"&&((e=this[ht].css.url)||console.warn("could not find stylesheet for "+this[ht].path)),e&&this.setAttribute("href",e)}return super.outerHTML}},ns=Ls;(()=>{a(Ls,Cc,"HTMLLinkElement",8)})();var Nc=Symbol(),Cs=class extends A{set src(t){this[Le]!=t&&(this[Le]=t)}get src(){return this[Le]}get outerHTML(){if(Z&&this.src&&(Z.styles||(Z.styles=[])).push(this),this.src){this.nodeName="link",this.setAttribute("rel","stylesheet"),this.setAttribute("href",String(this.src));let t=super.outerHTML;return this.nodeName="style",t}return super.outerHTML}},os=Cs;(()=>{a(Cs,Nc,"HTMLStyleElement",8)})();var Ec=Symbol(),Ns=class{},R=Ns;(()=>{a(Ns,Ec,"Event",0)})();var Mc=Symbol(),Es=class extends R{},ke=Es;(()=>{a(Es,Mc,"UIEvent",0)})();var Oc=Symbol(),Ms=class extends ke{},br=Ms;(()=>{a(Ms,Oc,"FocusEvent",0)})();var Pc=Symbol(),Os=class extends ke{},Fe=Os;(()=>{a(Os,Pc,"MouseEvent",0)})();var Ic=Symbol(),Ps=class extends Fe{},$r=Ps;(()=>{a(Ps,Ic,"PointerEvent",0)})();var kc=Symbol(),Is=class extends ke{},vr=Is;(()=>{a(Is,kc,"KeyboardEvent",0)})();var Fc=Symbol(),ks=class extends R{},C=ks;(()=>{a(ks,Fc,"CustomEvent",0)})();var Qi={};function nh(i,t,e){if(!i)return e[t]=null;if(e[t]!==void 0)return e[t];let r=Object.getOwnPropertyDescriptor(i,t);return r!==void 0||i==Ae?e[t]=r||null:nh(Reflect.getPrototypeOf(i),t,e)}var Ac=Symbol(),Fs=class extends y{set$(t,e){var n;let r=Qi[n=this.nodeName]||(Qi[n]={}),s=nh(this,t,r);!s||!s.set?this.setAttribute(t,e):this[t]=e}}