UNPKG

vditor

Version:

♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生

10 lines (8 loc) 4 MB
"use strict"; (function() { var $goVersion = "go1.19.13"; var z=Object.defineProperty;var f=(r,e)=>z(r,"name",{value:e,configurable:!0});Error.stackTraceLimit=1/0;var $NaN=NaN,$global,$module;if(typeof window!="undefined"?$global=window:typeof self!="undefined"?$global=self:typeof global!="undefined"?($global=global,$global.require=require):$global=this,$global===void 0||$global.Array===void 0)throw new Error("no global object found");if(typeof module!="undefined"&&($module=module),!$global.fs&&$global.require)try{var fs=$global.require("fs");typeof fs=="object"&&fs!==null&&Object.keys(fs).length!==0&&($global.fs=fs)}catch(r){}if(!$global.fs){var outputBuf="",decoder=new TextDecoder("utf-8");$global.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync:f(function(e,n){outputBuf+=decoder.decode(n);var t=outputBuf.lastIndexOf(` `);return t!=-1&&(console.log(outputBuf.substr(0,t)),outputBuf=outputBuf.substr(t+1)),n.length},"writeSync"),write:f(function(e,n,t,i,u,l){if(t!==0||i!==n.length||u!==null){l(enosys());return}var a=this.writeSync(e,n);l(null,a)},"write")}}var $linknames={},$packages={},$idCounter=0,$keys=f(r=>r?Object.keys(r):[],"$keys"),$flushConsole=f(()=>{},"$flushConsole"),$throwRuntimeError,$throwNilPointerError=f(()=>{$throwRuntimeError("invalid memory address or nil pointer dereference")},"$throwNilPointerError"),$call=f((r,e,n)=>r.apply(e,n),"$call"),$makeFunc=f(r=>function(...e){return $externalize(r(this,new($sliceType($jsObjectPtr))($global.Array.prototype.slice.call(e,[]))),$emptyInterface)},"$makeFunc"),$unused=f(r=>{},"$unused"),$print=console.log;if($global.process!==void 0&&$global.require)try{var util=$global.require("util");$print=f(function(...r){$global.process.stderr.write(util.format.apply(this,r))},"$print")}catch(r){}var $println=console.log,$initAllLinknames=f(()=>{for(var r=$keys($packages),e=0;e<r.length;e++){var n=$packages[r[e]].$initLinknames;typeof n=="function"&&n()}},"$initAllLinknames"),$mapArray=f((r,e)=>{for(var n=new r.constructor(r.length),t=0;t<r.length;t++)n[t]=e(r[t]);return n},"$mapArray"),$mapIndex=f((r,e)=>typeof r.get=="function"?r.get(e):void 0,"$mapIndex"),$mapDelete=f((r,e)=>{typeof r.delete=="function"&&r.delete(e)},"$mapDelete"),$methodVal=f((r,e)=>{var n=r.$methodVals||{};r.$methodVals=n;var t=n[e];if(t!==void 0)return t;var i=r[e];return t=i.bind(r),n[e]=t,t},"$methodVal"),$methodExpr=f((r,e)=>{var n=r.prototype[e];return n.$expr===void 0&&(n.$expr=(...t)=>{$stackDepthOffset--;try{return r.wrapped&&(t[0]=new r(t[0])),Function.call.apply(n,t)}finally{$stackDepthOffset++}}),n.$expr},"$methodExpr"),$ifaceMethodExprs={},$ifaceMethodExpr=f(r=>{var e=$ifaceMethodExprs["$"+r];return e===void 0&&(e=$ifaceMethodExprs["$"+r]=(...n)=>{$stackDepthOffset--;try{return Function.call.apply(n[0][r],n)}finally{$stackDepthOffset++}}),e},"$ifaceMethodExpr"),$subslice=f((r,e,n,t)=>{if(n===void 0&&(n=r.$length),t===void 0&&(t=r.$capacity),(e<0||n<e||t<n||n>r.$capacity||t>r.$capacity)&&$throwRuntimeError("slice bounds out of range"),r===r.constructor.nil)return r;var i=new r.constructor(r.$array);return i.$offset=r.$offset+e,i.$length=n-e,i.$capacity=t-e,i},"$subslice"),$substring=f((r,e,n)=>((e<0||n<e||n>r.length)&&$throwRuntimeError("slice bounds out of range"),r.substring(e,n)),"$substring"),$sliceToNativeArray=f(r=>r.$array.constructor!==Array?r.$array.subarray(r.$offset,r.$offset+r.$length):r.$array.slice(r.$offset,r.$offset+r.$length),"$sliceToNativeArray"),$sliceToGoArray=f((r,e)=>{var n=e.elem;if(n!==void 0&&r.$length<n.len&&$throwRuntimeError("cannot convert slice with length "+r.$length+" to pointer to array with length "+n.len),r==r.constructor.nil)return e.nil;if(r.$array.constructor!==Array)return r.$array.subarray(r.$offset,r.$offset+n.len);if(r.$offset==0&&r.$length==r.$capacity&&r.$length==n.len)return r.$array;if(n.len==0)return new n([]);$throwRuntimeError("gopherjs: non-numeric slice to underlying array conversion is not supported for subslices")},"$sliceToGoArray"),$convertSliceType=f((r,e)=>r==r.constructor.nil?e.nil:$subslice(new e(r.$array),r.$offset,r.$offset+r.$length),"$convertSliceType"),$decodeRune=f((r,e)=>{var n=r.charCodeAt(e);if(n<128)return[n,1];if(n!==n||n<192)return[65533,1];var t=r.charCodeAt(e+1);if(t!==t||t<128||192<=t)return[65533,1];if(n<224){var i=(n&31)<<6|t&63;return i<=127?[65533,1]:[i,2]}var u=r.charCodeAt(e+2);if(u!==u||u<128||192<=u)return[65533,1];if(n<240){var i=(n&15)<<12|(t&63)<<6|u&63;return i<=2047?[65533,1]:55296<=i&&i<=57343?[65533,1]:[i,3]}var l=r.charCodeAt(e+3);if(l!==l||l<128||192<=l)return[65533,1];if(n<248){var i=(n&7)<<18|(t&63)<<12|(u&63)<<6|l&63;return i<=65535||1114111<i?[65533,1]:[i,4]}return[65533,1]},"$decodeRune"),$encodeRune=f(r=>((r<0||r>1114111||55296<=r&&r<=57343)&&(r=65533),r<=127?String.fromCharCode(r):r<=2047?String.fromCharCode(192|r>>6,128|r&63):r<=65535?String.fromCharCode(224|r>>12,128|r>>6&63,128|r&63):String.fromCharCode(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)),"$encodeRune"),$stringToBytes=f(r=>{for(var e=new Uint8Array(r.length),n=0;n<r.length;n++)e[n]=r.charCodeAt(n);return e},"$stringToBytes"),$bytesToString=f(r=>{if(r.$length===0)return"";for(var e="",n=0;n<r.$length;n+=1e4)e+=String.fromCharCode.apply(void 0,r.$array.subarray(r.$offset+n,r.$offset+Math.min(r.$length,n+1e4)));return e},"$bytesToString"),$stringToRunes=f(r=>{for(var e=new Int32Array(r.length),n,t=0,i=0;i<r.length;i+=n[1],t++)n=$decodeRune(r,i),e[t]=n[0];return e.subarray(0,t)},"$stringToRunes"),$runesToString=f(r=>{if(r.$length===0)return"";for(var e="",n=0;n<r.$length;n++)e+=$encodeRune(r.$array[r.$offset+n]);return e},"$runesToString"),$copyString=f((r,e)=>{for(var n=Math.min(e.length,r.$length),t=0;t<n;t++)r.$array[r.$offset+t]=e.charCodeAt(t);return n},"$copyString"),$copySlice=f((r,e)=>{var n=Math.min(e.$length,r.$length);return $copyArray(r.$array,e.$array,r.$offset,e.$offset,n,r.constructor.elem),n},"$copySlice"),$copyArray=f((r,e,n,t,i,u)=>{if(!(i===0||r===e&&n===t)){if(e.subarray){r.set(e.subarray(t,t+i),n);return}switch(u.kind){case $kindArray:case $kindStruct:if(r===e&&n>t){for(var l=i-1;l>=0;l--)u.copy(r[n+l],e[t+l]);return}for(var l=0;l<i;l++)u.copy(r[n+l],e[t+l]);return}if(r===e&&n>t){for(var l=i-1;l>=0;l--)r[n+l]=e[t+l];return}for(var l=0;l<i;l++)r[n+l]=e[t+l]}},"$copyArray"),$clone=f((r,e)=>{var n=e.zero();return e.copy(n,r),n},"$clone"),$pointerOfStructConversion=f((r,e)=>{r.$proxies===void 0&&(r.$proxies={},r.$proxies[r.constructor.string]=r);var n=r.$proxies[e.string];if(n===void 0){for(var t={},i=0;i<e.elem.fields.length;i++)(u=>{t[u]={get(){return r[u]},set(l){r[u]=l}}})(e.elem.fields[i].prop);n=Object.create(e.prototype,t),n.$val=n,r.$proxies[e.string]=n,n.$proxies=r.$proxies}return n},"$pointerOfStructConversion"),$append=f(function(r){return $internalAppend(r,arguments,1,arguments.length-1)},"$append"),$appendSlice=f((r,e)=>{if(e.constructor===String){var n=$stringToBytes(e);return $internalAppend(r,n,0,n.length)}return $internalAppend(r,e.$array,e.$offset,e.$length)},"$appendSlice"),$internalAppend=f((r,e,n,t)=>{if(t===0)return r;var i=r.$array,u=r.$offset,l=r.$length+t,a=r.$capacity;if(l>a)if(u=0,a=Math.max(l,r.$capacity<1024?r.$capacity*2:Math.floor(r.$capacity*5/4)),r.$array.constructor===Array){i=r.$array.slice(r.$offset,r.$offset+r.$length),i.length=a;for(var $=r.constructor.elem.zero,o=r.$length;o<a;o++)i[o]=$()}else i=new r.$array.constructor(a),i.set(r.$array.subarray(r.$offset,r.$offset+r.$length));$copyArray(i,e,u+r.$length,n,t,r.constructor.elem);var s=new r.constructor(i);return s.$offset=u,s.$length=l,s.$capacity=a,s},"$internalAppend"),$equal=f((r,e,n)=>{if(n===$jsObjectPtr)return r===e;switch(n.kind){case $kindComplex64:case $kindComplex128:return r.$real===e.$real&&r.$imag===e.$imag;case $kindInt64:case $kindUint64:return r.$high===e.$high&&r.$low===e.$low;case $kindArray:if(r.length!==e.length)return!1;for(var t=0;t<r.length;t++)if(!$equal(r[t],e[t],n.elem))return!1;return!0;case $kindStruct:for(var t=0;t<n.fields.length;t++){var i=n.fields[t];if(!$equal(r[i.prop],e[i.prop],i.typ))return!1}return!0;case $kindInterface:return $interfaceIsEqual(r,e);default:return r===e}},"$equal"),$interfaceIsEqual=f((r,e)=>r===$ifaceNil||e===$ifaceNil?r===e:r.constructor!==e.constructor?!1:r.constructor===$jsObjectPtr?r.object===e.object:(r.constructor.comparable||$throwRuntimeError("comparing uncomparable type "+r.constructor.string),$equal(r.$val,e.$val,r.constructor)),"$interfaceIsEqual"),$unsafeMethodToFunction=f((r,e,n)=>n?(t,...i)=>{var u=$ptrType(r);if(t.constructor!=u)switch(r.kind){case $kindStruct:t=$pointerOfStructConversion(t,u);break;case $kindArray:t=new u(t);break;default:t=new u(t.$get,t.$set,t.$target)}return t[e](...i)}:(t,...i)=>{var u=$ptrType(r);if(t.constructor!=u)switch(r.kind){case $kindStruct:t=$clone(t,r);break;case $kindSlice:t=$convertSliceType(t,r);break;case $kindComplex64:case $kindComplex128:t=new r(t.$real,t.$imag);break;default:t=new r(t)}return t[e](...i)},"$unsafeMethodToFunction"),$id=f(r=>r,"$id"),$instanceOf=f((r,e)=>r instanceof e,"$instanceOf"),$typeOf=f(r=>typeof r,"$typeOf"),$min=Math.min,$mod=f((r,e)=>r%e,"$mod"),$parseInt=parseInt,$parseFloat=f(r=>r!=null&&r.constructor===Number?r:parseFloat(r),"$parseFloat"),$froundBuf=new Float32Array(1),$fround=Math.fround||(r=>($froundBuf[0]=r,$froundBuf[0])),$imul=Math.imul||((r,e)=>{var n=r>>>16&65535,t=r&65535,i=e>>>16&65535,u=e&65535;return t*u+(n*u+t*i<<16>>>0)>>0}),$floatKey=f(r=>r!==r?($idCounter++,"NaN$"+$idCounter):String(r),"$floatKey"),$flatten64=f(r=>r.$high*4294967296+r.$low,"$flatten64"),$shiftLeft64=f((r,e)=>e===0?r:e<32?new r.constructor(r.$high<<e|r.$low>>>32-e,r.$low<<e>>>0):e<64?new r.constructor(r.$low<<e-32,0):new r.constructor(0,0),"$shiftLeft64"),$shiftRightInt64=f((r,e)=>e===0?r:e<32?new r.constructor(r.$high>>e,(r.$low>>>e|r.$high<<32-e)>>>0):e<64?new r.constructor(r.$high>>31,r.$high>>e-32>>>0):r.$high<0?new r.constructor(-1,4294967295):new r.constructor(0,0),"$shiftRightInt64"),$shiftRightUint64=f((r,e)=>e===0?r:e<32?new r.constructor(r.$high>>>e,(r.$low>>>e|r.$high<<32-e)>>>0):e<64?new r.constructor(0,r.$high>>>e-32):new r.constructor(0,0),"$shiftRightUint64"),$mul64=f((r,e)=>{var n=r.$high>>>16,t=r.$high&65535,i=r.$low>>>16,u=r.$low&65535,l=e.$high>>>16,a=e.$high&65535,$=e.$low>>>16,o=e.$low&65535,s=0,h=0,c=0,v=0;v+=u*o,c+=v>>>16,v&=65535,c+=i*o,h+=c>>>16,c&=65535,c+=u*$,h+=c>>>16,c&=65535,h+=t*o,s+=h>>>16,h&=65535,h+=i*$,s+=h>>>16,h&=65535,h+=u*a,s+=h>>>16,h&=65535,s+=n*o+t*$+i*a+u*l,s&=65535;var d=(s<<16|h)>>>0,p=(c<<16|v)>>>0,y=new r.constructor(d,p);return y},"$mul64"),$div64=f((r,e,n)=>{e.$high===0&&e.$low===0&&$throwRuntimeError("integer divide by zero");var t=1,i=1,u=r.$high,l=r.$low;u<0&&(t=-1,i=-1,u=-u,l!==0&&(u--,l=4294967296-l));var a=e.$high,$=e.$low;e.$high<0&&(t*=-1,a=-a,$!==0&&(a--,$=4294967296-$));for(var o=0,s=0,h=0;a<2147483648&&(u>a||u===a&&l>$);)a=(a<<1|$>>>31)>>>0,$=$<<1>>>0,h++;for(var c=0;c<=h;c++)o=o<<1|s>>>31,s=s<<1>>>0,(u>a||u===a&&l>=$)&&(u=u-a,l=l-$,l<0&&(u--,l+=4294967296),s++,s===4294967296&&(o++,s=0)),$=($>>>1|a<<32-1)>>>0,a=a>>>1;return n?new r.constructor(u*i,l*i):new r.constructor(o*t,s*t)},"$div64"),$divComplex=f((r,e)=>{var n=r.$real===1/0||r.$real===-1/0||r.$imag===1/0||r.$imag===-1/0,t=e.$real===1/0||e.$real===-1/0||e.$imag===1/0||e.$imag===-1/0,i=!n&&(r.$real!==r.$real||r.$imag!==r.$imag),u=!t&&(e.$real!==e.$real||e.$imag!==e.$imag);if(i||u)return new r.constructor(NaN,NaN);if(n&&!t)return new r.constructor(1/0,1/0);if(!n&&t)return new r.constructor(0,0);if(e.$real===0&&e.$imag===0)return r.$real===0&&r.$imag===0?new r.constructor(NaN,NaN):new r.constructor(1/0,1/0);var l=Math.abs(e.$real),a=Math.abs(e.$imag);if(l<=a){var $=e.$real/e.$imag,o=e.$real*$+e.$imag;return new r.constructor((r.$real*$+r.$imag)/o,(r.$imag*$-r.$real)/o)}var $=e.$imag/e.$real,o=e.$imag*$+e.$real;return new r.constructor((r.$imag*$+r.$real)/o,(r.$imag-r.$real*$)/o)},"$divComplex"),$kindBool=1,$kindInt=2,$kindInt8=3,$kindInt16=4,$kindInt32=5,$kindInt64=6,$kindUint=7,$kindUint8=8,$kindUint16=9,$kindUint32=10,$kindUint64=11,$kindUintptr=12,$kindFloat32=13,$kindFloat64=14,$kindComplex64=15,$kindComplex128=16,$kindArray=17,$kindChan=18,$kindFunc=19,$kindInterface=20,$kindMap=21,$kindPtr=22,$kindSlice=23,$kindString=24,$kindStruct=25,$kindUnsafePointer=26,$methodSynthesizers=[],$addMethodSynthesizer=f(r=>{if($methodSynthesizers===null){r();return}$methodSynthesizers.push(r)},"$addMethodSynthesizer"),$synthesizeMethods=f(()=>{$methodSynthesizers.forEach(r=>{r()}),$methodSynthesizers=null},"$synthesizeMethods"),$ifaceKeyFor=f(r=>{if(r===$ifaceNil)return"nil";var e=r.constructor;return e.string+"$"+e.keyFor(r.$val)},"$ifaceKeyFor"),$identity=f(r=>r,"$identity"),$typeIDCounter=0,$idKey=f(r=>(r.$id===void 0&&($idCounter++,r.$id=$idCounter),String(r.$id)),"$idKey"),$arrayPtrCtor=f(()=>function(r){this.$get=()=>r,this.$set=function(e){typ.copy(this,e)},this.$val=r},"$arrayPtrCtor"),$newType=f((r,e,n,t,i,u,l)=>{var a;switch(e){case $kindBool:case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindUnsafePointer:a=f(function(o){this.$val=o},"typ"),a.wrapped=!0,a.keyFor=$identity;break;case $kindString:a=f(function(o){this.$val=o},"typ"),a.wrapped=!0,a.keyFor=o=>"$"+o;break;case $kindFloat32:case $kindFloat64:a=f(function(o){this.$val=o},"typ"),a.wrapped=!0,a.keyFor=o=>$floatKey(o);break;case $kindInt64:a=f(function(o,s){this.$high=o+Math.floor(Math.ceil(s)/4294967296)>>0,this.$low=s>>>0,this.$val=this},"typ"),a.keyFor=o=>o.$high+"$"+o.$low;break;case $kindUint64:a=f(function(o,s){this.$high=o+Math.floor(Math.ceil(s)/4294967296)>>>0,this.$low=s>>>0,this.$val=this},"typ"),a.keyFor=o=>o.$high+"$"+o.$low;break;case $kindComplex64:a=f(function(o,s){this.$real=$fround(o),this.$imag=$fround(s),this.$val=this},"typ"),a.keyFor=o=>o.$real+"$"+o.$imag;break;case $kindComplex128:a=f(function(o,s){this.$real=o,this.$imag=s,this.$val=this},"typ"),a.keyFor=o=>o.$real+"$"+o.$imag;break;case $kindArray:a=f(function(o){this.$val=o},"typ"),a.wrapped=!0,a.ptr=$newType(4,$kindPtr,"*"+n,!1,"",!1,$arrayPtrCtor()),a.init=(o,s)=>{a.elem=o,a.len=s,a.comparable=o.comparable,a.keyFor=h=>Array.prototype.join.call($mapArray(h,c=>String(o.keyFor(c)).replace(/\\/g,"\\\\").replace(/\$/g,"\\$")),"$"),a.copy=(h,c)=>{$copyArray(h,c,0,0,c.length,o)},a.ptr.init(a),Object.defineProperty(a.ptr.nil,"nilCheck",{get:$throwNilPointerError})};break;case $kindChan:a=f(function(o){this.$val=o},"typ"),a.wrapped=!0,a.keyFor=$idKey,a.init=(o,s,h)=>{a.elem=o,a.sendOnly=s,a.recvOnly=h};break;case $kindFunc:a=f(function(o){this.$val=o},"typ"),a.wrapped=!0,a.init=(o,s,h)=>{a.params=o,a.results=s,a.variadic=h,a.comparable=!1};break;case $kindInterface:a={implementedBy:{},missingMethodFor:{}},a.keyFor=$ifaceKeyFor,a.init=o=>{a.methods=o,o.forEach(s=>{$ifaceNil[s.prop]=$throwNilPointerError})};break;case $kindMap:a=f(function(o){this.$val=o},"typ"),a.wrapped=!0,a.init=(o,s)=>{a.key=o,a.elem=s,a.comparable=!1};break;case $kindPtr:a=l||function(o,s,h){this.$get=o,this.$set=s,this.$target=h,this.$val=this},a.keyFor=$idKey,a.init=o=>{a.elem=o,a.wrapped=o.kind===$kindArray,a.nil=new a($throwNilPointerError,$throwNilPointerError)};break;case $kindSlice:a=f(function(o){o.constructor!==a.nativeArray&&(o=new a.nativeArray(o)),this.$array=o,this.$offset=0,this.$length=o.length,this.$capacity=o.length,this.$val=this},"typ"),a.init=o=>{a.elem=o,a.comparable=!1,a.nativeArray=$nativeArray(o.kind),a.nil=new a([])};break;case $kindStruct:a=f(function(o){this.$val=o},"typ"),a.wrapped=!0,a.ptr=$newType(4,$kindPtr,"*"+n,!1,i,u,l),a.ptr.elem=a,a.ptr.prototype.$get=function(){return this},a.ptr.prototype.$set=function(o){a.copy(this,o)},a.init=(o,s)=>{a.pkgPath=o,a.fields=s,s.forEach(c=>{c.typ.comparable||(a.comparable=!1)}),a.keyFor=c=>{var v=c.$val;return $mapArray(s,d=>String(d.typ.keyFor(v[d.prop])).replace(/\\/g,"\\\\").replace(/\$/g,"\\$")).join("$")},a.copy=(c,v)=>{for(var d=0;d<s.length;d++){var p=s[d];switch(p.typ.kind){case $kindArray:case $kindStruct:p.typ.copy(c[p.prop],v[p.prop]);continue;default:c[p.prop]=v[p.prop];continue}}};var h={};s.forEach(c=>{h[c.prop]={get:$throwNilPointerError,set:$throwNilPointerError}}),a.ptr.nil=Object.create(l.prototype,h),a.ptr.nil.$val=a.ptr.nil,$addMethodSynthesizer(()=>{var c=f((v,d,p)=>{v.prototype[d.prop]===void 0&&(v.prototype[d.prop]=function(...y){var w=this.$val[p.prop];return p.typ===$jsObjectPtr&&(w=new $jsObjectPtr(w)),w.$val===void 0&&(w=new p.typ(w)),w[d.prop](...y)})},"synthesizeMethod");s.forEach(v=>{v.embedded&&($methodSet(v.typ).forEach(d=>{c(a,d,v),c(a.ptr,d,v)}),$methodSet($ptrType(v.typ)).forEach(d=>{c(a.ptr,d,v)}))})})};break;default:$panic(new $String("invalid kind: "+e))}switch(e){case $kindBool:case $kindMap:a.zero=()=>!1;break;case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindUnsafePointer:case $kindFloat32:case $kindFloat64:a.zero=()=>0;break;case $kindString:a.zero=()=>"";break;case $kindInt64:case $kindUint64:case $kindComplex64:case $kindComplex128:var $=new a(0,0);a.zero=()=>$;break;case $kindPtr:case $kindSlice:a.zero=()=>a.nil;break;case $kindChan:a.zero=()=>$chanNil;break;case $kindFunc:a.zero=()=>$throwNilPointerError;break;case $kindInterface:a.zero=()=>$ifaceNil;break;case $kindArray:a.zero=()=>{var o=$nativeArray(a.elem.kind);if(o!==Array)return new o(a.len);for(var s=new Array(a.len),h=0;h<a.len;h++)s[h]=a.elem.zero();return s};break;case $kindStruct:a.zero=()=>new a.ptr;break;default:$panic(new $String("invalid kind: "+e))}return a.id=$typeIDCounter,$typeIDCounter++,a.size=r,a.kind=e,a.string=n,a.named=t,a.pkg=i,a.exported=u,a.methods=[],a.methodSetCache=null,a.comparable=!0,a},"$newType"),$methodSet=f(r=>{if(r.methodSetCache!==null)return r.methodSetCache;var e={},n=r.kind===$kindPtr;if(n&&r.elem.kind===$kindInterface)return r.methodSetCache=[],[];for(var t=[{typ:n?r.elem:r,indirect:n}],i={};t.length>0;){var u=[],l=[];t.forEach(a=>{if(!i[a.typ.string])switch(i[a.typ.string]=!0,a.typ.named&&(l=l.concat(a.typ.methods),a.indirect&&(l=l.concat($ptrType(a.typ).methods))),a.typ.kind){case $kindStruct:a.typ.fields.forEach($=>{if($.embedded){var o=$.typ,s=o.kind===$kindPtr;u.push({typ:s?o.elem:o,indirect:a.indirect||s})}});break;case $kindInterface:l=l.concat(a.typ.methods);break}}),l.forEach(a=>{e[a.name]===void 0&&(e[a.name]=a)}),t=u}return r.methodSetCache=[],Object.keys(e).sort().forEach(a=>{r.methodSetCache.push(e[a])}),r.methodSetCache},"$methodSet"),$Bool=$newType(1,$kindBool,"bool",!0,"",!1,null),$Int=$newType(4,$kindInt,"int",!0,"",!1,null),$Int8=$newType(1,$kindInt8,"int8",!0,"",!1,null),$Int16=$newType(2,$kindInt16,"int16",!0,"",!1,null),$Int32=$newType(4,$kindInt32,"int32",!0,"",!1,null),$Int64=$newType(8,$kindInt64,"int64",!0,"",!1,null),$Uint=$newType(4,$kindUint,"uint",!0,"",!1,null),$Uint8=$newType(1,$kindUint8,"uint8",!0,"",!1,null),$Uint16=$newType(2,$kindUint16,"uint16",!0,"",!1,null),$Uint32=$newType(4,$kindUint32,"uint32",!0,"",!1,null),$Uint64=$newType(8,$kindUint64,"uint64",!0,"",!1,null),$Uintptr=$newType(4,$kindUintptr,"uintptr",!0,"",!1,null),$Float32=$newType(4,$kindFloat32,"float32",!0,"",!1,null),$Float64=$newType(8,$kindFloat64,"float64",!0,"",!1,null),$Complex64=$newType(8,$kindComplex64,"complex64",!0,"",!1,null),$Complex128=$newType(16,$kindComplex128,"complex128",!0,"",!1,null),$String=$newType(8,$kindString,"string",!0,"",!1,null),$UnsafePointer=$newType(4,$kindUnsafePointer,"unsafe.Pointer",!0,"unsafe",!1,null),$nativeArray=f(r=>{switch(r){case $kindInt:return Int32Array;case $kindInt8:return Int8Array;case $kindInt16:return Int16Array;case $kindInt32:return Int32Array;case $kindUint:return Uint32Array;case $kindUint8:return Uint8Array;case $kindUint16:return Uint16Array;case $kindUint32:return Uint32Array;case $kindUintptr:return Uint32Array;case $kindFloat32:return Float32Array;case $kindFloat64:return Float64Array;default:return Array}},"$nativeArray"),$toNativeArray=f((r,e)=>{var n=$nativeArray(r);return n===Array?e:new n(e)},"$toNativeArray"),$arrayTypes={},$arrayType=f((r,e)=>{var n=r.id+"$"+e,t=$arrayTypes[n];return t===void 0&&(t=$newType(r.size*e,$kindArray,"["+e+"]"+r.string,!1,"",!1,null),$arrayTypes[n]=t,t.init(r,e)),t},"$arrayType"),$chanType=f((r,e,n)=>{var t=(n?"<-":"")+"chan"+(e?"<- ":" ");!e&&!n&&r.string[0]=="<"?t+="("+r.string+")":t+=r.string;var i=e?"SendChan":n?"RecvChan":"Chan",u=r[i];return u===void 0&&(u=$newType(4,$kindChan,t,!1,"",!1,null),r[i]=u,u.init(r,e,n)),u},"$chanType"),$Chan=f(function(r,e){(e<0||e>2147483647)&&$throwRuntimeError("makechan: size out of range"),this.$elem=r,this.$capacity=e,this.$buffer=[],this.$sendQueue=[],this.$recvQueue=[],this.$closed=!1},"$Chan"),$chanNil=new $Chan(null,0);$chanNil.$sendQueue=$chanNil.$recvQueue={length:0,push(){},shift(){},indexOf(){return-1}};var $funcTypes={},$funcType=f((r,e,n)=>{var t=$mapArray(r,a=>a.id).join(",")+"$"+$mapArray(e,a=>a.id).join(",")+"$"+n,i=$funcTypes[t];if(i===void 0){var u=$mapArray(r,a=>a.string);n&&(u[u.length-1]="..."+u[u.length-1].substr(2));var l="func("+u.join(", ")+")";e.length===1?l+=" "+e[0].string:e.length>1&&(l+=" ("+$mapArray(e,a=>a.string).join(", ")+")"),i=$newType(4,$kindFunc,l,!1,"",!1,null),$funcTypes[t]=i,i.init(r,e,n)}return i},"$funcType"),$interfaceTypes={},$interfaceType=f(r=>{var e=$mapArray(r,i=>i.pkg+","+i.name+","+i.typ.id).join("$"),n=$interfaceTypes[e];if(n===void 0){var t="interface {}";r.length!==0&&(t="interface { "+$mapArray(r,i=>(i.pkg!==""?i.pkg+".":"")+i.name+i.typ.string.substr(4)).join("; ")+" }"),n=$newType(8,$kindInterface,t,!1,"",!1,null),$interfaceTypes[e]=n,n.init(r)}return n},"$interfaceType"),$emptyInterface=$interfaceType([]),$ifaceNil={},$error=$newType(8,$kindInterface,"error",!0,"",!1,null);$error.init([{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],!1)}]);var $mapTypes={},$mapType=f((r,e)=>{var n=r.id+"$"+e.id,t=$mapTypes[n];return t===void 0&&(t=$newType(4,$kindMap,"map["+r.string+"]"+e.string,!1,"",!1,null),$mapTypes[n]=t,t.init(r,e)),t},"$mapType"),$makeMap=f((r,e)=>{for(var n=new Map,t=0;t<e.length;t++){var i=e[t];n.set(r(i.k),i)}return n},"$makeMap"),$ptrType=f(r=>{var e=r.ptr;return e===void 0&&(e=$newType(4,$kindPtr,"*"+r.string,!1,"",r.exported,null),r.ptr=e,e.init(r)),e},"$ptrType"),$newDataPointer=f((r,e)=>e.elem.kind===$kindStruct?r:new e(()=>r,n=>{r=n}),"$newDataPointer"),$indexPtr=f((r,e,n)=>{if(r.buffer){var t=r.buffer.$ptr=r.buffer.$ptr||{},i=t[r.name]=t[r.name]||{},u=r.BYTES_PER_ELEMENT*e+r.byteOffset;return i[u]||(i[u]=new n(()=>r[e],l=>{r[e]=l}))}else return r.$ptr=r.$ptr||{},r.$ptr[e]||(r.$ptr[e]=new n(()=>r[e],l=>{r[e]=l}))},"$indexPtr"),$sliceType=f(r=>{var e=r.slice;return e===void 0&&(e=$newType(12,$kindSlice,"[]"+r.string,!1,"",!1,null),r.slice=e,e.init(r)),e},"$sliceType"),$makeSlice=f((r,e,n=e)=>{(e<0||e>2147483647)&&$throwRuntimeError("makeslice: len out of range"),(n<0||n<e||n>2147483647)&&$throwRuntimeError("makeslice: cap out of range");var t=new r.nativeArray(n);if(r.nativeArray===Array)for(var i=0;i<n;i++)t[i]=r.elem.zero();var u=new r(t);return u.$length=e,u},"$makeSlice"),$structTypes={},$structType=f((r,e)=>{var n=$mapArray(e,u=>u.name+","+u.typ.id+","+u.tag).join("$"),t=$structTypes[n];if(t===void 0){var i="struct { "+$mapArray(e,u=>{var l=u.typ.string+(u.tag!==""?' "'+u.tag.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"':"");return u.embedded?l:u.name+" "+l}).join("; ")+" }";e.length===0&&(i="struct {}"),t=$newType(0,$kindStruct,i,!1,"",!1,function(...u){this.$val=this;for(var l=0;l<e.length;l++){var a=e[l];if(a.name!="_"){var $=u[l];this[a.prop]=$!==void 0?$:a.typ.zero()}}}),$structTypes[n]=t,t.init(r,e)}return t},"$structType"),$assertType=f((r,e,n)=>{var t=e.kind===$kindInterface,i,u="";if(r===$ifaceNil)i=!1;else if(!t)i=r.constructor===e;else{var l=r.constructor.string;if(i=e.implementedBy[l],i===void 0){i=!0;for(var a=$methodSet(r.constructor),$=e.methods,o=0;o<$.length;o++){for(var s=$[o],h=!1,c=0;c<a.length;c++){var v=a[c];if(v.name===s.name&&v.pkg===s.pkg&&v.typ===s.typ){h=!0;break}}if(!h){i=!1,e.missingMethodFor[l]=s.name;break}}e.implementedBy[l]=i}i||(u=e.missingMethodFor[l])}if(!i){if(n)return[e.zero(),!1];$panic(new $packages.runtime.TypeAssertionError.ptr($packages.runtime._type.ptr.nil,r===$ifaceNil?$packages.runtime._type.ptr.nil:new $packages.runtime._type.ptr(r.constructor.string),new $packages.runtime._type.ptr(e.string),u))}return t||(r=r.$val),e===$jsObjectPtr&&(r=r.object),n?[r,!0]:r},"$assertType"),$stackDepthOffset=0,$getStackDepth=f(()=>{var r=new Error;if(r.stack!==void 0)return $stackDepthOffset+r.stack.split(` `).length},"$getStackDepth"),$panicStackDepth=null,$panicValue,$callDeferred=f((r,e,n)=>{if(!n&&r!==null&&$curGoroutine.deferStack.indexOf(r)==-1)throw e;if(e!==null){var t=null;try{$panic(new $jsErrorPtr(e))}catch(s){t=s}$callDeferred(r,t);return}if(!$curGoroutine.asleep){$stackDepthOffset--;var i=$panicStackDepth,u=$panicValue,l=$curGoroutine.panicStack.pop();l!==void 0&&($panicStackDepth=$getStackDepth(),$panicValue=l);try{for(;;){if(r===null&&(r=$curGoroutine.deferStack[$curGoroutine.deferStack.length-1],r===void 0)){if($panicStackDepth=null,l.Object instanceof Error)throw l.Object;var a;throw l.constructor===$String?a=l.$val:l.Error!==void 0?a=l.Error():l.String!==void 0?a=l.String():a=l,new Error(a)}var $=r.pop();if($===void 0){if($curGoroutine.deferStack.pop(),l!==void 0){r=null;continue}return}var o=$[0].apply($[2],$[1]);if(o&&o.$blk!==void 0){if(r.push([o.$blk,[],o]),n)throw null;return}if(l!==void 0&&$panicStackDepth===null){if(n)throw null;return}}}catch(s){if(n)throw s;$callDeferred(r,s,n)}finally{l!==void 0&&($panicStackDepth!==null&&$curGoroutine.panicStack.push(l),$panicStackDepth=i,$panicValue=u),$stackDepthOffset++}}},"$callDeferred"),$panic=f(r=>{$curGoroutine.panicStack.push(r),$callDeferred(null,null,!0)},"$panic"),$recover=f(()=>$panicStackDepth===null||$panicStackDepth!==void 0&&$panicStackDepth!==$getStackDepth()-2?$ifaceNil:($panicStackDepth=null,$panicValue),"$recover"),$throw=f(r=>{throw r},"$throw"),$noGoroutine={asleep:!1,exit:!1,deferStack:[],panicStack:[]},$curGoroutine=$noGoroutine,$totalGoroutines=0,$awakeGoroutines=0,$checkForDeadlock=!0,$exportedFunctions=0,$mainFinished=!1,$go=f((r,e)=>{$totalGoroutines++,$awakeGoroutines++;var n=f(()=>{try{$curGoroutine=n;var t=r(...e);if(t&&t.$blk!==void 0){r=f(()=>t.$blk(),"fun"),e=[];return}n.exit=!0}catch(i){if(!n.exit)throw i}finally{$curGoroutine=$noGoroutine,n.exit&&($totalGoroutines--,n.asleep=!0),n.asleep&&($awakeGoroutines--,!$mainFinished&&$awakeGoroutines===0&&$checkForDeadlock&&$exportedFunctions===0&&(console.error("fatal error: all goroutines are asleep - deadlock!"),$global.process!==void 0&&$global.process.exit(2)))}},"$goroutine");n.asleep=!1,n.exit=!1,n.deferStack=[],n.panicStack=[],$schedule(n)},"$go"),$scheduled=[],$runScheduled=f(()=>{var r=setTimeout($runScheduled);try{for(var e=Date.now(),n;(n=$scheduled.shift())!==void 0;){n();var t=Date.now()-e;if(t>4||t<0)break}}finally{$scheduled.length==0&&clearTimeout(r)}},"$runScheduled"),$schedule=f(r=>{r.asleep&&(r.asleep=!1,$awakeGoroutines++),$scheduled.push(r),$curGoroutine===$noGoroutine&&$runScheduled()},"$schedule"),$setTimeout=f((r,e)=>($awakeGoroutines++,setTimeout(()=>{$awakeGoroutines--,r()},e)),"$setTimeout"),$block=f(()=>{$curGoroutine===$noGoroutine&&$throwRuntimeError("cannot block in JavaScript callback, fix by wrapping code in goroutine"),$curGoroutine.asleep=!0},"$block"),$restore=f((r,e)=>r!==void 0&&r.$blk!==void 0?r:e,"$restore"),$send=f((r,e)=>{r.$closed&&$throwRuntimeError("send on closed channel");var n=r.$recvQueue.shift();if(n!==void 0){n([e,!0]);return}if(r.$buffer.length<r.$capacity){r.$buffer.push(e);return}var t=$curGoroutine,i;return r.$sendQueue.push(u=>(i=u,$schedule(t),e)),$block(),{$blk(){i&&$throwRuntimeError("send on closed channel")}}},"$send"),$recv=f(r=>{var e=r.$sendQueue.shift();e!==void 0&&r.$buffer.push(e(!1));var n=r.$buffer.shift();if(n!==void 0)return[n,!0];if(r.$closed)return[r.$elem.zero(),!1];var t=$curGoroutine,i={$blk(){return this.value}},u=f(l=>{i.value=l,$schedule(t)},"queueEntry");return r.$recvQueue.push(u),$block(),i},"$recv"),$close=f(r=>{for(r.$closed&&$throwRuntimeError("close of closed channel"),r.$closed=!0;;){var e=r.$sendQueue.shift();if(e===void 0)break;e(!0)}for(;;){var n=r.$recvQueue.shift();if(n===void 0)break;n([r.$elem.zero(),!1])}},"$close"),$select=f(r=>{for(var e=[],n=-1,t=0;t<r.length;t++){var i=r[t],u=i[0];switch(i.length){case 0:n=t;break;case 1:(u.$sendQueue.length!==0||u.$buffer.length!==0||u.$closed)&&e.push(t);break;case 2:u.$closed&&$throwRuntimeError("send on closed channel"),(u.$recvQueue.length!==0||u.$buffer.length<u.$capacity)&&e.push(t);break}}if(e.length!==0&&(n=e[Math.floor(Math.random()*e.length)]),n!==-1){var i=r[n];switch(i.length){case 0:return[n];case 1:return[n,$recv(i[0])];case 2:return $send(i[0],i[1]),[n]}}for(var l=[],a=$curGoroutine,$={$blk(){return this.selection}},o=f(()=>{for(var s=0;s<l.length;s++){var h=l[s],c=h[0],v=c.indexOf(h[1]);v!==-1&&c.splice(v,1)}},"removeFromQueues"),t=0;t<r.length;t++)(h=>{var c=r[h];switch(c.length){case 1:var v=f(d=>{$.selection=[h,d],o(),$schedule(a)},"queueEntry");l.push([c[0].$recvQueue,v]),c[0].$recvQueue.push(v);break;case 2:var v=f(()=>(c[0].$closed&&$throwRuntimeError("send on closed channel"),$.selection=[h],o(),$schedule(a),c[1]),"queueEntry");l.push([c[0].$sendQueue,v]),c[0].$sendQueue.push(v);break}})(t);return $block(),$},"$select"),$jsObjectPtr,$jsErrorPtr,$needsExternalization=f(r=>{switch(r.kind){case $kindBool:case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindFloat32:case $kindFloat64:return!1;default:return r!==$jsObjectPtr}},"$needsExternalization"),$externalize=f((r,e,n)=>{if(e===$jsObjectPtr)return r;switch(e.kind){case $kindBool:case $kindInt:case $kindInt8:case $kindInt16:case $kindInt32:case $kindUint:case $kindUint8:case $kindUint16:case $kindUint32:case $kindUintptr:case $kindFloat32:case $kindFloat64:return r;case $kindInt64:case $kindUint64:return $flatten64(r);case $kindArray:return $needsExternalization(e.elem)?$mapArray(r,k=>$externalize(k,e.elem,n)):r;case $kindFunc:return $externalizeFunction(r,e,!1,n);case $kindInterface:return r===$ifaceNil?null:r.constructor===$jsObjectPtr?r.$val.object:$externalize(r.$val,r.constructor,n);case $kindMap:if(r.keys===void 0)return null;for(var t={},i=Array.from(r.keys()),u=0;u<i.length;u++){var l=r.get(i[u]);t[$externalize(l.k,e.key,n)]=$externalize(l.v,e.elem,n)}return t;case $kindPtr:return r===e.nil?null:$externalize(r.$get(),e.elem,n);case $kindSlice:return r===r.constructor.nil?null:$needsExternalization(e.elem)?$mapArray($sliceToNativeArray(r),k=>$externalize(k,e.elem,n)):$sliceToNativeArray(r);case $kindString:if($isASCII(r))return r;for(var a="",$,u=0;u<r.length;u+=$[1]){$=$decodeRune(r,u);var o=$[0];if(o>65535){var s=Math.floor((o-65536)/1024)+55296,h=(o-65536)%1024+56320;a+=String.fromCharCode(s,h);continue}a+=String.fromCharCode(o)}return a;case $kindStruct:var c=$packages.time;if(c!==void 0&&r.constructor===c.Time.ptr){var v=$div64(r.UnixNano(),new $Int64(0,1e6));return new Date($flatten64(v))}var d={},p=f((k,m)=>{if(m===$jsObjectPtr)return k;switch(m.kind){case $kindPtr:return k===m.nil?d:p(k.$get(),m.elem);case $kindStruct:if(m.fields.length===0)return d;var b=m.fields[0];return p(k[b.prop],b.typ);case $kindInterface:return p(k.$val,k.constructor);default:return d}},"searchJsObject"),y=p(r,e);if(y!==d)return y;if(n!==void 0)return n(r);y={};for(var u=0;u<e.fields.length;u++){var w=e.fields[u];w.exported&&(y[w.name]=$externalize(r[w.prop],w.typ,n))}return y}$throwRuntimeError("cannot externalize "+e.string)},"$externalize"),$externalizeFunction=f((r,e,n,t)=>r===$throwNilPointerError?null:(r.$externalizeWrapper===void 0&&($checkForDeadlock=!1,r.$externalizeWrapper=function(){for(var i=[],u=0;u<e.params.length;u++){if(e.variadic&&u===e.params.length-1){for(var l=e.params[u].elem,a=[],$=u;$<arguments.length;$++)a.push($internalize(arguments[$],l,t));i.push(new e.params[u](a));break}i.push($internalize(arguments[u],e.params[u],t))}var o=r.apply(n?this:void 0,i);switch(e.results.length){case 0:return;case 1:return $externalize($copyIfRequired(o,e.results[0]),e.results[0],t);default:for(var u=0;u<e.results.length;u++)o[u]=$externalize($copyIfRequired(o[u],e.results[u]),e.results[u],t);return o}}),r.$externalizeWrapper),"$externalizeFunction"),$internalize=f((r,e,n,t,i)=>{if(e===$jsObjectPtr)return r;if(e===$jsObjectPtr.elem&&$throwRuntimeError("cannot internalize js.Object, use *js.Object instead"),r&&r.__internal_object__!==void 0)return $assertType(r.__internal_object__,e,!1);var u=$packages.time;if(u!==void 0&&e===u.Time)return r!=null&&r.constructor===Date||$throwRuntimeError("cannot internalize time.Time from "+typeof r+", must be Date"),u.Unix(new $Int64(0,0),new $Int64(0,r.getTime()*1e6));if(t===void 0&&(t=new Map),t.has(e)||t.set(e,new Map),t.get(e).has(r))return t.get(e).get(r);switch(e.kind){case $kindBool:return!!r;case $kindInt:return parseInt(r);case $kindInt8:return parseInt(r)<<24>>24;case $kindInt16:return parseInt(r)<<16>>16;case $kindInt32:return parseInt(r)>>0;case $kindUint:return parseInt(r);case $kindUint8:return parseInt(r)<<24>>>24;case $kindUint16:return parseInt(r)<<16>>>16;case $kindUint32:case $kindUintptr:return parseInt(r)>>>0;case $kindInt64:case $kindUint64:return new e(0,r);case $kindFloat32:case $kindFloat64:return parseFloat(r);case $kindArray:return r.length!==e.len&&$throwRuntimeError("got array with wrong size from JavaScript native"),$mapArray(r,F=>$internalize(F,e.elem,i));case $kindFunc:return function(){for(var F=[],g=0;g<e.params.length;g++){if(e.variadic&&g===e.params.length-1){for(var A=e.params[g].elem,x=arguments[g],C=0;C<x.$length;C++)F.push($externalize(x.$array[x.$offset+C],A,i));break}F.push($externalize(arguments[g],e.params[g],i))}var S=r.apply(n,F);switch(e.results.length){case 0:return;case 1:return $internalize(S,e.results[0],i);default:for(var g=0;g<e.results.length;g++)S[g]=$internalize(S[g],e.results[g],i);return S}};case $kindInterface:if(e.methods.length!==0&&$throwRuntimeError("cannot internalize "+e.string),r===null)return $ifaceNil;if(r===void 0)return new $jsObjectPtr(void 0);switch(r.constructor){case Int8Array:return new($sliceType($Int8))(r);case Int16Array:return new($sliceType($Int16))(r);case Int32Array:return new($sliceType($Int))(r);case Uint8Array:return new($sliceType($Uint8))(r);case Uint16Array:return new($sliceType($Uint16))(r);case Uint32Array:return new($sliceType($Uint))(r);case Float32Array:return new($sliceType($Float32))(r);case Float64Array:return new($sliceType($Float64))(r);case Array:return $internalize(r,$sliceType($emptyInterface),i);case Boolean:return new $Bool(!!r);case Date:return u===void 0?new $jsObjectPtr(r):new u.Time($internalize(r,u.Time,i));case(()=>{}).constructor:var l=$funcType([$sliceType($emptyInterface)],[$jsObjectPtr],!0);return new l($internalize(r,l,i));case Number:return new $Float64(parseFloat(r));case String:return new $String($internalize(r,$String,i));default:if($global.Node&&r instanceof $global.Node)return new $jsObjectPtr(r);var a=$mapType($String,$emptyInterface);return new a($internalize(r,a,n,t,i))}case $kindMap:var $=new Map;t.get(e).set(r,$);for(var o=$keys(r),c=0;c<o.length;c++){var s=$internalize(o[c],e.key,n,t,i);$.set(e.key.keyFor(s),{k:s,v:$internalize(r[o[c]],e.elem,n,t,i)})}return $;case $kindPtr:if(e.elem.kind===$kindStruct)return $internalize(r,e.elem,i);case $kindSlice:return new e($mapArray(r,F=>$internalize(F,e.elem,i)));case $kindString:if(r=String(r),$isASCII(r))return r;for(var h="",c=0;c<r.length;){var v=r.charCodeAt(c);if(55296<=v&&v<=56319){var d=r.charCodeAt(c+1),p=(v-55296)*1024+d-56320+65536;h+=$encodeRune(p),c+=2;continue}h+=$encodeRune(v),c++}return h;case $kindStruct:var y={},w=f(F=>{if(F===$jsObjectPtr)return r;switch(F===$jsObjectPtr.elem&&$throwRuntimeError("cannot internalize js.Object, use *js.Object instead"),F.kind){case $kindPtr:return w(F.elem);case $kindStruct:if(F.fields.length===0)return y;var g=F.fields[0],A=w(g.typ);if(A!==y){var x=new F.ptr;return x[g.prop]=A,x}return y;default:return y}},"searchJsObject"),k=w(e);if(k!==y)return k;for(var m=new e.ptr,c=0;c<e.fields.length;c++){var b=e.fields[c];if(b.exported){var I=r[b.name];m[b.prop]=$internalize(I,b.typ,n,t,i)}}return m}$throwRuntimeError("cannot internalize "+e.string)},"$internalize"),$copyIfRequired=f((r,e)=>{if(r&&r.constructor&&r.constructor.copy)return new r.constructor($clone(r.$val,r.constructor));if(e.copy){var n=e.zero();return e.copy(n,r),n}return r},"$copyIfRequired"),$isASCII=f(r=>{for(var e=0;e<r.length;e++)if(r.charCodeAt(e)>=128)return!1;return!0},"$isASCII"); $packages["github.com/gopherjs/gopherjs/js"]=(function(){var $pkg={},$init,A,B,J,M,O,P,Q,T,E,G,L;A=$pkg.Object=$newType(0,$kindStruct,"js.Object",true,"github.com/gopherjs/gopherjs/js",true,function(object_){this.$val=this;if(arguments.length===0){this.object=null;return;}this.object=object_;});B=$pkg.Error=$newType(0,$kindStruct,"js.Error",true,"github.com/gopherjs/gopherjs/js",true,function(Object_){this.$val=this;if(arguments.length===0){this.Object=null;return;}this.Object=Object_;});J=$pkg.M=$newType(4,$kindMap,"js.M",true,"github.com/gopherjs/gopherjs/js",true,null);M=$sliceType($emptyInterface);O=$ptrType(A);P=$sliceType(O);Q=$funcType([P],[O],true);T=$ptrType(B);A.ptr.prototype.Get=function(a){var a,b;b=this;return b.object[$externalize(a,$String)];};A.prototype.Get=function(a){return this.$val.Get(a);};A.ptr.prototype.Set=function(a,b){var a,b,c;c=this;c.object[$externalize(a,$String)]=$externalize(b,$emptyInterface);};A.prototype.Set=function(a,b){return this.$val.Set(a,b);};A.ptr.prototype.Delete=function(a){var a,b;b=this;delete b.object[$externalize(a,$String)];};A.prototype.Delete=function(a){return this.$val.Delete(a);};A.ptr.prototype.Length=function(){var a;a=this;return $parseInt(a.object.length);};A.prototype.Length=function(){return this.$val.Length();};A.ptr.prototype.Index=function(a){var a,b;b=this;return b.object[a];};A.prototype.Index=function(a){return this.$val.Index(a);};A.ptr.prototype.SetIndex=function(a,b){var a,b,c;c=this;c.object[a]=$externalize(b,$emptyInterface);};A.prototype.SetIndex=function(a,b){return this.$val.SetIndex(a,b);};A.ptr.prototype.Call=function(a,b){var a,b,c,d;c=this;return(d=c.object,d[$externalize(a,$String)].apply(d,$externalize(b,M)));};A.prototype.Call=function(a,b){return this.$val.Call(a,b);};A.ptr.prototype.Invoke=function(a){var a,b;b=this;return b.object.apply(undefined,$externalize(a,M));};A.prototype.Invoke=function(a){return this.$val.Invoke(a);};A.ptr.prototype.New=function(a){var a,b;b=this;return new($global.Function.prototype.bind.apply(b.object,[undefined].concat($externalize(a,M))));};A.prototype.New=function(a){return this.$val.New(a);};A.ptr.prototype.Bool=function(){var a;a=this;return!!(a.object);};A.prototype.Bool=function(){return this.$val.Bool();};A.ptr.prototype.String=function(){var a;a=this;return $internalize(a.object,$String);};A.prototype.String=function(){return this.$val.String();};A.ptr.prototype.Int=function(){var a;a=this;return $parseInt(a.object)>>0;};A.prototype.Int=function(){return this.$val.Int();};A.ptr.prototype.Int64=function(){var a;a=this;return $internalize(a.object,$Int64);};A.prototype.Int64=function(){return this.$val.Int64();};A.ptr.prototype.Uint64=function(){var a;a=this;return $internalize(a.object,$Uint64);};A.prototype.Uint64=function(){return this.$val.Uint64();};A.ptr.prototype.Float=function(){var a;a=this;return $parseFloat(a.object);};A.prototype.Float=function(){return this.$val.Float();};A.ptr.prototype.Interface=function(){var a;a=this;return $internalize(a.object,$emptyInterface);};A.prototype.Interface=function(){return this.$val.Interface();};A.ptr.prototype.Unsafe=function(){var a;a=this;return a.object;};A.prototype.Unsafe=function(){return this.$val.Unsafe();};B.ptr.prototype.Error=function(){var a;a=this;return"JavaScript error: "+$internalize(a.Object.message,$String);};B.prototype.Error=function(){return this.$val.Error();};B.ptr.prototype.Stack=function(){var a;a=this;return $internalize(a.Object.stack,$String);};B.prototype.Stack=function(){return this.$val.Stack();};E=function(a){var a;return $makeFunc(a);};$pkg.MakeFunc=E;G=function(a){var a,b,c,d,e,f;b=a;c=new($global.Object)();c.__internal_object__=b;d=b.constructor.methods;e=0;while(true){if(!(e<$parseInt(d.length))){break;}f=[f];f[0]=d[e];if(!($internalize(f[0].pkg,$String)==="")){e=e+(1)>>0;continue;}c[$externalize($internalize(f[0].name,$String),$String)]=$externalize((function(f){return function(g){var g;return $externalizeFunction(b[$externalize($internalize(f[0].prop,$String),$String)],f[0].typ,$externalize(true,$Bool)).apply(b,$externalize(g,P));};})(f),Q);e=e+(1)>>0;}return c;};$pkg.MakeWrapper=G;L=function(){var a;a=new B.ptr(null);$unused(a);};O.methods=[{prop:"Get",name:"Get",pkg:"",typ:$funcType([$String],[O],false)},{prop:"Set",name:"Set",pkg:"",typ:$funcType([$String,$emptyInterface],[],false)},{prop:"Delete",name:"Delete",pkg:"",typ:$funcType([$String],[],false)},{prop:"Length",name:"Length",pkg:"",typ:$funcType([],[$Int],false)},{prop:"Index",name:"Index",pkg:"",typ:$funcType([$Int],[O],false)},{prop:"SetIndex",name:"SetIndex",pkg:"",typ:$funcType([$Int,$emptyInterface],[],false)},{prop:"Call",name:"Call",pkg:"",typ:$funcType([$String,M],[O],true)},{prop:"Invoke",name:"Invoke",pkg:"",typ:$funcType([M],[O],true)},{prop:"New",name:"New",pkg:"",typ:$funcType([M],[O],true)},{prop:"Bool",name:"Bool",pkg:"",typ:$funcType([],[$Bool],false)},{prop:"String",name:"String",pkg:"",typ:$funcType([],[$String],false)},{prop:"Int",name:"Int",pkg:"",typ:$funcType([],[$Int],false)},{prop:"Int64",name:"Int64",pkg:"",typ:$funcType([],[$Int64],false)},{prop:"Uint64",name:"Uint64",pkg:"",typ:$funcType([],[$Uint64],false)},{prop:"Float",name:"Float",pkg:"",typ:$funcType([],[$Float64],false)},{prop:"Interface",name:"Interface",pkg:"",typ:$funcType([],[$emptyInterface],false)},{prop:"Unsafe",name:"Unsafe",pkg:"",typ:$funcType([],[$Uintptr],false)}];T.methods=[{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],false)},{prop:"Stack",name:"Stack",pkg:"",typ:$funcType([],[$String],false)}];A.init("github.com/gopherjs/gopherjs/js",[{prop:"object",name:"object",embedded:false,exported:false,typ:O,tag:""}]);B.init("",[{prop:"Object",name:"Object",embedded:true,exported:true,typ:O,tag:""}]);J.init($String,$emptyInterface);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:L();}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})(); $packages["runtime"]=(function(){var $pkg={},$init,A,C,D,L,U,V,AF,AT,BA,BB,BC,BD,BE,BF,BG,BH,H,I,N,O,AM,E,F,J,K,M,P,Q,S,T,AE,AG,AS,AU,AV,AW;A=$packages["github.com/gopherjs/gopherjs/js"];C=$pkg._type=$newType(0,$kindStruct,"runtime._type",true,"runtime",false,function(str_){this.$val=this;if(arguments.length===0){this.str="";return;}this.str=str_;});D=$pkg.TypeAssertionError=$newType(0,$kindStruct,"runtime.TypeAssertionError",true,"runtime",true,function(_interface_,concrete_,asserted_,missingMethod_){this.$val=this;if(arguments.length===0){this._interface=BC.nil;this.concrete=BC.nil;this.asserted=BC.nil;this.missingMethod="";return;}this._interface=_interface_;this.concrete=concrete_;this.asserted=asserted_;this.missingMethod=missingMethod_;});L=$pkg.basicFrame=$newType(0,$kindStruct,"runtime.basicFrame",true,"runtime",false,function(FuncName_,File_,Line_,Col_){this.$val=this;if(arguments.length===0){this.FuncName="";this.File="";this.Line=0;this.Col=0;return;}this.FuncName=FuncName_;this.File=File_;this.Line=Line_;this.Col=Col_;});U=$pkg.Frames=$newType(0,$kindStruct,"runtime.Frames",true,"runtime",true,function(frames_,current_){this.$val=this;if(arguments.length===0){this.frames=BF.nil;this.current=0;return;}this.frames=frames_;this.current=current_;});V=$pkg.Frame=$newType(0,$kindStruct,"runtime.Frame",true,"runtime",true,function(PC_,Func_,Function_,File_,Line_,Entry_){this.$val=this;if(arguments.length===0){this.PC=0;this.Func=BA.nil;this.Function="";this.File="";this.Line=0;this.Entry=0;return;}this.PC=PC_;this.Func=Func_;this.Function=Function_;this.File=File_;this.Line=Line_;this.Entry=Entry_;});AF=$pkg.Func=$newType(0,$kindStruct,"runtime.Func",true,"runtime",true,function(name_,file_,line_,opaque_){this.$val=this;if(arguments.length===0){this.name="";this.file="";this.line=0;this.opaque=new BD.ptr();return;}this.name=name_;this.file=file_;this.line=line_;this.opaque=opaque_;});AT=$pkg.errorString=$newType(8,$kindString,"runtime.errorString",true,"runtime",false,null);BA=$ptrType(AF);BB=$sliceType(BA);BC=$ptrType(C);BD=$structType("",[]);BE=$sliceType(L);BF=$sliceType(V);BG=$ptrType(D);BH=$ptrType(U);C.ptr.prototype.string=function(){var a;a=this;return a.str;};C.prototype.string=function(){return this.$val.string();};C.ptr.prototype.pkgpath=function(){var a;a=this;return"";};C.prototype.pkgpath=function(){return this.$val.pkgpath();};D.ptr.prototype.RuntimeError=function(){};D.prototype.RuntimeError=function(){return this.$val.RuntimeError();};D.ptr.prototype.Error=function(){var a,b,c,d,e;a=this;b="interface";if(!(a._interface===BC.nil)){b=a._interface.string();}c=a.asserted.string();if(a.concrete===BC.nil){return"interface conversion: "+b+" is nil, not "+c;}d=a.concrete.string();if(a.missingMethod===""){e="interface conversion: "+b+" is "+d+", not "+c;if(d===c){if(!(a.concrete.pkgpath()===a.asserted.pkgpath())){e=e+(" (types from different packages)");}else{e=e+(" (types from different scopes)");}}return e;}return"interface conversion: "+d+" is not "+c+": missing method "+a.missingMethod;};D.prototype.Error=function(){return this.$val.Error();};E=function(){var a,b;a=$packages[$externalize("github.com/gopherjs/gopherjs/js",$String)];$jsObjectPtr=a.Object.ptr;$jsErrorPtr=a.Error.ptr;$throwRuntimeError=AU;AM=$internalize($goVersion,$String);b=$ifaceNil;b=new D.ptr(BC.nil,BC.nil,BC.nil,"");$unused(b);};F=function(){var a,b,c;a=$global.process;if(a===undefined||a.env===undefined){return"/";}b=a.env.GOPHERJS_GOROOT;if(!(b===undefined)&&!($internalize(b,$String)==="")){return $internalize(b,$String);}else{c=a.env.GOROOT;if(!(c===undefined)&&!($internalize(c,$String)==="")){return $internalize(c,$String);}}return"/usr/local/go";};$pkg.GOROOT=F;J=function(a,b,c,d){var a,b,c,d,e,f,g,h,i,j,k,l;e=b+":"+K(c)+":"+K(d);f=(g=$mapIndex(H,$String.keyFor(e)),g!==undefined?[g.v,true]:[0,false]);h=f[0];i=f[1];if(i){return h;}j=new AF.ptr(a,b,c,new BD.ptr());k=((I.$length>>>0));I=$append(I,j);l=e;(H||$throwRuntimeError("assignment to entry in nil map")).set($String.keyFor(l),{k:l,v:k});return k;};K=function(a){var a;return $internalize(new($global.String)(a),$String);};M=function(a,b){var a,b,c;a=(a+1>>0)+1>>0;c=new($global.Error)().stack.split($externalize("\n",$String)).slice(a,a+b>>0);return P(c);};P=function(a){var a,b,c,d,e,f,g,h,i,j;b=new BE([]);c=$parseInt(a.length);d=0;while(true){if(!(d<c)){break;}e=$clone(Q(a[d]),L);if((f=$mapIndex(N,$String.keyFor(e.FuncName)),f!==undefined?f.v:false)){d=d+(1)>>0;continue;}g=(h=$mapIndex(O,$String.keyFor(e.FuncName)),h!==undefined?[h.v,true]:["",false]);i=g[0];j=g[1];if(j){e.FuncName=i;}b=$append(b,e);if(e.FuncName==="runtime.goexit"){break;}d=d+(1)>>0;}return b;};Q=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q;if(($parseInt(a.indexOf($externalize("@",$String)))>>0)>=0){b=new($global.RegExp)($externalize("[@:]",$String));c=a.split(b);return new L.ptr($internalize(c[0],$String),$internalize(c.slice(1,$parseInt(c.length)-2>>0).join($externalize(":",$String)),$String),$parseInt(c[($parseInt(c.length)-2>>0)])>>0,$parseInt(c[($parseInt(c.length)-1>>0)])>>0);}d=$parseInt(a.lastIndexOf($externalize("(",$String)))>>0;if(d===-1){e=a.split($externalize(":",$String));return new L.ptr("<none>",$internalize(e.slice(0,$parseInt(e.length)-2>>0).join($externalize(":",$String)).replace(new($global.RegExp)($externalize("^\\s*at ",$String)),$externalize("",$String)),$String),$parseInt(e[($parseInt(e.length)-2>>0)])>>0,$parseInt(e[($parseInt(e.length)-1>>0)])>>0);}f="";g="";h=f;i=g;j=0;k=0;l=j;m=k;n=a.substring(d+1>>0,$parseInt(a.indexOf($externalize(")",$String)))>>0);o=n.split($externalize(":",$String));if($internalize(n,$String)==="<anonymous>"){h="<anonymous>";}else{h=$internalize(o.slice(0,$parseInt(o.length)-2>>0).join($externalize(":",$String)),$String);l=$parseInt(o[($parseInt(o.length)-2>>0)])>>0;m=$parseInt(o[($parseInt(o.length)-1>>0)])>>0;}p=a.substring(($parseInt(a.indexOf($externalize("at ",$String)))>>0)+3>>0,$parseInt(a.indexOf($externalize(" (",$String)))>>0);q=$parseInt(p.indexOf($externalize("[as ",$String)))>>0;if(q>0){p=p.substring(q+4>>0,p.indexOf($externalize("]",$String)));}i=$internalize(p,$String);return new L.ptr(i,h,l,m);};$pkg.ParseCallFrame=Q;S=function(a,b){var a,b,c,d,e,f,g;c=M(a,b.$length);d=c;e=0;while(true){if(!(e<d.$length)){break;}f=e;g=$clone(((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]),L);((f<0||f>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+f]=J(g.FuncName,g.File,g.Line,g.Col));e++;}return c.$length;};$pkg.Callers=S;T=function(a){var a,b,c,d,e,f;b=new U.ptr(BF.nil,0);c=a;d=0;while(true){if(!(d<c.$length)){break;}e=((d<0||d>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+d]);f=AG(e);b.frames=$append(b.frames,new V.ptr(e,f,f.