code
stringlengths
2
1.05M
const exec = require('child_process').exec; const ver = require('../package.json').version; let hash; module.exports.init = function (b) { exec('git rev-parse HEAD', (error, stdout, stderr) => { if (error != null) { hash = null; console.err("git's broken yo"); } hash = stdout; }); }; module.exports.run = function (r, parts, reply) { reply(`${ver}: ${hash}`); }; module.exports.commands = ['version'];
/*! Tiny table */ var TINY = {}; function T$(i) { return document.getElementById(i); } function T$$(e, p) { return p.getElementsByTagName(e); } TINY.table = function() { function sorter(n, t, p) { this.n = n; this.id = t; this.p = p; if (this.p.init) { this.init(); } } sorter.prototype.init = function() { this.set(); var t = this.t, i = d = 0; t.h = T$$('tr', t)[0]; if (t.r.length !== 0) { t.l = t.r.length; t.w = t.r[0].cells.length; if (t.r.length > this.p.size) { $('#' + this.p.navid).show(); $('.' + this.p.navid).show(); } t.a = []; t.c = []; this.p.is = this.p.size; if (this.p.colddid) { d = T$(this.p.colddid); var o = document.createElement('option'); o.value = -1; o.innerHTML = 'Todas las columnas'; d.appendChild(o); } for (i; i < t.w; i++) { var c = t.h.cells[i]; t.c[i] = {}; if (c.className != 'nosort') { c.className = this.p.headclass; c.onclick = new Function(this.n + '.sort(' + i + ')'); c.onmousedown = function() { return false; }; } if (this.p.columns) { var l = this.p.columns.length, x = 0; for (x; x < l; x++) { if (this.p.columns[x].index == i) { var g = this.p.columns[x]; t.c[i].format = g.format == null ? 1 : g.format; t.c[i].decimals = g.decimals == null ? 2 : g.decimals; } } } if (d) { var o = document.createElement('option'); o.value = i; o.innerHTML = T$$('span', c)[0].innerHTML; d.appendChild(o); } } this.reset(); } }; sorter.prototype.reset = function() { var t = this.t; t.t = t.l; for (var i = 0; i < t.l; i++) { t.a[i] = {}; t.a[i].s = 1; } if (this.p.sortcolumn != undefined) { this.sort(this.p.sortcolumn, 1, this.p.is); } else { if (this.p.paginate) { this.size(); } this.alt(); this.sethover(); } this.calc(); }; sorter.prototype.sort = function(x, f, z) { var t = this.t; t.y = x; var x = t.h.cells[t.y], i = 0, n = document.createElement('tbody'); for (i; i < t.l; i++) { t.a[i].o = i; var v = t.r[i].cells[t.y]; t.r[i].style.display = ''; while (v.hasChildNodes()) { v = v.firstChild; } t.a[i].v = v.nodeValue ? v.nodeValue : ''; } for (i = 0; i < t.w; i++) { var c = t.h.cells[i]; if (c.className != 'nosort') { c.className = this.p.headclass; } } if (t.p == t.y && !f) { t.a.reverse(); x.className = t.d ? this.p.ascclass : this.p.descclass; t.d = t.d ? 0 : 1; } else { t.p = t.y; f && this.p.sortdir == -1 ? t.a.sort(cp).reverse() : t.a.sort(cp); t.d = 0; x.className = this.p.ascclass; } $(t.h.cells).children().children().removeClass().addClass('glyphicon glyphicon-sort'); var addclass = t.h.cells[t.p].className == 'asc' ? 'glyphicon glyphicon-sort-by-attributes' : 'glyphicon glyphicon-sort-by-attributes-alt'; $(t.h.cells[t.p]).children().children().removeClass().addClass(addclass); for (i = 0; i < t.l; i++) { var r = t.r[t.a[i].o].cloneNode(true); n.appendChild(r); } t.replaceChild(n, t.b); this.set(); this.alt(); if (this.p.paginate) { this.size(z); } this.sethover(); }; sorter.prototype.sethover = function() { if (this.p.hoverid) { for (var i = 0; i < this.t.l; i++) { var r = this.t.r[i]; r.setAttribute('onmouseover', this.n + '.hover(' + i + ',1)'); r.setAttribute('onmouseout', this.n + '.hover(' + i + ',0)'); } } }; sorter.prototype.calc = function() { if (this.p.sum || this.p.avg) { var t = this.t, i = x = 0, f, r; if (!T$$('tfoot', t)[0]) { f = document.createElement('tfoot'); t.appendChild(f); } else { f = T$$('tfoot', t)[0]; while (f.hasChildNodes()) { f.removeChild(f.firstChild); } } if (this.p.sum) { r = this.newrow(f); for (i; i < t.w; i++) { var j = r.cells[i]; if (this.p.sum.exists(i)) { var s = 0, m = t.c[i].format || ''; for (x = 0; x < this.t.l; x++) { if (t.a[x].s) { s += parseFloat(t.r[x].cells[i].innerHTML.replace(/(\$|\,)/g, '')); } } s = decimals(s, t.c[i].decimals ? t.c[i].decimals : 2); s = isNaN(s) ? 'n/a' : m == '$' ? s = s.currency(t.c[i].decimals) : s + m; r.cells[i].innerHTML = s; } else { r.cells[i].innerHTML = '&nbsp;'; } } } if (this.p.avg) { r = this.newrow(f); for (i = 0; i < t.w; i++) { var j = r.cells[i]; if (this.p.avg.exists(i)) { var s = c = 0, m = t.c[i].format || ''; for (x = 0; x < this.t.l; x++) { if (t.a[x].s) { s += parseFloat(t.r[x].cells[i].innerHTML.replace(/(\$|\,)/g, '')); c++; } } s = decimals(s / c, t.c[i].decimals ? t.c[i].decimals : 2); s = isNaN(s) ? 'n/a' : m == '$' ? s = s.currency(t.c[i].decimals) : s + m; j.innerHTML = s; } else { j.innerHTML = '&nbsp;'; } } } } }; sorter.prototype.newrow = function(p) { var r = document.createElement('tr'), i = 0; p.appendChild(r); for (i; i < this.t.w; i++) { r.appendChild(document.createElement('td')); } return r; }; sorter.prototype.alt = function() { var t = this.t, i = x = 0; for (i; i < t.l; i++) { var r = t.r[i]; if (t.a[i].s) { r.className = x % 2 == 0 ? this.p.evenclass : this.p.oddclass; var cells = T$$('td', r); for (var z = 0; z < t.w; z++) { cells[z].className = t.y == z ? x % 2 == 0 ? this.p.evenselclass : this.p.oddselclass : ''; } x++; } if (!t.a[i].s) { r.style.display = 'none'; } } }; sorter.prototype.page = function(s) { var t = this.t, i = x = 0, l = s + parseInt(this.p.size); if (this.p.totalrecid) { T$(this.p.totalrecid).innerHTML = t.t; } if (this.p.currentid) { T$(this.p.currentid).innerHTML = this.g; } if (this.p.startingrecid) { var b = ((this.g - 1) * this.p.size) + 1, m = b + (this.p.size - 1); m = m < t.l ? m : t.t; m = m < t.t ? m : t.t; T$(this.p.startingrecid).innerHTML = t.t == 0 ? 0 : b; ; T$(this.p.endingrecid).innerHTML = m; } for (i; i < t.l; i++) { var r = t.r[i]; if (t.a[i].s) { r.style.display = x >= s && x < l ? '' : 'none'; x++; } else { r.style.display = 'none'; } } }; sorter.prototype.addfirstdisclass = function() { $('.prev-page').parent().addClass('disabled'); $('.first-page').parent().addClass('disabled'); }; sorter.prototype.addlastdisclass = function() { $('.next-page').parent().addClass('disabled'); $('.last-page').parent().addClass('disabled'); }; sorter.prototype.removefirstdisclass = function() { $('.prev-page').parent().removeClass('disabled'); $('.first-page').parent().removeClass('disabled'); }; sorter.prototype.removelastdisclass = function() { $('.next-page').parent().removeClass('disabled'); $('.last-page').parent().removeClass('disabled'); }; sorter.prototype.disablepag = function(d, m) { var selval = parseInt($('#pagedropdown').find(":selected").val()); var selsumres = selval + parseInt(d); var optionsize = $('#pagedropdown option').size(); if (m) { if (d > 0) { $("#pagedropdown").val(optionsize).attr('selected', true); this.removefirstdisclass(); this.addlastdisclass(); } else if (d < 0) { $("#pagedropdown").val(1).attr('selected', true); this.removelastdisclass(); this.addfirstdisclass(); } } else { if (d > 0) { this.addlastdisclass(); if (selval < optionsize - 1) { $("#pagedropdown").val(selsumres).attr('selected', true); this.removefirstdisclass(); this.removelastdisclass(); } else if (selval === optionsize - 1) { $("#pagedropdown").val(selsumres).attr('selected', true); this.removefirstdisclass(); } } else if (d < 0) { this.addfirstdisclass(); if (selval > 2) { $("#pagedropdown").val(selsumres).attr('selected', true); this.removelastdisclass(); this.removefirstdisclass(); } else if (selval === 2) { $("#pagedropdown").val(selsumres).attr('selected', true); this.removelastdisclass(); } } } }; sorter.prototype.mueve = function(d, m) { this.vea(d == 1 ? (m ? this.d : this.g + 1) : (m ? 1 : this.g - 1)); this.disablepag(d, m); }; sorter.prototype.vea = function(s) { if (s <= this.d && s > 0) { this.g = s; this.page((s - 1) * this.p.size); } if (s == 1) { this.removelastdisclass(); this.addfirstdisclass(); } else if (s == ((parseInt(this.p.size) - parseInt(1)))) { this.removefirstdisclass(); this.addlastdisclass(); } else { this.removelastdisclass(); this.removefirstdisclass(); } }; sorter.prototype.size = function(s) { var t = this.t; if (s) { this.p.size = s; } this.g = 1; this.d = Math.ceil(this.t.t / this.p.size); this.page(0); if (this.p.totalid) { T$(this.p.totalid).innerHTML = t.t == 0 ? 1 : this.d; } if (this.p.pageddid) { var d = T$(this.p.pageddid), l = this.d + 1; d.setAttribute('onchange', this.n + '.vea(this.value)'); while (d.hasChildNodes()) { d.removeChild(d.firstChild); } for (var i = 1; i <= this.d; i++) { var o = document.createElement('option'); o.value = i; o.innerHTML = i; d.appendChild(o); } } this.removelastdisclass(); this.addfirstdisclass(); }; sorter.prototype.showall = function() { this.size(this.t.t); }; sorter.prototype.search = function(f) { var i = x = n = 0, k = -1, q = T$(f).value.toLowerCase(); if (this.p.colddid) { k = T$(this.p.colddid).value; } var s = (k == -1) ? 0 : k, e = (k == -1) ? this.t.w : parseInt(s) + 1; for (i; i < this.t.l; i++) { var r = this.t.r[i], v; if (q == '') { v = 1; } else { for (x = s; x < e; x++) { var b = r.cells[x].innerHTML.toLowerCase(); if (b.indexOf(q) == -1) { v = 0; } else { v = 1; break; } } } if (v) { n++; } this.t.a[i].s = v; } this.t.t = n; if (this.p.paginate) { this.size(); } this.calc(); this.alt(); }; sorter.prototype.hover = function(i, d) { this.t.r[i].id = d ? this.p.hoverid : ''; }; sorter.prototype.set = function() { var t = T$(this.id); t.b = T$$('tbody', t)[0]; t.r = t.b.rows; this.t = t; }; Array.prototype.exists = function(v) { for (var i = 0; i < this.length; i++) { if (this[i] == v) { return 1; } } return 0; }; Number.prototype.currency = function(c) { var n = this, d = n.toFixed(c).split('.'); d[0] = d[0].split('').reverse().join('').replace(/(\d{3})(?=\d)/g, '$1,').split('').reverse().join(''); return '$' + d.join('.'); }; function decimals(n, d) { return Math.round(n * Math.pow(10, d)) / Math.pow(10, d); } function cp(f, c) { var g, h; f = g = f.v.toLowerCase(); c = h = c.v.toLowerCase(); var i = parseFloat(f.replace(/(\$|\,)/g, '')), n = parseFloat(c.replace(/(\$|\,)/g, '')); if (!isNaN(i) && !isNaN(n)) { g = i, h = n; } i = Date.parse(f); n = Date.parse(c); if (!isNaN(i) && !isNaN(n)) { g = i; h = n; } return g > h ? 1 : (g < h ? -1 : 0); } return { sorter: sorter }; }();
(function () { function getQueryVariable(variable) { var query = window.location.search.substring(1), vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] === variable) { return pair[1]; } } } function getPreview(query, content, previewLength) { previewLength = previewLength || (content.length * 2); var parts = query.split(" "), match = content.toLowerCase().indexOf(query.toLowerCase()), matchLength = query.length, preview; // Find a relevant location in content for (var i = 0; i < parts.length; i++) { if (match >= 0) { break; } match = content.toLowerCase().indexOf(parts[i].toLowerCase()); matchLength = parts[i].length; } // Create preview if (match >= 0) { var start = match - (previewLength / 2), end = start > 0 ? match + matchLength + (previewLength / 2) : previewLength; preview = content.substring(start, end).trim(); if (start > 0) { preview = "..." + preview; } if (end < content.length) { preview = preview + "..."; } // Highlight query parts preview = preview.replace(new RegExp("(" + parts.join("|") + ")", "gi"), "<strong>$1</strong>"); } else { // Use start of content if no match found preview = content.substring(0, previewLength).trim() + (content.length > previewLength ? "..." : ""); } return preview; } function displaySearchResults(results, query) { var searchResultsEl = document.getElementById("search-results"), searchProcessEl = document.getElementById("search-process"); if (results.length) { var resultsHTML = ""; results.forEach(function (result) { var item = window.data[result.ref], contentPreview = getPreview(query, item.content, 170), titlePreview = getPreview(query, item.title); resultsHTML += "<li><h4><a href='" + item.url.trim() + "'>" + titlePreview + "</a></h4><p><small>" + contentPreview + "</small></p></li>"; }); searchResultsEl.innerHTML = resultsHTML; searchProcessEl.innerText = "Exibindo"; } else { searchResultsEl.style.display = "none"; searchProcessEl.innerText = "No"; } } window.index = lunr(function () { this.field("id"); this.field("title", {boost: 10}); this.field("date"); this.field("url"); this.field("content"); }); var query = decodeURIComponent((getQueryVariable("q") || "").replace(/\+/g, "%20")), searchQueryContainerEl = document.getElementById("search-query-container"), searchQueryEl = document.getElementById("search-query"); searchQueryEl.innerText = query; searchQueryContainerEl.style.display = "inline"; for (var key in window.data) { window.index.add(window.data[key]); } displaySearchResults(window.index.search(query), query); // Hand the results off to be displayed })();
define([ "./core", "./core/access", "./var/document", "./var/documentElement", "./css/var/rnumnonpx", "./css/curCSS", "./css/addGetHookIf", "./css/support", "./core/init", "./css", "./selector" // contains ], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) { /** * Gets a window from an element */ function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView; } jQuery.offset = { setOffset: function( elem, options, i ) { var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css( elem, "position" ), curElem = jQuery( elem ), props = {}; // Set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } curOffset = curElem.offset(); curCSSTop = jQuery.css( elem, "top" ); curCSSLeft = jQuery.css( elem, "left" ); calculatePosition = ( position === "absolute" || position === "fixed" ) && ( curCSSTop + curCSSLeft ).indexOf("auto") > -1; // Need to be able to calculate position if either // top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend({ offset: function( options ) { // Preserve chaining for setter if ( arguments.length ) { return options === undefined ? this : this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } var docElem, win, rect, doc, elem = this[ 0 ]; if ( !elem ) { return; } rect = elem.getBoundingClientRect(); // Make sure element is not hidden (display: none) or disconnected if ( rect.width || rect.height || elem.getClientRects().length ) { doc = elem.ownerDocument; win = getWindow( doc ); docElem = doc.documentElement; return { top: rect.top + win.pageYOffset - docElem.clientTop, left: rect.left + win.pageXOffset - docElem.clientLeft }; } }, position: function() { if ( !this[ 0 ] ) { return; } var offsetParent, offset, elem = this[ 0 ], parentOffset = { top: 0, left: 0 }; // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, // because it is its only offset parent if ( jQuery.css( elem, "position" ) === "fixed" ) { // Assume getBoundingClientRect is there when computed position is fixed offset = elem.getBoundingClientRect(); } else { // Get *real* offsetParent offsetParent = this.offsetParent(); // Get correct offsets offset = this.offset(); if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { parentOffset = offsetParent.offset(); } // Add offsetParent borders // Subtract offsetParent scroll positions parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ) - offsetParent.scrollTop(); parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ) - offsetParent.scrollLeft(); } // Subtract parent offsets and element margins return { top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) }; }, // This method will return documentElement in the following cases: // 1) For the element inside the iframe without offsetParent, this method will return // documentElement of the parent window // 2) For the hidden or detached element // 3) For body or html element, i.e. in case of the html node - it will return itself // // but those exceptions were never presented as a real life use-cases // and might be considered as more preferable results. // // This logic, however, is not guaranteed and can change at any point in the future offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent; while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { offsetParent = offsetParent.offsetParent; } return offsetParent || documentElement; }); } }); // Create scrollLeft and scrollTop methods jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { var top = "pageYOffset" === prop; jQuery.fn[ method ] = function( val ) { return access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { return win ? win[ prop ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : win.pageXOffset, top ? val : win.pageYOffset ); } else { elem[ method ] = val; } }, method, val, arguments.length, null ); }; }); // Support: Safari<7+, Chrome<37+ // Add the top/left cssHooks using jQuery.fn.position // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // Blink bug: https://code.google.com/p/chromium/issues/detail?id=229280 // getComputedStyle returns percent when specified for top/left/bottom/right; // rather than make the css module depend on the offset module, just check for it here jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, function( elem, computed ) { if ( computed ) { computed = curCSS( elem, prop ); // If curCSS returns percentage, fallback to offset return rnumnonpx.test( computed ) ? jQuery( elem ).position()[ prop ] + "px" : computed; } } ); }); return jQuery; });
import UnitConverter from '../../../UnitConverter' import { Fraction, mul, div } from '../../../../numbers' import { Mass } from '../../domains' import { UnitedStates } from '../../authorities' import { OunceConverter } from '../../us/customary/mass' import { ChickenEggs } from '../../systems' import { Jumbo, VeryLarge, Large, Medium, Small, Peewee } from '../../units' const jumboScalar = new Fraction(5, 2) export const JumboConverter = new UnitConverter( Mass, UnitedStates, ChickenEggs, Jumbo, OunceConverter, value => mul(value, jumboScalar), value => div(value, jumboScalar)) const veryLargeScalar = new Fraction(9, 4) export const VeryLargeConverter = new UnitConverter( Mass, UnitedStates, ChickenEggs, VeryLarge, OunceConverter, value => mul(value, veryLargeScalar), value => div(value, veryLargeScalar)) const largeScalar = 2 export const LargeConverter = new UnitConverter( Mass, UnitedStates, ChickenEggs, Large, OunceConverter, value => mul(value, largeScalar), value => div(value, largeScalar)) const mediumScalar = new Fraction(7, 4) export const MediumConverter = new UnitConverter( Mass, UnitedStates, ChickenEggs, Medium, OunceConverter, value => mul(value, mediumScalar), value => div(value, mediumScalar)) const smallScalar = new Fraction(3, 2) export const SmallConverter = new UnitConverter( Mass, UnitedStates, ChickenEggs, Small, OunceConverter, value => mul(value, smallScalar), value => div(value, smallScalar)) const peeweeScalar = new Fraction(5, 4); export const PeeweeConverter = new UnitConverter( Mass, UnitedStates, ChickenEggs, Peewee, OunceConverter, value => mul(value, peeweeScalar), value => div(value, peeweeScalar)) export function collectUnitConverters() { return [ JumboConverter, VeryLargeConverter, LargeConverter, MediumConverter, SmallConverter, PeeweeConverter ] }
'use strict'; var path = require('path'); var generators = require('yeoman-generator'); var yaml = require('js-yaml'); var _ = require('lodash'); var chalk = require('chalk'); var GitHub = require('github'); module.exports = generators.Base.extend({ _logHeading: function (msg) { this.log("\n"); this.log.writeln(chalk.bold(msg)); this.log.writeln(chalk.bold('-------------------------------')); }, _listPlugins: function () { var github = new GitHub({ version: '3.0.0' }); github.search.repos({ q: 'wok-plugin+in:name' }, function (err, response) { console.log(response.items.length); }); }, // The name `constructor` is important here constructor: function () { // Calling the super constructor is important so our generator is correctly set up generators.Base.apply(this, arguments); this.answers = {}; }, askForProject: function () { var done = this.async(); var _utils = this._; this._logHeading('Collecting new project infos...'); var prompts = [{ type: 'text', name: 'name', message: 'Project name', 'default': 'awesome-wok-project', filter: function (value) { return _utils.slugify(value) } }, { type: 'text', name: 'description', message: 'Project description', 'default': 'Awesome WOK Project' }, { type: 'text', name: 'author', message: 'Author', 'default': this.user.git.name() }, { type: 'text', name: 'license', message: 'License', 'default': 'MIT' }]; this.prompt(prompts, function (answers) { this.answers.projectData = answers; done(); }.bind(this)); }, askForFolders: function () { var done = this.async(); var _utils = this._; this._logHeading('Filesystem setup...'); var prompts = [ { type: 'text', name: 'www', message: 'Public assets folder', 'default': 'www', filter: function (value) { return _utils.slugify(value) } }]; this.prompt(prompts, function (answers) { answers.rsync = answers.www; this.answers.folders = answers; done(); }.bind(this)); }, fetchRepo: function () { var done = this.async(); this.remote('fevrcoding', 'wok', 'master', function (err, remote, files) { if (err) { //TODO manage error this.log.error('Unable to download latest version of https://github.com/fevrcoding/wok'); return false; } this.wokRepo = remote; this.wokFiles = files; done(); }.bind(this)); //this._listPlugins(); }, copyFiles: function () { var remote = this.wokRepo; var files = this.wokFiles; //copy main application folder remote.directory('application', 'application'); //build folder remote.dest.mkdir('build'); //copy unchanged configuration files ['hosts.yml', 'properties.yml'].forEach(function (filename) { var fullpath = path.join('build', 'grunt-config', filename); remote.copy(fullpath, fullpath); }); //copy unchanged files ['build/Gruntfile.js', 'build/compass.rb', 'bower.json', 'Gemfile'].forEach(function (filepath) { remote.copy(filepath, filepath); }); //copy dot files files.filter(function (path) { return path.indexOf('.') === 0 && path !== '.bowerrc'; }).forEach(function (el) { remote.copy(el, el); }); }, package: function () { var pkg = this.wokRepo.src.readJSON('package.json'); pkg = _.extend(pkg || {}, { version: '0.0.1', contributors: [] }, this.answers.projectData); this.wokRepo.dest.write('package.json', JSON.stringify(pkg, null, 4)); return pkg; }, config: function (remote) { var remote = this.wokRepo; var pathCfg = yaml.safeLoad(remote.src.read('build/grunt-config/paths.yml')); var defaultPublic = pathCfg.www; pathCfg = _.extend(pathCfg, this.answers.folders); remote.dest.write('build/grunt-config/paths.yml', yaml.safeDump(pathCfg)); //public www data to destination public folder remote.directory(defaultPublic, pathCfg.www); //write .bowerrc remote.dest.write('.bowerrc', JSON.stringify({directory: pathCfg.www + '/vendor'}, null, 4)); return pathCfg; }, readme: function () { //generate an empty readme file this.wokRepo.dest.write('README.md', '#' + this.answers.projectDescription + "\n\n"); }, install: function () { if (!this.options['skip-install']) { this.spawnCommand('bundler', ['install']); this.installDependencies({ skipMessage: true }); } var template = _.template('\n\nI\'m all done. ' + '<%= skipInstall ? "Just run" : "Running" %> <%= commands %> ' + '<%= skipInstall ? "" : "for you " %>to install the required dependencies.' + '<% if (!skipInstall) { %> If this fails, try running the command yourself.<% } %>\n\n' ); this.log(template({ skipInstall: this.options['skip-install'], commands: chalk.yellow.bold(['bower install', 'npm install', 'bundler install'].join(' & ')) })); } });
class MetaFloorController extends MRM.MetaBaseWallController{ constructor(dom){ super(dom); this.dom = dom; this.metaObject = this.createMetaObject() this.metaVerse = null; this.setupComponent(); this.updateMetaObject(); } get metaAttachedActions(){ return { attachMetaObject: true, assignRoomDimension: true } } get propertiesSettings(){ return { width: { type: Number, default: 1 }, length: { type: Number, default: 1 }, roomWidth: { type: Number, default: 1, onChange: "updateMetaObject" }, roomHeight: { type: Number, default: 1, onChange: "updateMetaObject" }, roomLength: { type: Number, default: 1, onChange: "updateMetaObject" } }; } get tagName() { return "meta-floor" } get metaChildrenNames(){ return ["meta-table", "meta-picture", "meta-text", "meta-board", "meta-item"] } get eventActionSettings(){ return { "meta-style": ['propagateMetaStyle'], "class": ["propagateMetaStyle"], "id": ["propagateMetaStyle"] } } updateMetaObject() { var mesh = this.metaObject.mesh; var group = this.metaObject.group; this.properties.width = this.properties.roomWidth; this.properties.length = this.properties.roomLength; group.rotation.x = 270 * (Math.PI/180); group.position.set(0, 0 , 0); mesh.scale.set(this.properties.roomWidth, this.properties.roomLength , 1); this.updateChildrenDisplayInline(); } } class MetaFloor extends MRM.MetaComponent { createdCallback() { this.controller = new MetaFloorController(this); super.createdCallback(); } metaDetached(e) { var targetController = e.detail.controller; if (this.controller.isChildren(targetController.tagName) ){ e.stopPropagation(); this.controller.metaObject.group.remove(targetController.metaObject.group); } } metaChildAttributeChanged(e){ var targetController = e.detail.controller; var attrName = e.detail.attrName if (this.controller.isChildren(targetController.tagName) ){ if(targetController.isAllowedAttribute(attrName)) { if (e.detail.actions.updateChildrenDisplayInline) { this.controller.updateChildrenDisplayInline() delete e.detail.actions.updateChildrenDisplayInline } } } } } document.registerElement('meta-floor', MetaFloor);
import 'isomorphic-fetch' import base64 from 'base-64' import utf8 from 'utf8' import Request from './Request' function encodeAccount(username, password) { let bytes = utf8.encode(`${ username }:${ password }`) return base64.encode(bytes) } export default class Stormpath { constructor({ application, authentication } = {}) { this.application = application this.authentication = authentication } retrieveApplication() { let url = `https://api.stormpath.com/v1/applications/${ this.application }/accounts` let options = { authentication: this.authentication } return Request.get(url, options) } createAccount(payload) { let url = `https://api.stormpath.com/v1/applications/${ this.application }/accounts` let options = { authentication: this.authentication, payload: payload } return Request.post(url, options) } retrieveAccount(account) { let url = `https://api.stormpath.com/v1/accounts/${ account }` let options = { authentication: this.authentication } return Request.get(url, options) } authenticateAccount({ username, password } = {}) { let url = `https://api.stormpath.com/v1/applications/${ this.application }/loginAttempts` //url = 'http://requestb.in/uwektzuw' let payload = { type: 'basic', value: encodeAccount(username, password) } let options = { authentication: this.authentication, payload: payload } return Request.post(url, options) } } if (require.main === module) { const credentials = { application: 'zDhRIszpk93AwssJDXuPs', authentication: { username: '1HU99B538PG3SW50K5M2NPJBW', password: '7ukbB9oDRjgyMEX/057SKtAwwLtOR3fbKvNQOp4i/uI' } } const account = { givenName: 'Denis', surname: 'Storm', username: 'DenisCarriere', email: '[email protected]', password: 'Denis44C', customData: { number: 4 } } const stormpath = new Stormpath(credentials) //stormpath.createAccount(account) //stormpath.retrieveApplication() stormpath.authenticateAccount(account) stormpath.retrieveAccount('3NElH12QutCmRSi3e6PAmI') .then( data => console.log(data), error => console.log(error) ) }
/* global Fae, SimpleMDE, toolbarBuiltInButtons */ /** * Fae form text * @namespace form.text * @memberof form */ Fae.form.text = { init: function() { this.overrideMarkdownDefaults(); this.initMarkdown(); }, /** * Override SimpleMDE's preference for font-awesome icons and use a modal for the guide * @see {@link modals.markdownModal} */ overrideMarkdownDefaults: function() { toolbarBuiltInButtons['bold'].className = 'icon-bold'; toolbarBuiltInButtons['italic'].className = 'icon-italic'; toolbarBuiltInButtons['heading'].className = 'icon-font'; toolbarBuiltInButtons['code'].className = 'icon-code'; toolbarBuiltInButtons['unordered-list'].className = 'icon-list-ul'; toolbarBuiltInButtons['ordered-list'].className = 'icon-list-ol'; toolbarBuiltInButtons['link'].className = 'icon-link'; toolbarBuiltInButtons['image'].className = 'icon-image'; toolbarBuiltInButtons['quote'].className = 'icon-quote'; toolbarBuiltInButtons['fullscreen'].className = 'icon-fullscreen no-disable no-mobile'; toolbarBuiltInButtons['horizontal-rule'].className = 'icon-minus'; toolbarBuiltInButtons['preview'].className = 'icon-eye no-disable'; toolbarBuiltInButtons['side-by-side'].className = 'icon-columns no-disable no-mobile'; toolbarBuiltInButtons['guide'].className = 'icon-question'; // Override SimpleMDE's default guide and use a homegrown modal toolbarBuiltInButtons['guide'].action = Fae.modals.markdownModal; }, /** * Find all markdown fields and initialize them with a markdown GUI * @has_test {features/form_helpers/fae_input_spec.rb} */ initMarkdown: function() { $('.js-markdown-editor:not(.mde-enabled)').each(function() { var $this = $(this); var editor = new SimpleMDE({ element: this, autoDownloadFontAwesome: false, status: false, spellChecker: false, hideIcons: ['image', 'side-by-side', 'fullscreen', 'preview'] }); // Disable tabbing within editor editor.codemirror.options.extraKeys['Tab'] = false; editor.codemirror.options.extraKeys['Shift-Tab'] = false; $this.addClass('mde-enabled'); // code mirror events to hook into current form element functions editor.codemirror.on('change', function(){ // updates the original textarea's value for JS validations $this.val(editor.value()); // update length counter Fae.form.validator.length_counter.updateCounter($this); }); editor.codemirror.on('focus', function(){ $this.parent().addClass('mde-focus'); }); editor.codemirror.on('blur', function(){ // trigger blur on the original textarea to trigger JS validations $this.blur(); $this.parent().removeClass('mde-focus'); }); }); } };
'use babel'; // eslint-disable-next-line import { CompositeDisposable, TextEditor, Directory } from 'atom'; import config from './config'; import Creator from './Creator'; import Insertor from './Insertor'; class DavsPackage { constructor() { this.reactReduxUtilsView = null; this.modalPanel = null; this.subscriptions = null; this.config = config; } activate() { // Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable this.subscriptions = new CompositeDisposable(); this.creator = new Creator(); this.insertor = new Insertor(); // Register command that toggles this view this.subscriptions.add(atom.commands.add('atom-workspace', { 'davs-package:create': context => this.create(context), 'davs-package:insert': context => this.insert(context), 'core:confirm': (event) => { this.creator.confirmSelection(); event.stopPropagation(); }, })); } deactivate() { this.subscriptions.dispose(); } create(context) { this.creator.create(context); } insert() { this.insertor.insert(); } } export default new DavsPackage();
import React from 'react'; import PropTypes from 'prop-types'; import Text from '../Text/Text'; import { Styled } from './CalloutGroupItem.styles'; const CalloutGroupItem = ({ text, imgSrc, imgAlt, emoji }) => { return ( <> {!imgSrc ? ( !emoji ? ( <Text>{text}</Text> ) : ( <Text> <Styled.CalloutGroupItemTool> <Styled.CalloutGroupItemEmoji role="img" aria-label={imgAlt}> {emoji} </Styled.CalloutGroupItemEmoji> {text} </Styled.CalloutGroupItemTool> </Text> ) ) : ( <Text> <Styled.CalloutGroupItemTool> <Styled.CalloutGroupItemLogo src={imgSrc} alt={imgAlt} aria-label={imgAlt} /> {text} </Styled.CalloutGroupItemTool> </Text> )} </> ); }; CalloutGroupItem.defaultProps = { imgSrc: null, imgAlt: null, emoji: null, }; CalloutGroupItem.propTypes = { emoji: PropTypes.string, text: PropTypes.oneOfType([PropTypes.node, PropTypes.string]).isRequired, imgSrc: PropTypes.node, imgAlt: PropTypes.string, }; export default CalloutGroupItem;
// Render home page and json data exports.view = function(req, res){ // Import json data var logData = require("../data/log.json"); // Set ateFoodGroup to numerical values var ateGrains; if(req.body.ateGrains == null){ateGrains = 0;} else ateGrains = 1; var ateFruit; if(req.body.ateFruit == null){ateFruit = 0;} else ateFruit = 1; var ateDairy; if(req.body.ateDairy == null){ateDairy = 0;} else ateDairy = 1; var ateProtein; if(req.body.ateProtein == null){ateProtein = 0;} else ateProtein = 1; var ateVeggies; if(req.body.ateVeggies == null){ateVeggies = 0;} else ateVeggies = 1; // Creat new JSON and append to log var newLog = { "id": logData.length + 1, "name": req.body.food, "dd": req.body.dd, "mm": req.body.mm, "year": req.body.yy, "cal": parseInt(req.body.cal), "mood": parseInt(req.body.mood), "info": req.body.info, "image": "public/images/food/oj.jpg", "ateGrains": ateGrains, "ateFruit": ateFruit, "ateVeggies": ateVeggies, "ateProtein": ateProtein, "ateDairy": ateDairy } logData.push(newLog); var newData = JSON.stringify(logData); var fs = require('fs'); fs.writeFile("data/log.json",newData, function(err) { if(err) { return console.log(err); } console.log("The new log was saved!"); res.redirect('/vet'); }); };
var expect = require('expect.js'); var Promise = require('bluebird'); var ZugZug = require('../lib/zugzug'); var Job = require('../lib/job'); describe('job.delete():Promise(self)', function() { var zz, job; beforeEach(function() { zz = new ZugZug(); job = new Job(zz, 'default'); }); afterEach(function(done) { Promise.promisify(zz._client.flushall, zz._client)() .then(zz.quit.bind(zz)) .done(function() {done();}); }); it('returns a promise', function(done) { job.save() .then(function() { var p = job.delete(); expect(p).to.be.a(Promise); return p.thenReturn(); }) .done(done); }); it('resolves to the instance', function(done) { job.save() .then(function() { return job.delete(); }) .then(function(res) { expect(res).to.equal(job); }) .done(done); }); it('deletes the job from the database', function(done) { var id; job.save() .then(function() { expect(job.id).to.equal('1'); id = job.id; return job.delete(); }) .then(function() { return zz.getJob(id); }) .then(function(res) { expect(res).to.equal(null); }) .done(done); }); it('resets the job\'s state', function(done) { job.save() .then(function() { return job.delete(); }) .then(function() { expect(job.id).to.be(undefined); expect(job.created).to.be(undefined); expect(job.updated).to.be(undefined); expect(job.state).to.be(undefined); }) .done(done); }); it('deletes the job\'s log', function(done) { var id; job.save() .then(function() { expect(job.id).to.equal('1'); id = job.id; return job.delete(); }) .then(function() { var m = zz._client.multi() .llen('zugzug:job:' + id + ':log'); return Promise.promisify(m.exec, m)(); }) .spread(function(newlen) { expect(newlen).to.equal(0); }) .done(done); }); });
'use strict'; module.exports = { app: { title: 'Surf Around The Corner', description: 'Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js', keywords: 'MongoDB, Express, AngularJS, Node.js' }, port: process.env.PORT || 3000, templateEngine: 'swig', sessionSecret: 'MEAN', sessionCollection: 'sessions', assets: { lib: { css: [ 'public/lib/components-font-awesome/css/font-awesome.css', 'public/lib/angular-ui-select/dist/select.css', 'http://fonts.googleapis.com/css?family=Bree+Serif', 'http://fonts.googleapis.com/css?family=Open+Sans', 'http://fonts.googleapis.com/css?family=Playfair+Display', 'http://fonts.googleapis.com/css?family=Dancing+Script', 'http://fonts.googleapis.com/css?family=Nunito' //'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css' ], js: [ 'public/lib/angular/angular.js', 'public/lib/angular-resource/angular-resource.js', 'public/lib/angular-cookies/angular-cookies.js', 'public/lib/angular-animate/angular-animate.js', 'public/lib/angular-touch/angular-touch.js', 'public/lib/angular-sanitize/angular-sanitize.js', 'public/lib/angular-ui-router/release/angular-ui-router.js', 'public/lib/angular-ui-utils/ui-utils.js', 'public/lib/jquery/dist/jquery.js', 'public/lib/angular-bootstrap/ui-bootstrap-tpls.js', 'public/lib/angular-ui-select/dist/select.js', 'public/lib/ng-lodash/build/ng-lodash.js', 'public/lib/ng-backstretch/dist/ng-backstretch.js', 'public/lib/ngFitText/src/ng-FitText.js' ] }, css: [ 'public/less/*.css', 'public/modules/**/css/*.css' ], js: [ 'public/config.js', 'public/application.js', 'public/modules/*/*.js', 'public/modules/*/*[!tests]*/*.js' ], tests: [ 'public/lib/angular-mocks/angular-mocks.js', 'public/modules/*/tests/*.js' ] } };
// anonymous closure - BEGIN (function(jQuery){ // anonymous closure - BEGIN ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// // include microevent.js // ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// var microevent = function(){} microevent.prototype = { fcts : {}, bind : function(event, fct){ this.fcts[event] = this.fcts[event] || []; this.fcts[event].push(fct); return this; }, unbind : function(event, fct){ console.assert(typeof fct === 'function') var arr = this.fcts[event]; if( typeof arr !== 'undefined' ) return this; console.assert(arr.indexOf(fct) !== -1); arr.splice(arr.indexOf(fct), 1); return this; }, trigger : function(event /* , args... */){ var arr = this.fcts[event]; if( typeof arr === 'undefined' ) return this; for(var i = 0; i < arr.length; i++){ arr[i].apply(this, Array.prototype.slice.call(arguments, 1)) } return this; } }; microevent.mixin = function(destObject){ var props = ['bind', 'unbind', 'trigger']; for(var i = 0; i < props.length; i ++){ destObject.prototype[props[i]] = microevent.prototype[props[i]]; } destObject.prototype['fcts'] = {}; } ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// // Acewidget class // ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// /** * The internal class of the jquery plugin * * - it has an event emitter. * - acewidget.bind('load', function(){console.log("widget loaded")}) * - acewidget.unbind('load', function(){console.log("widget loaded")}) }) */ var Acewidget = function(ctorOpts, jQueryContainer) { var self = this; // determine the options var opts = jQuery.extend(true, {}, { width : "600px", height : "400px", theme : "twilight", mode : "javascript", iframeUrl : "http://jeromeetienne.github.com/acewidget/iframe.html" }, ctorOpts); // build the queryUrl var queryUrl = ""; if( opts.theme) queryUrl += (queryUrl?"&":'') + "theme="+opts.theme; if( opts.mode ) queryUrl += (queryUrl?"&":'') + "mode=" +opts.mode; // init some variables var finalUrl = opts.iframeUrl + (queryUrl?'?'+queryUrl:'') var domId = "acewidget-"+Math.floor(Math.random()*99999).toString(36); this.elemSelect = "#"+domId; // build the dom element var elem = jQuery("<iframe>").attr({ src : finalUrl, id : domId, width : opts.width, height : opts.height }) // empty the container and insert the just built element $(jQueryContainer).empty().append(elem); // bind the element 'load' event jQuery(elem).bind("load", function(){ self.trigger("load"); }); // bind message jQuery(window).bind('message', {self: this}, this._onMessage); } /** * Destructor */ Acewidget.prototype.destroy = function(){ // unbind message jQuery(window).unbind('message', this._onMessage); jQuery(this.elemSelect).remove(); } /** * Received the message from the iframe */ Acewidget.prototype._onMessage = function(jQueryEvent){ var event = jQueryEvent.originalEvent; //console.log("event.data", event.data); var data = JSON.parse(event.data); // notify the callback if specified if( 'userdata' in data && 'callback' in data.userdata ){ //console.log("notify callback to", data.userdata.callback, "with", data) var callback = window[data.userdata.callback]; // remove the callback from the dom delete window[data.userdata.callback]; // remove the callback from data.userdata // - thus the user get its userdata unchanged delete data.userdata.callback; // if data.userdata is now empty, remove it if( Object.keys(data.userdata).length === 0 ) delete data.userdata; // notify the caller callback(data); } } /** * Send message to the iframe */ Acewidget.prototype._send = function(event, callback){ var iframeWin = jQuery(this.elemSelect).get(0).contentWindow; // if a callback is present, install it now if( callback ){ event.userdata = event.userdata || {} event.userdata.callback = "acewidgetCall-"+Math.floor(Math.random()*99999).toString(36); window[event.userdata.callback] = function(data){ callback(data) }; } // post the message iframeWin.postMessage(JSON.stringify(event), "*"); } /** * Helper for setValue event * * - this is a helper function on top of acewidget.send() * * @param {String} text the text to push in acewidget * @param {Function} callback will be notified with the result (jsend compliant) */ Acewidget.prototype.setValue = function(text, callback){ this._send({ type : "setValue", data : { text: text } }, callback); } /** * Helper for setValue event * * - this is a helper function on top of acewidget.send() * * @param {String} text the text to push in acewidget * @param {Function} callback will be notified with the result (jsend compliant) */ Acewidget.prototype.getValue = function(callback){ this._send({ type : "getValue" }, callback); } /** * Helper for setValue event * * - this is a helper function on top of acewidget.send() * * @param {String} text the text to push in acewidget * @param {Function} callback will be notified with the result (jsend compliant) */ Acewidget.prototype.setTabSize = function(tabSize, callback){ this._send({ type : "setTabSize", data : { size: tabSize } }, callback); } // mixin microevent.js in Acewidget microevent.mixin(Acewidget); ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// // jQuery plugin itself // ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// // declare the jquery plugin jQuery.fn.acewidget = function(ctorOpts) { var jQueryContainer = this; return new Acewidget(ctorOpts, jQueryContainer) } // anonymous closure - END })(jQuery) // anonymous closure - END
"use strict"; var assert = require("assert"); var stringmap = require("stringmap"); var stringset = require("stringset"); var is = require("simple-is"); var fmt = require("simple-fmt"); var error = require("./error"); var UUID = 1; function Scope(args) { assert(is.someof(args.kind, ["hoist", "block", "catch-block"])); assert(is.object(args.node)); assert(args.parent === null || is.object(args.parent)); this.uuid = UUID++; // kind === "hoist": function scopes, program scope, injected globals // kind === "block": ES6 block scopes // kind === "catch-block": catch block scopes this.kind = args.kind; // the AST node the block corresponds to this.node = args.node; // parent scope this.parent = args.parent; // this Scope is a wrapper. wrapper scopes will be skipped from hoist scope searching this.wrapper = !!args.wrapper; // children scopes for easier traversal (populated internally) this.children = []; // scope declarations. decls[variable_name] = { // kind: "fun" for functions, // "param" for function parameters, // "caught" for catch parameter // "var", // "const", // "let" // node: the AST node the declaration corresponds to // from: source code index from which it is visible at earliest // (only stored for "const", "let" [and "var"] nodes) // } this.decls = stringmap(); // variables (probably temporary) that are free-for-change this.freeVariables = []; // names of all declarations within this scope that was ever written // TODO move to decls.w? // TODO create corresponding read? this.written = stringset(); // names of all variables declared outside this hoist scope but // referenced in this scope (immediately or in child). // only stored on hoist scopes for efficiency // (because we currently generate lots of empty block scopes) this.propagates = (this.kind === "hoist" ? stringset() : null); // scopes register themselves with their parents for easier traversal if (this.parent) { this.parent.children.push(this); } } Scope.setOptions = function(options) { Scope.options = options; }; Scope.prototype.print = function(indent) { indent = indent || 0; var scope = this; var names = this.decls.keys().map(function(name) { return fmt("{0} [{1}]", name, scope.decls.get(name).kind); }).join(", "); var propagates = this.propagates ? this.propagates.items().join(", ") : ""; console.log(fmt("{0}{1}: {2}. propagates: {3}", fmt.repeat(" ", indent), this.node.type, names, propagates)); this.children.forEach(function(c) { c.print(indent + 2); }); }; function isObjectPattern(node) { return node && node.type === 'ObjectPattern'; } function isArrayPattern(node) { return node && node.type === 'ArrayPattern'; } function isFunction(node) { var type; return node && ((type = node.type) === "FunctionDeclaration" || type === "FunctionExpression" || type === "ArrowFunctionExpression"); } function isLoop(node) { var type; return node && ((type = node.type) === "ForStatement" || type === "ForInStatement" || type === "ForOfStatement" || type === "WhileStatement" || type === "DoWhileStatement"); } function isBlockScoped(kind) { return is.someof(kind, ["const", "let", "caught"]); } Scope.prototype.mutate = function(newKind) { if( this.kind !== newKind ) { assert(is.someof(newKind, ["hoist", "block", "catch-block"])); this.kind = newKind; this.propagates = (this.kind === "hoist" ? stringset() : null); } }; Scope.prototype.add = function(name, kind, node, referableFromPos, freeFromPosition, originalDeclarator) { assert(is.someof(kind, ["fun", "param", "var", "caught", "const", "let", "get", "set"]), kind + " is a wrong kind"); var isGlobal = node && (node.range || [])[0] < 0; if (!name && isObjectPattern(node)) { node.properties.forEach(function(property) { property && this.add(property.value.name, kind, property.value, referableFromPos, freeFromPosition, property.key); }, this); return; } if (!name && isArrayPattern(node)) { node.elements.forEach(function(element) { element && this.add(element.name, kind, element, element.range[0]) }, this); return; } if (!name && node.type === "SpreadElement") { name = node.argument.name; } function isConstLet(kind) { return is.someof(kind, ["const", "let"]); } var scope = this; // search nearest hoist-scope for fun, param and var's // const, let and caught variables go directly in the scope (which may be hoist, block or catch-block) if (is.someof(kind, ["fun", "param", "var"])) { while (scope.kind !== "hoist") { if (scope.decls.has(name) && isConstLet(scope.decls.get(name).kind)) { // could be caught return error(node.loc.start.line, "{0} is already declared", name); } scope = scope.parent; } } {// name exists in scope and either new or existing kind is const|let|catch => error var hasAlready = scope.decls.has(name); var existingKind; if ( hasAlready ) { existingKind = scope.decls.get(name).kind; } else {// Special test for "catch-block". Maybe it's not so prettily, but it works var parentScope = scope.parent; if ( parentScope && parentScope.kind === "catch-block" ) { hasAlready = parentScope.decls.has(name) && (existingKind = parentScope.decls.get(name).kind) === "caught" ; } } if ( hasAlready ) { if ( kind == 'get' && existingKind == 'set' || kind == 'set' && existingKind == 'get' ) { // all is fine //TODO:: do something to allow getter and setter declaration both be in scope.decls } else if ( Scope.options.disallowDuplicated || isBlockScoped(existingKind) || isBlockScoped(kind) ) { return error(node.loc.start.line, "{0} is already declared", name); } } } var declaration = { kind: kind, node: node, isGlobal: isGlobal, refs: [ /*reference node's*/ ] }; if ( referableFromPos !== void 0 ) { assert(is.someof(kind, ["var", "const", "let"]), kind + " is not one of [var, const, let]"); if (originalDeclarator) { declaration.from = originalDeclarator.range[0]; } else { declaration.from = referableFromPos; } } if ( freeFromPosition !== void 0 ) { assert(is.someof(kind, ["var", "const", "let"]), kind + " is not one of [var, const, let]"); if (originalDeclarator) { declaration.to = originalDeclarator.range[1]; } else { declaration.to = freeFromPosition; } } scope.decls.set(name, declaration); }; Scope.prototype.getKind = function(name) { assert(is.string(name), "name " + "'" + name + "' must be a string"); var decl = this.decls.get(name); return decl ? decl.kind : null; }; Scope.prototype.getNode = function(name) { assert(is.string(name), "name " + "'" + name + "' must be a string"); var decl = this.decls.get(name); return decl ? decl.node : null; }; Scope.prototype.getFromPos = function(name) { assert(is.string(name), "name " + "'" + name + "' must be a string"); var decl = this.decls.get(name); return decl ? decl.from : null; }; Scope.prototype.addRef = function(node) { assert(node && typeof node === 'object'); var name = node.name; assert(is.string(name), "name " + "'" + name + "' must be a string"); var decl = this.decls.get(name); assert(decl, "could not find declaration for reference " + name); decl.refs.push(node); }; Scope.prototype.getRefs = function(name) { assert(is.string(name), "name " + "'" + name + "' must be a string"); var decl = this.decls.get(name); return decl ? decl.refs : null; }; Scope.prototype.get = function(name) { return this.decls.get(name); }; Scope.prototype.hasOwn = function(name) { return this.decls.has(name); }; Scope.prototype.remove = function(name) { return this.decls.delete(name); }; Scope.prototype.pushFree = function(name, endsFrom) { this.freeVariables.push({name: name, endsFrom: endsFrom}); return name; }; Scope.prototype.popFree = function(startsFrom) { var candidate; for( var index = 0, length = this.freeVariables.length ; index < length ; index++ ) { candidate = this.freeVariables[index]; if( candidate.endsFrom && candidate.endsFrom <= startsFrom ) { this.freeVariables.splice(index, 1); candidate = candidate.name; break; } candidate = null; } return candidate || null; }; Scope.prototype.doesPropagate = function(name) { assert(this.kind === "hoist"); return this.kind === "hoist" && this.propagates.has(name); }; Scope.prototype.markPropagates = function(name) { assert(this.kind === "hoist"); this.propagates.add(name); }; Scope.prototype.doesThisUsing = function() { return this.__thisUsing || false; }; Scope.prototype.markThisUsing = function() { this.__thisUsing = true; }; Scope.prototype.doesArgumentsUsing = function() { return this.__argumentsUsing || false; }; Scope.prototype.markArgumentsUsing = function() { this.__argumentsUsing = true; }; Scope.prototype.closestHoistScope = function() { var scope = this; while ( scope.kind !== "hoist" || scope.wrapper ) { scope = scope.parent; } return scope; }; Scope.prototype.lookup = function(name) { for (var scope = this; scope; scope = scope.parent) { if (scope.decls.has(name) || isFunction(scope.node) && scope.node.rest && scope.node.rest.name == name ) { return scope; } else if (scope.kind === "hoist") { scope.propagates.add(name); } } return null; }; Scope.prototype.markWrite = function(name) { assert(is.string(name), "name " + "'" + name + "' must be a string"); this.written.add(name); }; // detects let variables that are never modified (ignores top-level) Scope.prototype.detectUnmodifiedLets = function() { var outmost = this; function detect(scope) { if (scope !== outmost) { scope.decls.keys().forEach(function(name) { if (scope.getKind(name) === "let" && !scope.written.has(name)) { return error(scope.getNode(name).loc.start.line, "{0} is declared as let but never modified so could be const", name); } }); } scope.children.forEach(function(childScope) { detect(childScope);; }); } detect(this); }; Scope.prototype.traverse = function(options) { options = options || {}; var pre = options.pre; var post = options.post; function visit(scope) { if (pre) { pre(scope); } scope.children.forEach(function(childScope) { visit(childScope); }); if (post) { post(scope); } } visit(this); }; //function __show(__a, scope) { // __a += " " ; // // if( scope ) { // console.log(__a + " | " + scope.uuid); // // if( (scope.children[0] || {}).uuid == scope.uuid ) { // throw new Error("123") // } // scope.children.forEach(__show.bind(null, __a)) // } //} // //Object.keys(Scope.prototype).forEach(function(name) {//wrap all // var fun = Scope.prototype[name]; // Scope.prototype[name] = function() { // try { // return fun.apply(this, arguments); // } // catch(e) { // console.error("ERROR:", name) // __show(" ", this); // } // } //}) module.exports = Scope;
"use strict";var assert;module.watch(require('assert'),{default(v){assert=v}},0);var unhexArray;module.watch(require('./testutil'),{unhexArray(v){unhexArray=v}},1);var table;module.watch(require('../src/table'),{default(v){table=v}},2); describe('table.js', function() { it('should make a ScriptList table', function() { // https://www.microsoft.com/typography/OTSPEC/chapter2.htm Examples 1 & 2 var expectedData = unhexArray( '0003 68616E69 0014 6B616E61 0020 6C61746E 002E' + // Example 1 (hani, kana, latn) '0004 0000 0000 FFFF 0001 0003' + // hani lang sys '0004 0000 0000 FFFF 0002 0003 0004' + // kana lang sys '000A 0001 55524420 0016' + // Example 2 for latn '0000 FFFF 0003 0000 0001 0002' + // DefLangSys '0000 0003 0003 0000 0001 0002' // UrduLangSys ); assert.deepEqual(new table.ScriptList([ { tag: 'hani', script: { defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [3] }, langSysRecords: [] } }, { tag: 'kana', script: { defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [3, 4] }, langSysRecords: [] } }, { tag: 'latn', script: { defaultLangSys: { reserved: 0, reqFeatureIndex: 0xffff, featureIndexes: [0, 1, 2] }, langSysRecords: [{ tag: 'URD ', langSys: { reserved: 0, reqFeatureIndex: 3, featureIndexes: [0, 1, 2] } }] } }, ]).encode(), expectedData); }); });
/*jshint node:true */ module.exports = function( grunt ) { "use strict"; var entryFiles = grunt.file.expandFiles( "entries/*.xml" ); grunt.loadNpmTasks( "grunt-clean" ); grunt.loadNpmTasks( "grunt-wordpress" ); grunt.loadNpmTasks( "grunt-jquery-content" ); grunt.loadNpmTasks( "grunt-check-modules" ); grunt.initConfig({ clean: { folder: "dist" }, lint: { grunt: "grunt.js" }, xmllint: { all: [].concat( entryFiles, "categories.xml", "entries2html.xsl" ) }, xmltidy: { all: [].concat( entryFiles, "categories.xml" ) }, "build-pages": { all: grunt.file.expandFiles( "pages/**" ) }, "build-xml-entries": { all: entryFiles }, "build-resources": { all: grunt.file.expandFiles( "resources/**" ) }, wordpress: grunt.utils._.extend({ dir: "dist/wordpress" }, grunt.file.readJSON( "config.json" ) ), watch: { scripts: { files: 'entries/*.xml', tasks: ['wordpress-deploy'], options: { interrupt: true } } } }); grunt.registerTask( "default", "build-wordpress" ); grunt.registerTask( "build", "build-pages build-xml-entries build-xml-categories build-xml-full build-resources" ); grunt.registerTask( "build-wordpress", "check-modules clean lint xmllint build" ); grunt.registerTask( "tidy", "xmllint xmltidy" ); };
var searchData= [ ['slot_5fcount',['SLOT_COUNT',['../classmastermind_1_1_mastermind.html#ad4cfc8127641ff8dfe89d65ae232331c',1,'mastermind::Mastermind']]] ];
(function() { var AS = this, Fn = AS.Fn; // assign $.extend(Fn, { execConvPrint: execConvPrint }); return; function execConvPrint() { var b_FPR = AS.Bo.FPR; var fn = null; try { if(b_FPR.Value('convfn') == "function(i, f, a){\n}") throw Error('Function is not modified'); fn = eval('(' + (b_FPR.Value('convfn') || null) + ')'); if(typeof fn != 'function') throw Error('Not function.'); } catch(e) { return b_FPR.error(e); } if(execConvPrint.last) // TODO remove console.log(execConvPrint.last); var fncs = b_FPR.Value('items[func]'); var args = b_FPR.Value('items[args]'); var memo = {}; fncs.forEach(function(func, i) { var a = null; try { a = eval('(' + args[i] + ')'); } catch(e) { return console.log('JSON.parse fail No.' + i, args[i]); } var nval = fn.call(b_FPR, i, func, $.extend(true, [], a)); nval && (function() { console.log('changing idx[' + i + ']', a, nval); b_FPR.Value('items[args][' + i + ']', JSON.stringify(nval)); memo[i] = {}, memo[i].func = func, memo[i].args = a; })(); }); execConvPrint.last = memo; b_FPR.notice('変換完了', Fn.noticeOpt()); } }).call(window.AppSpace);
const gulp = require('gulp'); const spawn = require('../lib/spawn'); const config = require('../config'); gulp.task('webpack', (callback) => { if (config.context === 'production') { process.env.NODE_ENV = 'production'; } process.env.WEBPACK_CONTEXT = config.context; const options = []; if (config.context === 'watch') { options.push('-w'); } spawn('node_modules/.bin/webpack', options, callback); });
/*! * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5) * (c) Copyright 2009-2014 SAP AG or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ jQuery.sap.declare("sap.m.BusyDialogRenderer");sap.m.BusyDialogRenderer={}; sap.m.BusyDialogRenderer.render=function(r,c){r.write("<div");r.writeControlData(c);r.addClass("sapMBusyDialog sapMCommonDialog");if(jQuery.device.is.iphone){r.addClass("sapMDialogHidden")}if(!c._isPlatformDependent){if(!c.getText()&&!c.getTitle()&&!c.getShowCancelButton()){r.addClass("sapMBusyDialogSimple")}}if(sap.m._bSizeCompact){r.addClass("sapUiSizeCompact")}r.writeClasses();var t=c.getTooltip_AsString();if(t){r.writeAttributeEscaped("title",t)}r.write(">");if(c.getTitle()){r.write("<header class=\"sapMDialogTitle\">");r.writeEscaped(c.getTitle());r.write("</header>")}if(sap.ui.Device.os.ios||!c._isPlatformDependent){r.renderControl(c._oLabel);r.renderControl(c._busyIndicator)}else{r.renderControl(c._busyIndicator);r.renderControl(c._oLabel)}if(c.getShowCancelButton()){if(sap.ui.Device.system.phone){r.write("<footer class='sapMBusyDialogFooter sapMFooter-CTX'>");r.renderControl(c._oButton);r.write("</footer>")}else{r.renderControl(c._oButtonToolBar)}}r.write("</div>")};
'use strict'; /* jshint ignore:start */ /** * This code was generated by * \ / _ _ _| _ _ * | (_)\/(_)(_|\/| |(/_ v1.0.0 * / / */ /* jshint ignore:end */ var Holodeck = require('../../../holodeck'); /* jshint ignore:line */ var Request = require( '../../../../../lib/http/request'); /* jshint ignore:line */ var Response = require( '../../../../../lib/http/response'); /* jshint ignore:line */ var RestException = require( '../../../../../lib/base/RestException'); /* jshint ignore:line */ var Twilio = require('../../../../../lib'); /* jshint ignore:line */ var serialize = require( '../../../../../lib/base/serialize'); /* jshint ignore:line */ var client; var holodeck; describe('Sink', function() { beforeEach(function() { holodeck = new Holodeck(); client = new Twilio('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'AUTHTOKEN', { httpClient: holodeck }); }); it('should generate valid fetch request', function(done) { holodeck.mock(new Response(500, {})); var promise = client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch(); promise.then(function() { throw new Error('failed'); }, function(error) { expect(error.constructor).toBe(RestException.prototype.constructor); done(); }).done(); var sid = 'DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; var url = `https://events.twilio.com/v1/Sinks/${sid}`; holodeck.assertHasRequest(new Request({ method: 'GET', url: url })); } ); it('should generate valid fetch response', function(done) { var body = { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:111111111:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'A Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }; holodeck.mock(new Response(200, body)); var promise = client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch(); promise.then(function(response) { expect(response).toBeDefined(); done(); }, function() { throw new Error('failed'); }).done(); } ); it('should generate valid create request', function(done) { holodeck.mock(new Response(500, {})); var opts = {'description': 'description', 'sinkConfiguration': {}, 'sinkType': 'kinesis'}; var promise = client.events.v1.sinks.create(opts); promise.then(function() { throw new Error('failed'); }, function(error) { expect(error.constructor).toBe(RestException.prototype.constructor); done(); }).done(); var url = 'https://events.twilio.com/v1/Sinks'; var values = { 'Description': 'description', 'SinkConfiguration': serialize.object({}), 'SinkType': 'kinesis', }; holodeck.assertHasRequest(new Request({ method: 'POST', url: url, data: values })); } ); it('should generate valid create response', function(done) { var body = { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:111111111:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'My Kinesis Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }; holodeck.mock(new Response(201, body)); var opts = {'description': 'description', 'sinkConfiguration': {}, 'sinkType': 'kinesis'}; var promise = client.events.v1.sinks.create(opts); promise.then(function(response) { expect(response).toBeDefined(); done(); }, function() { throw new Error('failed'); }).done(); } ); it('should generate valid create_segment response', function(done) { var body = { 'status': 'initialized', 'sink_configuration': { 'write_key': 'MY_WRITEKEY' }, 'description': 'My segment Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'segment', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }; holodeck.mock(new Response(201, body)); var opts = {'description': 'description', 'sinkConfiguration': {}, 'sinkType': 'kinesis'}; var promise = client.events.v1.sinks.create(opts); promise.then(function(response) { expect(response).toBeDefined(); done(); }, function() { throw new Error('failed'); }).done(); } ); it('should generate valid remove request', function(done) { holodeck.mock(new Response(500, {})); var promise = client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove(); promise.then(function() { throw new Error('failed'); }, function(error) { expect(error.constructor).toBe(RestException.prototype.constructor); done(); }).done(); var sid = 'DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; var url = `https://events.twilio.com/v1/Sinks/${sid}`; holodeck.assertHasRequest(new Request({ method: 'DELETE', url: url })); } ); it('should generate valid delete response', function(done) { var body = null; holodeck.mock(new Response(204, body)); var promise = client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove(); promise.then(function(response) { expect(response).toBe(true); done(); }, function() { throw new Error('failed'); }).done(); } ); it('should treat the first each arg as a callback', function(done) { var body = { 'sinks': [ { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:111111111:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'A Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T19:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T19:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }, { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:222222222:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'ANOTHER Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Validate' } }, { 'status': 'active', 'sink_configuration': { 'destination': 'http://example.org/webhook', 'method': 'POST', 'batch_events': true }, 'description': 'A webhook Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'date_created': '2015-07-30T21:00:00Z', 'sink_type': 'webhook', 'date_updated': '2015-07-30T21:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Validate' } } ], 'meta': { 'page': 0, 'page_size': 20, 'first_page_url': 'https://events.twilio.com/v1/Sinks?PageSize=20&Page=0', 'previous_page_url': null, 'url': 'https://events.twilio.com/v1/Sinks?PageSize=20&Page=0', 'next_page_url': null, 'key': 'sinks' } }; holodeck.mock(new Response(200, body)); client.events.v1.sinks.each(() => done()); } ); it('should treat the second arg as a callback', function(done) { var body = { 'sinks': [ { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:111111111:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'A Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T19:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T19:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }, { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:222222222:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'ANOTHER Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Validate' } }, { 'status': 'active', 'sink_configuration': { 'destination': 'http://example.org/webhook', 'method': 'POST', 'batch_events': true }, 'description': 'A webhook Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'date_created': '2015-07-30T21:00:00Z', 'sink_type': 'webhook', 'date_updated': '2015-07-30T21:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Validate' } } ], 'meta': { 'page': 0, 'page_size': 20, 'first_page_url': 'https://events.twilio.com/v1/Sinks?PageSize=20&Page=0', 'previous_page_url': null, 'url': 'https://events.twilio.com/v1/Sinks?PageSize=20&Page=0', 'next_page_url': null, 'key': 'sinks' } }; holodeck.mock(new Response(200, body)); client.events.v1.sinks.each({pageSize: 20}, () => done()); holodeck.assertHasRequest(new Request({ method: 'GET', url: 'https://events.twilio.com/v1/Sinks', params: {PageSize: 20}, })); } ); it('should find the callback in the opts object', function(done) { var body = { 'sinks': [ { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:111111111:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'A Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T19:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T19:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }, { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:222222222:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'ANOTHER Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Validate' } }, { 'status': 'active', 'sink_configuration': { 'destination': 'http://example.org/webhook', 'method': 'POST', 'batch_events': true }, 'description': 'A webhook Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'date_created': '2015-07-30T21:00:00Z', 'sink_type': 'webhook', 'date_updated': '2015-07-30T21:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Validate' } } ], 'meta': { 'page': 0, 'page_size': 20, 'first_page_url': 'https://events.twilio.com/v1/Sinks?PageSize=20&Page=0', 'previous_page_url': null, 'url': 'https://events.twilio.com/v1/Sinks?PageSize=20&Page=0', 'next_page_url': null, 'key': 'sinks' } }; holodeck.mock(new Response(200, body)); client.events.v1.sinks.each({callback: () => done()}, () => fail('wrong callback!')); } ); it('should generate valid list request', function(done) { holodeck.mock(new Response(500, {})); var promise = client.events.v1.sinks.list(); promise.then(function() { throw new Error('failed'); }, function(error) { expect(error.constructor).toBe(RestException.prototype.constructor); done(); }).done(); var url = 'https://events.twilio.com/v1/Sinks'; holodeck.assertHasRequest(new Request({ method: 'GET', url: url })); } ); it('should generate valid read_empty response', function(done) { var body = { 'sinks': [], 'meta': { 'page': 0, 'page_size': 10, 'first_page_url': 'https://events.twilio.com/v1/Sinks?PageSize=10&Page=0', 'previous_page_url': null, 'url': 'https://events.twilio.com/v1/Sinks?PageSize=10&Page=0', 'next_page_url': null, 'key': 'sinks' } }; holodeck.mock(new Response(200, body)); var promise = client.events.v1.sinks.list(); promise.then(function(response) { expect(response).toBeDefined(); done(); }, function() { throw new Error('failed'); }).done(); } ); it('should generate valid read_results response', function(done) { var body = { 'sinks': [ { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:111111111:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'A Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T19:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T19:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }, { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:222222222:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'ANOTHER Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Validate' } }, { 'status': 'active', 'sink_configuration': { 'destination': 'http://example.org/webhook', 'method': 'POST', 'batch_events': true }, 'description': 'A webhook Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'date_created': '2015-07-30T21:00:00Z', 'sink_type': 'webhook', 'date_updated': '2015-07-30T21:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Validate' } } ], 'meta': { 'page': 0, 'page_size': 20, 'first_page_url': 'https://events.twilio.com/v1/Sinks?PageSize=20&Page=0', 'previous_page_url': null, 'url': 'https://events.twilio.com/v1/Sinks?PageSize=20&Page=0', 'next_page_url': null, 'key': 'sinks' } }; holodeck.mock(new Response(200, body)); var promise = client.events.v1.sinks.list(); promise.then(function(response) { expect(response).toBeDefined(); done(); }, function() { throw new Error('failed'); }).done(); } ); it('should generate valid read_results_in_use response', function(done) { var body = { 'sinks': [ { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:111111111:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'A Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T19:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T19:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }, { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:222222222:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'ANOTHER Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab/Validate' } }, { 'status': 'active', 'sink_configuration': { 'destination': 'http://example.org/webhook', 'method': 'POST', 'batch_events': true }, 'description': 'A webhook Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'date_created': '2015-07-30T21:00:00Z', 'sink_type': 'webhook', 'date_updated': '2015-07-30T21:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Validate' } } ], 'meta': { 'page': 0, 'page_size': 20, 'first_page_url': 'https://events.twilio.com/v1/Sinks?InUse=True&PageSize=20&Page=0', 'previous_page_url': null, 'url': 'https://events.twilio.com/v1/Sinks?InUse=True&PageSize=20&Page=0', 'next_page_url': null, 'key': 'sinks' } }; holodeck.mock(new Response(200, body)); var promise = client.events.v1.sinks.list(); promise.then(function(response) { expect(response).toBeDefined(); done(); }, function() { throw new Error('failed'); }).done(); } ); it('should generate valid read_results_status response', function(done) { var body = { 'sinks': [ { 'status': 'active', 'sink_configuration': { 'destination': 'http://example.org/webhook', 'method': 'POST', 'batch_events': true }, 'description': 'A webhook Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'date_created': '2015-07-30T21:00:00Z', 'sink_type': 'webhook', 'date_updated': '2015-07-30T21:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac/Validate' } } ], 'meta': { 'page': 0, 'page_size': 20, 'first_page_url': 'https://events.twilio.com/v1/Sinks?Status=active&PageSize=20&Page=0', 'previous_page_url': null, 'url': 'https://events.twilio.com/v1/Sinks?Status=active&PageSize=20&Page=0', 'next_page_url': null, 'key': 'sinks' } }; holodeck.mock(new Response(200, body)); var promise = client.events.v1.sinks.list(); promise.then(function(response) { expect(response).toBeDefined(); done(); }, function() { throw new Error('failed'); }).done(); } ); it('should generate valid update request', function(done) { holodeck.mock(new Response(500, {})); var opts = {'description': 'description'}; var promise = client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(opts); promise.then(function() { throw new Error('failed'); }, function(error) { expect(error.constructor).toBe(RestException.prototype.constructor); done(); }).done(); var sid = 'DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; var url = `https://events.twilio.com/v1/Sinks/${sid}`; var values = {'Description': 'description', }; holodeck.assertHasRequest(new Request({ method: 'POST', url: url, data: values })); } ); it('should generate valid update response', function(done) { var body = { 'status': 'initialized', 'sink_configuration': { 'arn': 'arn:aws:kinesis:us-east-1:111111111:stream/test', 'role_arn': 'arn:aws:iam::111111111:role/Role', 'external_id': '1234567890' }, 'description': 'My Kinesis Sink', 'sid': 'DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'date_created': '2015-07-30T20:00:00Z', 'sink_type': 'kinesis', 'date_updated': '2015-07-30T20:00:00Z', 'url': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'links': { 'sink_test': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Test', 'sink_validate': 'https://events.twilio.com/v1/Sinks/DGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Validate' } }; holodeck.mock(new Response(200, body)); var opts = {'description': 'description'}; var promise = client.events.v1.sinks('DGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').update(opts); promise.then(function(response) { expect(response).toBeDefined(); done(); }, function() { throw new Error('failed'); }).done(); } ); });
module.exports = { attributes: { group: { model: 'Group' }, user: { model: 'User' }, synchronized: 'boolean', active: 'boolean', child_group: { model: 'Group' }, level: 'integer' }, migrate: 'safe', tableName: 'all_membership_group', autoUpdatedAt: false, autoCreatedAt: false };
var Type = require("@kaoscript/runtime").Type; module.exports = function() { let tt = foo(); if(!Type.isValue(tt)) { tt = bar; } };
'use strict'; var mongoose = require('mongoose'); var Schema = mongoose.Schema; var TaskSchema = new Schema({ name: String, description: String, point: Number, task_users: [{ type: Schema.Types.ObjectId, ref: "TaskUser"}], _week: { type: Schema.Types.ObjectId, ref: "Week"} }); module.exports = mongoose.model('Task', TaskSchema);
const path = require("path"); const Nightmare = require("nightmare"); const { EncryptionAlgorithm, createAdapter } = require("../../dist/index.node.js"); const TEXT = "Hi there!\nThis is some test text.\n\të "; const sandboxURL = `file://${path.resolve(__dirname, "./sandbox.html")}`; const nightmare = Nightmare({ executionTimeout: 15000, loadTimeout: 5000, show: false }); describe("environment consistency", function() { beforeEach(async function() { nightmare.on("console", (log, ...args) => { console.log(`[Web] (${log})`, ...args); }); await nightmare.goto(sandboxURL); await nightmare.wait(1000); await nightmare.inject("js", path.resolve(__dirname, "../../web/index.js")); await nightmare.wait(1000); }); after(async function() { await nightmare.end(); }); describe("from node to web", function() { describe("text", function() { it("decrypts AES-CBC from node", async function() { const encrypted = await createAdapter() .setAlgorithm(EncryptionAlgorithm.CBC) .encrypt(TEXT, "sample-pass"); const result = await nightmare.evaluate(function(encrypted, done) { const { createAdapter } = window.iocane; createAdapter() .decrypt(encrypted, "sample-pass") .then(output => done(null, output)) .catch(done); }, encrypted); expect(result).to.equal(TEXT); }); it("decrypts AES-GCM from node", async function() { const encrypted = await createAdapter() .setAlgorithm(EncryptionAlgorithm.GCM) .encrypt(TEXT, "sample-pass"); const result = await nightmare.evaluate(function(encrypted, done) { const { createAdapter } = window.iocane; createAdapter() .decrypt(encrypted, "sample-pass") .then(output => done(null, output)) .catch(done); }, encrypted); expect(result).to.equal(TEXT); }); }); describe("data", function() { beforeEach(function() { this.randomData = []; for (let i = 0; i < 50000; i += 1) { this.randomData.push(Math.floor(Math.random() * 256)); } this.data = Buffer.from(this.randomData); }); it("decrypts AES-CBC from node", async function() { const encrypted = await createAdapter() .setAlgorithm(EncryptionAlgorithm.CBC) .encrypt(this.data, "sample-pass"); const result = await nightmare.evaluate(function(encrypted, done) { const { createAdapter } = window.iocane; const data = window.helpers.base64ToArrayBuffer(encrypted); createAdapter() .decrypt(data, "sample-pass") .then(output => done(null, window.helpers.arrayBufferToBase64(output))) .catch(done); }, encrypted.toString("base64")); expect(Buffer.from(result, "base64")).to.satisfy(res => res.equals(this.data)); }); it("decrypts AES-GCM from node", async function() { const encrypted = await createAdapter() .setAlgorithm(EncryptionAlgorithm.GCM) .encrypt(this.data, "sample-pass"); const result = await nightmare.evaluate(function(encrypted, done) { const { createAdapter } = window.iocane; const data = window.helpers.base64ToArrayBuffer(encrypted); createAdapter() .decrypt(data, "sample-pass") .then(output => done(null, window.helpers.arrayBufferToBase64(output))) .catch(done); }, encrypted.toString("base64")); expect(Buffer.from(result, "base64")).to.satisfy(res => res.equals(this.data)); }); }); }); describe("from web to node", function() { describe("text", function() { it("decrypts AES-CBC from web", async function() { const encrypted = await nightmare.evaluate(function(raw, done) { const { EncryptionAlgorithm, createAdapter } = window.iocane; createAdapter() .setAlgorithm(EncryptionAlgorithm.CBC) .encrypt(raw, "sample-pass") .then(output => done(null, output)) .catch(done); }, TEXT); const decrypted = await createAdapter().decrypt(encrypted, "sample-pass"); expect(decrypted).to.equal(TEXT); }); it("decrypts AES-GCM from web", async function() { const encrypted = await nightmare.evaluate(function(raw, done) { const { EncryptionAlgorithm, createAdapter } = window.iocane; createAdapter() .setAlgorithm(EncryptionAlgorithm.GCM) .encrypt(raw, "sample-pass") .then(output => done(null, output)) .catch(done); }, TEXT); const decrypted = await createAdapter().decrypt(encrypted, "sample-pass"); expect(decrypted).to.equal(TEXT); }); }); describe("data", function() { beforeEach(function() { this.randomData = []; for (let i = 0; i < 50000; i += 1) { this.randomData.push(Math.floor(Math.random() * 256)); } this.data = Buffer.from(this.randomData); }); it("decrypts AES-CBC from web", async function() { const encrypted = await nightmare.evaluate(function(raw, done) { const { EncryptionAlgorithm, createAdapter } = window.iocane; const data = window.helpers.base64ToArrayBuffer(raw); createAdapter() .setAlgorithm(EncryptionAlgorithm.CBC) .encrypt(data, "sample-pass") .then(output => done(null, window.helpers.arrayBufferToBase64(output))) .catch(done); }, this.data.toString("base64")); const decrypted = await createAdapter().decrypt( Buffer.from(encrypted, "base64"), "sample-pass" ); expect(decrypted).to.satisfy(res => res.equals(this.data)); }); it("decrypts AES-GCM from web", async function() { const encrypted = await nightmare.evaluate(function(raw, done) { const { EncryptionAlgorithm, createAdapter } = window.iocane; const data = window.helpers.base64ToArrayBuffer(raw); createAdapter() .setAlgorithm(EncryptionAlgorithm.GCM) .encrypt(data, "sample-pass") .then(output => done(null, window.helpers.arrayBufferToBase64(output))) .catch(done); }, this.data.toString("base64")); const decrypted = await createAdapter().decrypt( Buffer.from(encrypted, "base64"), "sample-pass" ); expect(decrypted).to.satisfy(res => res.equals(this.data)); }); }); }); });
'use strict'; // prePublish gets run on 'npm install' (e.g. even if you aren't actually publishing) // so we have to check to make sure that we are in our own directory and this isn't // some poor user trying to install our package. var path = require('path'); var fs = require('fs'); var rootDirectory = path.join(__dirname, "../../"); if (path.basename(rootDirectory) != "Thali_CordovaPlugin") { process.exit(0); } var readMeFileName = "readme.md"; var parentReadMe = path.join(__dirname, "../../", readMeFileName); var localReadMe = path.join(__dirname, "../", readMeFileName); fs.writeFileSync(localReadMe, fs.readFileSync(parentReadMe)); process.exit(0);
import React, { Component } from 'react'; import classnames from 'classnames'; import withStyles from 'isomorphic-style-loader/lib/withStyles'; import LinearProgress from 'material-ui/LinearProgress'; import history from '../../core/history'; import Link from '../../components/Link/Link'; import Image from '../../components/Image'; import { Grid, Row, Col, ListGroup, ListGroupItem } from 'react-bootstrap'; import { AutoAffix } from 'react-overlays'; import s from './SystemsList.css'; import configs from '../../config/systems.json'; const System = ({name, title, image, available, visible, onClick}) => { const classNames = classnames(s.availabilityCheckIcon, "fa", available ? 'fa-check' : 'fa-close', available ? s.available : s.unavailable); return ( <div key={`system-${name}`} className={classnames(s.system, !visible ? s.hidden : s.show )} onClick={() => onClick(`/system/${name}`)} > <Image src={image} alt={title} /> <div className={s.systemTitle}>{title}</div> <i className={classNames} /> </div> ) }; class Systems extends Component { constructor(...props) { super(...props); this.state = { show: 'available' }; this.onHandleClick = ::this.onHandleClick; this.filter = ::this.filter; } onHandleClick(url) { history.push(url); } filter(system) { const { checkList } = this.props; if (this.state.show == 'all') { return true; } else if (this.state.show == 'available' && checkList[system.name]) { return true; } else if (this.state.show == 'not_available' && !checkList[system.name]) { return true; } return false; } setFilter(filter) { this.setState({ show: filter }); } renderSystems() { const { isChecking, checkList } = this.props; if (isChecking || checkList == undefined) { return (<LinearProgress />); } return ( <Row className={s.list}> <Col xs={12} md={8}> { configs.map((system) => { const isAvailable = checkList[system.name]; const isVisible = this.filter(system); return ( <System key={`emu-${system.name}`} {...system} available={isAvailable} visible={isVisible} onClick={this.onHandleClick} /> ) }) } </Col> <Col xs={6} md={3}> <AutoAffix viewportOffsetTop={15} container={this}> <ListGroup> <ListGroupItem onClick={this.setFilter.bind(this, 'available')} active={this.state.show == 'available'} > Show only available systems </ListGroupItem> <ListGroupItem onClick={this.setFilter.bind(this, 'not_available')} active={this.state.show == 'not_available'} > Show only not available systems </ListGroupItem> <ListGroupItem onClick={this.setFilter.bind(this, 'all')} active={this.state.show == 'all'} > Show all systems </ListGroupItem> </ListGroup> </AutoAffix> </Col> </Row> ); } render() { return ( <div className={s.container}> <h1>Systems</h1> <Grid> {this.renderSystems()} </Grid> </div> ) } } export default withStyles(s)(Systems);
version https://git-lfs.github.com/spec/v1 oid sha256:32728342485677be1fe240941c1404f53f367f741f7980cf29ae5c77e3f66a16 size 558
var Accumulator, errorTypes, isConstructor, isType, isValidator, throwFailedValidator, throwFailure, throwInvalidType; throwFailure = require("failure").throwFailure; Accumulator = require("accumulator"); isConstructor = require("./isConstructor"); isValidator = require("./isValidator"); errorTypes = require("../errorTypes"); isType = require("./isType"); module.exports = function(value, type, key) { var relevantData, result; if (isConstructor(key, Object)) { relevantData = key; key = relevantData.key; } else { relevantData = { key: key }; } if (!type) { throwFailure(Error("Must provide a 'type'!"), { value: value, type: type, key: key, relevantData: relevantData }); } if (isValidator(type)) { result = type.validate(value, key); if (result !== true) { throwFailedValidator(type, result, relevantData); } } else if (!isType(value, type)) { throwInvalidType(type, value, relevantData); } }; throwFailedValidator = function(type, result, relevantData) { var accumulated; accumulated = Accumulator(); accumulated.push(result); if (relevantData) { accumulated.push(relevantData); } return type.fail(accumulated.flatten()); }; throwInvalidType = function(type, value, relevantData) { var accumulated, error; accumulated = Accumulator(); accumulated.push({ type: type, value: value }); if (relevantData) { accumulated.push(relevantData); } error = errorTypes.invalidType(type, relevantData.key); return throwFailure(error, accumulated.flatten()); }; //# sourceMappingURL=../../../map/src/core/assertType.map
import SyncClient from 'sync-client'; const versions = [{ version: 1, stores: { bookmarks: 'id, parentID', folders: 'id, parentID', }, }, { version: 2, stores: { bookmarks: 'id, parentID, *tags', folders: 'id, parentID', tags: 'id', }, }]; export default new SyncClient('BookmarksManager', versions); export { SyncClient };
'use strict'; angular.module('meanDemoApp') .config(function ($stateProvider) { $stateProvider .state('main', { url: '/', templateUrl: 'app/main/main.html', controller: 'MainCtrl' }); });
const _parseHash = function (hash) { let name = ''; let urlType = ''; let hashParts = hash.split('_'); if (hashParts && hashParts.length === 2) { name = hashParts[1]; let type = hashParts[0]; // take off the "#" let finalType = type.slice(1, type.length); switch (finalType) { case 'method': urlType = 'methods'; break; case 'property': urlType = 'properties'; break; case 'event': urlType = 'events'; break; default: urlType = ''; } return { urlType, name, }; } return null; }; function hashToUrl(window) { if (window && window.location && window.location.hash) { let hashInfo = _parseHash(window.location.hash); if (hashInfo) { return `${window.location.pathname}/${hashInfo.urlType}/${hashInfo.name}?anchor=${hashInfo.name}`; } } return null; } function hasRedirectableHash(window) { let canRedirect = false; if (window && window.location && window.location.hash) { let hashParts = window.location.hash.split('_'); if (hashParts && hashParts.length === 2) { canRedirect = true; } } return canRedirect; } export { hashToUrl, hasRedirectableHash };
/** * An ES6 screeps game engine. * * An attempt to conquer screeps, the first MMO strategy sandbox * game for programmers! * * @author Geert Hauwaerts <[email protected]> * @copyright Copyright (c) Geert Hauwaerts * @license MIT License */ /** * Cache for static function results. */ export default class Cache { /** * Cache for static function results. * * @returns {void} */ constructor() { this.cache = {}; } /** * Store or retrieve an entry from cache. * * @param {string} table The cache table. * @param {string} key The entry to store or retrieve. * @param {*} value The callback function. * @param {*} ...args The callback function arguments. * @returns {*} */ remember(table, key, callback, ...args) { if (this.cache[table] === undefined) { this.cache[table] = {}; } let value = this.cache[table][key]; if (value === undefined) { value = callback(args); this.cache[table][key] = value; } return value; } /** * Remove an entry from cache. * * @param {string} table The cache table. * @param {string} key The entry to remove. * @returns {void} */ forget(table, key) { delete this.cache[table][key]; } }
'use strict'; var conf = require('../config'); var ctrlBuilder = require('../controllers/face-controller'); var version = conf.get('version'); var base_route = conf.get('baseurlpath'); var face_route = base_route + '/face'; module.exports = function (server, models, redis) { var controller = ctrlBuilder(server, models, redis); server.get({path: face_route, version: version}, controller.randomFace); server.head({path: face_route, version: version}, controller.randomFace); };
var chai = require('chai'); chai.use(require('chai-fs')); var expect = chai.expect var execute = require('../'); describe('execute', function() { it('should exist', function() { expect(execute).to.exist; }); it('should return a promise', function() { expect(execute().then).to.exist; }); it('should return an result object handed through it', function(done) { var result = { key: 'val' } execute(result).then(function(res) { if (res) { expect(res).to.equal(result); done(); } else { done(new Error('Expected result to be resolved')); } }, function() { done(new Error('Expected function to resolve, not reject.')); }); }); describe('shell commands', function() { it('should execute a string as a shell script', function(done) { //Test by creating file and asserting that it exists execute(null, { shell: 'echo "new file content" >> ./test/file.txt' }).then(function(){ expect("./test/file.txt").to.be.a.file("file.txt not found") done() }, function() { done(new Error('expected function to resolve, not reject')); }) //Remove file and asserting that it does not exist execute(null, { shell: 'rm ./test/file.txt' }).then(function(){ expect("./test/file.txt").not.to.be.a.file("file.txt not found") done() }, function() { done(new Error('expected function to resolve, not reject')); }) }); }); describe('bash scripts', function() { it('should execute a file as a bash script', function(done) { //Test by creating file and asserting that it exists execute(null, { bashScript: './test/test-script' }).then(function(){ expect("./test/file.txt").to.be.a.file("file.txt not found") done() }, function() { done(new Error('expected function to resolve, not reject')); }) //Remove file and asserting that it does not exist execute(null, { shell: 'rm ./test/file.txt' }).then(function(){ expect("./test/file.txt").not.to.be.a.file("file.txt not found") done() }, function() { done(new Error('expected function to resolve, not reject')); }); }); it('should hand parameters to bash scripts', function(done) { //Test by creating file and asserting that it exists execute(null, { bashScript: './test/test-script-params', bashParams: ['./test/file.txt'] }).then(function(){ expect("./test/file.txt").to.be.a.file("file.txt not found") done() }, function() { done(new Error('expected function to resolve, not reject')); }) //Remove file and asserting that it does not exist execute(null, { shell: 'rm ./test/file.txt' }).then(function(){ expect("./test/file.txt").not.to.be.a.file("file.txt not found") done() }, function() { done(new Error('expected function to resolve, not reject')); }) }); }); xdescribe('logging', function() { //TODO: enforce this: these two log tests could be enforced with an abstracted log func and a spy.... it('should default logging to false', function() { execute(null, { shell: 'echo "i should not log"' }).then(function(){ done() }, function() { done(new Error('expected function to resolve, not reject')); }) }); //TODO: enforce this it('should allow toggling logging', function() { execute(null, { logOutput: true, shell: 'echo "i should log"' }).then(function(){ done() }, function() { done(new Error('expected function to resolve, not reject')); }) }); }); });
/* * catberry-homepage * * Copyright (c) 2015 Denis Rechkunov and project contributors. * * catberry-homepage's license follows: * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * This license applies to all parts of catberry-homepage that are not * externally maintained libraries. */ 'use strict'; module.exports = Overview; var util = require('util'), StaticStoreBase = require('../../lib/StaticStoreBase'); util.inherits(Overview, StaticStoreBase); /* * This is a Catberry Store file. * More details can be found here * https://github.com/catberry/catberry/blob/master/docs/index.md#stores */ /** * Creates new instance of the "static/Quotes" store. * @constructor */ function Overview() { StaticStoreBase.call(this); } Overview.prototype.filename = 'github/overview';
import util from './util' import LatLngBounds from './latlngbounds' const {abs, max, min, PI, sin, cos, acos} = Math const rad = PI / 180 // distance between two geographical points using spherical law of cosines approximation function distance (latlng1, latlng2) { const lat1 = latlng1.lat * rad const lat2 = latlng2.lat * rad const a = sin(lat1) * sin(lat2) + cos(lat1) * cos(lat2) * cos((latlng2.lng - latlng1.lng) * rad) return 6371000 * acos(min(a, 1)); } class LatLng { constructor(a, b, c) { if (a instanceof LatLng) { return a; } if (Array.isArray(a) && typeof a[0] !== 'object') { if (a.length === 3) { return this._constructor(a[0], a[1], a[2]) } if (a.length === 2) { return this._constructor(a[0], a[1]) } return null; } if (a === undefined || a === null) { return a } if (typeof a === 'object' && 'lat' in a) { return this._constructor(a.lat, 'lng' in a ? a.lng : a.lon, a.alt); } if (b === undefined) { return null; } return this._constructor(a, b, c) } _constructor(lat, lng, alt) { if (isNaN(lat) || isNaN(lng)) { throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')'); } // @property lat: Number // Latitude in degrees this.lat = +lat // @property lng: Number // Longitude in degrees this.lng = +lng // @property alt: Number // Altitude in meters (optional) if (alt !== undefined) { this.alt = +alt } } // @method equals(otherLatLng: LatLng, maxMargin?: Number): Boolean // Returns `true` if the given `LatLng` point is at the same position (within a small margin of error). The margin of error can be overriden by setting `maxMargin` to a small number. equals(obj, maxMargin) { if (!obj) { return false } obj = new LatLng(obj); const margin = max(abs(this.lat - obj.lat), abs(this.lng - obj.lng)) return margin <= (maxMargin === undefined ? 1.0E-9 : maxMargin); } // @method toString(): String // Returns a string representation of the point (for debugging purposes). toString(precision) { return `LatLng(${this.lat.toFixed(precision)}, ${this.lng.toFixed(precision)})` } // @method distanceTo(otherLatLng: LatLng): Number // Returns the distance (in meters) to the given `LatLng` calculated using the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula). distanceTo(other) { return distance(this, new LatLng(other)) } // @method wrap(): LatLng // Returns a new `LatLng` object with the longitude wrapped so it's always between -180 and +180 degrees. wrap(latlng) { const lng = util.wrapNum(latlng.lng, [-180, 180], true) return new LatLng(latlng.lat, lng, latlng.alt) } // @method toBounds(sizeInMeters: Number): LatLngBounds // Returns a new `LatLngBounds` object in which each boundary is `sizeInMeters` meters apart from the `LatLng`. toBounds(sizeInMeters) { const latAccuracy = 180 * sizeInMeters / 40075017 const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat) return LatLngBounds( [this.lat - latAccuracy, this.lng - lngAccuracy], [this.lat + latAccuracy, this.lng + lngAccuracy] ) } clone() { return new LatLng(this.lat, this.lng, this.alt) } } module.exports = LatLng
import React from 'react' const EditableText = React.createClass({ propTypes: { onSubmit: React.PropTypes.func.isRequired, validator: React.PropTypes.func, enableEditing: React.PropTypes.bool, value: React.PropTypes.oneOfType([ React.PropTypes.string, React.PropTypes.number, ]) }, getInitialState: function() { return { editing: false, invalid: false, newValue: this.props.value, }; }, getDefaultProps: function() { return { enableEditing: true }; }, edit() { this.setState({editing: true}); }, handleChange(e) { this.setState({newValue: e.target.value}); }, cancelEdit() { this.setState({ editing: false, invalid: false, }); }, submit(e) { e.preventDefault(); if (!this.props.validator || this.props.validator(this.state.newValue)) { this.props.onSubmit(this.state.newValue); this.cancelEdit(); } else { this.setState({invalid: true}); } }, renderInputForm() { const inputForm = ( <form onSubmit={this.submit} className={this.state.invalid ? 'has-error' : ''} > <input type="text" autoFocus onChange={this.handleChange} onBlur={this.cancelEdit} value={this.state.newValue} className="form-control inline-editable" /> </form> ); return inputForm; }, render: function() { if (this.props.enableEditing) { return ( <div className="inline-edit"> {this.state.editing ? this.renderInputForm() : <a onClick={this.edit} title="Edit" className={'inline-editable'}>{this.props.value || 'Add'}</a> } </div> ); } else { return (<span>{this.props.value}</span>); } } }); export default EditableText
(function () { "use strict"; //angular.module('app', ['angularUtils.directives.dirPagination']); var env = {}; if (window) { Object.assign(env, window.__env); } var app = angular.module("deviceManagement", ['angularUtils.directives.dirPagination', 'common.services', 'ui.router'//, //'deviceResourceRest' //'deviceResourceMock' ]); app.constant("rootUrl", "http://www.example.com"); app.constant("$env", env); // configure state for device list // add route state // reference the app variable app.config(['$stateProvider', '$urlRouterProvider', function ($stateProvider, $urlRouterProvider) { // pass in $stateProvider - and use array to be min safe $urlRouterProvider.otherwise("/"); //("/devices"); // default otherwise if an activated state has no entry $stateProvider .state("home", { url: "/", templateUrl: "app/welcomeView.html" }) //manifest .state("manifestList", { url: "/devices/manifest/:DeviceId", templateUrl: "app/devices/manifestList.html", controller: "ManifestCtrl as vm" }) //devices .state("deviceList", { // set url fragment url: "/devices", // http://localhost:8000/#/devices templateUrl: "app/devices/deviceListView.html", // url location fetched template from web server controller: "DeviceListCtrl as vm" // associated controller is contructed }) .state("deviceEdit", { abstract: true, // abstract set so that it cannot be explicitly activated , it must have child state url: "/devices/edit/:DeviceId", // param is required which specific device id templateUrl: "app/devices/deviceEditView.html", // ui elements controller: "DeviceEditCtrl as vm", // as with alias of vm // resolve: { // deviceResource: "deviceResource", // device: function (deviceResource, $stateParams) { // var DeviceId = $stateParams.DeviceId; // return deviceResource.get({ DeviceId: DeviceId }).$promise; // } // } }) .state("deviceEdit.info", { url: "/info", templateUrl: "app/devices/deviceEditInfoView.html" }) .state("deviceEdit.price", { url: "/price", templateUrl: "app/devices/deviceEditPriceView.html" }) .state("deviceEdit.tags", { url: "/tags", templateUrl: "app/devices/deviceEditTagsView.html" }) .state("deviceDetail", { url: "/devices/:DeviceId", // param is required which specific device id templateUrl: "app/devices/deviceDetailView.html", // ui elements controller: "DeviceDetailCtrl as vm"//{ //$scope.DeviceId = $stateParams.DeviceId; //var DeviceId = $stateParams.DeviceId; //} //controller: "DeviceDetailCtrl as vm" //, // as with alias of vm // resolve: { // resolve is a property of the stateconfiguration object // deviceResource: "deviceResource", // key value pair Key is deviceResource value is string name of "deviceResource" // device: function (deviceResource, $stateParams) { // $stateParams service is needed because url: has this :DeviceId // var DeviceId = $stateParams.DeviceId; // return deviceResource.get({ DeviceId: DeviceId }).$promise; // function returns the promise // } // } }) //console.log('end .state ui router'); }] ); } ());
/** * Created by zad on 17/4/20. */ /** to left shift an Array * @param {Array} arr * @param {Number} num * @return {Array} */ function leftShift(arr, num) { const result = arr.concat(); if (num < 0) { return rightShift(arr, -num); } while (num > 0) { result.push(result.shift()); num--; } return result; } /** to right shift an Array * @param {Array} arr * @param {Number} num * @return {Array} */ function rightShift(arr, num) { return leftShift(arr, arr.length - num); } export {leftShift, rightShift};
/* eslint-env node */ 'use strict'; module.exports = { 'cowsay': require('./cowsay') };
import Component from '@ember/component'; import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; import { isEmpty } from '@ember/utils'; import { all } from 'rsvp'; import { task, timeout } from 'ember-concurrency'; import { validator, buildValidations } from 'ember-cp-validations'; import ValidationErrorDisplay from 'ilios-common/mixins/validation-error-display'; const Validations = buildValidations({ firstName: [ validator('presence', true), validator('length', { max: 50 }) ], middleName: [ validator('length', { max: 20 }) ], lastName: [ validator('presence', true), validator('length', { max: 50 }) ], campusId: [ validator('length', { max: 16 }) ], otherId: [ validator('length', { max: 16 }) ], email: [ validator('presence', true), validator('length', { max: 100 }), validator('format', { type: 'email' }) ], displayName: [ validator('length', { max: 200 }) ], preferredEmail: [ validator('length', { max: 100 }), validator('format', { allowBlank: true, type: 'email', }) ], phone: [ validator('length', { max: 20 }) ], username: { descriptionKey: 'general.username', validators: [ validator('length', { max: 100, }), validator('format', { regex: /^[a-z0-9_\-()@.]*$/i, }) ] }, password: { dependentKeys: ['model.canEditUsernameAndPassword', 'model.changeUserPassword'], disabled: computed('model.canEditUsernameAndPassword', 'model.changeUserPassword', function() { return this.get('model.canEditUsernameAndPassword') && !this.get('model.changeUserPassword'); }), validators: [ validator('presence', true), validator('length', { min: 5 }) ] } }); export default Component.extend(ValidationErrorDisplay, Validations, { commonAjax: service(), currentUser: service(), iliosConfig: service(), store: service(), classNameBindings: [':user-profile-bio', ':small-component', 'hasSavedRecently:has-saved:has-not-saved'], 'data-test-user-profile-bio': true, campusId: null, changeUserPassword: false, email: null, displayName: null, firstName: null, hasSavedRecently: false, isManageable: false, isManaging: false, lastName: null, middleName: null, otherId: null, password: null, phone: null, preferredEmail: null, showSyncErrorMessage: false, updatedFieldsFromSync: null, user: null, username: null, canEditUsernameAndPassword: computed('iliosConfig.userSearchType', async function() { const userSearchType = await this.iliosConfig.userSearchType; return userSearchType !== 'ldap'; }), passwordStrengthScore: computed('password', async function() { const { default: zxcvbn } = await import('zxcvbn'); const password = isEmpty(this.password) ? '' : this.password; const obj = zxcvbn(password); return obj.score; }), usernameMissing: computed('user.authentication', async function() { const authentication = await this.user.authentication; return isEmpty(authentication) || isEmpty(authentication.username); }), init() { this._super(...arguments); this.set('updatedFieldsFromSync', []); }, didReceiveAttrs() { this._super(...arguments); const user = this.user; const isManaging = this.isManaging; const manageTask = this.manage; if (user && isManaging && !manageTask.get('lastSuccessfull')){ manageTask.perform(); } }, actions: { cancelChangeUserPassword() { this.set('changeUserPassword', false); this.set('password', null); this.send('removeErrorDisplayFor', 'password'); } }, keyUp(event) { const keyCode = event.keyCode; const target = event.target; if (! ['text', 'password'].includes(target.type)) { return; } if (13 === keyCode) { this.save.perform(); return; } if (27 === keyCode) { if ('text' === target.type) { this.cancel.perform(); } else { this.send('cancelChangeUserPassword'); } } }, manage: task(function* () { const user = this.user; this.setProperties(user.getProperties( 'firstName', 'middleName', 'lastName', 'campusId', 'otherId', 'email', 'displayName', 'preferredEmail', 'phone' )); let auth = yield user.get('authentication'); if (auth) { this.set('username', auth.get('username')); this.set('password', ''); } this.setIsManaging(true); return true; }), save: task(function* () { yield timeout(10); const store = this.store; const canEditUsernameAndPassword = yield this.canEditUsernameAndPassword; const changeUserPassword = yield this.changeUserPassword; this.send('addErrorDisplaysFor', [ 'firstName', 'middleName', 'lastName', 'campusId', 'otherId', 'email', 'displayName', 'preferredEmail', 'phone', 'username', 'password' ]); let {validations} = yield this.validate(); if (validations.get('isValid')) { const user = this.user; user.setProperties(this.getProperties( 'firstName', 'middleName', 'lastName', 'campusId', 'otherId', 'email', 'displayName', 'preferredEmail', 'phone' )); let auth = yield user.get('authentication'); if (!auth) { auth = store.createRecord('authentication', { user }); } //always set and send the username in case it was updated in the sync let username = this.username; if (isEmpty(username)) { username = null; } auth.set('username', username); if (canEditUsernameAndPassword && changeUserPassword) { auth.set('password', this.password); } yield auth.save(); yield user.save(); const pendingUpdates = yield user.get('pendingUserUpdates'); yield all(pendingUpdates.invoke('destroyRecord')); this.send('clearErrorDisplay'); this.cancel.perform(); this.set('hasSavedRecently', true); yield timeout(500); this.set('hasSavedRecently', false); } }).drop(), directorySync: task(function* () { yield timeout(10); this.set('updatedFieldsFromSync', []); this.set('showSyncErrorMessage', false); this.set('syncComplete', false); const userId = this.get('user.id'); let url = `/application/directory/find/${userId}`; const commonAjax = this.commonAjax; try { let data = yield commonAjax.request(url); let userData = data.result; const firstName = this.firstName; const lastName = this.lastName; const displayName = this.displayName; const email = this.email; const username = this.username; const phone = this.phone; const campusId = this.campusId; if (userData.firstName !== firstName) { this.set('firstName', userData.firstName); this.updatedFieldsFromSync.pushObject('firstName'); } if (userData.lastName !== lastName) { this.set('lastName', userData.lastName); this.updatedFieldsFromSync.pushObject('lastName'); } if (userData.displayName !== displayName) { this.set('displayName', userData.displayName); this.updatedFieldsFromSync.pushObject('displayName'); } if (userData.email !== email) { this.set('email', userData.email); this.updatedFieldsFromSync.pushObject('email'); } if (userData.campusId !== campusId) { this.set('campusId', userData.campusId); this.updatedFieldsFromSync.pushObject('campusId'); } if (userData.phone !== phone) { this.set('phone', userData.phone); this.updatedFieldsFromSync.pushObject('phone'); } if (userData.username !== username) { this.set('username', userData.username); this.updatedFieldsFromSync.pushObject('username'); } } catch (e) { this.set('showSyncErrorMessage', true); } finally { this.set('syncComplete', true); yield timeout(2000); this.set('syncComplete', false); } }).drop(), cancel: task(function* () { yield timeout(1); this.set('hasSavedRecently', false); this.set('updatedFieldsFromSync', []); this.setIsManaging(false); this.set('changeUserPassword', false); this.set('firstName', null); this.set('lastName', null); this.set('middleName', null); this.set('campusId', null); this.set('otherId', null); this.set('email', null); this.set('displayName', null); this.set('preferredEmail', null); this.set('phone', null); this.set('username', null); this.set('password', null); }).drop() });
module.exports = { Server: app => ({ app, listen: jest.fn(), }), };
/* * Responsive Slideshow - jQuery plugin * * Copyright (c) 2010-2012 Roland Baldovino * * Project home: * https://github.com/junebaldovino/jquery.resss.plugin * * Version: 0.1 * */ (function($){ var _this,settings; var methods = { init : function( options ) { return this.each(function(){ settings = $.extend( { interval: 3000, animspeed: 1000, easing: 'easeOutBack', valign: 'middle', controls: false, cc: null, autoplay: false, controlsCont: null, total: null, allimgs: null, idletime: null, idlemode: false, details: false, curPg: 0, imgLoadCount: 0, waitLoad: true }, options); _this = $(this); var $this = $(this), data = $this.data('resss'); // initial settings settings.allimgs = _this.find('li'); settings.total = settings.allimgs.length; if(settings.controls) methods.initControls(); methods.preloadImages(); if(!settings.waitLoad){ methods.resetImages(); methods.addListeners(); methods.initTimers(); } if (!data) { $(this).data('resss', { target : $this }); } }); }, initControls : function(){ cc = $('<div class="controls" />'); _this.append(cc); for (var i = 0; i < settings.total; i++ ){ var d = i==0 ? $('<div class="active" />') : $('<div />'); cc.append(d); } }, resetCtrls : function(){ cc.find('div').each(function(i){ var li = $(this); i == settings.curPg ? li.addClass('active') : li.removeClass('active'); }); }, addListeners : function(){ // add swipe listeners _this.swipe({swipe:function(event, direction, distance, duration, fingerCount) {methods.swipe(event, direction, distance, duration, fingerCount)} }); // add window resize listeners $(window).bind({ 'resize.resss': function(e){methods.onresize();} }); // add controls listener if(settings.controls){ cc.find('div').each(function(i){ $(this).bind({ 'click' : function(e){ if(!$(this).hasClass('active')){ methods.gotoSlide(i); methods.resetCtrls(); } } }); }); } }, preloadImages : function(){ imgLoadDone = 0; imgCounter = 0; imgsLoaded = false; var c = settings.total; while(c--){ $.ajax({ url: settings.allimgs.find('img').eq(c).attr('src'), type: 'HEAD', success: function(data) { ++settings.imgLoadCount; if(settings.waitLoad){ if(settings.imgLoadCount==settings.total){ methods.finLoad(); } } /* else{ methods.showLoadedImg(this['url']); } */ } }); } methods.gotoSlide(settings.curPg); }, showLoadedImg : function(url){ settings.allimgs.find('img').each(function(){if($(this).attr('src')==url)$(this).css({display:'block'});}); }, finLoad : function(){ if(settings.waitLoad){ methods.resetImages(); methods.addListeners(); methods.initTimers(); } }, initTimers : function(){ if(settings.autoplay) { methods.ssplay(); }else{ $.idleTimer(settings.interval); $(document).bind("idle.idleTimer", function(){ settings.idlemode = true; settings.idletime = setInterval(function(){methods.onIdle()},settings.interval); }); $(document).bind("active.idleTimer", function(){ settings.idlemode = false; clearInterval(settings.idletime); }); } }, ssplay : function(){ if(settings.idletime != null) clearInterval(settings.idletime); settings.idletime = setInterval(function(){methods.ssplay()},settings.interval); methods.slideNext(); }, onIdle : function() { methods.slideNext(); }, onresize : function() { if($('.backstretch').length > 1){ $('.backstretch').eq(0).remove(); } if(settings.autoplay) methods.ssplay(); }, swipe : function(event, direction, distance, duration, fingerCount){ if(direction=='left') methods.slideNext(); if(direction=='right') methods.slidePrev(); }, slideNext : function(){ ++settings.curPg; if(settings.curPg > settings.total-1) settings.curPg = 0; var src = $(settings.allimgs[settings.curPg]).find('img').attr('src'); if($('.backstretch').length > 1){ $('.backstretch').eq(0).animate({opacity:0}, settings.animspeed, settings.easing, function(){$(this).remove();}); } _this.backstretch(src, {fade: settings.animspeed }); if(settings.details) { $(settings.allimgs[settings.curPg]).find('.details').css({display:'block', opacity:0}).animate({opacity:1}, settings.animspeed, settings.easing); } methods.resetCtrls(); if(settings.details) methods.resetDetails(); }, slidePrev : function(){ --settings.curPg; if(settings.curPg < 0) settings.curPg = settings.total-1; var src = $(settings.allimgs[settings.curPg]).find('img').attr('src'); if($('.backstretch').length > 1){ $('.backstretch').eq(0).animate({opacity:0}, settings.animspeed, settings.easing, function(){$(this).remove();}); } _this.backstretch(src, {fade: settings.animspeed}); if(settings.details) { $(settings.allimgs[settings.curPg]).find('.details').css({display:'block', opacity:0}).animate({opacity:1}, settings.animspeed, settings.easing); } methods.resetCtrls(); if(settings.details) methods.resetDetails(); }, gotoSlide : function(i){ settings.curPg = i; var src = $(settings.allimgs[settings.curPg]).find('img').attr('src'); if($('.backstretch').length > 1){ $('.backstretch').eq(0).animate({opacity:0}, settings.animspeed, settings.easing, function(){$(this).remove();}); } if(settings.details) { $(settings.allimgs[settings.curPg]).find('.details').css({display:'block', opacity:0}).animate({opacity:1}, settings.animspeed, settings.easing); } _this.backstretch(src, {fade: settings.animspeed}); if(settings.details) methods.resetDetails(); }, resetDetails : function(){ $(settings.allimgs).each(function(i){ if(i != settings.curPg) $(settings.allimgs[i]).find('.details').css({opacity:0,display:'none'}); }); }, resetImages : function(){ $(settings.allimgs).each(function(i){ $(settings.allimgs[i]).find('img').css({opacity:0,display:'none'}); }); if(settings.details) methods.resetDetails(); }, destroy : function( ) { return this.each(function(){ var $this = $(this), data = $this.data('resss'); $(window).unbind({ 'resize.resss': function(e){methods.onresize()}}); $(window).unbind('.resss'); data.resss.remove(); $this.removeData('resss'); }); } }; $.fn.resss = function(method) { if ( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if (typeof method === 'object' || ! method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.resss'); } }; })( jQuery );
/* global bp, noEvents, emptySet */ /* * This little app adds bthreads dynamically. */ bp.log.info("Program Loaded"); // Define the events. var kidADone = bp.Event("kidADone"); var kidBDone = bp.Event("kidBDone"); var parentDone = bp.Event("parentDone"); bp.registerBThread("parentBThread", function () { bp.log.info("parent started"); // first one, text for behavior on the start() method. bp.registerBThread( "kid a1", function() { bp.log.info("kid a1 started"); bp.sync({request:kidADone, block:parentDone}); }); bp.registerBThread( "kid b1", function() { bp.log.info("kid b1 started"); bp.sync({request:kidBDone, block:parentDone}); }); bp.sync( {request: parentDone} ); // second round, test for behavior on the resume() method. bp.registerBThread( "kid a2", function() { bp.sync({request:kidADone, block:parentDone}); }); bp.registerBThread( "kid b2", function() { bp.sync({request:kidBDone, block:parentDone}); }); bp.sync( {request: parentDone} ); });
//configure requirejs var requirejs = require('requirejs'); requirejs.config({ baseUrl: __dirname + '/../javascripts', nodeRequire: require }); //turn off rendering for commandline unit tests var global = requirejs('global'); global.RENDER = false; //export requirejs module.exports = { require: requirejs };
"use strict" /** * Construct URL for Magento Admin. * * @param {string} path path to Magento page (absolute path started with '/', alias - w/o) */ var result = function getUrl(path) { /* shortcuts for globals */ var casper = global.casper; var mobi = global.mobi; var root = mobi.opts.navig.mage; /* functionality */ casper.echo(" construct Magento Admin URL for path '" + path + "'.", "PARAMETER"); var isAlias = path.indexOf('/') === -1; // absolute path contains at least one '/' char var result, url; if (isAlias) { /* compose URI based on "route.to.page" */ var route = mobi.objPath.get(root.admin, path); url = route.self; } else { /* absolute path is used */ url = path } /* "http://mage2.local.host.com" + "/admin" + "url" */ result = root.self + root.admin.self + url; casper.echo(" result URL: " + result, "PARAMETER"); return result; } module.exports = result;
"use strict"; var EventEmitter = require('events').EventEmitter; var util = require( './util' ); /** * Single user on the server. */ var User = function(data, client) { this.client = client; this._applyProperties(data); }; User.prototype = Object.create(EventEmitter.prototype); /** * @summary Moves the user to a channel * * @param {Channel|String} channel - Channel name or a channel object */ User.prototype.moveToChannel = function(channel) { var id; if(typeof channel === "string") { id = this.client.channelByName(channel).id; } else if(typeof channel === "object") { id = channel.id; } else { return; } this.client.connection.sendMessage( 'UserState', { session: this.session, actor: this.client.user.session, channel_id: id }); }; /** * @summary Change a user's self deafened state. (Obviously) only works on yourself. * * @param {Boolean} isSelfDeaf - The new self deafened state */ User.prototype.setSelfDeaf = function(isSelfDeaf){ this.client.connection.sendMessage( 'UserState', { session: this.session, actor: this.client.user.session, self_deaf: isSelfDeaf }); }; /** * @summary Change a user's self muted state. (Obviously) only works on yourself. * * @param {Boolean} isSelfMute - The new self muted state */ User.prototype.setSelfMute = function(isSelfMute){ this.client.connection.sendMessage( 'UserState', { session: this.session, actor: this.client.user.session, self_mute: isSelfMute }); }; /** * @summary Attempts to kick the user. * * @param {String} [reason] - The reason to kick the user for. */ User.prototype.kick = function(reason) { this._sendRemoveUser( reason || "You have been kicked", false ); }; /** * @summary Attempts to ban the user. * * @param {String} [reason] - The reason to ban the user for. */ User.prototype.ban = function(reason) { this._sendRemoveUser( reason || "You have been banned", true ); }; /** * @summary Sends a message to the user. * * @param {String} message - The message to send. */ User.prototype.sendMessage = function(message) { this.client.sendMessage( message, { session: [ this.session ] } ); }; /** * @summary Returns an output stream for listening to the user audio. * * @param {Boolean} [noEmptyFrames] * True to cut the output stream during silence. If the output stream * isn't cut it will keep emitting zero-values when the user isn't * talking. * * @returns {MumbleOutputStream} Output stream. */ User.prototype.outputStream = function(noEmptyFrames) { return this.client.connection.outputStream(this.session, noEmptyFrames); }; /** * @summary Returns an input stream for sending audio to the user. * * @returns {MumbleInputStream} Input stream. */ User.prototype.inputStream = function() { return this.client.inputStreamForUser( this.session ); }; /** * @summary Checks whether the user can talk or not. * * @returns {Boolean} True if the user can talk. */ User.prototype.canTalk = function() { return !this.mute && !this.selfMute && !this.suppress; }; /** * @summary Checks whether the user can hear other people. * * @returns {Boolean} True if the user can hear. */ User.prototype.canHear = function() { return !this.selfDeaf; }; User.prototype._applyProperties = function(data) { /** * @summary Session ID * * @description * Session ID is present for all users. The ID specifies the current user * session and will change when the user reconnects. * * @see User#id * * @name User#session * @type Number */ this.session = data.session; /** * @summary User name * * @name User#name * @type String */ this.name = data.name; /** * @summary User ID * * @description * User ID is specified only for users who are registered on the server. * The user ID won't change when the user reconnects. * * @see User#session * * @name User#id * @type Number */ this.id = data.user_id; /** * @summary _true_ when the user is muted by an admin. * * @name User#mute * @type Boolean */ this.mute = data.mute; /** * @summary _true_ when the user is deafened by an admin. * * @name User#deaf * @type Boolean */ this.deaf = data.deaf; /** * @summary _true_ when the user is suppressed due to lack of * permissions. * * @description * The user will be suppressed by the server if they don't have permissions * to speak on the current channel. * * @name User#suppress * @type Boolean */ this.suppress = data.suppress; /** * @summary _true_ when the user has muted themselves. * * @name User#selfMute * @type Boolean */ this.selfMute = data.self_mute; /** * @summary _true_ when the user has deafened themselves. * * @name User#selfDeaf * @type Boolean */ this.selfDeaf = data.self_deaf; /** * @summary The hash of the user certificate * * @name User#hash * @type String */ this.hash = data.hash; /** * @summary _true_ when the user is recording the conversation. * * @name User#recording * @type Boolean */ this.recording = data.recording; /** * @summary _true_ when the user is a priority speaker. * * @name User#prioritySpeaker * @type Boolean */ this.prioritySpeaker = data.priority_speaker; /** * @summary User's current channel. * * @name User#channel * @type Channel */ if(data.channel_id !== null) { this.channel = this.client.channelById(data.channel_id); } else { // New users always enter root this.channel = this.client.rootChannel; } this.channel._addUser(this); //TODO: Comments, textures }; /** * @summary Emitted when the user disconnects * * @description * Also available through the client `user-disconnect` event. * * @event User#disconnect */ User.prototype._detach = function() { this.emit('disconnect'); this.channel._removeUser(this); }; /** * @summary Emitted when the user moves between channels. * * @event User#move * @param {Channel} oldChannel - The channel where the user was moved from. * @param {Channel} newChannel - The channel where the user was moved to. * @param {User} actor - The user who moved the channel or undefined for server. */ User.prototype._checkChangeChannel = function( data ) { // Get the two channel instances. var newChannel = this.client.channelById( data.channel_id ); var oldChannel = this.channel; // Make sure there is a change in the channel. if( newChannel === oldChannel ) return; // Make the channel change and notify listeners. this.channel = newChannel; oldChannel._removeUser( this ); newChannel._addUser( this ); var actor = this.client.userBySession( data.actor ); this.emit( 'move', oldChannel, newChannel, actor ); }; /** * @summary Emitted when the user is muted or unmuted by the server. * * @description * Also available through the client `user-mute` event. * * @event User#mute * @param {Boolean} status * True when the user is muted, false when unmuted. */ /** * @summary Emitted when the user mutes or unmutes themselves. * * @description * Also available through the client `user-self-mute` event. * * @event User#self-mute * @param {Boolean} status * True when the user mutes themselves. False when unmuting. */ /** * @summary Emitted when the user deafens or undeafens themselves. * * @description * Also available through the client `user-self-deaf` event. * * @event User#self-deaf * @param {Boolean} status * True when the user deafens themselves. False when undeafening. */ /** * @summary Emitted when the user is suppressed or unsuppressed. * * @description * Also available through the client `user-suppress` event. * * @event User#suppress * @param {Boolean} status * True when the user is suppressed. False when unsuppressed. */ /** * @summary Emitted when the user starts or stops recording. * * @description * Also available through the client `user-recording` event. * * @event User#recording * @param {Boolean} status * True when the user starts recording. False when they stop. */ /** * @summary Emitted when the user gains or loses priority speaker status. * * @description * Also available through the client `user-priority-speaker` event. * * @event User#priority-speaker * @param {Boolean} status * True when the user gains priority speaker status. False when they lose * it. */ User.prototype.update = function(data) { var self = this; // Check the simple fields. [ 'mute', 'selfMute', 'suppress', 'selfDeaf', 'recording', 'prioritySpeaker', ].forEach( function(f) { self._checkField( data, f ); }); // Channel check if( data.channel_id !== null ) { this._checkChangeChannel( data ); } }; User.prototype._sendRemoveUser = function( reason, ban ) { this.client.connection.sendMessage( 'UserRemove', { session: this.session, actor: this.client.user.session, reason: reason, ban: ban } ); }; User.prototype._checkField = function( data, field ) { // Make sure the field has a value. var newValue = data[ util.toFieldName( field ) ]; if( newValue === undefined ) return; // Make sure the new value differs. var oldValue = this[ field ]; if( newValue === oldValue ) return; // All checks succeeded. Store the new value and emit change event. this[ field ] = newValue; var actor = this.client.userBySession( data.actor ); this.emit( util.toEventName( field ), newValue, actor ); }; module.exports = User;
"use strict"; module.exports = function (context) { return context.data.root.query.name + context.data.root.query.suffix; };
/** * @author mrdoob / http://mrdoob.com/ */ var Config = function () { var namespace = 'threejs-inspector'; var storage = { 'selectionBoxEnabled': false, 'rafEnabled' : false, 'rafFps' : 30, } if ( window.localStorage[ namespace ] === undefined ) { window.localStorage[ namespace ] = JSON.stringify( storage ); } else { var data = JSON.parse( window.localStorage[ namespace ] ); for ( var key in data ) { storage[ key ] = data[ key ]; } } return { getKey: function ( key ) { return storage[ key ]; }, setKey: function () { // key, value, key, value ... for ( var i = 0, l = arguments.length; i < l; i += 2 ) { storage[ arguments[ i ] ] = arguments[ i + 1 ]; } window.localStorage[ namespace ] = JSON.stringify( storage ); console.log( '[' + /\d\d\:\d\d\:\d\d/.exec( new Date() )[ 0 ] + ']', 'Saved config to LocalStorage.' ); }, clear: function () { delete window.localStorage[ namespace ]; } } };
var _ = require("underscore"); var util = require("util"); exports.show = function (req, res) { var async = require('async'); if (!req.session.screen) { req.session.messages = { errors: ['screen not found'] }; res.redirect('/'); return; } var Handlebars = require('../hbs_helpers/hbs_helpers.js'); var fs = require('fs'); var JSONParse = require('json-literal-parse'); var screen = req.session.screen; var arr_widgetHTML = []; var widgetUtil = require('../lib/widget_util.js'); async.each(screen.widgets, function (widget, cb) { widgetUtil.render_widget(widget, function (err, w_html) { if(!err) arr_widgetHTML.push(w_html); else{ console.log("Failed to render widget " + widget.id + " : "+ err); req.session.messages = { errors: ["Failed to render widget " + widget.id + " : "+ err ] }; } cb(null); }); }, function (err) { req.session.screen.widgets = arr_widgetHTML; var data = { username: req.session.user.username, title: 'Screen : '+req.session.screen.name, screens: req.session.screens, widgets: req.session.widgets, screen: req.session.screen }; res.render('screens/show', data); }); }; exports.new = function (req, res) { var data = { username: req.session.user.username, title: 'Screen : Create New', screens: req.session.screens, widgets:req.session.widgets }; res.render('screens/new', data); }; exports.create = function (req, res) { //Deny direct post request if (!req.body.hasOwnProperty('screen_name') || !req.body.hasOwnProperty('screen_desc')) { res.status(401); res.send('Unauthorized Access <a href=\'/screens/new\'>Create New Screen</a> '); return; } var t_screen = { name: req.body.screen_name, description: req.body.screen_desc, widgets : [] }; var Screen = require('../models/screen'); //Create new screen Screen.save( t_screen, function(err, screen){ if(!err){ console.log('Screen created successfully'); req.session.messages = { success: ['Screen(' + t_screen.name + ') created successfully'], errors: [] }; res.redirect('/screens/'+screen.id); return; }else{ console.log('Failed to create screen: ',err); req.session.messages = { validationErrors: err }; res.redirect('screens/new'); return; } }); }; exports.addWidget = function(req, res){ var data = { username: req.session.user.username, title: 'Screen : Create New', screens: req.session.screens, screen:req.session.screen, widgets:req.session.widgets }; res.render("screens/widgets/add", data) }; exports.updateWidgets = function(req, res){ // res.send("widgets size: " + req.body.widgets.length +" Instance of " +( req.body.widgets instanceof Array)) // return; var Screen = require("../models/screen.js") Screen.addWidgets(req.params.id, req.body.widgets, function(err, suc){ if(err){ console.log("Error adding widgets to the screen: ", err); req.session.messages = { errors: ["Error adding widgets to the screen: " + err] }; res.redirect("/screens/"+req.params.id + "/widgets/add"); }else{ console.log(" Widgets added successfully!!") req.session.messages = { success: [ "Widgets added successfully!!"] }; res.redirect("/screens/"+req.params.id ); } }) } exports.removeWidget = function(req, res){ }; exports.delete = function (req, res) { if (!req.session.screen) { req.session.messages = { errors: ['screen not found'] }; } else { var Screen = require('../models/screen'); Screen.destroy(req.session.screen, function(err){ if(err){ util.log("Failed to delete screen "+err); req.session.messages = { errors: ['Failed to delete screen. ' + err] }; }else{ util.log("Screen deleted successfully"); req.session.messages = { success: ['Screen ' + req.session.screen.name + ' deleted successfully'] }; req.session.screen = null; } res.redirect('/'); return; }); } };
var db=require('./dbDatabase'); var mysql=require('mysql'); var connect_pool=mysql.createPool(db.options); connect_pool.connectionLimit=100; //准备好20个链接 connect_pool.queueLimit=100; //最大链接数 function getConnection(callback){ connect_pool.getConnection(function(err,client){ if(err){ console.log(err.message); setTimeout(getConnection,2000); } callback(client); }) } exports.getConnection=getConnection;
angular.module('factoria', ['firebase']) .factory('fireService', ['$firebaseArray', function($firebaseArray){ var firebaseRef= ""; var setFirebaseSource = function(url){ firebaseRef= new Firebase(url); }; var getFirebaseRoot = function(){ return firebaseRef; }; var addData = function(data){ // persist our data to firebase var ref = getFirebaseRoot(); return $firebase(ref).$push(data); }; var getData = function(callback){ var ref = getFirebaseRoot(); //TODO: //Call koaRender to update new elements style return $firebaseArray(ref); } var service = { setFirebaseSource : setFirebaseSource, addData : addData, getData : getData, getFirebaseRoot : getFirebaseRoot }; return service; }]);
//A container for data pertaining to the local card game state. Defines the decks stored locally as well as the local player data. class CardSystem { constructor() { this.deck = [random_deck()]; //Plan on having multiple decks available this.player = new Player(); this.player.deck = this.deck[0].copy(); this.duel = null; this.player.duel = this.duel; } reset() { this.player.deck = this.deck[0].copy(); this.duel = null; this.player.duel = this.duel; this.player.prizeTokens = 0; } } //An object representing a card. Clickable. class CardObject { constructor(slot, card, op, parent) { var d = card.index; var game = Client.game; this.parent = parent; this.isOpponents = op; this.obj = game.add.button( slot.obj.x, slot.obj.y, 'cards', this.click, this ); this.obj.anchor.setTo(0.5, 0.5); this.obj.height = 140; this.obj.width = 104; this.obj.angle = 90; if(op) { this.obj.angle *= -1; } this.obj.p = this; this.text = game.add.text( slot.obj.x, slot.obj.y, "HP 0/ 0\nATK 0\nDEF 0", { font: "16px Courier New", fill: "#ffffff", stroke: '#000000', align: "left" }); this.text.strokeThickness = 4; this.text.anchor.setTo(0.5, 0.5); this.card = card; if(this.card.type != CardType.MEMBER) { this.text.text = ""; } this.hpCTR = 0; this.revealed = !this.isOpponents; card.obj = this; this.game = game; this.ls = Client; this.slot = slot; this.channel = null; this.state = game.state.getCurrentState(); this.parent.add(this.obj); } isMember() { return this.card.type == CardType.MEMBER; } isChannel() { return this.card.type == CardType.CHANNEL; } isMeme() { return this.card.type == CardType.MEME; } isRole() { return this.card.type == CardType.ROLE; } getName() { return this.card.name; } getOriginalName() { return this.card.original_name; } hasOriginalName() { return this.card.name == this.card.original_name; } getAttack() { return this.card.atk; } getDefense() { return this.card.def; } getLevel() { return this.card.lvl; } getMemeCategory() { return this.card.category; } getChannelSubject() { return this.card.subject; } click() { var local = this.ls.cardsys.duel.local; var duel = this.ls.cardsys.duel; if(Game.waitAnim || Game.inputLayer > 0) return; if(this.isOpponents) { if(!this.revealed) return; if(duel.phase == DuelPhase.BATTLE) { var local = duel.local; var cobj = local.selected.obj; var c = local.selected; if(local.selected == null) return; var b = validAttackTarget(c, this.slot, duel) Client.chat.write(`Valid: ${b}`); if(b) { if(c.attacks > 0) { Client.sendMove("ATTACK " + cobj.slot.name + " " + this.slot.name); c.attacks--; Game.attack(cobj, this.slot); } } return; } this.state.obj.pv.x = this.game.world.centerX; this.state.obj.pv.y = this.game.world.centerY; this.state.obj.pv.key = 'cards'; if(this.card.index !== 0 || this.card.index > CardIndex.length) { this.state.obj.pv.frame = this.card.index - 1; } else { this.state.obj.pv.frame = UNDEFINED_CARD_INDEX; } return; } if(duel.phase === DuelPhase.DRAW) { if(this.slot.type === SlotType.DECK) { if(duel.draws < 5) { this.draw(); } } return; } if(local.selected === this.card) { this.state.obj.pv.x = this.game.world.centerX; this.state.obj.pv.y = this.game.world.centerY; this.state.obj.pv.key = 'cards'; if(this.card.index !== 0 || this.card.index > CardIndex.length) { this.state.obj.pv.frame = this.card.index - 1; } else { this.state.obj.pv.frame = UNDEFINED_CARD_INDEX; } } else { local.selected = this.card; } if(this.slot !== null) { //Client.sendMove("SELECT " + this.slot.name); } } draw() { var duel = this.ls.cardsys.duel; if(this.isOpponents) { duel.opponent.deck.draw(); } else { duel.player.deck.draw(); var next = new CardObject(this.slot, duel.player.deck.get_top(), this.isOpponents, this.parent); this.parent.bringToTop(this.obj); this.state.obj.local.deck = next; this.move({ x: 104, y: (duel.local.hand.length * 104) + 132 }); duel.local.hand.push(this); this.slot = null; duel.draws++; if(duel.draws >= 5) { duel.phase++; duel.effectPhase(); } } Client.sendMove("DRAW"); } move(dest, cb=function(duel){}) { //var distance = Phaser.Math.distance(this.obj.x, this.obj.y, dest.x, dest.y); var duration = 250; var local = this.ls.cardsys.duel.local; local.selected = null; this.obj.input.enabled = false; this.parent.bringToTop(this.obj); var tween = this.game.add.tween(this.obj).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween.onComplete.addOnce(function(obj, tween) { obj.input.enabled = true; }); tween.start(); var tween2 = this.game.add.tween(this.text).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween2.onComplete.addOnce(function(obj, tween2) { cb(Client.cardsys.duel); }); tween2.start(); } update() { if(!this.revealed) { this.obj.frame = UNDEFINED_CARD_INDEX; this.text.text = ""; return; } if(this.card.index > 0 && this.card.index < CardIndex.length) { this.obj.frame = this.card.index - 1; } else { this.obj.frame = UNDEFINED_CARD_INDEX; } if(this.ls.cardsys.duel.local.selected === this.card) { this.obj.tint = 0x7F7FFF; } else { this.obj.tint = 0xFFFFFF; } if(this.card.type == CardType.MEMBER) { if(this.hpCTR > this.card.currentHP) { this.hpCTR--; } else if(this.hpCTR < this.card.currentHP) { this.hpCTR++; } if(this.slot == null) { this.text.text = ""; } else { this.text.text = "HP " + this.hpCTR + "/ " + this.card.hp + "\nATK " + this.card.atk + "\nDEF " + this.card.def; } } } } //An object representing the deck. class DeckObject { constructor(slot, card, op, parent) { var d = card.index; var game = Client.game; this.parent = parent; this.isOpponents = op; this.obj = game.add.button( slot.obj.x, slot.obj.y, 'cards', this.click, this ); this.obj.anchor.setTo(0.5, 0.5); this.obj.height = 140; this.obj.width = 104; this.obj.angle = 90; if(op) { this.obj.angle *= -1; } this.text = game.add.text( slot.obj.x, slot.obj.y, "0", { font: "16px Courier New", fill: "#ffffff", stroke: '#000000', align: "left" }); this.text.strokeThickness = 4; this.text.anchor.setTo(0.5, 0.5); this.card = card; if(this.card.type != CardType.MEMBER) { this.text.text = ""; } this.revealed = !this.isOpponents; card.obj = this; this.game = game; this.ls = Client; this.slot = slot; this.channel = null; this.state = game.state.getCurrentState(); this.parent.add(this.obj); } click() { var local = this.ls.cardsys.duel.local; var duel = this.ls.cardsys.duel; if(Game.waitAnim || Game.inputLayer > 0) return; if(this.isOpponents) { //this.draw(); return; } if(duel.phase === DuelPhase.DRAW) { if(this.slot.type === SlotType.DECK) { if(duel.draws < 1) { this.draw(); } } return; } if(this.slot !== null) { //Client.sendMove("SURRENDER"); } } draw(cb=function(duel){}) { var duel = this.ls.cardsys.duel; var game = this.ls.game; var sounds = this.ls.sounds; if(duel.phase == DuelPhase.DRAW) { Client.sendMove("DRAW 1"); } if(this.isOpponents) { var next = new CardObject(this.slot, duel.opponent.deck.get_top(), this.isOpponents, this.parent); next.revealed = true; this.parent.bringToTop(next.obj); //obj.remote.hand.push(next); //obj.remote.hand.updateHandPositions(); duel.remote.hand.push(next); Game.addToHand(next, this.isOpponents); Game.updateHand(cb); var n = getRandomInt(1, 3); if(n == 1) { sounds['card1'].play(); } else if(n == 2) { sounds['card0'].play(); } else { sounds['card3'].play(); } //duel.remote.hand.updateHandPositions(); next.slot = null; duel.opponent.deck.draw(); } else { var next = new CardObject(this.slot, duel.player.deck.get_top(), this.isOpponents, this.parent); this.parent.bringToTop(next.obj); //this.state.obj.local.deck = next; //next.move({ // x: 104, // y: (duel.local.hand.length * 104) + 132 //}); //obj.local.hand.push(next); //obj.local.hand.updateHandPositions(); duel.local.hand.push(next); Game.addToHand(next, this.isOpponents); Game.updateHand(cb); var n = getRandomInt(1, 3); if(n == 1) { sounds['card1'].play(); } else if(n == 2) { sounds['card0'].play(); } else { sounds['card3'].play(); } //duel.local.hand.updateHandPositions(); next.slot = null; duel.player.deck.draw(); duel.draws++; if(duel.draws >= 1) { duel.phase = DuelPhase.EFFECT; duel.effectPhase(); } } } move(dest) { //var distance = Phaser.Math.distance(this.obj.x, this.obj.y, dest.x, dest.y); var duration = 250; var local = this.ls.cardsys.duel.local; local.selected = null; this.obj.input.enabled = false; var tween = this.game.add.tween(this.obj).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween.onComplete.addOnce(function(obj, tween) { obj.input.enabled = true; }); tween.start(); var tween2 = this.game.add.tween(this.text).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween2.onComplete.addOnce(function(obj, tween2) { }); tween2.start(); } update() { this.obj.frame = UNDEFINED_CARD_INDEX; if(this.isOpponents) { this.text.setText(`${Client.cardsys.duel.opponent.deck.card.length}`); } else { this.text.setText(`${Client.cardsys.duel.player.deck.card.length}`); } } } //An object that controls the hand. Automatically spaces out cards and handles animation. class HandObject { constructor(p, op, parent) { var game = Client.game; this.parent = parent; this.isOpponents = op; this.objs = []; this.pos = { x: p.x, y: p.y, }; this.revealed = !this.isOpponents; this.game = game; this.ls = Client; this.state = game.state.getCurrentState(); } get(index) { return this.objs[index]; } updateHandPositions(fn, fcb=function(duel){}) { var duration = 250; var local = this.ls.cardsys.duel.local; local.selected = null; var tweens = []; for(i in this.objs) { var dest = {x: this.pos.x, y: (this.pos.y + (104 * (i - this.objs.length / 2)))}; //Client.chat.write("X=" + dest.x + ",Y=" + dest.y); this.objs[i].obj.input.enabled = false; var tween = this.game.add.tween(this.objs[i].obj).to(dest, duration, Phaser.Easing.Quadratic.InOut); if(i >= this.objs.length - 1) { tween.onComplete.addOnce(function(obj, tween) { fn(obj.p); fcb(Client.cardsys.duel); obj.input.enabled = true; }); } else { tween.onComplete.addOnce(function(obj, tween) { obj.input.enabled = true; }); } tween.start(); tweens.push(tween); var tween2 = this.game.add.tween(this.objs[i].text).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween2.onComplete.addOnce(function(obj, tween2) { }); tween2.start(); tweens.push(tween2); } } push(o) { this.objs.push(o); this.parent.add(o.obj); } remove(o) { var j = -1; for(i in this.objs) { if(this.objs[i] === o) j = i; } if(j !== -1) { this.objs.splice(j, 1); } return j; //this.parent.add(o.obj); } check(o) { for(i in this.objs) { if(this.objs[i] === o) return true; } return false; } /*click() {} draw() { } move(dest) { //var distance = Phaser.Math.distance(this.obj.x, this.obj.y, dest.x, dest.y); var duration = 250; var local = this.ls.cardsys.duel.local; local.selected = null; this.obj.input.enabled = false; var tween = this.game.add.tween(this.obj).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween.onComplete.addOnce(function(obj, tween) { obj.input.enabled = true; }); tween.start(); var tween2 = this.game.add.tween(this.text).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween2.onComplete.addOnce(function(obj, tween2) { }); tween2.start(); }*/ update() { for(i in this.objs) { this.objs[i].update(); } } } //An object that represents the Offline Space. Automatically controls animations. class OfflineObject { constructor(p, op, parent) { var game = Client.game; this.parent = parent; this.isOpponents = op; this.objs = []; this.pos = { x: p.x + 70, y: p.y + 50, }; this.revealed = true; this.game = game; this.ls = Client; this.state = game.state.getCurrentState(); } updatePositions() { var duration = 250; var local = this.ls.cardsys.duel.local; local.selected = null; var tweens = []; for(i in this.objs) { var dest = {x: this.pos.x, y: this.pos.y }; //Client.chat.write("X=" + dest.x + ",Y=" + dest.y); this.objs[i].obj.input.enabled = false; var tween = this.game.add.tween(this.objs[i].obj).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween.onComplete.addOnce(function(obj, tween) { obj.input.enabled = true; }); tween.start(); tweens.push(tween); var tween2 = this.game.add.tween(this.objs[i].text).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween2.onComplete.addOnce(function(obj, tween2) { }); tween2.start(); tweens.push(tween2); } } push(o) { this.objs.push(o); this.parent.add(o.obj); } remove(o) { var j = -1; for(i in this.objs) { if(this.objs[i] === o) j = i; } if(j !== -1) { this.objs.splice(j, 1); } //this.parent.add(o.obj); } check(o) { for(i in this.objs) { if(this.objs[i] === o) return true; } return false; } /*click() {} draw() { } move(dest) { //var distance = Phaser.Math.distance(this.obj.x, this.obj.y, dest.x, dest.y); var duration = 250; var local = this.ls.cardsys.duel.local; local.selected = null; this.obj.input.enabled = false; var tween = this.game.add.tween(this.obj).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween.onComplete.addOnce(function(obj, tween) { obj.input.enabled = true; }); tween.start(); var tween2 = this.game.add.tween(this.text).to(dest, duration, Phaser.Easing.Quadratic.InOut); tween2.onComplete.addOnce(function(obj, tween2) { }); tween2.start(); }*/ update() { for(i in this.objs) { this.objs[i].update(); } } } //An object that represents a card selector button. Used in prompts. class CardSelectObject { constructor() { var game = Client.game; this.obj = game.add.button( -1000, 500, 'cards', this.click, this ); this.obj.height = 281; this.obj.width = 201; this.obj.angle = 0; } init(c, op, parent) { var game = Client.game; this.parent = parent; this.isOpponents = op; //this.obj = game.add.button( // -1000, // 500, // 'cards', // this.click, // this //); //this.obj.anchor.setTo(0.5, 0.5); this.card = c; } setSelected(b) { this.selected = b; } click() { this.parent.selected = this; } update() { this.obj.frame = this.card.index - 1; if(this.parent.selected === this) { this.obj.tint = 0x7F7FFF; } else { this.obj.tint = 0xFFFFFF; } } } //An object that represents the select card prompt that allows the user to select a card. Handles the layout of the prompt and animations. class SelectCardPrompt { constructor(pos) { var game = Client.game; this.pos = pos; this.onConfirm = function(c){}; this.selected = null; this.objs = []; this.dobjs = []; this.back = game.add.tileSprite(pos.x, pos.y, pos.width, pos.height, 'promptsc', 2, ui); this.back.y += pos.height; this.text = game.add.text(pos.text.x, pos.text.y, "", { font: pos.text.pxsize + "px Impact", fill: "#FFFFFF", align: "center" }); this.text.y += pos.height; this.confirmButton = game.add.button( this.pos.button.x, this.pos.button.y, 'buttons3', function() { if(this.selected !== null) { this.hide(function(pr){ pr.p.hidden = true; Game.inputLayer = 0; pr.p.onConfirm(pr.p.selected.card); }); } }, this ); this.confirmButton.p = this; this.confirmButton.frame = 4; this.confirmButton.y += pos.height; this.scroll = 0; this.hidden = true; for(var i = 0; i < 40; i++) { this.dobjs.push(new CardSelectObject()); } this.dobjsid = 0; } setMsg(msg) { this.text.setText(msg); } clear() { this.objs = []; this.dobjsid = 0; this.selected = null; } add(c) { var nb = this.dobjs[this.dobjsid]; nb.init(c, false, this); this.objs.push(nb); this.dobjsid++; } getSelected() { return this.selected; } setConfirmCallback(onConfirm) { this.onConfirm = onConfirm; } show() { var game = Client.game; var tween = game.add.tween(this.back).to( { y: this.pos.y }, 100, Phaser.Easing.Linear.None, true, 0); var tween2 = game.add.tween(this.text).to( { y: this.pos.text.y }, 100, Phaser.Easing.Linear.None, true, 0); var tween3 = game.add.tween(this.confirmButton).to( { y: this.pos.button.y }, 100, Phaser.Easing.Linear.None, true, 0); tween.start(); tween2.start(); tween3.start(); this.hidden = false; } hide(onFinish) { var game = Client.game; var tween = game.add.tween(this.back).to( { y: this.pos.y + this.pos.height }, 100, Phaser.Easing.Linear.None, true, 0); var tween2 = game.add.tween(this.text).to( { y: this.pos.text.y + this.pos.height }, 100, Phaser.Easing.Linear.None, true, 0); var tween3 = game.add.tween(this.confirmButton).to( { y: this.pos.button.y + this.pos.height }, 100, Phaser.Easing.Linear.None, true, 0); tween.start(); tween2.start(); tween3.onComplete.addOnce(function(obj, tween){ onFinish(obj); }); tween3.start(); } calcButtonPosition(index) { //var xx = this.pos.card.x + (this.pos.card.width * index) - (this.scroll * this.pos.card.width); var xx = this.pos.card.x + (this.pos.card.width * index) - (this.scroll * this.pos.card.width * this.objs.length); var pos = { //x: xx + 230, x: 10 + (202 * index), y: (this.pos.card.y - 141) + (this.back.y - this.pos.y) } return pos; } update() { if(this.hidden) return; for(i in this.objs) { var pos = this.calcButtonPosition(i); this.objs[i].obj.x = pos.x; this.objs[i].obj.y = pos.y; this.objs[i].update(); } } } const ChannelType = { NON : 0, SRS : 1, GMG : 2, MDA : 3, MTR : 4, MEM : 5 } //Returns a random number between min and max - 1 inclusive function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min)) + min; //The maximum is exclusive and the minimum is inclusive } //Damage calculation function function calcDamage(atk, def) { var dmg = Math.round((atk * 1.5) - (def * 1.5)); if(dmg < 1) dmg = 1; return dmg; } //Converts a raw array of numbers into a deck. function make_deck(rawDeck) { var deck = new Deck(); for(i in rawDeck) { var card = new Card(); card.set_index(rawDeck[i]); deck.add(card); } return deck; } //Returns a random deck function random_deck() { var cards = 40; var deck = new Deck(); for(i = 0; i < cards; i++) { var n = getRandomInt(1, 152); var c = new Card(); c.set_index(n); deck.add(c); } return deck; } //Returns true if a deck is playable function check_deck(deck) { var cards = 40; var numChannels = 0; var numMembers = 0; for(i = 0; i < cards; i++) { var c = deck.card[i]; if(c.type == CardType.MEMBER) numMembers++; if(c.type == CardType.CHANNEL) numChannels++; } return (numChannels >= 1 && numMembers >= 1); } //Returns a random deck that is guarenteed to be playable function random_playable_deck() { var cards = 40; var deck = null; do { deck = new Deck(); for(i = 0; i < cards; i++) { var n = getRandomInt(1, 152); var c = new Card(); c.set_index(n); deck.add(c); } } while(!check_deck(deck)); return deck; } //Returns a dummy deck used for testing function dummy_deck() { var cards = 40; var deck = new Deck(); for(i = 0; i < cards; i++) { var n = DummyDeck[i]; var c = new Card(); c.set_index(n); deck.add(c); } return deck; } //Initializes CardIndex with the JSON string str. function loadCardData(str) { CardIndex = JSON.parse(str); } //Returns whether a card can be moved to a slot. function validSlot(card, slot, duel) { if(!slot.empty()) return false; if(slot.isOpponents) return false; if(card.type === CardType.CHANNEL && slot.type === SlotType.CHANNEL) { return true; } if((card.type === CardType.ROLE || card.type === CardType.MEMBER) && slot.type === SlotType.MEMROLE ) { if(slot.channel.empty()) return false; if(card.type === CardType.MEMBER && card.lvl > 1) return ( duel.local.getLevelOneMembers().length > card.lvl - 2 ); return true; } if(card.type === CardType.MEME && slot.type === SlotType.MEME) { return true; } return false; } //Returns whether a slot is a valid attack target function validAttackTarget(card, slot, duel) { if(slot.empty()) return false; if(!slot.isOpponents) return false; if(card.type !== CardType.MEMBER && (card.type !== CardType.MEME || card.category !== MemeCategory.VRT)) { return false; } if(slot.type === SlotType.CHANNEL) { return true; } if(slot.type === SlotType.MEMROLE && slot.card.card.type === CardType.MEMBER) { return true; } return false; } const SlotType = { UNDEFINED : 0, MEMROLE : 1, CHANNEL : 2, MEME : 3, DECK : 4, OFFLINE : 5 } const SlotFrame = { UNDEFINED : 0, DISABLED : 1, OPEN : 2 } //An object representing a slot on the game board. class Slot { constructor(pos, type, op, channel) { this.type = type; //Whether the slot is controlled by the opponent. this.isOpponents = op; //The card that is in this slot. this.card = null; this.hpCTR = 0; //Channel slot connected to this one. this.channel = channel; var game = Client.game; //The button object. this.obj = game.add.button( pos.x + 70, pos.y + 51, 'cardmask', this.click, this ); this.obj.anchor.setTo(0.5, 0.5); this.obj.height = 140; this.obj.width = 104; this.obj.angle = 90; this.obj.frame = SlotFrame.UNDEFINED; //The name of the slot. this.name = ""; this.ls = Client; } //Returns true if a card is not in this slot. False otherwise. empty() { return (this.card === null); } refresh() { if(!this.empty()) this.card.resetAttacks(); } //Called when the user clicks the card slot. click() { var duel = this.ls.cardsys.duel; var player = duel.player; if(duel.turn !== player) return; if(duel.local.selected !== null) { if(duel.phase === DuelPhase.ACTION) { if(Game.isInHand(duel.local.selected.obj, false)) { var local = duel.local; var cobj = local.selected.obj; var c = local.selected; if(validSlot(c, this, duel)) { cobj.move({x: this.obj.x, y: this.obj.y}); this.card = cobj; if(cobj.slot !== null) { cobj.slot.card = null; } cobj.slot = this; local.selected = null; var j = Game.removeFromHand(cobj, false); var n = this.name; Game.updateHand(); Client.sendMove("PLAY " + j + " " + n); Game.playCard(cobj, false); } } } else if(duel.phase === DuelPhase.BATTLE) { //if(Game.isOnField(duel.local.selected.obj, false)) { var local = duel.local; var cobj = local.selected.obj; var c = local.selected; if(validAttackTarget(c, this, duel)) { if(cobj.attacks > 0) { Game.attack(c, this); this.card = cobj; //if(cobj.slot !== null) { // cobj.slot.card = null; //} //cobj.slot = this; local.selected = null; } } //} } } } update() { var duel = this.ls.cardsys.duel; var game = this.ls.game; var player = duel.player; if(duel.turn !== player) { this.obj.frame = 1; } if(duel.local.selected !== null) { if(duel.local.selected === this.card) { this.obj.frame = 0; return; } if(Game.isInHand(duel.local.selected.obj, false)) { if(validSlot(duel.local.selected, this, duel)) { this.obj.frame = 2; } else { this.obj.frame = 1; } } } else { this.obj.frame = 0; } if(this.card !== null) { this.card.update(); } } } //Player data object. class Player { constructor() { //The player's active deck. this.deck = random_deck(); //The player's current active duel. this.duel = null; //The player's current prize token count. this.prizeTokens = 0; //The player's registered name. this.name = null; //The player's rank. this.rank = 0; } }
const path = require('path'); const wmd = require('wmd'); const {getFile} = require('./importHelpers'); const createContextForList = (folderContents) => { let promises = []; return new Promise((resolve, reject) => { for (let file in folderContents) { let promise = getFile(folderContents[file].path); promises.push(promise); } Promise.all(promises).then(results => { for (let file in folderContents) { const content = wmd(results[file], { preprocessors: [wmd.preprocessors.metadata, wmd.preprocessors.fencedCodeBlocks] }); folderContents[file].meta = content.metadata; } resolve(folderContents); }); }); } // gets context data from file url - works both for list entries and pages const createContextFromFile = (fileUrl) => { return new Promise((resolve, reject) => { getFile(fileUrl).then(data => { const parsedData = { context: wmd(data, { preprocessors: [wmd.preprocessors.metadata, wmd.preprocessors.fencedCodeBlocks] }), fileName: path.parse(fileUrl).name, } resolve(parsedData); }); }); } module.exports.createContextForList = createContextForList; module.exports.createContextFromFile = createContextFromFile;
class AchievementEvt { constructor(subType, payload) { this.type = 'achievements'; this.subType = subType; this.payload = payload; } }; /** * generate PageVisitEvt * @param {string} * @returns {AchievementEvt} */ export class PageVisitEvt extends AchievementEvt { constructor(pageName) { super('page-visited', pageName); } }; /** * generate ForgotPasswordEvt * @param {String} targetEmail * @returns {AchievementEvt} */ export class ForgotPasswordEvt extends AchievementEvt { constructor(targetEmail) { super('forgot-password', targetEmail); } }; /** * generate ForgotPasswordEvt * @returns {AchievementEvt} */ export class MoodRegisteredEvt extends AchievementEvt { constructor() { super('mood-registered'); } }; /** * generate TimeTravelEvt * @param {Object} targetRange * @returns {AchievementEvt} */ export class TimeTravelEvt extends AchievementEvt { constructor(targetRange) { super('time-travel', targetRange); } }; // TODO // clickedOnNotification from SW - just after action [fast hand, tchin tchin, chain reaction] // ensure all ui event are processed - OK [mood entry, page visits, past, future, forgot password] await TEST [duck face] KO [duck face] // snackbar for achievements + animation const badgesConfig = { badgesArray: [ { title: 'adventurer', description: 'visited all pages in one session', badge: 'adventurer' }, { title: 'lost in translation', description: 'went to 404 page', badge: 'lost-in-translation' }, { title: 'duck face', description: 'got a custom avatar', badge: 'no-more-faceless' }, { title: 'goldfish', description: 'forgot password mechanism activated X1', badge: 'goldfish' }, { title: 'alzeihmer', description: 'forgot password mechanism activated X3', badge: '019-grandfather' }, { title: 'mood alert', description: 'subscribed for notifications', badge: '003-smartphone' }, { title: 'mood monitor', description: 'multiple subscriptions for notifications', badge: '010-technology' }, { title: 'fast hand', description: 'clicked on notification', badge: 'fast-hand' }, { title: 'tchin tchin', description: 'your mood update notification nudged someone else mood update', badge: '001-toast' }, { title: 'chain reaction', description: 'your mood update notification nudged two persons to update their mood', badge: '007-share' }, { title: 'back to the future', description: 'time traveled more than one month in the past', badge: 'back-to-the-future' }, { title: 'fortuneteller', description: 'tried to time travel more than a month in the future. Tip: it is useless!', badge: '010-crystal-ball' }, { title: 'noob moodist', description: 'first mood update', badge: '014-helmet' }, { title: 'baron moodist', description: 'updated mood three days straight', badge: '011-crown-2' }, { title: 'duke moodist', description: 'updated mood a full week straight', badge: '012-crown-1' }, { title: 'archduke moodist', description: 'updated mood a full month straight', badge: '010-crown-3' }, { title: 'king moodist', description: 'updated mood three months straight', badge: '013-crown' }, { title: 'emperor moodist', description: 'updated mood a full year straight', badge: '003-greek' }, { title: 'happy days', description: 'positive mood for the last five updates', badge: '005-heavy-metal' }, { title: 'depression', description: 'negative mood for the last five updates', badge: '006-crying' }, { title: 'zen & balanced', description: 'neurtral mood for the last three updates', badge: '003-libra' }, { title: 'mood roller coaster', description: 'changed mood from positive to negative, or reverse, in one day', badge: '005-roller-coaster' }, { title: 'mood swings meds', description: 'changed mood more than three times a day', badge: '008-pills' }, { title: 'blissed', description: 'mood updated to highest possible score', badge: '004-island' }, { title: 'suicidal tendencies', description: 'mood updated to lowest possible score', badge: '006-gallows' }, { title: 'come back', description: 'from negative to positive mood', badge: '005-profits' }, { title: 'mood swing', description: 'from positive to negative mood', badge: '004-loss' }, { title: 'stairway to heaven', description: 'mood increased 5 scores at once', badge: '015-paper-plane' }, { title: 'nuclear disaster', description: 'mood decreased 5 scores at once', badge: '007-bomb-detonation' } ], AchievementsEvts: { PageVisitEvt: PageVisitEvt, ForgotPasswordEvt: ForgotPasswordEvt, TimeTravelEvt: TimeTravelEvt, MoodRegisteredEvt: MoodRegisteredEvt }, technical: { gravatarImagesCacheName: '$$$toolbox-cache$$$https://moodies-1ad4f.firebaseapp.com/$$$', adventurerPageList: ['home', 'profile', 'users', 'mood-input', 'time-travel', 'about', 'badges'], adventurerID: 'adventurer', lostInTranslationPageList: ['404'], lostInTranslationID: 'lost in translation', backToTheFutureID: 'back to the future', fortunetellerID: 'fortuneteller', alzeihmerGoldfishID: 'forgotPasswordCounter', duckFaceID: 'duck face', moodsRelatedAchievementsSpecialEvt: 'all-moods-related-achievements' } }; export default badgesConfig;
function InputHandler(viewport) { var self = this; self.pressedKeys = {}; self.mouseX = 0; self.mouseY = 0; self.mouseDownX = 0; self.mouseDownY = 0; self.mouseMoved = false; self.mouseDown = false; self.mouseButton = 0; // 1 = left | 2 = middle | 3 = right self.viewport = viewport; var viewportElem = viewport.get(0); viewportElem.ondrop = function(event) { self.onDrop(event); }; viewportElem.ondragover = function(event) { event.preventDefault(); }; viewportElem.onclick = function(event) { self.onClick(event); }; viewportElem.onmousedown = function(event) { self.onMouseDown(event); }; window.onmouseup = function(event) { self.onMouseUp(event); }; window.onkeydown = function(event) { self.onKeyDown(event); }; window.onkeyup = function(event) { self.onKeyUp(event); }; window.onmousemove = function(event) { self.onMouseMove(event); }; viewportElem.oncontextmenu = function(event) { event.preventDefault();}; viewport.mousewheel(function(event) { self.onScroll(event); }); } InputHandler.prototype.update = function(event) { for(var key in this.pressedKeys) { this.target.onKeyDown(key); } }; InputHandler.prototype.onKeyUp = function(event) { delete this.pressedKeys[event.keyCode]; }; InputHandler.prototype.onKeyDown = function(event) { // Avoid capturing key events from input boxes and text areas var tag = event.target.tagName.toLowerCase(); if (tag == 'input' || tag == 'textarea') return; var keyCode = event.keyCode; this.pressedKeys[keyCode] = true; var ctrl = event.ctrlKey; this.target.onKeyPress(keyCode, ctrl); }; InputHandler.prototype.isKeyDown = function(key) { var isDown = this.pressedKeys[key] !== undefined; return isDown; }; // Return mouse position in [0,1] range relative to bottom-left of viewport (screen space) InputHandler.prototype.convertToScreenSpace = function(pageX, pageY) { var left = this.viewport.offset().left; var top = this.viewport.offset().top; var width = this.viewport.innerWidth(); var height = this.viewport.innerHeight(); var x = (pageX - left)/width; var y = -(pageY - top)/height + 1.0; return [x,y]; }; InputHandler.prototype.onDrop = function(event) { event.preventDefault(); var mouse = this.convertToScreenSpace(event.pageX, event.pageY); var assetName = event.dataTransfer.getData("text"); this.target.dropAsset(assetName, mouse[0], mouse[1]); }; InputHandler.prototype.onClick = function(event) { if(this.mouseMoved) return; var screenSpace = this.convertToScreenSpace(event.pageX, event.pageY); this.target.onClick(screenSpace[0], screenSpace[1]); }; InputHandler.prototype.onMouseDown = function(event) { this.viewport.focus(); if(this.mouseButton > 0) return; // Don't process a mouse down from a different button until the current one is done this.mouseButton = event.which; this.mouseDown = true; var mouseX = event.pageX; var mouseY = event.pageY; this.mouseDownX = mouseX; this.mouseDownY = mouseY; this.mouseMoved = false; var screenSpace = this.convertToScreenSpace(mouseX, mouseY); this.target.onMouseDown(screenSpace[0], screenSpace[1], this.mouseButton) }; InputHandler.prototype.onMouseUp = function(event) { this.mouseDown = false; this.mouseButton = 0; }; InputHandler.prototype.onMouseMove = function(event) { var mouseX = event.pageX; var mouseY = event.pageY; // Ignore click if mouse moved too much between mouse down and mouse click if(Math.abs(this.mouseDownX - mouseX) > 3 || Math.abs(this.mouseDownY - mouseY) > 3) { this.mouseMoved = true; } if(this.mouseDown) { event.preventDefault(); } var mouseMoveX = mouseX - this.mouseX; var mouseMoveY = mouseY - this.mouseY; this.mouseX = mouseX; this.mouseY = mouseY; var screenSpace = this.convertToScreenSpace(mouseX, mouseY); this.target.onMouseMove(screenSpace[0], screenSpace[1], mouseMoveX, mouseMoveY, this.mouseButton); }; InputHandler.prototype.onScroll = function(event) { this.target.onScroll(event.deltaY); };
// Generated by CoffeeScript 1.9.1 (function() { var bcv_parser, bcv_passage, bcv_utils, root, hasProp = {}.hasOwnProperty; root = this; bcv_parser = (function() { bcv_parser.prototype.s = ""; bcv_parser.prototype.entities = []; bcv_parser.prototype.passage = null; bcv_parser.prototype.regexps = {}; bcv_parser.prototype.options = { consecutive_combination_strategy: "combine", osis_compaction_strategy: "b", book_sequence_strategy: "ignore", invalid_sequence_strategy: "ignore", sequence_combination_strategy: "combine", invalid_passage_strategy: "ignore", non_latin_digits_strategy: "ignore", passage_existence_strategy: "bcv", zero_chapter_strategy: "error", zero_verse_strategy: "error", book_alone_strategy: "ignore", book_range_strategy: "ignore", captive_end_digits_strategy: "delete", end_range_digits_strategy: "verse", include_apocrypha: false, ps151_strategy: "c", versification_system: "default", case_sensitive: "none" }; function bcv_parser() { var key, ref, val; this.options = {}; ref = bcv_parser.prototype.options; for (key in ref) { if (!hasProp.call(ref, key)) continue; val = ref[key]; this.options[key] = val; } this.versification_system(this.options.versification_system); } bcv_parser.prototype.parse = function(s) { var ref; this.reset(); this.s = s; s = this.replace_control_characters(s); ref = this.match_books(s), s = ref[0], this.passage.books = ref[1]; this.entities = this.match_passages(s)[0]; return this; }; bcv_parser.prototype.parse_with_context = function(s, context) { var entities, ref, ref1, ref2; this.reset(); ref = this.match_books(this.replace_control_characters(context)), context = ref[0], this.passage.books = ref[1]; ref1 = this.match_passages(context), entities = ref1[0], context = ref1[1]; this.reset(); this.s = s; s = this.replace_control_characters(s); ref2 = this.match_books(s), s = ref2[0], this.passage.books = ref2[1]; this.passage.books.push({ value: "", parsed: [], start_index: 0, type: "context", context: context }); s = "\x1f" + (this.passage.books.length - 1) + "/9\x1f" + s; this.entities = this.match_passages(s)[0]; return this; }; bcv_parser.prototype.reset = function() { this.s = ""; this.entities = []; if (this.passage) { this.passage.books = []; return this.passage.indices = {}; } else { this.passage = new bcv_passage; this.passage.options = this.options; return this.passage.translations = this.translations; } }; bcv_parser.prototype.set_options = function(options) { var key, val; for (key in options) { if (!hasProp.call(options, key)) continue; val = options[key]; if (key === "include_apocrypha" || key === "versification_system" || key === "case_sensitive") { this[key](val); } else { this.options[key] = val; } } return this; }; bcv_parser.prototype.include_apocrypha = function(arg) { var base, base1, ref, translation, verse_count; if (!((arg != null) && (arg === true || arg === false))) { return this; } this.options.include_apocrypha = arg; this.regexps.books = this.regexps.get_books(arg, this.options.case_sensitive); ref = this.translations; for (translation in ref) { if (!hasProp.call(ref, translation)) continue; if (translation === "aliases" || translation === "alternates") { continue; } if ((base = this.translations[translation]).chapters == null) { base.chapters = {}; } if ((base1 = this.translations[translation].chapters)["Ps"] == null) { base1["Ps"] = bcv_utils.shallow_clone_array(this.translations["default"].chapters["Ps"]); } if (arg === true) { if (this.translations[translation].chapters["Ps151"] != null) { verse_count = this.translations[translation].chapters["Ps151"][0]; } else { verse_count = this.translations["default"].chapters["Ps151"][0]; } this.translations[translation].chapters["Ps"][150] = verse_count; } else { if (this.translations[translation].chapters["Ps"].length === 151) { this.translations[translation].chapters["Ps"].pop(); } } } return this; }; bcv_parser.prototype.versification_system = function(system) { var base, base1, base2, book, chapter_list, ref, ref1; if (!((system != null) && (this.translations[system] != null))) { return this; } if (this.translations.alternates["default"] != null) { if (system === "default") { if (this.translations.alternates["default"].order != null) { this.translations["default"].order = bcv_utils.shallow_clone(this.translations.alternates["default"].order); } ref = this.translations.alternates["default"].chapters; for (book in ref) { if (!hasProp.call(ref, book)) continue; chapter_list = ref[book]; this.translations["default"].chapters[book] = bcv_utils.shallow_clone_array(chapter_list); } } else { this.versification_system("default"); } } if ((base = this.translations.alternates)["default"] == null) { base["default"] = { order: null, chapters: {} }; } if (system !== "default" && (this.translations[system].order != null)) { if ((base1 = this.translations.alternates["default"]).order == null) { base1.order = bcv_utils.shallow_clone(this.translations["default"].order); } this.translations["default"].order = bcv_utils.shallow_clone(this.translations[system].order); } if (system !== "default" && (this.translations[system].chapters != null)) { ref1 = this.translations[system].chapters; for (book in ref1) { if (!hasProp.call(ref1, book)) continue; chapter_list = ref1[book]; if ((base2 = this.translations.alternates["default"].chapters)[book] == null) { base2[book] = bcv_utils.shallow_clone_array(this.translations["default"].chapters[book]); } this.translations["default"].chapters[book] = bcv_utils.shallow_clone_array(chapter_list); } } this.options.versification_system = system; this.include_apocrypha(this.options.include_apocrypha); return this; }; bcv_parser.prototype.case_sensitive = function(arg) { if (!((arg != null) && (arg === "none" || arg === "books"))) { return this; } if (arg === this.options.case_sensitive) { return this; } this.options.case_sensitive = arg; this.regexps.books = this.regexps.get_books(this.options.include_apocrypha, arg); return this; }; bcv_parser.prototype.translation_info = function(new_translation) { var book, chapter_list, id, old_translation, out, ref, ref1, ref2; if (new_translation == null) { new_translation = "default"; } if ((new_translation != null) && (((ref = this.translations.aliases[new_translation]) != null ? ref.alias : void 0) != null)) { new_translation = this.translations.aliases[new_translation].alias; } if (!((new_translation != null) && (this.translations[new_translation] != null))) { new_translation = "default"; } old_translation = this.options.versification_system; if (new_translation !== old_translation) { this.versification_system(new_translation); } out = { order: bcv_utils.shallow_clone(this.translations["default"].order), books: [], chapters: {} }; ref1 = this.translations["default"].chapters; for (book in ref1) { if (!hasProp.call(ref1, book)) continue; chapter_list = ref1[book]; out.chapters[book] = bcv_utils.shallow_clone_array(chapter_list); } ref2 = out.order; for (book in ref2) { if (!hasProp.call(ref2, book)) continue; id = ref2[book]; out.books[id - 1] = book; } if (new_translation !== old_translation) { this.versification_system(old_translation); } return out; }; bcv_parser.prototype.replace_control_characters = function(s) { s = s.replace(this.regexps.control, " "); if (this.options.non_latin_digits_strategy === "replace") { s = s.replace(/[٠۰߀०০੦૦୦0౦೦൦๐໐༠၀႐០᠐᥆᧐᪀᪐᭐᮰᱀᱐꘠꣐꤀꧐꩐꯰0]/g, "0"); s = s.replace(/[١۱߁१১੧૧୧௧౧೧൧๑໑༡၁႑១᠑᥇᧑᪁᪑᭑᮱᱁᱑꘡꣑꤁꧑꩑꯱1]/g, "1"); s = s.replace(/[٢۲߂२২੨૨୨௨౨೨൨๒໒༢၂႒២᠒᥈᧒᪂᪒᭒᮲᱂᱒꘢꣒꤂꧒꩒꯲2]/g, "2"); s = s.replace(/[٣۳߃३৩੩૩୩௩౩೩൩๓໓༣၃႓៣᠓᥉᧓᪃᪓᭓᮳᱃᱓꘣꣓꤃꧓꩓꯳3]/g, "3"); s = s.replace(/[٤۴߄४৪੪૪୪௪౪೪൪๔໔༤၄႔៤᠔᥊᧔᪄᪔᭔᮴᱄᱔꘤꣔꤄꧔꩔꯴4]/g, "4"); s = s.replace(/[٥۵߅५৫੫૫୫௫౫೫൫๕໕༥၅႕៥᠕᥋᧕᪅᪕᭕᮵᱅᱕꘥꣕꤅꧕꩕꯵5]/g, "5"); s = s.replace(/[٦۶߆६৬੬૬୬௬౬೬൬๖໖༦၆႖៦᠖᥌᧖᪆᪖᭖᮶᱆᱖꘦꣖꤆꧖꩖꯶6]/g, "6"); s = s.replace(/[٧۷߇७৭੭૭୭௭౭೭൭๗໗༧၇႗៧᠗᥍᧗᪇᪗᭗᮷᱇᱗꘧꣗꤇꧗꩗꯷7]/g, "7"); s = s.replace(/[٨۸߈८৮੮૮୮௮౮೮൮๘໘༨၈႘៨᠘᥎᧘᪈᪘᭘᮸᱈᱘꘨꣘꤈꧘꩘꯸8]/g, "8"); s = s.replace(/[٩۹߉९৯੯૯୯௯౯೯൯๙໙༩၉႙៩᠙᥏᧙᪉᪙᭙᮹᱉᱙꘩꣙꤉꧙꩙꯹9]/g, "9"); } return s; }; bcv_parser.prototype.match_books = function(s) { var book, books, has_replacement, k, len, ref; books = []; ref = this.regexps.books; for (k = 0, len = ref.length; k < len; k++) { book = ref[k]; has_replacement = false; s = s.replace(book.regexp, function(full, prev, bk) { var extra; has_replacement = true; books.push({ value: bk, parsed: book.osis, type: "book" }); extra = book.extra != null ? "/" + book.extra : ""; return prev + "\x1f" + (books.length - 1) + extra + "\x1f"; }); if (has_replacement === true && /^[\s\x1f\d:.,;\-\u2013\u2014]+$/.test(s)) { break; } } s = s.replace(this.regexps.translations, function(match) { books.push({ value: match, parsed: match.toLowerCase(), type: "translation" }); return "\x1e" + (books.length - 1) + "\x1e"; }); return [s, this.get_book_indices(books, s)]; }; bcv_parser.prototype.get_book_indices = function(books, s) { var add_index, match, re; add_index = 0; re = /([\x1f\x1e])(\d+)(?:\/\d+)?\1/g; while (match = re.exec(s)) { books[match[2]].start_index = match.index + add_index; add_index += books[match[2]].value.length - match[0].length; } return books; }; bcv_parser.prototype.match_passages = function(s) { var accum, book_id, entities, full, match, next_char, original_part_length, part, passage, post_context, re, ref, regexp_index_adjust, start_index_adjust; entities = []; post_context = {}; while (match = this.regexps.escaped_passage.exec(s)) { full = match[0], part = match[1], book_id = match[2]; original_part_length = part.length; match.index += full.length - original_part_length; if (/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(part)) { re = /\s+\d+\s*$/; part = part.replace(re, ""); } if (!/[\d\x1f\x1e)]$/.test(part)) { part = this.replace_match_end(part); } if (this.options.captive_end_digits_strategy === "delete") { next_char = match.index + part.length; if (s.length > next_char && /^\w/.test(s.substr(next_char, 1))) { part = part.replace(/[\s*]+\d+$/, ""); } part = part.replace(/(\x1e[)\]]?)[\s*]*\d+$/, "$1"); } part = part.replace(/[A-Z]+/g, function(capitals) { return capitals.toLowerCase(); }); start_index_adjust = part.substr(0, 1) === "\x1f" ? 0 : part.split("\x1f")[0].length; passage = { value: grammar.parse(part), type: "base", start_index: this.passage.books[book_id].start_index - start_index_adjust, match: part }; if (this.options.book_alone_strategy === "full" && this.options.book_range_strategy === "include" && passage.value[0].type === "b" && (passage.value.length === 1 || (passage.value.length > 1 && passage.value[1].type === "translation_sequence")) && start_index_adjust === 0 && (this.passage.books[book_id].parsed.length === 1 || (this.passage.books[book_id].parsed.length > 1 && this.passage.books[book_id].parsed[1].type === "translation")) && /^[234]/.test(this.passage.books[book_id].parsed[0])) { this.create_book_range(s, passage, book_id); } ref = this.passage.handle_obj(passage), accum = ref[0], post_context = ref[1]; entities = entities.concat(accum); regexp_index_adjust = this.adjust_regexp_end(accum, original_part_length, part.length); if (regexp_index_adjust > 0) { this.regexps.escaped_passage.lastIndex -= regexp_index_adjust; } } return [entities, post_context]; }; bcv_parser.prototype.adjust_regexp_end = function(accum, old_length, new_length) { var regexp_index_adjust; regexp_index_adjust = 0; if (accum.length > 0) { regexp_index_adjust = old_length - accum[accum.length - 1].indices[1] - 1; } else if (old_length !== new_length) { regexp_index_adjust = old_length - new_length; } return regexp_index_adjust; }; bcv_parser.prototype.replace_match_end = function(part) { var match, remove; remove = part.length; while (match = this.regexps.match_end_split.exec(part)) { remove = match.index + match[0].length; } if (remove < part.length) { part = part.substr(0, remove); } return part; }; bcv_parser.prototype.create_book_range = function(s, passage, book_id) { var cases, i, k, limit, prev, range_regexp, ref; cases = [bcv_parser.prototype.regexps.first, bcv_parser.prototype.regexps.second, bcv_parser.prototype.regexps.third]; limit = parseInt(this.passage.books[book_id].parsed[0].substr(0, 1), 10); for (i = k = 1, ref = limit; 1 <= ref ? k < ref : k > ref; i = 1 <= ref ? ++k : --k) { range_regexp = i === limit - 1 ? bcv_parser.prototype.regexps.range_and : bcv_parser.prototype.regexps.range_only; prev = s.match(RegExp("(?:^|\\W)(" + cases[i - 1] + "\\s*" + range_regexp + "\\s*)\\x1f" + book_id + "\\x1f", "i")); if (prev != null) { return this.add_book_range_object(passage, prev, i); } } return false; }; bcv_parser.prototype.add_book_range_object = function(passage, prev, start_book_number) { var i, k, length, ref, ref1, results; length = prev[1].length; passage.value[0] = { type: "b_range_pre", value: [ { type: "b_pre", value: start_book_number.toString(), indices: [prev.index, prev.index + length] }, passage.value[0] ], indices: [0, passage.value[0].indices[1] + length] }; passage.value[0].value[1].indices[0] += length; passage.value[0].value[1].indices[1] += length; passage.start_index -= length; passage.match = prev[1] + passage.match; if (passage.value.length === 1) { return; } results = []; for (i = k = 1, ref = passage.value.length; 1 <= ref ? k < ref : k > ref; i = 1 <= ref ? ++k : --k) { if (passage.value[i].value == null) { continue; } if (((ref1 = passage.value[i].value[0]) != null ? ref1.indices : void 0) != null) { passage.value[i].value[0].indices[0] += length; passage.value[i].value[0].indices[1] += length; } passage.value[i].indices[0] += length; results.push(passage.value[i].indices[1] += length); } return results; }; bcv_parser.prototype.osis = function() { var k, len, osis, out, ref; out = []; ref = this.parsed_entities(); for (k = 0, len = ref.length; k < len; k++) { osis = ref[k]; if (osis.osis.length > 0) { out.push(osis.osis); } } return out.join(","); }; bcv_parser.prototype.osis_and_translations = function() { var k, len, osis, out, ref; out = []; ref = this.parsed_entities(); for (k = 0, len = ref.length; k < len; k++) { osis = ref[k]; if (osis.osis.length > 0) { out.push([osis.osis, osis.translations.join(",")]); } } return out; }; bcv_parser.prototype.osis_and_indices = function() { var k, len, osis, out, ref; out = []; ref = this.parsed_entities(); for (k = 0, len = ref.length; k < len; k++) { osis = ref[k]; if (osis.osis.length > 0) { out.push({ osis: osis.osis, translations: osis.translations, indices: osis.indices }); } } return out; }; bcv_parser.prototype.parsed_entities = function() { var entity, entity_id, i, k, l, last_i, len, len1, length, m, n, osis, osises, out, passage, ref, ref1, ref2, ref3, strings, translation, translation_alias, translation_osis, translations; out = []; for (entity_id = k = 0, ref = this.entities.length; 0 <= ref ? k < ref : k > ref; entity_id = 0 <= ref ? ++k : --k) { entity = this.entities[entity_id]; if (entity.type && entity.type === "translation_sequence" && out.length > 0 && entity_id === out[out.length - 1].entity_id + 1) { out[out.length - 1].indices[1] = entity.absolute_indices[1]; } if (entity.passages == null) { continue; } if ((entity.type === "b" && this.options.book_alone_strategy === "ignore") || (entity.type === "b_range" && this.options.book_range_strategy === "ignore") || entity.type === "context") { continue; } translations = []; translation_alias = null; if (entity.passages[0].translations != null) { ref1 = entity.passages[0].translations; for (l = 0, len = ref1.length; l < len; l++) { translation = ref1[l]; translation_osis = ((ref2 = translation.osis) != null ? ref2.length : void 0) > 0 ? translation.osis : ""; if (translation_alias == null) { translation_alias = translation.alias; } translations.push(translation_osis); } } else { translations = [""]; translation_alias = "default"; } osises = []; length = entity.passages.length; for (i = m = 0, ref3 = length; 0 <= ref3 ? m < ref3 : m > ref3; i = 0 <= ref3 ? ++m : --m) { passage = entity.passages[i]; if (passage.type == null) { passage.type = entity.type; } if (passage.valid.valid === false) { if (this.options.invalid_sequence_strategy === "ignore" && entity.type === "sequence") { this.snap_sequence("ignore", entity, osises, i, length); } if (this.options.invalid_passage_strategy === "ignore") { continue; } } if ((passage.type === "b" || passage.type === "b_range") && this.options.book_sequence_strategy === "ignore" && entity.type === "sequence") { this.snap_sequence("book", entity, osises, i, length); continue; } if ((passage.type === "b_range_start" || passage.type === "range_end_b") && this.options.book_range_strategy === "ignore") { this.snap_range(entity, i); } if (passage.absolute_indices == null) { passage.absolute_indices = entity.absolute_indices; } osises.push({ osis: passage.valid.valid ? this.to_osis(passage.start, passage.end, translation_alias) : "", type: passage.type, indices: passage.absolute_indices, translations: translations, start: passage.start, end: passage.end, enclosed_indices: passage.enclosed_absolute_indices, entity_id: entity_id, entities: [passage] }); } if (osises.length === 0) { continue; } if (osises.length > 1 && this.options.consecutive_combination_strategy === "combine") { osises = this.combine_consecutive_passages(osises, translation_alias); } if (this.options.sequence_combination_strategy === "separate") { out = out.concat(osises); } else { strings = []; last_i = osises.length - 1; if ((osises[last_i].enclosed_indices != null) && osises[last_i].enclosed_indices[1] >= 0) { entity.absolute_indices[1] = osises[last_i].enclosed_indices[1]; } for (n = 0, len1 = osises.length; n < len1; n++) { osis = osises[n]; if (osis.osis.length > 0) { strings.push(osis.osis); } } out.push({ osis: strings.join(","), indices: entity.absolute_indices, translations: translations, entity_id: entity_id, entities: osises }); } } return out; }; bcv_parser.prototype.to_osis = function(start, end, translation) { var osis, out; if ((end.c == null) && (end.v == null) && start.b === end.b && (start.c == null) && (start.v == null) && this.options.book_alone_strategy === "first_chapter") { end.c = 1; } osis = { start: "", end: "" }; if (start.c == null) { start.c = 1; } if (start.v == null) { start.v = 1; } if (end.c == null) { if (this.options.passage_existence_strategy.indexOf("c") >= 0 || ((this.passage.translations[translation].chapters[end.b] != null) && this.passage.translations[translation].chapters[end.b].length === 1)) { end.c = this.passage.translations[translation].chapters[end.b].length; } else { end.c = 999; } } if (end.v == null) { if ((this.passage.translations[translation].chapters[end.b][end.c - 1] != null) && this.options.passage_existence_strategy.indexOf("v") >= 0) { end.v = this.passage.translations[translation].chapters[end.b][end.c - 1]; } else { end.v = 999; } } if (this.options.include_apocrypha && this.options.ps151_strategy === "b" && ((start.c === 151 && start.b === "Ps") || (end.c === 151 && end.b === "Ps"))) { this.fix_ps151(start, end, translation); } if (this.options.osis_compaction_strategy === "b" && start.c === 1 && start.v === 1 && end.c === this.passage.translations[translation].chapters[end.b].length && end.v === this.passage.translations[translation].chapters[end.b][end.c - 1]) { osis.start = start.b; osis.end = end.b; } else if (this.options.osis_compaction_strategy.length <= 2 && start.v === 1 && (end.v === 999 || end.v === this.passage.translations[translation].chapters[end.b][end.c - 1])) { osis.start = start.b + "." + start.c.toString(); osis.end = end.b + "." + end.c.toString(); } else { osis.start = start.b + "." + start.c.toString() + "." + start.v.toString(); osis.end = end.b + "." + end.c.toString() + "." + end.v.toString(); } if (osis.start === osis.end) { out = osis.start; } else { out = osis.start + "-" + osis.end; } if (start.extra != null) { out = start.extra + "," + out; } if (end.extra != null) { out += "," + end.extra; } return out; }; bcv_parser.prototype.fix_ps151 = function(start, end, translation) { var ref; if (translation !== "default" && (((ref = this.translations[translation]) != null ? ref.chapters["Ps151"] : void 0) == null)) { this.passage.promote_book_to_translation("Ps151", translation); } if (start.c === 151 && start.b === "Ps") { if (end.c === 151 && end.b === "Ps") { start.b = "Ps151"; start.c = 1; end.b = "Ps151"; return end.c = 1; } else { start.extra = this.to_osis({ b: "Ps151", c: 1, v: start.v }, { b: "Ps151", c: 1, v: this.passage.translations[translation].chapters["Ps151"][0] }, translation); start.b = "Prov"; start.c = 1; return start.v = 1; } } else { end.extra = this.to_osis({ b: "Ps151", c: 1, v: 1 }, { b: "Ps151", c: 1, v: end.v }, translation); end.c = 150; return end.v = this.passage.translations[translation].chapters["Ps"][149]; } }; bcv_parser.prototype.combine_consecutive_passages = function(osises, translation) { var enclosed_sequence_start, has_enclosed, i, is_enclosed_last, k, last_i, osis, out, prev, prev_i, ref; out = []; prev = {}; last_i = osises.length - 1; enclosed_sequence_start = -1; has_enclosed = false; for (i = k = 0, ref = last_i; 0 <= ref ? k <= ref : k >= ref; i = 0 <= ref ? ++k : --k) { osis = osises[i]; if (osis.osis.length > 0) { prev_i = out.length - 1; is_enclosed_last = false; if (osis.enclosed_indices[0] !== enclosed_sequence_start) { enclosed_sequence_start = osis.enclosed_indices[0]; } if (enclosed_sequence_start >= 0 && (i === last_i || osises[i + 1].enclosed_indices[0] !== osis.enclosed_indices[0])) { is_enclosed_last = true; has_enclosed = true; } if (this.is_verse_consecutive(prev, osis.start, translation)) { out[prev_i].end = osis.end; out[prev_i].is_enclosed_last = is_enclosed_last; out[prev_i].indices[1] = osis.indices[1]; out[prev_i].enclosed_indices[1] = osis.enclosed_indices[1]; out[prev_i].osis = this.to_osis(out[prev_i].start, osis.end, translation); } else { out.push(osis); } prev = { b: osis.end.b, c: osis.end.c, v: osis.end.v }; } else { out.push(osis); prev = {}; } } if (has_enclosed) { this.snap_enclosed_indices(out); } return out; }; bcv_parser.prototype.snap_enclosed_indices = function(osises) { var k, len, osis; for (k = 0, len = osises.length; k < len; k++) { osis = osises[k]; if (osis.is_enclosed_last != null) { if (osis.enclosed_indices[0] < 0 && osis.is_enclosed_last) { osis.indices[1] = osis.enclosed_indices[1]; } delete osis.is_enclosed_last; } } return osises; }; bcv_parser.prototype.is_verse_consecutive = function(prev, check, translation) { var translation_order; if (prev.b == null) { return false; } translation_order = this.passage.translations[translation].order != null ? this.passage.translations[translation].order : this.passage.translations["default"].order; if (prev.b === check.b) { if (prev.c === check.c) { if (prev.v === check.v - 1) { return true; } } else if (check.v === 1 && prev.c === check.c - 1) { if (prev.v === this.passage.translations[translation].chapters[prev.b][prev.c - 1]) { return true; } } } else if (check.c === 1 && check.v === 1 && translation_order[prev.b] === translation_order[check.b] - 1) { if (prev.c === this.passage.translations[translation].chapters[prev.b].length && prev.v === this.passage.translations[translation].chapters[prev.b][prev.c - 1]) { return true; } } return false; }; bcv_parser.prototype.snap_range = function(entity, passage_i) { var entity_i, key, pluck, ref, source_entity, target_entity, temp, type; if (entity.type === "b_range_start" || (entity.type === "sequence" && entity.passages[passage_i].type === "b_range_start")) { entity_i = 1; source_entity = "end"; type = "b_range_start"; } else { entity_i = 0; source_entity = "start"; type = "range_end_b"; } target_entity = source_entity === "end" ? "start" : "end"; ref = entity.passages[passage_i][target_entity]; for (key in ref) { if (!hasProp.call(ref, key)) continue; entity.passages[passage_i][target_entity][key] = entity.passages[passage_i][source_entity][key]; } if (entity.type === "sequence") { if (passage_i >= entity.value.length) { passage_i = entity.value.length - 1; } pluck = this.passage.pluck(type, entity.value[passage_i]); if (pluck != null) { temp = this.snap_range(pluck, 0); if (passage_i === 0) { entity.absolute_indices[0] = temp.absolute_indices[0]; } else { entity.absolute_indices[1] = temp.absolute_indices[1]; } } } else { entity.original_type = entity.type; entity.type = entity.value[entity_i].type; entity.absolute_indices = [entity.value[entity_i].absolute_indices[0], entity.value[entity_i].absolute_indices[1]]; } return entity; }; bcv_parser.prototype.snap_sequence = function(type, entity, osises, i, length) { var passage; passage = entity.passages[i]; if (passage.absolute_indices[0] === entity.absolute_indices[0] && i < length - 1 && this.get_snap_sequence_i(entity.passages, i, length) !== i) { entity.absolute_indices[0] = entity.passages[i + 1].absolute_indices[0]; this.remove_absolute_indices(entity.passages, i + 1); } else if (passage.absolute_indices[1] === entity.absolute_indices[1] && i > 0) { entity.absolute_indices[1] = osises.length > 0 ? osises[osises.length - 1].indices[1] : entity.passages[i - 1].absolute_indices[1]; } else if (type === "book" && i < length - 1 && !this.starts_with_book(entity.passages[i + 1])) { entity.passages[i + 1].absolute_indices[0] = passage.absolute_indices[0]; } return entity; }; bcv_parser.prototype.get_snap_sequence_i = function(passages, i, length) { var j, k, ref, ref1; for (j = k = ref = i + 1, ref1 = length; ref <= ref1 ? k < ref1 : k > ref1; j = ref <= ref1 ? ++k : --k) { if (this.starts_with_book(passages[j])) { return j; } if (passages[j].valid.valid) { return i; } } return i; }; bcv_parser.prototype.starts_with_book = function(passage) { if (passage.type.substr(0, 1) === "b") { return true; } if ((passage.type === "range" || passage.type === "ff") && passage.start.type.substr(0, 1) === "b") { return true; } return false; }; bcv_parser.prototype.remove_absolute_indices = function(passages, i) { var end, k, len, passage, ref, ref1, start; if (passages[i].enclosed_absolute_indices[0] < 0) { return false; } ref = passages[i].enclosed_absolute_indices, start = ref[0], end = ref[1]; ref1 = passages.slice(i); for (k = 0, len = ref1.length; k < len; k++) { passage = ref1[k]; if (passage.enclosed_absolute_indices[0] === start && passage.enclosed_absolute_indices[1] === end) { passage.enclosed_absolute_indices = [-1, -1]; } else { break; } } return true; }; return bcv_parser; })(); root.bcv_parser = bcv_parser; bcv_passage = (function() { function bcv_passage() {} bcv_passage.prototype.books = []; bcv_passage.prototype.indices = {}; bcv_passage.prototype.options = {}; bcv_passage.prototype.translations = {}; bcv_passage.prototype.handle_array = function(passages, accum, context) { var k, len, passage, ref; if (accum == null) { accum = []; } if (context == null) { context = {}; } for (k = 0, len = passages.length; k < len; k++) { passage = passages[k]; if (passage == null) { continue; } if (passage.type === "stop") { break; } ref = this.handle_obj(passage, accum, context), accum = ref[0], context = ref[1]; } return [accum, context]; }; bcv_passage.prototype.handle_obj = function(passage, accum, context) { if ((passage.type != null) && (this[passage.type] != null)) { return this[passage.type](passage, accum, context); } else { return [accum, context]; } }; bcv_passage.prototype.b = function(passage, accum, context) { var alternates, b, k, len, obj, ref, valid; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; alternates = []; ref = this.books[passage.value].parsed; for (k = 0, len = ref.length; k < len; k++) { b = ref[k]; valid = this.validate_ref(passage.start_context.translations, { b: b }); obj = { start: { b: b }, end: { b: b }, valid: valid }; if (passage.passages.length === 0 && valid.valid) { passage.passages.push(obj); } else { alternates.push(obj); } } if (passage.passages.length === 0) { passage.passages.push(alternates.shift()); } if (alternates.length > 0) { passage.passages[0].alternates = alternates; } if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } accum.push(passage); context = { b: passage.passages[0].start.b }; if (passage.start_context.translations != null) { context.translations = passage.start_context.translations; } return [accum, context]; }; bcv_passage.prototype.b_range = function(passage, accum, context) { return this.range(passage, accum, context); }; bcv_passage.prototype.b_range_pre = function(passage, accum, context) { var alternates, book, end, ref, ref1, start_obj; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; alternates = []; book = this.pluck("b", passage.value); ref = this.b(book, [], context), (ref1 = ref[0], end = ref1[0]), context = ref[1]; if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } start_obj = { b: passage.value[0].value + end.passages[0].start.b.substr(1), type: "b" }; passage.passages = [ { start: start_obj, end: end.passages[0].end, valid: end.passages[0].valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.b_range_start = function(passage, accum, context) { return this.range(passage, accum, context); }; bcv_passage.prototype.base = function(passage, accum, context) { this.indices = this.calculate_indices(passage.match, passage.start_index); return this.handle_array(passage.value, accum, context); }; bcv_passage.prototype.bc = function(passage, accum, context) { var alternates, b, c, context_key, k, len, obj, ref, ref1, valid; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; this.reset_context(context, ["b", "c", "v"]); c = this.pluck("c", passage.value).value; alternates = []; ref = this.books[this.pluck("b", passage.value).value].parsed; for (k = 0, len = ref.length; k < len; k++) { b = ref[k]; context_key = "c"; valid = this.validate_ref(passage.start_context.translations, { b: b, c: c }); obj = { start: { b: b }, end: { b: b }, valid: valid }; if (valid.messages.start_chapter_not_exist_in_single_chapter_book) { obj.valid = this.validate_ref(passage.start_context.translations, { b: b, v: c }); obj.valid.messages.start_chapter_not_exist_in_single_chapter_book = 1; obj.start.c = 1; obj.end.c = 1; context_key = "v"; } obj.start[context_key] = c; ref1 = this.fix_start_zeroes(obj.valid, obj.start.c, obj.start.v), obj.start.c = ref1[0], obj.start.v = ref1[1]; if (obj.start.v == null) { delete obj.start.v; } obj.end[context_key] = obj.start[context_key]; if (passage.passages.length === 0 && obj.valid.valid) { passage.passages.push(obj); } else { alternates.push(obj); } } if (passage.passages.length === 0) { passage.passages.push(alternates.shift()); } if (alternates.length > 0) { passage.passages[0].alternates = alternates; } if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } this.set_context_from_object(context, ["b", "c", "v"], passage.passages[0].start); accum.push(passage); return [accum, context]; }; bcv_passage.prototype.bc_title = function(passage, accum, context) { var bc, i, k, ref, ref1, ref2, title; passage.start_context = bcv_utils.shallow_clone(context); ref = this.bc(this.pluck("bc", passage.value), [], context), (ref1 = ref[0], bc = ref1[0]), context = ref[1]; if (bc.passages[0].start.b.substr(0, 2) !== "Ps" && (bc.passages[0].alternates != null)) { for (i = k = 0, ref2 = bc.passages[0].alternates.length; 0 <= ref2 ? k < ref2 : k > ref2; i = 0 <= ref2 ? ++k : --k) { if (bc.passages[0].alternates[i].start.b.substr(0, 2) !== "Ps") { continue; } bc.passages[0] = bc.passages[0].alternates[i]; break; } } if (bc.passages[0].start.b.substr(0, 2) !== "Ps") { accum.push(bc); return [accum, context]; } this.books[this.pluck("b", bc.value).value].parsed = ["Ps"]; title = this.pluck("title", passage.value); if (title == null) { title = this.pluck("v", passage.value); } passage.value[1] = { type: "v", value: [ { type: "integer", value: 1, indices: title.indices } ], indices: title.indices }; passage.type = "bcv"; return this.bcv(passage, accum, passage.start_context); }; bcv_passage.prototype.bcv = function(passage, accum, context) { var alternates, b, bc, c, k, len, obj, ref, ref1, v, valid; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; this.reset_context(context, ["b", "c", "v"]); bc = this.pluck("bc", passage.value); c = this.pluck("c", bc.value).value; v = this.pluck("v", passage.value).value; alternates = []; ref = this.books[this.pluck("b", bc.value).value].parsed; for (k = 0, len = ref.length; k < len; k++) { b = ref[k]; valid = this.validate_ref(passage.start_context.translations, { b: b, c: c, v: v }); ref1 = this.fix_start_zeroes(valid, c, v), c = ref1[0], v = ref1[1]; obj = { start: { b: b, c: c, v: v }, end: { b: b, c: c, v: v }, valid: valid }; if (passage.passages.length === 0 && valid.valid) { passage.passages.push(obj); } else { alternates.push(obj); } } if (passage.passages.length === 0) { passage.passages.push(alternates.shift()); } if (alternates.length > 0) { passage.passages[0].alternates = alternates; } if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } this.set_context_from_object(context, ["b", "c", "v"], passage.passages[0].start); accum.push(passage); return [accum, context]; }; bcv_passage.prototype.bv = function(passage, accum, context) { var b, bcv, ref, ref1, ref2, v; passage.start_context = bcv_utils.shallow_clone(context); ref = passage.value, b = ref[0], v = ref[1]; bcv = { indices: passage.indices, value: [ { type: "bc", value: [ b, { type: "c", value: [ { type: "integer", value: 1 } ] } ] }, v ] }; ref1 = this.bcv(bcv, [], context), (ref2 = ref1[0], bcv = ref2[0]), context = ref1[1]; passage.passages = bcv.passages; if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.c = function(passage, accum, context) { var c, valid; passage.start_context = bcv_utils.shallow_clone(context); c = passage.type === "integer" ? passage.value : this.pluck("integer", passage.value).value; valid = this.validate_ref(passage.start_context.translations, { b: context.b, c: c }); if (!valid.valid && valid.messages.start_chapter_not_exist_in_single_chapter_book) { return this.v(passage, accum, context); } c = this.fix_start_zeroes(valid, c)[0]; passage.passages = [ { start: { b: context.b, c: c }, end: { b: context.b, c: c }, valid: valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } accum.push(passage); context.c = c; this.reset_context(context, ["v"]); if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } return [accum, context]; }; bcv_passage.prototype.c_psalm = function(passage, accum, context) { var c; passage.type = "bc"; c = parseInt(this.books[passage.value].value.match(/^\d+/)[0], 10); passage.value = [ { type: "b", value: passage.value, indices: passage.indices }, { type: "c", value: [ { type: "integer", value: c, indices: passage.indices } ], indices: passage.indices } ]; return this.bc(passage, accum, context); }; bcv_passage.prototype.c_title = function(passage, accum, context) { var title; passage.start_context = bcv_utils.shallow_clone(context); if (context.b !== "Ps") { return this.c(passage.value[0], accum, context); } title = this.pluck("title", passage.value); passage.value[1] = { type: "v", value: [ { type: "integer", value: 1, indices: title.indices } ], indices: title.indices }; passage.type = "cv"; return this.cv(passage, accum, passage.start_context); }; bcv_passage.prototype.cv = function(passage, accum, context) { var c, ref, v, valid; passage.start_context = bcv_utils.shallow_clone(context); c = this.pluck("c", passage.value).value; v = this.pluck("v", passage.value).value; valid = this.validate_ref(passage.start_context.translations, { b: context.b, c: c, v: v }); ref = this.fix_start_zeroes(valid, c, v), c = ref[0], v = ref[1]; passage.passages = [ { start: { b: context.b, c: c, v: v }, end: { b: context.b, c: c, v: v }, valid: valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } accum.push(passage); context.c = c; context.v = v; if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } return [accum, context]; }; bcv_passage.prototype.cb_range = function(passage, accum, context) { var b, end_c, ref, start_c; passage.type = "range"; ref = passage.value, b = ref[0], start_c = ref[1], end_c = ref[2]; passage.value = [ { type: "bc", value: [b, start_c], indices: passage.indices }, end_c ]; end_c.indices[1] = passage.indices[1]; return this.range(passage, accum, context); }; bcv_passage.prototype.context = function(passage, accum, context) { var key, ref; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; ref = this.books[passage.value].context; for (key in ref) { if (!hasProp.call(ref, key)) continue; context[key] = this.books[passage.value].context[key]; } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.cv_psalm = function(passage, accum, context) { var bc, c_psalm, ref, v; passage.start_context = bcv_utils.shallow_clone(context); passage.type = "bcv"; ref = passage.value, c_psalm = ref[0], v = ref[1]; bc = this.c_psalm(c_psalm, [], passage.start_context)[0][0]; passage.value = [bc, v]; return this.bcv(passage, accum, context); }; bcv_passage.prototype.ff = function(passage, accum, context) { var ref, ref1; passage.start_context = bcv_utils.shallow_clone(context); passage.value.push({ type: "integer", indices: passage.indices, value: 999 }); ref = this.range(passage, [], passage.start_context), (ref1 = ref[0], passage = ref1[0]), context = ref[1]; passage.value[0].indices = passage.value[1].indices; passage.value[0].absolute_indices = passage.value[1].absolute_indices; passage.value.pop(); if (passage.passages[0].valid.messages.end_verse_not_exist != null) { delete passage.passages[0].valid.messages.end_verse_not_exist; } if (passage.passages[0].valid.messages.end_chapter_not_exist != null) { delete passage.passages[0].valid.messages.end_chapter_not_exist; } if (passage.passages[0].end.original_c != null) { delete passage.passages[0].end.original_c; } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.integer_title = function(passage, accum, context) { var v_indices; passage.start_context = bcv_utils.shallow_clone(context); if (context.b !== "Ps") { return this.integer(passage.value[0], accum, context); } passage.value[0] = { type: "c", value: [passage.value[0]], indices: [passage.value[0].indices[0], passage.value[0].indices[1]] }; v_indices = [passage.indices[1] - 5, passage.indices[1]]; passage.value[1] = { type: "v", value: [ { type: "integer", value: 1, indices: v_indices } ], indices: v_indices }; passage.type = "cv"; return this.cv(passage, accum, passage.start_context); }; bcv_passage.prototype.integer = function(passage, accum, context) { if (context.v != null) { return this.v(passage, accum, context); } return this.c(passage, accum, context); }; bcv_passage.prototype.sequence = function(passage, accum, context) { var k, l, len, len1, obj, psg, ref, ref1, ref2, ref3, sub_psg; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; ref = passage.value; for (k = 0, len = ref.length; k < len; k++) { obj = ref[k]; ref1 = this.handle_array(obj, [], context), (ref2 = ref1[0], psg = ref2[0]), context = ref1[1]; ref3 = psg.passages; for (l = 0, len1 = ref3.length; l < len1; l++) { sub_psg = ref3[l]; if (sub_psg.type == null) { sub_psg.type = psg.type; } if (sub_psg.absolute_indices == null) { sub_psg.absolute_indices = psg.absolute_indices; } if (psg.start_context.translations != null) { sub_psg.translations = psg.start_context.translations; } sub_psg.enclosed_absolute_indices = psg.type === "sequence_post_enclosed" ? psg.absolute_indices : [-1, -1]; passage.passages.push(sub_psg); } } if (passage.absolute_indices == null) { if (passage.passages.length > 0 && passage.type === "sequence") { passage.absolute_indices = [passage.passages[0].absolute_indices[0], passage.passages[passage.passages.length - 1].absolute_indices[1]]; } else { passage.absolute_indices = this.get_absolute_indices(passage.indices); } } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.sequence_post_enclosed = function(passage, accum, context) { return this.sequence(passage, accum, context); }; bcv_passage.prototype.v = function(passage, accum, context) { var c, no_c, ref, v, valid; v = passage.type === "integer" ? passage.value : this.pluck("integer", passage.value).value; passage.start_context = bcv_utils.shallow_clone(context); c = context.c != null ? context.c : 1; valid = this.validate_ref(passage.start_context.translations, { b: context.b, c: c, v: v }); ref = this.fix_start_zeroes(valid, 0, v), no_c = ref[0], v = ref[1]; passage.passages = [ { start: { b: context.b, c: c, v: v }, end: { b: context.b, c: c, v: v }, valid: valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } accum.push(passage); context.v = v; return [accum, context]; }; bcv_passage.prototype.range = function(passage, accum, context) { var end, end_obj, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, return_now, return_value, start, start_obj, valid; passage.start_context = bcv_utils.shallow_clone(context); ref = passage.value, start = ref[0], end = ref[1]; ref1 = this.handle_obj(start, [], context), (ref2 = ref1[0], start = ref2[0]), context = ref1[1]; if (end.type === "v" && ((start.type === "bc" && !((ref3 = start.passages) != null ? (ref4 = ref3[0]) != null ? (ref5 = ref4.valid) != null ? (ref6 = ref5.messages) != null ? ref6.start_chapter_not_exist_in_single_chapter_book : void 0 : void 0 : void 0 : void 0)) || start.type === "c") && this.options.end_range_digits_strategy === "verse") { passage.value[0] = start; return this.range_change_integer_end(passage, accum); } ref7 = this.handle_obj(end, [], context), (ref8 = ref7[0], end = ref8[0]), context = ref7[1]; passage.value = [start, end]; passage.indices = [start.indices[0], end.indices[1]]; delete passage.absolute_indices; start_obj = { b: start.passages[0].start.b, c: start.passages[0].start.c, v: start.passages[0].start.v, type: start.type }; end_obj = { b: end.passages[0].end.b, c: end.passages[0].end.c, v: end.passages[0].end.v, type: end.type }; if (end.passages[0].valid.messages.start_chapter_is_zero) { end_obj.c = 0; } if (end.passages[0].valid.messages.start_verse_is_zero) { end_obj.v = 0; } valid = this.validate_ref(passage.start_context.translations, start_obj, end_obj); if (valid.valid) { ref9 = this.range_handle_valid(valid, passage, start, start_obj, end, end_obj, accum), return_now = ref9[0], return_value = ref9[1]; if (return_now) { return return_value; } } else { return this.range_handle_invalid(valid, passage, start, start_obj, end, end_obj, accum); } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } passage.passages = [ { start: start_obj, end: end_obj, valid: valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (start_obj.type === "b") { if (end_obj.type === "b") { passage.type = "b_range"; } else { passage.type = "b_range_start"; } } else if (end_obj.type === "b") { passage.type = "range_end_b"; } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.range_change_end = function(passage, accum, new_end) { var end, new_obj, ref, start; ref = passage.value, start = ref[0], end = ref[1]; if (end.type === "integer") { end.original_value = end.value; end.value = new_end; } else if (end.type === "v") { new_obj = this.pluck("integer", end.value); new_obj.original_value = new_obj.value; new_obj.value = new_end; } else if (end.type === "cv") { new_obj = this.pluck("c", end.value); new_obj.original_value = new_obj.value; new_obj.value = new_end; } return this.handle_obj(passage, accum, passage.start_context); }; bcv_passage.prototype.range_change_integer_end = function(passage, accum) { var end, ref, start; ref = passage.value, start = ref[0], end = ref[1]; if (passage.original_type == null) { passage.original_type = passage.type; } if (passage.original_value == null) { passage.original_value = [start, end]; } passage.type = start.type === "integer" ? "cv" : start.type + "v"; if (start.type === "integer") { passage.value[0] = { type: "c", value: [start], indices: start.indices }; } if (end.type === "integer") { passage.value[1] = { type: "v", value: [end], indices: end.indices }; } return this.handle_obj(passage, accum, passage.start_context); }; bcv_passage.prototype.range_check_new_end = function(translations, start_obj, end_obj, valid) { var new_end, new_valid, obj_to_validate, type; new_end = 0; type = null; if (valid.messages.end_chapter_before_start) { type = "c"; } else if (valid.messages.end_verse_before_start) { type = "v"; } if (type != null) { new_end = this.range_get_new_end_value(start_obj, end_obj, valid, type); } if (new_end > 0) { obj_to_validate = { b: end_obj.b, c: end_obj.c, v: end_obj.v }; obj_to_validate[type] = new_end; new_valid = this.validate_ref(translations, obj_to_validate); if (!new_valid.valid) { new_end = 0; } } return new_end; }; bcv_passage.prototype.range_end_b = function(passage, accum, context) { return this.range(passage, accum, context); }; bcv_passage.prototype.range_get_new_end_value = function(start_obj, end_obj, valid, key) { var new_end; new_end = 0; if ((key === "c" && valid.messages.end_chapter_is_zero) || (key === "v" && valid.messages.end_verse_is_zero)) { return new_end; } if (start_obj[key] >= 10 && end_obj[key] < 10 && start_obj[key] - 10 * Math.floor(start_obj[key] / 10) < end_obj[key]) { new_end = end_obj[key] + 10 * Math.floor(start_obj[key] / 10); } else if (start_obj[key] >= 100 && end_obj[key] < 100 && start_obj[key] - 100 < end_obj[key]) { new_end = end_obj[key] + 100; } return new_end; }; bcv_passage.prototype.range_handle_invalid = function(valid, passage, start, start_obj, end, end_obj, accum) { var new_end, ref, temp_valid, temp_value; if (valid.valid === false && (valid.messages.end_chapter_before_start || valid.messages.end_verse_before_start) && (end.type === "integer" || end.type === "v") || (valid.valid === false && valid.messages.end_chapter_before_start && end.type === "cv")) { new_end = this.range_check_new_end(passage.start_context.translations, start_obj, end_obj, valid); if (new_end > 0) { return this.range_change_end(passage, accum, new_end); } } if (this.options.end_range_digits_strategy === "verse" && (start_obj.v == null) && (end.type === "integer" || end.type === "v")) { temp_value = end.type === "v" ? this.pluck("integer", end.value) : end.value; temp_valid = this.validate_ref(passage.start_context.translations, { b: start_obj.b, c: start_obj.c, v: temp_value }); if (temp_valid.valid) { return this.range_change_integer_end(passage, accum); } } if (passage.original_type == null) { passage.original_type = passage.type; } passage.type = "sequence"; ref = [[start, end], [[start], [end]]], passage.original_value = ref[0], passage.value = ref[1]; return this.sequence(passage, accum, passage.start_context); }; bcv_passage.prototype.range_handle_valid = function(valid, passage, start, start_obj, end, end_obj, accum) { var temp_valid, temp_value; if (valid.messages.end_chapter_not_exist && this.options.end_range_digits_strategy === "verse" && (start_obj.v == null) && (end.type === "integer" || end.type === "v") && this.options.passage_existence_strategy.indexOf("v") >= 0) { temp_value = end.type === "v" ? this.pluck("integer", end.value) : end.value; temp_valid = this.validate_ref(passage.start_context.translations, { b: start_obj.b, c: start_obj.c, v: temp_value }); if (temp_valid.valid) { return [true, this.range_change_integer_end(passage, accum)]; } } this.range_validate(valid, start_obj, end_obj, passage); return [false, null]; }; bcv_passage.prototype.range_validate = function(valid, start_obj, end_obj, passage) { var ref; if (valid.messages.end_chapter_not_exist || valid.messages.end_chapter_not_exist_in_single_chapter_book) { end_obj.original_c = end_obj.c; end_obj.c = valid.messages.end_chapter_not_exist ? valid.messages.end_chapter_not_exist : valid.messages.end_chapter_not_exist_in_single_chapter_book; if (end_obj.v != null) { end_obj.v = this.validate_ref(passage.start_context.translations, { b: end_obj.b, c: end_obj.c, v: 999 }).messages.end_verse_not_exist; delete valid.messages.end_verse_is_zero; } } else if (valid.messages.end_verse_not_exist) { end_obj.original_v = end_obj.v; end_obj.v = valid.messages.end_verse_not_exist; } if (valid.messages.end_verse_is_zero && this.options.zero_verse_strategy !== "allow") { end_obj.v = valid.messages.end_verse_is_zero; } if (valid.messages.end_chapter_is_zero) { end_obj.c = valid.messages.end_chapter_is_zero; } ref = this.fix_start_zeroes(valid, start_obj.c, start_obj.v), start_obj.c = ref[0], start_obj.v = ref[1]; return true; }; bcv_passage.prototype.translation_sequence = function(passage, accum, context) { var k, l, len, len1, ref, translation, translations, val; passage.start_context = bcv_utils.shallow_clone(context); translations = []; translations.push({ translation: this.books[passage.value[0].value].parsed }); ref = passage.value[1]; for (k = 0, len = ref.length; k < len; k++) { val = ref[k]; val = this.books[this.pluck("translation", val).value].parsed; if (val != null) { translations.push({ translation: val }); } } for (l = 0, len1 = translations.length; l < len1; l++) { translation = translations[l]; if (this.translations.aliases[translation.translation] != null) { translation.alias = this.translations.aliases[translation.translation].alias; translation.osis = this.translations.aliases[translation.translation].osis || ""; } else { translation.alias = "default"; translation.osis = translation.translation.toUpperCase(); } } if (accum.length > 0) { context = this.translation_sequence_apply(accum, translations); } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } accum.push(passage); this.reset_context(context, ["translations"]); return [accum, context]; }; bcv_passage.prototype.translation_sequence_apply = function(accum, translations) { var context, i, k, new_accum, ref, ref1, use_i; use_i = 0; for (i = k = ref = accum.length - 1; ref <= 0 ? k <= 0 : k >= 0; i = ref <= 0 ? ++k : --k) { if (accum[i].original_type != null) { accum[i].type = accum[i].original_type; } if (accum[i].original_value != null) { accum[i].value = accum[i].original_value; } if (accum[i].type !== "translation_sequence") { continue; } use_i = i + 1; break; } if (use_i < accum.length) { accum[use_i].start_context.translations = translations; ref1 = this.handle_array(accum.slice(use_i), [], accum[use_i].start_context), new_accum = ref1[0], context = ref1[1]; } else { context = bcv_utils.shallow_clone(accum[accum.length - 1].start_context); } return context; }; bcv_passage.prototype.pluck = function(type, passages) { var k, len, passage; for (k = 0, len = passages.length; k < len; k++) { passage = passages[k]; if (!((passage != null) && (passage.type != null) && passage.type === type)) { continue; } if (type === "c" || type === "v") { return this.pluck("integer", passage.value); } return passage; } return null; }; bcv_passage.prototype.set_context_from_object = function(context, keys, obj) { var k, len, results, type; results = []; for (k = 0, len = keys.length; k < len; k++) { type = keys[k]; if (obj[type] == null) { continue; } results.push(context[type] = obj[type]); } return results; }; bcv_passage.prototype.reset_context = function(context, keys) { var k, len, results, type; results = []; for (k = 0, len = keys.length; k < len; k++) { type = keys[k]; results.push(delete context[type]); } return results; }; bcv_passage.prototype.fix_start_zeroes = function(valid, c, v) { if (valid.messages.start_chapter_is_zero && this.options.zero_chapter_strategy === "upgrade") { c = valid.messages.start_chapter_is_zero; } if (valid.messages.start_verse_is_zero && this.options.zero_verse_strategy === "upgrade") { v = valid.messages.start_verse_is_zero; } return [c, v]; }; bcv_passage.prototype.calculate_indices = function(match, adjust) { var character, end_index, indices, k, l, len, len1, len2, m, match_index, part, part_length, parts, ref, switch_type, temp; switch_type = "book"; indices = []; match_index = 0; adjust = parseInt(adjust, 10); parts = [match]; ref = ["\x1e", "\x1f"]; for (k = 0, len = ref.length; k < len; k++) { character = ref[k]; temp = []; for (l = 0, len1 = parts.length; l < len1; l++) { part = parts[l]; temp = temp.concat(part.split(character)); } parts = temp; } for (m = 0, len2 = parts.length; m < len2; m++) { part = parts[m]; switch_type = switch_type === "book" ? "rest" : "book"; part_length = part.length; if (part_length === 0) { continue; } if (switch_type === "book") { part = part.replace(/\/\d+$/, ""); end_index = match_index + part_length; if (indices.length > 0 && indices[indices.length - 1].index === adjust) { indices[indices.length - 1].end = end_index; } else { indices.push({ start: match_index, end: end_index, index: adjust }); } match_index += part_length + 2; adjust = this.books[part].start_index + this.books[part].value.length - match_index; indices.push({ start: end_index + 1, end: end_index + 1, index: adjust }); } else { end_index = match_index + part_length - 1; if (indices.length > 0 && indices[indices.length - 1].index === adjust) { indices[indices.length - 1].end = end_index; } else { indices.push({ start: match_index, end: end_index, index: adjust }); } match_index += part_length; } } return indices; }; bcv_passage.prototype.get_absolute_indices = function(arg1) { var end, end_out, index, k, len, ref, start, start_out; start = arg1[0], end = arg1[1]; start_out = null; end_out = null; ref = this.indices; for (k = 0, len = ref.length; k < len; k++) { index = ref[k]; if (start_out === null && (index.start <= start && start <= index.end)) { start_out = start + index.index; } if ((index.start <= end && end <= index.end)) { end_out = end + index.index + 1; break; } } return [start_out, end_out]; }; bcv_passage.prototype.validate_ref = function(translations, start, end) { var k, len, messages, temp_valid, translation, valid; if (!((translations != null) && translations.length > 0)) { translations = [ { translation: "default", osis: "", alias: "default" } ]; } valid = false; messages = {}; for (k = 0, len = translations.length; k < len; k++) { translation = translations[k]; if (translation.alias == null) { translation.alias = "default"; } if (translation.alias == null) { if (messages.translation_invalid == null) { messages.translation_invalid = []; } messages.translation_invalid.push(translation); continue; } if (this.translations.aliases[translation.alias] == null) { translation.alias = "default"; if (messages.translation_unknown == null) { messages.translation_unknown = []; } messages.translation_unknown.push(translation); } temp_valid = this.validate_start_ref(translation.alias, start, messages)[0]; if (end) { temp_valid = this.validate_end_ref(translation.alias, start, end, temp_valid, messages)[0]; } if (temp_valid === true) { valid = true; } } return { valid: valid, messages: messages }; }; bcv_passage.prototype.validate_start_ref = function(translation, start, messages) { var ref, ref1, translation_order, valid; valid = true; if (translation !== "default" && (((ref = this.translations[translation]) != null ? ref.chapters[start.b] : void 0) == null)) { this.promote_book_to_translation(start.b, translation); } translation_order = ((ref1 = this.translations[translation]) != null ? ref1.order : void 0) != null ? translation : "default"; if (start.v != null) { start.v = parseInt(start.v, 10); } if (this.translations[translation_order].order[start.b] != null) { if (start.c == null) { start.c = 1; } start.c = parseInt(start.c, 10); if (isNaN(start.c)) { valid = false; messages.start_chapter_not_numeric = true; return [valid, messages]; } if (start.c === 0) { messages.start_chapter_is_zero = 1; if (this.options.zero_chapter_strategy === "error") { valid = false; } else { start.c = 1; } } if ((start.v != null) && start.v === 0) { messages.start_verse_is_zero = 1; if (this.options.zero_verse_strategy === "error") { valid = false; } else if (this.options.zero_verse_strategy === "upgrade") { start.v = 1; } } if (start.c > 0 && (this.translations[translation].chapters[start.b][start.c - 1] != null)) { if (start.v != null) { if (isNaN(start.v)) { valid = false; messages.start_verse_not_numeric = true; } else if (start.v > this.translations[translation].chapters[start.b][start.c - 1]) { if (this.options.passage_existence_strategy.indexOf("v") >= 0) { valid = false; messages.start_verse_not_exist = this.translations[translation].chapters[start.b][start.c - 1]; } } } } else { if (start.c !== 1 && this.translations[translation].chapters[start.b].length === 1) { valid = false; messages.start_chapter_not_exist_in_single_chapter_book = 1; } else if (start.c > 0 && this.options.passage_existence_strategy.indexOf("c") >= 0) { valid = false; messages.start_chapter_not_exist = this.translations[translation].chapters[start.b].length; } } } else { if (this.options.passage_existence_strategy.indexOf("b") >= 0) { valid = false; } messages.start_book_not_exist = true; } return [valid, messages]; }; bcv_passage.prototype.validate_end_ref = function(translation, start, end, valid, messages) { var ref, translation_order; translation_order = ((ref = this.translations[translation]) != null ? ref.order : void 0) != null ? translation : "default"; if (end.c != null) { end.c = parseInt(end.c, 10); if (isNaN(end.c)) { valid = false; messages.end_chapter_not_numeric = true; } else if (end.c === 0) { messages.end_chapter_is_zero = 1; if (this.options.zero_chapter_strategy === "error") { valid = false; } else { end.c = 1; } } } if (end.v != null) { end.v = parseInt(end.v, 10); if (isNaN(end.v)) { valid = false; messages.end_verse_not_numeric = true; } else if (end.v === 0) { messages.end_verse_is_zero = 1; if (this.options.zero_verse_strategy === "error") { valid = false; } else if (this.options.zero_verse_strategy === "upgrade") { end.v = 1; } } } if (this.translations[translation_order].order[end.b] != null) { if ((end.c == null) && this.translations[translation].chapters[end.b].length === 1) { end.c = 1; } if ((this.translations[translation_order].order[start.b] != null) && this.translations[translation_order].order[start.b] > this.translations[translation_order].order[end.b]) { if (this.options.passage_existence_strategy.indexOf("b") >= 0) { valid = false; } messages.end_book_before_start = true; } if (start.b === end.b && (end.c != null) && !isNaN(end.c)) { if (start.c == null) { start.c = 1; } if (!isNaN(parseInt(start.c, 10)) && start.c > end.c) { valid = false; messages.end_chapter_before_start = true; } else if (start.c === end.c && (end.v != null) && !isNaN(end.v)) { if (start.v == null) { start.v = 1; } if (!isNaN(parseInt(start.v, 10)) && start.v > end.v) { valid = false; messages.end_verse_before_start = true; } } } if ((end.c != null) && !isNaN(end.c)) { if (this.translations[translation].chapters[end.b][end.c - 1] == null) { if (this.translations[translation].chapters[end.b].length === 1) { messages.end_chapter_not_exist_in_single_chapter_book = 1; } else if (end.c > 0 && this.options.passage_existence_strategy.indexOf("c") >= 0) { messages.end_chapter_not_exist = this.translations[translation].chapters[end.b].length; } } } if ((end.v != null) && !isNaN(end.v)) { if (end.c == null) { end.c = this.translations[translation].chapters[end.b].length; } if (end.v > this.translations[translation].chapters[end.b][end.c - 1] && this.options.passage_existence_strategy.indexOf("v") >= 0) { messages.end_verse_not_exist = this.translations[translation].chapters[end.b][end.c - 1]; } } } else { valid = false; messages.end_book_not_exist = true; } return [valid, messages]; }; bcv_passage.prototype.promote_book_to_translation = function(book, translation) { var base, base1; if ((base = this.translations)[translation] == null) { base[translation] = {}; } if ((base1 = this.translations[translation]).chapters == null) { base1.chapters = {}; } if (this.translations[translation].chapters[book] == null) { return this.translations[translation].chapters[book] = bcv_utils.shallow_clone_array(this.translations["default"].chapters[book]); } }; return bcv_passage; })(); bcv_utils = { shallow_clone: function(obj) { var key, out, val; if (obj == null) { return obj; } out = {}; for (key in obj) { if (!hasProp.call(obj, key)) continue; val = obj[key]; out[key] = val; } return out; }, shallow_clone_array: function(arr) { var i, k, out, ref; if (arr == null) { return arr; } out = []; for (i = k = 0, ref = arr.length; 0 <= ref ? k <= ref : k >= ref; i = 0 <= ref ? ++k : --k) { if (typeof arr[i] !== "undefined") { out[i] = arr[i]; } } return out; } }; bcv_parser.prototype.regexps.translations = /(?:(?:RUSV|SZ))\b/gi; bcv_parser.prototype.translations = { aliases: { "default": { osis: "", alias: "default" } }, alternates: {}, "default": { order: { "Gen": 1, "Exod": 2, "Lev": 3, "Num": 4, "Deut": 5, "Josh": 6, "Judg": 7, "Ruth": 8, "1Sam": 9, "2Sam": 10, "1Kgs": 11, "2Kgs": 12, "1Chr": 13, "2Chr": 14, "Ezra": 15, "Neh": 16, "Esth": 17, "Job": 18, "Ps": 19, "Prov": 20, "Eccl": 21, "Song": 22, "Isa": 23, "Jer": 24, "Lam": 25, "Ezek": 26, "Dan": 27, "Hos": 28, "Joel": 29, "Amos": 30, "Obad": 31, "Jonah": 32, "Mic": 33, "Nah": 34, "Hab": 35, "Zeph": 36, "Hag": 37, "Zech": 38, "Mal": 39, "Matt": 40, "Mark": 41, "Luke": 42, "John": 43, "Acts": 44, "Rom": 45, "1Cor": 46, "2Cor": 47, "Gal": 48, "Eph": 49, "Phil": 50, "Col": 51, "1Thess": 52, "2Thess": 53, "1Tim": 54, "2Tim": 55, "Titus": 56, "Phlm": 57, "Heb": 58, "Jas": 59, "1Pet": 60, "2Pet": 61, "1John": 62, "2John": 63, "3John": 64, "Jude": 65, "Rev": 66, "Tob": 67, "Jdt": 68, "GkEsth": 69, "Wis": 70, "Sir": 71, "Bar": 72, "PrAzar": 73, "Sus": 74, "Bel": 75, "SgThree": 76, "EpJer": 77, "1Macc": 78, "2Macc": 79, "3Macc": 80, "4Macc": 81, "1Esd": 82, "2Esd": 83, "PrMan": 84 }, chapters: { "Gen": [31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26], "Exod": [22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38], "Lev": [17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34], "Num": [54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22, 29, 35, 41, 30, 25, 18, 65, 23, 31, 40, 16, 54, 42, 56, 29, 34, 13], "Deut": [46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 32, 18, 29, 23, 22, 20, 22, 21, 20, 23, 30, 25, 22, 19, 19, 26, 68, 29, 20, 30, 52, 29, 12], "Josh": [18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33], "Judg": [36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25], "Ruth": [22, 23, 18, 22], "1Sam": [28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 42, 15, 23, 29, 22, 44, 25, 12, 25, 11, 31, 13], "2Sam": [27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 33, 43, 26, 22, 51, 39, 25], "1Kgs": [53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 53], "2Kgs": [18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30], "1Chr": [54, 55, 24, 43, 26, 81, 40, 40, 44, 14, 47, 40, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31, 32, 34, 21, 30], "2Chr": [17, 18, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 22, 15, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27, 28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23], "Ezra": [11, 70, 13, 24, 17, 22, 28, 36, 15, 44], "Neh": [11, 20, 32, 23, 19, 19, 73, 18, 38, 39, 36, 47, 31], "Esth": [22, 23, 15, 17, 14, 14, 10, 17, 32, 3], "Job": [22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29, 29, 34, 30, 17, 25, 6, 14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 30, 24, 34, 17], "Ps": [6, 12, 8, 8, 12, 10, 17, 9, 20, 18, 7, 8, 6, 7, 5, 11, 15, 50, 14, 9, 13, 31, 6, 10, 22, 12, 14, 9, 11, 12, 24, 11, 22, 22, 28, 12, 40, 22, 13, 17, 13, 11, 5, 26, 17, 11, 9, 14, 20, 23, 19, 9, 6, 7, 23, 13, 11, 11, 17, 12, 8, 12, 11, 10, 13, 20, 7, 35, 36, 5, 24, 20, 28, 23, 10, 12, 20, 72, 13, 19, 16, 8, 18, 12, 13, 17, 7, 18, 52, 17, 16, 15, 5, 23, 11, 13, 12, 9, 9, 5, 8, 28, 22, 35, 45, 48, 43, 13, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 13, 10, 7, 12, 15, 21, 10, 20, 14, 9, 6], "Prov": [33, 22, 35, 27, 23, 35, 27, 36, 18, 32, 31, 28, 25, 35, 33, 33, 28, 24, 29, 30, 31, 29, 35, 34, 28, 28, 27, 28, 27, 33, 31], "Eccl": [18, 26, 22, 16, 20, 12, 29, 17, 18, 20, 10, 14], "Song": [17, 17, 11, 16, 16, 13, 13, 14], "Isa": [31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24], "Jer": [19, 37, 25, 31, 31, 30, 34, 22, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10, 38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46, 64, 34], "Lam": [22, 22, 66, 22, 22], "Ezek": [28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 49, 32, 31, 49, 27, 17, 21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35], "Dan": [21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13], "Hos": [11, 23, 5, 19, 15, 11, 16, 14, 17, 15, 12, 14, 16, 9], "Joel": [20, 32, 21], "Amos": [15, 16, 15, 13, 27, 14, 17, 14, 15], "Obad": [21], "Jonah": [17, 10, 10, 11], "Mic": [16, 13, 12, 13, 15, 16, 20], "Nah": [15, 13, 19], "Hab": [17, 20, 19], "Zeph": [18, 15, 20], "Hag": [15, 23], "Zech": [21, 13, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21], "Mal": [14, 17, 18, 6], "Matt": [25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 27, 35, 30, 34, 46, 46, 39, 51, 46, 75, 66, 20], "Mark": [45, 28, 35, 41, 43, 56, 37, 38, 50, 52, 33, 44, 37, 72, 47, 20], "Luke": [80, 52, 38, 44, 39, 49, 50, 56, 62, 42, 54, 59, 35, 35, 32, 31, 37, 43, 48, 47, 38, 71, 56, 53], "John": [51, 25, 36, 54, 47, 71, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42, 31, 25], "Acts": [26, 47, 26, 37, 42, 15, 60, 40, 43, 48, 30, 25, 52, 28, 41, 40, 34, 28, 41, 38, 40, 30, 35, 27, 27, 32, 44, 31], "Rom": [32, 29, 31, 25, 21, 23, 25, 39, 33, 21, 36, 21, 14, 23, 33, 27], "1Cor": [31, 16, 23, 21, 13, 20, 40, 13, 27, 33, 34, 31, 13, 40, 58, 24], "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 14], "Gal": [24, 21, 29, 31, 26, 18], "Eph": [23, 22, 21, 32, 33, 24], "Phil": [30, 30, 21, 23], "Col": [29, 23, 25, 18], "1Thess": [10, 20, 13, 18, 28], "2Thess": [12, 17, 18], "1Tim": [20, 15, 16, 16, 25, 21], "2Tim": [18, 26, 17, 22], "Titus": [16, 15, 15], "Phlm": [25], "Heb": [14, 18, 19, 16, 14, 20, 28, 13, 28, 39, 40, 29, 25], "Jas": [27, 26, 18, 17, 20], "1Pet": [25, 25, 22, 19, 14], "2Pet": [21, 22, 18], "1John": [10, 29, 24, 21, 21], "2John": [13], "3John": [15], "Jude": [25], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 17, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21], "Tob": [22, 14, 17, 21, 22, 18, 16, 21, 6, 13, 18, 22, 17, 15], "Jdt": [16, 28, 10, 15, 24, 21, 32, 36, 14, 23, 23, 20, 20, 19, 14, 25], "GkEsth": [22, 23, 15, 17, 14, 14, 10, 17, 32, 13, 12, 6, 18, 19, 16, 24], "Wis": [16, 24, 19, 20, 23, 25, 30, 21, 18, 21, 26, 27, 19, 31, 19, 29, 21, 25, 22], "Sir": [30, 18, 31, 31, 15, 37, 36, 19, 18, 31, 34, 18, 26, 27, 20, 30, 32, 33, 30, 31, 28, 27, 27, 34, 26, 29, 30, 26, 28, 25, 31, 24, 33, 31, 26, 31, 31, 34, 35, 30, 22, 25, 33, 23, 26, 20, 25, 25, 16, 29, 30], "Bar": [22, 35, 37, 37, 9], "PrAzar": [68], "Sus": [64], "Bel": [42], "SgThree": [39], "EpJer": [73], "1Macc": [64, 70, 60, 61, 68, 63, 50, 32, 73, 89, 74, 53, 53, 49, 41, 24], "2Macc": [36, 32, 40, 50, 27, 31, 42, 36, 29, 38, 38, 45, 26, 46, 39], "3Macc": [29, 33, 30, 21, 51, 41, 23], "4Macc": [35, 24, 21, 26, 38, 35, 23, 29, 32, 21, 27, 19, 27, 20, 32, 25, 24, 24], "1Esd": [58, 30, 24, 63, 73, 34, 15, 96, 55], "2Esd": [40, 48, 36, 52, 56, 59, 70, 63, 47, 59, 46, 51, 58, 48, 63, 78], "PrMan": [15], "Ps151": [7] } }, vulgate: { chapters: { "Ps": [6, 13, 9, 10, 13, 11, 18, 10, 39, 8, 9, 6, 7, 5, 10, 15, 51, 15, 10, 14, 32, 6, 10, 22, 12, 14, 9, 11, 13, 25, 11, 22, 23, 28, 13, 40, 23, 14, 18, 14, 12, 5, 26, 18, 12, 10, 15, 21, 23, 21, 11, 7, 9, 24, 13, 12, 12, 18, 14, 9, 13, 12, 11, 14, 20, 8, 36, 37, 6, 24, 20, 28, 23, 11, 13, 21, 72, 13, 20, 17, 8, 19, 13, 14, 17, 7, 19, 53, 17, 16, 16, 5, 23, 11, 13, 12, 9, 9, 5, 8, 29, 22, 35, 45, 48, 43, 14, 31, 7, 10, 10, 9, 26, 9, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 14, 10, 8, 12, 15, 21, 10, 11, 20, 14, 9, 7] } }, ceb: { chapters: { "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 13], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21], "Tob": [22, 14, 17, 21, 22, 18, 16, 21, 6, 13, 18, 22, 18, 15], "PrAzar": [67], "EpJer": [72], "1Esd": [55, 26, 24, 63, 71, 33, 15, 92, 55] } }, kjv: { chapters: { "3John": [14] } }, nab: { order: { "Gen": 1, "Exod": 2, "Lev": 3, "Num": 4, "Deut": 5, "Josh": 6, "Judg": 7, "Ruth": 8, "1Sam": 9, "2Sam": 10, "1Kgs": 11, "2Kgs": 12, "1Chr": 13, "2Chr": 14, "PrMan": 15, "Ezra": 16, "Neh": 17, "1Esd": 18, "2Esd": 19, "Tob": 20, "Jdt": 21, "Esth": 22, "GkEsth": 23, "1Macc": 24, "2Macc": 25, "3Macc": 26, "4Macc": 27, "Job": 28, "Ps": 29, "Prov": 30, "Eccl": 31, "Song": 32, "Wis": 33, "Sir": 34, "Isa": 35, "Jer": 36, "Lam": 37, "Bar": 38, "EpJer": 39, "Ezek": 40, "Dan": 41, "PrAzar": 42, "Sus": 43, "Bel": 44, "SgThree": 45, "Hos": 46, "Joel": 47, "Amos": 48, "Obad": 49, "Jonah": 50, "Mic": 51, "Nah": 52, "Hab": 53, "Zeph": 54, "Hag": 55, "Zech": 56, "Mal": 57, "Matt": 58, "Mark": 59, "Luke": 60, "John": 61, "Acts": 62, "Rom": 63, "1Cor": 64, "2Cor": 65, "Gal": 66, "Eph": 67, "Phil": 68, "Col": 69, "1Thess": 70, "2Thess": 71, "1Tim": 72, "2Tim": 73, "Titus": 74, "Phlm": 75, "Heb": 76, "Jas": 77, "1Pet": 78, "2Pet": 79, "1John": 80, "2John": 81, "3John": 82, "Jude": 83, "Rev": 84 }, chapters: { "Gen": [31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 54, 33, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26], "Exod": [22, 25, 22, 31, 23, 30, 29, 28, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 37, 30, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38], "Lev": [17, 16, 17, 35, 26, 23, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34], "Num": [54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 35, 28, 32, 22, 29, 35, 41, 30, 25, 19, 65, 23, 31, 39, 17, 54, 42, 56, 29, 34, 13], "Deut": [46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 31, 19, 29, 23, 22, 20, 22, 21, 20, 23, 29, 26, 22, 19, 19, 26, 69, 28, 20, 30, 52, 29, 12], "1Sam": [28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 42, 16, 23, 28, 23, 44, 25, 12, 25, 11, 31, 13], "2Sam": [27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 32, 44, 26, 22, 51, 39, 25], "1Kgs": [53, 46, 28, 20, 32, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 54], "2Kgs": [18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 20, 22, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30], "1Chr": [54, 55, 24, 43, 41, 66, 40, 40, 44, 14, 47, 41, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31, 32, 34, 21, 30], "2Chr": [18, 17, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 23, 14, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27, 28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23], "Neh": [11, 20, 38, 17, 19, 19, 72, 18, 37, 40, 36, 47, 31], "Job": [22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29, 29, 34, 30, 17, 25, 6, 14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 30, 32, 26, 17], "Ps": [6, 11, 9, 9, 13, 11, 18, 10, 21, 18, 7, 9, 6, 7, 5, 11, 15, 51, 15, 10, 14, 32, 6, 10, 22, 12, 14, 9, 11, 13, 25, 11, 22, 23, 28, 13, 40, 23, 14, 18, 14, 12, 5, 27, 18, 12, 10, 15, 21, 23, 21, 11, 7, 9, 24, 14, 12, 12, 18, 14, 9, 13, 12, 11, 14, 20, 8, 36, 37, 6, 24, 20, 28, 23, 11, 13, 21, 72, 13, 20, 17, 8, 19, 13, 14, 17, 7, 19, 53, 17, 16, 16, 5, 23, 11, 13, 12, 9, 9, 5, 8, 29, 22, 35, 45, 48, 43, 14, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 14, 10, 8, 12, 15, 21, 10, 20, 14, 9, 6], "Eccl": [18, 26, 22, 17, 19, 12, 29, 17, 18, 20, 10, 14], "Song": [17, 17, 11, 16, 16, 12, 14, 14], "Isa": [31, 22, 26, 6, 30, 13, 25, 23, 20, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 11, 25, 24], "Jer": [19, 37, 25, 31, 31, 30, 34, 23, 25, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10, 38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46, 64, 34], "Ezek": [28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 44, 37, 31, 49, 27, 17, 21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35], "Dan": [21, 49, 100, 34, 30, 29, 28, 27, 27, 21, 45, 13, 64, 42], "Hos": [9, 25, 5, 19, 15, 11, 16, 14, 17, 15, 11, 15, 15, 10], "Joel": [20, 27, 5, 21], "Jonah": [16, 11, 10, 11], "Mic": [16, 13, 12, 14, 14, 16, 20], "Nah": [14, 14, 19], "Zech": [17, 17, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21], "Mal": [14, 17, 24], "Acts": [26, 47, 26, 37, 42, 15, 60, 40, 43, 49, 30, 25, 52, 28, 41, 40, 34, 28, 40, 38, 40, 30, 35, 27, 27, 32, 44, 31], "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 13], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21], "Tob": [22, 14, 17, 21, 22, 18, 17, 21, 6, 13, 18, 22, 18, 15], "Sir": [30, 18, 31, 31, 15, 37, 36, 19, 18, 31, 34, 18, 26, 27, 20, 30, 32, 33, 30, 31, 28, 27, 27, 33, 26, 29, 30, 26, 28, 25, 31, 24, 33, 31, 26, 31, 31, 34, 35, 30, 22, 25, 33, 23, 26, 20, 25, 25, 16, 29, 30], "Bar": [22, 35, 38, 37, 9, 72], "2Macc": [36, 32, 40, 50, 27, 31, 42, 36, 29, 38, 38, 46, 26, 46, 39] } }, nlt: { chapters: { "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21] } }, nrsv: { chapters: { "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 13], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21] } } }; bcv_parser.prototype.regexps.space = "[\\s\\xa0]"; bcv_parser.prototype.regexps.escaped_passage = RegExp("(?:^|[^\\x1f\\x1e\\dA-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:(?:ch(?:apters?|a?pts?\\.?|a?p?s?\\.?)?\\s*\\d+\\s*(?:[\\u2013\\u2014\\-]|through|thru|to)\\s*\\d+\\s*(?:from|of|in)(?:\\s+the\\s+book\\s+of)?\\s*)|(?:ch(?:apters?|a?pts?\\.?|a?p?s?\\.?)?\\s*\\d+\\s*(?:from|of|in)(?:\\s+the\\s+book\\s+of)?\\s*)|(?:\\d+(?:th|nd|st)\\s*ch(?:apter|a?pt\\.?|a?p?\\.?)?\\s*(?:from|of|in)(?:\\s+the\\s+book\\s+of)?\\s*))?\\x1f(\\d+)(?:/\\d+)?\\x1f(?:/\\d+\\x1f|[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014]|надписаниях(?![a-z])|и" + bcv_parser.prototype.regexps.space + "+далее|главы|стихи|глав|стих|гл|—|и|[аб](?!\\w)|$)+)", "gi"); bcv_parser.prototype.regexps.match_end_split = RegExp("\\d\\W*надписаниях|\\d\\W*и" + bcv_parser.prototype.regexps.space + "+далее(?:[\\s\\xa0*]*\\.)?|\\d[\\s\\xa0*]*[аб](?!\\w)|\\x1e(?:[\\s\\xa0*]*[)\\]\\uff09])?|[\\d\\x1f]", "gi"); bcv_parser.prototype.regexps.control = /[\x1e\x1f]/g; bcv_parser.prototype.regexps.pre_book = "[^A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ]"; bcv_parser.prototype.regexps.first = "(?:1-?я|1-?е|1)\\.?" + bcv_parser.prototype.regexps.space + "*"; bcv_parser.prototype.regexps.second = "(?:2-?я|2-?е|2)\\.?" + bcv_parser.prototype.regexps.space + "*"; bcv_parser.prototype.regexps.third = "(?:3-?я|3-?е|3)\\.?" + bcv_parser.prototype.regexps.space + "*"; bcv_parser.prototype.regexps.range_and = "(?:[&\u2013\u2014-]|и|—)"; bcv_parser.prototype.regexps.range_only = "(?:[\u2013\u2014-]|—)"; bcv_parser.prototype.regexps.get_books = function(include_apocrypha, case_sensitive) { var book, books, k, len, out; books = [ { osis: ["Ps"], apocrypha: true, extra: "2", regexp: /(\b)(Ps151)(?=\.1)/g }, { osis: ["Gen"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Бытия|Gen|Быт(?:ие)?|Нач(?:ало)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Exod"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Исход|Exod|Исх(?:од)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Bel"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Виле[\\s\\xa0]*и[\\s\\xa0]*драконе|Bel|Бел(?:[\\s\\xa0]*и[\\s\\xa0]*Дракон|е)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Lev"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Левит|Lev|Лев(?:ит)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Num"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Чисел|Num|Чис(?:ла)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Sir"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Премудрост(?:и[\\s\\xa0]*Иисуса,[\\s\\xa0]*сына[\\s\\xa0]*Сирахова|ь[\\s\\xa0]*Сираха)|Ekkleziastik|Sir|Сир(?:ахова)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Wis"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Прем(?:удрости[\\s\\xa0]*Соломона)?|Wis))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Lam"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Плач(?:[\\s\\xa0]*Иеремии)?|Lam))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["EpJer"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*Иеремии|EpJer))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Rev"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Rev|Отк(?:р(?:овение)?)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["PrMan"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Молитва[\\s\\xa0]*Манассии|PrMan))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Deut"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Deut|Втор(?:озаконие)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Josh"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Иисуса[\\s\\xa0]*Навина|Josh|И(?:исус(?:а[\\s\\xa0]*Навина|[\\s\\xa0]*Навин)|еш(?:уа)?)|Нав))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Judg"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Суде(?:[ий](?:[\\s\\xa0]*Израилевых)?)|Judg|Суд(?:е[ий]|ьи)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Ruth"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Руфи|Ruth|Ру(?:т|фь?)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["1Esd"], apocrypha: true, regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:2(?:-?(?:[ея](?:\.[\s\xa0]*Ездры|[\s\xa0]*Ездры))|\.[\s\xa0]*Ездры|(?:[ея](?:\.[\s\xa0]*Ездры|[\s\xa0]*Ездры))|[\s\xa0]*Езд(?:ры)?)|1Esd))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2Esd"], apocrypha: true, regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:3(?:-?(?:[ея](?:\.[\s\xa0]*Ездры|[\s\xa0]*Ездры))|\.[\s\xa0]*Ездры|(?:[ея](?:\.[\s\xa0]*Ездры|[\s\xa0]*Ездры))|[\s\xa0]*Езд(?:ры)?)|2Esd))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Isa"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Исаии|Isa|Ис(?:аи[ия]?)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Sam"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(2(?:-?(?:[ея](?:\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)))|\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)|(?:[ея](?:\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)))|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Цар(?:ств)?)|Sam))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Sam"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(1(?:-?(?:[ея](?:\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)))|\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)|(?:[ея](?:\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Царств)))|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Самуила|Цар(?:ств)?)|Sam))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2Kgs"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:4(?:-?(?:[ея](?:\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)))|\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)|(?:[ея](?:\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)))|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Цар(?:ств)?))|2(?:-?(?:[ея](?:\.[\s\xa0]*Царе[ий]|[\s\xa0]*Царе[ий]))|\.[\s\xa0]*Царе[ий]|(?:[ея](?:\.[\s\xa0]*Царе[ий]|[\s\xa0]*Царе[ий]))|[\s\xa0]*Царе[ий]|Kgs)))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Kgs"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:3(?:-?(?:[ея](?:\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)))|\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)|(?:[ея](?:\.[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Царств)))|[\s\xa0]*(?:Книга[\s\xa0]*Царств|Цар(?:ств)?))|1(?:-?(?:[ея](?:\.[\s\xa0]*Царе[ий]|[\s\xa0]*Царе[ий]))|\.[\s\xa0]*Царе[ий]|(?:[ея](?:\.[\s\xa0]*Царе[ий]|[\s\xa0]*Царе[ий]))|[\s\xa0]*Царе[ий]|Kgs)))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2Chr"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(2(?:-?(?:[ея](?:\.[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)|[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)))|\.[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)|(?:[ея](?:\.[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)|[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)))|[\s\xa0]*(?:Хроник|Лет(?:опись)?|Пар(?:алипоменон)?)|Chr))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Chr"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(1(?:-?(?:[ея](?:\.[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)|[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)))|\.[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)|(?:[ея](?:\.[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)|[\s\xa0]*(?:Паралипоменон|Летопись|Хроник)))|[\s\xa0]*(?:Хроник|Лет(?:опись)?|Пар(?:алипоменон)?)|Chr))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Ezra"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:Первая[\s\xa0]*Ездры|Книга[\s\xa0]*Ездры|1[\s\xa0]*Езд|Уза[ий]р|Ezra|Езд(?:р[аы])?))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Neh"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Неемии|Неем(?:и[ия])?|Neh))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["GkEsth"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Дополнения[\\s\\xa0]*к[\\s\\xa0]*Есфири|GkEsth))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Esth"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Есфири|Esth|Есф(?:ирь)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Job"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Иова|Job|Аюб|Иова?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Ps"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Заб(?:ур)?|Ps|Пс(?:ал(?:тирь|мы|ом)?)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["PrAzar"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Молитва[\\s\\xa0]*Азария|PrAzar))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Prov"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*притче[ий][\\s\\xa0]*Соломоновых|Prov|Мудр(?:ые[\\s\\xa0]*изречения)?|Пр(?:ит(?:чи)?)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Eccl"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*Екклесиаста|Eccl|Разм(?:ышления)?|Екк(?:лесиаст)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["SgThree"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Благодарственная[\\s\\xa0]*песнь[\\s\\xa0]*отроков|Молитва[\\s\\xa0]*святых[\\s\\xa0]*трех[\\s\\xa0]*отроков|Песнь[\\s\\xa0]*тр[её]х[\\s\\xa0]*отроков|SgThree))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Song"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Song|Песн(?:и[\\s\\xa0]*Песне[ий]|ь(?:[\\s\\xa0]*(?:песне[ий][\\s\\xa0]*Соломона|Суле[ий]мана))?)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Jer"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Иеремии|Jer|Иер(?:еми[ия])?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Ezek"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Иезекииля|Ezek|Езек(?:иил)?|Иез(?:екиил[ья])?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Dan"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Даниила|Dan|Д(?:ан(?:и(?:ила?|ял))?|он)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Hos"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Осии|Hos|Ос(?:и[ия])?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Joel"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Иоиля|Joel|Иоил[ья]?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Amos"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Амоса|Amos|Ам(?:оса?)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Obad"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Авдия|Obad|Авд(?:и[ийя])?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Jonah"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Ионы|Jonah|Ион[аы]|Юнус))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Mic"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Михея|Mic|Мих(?:е[ийя])?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Nah"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Наума|Наума?|Nah))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Hab"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Аввакума|Hab|Авв(?:акума?)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Zeph"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Софонии|Zeph|Соф(?:они[ия])?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Hag"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Аггея|Hag|Агг(?:е[ийя])?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Zech"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Захарии|Zech|За(?:к(?:ария)?|х(?:ари[ия])?)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Mal"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*пророка[\\s\\xa0]*Малахии|Mal|Мал(?:ахи[ия])?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Matt"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Евангелие[\\s\\xa0]*от[\\s\\xa0]*Матфея|От[\\s\\xa0]*Матфея|Matt|М(?:ат(?:а[ий])?|[тф])))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Mark"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Евангелие[\\s\\xa0]*от[\\s\\xa0]*Марка|От[\\s\\xa0]*Марка|Mark|М(?:арк|[кр])))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Luke"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Евангелие[\\s\\xa0]*от[\\s\\xa0]*Луки|От[\\s\\xa0]*Луки|Luke|Л(?:ука|к)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["1John"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(1(?:-?(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))))|\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))))|John|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|И(?:о(?:анна|хана)|н))))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2John"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(2(?:-?(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))))|\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))))|John|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|И(?:о(?:анна|хана)|н))))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["3John"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(3(?:-?(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))))|\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|Ио(?:анна|хана))))|John|[\s\xa0]*(?:послание[\s\xa0]*Иоанна|И(?:о(?:анна|хана)|н))))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["John"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Евангелие[\\s\\xa0]*от[\\s\\xa0]*Иоанна|От[\\s\\xa0]*Иоанна|John|И(?:охан|н)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Acts"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Acts|Деян(?:ия)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Rom"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*к[\\s\\xa0]*Римлянам|К[\\s\\xa0]*Римлянам|Rom|Рим(?:лянам)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Cor"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(2(?:-?(?:[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)|[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)))|\.[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)|(?:[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)|[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)))|[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Кор(?:инфянам)?)|Cor))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Cor"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(1(?:-?(?:[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)|[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)))|\.[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)|(?:[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)|[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Коринфянам)))|[\s\xa0]*(?:к[\s\xa0]*Коринфянам|Кор(?:инфянам)?)|Cor))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Gal"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*к[\\s\\xa0]*Галатам|К[\\s\\xa0]*Галатам|Gal|Гал(?:атам)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Eph"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*к[\\s\\xa0]*Ефесянам|К[\\s\\xa0]*Ефесянам|Eph|(?:[ЕЭ]ф(?:есянам)?)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Phil"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*к[\\s\\xa0]*Филиппи[ий]цам|К[\\s\\xa0]*Филиппи[ий]цам|Phil|Ф(?:ил(?:иппи[ий]цам)?|лп)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Col"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*к[\\s\\xa0]*Колоссянам|Col|К(?:[\\s\\xa0]*Колоссянам|ол(?:оссянам)?)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Thess"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(2(?:-?[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Фессалоники(?:[ий]цам|Фессалоники[ий]цам)|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам)))|\.[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам)|[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Фессалоники(?:[ий]цам|Фессалоники[ий]цам)|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам)))|Thess|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фес(?:салоники[ий]цам)?))|2(?:-?[ея](?:\.[\s\xa0]*Фессалоники(?:[ий]цам|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам)))|[ея](?:\.[\s\xa0]*Фессалоники(?:[ий]цам|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам))))|2(?:-?[ея][\s\xa0]*(?:к[\s\xa0]*Фессалоники(?:[ий]цам|Фессалоники[ий]цам))|[ея][\s\xa0]*(?:к[\s\xa0]*Фессалоники(?:[ий]цам|Фессалоники[ий]цам)))|2(?:-?[ея][\s\xa0]*Фессалоники(?:[ий]цам)|[ея][\s\xa0]*Фессалоники(?:[ий]цам)))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Thess"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(1(?:-?[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Фессалоники(?:[ий]цам|Фессалоники[ий]цам)|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам)))|\.[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам)|[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Фессалоники(?:[ий]цам|Фессалоники[ий]цам)|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам)))|Thess|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фес(?:салоники[ий]цам)?))|1(?:-?[ея](?:\.[\s\xa0]*Фессалоники(?:[ий]цам|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам)))|[ея](?:\.[\s\xa0]*Фессалоники(?:[ий]цам|[\s\xa0]*(?:к[\s\xa0]*Фессалоники[ий]цам|Фессалоники[ий]цам))))|1(?:-?[ея][\s\xa0]*(?:к[\s\xa0]*Фессалоники(?:[ий]цам|Фессалоники[ий]цам))|[ея][\s\xa0]*(?:к[\s\xa0]*Фессалоники(?:[ий]цам|Фессалоники[ий]цам)))|1(?:-?[ея][\s\xa0]*Фессалоники(?:[ий]цам)|[ея][\s\xa0]*Фессалоники(?:[ий]цам)))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2Tim"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(2(?:-?(?:[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))|[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))))|\.[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))|(?:[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))|[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))))|[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею)?)|Tim))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Tim"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(1(?:-?(?:[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))|[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))))|\.[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))|(?:[ея](?:\.[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))|[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею))))|[\s\xa0]*(?:к[\s\xa0]*Тимофею|Тим(?:етею|офею)?)|Tim))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Titus"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*к[\\s\\xa0]*Титу|К[\\s\\xa0]*Титу|Titus|Титу?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Phlm"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*к[\\s\\xa0]*Филимону|К[\\s\\xa0]*Филимону|Phlm|Ф(?:илимону|лм)))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Heb"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*к[\\s\\xa0]*Евреям|К[\\s\\xa0]*Евреям|Heb|Евр(?:еям)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Jas"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*Иакова|Якуб|Jas|Иак(?:ова)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Pet"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(2(?:-?(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))|[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))))|\.[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))|(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))|[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))))|[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра)?)|Pet))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Pet"], regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(1(?:-?(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))|[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))))|\.[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))|(?:[ея](?:\.[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))|[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра))))|[\s\xa0]*(?:послание[\s\xa0]*Петра|Пет(?:ира|ра)?)|Pet))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Jude"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Послание[\\s\\xa0]*Иуды|Jude|Иуд[аы]?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Tob"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Tob|Тов(?:ита)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Jdt"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Jdt|Юди(?:фь)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Bar"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Книга[\\s\\xa0]*(?:пророка[\\s\\xa0]*Вару́ха|Варуха)|Бару́ха|Bar|Вар(?:уха)?))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Sus"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:С(?:казанию[\\s\\xa0]*о[\\s\\xa0]*Сусанне[\\s\\xa0]*и[\\s\\xa0]*Данииле|усанна(?:[\\s\\xa0]*и[\\s\\xa0]*старцы)?)|Sus))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)()\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Macc"], apocrypha: true, regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:Вторая[\s\xa0]*книга[\s\xa0]*Маккаве[ий]ская|2(?:-?(?:[ея](?:\.[\s\xa0]*Маккавеев|[\s\xa0]*Маккавеев))|\.[\s\xa0]*Маккавеев|(?:[ея](?:\.[\s\xa0]*Маккавеев|[\s\xa0]*Маккавеев))|[\s\xa0]*Макк(?:авеев)?|Macc)))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["3Macc"], apocrypha: true, regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:Третья[\s\xa0]*книга[\s\xa0]*Маккаве[ий]ская|3(?:-?(?:[ея](?:\.[\s\xa0]*Маккавеев|[\s\xa0]*Маккавеев))|\.[\s\xa0]*Маккавеев|(?:[ея](?:\.[\s\xa0]*Маккавеев|[\s\xa0]*Маккавеев))|[\s\xa0]*Макк(?:авеев)?|Macc)))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["4Macc"], apocrypha: true, regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])(4(?:-?(?:[ея](?:\.[\s\xa0]*Маккавеев|[\s\xa0]*Маккавеев))|\.[\s\xa0]*Маккавеев|(?:[ея](?:\.[\s\xa0]*Маккавеев|[\s\xa0]*Маккавеев))|[\s\xa0]*Макк(?:авеев)?|Macc))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Macc"], apocrypha: true, regexp: /(^|[^0-9A-Za-zЀ-ҁ҃-҇Ҋ-ԧⷠ-ⷿꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ])((?:Первая[\s\xa0]*книга[\s\xa0]*Маккаве[ий]ская|1(?:-?(?:[ея](?:\.[\s\xa0]*Маккавеев|[\s\xa0]*Маккавеев))|\.[\s\xa0]*Маккавеев|(?:[ея](?:\.[\s\xa0]*Маккавеев|[\s\xa0]*Маккавеев))|[\s\xa0]*Макк(?:авеев)?|Macc)))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)()\[\]\/"'\*=~\-\u2013\u2014])|$)/gi } ]; if (include_apocrypha === true && case_sensitive === "none") { return books; } out = []; for (k = 0, len = books.length; k < len; k++) { book = books[k]; if (include_apocrypha === false && (book.apocrypha != null) && book.apocrypha === true) { continue; } if (case_sensitive === "books") { book.regexp = new RegExp(book.regexp.source, "g"); } out.push(book); } return out; }; bcv_parser.prototype.regexps.books = bcv_parser.prototype.regexps.get_books(false, "none"); var grammar = (function() { /* * Generated by PEG.js 0.8.0. * * http://pegjs.majda.cz/ */ function peg$subclass(child, parent) { function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); } function SyntaxError(message, expected, found, offset, line, column) { this.message = message; this.expected = expected; this.found = found; this.offset = offset; this.line = line; this.column = column; this.name = "SyntaxError"; } peg$subclass(SyntaxError, Error); function parse(input) { var options = arguments.length > 1 ? arguments[1] : {}, peg$FAILED = {}, peg$startRuleFunctions = { start: peg$parsestart }, peg$startRuleFunction = peg$parsestart, peg$c0 = [], peg$c1 = peg$FAILED, peg$c2 = null, peg$c3 = function(val_1, val_2) { val_2.unshift([val_1]); return {"type": "sequence", "value": val_2, "indices": [offset(), peg$currPos - 1]} }, peg$c4 = "(", peg$c5 = { type: "literal", value: "(", description: "\"(\"" }, peg$c6 = ")", peg$c7 = { type: "literal", value: ")", description: "\")\"" }, peg$c8 = function(val_1, val_2) { if (typeof(val_2) === "undefined") val_2 = []; val_2.unshift([val_1]); return {"type": "sequence_post_enclosed", "value": val_2, "indices": [offset(), peg$currPos - 1]} }, peg$c9 = void 0, peg$c10 = function(val_1, val_2) { if (val_1.length && val_1.length === 2) val_1 = val_1[0]; // for `b`, which returns [object, undefined] return {"type": "range", "value": [val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c11 = "\x1F", peg$c12 = { type: "literal", value: "\x1F", description: "\"\\x1F\"" }, peg$c13 = "/", peg$c14 = { type: "literal", value: "/", description: "\"/\"" }, peg$c15 = /^[1-8]/, peg$c16 = { type: "class", value: "[1-8]", description: "[1-8]" }, peg$c17 = function(val) { return {"type": "b", "value": val.value, "indices": [offset(), peg$currPos - 1]} }, peg$c18 = function(val_1, val_2) { return {"type": "bc", "value": [val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c19 = ",", peg$c20 = { type: "literal", value: ",", description: "\",\"" }, peg$c21 = function(val_1, val_2) { return {"type": "bc_title", "value": [val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c22 = ".", peg$c23 = { type: "literal", value: ".", description: "\".\"" }, peg$c24 = function(val_1, val_2) { return {"type": "bcv", "value": [val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c25 = "-", peg$c26 = { type: "literal", value: "-", description: "\"-\"" }, peg$c27 = function(val_1, val_2, val_3, val_4) { return {"type": "range", "value": [{"type": "bcv", "value": [{"type": "bc", "value": [val_1, val_2], "indices": [val_1.indices[0], val_2.indices[1]]}, val_3], "indices": [val_1.indices[0], val_3.indices[1]]}, val_4], "indices": [offset(), peg$currPos - 1]} }, peg$c28 = function(val_1, val_2) { return {"type": "bv", "value": [val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c29 = function(val_1, val_2) { return {"type": "bc", "value": [val_2, val_1], "indices": [offset(), peg$currPos - 1]} }, peg$c30 = function(val_1, val_2, val_3) { return {"type": "cb_range", "value": [val_3, val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c31 = "th", peg$c32 = { type: "literal", value: "th", description: "\"th\"" }, peg$c33 = "nd", peg$c34 = { type: "literal", value: "nd", description: "\"nd\"" }, peg$c35 = "st", peg$c36 = { type: "literal", value: "st", description: "\"st\"" }, peg$c37 = "/1\x1F", peg$c38 = { type: "literal", value: "/1\x1F", description: "\"/1\\x1F\"" }, peg$c39 = function(val) { return {"type": "c_psalm", "value": val.value, "indices": [offset(), peg$currPos - 1]} }, peg$c40 = function(val_1, val_2) { return {"type": "cv_psalm", "value": [val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c41 = function(val_1, val_2) { return {"type": "c_title", "value": [val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c42 = function(val_1, val_2) { return {"type": "cv", "value": [val_1, val_2], "indices": [offset(), peg$currPos - 1]} }, peg$c43 = function(val) { return {"type": "c", "value": [val], "indices": [offset(), peg$currPos - 1]} }, peg$c44 = "\u0438", peg$c45 = { type: "literal", value: "\u0438", description: "\"\\u0438\"" }, peg$c46 = "\u0434\u0430\u043B\u0435\u0435", peg$c47 = { type: "literal", value: "\u0434\u0430\u043B\u0435\u0435", description: "\"\\u0434\\u0430\\u043B\\u0435\\u0435\"" }, peg$c48 = /^[a-z]/, peg$c49 = { type: "class", value: "[a-z]", description: "[a-z]" }, peg$c50 = function(val_1) { return {"type": "ff", "value": [val_1], "indices": [offset(), peg$currPos - 1]} }, peg$c51 = "\u043D\u0430\u0434\u043F\u0438\u0441\u0430\u043D\u0438\u044F\u0445", peg$c52 = { type: "literal", value: "\u043D\u0430\u0434\u043F\u0438\u0441\u0430\u043D\u0438\u044F\u0445", description: "\"\\u043D\\u0430\\u0434\\u043F\\u0438\\u0441\\u0430\\u043D\\u0438\\u044F\\u0445\"" }, peg$c53 = function(val_1) { return {"type": "integer_title", "value": [val_1], "indices": [offset(), peg$currPos - 1]} }, peg$c54 = "/9\x1F", peg$c55 = { type: "literal", value: "/9\x1F", description: "\"/9\\x1F\"" }, peg$c56 = function(val) { return {"type": "context", "value": val.value, "indices": [offset(), peg$currPos - 1]} }, peg$c57 = "/2\x1F", peg$c58 = { type: "literal", value: "/2\x1F", description: "\"/2\\x1F\"" }, peg$c59 = ".1", peg$c60 = { type: "literal", value: ".1", description: "\".1\"" }, peg$c61 = /^[0-9]/, peg$c62 = { type: "class", value: "[0-9]", description: "[0-9]" }, peg$c63 = function(val) { return {"type": "bc", "value": [val, {"type": "c", "value": [{"type": "integer", "value": 151, "indices": [peg$currPos - 2, peg$currPos - 1]}], "indices": [peg$currPos - 2, peg$currPos - 1]}], "indices": [offset(), peg$currPos - 1]} }, peg$c64 = function(val_1, val_2) { return {"type": "bcv", "value": [val_1, {"type": "v", "value": [val_2], "indices": [val_2.indices[0], val_2.indices[1]]}], "indices": [offset(), peg$currPos - 1]} }, peg$c65 = /^[\u0430\u0431]/i, peg$c66 = { type: "class", value: "[\\u0430\\u0431]i", description: "[\\u0430\\u0431]i" }, peg$c67 = function(val) { return {"type": "v", "value": [val], "indices": [offset(), peg$currPos - 1]} }, peg$c68 = "\u0433\u043B", peg$c69 = { type: "literal", value: "\u0433\u043B", description: "\"\\u0433\\u043B\"" }, peg$c70 = "\u0430\u0432\u044B", peg$c71 = { type: "literal", value: "\u0430\u0432\u044B", description: "\"\\u0430\\u0432\\u044B\"" }, peg$c72 = "\u0430\u0432", peg$c73 = { type: "literal", value: "\u0430\u0432", description: "\"\\u0430\\u0432\"" }, peg$c74 = "", peg$c75 = function() { return {"type": "c_explicit"} }, peg$c76 = "\u0441\u0442\u0438\u0445", peg$c77 = { type: "literal", value: "\u0441\u0442\u0438\u0445", description: "\"\\u0441\\u0442\\u0438\\u0445\"" }, peg$c78 = function() { return {"type": "v_explicit"} }, peg$c79 = /^["']/, peg$c80 = { type: "class", value: "[\"']", description: "[\"']" }, peg$c81 = /^[;\/:&\-\u2013\u2014~]/, peg$c82 = { type: "class", value: "[;\\/:&\\-\\u2013\\u2014~]", description: "[;\\/:&\\-\\u2013\\u2014~]" }, peg$c83 = function() { return "" }, peg$c84 = /^[\-\u2013\u2014]/, peg$c85 = { type: "class", value: "[\\-\\u2013\\u2014]", description: "[\\-\\u2013\\u2014]" }, peg$c86 = "\u2014", peg$c87 = { type: "literal", value: "\u2014", description: "\"\\u2014\"" }, peg$c88 = function(val) { return {type:"title", value: [val], "indices": [offset(), peg$currPos - 1]} }, peg$c89 = "from", peg$c90 = { type: "literal", value: "from", description: "\"from\"" }, peg$c91 = "of", peg$c92 = { type: "literal", value: "of", description: "\"of\"" }, peg$c93 = "in", peg$c94 = { type: "literal", value: "in", description: "\"in\"" }, peg$c95 = "the", peg$c96 = { type: "literal", value: "the", description: "\"the\"" }, peg$c97 = "book", peg$c98 = { type: "literal", value: "book", description: "\"book\"" }, peg$c99 = /^[([]/, peg$c100 = { type: "class", value: "[([]", description: "[([]" }, peg$c101 = /^[)\]]/, peg$c102 = { type: "class", value: "[)\\]]", description: "[)\\]]" }, peg$c103 = function(val) { return {"type": "translation_sequence", "value": val, "indices": [offset(), peg$currPos - 1]} }, peg$c104 = "\x1E", peg$c105 = { type: "literal", value: "\x1E", description: "\"\\x1E\"" }, peg$c106 = function(val) { return {"type": "translation", "value": val.value, "indices": [offset(), peg$currPos - 1]} }, peg$c107 = ",000", peg$c108 = { type: "literal", value: ",000", description: "\",000\"" }, peg$c109 = function(val) { return {"type": "integer", "value": parseInt(val.join(""), 10), "indices": [offset(), peg$currPos - 1]} }, peg$c110 = /^[^\x1F\x1E([]/, peg$c111 = { type: "class", value: "[^\\x1F\\x1E([]", description: "[^\\x1F\\x1E([]" }, peg$c112 = function(val) { return {"type": "word", "value": val.join(""), "indices": [offset(), peg$currPos - 1]} }, peg$c113 = function(val) { return {"type": "stop", "value": val, "indices": [offset(), peg$currPos - 1]} }, peg$c114 = /^[\s\xa0*]/, peg$c115 = { type: "class", value: "[\\s\\xa0*]", description: "[\\s\\xa0*]" }, peg$currPos = 0, peg$reportedPos = 0, peg$cachedPos = 0, peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result; if ("startRule" in options) { if (!(options.startRule in peg$startRuleFunctions)) { throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; } function text() { return input.substring(peg$reportedPos, peg$currPos); } function offset() { return peg$reportedPos; } function line() { return peg$computePosDetails(peg$reportedPos).line; } function column() { return peg$computePosDetails(peg$reportedPos).column; } function expected(description) { throw peg$buildException( null, [{ type: "other", description: description }], peg$reportedPos ); } function error(message) { throw peg$buildException(message, null, peg$reportedPos); } function peg$computePosDetails(pos) { function advance(details, startPos, endPos) { var p, ch; for (p = startPos; p < endPos; p++) { ch = input.charAt(p); if (ch === "\n") { if (!details.seenCR) { details.line++; } details.column = 1; details.seenCR = false; } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { details.line++; details.column = 1; details.seenCR = true; } else { details.column++; details.seenCR = false; } } } if (peg$cachedPos !== pos) { if (peg$cachedPos > pos) { peg$cachedPos = 0; peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; } advance(peg$cachedPosDetails, peg$cachedPos, pos); peg$cachedPos = pos; } return peg$cachedPosDetails; } function peg$fail(expected) { if (peg$currPos < peg$maxFailPos) { return; } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; peg$maxFailExpected = []; } peg$maxFailExpected.push(expected); } function peg$buildException(message, expected, pos) { function cleanupExpected(expected) { var i = 1; expected.sort(function(a, b) { if (a.description < b.description) { return -1; } else if (a.description > b.description) { return 1; } else { return 0; } }); while (i < expected.length) { if (expected[i - 1] === expected[i]) { expected.splice(i, 1); } else { i++; } } } function buildMessage(expected, found) { function stringEscape(s) { function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } return s .replace(/\\/g, '\\\\') .replace(/"/g, '\\"') .replace(/\x08/g, '\\b') .replace(/\t/g, '\\t') .replace(/\n/g, '\\n') .replace(/\f/g, '\\f') .replace(/\r/g, '\\r') .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); } var expectedDescs = new Array(expected.length), expectedDesc, foundDesc, i; for (i = 0; i < expected.length; i++) { expectedDescs[i] = expected[i].description; } expectedDesc = expected.length > 1 ? expectedDescs.slice(0, -1).join(", ") + " or " + expectedDescs[expected.length - 1] : expectedDescs[0]; foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; return "Expected " + expectedDesc + " but " + foundDesc + " found."; } var posDetails = peg$computePosDetails(pos), found = pos < input.length ? input.charAt(pos) : null; if (expected !== null) { cleanupExpected(expected); } return new SyntaxError( message !== null ? message : buildMessage(expected, found), expected, found, pos, posDetails.line, posDetails.column ); } function peg$parsestart() { var s0, s1; s0 = []; s1 = peg$parsebcv_hyphen_range(); if (s1 === peg$FAILED) { s1 = peg$parsesequence(); if (s1 === peg$FAILED) { s1 = peg$parsecb_range(); if (s1 === peg$FAILED) { s1 = peg$parserange(); if (s1 === peg$FAILED) { s1 = peg$parseff(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_comma(); if (s1 === peg$FAILED) { s1 = peg$parsebc_title(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsecv_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$parsec_psalm(); if (s1 === peg$FAILED) { s1 = peg$parseb(); if (s1 === peg$FAILED) { s1 = peg$parsecbv(); if (s1 === peg$FAILED) { s1 = peg$parsecbv_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsecb(); if (s1 === peg$FAILED) { s1 = peg$parsecb_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsetranslation_sequence_enclosed(); if (s1 === peg$FAILED) { s1 = peg$parsetranslation_sequence(); if (s1 === peg$FAILED) { s1 = peg$parsesequence_sep(); if (s1 === peg$FAILED) { s1 = peg$parsec_title(); if (s1 === peg$FAILED) { s1 = peg$parseinteger_title(); if (s1 === peg$FAILED) { s1 = peg$parsecv(); if (s1 === peg$FAILED) { s1 = peg$parsecv_weak(); if (s1 === peg$FAILED) { s1 = peg$parsev_letter(); if (s1 === peg$FAILED) { s1 = peg$parseinteger(); if (s1 === peg$FAILED) { s1 = peg$parsec(); if (s1 === peg$FAILED) { s1 = peg$parsev(); if (s1 === peg$FAILED) { s1 = peg$parseword(); if (s1 === peg$FAILED) { s1 = peg$parseword_parenthesis(); if (s1 === peg$FAILED) { s1 = peg$parsecontext(); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } if (s1 !== peg$FAILED) { while (s1 !== peg$FAILED) { s0.push(s1); s1 = peg$parsebcv_hyphen_range(); if (s1 === peg$FAILED) { s1 = peg$parsesequence(); if (s1 === peg$FAILED) { s1 = peg$parsecb_range(); if (s1 === peg$FAILED) { s1 = peg$parserange(); if (s1 === peg$FAILED) { s1 = peg$parseff(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_comma(); if (s1 === peg$FAILED) { s1 = peg$parsebc_title(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsecv_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$parsec_psalm(); if (s1 === peg$FAILED) { s1 = peg$parseb(); if (s1 === peg$FAILED) { s1 = peg$parsecbv(); if (s1 === peg$FAILED) { s1 = peg$parsecbv_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsecb(); if (s1 === peg$FAILED) { s1 = peg$parsecb_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsetranslation_sequence_enclosed(); if (s1 === peg$FAILED) { s1 = peg$parsetranslation_sequence(); if (s1 === peg$FAILED) { s1 = peg$parsesequence_sep(); if (s1 === peg$FAILED) { s1 = peg$parsec_title(); if (s1 === peg$FAILED) { s1 = peg$parseinteger_title(); if (s1 === peg$FAILED) { s1 = peg$parsecv(); if (s1 === peg$FAILED) { s1 = peg$parsecv_weak(); if (s1 === peg$FAILED) { s1 = peg$parsev_letter(); if (s1 === peg$FAILED) { s1 = peg$parseinteger(); if (s1 === peg$FAILED) { s1 = peg$parsec(); if (s1 === peg$FAILED) { s1 = peg$parsev(); if (s1 === peg$FAILED) { s1 = peg$parseword(); if (s1 === peg$FAILED) { s1 = peg$parseword_parenthesis(); if (s1 === peg$FAILED) { s1 = peg$parsecontext(); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } else { s0 = peg$c1; } return s0; } function peg$parsesequence() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsecb_range(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_hyphen_range(); if (s1 === peg$FAILED) { s1 = peg$parserange(); if (s1 === peg$FAILED) { s1 = peg$parseff(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_comma(); if (s1 === peg$FAILED) { s1 = peg$parsebc_title(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsecv_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$parsec_psalm(); if (s1 === peg$FAILED) { s1 = peg$parseb(); if (s1 === peg$FAILED) { s1 = peg$parsecbv(); if (s1 === peg$FAILED) { s1 = peg$parsecbv_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsecb(); if (s1 === peg$FAILED) { s1 = peg$parsecb_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsecontext(); } } } } } } } } } } } } } } } } } } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$parsesequence_sep(); if (s4 === peg$FAILED) { s4 = peg$c2; } if (s4 !== peg$FAILED) { s5 = peg$parsesequence_post(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; s4 = peg$parsesequence_sep(); if (s4 === peg$FAILED) { s4 = peg$c2; } if (s4 !== peg$FAILED) { s5 = peg$parsesequence_post(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } } } else { s2 = peg$c1; } if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c3(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsesequence_post_enclosed() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { s1 = peg$c4; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s1 !== peg$FAILED) { s2 = peg$parsesp(); if (s2 !== peg$FAILED) { s3 = peg$parsesequence_sep(); if (s3 === peg$FAILED) { s3 = peg$c2; } if (s3 !== peg$FAILED) { s4 = peg$parsesequence_post(); if (s4 !== peg$FAILED) { s5 = []; s6 = peg$currPos; s7 = peg$parsesequence_sep(); if (s7 === peg$FAILED) { s7 = peg$c2; } if (s7 !== peg$FAILED) { s8 = peg$parsesequence_post(); if (s8 !== peg$FAILED) { s7 = [s7, s8]; s6 = s7; } else { peg$currPos = s6; s6 = peg$c1; } } else { peg$currPos = s6; s6 = peg$c1; } while (s6 !== peg$FAILED) { s5.push(s6); s6 = peg$currPos; s7 = peg$parsesequence_sep(); if (s7 === peg$FAILED) { s7 = peg$c2; } if (s7 !== peg$FAILED) { s8 = peg$parsesequence_post(); if (s8 !== peg$FAILED) { s7 = [s7, s8]; s6 = s7; } else { peg$currPos = s6; s6 = peg$c1; } } else { peg$currPos = s6; s6 = peg$c1; } } if (s5 !== peg$FAILED) { s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { s7 = peg$c6; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c7); } } if (s7 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c8(s4, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsesequence_post() { var s0; s0 = peg$parsesequence_post_enclosed(); if (s0 === peg$FAILED) { s0 = peg$parsecb_range(); if (s0 === peg$FAILED) { s0 = peg$parsebcv_hyphen_range(); if (s0 === peg$FAILED) { s0 = peg$parserange(); if (s0 === peg$FAILED) { s0 = peg$parseff(); if (s0 === peg$FAILED) { s0 = peg$parsebcv_comma(); if (s0 === peg$FAILED) { s0 = peg$parsebc_title(); if (s0 === peg$FAILED) { s0 = peg$parseps151_bcv(); if (s0 === peg$FAILED) { s0 = peg$parsebcv(); if (s0 === peg$FAILED) { s0 = peg$parsebcv_weak(); if (s0 === peg$FAILED) { s0 = peg$parseps151_bc(); if (s0 === peg$FAILED) { s0 = peg$parsebc(); if (s0 === peg$FAILED) { s0 = peg$parsecv_psalm(); if (s0 === peg$FAILED) { s0 = peg$parsebv(); if (s0 === peg$FAILED) { s0 = peg$parsec_psalm(); if (s0 === peg$FAILED) { s0 = peg$parseb(); if (s0 === peg$FAILED) { s0 = peg$parsecbv(); if (s0 === peg$FAILED) { s0 = peg$parsecbv_ordinal(); if (s0 === peg$FAILED) { s0 = peg$parsecb(); if (s0 === peg$FAILED) { s0 = peg$parsecb_ordinal(); if (s0 === peg$FAILED) { s0 = peg$parsec_title(); if (s0 === peg$FAILED) { s0 = peg$parseinteger_title(); if (s0 === peg$FAILED) { s0 = peg$parsecv(); if (s0 === peg$FAILED) { s0 = peg$parsecv_weak(); if (s0 === peg$FAILED) { s0 = peg$parsev_letter(); if (s0 === peg$FAILED) { s0 = peg$parseinteger(); if (s0 === peg$FAILED) { s0 = peg$parsec(); if (s0 === peg$FAILED) { s0 = peg$parsev(); } } } } } } } } } } } } } } } } } } } } } } } } } } } return s0; } function peg$parserange() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsebcv_comma(); if (s1 === peg$FAILED) { s1 = peg$parsebc_title(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsecv_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$currPos; s2 = peg$parseb(); if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; s4 = peg$currPos; s5 = peg$parserange_sep(); if (s5 !== peg$FAILED) { s6 = peg$parsebcv_comma(); if (s6 === peg$FAILED) { s6 = peg$parsebc_title(); if (s6 === peg$FAILED) { s6 = peg$parseps151_bcv(); if (s6 === peg$FAILED) { s6 = peg$parsebcv(); if (s6 === peg$FAILED) { s6 = peg$parsebcv_weak(); if (s6 === peg$FAILED) { s6 = peg$parseps151_bc(); if (s6 === peg$FAILED) { s6 = peg$parsebc(); if (s6 === peg$FAILED) { s6 = peg$parsebv(); if (s6 === peg$FAILED) { s6 = peg$parseb(); } } } } } } } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } peg$silentFails--; if (s4 !== peg$FAILED) { peg$currPos = s3; s3 = peg$c9; } else { s3 = peg$c1; } if (s3 !== peg$FAILED) { s2 = [s2, s3]; s1 = s2; } else { peg$currPos = s1; s1 = peg$c1; } } else { peg$currPos = s1; s1 = peg$c1; } if (s1 === peg$FAILED) { s1 = peg$parsecbv(); if (s1 === peg$FAILED) { s1 = peg$parsecbv_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsec_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsecb(); if (s1 === peg$FAILED) { s1 = peg$parsecb_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsec_title(); if (s1 === peg$FAILED) { s1 = peg$parseinteger_title(); if (s1 === peg$FAILED) { s1 = peg$parsecv(); if (s1 === peg$FAILED) { s1 = peg$parsecv_weak(); if (s1 === peg$FAILED) { s1 = peg$parsev_letter(); if (s1 === peg$FAILED) { s1 = peg$parseinteger(); if (s1 === peg$FAILED) { s1 = peg$parsec(); if (s1 === peg$FAILED) { s1 = peg$parsev(); } } } } } } } } } } } } } } } } } } } } } } if (s1 !== peg$FAILED) { s2 = peg$parserange_sep(); if (s2 !== peg$FAILED) { s3 = peg$parseff(); if (s3 === peg$FAILED) { s3 = peg$parsebcv_comma(); if (s3 === peg$FAILED) { s3 = peg$parsebc_title(); if (s3 === peg$FAILED) { s3 = peg$parseps151_bcv(); if (s3 === peg$FAILED) { s3 = peg$parsebcv(); if (s3 === peg$FAILED) { s3 = peg$parsebcv_weak(); if (s3 === peg$FAILED) { s3 = peg$parseps151_bc(); if (s3 === peg$FAILED) { s3 = peg$parsebc(); if (s3 === peg$FAILED) { s3 = peg$parsecv_psalm(); if (s3 === peg$FAILED) { s3 = peg$parsebv(); if (s3 === peg$FAILED) { s3 = peg$parseb(); if (s3 === peg$FAILED) { s3 = peg$parsecbv(); if (s3 === peg$FAILED) { s3 = peg$parsecbv_ordinal(); if (s3 === peg$FAILED) { s3 = peg$parsec_psalm(); if (s3 === peg$FAILED) { s3 = peg$parsecb(); if (s3 === peg$FAILED) { s3 = peg$parsecb_ordinal(); if (s3 === peg$FAILED) { s3 = peg$parsec_title(); if (s3 === peg$FAILED) { s3 = peg$parseinteger_title(); if (s3 === peg$FAILED) { s3 = peg$parsecv(); if (s3 === peg$FAILED) { s3 = peg$parsev_letter(); if (s3 === peg$FAILED) { s3 = peg$parseinteger(); if (s3 === peg$FAILED) { s3 = peg$parsecv_weak(); if (s3 === peg$FAILED) { s3 = peg$parsec(); if (s3 === peg$FAILED) { s3 = peg$parsev(); } } } } } } } } } } } } } } } } } } } } } } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c10(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parseb() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 31) { s1 = peg$c11; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 47) { s4 = peg$c13; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } if (s4 !== peg$FAILED) { if (peg$c15.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } if (s3 === peg$FAILED) { s3 = peg$c2; } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 31) { s4 = peg$c11; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c17(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsebc() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parseb(); if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$parsev_explicit(); if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsec(); if (s6 !== peg$FAILED) { s7 = peg$parsecv_sep(); if (s7 !== peg$FAILED) { s8 = peg$parsev(); if (s8 !== peg$FAILED) { s6 = [s6, s7, s8]; s5 = s6; } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } peg$silentFails--; if (s5 !== peg$FAILED) { peg$currPos = s4; s4 = peg$c9; } else { s4 = peg$c1; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c1; } } else { peg$currPos = s2; s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parsecv_sep(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecv_sep(); } } else { s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parsecv_sep_weak(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecv_sep_weak(); } } else { s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parserange_sep(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parserange_sep(); } } else { s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = peg$parsesp(); } } } } if (s2 !== peg$FAILED) { s3 = peg$parsec(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c18(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsebc_comma() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseb(); if (s1 !== peg$FAILED) { s2 = peg$parsesp(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s3 = peg$c19; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s3 !== peg$FAILED) { s4 = peg$parsesp(); if (s4 !== peg$FAILED) { s5 = peg$parsec(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c18(s1, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsebc_title() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); } if (s1 !== peg$FAILED) { s2 = peg$parsetitle(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c21(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsebcv() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); } if (s1 !== peg$FAILED) { s2 = peg$currPos; peg$silentFails++; s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s4 = peg$c22; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s4 !== peg$FAILED) { s5 = peg$parsev_explicit(); if (s5 !== peg$FAILED) { s6 = peg$parsev(); if (s6 !== peg$FAILED) { s4 = [s4, s5, s6]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$parsesequence_sep(); if (s4 === peg$FAILED) { s4 = peg$c2; } if (s4 !== peg$FAILED) { s5 = peg$parsev_explicit(); if (s5 !== peg$FAILED) { s6 = peg$parsecv(); if (s6 !== peg$FAILED) { s4 = [s4, s5, s6]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } } peg$silentFails--; if (s3 === peg$FAILED) { s2 = peg$c9; } else { peg$currPos = s2; s2 = peg$c1; } if (s2 !== peg$FAILED) { s3 = peg$currPos; s4 = peg$parsecv_sep(); if (s4 === peg$FAILED) { s4 = peg$parsesequence_sep(); } if (s4 === peg$FAILED) { s4 = peg$c2; } if (s4 !== peg$FAILED) { s5 = peg$parsev_explicit(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } if (s3 === peg$FAILED) { s3 = peg$parsecv_sep(); } if (s3 !== peg$FAILED) { s4 = peg$parsev_letter(); if (s4 === peg$FAILED) { s4 = peg$parsev(); } if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c24(s1, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsebcv_weak() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); } if (s1 !== peg$FAILED) { s2 = peg$parsecv_sep_weak(); if (s2 !== peg$FAILED) { s3 = peg$parsev_letter(); if (s3 === peg$FAILED) { s3 = peg$parsev(); } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsecv_sep(); if (s6 !== peg$FAILED) { s7 = peg$parsev(); if (s7 !== peg$FAILED) { s6 = [s6, s7]; s5 = s6; } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c9; } else { peg$currPos = s4; s4 = peg$c1; } if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c24(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsebcv_comma() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsebc_comma(); if (s1 !== peg$FAILED) { s2 = peg$parsesp(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s3 = peg$c19; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s3 !== peg$FAILED) { s4 = peg$parsesp(); if (s4 !== peg$FAILED) { s5 = peg$parsev_letter(); if (s5 === peg$FAILED) { s5 = peg$parsev(); } if (s5 !== peg$FAILED) { s6 = peg$currPos; peg$silentFails++; s7 = peg$currPos; s8 = peg$parsecv_sep(); if (s8 !== peg$FAILED) { s9 = peg$parsev(); if (s9 !== peg$FAILED) { s8 = [s8, s9]; s7 = s8; } else { peg$currPos = s7; s7 = peg$c1; } } else { peg$currPos = s7; s7 = peg$c1; } peg$silentFails--; if (s7 === peg$FAILED) { s6 = peg$c9; } else { peg$currPos = s6; s6 = peg$c1; } if (s6 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c24(s1, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsebcv_hyphen_range() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parseb(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c25; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s2 === peg$FAILED) { s2 = peg$parsespace(); } if (s2 === peg$FAILED) { s2 = peg$c2; } if (s2 !== peg$FAILED) { s3 = peg$parsec(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s4 = peg$c25; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s4 !== peg$FAILED) { s5 = peg$parsev(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s6 = peg$c25; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s6 !== peg$FAILED) { s7 = peg$parsev(); if (s7 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c27(s1, s3, s5, s7); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsebv() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseb(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parsecv_sep(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecv_sep(); } } else { s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parsecv_sep_weak(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecv_sep_weak(); } } else { s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parserange_sep(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parserange_sep(); } } else { s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = peg$currPos; s3 = []; s4 = peg$parsesequence_sep(); if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parsesequence_sep(); } } else { s3 = peg$c1; } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$parsev_explicit(); peg$silentFails--; if (s5 !== peg$FAILED) { peg$currPos = s4; s4 = peg$c9; } else { s4 = peg$c1; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c1; } } else { peg$currPos = s2; s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = peg$parsesp(); } } } } if (s2 !== peg$FAILED) { s3 = peg$parsev_letter(); if (s3 === peg$FAILED) { s3 = peg$parsev(); } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c28(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecb() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsec_explicit(); if (s1 !== peg$FAILED) { s2 = peg$parsec(); if (s2 !== peg$FAILED) { s3 = peg$parsein_book_of(); if (s3 === peg$FAILED) { s3 = peg$c2; } if (s3 !== peg$FAILED) { s4 = peg$parseb(); if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c29(s2, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecb_range() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsec_explicit(); if (s1 !== peg$FAILED) { s2 = peg$parsec(); if (s2 !== peg$FAILED) { s3 = peg$parserange_sep(); if (s3 !== peg$FAILED) { s4 = peg$parsec(); if (s4 !== peg$FAILED) { s5 = peg$parsein_book_of(); if (s5 === peg$FAILED) { s5 = peg$c2; } if (s5 !== peg$FAILED) { s6 = peg$parseb(); if (s6 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c30(s2, s4, s6); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecbv() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsecb(); if (s1 !== peg$FAILED) { s2 = peg$parsesequence_sep(); if (s2 === peg$FAILED) { s2 = peg$c2; } if (s2 !== peg$FAILED) { s3 = peg$parsev_explicit(); if (s3 !== peg$FAILED) { s4 = peg$parsev(); if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c24(s1, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecb_ordinal() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsec(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c31) { s2 = peg$c31; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c32); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c33) { s2 = peg$c33; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c35) { s2 = peg$c35; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c36); } } } } if (s2 !== peg$FAILED) { s3 = peg$parsec_explicit(); if (s3 !== peg$FAILED) { s4 = peg$parsein_book_of(); if (s4 === peg$FAILED) { s4 = peg$c2; } if (s4 !== peg$FAILED) { s5 = peg$parseb(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c29(s1, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecbv_ordinal() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsecb_ordinal(); if (s1 !== peg$FAILED) { s2 = peg$parsesequence_sep(); if (s2 === peg$FAILED) { s2 = peg$c2; } if (s2 !== peg$FAILED) { s3 = peg$parsev_explicit(); if (s3 !== peg$FAILED) { s4 = peg$parsev(); if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c24(s1, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsec_psalm() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 31) { s1 = peg$c11; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c37) { s3 = peg$c37; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c39(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecv_psalm() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsec_psalm(); if (s1 !== peg$FAILED) { s2 = peg$parsesequence_sep(); if (s2 === peg$FAILED) { s2 = peg$c2; } if (s2 !== peg$FAILED) { s3 = peg$parsev_explicit(); if (s3 !== peg$FAILED) { s4 = peg$parsev(); if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c40(s1, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsec_title() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsec_explicit(); if (s1 !== peg$FAILED) { s2 = peg$parsec(); if (s2 !== peg$FAILED) { s3 = peg$parsetitle(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c41(s2, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecv() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parsev_explicit(); if (s1 === peg$FAILED) { s1 = peg$c2; } if (s1 !== peg$FAILED) { s2 = peg$parsec(); if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; s4 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s5 = peg$c22; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s5 !== peg$FAILED) { s6 = peg$parsev_explicit(); if (s6 !== peg$FAILED) { s7 = peg$parsev(); if (s7 !== peg$FAILED) { s5 = [s5, s6, s7]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } peg$silentFails--; if (s4 === peg$FAILED) { s3 = peg$c9; } else { peg$currPos = s3; s3 = peg$c1; } if (s3 !== peg$FAILED) { s4 = peg$currPos; s5 = peg$parsecv_sep(); if (s5 === peg$FAILED) { s5 = peg$c2; } if (s5 !== peg$FAILED) { s6 = peg$parsev_explicit(); if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } if (s4 === peg$FAILED) { s4 = peg$parsecv_sep(); } if (s4 !== peg$FAILED) { s5 = peg$parsev_letter(); if (s5 === peg$FAILED) { s5 = peg$parsev(); } if (s5 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c42(s2, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecv_weak() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parsec(); if (s1 !== peg$FAILED) { s2 = peg$parsecv_sep_weak(); if (s2 !== peg$FAILED) { s3 = peg$parsev_letter(); if (s3 === peg$FAILED) { s3 = peg$parsev(); } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsecv_sep(); if (s6 !== peg$FAILED) { s7 = peg$parsev(); if (s7 !== peg$FAILED) { s6 = [s6, s7]; s5 = s6; } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c9; } else { peg$currPos = s4; s4 = peg$c1; } if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c42(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsec() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsec_explicit(); if (s1 === peg$FAILED) { s1 = peg$c2; } if (s1 !== peg$FAILED) { s2 = peg$parseinteger(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c43(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parseff() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$parsecv(); if (s1 === peg$FAILED) { s1 = peg$parsecv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseinteger(); if (s1 === peg$FAILED) { s1 = peg$parsec(); if (s1 === peg$FAILED) { s1 = peg$parsev(); } } } } } } } } if (s1 !== peg$FAILED) { s2 = peg$parsesp(); if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 1).toLowerCase() === peg$c44) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s3 !== peg$FAILED) { s4 = peg$parsespace(); if (s4 !== peg$FAILED) { if (input.substr(peg$currPos, 5).toLowerCase() === peg$c46) { s5 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s5 !== peg$FAILED) { s6 = peg$parseabbrev(); if (s6 === peg$FAILED) { s6 = peg$c2; } if (s6 !== peg$FAILED) { s7 = peg$currPos; peg$silentFails++; if (peg$c48.test(input.charAt(peg$currPos))) { s8 = input.charAt(peg$currPos); peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c49); } } peg$silentFails--; if (s8 === peg$FAILED) { s7 = peg$c9; } else { peg$currPos = s7; s7 = peg$c1; } if (s7 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c50(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parseinteger_title() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseinteger(); if (s1 !== peg$FAILED) { s2 = peg$parsecv_sep(); if (s2 === peg$FAILED) { s2 = peg$parsesequence_sep(); } if (s2 === peg$FAILED) { s2 = peg$c2; } if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 11).toLowerCase() === peg$c51) { s3 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c53(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecontext() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 31) { s1 = peg$c11; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c54) { s3 = peg$c54; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c55); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c56(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parseps151_b() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 31) { s1 = peg$c11; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c57) { s3 = peg$c57; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c58); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c17(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parseps151_bc() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parseps151_b(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c59) { s2 = peg$c59; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; if (peg$c61.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c62); } } peg$silentFails--; if (s4 === peg$FAILED) { s3 = peg$c9; } else { peg$currPos = s3; s3 = peg$c1; } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c63(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parseps151_bcv() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseps151_bc(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s2 = peg$c22; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s2 !== peg$FAILED) { s3 = peg$parseinteger(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c64(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsev_letter() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parsev_explicit(); if (s1 === peg$FAILED) { s1 = peg$c2; } if (s1 !== peg$FAILED) { s2 = peg$parseinteger(); if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; if (input.substr(peg$currPos, 1).toLowerCase() === peg$c44) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s6 !== peg$FAILED) { s7 = peg$parsespace(); if (s7 !== peg$FAILED) { if (input.substr(peg$currPos, 5).toLowerCase() === peg$c46) { s8 = input.substr(peg$currPos, 5); peg$currPos += 5; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s8 !== peg$FAILED) { s6 = [s6, s7, s8]; s5 = s6; } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c9; } else { peg$currPos = s4; s4 = peg$c1; } if (s4 !== peg$FAILED) { if (peg$c65.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c66); } } if (s5 !== peg$FAILED) { s6 = peg$currPos; peg$silentFails++; if (peg$c48.test(input.charAt(peg$currPos))) { s7 = input.charAt(peg$currPos); peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c49); } } peg$silentFails--; if (s7 === peg$FAILED) { s6 = peg$c9; } else { peg$currPos = s6; s6 = peg$c1; } if (s6 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c67(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsev() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsev_explicit(); if (s1 === peg$FAILED) { s1 = peg$c2; } if (s1 !== peg$FAILED) { s2 = peg$parseinteger(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c67(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsec_explicit() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { s2 = peg$currPos; if (input.substr(peg$currPos, 2).toLowerCase() === peg$c68) { s3 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 3).toLowerCase() === peg$c70) { s4 = input.substr(peg$currPos, 3); peg$currPos += 3; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c71); } } if (s4 === peg$FAILED) { if (input.substr(peg$currPos, 2).toLowerCase() === peg$c72) { s4 = input.substr(peg$currPos, 2); peg$currPos += 2; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c73); } } if (s4 === peg$FAILED) { s4 = peg$currPos; s5 = peg$c74; if (s5 !== peg$FAILED) { s6 = peg$parseabbrev(); if (s6 === peg$FAILED) { s6 = peg$c2; } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } } } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c1; } } else { peg$currPos = s2; s2 = peg$c1; } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c75(); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsev_explicit() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { s2 = peg$currPos; if (input.substr(peg$currPos, 4).toLowerCase() === peg$c76) { s3 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c77); } } if (s3 !== peg$FAILED) { if (input.substr(peg$currPos, 1).toLowerCase() === peg$c44) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s4 === peg$FAILED) { s4 = peg$c74; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c1; } } else { peg$currPos = s2; s2 = peg$c1; } if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; if (peg$c48.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c49); } } peg$silentFails--; if (s4 === peg$FAILED) { s3 = peg$c9; } else { peg$currPos = s3; s3 = peg$c1; } if (s3 !== peg$FAILED) { s4 = peg$parsesp(); if (s4 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c78(); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecv_sep() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s2 = peg$c19; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsecv_sep_weak() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (peg$c79.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } if (s0 === peg$FAILED) { s0 = peg$parsespace(); } return s0; } function peg$parsesequence_sep() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = []; if (peg$c81.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s2 === peg$FAILED) { s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s3 = peg$c22; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s7 = peg$c22; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s7 !== peg$FAILED) { s8 = peg$parsesp(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s9 = peg$c22; peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s9 !== peg$FAILED) { s6 = [s6, s7, s8, s9]; s5 = s6; } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c9; } else { peg$currPos = s4; s4 = peg$c1; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c1; } } else { peg$currPos = s2; s2 = peg$c1; } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 1).toLowerCase() === peg$c44) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s2 === peg$FAILED) { s2 = peg$parsespace(); } } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c81.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c82); } } if (s2 === peg$FAILED) { s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s3 = peg$c22; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s7 = peg$c22; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s7 !== peg$FAILED) { s8 = peg$parsesp(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s9 = peg$c22; peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s9 !== peg$FAILED) { s6 = [s6, s7, s8, s9]; s5 = s6; } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } } else { peg$currPos = s5; s5 = peg$c1; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = peg$c9; } else { peg$currPos = s4; s4 = peg$c1; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c1; } } else { peg$currPos = s2; s2 = peg$c1; } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 1).toLowerCase() === peg$c44) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s2 === peg$FAILED) { s2 = peg$parsespace(); } } } } } else { s1 = peg$c1; } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c83(); } s0 = s1; return s0; } function peg$parserange_sep() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; if (peg$c84.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c85); } } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } if (s3 === peg$FAILED) { s3 = peg$currPos; if (input.substr(peg$currPos, 1).toLowerCase() === peg$c86) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; if (peg$c84.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c85); } } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } if (s3 === peg$FAILED) { s3 = peg$currPos; if (input.substr(peg$currPos, 1).toLowerCase() === peg$c86) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c87); } } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } } } } else { s2 = peg$c1; } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsetitle() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsecv_sep(); if (s1 === peg$FAILED) { s1 = peg$parsesequence_sep(); } if (s1 === peg$FAILED) { s1 = peg$c2; } if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 11).toLowerCase() === peg$c51) { s2 = input.substr(peg$currPos, 11); peg$currPos += 11; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s2 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c88(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsein_book_of() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 4) === peg$c89) { s2 = peg$c89; peg$currPos += 4; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c90); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c91) { s2 = peg$c91; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c92); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c93) { s2 = peg$c93; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c94); } } } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s4 = peg$currPos; if (input.substr(peg$currPos, 3) === peg$c95) { s5 = peg$c95; peg$currPos += 3; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c96); } } if (s5 !== peg$FAILED) { s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.substr(peg$currPos, 4) === peg$c97) { s7 = peg$c97; peg$currPos += 4; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c98); } } if (s7 !== peg$FAILED) { s8 = peg$parsesp(); if (s8 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c91) { s9 = peg$c91; peg$currPos += 2; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c92); } } if (s9 !== peg$FAILED) { s10 = peg$parsesp(); if (s10 !== peg$FAILED) { s5 = [s5, s6, s7, s8, s9, s10]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } if (s4 === peg$FAILED) { s4 = peg$c2; } if (s4 !== peg$FAILED) { s1 = [s1, s2, s3, s4]; s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parseabbrev() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s2 = peg$c22; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; s4 = peg$currPos; s5 = peg$parsesp(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s6 = peg$c22; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s6 !== peg$FAILED) { s7 = peg$parsesp(); if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s8 = peg$c22; peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s8 !== peg$FAILED) { s5 = [s5, s6, s7, s8]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } peg$silentFails--; if (s4 === peg$FAILED) { s3 = peg$c9; } else { peg$currPos = s3; s3 = peg$c1; } if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsetranslation_sequence_enclosed() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (peg$c99.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c100); } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s4 = peg$currPos; s5 = peg$parsetranslation(); if (s5 !== peg$FAILED) { s6 = []; s7 = peg$currPos; s8 = peg$parsesequence_sep(); if (s8 !== peg$FAILED) { s9 = peg$parsetranslation(); if (s9 !== peg$FAILED) { s8 = [s8, s9]; s7 = s8; } else { peg$currPos = s7; s7 = peg$c1; } } else { peg$currPos = s7; s7 = peg$c1; } while (s7 !== peg$FAILED) { s6.push(s7); s7 = peg$currPos; s8 = peg$parsesequence_sep(); if (s8 !== peg$FAILED) { s9 = peg$parsetranslation(); if (s9 !== peg$FAILED) { s8 = [s8, s9]; s7 = s8; } else { peg$currPos = s7; s7 = peg$c1; } } else { peg$currPos = s7; s7 = peg$c1; } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$c1; } } else { peg$currPos = s4; s4 = peg$c1; } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { if (peg$c101.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c102); } } if (s6 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c103(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsetranslation_sequence() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 44) { s3 = peg$c19; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s3 !== peg$FAILED) { s4 = peg$parsesp(); if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$c1; } } else { peg$currPos = s2; s2 = peg$c1; } if (s2 === peg$FAILED) { s2 = peg$c2; } if (s2 !== peg$FAILED) { s3 = peg$currPos; s4 = peg$parsetranslation(); if (s4 !== peg$FAILED) { s5 = []; s6 = peg$currPos; s7 = peg$parsesequence_sep(); if (s7 !== peg$FAILED) { s8 = peg$parsetranslation(); if (s8 !== peg$FAILED) { s7 = [s7, s8]; s6 = s7; } else { peg$currPos = s6; s6 = peg$c1; } } else { peg$currPos = s6; s6 = peg$c1; } while (s6 !== peg$FAILED) { s5.push(s6); s6 = peg$currPos; s7 = peg$parsesequence_sep(); if (s7 !== peg$FAILED) { s8 = peg$parsetranslation(); if (s8 !== peg$FAILED) { s7 = [s7, s8]; s6 = s7; } else { peg$currPos = s6; s6 = peg$c1; } } else { peg$currPos = s6; s6 = peg$c1; } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$c1; } } else { peg$currPos = s3; s3 = peg$c1; } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c103(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parsetranslation() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 30) { s1 = peg$c104; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c105); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 30) { s3 = peg$c104; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c105); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c106(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } } else { peg$currPos = s0; s0 = peg$c1; } return s0; } function peg$parseinteger() { var res; if (res = /^[0-9]{1,3}(?!\d|,000)/.exec(input.substr(peg$currPos))) { peg$reportedPos = peg$currPos; peg$currPos += res[0].length; return {"type": "integer", "value": parseInt(res[0], 10), "indices": [peg$reportedPos, peg$currPos - 1]} } else { return peg$c1; } } function peg$parseany_integer() { var res; if (res = /^[0-9]+/.exec(input.substr(peg$currPos))) { peg$reportedPos = peg$currPos; peg$currPos += res[0].length; return {"type": "integer", "value": parseInt(res[0], 10), "indices": [peg$reportedPos, peg$currPos - 1]} } else { return peg$c1; } } function peg$parseword() { var s0, s1, s2; s0 = peg$currPos; s1 = []; if (peg$c110.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c111); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c110.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c111); } } } } else { s1 = peg$c1; } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c112(s1); } s0 = s1; return s0; } function peg$parseword_parenthesis() { var s0, s1; s0 = peg$currPos; if (peg$c99.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c100); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; s1 = peg$c113(s1); } s0 = s1; return s0; } function peg$parsesp() { var s0; s0 = peg$parsespace(); if (s0 === peg$FAILED) { s0 = peg$c2; } return s0; } function peg$parsespace() { var res; if (res = /^[\s\xa0*]+/.exec(input.substr(peg$currPos))) { peg$reportedPos = peg$currPos; peg$currPos += res[0].length; return []; } return peg$c1; } peg$result = peg$startRuleFunction(); if (peg$result !== peg$FAILED && peg$currPos === input.length) { return peg$result; } else { if (peg$result !== peg$FAILED && peg$currPos < input.length) { peg$fail({ type: "end", description: "end of input" }); } throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); } } return { SyntaxError: SyntaxError, parse: parse }; })(); }).call(this);
const config = require('../../../knexfile').intweb const knex = require('knex')(config) const dateFormatter = require('../date-formatter') const insertClaimEvent = require('./insert-claim-event') const claimEventEnum = require('../../constants/claim-event-enum') module.exports = function (claimId, isTrusted, untrustedReason) { return getEligibilityData(claimId) .then(function (eligibilityData) { if (isTrusted !== eligibilityData.IsTrusted) { var updateObject = { isTrusted: isTrusted, UntrustedDate: !isTrusted ? dateFormatter.now().toDate() : null, UntrustedReason: !isTrusted ? untrustedReason : null } return knex('Eligibility') .where('EligibilityId', eligibilityData.EligibilityId) .update(updateObject) .then(function () { var event = isTrusted ? claimEventEnum.ALLOW_AUTO_APPROVAL.value : claimEventEnum.DISABLE_AUTO_APPROVAL.value return insertClaimEvent(eligibilityData.Reference, eligibilityData.EligibilityId, claimId, event, null, untrustedReason, null, true) }) } }) } function getEligibilityData (claimId) { return knex('Claim') .join('Eligibility', 'Claim.EligibilityId', '=', 'Eligibility.EligibilityId') .where('ClaimId', claimId) .first() .select('Eligibility.EligibilityId', 'Eligibility.Reference', 'Eligibility.IsTrusted') }
import Ember from 'ember'; import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin'; import config from 'ilios/config/environment'; const { inject } = Ember; const { service } = inject; export default Ember.Route.extend(ApplicationRouteMixin, { flashMessages: service(), commonAjax: service(), i18n: service(), moment: service(), /** * Leave titles as an array * All of our routes send translations for the 'titleToken' key and we do the translating in head.hbs * and in the application controller. * @param Array tokens * @return Array */ title(tokens){ return tokens; }, //Override the default session invalidator so we can do auth stuff sessionInvalidated() { if (!Ember.testing) { let logoutUrl = '/auth/logout'; return this.get('commonAjax').request(logoutUrl).then(response => { if(response.status === 'redirect'){ window.location.replace(response.logoutUrl); } else { this.get('flashMessages').success('general.confirmLogout'); window.location.replace(config.rootURL); } }); } }, beforeModel() { const i18n = this.get('i18n'); const moment = this.get('moment'); moment.setLocale(i18n.get('locale')); }, actions: { willTransition: function() { let controller = this.controllerFor('application'); controller.set('errors', []); controller.set('showErrorDisplay', false); } } });
var map = [ [0x1, 0x8], [0x2, 0x10], [0x4, 0x20], [0x40, 0x80] ] function Canvas(width, height) { if(width%2 != 0) { throw new Error('Width must be multiple of 2!'); } if(height%4 != 0) { throw new Error('Height must be multiple of 4!'); } this.width = width; this.height = height; this.content = new Buffer(width*height/8); this.content.fill(0); } var methods = { set: function(coord, mask) { this.content[coord] |= mask; }, unset: function(coord, mask) { this.content[coord] &= ~mask; }, toggle: function(coord, mask) { this.content[coord] ^= mask; } }; Object.keys(methods).forEach(function(method) { Canvas.prototype[method] = function(x, y) { if(!(x >= 0 && x < this.width && y >= 0 && y < this.height)) { return; } x = Math.floor(x); y = Math.floor(y); var nx = Math.floor(x/2); var ny = Math.floor(y/4); var coord = nx + this.width/2*ny; var mask = map[y%4][x%2]; methods[method].call(this, coord, mask); } }); Canvas.prototype.clear = function() { this.content.fill(0); }; Canvas.prototype.frame = function frame(delimiter) { delimiter = delimiter || '\n'; var result = []; for(var i = 0, j = 0; i < this.content.length; i++, j++) { if(j == this.width/2) { result.push(delimiter); j = 0; } if(this.content[i] == 0) { result.push(' '); } else { result.push(String.fromCharCode(0x2800 + this.content[i])) } } result.push(delimiter); return result.join(''); }; module.exports = Canvas;
/** * Test for fur bin. * Runs with mocha. */ 'use strict' const assert = require('assert') const fs = require('fs') const furBin = require.resolve('../bin/fur') const execcli = require('execcli') const mkdirp = require('mkdirp') let tmpDir = __dirname + '/../tmp' describe('bin', function () { this.timeout(24000) before(async () => { await mkdirp(tmpDir) }) after(async () => { }) it('Generate favicon', async () => { let filename = tmpDir + '/testing-bin-favicon.png' await execcli(furBin, [ 'favicon', filename ]) assert.ok(fs.existsSync(filename)) }) it('Generate banner', async () => { let filename = tmpDir + '/testing-bin-banner.png' await execcli(furBin, [ 'banner', filename ]) assert.ok(fs.existsSync(filename)) }) }) /* global describe, before, after, it */
Router.map(function(){ this.route('home',{ path:'/', template: 'home', onBeforeAction: function(pause){ this.subscribe('getAlgosByReg',Session.get('mainQuery')).wait(); this.subscribe('getAlgosByName',Session.get('mainQuery')).wait(); this.subscribe('getAlgosByKeyWord',Session.get('mainQuery')).wait(); } }); this.route('guide',{ path:'/guidelines', template:'guidelines' }); this.route('pediaHome',{ path: '/algos', template:'pedia', onBeforeAction: function(pause){ this.subscribe('getAllAlgos'); Session.set('pediaAiD',""); } }); this.route('pediaSpecific',{ path: '/algos/:_id', template:'pedia', onBeforeAction: function(pause){ this.subscribe('getAllAlgos'); this.subscribe('codeByAlgo',this.params._id); Session.set('pediaAiD',this.params._id); } }); this.route('langs',{ template: 'langList', onBeforeAction: function(pause){ Session.set('langPageLang',""); } }); this.route('langSearch',{ path: '/langs/:_id', template: 'langList', onBeforeAction: function(pause){ this.subscribe('codeByLang',this.params._id).wait(); Session.set('langPageLang',this.params._id); } }); this.route('users',{ path: '/users/:_id', template:'userPage', onBeforeAction: function(pause){ this.subscribe('getUserCode',this.params._id).wait(); this.subscribe('getUserAlgos',this.params._id).wait(); var uDoc = Meteor.users.findOne({_id:this.params._id}); Session.set('lastUserSearch',uDoc); if(Session.equals('lastUserSearch',undefined)){ pause(); } } }); this.route('pedia',{ path:'/pedia/:_id', template: 'entryPage', onBeforeAction: function(pause){ this.subscribe('algoParticular',this.params._id).wait(); var aDoc = AlgoPedia.findOne({AiD:this.params._id}); Session.set('lastAlgoSearch',aDoc); Session.set('lsiSelected',null); Session.set('tabSelect','first'); Session.set('lsiLangSearch',null); if(Session.equals('lastAlgoSearch',undefined)){ pause(); } } }); this.route('pediaSearch',{ path:'/pedia/:algo/:search', template: 'entryPage', onBeforeAction: function(pause){ this.subscribe('algoParticular',this.params.algo).wait(); var aDoc=AlgoPedia.findOne({AiD:this.params.algo}); Session.set('lastAlgoSearch',aDoc); if(this.params.search==="showAll"){ this.subscribe('codeByAlgo',this.params.algo).wait(); Session.set('lsiLangSearch',null); Session.set('lsiSelected',null); Session.set('tabSelect','second'); if(Session.equals('lastAlgoSearch',undefined)){ pause(); } } else{ this.subscribe('codeByAlgoAndLang',this.params.algo,this.params.search).wait(); var lDoc = Languages.findOne({Slug:this.params.search}); Session.set('lsiLangSearch',lDoc); Session.set('lsiSelected',null); Session.set('tabSelect','second'); if(Session.equals('lastAlgoSearch',undefined)){ pause(); } if(Session.equals('lsiLangSearch',undefined)){ pause(); } } } }); this.route('lsiSearchRoute',{ path:'/pedia/:algo/:lang/:search', template: 'entryPage', onBeforeAction: function(pause){ this.subscribe('getComments',this.params.search); this.subscribe('algoParticular',this.params.algo).wait(); var aDoc=AlgoPedia.findOne({AiD:this.params.algo}); Session.set('lastAlgoSearch',aDoc); if(this.params.lang==="showAll"){ this.subscribe('codeByAlgo',this.params.algo).wait(); Session.set('lsiSelected',this.params.search); Session.set('tabSelect','second'); Session.set('lsiLangSearch',null); if(Session.equals('lastAlgoSearch',undefined)){ pause(); } } else{ this.subscribe('codeByAlgoAndLang',this.params.algo,this.params.lang).wait(); var lDoc = Languages.findOne({Slug:this.params.lang}); Session.set('lsiSelected',this.params.search); Session.set('tabSelect','second'); Session.set('lsiLangSearch',lDoc); if(Session.equals('lastAlgoSearch',undefined)){ pause(); } if(Session.equals('lsiLangSearch',undefined)){ pause(); } } } }); }); Router.configure({ layoutTemplate: 'layout_main', });
/** * Imports */ var path = require('path'); var fs = require('fs'); var _ = require('lodash'); /** * BaseDbContext class * @param {Object} options */ var BaseDbContext = module.exports = function(options) { options || (options = {}); this.entities = {}; this._loadModels(); this.initialize.apply(this, arguments); } _.extend(BaseDbContext.prototype, { initialize: function () {}, modelsFolder: [], _loadModels: function () { if(!this.db) { return; } var self = this; this.modelsFolder.forEach(function (folderpath) { fs.readdirSync(folderpath).forEach(function(file) { var modelName = file.split('.')[0]; var model = self.db.import(path.join(folderpath, file)); self.entities[modelName] = model; }); Object.keys(self.entities).forEach(function(modelName) { if ('associate' in self.entities[modelName]) { self.entities[modelName].associate(self.entities); } }); }); }, sync: function () { return this.db.sync(); }, drop: function () { return this.db.drop(); } }); /** * JavaScript extend function */ function extend(protoProps, staticProps) { var parent = this; var child; if (protoProps && _.has(protoProps, 'constructor')) { child = protoProps.constructor; } else { child = function() { return parent.apply(this, arguments); }; } _.extend(child, parent, staticProps); child.prototype = Object.create(parent.prototype, { constructor: { value: child, enumerable: false, writable: true, configurable: true } }); if (protoProps) _.extend(child.prototype, protoProps); child.__super__ = parent.prototype; return child; }; BaseDbContext.extend = extend; module.exports = BaseDbContext;
import React, {Component} from "react"; import { addAnimationId } from './modules/animationFunctions.js' import '../scss/dev-projects.css'; import close from "../assets/close.png"; export default class DevProjects extends Component { componentDidMount() { addAnimationId('dev-projects', 'dev-section-fadein') } render() { return ( <div id="dev-projects"> <i onClick={this.props.closeButtonClick} className="fal fa-times"></i> <div className="project-container"> <div> <p>PERSONAL SITE PROJECT</p> <p>BUILT A NEW PERSONAL SITE USING REACT.JS WHILE UTILIZING VARIOUS ANIMATIONS AND TRANSITIONS</p> </div> <div> <a href="https://github.com/Ayaz2589/personal_site" target="_blank"> VIEW PERSONAL SITE CODEBASE </a> </div> </div> </div> ); } };
import React, { PropTypes } from 'react'; import Spinner from './Spinner'; const ModalOverlay = (props) => { const isActive = props.active ? 'active' : ''; const spinner = props.spinner ? <Spinner /> : ''; return ( <div id="modal-overlay" className={isActive}> {spinner} </div> ); }; ModalOverlay.propTypes = { active: PropTypes.bool, spinner: PropTypes.bool, }; export default ModalOverlay;
version https://git-lfs.github.com/spec/v1 oid sha256:1371b661d4ebad753ee72a0b75d51aca5ca885cbb51d046e634951057b5314f6 size 144
function tabCtrl(id) { var element = document.querySelectorAll('[data-selector="tabbar/tab"]'); for (var i = 0; i < element.length; i++) { if (element[i].dataset.id === id) { element[i].classList.add('tabbar__tab__active'); } else { element[i].classList.remove('tabbar__tab__active'); } } } function tabItemCtrl(id) { var element = document.querySelectorAll('[data-selector="tabbar/item"]'); for (var i = 0; i < element.length; i++) { if (element[i].dataset.id === id) { element[i].classList.remove('tabbar__item--hidden'); } else { element[i].classList.add('tabbar__item--hidden'); } } } function init() { var links = document.querySelectorAll('[data-selector="tabbar/tab"]'); for (var i = 0; i < links.length; i++) { links[i].addEventListener('click', function (event) { event.preventDefault(); tabCtrl(this.dataset.id); tabItemCtrl(this.dataset.id); }, false); } } export default init;
import core from 'comindware/core'; import CanvasView from 'demoPage/views/CanvasView'; export default function() { const model = new Backbone.Model({ referenceValue: { id: 'test.1', text: 'Test Reference 1' } }); return new CanvasView({ view: new core.form.editors.ReferenceBubbleEditor({ model, key: 'referenceValue', autocommit: true, showEditButton: true, controller: new core.form.editors.reference.controllers.DemoReferenceEditorController() }), presentation: "{{#if referenceValue}}{ id: '{{referenceValue.id}}', text: '{{referenceValue.text}}' }{{else}}null{{/if}}" }); }
'use strict'; // Use local.env.js for environment variables that grunt will set when the server starts locally. // Use for your api keys, secrets, etc. This file should not be tracked by git. // // You will need to set these on the server you deploy to. module.exports = { DOMAIN: 'http://localhost:9000', SESSION_SECRET: 'zebratest-secret', // Control debug level for modules using visionmedia/debug DEBUG: '' };
/* Copyright 2013, KISSY UI Library v1.30 MIT Licensed build time: Jul 1 20:13 */ var KISSY=function(a){var b=this,i,k=0;i={__BUILD_TIME:"20130701201313",Env:{host:b,nodejs:"function"==typeof require&&"object"==typeof exports},Config:{debug:"",fns:{}},version:"1.30",config:function(b,j){var l,e,f=this,d,h=i.Config,c=h.fns;i.isObject(b)?i.each(b,function(m,a){(d=c[a])?d.call(f,m):h[a]=m}):(l=c[b],j===a?e=l?l.call(f):h[b]:l?e=l.call(f,j):h[b]=j);return e},log:function(g,j,l){if(i.Config.debug&&(l&&(g=l+": "+g),b.console!==a&&console.log))console[j&&console[j]?j:"log"](g)}, error:function(a){if(i.Config.debug)throw a instanceof Error?a:Error(a);},guid:function(a){return(a||"")+k++}};i.Env.nodejs&&(i.KISSY=i,module.exports=i);return i}(); (function(a,b){function i(){}function k(c,a){var b;d?b=d(c):(i.prototype=c,b=new i);b.constructor=a;return b}function g(c,d,h,e,g,i){if(!d||!c)return c;h===b&&(h=f);var k=0,s,u,v;d[l]=c;i.push(d);if(e){v=e.length;for(k=0;k<v;k++)s=e[k],s in d&&j(s,c,d,h,e,g,i)}else{u=a.keys(d);v=u.length;for(k=0;k<v;k++)s=u[k],s!=l&&j(s,c,d,h,e,g,i)}return c}function j(c,d,h,e,j,i,k){if(e||!(c in d)||i){var s=d[c],h=h[c];if(s===h)s===b&&(d[c]=s);else if(i&&h&&(a.isArray(h)||a.isPlainObject(h)))h[l]?d[c]=h[l]:(i=s&& (a.isArray(s)||a.isPlainObject(s))?s:a.isArray(h)?[]:{},d[c]=i,g(i,h,e,j,f,k));else if(h!==b&&(e||!(c in d)))d[c]=h}}var l="__MIX_CIRCULAR",e=this,f=!0,d=Object.create,h=!{toString:1}.propertyIsEnumerable("toString"),c="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toString,toLocaleString,valueOf".split(",");(function(c,a){for(var d in a)c[d]=a[d]})(a,{stamp:function(c,d,h){if(!c)return c;var h=h||"__~ks_stamped",f=c[h];if(!f&&!d)try{f=c[h]=a.guid(h)}catch(e){f=b}return f},keys:function(a){var d= [],b,f;for(b in a)d.push(b);if(h)for(f=c.length-1;0<=f;f--)b=c[f],a.hasOwnProperty(b)&&d.push(b);return d},mix:function(c,a,d,b,h){"object"===typeof d&&(b=d.whitelist,h=d.deep,d=d.overwrite);var f=[],e=0;for(g(c,a,d,b,h,f);a=f[e++];)delete a[l];return c},merge:function(c){var c=a.makeArray(arguments),d={},b,h=c.length;for(b=0;b<h;b++)a.mix(d,c[b]);return d},augment:function(c,d){var h=a.makeArray(arguments),f=h.length-2,e=1,j=h[f],g=h[f+1];a.isArray(g)||(j=g,g=b,f++);a.isBoolean(j)||(j=b,f++);for(;e< f;e++)a.mix(c.prototype,h[e].prototype||h[e],j,g);return c},extend:function(c,d,b,h){if(!d||!c)return c;var f=d.prototype,e;e=k(f,c);c.prototype=a.mix(e,c.prototype);c.superclass=k(f,d);b&&a.mix(e,b);h&&a.mix(c,h);return c},namespace:function(){var c=a.makeArray(arguments),d=c.length,b=null,h,j,g,i=c[d-1]===f&&d--;for(h=0;h<d;h++){g=(""+c[h]).split(".");b=i?e:this;for(j=e[g[0]]===b?1:0;j<g.length;++j)b=b[g[j]]=b[g[j]]||{}}return b}})})(KISSY); (function(a,b){var i=Array.prototype,k=i.indexOf,g=i.lastIndexOf,j=i.filter,l=i.every,e=i.some,f=i.map;a.mix(a,{each:function(d,h,c){if(d){var m,f,e=0;m=d&&d.length;f=m===b||"function"===a.type(d);c=c||null;if(f)for(f=a.keys(d);e<f.length&&!(m=f[e],!1===h.call(c,d[m],m,d));e++);else for(f=d[0];e<m&&!1!==h.call(c,f,e,d);f=d[++e]);}return d},indexOf:k?function(d,a){return k.call(a,d)}:function(d,a){for(var c=0,b=a.length;c<b;++c)if(a[c]===d)return c;return-1},lastIndexOf:g?function(d,a){return g.call(a, d)}:function(d,a){for(var c=a.length-1;0<=c&&a[c]!==d;c--);return c},unique:function(d,b){var c=d.slice();b&&c.reverse();for(var m=0,f,e;m<c.length;){for(e=c[m];(f=a.lastIndexOf(e,c))!==m;)c.splice(f,1);m+=1}b&&c.reverse();return c},inArray:function(d,b){return-1<a.indexOf(d,b)},filter:j?function(d,a,c){return j.call(d,a,c||this)}:function(d,b,c){var m=[];a.each(d,function(d,a,f){b.call(c||this,d,a,f)&&m.push(d)});return m},map:f?function(d,a,c){return f.call(d,a,c||this)}:function(d,a,c){for(var b= d.length,f=Array(b),e=0;e<b;e++){var j="string"==typeof d?d.charAt(e):d[e];if(j||e in d)f[e]=a.call(c||this,j,e,d)}return f},reduce:function(a,f,c){var m=a.length;if("function"!==typeof f)throw new TypeError("callback is not function!");if(0===m&&2==arguments.length)throw new TypeError("arguments invalid");var e=0,j;if(3<=arguments.length)j=arguments[2];else{do{if(e in a){j=a[e++];break}e+=1;if(e>=m)throw new TypeError;}while(1)}for(;e<m;)e in a&&(j=f.call(b,j,a[e],e,a)),e++;return j},every:l?function(a, b,c){return l.call(a,b,c||this)}:function(a,b,c){for(var f=a&&a.length||0,e=0;e<f;e++)if(e in a&&!b.call(c,a[e],e,a))return!1;return!0},some:e?function(a,b,c){return e.call(a,b,c||this)}:function(a,b,c){for(var f=a&&a.length||0,e=0;e<f;e++)if(e in a&&b.call(c,a[e],e,a))return!0;return!1},makeArray:function(d){if(null==d)return[];if(a.isArray(d))return d;if("number"!==typeof d.length||d.alert||"string"==typeof d||a.isFunction(d))return[d];for(var b=[],c=0,f=d.length;c<f;c++)b[c]=d[c];return b}})})(KISSY); (function(a,b){function i(c){var a=typeof c;return null==c||"object"!==a&&"function"!==a}function k(){if(f)return f;var c=j;a.each(l,function(a){c+=a+"|"});c=c.slice(0,-1);return f=RegExp(c,"g")}function g(){if(d)return d;var c=j;a.each(e,function(a){c+=a+"|"});c+="&#(\\d{1,5});";return d=RegExp(c,"g")}var j="",l={"&amp;":"&","&gt;":">","&lt;":"<","&#x60;":"`","&#x2F;":"/","&quot;":'"',"&#x27;":"'"},e={},f,d,h=/[\-#$\^*()+\[\]{}|\\,.?\s]/g;(function(){for(var c in l)e[l[c]]=c})();a.mix(a,{urlEncode:function(c){return encodeURIComponent(""+ c)},urlDecode:function(c){return decodeURIComponent(c.replace(/\+/g," "))},fromUnicode:function(c){return c.replace(/\\u([a-f\d]{4})/ig,function(c,a){return String.fromCharCode(parseInt(a,16))})},escapeHTML:function(c){return(c+"").replace(k(),function(c){return e[c]})},escapeRegExp:function(c){return c.replace(h,"\\$&")},unEscapeHTML:function(c){return c.replace(g(),function(c,a){return l[c]||String.fromCharCode(+a)})},param:function(c,d,f,e){if(!a.isPlainObject(c))return j;d=d||"&";f=f||"=";a.isUndefined(e)&& (e=!0);var h=[],g,l,k,s,u,v=a.urlEncode;for(g in c)if(u=c[g],g=v(g),i(u))h.push(g),u!==b&&h.push(f,v(u+j)),h.push(d);else if(a.isArray(u)&&u.length){l=0;for(s=u.length;l<s;++l)k=u[l],i(k)&&(h.push(g,e?v("[]"):j),k!==b&&h.push(f,v(k+j)),h.push(d))}h.pop();return h.join(j)},unparam:function(c,d,f){if("string"!=typeof c||!(c=a.trim(c)))return{};for(var f=f||"=",e={},h,j=a.urlDecode,c=c.split(d||"&"),g=0,i=c.length;g<i;++g){h=c[g].indexOf(f);if(-1==h)d=j(c[g]),h=b;else{d=j(c[g].substring(0,h));h=c[g].substring(h+ 1);try{h=j(h)}catch(l){}a.endsWith(d,"[]")&&(d=d.substring(0,d.length-2))}d in e?a.isArray(e[d])?e[d].push(h):e[d]=[e[d],h]:e[d]=h}return e}})})(KISSY); (function(a){function b(a,b,g){var j=[].slice,l=j.call(arguments,3),e=function(){},f=function(){var d=j.call(arguments);return b.apply(this instanceof e?this:g,a?d.concat(l):l.concat(d))};e.prototype=b.prototype;f.prototype=new e;return f}a.mix(a,{noop:function(){},bind:b(0,b,null,0),rbind:b(0,b,null,1),later:function(b,k,g,j,l){var k=k||0,e=b,f=a.makeArray(l),d;"string"==typeof b&&(e=j[b]);b=function(){e.apply(j,f)};d=g?setInterval(b,k):setTimeout(b,k);return{id:d,interval:g,cancel:function(){this.interval? clearInterval(d):clearTimeout(d)}}},throttle:function(b,k,g){k=k||150;if(-1===k)return function(){b.apply(g||this,arguments)};var j=a.now();return function(){var l=a.now();l-j>k&&(j=l,b.apply(g||this,arguments))}},buffer:function(b,k,g){function j(){j.stop();l=a.later(b,k,0,g||this,arguments)}k=k||150;if(-1===k)return function(){b.apply(g||this,arguments)};var l=null;j.stop=function(){l&&(l.cancel(),l=0)};return j}})})(KISSY); (function(a,b){function i(b,d,e){var c=b,m,n,g,o;if(!b)return c;if(b[l])return e[b[l]].destination;if("object"===typeof b){o=b.constructor;if(a.inArray(o,[Boolean,String,Number,Date,RegExp]))c=new o(b.valueOf());else if(m=a.isArray(b))c=d?a.filter(b,d):b.concat();else if(n=a.isPlainObject(b))c={};b[l]=o=a.guid();e[o]={destination:c,input:b}}if(m)for(b=0;b<c.length;b++)c[b]=i(c[b],d,e);else if(n)for(g in b)if(g!==l&&(!d||d.call(b,b[g],g,b)!==j))c[g]=i(b[g],d,e);return c}function k(f,d,h,c){if(f[e]=== d&&d[e]===f)return g;f[e]=d;d[e]=f;var m=function(c,a){return null!==c&&c!==b&&c[a]!==b},n;for(n in d)!m(f,n)&&m(d,n)&&h.push("expected has key '"+n+"', but missing from actual.");for(n in f)!m(d,n)&&m(f,n)&&h.push("expected missing key '"+n+"', but present in actual.");for(n in d)n!=e&&(a.equals(f[n],d[n],h,c)||c.push("'"+n+"' was '"+(d[n]?d[n].toString():d[n])+"' in expected, but was '"+(f[n]?f[n].toString():f[n])+"' in actual."));a.isArray(f)&&a.isArray(d)&&f.length!=d.length&&c.push("arrays were not the same length"); delete f[e];delete d[e];return 0===h.length&&0===c.length}var g=!0,j=!1,l="__~ks_cloned",e="__~ks_compared";a.mix(a,{equals:function(e,d,h,c){h=h||[];c=c||[];return e===d?g:e===b||null===e||d===b||null===d?null==e&&null==d:e instanceof Date&&d instanceof Date?e.getTime()==d.getTime():"string"==typeof e&&"string"==typeof d||a.isNumber(e)&&a.isNumber(d)?e==d:"object"===typeof e&&"object"===typeof d?k(e,d,h,c):e===d},clone:function(e,d){var h={},c=i(e,d,h);a.each(h,function(c){c=c.input;if(c[l])try{delete c[l]}catch(a){c[l]= b}});h=null;return c},now:Date.now||function(){return+new Date}})})(KISSY); (function(a,b){var i=/^[\s\xa0]+|[\s\xa0]+$/g,k=String.prototype.trim,g=/\\?\{([^{}]+)\}/g;a.mix(a,{trim:k?function(a){return null==a?"":k.call(a)}:function(a){return null==a?"":(a+"").replace(i,"")},substitute:function(a,i,e){return"string"!=typeof a||!i?a:a.replace(e||g,function(a,d){return"\\"===a.charAt(0)?a.slice(1):i[d]===b?"":i[d]})},ucfirst:function(a){a+="";return a.charAt(0).toUpperCase()+a.substring(1)},startsWith:function(a,b){return 0===a.lastIndexOf(b,0)},endsWith:function(a,b){var e= a.length-b.length;return 0<=e&&a.indexOf(b,e)==e}})})(KISSY); (function(a,b){var i={},k=Object.prototype.toString;a.mix(a,{isBoolean:0,isNumber:0,isString:0,isFunction:0,isArray:0,isDate:0,isRegExp:0,isObject:0,type:function(a){return null==a?""+a:i[k.call(a)]||"object"},isNull:function(a){return null===a},isUndefined:function(a){return a===b},isEmptyObject:function(a){for(var j in a)if(j!==b)return!1;return!0},isPlainObject:function(g){if(!g||"object"!==a.type(g)||g.nodeType||g.window==g)return!1;try{if(g.constructor&&!Object.prototype.hasOwnProperty.call(g, "constructor")&&!Object.prototype.hasOwnProperty.call(g.constructor.prototype,"isPrototypeOf"))return!1}catch(j){return!1}for(var i in g);return i===b||Object.prototype.hasOwnProperty.call(g,i)}});a.each("Boolean,Number,String,Function,Array,Date,RegExp,Object".split(","),function(b,j){i["[object "+b+"]"]=j=b.toLowerCase();a["is"+b]=function(b){return a.type(b)==j}})})(KISSY); (function(a,b){function i(a,d,e){if(a instanceof l)return e(a[h]);var f=a[h];if(a=a[c])a.push([d,e]);else if(g(f))i(f,d,e);else return d&&d(f);return b}function k(a){if(!(this instanceof k))return new k(a);this.promise=a||new j}function g(a){return a&&a instanceof j}function j(a){this[h]=a;a===b&&(this[c]=[])}function l(a){if(a instanceof l)return a;j.apply(this,arguments);return b}function e(a,c,b){function d(a){try{return c?c(a):a}catch(b){return new l(b)}}function e(a){try{return b?b(a):new l(a)}catch(c){return new l(c)}} function h(a){g||(g=1,f.resolve(d(a)))}var f=new k,g=0;a instanceof j?i(a,h,function(a){g||(g=1,f.resolve(e(a)))}):h(a);return f.promise}function f(a){return!d(a)&&g(a)&&a[c]===b&&(!g(a[h])||f(a[h]))}function d(a){return g(a)&&a[c]===b&&a[h]instanceof l}var h="__promise_value",c="__promise_pendings";k.prototype={constructor:k,resolve:function(d){var e=this.promise,f;if(!(f=e[c]))return b;e[h]=d;f=[].concat(f);e[c]=b;a.each(f,function(a){i(e,a[0],a[1])});return d},reject:function(a){return this.resolve(new l(a))}}; j.prototype={constructor:j,then:function(a,c){return e(this,a,c)},fail:function(a){return e(this,0,a)},fin:function(a){return e(this,function(c){return a(c,!0)},function(c){return a(c,!1)})},isResolved:function(){return f(this)},isRejected:function(){return d(this)}};a.extend(l,j);KISSY.Defer=k;KISSY.Promise=j;j.Defer=k;a.mix(j,{when:e,isPromise:g,isResolved:f,isRejected:d,all:function(a){var c=a.length;if(!c)return a;for(var b=k(),d=0;d<a.length;d++)(function(d,h){e(d,function(d){a[h]=d;0===--c&& b.resolve(a)},function(a){b.reject(a)})})(a[d],d);return b.promise}})})(KISSY); (function(a){function b(a,b){for(var i=0,e=a.length-1,f=[],d;0<=e;e--)d=a[e],"."!=d&&(".."===d?i++:i?i--:f[f.length]=d);if(b)for(;i--;i)f[f.length]="..";return f=f.reverse()}var i=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/,k={resolve:function(){var g="",j,i=arguments,e,f=0;for(j=i.length-1;0<=j&&!f;j--)e=i[j],"string"==typeof e&&e&&(g=e+"/"+g,f="/"==e.charAt(0));g=b(a.filter(g.split("/"),function(a){return!!a}),!f).join("/");return(f?"/":"")+g||"."},normalize:function(g){var j= "/"==g.charAt(0),i="/"==g.slice(-1),g=b(a.filter(g.split("/"),function(a){return!!a}),!j).join("/");!g&&!j&&(g=".");g&&i&&(g+="/");return(j?"/":"")+g},join:function(){var b=a.makeArray(arguments);return k.normalize(a.filter(b,function(a){return a&&"string"==typeof a}).join("/"))},relative:function(b,j){var b=k.normalize(b),j=k.normalize(j),i=a.filter(b.split("/"),function(a){return!!a}),e=[],f,d,h=a.filter(j.split("/"),function(a){return!!a});d=Math.min(i.length,h.length);for(f=0;f<d&&i[f]==h[f];f++); for(d=f;f<i.length;)e.push(".."),f++;e=e.concat(h.slice(d));return e=e.join("/")},basename:function(a,b){var k;k=(a.match(i)||[])[3]||"";b&&k&&k.slice(-1*b.length)==b&&(k=k.slice(0,-1*b.length));return k},dirname:function(a){var b=a.match(i)||[],a=b[1]||"",b=b[2]||"";if(!a&&!b)return".";b&&(b=b.substring(0,b.length-1));return a+b},extname:function(a){return(a.match(i)||[])[4]||""}};a.Path=k})(KISSY); (function(a,b){function i(c){c._queryMap||(c._queryMap=a.unparam(c._query))}function k(a){this._query=a||""}function g(a,c){return encodeURI(a).replace(c,function(a){a=a.charCodeAt(0).toString(16);return"%"+(1==a.length?"0"+a:a)})}function j(c){if(c instanceof j)return c.clone();var b=this;a.mix(b,{scheme:"",userInfo:"",hostname:"",port:"",path:"",query:"",fragment:""});c=j.getComponents(c);a.each(c,function(c,d){c=c||"";if("query"==d)b.query=new k(c);else{try{c=a.urlDecode(c)}catch(e){}b[d]=c}}); return b}var l=/[#\/\?@]/g,e=/[#\?]/g,f=/[#@]/g,d=/#/g,h=RegExp("^(?:([\\w\\d+.-]+):)?(?://(?:([^/?#@]*)@)?([\\w\\d\\-\\u0100-\\uffff.+%]*|\\[[^\\]]+\\])(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$"),c=a.Path,m={scheme:1,userInfo:2,hostname:3,port:4,path:5,query:6,fragment:7};k.prototype={constructor:k,clone:function(){return new k(this.toString())},reset:function(a){this._query=a||"";this._queryMap=null;return this},count:function(){var c,b=0,d;i(this);c=this._queryMap;for(d in c)a.isArray(c[d])? b+=c[d].length:b++;return b},has:function(c){var b;i(this);b=this._queryMap;return c?c in b:!a.isEmptyObject(b)},get:function(a){var c;i(this);c=this._queryMap;return a?c[a]:c},keys:function(){i(this);return a.keys(this._queryMap)},set:function(c,b){var d;i(this);d=this._queryMap;"string"==typeof c?this._queryMap[c]=b:(c instanceof k&&(c=c.get()),a.each(c,function(a,c){d[c]=a}));return this},remove:function(a){i(this);a?delete this._queryMap[a]:this._queryMap={};return this},add:function(c,d){var e= this,h,f;a.isObject(c)?(c instanceof k&&(c=c.get()),a.each(c,function(a,c){e.add(c,a)})):(i(e),h=e._queryMap,f=h[c],f=f===b?d:[].concat(f).concat(d),h[c]=f);return e},toString:function(c){i(this);return a.param(this._queryMap,b,b,c)}};j.prototype={constructor:j,clone:function(){var c=new j,b=this;a.each(m,function(a,d){c[d]=b[d]});c.query=c.query.clone();return c},resolve:function(b){"string"==typeof b&&(b=new j(b));var d=0,e,h=this.clone();a.each("scheme,userInfo,hostname,port,path,query,fragment".split(","), function(f){if(f=="path")if(d)h[f]=b[f];else{if(f=b.path){d=1;if(!a.startsWith(f,"/"))if(h.hostname&&!h.path)f="/"+f;else if(h.path){e=h.path.lastIndexOf("/");e!=-1&&(f=h.path.slice(0,e+1)+f)}h.path=c.normalize(f)}}else if(f=="query"){if(d||b.query.toString()){h.query=b.query.clone();d=1}}else if(d||b[f]){h[f]=b[f];d=1}});return h},getScheme:function(){return this.scheme},setScheme:function(a){this.scheme=a;return this},getHostname:function(){return this.hostname},setHostname:function(a){this.hostname= a;return this},setUserInfo:function(a){this.userInfo=a;return this},getUserInfo:function(){return this.userInfo},setPort:function(a){this.port=a;return this},getPort:function(){return this.port},setPath:function(a){this.path=a;return this},getPath:function(){return this.path},setQuery:function(c){"string"==typeof c&&(a.startsWith(c,"?")&&(c=c.slice(1)),c=new k(g(c,f)));this.query=c;return this},getQuery:function(){return this.query},getFragment:function(){return this.fragment},setFragment:function(c){a.startsWith(c, "#")&&(c=c.slice(1));this.fragment=c;return this},isSameOriginAs:function(a){return this.hostname.toLowerCase()==a.hostname.toLowerCase()&&this.scheme.toLowerCase()==a.scheme.toLowerCase()&&this.port.toLowerCase()==a.port.toLowerCase()},toString:function(b){var h=[],f,m;if(f=this.scheme)h.push(g(f,l)),h.push(":");if(f=this.hostname){h.push("//");if(m=this.userInfo)h.push(g(m,l)),h.push("@");h.push(encodeURIComponent(f));if(m=this.port)h.push(":"),h.push(m)}if(m=this.path)f&&!a.startsWith(m,"/")&& (m="/"+m),m=c.normalize(m),h.push(g(m,e));if(b=this.query.toString.call(this.query,b))h.push("?"),h.push(b);if(b=this.fragment)h.push("#"),h.push(g(b,d));return h.join("")}};j.Query=k;j.getComponents=function(c){var b=(c||"").match(h)||[],d={};a.each(m,function(a,c){d[c]=b[a]});return d};a.Uri=j})(KISSY); (function(a,b){function i(a){var c;return(c=a.match(/MSIE\s([^;]*)/))&&c[1]?n(c[1]):0}var k=a.Env.host,g=k.document,k=(k=k.navigator)&&k.userAgent||"",j,l="",e="",f,d=[6,9],h=g&&g.createElement("div"),c=[],m=KISSY.UA={webkit:b,trident:b,gecko:b,presto:b,chrome:b,safari:b,firefox:b,ie:b,opera:b,mobile:b,core:b,shell:b,phantomjs:b,os:b,ipad:b,iphone:b,ipod:b,ios:b,android:b,nodejs:b},n=function(a){var c=0;return parseFloat(a.replace(/\./g,function(){return 0===c++?".":""}))};h&&(h.innerHTML="<\!--[if IE {{version}}]><s></s><![endif]--\>".replace("{{version}}", ""),c=h.getElementsByTagName("s"));if(0<c.length){e="ie";m[l="trident"]=0.1;if((f=k.match(/Trident\/([\d.]*)/))&&f[1])m[l]=n(f[1]);f=d[0];for(d=d[1];f<=d;f++)if(h.innerHTML="<\!--[if IE {{version}}]><s></s><![endif]--\>".replace("{{version}}",f),0<c.length){m[e]=f;break}var p;if(!m.ie&&(p=i(k)))m[e="ie"]=p}else if((f=k.match(/AppleWebKit\/([\d.]*)/))&&f[1]){m[l="webkit"]=n(f[1]);if((f=k.match(/Chrome\/([\d.]*)/))&&f[1])m[e="chrome"]=n(f[1]);else if((f=k.match(/\/([\d.]*) Safari/))&&f[1])m[e="safari"]= n(f[1]);if(/ Mobile\//.test(k)&&k.match(/iPad|iPod|iPhone/)){m.mobile="apple";if((f=k.match(/OS ([^\s]*)/))&&f[1])m.ios=n(f[1].replace("_","."));j="ios";if((f=k.match(/iPad|iPod|iPhone/))&&f[0])m[f[0].toLowerCase()]=m.ios}else if(/ Android/.test(k)){if(/Mobile/.test(k)&&(j=m.mobile="android"),(f=k.match(/Android ([^\s]*);/))&&f[1])m.android=n(f[1])}else if(f=k.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/))m.mobile=f[0].toLowerCase();if((f=k.match(/PhantomJS\/([^\s]*)/))&&f[1])m.phantomjs=n(f[1])}else if((f= k.match(/Presto\/([\d.]*)/))&&f[1]){if(m[l="presto"]=n(f[1]),(f=k.match(/Opera\/([\d.]*)/))&&f[1]){m[e="opera"]=n(f[1]);if((f=k.match(/Opera\/.* Version\/([\d.]*)/))&&f[1])m[e]=n(f[1]);if((f=k.match(/Opera Mini[^;]*/))&&f)m.mobile=f[0].toLowerCase();else if((f=k.match(/Opera Mobi[^;]*/))&&f)m.mobile=f[0]}}else if((f=k.match(/MSIE\s([^;]*)/))&&f[1]){if(m[l="trident"]=0.1,m[e="ie"]=n(f[1]),(f=k.match(/Trident\/([\d.]*)/))&&f[1])m[l]=n(f[1])}else if(f=k.match(/Gecko/)){m[l="gecko"]=0.1;if((f=k.match(/rv:([\d.]*)/))&& f[1])m[l]=n(f[1]);if((f=k.match(/Firefox\/([\d.]*)/))&&f[1])m[e="firefox"]=n(f[1])}j||(/windows|win32/i.test(k)?j="windows":/macintosh|mac_powerpc/i.test(k)?j="macintosh":/linux/i.test(k)?j="linux":/rhino/i.test(k)&&(j="rhino"));if("object"===typeof process){var o,q;if((o=process.versions)&&(q=o.node))j=process.platform,m.nodejs=n(q)}m.os=j;m.core=l;m.shell=e;m._numberify=n;j="webkit,trident,gecko,presto,chrome,safari,firefox,ie,opera".split(",");var g=g&&g.documentElement,r="";g&&(a.each(j,function(a){var c= m[a];if(c){r=r+(" ks-"+a+(parseInt(c)+""));r=r+(" ks-"+a)}}),a.trim(r)&&(g.className=a.trim(g.className+r)))})(KISSY);(function(a){var b=a.Env,i=b.host,k=a.UA,g=i.document||{},j="ontouchstart"in g&&!k.phantomjs,l=(g=g.documentMode)||k.ie,e=(b.nodejs&&"object"===typeof global?global:i).JSON;g&&9>g&&(e=0);a.Features={isTouchSupported:function(){return j},isDeviceMotionSupported:function(){return!!i.DeviceMotionEvent},isHashChangeSupported:function(){return"onhashchange"in i&&(!l||7<l)},isNativeJSONSupported:function(){return e}}})(KISSY); (function(a){function b(a){this.runtime=a}b.Status={INIT:0,LOADING:1,LOADED:2,ERROR:3,ATTACHED:4};a.Loader=b;a.Loader.Status=b.Status})(KISSY); (function(a){function b(a,b,j){a=a[i]||(a[i]={});j&&(a[b]=a[b]||[]);return a[b]}a.namespace("Loader");var i="__events__"+a.now();KISSY.Loader.Target={on:function(a,g){b(this,a,1).push(g)},detach:function(k,g){var j,l;if(k){if(j=b(this,k))g&&(l=a.indexOf(g,j),-1!=l&&j.splice(l,1)),(!g||!j.length)&&delete (this[i]||(this[i]={}))[k]}else delete this[i]},fire:function(a,g){var j=b(this,a)||[],i,e=j.length;for(i=0;i<e;i++)j[i].call(null,g)}}})(KISSY); (function(a){function b(a){if("string"==typeof a)return i(a);for(var c=[],b=0,d=a.length;b<d;b++)c[b]=i(a[b]);return c}function i(a){"/"==a.charAt(a.length-1)&&(a+="index");return a}function k(c,b,d){var c=c.Env.mods,e,h,b=a.makeArray(b);for(h=0;h<b.length;h++)if(e=c[b[h]],!e||e.status!==d)return 0;return 1}var g=a.Loader,j=a.Path,l=a.Env.host,e=a.startsWith,f=g.Status,d=f.ATTACHED,h=f.LOADED,c=a.Loader.Utils={},m=l.document;a.mix(c,{docHead:function(){return m.getElementsByTagName("head")[0]||m.documentElement}, normalDepModuleName:function(a,b){var d=0,h;if(!b)return b;if("string"==typeof b)return e(b,"../")||e(b,"./")?j.resolve(j.dirname(a),b):j.normalize(b);for(h=b.length;d<h;d++)b[d]=c.normalDepModuleName(a,b[d]);return b},createModulesInfo:function(b,d){a.each(d,function(a){c.createModuleInfo(b,a)})},createModuleInfo:function(c,b,d){var b=i(b),e=c.Env.mods,h=e[b];return h?h:e[b]=h=new g.Module(a.mix({name:b,runtime:c},d))},isAttached:function(a,c){return k(a,c,d)},isLoaded:function(a,c){return k(a,c, h)},getModules:function(b,e){var h=[b],f,m,g,j,i=b.Env.mods;a.each(e,function(e){f=i[e];if(!f||"css"!=f.getType())m=c.unalias(b,e),(g=a.reduce(m,function(a,c){j=i[c];return a&&j&&j.status==d},!0))?h.push(i[m[0]].value):h.push(null)});return h},attachModsRecursively:function(a,b,d){var d=d||[],e,h=1,f=a.length,m=d.length;for(e=0;e<f;e++)h=c.attachModRecursively(a[e],b,d)&&h,d.length=m;return h},attachModRecursively:function(b,e,f){var m,g=e.Env.mods[b];if(!g)return 0;m=g.status;if(m==d)return 1;if(m!= h)return 0;if(a.Config.debug){if(a.inArray(b,f))return f.push(b),0;f.push(b)}return c.attachModsRecursively(g.getNormalizedRequires(),e,f)?(c.attachMod(e,g),1):0},attachMod:function(a,b){if(b.status==h){var e=b.fn;e&&(b.value=e.apply(b,c.getModules(a,b.getRequiresWithAlias())));b.status=d;a.getLoader().fire("afterModAttached",{mod:b})}},getModNamesAsArray:function(a){"string"==typeof a&&(a=a.replace(/\s+/g,"").split(","));return a},normalizeModNames:function(a,b,d){return c.unalias(a,c.normalizeModNamesWithAlias(a, b,d))},unalias:function(a,c){for(var d=[].concat(c),e,h,f,m=0,g,j=a.Env.mods;!m;){m=1;for(e=d.length-1;0<=e;e--)if((h=j[d[e]])&&(f=h.alias)){m=0;for(g=f.length-1;0<=g;g--)f[g]||f.splice(g,1);d.splice.apply(d,[e,1].concat(b(f)))}}return d},normalizeModNamesWithAlias:function(a,d,e){var a=[],h,f;if(d){h=0;for(f=d.length;h<f;h++)d[h]&&a.push(b(d[h]))}e&&(a=c.normalDepModuleName(e,a));return a},registerModule:function(b,d,e,f){var m=b.Env.mods,g=m[d];if(!g||!g.fn)c.createModuleInfo(b,d),g=m[d],a.mix(g, {name:d,status:h,fn:e}),a.mix(g,f)},getMappedPath:function(a,c,b){for(var a=b||a.Config.mappedRules||[],d,b=0;b<a.length;b++)if(d=a[b],c.match(d[0]))return c.replace(d[0],d[1]);return c}})})(KISSY); (function(a){function b(a,b){return b in a?a[b]:a.runtime.Config[b]}function i(b){a.mix(this,b)}function k(b){this.status=j.Status.INIT;a.mix(this,b)}var g=a.Path,j=a.Loader,l=j.Utils;a.augment(i,{getTag:function(){return b(this,"tag")},getName:function(){return this.name},getBase:function(){return b(this,"base")},getPrefixUriForCombo:function(){var a=this.getName();return this.getBase()+(a&&!this.isIgnorePackageNameInUri()?a+"/":"")},getBaseUri:function(){return b(this,"baseUri")},isDebug:function(){return b(this, "debug")},isIgnorePackageNameInUri:function(){return b(this,"ignorePackageNameInUri")},getCharset:function(){return b(this,"charset")},isCombine:function(){return b(this,"combine")}});j.Package=i;a.augment(k,{setValue:function(a){this.value=a},getType:function(){var a=this.type;a||(this.type=a=".css"==g.extname(this.name).toLowerCase()?"css":"js");return a},getFullPath:function(){var a,b,d,h,c;if(!this.fullpath){d=this.getPackage();b=d.getBaseUri();c=this.getPath();if(d.isIgnorePackageNameInUri()&& (h=d.getName()))c=g.relative(h,c);b=b.resolve(c);(a=this.getTag())&&b.query.set("t",a);this.fullpath=l.getMappedPath(this.runtime,b.toString())}return this.fullpath},getPath:function(){var a;if(!(a=this.path)){a=this.name;var b="."+this.getType(),d="-min";a=g.join(g.dirname(a),g.basename(a,b));this.getPackage().isDebug()&&(d="");a=this.path=a+d+b}return a},getValue:function(){return this.value},getName:function(){return this.name},getPackage:function(){var b;if(!(b=this.packageInfo)){b=this.runtime; var f=this.name,d=b.config("packages"),h="",c;for(c in d)a.startsWith(f,c)&&c.length>h.length&&(h=c);b=this.packageInfo=d[h]||b.config("systemPackage")}return b},getTag:function(){return this.tag||this.getPackage().getTag()},getCharset:function(){return this.charset||this.getPackage().getCharset()},getRequiredMods:function(){var b=this.runtime;return a.map(this.getNormalizedRequires(),function(a){return l.createModuleInfo(b,a)})},getRequiresWithAlias:function(){var a=this.requiresWithAlias,b=this.requires; if(!b||0==b.length)return b||[];a||(this.requiresWithAlias=a=l.normalizeModNamesWithAlias(this.runtime,b,this.name));return a},getNormalizedRequires:function(){var a,b=this.normalizedRequiresStatus,d=this.status,h=this.requires;if(!h||0==h.length)return h||[];if((a=this.normalizedRequires)&&b==d)return a;this.normalizedRequiresStatus=d;return this.normalizedRequires=l.normalizeModNames(this.runtime,h,this.name)}});j.Module=k})(KISSY); (function(a){function b(){for(var l in j){var e=j[l],f=e.node,d,h=0;if(k.webkit)f.sheet&&(h=1);else if(f.sheet)try{f.sheet.cssRules&&(h=1)}catch(c){d=c.name,"NS_ERROR_DOM_SECURITY_ERR"==d&&(h=1)}h&&(e.callback&&e.callback.call(f),delete j[l])}g=a.isEmptyObject(j)?0:setTimeout(b,i)}var i=30,k=a.UA,g=0,j={};a.mix(a.Loader.Utils,{pollCss:function(a,e){var f;f=j[a.href]={};f.node=a;f.callback=e;g||b()}})})(KISSY); (function(a){var b=a.Env.host.document,i=a.Loader.Utils,k=a.Path,g={},j=536>a.UA.webkit;a.mix(a,{getScript:function(l,e,f){var d=e,h=0,c,m,n,p;a.startsWith(k.extname(l).toLowerCase(),".css")&&(h=1);a.isPlainObject(d)&&(e=d.success,c=d.error,m=d.timeout,f=d.charset,n=d.attrs);d=g[l]=g[l]||[];d.push([e,c]);if(1<d.length)return d.node;var e=i.docHead(),o=b.createElement(h?"link":"script");n&&a.each(n,function(a,b){o.setAttribute(b,a)});h?(o.href=l,o.rel="stylesheet"):(o.src=l,o.async=!0);d.node=o;f&& (o.charset=f);var q=function(b){var c;if(p){p.cancel();p=void 0}a.each(g[l],function(a){(c=a[b])&&c.call(o)});delete g[l]},f=!h;h&&(f=j?!1:"onload"in o);f?(o.onload=o.onreadystatechange=function(){var a=o.readyState;if(!a||a=="loaded"||a=="complete"){o.onreadystatechange=o.onload=null;q(0)}},o.onerror=function(){o.onerror=null;q(1)}):i.pollCss(o,function(){q(0)});m&&(p=a.later(function(){q(1)},1E3*m));h?e.appendChild(o):e.insertBefore(o,e.firstChild);return o}})})(KISSY); (function(a,b){function i(b){"/"!=b.charAt(b.length-1)&&(b+="/");l?b=l.resolve(b):(a.startsWith(b,"file:")||(b="file:"+b),b=new a.Uri(b));return b}var k=a.Loader,g=k.Utils,j=a.Env.host.location,l,e,f=a.Config.fns;if(!a.Env.nodejs&&j&&(e=j.href))l=new a.Uri(e);f.map=function(a){var b=this.Config;return!1===a?b.mappedRules=[]:b.mappedRules=(b.mappedRules||[]).concat(a||[])};f.mapCombo=function(a){var b=this.Config;return!1===a?b.mappedComboRules=[]:b.mappedComboRules=(b.mappedComboRules||[]).concat(a|| [])};f.packages=function(d){var h,c=this.Config,e=c.packages=c.packages||{};return d?(a.each(d,function(b,c){h=b.name||c;var d=i(b.base||b.path);b.name=h;b.base=d.toString();b.baseUri=d;b.runtime=a;delete b.path;e[h]=new k.Package(b)}),b):!1===d?(c.packages={},b):e};f.modules=function(b){var h=this,c=h.Env;b&&a.each(b,function(b,d){g.createModuleInfo(h,d,b);a.mix(c.mods[d],b)})};f.base=function(a){var h=this.Config;if(!a)return h.base;a=i(a);h.base=a.toString();h.baseUri=a;return b}})(KISSY); (function(a){var b=a.Loader,i=a.UA,k=b.Utils;a.augment(b,b.Target,{__currentMod:null,__startLoadTime:0,__startLoadModName:null,add:function(b,j,l){var e=this.runtime;if("string"==typeof b)k.registerModule(e,b,j,l);else if(a.isFunction(b))if(l=j,j=b,i.ie){var b=a.Env.host.document.getElementsByTagName("script"),f,d,h;for(d=b.length-1;0<=d;d--)if(h=b[d],"interactive"==h.readyState){f=h;break}b=f?f.getAttribute("data-mod-name"):this.__startLoadModName;k.registerModule(e,b,j,l);this.__startLoadModName= null;this.__startLoadTime=0}else this.__currentMod={fn:j,config:l}}})})(KISSY); (function(a,b){function i(b){a.mix(this,{fn:b,waitMods:{},requireLoadedMods:{}})}function k(a,b,d){var f,m=b.length;for(f=0;f<m;f++){var j=a,i=b[f],k=d,l=j.runtime,w=void 0,A=void 0,w=l.Env.mods,y=w[i];y||(e.createModuleInfo(l,i),y=w[i]);w=y.status;w!=n&&(w===c?k.loadModRequires(j,y):(A=k.isModWait(i),A||(k.addWaitMod(i),w<=h&&g(j,y,k))))}}function g(c,g,j){function i(){g.fn?(d[l]||(d[l]=1),j.loadModRequires(c,g),j.removeWaitMod(l),j.check()):g.status=m}var k=c.runtime,l=g.getName(),n=g.getCharset(), v=g.getFullPath(),x=0,w=f.ie,A="css"==g.getType();g.status=h;w&&!A&&(c.__startLoadModName=l,c.__startLoadTime=Number(+new Date));a.getScript(v,{attrs:w?{"data-mod-name":l}:b,success:function(){if(g.status==h)if(A)e.registerModule(k,l,a.noop);else if(x=c.__currentMod){e.registerModule(k,l,x.fn,x.config);c.__currentMod=null}a.later(i)},error:i,charset:n})}var j,l,e,f,d={},h,c,m,n;j=a.Loader;l=j.Status;e=j.Utils;f=a.UA;h=l.LOADING;c=l.LOADED;m=l.ERROR;n=l.ATTACHED;i.prototype={check:function(){var b= this.fn;b&&a.isEmptyObject(this.waitMods)&&(b(),this.fn=null)},addWaitMod:function(a){this.waitMods[a]=1},removeWaitMod:function(a){delete this.waitMods[a]},isModWait:function(a){return this.waitMods[a]},loadModRequires:function(a,b){var c=this.requireLoadedMods,d=b.name;c[d]||(c[d]=1,c=b.getNormalizedRequires(),k(a,c,this))}};a.augment(j,{use:function(a,b,c){var d,h=new i(function(){e.attachModsRecursively(d,f);b&&b.apply(f,e.getModules(f,a))}),f=this.runtime,a=e.getModNamesAsArray(a),a=e.normalizeModNamesWithAlias(f, a);d=e.unalias(f,a);k(this,d,h);c?h.check():setTimeout(function(){h.check()},0);return this}})})(KISSY); (function(a,b){function i(b,c,d){var h=b&&b.length;h?a.each(b,function(b){a.getScript(b,function(){--h||c()},d)}):c()}function k(b){a.mix(this,{runtime:b,queue:[],loading:0})}function g(a){if(a.queue.length){var b=a.queue.shift();l(a,b)}}function j(a,b){a.queue.push(b)}function l(b,c){function d(){w&&x&&(m.attachModsRecursively(g,B)?j.apply(null,m.getModules(B,h)):l(b,c))}var h=c.modNames,g=c.unaliasModNames,j=c.fn,k,u,v,x,w,A,y,B=b.runtime;b.loading=1;k=b.calculate(g);m.createModulesInfo(B,k);k= b.getComboUrls(k);u=k.css;A=0;for(y in u)A++;x=0;w=!A;for(y in u)i(u[y],function(){if(!--A){for(y in u)a.each(u[y].mods,function(b){m.registerModule(B,b.name,a.noop)});e(u);w=1;d()}},u[y].charset);v=k.js;f(v,function(a){(x=a)&&e(v);d()})}function e(b){if(a.Config.debug){var c=[],d,h=[];for(d in b)h.push.apply(h,b[d]),a.each(b[d].mods,function(a){c.push(a.name)})}}function f(d,h){var e,f,m=0;for(e in d)m++;if(m)for(e in f=1,d)(function(e){i(d[e],function(){a.each(d[e].mods,function(a){return!a.fn? (a.status=c.ERROR,f=0,!1):b});f&&!--m&&h(1)},d[e].charset)})(e);else h(1)}function d(b,c,h){var e=b.runtime,f,g;f=b.runtime.Env.mods[c];var j=h[c];if(j)return j;h[c]=j={};if(f&&!m.isAttached(e,c)){c=f.getNormalizedRequires();for(f=0;f<c.length;f++)g=c[f],!m.isLoaded(e,g)&&!m.isAttached(e,g)&&(j[g]=1),g=d(b,g,h),a.mix(j,g)}return j}var h=a.Loader,c=h.Status,m=h.Utils;a.augment(k,h.Target);a.augment(k,{clear:function(){this.loading=0},use:function(a,b,c){var d=this,h=d.runtime,a=m.getModNamesAsArray(a), a=m.normalizeModNamesWithAlias(h,a),e=m.unalias(h,a);m.isAttached(h,e)?b&&(c?b.apply(null,m.getModules(h,a)):setTimeout(function(){b.apply(null,m.getModules(h,a))},0)):(j(d,{modNames:a,unaliasModNames:e,fn:function(){setTimeout(function(){d.loading=0;g(d)},0);b&&b.apply(this,arguments)}}),d.loading||g(d))},add:function(a,b,c){m.registerModule(this.runtime,a,b,c)},calculate:function(b){var c={},h,e,f,g=this.runtime,j={};for(h=0;h<b.length;h++)e=b[h],m.isAttached(g,e)||(m.isLoaded(g,e)||(c[e]=1),a.mix(c, d(this,e,j)));b=[];for(f in c)b.push(f);return b},getComboUrls:function(b){var c=this,d,h=c.runtime,e=h.Config,f={};a.each(b,function(a){var a=c.runtime.Env.mods[a],b=a.getPackage(),d=a.getType(),h,e=b.getName();f[e]=f[e]||{};if(!(h=f[e][d]))h=f[e][d]=f[e][d]||[],h.packageInfo=b;h.push(a)});var g={js:{},css:{}},j,i,k,b=e.comboPrefix,l=e.comboSep,A=e.comboMaxFileNum,y=e.comboMaxUrlLength;for(i in f)for(k in f[i]){j=[];var B=f[i][k],D=B.packageInfo,C=(d=D.getTag())?"?t="+encodeURIComponent(d):"",I= C.length,z,F,K,J=D.getPrefixUriForCombo();g[k][i]=[];g[k][i].charset=D.getCharset();g[k][i].mods=[];z=J+b;K=z.length;var L=function(){g[k][i].push(m.getMappedPath(h,z+j.join(l)+C,e.mappedComboRules))};for(d=0;d<B.length;d++)if(F=B[d].getFullPath(),g[k][i].mods.push(B[d]),!D.isCombine()||!a.startsWith(F,J))g[k][i].push(F);else if(F=F.slice(J.length).replace(/\?.*$/,""),j.push(F),j.length>A||K+j.join(l).length+I>y)j.pop(),L(),j=[],d--;j.length&&L()}return g}});h.Combo=k})(KISSY); (function(a,b){function i(){var e=/^(.*)(seed|kissy)(?:-min)?\.js[^/]*/i,f=/(seed|kissy)(?:-min)?\.js/i,d,h,c=g.host.document.getElementsByTagName("script"),m=c[c.length-1],c=m.src,m=(m=m.getAttribute("data-config"))?(new Function("return "+m))():{};d=m.comboPrefix=m.comboPrefix||"??";h=m.comboSep=m.comboSep||",";var j,i=c.indexOf(d);-1==i?j=c.replace(e,"$1"):(j=c.substring(0,i),"/"!=j.charAt(j.length-1)&&(j+="/"),c=c.substring(i+d.length).split(h),a.each(c,function(a){return a.match(f)?(j+=a.replace(e, "$1"),!1):b}));return a.mix({base:j},m)}a.mix(a,{add:function(a,b,d){this.getLoader().add(a,b,d)},use:function(a,b){var d=this.getLoader();d.use.apply(d,arguments)},getLoader:function(){var a=this.Env;return this.Config.combine&&!a.nodejs?a._comboLoader:a._loader},require:function(a){return j.getModules(this,[a])[1]}});var k=a.Loader,g=a.Env,j=k.Utils,l=a.Loader.Combo;a.Env.nodejs?a.config({charset:"utf-8",base:__dirname.replace(/\\/g,"/").replace(/\/$/,"")+"/"}):a.config(a.mix({comboMaxUrlLength:2E3, comboMaxFileNum:40,charset:"utf-8",tag:"20130701201313"},i()));a.config("systemPackage",new k.Package({name:"",runtime:a}));g.mods={};g._loader=new k(a);l&&(g._comboLoader=new l(a))})(KISSY); (function(a,b){function i(){j&&o(k,n,i);f.resolve(a)}var k=a.Env.host,g=a.UA,j=k.document,l=j&&j.documentElement,e=k.location,f=new a.Defer,d=f.promise,h=/^#?([\w-]+)$/,c=/\S/,m=!(!j||!j.addEventListener),n="load",p=m?function(a,b,c){a.addEventListener(b,c,!1)}:function(a,b,c){a.attachEvent("on"+b,c)},o=m?function(a,b,c){a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent("on"+b,c)};a.mix(a,{isWindow:function(a){return null!=a&&a==a.window},parseXML:function(a){if(a.documentElement)return a; var c;try{k.DOMParser?c=(new DOMParser).parseFromString(a,"text/xml"):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async=!1,c.loadXML(a))}catch(d){c=b}!c||!c.documentElement||c.getElementsByTagName("parsererror");return c},globalEval:function(a){a&&c.test(a)&&(k.execScript||function(a){k.eval.call(k,a)})(a)},ready:function(a){d.then(a);return this},available:function(b,c){var b=(b+"").match(h)[1],d=1,e,f=a.later(function(){((e=j.getElementById(b))&&(c(e)||1)||500<++d)&&f.cancel()},40,!0)}});if(e&&-1!== (e.search||"").indexOf("ks-debug"))a.Config.debug=!0;(function(){if(!j||"complete"===j.readyState)i();else if(p(k,n,i),m){var a=function(){o(j,"DOMContentLoaded",a);i()};p(j,"DOMContentLoaded",a)}else{var b=function(){"complete"===j.readyState&&(o(j,"readystatechange",b),i())};p(j,"readystatechange",b);var c,d=l&&l.doScroll;try{c=null===k.frameElement}catch(h){c=!1}if(d&&c){var e=function(){try{d("left"),i()}catch(a){setTimeout(e,40)}};e()}}})();if(g.ie)try{j.execCommand("BackgroundImageCache",!1, !0)}catch(q){}})(KISSY,void 0);(function(a){var b=a.startsWith(location.href,"https")?"https://s.tbcdn.cn/s/kissy/":"http://a.tbcdn.cn/s/kissy/";a.config({packages:{gallery:{base:b},mobile:{base:b}},modules:{core:{alias:"dom,event,ajax,anim,base,node,json,ua,cookie".split(",")}}})})(KISSY); (function(a,b,i){a({ajax:{requires:["dom","json","event"]}});a({anim:{requires:["dom","event"]}});a({base:{requires:["event/custom"]}});a({button:{requires:["component/base","event"]}});a({calendar:{requires:["node","event"]}});a({color:{requires:["base"]}});a({combobox:{requires:["dom","component/base","node","menu","ajax"]}});a({"component/base":{requires:["rich-base","node","event"]}});a({"component/extension":{requires:["dom","node"]}});a({"component/plugin/drag":{requires:["rich-base","dd/base"]}}); a({"component/plugin/resize":{requires:["resizable"]}});a({datalazyload:{requires:["dom","event","base"]}});a({dd:{alias:["dd/base","dd/droppable"]}});a({"dd/base":{requires:["dom","node","event","rich-base","base"]}});a({"dd/droppable":{requires:["dd/base","dom","node","rich-base"]}});a({"dd/plugin/constrain":{requires:["base","node"]}});a({"dd/plugin/proxy":{requires:["node","base","dd/base"]}});a({"dd/plugin/scroll":{requires:["dd/base","base","node","dom"]}});a({dom:{alias:["dom/base",i.ie&&(9> i.ie||9>document.documentMode)?"dom/ie":""]}});a({"dom/ie":{requires:["dom/base"]}});a({editor:{requires:["htmlparser","component/base","core"]}});a({event:{alias:["event/base","event/dom","event/custom"]}});a({"event/custom":{requires:["event/base"]}});a({"event/dom":{alias:["event/dom/base",b.isTouchSupported()?"event/dom/touch":"",b.isDeviceMotionSupported()?"event/dom/shake":"",b.isHashChangeSupported()?"":"event/dom/hashchange",9>i.ie?"event/dom/ie":"",i.ie?"":"event/dom/focusin"]}});a({"event/dom/base":{requires:["dom", "event/base"]}});a({"event/dom/focusin":{requires:["event/dom/base"]}});a({"event/dom/hashchange":{requires:["event/dom/base","dom"]}});a({"event/dom/ie":{requires:["event/dom/base","dom"]}});a({"event/dom/shake":{requires:["event/dom/base"]}});a({"event/dom/touch":{requires:["event/dom/base","dom"]}});a({imagezoom:{requires:["node","overlay"]}});a({json:{requires:[KISSY.Features.isNativeJSONSupported()?"":"json/json2"]}});a({kison:{requires:["base"]}});a({menu:{requires:["component/extension","node", "component/base","event"]}});a({menubutton:{requires:["node","menu","button","component/base"]}});a({mvc:{requires:["event","base","ajax","json","node"]}});a({node:{requires:["dom","event/dom","anim"]}});a({overlay:{requires:["node","component/base","component/extension","event"]}});a({resizable:{requires:["node","rich-base","dd/base"]}});a({"rich-base":{requires:["base"]}});a({separator:{requires:["component/base"]}});a({"split-button":{requires:["component/base","button","menubutton"]}});a({stylesheet:{requires:["dom"]}}); a({swf:{requires:["dom","json","base"]}});a({switchable:{requires:["dom","event","anim",KISSY.Features.isTouchSupported()?"dd/base":""]}});a({tabs:{requires:["button","toolbar","component/base"]}});a({toolbar:{requires:["component/base","node"]}});a({tree:{requires:["node","component/base","event"]}});a({waterfall:{requires:["node","base"]}});a({xtemplate:{alias:["xtemplate/facade"]}});a({"xtemplate/compiler":{requires:["xtemplate/runtime"]}});a({"xtemplate/facade":{requires:["xtemplate/runtime", "xtemplate/compiler"]}})})(function(a){KISSY.config("modules",a)},KISSY.Features,KISSY.UA);(function(a){a.add("empty",a.noop);a.add("promise",function(){return a.Promise});a.add("ua",function(){return a.UA});a.add("uri",function(){return a.Uri});a.add("path",function(){return a.Path})})(KISSY); KISSY.add("dom/base/api",function(a){var b=a.Env.host,i=a.UA,k={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12},g={isCustomDomain:function(a){var a=a||b,g=a.document.domain,a=a.location.hostname;return g!=a&&g!="["+a+"]"},getEmptyIframeSrc:function(a){a=a||b;return i.ie&&g.isCustomDomain(a)?"javascript:void(function(){"+ encodeURIComponent("document.open();document.domain='"+a.document.domain+"';document.close();")+"}())":""},NodeType:k,getWindow:function(a){return!a?b:"scrollTo"in a&&a.document?a:a.nodeType==k.DOCUMENT_NODE?a.defaultView||a.parentWindow:!1},_isNodeList:function(a){return a&&!a.nodeType&&a.item&&!a.setTimeout},nodeName:function(a){var b=g.get(a),a=b.nodeName.toLowerCase();i.ie&&(b=b.scopeName)&&"HTML"!=b&&(a=b.toLowerCase()+":"+a);return a},_RE_NUM_NO_PX:RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+ ")(?!px)[a-z%]+$","i")};a.mix(g,k);return g}); KISSY.add("dom/base/attr",function(a,b,i){function k(a,b){var b=q[b]||b,c=t[b];return c&&c.get?c.get(a,b):a[b]}var g=a.Env.host.document,j=b.NodeType,l=(g=g&&g.documentElement)&&g.textContent===i?"innerText":"textContent",e=b.nodeName,f=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,d=/^(?:button|input|object|select|textarea)$/i,h=/^a(?:rea)?$/i,c=/:|^on/,m=/\r/g,n={},p={val:1,css:1,html:1,text:1,data:1,width:1,height:1, offset:1,scrollTop:1,scrollLeft:1},o={tabindex:{get:function(a){var b=a.getAttributeNode("tabindex");return b&&b.specified?parseInt(b.value,10):d.test(a.nodeName)||h.test(a.nodeName)&&a.href?0:i}}},q={hidefocus:"hideFocus",tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},r={get:function(a, c){return b.prop(a,c)?c.toLowerCase():i},set:function(a,c,d){!1===c?b.removeAttr(a,d):(c=q[d]||d,c in a&&(a[c]=!0),a.setAttribute(d,d.toLowerCase()));return d}},t={},s={},u={select:{get:function(a){var c=a.selectedIndex,d=a.options,h;if(0>c)return null;if("select-one"===a.type)return b.val(d[c]);a=[];c=0;for(h=d.length;c<h;++c)d[c].selected&&a.push(b.val(d[c]));return a},set:function(c,d){var h=a.makeArray(d);a.each(c.options,function(c){c.selected=a.inArray(b.val(c),h)});h.length||(c.selectedIndex= -1);return h}}};a.each(["radio","checkbox"],function(c){u[c]={get:function(a){return null===a.getAttribute("value")?"on":a.value},set:function(c,d){if(a.isArray(d))return c.checked=a.inArray(b.val(c),d)}}});o.style={get:function(a){return a.style.cssText}};a.mix(b,{_valHooks:u,_propFix:q,_attrHooks:o,_propHooks:t,_attrNodeHook:s,_attrFix:n,prop:function(c,d,h){var e=b.query(c),f,m;if(a.isPlainObject(d))return a.each(d,function(a,c){b.prop(e,c,a)}),i;d=q[d]||d;m=t[d];if(h!==i)for(c=e.length-1;0<=c;c--)f= e[c],m&&m.set?m.set(f,h,d):f[d]=h;else if(e.length)return k(e[0],d);return i},hasProp:function(a,c){var d=b.query(a),h,e=d.length,f;for(h=0;h<e;h++)if(f=d[h],k(f,c)!==i)return!0;return!1},removeProp:function(a,c){var c=q[c]||c,d=b.query(a),h,e;for(h=d.length-1;0<=h;h--){e=d[h];try{e[c]=i,delete e[c]}catch(f){}}},attr:function(d,h,m,g){var k=b.query(d),l=k[0];if(a.isPlainObject(h)){var g=m,q;for(q in h)b.attr(k,q,h[q],g);return i}if(!(h=a.trim(h)))return i;if(g&&p[h])return b[h](d,m);h=h.toLowerCase(); if(g&&p[h])return b[h](d,m);h=n[h]||h;d=f.test(h)?r:c.test(h)?s:o[h];if(m===i){if(l&&l.nodeType===j.ELEMENT_NODE){"form"==e(l)&&(d=s);if(d&&d.get)return d.get(l,h);h=l.getAttribute(h);return null===h?i:h}}else for(g=k.length-1;0<=g;g--)if((l=k[g])&&l.nodeType===j.ELEMENT_NODE)"form"==e(l)&&(d=s),d&&d.set?d.set(l,m,h):l.setAttribute(h,""+m);return i},removeAttr:function(a,c){var c=c.toLowerCase(),c=n[c]||c,d=b.query(a),h,e,m;for(m=d.length-1;0<=m;m--)if(e=d[m],e.nodeType==j.ELEMENT_NODE&&(e.removeAttribute(c), f.test(c)&&(h=q[c]||c)in e))e[h]=!1},hasAttr:g&&!g.hasAttribute?function(a,c){var c=c.toLowerCase(),d=b.query(a),h,e;for(h=0;h<d.length;h++)if(e=d[h],(e=e.getAttributeNode(c))&&e.specified)return!0;return!1}:function(a,c){var d=b.query(a),h,e=d.length;for(h=0;h<e;h++)if(d[h].hasAttribute(c))return!0;return!1},val:function(c,d){var h,f,g,j,k;if(d===i){if(g=b.get(c)){if((h=u[e(g)]||u[g.type])&&"get"in h&&(f=h.get(g,"value"))!==i)return f;f=g.value;return"string"===typeof f?f.replace(m,""):null==f?"": f}return i}f=b.query(c);for(j=f.length-1;0<=j;j--){g=f[j];if(1!==g.nodeType)break;k=d;null==k?k="":"number"===typeof k?k+="":a.isArray(k)&&(k=a.map(k,function(a){return a==null?"":a+""}));h=u[e(g)]||u[g.type];if(!h||!("set"in h)||h.set(g,k,"value")===i)g.value=k}return i},text:function(a,c){var d,h,e;if(c===i){d=b.get(a);if(d.nodeType==j.ELEMENT_NODE)return d[l]||"";if(d.nodeType==j.TEXT_NODE)return d.nodeValue}else{h=b.query(a);for(e=h.length-1;0<=e;e--)d=h[e],d.nodeType==j.ELEMENT_NODE?d[l]=c:d.nodeType== j.TEXT_NODE&&(d.nodeValue=c)}return i}});return b},{requires:["./api"]});KISSY.add("dom/base",function(a,b){a.mix(a,{DOM:b,get:b.get,query:b.query});return b},{requires:"./base/api,./base/attr,./base/class,./base/create,./base/data,./base/insertion,./base/offset,./base/style,./base/selector,./base/traversal".split(",")}); KISSY.add("dom/base/class",function(a,b,i){function k(e,f,d,h){if(!(f=a.trim(f)))return h?!1:i;var e=b.query(e),c=e.length,m=f.split(j),f=[],k,l;for(l=0;l<m.length;l++)(k=a.trim(m[l]))&&f.push(k);for(l=0;l<c;l++)if(m=e[l],m.nodeType==g.ELEMENT_NODE&&(m=d(m,f,f.length),m!==i))return m;return h?!1:i}var g=b.NodeType,j=/[\.\s]\s*\.?/,l=/[\n\t]/g;a.mix(b,{hasClass:function(a,b){return k(a,b,function(a,b,c){var a=a.className,e,f;if(a){a=(" "+a+" ").replace(l," ");e=0;for(f=!0;e<c;e++)if(0>a.indexOf(" "+ b[e]+" ")){f=!1;break}if(f)return!0}},!0)},addClass:function(b,f){k(b,f,function(b,h,c){var e=b.className,g,i;if(e){g=(" "+e+" ").replace(l," ");for(i=0;i<c;i++)0>g.indexOf(" "+h[i]+" ")&&(e+=" "+h[i]);b.className=a.trim(e)}else b.className=f},i)},removeClass:function(b,f){k(b,f,function(b,h,c){var e=b.className,f,g;if(e)if(c){e=(" "+e+" ").replace(l," ");for(f=0;f<c;f++)for(g=" "+h[f]+" ";0<=e.indexOf(g);)e=e.replace(g," ");b.className=a.trim(e)}else b.className=""},i)},replaceClass:function(a,f, d){b.removeClass(a,f);b.addClass(a,d)},toggleClass:function(e,f,d){var h=a.isBoolean(d),c,g;k(e,f,function(a,e,i){for(g=0;g<i;g++)f=e[g],c=h?!d:b.hasClass(a,f),b[c?"removeClass":"addClass"](a,f)},i)}});return b},{requires:["./api"]}); KISSY.add("dom/base/create",function(a,b,i){function k(c){var d=a.require("event/dom");d&&d.detach(c);b.removeData(c)}function g(a,b){var d=b&&b!=f?b.createElement(c):m;d.innerHTML="m<div>"+a+"</div>";return d.lastChild}function j(a,b,c){var h=b.nodeType;if(h==d.DOCUMENT_FRAGMENT_NODE){b=b.childNodes;c=c.childNodes;for(h=0;b[h];)c[h]&&j(a,b[h],c[h]),h++}else if(h==d.ELEMENT_NODE){b=b.getElementsByTagName("*");c=c.getElementsByTagName("*");for(h=0;b[h];)c[h]&&a(b[h],c[h]),h++}}function l(c,h){var e= a.require("event/dom"),f,g;if(h.nodeType!=d.ELEMENT_NODE||b.hasData(c)){f=b.data(c);for(g in f)b.data(h,g,f[g]);e&&(e._DOMUtils.removeData(h),e._clone(c,h))}}function e(b){var c=null,d,h;if(b&&(b.push||b.item)&&b[0]){c=b[0].ownerDocument;c=c.createDocumentFragment();b=a.makeArray(b);d=0;for(h=b.length;d<h;d++)c.appendChild(b[d])}return c}var f=a.Env.host.document,d=b.NodeType,h=a.UA.ie,c="div",m=f&&f.createElement(c),n=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,p=/<([\w:]+)/, o=/^\s+/,q=h&&9>h,r=/<|&#?\w+;/,t=f&&"outerHTML"in f.documentElement,s=/^<(\w+)\s*\/?>(?:<\/\1>)?$/;a.mix(b,{create:function(h,m,j,k){var l=null;if(!h)return l;if(h.nodeType)return b.clone(h);if("string"!=typeof h)return l;k===i&&(k=!0);k&&(h=a.trim(h));var k=b._creators,t,u,j=j||f,w,v=c;if(r.test(h))if(w=s.exec(h))l=j.createElement(w[1]);else{h=h.replace(n,"<$1></$2>");if((w=p.exec(h))&&(t=w[1]))v=t.toLowerCase();t=(k[v]||g)(h,j);q&&(u=h.match(o))&&t.insertBefore(j.createTextNode(u[0]),t.firstChild); h=t.childNodes;1===h.length?l=h[0].parentNode.removeChild(h[0]):h.length&&(l=e(h))}else l=j.createTextNode(h);a.isPlainObject(m)&&(l.nodeType==d.ELEMENT_NODE?b.attr(l,m,!0):l.nodeType==d.DOCUMENT_FRAGMENT_NODE&&b.attr(l.childNodes,m,!0));return l},_fixCloneAttributes:null,_creators:{div:g},_defaultCreator:g,html:function(a,c,h,e){var a=b.query(a),f=a[0],g=!1,m,j;if(f){if(c===i)return f.nodeType==d.ELEMENT_NODE?f.innerHTML:null;c+="";if(!c.match(/<(?:script|style|link)/i)&&(!q||!c.match(o))&&!x[(c.match(p)|| ["",""])[1].toLowerCase()])try{for(m=a.length-1;0<=m;m--)j=a[m],j.nodeType==d.ELEMENT_NODE&&(k(j.getElementsByTagName("*")),j.innerHTML=c);g=!0}catch(l){}g||(c=b.create(c,0,f.ownerDocument,0),b.empty(a),b.append(c,a,h));e&&e()}},outerHTML:function(a,h,e){var g=b.query(a),j=g.length;if(a=g[0]){if(h===i){if(t)return a.outerHTML;h=(h=a.ownerDocument)&&h!=f?h.createElement(c):m;h.innerHTML="";h.appendChild(b.clone(a,!0));return h.innerHTML}h+="";if(!h.match(/<(?:script|style|link)/i)&&t)for(e=j-1;0<= e;e--)a=g[e],a.nodeType==d.ELEMENT_NODE&&(k(a),k(a.getElementsByTagName("*")),a.outerHTML=h);else a=b.create(h,0,a.ownerDocument,0),b.insertBefore(a,g,e),b.remove(g)}},remove:function(a,c){var h,e=b.query(a),f,g;for(g=e.length-1;0<=g;g--)h=e[g],!c&&h.nodeType==d.ELEMENT_NODE&&(f=h.getElementsByTagName("*"),k(f),k(h)),h.parentNode&&h.parentNode.removeChild(h)},clone:function(a,c,h,e){"object"===typeof c&&(e=c.deepWithDataAndEvent,h=c.withDataAndEvent,c=c.deep);var a=b.get(a),f,g=b._fixCloneAttributes, m;if(!a)return null;m=a.nodeType;f=a.cloneNode(c);if(m==d.ELEMENT_NODE||m==d.DOCUMENT_FRAGMENT_NODE)g&&m==d.ELEMENT_NODE&&g(a,f),c&&g&&j(g,a,f);h&&(l(a,f),c&&e&&j(l,a,f));return f},empty:function(a){var a=b.query(a),c,d;for(d=a.length-1;0<=d;d--)c=a[d],b.remove(c.childNodes)},_nodeListToFragment:e});var u=b._creators,v=b.create,x={option:"select",optgroup:"select",area:"map",thead:"table",td:"tr",th:"tr",tr:"tbody",tbody:"table",tfoot:"table",caption:"table",colgroup:"table",col:"colgroup",legend:"fieldset"}, w;for(w in x)(function(a){u[w]=function(b,c){return v("<"+a+">"+b+"</"+a+">",null,c)}})(x[w]);return b},{requires:["./api"]}); KISSY.add("dom/base/data",function(a,b,i){var k=a.Env.host,g="__ks_data_"+a.now(),j={},l={},e={applet:1,object:1,embed:1},f={hasData:function(b,d){if(b)if(d!==i){if(d in b)return!0}else if(!a.isEmptyObject(b))return!0;return!1}},d={hasData:function(a,b){return a==k?d.hasData(l,b):f.hasData(a[g],b)},data:function(a,b,h){if(a==k)return d.data(l,b,h);var e=a[g];if(h!==i)e=a[g]=a[g]||{},e[b]=h;else return b!==i?e&&e[b]:e=a[g]=a[g]||{}},removeData:function(b,h){if(b==k)return d.removeData(l,h);var e=b[g]; if(h!==i)delete e[h],a.isEmptyObject(e)&&d.removeData(b);else try{delete b[g]}catch(f){b[g]=i}}},h={hasData:function(a,b){var d=a[g];return!d?!1:f.hasData(j[d],b)},data:function(b,d,h){if(e[b.nodeName.toLowerCase()])return i;var f=b[g];if(!f){if(d!==i&&h===i)return i;f=b[g]=a.guid()}b=j[f];if(h!==i)b=j[f]=j[f]||{},b[d]=h;else return d!==i?b&&b[d]:b=j[f]=j[f]||{}},removeData:function(b,d){var e=b[g],f;if(e)if(f=j[e],d!==i)delete f[d],a.isEmptyObject(f)&&h.removeData(b);else{delete j[e];try{delete b[g]}catch(k){b[g]= i}b.removeAttribute&&b.removeAttribute(g)}}};a.mix(b,{__EXPANDO:g,hasData:function(a,e){for(var f=!1,g=b.query(a),j=0;j<g.length&&!(f=g[j],f=f.nodeType?h.hasData(f,e):d.hasData(f,e));j++);return f},data:function(c,e,f){var c=b.query(c),g=c[0];if(a.isPlainObject(e)){for(var j in e)b.data(c,j,e[j]);return i}if(f===i){if(g)return g.nodeType?h.data(g,e):d.data(g,e)}else for(j=c.length-1;0<=j;j--)g=c[j],g.nodeType?h.data(g,e,f):d.data(g,e,f);return i},removeData:function(a,e){var f=b.query(a),g,j;for(j= f.length-1;0<=j;j--)g=f[j],g.nodeType?h.removeData(g,e):d.removeData(g,e)}});return b},{requires:["./api"]}); KISSY.add("dom/base/insertion",function(a,b){function i(a,b){var g=[],k,o,q;for(k=0;a[k];k++)if(o=a[k],q=e(o),o.nodeType==j.DOCUMENT_FRAGMENT_NODE)g.push.apply(g,i(f(o.childNodes),b));else if("script"===q&&(!o.type||h.test(o.type)))o.parentNode&&o.parentNode.removeChild(o),b&&b.push(o);else{if(o.nodeType==j.ELEMENT_NODE&&!l.test(q)){q=[];var r,t,s=o.getElementsByTagName("script");for(t=0;t<s.length;t++)r=s[t],(!r.type||h.test(r.type))&&q.push(r);d.apply(a,[k+1,0].concat(q))}g.push(o)}return g}function k(b){b.src? a.getScript(b.src):(b=a.trim(b.text||b.textContent||b.innerHTML||""))&&a.globalEval(b)}function g(c,d,h,e){c=b.query(c);e&&(e=[]);c=i(c,e);b._fixInsertionChecked&&b._fixInsertionChecked(c);var d=b.query(d),f,g,j,l,s=d.length;if((c.length||e&&e.length)&&s){c=b._nodeListToFragment(c);1<s&&(l=b.clone(c,!0),d=a.makeArray(d));for(f=0;f<s;f++)g=d[f],c&&(j=0<f?b.clone(l,!0):c,h(j,g)),e&&e.length&&a.each(e,k)}}var j=b.NodeType,l=/^(?:button|input|object|select|textarea)$/i,e=b.nodeName,f=a.makeArray,d=[].splice, h=/\/(java|ecma)script/i;a.mix(b,{_fixInsertionChecked:null,insertBefore:function(a,b,d){g(a,b,function(a,b){b.parentNode&&b.parentNode.insertBefore(a,b)},d)},insertAfter:function(a,b,d){g(a,b,function(a,b){b.parentNode&&b.parentNode.insertBefore(a,b.nextSibling)},d)},appendTo:function(a,b,d){g(a,b,function(a,b){b.appendChild(a)},d)},prependTo:function(a,b,d){g(a,b,function(a,b){b.insertBefore(a,b.firstChild)},d)},wrapAll:function(a,d){d=b.clone(b.get(d),!0);a=b.query(a);a[0].parentNode&&b.insertBefore(d, a[0]);for(var h;(h=d.firstChild)&&1==h.nodeType;)d=h;b.appendTo(a,d)},wrap:function(c,d){c=b.query(c);d=b.get(d);a.each(c,function(a){b.wrapAll(a,d)})},wrapInner:function(c,d){c=b.query(c);d=b.get(d);a.each(c,function(a){var c=a.childNodes;c.length?b.wrapAll(c,d):a.appendChild(d)})},unwrap:function(c){c=b.query(c);a.each(c,function(a){a=a.parentNode;b.replaceWith(a,a.childNodes)})},replaceWith:function(a,d){var h=b.query(a),d=b.query(d);b.remove(d,!0);b.insertBefore(d,h);b.remove(h)}});a.each({prepend:"prependTo", append:"appendTo",before:"insertBefore",after:"insertAfter"},function(a,d){b[d]=b[a]});return b},{requires:["./api"]}); KISSY.add("dom/base/offset",function(a,b,i){function k(a){var b,c=a.ownerDocument.body;if(!a.getBoundingClientRect)return{left:0,top:0};b=a.getBoundingClientRect();a=b[n];b=b[p];a-=f.clientLeft||c.clientLeft||0;b-=f.clientTop||c.clientTop||0;return{left:a,top:b}}function g(a,c){var h={left:0,top:0},e=d(a[m]),f,g=a,c=c||e;do{if(e==c){var j=g;f=k(j);j=d(j[m]);f.left+=b[q](j);f.top+=b[r](j)}else f=k(g);h.left+=f.left;h.top+=f.top}while(e&&e!=c&&(g=e.frameElement)&&(e=e.parent));return h}var j=a.Env.host, l=j.document,e=b.NodeType,f=l&&l.documentElement,d=b.getWindow,h=Math.max,c=parseFloat,m="ownerDocument",n="left",p="top",o=a.isNumber,q="scrollLeft",r="scrollTop";a.mix(b,{offset:function(a,d,h){if(d===i){var a=b.get(a),e;a&&(e=g(a,h));return e}h=b.query(a);for(e=h.length-1;0<=e;e--){var a=h[e],f=d;"static"===b.css(a,"position")&&(a.style.position="relative");var j=g(a),k={},m=void 0,l=void 0;for(l in f)m=c(b.css(a,l))||0,k[l]=c(m+f[l]-j[l]);b.css(a,k)}return i},scrollIntoView:function(h,f,g,j){var k, m,l,o;if(l=b.get(h)){f&&(f=b.get(f));f||(f=l.ownerDocument);f.nodeType==e.DOCUMENT_NODE&&(f=d(f));a.isPlainObject(g)&&(j=g.allowHorizontalScroll,o=g.onlyScrollIfNeeded,g=g.alignWithTop);j=j===i?!0:j;m=!!d(f);var h=b.offset(l),q=b.outerHeight(l);k=b.outerWidth(l);var r,C,I,z;m?(m=f,r=b.height(m),C=b.width(m),z={left:b.scrollLeft(m),top:b.scrollTop(m)},m=h[n]-z[n],l=h[p]-z[p],k=h[n]+k-(z[n]+C),h=h[p]+q-(z[p]+r)):(r=b.offset(f),C=f.clientHeight,I=f.clientWidth,z={left:b.scrollLeft(f),top:b.scrollTop(f)}, m=h[n]-(r[n]+(c(b.css(f,"borderLeftWidth"))||0)),l=h[p]-(r[p]+(c(b.css(f,"borderTopWidth"))||0)),k=h[n]+k-(r[n]+I+(c(b.css(f,"borderRightWidth"))||0)),h=h[p]+q-(r[p]+C+(c(b.css(f,"borderBottomWidth"))||0)));if(o){if(0>l||0<h)!0===g?b.scrollTop(f,z.top+l):!1===g?b.scrollTop(f,z.top+h):0>l?b.scrollTop(f,z.top+l):b.scrollTop(f,z.top+h)}else(g=g===i?!0:!!g)?b.scrollTop(f,z.top+l):b.scrollTop(f,z.top+h);if(j)if(o){if(0>m||0<k)!0===g?b.scrollLeft(f,z.left+m):!1===g?b.scrollLeft(f,z.left+k):0>m?b.scrollLeft(f, z.left+m):b.scrollLeft(f,z.left+k)}else(g=g===i?!0:!!g)?b.scrollLeft(f,z.left+m):b.scrollLeft(f,z.left+k)}},docWidth:0,docHeight:0,viewportHeight:0,viewportWidth:0,scrollTop:0,scrollLeft:0});a.each(["Left","Top"],function(a,c){var h="scroll"+a;b[h]=function(f,g){if(o(f))return arguments.callee(j,f);var f=b.get(f),m,k,l,n=d(f);n?g!==i?(g=parseFloat(g),k="Left"==a?g:b.scrollLeft(n),l="Top"==a?g:b.scrollTop(n),n.scrollTo(k,l)):(m=n["page"+(c?"Y":"X")+"Offset"],o(m)||(k=n.document,m=k.documentElement[h], o(m)||(m=k.body[h]))):f.nodeType==e.ELEMENT_NODE&&(g!==i?f[h]=parseFloat(g):m=f[h]);return m}});a.each(["Width","Height"],function(a){b["doc"+a]=function(c){c=b.get(c);c=d(c).document;return h(c.documentElement["scroll"+a],c.body["scroll"+a],b["viewport"+a](c))};b["viewport"+a]=function(c){var c=b.get(c),h="client"+a,c=d(c).document,e=c.body,f=c.documentElement[h];return"CSS1Compat"===c.compatMode&&f||e&&e[h]||f}});return b},{requires:["./api"]}); KISSY.add("dom/base/selector",function(a,b,i){function k(a){var b,c;for(c=0;c<this.length&&!(b=this[c],!1===a(b,c));c++);}function g(d,h){var e,f,m="string"==typeof d,o=h===i&&(f=1)?[c]:g(h);d?m?(d=v(d),f&&"body"==d?e=[c.body]:1==o.length&&d&&(e=l(d,o[0]))):f&&(e=d.nodeType||d.setTimeout?[d]:d.getDOMNodes?d.getDOMNodes():p(d)?d:q(d)?a.makeArray(d):[d]):e=[];if(!e&&(e=[],d)){for(f=0;f<o.length;f++)t.apply(e,j(d,o[f]));1<e.length&&(1<o.length||m&&-1<d.indexOf(u))&&b.unique(e)}e.each=k;return e}function j(b, c){var d="string"==typeof b;if(d&&b.match(w)||!d)d=e(b,c);else if(d&&-1<b.replace(/"(?:(?:\\.)|[^"])*"/g,"").replace(/'(?:(?:\\.)|[^'])*'/g,"").indexOf(u)){var d=[],h,f=b.split(/\s*,\s*/);for(h=0;h<f.length;h++)t.apply(d,j(f[h],c))}else d=[],(h=a.require("sizzle"))&&h(b,c,d);return d}function l(a,c){var h,e,g,j;if(x.test(a))h=(e=f(a.slice(1),c))?[e]:[];else if(g=w.exec(a)){e=g[1];j=g[2];g=g[3];if(c=e?f(e,c):c)g?!e||-1!=a.indexOf(s)?h=[].concat(b._getElementsByClassName(g,j,c)):(e=f(e,c),d(e,g)&&(h= [e])):j&&(h=o(b._getElementsByTagName(j,c)));h=h||[]}return h}function e(a,d){var h;"string"==typeof a?h=l(a,d)||[]:p(a)||q(a)?h=n(a,function(a){return!a?!1:d==c?!0:b._contains(d,a)}):(!a?0:d==c||b._contains(d,a))&&(h=[a]);return h}function f(a,c){var d=c.nodeType==m.DOCUMENT_NODE;return b._getElementById(a,c,d?c:c.ownerDocument,d)}function d(a,b){var c=a&&a.className;return c&&-1<(s+c+s).indexOf(s+b+s)}function h(a,b){var c=a&&a.getAttributeNode(b);return c&&c.nodeValue}var c=a.Env.host.document, m=b.NodeType,n=a.filter,p=a.isArray,o=a.makeArray,q=b._isNodeList,r=b.nodeName,t=Array.prototype.push,s=" ",u=",",v=a.trim,x=/^#[\w-]+$/,w=/^(?:#([\w-]+))?\s*([\w-]+|\*)?\.?([\w-]+)?$/;a.mix(b,{_getAttr:h,_hasSingleClass:d,_getElementById:function(a,c,d,h){var e=d.getElementById(a),f=b._getAttr(e,"id");return!e&&!h&&!b._contains(d,c)||e&&f!=a?b.filter("*","#"+a,c)[0]||null:h||e&&b._contains(c,e)?e:null},_getElementsByTagName:function(a,b){return b.getElementsByTagName(a)},_getElementsByClassName:function(a, b,c){return o(c.querySelectorAll((b||"")+"."+a))},_compareNodeOrder:function(a,b){return!a.compareDocumentPosition||!b.compareDocumentPosition?a.compareDocumentPosition?-1:1:a.compareDocumentPosition(b)&4?-1:1},query:g,get:function(a,b){return g(a,b)[0]||null},unique:function(){function a(d,h){return d==h?(c=!0,0):b._compareNodeOrder(d,h)}var c,d=!0;[0,0].sort(function(){d=!1;return 0});return function(b){c=d;b.sort(a);if(c)for(var h=1,e=b.length;h<e;)b[h]===b[h-1]?b.splice(h,1):h++;return b}}(), filter:function(b,c,e){var b=g(b,e),e=a.require("sizzle"),f,j,i,m,k=[];if("string"==typeof c&&(c=v(c))&&(f=w.exec(c)))i=f[1],j=f[2],m=f[3],i?i&&!j&&!m&&(c=function(a){return h(a,"id")==i}):c=function(a){var b=!0,c=!0;j&&(b=r(a)==j.toLowerCase());m&&(c=d(a,m));return c&&b};a.isFunction(c)?k=a.filter(b,c):c&&e&&(k=e.matches(c,b));return k},test:function(a,c,d){a=g(a,d);return a.length&&b.filter(a,c,d).length===a.length}});return b},{requires:["./api"]}); KISSY.add("dom/base/style",function(a,b,i){function k(a){return a.replace(t,"ms-").replace(s,u)}function g(a,b,c){var d={},h;for(h in b)d[h]=a[m][h],a[m][h]=b[h];c.call(a);for(h in b)a[m][h]=d[h]}function j(a,b,c){var d,h,e;if(3===a.nodeType||8===a.nodeType||!(d=a[m]))return i;b=k(b);e=A[b];b=y[b]||b;if(c!==i){null===c||c===x?c=x:!isNaN(Number(c))&&!r[b]&&(c+=w);e&&e.set&&(c=e.set(a,c));if(c!==i){try{d[b]=c}catch(f){}c===x&&d.removeAttribute&&d.removeAttribute(b)}d.cssText||a.removeAttribute("style"); return i}if(!e||!("get"in e&&(h=e.get(a,!1))!==i))h=d[b];return h===i?"":h}function l(a){var b,c=arguments;0!==a.offsetWidth?b=e.apply(i,c):g(a,D,function(){b=e.apply(i,c)});return b}function e(c,d,h){if(a.isWindow(c))return d==p?b.viewportWidth(c):b.viewportHeight(c);if(9==c.nodeType)return d==p?b.docWidth(c):b.docHeight(c);var e=d===p?["Left","Right"]:["Top","Bottom"],f=d===p?c.offsetWidth:c.offsetHeight;if(0<f)return"border"!==h&&a.each(e,function(a){h||(f-=parseFloat(b.css(c,"padding"+a))||0); f="margin"===h?f+(parseFloat(b.css(c,h+a))||0):f-(parseFloat(b.css(c,"border"+a+"Width"))||0)}),f;f=b._getComputedStyle(c,d);if(null==f||0>Number(f))f=c.style[d]||0;f=parseFloat(f)||0;h&&a.each(e,function(a){f+=parseFloat(b.css(c,"padding"+a))||0;"padding"!==h&&(f+=parseFloat(b.css(c,"border"+a+"Width"))||0);"margin"===h&&(f+=parseFloat(b.css(c,h+a))||0)});return f}var f=a.Env.host,d=a.UA,h=b.nodeName,c=f.document,m="style",n=/^margin/,p="width",o="display"+a.now(),q=parseInt,r={fillOpacity:1,fontWeight:1, lineHeight:1,opacity:1,orphans:1,widows:1,zIndex:1,zoom:1},t=/^-ms-/,s=/-([a-z])/ig,u=function(a,b){return b.toUpperCase()},v=/([A-Z]|^ms)/g,x="",w="px",A={},y={},B={};y["float"]="cssFloat";a.mix(b,{_camelCase:k,_CUSTOM_STYLES:A,_cssProps:y,_getComputedStyle:function(a,c){var d="",h,e,f,g,j;e=a.ownerDocument;c=c.replace(v,"-$1").toLowerCase();if(h=e.defaultView.getComputedStyle(a,null))d=h.getPropertyValue(c)||h[c];""===d&&!b.contains(e,a)&&(c=y[c]||c,d=a[m][c]);b._RE_NUM_NO_PX.test(d)&&n.test(c)&& (j=a.style,e=j.width,f=j.minWidth,g=j.maxWidth,j.minWidth=j.maxWidth=j.width=d,d=h.width,j.width=e,j.minWidth=f,j.maxWidth=g);return d},style:function(c,d,h){var c=b.query(c),e,f=c[0];if(a.isPlainObject(d)){for(e in d)for(f=c.length-1;0<=f;f--)j(c[f],e,d[e]);return i}if(h===i)return e="",f&&(e=j(f,d,h)),e;for(f=c.length-1;0<=f;f--)j(c[f],d,h);return i},css:function(c,d,h){var c=b.query(c),e=c[0],f;if(a.isPlainObject(d)){for(f in d)for(e=c.length-1;0<=e;e--)j(c[e],f,d[f]);return i}d=k(d);f=A[d];if(h=== i){h="";if(e&&(!f||!("get"in f&&(h=f.get(e,!0))!==i)))h=b._getComputedStyle(e,d);return h===i?"":h}for(e=c.length-1;0<=e;e--)j(c[e],d,h);return i},show:function(a){var a=b.query(a),d,h,e;for(e=a.length-1;0<=e;e--)if(h=a[e],h[m].display=b.data(h,o)||x,"none"===b.css(h,"display")){d=h.tagName.toLowerCase();var f=void 0,g=B[d],j=void 0;B[d]||(f=c.body||c.documentElement,j=c.createElement(d),b.prepend(j,f),g=b.css(j,"display"),f.removeChild(j),B[d]=g);d=g;b.data(h,o,d);h[m].display=d}},hide:function(a){var a= b.query(a),c,d;for(d=a.length-1;0<=d;d--){c=a[d];var h=c[m],e=h.display;"none"!==e&&(e&&b.data(c,o,e),h.display="none")}},toggle:function(a){var a=b.query(a),c,d;for(d=a.length-1;0<=d;d--)c=a[d],"none"===b.css(c,"display")?b.show(c):b.hide(c)},addStyleSheet:function(a,c,d){a=a||f;"string"==typeof a&&(d=c,c=a,a=f);var a=b.get(a),a=b.getWindow(a).document,h;if(d&&(d=d.replace("#",x)))h=b.get("#"+d,a);h||(h=b.create("<style>",{id:d},a),b.get("head",a).appendChild(h),h.styleSheet?h.styleSheet.cssText= c:h.appendChild(a.createTextNode(c)))},unselectable:function(c){var c=b.query(c),e,f,g=0,j,i;for(f=c.length-1;0<=f;f--)if(e=c[f],d.gecko)e[m].MozUserSelect="none";else if(d.webkit)e[m].KhtmlUserSelect="none";else if(d.ie||d.opera){i=e.getElementsByTagName("*");e.setAttribute("unselectable","on");for(j=["iframe","textarea","input","select"];e=i[g++];)a.inArray(h(e),j)||e.setAttribute("unselectable","on")}},innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0,width:0,height:0});a.each([p,"height"], function(c){b["inner"+a.ucfirst(c)]=function(a){return(a=b.get(a))&&l(a,c,"padding")};b["outer"+a.ucfirst(c)]=function(a,d){var h=b.get(a);return h&&l(h,c,d?"margin":"border")};b[c]=function(a,d){var h=b.css(a,c,d);h&&(h=parseFloat(h));return h}});var D={position:"absolute",visibility:"hidden",display:"block"};a.each(["height","width"],function(a){A[a]={get:function(b,c){return c?l(b,a)+"px":i}}});a.each(["left","top"],function(h){A[h]={get:function(e,f){var g;if(f&&(g=b._getComputedStyle(e,h),"auto"=== g)){g=0;if(a.inArray(b.css(e,"position"),["absolute","fixed"])){g=e["left"===h?"offsetLeft":"offsetTop"];if(d.ie&&9>(c.documentMode||0)||d.opera)g-=e.offsetParent&&e.offsetParent["client"+("left"==h?"Left":"Top")]||0;g-=q(b.css(e,"margin-"+h))||0}g+="px"}return g}}});return b},{requires:["./api"]}); KISSY.add("dom/base/traversal",function(a,b,i){function k(e,f,d,h,c,j,k){if(!(e=b.get(e)))return null;if(0===f)return e;j||(e=e[d]);if(!e)return null;c=c&&b.get(c)||null;f===i&&(f=1);var j=[],p=a.isArray(f),o,q;a.isNumber(f)&&(o=0,q=f,f=function(){return++o===q});for(;e&&e!=c;){if((e.nodeType==l.ELEMENT_NODE||e.nodeType==l.TEXT_NODE&&k)&&g(e,f)&&(!h||h(e)))if(j.push(e),!p)break;e=e[d]}return p?j:j[0]||null}function g(e,f){if(!f)return!0;if(a.isArray(f)){var d,h=f.length;if(!h)return!0;for(d=0;d<h;d++)if(b.test(e, f[d]))return!0}else if(b.test(e,f))return!0;return!1}function j(e,f,d,h){var c=[],g,j;if((g=e=b.get(e))&&d)g=e.parentNode;if(g){d=a.makeArray(g.childNodes);for(g=0;g<d.length;g++)j=d[g],(h||j.nodeType==l.ELEMENT_NODE)&&j!=e&&c.push(j);f&&(c=b.filter(c,f))}return c}var l=b.NodeType;a.mix(b,{_contains:function(a,b){return!!(a.compareDocumentPosition(b)&16)},closest:function(a,b,d,h){return k(a,b,"parentNode",function(a){return a.nodeType!=l.DOCUMENT_FRAGMENT_NODE},d,!0,h)},parent:function(a,b,d){return k(a, b,"parentNode",function(a){return a.nodeType!=l.DOCUMENT_FRAGMENT_NODE},d,i)},first:function(a,f,d){a=b.get(a);return k(a&&a.firstChild,f,"nextSibling",i,i,!0,d)},last:function(a,f,d){a=b.get(a);return k(a&&a.lastChild,f,"previousSibling",i,i,!0,d)},next:function(a,b,d){return k(a,b,"nextSibling",i,i,i,d)},prev:function(a,b,d){return k(a,b,"previousSibling",i,i,i,d)},siblings:function(a,b,d){return j(a,b,!0,d)},children:function(a,b){return j(a,b,i)},contents:function(a,b){return j(a,b,i,1)},contains:function(a, f){a=b.get(a);f=b.get(f);return a&&f?b._contains(a,f):!1},index:function(e,f){var d=b.query(e),h,c=0;h=d[0];if(!f){d=h&&h.parentNode;if(!d)return-1;for(;h=h.previousSibling;)h.nodeType==l.ELEMENT_NODE&&c++;return c}c=b.query(f);return"string"===typeof f?a.indexOf(h,c):a.indexOf(c[0],d)},equals:function(a,f){a=b.query(a);f=b.query(f);if(a.length!=f.length)return!1;for(var d=a.length;0<=d;d--)if(a[d]!=f[d])return!1;return!0}});return b},{requires:["./api"]}); KISSY.add("dom/ie/attr",function(a,b){var i=b._attrHooks,k=b._attrNodeHook,g=b.NodeType,j=b._valHooks,l=b._propFix;if(8>(document.documentMode||a.UA.ie))i.style.set=function(a,b){a.style.cssText=b},a.mix(k,{get:function(a,b){var d=a.getAttributeNode(b);return d&&(d.specified||d.nodeValue)?d.nodeValue:void 0},set:function(a,b,d){var h=a.getAttributeNode(d),c;if(h)h.nodeValue=b;else try{c=a.ownerDocument.createAttribute(d),c.value=b,a.setAttributeNode(c)}catch(g){return a.setAttribute(d,b,0)}}}),a.mix(b._attrFix, l),i.tabIndex=i.tabindex,a.each("href,src,width,height,colSpan,rowSpan".split(","),function(a){i[a]={get:function(b){b=b.getAttribute(a,2);return b===null?void 0:b}}}),j.button=i.value=k,j.option={get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}};(i.href=i.href||{}).set=function(a,b,d){for(var h=a.childNodes,c,j=h.length,i=0<j,j=j-1;0<=j;j--)h[j].nodeType!=g.TEXT_NODE&&(i=0);i&&(c=a.ownerDocument.createElement("b"),c.style.display="none",a.appendChild(c));a.setAttribute(d, ""+b);c&&a.removeChild(c)};return b},{requires:["dom/base"]}); KISSY.add("dom/ie/create",function(a,b){var i=document.documentMode||a.UA.ie;b._fixCloneAttributes=function(a,e){e.clearAttributes&&e.clearAttributes();e.mergeAttributes&&e.mergeAttributes(a);var f=e.nodeName.toLowerCase(),d=a.childNodes;if("object"===f&&!e.childNodes.length)for(f=0;f<d.length;f++)e.appendChild(d[f].cloneNode(!0));else if("input"===f&&("checkbox"===a.type||"radio"===a.type)){if(a.checked&&(e.defaultChecked=e.checked=a.checked),e.value!==a.value)e.value=a.value}else if("option"=== f)e.selected=a.defaultSelected;else if("input"===f||"textarea"===f)e.defaultValue=a.defaultValue;e.removeAttribute(b.__EXPANDO)};var k=b._creators,g=b._defaultCreator,j=/<tbody/i;8>i&&(k.table=function(i,e){var f=g(i,e);if(j.test(i))return f;var d=f.firstChild,h=a.makeArray(d.childNodes);a.each(h,function(a){"tbody"==b.nodeName(a)&&!a.childNodes.length&&d.removeChild(a)});return f})},{requires:["dom/base"]});KISSY.add("dom/ie",function(a,b){return b},{requires:"./ie/attr,./ie/create,./ie/insertion,./ie/selector,./ie/style,./ie/traversal,./ie/input-selection".split(",")}); KISSY.add("dom/ie/input-selection",function(a,b){function i(a,b){var d=0,h=0,c=a.ownerDocument.selection.createRange(),g=k(a);g.inRange(c)&&(g.setEndPoint("EndToStart",c),d=j(a,g).length,b&&(h=d+j(a,c).length));return[d,h]}function k(a){if("textarea"==a.type){var b=a.document.body.createTextRange();b.moveToElementText(a);return b}return a.createTextRange()}function g(a,b,d){var h=Math.min(b,d),c=Math.max(b,d);return h==c?0:"textarea"==a.type?(a=a.value.substring(h,c).replace(/\r\n/g,"\n").length, b>d&&(a=-a),a):d-b}function j(a,b){if("textarea"==a.type){var d=b.text,h=b.duplicate();if(0==h.compareEndPoints("StartToEnd",h))return d;h.moveEnd("character",-1);h.text==d&&(d+="\r\n");return d}return b.text}var l=b._propHooks;l.selectionStart={set:function(a,b){var d=a.ownerDocument.selection.createRange();if(k(a).inRange(d)){var h=i(a,1)[1],c=g(a,b,h);d.collapse(!1);d.moveStart("character",-c);b>h&&d.collapse(!0);d.select()}},get:function(a){return i(a)[0]}};l.selectionEnd={set:function(a,b){var d= a.ownerDocument.selection.createRange();if(k(a).inRange(d)){var h=i(a)[0],c=g(a,h,b);d.collapse(!0);d.moveEnd("character",c);h>b&&d.collapse(!1);d.select()}},get:function(a){return i(a,1)[1]}}},{requires:["dom/base"]}); KISSY.add("dom/ie/insertion",function(a,b){if(8>(document.documentMode||a.UA.ie))b._fixInsertionChecked=function k(a){for(var j=0;j<a.length;j++){var l=a[j];if(l.nodeType==b.NodeType.DOCUMENT_FRAGMENT_NODE)k(l.childNodes);else if("input"==b.nodeName(l)){if("checkbox"===l.type||"radio"===l.type)l.defaultChecked=l.checked}else if(l.nodeType==b.NodeType.ELEMENT_NODE)for(var l=l.getElementsByTagName("input"),e=0;e<l.length;e++)k(l[e])}}},{requires:["dom/base"]}); KISSY.add("dom/ie/selector",function(a,b){var i=a.Env.host.document;b._compareNodeOrder=function(a,b){return a.sourceIndex-b.sourceIndex};i.querySelectorAll||(b._getElementsByClassName=function(a,g,j){if(!j)return[];for(var g=j.getElementsByTagName(g||"*"),j=[],i=0,e=0,f=g.length,d;i<f;++i)d=g[i],b._hasSingleClass(d,a)&&(j[e++]=d);return j});b._getElementsByTagName=function(b,g){var j=a.makeArray(g.getElementsByTagName(b)),i,e,f,d;if(b==="*"){i=[];for(f=e=0;d=j[e++];)d.nodeType===1&&(i[f++]=d);j= i}return j}},{requires:["dom/base"]}); KISSY.add("dom/ie/style",function(a,b){var i=b._cssProps,k=document.documentMode||a.UA.ie,g=a.Env.host.document,g=g&&g.documentElement,j=/^(top|right|bottom|left)$/,l=b._CUSTOM_STYLES,e=/opacity\s*=\s*([^)]*)/,f=/alpha\([^)]*\)/i;i["float"]="styleFloat";l.backgroundPosition={get:function(a,b){return b?a.currentStyle.backgroundPositionX+" "+a.currentStyle.backgroundPositionY:a.style.backgroundPosition}};try{null==g.style.opacity&&(l.opacity={get:function(a,b){return e.test((b&&a.currentStyle?a.currentStyle.filter: a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(b,d){var d=parseFloat(d),h=b.style,e=b.currentStyle,g=isNaN(d)?"":"alpha(opacity="+100*d+")",j=a.trim(e&&e.filter||h.filter||"");h.zoom=1;if((1<=d||!g)&&!a.trim(j.replace(f,"")))if(h.removeAttribute("filter"),!g||e&&!e.filter)return;h.filter=f.test(j)?j.replace(f,g):j+(j?", ":"")+g}})}catch(d){}var k=8==k,h={};h.thin=k?"1px":"2px";h.medium=k?"3px":"4px";h.thick=k?"5px":"6px";a.each(["","Top","Left","Right","Bottom"],function(a){var b= "border"+a+"Width",d="border"+a+"Style";l[b]={get:function(a,c){var f=c?a.currentStyle:0,e=f&&""+f[b]||void 0;e&&0>e.indexOf("px")&&(e=h[e]&&"none"!==f[d]?h[e]:0);return e}}});b._getComputedStyle=function(a,d){var d=i[d]||d,h=a.currentStyle&&a.currentStyle[d];if(b._RE_NUM_NO_PX.test(h)&&!j.test(d)){var e=a.style,f=e.left,g=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left="fontSize"===d?"1em":h||0;h=e.pixelLeft+"px";e.left=f;a.runtimeStyle.left=g}return""===h?"auto":h}},{requires:["dom/base"]}); KISSY.add("dom/ie/traversal",function(a,b){b._contains=function(a,k){a.nodeType==b.NodeType.DOCUMENT_NODE&&(a=a.documentElement);k=k.parentNode;return a==k?!0:k&&k.nodeType==b.NodeType.ELEMENT_NODE?a.contains&&a.contains(k):!1}},{requires:["dom/base"]});KISSY.add("event/base",function(a,b,i,k,g){return a.Event={_Utils:b,_Object:i,_Observer:k,_ObservableEvent:g}},{requires:["./base/utils","./base/object","./base/observer","./base/observable"]}); KISSY.add("event/base/object",function(a){function b(){this.timeStamp=a.now()}var i=function(){return!1},k=function(){return!0};b.prototype={constructor:b,isDefaultPrevented:i,isPropagationStopped:i,isImmediatePropagationStopped:i,preventDefault:function(){this.isDefaultPrevented=k},stopPropagation:function(){this.isPropagationStopped=k},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=k;this.stopPropagation()},halt:function(a){a?this.stopImmediatePropagation():this.stopPropagation(); this.preventDefault()}};return b}); KISSY.add("event/base/observable",function(a){function b(b){a.mix(this,b);this.reset()}b.prototype={constructor:b,hasObserver:function(){return!!this.observers.length},reset:function(){this.observers=[]},removeObserver:function(a){var b,g=this.observers,j=g.length;for(b=0;b<j;b++)if(g[b]==a){g.splice(b,1);break}this.checkMemory()},checkMemory:function(){},findObserver:function(a){var b=this.observers,g;for(g=b.length-1;0<=g;--g)if(a.equals(b[g]))return g;return-1}};return b}); KISSY.add("event/base/observer",function(a){function b(b){a.mix(this,b)}b.prototype={constructor:b,equals:function(b){var k=this;return!!a.reduce(k.keys,function(a,j){return a&&k[j]===b[j]},1)},simpleNotify:function(a,b){var g;g=this.fn.call(this.context||b.currentTarget,a,this.data);this.once&&b.removeObserver(this);return g},notifyInternal:function(a,b){return this.simpleNotify(a,b)},notify:function(a,b){var g;g=a._ks_groups;if(!g||this.groups&&this.groups.match(g))return g=this.notifyInternal(a, b),!1===g&&a.halt(),g}};return b}); KISSY.add("event/base/utils",function(a){var b,i;return{splitAndRun:i=function(b,g){b=a.trim(b);-1==b.indexOf(" ")?g(b):a.each(b.split(/\s+/),g)},normalizeParam:function(i,g,j){var l=g||{},l=a.isFunction(g)?{fn:g,context:j}:a.merge(l),g=b(i),i=g[0];l.groups=g[1];l.type=i;return l},batchForType:function(b,g){var j=a.makeArray(arguments);i(j[2+g],function(a){var e=[].concat(j);e.splice(0,2);e[g]=a;b.apply(null,e)})},getTypedGroups:b=function(a){if(0>a.indexOf("."))return[a,""];var b=a.match(/([^.]+)?(\..+)?$/), a=[b[1]];(b=b[2])?(b=b.split(".").sort(),a.push(b.join("."))):a.push("");return a},getGroupsRe:function(a){return RegExp(a.split(".").join(".*\\.")+"(?:\\.|$)")}}}); KISSY.add("event/custom/api-impl",function(a,b,i,k){var g=a.trim,j=i._Utils,l=j.splitAndRun;return a.mix(b,{fire:function(a,b,d){var h=void 0,d=d||{};l(b,function(b){var f,b=j.getTypedGroups(b);f=b[1];b=b[0];f&&(f=j.getGroupsRe(f),d._ks_groups=f);f=(k.getCustomEvent(a,b)||new k({currentTarget:a,type:b})).fire(d);!1!==h&&(h=f)});return h},publish:function(b,f,d){var h;l(f,function(c){h=k.getCustomEvent(b,c,1);a.mix(h,d)});return b},addTarget:function(e,f){var d=b.getTargets(e);a.inArray(f,d)||d.push(f); return e},removeTarget:function(e,f){var d=b.getTargets(e),h=a.indexOf(f,d);-1!=h&&d.splice(h,1);return e},getTargets:function(a){a["__~ks_bubble_targets"]=a["__~ks_bubble_targets"]||[];return a["__~ks_bubble_targets"]},on:function(a,b,d,h){b=g(b);j.batchForType(function(b,d,h){d=j.normalizeParam(b,d,h);b=d.type;if(b=k.getCustomEvent(a,b,1))b.on(d)},0,b,d,h);return a},detach:function(b,f,d,h){f=g(f);j.batchForType(function(c,d,h){var f=j.normalizeParam(c,d,h);(c=f.type)?(c=k.getCustomEvent(b,c,1))&& c.detach(f):(c=k.getCustomEvents(b),a.each(c,function(a){a.detach(f)}))},0,f,d,h);return b}})},{requires:["./api","event/base","./observable"]});KISSY.add("event/custom/api",function(){return{}});KISSY.add("event/custom",function(a,b,i,k){var g={};a.each(i,function(b,i){g[i]=function(){var e=a.makeArray(arguments);e.unshift(this);return b.apply(null,e)}});i=a.mix({_ObservableCustomEvent:k,Target:g},i);a.mix(b,{Target:g,custom:i});a.EventTarget=g;return i},{requires:["./base","./custom/api-impl","./custom/observable"]}); KISSY.add("event/custom/object",function(a,b){function i(b){i.superclass.constructor.call(this);a.mix(this,b)}a.extend(i,b._Object);return i},{requires:["event/base"]}); KISSY.add("event/custom/observable",function(a,b,i,k,g){function j(){j.superclass.constructor.apply(this,arguments);this.defaultFn=null;this.defaultTargetOnly=!1;this.bubbles=!0}var l=g._Utils;a.extend(j,g._ObservableEvent,{constructor:j,on:function(a){a=new i(a);-1==this.findObserver(a)&&this.observers.push(a)},checkMemory:function(){var b=this.currentTarget,d=j.getCustomEvents(b);d&&(this.hasObserver()||delete d[this.type],a.isEmptyObject(d)&&delete b[e])},fire:function(a){if(this.hasObserver()|| this.bubbles){var a=a||{},d=this.type,h=this.defaultFn,c,e,g;c=this.currentTarget;var i=a,l;a.type=d;i instanceof k||(i.target=c,i=new k(i));i.currentTarget=c;a=this.notify(i);!1!==l&&(l=a);if(this.bubbles){g=(e=b.getTargets(c))&&e.length||0;for(c=0;c<g&&!i.isPropagationStopped();c++)a=b.fire(e[c],d,i),!1!==l&&(l=a)}h&&!i.isDefaultPrevented()&&(d=j.getCustomEvent(i.target,i.type),(!this.defaultTargetOnly&&!d.defaultTargetOnly||this==i.target)&&h.call(this));return l}},notify:function(a){var b=this.observers, h,c,e=b.length,g;for(g=0;g<e&&!a.isImmediatePropagationStopped();g++)h=b[g].notify(a,this),!1!==c&&(c=h),!1===h&&a.halt();return c},detach:function(a){var b,h=a.fn,c=a.context,e=this.currentTarget,g=this.observers,a=a.groups;if(g.length){a&&(b=l.getGroupsRe(a));var j,i,k,r,t=g.length;if(h||b){c=c||e;j=a=0;for(i=[];a<t;++a)if(k=g[a],r=k.context||e,c!=r||h&&h!=k.fn||b&&!k.groups.match(b))i[j++]=k;this.observers=i}else this.reset();this.checkMemory()}}});var e="__~ks_custom_events";j.getCustomEvent= function(a,b,h){var c,e=j.getCustomEvents(a,h);c=e&&e[b];!c&&h&&(c=e[b]=new j({currentTarget:a,type:b}));return c};j.getCustomEvents=function(a,b){!a[e]&&b&&(a[e]={});return a[e]};return j},{requires:["./api","./observer","./object","event/base"]});KISSY.add("event/custom/observer",function(a,b){function i(){i.superclass.constructor.apply(this,arguments)}a.extend(i,b._Observer,{keys:["fn","context","groups"]});return i},{requires:["event/base"]}); KISSY.add("event/dom/base/api",function(a,b,i,k,g,j,l){function e(a,b){var d=k[b]||{};a.originalType||(a.selector?d.delegateFix&&(a.originalType=b,b=d.delegateFix):d.onFix&&(a.originalType=b,b=d.onFix));return b}function f(b,c,d){var f,g,i,d=a.merge(d),c=e(d,c);f=j.getCustomEvents(b,1);if(!(i=f.handle))i=f.handle=function(a){var b=a.type,c=i.currentTarget;if(!(j.triggeredEvent==b||"undefined"==typeof KISSY))if(b=j.getCustomEvent(c,b))return a.currentTarget=c,a=new l(a),b.notify(a)},i.currentTarget= b;if(!(g=f.events))g=f.events={};f=g[c];f||(f=g[c]=new j({type:c,fn:i,currentTarget:b}),f.setup());f.on(d);b=null}var d=b._Utils;a.mix(b,{add:function(b,c,e,g){c=a.trim(c);b=i.query(b);d.batchForType(function(a,b,c,h){c=d.normalizeParam(b,c,h);b=c.type;for(h=a.length-1;0<=h;h--)f(a[h],b,c)},1,b,c,e,g);return b},remove:function(b,c,f,g){c=a.trim(c);b=i.query(b);d.batchForType(function(b,c,h,f){h=d.normalizeParam(c,h,f);c=h.type;for(f=b.length-1;0<=f;f--){var g=b[f],i=c,k=h,k=a.merge(k),l=void 0,i= e(k,i),g=j.getCustomEvents(g),l=(g||{}).events;if(g&&l)if(i)(l=l[i])&&l.detach(k);else for(i in l)l[i].detach(k)}},1,b,c,f,g);return b},delegate:function(a,c,d,e,f){return b.add(a,c,{fn:e,context:f,selector:d})},undelegate:function(a,c,d,e,f){return b.remove(a,c,{fn:e,context:f,selector:d})},fire:function(b,c,e,f){var g=void 0,e=e||{};e.synthetic=1;d.splitAndRun(c,function(c){e.type=c;var k,l,t,c=d.getTypedGroups(c);(l=c[1])&&(l=d.getGroupsRe(l));c=c[0];a.mix(e,{type:c,_ks_groups:l});b=i.query(b); for(l=b.length-1;0<=l;l--)k=b[l],t=j.getCustomEvent(k,c),!f&&!t&&(t=new j({type:c,currentTarget:k})),t&&(k=t.fire(e,f),!1!==g&&(g=k))});return g},fireHandler:function(a,c,d){return b.fire(a,c,d,1)},_clone:function(b,c){var d;(d=j.getCustomEvents(b))&&a.each(d.events,function(b,d){a.each(b.observers,function(a){f(c,d,a)})})},_ObservableDOMEvent:j});b.on=b.add;b.detach=b.remove;return b},{requires:"event/base,dom,./special,./utils,./observable,./object".split(",")}); KISSY.add("event/dom/base",function(a,b,i,k,g,j){a.mix(b,{KeyCodes:i,_DOMUtils:k,Gesture:g,_Special:j});return b},{requires:"event/base,./base/key-codes,./base/utils,./base/gesture,./base/special,./base/api,./base/mouseenter,./base/mousewheel,./base/valuechange".split(",")});KISSY.add("event/dom/base/gesture",function(){return{start:"mousedown",move:"mousemove",end:"mouseup",tap:"click",doubleTap:"dblclick"}}); KISSY.add("event/dom/base/key-codes",function(a){var b=a.UA,i={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88, Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221, WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(a){if(a.altKey&&!a.ctrlKey||a.metaKey||a.keyCode>=i.F1&&a.keyCode<=i.F12)return!1;switch(a.keyCode){case i.ALT:case i.CAPS_LOCK:case i.CONTEXT_MENU:case i.CTRL:case i.DOWN:case i.END:case i.ESC:case i.HOME:case i.INSERT:case i.LEFT:case i.MAC_FF_META:case i.META:case i.NUMLOCK:case i.NUM_CENTER:case i.PAGE_DOWN:case i.PAGE_UP:case i.PAUSE:case i.PRINT_SCREEN:case i.RIGHT:case i.SHIFT:case i.UP:case i.WIN_KEY:case i.WIN_KEY_RIGHT:return!1; default:return!0}},isCharacterKey:function(a){if(a>=i.ZERO&&a<=i.NINE||a>=i.NUM_ZERO&&a<=i.NUM_MULTIPLY||a>=i.A&&a<=i.Z||b.webkit&&0==a)return!0;switch(a){case i.SPACE:case i.QUESTION_MARK:case i.NUM_PLUS:case i.NUM_MINUS:case i.NUM_PERIOD:case i.NUM_DIVISION:case i.SEMICOLON:case i.DASH:case i.EQUALS:case i.COMMA:case i.PERIOD:case i.SLASH:case i.APOSTROPHE:case i.SINGLE_QUOTE:case i.OPEN_SQUARE_BRACKET:case i.BACKSLASH:case i.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};return i}); KISSY.add("event/dom/base/mouseenter",function(a,b,i,k){a.each([{name:"mouseenter",fix:"mouseover"},{name:"mouseleave",fix:"mouseout"}],function(a){k[a.name]={onFix:a.fix,delegateFix:a.fix,handle:function(a,b,e){var f=a.currentTarget,d=a.relatedTarget;if(!d||d!==f&&!i.contains(f,d))return[b.simpleNotify(a,e)]}}});return b},{requires:["./api","dom","./special"]}); KISSY.add("event/dom/base/mousewheel",function(a,b){var i=a.UA.gecko?"DOMMouseScroll":"mousewheel";b.mousewheel={onFix:i,delegateFix:i}},{requires:["./special"]}); KISSY.add("event/dom/base/object",function(a,b,i){function k(a){this.scale=this.rotation=this.targetTouches=this.touches=this.changedTouches=this.which=this.wheelDelta=this.view=this.toElement=this.srcElement=this.shiftKey=this.screenY=this.screenX=this.relatedTarget=this.relatedNode=this.prevValue=this.pageY=this.pageX=this.offsetY=this.offsetX=this.newValue=this.metaKey=this.keyCode=this.handler=this.fromElement=this.eventPhase=this.detail=this.data=this.ctrlKey=this.clientY=this.clientX=this.charCode= this.cancelable=this.button=this.bubbles=this.attrName=this.attrChange=this.altKey=i;k.superclass.constructor.call(this);this.originalEvent=a;this.isDefaultPrevented=a.defaultPrevented||a.returnValue===f||a.getPreventDefault&&a.getPreventDefault()?function(){return e}:function(){return f};g(this);j(this)}function g(a){for(var b=a.originalEvent,e=d.length,f,g=b.currentTarget,g=9===g.nodeType?g:g.ownerDocument||l;e;)f=d[--e],a[f]=b[f];a.target||(a.target=a.srcElement||g);3===a.target.nodeType&&(a.target= a.target.parentNode);!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);a.pageX===i&&a.clientX!==i&&(b=g.documentElement,e=g.body,a.pageX=a.clientX+(b&&b.scrollLeft||e&&e.scrollLeft||0)-(b&&b.clientLeft||e&&e.clientLeft||0),a.pageY=a.clientY+(b&&b.scrollTop||e&&e.scrollTop||0)-(b&&b.clientTop||e&&e.clientTop||0));a.which===i&&(a.which=a.charCode===i?a.keyCode:a.charCode);a.metaKey===i&&(a.metaKey=a.ctrlKey);!a.which&&a.button!==i&&(a.which=a.button& 1?1:a.button&2?3:a.button&4?2:0)}function j(b){var c,d,e,f=b.detail;b.wheelDelta&&(e=b.wheelDelta/120);b.detail&&(e=-(0==f%3?f/3:f));b.axis!==i&&(b.axis===b.HORIZONTAL_AXIS?(d=0,c=-1*e):b.axis===b.VERTICAL_AXIS&&(c=0,d=e));b.wheelDeltaY!==i&&(d=b.wheelDeltaY/120);b.wheelDeltaX!==i&&(c=-1*b.wheelDeltaX/120);!c&&!d&&(d=e);(c!==i||d!==i||e!==i)&&a.mix(b,{deltaY:d,delta:e,deltaX:c})}var l=a.Env.host.document,e=!0,f=!1,d="type,altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,pageX,pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which,axis,changedTouches,touches,targetTouches,rotation,scale".split(","); a.extend(k,b._Object,{constructor:k,preventDefault:function(){var a=this.originalEvent;a.preventDefault?a.preventDefault():a.returnValue=f;k.superclass.preventDefault.call(this)},stopPropagation:function(){var a=this.originalEvent;a.stopPropagation?a.stopPropagation():a.cancelBubble=e;k.superclass.stopPropagation.call(this)}});return b.DOMEventObject=k},{requires:["event/base"]}); KISSY.add("event/dom/base/observable",function(a,b,i,k,g,j,l){function e(b){a.mix(this,b);this.reset()}var f=l._Utils;a.extend(e,l._ObservableEvent,{setup:function(){var a=this.type,b=i[a]||{},c=this.currentTarget,e=k.data(c).handle;(!b.setup||!1===b.setup.call(c,a))&&k.simpleAdd(c,a,e)},constructor:e,reset:function(){e.superclass.reset.call(this);this.lastCount=this.delegateCount=0},notify:function(a){var h=a.target,c=this.currentTarget,e=this.observers,f=[],g,j,i=this.delegateCount||0,l,k;if(i&& !h.disabled)for(;h!=c;){l=[];for(j=0;j<i;j++)k=e[j],b.test(h,k.selector)&&l.push(k);l.length&&f.push({currentTarget:h,currentTargetObservers:l});h=h.parentNode||c}f.push({currentTarget:c,currentTargetObservers:e.slice(i)});j=0;for(h=f.length;!a.isPropagationStopped()&&j<h;++j){c=f[j];l=c.currentTargetObservers;c=c.currentTarget;a.currentTarget=c;for(c=0;!a.isImmediatePropagationStopped()&&c<l.length;c++)e=l[c],e=e.notify(a,this),!1!==g&&(g=e)}return g},fire:function(d,h){var d=d||{},c=this.type,f= i[c];f&&f.onFix&&(c=f.onFix);var g,l,f=this.currentTarget,k=!0;d.type=c;d instanceof j||(l=d,d=new j({currentTarget:f,target:f}),a.mix(d,l));l=f;g=b.getWindow(l.ownerDocument||l);var q=g.document,r=[],t=0,s="on"+c;do r.push(l),l=l.parentNode||l.ownerDocument||l===q&&g;while(l);l=r[t];do{d.currentTarget=l;if(g=e.getCustomEvent(l,c))g=g.notify(d),!1!==k&&(k=g);l[s]&&!1===l[s].call(l)&&d.preventDefault();l=r[++t]}while(!h&&l&&!d.isPropagationStopped());if(!h&&!d.isDefaultPrevented()){var u;try{if(s&& f[c]&&("focus"!==c&&"blur"!==c||0!==f.offsetWidth)&&!a.isWindow(f))(u=f[s])&&(f[s]=null),e.triggeredEvent=c,f[c]()}catch(v){}u&&(f[s]=u);e.triggeredEvent=""}return k},on:function(a){var b=this.observers,c=i[this.type]||{},a=a instanceof g?a:new g(a);-1==this.findObserver(a)&&(a.selector?(b.splice(this.delegateCount,0,a),this.delegateCount++):a.last?(b.push(a),this.lastCount++):b.splice(b.length-this.lastCount,0,a),c.add&&c.add.call(this.currentTarget,a))},detach:function(a){var b,c=i[this.type]|| {},e="selector"in a,g=a.selector,j=a.context,l=a.fn,k=this.currentTarget,r=this.observers,a=a.groups;if(r.length){a&&(b=f.getGroupsRe(a));var t,s,u,v,x=r.length;if(l||e||b){j=j||k;t=a=0;for(s=[];a<x;++a)u=r[a],v=u.context||k,j!=v||l&&l!=u.fn||e&&(g&&g!=u.selector||!g&&!u.selector)||b&&!u.groups.match(b)?s[t++]=u:(u.selector&&this.delegateCount&&this.delegateCount--,u.last&&this.lastCount&&this.lastCount--,c.remove&&c.remove.call(k,u));this.observers=s}else this.reset();this.checkMemory()}},checkMemory:function(){var b= this.type,h,c,e=i[b]||{},f=this.currentTarget,g=k.data(f);if(g&&(h=g.events,this.hasObserver()||(c=g.handle,(!e.tearDown||!1===e.tearDown.call(f,b))&&k.simpleRemove(f,b,c),delete h[b]),a.isEmptyObject(h)))g.handle=null,k.removeData(f)}});e.triggeredEvent="";e.getCustomEvent=function(a,b){var c=k.data(a),e;c&&(e=c.events);if(e)return e[b]};e.getCustomEvents=function(a,b){var c=k.data(a);!c&&b&&k.data(a,c={});return c};return e},{requires:"dom,./special,./utils,./observer,./object,event/base".split(",")}); KISSY.add("event/dom/base/observer",function(a,b,i){function k(a){k.superclass.constructor.apply(this,arguments)}a.extend(k,i._Observer,{keys:"fn,selector,data,context,originalType,groups,last".split(","),notifyInternal:function(a,j){var i,e,f=a.type;this.originalType&&(a.type=this.originalType);(i=b[a.type])&&i.handle?(i=i.handle(a,this,j))&&0<i.length&&(e=i[0]):e=this.simpleNotify(a,j);a.type=f;return e}});return k},{requires:["./special","event/base"]});KISSY.add("event/dom/base/special",function(){return{}}); KISSY.add("event/dom/base/utils",function(a,b){var i=a.Env.host.document;return{simpleAdd:i&&i.addEventListener?function(a,b,j,i){a.addEventListener&&a.addEventListener(b,j,!!i)}:function(a,b,j){a.attachEvent&&a.attachEvent("on"+b,j)},simpleRemove:i&&i.removeEventListener?function(a,b,j,i){a.removeEventListener&&a.removeEventListener(b,j,!!i)}:function(a,b,j){a.detachEvent&&a.detachEvent("on"+b,j)},data:function(a,g){return b.data(a,"ksEventTargetId_1.30",g)},removeData:function(a){return b.removeData(a, "ksEventTargetId_1.30")}}},{requires:["dom"]}); KISSY.add("event/dom/base/valuechange",function(a,b,i,k){function g(a){if(i.hasData(a,p)){var b=i.data(a,p);clearTimeout(b);i.removeData(a,p)}}function j(a){g(a.target)}function l(a){var d=a.value,h=i.data(a,n);d!==h&&(b.fireHandler(a,c,{prevVal:h,newVal:d}),i.data(a,n,d))}function e(a){i.hasData(a,p)||i.data(a,p,setTimeout(function(){l(a);i.data(a,p,setTimeout(arguments.callee,o))},o))}function f(a){var b=a.target;"focus"==a.type&&i.data(b,n,b.value);e(b)}function d(a){l(a.target)}function h(a){i.removeData(a, n);g(a);b.remove(a,"blur",j);b.remove(a,"webkitspeechchange",d);b.remove(a,"mousedown keyup keydown focus",f)}var c="valuechange",m=i.nodeName,n="event/valuechange/history",p="event/valuechange/poll",o=50;k[c]={setup:function(){var a=m(this);if("input"==a||"textarea"==a)h(this),b.on(this,"blur",j),b.on(this,"webkitspeechchange",d),b.on(this,"mousedown keyup keydown focus",f)},tearDown:function(){h(this)}};return b},{requires:["./api","dom","./special"]}); KISSY.add("event/dom/focusin",function(a,b){var i=b._Special;a.each([{name:"focusin",fix:"focus"},{name:"focusout",fix:"blur"}],function(k){function g(a){return b.fire(a.target,k.name)}var j=a.guid("attaches_"+a.now()+"_");i[k.name]={setup:function(){var a=this.ownerDocument||this;j in a||(a[j]=0);a[j]+=1;1===a[j]&&a.addEventListener(k.fix,g,!0)},tearDown:function(){var a=this.ownerDocument||this;a[j]-=1;0===a[j]&&a.removeEventListener(k.fix,g,!0)}}});return b},{requires:["event/dom/base"]}); KISSY.add("event/dom/hashchange",function(a,b,i){var k=a.UA,g=b._Special,j=a.Env.host,l=j.document,e=l&&l.documentMode,f="__replace_history_"+a.now(),k=e||k.ie;b.REPLACE_HISTORY=f;var d="<html><head><title>"+(l&&l.title||"")+" - {hash}</title>{head}</head><body>{hash}</body></html>",h=function(){return"#"+(new a.Uri(location.href)).getFragment()},c,m,n=function(){var b=h(),d;if(d=a.endsWith(b,f))b=b.slice(0,-f.length),location.hash=b;b!==m&&(m=b,p(b,d));c=setTimeout(n,50)},p=k&&8>k?function(b,c){var h= a.substitute(d,{hash:a.escapeHTML(b),head:i.isCustomDomain()?"<script>document.domain = '"+l.domain+"';<\/script>":""}),e=r.contentWindow.document;try{c?e.open("text/html","replace"):e.open(),e.write(h),e.close()}catch(f){}}:function(){b.fireHandler(j,"hashchange")},o=function(){c||n()},q=function(){c&&clearTimeout(c);c=0},r;k&&8>k&&(o=function(){if(!r){var c=i.getEmptyIframeSrc();r=i.create("<iframe "+(c?'src="'+c+'"':"")+' style="display: none" height="0" width="0" tabindex="-1" title="empty"/>'); i.prepend(r,l.documentElement);b.add(r,"load",function(){b.remove(r,"load");p(h());b.add(r,"load",d);n()});l.onpropertychange=function(){try{"title"===event.propertyName&&(r.contentWindow.document.title=l.title+" - "+h())}catch(a){}};var d=function(){var c=a.trim(r.contentWindow.document.body.innerText),d=h();c!=d&&(m=location.hash=c);b.fireHandler(j,"hashchange")}}},q=function(){c&&clearTimeout(c);c=0;b.detach(r);i.remove(r);r=0});g.hashchange={setup:function(){if(this===j){m=h();o()}},tearDown:function(){this=== j&&q()}}},{requires:["event/dom/base","dom"]}); KISSY.add("event/dom/ie/change",function(a,b,i){function k(a){a=a.type;return"checkbox"==a||"radio"==a}function g(a){"checked"==a.originalEvent.propertyName&&(this.__changed=1)}function j(a){this.__changed&&(this.__changed=0,b.fire(this,"change",a))}function l(a){a=a.target;f.test(a.nodeName)&&!a.__changeHandler&&(a.__changeHandler=1,b.on(a,"change",{fn:e,last:1}))}function e(a){if(!a.isPropagationStopped()&&!k(this)){var h;(h=this.parentNode)&&b.fire(h,"change",a)}}var f=/^(?:textarea|input|select)$/i; b._Special.change={setup:function(){if(f.test(this.nodeName))if(k(this))b.on(this,"propertychange",g),b.on(this,"click",j);else return!1;else b.on(this,"beforeactivate",l)},tearDown:function(){if(f.test(this.nodeName))if(k(this))b.remove(this,"propertychange",g),b.remove(this,"click",j);else return!1;else b.remove(this,"beforeactivate",l),a.each(i.query("textarea,input,select",this),function(a){a.__changeHandler&&(a.__changeHandler=0,b.remove(a,"change",{fn:e,last:1}))})}}},{requires:["event/dom/base", "dom"]});KISSY.add("event/dom/ie",function(){},{requires:["./ie/change","./ie/submit"]}); KISSY.add("event/dom/ie/submit",function(a,b,i){function k(a){var a=a.target,e=j(a);if((a="input"==e||"button"==e?a.form:null)&&!a.__submit__fix)a.__submit__fix=1,b.on(a,"submit",{fn:g,last:1})}function g(a){this.parentNode&&!a.isPropagationStopped()&&!a.synthetic&&b.fire(this.parentNode,"submit",a)}var j=i.nodeName;b._Special.submit={setup:function(){if("form"==j(this))return!1;b.on(this,"click keypress",k)},tearDown:function(){if("form"==j(this))return!1;b.remove(this,"click keypress",k);a.each(i.query("form", this),function(a){a.__submit__fix&&(a.__submit__fix=0,b.remove(a,"submit",{fn:g,last:1}))})}}},{requires:["event/dom/base","dom"]}); KISSY.add("event/dom/shake",function(a,b,i){function k(a){var b=a.accelerationIncludingGravity,a=b.x,g=b.y,b=b.z,k;f!==i&&(k=c(m(a-f),m(g-d),m(b-h)),k>j&&p(),k>l&&(e=1));f=a;d=g;h=b}var g=b._Special,j=5,l=20,e=0,f,d,h,c=Math.max,m=Math.abs,n=a.Env.host,p=a.buffer(function(){e&&(b.fireHandler(n,"shake",{accelerationIncludingGravity:{x:f,y:d,z:h}}),f=i,e=0)},250);g.shake={setup:function(){this==n&&n.addEventListener("devicemotion",k,!1)},tearDown:function(){this==n&&(p.stop(),f=i,e=0,n.removeEventListener("devicemotion", k,!1))}}},{requires:["event/dom/base"]}); KISSY.add("event/dom/touch/double-tap",function(a,b,i,k){function g(){}a.extend(g,k,{onTouchStart:function(a){if(!1===g.superclass.onTouchStart.apply(this,arguments))return!1;this.startTime=a.timeStamp;this.singleTapTimer&&(clearTimeout(this.singleTapTimer),this.singleTapTimer=0)},onTouchMove:function(){return!1},onTouchEnd:function(a){var b=this.lastEndTime,e=a.timeStamp,f=a.target,d=a.changedTouches[0],h=e-this.startTime;this.lastEndTime=e;if(b&&(h=e-b,300>h)){this.lastEndTime=0;i.fire(f,"doubleTap", {touch:d,duration:h/1E3});return}h=e-this.startTime;300<h?i.fire(f,"singleTap",{touch:d,duration:h/1E3}):this.singleTapTimer=setTimeout(function(){i.fire(f,"singleTap",{touch:d,duration:h/1E3})},300)}});b.singleTap=b.doubleTap={handle:new g};return g},{requires:["./handle-map","event/dom/base","./single-touch"]}); KISSY.add("event/dom/touch/gesture",function(a,b){var i=b.Gesture,k,g,j;a.Features.isTouchSupported()&&(k="touchstart",g="touchmove",j="touchend");k&&(i.start=k,i.move=g,i.end=j,i.tap="tap",i.doubleTap="doubleTap");return i},{requires:["event/dom/base"]});KISSY.add("event/dom/touch/handle-map",function(){return{}}); KISSY.add("event/dom/touch/handle",function(a,b,i,k,g){function j(a){this.doc=a;this.eventHandle={};this.init()}var l=a.guid("touch-handle"),e=a.Features,f={};f[g.start]="onTouchStart";f[g.move]="onTouchMove";f[g.end]="onTouchEnd";"mousedown"!==g.start&&(f.touchcancel="onTouchEnd");var d=a.throttle(function(a){this.callEventHandle("onTouchMove",a)},30);j.prototype={init:function(){var a=this.doc,b,d;for(b in f){d=f[b];k.on(a,b,this[d],this)}},normalize:function(a){var b=a.type,d;if(!e.isTouchSupported()){if(b.indexOf("mouse")!= -1&&a.which!=1)return;d=[a];b=!b.match(/up$/i);a.touches=b?d:[];a.targetTouches=b?d:[];a.changedTouches=d}return a},onTouchMove:function(a){d.call(this,a)},onTouchStart:function(a){var b,d,e=this.eventHandle;for(b in e){d=e[b].handle;d.isActive=1}this.callEventHandle("onTouchStart",a)},onTouchEnd:function(a){this.callEventHandle("onTouchEnd",a)},callEventHandle:function(a,b){var d=this.eventHandle,e,f;if(b=this.normalize(b)){for(e in d){f=d[e].handle;if(!f.processed){f.processed=1;if(f.isActive&& f[a](b)===false)f.isActive=0}}for(e in d){f=d[e].handle;f.processed=0}}},addEventHandle:function(a){var b=this.eventHandle,d=i[a].handle;b[a]?b[a].count++:b[a]={count:1,handle:d}},removeEventHandle:function(a){var b=this.eventHandle;if(b[a]){b[a].count--;b[a].count||delete b[a]}},destroy:function(){var a=this.doc,b,d;for(b in f){d=f[b];k.detach(a,b,this[d],this)}}};return{addDocumentHandle:function(a,c){var d=b.getWindow(a.ownerDocument||a).document,e=i[c].setup,f=b.data(d,l);f||b.data(d,l,f=new j(d)); e&&e.call(a,c);f.addEventHandle(c)},removeDocumentHandle:function(d,c){var e=b.getWindow(d.ownerDocument||d).document,f=i[c].tearDown,g=b.data(e,l);f&&f.call(d,c);if(g){g.removeEventHandle(c);if(a.isEmptyObject(g.eventHandle)){g.destroy();b.removeData(e,l)}}}}},{requires:"dom,./handle-map,event/dom/base,./gesture,./tap,./swipe,./double-tap,./pinch,./tap-hold,./rotate".split(",")}); KISSY.add("event/dom/touch/multi-touch",function(a,b){function i(){}i.prototype={requiredTouchCount:2,onTouchStart:function(a){var b=this.requiredTouchCount,j=a.touches.length;j===b?this.start():j>b&&this.end(a)},onTouchEnd:function(a){this.end(a)},start:function(){this.isTracking||(this.isTracking=!0,this.isStarted=!1)},fireEnd:a.noop,getCommonTarget:function(a){var g=a.touches,a=g[0].target,g=g[1].target;if(a==g||b.contains(a,g))return a;for(;;){if(b.contains(g,a))return g;g=g.parentNode}},end:function(a){this.isTracking&& (this.isTracking=!1,this.isStarted&&(this.isStarted=!1,this.fireEnd(a)))}};return i},{requires:["dom"]}); KISSY.add("event/dom/touch/pinch",function(a,b,i,k,g){function j(){}function l(a){(!a.touches||2==a.touches.length)&&a.preventDefault()}a.extend(j,k,{onTouchMove:function(b){if(this.isTracking){var f=b.touches,d,h=f[0],c=f[1];d=h.pageX-c.pageX;h=h.pageY-c.pageY;d=Math.sqrt(d*d+h*h);this.lastTouches=f;this.isStarted?i.fire(this.target,"pinch",a.mix(b,{distance:d,scale:d/this.startDistance})):(this.isStarted=!0,this.startDistance=d,f=this.target=this.getCommonTarget(b),i.fire(f,"pinchStart",a.mix(b, {distance:d,scale:1})))}},fireEnd:function(b){i.fire(this.target,"pinchEnd",a.mix(b,{touches:this.lastTouches}))}});k=new j;b.pinchStart=b.pinchEnd={handle:k};b.pinch={handle:k,setup:function(){i.on(this,g.move,l)},tearDown:function(){i.detach(this,g.move,l)}};return j},{requires:["./handle-map","event/dom/base","./multi-touch","./gesture"]}); KISSY.add("event/dom/touch/rotate",function(a,b,i,k,g,j){function l(){}function e(a){(!a.touches||2==a.touches.length)&&a.preventDefault()}var f=180/Math.PI;a.extend(l,i,{onTouchMove:function(b){if(this.isTracking){var e=b.touches,c=e[0],g=e[1],i=this.lastAngle,c=Math.atan2(g.pageY-c.pageY,g.pageX-c.pageX)*f;if(i!==j){var g=Math.abs(c-i),l=(c+360)%360,o=(c-360)%360;Math.abs(l-i)<g?c=l:Math.abs(o-i)<g&&(c=o)}this.lastTouches=e;this.lastAngle=c;this.isStarted?k.fire(this.target,"rotate",a.mix(b,{angle:c, rotation:c-this.startAngle})):(this.isStarted=!0,this.startAngle=c,this.target=this.getCommonTarget(b),k.fire(this.target,"rotateStart",a.mix(b,{angle:c,rotation:0})))}},end:function(){this.lastAngle=j;l.superclass.end.apply(this,arguments)},fireEnd:function(b){k.fire(this.target,"rotateEnd",a.mix(b,{touches:this.lastTouches}))}});i=new l;b.rotateEnd=b.rotateStart={handle:i};b.rotate={handle:i,setup:function(){k.on(this,g.move,e)},tearDown:function(){k.detach(this,g.move,e)}};return l},{requires:["./handle-map", "./multi-touch","event/dom/base","./gesture"]});KISSY.add("event/dom/touch/single-touch",function(a){function b(){}b.prototype={requiredTouchCount:1,onTouchStart:function(a){if(a.touches.length!=this.requiredTouchCount)return!1;this.lastTouches=a.touches},onTouchMove:a.noop,onTouchEnd:a.noop};return b}); KISSY.add("event/dom/touch/swipe",function(a,b,i,k){function g(a,b,c){var g=b.changedTouches[0],j=g.pageX-a.startX,k=g.pageY-a.startY,o=Math.abs(j),q=Math.abs(k);if(c)a.isVertical&&a.isHorizontal&&(q>o?a.isHorizontal=0:a.isVertical=0);else if(a.isVertical&&q<f&&(a.isVertical=0),a.isHorizontal&&o<f)a.isHorizontal=0;if(a.isHorizontal)j=0>j?"left":"right";else if(a.isVertical)j=0>k?"up":"down",o=q;else return!1;i.fire(b.target,c?e:l,{originalEvent:b.originalEvent,touch:g,direction:j,distance:o,duration:(b.timeStamp- a.startTime)/1E3})}function j(){}var l="swipe",e="swiping",f=50;a.extend(j,k,{onTouchStart:function(a){if(!1===j.superclass.onTouchStart.apply(this,arguments))return!1;var b=a.touches[0];this.startTime=a.timeStamp;this.isVertical=this.isHorizontal=1;this.startX=b.pageX;this.startY=b.pageY;-1!=a.type.indexOf("mouse")&&a.preventDefault()},onTouchMove:function(a){var b=a.changedTouches[0],c=b.pageY-this.startY,b=Math.abs(b.pageX-this.startX),c=Math.abs(c);if(1E3<a.timeStamp-this.startTime)return!1;this.isVertical&& 35<b&&(this.isVertical=0);this.isHorizontal&&35<c&&(this.isHorizontal=0);return g(this,a,1)},onTouchEnd:function(a){return!1===this.onTouchMove(a)?!1:g(this,a,0)}});b[l]=b[e]={handle:new j};return j},{requires:["./handle-map","event/dom/base","./single-touch"]}); KISSY.add("event/dom/touch/tap-hold",function(a,b,i,k,g){function j(){}function l(a){(!a.touches||1==a.touches.length)&&a.preventDefault()}a.extend(j,i,{onTouchStart:function(b){if(!1===j.superclass.onTouchStart.call(this,b))return!1;this.timer=setTimeout(function(){k.fire(b.target,"tapHold",{touch:b.touches[0],duration:(a.now()-b.timeStamp)/1E3})},1E3)},onTouchMove:function(){clearTimeout(this.timer);return!1},onTouchEnd:function(){clearTimeout(this.timer)}});b.tapHold={setup:function(){k.on(this, g.start,l)},tearDown:function(){k.detach(this,g.start,l)},handle:new j};return j},{requires:["./handle-map","./single-touch","event/dom/base","./gesture"]});KISSY.add("event/dom/touch/tap",function(a,b,i,k){function g(){}a.extend(g,k,{onTouchMove:function(){return!1},onTouchEnd:function(a){i.fire(a.target,"tap",{touch:a.changedTouches[0]})}});b.tap={handle:new g};return g},{requires:["./handle-map","event/dom/base","./single-touch"]}); KISSY.add("event/dom/touch",function(a,b,i,k){var a=b._Special,b={setup:function(a){k.addDocumentHandle(this,a)},tearDown:function(a){k.removeDocumentHandle(this,a)}},g;for(g in i)a[g]=b},{requires:["event/dom/base","./touch/handle-map","./touch/handle"]}); KISSY.add("json/json2",function(){function a(a){return 10>a?"0"+a:a}function b(a){j.lastIndex=0;return j.test(a)?'"'+a.replace(j,function(a){var b=f[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function i(a,c){var f,g,j,k,q=l,r,t=c[a];t&&"object"===typeof t&&"function"===typeof t.toJSON&&(t=t.toJSON(a));"function"===typeof d&&(t=d.call(c,a,t));switch(typeof t){case "string":return b(t);case "number":return isFinite(t)?""+t:"null";case "boolean":case "null":return""+ t;case "object":if(!t)return"null";l+=e;r=[];if("[object Array]"===Object.prototype.toString.apply(t)){k=t.length;for(f=0;f<k;f+=1)r[f]=i(f,t)||"null";j=0===r.length?"[]":l?"[\n"+l+r.join(",\n"+l)+"\n"+q+"]":"["+r.join(",")+"]";l=q;return j}if(d&&"object"===typeof d){k=d.length;for(f=0;f<k;f+=1)g=d[f],"string"===typeof g&&(j=i(g,t))&&r.push(b(g)+(l?": ":":")+j)}else for(g in t)Object.hasOwnProperty.call(t,g)&&(j=i(g,t))&&r.push(b(g)+(l?": ":":")+j);j=0===r.length?"{}":l?"{\n"+l+r.join(",\n"+l)+"\n"+ q+"}":"{"+r.join(",")+"}";l=q;return j}}var k={};"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var g=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, j=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,l,e,f={"":"\\b","\t":"\\t","\n":"\\n"," ":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},d;k.stringify=function(a,b,f){var g;e=l="";if(typeof f==="number")for(g=0;g<f;g=g+1)e=e+" ";else typeof f==="string"&&(e=f);if((d=b)&&typeof b!=="function"&&(typeof b!=="object"||typeof b.length!=="number"))throw Error("JSON.stringify");return i("",{"":a})};k.parse=function(a,b){function d(a, f){var e,h,g=a[f];if(g&&typeof g==="object")for(e in g)if(Object.hasOwnProperty.call(g,e)){h=d(g,e);h!==void 0?g[e]=h:delete g[e]}return b.call(a,f,g)}var f,a=""+a;g.lastIndex=0;g.test(a)&&(a=a.replace(g,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){f=eval("("+a+")");return typeof b=== "function"?d({"":f},""):f}throw new SyntaxError("JSON.parse");};return k});KISSY.add("json",function(a,b){b||(b=JSON);return a.JSON={parse:function(a){return null==a||""===a?null:b.parse(a)},stringify:b.stringify}},{requires:[KISSY.Features.isNativeJSONSupported()?"":"json/json2"]}); KISSY.add("ajax",function(a,b,i){function k(b,l,e,f,d){a.isFunction(l)&&(f=e,e=l,l=g);return i({type:d||"get",url:b,data:l,success:e,dataType:f})}var g=void 0;a.mix(i,{serialize:b.serialize,get:k,post:function(b,i,e,f){a.isFunction(i)&&(f=e,e=i,i=g);return k(b,i,e,f,"post")},jsonp:function(b,i,e){a.isFunction(i)&&(e=i,i=g);return k(b,i,e,"jsonp")},getScript:a.getScript,getJSON:function(b,i,e){a.isFunction(i)&&(e=i,i=g);return k(b,i,e,"json")},upload:function(b,k,e,f,d){a.isFunction(e)&&(d=f,f=e,e= g);return i({url:b,type:"post",dataType:d,form:k,data:e,success:f})}});a.mix(a,{Ajax:i,IO:i,ajax:i,io:i,jsonp:i.jsonp});return i},{requires:"ajax/form-serializer,ajax/base,ajax/xhr-transport,ajax/script-transport,ajax/jsonp,ajax/form,ajax/iframe-transport,ajax/methods".split(",")}); KISSY.add("ajax/base",function(a,b,i,k){function g(b){var d=b.context;delete b.context;b=a.mix(a.clone(p),b,{deep:!0});b.context=d||b;var e,h=b.type,g=b.dataType,d=b.uri=m.resolve(b.url);b.uri.setQuery("");"crossDomain"in b||(b.crossDomain=!b.uri.isSameOriginAs(m));h=b.type=h.toUpperCase();b.hasContent=!c.test(h);if(b.processData&&(e=b.data)&&"string"!=typeof e)b.data=a.param(e,k,k,b.serializeArray);g=b.dataType=a.trim(g||"*").split(f);!("cache"in b)&&a.inArray(g[0],["script","jsonp"])&&(b.cache= !1);b.hasContent||(b.data&&d.query.add(a.unparam(b.data)),!1===b.cache&&d.query.set("_ksTS",a.now()+"_"+a.guid()));return b}function j(a,b){l.fire(a,{ajaxConfig:b.config,io:b})}function l(b){function c(a){return function(c){if(i=d.timeoutTimer)clearTimeout(i),d.timeoutTimer=0;var f=b[a];f&&f.apply(w,c);j(a,d)}}var d=this;if(!(d instanceof l))return new l(b);h.call(d);b=g(b);a.mix(d,{responseData:null,config:b||{},timeoutTimer:null,responseText:null,responseXML:null,responseHeadersString:"",responseHeaders:null, requestHeaders:{},readyState:0,state:0,statusText:null,status:0,transport:null,_defer:new a.Defer(this)});var f;j("start",d);f=new (n[b.dataType[0]]||n["*"])(d);d.transport=f;b.contentType&&d.setRequestHeader("Content-Type",b.contentType);var e=b.dataType[0],i,k,m=b.timeout,w=b.context,p=b.headers,y=b.accepts;d.setRequestHeader("Accept",e&&y[e]?y[e]+("*"===e?"":", */*; q=0.01"):y["*"]);for(k in p)d.setRequestHeader(k,p[k]);if(b.beforeSend&&!1===b.beforeSend.call(w,d,b))return d;d.then(c("success"), c("error"));d.fin(c("complete"));d.readyState=1;j("send",d);b.async&&0<m&&(d.timeoutTimer=setTimeout(function(){d.abort("timeout")},1E3*m));try{d.state=1,f.send()}catch(B){2>d.state&&d._ioReady(-1,B.message)}return d}var e=/^(?:about|app|app\-storage|.+\-extension|file|widget)$/,f=/\s+/,d=function(a){return a},h=a.Promise,c=/^(?:GET|HEAD)$/,m=new a.Uri((a.Env.host.location||{}).href),e=m&&e.test(m.getScheme()),n={},p={type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",async:!0, serializeArray:!0,processData:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},converters:{text:{json:b.parse,html:d,text:d,xml:a.parseXML}},contents:{xml:/xml/,html:/html/,json:/json/}};p.converters.html=p.converters.text;a.mix(l,i.Target);a.mix(l,{isLocal:e,setupConfig:function(b){a.mix(p,b,{deep:!0})},setupTransport:function(a,b){n[a]=b},getTransport:function(a){return n[a]},getConfig:function(){return p}});return l}, {requires:["json","event"]}); KISSY.add("ajax/form-serializer",function(a,b){function i(a){return a.replace(g,"\r\n")}var k=/^(?:select|textarea)/i,g=/\r?\n/g,j,l=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i;return j={serialize:function(b,f){return a.param(j.getFormData(b),void 0,void 0,f||!1)},getFormData:function(e){var f=[],d={};a.each(b.query(e),function(b){b=b.elements?a.makeArray(b.elements):[b];f.push.apply(f,b)});f=a.filter(f,function(a){return a.name&&!a.disabled&& (a.checked||k.test(a.nodeName)||l.test(a.type))});a.each(f,function(f){var c=b.val(f),e;null!==c&&(c=a.isArray(c)?a.map(c,i):i(c),(e=d[f.name])?(e&&!a.isArray(e)&&(e=d[f.name]=[e]),e.push.apply(e,a.makeArray(c))):d[f.name]=c)});return d}}},{requires:["dom"]}); KISSY.add("ajax/form",function(a,b,i,k){b.on("start",function(b){var j,l,e,b=b.io.config;if(e=b.form)j=i.get(e),l=j.encoding||j.enctype,e=b.data,"multipart/form-data"!=l.toLowerCase()?(j=k.getFormData(j),b.hasContent?(j=a.param(j,void 0,void 0,b.serializeArray),b.data=e?b.data+("&"+j):j):b.uri.query.add(j)):(e=b.dataType,b=e[0],"*"==b&&(b="text"),e.length=2,e[0]="iframe",e[1]=b)});return b},{requires:["./base","dom","./form-serializer"]}); KISSY.add("ajax/iframe-transport",function(a,b,i,k){function g(f){var d=a.guid("io-iframe"),h=b.getEmptyIframeSrc(),f=f.iframe=b.create("<iframe "+(h?' src="'+h+'" ':"")+' id="'+d+'" name="'+d+'" style="position:absolute;left:-9999px;top:-9999px;"/>');b.prepend(f,e.body||e.documentElement);return f}function j(f,d,h){var c=[],g,j,i,k;a.each(f,function(f,l){g=a.isArray(f);j=a.makeArray(f);for(i=0;i<j.length;i++)k=e.createElement("input"),k.type="hidden",k.name=l+(g&&h?"[]":""),k.value=j[i],b.append(k, d),c.push(k)});return c}function l(a){this.io=a}var e=a.Env.host.document;k.setupConfig({converters:{iframe:k.getConfig().converters.text,text:{iframe:function(a){return a}},xml:{iframe:function(a){return a}}}});a.augment(l,{send:function(){function f(){i.on(l,"load error",d._callback,d);q.submit()}var d=this,e=d.io,c=e.config,k,l,p,o=c.data,q=b.get(c.form);d.attrs={target:b.attr(q,"target")||"",action:b.attr(q,"action")||"",method:b.attr(q,"method")};d.form=q;l=g(e);b.attr(q,{target:l.id,action:e._getUrlForSend(), method:"post"});o&&(p=a.unparam(o));p&&(k=j(p,q,c.serializeArray));d.fields=k;6==a.UA.ie?setTimeout(f,0):f()},_callback:function(e){var d=this,h=d.form,c=d.io,e=e.type,g,j=c.iframe;if(j)if("abort"==e&&6==a.UA.ie?setTimeout(function(){b.attr(h,d.attrs)},0):b.attr(h,d.attrs),b.remove(this.fields),i.detach(j),setTimeout(function(){b.remove(j)},30),c.iframe=null,"load"==e)try{if((g=j.contentWindow.document)&&g.body)c.responseText=a.trim(b.text(g.body)),a.startsWith(c.responseText,"<?xml")&&(c.responseText= void 0);c.responseXML=g&&g.XMLDocument?g.XMLDocument:g;g?c._ioReady(200,"success"):c._ioReady(500,"parser error")}catch(k){c._ioReady(500,"parser error")}else"error"==e&&c._ioReady(500,"error")},abort:function(){this._callback({type:"abort"})}});k.setupTransport("iframe",l);return k},{requires:["dom","event","./base"]}); KISSY.add("ajax/jsonp",function(a,b){var i=a.Env.host;b.setupConfig({jsonp:"callback",jsonpCallback:function(){return a.guid("jsonp")}});b.on("start",function(b){var g=b.io,j=g.config,b=j.dataType;if("jsonp"==b[0]){var l,e=j.jsonpCallback,f=a.isFunction(e)?e():e,d=i[f];j.uri.query.set(j.jsonp,f);i[f]=function(b){1<arguments.length&&(b=a.makeArray(arguments));l=[b]};g.fin(function(){i[f]=d;if(void 0===d)try{delete i[f]}catch(a){}else l&&d(l[0])});g=g.converters=g.converters||{};g.script=g.script|| {};g.script.json=function(){return l[0]};b.length=2;b[0]="script";b[1]="json"}});return b},{requires:["./base"]}); KISSY.add("ajax/methods",function(a,b,i){function k(b){var g=b.responseText,e=b.responseXML,f=b.config,d=f.converters,h=b.converters||{},c,k,n=f.contents,p=f.dataType;if(g||e){for(f=b.mimeType||b.getResponseHeader("Content-Type");"*"==p[0];)p.shift();if(!p.length)for(c in n)if(n[c].test(f)){p[0]!=c&&p.unshift(c);break}p[0]=p[0]||"text";if("text"==p[0]&&g!==i)k=g;else if("xml"==p[0]&&e!==i)k=e;else{var o={text:g,xml:e};a.each(["text","xml"],function(a){var b=p[0];return(h[a]&&h[a][b]||d[a]&&d[a][b])&& o[a]?(p.unshift(a),k="text"==a?g:e,!1):i})}}n=p[0];for(f=1;f<p.length;f++){c=p[f];var q=h[n]&&h[n][c]||d[n]&&d[n][c];if(!q)throw"no covert for "+n+" => "+c;k=q(k);n=c}b.responseData=k}var g=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg;a.extend(b,a.Promise,{setRequestHeader:function(a,b){this.requestHeaders[a]=b;return this},getAllResponseHeaders:function(){return 2===this.state?this.responseHeadersString:null},getResponseHeader:function(a){var b,e;if(2===this.state){if(!(e=this.responseHeaders))for(e=this.responseHeaders= {};b=g.exec(this.responseHeadersString);)e[b[1]]=b[2];b=e[a]}return b===i?null:b},overrideMimeType:function(a){this.state||(this.mimeType=a);return this},abort:function(a){a=a||"abort";this.transport&&this.transport.abort(a);this._ioReady(0,a);return this},getNativeXhr:function(){var a;return(a=this.transport)?a.nativeXhr:null},_ioReady:function(a,b){if(2!=this.state){this.state=2;this.readyState=4;var e;if(200<=a&&300>a||304==a)if(304==a)b="not modified",e=!0;else try{k(this),b="success",e=!0}catch(f){b= "parser error"}else 0>a&&(a=0);this.status=a;this.statusText=b;this._defer[e?"resolve":"reject"]([this.responseData,b,this])}},_getUrlForSend:function(){var b=this.config,g=b.uri,e=a.Uri.getComponents(b.url).query||"";return g.toString(b.serializeArray)+(e?(g.query.has()?"&":"?")+e:e)}})},{requires:["./base"]}); KISSY.add("ajax/script-transport",function(a,b,i,k){function g(a){if(!a.config.crossDomain)return new (b.getTransport("*"))(a);this.io=a;return this}var j=a.Env.host,l=j.document;b.setupConfig({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{text:{script:function(b){a.globalEval(b);return b}}}});a.augment(g,{send:function(){var a=this,b,d=a.io,h=d.config,c=l.head||l.getElementsByTagName("head")[0]|| l.documentElement;a.head=c;b=l.createElement("script");a.script=b;b.async=!0;h.scriptCharset&&(b.charset=h.scriptCharset);b.src=d._getUrlForSend();b.onerror=b.onload=b.onreadystatechange=function(b){b=b||j.event;a._callback((b.type||"error").toLowerCase())};c.insertBefore(b,c.firstChild)},_callback:function(a,b){var d=this.script,h=this.io,c=this.head;if(d&&(b||!d.readyState||/loaded|complete/.test(d.readyState)||"error"==a))d.onerror=d.onload=d.onreadystatechange=null,c&&d.parentNode&&c.removeChild(d), this.head=this.script=k,!b&&"error"!=a?h._ioReady(200,"success"):"error"==a&&h._ioReady(500,"script error")},abort:function(){this._callback(0,1)}});b.setupTransport("script",g);return b},{requires:["./base","./xhr-transport"]}); KISSY.add("ajax/sub-domain-transport",function(a,b,i,k){function g(a){var b=a.config;this.io=a;b.crossDomain=!1}function j(){var a=this.io.config.uri.getHostname(),a=e[a];a.ready=1;i.detach(a.iframe,"load",j,this);this.send()}var l=a.Env.host.document,e={};a.augment(g,b.proto,{send:function(){var f=this.io.config,d=f.uri,h=d.getHostname(),c;c=e[h];var g="/sub_domain_proxy.html";f.xdr&&f.xdr.subDomain&&f.xdr.subDomain.proxy&&(g=f.xdr.subDomain.proxy);c&&c.ready?(this.nativeXhr=b.nativeXhr(0,c.iframe.contentWindow))&& this.sendInternal():(c?f=c.iframe:(c=e[h]={},f=c.iframe=l.createElement("iframe"),k.css(f,{position:"absolute",left:"-9999px",top:"-9999px"}),k.prepend(f,l.body||l.documentElement),c=new a.Uri,c.setScheme(d.getScheme()),c.setPort(d.getPort()),c.setHostname(h),c.setPath(g),f.src=c.toString()),i.on(f,"load",j,this))}});return g},{requires:["./xhr-transport-base","event","dom"]}); KISSY.add("ajax/xdr-flash-transport",function(a,b,i){function k(a,b,e){d||(d=!0,a='<object id="'+l+'" type="application/x-shockwave-flash" data="'+a+'" width="0" height="0"><param name="movie" value="'+a+'" /><param name="FlashVars" value="yid='+b+"&uid="+e+'&host=KISSY.IO" /><param name="allowScriptAccess" value="always" /></object>',b=f.createElement("div"),i.prepend(b,f.body||f.documentElement),b.innerHTML=a)}function g(a){this.io=a}var j={},l="io_swf",e,f=a.Env.host.document,d=!1;a.augment(g, {send:function(){var b=this,c=b.io,d=c.config;k((d.xdr||{}).src||a.Config.base+"ajax/io.swf",1,1);e?(b._uid=a.guid(),j[b._uid]=b,e.send(c._getUrlForSend(),{id:b._uid,uid:b._uid,method:d.type,data:d.hasContent&&d.data||{}})):setTimeout(function(){b.send()},200)},abort:function(){e.abort(this._uid)},_xdrResponse:function(a,b){var d,e=b.id,f,g=b.c,i=this.io;if(g&&(f=g.responseText))i.responseText=decodeURI(f);switch(a){case "success":d={status:200,statusText:"success"};delete j[e];break;case "abort":delete j[e]; break;case "timeout":case "transport error":case "failure":delete j[e],d={status:"status"in g?g.status:500,statusText:g.statusText||a}}d&&i._ioReady(d.status,d.statusText)}});b.applyTo=function(d,c,e){var d=c.split(".").slice(1),f=b;a.each(d,function(a){f=f[a]});f.apply(null,e)};b.xdrReady=function(){e=f.getElementById(l)};b.xdrResponse=function(a,b){var d=j[b.uid];d&&d._xdrResponse(a,b)};return g},{requires:["./base","dom"]}); KISSY.add("ajax/xhr-transport-base",function(a,b){function i(a,b){try{return new (b||g).XMLHttpRequest}catch(c){}}function k(a){var b;a.ifModified&&(b=a.uri,!1===a.cache&&(b=b.clone(),b.query.remove("_ksTS")),b=b.toString());return b}var g=a.Env.host,j=7<a.UA.ie&&g.XDomainRequest,l={proto:{}},e={},f={};b.__lastModifiedCached=e;b.__eTagCached=f;l.nativeXhr=g.ActiveXObject?function(a,e){var c;if(!l.supportCORS&&a&&j)c=new j;else if(!(c=!b.isLocal&&i(a,e)))a:{try{c=new (e||g).ActiveXObject("Microsoft.XMLHTTP"); break a}catch(f){}c=void 0}return c}:i;l._XDomainRequest=j;l.supportCORS="withCredentials"in l.nativeXhr();a.mix(l.proto,{sendInternal:function(){var a=this,b=a.io,c=b.config,g=a.nativeXhr,i=c.type,l=c.async,o,q=b.mimeType,r=b.requestHeaders||{},b=b._getUrlForSend(),t=k(c),s,u;if(t){if(s=e[t])r["If-Modified-Since"]=s;if(s=f[t])r["If-None-Match"]=s}(o=c.username)?g.open(i,b,l,o,c.password):g.open(i,b,l);if(i=c.xhrFields)for(u in i)g[u]=i[u];q&&g.overrideMimeType&&g.overrideMimeType(q);r["X-Requested-With"]|| (r["X-Requested-With"]="XMLHttpRequest");if("undefined"!==typeof g.setRequestHeader)for(u in r)g.setRequestHeader(u,r[u]);g.send(c.hasContent&&c.data||null);!l||4==g.readyState?a._callback():j&&g instanceof j?(g.onload=function(){g.readyState=4;g.status=200;a._callback()},g.onerror=function(){g.readyState=4;g.status=500;a._callback()}):g.onreadystatechange=function(){a._callback()}},abort:function(){this._callback(0,1)},_callback:function(d,g){var c=this.nativeXhr,i=this.io,l,p,o,q,r,t=i.config;try{if(g|| 4==c.readyState)if(j&&c instanceof j?(c.onerror=a.noop,c.onload=a.noop):c.onreadystatechange=a.noop,g)4!==c.readyState&&c.abort();else{l=k(t);var s=c.status;j&&c instanceof j||(i.responseHeadersString=c.getAllResponseHeaders());l&&(p=c.getResponseHeader("Last-Modified"),o=c.getResponseHeader("ETag"),p&&(e[l]=p),o&&(f[o]=o));if((r=c.responseXML)&&r.documentElement)i.responseXML=r;i.responseText=c.responseText;try{q=c.statusText}catch(u){q=""}!s&&b.isLocal&&!t.crossDomain?s=i.responseText?200:404:1223=== s&&(s=204);i._ioReady(s,q)}}catch(v){c.onreadystatechange=a.noop,g||i._ioReady(-1,v)}}});return l},{requires:["./base"]}); KISSY.add("ajax/xhr-transport",function(a,b,i,k,g){function j(b){var d=b.config,h=d.crossDomain,c=d.xdr||{},j=c.subDomain=c.subDomain||{};this.io=b;if(h){d=d.uri.getHostname();if(l.domain&&a.endsWith(d,l.domain)&&!1!==j.proxy)return new k(b);if(!i.supportCORS&&("flash"===""+c.use||!e))return new g(b)}this.nativeXhr=i.nativeXhr(h);return this}var l=a.Env.host.document,e=i._XDomainRequest;a.augment(j,i.proto,{send:function(){this.sendInternal()}});b.setupTransport("*",j);return b},{requires:["./base", "./xhr-transport-base","./sub-domain-transport","./xdr-flash-transport"]}); KISSY.add("cookie",function(a){function b(a){return"string"==typeof a&&""!==a}var i=a.Env.host.document,k=encodeURIComponent,g=a.urlDecode;return a.Cookie={get:function(a){var k,e;if(b(a)&&(e=(""+i.cookie).match(RegExp("(?:^| )"+a+"(?:(?:=([^;]*))|;|$)"))))k=e[1]?g(e[1]):"";return k},set:function(a,g,e,f,d,h){var g=""+k(g),c=e;"number"===typeof c&&(c=new Date,c.setTime(c.getTime()+864E5*e));c instanceof Date&&(g+="; expires="+c.toUTCString());b(f)&&(g+="; domain="+f);b(d)&&(g+="; path="+d);h&&(g+= "; secure");i.cookie=a+"="+g},remove:function(a,b,e,f){this.set(a,"",-1,b,e,f)}}}); KISSY.add("base/attribute",function(a,b){function i(a,b){return"string"==typeof b?a[b]:b}function k(b,c,d,e,f,g,h){h=h||d;return b.fire(c+a.ucfirst(d)+"Change",{attrName:h,subAttrName:g,prevVal:e,newVal:f})}function g(a,b,c){var d=a[b]||{};c&&(a[b]=d);return d}function j(a){return g(a,"__attrs",!0)}function l(a){return g(a,"__attrVals",!0)}function e(a,c){for(var d=0,e=c.length;a!=b&&d<e;d++)a=a[c[d]];return a}function f(a,b){var c;!a.hasAttr(b)&&-1!==b.indexOf(".")&&(c=b.split("."),b=c.shift()); return{path:c,name:b}}function d(c,d,e){var f=e;if(d){var c=f=c===b?{}:a.clone(c),g=d.length-1;if(0<=g){for(var h=0;h<g;h++)c=c[d[h]];c!=b&&(c[d[h]]=e)}}return f}function h(a,c,g,h,i){var h=h||{},j,m,n;n=f(a,c);var w=c,c=n.name;j=n.path;n=a.get(c);j&&(m=e(n,j));if(!j&&n===g||j&&m===g)return b;g=d(n,j,g);if(!h.silent&&!1===k(a,"before",c,n,g,w))return!1;g=a.setInternal(c,g,h);if(!1===g)return g;h.silent||(g=l(a)[c],k(a,"after",c,n,g,w),i?i.push({prevVal:n,newVal:g,attrName:c,subAttrName:w}):k(a,"", "*",[n],[g],[w],[c]));return a}function c(){}function m(a,c){var d=j(a),e=g(d,c),f=e.valueFn;if(f&&(f=i(a,f)))f=f.call(a),f!==b&&(e.value=f),delete e.valueFn,d[c]=e;return e.value}function n(a,c,e,h){var k,l;k=f(a,c);c=k.name;if(k=k.path)l=a.get(c),e=d(l,k,e);if((k=g(j(a),c,!0).validator)&&(k=i(a,k)))if(a=k.call(a,e,c,h),a!==b&&!0!==a)return a;return b}c.INVALID={};var p=c.INVALID;c.prototype={getAttrs:function(){return j(this)},getAttrVals:function(){var a={},b,c=j(this);for(b in c)a[b]=this.get(b); return a},addAttr:function(b,c,d){var e=j(this),c=a.clone(c);e[b]?a.mix(e[b],c,d):e[b]=c;return this},addAttrs:function(b,c){var d=this;a.each(b,function(a,b){d.addAttr(b,a)});c&&d.set(c);return d},hasAttr:function(a){return j(this).hasOwnProperty(a)},removeAttr:function(a){this.hasAttr(a)&&(delete j(this)[a],delete l(this)[a]);return this},set:function(c,d,e){if(a.isPlainObject(c)){var e=d,d=Object(c),f=[],g,i=[];for(c in d)(g=n(this,c,d[c],d))!==b&&i.push(g);if(i.length)return e&&e.error&&e.error(i), !1;for(c in d)h(this,c,d[c],e,f);var j=[],l=[],m=[],p=[];a.each(f,function(a){l.push(a.prevVal);m.push(a.newVal);j.push(a.attrName);p.push(a.subAttrName)});j.length&&k(this,"","*",l,m,p,j);return this}return h(this,c,d,e)},setInternal:function(a,c,d){var e,f,h=g(j(this),a,!0).setter;f=n(this,a,c);if(f!==b)return d.error&&d.error(f),!1;if(h&&(h=i(this,h)))e=h.call(this,c,a);if(e===p)return!1;e!==b&&(c=e);l(this)[a]=c},get:function(a){var c,d=this.hasAttr(a),f=l(this),h;!d&&-1!==a.indexOf(".")&&(c= a.split("."),a=c.shift());d=g(j(this),a).getter;h=a in f?f[a]:m(this,a);if(d&&(d=i(this,d)))h=d.call(this,h,a);!(a in f)&&h!==b&&(f[a]=h);c&&(h=e(h,c));return h},reset:function(a,b){if("string"==typeof a)return this.hasAttr(a)?this.set(a,m(this,a),b):this;var b=a,c=j(this),d={};for(a in c)d[a]=m(this,a);this.set(d,b);return this}};return c}); KISSY.add("base",function(a,b,i){function k(a){var b=this.constructor;for(this.userConfig=a;b;){var i=b.ATTRS;if(i){var e=void 0;for(e in i)this.addAttr(e,i[e],!1)}b=b.superclass?b.superclass.constructor:null}if(a)for(var f in a)this.setInternal(f,a[f])}a.augment(k,i.Target,b);k.Attribute=b;return a.Base=k},{requires:["base/attribute","event/custom"]});KISSY.add("anim",function(a,b,i){b.Easing=i;a.mix(a,{Anim:b,Easing:b.Easing});return b},{requires:["anim/base","anim/easing","anim/color","anim/background-position"]}); KISSY.add("anim/background-position",function(a,b,i,k){function g(a){a=a.replace(/left|top/g,"0px").replace(/right|bottom/g,"100%").replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");a=a.match(/(-?[0-9\.]+)(px|%|em|pt)\s(-?[0-9\.]+)(px|%|em|pt)/);return[parseFloat(a[1]),a[2],parseFloat(a[3]),a[4]]}function j(){j.superclass.constructor.apply(this,arguments)}a.extend(j,k,{load:function(){j.superclass.load.apply(this,arguments);this.unit=["px","px"];if(this.from){var a=g(this.from);this.from=[a[0],a[2]]}else this.from= [0,0];this.to?(a=g(this.to),this.to=[a[0],a[2]],this.unit=[a[1],a[3]]):this.to=[0,0]},interpolate:function(a,b,f){var d=this.unit,g=j.superclass.interpolate;return g(a[0],b[0],f)+d[0]+" "+g(a[1],b[1],f)+d[1]},cur:function(){return b.css(this.anim.config.el,"backgroundPosition")},update:function(){var a=this.prop,e=this.anim.config.el,f=this.interpolate(this.from,this.to,this.pos);b.css(e,a,f)}});return k.Factories.backgroundPosition=j},{requires:["dom","./base","./fx"]}); KISSY.add("anim/base",function(a,b,i,k,g,j,l){function e(c,d,g,h,i){if(c.el)return g=c.el,d=c.props,delete c.el,delete c.props,new e(g,d,c);if(c=b.get(c)){if(!(this instanceof e))return new e(c,d,g,h,i);d="string"==typeof d?a.unparam(""+d,";",":"):a.clone(d);a.each(d,function(b,c){var e=a.trim(o(c));e?c!=e&&(d[e]=d[c],delete d[c]):delete d[c]});g=a.isPlainObject(g)?a.clone(g):{duration:parseFloat(g)||void 0,easing:h,complete:i};g=a.merge(s,g);g.el=c;g.props=d;this.config=g;this._duration=1E3*g.duration; this.domEl=c;this._backupProps={};this._fxs={};this.on("complete",f)}}function f(c){var d,e,f=this.config;a.isEmptyObject(d=this._backupProps)||b.css(f.el,d);(e=f.complete)&&e.call(this,c)}function d(){var c=this.config,d=this._backupProps,e=c.el,f,i,l,m=c.specialEasing||{},n=this._fxs,o=c.props;h(this);if(!1===this.fire("beforeStart"))this.stop(0);else{if(e.nodeType==q.ELEMENT_NODE)for(l in i="none"===b.css(e,"display"),o)if(f=o[l],"hide"==f&&i||"show"==f&&!i){this.stop(1);return}if(e.nodeType== q.ELEMENT_NODE&&(o.width||o.height))f=e.style,a.mix(d,{overflow:f.overflow,"overflow-x":f.overflowX,"overflow-y":f.overflowY}),f.overflow="hidden","inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(p.ie?f.zoom=1:f.display="inline-block");a.each(o,function(b,d){var e;a.isArray(b)?(e=m[d]=b[1],o[d]=b[0]):e=m[d]=m[d]||c.easing;"string"==typeof e&&(e=m[d]=k[e]);m[d]=e||k.easeNone});a.each(t,function(c,d){var f,g;if(g=o[d])f={},a.each(c,function(a){f[a]=b.css(e,a);m[a]=m[d]}),b.css(e,d,g),a.each(f, function(a,c){o[c]=b.css(e,c);b.css(e,c,a)}),delete o[d]});for(l in o){f=a.trim(o[l]);var s,v,x={prop:l,anim:this,easing:m[l]},E=j.getFx(x);a.inArray(f,r)?(d[l]=b.style(e,l),"toggle"==f&&(f=i?"show":"hide"),"hide"==f?(s=0,v=E.cur(),d.display="none"):(v=0,s=E.cur(),b.css(e,l,v),b.show(e)),f=s):(s=f,v=E.cur());f+="";var H="",G=f.match(u);if(G){s=parseFloat(G[2]);if((H=G[3])&&"px"!==H)b.css(e,l,f),v*=s/E.cur(),b.css(e,l,v+H);G[1]&&(s=("-="===G[1]?-1:1)*s+v)}x.from=v;x.to=s;x.unit=H;E.load(x);n[l]=E}this._startTime= a.now();g.start(this)}}function h(c){var d=c.config.el,e=b.data(d,v);e||b.data(d,v,e={});e[a.stamp(c)]=c}function c(c){var d=c.config.el,e=b.data(d,v);e&&(delete e[a.stamp(c)],a.isEmptyObject(e)&&b.removeData(d,v))}function m(c,d,e){c=b.data(c,"resume"==e?x:v);c=a.merge(c);a.each(c,function(a){if(void 0===d||a.config.queue==d)a[e]()})}function n(c,d,e,f){e&&!1!==f&&l.removeQueue(c,f);c=b.data(c,v);c=a.merge(c);a.each(c,function(a){a.config.queue==f&&a.stop(d)})}var p=a.UA,o=b._camelCase,q=b.NodeType, r=["hide","show","toggle"],t={background:["backgroundPosition"],border:["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth"],borderBottom:["borderBottomWidth"],borderLeft:["borderLeftWidth"],borderTop:["borderTopWidth"],borderRight:["borderRightWidth"],font:["fontSize","fontWeight"],margin:["marginBottom","marginLeft","marginRight","marginTop"],padding:["paddingBottom","paddingLeft","paddingRight","paddingTop"]},s={duration:1,easing:"easeNone"},u=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i; e.SHORT_HANDS=t;e.prototype={constructor:e,isRunning:function(){var c=b.data(this.config.el,v);return c?!!c[a.stamp(this)]:0},isPaused:function(){var c=b.data(this.config.el,x);return c?!!c[a.stamp(this)]:0},pause:function(){if(this.isRunning()){this._pauseDiff=a.now()-this._startTime;g.stop(this);c(this);var d=this.config.el,e=b.data(d,x);e||b.data(d,x,e={});e[a.stamp(this)]=this}return this},resume:function(){if(this.isPaused()){this._startTime=a.now()-this._pauseDiff;var c=this.config.el,d=b.data(c, x);d&&(delete d[a.stamp(this)],a.isEmptyObject(d)&&b.removeData(c,x));h(this);g.start(this)}return this},_runInternal:d,run:function(){!1===this.config.queue?d.call(this):l.queue(this);return this},_frame:function(){var a,b=this.config,c=1,d,e,f=this._fxs;for(a in f)if(!(e=f[a]).finished)b.frame&&(d=b.frame(e)),1==d||0==d?(e.finished=d,c&=d):(c&=e.frame())&&b.frame&&b.frame(e);(!1===this.fire("step")||c)&&this.stop(c)},stop:function(a){var b=this.config,d=b.queue,e,f=this._fxs;if(!this.isRunning())return!1!== d&&l.remove(this),this;if(a){for(e in f)if(!(a=f[e]).finished)b.frame?b.frame(a,1):a.frame(1);this.fire("complete")}g.stop(this);c(this);!1!==d&&l.dequeue(this);return this}};a.augment(e,i.Target);var v=a.guid("ks-anim-unqueued-"+a.now()+"-"),x=a.guid("ks-anim-paused-"+a.now()+"-");e.stop=function(c,d,e,f){if(null===f||"string"==typeof f||!1===f)return n.apply(void 0,arguments);e&&l.removeQueues(c);var g=b.data(c,v),g=a.merge(g);a.each(g,function(a){a.stop(d)})};a.each(["pause","resume"],function(a){e[a]= function(b,c){if(null===c||"string"==typeof c||!1===c)return m(b,c,a);m(b,void 0,a)}});e.isRunning=function(c){return(c=b.data(c,v))&&!a.isEmptyObject(c)};e.isPaused=function(c){return(c=b.data(c,x))&&!a.isEmptyObject(c)};e.Q=l;return e},{requires:"dom,event,./easing,./manager,./fx,./queue".split(",")}); KISSY.add("anim/color",function(a,b,i,k){function g(a){var a=a+"",b;if(b=a.match(d))return[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])];if(b=a.match(h))return[parseInt(b[1]),parseInt(b[2]),parseInt(b[3]),parseInt(b[4])];if(b=a.match(c)){for(a=1;a<b.length;a++)2>b[a].length&&(b[a]+=b[a]);return[parseInt(b[1],l),parseInt(b[2],l),parseInt(b[3],l)]}return f[a=a.toLowerCase()]?f[a]:[255,255,255]}function j(){j.superclass.constructor.apply(this,arguments)}var l=16,e=Math.floor,f={black:[0,0,0],silver:[192, 192,192],gray:[128,128,128],white:[255,255,255],maroon:[128,0,0],red:[255,0,0],purple:[128,0,128],fuchsia:[255,0,255],green:[0,128,0],lime:[0,255,0],olive:[128,128,0],yellow:[255,255,0],navy:[0,0,128],blue:[0,0,255],teal:[0,128,128],aqua:[0,255,255]},d=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,h=/^rgba\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+),\s*([0-9]+)\)$/i,c=/^#?([0-9A-F]{1,2})([0-9A-F]{1,2})([0-9A-F]{1,2})$/i,b=i.SHORT_HANDS;b.background=b.background||[];b.background.push("backgroundColor"); b.borderColor=["borderBottomColor","borderLeftColor","borderRightColor","borderTopColor"];b.border.push("borderBottomColor","borderLeftColor","borderRightColor","borderTopColor");b.borderBottom.push("borderBottomColor");b.borderLeft.push("borderLeftColor");b.borderRight.push("borderRightColor");b.borderTop.push("borderTopColor");a.extend(j,k,{load:function(){j.superclass.load.apply(this,arguments);this.from&&(this.from=g(this.from));this.to&&(this.to=g(this.to))},interpolate:function(a,b,c){var d= j.superclass.interpolate;if(3==a.length&&3==b.length)return"rgb("+[e(d(a[0],b[0],c)),e(d(a[1],b[1],c)),e(d(a[2],b[2],c))].join(", ")+")";if(4==a.length||4==b.length)return"rgba("+[e(d(a[0],b[0],c)),e(d(a[1],b[1],c)),e(d(a[2],b[2],c)),e(d(a[3]||1,b[3]||1,c))].join(", ")+")"}});a.each("backgroundColor,borderBottomColor,borderLeftColor,borderRightColor,borderTopColor,color,outlineColor".split(","),function(a){k.Factories[a]=j});return j},{requires:["dom","./base","./fx"]}); KISSY.add("anim/easing",function(){var a=Math.PI,b=Math.pow,i=Math.sin,k={swing:function(b){return-Math.cos(b*a)/2+0.5},easeNone:function(a){return a},easeIn:function(a){return a*a},easeOut:function(a){return(2-a)*a},easeBoth:function(a){return 1>(a*=2)?0.5*a*a:0.5*(1- --a*(a-2))},easeInStrong:function(a){return a*a*a*a},easeOutStrong:function(a){return 1- --a*a*a*a},easeBothStrong:function(a){return 1>(a*=2)?0.5*a*a*a*a:0.5*(2-(a-=2)*a*a*a)},elasticIn:function(g){return 0===g||1===g?g:-(b(2,10*(g-= 1))*i((g-0.075)*2*a/0.3))},elasticOut:function(g){return 0===g||1===g?g:b(2,-10*g)*i((g-0.075)*2*a/0.3)+1},elasticBoth:function(g){return 0===g||2===(g*=2)?g:1>g?-0.5*b(2,10*(g-=1))*i((g-0.1125)*2*a/0.45):0.5*b(2,-10*(g-=1))*i((g-0.1125)*2*a/0.45)+1},backIn:function(a){1===a&&(a-=0.001);return a*a*(2.70158*a-1.70158)},backOut:function(a){return(a-=1)*a*(2.70158*a+1.70158)+1},backBoth:function(a){var b,i=(b=2.5949095)+1;return 1>(a*=2)?0.5*a*a*(i*a-b):0.5*((a-=2)*a*(i*a+b)+2)},bounceIn:function(a){return 1- k.bounceOut(1-a)},bounceOut:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+0.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+0.9375:7.5625*(a-=2.625/2.75)*a+0.984375},bounceBoth:function(a){return 0.5>a?0.5*k.bounceIn(2*a):0.5*k.bounceOut(2*a-1)+0.5}};return k}); KISSY.add("anim/fx",function(a,b,i){function k(a){this.load(a)}function g(a,g){return(!a.style||null==a.style[g])&&null!=b.attr(a,g,i,1)?1:0}k.prototype={constructor:k,load:function(b){a.mix(this,b);this.pos=0;this.unit=this.unit||""},frame:function(b){var g=this.anim,e=0;if(this.finished)return 1;var f=a.now(),d=g._startTime,g=g._duration;b||f>=g+d?e=this.pos=1:this.pos=this.easing((f-d)/g);this.update();this.finished=this.finished||e;return e},interpolate:function(b,g,e){return a.isNumber(b)&&a.isNumber(g)? (b+(g-b)*e).toFixed(3):i},update:function(){var a=this.prop,k=this.anim.config.el,e=this.to,f=this.interpolate(this.from,e,this.pos);f===i?this.finished||(this.finished=1,b.css(k,a,e)):(f+=this.unit,g(k,a)?b.attr(k,a,f,1):b.css(k,a,f))},cur:function(){var a=this.prop,k=this.anim.config.el;if(g(k,a))return b.attr(k,a,i,1);var e,a=b.css(k,a);return isNaN(e=parseFloat(a))?!a||"auto"===a?0:a:e}};k.Factories={};k.getFx=function(a){return new (k.Factories[a.prop]||k)(a)};return k},{requires:["dom"]}); KISSY.add("anim/manager",function(a){var b=a.stamp;return{interval:15,runnings:{},timer:null,start:function(a){var k=b(a);this.runnings[k]||(this.runnings[k]=a,this.startTimer())},stop:function(a){this.notRun(a)},notRun:function(i){delete this.runnings[b(i)];a.isEmptyObject(this.runnings)&&this.stopTimer()},pause:function(a){this.notRun(a)},resume:function(a){this.start(a)},startTimer:function(){var a=this;a.timer||(a.timer=setTimeout(function(){a.runFrames()?a.stopTimer():(a.timer=0,a.startTimer())}, a.interval))},stopTimer:function(){var a=this.timer;a&&(clearTimeout(a),this.timer=0)},runFrames:function(){var a=1,b,g=this.runnings;for(b in g)a=0,g[b]._frame();return a}}}); KISSY.add("anim/queue",function(a,b){function i(a,f,d){var f=f||j,h,c=b.data(a,g);!c&&!d&&b.data(a,g,c={});c&&(h=c[f],!h&&!d&&(h=c[f]=[]));return h}function k(e,f){var f=f||j,d=b.data(e,g);d&&delete d[f];a.isEmptyObject(d)&&b.removeData(e,g)}var g=a.guid("ks-queue-"+a.now()+"-"),j=a.guid("ks-queue-"+a.now()+"-"),l={queueCollectionKey:g,queue:function(a){var b=i(a.config.el,a.config.queue);b.push(a);"..."!==b[0]&&l.dequeue(a);return b},remove:function(b){var f=i(b.config.el,b.config.queue,1);f&&(b= a.indexOf(b,f),-1<b&&f.splice(b,1))},removeQueues:function(a){b.removeData(a,g)},removeQueue:k,dequeue:function(a){var b=a.config.el,a=a.config.queue,d=i(b,a,1),h=d&&d.shift();"..."==h&&(h=d.shift());h?(d.unshift("..."),h._runInternal()):k(b,a)}};return l},{requires:["dom"]}); KISSY.add("node/anim",function(a,b,i,k,g){function j(a,b,d){for(var h=[],c={},d=d||0;d<b;d++)h.push.apply(h,l[d]);for(d=0;d<h.length;d++)c[h[d]]=a;return c}var l=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];a.augment(k,{animate:function(b){var f=a.makeArray(arguments);a.each(this,function(b){var e=a.clone(f),c=e[0];c.props?(c.el=b,i(c).run()):i.apply(g,[b].concat(e)).run()});return this},stop:function(b, f,d){a.each(this,function(a){i.stop(a,b,f,d)});return this},pause:function(b,f){a.each(this,function(a){i.pause(a,f)});return this},resume:function(b,f){a.each(this,function(a){i.resume(a,f)});return this},isRunning:function(){for(var a=0;a<this.length;a++)if(i.isRunning(this[a]))return!0;return!1},isPaused:function(){for(var a=0;a<this.length;a++)if(i.isPaused(this[a]))return 1;return 0}});a.each({show:j("show",3),hide:j("hide",3),toggle:j("toggle",3),fadeIn:j("show",3,2),fadeOut:j("hide",3,2),fadeToggle:j("toggle", 3,2),slideDown:j("show",1),slideUp:j("hide",1),slideToggle:j("toggle",1)},function(e,f){k.prototype[f]=function(d,h,c){if(b[f]&&!d)b[f](this);else a.each(this,function(a){i(a,e,d,c||"easeOut",h).run()});return this}})},{requires:["dom","anim","./base"]}); KISSY.add("node/attach",function(a,b,i,k,g){function j(a,d,e){e.unshift(d);a=b[a].apply(b,e);return a===g?d:a}var l=k.prototype,e=a.makeArray;k.KeyCodes=i.KeyCodes;a.each("nodeName,equals,contains,index,scrollTop,scrollLeft,height,width,innerHeight,innerWidth,outerHeight,outerWidth,addStyleSheet,appendTo,prependTo,insertBefore,before,after,insertAfter,test,hasClass,addClass,removeClass,replaceClass,toggleClass,removeAttr,hasAttr,hasProp,scrollIntoView,remove,empty,removeData,hasData,unselectable,wrap,wrapAll,replaceWith,wrapInner,unwrap".split(","),function(a){l[a]= function(){var b=e(arguments);return j(a,this,b)}});a.each("filter,first,last,parent,closest,next,prev,clone,siblings,contents,children".split(","),function(a){l[a]=function(){var d=e(arguments);d.unshift(this);d=b[a].apply(b,d);return d===g?this:d===null?null:new k(d)}});a.each({attr:1,text:0,css:1,style:1,val:0,prop:1,offset:0,html:0,outerHTML:0,data:1},function(f,d){l[d]=function(){var h;h=e(arguments);h[f]===g&&!a.isObject(h[0])?(h.unshift(this),h=b[d].apply(b,h)):h=j(d,this,h);return h}});a.each("on,detach,fire,fireHandler,delegate,undelegate".split(","), function(a){l[a]=function(){var b=e(arguments);b.unshift(this);i[a].apply(i,b);return this}})},{requires:["dom","event/dom","./base"]}); KISSY.add("node/base",function(a,b,i){function k(h,c,g){if(!(this instanceof k))return new k(h,c,g);if(h)if("string"==typeof h){if(h=b.create(h,c,g),h.nodeType===l.DOCUMENT_FRAGMENT_NODE)return e.apply(this,f(h.childNodes)),this}else{if(a.isArray(h)||d(h))return e.apply(this,f(h)),this}else return this;this[0]=h;this.length=1;return this}var g=Array.prototype,j=g.slice,l=b.NodeType,e=g.push,f=a.makeArray,d=b._isNodeList;k.prototype={constructor:k,length:0,item:function(b){return a.isNumber(b)?b>= this.length?null:new k(this[b]):new k(b)},add:function(b,c,d){a.isNumber(c)&&(d=c,c=i);b=k.all(b,c).getDOMNodes();c=new k(this);d===i?e.apply(c,b):(d=[d,0],d.push.apply(d,b),g.splice.apply(c,d));return c},slice:function(a,b){return new k(j.apply(this,arguments))},getDOMNodes:function(){return j.call(this)},each:function(b,c){var d=this;a.each(d,function(a,e){a=new k(a);return b.call(c||a,a,e,d)});return d},getDOMNode:function(){return this[0]},end:function(){return this.__parent||this},all:function(a){a= 0<this.length?k.all(a,this):new k;a.__parent=this;return a},one:function(a){a=this.all(a);if(a=a.length?a.slice(0,1):null)a.__parent=this;return a}};a.mix(k,{all:function(d,c){return"string"==typeof d&&(d=a.trim(d))&&3<=d.length&&a.startsWith(d,"<")&&a.endsWith(d,">")?(c&&(c.getDOMNode&&(c=c[0]),c=c.ownerDocument||c),new k(d,i,c)):new k(b.query(d,c))},one:function(a,b){var d=k.all(a,b);return d.length?d.slice(0,1):null}});k.NodeType=l;return k},{requires:["dom"]}); KISSY.add("node",function(a,b){a.mix(a,{Node:b,NodeList:b,one:b.one,all:b.all});return b},{requires:["node/base","node/attach","node/override","node/anim"]}); KISSY.add("node/override",function(a,b,i){var k=i.prototype;a.each(["append","prepend","before","after"],function(a){k[a]=function(i){"string"==typeof i&&(i=b.create(i));if(i)b[a](i,this);return this}});a.each(["wrap","wrapAll","replaceWith","wrapInner"],function(a){var b=k[a];k[a]=function(a){"string"==typeof a&&(a=i.all(a,this[0].ownerDocument));return b.call(this,a)}})},{requires:["dom","./base"]});KISSY.use("ua,dom,event,node,json,ajax,anim,base,cookie",0,1);
import { template, traverse, types as t } from "@babel/core"; import { environmentVisitor } from "@babel/helper-replace-supers"; const findBareSupers = traverse.visitors.merge([ { Super(path) { const { node, parentPath } = path; if (parentPath.isCallExpression({ callee: node })) { this.push(parentPath); } }, }, environmentVisitor, ]); const referenceVisitor = { "TSTypeAnnotation|TypeAnnotation"(path) { path.skip(); }, ReferencedIdentifier(path) { if (this.scope.hasOwnBinding(path.node.name)) { this.scope.rename(path.node.name); path.skip(); } }, }; function handleClassTDZ(path, state) { if ( state.classBinding && state.classBinding === path.scope.getBinding(path.node.name) ) { const classNameTDZError = state.file.addHelper("classNameTDZError"); const throwNode = t.callExpression(classNameTDZError, [ t.stringLiteral(path.node.name), ]); path.replaceWith(t.sequenceExpression([throwNode, path.node])); path.skip(); } } const classFieldDefinitionEvaluationTDZVisitor = { ReferencedIdentifier: handleClassTDZ, }; export function injectInitialization(path, constructor, nodes, renamer) { if (!nodes.length) return; const isDerived = !!path.node.superClass; if (!constructor) { const newConstructor = t.classMethod( "constructor", t.identifier("constructor"), [], t.blockStatement([]), ); if (isDerived) { newConstructor.params = [t.restElement(t.identifier("args"))]; newConstructor.body.body.push(template.statement.ast`super(...args)`); } [constructor] = path.get("body").unshiftContainer("body", newConstructor); } if (renamer) { renamer(referenceVisitor, { scope: constructor.scope }); } if (isDerived) { const bareSupers = []; constructor.traverse(findBareSupers, bareSupers); let isFirst = true; for (const bareSuper of bareSupers) { if (isFirst) { bareSuper.insertAfter(nodes); isFirst = false; } else { bareSuper.insertAfter(nodes.map(n => t.cloneNode(n))); } } } else { constructor.get("body").unshiftContainer("body", nodes); } } export function extractComputedKeys(ref, path, computedPaths, file) { const declarations = []; const state = { classBinding: path.node.id && path.scope.getBinding(path.node.id.name), file, }; for (const computedPath of computedPaths) { const computedKey = computedPath.get("key"); if (computedKey.isReferencedIdentifier()) { handleClassTDZ(computedKey, state); } else { computedKey.traverse(classFieldDefinitionEvaluationTDZVisitor, state); } const computedNode = computedPath.node; // Make sure computed property names are only evaluated once (upon class definition) // and in the right order in combination with static properties if (!computedKey.isConstantExpression()) { const ident = path.scope.generateUidIdentifierBasedOnNode( computedNode.key, ); // Declaring in the same block scope // Ref: https://github.com/babel/babel/pull/10029/files#diff-fbbdd83e7a9c998721c1484529c2ce92 path.scope.push({ id: ident, kind: "let", }); declarations.push( t.expressionStatement( t.assignmentExpression("=", t.cloneNode(ident), computedNode.key), ), ); computedNode.key = t.cloneNode(ident); } } return declarations; }
import React from "react" import Presentation from "./Presentation" import Icon from 'material-ui/Icon' import IconButton from 'material-ui/IconButton' import Grid from 'material-ui/Grid' import Typography from 'material-ui/Typography' import { colors } from "../themes/coinium" require("../themes/coinium/index.css") const FOOTER_WIDTH = 60 const MODES = { PRESENTATION: 0, HELP: 1 } export default class App extends React.Component { constructor(props) { super(props); this.state = { mode: MODES.PRESENTATION }; } goToSlide(slideName) { this.setState({mode: MODES.PRESENTATION}, () => { location.hash = `/${slideName}` }) } renderHelp() { const style = { height: '100%', backgroundColor: colors.primary } const creditsStyle = { opacity: 0.8 } return ( <Grid container direction="column" justify="center" align="center" style={style}> <Typography type="caption" style={creditsStyle}> Copyright 2017 Coinium, Inc <hr /> Contact us: <a href="mailto:[email protected]">[email protected]</a> <hr /> {"Some icons based on the work of "} <a href="http://www.freepik.com" title="Freepik">Freepik</a> {" from "} <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> {" are licensed by "} <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a> </Typography> </Grid> ) } renderCurrentPage() { switch (this.state.mode) { case MODES.PRESENTATION: return <Presentation /> case MODES.HELP: return this.renderHelp() default: return ( <Typography>Please reload</Typography> ) } } render() { const mainStyle = { position: 'fixed', top: 0, right: FOOTER_WIDTH, bottom: 0, left: 0, boxShadow: '2px 0px 4px rgba(0,0,0,0.4)', zIndex: 2, overflow: 'hidden' } const navStyle = { background: colors.secondary, position: 'fixed', top: 0, right: 0, bottom: 0, left: 'auto', width: FOOTER_WIDTH, zIndex: 1 } const onHelpClick = () => { const mode = this.state.mode == MODES.HELP ? MODES.PRESENTATION : MODES.HELP this.setState({mode}) } return ( <Grid container className="App"> <Grid item style={mainStyle}> {this.renderCurrentPage()} </Grid> <Grid item container direction="column" justify="space-between" align="center" spacing={0} style={navStyle}> <Grid> <IconButton onClick={this.goToSlide.bind(this, "home")}> <Icon color="contrast">home</Icon> </IconButton> <IconButton onClick={this.goToSlide.bind(this, "problem")}> <Icon color="contrast">info_outline</Icon> </IconButton> <IconButton onClick={this.goToSlide.bind(this, "team")}> <Icon color="contrast">people</Icon> </IconButton> <IconButton onClick={this.goToSlide.bind(this, "mobile")}> <Icon color="contrast">phone_iphone</Icon> </IconButton> <IconButton onClick={this.goToSlide.bind(this, "signup")}> <Icon color="contrast">insert_drive_file</Icon> </IconButton> </Grid> <Grid> <IconButton onClick={onHelpClick}> <Icon color="contrast">help_outline</Icon> </IconButton> </Grid> </Grid> </Grid> ); } }
/** * 在球场 * zaiqiuchang.com */ const initialState = { users: {}, posts: {}, courts: {}, files: {}, userStats: {}, postStats: {}, courtStats: {}, fileStats: {} } export default (state = initialState, action) => { if (action.type === 'CACHE_OBJECTS') { let newState = Object.assign({}, state) for (let [k, v] of Object.entries(action)) { if (newState[k] === undefined) { continue } newState[k] = Object.assign({}, newState[k], v) } return newState } else if (action.type === 'RESET' || action.type === 'RESET_OBJECT_CACHE') { return initialState } else { return state } }
// ajax mode: abort // usage: $.ajax({ mode: "abort"[, port: "uniqueport"]}); // if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() var pendingRequests = {}, ajax; // Use a prefilter if available (1.5+) if ($.ajaxPrefilter) { $.ajaxPrefilter(function (settings, _, xhr) { var port = settings.port; if (settings.mode === "abort") { if (pendingRequests[port]) { pendingRequests[port].abort(); } pendingRequests[port] = xhr; } }); } else { // Proxy ajax ajax = $.ajax; $.ajax = function (settings) { var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode, port = ( "port" in settings ? settings : $.ajaxSettings ).port; if (mode === "abort") { if (pendingRequests[port]) { pendingRequests[port].abort(); } pendingRequests[port] = ajax.apply(this, arguments); return pendingRequests[port]; } return ajax.apply(this, arguments); }; }
module.exports = { prefix: 'fal', iconName: 'trademark', icon: [640, 512, [], "f25c", "M121.564 134.98H23.876c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h240.249c6.627 0 12 5.373 12 12v14.98c0 6.627-5.373 12-12 12h-97.688V404c0 6.627-5.373 12-12 12h-20.873c-6.627 0-12-5.373-12-12V134.98zM352.474 96h28.124a12 12 0 0 1 11.048 7.315l70.325 165.83c7.252 17.677 15.864 43.059 15.864 43.059h.907s8.611-25.382 15.863-43.059l70.326-165.83A11.998 11.998 0 0 1 575.978 96h28.123a12 12 0 0 1 11.961 11.034l23.898 296c.564 6.985-4.953 12.966-11.961 12.966h-20.318a12 12 0 0 1-11.963-11.059l-14.994-190.64c-1.36-19.49-.453-47.139-.453-47.139h-.907s-9.518 29.462-17.224 47.139l-60.746 137a12 12 0 0 1-10.97 7.136h-24.252a12 12 0 0 1-10.983-7.165l-60.301-136.971c-7.252-17.225-17.224-48.046-17.224-48.046h-.907s.453 28.555-.907 48.046l-14.564 190.613A11.997 11.997 0 0 1 349.322 416h-20.746c-7.008 0-12.525-5.98-11.961-12.966l23.897-296A12.002 12.002 0 0 1 352.474 96z"] };
export const FETCH_MESSAGES_REQUEST = 'FETCH_MESSAGES_REQUEST'; export const FETCH_MESSAGES_SUCCESS = 'FETCH_MESSAGES_SUCCESS'; export const FETCH_MESSAGES_ERROR = 'FETCH_MESSAGES_ERROR'; export const CREATE_MESSAGE_REQUEST = 'CREATE_MESSAGE_REQUEST'; export const CREATE_MESSAGE_SUCCESS = 'CREATE_MESSAGE_SUCCESS'; export const CREATE_MESSAGE_ERROR = 'CREATE_MESSAGE_ERROR'; export const UPDATE_MESSAGE_REQUEST = 'UPDATE_MESSAGE_REQUEST'; export const UPDATE_MESSAGE_SUCCESS = 'UPDATE_MESSAGE_SUCCESS'; export const UPDATE_MESSAGE_ERROR = 'UPDATE_MESSAGE_ERROR'; export const DELETE_MESSAGE_REQUEST = 'DELETE_MESSAGE_REQUEST'; export const DELETE_MESSAGE_SUCCESS = 'DELETE_MESSAGE_SUCCESS'; export const DELETE_MESSAGE_ERROR = 'DELETE_MESSAGE_ERROR';
(function(){ if ( !window.File || !window.FileReader || !window.FileList || !window.Blob) return alert('La API de Archivos no es compatible con tu navegador. Considera actualizarlo.'); var Fractal = { loaded: false, imagen: null, tipo: "mandelbrot", busy: false, mode: 0, lastTime: 0, properties: { width:500, height:500 }, dimensions: { x:{s:0,e:0}, y:{s:0,e:0} }, iniciate: function(){ Fractal.loaded = true; Fractal.resetDimentions(); UI.setFractalprop(); }, clear: function(){ Fractal.loaded = false; Fractal.imagen = null; }, resetDimentions: function(){ var d = fractal[Fractal.tipo].prototype.dim; Fractal.dimensions = { x:{s:d.x.s,e:d.x.e}, y:{s:d.y.s,e:d.y.e} }; UI.setDimensions(); }, render: function(){ var self = this; Fractal.dimensions = UI.getDimensions(); if ( !Fractal.loaded || Fractal.busy ) return alert("El Fractal está ocupado"); if ( ! Fractal.paleta.loaded ) return alert("Cargar una paleta"); Fractal.busy = true; UI.rendering(); setTimeout(function(){ Fractal.lastTime = Date.now(); Fractal.imagen = new engine.Imagen(); var process = new engine.ProcessMulti( "fractal.worker.js", Fractal.imagen, UI.getWorkers(), FractalProcessing); // Asignar paleta //process.on("paint",function(f){return self.paleta.getColor(f);}); // Al terminar de procesar: process.on("end",function(){ Fractal.busy = false; Fractal.lastTime = Date.now() - Fractal.lastTime; process.render(); console.log("Tiempo: " + Fractal.lastTime); UI.setFractalprop(); // Guardar imagen del fractal Fractal.imagen = process.source; UI.rendered(); }); console.log(Fractal.properties); Fractal.imagen.create( Fractal.properties.width , Fractal.properties.height ); //if ( Fractal.paleta.loaded ) { // Usar paleta process.loop({ fractal_nom: Fractal.tipo }, {x:0,y:0}, {x:Fractal.properties.width,y:Fractal.properties.height}, Fractal.dimensions, Fractal.paleta ); //} else return alert("La paleta no está cargada"); },100); }, calcularZoom: function(pos,medidas){ var offset_x = - Fractal.dimensions.x.s, offset_y = - Fractal.dimensions.y.s, w = Fractal.dimensions.x.e - Fractal.dimensions.x.s, h = Fractal.dimensions.y.e - Fractal.dimensions.y.s; Fractal.dimensions.x.s = ( pos.x / Fractal.properties.width ) * w - offset_x; Fractal.dimensions.y.s = ( pos.y / Fractal.properties.height ) * h - offset_y; Fractal.dimensions.x.e = ( ( pos.x + medidas ) / Fractal.properties.width ) * w - offset_x; Fractal.dimensions.y.e = ( ( pos.y + medidas ) / Fractal.properties.height ) * h - offset_y; UI.setDimensions(); }, calcularDesplazo: function(x,y){ var offset_x = - Fractal.dimensions.x.s, offset_y = - Fractal.dimensions.y.s, w = Fractal.dimensions.x.e - Fractal.dimensions.x.s, h = Fractal.dimensions.y.e - Fractal.dimensions.y.s, desplazo = { h: ( x / Fractal.properties.width ) * w - offset_x - Fractal.dimensions.x.s, v: ( y / Fractal.properties.height ) * h - offset_y - Fractal.dimensions.y.s }; Fractal.dimensions.x.s += desplazo.h; Fractal.dimensions.y.s += desplazo.v; Fractal.dimensions.x.e += desplazo.h; Fractal.dimensions.y.e += desplazo.v; console.log({h:desplazo.h,v:desplazo.v},{x:x,y:y}); UI.setDimensions(); }, paleta: null }; engine.MyCanvas.init(Fractal.properties.width,Fractal.properties.height); var UI = { $els: {}, init: function(){ this.$els.Fractal = {}; this.$els.Fractal.fetchType = $("#fractalType"); this.$els.Fractal.fileName = this.$els.Fractal.fetchType.children('a:first'); this.$els.Fractal.selectType = this.$els.Fractal.fetchType.children('select#tipoFractal'); this.$els.Fractal.settings = $("#FractalSettings"); this.$els.Fractal.complejos = this.$els.Fractal.settings.find('ul#complejos'); this.$els.Fractal.dims = { s_x: this.$els.Fractal.complejos.find('output[name="s_x"]'), s_y: this.$els.Fractal.complejos.find('output[name="s_y"]'), e_x: this.$els.Fractal.complejos.find('output[name="e_x"]'), e_y: this.$els.Fractal.complejos.find('output[name="e_y"]') }; this.$els.Fractal.modo = this.$els.Fractal.settings.find("#modes .btn-group"); this.$els.Fractal.workers = this.$els.Fractal.settings.find('input[name="workers"]'); this.$els.paleta = { divs: { select: $("#paletaSelect"), selected: $("#paletaSelected"), current: $("a#paleta") }, forms: { select: $('select#palletSelect'), input: $('input#paletteInput') }, slide: { list: $('ul#paletaShow'), button: $('a#paletaSlide') } }; this.$els.paleta.forms.selectLoad = this.$els.paleta.divs.select.find('button'); this.$els.Fractal.suave = this.$els.Fractal.settings.find('input#softTransition'); this.$els.Fractal.renderButton = this.$els.Fractal.settings.find('button[name="render"]'); this.$els.Fractal.renderButton.removeAttr("disabled"); this.setEventos(); }, setEventos: function(){ this.$els.Fractal.fileName.click(function(e){ Fractal.clear(); UI.fileSelect(false); }); this.$els.paleta.divs.current.click(function(e){ Fractal.paleta.clear(); UI.paletaSelect(false); }); this.$els.paleta.forms.selectLoad.click(function(e){ Fractal.paleta.ajaxFetch( UI.$els.paleta.forms.select.val() ); }); this.$els.Fractal.renderButton.click(function(e){ Fractal.render(); }); this.$els.Fractal.suave.on('change',function(e){ Fractal.paleta.suavizado = e.currentTarget.checked; }); Fractal.paleta.suavizado = this.$els.Fractal.suave[0].checked; this.$els.paleta.slide.button.click(UI.paletaSlide); this.$els.Fractal.modo.on('click','label',function(e){ var $this = $(this), selected = $this.children('input').val(); UI.$els.Fractal.modo.find('label.active').removeClass('active'); $this.addClass("active"); if ( selected == "zoom" ) Fractal.mode = 0; else Fractal.mode = 1; }); this.$els.Fractal.settings.find('span#resetDim').click(function(){ Fractal.resetDimentions(); }); this.$els.Fractal.selectType.on('change',UI.typeChange); this.$els.paleta.forms.input.on('change',Fractal.paleta.loadFile); // Dispararse en la primera dibujada $(engine.MyCanvas.el).on('mousedown',UI.mouse.down); $(engine.MyCanvas.el).on('mouseup',UI.mouse.up); $(engine.MyCanvas.el).on('mousemove',UI.mouse.move); }, typeChange: function(e){ var v = $(e.target).val(); if ( v != "" ) { UI.fileSelect(true); UI.$els.Fractal.fileName.children('small').html(e.target.selectedOptions[0].innerHTML); Fractal.tipo = v; Fractal.iniciate(); } }, fileSelect: function(activate){ if ( ( activate == undefined ) || activate ){ this.$els.Fractal.fileName.show(); this.$els.Fractal.selectType.hide(); } else { this.$els.Fractal.selectType.show().val("Elige Fractal"); this.$els.Fractal.fileName.hide(); } }, mouse: { pressed: false, startPos:{x:0,y:0}, endPos:{x:0,y:0}, getCoords: function(e){ var rect = engine.MyCanvas.el.getBoundingClientRect(); return { x: e.clientX - rect.left, y: e.clientY - rect.top }; }, down: function(e){ if ( UI.mouse.pressed ) return UI.mouse.up(e); if ( e.which != 1 ) return; UI.mouse.pressed = true; UI.mouse.startPos = UI.mouse.getCoords(e); }, up: function(e){ if ( !UI.mouse.pressed || e.which != 1 ) return; UI.mouse.pressed = false; UI.mouse.endPos = UI.mouse.getCoords(e); if ( Fractal.mode == 0 ) { var pos = { x: Math.min(UI.mouse.startPos.x,UI.mouse.endPos.x), y: Math.min(UI.mouse.startPos.y,UI.mouse.endPos.y) }, width = Math.max(UI.mouse.startPos.x,UI.mouse.endPos.x) - pos.x, height = Math.max(UI.mouse.startPos.y,UI.mouse.endPos.y) - pos.y; Fractal.calcularZoom(pos,Math.max(width,height)); } else Fractal.calcularDesplazo(UI.mouse.endPos.x - UI.mouse.startPos.x , UI.mouse.endPos.y - UI.mouse.startPos.y); Fractal.render(); }, move: function(e){ if ( !UI.mouse.pressed ) return; var endPos = UI.mouse.getCoords(e), startPos = UI.mouse.startPos; engine.MyCanvas.renderImg( Fractal.imagen ); var context = engine.MyCanvas.context; context.beginPath(); if ( Fractal.mode == 0 ) { var pos = { x: Math.min(startPos.x,endPos.x), y: Math.min(startPos.y,endPos.y) }, width = Math.max(startPos.x,endPos.x) - pos.x, height = Math.max(startPos.y,endPos.y) - pos.y; context.rect(pos.x,pos.y, width,height); } else { context.moveTo(startPos.x,startPos.y); context.lineTo(endPos.x,endPos.y); } context.lineWidth = 2; context.strokeStyle = 'red'; context.stroke(); } }, paletaSelect: function(activate){ if ( ( activate == undefined ) || activate ){ this.$els.paleta.divs.select.hide(); this.$els.paleta.divs.selected.show(); this.paletaDraw(); } else { this.$els.paleta.divs.selected.hide(); this.$els.paleta.divs.select.show(); } }, setFractalprop: function(){ var $lis = this.$els.Fractal.settings.find('ul#datos li'); $lis.eq(0).find('span').html(Fractal.properties.width+"x"+Fractal.properties.height); var $time = $lis.eq(1).children('b'); $time.children('span').remove(); var $span = $('<span></span>'); $span.html(Fractal.lastTime + "ms").addClass("animate new"); $time.append( $span ); $span.focus().removeClass("new"); }, setDimensions: function(){ this.$els.Fractal.dims.s_x.html(Fractal.dimensions.x.s); this.$els.Fractal.dims.s_y.html(Fractal.dimensions.y.s); this.$els.Fractal.dims.e_x.html(Fractal.dimensions.x.e); this.$els.Fractal.dims.e_y.html(Fractal.dimensions.y.e); }, getDimensions: function(){ var $dim = this.$els.Fractal.dims; return ret = {x: { s: parseFloat( $dim.s_x.html() ), e: parseFloat( $dim.e_x.html() ) },y:{ s: parseFloat( $dim.s_y.html() ), e: parseFloat( $dim.e_y.html() ) }}; }, getWorkers: function(){ var v = parseInt(this.$els.Fractal.workers.val()); if ( v < 1 || v > 20 ) { v = 1; this.$els.Fractal.workers.val(v); } return v; }, rendering: function(){ UI.$els.Fractal.renderButton.html("... rendering ...").attr("disabled",""); $('body').addClass("cargando"); }, rendered: function(){ UI.$els.Fractal.renderButton.html("Render").removeAttr("disabled"); $('body').removeClass('cargando'); $('#modes').show(); }, paletaSlide: function(){ var lista = UI.$els.paleta.slide.list, boton = UI.$els.paleta.slide.button; if ( boton.hasClass("active") ){ boton.removeClass("active"); boton.html("Mostrar Paleta"); lista.slideUp("slow"); } else { boton.addClass("active"); lista.slideDown("slow"); boton.html("Ocultar Paleta"); } }, paletaDraw: function(){ var $lista = this.$els.paleta.slide.list; $lista.empty(); for (var i = 0; i < Fractal.paleta.json.length; i++) { var row = Fractal.paleta.json[i]; $lista.append( $('<li></li>').html('<span class="color" style="background-color:rgb('+ row[1].r+','+row[1].g+','+row[1].b+');"></span> ' + row[0]) ); }; } }; Fractal.paleta = new engine.Paleta(UI); UI.init(); Fractal.iniciate(); })();
var Model = require('./beer'); var Controller = { create: function(req, res) { var dados = req.body; var model = new Model(dados); model.save(function (err, data) { if (err){ console.log('Erro: ', err); res.json('Erro: ' + err); } else{ console.log('Cerveja Inserida: ', data); res.json(data); } }); }, retrieve: function(req, res) { var query = {}; Model.find(query, function (err, data) { if (err){ console.log('Erro: ', err); res.json('Erro: ' + err); } else{ console.log('Cervejas Listadas: ', data); res.json(data); } }); }, get: function(req, res) { var query = {_id: req.params.id}; Model.findOne(query, function (err, data) { if (err){ console.log('Erro: ', err); res.json('Erro: ' + err); } else{ console.log('Cervejas Listadas: ', data); res.json(data); } }); }, update: function(req, res) { var query = {_id: req.params.id}; var mod = req.body; Model.update(query, mod, function (err, data) { if (err){ console.log('Erro: ', err); res.json('Erro: ' + err); } else{ console.log('Cervejas alteradas: ', data); res.json(data); } }); }, delete: function(req, res) { var query = {_id: req.params.id}; // É multi: true CUIDADO! Model.remove(query, function(err, data) { if (err){ console.log('Erro: ', err); res.json('Erro: ' + err); } else{ console.log('Cervejas deletadas: ', data); res.json(data); } }); }, renderList: function(req, res) { var query = {}; Model.find(query, function (err, data) { if (err){ console.log('Erro: ', err); res.render('beers/error', { error: err }); } else{ console.log('Cervejas Listadas: ', data); res.render('beers/index', { title: 'Listagem das cervejas', beers: data }); } }); }, renderGet: function(req, res) { var query = {_id: req.params.id}; Model.findOne(query, function (err, data) { if (err){ console.log('Erro: ', err); res.render('beers/error', { error: err }); } else{ console.log('Cervejas consultada: ', data); res.render('beers/get', { title: 'Cerveja ' + data.name, beer: data }); } }); }, renderCreate: function(req, res) { res.render('beers/create', { title: 'Cadastro de Cerveja' }); }, renderUpdate: function(req, res) { var query = {_id: req.params.id}; Model.findOne(query, function (err, data) { if (err){ console.log('Erro: ', err); res.render('beers/error', { error: err }); } else{ console.log('Cervejas alteradas: ', data); res.render('beers/update', { title: 'Cerveja ' + data.name, beer: data }); } }); }, renderRemove: function(req, res) { var query = {_id: req.params.id}; Model.findOne(query, function (err, data) { if (err){ console.log('Erro: ', err); res.render('beers/error', { error: err }); } else{ console.log('Cervejas removidas: ', data); res.render('beers/remove', { title: 'Remover Cerveja ' + data.name, beer: data }); } }); } }; module.exports = Controller;
(function() { // numeral.js locale configuration // locale : Latvian (lv) // author : Lauris Bukšis-Haberkorns : https://github.com/Lafriks return { delimiters: { thousands: String.fromCharCode(160), decimal: ',' }, abbreviations: { thousand: ' tūkst.', million: ' milj.', billion: ' mljrd.', trillion: ' trilj.' }, ordinal: function(number) { return '.'; }, currency: { symbol: '€' } }; })();
module.exports = { out: "./docs/", readme: "README.md", name: "Persian Tools", includes: "./src", entryPoints: ["./src/index.ts"], exclude: ["**/test/**/*", "**/*.js", "**/dist/**/*", "**/src/dummy/**"], excludeExternals: true, includeVersion: true, excludePrivate: false, };
'use strict'; /** * Confirm new player name */ module.exports = (srcPath) => { const EventUtil = require(srcPath + 'EventUtil'); return { event: state => (socket, args) => { const say = EventUtil.genSay(socket); const write = EventUtil.genWrite(socket); write(`<bold>${args.name} doesn't exist, would you like to create it?</bold> <cyan>[y/n]</cyan> `); socket.once('data', confirmation => { say(''); confirmation = confirmation.toString().trim().toLowerCase(); if (!/[yn]/.test(confirmation)) { return socket.emit('player-name-check', socket, args); } if (confirmation === 'n') { say(`Let's try again...`); return socket.emit('create-player', socket, args); } return socket.emit('finish-player', socket, args); }); } }; };
import React, {Component} from 'react'; import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; import {initialPlay, nextTrack, togglePlaying} from 'redux/modules/player'; import {starTrack, unstarTrack} from 'redux/modules/starred'; import {isTrackStarred} from 'utils/track'; const classNames = require('classnames'); const styles = require('./Player.scss'); @connect( state => ({player: state.player, starred: state.starred}), dispatch => bindActionCreators({initialPlay, nextTrack, starTrack, unstarTrack, togglePlaying}, dispatch)) export default class Player extends Component { constructor(props) { super(props); this.handleToggleClick = this.handleToggleClick.bind(this); this.handleNextTrack = this.handleNextTrack.bind(this); this.handleStarTrack = this.handleStarTrack.bind(this); this.handleStarTrackClick = this.handleStarTrackClick.bind(this); this.isStarred = this.isStarred.bind(this); this.isTrackSelected = this.isTrackSelected.bind(this); this.renderInfo = this.renderInfo.bind(this); } handleToggleClick() { const {initialPlay, player, togglePlaying} = this.props; // eslint-disable-line no-shadow const {currentTrack} = player; if (currentTrack) { togglePlaying(); } else { initialPlay(); } } handleNextTrack() { if (!this.isTrackSelected()) return; const {nextTrack} = this.props; // eslint-disable-line no-shadow nextTrack(); } handleStarTrack() { const {player, starTrack} = this.props; // eslint-disable-line no-shadow const {currentTrack} = player; starTrack(currentTrack); console.log('starrr'); } handleStarTrackClick() { if (this.isStarred()) { this.handleUnstarTrack(); } else { this.handleStarTrack(); } } handleUnstarTrack() { const {player, unstarTrack} = this.props; // eslint-disable-line no-shadow const {currentTrack} = player; unstarTrack(currentTrack); console.log('unstarrr'); } isStarred() { const {player, starred} = this.props; const {currentTrack} = player; if (!this.isTrackSelected()) return false; const {starredTracks} = starred; return isTrackStarred(currentTrack, starredTracks); } isTrackSelected() { const {player} = this.props; const {currentTrack} = player; return currentTrack ? true : false; } renderInfo() { const {player} = this.props; const {currentTrack} = player; if (!currentTrack) return ''; const { data: { title, artist: { name: artistName, url: artistUrl }, track: { url: trackUrl } } } = currentTrack; return ( <h3 className={styles['info__text']}> <a className={styles['info__text__title']} href={trackUrl} target="_blank">{title}</a> <span className={styles['info__text__divider']}></span> <a className={styles['info__text__artist']} href={artistUrl} target="_blank">{artistName}</a> </h3> ); } render() { const {player} = this.props; const { playing: isPlaying } = player; const isStarred = this.isStarred(); console.log('is starred?', isStarred); const trackIsSelected = this.isTrackSelected(); const rootClasses = classNames( styles['Player'], { [styles['state--empty']]: !trackIsSelected, [styles['state--playing']]: isPlaying, [styles['state--starred']]: isStarred, [styles['state--disabled']]: !trackIsSelected } ); return ( <div className={rootClasses}> <div className={styles['info']}> {this.renderInfo()} </div> <div className={styles['controls']}> <div className={[styles['btn'], styles['btn--star']].join(' ')} onClick={this.handleStarTrackClick}> <div className={styles['btnIcon']}></div> </div> <div className={[styles['btn'], styles['btn--share']].join(' ')}> <div className={styles['btnIcon']}></div> </div> <div className={[styles['btn'], styles['btn--toggle']].join(' ')} onClick={this.handleToggleClick}> <div className={styles['btnIcon']}></div> </div> <div className={[styles['btn'], styles['btn--skip']].join(' ')} onClick={this.handleNextTrack}> <div className={styles['btnIcon']}></div> </div> </div> </div> ); } } Player.propTypes = { initialPlay: React.PropTypes.func, nextTrack: React.PropTypes.func, player: React.PropTypes.object, starred: React.PropTypes.object, starTrack: React.PropTypes.func, unstarTrack: React.PropTypes.func, togglePlaying: React.PropTypes.func, };
/** * @fileoverview Rule to enforce grouped require statements for Node.JS * @author Raphael Pigulla * @deprecated in ESLint v7.0.0 */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = { meta: { deprecated: true, replacedBy: [], type: "suggestion", docs: { description: "disallow `require` calls to be mixed with regular variable declarations", recommended: false, url: "https://eslint.org/docs/rules/no-mixed-requires" }, schema: [ { oneOf: [ { type: "boolean" }, { type: "object", properties: { grouping: { type: "boolean" }, allowCall: { type: "boolean" } }, additionalProperties: false } ] } ], messages: { noMixRequire: "Do not mix 'require' and other declarations.", noMixCoreModuleFileComputed: "Do not mix core, module, file and computed requires." } }, create(context) { const options = context.options[0]; let grouping = false, allowCall = false; if (typeof options === "object") { grouping = options.grouping; allowCall = options.allowCall; } else { grouping = !!options; } /** * Returns the list of built-in modules. * @returns {string[]} An array of built-in Node.js modules. */ function getBuiltinModules() { /* * This list is generated using: * `require("repl")._builtinLibs.concat('repl').sort()` * This particular list is as per nodejs v0.12.2 and iojs v0.7.1 */ return [ "assert", "buffer", "child_process", "cluster", "crypto", "dgram", "dns", "domain", "events", "fs", "http", "https", "net", "os", "path", "punycode", "querystring", "readline", "repl", "smalloc", "stream", "string_decoder", "tls", "tty", "url", "util", "v8", "vm", "zlib" ]; } const BUILTIN_MODULES = getBuiltinModules(); const DECL_REQUIRE = "require", DECL_UNINITIALIZED = "uninitialized", DECL_OTHER = "other"; const REQ_CORE = "core", REQ_FILE = "file", REQ_MODULE = "module", REQ_COMPUTED = "computed"; /** * Determines the type of a declaration statement. * @param {ASTNode} initExpression The init node of the VariableDeclarator. * @returns {string} The type of declaration represented by the expression. */ function getDeclarationType(initExpression) { if (!initExpression) { // "var x;" return DECL_UNINITIALIZED; } if (initExpression.type === "CallExpression" && initExpression.callee.type === "Identifier" && initExpression.callee.name === "require" ) { // "var x = require('util');" return DECL_REQUIRE; } if (allowCall && initExpression.type === "CallExpression" && initExpression.callee.type === "CallExpression" ) { // "var x = require('diagnose')('sub-module');" return getDeclarationType(initExpression.callee); } if (initExpression.type === "MemberExpression") { // "var x = require('glob').Glob;" return getDeclarationType(initExpression.object); } // "var x = 42;" return DECL_OTHER; } /** * Determines the type of module that is loaded via require. * @param {ASTNode} initExpression The init node of the VariableDeclarator. * @returns {string} The module type. */ function inferModuleType(initExpression) { if (initExpression.type === "MemberExpression") { // "var x = require('glob').Glob;" return inferModuleType(initExpression.object); } if (initExpression.arguments.length === 0) { // "var x = require();" return REQ_COMPUTED; } const arg = initExpression.arguments[0]; if (arg.type !== "Literal" || typeof arg.value !== "string") { // "var x = require(42);" return REQ_COMPUTED; } if (BUILTIN_MODULES.indexOf(arg.value) !== -1) { // "var fs = require('fs');" return REQ_CORE; } if (/^\.{0,2}\//u.test(arg.value)) { // "var utils = require('./utils');" return REQ_FILE; } // "var async = require('async');" return REQ_MODULE; } /** * Check if the list of variable declarations is mixed, i.e. whether it * contains both require and other declarations. * @param {ASTNode} declarations The list of VariableDeclarators. * @returns {boolean} True if the declarations are mixed, false if not. */ function isMixed(declarations) { const contains = {}; declarations.forEach(declaration => { const type = getDeclarationType(declaration.init); contains[type] = true; }); return !!( contains[DECL_REQUIRE] && (contains[DECL_UNINITIALIZED] || contains[DECL_OTHER]) ); } /** * Check if all require declarations in the given list are of the same * type. * @param {ASTNode} declarations The list of VariableDeclarators. * @returns {boolean} True if the declarations are grouped, false if not. */ function isGrouped(declarations) { const found = {}; declarations.forEach(declaration => { if (getDeclarationType(declaration.init) === DECL_REQUIRE) { found[inferModuleType(declaration.init)] = true; } }); return Object.keys(found).length <= 1; } return { VariableDeclaration(node) { if (isMixed(node.declarations)) { context.report({ node, messageId: "noMixRequire" }); } else if (grouping && !isGrouped(node.declarations)) { context.report({ node, messageId: "noMixCoreModuleFileComputed" }); } } }; } };
import IntersectionObserverPolyfill from './resources/IntersectionObserverPolyfill'; import IntersectionObserverEntryPolyfill from './resources/IntersectionObserverEntryPolyfill'; export { IntersectionObserverEntryPolyfill, IntersectionObserverPolyfill, };
(function() { var bcv_parser, bcv_passage, bcv_utils, root, hasProp = {}.hasOwnProperty; root = this; bcv_parser = (function() { bcv_parser.prototype.s = ""; bcv_parser.prototype.entities = []; bcv_parser.prototype.passage = null; bcv_parser.prototype.regexps = {}; bcv_parser.prototype.options = { consecutive_combination_strategy: "combine", osis_compaction_strategy: "b", book_sequence_strategy: "ignore", invalid_sequence_strategy: "ignore", sequence_combination_strategy: "combine", punctuation_strategy: "us", invalid_passage_strategy: "ignore", non_latin_digits_strategy: "ignore", passage_existence_strategy: "bcv", zero_chapter_strategy: "error", zero_verse_strategy: "error", single_chapter_1_strategy: "chapter", book_alone_strategy: "ignore", book_range_strategy: "ignore", captive_end_digits_strategy: "delete", end_range_digits_strategy: "verse", include_apocrypha: false, ps151_strategy: "c", versification_system: "default", case_sensitive: "none" }; function bcv_parser() { var key, ref, val; this.options = {}; ref = bcv_parser.prototype.options; for (key in ref) { if (!hasProp.call(ref, key)) continue; val = ref[key]; this.options[key] = val; } this.versification_system(this.options.versification_system); } bcv_parser.prototype.parse = function(s) { var ref; this.reset(); this.s = s; s = this.replace_control_characters(s); ref = this.match_books(s), s = ref[0], this.passage.books = ref[1]; this.entities = this.match_passages(s)[0]; return this; }; bcv_parser.prototype.parse_with_context = function(s, context) { var entities, ref, ref1, ref2; this.reset(); ref = this.match_books(this.replace_control_characters(context)), context = ref[0], this.passage.books = ref[1]; ref1 = this.match_passages(context), entities = ref1[0], context = ref1[1]; this.reset(); this.s = s; s = this.replace_control_characters(s); ref2 = this.match_books(s), s = ref2[0], this.passage.books = ref2[1]; this.passage.books.push({ value: "", parsed: [], start_index: 0, type: "context", context: context }); s = "\x1f" + (this.passage.books.length - 1) + "/9\x1f" + s; this.entities = this.match_passages(s)[0]; return this; }; bcv_parser.prototype.reset = function() { this.s = ""; this.entities = []; if (this.passage) { this.passage.books = []; return this.passage.indices = {}; } else { this.passage = new bcv_passage; this.passage.options = this.options; return this.passage.translations = this.translations; } }; bcv_parser.prototype.set_options = function(options) { var key, val; for (key in options) { if (!hasProp.call(options, key)) continue; val = options[key]; if (key === "include_apocrypha" || key === "versification_system" || key === "case_sensitive") { this[key](val); } else { this.options[key] = val; } } return this; }; bcv_parser.prototype.include_apocrypha = function(arg) { var base, base1, ref, translation, verse_count; if (!((arg != null) && (arg === true || arg === false))) { return this; } this.options.include_apocrypha = arg; this.regexps.books = this.regexps.get_books(arg, this.options.case_sensitive); ref = this.translations; for (translation in ref) { if (!hasProp.call(ref, translation)) continue; if (translation === "aliases" || translation === "alternates") { continue; } if ((base = this.translations[translation]).chapters == null) { base.chapters = {}; } if ((base1 = this.translations[translation].chapters)["Ps"] == null) { base1["Ps"] = bcv_utils.shallow_clone_array(this.translations["default"].chapters["Ps"]); } if (arg === true) { if (this.translations[translation].chapters["Ps151"] != null) { verse_count = this.translations[translation].chapters["Ps151"][0]; } else { verse_count = this.translations["default"].chapters["Ps151"][0]; } this.translations[translation].chapters["Ps"][150] = verse_count; } else { if (this.translations[translation].chapters["Ps"].length === 151) { this.translations[translation].chapters["Ps"].pop(); } } } return this; }; bcv_parser.prototype.versification_system = function(system) { var base, base1, base2, book, chapter_list, ref, ref1; if (!((system != null) && (this.translations[system] != null))) { return this; } if (this.translations.alternates["default"] != null) { if (system === "default") { if (this.translations.alternates["default"].order != null) { this.translations["default"].order = bcv_utils.shallow_clone(this.translations.alternates["default"].order); } ref = this.translations.alternates["default"].chapters; for (book in ref) { if (!hasProp.call(ref, book)) continue; chapter_list = ref[book]; this.translations["default"].chapters[book] = bcv_utils.shallow_clone_array(chapter_list); } } else { this.versification_system("default"); } } if ((base = this.translations.alternates)["default"] == null) { base["default"] = { order: null, chapters: {} }; } if (system !== "default" && (this.translations[system].order != null)) { if ((base1 = this.translations.alternates["default"]).order == null) { base1.order = bcv_utils.shallow_clone(this.translations["default"].order); } this.translations["default"].order = bcv_utils.shallow_clone(this.translations[system].order); } if (system !== "default" && (this.translations[system].chapters != null)) { ref1 = this.translations[system].chapters; for (book in ref1) { if (!hasProp.call(ref1, book)) continue; chapter_list = ref1[book]; if ((base2 = this.translations.alternates["default"].chapters)[book] == null) { base2[book] = bcv_utils.shallow_clone_array(this.translations["default"].chapters[book]); } this.translations["default"].chapters[book] = bcv_utils.shallow_clone_array(chapter_list); } } this.options.versification_system = system; this.include_apocrypha(this.options.include_apocrypha); return this; }; bcv_parser.prototype.case_sensitive = function(arg) { if (!((arg != null) && (arg === "none" || arg === "books"))) { return this; } if (arg === this.options.case_sensitive) { return this; } this.options.case_sensitive = arg; this.regexps.books = this.regexps.get_books(this.options.include_apocrypha, arg); return this; }; bcv_parser.prototype.translation_info = function(new_translation) { var book, chapter_list, id, old_translation, out, ref, ref1, ref2; if (new_translation == null) { new_translation = "default"; } if ((new_translation != null) && (((ref = this.translations.aliases[new_translation]) != null ? ref.alias : void 0) != null)) { new_translation = this.translations.aliases[new_translation].alias; } if (!((new_translation != null) && (this.translations[new_translation] != null))) { new_translation = "default"; } old_translation = this.options.versification_system; if (new_translation !== old_translation) { this.versification_system(new_translation); } out = { alias: new_translation, books: [], chapters: {}, order: bcv_utils.shallow_clone(this.translations["default"].order) }; ref1 = this.translations["default"].chapters; for (book in ref1) { if (!hasProp.call(ref1, book)) continue; chapter_list = ref1[book]; out.chapters[book] = bcv_utils.shallow_clone_array(chapter_list); } ref2 = out.order; for (book in ref2) { if (!hasProp.call(ref2, book)) continue; id = ref2[book]; out.books[id - 1] = book; } if (new_translation !== old_translation) { this.versification_system(old_translation); } return out; }; bcv_parser.prototype.replace_control_characters = function(s) { s = s.replace(this.regexps.control, " "); if (this.options.non_latin_digits_strategy === "replace") { s = s.replace(/[٠۰߀०০੦૦୦0౦೦൦๐໐༠၀႐០᠐᥆᧐᪀᪐᭐᮰᱀᱐꘠꣐꤀꧐꩐꯰0]/g, "0"); s = s.replace(/[١۱߁१১੧૧୧௧౧೧൧๑໑༡၁႑១᠑᥇᧑᪁᪑᭑᮱᱁᱑꘡꣑꤁꧑꩑꯱1]/g, "1"); s = s.replace(/[٢۲߂२২੨૨୨௨౨೨൨๒໒༢၂႒២᠒᥈᧒᪂᪒᭒᮲᱂᱒꘢꣒꤂꧒꩒꯲2]/g, "2"); s = s.replace(/[٣۳߃३৩੩૩୩௩౩೩൩๓໓༣၃႓៣᠓᥉᧓᪃᪓᭓᮳᱃᱓꘣꣓꤃꧓꩓꯳3]/g, "3"); s = s.replace(/[٤۴߄४৪੪૪୪௪౪೪൪๔໔༤၄႔៤᠔᥊᧔᪄᪔᭔᮴᱄᱔꘤꣔꤄꧔꩔꯴4]/g, "4"); s = s.replace(/[٥۵߅५৫੫૫୫௫౫೫൫๕໕༥၅႕៥᠕᥋᧕᪅᪕᭕᮵᱅᱕꘥꣕꤅꧕꩕꯵5]/g, "5"); s = s.replace(/[٦۶߆६৬੬૬୬௬౬೬൬๖໖༦၆႖៦᠖᥌᧖᪆᪖᭖᮶᱆᱖꘦꣖꤆꧖꩖꯶6]/g, "6"); s = s.replace(/[٧۷߇७৭੭૭୭௭౭೭൭๗໗༧၇႗៧᠗᥍᧗᪇᪗᭗᮷᱇᱗꘧꣗꤇꧗꩗꯷7]/g, "7"); s = s.replace(/[٨۸߈८৮੮૮୮௮౮೮൮๘໘༨၈႘៨᠘᥎᧘᪈᪘᭘᮸᱈᱘꘨꣘꤈꧘꩘꯸8]/g, "8"); s = s.replace(/[٩۹߉९৯੯૯୯௯౯೯൯๙໙༩၉႙៩᠙᥏᧙᪉᪙᭙᮹᱉᱙꘩꣙꤉꧙꩙꯹9]/g, "9"); } return s; }; bcv_parser.prototype.match_books = function(s) { var book, books, has_replacement, k, len, ref; books = []; ref = this.regexps.books; for (k = 0, len = ref.length; k < len; k++) { book = ref[k]; has_replacement = false; s = s.replace(book.regexp, function(full, prev, bk) { var extra; has_replacement = true; books.push({ value: bk, parsed: book.osis, type: "book" }); extra = book.extra != null ? "/" + book.extra : ""; return prev + "\x1f" + (books.length - 1) + extra + "\x1f"; }); if (has_replacement === true && /^[\s\x1f\d:.,;\-\u2013\u2014]+$/.test(s)) { break; } } s = s.replace(this.regexps.translations, function(match) { books.push({ value: match, parsed: match.toLowerCase(), type: "translation" }); return "\x1e" + (books.length - 1) + "\x1e"; }); return [s, this.get_book_indices(books, s)]; }; bcv_parser.prototype.get_book_indices = function(books, s) { var add_index, match, re; add_index = 0; re = /([\x1f\x1e])(\d+)(?:\/\d+)?\1/g; while (match = re.exec(s)) { books[match[2]].start_index = match.index + add_index; add_index += books[match[2]].value.length - match[0].length; } return books; }; bcv_parser.prototype.match_passages = function(s) { var accum, book_id, entities, full, match, next_char, original_part_length, part, passage, post_context, ref, regexp_index_adjust, start_index_adjust; entities = []; post_context = {}; while (match = this.regexps.escaped_passage.exec(s)) { full = match[0], part = match[1], book_id = match[2]; original_part_length = part.length; match.index += full.length - original_part_length; if (/\s[2-9]\d\d\s*$|\s\d{4,}\s*$/.test(part)) { part = part.replace(/\s+\d+\s*$/, ""); } if (!/[\d\x1f\x1e)]$/.test(part)) { part = this.replace_match_end(part); } if (this.options.captive_end_digits_strategy === "delete") { next_char = match.index + part.length; if (s.length > next_char && /^\w/.test(s.substr(next_char, 1))) { part = part.replace(/[\s*]+\d+$/, ""); } part = part.replace(/(\x1e[)\]]?)[\s*]*\d+$/, "$1"); } part = part.replace(/[A-Z]+/g, function(capitals) { return capitals.toLowerCase(); }); start_index_adjust = part.substr(0, 1) === "\x1f" ? 0 : part.split("\x1f")[0].length; passage = { value: grammar.parse(part, { punctuation_strategy: this.options.punctuation_strategy }), type: "base", start_index: this.passage.books[book_id].start_index - start_index_adjust, match: part }; if (this.options.book_alone_strategy === "full" && this.options.book_range_strategy === "include" && passage.value[0].type === "b" && (passage.value.length === 1 || (passage.value.length > 1 && passage.value[1].type === "translation_sequence")) && start_index_adjust === 0 && (this.passage.books[book_id].parsed.length === 1 || (this.passage.books[book_id].parsed.length > 1 && this.passage.books[book_id].parsed[1].type === "translation")) && /^[234]/.test(this.passage.books[book_id].parsed[0])) { this.create_book_range(s, passage, book_id); } ref = this.passage.handle_obj(passage), accum = ref[0], post_context = ref[1]; entities = entities.concat(accum); regexp_index_adjust = this.adjust_regexp_end(accum, original_part_length, part.length); if (regexp_index_adjust > 0) { this.regexps.escaped_passage.lastIndex -= regexp_index_adjust; } } return [entities, post_context]; }; bcv_parser.prototype.adjust_regexp_end = function(accum, old_length, new_length) { var regexp_index_adjust; regexp_index_adjust = 0; if (accum.length > 0) { regexp_index_adjust = old_length - accum[accum.length - 1].indices[1] - 1; } else if (old_length !== new_length) { regexp_index_adjust = old_length - new_length; } return regexp_index_adjust; }; bcv_parser.prototype.replace_match_end = function(part) { var match, remove; remove = part.length; while (match = this.regexps.match_end_split.exec(part)) { remove = match.index + match[0].length; } if (remove < part.length) { part = part.substr(0, remove); } return part; }; bcv_parser.prototype.create_book_range = function(s, passage, book_id) { var cases, i, k, limit, prev, range_regexp, ref; cases = [bcv_parser.prototype.regexps.first, bcv_parser.prototype.regexps.second, bcv_parser.prototype.regexps.third]; limit = parseInt(this.passage.books[book_id].parsed[0].substr(0, 1), 10); for (i = k = 1, ref = limit; 1 <= ref ? k < ref : k > ref; i = 1 <= ref ? ++k : --k) { range_regexp = i === limit - 1 ? bcv_parser.prototype.regexps.range_and : bcv_parser.prototype.regexps.range_only; prev = s.match(RegExp("(?:^|\\W)(" + cases[i - 1] + "\\s*" + range_regexp + "\\s*)\\x1f" + book_id + "\\x1f", "i")); if (prev != null) { return this.add_book_range_object(passage, prev, i); } } return false; }; bcv_parser.prototype.add_book_range_object = function(passage, prev, start_book_number) { var i, k, length, ref, ref1, results; length = prev[1].length; passage.value[0] = { type: "b_range_pre", value: [ { type: "b_pre", value: start_book_number.toString(), indices: [prev.index, prev.index + length] }, passage.value[0] ], indices: [0, passage.value[0].indices[1] + length] }; passage.value[0].value[1].indices[0] += length; passage.value[0].value[1].indices[1] += length; passage.start_index -= length; passage.match = prev[1] + passage.match; if (passage.value.length === 1) { return; } results = []; for (i = k = 1, ref = passage.value.length; 1 <= ref ? k < ref : k > ref; i = 1 <= ref ? ++k : --k) { if (passage.value[i].value == null) { continue; } if (((ref1 = passage.value[i].value[0]) != null ? ref1.indices : void 0) != null) { passage.value[i].value[0].indices[0] += length; passage.value[i].value[0].indices[1] += length; } passage.value[i].indices[0] += length; results.push(passage.value[i].indices[1] += length); } return results; }; bcv_parser.prototype.osis = function() { var k, len, osis, out, ref; out = []; ref = this.parsed_entities(); for (k = 0, len = ref.length; k < len; k++) { osis = ref[k]; if (osis.osis.length > 0) { out.push(osis.osis); } } return out.join(","); }; bcv_parser.prototype.osis_and_translations = function() { var k, len, osis, out, ref; out = []; ref = this.parsed_entities(); for (k = 0, len = ref.length; k < len; k++) { osis = ref[k]; if (osis.osis.length > 0) { out.push([osis.osis, osis.translations.join(",")]); } } return out; }; bcv_parser.prototype.osis_and_indices = function() { var k, len, osis, out, ref; out = []; ref = this.parsed_entities(); for (k = 0, len = ref.length; k < len; k++) { osis = ref[k]; if (osis.osis.length > 0) { out.push({ osis: osis.osis, translations: osis.translations, indices: osis.indices }); } } return out; }; bcv_parser.prototype.parsed_entities = function() { var entity, entity_id, i, k, l, last_i, len, len1, length, m, n, osis, osises, out, passage, ref, ref1, ref2, ref3, strings, translation, translation_alias, translation_osis, translations; out = []; for (entity_id = k = 0, ref = this.entities.length; 0 <= ref ? k < ref : k > ref; entity_id = 0 <= ref ? ++k : --k) { entity = this.entities[entity_id]; if (entity.type && entity.type === "translation_sequence" && out.length > 0 && entity_id === out[out.length - 1].entity_id + 1) { out[out.length - 1].indices[1] = entity.absolute_indices[1]; } if (entity.passages == null) { continue; } if ((entity.type === "b" && this.options.book_alone_strategy === "ignore") || (entity.type === "b_range" && this.options.book_range_strategy === "ignore") || entity.type === "context") { continue; } translations = []; translation_alias = null; if (entity.passages[0].translations != null) { ref1 = entity.passages[0].translations; for (l = 0, len = ref1.length; l < len; l++) { translation = ref1[l]; translation_osis = ((ref2 = translation.osis) != null ? ref2.length : void 0) > 0 ? translation.osis : ""; if (translation_alias == null) { translation_alias = translation.alias; } translations.push(translation_osis); } } else { translations = [""]; translation_alias = "default"; } osises = []; length = entity.passages.length; for (i = m = 0, ref3 = length; 0 <= ref3 ? m < ref3 : m > ref3; i = 0 <= ref3 ? ++m : --m) { passage = entity.passages[i]; if (passage.type == null) { passage.type = entity.type; } if (passage.valid.valid === false) { if (this.options.invalid_sequence_strategy === "ignore" && entity.type === "sequence") { this.snap_sequence("ignore", entity, osises, i, length); } if (this.options.invalid_passage_strategy === "ignore") { continue; } } if ((passage.type === "b" || passage.type === "b_range") && this.options.book_sequence_strategy === "ignore" && entity.type === "sequence") { this.snap_sequence("book", entity, osises, i, length); continue; } if ((passage.type === "b_range_start" || passage.type === "range_end_b") && this.options.book_range_strategy === "ignore") { this.snap_range(entity, i); } if (passage.absolute_indices == null) { passage.absolute_indices = entity.absolute_indices; } osises.push({ osis: passage.valid.valid ? this.to_osis(passage.start, passage.end, translation_alias) : "", type: passage.type, indices: passage.absolute_indices, translations: translations, start: passage.start, end: passage.end, enclosed_indices: passage.enclosed_absolute_indices, entity_id: entity_id, entities: [passage] }); } if (osises.length === 0) { continue; } if (osises.length > 1 && this.options.consecutive_combination_strategy === "combine") { osises = this.combine_consecutive_passages(osises, translation_alias); } if (this.options.sequence_combination_strategy === "separate") { out = out.concat(osises); } else { strings = []; last_i = osises.length - 1; if ((osises[last_i].enclosed_indices != null) && osises[last_i].enclosed_indices[1] >= 0) { entity.absolute_indices[1] = osises[last_i].enclosed_indices[1]; } for (n = 0, len1 = osises.length; n < len1; n++) { osis = osises[n]; if (osis.osis.length > 0) { strings.push(osis.osis); } } out.push({ osis: strings.join(","), indices: entity.absolute_indices, translations: translations, entity_id: entity_id, entities: osises }); } } return out; }; bcv_parser.prototype.to_osis = function(start, end, translation) { var osis, out; if ((end.c == null) && (end.v == null) && start.b === end.b && (start.c == null) && (start.v == null) && this.options.book_alone_strategy === "first_chapter") { end.c = 1; } osis = { start: "", end: "" }; if (start.c == null) { start.c = 1; } if (start.v == null) { start.v = 1; } if (end.c == null) { if (this.options.passage_existence_strategy.indexOf("c") >= 0 || ((this.passage.translations[translation].chapters[end.b] != null) && this.passage.translations[translation].chapters[end.b].length === 1)) { end.c = this.passage.translations[translation].chapters[end.b].length; } else { end.c = 999; } } if (end.v == null) { if ((this.passage.translations[translation].chapters[end.b][end.c - 1] != null) && this.options.passage_existence_strategy.indexOf("v") >= 0) { end.v = this.passage.translations[translation].chapters[end.b][end.c - 1]; } else { end.v = 999; } } if (this.options.include_apocrypha && this.options.ps151_strategy === "b" && ((start.c === 151 && start.b === "Ps") || (end.c === 151 && end.b === "Ps"))) { this.fix_ps151(start, end, translation); } if (this.options.osis_compaction_strategy === "b" && start.c === 1 && start.v === 1 && ((end.c === 999 && end.v === 999) || (end.c === this.passage.translations[translation].chapters[end.b].length && this.options.passage_existence_strategy.indexOf("c") >= 0 && (end.v === 999 || (end.v === this.passage.translations[translation].chapters[end.b][end.c - 1] && this.options.passage_existence_strategy.indexOf("v") >= 0))))) { osis.start = start.b; osis.end = end.b; } else if (this.options.osis_compaction_strategy.length <= 2 && start.v === 1 && (end.v === 999 || (end.v === this.passage.translations[translation].chapters[end.b][end.c - 1] && this.options.passage_existence_strategy.indexOf("v") >= 0))) { osis.start = start.b + "." + start.c.toString(); osis.end = end.b + "." + end.c.toString(); } else { osis.start = start.b + "." + start.c.toString() + "." + start.v.toString(); osis.end = end.b + "." + end.c.toString() + "." + end.v.toString(); } if (osis.start === osis.end) { out = osis.start; } else { out = osis.start + "-" + osis.end; } if (start.extra != null) { out = start.extra + "," + out; } if (end.extra != null) { out += "," + end.extra; } return out; }; bcv_parser.prototype.fix_ps151 = function(start, end, translation) { var ref; if (translation !== "default" && (((ref = this.translations[translation]) != null ? ref.chapters["Ps151"] : void 0) == null)) { this.passage.promote_book_to_translation("Ps151", translation); } if (start.c === 151 && start.b === "Ps") { if (end.c === 151 && end.b === "Ps") { start.b = "Ps151"; start.c = 1; end.b = "Ps151"; return end.c = 1; } else { start.extra = this.to_osis({ b: "Ps151", c: 1, v: start.v }, { b: "Ps151", c: 1, v: this.passage.translations[translation].chapters["Ps151"][0] }, translation); start.b = "Prov"; start.c = 1; return start.v = 1; } } else { end.extra = this.to_osis({ b: "Ps151", c: 1, v: 1 }, { b: "Ps151", c: 1, v: end.v }, translation); end.c = 150; return end.v = this.passage.translations[translation].chapters["Ps"][149]; } }; bcv_parser.prototype.combine_consecutive_passages = function(osises, translation) { var enclosed_sequence_start, has_enclosed, i, is_enclosed_last, k, last_i, osis, out, prev, prev_i, ref; out = []; prev = {}; last_i = osises.length - 1; enclosed_sequence_start = -1; has_enclosed = false; for (i = k = 0, ref = last_i; 0 <= ref ? k <= ref : k >= ref; i = 0 <= ref ? ++k : --k) { osis = osises[i]; if (osis.osis.length > 0) { prev_i = out.length - 1; is_enclosed_last = false; if (osis.enclosed_indices[0] !== enclosed_sequence_start) { enclosed_sequence_start = osis.enclosed_indices[0]; } if (enclosed_sequence_start >= 0 && (i === last_i || osises[i + 1].enclosed_indices[0] !== osis.enclosed_indices[0])) { is_enclosed_last = true; has_enclosed = true; } if (this.is_verse_consecutive(prev, osis.start, translation)) { out[prev_i].end = osis.end; out[prev_i].is_enclosed_last = is_enclosed_last; out[prev_i].indices[1] = osis.indices[1]; out[prev_i].enclosed_indices[1] = osis.enclosed_indices[1]; out[prev_i].osis = this.to_osis(out[prev_i].start, osis.end, translation); } else { out.push(osis); } prev = { b: osis.end.b, c: osis.end.c, v: osis.end.v }; } else { out.push(osis); prev = {}; } } if (has_enclosed) { this.snap_enclosed_indices(out); } return out; }; bcv_parser.prototype.snap_enclosed_indices = function(osises) { var k, len, osis; for (k = 0, len = osises.length; k < len; k++) { osis = osises[k]; if (osis.is_enclosed_last != null) { if (osis.enclosed_indices[0] < 0 && osis.is_enclosed_last) { osis.indices[1] = osis.enclosed_indices[1]; } delete osis.is_enclosed_last; } } return osises; }; bcv_parser.prototype.is_verse_consecutive = function(prev, check, translation) { var translation_order; if (prev.b == null) { return false; } translation_order = this.passage.translations[translation].order != null ? this.passage.translations[translation].order : this.passage.translations["default"].order; if (prev.b === check.b) { if (prev.c === check.c) { if (prev.v === check.v - 1) { return true; } } else if (check.v === 1 && prev.c === check.c - 1) { if (prev.v === this.passage.translations[translation].chapters[prev.b][prev.c - 1]) { return true; } } } else if (check.c === 1 && check.v === 1 && translation_order[prev.b] === translation_order[check.b] - 1) { if (prev.c === this.passage.translations[translation].chapters[prev.b].length && prev.v === this.passage.translations[translation].chapters[prev.b][prev.c - 1]) { return true; } } return false; }; bcv_parser.prototype.snap_range = function(entity, passage_i) { var entity_i, key, pluck, ref, source_entity, target_entity, temp, type; if (entity.type === "b_range_start" || (entity.type === "sequence" && entity.passages[passage_i].type === "b_range_start")) { entity_i = 1; source_entity = "end"; type = "b_range_start"; } else { entity_i = 0; source_entity = "start"; type = "range_end_b"; } target_entity = source_entity === "end" ? "start" : "end"; ref = entity.passages[passage_i][target_entity]; for (key in ref) { if (!hasProp.call(ref, key)) continue; entity.passages[passage_i][target_entity][key] = entity.passages[passage_i][source_entity][key]; } if (entity.type === "sequence") { if (passage_i >= entity.value.length) { passage_i = entity.value.length - 1; } pluck = this.passage.pluck(type, entity.value[passage_i]); if (pluck != null) { temp = this.snap_range(pluck, 0); if (passage_i === 0) { entity.absolute_indices[0] = temp.absolute_indices[0]; } else { entity.absolute_indices[1] = temp.absolute_indices[1]; } } } else { entity.original_type = entity.type; entity.type = entity.value[entity_i].type; entity.absolute_indices = [entity.value[entity_i].absolute_indices[0], entity.value[entity_i].absolute_indices[1]]; } return entity; }; bcv_parser.prototype.snap_sequence = function(type, entity, osises, i, length) { var passage; passage = entity.passages[i]; if (passage.absolute_indices[0] === entity.absolute_indices[0] && i < length - 1 && this.get_snap_sequence_i(entity.passages, i, length) !== i) { entity.absolute_indices[0] = entity.passages[i + 1].absolute_indices[0]; this.remove_absolute_indices(entity.passages, i + 1); } else if (passage.absolute_indices[1] === entity.absolute_indices[1] && i > 0) { entity.absolute_indices[1] = osises.length > 0 ? osises[osises.length - 1].indices[1] : entity.passages[i - 1].absolute_indices[1]; } else if (type === "book" && i < length - 1 && !this.starts_with_book(entity.passages[i + 1])) { entity.passages[i + 1].absolute_indices[0] = passage.absolute_indices[0]; } return entity; }; bcv_parser.prototype.get_snap_sequence_i = function(passages, i, length) { var j, k, ref, ref1; for (j = k = ref = i + 1, ref1 = length; ref <= ref1 ? k < ref1 : k > ref1; j = ref <= ref1 ? ++k : --k) { if (this.starts_with_book(passages[j])) { return j; } if (passages[j].valid.valid) { return i; } } return i; }; bcv_parser.prototype.starts_with_book = function(passage) { if (passage.type.substr(0, 1) === "b") { return true; } if ((passage.type === "range" || passage.type === "ff") && passage.start.type.substr(0, 1) === "b") { return true; } return false; }; bcv_parser.prototype.remove_absolute_indices = function(passages, i) { var end, k, len, passage, ref, ref1, start; if (passages[i].enclosed_absolute_indices[0] < 0) { return false; } ref = passages[i].enclosed_absolute_indices, start = ref[0], end = ref[1]; ref1 = passages.slice(i); for (k = 0, len = ref1.length; k < len; k++) { passage = ref1[k]; if (passage.enclosed_absolute_indices[0] === start && passage.enclosed_absolute_indices[1] === end) { passage.enclosed_absolute_indices = [-1, -1]; } else { break; } } return true; }; return bcv_parser; })(); root.bcv_parser = bcv_parser; bcv_passage = (function() { function bcv_passage() {} bcv_passage.prototype.books = []; bcv_passage.prototype.indices = {}; bcv_passage.prototype.options = {}; bcv_passage.prototype.translations = {}; bcv_passage.prototype.handle_array = function(passages, accum, context) { var k, len, passage, ref; if (accum == null) { accum = []; } if (context == null) { context = {}; } for (k = 0, len = passages.length; k < len; k++) { passage = passages[k]; if (passage == null) { continue; } if (passage.type === "stop") { break; } ref = this.handle_obj(passage, accum, context), accum = ref[0], context = ref[1]; } return [accum, context]; }; bcv_passage.prototype.handle_obj = function(passage, accum, context) { if ((passage.type != null) && (this[passage.type] != null)) { return this[passage.type](passage, accum, context); } else { return [accum, context]; } }; bcv_passage.prototype.b = function(passage, accum, context) { var alternates, b, k, len, obj, ref, valid; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; alternates = []; ref = this.books[passage.value].parsed; for (k = 0, len = ref.length; k < len; k++) { b = ref[k]; valid = this.validate_ref(passage.start_context.translations, { b: b }); obj = { start: { b: b }, end: { b: b }, valid: valid }; if (passage.passages.length === 0 && valid.valid) { passage.passages.push(obj); } else { alternates.push(obj); } } if (passage.passages.length === 0) { passage.passages.push(alternates.shift()); } if (alternates.length > 0) { passage.passages[0].alternates = alternates; } if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } accum.push(passage); context = { b: passage.passages[0].start.b }; if (passage.start_context.translations != null) { context.translations = passage.start_context.translations; } return [accum, context]; }; bcv_passage.prototype.b_range = function(passage, accum, context) { return this.range(passage, accum, context); }; bcv_passage.prototype.b_range_pre = function(passage, accum, context) { var book, end, ref, ref1, start_obj; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; book = this.pluck("b", passage.value); ref = this.b(book, [], context), (ref1 = ref[0], end = ref1[0]), context = ref[1]; if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } start_obj = { b: passage.value[0].value + end.passages[0].start.b.substr(1), type: "b" }; passage.passages = [ { start: start_obj, end: end.passages[0].end, valid: end.passages[0].valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.b_range_start = function(passage, accum, context) { return this.range(passage, accum, context); }; bcv_passage.prototype.base = function(passage, accum, context) { this.indices = this.calculate_indices(passage.match, passage.start_index); return this.handle_array(passage.value, accum, context); }; bcv_passage.prototype.bc = function(passage, accum, context) { var alternates, b, c, context_key, k, len, obj, ref, ref1, valid; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; this.reset_context(context, ["b", "c", "v"]); c = this.pluck("c", passage.value).value; alternates = []; ref = this.books[this.pluck("b", passage.value).value].parsed; for (k = 0, len = ref.length; k < len; k++) { b = ref[k]; context_key = "c"; valid = this.validate_ref(passage.start_context.translations, { b: b, c: c }); obj = { start: { b: b }, end: { b: b }, valid: valid }; if (valid.messages.start_chapter_not_exist_in_single_chapter_book || valid.messages.start_chapter_1) { obj.valid = this.validate_ref(passage.start_context.translations, { b: b, v: c }); if (valid.messages.start_chapter_not_exist_in_single_chapter_book) { obj.valid.messages.start_chapter_not_exist_in_single_chapter_book = 1; } obj.start.c = 1; obj.end.c = 1; context_key = "v"; } obj.start[context_key] = c; ref1 = this.fix_start_zeroes(obj.valid, obj.start.c, obj.start.v), obj.start.c = ref1[0], obj.start.v = ref1[1]; if (obj.start.v == null) { delete obj.start.v; } obj.end[context_key] = obj.start[context_key]; if (passage.passages.length === 0 && obj.valid.valid) { passage.passages.push(obj); } else { alternates.push(obj); } } if (passage.passages.length === 0) { passage.passages.push(alternates.shift()); } if (alternates.length > 0) { passage.passages[0].alternates = alternates; } if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } this.set_context_from_object(context, ["b", "c", "v"], passage.passages[0].start); accum.push(passage); return [accum, context]; }; bcv_passage.prototype.bc_title = function(passage, accum, context) { var bc, i, k, ref, ref1, ref2, title; passage.start_context = bcv_utils.shallow_clone(context); ref = this.bc(this.pluck("bc", passage.value), [], context), (ref1 = ref[0], bc = ref1[0]), context = ref[1]; if (bc.passages[0].start.b.substr(0, 2) !== "Ps" && (bc.passages[0].alternates != null)) { for (i = k = 0, ref2 = bc.passages[0].alternates.length; 0 <= ref2 ? k < ref2 : k > ref2; i = 0 <= ref2 ? ++k : --k) { if (bc.passages[0].alternates[i].start.b.substr(0, 2) !== "Ps") { continue; } bc.passages[0] = bc.passages[0].alternates[i]; break; } } if (bc.passages[0].start.b.substr(0, 2) !== "Ps") { accum.push(bc); return [accum, context]; } this.books[this.pluck("b", bc.value).value].parsed = ["Ps"]; title = this.pluck("title", passage.value); if (title == null) { title = this.pluck("v", passage.value); } passage.value[1] = { type: "v", value: [ { type: "integer", value: 1, indices: title.indices } ], indices: title.indices }; passage.type = "bcv"; return this.bcv(passage, accum, passage.start_context); }; bcv_passage.prototype.bcv = function(passage, accum, context) { var alternates, b, bc, c, k, len, obj, ref, ref1, v, valid; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; this.reset_context(context, ["b", "c", "v"]); bc = this.pluck("bc", passage.value); c = this.pluck("c", bc.value).value; v = this.pluck("v", passage.value).value; alternates = []; ref = this.books[this.pluck("b", bc.value).value].parsed; for (k = 0, len = ref.length; k < len; k++) { b = ref[k]; valid = this.validate_ref(passage.start_context.translations, { b: b, c: c, v: v }); ref1 = this.fix_start_zeroes(valid, c, v), c = ref1[0], v = ref1[1]; obj = { start: { b: b, c: c, v: v }, end: { b: b, c: c, v: v }, valid: valid }; if (passage.passages.length === 0 && valid.valid) { passage.passages.push(obj); } else { alternates.push(obj); } } if (passage.passages.length === 0) { passage.passages.push(alternates.shift()); } if (alternates.length > 0) { passage.passages[0].alternates = alternates; } if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } this.set_context_from_object(context, ["b", "c", "v"], passage.passages[0].start); accum.push(passage); return [accum, context]; }; bcv_passage.prototype.bv = function(passage, accum, context) { var b, bcv, ref, ref1, ref2, v; passage.start_context = bcv_utils.shallow_clone(context); ref = passage.value, b = ref[0], v = ref[1]; bcv = { indices: passage.indices, value: [ { type: "bc", value: [ b, { type: "c", value: [ { type: "integer", value: 1 } ] } ] }, v ] }; ref1 = this.bcv(bcv, [], context), (ref2 = ref1[0], bcv = ref2[0]), context = ref1[1]; passage.passages = bcv.passages; if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.c = function(passage, accum, context) { var c, valid; passage.start_context = bcv_utils.shallow_clone(context); c = passage.type === "integer" ? passage.value : this.pluck("integer", passage.value).value; valid = this.validate_ref(passage.start_context.translations, { b: context.b, c: c }); if (!valid.valid && valid.messages.start_chapter_not_exist_in_single_chapter_book) { return this.v(passage, accum, context); } c = this.fix_start_zeroes(valid, c)[0]; passage.passages = [ { start: { b: context.b, c: c }, end: { b: context.b, c: c }, valid: valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } accum.push(passage); context.c = c; this.reset_context(context, ["v"]); if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } return [accum, context]; }; bcv_passage.prototype.c_psalm = function(passage, accum, context) { var c; passage.type = "bc"; c = parseInt(this.books[passage.value].value.match(/^\d+/)[0], 10); passage.value = [ { type: "b", value: passage.value, indices: passage.indices }, { type: "c", value: [ { type: "integer", value: c, indices: passage.indices } ], indices: passage.indices } ]; return this.bc(passage, accum, context); }; bcv_passage.prototype.c_title = function(passage, accum, context) { var title; passage.start_context = bcv_utils.shallow_clone(context); if (context.b !== "Ps") { return this.c(passage.value[0], accum, context); } title = this.pluck("title", passage.value); passage.value[1] = { type: "v", value: [ { type: "integer", value: 1, indices: title.indices } ], indices: title.indices }; passage.type = "cv"; return this.cv(passage, accum, passage.start_context); }; bcv_passage.prototype.cv = function(passage, accum, context) { var c, ref, v, valid; passage.start_context = bcv_utils.shallow_clone(context); c = this.pluck("c", passage.value).value; v = this.pluck("v", passage.value).value; valid = this.validate_ref(passage.start_context.translations, { b: context.b, c: c, v: v }); ref = this.fix_start_zeroes(valid, c, v), c = ref[0], v = ref[1]; passage.passages = [ { start: { b: context.b, c: c, v: v }, end: { b: context.b, c: c, v: v }, valid: valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } accum.push(passage); context.c = c; context.v = v; if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } return [accum, context]; }; bcv_passage.prototype.cb_range = function(passage, accum, context) { var b, end_c, ref, start_c; passage.type = "range"; ref = passage.value, b = ref[0], start_c = ref[1], end_c = ref[2]; passage.value = [ { type: "bc", value: [b, start_c], indices: passage.indices }, end_c ]; end_c.indices[1] = passage.indices[1]; return this.range(passage, accum, context); }; bcv_passage.prototype.context = function(passage, accum, context) { var key, ref; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; ref = this.books[passage.value].context; for (key in ref) { if (!hasProp.call(ref, key)) continue; context[key] = this.books[passage.value].context[key]; } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.cv_psalm = function(passage, accum, context) { var bc, c_psalm, ref, v; passage.start_context = bcv_utils.shallow_clone(context); passage.type = "bcv"; ref = passage.value, c_psalm = ref[0], v = ref[1]; bc = this.c_psalm(c_psalm, [], passage.start_context)[0][0]; passage.value = [bc, v]; return this.bcv(passage, accum, context); }; bcv_passage.prototype.ff = function(passage, accum, context) { var ref, ref1; passage.start_context = bcv_utils.shallow_clone(context); passage.value.push({ type: "integer", indices: passage.indices, value: 999 }); ref = this.range(passage, [], passage.start_context), (ref1 = ref[0], passage = ref1[0]), context = ref[1]; passage.value[0].indices = passage.value[1].indices; passage.value[0].absolute_indices = passage.value[1].absolute_indices; passage.value.pop(); if (passage.passages[0].valid.messages.end_verse_not_exist != null) { delete passage.passages[0].valid.messages.end_verse_not_exist; } if (passage.passages[0].valid.messages.end_chapter_not_exist != null) { delete passage.passages[0].valid.messages.end_chapter_not_exist; } if (passage.passages[0].end.original_c != null) { delete passage.passages[0].end.original_c; } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.integer_title = function(passage, accum, context) { passage.start_context = bcv_utils.shallow_clone(context); if (context.b !== "Ps") { return this.integer(passage.value[0], accum, context); } passage.value[0] = { type: "c", value: [passage.value[0]], indices: [passage.value[0].indices[0], passage.value[0].indices[1]] }; passage.value[1].type = "v"; passage.value[1].original_type = "title"; passage.value[1].value = [ { type: "integer", value: 1, indices: passage.value[1].value.indices } ]; passage.type = "cv"; return this.cv(passage, accum, passage.start_context); }; bcv_passage.prototype.integer = function(passage, accum, context) { if (context.v != null) { return this.v(passage, accum, context); } return this.c(passage, accum, context); }; bcv_passage.prototype.next_v = function(passage, accum, context) { var prev_integer, psg, ref, ref1, ref2, ref3; passage.start_context = bcv_utils.shallow_clone(context); prev_integer = this.pluck_last_recursively("integer", passage.value); if (prev_integer == null) { prev_integer = { value: 1 }; } passage.value.push({ type: "integer", indices: passage.indices, value: prev_integer.value + 1 }); ref = this.range(passage, [], passage.start_context), (ref1 = ref[0], psg = ref1[0]), context = ref[1]; if ((psg.passages[0].valid.messages.end_verse_not_exist != null) && (psg.passages[0].valid.messages.start_verse_not_exist == null) && (psg.passages[0].valid.messages.start_chapter_not_exist == null) && (context.c != null)) { passage.value.pop(); passage.value.push({ type: "cv", indices: passage.indices, value: [ { type: "c", value: [ { type: "integer", value: context.c + 1, indices: passage.indices } ], indices: passage.indices }, { type: "v", value: [ { type: "integer", value: 1, indices: passage.indices } ], indices: passage.indices } ] }); ref2 = this.range(passage, [], passage.start_context), (ref3 = ref2[0], psg = ref3[0]), context = ref2[1]; } psg.value[0].indices = psg.value[1].indices; psg.value[0].absolute_indices = psg.value[1].absolute_indices; psg.value.pop(); if (psg.passages[0].valid.messages.end_verse_not_exist != null) { delete psg.passages[0].valid.messages.end_verse_not_exist; } if (psg.passages[0].valid.messages.end_chapter_not_exist != null) { delete psg.passages[0].valid.messages.end_chapter_not_exist; } if (psg.passages[0].end.original_c != null) { delete psg.passages[0].end.original_c; } accum.push(psg); return [accum, context]; }; bcv_passage.prototype.sequence = function(passage, accum, context) { var k, l, len, len1, obj, psg, ref, ref1, ref2, ref3, sub_psg; passage.start_context = bcv_utils.shallow_clone(context); passage.passages = []; ref = passage.value; for (k = 0, len = ref.length; k < len; k++) { obj = ref[k]; ref1 = this.handle_array(obj, [], context), (ref2 = ref1[0], psg = ref2[0]), context = ref1[1]; ref3 = psg.passages; for (l = 0, len1 = ref3.length; l < len1; l++) { sub_psg = ref3[l]; if (sub_psg.type == null) { sub_psg.type = psg.type; } if (sub_psg.absolute_indices == null) { sub_psg.absolute_indices = psg.absolute_indices; } if (psg.start_context.translations != null) { sub_psg.translations = psg.start_context.translations; } sub_psg.enclosed_absolute_indices = psg.type === "sequence_post_enclosed" ? psg.absolute_indices : [-1, -1]; passage.passages.push(sub_psg); } } if (passage.absolute_indices == null) { if (passage.passages.length > 0 && passage.type === "sequence") { passage.absolute_indices = [passage.passages[0].absolute_indices[0], passage.passages[passage.passages.length - 1].absolute_indices[1]]; } else { passage.absolute_indices = this.get_absolute_indices(passage.indices); } } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.sequence_post_enclosed = function(passage, accum, context) { return this.sequence(passage, accum, context); }; bcv_passage.prototype.v = function(passage, accum, context) { var c, no_c, ref, v, valid; v = passage.type === "integer" ? passage.value : this.pluck("integer", passage.value).value; passage.start_context = bcv_utils.shallow_clone(context); c = context.c != null ? context.c : 1; valid = this.validate_ref(passage.start_context.translations, { b: context.b, c: c, v: v }); ref = this.fix_start_zeroes(valid, 0, v), no_c = ref[0], v = ref[1]; passage.passages = [ { start: { b: context.b, c: c, v: v }, end: { b: context.b, c: c, v: v }, valid: valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } accum.push(passage); context.v = v; return [accum, context]; }; bcv_passage.prototype.range = function(passage, accum, context) { var end, end_obj, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, return_now, return_value, start, start_obj, valid; passage.start_context = bcv_utils.shallow_clone(context); ref = passage.value, start = ref[0], end = ref[1]; ref1 = this.handle_obj(start, [], context), (ref2 = ref1[0], start = ref2[0]), context = ref1[1]; if (end.type === "v" && ((start.type === "bc" && !((ref3 = start.passages) != null ? (ref4 = ref3[0]) != null ? (ref5 = ref4.valid) != null ? (ref6 = ref5.messages) != null ? ref6.start_chapter_not_exist_in_single_chapter_book : void 0 : void 0 : void 0 : void 0)) || start.type === "c") && this.options.end_range_digits_strategy === "verse") { passage.value[0] = start; return this.range_change_integer_end(passage, accum); } ref7 = this.handle_obj(end, [], context), (ref8 = ref7[0], end = ref8[0]), context = ref7[1]; passage.value = [start, end]; passage.indices = [start.indices[0], end.indices[1]]; delete passage.absolute_indices; start_obj = { b: start.passages[0].start.b, c: start.passages[0].start.c, v: start.passages[0].start.v, type: start.type }; end_obj = { b: end.passages[0].end.b, c: end.passages[0].end.c, v: end.passages[0].end.v, type: end.type }; if (end.passages[0].valid.messages.start_chapter_is_zero) { end_obj.c = 0; } if (end.passages[0].valid.messages.start_verse_is_zero) { end_obj.v = 0; } valid = this.validate_ref(passage.start_context.translations, start_obj, end_obj); if (valid.valid) { ref9 = this.range_handle_valid(valid, passage, start, start_obj, end, end_obj, accum), return_now = ref9[0], return_value = ref9[1]; if (return_now) { return return_value; } } else { return this.range_handle_invalid(valid, passage, start, start_obj, end, end_obj, accum); } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } passage.passages = [ { start: start_obj, end: end_obj, valid: valid } ]; if (passage.start_context.translations != null) { passage.passages[0].translations = passage.start_context.translations; } if (start_obj.type === "b") { if (end_obj.type === "b") { passage.type = "b_range"; } else { passage.type = "b_range_start"; } } else if (end_obj.type === "b") { passage.type = "range_end_b"; } accum.push(passage); return [accum, context]; }; bcv_passage.prototype.range_change_end = function(passage, accum, new_end) { var end, new_obj, ref, start; ref = passage.value, start = ref[0], end = ref[1]; if (end.type === "integer") { end.original_value = end.value; end.value = new_end; } else if (end.type === "v") { new_obj = this.pluck("integer", end.value); new_obj.original_value = new_obj.value; new_obj.value = new_end; } else if (end.type === "cv") { new_obj = this.pluck("c", end.value); new_obj.original_value = new_obj.value; new_obj.value = new_end; } return this.handle_obj(passage, accum, passage.start_context); }; bcv_passage.prototype.range_change_integer_end = function(passage, accum) { var end, ref, start; ref = passage.value, start = ref[0], end = ref[1]; if (passage.original_type == null) { passage.original_type = passage.type; } if (passage.original_value == null) { passage.original_value = [start, end]; } passage.type = start.type === "integer" ? "cv" : start.type + "v"; if (start.type === "integer") { passage.value[0] = { type: "c", value: [start], indices: start.indices }; } if (end.type === "integer") { passage.value[1] = { type: "v", value: [end], indices: end.indices }; } return this.handle_obj(passage, accum, passage.start_context); }; bcv_passage.prototype.range_check_new_end = function(translations, start_obj, end_obj, valid) { var new_end, new_valid, obj_to_validate, type; new_end = 0; type = null; if (valid.messages.end_chapter_before_start) { type = "c"; } else if (valid.messages.end_verse_before_start) { type = "v"; } if (type != null) { new_end = this.range_get_new_end_value(start_obj, end_obj, valid, type); } if (new_end > 0) { obj_to_validate = { b: end_obj.b, c: end_obj.c, v: end_obj.v }; obj_to_validate[type] = new_end; new_valid = this.validate_ref(translations, obj_to_validate); if (!new_valid.valid) { new_end = 0; } } return new_end; }; bcv_passage.prototype.range_end_b = function(passage, accum, context) { return this.range(passage, accum, context); }; bcv_passage.prototype.range_get_new_end_value = function(start_obj, end_obj, valid, key) { var new_end; new_end = 0; if ((key === "c" && valid.messages.end_chapter_is_zero) || (key === "v" && valid.messages.end_verse_is_zero)) { return new_end; } if (start_obj[key] >= 10 && end_obj[key] < 10 && start_obj[key] - 10 * Math.floor(start_obj[key] / 10) < end_obj[key]) { new_end = end_obj[key] + 10 * Math.floor(start_obj[key] / 10); } else if (start_obj[key] >= 100 && end_obj[key] < 100 && start_obj[key] - 100 < end_obj[key]) { new_end = end_obj[key] + 100; } return new_end; }; bcv_passage.prototype.range_handle_invalid = function(valid, passage, start, start_obj, end, end_obj, accum) { var new_end, ref, temp_valid, temp_value; if (valid.valid === false && (valid.messages.end_chapter_before_start || valid.messages.end_verse_before_start) && (end.type === "integer" || end.type === "v") || (valid.valid === false && valid.messages.end_chapter_before_start && end.type === "cv")) { new_end = this.range_check_new_end(passage.start_context.translations, start_obj, end_obj, valid); if (new_end > 0) { return this.range_change_end(passage, accum, new_end); } } if (this.options.end_range_digits_strategy === "verse" && (start_obj.v == null) && (end.type === "integer" || end.type === "v")) { temp_value = end.type === "v" ? this.pluck("integer", end.value) : end.value; temp_valid = this.validate_ref(passage.start_context.translations, { b: start_obj.b, c: start_obj.c, v: temp_value }); if (temp_valid.valid) { return this.range_change_integer_end(passage, accum); } } if (passage.original_type == null) { passage.original_type = passage.type; } passage.type = "sequence"; ref = [[start, end], [[start], [end]]], passage.original_value = ref[0], passage.value = ref[1]; return this.sequence(passage, accum, passage.start_context); }; bcv_passage.prototype.range_handle_valid = function(valid, passage, start, start_obj, end, end_obj, accum) { var temp_valid, temp_value; if (valid.messages.end_chapter_not_exist && this.options.end_range_digits_strategy === "verse" && (start_obj.v == null) && (end.type === "integer" || end.type === "v") && this.options.passage_existence_strategy.indexOf("v") >= 0) { temp_value = end.type === "v" ? this.pluck("integer", end.value) : end.value; temp_valid = this.validate_ref(passage.start_context.translations, { b: start_obj.b, c: start_obj.c, v: temp_value }); if (temp_valid.valid) { return [true, this.range_change_integer_end(passage, accum)]; } } this.range_validate(valid, start_obj, end_obj, passage); return [false, null]; }; bcv_passage.prototype.range_validate = function(valid, start_obj, end_obj, passage) { var ref; if (valid.messages.end_chapter_not_exist || valid.messages.end_chapter_not_exist_in_single_chapter_book) { end_obj.original_c = end_obj.c; end_obj.c = valid.messages.end_chapter_not_exist ? valid.messages.end_chapter_not_exist : valid.messages.end_chapter_not_exist_in_single_chapter_book; if (end_obj.v != null) { end_obj.v = this.validate_ref(passage.start_context.translations, { b: end_obj.b, c: end_obj.c, v: 999 }).messages.end_verse_not_exist; delete valid.messages.end_verse_is_zero; } } else if (valid.messages.end_verse_not_exist) { end_obj.original_v = end_obj.v; end_obj.v = valid.messages.end_verse_not_exist; } if (valid.messages.end_verse_is_zero && this.options.zero_verse_strategy !== "allow") { end_obj.v = valid.messages.end_verse_is_zero; } if (valid.messages.end_chapter_is_zero) { end_obj.c = valid.messages.end_chapter_is_zero; } ref = this.fix_start_zeroes(valid, start_obj.c, start_obj.v), start_obj.c = ref[0], start_obj.v = ref[1]; return true; }; bcv_passage.prototype.translation_sequence = function(passage, accum, context) { var k, l, len, len1, ref, translation, translations, val; passage.start_context = bcv_utils.shallow_clone(context); translations = []; translations.push({ translation: this.books[passage.value[0].value].parsed }); ref = passage.value[1]; for (k = 0, len = ref.length; k < len; k++) { val = ref[k]; val = this.books[this.pluck("translation", val).value].parsed; if (val != null) { translations.push({ translation: val }); } } for (l = 0, len1 = translations.length; l < len1; l++) { translation = translations[l]; if (this.translations.aliases[translation.translation] != null) { translation.alias = this.translations.aliases[translation.translation].alias; translation.osis = this.translations.aliases[translation.translation].osis || translation.translation.toUpperCase(); } else { translation.alias = "default"; translation.osis = translation.translation.toUpperCase(); } } if (accum.length > 0) { context = this.translation_sequence_apply(accum, translations); } if (passage.absolute_indices == null) { passage.absolute_indices = this.get_absolute_indices(passage.indices); } accum.push(passage); this.reset_context(context, ["translations"]); return [accum, context]; }; bcv_passage.prototype.translation_sequence_apply = function(accum, translations) { var context, i, k, new_accum, ref, ref1, use_i; use_i = 0; for (i = k = ref = accum.length - 1; ref <= 0 ? k <= 0 : k >= 0; i = ref <= 0 ? ++k : --k) { if (accum[i].original_type != null) { accum[i].type = accum[i].original_type; } if (accum[i].original_value != null) { accum[i].value = accum[i].original_value; } if (accum[i].type !== "translation_sequence") { continue; } use_i = i + 1; break; } if (use_i < accum.length) { accum[use_i].start_context.translations = translations; ref1 = this.handle_array(accum.slice(use_i), [], accum[use_i].start_context), new_accum = ref1[0], context = ref1[1]; } else { context = bcv_utils.shallow_clone(accum[accum.length - 1].start_context); } return context; }; bcv_passage.prototype.pluck = function(type, passages) { var k, len, passage; for (k = 0, len = passages.length; k < len; k++) { passage = passages[k]; if (!((passage != null) && (passage.type != null) && passage.type === type)) { continue; } if (type === "c" || type === "v") { return this.pluck("integer", passage.value); } return passage; } return null; }; bcv_passage.prototype.pluck_last_recursively = function(type, passages) { var k, passage, value; for (k = passages.length - 1; k >= 0; k += -1) { passage = passages[k]; if (!((passage != null) && (passage.type != null))) { continue; } if (passage.type === type) { return this.pluck(type, [passage]); } value = this.pluck_last_recursively(type, passage.value); if (value != null) { return value; } } return null; }; bcv_passage.prototype.set_context_from_object = function(context, keys, obj) { var k, len, results, type; results = []; for (k = 0, len = keys.length; k < len; k++) { type = keys[k]; if (obj[type] == null) { continue; } results.push(context[type] = obj[type]); } return results; }; bcv_passage.prototype.reset_context = function(context, keys) { var k, len, results, type; results = []; for (k = 0, len = keys.length; k < len; k++) { type = keys[k]; results.push(delete context[type]); } return results; }; bcv_passage.prototype.fix_start_zeroes = function(valid, c, v) { if (valid.messages.start_chapter_is_zero && this.options.zero_chapter_strategy === "upgrade") { c = valid.messages.start_chapter_is_zero; } if (valid.messages.start_verse_is_zero && this.options.zero_verse_strategy === "upgrade") { v = valid.messages.start_verse_is_zero; } return [c, v]; }; bcv_passage.prototype.calculate_indices = function(match, adjust) { var character, end_index, indices, k, l, len, len1, len2, m, match_index, part, part_length, parts, ref, switch_type, temp; switch_type = "book"; indices = []; match_index = 0; adjust = parseInt(adjust, 10); parts = [match]; ref = ["\x1e", "\x1f"]; for (k = 0, len = ref.length; k < len; k++) { character = ref[k]; temp = []; for (l = 0, len1 = parts.length; l < len1; l++) { part = parts[l]; temp = temp.concat(part.split(character)); } parts = temp; } for (m = 0, len2 = parts.length; m < len2; m++) { part = parts[m]; switch_type = switch_type === "book" ? "rest" : "book"; part_length = part.length; if (part_length === 0) { continue; } if (switch_type === "book") { part = part.replace(/\/\d+$/, ""); end_index = match_index + part_length; if (indices.length > 0 && indices[indices.length - 1].index === adjust) { indices[indices.length - 1].end = end_index; } else { indices.push({ start: match_index, end: end_index, index: adjust }); } match_index += part_length + 2; adjust = this.books[part].start_index + this.books[part].value.length - match_index; indices.push({ start: end_index + 1, end: end_index + 1, index: adjust }); } else { end_index = match_index + part_length - 1; if (indices.length > 0 && indices[indices.length - 1].index === adjust) { indices[indices.length - 1].end = end_index; } else { indices.push({ start: match_index, end: end_index, index: adjust }); } match_index += part_length; } } return indices; }; bcv_passage.prototype.get_absolute_indices = function(arg1) { var end, end_out, index, k, len, ref, start, start_out; start = arg1[0], end = arg1[1]; start_out = null; end_out = null; ref = this.indices; for (k = 0, len = ref.length; k < len; k++) { index = ref[k]; if (start_out === null && (index.start <= start && start <= index.end)) { start_out = start + index.index; } if ((index.start <= end && end <= index.end)) { end_out = end + index.index + 1; break; } } return [start_out, end_out]; }; bcv_passage.prototype.validate_ref = function(translations, start, end) { var k, len, messages, temp_valid, translation, valid; if (!((translations != null) && translations.length > 0)) { translations = [ { translation: "default", osis: "", alias: "default" } ]; } valid = false; messages = {}; for (k = 0, len = translations.length; k < len; k++) { translation = translations[k]; if (translation.alias == null) { translation.alias = "default"; } if (translation.alias == null) { if (messages.translation_invalid == null) { messages.translation_invalid = []; } messages.translation_invalid.push(translation); continue; } if (this.translations.aliases[translation.alias] == null) { translation.alias = "default"; if (messages.translation_unknown == null) { messages.translation_unknown = []; } messages.translation_unknown.push(translation); } temp_valid = this.validate_start_ref(translation.alias, start, messages)[0]; if (end) { temp_valid = this.validate_end_ref(translation.alias, start, end, temp_valid, messages)[0]; } if (temp_valid === true) { valid = true; } } return { valid: valid, messages: messages }; }; bcv_passage.prototype.validate_start_ref = function(translation, start, messages) { var ref, ref1, translation_order, valid; valid = true; if (translation !== "default" && (((ref = this.translations[translation]) != null ? ref.chapters[start.b] : void 0) == null)) { this.promote_book_to_translation(start.b, translation); } translation_order = ((ref1 = this.translations[translation]) != null ? ref1.order : void 0) != null ? translation : "default"; if (start.v != null) { start.v = parseInt(start.v, 10); } if (this.translations[translation_order].order[start.b] != null) { if (start.c == null) { start.c = 1; } start.c = parseInt(start.c, 10); if (isNaN(start.c)) { valid = false; messages.start_chapter_not_numeric = true; return [valid, messages]; } if (start.c === 0) { messages.start_chapter_is_zero = 1; if (this.options.zero_chapter_strategy === "error") { valid = false; } else { start.c = 1; } } if ((start.v != null) && start.v === 0) { messages.start_verse_is_zero = 1; if (this.options.zero_verse_strategy === "error") { valid = false; } else if (this.options.zero_verse_strategy === "upgrade") { start.v = 1; } } if (start.c > 0 && (this.translations[translation].chapters[start.b][start.c - 1] != null)) { if (start.v != null) { if (isNaN(start.v)) { valid = false; messages.start_verse_not_numeric = true; } else if (start.v > this.translations[translation].chapters[start.b][start.c - 1]) { if (this.options.passage_existence_strategy.indexOf("v") >= 0) { valid = false; messages.start_verse_not_exist = this.translations[translation].chapters[start.b][start.c - 1]; } } } else if (start.c === 1 && this.options.single_chapter_1_strategy === "verse" && this.translations[translation].chapters[start.b].length === 1) { messages.start_chapter_1 = 1; } } else { if (start.c !== 1 && this.translations[translation].chapters[start.b].length === 1) { valid = false; messages.start_chapter_not_exist_in_single_chapter_book = 1; } else if (start.c > 0 && this.options.passage_existence_strategy.indexOf("c") >= 0) { valid = false; messages.start_chapter_not_exist = this.translations[translation].chapters[start.b].length; } } } else if (start.b == null) { valid = false; messages.start_book_not_defined = true; } else { if (this.options.passage_existence_strategy.indexOf("b") >= 0) { valid = false; } messages.start_book_not_exist = true; } return [valid, messages]; }; bcv_passage.prototype.validate_end_ref = function(translation, start, end, valid, messages) { var ref, translation_order; translation_order = ((ref = this.translations[translation]) != null ? ref.order : void 0) != null ? translation : "default"; if (end.c != null) { end.c = parseInt(end.c, 10); if (isNaN(end.c)) { valid = false; messages.end_chapter_not_numeric = true; } else if (end.c === 0) { messages.end_chapter_is_zero = 1; if (this.options.zero_chapter_strategy === "error") { valid = false; } else { end.c = 1; } } } if (end.v != null) { end.v = parseInt(end.v, 10); if (isNaN(end.v)) { valid = false; messages.end_verse_not_numeric = true; } else if (end.v === 0) { messages.end_verse_is_zero = 1; if (this.options.zero_verse_strategy === "error") { valid = false; } else if (this.options.zero_verse_strategy === "upgrade") { end.v = 1; } } } if (this.translations[translation_order].order[end.b] != null) { if ((end.c == null) && this.translations[translation].chapters[end.b].length === 1) { end.c = 1; } if ((this.translations[translation_order].order[start.b] != null) && this.translations[translation_order].order[start.b] > this.translations[translation_order].order[end.b]) { if (this.options.passage_existence_strategy.indexOf("b") >= 0) { valid = false; } messages.end_book_before_start = true; } if (start.b === end.b && (end.c != null) && !isNaN(end.c)) { if (start.c == null) { start.c = 1; } if (!isNaN(parseInt(start.c, 10)) && start.c > end.c) { valid = false; messages.end_chapter_before_start = true; } else if (start.c === end.c && (end.v != null) && !isNaN(end.v)) { if (start.v == null) { start.v = 1; } if (!isNaN(parseInt(start.v, 10)) && start.v > end.v) { valid = false; messages.end_verse_before_start = true; } } } if ((end.c != null) && !isNaN(end.c)) { if (this.translations[translation].chapters[end.b][end.c - 1] == null) { if (this.translations[translation].chapters[end.b].length === 1) { messages.end_chapter_not_exist_in_single_chapter_book = 1; } else if (end.c > 0 && this.options.passage_existence_strategy.indexOf("c") >= 0) { messages.end_chapter_not_exist = this.translations[translation].chapters[end.b].length; } } } if ((end.v != null) && !isNaN(end.v)) { if (end.c == null) { end.c = this.translations[translation].chapters[end.b].length; } if (end.v > this.translations[translation].chapters[end.b][end.c - 1] && this.options.passage_existence_strategy.indexOf("v") >= 0) { messages.end_verse_not_exist = this.translations[translation].chapters[end.b][end.c - 1]; } } } else { valid = false; messages.end_book_not_exist = true; } return [valid, messages]; }; bcv_passage.prototype.promote_book_to_translation = function(book, translation) { var base, base1; if ((base = this.translations)[translation] == null) { base[translation] = {}; } if ((base1 = this.translations[translation]).chapters == null) { base1.chapters = {}; } if (this.translations[translation].chapters[book] == null) { return this.translations[translation].chapters[book] = bcv_utils.shallow_clone_array(this.translations["default"].chapters[book]); } }; return bcv_passage; })(); bcv_utils = { shallow_clone: function(obj) { var key, out, val; if (obj == null) { return obj; } out = {}; for (key in obj) { if (!hasProp.call(obj, key)) continue; val = obj[key]; out[key] = val; } return out; }, shallow_clone_array: function(arr) { var i, k, out, ref; if (arr == null) { return arr; } out = []; for (i = k = 0, ref = arr.length; 0 <= ref ? k <= ref : k >= ref; i = 0 <= ref ? ++k : --k) { if (typeof arr[i] !== "undefined") { out[i] = arr[i]; } } return out; } }; bcv_parser.prototype.regexps.translations = /(?:(?:ERV))\b/gi; bcv_parser.prototype.translations = { aliases: { "default": { osis: "", alias: "default" } }, alternates: {}, "default": { order: { "Gen": 1, "Exod": 2, "Lev": 3, "Num": 4, "Deut": 5, "Josh": 6, "Judg": 7, "Ruth": 8, "1Sam": 9, "2Sam": 10, "1Kgs": 11, "2Kgs": 12, "1Chr": 13, "2Chr": 14, "Ezra": 15, "Neh": 16, "Esth": 17, "Job": 18, "Ps": 19, "Prov": 20, "Eccl": 21, "Song": 22, "Isa": 23, "Jer": 24, "Lam": 25, "Ezek": 26, "Dan": 27, "Hos": 28, "Joel": 29, "Amos": 30, "Obad": 31, "Jonah": 32, "Mic": 33, "Nah": 34, "Hab": 35, "Zeph": 36, "Hag": 37, "Zech": 38, "Mal": 39, "Matt": 40, "Mark": 41, "Luke": 42, "John": 43, "Acts": 44, "Rom": 45, "1Cor": 46, "2Cor": 47, "Gal": 48, "Eph": 49, "Phil": 50, "Col": 51, "1Thess": 52, "2Thess": 53, "1Tim": 54, "2Tim": 55, "Titus": 56, "Phlm": 57, "Heb": 58, "Jas": 59, "1Pet": 60, "2Pet": 61, "1John": 62, "2John": 63, "3John": 64, "Jude": 65, "Rev": 66, "Tob": 67, "Jdt": 68, "GkEsth": 69, "Wis": 70, "Sir": 71, "Bar": 72, "PrAzar": 73, "Sus": 74, "Bel": 75, "SgThree": 76, "EpJer": 77, "1Macc": 78, "2Macc": 79, "3Macc": 80, "4Macc": 81, "1Esd": 82, "2Esd": 83, "PrMan": 84 }, chapters: { "Gen": [31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26], "Exod": [22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38], "Lev": [17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34], "Num": [54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 50, 13, 32, 22, 29, 35, 41, 30, 25, 18, 65, 23, 31, 40, 16, 54, 42, 56, 29, 34, 13], "Deut": [46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 32, 18, 29, 23, 22, 20, 22, 21, 20, 23, 30, 25, 22, 19, 19, 26, 68, 29, 20, 30, 52, 29, 12], "Josh": [18, 24, 17, 24, 15, 27, 26, 35, 27, 43, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 45, 34, 16, 33], "Judg": [36, 23, 31, 24, 31, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 25], "Ruth": [22, 23, 18, 22], "1Sam": [28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 42, 15, 23, 29, 22, 44, 25, 12, 25, 11, 31, 13], "2Sam": [27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 33, 43, 26, 22, 51, 39, 25], "1Kgs": [53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 53], "2Kgs": [18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 21, 21, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30], "1Chr": [54, 55, 24, 43, 26, 81, 40, 40, 44, 14, 47, 40, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31, 32, 34, 21, 30], "2Chr": [17, 18, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 22, 15, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27, 28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23], "Ezra": [11, 70, 13, 24, 17, 22, 28, 36, 15, 44], "Neh": [11, 20, 32, 23, 19, 19, 73, 18, 38, 39, 36, 47, 31], "Esth": [22, 23, 15, 17, 14, 14, 10, 17, 32, 3], "Job": [22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29, 29, 34, 30, 17, 25, 6, 14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 30, 24, 34, 17], "Ps": [6, 12, 8, 8, 12, 10, 17, 9, 20, 18, 7, 8, 6, 7, 5, 11, 15, 50, 14, 9, 13, 31, 6, 10, 22, 12, 14, 9, 11, 12, 24, 11, 22, 22, 28, 12, 40, 22, 13, 17, 13, 11, 5, 26, 17, 11, 9, 14, 20, 23, 19, 9, 6, 7, 23, 13, 11, 11, 17, 12, 8, 12, 11, 10, 13, 20, 7, 35, 36, 5, 24, 20, 28, 23, 10, 12, 20, 72, 13, 19, 16, 8, 18, 12, 13, 17, 7, 18, 52, 17, 16, 15, 5, 23, 11, 13, 12, 9, 9, 5, 8, 28, 22, 35, 45, 48, 43, 13, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 13, 10, 7, 12, 15, 21, 10, 20, 14, 9, 6], "Prov": [33, 22, 35, 27, 23, 35, 27, 36, 18, 32, 31, 28, 25, 35, 33, 33, 28, 24, 29, 30, 31, 29, 35, 34, 28, 28, 27, 28, 27, 33, 31], "Eccl": [18, 26, 22, 16, 20, 12, 29, 17, 18, 20, 10, 14], "Song": [17, 17, 11, 16, 16, 13, 13, 14], "Isa": [31, 22, 26, 6, 30, 13, 25, 22, 21, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 12, 25, 24], "Jer": [19, 37, 25, 31, 31, 30, 34, 22, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10, 38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46, 64, 34], "Lam": [22, 22, 66, 22, 22], "Ezek": [28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 49, 32, 31, 49, 27, 17, 21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35], "Dan": [21, 49, 30, 37, 31, 28, 28, 27, 27, 21, 45, 13], "Hos": [11, 23, 5, 19, 15, 11, 16, 14, 17, 15, 12, 14, 16, 9], "Joel": [20, 32, 21], "Amos": [15, 16, 15, 13, 27, 14, 17, 14, 15], "Obad": [21], "Jonah": [17, 10, 10, 11], "Mic": [16, 13, 12, 13, 15, 16, 20], "Nah": [15, 13, 19], "Hab": [17, 20, 19], "Zeph": [18, 15, 20], "Hag": [15, 23], "Zech": [21, 13, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21], "Mal": [14, 17, 18, 6], "Matt": [25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 27, 35, 30, 34, 46, 46, 39, 51, 46, 75, 66, 20], "Mark": [45, 28, 35, 41, 43, 56, 37, 38, 50, 52, 33, 44, 37, 72, 47, 20], "Luke": [80, 52, 38, 44, 39, 49, 50, 56, 62, 42, 54, 59, 35, 35, 32, 31, 37, 43, 48, 47, 38, 71, 56, 53], "John": [51, 25, 36, 54, 47, 71, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42, 31, 25], "Acts": [26, 47, 26, 37, 42, 15, 60, 40, 43, 48, 30, 25, 52, 28, 41, 40, 34, 28, 41, 38, 40, 30, 35, 27, 27, 32, 44, 31], "Rom": [32, 29, 31, 25, 21, 23, 25, 39, 33, 21, 36, 21, 14, 23, 33, 27], "1Cor": [31, 16, 23, 21, 13, 20, 40, 13, 27, 33, 34, 31, 13, 40, 58, 24], "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 14], "Gal": [24, 21, 29, 31, 26, 18], "Eph": [23, 22, 21, 32, 33, 24], "Phil": [30, 30, 21, 23], "Col": [29, 23, 25, 18], "1Thess": [10, 20, 13, 18, 28], "2Thess": [12, 17, 18], "1Tim": [20, 15, 16, 16, 25, 21], "2Tim": [18, 26, 17, 22], "Titus": [16, 15, 15], "Phlm": [25], "Heb": [14, 18, 19, 16, 14, 20, 28, 13, 28, 39, 40, 29, 25], "Jas": [27, 26, 18, 17, 20], "1Pet": [25, 25, 22, 19, 14], "2Pet": [21, 22, 18], "1John": [10, 29, 24, 21, 21], "2John": [13], "3John": [15], "Jude": [25], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 17, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21], "Tob": [22, 14, 17, 21, 22, 18, 16, 21, 6, 13, 18, 22, 17, 15], "Jdt": [16, 28, 10, 15, 24, 21, 32, 36, 14, 23, 23, 20, 20, 19, 14, 25], "GkEsth": [22, 23, 15, 17, 14, 14, 10, 17, 32, 13, 12, 6, 18, 19, 16, 24], "Wis": [16, 24, 19, 20, 23, 25, 30, 21, 18, 21, 26, 27, 19, 31, 19, 29, 21, 25, 22], "Sir": [30, 18, 31, 31, 15, 37, 36, 19, 18, 31, 34, 18, 26, 27, 20, 30, 32, 33, 30, 31, 28, 27, 27, 34, 26, 29, 30, 26, 28, 25, 31, 24, 33, 31, 26, 31, 31, 34, 35, 30, 22, 25, 33, 23, 26, 20, 25, 25, 16, 29, 30], "Bar": [22, 35, 37, 37, 9], "PrAzar": [68], "Sus": [64], "Bel": [42], "SgThree": [39], "EpJer": [73], "1Macc": [64, 70, 60, 61, 68, 63, 50, 32, 73, 89, 74, 53, 53, 49, 41, 24], "2Macc": [36, 32, 40, 50, 27, 31, 42, 36, 29, 38, 38, 45, 26, 46, 39], "3Macc": [29, 33, 30, 21, 51, 41, 23], "4Macc": [35, 24, 21, 26, 38, 35, 23, 29, 32, 21, 27, 19, 27, 20, 32, 25, 24, 24], "1Esd": [58, 30, 24, 63, 73, 34, 15, 96, 55], "2Esd": [40, 48, 36, 52, 56, 59, 70, 63, 47, 59, 46, 51, 58, 48, 63, 78], "PrMan": [15], "Ps151": [7] } }, vulgate: { chapters: { "Gen": [31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 55, 32, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 32, 25], "Exod": [22, 25, 22, 31, 23, 30, 25, 32, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 36, 31, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 36], "Lev": [17, 16, 17, 35, 19, 30, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 45, 34], "Num": [54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 34, 15, 34, 45, 41, 50, 13, 32, 22, 30, 35, 41, 30, 25, 18, 65, 23, 31, 39, 17, 54, 42, 56, 29, 34, 13], "Josh": [18, 24, 17, 25, 16, 27, 26, 35, 27, 44, 23, 24, 33, 15, 63, 10, 18, 28, 51, 9, 43, 34, 16, 33], "Judg": [36, 23, 31, 24, 32, 40, 25, 35, 57, 18, 40, 15, 25, 20, 20, 31, 13, 31, 30, 48, 24], "1Sam": [28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 43, 15, 23, 28, 23, 44, 25, 12, 25, 11, 31, 13], "1Kgs": [53, 46, 28, 34, 18, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 54], "1Chr": [54, 55, 24, 43, 26, 81, 40, 40, 44, 14, 46, 40, 14, 17, 29, 43, 27, 17, 19, 7, 30, 19, 32, 31, 31, 32, 34, 21, 30], "Neh": [11, 20, 31, 23, 19, 19, 73, 18, 38, 39, 36, 46, 31], "Job": [22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 23, 16, 21, 29, 29, 34, 30, 17, 25, 6, 14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 35, 28, 25, 16], "Ps": [6, 13, 9, 10, 13, 11, 18, 10, 39, 8, 9, 6, 7, 5, 10, 15, 51, 15, 10, 14, 32, 6, 10, 22, 12, 14, 9, 11, 13, 25, 11, 22, 23, 28, 13, 40, 23, 14, 18, 14, 12, 5, 26, 18, 12, 10, 15, 21, 23, 21, 11, 7, 9, 24, 13, 12, 12, 18, 14, 9, 13, 12, 11, 14, 20, 8, 36, 37, 6, 24, 20, 28, 23, 11, 13, 21, 72, 13, 20, 17, 8, 19, 13, 14, 17, 7, 19, 53, 17, 16, 16, 5, 23, 11, 13, 12, 9, 9, 5, 8, 29, 22, 35, 45, 48, 43, 14, 31, 7, 10, 10, 9, 26, 9, 10, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 14, 10, 8, 12, 15, 21, 10, 11, 9, 14, 9, 6], "Eccl": [18, 26, 22, 17, 19, 11, 30, 17, 18, 20, 10, 14], "Song": [16, 17, 11, 16, 17, 12, 13, 14], "Jer": [19, 37, 25, 31, 31, 30, 34, 22, 26, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10, 38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 20, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46, 64, 34], "Ezek": [28, 9, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 49, 32, 31, 49, 27, 17, 21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35], "Dan": [21, 49, 100, 34, 31, 28, 28, 27, 27, 21, 45, 13, 65, 42], "Hos": [11, 24, 5, 19, 15, 11, 16, 14, 17, 15, 12, 14, 15, 10], "Amos": [15, 16, 15, 13, 27, 15, 17, 14, 14], "Jonah": [16, 11, 10, 11], "Mic": [16, 13, 12, 13, 14, 16, 20], "Hag": [14, 24], "Matt": [25, 23, 17, 25, 48, 34, 29, 34, 38, 42, 30, 50, 58, 36, 39, 28, 26, 35, 30, 34, 46, 46, 39, 51, 46, 75, 66, 20], "Mark": [45, 28, 35, 40, 43, 56, 37, 39, 49, 52, 33, 44, 37, 72, 47, 20], "John": [51, 25, 36, 54, 47, 72, 53, 59, 41, 42, 57, 50, 38, 31, 27, 33, 26, 40, 42, 31, 25], "Acts": [26, 47, 26, 37, 42, 15, 59, 40, 43, 48, 30, 25, 52, 27, 41, 40, 34, 28, 40, 38, 40, 30, 35, 27, 27, 32, 44, 31], "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 13], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21], "Tob": [25, 23, 25, 23, 28, 22, 20, 24, 12, 13, 21, 22, 23, 17], "Jdt": [12, 18, 15, 17, 29, 21, 25, 34, 19, 20, 21, 20, 31, 18, 15, 31], "Wis": [16, 25, 19, 20, 24, 27, 30, 21, 19, 21, 27, 27, 19, 31, 19, 29, 20, 25, 20], "Sir": [40, 23, 34, 36, 18, 37, 40, 22, 25, 34, 36, 19, 32, 27, 22, 31, 31, 33, 28, 33, 31, 33, 38, 47, 36, 28, 33, 30, 35, 27, 42, 28, 33, 31, 26, 28, 34, 39, 41, 32, 28, 26, 37, 27, 31, 23, 31, 28, 19, 31, 38, 13], "Bar": [22, 35, 38, 37, 9, 72], "1Macc": [67, 70, 60, 61, 68, 63, 50, 32, 73, 89, 74, 54, 54, 49, 41, 24], "2Macc": [36, 33, 40, 50, 27, 31, 42, 36, 29, 38, 38, 46, 26, 46, 40] } }, ceb: { chapters: { "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 13], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21], "Tob": [22, 14, 17, 21, 22, 18, 16, 21, 6, 13, 18, 22, 18, 15], "PrAzar": [67], "EpJer": [72], "1Esd": [55, 26, 24, 63, 71, 33, 15, 92, 55] } }, kjv: { chapters: { "3John": [14] } }, nab: { order: { "Gen": 1, "Exod": 2, "Lev": 3, "Num": 4, "Deut": 5, "Josh": 6, "Judg": 7, "Ruth": 8, "1Sam": 9, "2Sam": 10, "1Kgs": 11, "2Kgs": 12, "1Chr": 13, "2Chr": 14, "PrMan": 15, "Ezra": 16, "Neh": 17, "1Esd": 18, "2Esd": 19, "Tob": 20, "Jdt": 21, "Esth": 22, "GkEsth": 23, "1Macc": 24, "2Macc": 25, "3Macc": 26, "4Macc": 27, "Job": 28, "Ps": 29, "Prov": 30, "Eccl": 31, "Song": 32, "Wis": 33, "Sir": 34, "Isa": 35, "Jer": 36, "Lam": 37, "Bar": 38, "EpJer": 39, "Ezek": 40, "Dan": 41, "PrAzar": 42, "Sus": 43, "Bel": 44, "SgThree": 45, "Hos": 46, "Joel": 47, "Amos": 48, "Obad": 49, "Jonah": 50, "Mic": 51, "Nah": 52, "Hab": 53, "Zeph": 54, "Hag": 55, "Zech": 56, "Mal": 57, "Matt": 58, "Mark": 59, "Luke": 60, "John": 61, "Acts": 62, "Rom": 63, "1Cor": 64, "2Cor": 65, "Gal": 66, "Eph": 67, "Phil": 68, "Col": 69, "1Thess": 70, "2Thess": 71, "1Tim": 72, "2Tim": 73, "Titus": 74, "Phlm": 75, "Heb": 76, "Jas": 77, "1Pet": 78, "2Pet": 79, "1John": 80, "2John": 81, "3John": 82, "Jude": 83, "Rev": 84 }, chapters: { "Gen": [31, 25, 24, 26, 32, 22, 24, 22, 29, 32, 32, 20, 18, 24, 21, 16, 27, 33, 38, 18, 34, 24, 20, 67, 34, 35, 46, 22, 35, 43, 54, 33, 20, 31, 29, 43, 36, 30, 23, 23, 57, 38, 34, 34, 28, 34, 31, 22, 33, 26], "Exod": [22, 25, 22, 31, 23, 30, 29, 28, 35, 29, 10, 51, 22, 31, 27, 36, 16, 27, 25, 26, 37, 30, 33, 18, 40, 37, 21, 43, 46, 38, 18, 35, 23, 35, 35, 38, 29, 31, 43, 38], "Lev": [17, 16, 17, 35, 26, 23, 38, 36, 24, 20, 47, 8, 59, 57, 33, 34, 16, 30, 37, 27, 24, 33, 44, 23, 55, 46, 34], "Num": [54, 34, 51, 49, 31, 27, 89, 26, 23, 36, 35, 16, 33, 45, 41, 35, 28, 32, 22, 29, 35, 41, 30, 25, 19, 65, 23, 31, 39, 17, 54, 42, 56, 29, 34, 13], "Deut": [46, 37, 29, 49, 33, 25, 26, 20, 29, 22, 32, 31, 19, 29, 23, 22, 20, 22, 21, 20, 23, 29, 26, 22, 19, 19, 26, 69, 28, 20, 30, 52, 29, 12], "1Sam": [28, 36, 21, 22, 12, 21, 17, 22, 27, 27, 15, 25, 23, 52, 35, 23, 58, 30, 24, 42, 16, 23, 28, 23, 44, 25, 12, 25, 11, 31, 13], "2Sam": [27, 32, 39, 12, 25, 23, 29, 18, 13, 19, 27, 31, 39, 33, 37, 23, 29, 32, 44, 26, 22, 51, 39, 25], "1Kgs": [53, 46, 28, 20, 32, 38, 51, 66, 28, 29, 43, 33, 34, 31, 34, 34, 24, 46, 21, 43, 29, 54], "2Kgs": [18, 25, 27, 44, 27, 33, 20, 29, 37, 36, 20, 22, 25, 29, 38, 20, 41, 37, 37, 21, 26, 20, 37, 20, 30], "1Chr": [54, 55, 24, 43, 41, 66, 40, 40, 44, 14, 47, 41, 14, 17, 29, 43, 27, 17, 19, 8, 30, 19, 32, 31, 31, 32, 34, 21, 30], "2Chr": [18, 17, 17, 22, 14, 42, 22, 18, 31, 19, 23, 16, 23, 14, 19, 14, 19, 34, 11, 37, 20, 12, 21, 27, 28, 23, 9, 27, 36, 27, 21, 33, 25, 33, 27, 23], "Neh": [11, 20, 38, 17, 19, 19, 72, 18, 37, 40, 36, 47, 31], "Job": [22, 13, 26, 21, 27, 30, 21, 22, 35, 22, 20, 25, 28, 22, 35, 22, 16, 21, 29, 29, 34, 30, 17, 25, 6, 14, 23, 28, 25, 31, 40, 22, 33, 37, 16, 33, 24, 41, 30, 32, 26, 17], "Ps": [6, 11, 9, 9, 13, 11, 18, 10, 21, 18, 7, 9, 6, 7, 5, 11, 15, 51, 15, 10, 14, 32, 6, 10, 22, 12, 14, 9, 11, 13, 25, 11, 22, 23, 28, 13, 40, 23, 14, 18, 14, 12, 5, 27, 18, 12, 10, 15, 21, 23, 21, 11, 7, 9, 24, 14, 12, 12, 18, 14, 9, 13, 12, 11, 14, 20, 8, 36, 37, 6, 24, 20, 28, 23, 11, 13, 21, 72, 13, 20, 17, 8, 19, 13, 14, 17, 7, 19, 53, 17, 16, 16, 5, 23, 11, 13, 12, 9, 9, 5, 8, 29, 22, 35, 45, 48, 43, 14, 31, 7, 10, 10, 9, 8, 18, 19, 2, 29, 176, 7, 8, 9, 4, 8, 5, 6, 5, 6, 8, 8, 3, 18, 3, 3, 21, 26, 9, 8, 24, 14, 10, 8, 12, 15, 21, 10, 20, 14, 9, 6], "Eccl": [18, 26, 22, 17, 19, 12, 29, 17, 18, 20, 10, 14], "Song": [17, 17, 11, 16, 16, 12, 14, 14], "Isa": [31, 22, 26, 6, 30, 13, 25, 23, 20, 34, 16, 6, 22, 32, 9, 14, 14, 7, 25, 6, 17, 25, 18, 23, 12, 21, 13, 29, 24, 33, 9, 20, 24, 17, 10, 22, 38, 22, 8, 31, 29, 25, 28, 28, 25, 13, 15, 22, 26, 11, 23, 15, 12, 17, 13, 12, 21, 14, 21, 22, 11, 12, 19, 11, 25, 24], "Jer": [19, 37, 25, 31, 31, 30, 34, 23, 25, 25, 23, 17, 27, 22, 21, 21, 27, 23, 15, 18, 14, 30, 40, 10, 38, 24, 22, 17, 32, 24, 40, 44, 26, 22, 19, 32, 21, 28, 18, 16, 18, 22, 13, 30, 5, 28, 7, 47, 39, 46, 64, 34], "Ezek": [28, 10, 27, 17, 17, 14, 27, 18, 11, 22, 25, 28, 23, 23, 8, 63, 24, 32, 14, 44, 37, 31, 49, 27, 17, 21, 36, 26, 21, 26, 18, 32, 33, 31, 15, 38, 28, 23, 29, 49, 26, 20, 27, 31, 25, 24, 23, 35], "Dan": [21, 49, 100, 34, 30, 29, 28, 27, 27, 21, 45, 13, 64, 42], "Hos": [9, 25, 5, 19, 15, 11, 16, 14, 17, 15, 11, 15, 15, 10], "Joel": [20, 27, 5, 21], "Jonah": [16, 11, 10, 11], "Mic": [16, 13, 12, 14, 14, 16, 20], "Nah": [14, 14, 19], "Zech": [17, 17, 10, 14, 11, 15, 14, 23, 17, 12, 17, 14, 9, 21], "Mal": [14, 17, 24], "Acts": [26, 47, 26, 37, 42, 15, 60, 40, 43, 49, 30, 25, 52, 28, 41, 40, 34, 28, 40, 38, 40, 30, 35, 27, 27, 32, 44, 31], "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 13], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21], "Tob": [22, 14, 17, 21, 22, 18, 17, 21, 6, 13, 18, 22, 18, 15], "Sir": [30, 18, 31, 31, 15, 37, 36, 19, 18, 31, 34, 18, 26, 27, 20, 30, 32, 33, 30, 31, 28, 27, 27, 33, 26, 29, 30, 26, 28, 25, 31, 24, 33, 31, 26, 31, 31, 34, 35, 30, 22, 25, 33, 23, 26, 20, 25, 25, 16, 29, 30], "Bar": [22, 35, 38, 37, 9, 72], "2Macc": [36, 32, 40, 50, 27, 31, 42, 36, 29, 38, 38, 46, 26, 46, 39] } }, nlt: { chapters: { "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21] } }, nrsv: { chapters: { "2Cor": [24, 17, 18, 18, 21, 18, 16, 24, 15, 18, 33, 21, 13], "Rev": [20, 29, 22, 11, 14, 17, 17, 13, 21, 11, 19, 18, 18, 20, 8, 21, 18, 24, 21, 15, 27, 21] } } }; bcv_parser.prototype.languages = ["or"]; bcv_parser.prototype.regexps.space = "[\\s\\xa0]"; bcv_parser.prototype.regexps.escaped_passage = /(?:^|[^\x1f\x1e\dA-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:(?:ch(?:apters?|a?pts?\.?|a?p?s?\.?)?\s*\d+\s*(?:[\u2013\u2014\-]|through|thru|to)\s*\d+\s*(?:from|of|in)(?:\s+the\s+book\s+of)?\s*)|(?:ch(?:apters?|a?pts?\.?|a?p?s?\.?)?\s*\d+\s*(?:from|of|in)(?:\s+the\s+book\s+of)?\s*)|(?:\d+(?:th|nd|st)\s*ch(?:apter|a?pt\.?|a?p?\.?)?\s*(?:from|of|in)(?:\s+the\s+book\s+of)?\s*))?\x1f(\d+)(?:\/\d+)?\x1f(?:\/\d+\x1f|[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014]|title(?![a-z])|chapter|verse|ଠାରୁ|and|ff|[ଖ](?!\w)|$)+)/gi; bcv_parser.prototype.regexps.match_end_split = /\d\W*title|\d\W*ff(?:[\s\xa0*]*\.)?|\d[\s\xa0*]*[ଖ](?!\w)|\x1e(?:[\s\xa0*]*[)\]\uff09])?|[\d\x1f]/gi; bcv_parser.prototype.regexps.control = /[\x1e\x1f]/g; bcv_parser.prototype.regexps.pre_book = "[^A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ]"; bcv_parser.prototype.regexps.first = "(?:ପ୍ରଥମ|1)\\.?" + bcv_parser.prototype.regexps.space + "*"; bcv_parser.prototype.regexps.second = "(?:ଦ୍ୱିତୀୟ|2)\\.?" + bcv_parser.prototype.regexps.space + "*"; bcv_parser.prototype.regexps.third = "(?:ତୃତୀୟ|3)\\.?" + bcv_parser.prototype.regexps.space + "*"; bcv_parser.prototype.regexps.range_and = "(?:[&\u2013\u2014-]|and|ଠାରୁ)"; bcv_parser.prototype.regexps.range_only = "(?:[\u2013\u2014-]|ଠାରୁ)"; bcv_parser.prototype.regexps.get_books = function(include_apocrypha, case_sensitive) { var book, books, k, len, out; books = [ { osis: ["Ps"], apocrypha: true, extra: "2", regexp: /(\b)(Ps151)(?=\.1)/g }, { osis: ["Gen"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଆଦି(?:ପୁସ୍ତକ)?|Gen))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Exod"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯାତ୍ରା(?:[\\s\\xa0]*ପୁସ୍ତକ|ପୁସ୍ତକ)?|Exod))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Bel"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Bel))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Lev"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଲେବୀୟ(?:[\\s\\xa0]*ପୁସ୍ତକ)?|Lev))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Num"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଗଣନା(?:[\\s\\xa0]*ପୁସ୍ତକ)?|Num))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Sir"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Sir))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Wis"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Wis))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Lam"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯିରିମିୟଙ୍କ[\\s\\xa0]*ବିଳାପ|Lam))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["EpJer"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:EpJer))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Rev"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯୋହନଙ୍କ[\\s\\xa0]*ପ୍ରତି[\\s\\xa0]*ପ୍ରକାଶିତ[\\s\\xa0]*ବାକ୍ୟ|Rev))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["PrMan"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:PrMan))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Deut"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଦ୍ୱିତୀୟ[\\s\\xa0]*ବିବରଣୀ?|ବିବରଣି|Deut))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Josh"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯିହୋଶୂୟଙ୍କର(?:[\\s\\xa0]*ପୁସ୍ତକ)?|Josh))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Judg"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ବିଗ୍ଭରକର୍ତ୍ତାମାନଙ୍କ[\\s\\xa0]*ବିବରଣ|Judg))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Ruth"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଋତର[\\s\\xa0]*ବିବରଣ[\\s\\xa0]*ପୁସ୍ତକ|Ruth))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["1Esd"], apocrypha: true, regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1Esd))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2Esd"], apocrypha: true, regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2Esd))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Isa"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯ(?:ିଶାଇୟ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କର[\\s\\xa0]*ପୁସ୍ତକ)?|[ାୀ]ଶାଇୟ)|ୟିଶାୟ|Isa|ୟଶାଇୟ))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Sam"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2(?:[\s\xa0]*ଶାମୁୟେଲଙ|Sam|\.[\s\xa0]*ଶାମୁୟେଲଙ)|ଦ୍ୱିତୀୟ[\s\xa0]*ଶାମୁୟେଲଙ|(?:ଦ୍ୱିତୀୟ|2\.?)[\s\xa0]*ଶାମୁୟେଲ|ଶାମୁୟେଲଙ୍କ[\s\xa0]*ଦ୍ୱିତୀୟ[\s\xa0]*ପୁସ୍ତକ))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Sam"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1(?:[\s\xa0]*ଶାମୁୟେଲଙ|Sam|\.[\s\xa0]*ଶାମୁୟେଲଙ)|ପ୍ରଥମ[\s\xa0]*ଶାମୁୟେଲଙ|(?:ପ୍ରଥମ|1\.?)[\s\xa0]*ଶାମୁୟେଲ|ଶାମୁୟେଲଙ୍କ[\s\xa0]*ପ୍ରଥମ[\s\xa0]*ପୁସ୍ତକ))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2Kgs"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2(?:[\s\xa0]*ରାଜାବଳୀର|Kgs|\.[\s\xa0]*ରାଜାବଳୀର)|ଦ୍ୱିତୀୟ[\s\xa0]*ରାଜାବଳୀର|(?:ଦ୍ୱିତୀୟ|2\.?)[\s\xa0]*ରାଜାବଳୀ|ରାଜାବଳୀର[\s\xa0]*ଦ୍ୱିତୀୟ[\s\xa0]*ପୁସ୍ତକ))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Kgs"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1(?:[\s\xa0]*ରାଜାବଳୀର|Kgs|\.[\s\xa0]*ରାଜାବଳୀର)|ପ୍ରଥମ[\s\xa0]*ରାଜାବଳୀର|(?:ପ୍ରଥମ|1\.?)[\s\xa0]*ରାଜାବଳୀ|ରାଜାବଳୀର[\s\xa0]*ପ୍ରଥମ[\s\xa0]*ପୁସ୍ତକ))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2Chr"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2(?:[\s\xa0]*ବଂଶାବଳୀର|Chr|\.[\s\xa0]*ବଂଶାବଳୀର)|ଦ୍ୱିତୀୟ[\s\xa0]*ବଂଶାବଳୀର|(?:ଦ୍ୱିତୀୟ|2\.?)[\s\xa0]*ବଂଶାବଳୀ|ବଂଶାବଳୀର[\s\xa0]*ଦ୍ୱିତୀୟ[\s\xa0]*ପୁସ୍ତକ))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Chr"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1(?:[\s\xa0]*ବଂଶାବଳୀର|Chr|\.[\s\xa0]*ବଂଶାବଳୀର)|ପ୍ରଥମ[\s\xa0]*ବଂଶାବଳୀର|(?:ପ୍ରଥମ|1\.?)[\s\xa0]*ବଂଶାବଳୀ|ବଂଶାବଳୀର[\s\xa0]*ପ୍ରଥମ[\s\xa0]*ପୁସ୍ତକ))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Ezra"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଏଜ୍ରା|Ezra))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Neh"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ନିହିମିୟାଙ୍କର(?:[\\s\\xa0]*ପୁସ୍ତକ)?|Neh))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["GkEsth"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:GkEsth))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Esth"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଏଷ୍ଟର[\\s\\xa0]*ବିବରଣ|Esth))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Job"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଆୟୁବ(?:[\\s\\xa0]*ପୁସ୍ତକ)?|Job))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Ps"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଗ(?:ୀତି?|ାତ)ସଂହିତା|Ps))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["PrAzar"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:PrAzar))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Prov"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ହିତୋପଦେଶ|Prov))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Eccl"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଉପଦେଶକ|Eccl))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["SgThree"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:SgThree))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Song"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ପରମଗୀତ|Song))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Jer"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯିରିମିୟ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Jer))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Ezek"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯିହିଜିକଲ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Ezek))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Dan"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଦାନିୟେଲଙ(?:୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Dan))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Hos"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ହୋଶ(?:େୟ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|ହେ)|Hos))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Joel"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯୋୟେଲ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Joel))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Amos"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଆମୋଷ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Amos))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Obad"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଓବଦିଅ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Obad))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Jonah"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯୂନସ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Jonah))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Mic"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ମ(?:ୀଖା(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|ିଖା)|Mic))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Nah"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ନାହୂମ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Nah))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Hab"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ହବ(?:‌କ୍‌କୂକ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|କ[ୁୂ]କ୍)|Hab))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Zeph"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ସିଫନିୟ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Zeph))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Hag"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ହାଗୟ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Hag))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Zech"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯିଖରିୟ(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Zech))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Mal"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ମଲାଖି(?:[\\s\\xa0]*ଭବିଷ୍ୟ‌ଦ୍‌ବକ୍ତାଙ୍କ[\\s\\xa0]*ପୁସ୍ତକ)?|Mal))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Matt"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ମାଥିଉ(?:[\\s\\xa0]*ଲିଖିତ[\\s\\xa0]*ସୁସମାଗ୍ଭର)?|Matt))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Mark"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ମାର୍କ(?:[\\s\\xa0]*ଲିଖିତ[\\s\\xa0]*ସୁସମାଗ୍ଭର)?|Mark))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Luke"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଲୂକ(?:[\\s\\xa0]*ଲିଖିତ[\\s\\xa0]*ସୁସମାଗ୍ଭର)?|Luke))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["1John"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1(?:[\s\xa0]*ଯୋହନଙ|John|\.[\s\xa0]*ଯୋହନଙ)|ପ୍ରଥମ[\s\xa0]*ଯୋହନଙ|ଯୋହନଙ୍କ[\s\xa0]*ପ୍ରଥମ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2John"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2(?:[\s\xa0]*ଯୋହନଙ|John|\.[\s\xa0]*ଯୋହନଙ)|ଦ୍ୱିତୀୟ[\s\xa0]*ଯୋହନଙ|ଯୋହନଙ୍କ[\s\xa0]*ଦ୍ୱିତୀୟ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["3John"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:3(?:[\s\xa0]*ଯୋହନଙ|John|\.[\s\xa0]*ଯୋହନଙ)|ତୃତୀୟ[\s\xa0]*ଯୋହନଙ|ଯୋହନଙ୍କ[\s\xa0]*ତୃତୀୟ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["John"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯୋହନ(?:[\\s\\xa0]*ଲିଖିତ[\\s\\xa0]*ସୁସମାଗ୍ଭର)?|John))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Acts"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ପ୍ରେରିତ(?:ମାନଙ୍କ[\\s\\xa0]*କାର୍ଯ୍ୟର[\\s\\xa0]*ବିବରଣ)?|Acts))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Rom"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ରୋମୀୟଙ୍କ(?:[\\s\\xa0]*ପ୍ରତି[\\s\\xa0]*ପତ୍ର)?|Rom))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Cor"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2(?:[\s\xa0]*କରିନ୍ଥୀୟଙ୍କ|Cor|\.[\s\xa0]*କରିନ୍ଥୀୟଙ୍କ)|ଦ୍ୱିତୀୟ[\s\xa0]*କରିନ୍ଥୀୟଙ୍କ|(?:ଦ୍ୱିତୀୟ|2\.?)[\s\xa0]*କରିନ୍ଥୀୟ|କରିନ୍ଥୀୟଙ୍କ[\s\xa0]*ପ୍ରତି[\s\xa0]*ଦ୍ୱିତୀୟ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Cor"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1(?:[\s\xa0]*କରିନ୍ଥୀୟଙ୍କ|Cor|\.[\s\xa0]*କରିନ୍ଥୀୟଙ୍କ)|ପ୍ରଥମ[\s\xa0]*କରିନ୍ଥୀୟଙ୍କ|(?:ପ୍ରଥମ|1\.?)[\s\xa0]*କରିନ୍ଥୀୟ|କରିନ୍ଥୀୟଙ୍କ[\s\xa0]*ପ୍ରତି[\s\xa0]*ପ୍ରଥମ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Gal"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଗାଲାତୀୟଙ୍କ(?:[\\s\\xa0]*ପ୍ରତି[\\s\\xa0]*ପତ୍ର)?|Gal))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Eph"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଏଫିସୀୟଙ୍କ(?:[\\s\\xa0]*ପ୍ରତି[\\s\\xa0]*ପତ୍ର)?|Eph))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Phil"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଫିଲି‌ପ୍‌ପୀୟଙ୍କ(?:[\\s\\xa0]*ପ୍ରତି[\\s\\xa0]*ପତ୍ର)?|Phil))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Col"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:କଲସୀୟଙ୍କ(?:[\\s\\xa0]*ପ୍ରତି[\\s\\xa0]*ପତ୍ର)?|Col))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Thess"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2(?:[\s\xa0]*ଥେସଲନୀକୀୟଙ|Thess|\.[\s\xa0]*ଥେସଲନୀକୀୟଙ)|ଦ୍ୱିତୀୟ[\s\xa0]*ଥେସଲନୀକୀୟଙ|ଥେସଲନୀକୀୟଙ୍କ[\s\xa0]*ପ୍ରତି[\s\xa0]*ଦ୍ୱିତୀୟ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Thess"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1(?:[\s\xa0]*ଥେସଲନୀକୀୟଙ|Thess|\.[\s\xa0]*ଥେସଲନୀକୀୟଙ)|ପ୍ରଥମ[\s\xa0]*ଥେସଲନୀକୀୟଙ|ଥେସଲନୀକୀୟଙ୍କ[\s\xa0]*ପ୍ରତି[\s\xa0]*ପ୍ରଥମ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["2Tim"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2(?:[\s\xa0]*ତୀମଥିଙ୍କ|Tim|\.[\s\xa0]*ତୀମଥିଙ୍କ)|ଦ୍ୱିତୀୟ[\s\xa0]*ତୀମଥିଙ୍କ|ତୀମଥିଙ୍କ[\s\xa0]*ପ୍ରତି[\s\xa0]*ଦ୍ୱିତୀୟ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Tim"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1(?:[\s\xa0]*ତୀମଥିଙ୍କ|Tim|\.[\s\xa0]*ତୀମଥିଙ୍କ)|ପ୍ରଥମ[\s\xa0]*ତୀମଥିଙ୍କ|ତୀମଥିଙ୍କ[\s\xa0]*ପ୍ରତି[\s\xa0]*ପ୍ରଥମ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Titus"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ତୀତସଙ୍କ(?:[\\s\\xa0]*ପ୍ରତି[\\s\\xa0]*ପତ୍ର)?|Titus))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Phlm"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଫିଲୀମୋନଙ୍କ(?:[\\s\\xa0]*ପ୍ରତି[\\s\\xa0]*ପତ୍ର)?|Phlm))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Heb"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଏବ୍ରୀ|Heb))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Jas"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯାକୁବଙ୍କ(?:[\\s\\xa0]*ପତ୍ର)?|Jas))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Pet"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2(?:[\s\xa0]*ପିତରଙ|Pet|\.[\s\xa0]*ପିତରଙ)|ଦ୍ୱିତୀୟ[\s\xa0]*ପିତରଙ|ପିତରଙ୍କ[\s\xa0]*ଦ୍ୱିତୀୟ[\s\xa0]*ପତ୍ର))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Pet"], regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:ପ(?:ିତରଙ୍କ[\s\xa0]*ପ୍ରଥମ[\s\xa0]*ପତ୍ର|୍ରଥମ[\s\xa0]*ପିତରଙ)|1(?:[\s\xa0]*ପିତରଙ|Pet|\.[\s\xa0]*ପିତରଙ)))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["Jude"], regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:ଯିହୂଦାଙ୍କ(?:[\\s\\xa0]*ପତ୍ର)?|Jude))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Tob"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Tob))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Jdt"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Jdt))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Bar"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Bar))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["Sus"], apocrypha: true, regexp: RegExp("(^|" + bcv_parser.prototype.regexps.pre_book + ")((?:Sus))(?:(?=[\\d\\s\\xa0.:,;\\x1e\\x1f&\\(\\)\\uff08\\uff09\\[\\]/\"'\\*=~\\-\\u2013\\u2014])|$)", "gi") }, { osis: ["2Macc"], apocrypha: true, regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:2Macc))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["3Macc"], apocrypha: true, regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:3Macc))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["4Macc"], apocrypha: true, regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:4Macc))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi }, { osis: ["1Macc"], apocrypha: true, regexp: /(^|[^0-9A-Za-zଁଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଵ-ହ଼-ଽିୁ-ୄ୍ୖଡ଼-ଢ଼ୟ-ୣୱ])((?:1Macc))(?:(?=[\d\s\xa0.:,;\x1e\x1f&\(\)\uff08\uff09\[\]\/"'\*=~\-\u2013\u2014])|$)/gi } ]; if (include_apocrypha === true && case_sensitive === "none") { return books; } out = []; for (k = 0, len = books.length; k < len; k++) { book = books[k]; if (include_apocrypha === false && (book.apocrypha != null) && book.apocrypha === true) { continue; } if (case_sensitive === "books") { book.regexp = new RegExp(book.regexp.source, "g"); } out.push(book); } return out; }; bcv_parser.prototype.regexps.books = bcv_parser.prototype.regexps.get_books(false, "none"); var grammar; /* * Generated by PEG.js 0.10.0. * * http://pegjs.org/ */ (function(root) { "use strict"; function peg$subclass(child, parent) { function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); } function peg$SyntaxError(message, expected, found, location) { this.message = message; this.expected = expected; this.found = found; this.location = location; this.name = "SyntaxError"; if (typeof Error.captureStackTrace === "function") { Error.captureStackTrace(this, peg$SyntaxError); } } peg$subclass(peg$SyntaxError, Error); peg$SyntaxError.buildMessage = function(expected, found) { var DESCRIBE_EXPECTATION_FNS = { literal: function(expectation) { return "\"" + literalEscape(expectation.text) + "\""; }, "class": function(expectation) { var escapedParts = "", i; for (i = 0; i < expectation.parts.length; i++) { escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]); } return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; }, any: function(expectation) { return "any character"; }, end: function(expectation) { return "end of input"; }, other: function(expectation) { return expectation.description; } }; function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } function literalEscape(s) { return s .replace(/\\/g, '\\\\') .replace(/"/g, '\\"') .replace(/\0/g, '\\0') .replace(/\t/g, '\\t') .replace(/\n/g, '\\n') .replace(/\r/g, '\\r') .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); } function classEscape(s) { return s .replace(/\\/g, '\\\\') .replace(/\]/g, '\\]') .replace(/\^/g, '\\^') .replace(/-/g, '\\-') .replace(/\0/g, '\\0') .replace(/\t/g, '\\t') .replace(/\n/g, '\\n') .replace(/\r/g, '\\r') .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); } function describeExpectation(expectation) { return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); } function describeExpected(expected) { var descriptions = new Array(expected.length), i, j; for (i = 0; i < expected.length; i++) { descriptions[i] = describeExpectation(expected[i]); } descriptions.sort(); if (descriptions.length > 0) { for (i = 1, j = 1; i < descriptions.length; i++) { if (descriptions[i - 1] !== descriptions[i]) { descriptions[j] = descriptions[i]; j++; } } descriptions.length = j; } switch (descriptions.length) { case 1: return descriptions[0]; case 2: return descriptions[0] + " or " + descriptions[1]; default: return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1]; } } function describeFound(found) { return found ? "\"" + literalEscape(found) + "\"" : "end of input"; } return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; }; function peg$parse(input, options) { options = options !== void 0 ? options : {}; var peg$FAILED = {}, peg$startRuleFunctions = { start: peg$parsestart }, peg$startRuleFunction = peg$parsestart, peg$c0 = function(val_1, val_2) { val_2.unshift([val_1]); return {"type": "sequence", "value": val_2, "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c1 = "(", peg$c2 = peg$literalExpectation("(", false), peg$c3 = ")", peg$c4 = peg$literalExpectation(")", false), peg$c5 = function(val_1, val_2) { if (typeof(val_2) === "undefined") val_2 = []; val_2.unshift([val_1]); return {"type": "sequence_post_enclosed", "value": val_2, "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c6 = function(val_1, val_2) { if (val_1.length && val_1.length === 2) val_1 = val_1[0]; // for `b`, which returns [object, undefined] return {"type": "range", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c7 = "\x1F", peg$c8 = peg$literalExpectation("\x1F", false), peg$c9 = "/", peg$c10 = peg$literalExpectation("/", false), peg$c11 = /^[1-8]/, peg$c12 = peg$classExpectation([["1", "8"]], false, false), peg$c13 = function(val) { return {"type": "b", "value": val.value, "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c14 = function(val_1, val_2) { return {"type": "bc", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c15 = ",", peg$c16 = peg$literalExpectation(",", false), peg$c17 = function(val_1, val_2) { return {"type": "bc_title", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c18 = ".", peg$c19 = peg$literalExpectation(".", false), peg$c20 = function(val_1, val_2) { return {"type": "bcv", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c21 = "-", peg$c22 = peg$literalExpectation("-", false), peg$c23 = function(val_1, val_2, val_3, val_4) { return {"type": "range", "value": [{"type": "bcv", "value": [{"type": "bc", "value": [val_1, val_2], "indices": [val_1.indices[0], val_2.indices[1]]}, val_3], "indices": [val_1.indices[0], val_3.indices[1]]}, val_4], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c24 = function(val_1, val_2) { return {"type": "bv", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c25 = function(val_1, val_2) { return {"type": "bc", "value": [val_2, val_1], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c26 = function(val_1, val_2, val_3) { return {"type": "cb_range", "value": [val_3, val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c27 = "th", peg$c28 = peg$literalExpectation("th", false), peg$c29 = "nd", peg$c30 = peg$literalExpectation("nd", false), peg$c31 = "st", peg$c32 = peg$literalExpectation("st", false), peg$c33 = "/1\x1F", peg$c34 = peg$literalExpectation("/1\x1F", false), peg$c35 = function(val) { return {"type": "c_psalm", "value": val.value, "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c36 = function(val_1, val_2) { return {"type": "cv_psalm", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c37 = function(val_1, val_2) { return {"type": "c_title", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c38 = function(val_1, val_2) { return {"type": "cv", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c39 = function(val) { return {"type": "c", "value": [val], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c40 = "ff", peg$c41 = peg$literalExpectation("ff", false), peg$c42 = /^[a-z]/, peg$c43 = peg$classExpectation([["a", "z"]], false, false), peg$c44 = function(val_1) { return {"type": "ff", "value": [val_1], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c45 = function(val_1, val_2) { return {"type": "integer_title", "value": [val_1, val_2], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c46 = "/9\x1F", peg$c47 = peg$literalExpectation("/9\x1F", false), peg$c48 = function(val) { return {"type": "context", "value": val.value, "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c49 = "/2\x1F", peg$c50 = peg$literalExpectation("/2\x1F", false), peg$c51 = ".1", peg$c52 = peg$literalExpectation(".1", false), peg$c53 = /^[0-9]/, peg$c54 = peg$classExpectation([["0", "9"]], false, false), peg$c55 = function(val) { return {"type": "bc", "value": [val, {"type": "c", "value": [{"type": "integer", "value": 151, "indices": [peg$currPos - 2, peg$currPos - 1]}], "indices": [peg$currPos - 2, peg$currPos - 1]}], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c56 = function(val_1, val_2) { return {"type": "bcv", "value": [val_1, {"type": "v", "value": [val_2], "indices": [val_2.indices[0], val_2.indices[1]]}], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c57 = /^[\u0B16]/i, peg$c58 = peg$classExpectation(["\u0B16"], false, true), peg$c59 = function(val) { return {"type": "v", "value": [val], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c60 = "chapter", peg$c61 = peg$literalExpectation("chapter", false), peg$c62 = function() { return {"type": "c_explicit"} }, peg$c63 = "verse", peg$c64 = peg$literalExpectation("verse", false), peg$c65 = function() { return {"type": "v_explicit"} }, peg$c66 = ":", peg$c67 = peg$literalExpectation(":", false), peg$c68 = /^["']/, peg$c69 = peg$classExpectation(["\"", "'"], false, false), peg$c70 = /^[,;\/:&\-\u2013\u2014~]/, peg$c71 = peg$classExpectation([",", ";", "/", ":", "&", "-", "\u2013", "\u2014", "~"], false, false), peg$c72 = "and", peg$c73 = peg$literalExpectation("and", false), peg$c74 = function() { return "" }, peg$c75 = /^[\-\u2013\u2014]/, peg$c76 = peg$classExpectation(["-", "\u2013", "\u2014"], false, false), peg$c77 = "\u0B20\u0B3E\u0B30\u0B41", peg$c78 = peg$literalExpectation("\u0B20\u0B3E\u0B30\u0B41", true), peg$c79 = "title", peg$c80 = peg$literalExpectation("title", false), peg$c81 = function(val) { return {type:"title", value: [val], "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c82 = "from", peg$c83 = peg$literalExpectation("from", false), peg$c84 = "of", peg$c85 = peg$literalExpectation("of", false), peg$c86 = "in", peg$c87 = peg$literalExpectation("in", false), peg$c88 = "the", peg$c89 = peg$literalExpectation("the", false), peg$c90 = "book", peg$c91 = peg$literalExpectation("book", false), peg$c92 = /^[([]/, peg$c93 = peg$classExpectation(["(", "["], false, false), peg$c94 = /^[)\]]/, peg$c95 = peg$classExpectation([")", "]"], false, false), peg$c96 = function(val) { return {"type": "translation_sequence", "value": val, "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c97 = "\x1E", peg$c98 = peg$literalExpectation("\x1E", false), peg$c99 = function(val) { return {"type": "translation", "value": val.value, "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c100 = ",000", peg$c101 = peg$literalExpectation(",000", false), peg$c102 = function(val) { return {"type": "integer", "value": parseInt(val.join(""), 10), "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c103 = /^[^\x1F\x1E([]/, peg$c104 = peg$classExpectation(["\x1F", "\x1E", "(", "["], true, false), peg$c105 = function(val) { return {"type": "word", "value": val.join(""), "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c106 = function(val) { return {"type": "stop", "value": val, "indices": [peg$savedPos, peg$currPos - 1]} }, peg$c107 = /^[\s\xa0*]/, peg$c108 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0", "*"], false, false), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result; if ("startRule" in options) { if (!(options.startRule in peg$startRuleFunctions)) { throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; } if ("punctuation_strategy" in options && options.punctuation_strategy === "eu") { peg$parsecv_sep = peg$parseeu_cv_sep; peg$c70 = /^[;\/:&\-\u2013\u2014~]/; } function text() { return input.substring(peg$savedPos, peg$currPos); } function location() { return peg$computeLocation(peg$savedPos, peg$currPos); } function expected(description, location) { location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) throw peg$buildStructuredError( [peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location ); } function error(message, location) { location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) throw peg$buildSimpleError(message, location); } function peg$literalExpectation(text, ignoreCase) { return { type: "literal", text: text, ignoreCase: ignoreCase }; } function peg$classExpectation(parts, inverted, ignoreCase) { return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; } function peg$anyExpectation() { return { type: "any" }; } function peg$endExpectation() { return { type: "end" }; } function peg$otherExpectation(description) { return { type: "other", description: description }; } function peg$computePosDetails(pos) { var details = peg$posDetailsCache[pos], p; if (details) { return details; } else { p = pos - 1; while (!peg$posDetailsCache[p]) { p--; } details = peg$posDetailsCache[p]; details = { line: details.line, column: details.column }; while (p < pos) { if (input.charCodeAt(p) === 10) { details.line++; details.column = 1; } else { details.column++; } p++; } peg$posDetailsCache[pos] = details; return details; } } function peg$computeLocation(startPos, endPos) { var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos); return { start: { offset: startPos, line: startPosDetails.line, column: startPosDetails.column }, end: { offset: endPos, line: endPosDetails.line, column: endPosDetails.column } }; } function peg$fail(expected) { if (peg$currPos < peg$maxFailPos) { return; } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; peg$maxFailExpected = []; } peg$maxFailExpected.push(expected); } function peg$buildSimpleError(message, location) { return new peg$SyntaxError(message, null, null, location); } function peg$buildStructuredError(expected, found, location) { return new peg$SyntaxError( peg$SyntaxError.buildMessage(expected, found), expected, found, location ); } function peg$parsestart() { var s0, s1; s0 = []; s1 = peg$parsebcv_hyphen_range(); if (s1 === peg$FAILED) { s1 = peg$parsesequence(); if (s1 === peg$FAILED) { s1 = peg$parsecb_range(); if (s1 === peg$FAILED) { s1 = peg$parserange(); if (s1 === peg$FAILED) { s1 = peg$parseff(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_comma(); if (s1 === peg$FAILED) { s1 = peg$parsebc_title(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsecv_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$parsec_psalm(); if (s1 === peg$FAILED) { s1 = peg$parseb(); if (s1 === peg$FAILED) { s1 = peg$parsecbv(); if (s1 === peg$FAILED) { s1 = peg$parsecbv_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsecb(); if (s1 === peg$FAILED) { s1 = peg$parsecb_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsetranslation_sequence_enclosed(); if (s1 === peg$FAILED) { s1 = peg$parsetranslation_sequence(); if (s1 === peg$FAILED) { s1 = peg$parsesequence_sep(); if (s1 === peg$FAILED) { s1 = peg$parsec_title(); if (s1 === peg$FAILED) { s1 = peg$parseinteger_title(); if (s1 === peg$FAILED) { s1 = peg$parsecv(); if (s1 === peg$FAILED) { s1 = peg$parsecv_weak(); if (s1 === peg$FAILED) { s1 = peg$parsev_letter(); if (s1 === peg$FAILED) { s1 = peg$parseinteger(); if (s1 === peg$FAILED) { s1 = peg$parsec(); if (s1 === peg$FAILED) { s1 = peg$parsev(); if (s1 === peg$FAILED) { s1 = peg$parseword(); if (s1 === peg$FAILED) { s1 = peg$parseword_parenthesis(); if (s1 === peg$FAILED) { s1 = peg$parsecontext(); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } if (s1 !== peg$FAILED) { while (s1 !== peg$FAILED) { s0.push(s1); s1 = peg$parsebcv_hyphen_range(); if (s1 === peg$FAILED) { s1 = peg$parsesequence(); if (s1 === peg$FAILED) { s1 = peg$parsecb_range(); if (s1 === peg$FAILED) { s1 = peg$parserange(); if (s1 === peg$FAILED) { s1 = peg$parseff(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_comma(); if (s1 === peg$FAILED) { s1 = peg$parsebc_title(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsecv_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$parsec_psalm(); if (s1 === peg$FAILED) { s1 = peg$parseb(); if (s1 === peg$FAILED) { s1 = peg$parsecbv(); if (s1 === peg$FAILED) { s1 = peg$parsecbv_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsecb(); if (s1 === peg$FAILED) { s1 = peg$parsecb_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsetranslation_sequence_enclosed(); if (s1 === peg$FAILED) { s1 = peg$parsetranslation_sequence(); if (s1 === peg$FAILED) { s1 = peg$parsesequence_sep(); if (s1 === peg$FAILED) { s1 = peg$parsec_title(); if (s1 === peg$FAILED) { s1 = peg$parseinteger_title(); if (s1 === peg$FAILED) { s1 = peg$parsecv(); if (s1 === peg$FAILED) { s1 = peg$parsecv_weak(); if (s1 === peg$FAILED) { s1 = peg$parsev_letter(); if (s1 === peg$FAILED) { s1 = peg$parseinteger(); if (s1 === peg$FAILED) { s1 = peg$parsec(); if (s1 === peg$FAILED) { s1 = peg$parsev(); if (s1 === peg$FAILED) { s1 = peg$parseword(); if (s1 === peg$FAILED) { s1 = peg$parseword_parenthesis(); if (s1 === peg$FAILED) { s1 = peg$parsecontext(); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } else { s0 = peg$FAILED; } return s0; } function peg$parsesequence() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsecb_range(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_hyphen_range(); if (s1 === peg$FAILED) { s1 = peg$parserange(); if (s1 === peg$FAILED) { s1 = peg$parseff(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_comma(); if (s1 === peg$FAILED) { s1 = peg$parsebc_title(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsecv_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$parsec_psalm(); if (s1 === peg$FAILED) { s1 = peg$parseb(); if (s1 === peg$FAILED) { s1 = peg$parsecbv(); if (s1 === peg$FAILED) { s1 = peg$parsecbv_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsecb(); if (s1 === peg$FAILED) { s1 = peg$parsecb_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsecontext(); } } } } } } } } } } } } } } } } } } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; s4 = peg$parsesequence_sep(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parsesequence_post(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; s4 = peg$parsesequence_sep(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parsesequence_post(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } } else { s2 = peg$FAILED; } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsesequence_post_enclosed() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { s1 = peg$c1; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s1 !== peg$FAILED) { s2 = peg$parsesp(); if (s2 !== peg$FAILED) { s3 = peg$parsesequence_sep(); if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { s4 = peg$parsesequence_post(); if (s4 !== peg$FAILED) { s5 = []; s6 = peg$currPos; s7 = peg$parsesequence_sep(); if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { s8 = peg$parsesequence_post(); if (s8 !== peg$FAILED) { s7 = [s7, s8]; s6 = s7; } else { peg$currPos = s6; s6 = peg$FAILED; } } else { peg$currPos = s6; s6 = peg$FAILED; } while (s6 !== peg$FAILED) { s5.push(s6); s6 = peg$currPos; s7 = peg$parsesequence_sep(); if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { s8 = peg$parsesequence_post(); if (s8 !== peg$FAILED) { s7 = [s7, s8]; s6 = s7; } else { peg$currPos = s6; s6 = peg$FAILED; } } else { peg$currPos = s6; s6 = peg$FAILED; } } if (s5 !== peg$FAILED) { s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { s7 = peg$c3; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c4); } } if (s7 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c5(s4, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsesequence_post() { var s0; s0 = peg$parsesequence_post_enclosed(); if (s0 === peg$FAILED) { s0 = peg$parsecb_range(); if (s0 === peg$FAILED) { s0 = peg$parsebcv_hyphen_range(); if (s0 === peg$FAILED) { s0 = peg$parserange(); if (s0 === peg$FAILED) { s0 = peg$parseff(); if (s0 === peg$FAILED) { s0 = peg$parsebcv_comma(); if (s0 === peg$FAILED) { s0 = peg$parsebc_title(); if (s0 === peg$FAILED) { s0 = peg$parseps151_bcv(); if (s0 === peg$FAILED) { s0 = peg$parsebcv(); if (s0 === peg$FAILED) { s0 = peg$parsebcv_weak(); if (s0 === peg$FAILED) { s0 = peg$parseps151_bc(); if (s0 === peg$FAILED) { s0 = peg$parsebc(); if (s0 === peg$FAILED) { s0 = peg$parsecv_psalm(); if (s0 === peg$FAILED) { s0 = peg$parsebv(); if (s0 === peg$FAILED) { s0 = peg$parsec_psalm(); if (s0 === peg$FAILED) { s0 = peg$parseb(); if (s0 === peg$FAILED) { s0 = peg$parsecbv(); if (s0 === peg$FAILED) { s0 = peg$parsecbv_ordinal(); if (s0 === peg$FAILED) { s0 = peg$parsecb(); if (s0 === peg$FAILED) { s0 = peg$parsecb_ordinal(); if (s0 === peg$FAILED) { s0 = peg$parsec_title(); if (s0 === peg$FAILED) { s0 = peg$parseinteger_title(); if (s0 === peg$FAILED) { s0 = peg$parsecv(); if (s0 === peg$FAILED) { s0 = peg$parsecv_weak(); if (s0 === peg$FAILED) { s0 = peg$parsev_letter(); if (s0 === peg$FAILED) { s0 = peg$parseinteger(); if (s0 === peg$FAILED) { s0 = peg$parsec(); if (s0 === peg$FAILED) { s0 = peg$parsev(); } } } } } } } } } } } } } } } } } } } } } } } } } } } return s0; } function peg$parserange() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsebcv_comma(); if (s1 === peg$FAILED) { s1 = peg$parsebc_title(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsecv_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$currPos; s2 = peg$parseb(); if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; s4 = peg$currPos; s5 = peg$parserange_sep(); if (s5 !== peg$FAILED) { s6 = peg$parsebcv_comma(); if (s6 === peg$FAILED) { s6 = peg$parsebc_title(); if (s6 === peg$FAILED) { s6 = peg$parseps151_bcv(); if (s6 === peg$FAILED) { s6 = peg$parsebcv(); if (s6 === peg$FAILED) { s6 = peg$parsebcv_weak(); if (s6 === peg$FAILED) { s6 = peg$parseps151_bc(); if (s6 === peg$FAILED) { s6 = peg$parsebc(); if (s6 === peg$FAILED) { s6 = peg$parsebv(); if (s6 === peg$FAILED) { s6 = peg$parseb(); } } } } } } } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } peg$silentFails--; if (s4 !== peg$FAILED) { peg$currPos = s3; s3 = void 0; } else { s3 = peg$FAILED; } if (s3 !== peg$FAILED) { s2 = [s2, s3]; s1 = s2; } else { peg$currPos = s1; s1 = peg$FAILED; } } else { peg$currPos = s1; s1 = peg$FAILED; } if (s1 === peg$FAILED) { s1 = peg$parsecbv(); if (s1 === peg$FAILED) { s1 = peg$parsecbv_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsec_psalm(); if (s1 === peg$FAILED) { s1 = peg$parsecb(); if (s1 === peg$FAILED) { s1 = peg$parsecb_ordinal(); if (s1 === peg$FAILED) { s1 = peg$parsec_title(); if (s1 === peg$FAILED) { s1 = peg$parseinteger_title(); if (s1 === peg$FAILED) { s1 = peg$parsecv(); if (s1 === peg$FAILED) { s1 = peg$parsecv_weak(); if (s1 === peg$FAILED) { s1 = peg$parsev_letter(); if (s1 === peg$FAILED) { s1 = peg$parseinteger(); if (s1 === peg$FAILED) { s1 = peg$parsec(); if (s1 === peg$FAILED) { s1 = peg$parsev(); } } } } } } } } } } } } } } } } } } } } } } if (s1 !== peg$FAILED) { s2 = peg$parserange_sep(); if (s2 !== peg$FAILED) { s3 = peg$parseff(); if (s3 === peg$FAILED) { s3 = peg$parsebcv_comma(); if (s3 === peg$FAILED) { s3 = peg$parsebc_title(); if (s3 === peg$FAILED) { s3 = peg$parseps151_bcv(); if (s3 === peg$FAILED) { s3 = peg$parsebcv(); if (s3 === peg$FAILED) { s3 = peg$parsebcv_weak(); if (s3 === peg$FAILED) { s3 = peg$parseps151_bc(); if (s3 === peg$FAILED) { s3 = peg$parsebc(); if (s3 === peg$FAILED) { s3 = peg$parsecv_psalm(); if (s3 === peg$FAILED) { s3 = peg$parsebv(); if (s3 === peg$FAILED) { s3 = peg$parseb(); if (s3 === peg$FAILED) { s3 = peg$parsecbv(); if (s3 === peg$FAILED) { s3 = peg$parsecbv_ordinal(); if (s3 === peg$FAILED) { s3 = peg$parsec_psalm(); if (s3 === peg$FAILED) { s3 = peg$parsecb(); if (s3 === peg$FAILED) { s3 = peg$parsecb_ordinal(); if (s3 === peg$FAILED) { s3 = peg$parsec_title(); if (s3 === peg$FAILED) { s3 = peg$parseinteger_title(); if (s3 === peg$FAILED) { s3 = peg$parsecv(); if (s3 === peg$FAILED) { s3 = peg$parsev_letter(); if (s3 === peg$FAILED) { s3 = peg$parseinteger(); if (s3 === peg$FAILED) { s3 = peg$parsecv_weak(); if (s3 === peg$FAILED) { s3 = peg$parsec(); if (s3 === peg$FAILED) { s3 = peg$parsev(); } } } } } } } } } } } } } } } } } } } } } } } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c6(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseb() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 31) { s1 = peg$c7; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 47) { s4 = peg$c9; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s4 !== peg$FAILED) { if (peg$c11.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 31) { s4 = peg$c7; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c13(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebc() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parseb(); if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$parsev_explicit(); if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsec(); if (s6 !== peg$FAILED) { s7 = peg$parsecv_sep(); if (s7 !== peg$FAILED) { s8 = peg$parsev(); if (s8 !== peg$FAILED) { s6 = [s6, s7, s8]; s5 = s6; } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } peg$silentFails--; if (s5 !== peg$FAILED) { peg$currPos = s4; s4 = void 0; } else { s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parsecv_sep(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecv_sep(); } } else { s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parsecv_sep_weak(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecv_sep_weak(); } } else { s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parserange_sep(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parserange_sep(); } } else { s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = peg$parsesp(); } } } } if (s2 !== peg$FAILED) { s3 = peg$parsec(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c14(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebc_comma() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseb(); if (s1 !== peg$FAILED) { s2 = peg$parsesp(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s3 = peg$c15; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s3 !== peg$FAILED) { s4 = peg$parsesp(); if (s4 !== peg$FAILED) { s5 = peg$parsec(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c14(s1, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebc_title() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); } if (s1 !== peg$FAILED) { s2 = peg$parsetitle(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c17(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebcv() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); } if (s1 !== peg$FAILED) { s2 = peg$currPos; peg$silentFails++; s3 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s4 = peg$c18; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s4 !== peg$FAILED) { s5 = peg$parsev_explicit(); if (s5 !== peg$FAILED) { s6 = peg$parsev(); if (s6 !== peg$FAILED) { s4 = [s4, s5, s6]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$parsesequence_sep(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parsev_explicit(); if (s5 !== peg$FAILED) { s6 = peg$parsecv(); if (s6 !== peg$FAILED) { s4 = [s4, s5, s6]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } peg$silentFails--; if (s3 === peg$FAILED) { s2 = void 0; } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$currPos; s4 = peg$parsecv_sep(); if (s4 === peg$FAILED) { s4 = peg$parsesequence_sep(); } if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parsev_explicit(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 === peg$FAILED) { s3 = peg$parsecv_sep(); } if (s3 !== peg$FAILED) { s4 = peg$parsev_letter(); if (s4 === peg$FAILED) { s4 = peg$parsev(); } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c20(s1, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebcv_weak() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parseps151_bc(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); } if (s1 !== peg$FAILED) { s2 = peg$parsecv_sep_weak(); if (s2 !== peg$FAILED) { s3 = peg$parsev_letter(); if (s3 === peg$FAILED) { s3 = peg$parsev(); } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsecv_sep(); if (s6 !== peg$FAILED) { s7 = peg$parsev(); if (s7 !== peg$FAILED) { s6 = [s6, s7]; s5 = s6; } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = void 0; } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c20(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebcv_comma() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsebc_comma(); if (s1 !== peg$FAILED) { s2 = peg$parsesp(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s3 = peg$c15; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s3 !== peg$FAILED) { s4 = peg$parsesp(); if (s4 !== peg$FAILED) { s5 = peg$parsev_letter(); if (s5 === peg$FAILED) { s5 = peg$parsev(); } if (s5 !== peg$FAILED) { s6 = peg$currPos; peg$silentFails++; s7 = peg$currPos; s8 = peg$parsecv_sep(); if (s8 !== peg$FAILED) { s9 = peg$parsev(); if (s9 !== peg$FAILED) { s8 = [s8, s9]; s7 = s8; } else { peg$currPos = s7; s7 = peg$FAILED; } } else { peg$currPos = s7; s7 = peg$FAILED; } peg$silentFails--; if (s7 === peg$FAILED) { s6 = void 0; } else { peg$currPos = s6; s6 = peg$FAILED; } if (s6 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c20(s1, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebcv_hyphen_range() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parseb(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c21; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c22); } } if (s2 === peg$FAILED) { s2 = peg$parsespace(); } if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = peg$parsec(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s4 = peg$c21; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c22); } } if (s4 !== peg$FAILED) { s5 = peg$parsev(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s6 = peg$c21; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c22); } } if (s6 !== peg$FAILED) { s7 = peg$parsev(); if (s7 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c23(s1, s3, s5, s7); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebv() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parseb(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parsecv_sep(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecv_sep(); } } else { s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parsecv_sep_weak(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecv_sep_weak(); } } else { s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = []; s3 = peg$parserange_sep(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parserange_sep(); } } else { s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = peg$currPos; s3 = []; s4 = peg$parsesequence_sep(); if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parsesequence_sep(); } } else { s3 = peg$FAILED; } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$parsev_explicit(); peg$silentFails--; if (s5 !== peg$FAILED) { peg$currPos = s4; s4 = void 0; } else { s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = peg$parsesp(); } } } } if (s2 !== peg$FAILED) { s3 = peg$parsev_letter(); if (s3 === peg$FAILED) { s3 = peg$parsev(); } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c24(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecb() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsec_explicit(); if (s1 !== peg$FAILED) { s2 = peg$parsec(); if (s2 !== peg$FAILED) { s3 = peg$parsein_book_of(); if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { s4 = peg$parseb(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c25(s2, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecb_range() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsec_explicit(); if (s1 !== peg$FAILED) { s2 = peg$parsec(); if (s2 !== peg$FAILED) { s3 = peg$parserange_sep(); if (s3 !== peg$FAILED) { s4 = peg$parsec(); if (s4 !== peg$FAILED) { s5 = peg$parsein_book_of(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { s6 = peg$parseb(); if (s6 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c26(s2, s4, s6); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecbv() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsecb(); if (s1 !== peg$FAILED) { s2 = peg$parsesequence_sep(); if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = peg$parsev_explicit(); if (s3 !== peg$FAILED) { s4 = peg$parsev(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c20(s1, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecb_ordinal() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsec(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c27) { s2 = peg$c27; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c28); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c29) { s2 = peg$c29; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c30); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c31) { s2 = peg$c31; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c32); } } } } if (s2 !== peg$FAILED) { s3 = peg$parsec_explicit(); if (s3 !== peg$FAILED) { s4 = peg$parsein_book_of(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parseb(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c25(s1, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecbv_ordinal() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsecb_ordinal(); if (s1 !== peg$FAILED) { s2 = peg$parsesequence_sep(); if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = peg$parsev_explicit(); if (s3 !== peg$FAILED) { s4 = peg$parsev(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c20(s1, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsec_psalm() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 31) { s1 = peg$c7; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c33) { s3 = peg$c33; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c35(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecv_psalm() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsec_psalm(); if (s1 !== peg$FAILED) { s2 = peg$parsesequence_sep(); if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = peg$parsev_explicit(); if (s3 !== peg$FAILED) { s4 = peg$parsev(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c36(s1, s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsec_title() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsec_explicit(); if (s1 !== peg$FAILED) { s2 = peg$parsec(); if (s2 !== peg$FAILED) { s3 = peg$parsetitle(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c37(s2, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecv() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parsev_explicit(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parsec(); if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; s4 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s5 = peg$c18; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s5 !== peg$FAILED) { s6 = peg$parsev_explicit(); if (s6 !== peg$FAILED) { s7 = peg$parsev(); if (s7 !== peg$FAILED) { s5 = [s5, s6, s7]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } peg$silentFails--; if (s4 === peg$FAILED) { s3 = void 0; } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { s4 = peg$currPos; s5 = peg$parsecv_sep(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { s6 = peg$parsev_explicit(); if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 === peg$FAILED) { s4 = peg$parsecv_sep(); } if (s4 !== peg$FAILED) { s5 = peg$parsev_letter(); if (s5 === peg$FAILED) { s5 = peg$parsev(); } if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c38(s2, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecv_weak() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parsec(); if (s1 !== peg$FAILED) { s2 = peg$parsecv_sep_weak(); if (s2 !== peg$FAILED) { s3 = peg$parsev_letter(); if (s3 === peg$FAILED) { s3 = peg$parsev(); } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsecv_sep(); if (s6 !== peg$FAILED) { s7 = peg$parsev(); if (s7 !== peg$FAILED) { s6 = [s6, s7]; s5 = s6; } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = void 0; } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c38(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsec() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsec_explicit(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseinteger(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c39(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseff() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsebcv(); if (s1 === peg$FAILED) { s1 = peg$parsebcv_weak(); if (s1 === peg$FAILED) { s1 = peg$parsebc(); if (s1 === peg$FAILED) { s1 = peg$parsebv(); if (s1 === peg$FAILED) { s1 = peg$parsecv(); if (s1 === peg$FAILED) { s1 = peg$parsecv_weak(); if (s1 === peg$FAILED) { s1 = peg$parseinteger(); if (s1 === peg$FAILED) { s1 = peg$parsec(); if (s1 === peg$FAILED) { s1 = peg$parsev(); } } } } } } } } if (s1 !== peg$FAILED) { s2 = peg$parsesp(); if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c40) { s3 = peg$c40; peg$currPos += 2; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c41); } } if (s3 !== peg$FAILED) { s4 = peg$parseabbrev(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$currPos; peg$silentFails++; if (peg$c42.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c43); } } peg$silentFails--; if (s6 === peg$FAILED) { s5 = void 0; } else { peg$currPos = s5; s5 = peg$FAILED; } if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c44(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseinteger_title() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseinteger(); if (s1 !== peg$FAILED) { s2 = peg$parsetitle(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c45(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecontext() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 31) { s1 = peg$c7; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c46) { s3 = peg$c46; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c47); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c48(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseps151_b() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 31) { s1 = peg$c7; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c8); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c49) { s3 = peg$c49; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c50); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c13(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseps151_bc() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parseps151_b(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c51) { s2 = peg$c51; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; if (peg$c53.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c54); } } peg$silentFails--; if (s4 === peg$FAILED) { s3 = void 0; } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c55(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseps151_bcv() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseps151_bc(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s2 = peg$c18; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s2 !== peg$FAILED) { s3 = peg$parseinteger(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c56(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsev_letter() { var s0, s1, s2, s3, s4, s5, s6, s7; s0 = peg$currPos; s1 = peg$parsev_explicit(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseinteger(); if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; if (input.substr(peg$currPos, 2) === peg$c40) { s5 = peg$c40; peg$currPos += 2; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c41); } } peg$silentFails--; if (s5 === peg$FAILED) { s4 = void 0; } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { if (peg$c57.test(input.charAt(peg$currPos))) { s5 = input.charAt(peg$currPos); peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c58); } } if (s5 !== peg$FAILED) { s6 = peg$currPos; peg$silentFails++; if (peg$c42.test(input.charAt(peg$currPos))) { s7 = input.charAt(peg$currPos); peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c43); } } peg$silentFails--; if (s7 === peg$FAILED) { s6 = void 0; } else { peg$currPos = s6; s6 = peg$FAILED; } if (s6 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsev() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsev_explicit(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseinteger(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c59(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsec_explicit() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 7) === peg$c60) { s2 = peg$c60; peg$currPos += 7; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c61); } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c62(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsev_explicit() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 5) === peg$c63) { s2 = peg$c63; peg$currPos += 5; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c64); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; if (peg$c42.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c43); } } peg$silentFails--; if (s4 === peg$FAILED) { s3 = void 0; } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { s4 = peg$parsesp(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c65(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecv_sep() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { s2 = []; if (input.charCodeAt(peg$currPos) === 58) { s3 = peg$c66; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c67); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); if (input.charCodeAt(peg$currPos) === 58) { s3 = peg$c66; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c67); } } } } else { s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s3 = peg$c18; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s7 = peg$c18; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s7 !== peg$FAILED) { s8 = peg$parsesp(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s9 = peg$c18; peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s9 !== peg$FAILED) { s6 = [s6, s7, s8, s9]; s5 = s6; } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = void 0; } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsecv_sep_weak() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (peg$c68.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c69); } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$parsespace(); } return s0; } function peg$parsesequence_sep() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = []; if (peg$c70.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c71); } } if (s2 === peg$FAILED) { s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s3 = peg$c18; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s7 = peg$c18; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s7 !== peg$FAILED) { s8 = peg$parsesp(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s9 = peg$c18; peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s9 !== peg$FAILED) { s6 = [s6, s7, s8, s9]; s5 = s6; } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = void 0; } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c72) { s2 = peg$c72; peg$currPos += 3; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c73); } } if (s2 === peg$FAILED) { s2 = peg$parsespace(); } } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c70.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c71); } } if (s2 === peg$FAILED) { s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s3 = peg$c18; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s3 !== peg$FAILED) { s4 = peg$currPos; peg$silentFails++; s5 = peg$currPos; s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s7 = peg$c18; peg$currPos++; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s7 !== peg$FAILED) { s8 = peg$parsesp(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s9 = peg$c18; peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s9 !== peg$FAILED) { s6 = [s6, s7, s8, s9]; s5 = s6; } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } peg$silentFails--; if (s5 === peg$FAILED) { s4 = void 0; } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c72) { s2 = peg$c72; peg$currPos += 3; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c73); } } if (s2 === peg$FAILED) { s2 = peg$parsespace(); } } } } } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c74(); } s0 = s1; return s0; } function peg$parserange_sep() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$currPos; if (peg$c75.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c76); } } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 === peg$FAILED) { s3 = peg$currPos; if (input.substr(peg$currPos, 4).toLowerCase() === peg$c77) { s4 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c78); } } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$currPos; if (peg$c75.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c76); } } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 === peg$FAILED) { s3 = peg$currPos; if (input.substr(peg$currPos, 4).toLowerCase() === peg$c77) { s4 = input.substr(peg$currPos, 4); peg$currPos += 4; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c78); } } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } } } else { s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsetitle() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parsecv_sep(); if (s1 === peg$FAILED) { s1 = peg$parsesequence_sep(); } if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 5) === peg$c79) { s2 = peg$c79; peg$currPos += 5; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c81(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsein_book_of() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 4) === peg$c82) { s2 = peg$c82; peg$currPos += 4; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c83); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c84) { s2 = peg$c84; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c85); } } if (s2 === peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c86) { s2 = peg$c86; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c87); } } } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s4 = peg$currPos; if (input.substr(peg$currPos, 3) === peg$c88) { s5 = peg$c88; peg$currPos += 3; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s5 !== peg$FAILED) { s6 = peg$parsesp(); if (s6 !== peg$FAILED) { if (input.substr(peg$currPos, 4) === peg$c90) { s7 = peg$c90; peg$currPos += 4; } else { s7 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c91); } } if (s7 !== peg$FAILED) { s8 = peg$parsesp(); if (s8 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c84) { s9 = peg$c84; peg$currPos += 2; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c85); } } if (s9 !== peg$FAILED) { s10 = peg$parsesp(); if (s10 !== peg$FAILED) { s5 = [s5, s6, s7, s8, s9, s10]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s1 = [s1, s2, s3, s4]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseabbrev() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s2 = peg$c18; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; s4 = peg$currPos; s5 = peg$parsesp(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s6 = peg$c18; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s6 !== peg$FAILED) { s7 = peg$parsesp(); if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s8 = peg$c18; peg$currPos++; } else { s8 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c19); } } if (s8 !== peg$FAILED) { s5 = [s5, s6, s7, s8]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } peg$silentFails--; if (s4 === peg$FAILED) { s3 = void 0; } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseeu_cv_sep() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s2 = peg$c15; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsetranslation_sequence_enclosed() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { if (peg$c92.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c93); } } if (s2 !== peg$FAILED) { s3 = peg$parsesp(); if (s3 !== peg$FAILED) { s4 = peg$currPos; s5 = peg$parsetranslation(); if (s5 !== peg$FAILED) { s6 = []; s7 = peg$currPos; s8 = peg$parsesequence_sep(); if (s8 !== peg$FAILED) { s9 = peg$parsetranslation(); if (s9 !== peg$FAILED) { s8 = [s8, s9]; s7 = s8; } else { peg$currPos = s7; s7 = peg$FAILED; } } else { peg$currPos = s7; s7 = peg$FAILED; } while (s7 !== peg$FAILED) { s6.push(s7); s7 = peg$currPos; s8 = peg$parsesequence_sep(); if (s8 !== peg$FAILED) { s9 = peg$parsetranslation(); if (s9 !== peg$FAILED) { s8 = [s8, s9]; s7 = s8; } else { peg$currPos = s7; s7 = peg$FAILED; } } else { peg$currPos = s7; s7 = peg$FAILED; } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } if (s4 !== peg$FAILED) { s5 = peg$parsesp(); if (s5 !== peg$FAILED) { if (peg$c94.test(input.charAt(peg$currPos))) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c95); } } if (s6 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c96(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsetranslation_sequence() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parsesp(); if (s1 !== peg$FAILED) { s2 = peg$currPos; if (input.charCodeAt(peg$currPos) === 44) { s3 = peg$c15; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s3 !== peg$FAILED) { s4 = peg$parsesp(); if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = peg$currPos; s4 = peg$parsetranslation(); if (s4 !== peg$FAILED) { s5 = []; s6 = peg$currPos; s7 = peg$parsesequence_sep(); if (s7 !== peg$FAILED) { s8 = peg$parsetranslation(); if (s8 !== peg$FAILED) { s7 = [s7, s8]; s6 = s7; } else { peg$currPos = s6; s6 = peg$FAILED; } } else { peg$currPos = s6; s6 = peg$FAILED; } while (s6 !== peg$FAILED) { s5.push(s6); s6 = peg$currPos; s7 = peg$parsesequence_sep(); if (s7 !== peg$FAILED) { s8 = peg$parsetranslation(); if (s8 !== peg$FAILED) { s7 = [s7, s8]; s6 = s7; } else { peg$currPos = s6; s6 = peg$FAILED; } } else { peg$currPos = s6; s6 = peg$FAILED; } } if (s5 !== peg$FAILED) { s4 = [s4, s5]; s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c96(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsetranslation() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 30) { s1 = peg$c97; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c98); } } if (s1 !== peg$FAILED) { s2 = peg$parseany_integer(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 30) { s3 = peg$c97; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c98); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c99(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseinteger() { var res; if (res = /^[0-9]{1,3}(?!\d|,000)/.exec(input.substr(peg$currPos))) { peg$savedPos = peg$currPos; peg$currPos += res[0].length; return {"type": "integer", "value": parseInt(res[0], 10), "indices": [peg$savedPos, peg$currPos - 1]} } else { return peg$FAILED; } } function peg$parseany_integer() { var s0, s1, s2; s0 = peg$currPos; s1 = []; if (peg$c53.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c54); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c53.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c54); } } } } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c102(s1); } s0 = s1; return s0; } function peg$parseword() { var s0, s1, s2; s0 = peg$currPos; s1 = []; if (peg$c103.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c104); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c103.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c104); } } } } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c105(s1); } s0 = s1; return s0; } function peg$parseword_parenthesis() { var s0, s1; s0 = peg$currPos; if (peg$c92.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c93); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c106(s1); } s0 = s1; return s0; } function peg$parsesp() { var s0; s0 = peg$parsespace(); if (s0 === peg$FAILED) { s0 = null; } return s0; } function peg$parsespace() { var res; if (res = /^[\s\xa0*]+/.exec(input.substr(peg$currPos))) { peg$currPos += res[0].length; return []; } return peg$FAILED; } peg$result = peg$startRuleFunction(); if (peg$result !== peg$FAILED && peg$currPos === input.length) { return peg$result; } else { if (peg$result !== peg$FAILED && peg$currPos < input.length) { peg$fail(peg$endExpectation()); } throw peg$buildStructuredError( peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) ); } } grammar = { SyntaxError: peg$SyntaxError, parse: peg$parse }; })(this); }).call(this);
const path = require('path'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const PATHS = { SRC: path.join(__dirname, 'src') }; const webpackConfig = { entry: ['./src/index.jsx'], plugins: [new ExtractTextPlugin('style.css')], devtool: 'source-map', node: { fs: 'empty' }, output: { path: __dirname, publicPath: '/', filename: 'bundle.js' }, module: { rules: [ { test: /\.(js|jsx)?$/, use: [ { loader: 'eslint-loader' } ], include: [PATHS.SRC], enforce: 'pre' }, { test: /\.jsx?$/, include: [path.resolve('src')], exclude: /node_modules/, use: [ { loader: 'babel-loader', options: { cacheDirectory: true } } ] }, { test: /\.css$/, use: ['style-loader', 'css-loader'] }, { test: /\.(woff|eot|ttf|woff2)$/, use: { loader: 'url-loader' } }, { test: /\.(jpg|gif|png|svg)$/, use: { loader: 'file-loader?name=[name].[hash].[ext]' } } ] }, resolve: { extensions: ['.js', '.jsx'] }, devServer: { historyApiFallback: true, contentBase: './' } }; module.exports = webpackConfig;
var ctx,canvasWidth,canvasHeight; var img_pyr; var img_ryp; var lowpass1, lowpass2; function demo_app(videoWidth, videoHeight) { savnac.width = canvas.width = videoWidth savnac.height = canvas.height = videoHeight vidWidth = videoWidth vidHeight = videoHeight // canvasWidth = canvas.width; // canvasHeight = canvas.height; ctx = canvas.getContext('2d'); xtc = savnac.getContext('2d') ctx.fillStyle = "rgb(0,255,0)"; ctx.strokeStyle = "rgb(0,255,0)"; var num_deep = 5; img_pyr = new color_pyr(videoWidth, videoHeight, num_deep) img_ryp = new color_pyr(videoWidth, videoHeight, num_deep) lowpass1 = new color_pyr(videoWidth, videoHeight, num_deep) lowpass2 = new color_pyr(videoWidth, videoHeight, num_deep) filtered = new color_pyr(videoWidth, videoHeight, num_deep) } function color_pyr(W, H, num_deep){ function init_pyr(){ var pyr = new jsfeat.pyramid_t(num_deep); pyr.allocate(W, H, jsfeat.F32_t | jsfeat.C1_t); return pyr; } this.levels = num_deep; this.W = W; this.H = H; this.Y = init_pyr(); this.U = init_pyr(); this.V = init_pyr(); } color_pyr.prototype.pyrDown = function(){ function downchan(chan){ var i = 2, a = chan.data[0], b = chan.data[1]; jsfeat.imgproc.pyrdown(a, b); for(; i < chan.levels; i++){ a = b; b = chan.data[i]; jsfeat.imgproc.pyrdown(a, b); // jsfeat.imgproc.pyrup(b, img_ryp.data[i - 1]) } } downchan(this.Y); downchan(this.U); downchan(this.V); } color_pyr.prototype.pyrUp = function(source){ function upchan(chan, schan){ for(var i = 1; i < chan.levels; i++){ jsfeat.imgproc.pyrup(schan.data[i], chan.data[i - 1]) } } upchan(this.Y, source.Y) upchan(this.U, source.U) upchan(this.V, source.V) } color_pyr.prototype.lpyrUp = function(source){ function lchan(chan, schan){ var inner = chan.data[chan.levels - 2]; for(var i = 0; i < inner.cols * inner.rows; i++){ inner.data[i] = 0; } for(var i = chan.levels - 1; i > 0; i--){ jsfeat.imgproc.pyrup(chan.data[i], chan.data[i - 1]) imadd(chan.data[i - 1], schan.data[i - 1]) } } lchan(this.Y, source.Y) lchan(this.U, source.U) lchan(this.V, source.V) } color_pyr.prototype.lpyrDown = function(source){ function lchan(chan, schan){ for(var i = 0; i < chan.levels - 1; i++){ imsub(schan.data[i], chan.data[i]) } } lchan(this.Y, source.Y) lchan(this.U, source.U) lchan(this.V, source.V) } color_pyr.prototype.iirFilter = function(source, r){ function iir(chan, schan){ for(var i = 0; i < chan.levels - 1; i++){ var lpl = chan.data[i], pyl = schan.data[i]; for(var j = 0; j < pyl.cols * pyl.rows; j++) { lpl.data[j] = (1 - r) * lpl.data[j] + r * pyl.data[j]; } } } iir(this.Y, source.Y) iir(this.U, source.U) iir(this.V, source.V) } color_pyr.prototype.setSubtract = function(a, b) { function subp(chan, chana, chanb){ for(var i = 0; i < b.levels; i++){ var al = chana.data[i], bl = chanb.data[i], cl = chan.data[i]; for(var j = 0; j < al.cols * al.rows; j++) { cl.data[j] = (al.data[j] - bl.data[j]) } } } subp(this.Y, a.Y, b.Y) subp(this.U, a.U, b.U) subp(this.V, a.V, b.V) } color_pyr.prototype.fromRGBA = function(src) { var w = src.width, h = src.height; for(var y = 0; y < h; y++){ for(var x = 0; x < w; x++){ var r = src.data[(y * w + x) * 4], g = src.data[(y * w + x) * 4 + 1], b = src.data[(y * w + x) * 4 + 2]; var Y = r * .299000 + g * .587000 + b * .114000, U = r * -.168736 + g * -.331264 + b * .500000 + 128, V = r * .500000 + g * -.418688 + b * -.081312 + 128; this.Y.data[0].data[y * w + x] = Y; this.U.data[0].data[y * w + x] = U; this.V.data[0].data[y * w + x] = V; } } } color_pyr.prototype.mulLevel = function(n, c){ function mul(chan){ var d = chan.data[n]; for(var i = 0; i < d.cols * d.rows; i++){ d.data[i] *= c; } } mul(this.Y); mul(this.U); mul(this.V); } function immul(n, chan, schan, c){ var d = chan.data[n], e = schan.data[n]; for(var i = 0; i < d.cols * d.rows; i++){ d.data[i] = c * d.data[i] + e.data[i]; } } color_pyr.prototype.exportLayer = function(layer, dest) { var Yp = this.Y.data[layer].data, Up = this.U.data[layer].data, Vp = this.V.data[layer].data, Dd = dest.data; var w = this.Y.data[layer].cols, h = this.Y.data[layer].rows; for(var y = 0; y < h; y++){ for(var x = 0; x < w; x++){ var i = y * w + x; var Y = Yp[i], U = Up[i], V = Vp[i]; var r = Y + 1.4075 * (V - 128), g = Y - 0.3455 * (U - 128) - (0.7169 * (V - 128)), b = Y + 1.7790 * (U - 128); var n = 4 * (y * dest.width + x); Dd[n] = r; Dd[n + 1] = g; Dd[n + 2] = b; Dd[n + 3] = 255; } } } color_pyr.prototype.exportLayerRGB = function(layer, dest) { var Yp = this.Y.data[layer].data, Up = this.U.data[layer].data, Vp = this.V.data[layer].data, Dd = dest.data; var w = this.Y.data[layer].cols, h = this.Y.data[layer].rows; for(var y = 0; y < h; y++){ for(var x = 0; x < w; x++){ var i = y * w + x; var Y = Yp[i], U = Up[i], V = Vp[i]; var n = 4 * (y * dest.width + x); Dd[n] = 127 + 10 * Y; Dd[n + 1] = 127 + 10 * U; Dd[n + 2] = 127 + 10 * V; Dd[n + 3] = 255; } } } color_pyr.prototype.toRGBA = function(dest) { for(var i = 0; i < this.levels; i++) this.exportLayerRGB(i, dest); } function imadd(a, b){ var a_d = a.data, b_d = b.data; var w = a.cols, h = a.rows, n = w * h; for(var i = 0; i < n; ++i){ a_d[i] = a_d[i] + b_d[i]; } } function imsub(a, b){ var a_d = a.data, b_d = b.data; var w = a.cols, h = a.rows, n = w * h; for(var i = 0; i < n; ++i){ b_d[i] = (b_d[i] - a_d[i]); } } var first_frame = true; function evm(){ var imageData = ctx.getImageData(0, 0, vidWidth, vidHeight); img_pyr.fromRGBA(imageData) img_pyr.pyrDown() img_ryp.pyrUp(img_pyr) img_pyr.lpyrDown(img_ryp) lowpass1.iirFilter(img_pyr, r1); lowpass2.iirFilter(img_pyr, r2); filtered.setSubtract(lowpass1, lowpass2); var delta = lambda_c / 8 / (1+alpha); var lambda = Math.sqrt(vidHeight * vidHeight + vidWidth * vidWidth) / 3; // for(var n = filtered.levels - 1; n >= 0; n--){ for(var n = 0; n < filtered.levels; n++) { var currAlpha = lambda / delta / 8 - 1; currAlpha *= exaggeration_factor; if(n <= 0 || n == filtered.levels - 1) { filtered.mulLevel(n, 0) }else if(currAlpha > alpha){ filtered.mulLevel(n, alpha) }else{ filtered.mulLevel(n, currAlpha) } lambda = lambda / 2; } img_ryp.lpyrUp(filtered) var blah = ctx.createImageData(vidWidth, vidHeight) filtered.toRGBA(blah) xtc.putImageData(blah, 0, 0); var merp = ctx.createImageData(vidWidth, vidHeight) // img_ryp.toRGBA(merp) img_pyr.fromRGBA(imageData) // img_pyr.addLevel(0, img_ryp) immul(0, img_ryp.Y, img_pyr.Y, 1) immul(0, img_ryp.U, img_pyr.U, chromAttenuation) immul(0, img_ryp.V, img_pyr.V, chromAttenuation) img_ryp.exportLayer(0, merp) ctx.putImageData(merp, 0, 0); } function clamp(n) { return Math.max(0, Math.min(255, n))}
import { curry, range, always } from 'ramda' const FALSE = always(false) export const makeGrid = curry((cell, size) => { const r = range(0, size) return r.map((y) => r.map((x) => cell(y, x))) }) export const makeBlankGrid = makeGrid(FALSE)
'use strict'; const resultsStorage = require('../lib/core/resultsStorage'); const moment = require('moment'); const expect = require('chai').expect; const timestamp = moment(); const timestampString = timestamp.format('YYYY-MM-DD-HH-mm-ss'); function createResultUrls(url, outputFolder, resultBaseURL) { return resultsStorage(url, timestamp, outputFolder, resultBaseURL).resultUrls; } describe('resultUrls', function() { describe('#hasBaseUrl', function() { it('should be false if base url is missing', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', undefined, undefined ); expect(resultUrls.hasBaseUrl()).to.be.false; }); it('should be true if base url is present', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', undefined, 'http://results.com' ); expect(resultUrls.hasBaseUrl()).to.be.true; }); }); describe('#reportSummaryUrl', function() { it('should create url with default output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', undefined, 'http://results.com' ); expect(resultUrls.reportSummaryUrl()).to.equal( `http://results.com/www.foo.bar/${timestampString}` ); }); it('should create url with absolute output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', '/root/leaf', 'http://results.com' ); expect(resultUrls.reportSummaryUrl()).to.equal('http://results.com/leaf'); }); it('should create url with relative output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', '../leaf', 'http://results.com' ); expect(resultUrls.reportSummaryUrl()).to.equal('http://results.com/leaf'); }); }); describe('#absoluteSummaryPageUrl', function() { it('should create url with default output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', undefined, 'http://results.com' ); expect( resultUrls.absoluteSummaryPageUrl('http://www.foo.bar/xyz') ).to.equal( `http://results.com/www.foo.bar/${ timestampString }/pages/www.foo.bar/xyz/` ); }); it('should create url with absolute output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', '/root/leaf', 'http://results.com' ); expect( resultUrls.absoluteSummaryPageUrl('http://www.foo.bar/xyz') ).to.equal('http://results.com/leaf/pages/www.foo.bar/xyz/'); }); it('should create url with relative output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', '../leaf', 'http://results.com' ); expect( resultUrls.absoluteSummaryPageUrl('http://www.foo.bar/xyz') ).to.equal('http://results.com/leaf/pages/www.foo.bar/xyz/'); }); }); describe('#relativeSummaryPageUrl', function() { it('should create url with default output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', undefined, 'http://results.com' ); expect( resultUrls.relativeSummaryPageUrl('http://www.foo.bar/xyz') ).to.equal('pages/www.foo.bar/xyz/'); }); it('should create url with absolute output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', '/root/leaf', 'http://results.com' ); expect( resultUrls.relativeSummaryPageUrl('http://www.foo.bar/xyz') ).to.equal('pages/www.foo.bar/xyz/'); }); it('should create url with relative output folder', function() { const resultUrls = createResultUrls( 'http://www.foo.bar', '../leaf', 'http://results.com' ); expect( resultUrls.relativeSummaryPageUrl('http://www.foo.bar/xyz') ).to.equal('pages/www.foo.bar/xyz/'); }); }); });
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery-ui //= require jquery_ujs //= require underscore-min //= require lumen/loader //= require lumen/bootswatch //= require bootstrap3-typeahead //= require bootstrap-datepicker //= require pages //= require airports //= require wishlists //= require base //= require reverse_geocoder // =require current_location //= require mapper //= require map_bounds //= require map
container_interval_id = 0; password_interval_id = 0; distro_image = 'ubuntu.svg'; // Shows a message // Leave text empty to hide message // error is a boolean deciding whether or not to add an error class function message(text, error) { var message = document.getElementById('message'); message.innerHTML = text; message.className = text ? (error ? 'error' : '') : 'hidden'; } // Shows an error function show_error(text) { message(text, true); // Stop the script on error throw new Error(); } // Center the main login container function centerContainer() { var container = document.getElementById("box"); // Set absolute top to be half of viewport height minus half of container height container.style.top = (document.documentElement.clientHeight / 2) - (container.offsetHeight / 2) + 'px'; // Set absolute left to be half of viewport width minus half of container width container.style.left = (document.documentElement.clientWidth / 2) - (container.offsetWidth / 2) + 'px'; } // Centers the main container on container resize // Time to build a custom resize event emulator thingy! function centerContainerOnResize() { onResize(document.getElementById('box'), centerContainer); } // Executes a callback when an element is resized function onResize(el, callback) { var width = el.offsetWidth; var height = el.offsetHeight; container_interval_id = setInterval(function() { // If the width or height don't match up if( el.offsetWidth != width || el.offsetHeight != height ) { // Remove the old task (with the old width/height) clearInterval(container_interval_id); // Execute the callback if(callback) callback(); // And bind a new resize event (this makes sure we're always checking against the new width/height) onResize(el, callback); } },250); } // This is called by lightdm when the auth request is completed function authentication_complete() { if (lightdm.is_authenticated) { lightdm.login (lightdm.authentication_user, lightdm.default_session); } else { message("Authentication failed", true); lightdm.cancel_authentication(); } } // Ignore requests for timed logins function timed_login(user) {} // Attempts to log in with lightdm // Executes on form submit function attemptLogin() { message("Logging in..."); // Cancel weird timed logins lightdm.cancel_timed_login(); // Pass on user to lightdm var user = document.getElementById('user').value; lightdm.start_authentication(user); } // Called by lightdm when it wants us to show a password prompt // We wait until this is called to sen dlightdm our password function show_prompt(text) { // Pass on password to lightdm once we have actually started authenticating if(password_interval_id > 0) clearInterval(password_interval_id); password_interval_id = setInterval(function() { var password = document.getElementById('password').value; lightdm.provide_secret(password); }, 250); } // Updates elements with content like time, etc. function initializeWidgets() { // Start up the clock initializeClockWidget(); // Start up the hostname widget initializeHostnameWidget(); // Start up the distro widget initializeDistroWidget(); } function initializeDistroWidget() { // If we have a distro image if(distro_image) { // Add in the distro logo var el = document.getElementById('distro-widget'); var img = document.createElement('img'); el.appendChild(img); img.src = 'img/distro/'+distro_image; // Center the form elements in #form after the image has loaded img.onload = function() { var form = document.getElementById('form'); var content = document.getElementById('content'); // Set #form top margin to half of #content height minus half of #form height form.style.marginTop = ((content.offsetHeight / 2) - (form.offsetHeight / 2)) + 'px'; } } } function initializeClockWidget() { updateClockWidget(); setInterval(updateClockWidget, 1000); } function initializeHostnameWidget() { var el = document.getElementById("hostname-widget"); el.innerHTML = lightdm.hostname; } function updateClockWidget() { var el = document.getElementById("clock-widget"); var date = new Date(); var days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']; var months = ['January','February','March','April','May','June','July','August','September','October','November','December']; var dateString = '<span>' + (date.getHours()<10?'0':'') + date.getHours() + ':' + (date.getMinutes()<10?'0':'') + date.getMinutes() + '</span> :: ' + days[date.getDay()] + ', <span>' + date.getDate() + '</span> ' + months[date.getMonth()]; el.innerHTML = dateString; } //If we have a logged in user, add his username to the user field function initializeUsers() { var el = document.getElementById('user'); // Loop through users for (var i = 0; i < lightdm.users.length; i++) { var user = lightdm.users[i]; if(user.logged_in) { el.value = user.name; } } } // Loads actions like suspend, reboot, etc. function initializeActions() { var el = document.getElementById('actions-inner'); el.innerHTML = ''; if (lightdm.can_suspend) { var node = document.createElement('a'); node.className = 'iconic moon_fill'; node.onclick = function(e) { lightdm.suspend(); e.stopPropagation(); e.preventDefault(true); return false; }; el.appendChild(node); } if (lightdm.can_restart) { var node = document.createElement('a'); node.className = 'iconic spin'; node.onclick = function(e) { lightdm.restart(); e.stopPropagation(); e.preventDefault(true); return false; }; el.appendChild(node); } if (lightdm.can_shutdown) { var node = document.createElement('a'); node.className = 'iconic x'; node.onclick = function(e) { lightdm.shutdown(); e.stopPropagation(); e.preventDefault(true); return false; }; el.appendChild(node); } } // Focuses the user field (if empty), else focuses the password field function handleFocus() { var user = document.getElementById('user'); if(user.value == 'undefined' || user.value == '') { user.focus(); }else{ document.getElementById('password').focus(); } } // Initializes the script (function initialize() { // Center container initially centerContainer(); // Center container again on container resize centerContainerOnResize(); // Update elements that contain informations like time, date, hostname, etc. initializeWidgets(); // Load the list of users initializeUsers(); // Load actions (suspend, reboot, shutdown, etc.) initializeActions(); // Handle focusing handleFocus(); })();
import test from 'ava'; import Nightmare from 'nightmare'; const nightmare = new Nightmare({ show: process.env.SHOW }); test('food', async t => { await nightmare .goto('http://localhost:3333'); const visible = await nightmare .click('#food') .wait(500) .visible('[class*=_box_]'); t.true(visible); const hidden = await nightmare .click('[class*=_buttonList_] li:last-child a') .wait(500) .visible('[class*=_box_]'); t.false(hidden); const completeFood = await nightmare .click('#food') .wait(1000) .click('[class*=_buttonList_] li:first-child a') .wait(1000) .click('[class*=_buttonList_] li:first-child a') // Meat .wait(1000) .click('[class*=_convenientList_] li:first-child a') // Beaf .click('[class*=_buttonList_] a') // Next .wait(1000) .click('[class*=_buttonList_] a') // I got it .wait(1000) .visible('[class*=_box_]'); t.false(completeFood); const completeFoodResult = await nightmare .evaluate(() => { return JSON.parse(document.getElementById('answer').innerText); }); t.is(completeFoodResult.type, 'Meat'); t.is(completeFoodResult.meat, 'beef'); const completeFoodUsingInput = await nightmare .click('#food') .wait(1000) .click('[class*=_buttonList_] li:first-child a') .wait(1000) .click('[class*=_buttonList_] li:first-child a') // Meat .wait(1000) .click('[class*=_convenientList_] li:last-child a') // Other .click('[class*=_buttonList_] a') // Next .wait(1000) .type('[class*=_convenientInput_]', 'foo') .click('[class*=_buttonList_] a') // Next .wait(1000) .click('[class*=_buttonList_] a') // I got it .wait(1000) .visible('[class*=_box_]'); t.false(completeFoodUsingInput); const completeFoodUsingInputResult = await nightmare .evaluate(() => { return JSON.parse(document.getElementById('answer').innerText); }); t.is(completeFoodUsingInputResult.type, 'Meat'); t.is(completeFoodUsingInputResult.meat, 'foo'); });
/** * Created by faspert on 28.04.2015. */ 'use strict'; angular.module('gardenApp') .directive('gvDygraph', function () { return { restrict: 'EAC', //E = element, A = attribute, C = class, M = comment scope: true , //use parent's scope //replace: 'true', // replace directive by template in html template: '<div id="graphdiv"></div>', link: function (scope, element, attrs) { //DOM manipulation console.log('testing the stuff'); var g = new Dygraph(element.children()[0], [[0,0]], { title: 'Temperature / Humidite', }); scope.$watch("data", function () { console.log('scope changes'); var options = scope.options; if (options === undefined) { options = {}; } //do not update if data is empty if (scope.data.length != 0) options.file = scope.data; console.log(scope.data) g.updateOptions(options); g.resetZoom(); g.resize(); }, true); } } });
'use strict'; //Setting up route angular.module('mean.system').config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { // For unmatched routes: $urlRouterProvider.otherwise('/'); // states for my app $stateProvider .state('home', { url: '/', templateUrl: 'public/system/views/index.html' }) .state('auth', { templateUrl: 'public/auth/views/index.html' }) .state('places', { url: '/places', templateUrl: 'public/system/views/places.html', reloadOnSearch: true, controller: 'PlacesController' }); } ]) .config(['$locationProvider', function($locationProvider) { $locationProvider.hashPrefix('!'); } ]);
module.exports = { extends: ["standard", "standard-react"], env: { browser: true, es6: true }, globals: { graphql: true }, plugins: ["class-property"], parser: "babel-eslint", rules: { indent: ["off"], "no-unused-vars": [ "error", { varsIgnorePattern: "React" } ], "jsx-quotes": ["error", "prefer-double"], "react/prop-types": "off", "react/jsx-uses-react": "error", "react/jsx-uses-vars": "error", "react/react-in-jsx-scope": "error", "space-before-function-paren": "off" } };
Rc4Random = function(seed) { var keySchedule = []; var keySchedule_i = 0; var keySchedule_j = 0; function init(seed) { for (var i = 0; i < 256; i++) { keySchedule[i] = i; } var j = 0; for (var i = 0; i < 256; i++) { j = (j + keySchedule[i] + seed.charCodeAt(i % seed.length)) % 256; var t = keySchedule[i]; keySchedule[i] = keySchedule[j]; keySchedule[j] = t; } } init(seed); function getRandomByte() { keySchedule_i = (keySchedule_i + 1) % 256; keySchedule_j = (keySchedule_j + keySchedule[keySchedule_i]) % 256; var t = keySchedule[keySchedule_i]; keySchedule[keySchedule_i] = keySchedule[keySchedule_j]; keySchedule[keySchedule_j] = t; return keySchedule[(keySchedule[keySchedule_i] + keySchedule[keySchedule_j]) % 256]; } this.getRandomNumber = function() { var number = 0; var multiplier = 1; for (var i = 0; i < 8; i++) { number += getRandomByte() * multiplier; multiplier *= 256; } return number / 18446744073709551616; } }
const TelegramBot = require('node-telegram-bot-api'); const EnchancedTelegramTest = require('./EnhancedTelegramTest'); const { track, trackInline } = require('../src/analytics'); const { initHandlers } = require('../src/handlers'); function createBot() { return new TelegramBot('0123456789abcdef', { webhook: true }); } function createTestServer(callback) { const bot = createBot(); const analytics = { track: (msg, name) => track(msg, name, callback), trackInline: msg => trackInline(msg, callback) }; initHandlers(bot, analytics); return new EnchancedTelegramTest(bot); } module.exports = { createBot, createTestServer };