commit 0a7f973068506e6d6f17615753a0c314f36139ab Author: Chris Cromer Date: Tue Jul 26 20:54:59 2016 -0400 Initial commit diff --git a/.idea/jvon.iml b/.idea/jvon.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/jvon.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3a15e65 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/check/index.css b/check/index.css new file mode 100644 index 0000000..66796b3 --- /dev/null +++ b/check/index.css @@ -0,0 +1,25 @@ +html { + height: 100%; + width: 100%; + padding: 0px; + margin: 0px; + position: fixed; +} + +body { + height: 100%; + padding: 5px; + margin: 0px; +} + +#drop_zone { + border: 2px dashed #bbb; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + padding: 25px; + text-align: center; + font: 20pt bold; + color: #bbb; + height: 92%; +} \ No newline at end of file diff --git a/check/index.html b/check/index.html new file mode 100644 index 0000000..aa4cbe5 --- /dev/null +++ b/check/index.html @@ -0,0 +1,18 @@ + + + + + + + JVON Checker + + + + + + + +
Arrastre los archivos de JVON aquí
+ + + \ No newline at end of file diff --git a/check/script.js b/check/script.js new file mode 100644 index 0000000..738fcea --- /dev/null +++ b/check/script.js @@ -0,0 +1,63 @@ +var fileContents = new Array(); +var fileNames = new Array(); + +function handleFileSelect(evt) { + evt.stopPropagation(); + evt.preventDefault(); + + var files = evt.dataTransfer.files; + for (var i = 0, f; f = files[i]; i++) { + var file = files[i]; + + if (file) { + var reader = new FileReader(); + reader.onload = (function(theFile) { + return function (e) { + fileNames[fileNames.length] = theFile.name; + fileContents[fileContents.length] = e.target.result.substring(0,128); + if (fileContents.length == files.length) { + compareFiles(fileContents, fileNames); + } + }; + })(f); + + reader.readAsText(file); + } + else { + alert("No se pude abrir los archivos!"); + } + } +} + +function compareFiles(fileContents, fileNames) { + var found = false; + for (var i = 0; i < fileContents.length; i++) { + for (var j = i + 1; j < fileContents.length; j++) { + if (fileContents[i] == fileContents[j]) { + alert(fileNames[i] + "\r\n\r\n" + fileNames[j] + "\r\n\r\nTienen los mismos identificadores!"); + found = true; + } + } + } + if (found == false) { + alert("Ningun identificador era lo mismo!"); + } + resetArrays(); +} + +function resetArrays() { + fileNames = new Array(); + fileContents = new Array(); +} + +function handleDragOver(evt) { + evt.stopPropagation(); + evt.preventDefault(); + evt.dataTransfer.dropEffect = 'copy'; +} + +function initialize() { + var dropZone = document.getElementById('drop_zone'); + dropZone.addEventListener('dragover', handleDragOver, false); + dropZone.addEventListener('drop', handleFileSelect, false); +} \ No newline at end of file diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..ac6ae52 Binary files /dev/null and b/favicon.ico differ diff --git a/index.css b/index.css new file mode 100644 index 0000000..1764d29 --- /dev/null +++ b/index.css @@ -0,0 +1,147 @@ +body { + font-family: "Lucida Console", Monaco, monospace; +} + +.main_table { + width: 100%; + height: 100%; +} + +.title_table { + width: 100%; +} + +.main_td { + vertical-align: top; + text-align: center; + width: 50%; + border: 1px solid black; + padding: 10px; + height: 100%; +} + +.title_td { + background: #0000FF; + color: #FFFFFF; + padding: 3px; +} + +.result_table { + vertical-align: top; + padding: 10px; +} + +.line_number_td { + cursor: pointer; +} + +.line_number_selected { + background: #FFFF00 !important; +} + +.code_number_selected { + background: #FF0000 !important; +} + +.table_background { + background: #000000; +} + +.table_cell { + background: #FFFFFF; + padding: 3px; +} + +.blank_title_cell { + width: 33%; +} + +.options { + width: 33%; + text-align: right; +} + +.project_name { + width: 33%; + text-align: center; +} + +.scrollcode { + margin: 0px auto; + width: 100%; + height: 300px; + overflow: scroll; + overflow-x: hidden; +} + +.scrollresult { + margin: 0px auto; + width: 100%; + height: 300px; + overflow: scroll; + overflow-x: scroll; +} + +.input_prompt { + vertical-align: middle; + text-align: center; + padding: 5px; + background-color: #FFFFFF; + width: 200px; + height: 75px; + margin: auto; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 1000; + border: 1px solid black; + visibility: hidden; +} + +.input_prompt_vertical { + vertical-align: middle; +} + +.help_window { + padding: 5px; + background-color: #FFFFFF; + width: 400px; + height: 300px; + margin: auto; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 1000; + border: 1px solid black; + overflow: scroll; + overflow-x: hidden; + visibility: hidden; +} + +.help_title { + text-align: center; + width: 100%; + color: #FF0000; + margin: 0px auto; +} + +.blur { + position: fixed; + background-color: #000000; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 900; + background-color: #000000; + opacity: 0.7; + visibility: hidden; +} + +.credits { + text-align: right; +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..1679de6 --- /dev/null +++ b/index.html @@ -0,0 +1,148 @@ + + + + + + + JVON Web + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + {{strings.input_value}} + + + +
+ +
+ + + + + + + +
{{strings.project_name}} + + +
+
+ + + + + +
+ {{strings.code}}
+
+ + + + + + +
{{line.line}}
+
+
+ + + + + + {{strings.import_code}} + +
+ {{strings.result}} +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
LnAc808182838485Wrt
{{result.line}}{{result.ac}}{{result.first}}{{result.second}}{{result.third}}{{result.fourth}}{{result.fifth}}{{result.sixth}}{{result.wrt}}
+
+ + + + + + + +
{{strings.screen}}
{{line.result}}
+
+
+
+ + + + {{strings.interval}} + +
+
+ JVON Web
+ {{strings.credits_description}} {{strings.credits_john}}
+ {{strings.credits_cromer}}
+ Ingeniería Civil en Informática, Universidad del Bío Bío, 2015
+ Version android +
+ + diff --git a/js/angular/angular-sanitize.min.js b/js/angular/angular-sanitize.min.js new file mode 100755 index 0000000..f70694b --- /dev/null +++ b/js/angular/angular-sanitize.min.js @@ -0,0 +1,16 @@ +/* + AngularJS v1.3.11 + (c) 2010-2014 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(n,h,p){'use strict';function E(a){var d=[];s(d,h.noop).chars(a);return d.join("")}function g(a){var d={};a=a.split(",");var c;for(c=0;c=c;e--)d.end&&d.end(f[e]);f.length=c}}"string"!==typeof a&&(a=null===a||"undefined"===typeof a?"":""+a);var b,k,f=[],m=a,l;for(f.last=function(){return f[f.length-1]};a;){l="";k=!0;if(f.last()&&x[f.last()])a=a.replace(new RegExp("(.*)<\\s*\\/\\s*"+f.last()+"[^>]*>","i"),function(a,b){b=b.replace(H,"$1").replace(I,"$1");d.chars&&d.chars(r(b));return""}),e("",f.last());else{if(0===a.indexOf("\x3c!--"))b=a.indexOf("--",4),0<=b&&a.lastIndexOf("--\x3e",b)===b&&(d.comment&&d.comment(a.substring(4, +b)),a=a.substring(b+3),k=!1);else if(y.test(a)){if(b=a.match(y))a=a.replace(b[0],""),k=!1}else if(J.test(a)){if(b=a.match(z))a=a.substring(b[0].length),b[0].replace(z,e),k=!1}else K.test(a)&&((b=a.match(A))?(b[4]&&(a=a.substring(b[0].length),b[0].replace(A,c)),k=!1):(l+="<",a=a.substring(1)));k&&(b=a.indexOf("<"),l+=0>b?a:a.substring(0,b),a=0>b?"":a.substring(b),d.chars&&d.chars(r(l)))}if(a==m)throw L("badparse",a);m=a}e()}function r(a){if(!a)return"";var d=M.exec(a);a=d[1];var c=d[3];if(d=d[2])q.innerHTML= +d.replace(//g,">")}function s(a,d){var c=!1,e=h.bind(a,a.push);return{start:function(a,k,f){a=h.lowercase(a);!c&&x[a]&&(c=a);c||!0!==C[a]||(e("<"),e(a),h.forEach(k,function(c,f){var k= +h.lowercase(f),g="img"===a&&"src"===k||"background"===k;!0!==P[k]||!0===D[k]&&!d(c,g)||(e(" "),e(f),e('="'),e(B(c)),e('"'))}),e(f?"/>":">"))},end:function(a){a=h.lowercase(a);c||!0!==C[a]||(e(""));a==c&&(c=!1)},chars:function(a){c||e(B(a))}}}var L=h.$$minErr("$sanitize"),A=/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,z=/^<\/\s*([\w:-]+)[^>]*>/,G=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,K=/^]*?)>/i,I=/"\u201d\u2019]/,c=/^mailto:/;return function(e,b){function k(a){a&&g.push(E(a))} +function f(a,c){g.push("');k(c);g.push("")}if(!e)return e;for(var m,l=e,g=[],n,p;m=l.match(d);)n=m[0],m[2]||m[4]||(n=(m[3]?"http://":"mailto:")+n),p=m.index,k(l.substr(0,p)),f(n,m[0].replace(c,"")),l=l.substring(p+m[0].length);k(l);return a(g.join(""))}}])})(window,window.angular); +//# sourceMappingURL=angular-sanitize.min.js.map diff --git a/js/angular/angular-touch.min.js b/js/angular/angular-touch.min.js new file mode 100755 index 0000000..a6dab57 --- /dev/null +++ b/js/angular/angular-touch.min.js @@ -0,0 +1,13 @@ +/* + AngularJS v1.3.11 + (c) 2010-2014 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(y,u,z){'use strict';function s(h,k,p){n.directive(h,["$parse","$swipe",function(d,e){return function(l,m,f){function g(a){if(!c)return!1;var b=Math.abs(a.y-c.y);a=(a.x-c.x)*k;return q&&75>b&&0b/a}var b=d(f[h]),c,q,a=["touch"];u.isDefined(f.ngSwipeDisableMouse)||a.push("mouse");e.bind(m,{start:function(a,b){c=a;q=!0},cancel:function(a){q=!1},end:function(a,c){g(a)&&l.$apply(function(){m.triggerHandler(p);b(l,{$event:c})})}},a)}}])}var n=u.module("ngTouch",[]);n.factory("$swipe", +[function(){function h(d){var e=d.touches&&d.touches.length?d.touches:[d];d=d.changedTouches&&d.changedTouches[0]||d.originalEvent&&d.originalEvent.changedTouches&&d.originalEvent.changedTouches[0]||e[0].originalEvent||e[0];return{x:d.clientX,y:d.clientY}}function k(d,e){var l=[];u.forEach(d,function(d){(d=p[d][e])&&l.push(d)});return l.join(" ")}var p={mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},touch:{start:"touchstart",move:"touchmove",end:"touchend",cancel:"touchcancel"}};return{bind:function(d, +e,l){var m,f,g,b,c=!1;l=l||["mouse","touch"];d.on(k(l,"start"),function(a){g=h(a);c=!0;f=m=0;b=g;e.start&&e.start(g,a)});var q=k(l,"cancel");if(q)d.on(q,function(a){c=!1;e.cancel&&e.cancel(a)});d.on(k(l,"move"),function(a){if(c&&g){var d=h(a);m+=Math.abs(d.x-b.x);f+=Math.abs(d.y-b.y);b=d;10>m&&10>f||(f>m?(c=!1,e.cancel&&e.cancel(a)):(a.preventDefault(),e.move&&e.move(d,a)))}});d.on(k(l,"end"),function(a){c&&(c=!1,e.end&&e.end(h(a),a))})}}}]);n.config(["$provide",function(h){h.decorator("ngClickDirective", +["$delegate",function(k){k.shift();return k}])}]);n.directive("ngClick",["$parse","$timeout","$rootElement",function(h,k,p){function d(b,c,d){for(var a=0;aMath.abs(b[a]-c)&&25>Math.abs(e-f))return b.splice(a,a+2),!0}return!1}function e(b){if(!(2500e&&1>c||g&&g[0]===e&&g[1]===c||(g&&(g=null),"label"===b.target.tagName.toLowerCase()&&(g=[e,c]),d(f,e,c)||(b.stopPropagation(), +b.preventDefault(),b.target&&b.target.blur()))}}function l(b){b=b.touches&&b.touches.length?b.touches:[b];var c=b[0].clientX,d=b[0].clientY;f.push(c,d);k(function(){for(var a=0;ak&&12>x&&(f||(p[0].addEventListener("click",e,!0),p[0].addEventListener("touchstart", +l,!0),f=[]),m=Date.now(),d(f,h,t),r&&r.blur(),u.isDefined(g.disabled)&&!1!==g.disabled||c.triggerHandler("click",[b]));a()});c.onclick=function(a){};c.on("click",function(a,c){b.$apply(function(){k(b,{$event:c||a})})});c.on("mousedown",function(a){c.addClass("ng-click-active")});c.on("mousemove mouseup",function(a){c.removeClass("ng-click-active")})}}]);s("ngSwipeLeft",-1,"swipeleft");s("ngSwipeRight",1,"swiperight")})(window,window.angular); +//# sourceMappingURL=angular-touch.min.js.map diff --git a/js/angular/angular.min.js b/js/angular/angular.min.js new file mode 100755 index 0000000..2b79daa --- /dev/null +++ b/js/angular/angular.min.js @@ -0,0 +1,251 @@ +/* + AngularJS v1.3.11 + (c) 2010-2014 Google, Inc. http://angularjs.org + License: MIT +*/ +(function(M,Y,t){'use strict';function T(b){return function(){var a=arguments[0],c;c="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.3.11/"+(b?b+"/":"")+a;for(a=1;a").append(b).html();try{return b[0].nodeType===pb?Q(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+Q(b)})}catch(d){return Q(c)}}function pc(b){try{return decodeURIComponent(b)}catch(a){}}function qc(b){var a={},c,d;s((b||"").split("&"),function(b){b&& +(c=b.replace(/\+/g,"%20").split("="),d=pc(c[0]),y(d)&&(b=y(c[1])?pc(c[1]):!0,rc.call(a,d)?D(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function Nb(b){var a=[];s(b,function(b,d){D(b)?s(b,function(b){a.push(Fa(d,!0)+(!0===b?"":"="+Fa(b,!0)))}):a.push(Fa(d,!0)+(!0===b?"":"="+Fa(b,!0)))});return a.length?a.join("&"):""}function qb(b){return Fa(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Fa(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi, +":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,a?"%20":"+")}function Id(b,a){var c,d,e=rb.length;b=B(b);for(d=0;d/,">"));}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);c.debugInfoEnabled&&a.push(["$compileProvider",function(a){a.debugInfoEnabled(!0)}]);a.unshift("ng");d=Ob(a,c.strictDi);d.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return d}, +e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;M&&e.test(M.name)&&(c.debugInfoEnabled=!0,M.name=M.name.replace(e,""));if(M&&!f.test(M.name))return d();M.name=M.name.replace(f,"");ga.resumeBootstrap=function(b){s(b,function(b){a.push(b)});d()}}function Kd(){M.name="NG_ENABLE_DEBUG_INFO!"+M.name;M.location.reload()}function Ld(b){b=ga.element(b).injector();if(!b)throw Ka("test");return b.get("$$testability")}function tc(b,a){a=a||"_";return b.replace(Md,function(b,d){return(d?a:"")+b.toLowerCase()})} +function Nd(){var b;uc||((sa=M.jQuery)&&sa.fn.on?(B=sa,z(sa.fn,{scope:La.scope,isolateScope:La.isolateScope,controller:La.controller,injector:La.injector,inheritedData:La.inheritedData}),b=sa.cleanData,sa.cleanData=function(a){var c;if(Pb)Pb=!1;else for(var d=0,e;null!=(e=a[d]);d++)(c=sa._data(e,"events"))&&c.$destroy&&sa(e).triggerHandler("$destroy");b(a)}):B=R,ga.element=B,uc=!0)}function Qb(b,a,c){if(!b)throw Ka("areq",a||"?",c||"required");return b}function sb(b,a,c){c&&D(b)&&(b=b[b.length-1]); +Qb(G(b),a,"not a function, got "+(b&&"object"===typeof b?b.constructor.name||"Object":typeof b));return b}function Ma(b,a){if("hasOwnProperty"===b)throw Ka("badname",a);}function vc(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,f=a.length,g=0;g")+d[2];for(d=d[0];d--;)c=c.lastChild;f=Ya(f,c.childNodes);c=e.firstChild;c.textContent=""}else f.push(a.createTextNode(b));e.textContent="";e.innerHTML="";s(f,function(a){e.appendChild(a)});return e}function R(b){if(b instanceof +R)return b;var a;F(b)&&(b=U(b),a=!0);if(!(this instanceof R)){if(a&&"<"!=b.charAt(0))throw Sb("nosel");return new R(b)}if(a){a=Y;var c;b=(c=gf.exec(b))?[a.createElement(c[1])]:(c=Fc(b,a))?c.childNodes:[]}Gc(this,b)}function Tb(b){return b.cloneNode(!0)}function wb(b,a){a||xb(b);if(b.querySelectorAll)for(var c=b.querySelectorAll("*"),d=0,e=c.length;d 4096 bytes)!"));else{if(n.cookie!==y)for(y=n.cookie,d=y.split("; "),ea={},f=0;fk&&this.remove(q.key), +b},get:function(a){if(k").parent()[0])});var f=S(a,b,a,c,d,e);E.$$addScopeClass(a);var g=null;return function(b,c,d){Qb(b,"scope");d=d||{};var e=d.parentBoundTranscludeFn,h=d.transcludeControllers;d=d.futureParentElement;e&&e.$$boundTransclude&&(e=e.$$boundTransclude);g||(g=(d=d&&d[0])?"foreignobject"!==ua(d)&&d.toString().match(/SVG/)?"svg":"html":"html");d="html"!==g?B(Wb(g,B("
").append(a).html())): +c?La.clone.call(a):a;if(h)for(var l in h)d.data("$"+l+"Controller",h[l].instance);E.$$addScopeInfo(d,b);c&&c(d,b);f&&f(b,d,d,e);return d}}function S(a,b,c,d,e,f){function g(a,c,d,e){var f,l,k,q,n,p,w;if(r)for(w=Array(c.length),q=0;qK.priority)break;if(N=K.scope)K.templateUrl||(I(N)?(Oa("new/isolated scope",S||P,K,aa),S=K):Oa("new/isolated scope",S,K,aa)),P=P||K;z=K.name;!K.templateUrl&&K.controller&&(N=K.controller, +C=C||{},Oa("'"+z+"' controller",C[z],K,aa),C[z]=K);if(N=K.transclude)ca=!0,K.$$tlb||(Oa("transclusion",ea,K,aa),ea=K),"element"==N?(H=!0,x=K.priority,N=aa,aa=e.$$element=B(Y.createComment(" "+z+": "+e[z]+" ")),d=aa[0],V(g,Za.call(N,0),d),Aa=E(N,f,x,l&&l.name,{nonTlbTranscludeDirective:ea})):(N=B(Tb(d)).contents(),aa.empty(),Aa=E(N,f));if(K.template)if(A=!0,Oa("template",ka,K,aa),ka=K,N=G(K.template)?K.template(aa,e):K.template,N=Sc(N),K.replace){l=K;N=Rb.test(N)?Tc(Wb(K.templateNamespace,U(N))):[]; +d=N[0];if(1!=N.length||d.nodeType!==oa)throw ja("tplrt",z,"");V(g,aa,d);R={$attr:{}};N=W(d,[],R);var ba=a.splice(M+1,a.length-(M+1));S&&y(N);a=a.concat(N).concat(ba);Qc(e,R);R=a.length}else aa.html(N);if(K.templateUrl)A=!0,Oa("template",ka,K,aa),ka=K,K.replace&&(l=K),v=T(a.splice(M,a.length-M),aa,e,g,ca&&Aa,k,n,{controllerDirectives:C,newIsolateScopeDirective:S,templateDirective:ka,nonTlbTranscludeDirective:ea}),R=a.length;else if(K.compile)try{Q=K.compile(aa,e,Aa),G(Q)?w(null,Q,Pa,fb):Q&&w(Q.pre, +Q.post,Pa,fb)}catch(qf){c(qf,va(aa))}K.terminal&&(v.terminal=!0,x=Math.max(x,K.priority))}v.scope=P&&!0===P.scope;v.transcludeOnThisElement=ca;v.elementTranscludeOnThisElement=H;v.templateOnThisElement=A;v.transclude=Aa;r.hasElementTranscludeDirective=H;return v}function y(a){for(var b=0,c=a.length;bq.priority)&&-1!=q.restrict.indexOf(f)){if(l){var w={$$start:l,$$end:k};q=z(Object.create(q),w)}b.push(q);h=q}}catch(O){c(O)}}return h}function A(b){if(d.hasOwnProperty(b))for(var c=a.get(b+"Directive"),e=0,f=c.length;e"+b+"";return c.childNodes[0].childNodes;default:return b}}function R(a,b){if("srcdoc"==b)return L.HTML;var c=ua(a);if("xlinkHref"==b||"form"==c&&"action"==b||"img"!=c&&("src"==b||"ngSrc"==b))return L.RESOURCE_URL}function Pa(a,c,d,e,f){var h=R(a,e);f=g[e]||f;var k=b(d,!0, +h,f);if(k){if("multiple"===e&&"select"===ua(a))throw ja("selmulti",va(a));c.push({priority:100,compile:function(){return{pre:function(a,c,g){c=g.$$observers||(g.$$observers={});if(l.test(e))throw ja("nodomevents");var n=g[e];n!==d&&(k=n&&b(n,!0,h,f),d=n);k&&(g[e]=k(a),(c[e]||(c[e]=[])).$$inter=!0,(g.$$observers&&g.$$observers[e].$$scope||a).$watch(k,function(a,b){"class"===e&&a!=b?g.$updateClass(a,b):g.$set(e,a)}))}}}})}}function V(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g< +h;g++)if(a[g]==d){a[g++]=c;h=g+e-1;for(var l=a.length;g=a)return b;for(;a--;)8===b[a].nodeType&&rf.call(b,a,1);return b}function Fe(){var b={},a=!1,c=/^(\S+)(\s+as\s+(\w+))?$/;this.register=function(a,c){Ma(a,"controller");I(a)?z(b,a):b[a]=c};this.allowGlobals=function(){a=!0};this.$get=["$injector","$window",function(d,e){function f(a,b,c,d){if(!a||!I(a.$scope))throw T("$controller")("noscp",d,b);a.$scope[b]=c}return function(g,h, +l,k){var m,n,q;l=!0===l;k&&F(k)&&(q=k);F(g)&&(k=g.match(c),n=k[1],q=q||k[3],g=b.hasOwnProperty(n)?b[n]:vc(h.$scope,n,!0)||(a?vc(e,n,!0):t),sb(g,n,!0));if(l)return l=(D(g)?g[g.length-1]:g).prototype,m=Object.create(l||null),q&&f(h,q,m,n||g.name),z(function(){d.invoke(g,m,h,n);return m},{instance:m,identifier:q});m=d.instantiate(g,h,n);q&&f(h,q,m,n||g.name);return m}}]}function Ge(){this.$get=["$window",function(b){return B(b.document)}]}function He(){this.$get=["$log",function(b){return function(a, +c){b.error.apply(b,arguments)}}]}function Yb(b,a){if(F(b)){var c=b.replace(sf,"").trim();if(c){var d=a("Content-Type");(d=d&&0===d.indexOf(Vc))||(d=(d=c.match(tf))&&uf[d[0]].test(c));d&&(b=oc(c))}}return b}function Wc(b){var a=ha(),c,d,e;if(!b)return a;s(b.split("\n"),function(b){e=b.indexOf(":");c=Q(U(b.substr(0,e)));d=U(b.substr(e+1));c&&(a[c]=a[c]?a[c]+", "+d:d)});return a}function Xc(b){var a=I(b)?b:t;return function(c){a||(a=Wc(b));return c?(c=a[Q(c)],void 0===c&&(c=null),c):a}}function Yc(b, +a,c,d){if(G(d))return d(b,a,c);s(d,function(d){b=d(b,a,c)});return b}function Ke(){var b=this.defaults={transformResponse:[Yb],transformRequest:[function(a){return I(a)&&"[object File]"!==Da.call(a)&&"[object Blob]"!==Da.call(a)&&"[object FormData]"!==Da.call(a)?$a(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ra(Zb),put:ra(Zb),patch:ra(Zb)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"},a=!1;this.useApplyAsync=function(b){return y(b)?(a=!!b,this):a};var c=this.interceptors= +[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(d,e,f,g,h,l){function k(a){function c(a){var b=z({},a);b.data=a.data?Yc(a.data,a.headers,a.status,e.transformResponse):a.data;a=a.status;return 200<=a&&300>a?b:h.reject(b)}function d(a){var b,c={};s(a,function(a,d){G(a)?(b=a(),null!=b&&(c[d]=b)):c[d]=a});return c}if(!ga.isObject(a))throw T("$http")("badreq",a);var e=z({method:"get",transformRequest:b.transformRequest,transformResponse:b.transformResponse}, +a);e.headers=function(a){var c=b.headers,e=z({},a.headers),f,g,c=z({},c.common,c[Q(a.method)]);a:for(f in c){a=Q(f);for(g in e)if(Q(g)===a)continue a;e[f]=c[f]}return d(e)}(a);e.method=ub(e.method);var f=[function(a){var d=a.headers,e=Yc(a.data,Xc(d),t,a.transformRequest);A(e)&&s(d,function(a,b){"content-type"===Q(b)&&delete d[b]});A(a.withCredentials)&&!A(b.withCredentials)&&(a.withCredentials=b.withCredentials);return m(a,e).then(c,c)},t],g=h.when(e);for(s(u,function(a){(a.request||a.requestError)&& +f.unshift(a.request,a.requestError);(a.response||a.responseError)&&f.push(a.response,a.responseError)});f.length;){a=f.shift();var l=f.shift(),g=g.then(a,l)}g.success=function(a){g.then(function(b){a(b.data,b.status,b.headers,e)});return g};g.error=function(a){g.then(null,function(b){a(b.data,b.status,b.headers,e)});return g};return g}function m(c,f){function l(b,c,d,e){function f(){m(c,b,d,e)}P&&(200<=b&&300>b?P.put(X,[b,c,Wc(d),e]):P.remove(X));a?g.$applyAsync(f):(f(),g.$$phase||g.$apply())}function m(a, +b,d,e){b=Math.max(b,0);(200<=b&&300>b?C.resolve:C.reject)({data:a,status:b,headers:Xc(d),config:c,statusText:e})}function w(a){m(a.data,a.status,ra(a.headers()),a.statusText)}function u(){var a=k.pendingRequests.indexOf(c);-1!==a&&k.pendingRequests.splice(a,1)}var C=h.defer(),x=C.promise,P,E,s=c.headers,X=n(c.url,c.params);k.pendingRequests.push(c);x.then(u,u);!c.cache&&!b.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(P=I(c.cache)?c.cache:I(b.cache)?b.cache:q);P&&(E=P.get(X),y(E)?E&& +G(E.then)?E.then(w,w):D(E)?m(E[1],E[0],ra(E[2]),E[3]):m(E,200,{},"OK"):P.put(X,x));A(E)&&((E=Zc(c.url)?e.cookies()[c.xsrfCookieName||b.xsrfCookieName]:t)&&(s[c.xsrfHeaderName||b.xsrfHeaderName]=E),d(c.method,X,f,l,s,c.timeout,c.withCredentials,c.responseType));return x}function n(a,b){if(!b)return a;var c=[];Ed(b,function(a,b){null===a||A(a)||(D(a)||(a=[a]),s(a,function(a){I(a)&&(a=qa(a)?a.toISOString():$a(a));c.push(Fa(b)+"="+Fa(a))}))});0=l&&(r.resolve(q),n(O.$$intervalId),delete f[O.$$intervalId]);u||b.$apply()},h);f[O.$$intervalId]=r;return O}var f={};e.cancel=function(b){return b&&b.$$intervalId in f?(f[b.$$intervalId].reject("canceled"),a.clearInterval(b.$$intervalId),delete f[b.$$intervalId],!0):!1};return e}]}function Rd(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3, +lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a", +fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function ac(b){b=b.split("/");for(var a=b.length;a--;)b[a]=qb(b[a]);return b.join("/")}function $c(b,a){var c=Ba(b);a.$$protocol=c.protocol;a.$$host=c.hostname;a.$$port=ba(c.port)||xf[c.protocol]||null}function ad(b,a){var c="/"!==b.charAt(0);c&&(b="/"+b);var d=Ba(b);a.$$path=decodeURIComponent(c&&"/"===d.pathname.charAt(0)? +d.pathname.substring(1):d.pathname);a.$$search=qc(d.search);a.$$hash=decodeURIComponent(d.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function za(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function Ha(b){var a=b.indexOf("#");return-1==a?b:b.substr(0,a)}function bd(b){return b.replace(/(#.+)|#$/,"$1")}function bc(b){return b.substr(0,Ha(b).lastIndexOf("/")+1)}function cc(b,a){this.$$html5=!0;a=a||"";var c=bc(b);$c(b,this);this.$$parse=function(a){var b=za(c,a);if(!F(b))throw Fb("ipthprfx", +a,c);ad(b,this);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Nb(this.$$search),b=this.$$hash?"#"+qb(this.$$hash):"";this.$$url=ac(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$parseLinkUrl=function(d,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;(f=za(b,d))!==t?(g=f,g=(f=za(a,f))!==t?c+(za("/",f)||f):b+g):(f=za(c,d))!==t?g=c+f:c==d+"/"&&(g=c);g&&this.$$parse(g);return!!g}}function dc(b,a){var c=bc(b);$c(b,this);this.$$parse= +function(d){d=za(b,d)||za(c,d);var e;"#"===d.charAt(0)?(e=za(a,d),A(e)&&(e=d)):e=this.$$html5?d:"";ad(e,this);d=this.$$path;var f=/^\/[A-Z]:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));f.exec(e)||(d=(e=f.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Nb(this.$$search),e=this.$$hash?"#"+qb(this.$$hash):"";this.$$url=ac(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$parseLinkUrl=function(a,c){return Ha(b)==Ha(a)?(this.$$parse(a),!0): +!1}}function cd(b,a){this.$$html5=!0;dc.apply(this,arguments);var c=bc(b);this.$$parseLinkUrl=function(d,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;b==Ha(d)?f=d:(g=za(c,d))?f=b+a+g:c===d+"/"&&(f=c);f&&this.$$parse(f);return!!f};this.$$compose=function(){var c=Nb(this.$$search),e=this.$$hash?"#"+qb(this.$$hash):"";this.$$url=ac(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+a+this.$$url}}function Gb(b){return function(){return this[b]}}function dd(b,a){return function(c){if(A(c))return this[b]; +this[b]=a(c);this.$$compose();return this}}function Me(){var b="",a={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(a){return y(a)?(b=a,this):b};this.html5Mode=function(b){return Wa(b)?(a.enabled=b,this):I(b)?(Wa(b.enabled)&&(a.enabled=b.enabled),Wa(b.requireBase)&&(a.requireBase=b.requireBase),Wa(b.rewriteLinks)&&(a.rewriteLinks=b.rewriteLinks),this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(c,d,e,f,g){function h(a,b,c){var e=k.url(), +f=k.$$state;try{d.url(a,b,c),k.$$state=d.state()}catch(g){throw k.url(e),k.$$state=f,g;}}function l(a,b){c.$broadcast("$locationChangeSuccess",k.absUrl(),a,k.$$state,b)}var k,m;m=d.baseHref();var n=d.url(),q;if(a.enabled){if(!m&&a.requireBase)throw Fb("nobase");q=n.substring(0,n.indexOf("/",n.indexOf("//")+2))+(m||"/");m=e.history?cc:cd}else q=Ha(n),m=dc;k=new m(q,"#"+b);k.$$parseLinkUrl(n,n);k.$$state=d.state();var u=/^\s*(javascript|mailto):/i;f.on("click",function(b){if(a.rewriteLinks&&!b.ctrlKey&& +!b.metaKey&&!b.shiftKey&&2!=b.which&&2!=b.button){for(var e=B(b.target);"a"!==ua(e[0]);)if(e[0]===f[0]||!(e=e.parent())[0])return;var h=e.prop("href"),l=e.attr("href")||e.attr("xlink:href");I(h)&&"[object SVGAnimatedString]"===h.toString()&&(h=Ba(h.animVal).href);u.test(h)||!h||e.attr("target")||b.isDefaultPrevented()||!k.$$parseLinkUrl(h,l)||(b.preventDefault(),k.absUrl()!=d.url()&&(c.$apply(),g.angular["ff-684208-preventDefault"]=!0))}});k.absUrl()!=n&&d.url(k.absUrl(),!0);var r=!0;d.onUrlChange(function(a, +b){c.$evalAsync(function(){var d=k.absUrl(),e=k.$$state,f;k.$$parse(a);k.$$state=b;f=c.$broadcast("$locationChangeStart",a,d,b,e).defaultPrevented;k.absUrl()===a&&(f?(k.$$parse(d),k.$$state=e,h(d,!1,e)):(r=!1,l(d,e)))});c.$$phase||c.$digest()});c.$watch(function(){var a=bd(d.url()),b=bd(k.absUrl()),f=d.state(),g=k.$$replace,q=a!==b||k.$$html5&&e.history&&f!==k.$$state;if(r||q)r=!1,c.$evalAsync(function(){var b=k.absUrl(),d=c.$broadcast("$locationChangeStart",b,a,k.$$state,f).defaultPrevented;k.absUrl()=== +b&&(d?(k.$$parse(a),k.$$state=f):(q&&h(b,g,f===k.$$state?null:k.$$state),l(a,f)))});k.$$replace=!1});return k}]}function Ne(){var b=!0,a=this;this.debugEnabled=function(a){return y(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||H;a=!1;try{a=!!e.apply}catch(l){}return a? +function(){var a=[];s(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function ta(b,a){if("__defineGetter__"===b||"__defineSetter__"===b||"__lookupGetter__"===b||"__lookupSetter__"===b||"__proto__"===b)throw la("isecfld",a);return b}function ma(b,a){if(b){if(b.constructor===b)throw la("isecfn",a);if(b.window=== +b)throw la("isecwindow",a);if(b.children&&(b.nodeName||b.prop&&b.attr&&b.find))throw la("isecdom",a);if(b===Object)throw la("isecobj",a);}return b}function ec(b){return b.constant}function gb(b,a,c,d,e){ma(b,e);ma(a,e);c=c.split(".");for(var f,g=0;1h?ed(g[0],g[1],g[2],g[3],g[4],c,d):function(a,b){var e=0,f;do f=ed(g[e++],g[e++],g[e++],g[e++],g[e++],c,d)(a,b),b=t,a=f;while(e=this.promise.$$state.status&&d&&d.length&&b(function(){for(var b,e,f=0,g=d.length;fa)for(b in k++,f)e.hasOwnProperty(b)||(u--,delete f[b])}else f!==e&&(f=e,k++);return k}}c.$stateful=!0;var d=this,e,f,h,l=1s&&(y=4-s,W[y]||(W[y]=[]),W[y].push({msg:G(e.exp)?"fn: "+(e.exp.name||e.exp.toString()):e.exp,newVal:g,oldVal:l}));else if(e===c){v=!1;break a}}catch(A){f(A)}if(!(m=t.$$childHead||t!==this&&t.$$nextSibling))for(;t!==this&&!(m=t.$$nextSibling);)t=t.$parent}while(t=m);if((v||O.length)&&!s--)throw r.$$phase=null,a("infdig",b,W);}while(v||O.length);for(r.$$phase=null;p.length;)try{p.shift()()}catch(ca){f(ca)}},$destroy:function(){if(!this.$$destroyed){var a= +this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;if(this!==r){for(var b in this.$$listenerCount)m(this,this.$$listenerCount[b],b);a.$$childHead==this&&(a.$$childHead=this.$$nextSibling);a.$$childTail==this&&(a.$$childTail=this.$$prevSibling);this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=H;this.$on=this.$watch=this.$watchGroup= +function(){return H};this.$$listeners={};this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=this.$$watchers=null}}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a,b){r.$$phase||O.length||h.defer(function(){O.length&&r.$digest()});O.push({scope:this,expression:a,locals:b})},$$postDigest:function(a){p.push(a)},$apply:function(a){try{return k("$apply"),this.$eval(a)}catch(b){f(b)}finally{r.$$phase=null;try{r.$digest()}catch(c){throw f(c),c; +}}},$applyAsync:function(a){function b(){c.$eval(a)}var c=this;a&&v.push(b);u()},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){var d=c.indexOf(b);-1!==d&&(c[d]=null,m(e,1,a))}},$emit:function(a,b){var c=[],d,e=this,g=!1,h={name:a,targetScope:e,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1}, +l=Ya([h],arguments,1),k,m;do{d=e.$$listeners[a]||c;h.currentScope=e;k=0;for(m=d.length;kRa)throw Ca("iequirks");var d=ra(na);d.isEnabled=function(){return b};d.trustAs=c.trustAs;d.getTrusted=c.getTrusted;d.valueOf=c.valueOf;b||(d.trustAs=d.getTrusted=function(a,b){return b},d.valueOf=pa);d.parseAs=function(b,c){var e=a(c);return e.literal&&e.constant?e:a(c,function(a){return d.getTrusted(b,a)})};var e=d.parseAs,f=d.getTrusted,g=d.trustAs;s(na,function(a,b){var c=Q(b);d[cb("parse_as_"+c)]=function(b){return e(a,b)};d[cb("get_trusted_"+c)]=function(b){return f(a,b)};d[cb("trust_as_"+ +c)]=function(b){return g(a,b)}});return d}]}function Ue(){this.$get=["$window","$document",function(b,a){var c={},d=ba((/android (\d+)/.exec(Q((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||{}).userAgent),f=a[0]||{},g,h=/^(Moz|webkit|ms)(?=[A-Z])/,l=f.body&&f.body.style,k=!1,m=!1;if(l){for(var n in l)if(k=h.exec(n)){g=k[0];g=g.substr(0,1).toUpperCase()+g.substr(1);break}g||(g="WebkitOpacity"in l&&"webkit");k=!!("transition"in l||g+"Transition"in l);m=!!("animation"in l||g+"Animation"in +l);!d||k&&m||(k=F(f.body.style.webkitTransition),m=F(f.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hasEvent:function(a){if("input"===a&&11>=Ra)return!1;if(A(c[a])){var b=f.createElement("div");c[a]="on"+a in b}return c[a]},csp:ab(),vendorPrefix:g,transitions:k,animations:m,android:d}}]}function We(){this.$get=["$templateCache","$http","$q",function(b,a,c){function d(e,f){d.totalPendingRequests++;var g=a.defaults&&a.defaults.transformResponse;D(g)?g=g.filter(function(a){return a!== +Yb}):g===Yb&&(g=null);return a.get(e,{cache:b,transformResponse:g}).finally(function(){d.totalPendingRequests--}).then(function(a){return a.data},function(a){if(!f)throw ja("tpload",e);return c.reject(a)})}d.totalPendingRequests=0;return d}]}function Xe(){this.$get=["$rootScope","$browser","$location",function(b,a,c){return{findBindings:function(a,b,c){a=a.getElementsByClassName("ng-binding");var g=[];s(a,function(a){var d=ga.element(a).data("$binding");d&&s(d,function(d){c?(new RegExp("(^|\\s)"+ +gd(b)+"(\\s|\\||$)")).test(d)&&g.push(a):-1!=d.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,c){for(var g=["ng-","data-ng-","ng\\:"],h=0;hb;b=Math.abs(b);var g=b+"",h="",l=[],k=!1;if(-1!==g.indexOf("e")){var m=g.match(/([\d\.]+)e(-?)(\d+)/);m&& +"-"==m[2]&&m[3]>e+1?b=0:(h=g,k=!0)}if(k)0b&&(h=b.toFixed(e),b=parseFloat(h));else{g=(g.split(od)[1]||"").length;A(e)&&(e=Math.min(Math.max(a.minFrac,g),a.maxFrac));b=+(Math.round(+(b.toString()+"e"+e)).toString()+"e"+-e);var g=(""+b).split(od),k=g[0],g=g[1]||"",n=0,q=a.lgSize,u=a.gSize;if(k.length>=q+u)for(n=k.length-q,m=0;mb&&(d="-",b=-b);for(b=""+b;b.length-c)e+=c;0===e&&-12==c&&(e=12);return Hb(e,a,d)}}function Ib(b,a){return function(c,d){var e=c["get"+b](),f=ub(a?"SHORT"+b:b);return d[f][e]}}function pd(b){var a=(new Date(b,0,1)).getDay();return new Date(b,0,(4>=a?5:12)-a)}function qd(b){return function(a){var c= +pd(a.getFullYear());a=+new Date(a.getFullYear(),a.getMonth(),a.getDate()+(4-a.getDay()))-+c;a=1+Math.round(a/6048E5);return Hb(a,b)}}function kd(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var f=0,g=0,h=b[8]?a.setUTCFullYear:a.setFullYear,l=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=ba(b[9]+b[10]),g=ba(b[9]+b[11]));h.call(a,ba(b[1]),ba(b[2])-1,ba(b[3]));f=ba(b[4]||0)-f;g=ba(b[5]||0)-g;h=ba(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));l.call(a,f,g,h,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; +return function(c,e,f){var g="",h=[],l,k;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;F(c)&&(c=Kf.test(c)?ba(c):a(c));V(c)&&(c=new Date(c));if(!qa(c))return c;for(;e;)(k=Lf.exec(e))?(h=Ya(h,k,1),e=h.pop()):(h.push(e),e=null);f&&"UTC"===f&&(c=new Date(c.getTime()),c.setMinutes(c.getMinutes()+c.getTimezoneOffset()));s(h,function(a){l=Mf[a];g+=l?l(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Ff(){return function(b,a){A(a)&&(a=2);return $a(b,a)}}function Gf(){return function(b, +a){V(b)&&(b=b.toString());return D(b)||F(b)?(a=Infinity===Math.abs(Number(a))?Number(a):ba(a))?0b||37<=b&&40>=b||m(a,this,this.value)});if(e.hasEvent("paste"))a.on("paste cut",m)}a.on("change",l);d.$render=function(){a.val(d.$isEmpty(d.$viewValue)?"":d.$viewValue)}}function Lb(b,a){return function(c,d){var e,f;if(qa(c))return c;if(F(c)){'"'==c.charAt(0)&&'"'==c.charAt(c.length-1)&&(c=c.substring(1,c.length-1));if(Nf.test(c))return new Date(c);b.lastIndex= +0;if(e=b.exec(c))return e.shift(),f=d?{yyyy:d.getFullYear(),MM:d.getMonth()+1,dd:d.getDate(),HH:d.getHours(),mm:d.getMinutes(),ss:d.getSeconds(),sss:d.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},s(e,function(b,c){c=s}; +g.$observe("min",function(a){s=q(a);h.$validate()})}if(y(g.max)||g.ngMax){var p;h.$validators.max=function(a){return!n(a)||A(p)||c(a)<=p};g.$observe("max",function(a){p=q(a);h.$validate()})}}}function td(b,a,c,d){(d.$$hasNativeValidators=I(a[0].validity))&&d.$parsers.push(function(b){var c=a.prop("validity")||{};return c.badInput&&!c.typeMismatch?t:b})}function ud(b,a,c,d,e){if(y(d)){b=b(d);if(!b.constant)throw T("ngModel")("constexpr",c,d);return b(a)}return e}function ic(b,a){b="ngClass"+b;return["$animate", +function(c){function d(a,b){var c=[],d=0;a:for(;d(?:<\/\1>|)$/,Rb=/<|&#?\w+;/,ef=/<([\w:]+)/,ff=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ia={option:[1,'"],thead:[1,"","
"],col:[2,"", +"
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ia.optgroup=ia.option;ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead;ia.th=ia.td;var La=R.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===Y.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),R(M).on("load",a))},toString:function(){var b=[];s(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<= +b?B(this[b]):B(this[this.length+b])},length:0,push:Pf,sort:[].sort,splice:[].splice},Eb={};s("multiple selected checked disabled readOnly required open".split(" "),function(b){Eb[Q(b)]=b});var Mc={};s("input select option textarea button form details".split(" "),function(b){Mc[b]=!0});var Nc={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern"};s({data:Ub,removeData:xb},function(b,a){R[a]=b});s({data:Ub,inheritedData:Db,scope:function(b){return B.data(b,"$scope")|| +Db(b.parentNode||b,["$isolateScope","$scope"])},isolateScope:function(b){return B.data(b,"$isolateScope")||B.data(b,"$isolateScopeNoTemplate")},controller:Ic,injector:function(b){return Db(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Ab,css:function(b,a,c){a=cb(a);if(y(c))b.style[a]=c;else return b.style[a]},attr:function(b,a,c){var d=Q(a);if(Eb[d])if(y(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||H).specified? +d:t;else if(y(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?t:b},prop:function(b,a,c){if(y(c))b[a]=c;else return b[a]},text:function(){function b(a,b){if(A(b)){var d=a.nodeType;return d===oa||d===pb?a.textContent:""}a.textContent=b}b.$dv="";return b}(),val:function(b,a){if(A(a)){if(b.multiple&&"select"===ua(b)){var c=[];s(b.options,function(a){a.selected&&c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(A(a))return b.innerHTML; +wb(b,!0);b.innerHTML=a},empty:Jc},function(b,a){R.prototype[a]=function(a,d){var e,f,g=this.length;if(b!==Jc&&(2==b.length&&b!==Ab&&b!==Ic?a:d)===t){if(I(a)){for(e=0;e":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a, +c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"!":function(a,c,d){return!d(a,c)},"=":!0,"|":!0}),Xf={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},gc=function(a){this.options=a};gc.prototype={constructor:gc,lex:function(a){this.text=a;this.index=0;for(this.tokens=[];this.index=a&&"string"===typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=d||this.index;c=y(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c, +d)+"]":" "+d;throw la("lexerr",a,c,this.text);},readNumber:function(){for(var a="",c=this.index;this.indexa){a=this.tokens[a];var g=a.text;if(g===c||g===d||g===e||g===f||!(c||d||e||f))return a}return!1},expect:function(a,c,d,e){return(a=this.peek(a,c,d,e))?(this.tokens.shift(),a):!1},consume:function(a){if(0===this.tokens.length)throw la("ueoe",this.text);var c=this.expect(a);c||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return c},unaryFn:function(a,c){var d=mb[a];return z(function(a,f){return d(a,f,c)},{constant:c.constant,inputs:[c]})},binaryFn:function(a, +c,d,e){var f=mb[c];return z(function(c,e){return f(c,e,a,d)},{constant:a.constant&&d.constant,inputs:!e&&[a,d]})},identifier:function(){for(var a=this.consume().text;this.peek(".")&&this.peekAhead(1).identifier&&!this.peekAhead(2,"(");)a+=this.consume().text+this.consume().text;return zf(a,this.options,this.text)},constant:function(){var a=this.consume().value;return z(function(){return a},{constant:!0,literal:!0})},statements:function(){for(var a=[];;)if(0","<=",">=");)a=this.binaryFn(a,c.text,this.additive());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.text,this.multiplicative());return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*","/","%");)a=this.binaryFn(a,c.text,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(hb.ZERO, +a.text,this.unary()):(a=this.expect("!"))?this.unaryFn(a.text,this.unary()):this.primary()},fieldAccess:function(a){var c=this.identifier();return z(function(d,e,f){d=f||a(d,e);return null==d?t:c(d)},{assign:function(d,e,f){var g=a(d,f);g||a.assign(d,g={},f);return c.assign(g,e)}})},objectIndex:function(a){var c=this.text,d=this.expression();this.consume("]");return z(function(e,f){var g=a(e,f),h=d(e,f);ta(h,c);return g?ma(g[h],c):t},{assign:function(e,f,g){var h=ta(d(e,g),c),l=ma(a(e,g),c);l||a.assign(e, +l={},g);return l[h]=f}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this.text,f=d.length?[]:null;return function(g,h){var l=c?c(g,h):y(c)?t:g,k=a(g,h,l)||H;if(f)for(var m=d.length;m--;)f[m]=ma(d[m](g,h),e);ma(l,e);if(k){if(k.constructor===k)throw la("isecfn",e);if(k===Uf||k===Vf||k===Wf)throw la("isecff",e);}l=k.apply?k.apply(l,f):k(f[0],f[1],f[2],f[3],f[4]);return ma(l,e)}},arrayDeclaration:function(){var a= +[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]");return z(function(c,d){for(var e=[],f=0,g=a.length;fa.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();return a=(0<=a?"+":"")+(Hb(Math[0=h};d.$observe("min",function(a){y(a)&& +!V(a)&&(a=parseFloat(a,10));h=V(a)&&!isNaN(a)?a:t;e.$validate()})}if(d.max||d.ngMax){var l;e.$validators.max=function(a){return e.$isEmpty(a)||A(l)||a<=l};d.$observe("max",function(a){y(a)&&!V(a)&&(a=parseFloat(a,10));l=V(a)&&!isNaN(a)?a:t;e.$validate()})}},url:function(a,c,d,e,f,g){ib(a,c,d,e,f,g);hc(e);e.$$parserName="url";e.$validators.url=function(a,c){var d=a||c;return e.$isEmpty(d)||Yf.test(d)}},email:function(a,c,d,e,f,g){ib(a,c,d,e,f,g);hc(e);e.$$parserName="email";e.$validators.email=function(a, +c){var d=a||c;return e.$isEmpty(d)||Zf.test(d)}},radio:function(a,c,d,e){A(d.name)&&c.attr("name",++nb);c.on("click",function(a){c[0].checked&&e.$setViewValue(d.value,a&&a.type)});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e,f,g,h,l){var k=ud(l,a,"ngTrueValue",d.ngTrueValue,!0),m=ud(l,a,"ngFalseValue",d.ngFalseValue,!1);c.on("click",function(a){e.$setViewValue(c[0].checked,a&&a.type)});e.$render=function(){c[0].checked=e.$viewValue}; +e.$isEmpty=function(a){return!1===a};e.$formatters.push(function(a){return fa(a,k)});e.$parsers.push(function(a){return a?k:m})},hidden:H,button:H,submit:H,reset:H,file:H},xc=["$browser","$sniffer","$filter","$parse",function(a,c,d,e){return{restrict:"E",require:["?ngModel"],link:{pre:function(f,g,h,l){l[0]&&(Dd[Q(h.type)]||Dd.text)(f,g,h,l[0],c,a,d,e)}}}}],ag=/^(true|false|\d+)$/,ye=function(){return{restrict:"A",priority:100,compile:function(a,c){return ag.test(c.ngValue)?function(a,c,f){f.$set("value", +a.$eval(f.ngValue))}:function(a,c,f){a.$watch(f.ngValue,function(a){f.$set("value",a)})}}}},Zd=["$compile",function(a){return{restrict:"AC",compile:function(c){a.$$addBindingClass(c);return function(c,e,f){a.$$addBindingInfo(e,f.ngBind);e=e[0];c.$watch(f.ngBind,function(a){e.textContent=a===t?"":a})}}}}],ae=["$interpolate","$compile",function(a,c){return{compile:function(d){c.$$addBindingClass(d);return function(d,f,g){d=a(f.attr(g.$attr.ngBindTemplate));c.$$addBindingInfo(f,d.expressions);f=f[0]; +g.$observe("ngBindTemplate",function(a){f.textContent=a===t?"":a})}}}}],$d=["$sce","$parse","$compile",function(a,c,d){return{restrict:"A",compile:function(e,f){var g=c(f.ngBindHtml),h=c(f.ngBindHtml,function(a){return(a||"").toString()});d.$$addBindingClass(e);return function(c,e,f){d.$$addBindingInfo(e,f.ngBindHtml);c.$watch(h,function(){e.html(a.getTrustedHtml(g(c))||"")})}}}}],xe=da({restrict:"A",require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}), +be=ic("",!0),de=ic("Odd",0),ce=ic("Even",1),ee=Ja({compile:function(a,c){c.$set("ngCloak",t);a.removeClass("ng-cloak")}}),fe=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Cc={},bg={blur:!0,focus:!0};s("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var c=ya("ng-"+a);Cc[c]=["$parse","$rootScope",function(d,e){return{restrict:"A",compile:function(f,g){var h= +d(g[c],null,!0);return function(c,d){d.on(a,function(d){var f=function(){h(c,{$event:d})};bg[a]&&e.$$phase?c.$evalAsync(f):c.$apply(f)})}}}}]});var ie=["$animate",function(a){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,f,g){var h,l,k;c.$watch(e.ngIf,function(c){c?l||g(function(c,f){l=f;c[c.length++]=Y.createComment(" end ngIf: "+e.ngIf+" ");h={clone:c};a.enter(c,d.parent(),d)}):(k&&(k.remove(),k=null),l&&(l.$destroy(),l=null),h&&(k= +tb(h.clone),a.leave(k).then(function(){k=null}),h=null))})}}}],je=["$templateRequest","$anchorScroll","$animate","$sce",function(a,c,d,e){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:ga.noop,compile:function(f,g){var h=g.ngInclude||g.src,l=g.onload||"",k=g.autoscroll;return function(f,g,q,s,r){var t=0,p,v,w,L=function(){v&&(v.remove(),v=null);p&&(p.$destroy(),p=null);w&&(d.leave(w).then(function(){v=null}),v=w,w=null)};f.$watch(e.parseAsResourceUrl(h),function(e){var h= +function(){!y(k)||k&&!f.$eval(k)||c()},q=++t;e?(a(e,!0).then(function(a){if(q===t){var c=f.$new();s.template=a;a=r(c,function(a){L();d.enter(a,null,g).then(h)});p=c;w=a;p.$emit("$includeContentLoaded",e);f.$eval(l)}},function(){q===t&&(L(),f.$emit("$includeContentError",e))}),f.$emit("$includeContentRequested",e)):(L(),s.template=null)})}}}}],Ae=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(c,d,e,f){/SVG/.test(d[0].toString())?(d.empty(),a(Fc(f.template, +Y).childNodes)(c,function(a){d.append(a)},{futureParentElement:d})):(d.html(f.template),a(d.contents())(c))}}}],ke=Ja({priority:450,compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),we=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,c,d,e){var f=c.attr(d.$attr.ngList)||", ",g="false"!==d.ngTrim,h=g?U(f):f;e.$parsers.push(function(a){if(!A(a)){var c=[];a&&s(a.split(h),function(a){a&&c.push(g?U(a):a)});return c}});e.$formatters.push(function(a){return D(a)? +a.join(f):t});e.$isEmpty=function(a){return!a||!a.length}}}},kb="ng-valid",vd="ng-invalid",Sa="ng-pristine",Kb="ng-dirty",xd="ng-pending",Mb=new T("ngModel"),cg=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(a,c,d,e,f,g,h,l,k,m){this.$modelValue=this.$viewValue=Number.NaN;this.$$rawModelValue=t;this.$validators={};this.$asyncValidators={};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$untouched=!0; +this.$touched=!1;this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending=t;this.$name=m(d.name||"",!1)(a);var n=f(d.ngModel),q=n.assign,u=n,r=q,O=null,p=this;this.$$setOptions=function(a){if((p.$options=a)&&a.getterSetter){var c=f(d.ngModel+"()"),g=f(d.ngModel+"($$$p)");u=function(a){var d=n(a);G(d)&&(d=c(a));return d};r=function(a,c){G(n(a))?g(a,{$$$p:p.$modelValue}):q(a,p.$modelValue)}}else if(!n.assign)throw Mb("nonassign",d.ngModel,va(e)); +};this.$render=H;this.$isEmpty=function(a){return A(a)||""===a||null===a||a!==a};var v=e.inheritedData("$formController")||Jb,w=0;sd({ctrl:this,$element:e,set:function(a,c){a[c]=!0},unset:function(a,c){delete a[c]},parentForm:v,$animate:g});this.$setPristine=function(){p.$dirty=!1;p.$pristine=!0;g.removeClass(e,Kb);g.addClass(e,Sa)};this.$setDirty=function(){p.$dirty=!0;p.$pristine=!1;g.removeClass(e,Sa);g.addClass(e,Kb);v.$setDirty()};this.$setUntouched=function(){p.$touched=!1;p.$untouched=!0;g.setClass(e, +"ng-untouched","ng-touched")};this.$setTouched=function(){p.$touched=!0;p.$untouched=!1;g.setClass(e,"ng-touched","ng-untouched")};this.$rollbackViewValue=function(){h.cancel(O);p.$viewValue=p.$$lastCommittedViewValue;p.$render()};this.$validate=function(){if(!V(p.$modelValue)||!isNaN(p.$modelValue)){var a=p.$$rawModelValue,c=p.$valid,d=p.$modelValue,e=p.$options&&p.$options.allowInvalid;p.$$runValidators(p.$error[p.$$parserName||"parse"]?!1:t,a,p.$$lastCommittedViewValue,function(f){e||c===f||(p.$modelValue= +f?a:t,p.$modelValue!==d&&p.$$writeModelToScope())})}};this.$$runValidators=function(a,c,d,e){function f(){var a=!0;s(p.$validators,function(e,f){var g=e(c,d);a=a&&g;h(f,g)});return a?!0:(s(p.$asyncValidators,function(a,c){h(c,null)}),!1)}function g(){var a=[],e=!0;s(p.$asyncValidators,function(f,g){var l=f(c,d);if(!l||!G(l.then))throw Mb("$asyncValidators",l);h(g,t);a.push(l.then(function(){h(g,!0)},function(a){e=!1;h(g,!1)}))});a.length?k.all(a).then(function(){l(e)},H):l(!0)}function h(a,c){m=== +w&&p.$setValidity(a,c)}function l(a){m===w&&e(a)}w++;var m=w;(function(a){var c=p.$$parserName||"parse";if(a===t)h(c,null);else if(h(c,a),!a)return s(p.$validators,function(a,c){h(c,null)}),s(p.$asyncValidators,function(a,c){h(c,null)}),!1;return!0})(a)?f()?g():l(!1):l(!1)};this.$commitViewValue=function(){var a=p.$viewValue;h.cancel(O);if(p.$$lastCommittedViewValue!==a||""===a&&p.$$hasNativeValidators)p.$$lastCommittedViewValue=a,p.$pristine&&this.$setDirty(),this.$$parseAndValidate()};this.$$parseAndValidate= +function(){var c=p.$$lastCommittedViewValue,d=A(c)?t:!0;if(d)for(var e=0;eF;)d=r.pop(),m(N,d.label,!1),d.element.remove()}for(;R.length>x;){l=R.pop();for(F=1;Fa&&q.removeOption(c)})}var n;if(!(n=r.match(d)))throw eg("iexp", +r,va(f));var C=c(n[2]||n[1]),x=n[4]||n[6],A=/ as /.test(n[0])&&n[1],B=A?c(A):null,G=n[5],I=c(n[3]||""),F=c(n[2]?n[1]:x),P=c(n[7]),M=n[8]?c(n[8]):null,Q={},R=[[{element:f,label:""}]],T={};z&&(a(z)(e),z.removeClass("ng-scope"),z.remove());f.empty();f.on("change",function(){e.$apply(function(){var a=P(e)||[],c;if(u)c=[],s(f.val(),function(d){d=M?Q[d]:d;c.push("?"===d?t:""===d?null:h(B?B:F,d,a[d]))});else{var d=M?Q[f.val()]:f.val();c="?"===d?t:""===d?null:h(B?B:F,d,a[d])}g.$setViewValue(c);p()})});g.$render= +p;e.$watchCollection(P,l);e.$watchCollection(function(){var a=P(e),c;if(a&&D(a)){c=Array(a.length);for(var d=0,f=a.length;df||e.$isEmpty(a)||c.length<=f}}}}},Ac=function(){return{restrict:"A",require:"?ngModel",link:function(a,c, +d,e){if(e){var f=0;d.$observe("minlength",function(a){f=ba(a)||0;e.$validate()});e.$validators.minlength=function(a,c){return e.$isEmpty(c)||c.length>=f}}}}};M.angular.bootstrap?console.log("WARNING: Tried to load angular more than once."):(Nd(),Pd(ga),B(Y).ready(function(){Jd(Y,sc)}))})(window,document);!window.angular.$$csp()&&window.angular.element(document).find("head").prepend(''); +//# sourceMappingURL=angular.min.js.map diff --git a/js/cryptojs/components/mode-ecb-min.js b/js/cryptojs/components/mode-ecb-min.js new file mode 100755 index 0000000..b764073 --- /dev/null +++ b/js/cryptojs/components/mode-ecb-min.js @@ -0,0 +1,7 @@ +/* +CryptoJS v3.1.2 +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +CryptoJS.mode.ECB=function(){var a=CryptoJS.lib.BlockCipherMode.extend();a.Encryptor=a.extend({processBlock:function(a,b){this._cipher.encryptBlock(a,b)}});a.Decryptor=a.extend({processBlock:function(a,b){this._cipher.decryptBlock(a,b)}});return a}(); diff --git a/js/cryptojs/components/pad-zeropadding-min.js b/js/cryptojs/components/pad-zeropadding-min.js new file mode 100755 index 0000000..18f43ef --- /dev/null +++ b/js/cryptojs/components/pad-zeropadding-min.js @@ -0,0 +1,7 @@ +/* +CryptoJS v3.1.2 +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +CryptoJS.pad.ZeroPadding={pad:function(a,c){var b=4*c;a.clamp();a.sigBytes+=b-(a.sigBytes%b||b)},unpad:function(a){for(var c=a.words,b=a.sigBytes-1;!(c[b>>>2]>>>24-8*(b%4)&255);)b--;a.sigBytes=b+1}}; diff --git a/js/cryptojs/rollups/aes.js b/js/cryptojs/rollups/aes.js new file mode 100755 index 0000000..827503c --- /dev/null +++ b/js/cryptojs/rollups/aes.js @@ -0,0 +1,35 @@ +/* +CryptoJS v3.1.2 +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +var CryptoJS=CryptoJS||function(u,p){var d={},l=d.lib={},s=function(){},t=l.Base={extend:function(a){s.prototype=this;var c=new s;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, +r=l.WordArray=t.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=p?c:4*a.length},toString:function(a){return(a||v).stringify(this)},concat:function(a){var c=this.words,e=a.words,j=this.sigBytes;a=a.sigBytes;this.clamp();if(j%4)for(var k=0;k>>2]|=(e[k>>>2]>>>24-8*(k%4)&255)<<24-8*((j+k)%4);else if(65535>>2]=e[k>>>2];else c.push.apply(c,e);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< +32-8*(c%4);a.length=u.ceil(c/4)},clone:function(){var a=t.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],e=0;e>>2]>>>24-8*(j%4)&255;e.push((k>>>4).toString(16));e.push((k&15).toString(16))}return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j>>3]|=parseInt(a.substr(j, +2),16)<<24-4*(j%8);return new r.init(e,c/2)}},b=w.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var e=[],j=0;j>>2]>>>24-8*(j%4)&255));return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new r.init(e,c)}},x=w.Utf8={stringify:function(a){try{return decodeURIComponent(escape(b.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return b.parse(unescape(encodeURIComponent(a)))}}, +q=l.BufferedBlockAlgorithm=t.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=x.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,e=c.words,j=c.sigBytes,k=this.blockSize,b=j/(4*k),b=a?u.ceil(b):u.max((b|0)-this._minBufferSize,0);a=b*k;j=u.min(4*a,j);if(a){for(var q=0;q>>2]>>>24-8*(r%4)&255)<<16|(l[r+1>>>2]>>>24-8*((r+1)%4)&255)<<8|l[r+2>>>2]>>>24-8*((r+2)%4)&255,v=0;4>v&&r+0.75*v>>6*(3-v)&63));if(l=t.charAt(64))for(;d.length%4;)d.push(l);return d.join("")},parse:function(d){var l=d.length,s=this._map,t=s.charAt(64);t&&(t=d.indexOf(t),-1!=t&&(l=t));for(var t=[],r=0,w=0;w< +l;w++)if(w%4){var v=s.indexOf(d.charAt(w-1))<<2*(w%4),b=s.indexOf(d.charAt(w))>>>6-2*(w%4);t[r>>>2]|=(v|b)<<24-8*(r%4);r++}return p.create(t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); +(function(u){function p(b,n,a,c,e,j,k){b=b+(n&a|~n&c)+e+k;return(b<>>32-j)+n}function d(b,n,a,c,e,j,k){b=b+(n&c|a&~c)+e+k;return(b<>>32-j)+n}function l(b,n,a,c,e,j,k){b=b+(n^a^c)+e+k;return(b<>>32-j)+n}function s(b,n,a,c,e,j,k){b=b+(a^(n|~c))+e+k;return(b<>>32-j)+n}for(var t=CryptoJS,r=t.lib,w=r.WordArray,v=r.Hasher,r=t.algo,b=[],x=0;64>x;x++)b[x]=4294967296*u.abs(u.sin(x+1))|0;r=r.MD5=v.extend({_doReset:function(){this._hash=new w.init([1732584193,4023233417,2562383102,271733878])}, +_doProcessBlock:function(q,n){for(var a=0;16>a;a++){var c=n+a,e=q[c];q[c]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360}var a=this._hash.words,c=q[n+0],e=q[n+1],j=q[n+2],k=q[n+3],z=q[n+4],r=q[n+5],t=q[n+6],w=q[n+7],v=q[n+8],A=q[n+9],B=q[n+10],C=q[n+11],u=q[n+12],D=q[n+13],E=q[n+14],x=q[n+15],f=a[0],m=a[1],g=a[2],h=a[3],f=p(f,m,g,h,c,7,b[0]),h=p(h,f,m,g,e,12,b[1]),g=p(g,h,f,m,j,17,b[2]),m=p(m,g,h,f,k,22,b[3]),f=p(f,m,g,h,z,7,b[4]),h=p(h,f,m,g,r,12,b[5]),g=p(g,h,f,m,t,17,b[6]),m=p(m,g,h,f,w,22,b[7]), +f=p(f,m,g,h,v,7,b[8]),h=p(h,f,m,g,A,12,b[9]),g=p(g,h,f,m,B,17,b[10]),m=p(m,g,h,f,C,22,b[11]),f=p(f,m,g,h,u,7,b[12]),h=p(h,f,m,g,D,12,b[13]),g=p(g,h,f,m,E,17,b[14]),m=p(m,g,h,f,x,22,b[15]),f=d(f,m,g,h,e,5,b[16]),h=d(h,f,m,g,t,9,b[17]),g=d(g,h,f,m,C,14,b[18]),m=d(m,g,h,f,c,20,b[19]),f=d(f,m,g,h,r,5,b[20]),h=d(h,f,m,g,B,9,b[21]),g=d(g,h,f,m,x,14,b[22]),m=d(m,g,h,f,z,20,b[23]),f=d(f,m,g,h,A,5,b[24]),h=d(h,f,m,g,E,9,b[25]),g=d(g,h,f,m,k,14,b[26]),m=d(m,g,h,f,v,20,b[27]),f=d(f,m,g,h,D,5,b[28]),h=d(h,f, +m,g,j,9,b[29]),g=d(g,h,f,m,w,14,b[30]),m=d(m,g,h,f,u,20,b[31]),f=l(f,m,g,h,r,4,b[32]),h=l(h,f,m,g,v,11,b[33]),g=l(g,h,f,m,C,16,b[34]),m=l(m,g,h,f,E,23,b[35]),f=l(f,m,g,h,e,4,b[36]),h=l(h,f,m,g,z,11,b[37]),g=l(g,h,f,m,w,16,b[38]),m=l(m,g,h,f,B,23,b[39]),f=l(f,m,g,h,D,4,b[40]),h=l(h,f,m,g,c,11,b[41]),g=l(g,h,f,m,k,16,b[42]),m=l(m,g,h,f,t,23,b[43]),f=l(f,m,g,h,A,4,b[44]),h=l(h,f,m,g,u,11,b[45]),g=l(g,h,f,m,x,16,b[46]),m=l(m,g,h,f,j,23,b[47]),f=s(f,m,g,h,c,6,b[48]),h=s(h,f,m,g,w,10,b[49]),g=s(g,h,f,m, +E,15,b[50]),m=s(m,g,h,f,r,21,b[51]),f=s(f,m,g,h,u,6,b[52]),h=s(h,f,m,g,k,10,b[53]),g=s(g,h,f,m,B,15,b[54]),m=s(m,g,h,f,e,21,b[55]),f=s(f,m,g,h,v,6,b[56]),h=s(h,f,m,g,x,10,b[57]),g=s(g,h,f,m,t,15,b[58]),m=s(m,g,h,f,D,21,b[59]),f=s(f,m,g,h,z,6,b[60]),h=s(h,f,m,g,C,10,b[61]),g=s(g,h,f,m,j,15,b[62]),m=s(m,g,h,f,A,21,b[63]);a[0]=a[0]+f|0;a[1]=a[1]+m|0;a[2]=a[2]+g|0;a[3]=a[3]+h|0},_doFinalize:function(){var b=this._data,n=b.words,a=8*this._nDataBytes,c=8*b.sigBytes;n[c>>>5]|=128<<24-c%32;var e=u.floor(a/ +4294967296);n[(c+64>>>9<<4)+15]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360;n[(c+64>>>9<<4)+14]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;b.sigBytes=4*(n.length+1);this._process();b=this._hash;n=b.words;for(a=0;4>a;a++)c=n[a],n[a]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return b},clone:function(){var b=v.clone.call(this);b._hash=this._hash.clone();return b}});t.MD5=v._createHelper(r);t.HmacMD5=v._createHmacHelper(r)})(Math); +(function(){var u=CryptoJS,p=u.lib,d=p.Base,l=p.WordArray,p=u.algo,s=p.EvpKDF=d.extend({cfg:d.extend({keySize:4,hasher:p.MD5,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,r){for(var p=this.cfg,s=p.hasher.create(),b=l.create(),u=b.words,q=p.keySize,p=p.iterations;u.length>>2]&255}};d.BlockCipher=v.extend({cfg:v.cfg.extend({mode:b,padding:q}),reset:function(){v.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a, +this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var n=d.CipherParams=l.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),b=(p.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;return(a?s.create([1398893684, +1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=s.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return n.create({ciphertext:a,salt:c})}},a=d.SerializableCipher=l.extend({cfg:l.extend({format:b}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var l=a.createEncryptor(c,d);b=l.finalize(b);l=l.cfg;return n.create({ciphertext:b,key:c,iv:l.iv,algorithm:a,mode:l.mode,padding:l.padding,blockSize:a.blockSize,formatter:d.format})}, +decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),p=(p.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=s.random(8));a=w.create({keySize:b+c}).compute(a,d);c=s.create(a.words.slice(b),4*c);a.sigBytes=4*b;return n.create({key:a,iv:c,salt:d})}},c=d.PasswordBasedCipher=a.extend({cfg:a.cfg.extend({kdf:p}),encrypt:function(b,c,d,l){l=this.cfg.extend(l);d=l.kdf.execute(d, +b.keySize,b.ivSize);l.iv=d.iv;b=a.encrypt.call(this,b,c,d.key,l);b.mixIn(d);return b},decrypt:function(b,c,d,l){l=this.cfg.extend(l);c=this._parse(c,l.format);d=l.kdf.execute(d,b.keySize,b.ivSize,c.salt);l.iv=d.iv;return a.decrypt.call(this,b,c,d.key,l)}})}(); +(function(){for(var u=CryptoJS,p=u.lib.BlockCipher,d=u.algo,l=[],s=[],t=[],r=[],w=[],v=[],b=[],x=[],q=[],n=[],a=[],c=0;256>c;c++)a[c]=128>c?c<<1:c<<1^283;for(var e=0,j=0,c=0;256>c;c++){var k=j^j<<1^j<<2^j<<3^j<<4,k=k>>>8^k&255^99;l[e]=k;s[k]=e;var z=a[e],F=a[z],G=a[F],y=257*a[k]^16843008*k;t[e]=y<<24|y>>>8;r[e]=y<<16|y>>>16;w[e]=y<<8|y>>>24;v[e]=y;y=16843009*G^65537*F^257*z^16843008*e;b[k]=y<<24|y>>>8;x[k]=y<<16|y>>>16;q[k]=y<<8|y>>>24;n[k]=y;e?(e=z^a[a[a[G^z]]],j^=a[a[j]]):e=j=1}var H=[0,1,2,4,8, +16,32,64,128,27,54],d=d.AES=p.extend({_doReset:function(){for(var a=this._key,c=a.words,d=a.sigBytes/4,a=4*((this._nRounds=d+6)+1),e=this._keySchedule=[],j=0;j>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255]):(k=k<<8|k>>>24,k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255],k^=H[j/d|0]<<24);e[j]=e[j-d]^k}c=this._invKeySchedule=[];for(d=0;dd||4>=j?k:b[l[k>>>24]]^x[l[k>>>16&255]]^q[l[k>>> +8&255]]^n[l[k&255]]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,t,r,w,v,l)},decryptBlock:function(a,c){var d=a[c+1];a[c+1]=a[c+3];a[c+3]=d;this._doCryptBlock(a,c,this._invKeySchedule,b,x,q,n,s);d=a[c+1];a[c+1]=a[c+3];a[c+3]=d},_doCryptBlock:function(a,b,c,d,e,j,l,f){for(var m=this._nRounds,g=a[b]^c[0],h=a[b+1]^c[1],k=a[b+2]^c[2],n=a[b+3]^c[3],p=4,r=1;r>>24]^e[h>>>16&255]^j[k>>>8&255]^l[n&255]^c[p++],s=d[h>>>24]^e[k>>>16&255]^j[n>>>8&255]^l[g&255]^c[p++],t= +d[k>>>24]^e[n>>>16&255]^j[g>>>8&255]^l[h&255]^c[p++],n=d[n>>>24]^e[g>>>16&255]^j[h>>>8&255]^l[k&255]^c[p++],g=q,h=s,k=t;q=(f[g>>>24]<<24|f[h>>>16&255]<<16|f[k>>>8&255]<<8|f[n&255])^c[p++];s=(f[h>>>24]<<24|f[k>>>16&255]<<16|f[n>>>8&255]<<8|f[g&255])^c[p++];t=(f[k>>>24]<<24|f[n>>>16&255]<<16|f[g>>>8&255]<<8|f[h&255])^c[p++];n=(f[n>>>24]<<24|f[g>>>16&255]<<16|f[h>>>8&255]<<8|f[k&255])^c[p++];a[b]=q;a[b+1]=s;a[b+2]=t;a[b+3]=n},keySize:8});u.AES=p._createHelper(d)})(); diff --git a/js/cryptojs/rollups/hmac-sha512.js b/js/cryptojs/rollups/hmac-sha512.js new file mode 100755 index 0000000..5e5981f --- /dev/null +++ b/js/cryptojs/rollups/hmac-sha512.js @@ -0,0 +1,25 @@ +/* +CryptoJS v3.1.2 +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +var CryptoJS=CryptoJS||function(a,j){var c={},b=c.lib={},f=function(){},l=b.Base={extend:function(a){f.prototype=this;var d=new f;a&&d.mixIn(a);d.hasOwnProperty("init")||(d.init=function(){d.$super.init.apply(this,arguments)});d.init.prototype=d;d.$super=this;return d},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var d in a)a.hasOwnProperty(d)&&(this[d]=a[d]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, +u=b.WordArray=l.extend({init:function(a,d){a=this.words=a||[];this.sigBytes=d!=j?d:4*a.length},toString:function(a){return(a||m).stringify(this)},concat:function(a){var d=this.words,M=a.words,e=this.sigBytes;a=a.sigBytes;this.clamp();if(e%4)for(var b=0;b>>2]|=(M[b>>>2]>>>24-8*(b%4)&255)<<24-8*((e+b)%4);else if(65535>>2]=M[b>>>2];else d.push.apply(d,M);this.sigBytes+=a;return this},clamp:function(){var D=this.words,d=this.sigBytes;D[d>>>2]&=4294967295<< +32-8*(d%4);D.length=a.ceil(d/4)},clone:function(){var a=l.clone.call(this);a.words=this.words.slice(0);return a},random:function(D){for(var d=[],b=0;b>>2]>>>24-8*(e%4)&255;b.push((c>>>4).toString(16));b.push((c&15).toString(16))}return b.join("")},parse:function(a){for(var d=a.length,b=[],e=0;e>>3]|=parseInt(a.substr(e, +2),16)<<24-4*(e%8);return new u.init(b,d/2)}},y=k.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],e=0;e>>2]>>>24-8*(e%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],e=0;e>>2]|=(a.charCodeAt(e)&255)<<24-8*(e%4);return new u.init(c,b)}},z=k.Utf8={stringify:function(a){try{return decodeURIComponent(escape(y.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return y.parse(unescape(encodeURIComponent(a)))}}, +x=b.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=z.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(b){var d=this._data,c=d.words,e=d.sigBytes,l=this.blockSize,k=e/(4*l),k=b?a.ceil(k):a.max((k|0)-this._minBufferSize,0);b=k*l;e=a.min(4*b,e);if(b){for(var x=0;xm;m++)k[m]=a();b=b.SHA512=c.extend({_doReset:function(){this._hash=new l.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(a,b){for(var c=this._hash.words, +f=c[0],j=c[1],d=c[2],l=c[3],e=c[4],m=c[5],N=c[6],c=c[7],aa=f.high,O=f.low,ba=j.high,P=j.low,ca=d.high,Q=d.low,da=l.high,R=l.low,ea=e.high,S=e.low,fa=m.high,T=m.low,ga=N.high,U=N.low,ha=c.high,V=c.low,r=aa,n=O,G=ba,E=P,H=ca,F=Q,Y=da,I=R,s=ea,p=S,W=fa,J=T,X=ga,K=U,Z=ha,L=V,t=0;80>t;t++){var A=k[t];if(16>t)var q=A.high=a[b+2*t]|0,g=A.low=a[b+2*t+1]|0;else{var q=k[t-15],g=q.high,v=q.low,q=(g>>>1|v<<31)^(g>>>8|v<<24)^g>>>7,v=(v>>>1|g<<31)^(v>>>8|g<<24)^(v>>>7|g<<25),C=k[t-2],g=C.high,h=C.low,C=(g>>>19| +h<<13)^(g<<3|h>>>29)^g>>>6,h=(h>>>19|g<<13)^(h<<3|g>>>29)^(h>>>6|g<<26),g=k[t-7],$=g.high,B=k[t-16],w=B.high,B=B.low,g=v+g.low,q=q+$+(g>>>0>>0?1:0),g=g+h,q=q+C+(g>>>0>>0?1:0),g=g+B,q=q+w+(g>>>0>>0?1:0);A.high=q;A.low=g}var $=s&W^~s&X,B=p&J^~p&K,A=r&G^r&H^G&H,ka=n&E^n&F^E&F,v=(r>>>28|n<<4)^(r<<30|n>>>2)^(r<<25|n>>>7),C=(n>>>28|r<<4)^(n<<30|r>>>2)^(n<<25|r>>>7),h=u[t],la=h.high,ia=h.low,h=L+((p>>>14|s<<18)^(p>>>18|s<<14)^(p<<23|s>>>9)),w=Z+((s>>>14|p<<18)^(s>>>18|p<<14)^(s<<23|p>>>9))+(h>>> +0>>0?1:0),h=h+B,w=w+$+(h>>>0>>0?1:0),h=h+ia,w=w+la+(h>>>0>>0?1:0),h=h+g,w=w+q+(h>>>0>>0?1:0),g=C+ka,A=v+A+(g>>>0>>0?1:0),Z=X,L=K,X=W,K=J,W=s,J=p,p=I+h|0,s=Y+w+(p>>>0>>0?1:0)|0,Y=H,I=F,H=G,F=E,G=r,E=n,n=h+g|0,r=w+A+(n>>>0>>0?1:0)|0}O=f.low=O+n;f.high=aa+r+(O>>>0>>0?1:0);P=j.low=P+E;j.high=ba+G+(P>>>0>>0?1:0);Q=d.low=Q+F;d.high=ca+H+(Q>>>0>>0?1:0);R=l.low=R+I;l.high=da+Y+(R>>>0>>0?1:0);S=e.low=S+p;e.high=ea+s+(S>>>0

>>0?1:0);T=m.low=T+J;m.high=fa+W+(T>>>0>>0?1: +0);U=N.low=U+K;N.high=ga+X+(U>>>0>>0?1:0);V=c.low=V+L;c.high=ha+Z+(V>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,f=8*a.sigBytes;b[f>>>5]|=128<<24-f%32;b[(f+128>>>10<<5)+30]=Math.floor(c/4294967296);b[(f+128>>>10<<5)+31]=c;a.sigBytes=4*b.length;this._process();return this._hash.toX32()},clone:function(){var a=c.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});j.SHA512=c._createHelper(b);j.HmacSHA512=c._createHmacHelper(b)})(); +(function(){var a=CryptoJS,j=a.enc.Utf8;a.algo.HMAC=a.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=j.parse(b));var f=a.blockSize,l=4*f;b.sigBytes>l&&(b=a.finalize(b));b.clamp();for(var u=this._oKey=b.clone(),k=this._iKey=b.clone(),m=u.words,y=k.words,z=0;z>>2]|=(d[j>>>2]>>>24-8*(j%4)&255)<<24-8*((c+j)%4);else if(65535>>2]=d[j>>>2];else b.push.apply(b,d);this.sigBytes+=a;return this},clamp:function(){var n=this.words,b=this.sigBytes;n[b>>>2]&=4294967295<< +32-8*(b%4);n.length=a.ceil(b/4)},clone:function(){var a=l.clone.call(this);a.words=this.words.slice(0);return a},random:function(n){for(var b=[],d=0;d>>2]>>>24-8*(c%4)&255;d.push((j>>>4).toString(16));d.push((j&15).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,d=[],c=0;c>>3]|=parseInt(a.substr(c, +2),16)<<24-4*(c%8);return new p.init(d,b/2)}},G=y.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c>>2]>>>24-8*(c%4)&255));return d.join("")},parse:function(a){for(var b=a.length,d=[],c=0;c>>2]|=(a.charCodeAt(c)&255)<<24-8*(c%4);return new p.init(d,b)}},fa=y.Utf8={stringify:function(a){try{return decodeURIComponent(escape(G.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},parse:function(a){return G.parse(unescape(encodeURIComponent(a)))}}, +h=f.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new p.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=fa.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(n){var b=this._data,d=b.words,c=b.sigBytes,j=this.blockSize,l=c/(4*j),l=n?a.ceil(l):a.max((l|0)-this._minBufferSize,0);n=l*j;c=a.min(4*n,c);if(n){for(var h=0;hq;q++)y[q]=a();f=f.SHA512=r.extend({_doReset:function(){this._hash=new l.init([new g.init(1779033703,4089235720),new g.init(3144134277,2227873595),new g.init(1013904242,4271175723),new g.init(2773480762,1595750129),new g.init(1359893119,2917565137),new g.init(2600822924,725511199),new g.init(528734635,4215389547),new g.init(1541459225,327033209)])},_doProcessBlock:function(a,f){for(var h=this._hash.words, +g=h[0],n=h[1],b=h[2],d=h[3],c=h[4],j=h[5],l=h[6],h=h[7],q=g.high,m=g.low,r=n.high,N=n.low,Z=b.high,O=b.low,$=d.high,P=d.low,aa=c.high,Q=c.low,ba=j.high,R=j.low,ca=l.high,S=l.low,da=h.high,T=h.low,v=q,s=m,H=r,E=N,I=Z,F=O,W=$,J=P,w=aa,t=Q,U=ba,K=R,V=ca,L=S,X=da,M=T,x=0;80>x;x++){var B=y[x];if(16>x)var u=B.high=a[f+2*x]|0,e=B.low=a[f+2*x+1]|0;else{var u=y[x-15],e=u.high,z=u.low,u=(e>>>1|z<<31)^(e>>>8|z<<24)^e>>>7,z=(z>>>1|e<<31)^(z>>>8|e<<24)^(z>>>7|e<<25),D=y[x-2],e=D.high,k=D.low,D=(e>>>19|k<<13)^ +(e<<3|k>>>29)^e>>>6,k=(k>>>19|e<<13)^(k<<3|e>>>29)^(k>>>6|e<<26),e=y[x-7],Y=e.high,C=y[x-16],A=C.high,C=C.low,e=z+e.low,u=u+Y+(e>>>0>>0?1:0),e=e+k,u=u+D+(e>>>0>>0?1:0),e=e+C,u=u+A+(e>>>0>>0?1:0);B.high=u;B.low=e}var Y=w&U^~w&V,C=t&K^~t&L,B=v&H^v&I^H&I,ha=s&E^s&F^E&F,z=(v>>>28|s<<4)^(v<<30|s>>>2)^(v<<25|s>>>7),D=(s>>>28|v<<4)^(s<<30|v>>>2)^(s<<25|v>>>7),k=p[x],ia=k.high,ea=k.low,k=M+((t>>>14|w<<18)^(t>>>18|w<<14)^(t<<23|w>>>9)),A=X+((w>>>14|t<<18)^(w>>>18|t<<14)^(w<<23|t>>>9))+(k>>>0>> +0?1:0),k=k+C,A=A+Y+(k>>>0>>0?1:0),k=k+ea,A=A+ia+(k>>>0>>0?1:0),k=k+e,A=A+u+(k>>>0>>0?1:0),e=D+ha,B=z+B+(e>>>0>>0?1:0),X=V,M=L,V=U,L=K,U=w,K=t,t=J+k|0,w=W+A+(t>>>0>>0?1:0)|0,W=I,J=F,I=H,F=E,H=v,E=s,s=k+e|0,v=A+B+(s>>>0>>0?1:0)|0}m=g.low=m+s;g.high=q+v+(m>>>0>>0?1:0);N=n.low=N+E;n.high=r+H+(N>>>0>>0?1:0);O=b.low=O+F;b.high=Z+I+(O>>>0>>0?1:0);P=d.low=P+J;d.high=$+W+(P>>>0>>0?1:0);Q=c.low=Q+t;c.high=aa+w+(Q>>>0>>0?1:0);R=j.low=R+K;j.high=ba+U+(R>>>0>>0?1:0);S=l.low= +S+L;l.high=ca+V+(S>>>0>>0?1:0);T=h.low=T+M;h.high=da+X+(T>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,f=a.words,h=8*this._nDataBytes,g=8*a.sigBytes;f[g>>>5]|=128<<24-g%32;f[(g+128>>>10<<5)+30]=Math.floor(h/4294967296);f[(g+128>>>10<<5)+31]=h;a.sigBytes=4*f.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});m.SHA512=r._createHelper(f);m.HmacSHA512=r._createHmacHelper(f)})(); diff --git a/js/jvon-angular.js b/js/jvon-angular.js new file mode 100644 index 0000000..25ee013 --- /dev/null +++ b/js/jvon-angular.js @@ -0,0 +1,450 @@ +// This is the angular controller and the code pane +var jvonapp = angular.module("JVON", ["ngTouch", "ngSanitize"]); + +jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", function ($scope, $timeout ,$interval) { + // List of available commands + $scope.commands = commands; + + // The code pane + $scope.code_lines = new Array(); + + // The result pane + $scope.results = new Array(); + + // What is displayed on the screen + $scope.screen = new Array(); + + $scope.execution_started = false; + + $scope.speed = 1; // 1 second interval between code + + // Set language to spanish by default or load english if it's saved in the browser + if (localStorage.language == 1) { + $scope.language = 1; + $scope.strings = english_strings; + } + else { + $scope.language = 0; + $scope.strings = spanish_strings; + } + + // Initialize, this variable is only set to show that the code has changd to update the display + $scope.imported_code = false; + + // Set and ID + $scope.identifier = new Date().getTime().toString() + navigator.userAgent + Math.random().toString(); + $scope.identifier = CryptoJS.SHA512($scope.identifier).toString(); + + // Change the language between english and spanish + $scope.change_language = function () { + if ($scope.language == 1) { + $scope.strings = english_strings; + localStorage.language = 1; + } + else { + $scope.strings = spanish_strings; + localStorage.language = 0; + } + }; + + $scope.change_speed = function () { + $timeout.cancel($scope.promise); + if ($scope.execution_started == false) { + $scope.execution_started = true; + $scope.promise = $timeout($scope.execute_line, 1); + } + else { + $scope.promise = $timeout($scope.execute_line, 1000 * $scope.speed); + } + }; + + $scope.paused_blink = function (enabled) { + if (enabled == true) { + $scope.blinking = true; + $scope.blink_state = false; + $scope.opacity = 1; + $scope.blink_promise = $interval($scope.blink, 20); + } + else { + $interval.cancel($scope.blink_promise); + element = document.getElementById("pause_code"); + element.style.opacity = 1; + element.style.filter = "alpha(opacity=" + 1 * 100 + ")"; + } + }; + + $scope.blink = function () { + element = document.getElementById("pause_code"); + if ($scope.blink_state == false) { + if ($scope.opacity <= 0.1) { + $scope.blink_state = true; + $scope.opacity = 0.1; + } + else { + element.style.opacity = $scope.opacity; + element.style.filter = "alpha(opacity=" + $scope.opacity * 100 + ")"; + $scope.opacity -= $scope.opacity * 0.1; + } + } + else { + if ($scope.opacity >= 1) { + $scope.blink_state = false; + $scope.opacity = 1; + } + else { + element.style.opacity = $scope.opacity; + element.style.filter = "alpha(opacity=" + $scope.opacity * 100 + ")"; + $scope.opacity += $scope.opacity * 0.1; + } + } + }; + + $scope.cancel_timer = function () { + $timeout.cancel($scope.promise); + }; + + // Show the help window + $scope.show_help = function () { + document.getElementById("help_window").style.visibility = "visible"; + document.getElementById("blur").style.visibility = "visible"; + }; + + // Hide the help window + $scope.hide_help = function () { + if (document.getElementById("help_window").style.visibility == "visible") { + document.getElementById("help_window").style.visibility = "hidden"; + document.getElementById("blur").style.visibility = "hidden"; + } + }; + + $scope.show_input_prompt = function () { + document.getElementById("input_prompt").style.visibility = "visible"; + document.getElementById("blur").style.visibility = "visible"; + document.getElementById("rda").focus(); + }; + + $scope.hide_input_prompt = function () { + document.getElementById("input_prompt").style.visibility = "hidden"; + document.getElementById("blur").style.visibility = "hidden"; + document.getElementById("rda").value = ""; + }; + + $scope.disable_code_buttons = function () { + document.getElementById("add_line").disabled = true; + document.getElementById("insert_line").disabled = true; + document.getElementById("delete_line").disabled = true; + document.getElementById("clear_code").disabled = true; + document.getElementById("export_code").disabled = true; + document.getElementById("file").disabled = true; + }; + + $scope.enable_code_buttons = function () { + document.getElementById("add_line").disabled = false; + document.getElementById("insert_line").disabled = false; + document.getElementById("delete_line").disabled = false; + document.getElementById("clear_code").disabled = false; + document.getElementById("export_code").disabled = false; + document.getElementById("file").disabled = false; + }; + + // Add a new line the the code pane + $scope.add_line = function () { + var len = $scope.code_lines.length - 1; + + if (len != -1) { + var line_number = parseInt($scope.code_lines[len].line) + 1; + var line = { + line: line_number.toString(), + highlighted: false, + command: $scope.commands[0], + value: "" + }; + $scope.code_lines.push(line); + } + else { + $scope.code_lines = [ + { + line: "1", + highlighted: false, + command: commands[0], + value: "" + } + ]; + } + }; + + $scope.insert_line = function () { + if ($scope.code_lines.length > 0) { + // Find the last highlighted line + var highlighted = null; + for (var i = $scope.code_lines.length - 1; i >= 0; i--) { + if ($scope.code_lines[i].highlighted == true) { + highlighted = i; + break; + } + } + if (highlighted == null) { + highlighted = $scope.code_lines.length - 1; + } + + // Add a line after the last highlighted + var new_code_lines = new Array(); + var j = 1; + for (var i = 0; i < $scope.code_lines.length; i++) { + if (highlighted == i) { + $scope.code_lines[i].line = j.toString(); + new_code_lines.push($scope.code_lines[i]); + + j++; + var line = { + line: j.toString(), + highlighted: false, + command: $scope.commands[0], + value: "" + }; + new_code_lines.push(line); + j++; + } + else { + $scope.code_lines[i].line = j.toString(); + new_code_lines.push($scope.code_lines[i]); + j++; + } + } + $scope.code_lines = new_code_lines; + } + }; + + // Delete the highlighted lines + $scope.delete_line = function () { + var new_code_lines = new Array(); + var j = 1; + for (var i = 0; i < $scope.code_lines.length; i++) { + if (!$scope.code_lines[i].highlighted) { + $scope.code_lines[i].line = j.toString(); + j++; + new_code_lines.push($scope.code_lines[i]); + } + } + $scope.code_lines = new_code_lines; + }; + + // Delete all code lines + $scope.clear_code = function () { + $scope.code_lines = new Array(); + }; + + $scope.select_line = function (line_number, result) { + // If execution finished remove all highlights + if ($scope.finished == true) { + $scope.finished = false; + for (var i = 0; i < $scope.code_lines.length; i++) { + if ($scope.code_lines[i].highlighted == true) { + // Unhighlight + var line; + line = document.getElementById("line1_" + i.toString()); + line.className = line.className.substring(0,line.className.length - 21); + line = document.getElementById("line2_" + i.toString()); + line.className = line.className.substring(0,line.className.length - 21); + line = document.getElementById("line3_" + i.toString()); + line.className = line.className.substring(0,line.className.length - 21); + $scope.code_lines[i].highlighted = false; + } + } + } + + if ($scope.executing == true && result == true) { + if ($scope.code_lines[line_number].highlighted == false) { + // Highlight + var line; + line = document.getElementById("line1_" + line_number.toString()); + line.className += " code_number_selected"; + line = document.getElementById("line2_" + line_number.toString()); + line.className += " code_number_selected"; + line = document.getElementById("line3_" + line_number.toString()); + line.className += " code_number_selected"; + $scope.code_lines[line_number].highlighted = true; + } + else { + // Unhighlight + var line; + line = document.getElementById("line1_" + line_number.toString()); + line.className = line.className.substring(0,line.className.length - 21); + line = document.getElementById("line2_" + line_number.toString()); + line.className = line.className.substring(0,line.className.length - 21); + line = document.getElementById("line3_" + line_number.toString()); + line.className = line.className.substring(0,line.className.length - 21); + $scope.code_lines[line_number].highlighted = false; + } + } + else if ($scope.executing == false && result == false) { + if ($scope.code_lines[line_number].highlighted == false) { + // Highlight + var line; + line = document.getElementById("line1_" + line_number.toString()); + line.className += " line_number_selected"; + line = document.getElementById("line2_" + line_number.toString()); + line.className += " line_number_selected"; + line = document.getElementById("line3_" + line_number.toString()); + line.className += " line_number_selected"; + $scope.code_lines[line_number].highlighted = true; + } + else { + // Unhighlight + var line; + line = document.getElementById("line1_" + line_number.toString()); + line.className = line.className.substring(0,line.className.length - 21); + line = document.getElementById("line2_" + line_number.toString()); + line.className = line.className.substring(0,line.className.length - 21); + line = document.getElementById("line3_" + line_number.toString()); + line.className = line.className.substring(0,line.className.length - 21); + $scope.code_lines[line_number].highlighted = false; + } + } + }; + + $scope.export_code = function() { + // Encrypt the data + var data = $scope.code_lines; + + // Remove highlights from saved data + for (var i = 0; i < data.length; i++) { + data[i].highlighted = false; + } + + var filename = document.getElementById("project_name").value; + + // If there is no project name, name the file "codigo" + if (filename.trim() == "") { + filename = "codigo"; + } + + // Cleanup the filename and romove unapproved characters + var regex = /[^A-Za-z0-9 \-\.]/g; + filename = filename.replace(regex, "") + ".jvon"; + + var encrypted = $scope.encrypt(JSON.stringify(data), filename); + + // Create an invisble link + var link = document.createElement("a"); + link.style.display = "none"; + link.setAttribute("href", 'data:application/octet-stream;charset=utf-8,' + encrypted); + link.setAttribute("download", filename); + + // Add the link to the DOM + document.body.appendChild(link); + // Start the download + link.click(); + // Delete the link from DOM + document.body.removeChild(link); + }; + + $scope.key = CryptoJS.enc.Utf8.parse("ciq3IpalFhkRSerOhNmsbjcD3dRszglG"); + + $scope.encrypt = function(data, filename) { + var encrypted = CryptoJS.AES.encrypt(data, $scope.key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.ZeroPadding }); + var encrypted2 = CryptoJS.AES.encrypt(filename, $scope.key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.ZeroPadding }); + var hmac = CryptoJS.HmacSHA512(encrypted.toString(), CryptoJS.SHA512($scope.key)).toString(); + return $scope.identifier + hmac + encrypted + "jvonfile" + encrypted2; + }; + + $scope.decrypt = function(data) { + data = data.split("jvonfile"); + var filename = data[1]; + data = data[0]; + + var hmac = data.substring(128,256); + var encrypted = data.substring(256); + + if (hmac != CryptoJS.HmacSHA512(encrypted, CryptoJS.SHA512($scope.key)).toString()) { + // The file is invalid or hacked + alert($scope.strings.file_load_failed); + return null; + } + else { + var decrypted = CryptoJS.AES.decrypt(encrypted, $scope.key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.ZeroPadding }); + var decrypted2 = CryptoJS.AES.decrypt(filename, $scope.key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.ZeroPadding }); + + filename = decrypted2.toString(CryptoJS.enc.Utf8); + + // Remove the .jvon extension from the filename + if (filename.substring(filename.length - 5, filename.length) == ".jvon") { + filename = filename.substring(0, filename.length - 5); + } + + document.getElementById("project_name").value = filename; + + $scope.identifier = data.substring(0,128); + return decrypted.toString(CryptoJS.enc.Utf8); + } + }; + + // Watch for changes to the code from external sources and update accordingly + $scope.$watch('imported_code',function(newValue, oldValue) { + if (newValue) { + $scope.code_lines = newValue; + $scope.imported_code = false; + + // Reset the select dropdowns + for (var i = 0; i < $scope.code_lines.length; i++) { + for (var j = 0; j < $scope.commands.length; j++) { + if ($scope.code_lines[i].command.name == $scope.commands[j].name) { + $scope.code_lines[i].command = $scope.commands[j]; + } + } + } + } + }); + + // Execute code line by line with an interval + $scope.repeater = function () { + if ($scope.execution_started == false) { + $scope.execution_started = true; + $scope.promise = $timeout($scope.execute_line, 1); + } + else { + $scope.promise = $timeout($scope.execute_line, 1000 * $scope.speed); + } + }; + + window.onbeforeunload = function() { + // Warn the user about leaving the page + return $scope.strings.leave; + }; +}]); + +// This directive is used to listen for a change to the file box and read the file +jvonapp.directive("importFile", function () { + return { + restrict: "A", + link: function ($scope, element, attributes) { + element.bind('change', function (event) { + var file = event.target.files[0]; + + if (file) { + var reader = new FileReader(); + reader.onload = function(e) { + // Decrypt the code and parse it + var data = $scope.decrypt(e.target.result); + $scope.imported_code = JSON.parse(data); + // Erase current lines to rebuild it from the imported file + for (var i = 0; i < $scope.code_lines.length; i++) { + if ($scope.code_lines[i].highlighted == true) { + // Remove highlights from the DOM before we load anything + $scope.finished = true; + $scope.select_line(i, true); + } + } + $scope.code_lines = new Array(); + $scope.$apply(); + } + + reader.readAsText(file); + } + else { + alert($scope.strings.file_load_failed); + } + }); + } + }; +}); \ No newline at end of file diff --git a/js/jvon-interpret.js b/js/jvon-interpret.js new file mode 100644 index 0000000..68ddeca --- /dev/null +++ b/js/jvon-interpret.js @@ -0,0 +1,920 @@ +// This is the result pane which executes the commands +// Wait for the DOM to load then add this to the angular controller +document.addEventListener('DOMContentLoaded', function () { + // Get the controller + var $scope = angular.element(document.getElementById("jvon")).scope(); + + $scope.stopped = true; + $scope.executing = false; + $scope.finished = false; + + // Execute code + $scope.execute_code = function () { + // Check if there is any code to run + if ($scope.code_lines.length > 0) { + $scope.executing = true; + $scope.stopped = false; + $scope.previous = null; + $scope.finished = false; + + $scope.ac = ""; + $scope.memory = new Array(); + $scope.memory[0] = null; // 80 + $scope.memory[1] = null; // 81 + $scope.memory[2] = null; // 82 + $scope.memory[3] = null; // 83 + $scope.memory[4] = null; // 84 + $scope.memory[5] = null; // 85 + + document.getElementById("execute_code").disabled = true; + document.getElementById("pause_code").disabled = false; + document.getElementById("stop_code").disabled = false; + + // Unhighlight lines + for (var i = 0; i < $scope.code_lines.length; i++) { + if ($scope.code_lines[i].highlighted == true) { + $scope.select_line(i, true); + } + } + + $scope.disable_code_buttons(); + + $scope.results = new Array(); + $scope.screen = new Array(); + $scope.line_number = 0; + $scope.repeater(); + } + }; + + $scope.stop_code = function () { + $scope.cancel_timer(); + if ($scope.blinking == true) { + $scope.paused_blink(false); + } + $scope.stopped = true; + $scope.executing = false; + $scope.finished = true; + $scope.enable_code_buttons(); + document.getElementById("execute_code").disabled = false; + document.getElementById("pause_code").disabled = true; + document.getElementById("stop_code").disabled = true; + }; + + $scope.pause_code = function () { + if ($scope.stopped == false) { + $scope.paused_blink(true); + $scope.cancel_timer(); + $scope.stopped = true; + } + else { + $scope.paused_blink(false); + $scope.stopped = false; + $scope.repeater(); + } + }; + + $scope.execute_line = function () { + if ($scope.stopped == false) { + if ($scope.line_number >= $scope.code_lines.length) { + alert($scope.strings.error_no_command); + $scope.stop_code(); + } + else { + // Unhighlight previous line + if ($scope.previous == null) { + $scope.previous = $scope.line_number; + } + else { + $scope.select_line($scope.previous, true); + $scope.previous = $scope.line_number; + } + + $scope.select_line($scope.line_number, true); + switch ($scope.code_lines[$scope.line_number].command.name) { + case "": + $scope.line_number++; + $scope.repeater(); + break; + case "rda": + $scope.rda($scope.code_lines[$scope.line_number].value); + break; + case "lda": + $scope.lda($scope.code_lines[$scope.line_number].value); + break; + case "str": + $scope.str($scope.code_lines[$scope.line_number].value); + break; + case "wrt": + $scope.wrt($scope.code_lines[$scope.line_number].value); + break; + case "add": + $scope.add($scope.code_lines[$scope.line_number].value); + break; + case "sub": + $scope.sub($scope.code_lines[$scope.line_number].value); + break; + case "mul": + $scope.mul($scope.code_lines[$scope.line_number].value); + break; + case "div": + $scope.div($scope.code_lines[$scope.line_number].value); + break; + case "jmp": + $scope.jmp($scope.code_lines[$scope.line_number].value); + break; + case "jmpZ": + $scope.jmpZ($scope.code_lines[$scope.line_number].value); + break; + case "jmpL": + $scope.jmpL($scope.code_lines[$scope.line_number].value); + break; + case "sqr": + $scope.sqr($scope.code_lines[$scope.line_number].value); + break; + case "pow": + $scope.pow($scope.code_lines[$scope.line_number].value); + break; + case "End": + $scope.End($scope.code_lines[$scope.line_number].value); + break; + default: + alert($scope.code_lines[$scope.line_number].command.name + " is not implemented yet."); + $scope.line_number++; + $scope.repeater(); + } + } + } + }; + + $scope.check_syntax = function (value) { + var result; + + if (value == "") { + return {type: "blank", value: ""}; + } + + var regex = /^(\d+)$/; + if ((result = regex.exec(value)) !== null) { + if (result.index === regex.lastIndex) { + regex.lastIndex++; + } + + return {type: "memory", value: result[1]}; + } + + var regex = /^\[(\d+)\]$/; + if ((result = regex.exec(value)) !== null) { + if (result.index === regex.lastIndex) { + regex.lastIndex++; + } + + return {type: "address", value: result[1]}; + } + + var regex = /^#(-?[0-9]*?\.?[0-9]+)$/; + if ((result = regex.exec(value)) !== null) { + if (result.index === regex.lastIndex) { + regex.lastIndex++; + } + + return {type: "number", value: result[1]}; + } + + return {type: "invalid", value: value}; + }; + + $scope.check_memory_address = function(value) { + value = parseFloat(value); + if (value < 80 || value > 85) { + return false; + } + return true; + }; + + $scope.check_memory_value = function(value) { + value = parseFloat(value) - 80; + if ($scope.memory[value] == null) { + return false; + } + return true; + }; + + $scope.rda = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "invalid" || syntax.type == "number" || syntax.type == "blank") { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true) { + $scope.rda_value = value; + $scope.show_input_prompt(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + // Memory address + if ($scope.check_memory_address(syntax.value) == true) { + syntax.value = parseFloat(syntax.value); + syntax.value = syntax.value - 80; + var new_memory = $scope.memory[syntax.value]; + + var regex = /^\d+$/; + var result; + + if ((result = regex.exec(new_memory)) !== null && $scope.check_memory_address(new_memory) == true) { + $scope.rda_value = new_memory; + $scope.show_input_prompt(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + }; + + $scope.rda_value_received = function () { + var value = document.getElementById("rda").value; + + var regex = /^-?[0-9]*?\.?[0-9]+$/; + var result; + + if ((result = regex.exec(value)) !== null) { + value = parseFloat(value); + $scope.rda_value = parseFloat($scope.rda_value); + + $scope.hide_input_prompt(); + + $scope.create_result($scope.line_number, $scope.rda_value, value); + + $scope.rda_value = $scope.rda_value - 80; + $scope.memory[$scope.rda_value] = value; + + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_input); + } + }; + + $scope.lda = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "invalid" || syntax.type == "blank") { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + else if (syntax.type == "number") { + $scope.ac = syntax.value; + + $scope.create_result($scope.line_number, "ac", $scope.ac); + + $scope.line_number++; + $scope.repeater(); + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true && $scope.check_memory_value(value) == true) { + value = parseFloat(value) - 80; + $scope.ac = $scope.memory[value]; + + $scope.create_result($scope.line_number, "ac", $scope.ac); + + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + // Memory address + if ($scope.check_memory_address(syntax.value) == true && $scope.check_memory_value(syntax.value) == true) { + var new_value = parseFloat(syntax.value) - 80; + new_value = $scope.memory[new_value]; + if ($scope.check_memory_address(new_value) == true && $scope.check_memory_value(new_value) == true) { + new_value = new_value - 80; + $scope.ac = $scope.memory[new_value]; + + $scope.create_result($scope.line_number, "ac", $scope.ac); + + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + }; + + $scope.str = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "invalid" || syntax.type == "number" || syntax.type == "blank") { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true) { + new_value = parseFloat(value) - 80; + $scope.memory[new_value] = $scope.ac; + + $scope.create_result($scope.line_number, parseFloat(value), $scope.ac); + + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + // Memory address + if ($scope.check_memory_address(syntax.value) == true) { + syntax.value = parseFloat(syntax.value); + syntax.value = syntax.value - 80; + var new_memory = $scope.memory[syntax.value]; + + var regex = /^\d+$/; + var result; + + if ((result = regex.exec(new_memory)) !== null && $scope.check_memory_address(new_memory) == true) { + new_memory = parseFloat(new_memory) - 80; + $scope.memory[new_memory] = $scope.ac; + + $scope.create_result($scope.line_number, parseFloat(new_memory) + 80, $scope.ac); + + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + }; + + $scope.wrt = function (value) { + if (value == "") { + $scope.create_result($scope.line_number, "wrt", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.add = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "number") { + $scope.ac = parseFloat($scope.ac) + parseFloat(syntax.value); + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true && $scope.check_memory_value(value) == true) { + value = $scope.memory[value - 80]; + $scope.ac = parseFloat($scope.ac) + parseFloat(value); + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true && $scope.check_memory_value(temp_value) == true) { + value = parseFloat($scope.memory[temp_value - 80]); + $scope.ac = parseFloat($scope.ac) + value; + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.sub = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "number") { + $scope.ac = parseFloat($scope.ac) - parseFloat(syntax.value); + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true && $scope.check_memory_value(value) == true) { + value = $scope.memory[value - 80]; + $scope.ac = parseFloat($scope.ac) - parseFloat(value); + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true && $scope.check_memory_value(temp_value) == true) { + value = parseFloat($scope.memory[temp_value - 80]); + $scope.ac = parseFloat($scope.ac) - value; + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.mul = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "number") { + $scope.ac = parseFloat($scope.ac) * parseFloat(syntax.value); + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true && $scope.check_memory_value(value) == true) { + value = $scope.memory[value - 80]; + $scope.ac = parseFloat($scope.ac) * parseFloat(value); + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true && $scope.check_memory_value(temp_value) == true) { + value = parseFloat($scope.memory[temp_value - 80]); + $scope.ac = parseFloat($scope.ac) * value; + + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.div = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "number") { + $scope.ac = parseFloat($scope.ac) / parseFloat(syntax.value); + + var regex = /^-?[0-9]*\.?[0-9]+$/; + var result; + + if ((result = regex.exec($scope.ac)) !== null) { + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_math); + $scope.stop_code(); + } + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true && $scope.check_memory_value(value) == true) { + value = $scope.memory[value - 80]; + $scope.ac = parseFloat($scope.ac) / parseFloat(value); + + var regex = /^-?[0-9]*\.?[0-9]+$/; + var result; + + if ((result = regex.exec($scope.ac)) !== null) { + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_math); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true && $scope.check_memory_value(temp_value) == true) { + value = parseFloat($scope.memory[temp_value - 80]); + $scope.ac = parseFloat($scope.ac) / value; + + var regex = /^-?[0-9]*\.?[0-9]+$/; + var result; + + if ((result = regex.exec($scope.ac)) !== null) { + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_math); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.jmp = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "memory") { + $scope.line_number = parseFloat(value) - 1; + $scope.repeater(); + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true) { + value = parseFloat($scope.memory[temp_value - 80]); + $scope.line_number = parseFloat(value) - 1; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.jmpZ = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "memory") { + if (parseFloat($scope.ac) == 0) { + $scope.line_number = parseFloat(value) - 1; + $scope.repeater(); + } + else { + $scope.line_number++; + $scope.repeater(); + } + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true) { + if (parseFloat($scope.ac) == 0) { + value = parseFloat($scope.memory[temp_value - 80]); + $scope.line_number = parseFloat(value) - 1; + $scope.repeater(); + } + else { + $scope.line_number++; + $scope.repeater(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.jmpL = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "memory") { + if (parseFloat($scope.ac) < 0) { + $scope.line_number = parseFloat(value) - 1; + $scope.repeater(); + } + else { + $scope.line_number++; + $scope.repeater(); + } + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true) { + if (parseFloat($scope.ac) < 0) { + value = parseFloat($scope.memory[temp_value - 80]); + $scope.line_number = parseFloat(value) - 1; + $scope.repeater(); + } + else { + $scope.line_number++; + $scope.repeater(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.sqr = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "blank") { + if ($scope.ac == "") { + alert($scope.strings.error_ac); + $scope.stop_code(); + } + else { + var sqr = Math.sqrt(parseFloat($scope.ac)); + if (sqr == "NaN") { + alert($scope.strings.error_math); + $scope.stop_code(); + } + else { + $scope.ac = sqr; + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + } + } + else if (syntax.type == "number") { + var sqr = Math.sqrt(syntax.value); + if (sqr == "NaN") { + alert($scope.strings.error_math); + $scope.stop_code(); + } + else { + $scope.ac = sqr; + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true && $scope.check_memory_value(value) == true) { + value = parseFloat($scope.memory[value - 80]); + var sqr = Math.sqrt(value); + if (sqr == "NaN") { + alert($scope.strings.error_math); + $scope.stop_code(); + } + else { + $scope.ac = sqr; + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true && $scope.check_memory_value(temp_value) == true) { + value = parseFloat($scope.memory[temp_value - 80]); + var sqr = Math.sqrt(value); + if (sqr == "NaN") { + alert($scope.strings.error_math); + $scope.stop_code(); + } + else { + $scope.ac = sqr; + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.pow = function (value) { + var syntax = $scope.check_syntax(value); + if (syntax.type == "number") { + if ($scope.ac != "" || $scope.ac == 0) { + var new_value; + value = parseFloat(syntax.value); + if (value < 0) { + // The exponent is negative + value = Math.abs(parseFloat(value)); + new_value = 1 / $scope.pow_repeat(parseFloat(value), parseFloat($scope.ac)); + } + else { + // The exponent is positive + new_value = $scope.pow_repeat(parseFloat(value), parseFloat($scope.ac)); + } + $scope.ac = new_value; + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_ac); + $scope.stop_code(); + } + } + else if (syntax.type == "memory") { + if ($scope.check_memory_address(value) == true) { + value = parseFloat($scope.memory[value - 80]); + var new_value; + if (value < 0) { + // The exponent is negative + value = Math.abs(parseFloat(value)); + new_value = 1 / $scope.pow_repeat(parseFloat(value), parseFloat($scope.ac)); + } + else { + // The exponent is positive + new_value = $scope.pow_repeat(parseFloat(value), parseFloat($scope.ac)); + } + $scope.ac = new_value; + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else if (syntax.type == "address") { + var temp_value = $scope.memory[syntax.value - 80]; + if ($scope.check_memory_address(temp_value) == true) { + value = parseFloat($scope.memory[temp_value - 80]); + var new_value; + if (value < 0) { + // The exponent is negative + value = Math.abs(parseFloat(value)); + new_value = 1 / $scope.pow_repeat(parseFloat(value), parseFloat($scope.ac)); + } + else { + // The exponent is positive + new_value = $scope.pow_repeat(parseFloat(value), parseFloat($scope.ac)); + } + $scope.ac = new_value; + $scope.create_result($scope.line_number, "ac", $scope.ac); + $scope.line_number++; + $scope.repeater(); + } + else { + alert($scope.strings.error_memory); + $scope.stop_code(); + } + } + else { + alert($scope.strings.error_syntax); + $scope.stop_code(); + } + }; + + $scope.pow_repeat = function (exponent, base) { + if (exponent == 0) { + return 1; + } + else { + return base * $scope.pow_repeat(exponent -1, base); + } + } + + $scope.End = function (value) { + // Rap-up everything + $scope.stop_code(); + }; + + $scope.create_result = function (line, key, value) { + var result = { + line: line + 1, + first: "", + second: "", + third: "", + fourth: "", + fifth: "", + sixth: "", + ac: "", + wrt: "" + }; + + switch (key) { + case 80: + key = "first"; + break; + case 81: + key = "second"; + break; + case 82: + key = "third"; + break; + case 83: + key = "fourth"; + break; + case 84: + key = "fifth"; + break; + case 85: + key = "sixth"; + break; + case "80": + key = "first"; + break; + case "81": + key = "second"; + break; + case "82": + key = "third"; + break; + case "83": + key = "fourth"; + break; + case "84": + key = "fifth"; + break; + case "85": + key = "sixth"; + break; + case "wrt": + $scope.screen.push({result: value}); + break; + } + + result[key] = value; + $scope.results.push(result); + }; + + $scope.$apply(); +}); diff --git a/js/values/code.js b/js/values/code.js new file mode 100644 index 0000000..67f2749 --- /dev/null +++ b/js/values/code.js @@ -0,0 +1,17 @@ +var commands = [ + { name: "" }, + { name: "rda" }, + { name: "lda" }, + { name: "str" }, + { name: "wrt" }, + { name: "add" }, + { name: "sub" }, + { name: "mul" }, + { name: "div" }, + { name: "jmp" }, + { name: "jmpZ" }, + { name: "jmpL" }, + { name: "sqr" }, + { name: "pow" }, + { name: "End" } +]; \ No newline at end of file diff --git a/js/values/english.js b/js/values/english.js new file mode 100644 index 0000000..84389b8 --- /dev/null +++ b/js/values/english.js @@ -0,0 +1,32 @@ +var english_strings = { + english: "English", + spanish: "Spanish", + project_name: "Project name:", + help: "Help", + code: "Code", + result: "Result", + screen: "Screen", + add_line: "Add line", + insert_line: "Insert line", + delete_line: "Delete line", + clear_code: "Clear code", + export_code: "Export", + import_code: "Import:", + execute_code: "Execute", + pause_code: "Pause", + stop_code: "Stop", + interval: "Interval: ", + input_value: "Input value:", + error_input: "The submitted value is not a number.", + error_syntax: "Syntax error.", + error_memory: "Memory address not found.", + error_no_command: "No command detected.", + error_math: "Math error.", + error_ac: "AC is empty.", + file_load_failed: "Failed to load file!", + leave: "Are you sure you want to leave this page?", + help_text: "

Commands:
rda: Read from keyboard to memory.
lda: Load to AC.
str: Save to memory.
wrt: Print to screen.
add: Addition.
sub: Subtraction.
mul: Multiplication.
div: Division.
jmp: Jump.
jmpZ: Jump if AC is equal to 0.
jmpL: Jump if AC is less than 0.
sqr: Square root of AC.
pow: AC to the power of n
End: End program.

Symbols:
#: Use numeric value.
[]: Value in memory is an address.", + credits_description: "Language simulator based on the architecture of", + credits_john: "John von Nuemann", + credits_cromer: "Made by Christopher Cromer(chris@cromer.cl)" +}; diff --git a/js/values/spanish.js b/js/values/spanish.js new file mode 100644 index 0000000..10ca29c --- /dev/null +++ b/js/values/spanish.js @@ -0,0 +1,32 @@ +var spanish_strings = { + english: "Inglés", + spanish: "Español", + project_name: "Nombre de proyecto:", + help: "Ayuda", + code: "Código", + result: "Resultado", + screen: "Pantalla", + add_line: "Agregar linea", + insert_line: "Insertar linea", + delete_line: "Borrar linea", + clear_code: "Borrar código", + export_code: "Exportar", + import_code: "Importar:", + execute_code: "Ejecutar", + pause_code: "Pausar", + stop_code: "Parar", + interval: "Intervalo: ", + input_value: "Ingresar valor:", + error_input: "El valor ingresado no es un número.", + error_memory: "Dirreción de memoria no existe.", + error_syntax: "Error de sintaxis.", + error_no_command: "No hay commando para ejecutar.", + error_math: "Error matemático.", + error_ac: "AC es vacío.", + file_load_failed: "Cargar archivo se falló!", + leave: "Estás seguro que quieres cerrar esta pagina?", + help_text: "
Comandos:
rda: Leer del teclado a memoria.
lda: Cargar a AC.
str: Guardar a memoria.
wrt: Imprimiar a pantalla.
add: Suma.
sub: Resta.
mul: Multiplicación.
div: División.
jmp: Saltar.
jmpZ: Saltar si AC es igual a 0.
jmpL: Saltar si AC es menor de 0.
sqr: Raiz cuadrada de AC.
pow: AC a poder de n
End: Terminar programa.

Simbolos:
#: Usar valor numerico.
[]: Valor en memoria es un dirreción.", + credits_description: "Simulador de lenguaje basado en la arquitectura de", + credits_john: "John von Nuemann", + credits_cromer: "Construido por Christopher Cromer(chris@cromer.cl)" +}; diff --git a/jvon-1.0.0.0.apk b/jvon-1.0.0.0.apk new file mode 100755 index 0000000..0462537 Binary files /dev/null and b/jvon-1.0.0.0.apk differ diff --git a/ubblogo.png b/ubblogo.png new file mode 100644 index 0000000..02f27b5 Binary files /dev/null and b/ubblogo.png differ