diff --git a/.gitignore b/.gitignore index 19d8a18aa..50249f9f1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,5 @@ project.properties .settings build/ .gradle -!opensrp-app/assets/web/build/ -!opensrp-app/assets/web/lib/enketo-core/build/ +!ei.opensrp-app/assets/web/build/ +!ei.opensrp-app/assets/web/lib/enketo-core/build/ diff --git a/.travis.yml b/.travis.yml index 76182d35b..35859016f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,11 +47,11 @@ script: # Enable the line below once we get all the test passing, currently most of the tests are failing # so we'll just if the project compiles #- ./gradlew connectedAndroidTest - - ./gradlew opensrp-mcare:connectedAndroidTest -i --stacktrace + - ./gradlew ei.opensrp-mcare:connectedAndroidTest -i --stacktrace after_failure: -- pandoc opensrp-mcare/build/reports/androidTests/connected/index.html -t plain +- pandoc ei.opensrp-mcare/build/reports/androidTests/connected/index.html -t plain notifications: slack: diff --git a/README.md b/README.md index 041bff894..fb314c011 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Dristhi](opensrp-app/res/drawable-mdpi/login_logo.png)] (https://smartregister.atlassian.net/wiki/dashboard.action) +[![Dristhi](ei.opensrp-app/res/drawable-mdpi/login_logo.png)] (https://smartregister.atlassian.net/wiki/dashboard.action) To run this project, you need to do this: ======================================== @@ -21,4 +21,4 @@ Login (for demo server): login-username - demotest, login-password - Demot123 -Check app.properties file in "drishti-app/asset/" folder to change the demo server url to your own instance of opensrp server. +Check app.properties file in "drishti-app/asset/" folder to change the demo server url to your own instance of ei.opensrp server. diff --git a/build.gradle b/build.gradle index 155db0976..73692a86f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,30 +1,61 @@ -configure(allprojects) { project -> - buildscript { - repositories { - jcenter() - mavenCentral() - maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } - mavenLocal() +buildscript { + System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true' + + dependencies { + classpath 'com.android.tools.build:gradle:2.3.2' + //classpath 'com.google.gms:google-services:3.0.0' + } +} + +allprojects { + repositories { + jcenter() + maven { url "$rootDir/repo/" } + maven { url = 'https://oss.sonatype.org/content/groups/public' } + maven { + url "${projectDir}/opensrp-app/../libs/" } + maven { + url "${projectDir}/opensrp-app-it/../libs/" + } + mavenLocal() } } +configurations.all { + transitive = true +} + +//configure(allprojects) { project -> +// buildscript { +// System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true' +// +// repositories { +// jcenter() +// mavenCentral() +// maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } +// mavenLocal() +// } +// } +//} + project.ext.preDexLibs = !project.hasProperty('disablePreDex') -subprojects { +/*subprojects { group = 'org.ei.opensrp' - ext.androidToolsBuildGradle = '21.1.2' - ext.androidBuildToolsVersion = '21.1.2' - ext.androidMinSdkVersion = 16 - ext.androidCompileSdkVersion = 21 + ext.androidToolsBuildGradle = "25.0.2" + ext.androidBuildToolsVersion = "25.0.2" + ext.androidMinSdkVersion = 19 + ext.androidCompileSdkVersion = 24 ext.androidTargetSdkVersion = 21 ext.androidAnnotationsVersion = '3.0.1'; ext.androidAnnotationsAPIVersion = '3.0.1'; repositories { + jcenter() mavenCentral() maven { url "${projectDir}/libs/" } maven { url "http://nexus.motechproject.org/content/repositories/drishti" } @@ -49,7 +80,7 @@ subprojects { project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs } } -} +}*/ apply plugin : 'java' apply plugin : 'build-dashboard' diff --git a/gradle-app.setting b/gradle-app.setting index 35224f6d5..60b0d55d4 100644 --- a/gradle-app.setting +++ b/gradle-app.setting @@ -9,7 +9,7 @@ - + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4d50984cd..792420ce5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Jun 30 10:30:31 WITA 2015 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip +#Mon Jan 09 15:48:09 PKT 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/hs_err_pid22668.log b/hs_err_pid22668.log index 4789fe007..1d49ec2e3 100644 --- a/hs_err_pid22668.log +++ b/hs_err_pid22668.log @@ -320,7 +320,7 @@ eaa80000-100000000 rw-p 00000000 00:00 0 7fb030021000-7fb034000000 ---p 00000000 00:00 0 7fb034000000-7fb034021000 rw-p 00000000 00:00 0 7fb034021000-7fb038000000 ---p 00000000 00:00 0 -7fb03b000000-7fb03b002000 r--s 0000c000 08:01 8258553 /home/raihan/OpenSrpWorkSpace/opensrp-client/opensrp-app/libs/butterknife-7.0.1.jar +7fb03b000000-7fb03b002000 r--s 0000c000 08:01 8258553 /home/raihan/OpenSrpWorkSpace/ei.opensrp-client/ei.opensrp-app/libs/butterknife-7.0.1.jar 7fb03b017000-7fb03b018000 rw-p 00000000 00:00 0 7fb03b018000-7fb03b01b000 ---p 00000000 00:00 0 7fb03b01b000-7fb03b119000 rw-p 00000000 00:00 0 diff --git a/hs_err_pid22795.log b/hs_err_pid22795.log index a98da8b95..5dfa56f99 100644 --- a/hs_err_pid22795.log +++ b/hs_err_pid22795.log @@ -292,7 +292,7 @@ eaa80000-100000000 rw-p 00000000 00:00 0 7f9ec0021000-7f9ec4000000 ---p 00000000 00:00 0 7f9ec4000000-7f9ec4e74000 rw-p 00000000 00:00 0 7f9ec4e74000-7f9ec8000000 ---p 00000000 00:00 0 -7f9ecb41e000-7f9ecb420000 r--s 0000c000 08:01 9582194 /home/raihan/OpenSrpWorkSpace/opensrp-client/opensrp-mcare/build/intermediates/exploded-aar/org.ei.opensrp/opensrp-app/unspecified/jars/libs/butterknife-7.0.1.jar +7f9ecb41e000-7f9ecb420000 r--s 0000c000 08:01 9582194 /home/raihan/OpenSrpWorkSpace/ei.opensrp-client/ei.opensrp-mcare/build/intermediates/exploded-aar/org.org.ei.opensrp.core.widget.opensrp/ei.opensrp-app/unspecified/jars/libs/butterknife-7.0.1.jar 7f9ecb420000-7f9ecb423000 ---p 00000000 00:00 0 7f9ecb423000-7f9ecb521000 rw-p 00000000 00:00 0 7f9ecb521000-7f9ecb524000 ---p 00000000 00:00 0 @@ -309,7 +309,7 @@ eaa80000-100000000 rw-p 00000000 00:00 0 7f9ecba29000-7f9ecbb27000 rw-p 00000000 00:00 0 [stack:22832] 7f9ecbb27000-7f9ecbb2a000 ---p 00000000 00:00 0 7f9ecbb2a000-7f9ecbc28000 rw-p 00000000 00:00 0 [stack:22831] -7f9ecbc28000-7f9ecbc2a000 r--s 0000c000 08:01 8258553 /home/raihan/OpenSrpWorkSpace/opensrp-client/opensrp-app/libs/butterknife-7.0.1.jar +7f9ecbc28000-7f9ecbc2a000 r--s 0000c000 08:01 8258553 /home/raihan/OpenSrpWorkSpace/ei.opensrp-client/ei.opensrp-app/libs/butterknife-7.0.1.jar 7f9ecbc3f000-7f9ecbc40000 rw-p 00000000 00:00 0 7f9ecbc40000-7f9ecbc48000 r--s 000a8000 08:01 7733561 /home/raihan/android-studio/gradle/m2repository/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar 7f9ecbc48000-7f9ecbc4a000 r--s 0000d000 08:01 7733686 /home/raihan/android-studio/gradle/m2repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar diff --git a/opensrp-app/AndroidManifest.xml b/opensrp-app/AndroidManifest.xml index 467d79c08..f48c6c4de 100644 --- a/opensrp-app/AndroidManifest.xml +++ b/opensrp-app/AndroidManifest.xml @@ -16,13 +16,8 @@ - diff --git a/opensrp-app/assets/www/enketo/js/enketo-dristhi-combined.min.js b/opensrp-app/assets/www/enketo/js/enketo-dristhi-combined.min.js index cb7202048..95de8d081 100644 --- a/opensrp-app/assets/www/enketo/js/enketo-dristhi-combined.min.js +++ b/opensrp-app/assets/www/enketo/js/enketo-dristhi-combined.min.js @@ -2,30 +2,30 @@ * @license RequireJS 2.1.9 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details - */ - -/** - * Copyright (C) 2012 Martijn van de Rijdt for JavaRosa functions added to XPathJS to make XPathJS_javarosa - * - * Original copyright notice for XPathJS: - * - * Copyright (C) 2011 Andrej Pavlovic for XPathJS - * - * This file is part of XPathJS. - * - * XPathJS is free software: you can redistribute it and/or modify it under - * the terms of the GNU Affero General Public License as published by the Free - * Software Foundation, version 3 of the License. - * - * XPathJS is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more - * details. - * - * You should have received a copy of the GNU Affero General Public License along - * with this program. If not, see . - */ - + */ + +/** + * Copyright (C) 2012 Martijn van de Rijdt for JavaRosa functions added to XPathJS to make XPathJS_javarosa + * + * Original copyright notice for XPathJS: + * + * Copyright (C) 2011 Andrej Pavlovic for XPathJS + * + * This file is part of XPathJS. + * + * XPathJS is free software: you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License as published by the Free + * Software Foundation, version 3 of the License. + * + * XPathJS is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License along + * with this program. If not, see . + */ + /*! * jQuery JavaScript Library v2.1.0 * http://jquery.com/ @@ -38,8 +38,8 @@ * http://jquery.org/license * * Date: 2014-01-23T21:10Z - */ - + */ + /*! * Sizzle CSS Selector Engine v1.10.16 * http://sizzlejs.com/ @@ -49,8 +49,8 @@ * http://jquery.org/license * * Date: 2014-01-13 - */ - + */ + /** * Simple XPath Compatibility Plugin for jQuery 1.1 * By John Resig @@ -60,76 +60,76 @@ * * @param {string} selector [description] * @return {?(Array.<(Element|null)>|Element)} [description] - */ - + */ + /** * @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/requirejs/text for details - */ - + */ + /*! * Bootstrap v3.1.1 (http://getbootstrap.com) * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - */ - + */ + /* ======================================================================== * Bootstrap: transition.js v3.1.1 * http://getbootstrap.com/javascript/#transitions * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: alert.js v3.1.1 * http://getbootstrap.com/javascript/#alerts * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: button.js v3.1.1 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: carousel.js v3.1.1 * http://getbootstrap.com/javascript/#carousel * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: collapse.js v3.1.1 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: dropdown.js v3.1.1 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: modal.js v3.1.1 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: tooltip.js v3.1.1 * http://getbootstrap.com/javascript/#tooltip @@ -137,40 +137,40 @@ * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: popover.js v3.1.1 * http://getbootstrap.com/javascript/#popovers * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: scrollspy.js v3.1.1 * http://getbootstrap.com/javascript/#scrollspy * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: tab.js v3.1.1 * http://getbootstrap.com/javascript/#tabs * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* ======================================================================== * Bootstrap: affix.js v3.1.1 * http://getbootstrap.com/javascript/#affix * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - + * ======================================================================== */ + /* * @fileOverview TouchSwipe - jQuery Plugin * @version 1.6.5 @@ -256,8 +256,8 @@ * $Date: 2013-08-24 (Sat, 24 Aug 2013) $ * $version 1.6.5 - Merged a few pull requests fixing various bugs, added AMD support. -*/ - +*/ + /** * @preserve Copyright 2012 Martijn van de Rijdt & Modi Labs * @@ -272,8 +272,8 @@ * 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. - */ - + */ + /** * @preserve Copyright 2012 Martijn van de Rijdt * @@ -288,8 +288,8 @@ * 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. - */ - + */ + /** * @preserve Copyright 2012 Silvio Moreto, Martijn van de Rijdt & Modilabs * @@ -304,8 +304,8 @@ * 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. - */ - + */ + /** * @preserve Copyright 2012 Martijn van de Rijdt & Modilabs * @@ -320,8 +320,8 @@ * 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. - */ - + */ + /** * @preserve Copyright 2013 Martijn van de Rijdt & Modi Labs * @@ -336,8 +336,8 @@ * 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. - */ - + */ + /*! * Timepicker Component for Twitter Bootstrap * @@ -347,8 +347,8 @@ * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. - */ - + */ + /* ========================================================= * bootstrap-datepicker.js * Repo: https://github.com/eternicode/bootstrap-datepicker/ @@ -369,8 +369,8 @@ * 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. - * ========================================================= */ - + * ========================================================= */ + function getURLParameter(e){return decodeURI((RegExp(e+"=(.+?)(&|$)").exec(location.search)||[,null])[1])}var requirejs,require,define;if(function(global){function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var n;for(n=0;n-1&&(!e[n]||!t(e[n],n,e));n-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var n;for(n in e)if(hasProp(e,n)&&t(e[n],n))break}function mixin(e,t,n,i){return t&&eachProp(t,function(t,r){(n||!hasProp(e,r))&&(i&&"string"!=typeof t?(e[r]||(e[r]={}),mixin(e[r],t,n,i)):e[r]=t)}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,n,i){var r=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return r.requireType=e,r.requireModules=i,n&&(r.originalError=n),r}function newContext(e){function t(e){var t,n;for(t=0;e[t];t+=1)if(n=e[t],"."===n)e.splice(t,1),t-=1;else if(".."===n){if(1===t&&(".."===e[2]||".."===e[0]))break;t>0&&(e.splice(t-1,2),t-=2)}}function n(e,n,i){var r,o,a,s,l,u,c,d,p,h,f,g=n&&n.split("/"),m=g,v=_.map,y=v&&v["*"];if(e&&"."===e.charAt(0)&&(n?(m=getOwn(_.pkgs,n)?g=[n]:g.slice(0,g.length-1),e=m.concat(e.split("/")),t(e),o=getOwn(_.pkgs,r=e[0]),e=e.join("/"),o&&e===r+"/"+o.main&&(e=r)):0===e.indexOf("./")&&(e=e.substring(2))),i&&v&&(g||y)){for(s=e.split("/"),l=s.length;l>0;l-=1){if(c=s.slice(0,l).join("/"),g)for(u=g.length;u>0;u-=1)if(a=getOwn(v,g.slice(0,u).join("/")),a&&(a=getOwn(a,c))){d=a,p=l;break}if(d)break;!h&&y&&getOwn(y,c)&&(h=getOwn(y,c),f=l)}!d&&h&&(d=h,p=f),d&&(s.splice(0,p,d),e=s.join("/"))}return e}function i(e){isBrowser&&each(scripts(),function(t){return t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===w.contextName?(t.parentNode.removeChild(t),!0):void 0})}function r(e){var t=getOwn(_.paths,e);return t&&isArray(t)&&t.length>1?(t.shift(),w.require.undef(e),w.require([e]),!0):void 0}function o(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function a(e,t,i,r){var a,s,l,u,c=null,d=t?t.name:null,p=e,h=!0,f="";return e||(h=!1,e="_@r"+(M+=1)),u=o(e),c=u[0],e=u[1],c&&(c=n(c,d,r),s=getOwn(S,c)),e&&(c?f=s&&s.normalize?s.normalize(e,function(e){return n(e,d,r)}):n(e,d,r):(f=n(e,d,r),u=o(f),c=u[0],f=u[1],i=!0,a=w.nameToUrl(f))),l=!c||s||i?"":"_unnormalized"+(A+=1),{prefix:c,name:f,parentMap:t,unnormalized:!!l,url:a,originalName:p,isDefine:h,id:(c?c+"!"+f:f)+l}}function s(e){var t=e.id,n=getOwn(T,t);return n||(n=T[t]=new w.Module(e)),n}function l(e,t,n){var i=e.id,r=getOwn(T,i);!hasProp(S,i)||r&&!r.defineEmitComplete?(r=s(e),r.error&&"error"===t?n(r.error):r.on(t,n)):"defined"===t&&n(S[i])}function u(e,t){var n=e.requireModules,i=!1;t?t(e):(each(n,function(t){var n=getOwn(T,t);n&&(n.error=e,n.events.error&&(i=!0,n.emit("error",e)))}),i||req.onError(e))}function c(){globalDefQueue.length&&(apsp.apply(C,[C.length-1,0].concat(globalDefQueue)),globalDefQueue=[])}function d(e){delete T[e],delete E[e]}function p(e,t,n){var i=e.map.id;e.error?e.emit("error",e.error):(t[i]=!0,each(e.depMaps,function(i,r){var o=i.id,a=getOwn(T,o);!a||e.depMatched[r]||n[o]||(getOwn(t,o)?(e.defineDep(r,S[o]),e.check()):p(a,t,n))}),n[i]=!0)}function h(){var e,t,n,o,a=1e3*_.waitSeconds,s=a&&w.startTime+a<(new Date).getTime(),l=[],c=[],d=!1,f=!0;if(!y){if(y=!0,eachProp(E,function(n){if(e=n.map,t=e.id,n.enabled&&(e.isDefine||c.push(n),!n.error))if(!n.inited&&s)r(t)?(o=!0,d=!0):(l.push(t),i(t));else if(!n.inited&&n.fetched&&e.isDefine&&(d=!0,!e.prefix))return f=!1}),s&&l.length)return n=makeError("timeout","Load timeout for modules: "+l,null,l),n.contextName=w.contextName,u(n);f&&each(c,function(e){p(e,{},{})}),s&&!o||!d||!isBrowser&&!isWebWorker||k||(k=setTimeout(function(){k=0,h()},50)),y=!1}}function f(e){hasProp(S,e[0])||s(a(e[0],null,!0)).init(e[1],e[2])}function g(e,t,n,i){e.detachEvent&&!isOpera?i&&e.detachEvent(i,t):e.removeEventListener(n,t,!1)}function m(e){var t=e.currentTarget||e.srcElement;return g(t,w.onScriptLoad,"load","onreadystatechange"),g(t,w.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function v(){var e;for(c();C.length;){if(e=C.shift(),null===e[0])return u(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));f(e)}}var y,b,w,x,k,_={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},T={},E={},D={},C=[],S={},N={},M=1,A=1;return x={require:function(e){return e.require?e.require:e.require=w.makeRequire(e.map)},exports:function(e){return e.usingExports=!0,e.map.isDefine?e.exports?e.exports:e.exports=S[e.map.id]={}:void 0},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){var t,n=getOwn(_.pkgs,e.map.id);return t=n?getOwn(_.config,e.map.id+"/"+n.main):getOwn(_.config,e.map.id),t||{}},exports:S[e.map.id]}}},b=function(e){this.events=getOwn(D,e.id)||{},this.map=e,this.shim=getOwn(_.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},b.prototype={init:function(e,t,n,i){i=i||{},this.inited||(this.factory=t,n?this.on("error",n):this.events.error&&(n=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=i.ignore,i.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,w.startTime=(new Date).getTime();var e=this.map;return this.shim?void w.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})):e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;N[e]||(N[e]=!0,w.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,n=this.map.id,i=this.depExports,r=this.exports,o=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(o)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{r=w.execCb(n,o,i,r)}catch(a){e=a}else r=w.execCb(n,o,i,r);if(this.map.isDefine&&(t=this.module,t&&void 0!==t.exports&&t.exports!==this.exports?r=t.exports:void 0===r&&this.usingExports&&(r=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",u(this.error=e)}else r=o;this.exports=r,this.map.isDefine&&!this.ignore&&(S[n]=r,req.onResourceLoad&&req.onResourceLoad(w,this.map,this.depMaps)),d(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,i=a(e.prefix);this.depMaps.push(i),l(i,"defined",bind(this,function(i){var r,o,c,p=this.map.name,h=this.map.parentMap?this.map.parentMap.name:null,f=w.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(i.normalize&&(p=i.normalize(p,function(e){return n(e,h,!0)})||""),o=a(e.prefix+"!"+p,this.map.parentMap),l(o,"defined",bind(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),c=getOwn(T,o.id),void(c&&(this.depMaps.push(o),this.events.error&&c.on("error",bind(this,function(e){this.emit("error",e)})),c.enable()))):(r=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),r.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(T,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&d(e.map.id)}),u(e)}),r.fromText=bind(this,function(n,i){var o=e.name,l=a(o),c=useInteractive;i&&(n=i),c&&(useInteractive=!1),s(l),hasProp(_.config,t)&&(_.config[o]=_.config[t]);try{req.exec(n)}catch(d){return u(makeError("fromtexteval","fromText eval for "+t+" failed: "+d,d,[t]))}c&&(useInteractive=!0),this.depMaps.push(l),w.completeLoad(o),f([o],r)}),void i.load(e.name,f,r,_))})),w.enable(i,this),this.pluginMaps[i.id]=i},enable:function(){E[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var n,i,r;if("string"==typeof e){if(e=a(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,r=getOwn(x,e.id))return void(this.depExports[t]=r(this));this.depCount+=1,l(e,"defined",bind(this,function(e){this.defineDep(t,e),this.check()})),this.errback&&l(e,"error",bind(this,this.errback))}n=e.id,i=T[n],hasProp(x,n)||!i||i.enabled||w.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(T,e.id);t&&!t.enabled&&w.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},w={config:_,contextName:e,registry:T,defined:S,urlFetched:N,defQueue:C,Module:b,makeModuleMap:a,nextTick:req.nextTick,onError:u,configure:function(e){e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/");var t=_.pkgs,n=_.shim,i={paths:!0,config:!0,map:!0};eachProp(e,function(e,t){i[t]?"map"===t?(_.map||(_.map={}),mixin(_[t],e,!0,!0)):mixin(_[t],e,!0):_[t]=e}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=w.makeShimExports(e)),n[t]=e}),_.shim=n),e.packages&&(each(e.packages,function(e){var n;e="string"==typeof e?{name:e}:e,n=e.location,t[e.name]={name:e.name,location:n||e.name,main:(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}}),_.pkgs=t),eachProp(T,function(e,t){e.inited||e.map.unnormalized||(e.map=a(t))}),(e.deps||e.callback)&&w.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,r){function o(n,i,l){var c,d,p;return r.enableBuildCallback&&i&&isFunction(i)&&(i.__requireJsBuild=!0),"string"==typeof n?isFunction(i)?u(makeError("requireargs","Invalid require call"),l):t&&hasProp(x,n)?x[n](T[t.id]):req.get?req.get(w,n,t,o):(d=a(n,t,!1,!0),c=d.id,hasProp(S,c)?S[c]:u(makeError("notloaded",'Module name "'+c+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(v(),w.nextTick(function(){v(),p=s(a(null,t)),p.skipMap=r.skipMap,p.init(n,i,l,{enabled:!0}),h()}),o)}return r=r||{},mixin(o,{isBrowser:isBrowser,toUrl:function(e){var i,r=e.lastIndexOf("."),o=e.split("/")[0],a="."===o||".."===o;return-1!==r&&(!a||r>1)&&(i=e.substring(r,e.length),e=e.substring(0,r)),w.nameToUrl(n(e,t&&t.id,!0),i,!0)},defined:function(e){return hasProp(S,a(e,t,!1,!0).id)},specified:function(e){return e=a(e,t,!1,!0).id,hasProp(S,e)||hasProp(T,e)}}),t||(o.undef=function(e){c();var n=a(e,t,!0),r=getOwn(T,e);i(e),delete S[e],delete N[n.url],delete D[e],r&&(r.events.defined&&(D[e]=r.events),d(e))}),o},enable:function(e){var t=getOwn(T,e.id);t&&s(e).enable()},completeLoad:function(e){var t,n,i,o=getOwn(_.shim,e)||{},a=o.exports;for(c();C.length;){if(n=C.shift(),null===n[0]){if(n[0]=e,t)break;t=!0}else n[0]===e&&(t=!0);f(n)}if(i=getOwn(T,e),!t&&!hasProp(S,e)&&i&&!i.inited){if(!(!_.enforceDefine||a&&getGlobal(a)))return r(e)?void 0:u(makeError("nodefine","No define call for "+e,null,[e]));f([e,o.deps||[],o.exportsFn])}h()},nameToUrl:function(e,t,n){var i,r,o,a,s,l,u,c,d;if(req.jsExtRegExp.test(e))c=e+(t||"");else{for(i=_.paths,r=_.pkgs,s=e.split("/"),l=s.length;l>0;l-=1){if(u=s.slice(0,l).join("/"),o=getOwn(r,u),d=getOwn(i,u)){isArray(d)&&(d=d[0]),s.splice(0,l,d);break}if(o){a=e===o.name?o.location+"/"+o.main:o.location,s.splice(0,l,a);break}}c=s.join("/"),c+=t||(/^data\:|\?/.test(c)||n?"":".js"),c=("/"===c.charAt(0)||c.match(/^[\w\+\.\-]+:/)?"":_.baseUrl)+c}return _.urlArgs?c+((-1===c.indexOf("?")?"?":"&")+_.urlArgs):c},load:function(e,t){req.load(w,e,t)},execCb:function(e,t,n,i){return t.apply(i,n)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=m(e);w.completeLoad(t.id)}},onScriptError:function(e){var t=m(e);return r(t.id)?void 0:u(makeError("scripterror","Script error for: "+t.id,e,[t.id]))}},w.require=w.makeRequire(),w}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){return"interactive"===e.readyState?interactiveScript=e:void 0}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.9",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,apsp=ap.splice,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}"undefined"==typeof require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,n,i){var r,o,a=defContextName;return isArray(e)||"string"==typeof e||(o=e,isArray(t)?(e=t,t=n,n=i):e=[]),o&&o.context&&(a=o.context),r=getOwn(contexts,a),r||(r=contexts[a]=req.s.newContext(a)),o&&r.configure(o),r.require(e,t,n)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,n){var i=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return i.type=e.scriptType||"text/javascript",i.charset="utf-8",i.async=!0,i},req.load=function(e,t,n){var i,r=e&&e.config||{};if(isBrowser)return i=req.createNode(r,t,n),i.setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),!i.attachEvent||i.attachEvent.toString&&i.attachEvent.toString().indexOf("[native code")<0||isOpera?(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)),i.src=n,currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):head.appendChild(i),currentlyAddingScript=null,i;if(isWebWorker)try{importScripts(n),e.completeLoad(t)}catch(o){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+n,o,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){return head||(head=e.parentNode),dataMain=e.getAttribute("data-main"),dataMain?(mainScript=dataMain,cfg.baseUrl||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0):void 0}),define=function(e,t,n){var i,r;"string"!=typeof e&&(n=t,t=e,e=null),isArray(t)||(n=t,t=null),!t&&isFunction(n)&&(t=[],n.length&&(n.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,n){t.push(n)}),t=(1===n.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(i=currentlyAddingScript||getInteractiveScript(),i&&(e||(e=i.getAttribute("data-requiremodule")),r=contexts[i.getAttribute("data-requirecontext")])),(r?r.defQueue:globalDefQueue).push([e,t,n])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this),define("../../lib/enketo-core/lib/require.js",function(){}),XPathJS=function(){var e,t,n,i,r,o,a,s,l,u,c,d,p,h,f,g,m,y=[],b="http://www.w3.org/XML/1998/namespace",x="http://www.w3.org/2000/xmlns/",k="http://www.w3.org/1999/xhtml",_=function(e){return e.ownerDocument},T=function(e){var t=[],n=function(e,t){var n,i,r=[];for(i=0;i=0;n--)r=e.ownerDocument.namespaces.item(n),insertNamespaceIfNotDeclared.call(this,o,r.name,r.urn,e);for(n=e.attributes.length-1;n>=0;n--)e.attributes[n].specified&&!1!==(i=isNamespaceAttributeNode(e.attributes[n]))&&(1!==i.length?insertNamespaceIfNotDeclared.call(this,o,i[1],e.attributes[n].nodeValue,e):insertNamespaceIfNotDeclared.call(this,o,"",e.attributes[n].nodeValue,e));if(nodeNamespace.call(this,e.parentNode,o),void 0===t&&(insertNamespaceIfNotDeclared.call(this,o,"xml",b,e),o[0]&&""===o[0].prefix&&""===o[0].namespaceURI&&o.shift()),void 0===t)for(n=0;n=0&&i.sourceIndex>=0?(n.sourceIndexi.sourceIndex&&2):1)+0}if(e===n&&t===i)return r;if(e===n)return s(e,n,t,i,r,16,8,4,2);if(t===i)return s(t,i,e,n,r,8,16,2,4);if(16===(16&r))return 4;if(8===(8&r))return 2;if(0===r){for(o=0;o0?!0:!1},g.prototype.toString=function(){return this.value.length<1?"":(this.sortDocumentOrder(),nodeStringValue(this.value[0]))},g.prototype.toNumber=function(){return new h(this.toString()).toNumber()},g.prototype.toNodeSet=function(){return this.value},g.prototype.toDate=function(){return new h(this.toString()).toDate()},g.prototype.sortDocumentOrder=function(){switch(this.docOrder){case"document-order":break;case"reverse-document-order":this.value.reverse();break;default:this.value.sort(function(e,t){var n=compareDocumentPosition(e,t);if(4==(4&n))return-1;if(2==(2&n))return 1;throw new Error("NodeSetType.sortDocumentOrder - unexpected compare result: "+n)})}this.docOrder="document-order"},g.prototype.sortReverseDocumentOrder=function(){switch(this.docOrder){case"document-order":this.value.reverse();break;case"reverse-document-order":break;default:this.sortDocumentOrder(),this.value.reverse()}this.docOrder="reverse-document-order"},g.prototype.append=function(e){var t,n=0,i=0;if(!e instanceof g)throw new Error("NodeSetType can be passed into NodeSetType.append method");for(this.sortDocumentOrder(),e.sortDocumentOrder();n0?!0:!1},h.prototype.toString=function(){return this.value},h.prototype.toNumber=function(){var e;return this.isDateString(this.value)?new DateType(this.value).toNumber():(e=this.value.match(/^[ \t\r\n]*(-?[0-9]+(?:[.][0-9]*)?)[ \t\r\n]*$/),null!==e?parseFloat(e[1]):(e=this.value.match(/^[ \t\r\n]*(-?[.][0-9]+)[ \t\r\n]*$/),null!==e?parseFloat(e[1]):Number.NaN))},h.prototype.toDate=function(){return new Date(this.value)},h.prototype.isDateString=function(){return isNaN(this.value)?isNaN(Date.parse(this.value))?!1:/('|")?[0-9]{4}(-|\/)[0-9]{2}(-|\/)[0-9]{2}('|")?/.test(this.value)?(console.debug("found string value that passes check for datestringiness: "+this.value),!0):!1:!1},f=function(e){d.call(this,e,"number",["boolean","string","number","date"])},f.prototype=new d,f.constructor=f,f.prototype.toBoolean=function(){return 0===this.value||isNaN(this.value)?!1:!0},f.prototype.toString=function(){return this.value.toString()},f.prototype.toNumber=function(){return this.value},f.prototype.toDate=function(){return new Date(864e5*this.value)},DateType=function(e){d.call(this,e,"date",["date","string","number","boolean"])},DateType.prototype=new d,DateType.constructor=DateType,DateType.prototype.toDate=function(){return new Date(this.value)},DateType.prototype.toString=function(){return new Date(this.value).toUTCString()},DateType.prototype.toNumber=function(){return new Date(this.value).getTime()/864e5},DateType.prototype.toBoolean=function(){return!isNaN(new Date(this.value).getTime())},e=function(t,n){var i;switch(this.code=t,this.code){case e.INVALID_EXPRESSION_ERR:this.name="INVALID_EXPRESSION_ERR";break;case e.TYPE_ERR:this.name="TYPE_ERR";break;default:throw i=new Error("Unsupported XPathException code: "+this.code),i.name="XPathExceptionInternalError",i}this.message=n||""},e.prototype.toString=function(){return'XPathException: "'+this.message+'", code: "'+this.code+'", name: "'+this.name+'"'},e.INVALID_EXPRESSION_ERR=51,e.TYPE_ERR=52,t=function(e){var t,n,i;for(t in e){i=!1;for(n in this.opts)if(t===n){this.opts[t]=e[t],i=!0;break}if(!i)throw new Error("Unsupported option: "+t)}this.opts["unique-ids"][b]="id",this.opts["unique-ids"][k]="id"},t.prototype={opts:{"unique-ids":{},"case-sensitive":!1},createExpression:function(t,i){var r,o,a,s,l={};try{r=XPathJS._parser.parse(t)}catch(u){throw o="The expression is not a legal expression.",o+=u instanceof XPathJS._parser.SyntaxError?" (line: "+u.line+", character: "+u.column+")":" ("+u.message+")", new e(e.INVALID_EXPRESSION_ERR,o)}if(r.nsPrefixes.length>0){if("object"!=typeof i||"undefined"==typeof i.lookupNamespaceURI)throw new e(e.INVALID_EXPRESSION_ERR,"No namespace resolver provided or lookupNamespaceURI function not supported.");for(a=0;a=0;i--)switch(t.args[0]){case"text":3!=n.value[i].nodeType&&4!=n.value[i].nodeType&&n.value.splice(i,1);break;case"comment":8!=n.value[i].nodeType&&n.value.splice(i,1);break;case"processing-instruction":(7!=n.value[i].nodeType||t.args[1].length>0&&s(this,t.args[1][0])!=n.value[i].nodeName)&&n.value.splice(i,1)}break;case"name":switch(a=s(this,t),e){case"attribute":l=2;break;case"namespace":l=13;break;default:l=1}for(i=n.value.length-1;i>=0;i--)n.value[i].nodeType==l?(null!==a.ns||null!==a.name)&&(u=nodeExpandedName.call(this,n.value[i]),u!==!1&&u.ns===a.ns?null!==a.name&&u.name.toLowerCase()!=a.name.toLowerCase()&&n.value.splice(i,1):n.value.splice(i,1)):n.value.splice(i,1);break;default:throw new Error("NodeTest type not supported in step: "+t.type)}return n},predicate:function(e,t,n){var i,r,o,a,l,u;if(i=s(this,t),!i instanceof g)throw new Error('Expected "node-set", got: '+i.type);switch(e){case"ancestor":case"ancestor-or-self":case"preceding":case"preceding-sibling":i.sortReverseDocumentOrder();break;default:i.sortDocumentOrder()}for(a=0;ae})},">=":function(e,t){return compareOperator.call(this,s(this,e),s(this,t),">=",function(e,t){return e>=t})},">":function(e,t){return compareOperator.call(this,s(this,e),s(this,t),">",function(e,t){return e>t})},"+":function(e,t){return new f(s(this,e).toNumber()+s(this,t).toNumber())},"-":function(e,t){return new f(s(this,e).toNumber()-s(this,t).toNumber())},div:function(e,t){return new f(s(this,e).toNumber()/s(this,t).toNumber())},mod:function(e,t){return new f(s(this,e).toNumber()%s(this,t).toNumber())},"*":function(e,t){return new f(s(this,e).toNumber()*s(this,t).toNumber())},string:function(e){return new h(e)},number:function(e){return new f(e)},$:function(e){throw new Error("TODO: Not implemented.16")},name:function(e,t){var n=null;if(null!==e&&(n=this.nsMap[e],!n))throw new Error('Namespace prefix "'+e+'" is not mapped to a namespace.');return{ns:n,name:t}}},u={"":{last:{fn:function(){return new f(this.size)},ret:"number"},count:{fn:function(e){return new f(e.toNodeSet().length)},args:[{t:"node-set"}],ret:"number"},id:{fn:function(e){var t,n,i,r=this,o=[],a=[],s=function(e){var t,n=e.split(/[\u0020\u0009\u000D\u000A]+/);for(t=n.length-1;t>=0;t--)0==n[t].length&&n.splice(t,1);return n};if(e instanceof g)for(t=0;t=0;t--)for(n=t-1;n>=0;n--)if(o[t]==o[n]&&t!=n){o.splice(t,1);break}for(t=0;t0&&(e.sortDocumentOrder(),t=nodeExpandedName.call(this,e.value[0]),t!==!1&&(n=t.name)),new h(n)},args:[{t:"node-set",r:!1}],ret:"string"},"namespace-uri":{fn:function(e){var t,n="";return 0==arguments.length&&(e=new g([this.node])),e.toNodeSet().length>0&&(e.sortDocumentOrder(),t=nodeExpandedName.call(this,e.value[0]),t!==!1&&null!==t.ns&&(n=t.ns)),new h(n)},args:[{t:"node-set",r:!1}],ret:"string"},name:{fn:function(e){var t,n="";return 0==arguments.length&&(e=new g([this.node])),e.toNodeSet().length>0&&(e.sortDocumentOrder(),t=nodeExpandedName.call(this,e.value[0]),t!==!1&&(n=t.prefix&&t.prefix.length>0?t.prefix+":"+t.name:t.name)),new h(n)},args:[{t:"node-set",r:!1}],ret:"string"},string:{fn:function(e){return 0==arguments.length&&(e=new g([this.node],"document-order")),new h(e.toString())},args:[{t:"object",r:!1}],ret:"string"},"starts-with":{fn:function(e,t){return new p(e.toString().substr(0,(t=t.toString()).length)==t)},args:[{t:"string"},{t:"string"}],ret:"string"},contains:{fn:function(e,t){return new p(-1!=e.toString().indexOf(t=t.toString()))},args:[{t:"string"},{t:"string"}],ret:"string"},"substring-before":{fn:function(e,t){return e=e.toString(),t=e.indexOf(t.toString()),new h(-1==t?"":e.substr(0,t))},args:[{t:"string"},{t:"string"}],ret:"string"},"substring-after":{fn:function(e,t){var n;return e=e.toString(),t=t.toString(),n=e.indexOf(t),new h(-1==n?"":e.substr(n+t.length))},args:[{t:"string"},{t:"string"}],ret:"string"},substring:{fn:function(e,t,n){return e=e.toString(),t=Math.round(t.toNumber())-1,new h(isNaN(t)?"":2==arguments.length?e.substring(0>t?0:t):e.substring(0>t?0:t,t+Math.round(n.toNumber())))},args:[{t:"string"},{t:"number"},{t:"number",r:!1}],ret:"string"},"string-length":{fn:function(e){return e=0==arguments.length?nodeStringValue(this.node):e.toString(),new f(e.length)},args:[{t:"string",r:!1}],ret:"number"},"normalize-space":{fn:function(e){return e=0==arguments.length?nodeStringValue(this.node):e.toString(),new h(e.replace(/^[\u0020\u0009\u000D\u000A]+/,"").replace(/[\u0020\u0009\u000D\u000A]+$/,"").replace(/[\u0020\u0009\u000D\u000A]+/g," "))},args:[{t:"string",r:!1}],ret:"string"},translate:{fn:function(e,t,n){var i,r,o,a="";for(e=e.toString(),t=t.toString(),n=n.toString(),i=0;i=0&&t0?(t=nodeStringValue(e[0]).trim().split(" "),new f(1==t.length&&""===t[0]?0:t.length)):new f(0)},args:[{t:"node-set"}],ret:"number"},checklist:{fn:function(e,t,n){var i,r,o=0;for(e=e.toNumber(),t=t.toNumber(),i=2;ie||o>=e)&&(0>t||t>=o))},args:[{t:"number"},{t:"number"},{t:"object"},{t:"object",r:!1,rep:!0}],ret:"boolean"},"weighted-checklist":{fn:function(e,t,n,i){var r,o=[],a=[],s=0;for(e=e.toNumber(),t=t.toNumber(),r=2;re||s>=e)&&(0>t||t>=s))},args:[{t:"number"},{t:"number"},{t:"object"},{t:"object"},{t:"object",r:!1,rep:!0}],ret:"boolean"},"boolean-from-string":{fn:function(e){return new p("true"===e.toString().toLowerCase()||"1"===String(e))},args:[{t:"string"}],ret:"boolean"},"if":{fn:function(e,t,n){return e.toBoolean()?t:n},args:[{t:"object"},{t:"object"},{t:"object"}],ret:"object"},date:{fn:function(e){return new DateType(e.toDate())},args:[{t:"object"}],ret:"string"},"date-time":{fn:function(e){return new DateType(e.toDate())},args:[{t:"object"}],ret:"string"},"decimal-date-time":{fn:function(e){return new DateType(e.toDate())},args:[{t:"object"}],ret:"string"},today:{fn:function(){var e=new Date;return new DateType(new Date(e.getFullYear(),e.getMonth(),e.getDate()))},ret:"string"},now:{fn:function(){return new DateType(new Date)},ret:"string"},regex:{fn:function(e,t){var n,i;return n=e.toString(),i=new RegExp(t),new p(i.test(n))},args:[{t:"object"},{t:"string"}],ret:"boolean"},uuid:{fn:function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,n="x"==e?t:3&t|8;return n.toString(16)});return new h(e)},ret:"string"},"int":{fn:function(e){return new f(parseInt(e))},args:[{t:"number"}],ret:"number"},substr:{fn:function(e,t,n){return e=e.toString(),length=e.length,t=Math.round(t.toNumber()),n=n?Math.round(n.toNumber()):length,new h(isNaN(t)?"":e.substring(0>t?length+t:t,0>n?length+n:n))},args:[{t:"string"},{t:"number"},{t:"number",r:!1}],ret:"string"},random:{fn:function(){return new f(Math.random().toFixed(15))},ret:"number"},min:{fn:function(e,t){var n,i,r,o;for(console.log("min args",arguments),n=0;n0?e:t},args:[{t:"object"},{t:"object"}],ret:"string"},"format-date":{fn:function(e,t){var n,e=new DateType(e),i=e.toDate(),r=t.toString(),o=function(e,t){var i=e.toString(),r=t-i.length;for(n=0;r>n;n++)i="0"+i;return i};if(!e.toBoolean())return new h(i.toString());props={Y:i.getFullYear(),y:i.getFullYear().toString().substring(2,4),m:o(i.getMonth()+1,2),n:i.getMonth()+1,b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][i.getMonth()],d:o(i.getDate(),2),e:i.getDate(),H:o(i.getHours(),2),h:i.getHours(),M:o(i.getMinutes(),2),S:o(i.getSeconds(),2),3:o(i.getMilliseconds(),3),a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][i.getDay()]};for(prop in props)r=r.replace("%"+prop,props[prop]);return new h(r)},args:[{t:"date"},{t:"string"}],ret:"string"},"format-date-time":{fn:function(e,t){var n,e=new DateType(e),i=e.toDate(),r=t.toString(),o=function(e,t){var i=e.toString(),r=t-i.length;for(n=0;r>n;n++)i="0"+i;return i};if(!e.toBoolean())return new h(i.toString());props={Y:i.getFullYear(),y:i.getFullYear().toString().substring(2,4),m:o(i.getMonth()+1,2),n:i.getMonth()+1,b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][i.getMonth()],d:o(i.getDate(),2),e:i.getDate(),H:o(i.getHours(),2),h:i.getHours(),M:o(i.getMinutes(),2),S:o(i.getSeconds(),2),3:o(i.getMilliseconds(),3),a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][i.getDay()]};for(prop in props)r=r.replace("%"+prop,props[prop]);return new h(r)},args:[{t:"date"},{t:"string"}],ret:"string"},pow:{fn:function(e,t){return new f(Math.pow(e,t))},args:[{t:"number"},{t:"number"}],ret:"number"},version:{fn:function(){var e="#document"===this.node.nodeName?this.node.documentElement:this.node.ownerDocument.firstElementChild,t=e.attributes.version;return new h(t?t.textContent:"")},args:[],ret:"string"},once:{fn:function(e){var t=nodeStringValue(this.node),n=e.toString();return n="NaN"===n?"":n,new h(""!==t?t:n)},args:[{t:"string"}],ret:"string"}}},s=function(e,t){if("function"!=typeof l[t.type])throw new Error("Internal Error: Expression type does not exist: "+t.type);return l[t.type].apply(e,t.args)},r=function(t,n,i){switch(n){case r.NUMBER_TYPE:this.resultType=r.NUMBER_TYPE,this.numberValue=i.toNumber();break;case r.STRING_TYPE:this.resultType=r.STRING_TYPE,this.stringValue=i.toString();break;case r.BOOLEAN_TYPE:this.resultType=r.BOOLEAN_TYPE,this.booleanValue=i.toBoolean();break;case r.UNORDERED_NODE_ITERATOR_TYPE:case r.ORDERED_NODE_ITERATOR_TYPE:case r.UNORDERED_NODE_SNAPSHOT_TYPE:case r.ORDERED_NODE_SNAPSHOT_TYPE:case r.ANY_UNORDERED_NODE_TYPE:case r.FIRST_ORDERED_NODE_TYPE:if(!i instanceof g)throw new Error('Expected result of type "node-set", got: "'+i.type+'"');switch(this.resultType=n,n){case r.UNORDERED_NODE_ITERATOR_TYPE:case r.UNORDERED_NODE_SNAPSHOT_TYPE:this._value=i.toNodeSet(),this.snapshotLength=this._value.length;break;case r.ORDERED_NODE_ITERATOR_TYPE:case r.ORDERED_NODE_SNAPSHOT_TYPE:i.sortDocumentOrder(),this._value=i.toNodeSet(),this.snapshotLength=this._value.length;break;case r.ANY_UNORDERED_NODE_TYPE:i=i.toNodeSet(),this.singleNodeValue=i.length?i[0]:null;break;case r.FIRST_ORDERED_NODE_TYPE:i.sortDocumentOrder(),i=i.toNodeSet(),this.singleNodeValue=i.length?i[0]:null;break;default:throw new e(e.TYPE_ERR,"XPath result type not supported. (type: "+n+")")}break;default:throw new e(e.TYPE_ERR,"XPath result type not supported. (type: "+n+")")}},r.factory=function(t,n,i){var o;if(n!==r.ANY_TYPE)return new r(t,n,i);if(i instanceof g)o=new r(t,r.UNORDERED_NODE_ITERATOR_TYPE,i);else if(i instanceof f)o=new r(t,r.NUMBER_TYPE,i);else if(i instanceof p)o=new r(t,r.BOOLEAN_TYPE,i);else{if(!(i instanceof h))throw new e(e.TYPE_ERR,"Internal Error: Unsupported value type: "+typeof i);o=new r(t,r.STRING_TYPE,i)}return o},r.prototype={resultType:null,numberValue:null,stringValue:null,booleanValue:null,singleNodeValue:null,invalidIteratorState:null,snapshotLength:null,_iteratorIndex:0,iterateNext:function(){if(this.resultType!=r.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=r.ORDERED_NODE_ITERATOR_TYPE)throw new e(e.TYPE_ERR,"iterateNext() method may only be used with results of type UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE");return this._iteratorIndexr;r++)o=e.charAt(r),"\n"===o?(t.seenCR||t.line++,t.column=1,t.seenCR=!1):"\r"===o||"\u2028"===o||"\u2029"===o?(t.line++,t.column=1,t.seenCR=!0):(t.column++,t.seenCR=!1)}return hi!==t&&(hi>t&&(hi=0,fi={line:1,column:1,seenCR:!1}),n(fi,hi,t),hi=t),fi}function r(e){gi>di||(di>gi&&(gi=di,mi=[]),mi.push(e))}function o(i,r,o){function a(e){var t=1;for(e.sort(function(e,t){return e.descriptiont.description?1:0});t1?a.slice(0,-1).join(", ")+" or "+a[e.length-1]:a[0],r=t?'"'+n(t)+'"':"end of input","Expected "+i+" but "+r+" found."}var l=n(o),u=o1?arguments[1]:{},J={},Q={XPath:a},G=a,Z=J,ee=function(e){return{tree:e,nsPrefixes:xi}},te="/",ne={type:"literal",value:"/",description:'"/"'},ie=null,re=function(e){return{type:"/",args:[null,e?e[1]:null]}},oe="//",ae={type:"literal",value:"//",description:'"//"'},se=function(e,t){var n;for(n=0;n=",Ot={type:"literal",value:">=",description:'">="'},$t=">",Rt={type:"literal",value:">",description:'">"'},jt="+",It={type:"literal",value:"+",description:'"+"'},Ft="-",qt={type:"literal",value:"-",description:'"-"'},Lt="div",Vt={type:"literal",value:"div",description:'"div"'},Ut="mod",Bt={type:"literal",value:"mod",description:'"mod"'},Ht=function(e){return{type:"*",args:[{type:"number",args:[-1]},e]}},Wt='"',zt={type:"literal",value:'"',description:'"\\""'},Xt=/^[^"]/,Yt={type:"class",value:'[^"]',description:'[^"]'},Kt=function(e){return{type:"string",args:[e.join("")]}},Jt="'",Qt={type:"literal",value:"'",description:'"\'"'},Gt=/^[^']/,Zt={type:"class",value:"[^']",description:"[^']"},en=function(e,t){return{type:"number",args:[t?parseFloat(e+"."+t[1]):parseInt(e)]}},tn=function(e){return{type:"number",args:[parseFloat("."+e)]}},nn=/^[0-9]/,rn={type:"class",value:"[0-9]",description:"[0-9]"},on=function(e){return e.join("")},an="*",sn={type:"literal",value:"*",description:'"*"'},ln=function(e){var t;if(null===yi.args[0])for(t=0;t<_i.length;t++)if(yi.args[1]==_i[t])return!1;return!0},un=void 0,cn=function(e){return""===e.args[0]?e={type:e.type,args:[null,e.args[1]]}:ki(e.args[0]),e},dn="$",pn={type:"literal",value:"$",description:'"$"'},hn=function(e){return ki(e.args[0]),{type:"$",args:[e]}},fn=function(){return{type:"name",args:[null,null]}},gn=":",mn={type:"literal",value:":",description:'":"'},vn=function(e){return ki(e),{type:"name",args:[e,null]}},yn=function(e){return ki(e.args[0]),e},bn="comment",wn={type:"literal",value:"comment",description:'"comment"'},xn="text",kn={type:"literal",value:"text",description:'"text"'},_n="node",Tn={type:"literal",value:"node",description:'"node"'},En=/^[ \t\r\n]/,Dn={type:"class",value:"[ \\t\\r\\n]",description:"[ \\t\\r\\n]"},Cn=function(e){return yi=e,e},Sn=function(e,t){return{type:"name",args:[e,t]}},Nn=function(e){return{type:"name",args:[null,e]}},Mn=/^[A-Z]/,An={type:"class",value:"[A-Z]",description:"[A-Z]"},Pn="_",On={type:"literal",value:"_",description:'"_"'},$n=/^[a-z]/,Rn={type:"class",value:"[a-z]",description:"[a-z]"},jn=/^[\xC0-\xD6]/,In={type:"class",value:"[\\xC0-\\xD6]",description:"[\\xC0-\\xD6]"},Fn=/^[\xD8-\xF6]/,qn={type:"class",value:"[\\xD8-\\xF6]",description:"[\\xD8-\\xF6]"},Ln=/^[\xF8-\u02FF]/,Vn={type:"class",value:"[\\xF8-\\u02FF]",description:"[\\xF8-\\u02FF]"},Un=/^[\u0370-\u037D]/,Bn={type:"class",value:"[\\u0370-\\u037D]",description:"[\\u0370-\\u037D]"},Hn=/^[\u037F-\u1FFF]/,Wn={type:"class",value:"[\\u037F-\\u1FFF]",description:"[\\u037F-\\u1FFF]"},zn=/^[\u200C-\u200D]/,Xn={type:"class",value:"[\\u200C-\\u200D]",description:"[\\u200C-\\u200D]"},Yn=/^[\u2070-\u218F]/,Kn={type:"class",value:"[\\u2070-\\u218F]",description:"[\\u2070-\\u218F]"},Jn=/^[\u2C00-\u2FEF]/,Qn={type:"class",value:"[\\u2C00-\\u2FEF]",description:"[\\u2C00-\\u2FEF]"},Gn=/^[\u3001-\uD7FF]/,Zn={type:"class",value:"[\\u3001-\\uD7FF]",description:"[\\u3001-\\uD7FF]"},ei=/^[\uF900-\uFDCF]/,ti={type:"class",value:"[\\uF900-\\uFDCF]",description:"[\\uF900-\\uFDCF]"},ni=/^[\uFDF0-\uFFFD]/,ii={type:"class",value:"[\\uFDF0-\\uFFFD]",description:"[\\uFDF0-\\uFFFD]"},ri=/^[\xB7]/,oi={type:"class",value:"[\\xB7]",description:"[\\xB7]"},ai=/^[\u0300-\u036F]/,si={type:"class",value:"[\\u0300-\\u036F]",description:"[\\u0300-\\u036F]"},li=/^[\u203F-\u2040]/,ui={type:"class",value:"[\\u203F-\\u2040]",description:"[\\u203F-\\u2040]"},ci=function(e,t){return e+t.join("")},di=0,pi=0,hi=0,fi={line:1,column:1,seenCR:!1},gi=0,mi=[],vi=0;if("startRule"in K){if(!(K.startRule in Q))throw new Error("Can't start parsing from rule \""+K.startRule+'".');G=Q[K.startRule]}var yi,bi=function(e,t,n,i){var r,o,a={type:"",args:[]};for(a.args.push(e),r=0;r0&&t-1 in e}function i(e,t,n){if(ee.isFunction(t))return ee.grep(e,function(e,i){return!!t.call(e,i,e)!==n});if(t.nodeType)return ee.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(se.test(t))return ee.filter(t,e,n);t=ee.filter(t,e)}return ee.grep(e,function(e){return z.call(t,e)>=0!==n})}function r(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function o(e){var t=fe[e]={};return ee.each(e.match(he)||[],function(e,n){t[n]=!0}),t}function a(){G.removeEventListener("DOMContentLoaded",a,!1),e.removeEventListener("load",a,!1),ee.ready()}function s(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=ee.expando+Math.random()}function l(e,t,n){var i;if(void 0===n&&1===e.nodeType)if(i="data-"+t.replace(we,"-$1").toLowerCase(),n=e.getAttribute(i),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:be.test(n)?ee.parseJSON(n):n}catch(r){}ye.set(e,t,n)}else n=void 0;return n}function u(){return!0}function c(){return!1}function d(){try{return G.activeElement}catch(e){}}function p(e,t){return ee.nodeName(e,"table")&&ee.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function h(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function f(e){var t=je.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function g(e,t){for(var n=0,i=e.length;i>n;n++)ve.set(e[n],"globalEval",!t||ve.get(t[n],"globalEval"))}function m(e,t){var n,i,r,o,a,s,l,u;if(1===t.nodeType){if(ve.hasData(e)&&(o=ve.access(e),a=ve.set(t,o),u=o.events)){delete a.handle,a.events={};for(r in u)for(n=0,i=u[r].length;i>n;n++)ee.event.add(t,r,u[r][n])}ye.hasData(e)&&(s=ye.access(e),l=ee.extend({},s),ye.set(t,l))}}function v(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&ee.nodeName(e,t)?ee.merge([e],n):n}function y(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Te.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function b(t,n){var i=ee(n.createElement(t)).appendTo(n.body),r=e.getDefaultComputedStyle?e.getDefaultComputedStyle(i[0]).display:ee.css(i[0],"display");return i.detach(),r}function w(e){var t=G,n=Le[e];return n||(n=b(e,t),"none"!==n&&n||(qe=(qe||ee("