You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
130 KiB
19 lines
130 KiB
2 years ago
|
var sh=Object.create;var Xs=Object.defineProperty;var nh=Object.getOwnPropertyDescriptor;var oh=Object.getOwnPropertyNames;var lh=Object.getPrototypeOf,hh=Object.prototype.hasOwnProperty;var ah=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var uh=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of oh(t))!hh.call(i,s)&&s!==e&&Xs(i,s,{get:()=>t[s],enumerable:!(r=nh(t,s))||r.enumerable});return i};var ch=(i,t,e)=>(e=i!=null?sh(lh(i)):{},uh(t||!i||!i.__esModule?Xs(e,"default",{value:i,enumerable:!0}):e,i));var vl=ah((Zf,us)=>{"use strict";var zt=typeof Reflect=="object"?Reflect:null,cl=zt&&typeof zt.apply=="function"?zt.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)},xr;zt&&typeof zt.ownKeys=="function"?xr=zt.ownKeys:Object.getOwnPropertySymbols?xr=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:xr=function(t){return Object.getOwnPropertyNames(t)};function lu(i){console&&console.warn&&console.warn(i)}var dl=Number.isNaN||function(t){return t!==t};function g(){g.init.call(this)}us.exports=g;us.exports.once=cu;g.EventEmitter=g;g.prototype._events=void 0;g.prototype._eventsCount=0;g.prototype._maxListeners=void 0;var fl=10;function Sr(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(g,"defaultMaxListeners",{enumerable:!0,get:function(){return fl},set:function(i){if(typeof i!="number"||i<0||dl(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");fl=i}});g.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};g.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||dl(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function pl(i){return i._maxListeners===void 0?g.defaultMaxListeners:i._maxListeners}g.prototype.getMaxListeners=function(){return pl(this)};g.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var s=t==="error",n=this._events;if(n!==void 0)s=s&&n.error===void 0;else if(!s)return!1;if(s){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var h=n[t];if(h===void 0)return!1;if(typeof h=="function")cl(h,this,e);else for(var a=h.length,c=_l(h,a),r=0;r<a;++r)cl(c[r],this,e);return!0};function ml(i,t,e,r){var s,n,o;if(Sr(e),n=i._events,n===void 0?(n=i._events=Object.create(null),i._eventsCount=0):(n.newListener!==void 0&&(i.emit("newListener",t,e.listener?e.listener:e),n=i._events),o=n[t]),o===void 0)o=n[t]=e,++i._eventsCount;else if(typeof o=="function"?o=n[t]=r?[e,o]:[o,e]:r?o.unshift(e):o.push(e),s=pl(i),s>0&&o.length>s&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=i,l.type=t,l.count=o.length,lu(l)}return i}g.prototype.addListener=function(t,e){return ml(this,t,e,!1)};g.prototype.on=g.prototype.addListener;g.prototype.prependListener=function(t,e){return ml(this,t,e,!0)};function hu(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function gl(i,t,e){var r={fired:!1,wrapFn:void 0,target:i,type:t,listener:e},s=hu.bind(r);return s.listener=e,r.wrapFn=s,s}g.prototype.once=function(t,e){return Sr(e),this.on(t,gl(this,t,e)),this};g.prototype.prependOnceListener=function(t,e){return Sr(e),this.prependListener(t,gl(this,t,e)),this};g.prototype.removeListener=function(t,e){var r,s,n,o,l;if(Sr(e),s=this._events,s===void 0)return this;if(r=s[t],r===void 0)return this;if(r===e||r.listener===e)--this
|
||
|
|
||
|
|
||
|
`;for(let n of Z(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=Z(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()})}};function Ku(i,...t){return qr.wrap(i,...t)}import dn from"path";var Xu=new class{get rootDir(){return process.env.IMBA_OUTDIR||dn.dirname(process.env.pm_exec_path||process.argv[1])}get publicPath(){return dn.resolve(this.rootDir,process.env.IMBA_PUBDIR||globalThis.IMBA_PUBDIR||"public")}};function Th(i){let t;return i?(t=i.toIterable)?t.call(i):i:[]}var W={"":[-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
|
||
|
`+n.join(`
|
||
|
`)+`
|
||
|
`+e.slice(o)}return"<!DOCTYPE html>"+e}};Ye[w]();var he=class extends P{},ae=class extends P{},ue=class extends P{},ce=class extends P{},fe=class extends P{},oi=class extends P{get outerHTML(){return ot&&(ot.scripts||(ot.scripts=[])).push(this),this[nt]&&(this[nt].js?(this.setAttribute("src",this[nt].js.url),this.setAttribute("type","module")):console.warn("could not find browser entrypoint for "+this[nt].path)),super.outerHTML}},li=class extends P{get outerHTML(){if(this[nt]){let t=this.getAttribute("rel"),e;t=="stylesheet"&&((e=this[nt].css.url)||console.warn("could not find stylesheet for "+this[nt].path)),e&&this.setAttribute("href",e)}return super.outerHTML}},hi=class extends P{set src(t){this[re]!=t&&(this[re]=t)}get src(){return this[re]}get outerHTML(){if(ot&&this.src&&(ot.styles||(ot.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}},k=class{},We=class extends k{},de=class extends We{},Xe=class extends de{},Qe=class extends We{},E=class extends k{},qn={};function Xn(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==pe?e[t]=r||null:Xn(Reflect.getPrototypeOf(i),t,e)}var pe=class extends d{set$(t,e){var r;let s=qn[r=this.nodeName]||(qn[r]={}),n=Xn(this,t,s);!n||!n.set?this.setAttribute(t,e):this[t]=e}},ai=class extends pe{set src(t){if(this[re]!=t&&(this[re]=t,!0)){if(t&&t.adoptNode)t.adoptNode(this);else if(t&&t.type=="svg"){if(t.attributes)for(let e=t.attributes,r=0,s=Object.keys(e),n=s.length,o,l;r<n;r++)o=s[r],l=e[o],this.setAttribute(o,l);this.innerHTML=t.content}}}};W[""].klass=d;W.HTML.klass=P;W.SVG.klass=pe;T.html.klass=Ye;T.select.klass=he;T.input.klass=ae;T.textarea.klass=ue;T.button.klass=ce;T.option.klass=fe;T.script.klass=oi;T.style.klass=hi;T.link.klass=li;T.svg_svg.klass=ai;pt("");pt("HTML");pt("SVG");function pc(i,t,e,r){let s=ht.createElement(i);return e&&(s.className=e),r!==null&&s.text$(r),t&&t[se]&&t[se](s),s}function mc(i,t,e,r,s){let n=ht.createElementNS("http://www.w3.org/2000/svg",i);return e&&(n.className=e),t&&t[se]&&t[se](n),r&&(n.textContent=r),n}function mt(i){return ht.createComment(i)}function ui(i){return ht.createTextNode(i)}function gc(){return ht.createDocumentFragment()}function Kh(i,t,e,r,s){let n;return typeof i!="string"&&(i.prototype instanceof P?(n=new i,n.nodeName=i.nodeName):i&&i.nodeName&&(i=i.nodeName)),n||(n=ht.createElement(Wn[i]||i)),n[Yn]=t,n[w](),r!==null&&n[Hh]("__").text$(r),(e||n.flags$ns)&&n.flag$(e||""),n}function yc(i,t,e,r){if(i==null||i==null)return mt("");if(i instanceof L)return i;if(typeof i=="string"||i&&i.prototype instanceof L)return Kh(i,t,e,r)}function bc(i,t,e={}){W[i]=Uh[i]={idl:!0,name:i,klass:t};let r=t.nodeName=i,s=t.prototype;if(i.indexOf("-")==-1&&(r=t.nodeName=""+i+"-tag",Wn[i]=r),e.extends&&(s[qe]=e.extends),e.cssns){let n=(s._ns_||"")+" "+e.cssns;s._ns_=n.trim()+" ",s[jh]=e.cssns}if(e.cssid){let n=(s.flags$ns||"")+" "+e.cssid;s[Gh]=e.cssid,s.flags$ns=n.trim()+" "}return t}globalThis[$h]={Location:ne,Document:et};function ci(i){let t;return i?(t=i.toIterable)?t.call(i):i:[]}function Yh(i,t){let e=Object.getOwnPropertyDescriptors(t);return delete e.constructor,Object.defineProperties(i,e),i}var er=Symbol.for("#parent"),Qn=Symbol.for("#closestNode"),Wh=Symbol.for("#isRichElement"),Xh=Symbol.for("#afterVisit"),Jn=Symbol.for("#__initor__"),Zn=Symbol.for("#__inited__"),to=Symbol.for("#appendChild"),eo=Symbol.for("#removeChild"),ro=Symbol.for("#replaceChild"),at=Symbol.for("#insertInto"),Je=Symbol.for("#replaceWith"),io=Symbol.for("#insertChild"),Ze=Symbol.for("#removeFrom"),so=Symbol.for("#placeChild"),ao=Symbol.for("#__init__"),Qh=Symbol.for("#registerFunctionalSlot"),Jh=Symbol.for("#getFunctionalSlot"),no=Symbol.for("#getSlot"),di=Symbol.for("##parent"),gt=Symbol.for("##up"),oo=Symbol.for("##flags"),Zh=Symbol.for("#domFlags"),U=Symbol.for("#end"),lo=Symbol.for("#textContent"),tr=Symbol.for("#textNode"),fi=Symbol
|
||
|
box-sizing: border-box;
|
||
|
border-width: 0;
|
||
|
border-style: solid;
|
||
|
border-color: currentColor;
|
||
|
}`,bi=class{constructor(t=null){this[Oo](t)}[Oo](t=null){var e;this.entries=t&&(e=t.entries)!==void 0?e:{}}register(t,e){let r=this.entries[t];r?r&&(r.css=e,r.node&&(r.node.textContent=e)):(r=this.entries[t]={sourceId:t,css:e},this.entries.resets||this.register("resets",_a))}toString(){return Object.values(this.entries).map(function(t){return t.css}).join(`
|
||
|
|
||
|
`)}toValue(t,e,r,s=null){let n;Mo[r]&&(t=String(t));let o=typeof t;if(o=="number"){if(e||(ya.test(r)?e="px":ba.test(r)?e="u":r=="rotate"&&(e="turn",t=(t%1).toFixed(4))),e)return ma[e]?t+e:e=="u"?t*4+"px":"calc(var(--u_"+e+",1px) * "+t+")"}else if(o=="string"){if(r&&Mo[r]&&t[0]!='"'&&t[0]!="'"&&(t.indexOf('"')>=0?t.indexOf("'")==-1&&(t="'"+t+"'"):t='"'+t+'"'),n=t.match(ga)){let h=vi[n[1]][parseInt(n[2])],a="100%";if(typeof s=="number"?a=s+"%":typeof s=="string"&&(a=s),h)return"hsla("+h[0]+","+h[1]+"%,"+h[2]+"%,"+a+")"}}else if(t&&t.toStyleString instanceof Function)return t.toStyleString();return t}parseDimension(t){if(typeof t=="string"){let[e,r,s]=t.match(/^([-+]?[\d\.]+)(%|\w+)$/);return[parseFloat(r),s]}else if(typeof t=="number")return[t]}},va=new bi,zc=Object.keys(vi);function Uc(){return!0}var _i=class{css$(t,e,r){return this.style[t]=e}css$var(t,e,r,s,n=null){let o=va.toValue(e,r,s,n);this.style.setProperty(t,o)}};pa(d.prototype,_i.prototype);var xa=Symbol.for("#insertInto"),Po=Symbol.for("#removeFrom");function Wc(i,t={}){let e=C.context;C.context=t;let r=i(t);return C.context==t&&(C.context=e),r}function Sa(i,t){return console.error(`imba.mount not supported on server.
|
||
|
To spawn a dev-server for an imba client run:
|
||
|
> imba serve my-imba-file.imba`),String(i);let e=t||globalThis.document.body,r=i;if(i instanceof Function){let s=new X(e,null),n=function(){let o=C.context;C.context=s;let l=i(s);return C.context==s&&(C.context=o),l};r=n(),A.listen("commit",n)}else r.__F|=64;return r[xa](e),r}function wa(i){return i&&i[Po]&&i[Po](i.parentNode),i}var ko=globalThis.imba||(globalThis.imba={});ko.mount=Sa;ko.unmount=wa;function $t(i,t){let e=Object.getOwnPropertyDescriptors(t);return delete e.constructor,Object.defineProperties(i,e),i}function ye(i){let t;return i?(t=i.toIterable)?t.call(i):i:[]}var be=Symbol.for("##onchange"),ve=Symbol.for("#afterVisit"),_e=Symbol.for("##oninput"),ur=Symbol.for("##onclick"),xe=Symbol.for("##bound"),vt=Symbol.for("##visitContext");function Zc(){return!0}var Ta={INPUT:!0,SELECT:!0,TEXTAREA:!0,BUTTON:!0},xi=function(i){return i instanceof Array||i&&i.has instanceof Function},Oi=function(i,t){return i==t?!0:i instanceof Array?i.indexOf(t)>=0:i&&i.has instanceof Function?i.has(t):i&&i.contains instanceof Function?i.contains(t):!1},Mi=function(i,t){if(i instanceof Array)return i.push(t);if(i&&i.add instanceof Function)return i.add(t)},Pi=function(i,t){if(i instanceof Array){let e=i.indexOf(t);if(e>=0)return i.splice(e,1)}else if(i&&i.delete instanceof Function)return i.delete(t)};function La(i){function t(){return i[0]?i[0][i[1]]:void 0}function e(r){return i[0]?i[0][i[1]]=r:null}return{get:t,set:e}}var Si=class{getRichValue(){return this.value}setRichValue(t){return this.value=t}bind$(t,e){let r=e||[];return t=="data"&&!this[xe]&&Ta[this.nodeName]&&(this[xe]=!0,this[be]&&this.addEventListener("change",this[be]=this[be].bind(this)),this[_e]&&this.addEventListener("input",this[_e]=this[_e].bind(this),{capture:!0}),this[ur]&&this.addEventListener("click",this[ur]=this[ur].bind(this),{capture:!0})),Object.defineProperty(this,t,r instanceof Array?La(r):r),r}};$t(d.prototype,Si.prototype);Object.defineProperty(d.prototype,"richValue",{get:function(){return this.getRichValue()},set:function(i){return this.setRichValue(i)}});var wi=class{[be](t){let e=this.data,r=this.$$value;this.$$value=void 0;let s=this.getRichValue();if(this.multiple){if(r)for(let n=0,o=ye(r),l=o.length;n<l;n++){let h=o[n];s.indexOf(h)==-1&&Pi(e,h)}for(let n=0,o=ye(s),l=o.length;n<l;n++){let h=o[n];(!r||r.indexOf(h)==-1)&&Mi(e,h)}}else this.data=s[0];return M(),this}getRichValue(){var t;if(this.$$value)return this.$$value;t=[];for(let e=0,r=ye(this.selectedOptions),s=r.length;e<s;e++){let n=r[e];t.push(n.richValue)}return this.$$value=t}syncValue(){let t=this.data;if(this.multiple){let e=[];for(let r=0,s=ye(this.options),n=s.length;r<n;r++){let o=s[r],l=o.richValue,h=Oi(t,l);o.selected=h,h&&e.push(l)}this.$$value=e}else for(let e=0,r=ye(this.options),s=r.length;e<s;e++){let o=r[e].richValue;if(o==t){this.$$value=[o],this.selectedIndex=e;break}}}[ve](){if(this.syncValue(),this[vt])return this[vt]=null}};$t(he.prototype,wi.prototype);var Ti=class{setRichValue(t){return this.$$value=t,this.value=t}getRichValue(){return this.$$value!==void 0?this.$$value:this.value}};$t(fe.prototype,Ti.prototype);var Li=class{setRichValue(t){return this.$$value=t,this.value=t}getRichValue(){return this.$$value!==void 0?this.$$value:this.value}[_e](t){return this.data=this.value,M()}[ve](){let t=this.data;if(t==null&&(t=""),this[xe]&&this.value!=t&&(this.value=t),this[vt])return this[vt]=null}};$t(ue.prototype,Li.prototype);var Ni=class{[_e](t){let e=this.type;if(!(e=="checkbox"||e=="radio")&&!(e=="number"&&Number.isNaN(this.valueAsNumber)))return this.$$value=void 0,this.data=this.richValue,M()}[be](t){let e=this.data,r=this.richValue;if(this.type=="checkbox"||this.type=="radio"){let s=this.checked;xi(e)?s?Mi(e,r):Pi(e,r):this.data=s?r:!1}return M()}setRichValue(t){this.$$value!==t&&(this.$$value=t,this.value!==t&&(this.value=t))}getRichValue(){if(this.$$value!==void 0)return this.$$value;let t=this.value,e=this.type;if(e=="range"||e=="number"){let r=this.valueAsNumber;Number.isNaN(r)&&(r=Number(t.replace(/\,/,".")+0)),Number.isNaN(r)&&(r=null),t=r}else e=="checkbox"
|