|
|
|
@@ -1,29 +1,30 @@
|
|
|
|
|
import{a as c0}from"./chunk-NTFEI2OH.js";import{a as d0}from"./chunk-T6VURU5O.js";import{a as Sc}from"./chunk-A7SWO6EA.js";import{a as h0,b as u0,c as t_}from"./chunk-EY5LTL52.js";import{C as rf,H as nf,t as a0,u as l0}from"./chunk-4WX2XTAI.js";import"./chunk-UACHXWHT.js";import{A as an,E as ln,F as Ju,G as xo,I as wo,J as bc,K as ef,T as tf,U as s0,X as o0,a as Gn,b as Ra,d as St,da as yc,e as Ma,f as zt,g as Ce,h as Hu,i as t0,k as r0,m as mc,n as Oc,o as gc,p as Cs,q as n0,t as vo,w as i0,x as Ku,y as La,z as ir}from"./chunk-EK7ZCXAS.js";import{a as gt,b as As,c as Ea,d as qu,e as Gu}from"./chunk-VSC4MAII.js";var of=qu((f0,sf)=>{(function(r){if(typeof f0=="object"&&typeof sf!="undefined")sf.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=r()}})(function(){var r,e,t;return(function n(i,s,o){function a(d,h){if(!s[d]){if(!i[d]){var u=typeof Ea=="function"&&Ea;if(!h&&u)return u(d,!0);if(l)return l(d,!0);var f=new Error("Cannot find module '"+d+"'");throw f.code="MODULE_NOT_FOUND",f}var m=s[d]={exports:{}};i[d][0].call(m.exports,function(g){var v=i[d][1][g];return a(v||g)},m,m.exports,n,i,s,o)}return s[d].exports}for(var l=typeof Ea=="function"&&Ea,c=0;c<o.length;c++)a(o[c]);return a})({1:[function(n,i,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,l;if(a){var c=0,d=new a(g),h=o.document.createTextNode("");d.observe(h,{characterData:!0}),l=function(){h.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var u=new o.MessageChannel;u.port1.onmessage=g,l=function(){u.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var k=o.document.createElement("script");k.onreadystatechange=function(){g(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},o.document.documentElement.appendChild(k)}:l=function(){setTimeout(g,0)};var f,m=[];function g(){f=!0;for(var k,L,M=m.length;M;){for(L=m,m=[],k=-1;++k<M;)L[k]();M=m.length}f=!1}i.exports=v;function v(k){m.push(k)===1&&!f&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,s){"use strict";var o=n(1);function a(){}var l={},c=["REJECTED"],d=["FULFILLED"],h=["PENDING"];i.exports=u;function u(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,x!==a&&v(this,x)}u.prototype.catch=function(x){return this.then(null,x)},u.prototype.then=function(x,R){if(typeof x!="function"&&this.state===d||typeof R!="function"&&this.state===c)return this;var X=new this.constructor(a);if(this.state!==h){var j=this.state===d?x:R;m(X,j,this.outcome)}else this.queue.push(new f(X,x,R));return X};function f(x,R,X){this.promise=x,typeof R=="function"&&(this.onFulfilled=R,this.callFulfilled=this.otherCallFulfilled),typeof X=="function"&&(this.onRejected=X,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(x){l.resolve(this.promise,x)},f.prototype.otherCallFulfilled=function(x){m(this.promise,this.onFulfilled,x)},f.prototype.callRejected=function(x){l.reject(this.promise,x)},f.prototype.otherCallRejected=function(x){m(this.promise,this.onRejected,x)};function m(x,R,X){o(function(){var j;try{j=R(X)}catch(G){return l.reject(x,G)}j===x?l.reject(x,new TypeError("Cannot resolve promise with itself")):l.resolve(x,j)})}l.resolve=function(x,R){var X=k(g,R);if(X.status==="error")return l.reject(x,X.value);var j=X.value;if(j)v(x,j);else{x.state=d,x.outcome=R;for(var G=-1,ie=x.queue.length;++G<ie;)x.queue[G].callFulfilled(R)}return x},l.reject=function(x,R){x.state=c,x.outcome=R;for(var X=-1,j=x.queue.length;++X<j;)x.queue[X].callRejected(R);return x};function g(x){var R=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof R=="function")return function(){R.apply(x,arguments)}}function v(x,R){var X=!1;function j(ge){X||(X=!0,l.reject(x,ge))}function G(ge){X||(X=!0,l.resolve(x,ge))}function ie(){R(G,j)}var U=k(ie);U.status==="error"&&j(U.value)}function k(x,R){var X={};try{X.value=x(R),X.status="success"}catch(j){X.status="error",X.value=j}return X}u.resolve=L;function L(x){return x instanceof this?x:l.resolve(new this(a),x)}u.reject=M;function M(x){var R=new this(a);return l.reject(R,x)}u.all=D;function D(x){var R=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=x.length,j=!1;if(!X)return this.resolve([]);for(var G=new Array(X),ie=0,U=-1,ge=new this(a);++U<X;)pe(x[U],U);return ge;function pe(ke,B){R.resolve(ke).then(he,function(J){j||(j=!0,l.reject(ge,J))});function he(J){G[B]=J,++ie===X&&!j&&(j=!0,l.resolve(ge,G))}}}u.race=w;function w(x){var R=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=xLine truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mX(r,e){return uX(r)||fX(r,e)||OX(r,e)||pX()}function OX(r,e){if(r){if(typeof r=="string")return zQ(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?zQ(r,e):void 0}}var tT=Object.entries,WQ=Object.setPrototypeOf,gX=Object.isFrozen,bX=Object.getPrototypeOf,yX=Object.getOwnPropertyDescriptor,It=Object.freeze,Yt=Object.seal,ya=Object.create,rT=typeof Reflect!="undefined"&&Reflect,Mb=rT.apply,Lb=rT.construct;It||(It=function(e){return e});Yt||(Yt=function(e){return e});Mb||(Mb=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(t,i)});Lb||(Lb=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});var fo=Ct(Array.prototype.forEach),SX=Ct(Array.prototype.lastIndexOf),BQ=Ct(Array.prototype.pop),tc=Ct(Array.prototype.push),vX=Ct(Array.prototype.splice),Sa=Array.isArray,ic=Ct(String.prototype.toLowerCase),Tb=Ct(String.prototype.toString),VQ=Ct(String.prototype.match),rc=Ct(String.prototype.replace),YQ=Ct(String.prototype.indexOf),xX=Ct(String.prototype.trim),wX=Ct(Number.prototype.toString),PX=Ct(Boolean.prototype.toString),FQ=typeof BigInt=="undefined"?null:Ct(BigInt.prototype.toString),NQ=typeof Symbol=="undefined"?null:Ct(Symbol.prototype.toString),Rr=Ct(Object.prototype.hasOwnProperty),nc=Ct(Object.prototype.toString),ur=Ct(RegExp.prototype.test),uo=kX(TypeError);function Ct(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Mb(r,e,n)}}function kX(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Lb(r,t)}}function Ye(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ic;if(WQ&&WQ(r,null),!Sa(e))return r;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){let s=t(i);s!==i&&(gX(e)||(e[n]=s),i=s)}r[i]=!0}return r}function $X(r){for(let e=0;e<r.length;e++)Rr(r,e)||(r[e]=null);return r}function Kr(r){let e=ya(null);for(let n of tT(r)){var t=mX(n,2);let i=t[0],s=t[1];Rr(r,i)&&(Sa(s)?e[i]=$X(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=Kr(s):e[i]=s)}return e}function QX(r){switch(typeof r){case"string":return r;case"number":return wX(r);case"boolean":return PX(r);case"bigint":return FQ?FQ(r):"0";case"symbol":return NQ?NQ(r):"Symbol()";case"undefined":return nc(r);case"function":case"object":{if(r===null)return nc(r);let e=r,t=xn(e,"toString");if(typeof t=="function"){let n=t(e);return typeof n=="string"?n:nc(n)}return nc(r)}default:return nc(r)}}function xn(r,e){for(;r!==null;){let n=yX(r,e);if(n){if(n.get)return Ct(n.get);if(typeof n.value=="function")return Ct(n.value)}r=bX(r)}function t(){return null}return t}function TX(r){try{return ur(r,""),!0}catch(e){return!1}}var jQ=It(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),_b=It(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ab=It(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),_X=It(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-gly
Line truncated
|
|
|
|
|
`+Qe),yt&&(Qe=S(Qe)),G&&tr?B(Qe):Qe},e.setConfig=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bi(C),ne=!0,me=Se,qe=we},e.clearConfig=function(){Or=null,ne=!1,me=null,qe=null,G=U,ie=""},e.isValidAttribute=function(C,p,b){Or||bi({});let T=_e(C),I=_e(p);return Xe(T,I,b)},e.addHook=function(C,p){typeof p=="function"&&Rr(Oe,C)&&tc(Oe[C],p)},e.removeHook=function(C,p){if(Rr(Oe,C)){if(p!==void 0){let b=SX(Oe[C],p);return b===-1?void 0:vX(Oe[C],b,1)[0]}return BQ(Oe[C])}},e.removeHooks=function(C){Rr(Oe,C)&&(Oe[C]=[])},e.removeAllHooks=function(){Oe=eT()},e}var NX=iT();sT.exports=NX});var Ub=Gu(of());var Es="\u2190\u2191\u2193\u2192";var xc=[{keys:[Es],action:"Joypad"},{keys:["Space"],action:"Button A"},{keys:["Shift"],action:"Button B"}],af=[{keys:[Es],action:"Joystick"},{keys:["Space"],action:"Button 1"},{keys:["Shift"],action:"Button 2"},{keys:["\\"],action:"Coin"},{keys:["Enter"],action:"Start"}],vc=[...xc,{keys:["\\"],action:"Select"},{keys:["Enter"],action:"Start"}],p0=[{keys:[Es],action:"Joystick"},{keys:["Space"],action:"Button"}],m0={vcs:p0,c64:p0,apple2:[{keys:["Mouse"],action:"Paddles/Joystick"},{keys:["Click"],action:"Button 1"},{keys:["SHIFT-Click"],action:"Button 2"},{keys:["ALT-Click"],action:"Button 3"}],nes:vc,atari7800:vc,pce:vc,gb:vc,msx:xc,coleco:xc,sms:[...xc,{keys:["Enter"],action:"Start"}],vicdual:af,galaxian:af,vector:af,mw8080bw:[{keys:["\u2190\xA0\u2192"],action:"Joystick"},{keys:["Space"],action:"Fire"}],williams:[{keys:["A W S D"],action:"Move"},{keys:[Es],action:"Fire"},{keys:["\\"],action:"Coin"},{keys:["Enter"],action:"Start"},{keys:["6 7 8 9"],action:"Extra"}],astrocade:[{keys:[Es],action:"Joystick"},{keys:["Space"],action:"Trigger"},{keys:["Mouse X"],action:"Knob"},{keys:[`U I O P
|
|
|
|
|
import{a as d0}from"./chunk-NTFEI2OH.js";import{a as h0}from"./chunk-T6VURU5O.js";import{a as vc}from"./chunk-A7SWO6EA.js";import{a as u0,b as f0,c as s_}from"./chunk-EY5LTL52.js";import{C as nf,H as sf,t as l0,u as c0}from"./chunk-4WX2XTAI.js";import"./chunk-UACHXWHT.js";import{A as cn,E as dn,F as ef,G as xo,I as wo,J as yc,K as tf,T as rf,U as o0,X as a0,a as Gn,b as Ma,d as St,da as Sc,e as La,f as zt,g as Ce,h as Ku,i as r0,k as n0,m as Oc,n as gc,o as bc,p as Cs,q as i0,t as vo,w as s0,x as Ju,y as Da,z as ir}from"./chunk-EK7ZCXAS.js";import{a as gt,b as As,c as Ra,d as Gu,e as Hu}from"./chunk-VSC4MAII.js";var af=Gu((p0,of)=>{(function(r){if(typeof p0=="object"&&typeof of!="undefined")of.exports=r();else if(typeof define=="function"&&define.amd)define([],r);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=r()}})(function(){var r,e,t;return(function n(i,s,o){function a(d,h){if(!s[d]){if(!i[d]){var u=typeof Ra=="function"&&Ra;if(!h&&u)return u(d,!0);if(l)return l(d,!0);var f=new Error("Cannot find module '"+d+"'");throw f.code="MODULE_NOT_FOUND",f}var m=s[d]={exports:{}};i[d][0].call(m.exports,function(g){var v=i[d][1][g];return a(v||g)},m,m.exports,n,i,s,o)}return s[d].exports}for(var l=typeof Ra=="function"&&Ra,c=0;c<o.length;c++)a(o[c]);return a})({1:[function(n,i,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,l;if(a){var c=0,d=new a(g),h=o.document.createTextNode("");d.observe(h,{characterData:!0}),l=function(){h.data=c=++c%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var u=new o.MessageChannel;u.port1.onmessage=g,l=function(){u.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var k=o.document.createElement("script");k.onreadystatechange=function(){g(),k.onreadystatechange=null,k.parentNode.removeChild(k),k=null},o.document.documentElement.appendChild(k)}:l=function(){setTimeout(g,0)};var f,m=[];function g(){f=!0;for(var k,L,M=m.length;M;){for(L=m,m=[],k=-1;++k<M;)L[k]();M=m.length}f=!1}i.exports=v;function v(k){m.push(k)===1&&!f&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,s){"use strict";var o=n(1);function a(){}var l={},c=["REJECTED"],d=["FULFILLED"],h=["PENDING"];i.exports=u;function u(x){if(typeof x!="function")throw new TypeError("resolver must be a function");this.state=h,this.queue=[],this.outcome=void 0,x!==a&&v(this,x)}u.prototype.catch=function(x){return this.then(null,x)},u.prototype.then=function(x,R){if(typeof x!="function"&&this.state===d||typeof R!="function"&&this.state===c)return this;var X=new this.constructor(a);if(this.state!==h){var j=this.state===d?x:R;m(X,j,this.outcome)}else this.queue.push(new f(X,x,R));return X};function f(x,R,X){this.promise=x,typeof R=="function"&&(this.onFulfilled=R,this.callFulfilled=this.otherCallFulfilled),typeof X=="function"&&(this.onRejected=X,this.callRejected=this.otherCallRejected)}f.prototype.callFulfilled=function(x){l.resolve(this.promise,x)},f.prototype.otherCallFulfilled=function(x){m(this.promise,this.onFulfilled,x)},f.prototype.callRejected=function(x){l.reject(this.promise,x)},f.prototype.otherCallRejected=function(x){m(this.promise,this.onRejected,x)};function m(x,R,X){o(function(){var j;try{j=R(X)}catch(G){return l.reject(x,G)}j===x?l.reject(x,new TypeError("Cannot resolve promise with itself")):l.resolve(x,j)})}l.resolve=function(x,R){var X=k(g,R);if(X.status==="error")return l.reject(x,X.value);var j=X.value;if(j)v(x,j);else{x.state=d,x.outcome=R;for(var G=-1,ie=x.queue.length;++G<ie;)x.queue[G].callFulfilled(R)}return x},l.reject=function(x,R){x.state=c,x.outcome=R;for(var X=-1,j=x.queue.length;++X<j;)x.queue[X].callRejected(R);return x};function g(x){var R=x&&x.then;if(x&&(typeof x=="object"||typeof x=="function")&&typeof R=="function")return function(){R.apply(x,arguments)}}function v(x,R){var X=!1;function j(ge){X||(X=!0,l.reject(x,ge))}function G(ge){X||(X=!0,l.resolve(x,ge))}function ie(){R(G,j)}var U=k(ie);U.status==="error"&&j(U.value)}function k(x,R){var X={};try{X.value=x(R),X.status="success"}catch(j){X.status="error",X.value=j}return X}u.resolve=L;function L(x){return x instanceof this?x:l.resolve(new this(a),x)}u.reject=M;function M(x){var R=new this(a);return l.reject(R,x)}u.all=D;function D(x){var R=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=x.length,j=!1;if(!X)return this.resolve([]);for(var G=new Array(X),ie=0,U=-1,ge=new this(a);++U<X;)pe(x[U],U);return ge;function pe(ke,B){R.resolve(ke).then(he,function(J){j||(j=!0,l.reject(ge,J))});function he(J){G[B]=J,++ie===X&&!j&&(j=!0,l.resolve(ge,G))}}}u.race=w;function w(x){var R=this;if(Object.prototype.toString.call(x)!=="[object Array]")return this.reject(new TypeError("must be an array"));var X=xLine truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xX(r,e){return yX(r)||SX(r,e)||wX(r,e)||vX()}function wX(r,e){if(r){if(typeof r=="string")return YQ(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?YQ(r,e):void 0}}var sT=Object.entries,FQ=Object.setPrototypeOf,PX=Object.isFrozen,kX=Object.getPrototypeOf,$X=Object.getOwnPropertyDescriptor,It=Object.freeze,Ft=Object.seal,Sa=Object.create,oT=typeof Reflect!="undefined"&&Reflect,Lb=oT.apply,Db=oT.construct;It||(It=function(e){return e});Ft||(Ft=function(e){return e});Lb||(Lb=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(t,i)});Db||(Db=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});var fo=Ct(Array.prototype.forEach),QX=Ct(Array.prototype.lastIndexOf),NQ=Ct(Array.prototype.pop),rc=Ct(Array.prototype.push),TX=Ct(Array.prototype.splice),va=Array.isArray,sc=Ct(String.prototype.toLowerCase),_b=Ct(String.prototype.toString),jQ=Ct(String.prototype.match),nc=Ct(String.prototype.replace),UQ=Ct(String.prototype.indexOf),_X=Ct(String.prototype.trim),AX=Ct(Number.prototype.toString),CX=Ct(Boolean.prototype.toString),qQ=typeof BigInt=="undefined"?null:Ct(BigInt.prototype.toString),GQ=typeof Symbol=="undefined"?null:Ct(Symbol.prototype.toString),Mr=Ct(Object.prototype.hasOwnProperty),ic=Ct(Object.prototype.toString),ur=Ct(RegExp.prototype.test),uo=EX(TypeError);function Ct(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Lb(r,e,n)}}function EX(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Db(r,t)}}function Ye(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:sc;if(FQ&&FQ(r,null),!va(e))return r;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){let s=t(i);s!==i&&(PX(e)||(e[n]=s),i=s)}r[i]=!0}return r}function RX(r){for(let e=0;e<r.length;e++)Mr(r,e)||(r[e]=null);return r}function en(r){let e=Sa(null);for(let n of sT(r)){var t=xX(n,2);let i=t[0],s=t[1];Mr(r,i)&&(va(s)?e[i]=RX(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=en(s):e[i]=s)}return e}function MX(r){switch(typeof r){case"string":return r;case"number":return AX(r);case"boolean":return CX(r);case"bigint":return qQ?qQ(r):"0";case"symbol":return GQ?GQ(r):"Symbol()";case"undefined":return ic(r);case"function":case"object":{if(r===null)return ic(r);let e=r,t=wn(e,"toString");if(typeof t=="function"){let n=t(e);return typeof n=="string"?n:ic(n)}return ic(r)}default:return ic(r)}}function wn(r,e){for(;r!==null;){let n=$X(r,e);if(n){if(n.get)return Ct(n.get);if(typeof n.value=="function")return Ct(n.value)}r=kX(r)}function t(){return null}return t}function LX(r){try{return ur(r,""),!0}catch(e){return!1}}var HQ=It(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ab=It(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Cb=It(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),DX=It(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-gly
Line truncated
|
|
|
|
|
`+Qe),yt&&(Qe=S(Qe)),G&&tr?B(Qe):Qe},e.setConfig=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bi(C),ne=!0,me=Se,qe=we},e.clearConfig=function(){Or=null,ne=!1,me=null,qe=null,G=U,ie=""},e.isValidAttribute=function(C,p,b){Or||bi({});let T=_e(C),I=_e(p);return Xe(T,I,b)},e.addHook=function(C,p){typeof p=="function"&&Mr(Oe,C)&&rc(Oe[C],p)},e.removeHook=function(C,p){if(Mr(Oe,C)){if(p!==void 0){let b=QX(Oe[C],p);return b===-1?void 0:TX(Oe[C],b,1)[0]}return NQ(Oe[C])}},e.removeHooks=function(C){Mr(Oe,C)&&(Oe[C]=[])},e.removeAllHooks=function(){Oe=iT()},e}var JX=lT();cT.exports=JX});var qb=Hu(af());var Es="\u2190\u2191\u2193\u2192";var wc=[{keys:[Es],action:"Joypad"},{keys:["Space"],action:"Button A"},{keys:["Shift"],action:"Button B"}],lf=[{keys:[Es],action:"Joystick"},{keys:["Space"],action:"Button 1"},{keys:["Shift"],action:"Button 2"},{keys:["\\"],action:"Coin"},{keys:["Enter"],action:"Start"}],xc=[...wc,{keys:["\\"],action:"Select"},{keys:["Enter"],action:"Start"}],m0=[{keys:[Es],action:"Joystick"},{keys:["Space"],action:"Button"}],O0={vcs:m0,c64:m0,apple2:[{keys:["Mouse"],action:"Paddles/Joystick"},{keys:["Click"],action:"Button 1"},{keys:["SHIFT-Click"],action:"Button 2"},{keys:["ALT-Click"],action:"Button 3"}],nes:xc,atari7800:xc,pce:xc,gb:xc,msx:wc,coleco:wc,sms:[...wc,{keys:["Enter"],action:"Start"}],vicdual:lf,galaxian:lf,vector:lf,mw8080bw:[{keys:["\u2190\xA0\u2192"],action:"Joystick"},{keys:["Space"],action:"Fire"}],williams:[{keys:["A W S D"],action:"Move"},{keys:[Es],action:"Fire"},{keys:["\\"],action:"Coin"},{keys:["Enter"],action:"Start"},{keys:["6 7 8 9"],action:"Extra"}],astrocade:[{keys:[Es],action:"Joystick"},{keys:["Space"],action:"Trigger"},{keys:["Mouse X"],action:"Knob"},{keys:[`U I O P
|
|
|
|
|
J K L /
|
|
|
|
|
7 8 9 X
|
|
|
|
|
4 5 6 -
|
|
|
|
|
1 2 3 ,
|
|
|
|
|
\\ 0 . =`],action:"Keypad"}],vectrex:[{keys:[Es],action:"Joystick"},{keys:["Z X C V"],action:"Buttons"}],atari8:[{keys:[Es],action:"Joystick"},{keys:["Shift"],action:"Button"},{keys:["F1"],action:"Start"},{keys:["F2"],action:"Select"},{keys:["F3"],action:"Option"}],pacman:[{keys:["\u2190\xA0\u2192"],action:"Joystick"},{keys:["Space"],action:"Fire"},{keys:["5","6"],action:"Coin"},{keys:["Enter","2"],action:"Start"}]};var r_={left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown"},lf=null;function Po(){if(lf===null){var r=typeof navigator!="undefined"?navigator:null;lf=!!r&&/mac|iphone|ipad|ipod/i.test(r.platform||r.userAgent||"")}return lf}function df(r){var e=r.toLowerCase().split("+"),t=e.pop(),n={mod:!1,shift:!1,key:""};for(var i of e)if(i=="mod"||i=="ctrl"||i=="meta"||i=="cmd")n.mod=!0;else if(i=="shift")n.shift=!0;else return console.warn('Keyboard shortcut "'+r+'": unsupported modifier "'+i+'" (alt is layout-dependent), skipping'),null;t=r_[t]||t;var s=/^[a-z]$/.test(t),o=/^f([1-9]|1[0-2])$/.test(t);return!s&&!o&&!/^[0-9]$/.test(t)&&!/^arrow/.test(t)?(console.warn('Keyboard shortcut "'+r+'": key "'+t+'" is layout-dependent (use a-z, 0-9, f1-f12), skipping'),null):n.shift&&!s&&!/^arrow/.test(t)?(console.warn('Keyboard shortcut "'+r+'": shift is only allowed with letters and arrows, skipping'),null):(n.key=t,n)}function n_(r,e){if(e.altKey)return!1;var t=Po(),n=t?e.metaKey:e.ctrlKey,i=t?e.ctrlKey:e.metaKey;return r.mod!==n||i||r.shift!==e.shiftKey?!1:(e.key||"").toLowerCase()===r.key}var wc=class{constructor(){this.bindings=[];this.handler=e=>{if(!e.defaultPrevented)for(var t=0;t<this.bindings.length;t++){var n=this.bindings[t];if(n_(n.binding,e)){e.preventDefault(),e.stopPropagation(),n.fn(e);return}}}}bind(e,t){var n=df(e);n&&this.bindings.push({binding:n,fn:t})}unbindAll(){this.bindings=[]}attach(){window.addEventListener("keydown",this.handler)}detach(){window.removeEventListener("keydown",this.handler)}},i_={mod:"Mod",cmd:"Mod",meta:"Mod",ctrl:"Ctrl",control:"Ctrl",shift:"Shift",alt:"Alt",option:"Alt"},cf=null;function s_(){if(cf===null){var r=typeof navigator!="undefined"?navigator:null;cf=!!r&&/win/i.test(r.platform||r.userAgent||"")}return cf}function O0(r){var e=r.split("-"),t=e.pop();t===""&&(t="-");var n=[];for(var i of e)if(i!==""){var s=i_[i.toLowerCase()]||i;s=="Ctrl"&&!Po()&&(s="Mod"),n.indexOf(s)<0&&n.push(s)}return n.sort(),n.concat([t.toLowerCase()]).join("-")}function o_(r){var e=Po()?r.mac:s_()?r.win:r.linux;return e||r.key}var hf=["Mod-Shift-a","Mod-Shift-d","Mod-Shift-e","Mod-Shift-f","Mod-Shift-g","Mod-Shift-h","Mod-Shift-i","Mod-Shift-j","Mod-Shift-k","Mod-Shift-l","Mod-Shift-r","Mod-Shift-x","Mod-Shift-y"];function uf(r,e){var t=e.map(O0);return r.filter(function(n){var i=o_(n);return!i||t.indexOf(O0(i))<0})}var a_={shift:"\u21E7",ctrl:"\u2303",alt:"\u2325",meta:"\u2318",mod:"\u2318",cmd:"\u2318"},l_={shift:"Shift",ctrl:"Ctrl",alt:"Alt",meta:"Win",mod:"Ctrl",cmd:"Cmd"},c_={arrowleft:"\u2190",arrowright:"\u2192",arrowup:"\u2191",arrowdown:"\u2193",backspace:"\u232B",enter:"\u21A9",tab:"\u21E5",escape:"\u238B",space:"\u2423"};function pf(r){var e=r.toLowerCase().split("+"),t=e.pop(),n=Po(),i=n?["shift","ctrl","alt","meta","mod","cmd"]:["mod","ctrl","shift","alt","meta","cmd"],s=i.filter(c=>e.indexOf(c)>=0);for(var o of e)s.indexOf(o)<0&&s.push(o);var a=s.map(c=>n?a_[c]||c:l_[c]||c).join(n?"":"+"),l=/^[a-z][0-9]?$/.test(t)?t.toUpperCase():c_[t]||(n?t:t.charAt(0).toUpperCase()+t.slice(1));return(a?a+(n?"":"+"):"")+l}var ff=class{constructor(e){this.shortcutsSig="";this.status={};this.visible=!0;this.pendingShortcuts=!1;this.pendingStatus=!1;this.div=e,this.shortcutsZone=$(document.createElement("span")).addClass("shortcuts_zone"),this.statusZone=$(document.createElement("span")).addClass("status_zone"),$(e).append(this.shortcutsZone).append(this.statusZone)}setShortcuts(e){if(this.visible){var t=e.map(s=>s.key+""+s.label).join("");if(t!==this.shortcutsSig){if(Da){this.pendingShortcuts=!0;return}this.shortcutsSig=t,this.shortcutsZone.empty();for(var n of e){var i=$(document.createElement("span")).addClass("shortcut");i.append($(document.createElement("kbd")).text(pf(n.key))),i.append(document.createTextNode(" "+n.label)),n.fn&&g0(i,n.fn),this.shortcutsZone.append(i)}}}}setStatus(e,t){t?this.status[e]=t:delete this.status[e],this.renderStatus()}renderStatus(){if(this.visible){if(Da){this.pendingStatus=!0;return}this.statusZone.empty();for(var e of Object.keys(this.status)){var t=this.status[e],n=$(document.createElement("span")).addClass("status_item");t.cls&&n.addClass(t.cls),t.title&&n.prop("title",t.title),n.text(t.text),t.fn&&g0(n,t.fn),this.statusZone.append(n)}}}};function g0(r,e){r.addClass("clickable"),r.mousedown(t=>t.preventDefault()),r.click(e)}var Da=!1;function b0(){Zr&&(Zr.pendingShortcuts&&(Zr.pendingShortcuts=!1,Xr()),Zr.pendingStatus&&(Zr.pendingStatus=!1,Zr.renderStatus()))}function d_(){$(document).on("mousedown.shortcutbar",()=>{Da=!0}),$(document).on(
Line truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g_(r,e){return p_(r)||m_(r,e)||b_(r,e)||O_()}function b_(r,e){if(r){if(typeof r=="string")return _0(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_0(r,e):void 0}}var Y0=Object.entries,A0=Object.setPrototypeOf,y_=Object.isFrozen,S_=Object.getPrototypeOf,v_=Object.getOwnPropertyDescriptor,Mt=Object.freeze,Wt=Object.seal,ko=Object.create,F0=typeof Reflect!="undefined"&&Reflect,vf=F0.apply,xf=F0.construct;Mt||(Mt=function(e){return e});Wt||(Wt=function(e){return e});vf||(vf=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(t,i)});xf||(xf=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});var Ms=$t(Array.prototype.forEach),x_=$t(Array.prototype.lastIndexOf),C0=$t(Array.prototype.pop),Ia=$t(Array.prototype.push),w_=$t(Array.prototype.splice),$o=Array.isArray,za=$t(String.prototype.toLowerCase),mf=$t(String.prototype.toString),E0=$t(String.prototype.match),Za=$t(String.prototype.replace),R0=$t(String.prototype.indexOf),P_=$t(String.prototype.trim),k_=$t(Number.prototype.toString),$_=$t(Boolean.prototype.toString),M0=typeof BigInt=="undefined"?null:$t(BigInt.prototype.toString),L0=typeof Symbol=="undefined"?null:$t(Symbol.prototype.toString),$r=$t(Object.prototype.hasOwnProperty),Xa=$t(Object.prototype.toString),sr=$t(RegExp.prototype.test),Rs=Q_(TypeError);function $t(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return vf(r,e,n)}}function Q_(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return xf(r,t)}}function Ve(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:za;if(A0&&A0(r,null),!$o(e))return r;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){let s=t(i);s!==i&&(y_(e)||(e[n]=s),i=s)}r[i]=!0}return r}function T_(r){for(let e=0;e<r.length;e++)$r(r,e)||(r[e]=null);return r}function Br(r){let e=ko(null);for(let n of Y0(r)){var t=g_(n,2);let i=t[0],s=t[1];$r(r,i)&&($o(s)?e[i]=T_(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=Br(s):e[i]=s)}return e}function __(r){switch(typeof r){case"string":return r;case"number":return k_(r);case"boolean":return $_(r);case"bigint":return M0?M0(r):"0";case"symbol":return L0?L0(r):"Symbol()";case"undefined":return Xa(r);case"function":case"object":{if(r===null)return Xa(r);let e=r,t=cn(e,"toString");if(typeof t=="function"){let n=t(e);return typeof n=="string"?n:Xa(n)}return Xa(r)}default:return Xa(r)}}function cn(r,e){for(;r!==null;){let n=v_(r,e);if(n){if(n.get)return $t(n.get);if(typeof n.value=="function")return $t(n.value)}r=S_(r)}function t(){return null}return t}function A_(r){try{return sr(r,""),!0}catch(e){return!1}}var D0=Mt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Of=Mt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),gf=Mt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),C_=Mt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-gly
Line truncated
|
|
|
|
|
`+Qe),yt&&(Qe=S(Qe)),G&&tr?B(Qe):Qe},e.setConfig=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bi(C),ne=!0,me=Se,qe=we},e.clearConfig=function(){Or=null,ne=!1,me=null,qe=null,G=U,ie=""},e.isValidAttribute=function(C,p,b){Or||bi({});let T=_e(C),I=_e(p);return Xe(T,I,b)},e.addHook=function(C,p){typeof p=="function"&&$r(Oe,C)&&Ia(Oe[C],p)},e.removeHook=function(C,p){if($r(Oe,C)){if(p!==void 0){let b=x_(Oe[C],p);return b===-1?void 0:w_(Oe[C],b,1)[0]}return C0(Oe[C])}},e.removeHooks=function(C){$r(Oe,C)&&(Oe[C]=[])},e.removeAllHooks=function(){Oe=V0()},e}var Yi=j0();var U_=kf(),U0=["clk","reset"],$f=class{constructor(e,t){this.lines=[];this.zoom=8;this.t0=0;this.tsel=-1;this.tnow=-1;this.hexformat=!0;this.scrollbarWidth=12;this.parent=e,this.wfp=t,this.parent.setAttribute("tabindex","-1"),this.parent.addEventListener("mousedown",n=>{n.preventDefault(),this.parent.focus()}),k0(this.parent,()=>this.getShortcuts()),Q0(this.parent,"verilog-waveform"),this.recreate()}getShortcuts(){return[{key:"=",label:"Zoom In",fn:()=>this.setZoom(this.zoom*2)},{key:"-",label:"Zoom Out",fn:()=>this.setZoom(this.zoom/2)},{key:"ctrl+shift+left",label:"To Start",fn:()=>{this.setSelTime(0),this.setOrgTime(0)}},{key:"shift+left",label:"Page Left",fn:()=>this.setSelTime(this.tsel-this.clocksPerPage/4)},{key:"left",label:"Left",fn:()=>this.setSelTime(this.tsel-1)},{key:"right",label:"Right",fn:()=>this.setSelTime(this.tsel+1)},{key:"shift+right",label:"Page Right",fn:()=>this.setSelTime(this.tsel+this.clocksPerPage/4)},{key:"space",label:"Go To Current",fn:()=>{this.setOrgTime(this.tnow),this.setSelTime(this.tnow)}},{key:"h",label:"Hex/Dec",fn:()=>{this.hexformat=!this.hexformat,this.refresh()}}]}recreate(){clearTimeout(this.wtimer),this.wtimer=setTimeout(()=>{this.destroy(),this._recreate()},0)}destroy(){this.wavelist&&($(this.wavelist.container).remove(),this.wavelist=null),this.toolbar&&(this.toolbar.destroy(),this.toolbar=null),this.clklabel&&(this.clklabel.remove(),this.clklabel=null)}_recreate(){if(this.meta=this.wfp.getSignalMetadata(),!!this.meta){var e=$(this.parent).width();this.pageWidth=e-this.scrollbarWidth;var t=40;this.setClocksPerPage(),this.clockMax=0,this.wavelist=new zr({w:e,h:$(this.parent).height(),itemHeight:t,totalRows:this.meta.length+1,generatorFn:o=>{var a=this.meta[o];let l=document.createElement("div"),c=document.createElement("canvas");return c.width=e-12,c.height=t,l.appendChild(c),l.classList.add("waverow"),this.lines[o]=c,this.refreshRow(o),a&&a.input&&U0.indexOf(a.label)<0&&(l.onmousedown=d=>{var h=this.meta[o];h&&h.input&&this.changeInputValue(o)},l.classList.add("editable"),l.style.cursor="grab"),l}});var n=this.wavelist.container;n.tabIndex=-1,this.toolbar=new Bi(this.parent,this.parent),this.toolbar.span.css("display","inline-block"),this.clklabel=document.createElement("span"),this.clklabel.innerText="-",$(this.parent).append(this.clklabel),$(this.parent).append(n);var i=!1,s=o=>{this.setSelTime(o.offsetX/this.zoom+this.t0-.5)};$(n).mousedown(o=>{i=!0,s(o)}),$(n).mousemove(o=>{i&&s(o)}),$(n).mouseup(o=>{i=!1}),$(n).on("wheel",o=>{if(Math.abs(o.originalEvent.deltaX)>Math.abs(o.originalEvent.deltaY)){var a=Math.max(-1e3,Math.min(1e3,o.originalEvent.deltaX));a&&this.setOrgTime(this.t0+a)}}),this.toolbar.add("=","Zoom In","glyphicon-zoom-in",(o,a)=>{this.setZoom(this.zoom*2)}),this.toolbar.add("+","Zoom In",null,(o,a)=>{this.setZoom(this.zoom*2)}),this.toolbar.add("-","Zoom Out","glyphicon-zoom-out",(o,a)=>{this.setZoom(this.zoom/2)}),this.toolbar.add("ctrl+shift+left","Move to beginning","glyphicon-backward",(o,a)=>{this.setSelTime(0),this.setOrgTime(0)}),this.toolbar.add("shift+left","Move left 1/4 page","glyphicon-fast-backward",(o,a)=>{this.setSelTime(this.tsel-this.clocksPerPage/4)}),this.toolbar.add("left","Move left 1 clock","glyphicon-step-backward",(o,a)=>{this.setSelTime(this.tsel-1)}),this.toolbar.add("right","Move right 1 clock","glyphicon-step-forward",(o,a)=>{this.setSelTime(this.tsel+1)}),this.toolbar.add("shift+right","Move right 1/4 page","glyphicon-fast-forward",(o,a)=>{this.setSelTime(this.tsel+this.clocksPerPage/4)}),this.toolbar.add("space","Go to current time","glyphicon-flash",(o,a)=>{this.setOrgTime(this.tnow),this.setSelTime(this.tnow)}),this.toolbar.add("h","Switch between hex/decimal format","glyphicon-barcode",(o,a)=>{this.hexformat=!this.hexformat,this.refresh()}),$(window).resize(()=>{this.recreate()})}}roundT(e){return e=Math.round(e),e=Math.max(0,e),e=Math.min(this.clockMax+this.clocksPerPage/2,e),e}setOrgTime(e){this.t0=this.roundT(e),this.refresh()}setCurrentTime(e){this.tnow=this.roundT(e),this.refresh()}setSelTime(e){e=this.roundT(e),e>=this.t0+this.clocksPerPage-1&&(this.t0+=this.clocksPerPage/4),e<=this.t0+2&&(this.t0-=this.clocksPerPage/4),this.tsel=e,this.setOrgTime(this.t0),this.clklabel.innerText=" clk "+this.tsel}setClocksPerPage(){this.clocksPerPage=Math.floor(this.pageWidth/this.zoom)-1}setZoom(e){this.zoom=Math.max(1/16,Math.min(6
Line truncated
|
|
|
|
|
`);for(let i of e||[]){let s=i instanceof RegExp?{re:i}:i;for(let o of n){let a;for(s.re.lastIndex=0;a=s.re.exec(o);){let l=a[s.group!=null?s.group:a.length-1];l&&t.push(s.suffix?l+s.suffix:l)}}}return t}var An={vcs:{arch:"6502",code_start:4096,code_size:61440,data_start:128,data_size:128,wiz_rom_ext:".a26",wiz_inc_dir:"2600",cfgfile:"atari2600.cfg",libargs:["crt0.o","atari2600.lib"],extra_link_files:["crt0.o","atari2600.cfg"],asm_cfgfile:"atari2600-asm.cfg",asm_libargs:[],asm_extra_link_files:["atari2600-asm.cfg"],define:["__ATARI2600__"]},mw8080bw:{arch:"z80",code_start:0,rom_size:8192,data_start:8192,data_size:1024,stack_end:9216},vicdual:{arch:"z80",code_start:0,rom_size:16416,data_start:58368,data_size:1024,stack_end:59392},galaxian:{arch:"z80",code_start:0,rom_size:16384,data_start:16384,data_size:1024,stack_end:18432},"galaxian-scramble":{arch:"z80",code_start:0,rom_size:20512,data_start:16384,data_size:1024,stack_end:18432},pacman:{arch:"z80",code_start:0,codeseg_start:202,rom_size:32768,data_start:19456,data_size:652,stack_end:20416},williams:{arch:"6809",code_start:0,rom_size:49152,data_start:38912,data_size:10240,stack_end:49152,set_stack_end:49152,extra_link_files:["williams.scr","libcmoc-crt-vec.a","libcmoc-std-vec.a"],extra_link_args:["-swilliams.scr","-lcmoc-crt-vec","-lcmoc-std-vec"],extra_compile_files:["assert.h","cmoc.h","stdarg.h","stdlib.h"]},"williams-defender":{arch:"6809",code_start:0,rom_size:49152,data_start:38912,data_size:10240,stack_end:49152},"williams-z80":{arch:"z80",code_start:0,rom_size:38912,data_start:38912,data_size:10240,stack_end:49152},"vector-z80color":{arch:"z80",code_start:0,rom_size:32768,data_start:57344,data_size:8192,stack_end:0},"vector-ataricolor":{arch:"6502",define:["__VECTOR__"],cfgfile:"vector-color.cfg",libargs:["crt0.o","none.lib"],extra_link_files:["crt0.o","vector-color.cfg"]},"sound_williams-z80":{arch:"z80",code_start:0,rom_size:16384,data_start:16384,data_size:1024,stack_end:32768},base_z80:{arch:"z80",code_start:0,rom_size:32768,data_start:32768,data_size:32768,stack_end:0},coleco:{arch:"z80",rom_start:32768,code_start:33024,rom_size:32768,data_start:28672,data_size:1024,stack_end:32768,extra_preproc_args:["-I","/share/include/coleco","-D","CV_CV"],extra_link_args:["-k","/share/lib/coleco","-l","libcv","-l","libcvu","crt0.rel"]},msx:{arch:"z80",rom_start:16384,code_start:16384,rom_size:32768,data_start:49152,data_size:12288,stack_end:65535,extra_link_args:["crt0-msx.rel"],extra_link_files:["crt0-msx.rel","crt0-msx.lst"],wiz_sys_type:"z80",wiz_inc_dir:"msx"},"msx-libcv":{arch:"z80",rom_start:16384,code_start:16384,rom_size:32768,data_start:49152,data_size:12288,stack_end:65535,extra_preproc_args:["-I",".","-D","CV_MSX"],extra_link_args:["-k",".","-l","libcv-msx","-l","libcvu-msx","crt0-msx.rel"],extra_link_files:["libcv-msx.lib","libcvu-msx.lib","crt0-msx.rel","crt0-msx.lst"],extra_compile_files:["cv.h","cv_graphics.h","cv_input.h","cv_sound.h","cv_support.h","cvu.h","cvu_c.h","cvu_compression.h","cvu_f.h","cvu_graphics.h","cvu_input.h","cvu_sound.h"]},"sms-sg1000-libcv":{arch:"z80",rom_start:0,code_start:256,rom_size:49152,data_start:49152,data_size:1024,stack_end:57344,extra_preproc_args:["-I",".","-D","CV_SMS"],extra_link_args:["-k",".","-l","libcv-sms","-l","libcvu-sms","crt0-sms.rel"],extra_link_files:["libcv-sms.lib","libcvu-sms.lib","crt0-sms.rel","crt0-sms.lst"],extra_compile_files:["cv.h","cv_graphics.h","cv_input.h","cv_sound.h","cv_support.h","cvu.h","cvu_c.h","cvu_compression.h","cvu_f.h","cvu_graphics.h","cvu_input.h","cvu_sound.h"]},nes:{arch:"6502",define:["__NES__"],cfgfile:"neslib2.cfg",libargs:["crt0.o","nes.lib","neslib2.lib","-D","NES_MAPPER=0","-D","NES_PRG_BANKS=2","-D","NES_CHR_BANKS=1","-D","NES_MIRRORING=0"],extra_link_files:["crt0.o","neslib2.lib","neslib2.cfg","nesbanked.cfg"],symbolConfigs:{NES_MAPPER:{4:"nesbanked.cfg"}},ignore_segments:["HEADER","CHARS"],wiz_rom_ext:".nes"},apple2:{arch:"6502",define:["__APPLE2__"],cfgfile:"apple2.cfg",libargs:["--lib-path","/share/target/apple2/drv","apple2.lib"],__CODE_RUN__:16384,code_start:2051,acmeargs:["-f","apple"]},"apple2-e":{arch:"6502",define:["__APPLE2__"],cfgfile:"apple2.cfg",libargs:["apple2.lib"],acmeargs:["-f","apple"]},"atari8-800xl.disk":{arch:"6502",define:["__ATARI__"],cfgfile:"atari.cfg",libargs:["atari.lib"],fastbasic_cfgfile:"fastbasic-cart.cfg",ignore_segments:["EXEHDR","SYSCHKHDR","SYSCHKTRL","MAINHDR","AUTOSTRT"]},"atari8-800xl":{arch:"6502",define:["__ATARI__"],cfgfile:"atari-cart.cfg",libargs:["atari.lib","-D","__CARTFLAGS__=4"],fastbasic_cfgfile:"fastbasic-cart.cfg"},"atari8-800":{arch:"6502",define:["__ATARI__"],cfgfile:"atari-cart.cfg",libargs:["atari.lib","-D","__CARTFLAGS__=4"],fastbasic_cfgfile:"fastbasic-cart.cfg"},"atari8-5200":{arch:"6502",define:["__ATARI5200__"],cfgfile:"atari5200.cfg",libargs:["atari5200.lib","-D","__CARTFLAGS__=255"],fastbasic_cfgfile:"fastbasic-cart.cfg"},verilog:{arch:"verilog",extra_compile_files:["8bitworkshop.v"]},astrocad
Line truncated
|
|
|
|
|
\\ 0 . =`],action:"Keypad"}],vectrex:[{keys:[Es],action:"Joystick"},{keys:["Z X C V"],action:"Buttons"}],atari8:[{keys:[Es],action:"Joystick"},{keys:["Shift"],action:"Button"},{keys:["F1"],action:"Start"},{keys:["F2"],action:"Select"},{keys:["F3"],action:"Option"}],pacman:[{keys:["\u2190\xA0\u2192"],action:"Joystick"},{keys:["Space"],action:"Fire"},{keys:["5","6"],action:"Coin"},{keys:["Enter","2"],action:"Start"}]};var o_={left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown"},cf=null;function Po(){if(cf===null){var r=typeof navigator!="undefined"?navigator:null;cf=!!r&&/mac|iphone|ipad|ipod/i.test(r.platform||r.userAgent||"")}return cf}function hf(r){var e=r.toLowerCase().split("+"),t=e.pop(),n={mod:!1,shift:!1,key:""};for(var i of e)if(i=="mod"||i=="ctrl"||i=="meta"||i=="cmd")n.mod=!0;else if(i=="shift")n.shift=!0;else return console.warn('Keyboard shortcut "'+r+'": unsupported modifier "'+i+'" (alt is layout-dependent), skipping'),null;t=o_[t]||t;var s=/^[a-z]$/.test(t),o=/^f([1-9]|1[0-2])$/.test(t);return!s&&!o&&!/^[0-9]$/.test(t)&&!/^arrow/.test(t)?(console.warn('Keyboard shortcut "'+r+'": key "'+t+'" is layout-dependent (use a-z, 0-9, f1-f12), skipping'),null):n.shift&&!s&&!/^arrow/.test(t)?(console.warn('Keyboard shortcut "'+r+'": shift is only allowed with letters and arrows, skipping'),null):(n.key=t,n)}function a_(r,e){if(e.altKey)return!1;var t=Po(),n=t?e.metaKey:e.ctrlKey,i=t?e.ctrlKey:e.metaKey;return r.mod!==n||i||r.shift!==e.shiftKey?!1:(e.key||"").toLowerCase()===r.key}var Pc=class{constructor(){this.bindings=[];this.handler=e=>{if(!e.defaultPrevented)for(var t=0;t<this.bindings.length;t++){var n=this.bindings[t];if(a_(n.binding,e)){e.preventDefault(),e.stopPropagation(),n.fn(e);return}}}}bind(e,t){var n=hf(e);n&&this.bindings.push({binding:n,fn:t})}unbindAll(){this.bindings=[]}attach(){window.addEventListener("keydown",this.handler)}detach(){window.removeEventListener("keydown",this.handler)}},l_={mod:"Mod",cmd:"Mod",meta:"Mod",ctrl:"Ctrl",control:"Ctrl",shift:"Shift",alt:"Alt",option:"Alt"},df=null;function c_(){if(df===null){var r=typeof navigator!="undefined"?navigator:null;df=!!r&&/win/i.test(r.platform||r.userAgent||"")}return df}function g0(r){var e=r.split("-"),t=e.pop();t===""&&(t="-");var n=[];for(var i of e)if(i!==""){var s=l_[i.toLowerCase()]||i;s=="Ctrl"&&!Po()&&(s="Mod"),n.indexOf(s)<0&&n.push(s)}return n.sort(),n.concat([t.toLowerCase()]).join("-")}function d_(r){var e=Po()?r.mac:c_()?r.win:r.linux;return e||r.key}var uf=["Mod-Shift-a","Mod-Shift-d","Mod-Shift-e","Mod-Shift-f","Mod-Shift-g","Mod-Shift-h","Mod-Shift-i","Mod-Shift-j","Mod-Shift-k","Mod-Shift-l","Mod-Shift-r","Mod-Shift-x","Mod-Shift-y"];function ff(r,e){var t=e.map(g0);return r.filter(function(n){var i=d_(n);return!i||t.indexOf(g0(i))<0})}var h_={shift:"\u21E7",ctrl:"\u2303",alt:"\u2325",meta:"\u2318",mod:"\u2318",cmd:"\u2318"},u_={shift:"Shift",ctrl:"Ctrl",alt:"Alt",meta:"Win",mod:"Ctrl",cmd:"Cmd"},f_={arrowleft:"\u2190",arrowright:"\u2192",arrowup:"\u2191",arrowdown:"\u2193",backspace:"\u232B",enter:"\u21A9",tab:"\u21E5",escape:"\u238B",space:"\u2423"};function mf(r){var e=r.toLowerCase().split("+"),t=e.pop(),n=Po(),i=n?["shift","ctrl","alt","meta","mod","cmd"]:["mod","ctrl","shift","alt","meta","cmd"],s=i.filter(c=>e.indexOf(c)>=0);for(var o of e)s.indexOf(o)<0&&s.push(o);var a=s.map(c=>n?h_[c]||c:u_[c]||c).join(n?"":"+"),l=/^[a-z][0-9]?$/.test(t)?t.toUpperCase():f_[t]||(n?t:t.charAt(0).toUpperCase()+t.slice(1));return(a?a+(n?"":"+"):"")+l}var pf=class{constructor(e){this.shortcutsSig="";this.status={};this.visible=!0;this.pendingShortcuts=!1;this.pendingStatus=!1;this.div=e,this.shortcutsZone=$(document.createElement("span")).addClass("shortcuts_zone"),this.statusZone=$(document.createElement("span")).addClass("status_zone"),$(e).append(this.shortcutsZone).append(this.statusZone)}setShortcuts(e){if(this.visible){var t=e.map(s=>s.key+""+s.label).join("");if(t!==this.shortcutsSig){if(Ia){this.pendingShortcuts=!0;return}this.shortcutsSig=t,this.shortcutsZone.empty();for(var n of e){var i=$(document.createElement("span")).addClass("shortcut");i.append($(document.createElement("kbd")).text(mf(n.key))),i.append(document.createTextNode(" "+n.label)),n.fn&&b0(i,n.fn),this.shortcutsZone.append(i)}}}}setStatus(e,t){t?this.status[e]=t:delete this.status[e],this.renderStatus()}renderStatus(){if(this.visible){if(Ia){this.pendingStatus=!0;return}this.statusZone.empty();for(var e of Object.keys(this.status)){var t=this.status[e],n=$(document.createElement("span")).addClass("status_item");t.cls&&n.addClass(t.cls),t.title&&n.prop("title",t.title),n.text(t.text),t.fn&&b0(n,t.fn),this.statusZone.append(n)}}}};function b0(r,e){r.addClass("clickable"),r.mousedown(t=>t.preventDefault()),r.click(e)}var Ia=!1;function y0(){Xr&&(Xr.pendingShortcuts&&(Xr.pendingShortcuts=!1,zr()),Xr.pendingStatus&&(Xr.pendingStatus=!1,Xr.renderStatus()))}function p_(){$(document).on("mousedown.shortcutbar",()=>{Ia=!0}),$(document).on(
Line truncated
|
|
|
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v_(r,e){return b_(r)||y_(r,e)||x_(r,e)||S_()}function x_(r,e){if(r){if(typeof r=="string")return A0(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A0(r,e):void 0}}var F0=Object.entries,C0=Object.setPrototypeOf,w_=Object.isFrozen,P_=Object.getPrototypeOf,k_=Object.getOwnPropertyDescriptor,Mt=Object.freeze,Wt=Object.seal,ko=Object.create,N0=typeof Reflect!="undefined"&&Reflect,xf=N0.apply,wf=N0.construct;Mt||(Mt=function(e){return e});Wt||(Wt=function(e){return e});xf||(xf=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];return e.apply(t,i)});wf||(wf=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});var Ms=$t(Array.prototype.forEach),$_=$t(Array.prototype.lastIndexOf),E0=$t(Array.prototype.pop),Za=$t(Array.prototype.push),Q_=$t(Array.prototype.splice),$o=Array.isArray,Wa=$t(String.prototype.toLowerCase),Of=$t(String.prototype.toString),R0=$t(String.prototype.match),Xa=$t(String.prototype.replace),M0=$t(String.prototype.indexOf),T_=$t(String.prototype.trim),__=$t(Number.prototype.toString),A_=$t(Boolean.prototype.toString),L0=typeof BigInt=="undefined"?null:$t(BigInt.prototype.toString),D0=typeof Symbol=="undefined"?null:$t(Symbol.prototype.toString),$r=$t(Object.prototype.hasOwnProperty),za=$t(Object.prototype.toString),sr=$t(RegExp.prototype.test),Rs=C_(TypeError);function $t(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return xf(r,e,n)}}function C_(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return wf(r,t)}}function Ve(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Wa;if(C0&&C0(r,null),!$o(e))return r;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){let s=t(i);s!==i&&(w_(e)||(e[n]=s),i=s)}r[i]=!0}return r}function E_(r){for(let e=0;e<r.length;e++)$r(r,e)||(r[e]=null);return r}function Vr(r){let e=ko(null);for(let n of F0(r)){var t=v_(n,2);let i=t[0],s=t[1];$r(r,i)&&($o(s)?e[i]=E_(s):s&&typeof s=="object"&&s.constructor===Object?e[i]=Vr(s):e[i]=s)}return e}function R_(r){switch(typeof r){case"string":return r;case"number":return __(r);case"boolean":return A_(r);case"bigint":return L0?L0(r):"0";case"symbol":return D0?D0(r):"Symbol()";case"undefined":return za(r);case"function":case"object":{if(r===null)return za(r);let e=r,t=hn(e,"toString");if(typeof t=="function"){let n=t(e);return typeof n=="string"?n:za(n)}return za(r)}default:return za(r)}}function hn(r,e){for(;r!==null;){let n=k_(r,e);if(n){if(n.get)return $t(n.get);if(typeof n.value=="function")return $t(n.value)}r=P_(r)}function t(){return null}return t}function M_(r){try{return sr(r,""),!0}catch(e){return!1}}var I0=Mt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gf=Mt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),bf=Mt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),L_=Mt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-gly
Line truncated
|
|
|
|
|
`+Qe),yt&&(Qe=S(Qe)),G&&tr?B(Qe):Qe},e.setConfig=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bi(C),ne=!0,me=Se,qe=we},e.clearConfig=function(){Or=null,ne=!1,me=null,qe=null,G=U,ie=""},e.isValidAttribute=function(C,p,b){Or||bi({});let T=_e(C),I=_e(p);return Xe(T,I,b)},e.addHook=function(C,p){typeof p=="function"&&$r(Oe,C)&&Za(Oe[C],p)},e.removeHook=function(C,p){if($r(Oe,C)){if(p!==void 0){let b=$_(Oe[C],p);return b===-1?void 0:Q_(Oe[C],b,1)[0]}return E0(Oe[C])}},e.removeHooks=function(C){$r(Oe,C)&&(Oe[C]=[])},e.removeAllHooks=function(){Oe=Y0()},e}var Yi=U0();var K_=$f(),q0=["clk","reset"],Qf=class{constructor(e,t){this.lines=[];this.zoom=8;this.t0=0;this.tsel=-1;this.tnow=-1;this.hexformat=!0;this.scrollbarWidth=12;this.parent=e,this.wfp=t,this.parent.setAttribute("tabindex","-1"),this.parent.addEventListener("mousedown",n=>{n.preventDefault(),this.parent.focus()}),$0(this.parent,()=>this.getShortcuts()),T0(this.parent,"verilog-waveform"),this.recreate()}getShortcuts(){return[{key:"=",label:"Zoom In",fn:()=>this.setZoom(this.zoom*2)},{key:"-",label:"Zoom Out",fn:()=>this.setZoom(this.zoom/2)},{key:"ctrl+shift+left",label:"To Start",fn:()=>{this.setSelTime(0),this.setOrgTime(0)}},{key:"shift+left",label:"Page Left",fn:()=>this.setSelTime(this.tsel-this.clocksPerPage/4)},{key:"left",label:"Left",fn:()=>this.setSelTime(this.tsel-1)},{key:"right",label:"Right",fn:()=>this.setSelTime(this.tsel+1)},{key:"shift+right",label:"Page Right",fn:()=>this.setSelTime(this.tsel+this.clocksPerPage/4)},{key:"space",label:"Go To Current",fn:()=>{this.setOrgTime(this.tnow),this.setSelTime(this.tnow)}},{key:"h",label:"Hex/Dec",fn:()=>{this.hexformat=!this.hexformat,this.refresh()}}]}recreate(){clearTimeout(this.wtimer),this.wtimer=setTimeout(()=>{this.destroy(),this._recreate()},0)}destroy(){this.wavelist&&($(this.wavelist.container).remove(),this.wavelist=null),this.toolbar&&(this.toolbar.destroy(),this.toolbar=null),this.clklabel&&(this.clklabel.remove(),this.clklabel=null)}_recreate(){if(this.meta=this.wfp.getSignalMetadata(),!!this.meta){var e=$(this.parent).width();this.pageWidth=e-this.scrollbarWidth;var t=40;this.setClocksPerPage(),this.clockMax=0,this.wavelist=new Wr({w:e,h:$(this.parent).height(),itemHeight:t,totalRows:this.meta.length+1,generatorFn:o=>{var a=this.meta[o];let l=document.createElement("div"),c=document.createElement("canvas");return c.width=e-12,c.height=t,l.appendChild(c),l.classList.add("waverow"),this.lines[o]=c,this.refreshRow(o),a&&a.input&&q0.indexOf(a.label)<0&&(l.onmousedown=d=>{var h=this.meta[o];h&&h.input&&this.changeInputValue(o)},l.classList.add("editable"),l.style.cursor="grab"),l}});var n=this.wavelist.container;n.tabIndex=-1,this.toolbar=new Bi(this.parent,this.parent),this.toolbar.span.css("display","inline-block"),this.clklabel=document.createElement("span"),this.clklabel.innerText="-",$(this.parent).append(this.clklabel),$(this.parent).append(n);var i=!1,s=o=>{this.setSelTime(o.offsetX/this.zoom+this.t0-.5)};$(n).mousedown(o=>{i=!0,s(o)}),$(n).mousemove(o=>{i&&s(o)}),$(n).mouseup(o=>{i=!1}),$(n).on("wheel",o=>{if(Math.abs(o.originalEvent.deltaX)>Math.abs(o.originalEvent.deltaY)){var a=Math.max(-1e3,Math.min(1e3,o.originalEvent.deltaX));a&&this.setOrgTime(this.t0+a)}}),this.toolbar.add("=","Zoom In","glyphicon-zoom-in",(o,a)=>{this.setZoom(this.zoom*2)}),this.toolbar.add("+","Zoom In",null,(o,a)=>{this.setZoom(this.zoom*2)}),this.toolbar.add("-","Zoom Out","glyphicon-zoom-out",(o,a)=>{this.setZoom(this.zoom/2)}),this.toolbar.add("ctrl+shift+left","Move to beginning","glyphicon-backward",(o,a)=>{this.setSelTime(0),this.setOrgTime(0)}),this.toolbar.add("shift+left","Move left 1/4 page","glyphicon-fast-backward",(o,a)=>{this.setSelTime(this.tsel-this.clocksPerPage/4)}),this.toolbar.add("left","Move left 1 clock","glyphicon-step-backward",(o,a)=>{this.setSelTime(this.tsel-1)}),this.toolbar.add("right","Move right 1 clock","glyphicon-step-forward",(o,a)=>{this.setSelTime(this.tsel+1)}),this.toolbar.add("shift+right","Move right 1/4 page","glyphicon-fast-forward",(o,a)=>{this.setSelTime(this.tsel+this.clocksPerPage/4)}),this.toolbar.add("space","Go to current time","glyphicon-flash",(o,a)=>{this.setOrgTime(this.tnow),this.setSelTime(this.tnow)}),this.toolbar.add("h","Switch between hex/decimal format","glyphicon-barcode",(o,a)=>{this.hexformat=!this.hexformat,this.refresh()}),$(window).resize(()=>{this.recreate()})}}roundT(e){return e=Math.round(e),e=Math.max(0,e),e=Math.min(this.clockMax+this.clocksPerPage/2,e),e}setOrgTime(e){this.t0=this.roundT(e),this.refresh()}setCurrentTime(e){this.tnow=this.roundT(e),this.refresh()}setSelTime(e){e=this.roundT(e),e>=this.t0+this.clocksPerPage-1&&(this.t0+=this.clocksPerPage/4),e<=this.t0+2&&(this.t0-=this.clocksPerPage/4),this.tsel=e,this.setOrgTime(this.t0),this.clklabel.innerText=" clk "+this.tsel}setClocksPerPage(){this.clocksPerPage=Math.floor(this.pageWidth/this.zoom)-1}setZoom(e){this.zoom=Math.max(1/16,Math.min(6
Line truncated
|
|
|
|
|
`);for(let i of e||[]){let s=i instanceof RegExp?{re:i}:i;for(let o of n){let a;for(s.re.lastIndex=0;a=s.re.exec(o);){let l=a[s.group!=null?s.group:a.length-1];l&&t.push(s.suffix?l+s.suffix:l)}}}return t}var Cn={vcs:{arch:"6502",code_start:4096,code_size:61440,data_start:128,data_size:128,wiz_rom_ext:".a26",wiz_inc_dir:"2600",cfgfile:"atari2600.cfg",libargs:["crt0.o","atari2600.lib"],extra_link_files:["crt0.o","atari2600.cfg"],asm_cfgfile:"atari2600-asm.cfg",asm_libargs:[],asm_extra_link_files:["atari2600-asm.cfg"],define:["__ATARI2600__"]},mw8080bw:{arch:"z80",code_start:0,rom_size:8192,data_start:8192,data_size:1024,stack_end:9216},vicdual:{arch:"z80",code_start:0,rom_size:16416,data_start:58368,data_size:1024,stack_end:59392},galaxian:{arch:"z80",code_start:0,rom_size:16384,data_start:16384,data_size:1024,stack_end:18432},"galaxian-scramble":{arch:"z80",code_start:0,rom_size:20512,data_start:16384,data_size:1024,stack_end:18432},pacman:{arch:"z80",code_start:0,codeseg_start:202,rom_size:32768,data_start:19456,data_size:652,stack_end:20416},williams:{arch:"6809",code_start:0,rom_size:49152,data_start:38912,data_size:10240,stack_end:49152,set_stack_end:49152,extra_link_files:["williams.scr","libcmoc-crt-vec.a","libcmoc-std-vec.a"],extra_link_args:["-swilliams.scr","-lcmoc-crt-vec","-lcmoc-std-vec"],extra_compile_files:["assert.h","cmoc.h","stdarg.h","stdlib.h"]},"williams-defender":{arch:"6809",code_start:0,rom_size:49152,data_start:38912,data_size:10240,stack_end:49152},"williams-z80":{arch:"z80",code_start:0,rom_size:38912,data_start:38912,data_size:10240,stack_end:49152},"vector-z80color":{arch:"z80",code_start:0,rom_size:32768,data_start:57344,data_size:8192,stack_end:0},"vector-ataricolor":{arch:"6502",define:["__VECTOR__"],cfgfile:"vector-color.cfg",libargs:["crt0.o","none.lib"],extra_link_files:["crt0.o","vector-color.cfg"]},"sound_williams-z80":{arch:"z80",code_start:0,rom_size:16384,data_start:16384,data_size:1024,stack_end:32768},base_z80:{arch:"z80",code_start:0,rom_size:32768,data_start:32768,data_size:32768,stack_end:0},coleco:{arch:"z80",rom_start:32768,code_start:33024,rom_size:32768,data_start:28672,data_size:1024,stack_end:32768,extra_preproc_args:["-I","/share/include/coleco","-D","CV_CV"],extra_link_args:["-k","/share/lib/coleco","-l","libcv","-l","libcvu","crt0.rel"]},msx:{arch:"z80",rom_start:16384,code_start:16384,rom_size:32768,data_start:49152,data_size:12288,stack_end:65535,extra_link_args:["crt0-msx.rel"],extra_link_files:["crt0-msx.rel","crt0-msx.lst"],wiz_sys_type:"z80",wiz_inc_dir:"msx"},"msx-libcv":{arch:"z80",rom_start:16384,code_start:16384,rom_size:32768,data_start:49152,data_size:12288,stack_end:65535,extra_preproc_args:["-I",".","-D","CV_MSX"],extra_link_args:["-k",".","-l","libcv-msx","-l","libcvu-msx","crt0-msx.rel"],extra_link_files:["libcv-msx.lib","libcvu-msx.lib","crt0-msx.rel","crt0-msx.lst"],extra_compile_files:["cv.h","cv_graphics.h","cv_input.h","cv_sound.h","cv_support.h","cvu.h","cvu_c.h","cvu_compression.h","cvu_f.h","cvu_graphics.h","cvu_input.h","cvu_sound.h"]},"sms-sg1000-libcv":{arch:"z80",rom_start:0,code_start:256,rom_size:49152,data_start:49152,data_size:1024,stack_end:57344,extra_preproc_args:["-I",".","-D","CV_SMS"],extra_link_args:["-k",".","-l","libcv-sms","-l","libcvu-sms","crt0-sms.rel"],extra_link_files:["libcv-sms.lib","libcvu-sms.lib","crt0-sms.rel","crt0-sms.lst"],extra_compile_files:["cv.h","cv_graphics.h","cv_input.h","cv_sound.h","cv_support.h","cvu.h","cvu_c.h","cvu_compression.h","cvu_f.h","cvu_graphics.h","cvu_input.h","cvu_sound.h"]},nes:{arch:"6502",define:["__NES__"],cfgfile:"neslib2.cfg",libargs:["crt0.o","nes.lib","neslib2.lib","-D","NES_MAPPER=0","-D","NES_PRG_BANKS=2","-D","NES_CHR_BANKS=1","-D","NES_MIRRORING=0"],extra_link_files:["crt0.o","neslib2.lib","neslib2.cfg","nesbanked.cfg"],symbolConfigs:{NES_MAPPER:{4:"nesbanked.cfg"}},ignore_segments:["HEADER","CHARS"],wiz_rom_ext:".nes"},apple2:{arch:"6502",define:["__APPLE2__"],cfgfile:"apple2.cfg",libargs:["--lib-path","/share/target/apple2/drv","apple2.lib"],__CODE_RUN__:16384,code_start:2051,acmeargs:["-f","apple"]},"apple2-e":{arch:"6502",define:["__APPLE2__"],cfgfile:"apple2.cfg",libargs:["apple2.lib"],acmeargs:["-f","apple"]},"atari8-800xl.disk":{arch:"6502",define:["__ATARI__"],cfgfile:"atari.cfg",libargs:["atari.lib"],fastbasic_cfgfile:"fastbasic-cart.cfg",ignore_segments:["EXEHDR","SYSCHKHDR","SYSCHKTRL","MAINHDR","AUTOSTRT"]},"atari8-800xl":{arch:"6502",define:["__ATARI__"],cfgfile:"atari-cart.cfg",libargs:["atari.lib","-D","__CARTFLAGS__=4"],fastbasic_cfgfile:"fastbasic-cart.cfg"},"atari8-800":{arch:"6502",define:["__ATARI__"],cfgfile:"atari-cart.cfg",libargs:["atari.lib","-D","__CARTFLAGS__=4"],fastbasic_cfgfile:"fastbasic-cart.cfg"},"atari8-5200":{arch:"6502",define:["__ATARI5200__"],cfgfile:"atari5200.cfg",libargs:["atari5200.lib","-D","__CARTFLAGS__=255"],fastbasic_cfgfile:"fastbasic-cart.cfg"},verilog:{arch:"verilog",extra_compile_files:["8bitworkshop.v"]},astrocad
Line truncated
|
|
|
|
|
`){[e,t]=Co(this,e,t);let i="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(i+=n),e<l&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let s of e)n.push(s),i+=s.length+1,n.length==32&&(t.push(new r(n,i)),n=[],i=-1);return i>-1&&t.push(new r(n,i)),t}},To=class r extends Le{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=n+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,n,i);i=a+1,n=l+1}}decompose(e,t,n,i){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let c=i&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?n.push(a):a.decompose(e-o,t-o,n,c)}o=l+1}}replace(e,t,n){if([e,t]=Co(this,e,t),n.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,n),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let d=this.children.slice();return d[i]=l,new r(d,this.length-(t-e)+n.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
|
|
|
|
`){[e,t]=Co(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=n),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,n)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof r))return 0;let n=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return n;let l=this.children[i],c=e.children[s];if(l!=c)return n+l.scanIdentical(c,t);n+=l.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let f of e)n+=f.lines;if(n<32){let f=[];for(let m of e)m.flatten(f);return new Vr(f,t)}let i=Math.max(32,n>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,d=[];function h(f){let m;if(f.lines>s&&f instanceof r)for(let g of f.children)h(g);else f.lines>o&&(l>o||!l)?(u(),a.push(f)):f instanceof Vr&&l&&(m=d[d.length-1])instanceof Vr&&f.lines+m.lines<=32?(l+=f.lines,c+=f.length+1,d[d.length-1]=new Vr(m.text.concat(f.text),m.length+1+f.length)):(l+f.lines>i&&u(),l+=f.lines,c+=f.length+1,d.push(f))}function u(){l!=0&&(a.push(d.length==1?d[0]:r.from(d,c)),c=-1,l=d.length=0)}for(let f of e)h(f);return u(),a.length==1?a[0]:new r(a,t)}};Le.empty=new Vr([""],0);function cA(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Mc(r,e,t=0,n=1e9){for(let i=0,s=0,o=!0;s<r.length&&i<=n;s++){let a=r[s],l=i+a.length;l>=t&&(l>n&&(a=a.slice(0,n-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function gy(r,e,t){return Mc(r,[""],e,t)}var Zs=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Vr?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],s=this.offsets[n],o=s>>1,a=i instanceof Vr?i.text.length:i.children.length;if(o==(t>0?a:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
|
`,this;e--}else if(i instanceof Vr){let l=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Vr?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Lc=class{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Zs(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Dc=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(Le.prototype[Symbol.iterator]=function(){return this.iter()},Zs.prototype[Symbol.iterator]=Lc.prototype[Symbol.iterator]=Dc.prototype[Symbol.iterator]=function(){return this});var Cf=class{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}};function Co(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function xt(r,e,t=!0,n=!0){return fy(r,e,t,n)}function dA(r){return r>=56320&&r<57344}function hA(r){return r>=55296&&r<56320}function Rn(r,e){let t=r.charCodeAt(e);if(!hA(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return dA(n)?(t-55296<<10)+(n-56320)+65536:t}function Wc(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function ji(r){return r<65536?1:2}var Ef=/\r\n?|\n/,Lt=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(Lt||(Lt={})),xi=class r{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,i,s),i+=s):i+=o,n+=s}}iterChangedRanges(e,t=!1){Rf(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new r(e)}composeDesc(e){return this.empty?e:e.empty?this:xy(this,e)}mapDesc(e,t=!1){return e.empty?this:Mf(this,e,t)}mapPos(e,t=-1,n=Lt.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(n!=Lt.Simple&&c>=e&&(n==Lt.TrackDel&&i<e&&c>e||n==Lt.TrackBefore&&i<e||n==Lt.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let s=this.sections[n++],o=this.sections[n++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new r(e)}static create(e){return new r(e)}},gr=class r extends xi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Rf(this,(t,n,i,s,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return Mf(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;n.length<l;)n.push(Le.empty);n.push(o?e.slice(s,s+o):Le.empty)}s+=o}return new r(t,n)}compose(e){return this.empty?e:e.empty?this:xy(this,e,!0)}map(e,t=!1){return e.empty?this:Mf(this,e,t,!0)}iterChanges(e,t=!1){Rf(this,e,t)}get desc
Line truncated
|
|
|
|
|
`}get readOnly(){return this.facet(_y)}phrase(e,...t){for(let n of this.facet(r.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let s of this.facet(Py))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return SA(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let l=xt(t,o,!1);if(s(t.slice(l,o))!=rt.Word)break;o=l}for(;a<i;){let l=xt(t,a);if(s(t.slice(a,l))!=rt.Word)break;a=l}return o==a?null:Z.range(o+n,a+n)}};Me.allowMultipleSelections=Df;Me.tabSize=le.define({combine:r=>r.length?r[0]:4});Me.lineSeparator=ky;Me.readOnly=_y;Me.phrases=le.define({compare(r,e){let t=Object.keys(r),n=Object.keys(e);return t.length==n.length&&t.every(i=>r[i]==e[i])}});Me.languageData=Py;Me.changeFilter=$y;Me.transactionFilter=Qy;Me.transactionExtender=Ty;Ut.reconfigure=be.define();function Yr(r,e,t={}){let n={};for(let i of r)for(let s of Object.keys(i)){let o=i[s],a=n[s];if(a===void 0)n[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}var dn=class{eq(e){return this==e}range(e,t=e){return Fa.create(e,t,this)}};dn.prototype.startSide=dn.prototype.endSide=0;dn.prototype.point=!1;dn.prototype.mapMode=Lt.TrackDel;function Nf(r,e){return r==e||r.constructor==e.constructor&&r.eq(e)}var Fa=class r{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new r(e,t,n)}};function Wf(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}var Bf=class r{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let s=n?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,n,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+e,h=this.to[l]+e,u,f;if(d==h){let m=t.mapPos(d,c.startSide,c.mapMode);if(m==null||(u=f=m,c.startSide!=c.endSide&&(f=t.mapPos(d,c.endSide),f<u)))continue}else if(u=t.mapPos(d,c.startSide),f=t.mapPos(h,c.endSide),u>f||u==f&&c.startSide>0&&c.endSide<=0)continue;(f-u||c.endSide-c.startSide)<0||(o<0&&(o=u),c.point&&(a=Math.max(a,f-u)),n.push(c),i.push(u-o),s.push(f-o))}return{mapped:n.length?new r(i,s,n,a):null,pos:o}}},Te=class r{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new r(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(Wf)),this.isEmpty)return t.length?r.of(t):this;let a=new zc(this,null,-1).goto(0),l=0,c=[],d=new En;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];d.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push(Fa.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?r.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),t.push(l),n.push(e.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),n.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new r(n,t,s||r.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Na.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Na.from(e).goto(t)}static compare(e,t,n,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.is
Line truncated
|
|
|
|
|
`)}static newName(){let e=Ry[Ey]||1;return Ry[Ey]=e+1,"\u037C"+e.toString(36)}static mount(e,t,n){let i=e[jf],s=n&&n.nonce;i?s&&i.setNonce(s):i=new Uf(e,s),i.mount(Array.isArray(t)?t:[t],e)}},My=new Map,Uf=class{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=My.get(n);if(s)return e[jf]=s;this.sheet=new i.CSSStyleSheet,My.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[jf]=this}mount(e,t){let n=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),n)for(let c=0;c<a.rules.length;c++)n.insertRule(a.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
|
|
|
|
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var wi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Eo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xA=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),wA=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Qt=0;Qt<10;Qt++)wi[48+Qt]=wi[96+Qt]=String(Qt);var Qt;for(Qt=1;Qt<=24;Qt++)wi[Qt+111]="F"+Qt;var Qt;for(Qt=65;Qt<=90;Qt++)wi[Qt]=String.fromCharCode(Qt+32),Eo[Qt]=String.fromCharCode(Qt);var Qt;for(Vc in wi)Eo.hasOwnProperty(Vc)||(Eo[Vc]=wi[Vc]);var Vc;function Ly(r){var e=xA&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||wA&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Eo:wi)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function wt(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];typeof i=="string"?r.setAttribute(n,i):i!=null&&(r[n]=i)}e++}for(;e<arguments.length;e++)Dy(r,arguments[e]);return r}function Dy(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Dy(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}var br=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},ip=typeof document!="undefined"?document:{documentElement:{style:{}}},sp=/Edge\/(\d+)/.exec(br.userAgent),vS=/MSIE \d/.test(br.userAgent),op=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(br.userAgent),xd=!!(vS||op||sp),Iy=!xd&&/gecko\/(\d+)/i.test(br.userAgent),qf=!xd&&/Chrome\/(\d+)/.exec(br.userAgent),Zy="webkitFontSmoothing"in ip.documentElement.style,ap=!xd&&/Apple Computer/.test(br.vendor),Xy=ap&&(/Mobile\/\w+/.test(br.userAgent)||br.maxTouchPoints>2),ce={mac:Xy||/Mac/.test(br.platform),windows:/Win/.test(br.platform),linux:/Linux|X11/.test(br.platform),ie:xd,ie_version:vS?ip.documentMode||6:op?+op[1]:sp?+sp[1]:0,gecko:Iy,gecko_version:Iy?+(/Firefox\/(\d+)/.exec(br.userAgent)||[0,0])[1]:0,chrome:!!qf,chrome_version:qf?+qf[1]:0,ios:Xy,android:/Android\b/.test(br.userAgent),webkit:Zy,webkit_version:Zy?+(/\bAppleWebKit\/(\d+)/.exec(br.userAgent)||[0,0])[1]:0,safari:ap,safari_version:ap?+(/\bVersion\/(\d+(\.\d+)?)/.exec(br.userAgent)||[0,0])[1]:0,tabSize:ip.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Kp(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}var id=Object.create(null);function Jp(r,e,t){if(r==e)return!0;r||(r=id),e||(e=id);let n=Object.keys(r),i=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of n)if(s!=t&&(i.indexOf(s)==-1||r[s]!==e[s]))return!1;return!0}function PA(r,e){for(let t=r.attributes.length-1;t>=0;t--){let n=r.attributes[t].name;e[n]==null&&r.removeAttribute(n)}for(let t in e){let n=e[t];t=="style"?r.style.cssText=n:r.getAttribute(t)!=n&&r.setAttribute(t,n)}}function zy(r,e,t){let n=!1;if(e)for(let i in e)t&&i in t||(n=!0,i=="style"?r.style.cssText="":r.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(n=!0,i=="style"?r.style.cssText=t[i]:r.setAttribute(i,t[i]));return n}function kA(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let n=r.attributes[t];e[n.name]=n.value}return e}var Tt=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Gt=(function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r})(Gt||(Gt={})),ee=class extends dn{constructor(e,t,n,i){super(),this.startSide=e,this.enLine truncated
|
|
|
|
|
`,i=r.state.doc.line(i.number+(t?1:-1)),s=r.bidiSpans(i),c=r.visualLineSide(i,!t)}if(l){if(!l(d))return a}else{if(!n)return c;l=n(d)}a=c}}function iC(r,e,t){let n=r.state.charCategorizer(e),i=n(t);return s=>{let o=n(s);return i==rt.Space&&(i=o),i==o}}function sC(r,e,t,n){let i=e.head,s=t?1:-1;if(i==(t?r.state.doc.length:0))return Z.cursor(i,e.assoc);let o=e.goalColumn,a,l=r.contentDOM.getBoundingClientRect(),c=r.coordsAtPos(i,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=r.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let m=r.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,r.defaultCharacterWidth*(i-m.from))),a=(s<0?m.top:m.bottom)+d}let h=l.left+o,u=r.viewState.heightOracle.textHeight>>1,f=n!=null?n:u;for(let m=0;;m+=u){let g=a+(f+m)*s,v=wp(r,{x:h,y:g},!1,s);if(t?g>l.bottom:g<l.top)return Z.cursor(v.pos,v.assoc);let k=r.coordsAtPos(v.pos,v.assoc),L=k?(k.top+k.bottom)/2:0;if(!k||(t?L>a:L<a))return Z.cursor(v.pos,v.assoc,void 0,o)}}function tl(r,e,t){for(;;){let n=0;for(let i of r)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=n||t||(e-s<o-e?-1:1);e=l<0?s:o,n=l}});if(!n)return e}}function KS(r,e){let t=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],s=null;if(i.empty){let o=tl(r,i.from,0);o!=i.from&&(s=Z.cursor(o,-1))}else{let o=tl(r,i.from,-1),a=tl(r,i.to,1);(o!=i.from||a!=i.to)&&(i.undirectional?s=Z.undirectionalRange(i.from,i.to):s=Z.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[n]=s)}return t?Z.create(t,e.mainIndex):e}function Kf(r,e,t){let n=tl(r.state.facet(hl).map(i=>i(r)),t.from,e.head>t.from?-1:1);return n==t.from?t:Z.cursor(n,n<t.from?1:-1)}var pn=class{constructor(e,t){this.pos=e,this.assoc=t}};function wp(r,e,t,n){let i=r.contentDOM.getBoundingClientRect(),s=i.top+r.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new pn(0,1);if(l>r.viewState.docHeight)return new pn(r.state.doc.length,-1);if(c=r.elementAtHeight(l),n==null)break;if(c.type==Gt.Text){if(n<0?c.to<r.viewport.from:c.from>r.viewport.to)break;let u=r.docView.coordsAt(n<0?c.from:c.to,n>0?-1:1);if(u&&(n<0?u.top<=l+s:u.bottom>=l+s))break}let h=r.viewState.heightOracle.textHeight/2;l=n>0?c.bottom+h:c.top-h}if(r.viewport.from>=c.to||r.viewport.to<=c.from){if(t)return null;if(c.type==Gt.Text){let h=rC(r,i,c,o,a);return new pn(h,h==c.from?1:-1)}}if(c.type!=Gt.Text)return l<(c.top+c.bottom)/2?new pn(c.from,1):new pn(c.to,-1);let d=r.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=r.docView.lineAt(c.from,-2)),new Pp(r,o,a,r.textDirectionAt(c.from)).scanTile(d,c.from)}var Pp=class{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[mn.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[mn.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t,n=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,d=-1,h=1e9,u;e:for(;i<s;){let m=s-i,g=i+s>>1;t:if(o.has(g)){for(let L=1;L<m;L++){let M=g+L;if(M>=s&&(M-=m),!o.has(M)){g=M;break t}}break e}o.add(g);let v=t(g),k=0;if(v)for(let L=0;L<v.length;L++){let M=v[L];if(!(M.width==0&&v.length>1))if(M.bottom<this.y)(!l||l.bottom<M.bottom)&&(l=M),k=1;else if(M.top>this.y)(!c||c.top>M.top)&&(c=M),k=-1;else{let D=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,w=Math.abs(D);w<h&&(d=g,h=w,u=M),D&&(k=D<0==(this.baseDir==et.LTR)?-1:1)}}k==-1&&(!a||this.baseDirAt(e[g],1))?s=g:k==1&&(!a||this.baseDirAt(e[g+1],-1))&&(i=g+1)}if(!u){if(!c&&!l)return{i:0,after:!1};let m=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(m.top+m.bottom)/2,this.scan(e,t,!0)}if(h&&!n){let{top:m,bottom:g}=u;if(l&&l.bottom>(m+m+g)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(c&&c.top<(m+g+g)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(a?this.dirAt(e[d],1):this.baseDir)==et.LTR;return{i:d,after:this.x>(u.left+u.right)/2==f}}scanText(e,t){let n=[];for(let s=0;s<e.length;s=xt(e.text,s))n.push(t+s);n.push(t+e.length);let i=this.scan(n,s=>{let o=n[s]-t,a=n[s+1]-t;return ll(e.dom,o,a).getClientRects()});return i.after?new pn(n[i.i+1],-1):new pn(n[i.i],1)}scanTile(e,t){if(!e.length)return new pn(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let n=[t];for(let a=0,l=t;a<e.children.length;a++)n.push(l+=e.children[a].length);let i=this.scan(n,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:ll(l.dom,0,l.length)).getClientRects()}),s=e.children[i.i],o=n[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new pn(n[i.i+1],-1):new pn(o,1)}},Ro="\uFFFF",kp=class{con
Line truncated
|
|
|
|
|
`&&r.lineWrapping&&(n&&(n=Z.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:Le.of([" "])}),t)return om(r,t,n,o);if(n&&!ud(n,s)){let a=!1,l="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(a=!0),l=r.inputState.lastSelectionOrigin,l=="select.pointer"&&(n=KS(i.facet(hl).map(c=>c(r)),n))),r.dispatch({selection:n,scrollIntoView:a,userEvent:l}),!0}else return!1}function om(r,e,t,n=-1){if(ce.ios&&r.inputState.flushIOSKey(e))return!0;let i=r.state.selection.main;if(ce.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&r.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Xo(r.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Xo(r.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Xo(r.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let o,a=()=>o||(o=lC(r,e,t));return r.state.facet(zS).some(l=>l(r,e.from,e.to,s,a))||r.dispatch(a()),!0}function lC(r,e,t){let n,i=r.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,d=tl(i.facet(hl).map(h=>h(r)),c,l);e.from==d&&(o=d)}if(o>-1)n={changes:e,selection:Z.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&r.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";n=i.replaceSelection(r.state.toText(l+e.insert.sliceString(0,void 0,r.state.lineBreak)+c))}else{let l=i.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(r.inputState.composing>=0||r.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=r.state.sliceDoc(e.from,e.to),h,u=t&&HS(r,t.main.head);if(u){let m=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-m}}else h=r.state.doc.lineAt(s.head);let f=s.to-e.to;n=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:c||m.map(l)};let g=m.to-f,v=g-d.length;if(r.state.sliceDoc(v,g)!=d||g>=h.from&&v<=h.to)return{range:m};let k=i.changes({from:v,to:g,insert:e.insert}),L=m.to-s.to;return{changes:k,range:c?Z.range(Math.max(0,c.anchor+L),Math.max(0,c.head+L)):m.map(k)}})}else n={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,a+=".compose",r.inputState.compositionFirstChange&&(a+=".start",r.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:a,scrollIntoView:!0})}function tv(r,e,t,n){let i=Math.min(r.length,e.length),s=0;for(;s<i&&r.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&r.length==e.length)return null;let o=r.length,a=e.length;for(;o>0&&a>0&&r.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&r.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function cC(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}=r.observer.selectionRange;return t&&(e.push(new hd(t,n)),(i!=t||s!=n)&&e.push(new hd(i,s))),e}function dC(r,e){if(r.length==0)return null;let t=r[0].pos,n=r.length==2?r[1].pos:t;return t>-1&&n>-1?Z.single(t+e,n+e):null}function ud(r,e){return e.head==r.main.head&&e.anchor==r.main.anchor}var Qp=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ce.safari&&e.contentDOM.addEventListener("input",()=>null),ce.gecko&&kC(e.contentDOM.ownerDocument)}handleEvent(e){!bC(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandl
Line truncated
|
|
|
|
|
`))};if((ce.mac||ce.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Le.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let u=this.to-this.from+(h.to-h.from+h.insert.length);om(e,h,Z.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],s=null;for(let o=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=n=>{let i=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(ee.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:FS.of(ee.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{let i=al(n.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(n)return;let d=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=d}t+=d}),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},N=class r{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM
Line truncated
|
|
|
|
|
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Yp),KC={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},ep=null;function JC(){var r;if(ep==null&&typeof document!="undefined"&&document.body){let e=document.body.style;ep=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return ep||!1}var rd=le.define({combine(r){let e=Yr(r,{render:null,specialChars:HC,addSpecialChars:null});return(e.replaceTabs=!JC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Yp)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Yp)),e}});function vv(r={}){return[rd.of(r),eE()]}var fS=null;function eE(){return fS||(fS=at.fromClass(class{constructor(r){this.view=r,this.decorations=ee.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(rd)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new cl({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:i}=t.state,s=Rn(e[0],0);if(s==9){let o=i.lineAt(n),a=t.state.tabSize,l=qt(o.text,a,n-o.from);return ee.replace({widget:new Np((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ee.replace({widget:new Fp(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(rd);r.startState.facet(rd)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}var tE="\u2022";function rE(r){return r>=32?tE:r==10?"\u2424":String.fromCharCode(9216+r)}var Fp=class extends Tt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=rE(this.code),n=e.state.phrase("Control character")+" "+(KC[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Np=class extends Tt{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function $d(){return iE}var nE=ee.line({class:"cm-activeLine"}),iE=at.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let n of r.state.selection.ranges){let i=r.lineBlockAt(n.head);i.from>e&&(t.push(nE.range(i.from)),e=i.from)}return ee.set(t)}},{decorations:r=>r.decorations});var jp=2e3;function sE(r,e,t){let n=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>jp||t.off>jp||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=n;l<=i;l++){let c=r.doc.line(l);c.length<=a&&s.push(Z.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=n;l<=i;l++){let c=r.doc.line(l),d=Bc(c.text,o,r.tabSize,!0);if(d<0)s.push(Z.cursor(c.to));else{let h=Bc(c.text,a,r.tabSize);s.push(Z.range(c.from+d,c.from+h))}}}return s}function oE(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function pS(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1),n=r.state.doc.lineAt(t),i=t-n.from,s=i>jp?-1:i==n.length?oE(r,e.clientX):qt(n.text,r.state.tabSize,t-n.from);return{line:n.number,col:s,off:i}}function aE(r,e){let t=pS(r,e),n=r.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(i.changes)}},get(i,s,o){let a=pS(r,i);if(!a)return n;let l=sE(r.state,t,a);return l.length?o?Z.create(l.concat(n.ranges)):Z.create(l):n}}:null}function Qd(r){let e=(r==null?void 0:r.eventFilter)||(t=>t.altKey&&t.button==0);return N.mouseSelectionStyle.of((t,n)=>e(n)?aE(t,n):null)}var lE={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},cE={style:"cursor: crosshair"};function Td(r={}){let[e,t]=lE[r.key||"Alt"],n=at.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}})
Line truncated
|
|
|
|
|
`){[e,t]=Co(this,e,t);let i="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(i+=n),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,n)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof r))return 0;let n=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return n;let l=this.children[i],c=e.children[s];if(l!=c)return n+l.scanIdentical(c,t);n+=l.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let f of e)n+=f.lines;if(n<32){let f=[];for(let m of e)m.flatten(f);return new Yr(f,t)}let i=Math.max(32,n>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,d=[];function h(f){let m;if(f.lines>s&&f instanceof r)for(let g of f.children)h(g);else f.lines>o&&(l>o||!l)?(u(),a.push(f)):f instanceof Yr&&l&&(m=d[d.length-1])instanceof Yr&&f.lines+m.lines<=32?(l+=f.lines,c+=f.length+1,d[d.length-1]=new Yr(m.text.concat(f.text),m.length+1+f.length)):(l+f.lines>i&&u(),l+=f.lines,c+=f.length+1,d.push(f))}function u(){l!=0&&(a.push(d.length==1?d[0]:r.from(d,c)),c=-1,l=d.length=0)}for(let f of e)h(f);return u(),a.length==1?a[0]:new r(a,t)}};Le.empty=new Yr([""],0);function fA(r){let e=-1;for(let t of r)e+=t.length+1;return e}function Lc(r,e,t=0,n=1e9){for(let i=0,s=0,o=!0;s<r.length&&i<=n;s++){let a=r[s],l=i+a.length;l>=t&&(l>n&&(a=a.slice(0,n-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function by(r,e,t){return Lc(r,[""],e,t)}var Zs=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Yr?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],s=this.offsets[n],o=s>>1,a=i instanceof Yr?i.text.length:i.children.length;if(o==(t>0?a:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
|
`,this;e--}else if(i instanceof Yr){let l=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Yr?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Dc=class{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Zs(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Ic=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(Le.prototype[Symbol.iterator]=function(){return this.iter()},Zs.prototype[Symbol.iterator]=Dc.prototype[Symbol.iterator]=Ic.prototype[Symbol.iterator]=function(){return this});var Ef=class{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}};function Co(r,e,t){return e=Math.max(0,Math.min(r.length,e)),[e,Math.max(e,Math.min(r.length,t))]}function xt(r,e,t=!0,n=!0){return py(r,e,t,n)}function pA(r){return r>=56320&&r<57344}function mA(r){return r>=55296&&r<56320}function Mn(r,e){let t=r.charCodeAt(e);if(!mA(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return pA(n)?(t-55296<<10)+(n-56320)+65536:t}function Bc(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function ji(r){return r<65536?1:2}var Rf=/\r\n?|\n/,Lt=(function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r})(Lt||(Lt={})),xi=class r{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,i,s),i+=s):i+=o,n+=s}}iterChangedRanges(e,t=!1){Mf(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new r(e)}composeDesc(e){return this.empty?e:e.empty?this:wy(this,e)}mapDesc(e,t=!1){return e.empty?this:Lf(this,e,t)}mapPos(e,t=-1,n=Lt.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(n!=Lt.Simple&&c>=e&&(n==Lt.TrackDel&&i<e&&c>e||n==Lt.TrackBefore&&i<e||n==Lt.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let s=this.sections[n++],o=this.sections[n++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new r(e)}static create(e){return new r(e)}},gr=class r extends xi{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Mf(this,(t,n,i,s,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return Lf(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;n.length<l;)n.push(Le.empty);n.push(o?e.slice(s,s+o):Le.empty)}s+=o}return new r(t,n)}compose(e){return this.empty?e:e.empty?this:wy(this,e,!0)}map(e,t=!1){return e.empty?this:Lf(this,e,t,!0)}iterChanges(e,t=!1){Mf(this,e,t)}get desc
Line truncated
|
|
|
|
|
`}get readOnly(){return this.facet(Ay)}phrase(e,...t){for(let n of this.facet(r.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let s of this.facet(ky))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return PA(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let l=xt(t,o,!1);if(s(t.slice(l,o))!=rt.Word)break;o=l}for(;a<i;){let l=xt(t,a);if(s(t.slice(a,l))!=rt.Word)break;a=l}return o==a?null:Z.range(o+n,a+n)}};Me.allowMultipleSelections=If;Me.tabSize=le.define({combine:r=>r.length?r[0]:4});Me.lineSeparator=$y;Me.readOnly=Ay;Me.phrases=le.define({compare(r,e){let t=Object.keys(r),n=Object.keys(e);return t.length==n.length&&t.every(i=>r[i]==e[i])}});Me.languageData=ky;Me.changeFilter=Qy;Me.transactionFilter=Ty;Me.transactionExtender=_y;Bt.reconfigure=be.define();function Fr(r,e,t={}){let n={};for(let i of r)for(let s of Object.keys(i)){let o=i[s],a=n[s];if(a===void 0)n[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}var un=class{eq(e){return this==e}range(e,t=e){return Na.create(e,t,this)}};un.prototype.startSide=un.prototype.endSide=0;un.prototype.point=!1;un.prototype.mapMode=Lt.TrackDel;function jf(r,e){return r==e||r.constructor==e.constructor&&r.eq(e)}var Na=class r{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new r(e,t,n)}};function Bf(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}var Vf=class r{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let s=n?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(n?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,n,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],d=this.from[l]+e,h=this.to[l]+e,u,f;if(d==h){let m=t.mapPos(d,c.startSide,c.mapMode);if(m==null||(u=f=m,c.startSide!=c.endSide&&(f=t.mapPos(d,c.endSide),f<u)))continue}else if(u=t.mapPos(d,c.startSide),f=t.mapPos(h,c.endSide),u>f||u==f&&c.startSide>0&&c.endSide<=0)continue;(f-u||c.endSide-c.startSide)<0||(o<0&&(o=u),c.point&&(a=Math.max(a,f-u)),n.push(c),i.push(u-o),s.push(f-o))}return{mapped:n.length?new r(i,s,n,a):null,pos:o}}},Te=class r{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new r(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(Bf)),this.isEmpty)return t.length?r.of(t):this;let a=new Wc(this,null,-1).goto(0),l=0,c=[],d=new Rn;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];d.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&d.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(d.addInner(a.from,a.to,a.value)||c.push(Na.create(a.from,a.to,a.value))),a.next());return d.finishInner(this.nextLayer.isEmpty&&!c.length?r.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)i=Math.max(i,l.maxPoint),t.push(l),n.push(e.mapPos(a));else if(c===!0){let{mapped:d,pos:h}=l.map(a,e);d&&(i=Math.max(i,d.maxPoint),t.push(d),n.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new r(n,t,s||r.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return ja.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return ja.from(e).goto(t)}static compare(e,t,n,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.is
Line truncated
|
|
|
|
|
`)}static newName(){let e=My[Ry]||1;return My[Ry]=e+1,"\u037C"+e.toString(36)}static mount(e,t,n){let i=e[Uf],s=n&&n.nonce;i?s&&i.setNonce(s):i=new qf(e,s),i.mount(Array.isArray(t)?t:[t],e)}},Ly=new Map,qf=class{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Ly.get(n);if(s)return e[Uf]=s;this.sheet=new i.CSSStyleSheet,Ly.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Uf]=this}mount(e,t){let n=this.sheet,i=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),n)for(let c=0;c<a.rules.length;c++)n.insertRule(a.rules[c],i++)}else{for(;s<l;)i+=this.modules[s++].rules.length;i+=a.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
|
|
|
|
|
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var wi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Eo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},$A=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),QA=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Qt=0;Qt<10;Qt++)wi[48+Qt]=wi[96+Qt]=String(Qt);var Qt;for(Qt=1;Qt<=24;Qt++)wi[Qt+111]="F"+Qt;var Qt;for(Qt=65;Qt<=90;Qt++)wi[Qt]=String.fromCharCode(Qt+32),Eo[Qt]=String.fromCharCode(Qt);var Qt;for(Yc in wi)Eo.hasOwnProperty(Yc)||(Eo[Yc]=wi[Yc]);var Yc;function Dy(r){var e=$A&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||QA&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Eo:wi)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function wt(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];typeof i=="string"?r.setAttribute(n,i):i!=null&&(r[n]=i)}e++}for(;e<arguments.length;e++)Iy(r,arguments[e]);return r}function Iy(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)Iy(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}var br=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},sp=typeof document!="undefined"?document:{documentElement:{style:{}}},op=/Edge\/(\d+)/.exec(br.userAgent),xS=/MSIE \d/.test(br.userAgent),ap=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(br.userAgent),wd=!!(xS||ap||op),Zy=!wd&&/gecko\/(\d+)/i.test(br.userAgent),Gf=!wd&&/Chrome\/(\d+)/.exec(br.userAgent),Xy="webkitFontSmoothing"in sp.documentElement.style,lp=!wd&&/Apple Computer/.test(br.vendor),zy=lp&&(/Mobile\/\w+/.test(br.userAgent)||br.maxTouchPoints>2),ce={mac:zy||/Mac/.test(br.platform),windows:/Win/.test(br.platform),linux:/Linux|X11/.test(br.platform),ie:wd,ie_version:xS?sp.documentMode||6:ap?+ap[1]:op?+op[1]:0,gecko:Zy,gecko_version:Zy?+(/Firefox\/(\d+)/.exec(br.userAgent)||[0,0])[1]:0,chrome:!!Gf,chrome_version:Gf?+Gf[1]:0,ios:zy,android:/Android\b/.test(br.userAgent),webkit:Xy,webkit_version:Xy?+(/\bAppleWebKit\/(\d+)/.exec(br.userAgent)||[0,0])[1]:0,safari:lp,safari_version:lp?+(/\bVersion\/(\d+(\.\d+)?)/.exec(br.userAgent)||[0,0])[1]:0,tabSize:sp.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Jp(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}var sd=Object.create(null);function em(r,e,t){if(r==e)return!0;r||(r=sd),e||(e=sd);let n=Object.keys(r),i=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of n)if(s!=t&&(i.indexOf(s)==-1||r[s]!==e[s]))return!1;return!0}function TA(r,e){for(let t=r.attributes.length-1;t>=0;t--){let n=r.attributes[t].name;e[n]==null&&r.removeAttribute(n)}for(let t in e){let n=e[t];t=="style"?r.style.cssText=n:r.getAttribute(t)!=n&&r.setAttribute(t,n)}}function Wy(r,e,t){let n=!1;if(e)for(let i in e)t&&i in t||(n=!0,i=="style"?r.style.cssText="":r.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(n=!0,i=="style"?r.style.cssText=t[i]:r.setAttribute(i,t[i]));return n}function _A(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let n=r.attributes[t];e[n.name]=n.value}return e}var Tt=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Gt=(function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r})(Gt||(Gt={})),ee=class extends un{constructor(e,t,n,i){super(),this.startSide=e,this.enLine truncated
|
|
|
|
|
`,i=r.state.doc.line(i.number+(t?1:-1)),s=r.bidiSpans(i),c=r.visualLineSide(i,!t)}if(l){if(!l(d))return a}else{if(!n)return c;l=n(d)}a=c}}function lC(r,e,t){let n=r.state.charCategorizer(e),i=n(t);return s=>{let o=n(s);return i==rt.Space&&(i=o),i==o}}function cC(r,e,t,n){let i=e.head,s=t?1:-1;if(i==(t?r.state.doc.length:0))return Z.cursor(i,e.assoc);let o=e.goalColumn,a,l=r.contentDOM.getBoundingClientRect(),c=r.coordsAtPos(i,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),d=r.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let m=r.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,r.defaultCharacterWidth*(i-m.from))),a=(s<0?m.top:m.bottom)+d}let h=l.left+o,u=r.viewState.heightOracle.textHeight>>1,f=n!=null?n:u;for(let m=0;;m+=u){let g=a+(f+m)*s,v=Pp(r,{x:h,y:g},!1,s);if(t?g>l.bottom:g<l.top)return Z.cursor(v.pos,v.assoc);let k=r.coordsAtPos(v.pos,v.assoc),L=k?(k.top+k.bottom)/2:0;if(!k||(t?L>a:L<a))return Z.cursor(v.pos,v.assoc,void 0,o)}}function rl(r,e,t){for(;;){let n=0;for(let i of r)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=n||t||(e-s<o-e?-1:1);e=l<0?s:o,n=l}});if(!n)return e}}function JS(r,e){let t=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],s=null;if(i.empty){let o=rl(r,i.from,0);o!=i.from&&(s=Z.cursor(o,-1))}else{let o=rl(r,i.from,-1),a=rl(r,i.to,1);(o!=i.from||a!=i.to)&&(i.undirectional?s=Z.undirectionalRange(i.from,i.to):s=Z.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[n]=s)}return t?Z.create(t,e.mainIndex):e}function Jf(r,e,t){let n=rl(r.state.facet(ul).map(i=>i(r)),t.from,e.head>t.from?-1:1);return n==t.from?t:Z.cursor(n,n<t.from?1:-1)}var On=class{constructor(e,t){this.pos=e,this.assoc=t}};function Pp(r,e,t,n){let i=r.contentDOM.getBoundingClientRect(),s=i.top+r.viewState.paddingTop,{x:o,y:a}=e,l=a-s,c;for(;;){if(l<0)return new On(0,1);if(l>r.viewState.docHeight)return new On(r.state.doc.length,-1);if(c=r.elementAtHeight(l),n==null)break;if(c.type==Gt.Text){if(n<0?c.to<r.viewport.from:c.from>r.viewport.to)break;let u=r.docView.coordsAt(n<0?c.from:c.to,n>0?-1:1);if(u&&(n<0?u.top<=l+s:u.bottom>=l+s))break}let h=r.viewState.heightOracle.textHeight/2;l=n>0?c.bottom+h:c.top-h}if(r.viewport.from>=c.to||r.viewport.to<=c.from){if(t)return null;if(c.type==Gt.Text){let h=oC(r,i,c,o,a);return new On(h,h==c.from?1:-1)}}if(c.type!=Gt.Text)return l<(c.top+c.bottom)/2?new On(c.from,1):new On(c.to,-1);let d=r.docView.lineAt(c.from,2);return(!d||d.length!=c.length)&&(d=r.docView.lineAt(c.from,-2)),new kp(r,o,a,r.textDirectionAt(c.from)).scanTile(d,c.from)}var kp=class{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[gn.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[gn.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t,n=!1){let i=0,s=e.length-1,o=new Set,a=this.bidiIn(e[0],e[s]),l,c,d=-1,h=1e9,u;e:for(;i<s;){let m=s-i,g=i+s>>1;t:if(o.has(g)){for(let L=1;L<m;L++){let M=g+L;if(M>=s&&(M-=m),!o.has(M)){g=M;break t}}break e}o.add(g);let v=t(g),k=0;if(v)for(let L=0;L<v.length;L++){let M=v[L];if(!(M.width==0&&v.length>1))if(M.bottom<this.y)(!l||l.bottom<M.bottom)&&(l=M),k=1;else if(M.top>this.y)(!c||c.top>M.top)&&(c=M),k=-1;else{let D=M.left>this.x?this.x-M.left:M.right<this.x?this.x-M.right:0,w=Math.abs(D);w<h&&(d=g,h=w,u=M),D&&(k=D<0==(this.baseDir==et.LTR)?-1:1)}}k==-1&&(!a||this.baseDirAt(e[g],1))?s=g:k==1&&(!a||this.baseDirAt(e[g+1],-1))&&(i=g+1)}if(!u){if(!c&&!l)return{i:0,after:!1};let m=l&&(!c||this.y-l.bottom<c.top-this.y)?l:c;return this.y=(m.top+m.bottom)/2,this.scan(e,t,!0)}if(h&&!n){let{top:m,bottom:g}=u;if(l&&l.bottom>(m+m+g)/3)return this.y=l.bottom-1,this.scan(e,t,!0);if(c&&c.top<(m+g+g)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(a?this.dirAt(e[d],1):this.baseDir)==et.LTR;return{i:d,after:this.x>(u.left+u.right)/2==f}}scanText(e,t){let n=[];for(let s=0;s<e.length;s=xt(e.text,s))n.push(t+s);n.push(t+e.length);let i=this.scan(n,s=>{let o=n[s]-t,a=n[s+1]-t;return cl(e.dom,o,a).getClientRects()});return i.after?new On(n[i.i+1],-1):new On(n[i.i],1)}scanTile(e,t){if(!e.length)return new On(t,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,t);if(a.isComposite())return this.scanTile(a,t)}let n=[t];for(let a=0,l=t;a<e.children.length;a++)n.push(l+=e.children[a].length);let i=this.scan(n,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:cl(l.dom,0,l.length)).getClientRects()}),s=e.children[i.i],o=n[i.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):i.after?new On(n[i.i+1],-1):new On(o,1)}},Ro="\uFFFF",$p=class{con
Line truncated
|
|
|
|
|
`&&r.lineWrapping&&(n&&(n=Z.single(n.main.anchor-1,n.main.head-1)),t={from:s.from,to:s.to,insert:Le.of([" "])}),t)return am(r,t,n,o);if(n&&!fd(n,s)){let a=!1,l="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(a=!0),l=r.inputState.lastSelectionOrigin,l=="select.pointer"&&(n=JS(i.facet(ul).map(c=>c(r)),n))),r.dispatch({selection:n,scrollIntoView:a,userEvent:l}),!0}else return!1}function am(r,e,t,n=-1){if(ce.ios&&r.inputState.flushIOSKey(e))return!0;let i=r.state.selection.main;if(ce.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&r.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Xo(r.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>i.head)&&Xo(r.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&Xo(r.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let o,a=()=>o||(o=uC(r,e,t));return r.state.facet(WS).some(l=>l(r,e.from,e.to,s,a))||r.dispatch(a()),!0}function uC(r,e,t){let n,i=r.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let l=e.from<s.from?-1:1,c=l<0?s.from:s.to,d=rl(i.facet(ul).map(h=>h(r)),c,l);e.from==d&&(o=d)}if(o>-1)n={changes:e,selection:Z.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&r.inputState.composing<0){let l=s.from<e.from?i.sliceDoc(s.from,e.from):"",c=s.to>e.to?i.sliceDoc(e.to,s.to):"";n=i.replaceSelection(r.state.toText(l+e.insert.sliceString(0,void 0,r.state.lineBreak)+c))}else{let l=i.changes(e),c=t&&t.main.to<=l.newLength?t.main:void 0;if(i.selection.ranges.length>1&&(r.inputState.composing>=0||r.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let d=r.state.sliceDoc(e.from,e.to),h,u=t&&KS(r,t.main.head);if(u){let m=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-m}}else h=r.state.doc.lineAt(s.head);let f=s.to-e.to;n=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:c||m.map(l)};let g=m.to-f,v=g-d.length;if(r.state.sliceDoc(v,g)!=d||g>=h.from&&v<=h.to)return{range:m};let k=i.changes({from:v,to:g,insert:e.insert}),L=m.to-s.to;return{changes:k,range:c?Z.range(Math.max(0,c.anchor+L),Math.max(0,c.head+L)):m.map(k)}})}else n={changes:l,selection:c&&i.selection.replaceRange(c)}}let a="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,a+=".compose",r.inputState.compositionFirstChange&&(a+=".start",r.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:a,scrollIntoView:!0})}function rv(r,e,t,n){let i=Math.min(r.length,e.length),s=0;for(;s<i&&r.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&r.length==e.length)return null;let o=r.length,a=e.length;for(;o>0&&a>0&&r.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&r.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function fC(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}=r.observer.selectionRange;return t&&(e.push(new ud(t,n)),(i!=t||s!=n)&&e.push(new ud(i,s))),e}function pC(r,e){if(r.length==0)return null;let t=r[0].pos,n=r.length==2?r[1].pos:t;return t>-1&&n>-1?Z.single(t+e,n+e):null}function fd(r,e){return e.head==r.main.head&&e.anchor==r.main.anchor}var Tp=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ce.safari&&e.contentDOM.addEventListener("input",()=>null),ce.gecko&&_C(e.contentDOM.ownerDocument)}handleEvent(e){!xC(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandl
Line truncated
|
|
|
|
|
`))};if((ce.mac||ce.android)&&h.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(h={from:a,to:l,insert:Le.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let u=this.to-this.from+(h.to-h.from+h.insert.length);am(e,h,Z.single(this.toEditorPos(n.selectionStart,u),this.toEditorPos(n.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],s=null;for(let o=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=n=>{let i=[];for(let s of n.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let d=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;i.push(ee.mark({attributes:{style:d}}).range(l,c))}}}e.dispatch({effects:NS.of(ee.set(i))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{let i=ll(n.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(n)return;let d=c.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(c)){i=this.pendingContextChange=null,t+=d,this.to+=d;return}else i=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=d,this.to+=d;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=d}t+=d}),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},N=class r{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM
Line truncated
|
|
|
|
|
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Fp),rE={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},tp=null;function nE(){var r;if(tp==null&&typeof document!="undefined"&&document.body){let e=document.body.style;tp=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return tp||!1}var nd=le.define({combine(r){let e=Fr(r,{render:null,specialChars:tE,addSpecialChars:null});return(e.replaceTabs=!nE())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Fp)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Fp)),e}});function xv(r={}){return[nd.of(r),iE()]}var pS=null;function iE(){return pS||(pS=at.fromClass(class{constructor(r){this.view=r,this.decorations=ee.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(nd)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new dl({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:i}=t.state,s=Mn(e[0],0);if(s==9){let o=i.lineAt(n),a=t.state.tabSize,l=qt(o.text,a,n-o.from);return ee.replace({widget:new jp((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=ee.replace({widget:new Np(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(nd);r.startState.facet(nd)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}var sE="\u2022";function oE(r){return r>=32?sE:r==10?"\u2424":String.fromCharCode(9216+r)}var Np=class extends Tt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=oE(this.code),n=e.state.phrase("Control character")+" "+(rE[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}},jp=class extends Tt{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function Qd(){return lE}var aE=ee.line({class:"cm-activeLine"}),lE=at.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let n of r.state.selection.ranges){let i=r.lineBlockAt(n.head);i.from>e&&(t.push(aE.range(i.from)),e=i.from)}return ee.set(t)}},{decorations:r=>r.decorations});var Up=2e3;function cE(r,e,t){let n=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>Up||t.off>Up||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=n;l<=i;l++){let c=r.doc.line(l);c.length<=a&&s.push(Z.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=n;l<=i;l++){let c=r.doc.line(l),d=Vc(c.text,o,r.tabSize,!0);if(d<0)s.push(Z.cursor(c.to));else{let h=Vc(c.text,a,r.tabSize);s.push(Z.range(c.from+d,c.from+h))}}}return s}function dE(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function mS(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1),n=r.state.doc.lineAt(t),i=t-n.from,s=i>Up?-1:i==n.length?dE(r,e.clientX):qt(n.text,r.state.tabSize,t-n.from);return{line:n.number,col:s,off:i}}function hE(r,e){let t=mS(r,e),n=r.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(i.changes)}},get(i,s,o){let a=mS(r,i);if(!a)return n;let l=cE(r.state,t,a);return l.length?o?Z.create(l.concat(n.ranges)):Z.create(l):n}}:null}function Td(r){let e=(r==null?void 0:r.eventFilter)||(t=>t.altKey&&t.button==0);return N.mouseSelectionStyle.of((t,n)=>e(n)?hE(t,n):null)}var uE={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},fE={style:"cursor: crosshair"};function _d(r={}){let[e,t]=uE[r.key||"Alt"],n=at.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}})
Line truncated
|
|
|
|
|
`&&(t="");else{let n=t.indexOf(`
|
|
|
|
|
`);n>-1&&(t=t.slice(0,n))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=n||(t=t.slice(0,s-(n-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,n=o+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(t,i,1),t+=i;let a=this.chunk.length;i=this.skipGapsTo(n,i,-1),n+=i,s+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=n:this.chunk.push(e,t,n,s),i}parseLine(e){let{line:t,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Wd(t,e?e.state.tabSize:4,e?ni(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=gx(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Ee.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:gR,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Ee(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Ee(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function gx(r,e,t){e.start=e.pos;for(let n=0;n<10;n++){let i=r(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}var Ym=Object.create(null),bl=[bt.none],gR=new Qi(bl),ex=[],tx=Object.create(null),bx=Object.create(null);for(let[r,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])bx[r]=yx(Ym,e);var Bd=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),bx)}resolve(e){return e?this.table[e]||(this.table[e]=yx(this.extra,e)):0}},bR=new Bd(Ym);function Tm(r,e){ex.indexOf(r)>-1||(ex.push(r),console.warn(e))}function yx(r,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=r[c]||O[c];d?typeof d=="function"?l.length?l=l.map(d):Tm(c,`Modifier ${c} used at start of tag`):l.length?Tm(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:Tm(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=n+" "+t.map(a=>a.id),s=tx[i];if(s)return s.id;let o=tx[i]=bt.define({id:bl.length,name:n,props:[Ht({[n]:t})]});return bl.push(o),o.id}function yR(r,e){let t=bt.define({id:bl.length,name:"Document",props:[Ai.add(()=>r),gn.add(()=>n=>e.getIndent(n))],top:!0});return bl.push(t),t}var O8={rtl:ee.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:et.RTL}),ltr:ee.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:et.LTR}),auto:ee.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var jd=class{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=ze(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),s=i.search(vR(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Sx(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function SR(r){let e=Object.create(null),t=Object.create(null);for(let{label:i}of r){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let n=Sx(e)+Sx(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Px(r){let e=r.map(i=>typeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:SR(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function kx(r,e){return t=>{for(let n=ze(t.state).reso
Line truncated
|
|
|
|
|
`);n>-1&&(t=t.slice(0,n))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=n||(t=t.slice(0,s-(n-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,n=o+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(t,i,1),t+=i;let a=this.chunk.length;i=this.skipGapsTo(n,i,-1),n+=i,s+=this.chunk.length-a}let o=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&o>=0&&this.chunk[o]==e&&this.chunk[o+2]==t?this.chunk[o+2]=n:this.chunk.push(e,t,n,s),i}parseLine(e){let{line:t,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Bd(t,e?e.state.tabSize:4,e?ni(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=bx(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Ee.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:vR,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Ee(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Ee(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function bx(r,e,t){e.start=e.pos;for(let n=0;n<10;n++){let i=r(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}var Fm=Object.create(null),yl=[bt.none],vR=new Qi(yl),tx=[],rx=Object.create(null),yx=Object.create(null);for(let[r,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])yx[r]=Sx(Fm,e);var Vd=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),yx)}resolve(e){return e?this.table[e]||(this.table[e]=Sx(this.extra,e)):0}},xR=new Vd(Fm);function _m(r,e){tx.indexOf(r)>-1||(tx.push(r),console.warn(e))}function Sx(r,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let d=r[c]||O[c];d?typeof d=="function"?l.length?l=l.map(d):_m(c,`Modifier ${c} used at start of tag`):l.length?_m(c,`Tag ${c} used as modifier`):l=Array.isArray(d)?d:[d]:_m(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=n+" "+t.map(a=>a.id),s=rx[i];if(s)return s.id;let o=rx[i]=bt.define({id:yl.length,name:n,props:[Ht({[n]:t})]});return yl.push(o),o.id}function wR(r,e){let t=bt.define({id:yl.length,name:"Document",props:[Ai.add(()=>r),Cr.add(()=>n=>e.getIndent(n))],top:!0});return yl.push(t),t}var w8={rtl:ee.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:et.RTL}),ltr:ee.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:et.LTR}),auto:ee.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var jd=class{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=ze(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),s=i.search(kR(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function vx(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function PR(r){let e=Object.create(null),t=Object.create(null);for(let{label:i}of r){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let n=vx(e)+vx(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function kx(r){let e=r.map(i=>typeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:PR(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function $x(r,e){return t=>{for(let n=ze(t.state).reso
Line truncated
|
|
|
|
|
`;let o=r.state.facet(ri),a=o instanceof Kt?"Lezer LRLanguage":o instanceof Dt?"StreamLanguage":"Unknown",l=o instanceof Kt?"AST ":o instanceof Dt?"Token ":"Name ";return{pos:e,above:!0,arrow:!0,create(c){let d=document.createElement("div");d.style.overflow="visible",d.style.height="0",d.style.width="0";let h=document.createElement("div");return h.className="cm-debug-tooltip",h.textContent=`Parser: ${a}
|
|
|
|
|
${l}: ${n.name}
|
|
|
|
|
Tags : ${s}`,h.style.whiteSpace="pre-wrap",h.style.fontFamily="monospace",h.style.background="#333",h.style.color="white",h.style.padding="2px 8px",h.style.borderRadius="4px",h.style.fontSize="12px",h.style.border="1px solid #555",h.style.pointerEvents="none",h.style.position="absolute",h.style.bottom="0",h.style.width="max-content",d.appendChild(h),{dom:d}}}},{hoverTime:10,hideOnChange:!0});var BR=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=rO(r.state,t.from);return n.line?VR(r):n.block?FR(r):!1};function tO(r,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=r(e,t);return i?(n(t.update(i)),!0):!1}}var VR=tO(UR,0);var YR=tO(Bx,0);var FR=tO((r,e)=>Bx(r,e,jR(e)),0);function rO(r,e){let t=r.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}var xl=50;function NR(r,{open:e,close:t},n,i){let s=r.sliceDoc(n-xl,n),o=r.sliceDoc(i,i+xl),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:n-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let d,h;i-n<=2*xl?d=h=r.sliceDoc(n,i):(d=r.sliceDoc(n,n+xl),h=r.sliceDoc(i-xl,i));let u=/^\s*/.exec(d)[0].length,f=/\s*$/.exec(h)[0].length,m=h.length-f-t.length;return d.slice(u,u+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:n+u+e.length,margin:/\s/.test(d.charAt(u+e.length))?1:0},close:{pos:i-f-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function jR(r){let e=[];for(let t of r.selection.ranges){let n=r.doc.lineAt(t.from),i=t.to<=n.to?n:r.doc.lineAt(t.to);i.from>n.from&&i.from==t.to&&(i=t.to==n.to+1?n:r.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function Bx(r,e,t=e.selection.ranges){let n=t.map(s=>rO(e,s.from).block);if(!n.every(s=>s))return null;let i=t.map((s,o)=>NR(e,n[o],s.from,s.to));if(r!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(r!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=n[o],{open:c,close:d}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:s}}return null}function UR(r,e,t=e.selection.ranges){let n=[],i=-1;e:for(let{from:s,to:o}of t){let a=n.length,l=1e9,c;for(let d=s;d<=o;){let h=e.doc.lineAt(d);if(c==null&&(c=rO(e,h.from).line,!c))continue e;if(h.from>i&&(s==o||o>h.from)){i=h.from;let u=/^\s*/.exec(h.text)[0].length,f=u==h.length,m=h.text.slice(u,u+c.length)==c?u:-1;u<h.text.length&&u<l&&(l=u),n.push({line:h,comment:m,token:c,indent:u,empty:f,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=l);n.length==a+1&&(n[a].single=!0)}if(r!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of n)(h||!d)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(r!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of n)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,s.push({from:c,to:d})}return{changes:s}}return null}var Km=Qr.define(),Hd=Qr.define(),qR=le.define(),Vx=le.define({combine(r){return Yr(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,i)=>e(n,i)||t(n,i)})}}),Yx=Ze.define({create(){return Ks.empty},update(r,e){let t=e.state.facet(Vx),n=e.annotation(Km);if(n){let l=Xn.fromTransaction(e,n.selection),c=n.side,d=c==0?r.undone:r.done;return l?d=Gd(d,d.length,t.minDepth,l):d=jx(d,e.startState.selection),new Ks(c==0?n.rest:d,c==0?d:n.rest)}let i=e.annotation(Hd);if((i=="full"||i=="before")&&(r=r.isolate()),e.annotation(dt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=Xn.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return s?r=r.addChanges(s,o,a,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new Ks(r.done.map(Xn.fromJSON),r.undone.map(Xn.fromJSON))}});function Fx(r={}){return[Yx,Vx.of(r),N.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?wl:e.inputType=="historyRedo"?Ho:null;return n?(e.preventDefault(),n(t)):!1}})]}function Kd(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let i=t.field(Yx,!1);if(!i)return!1;let s=i.pop(r,t,e);return s?(n(s),!0):!1}}var wl=Kd(0,!1),Ho=Kd(1,!1),GR=Kd(0,!0),HR=Kd(1,!0);var Xn=class r{constructor(e,t,n,i,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new r(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this
Line truncated
|
|
|
|
|
Tags : ${s}`,h.style.whiteSpace="pre-wrap",h.style.fontFamily="monospace",h.style.background="#333",h.style.color="white",h.style.padding="2px 8px",h.style.borderRadius="4px",h.style.fontSize="12px",h.style.border="1px solid #555",h.style.pointerEvents="none",h.style.position="absolute",h.style.bottom="0",h.style.width="max-content",d.appendChild(h),{dom:d}}}},{hoverTime:10,hideOnChange:!0});var NR=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=nO(r.state,t.from);return n.line?jR(r):n.block?qR(r):!1};function rO(r,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=r(e,t);return i?(n(t.update(i)),!0):!1}}var jR=rO(KR,0);var UR=rO(Vx,0);var qR=rO((r,e)=>Vx(r,e,HR(e)),0);function nO(r,e){let t=r.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}var wl=50;function GR(r,{open:e,close:t},n,i){let s=r.sliceDoc(n-wl,n),o=r.sliceDoc(i,i+wl),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:n-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let d,h;i-n<=2*wl?d=h=r.sliceDoc(n,i):(d=r.sliceDoc(n,n+wl),h=r.sliceDoc(i-wl,i));let u=/^\s*/.exec(d)[0].length,f=/\s*$/.exec(h)[0].length,m=h.length-f-t.length;return d.slice(u,u+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:n+u+e.length,margin:/\s/.test(d.charAt(u+e.length))?1:0},close:{pos:i-f-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function HR(r){let e=[];for(let t of r.selection.ranges){let n=r.doc.lineAt(t.from),i=t.to<=n.to?n:r.doc.lineAt(t.to);i.from>n.from&&i.from==t.to&&(i=t.to==n.to+1?n:r.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function Vx(r,e,t=e.selection.ranges){let n=t.map(s=>nO(e,s.from).block);if(!n.every(s=>s))return null;let i=t.map((s,o)=>GR(e,n[o],s.from,s.to));if(r!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(r!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=n[o],{open:c,close:d}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:d.pos-d.margin,to:d.pos+l.close.length})}return{changes:s}}return null}function KR(r,e,t=e.selection.ranges){let n=[],i=-1;e:for(let{from:s,to:o}of t){let a=n.length,l=1e9,c;for(let d=s;d<=o;){let h=e.doc.lineAt(d);if(c==null&&(c=nO(e,h.from).line,!c))continue e;if(h.from>i&&(s==o||o>h.from)){i=h.from;let u=/^\s*/.exec(h.text)[0].length,f=u==h.length,m=h.text.slice(u,u+c.length)==c?u:-1;u<h.text.length&&u<l&&(l=u),n.push({line:h,comment:m,token:c,indent:u,empty:f,single:!1})}d=h.to+1}if(l<1e9)for(let d=a;d<n.length;d++)n[d].indent<n[d].line.text.length&&(n[d].indent=l);n.length==a+1&&(n[a].single=!0)}if(r!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:d,single:h}of n)(h||!d)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(r!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of n)if(a>=0){let c=o.from+a,d=c+l.length;o.text[d-o.from]==" "&&d++,s.push({from:c,to:d})}return{changes:s}}return null}var Jm=Qr.define(),Hd=Qr.define(),JR=le.define(),Yx=le.define({combine(r){return Fr(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,i)=>e(n,i)||t(n,i)})}}),Fx=Ze.define({create(){return Ks.empty},update(r,e){let t=e.state.facet(Yx),n=e.annotation(Jm);if(n){let l=Xn.fromTransaction(e,n.selection),c=n.side,d=c==0?r.undone:r.done;return l?d=Gd(d,d.length,t.minDepth,l):d=Ux(d,e.startState.selection),new Ks(c==0?n.rest:d,c==0?d:n.rest)}let i=e.annotation(Hd);if((i=="full"||i=="before")&&(r=r.isolate()),e.annotation(dt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=Xn.fromTransaction(e),o=e.annotation(dt.time),a=e.annotation(dt.userEvent);return s?r=r.addChanges(s,o,a,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new Ks(r.done.map(Xn.fromJSON),r.undone.map(Xn.fromJSON))}});function Nx(r={}){return[Fx,Yx.of(r),N.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?Pl:e.inputType=="historyRedo"?Ko:null;return n?(e.preventDefault(),n(t)):!1}})]}function Kd(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let i=t.field(Fx,!1);if(!i)return!1;let s=i.pop(r,t,e);return s?(n(s),!0):!1}}var Pl=Kd(0,!1),Ko=Kd(1,!1),e2=Kd(0,!0),t2=Kd(1,!0);var Xn=class r{constructor(e,t,n,i,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new r(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this
Line truncated
|
|
|
|
|
`,2e3)){if(!a.trim())continue;if(a[0]==" "){t++;continue}let l=a.length-a.trimStart().length;l>0&&n++;let c=l-i;c>=2&&c<=8&&e.set(c,(e.get(c)||0)+1),i=l}if(t>n)return" ";let s=2,o=0;for(let[a,l]of e)(l>o||l==o&&a<s)&&(s=a,o=l);return" ".repeat(s)}function eM(r){let e=r.state;return e.selection.ranges.some(t=>!t.empty)?rh(r):(r.dispatch(e.changeByRange(t=>{let n=J2(e,t.head);return{changes:{from:t.head,insert:n},range:Z.cursor(t.head+n.length)}}),{scrollIntoView:!0,userEvent:"input"}),!0)}function tM(r){for(let e=1;e<=r.doc.lines;e++)if(/^\d\d/.test(r.doc.line(e).text))return!0;return!1}var kw=[{key:"Enter",run:r=>tM(r.state)&&Sw(r)}],$w=[{key:"Tab",run:eM},{key:"Shift-Tab",run:nh}],Qw=[{key:"Tab",run:xw},{key:"Shift-Tab",run:nh}],$l=50,ih=8,rM=!0;function ea(r){rM&&console.log("[asm-tab] "+r)}function ta(r,e){let t=0;for(let n=0;n<e;n++)t=r.charCodeAt(n)==9?(Math.floor(t/ih)+1)*ih:t+1;return t}function oO(r,e){r>0&&e.set(r,(e.get(r)||0)+1)}function nM(r,e){let t=[],n=/\S+/g,i;for(;(i=n.exec(r))!==null&&r[i.index]!=";";)t.push(ta(r,i.index));let s=/(^|\s);/.exec(r);s&&oO(ta(r,s.index+s[1].length),e);let o=t.length&&t[0]==0?t.slice(1):t;o.length>=1&&oO(o[0],e),o.length>=2&&oO(o[1],e)}var iM=3;function Tw(r,e){let t=r.doc.lineAt(e),n=r.doc.lines,i=(a,l,c,d)=>{let h=0;for(let u=a;u!=l&&h<$l;u+=c){let f=r.doc.line(u);f.text.trim()&&(nM(f.text,d),h++)}return h},s=new Map;return i(t.number+1,Math.min(n,t.number+$l)+1,1,s)<iM&&i(t.number-1,Math.max(1,t.number-$l)-1,-1,s),s}function sM(r,e,t){let n=-1,i=0;for(let[s,o]of r)s>e&&(o>i||o==i&&s<n)&&(n=s,i=o);return n>=0?n:(Math.floor(e/t)+1)*t}function oM(r,e,t){let n=-1,i=0;for(let[s,o]of r)s<e&&(o>i||o==i&&s>n)&&(n=s,i=o);return n>=0?n:Math.max(0,Math.min(Math.floor((e-1)/t)*t,e-1))}function _w(r,e){let t=r.doc.lineAt(e),n=Math.max(1,t.number-$l),i=Math.min(r.doc.lines,t.number+$l);for(let s=n;s<=i;s++)if(r.doc.line(s).text.includes(" "))return!0;return!1}function Aw(r){return"["+[...r.entries()].sort((e,t)=>e[0]-t[0]).map(([e,t])=>`${e}:${t}`).join(" ")+"]"}function aM(r,e){let t=r.doc.lineAt(e),n=ta(t.text,e-t.from),i=_w(r,e),s=i?ih:r.tabSize,o=Tw(r,e),a=sM(o,n,s);return ea(`Tab @ line ${t.number} col ${n}: stops(col:freq)=${Aw(o)} ${i?"grid=8 (file has tabs)":`grid=${r.tabSize}`} -> target=${a} | line=${JSON.stringify(t.text.slice(0,n))}+CURSOR`),a<=n?null:{from:e,insert:" ".repeat(a-n)}}function lM(r,e){let t=r.doc.lineAt(e),n=e-t.from;if(n==0)return ea(`Backspace @ line ${t.number} col 0: start of line, using default`),null;if(t.text[n-1]==" ")return ea(`Backspace @ line ${t.number} col ${ta(t.text,n)}: deleting one tab char`),{from:e-1,to:e};if(!/^[ \t]+$/.test(t.text.slice(0,n)))return ea(`Backspace @ line ${t.number} col ${ta(t.text,n)}: cursor not in leading whitespace, using default`),null;let i=_w(r,e),s=i?ih:r.tabSize,o=ta(t.text,n),a=Tw(r,e),l=oM(a,o,s);if(l>=o)return ea(`Backspace @ line ${t.number} col ${o}: no stop before cursor, using default`),null;let c=e-(o-l);return ea(`Backspace @ line ${t.number} col ${o}: stops(col:freq)=${Aw(a)} ${i?"grid=8 (file has tabs)":`grid=${r.tabSize}`} -> deleting cols ${l}..${o} | line=${JSON.stringify(t.text.slice(0,n))}+CURSOR`),{from:c,to:e}}function cM(r){let e=r.state;if(e.selection.ranges.some(n=>!n.empty))return!1;let t=e.changeByRange(n=>{let i=aM(e,n.head);return i?{changes:i,range:Z.cursor(n.head+i.insert.length)}:{range:n}});return r.dispatch(t),!0}function dM(r){let e=r.state,t=e.selection.main;if(!t.empty)return!1;let n=lM(e,t.head);return n?(r.dispatch(e.update({changes:n,selection:Z.cursor(n.from)})),!0):!1}function Cw(r){return[{key:"Tab",run:e=>r()&&cM(e)},{key:"Backspace",run:e=>r()&&dM(e)}]}var hM=new Bt,uM=new Bt,fM=new Bt,pM=new Bt,mM=new Bt,OM=new Bt,gM=new Bt,bM=new Bt,Rw="8bitworkshop/editorSettings",Ew={tabSize:8,tabsToSpaces:!0,highlightSpecialChars:!1,highlightWhitespace:!1,highlightTrailingWhitespace:!1,closeBrackets:!1,debugHighlightTags:!1,showLineNumbers:!1,showStatusBar:!0};function ra(){try{var r=localStorage.getItem(Rw);if(r)return gt(gt({},Ew),JSON.parse(r))}catch(e){}return gt({},Ew)}function yM(r){localStorage.setItem(Rw,JSON.stringify(r))}var Mw=[[pM,r=>[Me.tabSize.of(r.tabSize),bn.of(" ".repeat(r.tabSize))]],[OM,r=>Sr.of(r.tabsToSpaces?$w:Qw)],[hM,r=>r.highlightSpecialChars?xv():[]],[uM,r=>r.highlightWhitespace?Ev():[]],[fM,r=>r.highlightTrailingWhitespace?Rv():[]],[mM,r=>r.closeBrackets?[_x(),Sr.of([{key:"Backspace",run:Ex}])]:[]],[gM,r=>r.debugHighlightTags?Mx:[]],[bM,r=>r.showLineNumbers?Ad():[]]];function Lw(r){return Mw.map(([e,t])=>e.of(t(r)))}var Dw=new Set;function Iw(r){Dw.add(r)}function SM(r){var e=Mw.map(([n,i])=>n.reconfigure(i(r)));for(var t of Dw)t.dispatch({effects:e})}function Zw(){var r=ra(),e=!wo();bootbox.dialog({onEscape:!0,title:"Settings",message:`<form id="settingsForm" onsubmit="return false">
|
|
|
|
|
<div class="form-group"><label>Tab size: <input type="number" id="setting_tabSize" min="1" max="40" value="${r.tabSize}" style="width:4em"></label></div>
|
|
|
|
|
<div class="checkbox"><label><input type="checkbox" id="setting_tabsToSpaces" ${r.tabsToSpaces?"checked":""}> Insert spaces when pressing TAB</label></div>
|
|
|
|
|
<div class="checkbox"><label><input type="checkbox" id="setting_highlightSpecialChars" ${r.highlightSpecialChars?"checked":""}> Highlight special characters</label></div>
|
|
|
|
@@ -37,23 +38,23 @@ Tags : ${s}`,h.style.whiteSpace="pre-wrap",h.style.fontFamily="monospace",h.sty
|
|
|
|
|
<h5>Internal</h5>
|
|
|
|
|
<div class="checkbox"><label><input type="checkbox" id="setting_debugHighlightTags" ${r.debugHighlightTags?"checked":""}> Debug editor syntax highlighting tags</label></div>
|
|
|
|
|
`:""}
|
|
|
|
|
</form>`,buttons:{cancel:{label:"Cancel",className:"btn-default"},ok:{label:"Save",className:"btn-primary",callback:()=>{r.tabSize=parseInt($("#setting_tabSize").val())||8,r.tabsToSpaces=$("#setting_tabsToSpaces").is(":checked"),r.highlightSpecialChars=$("#setting_highlightSpecialChars").is(":checked"),r.highlightWhitespace=$("#setting_highlightWhitespace").is(":checked"),r.highlightTrailingWhitespace=$("#setting_highlightTrailingWhitespace").is(":checked"),r.closeBrackets=$("#setting_closeBrackets").is(":checked"),r.showLineNumbers=$("#setting_showLineNumbers").is(":checked"),e&&(r.debugHighlightTags=$("#setting_debugHighlightTags").is(":checked")),r.showStatusBar=$("#setting_showStatusBar").is(":checked"),mM(r),OM(r),Pc(r.showStatusBar)}}}})}function sh(){return typeof navigator!="undefined"?navigator.storage:null}function gM(r){var e=r!==void 0?r:sh();return!!(e&&typeof e.persist=="function")}async function bM(r){var e=r!==void 0?r:sh();try{if(e&&typeof e.estimate=="function"){var t=await e.estimate();return{usage:t&&t.usage,quota:t&&t.quota}}}catch(n){console.log("storage.estimate() failed",n)}return{}}async function yM(r){var e=r!==void 0?r:sh(),t={supported:gM(e),persisted:!1};try{e&&typeof e.persisted=="function"&&(t.persisted=await e.persisted())}catch(i){console.log("storage.persisted() failed",i)}var n=await bM(e);return t.usage=n.usage,t.quota=n.quota,t}async function aO(r){var e=r!==void 0?r:sh(),t=await yM(e);if(!t.supported||t.persisted)return t.granted=!1,t;try{t.persisted=await e.persist(),t.granted=t.persisted}catch(n){console.log("storage.persist() failed",n),t.granted=!1}return t}function SM(r){return r==null&&(r=typeof navigator!="undefined"?navigator.userAgent:""),r?/Edg\/|OPR\/|Chrome\/|Chromium\//.test(r)?"chromium":/Firefox\/|FxiOS\//.test(r)?"firefox":/Safari\//.test(r)?"safari":"other":"other"}function Iw(r){if(typeof r!="number"||!isFinite(r))return"?";for(var e=["bytes","KB","MB","GB","TB"],t=0;r>=1024&&t<e.length-1;)r/=1024,t++;return(t==0?r.toFixed(0):r.toFixed(1))+" "+e[t]}function Zw(r){return r.usage==null&&r.quota==null?"":"This site is using "+Iw(r.usage)+" of the "+Iw(r.quota)+" your browser allows."}var oO="Your edits are still saved in this browser either way — persistence only protects them if the browser needs to reclaim disk space. Use <b>File > Download All Changes as ZIP</b> (or push to GitHub) to keep a backup.";function Xw(r){switch(r||SM()){case"chromium":return"Chrome and Edge never ask — they grant persistent storage on their own to sites you use regularly. Bookmarking this page, or installing it as an app, usually qualifies it; then try <b>Request Local Storage Permissions</b> again.";case"firefox":return"Firefox asks for permission the first time. If you dismissed or blocked that prompt, clear it from the padlock icon in the address bar and try <b>Request Local Storage Permissions</b> again.";case"safari":return"Safari decides on its own, and may delete site data after several days without a visit. Adding this page to your Favorites or Home Screen makes eviction less likely.";default:return"This browser decides on its own whether to keep site data."}}function vM(){return"This browser doesn't support persistent storage, so it may discard your local file edits when it needs disk space. "+oO}function zw(r,e){var t=Zw(r),n;return r.supported?r.persisted?n=(r.granted?"Your browser just granted persistent storage. ":"Your browser is already persisting your local file edits. ")+oO:n="Your browser has not granted persistent storage, so it may discard your local file edits when it needs disk space.<br><br>"+Xw()+"<br><br>"+oO:n=vM(),t?n+"<br><br>"+t:n}function Ww(r){return"Your browser ran out of space for this site, so your last edit may not have been saved.<br><br>"+Zw(r)+" Delete unused projects, or use <b>File > Download All Changes as ZIP</b> to back up your work before it is lost."+(r.supported&&!r.persisted?"<br><br>"+Xw():"")}var Hw=Gu(of());var ra=class{constructor(e,t){e=e||[],this.lines=e,this.text=t,this.offset2loc=new Map,this.line2offset=new Map;for(var n of e)n.offset>=0&&(this.offset2loc.has(n.offset)||this.offset2loc.set(n.offset,n),this.line2offset.has(n.line)||this.line2offset.set(n.line,n.offset));this.sortedOffsets=Array.from(this.offset2loc.keys()).sort((i,s)=>i-s)}findLineForOffset(e,t){let n=this.sortedOffsets;for(var i=0,s=n.length-1,o=-1;i<=s;){var a=i+s>>1;n[a]<=e?(o=a,i=a+1):s=a-1}if(o<0)return null;var l=n[o];return e-l>t?null:this.offset2loc.get(l)}lineCount(){return this.lines.length}};function Bw(r){return"errors"in r}function Vw(r){return"output"in r}function na(r,e){if(e){var t=Ma(e);t!=""&&r.startsWith(t+"/")&&(r=r.substring(t.length+1))}return r}function xM(r,e){var t=Ma(e);return t.length>0&&t!="local"?[t+"/"+r,r]:[r]}function wM(r,e,t,n){var i=s=>ry(r,s).map(o=>xM(o,e));return{includes:i(Qc(t,n)),links:i(Tc(t,n))}}async function Fw(r,e,t,n,i){for(var s=[],o=new Set([na(e,e)]),a=[{path:e,text:t,tool:i(e)}]Line truncated
|
|
|
|
|
</form>`,buttons:{cancel:{label:"Cancel",className:"btn-default"},ok:{label:"Save",className:"btn-primary",callback:()=>{r.tabSize=parseInt($("#setting_tabSize").val())||8,r.tabsToSpaces=$("#setting_tabsToSpaces").is(":checked"),r.highlightSpecialChars=$("#setting_highlightSpecialChars").is(":checked"),r.highlightWhitespace=$("#setting_highlightWhitespace").is(":checked"),r.highlightTrailingWhitespace=$("#setting_highlightTrailingWhitespace").is(":checked"),r.closeBrackets=$("#setting_closeBrackets").is(":checked"),r.showLineNumbers=$("#setting_showLineNumbers").is(":checked"),e&&(r.debugHighlightTags=$("#setting_debugHighlightTags").is(":checked")),r.showStatusBar=$("#setting_showStatusBar").is(":checked"),yM(r),SM(r),kc(r.showStatusBar)}}}})}function sh(){return typeof navigator!="undefined"?navigator.storage:null}function vM(r){var e=r!==void 0?r:sh();return!!(e&&typeof e.persist=="function")}async function xM(r){var e=r!==void 0?r:sh();try{if(e&&typeof e.estimate=="function"){var t=await e.estimate();return{usage:t&&t.usage,quota:t&&t.quota}}}catch(n){console.log("storage.estimate() failed",n)}return{}}async function wM(r){var e=r!==void 0?r:sh(),t={supported:vM(e),persisted:!1};try{e&&typeof e.persisted=="function"&&(t.persisted=await e.persisted())}catch(i){console.log("storage.persisted() failed",i)}var n=await xM(e);return t.usage=n.usage,t.quota=n.quota,t}async function lO(r){var e=r!==void 0?r:sh(),t=await wM(e);if(!t.supported||t.persisted)return t.granted=!1,t;try{t.persisted=await e.persist(),t.granted=t.persisted}catch(n){console.log("storage.persist() failed",n),t.granted=!1}return t}function PM(r){return r==null&&(r=typeof navigator!="undefined"?navigator.userAgent:""),r?/Edg\/|OPR\/|Chrome\/|Chromium\//.test(r)?"chromium":/Firefox\/|FxiOS\//.test(r)?"firefox":/Safari\//.test(r)?"safari":"other":"other"}function Xw(r){if(typeof r!="number"||!isFinite(r))return"?";for(var e=["bytes","KB","MB","GB","TB"],t=0;r>=1024&&t<e.length-1;)r/=1024,t++;return(t==0?r.toFixed(0):r.toFixed(1))+" "+e[t]}function zw(r){return r.usage==null&&r.quota==null?"":"This site is using "+Xw(r.usage)+" of the "+Xw(r.quota)+" your browser allows."}var aO="Your edits are still saved in this browser either way — persistence only protects them if the browser needs to reclaim disk space. Use <b>File > Download All Changes as ZIP</b> (or push to GitHub) to keep a backup.";function Ww(r){switch(r||PM()){case"chromium":return"Chrome and Edge never ask — they grant persistent storage on their own to sites you use regularly. Bookmarking this page, or installing it as an app, usually qualifies it; then try <b>Request Local Storage Permissions</b> again.";case"firefox":return"Firefox asks for permission the first time. If you dismissed or blocked that prompt, clear it from the padlock icon in the address bar and try <b>Request Local Storage Permissions</b> again.";case"safari":return"Safari decides on its own, and may delete site data after several days without a visit. Adding this page to your Favorites or Home Screen makes eviction less likely.";default:return"This browser decides on its own whether to keep site data."}}function kM(){return"This browser doesn't support persistent storage, so it may discard your local file edits when it needs disk space. "+aO}function Bw(r,e){var t=zw(r),n;return r.supported?r.persisted?n=(r.granted?"Your browser just granted persistent storage. ":"Your browser is already persisting your local file edits. ")+aO:n="Your browser has not granted persistent storage, so it may discard your local file edits when it needs disk space.<br><br>"+Ww()+"<br><br>"+aO:n=kM(),t?n+"<br><br>"+t:n}function Vw(r){return"Your browser ran out of space for this site, so your last edit may not have been saved.<br><br>"+zw(r)+" Delete unused projects, or use <b>File > Download All Changes as ZIP</b> to back up your work before it is lost."+(r.supported&&!r.persisted?"<br><br>"+Ww():"")}var Jw=Hu(af());var na=class{constructor(e,t){e=e||[],this.lines=e,this.text=t,this.offset2loc=new Map,this.line2offset=new Map;for(var n of e)n.offset>=0&&(this.offset2loc.has(n.offset)||this.offset2loc.set(n.offset,n),this.line2offset.has(n.line)||this.line2offset.set(n.line,n.offset));this.sortedOffsets=Array.from(this.offset2loc.keys()).sort((i,s)=>i-s)}findLineForOffset(e,t){let n=this.sortedOffsets;for(var i=0,s=n.length-1,o=-1;i<=s;){var a=i+s>>1;n[a]<=e?(o=a,i=a+1):s=a-1}if(o<0)return null;var l=n[o];return e-l>t?null:this.offset2loc.get(l)}lineCount(){return this.lines.length}};function Yw(r){return"errors"in r}function Fw(r){return"output"in r}function ia(r,e){if(e){var t=La(e);t!=""&&r.startsWith(t+"/")&&(r=r.substring(t.length+1))}return r}function $M(r,e){var t=La(e);return t.length>0&&t!="local"?[t+"/"+r,r]:[r]}function QM(r,e,t,n){var i=s=>ny(r,s).map(o=>$M(o,e));return{includes:i(Tc(t,n)),links:i(_c(t,n))}}async function jw(r,e,t,n,i){for(var s=[],o=new Set([ia(e,e)]),a=[{path:e,text:t,tool:i(e)}]Line truncated
|
|
|
|
|
=====
|
|
|
|
|
|
|
|
|
|
[Open this project in 8bitworkshop](http://8bitworkshop.com/redir.html?platform=$PLATFORM&githubURL=$GITHUBURL&file=$MAINFILE).
|
|
|
|
|
`;function Js(){for(var r={},e=0;e<localStorage.length;e++){var t=localStorage.key(e);if(t.startsWith("__repo__")){var n=JSON.parse(localStorage.getItem(t)),i=t.substring(8);r[i]=n}}return r}function $l(r){var e=r.split("/",8);return e.length<5||e[0]!="https:"||e[2]!="github.com"||e[5]&&e[5]!="tree"?null:{user:e[3],repo:e[4],repopath:e[3]+"/"+e[4],branch:e[6],subtreepath:e[7]}}var dh=class{constructor(e,t,n,i){this.githubCons=e,this.githubToken=t,this.store=n,this.project=i,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((t,n)=>{t()});var e=new firebase.auth.GithubAuthProvider;return e.addScope("repo"),firebase.auth().signInWithPopup(e).then(t=>{this.githubToken=t.credential.accessToken;var n=t.user;this.recreateGithub(),document.cookie="__github_key="+this.githubToken+";path=/;max-age=31536000",console.log("Stored GitHub OAUTH key")})}logout(){return this.githubToken&&this.githubToken.length?firebase.auth().signOut().then(()=>{document.cookie="__github_key=;path=/;max-age=0",this.githubToken=null,this.recreateGithub()}):new Promise((e,t)=>{e()})}isFileIgnored(e){return e=e.toUpperCase(),!!(e.startsWith("LICENSE")||e.startsWith("README")||e.startsWith("."))}async getGithubSession(e){var t=$l(e);if(!t)throw new Error("Please enter a valid GitHub URL.");var n=Js()[t.repopath],i=t.branch||n&&n.branch,s=this.github.repos(t.user,t.repo);try{i=(await s.fetch()).defaultBranch||"master"}catch(a){console.log("could not fetch default branch: "+a),i="main"}console.log("branch =",i);var o={url:e,user:t.user,reponame:t.repo,repopath:t.repopath,branch:i,subtreepath:t.subtreepath,prefix:"",repo:s,platform_id:this.project?this.project.platform_id:n?n.platform_id:null};return o}getGithubHEADTree(e){var t;return this.getGithubSession(e).then(n=>(t=n,t.repo.git.refs.heads(t.branch).fetch())).then(n=>(t.head=n,t.sha=n.object.sha,t.repo.git.trees(t.sha).fetch())).then(n=>{if(t.subtreepath){for(let i of n.tree)if(i.type=="tree"&&i.path==t.subtreepath&&i.sha)return t.repo.git.trees(i.sha).fetch();throw Error("Cannot find subtree '"+t.subtreepath+"' in tree "+n.sha)}return n}).then(n=>(t.tree=n,t))}bind(e,t){var n="__repo__"+e.repopath;if(t){var i={url:e.url,branch:e.branch,platform_id:e.platform_id,mainPath:e.mainPath,sha:e.sha};console.log("storing",i),localStorage.setItem(n,JSON.stringify(i))}else localStorage.removeItem(n)}import(e){var t;return this.getGithubSession(e).then(n=>(t=n,t.repo.contents("README.md").read())).catch(n=>(console.log(n),console.log("no README.md found"),t.repo.fetch().then(i=>""))).then(n=>{var i;if(i=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(n),i&&i[1]&&(console.log("main path: '"+i[1]+"'"),t.mainPath=i[1]),i=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(n),i){if(console.log("platform id: '"+i[1]+"'"),t.platform_id&&!t.platform_id.startsWith(i[1]))throw Error("Platform mismatch: Repository is '"+i[1]+"', you have '"+t.platform_id+"' selected.");t.platform_id=i[1]}return this.bind(t,!0),t})}pull(e,t){var n;return this.getGithubHEADTree(e).then(i=>{n=i;let s=[];return n.paths=[],n.tree.tree.forEach(o=>{if(console.log(o.path,o.type,o.size),n.paths.push(o.path),o.type=="blob"&&!this.isFileIgnored(o.path)){var a=n.repo.git.blobs(o.sha).fetch().then(l=>{var c=n.prefix+o.path,d=o.size,h=l.encoding,u=l.content;if(l.encoding=="base64"){var f=mc(atob(u)),m=Cs(o.path,f);u=m?f:gc(f)}return l.size!=u.length&&(u=u.slice(0,l.size)),(t||this.store).setItem(c,u)});s.push(a)}else console.log("ignoring "+o.path)}),Promise.all(s)}).then(i=>n)}importAndPull(e){return this.import(e).then(t=>this.pull(e))}publish(e,t,n,i){var s,o=this.project.platform_id,a=this.project.stripLocalPath(this.project.mainPath);return this.github.user.repos.create({name:e,description:t,private:i,auto_init:!1,license_template:n}).then(l=>{s=l;var c=PM;c=c.replace(/\$NAME/g,encodeURIComponent(e)),c=c.replace(/\$PLATFORM/g,encodeURIComponent(o)),c=c.replace(/\$GITHUBURL/g,encodeURIComponent(s.htmlUrl)),c=c.replace(/\$MAINFILE/g,encodeURIComponent(a));var d={message:"8bitworkshop: updated metadata in README.md",content:btoa(c)};return s.contents("README.md").add(d)}).then(()=>this.getGithubSession(s.htmlUrl))}commit(e,t,n){var i;return t||(t="updated from 8bitworkshop.com"),this.getGithubHEADTree(e).then(s=>{if(i=s,i.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(n.map(o=>typeof o.data=="string"?i.repo.git.blobs.create({content:o.data,encoding:"utf-8"}):i.repo.git.blobs.create({content:btoa(Oc(o.data)),encoding:"base64"})))}).then(s=>i.repo.git.trees.create({tree:n.map((o,a)=>({path:o.path,mode:"100644",type:"blob",sha:s[a].sha})),base_tree:i.tree.sha})).then(s=>i.repo.git.commits.create({message:t,tree:s.sha,parents:[i.head.object.sha]})).then(s=>i.repo.commits(s.sha).fetch()).then(s=>(i.commit=s,i))}push(e){return e.head.update({sha:e.com
Line truncated
|
|
|
|
|
`},s=window.c2t({noInitialRun:!0,print:i,printErr:i}),o=s.FS,a=kt()+".bin",l=kt()+".wav";o.writeFile(a,xr(),{encoding:"binary"});var c=["-2bc",a+","+e.toString(16),l];s.callMain(c);var d=o.readFile(l,{encoding:"binary"});if(d){var h=new Blob([d],{type:"audio/wav"});(0,ii.saveAs)(h,l),n+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",ar(n)}})}function TM(r){ln("lib/makewav.js").then(()=>{let e="",t=function(a){e+=a+`
|
|
|
|
|
`;function Js(){for(var r={},e=0;e<localStorage.length;e++){var t=localStorage.key(e);if(t.startsWith("__repo__")){var n=JSON.parse(localStorage.getItem(t)),i=t.substring(8);r[i]=n}}return r}function Ql(r){var e=r.split("/",8);return e.length<5||e[0]!="https:"||e[2]!="github.com"||e[5]&&e[5]!="tree"?null:{user:e[3],repo:e[4],repopath:e[3]+"/"+e[4],branch:e[6],subtreepath:e[7]}}var dh=class{constructor(e,t,n,i){this.githubCons=e,this.githubToken=t,this.store=n,this.project=i,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((t,n)=>{t()});var e=new firebase.auth.GithubAuthProvider;return e.addScope("repo"),firebase.auth().signInWithPopup(e).then(t=>{this.githubToken=t.credential.accessToken;var n=t.user;this.recreateGithub(),document.cookie="__github_key="+this.githubToken+";path=/;max-age=31536000",console.log("Stored GitHub OAUTH key")})}logout(){return this.githubToken&&this.githubToken.length?firebase.auth().signOut().then(()=>{document.cookie="__github_key=;path=/;max-age=0",this.githubToken=null,this.recreateGithub()}):new Promise((e,t)=>{e()})}isFileIgnored(e){return e=e.toUpperCase(),!!(e.startsWith("LICENSE")||e.startsWith("README")||e.startsWith("."))}async getGithubSession(e){var t=Ql(e);if(!t)throw new Error("Please enter a valid GitHub URL.");var n=Js()[t.repopath],i=t.branch||n&&n.branch,s=this.github.repos(t.user,t.repo);try{i=(await s.fetch()).defaultBranch||"master"}catch(a){console.log("could not fetch default branch: "+a),i="main"}console.log("branch =",i);var o={url:e,user:t.user,reponame:t.repo,repopath:t.repopath,branch:i,subtreepath:t.subtreepath,prefix:"",repo:s,platform_id:this.project?this.project.platform_id:n?n.platform_id:null};return o}getGithubHEADTree(e){var t;return this.getGithubSession(e).then(n=>(t=n,t.repo.git.refs.heads(t.branch).fetch())).then(n=>(t.head=n,t.sha=n.object.sha,t.repo.git.trees(t.sha).fetch())).then(n=>{if(t.subtreepath){for(let i of n.tree)if(i.type=="tree"&&i.path==t.subtreepath&&i.sha)return t.repo.git.trees(i.sha).fetch();throw Error("Cannot find subtree '"+t.subtreepath+"' in tree "+n.sha)}return n}).then(n=>(t.tree=n,t))}bind(e,t){var n="__repo__"+e.repopath;if(t){var i={url:e.url,branch:e.branch,platform_id:e.platform_id,mainPath:e.mainPath,sha:e.sha};console.log("storing",i),localStorage.setItem(n,JSON.stringify(i))}else localStorage.removeItem(n)}import(e){var t;return this.getGithubSession(e).then(n=>(t=n,t.repo.contents("README.md").read())).catch(n=>(console.log(n),console.log("no README.md found"),t.repo.fetch().then(i=>""))).then(n=>{var i;if(i=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(n),i&&i[1]&&(console.log("main path: '"+i[1]+"'"),t.mainPath=i[1]),i=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(n),i){if(console.log("platform id: '"+i[1]+"'"),t.platform_id&&!t.platform_id.startsWith(i[1]))throw Error("Platform mismatch: Repository is '"+i[1]+"', you have '"+t.platform_id+"' selected.");t.platform_id=i[1]}return this.bind(t,!0),t})}pull(e,t){var n;return this.getGithubHEADTree(e).then(i=>{n=i;let s=[];return n.paths=[],n.tree.tree.forEach(o=>{if(console.log(o.path,o.type,o.size),n.paths.push(o.path),o.type=="blob"&&!this.isFileIgnored(o.path)){var a=n.repo.git.blobs(o.sha).fetch().then(l=>{var c=n.prefix+o.path,d=o.size,h=l.encoding,u=l.content;if(l.encoding=="base64"){var f=Oc(atob(u)),m=Cs(o.path,f);u=m?f:bc(f)}return l.size!=u.length&&(u=u.slice(0,l.size)),(t||this.store).setItem(c,u)});s.push(a)}else console.log("ignoring "+o.path)}),Promise.all(s)}).then(i=>n)}importAndPull(e){return this.import(e).then(t=>this.pull(e))}publish(e,t,n,i){var s,o=this.project.platform_id,a=this.project.stripLocalPath(this.project.mainPath);return this.github.user.repos.create({name:e,description:t,private:i,auto_init:!1,license_template:n}).then(l=>{s=l;var c=TM;c=c.replace(/\$NAME/g,encodeURIComponent(e)),c=c.replace(/\$PLATFORM/g,encodeURIComponent(o)),c=c.replace(/\$GITHUBURL/g,encodeURIComponent(s.htmlUrl)),c=c.replace(/\$MAINFILE/g,encodeURIComponent(a));var d={message:"8bitworkshop: updated metadata in README.md",content:btoa(c)};return s.contents("README.md").add(d)}).then(()=>this.getGithubSession(s.htmlUrl))}commit(e,t,n){var i;return t||(t="updated from 8bitworkshop.com"),this.getGithubHEADTree(e).then(s=>{if(i=s,i.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(n.map(o=>typeof o.data=="string"?i.repo.git.blobs.create({content:o.data,encoding:"utf-8"}):i.repo.git.blobs.create({content:btoa(gc(o.data)),encoding:"base64"})))}).then(s=>i.repo.git.trees.create({tree:n.map((o,a)=>({path:o.path,mode:"100644",type:"blob",sha:s[a].sha})),base_tree:i.tree.sha})).then(s=>i.repo.git.commits.create({message:t,tree:s.sha,parents:[i.head.object.sha]})).then(s=>i.repo.commits(s.sha).fetch()).then(s=>(i.commit=s,i))}push(e){return e.head.update({sha:e.com
Line truncated
|
|
|
|
|
`},s=window.c2t({noInitialRun:!0,print:i,printErr:i}),o=s.FS,a=kt()+".bin",l=kt()+".wav";o.writeFile(a,xr(),{encoding:"binary"});var c=["-2bc",a+","+e.toString(16),l];s.callMain(c);var d=o.readFile(l,{encoding:"binary"});if(d){var h=new Blob([d],{type:"audio/wav"});(0,ii.saveAs)(h,l),n+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",ar(n)}})}function EM(r){dn("lib/makewav.js").then(()=>{let e="",t=function(a){e+=a+`
|
|
|
|
|
`};var n=zt(kt());let i=n+".bin",s=n+".wav";window.makewav({noInitialRun:!1,print:t,printErr:t,arguments:["-ts","-f0","-v10",i],preRun:a=>{a.FS.writeFile(i,xr(),{encoding:"binary"})}}).ready.then(a=>{let l=[i];a.run(l),console.log(e);let d=a.FS.readFile(s,{encoding:"binary"});if(d){let h=new Blob([d],{type:"audio/wav"});(0,ii.saveAs)(h,s),e+=`
|
|
|
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,ar(e)}})})}function _M(r){var e=zt(kt());let t=e+".tap",n=new eo(e),i=new hh({sine_wave:!0}),s=xr(),o=s[0]+s[1]*256;s=s.slice(2),n.setContent({data:s,startAddress:o,type:eo.FILE_TYPE_NON_RELOCATABLE}),n.generateSound(i);let a=i.getTAPData();if(a){let l=new Blob([a],{type:"application/octet-stream"});(0,ii.saveAs)(l,t)}}function cO(){switch(ir(fe)){case"vcs":return TM;case"apple2":return QM;case"c64":return _M}}function Jw(r){if(xr()==null)return Re("Please fix errors before exporting."),!0;var e=cO();if(e===void 0)return Re("Cassette export is not supported on this platform."),!0;e(r)}function eP(r){if(xr()==null)return Re("Please finish compiling with no errors before downloading ROM."),!0;var e=zt(kt());if(P.getDownloadFile){var t=P.getDownloadFile(),e=zt(kt());(0,ii.saveAs)(t.blob,e+t.extension)}else if(xr()instanceof Uint8Array){var n=new Blob([xr()],{type:"application/octet-stream"}),i=P.getROMExtension&&P.getROMExtension(xr())||"-"+ir(fe)+".bin";(0,ii.saveAs)(n,e+i)}else Re(`The "${fe}" platform doesn't have downloadable ROMs.`)}function tP(r){var e=F.getCurrentText();if(!e)return!1;var t=new Blob([e],{type:"text/plain;charset=utf-8"});(0,ii.saveAs)(t,aP(),{autoBom:!1})}async function rP(){let r=(await import("./jszip.min-EENSZHRN.js")).default;return new r}async function nP(r){var e=await rP();Ci().iterateFiles((t,n)=>{n&&e.file(St(t),n)}),e.generateAsync({type:"blob"}).then(t=>{(0,ii.saveAs)(t,kt()+"-"+ir(fe)+".zip")})}function iP(r){let e=P.getDebugSymbolFile&&P.getDebugSymbolFile();if(!e){Re("This project does not have debug information.");return}var t=zt(kt());(0,ii.saveAs)(e.blob,t+e.extension,{autoBom:!1})}async function sP(r){var e=await rP(),t=await ss().keys();st(!0);try{var n=0;await Promise.all(t.map(s=>ss().getItem(s).then(o=>{Cn(n++/(t.length+1)),o&&e.file(s,o)})));var i=await e.generateAsync({type:"blob"});(0,ii.saveAs)(i,ir(fe)+"-all.zip")}finally{st(!1)}}var lO=!1;function oP(){lO||ln("lib/gif.js").then(()=>{var r=$("#emulator").find("canvas")[0];if(!r){Re("Could not find canvas element to record video!");return}var e=0;r.style&&r.style.transform&&(r.style.transform.indexOf("rotate(-90deg)")>=0?e=-1:r.style.transform.indexOf("rotate(90deg)")>=0&&(e=1));var t=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:e}),n=$("#videoPreviewImage");t.on("progress",l=>{Cn(l)}),t.on("finished",l=>{n.attr("src",URL.createObjectURL(l)),st(!1),P.resume(),$("#videoPreviewModal").modal("show")});var i=20,s=300,o=0;console.log("Recording video",r),$("#emulator").css("backgroundColor","#cc3333");var a=()=>{o++>s?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),st(!0),P.pause(),t.render(),lO=!1):(t.addFrame(r,{delay:i,copy:!0}),setTimeout(a,i),lO=!0)};a()})}var dO;async function to(){if(!dO){await ln("lib/octokat.js"),await ln("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await ln("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await ln("https://8bitworkshop.com/config.js");var r=bc("__github_key");dO=new dh(Octokat,r,ss(),Ci()),console.log("loaded github service")}return dO}function Tl(){var r=(_t||"").split("/");return r.length!=2?(Re("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+r[0]+"/"+r[1]}async function _l(r,e){var t,n=$l(r);if(!n){Re("Could not parse GitHub URL.");return}var i=Js()[n.repopath];if(!(i&&!confirm("You've already imported "+n.repopath+" -- do you want to replace all local files?"))){st(!0);var s=ch(n.repopath);Cn(.25);var o=await to();return o.import(r).then(a=>(t=a,Cn(.75),o.pull(r,s))).then(a=>{st(!1),ro(e,{repo:n.repopath})}).catch(a=>{st(!1),console.log(a),Re("Could not import "+r+". "+a)})}}async function lP(r){var e=await to();e.login().then(()=>{ar("You are signed in to GitHub.")}).catch(t=>{Re("Could not sign in."+t)})}async function cP(r){var e=await to();e.logout().then(()=>{ar("You are logged out of GitHub.")})}function dP(r){var e=$("#importGithubModal"),t=$("#importGithubButton");e.modal("show"),e.off("shown.bs.modal").on("shown.bs.modal",()=>$("#importGithubURL").trigger("focus")),$("#importGithubURL").off("keydown").on("keydown",n=>{n.key==="Enter"&&(n.preventDefault(),t.trigger("click"))}),t.off("click").on("click",()=>{var n=$("#importGithubURL").val()+"";e.modal("hide"),_l(n,!1)})}function hP(r){if(!(_t&&!confirm("This project ("+Ci().mainPath+") is already bound to a GitHub repository. Do you want to re-publish to a new repository? (You can instead choose 'Push Changes' to update files in the existing repository.)"))){var e=$("#publishGithubModal"),t=$("#publishGithubButton");$("#githubRepoName").val(zt(St(Ci().mainPath))),e.modal("show"),t.off("click").on("click",async()=>{var n=$("#githubRepoName").val()+"",i=$("#githubRepoDesc").val()+"",s=$("#githubRepoPrivate").val()=="private",o=$("#githubRepoLicense").val()+""Line truncated
|
|
|
|
|
`);for(let o=0;o<s.length;o++){let a=s[o],l=o+1,c=a.match(/(?:function|func|def|proc)\s+(\w+)/i);c&&i.push({id:`${e}:${l}:${c[1]}`,name:c[1],kind:"func",source:n,file:e,line:l});let d=a.match(/(?:var|let|const|global)\s+(\w+)/i);d&&i.push({id:`${e}:${l}:${d[1]}`,name:d[1],kind:"var",source:n,file:e,line:l});let h=a.match(/(?:struct|class|interface|type)\s+(\w+)/i);h&&i.push({id:`${e}:${l}:${h[1]}`,name:h[1],kind:"type",source:n,file:e,line:l});let u=a.match(/^\s*(\w+)\s*:/);u&&!a.trim().startsWith("//")&&i.push({id:`${e}:${l}:${u[1]}`,name:u[1],kind:"label",source:n,file:e,line:l});let f=a.match(/#define\s+(\w+)/i);f&&i.push({id:`${e}:${l}:${f[1]}`,name:f[1],kind:"macro",source:n,file:e,line:l});let m=a.match(/^\s*(\w+)\s*(?:=|equ)\s+/i);m&&i.push({id:`${e}:${l}:${m[1]}`,name:m[1],kind:"equate",source:n,file:e,line:l})}return i}var bP=()=>null;function yP(r){bP=r}function oa(){return bP()}var uh=class{constructor(){this.id="project";this.kind="project";this.rebuilt=!1;this.index=new sa([])}async ready(){await this.index.init(),this.rebuilt||(this.rebuilt=!0,await this.rebuild())}query(e,t){let n=this.index.query(e,t),i=this.fulltextQuery(e,t),s=n.concat(i);return s.sort((o,a)=>a.score-o.score),s.slice(0,t)}fulltextQuery(e,t){if(e.length<2)return[];let n=e.toLowerCase(),i=[],s=Math.max(t,10),o=oa();return o?(o.iterateFiles((a,l)=>{if(typeof l!="string")return;let c=l.split(`
|
|
|
|
|
`),d=0;for(let h=0;h<c.length;h++){let u=c[h],m=u.toLowerCase().indexOf(n);if(m>=0){let g=u.trim();if(!g)continue;if(i.push({record:{id:`text:${a}:${h+1}`,name:g.length>80?g.slice(0,80)+"\u2026":g,kind:"text",source:"project",file:a,line:h+1},score:200+Math.max(0,100-m*2),ranges:[m,m+e.length]}),++d>=s)break}}}),i):[]}async onFileChanged(e,t){let n=this.extractSymbolsFromFile(e,t,"project");this.index.pushRecords(n)}extractSymbolsFromFile(e,t,n){if(typeof t!="string")return[];let i=this.detectEditorStyle(e);return uO(t,e,i,n)}detectEditorStyle(e){var n;switch((n=e.split(".").pop())==null?void 0:n.toLowerCase()){case"c":case"h":return"text/x-csrc";case"asm":case"a65":case"inc":return"6502";case"v":return"verilog";case"wiz":return"text/x-wiz";case"bas":case"basic":return"basic";case"fb":case"fastbasic":return"fastbasic";case"bac":case"bataribasic":return"bataribasic";case"i":return"inform6";case"d":return"dialog";default:return"text/x-csrc"}}async rebuild(){this.index.clear(),await this.index.init();let e=oa();if(!e)return;let t=[];e.iterateFiles((n,i)=>{if(typeof i!="string")return;let s=this.detectEditorStyle(n),o=uO(i,n,s,"project");t.push(...o)}),this.index.pushRecords(t)}};var MM=new Set(["h","hh","hpp","inc","asm","a65","s","mac","defs","def","equ","i","m","c","bas","txt"]),LM=20,fh=class{constructor(){this.id="toolchain";this.kind="toolchain";this.fsName=null;this.files=[];this.loaded=new Map;this.readyPromise=null;this.batchSize=LM}async ready(){return this.readyPromise||(this.readyPromise=this.load()),this.readyPromise}async load(){let e=oa();if(!e)return;let t;try{t=e.getToolForFilename?e.getToolForFilename(e.mainPath):""}catch(o){t=""}let n=Ac(t,e.platform_id),i=_c(t,e.platform_id);if(!n||!i.length)return;this.fsName=n;let s=new Set;for(let o of i){let a=await this.listFiles(o);for(let l of a)this.isSearchable(l)&&!s.has(l)&&(s.add(l),this.files.push(l))}this.files.sort();for(let o=0;o<this.files.length;o+=this.batchSize){let a=this.files.slice(o,o+this.batchSize),l=await Promise.all(a.map(async c=>{let d=await this.readFile(c);return[c,d]}));for(let[c,d]of l)d!=null&&this.loaded.set(c,d)}}isValid(){return this.fsName!=null&&this.files.length>0}async listFiles(e){let t=oa();if(!t||!this.fsName||!t.queryWorker)return[];try{let n={preload_fs:this.fsName,listshared:e,updates:[],buildsteps:[]},i=await t.queryWorker(n),s=i&&i.output;return Array.isArray(s)?s:[]}catch(n){return console.debug("Toolchain list error:",n),[]}}async readFile(e){let t=oa();if(!t||!this.fsName||!t.queryWorker)return null;try{let n={preload_fs:this.fsName,readshared:e,updates:[],buildsteps:[]},i=await t.queryWorker(n),s=i&&i.output;return s instanceof Uint8Array&&s.length>0?new TextDecoder().decode(s):null}catch(n){return console.debug("Toolchain read error:",n),null}}isSearchable(e){let t=e.split("/").pop()||e,n=t.lastIndexOf(".");return n<0?!0:MM.has(t.substring(n+1).toLowerCase())}async query(e,t){return await this.ready(),!this.isValid()||e.length<2?[]:this.textQuery(e,t)}textQuery(e,t){if(e.length<2)return[];let n=e.toLowerCase(),i=[],s=Math.max(t,5);for(let[o,a]of this.loaded){let l=a.split(`
|
|
|
|
|
`),c=0;for(let d=0;d<l.length;d++){let h=l[d],f=h.toLowerCase().indexOf(n);if(f>=0){let m=h.trim();if(!m)continue;if(i.push({record:{id:`toolchain:${o}:${d+1}`,name:m.length>80?m.slice(0,80)+"\u2026":m,kind:"text",source:"toolchain",file:o,line:d+1},score:200+Math.max(0,100-f*2),ranges:[f,f+e.length]}),++c>=s)break}}}return i.sort((o,a)=>a.score-o.score),i.slice(0,t)}invalidate(){this.fsName=null,this.files=[],this.loaded.clear(),this.readyPromise=null}};var SP=()=>[];function vP(r){SP=r}var DM=/<h([1-3])\b[^>]*>([\s\S]*?)<\/h\1>/gi;function IM(r){return r.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&#(?:0*39|x27);/gi,"'").replace(/ /g," ").replace(/…/g,"\u2026").replace(/—/g,"\u2014").replace(/–/g,"\u2013").replace(/’|‘/g,"'").replace(/”|“/g,'"').replace(/»/g,"\xBB").replace(/«/g,"\xAB").replace(/&/g,"&")}function fO(r){return IM(r.replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim()}function ZM(r,e=180){let t=r.trim();if(!t)return;let i=t.slice(0,e).match(/^([\s\S]*?[.!?])(?:\s|$)/);return i?i[1]:t.length<=e?t:t.slice(0,e-1)+"\u2026"}function XM(r){let e=[],t="#help/"+r.id,n=r.title||r.id,i=r.html||"",s=[],o=new RegExp(DM.source,"gi"),a;for(;a=o.exec(i);)s.push({name:fO(a[2]),start:a.index,end:o.lastIndex});let l=(u,f,m)=>{if(!f)return;let g=ZM(m),v=g&&m.startsWith(g)?m.slice(g.length).trim():m;e.push({id:`${r.id}:${u}`,name:f,kind:"doc",brief:g,detail:v||void 0,source:"docs",file:n,url:t})},c=s.length?s[0].start:i.length,d=fO(i.slice(0,c)),h=s.length&&s[0].start===0?s[0].name||r.title:r.title||r.id;l(0,h,d);for(let u=0;u<s.length;u++){if(u===0&&s[0].start===0)continue;let f=u+1<s.length?s[u+1].start:i.length;l(u+1,s[u].name,fO(i.slice(s[u].end,f)))}return e}var ph=class{constructor(){this.id="docs";this.kind="docs";this.index=null;this.readyPromise=null}async ready(){return this.readyPromise?this.readyPromise:(this.readyPromise=this.load(),this.readyPromise)}async load(){let e=SP()||[];if(e.length===0)return;let t=[];for(let i of e)t.push(...XM(i));if(t.length===0)return;let n=new sa(t);await n.init(),this.index=n}async query(e,t){return await this.ready(),this.index?this.index.query(e,t):[]}};var zM=50,pO=class r{constructor(){this.sources=new Map;this.projectSource=new uh,this.toolchainSource=new fh,this.docsSource=new ph,this.sources.set("project",this.projectSource),this.sources.set("toolchain",this.toolchainSource),this.sources.set("docs",this.docsSource)}static getInstance(){return r.instance||(r.instance=new r),r.instance}parseQuery(e){return e.startsWith("#")?{needle:e.slice(1).trim(),filter:"symbols"}:e.startsWith(">")?{needle:e.slice(1).trim(),filter:"files"}:e.startsWith("?")?{needle:e.slice(1).trim(),filter:"docs"}:{needle:e,filter:"all"}}async query(e,t=zM){let{needle:n,filter:i}=this.parseQuery(e);if(!n)return[];let s=[],o=[];i==="docs"?o.push(this.docsSource):i==="files"?o.push(this.projectSource):i==="symbols"?(o.push(this.projectSource),o.push(this.toolchainSource)):(o.push(this.projectSource),o.push(this.toolchainSource),o.push(this.docsSource));for(let d of o)try{await d.ready();let h=await d.query(n,t-s.length);s.push(...h)}catch(h){console.debug("Search source error:",h)}s.sort((d,h)=>h.score-d.score);let a={project:1.3,toolchain:1,docs:.7};for(let d of s){let h=a[d.record.source]||1;d.score*=h}s.sort((d,h)=>h.score-d.score);let l=new Set;return s.filter(d=>l.has(d.record.id)?!1:(l.add(d.record.id),!0)).slice(0,t)}},xP=pO.getInstance();var wP=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r,as=class{constructor(e,t,n=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?a=>s(wP(a)):wP,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Rn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Wc(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ji(e);let i=this.normalize(t);if(i.length)for(let s=0,o=n,a=!0;;s++){let l=i.charCodeAt(s),c=this.match(l,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(c)return this.value=c,this;if(s==i.length-1)break;a&&s<t.length&&t.charCodeAt(s)==l?o++:a=!1}}}match(e,t,n,i,s){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?o={from:l.from,to:i,precise:s&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:i,precise:n&&s}:this.matches.push({from:t,index:1,precise:n})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null)
Line truncated
|
|
|
|
|
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new gO(this):new OO(this)}getCursor(e,t=0,n){let i=e.doc?e:Me.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?la(this,i,t,n):aa(this,i,t,n)}},xh=class{constructor(e){this.spec=e}};function HM(r,e,t){return(n,i,s,o)=>{if(t&&!t(n,i,s,o))return!1;let a=n>=o&&i<=o+s.length?s.slice(n-o,i-o):e.doc.sliceString(n,i);return r(a,e,n,i)}}function aa(r,e,t,n){let i;return r.wholeWord&&(i=KM(e.doc,e.charCategorizer(e.selection.main.head))),r.test&&(i=HM(r.test,e,i)),new as(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:s=>s.toLowerCase(),i)}function KM(r,e){return(t,n,i,s)=>((s>t||s+i.length<n)&&(s=Math.max(0,t-2),i=r.sliceString(s,Math.min(r.length,n+2))),(e(wh(i,t-s))!=rt.Word||e(Ph(i,t-s))!=rt.Word)&&(e(Ph(i,n-s))!=rt.Word||e(wh(i,n-s))!=rt.Word))}var OO=class extends xh{constructor(e){super(e)}nextMatch(e,t,n){let i=aa(this.spec,e,n,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=aa(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==n?null:i.value}prevMatchInRange(e,t,n){for(let i=n;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=aa(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,n){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=n)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=aa(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=aa(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}};function JM(r,e,t){return(n,i,s)=>(!t||t(n,i,s))&&r(s[0],e,n,i)}function la(r,e,t,n){let i;return r.wholeWord&&(i=eL(e.charCategorizer(e.selection.main.head))),r.test&&(i=JM(r.test,e,i)),new gh(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:i},t,n)}function wh(r,e){return r.slice(xt(r,e,!1),e)}function Ph(r,e){return r.slice(e,xt(r,e))}function eL(r){return(e,t,n)=>!n[0].length||(r(wh(n.input,n.index))!=rt.Word||r(Ph(n.input,n.index))!=rt.Word)&&(r(Ph(n.input,n.index+n[0].length))!=rt.Word||r(wh(n.input,n.index+n[0].length))!=rt.Word)}var gO=class extends xh{nextMatch(e,t,n){let i=la(this.spec,e,n,e.doc.length).next();return i.done&&(i=la(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-i*1e4),o=la(this.spec,e,s,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let i=n.length;i>0;i--){let s=+n.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+n.slice(i)}return t})}matchAll(e,t){let n=la(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=la(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}},Cl=be.define(),PO=be.define(),os=Ze.define({create(r){return new Al(bO(r).create(),null)},update(r,e){for(let t of e.effects)t.is(Cl)?r=new Al(t.value.create(),r.panel):t.is(PO)&&(r=new Al(r.query,t.value?kO:null));return r},provide:r=>dl.from(r,e=>e.panel)});var Al=class{constructor(e,t){this.query=e,this.panel=t}},tL=ee.mark({class:"cm-searchMatch"}),rL=ee.mark({class:"cm-searchMatch cm-searchMatch-selected"}),nL=at.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(os))}update(r){let e=r.state.field(os);(e!=r.startState.field(os)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return ee.none;let{view:t}=this,n=new En;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-500;)l=s[++i].to;r.highlight(t.state,a,l,(c,d)=>{let h=t.state.selection.ranges.some(u=>u.from==c&&u.to==d);n.add(c,d,h?rL:tL)})}return n.finish()}},{decorations:r=>r.decorations});function El(r){return e=>{let t=e.state.field(os,!1);return t&&t.query.spec.valid?r(e,t):Qh(e)}}var ca=El((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let i=Z.single(n.from,n.to),s=r.state.facet(no);return r.dispatch({selection:i,effects:[$O(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),_P(r),!0}),kh=El((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,i=e.prevMatch(t,n,n);if(
Line truncated
|
|
|
|
|
`+t.scrub(),s=this.advance(i);return s>-1&&s<i.length?this.complete(e,n,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&Ll(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,Be(te.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(z1(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Be(te.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Z1(e,Ll(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=Ll(e,this.pos),n=0;if(t>this.pos){let i=X1(e,t,this.start);if(i){let s=lg(e,i.to-this.start);s>0&&(this.nextStage(i),n=s)}}return n||(n=lg(e,this.pos)),n>0&&n<e.length?n:-1}else return lg(e,this.pos)}}};function lg(r,e){for(;e<r.length;e++){let t=r.charCodeAt(e);if(t==10)break;if(!Sn(t))return-1}return e}var mg=class{nextLine(e,t,n){let i=t.depth<e.stack.length?-1:_1(t),s=t.next;if(i<0)return!1;let o=Be(te.HeaderMark,e.lineStart+t.pos,e.lineStart+i);return e.nextLine(),e.addLeafElement(n,Be(s==61?te.SetextHeading1:te.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},R1={LinkReference(r,e){return e.content.charCodeAt(0)==91?new pg(e):null},SetextHeading(){return new mg}},SD=[(r,e)=>T1(e)>=0,(r,e)=>k1(e)>=0,(r,e)=>$1(e)>=0,(r,e)=>xg(e,r,!0)>=0,(r,e)=>wg(e,r,!0)>=0,(r,e)=>vg(e,r,!0)>=0,(r,e)=>E1(e,r,!0)>=0],vD={text:"",end:0},Og=class{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.line=new hg,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=i[i.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=i[0].from,this.block=Eh.create(te.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new yg(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let i=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!i||e.markers[n].from<i.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!i)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let i=n(this,e);if(i!=!1){if(i==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new dg(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let i=n(this,t);i&&t.parsers.push(i)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break e}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
|
|
|
|
|
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=W1(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=vD;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let n=this.absoluteLineStart,i=this.rangeI;for(;this.ranges[i].to<t.end;){i++;let s=this.ranges[i].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[i-1].to-n)+o,n=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let i=this.stack[e.depth],s=this.parser.skipContextMarkup[i.type];if(!s)throw new Error("Unhandled block context "+te[i.type]);let o=this.line.markers.length;if(!s(i,this,e)){this.line.markers.length>o&&(i.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
|
|
|
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,ar(e)}})})}function RM(r){var e=zt(kt());let t=e+".tap",n=new eo(e),i=new hh({sine_wave:!0}),s=xr(),o=s[0]+s[1]*256;s=s.slice(2),n.setContent({data:s,startAddress:o,type:eo.FILE_TYPE_NON_RELOCATABLE}),n.generateSound(i);let a=i.getTAPData();if(a){let l=new Blob([a],{type:"application/octet-stream"});(0,ii.saveAs)(l,t)}}function dO(){switch(ir(fe)){case"vcs":return EM;case"apple2":return CM;case"c64":return RM}}function tP(r){if(xr()==null)return Re("Please fix errors before exporting."),!0;var e=dO();if(e===void 0)return Re("Cassette export is not supported on this platform."),!0;e(r)}function rP(r){if(xr()==null)return Re("Please finish compiling with no errors before downloading ROM."),!0;var e=zt(kt());if(P.getDownloadFile){var t=P.getDownloadFile(),e=zt(kt());(0,ii.saveAs)(t.blob,e+t.extension)}else if(xr()instanceof Uint8Array){var n=new Blob([xr()],{type:"application/octet-stream"}),i=P.getROMExtension&&P.getROMExtension(xr())||"-"+ir(fe)+".bin";(0,ii.saveAs)(n,e+i)}else Re(`The "${fe}" platform doesn't have downloadable ROMs.`)}function nP(r){var e=F.getCurrentText();if(!e)return!1;var t=new Blob([e],{type:"text/plain;charset=utf-8"});(0,ii.saveAs)(t,cP(),{autoBom:!1})}async function iP(){let r=(await import("./jszip.min-EENSZHRN.js")).default;return new r}async function sP(r){var e=await iP();Ci().iterateFiles((t,n)=>{n&&e.file(St(t),n)}),e.generateAsync({type:"blob"}).then(t=>{(0,ii.saveAs)(t,kt()+"-"+ir(fe)+".zip")})}function oP(r){let e=P.getDebugSymbolFile&&P.getDebugSymbolFile();if(!e){Re("This project does not have debug information.");return}var t=zt(kt());(0,ii.saveAs)(e.blob,t+e.extension,{autoBom:!1})}async function aP(r){var e=await iP(),t=await ss().keys();st(!0);try{var n=0;await Promise.all(t.map(s=>ss().getItem(s).then(o=>{En(n++/(t.length+1)),o&&e.file(s,o)})));var i=await e.generateAsync({type:"blob"});(0,ii.saveAs)(i,ir(fe)+"-all.zip")}finally{st(!1)}}var cO=!1;function lP(){cO||dn("lib/gif.js").then(()=>{var r=$("#emulator").find("canvas")[0];if(!r){Re("Could not find canvas element to record video!");return}var e=0;r.style&&r.style.transform&&(r.style.transform.indexOf("rotate(-90deg)")>=0?e=-1:r.style.transform.indexOf("rotate(90deg)")>=0&&(e=1));var t=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:e}),n=$("#videoPreviewImage");t.on("progress",l=>{En(l)}),t.on("finished",l=>{n.attr("src",URL.createObjectURL(l)),st(!1),P.resume(),$("#videoPreviewModal").modal("show")});var i=20,s=300,o=0;console.log("Recording video",r),$("#emulator").css("backgroundColor","#cc3333");var a=()=>{o++>s?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),st(!0),P.pause(),t.render(),cO=!1):(t.addFrame(r,{delay:i,copy:!0}),setTimeout(a,i),cO=!0)};a()})}var hO;async function to(){if(!hO){await dn("lib/octokat.js"),await dn("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await dn("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await dn("https://8bitworkshop.com/config.js");var r=yc("__github_key");hO=new dh(Octokat,r,ss(),Ci()),console.log("loaded github service")}return hO}function _l(){var r=(_t||"").split("/");return r.length!=2?(Re("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+r[0]+"/"+r[1]}async function Al(r,e){var t,n=Ql(r);if(!n){Re("Could not parse GitHub URL.");return}var i=Js()[n.repopath];if(!(i&&!confirm("You've already imported "+n.repopath+" -- do you want to replace all local files?"))){st(!0);var s=ch(n.repopath);En(.25);var o=await to();return o.import(r).then(a=>(t=a,En(.75),o.pull(r,s))).then(a=>{st(!1),ro(e,{repo:n.repopath})}).catch(a=>{st(!1),console.log(a),Re("Could not import "+r+". "+a)})}}async function dP(r){var e=await to();e.login().then(()=>{ar("You are signed in to GitHub.")}).catch(t=>{Re("Could not sign in."+t)})}async function hP(r){var e=await to();e.logout().then(()=>{ar("You are logged out of GitHub.")})}function uP(r){var e=$("#importGithubModal"),t=$("#importGithubButton");e.modal("show"),e.off("shown.bs.modal").on("shown.bs.modal",()=>$("#importGithubURL").trigger("focus")),$("#importGithubURL").off("keydown").on("keydown",n=>{n.key==="Enter"&&(n.preventDefault(),t.trigger("click"))}),t.off("click").on("click",()=>{var n=$("#importGithubURL").val()+"";e.modal("hide"),Al(n,!1)})}function fP(r){if(!(_t&&!confirm("This project ("+Ci().mainPath+") is already bound to a GitHub repository. Do you want to re-publish to a new repository? (You can instead choose 'Push Changes' to update files in the existing repository.)"))){var e=$("#publishGithubModal"),t=$("#publishGithubButton");$("#githubRepoName").val(zt(St(Ci().mainPath))),e.modal("show"),t.off("click").on("click",async()=>{var n=$("#githubRepoName").val()+"",i=$("#githubRepoDesc").val()+"",s=$("#githubRepoPrivate").val()=="private",o=$("#githubRepoLicense").val()+""Line truncated
|
|
|
|
|
`);for(let o=0;o<s.length;o++){let a=s[o],l=o+1,c=a.match(/(?:function|func|def|proc)\s+(\w+)/i);c&&i.push({id:`${e}:${l}:${c[1]}`,name:c[1],kind:"func",source:n,file:e,line:l});let d=a.match(/(?:var|let|const|global)\s+(\w+)/i);d&&i.push({id:`${e}:${l}:${d[1]}`,name:d[1],kind:"var",source:n,file:e,line:l});let h=a.match(/(?:struct|class|interface|type)\s+(\w+)/i);h&&i.push({id:`${e}:${l}:${h[1]}`,name:h[1],kind:"type",source:n,file:e,line:l});let u=a.match(/^\s*(\w+)\s*:/);u&&!a.trim().startsWith("//")&&i.push({id:`${e}:${l}:${u[1]}`,name:u[1],kind:"label",source:n,file:e,line:l});let f=a.match(/#define\s+(\w+)/i);f&&i.push({id:`${e}:${l}:${f[1]}`,name:f[1],kind:"macro",source:n,file:e,line:l});let m=a.match(/^\s*(\w+)\s*(?:=|equ)\s+/i);m&&i.push({id:`${e}:${l}:${m[1]}`,name:m[1],kind:"equate",source:n,file:e,line:l})}return i}var SP=()=>null;function vP(r){SP=r}function aa(){return SP()}var uh=class{constructor(){this.id="project";this.kind="project";this.rebuilt=!1;this.index=new oa([])}async ready(){await this.index.init(),this.rebuilt||(this.rebuilt=!0,await this.rebuild())}query(e,t){let n=this.index.query(e,t),i=this.fulltextQuery(e,t),s=n.concat(i);return s.sort((o,a)=>a.score-o.score),s.slice(0,t)}fulltextQuery(e,t){if(e.length<2)return[];let n=e.toLowerCase(),i=[],s=Math.max(t,10),o=aa();return o?(o.iterateFiles((a,l)=>{if(typeof l!="string")return;let c=l.split(`
|
|
|
|
|
`),d=0;for(let h=0;h<c.length;h++){let u=c[h],m=u.toLowerCase().indexOf(n);if(m>=0){let g=u.trim();if(!g)continue;if(i.push({record:{id:`text:${a}:${h+1}`,name:g.length>80?g.slice(0,80)+"\u2026":g,kind:"text",source:"project",file:a,line:h+1},score:200+Math.max(0,100-m*2),ranges:[m,m+e.length]}),++d>=s)break}}}),i):[]}async onFileChanged(e,t){let n=this.extractSymbolsFromFile(e,t,"project");this.index.pushRecords(n)}extractSymbolsFromFile(e,t,n){if(typeof t!="string")return[];let i=this.detectEditorStyle(e);return fO(t,e,i,n)}detectEditorStyle(e){var n;switch((n=e.split(".").pop())==null?void 0:n.toLowerCase()){case"c":case"h":return"text/x-csrc";case"asm":case"a65":case"inc":return"6502";case"v":return"verilog";case"wiz":return"text/x-wiz";case"bas":case"basic":return"basic";case"fb":case"fastbasic":return"fastbasic";case"bac":case"bataribasic":return"bataribasic";case"i":return"inform6";case"d":return"dialog";default:return"text/x-csrc"}}async rebuild(){this.index.clear(),await this.index.init();let e=aa();if(!e)return;let t=[];e.iterateFiles((n,i)=>{if(typeof i!="string")return;let s=this.detectEditorStyle(n),o=fO(i,n,s,"project");t.push(...o)}),this.index.pushRecords(t)}};var ZM=new Set(["h","hh","hpp","inc","asm","a65","s","mac","defs","def","equ","i","m","c","bas","txt"]),XM=20,fh=class{constructor(){this.id="toolchain";this.kind="toolchain";this.fsName=null;this.files=[];this.loaded=new Map;this.readyPromise=null;this.batchSize=XM}async ready(){return this.readyPromise||(this.readyPromise=this.load()),this.readyPromise}async load(){let e=aa();if(!e)return;let t;try{t=e.getToolForFilename?e.getToolForFilename(e.mainPath):""}catch(o){t=""}let n=Cc(t,e.platform_id),i=Ac(t,e.platform_id);if(!n||!i.length)return;this.fsName=n;let s=new Set;for(let o of i){let a=await this.listFiles(o);for(let l of a)this.isSearchable(l)&&!s.has(l)&&(s.add(l),this.files.push(l))}this.files.sort();for(let o=0;o<this.files.length;o+=this.batchSize){let a=this.files.slice(o,o+this.batchSize),l=await Promise.all(a.map(async c=>{let d=await this.readFile(c);return[c,d]}));for(let[c,d]of l)d!=null&&this.loaded.set(c,d)}}isValid(){return this.fsName!=null&&this.files.length>0}async listFiles(e){let t=aa();if(!t||!this.fsName||!t.queryWorker)return[];try{let n={preload_fs:this.fsName,listshared:e,updates:[],buildsteps:[]},i=await t.queryWorker(n),s=i&&i.output;return Array.isArray(s)?s:[]}catch(n){return console.debug("Toolchain list error:",n),[]}}async readFile(e){let t=aa();if(!t||!this.fsName||!t.queryWorker)return null;try{let n={preload_fs:this.fsName,readshared:e,updates:[],buildsteps:[]},i=await t.queryWorker(n),s=i&&i.output;return s instanceof Uint8Array&&s.length>0?new TextDecoder().decode(s):null}catch(n){return console.debug("Toolchain read error:",n),null}}isSearchable(e){let t=e.split("/").pop()||e,n=t.lastIndexOf(".");return n<0?!0:ZM.has(t.substring(n+1).toLowerCase())}async query(e,t){return await this.ready(),!this.isValid()||e.length<2?[]:this.textQuery(e,t)}textQuery(e,t){if(e.length<2)return[];let n=e.toLowerCase(),i=[],s=Math.max(t,5);for(let[o,a]of this.loaded){let l=a.split(`
|
|
|
|
|
`),c=0;for(let d=0;d<l.length;d++){let h=l[d],f=h.toLowerCase().indexOf(n);if(f>=0){let m=h.trim();if(!m)continue;if(i.push({record:{id:`toolchain:${o}:${d+1}`,name:m.length>80?m.slice(0,80)+"\u2026":m,kind:"text",source:"toolchain",file:o,line:d+1},score:200+Math.max(0,100-f*2),ranges:[f,f+e.length]}),++c>=s)break}}}return i.sort((o,a)=>a.score-o.score),i.slice(0,t)}invalidate(){this.fsName=null,this.files=[],this.loaded.clear(),this.readyPromise=null}};var xP=()=>[];function wP(r){xP=r}var zM=/<h([1-3])\b[^>]*>([\s\S]*?)<\/h\1>/gi;function WM(r){return r.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&#(?:0*39|x27);/gi,"'").replace(/ /g," ").replace(/…/g,"\u2026").replace(/—/g,"\u2014").replace(/–/g,"\u2013").replace(/’|‘/g,"'").replace(/”|“/g,'"').replace(/»/g,"\xBB").replace(/«/g,"\xAB").replace(/&/g,"&")}function pO(r){return WM(r.replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim()}function BM(r,e=180){let t=r.trim();if(!t)return;let i=t.slice(0,e).match(/^([\s\S]*?[.!?])(?:\s|$)/);return i?i[1]:t.length<=e?t:t.slice(0,e-1)+"\u2026"}function VM(r){let e=[],t="#help/"+r.id,n=r.title||r.id,i=r.html||"",s=[],o=new RegExp(zM.source,"gi"),a;for(;a=o.exec(i);)s.push({name:pO(a[2]),start:a.index,end:o.lastIndex});let l=(u,f,m)=>{if(!f)return;let g=BM(m),v=g&&m.startsWith(g)?m.slice(g.length).trim():m;e.push({id:`${r.id}:${u}`,name:f,kind:"doc",brief:g,detail:v||void 0,source:"docs",file:n,url:t})},c=s.length?s[0].start:i.length,d=pO(i.slice(0,c)),h=s.length&&s[0].start===0?s[0].name||r.title:r.title||r.id;l(0,h,d);for(let u=0;u<s.length;u++){if(u===0&&s[0].start===0)continue;let f=u+1<s.length?s[u+1].start:i.length;l(u+1,s[u].name,pO(i.slice(s[u].end,f)))}return e}var ph=class{constructor(){this.id="docs";this.kind="docs";this.index=null;this.readyPromise=null}async ready(){return this.readyPromise?this.readyPromise:(this.readyPromise=this.load(),this.readyPromise)}async load(){let e=xP()||[];if(e.length===0)return;let t=[];for(let i of e)t.push(...VM(i));if(t.length===0)return;let n=new oa(t);await n.init(),this.index=n}async query(e,t){return await this.ready(),this.index?this.index.query(e,t):[]}};var YM=50,mO=class r{constructor(){this.sources=new Map;this.projectSource=new uh,this.toolchainSource=new fh,this.docsSource=new ph,this.sources.set("project",this.projectSource),this.sources.set("toolchain",this.toolchainSource),this.sources.set("docs",this.docsSource)}static getInstance(){return r.instance||(r.instance=new r),r.instance}parseQuery(e){return e.startsWith("#")?{needle:e.slice(1).trim(),filter:"symbols"}:e.startsWith(">")?{needle:e.slice(1).trim(),filter:"files"}:e.startsWith("?")?{needle:e.slice(1).trim(),filter:"docs"}:{needle:e,filter:"all"}}async query(e,t=YM){let{needle:n,filter:i}=this.parseQuery(e);if(!n)return[];let s=[],o=[];i==="docs"?o.push(this.docsSource):i==="files"?o.push(this.projectSource):i==="symbols"?(o.push(this.projectSource),o.push(this.toolchainSource)):(o.push(this.projectSource),o.push(this.toolchainSource),o.push(this.docsSource));for(let d of o)try{await d.ready();let h=await d.query(n,t-s.length);s.push(...h)}catch(h){console.debug("Search source error:",h)}s.sort((d,h)=>h.score-d.score);let a={project:1.3,toolchain:1,docs:.7};for(let d of s){let h=a[d.record.source]||1;d.score*=h}s.sort((d,h)=>h.score-d.score);let l=new Set;return s.filter(d=>l.has(d.record.id)?!1:(l.add(d.record.id),!0)).slice(0,t)}},PP=mO.getInstance();var kP=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r,as=class{constructor(e,t,n=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?a=>s(kP(a)):kP,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Mn(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Bc(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ji(e);let i=this.normalize(t);if(i.length)for(let s=0,o=n,a=!0;;s++){let l=i.charCodeAt(s),c=this.match(l,o,a,this.bufferPos+this.bufferStart,s==i.length-1);if(c)return this.value=c,this;if(s==i.length-1)break;a&&s<t.length&&t.charCodeAt(s)==l?o++:a=!1}}}match(e,t,n,i,s){let o=null;for(let a=0;a<this.matches.length;){let l=this.matches[a],c=!1;this.query.charCodeAt(l.index)==e&&(l.index==this.query.length-1?o={from:l.from,to:i,precise:s&&l.precise}:(l.index++,c=!0)),c?a++:this.matches.splice(a,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?o={from:t,to:i,precise:n&&s}:this.matches.push({from:t,index:1,precise:n})),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null)
Line truncated
|
|
|
|
|
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new bO(this):new gO(this)}getCursor(e,t=0,n){let i=e.doc?e:Me.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?ca(this,i,t,n):la(this,i,t,n)}},xh=class{constructor(e){this.spec=e}};function tL(r,e,t){return(n,i,s,o)=>{if(t&&!t(n,i,s,o))return!1;let a=n>=o&&i<=o+s.length?s.slice(n-o,i-o):e.doc.sliceString(n,i);return r(a,e,n,i)}}function la(r,e,t,n){let i;return r.wholeWord&&(i=rL(e.doc,e.charCategorizer(e.selection.main.head))),r.test&&(i=tL(r.test,e,i)),new as(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:s=>s.toLowerCase(),i)}function rL(r,e){return(t,n,i,s)=>((s>t||s+i.length<n)&&(s=Math.max(0,t-2),i=r.sliceString(s,Math.min(r.length,n+2))),(e(wh(i,t-s))!=rt.Word||e(Ph(i,t-s))!=rt.Word)&&(e(Ph(i,n-s))!=rt.Word||e(wh(i,n-s))!=rt.Word))}var gO=class extends xh{constructor(e){super(e)}nextMatch(e,t,n){let i=la(this.spec,e,n,e.doc.length).nextOverlapping();if(i.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);i=la(this.spec,e,0,s).nextOverlapping()}return i.done||i.value.from==t&&i.value.to==n?null:i.value}prevMatchInRange(e,t,n){for(let i=n;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=la(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,n){let i=this.prevMatchInRange(e,0,t);return i||(i=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),i&&(i.from!=t||i.to!=n)?i:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=la(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=la(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}};function nL(r,e,t){return(n,i,s)=>(!t||t(n,i,s))&&r(s[0],e,n,i)}function ca(r,e,t,n){let i;return r.wholeWord&&(i=iL(e.charCategorizer(e.selection.main.head))),r.test&&(i=nL(r.test,e,i)),new gh(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:i},t,n)}function wh(r,e){return r.slice(xt(r,e,!1),e)}function Ph(r,e){return r.slice(e,xt(r,e))}function iL(r){return(e,t,n)=>!n[0].length||(r(wh(n.input,n.index))!=rt.Word||r(Ph(n.input,n.index))!=rt.Word)&&(r(Ph(n.input,n.index+n[0].length))!=rt.Word||r(wh(n.input,n.index+n[0].length))!=rt.Word)}var bO=class extends xh{nextMatch(e,t,n){let i=ca(this.spec,e,n,e.doc.length).next();return i.done&&(i=ca(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-i*1e4),o=ca(this.spec,e,s,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let i=n.length;i>0;i--){let s=+n.slice(0,i);if(s>0&&s<e.match.length)return e.match[s]+n.slice(i)}return t})}matchAll(e,t){let n=ca(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=ca(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}},El=be.define(),kO=be.define(),os=Ze.define({create(r){return new Cl(yO(r).create(),null)},update(r,e){for(let t of e.effects)t.is(El)?r=new Cl(t.value.create(),r.panel):t.is(kO)&&(r=new Cl(r.query,t.value?$O:null));return r},provide:r=>hl.from(r,e=>e.panel)});var Cl=class{constructor(e,t){this.query=e,this.panel=t}},sL=ee.mark({class:"cm-searchMatch"}),oL=ee.mark({class:"cm-searchMatch cm-searchMatch-selected"}),aL=at.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(os))}update(r){let e=r.state.field(os);(e!=r.startState.field(os)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return ee.none;let{view:t}=this,n=new Rn;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-500;)l=s[++i].to;r.highlight(t.state,a,l,(c,d)=>{let h=t.state.selection.ranges.some(u=>u.from==c&&u.to==d);n.add(c,d,h?oL:sL)})}return n.finish()}},{decorations:r=>r.decorations});function Rl(r){return e=>{let t=e.state.field(os,!1);return t&&t.query.spec.valid?r(e,t):Qh(e)}}var da=Rl((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let i=Z.single(n.from,n.to),s=r.state.facet(no);return r.dispatch({selection:i,effects:[QO(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),CP(r),!0}),kh=Rl((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,i=e.prevMatch(t,n,n);if(
Line truncated
|
|
|
|
|
`+t.scrub(),s=this.advance(i);return s>-1&&s<i.length?this.complete(e,n,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&Dl(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,n){return e.addLeafElement(t,Be(te.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Y1(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Be(te.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(B1(e,Dl(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=Dl(e,this.pos),n=0;if(t>this.pos){let i=V1(e,t,this.start);if(i){let s=cg(e,i.to-this.start);s>0&&(this.nextStage(i),n=s)}}return n||(n=cg(e,this.pos)),n>0&&n<e.length?n:-1}else return cg(e,this.pos)}}};function cg(r,e){for(;e<r.length;e++){let t=r.charCodeAt(e);if(t==10)break;if(!vn(t))return-1}return e}var Og=class{nextLine(e,t,n){let i=t.depth<e.stack.length?-1:R1(t),s=t.next;if(i<0)return!1;let o=Be(te.HeaderMark,e.lineStart+t.pos,e.lineStart+i);return e.nextLine(),e.addLeafElement(n,Be(s==61?te.SetextHeading1:te.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),o])),!0}finish(){return!1}},I1={LinkReference(r,e){return e.content.charCodeAt(0)==91?new mg(e):null},SetextHeading(){return new Og}},QD=[(r,e)=>E1(e)>=0,(r,e)=>_1(e)>=0,(r,e)=>A1(e)>=0,(r,e)=>wg(e,r,!0)>=0,(r,e)=>Pg(e,r,!0)>=0,(r,e)=>xg(e,r,!0)>=0,(r,e)=>D1(e,r,!0)>=0],TD={text:"",end:0},gg=class{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.line=new ug,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=i[i.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=i[0].from,this.block=Rh.create(te.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new Sg(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let n=0;;){let i=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;n<e.markers.length&&(!i||e.markers[n].from<i.end);){let s=e.markers[n++];this.addNode(s.type,s.from,s.to)}if(!i)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let n of this.parser.blockParsers)if(n){let i=n(this,e);if(i!=!1){if(i==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new hg(this.lineStart+e.pos,e.text.slice(e.pos));for(let n of this.parser.leafBlockParsers)if(n){let i=n(this,t);i&&t.parsers.push(i)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break e}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
|
|
|
|
|
`+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=F1(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=TD;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let n=this.absoluteLineStart,i=this.rangeI;for(;this.ranges[i].to<t.end;){i++;let s=this.ranges[i].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[i-1].to-n)+o,n=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let i=this.stack[e.depth],s=this.parser.skipContextMarkup[i.type];if(!s)throw new Error("Unhandled block context "+te[i.type]);let o=this.line.markers.length;if(!s(i,this,e)){this.line.markers.length>o&&(i.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
|
|
|
|
|
`?"":t;else{let i=t.indexOf(`
|
|
|
|
|
`);n=i<0?t:t.slice(0,i)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=Eh.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e=="number"&&(e=new Ee(this.parser.nodeSet.types[e],ua,ua,(n!=null?n:this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(bg(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?M1(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let t=bg(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(te.Paragraph,e.content.length),e.start)}elt(e,t,n,i){return typeof e=="string"?Be(this.parser.getNodeType(e),t,n,i):new Mh(e,t)}get buffer(){return new Rh(this.parser.nodeSet)}};function M1(r,e,t,n,i){let s=r[e].to,o=[],a=[],l=t.from+n;function c(d,h){for(;h?d>=s:d>s;){let u=r[e+1].from-s;n+=u,d+=u,e++,s=r[e].to}}for(let d=t.firstChild;d;d=d.nextSibling){c(d.from+n,!0);let h=d.from+n,u,f=i.get(d.tree);f?u=f:d.to+n>s?(u=M1(r,e,d,n,i),c(d.to+n,!1)):u=d.toTree(),o.push(u),a.push(h-l)}return c(t.to+n,!1),new Ee(t.type,o,a,t.to+n-l,t.tree?t.tree.propValues:void 0)}var Il=class r extends _i{constructor(e,t,n,i,s,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=i,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let d of e.types)this.nodeTypes[d.name]=d.id}createParse(e,t,n){let i=new Og(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}configure(e){let t=gg(e);if(!t)return this;let{nodeSet:n,skipContextMarkup:i}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),d=this.endLeafBlock.slice(),h=this.wrappers;if(Ml(t.defineNodes)){i=Object.assign({},i);let u=n.types.slice(),f;for(let m of t.defineNodes){let{name:g,block:v,composite:k,style:L}=typeof m=="string"?{name:m}:m;if(u.some(w=>w.name==g))continue;k&&(i[u.length]=(w,x,R)=>k(x,R,w.value));let M=u.length,D=k?["Block","BlockContext"]:v?M>=te.ATXHeading1&&M<=te.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(bt.define({id:M,name:g,props:D&&[[xe.group,D]]})),L&&(f||(f={}),Array.isArray(L)||L instanceof jr?f[g]=L:Object.assign(f,L))}n=new Qi(u),f&&(n=n.extend(Ht(f)))}if(Ml(t.props)&&(n=n.extend(...t.props)),Ml(t.remove))for(let u of t.remove){let f=this.blockNames.indexOf(u),m=this.inlineNames.indexOf(u);f>-1&&(s[f]=o[f]=void 0),m>-1&&(l[m]=void 0)}if(Ml(t.parseBlock))for(let u of t.parseBlock){let f=a.indexOf(u.name);if(f>-1)s[f]=u.parse,o[f]=u.leaf;else{let m=u.before?Ch(a,u.before):u.after?Ch(a,u.after)+1:a.length-1;s.splice(m,0,u.parse),o.splice(m,0,u.leaf),a.splice(m,0,u.name)}u.endLeaf&&d.push(u.endLeaf)}if(Ml(t.parseInline))for(let u of t.parseInline){let f=c.indexOf(u.name);if(f>-1)l[f]=u.parse;else{let m=u.before?Ch(c,u.before):u.after?Ch(c,u.after)+1:c.length-1;l.splice(m,0,u.parse),c.splice(m,0,u.name)}}return t.wrap&&(h=h.concat(t.wrap)),new r(n,s,o,a,d,i,l,c,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new Xl(this,e,t);e:for(let i=t;i<n.end;){let s=n.char(i);for(let o of this.inlineParsers)if(o){let a=o(n,s,i);if(a>=0){i=a;continue e}}i++}return n.resolveMarkers(0)}};function Ml(r){return r!=null&&r.length>0}function gg(r){if(!Array.isArray(r))return r;if(r.length==0)return null;let e=gg(r[0]);if(r.length==1)return e;let t=gg(r.slice(1));if(!t||!e)return e||t;let n=(o,a)=>(o||ua).concat(a||ua),i=e.wrap,s=t.wrap;return{props:n(e.props,t.props),defineNodes:n(e.defineNodes,t.defineNodes),parseBlock:n(e.parseBlock,t.parseBlock),parseInline:n(e.parseInline,t.parseInline),remove:n(e.remove,t.remove),wrap:i?s?(o,a,l,c)=>i(s(o,a,l,c),a,l,c):i:s}}function Ch(r,e){let t=r.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var L1=[bt.none];for(let r=1,e;e=te[r];r++)L1[r]=bt.define({id:r,name:e,props:r>=te.Escape?[]:[[xe.group,r in P1?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var ua=[],Rh=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e
Line truncated
|
|
|
|
|
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let i=e+this.fragment.offset;for(;n.to<=i;)if(!n.parent())return!1;for(;;){if(n.from>=i)return this.fragment.from<=t;if(!n.childAfter(i))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(xe.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,a=e.block.children.length,l=o,c=a;for(;;){if(t.to-n>i){if(t.type.isAnonymous&&t.firstChild())continue;break}let d=W1(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,d);else{let h=new Ee(e.parser.nodeSet.types[te.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,d)}if(t.type.is("Block")&&(wD.indexOf(t.type.id)<0?(o=t.to-n,a=e.block.children.length):(o=l,a=c),l=t.to-n,c=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-s}};function W1(r,e){let t=r;for(let n=1;n<e.length;n++){let i=e[n-1].to,s=e[n].from;i<r&&(t-=s-i)}return t}var PD=Ht({"Blockquote/...":O.quote,HorizontalRule:O.contentSeparator,"ATXHeading1/... SetextHeading1/...":O.heading1,"ATXHeading2/... SetextHeading2/...":O.heading2,"ATXHeading3/...":O.heading3,"ATXHeading4/...":O.heading4,"ATXHeading5/...":O.heading5,"ATXHeading6/...":O.heading6,"Comment CommentBlock":O.comment,Escape:O.escape,Entity:O.character,"Emphasis/...":O.emphasis,"StrongEmphasis/...":O.strong,"Link/... Image/...":O.link,"OrderedList/... BulletList/...":O.list,"BlockQuote/...":O.quote,"InlineCode CodeText":O.monospace,"URL Autolink":O.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":O.processingInstruction,"CodeInfo LinkLabel":O.labelName,LinkTitle:O.string,Paragraph:O.content}),B1=new Il(new Qi(L1).extend(PD),Object.keys(Ah).map(r=>Ah[r]),Object.keys(Ah).map(r=>R1[r]),Object.keys(Ah),SD,P1,Object.keys(cg).map(r=>cg[r]),Object.keys(cg),[]);function kD(r,e,t){let n=[];for(let i=r.firstChild,s=e;;i=i.nextSibling){let o=i?i.from:t;if(o>s&&n.push({from:s,to:o}),!i)break;s=i.to}return n}function V1(r){let{codeParser:e,htmlParser:t}=r;return{wrap:Ld((i,s)=>{let o=i.type.id;if(e&&(o==te.CodeBlock||o==te.FencedCode)){let a="";if(o==te.FencedCode){let c=i.node.getChild(te.CodeInfo);c&&(a=s.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==te.CodeText,bracketed:o==te.FencedCode}}else if(t&&(o==te.HTMLBlock||o==te.HTMLTag||o==te.CommentBlock))return{parser:t,overlay:kD(i.node,i.from,i.to)};return null})}}var $D={resolve:"Strikethrough",mark:"StrikethroughMark"},QD={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":O.strikethrough}},{name:"StrikethroughMark",style:O.processingInstruction}],parseInline:[{name:"Strikethrough",parse(r,e,t){if(e!=126||r.char(t+1)!=126||r.char(t+2)==126)return-1;let n=r.slice(t-1,t),i=r.slice(t+2,t+3),s=/\s|^$/.test(n),o=/\s|^$/.test(i),a=Zl.test(n),l=Zl.test(i);return r.addDelimiter($D,t,t+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function Dl(r,e,t=0,n,i=0){let s=0,o=!0,a=-1,l=-1,c=!1,d=()=>{n.push(r.elt("TableCell",i+a,i+l,r.parser.parseInline(e.slice(a,l),i+a)))};for(let h=t;h<e.length;h++){let u=e.charCodeAt(h);u==124&&!c?((!o||a>-1)&&s++,o=!1,n&&(a>-1&&d(),n.push(r.elt("TableDelimiter",h+i,h+i+1))),a=l=-1):(c||u!=32&&u!=9)&&(a<0&&(a=h),l=h+1),c=!c&&u==92}return a>-1&&(s++,n&&d()),s}function g1(r,e){for(let t=e;t<r.length;t++){let n=r.charCodeAt(t);if(n==124)return!0;n==92&&t++}return!1}var Y1=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Dh=class{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let i;if((t.next==45||t.next==58||t.next==124)&&Y1.test(i=t.text.slice(t.pos))){let s=[];Dl(e,n.content,0,s,n.start)==Dl(e,i,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let i=[];Dl(e,t.text,t.pos,i,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,i))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},TD={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":O.heading}},"TableRow",{name:"TableCell",style:O.content},{name:"TableDelimiter",style:O.processingInstruction}],parseBlock:[{name:"Table",leaf(r,e){return g1(e.content,0)?new Dh:null},endLeaf(r,e,t){if(t.parsers.some(i=>i instanceof Dh)||!g1(e.text,e.basePos))return!1;let n=r.peekLine();return Y1.test(n)&&Dl(r,e.text,e.basePos)==Dl(r,n,e.basePos)},before:"SetextHeading"}]},Sg=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},_D={defineNodes:[{name:"Task",block:!0,style:O.list},{name:"TaskMarker",style:O.atom}],pa
Line truncated
|
|
|
|
|
`);n=i<0?t:t.slice(0,i)}return e+n.length>this.to?n.slice(0,this.to-e):n}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,n=0){this.block=Rh.create(e,n,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,n=0){this.startContext(this.parser.getNodeType(e),t,n)}addNode(e,t,n){typeof e=="number"&&(e=new Ee(this.parser.nodeSet.types[e],fa,fa,(n!=null?n:this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(yg(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?Z1(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let n of e.parsers)if(n.finish(this,e))return;let t=yg(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(te.Paragraph,e.content.length),e.start)}elt(e,t,n,i){return typeof e=="string"?Be(this.parser.getNodeType(e),t,n,i):new Lh(e,t)}get buffer(){return new Mh(this.parser.nodeSet)}};function Z1(r,e,t,n,i){let s=r[e].to,o=[],a=[],l=t.from+n;function c(d,h){for(;h?d>=s:d>s;){let u=r[e+1].from-s;n+=u,d+=u,e++,s=r[e].to}}for(let d=t.firstChild;d;d=d.nextSibling){c(d.from+n,!0);let h=d.from+n,u,f=i.get(d.tree);f?u=f:d.to+n>s?(u=Z1(r,e,d,n,i),c(d.to+n,!1)):u=d.toTree(),o.push(u),a.push(h-l)}return c(t.to+n,!1),new Ee(t.type,o,a,t.to+n-l,t.tree?t.tree.propValues:void 0)}var Zl=class r extends _i{constructor(e,t,n,i,s,o,a,l,c){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=n,this.blockNames=i,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=c,this.nodeTypes=Object.create(null);for(let d of e.types)this.nodeTypes[d.name]=d.id}createParse(e,t,n){let i=new gg(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}configure(e){let t=bg(e);if(!t)return this;let{nodeSet:n,skipContextMarkup:i}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),c=this.inlineNames.slice(),d=this.endLeafBlock.slice(),h=this.wrappers;if(Ll(t.defineNodes)){i=Object.assign({},i);let u=n.types.slice(),f;for(let m of t.defineNodes){let{name:g,block:v,composite:k,style:L}=typeof m=="string"?{name:m}:m;if(u.some(w=>w.name==g))continue;k&&(i[u.length]=(w,x,R)=>k(x,R,w.value));let M=u.length,D=k?["Block","BlockContext"]:v?M>=te.ATXHeading1&&M<=te.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(bt.define({id:M,name:g,props:D&&[[xe.group,D]]})),L&&(f||(f={}),Array.isArray(L)||L instanceof Ur?f[g]=L:Object.assign(f,L))}n=new Qi(u),f&&(n=n.extend(Ht(f)))}if(Ll(t.props)&&(n=n.extend(...t.props)),Ll(t.remove))for(let u of t.remove){let f=this.blockNames.indexOf(u),m=this.inlineNames.indexOf(u);f>-1&&(s[f]=o[f]=void 0),m>-1&&(l[m]=void 0)}if(Ll(t.parseBlock))for(let u of t.parseBlock){let f=a.indexOf(u.name);if(f>-1)s[f]=u.parse,o[f]=u.leaf;else{let m=u.before?Eh(a,u.before):u.after?Eh(a,u.after)+1:a.length-1;s.splice(m,0,u.parse),o.splice(m,0,u.leaf),a.splice(m,0,u.name)}u.endLeaf&&d.push(u.endLeaf)}if(Ll(t.parseInline))for(let u of t.parseInline){let f=c.indexOf(u.name);if(f>-1)l[f]=u.parse;else{let m=u.before?Eh(c,u.before):u.after?Eh(c,u.after)+1:c.length-1;l.splice(m,0,u.parse),c.splice(m,0,u.name)}}return t.wrap&&(h=h.concat(t.wrap)),new r(n,s,o,a,d,i,l,c,h)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let n=new zl(this,e,t);e:for(let i=t;i<n.end;){let s=n.char(i);for(let o of this.inlineParsers)if(o){let a=o(n,s,i);if(a>=0){i=a;continue e}}i++}return n.resolveMarkers(0)}};function Ll(r){return r!=null&&r.length>0}function bg(r){if(!Array.isArray(r))return r;if(r.length==0)return null;let e=bg(r[0]);if(r.length==1)return e;let t=bg(r.slice(1));if(!t||!e)return e||t;let n=(o,a)=>(o||fa).concat(a||fa),i=e.wrap,s=t.wrap;return{props:n(e.props,t.props),defineNodes:n(e.defineNodes,t.defineNodes),parseBlock:n(e.parseBlock,t.parseBlock),parseInline:n(e.parseInline,t.parseInline),remove:n(e.remove,t.remove),wrap:i?s?(o,a,l,c)=>i(s(o,a,l,c),a,l,c):i:s}}function Eh(r,e){let t=r.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var X1=[bt.none];for(let r=1,e;e=te[r];r++)X1[r]=bt.define({id:r,name:e,props:r>=te.Escape?[]:[[xe.group,r in T1?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var fa=[],Mh=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e
Line truncated
|
|
|
|
|
`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(),n.firstChild());let i=e+this.fragment.offset;for(;n.to<=i;)if(!n.parent())return!1;for(;;){if(n.from>=i)return this.fragment.from<=t;if(!n.childAfter(i))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(xe.contextHash)==e}takeNodes(e){let t=this.cursor,n=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,a=e.block.children.length,l=o,c=a;for(;;){if(t.to-n>i){if(t.type.isAnonymous&&t.firstChild())continue;break}let d=F1(t.from-n,e.ranges);if(t.to-n<=e.ranges[e.rangeI].to)e.addNode(t.tree,d);else{let h=new Ee(e.parser.nodeSet.types[te.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,t.tree),e.addNode(h,d)}if(t.type.is("Block")&&(AD.indexOf(t.type.id)<0?(o=t.to-n,a=e.block.children.length):(o=l,a=c),l=t.to-n,c=e.block.children.length),!t.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-s}};function F1(r,e){let t=r;for(let n=1;n<e.length;n++){let i=e[n-1].to,s=e[n].from;i<r&&(t-=s-i)}return t}var CD=Ht({"Blockquote/...":O.quote,HorizontalRule:O.contentSeparator,"ATXHeading1/... SetextHeading1/...":O.heading1,"ATXHeading2/... SetextHeading2/...":O.heading2,"ATXHeading3/...":O.heading3,"ATXHeading4/...":O.heading4,"ATXHeading5/...":O.heading5,"ATXHeading6/...":O.heading6,"Comment CommentBlock":O.comment,Escape:O.escape,Entity:O.character,"Emphasis/...":O.emphasis,"StrongEmphasis/...":O.strong,"Link/... Image/...":O.link,"OrderedList/... BulletList/...":O.list,"BlockQuote/...":O.quote,"InlineCode CodeText":O.monospace,"URL Autolink":O.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":O.processingInstruction,"CodeInfo LinkLabel":O.labelName,LinkTitle:O.string,Paragraph:O.content}),N1=new Zl(new Qi(X1).extend(CD),Object.keys(Ch).map(r=>Ch[r]),Object.keys(Ch).map(r=>I1[r]),Object.keys(Ch),QD,T1,Object.keys(dg).map(r=>dg[r]),Object.keys(dg),[]);function ED(r,e,t){let n=[];for(let i=r.firstChild,s=e;;i=i.nextSibling){let o=i?i.from:t;if(o>s&&n.push({from:s,to:o}),!i)break;s=i.to}return n}function j1(r){let{codeParser:e,htmlParser:t}=r;return{wrap:Dd((i,s)=>{let o=i.type.id;if(e&&(o==te.CodeBlock||o==te.FencedCode)){let a="";if(o==te.FencedCode){let c=i.node.getChild(te.CodeInfo);c&&(a=s.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==te.CodeText,bracketed:o==te.FencedCode}}else if(t&&(o==te.HTMLBlock||o==te.HTMLTag||o==te.CommentBlock))return{parser:t,overlay:ED(i.node,i.from,i.to)};return null})}}var RD={resolve:"Strikethrough",mark:"StrikethroughMark"},MD={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":O.strikethrough}},{name:"StrikethroughMark",style:O.processingInstruction}],parseInline:[{name:"Strikethrough",parse(r,e,t){if(e!=126||r.char(t+1)!=126||r.char(t+2)==126)return-1;let n=r.slice(t-1,t),i=r.slice(t+2,t+3),s=/\s|^$/.test(n),o=/\s|^$/.test(i),a=Xl.test(n),l=Xl.test(i);return r.addDelimiter(RD,t,t+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function Il(r,e,t=0,n,i=0){let s=0,o=!0,a=-1,l=-1,c=!1,d=()=>{n.push(r.elt("TableCell",i+a,i+l,r.parser.parseInline(e.slice(a,l),i+a)))};for(let h=t;h<e.length;h++){let u=e.charCodeAt(h);u==124&&!c?((!o||a>-1)&&s++,o=!1,n&&(a>-1&&d(),n.push(r.elt("TableDelimiter",h+i,h+i+1))),a=l=-1):(c||u!=32&&u!=9)&&(a<0&&(a=h),l=h+1),c=!c&&u==92}return a>-1&&(s++,n&&d()),s}function v1(r,e){for(let t=e;t<r.length;t++){let n=r.charCodeAt(t);if(n==124)return!0;n==92&&t++}return!1}var U1=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Ih=class{constructor(){this.rows=null}nextLine(e,t,n){if(this.rows==null){this.rows=!1;let i;if((t.next==45||t.next==58||t.next==124)&&U1.test(i=t.text.slice(t.pos))){let s=[];Il(e,n.content,0,s,n.start)==Il(e,i,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let i=[];Il(e,t.text,t.pos,i,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,i))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},LD={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":O.heading}},"TableRow",{name:"TableCell",style:O.content},{name:"TableDelimiter",style:O.processingInstruction}],parseBlock:[{name:"Table",leaf(r,e){return v1(e.content,0)?new Ih:null},endLeaf(r,e,t){if(t.parsers.some(i=>i instanceof Ih)||!v1(e.text,e.basePos))return!1;let n=r.peekLine();return U1.test(n)&&Il(r,e.text,e.basePos)==Il(r,n,e.basePos)},before:"SetextHeading"}]},vg=class{nextLine(){return!1}finish(e,t){return e.addLeafElement(t,e.elt("Task",t.start,t.start+t.content.length,[e.elt("TaskMarker",t.start,t.start+3),...e.parser.parseInline(t.content.slice(3),t.start+3)])),!0}},DD={defineNodes:[{name:"Task",block:!0,style:O.list},{name:"TaskMarker",style:O.atom}],pa
Line truncated
|
|
|
|
|
\${}
|
|
|
|
|
} catch (\${error}) {
|
|
|
|
|
\${}
|
|
|
|
@@ -65,37 +66,37 @@ Connect your audio output to the SuperCharger input, turn up the volume, and pla
|
|
|
|
|
constructor(\${params}) {
|
|
|
|
|
\${}
|
|
|
|
|
}
|
|
|
|
|
}`,{label:"class",detail:"definition",type:"keyword"}),vr('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),vr('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],$Z=Ek.concat([vr("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),vr("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),vr("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),_k=new jo,Rk=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Bl(r){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,r),!0}}var QZ=["FunctionDeclaration"],TZ={FunctionDeclaration:Bl("function"),ClassDeclaration:Bl("class"),ClassExpression:()=>!0,EnumDeclaration:Bl("constant"),TypeAliasDeclaration:Bl("type"),NamespaceDeclaration:Bl("namespace"),VariableDefinition(r,e){r.matchContext(QZ)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function Mk(r,e){let t=_k.get(e);if(t)return t;let n=[],i=!0;function s(o,a){let l=r.sliceString(o.from,o.to);n.push({label:l,type:a})}return e.cursor(We.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=TZ[o.name];if(a&&a(o,s)||Rk.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of Mk(r,o.node))n.push(a);return!1}}),_k.set(e,n),n}var Ak=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Lk=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function _Z(r){let e=ze(r.state).resolveInner(r.pos,-1);if(Lk.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Ak.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Rk.has(i.name)&&(n=n.concat(Mk(r.state.doc,i)));return{options:n,from:t?e.from:r.pos,validFor:Ak}}var Bn=Kt.define({name:"javascript",parser:Tk.configure({props:[gn.add({IfStatement:Zn({except:/^\s*({|else\b)/}),TryStatement:Zn({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:sx,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:n?1:2)*r.unit},Block:Fd({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":Zn({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),dr.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Bt,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,n=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?r.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Dk={test:r=>/^JSX/.test(r.name),facet:Uo({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Zg=Bn.configure({dialect:"ts"},"typescript"),Xg=Bn.configure({dialect:"jsx",props:[Vd.add(r=>r.isTop?[Dk]:void 0)]}),zg=Bn.configure({dialect:"jsx ts",props:[Vd.add(r=>r.isTop?[Dk]:void 0)]},"typescript"),Ik=r=>({label:r,type:"keyword"}),Zk="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Ik),AZ=Zk.concat(["declare","implements","private","protected","public"].map(Ik));function Xk(r={}){let e=r.jsx?r.typescript?zg:Xg:r.typescript?Zg:Bn,t=r.typescript?$Z.concat(AZ):Ek.concat(Zk);return new je(e,[Bn.data.of({autocomplete:kx(Lk,Px(t))}),Bn.data.of({autocomplete:_Z}),r.jsx?RZ:[]])}function CZ(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function Ck(r,e,t=r.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return r.sliceString(n.from,Math.min(n.to,t));return""}var EZ=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),RZ=N.inputHandler.of((r,e,t,n,i)=>{if((EZ?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||n!=">"&&n!="/"||!Bn.isActiveAt(r.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:d}=l,h=ze(o).resol
Line truncated
|
|
|
|
|
`);for(let l of a){p$.lastIndex=0;let c=p$.exec(l);if(c){let d=o+c.index+c[0].length;t.push(ee.widget({widget:new nb(c[0],e),side:-1}).range(d))}o+=l.length+1}}return ee.set(t,!0)}function O$(r){let e;function t(n){let i=e.posAtDOM(n);r(e.state.doc.lineAt(i).number)}return at.fromClass(class{constructor(n){e=n,this.decorations=m$(n,t)}update(n){e=n.view,(n.docChanged||n.viewportChanged)&&(this.decorations=m$(n.view,t))}},{decorations:n=>n.decorations})}var ib=class extends Tt{constructor(t,n,i){super();this.filename=t;this.system=n;this.handleClick=i}toDOM(){let t=document.createElement("span");return t.className="include-link-badge",t.textContent="\u2192",t.title=(this.system?"System header: ":"View ")+this.filename,t.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),this.handleClick(this.filename,this.system)}),t}eq(t){return this.filename===t.filename&&this.system===t.system}ignoreEvent(){return!1}};function f5(r,e,t){let n=[],i=r.state.doc,s=new Set;for(let{from:o,to:a}of r.visibleRanges){let l=r.state.sliceDoc(o,a);for(let c of e){let d=c instanceof RegExp?{re:c}:c;d.re.lastIndex=0;let h;for(;h=d.re.exec(l);){let u=h[d.group!=null?d.group:h.length-1];if(!u)continue;let f=d.suffix?u+d.suffix:u,m=Math.min(o+h.index+h[0].length,i.length),g=i.lineAt(m),v=g.number+":"+f;s.has(v)||(s.add(v),n.push(ee.widget({widget:new ib(f,!!d.system,t),side:1}).range(g.to)))}}}return ee.set(n,!0)}function g$(r,e){function t(n){let i=r();return!i||!i.length?ee.none:f5(n,i,e)}return at.fromClass(class{constructor(n){this.decorations=t(n)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=t(n.view))}},{decorations:n=>n.decorations})}var hs=window.matchMedia&&window.matchMedia("only screen and (max-width: 760px)").matches;function vn(r,e){var t=$(document.createElement("div"));return r&&t.appendTo(r),e&&t.addClass(e),t}function p5(r){return Me.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input")||!r.input)return e;let t=[],n=!1;if(e.changes.iterChanges((o,a,l,c,d)=>{let h=d.toString(),u=r.input(h);t.push({from:o,to:a,insert:u}),u!==h&&(n=!0)}),!n)return e;let i=e.annotation(dt.userEvent),s=e.annotation(dt.addToHistory);return{changes:t,selection:e.selection,effects:e.effects,scrollIntoView:e.scrollIntoView,annotations:[...i!=null?[dt.userEvent.of(i)]:[],...s!=null?[dt.addToHistory.of(s)]:[]]}})}var sb=new Ut;function b$(r){return sb.reconfigure(p5(r))}var y$=be.define(),S$=be.define(),v$=be.define(),x$=be.define(),w$=be.define(),P$=be.define(),k$=be.define(),ab=be.define(),$$=be.define(),Q$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(y$)){let n=t.value,i=[];for(let[s,o]of n.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new Fh(Ce(o,4)).range(a))}r=Te.of(i,!0)}return r}}),T$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(S$)){let n=t.value,i=[];for(let[s,o]of n.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new Nh(o).range(a))}r=Te.of(i,!0)}return r}}),_$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(v$)){let n=t.value,i=[];for(let[s,o]of n.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new jh(o).range(a))}r=Te.of(i,!0)}return r}}),A$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(w$)){let n=[],i=t.value.filter(s=>s.line>=1&&s.line<=e.state.doc.lines).sort((s,o)=>s.line-o.line);for(let s of i){let o=e.state.doc.line(s.line).from;n.push((s.enabled?O5:g5).range(o))}r=Te.of(n,!0)}return r}}),ob=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(P$)){let n=t.value,i=[];for(let[s,o]of n.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new qh(s,o).range(a))}r=Te.of(i,!0)}return r}}),C$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(k$))if(t.value===null)r=Te.empty;else{let n=t.value;if(n>=1&&n<=e.state.doc.lines){let i=e.state.doc.line(n).from;r=Te.of(E$.range(i))}}return r}}),Fh=class extends Pt{constructor(t){super();this.hex=t}toDOM(){let t=document.createElement("span");return t.className="gutter-offset-marker",t.textContent=this.hex,t.title="Click to run to here",t}eq(t){return this.hex==t.hex}},Nh=class extends Pt{constructor(t){super();this.bytes=t}toDOM(){return document.createTextNode(this.bytes)}eq(t){return this.bytes==t.bytes}},jh=class extends Pt{constructor(t){super();this.clock=t}toDOM(){return document.createTextNode(this.clock)}eq(t){return this.clock==t.clock}},m5=new class extends Pt{toDOM(){let r=document.createElement("span");return r.className="gutter-breakpoint-placeholder",r.textContent="\u25CF",r}},Uh=class extends Pt{constructor(t){super();this.enabled=t}toDOM(){let t=document.createElement("span");return t.className="gutter-breakpoin
Line truncated
|
|
|
|
|
}`,{label:"class",detail:"definition",type:"keyword"}),vr('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),vr('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],RZ=Dk.concat([vr("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),vr("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),vr("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Rk=new jo,Ik=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Vl(r){return(e,t)=>{let n=e.node.getChild("VariableDefinition");return n&&t(n,r),!0}}var MZ=["FunctionDeclaration"],LZ={FunctionDeclaration:Vl("function"),ClassDeclaration:Vl("class"),ClassExpression:()=>!0,EnumDeclaration:Vl("constant"),TypeAliasDeclaration:Vl("type"),NamespaceDeclaration:Vl("namespace"),VariableDefinition(r,e){r.matchContext(MZ)||e(r,"variable")},TypeDefinition(r,e){e(r,"type")},__proto__:null};function Zk(r,e){let t=Rk.get(e);if(t)return t;let n=[],i=!0;function s(o,a){let l=r.sliceString(o.from,o.to);n.push({label:l,type:a})}return e.cursor(We.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=LZ[o.name];if(a&&a(o,s)||Ik.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of Zk(r,o.node))n.push(a);return!1}}),Rk.set(e,n),n}var Mk=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Xk=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function DZ(r){let e=ze(r.state).resolveInner(r.pos,-1);if(Xk.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Mk.test(r.state.sliceDoc(e.from,e.to));if(!t&&!r.explicit)return null;let n=[];for(let i=e;i;i=i.parent)Ik.has(i.name)&&(n=n.concat(Zk(r.state.doc,i)));return{options:n,from:t?e.from:r.pos,validFor:Mk}}var Bn=Kt.define({name:"javascript",parser:Ek.configure({props:[Cr.add({IfStatement:qr({except:/^\s*({|else\b)/}),TryStatement:qr({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ox,SwitchBody:r=>{let e=r.textAfter,t=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return r.baseIndent+(t?0:n?1:2)*r.unit},Block:Go({closing:"}"}),ArrowFunction:r=>r.baseIndent+r.unit,"TemplateString BlockComment":()=>null,"Statement Property":qr({except:/^\s*{/}),JSXElement(r){let e=/^\s*<\//.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},JSXEscape(r){let e=/\s*\}/.test(r.textAfter);return r.lineIndent(r.node.from)+(e?0:r.unit)},"JSXOpenTag JSXSelfClosingTag"(r){return r.column(r.node.from)+r.unit}}),dr.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Vt,BlockComment(r){return{from:r.from+2,to:r.to-2}},JSXElement(r){let e=r.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=r.lastChild;return{from:e.to,to:t.type.isError?r.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(r){var e;let t=(e=r.firstChild)===null||e===void 0?void 0:e.nextSibling,n=r.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?r.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),zk={test:r=>/^JSX/.test(r.name),facet:Uo({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Xg=Bn.configure({dialect:"ts"},"typescript"),zg=Bn.configure({dialect:"jsx",props:[Yd.add(r=>r.isTop?[zk]:void 0)]}),Wg=Bn.configure({dialect:"jsx ts",props:[Yd.add(r=>r.isTop?[zk]:void 0)]},"typescript"),Wk=r=>({label:r,type:"keyword"}),Bk="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Wk),IZ=Bk.concat(["declare","implements","private","protected","public"].map(Wk));function Vk(r={}){let e=r.jsx?r.typescript?Wg:zg:r.typescript?Xg:Bn,t=r.typescript?RZ.concat(IZ):Dk.concat(Bk);return new Fe(e,[Bn.data.of({autocomplete:$x(Xk,kx(t))}),Bn.data.of({autocomplete:DZ}),r.jsx?zZ:[]])}function ZZ(r){for(;;){if(r.name=="JSXOpenTag"||r.name=="JSXSelfClosingTag"||r.name=="JSXFragmentTag")return r;if(r.name=="JSXEscape"||!r.parent)return null;r=r.parent}}function Lk(r,e,t=r.length){for(let n=e==null?void 0:e.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return r.sliceString(n.from,Math.min(n.to,t));return""}var XZ=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),zZ=N.inputHandler.of((r,e,t,n,i)=>{if((XZ?r.composing:r.compositionStarted)||r.state.readOnly||e!=t||n!=">"&&n!="/"||!Bn.isActiveAt(r.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var c;let{head:d}=l,h=ze(o).resol
Line truncated
|
|
|
|
|
`);for(let l of a){b$.lastIndex=0;let c=b$.exec(l);if(c){let d=o+c.index+c[0].length;t.push(ee.widget({widget:new ib(c[0],e),side:-1}).range(d))}o+=l.length+1}}return ee.set(t,!0)}function S$(r){let e;function t(n){let i=e.posAtDOM(n);r(e.state.doc.lineAt(i).number)}return at.fromClass(class{constructor(n){e=n,this.decorations=y$(n,t)}update(n){e=n.view,(n.docChanged||n.viewportChanged)&&(this.decorations=y$(n.view,t))}},{decorations:n=>n.decorations})}var sb=class extends Tt{constructor(t,n,i){super();this.filename=t;this.system=n;this.handleClick=i}toDOM(){let t=document.createElement("span");return t.className="include-link-badge",t.textContent="\u2192",t.title=(this.system?"System header: ":"View ")+this.filename,t.addEventListener("click",n=>{n.preventDefault(),n.stopPropagation(),this.handleClick(this.filename,this.system)}),t}eq(t){return this.filename===t.filename&&this.system===t.system}ignoreEvent(){return!1}};function S5(r,e,t){let n=[],i=r.state.doc,s=new Set;for(let{from:o,to:a}of r.visibleRanges){let l=r.state.sliceDoc(o,a);for(let c of e){let d=c instanceof RegExp?{re:c}:c;d.re.lastIndex=0;let h;for(;h=d.re.exec(l);){let u=h[d.group!=null?d.group:h.length-1];if(!u)continue;let f=d.suffix?u+d.suffix:u,m=Math.min(o+h.index+h[0].length,i.length),g=i.lineAt(m),v=g.number+":"+f;s.has(v)||(s.add(v),n.push(ee.widget({widget:new sb(f,!!d.system,t),side:1}).range(g.to)))}}}return ee.set(n,!0)}function v$(r,e){function t(n){let i=r();return!i||!i.length?ee.none:S5(n,i,e)}return at.fromClass(class{constructor(n){this.decorations=t(n)}update(n){(n.docChanged||n.viewportChanged)&&(this.decorations=t(n.view))}},{decorations:n=>n.decorations})}var hs=window.matchMedia&&window.matchMedia("only screen and (max-width: 760px)").matches;function xn(r,e){var t=$(document.createElement("div"));return r&&t.appendTo(r),e&&t.addClass(e),t}function v5(r){return Me.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input")||!r.input)return e;let t=[],n=!1;if(e.changes.iterChanges((o,a,l,c,d)=>{let h=d.toString(),u=r.input(h);t.push({from:o,to:a,insert:u}),u!==h&&(n=!0)}),!n)return e;let i=e.annotation(dt.userEvent),s=e.annotation(dt.addToHistory);return{changes:t,selection:e.selection,effects:e.effects,scrollIntoView:e.scrollIntoView,annotations:[...i!=null?[dt.userEvent.of(i)]:[],...s!=null?[dt.addToHistory.of(s)]:[]]}})}var ob=new Bt;function x$(r){return ob.reconfigure(v5(r))}var w$=be.define(),P$=be.define(),k$=be.define(),$$=be.define(),Q$=be.define(),T$=be.define(),_$=be.define(),lb=be.define(),A$=be.define(),C$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(w$)){let n=t.value,i=[];for(let[s,o]of n.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new Nh(Ce(o,4)).range(a))}r=Te.of(i,!0)}return r}}),E$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(P$)){let n=t.value,i=[];for(let[s,o]of n.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new jh(o).range(a))}r=Te.of(i,!0)}return r}}),R$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(k$)){let n=t.value,i=[];for(let[s,o]of n.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new Uh(o).range(a))}r=Te.of(i,!0)}return r}}),M$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(Q$)){let n=[],i=t.value.filter(s=>s.line>=1&&s.line<=e.state.doc.lines).sort((s,o)=>s.line-o.line);for(let s of i){let o=e.state.doc.line(s.line).from;n.push((s.enabled?w5:P5).range(o))}r=Te.of(n,!0)}return r}}),ab=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(T$)){let n=t.value,i=[];for(let[s,o]of n.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;i.push(new Gh(s,o).range(a))}r=Te.of(i,!0)}return r}}),L$=Ze.define({create(){return Te.empty},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(_$))if(t.value===null)r=Te.empty;else{let n=t.value;if(n>=1&&n<=e.state.doc.lines){let i=e.state.doc.line(n).from;r=Te.of(D$.range(i))}}return r}}),Nh=class extends Pt{constructor(t){super();this.hex=t}toDOM(){let t=document.createElement("span");return t.className="gutter-offset-marker",t.textContent=this.hex,t.title="Click to run to here",t}eq(t){return this.hex==t.hex}},jh=class extends Pt{constructor(t){super();this.bytes=t}toDOM(){return document.createTextNode(this.bytes)}eq(t){return this.bytes==t.bytes}},Uh=class extends Pt{constructor(t){super();this.clock=t}toDOM(){return document.createTextNode(this.clock)}eq(t){return this.clock==t.clock}},x5=new class extends Pt{toDOM(){let r=document.createElement("span");return r.className="gutter-breakpoint-placeholder",r.textContent="\u25CF",r}},qh=class extends Pt{constructor(t){super();this.enabled=t}toDOM(){let t=document.createElement("span");return t.className="gutter-breakpoin
Line truncated
|
|
|
|
|
color: #ff6666;
|
|
|
|
|
background-color: #330000;
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
margin: 2px 0;
|
|
|
|
|
border-left: 3px solid #ff0000;
|
|
|
|
|
font-family: monospace;
|
|
|
|
|
`,t}},k5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(lo.showMessage)){if(t.value===null||!t.value)return ee.none;if(t.value.toggle){let n=[],i=new Map;return r.between(0,e.state.doc.length,(a,l,c)=>{try{let d=e.state.doc.lineAt(l).number;c.spec.widget instanceof Nl&&i.set(d,c.spec.widget.message)}catch(d){}}),i.has(t.value.line)?i.delete(t.value.line):i.set(t.value.line,t.value.msg),Array.from(i.keys()).sort((a,l)=>a-l).forEach(a=>{try{let l=e.state.doc.line(a);n.push(ee.widget({widget:new Nl(i.get(a)),block:!0,side:1}).range(l.to))}catch(l){}}),ee.set(n,!0)}}return r},provide:r=>N.decorations.from(r)}),lb=class extends Tt{constructor(t){super();this.value=t}toDOM(){let t=document.createElement("div");return t.textContent=`${this.value}`,t.style.cssText=`
|
|
|
|
|
`,t}},E5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(lo.showMessage)){if(t.value===null||!t.value)return ee.none;if(t.value.toggle){let n=[],i=new Map;return r.between(0,e.state.doc.length,(a,l,c)=>{try{let d=e.state.doc.lineAt(l).number;c.spec.widget instanceof jl&&i.set(d,c.spec.widget.message)}catch(d){}}),i.has(t.value.line)?i.delete(t.value.line):i.set(t.value.line,t.value.msg),Array.from(i.keys()).sort((a,l)=>a-l).forEach(a=>{try{let l=e.state.doc.line(a);n.push(ee.widget({widget:new jl(i.get(a)),block:!0,side:1}).range(l.to))}catch(l){}}),ee.set(n,!0)}}return r},provide:r=>N.decorations.from(r)}),cb=class extends Tt{constructor(t){super();this.value=t}toDOM(){let t=document.createElement("div");return t.textContent=`${this.value}`,t.style.cssText=`
|
|
|
|
|
color: #ccccff;
|
|
|
|
|
background-color: #000066;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
`,t.className="cm-line",t}},D$=be.define(),$5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(D$)){if(t.value===null||!t.value)return ee.none;let n=e.state.doc.lineAt(t.value.range.to);return ee.set([ee.widget({widget:new lb(t.value.val),block:!0,side:1}).range(n.to)])}return r},provide:r=>N.decorations.from(r)}),I$=be.define(),Q5=ee.mark({attributes:{class:"cm-error-span"}}),T5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(I$)){if(t.value===null)return ee.none;let n=[];for(let i of t.value)try{let s=e.state.doc.line(i.line),o=s.from+i.start,a=s.from+i.end;o>=s.from&&a<=s.to&&o<a&&n.push(Q5.range(o,a))}catch(s){}return ee.set(n,!0)}return r},provide:r=>N.decorations.from(r)}),Z$=be.define(),_5=ee.line({attributes:{class:"highlight-lines"}}),A5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(Z$)){if(t.value===null)return ee.none;let{start:n,end:i}=t.value,s=[];for(let o=n;o<=i;o++)try{let a=e.state.doc.line(o);s.push(_5.range(a.from))}catch(a){}return ee.set(s)}return r!==ee.none&&(e.docChanged||e.selection)?ee.none:r},provide:r=>N.decorations.from(r)}),X$={field:k5,widget:Nl},jl={effect:M$,decoration:L$,field:P5},Jh={effect:D$,field:$5},eu={effect:I$,field:T5},tu={effect:Z$,field:A5},z$=be.define(),C5=ee.line({attributes:{class:"cm-traced-line"}}),E5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(z$)){let n=[];for(let i of t.value)try{let s=e.state.doc.line(i);n.push(C5.range(s.from))}catch(s){}return ee.set(n,!0)}return r},provide:r=>N.decorations.from(r)}),ru={effect:z$,field:E5};var R5=[...uf(xw,hf),{key:"Mod-Shift-Backspace",run:nO}],V$=uf(CP,hf),Oa=64,Y$=be.define(),F$=be.define(),cb=Ze.define({create(){return new Map},update(r,e){let t=r;for(let n of e.effects)if(n.is(F$))t=new Map;else if(n.is(Y$)){t===r&&(t=new Map(r));for(let i of n.value)t.set(i.id,{from:i.from,to:i.to})}if(!e.changes.empty){let n=new Map;for(let[i,s]of t)n.set(i,{from:e.changes.mapPos(s.from,-1),to:e.changes.mapPos(s.to,1)});return n}return t}}),M5=200,db={default:{theme:Bh},6502:{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:Wh},dialog:{theme:Wh,lineWrap:!0},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noGutters:!0,lineBased:!0},ecs:{theme:Bh}},N$={input:null};function j$(r){N$.input=r?e=>e.toUpperCase():null}function fb(r){if(!r)return"";let e=r.state.selection.main;return e.empty?"":r.state.sliceDoc(e.from,e.to)}var Ul=class Ul{constructor(e,t){this.updateTimer=null;this.dirtylisting=!0;this.refreshDelayMsec=300;this.probe=null;this.path=e,this.mode=t}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var n=ae.getFile(this.path),i=n&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(n);return this.newEditor(t,n,i),this.editor.dispatch({effects:b$(N$)}),this.syncBreakpoints(),ae.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),t}setVisible(e){e?(this.editor.focus(),Ul.tracingEnabled&&this.startTracing()):this.stopTracing()}getShortcuts(){if(!this.editor)return[];var e=this.editor,t=(n,i,s)=>({key:n,label:i,fn:()=>{s(e),e.focus()}});return[t("mod+f","Find",Qh),t("mod+g","Find Next",ca),t("mod+d","Next Occurrence",xO),t("mod+z","Undo",wl),t("mod+shift+z","Redo",Ho)]}startTracing(){!this.probe&&P.startProbing&&(this.probe=P.startProbing(),this.probe.singleFrame=!1,this.probe.clear())}stopTracing(){this.probe&&(P.stopProbing(),this.probe=null),this.editor.dispatch({effects:ru.effect.of([])})}setTracingEnabled(e){Ul.tracingEnabled=e,e?this.startTracing():this.stopTracing()}newEditor(e,t,n){var i=db[this.mode]||db.default,s=n||i.isAsm,o=!!i.lineWrap,a=i.theme||db.default.theme,l=i.useLineNumbers&&!hs;de.embed&&(l=!1,s=!1);let c=i.noGutters||hs;var d;let h=Gg[this.mode];h?d=h.language:(console.warn("Unknown mode: "+this.mode),d=null),this.editor=new N({parent:e,doc:t,extensions:[s?[]:On.of(" "),s?Zm.of((u,f)=>{let m=u.state.doc.lineAt(f).number;if(m>=0){let g=u.state.doc.line(m);if(g.text.trim())return u.lineIndent(g.from)}return 0}):[],...s?[Sr.of(_w(()=>ta().tabsToSpaces))]:[],i.lineBased?Sr.of(ww):[],...Rw(ta()),Sr.of(R5),l?_d():[],Fx(),Sr.of(Ux),dx(),Sv(),Me.allowMultipleSelections.of(!0),kd(),ox(),mx(),Qd(),Td(),$d(),_v(),$h(),wO({top:!0}),Sr.of(V$),d||[],a,Kg,o?N.lineWrapping:[],jl.field,c?[]:[Gh.field,Gh.gutter],s&&!c?[Fl.field,Fl.gutter,Hh.field,Hh.gutter]:[],Kh.field,R$.gutter,N.updateListener.of(u=>{for(let f of u.transactions.flatMap(m=>m.effects))if(f.is(Kh.requestToggle)&&Vt.toggleSourceLine(this.path,f.value),f.is(ma.runToLine)){let m=f.value;if(this.sourcefile&&this.sourcefile.line2offset){let g=this.sourcefile.line2offset.get(m);g>=0&&Gl([g])}}}),lo.field,X$.field,eu.field,ma.field,ma.gutter,tu.field,ru.field,cb,O$(u=>{window.location.hash="asseteditor/"+encodeURIComponent(th
Line truncated
|
|
|
|
|
`).length-1;this.editor.dispatch({changes:{from:i,insert:e}}),this.highlightLines(n-1,n+s-2)}highlightLines(e,t){let n=this.editor.state.doc.line(e+1);this.editor.dispatch({effects:[tu.effect.of({start:e+1,end:t+1}),N.scrollIntoView(n.from,{y:"start",yMargin:100})]})}navigateToLine(e){if(e<1||e>this.editor.state.doc.lines)return;let t=this.editor.state.doc.line(e);this.editor.dispatch({selection:{anchor:t.from},effects:[tu.effect.of({start:e,end:e}),N.scrollIntoView(t.from,{y:"center"})]}),this.editor.focus()}getValue(){return this.editor.state.doc.toString()}getSelectionText(){return fb(this.editor)}getPath(){return this.path}markErrors(e){this.clearErrors(),e=e.slice(0,M5);let t=new Map,n=[];for(var i of e)if(!i.path||this.path.endsWith(i.path)){var s=this.editor.state.doc.lines,o=i.line;(isNaN(o)||o<1||o>s)&&(o=1),t.set(o,i.msg),i.start!=null&&i.end!=null&&i.end>i.start&&n.push({line:o,start:i.start,end:i.end})}this.editor.dispatch({effects:[lo.set.of(t),eu.effect.of(n.length>0?n:null)]})}clearErrors(){this.dirtylisting=!0,this.editor.dispatch({effects:[lo.set.of(new Map),lo.showMessage.of(null),eu.effect.of(null)]})}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors();var e=this.sourcefile.lines||[];let t=new Map,n=new Map,i=new Map;for(var s of e)if(s.offset>=0&&t.set(s.line,Ce(s.offset&65535,4)),s.insns){var o=s.insns.length>9?"...":s.insns;if(n.set(s.line,o),s.iscode){if(s.cycles)i.set(s.line,s.cycles+"");else if(P.getOpcodeMetadata){var a=parseInt(s.insns.split(" ")[0],16),l=P.getOpcodeMetadata(a,s.offset);if(l&&l.minCycles){var c=l.minCycles+"";i.set(s.line,c)}}}}this.editor.dispatch({effects:[Gh.set.of(t),Fl.set.of(n),Hh.set.of(i)]})}setTimingResult(e){if(this.sourcefile!=null){var t=new Map;for(let[o,a]of this.sourcefile.line2offset){let l=e.pc2clockrange[a];var n=l&&l.minclocks,i=l&&l.maxclocks;if(n>=0&&i>=0){var s;i==n?s=n+"":s=n+"-"+i,i==e.MAX_CLOCKS&&(s+="+"),t.set(o,s)}}this.editor.dispatch({effects:[Fl.set.of(t)]})}}setCurrentLine(e,t){var n=i=>{this.editor.dispatch({effects:[ma.set.of(i.line),jl.effect.of(i.line),...t?[N.scrollIntoView(this.editor.state.doc.line(i.line).from,{y:"center"})]:[]]})};if(this.clearCurrentLine(t),e){if(e.line<1||e.line>this.editor.state.doc.lines)return;if(n(e),t){let s=this.editor.state.doc.line(e.line).from+(e.start||0);this.editor.dispatch({selection:{anchor:s,head:s},effects:N.scrollIntoView(s,{y:"center"})})}this.currentDebugLine=e}}clearCurrentLine(e){if(this.currentDebugLine){if(e){let t=this.editor.state.selection.main.head;this.editor.dispatch({selection:{anchor:t,head:t}})}this.currentDebugLine=null}this.editor.dispatch({effects:[ma.set.of(null),jl.effect.of(null)]})}getActiveLine(){if(this.sourcefile){var e=Jt&&Jt.c;if(!e&&P.getCPUState&&!P.isRunning()&&(e=P.getCPUState()),e){var t=e&&(e.EPC||e.PC),n=this.sourcefile.findLineForOffset(t,Oa);return n}}}refreshDebugState(e){var t=this.getActiveLine();!e&&(t===this.currentDebugLine||!t&&!this.currentDebugLine)||this.setCurrentLine(t,e)}refreshListing(){var e=ae.getListingForFile(this.path);e&&e.sourcefile&&e.sourcefile!==this.sourcefile&&(this.sourcefile=e.sourcefile,this.dirtylisting=!0),!(!this.sourcefile||!this.dirtylisting)&&(this.updateListing(),this.dirtylisting=!1)}refresh(e){this.refreshListing(),this.refreshDebugState(e)}tick(){this.refreshDebugState(!1),this.updateTracedLines()}updateTracedLines(){let e=this.probe;if(!e||!e.idx||!this.sourcefile)return;let t=new Set;for(let n=0;n<e.idx;n++){let i=e.buf[n];if((i&4278190080)===16777216){let s=this.sourcefile.findLineForOffset(i&65535,Oa);s&&t.add(s.line)}}e.clear(),this.editor.dispatch({effects:ru.effect.of(Array.from(t))})}getLine(e){return this.editor.state.doc.line(e).text}getCurrentLine(){let e=this.editor.state.selection.main.head;return this.editor.state.doc.lineAt(e).number}getCursorPC(){for(var e=this.getCurrentLine();this.sourcefile&&e>=0;){var t=this.sourcefile.line2offset.get(e);if(t>=0)return t;e--}return-1}undoStep(){wl(this.editor)}redoStep(){Ho(this.editor)}syncBreakpoints(){let e=Vt.getSourceBreakpointsForFile(this.path).map(t=>({line:t.line,enabled:t.enabled}));this.editor.dispatch({effects:Kh.setAll.of(e)})}};Ul.tracingEnabled=!1;var Pr=Ul,hb=1024,Mi=class{getSelectionText(){return fb(this.disasmview)}createDiv(e){var t=document.createElement("div");return t.setAttribute("class","editor"),e.appendChild(t),this.newEditor(t),t}newEditor(e){this.disasmview=new N({parent:e,extensions:[Qd(),Td(),Me.allowMultipleSelections.of(!0),kd(),$d(),$h(),c$,Wh,jl.field,Me.tabSize.of(8),Me.readOnly.of(!0)]})}refresh(e,t){let n=Jt||P.saveState(),i=t!==void 0?t:n.c?n.c.PC:0,s=0,o=0,a=P.debugSymbols&&P.debugSymbols.addr2symbol||{},l=(h,u)=>{let f="",m=0;for(;m<u;){let g=h+m|0,v=P.disassemble(g,P.readAddress.bind(P)),k="",L="";for(let w=0;w<v.nbytes;w++)k+=Ce(P.readAddress(g+w));for(;k.length<14;)k+=" ";let M=v.line;if(a&&v.isaddr&&(M=M.replace(/([^#])[$]([0-9A-F]+)/,(w,...x)=>{let R=parseInt(x[1],16),X=a[R];return X?x[0]+X:(X=a
Line truncated
|
|
|
|
|
`;f+=D,g==i&&(o=s),s++,m+=v.nbytes||1}return f};var c=i<0?i-hb:Math.max(0,i-hb);let d=l(c,i-c)+l(i,hb);if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:d}}),e){let h=this.disasmview.state.doc.line(o+1);this.disasmview.dispatch({selection:{anchor:h.from,head:h.from},effects:N.scrollIntoView(h.from,{y:"center"})})}}goToAddress(e){e|=0,this.findAndSelectAddress(e)||(this.refresh(!1,e),this.findAndSelectAddress(e)),this.disasmview.focus()}findAndSelectAddress(e){let t=Ce(e,4),n=this.disasmview.state.doc;for(let i=1;i<=n.lines;i++){let s=n.line(i);if(s.text.startsWith(t+" "))return this.disasmview.dispatch({selection:{anchor:s.from,head:s.from+t.length},effects:N.scrollIntoView(s.from,{y:"center"})}),!0}return!1}getCursorPC(){let e=this.disasmview.state.selection.main.head,t=this.disasmview.state.doc.lineAt(e).number;if(t>=0){let i=this.disasmview.state.doc.line(t).text.trim().split(/\s+/);if(i&&i.length>=1){let s=parseInt(i[0],16);if(console.log("getCursorPC",s),s>=0)return s}}return-1}},nu=class extends Mi{constructor(e){super(),this.path=e}refreshListing(){var e=ae.getListingForFile(this.path);this.assemblyfile=e&&(e.assemblyfile||e.sourcefile)}refresh(e){if(this.refreshListing(),!!this.assemblyfile){var t=this.assemblyfile.text;if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:t}}),!!P.saveState){var n=Jt||P.saveState(),i=n.c?n.c.EPC||n.c.PC:0;if(i>=0&&this.assemblyfile){var s=this.assemblyfile.findLineForOffset(i,Oa);if(s&&e){let o=this.disasmview.state.doc.line(s.line);this.disasmview.dispatch({selection:{anchor:o.from,head:o.from},effects:N.scrollIntoView(o.from,{y:"center"})})}}}}}goToAddress(e){this.refreshListing();let t=this.assemblyfile&&this.assemblyfile.findLineForOffset(e,Oa);if(t){let n=this.disasmview.state.doc.line(t.line);this.disasmview.dispatch({selection:{anchor:n.from,head:n.from},effects:N.scrollIntoView(n.from,{y:"center"})})}this.disasmview.focus()}};function U$(r){let e=[r];try{var t=Ma(ae.mainPath);t.length>0&&t!="local"&&e.push(t+"/"+r)}catch(s){}for(var n of e){var i=ae&&ae.getFile(n);if(typeof i=="string")return n}return null}function W$(r){for(var e of ey(r))if(e.editorStyle){var t=l$(e.editorStyle);if(t)return t}return null}var ub=new Map;function L5(r){let e=ae.getToolForFilename(ae.mainPath),t=Ac(e,ae.platform_id),n=_c(e,ae.platform_id);if(!t||!n.length)return Promise.resolve(null);let i=t+":"+r;return ub.has(i)||ub.set(i,(async()=>{var s=[...n.map(d=>d+"/"+r),r];for(var o of s){var a={preload_fs:t,readshared:o,updates:[],buildsteps:[]},l=await ae.queryWorker(a),c=l&&l.output;if(c instanceof Uint8Array&&c.length>0)return new TextDecoder().decode(c)}return null})()),ub.get(i)}var us=class{constructor(e){this.fn=e;this.languageCompartment=new Ut}getSelectionText(){return fb(this.view)}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var n=W$(this.fn||this.currentPath||"")||Hg();return this.view=new N({parent:t,extensions:[Qd(),Td(),Me.allowMultipleSelections.of(!0),kd(),$d(),$h(),wO({top:!0}),Sr.of(V$),this.languageCompartment.of(n),Bh,Kg,Me.readOnly.of(!0)]}),this.refresh(!1),t}setVisible(e){e&&this.refresh(!1)}setHeaderText(e){var t=W$(this.currentPath||this.fn||"")||Hg();this.view.dispatch({effects:this.languageCompartment.reconfigure(t),changes:{from:0,to:this.view.state.doc.length,insert:e}})}refresh(e){var t=this.fn;if(!t){var n=window.location.hash;if(!n||!n.startsWith("#headerview/"))return;t=this.fn=decodeURIComponent(n.substring(12))}this.loadIncludeFile(t)}async loadIncludeFile(e){this.requestedFn=e;var t=U$(e);if(t){this.currentPath=t,this.setHeaderText(ae.getFile(t));return}var n=await L5(e);if(this.requestedFn===e){if(n!=null){this.currentPath=e,this.setHeaderText(n);return}this.currentPath=e,this.setHeaderText("// "+e+` was not found.
|
|
|
|
|
`,t.className="cm-line",t}},z$=be.define(),R5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(z$)){if(t.value===null||!t.value)return ee.none;let n=e.state.doc.lineAt(t.value.range.to);return ee.set([ee.widget({widget:new cb(t.value.val),block:!0,side:1}).range(n.to)])}return r},provide:r=>N.decorations.from(r)}),W$=be.define(),M5=ee.mark({attributes:{class:"cm-error-span"}}),L5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(W$)){if(t.value===null)return ee.none;let n=[];for(let i of t.value)try{let s=e.state.doc.line(i.line),o=s.from+i.start,a=s.from+i.end;o>=s.from&&a<=s.to&&o<a&&n.push(M5.range(o,a))}catch(s){}return ee.set(n,!0)}return r},provide:r=>N.decorations.from(r)}),B$=be.define(),D5=ee.line({attributes:{class:"highlight-lines"}}),I5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(B$)){if(t.value===null)return ee.none;let{start:n,end:i}=t.value,s=[];for(let o=n;o<=i;o++)try{let a=e.state.doc.line(o);s.push(D5.range(a.from))}catch(a){}return ee.set(s)}return r!==ee.none&&(e.docChanged||e.selection)?ee.none:r},provide:r=>N.decorations.from(r)}),V$={field:E5,widget:jl},Ul={effect:Z$,decoration:X$,field:C5},eu={effect:z$,field:R5},tu={effect:W$,field:L5},ru={effect:B$,field:I5},Y$=be.define(),Z5=ee.line({attributes:{class:"cm-traced-line"}}),X5=Ze.define({create(){return ee.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(Y$)){let n=[];for(let i of t.value)try{let s=e.state.doc.line(i);n.push(Z5.range(s.from))}catch(s){}return ee.set(n,!0)}return r},provide:r=>N.decorations.from(r)}),nu={effect:Y$,field:X5};var z5=[...ff(ww,uf),{key:"Mod-Shift-Backspace",run:iO}],j$=ff(RP,uf),ga=64,U$=be.define(),q$=be.define(),db=Ze.define({create(){return new Map},update(r,e){let t=r;for(let n of e.effects)if(n.is(q$))t=new Map;else if(n.is(U$)){t===r&&(t=new Map(r));for(let i of n.value)t.set(i.id,{from:i.from,to:i.to})}if(!e.changes.empty){let n=new Map;for(let[i,s]of t)n.set(i,{from:e.changes.mapPos(s.from,-1),to:e.changes.mapPos(s.to,1)});return n}return t}}),W5=200,hb={default:{theme:Vh},6502:{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:Bh},dialog:{theme:Bh,lineWrap:!0},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noGutters:!0,lineBased:!0},ecs:{theme:Vh}},G$={input:null};function H$(r){G$.input=r?e=>e.toUpperCase():null}function pb(r){if(!r)return"";let e=r.state.selection.main;return e.empty?"":r.state.sliceDoc(e.from,e.to)}var ql=class ql{constructor(e,t){this.updateTimer=null;this.indentUnitCompartment=new Bt;this.isAsm=!1;this.dirtylisting=!0;this.refreshDelayMsec=300;this.probe=null;this.path=e,this.mode=t}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var n=ae.getFile(this.path),i=n&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(n);return this.newEditor(t,n,i),this.editor.dispatch({effects:x$(G$)}),this.syncBreakpoints(),ae.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),t}setVisible(e){e?(this.editor.focus(),ql.tracingEnabled&&this.startTracing()):this.stopTracing()}getShortcuts(){if(!this.editor)return[];var e=this.editor,t=(n,i,s)=>({key:n,label:i,fn:()=>{s(e),e.focus()}});return[t("mod+f","Find",Qh),t("mod+g","Find Next",da),t("mod+d","Next Occurrence",wO),t("mod+z","Undo",Pl),t("mod+shift+z","Redo",Ko)]}startTracing(){!this.probe&&P.startProbing&&(this.probe=P.startProbing(),this.probe.singleFrame=!1,this.probe.clear())}stopTracing(){this.probe&&(P.stopProbing(),this.probe=null),this.editor.dispatch({effects:nu.effect.of([])})}setTracingEnabled(e){ql.tracingEnabled=e,e?this.startTracing():this.stopTracing()}newEditor(e,t,n){var i=hb[this.mode]||hb.default,s=n||i.isAsm,o=!!i.lineWrap,a=i.theme||hb.default.theme,l=i.useLineNumbers&&!hs;de.embed&&(l=!1,s=!1),this.isAsm=s;let c=i.noGutters||hs;var d;let h=Hg[this.mode];h?d=h.language:(console.warn("Unknown mode: "+this.mode),d=null),this.editor=new N({parent:e,doc:t,extensions:[this.indentUnitCompartment.of(this.indentUnitFor(t)),s?Xm.of((u,f)=>{let m=u.state.doc.lineAt(f).number;if(m>=0){let g=u.state.doc.line(m);if(g.text.trim())return u.lineIndent(g.from)}return 0}):[],...s?[Sr.of(Cw(()=>ra().tabsToSpaces))]:[],i.lineBased?Sr.of(kw):[],...Lw(ra()),Sr.of(z5),l?Ad():[],Nx(),Sr.of(qx),hx(),vv(),Me.allowMultipleSelections.of(!0),$d(),ax(),Ox(),Td(),_d(),Qd(),Av(),$h(),PO({top:!0}),Sr.of(j$),d||[],a,Jg,o?N.lineWrapping:[],Ul.field,c?[]:[Hh.field,Hh.gutter],s&&!c?[Nl.field,Nl.gutter,Kh.field,Kh.gutter]:[],Jh.field,I$.gutter,N.updateListener.of(u=>{for(let f of u.transactions.flatMap(m=>m.effects))if(f.is(Jh.requestToggle)&&Yt.toggleSourceLine(this.path,f.value),f.is(Oa.runToLine)){let m=f.value;if(this.sourcefile&&this.sourcefile.line2offset){let g=this.sourcefile.line2offset.get(m);g>=0&&Hl([g])}}}),lo.field,V$.field,tu.field,Oa.fiel
Line truncated
|
|
|
|
|
`).length-1;this.editor.dispatch({changes:{from:i,insert:e}}),this.highlightLines(n-1,n+s-2)}highlightLines(e,t){let n=this.editor.state.doc.line(e+1);this.editor.dispatch({effects:[ru.effect.of({start:e+1,end:t+1}),N.scrollIntoView(n.from,{y:"start",yMargin:100})]})}navigateToLine(e){if(e<1||e>this.editor.state.doc.lines)return;let t=this.editor.state.doc.line(e);this.editor.dispatch({selection:{anchor:t.from},effects:[ru.effect.of({start:e,end:e}),N.scrollIntoView(t.from,{y:"center"})]}),this.editor.focus()}getValue(){return this.editor.state.doc.toString()}getSelectionText(){return pb(this.editor)}getPath(){return this.path}markErrors(e){this.clearErrors(),e=e.slice(0,W5);let t=new Map,n=[];for(var i of e)if(!i.path||this.path.endsWith(i.path)){var s=this.editor.state.doc.lines,o=i.line;(isNaN(o)||o<1||o>s)&&(o=1),t.set(o,i.msg),i.start!=null&&i.end!=null&&i.end>i.start&&n.push({line:o,start:i.start,end:i.end})}this.editor.dispatch({effects:[lo.set.of(t),tu.effect.of(n.length>0?n:null)]})}clearErrors(){this.dirtylisting=!0,this.editor.dispatch({effects:[lo.set.of(new Map),lo.showMessage.of(null),tu.effect.of(null)]})}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors();var e=this.sourcefile.lines||[];let t=new Map,n=new Map,i=new Map;for(var s of e)if(s.offset>=0&&t.set(s.line,Ce(s.offset&65535,4)),s.insns){var o=s.insns.length>9?"...":s.insns;if(n.set(s.line,o),s.iscode){if(s.cycles)i.set(s.line,s.cycles+"");else if(P.getOpcodeMetadata){var a=parseInt(s.insns.split(" ")[0],16),l=P.getOpcodeMetadata(a,s.offset);if(l&&l.minCycles){var c=l.minCycles+"";i.set(s.line,c)}}}}this.editor.dispatch({effects:[Hh.set.of(t),Nl.set.of(n),Kh.set.of(i)]})}setTimingResult(e){if(this.sourcefile!=null){var t=new Map;for(let[o,a]of this.sourcefile.line2offset){let l=e.pc2clockrange[a];var n=l&&l.minclocks,i=l&&l.maxclocks;if(n>=0&&i>=0){var s;i==n?s=n+"":s=n+"-"+i,i==e.MAX_CLOCKS&&(s+="+"),t.set(o,s)}}this.editor.dispatch({effects:[Nl.set.of(t)]})}}setCurrentLine(e,t){var n=i=>{this.editor.dispatch({effects:[Oa.set.of(i.line),Ul.effect.of(i.line),...t?[N.scrollIntoView(this.editor.state.doc.line(i.line).from,{y:"center"})]:[]]})};if(this.clearCurrentLine(t),e){if(e.line<1||e.line>this.editor.state.doc.lines)return;if(n(e),t){let s=this.editor.state.doc.line(e.line).from+(e.start||0);this.editor.dispatch({selection:{anchor:s,head:s},effects:N.scrollIntoView(s,{y:"center"})})}this.currentDebugLine=e}}clearCurrentLine(e){if(this.currentDebugLine){if(e){let t=this.editor.state.selection.main.head;this.editor.dispatch({selection:{anchor:t,head:t}})}this.currentDebugLine=null}this.editor.dispatch({effects:[Oa.set.of(null),Ul.effect.of(null)]})}getActiveLine(){if(this.sourcefile){var e=Jt&&Jt.c;if(!e&&P.getCPUState&&!P.isRunning()&&(e=P.getCPUState()),e){var t=e&&(e.EPC||e.PC),n=this.sourcefile.findLineForOffset(t,ga);return n}}}refreshDebugState(e){var t=this.getActiveLine();!e&&(t===this.currentDebugLine||!t&&!this.currentDebugLine)||this.setCurrentLine(t,e)}refreshListing(){var e=ae.getListingForFile(this.path);e&&e.sourcefile&&e.sourcefile!==this.sourcefile&&(this.sourcefile=e.sourcefile,this.dirtylisting=!0),!(!this.sourcefile||!this.dirtylisting)&&(this.updateListing(),this.dirtylisting=!1)}refresh(e){this.refreshListing(),this.refreshDebugState(e)}tick(){this.refreshDebugState(!1),this.updateTracedLines()}updateTracedLines(){let e=this.probe;if(!e||!e.idx||!this.sourcefile)return;let t=new Set;for(let n=0;n<e.idx;n++){let i=e.buf[n];if((i&4278190080)===16777216){let s=this.sourcefile.findLineForOffset(i&65535,ga);s&&t.add(s.line)}}e.clear(),this.editor.dispatch({effects:nu.effect.of(Array.from(t))})}getLine(e){return this.editor.state.doc.line(e).text}getCurrentLine(){let e=this.editor.state.selection.main.head;return this.editor.state.doc.lineAt(e).number}getCursorPC(){for(var e=this.getCurrentLine();this.sourcefile&&e>=0;){var t=this.sourcefile.line2offset.get(e);if(t>=0)return t;e--}return-1}undoStep(){Pl(this.editor)}redoStep(){Ko(this.editor)}syncBreakpoints(){let e=Yt.getSourceBreakpointsForFile(this.path).map(t=>({line:t.line,enabled:t.enabled}));this.editor.dispatch({effects:Jh.setAll.of(e)})}};ql.tracingEnabled=!1;var Pr=ql,ub=1024,Mi=class{getSelectionText(){return pb(this.disasmview)}createDiv(e){var t=document.createElement("div");return t.setAttribute("class","editor"),e.appendChild(t),this.newEditor(t),t}newEditor(e){this.disasmview=new N({parent:e,extensions:[Td(),_d(),Me.allowMultipleSelections.of(!0),$d(),Qd(),$h(),f$,Bh,Ul.field,Me.tabSize.of(8),Me.readOnly.of(!0)]})}refresh(e,t){let n=Jt||P.saveState(),i=t!==void 0?t:n.c?n.c.PC:0,s=0,o=0,a=P.debugSymbols&&P.debugSymbols.addr2symbol||{},l=(h,u)=>{let f="",m=0;for(;m<u;){let g=h+m|0,v=P.disassemble(g,P.readAddress.bind(P)),k="",L="";for(let w=0;w<v.nbytes;w++)k+=Ce(P.readAddress(g+w));for(;k.length<14;)k+=" ";let M=v.line;if(a&&v.isaddr&&(M=M.replace(/([^#])[$]([0-9A-F]+)/,(w,...x)=>{let R=parseInt(x[1],16),X=a[R];return X?x[0]+X:(X=a
Line truncated
|
|
|
|
|
`;f+=D,g==i&&(o=s),s++,m+=v.nbytes||1}return f};var c=i<0?i-ub:Math.max(0,i-ub);let d=l(c,i-c)+l(i,ub);if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:d}}),e){let h=this.disasmview.state.doc.line(o+1);this.disasmview.dispatch({selection:{anchor:h.from,head:h.from},effects:N.scrollIntoView(h.from,{y:"center"})})}}goToAddress(e){e|=0,this.findAndSelectAddress(e)||(this.refresh(!1,e),this.findAndSelectAddress(e)),this.disasmview.focus()}findAndSelectAddress(e){let t=Ce(e,4),n=this.disasmview.state.doc;for(let i=1;i<=n.lines;i++){let s=n.line(i);if(s.text.startsWith(t+" "))return this.disasmview.dispatch({selection:{anchor:s.from,head:s.from+t.length},effects:N.scrollIntoView(s.from,{y:"center"})}),!0}return!1}getCursorPC(){let e=this.disasmview.state.selection.main.head,t=this.disasmview.state.doc.lineAt(e).number;if(t>=0){let i=this.disasmview.state.doc.line(t).text.trim().split(/\s+/);if(i&&i.length>=1){let s=parseInt(i[0],16);if(console.log("getCursorPC",s),s>=0)return s}}return-1}},iu=class extends Mi{constructor(e){super(),this.path=e}refreshListing(){var e=ae.getListingForFile(this.path);this.assemblyfile=e&&(e.assemblyfile||e.sourcefile)}refresh(e){if(this.refreshListing(),!!this.assemblyfile){var t=this.assemblyfile.text;if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:t}}),!!P.saveState){var n=Jt||P.saveState(),i=n.c?n.c.EPC||n.c.PC:0;if(i>=0&&this.assemblyfile){var s=this.assemblyfile.findLineForOffset(i,ga);if(s&&e){let o=this.disasmview.state.doc.line(s.line);this.disasmview.dispatch({selection:{anchor:o.from,head:o.from},effects:N.scrollIntoView(o.from,{y:"center"})})}}}}}goToAddress(e){this.refreshListing();let t=this.assemblyfile&&this.assemblyfile.findLineForOffset(e,ga);if(t){let n=this.disasmview.state.doc.line(t.line);this.disasmview.dispatch({selection:{anchor:n.from,head:n.from},effects:N.scrollIntoView(n.from,{y:"center"})})}this.disasmview.focus()}};function K$(r){let e=[r];try{var t=La(ae.mainPath);t.length>0&&t!="local"&&e.push(t+"/"+r)}catch(s){}for(var n of e){var i=ae&&ae.getFile(n);if(typeof i=="string")return n}return null}function F$(r){for(var e of ty(r))if(e.editorStyle){var t=u$(e.editorStyle);if(t)return t}return null}var fb=new Map;function B5(r){let e=ae.getToolForFilename(ae.mainPath),t=Cc(e,ae.platform_id),n=Ac(e,ae.platform_id);if(!t||!n.length)return Promise.resolve(null);let i=t+":"+r;return fb.has(i)||fb.set(i,(async()=>{var s=[...n.map(d=>d+"/"+r),r];for(var o of s){var a={preload_fs:t,readshared:o,updates:[],buildsteps:[]},l=await ae.queryWorker(a),c=l&&l.output;if(c instanceof Uint8Array&&c.length>0)return new TextDecoder().decode(c)}return null})()),fb.get(i)}var us=class{constructor(e){this.fn=e;this.languageCompartment=new Bt}getSelectionText(){return pb(this.view)}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var n=F$(this.fn||this.currentPath||"")||Kg();return this.view=new N({parent:t,extensions:[Td(),_d(),Me.allowMultipleSelections.of(!0),$d(),Qd(),$h(),PO({top:!0}),Sr.of(j$),this.languageCompartment.of(n),Vh,Jg,Me.readOnly.of(!0)]}),this.refresh(!1),t}setVisible(e){e&&this.refresh(!1)}setHeaderText(e){var t=F$(this.currentPath||this.fn||"")||Kg();this.view.dispatch({effects:this.languageCompartment.reconfigure(t),changes:{from:0,to:this.view.state.doc.length,insert:e}})}refresh(e){var t=this.fn;if(!t){var n=window.location.hash;if(!n||!n.startsWith("#headerview/"))return;t=this.fn=decodeURIComponent(n.substring(12))}this.loadIncludeFile(t)}async loadIncludeFile(e){this.requestedFn=e;var t=K$(e);if(t){this.currentPath=t,this.setHeaderText(ae.getFile(t));return}var n=await B5(e);if(this.requestedFn===e){if(n!=null){this.currentPath=e,this.setHeaderText(n);return}this.currentPath=e,this.setHeaderText("// "+e+` was not found.
|
|
|
|
|
// Project include files are loaded during a build -- try building first.
|
|
|
|
|
// Toolchain headers are only available when the tool has a bundled filesystem.`)}}navigateToLine(e){if(!(!this.view||e<1)&&e<=this.view.state.doc.lines){let t=this.view.state.doc.line(e);this.view.dispatch({selection:{anchor:t.from},effects:[N.scrollIntoView(t.from,{y:"center"})]}),this.view.focus()}}};var co=class{constructor(e){var t=document.createElement("div");t.setAttribute("class","memdump"),e.appendChild(t),this.maindiv=t}create(e,t,n){this.getLineAt=n,this.memorylist=new zr({w:$(e).width(),h:$(e).height(),itemHeight:pb(),totalRows:t,generatorFn:i=>{var s=n(i),o=document.createElement("div");return o.appendChild(document.createTextNode(s.text)),s.clas!=null&&(o.className=s.clas),o}}),$(this.maindiv).append(this.memorylist.container)}refresh(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var n=t,i=parseInt(n.getAttribute("data-index")),s=n.innerText,o=this.getLineAt(i),a=o.text;if(s!=a&&(n.innerText=a,o.clas!=null&&!n.classList.contains(o.clas))){var l=Array.from(n.classList);l.forEach(c=>n.classList.remove(c)),n.classList.add("vrow"),n.classList.add(o.clas)}})}};function pb(){return $("#dropdownMenuButton").first().height()}function D5(r){return r.start+Math.max(1,r.size||0)}function I5(r,e){r.sort((s,o)=>s.start-o.start||o.end-s.end);let t=[],n=[],i=[];for(let s of r){let o=t.findIndex(a=>a<=s.start);if(o<0&&t.length<e&&(o=t.length),o<0){let a=n[e-1];(a.hidden=a.hidden||[]).push(s);continue}t[o]=s.end,n[o]=s,s.lane=o,i.push(s)}return i}function mb(r,e,t,n){t=I5(t,n);let i=Math.max(1,...t.map(s=>s.lane+1));return{id:r,title:e,lanes:i,blocks:t}}function q$(r,e,t,n){let i=r.slice().sort((a,l)=>a.start-l.start),s=[],o=e;for(let a of i)a.start>o&&s.push({name:t,start:o,end:a.start,type:n,lane:0}),o=Math.max(o,a.end);return r.concat(s)}function G$(r){return{name:r.name,start:r.start,end:D5(r),type:r.type,lane:0}}function Z5(r){return r.startsWith("__")||/^[sl]__/.test(r)||r.startsWith(".")}function X5(r,e,t,n){var h,u;let i=(h=t==null?void 0:t.minVarSize)!=null?h:128,s=(u=t==null?void 0:t.maxVars)!=null?u:64,o=e.filter(f=>f.type=="ram"&&f.size>0);if(!r||!o.length)return[];let a=f=>n==null?void 0:n[f],l=new Map;for(let[f,m]of Object.entries(r)){if(typeof m!="number"||Z5(f))continue;let g=l.get(m);(g==null||!a(g)&&a(f))&&l.set(m,f)}let c=Array.from(l.keys()).sort((f,m)=>f-m),d=[];for(let f=0;f<c.length;f++){let m=c[f],g=null;for(let w of o)m>=w.start&&m<w.start+w.size&&(!g||w.size<g.size)&&(g=w);if(!g)continue;let v=l.get(m),k=a(v);if(k!=null){k>=i&&d.push({name:v,start:m,end:m+k,type:"var",lane:0});continue}let L=g.start+g.size,M=f+1<c.length?c[f+1]:1/0;if(M>=L&&g.source!="linker")continue;let D=Math.min(M,L);D-m>=i&&d.push({name:v,start:m,end:D,type:"var",lane:0,approx:!0})}return d.sort((f,m)=>m.end-m.start-(f.end-f.start)),d.slice(0,s)}function H$(r,e,t,n){var h;r=r||[];let i=(h=t==null?void 0:t.maxLanes)!=null?h:2,s=[],o=r.filter(u=>u.source=="native").map(G$),a=r.filter(u=>u.source!="native").map(G$);if(o.length&&s.push(mb("native","System",q$(o,0,"","unmapped"),i)),a.length){let u=Math.min(...a.map(f=>f.start));s.push(mb("linker","Segments",q$(a,u,"","free"),i))}let l=X5(e,r,t,n);l.length&&s.push(mb("vars","Objects",l,i));let c=new Set;for(let u of s)for(let f of u.blocks)c.add(f.start),c.add(f.end);return{bounds:Array.from(c).sort((u,f)=>u-f),columns:s}}function K$(r){return r.endsWith("_SIZE__")||r.endsWith("_LAST__")||r.endsWith("STACKSIZE__")||r.endsWith("FILEOFFS__")||r.startsWith("l__")||r.startsWith("s__")||r.startsWith(".__.")}var fs=class{constructor(){this.recreateOnResize=!0;this.hibits=0;this.totalRows=5120;this.gotoRow=-1}createDiv(e){var t=document.createElement("div");return t.setAttribute("class","memdump"),e.appendChild(t),this.showMemoryWindow(e,t),this.maindiv=t}showMemoryWindow(e,t){this.memorylist=new zr({w:$(e).width(),h:$(e).height(),itemHeight:pb(),totalRows:this.totalRows,generatorFn:i=>{var s=this.getMemoryLineAt(i),o=document.createElement("div");if(this.dumplines){var a=this.dumplines[i];a&&o.classList.add("seg_"+this.getMemorySegment(this.dumplines[i].a|this.hibits))}return i==this.gotoRow&&o.classList.add("goto_line"),o.appendChild(document.createTextNode(s)),o}}),$(t).append(this.memorylist.container),this.tick();let n=Ql();n&&this.dumplines&&this.scrollToAddress(n.data_start)}scrollToAddress(e){this.dumplines&&(this.hibits=e&4294901760,this.memorylist.scrollToItem(this.findMemoryWindowLine(e&65535)))}goToAddress(e){this.hibits=e&4294901760;var t=this.getDumpLines(),n;if(t&&t.length?n=this.findMemoryWindowLine(e&65535):n=(e&65535)>>4,n!==void 0){if(this.gotoRow=n,this.memorylist){var i=this.memorylist.container,s=n*this.memorylist.itemHeight-(i.clientHeight-this.memorylist.itemHeight)/2;i.scrollTop=Math.max(0,s)}this.tick()}}refresh(){this.dumplines=null,this.tick()}tick(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var n=$(t),i=parseInt(n.attr("data-index")),s=n.text(),o=this.getMemoryLineAt(i);s!=o&&n.text(o),n.toggleCla
Line truncated
|
|
|
|
|
`)),e.type&&s.addClass("segment-"+e.type);var l=t.lanes-e.lane;for(var c of t.blocks)c.lane>e.lane&&c.start<e.end&&c.end>e.start&&(l=Math.min(l,c.lane-e.lane));s.css("grid-row",`${i.indexOf(e.start)+2} / ${i.indexOf(e.end)+2}`),s.css("grid-column",`${n+e.lane} / span ${l}`),s.click(()=>{var d=F.createOrShow("#memory");d.scrollToAddress(e.start)}),this.maindiv.append(s)}refresh(){var h,u;this.maindiv.empty();var e=H$(ae.segments,(h=P.debugSymbols)==null?void 0:h.symbolmap,null,(u=P.debugSymbols)==null?void 0:u.symbolsizes),t=e.bounds;if(t.length){var n=["5em"],i=2,s=$('<div class="memmap-header" style="grid-row:1;grid-column:1"/>').text("Address");this.maindiv.append(s);for(var o of e.columns){for(var a=0;a<o.lanes;a++)n.push("minmax(0,1fr)");$('<div class="memmap-header"/>').text(o.title).css("grid-row","1").css("grid-column",`${i} / span ${o.lanes}`).appendTo(this.maindiv);for(var l of o.blocks)this.addBlock(l,o,i,t);i+=o.lanes}for(var c=["auto"],a=0;a+1<t.length;a++){var d=t[a+1]-t[a];c.push(Math.max(3,Math.log(d+1))*.5+"em"),$('<div class="segment-offset"/>').text("$"+Ce(t[a],4)).css("grid-row",`${a+2}`).css("grid-column","1").appendTo(this.maindiv)}this.maindiv.css("grid-template-columns",n.join(" ")),this.maindiv.css("grid-template-rows",c.join(" "))}}},Vn=4278190080,ps=class{constructor(){this.cumulativeData=!1;var e=160,t=262;try{e=Math.ceil(P.machine.cpuCyclesPerLine)||e,t=Math.ceil(P.machine.numTotalScanlines)||t}catch(n){}this.cyclesPerLine=e,this.totalScanlines=t}addr2symbol(e){var t=P.debugSymbols&&P.debugSymbols.addr2symbol||{};return t[e]}addr2str(e){var t=this.addr2symbol(e);return typeof t=="string"?"$"+Ce(e)+" ("+t+")":"$"+Ce(e)}showTooltip(e){e?(this.tooldiv||(this.tooldiv=document.createElement("div"),this.tooldiv.setAttribute("class","tooltiptrack"),document.body.appendChild(this.tooldiv)),$(this.tooldiv).text(e).show()):$(this.tooldiv).hide()}setVisible(e){e?(this.probe=P.startProbing(),this.probe.singleFrame=!this.cumulativeData,this.tick()):(this.probe&&(this.probe.singleFrame=!0),P.stopProbing(),this.probe=null)}redraw(e){var t=this.probe;if(!(!t||!t.idx)){var n=0,i=0,s=0;this.sp=0;for(var o=0;o<t.idx;o++){var a=t.buf[o],l=a&65535,c=a>>16&255,d=a&Vn;switch(d){case 2113929216:n++,i=0;break;case 2130706432:n=0,i=0;break;case 0:i+=l,s+=l;break;case 167772160:case 184549376:this.sp=l;default:e(d,l,i,n,s,c);break}}}}opToString(e,t,n){var i="";switch(e){case 16777216:i="Exec";break;case 301989888:i="Read";break;case 318767104:i="Write";break;case 335544320:i="IO Read";break;case 352321536:i="IO Write";break;case 369098752:i="VRAM Read";break;case 385875968:i="VRAM Write";break;case 402653184:i="DMA Read";break;case 419430400:i="DMA Write";break;case 134217728:i="Interrupt";break;case 150994944:i="Error";break;case 520093696:i="Wait";break;case 167772160:i="Stack Push";break;case 184549376:i="Stack Pop";break;default:return""}return typeof t=="number"&&(i+=" "+this.addr2str(t)),e&268435456&&typeof n=="number"&&(i+=" = $"+Ce(n,2)),i}getOpRGB(e,t){switch(e){case 16777216:return 98305;case 301989888:return 8388865;case 318767104:return 65920;case 335544320:return 98432;case 352321536:return 12583296;case 402653184:case 369098752:return 8421377;case 419430400:case 385875968:return 4227264;case 134217728:return 4177727;case 150994944:return 4145151;case 520093696:return 16727871;default:return 0}}},Ob=class extends ps{constructor(){super(...arguments);this.recreateOnResize=!0}createCanvas(t,n,i){var s=document.createElement("div"),o=document.createElement("canvas");return o.width=n,o.height=i,o.classList.add("pixelated"),o.style.width="100%",o.style.height="90vh",o.style.backgroundColor="black",o.style.cursor="crosshair",o.onmousemove=a=>{var l=yc(o,a);this.showTooltip(this.getTooltipText(l.x,l.y)),$(this.tooldiv).css("left",a.pageX+10).css("top",a.pageY-30)},o.onmouseout=a=>{$(this.tooldiv).hide()},t.appendChild(s),s.appendChild(o),this.canvas=o,this.ctx=o.getContext("2d"),this.initCanvas(),this.maindiv=s}initCanvas(){}getTooltipText(t,n){return null}getOpAtPos(t,n,i){t=t|0,n=n|0;let s=0;return this.redraw((o,a,l,c,d,h)=>{!s&&c==n&&l>=t&&(o&i)!=0&&(s=o|a)}),s}clear(){}tick(){this.clear(),this.redraw(this.drawEvent.bind(this))}},ou=class extends Ob{constructor(){super(...arguments);this.recreateOnResize=!1}createDiv(t){return this.createCanvas(t,this.cyclesPerLine,this.totalScanlines)}initCanvas(){this.imageData=this.ctx.createImageData(this.canvas.width,this.canvas.height),this.datau32=new Uint32Array(this.imageData.data.buffer)}getTooltipText(t,n){t=t|0,n=n|0;var i="",s=null,o=[],a=-1;return this.redraw((l,c,d,h,u,f)=>{switch(l){case 16777216:s=this.addr2symbol(c)||s;break;case 167772160:o.push(s);break;case 184549376:s=o.pop();break}h==n&&d<=t&&(d!=a&&(i="",a=d),i==""&&s&&(i+=`
|
|
|
|
|
// Toolchain headers are only available when the tool has a bundled filesystem.`)}}navigateToLine(e){if(!(!this.view||e<1)&&e<=this.view.state.doc.lines){let t=this.view.state.doc.line(e);this.view.dispatch({selection:{anchor:t.from},effects:[N.scrollIntoView(t.from,{y:"center"})]}),this.view.focus()}}};var co=class{constructor(e){var t=document.createElement("div");t.setAttribute("class","memdump"),e.appendChild(t),this.maindiv=t}create(e,t,n){this.getLineAt=n,this.memorylist=new Wr({w:$(e).width(),h:$(e).height(),itemHeight:mb(),totalRows:t,generatorFn:i=>{var s=n(i),o=document.createElement("div");return o.appendChild(document.createTextNode(s.text)),s.clas!=null&&(o.className=s.clas),o}}),$(this.maindiv).append(this.memorylist.container)}refresh(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var n=t,i=parseInt(n.getAttribute("data-index")),s=n.innerText,o=this.getLineAt(i),a=o.text;if(s!=a&&(n.innerText=a,o.clas!=null&&!n.classList.contains(o.clas))){var l=Array.from(n.classList);l.forEach(c=>n.classList.remove(c)),n.classList.add("vrow"),n.classList.add(o.clas)}})}};function mb(){return $("#dropdownMenuButton").first().height()}function V5(r){return r.start+Math.max(1,r.size||0)}function Y5(r,e){r.sort((s,o)=>s.start-o.start||o.end-s.end);let t=[],n=[],i=[];for(let s of r){let o=t.findIndex(a=>a<=s.start);if(o<0&&t.length<e&&(o=t.length),o<0){let a=n[e-1];(a.hidden=a.hidden||[]).push(s);continue}t[o]=s.end,n[o]=s,s.lane=o,i.push(s)}return i}function Ob(r,e,t,n){t=Y5(t,n);let i=Math.max(1,...t.map(s=>s.lane+1));return{id:r,title:e,lanes:i,blocks:t}}function J$(r,e,t,n){let i=r.slice().sort((a,l)=>a.start-l.start),s=[],o=e;for(let a of i)a.start>o&&s.push({name:t,start:o,end:a.start,type:n,lane:0}),o=Math.max(o,a.end);return r.concat(s)}function eQ(r){return{name:r.name,start:r.start,end:V5(r),type:r.type,lane:0}}function F5(r){return r.startsWith("__")||/^[sl]__/.test(r)||r.startsWith(".")}function N5(r,e,t,n){var h,u;let i=(h=t==null?void 0:t.minVarSize)!=null?h:128,s=(u=t==null?void 0:t.maxVars)!=null?u:64,o=e.filter(f=>f.type=="ram"&&f.size>0);if(!r||!o.length)return[];let a=f=>n==null?void 0:n[f],l=new Map;for(let[f,m]of Object.entries(r)){if(typeof m!="number"||F5(f))continue;let g=l.get(m);(g==null||!a(g)&&a(f))&&l.set(m,f)}let c=Array.from(l.keys()).sort((f,m)=>f-m),d=[];for(let f=0;f<c.length;f++){let m=c[f],g=null;for(let w of o)m>=w.start&&m<w.start+w.size&&(!g||w.size<g.size)&&(g=w);if(!g)continue;let v=l.get(m),k=a(v);if(k!=null){k>=i&&d.push({name:v,start:m,end:m+k,type:"var",lane:0});continue}let L=g.start+g.size,M=f+1<c.length?c[f+1]:1/0;if(M>=L&&g.source!="linker")continue;let D=Math.min(M,L);D-m>=i&&d.push({name:v,start:m,end:D,type:"var",lane:0,approx:!0})}return d.sort((f,m)=>m.end-m.start-(f.end-f.start)),d.slice(0,s)}function tQ(r,e,t,n){var h;r=r||[];let i=(h=t==null?void 0:t.maxLanes)!=null?h:2,s=[],o=r.filter(u=>u.source=="native").map(eQ),a=r.filter(u=>u.source!="native").map(eQ);if(o.length&&s.push(Ob("native","System",J$(o,0,"","unmapped"),i)),a.length){let u=Math.min(...a.map(f=>f.start));s.push(Ob("linker","Segments",J$(a,u,"","free"),i))}let l=N5(e,r,t,n);l.length&&s.push(Ob("vars","Objects",l,i));let c=new Set;for(let u of s)for(let f of u.blocks)c.add(f.start),c.add(f.end);return{bounds:Array.from(c).sort((u,f)=>u-f),columns:s}}function rQ(r){return r.endsWith("_SIZE__")||r.endsWith("_LAST__")||r.endsWith("STACKSIZE__")||r.endsWith("FILEOFFS__")||r.startsWith("l__")||r.startsWith("s__")||r.startsWith(".__.")}var fs=class{constructor(){this.recreateOnResize=!0;this.hibits=0;this.totalRows=5120;this.gotoRow=-1}createDiv(e){var t=document.createElement("div");return t.setAttribute("class","memdump"),e.appendChild(t),this.showMemoryWindow(e,t),this.maindiv=t}showMemoryWindow(e,t){this.memorylist=new Wr({w:$(e).width(),h:$(e).height(),itemHeight:mb(),totalRows:this.totalRows,generatorFn:i=>{var s=this.getMemoryLineAt(i),o=document.createElement("div");if(this.dumplines){var a=this.dumplines[i];a&&o.classList.add("seg_"+this.getMemorySegment(this.dumplines[i].a|this.hibits))}return i==this.gotoRow&&o.classList.add("goto_line"),o.appendChild(document.createTextNode(s)),o}}),$(t).append(this.memorylist.container),this.tick();let n=Tl();n&&this.dumplines&&this.scrollToAddress(n.data_start)}scrollToAddress(e){this.dumplines&&(this.hibits=e&4294901760,this.memorylist.scrollToItem(this.findMemoryWindowLine(e&65535)))}goToAddress(e){this.hibits=e&4294901760;var t=this.getDumpLines(),n;if(t&&t.length?n=this.findMemoryWindowLine(e&65535):n=(e&65535)>>4,n!==void 0){if(this.gotoRow=n,this.memorylist){var i=this.memorylist.container,s=n*this.memorylist.itemHeight-(i.clientHeight-this.memorylist.itemHeight)/2;i.scrollTop=Math.max(0,s)}this.tick()}}refresh(){this.dumplines=null,this.tick()}tick(){this.memorylist&&$(this.maindiv).find("[data-index]").each((e,t)=>{var n=$(t),i=parseInt(n.attr("data-index")),s=n.text(),o=this.getMemoryLineAt(i);s!=o&&n.text(o),n.toggleCla
Line truncated
|
|
|
|
|
`)),e.type&&s.addClass("segment-"+e.type);var l=t.lanes-e.lane;for(var c of t.blocks)c.lane>e.lane&&c.start<e.end&&c.end>e.start&&(l=Math.min(l,c.lane-e.lane));s.css("grid-row",`${i.indexOf(e.start)+2} / ${i.indexOf(e.end)+2}`),s.css("grid-column",`${n+e.lane} / span ${l}`),s.click(()=>{var d=F.createOrShow("#memory");d.scrollToAddress(e.start)}),this.maindiv.append(s)}refresh(){var h,u;this.maindiv.empty();var e=tQ(ae.segments,(h=P.debugSymbols)==null?void 0:h.symbolmap,null,(u=P.debugSymbols)==null?void 0:u.symbolsizes),t=e.bounds;if(t.length){var n=["5em"],i=2,s=$('<div class="memmap-header" style="grid-row:1;grid-column:1"/>').text("Address");this.maindiv.append(s);for(var o of e.columns){for(var a=0;a<o.lanes;a++)n.push("minmax(0,1fr)");$('<div class="memmap-header"/>').text(o.title).css("grid-row","1").css("grid-column",`${i} / span ${o.lanes}`).appendTo(this.maindiv);for(var l of o.blocks)this.addBlock(l,o,i,t);i+=o.lanes}for(var c=["auto"],a=0;a+1<t.length;a++){var d=t[a+1]-t[a];c.push(Math.max(3,Math.log(d+1))*.5+"em"),$('<div class="segment-offset"/>').text("$"+Ce(t[a],4)).css("grid-row",`${a+2}`).css("grid-column","1").appendTo(this.maindiv)}this.maindiv.css("grid-template-columns",n.join(" ")),this.maindiv.css("grid-template-rows",c.join(" "))}}},Vn=4278190080,ps=class{constructor(){this.cumulativeData=!1;var e=160,t=262;try{e=Math.ceil(P.machine.cpuCyclesPerLine)||e,t=Math.ceil(P.machine.numTotalScanlines)||t}catch(n){}this.cyclesPerLine=e,this.totalScanlines=t}addr2symbol(e){var t=P.debugSymbols&&P.debugSymbols.addr2symbol||{};return t[e]}addr2str(e){var t=this.addr2symbol(e);return typeof t=="string"?"$"+Ce(e)+" ("+t+")":"$"+Ce(e)}showTooltip(e){e?(this.tooldiv||(this.tooldiv=document.createElement("div"),this.tooldiv.setAttribute("class","tooltiptrack"),document.body.appendChild(this.tooldiv)),$(this.tooldiv).text(e).show()):$(this.tooldiv).hide()}setVisible(e){e?(this.probe=P.startProbing(),this.probe.singleFrame=!this.cumulativeData,this.tick()):(this.probe&&(this.probe.singleFrame=!0),P.stopProbing(),this.probe=null)}redraw(e){var t=this.probe;if(!(!t||!t.idx)){var n=0,i=0,s=0;this.sp=0;for(var o=0;o<t.idx;o++){var a=t.buf[o],l=a&65535,c=a>>16&255,d=a&Vn;switch(d){case 2113929216:n++,i=0;break;case 2130706432:n=0,i=0;break;case 0:i+=l,s+=l;break;case 167772160:case 184549376:this.sp=l;default:e(d,l,i,n,s,c);break}}}}opToString(e,t,n){var i="";switch(e){case 16777216:i="Exec";break;case 301989888:i="Read";break;case 318767104:i="Write";break;case 335544320:i="IO Read";break;case 352321536:i="IO Write";break;case 369098752:i="VRAM Read";break;case 385875968:i="VRAM Write";break;case 402653184:i="DMA Read";break;case 419430400:i="DMA Write";break;case 134217728:i="Interrupt";break;case 150994944:i="Error";break;case 520093696:i="Wait";break;case 167772160:i="Stack Push";break;case 184549376:i="Stack Pop";break;default:return""}return typeof t=="number"&&(i+=" "+this.addr2str(t)),e&268435456&&typeof n=="number"&&(i+=" = $"+Ce(n,2)),i}getOpRGB(e,t){switch(e){case 16777216:return 98305;case 301989888:return 8388865;case 318767104:return 65920;case 335544320:return 98432;case 352321536:return 12583296;case 402653184:case 369098752:return 8421377;case 419430400:case 385875968:return 4227264;case 134217728:return 4177727;case 150994944:return 4145151;case 520093696:return 16727871;default:return 0}}},gb=class extends ps{constructor(){super(...arguments);this.recreateOnResize=!0}createCanvas(t,n,i){var s=document.createElement("div"),o=document.createElement("canvas");return o.width=n,o.height=i,o.classList.add("pixelated"),o.style.width="100%",o.style.height="90vh",o.style.backgroundColor="black",o.style.cursor="crosshair",o.onmousemove=a=>{var l=Sc(o,a);this.showTooltip(this.getTooltipText(l.x,l.y)),$(this.tooldiv).css("left",a.pageX+10).css("top",a.pageY-30)},o.onmouseout=a=>{$(this.tooldiv).hide()},t.appendChild(s),s.appendChild(o),this.canvas=o,this.ctx=o.getContext("2d"),this.initCanvas(),this.maindiv=s}initCanvas(){}getTooltipText(t,n){return null}getOpAtPos(t,n,i){t=t|0,n=n|0;let s=0;return this.redraw((o,a,l,c,d,h)=>{!s&&c==n&&l>=t&&(o&i)!=0&&(s=o|a)}),s}clear(){}tick(){this.clear(),this.redraw(this.drawEvent.bind(this))}},au=class extends gb{constructor(){super(...arguments);this.recreateOnResize=!1}createDiv(t){return this.createCanvas(t,this.cyclesPerLine,this.totalScanlines)}initCanvas(){this.imageData=this.ctx.createImageData(this.canvas.width,this.canvas.height),this.datau32=new Uint32Array(this.imageData.data.buffer)}getTooltipText(t,n){t=t|0,n=n|0;var i="",s=null,o=[],a=-1;return this.redraw((l,c,d,h,u,f)=>{switch(l){case 16777216:s=this.addr2symbol(c)||s;break;case 167772160:o.push(s);break;case 184549376:s=o.pop();break}h==n&&d<=t&&(d!=a&&(i="",a=d),i==""&&s&&(i+=`
|
|
|
|
|
`+s),i+=`
|
|
|
|
|
`+this.opToString(l,c,f))}),"X: "+t+" Y: "+n+" "+i}refresh(){this.tick(),this.datau32.fill(Vn)}tick(){super.tick(),this.drawImage()}drawImage(){this.ctx.putImageData(this.imageData,0,0)}clear(){this.datau32.fill(Vn)}},au=class extends ou{createDiv(e){return this.createCanvas(e,256,256)}initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=yc(this.canvas,e),n=Math.floor(t.x)+Math.floor(t.y)*256,i=-1,s=-1;this.redraw((o,a)=>{s<0&&i>=0&&a==n&&(s=i),o==16777216&&(i=a)}),s>=0&&Gl([s])}}clear(){for(var e=0;e<=65535;e++){var t=P.readAddress(e),n=t>>2|t&31;n|=n<<8|n<<16,this.datau32[e]=n|Vn}}drawEvent(e,t,n,i){var s=this.getOpRGB(e,t);if(s){var o=t&255,a=t>>8&255,l=this.datau32[t&65535];l=l|s|Vn,this.datau32[t&65535]=l}}getTooltipText(e,t){var n=(e&255)+(t<<8),i="",s=-1,o={},a=null,l=[];return this.redraw((c,d,h,u,f,m)=>{switch(c){case 16777216:s=d,a=this.addr2symbol(d)||a;break;case 167772160:l.push(a);break;case 184549376:a=l.pop();break}var g=c|s;d==n&&!o[g]&&(i==""&&a&&(i+=`
|
|
|
|
|
`+this.opToString(l,c,f))}),"X: "+t+" Y: "+n+" "+i}refresh(){this.tick(),this.datau32.fill(Vn)}tick(){super.tick(),this.drawImage()}drawImage(){this.ctx.putImageData(this.imageData,0,0)}clear(){this.datau32.fill(Vn)}},lu=class extends au{createDiv(e){return this.createCanvas(e,256,256)}initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=Sc(this.canvas,e),n=Math.floor(t.x)+Math.floor(t.y)*256,i=-1,s=-1;this.redraw((o,a)=>{s<0&&i>=0&&a==n&&(s=i),o==16777216&&(i=a)}),s>=0&&Hl([s])}}clear(){for(var e=0;e<=65535;e++){var t=P.readAddress(e),n=t>>2|t&31;n|=n<<8|n<<16,this.datau32[e]=n|Vn}}drawEvent(e,t,n,i){var s=this.getOpRGB(e,t);if(s){var o=t&255,a=t>>8&255,l=this.datau32[t&65535];l=l|s|Vn,this.datau32[t&65535]=l}}getTooltipText(e,t){var n=(e&255)+(t<<8),i="",s=-1,o={},a=null,l=[];return this.redraw((c,d,h,u,f,m)=>{switch(c){case 16777216:s=d,a=this.addr2symbol(d)||a;break;case 167772160:l.push(a);break;case 184549376:a=l.pop();break}var g=c|s;d==n&&!o[g]&&(i==""&&a&&(i+=`
|
|
|
|
|
`+a),i+=`
|
|
|
|
|
PC `+this.addr2str(s)+" "+this.opToString(c,null,m),o[g]=1)}),this.addr2str(n)+i}},gb=class extends ou{initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=yc(this.canvas,e),n=Math.floor(t.x),i=Math.floor(t.y),s=this.getOpAtPos(t.x,t.y,16777216);s&&(oi("toline"),P.runEval(()=>{let o=P.getRasterScanline&&P.getRasterScanline()>=i;return o&&P.getRasterLineClock?o&&P.getRasterLineClock()>n:o}))}}drawEvent(e,t,n,i){var s=this.getOpRGB(e,t);if(s){var o=n+i*this.canvas.width,a=s|Vn;this.datau32[o]|=a}}drawImage(){let e=Vn;for(let t=0;t<this.datau32.length;t++)this.datau32[t]==Vn?this.datau32[t]=e:e=this.datau32[t];super.drawImage()}},lu=class extends gb{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,n,i,s){var o=i+s*this.canvas.width;if(t==134217728&&(this.interrupt=1),this.interrupt==1&&t==167772160&&(this.interrupt=n),this.interrupt>1&&this.sp>this.interrupt&&(this.interrupt=0),t==318767104&&(this.rgb|=47),t==385875968&&(this.rgb|=16256),t==352321536&&(this.rgb|=2047872),t==335544320&&(this.rgb|=7936),t==520093696&&(this.rgb=32768),t==150994944||t==402653184)this.datau32[o]=4279176975;else{let a=this.rgb;if(t==16777216){let l=this.sp&15;l>=8&&(l=16-l),Math.abs(this.lastpc)-n>16&&(l+=1),Math.abs(this.lastpc)-n>256&&(l+=1),a=this.rgb=526344*l+2105376,this.lastpc=n}this.interrupt&&(a|=8388672),this.datau32[o]==Vn&&(this.datau32[o]=a|Vn)}}},cu=class extends ps{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new co(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var n="",i="seg_data",s=this.dumplines&&this.dumplines[t];if(s!=null){var o=s.info.join(", ");n="("+Gn(s.row,4)+", "+Gn(s.col,4)+") "+Ra(s.asm||"",20)+o,o.indexOf("Write ")>=0&&(i="seg_io")}return{text:n,clas:i}}refresh(){this.tick()}tick(){let t=P instanceof nf||P instanceof rf;this.dumplines={},this.redraw((n,i,s,o,a,l)=>{t&&(a>>=2);var c=this.dumplines[a];switch(c==null&&(c={op:n,addr:i,row:o,col:s,asm:null,info:[]},this.dumplines[a]=c),n){case 16777216:if(P.disassemble){var d=P.disassemble(i,P.readAddress.bind(P));c.asm=d&&d.line}break;default:var h=this.opToString(n,i,l);h!=""&&c.info.push(h);break}}),this.vlist.refresh()}},du=class extends ps{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new co(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var n=Gn(t+"",3)+" ",i="seg_code",s=this.dumplines&&this.dumplines[t]||[],o=Math.round(this.cyclesPerLine/3.3),a=0;a<this.cyclesPerLine;a++){var l=s[a];if(l!==void 0){var c=l&65535,d=d&Vn;if(d==16777216)n+=",";else{var h=Ce(c);n+=h,a+=h.length-1}}else n+=a==o?"|":"."}return s[-1]&&(n+=" "+s[-1]),{text:n,clas:i}}refresh(){this.tick()}tick(){let t=P instanceof nf||P instanceof rf;this.dumplines={},this.redraw((n,i,s,o,a,l)=>{var c=this.dumplines[o];switch(c==null&&(this.dumplines[o]=c=[]),n){case 16777216:var d=P.debugSymbols.addr2symbol[i];d&&(c[-1]=d);break;case 335544320:case 352321536:case 369098752:case 385875968:c[s]=n|i;break}}),this.vlist.refresh()}},hu=class extends ps{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return P.debugSymbols&&P.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(P.debugSymbols.symbolmap).filter(n=>!K$(n))):this.keys=["no symbols defined"],this.vlist=new co(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:Gn("Symbol",35)+Gn("Reads",8)+Gn("Writes",8)};var n=this.keys[t-1],i=this.dumplines&&this.dumplines[n];function s(l){var c=i[l]|0;return Gn(c?c.toString():"",8)}var o,a;return i!=null?(o=Gn(n,35)+s(301989888)+s(318767104),i[16777216]?a="seg_code":i[335544320]||i[352321536]?a="seg_io":a="seg_data"):(o=Gn(n,35),a="seg_unknown"),{text:o,clas:a}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,n,i,s,o,a)=>{var l=P.debugSymbols.addr2symbol[n];if(l!=null){var c=this.dumplines[l];c==null&&(c={},this.dumplines[l]=c),c[t]=(c[t]|0)+1}}),this.vlist.refresh(),this.probe&&this.probe.clear()}},uu=class{constructor(){this.editingId=null}createDiv(e){return this.maindiv=vn(e,"vertical-scroll bp-view"),this.render(),this.maindiv[0]}refresh(e){this.render()}render(){let e=this.maindiv.empty(),t=Yh(),n=this.editingId!=null?t.find(d=>d.bp.id==this.editingId):null,i=$('<div class="bp-form"/>'),s=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","address or symbol (e.g. $8000, mainloop)").val(n&&n.bp.type=="address"?n.bp.target:""),o=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","condition (e.g. A>=$20, #scanline==222)").val(n&&n.bp.condition||""),a=$('<button class="btn btn-default btn-xs bp-submit"/>').text(n?"Save":"Add"),l=$('<button class="btn btn-default btn-xs bp-submit"/>').text("Cancel");l.toggl
Line truncated
|
|
|
|
|
`)<0&&e.indexOf("\r")<0)return e.trim()}return""}function Y5(r){var t;let e=r.record;if(e.source==="project"){let n=e.file;if(!n||!F.isWindow(n))return;let i=F.createOrShow(n);i instanceof Pr&&e.line&&i.navigateToLine(e.line)}else if(e.source==="toolchain"){let n=e.file;if(!n)return;ql(n);let i=F.createOrShow("#headerview/"+n);i instanceof us&&e.line&&i.navigateToLine(e.line)}else if(e.source==="debugger"){let n=(t=e.addr)!=null?t:-1;if(n<0)return;if(e.kind==="label"&&F.isWindow("#disasm")){let i=F.createOrShow("#disasm");i instanceof Mi&&i.goToAddress(n)}else{let i=F.createOrShow("#memory");i instanceof fs&&i.goToAddress(n)}}else if(e.source==="docs"){let n=e.url||"";n.startsWith("#help/")?F.createOrShow(n):n&&window.open(n,"_blank")}}function bb(){bootbox.dialog({title:"Search",onEscape:!0,message:`
|
|
|
|
|
PC `+this.addr2str(s)+" "+this.opToString(c,null,m),o[g]=1)}),this.addr2str(n)+i}},bb=class extends au{initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=Sc(this.canvas,e),n=Math.floor(t.x),i=Math.floor(t.y),s=this.getOpAtPos(t.x,t.y,16777216);s&&(oi("toline"),P.runEval(()=>{let o=P.getRasterScanline&&P.getRasterScanline()>=i;return o&&P.getRasterLineClock?o&&P.getRasterLineClock()>n:o}))}}drawEvent(e,t,n,i){var s=this.getOpRGB(e,t);if(s){var o=n+i*this.canvas.width,a=s|Vn;this.datau32[o]|=a}}drawImage(){let e=Vn;for(let t=0;t<this.datau32.length;t++)this.datau32[t]==Vn?this.datau32[t]=e:e=this.datau32[t];super.drawImage()}},cu=class extends bb{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,n,i,s){var o=i+s*this.canvas.width;if(t==134217728&&(this.interrupt=1),this.interrupt==1&&t==167772160&&(this.interrupt=n),this.interrupt>1&&this.sp>this.interrupt&&(this.interrupt=0),t==318767104&&(this.rgb|=47),t==385875968&&(this.rgb|=16256),t==352321536&&(this.rgb|=2047872),t==335544320&&(this.rgb|=7936),t==520093696&&(this.rgb=32768),t==150994944||t==402653184)this.datau32[o]=4279176975;else{let a=this.rgb;if(t==16777216){let l=this.sp&15;l>=8&&(l=16-l),Math.abs(this.lastpc)-n>16&&(l+=1),Math.abs(this.lastpc)-n>256&&(l+=1),a=this.rgb=526344*l+2105376,this.lastpc=n}this.interrupt&&(a|=8388672),this.datau32[o]==Vn&&(this.datau32[o]=a|Vn)}}},du=class extends ps{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new co(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var n="",i="seg_data",s=this.dumplines&&this.dumplines[t];if(s!=null){var o=s.info.join(", ");n="("+Gn(s.row,4)+", "+Gn(s.col,4)+") "+Ma(s.asm||"",20)+o,o.indexOf("Write ")>=0&&(i="seg_io")}return{text:n,clas:i}}refresh(){this.tick()}tick(){let t=P instanceof sf||P instanceof nf;this.dumplines={},this.redraw((n,i,s,o,a,l)=>{t&&(a>>=2);var c=this.dumplines[a];switch(c==null&&(c={op:n,addr:i,row:o,col:s,asm:null,info:[]},this.dumplines[a]=c),n){case 16777216:if(P.disassemble){var d=P.disassemble(i,P.readAddress.bind(P));c.asm=d&&d.line}break;default:var h=this.opToString(n,i,l);h!=""&&c.info.push(h);break}}),this.vlist.refresh()}},hu=class extends ps{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new co(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var n=Gn(t+"",3)+" ",i="seg_code",s=this.dumplines&&this.dumplines[t]||[],o=Math.round(this.cyclesPerLine/3.3),a=0;a<this.cyclesPerLine;a++){var l=s[a];if(l!==void 0){var c=l&65535,d=d&Vn;if(d==16777216)n+=",";else{var h=Ce(c);n+=h,a+=h.length-1}}else n+=a==o?"|":"."}return s[-1]&&(n+=" "+s[-1]),{text:n,clas:i}}refresh(){this.tick()}tick(){let t=P instanceof sf||P instanceof nf;this.dumplines={},this.redraw((n,i,s,o,a,l)=>{var c=this.dumplines[o];switch(c==null&&(this.dumplines[o]=c=[]),n){case 16777216:var d=P.debugSymbols.addr2symbol[i];d&&(c[-1]=d);break;case 335544320:case 352321536:case 369098752:case 385875968:c[s]=n|i;break}}),this.vlist.refresh()}},uu=class extends ps{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return P.debugSymbols&&P.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(P.debugSymbols.symbolmap).filter(n=>!rQ(n))):this.keys=["no symbols defined"],this.vlist=new co(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:Gn("Symbol",35)+Gn("Reads",8)+Gn("Writes",8)};var n=this.keys[t-1],i=this.dumplines&&this.dumplines[n];function s(l){var c=i[l]|0;return Gn(c?c.toString():"",8)}var o,a;return i!=null?(o=Gn(n,35)+s(301989888)+s(318767104),i[16777216]?a="seg_code":i[335544320]||i[352321536]?a="seg_io":a="seg_data"):(o=Gn(n,35),a="seg_unknown"),{text:o,clas:a}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,n,i,s,o,a)=>{var l=P.debugSymbols.addr2symbol[n];if(l!=null){var c=this.dumplines[l];c==null&&(c={},this.dumplines[l]=c),c[t]=(c[t]|0)+1}}),this.vlist.refresh(),this.probe&&this.probe.clear()}},fu=class{constructor(){this.editingId=null}createDiv(e){return this.maindiv=xn(e,"vertical-scroll bp-view"),this.render(),this.maindiv[0]}refresh(e){this.render()}render(){let e=this.maindiv.empty(),t=Fh(),n=this.editingId!=null?t.find(d=>d.bp.id==this.editingId):null,i=$('<div class="bp-form"/>'),s=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","address or symbol (e.g. $8000, mainloop)").val(n&&n.bp.type=="address"?n.bp.target:""),o=$('<input type="text" class="bp-input" spellcheck="false"/>').attr("placeholder","condition (e.g. A>=$20, #scanline==222)").val(n&&n.bp.condition||""),a=$('<button class="btn btn-default btn-xs bp-submit"/>').text(n?"Save":"Add"),l=$('<button class="btn btn-default btn-xs bp-submit"/>').text("Cancel");l.toggl
Line truncated
|
|
|
|
|
`)<0&&e.indexOf("\r")<0)return e.trim()}return""}function H5(r){var t;let e=r.record;if(e.source==="project"){let n=e.file;if(!n||!F.isWindow(n))return;let i=F.createOrShow(n);i instanceof Pr&&e.line&&i.navigateToLine(e.line)}else if(e.source==="toolchain"){let n=e.file;if(!n)return;Gl(n);let i=F.createOrShow("#headerview/"+n);i instanceof us&&e.line&&i.navigateToLine(e.line)}else if(e.source==="debugger"){let n=(t=e.addr)!=null?t:-1;if(n<0)return;if(e.kind==="label"&&F.isWindow("#disasm")){let i=F.createOrShow("#disasm");i instanceof Mi&&i.goToAddress(n)}else{let i=F.createOrShow("#memory");i instanceof fs&&i.goToAddress(n)}}else if(e.source==="docs"){let n=e.url||"";n.startsWith("#help/")?F.createOrShow(n):n&&window.open(n,"_blank")}}function yb(){bootbox.dialog({title:"Search",onEscape:!0,message:`
|
|
|
|
|
<div id="searchbox_form">
|
|
|
|
|
<input type="text" id="searchboxInput" class="form-control"
|
|
|
|
|
placeholder="Search symbols, files, docs"
|
|
|
|
|
autocomplete="off" style="margin-bottom:8px">
|
|
|
|
|
<div id="searchboxResults" style="max-height:340px;overflow-y:auto"></div>
|
|
|
|
|
</div>
|
|
|
|
|
`,buttons:{close:{label:"Close",className:"btn-default"}}}).one("shown.bs.modal",()=>{$("#searchboxInput").trigger("focus")});let e=$("#searchboxInput"),t=$("#searchboxResults"),n=[],i=-1,s=d=>{if(i=Math.max(-1,Math.min(d,n.length-1)),t.find("li.search-hit").each((h,u)=>{$(u).toggleClass("active",h===i)}),i>=0){let h=t[0],u=t.find("li.search-hit").eq(i);if(u.length){let f=u[0],m=h.getBoundingClientRect(),g=f.getBoundingClientRect(),v=g.top-m.top;v<0?h.scrollTop+=v:v+g.height>m.height&&(h.scrollTop+=v+g.height-m.height)}}},o=(d=i)=>{let h=n[d];h&&(Y5(h),bootbox.hideAll())},a=d=>{if(n=d||[],n.length===0){i=-1,t.html('<div class="text-muted" style="padding:8px">No matches.</div>');return}let h=$('<ul class="list-group" style="margin-bottom:0"></ul>');for(let u of n){let f=u.record,m=f.source,g=f.kind==="func"?"\u0192":f.kind==="macro"?"#":f.kind==="label"?":":f.kind==="struct"?"S":f.kind==="enum"?"E":f.kind==="text"?"\u2261":"\u2022",v=f.source==="debugger"?Ce(f.addr,4):f.file&&f.line?`${f.file}:${f.line}`:f.file||"",k=f.kind!=="text",L=$('<li class="list-group-item search-hit" style="cursor:pointer;padding:6px 10px;display:flex;align-items:center;overflow:hidden"></li>');L.html(`<span class="search-kind" style="margin-right:6px;font-weight:bold;flex:0 0 auto">${g}</span><span class="search-name" style="flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`+(k?`<strong>${pu(f.name)}</strong>`:`<span class="search-dumb">${pu(f.name)}</span>`)+(f.brief?` <span class="text-muted">- ${pu(f.brief)}</span>`:"")+`</span><span class="search-loc" style="flex:0 0 auto;margin-left:8px;font-style:italic;font-size:small;white-space:nowrap">${v?pu(v):""}</span>`),L.click(()=>{o(n.indexOf(u))}),h.append(L)}t.empty().append(h),s(0)},l=W5(async()=>{let d=e.val();if(!d){n=[],i=-1,t.empty();return}try{let h=await xP.query(d,B5),u=fu(d,P&&P.debugSymbols&&P.debugSymbols.symbolmap);u&&tQ(u,h.length>0)&&h.push(eQ(d,u,ae&&ae.segments)),a(h)}catch(h){t.html('<div class="text-danger" style="padding:8px">Search failed.</div>')}},150);e.on("input",l),e.on("keydown",d=>{d.key==="ArrowDown"?(d.preventDefault(),s(i+1)):d.key==="ArrowUp"?(d.preventDefault(),s(i-1)):d.key==="Enter"?(d.preventDefault(),i>=0?o():l()):d.key==="Home"?(d.preventDefault(),s(0)):d.key==="End"&&(d.preventDefault(),s(n.length-1))});let c=V5();c&&(e.val(c),l())}var F5=800,N5=1e3,j5=16;function aQ(r){var e={};return r.forEach(t=>{e[t.name]=(e[t.name]||0)+1}),r.forEach(t=>{e[t.name]>1&&t.group&&(t.name=t.group+": "+t.name)}),r}function rQ(r){return r.art?r.brev?0:7:null}var mu=/([0#]?)([x$%]|\d'h)([0-9a-f]+)(?:[;].*)?|(\d'b|0b)([01]+)/gim;function Pb(r){return r.replace(/(\shex\s+)([0-9a-f]+)/ig,function(e,t,n){for(var i=t,s=0;s<n.length;s+=2)i+="0x"+n.substr(s,2)+",";return i})}function lQ(r){for(var e=[],t;t=mu.exec(r);){var n;t[4]?n=parseInt(t[5],2):t[2].startsWith("%")?n=parseInt(t[3],2):t[2].startsWith("x")||t[2].startsWith("$")||t[2].endsWith("h")?n=parseInt(t[3],16):n=parseInt(t[3]),e.push(n)}return e}function U5(r,e,t){r=Pb(r);for(var n="",i,s=0,o=0,a=Math.ceil(t/4);i=mu.exec(r);)n+=r.slice(s,mu.lastIndex-i[0].length),s=mu.lastIndex,i[4]?n+=i[4]+Hu(e[o++],parseInt(i[4])):i[2].startsWith("%")?n+=i[1]+i[2]+Hu(e[o++],t):i[2].endsWith("h")?n+=i[1]+i[2]+Ce(e[o++],parseInt(i[2])):i[2].startsWith("x")?n+=i[1]+"x"+Ce(e[o++],a):i[2].startsWith("$")?n+=i[1]+"$"+Ce(e[o++],a):n+=i[1]+e[o++].toString();return n+=r.slice(s),n=n.replace(/(\shex\s+)([,x0-9a-f]+)/ig,(l,c,d)=>{var h=c+d;return h=h.replace(/0x/ig,"").replace(/,/ig,""),h}),n}function kb(r,e){if(!e)return r;for(var t=0,n=0;n<e.length;n++){var i=e[n];i<0&&(i=-i-1,t^=1<<i),r&1<<n&&(t^=1<<i)}return t}function $b(r,e){var t=e[r%e.length];return[t>>3,t&7]}var q5=[[0,0,4],[8,0,0]],G5=[[0,8,12],[8,8,0],[16,8,4],[24,8,8],[32,0,12],[40,0,0],[48,0,4],[56,0,8]];function H5(r,e,t,n,i,s){for(var o=0;o<8;o++)for(var a=r[e+o]||0,l=0;l<4;l++){var c=(3-l)*s+(7-o),d=a>>l&1|(a>>l+4&1)<<1;t[i*s+n+c]=d}}function K5(r,e,t,n,i,s){for(var o=0;o<8;o++){for(var a=0,l=0;l<4;l++){var c=(3-l)*s+(7-o),d=(t[i*s+n+c]||0)&3;d&1&&(a|=1<<l),d&2&&(a|=1<<l+4)}r[e+o]=a}}function Qb(r){return r.w===16&&r.h===16?G5:q5}function cQ(r){return Qb(r).length*8}function J5(r,e){for(var t=e.w,n=e.h,i=e.count||1,s=e.wpimg||cQ(e),o=Qb(e),a=[],l=0;l<i;l++){for(var c=new Array(t*n).fill(0),d=l*s,h=0;h<o.length;h++){var[u,f,m]=o[h];H5(r,d+u,c,f,m,t)}a.push(new Uint8Array(c))}return a}function eX(r,e){for(var t=e.w,n=e.h,i=e.count||r.length,s=e.wpimg||cQ(e),o=Qb(e),a=new Array(s*i).fill(0),l=0;l<i;l++)for(var c=r[l]||new Uint8Array(t*n),d=l*s,h=0;h<o.length;h++){var[u,f,m]=o[h];K5(a,d+u,c,f,m,t)}return a}function tX(r,e){if(e.pacstrip)return J5(r,e);var t=e.w,n=e.h,i=e.count||1,s=e.bpp||1,o=e.np||1,a=e.bpw||8,l=e.sl||Math.ceil(t*s/a),c=(1<<s)-1,d=e.pofs||l*n*i,h=e.skip||0,u=e.wpimg||l*n,f=l;e.il&&(u=l,f=l*i);for(var m=[],g=0;g<i;g++){for(var v=[],k=0;k<n;k++)for(var L=e.flip?n-1-k:k,M=u*g+L*f,D=0,w=0;w<t;w++){var x=0,R=kb(M,e.remap);Line truncated
|
|
|
|
|
`&&t++;return t}function fQ(r,e){for(var t=/[/;][*;]([{].+[}])[*;][/;]/g,n=[],i;i=t.exec(r);){var s=i.index+i[0].length,o;e?o=r.indexOf("end",s):i[0].startsWith(";;")?(o=r.indexOf(";;",s),o==r.indexOf(";;{",s)&&(o=-1)):o=r.indexOf(";",s);var a=nQ(r,i.index),l=i[0],c=o>=0?nQ(r,o):"???";if(o<0){var d=e?'"end"':i[0].startsWith(";;")?'";;"':'";"';n.push({header:l,startline:a,endline:c,error:`No closing ${d} found after asset header`})}else if(o<=s)n.push({header:l,startline:a,endline:c,error:"Empty data block after asset header"});else try{var h=i[1].replace(/([A-Za-z]+):/g,'"$1":'),u=JSON.parse(h),f=/#embed\s+"(.+?)"/.exec(r.substring(s,o)),m=f?f[1]:void 0;n.push({header:l,startline:a,endline:c,fmt:u,start:s,end:o,embedFile:m})}catch(g){n.push({header:l,startline:a,endline:c,error:`Invalid asset format: ${g.message}`})}}return n}function pQ(r,e,t){if(t(e))return e;var n=r.lastIndexOf("/");if(n>=0){var i=r.substring(0,n+1)+e;if(t(i))return i}return null}function rX(r,e){if(e.destfmt&&(e=e.destfmt),e.pacstrip)return eX(r,e);var t=e.w,n=e.h,i=e.count||1,s=e.bpp||1,o=e.np||1,a=e.bpw||8,l=e.sl||Math.ceil(e.w*s/a),c=(1<<s)-1,d=e.pofs||l*n*i,h=e.skip||0,u=e.wpimg||l*n,f=l;e.il&&(u=l,f=l*i);var m=e.il?f*n:u*i,g;o>0&&e.sl?g=new Uint8Array(m):a<=8?g=new Uint8Array(m*o):g=new Uint32Array(m*o);for(var v=0;v<i;v++)for(var k=r[v],L=0,M=0;M<n;M++)for(var D=e.flip?n-1-M:M,w=v*u+D*f,x=0,R=0;R<t;R++){var X=k[L++],j=kb(w,e.remap);e.reindex&&([j,x]=$b(R,e.reindex),j+=w);for(var G=0;G<o;G++){var ie=X>>G*s&c;g[j+G*d+h]|=e.brev?ie<<a-x-s:ie<<x}x+=s,x>=a&&!e.reindex&&(w+=1,x=0)}return g}function iQ(r,e,t,n,i,s,o){for(var a=[],l=0;l<r.length;l++){var c=r[l],d=4278190080;d|=(c>>e&(1<<t)-1)<<8-t,d|=(c>>n&(1<<i)-1)<<16-i,d|=(c>>s&(1<<o)-1)<<24-o,a.push(d)}return a}function nX(r){var e=(r>>0&1)*33+(r>>1&1)*71+(r>>2&1)*151,t=(r>>3&1)*33+(r>>4&1)*71+(r>>5&1)*151,n=(r>>6&1)*81+(r>>7&1)*174;return 4278190080|n<<16|t<<8|e}function iX(r){var e=r.pal;if(typeof e=="number"){var t=Math.floor(Math.abs(e/100)%10),n=Math.floor(Math.abs(e/10)%10),i=Math.floor(Math.abs(e)%10);return 1<<t+n+i}else{if(e==="pacman")return 256;var s=mQ[e];if(s)return s.length;throw new Error("No palette named "+e)}}function yb(r,e){var t=e.pal,n;if(typeof t=="number"){var i=Math.floor(Math.abs(t/100)%10),s=Math.floor(Math.abs(t/10)%10),o=Math.floor(Math.abs(t)%10);t>=0?n=iQ(r,0,i,i,s,i+s,o):n=iQ(r,i+s,o,i,s,0,i)}else if(t==="pacman"){n=[];for(var a=0;a<r.length;a++)n.push(nX(r[a]))}else{var l=mQ[t];if(l)n=new Uint32Array(r).map(c=>l[c&l.length-1]|4278190080);else throw new Error("No palette named "+t)}return n}function Jl(r){var e=r.pal;if(typeof e!="number"||!isFinite(e))return null;var t=Math.floor(Math.abs(e/100)%10),n=Math.floor(Math.abs(e/10)%10),i=Math.floor(Math.abs(e)%10);return t+n+i<=0?null:e>=0?{r:t,g:n,b:i,rshift:0,gshift:t,bshift:t+n}:{r:i,g:n,b:t,rshift:t+n,gshift:t,bshift:0}}function sQ(r,e,t,n){var i=Jl(r);return i?(e&(1<<i.r)-1)<<i.rshift|(t&(1<<i.g)-1)<<i.gshift|(n&(1<<i.b)-1)<<i.bshift:0}function sX(r,e){var t=Jl(r);return t?{r:e>>t.rshift&(1<<t.r)-1,g:e>>t.gshift&(1<<t.g)-1,b:e>>t.bshift&(1<<t.b)-1}:null}var mQ={gb:[13686916,8890444,5401396,2961698],nes:[5395026,11796480,10485760,11599933,7602281,91,95,6208,12048,543240,26368,1196544,7153664,0,0,0,12899815,16728064,14421538,16729963,14090399,6818519,6588,21681,27227,35843,43776,2918400,10777088,0,0,0,16316664,16755516,16742785,16735173,16730354,14633471,4681215,46327,57599,58229,259115,7911470,15065624,7895160,0,0,16777215,16773822,16300216,16300248,16758527,16761855,13095423,10148607,8973816,8650717,12122296,16119980,16777136,16308472,0,0],ap2lores:[0,16711935,127,8323199,32512,8355711,191,255,12549888,16760576,12566463,16744319,65280,16776960,49023,16777215],vcs:[0,0,4210752,4210752,7105644,7105644,9474192,9474192,11579568,11579568,13158600,13158600,14474460,14474460,16053492,16053492,17476,17476,1074276,1074276,2393220,2393220,3448992,3448992,4241592,4241592,5296336,5296336,6088936,6088936,6880508,6880508,10352,10352,1328260,1328260,2645144,2645144,3963052,3963052,5016764,5016764,6070476,6070476,6862044,6862044,7915756,7915756,6276,6276,1586328,1586328,3166380,3166380,4745408,4745408,6062288,6062288,7378144,7378144,8431852,8431852,9747708,9747708,136,136,2105500,2105500,3947696,3947696,5789888,5789888,7368912,7368912,8947936,8947936,10526956,10526956,11842812,11842812,6029432,6029432,7610508,7610508,8928416,8928416,10246320,10246320,11563200,11563200,12616912,12616912,13671644,13671644,14725356,14725356,7864392,7864392,9445472,9445472,10763384,10763384,12081292,12081292,13398176,13398176,14451892,14451892,15506628,15506628,16560340,16560340,8650772,8650772,9969712,9969712,11287628,11287628,12605544,12605544,13660284,13660284,14715028,14715028,15507624,15507624,16561340,16561340,8912896,8912896,10231836,10231836,11550776,11550776,12606544,12606544,13661288,13661288,14716028,14716028,15508624,15508624,16562340,16562340,8132608,8132608,9451548,9451548,11031608,11031608,12349520,12349520,13404264,134042
Line truncated
|
|
|
|
|
`,buttons:{close:{label:"Close",className:"btn-default"}}}).one("shown.bs.modal",()=>{$("#searchboxInput").trigger("focus")});let e=$("#searchboxInput"),t=$("#searchboxResults"),n=[],i=-1,s=d=>{if(i=Math.max(-1,Math.min(d,n.length-1)),t.find("li.search-hit").each((h,u)=>{$(u).toggleClass("active",h===i)}),i>=0){let h=t[0],u=t.find("li.search-hit").eq(i);if(u.length){let f=u[0],m=h.getBoundingClientRect(),g=f.getBoundingClientRect(),v=g.top-m.top;v<0?h.scrollTop+=v:v+g.height>m.height&&(h.scrollTop+=v+g.height-m.height)}}},o=(d=i)=>{let h=n[d];h&&(H5(h),bootbox.hideAll())},a=d=>{if(n=d||[],n.length===0){i=-1,t.html('<div class="text-muted" style="padding:8px">No matches.</div>');return}let h=$('<ul class="list-group" style="margin-bottom:0"></ul>');for(let u of n){let f=u.record,m=f.source,g=f.kind==="func"?"\u0192":f.kind==="macro"?"#":f.kind==="label"?":":f.kind==="struct"?"S":f.kind==="enum"?"E":f.kind==="text"?"\u2261":"\u2022",v=f.source==="debugger"?Ce(f.addr,4):f.file&&f.line?`${f.file}:${f.line}`:f.file||"",k=f.kind!=="text",L=$('<li class="list-group-item search-hit" style="cursor:pointer;padding:6px 10px;display:flex;align-items:center;overflow:hidden"></li>');L.html(`<span class="search-kind" style="margin-right:6px;font-weight:bold;flex:0 0 auto">${g}</span><span class="search-name" style="flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">`+(k?`<strong>${mu(f.name)}</strong>`:`<span class="search-dumb">${mu(f.name)}</span>`)+(f.brief?` <span class="text-muted">- ${mu(f.brief)}</span>`:"")+`</span><span class="search-loc" style="flex:0 0 auto;margin-left:8px;font-style:italic;font-size:small;white-space:nowrap">${v?mu(v):""}</span>`),L.click(()=>{o(n.indexOf(u))}),h.append(L)}t.empty().append(h),s(0)},l=U5(async()=>{let d=e.val();if(!d){n=[],i=-1,t.empty();return}try{let h=await PP.query(d,q5),u=pu(d,P&&P.debugSymbols&&P.debugSymbols.symbolmap);u&&sQ(u,h.length>0)&&h.push(iQ(d,u,ae&&ae.segments)),a(h)}catch(h){t.html('<div class="text-danger" style="padding:8px">Search failed.</div>')}},150);e.on("input",l),e.on("keydown",d=>{d.key==="ArrowDown"?(d.preventDefault(),s(i+1)):d.key==="ArrowUp"?(d.preventDefault(),s(i-1)):d.key==="Enter"?(d.preventDefault(),i>=0?o():l()):d.key==="Home"?(d.preventDefault(),s(0)):d.key==="End"&&(d.preventDefault(),s(n.length-1))});let c=G5();c&&(e.val(c),l())}var K5=800,J5=1e3,eX=16;function hQ(r){var e={};return r.forEach(t=>{e[t.name]=(e[t.name]||0)+1}),r.forEach(t=>{e[t.name]>1&&t.group&&(t.name=t.group+": "+t.name)}),r}function oQ(r){return r.art?r.brev?0:7:null}var Ou=/([0#]?)([x$%]|\d'h)([0-9a-f]+)(?:[;].*)?|(\d'b|0b)([01]+)/gim;function kb(r){return r.replace(/(\shex\s+)([0-9a-f]+)/ig,function(e,t,n){for(var i=t,s=0;s<n.length;s+=2)i+="0x"+n.substr(s,2)+",";return i})}function uQ(r){for(var e=[],t;t=Ou.exec(r);){var n;t[4]?n=parseInt(t[5],2):t[2].startsWith("%")?n=parseInt(t[3],2):t[2].startsWith("x")||t[2].startsWith("$")||t[2].endsWith("h")?n=parseInt(t[3],16):n=parseInt(t[3]),e.push(n)}return e}function tX(r,e,t){r=kb(r);for(var n="",i,s=0,o=0,a=Math.ceil(t/4);i=Ou.exec(r);)n+=r.slice(s,Ou.lastIndex-i[0].length),s=Ou.lastIndex,i[4]?n+=i[4]+Ku(e[o++],parseInt(i[4])):i[2].startsWith("%")?n+=i[1]+i[2]+Ku(e[o++],t):i[2].endsWith("h")?n+=i[1]+i[2]+Ce(e[o++],parseInt(i[2])):i[2].startsWith("x")?n+=i[1]+"x"+Ce(e[o++],a):i[2].startsWith("$")?n+=i[1]+"$"+Ce(e[o++],a):n+=i[1]+e[o++].toString();return n+=r.slice(s),n=n.replace(/(\shex\s+)([,x0-9a-f]+)/ig,(l,c,d)=>{var h=c+d;return h=h.replace(/0x/ig,"").replace(/,/ig,""),h}),n}function $b(r,e){if(!e)return r;for(var t=0,n=0;n<e.length;n++){var i=e[n];i<0&&(i=-i-1,t^=1<<i),r&1<<n&&(t^=1<<i)}return t}function Qb(r,e){var t=e[r%e.length];return[t>>3,t&7]}var rX=[[0,0,4],[8,0,0]],nX=[[0,8,12],[8,8,0],[16,8,4],[24,8,8],[32,0,12],[40,0,0],[48,0,4],[56,0,8]];function iX(r,e,t,n,i,s){for(var o=0;o<8;o++)for(var a=r[e+o]||0,l=0;l<4;l++){var c=(3-l)*s+(7-o),d=a>>l&1|(a>>l+4&1)<<1;t[i*s+n+c]=d}}function sX(r,e,t,n,i,s){for(var o=0;o<8;o++){for(var a=0,l=0;l<4;l++){var c=(3-l)*s+(7-o),d=(t[i*s+n+c]||0)&3;d&1&&(a|=1<<l),d&2&&(a|=1<<l+4)}r[e+o]=a}}function Tb(r){return r.w===16&&r.h===16?nX:rX}function fQ(r){return Tb(r).length*8}function oX(r,e){for(var t=e.w,n=e.h,i=e.count||1,s=e.wpimg||fQ(e),o=Tb(e),a=[],l=0;l<i;l++){for(var c=new Array(t*n).fill(0),d=l*s,h=0;h<o.length;h++){var[u,f,m]=o[h];iX(r,d+u,c,f,m,t)}a.push(new Uint8Array(c))}return a}function aX(r,e){for(var t=e.w,n=e.h,i=e.count||r.length,s=e.wpimg||fQ(e),o=Tb(e),a=new Array(s*i).fill(0),l=0;l<i;l++)for(var c=r[l]||new Uint8Array(t*n),d=l*s,h=0;h<o.length;h++){var[u,f,m]=o[h];sX(a,d+u,c,f,m,t)}return a}function lX(r,e){if(e.pacstrip)return oX(r,e);var t=e.w,n=e.h,i=e.count||1,s=e.bpp||1,o=e.np||1,a=e.bpw||8,l=e.sl||Math.ceil(t*s/a),c=(1<<s)-1,d=e.pofs||l*n*i,h=e.skip||0,u=e.wpimg||l*n,f=l;e.il&&(u=l,f=l*i);for(var m=[],g=0;g<i;g++){for(var v=[],k=0;k<n;k++)for(var L=e.flip?n-1-k:k,M=u*g+L*f,D=0,w=0;w<t;w++){var x=0,R=$b(M,e.remap);Line truncated
|
|
|
|
|
`&&t++;return t}function gQ(r,e){for(var t=/[/;][*;]([{].+[}])[*;][/;]/g,n=[],i;i=t.exec(r);){var s=i.index+i[0].length,o;e?o=r.indexOf("end",s):i[0].startsWith(";;")?(o=r.indexOf(";;",s),o==r.indexOf(";;{",s)&&(o=-1)):o=r.indexOf(";",s);var a=aQ(r,i.index),l=i[0],c=o>=0?aQ(r,o):"???";if(o<0){var d=e?'"end"':i[0].startsWith(";;")?'";;"':'";"';n.push({header:l,startline:a,endline:c,error:`No closing ${d} found after asset header`})}else if(o<=s)n.push({header:l,startline:a,endline:c,error:"Empty data block after asset header"});else try{var h=i[1].replace(/([A-Za-z]+):/g,'"$1":'),u=JSON.parse(h),f=/#embed\s+"(.+?)"/.exec(r.substring(s,o)),m=f?f[1]:void 0;n.push({header:l,startline:a,endline:c,fmt:u,start:s,end:o,embedFile:m})}catch(g){n.push({header:l,startline:a,endline:c,error:`Invalid asset format: ${g.message}`})}}return n}function bQ(r,e,t){if(t(e))return e;var n=r.lastIndexOf("/");if(n>=0){var i=r.substring(0,n+1)+e;if(t(i))return i}return null}function cX(r,e){if(e.destfmt&&(e=e.destfmt),e.pacstrip)return aX(r,e);var t=e.w,n=e.h,i=e.count||1,s=e.bpp||1,o=e.np||1,a=e.bpw||8,l=e.sl||Math.ceil(e.w*s/a),c=(1<<s)-1,d=e.pofs||l*n*i,h=e.skip||0,u=e.wpimg||l*n,f=l;e.il&&(u=l,f=l*i);var m=e.il?f*n:u*i,g;o>0&&e.sl?g=new Uint8Array(m):a<=8?g=new Uint8Array(m*o):g=new Uint32Array(m*o);for(var v=0;v<i;v++)for(var k=r[v],L=0,M=0;M<n;M++)for(var D=e.flip?n-1-M:M,w=v*u+D*f,x=0,R=0;R<t;R++){var X=k[L++],j=$b(w,e.remap);e.reindex&&([j,x]=Qb(R,e.reindex),j+=w);for(var G=0;G<o;G++){var ie=X>>G*s&c;g[j+G*d+h]|=e.brev?ie<<a-x-s:ie<<x}x+=s,x>=a&&!e.reindex&&(w+=1,x=0)}return g}function lQ(r,e,t,n,i,s,o){for(var a=[],l=0;l<r.length;l++){var c=r[l],d=4278190080;d|=(c>>e&(1<<t)-1)<<8-t,d|=(c>>n&(1<<i)-1)<<16-i,d|=(c>>s&(1<<o)-1)<<24-o,a.push(d)}return a}function dX(r){var e=(r>>0&1)*33+(r>>1&1)*71+(r>>2&1)*151,t=(r>>3&1)*33+(r>>4&1)*71+(r>>5&1)*151,n=(r>>6&1)*81+(r>>7&1)*174;return 4278190080|n<<16|t<<8|e}function hX(r){var e=r.pal;if(typeof e=="number"){var t=Math.floor(Math.abs(e/100)%10),n=Math.floor(Math.abs(e/10)%10),i=Math.floor(Math.abs(e)%10);return 1<<t+n+i}else{if(e==="pacman")return 256;var s=yQ[e];if(s)return s.length;throw new Error("No palette named "+e)}}function Sb(r,e){var t=e.pal,n;if(typeof t=="number"){var i=Math.floor(Math.abs(t/100)%10),s=Math.floor(Math.abs(t/10)%10),o=Math.floor(Math.abs(t)%10);t>=0?n=lQ(r,0,i,i,s,i+s,o):n=lQ(r,i+s,o,i,s,0,i)}else if(t==="pacman"){n=[];for(var a=0;a<r.length;a++)n.push(dX(r[a]))}else{var l=yQ[t];if(l)n=new Uint32Array(r).map(c=>l[c&l.length-1]|4278190080);else throw new Error("No palette named "+t)}return n}function ec(r){var e=r.pal;if(typeof e!="number"||!isFinite(e))return null;var t=Math.floor(Math.abs(e/100)%10),n=Math.floor(Math.abs(e/10)%10),i=Math.floor(Math.abs(e)%10);return t+n+i<=0?null:e>=0?{r:t,g:n,b:i,rshift:0,gshift:t,bshift:t+n}:{r:i,g:n,b:t,rshift:t+n,gshift:t,bshift:0}}function cQ(r,e,t,n){var i=ec(r);return i?(e&(1<<i.r)-1)<<i.rshift|(t&(1<<i.g)-1)<<i.gshift|(n&(1<<i.b)-1)<<i.bshift:0}function uX(r,e){var t=ec(r);return t?{r:e>>t.rshift&(1<<t.r)-1,g:e>>t.gshift&(1<<t.g)-1,b:e>>t.bshift&(1<<t.b)-1}:null}var yQ={gb:[13686916,8890444,5401396,2961698],nes:[5395026,11796480,10485760,11599933,7602281,91,95,6208,12048,543240,26368,1196544,7153664,0,0,0,12899815,16728064,14421538,16729963,14090399,6818519,6588,21681,27227,35843,43776,2918400,10777088,0,0,0,16316664,16755516,16742785,16735173,16730354,14633471,4681215,46327,57599,58229,259115,7911470,15065624,7895160,0,0,16777215,16773822,16300216,16300248,16758527,16761855,13095423,10148607,8973816,8650717,12122296,16119980,16777136,16308472,0,0],ap2lores:[0,16711935,127,8323199,32512,8355711,191,255,12549888,16760576,12566463,16744319,65280,16776960,49023,16777215],vcs:[0,0,4210752,4210752,7105644,7105644,9474192,9474192,11579568,11579568,13158600,13158600,14474460,14474460,16053492,16053492,17476,17476,1074276,1074276,2393220,2393220,3448992,3448992,4241592,4241592,5296336,5296336,6088936,6088936,6880508,6880508,10352,10352,1328260,1328260,2645144,2645144,3963052,3963052,5016764,5016764,6070476,6070476,6862044,6862044,7915756,7915756,6276,6276,1586328,1586328,3166380,3166380,4745408,4745408,6062288,6062288,7378144,7378144,8431852,8431852,9747708,9747708,136,136,2105500,2105500,3947696,3947696,5789888,5789888,7368912,7368912,8947936,8947936,10526956,10526956,11842812,11842812,6029432,6029432,7610508,7610508,8928416,8928416,10246320,10246320,11563200,11563200,12616912,12616912,13671644,13671644,14725356,14725356,7864392,7864392,9445472,9445472,10763384,10763384,12081292,12081292,13398176,13398176,14451892,14451892,15506628,15506628,16560340,16560340,8650772,8650772,9969712,9969712,11287628,11287628,12605544,12605544,13660284,13660284,14715028,14715028,15507624,15507624,16561340,16561340,8912896,8912896,10231836,10231836,11550776,11550776,12606544,12606544,13661288,13661288,14716028,14716028,15508624,15508624,16562340,16562340,8132608,8132608,9451548,9451548,11031608,11031608,12349520,12349520,13404264,134042
Line truncated
|
|
|
|
|
<p>The 8bitworkshop IDE is a browser-based development environment for
|
|
|
|
|
micro computers and consoles.
|
|
|
|
|
The IDE compiles or assembles your source code
|
|
|
|
@@ -303,7 +304,7 @@ tools appear:</p>
|
|
|
|
|
status bar at the bottom of the window (toggle it under
|
|
|
|
|
<strong>Settings \xBB Show keyboard shortcuts / status bar</strong>).</p>
|
|
|
|
|
<p>See <a href="editor.md">Editor</a> for editor-specific shortcuts.</p>
|
|
|
|
|
`;var SQ=`<h1>Editor</h1>
|
|
|
|
|
`;var PQ=`<h1>Editor</h1>
|
|
|
|
|
<p>The source editor is based on <a href="https://codemirror.net/">CodeMirror 6</a>.
|
|
|
|
|
Syntax highlighting is chosen from the toolchain that handles the file\u2019s
|
|
|
|
|
extension, so a <code>.c</code> file opens as C, a <code>.ca65</code> file as 6502 assembly,
|
|
|
|
@@ -380,7 +381,7 @@ filesystem in a read-only viewer.</li>
|
|
|
|
|
<p>The editor also inherits the standard <a href="https://codemirror.net/">CodeMirror 6</a> keymap,
|
|
|
|
|
including cursor/word movement and selection with the arrow keys, and cut/
|
|
|
|
|
copy/paste (<code>mod+X</code>, <code>mod+C</code>, <code>mod+V</code>).</p>
|
|
|
|
|
`;var vQ=`<h1>Disassembly</h1>
|
|
|
|
|
`;var kQ=`<h1>Disassembly</h1>
|
|
|
|
|
<p>The Disassembly window disassembles machine code around the current
|
|
|
|
|
program counter. It is available on platforms that expose both a
|
|
|
|
|
disassembler and a savable CPU state.</p>
|
|
|
|
@@ -429,7 +430,7 @@ from the tool\u2019s own output; see <a href="editor.md">Editor</a>. The listing
|
|
|
|
|
the program counter using the line-to-address map from the assembler,
|
|
|
|
|
which is more accurate for source-level navigation than the live
|
|
|
|
|
disassembly.</p>
|
|
|
|
|
`;var xQ=`<h1>Memory Browser</h1>
|
|
|
|
|
`;var $Q=`<h1>Memory Browser</h1>
|
|
|
|
|
<p>The Memory Browser shows a hex dump of CPU memory. It is available on
|
|
|
|
|
platforms that implement <code>readAddress</code>.</p>
|
|
|
|
|
<p>The dump is laid out 16 bytes per row:</p>
|
|
|
|
@@ -448,7 +449,7 @@ row containing it.</li>
|
|
|
|
|
<li>Clicking a segment in the <a href="memmap.md">Memory Map</a> opens this
|
|
|
|
|
window and scrolls to that segment\u2019s start address.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
`;var wQ=`<h1>Memory Map</h1>
|
|
|
|
|
`;var QQ=`<h1>Memory Map</h1>
|
|
|
|
|
<p>The Memory Map draws the program\u2019s memory layout as columns that share
|
|
|
|
|
one address axis. Each row starts at the address shown on the left, and
|
|
|
|
|
row height grows with the size of the range.</p>
|
|
|
|
@@ -476,7 +477,7 @@ Estimated sizes are marked with <code>~</code>.</li>
|
|
|
|
|
<h2>Navigating</h2>
|
|
|
|
|
<p>Click any bar to open the <a href="memory.md">Memory Browser</a> and
|
|
|
|
|
scroll it to that bar\u2019s start address.</p>
|
|
|
|
|
`;var PQ=`<h1>VRAM Browser</h1>
|
|
|
|
|
`;var TQ=`<h1>VRAM Browser</h1>
|
|
|
|
|
<p>The VRAM Browser is a hex dump of video memory. It is available on
|
|
|
|
|
systems with a separate video chip and a <code>readVRAMAddress</code> implementation.</p>
|
|
|
|
|
<p>It behaves like the <a href="memory.md">Memory Browser</a> \u2014 16 bytes per
|
|
|
|
@@ -484,7 +485,7 @@ row \u2014 but reads through the platform\u2019s video-memory accessor instead o
|
|
|
|
|
CPU memory, and its rows are all shown with the <code>video</code> segment color.</p>
|
|
|
|
|
<p>The dump does not scroll to a data segment on open, since VRAM has no
|
|
|
|
|
linker segments.</p>
|
|
|
|
|
`;var kQ=`<h1>Memory Probe</h1>
|
|
|
|
|
`;var _Q=`<h1>Memory Probe</h1>
|
|
|
|
|
<p>The Memory Probe is a heat map of memory activity. It is available on
|
|
|
|
|
platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
<p>The canvas is a 256\xD7256 grid of the 64K address space:</p>
|
|
|
|
@@ -550,7 +551,7 @@ contents, so the map is still readable before anything executes.</li>
|
|
|
|
|
<p>Hovering the map shows the routines and operations that touched that
|
|
|
|
|
address, including the program counter that performed each access and
|
|
|
|
|
any associated value.</p>
|
|
|
|
|
`;var $Q=`<h1>CRT Probe</h1>
|
|
|
|
|
`;var AQ=`<h1>CRT Probe</h1>
|
|
|
|
|
<p>The CRT Probe shows memory and I/O activity laid out by <em>raster
|
|
|
|
|
position</em> instead of by address, so you can see what the CPU touches at
|
|
|
|
|
each point of the display sweep. It is available on platforms that
|
|
|
|
@@ -603,7 +604,7 @@ implement <code>startProbing</code>.</p>
|
|
|
|
|
are filled with the previous color, so the display does not show false
|
|
|
|
|
black bands.</p>
|
|
|
|
|
<p>The view shows a complete frame, and might be incomplete during debugging.</p>
|
|
|
|
|
`;var QQ=`<h1>Probe Log</h1>
|
|
|
|
|
`;var CQ=`<h1>Probe Log</h1>
|
|
|
|
|
<p>The Probe Log is a chronological text view of CPU and memory activity
|
|
|
|
|
for a frame. It is available on platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
<p>Each line describes one clock tick:</p>
|
|
|
|
@@ -619,7 +620,7 @@ addresses and, where relevant, values.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Write operations are colored differently from reads so they stand out.</p>
|
|
|
|
|
<p>The view shows a complete frame, and might be incomplete during debugging.</p>
|
|
|
|
|
`;var TQ=`<h1>Scanline I/O</h1>
|
|
|
|
|
`;var EQ=`<h1>Scanline I/O</h1>
|
|
|
|
|
<p>The Scanline I/O window shows the I/O and VRAM accesses made during each
|
|
|
|
|
scanline. It is available on platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
<p>Each row is one scanline:</p>
|
|
|
|
@@ -634,7 +635,7 @@ end, when known.</li>
|
|
|
|
|
<p>This makes it easy to see where per-scanline register writes (raster
|
|
|
|
|
effects) occur relative to the start of the visible line.</p>
|
|
|
|
|
<p>The view shows a complete frame, and might be incomplete during debugging.</p>
|
|
|
|
|
`;var _Q=`<h1>Symbol Profiler</h1>
|
|
|
|
|
`;var RQ=`<h1>Symbol Profiler</h1>
|
|
|
|
|
<p>The Symbol Profiler counts memory reads and writes per symbol over time.
|
|
|
|
|
It is available on platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
<p>Each row lists a symbol with two counters:</p>
|
|
|
|
@@ -670,7 +671,7 @@ It is available on platforms that implement <code>startProbing</code>.</p>
|
|
|
|
|
the numbers keep growing while you run and are reset when data is
|
|
|
|
|
collected again. Symbols from the debug map are listed even before they
|
|
|
|
|
are touched.</p>
|
|
|
|
|
`;var AQ=`<h1>Call Stack</h1>
|
|
|
|
|
`;var MQ=`<h1>Call Stack</h1>
|
|
|
|
|
<p>The Call Stack window reconstructs the program\u2019s call graph from runtime
|
|
|
|
|
stack activity. It is available on platforms that implement
|
|
|
|
|
<code>startProbing</code>.</p>
|
|
|
|
@@ -684,7 +685,7 @@ probe buffer is cleared on each refresh, and the graph resets when the
|
|
|
|
|
emulator is reset.</p>
|
|
|
|
|
<p>Expanding a node reveals its callees, so you can drill into a hot
|
|
|
|
|
routine and see where the time and calls are going.</p>
|
|
|
|
|
`;var CQ=`<h1>Debug Tree</h1>
|
|
|
|
|
`;var LQ=`<h1>Debug Tree</h1>
|
|
|
|
|
<p>The Debug Tree shows a hierarchical view of platform debug information.
|
|
|
|
|
It is available on platforms that implement <code>getDebugTree</code>.</p>
|
|
|
|
|
<p>The tree\u2019s shape is defined by the platform. Where the
|
|
|
|
@@ -704,7 +705,7 @@ lazy are only called when the node is expanded.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Nodes collapse and expand on click. The tree refreshes with the emulator
|
|
|
|
|
while debugging.</p>
|
|
|
|
|
`;var EQ=`<h1>Breakpoints</h1>
|
|
|
|
|
`;var DQ=`<h1>Breakpoints</h1>
|
|
|
|
|
<p>The Breakpoints window lists every breakpoint in the project and lets you
|
|
|
|
|
add, edit, enable, or delete them. It is available on platforms that
|
|
|
|
|
implement <code>runEval</code> or <code>runToPC</code>.</p>
|
|
|
|
@@ -812,7 +813,7 @@ the disassembly, at the breakpoint\u2019s address.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Breakpoints are persisted in browser local storage, scoped to the
|
|
|
|
|
current platform and project file, so they survive a reload.</p>
|
|
|
|
|
`;var RQ=`<h1>Asset Editor</h1>
|
|
|
|
|
`;var IQ=`<h1>Asset Editor</h1>
|
|
|
|
|
<p>The Asset Editor finds <a href="asset-headers.md">asset headers</a> in your source \u2014 small JSON
|
|
|
|
|
descriptors inside comments \u2014 and turns the data block that follows into
|
|
|
|
|
an editable bitmap, tilemap, or palette. Edits are written straight back
|
|
|
|
@@ -861,7 +862,7 @@ from your project\u2019s graphics and palette, as a single preview.</p>
|
|
|
|
|
<p>Use <code>Ctrl/Cmd+Z</code> to undo and <code>Ctrl/Cmd+Shift+Z</code> to redo your edits. The
|
|
|
|
|
history starts fresh each time you open the Asset Editor, so undo only
|
|
|
|
|
affects the changes you\u2019ve made in this session.</p>
|
|
|
|
|
`;var MQ=`<h1>Managing Files</h1>
|
|
|
|
|
`;var ZQ=`<h1>Managing Files</h1>
|
|
|
|
|
<h2>Importing and exporting files</h2>
|
|
|
|
|
<p>To save your files outside of the browser:</p>
|
|
|
|
|
<ol>
|
|
|
|
@@ -974,7 +975,7 @@ commit message, then <strong>Push Changes</strong>.</li>
|
|
|
|
|
<strong>OK</strong>. All local files are overwritten; there is no merge in the
|
|
|
|
|
browser.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
`;var LQ=`<h1>Build Directives</h1>
|
|
|
|
|
`;var XQ=`<h1>Build Directives</h1>
|
|
|
|
|
<p>A project can contain multiple files. The build system decides how each
|
|
|
|
|
file is used based on directives in your source, and each file\u2019s
|
|
|
|
|
extension selects the tool that compiles or assembles it.</p>
|
|
|
|
@@ -1258,7 +1259,7 @@ cases:</p>
|
|
|
|
|
</table>
|
|
|
|
|
<p>See <a href="toolchains.md">Toolchains & Platforms</a> for the full
|
|
|
|
|
platform \xD7 extension \u2192 tool table.</p>
|
|
|
|
|
`;var DQ=`<!-- generated by \`npm run doctools\`; do not edit by hand -->
|
|
|
|
|
`;var zQ=`<!-- generated by \`npm run doctools\`; do not edit by hand -->
|
|
|
|
|
<h1>Toolchains & Platforms</h1>
|
|
|
|
|
<p>A source file\u2019s <strong>extension</strong> picks a tool, and the <strong>platform</strong>
|
|
|
|
|
disambiguates extensions several tools share (<code>.c</code>, <code>.s</code>, <code>.bas</code>).</p>
|
|
|
|
@@ -2920,7 +2921,7 @@ not accepted on that platform.</p>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
`;var IQ=`<h1>Asset Header</h1>
|
|
|
|
|
`;var WQ=`<h1>Asset Header</h1>
|
|
|
|
|
<p>An <strong>asset header</strong> is a tiny note to the <a href="asseteditor.md">Asset Editor</a>
|
|
|
|
|
that tells it what a block of data means. It is just a JSON object inside
|
|
|
|
|
a comment, sitting right above the bytes:</p>
|
|
|
|
@@ -3577,7 +3578,7 @@ bytes).</li>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
`;var ZQ=`<h2>Embedding the IDE in a web page</h2>
|
|
|
|
|
`;var BQ=`<h2>Embedding the IDE in a web page</h2>
|
|
|
|
|
<p>You can embed the IDE using an IFRAME element:</p>
|
|
|
|
|
<pre><code class="language-html"><iframe src="https://8bitworkshop.com/redir.html?embed=1&..."></iframe>
|
|
|
|
|
</code></pre>
|
|
|
|
@@ -3620,7 +3621,7 @@ containing embeds is effectively sandboxed from the others.</p>
|
|
|
|
|
src="https://8bitworkshop.com/redir.html?embed=1&platform=nes&highlight=&file0_name=testembed.dasm&file0_data=..."></iframe>
|
|
|
|
|
</div>
|
|
|
|
|
</code></pre>
|
|
|
|
|
`;var XQ=`<h1>Waveform Viewer</h1>
|
|
|
|
|
`;var VQ=`<h1>Waveform Viewer</h1>
|
|
|
|
|
<p>The Verilog platform shows a waveform trace below the emulator screen,
|
|
|
|
|
with one row per exposed signal. <strong>Click</strong> to give the waveform viewer
|
|
|
|
|
keyboard focus.</p>
|
|
|
|
@@ -3645,13 +3646,13 @@ signals), <code>clk</code> and <code>reset</code></li>
|
|
|
|
|
<li>For input signals (other than <code>clk</code> or <code>reset</code>) <strong>click</strong> its row to change its
|
|
|
|
|
value at the current clock.</li>
|
|
|
|
|
</ul>
|
|
|
|
|
`;var jX=Db(),_u=[{id:"index",title:"IDE Help",html:yQ},{id:"editor",title:"Editor",html:SQ},{id:"disasm",title:"Disassembly",html:vQ},{id:"memory",title:"Memory Browser",html:xQ},{id:"memmap",title:"Memory Map",html:wQ},{id:"vram",title:"VRAM Browser",html:PQ},{id:"memprobe",title:"Memory Probe",html:kQ},{id:"crtprobe",title:"CRT Probe",html:$Q},{id:"probelog",title:"Probe Log",html:QQ},{id:"scanlineio",title:"Scanline I/O",html:TQ},{id:"symbols",title:"Symbol Profiler",html:_Q},{id:"callstack",title:"Call Stack",html:AQ},{id:"debugtree",title:"Debug Tree",html:CQ},{id:"breakpoints",title:"Breakpoints",html:EQ},{id:"asseteditor",title:"Asset Editor",html:RQ},{id:"managing-files",title:"Managing Files",html:MQ},{id:"build-directives",title:"Build Directives",html:LQ},{id:"toolchains",title:"Toolchains & Platforms",html:DQ},{id:"asset-headers",title:"Asset Headers",html:IQ},{id:"embedding-ide",title:"Embedding the IDE",html:ZQ},{id:"verilog-waveform",title:"Waveform Viewer",html:XQ}],Ib={};for(let r of _u)Ib[r.id]=r;vP(()=>_u);function Zb(r){let e=r||"";return e.startsWith("#")&&(e=e.substring(1)),e.startsWith("help")&&(e=e.substring(4)),e.startsWith("/")&&(e=e.substring(1)),e.endsWith(".md")&&(e=e.substring(0,e.length-3)),e=e.replace(/^\.\//,""),Ib[e]?e:"index"}function UX(r){return Ib[Zb(r)]}var qX={"#disasm":"disasm","#memory":"memory","#memmap":"memmap","#vram":"vram","#memprobe":"memprobe","#crtprobe":"crtprobe","#probelog":"probelog","#scanlineio":"scanlineio","#symbols":"symbols","#callstack":"callstack","#debugtree":"debugtree","#breakpoints":"breakpoints","#asseteditor":"asseteditor"};function oT(r,e){return e?"editor":r&&qX[r]||"index"}function GX(r){r.querySelectorAll("a[href]").forEach(t=>{let n=t.getAttribute("href");if(!n)return;if(/^[a-z][a-z0-9+.-]*:/i.test(n)){t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer");return}if(n.startsWith("/")||n.startsWith("#"))return;let i=n.indexOf("#"),s=i>=0?n.substring(0,i):n;s.endsWith(".md")&&(t.setAttribute("href","#help/"+Zb(s)),t.removeAttribute("target"))})}function HX(r,e){let t=UX(e);r.innerHTML=jX.sanitize(t.html),GX(r)}var sc=class{constructor(e){this.id=Zb(e||"index")}getPath(){return"#help/"+this.id}createDiv(e){return this.maindiv=vn(e,"vertical-scroll help-view"),HX(this.maindiv[0],this.id),this.maindiv[0]}refresh(e){}};var oc=256,aT=100,lT=!1,Au=class r{constructor(e,t){this.expanded=!1;this.parent=e,this.name=t,this.children=new Map,this.level=e?e.level+1:-1,this.view=e?e.view:null}getDiv(){return this._div==null&&(this._div=document.createElement("div"),this._div.classList.add("vertical-scroll"),this._div.classList.add("tree-content"),this._header=document.createElement("div"),this._header.classList.add("tree-header"),this._header.classList.add("tree-level-"+this.level),this._header.append(this.name),this._inline=document.createElement("span"),this._inline.classList.add("tree-value"),this._header.append(this._inline),this._div.append(this._header),this.parent._content.append(this._div),this._header.onclick=e=>{this.toggleExpanded()}),this.expanded&&this._content==null?(this._content=document.createElement("div"),this._div.append(this._content)):!this.expanded&&this._content!=null&&(this._content.remove(),this._content=null,this.children.clear()),this._div}toggleExpanded(){this.expanded=!this.expanded,this.view.tick()}remove(){this._div.remove(),this._div=null}update(e){this.getDiv();var t="";if(e&&e.$$&&typeof e.$$=="function"&&this._content!=null&&(e=e.$$()),e==null)t=e+"";else if(typeof e=="number")e!=(e|0)?t=e.toString():t=e+" ($"+Ce(e)+")";else if(typeof e=="boolean")t=e.toString();else if(typeof e=="string")e.length<aT?t=e:t=e.substring(0,aT)+"...";else if(e.buffer&&e.length<=oc)t=o0(e,0,e.length);else if(typeof e=="object"||typeof e=="function")if(this._content!=null){if(e.slice&&e.length>oc){let l={},c=e;for(var n=oc;e.length/n>oc;)n*=2;for(let d=0;d<c.length;d+=n)l["$"+Ce(d)]={$$:()=>c.slice(d,d+n)};e=l}if(e instanceof Map){let l={};for(let[c,d]of e.entries())l[c]=d;e=l}let o=e instanceof Array?Array.from(e.keys()):Object.getOwnPropertyNames(e);if(o.length>oc){let l={},c=e;for(var n=100;o.length/n>100;)n*=2;for(let h=0;h<o.length;h+=n){for(var i={},s=h;s<h+n;s++)i[o[s]]=c[o[s]];l["["+h+"...]"]=i}e=l,o=Object.getOwnPropertyNames(e)}let a=new Set(this.children.keys());o.forEach(l=>{var c=!lT&&typeof l=="string"&&l.startsWith("$$");if(!c){let d=this.children.get(l);d==null&&(d=new r(this,l),this.children.set(l,d)),d.update(e[l])}a.delete(l)}),a.forEach(l=>{this.children.get(l).remove(),this.children.delete(l)}),this._header.classList.add("tree-expanded"),this._header.classList.remove("tree-collapsed")}else this._header.classList.add("tree-collapsed"),this._header.classList.remove("tree-expanded");else t=typeof e;this._inline.innerText!=t&&(this._inline.innerText=t)}};function cT(r,e){var t=new Au(null,null);t.view=e,t._content=r;var n=new Au(t,"/");return n.expanded=!0,n.getDiv(),n._div.style.padding="0px",n}
Line truncated
|
|
|
|
|
`,await gT(r),de.newfile?!n&&!t?Re('No build tool for "'+r+'" on this platform; project will not build.'):n?xT(!0,!0):ar("No skeleton file for "+t+" on this platform; using blank file."):ar('Could not find file "'+r+'"<br><br>Creating new '+(n?t:"blank")+" file."),delete de.newfile,Uu()}}function Gb(r){if(r=="/")de={repo:"/"};else if(r.indexOf("://")>=0){var e=$l(r);e&&(de={repo:e.repopath})}else de.platform=fe,de.file=r;ro()}async function lz(r){var e=Qf(P.getToolForFilename(r));try{return await $.get("presets/"+ir(fe)+"/skeleton."+e,"text")}catch(t){return console.log(t+""),null}}function Hb(r){return r.indexOf(" ")>=0?(Re("No spaces in filenames, please."),!1):!0}async function cz(r){var e=ir(fe),t={},n=[];for(var i of r){var s=P.getToolForFilename("test"+i);t[s]||(t[s]=[],n.push(s)),t[s].push(i)}var o=n.map(d=>$.ajax({url:"presets/"+e+"/skeleton."+Qf(d),type:"HEAD"}).then(()=>d,()=>null)),a=await Promise.all(o),l=[];for(var c of a)c!=null&&l.push({tool:c,extensions:t[c]});return l}async function dz(r){var e=await cz(P.getDefaultExtensions()),t,n;return e.length===0?(t=P.getDefaultExtensions(),n=t.join(" ")):(t=e.reduce((i,s)=>i.concat(s.extensions),[]),n=e.map(i=>i.extensions.join(" ")).join("<br>")),bootbox.prompt({title:"Enter the name of your new main source file.<br><br><span class='dialog-help'>"+n+"</span>",placeholder:"newfile"+t[0],callback:i=>{if(i&&i.trim().length>0){if(!Hb(i))return;i.indexOf(".")<0&&(i+=t[0]);var s=i;de.newfile="1",Gb(s)}}}),!0}function hz(r){let e=$('<input type="file" multiple accept="*" style="display:none">'),t=e[0];e.change(n=>{uz(t.files)}),e.click()}function uz(r){console.log(r);var e=0;function t(){var n=r[e++];if(!n)console.log("Done uploading",e),e>2?(ar("Files uploaded."),setTimeout(fc,1e3)):(de.file=r[0].name,bootbox.confirm({message:"Open '"+Os.sanitize(de.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:o=>{o?ro():setTimeout(fc,1e3)}}));else{var i=n.name,s=new FileReader;s.onload=function(o){var a=o.target.result,l=new Uint8Array(a);Cs(i,l)||(l=gc(l).replace(`\r
|
|
|
|
|
`;var ez=Ib(),Au=[{id:"index",title:"IDE Help",html:wQ},{id:"editor",title:"Editor",html:PQ},{id:"disasm",title:"Disassembly",html:kQ},{id:"memory",title:"Memory Browser",html:$Q},{id:"memmap",title:"Memory Map",html:QQ},{id:"vram",title:"VRAM Browser",html:TQ},{id:"memprobe",title:"Memory Probe",html:_Q},{id:"crtprobe",title:"CRT Probe",html:AQ},{id:"probelog",title:"Probe Log",html:CQ},{id:"scanlineio",title:"Scanline I/O",html:EQ},{id:"symbols",title:"Symbol Profiler",html:RQ},{id:"callstack",title:"Call Stack",html:MQ},{id:"debugtree",title:"Debug Tree",html:LQ},{id:"breakpoints",title:"Breakpoints",html:DQ},{id:"asseteditor",title:"Asset Editor",html:IQ},{id:"managing-files",title:"Managing Files",html:ZQ},{id:"build-directives",title:"Build Directives",html:XQ},{id:"toolchains",title:"Toolchains & Platforms",html:zQ},{id:"asset-headers",title:"Asset Headers",html:WQ},{id:"embedding-ide",title:"Embedding the IDE",html:BQ},{id:"verilog-waveform",title:"Waveform Viewer",html:VQ}],Zb={};for(let r of Au)Zb[r.id]=r;wP(()=>Au);function Xb(r){let e=r||"";return e.startsWith("#")&&(e=e.substring(1)),e.startsWith("help")&&(e=e.substring(4)),e.startsWith("/")&&(e=e.substring(1)),e.endsWith(".md")&&(e=e.substring(0,e.length-3)),e=e.replace(/^\.\//,""),Zb[e]?e:"index"}function tz(r){return Zb[Xb(r)]}var rz={"#disasm":"disasm","#memory":"memory","#memmap":"memmap","#vram":"vram","#memprobe":"memprobe","#crtprobe":"crtprobe","#probelog":"probelog","#scanlineio":"scanlineio","#symbols":"symbols","#callstack":"callstack","#debugtree":"debugtree","#breakpoints":"breakpoints","#asseteditor":"asseteditor"};function dT(r,e){return e?"editor":r&&rz[r]||"index"}function nz(r){r.querySelectorAll("a[href]").forEach(t=>{let n=t.getAttribute("href");if(!n)return;if(/^[a-z][a-z0-9+.-]*:/i.test(n)){t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer");return}if(n.startsWith("/")||n.startsWith("#"))return;let i=n.indexOf("#"),s=i>=0?n.substring(0,i):n;s.endsWith(".md")&&(t.setAttribute("href","#help/"+Xb(s)),t.removeAttribute("target"))})}function iz(r,e){let t=tz(e);r.innerHTML=ez.sanitize(t.html),nz(r)}var oc=class{constructor(e){this.id=Xb(e||"index")}getPath(){return"#help/"+this.id}createDiv(e){return this.maindiv=xn(e,"vertical-scroll help-view"),iz(this.maindiv[0],this.id),this.maindiv[0]}refresh(e){}};var ac=256,hT=100,uT=!1,Cu=class r{constructor(e,t){this.expanded=!1;this.parent=e,this.name=t,this.children=new Map,this.level=e?e.level+1:-1,this.view=e?e.view:null}getDiv(){return this._div==null&&(this._div=document.createElement("div"),this._div.classList.add("vertical-scroll"),this._div.classList.add("tree-content"),this._header=document.createElement("div"),this._header.classList.add("tree-header"),this._header.classList.add("tree-level-"+this.level),this._header.append(this.name),this._inline=document.createElement("span"),this._inline.classList.add("tree-value"),this._header.append(this._inline),this._div.append(this._header),this.parent._content.append(this._div),this._header.onclick=e=>{this.toggleExpanded()}),this.expanded&&this._content==null?(this._content=document.createElement("div"),this._div.append(this._content)):!this.expanded&&this._content!=null&&(this._content.remove(),this._content=null,this.children.clear()),this._div}toggleExpanded(){this.expanded=!this.expanded,this.view.tick()}remove(){this._div.remove(),this._div=null}update(e){this.getDiv();var t="";if(e&&e.$$&&typeof e.$$=="function"&&this._content!=null&&(e=e.$$()),e==null)t=e+"";else if(typeof e=="number")e!=(e|0)?t=e.toString():t=e+" ($"+Ce(e)+")";else if(typeof e=="boolean")t=e.toString();else if(typeof e=="string")e.length<hT?t=e:t=e.substring(0,hT)+"...";else if(e.buffer&&e.length<=ac)t=a0(e,0,e.length);else if(typeof e=="object"||typeof e=="function")if(this._content!=null){if(e.slice&&e.length>ac){let l={},c=e;for(var n=ac;e.length/n>ac;)n*=2;for(let d=0;d<c.length;d+=n)l["$"+Ce(d)]={$$:()=>c.slice(d,d+n)};e=l}if(e instanceof Map){let l={};for(let[c,d]of e.entries())l[c]=d;e=l}let o=e instanceof Array?Array.from(e.keys()):Object.getOwnPropertyNames(e);if(o.length>ac){let l={},c=e;for(var n=100;o.length/n>100;)n*=2;for(let h=0;h<o.length;h+=n){for(var i={},s=h;s<h+n;s++)i[o[s]]=c[o[s]];l["["+h+"...]"]=i}e=l,o=Object.getOwnPropertyNames(e)}let a=new Set(this.children.keys());o.forEach(l=>{var c=!uT&&typeof l=="string"&&l.startsWith("$$");if(!c){let d=this.children.get(l);d==null&&(d=new r(this,l),this.children.set(l,d)),d.update(e[l])}a.delete(l)}),a.forEach(l=>{this.children.get(l).remove(),this.children.delete(l)}),this._header.classList.add("tree-expanded"),this._header.classList.remove("tree-collapsed")}else this._header.classList.add("tree-collapsed"),this._header.classList.remove("tree-expanded");else t=typeof e;this._inline.innerText!=t&&(this._inline.innerText=t)}};function fT(r,e){var t=new Cu(null,null);t.view=e,t._content=r;var n=new Cu(t,"/");return n.expanded=!0,n.getDiv(),n._div.style.padding="0px",n}
Line truncated
|
|
|
|
|
`,await vT(r),de.newfile?!n&&!t?Re('No build tool for "'+r+'" on this platform; project will not build.'):n?$T(!0,!0):ar("No skeleton file for "+t+" on this platform; using blank file."):ar('Could not find file "'+r+'"<br><br>Creating new '+(n?t:"blank")+" file."),delete de.newfile,qu()}}function Hb(r){if(r=="/")de={repo:"/"};else if(r.indexOf("://")>=0){var e=Ql(r);e&&(de={repo:e.repopath})}else de.platform=fe,de.file=r;ro()}async function mz(r){var e=Tf(P.getToolForFilename(r));try{return await $.get("presets/"+ir(fe)+"/skeleton."+e,"text")}catch(t){return console.log(t+""),null}}function Kb(r){return r.indexOf(" ")>=0?(Re("No spaces in filenames, please."),!1):!0}async function Oz(r){var e=ir(fe),t={},n=[];for(var i of r){var s=P.getToolForFilename("test"+i);t[s]||(t[s]=[],n.push(s)),t[s].push(i)}var o=n.map(d=>$.ajax({url:"presets/"+e+"/skeleton."+Tf(d),type:"HEAD"}).then(()=>d,()=>null)),a=await Promise.all(o),l=[];for(var c of a)c!=null&&l.push({tool:c,extensions:t[c]});return l}async function gz(r){var e=await Oz(P.getDefaultExtensions()),t,n;return e.length===0?(t=P.getDefaultExtensions(),n=t.join(" ")):(t=e.reduce((i,s)=>i.concat(s.extensions),[]),n=e.map(i=>i.extensions.join(" ")).join("<br>")),bootbox.prompt({title:"Enter the name of your new main source file.<br><br><span class='dialog-help'>"+n+"</span>",placeholder:"newfile"+t[0],callback:i=>{if(i&&i.trim().length>0){if(!Kb(i))return;i.indexOf(".")<0&&(i+=t[0]);var s=i;de.newfile="1",Hb(s)}}}),!0}function bz(r){let e=$('<input type="file" multiple accept="*" style="display:none">'),t=e[0];e.change(n=>{yz(t.files)}),e.click()}function yz(r){console.log(r);var e=0;function t(){var n=r[e++];if(!n)console.log("Done uploading",e),e>2?(ar("Files uploaded."),setTimeout(pc,1e3)):(de.file=r[0].name,bootbox.confirm({message:"Open '"+Os.sanitize(de.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:o=>{o?ro():setTimeout(pc,1e3)}}));else{var i=n.name,s=new FileReader;s.onload=function(o){var a=o.target.result,l=new Uint8Array(a);Cs(i,l)||(l=bc(l).replace(`\r
|
|
|
|
|
`,`
|
|
|
|
|
`)),F.updateFile(i,l),console.log("Uploaded "+i+" "+l.length+" bytes"),t()},s.readAsArrayBuffer(n)}}r&&t()}async function fz(r){var e=window.showDirectoryPicker;e||Re("This browser can't open local files on your computer, yet. Try Chrome.");var t=await e(),n=t.name,i="__localfs__"+n,s={handle:t},o=Ub.createInstance({name:i,version:2});await o.setItem(i,s),de={localfs:n},ro(!0)}async function pz(r){return new Promise((e,t)=>{bootbox.prompt(Os.sanitize(r),n=>{e(n)})})}async function mz(r){let e={mode:"readwrite"};var t="__localfs__"+r,n=Ub.createInstance({name:t,version:2}),i=await n.getItem(t),s=i.handle;console.log(i,s);var o=await s.queryPermission(e);if(console.log(o),o!=="granted"&&(await pz("Request permissions to access filesystem?"),o=await s.requestPermission(e)),o!=="granted"){Re("Could not get permission to access filesystem.");return}let a={};return{getFileData:async l=>{console.log("getFileData",l);let d=await(await s.getFileHandle(l,{create:!1})).getFile(),h=await(Cs(l)?d.arrayBuffer():d.text());return h instanceof ArrayBuffer?new Uint8Array(h):h},setFileData:async(l,c)=>{a[l]=Date.now();let h=await(await s.getFileHandle(l,{create:!0})).createWritable();await h.write(c),await h.close()},onFileSystemUpdate:l=>{if(typeof window.FileSystemObserver=="undefined")return;new window.FileSystemObserver((d,h)=>{for(let u of d)if(u.changedHandle){let f=u.changedHandle.name;if(Date.now()-(a[f]||0)<2e3)continue;l(f)}}).observe(s,{recursive:!0})}}}function kt(){return St(ae.mainPath)}function aP(){return St(F.getActiveID())}function Oz(r){var e=F.getActive(),t=F.getActiveID(),n=e&&e.setData&&!e.setText;if(e&&(e.setText||e.setData)){var i="presets/"+ir(fe)+"/"+t;La(i,s=>{if(s==null){_t?Re("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):Re("Can only revert built-in examples.");return}bootbox.confirm("Reset '"+Os.sanitize(t)+"' to default?",o=>{o&&(n?(e.setData(s),ae.updateFile(t,s)):e.setText(s))})},n?"arraybuffer":"text")}else Re("Cannot revert the active window. Please choose a text file.")}function gz(r){var e=F.getActive();if(e&&e.getPath){var t=F.getActiveID();bootbox.confirm("Delete '"+Os.sanitize(t)+"'?",n=>{n&&wn.removeItem(t).then(()=>{de.file==t?(Zi.unsetLastPreset(),ro()):(fc(),ar("Deleted "+t))})})}else Re("Cannot delete the active window.")}function bz(r){var e=F.getActive();if(e&&e.getPath&&ae.getFile(e.getPath())){var t=F.getActiveID();bootbox.prompt({title:"Rename '"+Os.sanitize(t)+"' to?",value:t,callback:n=>{var i=ae.getFile(e.getPath());if(n&&n!=t&&i){if(!Hb(n))return;wn.removeItem(t).then(()=>wn.setItem(n,i)).then(()=>{fc(),alert("Renamed "+t+" to "+n),t==ae.mainPath&&Gb(n)})}}})}else Re("Cannot rename the active window.")}function yz(r){let e={},t,n=P.getPresets?P.getPresets():[];for(var i=0;i<n.length;i++){var s=n[i],o=s.chapter?s.chapter+". "+s.name:s.name,a=s.id==ae.mainPath;s.category?t=$("<optgroup />").attr("label","Examples: "+s.category).appendTo(r):t||(t=$("<optgroup />").attr("label","Examples").appendTo(r)),t.append($("<option />").val(s.id).text(o).attr("selected",a?"selected":null)),a&&(Iu=s),e[s.id]=o}return e}function Sz(r){if(Mr&&!wa){var e=0,t=Js();if(t){let i=$("<optgroup />").attr("label","Repositories").appendTo(r);for(let s in t){var n=t[s];n.platform_id&&ir(n.platform_id)==ir(fe)&&i.append($("<option />").val(n.url).text(n.url.substring(n.url.indexOf("/"))))}}}}async function bT(r,e,t,n){let i=await wn.keys();i||(i=[]);let s;for(var o=0;o<i.length;o++){let a=i[o];if(a.startsWith(t)&&!n[a]){s||(s=$("<optgroup />").attr("label",e).appendTo(r));let l=a.substring(t.length);s.append($("<option />").val(a).text(l).attr("selected",a==ae.mainPath?"selected":null))}}}function yT(r){r.css("visibility","visible");var e=ae.mainPath;r.val()!=e&&r.append($("<option />").val(e).text(e).attr("selected","selected"))}async function fc(){var r=$("#preset_select").empty();if(_t)r.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(St(_t)+"/").show(),await bT(r,_t,"",{}),yT(r);else{Sz(r);var e=yz(r);await bT(r,"Local Files","",e),yT(r)}r.off("change").change(function(t){Gb($(this).val().toString())})}function vz(r){var e=$("<p/>");if(r.path!=null){var t=r.line?r.label?`(${r.path} @ ${r.label})`:`(${r.path}:${r.line})`:`(${r.path})`,n=$("<a/>").text(t),i=r.path;i==kt()&&(i=ae.mainPath),F.isWindow(i)&&n.click(s=>{var o=F.createOrShow(i);o instanceof Pr&&o.navigateToLine(r.line)}),e.append(n),e.append(" ")}return e.append($("<span/>").text(r.msg)),e}function wT(){$("#error_alert").hide(),qb=!1}function Kb(r,e){var t=$("#error_alert_msg").empty();for(var n of r.slice(0,10))t.append(vz(n));$("#error_alert").show(),qb=e;var i=r.find(o=>o.path!=null),s;i&&F.isWindow(i.path==kt()?ae.mainPath:i.path)&&(s=()=>{Pz(i)})}function PT(r,e){if(e!=null){var t={msg:e,line:0};r instanceof tf&&r.$loc&&(t=Object.create(r.$loc),t.msg=e,console.log(t)),Kb([t],!0)}}async function xz(r){if("uppercaseOnly"in r&&j$(r.uppercaseO
Line truncated
|
|
|
|
|
`)),F.updateFile(i,l),console.log("Uploaded "+i+" "+l.length+" bytes"),t()},s.readAsArrayBuffer(n)}}r&&t()}async function Sz(r){var e=window.showDirectoryPicker;e||Re("This browser can't open local files on your computer, yet. Try Chrome.");var t=await e(),n=t.name,i="__localfs__"+n,s={handle:t},o=qb.createInstance({name:i,version:2});await o.setItem(i,s),de={localfs:n},ro(!0)}async function vz(r){return new Promise((e,t)=>{bootbox.prompt(Os.sanitize(r),n=>{e(n)})})}async function xz(r){let e={mode:"readwrite"};var t="__localfs__"+r,n=qb.createInstance({name:t,version:2}),i=await n.getItem(t),s=i.handle;console.log(i,s);var o=await s.queryPermission(e);if(console.log(o),o!=="granted"&&(await vz("Request permissions to access filesystem?"),o=await s.requestPermission(e)),o!=="granted"){Re("Could not get permission to access filesystem.");return}let a={};return{getFileData:async l=>{console.log("getFileData",l);let d=await(await s.getFileHandle(l,{create:!1})).getFile(),h=await(Cs(l)?d.arrayBuffer():d.text());return h instanceof ArrayBuffer?new Uint8Array(h):h},setFileData:async(l,c)=>{a[l]=Date.now();let h=await(await s.getFileHandle(l,{create:!0})).createWritable();await h.write(c),await h.close()},onFileSystemUpdate:l=>{if(typeof window.FileSystemObserver=="undefined")return;new window.FileSystemObserver((d,h)=>{for(let u of d)if(u.changedHandle){let f=u.changedHandle.name;if(Date.now()-(a[f]||0)<2e3)continue;l(f)}}).observe(s,{recursive:!0})}}}function kt(){return St(ae.mainPath)}function cP(){return St(F.getActiveID())}function wz(r){var e=F.getActive(),t=F.getActiveID(),n=e&&e.setData&&!e.setText;if(e&&(e.setText||e.setData)){var i="presets/"+ir(fe)+"/"+t;Da(i,s=>{if(s==null){_t?Re("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):Re("Can only revert built-in examples.");return}bootbox.confirm("Reset '"+Os.sanitize(t)+"' to default?",o=>{o&&(n?(e.setData(s),ae.updateFile(t,s)):e.setText(s))})},n?"arraybuffer":"text")}else Re("Cannot revert the active window. Please choose a text file.")}function Pz(r){var e=F.getActive();if(e&&e.getPath){var t=F.getActiveID();bootbox.confirm("Delete '"+Os.sanitize(t)+"'?",n=>{n&&Pn.removeItem(t).then(()=>{de.file==t?(Zi.unsetLastPreset(),ro()):(pc(),ar("Deleted "+t))})})}else Re("Cannot delete the active window.")}function kz(r){var e=F.getActive();if(e&&e.getPath&&ae.getFile(e.getPath())){var t=F.getActiveID();bootbox.prompt({title:"Rename '"+Os.sanitize(t)+"' to?",value:t,callback:n=>{var i=ae.getFile(e.getPath());if(n&&n!=t&&i){if(!Kb(n))return;Pn.removeItem(t).then(()=>Pn.setItem(n,i)).then(()=>{pc(),alert("Renamed "+t+" to "+n),t==ae.mainPath&&Hb(n)})}}})}else Re("Cannot rename the active window.")}function $z(r){let e={},t,n=P.getPresets?P.getPresets():[];for(var i=0;i<n.length;i++){var s=n[i],o=s.chapter?s.chapter+". "+s.name:s.name,a=s.id==ae.mainPath;s.category?t=$("<optgroup />").attr("label","Examples: "+s.category).appendTo(r):t||(t=$("<optgroup />").attr("label","Examples").appendTo(r)),t.append($("<option />").val(s.id).text(o).attr("selected",a?"selected":null)),a&&(Zu=s),e[s.id]=o}return e}function Qz(r){if(Lr&&!Pa){var e=0,t=Js();if(t){let i=$("<optgroup />").attr("label","Repositories").appendTo(r);for(let s in t){var n=t[s];n.platform_id&&ir(n.platform_id)==ir(fe)&&i.append($("<option />").val(n.url).text(n.url.substring(n.url.indexOf("/"))))}}}}async function xT(r,e,t,n){let i=await Pn.keys();i||(i=[]);let s;for(var o=0;o<i.length;o++){let a=i[o];if(a.startsWith(t)&&!n[a]){s||(s=$("<optgroup />").attr("label",e).appendTo(r));let l=a.substring(t.length);s.append($("<option />").val(a).text(l).attr("selected",a==ae.mainPath?"selected":null))}}}function wT(r){r.css("visibility","visible");var e=ae.mainPath;r.val()!=e&&r.append($("<option />").val(e).text(e).attr("selected","selected"))}async function pc(){var r=$("#preset_select").empty();if(_t)r.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(St(_t)+"/").show(),await xT(r,_t,"",{}),wT(r);else{Qz(r);var e=$z(r);await xT(r,"Local Files","",e),wT(r)}r.off("change").change(function(t){Hb($(this).val().toString())})}function Tz(r){var e=$("<p/>");if(r.path!=null){var t=r.line?r.label?`(${r.path} @ ${r.label})`:`(${r.path}:${r.line})`:`(${r.path})`,n=$("<a/>").text(t),i=r.path;i==kt()&&(i=ae.mainPath),F.isWindow(i)&&n.click(s=>{var o=F.createOrShow(i);o instanceof Pr&&o.navigateToLine(r.line)}),e.append(n),e.append(" ")}return e.append($("<span/>").text(r.msg)),e}function QT(){$("#error_alert").hide(),Gb=!1}function Jb(r,e){var t=$("#error_alert_msg").empty();for(var n of r.slice(0,10))t.append(Tz(n));$("#error_alert").show(),Gb=e;var i=r.find(o=>o.path!=null),s;i&&F.isWindow(i.path==kt()?ae.mainPath:i.path)&&(s=()=>{Cz(i)})}function TT(r,e){if(e!=null){var t={msg:e,line:0};r instanceof rf&&r.$loc&&(t=Object.create(r.$loc),t.msg=e,console.log(t)),Jb([t],!0)}}async function _z(r){if("uppercaseOnly"in r&&H$(r.uppercaseO
Line truncated
|
|
|
|
|
`+t(i)+`
|
|
|
|
|
`;ae.loadFiles([s]).then(a=>{a&&a.length?Re(i+" already exists; including anyway"):ae.updateFile(s,`
|
|
|
|
|
`),n.insertLinesBefore(o),va()})}}}):Re("Can't insert text in this window -- switch back to main file")}function Zz(){var r=kt(),e=P.getToolForFilename(r);r.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"||e=="oscar64"?Fn("Header",".h",t=>'#include "'+t+'"'):e=="dasm"||e=="zmac"?Fn("Include",".inc",t=>' include "'+t+'"'):e=="ca65"||e=="sdasz80"||e=="vasm"||e=="armips"?Fn("Include",".inc",t=>' .include "'+t+'"'):e=="verilator"?Fn("Verilog",".v",t=>'`include "'+t+'"'):e=="wiz"?Fn("Include",".wiz",t=>'import "'+t+'";'):e=="ecs"?Fn("Include",".ecs",t=>'import "'+t+'"'):e=="acme"?Fn("Include",".acme",t=>'!src "'+t+'"'):e=="xa"?Fn("Include",".xa",t=>'#include "'+t+'"'):e=="dialog"?Fn("Include",".dg",t=>'%% #include "'+t+'"'):Re("Can't add include file to this project type ("+e+")")}function Xz(){var r=kt(),e=P.getToolForFilename(r);r.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?Fn("Linked C (or .s)",".c",t=>'//#link "'+t+'"'):r.endsWith("asm")||r.endsWith(".s")||e=="ca65"||e=="lwasm"?Fn("Linked ASM",".inc",t=>';#link "'+t+'"'):Re("Can't add linked file to this project type ("+e+")")}function zz(){if(ft=new Bi($("#toolbar")[0],null),ft.grp.prop("id","run_bar"),ft.add("mod+shift+r","Reset","glyphicon-refresh",zT).prop("id","dbg_reset"),ft.add("mod+shift+h","Pause","glyphicon-pause",AT).prop("id","dbg_pause"),ft.add("mod+shift+g","Go To Address","",r=>{$T()||Bu()}),ft.add("mod+shift+g","Resume","glyphicon-play",Bu).prop("id","dbg_go"),ft.add("F8","Pause/Resume","",CT),ft.add("F1","Help","",FT),P.restartAtPC&&ft.add("mod+shift+a","Restart at Cursor","glyphicon-play-circle",DT).prop("id","dbg_restartatline"),ft.newGroup(),ft.grp.prop("id","debug_bar"),P.runEval&&ft.add("mod+shift+d","Reset and Debug","glyphicon-fast-backward",WT).prop("id","dbg_restart"),P.stepBack&&ft.add("mod+shift+j","Step Backwards","glyphicon-step-backward",XT).prop("id","dbg_stepback"),P.step&&ft.add("mod+shift+l","Single Step","glyphicon-step-forward",ET).prop("id","dbg_step"),P.stepOver&&ft.add("mod+shift+k","Step Over","glyphicon-hand-right",RT).prop("id","dbg_stepover"),P.runUntilReturn&&ft.add("mod+shift+i","Step Out of Subroutine","glyphicon-hand-up",ZT).prop("id","dbg_stepout"),P.runToVsync&&ft.add("mod+shift+x","Next Frame/Interrupt","glyphicon-forward",MT).prop("id","dbg_tovsync"),(P.runEval||P.runToPC)&&!fe.startsWith("verilog")&&ft.add("mod+shift+y","Run To Line","glyphicon-save",IT).prop("id","dbg_toline"),ft.newGroup(),ft.grp.prop("id","xtra_bar"),ft.add("mod+shift+f","Search","glyphicon-search",bb).prop("id","dbg_search"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(dz),$("#item_upload_file").click(hz),$("#item_open_directory").click(fz),$("#item_github_login").click(lP),$("#item_github_logout").click(cP),$("#item_github_import").click(dP),$("#item_github_publish").click(hP),$("#item_github_push").click(uP),$("#item_github_pull").click(fP),$("#item_repo_delete").click(mP),$("#item_share_file").click(Kw),$("#item_reset_file").click(Oz),$("#item_rename_file").click(bz),$("#item_delete_file").click(gz),$("#item_download_rom").click(eP),$("#item_download_file").click(tP),$("#item_download_zip").click(nP),P.getDebugSymbolFile?$("#item_download_sym").click(iP):$("#item_download_sym").hide(),$("#item_download_allzip").click(sP),$("#item_record_video").click(oP),cO()?$("#item_export_cassette").click(Jw):$("#item_export_cassette").hide(),P.setFrameRate&&P.getFrameRate&&($("#dbg_slower").click(Cz),$("#dbg_faster").click(Ez),$("#dbg_slowest").click(Rz),$("#dbg_fastest").click(Mz)),$("#item_addfile_include").click(Zz),$("#item_addfile_link").click(Xz),$("#item_request_persist").click(()=>xT(!0,!1)),$("#item_settings").click(Dw),BT(),P.newCodeAnalyzer&&ft.add(null,"Analyze CPU Timing","glyphicon-time",Lz),P.startProbing&&ft.add(null,"Highlight Executed Lines","glyphicon-fire",Iz).prop("id","dbg_tracelines"),P.setRecorder&&P.advance&&Vz(),P.showHelp){let{li:r,a:e}=Wu("help__"+fe,hc+" Info");$("#help_menu").append(r),$(e).click(t=>{t.preventDefault(),window.open(P.showHelp(),"_8bws_help")})}Bz();{let{li:r}=Wu("#help","IDE Help");$("#help_menu").prepend(r)}$("#item_tool_versions").click(Wz)}function FT(){if(F){var r=T0(),e=F.getActive()instanceof Pr,t=r||oT(F.getActiveID(),e),n="#help/"+t;window.location.hash===n?F.createOrShow(n):window.location.hash=n}}function Wz(){let r=u=>String(u==null?"":u).replace(/[&<>"]/g,f=>({"&":"&","<":"<",">":">",'"':"""})[f]),e=(u,f)=>"$"+Ce(u,4).toUpperCase()+(f!=null?"+$"+Ce(f,4).toUpperCase():""),t=An[fe]||An[ir(fe)]||An[an(fe)],n=t&&t.arch||"\u2014",i=[];t&&(t.rom_start!=null&&i.push("rom "+e(t.rom_start,t.rom_size)),t.code_start!=null&&i.push("code "+e(t.code_start,t.code_size)),t.data_start!=null&&i.push("data "+e(t.data_start,t.data_size)),t.stack_end!=null&&i.push("stack $"+Ce(t.stack_end,4).toUpperCase()));let s=new Set([".a"]);for(let u in Qo)for(let f of Qo[u].extensions||[])s.add(f);let o={},a=[],l=(u,f)=>{u&&(o[u]||(o[u]=[],a.push(u)),f&&Line truncated
|
|
|
|
|
`),n.insertLinesBefore(o),xa()})}}}):Re("Can't insert text in this window -- switch back to main file")}function Fz(){var r=kt(),e=P.getToolForFilename(r);r.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"||e=="oscar64"?Fn("Header",".h",t=>'#include "'+t+'"'):e=="dasm"||e=="zmac"?Fn("Include",".inc",t=>' include "'+t+'"'):e=="ca65"||e=="sdasz80"||e=="vasm"||e=="armips"?Fn("Include",".inc",t=>' .include "'+t+'"'):e=="verilator"?Fn("Verilog",".v",t=>'`include "'+t+'"'):e=="wiz"?Fn("Include",".wiz",t=>'import "'+t+'";'):e=="ecs"?Fn("Include",".ecs",t=>'import "'+t+'"'):e=="acme"?Fn("Include",".acme",t=>'!src "'+t+'"'):e=="xa"?Fn("Include",".xa",t=>'#include "'+t+'"'):e=="dialog"?Fn("Include",".dg",t=>'%% #include "'+t+'"'):Re("Can't add include file to this project type ("+e+")")}function Nz(){var r=kt(),e=P.getToolForFilename(r);r.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?Fn("Linked C (or .s)",".c",t=>'//#link "'+t+'"'):r.endsWith("asm")||r.endsWith(".s")||e=="ca65"||e=="lwasm"?Fn("Linked ASM",".inc",t=>';#link "'+t+'"'):Re("Can't add linked file to this project type ("+e+")")}function jz(){if(ft=new Bi($("#toolbar")[0],null),ft.grp.prop("id","run_bar"),ft.add("mod+shift+r","Reset","glyphicon-refresh",YT).prop("id","dbg_reset"),ft.add("mod+shift+h","Pause","glyphicon-pause",MT).prop("id","dbg_pause"),ft.add("mod+shift+g","Go To Address","",r=>{AT()||Vu()}),ft.add("mod+shift+g","Resume","glyphicon-play",Vu).prop("id","dbg_go"),ft.add("F8","Pause/Resume","",LT),ft.add("F1","Help","",qT),P.restartAtPC&&ft.add("mod+shift+a","Restart at Cursor","glyphicon-play-circle",zT).prop("id","dbg_restartatline"),ft.newGroup(),ft.grp.prop("id","debug_bar"),P.runEval&&ft.add("mod+shift+d","Reset and Debug","glyphicon-fast-backward",FT).prop("id","dbg_restart"),P.stepBack&&ft.add("mod+shift+j","Step Backwards","glyphicon-step-backward",VT).prop("id","dbg_stepback"),P.step&&ft.add("mod+shift+l","Single Step","glyphicon-step-forward",DT).prop("id","dbg_step"),P.stepOver&&ft.add("mod+shift+k","Step Over","glyphicon-hand-right",IT).prop("id","dbg_stepover"),P.runUntilReturn&&ft.add("mod+shift+i","Step Out of Subroutine","glyphicon-hand-up",BT).prop("id","dbg_stepout"),P.runToVsync&&ft.add("mod+shift+x","Next Frame/Interrupt","glyphicon-forward",ZT).prop("id","dbg_tovsync"),(P.runEval||P.runToPC)&&!fe.startsWith("verilog")&&ft.add("mod+shift+y","Run To Line","glyphicon-save",WT).prop("id","dbg_toline"),ft.newGroup(),ft.grp.prop("id","xtra_bar"),ft.add("mod+shift+f","Search","glyphicon-search",yb).prop("id","dbg_search"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(gz),$("#item_upload_file").click(bz),$("#item_open_directory").click(Sz),$("#item_github_login").click(dP),$("#item_github_logout").click(hP),$("#item_github_import").click(uP),$("#item_github_publish").click(fP),$("#item_github_push").click(pP),$("#item_github_pull").click(mP),$("#item_repo_delete").click(gP),$("#item_share_file").click(eP),$("#item_reset_file").click(wz),$("#item_rename_file").click(kz),$("#item_delete_file").click(Pz),$("#item_download_rom").click(rP),$("#item_download_file").click(nP),$("#item_download_zip").click(sP),P.getDebugSymbolFile?$("#item_download_sym").click(oP):$("#item_download_sym").hide(),$("#item_download_allzip").click(aP),$("#item_record_video").click(lP),dO()?$("#item_export_cassette").click(tP):$("#item_export_cassette").hide(),P.setFrameRate&&P.getFrameRate&&($("#dbg_slower").click(Zz),$("#dbg_faster").click(Xz),$("#dbg_slowest").click(zz),$("#dbg_fastest").click(Wz)),$("#item_addfile_include").click(Fz),$("#item_addfile_link").click(Nz),$("#item_request_persist").click(()=>$T(!0,!1)),$("#item_settings").click(Zw),NT(),P.newCodeAnalyzer&&ft.add(null,"Analyze CPU Timing","glyphicon-time",Bz),P.startProbing&&ft.add(null,"Highlight Executed Lines","glyphicon-fire",Yz).prop("id","dbg_tracelines"),P.setRecorder&&P.advance&&Gz(),P.showHelp){let{li:r,a:e}=Bu("help__"+fe,uc+" Info");$("#help_menu").append(r),$(e).click(t=>{t.preventDefault(),window.open(P.showHelp(),"_8bws_help")})}qz();{let{li:r}=Bu("#help","IDE Help");$("#help_menu").prepend(r)}$("#item_tool_versions").click(Uz)}function qT(){if(F){var r=_0(),e=F.getActive()instanceof Pr,t=r||dT(F.getActiveID(),e),n="#help/"+t;window.location.hash===n?F.createOrShow(n):window.location.hash=n}}function Uz(){let r=u=>String(u==null?"":u).replace(/[&<>"]/g,f=>({"&":"&","<":"<",">":">",'"':"""})[f]),e=(u,f)=>"$"+Ce(u,4).toUpperCase()+(f!=null?"+$"+Ce(f,4).toUpperCase():""),t=Cn[fe]||Cn[ir(fe)]||Cn[cn(fe)],n=t&&t.arch||"\u2014",i=[];t&&(t.rom_start!=null&&i.push("rom "+e(t.rom_start,t.rom_size)),t.code_start!=null&&i.push("code "+e(t.code_start,t.code_size)),t.data_start!=null&&i.push("data "+e(t.data_start,t.data_size)),t.stack_end!=null&&i.push("stack $"+Ce(t.stack_end,4).toUpperCase()));let s=new Set([".a"]);for(let u in Qo)for(let f of Qo[u].extensions||[])s.add(f);let o={},a=[],l=(u,f)=>{u&&(o[u]||(o[u]=[],a.push(u)),f&&Line truncated
|
|
|
|
|
<table class="help">
|
|
|
|
|
<tr><th>Architecture</th><td>${r(n)}</td></tr>
|
|
|
|
|
<tr><th>Memory</th><td>${i.length?i.join(" \xB7 "):"\u2014"}</td></tr>
|
|
|
|
@@ -3661,16 +3662,16 @@ value at the current clock.</li>
|
|
|
|
|
</table>`,h=a.map(u=>{let f=or(u),m=f&&f.version||"\u2014",g=f&&f.kind||"\u2014",v=o[u].length?o[u].map(L=>`<code>${r(L)}</code>`).join(" "):"\u2014",k=f&&f.name||u;return`<tr><td>${r(k)}</td><td>${r(g)}</td><td>${r(m)}</td><td>${v}</td></tr>`}).join(`
|
|
|
|
|
`);bootbox.dialog({title:"Toolchain Info",onEscape:!0,buttons:{docs:{label:"Full reference",className:"btn-link",callback:()=>{window.location.hash="#help/toolchains"}},ok:{label:"Close",className:"btn-primary"}},message:`
|
|
|
|
|
<div class="dialog-scroll">
|
|
|
|
|
<h5 class="dialog-title">${r(hc)} <small>${r(fe)}</small></h5>
|
|
|
|
|
<h5 class="dialog-title">${r(uc)} <small>${r(fe)}</small></h5>
|
|
|
|
|
${d}
|
|
|
|
|
<h5 class="dialog-title">Tools on this platform</h5>
|
|
|
|
|
<table class="help">
|
|
|
|
|
<tr><th>Tool</th><th>Kind</th><th>Version</th><th>Extensions</th></tr>
|
|
|
|
|
${h}
|
|
|
|
|
</table>
|
|
|
|
|
</div>`})}function Bz(){let r=P.getToolForFilename(kt());if(!r)return;let e=or(r);if(!e)return;let t=e.version?" ("+e.version+")":"",n=(s,o,a)=>{let{li:l,a:c}=Wu(s,o);$("#help_menu").append(l),$(c).click(d=>{d.preventDefault(),window.open(a,"_8bws_help")})};e.helpURL&&n("help__"+r,e.name+" Help"+t,e.helpURL);let i=J0(r,fe);i&&n("help__"+r+"__"+fe,e.name+" Help for "+hc,i)}function Vz(){var r=$("#replayslider"),e=$("#clockslider"),t=$("#replay_frame"),n=$("#replay_clock");P.advanceFrameClock||$("#clockdiv").hide();var i=()=>{t.text(kr.lastSeekFrame+""),n.text(kr.lastSeekStep+"")},s=l=>{Ii();var c=parseInt(r.val().toString()),d=parseInt(e.val().toString());kr.loadFrame(c,d)>=0&&(e.attr("min",0),e.attr("max",kr.lastStepCount),i(),Xu(P.saveState()))},o=l=>{Ii(),kr.loadFrame(l)>=0&&(r.val(l),i(),Xu(P.saveState()))},a=l=>{Ii();var c=parseInt(r.val().toString());kr.loadFrame(c,l)>=0&&(e.val(l),i(),Xu(P.saveState()))};kr.callbackStateChanged=()=>{r.attr("min",0),r.attr("max",kr.numFrames()),r.val(kr.currentFrame()),e.val(kr.currentStep()),i(),pc(P.saveState())},r.on("input",s),e.on("input",s),$("#replay_min").click(()=>{o(1)}),$("#replay_max").click(()=>{o(kr.numFrames())}),$("#replay_back").click(()=>{o(parseInt(r.val().toString())-1)}),$("#replay_fwd").click(()=>{o(parseInt(r.val().toString())+1)}),$("#clock_back").click(()=>{a(parseInt(e.val().toString())-1)}),$("#clock_fwd").click(()=>{a(parseInt(e.val().toString())+1)}),$("#replay_bar").show(),ft.add("mod+shift+e","Start/Stop Replay Recording","glyphicon-record",Dz).prop("id","dbg_record")}async function Yz(){if(Zi.shouldCompleteTour()){await ln("lib/bootstrap-tourist.js");var r=fe.startsWith("vcs"),e=[{element:"#platformsMenuButton",placement:"right",title:"Platform Selector",content:`You're currently on the "<b>`+fe+'</b>" platform. You can choose a different one from the menu.'},{element:"#preset_select",title:"Project Selector",content:"You can choose different code examples, create your own files, or import projects from GitHub."},{element:"#workspace",title:"Code Editor",content:r?"Type your 6502 assembly code into the editor, and it'll be assembled in real-time.":"Type your source code into the editor, and it'll be compiled in real-time."},{element:"#emulator",placement:"left",title:"Emulator",content:"We'll load your compiled code into the emulator whenever you make changes."},{element:"#debug_bar",placement:"bottom",title:"Debug Tools",content:"Use these buttons to set breakpoints, single step through code, pause/resume, and use debugging tools."},{element:"#dropdownMenuButton",title:"Main Menu",content:"Click the menu to create new files, download your code, or share your work with others."},{element:"#sidebar",title:"Sidebar",content:"Pull right to expose the sidebar. It lets you switch between source files, view assembly listings, and use other tools like Disassembler, Memory Browser, and Asset Editor."}];wo()&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Cookie Consent",content:'Before we start, we should tell you that this website stores persistent data in your browser. Review our <a href="/privacy.html" target="_new">privacy policy</a>.'}),e.push({element:"#booksMenuButton",placement:"left",title:"Books",content:"Get some books that explain how to program all of this stuff, and write some games!"})),wa&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Developer Analytics",content:"BTW, we send stack traces to sentry.io when exceptions are thrown. Hope that's ok."}),e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Welcome to 8bitworkshop Desktop!",content:'The directory "~/8bitworkshop" contains all of your file edits and built ROM images. You can create new projects under the platform directories (e.g. "c64/myproject")'}));var t=new Tour({autoscroll:!1,steps:e,onEnd:()=>{Zi.completedTour()}});setTimeout(()=>{t.start()},2500)}}function Vu(r){var e=(r.message||r.error||r)+"";if(e.indexOf("QuotaExceededError")>=0)tz();else{var t=r.error||r.reason;t!=null&&t instanceof tf?NT(t):wo()&&ay(e,t,{platform:fe,window:F?F.getActiveID():"",errors:F.lasterrors||[]})}}function NT(r){console.log("haltEmulation"),Ii(),oW(r)}function Fz(){window.addEventListener("error",Vu),window.addEventListener("unhandledrejection",Vu)}function jT(){window.removeEventListener("error",Vu),window.removeEventListener("unhandledrejection",Vu)}function ro(r,e){e&&(de=e),jT(),r?window.location.replace("?"+$.param(de)):window.location.href="?"+$.param(de)}function Uu(){fe&&(de.platform=fe),delete de[""],history.replaceState({},"","?"+$.param(de)+window.location.hash)}function UT(r){if(!r||r==="#")return null;var e=decodeURIComponent(r.substring(1));return e.startsWith("asseteditor/")?"#asseteditor":e.startsWith("headerview/")?(ql(e.substring(11)),"#"+e):F.isWindow("#"+e)?"#"+e:F.isWindow(e)?e:null}function Nz(){function r(){let e=window.location.hash,t=e&&e!=="#"?UT(e):null;if(t)t!==F.getActiveID()&&F.createOrShow(t);else{Line truncated
|
|
|
|
|
</div>`})}function qz(){let r=P.getToolForFilename(kt());if(!r)return;let e=or(r);if(!e)return;let t=e.version?" ("+e.version+")":"",n=(s,o,a)=>{let{li:l,a:c}=Bu(s,o);$("#help_menu").append(l),$(c).click(d=>{d.preventDefault(),window.open(a,"_8bws_help")})};e.helpURL&&n("help__"+r,e.name+" Help"+t,e.helpURL);let i=ey(r,fe);i&&n("help__"+r+"__"+fe,e.name+" Help for "+uc,i)}function Gz(){var r=$("#replayslider"),e=$("#clockslider"),t=$("#replay_frame"),n=$("#replay_clock");P.advanceFrameClock||$("#clockdiv").hide();var i=()=>{t.text(kr.lastSeekFrame+""),n.text(kr.lastSeekStep+"")},s=l=>{Ii();var c=parseInt(r.val().toString()),d=parseInt(e.val().toString());kr.loadFrame(c,d)>=0&&(e.attr("min",0),e.attr("max",kr.lastStepCount),i(),zu(P.saveState()))},o=l=>{Ii(),kr.loadFrame(l)>=0&&(r.val(l),i(),zu(P.saveState()))},a=l=>{Ii();var c=parseInt(r.val().toString());kr.loadFrame(c,l)>=0&&(e.val(l),i(),zu(P.saveState()))};kr.callbackStateChanged=()=>{r.attr("min",0),r.attr("max",kr.numFrames()),r.val(kr.currentFrame()),e.val(kr.currentStep()),i(),mc(P.saveState())},r.on("input",s),e.on("input",s),$("#replay_min").click(()=>{o(1)}),$("#replay_max").click(()=>{o(kr.numFrames())}),$("#replay_back").click(()=>{o(parseInt(r.val().toString())-1)}),$("#replay_fwd").click(()=>{o(parseInt(r.val().toString())+1)}),$("#clock_back").click(()=>{a(parseInt(e.val().toString())-1)}),$("#clock_fwd").click(()=>{a(parseInt(e.val().toString())+1)}),$("#replay_bar").show(),ft.add("mod+shift+e","Start/Stop Replay Recording","glyphicon-record",Vz).prop("id","dbg_record")}async function Hz(){if(Zi.shouldCompleteTour()){await dn("lib/bootstrap-tourist.js");var r=fe.startsWith("vcs"),e=[{element:"#platformsMenuButton",placement:"right",title:"Platform Selector",content:`You're currently on the "<b>`+fe+'</b>" platform. You can choose a different one from the menu.'},{element:"#preset_select",title:"Project Selector",content:"You can choose different code examples, create your own files, or import projects from GitHub."},{element:"#workspace",title:"Code Editor",content:r?"Type your 6502 assembly code into the editor, and it'll be assembled in real-time.":"Type your source code into the editor, and it'll be compiled in real-time."},{element:"#emulator",placement:"left",title:"Emulator",content:"We'll load your compiled code into the emulator whenever you make changes."},{element:"#debug_bar",placement:"bottom",title:"Debug Tools",content:"Use these buttons to set breakpoints, single step through code, pause/resume, and use debugging tools."},{element:"#dropdownMenuButton",title:"Main Menu",content:"Click the menu to create new files, download your code, or share your work with others."},{element:"#sidebar",title:"Sidebar",content:"Pull right to expose the sidebar. It lets you switch between source files, view assembly listings, and use other tools like Disassembler, Memory Browser, and Asset Editor."}];wo()&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Cookie Consent",content:'Before we start, we should tell you that this website stores persistent data in your browser. Review our <a href="/privacy.html" target="_new">privacy policy</a>.'}),e.push({element:"#booksMenuButton",placement:"left",title:"Books",content:"Get some books that explain how to program all of this stuff, and write some games!"})),Pa&&(e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Developer Analytics",content:"BTW, we send stack traces to sentry.io when exceptions are thrown. Hope that's ok."}),e.unshift({element:"#dropdownMenuButton",placement:"right",title:"Welcome to 8bitworkshop Desktop!",content:'The directory "~/8bitworkshop" contains all of your file edits and built ROM images. You can create new projects under the platform directories (e.g. "c64/myproject")'}));var t=new Tour({autoscroll:!1,steps:e,onEnd:()=>{Zi.completedTour()}});setTimeout(()=>{t.start()},2500)}}function Yu(r){var e=(r.message||r.error||r)+"";if(e.indexOf("QuotaExceededError")>=0)lz();else{var t=r.error||r.reason;t!=null&&t instanceof rf?GT(t):wo()&&ly(e,t,{platform:fe,window:F?F.getActiveID():"",errors:F.lasterrors||[]})}}function GT(r){console.log("haltEmulation"),Ii(),fW(r)}function Kz(){window.addEventListener("error",Yu),window.addEventListener("unhandledrejection",Yu)}function HT(){window.removeEventListener("error",Yu),window.removeEventListener("unhandledrejection",Yu)}function ro(r,e){e&&(de=e),HT(),r?window.location.replace("?"+$.param(de)):window.location.href="?"+$.param(de)}function qu(){fe&&(de.platform=fe),delete de[""],history.replaceState({},"","?"+$.param(de)+window.location.hash)}function KT(r){if(!r||r==="#")return null;var e=decodeURIComponent(r.substring(1));return e.startsWith("asseteditor/")?"#asseteditor":e.startsWith("headerview/")?(Gl(e.substring(11)),"#"+e):F.isWindow("#"+e)?"#"+e:F.isWindow(e)?e:null}function Jz(){function r(){let e=window.location.hash,t=e&&e!=="#"?KT(e):null;if(t)t!==F.getActiveID()&&F.createOrShow(t);else{Line truncated
|
|
|
|
|
`)>=0?(i.css({display:"inline-block","font-family":"monospace"}),n.split(`
|
|
|
|
|
`).forEach((s,o)=>{o&&i.append("<br>"),i.append(document.createTextNode(s))})):i.text(n)}t.append(document.createTextNode(" "+e.action)),r.append(" ")}return r.children().length>0}function Gz(){var r=$("#emucontrols");if(qz(r)){fe.endsWith(".mame")&&r.show();var e=$("#emulator").find("canvas");e&&(e.on("focus",()=>{P.isRunning()&&(r.fadeIn(200),P.resume())}),e.on("blur",()=>{r.fadeOut(200)}))}}async function Hz(){if(!ef[fe])throw Error("Invalid platform '"+fe+"'.");let r=$("#emuscreen")[0],e=Ju(de.options||"");P=new ef[fe](r,e),rW(),kr=new h0(P);let t=P.getPresets?P.getPresets():[];if(!de.file){var n=Zi.getLastPreset(),i=n||(_t?null:t[0].id);de.file=i||"DEFAULT",i||Re("There is no default main file for this project. Try selecting one from the pulldown.")}fe=="vcs"&&de.file.startsWith("examples/")&&!de.file.endsWith(".a")&&(de.file+=".a");var s=window.location.hash;Uu(),Fz(),s0(NT),q0(),await P.start(),await wz(),await iz(),await az(de.file),jz(s),Nz(),P.sourceFileFetch=o=>ae.filedata[o],zz(),!hs&&$("#shortcuts_bar").length&&(y0($("#shortcuts_bar")[0]),x0($z),w0(()=>{var o=F.id2div[F.activeid],a=o&&document.activeElement&&o.contains(document.activeElement),l=F.getActive(),c=a&&l&&l.getShortcuts?l.getShortcuts():[];return[...Qz(),...c]}),$(document).on("focusin focusout",()=>Xr()),Xr(),Pc(ta().showStatusBar)),Uz(),Gz(),er?Kz():(fc(),Jz(),Yz()),qT()}function Kz(){$("#dropdownMenuButton").hide(),$("#platformsMenuButton").hide(),$("#booksMenuButton").hide()}function Jz(){an(fe)=="nes"?$(".book-nes").addClass("book-active"):an(fe)=="vcs"?$(".book-vcs").addClass("book-active"):an(fe)=="verilog"?$(".book-verilog").addClass("book-active"):an(fe)=="c64"?$(".book-c64").addClass("book-active"):P.getToolForFilename(kt())=="sdcc"&&$(".book-arcade").addClass("book-active")}function qT(){setTimeout(()=>{$("#controls_dynamic").css("visibility","inherit")},250)}function eW(r){let e=xo(de.ignore)||er;st(!0),La(r,async t=>{if(t){var n=St(r);console.log("Importing "+t.length+" bytes as "+n);try{var i=await wn.getItem(n);st(!1),i!=null&&e||(i==null||confirm("Replace existing file '"+n+"'?"))&&await wn.setItem(n,t),delete de.importURL,de.file=n,Uu(),HT()}finally{st(!1)}}else Re("Could not load source code from URL: "+r),st(!1)},"text")}async function tW(){var r=xo(de.ignore),e=xo(de.force);er?r=!e:e=!1;for(var t=0;t<20;t++){let i=de["file"+t+"_name"],s=de["file"+t+"_data"];if(i==null||s==null)break;var n=await wn.getItem(i);if(!(r&&n)){let o=s;de["file"+t+"_type"]=="binary"&&(o=mc(atob(o))),(!n||e||confirm("Replace existing file '"+i+"'?"))&&await wn.setItem(i,o)}t==0&&(de.file=i),delete de["file"+t+"_name"],delete de["file"+t+"_data"],delete de["file"+t+"_type"]}delete de.ignore,delete de.force,Uu()}function rW(){var r=P.getPlatformName&&P.getPlatformName(),e=$('a[href="?platform='+fe+'"]');e.length&&(e.addClass("dropdown-item-checked"),r=r||e.text()||r),hc=r||fe,$(".platform_name").text(hc)}function nW(){if(fe=de.platform||Zi.getLastPlatformID(),_t=de.repo,!de.repo&&!de.file&&(_t=Zi.getLastRepoID(fe)),Mr&&_t&&_t!=="/"){var r=Js()[_t];r&&(console.log(fe,de,r),de.repo=_t,r.platform_id&&!de.platform&&(de.platform=fe=r.platform_id),r.mainPath&&!de.file&&(de.file=r.mainPath))}else _t="",delete de.repo;fe||(er&&ly("The 'platform' must be specified when embed=1"),fe=de.platform="vcs")}async function GT(){if(de.githubURL){_l(de.githubURL,!0);return}if(Mr&&de.repo&&!Js()[de.repo]&&de.repo!=="/"){if(confirm(`Repository '${de.repo}' was not found locally. Import it from GitHub?`)){_l("https://github.com/"+de.repo,!0);return}delete de.repo}if(nW(),pT({getPlatformId:()=>fe,isEmbed:er,hasLocalStorage:Mr,resizePlatform:()=>{P&&P.resize&&P.resize()},resizeWindows:()=>{F&&F.resize()},onTabChanged:r=>{go()&&(r!=="emulator"?P.isRunning()&&(Ii(),Yb=!0):Yb&&(Yb=!1,P.isRunning()||li()))}}),Oo=_t||ir(fe),er&&(Oo=(document.referrer||document.location.href)+Oo),wn=ch(Oo),de.importURL){eW(de.importURL);return}de.file0_name&&await tW(),HT()}async function HT(){try{var r=await u0(an(fe));console.log("starting platform",fe),await Hz(),F.titlePrefix=document.title+" ["+fe+"] - "+(_t?"["+_t+"] - ":""),F.updateTitle(F.getActiveID()||ae.mainPath)}catch(e){console.log(e),Re('Platform "'+fe+'" failed to load.')}finally{qT()}}var e0="__use_https";function KT(r){document.cookie=e0+"="+r+";domain=8bitworkshop.com;path=/;max-age=315360000"}function iW(){var r=bc(e0);if(typeof r=="string")return!!r;var e=Mr&&!localStorage.getItem("__lastplatform")?1:0;return KT(e),!!e}function sW(){bootbox.confirm('<p>Do you want to force the browser to use HTTPS from now on?</p><p>WARNING: This will make all of your local files unavailable, so you should "Download All Changes" first for each platform where you have done work.</p><p>You can go back to HTTP by setting the "'+e0+'" cookie to 0.</p>',r=>{r&&(KT(1),JT())})}function JT(){window.location.protocol=="http:"&&wo()&&(iW()?(jT(),window.location.replace(window.location.href.replace(/^http:/,"https:"))):$("#item_switch_https").c
Line truncated
|
|
|
|
|
`).forEach((s,o)=>{o&&i.append("<br>"),i.append(document.createTextNode(s))})):i.text(n)}t.append(document.createTextNode(" "+e.action)),r.append(" ")}return r.children().length>0}function nW(){var r=$("#emucontrols");if(rW(r)){fe.endsWith(".mame")&&r.show();var e=$("#emulator").find("canvas");e&&(e.on("focus",()=>{P.isRunning()&&(r.fadeIn(200),P.resume())}),e.on("blur",()=>{r.fadeOut(200)}))}}async function iW(){if(!tf[fe])throw Error("Invalid platform '"+fe+"'.");let r=$("#emuscreen")[0],e=ef(de.options||"");P=new tf[fe](r,e),cW(),kr=new u0(P);let t=P.getPresets?P.getPresets():[];if(!de.file){var n=Zi.getLastPreset(),i=n||(_t?null:t[0].id);de.file=i||"DEFAULT",i||Re("There is no default main file for this project. Try selecting one from the pulldown.")}fe=="vcs"&&de.file.startsWith("examples/")&&!de.file.endsWith(".a")&&(de.file+=".a");var s=window.location.hash;qu(),Kz(),o0(GT),G0(),await P.start(),await Az(),await hz(),await pz(de.file),eW(s),Jz(),P.sourceFileFetch=o=>ae.filedata[o],jz(),!hs&&$("#shortcuts_bar").length&&(S0($("#shortcuts_bar")[0]),w0(Rz),P0(()=>{var o=F.id2div[F.activeid],a=o&&document.activeElement&&o.contains(document.activeElement),l=F.getActive(),c=a&&l&&l.getShortcuts?l.getShortcuts():[];return[...Mz(),...c]}),$(document).on("focusin focusout",()=>zr()),zr(),kc(ra().showStatusBar)),tW(),nW(),er?sW():(pc(),oW(),Hz()),JT()}function sW(){$("#dropdownMenuButton").hide(),$("#platformsMenuButton").hide(),$("#booksMenuButton").hide()}function oW(){cn(fe)=="nes"?$(".book-nes").addClass("book-active"):cn(fe)=="vcs"?$(".book-vcs").addClass("book-active"):cn(fe)=="verilog"?$(".book-verilog").addClass("book-active"):cn(fe)=="c64"?$(".book-c64").addClass("book-active"):P.getToolForFilename(kt())=="sdcc"&&$(".book-arcade").addClass("book-active")}function JT(){setTimeout(()=>{$("#controls_dynamic").css("visibility","inherit")},250)}function aW(r){let e=xo(de.ignore)||er;st(!0),Da(r,async t=>{if(t){var n=St(r);console.log("Importing "+t.length+" bytes as "+n);try{var i=await Pn.getItem(n);st(!1),i!=null&&e||(i==null||confirm("Replace existing file '"+n+"'?"))&&await Pn.setItem(n,t),delete de.importURL,de.file=n,qu(),t_()}finally{st(!1)}}else Re("Could not load source code from URL: "+r),st(!1)},"text")}async function lW(){var r=xo(de.ignore),e=xo(de.force);er?r=!e:e=!1;for(var t=0;t<20;t++){let i=de["file"+t+"_name"],s=de["file"+t+"_data"];if(i==null||s==null)break;var n=await Pn.getItem(i);if(!(r&&n)){let o=s;de["file"+t+"_type"]=="binary"&&(o=Oc(atob(o))),(!n||e||confirm("Replace existing file '"+i+"'?"))&&await Pn.setItem(i,o)}t==0&&(de.file=i),delete de["file"+t+"_name"],delete de["file"+t+"_data"],delete de["file"+t+"_type"]}delete de.ignore,delete de.force,qu()}function cW(){var r=P.getPlatformName&&P.getPlatformName(),e=$('a[href="?platform='+fe+'"]');e.length&&(e.addClass("dropdown-item-checked"),r=r||e.text()||r),uc=r||fe,$(".platform_name").text(uc)}function dW(){if(fe=de.platform||Zi.getLastPlatformID(),_t=de.repo,!de.repo&&!de.file&&(_t=Zi.getLastRepoID(fe)),Lr&&_t&&_t!=="/"){var r=Js()[_t];r&&(console.log(fe,de,r),de.repo=_t,r.platform_id&&!de.platform&&(de.platform=fe=r.platform_id),r.mainPath&&!de.file&&(de.file=r.mainPath))}else _t="",delete de.repo;fe||(er&&cy("The 'platform' must be specified when embed=1"),fe=de.platform="vcs")}async function e_(){if(de.githubURL){Al(de.githubURL,!0);return}if(Lr&&de.repo&&!Js()[de.repo]&&de.repo!=="/"){if(confirm(`Repository '${de.repo}' was not found locally. Import it from GitHub?`)){Al("https://github.com/"+de.repo,!0);return}delete de.repo}if(dW(),bT({getPlatformId:()=>fe,isEmbed:er,hasLocalStorage:Lr,resizePlatform:()=>{P&&P.resize&&P.resize()},resizeWindows:()=>{F&&F.resize()},onTabChanged:r=>{go()&&(r!=="emulator"?P.isRunning()&&(Ii(),Fb=!0):Fb&&(Fb=!1,P.isRunning()||li()))}}),Oo=_t||ir(fe),er&&(Oo=(document.referrer||document.location.href)+Oo),Pn=ch(Oo),de.importURL){aW(de.importURL);return}de.file0_name&&await lW(),t_()}async function t_(){try{var r=await f0(cn(fe));console.log("starting platform",fe),await iW(),F.titlePrefix=document.title+" ["+fe+"] - "+(_t?"["+_t+"] - ":""),F.updateTitle(F.getActiveID()||ae.mainPath)}catch(e){console.log(e),Re('Platform "'+fe+'" failed to load.')}finally{JT()}}var t0="__use_https";function r_(r){document.cookie=t0+"="+r+";domain=8bitworkshop.com;path=/;max-age=315360000"}function hW(){var r=yc(t0);if(typeof r=="string")return!!r;var e=Lr&&!localStorage.getItem("__lastplatform")?1:0;return r_(e),!!e}function uW(){bootbox.confirm('<p>Do you want to force the browser to use HTTPS from now on?</p><p>WARNING: This will make all of your local files unavailable, so you should "Download All Changes" first for each platform where you have done work.</p><p>You can go back to HTTP by setting the "'+t0+'" cookie to 0.</p>',r=>{r&&(r_(1),n_())})}function n_(){window.location.protocol=="http:"&&wo()&&(hW()?(HT(),window.location.replace(window.location.href.replace(/^http:/,"https:"))):$("#item_switch_https").c
Line truncated
|
|
|
|
|
/*! Bundled license information:
|
|
|
|
|
|
|
|
|
|
localforage/dist/localforage.js:
|
|
|
|
|