diff --git a/.circleci/config.yml b/.circleci/config.yml index 08f1777eb..0f9922291 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,23 +32,23 @@ common_steps: &common_steps opam init --disable-sandboxing -j 1 -n -y sed -i "s/^jobs: [0-9]*/jobs: $NJOBS/g" ~/.opam/config eval $(opam env) - opam switch create 4.07.1 || true - opam switch set 4.07.1 + opam switch create $OCAML_VERSION || true + opam switch set $OCAML_VERSION opam repo add coq-released https://coq.inria.fr/opam/released || true opam update || true - run: name: "Install OCaml deps" command: | - opam install -y -v --jobs=2 ocamlbuild menhir base64 js_of_ocaml js_of_ocaml-ppx yojson atdgen re calendar uri + opam install -y -v --jobs=2 dune menhir base64 js_of_ocaml js_of_ocaml-ppx yojson atdgen re calendar uri wasm.1.0.1 - run: name: "Install Coq" command: | - opam install -y -v coq.8.8.2 coq-flocq coq-jsast + opam install -y -v coq.8.12.0 coq-flocq coq-jsast no_output_timeout: 30m - run: name: "Install Q*cert" command: | - opam install -y -v coq-qcert.1.4.1 + opam install -y -v coq-qcert.2.1.0 no_output_timeout: 30m - save_cache: <<: *common_cache_key @@ -64,7 +64,7 @@ common_steps: &common_steps name: 'Build the Ergo compiler' command: | eval $(opam env) - make setup + make configure make all - run: name: 'Testing' @@ -73,12 +73,12 @@ common_steps: &common_steps version: 2 jobs: - 4.07.1: + 4.09.1: docker: - image: circleci/openjdk:8-jdk environment: - TERM: dumb - - OCAML_VERSION: "4.07.x" + - OCAML_VERSION: "4.09.1" - CIRCLE_TEST_REPORTS: /tmp/circleci-test-results - NJOBS: 2 - NPM_CONFIG_PREFIX: "~/.npm-global" @@ -88,4 +88,4 @@ workflows: version: 2 build-deploy: jobs: - - 4.07.1 + - 4.09.1 diff --git a/.gitignore b/.gitignore index f3211ff43..d44543833 100644 --- a/.gitignore +++ b/.gitignore @@ -18,9 +18,13 @@ Makefile.config *~ .#* *.vo +*.vos +*.vok *.v.d *.glob *.aux +*.lia.cache +.Makefile.coq.d *.ctoj .DS_Store _CoqProject @@ -44,3 +48,7 @@ website/i18n/* !website/i18n/en.json *.sw[p] thumbs.db + +# generated by dune +*.merlin +*.install diff --git a/assets/APLogo.png b/APLogo.png similarity index 100% rename from assets/APLogo.png rename to APLogo.png diff --git a/DEVELOPERS.md b/DEVELOPERS.md index b3dfbe249..139a2510a 100644 --- a/DEVELOPERS.md +++ b/DEVELOPERS.md @@ -29,12 +29,12 @@ Before you can build Ergo, you must install and configure the following prerequi $ npm install -g lerna@^3.15.0 ``` -* [opam](https://opam.ocaml.org): the OCaml package manager, for OCaml 4.07.1. To install: +* [opam](https://opam.ocaml.org): the OCaml package manager, for OCaml 4.09.1. To install: ```sh $ sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) $ eval $(opam env) -$ opam switch create 4.07.1 +$ opam switch create 4.09.1 ``` #### Install development version @@ -53,8 +53,8 @@ To rebuild the compiler from the source, you will need Coq 8.8.2 and OCaml 4.07. ```sh $ opam repo add coq-released https://coq.inria.fr/opam/released -$ opam install ocamlbuild menhir base64 js_of_ocaml js_of_ocaml-ppx yojson atdgen re calendar uri -$ opam install coq.8.8.2 coq-qcert.1.4.1 +$ opam install dune menhir base64 js_of_ocaml js_of_ocaml-ppx yojson atdgen re calendar uri wasm.1.0.1 +$ opam install coq.8.8.2 coq-qcert.2.0.0 ``` ##### Build the Ergo Compiler and REPL @@ -63,7 +63,7 @@ To recompile Ergo from its source, do: ```sh $ make cleanall -$ make setup +$ make configure $ make all ``` @@ -80,7 +80,7 @@ If successful, you should find the following binaries in the `bin/` directory: We write unit and integration tests with Mocha and Cucumber. To run all of the tests once run: ```text -lerna run test +npm run test ``` ### Writing Documentation diff --git a/Makefile b/Makefile index ef2f10a8a..444af2a7b 100644 --- a/Makefile +++ b/Makefile @@ -20,20 +20,72 @@ include Makefile.coq_modules # CP=cp -FILES = $(addprefix mechanization/,$(MODULES:%=%.v)) +FILES = $(addprefix compiler/core/,$(MODULES:%=%.v)) ## Compiler all: + @$(MAKE) prepare @$(MAKE) MAKEFLAGS= ergo -# Setup -setup: - @$(MAKE) npm-setup +# Stdlib + +%.ctoj: %.cto + ./scripts/cto2ctoj.js parse $< + +compiler/lib/resources.ml: compiler/stdlib/accordproject.ctoj \ + compiler/stdlib/stdlib.ergo \ + compiler/stdlib/etime.ergo \ + compiler/stdlib/template.ergo \ + runtimes/javascript/ergo-runtime.js + echo '(* generated ocaml file *)' > compiler/lib/resources.ml + (for i in accordproject; do \ + echo "let $$i = {xxx|"; \ + cat compiler/stdlib/$$i.ctoj; \ + echo "|xxx}"; \ + done) >> compiler/lib/resources.ml + (for i in stdlib etime template; do \ + echo "let $$i = {xxx|"; \ + cat compiler/stdlib/$$i.ergo; \ + echo "|xxx}"; \ + done) >> compiler/lib/resources.ml + (for i in runtime; do \ + echo "let ergo_$$i = {xxx|"; \ + cat ./runtimes/javascript/ergo-$$i.js; \ + echo "|xxx}"; \ + done) >> compiler/lib/resources.ml + (echo `date "+let builddate = {xxx|%b %d, %Y|xxx}"`) >> compiler/lib/resources.ml + +# Configure +runtimes/javascript/ergo-runtime.js: runtimes/javascript/ergo-runtime-core.js \ + runtimes/javascript/ergo-runtime-tostring.js \ + runtimes/javascript/ergo-runtime-date-time.js \ + runtimes/javascript/ergo-runtime-log.js \ + runtimes/javascript/ergo-runtime-math.js \ + runtimes/javascript/ergo-runtime-uri.js + $(MAKE) -C ./runtimes/javascript + +./compiler/lib/js_runtime.ml: ./runtimes/javascript/ergo_runtime.ml + cp ./runtimes/javascript/ergo_runtime.ml ./compiler/lib/js_runtime.ml + +./compiler/lib/static_config.ml: + echo "(* This file is generated *)" > ./compiler/lib/static_config.ml + echo "let ergo_home = \"$(CURDIR)\"" >> ./compiler/lib/static_config.ml + +prepare: ./compiler/lib/static_config.ml compiler/lib/resources.ml Makefile.coq + $(MAKE) -C ./runtimes/javascript + +configure: + @echo "[Ergo] " + @echo "[Ergo] Configuring Build" + @echo "[Ergo] " + npm install + @$(MAKE) prepare # Regenerate the npm directory ergo: @$(MAKE) ergo-mechanization - @$(MAKE) MAKEFLAGS= ergo-extraction-refresh + @$(MAKE) MAKEFLAGS= ergo-ocaml-extraction + @$(MAKE) MAKEFLAGS= ergo-js-extraction ergo-mechanization: _CoqProject Makefile.coq @echo "[Ergo] " @@ -41,27 +93,22 @@ ergo-mechanization: _CoqProject Makefile.coq @echo "[Ergo] " @$(MAKE) -f Makefile.coq -ergo-extraction: +ergo-ocaml-extraction: @echo "[Ergo] " - @echo "[Ergo] Compiling the extracted OCaml" + @echo "[Ergo] Extracting Ergo Compiler to OCaml" @echo "[Ergo] " - @$(MAKE) -C extraction all + @$(MAKE) -C compiler/extraction + dune build @install -ergo-extraction-refresh: +ergo-js-extraction: @echo "[Ergo] " - @echo "[Ergo] Extracting mechanization to OCaml" + @echo "[Ergo] Extracting Ergo Compiler to JavaScript" @echo "[Ergo] " - @$(MAKE) -C extraction all-refresh - -npm-setup: - @echo "[Ergo] " - @echo "[Ergo] Setting up for Node.js build" - @echo "[Ergo] " - npm install + @$(MAKE) -C compiler/libjs ## Documentation documentation: - $(MAKE) -C mechanization documentation + $(MAKE) -C compiler/core documentation ## Testing test: @@ -73,20 +120,26 @@ clean-mechanization: Makefile.coq cleanall-mechanization: - @$(MAKE) -f Makefile.coq cleanall + - @rm -f ./compiler/lib/js_runtime.ml ./compiler/lib/static_config.ml compiler/lib/resources.ml - @rm -f Makefile.coq - @rm -f Makefile.coq.conf - @rm -f _CoqProject - - @find mechanization \( -name '*.vo' -or -name '*.v.d' -or -name '*.glob' -or -name '*.aux' \) -print0 | xargs -0 rm -f + - @find compiler/core \( -name '*.vo' -or -name '*.v.d' -or -name '*.glob' -or -name '*.aux' \) -print0 | xargs -0 rm -f + +clean-ocaml-extraction: + - @$(MAKE) -C compiler/extraction clean + +cleanall-ocaml-extraction: + - @$(MAKE) -C compiler/extraction cleanall + - dune clean -clean-extraction: - - @$(MAKE) -C extraction clean +clean-js-extraction: + - @$(MAKE) -C compiler/libjs clean -cleanall-extraction: - - @$(MAKE) -C extraction cleanall +cleanall-js-extraction: + - @$(MAKE) -C compiler/libjs cleanall clean-npm: - - @rm -f package-lock.json - - @rm -rf dist cleanall-npm: clean-npm - @node ./scripts/external/cleanExternalModels.js @@ -99,21 +152,24 @@ cleanall-npm: clean-npm clean: Makefile.coq - @$(MAKE) clean-npm - - @$(MAKE) clean-extraction + - @$(MAKE) clean-ocaml-extraction + - @$(MAKE) clean-js-extraction - @$(MAKE) -C packages/ergo-compiler clean - @$(MAKE) -C packages/ergo-engine clean - @$(MAKE) -C packages/ergo-cli clean + - @$(MAKE) -C runtimes/javascript clean cleanall: Makefile.coq @echo "[Ergo] " @echo "[Ergo] Cleaning up" @echo "[Ergo] " - @$(MAKE) cleanall-npm - - @$(MAKE) cleanall-extraction + - @$(MAKE) cleanall-ocaml-extraction - @$(MAKE) cleanall-mechanization - @$(MAKE) -C packages/ergo-compiler cleanall - @$(MAKE) -C packages/ergo-engine cleanall - @$(MAKE) -C packages/ergo-cli cleanall + - @$(MAKE) -C runtimes/javascript cleanall ## _CoqProject: Makefile.config @@ -121,9 +177,9 @@ _CoqProject: Makefile.config @echo "[Ergo] Setting up Coq" @echo "[Ergo] " ifneq ($(QCERT),) - (echo "-R mechanization ErgoSpec -R $(QCERT)/coq Qcert";) > _CoqProject + (echo "-R compiler/core ErgoSpec -R $(QCERT)/compiler/core Qcert";) > _CoqProject else - (echo "-R mechanization ErgoSpec";) > _CoqProject + (echo "-R compiler/core ErgoSpec";) > _CoqProject endif Makefile.coq: _CoqProject Makefile $(FILES) diff --git a/Makefile.config b/Makefile.config index 850d0da0b..bd856e227 100644 --- a/Makefile.config +++ b/Makefile.config @@ -13,4 +13,4 @@ # ## Qcert compiler location -#QCERT=../qcert-master +QCERT=qcert diff --git a/Makefile.coq_modules b/Makefile.coq_modules index 3a4681532..31755fa98 100644 --- a/Makefile.coq_modules +++ b/Makefile.coq_modules @@ -15,21 +15,36 @@ MODULES = \ Version \ Utils/Misc \ - Utils/EJSON \ + Backend/ForeignModel \ Backend/ForeignErgo \ - Backend/Model/DateTimeModelPart \ - Backend/Model/MathModelPart \ - Backend/Model/LogModelPart \ - Backend/Model/MonetaryAmountModelPart \ - Backend/Model/ErgoEnhancedModel \ - Backend/Model/ErgoBackendModel \ - Backend/Model/ErgoBackendRuntime \ - Backend/Lib/ENNRCtoJavaScript \ - Backend/Lib/ECType \ - Backend/Lib/EData \ - Backend/Lib/EOperators \ - Backend/Lib/ECodeGen \ - Backend/ErgoBackend \ + Backend/Component/DateTimeComponent \ + Backend/Component/MathComponent \ + Backend/Component/LogComponent \ + Backend/Component/MonetaryAmountComponent \ + Backend/Qcert/QcertData \ + Backend/Qcert/QcertEJson \ + Backend/Qcert/QcertDataToEJson \ + Backend/Qcert/QcertEJsonToJSON \ + Backend/Qcert/QcertToJava \ + Backend/Qcert/QcertToJavascriptAst \ + Backend/Qcert/QcertReduceOps \ + Backend/Qcert/QcertToReduceOps \ + Backend/Qcert/QcertToSpark \ + Backend/Qcert/QcertType \ + Backend/Qcert/QcertToScala \ + Backend/Qcert/QcertTypeToJSON \ + Backend/Qcert/QcertDataTyping \ + Backend/Qcert/QcertRuntime \ + Backend/Qcert/QcertTyping \ + Backend/Qcert/QcertModel \ + Backend/Qcert/QcertCompiler \ + Backend/Lib/QBackendModel \ + Backend/Lib/QBackendRuntime \ + Backend/Lib/QType \ + Backend/Lib/QData \ + Backend/Lib/QOps \ + Backend/Lib/QCodeGen \ + Backend/QLib \ Common/Provenance \ Common/Names \ Common/NamespaceContext \ @@ -37,9 +52,9 @@ MODULES = \ Common/Result \ Common/PrintTypedData \ Types/CTO \ - Types/ErgoCTypeUtil \ + Types/QcertTypeUtil \ Types/ErgoType \ - Types/ErgoTypetoErgoCType \ + Types/ErgoTypetoQcertType \ Ergo/Lang/Ergo \ Ergo/Lang/ErgoMap \ Ergo/Lang/ErgoSem \ @@ -56,6 +71,9 @@ MODULES = \ ErgoC/Lang/ErgoCExpand \ ErgoNNRC/Lang/ErgoNNRC \ ErgoNNRC/Lang/ErgoNNRCSugar \ + ErgoImp/Lang/ErgoImp \ + ErgoWasmAst/Lang/ErgoWasmAst \ + ErgoWasmBinary/Lang/ErgoWasmBinary \ Translation/CTOtoErgo \ Translation/ErgoNameResolve \ Translation/ErgoAssembly \ @@ -63,9 +81,11 @@ MODULES = \ Translation/ErgoCInline \ Translation/ErgotoErgoC \ Translation/ErgoCTtoErgoNNRC \ - Translation/ErgoNNRCtoJavaScript \ - Translation/ErgoNNRCtoCicero \ + Translation/ErgoNNRCtoErgoImp \ + Translation/ErgoImptoES6 \ Translation/ErgoNNRCtoJava \ + Translation/ErgoImptoWasmAst \ + Translation/WasmAsttoWasmBinary \ Compiler/ErgoDriver \ Compiler/ErgoCompiler \ Tests/HelloWorld diff --git a/README.md b/README.md index 2b00c8c22..765071ad4 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ Options: To create a contract text from a contract: ```sh -$ ergo draft --template ./examples/volumediscount --data ./examples/volumediscount/data.json +$ ergo draft --template ./tests/volumediscount --data ./tests/volumediscount/data.json ``` ### Initialize a contract @@ -88,7 +88,7 @@ $ ergo draft --template ./examples/volumediscount --data ./examples/volumediscou To obtain the initial state of the contract: ```sh -$ ergo initialize --template ./examples/volumediscount --data ./examples/volumediscount/data.json +$ ergo initialize --template ./tests/volumediscount --data ./tests/volumediscount/data.json 06:40:29 - info: ``` @@ -97,7 +97,7 @@ $ ergo initialize --template ./examples/volumediscount --data ./examples/volumed To send a request to a contract: ```sh -$ ergo trigger --template ./examples/volumediscount --data ./examples/volumediscount/data.json --request ./examples/volumediscount/request.json --state ./examples/volumediscount/state.json +$ ergo trigger --template ./tests/volumediscount --data ./tests/volumediscount/data.json --request ./tests/volumediscount/request.json --state ./tests/volumediscount/state.json 06:40:01 - info: { "clause": "orgXaccordprojectXvolumediscountXVolumeDiscount", @@ -124,7 +124,7 @@ $ ergo trigger --template ./examples/volumediscount --data ./examples/volumedisc To invoke a specific clause of the contract: ```sh -$ ergo invoke --template ./examples/volumediscount --clauseName volumediscount --data ./examples/volumediscount/data.json --params ./examples/volumediscount/params.json --state ./examples/volumediscount/state.json +$ ergo invoke --template ./tests/volumediscount --clauseName volumediscount --data ./tests/volumediscount/data.json --params ./tests/volumediscount/params.json --state ./tests/volumediscount/state.json ``` ### Compile a contract @@ -132,12 +132,12 @@ $ ergo invoke --template ./examples/volumediscount --clauseName volumediscount - To compile your first Ergo contract to JavaScript: ```sh -$ ergo compile ./examples/volumediscount/model/model.cto ./examples/volumediscount/logic/logic.ergo -Processing file: ./examples/volumediscount/logic.ergo -- compiled to: ./examples/volumediscount/logic.js +$ ergo compile ./tests/volumediscount/model/model.cto ./tests/volumediscount/logic/logic.ergo +Processing file: ./tests/volumediscount/logic.ergo -- compiled to: ./tests/volumediscount/logic.js ``` By default, Ergo compiles to JavaScript for execution. You can inspect -the compiled JavaScript code in `./examples/volumediscount/logic.js` +the compiled JavaScript code in `./tests/volumediscount/logic.js` [npmpkg]: https://www.npmjs.com/package/@accordproject/ergo-cli @@ -152,7 +152,7 @@ the compiled JavaScript code in `./examples/volumediscount/logic.js`
@@ -168,7 +168,6 @@ Accord Project is an open source, non-profit, initiative working to transform co * [Accord Project Technical Documentation][apdoc] * [Accord Project GitHub][apgit] - ### Documentation * [Getting Started with Accord Project][docwelcome] * [Concepts and High-level Architecture][dochighlevel] diff --git a/backends/javascript/ergo-runtime.js b/backends/javascript/ergo-runtime.js deleted file mode 100644 index 3478b16dd..000000000 --- a/backends/javascript/ergo-runtime.js +++ /dev/null @@ -1,934 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Initialize inheritance */ -var inheritance; - -/* "standard library" (implementation of unary and binary operators) */ -function unwrap(doc) { - // Unwrap for Enhanced TxStore format - if ("state" in doc && !("$class" in doc)) { - if (doc.state == "COMMITTED") - return JSON.parse(doc.currentValue); - else - return null; // Not sure if we will need something more fancy for un-committed data - } - // Leave as-is - else - return doc; -} -function concat(r1, r2) { - var result = { }; - for (var key2 in r2) - result[key2] = r2[key2]; - for (var key1 in r1) - if (!(key1 in r2)) - result[key1] = r1[key1]; - return result; -} -function contains(v, b) { - for (var i=0; i>>0){if(93<=p)u=1}else
if(56<(p-1|0)>>>0){j=1;u=1}if(!u){var
q=1;j=2}}else
@@ -2188,165 +2319,165 @@ if(8<=g)j=1;switch(j){case
q=4;break;case
1:var
q=2;break}a[1]=a[1]+q|0;var
-E=l+1|0;if(v!==l){var
-l=E;continue}break}}if(a[1]===fo(f))var
-y=o7(f);else{var
-b=cN(a[1]);a[1]=0;var
-x=fo(f)-1|0,C=0;if(!(x<0)){var
+E=m+1|0;if(v!==m){var
+m=E;continue}break}}if(a[1]===e1(e))var
+y=sQ(e);else{var
+b=cb(a[1]);a[1]=0;var
+w=e1(e)-1|0,C=0;if(!(w<0)){var
k=C;for(;;){var
-c=l8(f,k),d=0;if(35<=c)if(92===c)d=2;else
-if(dY<=c)d=1;else
+c=i7(e,k),d=0;if(35<=c)if(92===c)d=2;else
+if(cU<=c)d=1;else
d=3;else
if(32<=c)if(34<=c)d=2;else
d=3;else
if(14<=c)d=1;else
switch(c){case
-8:d9(b,a[1],92);a[1]++;d9(b,a[1],98);break;case
-9:d9(b,a[1],92);a[1]++;d9(b,a[1],e);break;case
-10:d9(b,a[1],92);a[1]++;d9(b,a[1],i);break;case
-13:d9(b,a[1],92);a[1]++;d9(b,a[1],h);break;default:d=1}switch(d){case
-1:d9(b,a[1],92);a[1]++;d9(b,a[1],48+(c/n|0)|0);a[1]++;d9(b,a[1],48+((c/10|0)%10|0)|0);a[1]++;d9(b,a[1],48+(c%10|0)|0);break;case
-2:d9(b,a[1],92);a[1]++;d9(b,a[1],c);break;case
-3:d9(b,a[1],c);break}a[1]++;var
-D=k+1|0;if(x!==k){var
+8:dy(b,a[1],92);a[1]++;dy(b,a[1],98);break;case
+9:dy(b,a[1],92);a[1]++;dy(b,a[1],f);break;case
+10:dy(b,a[1],92);a[1]++;dy(b,a[1],i);break;case
+13:dy(b,a[1],92);a[1]++;dy(b,a[1],h);break;default:d=1}switch(d){case
+1:dy(b,a[1],92);a[1]++;dy(b,a[1],48+(c/l|0)|0);a[1]++;dy(b,a[1],48+((c/10|0)%10|0)|0);a[1]++;dy(b,a[1],48+(c%10|0)|0);break;case
+2:dy(b,a[1],92);a[1]++;dy(b,a[1],c);break;case
+3:dy(b,a[1],c);break}a[1]++;var
+D=k+1|0;if(w!==k){var
k=D;continue}break}}var
y=b}var
-s=d$(y)}var
-z=J(s),A=gK(z+2|0,34);gY(s,0,A,1,z);return d$(A)}}function
-mu(m,a){if(13<=m){var
-g=[0,0],h=J(a)-1|0,n=0;if(!(h<0)){var
-c=n;for(;;){if(!(9<(w(a,c)+fl|0)>>>0))g[1]++;var
+s=eA(y)}var
+z=L(s),A=h0(z+2|0,34);io(s,0,A,1,z);return eA(A)}}function
+pw(m,a){if(13<=m){var
+g=[0,0],h=L(a)-1|0,n=0;if(!(h<0)){var
+c=n;for(;;){if(!(9<(x(a,c)+fU|0)>>>0))g[1]++;var
q=c+1|0;if(h!==c){var
c=q;continue}break}}var
-i=g[1],j=cN(J(a)+((i-1|0)/3|0)|0),k=[0,0],d=function(a){dV(j,k[1],a);k[1]++;return 0},e=[0,((i-1|0)%3|0)+1|0],l=J(a)-1|0,o=0;if(!(l<0)){var
+i=g[1],j=cb(L(a)+((i-1|0)/3|0)|0),k=[0,0],d=function(a){cR(j,k[1],a);k[1]++;return 0},e=[0,((i-1|0)%3|0)+1|0],l=L(a)-1|0,o=0;if(!(l<0)){var
b=o;for(;;){var
-f=w(a,b);if(9<(f+fl|0)>>>0)d(f);else{if(0===e[1]){d(95);e[1]=3}e[1]+=-1;d(f)}var
+f=x(a,b);if(9<(f+fU|0)>>>0)d(f);else{if(0===e[1]){d(95);e[1]=3}e[1]+=-1;d(f)}var
p=b+1|0;if(l!==b){var
-b=p;continue}break}}return d$(j)}return a}function
-Gp(b,c){switch(b){case
+b=p;continue}break}}return eA(j)}return a}function
+OG(b,c){switch(b){case
1:var
-a=FC;break;case
+a=NT;break;case
2:var
-a=FD;break;case
+a=NU;break;case
4:var
-a=FF;break;case
+a=NW;break;case
5:var
-a=FG;break;case
+a=NX;break;case
6:var
-a=FH;break;case
+a=NY;break;case
7:var
-a=FI;break;case
+a=NZ;break;case
8:var
-a=FJ;break;case
+a=N0;break;case
9:var
-a=FK;break;case
+a=N1;break;case
10:var
-a=FL;break;case
+a=N2;break;case
11:var
-a=FM;break;case
+a=N3;break;case
0:case
13:var
-a=FB;break;case
+a=NS;break;case
3:case
14:var
-a=FE;break;default:var
-a=FN}return mu(b,oL(a,c))}function
-Gq(b,c){switch(b){case
+a=NV;break;default:var
+a=N4}return pw(b,o7(a,c))}function
+OH(b,c){switch(b){case
1:var
-a=F2;break;case
+a=Oh;break;case
2:var
-a=F3;break;case
+a=Oi;break;case
4:var
-a=F5;break;case
+a=Ok;break;case
5:var
-a=F6;break;case
+a=Ol;break;case
6:var
-a=F7;break;case
+a=Om;break;case
7:var
-a=F8;break;case
+a=On;break;case
8:var
-a=F9;break;case
+a=Oo;break;case
9:var
-a=F_;break;case
+a=Op;break;case
10:var
-a=F$;break;case
+a=Oq;break;case
11:var
-a=Ga;break;case
+a=Or;break;case
0:case
13:var
-a=F1;break;case
+a=Og;break;case
3:case
14:var
-a=F4;break;default:var
-a=Gb}return mu(b,oL(a,c))}function
-Gr(b,c){switch(b){case
+a=Oj;break;default:var
+a=Os}return pw(b,o7(a,c))}function
+OI(b,c){switch(b){case
1:var
-a=Gd;break;case
+a=Ou;break;case
2:var
-a=Ge;break;case
+a=Ov;break;case
4:var
-a=Gg;break;case
+a=Ox;break;case
5:var
-a=Gh;break;case
+a=Oy;break;case
6:var
-a=Gi;break;case
+a=Oz;break;case
7:var
-a=Gj;break;case
+a=OA;break;case
8:var
-a=Gk;break;case
+a=OB;break;case
9:var
-a=Gl;break;case
+a=OC;break;case
10:var
-a=Gm;break;case
+a=OD;break;case
11:var
-a=Gn;break;case
+a=OE;break;case
0:case
13:var
-a=Gc;break;case
+a=Ot;break;case
3:case
14:var
-a=Gf;break;default:var
-a=Go}return mu(b,oL(a,c))}function
-Gs(b,c){switch(b){case
+a=Ow;break;default:var
+a=OF}return pw(b,o7(a,c))}function
+OJ(b,c){switch(b){case
1:var
-a=FP;break;case
+a=N6;break;case
2:var
-a=FQ;break;case
+a=N7;break;case
4:var
-a=FS;break;case
+a=N9;break;case
5:var
-a=FT;break;case
+a=N_;break;case
6:var
-a=FU;break;case
+a=N$;break;case
7:var
-a=FV;break;case
+a=Oa;break;case
8:var
-a=FW;break;case
+a=Ob;break;case
9:var
-a=FX;break;case
+a=Oc;break;case
10:var
-a=FY;break;case
+a=Od;break;case
11:var
-a=FZ;break;case
+a=Oe;break;case
0:case
13:var
-a=FO;break;case
+a=N5;break;case
3:case
14:var
-a=FR;break;default:var
-a=F0}return mu(b,aHr(a,c))}function
-hA(c,l,g){if(6<=c[2]){switch(c[1]){case
+a=N8;break;default:var
+a=Of}return pw(b,Ll(a,c))}function
+je(d,l,g){if(6<=d[2]){switch(d[1]){case
0:var
i=45;break;case
1:var
i=43;break;default:var
i=32}var
-m=aHm(g,l,i);return 7<=c[2]?d$(kD(sR,fR(m))):m}var
-q=h1(l),p=s$?s$[1]:70;switch(c[2]){case
+m=a8K(g,l,i);return 7<=d[2]?eA(no(xE,gX(m))):m}var
+q=jS(l),p=yb?yb[1]:70;switch(d[2]){case
0:var
-a=C;break;case
+a=D;break;case
1:var
-a=f;break;case
+a=e;break;case
2:var
a=69;break;case
3:var
@@ -2356,84 +2487,70 @@ a=71;break;case
5:var
a=p;break;case
6:var
-a=F;break;default:var
+a=G;break;default:var
a=72}var
-b=s8(16);kF(b,37);switch(c[1]){case
+c=x_(16);nr(c,37);switch(d[1]){case
0:break;case
-1:kF(b,43);break;default:kF(b,32)}kF(b,46);eX(b,d(az+q));kF(b,a);var
-e=Do(s_(b),g);if(5===c[2]){var
-n=so(g),r=J(e);if(3===n)return g<0.?Gt:Gu;if(4<=n)return Gv;var
+1:nr(c,43);break;default:nr(c,32)}nr(c,46);fH(c,b(av+q));nr(c,a);var
+f=Lj(ya(c),g);if(5===d[2]){var
+n=w9(g),r=L(f);if(3===n)return g<0.?OK:OL;if(4<=n)return OM;var
h=0;for(;;){if(h===r)var
o=0;else{var
-j=aL(e,h)+AS|0,k=0;if(23>>0)if(9<=s)var
+j=[0,[9,k+fU|0],g+1|0];else
+l=1;else
if(0===s){var
-H=v[1];v[1]++;var
-u=w(g+1|0),p=u[2],C=0,I=u[1];if((p+1|0)