|
|
|
@@ -1,36 +1,37 @@
|
|
|
|
|
import{a as lc,b as ko,c as pw}from"./chunk-JSIZCY7X.js";import{a as $g}from"./chunk-LNOKARBD.js";import{a as wg,b as Pg,c as mw}from"./chunk-427YVGD6.js";import{D as Qu,J as yu,t as xg,u as vg}from"./chunk-ZBO3TMVB.js";import{A as Zs,E as hr,F as gu,G as Po,I as oc,J as Sg,K as bu,T as Su,V as Qg,a as ln,b as ma,ba as ac,ca as yg,d as ai,da as ba,e as mu,f as li,g as ut,k as pg,m as tc,n as ic,o as rc,p as Es,q as mg,t as nc,w as gg,x as bg,y as sc,z as Qi}from"./chunk-NIHHDIEJ.js";import{a as zi,b as ec,c as pa,d as du,e as pu}from"./chunk-KT7KMEQC.js";var vu=du((kg,xu)=>{(function(i){if(typeof kg=="object"&&typeof xu!="undefined")xu.exports=i();else if(typeof define=="function"&&define.amd)define([],i);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=i()}})(function(){var i,e,t;return(function r(n,s,o){function a(h,O){if(!s[h]){if(!n[h]){var m=typeof pa=="function"&&pa;if(!O&&m)return m(h,!0);if(l)return l(h,!0);var b=new Error("Cannot find module '"+h+"'");throw b.code="MODULE_NOT_FOUND",b}var y=s[h]={exports:{}};n[h][0].call(y.exports,function(P){var X=n[h][1][P];return a(X||P)},y,y.exports,r,n,s,o)}return s[h].exports}for(var l=typeof pa=="function"&&pa,f=0;f<o.length;f++)a(o[f]);return a})({1:[function(r,n,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,l;if(a){var f=0,h=new a(P),O=o.document.createTextNode("");h.observe(O,{characterData:!0}),l=function(){O.data=f=++f%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var m=new o.MessageChannel;m.port1.onmessage=P,l=function(){m.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var Y=o.document.createElement("script");Y.onreadystatechange=function(){P(),Y.onreadystatechange=null,Y.parentNode.removeChild(Y),Y=null},o.document.documentElement.appendChild(Y)}:l=function(){setTimeout(P,0)};var b,y=[];function P(){b=!0;for(var Y,G,q=y.length;q;){for(G=y,y=[],Y=-1;++Y<q;)G[Y]();q=y.length}b=!1}n.exports=X;function X(Y){y.push(Y)===1&&!b&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(r,n,s){"use strict";var o=r(1);function a(){}var l={},f=["REJECTED"],h=["FULFILLED"],O=["PENDING"];n.exports=m;function m(d){if(typeof d!="function")throw new TypeError("resolver must be a function");this.state=O,this.queue=[],this.outcome=void 0,d!==a&&X(this,d)}m.prototype.catch=function(d){return this.then(null,d)},m.prototype.then=function(d,j){if(typeof d!="function"&&this.state===h||typeof j!="function"&&this.state===f)return this;var H=new this.constructor(a);if(this.state!==O){var Oe=this.state===h?d:j;y(H,Oe,this.outcome)}else this.queue.push(new b(H,d,j));return H};function b(d,j,H){this.promise=d,typeof j=="function"&&(this.onFulfilled=j,this.callFulfilled=this.otherCallFulfilled),typeof H=="function"&&(this.onRejected=H,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(d){l.resolve(this.promise,d)},b.prototype.otherCallFulfilled=function(d){y(this.promise,this.onFulfilled,d)},b.prototype.callRejected=function(d){l.reject(this.promise,d)},b.prototype.otherCallRejected=function(d){y(this.promise,this.onRejected,d)};function y(d,j,H){o(function(){var Oe;try{Oe=j(H)}catch(Ee){return l.reject(d,Ee)}Oe===d?l.reject(d,new TypeError("Cannot resolve promise with itself")):l.resolve(d,Oe)})}l.resolve=function(d,j){var H=Y(P,j);if(H.status==="error")return l.reject(d,H.value);var Oe=H.value;if(Oe)X(d,Oe);else{d.state=h,d.outcome=j;for(var Ee=-1,ge=d.queue.length;++Ee<ge;)d.queue[Ee].callFulfilled(j)}return d},l.reject=function(d,j){d.state=f,d.outcome=j;for(var H=-1,Oe=d.queue.length;++H<Oe;)d.queue[H].callRejected(j);return d};function P(d){var j=d&&d.then;if(d&&(typeof d=="object"||typeof d=="function")&&typeof j=="function")return function(){j.apply(d,arguments)}}function X(d,j){var H=!1;function Oe(ke){H||(H=!0,l.reject(d,ke))}function Ee(ke){H||(H=!0,l.resolve(d,ke))}function ge(){j(Ee,Oe)}var ie=Y(ge);ie.status==="error"&&Oe(ie.value)}function Y(d,j){var H={};try{H.value=d(j),H.status="success"}catch(Oe){H.status="error",H.value=Oe}return H}m.resolve=G;function G(d){return d instanceof this?d:l.resolve(new this(a),d)}m.reject=q;function q(d){var j=new this(a);return l.reject(j,d)}m.all=N;function N(d){var j=this;if(Object.prototype.toString.call(d)!=="[object Array]")return this.reject(new TypeError("must be an array"));var H=d.length,Oe=!1;if(!H)return this.resolve([]);for(var Ee=new Array(H),ge=0,ie=-1,ke=new this(a);++ie<H;)Ze(d[ie],ie);return ke;function Ze(Be,te){j.resolve(Be).then(ye,function(ce){Oe||(Oe=!0,l.reject(ke,ce))});function ye(ce){Ee[te]=ce,++ge===H&&!Oe&&(Oe=!0,l.resolve(ke,Ee))}}}m.race=V;function V(d){var j=this;if(Object.prototype.toString.call(d)!=="[object Array]")return this.reject(new TypeError("must be an array"));var H=d.length,Oe=!1;iLine truncated
|
|
|
|
|
`):c)),u};var eu=/^(?:focusinfocus|focusoutblur)$/,Gl=function(c){c.stopPropagation()};d.extend(d.event,{trigger:function(c,u,p,g){var S,Q,v,R,_,z,B,ee,W=[p||X],oe=h.call(c,"type")?c.type:c,Ve=h.call(c,"namespace")?c.namespace.split("."):[];if(Q=ee=v=p=p||X,!(p.nodeType===3||p.nodeType===8)&&!eu.test(oe+d.event.triggered)&&(oe.indexOf(".")>-1&&(Ve=oe.split("."),oe=Ve.shift(),Ve.sort()),_=oe.indexOf(":")<0&&"on"+oe,c=c[d.expando]?c:new d.Event(oe,typeof c=="object"&&c),c.isTrigger=g?2:3,c.namespace=Ve.join("."),c.rnamespace=c.namespace?new RegExp("(^|\\.)"+Ve.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=void 0,c.target||(c.target=p),u=u==null?[c]:d.makeArray(u,[c]),B=d.event.special[oe]||{},!(!g&&B.trigger&&B.trigger.apply(p,u)===!1))){if(!g&&!B.noBubble&&!P(p)){for(R=B.delegateType||oe,eu.test(R+oe)||(Q=Q.parentNode);Q;Q=Q.parentNode)W.push(Q),v=Q;v===(p.ownerDocument||X)&&W.push(v.defaultView||v.parentWindow||i)}for(S=0;(Q=W[S++])&&!c.isPropagationStopped();)ee=Q,c.type=S>1?R:B.bindType||oe,z=(we.get(Q,"events")||Object.create(null))[c.type]&&we.get(Q,"handle"),z&&z.apply(Q,u),z=_&&Q[_],z&&z.apply&&nr(Q)&&(c.result=z.apply(Q,u),c.result===!1&&c.preventDefault());return c.type=oe,!g&&!c.isDefaultPrevented()&&(!B._default||B._default.apply(W.pop(),u)===!1)&&nr(p)&&_&&y(p[oe])&&!P(p)&&(v=p[_],v&&(p[_]=null),d.event.triggered=oe,c.isPropagationStopped()&&ee.addEventListener(oe,Gl),p[oe](),c.isPropagationStopped()&&ee.removeEventListener(oe,Gl),d.event.triggered=void 0,v&&(p[_]=v)),c.result}},simulate:function(c,u,p){var g=d.extend(new d.Event,p,{type:c,isSimulated:!0});d.event.trigger(g,null,u)}}),d.fn.extend({trigger:function(c,u){return this.each(function(){d.event.trigger(c,u,this)})},triggerHandler:function(c,u){var p=this[0];if(p)return d.event.trigger(c,u,p,!0)}});var tu=/\[\]$/,fa=/\r?\n/g,N1=/^(?:submit|button|image|reset|file)$/i,B1=/^(?:input|select|textarea|keygen)/i;function iu(c,u,p,g){var S;if(Array.isArray(u))d.each(u,function(Q,v){p||tu.test(c)?g(c,v):iu(c+"["+(typeof v=="object"&&v!=null?Q:"")+"]",v,p,g)});else if(!p&&q(u)==="object")for(S in u)iu(c+"["+S+"]",u[S],p,g);else g(c,u)}d.param=function(c,u){var p,g=[],S=function(Q,v){var R=y(v)?v():v;g[g.length]=encodeURIComponent(Q)+"="+encodeURIComponent(R==null?"":R)};if(c==null)return"";if(Array.isArray(c)||c.jquery&&!d.isPlainObject(c))d.each(c,function(){S(this.name,this.value)});else for(p in c)iu(p,c[p],u,S);return g.join("&")},d.fn.extend({serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var c=d.prop(this,"elements");return c?d.makeArray(c):this}).filter(function(){var c=this.type;return this.name&&!d(this).is(":disabled")&&B1.test(this.nodeName)&&!N1.test(c)&&(this.checked||!Wt.test(c))}).map(function(c,u){var p=d(this).val();return p==null?null:Array.isArray(p)?d.map(p,function(g){return{name:u.name,value:g.replace(fa,`\r
|
|
|
|
|
import{a as hc,b as ko,c as P1}from"./chunk-JSIZCY7X.js";import{a as Rg}from"./chunk-LNOKARBD.js";import{a as _g,b as Cg,c as k1}from"./chunk-KJNUV3FX.js";import{D as $u,J as Pu,t as Tg,u as Xg}from"./chunk-ZBO3TMVB.js";import{A as Zs,E as fr,F as xu,G as Po,I as lc,J as $g,K as yu,T as wu,V as Pg,a as cn,b as ba,ba as cc,ca as kg,d as li,da as Sa,e as Su,f as ci,g as ht,h as Qu,k as xg,m as rc,n as nc,o as sc,p as Es,q as yg,t as oc,w as wg,x as vu,y as ac,z as Qi}from"./chunk-NIHHDIEJ.js";import{a as zi,b as ic,c as ma,d as gu,e as bu}from"./chunk-KT7KMEQC.js";var Tu=gu((Ag,ku)=>{(function(i){if(typeof Ag=="object"&&typeof ku!="undefined")ku.exports=i();else if(typeof define=="function"&&define.amd)define([],i);else{var e;typeof window!="undefined"?e=window:typeof global!="undefined"?e=global:typeof self!="undefined"?e=self:e=this,e.localforage=i()}})(function(){var i,e,t;return(function r(n,s,o){function a(f,O){if(!s[f]){if(!n[f]){var m=typeof ma=="function"&&ma;if(!O&&m)return m(f,!0);if(l)return l(f,!0);var b=new Error("Cannot find module '"+f+"'");throw b.code="MODULE_NOT_FOUND",b}var v=s[f]={exports:{}};n[f][0].call(v.exports,function(P){var T=n[f][1][P];return a(T||P)},v,v.exports,r,n,s,o)}return s[f].exports}for(var l=typeof ma=="function"&&ma,h=0;h<o.length;h++)a(o[h]);return a})({1:[function(r,n,s){(function(o){"use strict";var a=o.MutationObserver||o.WebKitMutationObserver,l;if(a){var h=0,f=new a(P),O=o.document.createTextNode("");f.observe(O,{characterData:!0}),l=function(){O.data=h=++h%2}}else if(!o.setImmediate&&typeof o.MessageChannel!="undefined"){var m=new o.MessageChannel;m.port1.onmessage=P,l=function(){m.port2.postMessage(0)}}else"document"in o&&"onreadystatechange"in o.document.createElement("script")?l=function(){var Y=o.document.createElement("script");Y.onreadystatechange=function(){P(),Y.onreadystatechange=null,Y.parentNode.removeChild(Y),Y=null},o.document.documentElement.appendChild(Y)}:l=function(){setTimeout(P,0)};var b,v=[];function P(){b=!0;for(var Y,B,q=v.length;q;){for(B=v,v=[],Y=-1;++Y<q;)B[Y]();q=v.length}b=!1}n.exports=T;function T(Y){v.push(Y)===1&&!b&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(r,n,s){"use strict";var o=r(1);function a(){}var l={},h=["REJECTED"],f=["FULFILLED"],O=["PENDING"];n.exports=m;function m(d){if(typeof d!="function")throw new TypeError("resolver must be a function");this.state=O,this.queue=[],this.outcome=void 0,d!==a&&T(this,d)}m.prototype.catch=function(d){return this.then(null,d)},m.prototype.then=function(d,j){if(typeof d!="function"&&this.state===f||typeof j!="function"&&this.state===h)return this;var F=new this.constructor(a);if(this.state!==O){var Oe=this.state===f?d:j;v(F,Oe,this.outcome)}else this.queue.push(new b(F,d,j));return F};function b(d,j,F){this.promise=d,typeof j=="function"&&(this.onFulfilled=j,this.callFulfilled=this.otherCallFulfilled),typeof F=="function"&&(this.onRejected=F,this.callRejected=this.otherCallRejected)}b.prototype.callFulfilled=function(d){l.resolve(this.promise,d)},b.prototype.otherCallFulfilled=function(d){v(this.promise,this.onFulfilled,d)},b.prototype.callRejected=function(d){l.reject(this.promise,d)},b.prototype.otherCallRejected=function(d){v(this.promise,this.onRejected,d)};function v(d,j,F){o(function(){var Oe;try{Oe=j(F)}catch(Ye){return l.reject(d,Ye)}Oe===d?l.reject(d,new TypeError("Cannot resolve promise with itself")):l.resolve(d,Oe)})}l.resolve=function(d,j){var F=Y(P,j);if(F.status==="error")return l.reject(d,F.value);var Oe=F.value;if(Oe)T(d,Oe);else{d.state=f,d.outcome=j;for(var Ye=-1,ge=d.queue.length;++Ye<ge;)d.queue[Ye].callFulfilled(j)}return d},l.reject=function(d,j){d.state=h,d.outcome=j;for(var F=-1,Oe=d.queue.length;++F<Oe;)d.queue[F].callRejected(j);return d};function P(d){var j=d&&d.then;if(d&&(typeof d=="object"||typeof d=="function")&&typeof j=="function")return function(){j.apply(d,arguments)}}function T(d,j){var F=!1;function Oe(Te){F||(F=!0,l.reject(d,Te))}function Ye(Te){F||(F=!0,l.resolve(d,Te))}function ge(){j(Ye,Oe)}var ie=Y(ge);ie.status==="error"&&Oe(ie.value)}function Y(d,j){var F={};try{F.value=d(j),F.status="success"}catch(Oe){F.status="error",F.value=Oe}return F}m.resolve=B;function B(d){return d instanceof this?d:l.resolve(new this(a),d)}m.reject=q;function q(d){var j=new this(a);return l.reject(j,d)}m.all=N;function N(d){var j=this;if(Object.prototype.toString.call(d)!=="[object Array]")return this.reject(new TypeError("must be an array"));var F=d.length,Oe=!1;if(!F)return this.resolve([]);for(var Ye=new Array(F),ge=0,ie=-1,Te=new this(a);++ie<F;)Ze(d[ie],ie);return Te;function Ze(Be,te){j.resolve(Be).then(ve,function(ce){Oe||(Oe=!0,l.reject(Te,ce))});function ve(ce){Ye[te]=ce,++ge===F&&!Oe&&(Oe=!0,l.resolve(Te,Ye))}}}m.race=M;function M(d){var j=this;if(Object.prototype.toString.call(d)!=="[object Array]")return this.reject(new TypeError("must be an array"));var F=d.lengthLine truncated
|
|
|
|
|
`):c)),u};var ru=/^(?:focusinfocus|focusoutblur)$/,Hl=function(c){c.stopPropagation()};d.extend(d.event,{trigger:function(c,u,p,g){var S,Q,y,R,_,z,G,ee,W=[p||T],oe=f.call(c,"type")?c.type:c,Ve=f.call(c,"namespace")?c.namespace.split("."):[];if(Q=ee=y=p=p||T,!(p.nodeType===3||p.nodeType===8)&&!ru.test(oe+d.event.triggered)&&(oe.indexOf(".")>-1&&(Ve=oe.split("."),oe=Ve.shift(),Ve.sort()),_=oe.indexOf(":")<0&&"on"+oe,c=c[d.expando]?c:new d.Event(oe,typeof c=="object"&&c),c.isTrigger=g?2:3,c.namespace=Ve.join("."),c.rnamespace=c.namespace?new RegExp("(^|\\.)"+Ve.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=void 0,c.target||(c.target=p),u=u==null?[c]:d.makeArray(u,[c]),G=d.event.special[oe]||{},!(!g&&G.trigger&&G.trigger.apply(p,u)===!1))){if(!g&&!G.noBubble&&!P(p)){for(R=G.delegateType||oe,ru.test(R+oe)||(Q=Q.parentNode);Q;Q=Q.parentNode)W.push(Q),y=Q;y===(p.ownerDocument||T)&&W.push(y.defaultView||y.parentWindow||i)}for(S=0;(Q=W[S++])&&!c.isPropagationStopped();)ee=Q,c.type=S>1?R:G.bindType||oe,z=(we.get(Q,"events")||Object.create(null))[c.type]&&we.get(Q,"handle"),z&&z.apply(Q,u),z=_&&Q[_],z&&z.apply&&nr(Q)&&(c.result=z.apply(Q,u),c.result===!1&&c.preventDefault());return c.type=oe,!g&&!c.isDefaultPrevented()&&(!G._default||G._default.apply(W.pop(),u)===!1)&&nr(p)&&_&&v(p[oe])&&!P(p)&&(y=p[_],y&&(p[_]=null),d.event.triggered=oe,c.isPropagationStopped()&&ee.addEventListener(oe,Hl),p[oe](),c.isPropagationStopped()&&ee.removeEventListener(oe,Hl),d.event.triggered=void 0,y&&(p[_]=y)),c.result}},simulate:function(c,u,p){var g=d.extend(new d.Event,p,{type:c,isSimulated:!0});d.event.trigger(g,null,u)}}),d.fn.extend({trigger:function(c,u){return this.each(function(){d.event.trigger(c,u,this)})},triggerHandler:function(c,u){var p=this[0];if(p)return d.event.trigger(c,u,p,!0)}});var nu=/\[\]$/,fa=/\r?\n/g,n1=/^(?:submit|button|image|reset|file)$/i,s1=/^(?:input|select|textarea|keygen)/i;function su(c,u,p,g){var S;if(Array.isArray(u))d.each(u,function(Q,y){p||nu.test(c)?g(c,y):su(c+"["+(typeof y=="object"&&y!=null?Q:"")+"]",y,p,g)});else if(!p&&q(u)==="object")for(S in u)su(c+"["+S+"]",u[S],p,g);else g(c,u)}d.param=function(c,u){var p,g=[],S=function(Q,y){var R=v(y)?y():y;g[g.length]=encodeURIComponent(Q)+"="+encodeURIComponent(R==null?"":R)};if(c==null)return"";if(Array.isArray(c)||c.jquery&&!d.isPlainObject(c))d.each(c,function(){S(this.name,this.value)});else for(p in c)su(p,c[p],u,S);return g.join("&")},d.fn.extend({serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var c=d.prop(this,"elements");return c?d.makeArray(c):this}).filter(function(){var c=this.type;return this.name&&!d(this).is(":disabled")&&s1.test(this.nodeName)&&!n1.test(c)&&(this.checked||!Wt.test(c))}).map(function(c,u){var p=d(this).val();return p==null?null:Array.isArray(p)?d.map(p,function(g){return{name:u.name,value:g.replace(fa,`\r
|
|
|
|
|
`)}}):{name:u.name,value:p.replace(fa,`\r
|
|
|
|
|
`)}}).get()}});var G1=/%20/g,F1=/#.*$/,H1=/([?&])_=[^&]*/,K1=/^(.*?):[ \t]*([^\r\n]*)$/mg,J1=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ew=/^(?:GET|HEAD)$/,tw=/^\/\//,ag={},ru={},lg="*/".concat("*"),nu=X.createElement("a");nu.href=vn.href;function cg(c){return function(u,p){typeof u!="string"&&(p=u,u="*");var g,S=0,Q=u.toLowerCase().match(Oi)||[];if(y(p))for(;g=Q[S++];)g[0]==="+"?(g=g.slice(1)||"*",(c[g]=c[g]||[]).unshift(p)):(c[g]=c[g]||[]).push(p)}}function fg(c,u,p,g){var S={},Q=c===ru;function v(R){var _;return S[R]=!0,d.each(c[R]||[],function(z,B){var ee=B(u,p,g);if(typeof ee=="string"&&!Q&&!S[ee])return u.dataTypes.unshift(ee),v(ee),!1;if(Q)return!(_=ee)}),_}return v(u.dataTypes[0])||!S["*"]&&v("*")}function su(c,u){var p,g,S=d.ajaxSettings.flatOptions||{};for(p in u)u[p]!==void 0&&((S[p]?c:g||(g={}))[p]=u[p]);return g&&d.extend(!0,c,g),c}function iw(c,u,p){for(var g,S,Q,v,R=c.contents,_=c.dataTypes;_[0]==="*";)_.shift(),g===void 0&&(g=c.mimeType||u.getResponseHeader("Content-Type"));if(g){for(S in R)if(R[S]&&R[S].test(g)){_.unshift(S);break}}if(_[0]in p)Q=_[0];else{for(S in p){if(!_[0]||c.converters[S+" "+_[0]]){Q=S;break}v||(v=S)}Q=Q||v}if(Q)return Q!==_[0]&&_.unshift(Q),p[Q]}function rw(c,u,p,g){var S,Q,v,R,_,z={},B=c.dataTypes.slice();if(B[1])for(v in c.converters)z[v.toLowerCase()]=c.converters[v];for(Q=B.shift();Q;)if(c.responseFields[Q]&&(p[c.responseFields[Q]]=u),!_&&g&&c.dataFilter&&(u=c.dataFilter(u,c.dataType)),_=Q,Q=B.shift(),Q){if(Q==="*")Q=_;else if(_!=="*"&&_!==Q){if(v=z[_+" "+Q]||z["* "+Q],!v){for(S in z)if(R=S.split(" "),R[1]===Q&&(v=z[_+" "+R[0]]||z["* "+R[0]],v)){v===!0?v=z[S]:z[S]!==!0&&(Q=R[0],B.unshift(R[1]));break}}if(v!==!0)if(v&&c.throws)u=v(u);else try{u=v(u)}catch(ee){return{state:"parsererror",error:v?ee:"No conversion from "+_+" to "+Q}}}}return{state:"success",data:u}}d.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:vn.href,type:"GET",isLocal:J1.test(vn.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":lg,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":d.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(c,u){return u?su(su(c,d.ajaxSettings),u):su(d.ajaxSettings,c)},ajaxPrefilter:cg(ag),ajaxTransport:cg(ru),ajax:function(c,u){typeof c=="object"&&(u=c,c=void 0),u=u||{};var p,g,S,Q,v,R,_,z,B,ee,W=d.ajaxSetup({},u),oe=W.context||W,Ve=W.context&&(oe.nodeType||oe.jquery)?d(oe):d.event,st=d.Deferred(),Ie=d.Callbacks("once memory"),Jt=W.statusCode||{},qt={},rn={},nn="canceled",et={readyState:0,getResponseHeader:function(ct){var Yt;if(_){if(!Q)for(Q={};Yt=K1.exec(S);)Q[Yt[1].toLowerCase()+" "]=(Q[Yt[1].toLowerCase()+" "]||[]).concat(Yt[2]);Yt=Q[ct.toLowerCase()+" "]}return Yt==null?null:Yt.join(", ")},getAllResponseHeaders:function(){return _?S:null},setRequestHeader:function(ct,Yt){return _==null&&(ct=rn[ct.toLowerCase()]=rn[ct.toLowerCase()]||ct,qt[ct]=Yt),this},overrideMimeType:function(ct){return _==null&&(W.mimeType=ct),this},statusCode:function(ct){var Yt;if(ct)if(_)et.always(ct[et.status]);else for(Yt in ct)Jt[Yt]=[Jt[Yt],ct[Yt]];return this},abort:function(ct){var Yt=ct||nn;return p&&p.abort(Yt),As(0,Yt),this}};if(st.promise(et),W.url=((c||W.url||vn.href)+"").replace(tw,vn.protocol+"//"),W.type=u.method||u.type||W.method||W.type,W.dataTypes=(W.dataType||"*").toLowerCase().match(Oi)||[""],W.crossDomain==null){R=X.createElement("a");try{R.href=W.url,R.href=R.href,W.crossDomain=nu.protocol+"//"+nu.host!=R.protocol+"//"+R.host}catch(ct){W.crossDomain=!0}}if(W.data&&W.processData&&typeof W.data!="string"&&(W.data=d.param(W.data,W.traditional)),fg(ag,W,u,et),_)return et;z=d.event&&W.global,z&&d.active++===0&&d.event.trigger("ajaxStart"),W.type=W.type.toUpperCase(),W.hasContent=!ew.test(W.type),g=W.url.replace(F1,""),W.hasContent?W.data&&W.processData&&(W.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(W.data=W.data.replace(G1,"+")):(ee=W.url.slice(g.length),W.data&&(W.processData||typeof W.data=="string")&&(g+=(Cs.test(g)?"&":"?")+W.data,delete W.data),W.cache===!1&&(g=g.replace(H1,"$1"),ee=(Cs.test(g)?"&":"?")+"_="+Bl.guid+++ee),W.url=g+ee),W.ifModified&&(d.lastModified[g]&&et.setRequestHeader("If-Modified-Since",d.lastModified[g]),d.etag[g]&&et.setRequestHeader("If-None-Match",d.etag[g])),(W.data&&W.hasContent&&W.contentType!==!1||u.contentType)&&et.setRequestHeader("Content-Type",W.contentType),et.setRequestHeader("Accept",W.dataTypes[0]&&W.accepts[W.dataTypes[0]]?W.accepts[W.dataTypes[0]]+(W.dataTypes[0]!=="*"?", "+lg+"; q=0.01":""):W.accepts["*"]);for(B in W.headers)et.setRequestHeader(B,W.headers[B]);if(W.beforeSend&&(W.beforeSend.call(oe,et,W)===!1||_))return et.abort();if(nn="ab
Line truncated
|
|
|
|
|
`+Vt),kr&&Wh([ie,ke,Ze],Gt=>{Vt=El(Vt,Gt," ")}),N&&Fr?N.createHTML(Vt):Vt},e.setConfig=function(){let Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};or(Pe),Ft=!0},e.clearConfig=function(){en=null,Ft=!1},e.isValidAttribute=function(Pe,A,ae){en||or({});let xe=kt(Pe),pt=kt(A);return Cr(xe,pt,ae)},e.addHook=function(Pe,A){typeof A=="function"&&Yl(ge[Pe],A)},e.removeHook=function(Pe,A){if(A!==void 0){let ae=iA(ge[Pe],A);return ae===-1?void 0:rA(ge[Pe],ae,1)[0]}return O1(ge[Pe])},e.removeHooks=function(Pe){ge[Pe]=[]},e.removeAllHooks=function(){ge=S1()},e}var QA=v1();w1.exports=QA});var Km=pu(vu());function Us(i,e,t,r){window.ga&&ga("send","event",i,e,t,r)}function Tg(i){window.ga&&ga("send","pageview",i)}function vt(i){i?(Yr(0),$("#pleaseWaitModal").modal("show")):(Yr(1),$("#pleaseWaitModal").modal("hide"))}function Yr(i){$("#pleaseWaitProgressBar").css("width",i*100+"%").show()}function Ge(i){vt(!1),bootbox.alert({title:'<span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Alert',message:ko.sanitize(i)})}function Li(i){vt(!1),bootbox.alert(ko.sanitize(i))}function Xg(i){throw Ge(i),new Error(i)}var Sa=class{constructor(e,t){e=e||[],this.lines=e,this.text=t,this.offset2loc=new Map,this.line2offset=new Map;for(var r of e)r.offset>=0&&(this.offset2loc[r.offset]||(this.offset2loc[r.offset]=r),this.line2offset[r.line]||(this.line2offset[r.line]=r.offset))}findLineForOffset(e,t){if(this.offset2loc)for(var r=0;r<=t;r++){var n=this.offset2loc[e];if(n)return n;e--}return null}lineCount(){return this.lines.length}};function _g(i){return"errors"in i}function Rg(i){return"output"in i}var Cg=pu(vu()),cc=class{constructor(e){this.preset_id=Qi(e)}async getRemoteFile(e){return new Promise((t,r)=>sc(e,t,Es(e)?"arraybuffer":"text"))}async getFileData(e){var t="presets/"+this.preset_id+"/"+e,r=await this.getRemoteFile(t);return r&&console.log("read",t,r.length,"bytes"),r}async setFileData(e,t){}};var To=class{constructor(e,t){this.basefs=e,this.overlayfs=t}async getFileData(e){var t=await this.overlayfs.getFileData(e);return t==null?this.basefs.getFileData(e):t}async setFileData(e,t){return await this.overlayfs.setFileData(e,t),this.basefs.setFileData(e,t)}},fc=class{constructor(e){this.store=e}async getFileData(e){return this.store.getItem(e)}async setFileData(e,t){return this.store.setItem(e,t)}};var hc=class{constructor(e,t,r,n){this.filedata={};this.pendingWorkerMessages=0;this.tools_preloaded={};this.isCompiling=!1;this.filename2path={};this.worker=e,this.platform_id=t,this.platform=r,this.filesystem=n,e.onmessage=s=>{this.receiveWorkerMessage(s.data)}}receiveWorkerMessage(e){var t=this.pendingWorkerMessages>1;t?(this.sendBuild(),this.pendingWorkerMessages=1):(this.callbackBuildStatus&&this.callbackBuildStatus(!1),this.isCompiling||(console.log(this.pendingWorkerMessages),console.trace()),this.isCompiling=!1,this.pendingWorkerMessages=0),e&&Rg(e)?this.processBuildResult(e):_g(e)&&this.processBuildListings(e),this.callbackBuildResult(e)}getToolForFilename(e){return this.remoteTool?"remote:"+this.remoteTool:this.platform.getToolForFilename(e)}preloadWorker(e){var t=this.getToolForFilename(e);t&&!this.tools_preloaded[t]&&(this.worker.postMessage({preload:t,platform:this.platform_id}),this.tools_preloaded[t]=!0)}pushAllFiles(e,t){e.push(t);var r=mu(this.mainPath);r.length>0&&r!="local"&&e.push(r+"/"+t)}parseIncludeDependencies(e){let t=[],r;if(this.platform_id.startsWith("verilog")){let n=/^\s*(`include|[.]include)\s+"(.+?)"/gmi;for(;r=n.exec(e);)this.pushAllFiles(t,r[2]);let s=/^\s*\$(include|\$dofile|\$write_image_in_table)\('(.+?)'/gmi;for(;r=s.exec(e);)this.pushAllFiles(t,r[2]);let o=/^\s*([.]arch)\s+(\w+)/gmi;for(;r=o.exec(e);)this.pushAllFiles(t,r[2]+".json");let a=/\$readmem[bh]\("(.+?)"/gmi;for(;r=a.exec(e);)this.pushAllFiles(t,r[1])}else{let n=/^\s*[.#%]?(include|incbin|embed)\s+"(.+?)"/gmi;for(;r=n.exec(e);)this.pushAllFiles(t,r[2]);let s=/^\s*([;']|[/][/])#(resource)\s+"(.+?)"/gm;for(;r=s.exec(e);)this.pushAllFiles(t,r[3]);let o=/^\s+(USE|ASM)\s+(\S+[.]\S+)/gm;for(;r=o.exec(e);)this.pushAllFiles(t,r[2]);let a=/^\s*(import|embed)\s*"(.+?)";/gmi;for(;r=a.exec(e);)r[1]=="import"?this.pushAllFiles(t,r[2]+".wiz"):this.pushAllFiles(t,r[2]);let l=/^\s*(import)\s*"(.+?)"/gmi;for(;r=l.exec(e);)this.pushAllFiles(t,r[2]);let f=/^[!]src\s+"(.+?)"/gmi;for(;r=f.exec(e);)this.pushAllFiles(t,r[1])}return t}parseLinkDependencies(e){let t=[],r;if(!this.platform_id.startsWith("verilog")){let n=/^\s*([;]|[/][/])#link\s+"(.+?)"/gm;for(;r=n.exec(e);)this.pushAllFiles(t,r[2])}return t}loadFileDependencies(e){let t=this.parseIncludeDependencies(e),r=this.parseLinkDependencies(e),n=t.concat(r);return this.loadFiles(n).then(s=>{if(s)for(let o of s)o.link=r.indexOf(o.path)>=0;return s})}okToSend(){return this.pendingWorkerMessages++==0&&this.mainPath!=null}updateFileInStore(e,t){this.filesystem.setFileData(e,t)}buildWorkerMessage(e){this.preloadWorker(this.mainPath);var t={updates:[],buildsteps:[]},r=this.stripLocalLine truncated
|
|
|
|
|
`)}}).get()}});var o1=/%20/g,a1=/#.*$/,l1=/([?&])_=[^&]*/,c1=/^(.*?):[ \t]*([^\r\n]*)$/mg,h1=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,f1=/^(?:GET|HEAD)$/,u1=/^\/\//,dg={},ou={},pg="*/".concat("*"),au=T.createElement("a");au.href=yn.href;function mg(c){return function(u,p){typeof u!="string"&&(p=u,u="*");var g,S=0,Q=u.toLowerCase().match(Oi)||[];if(v(p))for(;g=Q[S++];)g[0]==="+"?(g=g.slice(1)||"*",(c[g]=c[g]||[]).unshift(p)):(c[g]=c[g]||[]).push(p)}}function gg(c,u,p,g){var S={},Q=c===ou;function y(R){var _;return S[R]=!0,d.each(c[R]||[],function(z,G){var ee=G(u,p,g);if(typeof ee=="string"&&!Q&&!S[ee])return u.dataTypes.unshift(ee),y(ee),!1;if(Q)return!(_=ee)}),_}return y(u.dataTypes[0])||!S["*"]&&y("*")}function lu(c,u){var p,g,S=d.ajaxSettings.flatOptions||{};for(p in u)u[p]!==void 0&&((S[p]?c:g||(g={}))[p]=u[p]);return g&&d.extend(!0,c,g),c}function O1(c,u,p){for(var g,S,Q,y,R=c.contents,_=c.dataTypes;_[0]==="*";)_.shift(),g===void 0&&(g=c.mimeType||u.getResponseHeader("Content-Type"));if(g){for(S in R)if(R[S]&&R[S].test(g)){_.unshift(S);break}}if(_[0]in p)Q=_[0];else{for(S in p){if(!_[0]||c.converters[S+" "+_[0]]){Q=S;break}y||(y=S)}Q=Q||y}if(Q)return Q!==_[0]&&_.unshift(Q),p[Q]}function d1(c,u,p,g){var S,Q,y,R,_,z={},G=c.dataTypes.slice();if(G[1])for(y in c.converters)z[y.toLowerCase()]=c.converters[y];for(Q=G.shift();Q;)if(c.responseFields[Q]&&(p[c.responseFields[Q]]=u),!_&&g&&c.dataFilter&&(u=c.dataFilter(u,c.dataType)),_=Q,Q=G.shift(),Q){if(Q==="*")Q=_;else if(_!=="*"&&_!==Q){if(y=z[_+" "+Q]||z["* "+Q],!y){for(S in z)if(R=S.split(" "),R[1]===Q&&(y=z[_+" "+R[0]]||z["* "+R[0]],y)){y===!0?y=z[S]:z[S]!==!0&&(Q=R[0],G.unshift(R[1]));break}}if(y!==!0)if(y&&c.throws)u=y(u);else try{u=y(u)}catch(ee){return{state:"parsererror",error:y?ee:"No conversion from "+_+" to "+Q}}}}return{state:"success",data:u}}d.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn.href,type:"GET",isLocal:h1.test(yn.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pg,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":d.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(c,u){return u?lu(lu(c,d.ajaxSettings),u):lu(d.ajaxSettings,c)},ajaxPrefilter:mg(dg),ajaxTransport:mg(ou),ajax:function(c,u){typeof c=="object"&&(u=c,c=void 0),u=u||{};var p,g,S,Q,y,R,_,z,G,ee,W=d.ajaxSetup({},u),oe=W.context||W,Ve=W.context&&(oe.nodeType||oe.jquery)?d(oe):d.event,st=d.Deferred(),Ie=d.Callbacks("once memory"),ei=W.statusCode||{},qt={},nn={},sn="canceled",et={readyState:0,getResponseHeader:function(ct){var Et;if(_){if(!Q)for(Q={};Et=c1.exec(S);)Q[Et[1].toLowerCase()+" "]=(Q[Et[1].toLowerCase()+" "]||[]).concat(Et[2]);Et=Q[ct.toLowerCase()+" "]}return Et==null?null:Et.join(", ")},getAllResponseHeaders:function(){return _?S:null},setRequestHeader:function(ct,Et){return _==null&&(ct=nn[ct.toLowerCase()]=nn[ct.toLowerCase()]||ct,qt[ct]=Et),this},overrideMimeType:function(ct){return _==null&&(W.mimeType=ct),this},statusCode:function(ct){var Et;if(ct)if(_)et.always(ct[et.status]);else for(Et in ct)ei[Et]=[ei[Et],ct[Et]];return this},abort:function(ct){var Et=ct||sn;return p&&p.abort(Et),As(0,Et),this}};if(st.promise(et),W.url=((c||W.url||yn.href)+"").replace(u1,yn.protocol+"//"),W.type=u.method||u.type||W.method||W.type,W.dataTypes=(W.dataType||"*").toLowerCase().match(Oi)||[""],W.crossDomain==null){R=T.createElement("a");try{R.href=W.url,R.href=R.href,W.crossDomain=au.protocol+"//"+au.host!=R.protocol+"//"+R.host}catch(ct){W.crossDomain=!0}}if(W.data&&W.processData&&typeof W.data!="string"&&(W.data=d.param(W.data,W.traditional)),gg(dg,W,u,et),_)return et;z=d.event&&W.global,z&&d.active++===0&&d.event.trigger("ajaxStart"),W.type=W.type.toUpperCase(),W.hasContent=!f1.test(W.type),g=W.url.replace(a1,""),W.hasContent?W.data&&W.processData&&(W.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&(W.data=W.data.replace(o1,"+")):(ee=W.url.slice(g.length),W.data&&(W.processData||typeof W.data=="string")&&(g+=(Cs.test(g)?"&":"?")+W.data,delete W.data),W.cache===!1&&(g=g.replace(l1,"$1"),ee=(Cs.test(g)?"&":"?")+"_="+Fl.guid+++ee),W.url=g+ee),W.ifModified&&(d.lastModified[g]&&et.setRequestHeader("If-Modified-Since",d.lastModified[g]),d.etag[g]&&et.setRequestHeader("If-None-Match",d.etag[g])),(W.data&&W.hasContent&&W.contentType!==!1||u.contentType)&&et.setRequestHeader("Content-Type",W.contentType),et.setRequestHeader("Accept",W.dataTypes[0]&&W.accepts[W.dataTypes[0]]?W.accepts[W.dataTypes[0]]+(W.dataTypes[0]!=="*"?", "+pg+"; q=0.01":""):W.accepts["*"]);for(G in W.headers)et.setRequestHeader(G,W.headers[G]);if(W.beforeSend&&(W.beforeSend.call(oe,et,W)===!1||_))return et.abort();if(sn="ab
Line truncated
|
|
|
|
|
`+Vt),kr&&If([ie,Te,Ze],Gt=>{Vt=Ul(Vt,Gt," ")}),N&&Hr?N.createHTML(Vt):Vt},e.setConfig=function(){let Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};or(Pe),Ht=!0},e.clearConfig=function(){tn=null,Ht=!1},e.isValidAttribute=function(Pe,A,ae){tn||or({});let xe=kt(Pe),pt=kt(A);return Cr(xe,pt,ae)},e.addHook=function(Pe,A){typeof A=="function"&&Zl(ge[Pe],A)},e.removeHook=function(Pe,A){if(A!==void 0){let ae=hA(ge[Pe],A);return ae===-1?void 0:fA(ge[Pe],ae,1)[0]}return ww(ge[Pe])},e.removeHooks=function(Pe){ge[Pe]=[]},e.removeAllHooks=function(){ge=_w()},e}var TA=Yw();Ew.exports=TA});var sg=bu(Tu());function Us(i,e,t,r){window.ga&&ga("send","event",i,e,t,r)}function Yg(i){window.ga&&ga("send","pageview",i)}function yt(i){i?(Yr(0),$("#pleaseWaitModal").modal("show")):(Yr(1),$("#pleaseWaitModal").modal("hide"))}function Yr(i){$("#pleaseWaitProgressBar").css("width",i*100+"%").show()}function Ge(i){yt(!1),bootbox.alert({title:'<span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Alert',message:ko.sanitize(i)})}function Li(i){yt(!1),bootbox.alert(ko.sanitize(i))}function Eg(i){throw Ge(i),new Error(i)}var Qa=class{constructor(e,t){e=e||[],this.lines=e,this.text=t,this.offset2loc=new Map,this.line2offset=new Map;for(var r of e)r.offset>=0&&(this.offset2loc[r.offset]||(this.offset2loc[r.offset]=r),this.line2offset[r.line]||(this.line2offset[r.line]=r.offset))}findLineForOffset(e,t){if(this.offset2loc)for(var r=0;r<=t;r++){var n=this.offset2loc[e];if(n)return n;e--}return null}lineCount(){return this.lines.length}};function Zg(i){return"errors"in i}function Ug(i){return"output"in i}var zg=bu(Tu()),fc=class{constructor(e){this.preset_id=Qi(e)}async getRemoteFile(e){return new Promise((t,r)=>ac(e,t,Es(e)?"arraybuffer":"text"))}async getFileData(e){var t="presets/"+this.preset_id+"/"+e,r=await this.getRemoteFile(t);return r&&console.log("read",t,r.length,"bytes"),r}async setFileData(e,t){}};var To=class{constructor(e,t){this.basefs=e,this.overlayfs=t}async getFileData(e){var t=await this.overlayfs.getFileData(e);return t==null?this.basefs.getFileData(e):t}async setFileData(e,t){return await this.overlayfs.setFileData(e,t),this.basefs.setFileData(e,t)}},uc=class{constructor(e){this.store=e}async getFileData(e){return this.store.getItem(e)}async setFileData(e,t){return this.store.setItem(e,t)}};var Oc=class{constructor(e,t,r,n){this.filedata={};this.pendingWorkerMessages=0;this.tools_preloaded={};this.isCompiling=!1;this.filename2path={};this.worker=e,this.platform_id=t,this.platform=r,this.filesystem=n,e.onmessage=s=>{this.receiveWorkerMessage(s.data)}}receiveWorkerMessage(e){var t=this.pendingWorkerMessages>1;t?(this.sendBuild(),this.pendingWorkerMessages=1):(this.callbackBuildStatus&&this.callbackBuildStatus(!1),this.isCompiling||(console.log(this.pendingWorkerMessages),console.trace()),this.isCompiling=!1,this.pendingWorkerMessages=0),e&&Ug(e)?this.processBuildResult(e):Zg(e)&&this.processBuildListings(e),this.callbackBuildResult(e)}getToolForFilename(e){return this.remoteTool?"remote:"+this.remoteTool:this.platform.getToolForFilename(e)}preloadWorker(e){var t=this.getToolForFilename(e);t&&!this.tools_preloaded[t]&&(this.worker.postMessage({preload:t,platform:this.platform_id}),this.tools_preloaded[t]=!0)}pushAllFiles(e,t){e.push(t);var r=Su(this.mainPath);r.length>0&&r!="local"&&e.push(r+"/"+t)}parseIncludeDependencies(e){let t=[],r;if(this.platform_id.startsWith("verilog")){let n=/^\s*(`include|[.]include)\s+"(.+?)"/gmi;for(;r=n.exec(e);)this.pushAllFiles(t,r[2]);let s=/^\s*\$(include|\$dofile|\$write_image_in_table)\('(.+?)'/gmi;for(;r=s.exec(e);)this.pushAllFiles(t,r[2]);let o=/^\s*([.]arch)\s+(\w+)/gmi;for(;r=o.exec(e);)this.pushAllFiles(t,r[2]+".json");let a=/\$readmem[bh]\("(.+?)"/gmi;for(;r=a.exec(e);)this.pushAllFiles(t,r[1])}else{let n=/^\s*[.#%]?(include|incbin|embed)\s+"(.+?)"/gmi;for(;r=n.exec(e);)this.pushAllFiles(t,r[2]);let s=/^\s*([;']|[/][/])#(resource)\s+"(.+?)"/gm;for(;r=s.exec(e);)this.pushAllFiles(t,r[3]);let o=/^\s+(USE|ASM)\s+(\S+[.]\S+)/gm;for(;r=o.exec(e);)this.pushAllFiles(t,r[2]);let a=/^\s*(import|embed)\s*"(.+?)";/gmi;for(;r=a.exec(e);)r[1]=="import"?this.pushAllFiles(t,r[2]+".wiz"):this.pushAllFiles(t,r[2]);let l=/^\s*(import)\s*"(.+?)"/gmi;for(;r=l.exec(e);)this.pushAllFiles(t,r[2]);let h=/^[!]src\s+"(.+?)"/gmi;for(;r=h.exec(e);)this.pushAllFiles(t,r[1])}return t}parseLinkDependencies(e){let t=[],r;if(!this.platform_id.startsWith("verilog")){let n=/^\s*([;]|[/][/])#link\s+"(.+?)"/gm;for(;r=n.exec(e);)this.pushAllFiles(t,r[2])}return t}loadFileDependencies(e){let t=this.parseIncludeDependencies(e),r=this.parseLinkDependencies(e),n=t.concat(r);return this.loadFiles(n).then(s=>{if(s)for(let o of s)o.link=r.indexOf(o.path)>=0;return s})}okToSend(){return this.pendingWorkerMessages++==0&&this.mainPath!=null}updateFileInStore(e,t){this.filesystem.setFileData(e,t)}buildWorkerMessage(e){this.preloadWorker(this.mainPath);var t={updates:[],buildsteps:[]},r=this.stripLocalLine truncated
|
|
|
|
|
=====
|
|
|
|
|
|
|
|
|
|
[Open this project in 8bitworkshop](http://8bitworkshop.com/redir.html?platform=$PLATFORM&githubURL=$GITHUBURL&file=$MAINFILE).
|
|
|
|
|
`;function Xo(){for(var i={},e=0;e<localStorage.length;e++){var t=localStorage.key(e);if(t.startsWith("__repo__")){var r=JSON.parse(localStorage.getItem(t)),n=t.substring(8);i[n]=r}}return i}function Qa(i){var e=i.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 Oc=class{constructor(e,t,r,n){this.githubCons=e,this.githubToken=t,this.store=r,this.project=n,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((t,r)=>{t()});var e=new firebase.auth.GithubAuthProvider;return e.addScope("repo"),firebase.auth().signInWithPopup(e).then(t=>{this.githubToken=t.credential.accessToken;var r=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=Qa(e);if(!t)throw new Error("Please enter a valid GitHub URL.");var r=Xo()[t.repopath],n=t.branch||r&&r.branch,s=this.github.repos(t.user,t.repo);try{n=(await s.fetch()).defaultBranch||"master"}catch(a){console.log("could not fetch default branch: "+a),n="main"}console.log("branch =",n);var o={url:e,user:t.user,reponame:t.repo,repopath:t.repopath,branch:n,subtreepath:t.subtreepath,prefix:"",repo:s,platform_id:this.project?this.project.platform_id:r?r.platform_id:null};return o}getGithubHEADTree(e){var t;return this.getGithubSession(e).then(r=>(t=r,t.repo.git.refs.heads(t.branch).fetch())).then(r=>(t.head=r,t.sha=r.object.sha,t.repo.git.trees(t.sha).fetch())).then(r=>{if(t.subtreepath){for(let n of r.tree)if(n.type=="tree"&&n.path==t.subtreepath&&n.sha)return t.repo.git.trees(n.sha).fetch();throw Error("Cannot find subtree '"+t.subtreepath+"' in tree "+r.sha)}return r}).then(r=>(t.tree=r,t))}bind(e,t){var r="__repo__"+e.repopath;if(t){var n={url:e.url,branch:e.branch,platform_id:e.platform_id,mainPath:e.mainPath,sha:e.sha};console.log("storing",n),localStorage.setItem(r,JSON.stringify(n))}else localStorage.removeItem(r)}import(e){var t;return this.getGithubSession(e).then(r=>(t=r,t.repo.contents("README.md").read())).catch(r=>(console.log(r),console.log("no README.md found"),t.repo.fetch().then(n=>""))).then(r=>{var n;if(n=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(r),n&&n[1]&&(console.log("main path: '"+n[1]+"'"),t.mainPath=n[1]),n=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(r),n){if(console.log("platform id: '"+n[1]+"'"),t.platform_id&&!t.platform_id.startsWith(n[1]))throw Error("Platform mismatch: Repository is "+n[1]+", you have "+t.platform_id+" selected.");t.platform_id=n[1]}return this.bind(t,!0),t})}pull(e,t){var r;return this.getGithubHEADTree(e).then(n=>{r=n;let s=[];return r.paths=[],r.tree.tree.forEach(o=>{if(console.log(o.path,o.type,o.size),r.paths.push(o.path),o.type=="blob"&&!this.isFileIgnored(o.path)){var a=r.repo.git.blobs(o.sha).fetch().then(l=>{var f=r.prefix+o.path,h=o.size,O=l.encoding,m=l.content;if(l.encoding=="base64"){var b=tc(atob(m)),y=Es(o.path,b);m=y?b:rc(b)}return l.size!=m.length&&(m=m.slice(0,l.size)),(t||this.store).setItem(f,m)});s.push(a)}else console.log("ignoring "+o.path)}),Promise.all(s)}).then(n=>r)}importAndPull(e){return this.import(e).then(t=>this.pull(e))}publish(e,t,r,n){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:n,auto_init:!1,license_template:r}).then(l=>{s=l;var f=gw;f=f.replace(/\$NAME/g,encodeURIComponent(e)),f=f.replace(/\$PLATFORM/g,encodeURIComponent(o)),f=f.replace(/\$GITHUBURL/g,encodeURIComponent(s.htmlUrl)),f=f.replace(/\$MAINFILE/g,encodeURIComponent(a));var h={message:"8bitworkshop: updated metadata in README.md",content:btoa(f)};return s.contents("README.md").add(h)}).then(()=>this.getGithubSession(s.htmlUrl))}commit(e,t,r){var n;return t||(t="updated from 8bitworkshop.com"),this.getGithubHEADTree(e).then(s=>{if(n=s,n.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(r.map(o=>typeof o.data=="string"?n.repo.git.blobs.create({content:o.data,encoding:"utf-8"}):n.repo.git.blobs.create({content:btoa(ic(o.data)),encoding:"base64"})))}).then(s=>n.repo.git.trees.create({tree:r.map((o,a)=>({path:o.path,mode:"100644",type:"blob",sha:s[a].sha})),base_tree:n.tree.sha})).then(s=>n.repo.git.commits.create({message:t,tree:s.sha,parents:[n.head.object.sha]})).then(s=>n.repo.commits(s.sha).fetch()).then(s=>(n.commit=s,n))}push(e){return e.head.update({sha:e.commit.
Line truncated
|
|
|
|
|
`},s=window.c2t({noInitialRun:!0,print:n,printErr:n}),o=s.FS,a=jt()+".bin",l=jt()+".wav";o.writeFile(a,yi(),{encoding:"binary"});var f=["-2bc",a+","+e.toString(16),l];s.callMain(f);var h=o.readFile(l,{encoding:"binary"});if(h){var O=new Blob([h],{type:"audio/wav"});(0,cn.saveAs)(O,l),r+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",Li(r)}})}function yw(i){hr("lib/makewav.js").then(()=>{let e="",t=function(a){e+=a+`
|
|
|
|
|
`};var r=li(jt());let n=r+".bin",s=r+".wav";window.makewav({noInitialRun:!1,print:t,printErr:t,arguments:["-ts","-f0","-v10",n],preRun:a=>{a.FS.writeFile(n,yi(),{encoding:"binary"})}}).ready.then(a=>{let l=[n];a.run(l),console.log(e);let h=a.FS.readFile(s,{encoding:"binary"});if(h){let O=new Blob([h],{type:"audio/wav"});(0,cn.saveAs)(O,s),e+=`
|
|
|
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,Li(e)}})})}function xw(i){var e=li(jt());let t=e+".tap",r=new zs(e),n=new dc({sine_wave:!0}),s=yi(),o=s[0]+s[1]*256;s=s.slice(2),r.setContent({data:s,startAddress:o,type:zs.FILE_TYPE_NON_RELOCATABLE}),r.generateSound(n);let a=n.getTAPData();if(a){let l=new Blob([a],{type:"application/octet-stream"});(0,cn.saveAs)(l,t)}}function $u(){switch(Qi(Re)){case"vcs":return yw;case"apple2":return Qw;case"c64":return xw}}function Yg(i){if(yi()==null)return Ge("Please fix errors before exporting."),!0;var e=$u();if(e===void 0)return Ge("Cassette export is not supported on this platform."),!0;e(i)}function Eg(i){if(yi()==null)return Ge("Please finish compiling with no errors before downloading ROM."),!0;var e=li(jt());if(L.getDownloadFile){var t=L.getDownloadFile(),e=li(jt());(0,cn.saveAs)(t.blob,e+t.extension)}else if(yi()instanceof Uint8Array){var r=new Blob([yi()],{type:"application/octet-stream"}),n=L.getROMExtension&&L.getROMExtension(yi())||"-"+Qi(Re)+".bin";(0,cn.saveAs)(r,e+n)}else Ge(`The "${Re}" platform doesn't have downloadable ROMs.`)}function Zg(i){var e=_e.getCurrentText();if(!e)return!1;var t=new Blob([e],{type:"text/plain;charset=utf-8"});(0,cn.saveAs)(t,Dg(),{autoBom:!1})}async function Ug(){let i=(await import("./jszip.min-HOLYP7RC.js")).default;return new i}async function zg(i){var e=await Ug();Pn().iterateFiles((t,r)=>{r&&e.file(ai(t),r)}),e.generateAsync({type:"blob"}).then(t=>{(0,cn.saveAs)(t,jt()+"-"+Qi(Re)+".zip")})}function Lg(i){let e=L.getDebugSymbolFile&&L.getDebugSymbolFile();if(!e){Ge("This project does not have debug information.");return}var t=li(jt());(0,cn.saveAs)(e.blob,t+e.extension,{autoBom:!1})}async function Mg(i){var e=await Ug(),t=await Kn().keys();vt(!0);try{var r=0;await Promise.all(t.map(s=>Kn().getItem(s).then(o=>{Yr(r++/(t.length+1)),o&&e.file(s,o)})));var n=await e.generateAsync({type:"blob"});(0,cn.saveAs)(n,Qi(Re)+"-all.zip")}finally{vt(!1)}}var wu=!1;function Vg(){wu||hr("lib/gif.js").then(()=>{var i=$("#emulator").find("canvas")[0];if(!i){Ge("Could not find canvas element to record video!");return}var e=0;i.style&&i.style.transform&&(i.style.transform.indexOf("rotate(-90deg)")>=0?e=-1:i.style.transform.indexOf("rotate(90deg)")>=0&&(e=1));var t=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:e}),r=$("#videoPreviewImage");t.on("progress",l=>{Yr(l)}),t.on("finished",l=>{r.attr("src",URL.createObjectURL(l)),vt(!1),L.resume(),$("#videoPreviewModal").modal("show")});var n=20,s=300,o=0;console.log("Recording video",i),$("#emulator").css("backgroundColor","#cc3333");var a=()=>{o++>s?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),vt(!0),L.pause(),t.render(),wu=!1):(t.addFrame(i,{delay:n,copy:!0}),setTimeout(a,n),wu=!0)};a()})}var Pu;async function Ls(){if(!Pu){await hr("lib/octokat.js"),await hr("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await hr("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await hr("https://8bitworkshop.com/config.js");var i=oc("__github_key");Pu=new Oc(Octokat,i,Kn(),Pn()),console.log("loaded github service")}return Pu}function xa(){var i=(Et||"").split("/");return i.length!=2?(Ge("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+i[0]+"/"+i[1]}async function pc(i,e){var t,r=Qa(i);if(!r){Ge("Could not parse Github URL.");return}var n=Xo()[r.repopath];if(!(n&&!confirm("You've already imported "+r.repopath+" -- do you want to replace all local files?"))){vt(!0);var s=uc(r.repopath);Yr(.25);var o=await Ls();return o.import(i).then(a=>(t=a,Yr(.75),o.pull(i,s))).then(a=>{vt(!1),Us("sync","import",i),Ms(e,{repo:r.repopath})}).catch(a=>{vt(!1),console.log(a),Ge("Could not import "+i+"."+a)})}}async function Wg(i){var e=await Ls();e.login().then(()=>{Li("You are signed in to Github.")}).catch(t=>{Ge("Could not sign in."+t)})}async function qg(i){var e=await Ls();e.logout().then(()=>{Li("You are logged out of Github.")})}function jg(i){var e=$("#importGithubModal"),t=$("#importGithubButton");e.modal("show"),t.off("click").on("click",()=>{var r=$("#importGithubURL").val()+"";e.modal("hide"),pc(r,!1)})}function Ig(i){if(!(Et&&!confirm("This project ("+Pn().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(li(ai(Pn().mainPath))),e.modal("show"),t.off("click").on("click",async()=>{var r=$("#githubRepoName").val()+"",n=$("#githubRepoDesc").val()+"",s=$("#githubRepoPrivate").val()=="private",o=$("#githubRepoLicense").val()+"",a;if(!r){Ge("You did not enter a project name.");return}e.modal("hide"),vt(!0);var l=await Ls();l.login().then(()=>(Yr(.25),l.publish(r,n,o,s))).then(f=>(a=f,Yr(.5),Gg("initial iLine truncated
|
|
|
|
|
`;function Xo(){for(var i={},e=0;e<localStorage.length;e++){var t=localStorage.key(e);if(t.startsWith("__repo__")){var r=JSON.parse(localStorage.getItem(t)),n=t.substring(8);i[n]=r}}return i}function va(i){var e=i.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 pc=class{constructor(e,t,r,n){this.githubCons=e,this.githubToken=t,this.store=r,this.project=n,this.recreateGithub()}recreateGithub(){this.github=new this.githubCons({token:this.githubToken})}login(){if(this.githubToken&&this.githubToken.length)return new Promise((t,r)=>{t()});var e=new firebase.auth.GithubAuthProvider;return e.addScope("repo"),firebase.auth().signInWithPopup(e).then(t=>{this.githubToken=t.credential.accessToken;var r=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=va(e);if(!t)throw new Error("Please enter a valid GitHub URL.");var r=Xo()[t.repopath],n=t.branch||r&&r.branch,s=this.github.repos(t.user,t.repo);try{n=(await s.fetch()).defaultBranch||"master"}catch(a){console.log("could not fetch default branch: "+a),n="main"}console.log("branch =",n);var o={url:e,user:t.user,reponame:t.repo,repopath:t.repopath,branch:n,subtreepath:t.subtreepath,prefix:"",repo:s,platform_id:this.project?this.project.platform_id:r?r.platform_id:null};return o}getGithubHEADTree(e){var t;return this.getGithubSession(e).then(r=>(t=r,t.repo.git.refs.heads(t.branch).fetch())).then(r=>(t.head=r,t.sha=r.object.sha,t.repo.git.trees(t.sha).fetch())).then(r=>{if(t.subtreepath){for(let n of r.tree)if(n.type=="tree"&&n.path==t.subtreepath&&n.sha)return t.repo.git.trees(n.sha).fetch();throw Error("Cannot find subtree '"+t.subtreepath+"' in tree "+r.sha)}return r}).then(r=>(t.tree=r,t))}bind(e,t){var r="__repo__"+e.repopath;if(t){var n={url:e.url,branch:e.branch,platform_id:e.platform_id,mainPath:e.mainPath,sha:e.sha};console.log("storing",n),localStorage.setItem(r,JSON.stringify(n))}else localStorage.removeItem(r)}import(e){var t;return this.getGithubSession(e).then(r=>(t=r,t.repo.contents("README.md").read())).catch(r=>(console.log(r),console.log("no README.md found"),t.repo.fetch().then(n=>""))).then(r=>{var n;if(n=/8bitworkshop.com[^)]+file=([^)&]+)/.exec(r),n&&n[1]&&(console.log("main path: '"+n[1]+"'"),t.mainPath=n[1]),n=/8bitworkshop.com[^)]+platform=([A-Za-z0-9._\-]+)/.exec(r),n){if(console.log("platform id: '"+n[1]+"'"),t.platform_id&&!t.platform_id.startsWith(n[1]))throw Error("Platform mismatch: Repository is "+n[1]+", you have "+t.platform_id+" selected.");t.platform_id=n[1]}return this.bind(t,!0),t})}pull(e,t){var r;return this.getGithubHEADTree(e).then(n=>{r=n;let s=[];return r.paths=[],r.tree.tree.forEach(o=>{if(console.log(o.path,o.type,o.size),r.paths.push(o.path),o.type=="blob"&&!this.isFileIgnored(o.path)){var a=r.repo.git.blobs(o.sha).fetch().then(l=>{var h=r.prefix+o.path,f=o.size,O=l.encoding,m=l.content;if(l.encoding=="base64"){var b=rc(atob(m)),v=Es(o.path,b);m=v?b:sc(b)}return l.size!=m.length&&(m=m.slice(0,l.size)),(t||this.store).setItem(h,m)});s.push(a)}else console.log("ignoring "+o.path)}),Promise.all(s)}).then(n=>r)}importAndPull(e){return this.import(e).then(t=>this.pull(e))}publish(e,t,r,n){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:n,auto_init:!1,license_template:r}).then(l=>{s=l;var h=T1;h=h.replace(/\$NAME/g,encodeURIComponent(e)),h=h.replace(/\$PLATFORM/g,encodeURIComponent(o)),h=h.replace(/\$GITHUBURL/g,encodeURIComponent(s.htmlUrl)),h=h.replace(/\$MAINFILE/g,encodeURIComponent(a));var f={message:"8bitworkshop: updated metadata in README.md",content:btoa(h)};return s.contents("README.md").add(f)}).then(()=>this.getGithubSession(s.htmlUrl))}commit(e,t,r){var n;return t||(t="updated from 8bitworkshop.com"),this.getGithubHEADTree(e).then(s=>{if(n=s,n.subtreepath)throw Error("Sorry, right now you can only commit files to the root directory of a repository.");return Promise.all(r.map(o=>typeof o.data=="string"?n.repo.git.blobs.create({content:o.data,encoding:"utf-8"}):n.repo.git.blobs.create({content:btoa(nc(o.data)),encoding:"base64"})))}).then(s=>n.repo.git.trees.create({tree:r.map((o,a)=>({path:o.path,mode:"100644",type:"blob",sha:s[a].sha})),base_tree:n.tree.sha})).then(s=>n.repo.git.commits.create({message:t,tree:s.sha,parents:[n.head.object.sha]})).then(s=>n.repo.commits(s.sha).fetch()).then(s=>(n.commit=s,n))}push(e){return e.head.update({sha:e.commit.
Line truncated
|
|
|
|
|
`},s=window.c2t({noInitialRun:!0,print:n,printErr:n}),o=s.FS,a=jt()+".bin",l=jt()+".wav";o.writeFile(a,vi(),{encoding:"binary"});var h=["-2bc",a+","+e.toString(16),l];s.callMain(h);var f=o.readFile(l,{encoding:"binary"});if(f){var O=new Blob([f],{type:"audio/wav"});(0,hn.saveAs)(O,l),r+="Then connect your audio output to the cassette input, turn up the volume, and play the audio file.",Li(r)}})}function C1(i){fr("lib/makewav.js").then(()=>{let e="",t=function(a){e+=a+`
|
|
|
|
|
`};var r=ci(jt());let n=r+".bin",s=r+".wav";window.makewav({noInitialRun:!1,print:t,printErr:t,arguments:["-ts","-f0","-v10",n],preRun:a=>{a.FS.writeFile(n,vi(),{encoding:"binary"})}}).ready.then(a=>{let l=[n];a.run(l),console.log(e);let f=a.FS.readFile(s,{encoding:"binary"});if(f){let O=new Blob([f],{type:"audio/wav"});(0,hn.saveAs)(O,s),e+=`
|
|
|
|
|
Connect your audio output to the SuperCharger input, turn up the volume, and play the audio file.`,Li(e)}})})}function A1(i){var e=ci(jt());let t=e+".tap",r=new zs(e),n=new mc({sine_wave:!0}),s=vi(),o=s[0]+s[1]*256;s=s.slice(2),r.setContent({data:s,startAddress:o,type:zs.FILE_TYPE_NON_RELOCATABLE}),r.generateSound(n);let a=n.getTAPData();if(a){let l=new Blob([a],{type:"application/octet-stream"});(0,hn.saveAs)(l,t)}}function _u(){switch(Qi(Re)){case"vcs":return C1;case"apple2":return R1;case"c64":return A1}}function Mg(i){if(vi()==null)return Ge("Please fix errors before exporting."),!0;var e=_u();if(e===void 0)return Ge("Cassette export is not supported on this platform."),!0;e(i)}function Vg(i){if(vi()==null)return Ge("Please finish compiling with no errors before downloading ROM."),!0;var e=ci(jt());if(L.getDownloadFile){var t=L.getDownloadFile(),e=ci(jt());(0,hn.saveAs)(t.blob,e+t.extension)}else if(vi()instanceof Uint8Array){var r=new Blob([vi()],{type:"application/octet-stream"}),n=L.getROMExtension&&L.getROMExtension(vi())||"-"+Qi(Re)+".bin";(0,hn.saveAs)(r,e+n)}else Ge(`The "${Re}" platform doesn't have downloadable ROMs.`)}function Dg(i){var e=ke.getCurrentText();if(!e)return!1;var t=new Blob([e],{type:"text/plain;charset=utf-8"});(0,hn.saveAs)(t,Bg(),{autoBom:!1})}async function Wg(){let i=(await import("./jszip.min-HOLYP7RC.js")).default;return new i}async function qg(i){var e=await Wg();Pn().iterateFiles((t,r)=>{r&&e.file(li(t),r)}),e.generateAsync({type:"blob"}).then(t=>{(0,hn.saveAs)(t,jt()+"-"+Qi(Re)+".zip")})}function jg(i){let e=L.getDebugSymbolFile&&L.getDebugSymbolFile();if(!e){Ge("This project does not have debug information.");return}var t=ci(jt());(0,hn.saveAs)(e.blob,t+e.extension,{autoBom:!1})}async function Ig(i){var e=await Wg(),t=await Kn().keys();yt(!0);try{var r=0;await Promise.all(t.map(s=>Kn().getItem(s).then(o=>{Yr(r++/(t.length+1)),o&&e.file(s,o)})));var n=await e.generateAsync({type:"blob"});(0,hn.saveAs)(n,Qi(Re)+"-all.zip")}finally{yt(!1)}}var Xu=!1;function Ng(){Xu||fr("lib/gif.js").then(()=>{var i=$("#emulator").find("canvas")[0];if(!i){Ge("Could not find canvas element to record video!");return}var e=0;i.style&&i.style.transform&&(i.style.transform.indexOf("rotate(-90deg)")>=0?e=-1:i.style.transform.indexOf("rotate(90deg)")>=0&&(e=1));var t=new GIF({workerScript:"lib/gif.worker.js",workers:4,quality:10,rotate:e}),r=$("#videoPreviewImage");t.on("progress",l=>{Yr(l)}),t.on("finished",l=>{r.attr("src",URL.createObjectURL(l)),yt(!1),L.resume(),$("#videoPreviewModal").modal("show")});var n=20,s=300,o=0;console.log("Recording video",i),$("#emulator").css("backgroundColor","#cc3333");var a=()=>{o++>s?(console.log("Rendering video"),$("#emulator").css("backgroundColor","inherit"),yt(!0),L.pause(),t.render(),Xu=!1):(t.addFrame(i,{delay:n,copy:!0}),setTimeout(a,n),Xu=!0)};a()})}var Ru;async function Ls(){if(!Ru){await fr("lib/octokat.js"),await fr("https://www.gstatic.com/firebasejs/8.8.1/firebase-app.js"),await fr("https://www.gstatic.com/firebasejs/8.8.1/firebase-auth.js"),await fr("https://8bitworkshop.com/config.js");var i=lc("__github_key");Ru=new pc(Octokat,i,Kn(),Pn()),console.log("loaded github service")}return Ru}function ya(){var i=(Zt||"").split("/");return i.length!=2?(Ge("You are not in a GitHub repository. Choose one from the pulldown, or Import or Publish one."),null):"https://github.com/"+i[0]+"/"+i[1]}async function gc(i,e){var t,r=va(i);if(!r){Ge("Could not parse Github URL.");return}var n=Xo()[r.repopath];if(!(n&&!confirm("You've already imported "+r.repopath+" -- do you want to replace all local files?"))){yt(!0);var s=dc(r.repopath);Yr(.25);var o=await Ls();return o.import(i).then(a=>(t=a,Yr(.75),o.pull(i,s))).then(a=>{yt(!1),Us("sync","import",i),Ms(e,{repo:r.repopath})}).catch(a=>{yt(!1),console.log(a),Ge("Could not import "+i+"."+a)})}}async function Gg(i){var e=await Ls();e.login().then(()=>{Li("You are signed in to Github.")}).catch(t=>{Ge("Could not sign in."+t)})}async function Fg(i){var e=await Ls();e.logout().then(()=>{Li("You are logged out of Github.")})}function Hg(i){var e=$("#importGithubModal"),t=$("#importGithubButton");e.modal("show"),t.off("click").on("click",()=>{var r=$("#importGithubURL").val()+"";e.modal("hide"),gc(r,!1)})}function Kg(i){if(!(Zt&&!confirm("This project ("+Pn().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(ci(li(Pn().mainPath))),e.modal("show"),t.off("click").on("click",async()=>{var r=$("#githubRepoName").val()+"",n=$("#githubRepoDesc").val()+"",s=$("#githubRepoPrivate").val()=="private",o=$("#githubRepoLicense").val()+"",a;if(!r){Ge("You did not enter a project name.");return}e.modal("hide"),yt(!0);var l=await Ls();l.login().then(()=>(Yr(.25),l.publish(r,n,o,s))).then(h=>(a=h,Yr(.5),t0("initial iLine truncated
|
|
|
|
|
`&&t++;return t}var Tc=class{createDiv(e){return this.maindiv=kn(e,"vertical-scroll"),this.maindiv[0]}clearAssets(){this.rootnodes=[],this.deferrednodes=[]}registerAsset(e,t,r){this.rootnodes.push(t),r?r>1?this.deferrednodes.push(t):this.deferrednodes.unshift(t):t.refreshRight()}getPalettes(e){var t=[];return this.rootnodes.forEach(r=>{for(;r!=null;){if(r instanceof Pa){var n=r.palette;e==n.length&&t.push({node:r,name:"Palette",palette:n}),r.layout&&r.layout.forEach(([s,o,a])=>{if(o<n.length){if(a==e){var l=n.slice(o,o+a);t.push({node:r,name:s,palette:l})}else if(-a==e){var l=n.slice(o,o-a);l.reverse(),t.push({node:r,name:s,palette:l})}else if(a+1==e){var l=new Uint32Array(e);l[0]=n[0],l.set(n.slice(o,o+a),1),t.push({node:r,name:s,palette:l})}}});break}r=r.right}}),t}getTilemaps(e){var t=[];return this.rootnodes.forEach(r=>{for(;r!=null;){if(r instanceof Ds){var n=r.rgbimgs;n&&n.length>=e&&t.push({node:r,name:"Tilemap",images:r.images,rgbimgs:n})}r=r.right}}),t}isEditing(){return this.cureditordiv!=null}getCurrentEditNode(){return this.cureditnode}setCurrentEditor(e,t,r){for(this.cureditordiv!=e&&(this.cureditordiv&&(this.cureditordiv.hide(250),this.cureditordiv=null),e&&(this.cureditordiv=e,this.cureditordiv.show(),this.cureditordiv[0].scrollIntoView({behavior:"smooth",block:"center"}))),this.cureditelem&&(this.cureditelem.removeClass("selected"),this.cureditelem=null),t&&(this.cureditelem=t,this.cureditelem.addClass("selected"));r.left;)r=r.left;this.cureditnode=r,this.updateHashForSelection(e)}updateHashForSelection(e){if(typeof window!="undefined"){var t=e?e.closest(".asset_block[data-fileid]"):null,r=t&&t.attr("data-fileid"),n=t&&t.attr("data-startline"),s="#asseteditor";r&&n&&(s+="/"+encodeURIComponent(r)+"/"+n),window.location.hash!==s&&history.replaceState(null,"",s)}}scanFileTextForAssets(e,t){for(var r=/[/;][*;]([{].+[}])[*;][/;]/g,n=[],s;s=r.exec(t);){var o=s.index+s[0].length,a;Re.includes("verilog")?a=t.indexOf("end",o):s[0].startsWith(";;")?(a=t.indexOf(";;",o),a==t.indexOf(";;{",o)&&(a=-1)):a=t.indexOf(";",o);var l=c0(t,s.index),h=s[0],f=a>=0?c0(t,a):"???";if(a<0){var O=Re.includes("verilog")?'"end"':s[0].startsWith(";;")?'";;"':'";"';n.push({fileid:e,header:h,startline:l,endline:f,error:`No closing ${O} found after asset header`})}else if(a<=o)n.push({fileid:e,header:h,startline:l,endline:f,error:"Empty data block after asset header"});else try{var m=s[1].replace(/([A-Za-z]+):/g,'"$1":'),b=JSON.parse(m);n.push({fileid:e,header:h,startline:l,endline:f,fmt:b,start:o,end:a})}catch(F){n.push({fileid:e,header:h,startline:l,endline:f,error:`Invalid asset format: ${F.message}`})}}for(var v=/DEF_METASPRITE_(\d+)x(\d+)[(](\w+),\s*(\w+),\s*(\w+)/gi;s=v.exec(t);){for(var P=parseInt(s[1]),T=parseInt(s[2]),Y=s[3],B=parseInt(s[4]),q=parseInt(s[5]),N=[],M=0;M<P;M++)for(var d=0;d<T;d++)N.push({x:M*8,y:d*8,tile:B,attr:q});var j={defs:N,width:P*8,height:T*8};n.push({fileid:e,label:Y,meta:j})}return n}addPaletteEditorViews(e,t,r){var n=$('<div class="asset_dual"/>').appendTo(e),s=$('<div class="asset_editor"/>').hide(),o=[];t.getAllColors().forEach(P=>{o.push(new Uint32Array([P]))});var a=$("<table/>").appendTo(n);s.appendTo(n);var l=t.layout;if(!l){var h=t.palette.length,f=h>32?8:4;l=[];for(var O=0;O<h;O+=f)l.push(["",O,Math.min(h-O,f)])}var m=[];function b(P,T){var Y=t.words[T],B=t.palette[T],q="#"+ht(oc(B),6),N=B&32768?"black":"white";P.text(ht(Y,2)).css("background-color",q).css("color",N)}function v(){m.forEach(({cell:P,index:T})=>b(P,T))}return l.forEach(([P,T,Y])=>{if(T<t.palette.length){var B=$("<tr/>").appendTo(a);$("<td/>").text(P).appendTo(B);for(var q=[],N=T;N<T+Math.abs(Y);N++)q.push(N);Y<0&&q.reverse(),q.forEach(M=>{var d=$("<td/>").addClass("asset_cell asset_editable").appendTo(B);m.push({cell:d,index:M}),b(d,M),d.click(j=>{var F=new ka;F.rgbimgs=o,F.width=1,F.height=1,F.recreate(s,(Oe,Ye)=>{r(M,Oe),b(d,M)}),this.setCurrentEditor(s,d,t)})})}}),v}addPixelEditor(e,t,r){r.xform="scale(2)";var n=new xc(r);t.addRight(n);var s=new Ds(this,r);n.addRight(s),s.addRight(new $c(this,kn(e),r))}addPaletteEditor(e,t,r){var n=new Pa(r);t.addRight(n),t.refreshRight();var s=this.addPaletteEditorViews(e,n,(o,a)=>{console.log("set entry",o,"=",a),t.words[o]=a,n.words=null,n.updateRight(),n.refreshLeft()});n.addRight(new yc(s))}ensureFileDiv(e){var t=this.getFileDivId(e),r=$(document.getElementById(t));if(r.length===0){var n=kn(this.maindiv,"asset_file"),s=kn(n,"asset_file_header").text(e);r=kn(n).attr("id",t).addClass("disable-select")}return r}refreshAssetsInFile(e,t){let r=0;if(Re.startsWith("nes")&&e.endsWith(".chr")&&t instanceof Uint8Array){let o=new $a(ke,e),a={w:8,h:8,bpp:1,count:t.length>>4,brev:!0,np:2,pofs:8,remap:[0,1,2,4,5,6,7,8,9,10,11,12]};this.addPixelEditor(this.ensureFileDiv(e),o,a),this.registerAsset("charmap",o,1),r++}else if(Re.startsWith("nes")&&e.endsWith(".pal")&&t instanceof Uint8Array){let o=new $a(ke,e),a={pal:"nes",layout:"nes"};this.addPaletteEditor(this.ensureFileDiv(e),o,a),this.regi
Line truncated
|
|
|
|
|
`+s),n+=`
|
|
|
|
|
`+this.opToString(l,f,b))}),"X: "+t+" Y: "+r+" "+n}refresh(){this.tick(),this.datau32.fill(Er)}tick(){super.tick(),this.drawImage()}drawImage(){this.ctx.putImageData(this.imageData,0,0)}clear(){this.datau32.fill(Er)}},Rc=class extends _c{createDiv(e){return this.createCanvas(e,256,256)}initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=ac(this.canvas,e),r=Math.floor(t.x)+Math.floor(t.y)*256,n=-1,s=-1;this.redraw((o,a)=>{s<0&&n>=0&&a==r&&(s=n),o==16777216&&(n=a)}),s>=0&&Ws([s])}}clear(){for(var e=0;e<=65535;e++){var t=L.readAddress(e),r=t>>2|t&31;r|=r<<8|r<<16,this.datau32[e]=r|Er}}drawEvent(e,t,r,n){var s=this.getOpRGB(e,t);if(s){var o=t&255,a=t>>8&255,l=this.datau32[t&65535];l=l|s|Er,this.datau32[t&65535]=l}}getTooltipText(e,t){var r=(e&255)+(t<<8),n="",s=-1,o={},a=null,l=[];return this.redraw((f,h,O,m,b,y)=>{switch(f){case 16777216:s=h,a=this.addr2symbol(h)||a;break;case 167772160:l.push(a);break;case 184549376:a=l.pop();break}var P=f|s;h==r&&!o[P]&&(n==""&&a&&(n+=`
|
|
|
|
|
`+this.opToString(l,h,b))}),"X: "+t+" Y: "+r+" "+n}refresh(){this.tick(),this.datau32.fill(Zr)}tick(){super.tick(),this.drawImage()}drawImage(){this.ctx.putImageData(this.imageData,0,0)}clear(){this.datau32.fill(Zr)}},Ac=class extends Cc{createDiv(e){return this.createCanvas(e,256,256)}initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=cc(this.canvas,e),r=Math.floor(t.x)+Math.floor(t.y)*256,n=-1,s=-1;this.redraw((o,a)=>{s<0&&n>=0&&a==r&&(s=n),o==16777216&&(n=a)}),s>=0&&Ws([s])}}clear(){for(var e=0;e<=65535;e++){var t=L.readAddress(e),r=t>>2|t&31;r|=r<<8|r<<16,this.datau32[e]=r|Zr}}drawEvent(e,t,r,n){var s=this.getOpRGB(e,t);if(s){var o=t&255,a=t>>8&255,l=this.datau32[t&65535];l=l|s|Zr,this.datau32[t&65535]=l}}getTooltipText(e,t){var r=(e&255)+(t<<8),n="",s=-1,o={},a=null,l=[];return this.redraw((h,f,O,m,b,v)=>{switch(h){case 16777216:s=f,a=this.addr2symbol(f)||a;break;case 167772160:l.push(a);break;case 184549376:a=l.pop();break}var P=h|s;f==r&&!o[P]&&(n==""&&a&&(n+=`
|
|
|
|
|
`+a),n+=`
|
|
|
|
|
PC `+this.addr2str(s)+" "+this.opToString(f,null,y),o[P]=1)}),this.addr2str(r)+n}},Ru=class extends _c{initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=ac(this.canvas,e),r=Math.floor(t.x),n=Math.floor(t.y),s=this.getOpAtPos(t.x,t.y,16777216);s&&(hn("toline"),L.runEval(()=>{let o=L.getRasterScanline&&L.getRasterScanline()>=n;return o&&L.getRasterLineClock?o&&L.getRasterLineClock()>r:o}))}}drawEvent(e,t,r,n){var s=this.getOpRGB(e,t);if(s){var o=r+n*this.canvas.width,a=s|Er;this.datau32[o]|=a}}drawImage(){let e=Er;for(let t=0;t<this.datau32.length;t++)this.datau32[t]==Er?this.datau32[t]=e:e=this.datau32[t];super.drawImage()}},Cc=class extends Ru{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,r,n,s){var o=n+s*this.canvas.width;if(t==134217728&&(this.interrupt=1),this.interrupt==1&&t==167772160&&(this.interrupt=r),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)-r>16&&(l+=1),Math.abs(this.lastpc)-r>256&&(l+=1),a=this.rgb=526344*l+2105376,this.lastpc=r}this.interrupt&&(a|=8388672),this.datau32[o]==Er&&(this.datau32[o]=a|Er)}}},Ac=class extends Jn{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new ba(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var r="",n="seg_data",s=this.dumplines&&this.dumplines[t];if(s!=null){var o=s.info.join(", ");r="("+ln(s.row,4)+", "+ln(s.col,4)+") "+ma(s.asm||"",20)+o,o.indexOf("Write ")>=0&&(n="seg_io")}return{text:r,clas:n}}refresh(){this.tick()}tick(){let t=L instanceof yu||L instanceof Qu;this.dumplines={},this.redraw((r,n,s,o,a,l)=>{t&&(a>>=2);var f=this.dumplines[a];switch(f==null&&(f={op:r,addr:n,row:o,col:s,asm:null,info:[]},this.dumplines[a]=f),r){case 16777216:if(L.disassemble){var h=L.disassemble(n,L.readAddress.bind(L));f.asm=h&&h.line}break;default:var O=this.opToString(r,n,l);O!=""&&f.info.push(O);break}}),this.vlist.refresh()}},Yc=class extends Jn{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new ba(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var r=ln(t+"",3)+" ",n="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 f=l&65535,h=h&Er;if(h==16777216)r+=",";else{var O=ut(f);r+=O,a+=O.length-1}}else r+=a==o?"|":"."}return s[-1]&&(r+=" "+s[-1]),{text:r,clas:n}}refresh(){this.tick()}tick(){let t=L instanceof yu||L instanceof Qu;this.dumplines={},this.redraw((r,n,s,o,a,l)=>{var f=this.dumplines[o];switch(f==null&&(this.dumplines[o]=f=[]),r){case 16777216:var h=L.debugSymbols.addr2symbol[n];h&&(f[-1]=h);break;case 335544320:case 352321536:case 369098752:case 385875968:f[s]=r|n;break}}),this.vlist.refresh()}},Ec=class extends Jn{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return L.debugSymbols&&L.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(L.debugSymbols.symbolmap).filter(r=>!i0(r))):this.keys=["no symbols defined"],this.vlist=new ba(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:ln("Symbol",35)+ln("Reads",8)+ln("Writes",8)};var r=this.keys[t-1],n=this.dumplines&&this.dumplines[r];function s(l){var f=n[l]|0;return ln(f?f.toString():"",8)}var o,a;return n!=null?(o=ln(r,35)+s(301989888)+s(318767104),n[16777216]?a="seg_code":n[335544320]||n[352321536]?a="seg_io":a="seg_data"):(o=ln(r,35),a="seg_unknown"),{text:o,clas:a}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,r,n,s,o,a)=>{var l=L.debugSymbols.addr2symbol[r];if(l!=null){var f=this.dumplines[l];f==null&&(f={},this.dumplines[l]=f),f[t]=(f[t]|0)+1}}),this.vlist.refresh(),this.probe&&this.probe.clear()}};var Au=[],o0=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,
Line truncated
|
|
|
|
|
`){[e,t]=Yo(this,e,t);let n="";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&&(n+=r),e<l&&t>s&&(n+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],n=-1;for(let s of e)r.push(s),n+=s.length+1,r.length==32&&(t.push(new i(r,n)),r=[],n=-1);return n>-1&&t.push(new i(r,n)),t}},Ro=class i extends tt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,n){for(let s=0;;s++){let o=this.children[s],a=n+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,n);n=a+1,r=l+1}}decompose(e,t,r,n){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 f=n&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!f?r.push(a):a.decompose(e-o,t-o,r,f)}o=l+1}}replace(e,t,r){if([e,t]=Yo(this,e,t),r.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),f=this.lines-o.lines+l.lines;if(l.lines<f>>4&&l.lines>f>>6){let h=this.children.slice();return h[n]=l,new i(h,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
|
|
|
|
|
`){[e,t]=Yo(this,e,t);let n="";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&&(n+=r),e<l&&t>o&&(n+=a.sliceString(e-o,t-o,r)),o=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof i))return 0;let r=0,[n,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==a)return r;let l=this.children[n],f=e.children[s];if(l!=f)return r+l.scanIdentical(f,t);r+=l.length+1}}static from(e,t=e.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let b of e)r+=b.lines;if(r<32){let b=[];for(let y of e)y.flatten(b);return new Fi(b,t)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,a=[],l=0,f=-1,h=[];function O(b){let y;if(b.lines>s&&b instanceof i)for(let P of b.children)O(P);else b.lines>o&&(l>o||!l)?(m(),a.push(b)):b instanceof Fi&&l&&(y=h[h.length-1])instanceof Fi&&b.lines+y.lines<=32?(l+=b.lines,f+=b.length+1,h[h.length-1]=new Fi(y.text.concat(b.text),y.length+1+b.length)):(l+b.lines>n&&m(),l+=b.lines,f+=b.length+1,h.push(b))}function m(){l!=0&&(a.push(h.length==1?h[0]:i.from(h,f)),f=-1,l=h.length=0)}for(let b of e)O(b);return m(),a.length==1?a[0]:new i(a,t)}};tt.empty=new Fi([""],0);function Uw(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Lc(i,e,t=0,r=1e9){for(let n=0,s=0,o=!0;s<i.length&&n<=r;s++){let a=i[s],l=n+a.length;l>=t&&(l>r&&(a=a.slice(0,r-n)),n<t&&(a=a.slice(t-n)),o?(e[e.length-1]+=a,o=!1):e.push(a)),n=l+1}return e}function h0(i,e,t){return Lc(i,[""],e,t)}var Is=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 Fi?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,a=n instanceof Fi?n.text.length:n.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
|
`,this;e--}else if(n instanceof Fi){let l=n.text[o+(t<0?-1:0)];if(this.offsets[r]+=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=n.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Fi?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)}},Mc=class{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new Is(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}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 r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=r?n:t<0?n.slice(n.length-r):n.slice(0,r),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!=""}},Vc=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(tt.prototype[Symbol.iterator]=function(){return this.iter()},Is.prototype[Symbol.iterator]=Mc.prototype[Symbol.iterator]=Vc.prototype[Symbol.iterator]=function(){return this});var Eu=class{constructor(e,t,r,n){this.from=e,this.to=t,this.number=r,this.text=n}get length(){return this.to-this.from}};function Yo(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function Ut(i,e,t=!0,r=!0){return a0(i,e,t,r)}function zw(i){return i>=56320&&i<57344}function Lw(i){return i>=55296&&i<56320}function Ur(i,e){let t=i.charCodeAt(e);if(!Lw(t)||e+1==i.length)return t;let r=i.charCodeAt(e+1);return zw(r)?(t-55296<<10)+(r-56320)+65536:t}function Ic(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ts(i){return i<65536?1:2}var Zu=/\r\n?|\n/,It=(function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i})(It||(It={})),Tn=class i{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 r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,n,s),n+=s):n+=o,r+=s}}iterChangedRanges(e,t=!1){Uu(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];n<0?e.push(r,n):e.push(n,r)}return new i(e)}composeDesc(e){return this.empty?e:e.empty?this:m0(this,e)}mapDesc(e,t=!1){return e.empty?this:zu(this,e,t)}mapPos(e,t=-1,r=It.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],f=n+a;if(l<0){if(f>e)return s+(e-n);s+=a}else{if(r!=It.Simple&&f>=e&&(r==It.TrackDel&&n<e&&f>e||r==It.TrackBefore&&n<e||r==It.TrackAfter&&f>e))return null;if(f>e||f==e&&t<0&&!a)return e==n||t<0?s:s+l;s+=l}n=f}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let r=0,n=0;r<this.sections.length&&n<=t;){let s=this.sections[r++],o=this.sections[r++],a=n+s;if(o>=0&&n<=t&&a>=e)return n<e&&a>t?"cover":!0;n=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+r+(n>=0?":"+n:"")}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 i(e)}static create(e){return new i(e)}},xi=class i extends Tn{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 Uu(this,(t,r,n,s,o)=>e=e.replace(n,n+(r-t),o),!1),e}mapDesc(e,t=!1){return zu(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],a=t[n+1];if(a>=0){t[n]=a,t[n+1]=o;let l=n>>1;for(;r.length<l;)r.push(tt.empty);r.push(o?e.slice(s,s+o):tt.empty)}s+=o}return new i(t,r)}compose(e){return this.empty?e:e.empty?this:m0(this,e,!0)}map(e,t=!1){return e.empty?this:zu(this,e,t,!0)}iterChanges(e,t=!1){Uu(this,e,t)}get desc
Line truncated
|
|
|
|
|
`}get readOnly(){return this.facet(v0)}phrase(e,...t){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,n)=>{if(n=="$")return"$";let s=+(n||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let n=[];for(let s of this.facet(b0))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return Bw(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=Ut(t,o,!1);if(s(t.slice(l,o))!=xt.Word)break;o=l}for(;a<n;){let l=Ut(t,a);if(s(t.slice(a,l))!=xt.Word)break;a=l}return o==a?null:F.range(o+r,a+r)}};it.allowMultipleSelections=Mu;it.tabSize=me.define({combine:i=>i.length?i[0]:4});it.lineSeparator=S0;it.readOnly=v0;it.phrases=me.define({compare(i,e){let t=Object.keys(i),r=Object.keys(e);return t.length==r.length&&t.every(n=>i[n]==e[n])}});it.languageData=b0;it.changeFilter=Q0;it.transactionFilter=y0;it.transactionExtender=x0;Eo.reconfigure=Ce.define();function Hi(i,e,t={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let n in e)r[n]===void 0&&(r[n]=e[n]);return r}var ur=class{eq(e){return this==e}range(e,t=e){return Aa.create(e,t,this)}};ur.prototype.startSide=ur.prototype.endSide=0;ur.prototype.point=!1;ur.prototype.mapMode=It.TrackDel;function Fu(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}var Aa=class i{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new i(e,t,r)}};function ju(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}var Iu=class i{constructor(e,t,r,n){this.from=e,this.to=t,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,n=0){let s=r?this.to:this.from;for(let o=n,a=s.length;;){if(o==a)return o;let l=o+a>>1,f=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return f>=0?o:a;f>=0?a=l:o=l+1}}between(e,t,r,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(n(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],n=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let f=this.value[l],h=this.from[l]+e,O=this.to[l]+e,m,b;if(h==O){let y=t.mapPos(h,f.startSide,f.mapMode);if(y==null||(m=b=y,f.startSide!=f.endSide&&(b=t.mapPos(h,f.endSide),b<m)))continue}else if(m=t.mapPos(h,f.startSide),b=t.mapPos(O,f.endSide),m>b||m==b&&f.startSide>0&&f.endSide<=0)continue;(b-m||f.endSide-f.startSide)<0||(o<0&&(o=m),f.point&&(a=Math.max(a,b-m)),r.push(f),n.push(m-o),s.push(b-o))}return{mapped:r.length?new i(n,s,r,a):null,pos:o}}},Le=class i{constructor(e,t,r,n){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=n}static create(e,t,r,n){return new i(e,t,r,n)}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:r=!1,filterFrom:n=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(ju)),this.isEmpty)return t.length?i.of(t):this;let a=new jc(this,null,-1).goto(0),l=0,f=[],h=new Zr;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let O=t[l++];h.addInner(O.from,O.to,O.value)||f.push(O)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||n>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||n>a.to||s<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||f.push(Aa.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!f.length?i.empty:this.nextLayer.update({add:f,filter:o,filterFrom:n,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],n=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],f=e.touchesRange(a,a+l.length);if(f===!1)n=Math.max(n,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(f===!0){let{mapped:h,pos:O}=l.map(a,e);h&&(n=Math.max(n,h.maxPoint),t.push(h),r.push(O))}}let s=this.nextLayer.map(e);return t.length==0?s:new i(r,t,s||i.empty,n)}between(e,t,r){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],o=this.chunk[n];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Ya.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ya.from(e).goto(t)}static compare(e,t,r,n,s=-1){let o=e.filter(O=>O.maxPoint>0||!O.is
Line truncated
|
|
|
|
|
`)}static newName(){let e=k0[P0]||1;return k0[P0]=e+1,"\u037C"+e.toString(36)}static mount(e,t,r){let n=e[Hu],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Ku(e,s),n.mount(Array.isArray(t)?t:[t],e)}},T0=new Map,Ku=class{constructor(e,t){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=T0.get(r);if(s)return e[Hu]=s;this.sheet=new n.CSSStyleSheet,T0.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Hu]=this}mount(e,t){let r=this.sheet,n=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),r)for(let f=0;f<a.rules.length;f++)r.insertRule(a.rules[f],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=a.rules.length,s++}}if(r)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 Xn={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:"'"},Zo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Fw=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),Hw=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Dt=0;Dt<10;Dt++)Xn[48+Dt]=Xn[96+Dt]=String(Dt);var Dt;for(Dt=1;Dt<=24;Dt++)Xn[Dt+111]="F"+Dt;var Dt;for(Dt=65;Dt<=90;Dt++)Xn[Dt]=String.fromCharCode(Dt+32),Zo[Dt]=String.fromCharCode(Dt);var Dt;for(Bc in Xn)Zo.hasOwnProperty(Bc)||(Zo[Bc]=Xn[Bc]);var Bc;function X0(i){var e=Fw&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||Hw&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?Zo:Xn)[i.keyCode]||i.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 zt(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var n=t[r];typeof n=="string"?i.setAttribute(r,n):n!=null&&(i[r]=n)}e++}for(;e<arguments.length;e++)_0(i,arguments[e]);return i}function _0(i,e){if(typeof e=="string")i.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)i.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)_0(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}var wi=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},lO=typeof document!="undefined"?document:{documentElement:{style:{}}},cO=/Edge\/(\d+)/.exec(wi.userAgent),pb=/MSIE \d/.test(wi.userAgent),fO=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wi.userAgent),Tf=!!(pb||fO||cO),R0=!Tf&&/gecko\/(\d+)/i.test(wi.userAgent),Ju=!Tf&&/Chrome\/(\d+)/.exec(wi.userAgent),C0="webkitFontSmoothing"in lO.documentElement.style,hO=!Tf&&/Apple Computer/.test(wi.vendor),A0=hO&&(/Mobile\/\w+/.test(wi.userAgent)||wi.maxTouchPoints>2),Qe={mac:A0||/Mac/.test(wi.platform),windows:/Win/.test(wi.platform),linux:/Linux|X11/.test(wi.platform),ie:Tf,ie_version:pb?lO.documentMode||6:fO?+fO[1]:cO?+cO[1]:0,gecko:R0,gecko_version:R0?+(/Firefox\/(\d+)/.exec(wi.userAgent)||[0,0])[1]:0,chrome:!!Ju,chrome_version:Ju?+Ju[1]:0,ios:A0,android:/Android\b/.test(wi.userAgent),webkit:C0,webkit_version:C0?+(/\bAppleWebKit\/(\d+)/.exec(wi.userAgent)||[0,0])[1]:0,safari:hO,safari_version:hO?+(/\bVersion\/(\d+(\.\d+)?)/.exec(wi.userAgent)||[0,0])[1]:0,tabSize:lO.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function rd(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}var ff=Object.create(null);function nd(i,e,t){if(i==e)return!0;i||(i=ff),e||(e=ff);let r=Object.keys(i),n=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(n.indexOf(s)==-1||i[s]!==e[s]))return!1;return!0}function Kw(i,e){for(let t=i.attributes.length-1;t>=0;t--){let r=i.attributes[t].name;e[r]==null&&i.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?i.style.cssText=r:i.getAttribute(t)!=r&&i.setAttribute(t,r)}}function Y0(i,e,t){let r=!1;if(e)for(let n in e)t&&n in t||(r=!0,n=="style"?i.style.cssText="":i.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(r=!0,n=="style"?i.style.cssText=t[n]:i.setAttribute(n,t[n]));return r}function Jw(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let r=i.attributes[t];e[r.name]=r.value}return e}var fi=class{eq(e){return!1}updateDOM(e,t){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,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},ei=(function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i})(ei||(ei={})),pe=class extends ur{constructor(e,t,r,n){super(),this.startSide=e,this.endSLine truncated
|
|
|
|
|
`,n=i.state.doc.line(n.number+(t?1:-1)),s=i.bidiSpans(n),f=i.visualLineSide(n,!t)}if(l){if(!l(h))return a}else{if(!r)return f;l=r(h)}a=f}}function A$(i,e,t){let r=i.state.charCategorizer(e),n=r(t);return s=>{let o=r(s);return n==xt.Space&&(n=o),n==o}}function Y$(i,e,t,r){let n=e.head,s=t?1:-1;if(n==(t?i.state.doc.length:0))return F.cursor(n,e.assoc);let o=e.goalColumn,a,l=i.contentDOM.getBoundingClientRect(),f=i.coordsAtPos(n,(e.empty?e.assoc:0)||(t?1:-1)),h=i.documentTop;if(f)o==null&&(o=f.left-l.left),a=s<0?f.top:f.bottom;else{let y=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(l.right-l.left,i.defaultCharacterWidth*(n-y.from))),a=(s<0?y.top:y.bottom)+h}let O=l.left+o,m=r!=null?r:i.viewState.heightOracle.textHeight>>1,b=kO(i,{x:O,y:a+m*s},!1,s);return F.cursor(b.pos,b.assoc,void 0,o)}function qa(i,e,t){for(;;){let r=0;for(let n of i)n.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function Wb(i,e){let t=null;for(let r=0;r<e.ranges.length;r++){let n=e.ranges[r],s=null;if(n.empty){let o=qa(i,n.from,0);o!=n.from&&(s=F.cursor(o,-1))}else{let o=qa(i,n.from,-1),a=qa(i,n.to,1);(o!=n.from||a!=n.to)&&(s=F.range(n.from==n.anchor?o:a,n.from==n.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?F.create(t,e.mainIndex):e}function iO(i,e,t){let r=qa(i.state.facet(tl).map(n=>n(i)),t.from,e.head>t.from?-1:1);return r==t.from?t:F.cursor(r,r<t.from?1:-1)}var mr=class{constructor(e,t){this.pos=e,this.assoc=t}};function kO(i,e,t,r){let n=i.contentDOM.getBoundingClientRect(),s=n.top+i.viewState.paddingTop,{x:o,y:a}=e,l=a-s,f;for(;;){if(l<0)return new mr(0,1);if(l>i.viewState.docHeight)return new mr(i.state.doc.length,-1);if(f=i.elementAtHeight(l),r==null)break;if(f.type==ei.Text){if(r<0?f.to<i.viewport.from:f.from>i.viewport.to)break;let m=i.docView.coordsAt(r<0?f.from:f.to,r>0?-1:1);if(m&&(r<0?m.top<=l+s:m.bottom>=l+s))break}let O=i.viewState.heightOracle.textHeight/2;l=r>0?f.bottom+O:f.top-O}if(i.viewport.from>=f.to||i.viewport.to<=f.from){if(t)return null;if(f.type==ei.Text){let O=R$(i,n,f,o,a);return new mr(O,O==f.from?1:-1)}}if(f.type!=ei.Text)return l<(f.top+f.bottom)/2?new mr(f.from,1):new mr(f.to,-1);let h=i.docView.lineAt(f.from,2);return(!h||h.length!=f.length)&&(h=i.docView.lineAt(f.from,-2)),new TO(i,o,a,i.textDirectionAt(f.from)).scanTile(h,f.from)}var TO=class{constructor(e,t,r,n){this.view=e,this.x=t,this.y=r,this.baseDir=n,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:r,spans:n}=this.bidiSpansAt(e);return n[gr.find(n,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:n}=this.bidiSpansAt(e);return n[gr.find(n,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:n}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+n.from<t)}scan(e,t){let r=0,n=e.length-1,s=new Set,o=this.bidiIn(e[0],e[n]),a,l,f=-1,h=1e9,O;e:for(;r<n;){let b=n-r,y=r+n>>1;t:if(s.has(y)){let X=r+Math.floor(Math.random()*b);for(let Y=0;Y<b;Y++){if(!s.has(X)){y=X;break t}X++,X==n&&(X=r)}break e}s.add(y);let P=t(y);if(P)for(let X=0;X<P.length;X++){let Y=P[X],G=0;if(Y.bottom<this.y)(!a||a.bottom<Y.bottom)&&(a=Y),G=1;else if(Y.top>this.y)(!l||l.top>Y.top)&&(l=Y),G=-1;else{let q=Y.left>this.x?this.x-Y.left:Y.right<this.x?this.x-Y.right:0,N=Math.abs(q);N<h&&(f=y,h=N,O=Y),q&&(G=q<0==(this.baseDir==St.LTR)?-1:1)}G==-1&&(!o||this.baseDirAt(e[y],1))?n=y:G==1&&(!o||this.baseDirAt(e[y+1],-1))&&(r=y+1)}}if(!O){let b=a&&(!l||this.y-a.bottom<l.top-this.y)?a:l;return this.y=(b.top+b.bottom)/2,this.scan(e,t)}let m=(o?this.dirAt(e[f],1):this.baseDir)==St.LTR;return{i:f,after:this.x>(O.left+O.right)/2==m}}scanText(e,t){let r=[];for(let s=0;s<e.length;s=Ut(e.text,s))r.push(t+s);r.push(t+e.length);let n=this.scan(r,s=>{let o=r[s]-t,a=r[s+1]-t;return Ha(e.dom,o,a).getClientRects()});return n.after?new mr(r[n.i+1],-1):new mr(r[n.i],1)}scanTile(e,t){if(!e.length)return new mr(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 r=[t];for(let a=0,l=t;a<e.children.length;a++)r.push(l+=e.children[a].length);let n=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Ha(l.dom,0,l.length)).getClientRects()}),s=e.children[n.i],o=r[n.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):n.after?new mr(r[n.i+1],-1):new mr(o,1)}},Za="\uFFFF",XO=class{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(it.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Za}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let n=e;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=Zt.get(n),a=n.nextSibling;if(a==t){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Zt.get(a);(o&&l?o.breakAfter:
Line truncated
|
|
|
|
|
`&&i.lineWrapping&&(r&&(r=F.single(r.main.anchor-1,r.main.head-1)),t={from:n.from,to:n.to,insert:tt.of([" "])}),t)return hd(i,t,r,s);if(r&&!bf(r,n)){let o=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),a=i.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=Wb(i.state.facet(tl).map(l=>l(i)),r))),i.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function hd(i,e,t,r=-1){if(Qe.ios&&i.inputState.flushIOSKey(e))return!0;let n=i.state.selection.main;if(Qe.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&i.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Do(i.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&Do(i.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&Do(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=U$(i,e,t));return i.state.facet(Rb).some(l=>l(i,e.from,e.to,s,a))||i.dispatch(a()),!0}function U$(i,e,t){let r,n=i.state,s=n.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,f=l<0?s.from:s.to,h=qa(n.facet(tl).map(O=>O(i)),f,l);e.from==h&&(o=h)}if(o>-1)r={changes:e,selection:F.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)&&i.inputState.composing<0){let l=s.from<e.from?n.sliceDoc(s.from,e.from):"",f=s.to>e.to?n.sliceDoc(e.to,s.to):"";r=n.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+f))}else{let l=n.changes(e),f=t&&t.main.to<=l.newLength?t.main:void 0;if(n.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let h=i.state.sliceDoc(e.from,e.to),O,m=t&&Db(i,t.main.head);if(m){let y=e.insert.length-(e.to-e.from);O={from:m.from,to:m.to-y}}else O=i.state.doc.lineAt(s.head);let b=s.to-e.to;r=n.changeByRange(y=>{if(y.from==s.from&&y.to==s.to)return{changes:l,range:f||y.map(l)};let P=y.to-b,X=P-h.length;if(i.state.sliceDoc(X,P)!=h||P>=O.from&&X<=O.to)return{range:y};let Y=n.changes({from:X,to:P,insert:e.insert}),G=y.to-s.to;return{changes:Y,range:f?F.range(Math.max(0,f.anchor+G),Math.max(0,f.head+G)):y.map(Y)}})}else r={changes:l,selection:f&&n.selection.replaceRange(f)}}let a="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,a+=".compose",i.inputState.compositionFirstChange&&(a+=".start",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:a,scrollIntoView:!0})}function Ib(i,e,t,r){let n=Math.min(i.length,e.length),s=0;for(;s<n&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==n&&i.length==e.length)return null;let o=i.length,a=e.length;for(;o>0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&i.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 z$(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new gf(t,r)),(n!=t||s!=r)&&e.push(new gf(n,s))),e}function L$(i,e){if(i.length==0)return null;let t=i[0].pos,r=i.length==2?i[1].pos:t;return t>-1&&r>-1?F.single(t+e,r+e):null}function bf(i,e){return e.head==i.main.head&&e.anchor==i.main.anchor}var RO=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 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,Qe.safari&&e.contentDOM.addEventListener("input",()=>null),Qe.gecko&&J$(e.contentDOM.ownerDocument)}handleEvent(e){!I$(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 r=this.handlers[e];if(r){for(let n of r.observers)n(this.view,t);for(let n of r.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=M$(e),r=this.handlers,n=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].
Line truncated
|
|
|
|
|
`))};if((Qe.mac||Qe.android)&&O.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(O={from:a,to:l,insert:tt.of([r.text.replace("."," ")])}),this.pendingContextChange=O,!e.state.readOnly){let m=this.to-this.from+(O.to-O.from+O.insert.length);hd(e,O,F.single(this.toEditorPos(r.selectionStart,m),this.toEditorPos(r.selectionEnd,m)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),O.from<O.to&&!O.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let n=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.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,n.push(s)}t.updateCharacterBounds(r.rangeStart,n)},this.handlers.textformatupdate=r=>{let n=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),f=this.toEditorPos(s.rangeEnd);if(l<f){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;n.push(pe.mark({attributes:{style:h}}).range(l,f))}}}e.dispatch({effects:Zb.of(pe.set(n))})},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:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let n=Fa(r.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,n=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,f)=>{if(r)return;let h=f.length-(o-s);if(n&&o>=n.to)if(n.from==s&&n.to==o&&n.insert.eq(f)){n=this.pendingContextChange=null,t+=h,this.to+=h;return}else n=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+f.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),f.toString()),this.to+=h}t+=h}),n&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(n=>!n.isUserEvent("input.type")&&n.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,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(r,n)}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 r=this.composing;return r&&r.drifted?r.editorBase+(e-r.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])}},ne=class i{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.mea
Line truncated
|
|
|
|
|
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,GO),$P={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"},nO=null;function PP(){var i;if(nO==null&&typeof document!="undefined"&&document.body){let e=document.body.style;nO=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return nO||!1}var lf=me.define({combine(i){let e=Hi(i,{render:null,specialChars:wP,addSpecialChars:null});return(e.replaceTabs=!PP())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,GO)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,GO)),e}});function uS(i={}){return[lf.of(i),kP()]}var ab=null;function kP(){return ab||(ab=Lt.fromClass(class{constructor(i){this.view=i,this.decorations=pe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(lf)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new BO({regexp:i.specialChars,decoration:(e,t,r)=>{let{doc:n}=t.state,s=Ur(e[0],0);if(s==9){let o=n.lineAt(r),a=t.state.tabSize,l=vi(o.text,a,r-o.from);return pe.replace({widget:new HO((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=pe.replace({widget:new FO(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(lf);i.startState.facet(lf)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}var TP="\u2022";function XP(i){return i>=32?TP:i==10?"\u2424":String.fromCharCode(9216+i)}var FO=class extends fi{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=XP(this.code),r=e.state.phrase("Control character")+" "+($P[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,r,t);if(n)return n;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}},HO=class extends fi{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 Od(){return RP}var _P=pe.line({class:"cm-activeLine"}),RP=Lt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let r of i.state.selection.ranges){let n=i.lineBlockAt(r.head);n.from>e&&(t.push(_P.range(n.from)),e=n.from)}return pe.set(t)}},{decorations:i=>i.decorations});var KO=2e3;function CP(i,e,t){let r=Math.min(e.line,t.line),n=Math.max(e.line,t.line),s=[];if(e.off>KO||t.off>KO||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=n;l++){let f=i.doc.line(l);f.length<=a&&s.push(F.range(f.from+o,f.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=n;l++){let f=i.doc.line(l),h=Nc(f.text,o,i.tabSize,!0);if(h<0)s.push(F.cursor(f.to));else{let O=Nc(f.text,a,i.tabSize);s.push(F.range(f.from+h,f.from+O))}}}return s}function AP(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function lb(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),r=i.state.doc.lineAt(t),n=t-r.from,s=n>KO?-1:n==r.length?AP(i,e.clientX):vi(r.text,i.state.tabSize,t-r.from);return{line:r.number,col:s,off:n}}function YP(i,e){let t=lb(i,e),r=i.state.selection;return t?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(t.line).from),o=n.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let a=lb(i,n);if(!a)return r;let l=CP(i.state,t,a);return l.length?o?F.create(l.concat(r.ranges)):F.create(l):r}}:null}function dd(i){let e=(i==null?void 0:i.eventFilter)||(t=>t.altKey&&t.button==0);return ne.mouseSelectionStyle.of((t,r)=>e(r)?YP(t,r):null)}var EP={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},ZP={style:"cursor: crosshair"};function pd(i={}){let[e,t]=EP[i.key||"Alt"],r=Lt.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==e||t(n))},keyup(n){(n.keyCode==e||!t(n))&&this.set(!1)},mousemove(n){this.set(t(n))}}}
Line truncated
|
|
|
|
|
PC `+this.addr2str(s)+" "+this.opToString(h,null,v),o[P]=1)}),this.addr2str(r)+n}},zu=class extends Cc{initCanvas(){super.initCanvas(),this.canvas.onclick=e=>{var t=cc(this.canvas,e),r=Math.floor(t.x),n=Math.floor(t.y),s=this.getOpAtPos(t.x,t.y,16777216);s&&(fn("toline"),L.runEval(()=>{let o=L.getRasterScanline&&L.getRasterScanline()>=n;return o&&L.getRasterLineClock?o&&L.getRasterLineClock()>r:o}))}}drawEvent(e,t,r,n){var s=this.getOpRGB(e,t);if(s){var o=r+n*this.canvas.width,a=s|Zr;this.datau32[o]|=a}}drawImage(){let e=Zr;for(let t=0;t<this.datau32.length;t++)this.datau32[t]==Zr?this.datau32[t]=e:e=this.datau32[t];super.drawImage()}},Yc=class extends zu{constructor(){super(...arguments);this.interrupt=0;this.rgb=0;this.lastpc=0}drawEvent(t,r,n,s){var o=n+s*this.canvas.width;if(t==134217728&&(this.interrupt=1),this.interrupt==1&&t==167772160&&(this.interrupt=r),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)-r>16&&(l+=1),Math.abs(this.lastpc)-r>256&&(l+=1),a=this.rgb=526344*l+2105376,this.lastpc=r}this.interrupt&&(a|=8388672),this.datau32[o]==Zr&&(this.datau32[o]=a|Zr)}}},Ec=class extends Jn{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new Sa(t),this.vlist.create(t,this.cyclesPerLine*this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){var r="",n="seg_data",s=this.dumplines&&this.dumplines[t];if(s!=null){var o=s.info.join(", ");r="("+cn(s.row,4)+", "+cn(s.col,4)+") "+ba(s.asm||"",20)+o,o.indexOf("Write ")>=0&&(n="seg_io")}return{text:r,clas:n}}refresh(){this.tick()}tick(){let t=L instanceof Pu||L instanceof $u;this.dumplines={},this.redraw((r,n,s,o,a,l)=>{t&&(a>>=2);var h=this.dumplines[a];switch(h==null&&(h={op:r,addr:n,row:o,col:s,asm:null,info:[]},this.dumplines[a]=h),r){case 16777216:if(L.disassemble){var f=L.disassemble(n,L.readAddress.bind(L));h.asm=f&&f.line}break;default:var O=this.opToString(r,n,l);O!=""&&h.info.push(O);break}}),this.vlist.refresh()}},Zc=class extends Jn{constructor(){super(...arguments);this.recreateOnResize=!0}createDiv(t){return this.vlist=new Sa(t),this.vlist.create(t,this.totalScanlines,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){for(var r=cn(t+"",3)+" ",n="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 h=l&65535,f=f&Zr;if(f==16777216)r+=",";else{var O=ht(h);r+=O,a+=O.length-1}}else r+=a==o?"|":"."}return s[-1]&&(r+=" "+s[-1]),{text:r,clas:n}}refresh(){this.tick()}tick(){let t=L instanceof Pu||L instanceof $u;this.dumplines={},this.redraw((r,n,s,o,a,l)=>{var h=this.dumplines[o];switch(h==null&&(this.dumplines[o]=h=[]),r){case 16777216:var f=L.debugSymbols.addr2symbol[n];f&&(h[-1]=f);break;case 335544320:case 352321536:case 369098752:case 385875968:h[s]=r|n;break}}),this.vlist.refresh()}},Uc=class extends Jn{constructor(){super(...arguments);this.recreateOnResize=!0;this.cumulativeData=!0}createDiv(t){return L.debugSymbols&&L.debugSymbols.symbolmap?this.keys=Array.from(Object.keys(L.debugSymbols.symbolmap).filter(r=>!h0(r))):this.keys=["no symbols defined"],this.vlist=new Sa(t),this.vlist.create(t,this.keys.length+1,this.getMemoryLineAt.bind(this)),this.vlist.maindiv}getMemoryLineAt(t){if(t==0)return{text:cn("Symbol",35)+cn("Reads",8)+cn("Writes",8)};var r=this.keys[t-1],n=this.dumplines&&this.dumplines[r];function s(l){var h=n[l]|0;return cn(h?h.toString():"",8)}var o,a;return n!=null?(o=cn(r,35)+s(301989888)+s(318767104),n[16777216]?a="seg_code":n[335544320]||n[352321536]?a="seg_io":a="seg_data"):(o=cn(r,35),a="seg_unknown"),{text:o,clas:a}}refresh(){this.tick()}tick(){this.dumplines={},this.redraw((t,r,n,s,o,a)=>{var l=L.debugSymbols.addr2symbol[r];if(l!=null){var h=this.dumplines[l];h==null&&(h={},this.dumplines[l]=h),h[t]=(h[t]|0)+1}}),this.vlist.refresh(),this.probe&&this.probe.clear()}};var Mu=[],d0=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,
Line truncated
|
|
|
|
|
`){[e,t]=Eo(this,e,t);let n="";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&&(n+=r),e<l&&t>s&&(n+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],n=-1;for(let s of e)r.push(s),n+=s.length+1,r.length==32&&(t.push(new i(r,n)),r=[],n=-1);return n>-1&&t.push(new i(r,n)),t}},Co=class i extends tt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,n){for(let s=0;;s++){let o=this.children[s],a=n+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,n);n=a+1,r=l+1}}decompose(e,t,r,n){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 h=n&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!h?r.push(a):a.decompose(e-o,t-o,r,h)}o=l+1}}replace(e,t,r){if([e,t]=Eo(this,e,t),r.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),h=this.lines-o.lines+l.lines;if(l.lines<h>>4&&l.lines>h>>6){let f=this.children.slice();return f[n]=l,new i(f,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
|
|
|
|
|
`){[e,t]=Eo(this,e,t);let n="";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&&(n+=r),e<l&&t>o&&(n+=a.sliceString(e-o,t-o,r)),o=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof i))return 0;let r=0,[n,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==a)return r;let l=this.children[n],h=e.children[s];if(l!=h)return r+l.scanIdentical(h,t);r+=l.length+1}}static from(e,t=e.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let b of e)r+=b.lines;if(r<32){let b=[];for(let v of e)v.flatten(b);return new Fi(b,t)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,a=[],l=0,h=-1,f=[];function O(b){let v;if(b.lines>s&&b instanceof i)for(let P of b.children)O(P);else b.lines>o&&(l>o||!l)?(m(),a.push(b)):b instanceof Fi&&l&&(v=f[f.length-1])instanceof Fi&&b.lines+v.lines<=32?(l+=b.lines,h+=b.length+1,f[f.length-1]=new Fi(v.text.concat(b.text),v.length+1+b.length)):(l+b.lines>n&&m(),l+=b.lines,h+=b.length+1,f.push(b))}function m(){l!=0&&(a.push(f.length==1?f[0]:i.from(f,h)),h=-1,l=f.length=0)}for(let b of e)O(b);return m(),a.length==1?a[0]:new i(a,t)}};tt.empty=new Fi([""],0);function I1(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Vc(i,e,t=0,r=1e9){for(let n=0,s=0,o=!0;s<i.length&&n<=r;s++){let a=i[s],l=n+a.length;l>=t&&(l>r&&(a=a.slice(0,r-n)),n<t&&(a=a.slice(t-n)),o?(e[e.length-1]+=a,o=!1):e.push(a)),n=l+1}return e}function S0(i,e,t){return Vc(i,[""],e,t)}var Is=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 Fi?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,a=n instanceof Fi?n.text.length:n.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
|
|
|
`,this;e--}else if(n instanceof Fi){let l=n.text[o+(t<0?-1:0)];if(this.offsets[r]+=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=n.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Fi?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,r){this.value="",this.done=!1,this.cursor=new Is(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}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 r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=r?n:t<0?n.slice(n.length-r):n.slice(0,r),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!=""}},Wc=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol!="undefined"&&(tt.prototype[Symbol.iterator]=function(){return this.iter()},Is.prototype[Symbol.iterator]=Dc.prototype[Symbol.iterator]=Wc.prototype[Symbol.iterator]=function(){return this});var Du=class{constructor(e,t,r,n){this.from=e,this.to=t,this.number=r,this.text=n}get length(){return this.to-this.from}};function Eo(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function zt(i,e,t=!0,r=!0){return p0(i,e,t,r)}function N1(i){return i>=56320&&i<57344}function B1(i){return i>=55296&&i<56320}function zr(i,e){let t=i.charCodeAt(e);if(!B1(t)||e+1==i.length)return t;let r=i.charCodeAt(e+1);return N1(r)?(t-55296<<10)+(r-56320)+65536:t}function Bc(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function ts(i){return i<65536?1:2}var Wu=/\r\n?|\n/,It=(function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i})(It||(It={})),Tn=class i{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 r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,n,s),n+=s):n+=o,r+=s}}iterChangedRanges(e,t=!1){qu(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];n<0?e.push(r,n):e.push(n,r)}return new i(e)}composeDesc(e){return this.empty?e:e.empty?this:w0(this,e)}mapDesc(e,t=!1){return e.empty?this:ju(this,e,t)}mapPos(e,t=-1,r=It.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],h=n+a;if(l<0){if(h>e)return s+(e-n);s+=a}else{if(r!=It.Simple&&h>=e&&(r==It.TrackDel&&n<e&&h>e||r==It.TrackBefore&&n<e||r==It.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!a)return e==n||t<0?s:s+l;s+=l}n=h}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let r=0,n=0;r<this.sections.length&&n<=t;){let s=this.sections[r++],o=this.sections[r++],a=n+s;if(o>=0&&n<=t&&a>=e)return n<e&&a>t?"cover":!0;n=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+r+(n>=0?":"+n:"")}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 i(e)}static create(e){return new i(e)}},xi=class i extends Tn{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 qu(this,(t,r,n,s,o)=>e=e.replace(n,n+(r-t),o),!1),e}mapDesc(e,t=!1){return ju(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],a=t[n+1];if(a>=0){t[n]=a,t[n+1]=o;let l=n>>1;for(;r.length<l;)r.push(tt.empty);r.push(o?e.slice(s,s+o):tt.empty)}s+=o}return new i(t,r)}compose(e){return this.empty?e:e.empty?this:w0(this,e,!0)}map(e,t=!1){return e.empty?this:ju(this,e,t,!0)}iterChanges(e,t=!1){qu(this,e,t)}get desc
Line truncated
|
|
|
|
|
`}get readOnly(){return this.facet(R0)}phrase(e,...t){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,n)=>{if(n=="$")return"$";let s=+(n||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let n=[];for(let s of this.facet(P0))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return r$(t.length?t[0]:"")}wordAt(e){let{text:t,from:r,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=zt(t,o,!1);if(s(t.slice(l,o))!=xt.Word)break;o=l}for(;a<n;){let l=zt(t,a);if(s(t.slice(a,l))!=xt.Word)break;a=l}return o==a?null:H.range(o+r,a+r)}};it.allowMultipleSelections=Nu;it.tabSize=me.define({combine:i=>i.length?i[0]:4});it.lineSeparator=k0;it.readOnly=R0;it.phrases=me.define({compare(i,e){let t=Object.keys(i),r=Object.keys(e);return t.length==r.length&&t.every(n=>i[n]==e[n])}});it.languageData=P0;it.changeFilter=T0;it.transactionFilter=X0;it.transactionExtender=_0;Zo.reconfigure=Ce.define();function Hi(i,e,t={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let n in e)r[n]===void 0&&(r[n]=e[n]);return r}var ur=class{eq(e){return this==e}range(e,t=e){return Ya.create(e,t,this)}};ur.prototype.startSide=ur.prototype.endSide=0;ur.prototype.point=!1;ur.prototype.mapMode=It.TrackDel;function rO(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}var Ya=class i{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new i(e,t,r)}};function Ku(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}var Ju=class i{constructor(e,t,r,n){this.from=e,this.to=t,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,n=0){let s=r?this.to:this.from;for(let o=n,a=s.length;;){if(o==a)return o;let l=o+a>>1,h=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return h>=0?o:a;h>=0?a=l:o=l+1}}between(e,t,r,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(n(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],n=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let h=this.value[l],f=this.from[l]+e,O=this.to[l]+e,m,b;if(f==O){let v=t.mapPos(f,h.startSide,h.mapMode);if(v==null||(m=b=v,h.startSide!=h.endSide&&(b=t.mapPos(f,h.endSide),b<m)))continue}else if(m=t.mapPos(f,h.startSide),b=t.mapPos(O,h.endSide),m>b||m==b&&h.startSide>0&&h.endSide<=0)continue;(b-m||h.endSide-h.startSide)<0||(o<0&&(o=m),h.point&&(a=Math.max(a,b-m)),r.push(h),n.push(m-o),s.push(b-o))}return{mapped:r.length?new i(n,s,r,a):null,pos:o}}},Le=class i{constructor(e,t,r,n){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=n}static create(e,t,r,n){return new i(e,t,r,n)}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:r=!1,filterFrom:n=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(Ku)),this.isEmpty)return t.length?i.of(t):this;let a=new Nc(this,null,-1).goto(0),l=0,h=[],f=new Ur;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let O=t[l++];f.addInner(O.from,O.to,O.value)||h.push(O)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||n>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&f.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||n>a.to||s<a.from||o(a.from,a.to,a.value))&&(f.addInner(a.from,a.to,a.value)||h.push(Ya.create(a.from,a.to,a.value))),a.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?i.empty:this.nextLayer.update({add:h,filter:o,filterFrom:n,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],n=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],h=e.touchesRange(a,a+l.length);if(h===!1)n=Math.max(n,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(h===!0){let{mapped:f,pos:O}=l.map(a,e);f&&(n=Math.max(n,f.maxPoint),t.push(f),r.push(O))}}let s=this.nextLayer.map(e);return t.length==0?s:new i(r,t,s||i.empty,n)}between(e,t,r){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],o=this.chunk[n];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Ea.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ea.from(e).goto(t)}static compare(e,t,r,n,s=-1){let o=e.filter(O=>O.maxPoint>0||!O.is
Line truncated
|
|
|
|
|
`)}static newName(){let e=E0[Y0]||1;return E0[Y0]=e+1,"\u037C"+e.toString(36)}static mount(e,t,r){let n=e[nO],s=r&&r.nonce;n?s&&n.setNonce(s):n=new sO(e,s),n.mount(Array.isArray(t)?t:[t],e)}},Z0=new Map,sO=class{constructor(e,t){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=Z0.get(r);if(s)return e[nO]=s;this.sheet=new n.CSSStyleSheet,Z0.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[nO]=this}mount(e,t){let r=this.sheet,n=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),r)for(let h=0;h<a.rules.length;h++)r.insertRule(a.rules[h],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=a.rules.length,s++}}if(r)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 Xn={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:"'"},Uo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},s$=typeof navigator!="undefined"&&/Mac/.test(navigator.platform),o$=typeof navigator!="undefined"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Dt=0;Dt<10;Dt++)Xn[48+Dt]=Xn[96+Dt]=String(Dt);var Dt;for(Dt=1;Dt<=24;Dt++)Xn[Dt+111]="F"+Dt;var Dt;for(Dt=65;Dt<=90;Dt++)Xn[Dt]=String.fromCharCode(Dt+32),Uo[Dt]=String.fromCharCode(Dt);var Dt;for(Fc in Xn)Uo.hasOwnProperty(Fc)||(Uo[Fc]=Xn[Fc]);var Fc;function U0(i){var e=s$&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||o$&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?Uo:Xn)[i.keyCode]||i.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 Lt(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var n=t[r];typeof n=="string"?i.setAttribute(r,n):n!=null&&(i[r]=n)}e++}for(;e<arguments.length;e++)z0(i,arguments[e]);return i}function z0(i,e){if(typeof e=="string")i.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)i.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)z0(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}var wi=typeof navigator!="undefined"?navigator:{userAgent:"",vendor:"",platform:""},pO=typeof document!="undefined"?document:{documentElement:{style:{}}},mO=/Edge\/(\d+)/.exec(wi.userAgent),yb=/MSIE \d/.test(wi.userAgent),gO=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wi.userAgent),Xh=!!(yb||gO||mO),L0=!Xh&&/gecko\/(\d+)/i.test(wi.userAgent),oO=!Xh&&/Chrome\/(\d+)/.exec(wi.userAgent),M0="webkitFontSmoothing"in pO.documentElement.style,bO=!Xh&&/Apple Computer/.test(wi.vendor),V0=bO&&(/Mobile\/\w+/.test(wi.userAgent)||wi.maxTouchPoints>2),Qe={mac:V0||/Mac/.test(wi.platform),windows:/Win/.test(wi.platform),linux:/Linux|X11/.test(wi.platform),ie:Xh,ie_version:yb?pO.documentMode||6:gO?+gO[1]:mO?+mO[1]:0,gecko:L0,gecko_version:L0?+(/Firefox\/(\d+)/.exec(wi.userAgent)||[0,0])[1]:0,chrome:!!oO,chrome_version:oO?+oO[1]:0,ios:V0,android:/Android\b/.test(wi.userAgent),webkit:M0,webkit_version:M0?+(/\bAppleWebKit\/(\d+)/.exec(wi.userAgent)||[0,0])[1]:0,safari:bO,safari_version:bO?+(/\bVersion\/(\d+(\.\d+)?)/.exec(wi.userAgent)||[0,0])[1]:0,tabSize:pO.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function hd(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}var fh=Object.create(null);function fd(i,e,t){if(i==e)return!0;i||(i=fh),e||(e=fh);let r=Object.keys(i),n=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(n.indexOf(s)==-1||i[s]!==e[s]))return!1;return!0}function a$(i,e){for(let t=i.attributes.length-1;t>=0;t--){let r=i.attributes[t].name;e[r]==null&&i.removeAttribute(r)}for(let t in e){let r=e[t];t=="style"?i.style.cssText=r:i.getAttribute(t)!=r&&i.setAttribute(t,r)}}function D0(i,e,t){let r=!1;if(e)for(let n in e)t&&n in t||(r=!0,n=="style"?i.style.cssText="":i.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(r=!0,n=="style"?i.style.cssText=t[n]:i.setAttribute(n,t[n]));return r}function l$(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let r=i.attributes[t];e[r.name]=r.value}return e}var Ft=class{eq(e){return!1}updateDOM(e,t){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,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},ti=(function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i})(ti||(ti={})),de=class extends ur{constructor(e,t,r,n){super(),this.startSide=e,this.endSLine truncated
|
|
|
|
|
`,n=i.state.doc.line(n.number+(t?1:-1)),s=i.bidiSpans(n),h=i.visualLineSide(n,!t)}if(l){if(!l(f))return a}else{if(!r)return h;l=r(f)}a=h}}function D$(i,e,t){let r=i.state.charCategorizer(e),n=r(t);return s=>{let o=r(s);return n==xt.Space&&(n=o),n==o}}function W$(i,e,t,r){let n=e.head,s=t?1:-1;if(n==(t?i.state.doc.length:0))return H.cursor(n,e.assoc);let o=e.goalColumn,a,l=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(n,(e.empty?e.assoc:0)||(t?1:-1)),f=i.documentTop;if(h)o==null&&(o=h.left-l.left),a=s<0?h.top:h.bottom;else{let v=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(l.right-l.left,i.defaultCharacterWidth*(n-v.from))),a=(s<0?v.top:v.bottom)+f}let O=l.left+o,m=r!=null?r:i.viewState.heightOracle.textHeight>>1,b=YO(i,{x:O,y:a+m*s},!1,s);return H.cursor(b.pos,b.assoc,void 0,o)}function ja(i,e,t){for(;;){let r=0;for(let n of i)n.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function Hb(i,e){let t=null;for(let r=0;r<e.ranges.length;r++){let n=e.ranges[r],s=null;if(n.empty){let o=ja(i,n.from,0);o!=n.from&&(s=H.cursor(o,-1))}else{let o=ja(i,n.from,-1),a=ja(i,n.to,1);(o!=n.from||a!=n.to)&&(s=H.range(n.from==n.anchor?o:a,n.from==n.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?H.create(t,e.mainIndex):e}function cO(i,e,t){let r=ja(i.state.facet(il).map(n=>n(i)),t.from,e.head>t.from?-1:1);return r==t.from?t:H.cursor(r,r<t.from?1:-1)}var mr=class{constructor(e,t){this.pos=e,this.assoc=t}};function YO(i,e,t,r){let n=i.contentDOM.getBoundingClientRect(),s=n.top+i.viewState.paddingTop,{x:o,y:a}=e,l=a-s,h;for(;;){if(l<0)return new mr(0,1);if(l>i.viewState.docHeight)return new mr(i.state.doc.length,-1);if(h=i.elementAtHeight(l),r==null)break;if(h.type==ti.Text){if(r<0?h.to<i.viewport.from:h.from>i.viewport.to)break;let m=i.docView.coordsAt(r<0?h.from:h.to,r>0?-1:1);if(m&&(r<0?m.top<=l+s:m.bottom>=l+s))break}let O=i.viewState.heightOracle.textHeight/2;l=r>0?h.bottom+O:h.top-O}if(i.viewport.from>=h.to||i.viewport.to<=h.from){if(t)return null;if(h.type==ti.Text){let O=M$(i,n,h,o,a);return new mr(O,O==h.from?1:-1)}}if(h.type!=ti.Text)return l<(h.top+h.bottom)/2?new mr(h.from,1):new mr(h.to,-1);let f=i.docView.lineAt(h.from,2);return(!f||f.length!=h.length)&&(f=i.docView.lineAt(h.from,-2)),new EO(i,o,a,i.textDirectionAt(h.from)).scanTile(f,h.from)}var EO=class{constructor(e,t,r,n){this.view=e,this.x=t,this.y=r,this.baseDir=n,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:r,spans:n}=this.bidiSpansAt(e);return n[gr.find(n,e-r.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:r,spans:n}=this.bidiSpansAt(e);return n[gr.find(n,e-r.from,-1,t)].dir}bidiIn(e,t){let{spans:r,line:n}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+n.from<t)}scan(e,t){let r=0,n=e.length-1,s=new Set,o=this.bidiIn(e[0],e[n]),a,l,h=-1,f=1e9,O;e:for(;r<n;){let b=n-r,v=r+n>>1;t:if(s.has(v)){let T=r+Math.floor(Math.random()*b);for(let Y=0;Y<b;Y++){if(!s.has(T)){v=T;break t}T++,T==n&&(T=r)}break e}s.add(v);let P=t(v);if(P)for(let T=0;T<P.length;T++){let Y=P[T],B=0;if(Y.bottom<this.y)(!a||a.bottom<Y.bottom)&&(a=Y),B=1;else if(Y.top>this.y)(!l||l.top>Y.top)&&(l=Y),B=-1;else{let q=Y.left>this.x?this.x-Y.left:Y.right<this.x?this.x-Y.right:0,N=Math.abs(q);N<f&&(h=v,f=N,O=Y),q&&(B=q<0==(this.baseDir==St.LTR)?-1:1)}B==-1&&(!o||this.baseDirAt(e[v],1))?n=v:B==1&&(!o||this.baseDirAt(e[v+1],-1))&&(r=v+1)}}if(!O){let b=a&&(!l||this.y-a.bottom<l.top-this.y)?a:l;return this.y=(b.top+b.bottom)/2,this.scan(e,t)}let m=(o?this.dirAt(e[h],1):this.baseDir)==St.LTR;return{i:h,after:this.x>(O.left+O.right)/2==m}}scanText(e,t){let r=[];for(let s=0;s<e.length;s=zt(e.text,s))r.push(t+s);r.push(t+e.length);let n=this.scan(r,s=>{let o=r[s]-t,a=r[s+1]-t;return Ka(e.dom,o,a).getClientRects()});return n.after?new mr(r[n.i+1],-1):new mr(r[n.i],1)}scanTile(e,t){if(!e.length)return new mr(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 r=[t];for(let a=0,l=t;a<e.children.length;a++)r.push(l+=e.children[a].length);let n=this.scan(r,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Ka(l.dom,0,l.length)).getClientRects()}),s=e.children[n.i],o=r[n.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):n.after?new mr(r[n.i+1],-1):new mr(o,1)}},Ua="\uFFFF",ZO=class{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(it.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ua}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let n=e;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=Ut.get(n),a=n.nextSibling;if(a==t){o!=null&&o.breakAfter&&!a&&r!=this.view.contentDOM&&this.lineBreak();break}let l=Ut.get(a);(o&&l?o.breakAfter:
Line truncated
|
|
|
|
|
`&&i.lineWrapping&&(r&&(r=H.single(r.main.anchor-1,r.main.head-1)),t={from:n.from,to:n.to,insert:tt.of([" "])}),t)return bd(i,t,r,s);if(r&&!Sh(r,n)){let o=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),a=i.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=Hb(i.state.facet(il).map(l=>l(i)),r))),i.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function bd(i,e,t,r=-1){if(Qe.ios&&i.inputState.flushIOSKey(e))return!0;let n=i.state.selection.main;if(Qe.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&i.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Wo(i.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&Wo(i.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&Wo(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=I$(i,e,t));return i.state.facet(Lb).some(l=>l(i,e.from,e.to,s,a))||i.dispatch(a()),!0}function I$(i,e,t){let r,n=i.state,s=n.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,h=l<0?s.from:s.to,f=ja(n.facet(il).map(O=>O(i)),h,l);e.from==f&&(o=f)}if(o>-1)r={changes:e,selection:H.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)&&i.inputState.composing<0){let l=s.from<e.from?n.sliceDoc(s.from,e.from):"",h=s.to>e.to?n.sliceDoc(e.to,s.to):"";r=n.replaceSelection(i.state.toText(l+e.insert.sliceString(0,void 0,i.state.lineBreak)+h))}else{let l=n.changes(e),h=t&&t.main.to<=l.newLength?t.main:void 0;if(n.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let f=i.state.sliceDoc(e.from,e.to),O,m=t&&Fb(i,t.main.head);if(m){let v=e.insert.length-(e.to-e.from);O={from:m.from,to:m.to-v}}else O=i.state.doc.lineAt(s.head);let b=s.to-e.to;r=n.changeByRange(v=>{if(v.from==s.from&&v.to==s.to)return{changes:l,range:h||v.map(l)};let P=v.to-b,T=P-f.length;if(i.state.sliceDoc(T,P)!=f||P>=O.from&&T<=O.to)return{range:v};let Y=n.changes({from:T,to:P,insert:e.insert}),B=v.to-s.to;return{changes:Y,range:h?H.range(Math.max(0,h.anchor+B),Math.max(0,h.head+B)):v.map(Y)}})}else r={changes:l,selection:h&&n.selection.replaceRange(h)}}let a="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,a+=".compose",i.inputState.compositionFirstChange&&(a+=".start",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:a,scrollIntoView:!0})}function eS(i,e,t,r){let n=Math.min(i.length,e.length),s=0;for(;s<n&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==n&&i.length==e.length)return null;let o=i.length,a=e.length;for(;o>0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&i.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 N$(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new bh(t,r)),(n!=t||s!=r)&&e.push(new bh(n,s))),e}function B$(i,e){if(i.length==0)return null;let t=i[0].pos,r=i.length==2?i[1].pos:t;return t>-1&&r>-1?H.single(t+e,r+e):null}function Sh(i,e){return e.head==i.main.head&&e.anchor==i.main.anchor}var zO=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 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,Qe.safari&&e.contentDOM.addEventListener("input",()=>null),Qe.gecko&&lP(e.contentDOM.ownerDocument)}handleEvent(e){!tP(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 r=this.handlers[e];if(r){for(let n of r.observers)n(this.view,t);for(let n of r.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=G$(e),r=this.handlers,n=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].
Line truncated
|
|
|
|
|
`))};if((Qe.mac||Qe.android)&&O.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(O={from:a,to:l,insert:tt.of([r.text.replace("."," ")])}),this.pendingContextChange=O,!e.state.readOnly){let m=this.to-this.from+(O.to-O.from+O.insert.length);bd(e,O,H.single(this.toEditorPos(r.selectionStart,m),this.toEditorPos(r.selectionEnd,m)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),O.from<O.to&&!O.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(t.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let n=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.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,n.push(s)}t.updateCharacterBounds(r.rangeStart,n)},this.handlers.textformatupdate=r=>{let n=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(l<h){let f=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;n.push(de.mark({attributes:{style:f}}).range(l,h))}}}e.dispatch({effects:qb.of(de.set(n))})},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:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)t.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let n=Ha(r.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,n=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,h)=>{if(r)return;let f=h.length-(o-s);if(n&&o>=n.to)if(n.from==s&&n.to==o&&n.insert.eq(h)){n=this.pendingContextChange=null,t+=f,this.to+=f;return}else n=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=f,this.to+=f;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=f}t+=f}),n&&!r&&this.revertPending(e.state),!r}update(e){let t=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(n=>!n.isUserEvent("input.type")&&n.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,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(r,n)}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 r=this.composing;return r&&r.drifted?r.editorBase+(e-r.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])}},ne=class i{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.mea
Line truncated
|
|
|
|
|
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,id),YP={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"},fO=null;function EP(){var i;if(fO==null&&typeof document!="undefined"&&document.body){let e=document.body.style;fO=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return fO||!1}var ch=me.define({combine(i){let e=Hi(i,{render:null,specialChars:AP,addSpecialChars:null});return(e.replaceTabs=!EP())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,id)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,id)),e}});function QS(i={}){return[ch.of(i),ZP()]}var pb=null;function ZP(){return pb||(pb=Rt.fromClass(class{constructor(i){this.view=i,this.decorations=de.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(ch)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new td({regexp:i.specialChars,decoration:(e,t,r)=>{let{doc:n}=t.state,s=zr(e[0],0);if(s==9){let o=n.lineAt(r),a=t.state.tabSize,l=yi(o.text,a,r-o.from);return de.replace({widget:new nd((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=de.replace({widget:new rd(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(ch);i.startState.facet(ch)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}var UP="\u2022";function zP(i){return i>=32?UP:i==10?"\u2424":String.fromCharCode(9216+i)}var rd=class extends Ft{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=zP(this.code),r=e.state.phrase("Control character")+" "+(YP[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,r,t);if(n)return n;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}},nd=class extends Ft{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 MP}var LP=de.line({class:"cm-activeLine"}),MP=Rt.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let r of i.state.selection.ranges){let n=i.lineBlockAt(r.head);n.from>e&&(t.push(LP.range(n.from)),e=n.from)}return de.set(t)}},{decorations:i=>i.decorations});var sd=2e3;function VP(i,e,t){let r=Math.min(e.line,t.line),n=Math.max(e.line,t.line),s=[];if(e.off>sd||t.off>sd||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=n;l++){let h=i.doc.line(l);h.length<=a&&s.push(H.range(h.from+o,h.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=n;l++){let h=i.doc.line(l),f=Gc(h.text,o,i.tabSize,!0);if(f<0)s.push(H.cursor(h.to));else{let O=Gc(h.text,a,i.tabSize);s.push(H.range(h.from+f,h.from+O))}}}return s}function DP(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function mb(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),r=i.state.doc.lineAt(t),n=t-r.from,s=n>sd?-1:n==r.length?DP(i,e.clientX):yi(r.text,i.state.tabSize,t-r.from);return{line:r.number,col:s,off:n}}function WP(i,e){let t=mb(i,e),r=i.state.selection;return t?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(t.line).from),o=n.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let a=mb(i,n);if(!a)return r;let l=VP(i.state,t,a);return l.length?o?H.create(l.concat(r.ranges)):H.create(l):r}}:null}function vd(i){let e=(i==null?void 0:i.eventFilter)||(t=>t.altKey&&t.button==0);return ne.mouseSelectionStyle.of((t,r)=>e(r)?WP(t,r):null)}var qP={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},jP={style:"cursor: crosshair"};function xd(i={}){let[e,t]=qP[i.key||"Alt"],r=Rt.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==e||t(n))},keyup(n){(n.keyCode==e||!t(n))&&this.set(!1)},mousemove(n){this.set(t(n))}}}
Line truncated
|
|
|
|
|
`&&(t="");else{let r=t.indexOf(`
|
|
|
|
|
`);r>-1&&(t=t.slice(0,r))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),r=e+t.length;for(let n=this.rangeIndex;;){let s=this.ranges[n].to;if(s>=r||(t=t.slice(0,s-(r-t.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,a=this.lineAfter(o);t+=a,r=o+a.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let n=this.ranges[this.rangeIndex].to,s=e+t;if(r>0?n>s:n>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-n}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,r,n){let s=4;if(this.ranges.length>1){n=this.skipGapsTo(t,n,1),t+=n;let a=this.chunk.length;n=this.skipGapsTo(r,n,-1),r+=n,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]=r:this.chunk.push(e,t,r,s),n}parseLine(e){let{line:t,end:r}=this.nextLine(),n=0,{streamParser:s}=this.lang,o=new Df(t,e?e.state.tabSize:4,e?us(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=nQ(s.token,o,this.state);if(a&&(n=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,n)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Ne.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Mk,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Ne(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 Ne(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function nQ(i,e,t){e.start=e.pos;for(let r=0;r<10;r++){let n=i(e,t);if(e.pos>e.start)return n}throw new Error("Stream parser failed to advance stream.")}var Kd=Object.create(null),ll=[Rt.none],Mk=new Cn(ll),DS=[],WS=Object.create(null),sQ=Object.create(null);for(let[i,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"]])sQ[i]=oQ(Kd,e);var Wf=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),sQ)}resolve(e){return e?this.table[e]||(this.table[e]=oQ(this.extra,e)):0}},Vk=new Wf(Kd);function Ud(i,e){DS.indexOf(i)>-1||(DS.push(i),console.warn(e))}function oQ(i,e){let t=[];for(let a of e.split(" ")){let l=[];for(let f of a.split(".")){let h=i[f]||x[f];h?typeof h=="function"?l.length?l=l.map(h):Ud(f,`Modifier ${f} used at start of tag`):l.length?Ud(f,`Tag ${f} used as modifier`):l=Array.isArray(h)?h:[h]:Ud(f,`Unknown highlighting tag ${f}`)}for(let f of l)t.push(f)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),n=r+" "+t.map(a=>a.id),s=WS[n];if(s)return s.id;let o=WS[n]=Rt.define({id:ll.length,name:r,props:[ti({[r]:t})]});return ll.push(o),o.id}function Dk(i,e){let t=Rt.define({id:ll.length,name:"Document",props:[En.add(()=>i),qi.add(()=>r=>e.getIndent(r))],top:!0});return ll.push(t),t}var vZ={rtl:pe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:St.RTL}),ltr:pe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:St.LTR}),auto:pe.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Bf=class{constructor(e,t,r,n){this.state=e,this.pos=t,this.explicit=r,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=rt(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),r=Math.max(t.from,this.pos-250),n=t.text.slice(r-t.from,this.pos-t.from),s=n.search(qk(e,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}};function aQ(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Wk(i){let e=Object.create(null),t=Object.create(null);for(let{label:n}of i){e[n[0]]=!0;for(let s=1;s<n.length;s++)t[n[s]]=!0}let r=aQ(e)+aQ(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function hQ(i){let e=i.map(n=>typeof n=="string"?{label:n}:n),[t,r]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:Wk(e);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:e,validFor:t}:null}}function uQ(i,e){return t=>{for(let r=rt(t.state).reso
Line truncated
|
|
|
|
|
`+t.scrub(),s=this.advance(n);return s>-1&&s<n.length?this.complete(e,r,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&ml(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,r){return e.addLeafElement(t,lt(he.LinkReference,this.start,this.start+r,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(Iy(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(lt(he.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(qy(e,ml(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=ml(e,this.pos),r=0;if(t>this.pos){let n=jy(e,t,this.start);if(n){let s=wp(e,n.to-this.start);s>0&&(this.nextStage(n),r=s)}}return r||(r=wp(e,this.pos)),r>0&&r<e.length?r:-1}else return wp(e,this.pos)}}};function wp(i,e){for(;e<i.length;e++){let t=i.charCodeAt(e);if(t==10)break;if(!yr(t))return-1}return e}var Rp=class{nextLine(e,t,r){let n=t.depth<e.stack.length?-1:Ey(t),s=t.next;if(n<0)return!1;let o=lt(he.HeaderMark,e.lineStart+t.pos,e.lineStart+n);return e.nextLine(),e.addLeafElement(r,lt(s==61?he.SetextHeading1:he.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),o])),!0}finish(){return!1}},Ly={LinkReference(i,e){return e.content.charCodeAt(0)==91?new _p(e):null},SetextHeading(){return new Rp}},IX=[(i,e)=>Yy(e)>=0,(i,e)=>Ry(e)>=0,(i,e)=>Cy(e)>=0,(i,e)=>zp(e,i,!0)>=0,(i,e)=>Lp(e,i,!0)>=0,(i,e)=>Up(e,i,!0)>=0,(i,e)=>zy(e,i,!0)>=0],NX={text:"",end:0},Cp=class{constructor(e,t,r,n){this.parser=e,this.input=t,this.ranges=n,this.line=new kp,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=n[n.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=n[0].from,this.block=oh.create(he.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new Ep(r,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 r=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!n||e.markers[r].from<n.end);){let s=e.markers[r++];this.addNode(s.type,s.from,s.to)}if(!n)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 r of this.parser.blockParsers)if(r){let n=r(this,e);if(n!=!1){if(n==!0)return null;e.forward();continue e}}break}let t=new Pp(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let n=r(this,t);n&&t.parsers.push(n)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,t))break e}for(let r of t.parsers)if(r.nextLine(this,e,t))return null;t.content+=`
|
|
|
|
|
`+e.scrub();for(let r of e.markers)t.marks.push(r)}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=Ny(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=NX;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 r=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let s=this.ranges[n].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[n-1].to-r)+o,r=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(t);e.depth<this.stack.length;e.depth++){let n=this.stack[e.depth],s=this.parser.skipContextMarkup[n.type];if(!s)throw new Error("Unhandled block context "+he[n.type]);let o=this.line.markers.length;if(!s(n,this,e)){this.line.markers.length>o&&(n.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),r;if(this.input.lineChunks)r=t==`
|
|
|
|
|
`);r>-1&&(t=t.slice(0,r))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),r=e+t.length;for(let n=this.rangeIndex;;){let s=this.ranges[n].to;if(s>=r||(t=t.slice(0,s-(r-t.length)),n++,n==this.ranges.length))break;let o=this.ranges[n].from,a=this.lineAfter(o);t+=a,r=o+a.length}return{line:t,end:r}}skipGapsTo(e,t,r){for(;;){let n=this.ranges[this.rangeIndex].to,s=e+t;if(r>0?n>s:n>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-n}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,r,n){let s=4;if(this.ranges.length>1){n=this.skipGapsTo(t,n,1),t+=n;let a=this.chunk.length;n=this.skipGapsTo(r,n,-1),r+=n,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]=r:this.chunk.push(e,t,r,s),n}parseLine(e){let{line:t,end:r}=this.nextLine(),n=0,{streamParser:s}=this.lang,o=new Wh(t,e?e.state.tabSize:4,e?us(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=uQ(s.token,o,this.state);if(a&&(n=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,n)),o.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Ne.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Gk,topID:0,maxBufferLength:512,reused:this.chunkReused});e=new Ne(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 Ne(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function uQ(i,e,t){e.start=e.pos;for(let r=0;r<10;r++){let n=i(e,t);if(e.pos>e.start)return n}throw new Error("Stream parser failed to advance stream.")}var sp=Object.create(null),cl=[Ct.none],Gk=new Cn(cl),FS=[],HS=Object.create(null),OQ=Object.create(null);for(let[i,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"]])OQ[i]=dQ(sp,e);var qh=class{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),OQ)}resolve(e){return e?this.table[e]||(this.table[e]=dQ(this.extra,e)):0}},Fk=new qh(sp);function qd(i,e){FS.indexOf(i)>-1||(FS.push(i),console.warn(e))}function dQ(i,e){let t=[];for(let a of e.split(" ")){let l=[];for(let h of a.split(".")){let f=i[h]||x[h];f?typeof f=="function"?l.length?l=l.map(f):qd(h,`Modifier ${h} used at start of tag`):l.length?qd(h,`Tag ${h} used as modifier`):l=Array.isArray(f)?f:[f]:qd(h,`Unknown highlighting tag ${h}`)}for(let h of l)t.push(h)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),n=r+" "+t.map(a=>a.id),s=HS[n];if(s)return s.id;let o=HS[n]=Ct.define({id:cl.length,name:r,props:[ii({[r]:t})]});return cl.push(o),o.id}function Hk(i,e){let t=Ct.define({id:cl.length,name:"Document",props:[En.add(()=>i),qi.add(()=>r=>e.getIndent(r))],top:!0});return cl.push(t),t}var RZ={rtl:de.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:St.RTL}),ltr:de.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:St.LTR}),auto:de.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Gh=class{constructor(e,t,r,n){this.state=e,this.pos=t,this.explicit=r,this.view=n,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=rt(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),r=Math.max(t.from,this.pos-250),n=t.text.slice(r-t.from,this.pos-t.from),s=n.search(Jk(e,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),r&&r.onDocChange&&(this.abortOnDocChange=!0))}};function pQ(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Kk(i){let e=Object.create(null),t=Object.create(null);for(let{label:n}of i){e[n[0]]=!0;for(let s=1;s<n.length;s++)t[n[s]]=!0}let r=pQ(e)+pQ(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function SQ(i){let e=i.map(n=>typeof n=="string"?{label:n}:n),[t,r]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:Kk(e);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:e,validFor:t}:null}}function QQ(i,e){return t=>{for(let r=rt(t.state).reso
Line truncated
|
|
|
|
|
`+t.scrub(),s=this.advance(n);return s>-1&&s<n.length?this.complete(e,r,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&bl(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,r){return e.addLeafElement(t,lt(fe.LinkReference,this.start,this.start+r,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(ex(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(lt(fe.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Kv(e,bl(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=bl(e,this.pos),r=0;if(t>this.pos){let n=Jv(e,t,this.start);if(n){let s=_p(e,n.to-this.start);s>0&&(this.nextStage(n),r=s)}}return r||(r=_p(e,this.pos)),r>0&&r<e.length?r:-1}else return _p(e,this.pos)}}};function _p(i,e){for(;e<i.length;e++){let t=i.charCodeAt(e);if(t==10)break;if(!vr(t))return-1}return e}var Up=class{nextLine(e,t,r){let n=t.depth<e.stack.length?-1:Wv(t),s=t.next;if(n<0)return!1;let o=lt(fe.HeaderMark,e.lineStart+t.pos,e.lineStart+n);return e.nextLine(),e.addLeafElement(r,lt(s==61?fe.SetextHeading1:fe.SetextHeading2,r.start,e.prevLineEnd(),[...e.parser.parseInline(r.content,r.start),o])),!0}finish(){return!1}},Nv={LinkReference(i,e){return e.content.charCodeAt(0)==91?new Zp(e):null},SetextHeading(){return new Up}},e_=[(i,e)=>Dv(e)>=0,(i,e)=>Lv(e)>=0,(i,e)=>Mv(e)>=0,(i,e)=>qp(e,i,!0)>=0,(i,e)=>jp(e,i,!0)>=0,(i,e)=>Wp(e,i,!0)>=0,(i,e)=>Iv(e,i,!0)>=0],t_={text:"",end:0},zp=class{constructor(e,t,r,n){this.parser=e,this.input=t,this.ranges=n,this.line=new Ap,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=n[n.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=n[0].from,this.block=cf.create(fe.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new Vp(r,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 r=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<e.markers.length&&(!n||e.markers[r].from<n.end);){let s=e.markers[r++];this.addNode(s.type,s.from,s.to)}if(!n)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 r of this.parser.blockParsers)if(r){let n=r(this,e);if(n!=!1){if(n==!0)return null;e.forward();continue e}}break}let t=new Cp(this.lineStart+e.pos,e.text.slice(e.pos));for(let r of this.parser.leafBlockParsers)if(r){let n=r(this,t);n&&t.parsers.push(n)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,e,t))break e}for(let r of t.parsers)if(r.nextLine(this,e,t))return null;t.content+=`
|
|
|
|
|
`+e.scrub();for(let r of e.markers)t.marks.push(r)}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=tx(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=t_;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 r=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let s=this.ranges[n].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[n-1].to-r)+o,r=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,e.reset(t);e.depth<this.stack.length;e.depth++){let n=this.stack[e.depth],s=this.parser.skipContextMarkup[n.type];if(!s)throw new Error("Unhandled block context "+fe[n.type]);let o=this.line.markers.length;if(!s(n,this,e)){this.line.markers.length>o&&(n.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),r;if(this.input.lineChunks)r=t==`
|
|
|
|
|
`?"":t;else{let n=t.indexOf(`
|
|
|
|
|
`);r=n<0?t:t.slice(0,n)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,r=0){this.block=oh.create(e,r,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,r=0){this.startContext(this.parser.getNodeType(e),t,r)}addNode(e,t,r){typeof e=="number"&&(e=new Ne(this.parser.nodeSet.types[e],ra,ra,(r!=null?r: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(Yp(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?My(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let t=Yp(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(he.Paragraph,e.content.length),e.start)}elt(e,t,r,n){return typeof e=="string"?lt(this.parser.getNodeType(e),t,r,n):new lh(e,t)}get buffer(){return new ah(this.parser.nodeSet)}};function My(i,e,t,r,n){let s=i[e].to,o=[],a=[],l=t.from+r;function f(h,O){for(;O?h>=s:h>s;){let m=i[e+1].from-s;r+=m,h+=m,e++,s=i[e].to}}for(let h=t.firstChild;h;h=h.nextSibling){f(h.from+r,!0);let O=h.from+r,m,b=n.get(h.tree);b?m=b:h.to+r>s?(m=My(i,e,h,r,n),f(h.to+r,!1)):m=h.toTree(),o.push(m),a.push(O-l)}return f(t.to+r,!1),new Ne(t.type,o,a,t.to+r-l,t.tree?t.tree.propValues:void 0)}var bl=class i extends Yn{constructor(e,t,r,n,s,o,a,l,f){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=r,this.blockNames=n,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=f,this.nodeTypes=Object.create(null);for(let h of e.types)this.nodeTypes[h.name]=h.id}createParse(e,t,r){let n=new Cp(this,e,t,r);for(let s of this.wrappers)n=s(n,e,t,r);return n}configure(e){let t=Ap(e);if(!t)return this;let{nodeSet:r,skipContextMarkup:n}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),f=this.inlineNames.slice(),h=this.endLeafBlock.slice(),O=this.wrappers;if(pl(t.defineNodes)){n=Object.assign({},n);let m=r.types.slice(),b;for(let y of t.defineNodes){let{name:P,block:X,composite:Y,style:G}=typeof y=="string"?{name:y}:y;if(m.some(V=>V.name==P))continue;Y&&(n[m.length]=(V,d,j)=>Y(d,j,V.value));let q=m.length,N=Y?["Block","BlockContext"]:X?q>=he.ATXHeading1&&q<=he.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;m.push(Rt.define({id:q,name:P,props:N&&[[Ae.group,N]]})),G&&(b||(b={}),Array.isArray(G)||G instanceof er?b[P]=G:Object.assign(b,G))}r=new Cn(m),b&&(r=r.extend(ti(b)))}if(pl(t.props)&&(r=r.extend(...t.props)),pl(t.remove))for(let m of t.remove){let b=this.blockNames.indexOf(m),y=this.inlineNames.indexOf(m);b>-1&&(s[b]=o[b]=void 0),y>-1&&(l[y]=void 0)}if(pl(t.parseBlock))for(let m of t.parseBlock){let b=a.indexOf(m.name);if(b>-1)s[b]=m.parse,o[b]=m.leaf;else{let y=m.before?sh(a,m.before):m.after?sh(a,m.after)+1:a.length-1;s.splice(y,0,m.parse),o.splice(y,0,m.leaf),a.splice(y,0,m.name)}m.endLeaf&&h.push(m.endLeaf)}if(pl(t.parseInline))for(let m of t.parseInline){let b=f.indexOf(m.name);if(b>-1)l[b]=m.parse;else{let y=m.before?sh(f,m.before):m.after?sh(f,m.after)+1:f.length-1;l.splice(y,0,m.parse),f.splice(y,0,m.name)}}return t.wrap&&(O=O.concat(t.wrap)),new i(r,s,o,a,h,n,l,f,O)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let r=new Ql(this,e,t);e:for(let n=t;n<r.end;){let s=r.char(n);for(let o of this.inlineParsers)if(o){let a=o(r,s,n);if(a>=0){n=a;continue e}}n++}return r.resolveMarkers(0)}};function pl(i){return i!=null&&i.length>0}function Ap(i){if(!Array.isArray(i))return i;if(i.length==0)return null;let e=Ap(i[0]);if(i.length==1)return e;let t=Ap(i.slice(1));if(!t||!e)return e||t;let r=(o,a)=>(o||ra).concat(a||ra),n=e.wrap,s=t.wrap;return{props:r(e.props,t.props),defineNodes:r(e.defineNodes,t.defineNodes),parseBlock:r(e.parseBlock,t.parseBlock),parseInline:r(e.parseInline,t.parseInline),remove:r(e.remove,t.remove),wrap:n?s?(o,a,l,f)=>n(s(o,a,l,f),a,l,f):n:s}}function sh(i,e){let t=i.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var Vy=[Rt.none];for(let i=1,e;e=he[i];i++)Vy[i]=Rt.define({id:i,name:e,props:i>=he.Escape?[]:[[Ae.group,i in _y?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var ra=[],ah=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e
Line truncated
|
|
|
|
|
`;)s--;this.fragmentEnd=s?s-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let n=e+this.fragment.offset;for(;r.to<=n;)if(!r.parent())return!1;for(;;){if(r.from>=n)return this.fragment.from<=t;if(!r.childAfter(n))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(Ae.contextHash)==e}takeNodes(e){let t=this.cursor,r=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,a=e.block.children.length,l=o,f=a;for(;;){if(t.to-r>n){if(t.type.isAnonymous&&t.firstChild())continue;break}let h=Ny(t.from-r,e.ranges);if(t.to-r<=e.ranges[e.rangeI].to)e.addNode(t.tree,h);else{let O=new Ne(e.parser.nodeSet.types[he.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(O,t.tree),e.addNode(O,h)}if(t.type.is("Block")&&(GX.indexOf(t.type.id)<0?(o=t.to-r,a=e.block.children.length):(o=l,a=f),l=t.to-r,f=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 Ny(i,e){let t=i;for(let r=1;r<e.length;r++){let n=e[r-1].to,s=e[r].from;n<i&&(t-=s-n)}return t}var FX=ti({"Blockquote/...":x.quote,HorizontalRule:x.contentSeparator,"ATXHeading1/... SetextHeading1/...":x.heading1,"ATXHeading2/... SetextHeading2/...":x.heading2,"ATXHeading3/...":x.heading3,"ATXHeading4/...":x.heading4,"ATXHeading5/...":x.heading5,"ATXHeading6/...":x.heading6,"Comment CommentBlock":x.comment,Escape:x.escape,Entity:x.character,"Emphasis/...":x.emphasis,"StrongEmphasis/...":x.strong,"Link/... Image/...":x.link,"OrderedList/... BulletList/...":x.list,"BlockQuote/...":x.quote,"InlineCode CodeText":x.monospace,"URL Autolink":x.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":x.processingInstruction,"CodeInfo LinkLabel":x.labelName,LinkTitle:x.string,Paragraph:x.content}),By=new bl(new Cn(Vy).extend(FX),Object.keys(nh).map(i=>nh[i]),Object.keys(nh).map(i=>Ly[i]),Object.keys(nh),IX,_y,Object.keys($p).map(i=>$p[i]),Object.keys($p),[]);function HX(i,e,t){let r=[];for(let n=i.firstChild,s=e;;n=n.nextSibling){let o=n?n.from:t;if(o>s&&r.push({from:s,to:o}),!n)break;s=n.to}return r}function Gy(i){let{codeParser:e,htmlParser:t}=i;return{wrap:Zf((n,s)=>{let o=n.type.id;if(e&&(o==he.CodeBlock||o==he.FencedCode)){let a="";if(o==he.FencedCode){let f=n.node.getChild(he.CodeInfo);f&&(a=s.read(f.from,f.to))}let l=e(a);if(l)return{parser:l,overlay:f=>f.type.id==he.CodeText,bracketed:o==he.FencedCode}}else if(t&&(o==he.HTMLBlock||o==he.HTMLTag||o==he.CommentBlock))return{parser:t,overlay:HX(n.node,n.from,n.to)};return null})}}var KX={resolve:"Strikethrough",mark:"StrikethroughMark"},JX={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":x.strikethrough}},{name:"StrikethroughMark",style:x.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let r=i.slice(t-1,t),n=i.slice(t+2,t+3),s=/\s|^$/.test(r),o=/\s|^$/.test(n),a=Sl.test(r),l=Sl.test(n);return i.addDelimiter(KX,t,t+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function gl(i,e,t=0,r,n=0){let s=0,o=!0,a=-1,l=-1,f=!1,h=()=>{r.push(i.elt("TableCell",n+a,n+l,i.parser.parseInline(e.slice(a,l),n+a)))};for(let O=t;O<e.length;O++){let m=e.charCodeAt(O);m==124&&!f?((!o||a>-1)&&s++,o=!1,r&&(a>-1&&h(),r.push(i.elt("TableDelimiter",O+n,O+n+1))),a=l=-1):(f||m!=32&&m!=9)&&(a<0&&(a=O),l=O+1),f=!f&&m==92}return a>-1&&(s++,r&&h()),s}function vy(i,e){for(let t=e;t<i.length;t++){let r=i.charCodeAt(t);if(r==124)return!0;r==92&&t++}return!1}var Fy=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,fh=class{constructor(){this.rows=null}nextLine(e,t,r){if(this.rows==null){this.rows=!1;let n;if((t.next==45||t.next==58||t.next==124)&&Fy.test(n=t.text.slice(t.pos))){let s=[];gl(e,r.content,0,s,r.start)==gl(e,n,t.pos)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let n=[];gl(e,t.text,t.pos,n,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,n))}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}},e_={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":x.heading}},"TableRow",{name:"TableCell",style:x.content},{name:"TableDelimiter",style:x.processingInstruction}],parseBlock:[{name:"Table",leaf(i,e){return vy(e.content,0)?new fh:null},endLeaf(i,e,t){if(t.parsers.some(n=>n instanceof fh)||!vy(e.text,e.basePos))return!1;let r=i.peekLine();return Fy.test(r)&&gl(i,e.text,e.basePos)==gl(i,r,e.basePos)},before:"SetextHeading"}]},Zp=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}},t_={defineNodes:[{name:"Task",block:!0,style:x.list},{name:"TaskMarker",style:x.atom}],pars
Line truncated
|
|
|
|
|
`);r=n<0?t:t.slice(0,n)}return e+r.length>this.to?r.slice(0,this.to-e):r}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,r=0){this.block=cf.create(e,r,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,r=0){this.startContext(this.parser.getNodeType(e),t,r)}addNode(e,t,r){typeof e=="number"&&(e=new Ne(this.parser.nodeSet.types[e],na,na,(r!=null?r: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(Mp(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?Bv(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let r of e.parsers)if(r.finish(this,e))return;let t=Mp(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(fe.Paragraph,e.content.length),e.start)}elt(e,t,r,n){return typeof e=="string"?lt(this.parser.getNodeType(e),t,r,n):new ff(e,t)}get buffer(){return new hf(this.parser.nodeSet)}};function Bv(i,e,t,r,n){let s=i[e].to,o=[],a=[],l=t.from+r;function h(f,O){for(;O?f>=s:f>s;){let m=i[e+1].from-s;r+=m,f+=m,e++,s=i[e].to}}for(let f=t.firstChild;f;f=f.nextSibling){h(f.from+r,!0);let O=f.from+r,m,b=n.get(f.tree);b?m=b:f.to+r>s?(m=Bv(i,e,f,r,n),h(f.to+r,!1)):m=f.toTree(),o.push(m),a.push(O-l)}return h(t.to+r,!1),new Ne(t.type,o,a,t.to+r-l,t.tree?t.tree.propValues:void 0)}var Ql=class i extends Yn{constructor(e,t,r,n,s,o,a,l,h){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=r,this.blockNames=n,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=a,this.inlineNames=l,this.wrappers=h,this.nodeTypes=Object.create(null);for(let f of e.types)this.nodeTypes[f.name]=f.id}createParse(e,t,r){let n=new zp(this,e,t,r);for(let s of this.wrappers)n=s(n,e,t,r);return n}configure(e){let t=Lp(e);if(!t)return this;let{nodeSet:r,skipContextMarkup:n}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),a=this.blockNames.slice(),l=this.inlineParsers.slice(),h=this.inlineNames.slice(),f=this.endLeafBlock.slice(),O=this.wrappers;if(gl(t.defineNodes)){n=Object.assign({},n);let m=r.types.slice(),b;for(let v of t.defineNodes){let{name:P,block:T,composite:Y,style:B}=typeof v=="string"?{name:v}:v;if(m.some(M=>M.name==P))continue;Y&&(n[m.length]=(M,d,j)=>Y(d,j,M.value));let q=m.length,N=Y?["Block","BlockContext"]:T?q>=fe.ATXHeading1&&q<=fe.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;m.push(Ct.define({id:q,name:P,props:N&&[[Ae.group,N]]})),B&&(b||(b={}),Array.isArray(B)||B instanceof er?b[P]=B:Object.assign(b,B))}r=new Cn(m),b&&(r=r.extend(ii(b)))}if(gl(t.props)&&(r=r.extend(...t.props)),gl(t.remove))for(let m of t.remove){let b=this.blockNames.indexOf(m),v=this.inlineNames.indexOf(m);b>-1&&(s[b]=o[b]=void 0),v>-1&&(l[v]=void 0)}if(gl(t.parseBlock))for(let m of t.parseBlock){let b=a.indexOf(m.name);if(b>-1)s[b]=m.parse,o[b]=m.leaf;else{let v=m.before?lf(a,m.before):m.after?lf(a,m.after)+1:a.length-1;s.splice(v,0,m.parse),o.splice(v,0,m.leaf),a.splice(v,0,m.name)}m.endLeaf&&f.push(m.endLeaf)}if(gl(t.parseInline))for(let m of t.parseInline){let b=h.indexOf(m.name);if(b>-1)l[b]=m.parse;else{let v=m.before?lf(h,m.before):m.after?lf(h,m.after)+1:h.length-1;l.splice(v,0,m.parse),h.splice(v,0,m.name)}}return t.wrap&&(O=O.concat(t.wrap)),new i(r,s,o,a,f,n,l,h,O)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let r=new xl(this,e,t);e:for(let n=t;n<r.end;){let s=r.char(n);for(let o of this.inlineParsers)if(o){let a=o(r,s,n);if(a>=0){n=a;continue e}}n++}return r.resolveMarkers(0)}};function gl(i){return i!=null&&i.length>0}function Lp(i){if(!Array.isArray(i))return i;if(i.length==0)return null;let e=Lp(i[0]);if(i.length==1)return e;let t=Lp(i.slice(1));if(!t||!e)return e||t;let r=(o,a)=>(o||na).concat(a||na),n=e.wrap,s=t.wrap;return{props:r(e.props,t.props),defineNodes:r(e.defineNodes,t.defineNodes),parseBlock:r(e.parseBlock,t.parseBlock),parseInline:r(e.parseInline,t.parseInline),remove:r(e.remove,t.remove),wrap:n?s?(o,a,l,h)=>n(s(o,a,l,h),a,l,h):n:s}}function lf(i,e){let t=i.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var Gv=[Ct.none];for(let i=1,e;e=fe[i];i++)Gv[i]=Ct.define({id:i,name:e,props:i>=fe.Escape?[]:[[Ae.group,i in zv?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var na=[],hf=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e
Line truncated
|
|
|
|
|
`;)s--;this.fragmentEnd=s?s-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let n=e+this.fragment.offset;for(;r.to<=n;)if(!r.parent())return!1;for(;;){if(r.from>=n)return this.fragment.from<=t;if(!r.childAfter(n))return!1}}matches(e){let t=this.cursor.tree;return t&&t.prop(Ae.contextHash)==e}takeNodes(e){let t=this.cursor,r=this.fragment.offset,n=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,a=e.block.children.length,l=o,h=a;for(;;){if(t.to-r>n){if(t.type.isAnonymous&&t.firstChild())continue;break}let f=tx(t.from-r,e.ranges);if(t.to-r<=e.ranges[e.rangeI].to)e.addNode(t.tree,f);else{let O=new Ne(e.parser.nodeSet.types[fe.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(O,t.tree),e.addNode(O,f)}if(t.type.is("Block")&&(r_.indexOf(t.type.id)<0?(o=t.to-r,a=e.block.children.length):(o=l,a=h),l=t.to-r,h=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 tx(i,e){let t=i;for(let r=1;r<e.length;r++){let n=e[r-1].to,s=e[r].from;n<i&&(t-=s-n)}return t}var n_=ii({"Blockquote/...":x.quote,HorizontalRule:x.contentSeparator,"ATXHeading1/... SetextHeading1/...":x.heading1,"ATXHeading2/... SetextHeading2/...":x.heading2,"ATXHeading3/...":x.heading3,"ATXHeading4/...":x.heading4,"ATXHeading5/...":x.heading5,"ATXHeading6/...":x.heading6,"Comment CommentBlock":x.comment,Escape:x.escape,Entity:x.character,"Emphasis/...":x.emphasis,"StrongEmphasis/...":x.strong,"Link/... Image/...":x.link,"OrderedList/... BulletList/...":x.list,"BlockQuote/...":x.quote,"InlineCode CodeText":x.monospace,"URL Autolink":x.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":x.processingInstruction,"CodeInfo LinkLabel":x.labelName,LinkTitle:x.string,Paragraph:x.content}),ix=new Ql(new Cn(Gv).extend(n_),Object.keys(af).map(i=>af[i]),Object.keys(af).map(i=>Nv[i]),Object.keys(af),e_,zv,Object.keys(Rp).map(i=>Rp[i]),Object.keys(Rp),[]);function s_(i,e,t){let r=[];for(let n=i.firstChild,s=e;;n=n.nextSibling){let o=n?n.from:t;if(o>s&&r.push({from:s,to:o}),!n)break;s=n.to}return r}function rx(i){let{codeParser:e,htmlParser:t}=i;return{wrap:Uh((n,s)=>{let o=n.type.id;if(e&&(o==fe.CodeBlock||o==fe.FencedCode)){let a="";if(o==fe.FencedCode){let h=n.node.getChild(fe.CodeInfo);h&&(a=s.read(h.from,h.to))}let l=e(a);if(l)return{parser:l,overlay:h=>h.type.id==fe.CodeText,bracketed:o==fe.FencedCode}}else if(t&&(o==fe.HTMLBlock||o==fe.HTMLTag||o==fe.CommentBlock))return{parser:t,overlay:s_(n.node,n.from,n.to)};return null})}}var o_={resolve:"Strikethrough",mark:"StrikethroughMark"},a_={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":x.strikethrough}},{name:"StrikethroughMark",style:x.processingInstruction}],parseInline:[{name:"Strikethrough",parse(i,e,t){if(e!=126||i.char(t+1)!=126||i.char(t+2)==126)return-1;let r=i.slice(t-1,t),n=i.slice(t+2,t+3),s=/\s|^$/.test(r),o=/\s|^$/.test(n),a=vl.test(r),l=vl.test(n);return i.addDelimiter(o_,t,t+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function Sl(i,e,t=0,r,n=0){let s=0,o=!0,a=-1,l=-1,h=!1,f=()=>{r.push(i.elt("TableCell",n+a,n+l,i.parser.parseInline(e.slice(a,l),n+a)))};for(let O=t;O<e.length;O++){let m=e.charCodeAt(O);m==124&&!h?((!o||a>-1)&&s++,o=!1,r&&(a>-1&&f(),r.push(i.elt("TableDelimiter",O+n,O+n+1))),a=l=-1):(h||m!=32&&m!=9)&&(a<0&&(a=O),l=O+1),h=!h&&m==92}return a>-1&&(s++,r&&f()),s}function Rv(i,e){for(let t=e;t<i.length;t++){let r=i.charCodeAt(t);if(r==124)return!0;r==92&&t++}return!1}var nx=/^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Of=class{constructor(){this.rows=null}nextLine(e,t,r){if(this.rows==null){this.rows=!1;let n;if((t.next==45||t.next==58||t.next==124)&&nx.test(n=t.text.slice(t.pos))){let s=[];Sl(e,r.content,0,s,r.start)==Sl(e,n,t.pos)&&(this.rows=[e.elt("TableHeader",r.start,r.start+r.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let n=[];Sl(e,t.text,t.pos,n,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,n))}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}},l_={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":x.heading}},"TableRow",{name:"TableCell",style:x.content},{name:"TableDelimiter",style:x.processingInstruction}],parseBlock:[{name:"Table",leaf(i,e){return Rv(e.content,0)?new Of:null},endLeaf(i,e,t){if(t.parsers.some(n=>n instanceof Of)||!Rv(e.text,e.basePos))return!1;let r=i.peekLine();return nx.test(r)&&Sl(i,e.text,e.basePos)==Sl(i,r,e.basePos)},before:"SetextHeading"}]},Dp=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}},c_={defineNodes:[{name:"Task",block:!0,style:x.list},{name:"TaskMarker",style:x.atom}],pars
Line truncated
|
|
|
|
|
\${}
|
|
|
|
|
} catch (\${error}) {
|
|
|
|
|
\${}
|
|
|
|
@@ -42,36 +43,37 @@ PC `+this.addr2str(s)+" "+this.opToString(f,null,y),o[P]=1)}),this.addr2str(r)+n
|
|
|
|
|
constructor(\${params}) {
|
|
|
|
|
\${}
|
|
|
|
|
}
|
|
|
|
|
}`,{label:"class",detail:"definition",type:"keyword"}),$i('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),$i('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],KR=zx.concat([$i("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),$i("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),$i("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Ex=new Go,Lx=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function vl(i){return(e,t)=>{let r=e.node.getChild("VariableDefinition");return r&&t(r,i),!0}}var JR=["FunctionDeclaration"],eC={FunctionDeclaration:vl("function"),ClassDeclaration:vl("class"),ClassExpression:()=>!0,EnumDeclaration:vl("constant"),TypeAliasDeclaration:vl("type"),NamespaceDeclaration:vl("namespace"),VariableDefinition(i,e){i.matchContext(JR)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function Mx(i,e){let t=Ex.get(e);if(t)return t;let r=[],n=!0;function s(o,a){let l=i.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(at.IncludeAnonymous).iterate(o=>{if(n)n=!1;else if(o.name){let a=eC[o.name];if(a&&a(o,s)||Lx.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of Mx(i,o.node))r.push(a);return!1}}),Ex.set(e,r),r}var Zx=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Vx=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function tC(i){let e=rt(i.state).resolveInner(i.pos,-1);if(Vx.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Zx.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let r=[];for(let n=e;n;n=n.parent)Lx.has(n.name)&&(r=r.concat(Mx(i.state.doc,n)));return{options:r,from:t?e.from:i.pos,validFor:Zx}}var Ir=ii.define({name:"javascript",parser:Yx.configure({props:[qi.add({IfStatement:Sn({except:/^\s*({|else\b)/}),TryStatement:Sn({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:If,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:r?1:2)*i.unit},Block:Ko({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Sn({except:/^\s*{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),ji.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":ds,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Dx={test:i=>/^JSX/.test(i.name),facet:Fo({commentTokens:{block:{open:"{/*",close:"*/}"}}})},em=Ir.configure({dialect:"ts"},"typescript"),tm=Ir.configure({dialect:"jsx",props:[qf.add(i=>i.isTop?[Dx]:void 0)]}),im=Ir.configure({dialect:"jsx ts",props:[qf.add(i=>i.isTop?[Dx]:void 0)]},"typescript"),Wx=i=>({label:i,type:"keyword"}),qx="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(Wx),iC=qx.concat(["declare","implements","private","protected","public"].map(Wx));function jx(i={}){let e=i.jsx?i.typescript?im:tm:i.typescript?em:Ir,t=i.typescript?KR.concat(iC):zx.concat(qx);return new Qt(e,[Ir.data.of({autocomplete:uQ(Vx,hQ(t))}),Ir.data.of({autocomplete:tC}),i.jsx?sC:[]])}function rC(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function Ux(i,e,t=i.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return i.sliceString(r.from,Math.min(r.to,t));return""}var nC=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),sC=ne.inputHandler.of((i,e,t,r,n)=>{if((nC?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||r!=">"&&r!="/"||!Ir.isActiveAt(i.state,e,-1))return!1;let s=n(),{state:o}=s,a=o.changeByRange(l=>{var f;let{head:h}=l,O=rt(o).resolveInner(h-1,-1),m;if(O.name=="JSXStartTag"&&(O=O.parent),!(o.doc.sliceString(h-1,h)!=r||O.name=="JSXAttributeValue"&&O.to>h)){if(r==">"&&O.name=="JSXFragmentTag")return{range:l,changes:{from:h,insert:"</>"}};if(r=="/"&&O.name=="JSXStartCloseTag"){let b=O.parent,y=b.parent;if(y&&b.from==h-2&&((m=Ux(o.doc,y.firstChild,h))||((f=y.firstCh
Line truncated
|
|
|
|
|
`:r=="r"?"\r":r=="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 dm(this):new Om(this)}getCursor(e,t=0,r){let n=e.doc?e:it.create({doc:e});return r==null&&(r=n.doc.length),this.regexp?aa(this,n,t,r):oa(this,n,t,r)}},xh=class{constructor(e){this.spec=e}};function MC(i,e,t){return(r,n,s,o)=>{if(t&&!t(r,n,s,o))return!1;let a=r>=o&&n<=o+s.length?s.slice(r-o,n-o):e.doc.sliceString(r,n);return i(a,e,r,n)}}function oa(i,e,t,r){let n;return i.wholeWord&&(n=VC(e.doc,e.charCategorizer(e.selection.main.head))),i.test&&(n=MC(i.test,e,n)),new Ss(e.doc,i.unquoted,t,r,i.caseSensitive?void 0:s=>s.toLowerCase(),n)}function VC(i,e){return(t,r,n,s)=>((s>t||s+n.length<r)&&(s=Math.max(0,t-2),n=i.sliceString(s,Math.min(i.length,r+2))),(e(vh(n,t-s))!=xt.Word||e(wh(n,t-s))!=xt.Word)&&(e(wh(n,r-s))!=xt.Word||e(vh(n,r-s))!=xt.Word))}var Om=class extends xh{constructor(e){super(e)}nextMatch(e,t,r){let n=oa(this.spec,e,r,e.doc.length).nextOverlapping();if(n.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);n=oa(this.spec,e,0,s).nextOverlapping()}return n.done||n.value.from==t&&n.value.to==r?null:n.value}prevMatchInRange(e,t,r){for(let n=r;;){let s=Math.max(t,n-1e4-this.spec.unquoted.length),o=oa(this.spec,e,s,n),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;n-=1e4}}prevMatch(e,t,r){let n=this.prevMatchInRange(e,0,t);return n||(n=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),n&&(n.from!=t||n.to!=r)?n:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=oa(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let s=oa(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function DC(i,e,t){return(r,n,s)=>(!t||t(r,n,s))&&i(s[0],e,r,n)}function aa(i,e,t,r){let n;return i.wholeWord&&(n=WC(e.charCategorizer(e.selection.main.head))),i.test&&(n=DC(i.test,e,n)),new gh(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:n},t,r)}function vh(i,e){return i.slice(Ut(i,e,!1),e)}function wh(i,e){return i.slice(e,Ut(i,e))}function WC(i){return(e,t,r)=>!r[0].length||(i(vh(r.input,r.index))!=xt.Word||i(wh(r.input,r.index))!=xt.Word)&&(i(wh(r.input,r.index+r[0].length))!=xt.Word||i(vh(r.input,r.index+r[0].length))!=xt.Word)}var dm=class extends xh{nextMatch(e,t,r){let n=aa(this.spec,e,r,e.doc.length).next();return n.done&&(n=aa(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,r){for(let n=1;;n++){let s=Math.max(t,r-n*1e4),o=aa(this.spec,e,s,r),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,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let n=r.length;n>0;n--){let s=+r.slice(0,n);if(s>0&&s<e.match.length)return e.match[s]+r.slice(n)}return t})}matchAll(e,t){let r=aa(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let s=aa(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},kl=Ce.define(),Qm=Ce.define(),bs=ot.define({create(i){return new Pl(pm(i).create(),null)},update(i,e){for(let t of e.effects)t.is(kl)?i=new Pl(t.value.create(),i.panel):t.is(Qm)&&(i=new Pl(i.query,t.value?ym:null));return i},provide:i=>el.from(i,e=>e.panel)});var Pl=class{constructor(e,t){this.query=e,this.panel=t}},qC=pe.mark({class:"cm-searchMatch"}),jC=pe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),IC=Lt.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(bs))}update(i){let e=i.state.field(bs);(e!=i.startState.field(bs)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return pe.none;let{view:t}=this,r=new Zr;for(let n=0,s=t.visibleRanges,o=s.length;n<o;n++){let{from:a,to:l}=s[n];for(;n<o-1&&l>s[n+1].from-500;)l=s[++n].to;i.highlight(t.state,a,l,(f,h)=>{let O=t.state.selection.ranges.some(m=>m.from==f&&m.to==h);r.add(f,h,O?jC:qC)})}return r.finish()}},{decorations:i=>i.decorations});function Tl(i){return e=>{let t=e.state.field(bs,!1);return t&&t.query.spec.valid?i(e,t):xv(e)}}var $h=Tl((i,{query:e})=>{let{to:t}=i.state.selection.main,r=e.nextMatch(i.state,t,t);if(!r)return!1;let n=F.single(r.from,r.to),s=i.state.facet(co);return i.dispatch({selection:n,effects:[xm(i,r),s.scrollToMatch(n.main,i)],userEvent:"select.search"}),yv(i),!0}),Ph=Tl((i,{query:e})=>{let{state:t}=i,{from:r}=t.selection.main,n=e.prevMatch(t,r,r);if(
Line truncated
|
|
|
|
|
`;let o=i.state.facet(gn),a=o instanceof ii?"Lezer LRLanguage":o instanceof ri?"StreamLanguage":"Unknown",l=o instanceof ii?"AST ":o instanceof ri?"Token ":"Name ";return{pos:e,above:!0,arrow:!0,create(f){let h=document.createElement("div");h.style.overflow="visible",h.style.height="0",h.style.width="0";let O=document.createElement("div");return O.className="cm-debug-tooltip",O.textContent=`Parser: ${a}
|
|
|
|
|
}`,{label:"class",detail:"definition",type:"keyword"}),$i('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),$i('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],oC=Ix.concat([$i("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),$i("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),$i("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Wx=new Fo,Nx=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function $l(i){return(e,t)=>{let r=e.node.getChild("VariableDefinition");return r&&t(r,i),!0}}var aC=["FunctionDeclaration"],lC={FunctionDeclaration:$l("function"),ClassDeclaration:$l("class"),ClassExpression:()=>!0,EnumDeclaration:$l("constant"),TypeAliasDeclaration:$l("type"),NamespaceDeclaration:$l("namespace"),VariableDefinition(i,e){i.matchContext(aC)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function Bx(i,e){let t=Wx.get(e);if(t)return t;let r=[],n=!0;function s(o,a){let l=i.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(at.IncludeAnonymous).iterate(o=>{if(n)n=!1;else if(o.name){let a=lC[o.name];if(a&&a(o,s)||Nx.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of Bx(i,o.node))r.push(a);return!1}}),Wx.set(e,r),r}var qx=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Gx=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function cC(i){let e=rt(i.state).resolveInner(i.pos,-1);if(Gx.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&qx.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let r=[];for(let n=e;n;n=n.parent)Nx.has(n.name)&&(r=r.concat(Bx(i.state.doc,n)));return{options:r,from:t?e.from:i.pos,validFor:qx}}var Nr=ri.define({name:"javascript",parser:Dx.configure({props:[qi.add({IfStatement:Sn({except:/^\s*({|else\b)/}),TryStatement:Sn({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Nh,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:r?1:2)*i.unit},Block:Jo({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Sn({except:/^\s*{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),ji.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":ds,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Fx={test:i=>/^JSX/.test(i.name),facet:Ho({commentTokens:{block:{open:"{/*",close:"*/}"}}})},om=Nr.configure({dialect:"ts"},"typescript"),am=Nr.configure({dialect:"jsx",props:[jh.add(i=>i.isTop?[Fx]:void 0)]}),lm=Nr.configure({dialect:"jsx ts",props:[jh.add(i=>i.isTop?[Fx]:void 0)]},"typescript"),Hx=i=>({label:i,type:"keyword"}),Kx="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(Hx),hC=Kx.concat(["declare","implements","private","protected","public"].map(Hx));function Jx(i={}){let e=i.jsx?i.typescript?lm:am:i.typescript?om:Nr,t=i.typescript?oC.concat(hC):Ix.concat(Kx);return new Qt(e,[Nr.data.of({autocomplete:QQ(Gx,SQ(t))}),Nr.data.of({autocomplete:cC}),i.jsx?OC:[]])}function fC(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function jx(i,e,t=i.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return i.sliceString(r.from,Math.min(r.to,t));return""}var uC=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),OC=ne.inputHandler.of((i,e,t,r,n)=>{if((uC?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||r!=">"&&r!="/"||!Nr.isActiveAt(i.state,e,-1))return!1;let s=n(),{state:o}=s,a=o.changeByRange(l=>{var h;let{head:f}=l,O=rt(o).resolveInner(f-1,-1),m;if(O.name=="JSXStartTag"&&(O=O.parent),!(o.doc.sliceString(f-1,f)!=r||O.name=="JSXAttributeValue"&&O.to>f)){if(r==">"&&O.name=="JSXFragmentTag")return{range:l,changes:{from:f,insert:"</>"}};if(r=="/"&&O.name=="JSXStartCloseTag"){let b=O.parent,v=b.parent;if(v&&b.from==f-2&&((m=jx(o.doc,v.firstChild,f))||((h=v.firstCh
Line truncated
|
|
|
|
|
`:r=="r"?"\r":r=="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 Qm(this):new Sm(this)}getCursor(e,t=0,r){let n=e.doc?e:it.create({doc:e});return r==null&&(r=n.doc.length),this.regexp?la(this,n,t,r):aa(this,n,t,r)}},$f=class{constructor(e){this.spec=e}};function BC(i,e,t){return(r,n,s,o)=>{if(t&&!t(r,n,s,o))return!1;let a=r>=o&&n<=o+s.length?s.slice(r-o,n-o):e.doc.sliceString(r,n);return i(a,e,r,n)}}function aa(i,e,t,r){let n;return i.wholeWord&&(n=GC(e.doc,e.charCategorizer(e.selection.main.head))),i.test&&(n=BC(i.test,e,n)),new Ss(e.doc,i.unquoted,t,r,i.caseSensitive?void 0:s=>s.toLowerCase(),n)}function GC(i,e){return(t,r,n,s)=>((s>t||s+n.length<r)&&(s=Math.max(0,t-2),n=i.sliceString(s,Math.min(i.length,r+2))),(e(Pf(n,t-s))!=xt.Word||e(kf(n,t-s))!=xt.Word)&&(e(kf(n,r-s))!=xt.Word||e(Pf(n,r-s))!=xt.Word))}var Sm=class extends $f{constructor(e){super(e)}nextMatch(e,t,r){let n=aa(this.spec,e,r,e.doc.length).nextOverlapping();if(n.done){let s=Math.min(e.doc.length,t+this.spec.unquoted.length);n=aa(this.spec,e,0,s).nextOverlapping()}return n.done||n.value.from==t&&n.value.to==r?null:n.value}prevMatchInRange(e,t,r){for(let n=r;;){let s=Math.max(t,n-1e4-this.spec.unquoted.length),o=aa(this.spec,e,s,n),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;n-=1e4}}prevMatch(e,t,r){let n=this.prevMatchInRange(e,0,t);return n||(n=this.prevMatchInRange(e,Math.max(0,r-this.spec.unquoted.length),e.doc.length)),n&&(n.from!=t||n.to!=r)?n:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=aa(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let s=aa(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function FC(i,e,t){return(r,n,s)=>(!t||t(r,n,s))&&i(s[0],e,r,n)}function la(i,e,t,r){let n;return i.wholeWord&&(n=HC(e.charCategorizer(e.selection.main.head))),i.test&&(n=FC(i.test,e,n)),new Qf(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:n},t,r)}function Pf(i,e){return i.slice(zt(i,e,!1),e)}function kf(i,e){return i.slice(e,zt(i,e))}function HC(i){return(e,t,r)=>!r[0].length||(i(Pf(r.input,r.index))!=xt.Word||i(kf(r.input,r.index))!=xt.Word)&&(i(kf(r.input,r.index+r[0].length))!=xt.Word||i(Pf(r.input,r.index+r[0].length))!=xt.Word)}var Qm=class extends $f{nextMatch(e,t,r){let n=la(this.spec,e,r,e.doc.length).next();return n.done&&(n=la(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,r){for(let n=1;;n++){let s=Math.max(t,r-n*1e4),o=la(this.spec,e,s,r),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,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let n=r.length;n>0;n--){let s=+r.slice(0,n);if(s>0&&s<e.match.length)return e.match[s]+r.slice(n)}return t})}matchAll(e,t){let r=la(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let s=la(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},Xl=Ce.define(),Pm=Ce.define(),bs=ot.define({create(i){return new Tl(vm(i).create(),null)},update(i,e){for(let t of e.effects)t.is(Xl)?i=new Tl(t.value.create(),i.panel):t.is(Pm)&&(i=new Tl(i.query,t.value?km:null));return i},provide:i=>tl.from(i,e=>e.panel)});var Tl=class{constructor(e,t){this.query=e,this.panel=t}},KC=de.mark({class:"cm-searchMatch"}),JC=de.mark({class:"cm-searchMatch cm-searchMatch-selected"}),e2=Rt.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(bs))}update(i){let e=i.state.field(bs);(e!=i.startState.field(bs)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return de.none;let{view:t}=this,r=new Ur;for(let n=0,s=t.visibleRanges,o=s.length;n<o;n++){let{from:a,to:l}=s[n];for(;n<o-1&&l>s[n+1].from-500;)l=s[++n].to;i.highlight(t.state,a,l,(h,f)=>{let O=t.state.selection.ranges.some(m=>m.from==h&&m.to==f);r.add(h,f,O?JC:KC)})}return r.finish()}},{decorations:i=>i.decorations});function _l(i){return e=>{let t=e.state.field(bs,!1);return t&&t.query.spec.valid?i(e,t):_y(e)}}var Tf=_l((i,{query:e})=>{let{to:t}=i.state.selection.main,r=e.nextMatch(i.state,t,t);if(!r)return!1;let n=H.single(r.from,r.to),s=i.state.facet(co);return i.dispatch({selection:n,effects:[Tm(i,r),s.scrollToMatch(n.main,i)],userEvent:"select.search"}),Xy(i),!0}),Xf=_l((i,{query:e})=>{let{state:t}=i,{from:r}=t.selection.main,n=e.prevMatch(t,r,r);if(
Line truncated
|
|
|
|
|
`;let o=i.state.facet(gn),a=o instanceof ri?"Lezer LRLanguage":o instanceof ni?"StreamLanguage":"Unknown",l=o instanceof ri?"AST ":o instanceof ni?"Token ":"Name ";return{pos:e,above:!0,arrow:!0,create(h){let f=document.createElement("div");f.style.overflow="visible",f.style.height="0",f.style.width="0";let O=document.createElement("div");return O.className="cm-debug-tooltip",O.textContent=`Parser: ${a}
|
|
|
|
|
${l}: ${r.name}
|
|
|
|
|
Tags : ${s}`,O.style.whiteSpace="pre-wrap",O.style.fontFamily="monospace",O.style.background="#333",O.style.color="white",O.style.padding="2px 8px",O.style.borderRadius="4px",O.style.fontSize="12px",O.style.border="1px solid #555",O.style.pointerEvents="none",O.style.position="absolute",O.style.bottom="0",O.style.width="max-content",h.appendChild(O),{dom:h}}}},{hoverTime:10,hideOnChange:!0});function A2(i){return it.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input")||!i.input)return e;let t=[],r=!1;if(e.changes.iterChanges((o,a,l,f,h)=>{let O=h.toString(),m=i.input(O);t.push({from:o,to:a,insert:m}),m!==O&&(r=!0)}),!r)return e;let n=e.annotation(Tt.userEvent),s=e.annotation(Tt.addToHistory);return{changes:t,selection:e.selection,effects:e.effects,scrollIntoView:e.scrollIntoView,annotations:[...n!=null?[Tt.userEvent.of(n)]:[],...s!=null?[Tt.addToHistory.of(s)]:[]]}})}var Xm=new Eo;function zv(i){return Xm.reconfigure(A2(i))}var Lv=Ce.define(),Mv=Ce.define(),Vv=Ce.define(),Rm=Ce.define(),Dv=Ce.define(),Wv=Ce.define(),qv=Ce.define(),jv=Ce.define(),Iv=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Lv)){let r=t.value,n=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new kh(ut(o,4)).range(a))}i=Le.of(n,!0)}return i}}),Nv=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Mv)){let r=t.value,n=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Th(o).range(a))}i=Le.of(n,!0)}return i}}),Bv=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Vv)){let r=t.value,n=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Xh(o).range(a))}i=Le.of(n,!0)}return i}}),Gv=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Rm))if(t.value===null)i=Le.empty;else{let r=t.value;if(r>=1&&r<=e.state.doc.lines){let n=e.state.doc.line(r).from,s=!1;i.between(n,n,()=>(s=!0,!1)),s?i=i.update({filter:o=>o!==n}):i=i.update({add:[E2.range(n)]})}}return i}}),_m=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Dv)){let r=t.value,n=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new _h(s,o).range(a))}i=Le.of(n,!0)}return i}}),Fv=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Wv))if(t.value===null)i=Le.empty;else{let r=t.value;if(r>=1&&r<=e.state.doc.lines){let n=e.state.doc.line(r).from;i=Le.of(Hv.range(n))}}return i}}),kh=class extends Mt{constructor(t){super();this.hex=t}toDOM(){return document.createTextNode(this.hex)}eq(t){return this.hex==t.hex}},Th=class extends Mt{constructor(t){super();this.bytes=t}toDOM(){return document.createTextNode(this.bytes)}eq(t){return this.bytes==t.bytes}},Xh=class extends Mt{constructor(t){super();this.clock=t}toDOM(){return document.createTextNode(this.clock)}eq(t){return this.clock==t.clock}},Y2=new class extends Mt{toDOM(){let i=document.createElement("span");return i.textContent="\u25CF",i.style.color="transparent",i.style.cursor="pointer",i.addEventListener("mouseenter",()=>{i.style.color="rgba(255, 0, 0, 0.5)"}),i.addEventListener("mouseleave",()=>{i.style.color="transparent"}),i}},E2=new class extends Mt{toDOM(){let i=document.createElement("span");return i.innerHTML="\u25CF",i.style.color="rgba(255, 0, 0, 1.0)",i.style.cursor="pointer",i.title="Click to run to here",i}},_h=class extends Mt{constructor(t,r){super();this.line=t;this.msg=r}toDOM(){let t=document.createElement("span");return t.innerHTML="\u24E7",t.style.color="red",t.style.cursor="pointer",t.title=this.msg,t}eq(t){return this.line==t.line&&this.msg==t.msg}},Z2=new class extends Mt{toDOM(){let i=document.createElement("span");return i.textContent="\u25B6",i.style.color="transparent",i.style.cursor="pointer",i.title="Click to run to here",i.addEventListener("mouseenter",()=>{i.style.color="#ffee66"}),i.addEventListener("mouseleave",()=>{i.style.color="transparent"}),i}},Hv=new class extends Mt{toDOM(){let i=document.createElement("span");return i.innerHTML="\u25B6",i.style.color="#ff66ee",i.style.cursor="pointer",i.title="Current PC",i}},U2=as({class:"gutter-offset",markers:i=>i.state.field(Iv),initialSpacer:()=>new kh("0000")}),z2=as({class:"gutter-bytes",markers:i=>i.state.field(Nv),initialSpacer:()=>new Th("00 00 00")}),L2=as({class:"gutter-clock",markers:i=>i.state.field(Bv),initialSpacer:()=>new Xh("00")}),M2=as({class:"gutter-status",lineMarker(i,e,t){return t.length===0?Y2:null},markers:i=>{let e=i.state.field(_m);return e.size>0?e:i.state.field(Gv)},initialSpacer:()=>new _h(0,"\u24E7"),domEventHandlers:{click(i,e){let t=i.state.field(_m);if(t.size>0){let r=e.from,n="";if(t.between(r,r,(s,o,a)=>{n=a.msg}),n){let s=i.state.doc.line
Line truncated
|
|
|
|
|
Tags : ${s}`,O.style.whiteSpace="pre-wrap",O.style.fontFamily="monospace",O.style.background="#333",O.style.color="white",O.style.padding="2px 8px",O.style.borderRadius="4px",O.style.fontSize="12px",O.style.border="1px solid #555",O.style.pointerEvents="none",O.style.position="absolute",O.style.bottom="0",O.style.width="max-content",f.appendChild(O),{dom:f}}}},{hoverTime:10,hideOnChange:!0});function V2(i){return it.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input")||!i.input)return e;let t=[],r=!1;if(e.changes.iterChanges((o,a,l,h,f)=>{let O=f.toString(),m=i.input(O);t.push({from:o,to:a,insert:m}),m!==O&&(r=!0)}),!r)return e;let n=e.annotation(Tt.userEvent),s=e.annotation(Tt.addToHistory);return{changes:t,selection:e.selection,effects:e.effects,scrollIntoView:e.scrollIntoView,annotations:[...n!=null?[Tt.userEvent.of(n)]:[],...s!=null?[Tt.addToHistory.of(s)]:[]]}})}var Em=new Zo;function Iy(i){return Em.reconfigure(V2(i))}var Ny=Ce.define(),By=Ce.define(),Gy=Ce.define(),Um=Ce.define(),Fy=Ce.define(),Hy=Ce.define(),Ky=Ce.define(),Jy=Ce.define(),ew=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Ny)){let r=t.value,n=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new _f(ht(o,4)).range(a))}i=Le.of(n,!0)}return i}}),tw=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(By)){let r=t.value,n=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Rf(o).range(a))}i=Le.of(n,!0)}return i}}),iw=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Gy)){let r=t.value,n=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Cf(o).range(a))}i=Le.of(n,!0)}return i}}),rw=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Um))if(t.value===null)i=Le.empty;else{let r=t.value;if(r>=1&&r<=e.state.doc.lines){let n=e.state.doc.line(r).from,s=!1;i.between(n,n,()=>(s=!0,!1)),s?i=i.update({filter:o=>o!==n}):i=i.update({add:[W2.range(n)]})}}return i}}),Zm=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Fy)){let r=t.value,n=[];for(let[s,o]of r.entries())if(s>=1&&s<=e.state.doc.lines){let a=e.state.doc.line(s).from;n.push(new Af(s,o).range(a))}i=Le.of(n,!0)}return i}}),nw=ot.define({create(){return Le.empty},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Hy))if(t.value===null)i=Le.empty;else{let r=t.value;if(r>=1&&r<=e.state.doc.lines){let n=e.state.doc.line(r).from;i=Le.of(sw.range(n))}}return i}}),_f=class extends Mt{constructor(t){super();this.hex=t}toDOM(){return document.createTextNode(this.hex)}eq(t){return this.hex==t.hex}},Rf=class extends Mt{constructor(t){super();this.bytes=t}toDOM(){return document.createTextNode(this.bytes)}eq(t){return this.bytes==t.bytes}},Cf=class extends Mt{constructor(t){super();this.clock=t}toDOM(){return document.createTextNode(this.clock)}eq(t){return this.clock==t.clock}},D2=new class extends Mt{toDOM(){let i=document.createElement("span");return i.textContent="\u25CF",i.style.color="transparent",i.style.cursor="pointer",i.addEventListener("mouseenter",()=>{i.style.color="rgba(255, 0, 0, 0.5)"}),i.addEventListener("mouseleave",()=>{i.style.color="transparent"}),i}},W2=new class extends Mt{toDOM(){let i=document.createElement("span");return i.innerHTML="\u25CF",i.style.color="rgba(255, 0, 0, 1.0)",i.style.cursor="pointer",i.title="Click to run to here",i}},Af=class extends Mt{constructor(t,r){super();this.line=t;this.msg=r}toDOM(){let t=document.createElement("span");return t.innerHTML="\u24E7",t.style.color="red",t.style.cursor="pointer",t.title=this.msg,t}eq(t){return this.line==t.line&&this.msg==t.msg}},q2=new class extends Mt{toDOM(){let i=document.createElement("span");return i.textContent="\u25B6",i.style.color="transparent",i.style.cursor="pointer",i.title="Click to run to here",i.addEventListener("mouseenter",()=>{i.style.color="#ffee66"}),i.addEventListener("mouseleave",()=>{i.style.color="transparent"}),i}},sw=new class extends Mt{toDOM(){let i=document.createElement("span");return i.innerHTML="\u25B6",i.style.color="#ff66ee",i.style.cursor="pointer",i.title="Current PC",i}},j2=as({class:"gutter-offset",markers:i=>i.state.field(ew),initialSpacer:()=>new _f("0000")}),I2=as({class:"gutter-bytes",markers:i=>i.state.field(tw),initialSpacer:()=>new Rf("00 00 00")}),N2=as({class:"gutter-clock",markers:i=>i.state.field(iw),initialSpacer:()=>new Cf("00")}),B2=as({class:"gutter-status",lineMarker(i,e,t){return t.length===0?D2:null},markers:i=>{let e=i.state.field(Zm);return e.size>0?e:i.state.field(rw)},initialSpacer:()=>new Af(0,"\u24E7"),domEventHandlers:{click(i,e){let t=i.state.field(Zm);if(t.size>0){let r=e.from,n="";if(t.between(r,r,(s,o,a)=>{n=a.msg}),n){let s=i.state.doc.line
Line truncated
|
|
|
|
|
`);for(let l of a){aw.lastIndex=0;let h=aw.exec(l);if(h){let f=o+h.index+h[0].length;t.push(de.widget({widget:new zm(h[0],e),side:-1}).range(f))}o+=l.length+1}}return de.set(t,!0)}function cw(i){let e;function t(r){let n=e.posAtDOM(r);i(e.state.doc.lineAt(n).number)}return Rt.fromClass(class{constructor(r){e=r,this.decorations=lw(r,t)}update(r){e=r.view,(r.docChanged||r.viewportChanged)&&(this.decorations=lw(r.view,t))}},{decorations:r=>r.decorations})}function F2(i){let e=i.state.tabSize;return i.dispatch(i.state.changeByRange(t=>{let r=i.state.doc.lineAt(t.from),n=i.state.doc.lineAt(t.to);if(t.empty){let s=t.head-r.from,o=e-s%e,a=" ".repeat(o);return{changes:{from:t.from,insert:a},range:H.cursor(t.from+o)}}else if(r.number===n.number){let s=t.from-r.from,o=e-s%e,a=" ".repeat(o);return{changes:{from:t.from,to:t.to,insert:a},range:H.cursor(t.from+o)}}else{let s=[];for(let a=r.number;a<=n.number;a++){let l=i.state.doc.line(a),h=l.text.search(/\S/);if(h<0)continue;let O=(Math.floor(h/e)+1)*e-h;s.push({from:l.from+h,insert:" ".repeat(O)})}let o=i.state.changes(s);return{changes:o,range:H.range(o.mapPos(t.from),o.mapPos(t.to))}}})),!0}function H2(i){let e=i.state.tabSize,t=[],r=new Set;for(let n of i.state.selection.ranges){let s=i.state.doc.lineAt(n.from),o=i.state.doc.lineAt(n.to);for(let a=s.number;a<=o.number;a++){if(r.has(a))continue;r.add(a);let l=i.state.doc.line(a),h=l.text.search(/\S/);if(h<=0)continue;let f=Math.floor((h-1)/e)*e;t.push({from:l.from+f,to:l.from+h})}}return t.length&&i.dispatch({changes:t}),!0}var hw=[{key:"Tab",run:F2},{key:"Shift-Tab",run:H2}];var fw=Ce.define(),uw=de.line({attributes:{class:"cm-currentpc"}}),K2=ot.define({create(){return de.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(fw)){if(t.value===null)return de.none;let r=e.state.doc.line(t.value);return de.set([uw.range(r.from)])}return i},provide:i=>ne.decorations.from(i)}),Cl=class extends Ft{constructor(t){super();this.message=t}toDOM(){let t=document.createElement("div");return t.textContent=this.message,t.style.cssText=`
|
|
|
|
|
color: #ff6666;
|
|
|
|
|
background-color: #330000;
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
margin: 2px 0;
|
|
|
|
|
border-left: 3px solid #ff0000;
|
|
|
|
|
font-family: monospace;
|
|
|
|
|
`,t}},j2=ot.define({create(){return pe.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(fo.showMessage)){if(t.value===null||!t.value)return pe.none;if(t.value.toggle){let r=[],n=new Map;return i.between(0,e.state.doc.length,(a,l,f)=>{try{let h=e.state.doc.lineAt(l).number;f.spec.widget instanceof _l&&n.set(h,f.spec.widget.message)}catch(h){}}),n.has(t.value.line)?n.delete(t.value.line):n.set(t.value.line,t.value.msg),Array.from(n.keys()).sort((a,l)=>a-l).forEach(a=>{try{let l=e.state.doc.line(a);r.push(pe.widget({widget:new _l(n.get(a)),block:!0,side:1}).range(l.to))}catch(l){}}),pe.set(r,!0)}}return i},provide:i=>ne.decorations.from(i)}),Cm=class extends fi{constructor(t){super();this.value=t}toDOM(){let t=document.createElement("div");return t.textContent=`${this.value}`,t.style.cssText=`
|
|
|
|
|
`,t}},J2=ot.define({create(){return de.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(ho.showMessage)){if(t.value===null||!t.value)return de.none;if(t.value.toggle){let r=[],n=new Map;return i.between(0,e.state.doc.length,(a,l,h)=>{try{let f=e.state.doc.lineAt(l).number;h.spec.widget instanceof Cl&&n.set(f,h.spec.widget.message)}catch(f){}}),n.has(t.value.line)?n.delete(t.value.line):n.set(t.value.line,t.value.msg),Array.from(n.keys()).sort((a,l)=>a-l).forEach(a=>{try{let l=e.state.doc.line(a);r.push(de.widget({widget:new Cl(n.get(a)),block:!0,side:1}).range(l.to))}catch(l){}}),de.set(r,!0)}}return i},provide:i=>ne.decorations.from(i)}),Lm=class extends Ft{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}},i1=Ce.define(),I2=ot.define({create(){return pe.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(i1)){if(t.value===null||!t.value)return pe.none;let r=e.state.doc.lineAt(t.value.range.to);return pe.set([pe.widget({widget:new Cm(t.value.val),block:!0,side:1}).range(r.to)])}return i},provide:i=>ne.decorations.from(i)}),r1=Ce.define(),N2=pe.mark({attributes:{class:"cm-error-span"}}),B2=ot.define({create(){return pe.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(r1)){if(t.value===null)return pe.none;let r=[];for(let n of t.value)try{let s=e.state.doc.line(n.line),o=s.from+n.start,a=s.from+n.end;o>=s.from&&a<=s.to&&o<a&&r.push(N2.range(o,a))}catch(s){}return pe.set(r,!0)}return i},provide:i=>ne.decorations.from(i)}),n1=Ce.define(),G2=pe.line({attributes:{class:"highlight-lines"}}),F2=ot.define({create(){return pe.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(n1)){if(t.value===null)return pe.none;let{start:r,end:n}=t.value,s=[];for(let o=r;o<=n;o++)try{let a=e.state.doc.line(o);s.push(G2.range(a.from))}catch(a){}return pe.set(s)}return i!==pe.none&&(e.docChanged||e.selection)?pe.none:i},provide:i=>ne.decorations.from(i)}),s1={field:j2,widget:_l},Rl={effect:e1,decoration:t1,field:q2},Yh={effect:i1,field:I2},Eh={effect:r1,field:B2},Am={effect:n1,field:F2};var o1=!1,Uh=64,H2=200,Ym={default:{theme:km},6502:{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:Pm},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noLineNumbers:!0,noGutters:!0},ecs:{theme:km,isAsm:!0}},K2={input:null},ho=class{constructor(e,t){this.updateTimer=null;this.dirtylisting=!0;this.refreshDelayMsec=300;this.path=e,this.mode=t}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var r=ze.getFile(this.path),n=r&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(r);return this.newEditor(t,r,n),this.editor.dispatch({effects:zv(K2)}),ze.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),t}setVisible(e){e&&this.editor.focus()}newEditor(e,t,r){var n=Ym[this.mode]||Ym.default,s=r||n.isAsm,o=!!n.lineWrap,a=n.theme||Ym.default.theme,l=!n.noLineNumbers&&!va;ve.embed&&(l=!1,s=!1);let f=n.noGutters||va;var h;switch(this.mode){case"6502":h=kv();break;case"basic":h=Tv();break;case"bataribasic":h=Xv();break;case"fastbasic":h=_v();break;case"inform6":h=Rv();break;case"markdown":h=Ov();break;case"text/x-csrc":h=by();break;case"text/x-wiz":h=Av();break;case"verilog":h=Cv();break;case"z80":h=Ev();break;default:console.warn("Unknown mode: "+this.mode);break}this.editor=new ne({parent:e,doc:t,extensions:[Vr.of([{key:"Backspace",run:bQ}]),Vr.of(oy),l?QS():[],uS(),RQ(),Vr.of(YQ),HS(),hS(),it.allowMultipleSelections.of(!0),ud(),NS(),iQ(),pQ(),dd(),pd(),Od(),yS(),Sm(),Sv({top:!0}),Vr.of(wv),h||[],a,Uv,o1?Tm:[],it.tabSize.of(8),bn.of(" "),Vr.of(Jv),o?ne.lineWrapping:[],Rl.field,f?[]:[Rh.field,Rh.gutter],s&&!f?[Xl.field,Xl.gutter,Ch.field,Ch.gutter]:[],Ah.field,Kv.gutter,ne.updateListener.of(O=>{for(let m of O.transactions.flatMap(b=>b.effects))if(m.is(Ah.set)&&L.isRunning()&&this.runToBreakpoints(O.state),m.is(la.runToLine)){let b=m.value;if(this.sourcefile&&this.sourcefile.line2offset){let y=this.sourcefile.line2offset[b];y>=0&&Ws([y])}}}),fo.field,s1.field,Eh.field,la.field,la.gutter,Am.field,Xm.of([]),ne.updateListener.of(O=>{O.docChanged&&this.editorChanged()}),Yh.field,ne.updateListener.of(O=>{O.selectionSet&&this.inspectUnderCursor(O)})]})}editorChanged(){clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>{ze.updateFile(this.path,this.editor.state.doc.toString())},this.refreshDelayMsec)}inspectUnderCursor(e){let t=e.state.selection.main,r=e.state.sliceDoc(t.from,t.to).trim();var n;L.inspect&&(n=L.inspect(r)),!t.empty&&n&&n.length<80?e.view.dispatch({effects:Yh.effect.of({range:t,val:n})}):e.view.dispatch({effects:Yh.effect.of(null)})}setText(e){var t=this.editor.state.doc.toString();t!=e&&this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:e}})}insertLinesBefore(e){let t=this.editor.state.selection.main.from,r=this.editor.state.doc.lineAt(t).number,n=this.editor.state.doc.lineAt(t).from,s=e.split(`
|
|
|
|
|
`).length-1;this.editor.dispatch({changes:{from:n,insert:e}}),this.highlightLines(r-1,r+s-2)}highlightLines(e,t){let r=this.editor.state.doc.line(e+1);this.editor.dispatch({effects:[Am.effect.of({start:e+1,end:t+1}),ne.scrollIntoView(r.from,{y:"start",yMargin:100})]})}getValue(){return this.editor.state.doc.toString()}getPath(){return this.path}markErrors(e){this.clearErrors(),e=e.slice(0,H2);let t=new Map,r=[];for(var n of e)if(!n.path||this.path.endsWith(n.path)){var s=this.editor.state.doc.lines,o=n.line;(isNaN(o)||o<1||o>s)&&(o=1),t.set(o,n.msg),n.start!=null&&n.end!=null&&n.end>n.start&&r.push({line:o,start:n.start,end:n.end})}this.editor.dispatch({effects:[fo.set.of(t),Eh.effect.of(r.length>0?r:null)]})}clearErrors(){this.dirtylisting=!0,this.editor.dispatch({effects:[fo.set.of(new Map),fo.showMessage.of(null),Eh.effect.of(null)]})}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors();var e=this.sourcefile.lines||[];let t=new Map,r=new Map,n=new Map;for(var s of e)if(s.offset>=0&&t.set(s.line,ut(s.offset&65535,4)),s.insns){var o=s.insns.length>9?"...":s.insns;if(r.set(s.line,o),s.iscode){if(s.cycles)n.set(s.line,s.cycles+"");else if(L.getOpcodeMetadata){var a=parseInt(s.insns.split(" ")[0],16),l=L.getOpcodeMetadata(a,s.offset);if(l&&l.minCycles){var f=l.minCycles+"";n.set(s.line,f)}}}}this.editor.dispatch({effects:[Rh.set.of(t),Xl.set.of(r),Ch.set.of(n)]})}setTimingResult(e){if(this.sourcefile!=null){var t=new Map;for(let o of Object.keys(this.sourcefile.line2offset)){let a=this.sourcefile.line2offset[o],l=e.pc2clockrange[a];var r=l&&l.minclocks,n=l&&l.maxclocks;if(r>=0&&n>=0){var s;n==r?s=r+"":s=r+"-"+n,n==e.MAX_CLOCKS&&(s+="+"),t.set(parseInt(o),s)}}this.editor.dispatch({effects:[Xl.set.of(t)]})}}setCurrentLine(e,t){var r=n=>{this.editor.dispatch({effects:[la.set.of(n.line),Rl.effect.of(n.line),ne.scrollIntoView(this.editor.state.doc.line(n.line).from,{y:"center"})]})};if(this.clearCurrentLine(t),e){if(e.line<1||e.line>this.editor.state.doc.lines)return!1;if(r(e),t){let s=this.editor.state.doc.line(e.line).from+(e.start||0);this.editor.dispatch({selection:{anchor:s,head:s},effects:ne.scrollIntoView(s,{y:"center"})})}return this.currentDebugLine=e,!0}}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:[la.set.of(null),Rl.effect.of(null)]})}getActiveLine(){if(this.sourcefile){var e=zn&&zn.c;if(!e&&L.getCPUState&&!L.isRunning()&&(e=L.getCPUState()),e){var t=e&&(e.EPC||e.PC),r=this.sourcefile.findLineForOffset(t,Uh);return r}}}refreshDebugState(e){this.clearCurrentLine(e);var t=this.getActiveLine();t&&this.setCurrentLine(t,e)}refreshListing(){var e=ze.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)}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[e];if(t>=0)return t;e--}return-1}undoStep(){Jf(this.editor)}getBreakpointPCs(){if(this.sourcefile==null)return[];let e=[],r=this.editor.state.field(Ah.field).iter();for(;r.value;){let n=this.editor.state.doc.lineAt(r.from).number,s=this.sourcefile.line2offset[n];s>=0&&e.push(s),r.next()}return e}runToBreakpoints(e){let t=this.getBreakpointPCs();t.length>0?Ws(t):uo()}},Em=1024,Cl=class{createDiv(e){var t=document.createElement("div");return t.setAttribute("class","editor"),e.appendChild(t),this.newEditor(t),t}newEditor(e){this.disasmview=new ne({parent:e,extensions:[dd(),pd(),it.allowMultipleSelections.of(!0),ud(),Od(),Sm(),o1?Tm:[],Zv,Pm,Rl.field,it.tabSize.of(8),it.readOnly.of(!0)]})}refresh(e){let t=zn||L.saveState(),r=t.c?t.c.PC:0,n=0,s=0,o=L.debugSymbols&&L.debugSymbols.addr2symbol||{},a=(h,O)=>{let m="",b=0;for(;b<O;){let y=h+b|0,P=L.disassemble(y,L.readAddress.bind(L)),X="",Y="";for(let N=0;N<P.nbytes;N++)X+=ut(L.readAddress(y+N));for(;X.length<14;)X+=" ";let G=P.line;if(o&&P.isaddr&&(G=G.replace(/([^#])[$]([0-9A-F]+)/,(N,...V)=>{let d=parseInt(V[1],16),j=o[d];return j?V[0]+j:(j=o[d-1],j?V[0]+j+"+1":N)})),o){let N=o[y];N&&(Y="; "+N)}let q=ut(y,4)+" "+ma(X,14)+" "+ma(G,30)+Y+`
|
|
|
|
|
`;m+=q,y==r&&(s=n),n++,b+=P.nbytes||1}return m};var l=r<0?r-Em:Math.max(0,r-Em);let f=a(l,r-l)+a(r,Em);if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:f}}),e){let h=this.disasmview.state.doc.line(s+1);this.disasmview.dispatch({selection:{anchor:h.from,head:h.from},effects:ne.scrollIntoView(h.from,{y:"center"})})}}getCursorPC(){let e=this.disasmview.state.selection.main.head,t=this.disasmview.state.doc.lineAt(e).number;if(t>=0){let n=this.disasmview.state.doc.line(t).text.trim().split(/\s+/);if(n&&n.length>=1){let s=parseInt(n[0],16);if(console.log("getCursorPC",s),s>=0)return s}}return-1}},Zh=class extends Cl{constructor(e){super(),this.path=e}refreshListing(){var e=ze.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}}),!!L.saveState){var r=zn||L.saveState(),n=r.c?r.c.EPC||r.c.PC:0;if(n>=0&&this.assemblyfile){var s=this.assemblyfile.findLineForOffset(n,Uh);if(s&&e){let o=this.disasmview.state.doc.line(s.line);this.disasmview.dispatch({selection:{anchor:o.from,head:o.from},effects:ne.scrollIntoView(o.from,{y:"center"})})}}}}}};var Al=256,a1=100,l1=!1,zh=class i{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+" ($"+ut(e)+")";else if(typeof e=="boolean")t=e.toString();else if(typeof e=="string")e.length<a1?t=e:t=e.substring(0,a1)+"...";else if(e.buffer&&e.length<=Al)t=Qg(e,0,e.length);else if(typeof e=="object"||typeof e=="function")if(this._content!=null){if(e.slice&&e.length>Al){let l={},f=e;for(var r=Al;e.length/r>Al;)r*=2;for(let h=0;h<f.length;h+=r)l["$"+ut(h)]={$$:()=>f.slice(h,h+r)};e=l}if(e instanceof Map){let l={};for(let[f,h]of e.entries())l[f]=h;e=l}let o=e instanceof Array?Array.from(e.keys()):Object.getOwnPropertyNames(e);if(o.length>Al){let l={},f=e;for(var r=100;o.length/r>100;)r*=2;for(let O=0;O<o.length;O+=r){for(var n={},s=O;s<O+r;s++)n[o[s]]=f[o[s]];l["["+O+"...]"]=n}e=l,o=Object.getOwnPropertyNames(e)}let a=new Set(this.children.keys());o.forEach(l=>{var f=!l1&&typeof l=="string"&&l.startsWith("$$");if(!f){let h=this.children.get(l);h==null&&(h=new i(this,l),this.children.set(l,h)),h.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 c1(i,e){var t=new zh(null,null);t.view=e,t._content=i;var r=new zh(t,"/");return r.expanded=!0,r.getDiv(),r._div.style.padding="0px",r}var Zm=class{createDiv(e){return this.root=c1(e,this),this.root.getDiv()}refresh(){this.tick()}tick(){this.root.update(this.getRootObject())}};var Lh=class extends Zm{getRootObject(){return L.getDebugTree()}},Mh=class extends Jn{constructor(){super(...arguments);this.cumulativeData=!0}createDiv(t){return this.clear(),this.treeroot=c1(t,this),this.treeroot.getDiv()}refresh(){this.tick()}tick(){this.treeroot.update(this.getRootObject()),this.probe&&this.probe.clear()}clear(){this.graph=null,this.reset()}reset(){this.stack=[],this.lastsp=-1,this.lastpc=0,this.jsr=!1,this.rts=!1}newNode(t,r){return{$$SP:r,$$PC:t,count:0,startLine:null,endLine:null,calls:{}}}newRoot(t,r){this.stack.length==0?(this.graph=this.newNode(null,r),this.stack.unshift(this.graph)):r>this.stack[0].$$SP&&(this.graph=this.newNode(null,r),this.graph.calls[this.addr2str(t)]=this.stack[0],this.stack.unshift(this.graph))}getRootObject(){return this.redraw((t,r,n,s,o,a)=>{switch(t){case 184549376:this.newRoot(this.lastpc,this.lastsp);case 167772160:if(this.stack.length){let f=this.st
Line truncated
|
|
|
|
|
`,await P1(i),ve.newfile?!r&&!t?Ge('No build tool for "'+i+'" on this platform; project will not build.'):r?eg(!0,!0):Li("No skeleton file for "+t+" on this platform; using blank file."):Li('Could not find file "'+i+'"<br><br>Creating new '+(r?t:"blank")+" file."),delete ve.newfile,Jh()}}function tg(i){if(i=="/")ve={repo:"/"};else if(i.indexOf("://")>=0){var e=Qa(i);e&&(ve={repo:e.repopath})}else ve.platform=Re,ve.file=i;Ms()}async function RA(i){var e=L.getToolForFilename(i);try{return await $.get("presets/"+Qi(Re)+"/skeleton."+e,"text")}catch(t){return console.log(t+""),null}}function ig(i){return i.indexOf(" ")>=0?(Ge("No spaces in filenames, please."),!1):!0}async function CA(i){var e=Qi(Re),t={},r=[];for(var n of i){var s=L.getToolForFilename("test"+n);t[s]||(t[s]=[],r.push(s)),t[s].push(n)}var o=r.map(h=>$.ajax({url:"presets/"+e+"/skeleton."+h,type:"HEAD"}).then(()=>h,()=>null)),a=await Promise.all(o),l=[];for(var f of a)f!=null&&l.push({tool:f,extensions:t[f]});return l}async function AA(i){var e=await CA(L.getDefaultExtensions()),t,r;return e.length===0?(t=L.getDefaultExtensions(),r=t.join(" ")):(t=e.reduce((n,s)=>n.concat(s.extensions),[]),r=e.map(n=>n.extensions.join(" ")).join("<br>")),bootbox.prompt({title:"Enter the name of your new main source file.<br><br><span class='dialog-help'>"+r+"</span>",placeholder:"newfile"+t[0],callback:n=>{if(n&&n.trim().length>0){if(!ig(n))return;n.indexOf(".")<0&&(n+=t[0]);var s=n;Us("workspace","file","new"),ve.newfile="1",tg(s)}}}),!0}function YA(i){let e=$('<input type="file" multiple accept="*" style="display:none">'),t=e[0];e.change(r=>{EA(t.files)}),e.click()}function EA(i){console.log(i);var e=0;function t(){var r=i[e++];if(!r)console.log("Done uploading",e),e>2?(Li("Files uploaded."),setTimeout(ql,1e3)):(ve.file=i[0].name,bootbox.confirm({message:"Open '"+mo.sanitize(ve.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:o=>{o?Ms():setTimeout(ql,1e3)}})),Us("workspace","file","upload");else{var n=r.name,s=new FileReader;s.onload=function(o){var a=o.target.result,l=new Uint8Array(a);Es(n,l)||(l=rc(l).replace(`\r
|
|
|
|
|
`,t.className="cm-line",t}},Ow=Ce.define(),eA=ot.define({create(){return de.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(Ow)){if(t.value===null||!t.value)return de.none;let r=e.state.doc.lineAt(t.value.range.to);return de.set([de.widget({widget:new Lm(t.value.val),block:!0,side:1}).range(r.to)])}return i},provide:i=>ne.decorations.from(i)}),dw=Ce.define(),tA=de.mark({attributes:{class:"cm-error-span"}}),iA=ot.define({create(){return de.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(dw)){if(t.value===null)return de.none;let r=[];for(let n of t.value)try{let s=e.state.doc.line(n.line),o=s.from+n.start,a=s.from+n.end;o>=s.from&&a<=s.to&&o<a&&r.push(tA.range(o,a))}catch(s){}return de.set(r,!0)}return i},provide:i=>ne.decorations.from(i)}),pw=Ce.define(),rA=de.line({attributes:{class:"highlight-lines"}}),nA=ot.define({create(){return de.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(pw)){if(t.value===null)return de.none;let{start:r,end:n}=t.value,s=[];for(let o=r;o<=n;o++)try{let a=e.state.doc.line(o);s.push(rA.range(a.from))}catch(a){}return de.set(s)}return i!==de.none&&(e.docChanged||e.selection)?de.none:i},provide:i=>ne.decorations.from(i)}),mw={field:J2,widget:Cl},Al={effect:fw,decoration:uw,field:K2},Uf={effect:Ow,field:eA},zf={effect:dw,field:iA},Mm={effect:pw,field:nA};var gw=!1,Mf=64,sA=200,Vm={default:{theme:Am},6502:{isAsm:!0},z80:{isAsm:!0},jsasm:{isAsm:!0},gas:{isAsm:!0},vasm:{isAsm:!0},inform6:{theme:Cm},markdown:{lineWrap:!0},fastbasic:{noGutters:!0},basic:{noLineNumbers:!0,noGutters:!0},ecs:{theme:Am,isAsm:!0}},oA={input:null},fo=class{constructor(e,t){this.updateTimer=null;this.dirtylisting=!0;this.refreshDelayMsec=300;this.path=e,this.mode=t}createDiv(e){var t=document.createElement("div");t.setAttribute("class","editor"),e.appendChild(t);var r=ze.getFile(this.path),n=r&&this.mode=="verilog"&&/__asm\b([\s\S]+?)\b__endasm\b/.test(r);return this.newEditor(t,r,n),this.editor.dispatch({effects:Iy(oA)}),ze.getToolForFilename(this.path).startsWith("remote:")&&(this.refreshDelayMsec=1e3),t}setVisible(e){e&&this.editor.focus()}newEditor(e,t,r){var n=Vm[this.mode]||Vm.default,s=r||n.isAsm,o=!!n.lineWrap,a=n.theme||Vm.default.theme,l=!n.noLineNumbers&&!wa;ye.embed&&(l=!1,s=!1);let h=n.noGutters||wa;var f;switch(this.mode){case"6502":f=Ey();break;case"basic":f=Zy();break;case"bataribasic":f=Uy();break;case"fastbasic":f=zy();break;case"inform6":f=Ly();break;case"markdown":f=vy();break;case"text/x-csrc":f=Pv();break;case"text/x-wiz":f=Vy();break;case"verilog":f=My();break;case"z80":f=Wy();break;default:console.warn("Unknown mode: "+this.mode);break}this.editor=new ne({parent:e,doc:t,extensions:[Dr.of([{key:"Backspace",run:PQ}]),Dr.of(dv),l?TS():[],QS(),LQ(),Dr.of(DQ),sQ(),SS(),it.allowMultipleSelections.of(!0),Sd(),tQ(),hQ(),yQ(),vd(),xd(),Qd(),XS(),$m(),ky({top:!0}),Dr.of(Cy),f||[],a,jy,gw?Ym:[],it.tabSize.of(8),bn.of(" "),Dr.of(hw),o?ne.lineWrapping:[],Al.field,h?[]:[Yf.field,Yf.gutter],s&&!h?[Rl.field,Rl.gutter,Ef.field,Ef.gutter]:[],Zf.field,ow.gutter,ne.updateListener.of(O=>{for(let m of O.transactions.flatMap(b=>b.effects))if(m.is(Zf.set)&&L.isRunning()&&this.runToBreakpoints(O.state),m.is(ca.runToLine)){let b=m.value;if(this.sourcefile&&this.sourcefile.line2offset){let v=this.sourcefile.line2offset[b];v>=0&&Ws([v])}}}),ho.field,mw.field,zf.field,ca.field,ca.gutter,Mm.field,cw(O=>{window.location.hash="asseteditor/"+encodeURIComponent(this.path)+"/"+O}),Em.of([]),ne.updateListener.of(O=>{O.docChanged&&this.editorChanged()}),Uf.field,ne.updateListener.of(O=>{O.selectionSet&&this.inspectUnderCursor(O)})]})}editorChanged(){clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>{ze.updateFile(this.path,this.editor.state.doc.toString())},this.refreshDelayMsec)}inspectUnderCursor(e){let t=e.state.selection.main,r=e.state.sliceDoc(t.from,t.to).trim();var n;L.inspect&&(n=L.inspect(r)),!t.empty&&n&&n.length<80?e.view.dispatch({effects:Uf.effect.of({range:t,val:n})}):e.view.dispatch({effects:Uf.effect.of(null)})}setText(e){var t=this.editor.state.doc.toString();t!=e&&this.editor.dispatch({changes:{from:0,to:this.editor.state.doc.length,insert:e},annotations:Jh.of("full")})}replaceTextRange(e,t,r){let n=this.editor.state.doc.lineAt(e).number,s=this.editor.state.doc.lineAt(t).number;this.editor.dispatch({changes:{from:e,to:t,insert:r},annotations:Jh.of("full"),selection:{anchor:e,head:t},effects:[ne.scrollIntoView(this.editor.state.doc.line(n).from,{y:"start",yMargin:100})]})}insertLinesBefore(e){let t=this.editor.state.selection.main.from,r=this.editor.state.doc.lineAt(t).number,n=this.editor.state.doc.lineAt(t).from,s=e.split(`
|
|
|
|
|
`).length-1;this.editor.dispatch({changes:{from:n,insert:e}}),this.highlightLines(r-1,r+s-2)}highlightLines(e,t){let r=this.editor.state.doc.line(e+1);this.editor.dispatch({effects:[Mm.effect.of({start:e+1,end:t+1}),ne.scrollIntoView(r.from,{y:"start",yMargin:100})]})}getValue(){return this.editor.state.doc.toString()}getPath(){return this.path}markErrors(e){this.clearErrors(),e=e.slice(0,sA);let t=new Map,r=[];for(var n of e)if(!n.path||this.path.endsWith(n.path)){var s=this.editor.state.doc.lines,o=n.line;(isNaN(o)||o<1||o>s)&&(o=1),t.set(o,n.msg),n.start!=null&&n.end!=null&&n.end>n.start&&r.push({line:o,start:n.start,end:n.end})}this.editor.dispatch({effects:[ho.set.of(t),zf.effect.of(r.length>0?r:null)]})}clearErrors(){this.dirtylisting=!0,this.editor.dispatch({effects:[ho.set.of(new Map),ho.showMessage.of(null),zf.effect.of(null)]})}getSourceFile(){return this.sourcefile}updateListing(){this.clearErrors();var e=this.sourcefile.lines||[];let t=new Map,r=new Map,n=new Map;for(var s of e)if(s.offset>=0&&t.set(s.line,ht(s.offset&65535,4)),s.insns){var o=s.insns.length>9?"...":s.insns;if(r.set(s.line,o),s.iscode){if(s.cycles)n.set(s.line,s.cycles+"");else if(L.getOpcodeMetadata){var a=parseInt(s.insns.split(" ")[0],16),l=L.getOpcodeMetadata(a,s.offset);if(l&&l.minCycles){var h=l.minCycles+"";n.set(s.line,h)}}}}this.editor.dispatch({effects:[Yf.set.of(t),Rl.set.of(r),Ef.set.of(n)]})}setTimingResult(e){if(this.sourcefile!=null){var t=new Map;for(let o of Object.keys(this.sourcefile.line2offset)){let a=this.sourcefile.line2offset[o],l=e.pc2clockrange[a];var r=l&&l.minclocks,n=l&&l.maxclocks;if(r>=0&&n>=0){var s;n==r?s=r+"":s=r+"-"+n,n==e.MAX_CLOCKS&&(s+="+"),t.set(parseInt(o),s)}}this.editor.dispatch({effects:[Rl.set.of(t)]})}}setCurrentLine(e,t){var r=n=>{this.editor.dispatch({effects:[ca.set.of(n.line),Al.effect.of(n.line),ne.scrollIntoView(this.editor.state.doc.line(n.line).from,{y:"center"})]})};if(this.clearCurrentLine(t),e){if(e.line<1||e.line>this.editor.state.doc.lines)return!1;if(r(e),t){let s=this.editor.state.doc.line(e.line).from+(e.start||0);this.editor.dispatch({selection:{anchor:s,head:s},effects:ne.scrollIntoView(s,{y:"center"})})}return this.currentDebugLine=e,!0}}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:[ca.set.of(null),Al.effect.of(null)]})}getActiveLine(){if(this.sourcefile){var e=zn&&zn.c;if(!e&&L.getCPUState&&!L.isRunning()&&(e=L.getCPUState()),e){var t=e&&(e.EPC||e.PC),r=this.sourcefile.findLineForOffset(t,Mf);return r}}}refreshDebugState(e){this.clearCurrentLine(e);var t=this.getActiveLine();t&&this.setCurrentLine(t,e)}refreshListing(){var e=ze.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)}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[e];if(t>=0)return t;e--}return-1}undoStep(){tf(this.editor)}redoStep(){dl(this.editor)}getBreakpointPCs(){if(this.sourcefile==null)return[];let e=[],r=this.editor.state.field(Zf.field).iter();for(;r.value;){let n=this.editor.state.doc.lineAt(r.from).number,s=this.sourcefile.line2offset[n];s>=0&&e.push(s),r.next()}return e}runToBreakpoints(e){let t=this.getBreakpointPCs();t.length>0?Ws(t):uo()}},Dm=1024,Yl=class{createDiv(e){var t=document.createElement("div");return t.setAttribute("class","editor"),e.appendChild(t),this.newEditor(t),t}newEditor(e){this.disasmview=new ne({parent:e,extensions:[vd(),xd(),it.allowMultipleSelections.of(!0),Sd(),Qd(),$m(),gw?Ym:[],qy,Cm,Al.field,it.tabSize.of(8),it.readOnly.of(!0)]})}refresh(e){let t=zn||L.saveState(),r=t.c?t.c.PC:0,n=0,s=0,o=L.debugSymbols&&L.debugSymbols.addr2symbol||{},a=(f,O)=>{let m="",b=0;for(;b<O;){let v=f+b|0,P=L.disassemble(v,L.readAddress.bind(L)),T="",Y="";for(let N=0;N<P.nbytes;N++)T+=ht(L.readAddress(v+N));for(;T.length<14;)T+=" ";let B=P.line;if(o&&P.isaddr&&(B=B.replace(/([^#])[$]([0-9A-F]+)/,(N,...M)=>{let d=parseInt(M[1],16),j=o[d];return j?M[0]+j:(j=o[d-1],j?M[0]+j+"+1":N)})),o){let N=o[v];N&&(Y="; "+N)}let q=ht(v,4)+" "+ba(T,14)+" "+ba(B,30)+Y+`
|
|
|
|
|
`;m+=q,v==r&&(s=n),n++,b+=P.nbytes||1}return m};var l=r<0?r-Dm:Math.max(0,r-Dm);let h=a(l,r-l)+a(r,Dm);if(this.disasmview.dispatch({changes:{from:0,to:this.disasmview.state.doc.length,insert:h}}),e){let f=this.disasmview.state.doc.line(s+1);this.disasmview.dispatch({selection:{anchor:f.from,head:f.from},effects:ne.scrollIntoView(f.from,{y:"center"})})}}getCursorPC(){let e=this.disasmview.state.selection.main.head,t=this.disasmview.state.doc.lineAt(e).number;if(t>=0){let n=this.disasmview.state.doc.line(t).text.trim().split(/\s+/);if(n&&n.length>=1){let s=parseInt(n[0],16);if(console.log("getCursorPC",s),s>=0)return s}}return-1}},Lf=class extends Yl{constructor(e){super(),this.path=e}refreshListing(){var e=ze.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}}),!!L.saveState){var r=zn||L.saveState(),n=r.c?r.c.EPC||r.c.PC:0;if(n>=0&&this.assemblyfile){var s=this.assemblyfile.findLineForOffset(n,Mf);if(s&&e){let o=this.disasmview.state.doc.line(s.line);this.disasmview.dispatch({selection:{anchor:o.from,head:o.from},effects:ne.scrollIntoView(o.from,{y:"center"})})}}}}}};var El=256,bw=100,Sw=!1,Vf=class i{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+" ($"+ht(e)+")";else if(typeof e=="boolean")t=e.toString();else if(typeof e=="string")e.length<bw?t=e:t=e.substring(0,bw)+"...";else if(e.buffer&&e.length<=El)t=Pg(e,0,e.length);else if(typeof e=="object"||typeof e=="function")if(this._content!=null){if(e.slice&&e.length>El){let l={},h=e;for(var r=El;e.length/r>El;)r*=2;for(let f=0;f<h.length;f+=r)l["$"+ht(f)]={$$:()=>h.slice(f,f+r)};e=l}if(e instanceof Map){let l={};for(let[h,f]of e.entries())l[h]=f;e=l}let o=e instanceof Array?Array.from(e.keys()):Object.getOwnPropertyNames(e);if(o.length>El){let l={},h=e;for(var r=100;o.length/r>100;)r*=2;for(let O=0;O<o.length;O+=r){for(var n={},s=O;s<O+r;s++)n[o[s]]=h[o[s]];l["["+O+"...]"]=n}e=l,o=Object.getOwnPropertyNames(e)}let a=new Set(this.children.keys());o.forEach(l=>{var h=!Sw&&typeof l=="string"&&l.startsWith("$$");if(!h){let f=this.children.get(l);f==null&&(f=new i(this,l),this.children.set(l,f)),f.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 Qw(i,e){var t=new Vf(null,null);t.view=e,t._content=i;var r=new Vf(t,"/");return r.expanded=!0,r.getDiv(),r._div.style.padding="0px",r}var Wm=class{createDiv(e){return this.root=Qw(e,this),this.root.getDiv()}refresh(){this.tick()}tick(){this.root.update(this.getRootObject())}};var Df=class extends Wm{getRootObject(){return L.getDebugTree()}},Wf=class extends Jn{constructor(){super(...arguments);this.cumulativeData=!0}createDiv(t){return this.clear(),this.treeroot=Qw(t,this),this.treeroot.getDiv()}refresh(){this.tick()}tick(){this.treeroot.update(this.getRootObject()),this.probe&&this.probe.clear()}clear(){this.graph=null,this.reset()}reset(){this.stack=[],this.lastsp=-1,this.lastpc=0,this.jsr=!1,this.rts=!1}newNode(t,r){return{$$SP:r,$$PC:t,count:0,startLine:null,endLine:null,calls:{}}}newRoot(t,r){this.stack.length==0?(this.graph=this.newNode(null,r),this.stack.unshift(this.graph)):r>this.stack[0].$$SP&&(this.graph=this.newNode(null,r),this.graph.calls[this.addr2str(t)]=this.stack[0],this.stack.unshift(this.graph))}getRootObject(){return this.redraw((t,r,n,s,o,a)=>{switch(t){case 184549376:this.newRoot(this.lastpc,this.lastsp);case 167772160:if(this.stack.length){let h=this.st
Line truncated
|
|
|
|
|
`,await Uw(i),ye.newfile?!r&&!t?Ge('No build tool for "'+i+'" on this platform; project will not build.'):r?ag(!0,!0):Li("No skeleton file for "+t+" on this platform; using blank file."):Li('Could not find file "'+i+'"<br><br>Creating new '+(r?t:"blank")+" file."),delete ye.newfile,iu()}}function lg(i){if(i=="/")ye={repo:"/"};else if(i.indexOf("://")>=0){var e=va(i);e&&(ye={repo:e.repopath})}else ye.platform=Re,ye.file=i;Ms()}async function LA(i){var e=L.getToolForFilename(i);try{return await $.get("presets/"+Qi(Re)+"/skeleton."+e,"text")}catch(t){return console.log(t+""),null}}function cg(i){return i.indexOf(" ")>=0?(Ge("No spaces in filenames, please."),!1):!0}async function MA(i){var e=Qi(Re),t={},r=[];for(var n of i){var s=L.getToolForFilename("test"+n);t[s]||(t[s]=[],r.push(s)),t[s].push(n)}var o=r.map(f=>$.ajax({url:"presets/"+e+"/skeleton."+f,type:"HEAD"}).then(()=>f,()=>null)),a=await Promise.all(o),l=[];for(var h of a)h!=null&&l.push({tool:h,extensions:t[h]});return l}async function VA(i){var e=await MA(L.getDefaultExtensions()),t,r;return e.length===0?(t=L.getDefaultExtensions(),r=t.join(" ")):(t=e.reduce((n,s)=>n.concat(s.extensions),[]),r=e.map(n=>n.extensions.join(" ")).join("<br>")),bootbox.prompt({title:"Enter the name of your new main source file.<br><br><span class='dialog-help'>"+r+"</span>",placeholder:"newfile"+t[0],callback:n=>{if(n&&n.trim().length>0){if(!cg(n))return;n.indexOf(".")<0&&(n+=t[0]);var s=n;Us("workspace","file","new"),ye.newfile="1",lg(s)}}}),!0}function DA(i){let e=$('<input type="file" multiple accept="*" style="display:none">'),t=e[0];e.change(r=>{WA(t.files)}),e.click()}function WA(i){console.log(i);var e=0;function t(){var r=i[e++];if(!r)console.log("Done uploading",e),e>2?(Li("Files uploaded."),setTimeout(Il,1e3)):(ye.file=i[0].name,bootbox.confirm({message:"Open '"+mo.sanitize(ye.file)+"' as main project file?",buttons:{confirm:{label:"Open As New Project"},cancel:{label:"Include/Link With Project Later"}},callback:o=>{o?Ms():setTimeout(Il,1e3)}})),Us("workspace","file","upload");else{var n=r.name,s=new FileReader;s.onload=function(o){var a=o.target.result,l=new Uint8Array(a);Es(n,l)||(l=sc(l).replace(`\r
|
|
|
|
|
`,`
|
|
|
|
|
`)),_e.updateFile(n,l),console.log("Uploaded "+n+" "+l.length+" bytes"),t()},s.readAsArrayBuffer(r)}}i&&t()}async function ZA(i){var e=window.showDirectoryPicker;e||Ge("This browser can't open local files on your computer, yet. Try Chrome.");var t=await e(),r=t.name,n="__localfs__"+r,s={handle:t},o=Km.createInstance({name:n,version:2});await o.setItem(n,s),ve={localfs:r},Ms(!0)}async function UA(i){return new Promise((e,t)=>{bootbox.prompt(mo.sanitize(i),r=>{e(r)})})}async function zA(i){let e={mode:"readwrite"};var t="__localfs__"+i,r=Km.createInstance({name:t,version:2}),n=await r.getItem(t),s=n.handle;console.log(n,s);var o=await s.queryPermission(e);if(console.log(o),o!=="granted"&&(await UA("Request permissions to access filesystem?"),o=await s.requestPermission(e)),o!=="granted"){Ge("Could not get permission to access filesystem.");return}return{getFileData:async a=>{console.log("getFileData",a);let l=await s.getFileHandle(a,{create:!1});console.log("getFileData",l);let f=await l.getFile();console.log("getFileData",f);let h=await(Es(a)?f.binary():f.text());return console.log(l,f,h),h},setFileData:async(a,l)=>{}}}function jt(){return ai(ze.mainPath)}function Dg(){return ai(_e.getActiveID())}function LA(i){var e=_e.getActive();if(e&&e.setText){var t=_e.getActiveID();$.get("presets/"+Qi(Re)+"/"+t,r=>{bootbox.confirm("Reset '"+mo.sanitize(t)+"' to default?",n=>{n&&e.setText(r)})},"text").fail(()=>{Et?Ge("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):Ge("Can only revert built-in examples.")})}else Ge("Cannot revert the active window. Please choose a text file.")}function MA(i){var e=_e.getActive();if(e&&e.getPath){var t=_e.getActiveID();bootbox.confirm("Delete '"+mo.sanitize(t)+"'?",r=>{r&&wr.removeItem(t).then(()=>{ve.file==t?(go.unsetLastPreset(),Ms()):(ql(),Li("Deleted "+t))})})}else Ge("Cannot delete the active window.")}function VA(i){var e=_e.getActive();if(e&&e.getPath&&ze.getFile(e.getPath())){var t=_e.getActiveID();bootbox.prompt({title:"Rename '"+mo.sanitize(t)+"' to?",value:t,callback:r=>{var n=ze.getFile(e.getPath());if(r&&r!=t&&n){if(!ig(r))return;wr.removeItem(t).then(()=>wr.setItem(r,n)).then(()=>{ql(),alert("Renamed "+t+" to "+r),t==ze.mainPath&&tg(r)})}}})}else Ge("Cannot rename the active window.")}function DA(i){let e={},t,r=L.getPresets?L.getPresets():[];for(var n=0;n<r.length;n++){var s=r[n],o=s.chapter?s.chapter+". "+s.name:s.name,a=s.id==ze.mainPath;s.category?t=$("<optgroup />").attr("label","Examples: "+s.category).appendTo(i):t||(t=$("<optgroup />").attr("label","Examples").appendTo(i)),t.append($("<option />").val(s.id).text(o).attr("selected",a?"selected":null)),a&&(Ih=s),e[s.id]=o}return e}function WA(i){if(vr&&!jl){var e=0,t=Xo();if(t){let n=$("<optgroup />").attr("label","Repositories").appendTo(i);for(let s in t){var r=t[s];r.platform_id&&Qi(r.platform_id)==Qi(Re)&&n.append($("<option />").val(r.url).text(r.url.substring(r.url.indexOf("/"))))}}}}async function k1(i,e,t,r){let n=await wr.keys();n||(n=[]);let s;for(var o=0;o<n.length;o++){let a=n[o];if(a.startsWith(t)&&!r[a]){s||(s=$("<optgroup />").attr("label",e).appendTo(i));let l=a.substring(t.length);s.append($("<option />").val(a).text(l).attr("selected",a==ze.mainPath?"selected":null))}}}function T1(i){i.css("visibility","visible");var e=ze.mainPath;i.val()!=e&&i.append($("<option />").val(e).text(e).attr("selected","selected"))}async function ql(){var i=$("#preset_select").empty();if(Et)i.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(ai(Et)+"/").show(),await k1(i,Et,"",{}),T1(i);else{WA(i);var e=DA(i);await k1(i,"Local Files","",e),T1(i)}i.off("change").change(function(t){tg($(this).val().toString())})}function qA(i){var e=$("<p/>");if(i.path!=null){var t=i.line?i.label?`(${i.path} @ ${i.label})`:`(${i.path}:${i.line})`:`(${i.path})`,r=$("<a/>").text(t),n=i.path;n==jt()&&(n=ze.mainPath),_e.isWindow(n)&&r.click(s=>{var o=_e.createOrShow(n);o instanceof ho&&o.setCurrentLine(i,!0)}),e.append(r),e.append(" ")}return e.append($("<span/>").text(i.msg)),e}function C1(){$("#error_alert").hide(),Jm=!1}function rg(i,e){var t=$("#error_alert_msg").empty();for(var r of i.slice(0,10))t.append(qA(r));$("#error_alert").show(),Jm=e}function A1(i,e){if(e!=null){var t={msg:e,line:0};i instanceof Su&&i.$loc&&(t=Object.create(i.$loc),t.msg=e,console.log(t)),rg([t],!0)}}async function jA(i){if("errors"in i&&i.errors.length>0)Vl.addClass("has-errors"),_e.setErrors(i.errors),Dl(),rg(i.errors,!1);else{if(Vl.removeClass("has-errors"),_e.setErrors(null),C1(),i==null||"unchanged"in i&&i.unchanged||!("output"in i))return;L.debugSymbols=new xg(i.symbolmap,i.debuginfo),X1=i.params;var e=i.output;if(e!=null)try{uo(),z1(),await L.loadROM($A(),e),po=e,Gh||Mn(),UY()}catch(t){console.log(t),Vl.addClass("has-errors"),A1(t,t+""),po=null,Dl();return}Dl(),_e.refresh(!1)}}async function IA(){if(L.loadBIOS){var i=Re+".rom",e=await wr.getItem(i);e instanceof Uint8A
Line truncated
|
|
|
|
|
`),e.SP&&(t+="c.SP < 0x"+ut(e.SP)+`
|
|
|
|
|
`)),ke.updateFile(n,l),console.log("Uploaded "+n+" "+l.length+" bytes"),t()},s.readAsArrayBuffer(r)}}i&&t()}async function qA(i){var e=window.showDirectoryPicker;e||Ge("This browser can't open local files on your computer, yet. Try Chrome.");var t=await e(),r=t.name,n="__localfs__"+r,s={handle:t},o=sg.createInstance({name:n,version:2});await o.setItem(n,s),ye={localfs:r},Ms(!0)}async function jA(i){return new Promise((e,t)=>{bootbox.prompt(mo.sanitize(i),r=>{e(r)})})}async function IA(i){let e={mode:"readwrite"};var t="__localfs__"+i,r=sg.createInstance({name:t,version:2}),n=await r.getItem(t),s=n.handle;console.log(n,s);var o=await s.queryPermission(e);if(console.log(o),o!=="granted"&&(await jA("Request permissions to access filesystem?"),o=await s.requestPermission(e)),o!=="granted"){Ge("Could not get permission to access filesystem.");return}return{getFileData:async a=>{console.log("getFileData",a);let l=await s.getFileHandle(a,{create:!1});console.log("getFileData",l);let h=await l.getFile();console.log("getFileData",h);let f=await(Es(a)?h.binary():h.text());return console.log(l,h,f),f},setFileData:async(a,l)=>{}}}function jt(){return li(ze.mainPath)}function Bg(){return li(ke.getActiveID())}function NA(i){var e=ke.getActive();if(e&&e.setText){var t=ke.getActiveID();$.get("presets/"+Qi(Re)+"/"+t,r=>{bootbox.confirm("Reset '"+mo.sanitize(t)+"' to default?",n=>{n&&e.setText(r)})},"text").fail(()=>{Zt?Ge("Can only revert built-in examples. If you want to revert all files, You can pull from the repository."):Ge("Can only revert built-in examples.")})}else Ge("Cannot revert the active window. Please choose a text file.")}function BA(i){var e=ke.getActive();if(e&&e.getPath){var t=ke.getActiveID();bootbox.confirm("Delete '"+mo.sanitize(t)+"'?",r=>{r&&wr.removeItem(t).then(()=>{ye.file==t?(go.unsetLastPreset(),Ms()):(Il(),Li("Deleted "+t))})})}else Ge("Cannot delete the active window.")}function GA(i){var e=ke.getActive();if(e&&e.getPath&&ze.getFile(e.getPath())){var t=ke.getActiveID();bootbox.prompt({title:"Rename '"+mo.sanitize(t)+"' to?",value:t,callback:r=>{var n=ze.getFile(e.getPath());if(r&&r!=t&&n){if(!cg(r))return;wr.removeItem(t).then(()=>wr.setItem(r,n)).then(()=>{Il(),alert("Renamed "+t+" to "+r),t==ze.mainPath&&lg(r)})}}})}else Ge("Cannot rename the active window.")}function FA(i){let e={},t,r=L.getPresets?L.getPresets():[];for(var n=0;n<r.length;n++){var s=r[n],o=s.chapter?s.chapter+". "+s.name:s.name,a=s.id==ze.mainPath;s.category?t=$("<optgroup />").attr("label","Examples: "+s.category).appendTo(i):t||(t=$("<optgroup />").attr("label","Examples").appendTo(i)),t.append($("<option />").val(s.id).text(o).attr("selected",a?"selected":null)),a&&(Gf=s),e[s.id]=o}return e}function HA(i){if(yr&&!Nl){var e=0,t=Xo();if(t){let n=$("<optgroup />").attr("label","Repositories").appendTo(i);for(let s in t){var r=t[s];r.platform_id&&Qi(r.platform_id)==Qi(Re)&&n.append($("<option />").val(r.url).text(r.url.substring(r.url.indexOf("/"))))}}}}async function zw(i,e,t,r){let n=await wr.keys();n||(n=[]);let s;for(var o=0;o<n.length;o++){let a=n[o];if(a.startsWith(t)&&!r[a]){s||(s=$("<optgroup />").attr("label",e).appendTo(i));let l=a.substring(t.length);s.append($("<option />").val(a).text(l).attr("selected",a==ze.mainPath?"selected":null))}}}function Lw(i){i.css("visibility","visible");var e=ze.mainPath;i.val()!=e&&i.append($("<option />").val(e).text(e).attr("selected","selected"))}async function Il(){var i=$("#preset_select").empty();if(Zt)i.append($("<option />").val("/").text("Leave Repository")),$("#repo_name").text(li(Zt)+"/").show(),await zw(i,Zt,"",{}),Lw(i);else{HA(i);var e=FA(i);await zw(i,"Local Files","",e),Lw(i)}i.off("change").change(function(t){lg($(this).val().toString())})}function KA(i){var e=$("<p/>");if(i.path!=null){var t=i.line?i.label?`(${i.path} @ ${i.label})`:`(${i.path}:${i.line})`:`(${i.path})`,r=$("<a/>").text(t),n=i.path;n==jt()&&(n=ze.mainPath),ke.isWindow(n)&&r.click(s=>{var o=ke.createOrShow(n);o instanceof fo&&o.setCurrentLine(i,!0)}),e.append(r),e.append(" ")}return e.append($("<span/>").text(i.msg)),e}function Ww(){$("#error_alert").hide(),og=!1}function hg(i,e){var t=$("#error_alert_msg").empty();for(var r of i.slice(0,10))t.append(KA(r));$("#error_alert").show(),og=e}function qw(i,e){if(e!=null){var t={msg:e,line:0};i instanceof wu&&i.$loc&&(t=Object.create(i.$loc),t.msg=e,console.log(t)),hg([t],!0)}}async function JA(i){if("errors"in i&&i.errors.length>0)Wl.addClass("has-errors"),ke.setErrors(i.errors),ql(),hg(i.errors,!1);else{if(Wl.removeClass("has-errors"),ke.setErrors(null),Ww(),i==null||"unchanged"in i&&i.unchanged||!("output"in i))return;L.debugSymbols=new Tg(i.symbolmap,i.debuginfo),Mw=i.params;var e=i.output;if(e!=null)try{uo(),Gw(),await L.loadROM(AA(),e),po=e,Kf||Mn(),jY()}catch(t){console.log(t),Wl.addClass("has-errors"),qw(t,t+""),po=null,ql();return}ql(),ke.refresh(!1)}}async function eY(){if(L.loadBIOS){var i=Re+".rom",e=await wr.getItem(i);e instanceof Uint8A
Line truncated
|
|
|
|
|
`),e.SP&&(t+="c.SP < 0x"+ht(e.SP)+`
|
|
|
|
|
`),e.HL&&(t+=`c.HL == 0x4000
|
|
|
|
|
`),L.readAddress&&(t+=`this.readAddress(0x1234) == 0x0
|
|
|
|
|
`),L.readVRAMAddress&&(t+=`this.readVRAMAddress(0x1234) != 0x80
|
|
|
|
|
`),L.getRasterScanline&&(t+=`this.getRasterScanline() > 222
|
|
|
|
|
`),t}function oY(i){var e=new Function("c","return ("+i+");").bind(L);hn(),L.runEval(e),R1=i}function U1(){L.isRunning()?(_e.tick(),Nh=!1):Nh||(_e.tick(),Nh=!0),setTimeout(U1,100)}function Kh(i){L.setFrameRate(i),i>.01?$("#fps_label").text(i.toFixed(2)):$("#fps_label").text("1/"+Math.round(1/i))}function aY(){var i=L.getFrameRate();i=i/2,i>1e-5&&Kh(i)}function lY(){var i=L.getFrameRate();i=Math.min(60,i*2),Kh(i)}function cY(){Kh(60/65536)}function fY(){Mn(),Kh(60)}function hY(){_e.refresh(!1);var i=_e.getActive();if(i.getSourceFile&&i.setTimingResult){var e=L.newCodeAnalyzer();e.showLoopTimingForPC(0),i.setTimingResult(e)}}function sg(){ca&&(L.setRecorder(null),$("#dbg_record").removeClass("btn_recording"),$("#replaydiv").hide(),ng(),ca=!1)}function z1(){ca&&_i.reset()}function L1(){_i.reset(),L.setRecorder(_i),$("#dbg_record").addClass("btn_recording"),$("#replaydiv").show(),ca=!0}function uY(){ca?sg():L1()}function Ln(i,e,t){var r=_e.getActive();r&&r.insertLinesBefore?bootbox.prompt({title:"Add "+mo.sanitize(i)+" File to Project",value:"filename"+mo.sanitize(e),callback:n=>{if(n&&n.trim().length>0){if(!ig(n))return;var s=n,o=`
|
|
|
|
|
`),t}function dY(i){var e=new Function("c","return ("+i+");").bind(L);fn(),L.runEval(e),Dw=i}function Bw(){L.isRunning()?(ke.tick(),Ff=!1):Ff||(ke.tick(),Ff=!0),setTimeout(Bw,100)}function tu(i){L.setFrameRate(i),i>.01?$("#fps_label").text(i.toFixed(2)):$("#fps_label").text("1/"+Math.round(1/i))}function pY(){var i=L.getFrameRate();i=i/2,i>1e-5&&tu(i)}function mY(){var i=L.getFrameRate();i=Math.min(60,i*2),tu(i)}function gY(){tu(60/65536)}function bY(){Mn(),tu(60)}function SY(){ke.refresh(!1);var i=ke.getActive();if(i.getSourceFile&&i.setTimingResult){var e=L.newCodeAnalyzer();e.showLoopTimingForPC(0),i.setTimingResult(e)}}function ug(){ha&&(L.setRecorder(null),$("#dbg_record").removeClass("btn_recording"),$("#replaydiv").hide(),fg(),ha=!1)}function Gw(){ha&&_i.reset()}function Fw(){_i.reset(),L.setRecorder(_i),$("#dbg_record").addClass("btn_recording"),$("#replaydiv").show(),ha=!0}function QY(){ha?ug():Fw()}function Ln(i,e,t){var r=ke.getActive();r&&r.insertLinesBefore?bootbox.prompt({title:"Add "+mo.sanitize(i)+" File to Project",value:"filename"+mo.sanitize(e),callback:n=>{if(n&&n.trim().length>0){if(!cg(n))return;var s=n,o=`
|
|
|
|
|
`+t(n)+`
|
|
|
|
|
`;ze.loadFiles([s]).then(a=>{a&&a.length?Ge(n+" already exists; including anyway"):ze.updateFile(s,`
|
|
|
|
|
`),r.insertLinesBefore(o),Dl()})}}}):Ge("Can't insert text in this window -- switch back to main file")}function OY(){var i=jt(),e=L.getToolForFilename(i);i.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?Ln("Header",".h",t=>'#include "'+t+'"'):e=="dasm"||e=="zmac"?Ln("Include",".inc",t=>' include "'+t+'"'):e=="ca65"||e=="sdasz80"||e=="vasm"||e=="armips"?Ln("Include",".inc",t=>' .include "'+t+'"'):e=="verilator"?Ln("Verilog",".v",t=>'`include "'+t+'"'):e=="wiz"?Ln("Include",".wiz",t=>'import "'+t+'";'):e=="ecs"?Ln("Include",".ecs",t=>'import "'+t+'"'):e=="acme"?Ln("Include",".acme",t=>'!src "'+t+'"'):Ge("Can't add include file to this project type ("+e+")")}function dY(){var i=jt(),e=L.getToolForFilename(i);i.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?Ln("Linked C (or .s)",".c",t=>'//#link "'+t+'"'):i.endsWith("asm")||i.endsWith(".s")||e=="ca65"||e=="lwasm"?Ln("Linked ASM",".inc",t=>';#link "'+t+'"'):Ge("Can't add linked file to this project type ("+e+")")}function pY(){if(Nt=new lc($("#toolbar")[0],null),Nt.grp.prop("id","run_bar"),Nt.add("ctrl+alt+r","Reset","glyphicon-refresh",iY).prop("id","dbg_reset"),Nt.add("ctrl+alt+,","Pause","glyphicon-pause",BA).prop("id","dbg_pause"),Nt.add("ctrl+alt+.","Resume","glyphicon-play",E1).prop("id","dbg_go"),L.restartAtPC&&Nt.add("ctrl+alt+/","Restart at Cursor","glyphicon-play-circle",KA).prop("id","dbg_restartatline"),Nt.newGroup(),Nt.grp.prop("id","debug_bar"),L.runEval&&Nt.add("ctrl+alt+e","Reset and Debug","glyphicon-fast-backward",rY).prop("id","dbg_restart"),L.stepBack&&Nt.add("ctrl+alt+b","Step Backwards","glyphicon-step-backward",tY).prop("id","dbg_stepback"),L.step&&Nt.add("ctrl+alt+s","Single Step","glyphicon-step-forward",GA).prop("id","dbg_step"),L.stepOver&&Nt.add("ctrl+alt+t","Step Over","glyphicon-hand-right",FA).prop("id","dbg_stepover"),L.runUntilReturn&&Nt.add("ctrl+alt+o","Step Out of Subroutine","glyphicon-hand-up",eY).prop("id","dbg_stepout"),L.runToVsync&&Nt.add("ctrl+alt+n","Next Frame/Interrupt","glyphicon-forward",HA).prop("id","dbg_tovsync"),(L.runEval||L.runToPC)&&!Re.startsWith("verilog")&&Nt.add("ctrl+alt+l","Run To Line","glyphicon-save",JA).prop("id","dbg_toline"),Nt.newGroup(),Nt.grp.prop("id","xtra_bar"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(AA),$("#item_upload_file").click(YA),$("#item_open_directory").click(ZA),$("#item_github_login").click(Wg),$("#item_github_logout").click(qg),$("#item_github_import").click(jg),$("#item_github_publish").click(Ig),$("#item_github_push").click(Ng),$("#item_github_pull").click(Bg),$("#item_repo_delete").click(Fg),$("#item_share_file").click(Ag),$("#item_reset_file").click(LA),$("#item_rename_file").click(VA),$("#item_delete_file").click(MA),L.runEval?$("#item_debug_expr").click(nY).show():$("#item_debug_expr").hide(),$("#item_download_rom").click(Eg),$("#item_download_file").click(Zg),$("#item_download_zip").click(zg),L.getDebugSymbolFile?$("#item_download_sym").click(Lg):$("#item_download_sym").hide(),$("#item_download_allzip").click(Mg),$("#item_record_video").click(Vg),$u()?$("#item_export_cassette").click(Yg):$("#item_export_cassette").hide(),L.setFrameRate&&L.getFrameRate&&($("#dbg_slower").click(aY),$("#dbg_faster").click(lY),$("#dbg_slowest").click(cY),$("#dbg_fastest").click(fY)),$("#item_addfile_include").click(OY),$("#item_addfile_link").click(dY),$("#item_request_persist").click(()=>eg(!0,!1)),U1(),L.newCodeAnalyzer&&Nt.add(null,"Analyze CPU Timing","glyphicon-time",hY),L.setRecorder&&L.advance&&mY(),L.showHelp){let{li:t,a:r}=Gm("help__"+Re,Nm+" Help");$("#help_menu").append(t),$(r).click(()=>window.open(L.showHelp(),"_8bws_help"))}let i=L.getToolForFilename(jt()),e=vA[i];if(e){let{li:t,a:r}=Gm("help__"+i,i+" Help");$("#help_menu").append(t),$(r).click(()=>window.open(e,"_8bws_help"))}}function mY(){var i=$("#replayslider"),e=$("#clockslider"),t=$("#replay_frame"),r=$("#replay_clock");L.advanceFrameClock||$("#clockdiv").hide();var n=()=>{t.text(_i.lastSeekFrame+""),r.text(_i.lastSeekStep+"")},s=l=>{ys();var f=parseInt(i.val().toString()),h=parseInt(e.val().toString());_i.loadFrame(f,h)>=0&&(e.attr("min",0),e.attr("max",_i.lastStepCount),n(),Bh(L.saveState()))},o=l=>{ys(),_i.loadFrame(l)>=0&&(i.val(l),n(),Bh(L.saveState()))},a=l=>{ys();var f=parseInt(i.val().toString());_i.loadFrame(f,l)>=0&&(e.val(l),n(),Bh(L.saveState()))};_i.callbackStateChanged=()=>{i.attr("min",0),i.attr("max",_i.numFrames()),i.val(_i.currentFrame()),e.val(_i.currentStep()),n(),Il(L.saveState())},i.on("input",s),e.on("input",s),$("#replay_min").click(()=>{o(1)}),$("#replay_max").click(()=>{o(_i.numFrames())}),$("#replay_back").click(()=>{o(parseInt(i.val().toString())-1)}),$("#replay_fwd").click(()=>{o(parseInt(i.val().toString())+1)}),$("#clock_back").click(()=>{a(parseInt(e.val().toString())-1)}),$("#clock_fwd").click(()=>{a(parseInt(e.val().toString())+1)}),$("#replay_bar").show(),Nt.add("ctrl+alt+0","Start/Stop Replay Recording","glyphicon-record",uY).prop(Line truncated
|
|
|
|
|
`),r.insertLinesBefore(o),ql()})}}}):Ge("Can't insert text in this window -- switch back to main file")}function vY(){var i=jt(),e=L.getToolForFilename(i);i.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?Ln("Header",".h",t=>'#include "'+t+'"'):e=="dasm"||e=="zmac"?Ln("Include",".inc",t=>' include "'+t+'"'):e=="ca65"||e=="sdasz80"||e=="vasm"||e=="armips"?Ln("Include",".inc",t=>' .include "'+t+'"'):e=="verilator"?Ln("Verilog",".v",t=>'`include "'+t+'"'):e=="wiz"?Ln("Include",".wiz",t=>'import "'+t+'";'):e=="ecs"?Ln("Include",".ecs",t=>'import "'+t+'"'):e=="acme"?Ln("Include",".acme",t=>'!src "'+t+'"'):Ge("Can't add include file to this project type ("+e+")")}function xY(){var i=jt(),e=L.getToolForFilename(i);i.endsWith(".c")||e=="sdcc"||e=="cc65"||e=="cmoc"||e=="smlrc"?Ln("Linked C (or .s)",".c",t=>'//#link "'+t+'"'):i.endsWith("asm")||i.endsWith(".s")||e=="ca65"||e=="lwasm"?Ln("Linked ASM",".inc",t=>';#link "'+t+'"'):Ge("Can't add linked file to this project type ("+e+")")}function yY(){if(Nt=new hc($("#toolbar")[0],null),Nt.grp.prop("id","run_bar"),Nt.add("ctrl+alt+r","Reset","glyphicon-refresh",hY).prop("id","dbg_reset"),Nt.add("ctrl+alt+,","Pause","glyphicon-pause",iY).prop("id","dbg_pause"),Nt.add("ctrl+alt+.","Resume","glyphicon-play",Iw).prop("id","dbg_go"),L.restartAtPC&&Nt.add("ctrl+alt+/","Restart at Cursor","glyphicon-play-circle",oY).prop("id","dbg_restartatline"),Nt.newGroup(),Nt.grp.prop("id","debug_bar"),L.runEval&&Nt.add("ctrl+alt+e","Reset and Debug","glyphicon-fast-backward",fY).prop("id","dbg_restart"),L.stepBack&&Nt.add("ctrl+alt+b","Step Backwards","glyphicon-step-backward",cY).prop("id","dbg_stepback"),L.step&&Nt.add("ctrl+alt+s","Single Step","glyphicon-step-forward",rY).prop("id","dbg_step"),L.stepOver&&Nt.add("ctrl+alt+t","Step Over","glyphicon-hand-right",nY).prop("id","dbg_stepover"),L.runUntilReturn&&Nt.add("ctrl+alt+o","Step Out of Subroutine","glyphicon-hand-up",lY).prop("id","dbg_stepout"),L.runToVsync&&Nt.add("ctrl+alt+n","Next Frame/Interrupt","glyphicon-forward",sY).prop("id","dbg_tovsync"),(L.runEval||L.runToPC)&&!Re.startsWith("verilog")&&Nt.add("ctrl+alt+l","Run To Line","glyphicon-save",aY).prop("id","dbg_toline"),Nt.newGroup(),Nt.grp.prop("id","xtra_bar"),$(".dropdown-menu").collapse({toggle:!1}),$("#item_new_file").click(VA),$("#item_upload_file").click(DA),$("#item_open_directory").click(qA),$("#item_github_login").click(Gg),$("#item_github_logout").click(Fg),$("#item_github_import").click(Hg),$("#item_github_publish").click(Kg),$("#item_github_push").click(Jg),$("#item_github_pull").click(e0),$("#item_repo_delete").click(i0),$("#item_share_file").click(Lg),$("#item_reset_file").click(NA),$("#item_rename_file").click(GA),$("#item_delete_file").click(BA),L.runEval?$("#item_debug_expr").click(uY).show():$("#item_debug_expr").hide(),$("#item_download_rom").click(Vg),$("#item_download_file").click(Dg),$("#item_download_zip").click(qg),L.getDebugSymbolFile?$("#item_download_sym").click(jg):$("#item_download_sym").hide(),$("#item_download_allzip").click(Ig),$("#item_record_video").click(Ng),_u()?$("#item_export_cassette").click(Mg):$("#item_export_cassette").hide(),L.setFrameRate&&L.getFrameRate&&($("#dbg_slower").click(pY),$("#dbg_faster").click(mY),$("#dbg_slowest").click(gY),$("#dbg_fastest").click(bY)),$("#item_addfile_include").click(vY),$("#item_addfile_link").click(xY),$("#item_request_persist").click(()=>ag(!0,!1)),Bw(),L.newCodeAnalyzer&&Nt.add(null,"Analyze CPU Timing","glyphicon-time",SY),L.setRecorder&&L.advance&&wY(),L.showHelp){let{li:t,a:r}=ig("help__"+Re,eg+" Help");$("#help_menu").append(t),$(r).click(()=>window.open(L.showHelp(),"_8bws_help"))}let i=L.getToolForFilename(jt()),e=RA[i];if(e){let{li:t,a:r}=ig("help__"+i,i+" Help");$("#help_menu").append(t),$(r).click(()=>window.open(e,"_8bws_help"))}}function wY(){var i=$("#replayslider"),e=$("#clockslider"),t=$("#replay_frame"),r=$("#replay_clock");L.advanceFrameClock||$("#clockdiv").hide();var n=()=>{t.text(_i.lastSeekFrame+""),r.text(_i.lastSeekStep+"")},s=l=>{vs();var h=parseInt(i.val().toString()),f=parseInt(e.val().toString());_i.loadFrame(h,f)>=0&&(e.attr("min",0),e.attr("max",_i.lastStepCount),n(),Hf(L.saveState()))},o=l=>{vs(),_i.loadFrame(l)>=0&&(i.val(l),n(),Hf(L.saveState()))},a=l=>{vs();var h=parseInt(i.val().toString());_i.loadFrame(h,l)>=0&&(e.val(l),n(),Hf(L.saveState()))};_i.callbackStateChanged=()=>{i.attr("min",0),i.attr("max",_i.numFrames()),i.val(_i.currentFrame()),e.val(_i.currentStep()),n(),Bl(L.saveState())},i.on("input",s),e.on("input",s),$("#replay_min").click(()=>{o(1)}),$("#replay_max").click(()=>{o(_i.numFrames())}),$("#replay_back").click(()=>{o(parseInt(i.val().toString())-1)}),$("#replay_fwd").click(()=>{o(parseInt(i.val().toString())+1)}),$("#clock_back").click(()=>{a(parseInt(e.val().toString())-1)}),$("#clock_fwd").click(()=>{a(parseInt(e.val().toString())+1)}),$("#replay_bar").show(),Nt.add("ctrl+alt+0","Start/Stop Replay Recording","glyphicon-record",QY).prop(Line truncated
|
|
|
|
|
/*! Bundled license information:
|
|
|
|
|
|
|
|
|
|
localforage/dist/localforage.js:
|
|
|
|
@@ -97,4 +99,4 @@ jquery/dist/jquery.js:
|
|
|
|
|
dompurify/dist/purify.cjs.js:
|
|
|
|
|
(*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE *)
|
|
|
|
|
*/
|
|
|
|
|
//# sourceMappingURL=chunk-XXFACE7R.js.map
|
|
|
|
|
//# sourceMappingURL=chunk-EFP34EU3.js.map
|