├── .gitignore ├── favicon.ico ├── package.json ├── Gruntfile.js ├── Web.config ├── README.md ├── quranweb.sln ├── css └── site.css ├── js ├── quranclient.js ├── mousetrap.min.js ├── modernizr.js ├── site.js └── semantic-quran-web.min.js └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | node_modules 3 | *.log 4 | *.err 5 | -------------------------------------------------------------------------------- /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hasankhan/semantic-quran-web/HEAD/favicon.ico -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "semantic-quran-web", 3 | "version": "1.0.0", 4 | "description": "Web UI for Semantic Quran App", 5 | "main": "index.html", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "http://github.com/hasankhan/semantic-quran-web" 12 | }, 13 | "author": "Hasan Khan", 14 | "bugs": { 15 | "url": "https://github.com/hasankhan/semantic-quran-web/issues" 16 | }, 17 | "homepage": "http://semquran.com", 18 | "devDependencies": { 19 | "grunt": "~0.4.5", 20 | "grunt-contrib-uglify": "^0.6.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function (grunt) { 2 | 3 | // Project configuration. 4 | grunt.initConfig({ 5 | pkg: grunt.file.readJSON('package.json'), 6 | uglify: { 7 | options: { 8 | banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' 9 | }, 10 | build: { 11 | src: ['js/*.js', '!js/<%= pkg.name %>.min.js'], 12 | dest: 'js/<%= pkg.name %>.min.js' 13 | } 14 | }, 15 | jshint: { 16 | all: ['Gruntfile.js', 'js/quranclient.js', 'js/site.js'] 17 | } 18 | }); 19 | 20 | // Load the plugin that provides the "uglify" task. 21 | grunt.loadNpmTasks('grunt-contrib-uglify'); 22 | grunt.loadNpmTasks('grunt-contrib-jshint'); 23 | 24 | // Default task(s). 25 | grunt.registerTask('default', ['jshint', 'uglify']); 26 | 27 | }; -------------------------------------------------------------------------------- /Web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Semantic Quran 2 | ================== 3 | 4 | There are many verses in the Holy Quran that relate to certain topics but if we try to search for them based on keywords, we won't be able to find them because the search keyword may not be present in the translation of the verse itself. 5 | 6 | For example in verse [(94:6)](http://semquran.com#94/6) Allah (SWT) says, "Indeed, with hardship will be ease.". This verse is about hope and patience for believers who are in difficulty but the word 'hope' or 'patience' itself is not present in the verse and we won't be able to find this verse if we were to search for it. 7 | 8 | Tagging verses with words helps us categorize them in topics. This is useful in exploring Quran based on topics and identifying patterns and descriptions from Allah (SWT) about matters in a way not commonly used before. 9 | 10 | The website is hosted at: http://semquran.com 11 | 12 | ### Shortcuts ### 13 | 14 | * To directly visit a verse simply append hash (#) surah number and verse number to the url separated by slash e.g. http://semquran.com#3/2 would take you to verse 2 of surah 3. 15 | * To visit a range of verses replace the last number with a range e.g. http://semquran.com#3/2-5 would show you verse 2 to 5 of surah 3. 16 | * To see all verse for a given tag append search and keyword separated by slash e.g. http://semquran.com#search/heaven 17 | 18 | ### code ### 19 | This is a single page application (SPA) written using HTML5, JQuery Mobile and Backbone. The [backend](https://github.com/hasankhan/semantic-quran-api) is Azure Mobile Service based REST API. 20 | -------------------------------------------------------------------------------- /quranweb.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30501.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "quranweb", "http://localhost:21777", "{5BDB860E-A664-4C18-8BE2-05677B9BFAEA}" 7 | ProjectSection(WebsiteProperties) = preProject 8 | UseIISExpress = "true" 9 | TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0" 10 | Debug.AspNetCompiler.VirtualPath = "/localhost_21777" 11 | Debug.AspNetCompiler.PhysicalPath = "." 12 | Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_21777\" 13 | Debug.AspNetCompiler.Updateable = "true" 14 | Debug.AspNetCompiler.ForceOverwrite = "true" 15 | Debug.AspNetCompiler.FixedNames = "false" 16 | Debug.AspNetCompiler.Debug = "True" 17 | Release.AspNetCompiler.VirtualPath = "/localhost_21777" 18 | Release.AspNetCompiler.PhysicalPath = "." 19 | Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_21777\" 20 | Release.AspNetCompiler.Updateable = "true" 21 | Release.AspNetCompiler.ForceOverwrite = "true" 22 | Release.AspNetCompiler.FixedNames = "false" 23 | Release.AspNetCompiler.Debug = "False" 24 | SlnRelativePath = "." 25 | EndProjectSection 26 | EndProject 27 | Global 28 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 29 | Debug|Any CPU = Debug|Any CPU 30 | EndGlobalSection 31 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 32 | {5BDB860E-A664-4C18-8BE2-05677B9BFAEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 33 | {5BDB860E-A664-4C18-8BE2-05677B9BFAEA}.Debug|Any CPU.Build.0 = Debug|Any CPU 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /css/site.css: -------------------------------------------------------------------------------- 1 | .hidden { 2 | display: none !important; 3 | } 4 | 5 | h1 a, .ayahRef a, .tag a { 6 | text-decoration:none; 7 | font: inherit !important; 8 | color: inherit !important; 9 | } 10 | 11 | .result { 12 | background-color: beige; 13 | border: 1px solid black; 14 | border-top-width: 0; 15 | overflow: hidden 16 | } 17 | 18 | .result .ayahWrapper { 19 | text-align: right; 20 | padding: 10px; 21 | } 22 | 23 | .result .ayah { 24 | font-size: 35px; 25 | } 26 | 27 | .result .ayahRef { 28 | font-size: 25px; 29 | float: left; 30 | } 31 | 32 | .result .surahRef { 33 | cursor: pointer 34 | } 35 | 36 | .result .translation { 37 | font-size: 15px; 38 | padding-top: 5px; 39 | } 40 | 41 | li.tag { 42 | float: left; 43 | white-space: nowrap; 44 | display: inline-block; 45 | list-style-type: none; 46 | border: 1px solid gray; 47 | border-radius: 10px; 48 | background-color: beige; 49 | margin: 1px; 50 | font-size: 10px; 51 | text-align: center; 52 | } 53 | 54 | li.tag a, li.addTag { 55 | display: inline-block; 56 | width: 86px; 57 | padding: 5px; 58 | overflow: hidden; 59 | -ms-text-overflow: ellipsis; 60 | -o-text-overflow: ellipsis; 61 | text-overflow: ellipsis; 62 | } 63 | 64 | .loggedin-action { 65 | display: none; 66 | } 67 | 68 | .loggedin .loggedin-action { 69 | display: block; 70 | } 71 | 72 | li.addTag { 73 | background-color: lightgreen; 74 | display: none; 75 | cursor: pointer; 76 | } 77 | 78 | .loggedin li.addTag { 79 | display: inline-block; 80 | } 81 | 82 | span.delete { 83 | margin-right: 5px; 84 | color: red; 85 | cursor: pointer; 86 | } 87 | 88 | .loggedin span.delete { 89 | display: inline-block; 90 | } 91 | 92 | .results ul { 93 | float: right; 94 | } 95 | 96 | #recentlyAddedTags { 97 | display: inline-block; 98 | max-width: 300px; 99 | margin: 0 auto; 100 | padding: 10px; 101 | } 102 | 103 | #addTagDialogButton { 104 | max-width: 250px; 105 | margin: 0 auto; 106 | } 107 | 108 | #loadMore { 109 | display: none; 110 | } 111 | -------------------------------------------------------------------------------- /js/quranclient.js: -------------------------------------------------------------------------------- 1 | var QuranClient = (function () { 2 | 3 | function QuranClient(host, key) { 4 | this.host = host; 5 | 6 | var clientLoaded = typeof WindowsAzure !== 'undefined' && 7 | typeof WindowsAzure.MobileServiceClient !== 'undefined'; 8 | 9 | if (clientLoaded) { 10 | this.client = new WindowsAzure.MobileServiceClient(host, key); 11 | this.canLogin = true; 12 | } 13 | 14 | Object.defineProperty(this, 'loggedIn', { 15 | get: function () { 16 | return this.currentUser !== null; 17 | } 18 | }); 19 | 20 | Object.defineProperty(this, 'currentUser', { 21 | get: function () { 22 | return this.client ? this.client.currentUser : null; 23 | } 24 | }); 25 | } 26 | 27 | QuranClient.prototype.addTag = function (surah, verse, tag) { 28 | return this._post('tag/' + tag + '/' + surah + '/' + verse); 29 | }; 30 | 31 | QuranClient.prototype.removeTag = function (surah, verse, tag) { 32 | return this._del('tag/' + tag + '/' + surah + '/' + verse); 33 | }; 34 | 35 | QuranClient.prototype.findVersesByTag = function (tag) { 36 | return this._get('tag/' + tag); 37 | }; 38 | 39 | QuranClient.prototype.getVersesByRange = function (surah, start, end) { 40 | var path = 'verse/' + surah; 41 | 42 | if (start && end) { 43 | path += "/" + start + "-" + end; 44 | } 45 | else if (start) { 46 | path += "/" + start; 47 | } 48 | 49 | return this._get(path); 50 | }; 51 | 52 | QuranClient.prototype.listSurahs = function () { 53 | return this._get('surah'); 54 | }; 55 | 56 | QuranClient.prototype.listTags = function () { 57 | return this._get('tag'); 58 | }; 59 | 60 | QuranClient.prototype.login = function (provider, options) { 61 | if (this.client) { 62 | return this.client.loginWithOptions(provider, options); 63 | } 64 | }; 65 | 66 | QuranClient.prototype._onLoading = function (state) { 67 | if (typeof this.onLoading === 'function') { 68 | this.onLoading(state); 69 | } 70 | }; 71 | 72 | QuranClient.prototype._get = function (path) { 73 | return this._invoke(path, { 74 | method: 'get', 75 | }); 76 | }; 77 | 78 | QuranClient.prototype._post = function (path, body) { 79 | return this._invoke(path, { 80 | method: 'post', 81 | body: body 82 | }); 83 | }; 84 | 85 | QuranClient.prototype._del = function (path, body) { 86 | return this._invoke(path, { 87 | method: 'delete', 88 | body: body 89 | }); 90 | }; 91 | 92 | QuranClient.prototype._invoke = function (path, settings) { 93 | this._onLoading(true); 94 | 95 | var url = this.host + 'api/' + path, 96 | req = { 97 | type: settings.method.toUpperCase(), 98 | url: url, 99 | data: settings.body, 100 | headers: {} 101 | }; 102 | 103 | if (this.client && this.client.currentUser) { 104 | req.headers['x-zumo-auth'] = this.client.currentUser.mobileServiceAuthenticationToken; 105 | } 106 | 107 | var self = this; 108 | return $.ajax(req).always(function () { 109 | self._onLoading(false); 110 | }); 111 | }; 112 | 113 | return QuranClient; 114 | 115 | })(); -------------------------------------------------------------------------------- /js/mousetrap.min.js: -------------------------------------------------------------------------------- 1 | /* mousetrap v1.4.6 craig.is/killing/mice */ 2 | (function(J,r,f){function s(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent("on"+b,d)}function A(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return h[a.which]?h[a.which]:B[a.which]?B[a.which]:String.fromCharCode(a.which).toLowerCase()}function t(a){a=a||{};var b=!1,d;for(d in n)a[d]?b=!0:n[d]=0;b||(u=!1)}function C(a,b,d,c,e,v){var g,k,f=[],h=d.type;if(!l[a])return[];"keyup"==h&&w(a)&&(b=[a]);for(g=0;gg||h.hasOwnProperty(g)&&(p[h[g]]=g)}e=p[d]?"keydown":"keypress"}"keypress"==e&&f.length&&(e="keydown");return{key:c,modifiers:f,action:e}}function F(a,b,d,c,e){q[a+":"+d]=b;a=a.replace(/\s+/g," ");var f=a.split(" ");1":".","?":"/","|":"\\"},G={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p,l={},q={},n={},D,z=!1,I=!1,u=!1;for(f=1;20>f;++f)h[111+f]="f"+f;for(f=0;9>=f;++f)h[f+96]=f;s(r,"keypress",y);s(r,"keydown",y);s(r,"keyup",y);var m={bind:function(a,b,d){a=a instanceof Array?a:[a];for(var c=0;c 2 | 3 | Symantic Quran 4 | 5 | 6 | 17 | 18 | 19 |
20 |
21 | Menu 22 |

Semantic Quran

23 |

24 |
25 |
26 | 27 |
28 |
29 |
30 |
31 |
32 |
33 |
بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | 44 | 59 |
60 | 88 |
89 |
90 |

Please contribute a thoughtful tag for ayah

91 | 92 | 96 |
    97 |
    98 | Cancel 99 | Save 100 |
    101 |
    102 |
    103 |
    104 | 105 | 106 | 107 | 108 | 109 | 112 | 117 | 124 | 130 | 155 | 165 | 166 | -------------------------------------------------------------------------------- /js/site.js: -------------------------------------------------------------------------------- 1 | var client = new QuranClient('https://semantic-quran.azure-mobile.net/', 'okajHbuHsfhRmylXmwQgOKAsnmUyKG49'), 2 | verseNumPattern = /^(\d{1,3})(?:$|[ :/](\d{1,3})(?:$|-(\d{1,3})$))/, 3 | appView, 4 | LastSurah = 114; 5 | 6 | // Prevents all anchor click handling 7 | $.mobile.linkBindingEnabled = false; 8 | 9 | // Disabling this will prevent jQuery Mobile from handling hash changes 10 | $.mobile.hashListeningEnabled = false; 11 | 12 | var Workspace = Backbone.Router.extend({ 13 | routes: { 14 | '': 'viewPassage', 15 | 'search/:term': 'search', 16 | ':surah/:start-:end': 'viewPassage', 17 | ':surah/:start': 'viewPassage', 18 | ':surah': 'viewPassage', 19 | }, 20 | 21 | viewPassage: function (surah, start, end) { 22 | appView.mainView.doViewPassage(surah || 1, start, end); 23 | }, 24 | 25 | search: function (term) { 26 | appView.mainView.doSearch(term); 27 | } 28 | }); 29 | 30 | var AppView = Backbone.View.extend({ 31 | el: $('body'), 32 | 33 | initialize: function (client, router) { 34 | this.mainView = new MainView(client, router); 35 | router.on('route', function () { 36 | ga('send', 'pageview', Backbone.history.getFragment()); 37 | }); 38 | } 39 | }); 40 | 41 | var MainView = Backbone.View.extend({ 42 | el: $('#mainPage'), 43 | 44 | events: { 45 | 'click #menuBtn': 'toggleMenu', 46 | 'click #loginBtn': 'login', 47 | 'submit #searchForm': 'onSearchSubmit', 48 | 'submit #addTagForm': 'onAddTagFormSubmit', 49 | 'click #addTagDialogButton': 'onAddTagFormSubmit', 50 | 'click span.delete': 'onDelTagClick', 51 | 'click .addTag': 'onAddTagClick', 52 | 'click .recentTag': 'onRecentTagClick' 53 | }, 54 | 55 | initialize: function (client, router) { 56 | this.navPanel = $('#nav-panel'); 57 | this.searchBox = $('#search'); 58 | this.addTagPanel = $('#addTagPanel'); 59 | this.addTagForm = $('#addTagForm'); 60 | this.loginRow = $('#loginRow'); 61 | this.resultTemplate = _.template($('#result_template').html()); 62 | this.verseTagTemplate = _.template($('#verse_tag_template').html()); 63 | this.tagListTemplate = _.template($('#tag_list_template').html()); 64 | this.surahTitleTemplate = _.template($('#surah_title_template').html()); 65 | this.resultPane = $('#resultsPane'); 66 | this.mainPageHeading = $('#mainPageHeading'); 67 | this.surahSelector = $('#surahSelect'); 68 | this.preText = $('#preText'); 69 | this.addTagDialogTextBox = $('#addTagDialogTextBox'); 70 | this.tagsRecentlyAdded = []; 71 | this.surahList = []; 72 | this.nameSurahMap = {}; 73 | this.client = client; 74 | this.router = router; 75 | this.lastAddedTags = ''; 76 | 77 | this.client.onLoading = function (loading) { 78 | $.mobile.loading(loading ? 'show' : 'hide'); 79 | }; 80 | this.updateMRU(); 81 | this.loadRecentTags(); 82 | if (client.canLogin) { 83 | this.loginRow.removeClass('hidden'); 84 | } 85 | 86 | this.bindShortcuts(); 87 | this.loadSurahs(); 88 | 89 | var self = this; 90 | $(window).scroll(function () { 91 | if ($(window).scrollTop() + $(window).height() > $(document).height() - 100) { 92 | self.scrollMore(); 93 | } 94 | }); 95 | }, 96 | 97 | loadRecentTags: function() { 98 | if (Modernizr.localstorage && localStorage.tagsRecentlyAdded) { 99 | this.tagsRecentlyAdded = JSON.parse(localStorage.tagsRecentlyAdded); 100 | var container = $('#recentlyAddedTags').html(this.tagListTemplate({ 101 | tags: this.tagsRecentlyAdded, 102 | classes: 'recentTag' 103 | })); 104 | 105 | localStorage.tagsRecentlyAdded = JSON.stringify(this.tagsRecentlyAdded); 106 | } 107 | }, 108 | 109 | updateMRU: function () { 110 | var self = this; 111 | var lastUsedTags = $('#lastUsedTags'); 112 | client.listTags() 113 | .done(function (tags) { 114 | lastUsedTags.html(self.tagListTemplate({ 115 | tags: tags, 116 | classes: '' 117 | })); 118 | }); 119 | }, 120 | 121 | scrollMore: function() { 122 | if (!this.enableAutoScroll || 123 | this.currentSurah === 0 || 124 | this.surahList.length === 0 || 125 | this.ayahEnd >= this.surahList[this.currentSurah - 1].verses) { 126 | return; 127 | } 128 | 129 | this.ayahStart += 50; 130 | this.ayahEnd = Math.min(this.ayahEnd + 50, this.surahList[this.currentSurah - 1].verses); 131 | this.loadVerses(this.currentSurah, this.ayahStart, this.ayahEnd, false); 132 | }, 133 | 134 | onRecentTagClick: function(e) { 135 | var tag = $(e.currentTarget).data('tag'); 136 | var existing = this.addTagDialogTextBox.val(); 137 | if (existing) { 138 | tag = existing + ',' + tag; 139 | } 140 | this.addTagDialogTextBox.val(tag); 141 | return false; 142 | }, 143 | 144 | bindShortcuts: function () { 145 | var self = this; 146 | 147 | Mousetrap.bind('/', function () { 148 | self.searchBox.focus(); 149 | return false; 150 | }); 151 | Mousetrap.bind('q', function () { 152 | self.navPanel.panel('toggle'); 153 | }); 154 | Mousetrap.bind('l', this.login.bind(this)); 155 | Mousetrap.bind('t', this.onAddTagClick.bind(this, null)); 156 | Mousetrap.bind('d', this.onDelTagClick.bind(this, null)); 157 | Mousetrap.bind('r', this.onRepeatLastTags.bind(this)); 158 | Mousetrap.bind('n', this.nextSurah.bind(this)); 159 | Mousetrap.bind('p', this.previousSurah.bind(this)); 160 | }, 161 | 162 | previousSurah: function() { 163 | if (this.currentSurah > 1) { 164 | this.changeSurah(this.currentSurah - 1); 165 | } 166 | }, 167 | 168 | nextSurah: function() { 169 | if (this.currentSurah > 0 && this.currentSurah < LastSurah) { 170 | this.changeSurah(this.currentSurah + 1); 171 | } 172 | }, 173 | 174 | loadSurahs: function () { 175 | var self = this; 176 | 177 | var surahListTemplate = _.template($('#surah_list_template').html()); 178 | this.surahSelector.change(function () { 179 | var surah = self.surahSelector.val(); 180 | self.changeSurah(surah); 181 | }); 182 | this.client.listSurahs() 183 | .done(function (result) { 184 | self.surahList = result || []; 185 | self.surahList.forEach(function (surah) { 186 | self.nameSurahMap[surah.name.arabic.toLowerCase()] = surah.id; 187 | }); 188 | self.surahSelector.append(surahListTemplate({ surahs: self.surahList })); 189 | self.updateCurrentSurah(); 190 | }); 191 | }, 192 | 193 | changeSurah: function(surah) { 194 | if (surah === 0 || this.currentSurah == surah) { 195 | return; 196 | } 197 | 198 | this.router.navigate(surah.toString(), { trigger: true }); 199 | }, 200 | 201 | doViewPassage: function(surah, ayahStart, ayahEnd) { 202 | if (this.surahList.length > 0 && surah > this.surahList.length) { 203 | return; 204 | } 205 | 206 | this.currentSurah = surah; 207 | this.updateCurrentSurah(); 208 | this.enableAutoScroll = true; 209 | 210 | this.resultPane.empty(); 211 | this.loadVerses(surah, ayahStart, ayahEnd, true); 212 | 213 | this.ayahStart = ayahStart || 1; 214 | this.ayahEnd = ayahEnd || 50; 215 | }, 216 | 217 | onAddTagFormSubmit: function (e) { 218 | var data = this.addTagForm.data(); 219 | var tags = this.addTagDialogTextBox.val(); 220 | var surahNum = data.surah; 221 | var verseNum = data.verse; 222 | this.addTagDialogTextBox.val(''); 223 | 224 | this.addTags(surahNum, verseNum, tags); 225 | 226 | $('#addTagPanel').panel('close'); 227 | return false; 228 | }, 229 | 230 | addTags: function (surah, verse, tags) { 231 | var self = this; 232 | this.lastAddedTags = tags; 233 | 234 | if (tags !== null && tags.length > 0) { 235 | var values = tags.split(/[,;]/); 236 | $.each(values, function (i, value) { 237 | self.addTag(value, surah, verse).done(function (result) { 238 | console.log('Successfully Added: ' + result.text); 239 | 240 | // Update the local row 241 | var tagGroup = $('#tags' + surah + '_' + verse); 242 | var newTag = self.verseTagTemplate({ 243 | tag: result.text, 244 | surah: surah, 245 | verse: verse 246 | }); 247 | tagGroup.prepend(newTag); 248 | }); 249 | }); 250 | } 251 | }, 252 | 253 | addTag: function (val, surahNum, verseNum) { 254 | console.log('Adding tag: ' + val + ' to ' + '[' + surahNum + ':' + verseNum + ']'); 255 | 256 | // Add the tag to our recently added tags 257 | var isInList = false; 258 | $.each(this.tagsRecentlyAdded, function (i, entry) { 259 | if (entry === val) { 260 | isInList = true; 261 | return false; 262 | } 263 | }); 264 | 265 | if (!isInList) { 266 | this.tagsRecentlyAdded.unshift(val); 267 | this.tagsRecentlyAdded = this.tagsRecentlyAdded.slice(0, 10); 268 | this.loadRecentTags(); 269 | } 270 | 271 | return this.client.addTag(surahNum, verseNum, val); 272 | }, 273 | 274 | onRepeatLastTags: function (e) { 275 | if (!this.client.loggedIn || !this.lastAddedTags) { 276 | return; 277 | } 278 | 279 | var data = this.findCurrentVerse(e); 280 | if (!data || !data.surah || !data.verse) { 281 | return; 282 | } 283 | 284 | this.addTags(data.surah, data.verse, this.lastAddedTags); 285 | }, 286 | 287 | findCurrentVerse: function (e) { 288 | // find the verse currently hovered 289 | var data = $('.result:hover').first().data(); 290 | if (!data && e && e.currentTarget) { 291 | data = $(e.currentTarget).closest('.result').data(); 292 | } 293 | return data; 294 | }, 295 | 296 | onAddTagClick: function (e) { 297 | if (!this.client.loggedIn) { 298 | return; 299 | } 300 | 301 | var data = this.findCurrentVerse(e); 302 | if (!data || !data.surah || !data.verse) { 303 | return; 304 | } 305 | 306 | this.addTagForm.data('surah', data.surah); 307 | this.addTagForm.data('verse', data.verse); 308 | $('#addTagRef').text(data.surah + ':' + data.verse); 309 | var textBox = this.addTagDialogTextBox.val(''); 310 | 311 | this.addTagPanel.panel('open'); 312 | setTimeout(function () { 313 | textBox.focus(); 314 | }, 500); 315 | }, 316 | 317 | onDelTagClick: function (e) { 318 | if (!this.client.loggedIn) { 319 | return false; 320 | } 321 | 322 | // find the tag currently hovered 323 | var tagEl = $('li.tag:hover').first(); 324 | if (!tagEl && e && e.currentTarget) { 325 | tagEl = $(e.currentSurah).closest('li.tag'); 326 | } 327 | 328 | var data = tagEl.data(); 329 | if (!data || !data.tag || !data.surah || !data.verse) { 330 | return false; 331 | } 332 | 333 | var parent = tagEl.remove(); 334 | this.deleteTag(data.tag, data.surah, data.verse); 335 | 336 | return false; 337 | }, 338 | 339 | deleteTag: function (val, surahNum, verseNum) { 340 | console.log('Deleting tag: ' + val + ' to ' + '[' + surahNum + ':' + verseNum + ']'); 341 | 342 | this.client.removeTag(surahNum, verseNum, val) 343 | .done(function () { 344 | console.log('Successfully Deleted'); 345 | }); 346 | }, 347 | 348 | onSearchSubmit: function () { 349 | var val = this.searchBox.val(); 350 | if (val && val.length > 0) { 351 | this.router.navigate('search/' + val, { trigger: true }); 352 | } 353 | this.searchBox.val(''); 354 | 355 | return false; 356 | }, 357 | 358 | toggleMenu: function () { 359 | this.navPanel.panel('toggle'); 360 | }, 361 | 362 | login: function (e) { 363 | if (!this.client.canLogin) { 364 | return; 365 | } 366 | 367 | var self = this; 368 | client.login('facebook', { 369 | parameters: { 370 | display: 'popup' 371 | } 372 | }).done(function () { 373 | self.loginRow.hide(); 374 | self.$el.addClass('loggedin'); 375 | UserVoice.push(['identify', { 376 | id: client.currentUser.userId 377 | }]); 378 | }, function (err) { 379 | alert('Error: ' + err); 380 | }); 381 | }, 382 | 383 | doSearch: function(val) { 384 | var match = verseNumPattern.exec(val); 385 | if (match) { 386 | return this.doViewPassage(match[1], match[2], match[3]); 387 | } 388 | 389 | var surah = this.nameSurahMap[val.toLowerCase()]; 390 | if (surah) { 391 | return this.doViewPassage(surah); 392 | } 393 | 394 | var title = 'tag: ' + val; 395 | this.updateTitle(title); 396 | this.setCurrentSurah(0); 397 | this.enableAutoScroll = false; 398 | 399 | console.log('Doing search for: ' + val); 400 | this.resultPane.empty(); 401 | 402 | var self = this; 403 | this.client.findVersesByTag(val) 404 | .done(function (result) { 405 | self.updateTitle(title + ' - ' + result.length + ' result(s)'); 406 | self.loadResults(result || [], true); 407 | }); 408 | }, 409 | 410 | loadVerses: function(surah, start, end, animate) { 411 | var self = this; 412 | this.client.getVersesByRange(surah, start, end) 413 | .done(function (result) { 414 | self.loadResults(result || [], animate); 415 | }); 416 | }, 417 | 418 | updateCurrentSurah: function () { 419 | this.setCurrentSurah(this.currentSurah); 420 | if (this.currentSurah > 0 && this.surahList.length > 0) { 421 | var surah = this.surahList[this.currentSurah - 1]; 422 | var title = this.surahTitleTemplate(surah); 423 | this.updateTitle(title); 424 | } 425 | }, 426 | 427 | loadResults: function(data, animate) { 428 | this.resultPane.append(this.resultTemplate({ 429 | data: data, 430 | tagTemplate: this.verseTagTemplate 431 | })); 432 | 433 | if (animate) { 434 | window.scroll(0, 0); 435 | } 436 | }, 437 | 438 | updateTitle: function(title) { 439 | this.mainPageHeading.text(title); 440 | }, 441 | 442 | setCurrentSurah: function(surah) { 443 | if (surah > 0 && this.surahList.length > 0 && this.surahList[surah - 1].bismillah_pre) { 444 | this.preText.show(); 445 | } 446 | else { 447 | this.preText.hide(); 448 | } 449 | 450 | this.surahSelector.val(surah); 451 | this.surahSelector.selectmenu('refresh'); 452 | this.currentSurah = surah; 453 | } 454 | }); 455 | 456 | $(function () { 457 | appView = new AppView(client, new Workspace()); 458 | Backbone.history.start(); 459 | }); 460 | -------------------------------------------------------------------------------- /js/semantic-quran-web.min.js: -------------------------------------------------------------------------------- 1 | /*! semantic-quran-web 2014-11-13 */ 2 | !function(global){function require(a){a&&a.length>2&&"."==a[0]&&"/"==a[1]&&(a=a.slice(2));var b=$__modules__[a];if("function"==typeof b){var c={};return $__modules__[a]=c,b(c),c}if("object"==typeof b)return b;throw"Unknown module "+a}var $__modules__={},$__fileVersion__="1.2.21003.0";$__modules__.Resources={},$__modules__.Resources["en-US"]={Validate_NotNullError:"{0} cannot be null.",Validate_NotNullOrEmptyError:"{0} cannot be null or empty.",Validate_InvalidId:"{0} is not valid.",Validate_TypeCheckError:"{0} is expected to be a value of type {1}, not {2}.",Validate_LengthUnexpected:"{0} is expected to have length {1}, not {2}.",Validate_InvalidUserParameter:"{0} contains an invalid user-defined query string parameter: {1}. User-defined query string parameters must not begin with a '$'.",Extensions_DefaultErrorMessage:"Unexpected failure.",Extensions_ConnectionFailureMessage:"Unexpected connection failure.",MobileServiceTable_ReadMismatchedQueryTables:"Cannot get the results of a query for table '{1}' via table '{0}'.",MobileServiceTable_InsertIdAlreadySet:"Cannot insert if the {0} member is already set.",MobileServiceLogin_AuthenticationProviderNotSupported:"Unsupported authentication provider name. Please specify one of {0}.",MobileServiceLogin_LoginErrorResponse:"Cannot start a login operation because login is already in progress.",MobileServiceLogin_InvalidResponseFormat:"Invalid format of the authentication response.",MobileServiceLogin_InvalidProvider:"The first parameter must be the name of the autentication provider or a Microsoft Account authentication token.",MobileServiceTable_NotSingleObject:"Could not get object from response {0}.",Push_ConflictWithReservedName:"Template name conflicts with reserved name '{0}'.",Push_InvalidTemplateName:"Template name can't contain ';' or ':'.",Push_NotSupportedXMLFormatAsBodyTemplateWin8:"The bodyTemplate is not in accepted XML format. The first node of the bodyTemplate should be Badge/Tile/Toast, except for the wns/raw template, which need to be a valid XML.",Push_BodyTemplateMustBeXml:"Valid XML is required for any template without a raw header.",Push_TagNoCommas:"Tags must not contain ','."},$__modules__.MobileServiceClient=function(a){function b(a,b){f.isString(a,"applicationUrl"),f.notNullOrEmpty(a,"applicationUrl"),f.isString(b,"applicationKey"),this.applicationUrl=a,this.applicationKey=b||null;var c=g.getSdkInfo(),e=g.getOperatingSystemInfo(),j=c.fileVersion.split(".").slice(0,2).join(".");this.version="ZUMO/"+j+" (lang="+c.language+"; os="+e.name+"; os_version="+e.version+"; arch="+e.architecture+"; version="+c.fileVersion+")",this.currentUser=null,this._serviceFilter=null,this._login=new i(this),this.getTable=function(a){return f.isString(a,"tableName"),f.notNullOrEmpty(a,"tableName"),new h(a,this)},d&&(this.push=new d(this))}function c(){var a=null,b="MobileServices.Installation.config",c=g.readSetting(b);if(!e.isNull(c))try{var d=e.fromJson(c);a=d.applicationInstallationId}catch(f){}if(e.isNullOrEmpty(a)){a=e.createUniqueInstallationId();var h=e.toJson({applicationInstallationId:a});g.writeSetting(b,h)}return a}var d,e=require("Extensions"),f=require("Validate"),g=require("Platform"),h=require("MobileServiceTable").MobileServiceTable,i=require("MobileServiceLogin").MobileServiceLogin;try{d=require("Push").Push}catch(j){}var k={JsonApiCall:"AJ",GenericApiCall:"AG",AdditionalQueryParameters:"QS",OptimisticConcurrency:"OC",TableRefreshCall:"RF",TableReadRaw:"TR",TableReadQuery:"TQ"},l="X-ZUMO-FEATURES";a.MobileServiceClient=b,g.addToMobileServicesClientNamespace({MobileServiceClient:b}),b.prototype.withFilter=function(a){f.notNull(a,"serviceFilter");var c=new b(this.applicationUrl,this.applicationKey);c.currentUser=this.currentUser;var d=this._serviceFilter;return c._serviceFilter=e.isNull(d)?a:function(b,c,e){var f=function(a,b){d(a,c,b)};a(b,f,e)},c},b.prototype._request=function(a,c,d,h,i,j,k){e.isNull(k)&&"function"==typeof j&&(k=j,j=null),e.isNull(k)&&"function"==typeof i&&(k=i,i=null),e.isNull(k)&&"function"==typeof h&&(k=h,h=!1),e.isNull(k)&&"function"==typeof d&&(k=d,d=null),f.isString(a,"method"),f.notNullOrEmpty(a,"method"),f.isString(c,"uriFragment"),f.notNull(c,"uriFragment"),f.notNull(k,"callback");var m={type:a.toUpperCase()};m.url=e.url.isAbsoluteUrl(c)?c:e.url.combinePathSegments(this.applicationUrl,c),m.headers={},e.isNull(i)||e.extend(m.headers,i),m.headers["X-ZUMO-INSTALLATION-ID"]=b._applicationInstallationId,e.isNullOrEmpty(this.applicationKey)||(m.headers["X-ZUMO-APPLICATION"]=this.applicationKey),this.currentUser&&!e.isNullOrEmpty(this.currentUser.mobileServiceAuthenticationToken)&&(m.headers["X-ZUMO-AUTH"]=this.currentUser.mobileServiceAuthenticationToken),e.isNull(b._userAgent)||(m.headers["User-Agent"]=b._userAgent),e.isNullOrEmpty["X-ZUMO-VERSION"]||(m.headers["X-ZUMO-VERSION"]=this.version),e.isNull(m.headers[l])&&j&&j.length&&(m.headers[l]=j.join(",")),e.isNull(d)?m.data=null:(m.data=e.isString(d)?d:e.toJson(d),e.hasProperty(m.headers,["Content-Type","content-type","CONTENT-TYPE","Content-type"])||(m.headers["Content-Type"]="application/json"));var n=function(a,b){e.isNull(a)?!e.isNull(b)&&(b.status>=400||0===b.status)&&(a=e.createError(null,b),b=null):a=e.createError(a),k(a,b)};e.isNull(this._serviceFilter)||h?g.webRequest(m,n):this._serviceFilter(m,g.webRequest,n)},b.prototype.loginWithOptions=g.async(function(a,b,c){this._login.loginWithOptions(a,b,c)}),b.prototype.login=g.async(function(a,b,c,d){this._login.login(a,b,c,d)}),b.prototype.logout=function(){this.currentUser=null},b.prototype.invokeApi=g.async(function(a,b,c){f.isString(a,"apiName"),e.isNull(c)&&"function"==typeof b&&(c=b,b=null),f.notNull(c,"callback");var d,g,h,i;e.isNull(b)||(d=b.parameters,e.isNull(d)||f.isValidParametersObject(b.parameters),g=b.method,h=b.body,i=b.headers),e.isNull(g)&&(g="POST");var j=e.url.combinePathSegments("api",a);if(!e.isNull(d)){var l=e.url.getQueryString(d);j=e.url.combinePathAndQuery(j,l)}var m=[];e.isNullOrEmpty(h)||m.push(e.isString(h)?k.GenericApiCall:k.JsonApiCall),e.isNull(d)||m.push(k.AdditionalQueryParameters),this._request(g,j,h,null,i,m,function(a,b){if(e.isNull(a)){var d;if("undefined"!=typeof b.getResponseHeader&&(d=b.getResponseHeader("Content-Type")),d)-1!==d.toLowerCase().indexOf("json")&&(b.result=e.fromJson(b.responseText));else try{b.result=e.fromJson(b.responseText)}catch(f){}c(null,b)}else c(a,null)})}),b._applicationInstallationId=c(),b._userAgent=g.getUserAgent(),b._zumoFeatures=k},$__modules__.MobileServiceTable=function(a){function b(a,b){this.getTableName=function(){return a},this.getMobileServiceClient=function(){return b},this.systemProperties=0}function c(a){var b={};for(var c in a)"__"!==c.substr(0,2)&&(b[c]=a[c]);return b}function d(a,b,c){if(b===r.None||"string"==typeof c&&c.toLowerCase().indexOf("__systemproperties")>=0)return a;if(a=a||{},!j.isNull(a.__systemProperties))return a;if(b===r.All)a.__systemProperties="*";else{var d=[];r.CreatedAt&b&&d.push(s.CreatedAt),r.UpdatedAt&b&&d.push(s.UpdatedAt),r.Version&b&&d.push(s.Version),a.__systemProperties=d.join(",")}return a}function e(a){var b=j.fromJson(a.responseText);if(a.getResponseHeader){var c=a.getResponseHeader("ETag");j.isNullOrEmpty(c)||(b.__version=h(c))}return b}function f(a){a.request&&412===a.request.status&&(a.serverInstance=j.fromJson(a.request.responseText))}function g(a){var b=a.replace(/\"/g,'\\"');return'"'+b+'"'}function h(a){var b=a.length,c=a;return b>1&&'"'===a[0]&&'"'===a[b-1]&&(c=a.substr(1,b-2)),c.replace(/\\\"/g,'"')}function i(a,b){var c=!1;if(b)if(Array.isArray(b))c=b.length>0;else if(j.isObject(b))for(var d in b){c=!0;break}return c&&a.push(WindowsAzure.MobileServiceClient._zumoFeatures.AdditionalQueryParameters),a}var j=require("Extensions"),k=require("Validate"),l=require("Platform"),m=require("Query").Query,n="id",o="tables",p=["ID","Id","id","iD"],q=/^(.*?);\s*rel\s*=\s*(\w+)\s*$/,r={None:0,CreatedAt:1,UpdatedAt:2,Version:4,All:65535},s={CreatedAt:"__createdAt",UpdatedAt:"__updatedAt",Version:"__version"};l.addToMobileServicesClientNamespace({MobileServiceTable:{SystemProperties:r}}),a.MobileServiceTable=b,b.prototype._read=function(a,b,c){j.isNull(c)&&(j.isNull(b)&&"function"==typeof a?(c=a,a=null,b=null):"function"==typeof b&&(c=b,b=null,!j.isNull(a)&&j.isObject(a)&&!j.isString(a)&&j.isNull(a.toOData)&&(b=a,a=null))),a&&j.isString(a)&&k.notNullOrEmpty(a,"query"),j.isNull(b)||k.isValidParametersObject(b,"parameters"),k.notNull(c,"callback");var e=this.getTableName(),f=null,g=null,h=[];if(j.isString(a))f=a,j.isNullOrEmpty(a)||h.push(WindowsAzure.MobileServiceClient._zumoFeatures.TableReadRaw);else if(j.isObject(a)&&!j.isNull(a.toOData)&&a.getComponents){h.push(WindowsAzure.MobileServiceClient._zumoFeatures.TableReadQuery);var m=a.getComponents();if(g=m.projection,m.table){if(e!==m.table){var n=j.format(l.getResourceString("MobileServiceTable_ReadMismatchedQueryTables"),e,m.table);return void c(j.createError(n),null)}var p=a.toOData();f=p.replace(new RegExp("^/"+m.table),"")}}if(i(h,b),b=d(b,this.systemProperties,f),!j.isNull(b)){var r=j.url.getQueryString(b);j.isNullOrEmpty(f)?f=r:f+="&"+r}var s=f;j.url.isAbsoluteUrl(s)||(s=j.url.combinePathSegments(o,e),j.isNull(f)||(s=j.url.combinePathAndQuery(s,f))),this.getMobileServiceClient()._request("GET",s,null,!1,null,h,function(a,b){var d=null;if(j.isNull(a)){if(d=j.fromJson(b.responseText),d&&!Array.isArray(d)&&"undefined"!=typeof d.count&&"undefined"!=typeof d.results&&(d.results.totalCount=d.count,d=d.results),null!==g){var e=0;for(e=0;e=g&&(0===h.length?(e._storageManager.deleteAllRegistrations(),d()):d(c.createError("Failed to delete registrations for "+a)))})})};d.notNull(a,"pushHandle"),this._refreshRegistrations(f||a,function(d){c.isNullOrEmpty(f)||a===f?g(d,b):g(d,function(){e._refreshRegistrations(a,function(a){g(a,b)})})})}),b.prototype.listRegistrations=e.async(function(a,b){d.notNullOrEmpty(a),this._pushHttpClient.listRegistrations(a,this._platform,b)}),b.prototype._refreshRegistrations=function(a,b){var c=this;d.notNull(a,"pushHandle"),d.notNull(b,"callback"),this._pushHttpClient.listRegistrations(a,this._platform,function(d,e){d||c._storageManager.updateAllRegistrations(e,a),b(d)})}},$__modules__.LocalStorageManager=function(a){function b(a){this._registrations={},this._storageKey="MobileServices.Push."+a,this._isRefreshNeeded=!1,Object.defineProperty(this,"isRefreshNeeded",{get:function(){return this._isRefreshNeeded}}),this._pushHandle=null,Object.defineProperty(this,"pushHandle",{get:function(){return c.isNull(this._pushHandle)?"":this._pushHandle},set:function(a){d.notNullOrEmpty(a,"pushHandle"),this._pushHandle!==a&&(this._pushHandle=a,this._flushToSettings())}}),this._initializeRegistrationInfoFromStorage()}var c=require("Extensions"),d=require("Validate"),e=require("Platform"),f={Version:"v1.1.0",Keys:{Version:"Version",PushHandle:"ChannelUri",Registrations:"Registrations",NativeRegistration:"$Default"}};a.LocalStorageManager=b,b.NativeRegistrationName=f.Keys.NativeRegistration,b.prototype.getRegistrationIds=function(){var a=[];for(var b in this._registrations)this._registrations.hasOwnProperty(b)&&a.push(this._registrations[b]);return a},b.prototype.getRegistrationIdWithName=function(a){return d.notNullOrEmpty(a,"registrationName"),this._registrations[a]},b.prototype.updateAllRegistrations=function(a,b){d.notNull(b,"pushHandle"),a||(a=[]),this._registrations={};for(var e=0;e=0||window.navigator.userAgent.indexOf("Trident")>=0,i=h&&b(g,f),j=h?"iframe":"postMessage";if(a+=-1==a.indexOf("?")?"?":"&",a+="completion_type="+j+"&completion_origin="+encodeURIComponent(f),!f||0!==f.indexOf("http:")&&0!==f.indexOf("https:")){var k="Login is only supported from http:// or https:// URLs. Please host your page in a web server.";return void e(k,null)}var l=window.open(a,"_blank","location=no"),m=function(a,b){window.clearInterval(o),l.close(),window.removeEventListener?window.removeEventListener("message",n):window.detachEvent("onmessage",n),i&&i.parentNode.removeChild(i),e(a,b)},n=function(a){var b=h?i.contentWindow:l;if(a.source===b){var c;try{c=JSON.parse(a.data)}catch(d){return}c&&"LoginCompleted"===c.type&&(c.oauth||c.error)&&m(c.error,c.oauth)}},o=window.setInterval(function(){l&&l.closed===!0&&m("canceled",null)},250);return window.addEventListener?window.addEventListener("message",n,!1):window.attachEvent("onmessage",n),{cancelCallback:function(){return m("canceled",null),!0}}}},$__modules__.CordovaPopup=function(a){function b(){return window.cordova&&window.cordova.version}function c(){var a=b().match(/^(\d+).(\d+)./);if(a){var c=Number(a[1]),d=Number(a[2]),e=h;return c>e.major||c===e.major&&d>=e.minor}return!1}function d(){return!window.open}function e(a){var b=f(a,"#token="),c=f(a,"#error=");return{oAuthToken:b?JSON.parse(b):null,error:c}}function f(a,b){var c=a.indexOf(b);return 0>c?null:decodeURIComponent(a.substring(c+b.length))}function g(){for(var a=("webkitTransform"in document.documentElement.style?"-webkit-":""),b=12,c="",d=0;b>d;d++)c+="
    ";return["","","
    "+c+"
    ","",""].join("").replace(/-prefix-/g,a) 3 | }var h={major:3,minor:0};a.supportsCurrentRuntime=function(){return!!b()},a.login=function(a,f,i){var j=b();if(!c(j)){var k="Not a supported version of Cordova. Detected: "+j+". Required: "+h.major+"."+h.minor;throw new Error(k)}if(!d){var k='A required plugin: "org.apache.cordova.inappbrowser" was not detected.';throw new Error(k)}var l="",m="data:text/html,"+encodeURIComponent(g()+l);setTimeout(function(){var a=window.open(m,"_blank","location=no"),b=!1,c=function(c){if(!b&&0===c.url.indexOf(f)){b=!0,setTimeout(function(){a.close()},500);var d=e(c.url);i(d.error,d.oAuthToken)}};a.addEventListener("loadstart",c),a.addEventListener("loadstop",c),a.addEventListener("exit",function(){b||(b=!0,i("UserCancelled",null))})},500)}},$__modules__.Extensions=function(a){function b(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var c=require("Validate"),d=require("Platform"),e=a;a.isNull=function(a){return null===a||void 0===a},a.isNullOrZero=function(a){return null===a||void 0===a||0===a||""===a},a.isNullOrEmpty=function(a){return e.isNull(a)||0===a.length},a.format=function(a){if(c.isString(a,"message"),!e.isNullOrEmpty(a)&&arguments.length>1)for(var b=1;b255||0===a.trim().length)return!1;var b=/[+"\/?`\\]|[\u0000-\u001F]|[\u007F-\u009F]|^\.{1,2}$/;return null!==a.match(b)?!1:!0}return e.isNumber(a)?a>0:!1},a.isString=function(a){return e.isNull(a)||"string"==typeof a},a.isNumber=function(a){return!e.isNull(a)&&"number"==typeof a},a.isBool=function(a){return!e.isNull(a)&&"boolean"==typeof a},a.isDate=function(a){return!e.isNull(a)&&"date"==b(a)},a.toJson=function(a){return d.toJson(a)},a.fromJson=function(b){var c=null;return e.isNullOrEmpty(b)||(c=JSON.parse(b,function(b,c){if(e.isString(c)&&!e.isNullOrEmpty(c)){var d=a.tryParseIsoDateString(c);if(!e.isNull(d))return d}return c})),c},a.createUniqueInstallationId=function(){var a=function(a){return"0000".substring(a.length)+a},b=function(){return a(Math.floor(65536*Math.random()).toString(16))};return b()+b()+"-"+b()+"-"+b()+"-"+b()+"-"+b()+b()+b()},a.mapProperties=function(a,b){var c=[];if(!e.isNull(a)){var d=null;for(d in a)c.push(b(d,a[d]))}return c},a.pad=function(a,b,d){c.notNull(a,"value"),c.isInteger(b,"length"),c.isString(d,"ch"),c.notNullOrEmpty(d,"ch"),c.length(d,1,"ch");for(var e=a.toString();e.length=0&&a[d]===b;)d--;return d>=0?a.substr(0,d+1):""},a.trimStart=function(a,b){c.isString(a,"text"),c.notNull(a,"text"),c.isString(b,"ch"),c.notNullOrEmpty(b,"ch"),c.length(b,1,"ch");for(var d=0;d=0?b+"&"+a.trimStart(d,"?"):b+"?"+a.trimStart(d,"?"))},isAbsoluteUrl:function(a){if(e.isNullOrEmpty(a))return!1;var b=a.substring(0,7).toLowerCase();return"http://"==b||"https:/"==b}},a.tryParseIsoDateString=function(a){return d.tryParseIsoDateString(a)},a.createError=function(a,b){var c={message:d.getResourceString("Extensions_DefaultErrorMessage")};if(c.toString=function(){return c.message},b)if(c.request=b,0===b.status)c.message=d.getResourceString("Extensions_ConnectionFailureMessage");else{var f=!1;if(b.getResponseHeader){var g=b.getResponseHeader("Content-Type");g&&(f=g.toLowerCase().indexOf("text")>=0)}try{var h=JSON.parse(b.responseText);c.message="string"==typeof h?h:h.error||h.description||b.statusText||d.getResourceString("Extensions_DefaultErrorMessage")}catch(i){c.message=f?b.responseText:b.statusText||d.getResourceString("Extensions_DefaultErrorMessage")}}else e.isString(a)&&!e.isNullOrEmpty(a)?c.message=a:e.isNull(a)||(c.exception=a);return c}},$__modules__.PostMessageExchange=function(a){function b(){var a=this;a._lastMessageId=0,a._hasListener=!1,a._pendingMessages={}}function c(a){var b=d(a),c=b.port?b.port.toString():null,e="http:"===b.protocol&&"80"===c||"https:"===b.protocol&&"443"===c,f=c&&!e?":"+c:"";return b.protocol+"//"+b.hostname+f}function d(a){var b=global.document.createElement("a");return b.href=a,b}var e=require("Promises"),f=3e5;b.prototype.request=function(a,b,c){var d=this,g=++d._lastMessageId,h={messageId:g,contents:b};return d._ensureHasListener(),new e.Promise(function(b,e){d._pendingMessages[g]={messageId:g,complete:b,error:e,targetWindow:a,origin:c},d._pendingMessages[g].timeoutId=global.setTimeout(function(){var a=d._pendingMessages[g];a&&(delete d._pendingMessages[g],a.error({status:0,statusText:"Timeout",responseText:null}))},f),a.postMessage(JSON.stringify(h),c)})},b.prototype._ensureHasListener=function(){if(!this._hasListener){this._hasListener=!0;var a=this,b=function(){a._handleMessage.apply(a,arguments)};window.addEventListener?window.addEventListener("message",b,!1):window.attachEvent("onmessage",b)}},b.prototype._handleMessage=function(a){var b=this._tryDeserializeMessage(a.data),d=b&&b.messageId,e=d&&this._pendingMessages[d],f=e&&e.targetWindow===a.source&&e.origin===c(a.origin);f&&(global.clearTimeout(e.timeoutId),delete this._pendingMessages[d],e.complete(b.contents))},b.prototype._tryDeserializeMessage=function(a){if(!a||"string"!=typeof a)return null;try{return JSON.parse(a)}catch(b){return null}},a.instance=new b,a.getOriginRoot=c},$__modules__.Promises=function(a){!function(a){"use strict";function b(a){this._callbackFrames=[],this._resolutionState=null,this._resolutionValueOrError=null,this._resolveSuccess=d(this._resolveSuccess,this),this._resolveError=d(this._resolveError,this),a&&a(this._resolveSuccess,this._resolveError)}var c={success:{},error:{}},d=function(a,b){return function(){a.apply(b,arguments)}},e=function(a){return a&&"function"==typeof a.then};b.prototype.then=function(a,c){var d={success:a,error:c,chainedPromise:new b};return this._resolutionState?this._invokeCallback(d):this._callbackFrames.push(d),d.chainedPromise},b.prototype._resolveSuccess=function(a){this._resolve(c.success,a)},b.prototype._resolveError=function(a){this._resolve(c.error,a)},b.prototype._resolve=function(a,b){if(!this._resolutionState){this._resolutionState=a,this._resolutionValueOrError=b;for(var c=0,d=this._callbackFrames.length;d>c;c++)this._invokeCallback(this._callbackFrames[c])}},b.prototype._invokeCallback=function(a){var b=this._resolutionState===c.success?a.success:a.error;"function"==typeof b?setTimeout(d(function(){var d,f,g=!0;try{d=b(this._resolutionValueOrError),f=c.success}catch(h){g=!1,d=h,f=c.error}g&&e(d)?d.then(a.chainedPromise._resolveSuccess,a.chainedPromise._resolveError):a.chainedPromise._resolve(f,d)},this),1):a.chainedPromise._resolve(this._resolutionState,this._resolutionValueOrError)},b.prototype.done=function(a,b){return void this.then(a,b).then(null,function(a){setTimeout(function(){throw new Error(a)},1)})},a.Promise=b}(a)},$__modules__.Validate=function(a){var b=require("Extensions"),c=require("Platform");a.notNull=function(a,d){if(b.isNull(a))throw b.format(c.getResourceString("Validate_NotNullError"),d||"Value")},a.notNullOrEmpty=function(a,d){if(b.isNullOrEmpty(a))throw b.format(c.getResourceString("Validate_NotNullOrEmptyError"),d||"Value")},a.notNullOrZero=function(a,d){if(b.isNullOrZero(a))throw b.format(c.getResourceString("Validate_NotNullOrEmptyError"),d||"Value")},a.isValidId=function(a,d){if(!b.isValidId(a))throw b.format(c.getResourceString("Validate_InvalidId"),d||"id")},a.isDate=function(d,e){if(a.notNull(d,e),!b.isDate(d))throw b.format(c.getResourceString("Validate_TypeCheckError"),e||"Value","Date",typeof d)},a.isNumber=function(d,e){if(a.notNull(d,e),!b.isNumber(d))throw b.format(c.getResourceString("Validate_TypeCheckError"),e||"Value","Number",typeof d)},a.isValidParametersObject=function(d,e){a.notNull(d,e),a.isObject(d,e);for(var f in d)if(0===f.indexOf("$"))throw b.format(c.getResourceString("Validate_InvalidUserParameter"),e,f)},a.isInteger=function(d,e){if(a.notNull(d,e),a.isNumber(d,e),parseInt(d,10)!==parseFloat(d))throw b.format(c.getResourceString("Validate_TypeCheckError"),e||"Value","number",typeof d)},a.isString=function(a,d){if(!b.isString(a))throw b.format(c.getResourceString("Validate_TypeCheckError"),d||"Value","string",typeof a)},a.isObject=function(a,d){if(!b.isObject(a))throw b.format(c.getResourceString("Validate_TypeCheckError"),d||"Value","object",typeof a)},a.isArray=function(a,d){if(!Array.isArray(a))throw b.format(c.getResourceString("Validate_TypeCheckError"),d||"Value","array",typeof a)},a.length=function(d,e,f){if(a.notNull(d,f),a.isInteger(e,"length"),d.length!==e)throw b.format(c.getResourceString("Validate_LengthUnexpected"),f||"Value",e,d.length)}},$__modules__.JavaScript=function(a){(function(){var b,c,d,e,f;f=require("esprima"),b=require("./JavaScriptNodes"),e=require("./PartialEvaluator").PartialEvaluator,d=require("./JavaScriptToQueryVisitor").JavaScriptToQueryVisitor,a.JavaScript=c=function(){function a(){}return a.transformConstraint=function(b,c){var f,g;return f=a.getExpression(b,c),f.expression=e.evaluate(f),g=new d(f),g.visit(f.expression)},a.getProjectedFields=function(){return[]},a.getExpression=function(a,b){var c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;if(j="var _$$_stmt_$$_ = "+a+";",i=f.parse(j,{range:!0}),d="Program"===(null!=i?i.type:void 0)&&1===(null!=i&&null!=(m=i.body)?m.length:void 0)&&"VariableDeclaration"===(null!=(n=i.body[0])?n.type:void 0)&&1===(null!=(s=i.body[0])&&null!=(t=s.declarations)?t.length:void 0)&&"VariableDeclarator"===(null!=(u=i.body[0].declarations[0])?u.type:void 0)&&"FunctionExpression"===(null!=(v=i.body[0].declarations[0])&&null!=(w=v.init)?w.type:void 0)&&"BlockStatement"===(null!=(x=i.body[0].declarations[0].init)&&null!=(y=x.body)?y.type:void 0)&&1===(null!=(z=i.body[0].declarations[0].init.body)&&null!=(o=z.body)?o.length:void 0)&&"ReturnStatement"===(null!=(p=i.body[0].declarations[0].init.body.body[0])?p.type:void 0)&&(null!=(q=i.body[0].declarations[0].init.body.body[0])?q.argument:void 0),!d)throw"Expected a predicate with a single return statement, not "+a;if(h=null!=(r=i.body[0].declarations[0].init.params)?r.map(function(a){return a.name}):void 0,h.length>b.length)throw"Expected value(s) for parameter(s) "+h.slice(b.length);if(b.length>h.length)throw"Expected parameter(s) for value(s) "+b.slice(h.length);for(c={},e=k=0,l=h.length;l>k;e=++k)g=h[e],c[g]=b[e];return{source:j,expression:d,environment:c}},a}()}).call(this)},$__modules__.JavaScriptNodes=function(a){(function(){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,$={}.hasOwnProperty,_=function(a,b){function c(){this.constructor=a}for(var d in b)$.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};Z=require("./Node"),F=Z.Node,W=Z.Visitor,a.JavaScriptNode=y=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b}(F),a.JavaScriptVisitor=z=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b.prototype.JavaScriptNode=function(a){return a},b}(W),a.Program=J=function(a){function b(a){this.elements=a,b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.Program=function(a){return a=this.JavaScriptNode(a),a.elements=this.visit(a.elements),a},a.Function=t=function(a){function b(a,c,d){this.id=a,this.params=c,this.body=d,b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.Function=function(a){return a=this.JavaScriptNode(a),a.id=this.visit(a.id),a.params=this.visit(a.params),a.body=this.visit(a.body),a},a.Statement=M=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.Statement=function(a){return a=this.JavaScriptNode(a)},a.EmptyStatement=o=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.EmptyStatement=function(a){return a=this.JavaScriptNode(a)},a.BlockStatement=f=function(a){function b(a){this.body=a,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.BlockStatement=function(a){return a=this.Statement(a),a.body=this.visit(a.body),a},a.ExpressionStatement=q=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.ExpressionStatement=function(a){return a=this.Statement(a)},a.IfStatement=x=function(a){function b(a,c,d){this.test=a,this.consequent=c,this.alternate=d,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.IfStatement=function(a){return a=this.Statement(a),a.test=this.visit(a.test),a.consequent=this.visit(a.consequent),a.alternate=this.visit(a.alternate),a},a.LabeledStatement=A=function(a){function b(a,c){this.label=a,this.body=c,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.LabeledStatement=function(a){return a=this.Statement(a),a.label=this.visit(a.label),a.body=this.visit(a.body),a},a.BreakStatement=g=function(a){function b(a){this.label=a,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.BreakStatement=function(a){return a=this.Statement(a),a.label=this.visit(a.label),a},a.ContinueStatement=k=function(a){function b(a){this.label=a,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.ContinueStatement=function(a){return a=this.Statement(a),a.label=this.visit(a.label),a},a.WithStatement=Y=function(a){function b(a,c){this.object=a,this.body=c,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.WithStatement=function(a){return a=this.Statement(a),a.object=this.visit(a.object),a.body=this.visit(a.body),a},a.SwitchStatement=O=function(a){function b(a,c){this.discriminant=a,this.cases=c,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.SwitchStatement=function(a){return a=this.Statement(a),a.discriminant=this.visit(a.discriminant),a.cases=this.visit(a.cases),a},a.ReturnStatement=K=function(a){function b(a){this.argument=a,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.ReturnStatement=function(a){return a=this.Statement(a),a.argument=this.visit(a.argument),a},a.ThrowStatement=Q=function(a){function b(a){this.argument=a,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.ThrowStatement=function(a){return a=this.Statement(a),a.argument=this.visit(a.argument),a},a.TryStatement=R=function(a){function b(a,c,d){this.block=a,this.handlers=c,this.finalizer=d,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.TryStatement=function(a){return a=this.Statement(a),a.block=this.visit(a.block),a.handlers=this.visit(a.handlers),a.finalizer=this.visit(a.finalizer),a},a.WhileStatement=X=function(a){function b(a,c){this.test=a,this.body=c,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.WhileStatement=function(a){return a=this.Statement(a),a.test=this.visit(a.test),a.body=this.visit(a.body),a},a.DoWhileStatement=n=function(a){function b(a,c){this.body=a,this.test=c,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.DoWhileStatement=function(a){return a=this.Statement(a),a.body=this.visit(a.body),a.test=this.visit(a.test),a},a.ForStatement=s=function(a){function b(a,c,d,e){this.init=a,this.test=c,this.update=d,this.body=e,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.ForStatement=function(a){return a=this.Statement(a),a.init=this.visit(a.init),a.test=this.visit(a.test),a.update=this.visit(a.update),a.body=this.visit(a.body),a},a.ForInStatement=r=function(a){function b(a,c,d){this.left=a,this.right=c,this.body=d,b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.ForInStatement=function(a){return a=this.Statement(a),a.left=this.visit(a.left),a.right=this.visit(a.right),a.body=this.visit(a.body),a},a.DebuggerStatement=l=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.DebuggerStatement=function(a){return a=this.Statement(a)},a.Declaration=m=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b}(M),z.prototype.Declaration=function(a){return a=this.Statement(a)},a.FunctionDeclaration=u=function(a){function b(a,c,d){this.id=a,this.params=c,this.body=d,b.__super__.constructor.call(this)}return _(b,a),b}(m),z.prototype.FunctionDeclaration=function(a){return a=this.Declaration(a),a.id=this.visit(a.id),a.params=this.visit(a.params),a.body=this.visit(a.body),a},a.VariableDeclaration=U=function(a){function b(a,c){this.declarations=a,this.kind=c,b.__super__.constructor.call(this)}return _(b,a),b}(m),z.prototype.VariableDeclaration=function(a){return a=this.Declaration(a),a.declarations=this.visit(a.declarations),a},a.VariableDeclarator=V=function(a){function b(a,c){this.id=a,this.init=c,b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.VariableDeclarator=function(a){return a=this.JavaScriptNode(a),a.id=this.visit(a.id),a.init=this.visit(a.init),a},a.Expression=p=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return _(b,a),b.prototype.constuctor=function(){return b.__super__.constuctor.call(this)},b}(y),z.prototype.Expression=function(a){return a=this.JavaScriptNode(a)},a.ThisExpression=P=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.ThisExpression=function(a){return a=this.Expression(a)},a.ArrayExpression=b=function(a){function b(a){this.elements=a,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.ArrayExpression=function(a){return a=this.Expression(a),a.elements=this.visit(a.elements),a},a.ObjectExpression=G=function(a){function b(a){this.properties=a,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.ObjectExpression=function(a){var b,c,d,e;for(a=this.Expression(a),e=a.properties,c=0,d=e.length;d>c;c++)b=e[c],b.key=this.visit(b.key),b.value=this.visit(b.value);return a},a.FunctionExpression=v=function(a){function b(a,c,d){this.id=a,this.params=c,this.body=d,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.FunctionExpression=function(a){return a=this.Expression(a),a.id=this.visit(a.id),a.params=this.visit(a.params),a.body=this.visit(a.body),a},a.SequenceExpression=L=function(a){function b(a){this.expressions=a,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.SequenceExpression=function(a){return a=this.Expression(a),a.expressions=this.visit(a.expressions),a},a.UnaryExpression=S=function(a){function b(a,c,d){this.operator=a,this.prefix=c,this.argument=d,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.UnaryExpression=function(a){return a=this.Expression(a),a.argument=this.visit(a.argument),a},a.BinaryExpression=e=function(a){function b(a,c,d){this.operator=a,this.left=c,this.right=d,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.BinaryExpression=function(a){return a=this.Expression(a),a.left=this.visit(a.left),a.right=this.visit(a.right),a},a.AssignmentExpression=d=function(a){function b(a,c,d){this.operator=a,this.left=c,this.right=d,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.AssignmentExpression=function(a){return a=this.Expression(a),a.left=this.visit(a.left),a.right=this.visit(a.right),a},a.UpdateExpression=T=function(a){function b(a,c,d){this.operator=a,this.argument=c,this.prefix=d,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.UpdateExpression=function(a){return a=this.Expression(a),a.argument=this.visit(a.argument),a},a.LogicalExpression=C=function(a){function b(a,c,d){this.operator=a,this.left=c,this.right=d,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.LogicalExpression=function(a){return a=this.Expression(a),a.left=this.visit(a.left),a.right=this.visit(a.right),a},a.ConditionalExpression=j=function(a){function b(a,c,d){this.test=a,this.alternate=c,this.consequent=d,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.ConditionalExpression=function(a){return a=this.Expression(a),a.test=this.visit(a.test),a.alternate=this.visit(a.alternate),a.consequent=this.visit(a.consequent),a},a.NewExpression=E=function(a){function b(a,c){this.callee=a,this.arguments=c,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.NewExpression=function(a){return a=this.Expression(a),a.callee=this.visit(a.callee),a.arguments=this.visit(a.arguments),a},a.CallExpression=h=function(a){function b(a,c){this.callee=a,this.arguments=c,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.CallExpression=function(a){return a=this.Expression(a),a.callee=this.visit(a.callee),a.arguments=this.visit(a.arguments),a},a.MemberExpression=D=function(a){function b(a,c,d){this.object=a,this.property=c,this.computed=d,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.MemberExpression=function(a){return a=this.Expression(a),a.object=this.visit(a.object),a.property=this.visit(a.property),a},a.Pattern=I=function(a){function b(){b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.Pattern=function(a){return a=this.JavaScriptNode(a)},a.ObjectPattern=H=function(a){function b(a){this.properties=a,b.__super__.constructor.call(this)}return _(b,a),b}(I),z.prototype.ObjectPattern=function(a){var b,c,d,e;for(a=this.Pattern(a),e=a.properties,c=0,d=e.length;d>c;c++)b=e[c],b.key=this.visit(b.key),b.value=this.visit(b.value);return a},a.ArrayPattern=c=function(a){function b(a){this.elements=a,b.__super__.constructor.call(this)}return _(b,a),b}(I),z.prototype.ArrayPattern=function(a){return a=this.Pattern(a),a.elements=this.visit(a.elements),a},a.SwitchCase=N=function(a){function b(a,c){this.test=a,this.consequent=c,b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.SwitchCase=function(a){return a=this.JavaScriptNode(a),a.test=this.visit(a.test),a.consequent=this.visit(a.consequent),a},a.CatchClause=i=function(a){function b(a,c){this.param=a,this.body=c,b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.CatchClause=function(a){return a=this.JavaScriptNode(a),a.param=this.visit(a.param),a.body=this.visit(a.body),a},a.Identifier=w=function(a){function b(a){this.name=a,b.__super__.constructor.call(this)}return _(b,a),b}(y),z.prototype.Identifier=function(a){return a=this.JavaScriptNode(a)},a.Literal=B=function(a){function b(a){this.value=a,b.__super__.constructor.call(this)}return _(b,a),b}(p),z.prototype.Literal=function(a){return a=this.Expression(a)}}).call(this)},$__modules__.JavaScriptToQueryVisitor=function(a){(function(){var b,c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};e=require("./Utilities"),b=require("./JavaScriptNodes"),d=require("./QueryNodes"),a.JavaScriptToQueryVisitor=c=function(a){function b(a){this.context=a}return g(b,a),b.prototype.getSource=function(a){var b,c;return this.context.source.slice(null!=a&&null!=(b=a.range)?b[0]:void 0,+((null!=a&&null!=(c=a.range)?c[1]:void 0)-1)+1||9e9)},b.prototype.invalid=function(a){throw"The expression '"+this.getSource(a)+"'' is not supported."},b.prototype.translateUnary=function(a,b){var c,e;return c=b[a.operator],c?(e=this.visit(a.argument),new d.UnaryExpression(c,e)):null},b.prototype.translateBinary=function(a,b){var c,e,f;return e=b[a.operator],e?(c=this.visit(a.left),f=this.visit(a.right),new d.BinaryExpression(e,c,f)):null},b.prototype.visit=function(a){var c;return c=b.__super__.visit.call(this,a),a===c&&this.invalid(a),c},b.prototype.MemberExpression=function(a){var c;return c=function(){var b,c,e,f;return"ThisExpression"===(null!=a&&null!=(b=a.object)?b.type:void 0)&&"Identifier"===(null!=a&&null!=(c=a.property)?c.type:void 0)?new d.MemberExpression(a.property.name):"MemberExpression"===(null!=a&&null!=(e=a.object)?e.type:void 0)&&"ThisExpression"===(null!=(f=a.object.object)?f.type:void 0)&&"Identifier"===a.property.type&&"length"===a.property.name?new d.InvocationExpression(d.Methods.Length,new d.MemberExpression(a.object.property.name)):void 0}(),null!=c?c:b.__super__.MemberExpression.call(this,a)},b.prototype.Literal=function(a){return new d.ConstantExpression(a.value)},b.prototype.UnaryExpression=function(a){var c,e;return"+"===a.operator?this.visit(a.argument):(c={"!":d.UnaryOperators.Not,"-":d.UnaryOperators.Negate},null!=(e=this.translateUnary(a,c))?e:b.__super__.UnaryExpression.call(this,a))},b.prototype.UpdateExpression=function(a){var c,e;return c={"++":d.UnaryOperators.Increment,"--":d.UnaryOperators.Decrement},null!=(e=this.translateUnary(a,c))?e:b.__super__.UpdateExpression.call(this,a)},b.prototype.LogicalExpression=function(a){var c,e;return c={"&&":d.BinaryOperators.And,"||":d.BinaryOperators.Or},null!=(e=this.translateBinary(a,c))?e:b.__super__.LogicalExpression.call(this,a)},b.prototype.BinaryExpression=function(a){var c,f,g,h,i,j,k;return g={"+":d.BinaryOperators.Add,"-":d.BinaryOperators.Subtract,"*":d.BinaryOperators.Multiply,"/":d.BinaryOperators.Divide,"%":d.BinaryOperators.Modulo,">":d.BinaryOperators.GreaterThan,">=":d.BinaryOperators.GreaterThanOrEqual,"<":d.BinaryOperators.LessThan,"<=":d.BinaryOperators.LessThanOrEqual,"!=":d.BinaryOperators.NotEqual,"!==":d.BinaryOperators.NotEqual,"==":d.BinaryOperators.Equal,"===":d.BinaryOperators.Equal},function(){var l,m;return null!=(k=this.translateBinary(a,g))?k:"in"===a.operator&&"Literal"===(null!=(l=a.right)?l.type:void 0)&&e.isArray(null!=(m=a.right)?m.value:void 0)?a.right.value.length>0?(f=this.visit(a.left),d.QueryExpression.groupClauses(d.BinaryOperators.Or,function(){var b,g,k,l;for(k=a.right.value,l=[],b=0,g=k.length;g>b;b++){if(j=k[b],e.isObject(j)){if(h=function(){var a;a=[];for(c in j)i=j[c],a.push(i);return a}(),1!==(null!=h?h.length:void 0))throw"in operator requires comparison objects with a single field, not "+j+" ("+JSON.stringify(j)+"), for expression '"+this.getSource(a)+"'";j=h[0]}l.push(new d.BinaryExpression(d.BinaryOperators.Equal,f,new d.ConstantExpression(j)))}return l}.call(this))):new d.BinaryExpression(d.BinaryOperators.Equal,new d.ConstantExpression(!0),new d.ConstantExpression(!1)):b.__super__.BinaryExpression.call(this,a)}.call(this)},b.prototype.CallExpression=function(a){var c,e,f,g,h,i,j;return f=function(b){return function(c){var d;if(1!==(null!=(d=a.arguments)?d.length:void 0))throw"Function "+c+" expects one argument in expression '"+b.getSource(a)+"'";return b.visit(a.arguments[0])}}(this),g=function(b){return function(c,d){var e;if(2!==(null!=(e=a.arguments)?e.length:void 0))throw"Function "+d+" expects two arguments in expression '"+b.getSource(a)+"'";return[c,b.visit(a.arguments[0]),b.visit(a.arguments[1])]}}(this),e=null!=a&&null!=(j=a.callee)?j.value:void 0,c=function(){var b,c,j,k,l,m,n;if(e===Math.floor)return new d.InvocationExpression(d.Methods.Floor,[f("floor")]);if(e===Math.ceil)return new d.InvocationExpression(d.Methods.Ceiling,[f("ceil")]);if(e===Math.round)return new d.InvocationExpression(d.Methods.Round,[f("round")]);if("MemberExpression"===a.callee.type&&(null!=(b=a.callee.object)?b.__hasThisExp:void 0)===!0){if(h="CallExpression"===(null!=a&&null!=(c=a.callee)&&null!=(j=c.object)?j.type:void 0)?this.visit(a.callee.object):new d.MemberExpression(null!=(k=a.callee.object)&&null!=(l=k.property)?l.name:void 0),i=null!=(m=a.callee)&&null!=(n=m.property)?n.name:void 0,"toUpperCase"===i)return new d.InvocationExpression(d.Methods.ToUpperCase,[h]);if("toLowerCase"===i)return new d.InvocationExpression(d.Methods.ToLowerCase,[h]);if("trim"===i)return new d.InvocationExpression(d.Methods.Trim,[h]);if("indexOf"===i)return new d.InvocationExpression(d.Methods.IndexOf,[h,f("indexOf")]);if("concat"===i)return new d.InvocationExpression(d.Methods.Concat,[h,f("concat")]);if("substring"===i||"substr"===i)return new d.InvocationExpression(d.Methods.Substring,g(h,"substring"));if("replace"===i)return new d.InvocationExpression(d.Methods.Replace,g(h,"replace"));if("getFullYear"===i||"getUTCFullYear"===i)return new d.InvocationExpression(d.Methods.Year,[h]);if("getYear"===i)return new d.BinaryExpression(d.BinaryOperators.Subtract,new d.InvocationExpression(d.Methods.Year,[h]),new d.ConstantExpression(1900));if("getMonth"===i||"getUTCMonth"===i)return new d.BinaryExpression(d.BinaryOperators.Subtract,new d.InvocationExpression(d.Methods.Month,[h]),new d.ConstantExpression(1));if("getDate"===i||"getUTCDate"===i)return new d.InvocationExpression(d.Methods.Day,[h])}}.call(this),null!=c?c:b.__super__.CallExpression.call(this,a)},b}(b.JavaScriptVisitor)}).call(this)},$__modules__.Node=function(a){(function(){var b,c,d;d=require("./Utilities"),a.Node=b=function(){function a(){this.type=d.functionName(this.constructor)}return a.prototype.type="Node",a}(),a.Visitor=c=function(){function a(){}return a.prototype.visit=function(a){var b,c,e,f;if(d.isArray(a)){for(f=[],c=0,e=a.length;e>c;c++)b=a[c],f.push(this.visit(b));return f}if(null!=a?a.type:void 0){if(d.isFunction(this[a.type]))return this[a.type](a);throw"Unsupported expression "+this.getSource(a)}return a},a.prototype.getSource=function(){return null},a}()}).call(this)},$__modules__.ODataProvider=function(a){(function(){var b,c,d,e,f,g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};f=require("./Utilities"),d=require("./QueryNodes"),e=require("./Query").Query,a.ODataProvider=c=function(){function a(){}return a.prototype.toQuery=function(a){var b,c,d;return b=this.toOData(a,!0),d="/"+b.table,c="?",b.filters&&(d+=""+c+"$filter="+b.filters,c="&"),b.ordering&&(d+=""+c+"$orderby="+b.ordering,c="&"),b.skip&&(d+=""+c+"$skip="+b.skip,c="&"),(b.take||0===b.take)&&(d+=""+c+"$top="+b.take,c="&"),b.selections&&(d+=""+c+"$select="+b.selections,c="&"),b.includeTotalCount&&(d+=""+c+"$inlinecount=allpages"),d},a.prototype.toOData=function(a,c){var d,e,f,g,h,i,j;return null==c&&(c=!1),e=null!=(i=null!=a?a.getComponents():void 0)?i:{},h=function(){var a,b;a=null!=e?e.ordering:void 0,b=[];for(f in a)d=a[f],b.push(d?f:""+f+" desc");return b}(),g={table:null!=e?e.table:void 0,filters:b.convert(e.filters,c),ordering:null!=h?h.toString():void 0,skip:null!=e?e.skip:void 0,take:null!=e?e.take:void 0,selections:null!=e&&null!=(j=e.selections)?j.toString():void 0,includeTotalCount:null!=e?e.includeTotalCount:void 0}},a.prototype.fromOData=function(a,b,c,d,f,g,h){var i,j,k,l,m,n,o,p,q,r,s,t;for(l=new e(a),b&&l.where(b),(d||0===d)&&l.skip(d),(f||0===f)&&l.take(f),h&&l.includeTotalCount(),r=null!=(q=null!=g?g.split(","):void 0)?q:[],m=0,o=r.length;o>m;m++)j=r[m],l.select(j.trim()); 4 | for(s=function(){var a,b,d,e,f;for(e=null!=(d=null!=c?c.split(","):void 0)?d:[],f=[],a=0,b=e.length;b>a;a++)k=e[a],f.push(k.trim().split(" "));return f}(),n=0,p=s.length;p>n;n++)t=s[n],j=t[0],i=t[1],"DESC"!==(null!=i?i.toUpperCase():void 0)?l.orderBy(j):l.orderByDescending(j);return l},a}(),b=function(a){function b(a){this.encodeForUri=a}return h(b,a),b.convert=function(a,c){var d,e;return d=new b(c),null!=(e=a?d.visit(a):void 0)?e:null},b.prototype.toOData=function(a){var b;if(f.isNumber(a)||f.isBoolean(a))return a.toString();if(f.isString(a))return a=a.replace(/'/g,"''"),null!=this.encodeForUri&&this.encodeForUri===!0&&(a=encodeURIComponent(a)),"'"+a+"'";if(f.isDate(a))return b=JSON.stringify(a),b.length>2&&(b=b.slice(1,+(b.length-2)+1||9e9)),b=b.replace(/(T\d{2}:\d{2}:\d{2})Z$/,function(b,c){var d;return d=String(a.getMilliseconds()+1e3).substring(1),""+c+"."+d+"Z"}),"datetime'"+b+"'";if(a)throw"Unsupported literal value "+a;return"null"},b.prototype.ConstantExpression=function(a){return this.toOData(a.value)},b.prototype.MemberExpression=function(a){return a.member},b.prototype.UnaryExpression=function(a){if(a.operator===d.UnaryOperators.Not)return"not "+this.visit(a.operand);if(a.operator===d.UnaryOperators.Negate)return"(0 sub "+this.visit(a.operand)+")";throw"Unsupported operator "+a.operator},b.prototype.BinaryExpression=function(a){var b,c;if(b={And:"and",Or:"or",Add:"add",Subtract:"sub",Multiply:"mul",Divide:"div",Modulo:"mod",GreaterThan:"gt",GreaterThanOrEqual:"ge",LessThan:"lt",LessThanOrEqual:"le",NotEqual:"ne",Equal:"eq"},c=b[a.operator])return"("+this.visit(a.left)+" "+c+" "+this.visit(a.right)+")";throw"Unsupported operator "+a.operator},b.prototype.InvocationExpression=function(a){var b,c;if(b={Length:"length",ToUpperCase:"toupper",ToLowerCase:"tolower",Trim:"trim",IndexOf:"indexof",Replace:"replace",Substring:"substring",Concat:"concat",Day:"day",Month:"month",Year:"year",Floor:"floor",Ceiling:"ceiling",Round:"round"},c=b[a.method])return""+c+"("+this.visit(a.args)+")";throw"Invocation of unsupported method "+a.method},b.prototype.LiteralExpression=function(a){var b,c,d,e,f,g;for(d="",c=!1,g=a.queryString,e=0,f=g.length;f>e;e++)if(b=g[e],c)d+=b,c="'"!==b;else if("?"===b){if(!a.args||a.args.length<=0)throw"Too few arguments for "+a.queryString+".";d+=this.toOData(a.args.shift())}else"'"===b?(d+=b,c=!0):d+=b;if(a.args&&a.args.length>0)throw"Too many arguments for "+a.queryString;return d},b}(d.QueryExpressionVisitor)}).call(this)},$__modules__.PartialEvaluator=function(exports){(function(){var IndependenceNominator,JS,PartialEvaluator,_,__hasProp={}.hasOwnProperty,__extends=function(a,b){function c(){this.constructor=a}for(var d in b)__hasProp.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};_=require("./Utilities"),JS=require("./JavaScriptNodes"),exports.PartialEvaluator=PartialEvaluator=function(_super){function PartialEvaluator(a){this.context=a}return __extends(PartialEvaluator,_super),PartialEvaluator.prototype.visit=function(node){var key,params,source,thunk,value,values,_ref,_ref1,_ref2,_ref3;return node.__independent&&"Literal"!==node.type&&node.type?"Identifier"===node.type&&this.context.environment[node.name]?new JS.Literal(this.context.environment[node.name]):(source=this.context.source.slice(null!=node&&null!=(_ref=node.range)?_ref[0]:void 0,+((null!=node&&null!=(_ref1=node.range)?_ref1[1]:void 0)-1)+1||9e9),params=null!=(_ref2=function(){var a,b;a=this.context.environment,b=[];for(key in a)value=a[key],b.push(key);return b}.call(this))?_ref2:[],values=null!=(_ref3=function(){var a,b;a=this.context.environment,b=[];for(key in a)value=a[key],b.push(JSON.stringify(value));return b}.call(this))?_ref3:[],thunk="(function("+params+") { return "+source+"; })("+values+")",value=eval(thunk),new JS.Literal(value)):PartialEvaluator.__super__.visit.call(this,node)},PartialEvaluator.evaluate=function(a){var b,c;return c=new IndependenceNominator(a),c.visit(a.expression),b=new PartialEvaluator(a),b.visit(a.expression)},PartialEvaluator}(JS.JavaScriptVisitor),exports.IndependenceNominator=IndependenceNominator=function(a){function b(a){this.context=a}return __extends(b,a),b.prototype.Literal=function(a){return b.__super__.Literal.call(this,a),a.__independent=!0,a.__hasThisExp=!1,a},b.prototype.ThisExpression=function(a){return b.__super__.ThisExpression.call(this,a),a.__independent=!1,a.__hasThisExp=!0,a},b.prototype.Identifier=function(a){return b.__super__.Identifier.call(this,a),a.__independent=!0,a.__hasThisExp=!1,a},b.prototype.MemberExpression=function(a){var c;return b.__super__.MemberExpression.call(this,a),a.__hasThisExp=null!=(c=a.object)?c.__hasThisExp:void 0,a.__hasThisExp&&(a.__independent=!1,null!=a&&(a.property.__independent=!1)),a},b.prototype.CallExpression=function(a){return b.__super__.CallExpression.call(this,a),a.__hasThisExp=a.callee.__hasThisExp,a},b.prototype.ObjectExpression=function(a){var c,d,e,f,g,h,i,j;for(b.__super__.ObjectExpression.call(this,a),i=a.properties,e=0,g=i.length;g>e;e++)d=i[e],d.key.__independent=!1;for(c=!0,j=a.properties,f=0,h=j.length;h>f;f++)d=j[f],c&=d.value.__independent;return a.__independent=c?!0:!1,a},b.prototype.visit=function(a){var c,d,e,f,g,h,i;if(b.__super__.visit.call(this,a),!Object.prototype.hasOwnProperty.call(a,"__independent")){c=!0,d=function(a){var b;return _.isObject(a)?null!=(b=g.__independent)?b:!1:!0};for(e in a)if(g=a[e],_.isArray(g))for(h=0,i=g.length;i>h;h++)f=g[h],c&=d(f);else _.isObject(g)&&(c&=d(g));a.__independent=c?!0:!1}return a},b}(JS.JavaScriptVisitor)}).call(this)},$__modules__.Query=function(a){(function(){var b,c,d,e,f,g=[].slice;f=require("./Utilities"),d=require("./QueryNodes"),b=require("./JavaScript").JavaScript,a.Query=e=function(){function a(a,c){var e,h,i,j,k,l,m,n,o,p;if(!a||!f.isString(a))throw"Expected the name of a table!";n=a,e=c,h=null,k=null,l=[],j={},m=null,o=null,i=!1,p=0,this.getComponents=function(){return{filters:h,selections:l,projection:k,ordering:j,skip:m,take:o,table:n,context:e,includeTotalCount:i,version:p}},this.setComponents=function(a){var b,c,d,f,g,q,r,s,t;return p++,h=null!=(b=null!=a?a.filters:void 0)?b:null,l=null!=(c=null!=a?a.selections:void 0)?c:[],k=null!=(d=null!=a?a.projection:void 0)?d:null,j=null!=(f=null!=a?a.ordering:void 0)?f:{},m=null!=(g=null!=a?a.skip:void 0)?g:null,o=null!=(q=null!=a?a.take:void 0)?q:null,i=null!=(r=null!=a?a.includeTotalCount:void 0)?r:!1,n=null!=(s=null!=a?a.table:void 0)?s:null,e=null!=(t=null!=a?a.context:void 0)?t:null,this},this.where=function(){var a,c,e,i,j;return c=arguments[0],a=2<=arguments.length?g.call(arguments,1):[],p++,e=function(){if(f.isFunction(c))return b.transformConstraint(c,a);if(f.isObject(c))return d.QueryExpression.groupClauses(d.BinaryOperators.And,function(){var a;a=[];for(i in c)j=c[i],a.push(e=new d.BinaryExpression(d.BinaryOperators.Equal,new d.MemberExpression(i),new d.ConstantExpression(j)));return a}());if(f.isString(c))return new d.LiteralExpression(c,a);throw"Expected a function, object, or string, not "+c}(),h=d.QueryExpression.groupClauses(d.BinaryOperators.And,[h,e]),this},this.select=function(){var a,c,d,e,h;if(d=arguments[0],c=2<=arguments.length?g.call(arguments,1):[],p++,f.isString(d))for(l.push(d),e=0,h=c.length;h>e;e++){if(a=c[e],!f.isString(a))throw"Expected string parameters, not "+a;l.push(a)}else{if(!f.isFunction(d))throw"Expected a string or a function, not "+d;k=d,l=b.getProjectedFields(k)}return this},this.orderBy=function(){var a,b,c,d;for(b=1<=arguments.length?g.call(arguments,0):[],p++,c=0,d=b.length;d>c;c++){if(a=b[c],!f.isString(a))throw"Expected string parameters, not "+a;j[a]=!0}return this},this.orderByDescending=function(){var a,b,c,d;for(b=1<=arguments.length?g.call(arguments,0):[],p++,c=0,d=b.length;d>c;c++){if(a=b[c],!f.isString(a))throw"Expected string parameters, not "+a;j[a]=!1}return this},this.skip=function(a){if(p++,!f.isNumber(a))throw"Expected a number, not "+a;return m=a,this},this.take=function(a){if(p++,!f.isNumber(a))throw"Expected a number, not "+a;return o=a,this},this.includeTotalCount=function(){return p++,i=!0,this}}return a.registerProvider=function(b,c){return a.Providers[b]=c,a.prototype["to"+b]=function(){return null!=c&&"function"==typeof c.toQuery?c.toQuery(this):void 0}},a.Providers={},a.Expressions=d,a}(),c=require("./ODataProvider").ODataProvider,e.registerProvider("OData",new c)}).call(this)},$__modules__.QueryNodes=function(a){(function(){var b,c,d,e,f,g,h,i,j,k,l,m={}.hasOwnProperty,n=function(a,b){function c(){this.constructor=a}for(var d in b)m.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};l=require("./Node"),g=l.Node,k=l.Visitor,a.QueryExpression=h=function(a){function c(){c.__super__.constructor.call(this)}return n(c,a),c.groupClauses=function(a,c){var d;return d=function(c,d){return c?d?new b(a,c,d):c:d},c.reduce(d,null)},c}(g),a.QueryExpressionVisitor=i=function(a){function b(){b.__super__.constructor.call(this)}return n(b,a),b.prototype.QueryExpression=function(a){return a},b}(k),a.ConstantExpression=c=function(a){function b(a){this.value=a,b.__super__.constructor.call(this)}return n(b,a),b}(h),i.prototype.ConstantExpression=function(a){return this.QueryExpression(a)},a.MemberExpression=f=function(a){function b(a){this.member=a,b.__super__.constructor.call(this)}return n(b,a),b}(h),i.prototype.MemberExpression=function(a){return this.QueryExpression(a)},a.BinaryExpression=b=function(a){function b(a,c,d){this.operator=a,this.left=c,this.right=d,b.__super__.constructor.call(this)}return n(b,a),b}(h),i.prototype.BinaryExpression=function(a){return a=this.QueryExpression(a),a.left=this.visit(a.left),a.right=this.visit(a.right),a},a.BinaryOperators={And:"And",Or:"Or",Add:"Add",Subtract:"Subtract",Multiply:"Multiply",Divide:"Divide",Modulo:"Modulo",GreaterThan:"GreaterThan",GreaterThanOrEqual:"GreaterThanOrEqual",LessThan:"LessThan",LessThanOrEqual:"LessThanOrEqual",NotEqual:"NotEqual",Equal:"Equal"},a.UnaryExpression=j=function(a){function b(a,c){this.operator=a,this.operand=c,b.__super__.constructor.call(this)}return n(b,a),b}(h),i.prototype.UnaryExpression=function(a){return a=this.QueryExpression(a),a.operand=this.visit(a.operand),a},a.UnaryOperators={Not:"Not",Negate:"Negate",Increment:"Increment",Decrement:"Decrement"},a.InvocationExpression=d=function(a){function b(a,c){this.method=a,this.args=c,b.__super__.constructor.call(this)}return n(b,a),b}(h),i.prototype.InvocationExpression=function(a){return a=this.QueryExpression(a),a.args=this.visit(a.args),a},a.Methods={Length:"Length",ToUpperCase:"ToUpperCase",ToLowerCase:"ToLowerCase",Trim:"Trim",IndexOf:"IndexOf",Replace:"Replace",Substring:"Substring",Concat:"Concat",Day:"Day",Month:"Month",Year:"Year",Floor:"Floor",Ceiling:"Ceiling",Round:"Round"},a.LiteralExpression=e=function(a){function b(a,c){this.queryString=a,this.args=null!=c?c:[],b.__super__.constructor.call(this)}return n(b,a),b}(h),i.prototype.LiteralExpression=function(a){return this.QueryExpression(a)}}).call(this)},$__modules__.Utilities=function(a){(function(){var b,c=[].slice;b=function(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()},null==Array.prototype.reduce&&(Array.prototype.reduce=function(){var a,b,d,e,f,g;if(a=arguments[0],g=2<=arguments.length?c.call(arguments,1):[],b=this,d=b.length,e=0,f=void 0,null==b)throw new TypeError("Object is null or undefined");if("function"!=typeof a)throw new TypeError("First argument is not callable");if(0===g.length){if(0===d)throw new TypeError("Array length is 0 and no second argument");f=b[0],e=1}else f=g[0];for(;d>e;)e in b&&(f=a.call(void 0,f,b[e],b)),++e;return f}),null==Array.prototype.map&&(Array.prototype.map=function(a,b){var c,d,e,f,g,h,i;if("undefined"==typeof this||null===this)throw new TypeError("this is null or not defined");if("function"!=typeof a)throw new TypeError(a+" is not a function");for(b=b?b:void 0,e=Object(this),f=e.length>>>0,g=new Array(f),d=h=0,i=e.length;i>h;d=++h)c=e[d],d in e&&(g[d]=a.call(b,c,d,e));return g}),null==Array.isArray&&(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),a.isObject=function(a){return"object"===Object.prototype.toString.call(a).slice(8,-1).toLowerCase()},a.isString=function(a){return"string"==typeof a},a.isFunction=function(a){return"function"==typeof a},a.isArray=Array.isArray,a.isNumber=function(a){return"number"==typeof a},a.isBoolean=function(a){return"boolean"==typeof a},a.isDate=function(a){return"date"===b(a)},a.functionName=function(a){var b,c,d;return"function"==typeof Function.prototype.name?Function.prototype.name.call(a):(d=a.toString(),c="function ",d.slice(0,+(c.length-1)+1||9e9)===c&&(b=d.indexOf("(",c.length),b>c.length)?d.slice(c.length,+(b-1)+1||9e9):null)}}).call(this)},$__modules__.esprima=function(a){!function(b,c){"use strict";"function"==typeof define&&define.amd?define(["exports"],c):c("undefined"!=typeof a?a:b.esprima={})}(this,function(a){"use strict";function b(a,b){if(!a)throw new Error("ASSERT: "+b)}function c(a){return a>=48&&57>=a}function d(a){return"0123456789abcdefABCDEF".indexOf(a)>=0}function e(a){return"01234567".indexOf(a)>=0}function f(a){return 32===a||9===a||11===a||12===a||160===a||a>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(a)>=0}function g(a){return 10===a||13===a||8232===a||8233===a}function h(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a||92===a||a>=128&&pc.NonAsciiIdentifierStart.test(String.fromCharCode(a))}function i(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a||a>=48&&57>=a||92===a||a>=128&&pc.NonAsciiIdentifierPart.test(String.fromCharCode(a))}function j(a){switch(a){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0;default:return!1}}function k(a){switch(a){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}function l(a){return"eval"===a||"arguments"===a}function m(a){if(rc&&k(a))return!0;switch(a.length){case 2:return"if"===a||"in"===a||"do"===a;case 3:return"var"===a||"for"===a||"new"===a||"try"===a||"let"===a;case 4:return"this"===a||"else"===a||"case"===a||"void"===a||"with"===a||"enum"===a;case 5:return"while"===a||"break"===a||"catch"===a||"throw"===a||"const"===a||"yield"===a||"class"===a||"super"===a;case 6:return"return"===a||"typeof"===a||"delete"===a||"switch"===a||"export"===a||"import"===a;case 7:return"default"===a||"finally"===a||"extends"===a;case 8:return"function"===a||"continue"===a||"debugger"===a;case 10:return"instanceof"===a;default:return!1}}function n(a,c,d,e,f){var g;b("number"==typeof d,"Comment must have valid position"),xc.lastCommentStart>=d||(xc.lastCommentStart=d,g={type:a,value:c},yc.range&&(g.range=[d,e]),yc.loc&&(g.loc=f),yc.comments.push(g),yc.attachComment&&(yc.leadingComments.push(g),yc.trailingComments.push(g)))}function o(a){var b,c,d,e;for(b=sc-a,c={start:{line:tc,column:sc-uc-a}};vc>sc;)if(d=qc.charCodeAt(sc),++sc,g(d))return yc.comments&&(e=qc.slice(b+a,sc-1),c.end={line:tc,column:sc-uc-1},n("Line",e,b,sc-1,c)),13===d&&10===qc.charCodeAt(sc)&&++sc,++tc,void(uc=sc);yc.comments&&(e=qc.slice(b+a,sc),c.end={line:tc,column:sc-uc},n("Line",e,b,sc,c))}function p(){var a,b,c,d;for(yc.comments&&(a=sc-2,b={start:{line:tc,column:sc-uc-2}});vc>sc;)if(c=qc.charCodeAt(sc),g(c))13===c&&10===qc.charCodeAt(sc+1)&&++sc,++tc,++sc,uc=sc,sc>=vc&&S({},oc.UnexpectedToken,"ILLEGAL");else if(42===c){if(47===qc.charCodeAt(sc+1))return++sc,++sc,void(yc.comments&&(d=qc.slice(a+2,sc-2),b.end={line:tc,column:sc-uc},n("Block",d,a,sc,b)));++sc}else++sc;S({},oc.UnexpectedToken,"ILLEGAL")}function q(){var a,b;for(b=0===sc;vc>sc;)if(a=qc.charCodeAt(sc),f(a))++sc;else if(g(a))++sc,13===a&&10===qc.charCodeAt(sc)&&++sc,++tc,uc=sc,b=!0;else if(47===a)if(a=qc.charCodeAt(sc+1),47===a)++sc,++sc,o(2),b=!0;else{if(42!==a)break;++sc,++sc,p()}else if(b&&45===a){if(45!==qc.charCodeAt(sc+1)||62!==qc.charCodeAt(sc+2))break;sc+=3,o(3)}else{if(60!==a)break;if("!--"!==qc.slice(sc+1,sc+4))break;++sc,++sc,++sc,++sc,o(4)}}function r(a){var b,c,e,f=0;for(c="u"===a?4:2,b=0;c>b;++b){if(!(vc>sc&&d(qc[sc])))return"";e=qc[sc++],f=16*f+"0123456789abcdef".indexOf(e.toLowerCase())}return String.fromCharCode(f)}function s(){var a,b,c,e;for(a=qc[sc],b=0,"}"===a&&S({},oc.UnexpectedToken,"ILLEGAL");vc>sc&&(a=qc[sc++],d(a));)b=16*b+"0123456789abcdef".indexOf(a.toLowerCase());return(b>1114111||"}"!==a)&&S({},oc.UnexpectedToken,"ILLEGAL"),65535>=b?String.fromCharCode(b):(c=(b-65536>>10)+55296,e=(b-65536&1023)+56320,String.fromCharCode(c,e))}function t(){var a,b;for(a=qc.charCodeAt(sc++),b=String.fromCharCode(a),92===a&&(117!==qc.charCodeAt(sc)&&S({},oc.UnexpectedToken,"ILLEGAL"),++sc,a=r("u"),a&&"\\"!==a&&h(a.charCodeAt(0))||S({},oc.UnexpectedToken,"ILLEGAL"),b=a);vc>sc&&(a=qc.charCodeAt(sc),i(a));)++sc,b+=String.fromCharCode(a),92===a&&(b=b.substr(0,b.length-1),117!==qc.charCodeAt(sc)&&S({},oc.UnexpectedToken,"ILLEGAL"),++sc,a=r("u"),a&&"\\"!==a&&i(a.charCodeAt(0))||S({},oc.UnexpectedToken,"ILLEGAL"),b+=a);return b}function u(){var a,b;for(a=sc++;vc>sc;){if(b=qc.charCodeAt(sc),92===b)return sc=a,t();if(!i(b))break;++sc}return qc.slice(a,sc)}function v(){var a,b,c;return a=sc,b=92===qc.charCodeAt(sc)?t():u(),c=1===b.length?ic.Identifier:m(b)?ic.Keyword:"null"===b?ic.NullLiteral:"true"===b||"false"===b?ic.BooleanLiteral:ic.Identifier,{type:c,value:b,lineNumber:tc,lineStart:uc,start:a,end:sc}}function w(){var a,b,c,d,e=sc,f=qc.charCodeAt(sc),g=qc[sc];switch(f){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++sc,yc.tokenize&&(40===f?yc.openParenToken=yc.tokens.length:123===f&&(yc.openCurlyToken=yc.tokens.length)),{type:ic.Punctuator,value:String.fromCharCode(f),lineNumber:tc,lineStart:uc,start:e,end:sc};default:if(a=qc.charCodeAt(sc+1),61===a)switch(f){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return sc+=2,{type:ic.Punctuator,value:String.fromCharCode(f)+String.fromCharCode(a),lineNumber:tc,lineStart:uc,start:e,end:sc};case 33:case 61:return sc+=2,61===qc.charCodeAt(sc)&&++sc,{type:ic.Punctuator,value:qc.slice(e,sc),lineNumber:tc,lineStart:uc,start:e,end:sc}}}return d=qc.substr(sc,4),">>>="===d?(sc+=4,{type:ic.Punctuator,value:d,lineNumber:tc,lineStart:uc,start:e,end:sc}):(c=d.substr(0,3),">>>"===c||"<<="===c||">>="===c?(sc+=3,{type:ic.Punctuator,value:c,lineNumber:tc,lineStart:uc,start:e,end:sc}):(b=c.substr(0,2),g===b[1]&&"+-<>&|".indexOf(g)>=0||"=>"===b?(sc+=2,{type:ic.Punctuator,value:b,lineNumber:tc,lineStart:uc,start:e,end:sc}):"<>=!+-*%&|^/".indexOf(g)>=0?(++sc,{type:ic.Punctuator,value:g,lineNumber:tc,lineStart:uc,start:e,end:sc}):void S({},oc.UnexpectedToken,"ILLEGAL")))}function x(a){for(var b="";vc>sc&&d(qc[sc]);)b+=qc[sc++];return 0===b.length&&S({},oc.UnexpectedToken,"ILLEGAL"),h(qc.charCodeAt(sc))&&S({},oc.UnexpectedToken,"ILLEGAL"),{type:ic.NumericLiteral,value:parseInt("0x"+b,16),lineNumber:tc,lineStart:uc,start:a,end:sc}}function y(a){for(var b="0"+qc[sc++];vc>sc&&e(qc[sc]);)b+=qc[sc++];return(h(qc.charCodeAt(sc))||c(qc.charCodeAt(sc)))&&S({},oc.UnexpectedToken,"ILLEGAL"),{type:ic.NumericLiteral,value:parseInt(b,8),octal:!0,lineNumber:tc,lineStart:uc,start:a,end:sc}}function z(){var a,d,f;if(f=qc[sc],b(c(f.charCodeAt(0))||"."===f,"Numeric literal must start with a decimal digit or a decimal point"),d=sc,a="","."!==f){if(a=qc[sc++],f=qc[sc],"0"===a){if("x"===f||"X"===f)return++sc,x(d);if(e(f))return y(d);f&&c(f.charCodeAt(0))&&S({},oc.UnexpectedToken,"ILLEGAL")}for(;c(qc.charCodeAt(sc));)a+=qc[sc++];f=qc[sc]}if("."===f){for(a+=qc[sc++];c(qc.charCodeAt(sc));)a+=qc[sc++];f=qc[sc]}if("e"===f||"E"===f)if(a+=qc[sc++],f=qc[sc],("+"===f||"-"===f)&&(a+=qc[sc++]),c(qc.charCodeAt(sc)))for(;c(qc.charCodeAt(sc));)a+=qc[sc++];else S({},oc.UnexpectedToken,"ILLEGAL");return h(qc.charCodeAt(sc))&&S({},oc.UnexpectedToken,"ILLEGAL"),{type:ic.NumericLiteral,value:parseFloat(a),lineNumber:tc,lineStart:uc,start:d,end:sc}}function A(){var a,c,d,f,h,i,j,k,l="",m=!1;for(j=tc,k=uc,a=qc[sc],b("'"===a||'"'===a,"String literal must starts with a quote"),c=sc,++sc;vc>sc;){if(d=qc[sc++],d===a){a="";break}if("\\"===d)if(d=qc[sc++],d&&g(d.charCodeAt(0)))++tc,"\r"===d&&"\n"===qc[sc]&&++sc,uc=sc;else switch(d){case"u":case"x":"{"===qc[sc]?(++sc,l+=s()):(i=sc,h=r(d),h?l+=h:(sc=i,l+=d));break;case"n":l+="\n";break;case"r":l+="\r";break;case"t":l+=" ";break;case"b":l+="\b";break;case"f":l+="\f";break;case"v":l+=" ";break;default:e(d)?(f="01234567".indexOf(d),0!==f&&(m=!0),vc>sc&&e(qc[sc])&&(m=!0,f=8*f+"01234567".indexOf(qc[sc++]),"0123".indexOf(d)>=0&&vc>sc&&e(qc[sc])&&(f=8*f+"01234567".indexOf(qc[sc++]))),l+=String.fromCharCode(f)):l+=d}else{if(g(d.charCodeAt(0)))break;l+=d}}return""!==a&&S({},oc.UnexpectedToken,"ILLEGAL"),{type:ic.StringLiteral,value:l,octal:m,startLineNumber:j,startLineStart:k,lineNumber:tc,lineStart:uc,start:c,end:sc}}function B(a,b){var c;try{c=new RegExp(a,b)}catch(d){S({},oc.InvalidRegExp)}return c}function C(){var a,c,d,e,f;for(a=qc[sc],b("/"===a,"Regular expression literal must start with a slash"),c=qc[sc++],d=!1,e=!1;vc>sc;)if(a=qc[sc++],c+=a,"\\"===a)a=qc[sc++],g(a.charCodeAt(0))&&S({},oc.UnterminatedRegExp),c+=a;else if(g(a.charCodeAt(0)))S({},oc.UnterminatedRegExp);else if(d)"]"===a&&(d=!1);else{if("/"===a){e=!0;break}"["===a&&(d=!0)}return e||S({},oc.UnterminatedRegExp),f=c.substr(1,c.length-2),{value:f,literal:c}}function D(){var a,b,c,d;for(b="",c="";vc>sc&&(a=qc[sc],i(a.charCodeAt(0)));)if(++sc,"\\"===a&&vc>sc)if(a=qc[sc],"u"===a){if(++sc,d=sc,a=r("u"))for(c+=a,b+="\\u";sc>d;++d)b+=qc[d];else sc=d,c+="u",b+="\\u";T({},oc.UnexpectedToken,"ILLEGAL")}else b+="\\",T({},oc.UnexpectedToken,"ILLEGAL");else c+=a,b+=a;return{value:c,literal:b}}function E(){var a,b,c,d;return wc=null,q(),a=sc,b=C(),c=D(),d=B(b.value,c.value),yc.tokenize?{type:ic.RegularExpression,value:d,lineNumber:tc,lineStart:uc,start:a,end:sc}:{literal:b.literal+c.literal,value:d,start:a,end:sc}}function F(){var a,b,c,d;return q(),a=sc,b={start:{line:tc,column:sc-uc}},c=E(),b.end={line:tc,column:sc-uc},yc.tokenize||(yc.tokens.length>0&&(d=yc.tokens[yc.tokens.length-1],d.range[0]===a&&"Punctuator"===d.type&&("/"===d.value||"/="===d.value)&&yc.tokens.pop()),yc.tokens.push({type:"RegularExpression",value:c.literal,range:[a,sc],loc:b})),c}function G(a){return a.type===ic.Identifier||a.type===ic.Keyword||a.type===ic.BooleanLiteral||a.type===ic.NullLiteral}function H(){var a,b;if(a=yc.tokens[yc.tokens.length-1],!a)return F();if("Punctuator"===a.type){if("]"===a.value)return w();if(")"===a.value)return b=yc.tokens[yc.openParenToken-1],!b||"Keyword"!==b.type||"if"!==b.value&&"while"!==b.value&&"for"!==b.value&&"with"!==b.value?w():F();if("}"===a.value){if(yc.tokens[yc.openCurlyToken-3]&&"Keyword"===yc.tokens[yc.openCurlyToken-3].type){if(b=yc.tokens[yc.openCurlyToken-4],!b)return w()}else{if(!yc.tokens[yc.openCurlyToken-4]||"Keyword"!==yc.tokens[yc.openCurlyToken-4].type)return w();if(b=yc.tokens[yc.openCurlyToken-5],!b)return F()}return kc.indexOf(b.value)>=0?w():F()}return F()}return"Keyword"===a.type?F():w()}function I(){var a;return q(),sc>=vc?{type:ic.EOF,lineNumber:tc,lineStart:uc,start:sc,end:sc}:(a=qc.charCodeAt(sc),h(a)?v():40===a||41===a||59===a?w():39===a||34===a?A():46===a?c(qc.charCodeAt(sc+1))?z():w():c(a)?z():yc.tokenize&&47===a?H():w())}function J(){var a,b,c;return q(),a={start:{line:tc,column:sc-uc}},b=I(),a.end={line:tc,column:sc-uc},b.type!==ic.EOF&&(c=qc.slice(b.start,b.end),yc.tokens.push({type:jc[b.type],value:c,range:[b.start,b.end],loc:a})),b}function K(){var a;return a=wc,sc=a.end,tc=a.lineNumber,uc=a.lineStart,wc="undefined"!=typeof yc.tokens?J():I(),sc=a.end,tc=a.lineNumber,uc=a.lineStart,a}function L(){var a,b,c;a=sc,b=tc,c=uc,wc="undefined"!=typeof yc.tokens?J():I(),sc=a,tc=b,uc=c}function M(){this.line=tc,this.column=sc-uc}function N(){this.start=new M,this.end=null}function O(a){this.start=a.type===ic.StringLiteral?{line:a.startLineNumber,column:a.start-a.startLineStart}:{line:a.lineNumber,column:a.start-a.lineStart},this.end=null}function P(){sc=wc.start,wc.type===ic.StringLiteral?(tc=wc.startLineNumber,uc=wc.startLineStart):(tc=wc.lineNumber,uc=wc.lineStart),yc.range&&(this.range=[sc,0]),yc.loc&&(this.loc=new N)}function Q(a){yc.range&&(this.range=[a.start,0]),yc.loc&&(this.loc=new O(a))}function R(){var a,b,c,d;return a=sc,b=tc,c=uc,q(),d=tc!==b,sc=a,tc=b,uc=c,d}function S(a,c){var d,e=Array.prototype.slice.call(arguments,2),f=c.replace(/%(\d)/g,function(a,c){return b(c>="===a||">>>="===a||"&="===a||"^="===a||"|="===a)}function _(){var a;return 59===qc.charCodeAt(sc)||Y(";")?void K():(a=tc,q(),void(tc===a&&(wc.type===ic.EOF||Y("}")||U(wc))))}function ab(a){return a.type===lc.Identifier||a.type===lc.MemberExpression}function bb(){var a=[],b=new P;for(V("[");!Y("]");)Y(",")?(K(),a.push(null)):(a.push(xb()),Y("]")||V(","));return K(),b.finishArrayExpression(a)}function cb(a,b){var c,d,e=new P;return c=rc,d=Yb(),b&&rc&&l(a[0].name)&&T(b,oc.StrictParamName),rc=c,e.finishFunctionExpression(null,a,[],d)}function db(){var a,b=new P;return a=K(),a.type===ic.StringLiteral||a.type===ic.NumericLiteral?(rc&&a.octal&&T(a,oc.StrictOctalLiteral),b.finishLiteral(a)):b.finishIdentifier(a.value)}function eb(){var a,b,c,d,e,f=new P;return a=wc,a.type===ic.Identifier?(c=db(),"get"!==a.value||Y(":")?"set"!==a.value||Y(":")?(V(":"),d=xb(),f.finishProperty("init",c,d)):(b=db(),V("("),a=wc,a.type!==ic.Identifier?(V(")"),T(a,oc.UnexpectedToken,a.value),d=cb([])):(e=[Bb()],V(")"),d=cb(e,a)),f.finishProperty("set",b,d)):(b=db(),V("("),V(")"),d=cb([]),f.finishProperty("get",b,d))):a.type!==ic.EOF&&a.type!==ic.Punctuator?(b=db(),V(":"),d=xb(),f.finishProperty("init",b,d)):void U(a)}function fb(){var a,b,c,d,e=[],f={},g=String,h=new P;for(V("{");!Y("}");)a=eb(),b=a.key.type===lc.Identifier?a.key.name:g(a.key.value),d="init"===a.kind?nc.Data:"get"===a.kind?nc.Get:nc.Set,c="$"+b,Object.prototype.hasOwnProperty.call(f,c)?(f[c]===nc.Data?rc&&d===nc.Data?T({},oc.StrictDuplicateProperty):d!==nc.Data&&T({},oc.AccessorDataProperty):d===nc.Data?T({},oc.AccessorDataProperty):f[c]&d&&T({},oc.AccessorGetSet),f[c]|=d):f[c]=d,e.push(a),Y("}")||W(",");return V("}"),h.finishObjectExpression(e)}function gb(){var a;return V("("),Y(")")?(K(),mc.ArrowParameterPlaceHolder):(++xc.parenthesisCount,a=yb(),V(")"),a)}function hb(){var a,b,c,d;if(Y("("))return gb();if(Y("["))return bb();if(Y("{"))return fb();if(a=wc.type,d=new P,a===ic.Identifier)c=d.finishIdentifier(K().value);else if(a===ic.StringLiteral||a===ic.NumericLiteral)rc&&wc.octal&&T(wc,oc.StrictOctalLiteral),c=d.finishLiteral(K());else if(a===ic.Keyword){if(Z("function"))return bc();Z("this")?(K(),c=d.finishThisExpression()):U(K())}else a===ic.BooleanLiteral?(b=K(),b.value="true"===b.value,c=d.finishLiteral(b)):a===ic.NullLiteral?(b=K(),b.value=null,c=d.finishLiteral(b)):Y("/")||Y("/=")?(c=d.finishLiteral("undefined"!=typeof yc.tokens?F():E()),L()):U(K());return c}function ib(){var a=[];if(V("("),!Y(")"))for(;vc>sc&&(a.push(xb()),!Y(")"));)W(",");return V(")"),a}function jb(){var a,b=new P;return a=K(),G(a)||U(a),b.finishIdentifier(a.value)}function kb(){return V("."),jb()}function lb(){var a;return V("["),a=yb(),V("]"),a}function mb(){var a,b,c=new P;return X("new"),a=ob(),b=Y("(")?ib():[],c.finishNewExpression(a,b)}function nb(){var a,b,c,d,e=xc.allowIn;for(d=wc,xc.allowIn=!0,a=Z("new")?mb():hb();;)if(Y("."))c=kb(),a=new Q(d).finishMemberExpression(".",a,c);else if(Y("("))b=ib(),a=new Q(d).finishCallExpression(a,b);else{if(!Y("["))break;c=lb(),a=new Q(d).finishMemberExpression("[",a,c)}return xc.allowIn=e,a}function ob(){var a,c,d;for(b(xc.allowIn,"callee of new expression always allow in keyword."),d=wc,a=Z("new")?mb():hb();;)if(Y("["))c=lb(),a=new Q(d).finishMemberExpression("[",a,c);else{if(!Y("."))break;c=kb(),a=new Q(d).finishMemberExpression(".",a,c)}return a}function pb(){var a,b,c=wc;return a=nb(),wc.type===ic.Punctuator&&(!Y("++")&&!Y("--")||R()||(rc&&a.type===lc.Identifier&&l(a.name)&&T({},oc.StrictLHSPostfix),ab(a)||T({},oc.InvalidLHSInAssignment),b=K(),a=new Q(c).finishPostfixExpression(b.value,a))),a}function qb(){var a,b,c;return wc.type!==ic.Punctuator&&wc.type!==ic.Keyword?b=pb():Y("++")||Y("--")?(c=wc,a=K(),b=qb(),rc&&b.type===lc.Identifier&&l(b.name)&&T({},oc.StrictLHSPrefix),ab(b)||T({},oc.InvalidLHSInAssignment),b=new Q(c).finishUnaryExpression(a.value,b)):Y("+")||Y("-")||Y("~")||Y("!")?(c=wc,a=K(),b=qb(),b=new Q(c).finishUnaryExpression(a.value,b)):Z("delete")||Z("void")||Z("typeof")?(c=wc,a=K(),b=qb(),b=new Q(c).finishUnaryExpression(a.value,b),rc&&"delete"===b.operator&&b.argument.type===lc.Identifier&&T({},oc.StrictDelete)):b=pb(),b}function rb(a,b){var c=0;if(a.type!==ic.Punctuator&&a.type!==ic.Keyword)return 0;switch(a.value){case"||":c=1;break;case"&&":c=2;break;case"|":c=3;break;case"^":c=4;break;case"&":c=5;break;case"==":case"!=":case"===":case"!==":c=6;break;case"<":case">":case"<=":case">=":case"instanceof":c=7;break;case"in":c=b?7:0;break;case"<<":case">>":case">>>":c=8;break;case"+":case"-":c=9;break;case"*":case"/":case"%":c=11}return c}function sb(){var a,b,c,d,e,f,g,h,i,j;if(a=wc,i=qb(),i===mc.ArrowParameterPlaceHolder)return i;if(d=wc,e=rb(d,xc.allowIn),0===e)return i;for(d.prec=e,K(),b=[a,wc],g=qb(),f=[i,d,g];(e=rb(wc,xc.allowIn))>0;){for(;f.length>2&&e<=f[f.length-2].prec;)g=f.pop(),h=f.pop().value,i=f.pop(),b.pop(),c=new Q(b[b.length-1]).finishBinaryExpression(h,i,g),f.push(c);d=K(),d.prec=e,f.push(d),b.push(wc),c=qb(),f.push(c)}for(j=f.length-1,c=f[j],b.pop();j>1;)c=new Q(b.pop()).finishBinaryExpression(f[j-1].value,f[j-2],c),j-=2;return c}function tb(){var a,b,c,d,e;return e=wc,a=sb(),a===mc.ArrowParameterPlaceHolder?a:(Y("?")&&(K(),b=xc.allowIn,xc.allowIn=!0,c=xb(),xc.allowIn=b,V(":"),d=xb(),a=new Q(e).finishConditionalExpression(a,c,d)),a)}function ub(){return Y("{")?Yb():xb()}function vb(a){var b,c,d,e,f,g,h,i;for(e=[],f=[],g=0,i=null,h={paramSet:{}},b=0,c=a.length;c>b;b+=1)if(d=a[b],d.type===lc.Identifier)e.push(d),f.push(null),Zb(h,d,d.name);else{if(d.type!==lc.AssignmentExpression)return null;e.push(d.left),f.push(d.right),++g,Zb(h,d.left,d.left.name)}return h.message===oc.StrictParamDupe&&S(rc?h.stricted:h.firstRestricted,h.message),0===g&&(f=[]),{params:e,defaults:f,rest:i,stricted:h.stricted,firstRestricted:h.firstRestricted,message:h.message}}function wb(a,b){var c,d;return V("=>"),c=rc,d=ub(),rc&&a.firstRestricted&&S(a.firstRestricted,a.message),rc&&a.stricted&&T(a.stricted,a.message),rc=c,b.finishArrowFunctionExpression(a.params,a.defaults,d,d.type!==lc.BlockStatement) 5 | }function xb(){var a,b,c,d,e,f;return a=xc.parenthesisCount,f=wc,b=wc,c=tb(),c!==mc.ArrowParameterPlaceHolder&&!Y("=>")||xc.parenthesisCount!==a&&xc.parenthesisCount!==a+1||(c.type===lc.Identifier?e=vb([c]):c.type===lc.AssignmentExpression?e=vb([c]):c.type===lc.SequenceExpression?e=vb(c.expressions):c===mc.ArrowParameterPlaceHolder&&(e=vb([])),!e)?($()&&(ab(c)||T({},oc.InvalidLHSInAssignment),rc&&c.type===lc.Identifier&&l(c.name)&&T(b,oc.StrictLHSAssignment),b=K(),d=xb(),c=new Q(f).finishAssignmentExpression(b.value,c,d)),c):wb(e,new Q(f))}function yb(){var a,b,c=wc;if(a=xb(),Y(",")){for(b=[a];vc>sc&&Y(",");)K(),b.push(xb());a=new Q(c).finishSequenceExpression(b)}return a}function zb(){for(var a,b=[];vc>sc&&!Y("}")&&(a=cc(),"undefined"!=typeof a);)b.push(a);return b}function Ab(){var a,b=new P;return V("{"),a=zb(),V("}"),b.finishBlockStatement(a)}function Bb(){var a,b=new P;return a=K(),a.type!==ic.Identifier&&U(a),b.finishIdentifier(a.value)}function Cb(a){var b,c=null,d=new P;return b=Bb(),rc&&l(b.name)&&T({},oc.StrictVarName),"const"===a?(V("="),c=xb()):Y("=")&&(K(),c=xb()),d.finishVariableDeclarator(b,c)}function Db(a){var b=[];do{if(b.push(Cb(a)),!Y(","))break;K()}while(vc>sc);return b}function Eb(a){var b;return X("var"),b=Db(),_(),a.finishVariableDeclaration(b,"var")}function Fb(a){var b,c=new P;return X(a),b=Db(a),_(),c.finishVariableDeclaration(b,a)}function Gb(){var a=new P;return V(";"),a.finishEmptyStatement()}function Hb(a){var b=yb();return _(),a.finishExpressionStatement(b)}function Ib(a){var b,c,d;return X("if"),V("("),b=yb(),V(")"),c=Xb(),Z("else")?(K(),d=Xb()):d=null,a.finishIfStatement(b,c,d)}function Jb(a){var b,c,d;return X("do"),d=xc.inIteration,xc.inIteration=!0,b=Xb(),xc.inIteration=d,X("while"),V("("),c=yb(),V(")"),Y(";")&&K(),a.finishDoWhileStatement(b,c)}function Kb(a){var b,c,d;return X("while"),V("("),b=yb(),V(")"),d=xc.inIteration,xc.inIteration=!0,c=Xb(),xc.inIteration=d,a.finishWhileStatement(b,c)}function Lb(){var a,b,c=new P;return a=K(),b=Db(),c.finishVariableDeclaration(b,a.value)}function Mb(a){var b,c,d,e,f,g,h,i=xc.allowIn;return b=c=d=null,X("for"),V("("),Y(";")?K():(Z("var")||Z("let")?(xc.allowIn=!1,b=Lb(),xc.allowIn=i,1===b.declarations.length&&Z("in")&&(K(),e=b,f=yb(),b=null)):(xc.allowIn=!1,b=yb(),xc.allowIn=i,Z("in")&&(ab(b)||T({},oc.InvalidLHSInForIn),K(),e=b,f=yb(),b=null)),"undefined"==typeof e&&V(";")),"undefined"==typeof e&&(Y(";")||(c=yb()),V(";"),Y(")")||(d=yb())),V(")"),h=xc.inIteration,xc.inIteration=!0,g=Xb(),xc.inIteration=h,"undefined"==typeof e?a.finishForStatement(b,c,d,g):a.finishForInStatement(e,f,g)}function Nb(a){var b,c=null;return X("continue"),59===qc.charCodeAt(sc)?(K(),xc.inIteration||S({},oc.IllegalContinue),a.finishContinueStatement(null)):R()?(xc.inIteration||S({},oc.IllegalContinue),a.finishContinueStatement(null)):(wc.type===ic.Identifier&&(c=Bb(),b="$"+c.name,Object.prototype.hasOwnProperty.call(xc.labelSet,b)||S({},oc.UnknownLabel,c.name)),_(),null!==c||xc.inIteration||S({},oc.IllegalContinue),a.finishContinueStatement(c))}function Ob(a){var b,c=null;return X("break"),59===qc.charCodeAt(sc)?(K(),xc.inIteration||xc.inSwitch||S({},oc.IllegalBreak),a.finishBreakStatement(null)):R()?(xc.inIteration||xc.inSwitch||S({},oc.IllegalBreak),a.finishBreakStatement(null)):(wc.type===ic.Identifier&&(c=Bb(),b="$"+c.name,Object.prototype.hasOwnProperty.call(xc.labelSet,b)||S({},oc.UnknownLabel,c.name)),_(),null!==c||xc.inIteration||xc.inSwitch||S({},oc.IllegalBreak),a.finishBreakStatement(c))}function Pb(a){var b=null;return X("return"),xc.inFunctionBody||T({},oc.IllegalReturn),32===qc.charCodeAt(sc)&&h(qc.charCodeAt(sc+1))?(b=yb(),_(),a.finishReturnStatement(b)):R()?a.finishReturnStatement(null):(Y(";")||Y("}")||wc.type===ic.EOF||(b=yb()),_(),a.finishReturnStatement(b))}function Qb(a){var b,c;return rc&&(q(),T({},oc.StrictModeWith)),X("with"),V("("),b=yb(),V(")"),c=Xb(),a.finishWithStatement(b,c)}function Rb(){var a,b,c=[],d=new P;for(Z("default")?(K(),a=null):(X("case"),a=yb()),V(":");vc>sc&&!(Y("}")||Z("default")||Z("case"));)b=Xb(),c.push(b);return d.finishSwitchCase(a,c)}function Sb(a){var b,c,d,e,f;if(X("switch"),V("("),b=yb(),V(")"),V("{"),c=[],Y("}"))return K(),a.finishSwitchStatement(b,c);for(e=xc.inSwitch,xc.inSwitch=!0,f=!1;vc>sc&&!Y("}");)d=Rb(),null===d.test&&(f&&S({},oc.MultipleDefaultsInSwitch),f=!0),c.push(d);return xc.inSwitch=e,V("}"),a.finishSwitchStatement(b,c)}function Tb(a){var b;return X("throw"),R()&&S({},oc.NewlineAfterThrow),b=yb(),_(),a.finishThrowStatement(b)}function Ub(){var a,b,c=new P;return X("catch"),V("("),Y(")")&&U(wc),a=Bb(),rc&&l(a.name)&&T({},oc.StrictCatchVariable),V(")"),b=Ab(),c.finishCatchClause(a,b)}function Vb(a){var b,c=[],d=null;return X("try"),b=Ab(),Z("catch")&&c.push(Ub()),Z("finally")&&(K(),d=Ab()),0!==c.length||d||S({},oc.NoCatchOrFinally),a.finishTryStatement(b,[],c,d)}function Wb(a){return X("debugger"),_(),a.finishDebuggerStatement()}function Xb(){var a,b,c,d,e=wc.type;if(e===ic.EOF&&U(wc),e===ic.Punctuator&&"{"===wc.value)return Ab();if(d=new P,e===ic.Punctuator)switch(wc.value){case";":return Gb(d);case"(":return Hb(d)}else if(e===ic.Keyword)switch(wc.value){case"break":return Ob(d);case"continue":return Nb(d);case"debugger":return Wb(d);case"do":return Jb(d);case"for":return Mb(d);case"function":return ac(d);case"if":return Ib(d);case"return":return Pb(d);case"switch":return Sb(d);case"throw":return Tb(d);case"try":return Vb(d);case"var":return Eb(d);case"while":return Kb(d);case"with":return Qb(d)}return a=yb(),a.type===lc.Identifier&&Y(":")?(K(),c="$"+a.name,Object.prototype.hasOwnProperty.call(xc.labelSet,c)&&S({},oc.Redeclaration,"Label",a.name),xc.labelSet[c]=!0,b=Xb(),delete xc.labelSet[c],d.finishLabeledStatement(a,b)):(_(),d.finishExpressionStatement(a))}function Yb(){var a,b,c,d,e,f,g,h,i,j=[],k=new P;for(V("{");vc>sc&&wc.type===ic.StringLiteral&&(b=wc,a=cc(),j.push(a),a.expression.type===lc.Literal);)c=qc.slice(b.start+1,b.end-1),"use strict"===c?(rc=!0,d&&T(d,oc.StrictOctalLiteral)):!d&&b.octal&&(d=b);for(e=xc.labelSet,f=xc.inIteration,g=xc.inSwitch,h=xc.inFunctionBody,i=xc.parenthesizedCount,xc.labelSet={},xc.inIteration=!1,xc.inSwitch=!1,xc.inFunctionBody=!0,xc.parenthesizedCount=0;vc>sc&&!Y("}")&&(a=cc(),"undefined"!=typeof a);)j.push(a);return V("}"),xc.labelSet=e,xc.inIteration=f,xc.inSwitch=g,xc.inFunctionBody=h,xc.parenthesizedCount=i,k.finishBlockStatement(j)}function Zb(a,b,c){var d="$"+c;rc?(l(c)&&(a.stricted=b,a.message=oc.StrictParamName),Object.prototype.hasOwnProperty.call(a.paramSet,d)&&(a.stricted=b,a.message=oc.StrictParamDupe)):a.firstRestricted||(l(c)?(a.firstRestricted=b,a.message=oc.StrictParamName):k(c)?(a.firstRestricted=b,a.message=oc.StrictReservedWord):Object.prototype.hasOwnProperty.call(a.paramSet,d)&&(a.firstRestricted=b,a.message=oc.StrictParamDupe)),a.paramSet[d]=!0}function $b(a){var b,c,d;return b=wc,c=Bb(),Zb(a,b,b.value),Y("=")&&(K(),d=xb(),++a.defaultCount),a.params.push(c),a.defaults.push(d),!Y(")")}function _b(a){var b;if(b={params:[],defaultCount:0,defaults:[],firstRestricted:a},V("("),!Y(")"))for(b.paramSet={};vc>sc&&$b(b);)V(",");return V(")"),0===b.defaultCount&&(b.defaults=[]),{params:b.params,defaults:b.defaults,stricted:b.stricted,firstRestricted:b.firstRestricted,message:b.message}}function ac(){var a,b,c,d,e,f,g,h,i=[],j=[],m=new P;return X("function"),c=wc,a=Bb(),rc?l(c.value)&&T(c,oc.StrictFunctionName):l(c.value)?(f=c,g=oc.StrictFunctionName):k(c.value)&&(f=c,g=oc.StrictReservedWord),e=_b(f),i=e.params,j=e.defaults,d=e.stricted,f=e.firstRestricted,e.message&&(g=e.message),h=rc,b=Yb(),rc&&f&&S(f,g),rc&&d&&T(d,g),rc=h,m.finishFunctionDeclaration(a,i,j,b)}function bc(){var a,b,c,d,e,f,g,h=null,i=[],j=[],m=new P;return X("function"),Y("(")||(a=wc,h=Bb(),rc?l(a.value)&&T(a,oc.StrictFunctionName):l(a.value)?(c=a,d=oc.StrictFunctionName):k(a.value)&&(c=a,d=oc.StrictReservedWord)),e=_b(c),i=e.params,j=e.defaults,b=e.stricted,c=e.firstRestricted,e.message&&(d=e.message),g=rc,f=Yb(),rc&&c&&S(c,d),rc&&b&&T(b,d),rc=g,m.finishFunctionExpression(h,i,j,f)}function cc(){if(wc.type===ic.Keyword)switch(wc.value){case"const":case"let":return Fb(wc.value);case"function":return ac();default:return Xb()}return wc.type!==ic.EOF?Xb():void 0}function dc(){for(var a,b,c,d,e=[];vc>sc&&(b=wc,b.type===ic.StringLiteral)&&(a=cc(),e.push(a),a.expression.type===lc.Literal);)c=qc.slice(b.start+1,b.end-1),"use strict"===c?(rc=!0,d&&T(d,oc.StrictOctalLiteral)):!d&&b.octal&&(d=b);for(;vc>sc&&(a=cc(),"undefined"!=typeof a);)e.push(a);return e}function ec(){var a,b;return q(),L(),b=new P,rc=!1,a=dc(),b.finishProgram(a)}function fc(){var a,b,c,d=[];for(a=0;a0?1:0,uc=0,vc=qc.length,wc=null,xc={allowIn:!0,labelSet:{},inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},yc={},b=b||{},b.tokens=!0,yc.tokens=[],yc.tokenize=!0,yc.openParenToken=-1,yc.openCurlyToken=-1,yc.range="boolean"==typeof b.range&&b.range,yc.loc="boolean"==typeof b.loc&&b.loc,"boolean"==typeof b.comment&&b.comment&&(yc.comments=[]),"boolean"==typeof b.tolerant&&b.tolerant&&(yc.errors=[]);try{if(L(),wc.type===ic.EOF)return yc.tokens;for(K();wc.type!==ic.EOF;)try{K()}catch(e){if(yc.errors){yc.errors.push(e);break}throw e}fc(),d=yc.tokens,"undefined"!=typeof yc.comments&&(d.comments=yc.comments),"undefined"!=typeof yc.errors&&(d.errors=yc.errors)}catch(f){throw f}finally{yc={}}return d}function hc(a,b){var c,d;d=String,"string"==typeof a||a instanceof String||(a=d(a)),qc=a,sc=0,tc=qc.length>0?1:0,uc=0,vc=qc.length,wc=null,xc={allowIn:!0,labelSet:{},parenthesisCount:0,inFunctionBody:!1,inIteration:!1,inSwitch:!1,lastCommentStart:-1},yc={},"undefined"!=typeof b&&(yc.range="boolean"==typeof b.range&&b.range,yc.loc="boolean"==typeof b.loc&&b.loc,yc.attachComment="boolean"==typeof b.attachComment&&b.attachComment,yc.loc&&null!==b.source&&void 0!==b.source&&(yc.source=d(b.source)),"boolean"==typeof b.tokens&&b.tokens&&(yc.tokens=[]),"boolean"==typeof b.comment&&b.comment&&(yc.comments=[]),"boolean"==typeof b.tolerant&&b.tolerant&&(yc.errors=[]),yc.attachComment&&(yc.range=!0,yc.comments=[],yc.bottomRightStack=[],yc.trailingComments=[],yc.leadingComments=[]));try{c=ec(),"undefined"!=typeof yc.comments&&(c.comments=yc.comments),"undefined"!=typeof yc.tokens&&(fc(),c.tokens=yc.tokens),"undefined"!=typeof yc.errors&&(c.errors=yc.errors)}catch(e){throw e}finally{yc={}}return c}var ic,jc,kc,lc,mc,nc,oc,pc,qc,rc,sc,tc,uc,vc,wc,xc,yc;ic={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9},jc={},jc[ic.BooleanLiteral]="Boolean",jc[ic.EOF]="",jc[ic.Identifier]="Identifier",jc[ic.Keyword]="Keyword",jc[ic.NullLiteral]="Null",jc[ic.NumericLiteral]="Numeric",jc[ic.Punctuator]="Punctuator",jc[ic.StringLiteral]="String",jc[ic.RegularExpression]="RegularExpression",kc=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="],lc={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrowFunctionExpression:"ArrowFunctionExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement"},mc={ArrowParameterPlaceHolder:{type:"ArrowParameterPlaceHolder"}},nc={Data:1,Get:2,Set:4},oc={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},pc={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")},Q.prototype=P.prototype={processComment:function(){var a,b,c=yc.bottomRightStack,d=c[c.length-1];if(!(this.type===lc.Program&&this.body.length>0)){if(yc.trailingComments.length>0?yc.trailingComments[0].range[0]>=this.range[1]?(b=yc.trailingComments,yc.trailingComments=[]):yc.trailingComments.length=0:d&&d.trailingComments&&d.trailingComments[0].range[0]>=this.range[1]&&(b=d.trailingComments,delete d.trailingComments),d)for(;d&&d.range[0]>=this.range[0];)a=d,d=c.pop();a?a.leadingComments&&a.leadingComments[a.leadingComments.length-1].range[1]<=this.range[0]&&(this.leadingComments=a.leadingComments,a.leadingComments=void 0):yc.leadingComments.length>0&&yc.leadingComments[yc.leadingComments.length-1].range[1]<=this.range[0]&&(this.leadingComments=yc.leadingComments,yc.leadingComments=[]),b&&(this.trailingComments=b),c.push(this)}},finish:function(){yc.range&&(this.range[1]=sc),yc.loc&&(this.loc.end=new M,yc.source&&(this.loc.source=yc.source)),yc.attachComment&&this.processComment()},finishArrayExpression:function(a){return this.type=lc.ArrayExpression,this.elements=a,this.finish(),this},finishArrowFunctionExpression:function(a,b,c,d){return this.type=lc.ArrowFunctionExpression,this.id=null,this.params=a,this.defaults=b,this.body=c,this.rest=null,this.generator=!1,this.expression=d,this.finish(),this},finishAssignmentExpression:function(a,b,c){return this.type=lc.AssignmentExpression,this.operator=a,this.left=b,this.right=c,this.finish(),this},finishBinaryExpression:function(a,b,c){return this.type="||"===a||"&&"===a?lc.LogicalExpression:lc.BinaryExpression,this.operator=a,this.left=b,this.right=c,this.finish(),this},finishBlockStatement:function(a){return this.type=lc.BlockStatement,this.body=a,this.finish(),this},finishBreakStatement:function(a){return this.type=lc.BreakStatement,this.label=a,this.finish(),this},finishCallExpression:function(a,b){return this.type=lc.CallExpression,this.callee=a,this.arguments=b,this.finish(),this},finishCatchClause:function(a,b){return this.type=lc.CatchClause,this.param=a,this.body=b,this.finish(),this},finishConditionalExpression:function(a,b,c){return this.type=lc.ConditionalExpression,this.test=a,this.consequent=b,this.alternate=c,this.finish(),this},finishContinueStatement:function(a){return this.type=lc.ContinueStatement,this.label=a,this.finish(),this},finishDebuggerStatement:function(){return this.type=lc.DebuggerStatement,this.finish(),this},finishDoWhileStatement:function(a,b){return this.type=lc.DoWhileStatement,this.body=a,this.test=b,this.finish(),this},finishEmptyStatement:function(){return this.type=lc.EmptyStatement,this.finish(),this},finishExpressionStatement:function(a){return this.type=lc.ExpressionStatement,this.expression=a,this.finish(),this},finishForStatement:function(a,b,c,d){return this.type=lc.ForStatement,this.init=a,this.test=b,this.update=c,this.body=d,this.finish(),this},finishForInStatement:function(a,b,c){return this.type=lc.ForInStatement,this.left=a,this.right=b,this.body=c,this.each=!1,this.finish(),this},finishFunctionDeclaration:function(a,b,c,d){return this.type=lc.FunctionDeclaration,this.id=a,this.params=b,this.defaults=c,this.body=d,this.rest=null,this.generator=!1,this.expression=!1,this.finish(),this},finishFunctionExpression:function(a,b,c,d){return this.type=lc.FunctionExpression,this.id=a,this.params=b,this.defaults=c,this.body=d,this.rest=null,this.generator=!1,this.expression=!1,this.finish(),this},finishIdentifier:function(a){return this.type=lc.Identifier,this.name=a,this.finish(),this},finishIfStatement:function(a,b,c){return this.type=lc.IfStatement,this.test=a,this.consequent=b,this.alternate=c,this.finish(),this},finishLabeledStatement:function(a,b){return this.type=lc.LabeledStatement,this.label=a,this.body=b,this.finish(),this},finishLiteral:function(a){return this.type=lc.Literal,this.value=a.value,this.raw=qc.slice(a.start,a.end),this.finish(),this},finishMemberExpression:function(a,b,c){return this.type=lc.MemberExpression,this.computed="["===a,this.object=b,this.property=c,this.finish(),this},finishNewExpression:function(a,b){return this.type=lc.NewExpression,this.callee=a,this.arguments=b,this.finish(),this},finishObjectExpression:function(a){return this.type=lc.ObjectExpression,this.properties=a,this.finish(),this},finishPostfixExpression:function(a,b){return this.type=lc.UpdateExpression,this.operator=a,this.argument=b,this.prefix=!1,this.finish(),this},finishProgram:function(a){return this.type=lc.Program,this.body=a,this.finish(),this},finishProperty:function(a,b,c){return this.type=lc.Property,this.key=b,this.value=c,this.kind=a,this.finish(),this},finishReturnStatement:function(a){return this.type=lc.ReturnStatement,this.argument=a,this.finish(),this},finishSequenceExpression:function(a){return this.type=lc.SequenceExpression,this.expressions=a,this.finish(),this},finishSwitchCase:function(a,b){return this.type=lc.SwitchCase,this.test=a,this.consequent=b,this.finish(),this},finishSwitchStatement:function(a,b){return this.type=lc.SwitchStatement,this.discriminant=a,this.cases=b,this.finish(),this},finishThisExpression:function(){return this.type=lc.ThisExpression,this.finish(),this},finishThrowStatement:function(a){return this.type=lc.ThrowStatement,this.argument=a,this.finish(),this},finishTryStatement:function(a,b,c,d){return this.type=lc.TryStatement,this.block=a,this.guardedHandlers=b,this.handlers=c,this.finalizer=d,this.finish(),this},finishUnaryExpression:function(a,b){return this.type="++"===a||"--"===a?lc.UpdateExpression:lc.UnaryExpression,this.operator=a,this.argument=b,this.prefix=!0,this.finish(),this},finishVariableDeclaration:function(a,b){return this.type=lc.VariableDeclaration,this.declarations=a,this.kind=b,this.finish(),this},finishVariableDeclarator:function(a,b){return this.type=lc.VariableDeclarator,this.id=a,this.init=b,this.finish(),this},finishWhileStatement:function(a,b){return this.type=lc.WhileStatement,this.test=a,this.body=b,this.finish(),this},finishWithStatement:function(a,b){return this.type=lc.WithStatement,this.object=a,this.body=b,this.finish(),this}},a.version="2.0.0-dev",a.tokenize=gc,a.parse=hc,a.Syntax=function(){var a,b={};"function"==typeof Object.create&&(b=Object.create(null));for(a in lc)lc.hasOwnProperty(a)&&(b[a]=lc[a]);return"function"==typeof Object.freeze&&Object.freeze(b),b}()})},require("MobileServiceClient")}(this||exports),window.Modernizr=function(a,b,c){function d(a){o.cssText=a}function e(a,b){return typeof a===b}var f,g,h,i="2.8.3",j={},k=!0,l=b.documentElement,m="modernizr",n=b.createElement(m),o=n.style,p=({}.toString,{}),q=[],r=q.slice,s={}.hasOwnProperty;h=e(s,"undefined")||e(s.call,"undefined")?function(a,b){return b in a&&e(a.constructor.prototype[b],"undefined")}:function(a,b){return s.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=r.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(r.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(r.call(arguments)))};return d}),p.history=function(){return!(!a.history||!history.pushState)},p.localstorage=function(){try{return localStorage.setItem(m,m),localStorage.removeItem(m),!0}catch(a){return!1}};for(var t in p)h(p,t)&&(g=t.toLowerCase(),j[g]=p[t](),q.push((j[g]?"":"no-")+g));return j.addTest=function(a,b){if("object"==typeof a)for(var d in a)h(a,d)&&j.addTest(d,a[d]);else{if(a=a.toLowerCase(),j[a]!==c)return j;b="function"==typeof b?b():b,"undefined"!=typeof k&&k&&(l.className+=" "+(b?"":"no-")+a),j[a]=b}return j},d(""),n=f=null,j._version=i,l.className=l.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(k?" js "+q.join(" "):""),j}(this,this.document),function(a,b,c){function d(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function e(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);return a.shiftKey||(b=b.toLowerCase()),b}return q[a.which]?q[a.which]:r[a.which]?r[a.which]:String.fromCharCode(a.which).toLowerCase()}function f(a){a=a||{};var b,c=!1;for(b in w)a[b]?c=!0:w[b]=0;c||(z=!1)}function g(a,b,c,d,e,f){var g,h,i=[],j=c.type;if(!u[a])return[];for("keyup"==j&&k(a)&&(b=[a]),g=0;g95&&112>g||q.hasOwnProperty(g)&&(o[q[g]]=g)}e=o[c]?"keydown":"keypress"}return"keypress"==e&&f.length&&(e="keydown"),{key:d,modifiers:f,action:e}}function n(a,b,c,d,e){v[a+":"+c]=b,a=a.replace(/\s+/g," ");var f=a.split(" ");1":".","?":"/","|":"\\"},t={option:"alt",command:"meta","return":"enter",escape:"esc",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},u={},v={},w={},x=!1,y=!1,z=!1;for(c=1;20>c;++c)q[111+c]="f"+c;for(c=0;9>=c;++c)q[c+96]=c;d(b,"keypress",j),d(b,"keydown",j),d(b,"keyup",j);var A={bind:function(a,b,c){a=a instanceof Array?a:[a];for(var d=0;d$(document).height()-100&&c.scrollMore()})},loadRecentTags:function(){if(Modernizr.localstorage&&localStorage.tagsRecentlyAdded){this.tagsRecentlyAdded=JSON.parse(localStorage.tagsRecentlyAdded);{$("#recentlyAddedTags").html(this.tagListTemplate({tags:this.tagsRecentlyAdded,classes:"recentTag"}))}localStorage.tagsRecentlyAdded=JSON.stringify(this.tagsRecentlyAdded)}},updateMRU:function(){var a=this,b=$("#lastUsedTags");client.listTags().done(function(c){b.html(a.tagListTemplate({tags:c,classes:""}))})},scrollMore:function(){!this.enableAutoScroll||0===this.currentSurah||0===this.surahList.length||this.ayahEnd>=this.surahList[this.currentSurah-1].verses||(this.ayahStart+=50,this.ayahEnd=Math.min(this.ayahEnd+50,this.surahList[this.currentSurah-1].verses),this.loadVerses(this.currentSurah,this.ayahStart,this.ayahEnd,!1))},onRecentTagClick:function(a){var b=$(a.currentTarget).data("tag"),c=this.addTagDialogTextBox.val();return c&&(b=c+","+b),this.addTagDialogTextBox.val(b),!1},bindShortcuts:function(){var a=this;Mousetrap.bind("/",function(){return a.searchBox.focus(),!1}),Mousetrap.bind("q",function(){a.navPanel.panel("toggle")}),Mousetrap.bind("l",this.login.bind(this)),Mousetrap.bind("t",this.onAddTagClick.bind(this,null)),Mousetrap.bind("d",this.onDelTagClick.bind(this,null)),Mousetrap.bind("r",this.onRepeatLastTags.bind(this)),Mousetrap.bind("n",this.nextSurah.bind(this)),Mousetrap.bind("p",this.previousSurah.bind(this))},previousSurah:function(){this.currentSurah>1&&this.changeSurah(this.currentSurah-1)},nextSurah:function(){this.currentSurah>0&&this.currentSurah0&&a>this.surahList.length||(this.currentSurah=a,this.updateCurrentSurah(),this.enableAutoScroll=!0,this.resultPane.empty(),this.loadVerses(a,b,c,!0),this.ayahStart=b||1,this.ayahEnd=c||50)},onAddTagFormSubmit:function(){var a=this.addTagForm.data(),b=this.addTagDialogTextBox.val(),c=a.surah,d=a.verse;return this.addTagDialogTextBox.val(""),this.addTags(c,d,b),$("#addTagPanel").panel("close"),!1},addTags:function(a,b,c){var d=this;if(this.lastAddedTags=c,null!==c&&c.length>0){var e=c.split(/[,;]/);$.each(e,function(c,e){d.addTag(e,a,b).done(function(c){console.log("Successfully Added: "+c.text);var e=$("#tags"+a+"_"+b),f=d.verseTagTemplate({tag:c.text,surah:a,verse:b});e.prepend(f)})})}},addTag:function(a,b,c){console.log("Adding tag: "+a+" to ["+b+":"+c+"]");var d=!1;return $.each(this.tagsRecentlyAdded,function(b,c){return c===a?(d=!0,!1):void 0}),d||(this.tagsRecentlyAdded.unshift(a),this.tagsRecentlyAdded=this.tagsRecentlyAdded.slice(0,10),this.loadRecentTags()),this.client.addTag(b,c,a)},onRepeatLastTags:function(a){if(this.client.loggedIn&&this.lastAddedTags){var b=this.findCurrentVerse(a);b&&b.surah&&b.verse&&this.addTags(b.surah,b.verse,this.lastAddedTags)}},findCurrentVerse:function(a){var b=$(".result:hover").first().data();return!b&&a&&a.currentTarget&&(b=$(a.currentTarget).closest(".result").data()),b},onAddTagClick:function(a){if(this.client.loggedIn){var b=this.findCurrentVerse(a);if(b&&b.surah&&b.verse){this.addTagForm.data("surah",b.surah),this.addTagForm.data("verse",b.verse),$("#addTagRef").text(b.surah+":"+b.verse);var c=this.addTagDialogTextBox.val("");this.addTagPanel.panel("open"),setTimeout(function(){c.focus()},500)}}},onDelTagClick:function(a){if(!this.client.loggedIn)return!1;var b=$("li.tag:hover").first();!b&&a&&a.currentTarget&&(b=$(a.currentSurah).closest("li.tag"));var c=b.data();if(!(c&&c.tag&&c.surah&&c.verse))return!1;b.remove();return this.deleteTag(c.tag,c.surah,c.verse),!1},deleteTag:function(a,b,c){console.log("Deleting tag: "+a+" to ["+b+":"+c+"]"),this.client.removeTag(b,c,a).done(function(){console.log("Successfully Deleted")})},onSearchSubmit:function(){var a=this.searchBox.val();return a&&a.length>0&&this.router.navigate("search/"+a,{trigger:!0}),this.searchBox.val(""),!1},toggleMenu:function(){this.navPanel.panel("toggle")},login:function(){if(this.client.canLogin){var a=this;client.login("facebook",{parameters:{display:"popup"}}).done(function(){a.loginRow.hide(),a.$el.addClass("loggedin"),UserVoice.push(["identify",{id:client.currentUser.userId}])},function(a){alert("Error: "+a)})}},doSearch:function(a){var b=verseNumPattern.exec(a);if(b)return this.doViewPassage(b[1],b[2],b[3]);var c=this.nameSurahMap[a.toLowerCase()];if(c)return this.doViewPassage(c);var d="tag: "+a;this.updateTitle(d),this.setCurrentSurah(0),this.enableAutoScroll=!1,console.log("Doing search for: "+a),this.resultPane.empty();var e=this;this.client.findVersesByTag(a).done(function(a){e.updateTitle(d+" - "+a.length+" result(s)"),e.loadResults(a||[],!0)})},loadVerses:function(a,b,c,d){var e=this;this.client.getVersesByRange(a,b,c).done(function(a){e.loadResults(a||[],d)})},updateCurrentSurah:function(){if(this.setCurrentSurah(this.currentSurah),this.currentSurah>0&&this.surahList.length>0){var a=this.surahList[this.currentSurah-1],b=this.surahTitleTemplate(a);this.updateTitle(b)}},loadResults:function(a,b){this.resultPane.append(this.resultTemplate({data:a,tagTemplate:this.verseTagTemplate})),b&&window.scroll(0,0)},updateTitle:function(a){this.mainPageHeading.text(a)},setCurrentSurah:function(a){a>0&&this.surahList.length>0&&this.surahList[a-1].bismillah_pre?this.preText.show():this.preText.hide(),this.surahSelector.val(a),this.surahSelector.selectmenu("refresh"),this.currentSurah=a}});$(function(){appView=new AppView(client,new Workspace),Backbone.history.start()}); --------------------------------------------------------------------------------