(function(){var e;function n(a,b){var c="";void 0===b?b=8:8<b&&(b=8);if(null==a||isNaN(a))for(;0<b--;)c="?"+c;else for(;0<b--;){var d=a&15,d=d+(0<=d&&9>=d?48:55),c=String.fromCharCode(d)+c;a>>=4}return c}function aa(a){var b=a,c=a.lastIndexOf("/");0<=c&&(b=a.substr(c+1));c=b.indexOf("&");0<c&&(b=b.substr(0,c));return b}var ba={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function ca(a){return a.replace(/[&<>"']/g,function(a){return ba[a]})}var q=Date.now||function(){return+new Date};
function r(a,b,c){var d;d=!0;var f=0,g=null,k=aa(a),h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");d&&(h.onreadystatechange=function(){4===h.readyState&&(g=h.responseText,200==h.status||!h.status&&g.length&&"file:"==(window?window.location.protocol:"file:")||(f=h.status||-1),c&&(b?c.call(b,k,g,f,void 0):c(k,g,f,void 0)))});h.open("GET",a,d);h.send();d||(g=h.responseText,200!=h.status&&(f=h.status||-1),c&&(b?c.call(b,k,g,f,void 0):c(k,g,f,void 0)))}
function t(a){window&&window.alert(a)}function u(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var v={init:[],show:[],exit:[]},da=!1,w=!0;function x(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function y(a){v.init.push(a)}
function z(a){if(w)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks.")}}function A(a){!w&&a?(w=!0,da&&ea("init")):w=a}function ea(a){v[a]&&z(v[a])}x("onload",function(){da=!0;z(v.init)});x("onpageshow",function(){z(v.show)});x(u("Opera")||u("iOS")?"onunload":"onbeforeunload",function(){z(v.exit)});
function B(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id;this.name=b.name;void 0===this.id&&(this.id="");b=this.id.indexOf(".");0<b?(this.Ea=this.id.substr(0,b),this.Da=this.id.substr(b+1)):this.Da=this.id;this[a]=c;this.u={wa:!1,qa:!1,Ba:!1,H:!1,ra:!1};this.ya=null;this.u.ra=!1;this.A={};C[C.length]=this}var fa=void 0;if(window){fa||(fa=window.location.search.substr(1));for(var ga,ha=/\+/g,ia=/([^&=]+)=?([^&]*)/g;ga=ia.exec(fa);)ga[1].replace(ha," "),ga[2].replace(ha," ")}
function ja(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}function E(a){var b;b||(b=B);a.prototype=ja(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}var C=[];function F(a,b){if(void 0!==a){var c;b&&0<(c=b.indexOf("."))&&(a=b.substr(0,c+1)+a);for(c=0;c<C.length;c++)if(C[c].id===a)return C[c]}return null}
function G(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("({"+a+"})")}catch(c){t(c.message+" ("+a+")")}return b}window&&!window.document.ELEMENT_NODE&&(window.document.ELEMENT_NODE=1);
function H(a,b){for(var c=I(b.parentNode,"c1pjs-control"),d=0;d<c.length;d++)for(var f=c[d].childNodes,g=0;g<f.length;g++){var k=f[g];if(k.nodeType===window.document.ELEMENT_NODE){var h=k.getAttribute("class");if(h)for(var l=h.split(" "),m=0;m<l.length;m++)switch(h=l[m],h){case "c1pjs-binding":(h=G(k))&&h.binding&&a.J(h.type,h.binding,k),m=l.length}}}}
function I(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var f=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)f.test(a[b].className)&&c.push(a[b]);return c}
B.prototype={constructor:B,parent:null,toString:function(){return this.name?this.name:this.id||this.type},J:function(a,b,c){switch(b){case "clear":return this.A[b]||(this.A[b]=c,c.onclick=function(a){return function(){a.A.print&&(a.A.print.value="")}}(this)),!0;case "print":return this.A[b]||(this.za=this.A[b]=c,c.value="",this.F=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.xa=function(a,b,c){this.F(a,"notice",c)}),!0;default:return!1}},log:function(){},F:function(){},status:function(a){this.F(this.Da+": "+a)},xa:function(a,b){b||t(a)},N:function(a){this.u.ra||(this.u.wa=!1!==a,this.u.wa&&(a=this.ya,this.ya=null,a&&a()))}};function ka(a,b){if(a.u.Ba)return a.u.qa&&(a.u.qa=!1),a.u.Ba=!1;if(a.u.ra)return a.F(a.toString()+" error"),!1;a.u.qa=b;return a.u.qa}function J(a,b){b&&(a.u.wa?b():a.ya=b);return a.u.wa}function la(a,b){a.u.ra=!0;a.xa(b)}
function K(a){B.call(this,"C1PPanel",a);this.u.H=!1}E(K);K.prototype.J=function(a,b,c){return this.I&&this.I.J(a,b,c)||this.f&&this.f.J(a,b,c)||this.b&&this.b.J(a,b,c)?!0:B.prototype.J.call(this,a,b,c)};K.prototype.aa=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b,this.f=L(b,"cpu"),this.b=L(b,"keyboard"),ma())};function ma(){for(var a=!1,b=I(window.document,"c1pjs","panel"),c=0;c<b.length;c++){var d=b[c],f=G(d),g=F(f.id);g||(a=!0,g=new K(f));H(g,d);a&&g.N()}}y(ma);
function na(a){B.call(this,"C1PCPU",a);oa(this);this.u.H=!1;this.u.$=!1;this.ta=a.autoStart;this.ja=0;this.Ca=2;this.speed=this.ja;this.pa=30;this.oa=5;this.fa=8;this.ua=["Slow","Fast","Max"];this.fb=["(1Mhz)","(up to "+this.fa+"Mhz)","(unlimited)"];this.O=[];this.K=[];this.ka=65536;this.la=0;this.Z=65536;this.da=0;this.v=[this.Mb,this.ed,this.Xd,this.l,this.l,this.gd,this.Cb,this.l,this.kd,this.dd,this.Bb,this.l,this.l,this.ad,this.zb,this.l,this.Lb,this.fd,this.l,this.l,this.l,this.hd,this.Db,this.l,
this.Pb,this.cd,this.l,this.l,this.l,this.bd,this.Ab,this.l,this.Cc,this.vb,this.l,this.l,this.Ib,this.xb,this.qd,this.l,this.md,this.ub,this.pd,this.l,this.Hb,this.rb,this.nd,this.l,this.Jb,this.wb,this.l,this.l,this.l,this.yb,this.rd,this.l,this.Hd,this.tb,this.l,this.l,this.l,this.sb,this.od,this.l,this.xd,this.qc,this.l,this.l,this.l,this.sc,this.Yc,this.l,this.jd,this.pc,this.Xc,this.l,this.Bc,this.mc,this.Vc,this.l,this.Nb,this.rc,this.l,this.l,this.l,this.tc,this.Zc,this.l,this.Rb,this.oc,
this.l,this.l,this.l,this.nc,this.Wc,this.l,this.yd,this.Pa,this.l,this.l,this.l,this.Ra,this.vd,this.l,this.ld,this.Oa,this.ud,this.l,this.Ac,this.La,this.sd,this.l,this.Ob,this.Qa,this.l,this.l,this.l,this.Sa,this.wd,this.l,this.Jd,this.Na,this.l,this.l,this.l,this.Ma,this.td,this.l,this.l,this.Nd,this.l,this.l,this.Vd,this.Pd,this.Sd,this.l,this.lc,this.l,this.ae,this.l,this.Ud,this.Kd,this.Rd,this.l,this.Eb,this.Od,this.l,this.l,this.Wd,this.Qd,this.Td,this.l,this.ce,this.Md,this.be,this.l,this.l,
this.Ld,this.l,this.l,this.Sc,this.Hc,this.Nc,this.l,this.Tc,this.Jc,this.Oc,this.l,this.Zd,this.Gc,this.Yd,this.l,this.Qc,this.Dc,this.Lc,this.l,this.Fb,this.Ic,this.l,this.l,this.Uc,this.Kc,this.Pc,this.l,this.Sb,this.Fc,this.$d,this.l,this.Rc,this.Ec,this.Mc,this.l,this.ec,this.Xb,this.l,this.l,this.fc,this.Zb,this.ic,this.l,this.zc,this.Wb,this.kc,this.l,this.dc,this.Tb,this.gc,this.l,this.Kb,this.Yb,this.l,this.l,this.l,this.$b,this.jc,this.l,this.Qb,this.Vb,this.l,this.l,this.l,this.Ub,this.hc,
this.l,this.bc,this.Xa,this.l,this.l,this.cc,this.Za,this.wc,this.l,this.yc,this.Wa,this.$c,this.l,this.ac,this.Ta,this.uc,this.l,this.Gb,this.Ya,this.l,this.l,this.l,this.$a,this.xc,this.l,this.Id,this.Va,this.l,this.l,this.l,this.Ua,this.vc,this.l];this.eb=[7,6,0,0,0,3,5,0,3,2,2,0,0,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,3,6,0,0,3,3,5,0,4,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,6,6,0,0,0,3,5,0,3,2,2,0,3,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,6,6,0,0,0,3,5,0,4,2,2,0,5,4,6,0,2,5,0,0,0,4,6,0,2,
4,0,0,0,4,7,0,0,6,0,0,3,3,3,0,2,0,2,0,4,4,4,0,2,5,0,0,4,4,4,0,2,4,2,0,0,4,0,0,2,6,2,0,3,3,3,0,2,2,2,0,4,4,4,0,2,5,0,0,4,4,4,0,2,4,2,0,4,4,4,0,2,6,0,0,3,3,5,0,2,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0,2,6,0,0,3,3,5,0,2,2,2,0,4,4,6,0,2,5,0,0,0,4,6,0,2,4,0,0,0,4,7,0]}E(na);e=na.prototype;e.reset=function(a){this.u.$&&M(this);oa(this);this.c=this.a[65532]|this.a[65533]<<8;this.u.ra=!1;a&&(!0===this.ta||null===this.ta&&void 0===this.A.run)&&N(this)};
e.J=function(a,b,c){a=!1;switch(b){case "run":this.A[b]=c;c.onclick=function(a){return function(){a.u.$?M(a):N(a)}}(this);a=!0;break;case "A":case "X":case "Y":case "S":case "PC":case "C":case "Z":case "I":case "D":case "B":case "V":case "N":case "speed":this.A[b]=c;a=!0;break;case "setSpeed":this.A[b]=c,c.onclick=function(a){return function(){pa(a,2<=a.speed?a.ja:a.speed+1,!0)}}(this),a=!0}return a};e.Y=function(a,b){this.a=a;(this.Ia=b)?t("unsupported CPU address buffer offset ("+this.Ia+")"):this.N()};
e.aa=function(a,b){if(a&&!this.u.H){this.I=b;var c=L(b,"video");c&&(this.Aa=function(a){return function(){qa(a)}}(c),this.ea=function(a){return function(){a.ea()}}(c));this.u.H=!0;this.reset(!0);this.update()}};function ra(a,b,c,d,f){0>sa(a.O,b,c,d,f)&&(a.ka>b&&(a.ka=b),a.la<c&&(a.la=c),a.O.push([b,c,d,f]))}function O(a,b,c,d,f){0>sa(a.K,b,c,d,f)&&(a.Z>b&&(a.Z=b),a.da<c&&(a.da=c),a.K.push([b,c,d,f]))}
function sa(a,b,c,d,f){for(var g=0;g<a.length;g++)if(a[g][0]==b&&a[g][1]==c&&a[g][2]==d&&a[g][3]==f)return g;return-1}function pa(a,b,c){void 0!==b&&(a.speed=b,a.A.setSpeed&&(a.A.setSpeed.innerHTML=a.ua[2<=b?0:b+1]),a.F("running at "+a.ua[b].toLowerCase()+" speed "+a.fb[b]),c&&a.ea());a.S=0;a.Fa=q();ta(a)}e.Aa=function(){};e.ea=function(){};function P(a,b,c,d){void 0!==a.A[b]&&(void 0===d&&(d=1),c="0000"+c.toString(16),a.A[b].innerHTML=c.slice(c.length-d).toUpperCase())}
function ua(a){P(a,"A",a.g,2);P(a,"X",a.m,2);P(a,"Y",a.s,2);var b=va(a);P(a,"C",b&1?1:0);P(a,"Z",b&2?1:0);P(a,"I",b&4?1:0);P(a,"D",b&8?1:0);P(a,"B",b&16?1:0);P(a,"V",b&64?1:0);P(a,"N",b&128?1:0);P(a,"S",a.o,4);P(a,"PC",a.c,4);a.A.speed&&a.ca&&(a.A.speed.innerHTML=a.ca.toFixed(1)+"Mhz")}
function ta(a,b){var c=30;c<a.pa&&(c=a.pa);c<a.oa&&(c=a.oa);var d=1;b&&a.speed>a.ja&&a.ca&&(d=a.ca);d>a.fa&&2>a.speed&&(d=a.fa);a.gb=Math.round(1E3/30);a.ga=Math.floor(1E6/c*d);a.ma=Math.floor(1E6/30*d);a.Ha=Math.floor(1E6/a.pa*d);a.Ga=Math.floor(1E6/a.oa*d);b||(a.R=a.ma,a.U=a.Ha,a.T=a.Ga);a.na=0}function wa(a){1E6<=a.na&&ta(a,!0);a.V=0;a.hb=q()}
function xa(a){var b=q(),c=a.gb;a.V&&(c=Math.round(c*a.V/a.ma));c=c-(b-a.hb);if(b=b-a.Fa)a.ca=Math.round(a.S/(100*b))/10,864E5<=b&&pa(a);0>c?c=0:1==a.speed?a.ca<=a.fa&&(c=0):2==a.speed&&(c=0);a.na+=a.V;return c}
function N(a){if(ka(a,!0)){a.u.$||(pa(a),a.I&&a.I.start(),a.u.$=!0,a.A.run&&(a.A.run.innerHTML="Halt"),a.ea());wa(a);try{do{a.step(a.ga);var b=a.L-a.G;a.S+=b;a.V+=b;a.L=a.G=0;a.U-=a.ga;0>=a.U&&(a.U+=a.Ha,a.Aa());a.T-=a.ga;0>=a.T&&(a.T+=a.Ga,ua(a));a.R-=a.ga;if(0>=a.R){a.R+=a.ma;break}}while(a.u.$)}catch(c){M(a);a.update();ka(a,!1);la(a,c.stack||c.message);return}setTimeout(function(a){return function(){N(a)}}(a),xa(a))}else a.update(),a.I&&a.I.stop(a.Fa,a.S)}
e.step=function(a){this.b=this.j=-1;this.L=this.G=a;do{a=this.a[this.c];this.c++;this.v[a].call(this);if(0<=this.b){if(this.b>=this.ka&&this.b<=this.la)for(var b=this.b,c=this.c,d=0;d<this.O.length;d++)b>=this.O[d][0]&&b<=this.O[d][1]&&this.O[d][3].call(this.O[d][2],b,c);this.b=-1}else if(0<=this.j){if(this.j>=this.Z&&this.j<=this.da)for(b=this.j,c=this.c,d=0;d<this.K.length;d++)b>=this.K[d][0]&&b<=this.K[d][1]&&this.K[d][3].call(this.K[d][2],b,c);this.j=-1}this.G-=this.eb[a]}while(0<this.G);return!0};
function M(a){a.u.qa&&(a.u.Ba=!0);a.L-=a.G;a.G=0;a.u.$&&(a.u.$=!1,a.A.run&&(a.A.run.innerHTML="Run"))}e.update=function(){this.Aa();ua(this)};function ya(a){return a.u.$?a.S+a.L-a.G:0}e.W=function(a){return this.a[a]};e.P=function(a,b){this.a[a]=b};function va(a){var b=a.f&256?1:0,b=b|(a.i&255?0:2),b=b|((a.w&255^a.C^a.w>>1)&128?64:0),b=b|(a.h&128?128:0);return a.B&60|b}
function Q(a,b,c){var d=a.f&256?1:0,f=(b&15)+(c&15)+d;10<=f&&(f=f+6&15|16);f+=(b&240)+(c&240);a.C=b^c;a.w=f;a.h=f&255;160<=f&&(f+=96);512<=f&&(f-=256);a.f=f;a.i=b+c+d&255;a.G--;return f&255}function R(a,b,c){var d=a.f&256?0:1,f=(b&15)-(c&15)-d;0>f&&(f=(f-6&15)-16);f+=(b&240)-(c&240);0>f&&(f-=96);a.h=a.i=(a.f=b-c-d)&255;a.C=b^c;a.w=a.f;a.f^=256;a.G--;return f&255}function oa(a){a.g=0;a.m=0;a.s=0;a.o=256;a.B=0;a.h=0;a.i=0;a.C=0;a.w=0;a.f=0;a.c=0;a.b=-1;a.j=-1;a.ca=0;a.S=a.L=a.G=0}
e.Mb=function(){this.c++;this.a[this.o--]=this.c>>8;this.o|=256;this.a[this.o--]=this.c&255;this.o|=256;this.B|=16;this.B=va(this);this.a[this.o--]=this.B;this.o|=256;this.B&=239;this.b=65534;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.ed=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g|=this.a[this.b]};e.gd=function(){this.b=this.a[this.c++];this.h=this.i=this.g|=this.a[this.b]};
e.Cb=function(){this.j=this.a[this.c++];this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.kd=function(){this.B=va(this);this.a[this.o--]=this.B;this.o|=256};e.dd=function(){this.b=this.c++;this.h=this.i=this.g|=this.a[this.b]};e.Bb=function(){this.f=this.g<<1;this.h=this.i=this.g=this.f&255};e.ad=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g|=this.a[this.b]};
e.zb=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.Lb=function(){this.c+=(this.h&128?0:(this.G--,this.a[this.c]<<24>>24))+1};e.fd=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.g|=this.a[this.b]};e.hd=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g|=this.a[this.b]};
e.Db=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};e.Pb=function(){this.f=0};e.cd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.g|=this.a[this.b]};e.bd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g|=this.a[this.b]};e.Ab=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.a[this.j]<<1;this.h=this.i=this.a[this.j]=this.f&255};
e.Cc=function(){this.b=this.c++;this.a[this.o--]=this.c>>8;this.o|=256;this.a[this.o--]=this.c&255;this.o|=256;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.vb=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g&=this.a[this.b]};e.Ib=function(){this.b=this.a[this.c++];this.i=this.g&this.a[this.b];this.h=this.h&127|this.a[this.b]&128;this.w=0;this.C=this.a[this.b]&64?128:0};e.xb=function(){this.b=this.a[this.c++];this.h=this.i=this.g&=this.a[this.b]};
e.qd=function(){this.j=this.a[this.c++];this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.md=function(){this.o=this.o+1&255|256;this.B=this.a[this.o];this.f=this.B&1?256:0;this.i=this.B&2?0:1;this.h=this.B&128;this.w=0;this.C=this.B&64?128:0};e.ub=function(){this.b=this.c++;this.h=this.i=this.g&=this.a[this.b]};
e.pd=function(){this.f=this.f&65280|this.g;this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.g=this.f&255};e.Hb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.i=this.g&this.a[this.b];this.h=this.h&127|this.a[this.b]&128;this.w=0;this.C=this.a[this.b]&64?128:0};e.rb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g&=this.a[this.b]};
e.nd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.Jb=function(){this.c+=(this.h&128?(this.G--,this.a[this.c]<<24>>24):0)+1};e.wb=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.g&=this.a[this.b]};e.yb=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g&=this.a[this.b]};
e.rd=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.Hd=function(){this.f=256};e.tb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.g&=this.a[this.b]};e.sb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g&=this.a[this.b]};
e.od=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65280|this.a[this.j];this.f<<=1;this.f=this.f&65534|(this.f&512?1:0);this.h=this.i=this.a[this.j]=this.f&255};e.xd=function(){this.o=this.o+1&255|256;this.B=this.a[this.o];this.f=this.B&1?256:0;this.i=this.B&2?0:1;this.h=this.B&128;this.w=0;this.C=this.B&64?128:0;this.o=this.o+2&255|256;this.c=this.a[this.o-1|256]|this.a[this.o]<<8};
e.qc=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g^=this.a[this.b]};e.sc=function(){this.b=this.a[this.c++];this.h=this.i=this.g^=this.a[this.b]};e.Yc=function(){this.j=this.a[this.c++];this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};e.jd=function(){this.a[this.o--]=this.g;this.o|=256};e.pc=function(){this.b=this.c++;this.h=this.i=this.g^=this.a[this.b]};
e.Xc=function(){this.f=this.f&65279|(this.g&1?256:0);this.g=(this.f=this.f&65280|this.g>>1)&255;this.h=this.i=this.f&255};e.Bc=function(){this.b=this.c;this.c=this.a[this.b]|this.a[this.b+1]<<8};e.mc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g^=this.a[this.b]};e.Vc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.Nb=function(){this.c+=((this.w&255^this.C^this.w>>1)&128?0:(this.G--,this.a[this.c]<<24>>24))+1};e.rc=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.g^=this.a[this.b]};e.tc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g^=this.a[this.b]};e.Zc=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.Rb=function(){this.B&=251};e.oc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.g^=this.a[this.b]};e.nc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g^=this.a[this.b]};e.Wc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65279|(this.a[this.j]&1?256:0);this.a[this.j]=(this.f=this.f&65280|this.a[this.j]>>1)&255;this.h=this.i=this.f&255};
e.yd=function(){this.o=this.o+2&255|256;this.c=(this.a[this.o-1|256]|this.a[this.o]<<8)+1};e.Pa=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.nb=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.g=Q(this,this.g,this.a[this.b])};
e.Ra=function(){this.b=this.a[this.c++];this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.pb=function(){this.b=this.a[this.c++];this.g=Q(this,this.g,this.a[this.b])};e.vd=function(){this.j=this.a[this.c++];this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.ld=function(){this.o=this.o+1&255|256;this.h=this.i=this.g=this.a[this.o]};
e.Oa=function(){this.b=this.c++;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.mb=function(){this.b=this.c++;this.g=Q(this,this.g,this.a[this.b])};e.ud=function(){this.f=this.f&65280|this.g;this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.g=this.f&255};e.Ac=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.c=this.a[this.b]|this.a[this.b+1]<<8};
e.La=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.jb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.g=Q(this,this.g,this.a[this.b])};e.sd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};
e.Ob=function(){this.c+=((this.w&255^this.C^this.w>>1)&128?(this.G--,this.a[this.c]<<24>>24):0)+1};e.Qa=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.ob=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.g=Q(this,this.g,this.a[this.b])};
e.Sa=function(){this.b=this.a[this.c++]+this.m&255;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.qb=function(){this.b=this.a[this.c++]+this.m&255;this.g=Q(this,this.g,this.a[this.b])};e.wd=function(){this.j=this.a[this.c++]+this.m&255;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.Jd=function(){this.B|=4};
e.Na=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};e.lb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.g=Q(this,this.g,this.a[this.b])};e.Ma=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.g+this.a[this.b]+(this.f&256?1:0);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255};
e.kb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.g=Q(this,this.g,this.a[this.b])};e.td=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.f&65280|this.a[this.j];this.f=this.f&65023|(this.f&1?512:0);this.f>>=1;this.h=this.i=this.a[this.j]=this.f&255};e.Nd=function(){this.j=this.a[this.c++]+this.m&255;this.j=this.a[this.j]|this.a[this.j+1]<<8;this.a[this.j]=this.g};e.Vd=function(){this.j=this.a[this.c++];this.a[this.j]=this.s};
e.Pd=function(){this.j=this.a[this.c++];this.a[this.j]=this.g};e.Sd=function(){this.j=this.a[this.c++];this.a[this.j]=this.m};e.lc=function(){this.h=this.i=this.s=this.s-1&255};e.ae=function(){this.h=this.i=this.g=this.m};e.Ud=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.s};e.Kd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.g};e.Rd=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.a[this.j]=this.m};
e.Eb=function(){this.c+=(this.f&256?0:(this.G--,this.a[this.c]<<24>>24))+1};e.Od=function(){this.j=this.a[this.c++];this.j=(this.a[this.j]|this.a[this.j+1]<<8)+this.s;this.a[this.j]=this.g};e.Wd=function(){this.j=this.a[this.c++]+this.m&255;this.a[this.j]=this.s};e.Qd=function(){this.j=this.a[this.c++]+this.m&255;this.a[this.j]=this.g};e.Td=function(){this.j=this.a[this.c++]+this.s&255;this.a[this.j]=this.m};e.ce=function(){this.h=this.i=this.g=this.s};
e.Md=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.a[this.j]=this.g};e.be=function(){this.o=this.m|256};e.Ld=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.a[this.j]=this.g};e.Sc=function(){this.b=this.c++;this.h=this.i=this.s=this.a[this.b]};e.Hc=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.g=this.a[this.b]};e.Nc=function(){this.b=this.c++;this.h=this.i=this.m=this.a[this.b]};
e.Tc=function(){this.b=this.a[this.c++];this.h=this.i=this.s=this.a[this.b]};e.Jc=function(){this.b=this.a[this.c++];this.h=this.i=this.g=this.a[this.b]};e.Oc=function(){this.b=this.a[this.c++];this.h=this.i=this.m=this.a[this.b]};e.Zd=function(){this.h=this.i=this.s=this.g};e.Gc=function(){this.b=this.c++;this.h=this.i=this.g=this.a[this.b]};e.Yd=function(){this.h=this.i=this.m=this.g};e.Qc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.s=this.a[this.b]};
e.Dc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.g=this.a[this.b]};e.Lc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.m=this.a[this.b]};e.Fb=function(){this.c+=(this.f&256?(this.G--,this.a[this.c]<<24>>24):0)+1};e.Ic=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.g=this.a[this.b]};e.Uc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.s=this.a[this.b]};
e.Kc=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.g=this.a[this.b]};e.Pc=function(){this.b=this.a[this.c++]+this.s&255;this.h=this.i=this.m=this.a[this.b]};e.Sb=function(){this.C=this.w=0};e.Fc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.g=this.a[this.b]};e.$d=function(){this.h=this.i=this.m=this.o&255};e.Rc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.s=this.a[this.b]};
e.Ec=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.g=this.a[this.b]};e.Mc=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.m=this.a[this.b]};e.ec=function(){this.b=this.c++;this.h=this.i=this.f=this.s-this.a[this.b];this.f^=256};e.Xb=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};
e.fc=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.s-this.a[this.b];this.f^=256};e.Zb=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.ic=function(){this.j=this.a[this.c++];this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.zc=function(){this.h=this.i=this.s=this.s+1&255};e.Wb=function(){this.b=this.c++;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.kc=function(){this.h=this.i=this.m=this.m-1&255};
e.dc=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.s-this.a[this.b];this.f^=256};e.Tb=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.gc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.Kb=function(){this.c+=(this.i&255?(this.G--,this.a[this.c]<<24>>24):0)+1};
e.Yb=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.$b=function(){this.b=this.a[this.c++]+this.m&255;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.jc=function(){this.j=this.a[this.c++]+this.m&255;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};
e.Qb=function(){this.B&=-9;this.v[97]=this.Pa;this.v[101]=this.Ra;this.v[105]=this.Oa;this.v[109]=this.La;this.v[113]=this.Qa;this.v[117]=this.Sa;this.v[121]=this.Na;this.v[125]=this.Ma;this.v[225]=this.Xa;this.v[229]=this.Za;this.v[233]=this.Wa;this.v[237]=this.Ta;this.v[241]=this.Ya;this.v[245]=this.$a;this.v[249]=this.Va;this.v[253]=this.Ua};e.Vb=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};
e.Ub=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.f=this.g-this.a[this.b];this.f^=256};e.hc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.a[this.j]=this.a[this.j]-1&255};e.bc=function(){this.b=this.c++;this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Xa=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Dd=function(){this.b=this.a[this.c++]+this.m&255;this.b=this.a[this.b]|this.a[this.b+1]<<8;this.g=R(this,this.g,this.a[this.b])};e.cc=function(){this.b=this.a[this.c++];this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Za=function(){this.b=this.a[this.c++];this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Fd=function(){this.b=this.a[this.c++];this.g=R(this,this.g,this.a[this.b])};e.wc=function(){this.j=this.a[this.c++];this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};e.yc=function(){this.h=this.i=this.m=this.m+1&255};
e.Wa=function(){this.b=this.c++;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Cd=function(){this.b=this.c++;this.g=R(this,this.g,this.a[this.b])};e.$c=function(){};e.ac=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.f=this.m-this.a[this.b];this.f^=256};
e.Ta=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.zd=function(){this.b=this.a[this.c++]|this.a[this.c++]<<8;this.g=R(this,this.g,this.a[this.b])};e.uc=function(){this.j=this.a[this.c++]|this.a[this.c++]<<8;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};e.Gb=function(){this.c+=(this.i&255?0:(this.G--,this.a[this.c]<<24>>24))+1};
e.Ya=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Ed=function(){this.b=this.a[this.c++];this.b=(this.a[this.b]|this.a[this.b+1]<<8)+this.s;this.g=R(this,this.g,this.a[this.b])};
e.$a=function(){this.b=this.a[this.c++]+this.m&255;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Gd=function(){this.b=this.a[this.c++]+this.m&255;this.g=R(this,this.g,this.a[this.b])};e.xc=function(){this.j=this.a[this.c++]+this.m&255;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};
e.Id=function(){this.B|=8;this.v[97]=this.nb;this.v[101]=this.pb;this.v[105]=this.mb;this.v[109]=this.jb;this.v[113]=this.ob;this.v[117]=this.qb;this.v[121]=this.lb;this.v[125]=this.kb;this.v[225]=this.Dd;this.v[229]=this.Fd;this.v[233]=this.Cd;this.v[237]=this.zd;this.v[241]=this.Ed;this.v[245]=this.Gd;this.v[249]=this.Bd;this.v[253]=this.Ad};
e.Va=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Bd=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.s;this.g=R(this,this.g,this.a[this.b])};
e.Ua=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.f=this.g-this.a[this.b]-(this.f&256?0:1);this.C=this.g^this.a[this.b];this.w=this.f;this.h=this.i=this.g=this.f&255;this.f^=256};e.Ad=function(){this.b=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.g=R(this,this.g,this.a[this.b])};e.vc=function(){this.j=(this.a[this.c++]|this.a[this.c++]<<8)+this.m;this.h=this.i=this.a[this.j]=this.a[this.j]+1&255};
e.Xd=function(){var a;a=this.a[this.c++];switch(a){case 0:this.F("HALT");M(this);break;case 1:a=this.c;for(var b="";a<this.a.length;){var c=this.a[a++];if(!c)break;b+=String.fromCharCode(c)}this.c=a;b=b.replace(/%A/g,n(this.g,2)).replace(/%X/g,n(this.m,2)).replace(/%Y/g,n(this.s,2));this.F(b);this.R=0;this.L-=this.G;this.G=0;break;default:this.c-=2,this.F("undefined opSim: 0x"+n(a,2)+" at "+("0x"+n(this.c,4))),M(this)}};
e.l=function(){var a=this.a[--this.c];this.F("undefined opcode: 0x"+n(a,2)+" at "+("0x"+n(this.c,4)));M(this)};y(function(){for(var a=I(window.document,"c1pjs","cpu"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new na(d);H(d,c)}});
function S(a){B.call(this,"C1PROM",a);this.b=this.a=null;this.c=a.size;if(this.g=a.image){a=this.g;var b;b=this.g;var c="",d=b.lastIndexOf(".");0<=d&&(c=b.substr(d+1).toLowerCase());b=c;"json"!=b&&"hex"!=b&&(a="http://"+(window?window.location.host:"www.pcjs.org")+"/api/v1/dump?file="+this.g+"&format=bytes");r(a,this,this.i)}}E(S);
S.prototype.Y=function(a,b,c,d){this.a=a;this.h=b;a=c-b+1;this.c||(this.c=a);a!=this.c?la(this,"computer-specified ROM size (0x"+n(a,4)+") does not match component-specified size ("+("0x"+n(this.c,4))+")"):(d&&(this.f=d,O(d,b,c,this,this.P)),za(this))};S.prototype.aa=function(a){a&&!this.u.H&&(this.u.H=!0)};S.prototype.P=function(a,b){if(void 0!==b){var c=a-this.h;this.a[this.h+c]=this.b?this.b[c]:0}};
S.prototype.i=function(a,b,c){if(c)this.F('Error loading ROM "'+a+'" ('+c+")");else{if("["==b.charAt(0)||"{"==b.charAt(0))try{var d=eval("("+b+")"),f=d.bytes;f?this.b=f:this.b=d}catch(g){this.F('Error processing ROM "'+a+'": '+g.message);return}else for(a=b.replace(/\n/gm," ").replace(/ +$/,"").split(" "),this.b=Array(a.length),b=0;b<a.length;b++)this.b[b]=parseInt(a[b],16);za(this)}};
function za(a){if(!J(a))if(!a.g)a.N();else if(a.b&&a.a){var b=a.b.length;if(b!=a.c)la(a,"ROM image size (0x"+n(b,4)+") does not match component-specified size ("+("0x"+n(a.c,4))+")");else{for(var c=0;c<b;c++)a.a[a.h+c]=a.b[c];a.N()}}}y(function(){for(var a=I(window.document,"c1pjs","rom"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new S(d);H(d,c)}});function Aa(a){B.call(this,"C1PRAM",a)}E(Aa);Aa.prototype.Y=function(a){this.a=a;this.N()};
y(function(){for(var a=I(window.document,"c1pjs","ram"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Aa(d);H(d,c)}});
function Ba(a){B.call(this,"C1PKeyboard",a);this.u.H=!1;this.fa=a.model;this.L=8;this.oa=10;this.na=13;this.O=27;this.la=this.L;this.ma=this.oa;this.ga=this.na;this.K=this.O;this.v=241;this.G=224;this.ja=3;this.ka=15;this.o=1;this.m=[];this.m["break"]=this.G;this.m.esc=this.K;this.m["ctrl-c"]=this.ja;this.m["ctrl-o"]=this.ka;this.b=[];this.b[49]=30464;this.b[33]=30704;this.b[50]=30208;this.b[34]=30448;this.b[51]=29952;this.b[35]=30192;this.b[52]=29696;this.b[36]=29936;this.b[53]=29440;this.b[37]=
29680;this.b[54]=29184;this.b[38]=29424;this.b[55]=28928;this.b[39]=29168;this.b[56]=26368;this.b[40]=26608;this.b[57]=26112;this.b[41]=26352;this.b[48]=25856;this.b[58]=25600;this.b[42]=25840;this.b[45]=25344;this.b[61]=25584;this.b[46]=22272;this.b[62]=22512;this.b[108]=22016;this.b[76]=22256;this.b[92]=22256;this.b[111]=21760;this.b[79]=22E3;this.b[this.la]=22E3;this.b[this.ma]=21504;this.b[this.ga]=21248;this.b[119]=18176;this.b[87]=18416;this.b[101]=17920;this.b[69]=18160;this.b[114]=17664;this.b[82]=
17904;this.b[116]=17408;this.b[84]=17648;this.b[121]=17152;this.b[89]=17392;this.b[117]=16896;this.b[85]=17136;this.b[105]=16640;this.b[73]=16880;this.b[115]=14080;this.b[83]=14320;this.b[100]=13824;this.b[68]=14064;this.b[102]=13568;this.b[70]=13808;this.b[103]=13312;this.b[71]=13552;this.b[104]=13056;this.b[72]=13296;this.b[106]=12800;this.b[74]=13040;this.b[107]=12544;this.b[75]=12784;this.b[91]=12784;this.b[120]=9984;this.b[88]=10224;this.b[99]=9728;this.b[67]=9968;this.b[118]=9472;this.b[86]=
9712;this.b[98]=9216;this.b[66]=9456;this.b[110]=8960;this.b[78]=9200;this.b[94]=9200;this.b[109]=8704;this.b[77]=8944;this.b[93]=8944;this.b[44]=8448;this.b[60]=8688;this.b[113]=5888;this.b[81]=6128;this.b[97]=5632;this.b[65]=5872;this.b[122]=5376;this.b[90]=5616;this.b[32]=5120;this.b[47]=4864;this.b[63]=5104;this.b[59]=4608;this.b[43]=4848;this.b[112]=4352;this.b[80]=4592;this.b[64]=4592;this.b[this.v]=1536;this.b[this.K]=1280;this.b[240]=512;this.b[242]=256;this.b[244]=0;this.reset()}E(Ba);
e=Ba.prototype;e.reset=function(){this.sa(this.fa);this.c=this.o;this.S=0;this.g=[this.o,0,0,0,0,0,0,0];this.w=[];if(this.h)for(var a in this.h)isNaN(a)||this.h[a]&&clearTimeout(this.h[a]);this.h=[];this.da=this.i=0;this.T=-1;this.R=this.g;this.V=this.C=0;this.j=""};
e.J=function(a,b,c){if(void 0===this.A[b])switch(b){case "keyDown":return this.A[b]=c,c.onkeydown=function(a){return function(b){return Ca(a,b,!0)}}(this),!0;case "keyPress":return this.A[b]=c,c.onkeypress=function(a){return function(b){var c=!0;b=b||window.event;b=b.which||b.keyCode;a.j="";a.c&8?a.c&=-9:c=!T(a,b);return c}}(this),!0;case "keyUp":return this.A[b]=c,c.onkeyup=function(a){return function(b){return Ca(a,b,!1)}}(this),!0;case "break":return this.A[b]=c,c.onclick=function(a){return function(){a.I&&
a.I.reset(!0)}}(this),!0;default:if(void 0!==this.m[b])return this.A[b]=c,c.onclick=function(a,b,c){return function(){a.f&&a.f.ea();return!T(a,c)}}(this,b,this.m[b]),!0}return!1};e.Y=function(a,b,c,d){this.a=a;this.Z=b;this.pa=c-b+1;this.ta=this.Z+this.pa;d&&(this.f=d,O(d,b,c,this,this.P));this.N()};e.sa=function(a){this.s=a;this.B=255;600!=this.s&&(this.B=0,this.F("updated keyboard model: "+this.s))};e.aa=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b)};
e.N=function(){this.U=(this.ua=u("iOS"))||u("Android");B.prototype.N.call(this)};function Da(a,b){var c=b?100:250;a.f&&a.f.ca&&(c/=a.f.ca);return c}function Ea(a,b){!a.i||void 0!==b&&b==a.i||(clearTimeout(a.h[a.i]),U(a,a.i,!1,4))}function V(a,b,c){a.j=b;Fa(a,c||300)}function Fa(a,b){if(0<a.j.length){var c=a.j.charCodeAt(0);10==c&&(c=13);65<=c&&90>=c&&(c+=32);a.j=a.j.substr(1);T(a,c)}0<a.j.length&&setTimeout(function(a){return function(){Fa(a,b)}}(a),b)}
function Ca(a,b,c){var d,f=!c;b=b.keyCode;c&&(a.da=b);16==b?(a.c&=-5,c&&(a.c|=4),b+=224,f=!1):18==b?(a.c&=-3,c&&(a.c|=2),b+=224,f=!1):b==a.v-224?(a.c&=-65,c&&(a.c|=64),b+=224,f=!1):20==b?(c=!c,a.c&=~a.o,c&&(a.c|=a.o),b+=224,f=!1):91==b?(a.c&=-9,c&&(a.c|=8),f=!1,d=!0):d=9==b?f=!1:b==a.O||b==a.L?c?!T(a,b):!1:!0;f&&(a.c&=-9,a.U||b!=a.da||Ea(a));void 0===d&&(d=!U(a,b,c,2));return d}
function T(a,b){var c=!1;b==a.G?a.I&&(a.I.reset(!0),c=!0):(a.U&&65<=b&&90>=b&&(b+=32),Ea(a,b),U(a,b,!0,0)&&(a.f.speed==a.f.Ca?U(a,b,!1,1):(c=!1,a.h[b]&&(clearTimeout(a.h[b]),c=!0),c=Da(a,c),a.h[a.i=b]=setTimeout(function(a){return function(){U(a,b,!1,3)}}(a),c)),c=!0));return c}
function U(a,b,c,d){var f=!1;c||(a.h[b]=null,a.i==b&&(a.i=0));var g=0,k=a.b[b];void 0===k&&(1<=b&&26>=b&&(b+=64,g=a.v),k=a.b[b]);void 0!==k&&(b=k>>12,f=k>>8&15,g||(g=k&255),c?(a.g[b]|=1<<f,a.g[0]=g==a.v?a.g[0]|64:240==g?a.g[0]|4:242==g?a.g[0]|2:a.g[0]&-71):(a.g[b]&=~(1<<f),a.g[0]&=-71,a.g[0]|=a.c&70),c=0==d&&!a.w.length,a.w.push(a.g.slice()),Ga(a,c),f=!0);return f}e.W=function(){};e.P=function(a){this.S=this.f.W(a)^this.B;this.C++;Ga(this,!1,a)};
function Ga(a,b,c){var d=ya(a.f);b||(a.f.speed==a.f.Ca?b=void 0!==c&&32<=a.C:(b=d-a.V,b=0>b||8192<=b));b&&(b=a.w.shift(),void 0!==b&&(a.R=b),a.C=0,a.V=d);for(b=d=0;8>b;b++)a.S&1<<b&&(d|=a.R[b]);d^=a.B;if(void 0!==c)a.a[c]=d;else if(c=a.Z,d!=a.T)for(;c<a.ta;c++)a.a[c]=d;a.T=d}y(function(){for(var a=I(window.document,"c1pjs","keyboard"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Ba(d);H(d,c)}});
function Ha(a,b,c,d){B.call(this,"C1PVideo",a);this.S=a.model;this.K=a.charCols;this.L=a.charRows;this.U=a.screenWidth;this.V=a.screenHeight;this.i=a.charWidth;this.j=a.charHeight;Ia(this);this.m=b;this.R=c;this.g=d}E(Ha);e=Ha.prototype;e.reset=function(a){this.sa(this.S);if(this.a)for(var b=this.v;b<this.B;b++)this.a[b]=a?Math.floor(256*Math.random()):32};e.J=function(a,b,c){switch(b){case "refresh":return this.A[b]=c,c.onclick=function(a){return function(){Ja(a);qa(a)}}(this),!0}return!1};
e.Y=function(a,b,c,d){this.a=a;this.v=b;this.T=c-b+1;this.B=this.v+this.T;d&&(this.f=d,ra(d,56832,56832,this,this.W),O(d,56832,56832,this,this.P));this.reset(!0)};function Ia(a,b,c,d,f){a.o=void 0!==b?b:a.K;a.Z=void 0!==c?c:a.L;a.c=a.o*a.Z;a.B=a.v+a.c;a.I=void 0!==d?d:0;a.O=void 0!==f?f:c;a.C=Math.floor(a.U/a.o);a.G=Math.floor(a.V/a.O)}e.ea=function(){this.m.focus()};
e.sa=function(a){this.s=a;600==this.s?(Ia(this,this.K,this.L,3,25),1024==this.c&&this.f&&(this.h=this.B+this.c-1,O(this.f,this.h,this.h,this,this.bb))):(this.F("updated video model: "+this.s),Ia(this,64,32));Ja(this);qa(this)};e.aa=function(a,b){if(a&&!this.u.H&&J(this)){if(this.u.H=!0,this.b=L(b,"keyboard"))this.b.J("canvas","keyDown",this.m),this.b.J("canvas","keyPress",this.m),this.b.J("canvas","keyUp",this.m)}else!a&&this.u.H&&(this.u.H=!1)};
e.N=function(){this.i||(this.i=Math.floor(this.g.width/16));this.j||(this.j=Math.floor(this.g.height/16));B.prototype.N.call(this)};e.W=function(a){var b=this.f.W(a);this.f.P(a,b&127|(Math.floor(ya(this.f)/8333)&1?128:0))};e.P=function(){};
e.bb=function(a,b){if(void 0!==b){this.sa(540);this.b&&this.b.sa(542);var c=this.f,d=c.K,f=[],g=sa(d,this.h,this.h,this,this.bb);if(0<=g){f.push(d[g][0]);f.push(d[g][1]);d.splice(g,1);for(var k=65536,h=0,g=0;g<d.length;g++)k>d[g][0]&&(k=d[g][0]),h<d[g][1]&&(h=d[g][1]);f.push(k);f.push(h)}4==f.length&&(c.Z=f[2],c.da=f[3])}};function Ja(a){a.w=Array(a.c);for(var b=0;b<=a.c;b++)a.w[b]=-1}
function qa(a){var b=0;if(a.u.H)for(;b<a.c;){var c=a.a[a.v+b];if(a.w[b]!=c){var d=Math.floor(b/a.o);if(d>=a.I&&(d-=a.I,d<a.O)){var f=c*a.i;a.R.drawImage(a.g,f%a.g.width,Math.floor(f/a.g.width)*a.j,a.i,a.j,b%a.o*a.C,d*a.G,a.C,a.G)}a.w[b]=c}b++}}
y(function(){for(var a=I(window.document,"c1pjs","video"),b=0;b<a.length;b++){var c=a[b],d=G(c),f=window.document.createElement("canvas");if(void 0===f||!f.getContext){c.innerHTML="<br/>Missing &lt;canvas&gt; support. Please try a newer web browser.";break}f.setAttribute("class","c1pjs-canvas");f.setAttribute("width",d.screenWidth);f.setAttribute("height",d.screenHeight);f.setAttribute("contenteditable","true");f.setAttribute("autocapitalize","off");f.setAttribute("autocorrect","off");f.style.backgroundColor=
d.screenColor;f.style.height="auto";0<=(window?window.navigator.userAgent:"").indexOf("MSIE")&&(f.style.height=(c.clientWidth*d.screenHeight/d.screenWidth|0)+"px",c.onresize=function(a,b,c,d){return function(){b.style.height=(a.clientWidth*d/c|0)+"px"}}(c,f,d.screenWidth,d.screenHeight));c.appendChild(f);var g=new Image,k=f.getContext("2d"),f=new Ha(d,f,k,g);g.onload=function(a){return function(){a.N()}}(f,d.charSet);g.src=d.charSet;H(f,c)}});
function Ka(a){B.call(this,"C1PSerialPort",a);this.u.H=!1;this.s=a.demo;this.reset()}E(Ka);e=Ka.prototype;e.reset=function(){if(2!=this.c){this.h=this.j=0;var a=1;if(this.Ea){var b=this.Ea.match(/\d+/);null!==b&&(a=parseInt(b[0],10))}this.g='10 PRINT "HELLO OSI #'+a+'"\n';this.c=this.i=0}};e.start=function(){this.b&&this.s&&(V(this.b," C\n\n",3E3),setTimeout(function(a){return function(){a.c=1;V(a.b,"LOAD\n")}}(this),12E3));this.s=!1};
e.J=function(a,b,c){var d=this;switch(b){case "listSerial":return this.A[b]=c,!0;case "loadSerial":return this.A[b]=c,c.onclick=function(){d.A.listSerial&&r(d.A.listSerial.value,d,d.Ja)},!0;case "mountSerial":return!u("Mobi")&&window&&"FileReader"in window?(this.A[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),c.onsubmit=function(a){var b=a.currentTarget[1].files[0],c=new FileReader;c.onload=function(){d.Ja(b.name,c.result.toString(),
0)};c.readAsText(b);return!1}):c.parentNode.removeChild(c),!0}return!1};e.Y=function(a,b,c,d){this.a=a;this.m=b;this.v=c-b+1;this.o=this.m+this.v;if(this.f=d)ra(d,b,c,this,this.W),O(d,b,c,this,this.P);this.N()};e.aa=function(a,b){a&&!this.u.H&&(this.u.H=!0,this.I=b,this.b=L(b,"keyboard"))};
e.Ja=function(a,b,c){b?(this.g=b,this.c=this.i=0,this.I&&this.b&&this.f.u.$?(this.F("auto-loading "+a),this.f.ea(),"."!=this.g.charAt(0)?(this.c=1,V(this.b,"NEW\nLOAD\n")):(this.c=2,this.I.reset(!0),V(this.b,"ML"))):this.F(a+" ready to load")):this.F(a+" load error ("+c+")")};e.W=function(a,b){void 0!==b&&(a&1?La(this):this.g&&!this.i&&La(this))};e.P=function(){};
function La(a){if(void 0!==a.g){a.j=0;a.h=0;if(a.i<a.g.length){var b=a.g.charCodeAt(a.i++);10==b&&(b=13);a.j=b;a.h=1}else 1==a.c&&a.b&&V(a.b," \nRUN\n"),a.c=0;for(b=a.m+0;b<a.o;b+=2)a.a[b]=a.h?1:0;for(b=a.m+1;b<a.o;b+=2)a.a[b]=a.h?a.j:0}}y(function(){for(var a=I(window.document,"c1pjs","serial"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Ka(d);H(d,c)}});function Ma(a){B.call(this,"C1PDiskController",a);this.u.H=!1;this.reset(!0)}E(Ma);e=Ma.prototype;
e.reset=function(a){Na(this);this.b=-1;a&&(this.c=[],this.c[0]={de:0,Ka:40,cb:!0,ia:20,ba:0,ha:-1,va:[]})};
function Na(a){a.v={D:64,X:function(){},update:function(a){return function(c){void 0!==c&&(this.D=c);a.j.D&4||W(a,0,this)}}(a)};a.g={D:255,X:function(){this.update()},update:function(a){return function(c){void 0===c?c=a.g.D:Oa(a,c,a.i.D);c=(c|190)&-2;if(0<=a.b&&a.c[a.b].va.length){var d=a.c[a.b];d.cb&&(c&=-33);d.ba||(c&=-3);10>=--d.ia&&(0<d.ia?(c&=-129,Pa(a)):(d.ia=100,0<=a.b&&(a.c[a.b].ha=0,Qa(a))))}this.D=c;a.j.D&4&&W(a,0,this)}}(a)};a.j={D:0,X:function(){},update:function(a){return function(c){void 0!==
c&&(this.D=c&-193);W(a,1,this);a.g.update();a.v.update()}}(a)};a.w={D:255,X:function(){},update:function(a){return function(c){void 0!==c&&(this.D=c);a.m.D&4||W(a,2,this)}}(a)};a.i={D:255,X:function(){},update:function(a){return function(c){void 0===c?c=a.i.D:Oa(a,a.g.D,c);if(0<=a.b&&a.b<a.c.length){var d=a.c[a.b];d.va.length&&a.i.D&8&&!(c&8)&&(c&4?d.ba--:d.ba++,d.ba>=d.Ka&&(d.ba=d.Ka),0>d.ba&&(d.ba=0),d.ia=20,a.g.update(a.g.D|128),Pa(a))}this.D=c;a.m.D&4&&W(a,2,this)}}(a)};a.m={D:0,X:function(){},
update:function(a){return function(c){void 0!==c&&(this.D=c&-193);W(a,3,this);a.i.update();a.w.update()}}(a)};a.B={D:0,X:function(){},update:function(a){return function(c){void 0!==c&&(3==(c&3)&&(a.h.D=14),this.D=c);a.h.update()}}(a)};a.h={D:14,X:function(){},update:function(a){return function(c){void 0===c&&(c=a.h.D);c&=-2;0<=a.b&&0<=a.c[a.b].ha&&(c|=1);this.D=c;W(a,16,this)}}(a)};a.o={D:0,X:function(a){return function(){Qa(a)}}(a),update:function(a){return function(c){void 0!==c&&(this.D=c);W(a,
17,this)}}(a)};a.C={D:0,X:function(){},update:function(){return function(){}}(a)}}e.J=function(a,b,c){switch(b){case "listDisk":return this.A[b]=c,!0;case "loadDisk":return this.A[b]=c,c.onclick=function(a){return function(){if(a.A.listDisk){var b=a.A.listDisk.value,c=b;".json"!=b.substr(b.length-5)&&(c="http://"+window.location.host+"/api/v1/dump?disk="+b);a.F("loading  "+aa(b)+"...");r(c,a,a.ib)}}}(this),!0}return!1};
e.Y=function(a,b,c,d){this.a=a;this.s=b;if(this.f=d)ra(d,b,c,this,this.W),O(d,b,c,this,this.P);this.N()};e.aa=function(a){a&&!this.u.H&&(this.u.H=!0)};
e.ib=function(a,b,c){if(c)this.F("disk load error ("+c+")");else{c=[];this.F("mounting "+a+"...");try{if(c=eval("("+b+")"),c.length)if(c[0].length){var d=c[0];if(void 0===d[0].trackNum)this.F("data error: "+d[0]);else if(this.c[0]){for(b=0;b<d.length;b++){var f,g=d[b],k=g.sectors;if(void 0===(f=g.trackNum)||void 0===k)throw Error("track "+b+" missing data");f!=b&&t("track "+f+" out of order (expected "+b+")");c=[];var h,l,m;if(f){Ra(c,g,"trackSig");Sa(c,g);X(c,g,"trackType");for(var p=0;p<k.length;p++){h=
k[p];l=h.sectorData;X(c,h,"sectorSig");X(c,h,"sectorNum");X(c,h,"sectorPages");for(m=0;m<l.length;m++)c.push(l[m]);Ra(c,h,"sectorEndSig")}}else for(h=k[0],l=h.sectorData,X(c,g,"trackLoad",2),X(c,h,"sectorPages"),m=0;m<l.length;m++)c.push(l[m]);d[f].ab=c}this.c[0].va=d;this.F("mount of "+a+" complete")}else this.F("no available drives")}else this.F("no tracks: "+a);else this.F("no data: "+a)}catch(D){this.F("disk data error: "+D.message)}}};
function Sa(a,b){var c=b.trackNum;if(void 0===c)throw Error("missing bcd value: trackNum");a.push(Math.floor(c/10)<<4|c%10)}function X(a,b,c,d){b=b[c];if(void 0===b)throw Error("missing binary value: "+c);2==d&&a.push(b>>8&255);a.push(b&255)}function Ra(a,b,c){b=b[c];if(void 0===b)throw Error("missing signature: "+c);for(c=0;c<b.length;c++)a.push(b.charCodeAt(c))}
function Ta(a,b,c){b&=63;16>b?b&=3:32>b&&(b&=17);switch(b){case 0:a=a.j.D&4?a.g:a.v;break;case 1:a=a.j;break;case 2:a=a.m.D&4?a.i:a.w;break;case 3:a=a.m;break;case 16:a=c?a.B:a.h;break;case 17:a=a.o;break;default:a=a.C}return a}e.W=function(a,b){void 0!==b&&Ta(this,a-this.s,!1).X()};e.P=function(a,b){if(void 0!==b){var c=this.f.W(a);Ta(this,a-this.s,!0).update(c)}};function Oa(a,b,c){var d=-1;void 0!==b&&void 0!==c&&(d=0,c&32||(d|=2),a.g.D&64||(d|=1));a.b!=d&&(a.b=d,a.h.update())}
function Pa(a){0<=a.b&&(a.c[a.b].ha=-1,a.o.update(255),a.h.update())}function Qa(a){var b=null;if(0<=a.b){var b=a.c[a.b],c=b.va[b.ba];void 0!==c&&(0<=b.ha&&b.ha<c.ab.length?(b.ia=100,b=c.ab[b.ha++],a.o.update(b),a.h.update()):(b.ia=10,Pa(a)))}}function W(a,b,c){a.f.P(b+a.s,c.D)}y(function(){for(var a=I(window.document,"c1pjs","disk"),b=0;b<a.length;b++){var c=a[b],d=G(c),d=new Ma(d);H(d,c)}});function Y(a,b){B.call(this,"C1PComputer",a);this.M=b}E(Y);
Y.prototype.reset=function(a){var b=null,c;for(c in this.M)for(var d=0;d<this.M[c].length;d++){var f=this.M[c][d];f&&f.reset&&(f.reset(),"cpu"==c&&(b=f))}b&&(b.update(),a&&N(b))};Y.prototype.start=function(){for(var a in this.M)if("cpu"!=a)for(var b=0;b<this.M[a].length;b++){var c=this.M[a][b];c&&c.start&&c.start()}};Y.prototype.stop=function(a,b){for(var c in this.M)if("cpu"!=c)for(var d=0;d<this.M[c].length;d++){var f=this.M[c][d];f&&f.stop&&f.stop(a,b)}};
Y.prototype.J=function(a,b,c){switch(b){case "reset":return this.A[b]=c,c.onclick=function(a){return function(){a.reset()}}(this),!0}return!1};function L(a,b){return a.M[b]?a.M[b][0]:null}function Ua(a){var b=null,c;for(c in a.M)for(var d=0;d<a.M[c].length;d++){var f=a.M[c][d];if(f){if(!J(f)){J(f,function(a){return function(){Ua(a)}}(a));return}"cpu"==c?b=f:f.aa&&f.aa(!0,a)}}a.N();a.F("C1Pjs v1.19.3\nCopyright \u00a9 2012-2015 Jeff Parsons <Jeff@pcjs.org>");b&&b.aa(!0,a)}
y(function(){for(var a=I(window.document,"c1pjs","computer"),b=0;b<a.length;b++){for(var c=a[b],d=G(c),f,g={},k,h=0,l=0,m=0;m<d.modules.length;m++){var p=d.modules[m];if(!m){if("cpu"!=p.type)break;h=p.start;l=p.end;k=Array(l+1-h);for(f=h;f<k.length;f++)k[f]=0}if(f=F(p.refID,d.id)){var D=p.type;void 0===g[D]&&(g[D]=[]);g[D].push(f);f.Y&&void 0!==p.start&&f.Y(k,p.start,p.end,g.cpu[0])}else{t('no component for <module refid="'+p.refID+'">');return}}if(void 0===k){t('<module type="cpu"> definition must appear first in the <computer> specification');
break}if(f=F("debugger",d.id))g["debugger"]=[f],f.Y&&f.Y(k,h,l,g.cpu[0]);h=new Y(d,g);if(l=F("panel",d.id))if(g.panel=[l],l.za){f=d.id;d=void 0;g=[];f&&(f=0<(d=f.indexOf("."))?f.substr(0,d+1):"");for(d=0;d<C.length;d++)m=C[d],f&&m.id.indexOf(f)||g.push(m);d=g;for(g=0;g<d.length;g++)f=d[g],f!=l&&(f.xa=l.xa,f.F=l.F,f.za=l.za)}H(h,c);Ua(h)}});var Z=0;function Va(a,b,c,d,f,g){f("Loading "+a+"...");r(a,null,function(k,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),g(h,null)):Wa(h,a,b,c,d,f,g)})}
function Wa(a,b,c,d,f,g,k){function h(a,g){if(g)k(g,null);else{if(c){var h=b;h&&0>h.indexOf("/")&&(h=window.location.pathname+h);a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" state=$2"+d+"$2":"")+(h?" url=$2"+h+"$2":""))}h=null;if("<"==a.charAt(0))try{f||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(h=new window.ActiveXObject("Microsoft.XMLDOM"),h.async=!1,h.loadXML(a)):h=(new window.DOMParser).parseFromString(a,"text/xml")}catch(D){h=
null,a=D.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);k(a,h)}}a?f?Xa(a,g,h):h(a,null):k("no data"+(b?" for file: "+b:""),null)}
function Xa(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var f=d[2];b("Loading "+f+"...");r(f,null,function(g,k,h){if(h||!k)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(g=d[3])if(h=k.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,p=/( [a-z]+=)(['"])(.*?)\2/g;m=p.exec(g);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(k=k.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+f);return}k=k.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],k);Xa(a,b,c)}})}else c(a,null)}
function Ya(a,b,c){function d(a){if(void 0===k){var b=g&&I(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=ca(a))}function f(a){d("Error: "+a);h&&(--Z||A(!0));h=!1}var g,k,h=!0;Z++;try{if(g=window.document.getElementById(a)){c||(c="/versions/c1pjs/1.19.3/components.xsl");var l=function(h,k){if(k){var l=function(h,l){if(l)if(l)if(d("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window){var m=k.transformNode(l);m?(g.outerHTML=m,--Z||A(!0)):f("transformNodeToObject failed")}else window.document.implementation&&
window.document.implementation.createDocument?(m=new XSLTProcessor,m.importStylesheet(l),(m=m.transformToFragment(k,window.document))?g.parentNode?(g.parentNode.replaceChild(m,g),--Z||A(!0)):f("invalid machine element: "+a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser");else f("failed to load XSL file: "+c);else f(h)};k?Va(c,null,null,!1,d,l):f("failed to load XML file: "+b)}else f(h)};"<"!=b.charAt(0)?Va(b,a,void 0,!0,d,l):Wa(b,null,a,void 0,!1,d,l)}else f("missing machine element: "+
a)}catch(m){f(m.message)}return h}window.embedC1P=function(a,b,c){A(!1);return Ya(a,b,c)};window.enableEvents=A;window.sendEvent=ea;})();
