trusty-festivity-extension 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +33 -0
- data/README.md +2 -0
- data/Rakefile +110 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/images/pct-black.png +0 -0
- data/app/assets/images/skins/pghkids/footer.png +0 -0
- data/app/assets/images/skins/pghkids/footer_mobile.png +0 -0
- data/app/assets/images/skins/pghkids/frog.png +0 -0
- data/app/assets/images/skins/pghkids/frog_mobile.png +0 -0
- data/app/assets/images/skins/pghkids/header.png +0 -0
- data/app/assets/images/skins/pghkids/header_mobile.png +0 -0
- data/app/assets/images/skins/pghkids/seafoam.jpg +0 -0
- data/app/assets/javascripts/admin/festivity_admin.js +22 -0
- data/app/assets/javascripts/admin/pages/ajax_image_uploader.js +29 -0
- data/app/assets/javascripts/admin/pages/page_bindings.js +94 -0
- data/app/assets/javascripts/admin/pages/performances.js +59 -0
- data/app/assets/javascripts/admin/sites/categories.js +74 -0
- data/app/assets/javascripts/admin/sites/category_types.js +63 -0
- data/app/assets/javascripts/admin/sites/site_bindings.js +4 -0
- data/app/assets/javascripts/ajaxupload.js +1 -0
- data/app/assets/javascripts/bootstrap-sprockets.js +12 -0
- data/app/assets/javascripts/bootstrap.js +2306 -0
- data/app/assets/javascripts/bootstrap.min.js +7 -0
- data/app/assets/javascripts/bootstrap/affix.js +162 -0
- data/app/assets/javascripts/bootstrap/alert.js +94 -0
- data/app/assets/javascripts/bootstrap/button.js +116 -0
- data/app/assets/javascripts/bootstrap/carousel.js +237 -0
- data/app/assets/javascripts/bootstrap/collapse.js +211 -0
- data/app/assets/javascripts/bootstrap/dropdown.js +161 -0
- data/app/assets/javascripts/bootstrap/modal.js +324 -0
- data/app/assets/javascripts/bootstrap/popover.js +113 -0
- data/app/assets/javascripts/bootstrap/scrollspy.js +175 -0
- data/app/assets/javascripts/bootstrap/tab.js +153 -0
- data/app/assets/javascripts/bootstrap/tooltip.js +472 -0
- data/app/assets/javascripts/bootstrap/transition.js +59 -0
- data/app/assets/javascripts/events/event_list_bindings.js +3 -0
- data/app/assets/javascripts/events/filters.js +100 -0
- data/app/assets/javascripts/festivity.js +1 -0
- data/app/assets/javascripts/festivity_app.js +13 -0
- data/app/assets/javascripts/jasny-bootstrap.js +1024 -0
- data/app/assets/javascripts/jquery-migrate.js +521 -0
- data/app/assets/javascripts/jquery.collapse.js +176 -0
- data/app/assets/javascripts/jquery.collapse_cookie_storage.js +37 -0
- data/app/assets/javascripts/jquery.collapse_storage.js +56 -0
- data/app/assets/javascripts/jquery.inputmask.bundle.min.js +10 -0
- data/app/assets/javascripts/lodash.min.js +88 -0
- data/app/assets/javascripts/readmore.min.js +11 -0
- data/app/assets/javascripts/script.js +22 -0
- data/app/assets/javascripts/underscore.js +1545 -0
- data/app/assets/stylesheets/_bootstrap-compass.scss +9 -0
- data/app/assets/stylesheets/_bootstrap-mincer.scss +19 -0
- data/app/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
- data/app/assets/stylesheets/_bootstrap.scss +50 -0
- data/app/assets/stylesheets/_defaults.scss +6 -0
- data/app/assets/stylesheets/_event_filter_bar.scss +78 -0
- data/app/assets/stylesheets/_faq.scss +48 -0
- data/app/assets/stylesheets/_filter-bar-mobile.scss +32 -0
- data/app/assets/stylesheets/_footer.scss +18 -0
- data/app/assets/stylesheets/_global.scss +30 -0
- data/app/assets/stylesheets/_header.scss +95 -0
- data/app/assets/stylesheets/_landing_page.scss +62 -0
- data/app/assets/stylesheets/_locations.scss +17 -0
- data/app/assets/stylesheets/_media-queries.scss +9 -0
- data/app/assets/stylesheets/_mixins.scss +17 -0
- data/app/assets/stylesheets/_nav.scss +128 -0
- data/app/assets/stylesheets/_normalize.scss +375 -0
- data/app/assets/stylesheets/_overrides.scss +11 -0
- data/app/assets/stylesheets/_page-template.scss +124 -0
- data/app/assets/stylesheets/_related_events.scss +20 -0
- data/app/assets/stylesheets/_search-results.scss +20 -0
- data/app/assets/stylesheets/_utils.scss +8 -0
- data/app/assets/stylesheets/admin/festivity_admin.scss +28 -0
- data/app/assets/stylesheets/admin/modules/_category_styles.scss +23 -0
- data/app/assets/stylesheets/admin/modules/_form_styles.scss +40 -0
- data/app/assets/stylesheets/admin/modules/_list_styles.scss +30 -0
- data/app/assets/stylesheets/admin/modules/_variables.scss +3 -0
- data/app/assets/stylesheets/bootstrap/_alerts.scss +73 -0
- data/app/assets/stylesheets/bootstrap/_badges.scss +67 -0
- data/app/assets/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
- data/app/assets/stylesheets/bootstrap/_button-groups.scss +243 -0
- data/app/assets/stylesheets/bootstrap/_buttons.scss +160 -0
- data/app/assets/stylesheets/bootstrap/_carousel.scss +269 -0
- data/app/assets/stylesheets/bootstrap/_close.scss +36 -0
- data/app/assets/stylesheets/bootstrap/_code.scss +69 -0
- data/app/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
- data/app/assets/stylesheets/bootstrap/_dropdowns.scss +214 -0
- data/app/assets/stylesheets/bootstrap/_forms.scss +570 -0
- data/app/assets/stylesheets/bootstrap/_glyphicons.scss +301 -0
- data/app/assets/stylesheets/bootstrap/_grid.scss +84 -0
- data/app/assets/stylesheets/bootstrap/_input-groups.scss +166 -0
- data/app/assets/stylesheets/bootstrap/_jumbotron.scss +50 -0
- data/app/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/app/assets/stylesheets/bootstrap/_list-group.scss +124 -0
- data/app/assets/stylesheets/bootstrap/_media.scss +61 -0
- data/app/assets/stylesheets/bootstrap/_mixins.scss +39 -0
- data/app/assets/stylesheets/bootstrap/_modals.scss +148 -0
- data/app/assets/stylesheets/bootstrap/_navbar.scss +663 -0
- data/app/assets/stylesheets/bootstrap/_navs.scss +244 -0
- data/app/assets/stylesheets/bootstrap/_normalize.scss +427 -0
- data/app/assets/stylesheets/bootstrap/_pager.scss +54 -0
- data/app/assets/stylesheets/bootstrap/_pagination.scss +88 -0
- data/app/assets/stylesheets/bootstrap/_panels.scss +265 -0
- data/app/assets/stylesheets/bootstrap/_popovers.scss +135 -0
- data/app/assets/stylesheets/bootstrap/_print.scss +107 -0
- data/app/assets/stylesheets/bootstrap/_progress-bars.scss +87 -0
- data/app/assets/stylesheets/bootstrap/_responsive-embed.scss +35 -0
- data/app/assets/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
- data/app/assets/stylesheets/bootstrap/_scaffolding.scss +150 -0
- data/app/assets/stylesheets/bootstrap/_tables.scss +234 -0
- data/app/assets/stylesheets/bootstrap/_theme.scss +273 -0
- data/app/assets/stylesheets/bootstrap/_thumbnails.scss +38 -0
- data/app/assets/stylesheets/bootstrap/_tooltip.scss +103 -0
- data/app/assets/stylesheets/bootstrap/_type.scss +298 -0
- data/app/assets/stylesheets/bootstrap/_utilities.scss +56 -0
- data/app/assets/stylesheets/bootstrap/_variables.scss +862 -0
- data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/app/assets/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
- data/app/assets/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
- data/app/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/app/assets/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
- data/app/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/app/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/app/assets/stylesheets/bootstrap/mixins/_forms.scss +88 -0
- data/app/assets/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
- data/app/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/app/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/app/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/app/assets/stylesheets/bootstrap/mixins/_image.scss +33 -0
- data/app/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/app/assets/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
- data/app/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/app/assets/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
- data/app/assets/stylesheets/bootstrap/mixins/_panels.scss +24 -0
- data/app/assets/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/app/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
- data/app/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/app/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/app/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
- data/app/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- data/app/assets/stylesheets/events/_event-list-item.scss +85 -0
- data/app/assets/stylesheets/events/_event_template.scss +66 -0
- data/app/assets/stylesheets/events/_filter-bar.scss +5 -0
- data/app/assets/stylesheets/festivity.scss +35 -0
- data/app/assets/stylesheets/skins/pghkids/_events.scss +17 -0
- data/app/assets/stylesheets/skins/pghkids/_footer.scss +22 -0
- data/app/assets/stylesheets/skins/pghkids/_global.scss +42 -0
- data/app/assets/stylesheets/skins/pghkids/_header.scss +27 -0
- data/app/assets/stylesheets/skins/pghkids/_home.scss +113 -0
- data/app/assets/stylesheets/skins/pghkids/skin.scss +8 -0
- data/app/assets/stylesheets/vars/_vars_color.scss +6 -0
- data/app/assets/stylesheets/vars/_vars_media-queries.scss +5 -0
- data/app/assets/stylesheets/vars/_vars_type.scss +1 -0
- data/app/controllers/admin/festivity_categories_controller.rb +31 -0
- data/app/controllers/admin/festivity_category_types_controller.rb +31 -0
- data/app/controllers/admin/festivity_performances_controller.rb +21 -0
- data/app/controllers/festivity_events_controller.rb +71 -0
- data/app/controllers/festivity_location_areas_controller.rb +17 -0
- data/app/controllers/festivity_locations_controller.rb +19 -0
- data/app/controllers/search_controller.rb +17 -0
- data/app/helpers/admin/festivity_performances_helper.rb +3 -0
- data/app/helpers/admin/snippets_helper.rb +3 -0
- data/app/helpers/festivity_events_helper.rb +12 -0
- data/app/helpers/festivity_locations_helper.rb +4 -0
- data/app/models/festivity_base_page.rb +23 -0
- data/app/models/festivity_category.rb +17 -0
- data/app/models/festivity_category_type.rb +14 -0
- data/app/models/festivity_event_list.rb +90 -0
- data/app/models/festivity_event_list/festivity_event.rb +40 -0
- data/app/models/festivity_event_list/festivity_event_performance.rb +10 -0
- data/app/models/festivity_event_list/festivity_location.rb +15 -0
- data/app/models/festivity_event_page.rb +55 -0
- data/app/models/festivity_location_area_page.rb +5 -0
- data/app/models/festivity_location_page.rb +3 -0
- data/app/models/festivity_market_page.rb +3 -0
- data/app/models/festivity_page_category.rb +4 -0
- data/app/models/festivity_performance.rb +29 -0
- data/app/views/admin/pages/_festivity_base_fields.html.haml +75 -0
- data/app/views/admin/pages/_festivity_featured_image_fields.html.haml +3 -0
- data/app/views/admin/pages/_festivity_includes.html.haml +2 -0
- data/app/views/admin/pages/_festivity_location_fields.html.haml +26 -0
- data/app/views/admin/pages/partials/_categories.html.haml +18 -0
- data/app/views/admin/pages/partials/_category.html.haml +4 -0
- data/app/views/admin/pages/partials/_featured_image.html.haml +18 -0
- data/app/views/admin/pages/partials/_performance.html.haml +13 -0
- data/app/views/admin/pages/partials/_performances.html.haml +11 -0
- data/app/views/admin/pages/partials/_performances_table.html.haml +15 -0
- data/app/views/admin/sites/_festivity_site_fields.html.haml +26 -0
- data/app/views/admin/sites/partials/_category.html.haml +7 -0
- data/app/views/admin/sites/partials/_category_popup.html.haml +19 -0
- data/app/views/admin/sites/partials/_category_popups.haml +27 -0
- data/app/views/admin/sites/partials/_category_section.html.haml +7 -0
- data/app/views/admin/sites/partials/_category_types.html.haml +23 -0
- data/app/views/admin/sites/partials/_filters.html.haml +25 -0
- data/app/views/admin/sites/partials/_new_category.html.haml +3 -0
- data/app/views/admin/sites/partials/_new_category_type.html.haml +3 -0
- data/app/views/festivity_events/_event_filters.html.haml +39 -0
- data/app/views/festivity_events/_event_list.html.haml +62 -0
- data/app/views/festivity_events/_filter_bar_mobile.html.haml +22 -0
- data/app/views/festivity_events/index.html.haml +34 -0
- data/app/views/festivity_events/show.html.haml +152 -0
- data/app/views/festivity_location_areas/show.html.haml +29 -0
- data/app/views/festivity_locations/show.html.haml +66 -0
- data/app/views/header/_meta_tags.html.haml +8 -0
- data/app/views/navigation/_subnav_one_column.html.haml +15 -0
- data/app/views/navigation/_subnav_three_column.html.haml +7 -0
- data/app/views/navigation/_three_column_item.html.haml +11 -0
- data/app/views/search/_page.html.haml +1 -0
- data/app/views/search/_pagination_links.html.haml +7 -0
- data/app/views/search/_result_item.html.haml +6 -0
- data/app/views/search/show.html.haml +19 -0
- data/config/initializers/pluralizations.rb +0 -0
- data/config/initializers/radiant_config.rb +1 -0
- data/config/locales/en.yml +16 -0
- data/config/routes.rb +14 -0
- data/config/trustygems.yml +2 -0
- data/db/content/layouts/base.html +174 -0
- data/db/content/layouts/normal.html +5 -0
- data/db/fixtures/home_pages.yml +40 -0
- data/db/fixtures/layouts.yml +2 -0
- data/db/fixtures/pages.yml +23 -0
- data/db/fixtures/sites.yml +57 -0
- data/db/fixtures/users.yml +8 -0
- data/db/migrate/200150325136087799_add_event_performances_view.rb +27 -0
- data/db/migrate/200150425136087799_update_event_performances_view_with_site.rb +27 -0
- data/db/migrate/20150123175758_add_site_fields.rb +15 -0
- data/db/migrate/20150127090858995_add_base_event_fields.rb +24 -0
- data/db/migrate/20150127091005232_add_market_and_event_fields.rb +29 -0
- data/db/migrate/20150204113325731_add_category_types_table.rb +15 -0
- data/db/migrate/20150204113427832_add_categories_table.rb +15 -0
- data/db/migrate/20150204113510326_add_page_categories_table.rb +12 -0
- data/db/migrate/20150226131727777_add_location_page_fields.rb +19 -0
- data/db/migrate/20150302135485569_add_performances_table.rb +19 -0
- data/db/migrate/20150324135487799_add_indexes.rb +21 -0
- data/festivity_extension.rb +25 -0
- data/lib/festivity/admin/assets_helper.rb +17 -0
- data/lib/festivity/engine.rb +9 -0
- data/lib/festivity/extensions/page_extensions.rb +61 -0
- data/lib/festivity/extensions/pages_helper_extensions.rb +11 -0
- data/lib/festivity/extensions/paperclipped_extensions.rb +22 -0
- data/lib/festivity/extensions/site_extensions.rb +40 -0
- data/lib/festivity/mixins/not_found.rb +10 -0
- data/lib/tags/header_tags.rb +41 -0
- data/lib/tags/navigation_tags.rb +55 -0
- data/lib/tasks/active_record_utils.rb +35 -0
- data/lib/tasks/festivity_extension_tasks.rake +7 -0
- data/lib/tasks/setup.rake +101 -0
- data/lib/trusty-festivity-extension.rb +8 -0
- data/trusty-festivity-extension.gemspec +37 -0
- metadata +442 -0
@@ -0,0 +1,176 @@
|
|
1
|
+
/*
|
2
|
+
* Collapse plugin for jQuery
|
3
|
+
* --
|
4
|
+
* source: http://github.com/danielstocks/jQuery-Collapse/
|
5
|
+
* site: http://webcloud.se/jQuery-Collapse
|
6
|
+
*
|
7
|
+
* @author Daniel Stocks (http://webcloud.se)
|
8
|
+
* Copyright 2013, Daniel Stocks
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function($) {
|
13
|
+
|
14
|
+
// Constructor
|
15
|
+
function Collapse (el, options) {
|
16
|
+
options = options || {};
|
17
|
+
var _this = this,
|
18
|
+
query = options.query || "> :even";
|
19
|
+
|
20
|
+
$.extend(_this, {
|
21
|
+
$el: el,
|
22
|
+
options : options,
|
23
|
+
sections: [],
|
24
|
+
isAccordion : options.accordion || false,
|
25
|
+
db : options.persist ? jQueryCollapseStorage(el.get(0).id) : false
|
26
|
+
});
|
27
|
+
|
28
|
+
// Figure out what sections are open if storage is used
|
29
|
+
_this.states = _this.db ? _this.db.read() : [];
|
30
|
+
|
31
|
+
// For every pair of elements in given
|
32
|
+
// element, create a section
|
33
|
+
_this.$el.find(query).each(function() {
|
34
|
+
new jQueryCollapseSection($(this), _this);
|
35
|
+
});
|
36
|
+
|
37
|
+
// Capute ALL the clicks!
|
38
|
+
(function(scope) {
|
39
|
+
_this.$el.on("click", "[data-collapse-summary] " + (scope.options.clickQuery || ""),
|
40
|
+
$.proxy(_this.handleClick, scope));
|
41
|
+
|
42
|
+
_this.$el.bind("toggle close open",
|
43
|
+
$.proxy(_this.handleEvent, scope));
|
44
|
+
|
45
|
+
}(_this));
|
46
|
+
}
|
47
|
+
|
48
|
+
Collapse.prototype = {
|
49
|
+
handleClick: function(e, state) {
|
50
|
+
e.preventDefault();
|
51
|
+
var state = state || "toggle"
|
52
|
+
var sections = this.sections,
|
53
|
+
l = sections.length;
|
54
|
+
while(l--) {
|
55
|
+
if($.contains(sections[l].$summary[0], e.target)) {
|
56
|
+
sections[l][state]();
|
57
|
+
break;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
},
|
61
|
+
handleEvent: function(e) {
|
62
|
+
if(e.target == this.$el.get(0)) return this[e.type]();
|
63
|
+
this.handleClick(e, e.type);
|
64
|
+
},
|
65
|
+
open: function(eq) {
|
66
|
+
if(isFinite(eq)) return this.sections[eq].open();
|
67
|
+
$.each(this.sections, function(i, section) {
|
68
|
+
section.open();
|
69
|
+
})
|
70
|
+
},
|
71
|
+
close: function(eq) {
|
72
|
+
if(isFinite(eq)) return this.sections[eq].close();
|
73
|
+
$.each(this.sections, function(i, section) {
|
74
|
+
section.close();
|
75
|
+
})
|
76
|
+
},
|
77
|
+
toggle: function(eq) {
|
78
|
+
if(isFinite(eq)) return this.sections[eq].toggle();
|
79
|
+
$.each(this.sections, function(i, section) {
|
80
|
+
section.toggle();
|
81
|
+
})
|
82
|
+
}
|
83
|
+
};
|
84
|
+
|
85
|
+
// Section constructor
|
86
|
+
function Section($el, parent) {
|
87
|
+
|
88
|
+
if(!parent.options.clickQuery) $el.wrapInner('<a href="#"/>');
|
89
|
+
|
90
|
+
$.extend(this, {
|
91
|
+
isOpen : false,
|
92
|
+
$summary : $el.attr("data-collapse-summary",""),
|
93
|
+
$details : $el.next(),
|
94
|
+
options: parent.options,
|
95
|
+
parent: parent
|
96
|
+
});
|
97
|
+
parent.sections.push(this);
|
98
|
+
|
99
|
+
// Check current state of section
|
100
|
+
var state = parent.states[this._index()];
|
101
|
+
|
102
|
+
if(state === 0) {
|
103
|
+
this.close(true)
|
104
|
+
}
|
105
|
+
else if(this.$summary.is(".open") || state === 1) {
|
106
|
+
this.open(true);
|
107
|
+
} else {
|
108
|
+
this.close(true)
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
Section.prototype = {
|
113
|
+
toggle : function() {
|
114
|
+
this.isOpen ? this.close() : this.open();
|
115
|
+
},
|
116
|
+
close: function(bypass) {
|
117
|
+
this._changeState("close", bypass);
|
118
|
+
},
|
119
|
+
open: function(bypass) {
|
120
|
+
var _this = this;
|
121
|
+
if(_this.options.accordion && !bypass) {
|
122
|
+
$.each(_this.parent.sections, function(i, section) {
|
123
|
+
section.close()
|
124
|
+
});
|
125
|
+
}
|
126
|
+
_this._changeState("open", bypass);
|
127
|
+
},
|
128
|
+
_index: function() {
|
129
|
+
return $.inArray(this, this.parent.sections);
|
130
|
+
},
|
131
|
+
_changeState: function(state, bypass) {
|
132
|
+
|
133
|
+
var _this = this;
|
134
|
+
_this.isOpen = state == "open";
|
135
|
+
if($.isFunction(_this.options[state]) && !bypass) {
|
136
|
+
_this.options[state].apply(_this.$details);
|
137
|
+
} else {
|
138
|
+
_this.$details[_this.isOpen ? "show" : "hide"]();
|
139
|
+
}
|
140
|
+
|
141
|
+
_this.$summary.toggleClass("open", state != "close")
|
142
|
+
_this.$details.attr("aria-hidden", state == "close");
|
143
|
+
_this.$summary.attr("aria-expanded", state == "open");
|
144
|
+
_this.$summary.trigger(state == "open" ? "opened" : "closed", _this);
|
145
|
+
if(_this.parent.db) {
|
146
|
+
_this.parent.db.write(_this._index(), _this.isOpen);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
};
|
150
|
+
|
151
|
+
// Expose in jQuery API
|
152
|
+
$.fn.extend({
|
153
|
+
collapse: function(options, scan) {
|
154
|
+
var nodes = (scan) ? $("body").find("[data-collapse]") : $(this);
|
155
|
+
return nodes.each(function() {
|
156
|
+
var settings = (scan) ? {} : options,
|
157
|
+
values = $(this).attr("data-collapse") || "";
|
158
|
+
$.each(values.split(" "), function(i,v) {
|
159
|
+
if(v) settings[v] = true;
|
160
|
+
});
|
161
|
+
new Collapse($(this), settings);
|
162
|
+
});
|
163
|
+
}
|
164
|
+
});
|
165
|
+
|
166
|
+
//jQuery DOM Ready
|
167
|
+
$(function() {
|
168
|
+
$.fn.collapse(false, true);
|
169
|
+
});
|
170
|
+
|
171
|
+
// Expose constructor to
|
172
|
+
// global namespace
|
173
|
+
jQueryCollapse = Collapse;
|
174
|
+
jQueryCollapseSection = Section;
|
175
|
+
|
176
|
+
})(window.jQuery);
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/*
|
2
|
+
* Cookie Storage for jQuery Collapse
|
3
|
+
* --
|
4
|
+
* source: http://github.com/danielstocks/jQuery-Collapse/
|
5
|
+
* site: http://webcloud.se/jQuery-Collapse
|
6
|
+
*
|
7
|
+
* @author Daniel Stocks (http://webcloud.se)
|
8
|
+
* Copyright 2013, Daniel Stocks
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function($) {
|
13
|
+
|
14
|
+
var cookieStorage = {
|
15
|
+
expires: function() {
|
16
|
+
var now = new Date();
|
17
|
+
return now.setDate(now.getDate() + 1);
|
18
|
+
}(),
|
19
|
+
setItem: function(key, value) {
|
20
|
+
document.cookie = key + '=' + value + '; expires=' + this.expires +'; path=/';
|
21
|
+
},
|
22
|
+
getItem: function(key) {
|
23
|
+
key+= "=";
|
24
|
+
var item = "";
|
25
|
+
$.each(document.cookie.split(';'), function(i, cookie) {
|
26
|
+
while (cookie.charAt(0)==' ') cookie = cookie.substring(1,cookie.length);
|
27
|
+
if(cookie.indexOf(key) === 0) {
|
28
|
+
item = cookie.substring(key.length,cookie.length);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
return item;
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
$.fn.collapse.cookieStorage = cookieStorage;
|
36
|
+
|
37
|
+
})(jQuery);
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*
|
2
|
+
* Storage for jQuery Collapse
|
3
|
+
* --
|
4
|
+
* source: http://github.com/danielstocks/jQuery-Collapse/
|
5
|
+
* site: http://webcloud.se/jQuery-Collapse
|
6
|
+
*
|
7
|
+
* @author Daniel Stocks (http://webcloud.se)
|
8
|
+
* Copyright 2013, Daniel Stocks
|
9
|
+
* Released under the MIT, BSD, and GPL Licenses.
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function($) {
|
13
|
+
|
14
|
+
var STORAGE_KEY = "jQuery-Collapse";
|
15
|
+
|
16
|
+
function Storage(id) {
|
17
|
+
var DB;
|
18
|
+
try {
|
19
|
+
DB = window.localStorage || $.fn.collapse.cookieStorage;
|
20
|
+
} catch(e) {
|
21
|
+
DB = false;
|
22
|
+
}
|
23
|
+
return DB ? new _Storage(id, DB) : false;
|
24
|
+
}
|
25
|
+
function _Storage(id, DB) {
|
26
|
+
this.id = id;
|
27
|
+
this.db = DB;
|
28
|
+
this.data = [];
|
29
|
+
}
|
30
|
+
_Storage.prototype = {
|
31
|
+
write: function(position, state) {
|
32
|
+
var _this = this;
|
33
|
+
_this.data[position] = state ? 1 : 0;
|
34
|
+
// Pad out data array with zero values
|
35
|
+
$.each(_this.data, function(i) {
|
36
|
+
if(typeof _this.data[i] == 'undefined') {
|
37
|
+
_this.data[i] = 0;
|
38
|
+
}
|
39
|
+
});
|
40
|
+
var obj = this._getDataObject();
|
41
|
+
obj[this.id] = this.data;
|
42
|
+
this.db.setItem(STORAGE_KEY, JSON.stringify(obj));
|
43
|
+
},
|
44
|
+
read: function() {
|
45
|
+
var obj = this._getDataObject();
|
46
|
+
return obj[this.id] || [];
|
47
|
+
},
|
48
|
+
_getDataObject: function() {
|
49
|
+
var string = this.db.getItem(STORAGE_KEY);
|
50
|
+
return string ? JSON.parse(string) : {};
|
51
|
+
}
|
52
|
+
};
|
53
|
+
|
54
|
+
jQueryCollapseStorage = Storage;
|
55
|
+
|
56
|
+
})(jQuery);
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/*!
|
2
|
+
* jquery.inputmask.bundle
|
3
|
+
* http://github.com/RobinHerbots/jquery.inputmask
|
4
|
+
* Copyright (c) 2010 - 2015 Robin Herbots
|
5
|
+
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
6
|
+
* Version: 3.1.62-12
|
7
|
+
*/
|
8
|
+
!function(a){function b(a){var b=document.createElement("input"),c="on"+a,d=c in b;return d||(b.setAttribute(c,"return;"),d="function"==typeof b[c]),b=null,d}function c(a){var b="text"==a||"tel"==a;if(!b){var c=document.createElement("input");c.setAttribute("type",a),b="text"===c.type,c=null}return b}function d(b,c,e){var f=e.aliases[b];return f?(f.alias&&d(f.alias,void 0,e),a.extend(!0,e,f),a.extend(!0,e,c),!0):!1}function e(b,c){function d(c){function d(a,b,c,d){this.matches=[],this.isGroup=a||!1,this.isOptional=b||!1,this.isQuantifier=c||!1,this.isAlternator=d||!1,this.quantifier={min:1,max:1}}function e(c,d,e){var f=b.definitions[d],g=0==c.matches.length;if(e=void 0!=e?e:c.matches.length,f&&!m){f.placeholder=a.isFunction(f.placeholder)?f.placeholder.call(this,b):f.placeholder;for(var h=f.prevalidator,i=h?h.length:0,j=1;j<f.cardinality;j++){var k=i>=j?h[j-1]:[],l=k.validator,n=k.cardinality;c.matches.splice(e++,0,{fn:l?"string"==typeof l?new RegExp(l):new function(){this.test=l}:new RegExp("."),cardinality:n?n:1,optionality:c.isOptional,newBlockMarker:g,casing:f.casing,def:f.definitionSymbol||d,placeholder:f.placeholder,mask:d})}c.matches.splice(e++,0,{fn:f.validator?"string"==typeof f.validator?new RegExp(f.validator):new function(){this.test=f.validator}:new RegExp("."),cardinality:f.cardinality,optionality:c.isOptional,newBlockMarker:g,casing:f.casing,def:f.definitionSymbol||d,placeholder:f.placeholder,mask:d})}else c.matches.splice(e++,0,{fn:null,cardinality:0,optionality:c.isOptional,newBlockMarker:g,casing:null,def:d,placeholder:void 0,mask:d}),m=!1}for(var f,g,h,i,j,k,l=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,m=!1,n=new d,o=[],p=[];f=l.exec(c);)switch(g=f[0],g.charAt(0)){case b.optionalmarker.end:case b.groupmarker.end:if(h=o.pop(),o.length>0){if(i=o[o.length-1],i.matches.push(h),i.isAlternator){j=o.pop();for(var q=0;q<j.matches.length;q++)j.matches[q].isGroup=!1;o.length>0?(i=o[o.length-1],i.matches.push(j)):n.matches.push(j)}}else n.matches.push(h);break;case b.optionalmarker.start:o.push(new d(!1,!0));break;case b.groupmarker.start:o.push(new d(!0));break;case b.quantifiermarker.start:var r=new d(!1,!1,!0);g=g.replace(/[{}]/g,"");var s=g.split(","),t=isNaN(s[0])?s[0]:parseInt(s[0]),u=1==s.length?t:isNaN(s[1])?s[1]:parseInt(s[1]);if(("*"==u||"+"==u)&&(t="*"==u?0:1),r.quantifier={min:t,max:u},o.length>0){var v=o[o.length-1].matches;if(f=v.pop(),!f.isGroup){var w=new d(!0);w.matches.push(f),f=w}v.push(f),v.push(r)}else{if(f=n.matches.pop(),!f.isGroup){var w=new d(!0);w.matches.push(f),f=w}n.matches.push(f),n.matches.push(r)}break;case b.escapeChar:m=!0;break;case b.alternatormarker:o.length>0?(i=o[o.length-1],k=i.matches.pop()):k=n.matches.pop(),k.isAlternator?o.push(k):(j=new d(!1,!1,!1,!0),j.matches.push(k),o.push(j));break;default:if(o.length>0){if(i=o[o.length-1],i.matches.length>0&&(k=i.matches[i.matches.length-1],k.isGroup&&(k.isGroup=!1,e(k,b.groupmarker.start,0),e(k,b.groupmarker.end))),e(i,g),i.isAlternator){j=o.pop();for(var q=0;q<j.matches.length;q++)j.matches[q].isGroup=!1;o.length>0?(i=o[o.length-1],i.matches.push(j)):n.matches.push(j)}}else n.matches.length>0&&(k=n.matches[n.matches.length-1],k.isGroup&&(k.isGroup=!1,e(k,b.groupmarker.start,0),e(k,b.groupmarker.end))),e(n,g)}return n.matches.length>0&&(k=n.matches[n.matches.length-1],k.isGroup&&(k.isGroup=!1,e(k,b.groupmarker.start,0),e(k,b.groupmarker.end)),p.push(n)),p}function e(e,f){if(void 0==e||""==e)return void 0;if(1==e.length&&0==b.greedy&&0!=b.repeat&&(b.placeholder=""),b.repeat>0||"*"==b.repeat||"+"==b.repeat){var g="*"==b.repeat?0:"+"==b.repeat?1:b.repeat;e=b.groupmarker.start+e+b.groupmarker.end+b.quantifiermarker.start+g+","+b.repeat+b.quantifiermarker.end}var h;return void 0==a.inputmask.masksCache[e]||c===!0?(h={mask:e,maskToken:d(e),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:f},c!==!0&&(a.inputmask.masksCache[e]=h)):h=a.extend(!0,{},a.inputmask.masksCache[e]),h}function f(a){if(a=a.toString(),b.numericInput){a=a.split("").reverse();for(var c=0;c<a.length;c++)a[c]==b.optionalmarker.start?a[c]=b.optionalmarker.end:a[c]==b.optionalmarker.end?a[c]=b.optionalmarker.start:a[c]==b.groupmarker.start?a[c]=b.groupmarker.end:a[c]==b.groupmarker.end&&(a[c]=b.groupmarker.start);a=a.join("")}return a}var g=void 0;if(a.isFunction(b.mask)&&(b.mask=b.mask.call(this,b)),a.isArray(b.mask)){if(b.mask.length>1){b.keepStatic=void 0==b.keepStatic?!0:b.keepStatic;var h="(";return a.each(b.mask,function(b,c){h.length>1&&(h+=")|("),h+=f(void 0==c.mask||a.isFunction(c.mask)?c:c.mask)}),h+=")",e(h,b.mask)}b.mask=b.mask.pop()}return b.mask&&(g=void 0==b.mask.mask||a.isFunction(b.mask.mask)?e(f(b.mask),b.mask):e(f(b.mask.mask),b.mask)),g}function f(d,e,f){function g(a,b,c){b=b||0;var d,e,f,g=[],h=0;do{if(a===!0&&l().validPositions[h]){var i=l().validPositions[h];e=i.match,d=i.locator.slice(),g.push(c===!0?i.input:G(h,e))}else f=q(h,d,h-1),e=f.match,d=f.locator.slice(),g.push(G(h,e));h++}while((void 0==db||db>h-1)&&null!=e.fn||null==e.fn&&""!=e.def||b>=h);return g.pop(),g}function l(){return e}function m(a){var b=l();b.buffer=void 0,b.tests={},a!==!0&&(b._buffer=void 0,b.validPositions={},b.p=0)}function n(a){var b=l(),c=-1,d=b.validPositions;void 0==a&&(a=-1);var e=c,f=c;for(var g in d){var h=parseInt(g);d[h]&&null!=d[h].match.fn&&(a>=h&&(e=h),h>=a&&(f=h))}return c=-1!=e&&a-e>1||a>f?e:f}function o(b,c,d){if(f.insertMode&&void 0!=l().validPositions[b]&&void 0==d){var e,g=a.extend(!0,{},l().validPositions),h=n();for(e=b;h>=e;e++)delete l().validPositions[e];l().validPositions[b]=c;var i,j=!0;for(e=b;h>=e;e++){var k=g[e];if(void 0!=k){var m=l().validPositions;i=!f.keepStatic&&m[e]&&(void 0!=m[e+1]&&t(e+1,m[e].locator.slice(),e).length>1||void 0!=m[e].alternation)?e+1:C(e),j=s(i,k.match.def)?j&&z(i,k.input,!0,!0)!==!1:null==k.match.fn}if(!j)break}if(!j)return l().validPositions=a.extend(!0,{},g),!1}else l().validPositions[b]=c;return!0}function p(a,b,c,d){var e,g=a;l().p=a,void 0!=l().validPositions[a]&&l().validPositions[a].input==f.radixPoint&&(b++,g++);for(e=g;b>e;e++)void 0!=l().validPositions[e]&&(c===!0||0!=f.canClearPosition(l(),e,n(),d,f))&&delete l().validPositions[e];for(m(!0),e=g+1;e<=n();){for(;void 0!=l().validPositions[g];)g++;var h=l().validPositions[g];g>e&&(e=g+1);var i=l().validPositions[e];void 0!=i&&void 0==h?(s(g,i.match.def)&&z(g,i.input,!0)!==!1&&(delete l().validPositions[e],e++),g++):e++}var j=n(),k=B();for(j>=a&&void 0!=l().validPositions[j]&&l().validPositions[j].input==f.radixPoint&&delete l().validPositions[j],e=j+1;k>=e;e++)l().validPositions[e]&&delete l().validPositions[e];m(!0)}function q(a,b,c){var d=l().validPositions[a];if(void 0==d)for(var e=t(a,b,c),g=n(),h=l().validPositions[g]||t(0)[0],i=void 0!=h.alternation?h.locator[h.alternation].split(","):[],j=0;j<e.length&&(d=e[j],!(d.match&&(f.greedy&&d.match.optionalQuantifier!==!0||(d.match.optionality===!1||d.match.newBlockMarker===!1)&&d.match.optionalQuantifier!==!0)&&(void 0==h.alternation||void 0!=d.locator[h.alternation]&&y(d.locator[h.alternation].toString().split(","),i))));j++);return d}function r(a){return l().validPositions[a]?l().validPositions[a].match:t(a)[0].match}function s(a,b){for(var c=!1,d=t(a),e=0;e<d.length;e++)if(d[e].match&&d[e].match.def==b){c=!0;break}return c}function t(b,c,d){function e(c,d,f,h){function k(f,h,n){if(g>1e4)return alert("jquery.inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+l().mask),!0;if(g==b&&void 0==f.matches)return i.push({match:f,locator:h.reverse()}),!0;if(void 0!=f.matches){if(f.isGroup&&n!==!0){if(f=k(c.matches[m+1],h))return!0}else if(f.isOptional){var o=f;if(f=e(f,d,h,n)){var p=i[i.length-1].match,q=0==a.inArray(p,o.matches);q&&(j=!0),g=b}}else if(f.isAlternator){var r,s=f,t=[],u=i.slice(),v=h.length,w=d.length>0?d.shift():-1;if(-1==w||"string"==typeof w){var x,y=g,z=d.slice();"string"==typeof w&&(x=w.split(","));for(var A=0;A<s.matches.length;A++){i=[],f=k(s.matches[A],[A].concat(h),n)||f,r=i.slice(),g=y,i=[];for(var B=0;B<z.length;B++)d[B]=z[B];for(var C=0;C<r.length;C++)for(var D=r[C],E=0;E<t.length;E++){var F=t[E];if(D.match.mask==F.match.mask&&("string"!=typeof w||-1!=a.inArray(D.locator[v].toString(),x))){r.splice(C,1),F.locator[v]=F.locator[v]+","+D.locator[v],F.alternation=v;break}}t=t.concat(r)}"string"==typeof w&&(t=a.map(t,function(b,c){if(isFinite(c)){var d,e=b.locator[v].toString().split(",");b.locator[v]=void 0,b.alternation=void 0;for(var f=0;f<e.length;f++)d=-1!=a.inArray(e[f],x),d&&(void 0!=b.locator[v]?(b.locator[v]+=",",b.alternation=v,b.locator[v]+=e[f]):b.locator[v]=parseInt(e[f]));if(void 0!=b.locator[v])return b}})),i=u.concat(t),j=!0}else f=k(s.matches[w],[w].concat(h),n);if(f)return!0}else if(f.isQuantifier&&n!==!0)for(var G=f,H=d.length>0&&n!==!0?d.shift():0;H<(isNaN(G.quantifier.max)?H+1:G.quantifier.max)&&b>=g;H++){var I=c.matches[a.inArray(G,c.matches)-1];if(f=k(I,[H].concat(h),!0)){var p=i[i.length-1].match;p.optionalQuantifier=H>G.quantifier.min-1;var q=0==a.inArray(p,I.matches);if(q){if(H>G.quantifier.min-1){j=!0,g=b;break}return!0}return!0}}else if(f=e(f,d,h,n))return!0}else g++}for(var m=d.length>0?d.shift():0;m<c.matches.length;m++)if(c.matches[m].isQuantifier!==!0){var n=k(c.matches[m],[m].concat(f),h);if(n&&g==b)return n;if(g>b)break}}var f=l().maskToken,g=c?d:0,h=c||[0],i=[],j=!1;if(void 0==c){for(var k,m=b-1;void 0==(k=l().validPositions[m])&&m>-1;)m--;if(void 0!=k&&m>-1)g=m,h=k.locator.slice();else{for(m=b-1;void 0==(k=l().tests[m])&&m>-1;)m--;void 0!=k&&m>-1&&(g=m,h=k[0].locator.slice())}}for(var n=h.shift();n<f.length;n++){var o=e(f[n],h,[n]);if(o&&g==b||g>b)break}return(0==i.length||j)&&i.push({match:{fn:null,cardinality:0,optionality:!0,casing:null,def:""},locator:[]}),l().tests[b]=a.extend(!0,[],i),l().tests[b]}function u(){return void 0==l()._buffer&&(l()._buffer=g(!1,1)),l()._buffer}function v(){return void 0==l().buffer&&(l().buffer=g(!0,n(),!0)),l().buffer}function w(a,b,c){if(c=c||v().slice(),a===!0)m(),a=0,b=c.length;else for(var d=a;b>d;d++)delete l().validPositions[d],delete l().tests[d];for(var d=a;b>d;d++)c[d]!=f.skipOptionalPartCharacter&&z(d,c[d],!0,!0)}function x(a,b){switch(b.casing){case"upper":a=a.toUpperCase();break;case"lower":a=a.toLowerCase()}return a}function y(b,c){for(var d=f.greedy?c:c.slice(0,1),e=!1,g=0;g<b.length;g++)if(-1!=a.inArray(b[g],d)){e=!0;break}return e}function z(b,c,d,e){function g(b,c,d,e){var g=!1;return a.each(t(b),function(h,i){for(var j=i.match,k=c?1:0,q="",r=(v(),j.cardinality);r>k;r--)q+=E(b-(r-1));if(c&&(q+=c),g=null!=j.fn?j.fn.test(q,l(),b,d,f):c!=j.def&&c!=f.skipOptionalPartCharacter||""==j.def?!1:{c:j.def,pos:b},g!==!1){var s=void 0!=g.c?g.c:c;s=s==f.skipOptionalPartCharacter&&null===j.fn?j.def:s;var t=b,u=v();if(void 0!=g.remove&&(a.isArray(g.remove)||(g.remove=[g.remove]),a.each(g.remove.sort(function(a,b){return b-a}),function(a,b){p(b,b+1,!0)})),void 0!=g.insert&&(a.isArray(g.insert)||(g.insert=[g.insert]),a.each(g.insert.sort(function(a,b){return a-b}),function(a,b){z(b.pos,b.c,!0)})),g.refreshFromBuffer){var y=g.refreshFromBuffer;if(d=!0,w(y===!0?y:y.start,y.end,u),void 0==g.pos&&void 0==g.c)return g.pos=n(),!1;if(t=void 0!=g.pos?g.pos:b,t!=b)return g=a.extend(g,z(t,s,!0)),!1}else if(g!==!0&&void 0!=g.pos&&g.pos!=b&&(t=g.pos,w(b,t),t!=b))return g=a.extend(g,z(t,s,!0)),!1;return 1!=g&&void 0==g.pos&&void 0==g.c?!1:(h>0&&m(!0),o(t,a.extend({},i,{input:x(s,j)}),e)||(g=!1),!1)}}),g}function h(b,c,d,e){var g,h,i=a.extend(!0,{},l().validPositions);for(g=n();g>=0;g--)if(l().validPositions[g]&&void 0!=l().validPositions[g].alternation){h=l().validPositions[g].alternation;break}if(void 0!=h)for(var j in l().validPositions)if(parseInt(j)>parseInt(g)&&void 0===l().validPositions[j].alternation){for(var k=l().validPositions[j],o=k.locator[h],p=l().validPositions[g].locator[h].split(","),q=0;q<p.length;q++)if(o<p[q]){for(var r,s,t=j-1;t>=0;t--)if(r=l().validPositions[t],void 0!=r){s=r.locator[h],r.locator[h]=p[q];break}if(o!=r.locator[h]){for(var u=v().slice(),w=j;w<n()+1;w++)delete l().validPositions[w],delete l().tests[w];m(!0),f.keepStatic=!f.keepStatic;for(var w=j;w<u.length;w++)u[w]!=f.skipOptionalPartCharacter&&z(n()+1,u[w],!1,!0);r.locator[h]=s;var x=z(b,c,d,e);if(f.keepStatic=!f.keepStatic,x)return x;m(),l().validPositions=a.extend(!0,{},i)}}break}return!1}function i(b,c){for(var d=l().validPositions[c],e=d.locator,f=e.length,g=b;c>g;g++)if(!A(g)){var h=t(g),i=h[0],j=-1;a.each(h,function(a,b){for(var c=0;f>c;c++)b.locator[c]&&y(b.locator[c].toString().split(","),e[c].toString().split(","))&&c>j&&(j=c,i=b)}),o(g,a.extend({},i,{input:i.match.def}),!0)}}d=d===!0;for(var j=v(),k=b-1;k>-1&&!l().validPositions[k];k--);for(k++;b>k;k++)void 0==l().validPositions[k]&&((!A(k)||j[k]!=G(k))&&t(k).length>1||j[k]==f.radixPoint||"0"==j[k]&&a.inArray(f.radixPoint,j)<k)&&g(k,j[k],!0);var q=b,r=!1,s=a.extend(!0,{},l().validPositions);if(q<B()&&(r=g(q,c,d,e),!d&&r===!1)){var u=l().validPositions[q];if(!u||null!=u.match.fn||u.match.def!=c&&c!=f.skipOptionalPartCharacter){if((f.insertMode||void 0==l().validPositions[C(q)])&&!A(q))for(var D=q+1,F=C(q);F>=D;D++)if(r=g(D,c,d,e),r!==!1){i(q,D),q=D;break}}else r={caret:C(q)}}if(r===!1&&f.keepStatic&&O(j)&&(r=h(b,c,d,e)),r===!0&&(r={pos:q}),a.isFunction(f.postValidation)&&0!=r&&!d){m(!0);var H=f.postValidation(v(),f);if(!H)return m(!0),l().validPositions=a.extend(!0,{},s),!1}return r}function A(a){var b=r(a);return null!=b.fn?b.fn:!1}function B(){var a;db=cb.prop("maxLength"),-1==db&&(db=void 0);var b,c=n(),d=l().validPositions[c],e=void 0!=d?d.locator.slice():void 0;for(b=c+1;void 0==d||null!=d.match.fn||null==d.match.fn&&""!=d.match.def;b++)d=q(b,e,b-1),e=d.locator.slice();return a=b,void 0==db||db>a?a:db}function C(a){var b=B();if(a>=b)return b;for(var c=a;++c<b&&!A(c)&&(f.nojumps!==!0||f.nojumpsThreshold>c););return c}function D(a){var b=a;if(0>=b)return 0;for(;--b>0&&!A(b););return b}function E(a){return void 0==l().validPositions[a]?G(a):l().validPositions[a].input}function F(b,c,d,e,g){if(e&&a.isFunction(f.onBeforeWrite)){var h=f.onBeforeWrite.call(b,e,c,d,f);if(h){if(h.refreshFromBuffer){var i=h.refreshFromBuffer;w(i===!0?i:i.start,i.end,h.buffer),m(!0),c=v()}d=h.caret||d}}b._valueSet(c.join("")),void 0!=d&&L(b,d),g===!0&&(gb=!0,a(b).trigger("input"))}function G(a,b){return b=b||r(a),void 0!=b.placeholder?b.placeholder:null==b.fn?b.def:f.placeholder.charAt(a%f.placeholder.length)}function H(b,c,d,e){function f(){var a=!1,b=u().slice(i,C(i)).join("").indexOf(h);if(-1!=b&&!A(i)){a=!0;for(var c=u().slice(i,i+b),d=0;d<c.length;d++)if(" "!=c[d]){a=!1;break}}return a}var g=void 0!=e?e.slice():b._valueGet().split(""),h="",i=0;m(),l().p=C(-1),c&&b._valueSet("");var j=u().slice(0,C(-1)).join(""),k=g.join("").match(new RegExp(I(j),"g"));k&&k.length>0&&(g.splice(0,k.length*j.length),i=C(i)),a.each(g,function(c,e){var g=a.Event("keypress");g.which=e.charCodeAt(0),h+=e;var j=n(),k=l().validPositions[j],m=q(j+1,k?k.locator.slice():void 0,j);if(!f()||d){var o=d?c:null==m.match.fn&&m.match.optionality&&j+1<l().p?j+1:l().p;U.call(b,g,!0,!1,d,o),i=o+1,h=""}else U.call(b,g,!0,!1,!0,j+1)}),c&&F(b,v(),a(b).is(":focus")?C(n(0)):void 0,a.Event("checkval"))}function I(b){return a.inputmask.escapeRegex(b)}function J(b){if(b.data("_inputmask")&&!b.hasClass("hasDatepicker")){var c=[],d=l().validPositions;for(var e in d)d[e].match&&null!=d[e].match.fn&&c.push(d[e].input);var g=(eb?c.reverse():c).join(""),h=(eb?v().slice().reverse():v()).join("");return a.isFunction(f.onUnMask)&&(g=f.onUnMask.call(b,h,g,f)||g),g}return b[0]._valueGet()}function K(a){if(eb&&"number"==typeof a&&(!f.greedy||""!=f.placeholder)){var b=v().length;a=b-a}return a}function L(b,c,d){var e,g=b.jquery&&b.length>0?b[0]:b;if("number"!=typeof c)return g.setSelectionRange?(c=g.selectionStart,d=g.selectionEnd):document.selection&&document.selection.createRange&&(e=document.selection.createRange(),c=0-e.duplicate().moveStart("character",-1e5),d=c+e.text.length),{begin:K(c),end:K(d)};if(c=K(c),d=K(d),d="number"==typeof d?d:c,a(g).is(":visible")){var h=a(g).css("font-size").replace("px","")*d;g.scrollLeft=h>g.scrollWidth?h:0,i||0!=f.insertMode||c!=d||d++,g.setSelectionRange?(g.selectionStart=c,g.selectionEnd=d):g.createTextRange&&(e=g.createTextRange(),e.collapse(!0),e.moveEnd("character",d),e.moveStart("character",c),e.select())}}function M(b){var c,d,e=v(),f=e.length,g=n(),h={},i=l().validPositions[g],j=void 0!=i?i.locator.slice():void 0;for(c=g+1;c<e.length;c++)d=q(c,j,c-1),j=d.locator.slice(),h[c]=a.extend(!0,{},d);var k=i&&void 0!=i.alternation?i.locator[i.alternation].split(","):[];for(c=f-1;c>g&&(d=h[c].match,(d.optionality||d.optionalQuantifier||i&&void 0!=i.alternation&&void 0!=h[c].locator[i.alternation]&&-1!=a.inArray(h[c].locator[i.alternation].toString(),k))&&e[c]==G(c,d));c--)f--;return b?{l:f,def:h[f]?h[f].match:void 0}:f}function N(a){for(var b=M(),c=a.length-1;c>b&&!A(c);c--);return a.splice(b,c+1-b),a}function O(b){if(a.isFunction(f.isComplete))return f.isComplete.call(cb,b,f);if("*"==f.repeat)return void 0;{var c=!1,d=M(!0),e=D(d.l);n()}if(void 0==d.def||d.def.newBlockMarker||d.def.optionality||d.def.optionalQuantifier){c=!0;for(var g=0;e>=g;g++){var h=A(g),i=r(g);if(h&&void 0==l().validPositions[g]&&i.optionality!==!0&&i.optionalQuantifier!==!0||!h&&b[g]!=G(g)){c=!1;break}}}return c}function P(a,b){return eb?a-b>1||a-b==1&&f.insertMode:b-a>1||b-a==1&&f.insertMode}function Q(b){var c=a._data(b).events,d=!1;a.each(c,function(b,c){a.each(c,function(a,b){if("inputmask"==b.namespace&&"setvalue"!=b.type){var c=b.handler;b.handler=function(a){if(!this.disabled&&(!this.readOnly||"keydown"==a.type&&a.ctrlKey&&67==a.keyCode)){switch(a.type){case"input":if(gb===!0||d===!0)return gb=!1,a.preventDefault();break;case"keydown":fb=!1,d=!1;break;case"keypress":if(fb===!0)return a.preventDefault();fb=!0;break;case"compositionstart":d=!0;break;case"compositionupdate":gb=!0;break;case"compositionend":d=!1}return c.apply(this,arguments)}a.preventDefault()}}})})}function R(b){function c(b){if(void 0==a.valHooks[b]||1!=a.valHooks[b].inputmaskpatch){var c=a.valHooks[b]&&a.valHooks[b].get?a.valHooks[b].get:function(a){return a.value},d=a.valHooks[b]&&a.valHooks[b].set?a.valHooks[b].set:function(a,b){return a.value=b,a};a.valHooks[b]={get:function(b){var d=a(b);if(d.data("_inputmask")){if(d.data("_inputmask").opts.autoUnmask)return d.inputmask("unmaskedvalue");var e=c(b),f=d.data("_inputmask"),g=f.maskset,h=g._buffer;return h=h?h.join(""):"",e!=h?e:""}return c(b)},set:function(b,c){var e,f=a(b),g=f.data("_inputmask");return g?(e=d(b,a.isFunction(g.opts.onBeforeMask)?g.opts.onBeforeMask.call(nb,c,g.opts)||c:c),f.triggerHandler("setvalue.inputmask")):e=d(b,c),e},inputmaskpatch:!0}}}function d(){var b=a(this),c=a(this).data("_inputmask");return c?c.opts.autoUnmask?b.inputmask("unmaskedvalue"):h.call(this)!=u().join("")?h.call(this):"":h.call(this)}function e(b){var c=a(this).data("_inputmask");c?(i.call(this,a.isFunction(c.opts.onBeforeMask)?c.opts.onBeforeMask.call(nb,b,c.opts)||b:b),a(this).triggerHandler("setvalue.inputmask")):i.call(this,b)}function g(b){a(b).bind("mouseenter.inputmask",function(){var b=a(this),c=this,d=c._valueGet();""!=d&&d!=v().join("")&&(this._valueSet(a.isFunction(f.onBeforeMask)?f.onBeforeMask.call(nb,d,f)||d:d),b.triggerHandler("setvalue.inputmask"))});//!! the bound handlers are executed in the order they where bound
|
9
|
+
var c=a._data(b).events,d=c.mouseover;if(d){for(var e=d[d.length-1],g=d.length-1;g>0;g--)d[g]=d[g-1];d[0]=e}}var h,i;if(!b._valueGet){if(Object.getOwnPropertyDescriptor){Object.getOwnPropertyDescriptor(b,"value")}document.__lookupGetter__&&b.__lookupGetter__("value")?(h=b.__lookupGetter__("value"),i=b.__lookupSetter__("value"),b.__defineGetter__("value",d),b.__defineSetter__("value",e)):(h=function(){return b.value},i=function(a){b.value=a},c(b.type),g(b)),b._valueGet=function(a){return eb&&a!==!0?h.call(this).split("").reverse().join(""):h.call(this)},b._valueSet=function(a){i.call(this,eb?a.split("").reverse().join(""):a)}}}function S(b,c,d,e){function g(){if(f.keepStatic){m(!0);var c,d=[];for(c=n();c>=0;c--)if(l().validPositions[c]){if(void 0!=l().validPositions[c].alternation)break;d.push(l().validPositions[c].input),delete l().validPositions[c]}if(c>0)for(;d.length>0;){l().p=C(n());var e=a.Event("keypress");e.which=d.pop().charCodeAt(0),U.call(b,e,!0,!1,!1,l().p)}}}if((f.numericInput||eb)&&(c==a.inputmask.keyCode.BACKSPACE?c=a.inputmask.keyCode.DELETE:c==a.inputmask.keyCode.DELETE&&(c=a.inputmask.keyCode.BACKSPACE),eb)){var h=d.end;d.end=d.begin,d.begin=h}if(c==a.inputmask.keyCode.BACKSPACE&&(d.end-d.begin<1||0==f.insertMode)?d.begin=D(d.begin):c==a.inputmask.keyCode.DELETE&&d.begin==d.end&&(d.end=A(d.end)?d.end+1:C(d.end)+1),p(d.begin,d.end,!1,e),e!==!0){g();var i=n(d.begin);i<d.begin?(-1==i&&m(),l().p=C(i)):l().p=d.begin}}function T(c){var d=this,e=a(d),g=c.keyCode,i=L(d);g==a.inputmask.keyCode.BACKSPACE||g==a.inputmask.keyCode.DELETE||h&&127==g||c.ctrlKey&&88==g&&!b("cut")?(c.preventDefault(),88==g&&(_=v().join("")),S(d,g,i),F(d,v(),l().p,c,_!=v().join("")),d._valueGet()==u().join("")?e.trigger("cleared"):O(v())===!0&&e.trigger("complete"),f.showTooltip&&e.prop("title",l().mask)):g==a.inputmask.keyCode.END||g==a.inputmask.keyCode.PAGE_DOWN?setTimeout(function(){var a=C(n());f.insertMode||a!=B()||c.shiftKey||a--,L(d,c.shiftKey?i.begin:a,a)},0):g==a.inputmask.keyCode.HOME&&!c.shiftKey||g==a.inputmask.keyCode.PAGE_UP?L(d,0,c.shiftKey?i.begin:0):(f.undoOnEscape&&g==a.inputmask.keyCode.ESCAPE||90==g&&c.ctrlKey)&&c.altKey!==!0?(H(d,!0,!1,_.split("")),e.click()):g!=a.inputmask.keyCode.INSERT||c.shiftKey||c.ctrlKey?0!=f.insertMode||c.shiftKey||(g==a.inputmask.keyCode.RIGHT?setTimeout(function(){var a=L(d);L(d,a.begin)},0):g==a.inputmask.keyCode.LEFT&&setTimeout(function(){var a=L(d);L(d,eb?a.begin+1:a.begin-1)},0)):(f.insertMode=!f.insertMode,L(d,f.insertMode||i.begin!=B()?i.begin:i.begin-1)),f.onKeyDown.call(this,c,v(),L(d).begin,f),hb=-1!=a.inArray(g,f.ignorables)}function U(b,c,d,e,g){var h=this,i=a(h),j=b.which||b.charCode||b.keyCode;if(!(c===!0||b.ctrlKey&&b.altKey)&&(b.ctrlKey||b.metaKey||hb))return!0;if(j){46==j&&0==b.shiftKey&&","==f.radixPoint&&(j=44);var k,n=c?{begin:g,end:g}:L(h),p=String.fromCharCode(j),q=P(n.begin,n.end);q&&(l().undoPositions=a.extend(!0,{},l().validPositions),S(h,a.inputmask.keyCode.DELETE,n,!0),n.begin=l().p,f.insertMode||(f.insertMode=!f.insertMode,o(n.begin,e),f.insertMode=!f.insertMode),q=!f.multi),l().writeOutBuffer=!0;var r=eb&&!q?n.end:n.begin,s=z(r,p,e);if(s!==!1){if(s!==!0&&(r=void 0!=s.pos?s.pos:r,p=void 0!=s.c?s.c:p),m(!0),void 0!=s.caret)k=s.caret;else{var u=l().validPositions;k=!f.keepStatic&&(void 0!=u[r+1]&&t(r+1,u[r].locator.slice(),r).length>1||void 0!=u[r].alternation)?r+1:C(r)}l().p=k}if(d!==!1){var x=this;if(setTimeout(function(){f.onKeyValidation.call(x,s,f)},0),l().writeOutBuffer&&s!==!1){var y=v();F(h,y,c?void 0:f.numericInput?D(k):k,b,c!==!0),c!==!0&&setTimeout(function(){O(y)===!0&&i.trigger("complete")},0)}else q&&(l().buffer=void 0,l().validPositions=l().undoPositions)}else q&&(l().buffer=void 0,l().validPositions=l().undoPositions);if(f.showTooltip&&i.prop("title",l().mask),c&&a.isFunction(f.onBeforeWrite)){var A=f.onBeforeWrite.call(this,b,v(),k,f);if(A&&A.refreshFromBuffer){var B=A.refreshFromBuffer;w(B===!0?B:B.start,B.end,A.buffer),m(!0),A.caret&&(l().p=A.caret)}}b.preventDefault()}}function V(b){var c=this,d=a(c),e=c._valueGet(!0),g=L(c);if("propertychange"==b.type&&c._valueGet().length<=B())return!0;if("paste"==b.type){var h=e.substr(0,g.begin),i=e.substr(g.end,e.length);h==u().slice(0,g.begin).join("")&&(h=""),i==u().slice(g.end).join("")&&(i=""),window.clipboardData&&window.clipboardData.getData?e=h+window.clipboardData.getData("Text")+i:b.originalEvent&&b.originalEvent.clipboardData&&b.originalEvent.clipboardData.getData&&(e=h+b.originalEvent.clipboardData.getData("text/plain")+i)}var j=e;if(a.isFunction(f.onBeforePaste)){if(j=f.onBeforePaste.call(c,e,f),j===!1)return b.preventDefault(),!1;j||(j=e)}return H(c,!0,!1,eb?j.split("").reverse():j.split("")),d.click(),O(v())===!0&&d.trigger("complete"),!1}function W(b){var c=this;H(c,!0,!1),O(v())===!0&&a(c).trigger("complete"),b.preventDefault()}function X(a){var b=this;_=v().join(""),(""==bb||0!=a.originalEvent.data.indexOf(bb))&&(ab=L(b))}function Y(b){var c=this,d=ab||L(c);0==b.originalEvent.data.indexOf(bb)&&(m(),d={begin:0,end:0});var e=b.originalEvent.data;L(c,d.begin,d.end);for(var g=0;g<e.length;g++){var h=a.Event("keypress");h.which=e.charCodeAt(g),fb=!1,hb=!1,U.call(c,h)}setTimeout(function(){var a=l().p;F(c,v(),f.numericInput?D(a):a)},0),bb=b.originalEvent.data}function Z(){}function $(b){if(cb=a(b),cb.is(":input")&&c(cb.attr("type"))){if(cb.data("_inputmask",{maskset:e,opts:f,isRTL:!1}),f.showTooltip&&cb.prop("title",l().mask),("rtl"==b.dir||f.rightAlign)&&cb.css("text-align","right"),"rtl"==b.dir||f.numericInput){b.dir="ltr",cb.removeAttr("dir");var d=cb.data("_inputmask");d.isRTL=!0,cb.data("_inputmask",d),eb=!0}cb.unbind(".inputmask"),cb.closest("form").bind("submit",function(){_!=v().join("")&&cb.change(),cb[0]._valueGet&&cb[0]._valueGet()==u().join("")&&cb[0]._valueSet(""),f.removeMaskOnSubmit&&cb.inputmask("remove")}).bind("reset",function(){setTimeout(function(){cb.triggerHandler("setvalue.inputmask")},0)}),cb.bind("mouseenter.inputmask",function(){var b=a(this),c=this;!b.is(":focus")&&f.showMaskOnHover&&c._valueGet()!=v().join("")&&F(c,v())}).bind("blur.inputmask",function(b){var c=a(this),d=this;if(c.data("_inputmask")){var e=d._valueGet(),g=v().slice();ib=!0,_!=g.join("")&&setTimeout(function(){c.change(),_=g.join("")},0),""!=e&&(f.clearMaskOnLostFocus&&(e==u().join("")?g=[]:N(g)),O(g)===!1&&(c.trigger("incomplete"),f.clearIncomplete&&(m(),g=f.clearMaskOnLostFocus?[]:u().slice())),F(d,g,void 0,b))}}).bind("focus.inputmask",function(){var b=(a(this),this),c=b._valueGet();f.showMaskOnFocus&&(!f.showMaskOnHover||f.showMaskOnHover&&""==c)&&b._valueGet()!=v().join("")&&F(b,v(),C(n())),_=v().join("")}).bind("mouseleave.inputmask",function(){var b=a(this),c=this;if(f.clearMaskOnLostFocus){var d=v().slice(),e=c._valueGet();b.is(":focus")||e==b.attr("placeholder")||""==e||(e==u().join("")?d=[]:N(d),F(c,d))}}).bind("click.inputmask",function(){var b=a(this),c=this;if(b.is(":focus")){var d=L(c);if(d.begin==d.end)if(f.radixFocus&&""!=f.radixPoint&&-1!=a.inArray(f.radixPoint,v())&&(ib||v().join("")==u().join("")))L(c,a.inArray(f.radixPoint,v())),ib=!1;else{var e=eb?K(d.begin):d.begin,g=C(n(e));g>e?L(c,A(e)?e:C(e)):L(c,g)}}}).bind("dblclick.inputmask",function(){var a=this;setTimeout(function(){L(a,0,C(n()))},0)}).bind(k+".inputmask dragdrop.inputmask drop.inputmask",V).bind("setvalue.inputmask",function(){var a=this;H(a,!0,!1),_=v().join(""),(f.clearMaskOnLostFocus||f.clearIncomplete)&&a._valueGet()==u().join("")&&a._valueSet("")}).bind("cut.inputmask",function(b){gb=!0;var c=this,d=a(c),e=L(c);S(c,a.inputmask.keyCode.DELETE,e),F(c,v(),l().p,b,_!=v().join("")),c._valueGet()==u().join("")&&d.trigger("cleared"),f.showTooltip&&d.prop("title",l().mask)}).bind("complete.inputmask",f.oncomplete).bind("incomplete.inputmask",f.onincomplete).bind("cleared.inputmask",f.oncleared),cb.bind("keydown.inputmask",T).bind("keypress.inputmask",U),j||cb.bind("compositionstart.inputmask",X).bind("compositionupdate.inputmask",Y).bind("compositionend.inputmask",Z),"paste"===k&&cb.bind("input.inputmask",W),R(b);var g=a.isFunction(f.onBeforeMask)?f.onBeforeMask.call(b,b._valueGet(),f)||b._valueGet():b._valueGet();H(b,!0,!1,g.split(""));var h=v().slice();_=h.join("");var i;try{i=document.activeElement}catch(o){}O(h)===!1&&f.clearIncomplete&&m(),f.clearMaskOnLostFocus&&(h.join("")==u().join("")?h=[]:N(h)),F(b,h),i===b&&L(b,C(n())),Q(b)}}var _,ab,bb,cb,db,eb=!1,fb=!1,gb=!1,hb=!1,ib=!0;if(void 0!=d)switch(d.action){case"isComplete":return cb=a(d.el),e=cb.data("_inputmask").maskset,f=cb.data("_inputmask").opts,O(d.buffer);case"unmaskedvalue":return cb=d.$input,e=cb.data("_inputmask").maskset,f=cb.data("_inputmask").opts,eb=d.$input.data("_inputmask").isRTL,J(d.$input);case"mask":_=v().join(""),$(d.el);break;case"format":cb=a({}),cb.data("_inputmask",{maskset:e,opts:f,isRTL:f.numericInput}),f.numericInput&&(eb=!0);var jb=(a.isFunction(f.onBeforeMask)?f.onBeforeMask.call(cb,d.value,f)||d.value:d.value).split("");return H(cb,!1,!1,eb?jb.reverse():jb),a.isFunction(f.onBeforeWrite)&&f.onBeforeWrite.call(this,void 0,v(),0,f),d.metadata?{value:eb?v().slice().reverse().join(""):v().join(""),metadata:cb.inputmask("getmetadata")}:eb?v().slice().reverse().join(""):v().join("");case"isValid":cb=a({}),cb.data("_inputmask",{maskset:e,opts:f,isRTL:f.numericInput}),f.numericInput&&(eb=!0);var jb=d.value.split("");H(cb,!1,!0,eb?jb.reverse():jb);for(var kb=v(),lb=M(),mb=kb.length-1;mb>lb&&!A(mb);mb--);return kb.splice(lb,mb+1-lb),O(kb)&&d.value==kb.join("");case"getemptymask":return cb=a(d.el),e=cb.data("_inputmask").maskset,f=cb.data("_inputmask").opts,u();case"remove":var nb=d.el;cb=a(nb),e=cb.data("_inputmask").maskset,f=cb.data("_inputmask").opts,nb._valueSet(J(cb)),cb.unbind(".inputmask"),cb.removeData("_inputmask");var ob;Object.getOwnPropertyDescriptor&&(ob=Object.getOwnPropertyDescriptor(nb,"value")),ob&&ob.get?nb._valueGet&&Object.defineProperty(nb,"value",{get:nb._valueGet,set:nb._valueSet}):document.__lookupGetter__&&nb.__lookupGetter__("value")&&nb._valueGet&&(nb.__defineGetter__("value",nb._valueGet),nb.__defineSetter__("value",nb._valueSet));try{delete nb._valueGet,delete nb._valueSet}catch(pb){nb._valueGet=void 0,nb._valueSet=void 0}break;case"getmetadata":if(cb=a(d.el),e=cb.data("_inputmask").maskset,f=cb.data("_inputmask").opts,a.isArray(e.metadata)){for(var qb,rb=n(),sb=rb;sb>=0;sb--)if(l().validPositions[sb]&&void 0!=l().validPositions[sb].alternation){qb=l().validPositions[sb].alternation;break}return void 0!=qb?e.metadata[l().validPositions[rb].locator[qb]]:e.metadata[0]}return e.metadata}}if(void 0===a.fn.inputmask){var g=navigator.userAgent,h=null!==g.match(new RegExp("iphone","i")),i=(null!==g.match(new RegExp("android.*safari.*","i")),null!==g.match(new RegExp("android.*chrome.*","i"))),j=null!==g.match(new RegExp("android.*firefox.*","i")),k=(/Kindle/i.test(g)||/Silk/i.test(g)||/KFTT/i.test(g)||/KFOT/i.test(g)||/KFJWA/i.test(g)||/KFJWI/i.test(g)||/KFSOWI/i.test(g)||/KFTHWA/i.test(g)||/KFTHWI/i.test(g)||/KFAPWA/i.test(g)||/KFAPWI/i.test(g),b("paste")?"paste":b("input")?"input":"propertychange");a.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},alternatormarker:"|",escapeChar:"\\",mask:null,oncomplete:a.noop,onincomplete:a.noop,oncleared:a.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!1,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},alias:null,onKeyDown:a.noop,onBeforeMask:void 0,onBeforePaste:void 0,onBeforeWrite:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:a.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,rightAlign:!1,undoOnEscape:!0,radixPoint:"",radixFocus:!1,nojumps:!1,nojumpsThreshold:0,keepStatic:void 0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,definitionSymbol:"*"},"*":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1}},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],isComplete:void 0,canClearPosition:a.noop,postValidation:void 0},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},masksCache:{},escapeRegex:function(a){var b=["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"];return a.replace(new RegExp("(\\"+b.join("|\\")+")","gim"),"\\$1")},format:function(b,c,g){var h=a.extend(!0,{},a.inputmask.defaults,c);return d(h.alias,c,h),f({action:"format",value:b,metadata:g},e(h,c&&void 0!==c.definitions),h)},isValid:function(b,c){var g=a.extend(!0,{},a.inputmask.defaults,c);return d(g.alias,c,g),f({action:"isValid",value:b},e(g,c&&void 0!==c.definitions),g)}},a.fn.inputmask=function(b,c){function g(b,c,e){var f=a(b);f.data("inputmask-alias")&&d(f.data("inputmask-alias"),a.extend(!0,{},c),c);for(var g in c){var h=f.data("inputmask-"+g.toLowerCase());void 0!=h&&("mask"==g&&0==h.indexOf("[")?(c[g]=h.replace(/[\s[\]]/g,"").split("','"),c[g][0]=c[g][0].replace("'",""),c[g][c[g].length-1]=c[g][c[g].length-1].replace("'","")):c[g]="boolean"==typeof h?h:h.toString(),e&&(e[g]=c[g]))}return c}var h,i=a.extend(!0,{},a.inputmask.defaults,c);if("string"==typeof b)switch(b){case"mask":return d(i.alias,c,i),this.each(function(){return g(this,i),h=e(i,c&&void 0!==c.definitions),void 0==h?this:void f({action:"mask",el:this},h,i)});case"unmaskedvalue":var j=a(this);return j.data("_inputmask")?f({action:"unmaskedvalue",$input:j}):j.val();case"remove":return this.each(function(){var b=a(this);b.data("_inputmask")&&f({action:"remove",el:this})});case"getemptymask":return this.data("_inputmask")?f({action:"getemptymask",el:this}):"";case"hasMaskedValue":return this.data("_inputmask")?!this.data("_inputmask").opts.autoUnmask:!1;case"isComplete":return this.data("_inputmask")?f({action:"isComplete",buffer:this[0]._valueGet().split(""),el:this}):!0;case"getmetadata":return this.data("_inputmask")?f({action:"getmetadata",el:this}):void 0;default:return d(i.alias,c,i),d(b,c,i)||(i.mask=b),this.each(function(){return g(this,i),h=e(i,c&&void 0!==c.definitions),void 0==h?this:void f({action:"mask",el:this},h,i)})}else{if("object"==typeof b)return i=a.extend(!0,{},a.inputmask.defaults,b),d(i.alias,b,i),this.each(function(){return g(this,i),h=e(i,b&&void 0!==b.definitions),void 0==h?this:void f({action:"mask",el:this},h,i)});if(void 0==b)return this.each(function(){var b=a(this).attr("data-inputmask");if(b&&""!=b)try{b=b.replace(new RegExp("'","g"),'"');var e=a.parseJSON("{"+b+"}");a.extend(!0,e,c),i=a.extend(!0,{},a.inputmask.defaults,e),i=g(this,i),d(i.alias,e,i),i.alias=void 0,a(this).inputmask("mask",i)}catch(f){}if(a(this).attr("data-inputmask-mask")||a(this).attr("data-inputmask-alias")){i=a.extend(!0,{},a.inputmask.defaults,{});var h={};i=g(this,i,h),d(i.alias,h,i),i.alias=void 0,a(this).inputmask("mask",i)}})}}}return a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.definitions,{h:{validator:"[01][0-9]|2[0-3]",cardinality:2,prevalidator:[{validator:"[0-2]",cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:"[0-5]",cardinality:1}]},d:{validator:"0[1-9]|[12][0-9]|3[01]",cardinality:2,prevalidator:[{validator:"[0-3]",cardinality:1}]},m:{validator:"0[1-9]|1[012]",cardinality:2,prevalidator:[{validator:"[01]",cardinality:1}]},y:{validator:"(19|20)\\d{2}",cardinality:4,prevalidator:[{validator:"[12]",cardinality:1},{validator:"(19|20)",cardinality:2},{validator:"(19|20)\\d",cardinality:3}]}}),a.extend(a.inputmask.defaults.aliases,{"dd/mm/yyyy":{mask:"1/2/y",placeholder:"dd/mm/yyyy",regex:{val1pre:new RegExp("[0-3]"),val1:new RegExp("0[1-9]|[12][0-9]|3[01]"),val2pre:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|[12][0-9]|3[01])"+c+"[01])")},val2:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|[12][0-9])"+c+"(0[1-9]|1[012]))|(30"+c+"(0[13-9]|1[012]))|(31"+c+"(0[13578]|1[02]))")}},leapday:"29/02/",separator:"/",yearrange:{minyear:1900,maxyear:2099},isInYearRange:function(a,b,c){if(isNaN(a))return!1;var d=parseInt(a.concat(b.toString().slice(a.length))),e=parseInt(a.concat(c.toString().slice(a.length)));return(isNaN(d)?!1:d>=b&&c>=d)||(isNaN(e)?!1:e>=b&&c>=e)},determinebaseyear:function(a,b,c){var d=(new Date).getFullYear();if(a>d)return a;if(d>b){for(var e=b.toString().slice(0,2),f=b.toString().slice(2,4);e+c>b;)e--;var g=e+f;return a>g?a:g}return d},onKeyDown:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val(d.getDate().toString()+(d.getMonth()+1).toString()+d.getFullYear().toString()),c.triggerHandler("setvalue.inputmask")}},getFrontValue:function(a,b,c){for(var d=0,e=0,f=0;f<a.length&&"2"!=a.charAt(f);f++){var g=c.definitions[a.charAt(f)];g?(d+=e,e=g.cardinality):e++}return b.join("").substr(d,e)},definitions:{1:{validator:function(a,b,c,d,e){var f=e.regex.val1.test(a);return d||f||a.charAt(1)!=e.separator&&-1=="-./".indexOf(a.charAt(1))||!(f=e.regex.val1.test("0"+a.charAt(0)))?f:(b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=a;isNaN(b.buffer[c+1])||(f+=b.buffer[c+1]);var g=1==f.length?e.regex.val1pre.test(f):e.regex.val1.test(f);if(!d&&!g){if(g=e.regex.val1.test(a+"0"))return b.buffer[c]=a,b.buffer[++c]="0",{pos:c,c:"0"};if(g=e.regex.val1.test("0"+a))return b.buffer[c]="0",c++,{pos:c}}return g},cardinality:1}]},2:{validator:function(a,b,c,d,e){var f=e.getFrontValue(b.mask,b.buffer,e);-1!=f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=e.regex.val2(e.separator).test(f+a);if(!d&&!g&&(a.charAt(1)==e.separator||-1!="-./".indexOf(a.charAt(1)))&&(g=e.regex.val2(e.separator).test(f+"0"+a.charAt(0))))return b.buffer[c-1]="0",{refreshFromBuffer:{start:c-1,end:c},pos:c,c:a.charAt(0)};if(e.mask.indexOf("2")==e.mask.length-1&&g){var h=b.buffer.join("").substr(4,4)+a;if(h!=e.leapday)return!0;var i=parseInt(b.buffer.join("").substr(0,4),10);return i%4===0?i%100===0?i%400===0?!0:!1:!0:!1}return g},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){isNaN(b.buffer[c+1])||(a+=b.buffer[c+1]);var f=e.getFrontValue(b.mask,b.buffer,e);-1!=f.indexOf(e.placeholder[0])&&(f="01"+e.separator);var g=1==a.length?e.regex.val2pre(e.separator).test(f+a):e.regex.val2(e.separator).test(f+a);return d||g||!(g=e.regex.val2(e.separator).test(f+"0"+a))?g:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},y:{validator:function(a,b,c,d,e){if(e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)){var f=b.buffer.join("").substr(0,6);if(f!=e.leapday)return!0;var g=parseInt(a,10);return g%4===0?g%100===0?g%400===0?!0:!1:!0:!1}return!1},cardinality:4,prevalidator:[{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,1);if(f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a+"0").toString().slice(0,2),f=e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(0),b.buffer[c++]=g.charAt(1),{pos:c}}return f},cardinality:1},{validator:function(a,b,c,d,e){var f=e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear);if(!d&&!f){var g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2);if(f=e.isInYearRange(a[0]+g[1]+a[1],e.yearrange.minyear,e.yearrange.maxyear))return b.buffer[c++]=g.charAt(1),{pos:c};if(g=e.determinebaseyear(e.yearrange.minyear,e.yearrange.maxyear,a).toString().slice(0,2),e.isInYearRange(g+a,e.yearrange.minyear,e.yearrange.maxyear)){var h=b.buffer.join("").substr(0,6);if(h!=e.leapday)f=!0;else{var i=parseInt(a,10);f=i%4===0?i%100===0?i%400===0?!0:!1:!0:!1}}else f=!1;if(f)return b.buffer[c-1]=g.charAt(0),b.buffer[c++]=g.charAt(1),b.buffer[c++]=a.charAt(0),{refreshFromBuffer:{start:c-3,end:c},pos:c}}return f},cardinality:2},{validator:function(a,b,c,d,e){return e.isInYearRange(a,e.yearrange.minyear,e.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[13-9]|1[012])"+c+"[0-3])|(02"+c+"[0-2])")},val2:function(b){var c=a.inputmask.escapeRegex.call(this,b);return new RegExp("((0[1-9]|1[012])"+c+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+c+"30)|((0[13578]|1[02])"+c+"31)")},val1pre:new RegExp("[01]"),val1:new RegExp("0[1-9]|1[012]")},leapday:"02/29/",onKeyDown:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val((d.getMonth()+1).toString()+d.getDate().toString()+d.getFullYear().toString()),c.triggerHandler("setvalue.inputmask")}}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyDown:function(b){var c=a(this);if(b.ctrlKey&&b.keyCode==a.inputmask.keyCode.RIGHT){var d=new Date;c.val(d.getFullYear().toString()+(d.getMonth()+1).toString()+d.getDate().toString()),c.triggerHandler("setvalue.inputmask")}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy",leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:new RegExp("[012]"),hrs24:new RegExp("2[0-4]|1[3-9]"),hrs:new RegExp("[01][0-9]|2[0-4]"),ampm:new RegExp("^[a|p|A|P][m|M]"),mspre:new RegExp("[0-5]"),ms:new RegExp("[0-5][0-9]")},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(a,b,c,d,e){if("24"==e.hourFormat&&24==parseInt(a,10))return b.buffer[c-1]="0",b.buffer[c]="0",{refreshFromBuffer:{start:c-1,end:c},c:"0"};var f=e.regex.hrs.test(a);if(!d&&!f&&(a.charAt(1)==e.timeseparator||-1!="-.:".indexOf(a.charAt(1)))&&(f=e.regex.hrs.test("0"+a.charAt(0))))return b.buffer[c-1]="0",b.buffer[c]=a.charAt(0),c++,{refreshFromBuffer:{start:c-2,end:c},pos:c,c:e.timeseparator};if(f&&"24"!==e.hourFormat&&e.regex.hrs24.test(a)){var g=parseInt(a,10);return 24==g?(b.buffer[c+5]="a",b.buffer[c+6]="m"):(b.buffer[c+5]="p",b.buffer[c+6]="m"),g-=12,10>g?(b.buffer[c]=g.toString(),b.buffer[c-1]="0"):(b.buffer[c]=g.toString().charAt(1),b.buffer[c-1]=g.toString().charAt(0)),{refreshFromBuffer:{start:c-1,end:c+6},c:b.buffer[c]}}return f},cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=e.regex.hrspre.test(a);return d||f||!(f=e.regex.hrs.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},s:{validator:"[0-5][0-9]",cardinality:2,prevalidator:[{validator:function(a,b,c,d,e){var f=e.regex.mspre.test(a);return d||f||!(f=e.regex.ms.test("0"+a))?f:(b.buffer[c]="0",c++,{pos:c})},cardinality:1}]},t:{validator:function(a,b,c,d,e){return e.regex.ampm.test(a+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",placeholder:"hh:mm:ss",alias:"datetime",autoUnmask:!1},"hh:mm":{mask:"h:s",placeholder:"hh:mm",alias:"datetime",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.definitions,{A:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,casing:"upper"},"#":{validator:"[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",cardinality:1,casing:"upper"}}),a.extend(a.inputmask.defaults.aliases,{url:{mask:"ir",placeholder:"",separator:"",defaultPrefix:"http://",regex:{urlpre1:new RegExp("[fh]"),urlpre2:new RegExp("(ft|ht)"),urlpre3:new RegExp("(ftp|htt)"),urlpre4:new RegExp("(ftp:|http|ftps)"),urlpre5:new RegExp("(ftp:/|ftps:|http:|https)"),urlpre6:new RegExp("(ftp://|ftps:/|http:/|https:)"),urlpre7:new RegExp("(ftp://|ftps://|http://|https:/)"),urlpre8:new RegExp("(ftp://|ftps://|http://|https://)")},definitions:{i:{validator:function(){return!0},cardinality:8,prevalidator:function(){for(var a=[],b=8,c=0;b>c;c++)a[c]=function(){var a=c;return{validator:function(b,c,d,e,f){if(f.regex["urlpre"+(a+1)]){var g,h=b;a+1-b.length>0&&(h=c.buffer.join("").substring(0,a+1-b.length)+""+h);var i=f.regex["urlpre"+(a+1)].test(h);if(!e&&!i){for(d-=a,g=0;g<f.defaultPrefix.length;g++)c.buffer[d]=f.defaultPrefix[g],d++;for(g=0;g<h.length-1;g++)c.buffer[d]=h[g],d++;return{pos:d}}return i}return!1},cardinality:a}}();return a}()},r:{validator:".",cardinality:50}},insertMode:!1,autoUnmask:!1},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(a,b,c){return c-1>-1&&"."!=b.buffer[c-1]?(a=b.buffer[c-1]+a,a=c-2>-1&&"."!=b.buffer[c-2]?b.buffer[c-2]+a:"0"+a):a="00"+a,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(a)},cardinality:1}}},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",greedy:!1,onBeforePaste:function(a){return a=a.toLowerCase(),a.replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",cardinality:1,casing:"lower"}}}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{numeric:{mask:function(a){function b(b){for(var c="",d=0;d<b.length;d++)c+=a.definitions[b[d]]?"\\"+b[d]:b[d];return c}if(0!==a.repeat&&isNaN(a.integerDigits)&&(a.integerDigits=a.repeat),a.repeat=0,a.groupSeparator==a.radixPoint&&(a.groupSeparator="."==a.radixPoint?",":","==a.radixPoint?".":"")," "===a.groupSeparator&&(a.skipOptionalPartCharacter=void 0),a.autoGroup=a.autoGroup&&""!=a.groupSeparator,a.autoGroup&&("string"==typeof a.groupSize&&isFinite(a.groupSize)&&(a.groupSize=parseInt(a.groupSize)),isFinite(a.integerDigits))){var c=Math.floor(a.integerDigits/a.groupSize),d=a.integerDigits%a.groupSize;a.integerDigits=parseInt(a.integerDigits)+(0==d?c-1:c)}a.radixFocus=a.radixFocus&&"0"==a.placeholder,a.definitions[";"]=a.definitions["~"];var e=b(a.prefix);return e+="[+]",e+="~{1,"+a.integerDigits+"}",void 0!=a.digits&&(isNaN(a.digits)||parseInt(a.digits)>0)&&(e+=a.digitsOptional?"["+(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}]":(a.decimalProtect?":":a.radixPoint)+";{"+a.digits+"}"),""!=a.negationSymbol.back&&(e+="[-]"),e+=b(a.suffix),a.greedy=!1,e},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,groupSeparator:"",radixPoint:".",radixFocus:!0,groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,negationSymbol:{front:"-",back:""},integerDigits:"+",prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,min:void 0,max:void 0,postFormat:function(b,c,d,e){var f=!1;b.length>=e.suffix.length&&b.join("").indexOf(e.suffix)==b.length-e.suffix.length&&(b.length=b.length-e.suffix.length,f=!0),c=c>=b.length?b.length-1:c<e.prefix.length?e.prefix.length:c;var g=!1,h=b[c];if(""==e.groupSeparator||-1!=a.inArray(e.radixPoint,b)&&c>=a.inArray(e.radixPoint,b)||new RegExp("["+a.inputmask.escapeRegex(e.negationSymbol.front)+"+]").test(h)){if(f)for(var i=0,j=e.suffix.length;j>i;i++)b.push(e.suffix.charAt(i));return{pos:c}}var k=b.slice();h==e.groupSeparator&&(k.splice(c--,1),h=k[c]),d?k[c]="?":k.splice(c,0,"?");var l=k.join(""),m=l;if(l.length>0&&e.autoGroup||d&&-1!=l.indexOf(e.groupSeparator)){var n=a.inputmask.escapeRegex(e.groupSeparator);g=0==l.indexOf(e.groupSeparator),l=l.replace(new RegExp(n,"g"),"");var o=l.split(e.radixPoint);if(l=""==e.radixPoint?l:o[0],l!=e.prefix+"?0"&&l.length>=e.groupSize+e.prefix.length)for(var p=new RegExp("([-+]?[\\d?]+)([\\d?]{"+e.groupSize+"})");p.test(l);)l=l.replace(p,"$1"+e.groupSeparator+"$2"),l=l.replace(e.groupSeparator+e.groupSeparator,e.groupSeparator);""!=e.radixPoint&&o.length>1&&(l+=e.radixPoint+o[1])}g=m!=l,b.length=l.length;for(var i=0,j=l.length;j>i;i++)b[i]=l.charAt(i);var q=a.inArray("?",b);if(d?b[q]=h:b.splice(q,1),!g&&f)for(var i=0,j=e.suffix.length;j>i;i++)b.push(e.suffix.charAt(i));return{pos:q,refreshFromBuffer:g,buffer:b}},onBeforeWrite:function(b,c,d,e){if(b&&"blur"==b.type){var f=c.join(""),g=f.replace(e.prefix,"");if(g=g.replace(e.suffix,""),g=g.replace(new RegExp(a.inputmask.escapeRegex(e.groupSeparator),"g"),""),","===e.radixPoint&&(g=g.replace(a.inputmask.escapeRegex(e.radixPoint),".")),isFinite(g)&&isFinite(e.min)&&parseFloat(g)<parseFloat(e.min))return a.extend(!0,{refreshFromBuffer:!0,buffer:(e.prefix+e.min).split("")},e.postFormat((e.prefix+e.min).split(""),0,!0,e));var h=""!=e.radixPoint?c.join("").split(e.radixPoint):[c.join("")],i=h[0].match(e.regex.integerPart(e)),j=2==h.length?h[1].match(e.regex.integerNPart(e)):void 0;!i||i[0]!=e.negationSymbol.front+"0"&&i[0]!=e.negationSymbol.front&&"+"!=i[0]||void 0!=j&&!j[0].match(/^0+$/)||c.splice(i.index,1);var k=a.inArray(e.radixPoint,c);if(-1!=k&&isFinite(e.digits)&&!e.digitsOptional){for(var l=1;l<=e.digits;l++)(void 0==c[k+l]||c[k+l]==e.placeholder.charAt(0))&&(c[k+l]="0");return{refreshFromBuffer:!0,buffer:c}}}if(e.autoGroup){var m=e.postFormat(c,d-1,!0,e);return m.caret=d<=e.prefix.length?m.pos:m.pos+1,m}},regex:{integerPart:function(b){return new RegExp("["+a.inputmask.escapeRegex(b.negationSymbol.front)+"+]?\\d+")},integerNPart:function(b){return new RegExp("[\\d"+a.inputmask.escapeRegex(b.groupSeparator)+"]+")}},signHandler:function(a,b,c,d,e){if(!d&&e.allowMinus&&"-"===a||e.allowPlus&&"+"===a){var f=b.buffer.join("").match(e.regex.integerPart(e));if(f&&f[0].length>0)return b.buffer[f.index]==("-"===a?"+":e.negationSymbol.front)?"-"==a?""!=e.negationSymbol.back?{pos:f.index,c:e.negationSymbol.front,remove:f.index,caret:c,insert:{pos:b.buffer.length-e.suffix.length-1,c:e.negationSymbol.back}}:{pos:f.index,c:e.negationSymbol.front,remove:f.index,caret:c}:""!=e.negationSymbol.back?{pos:f.index,c:"+",remove:[f.index,b.buffer.length-e.suffix.length-1],caret:c}:{pos:f.index,c:"+",remove:f.index,caret:c}:b.buffer[f.index]==("-"===a?e.negationSymbol.front:"+")?"-"==a&&""!=e.negationSymbol.back?{remove:[f.index,b.buffer.length-e.suffix.length-1],caret:c-1}:{remove:f.index,caret:c-1}:"-"==a?""!=e.negationSymbol.back?{pos:f.index,c:e.negationSymbol.front,caret:c+1,insert:{pos:b.buffer.length-e.suffix.length,c:e.negationSymbol.back}}:{pos:f.index,c:e.negationSymbol.front,caret:c+1}:{pos:f.index,c:a,caret:c+1}}return!1},radixHandler:function(b,c,d,e,f){if(!e&&b===f.radixPoint&&f.digits>0){var g=a.inArray(f.radixPoint,c.buffer),h=c.buffer.join("").match(f.regex.integerPart(f));if(-1!=g&&c.validPositions[g])return c.validPositions[g-1]?{caret:g+1}:{pos:h.index,c:h[0],caret:g+1};if(!h||"0"==h[0]&&h.index+1!=d)return c.buffer[h?h.index:d]="0",{pos:(h?h.index:d)+1}}return!1},leadingZeroHandler:function(b,c,d,e,f){var g=c.buffer.join("").match(f.regex.integerNPart(f)),h=a.inArray(f.radixPoint,c.buffer);if(g&&!e&&(-1==h||h>=d))if(0==g[0].indexOf("0")){d<f.prefix.length&&(d=g.index);var i=a.inArray(f.radixPoint,c._buffer),j=c._buffer&&c.buffer.slice(h).join("")==c._buffer.slice(i).join("")||0==parseInt(c.buffer.slice(h+1).join("")),k=c._buffer&&c.buffer.slice(g.index,h).join("")==c._buffer.slice(f.prefix.length,i).join("")||"0"==c.buffer.slice(g.index,h).join("");
|
10
|
+
if(-1==h||j&&k)return c.buffer.splice(g.index,1),d=d>g.index?d-1:g.index,{pos:d,remove:g.index};if(g.index+1==d||"0"==b)return c.buffer.splice(g.index,1),d=g.index,{pos:d,remove:g.index}}else if("0"===b&&d<=g.index&&g[0]!=f.groupSeparator)return!1;return!0},postValidation:function(b,c){var d=!0,e=b.join(""),f=e.replace(c.prefix,"");return f=f.replace(c.suffix,""),f=f.replace(new RegExp(a.inputmask.escapeRegex(c.groupSeparator),"g"),""),","===c.radixPoint&&(f=f.replace(a.inputmask.escapeRegex(c.radixPoint),".")),f=f.replace(new RegExp("^"+a.inputmask.escapeRegex(c.negationSymbol.front)),"-"),f=f.replace(new RegExp(a.inputmask.escapeRegex(c.negationSymbol.back)+"$"),""),isFinite(f)&&isFinite(c.max)&&(d=parseFloat(f)<=parseFloat(c.max)),d},definitions:{"~":{validator:function(b,c,d,e,f){var g=f.signHandler(b,c,d,e,f);if(!g&&(g=f.radixHandler(b,c,d,e,f),!g&&(g=e?new RegExp("[0-9"+a.inputmask.escapeRegex(f.groupSeparator)+"]").test(b):new RegExp("[0-9]").test(b),g===!0&&(g=f.leadingZeroHandler(b,c,d,e,f),g===!0)))){var h=a.inArray(f.radixPoint,c.buffer);g=f.digitsOptional===!1&&d>h&&!e?{pos:d,remove:d}:{pos:d}}return g},cardinality:1,prevalidator:null},"+":{validator:function(a,b,c,d,e){var f=e.signHandler(a,b,c,d,e);return!f&&(d&&e.allowMinus&&a===e.negationSymbol.front||e.allowMinus&&"-"==a||e.allowPlus&&"+"==a)&&(f="-"==a?""!=e.negationSymbol.back?{pos:c,c:"-"===a?e.negationSymbol.front:"+",caret:c+1,insert:{pos:b.buffer.length,c:e.negationSymbol.back}}:{pos:c,c:"-"===a?e.negationSymbol.front:"+",caret:c+1}:!0),f},cardinality:1,prevalidator:null,placeholder:""},"-":{validator:function(a,b,c,d,e){var f=e.signHandler(a,b,c,d,e);return!f&&d&&e.allowMinus&&a===e.negationSymbol.back&&(f=!0),f},cardinality:1,prevalidator:null,placeholder:""},":":{validator:function(b,c,d,e,f){var g=f.signHandler(b,c,d,e,f);if(!g){var h="["+a.inputmask.escapeRegex(f.radixPoint)+"]";g=new RegExp(h).test(b),g&&c.validPositions[d]&&c.validPositions[d].match.placeholder==f.radixPoint&&(g={caret:d+1})}return g},cardinality:1,prevalidator:null,placeholder:function(a){return a.radixPoint}}},insertMode:!0,autoUnmask:!1,onUnMask:function(b,c,d){var e=b.replace(d.prefix,"");return e=e.replace(d.suffix,""),e=e.replace(new RegExp(a.inputmask.escapeRegex(d.groupSeparator),"g"),"")},isComplete:function(b,c){var d=b.join(""),e=b.slice();if(c.postFormat(e,0,!0,c),e.join("")!=d)return!1;var f=d.replace(c.prefix,"");return f=f.replace(c.suffix,""),f=f.replace(new RegExp(a.inputmask.escapeRegex(c.groupSeparator),"g"),""),","===c.radixPoint&&(f=f.replace(a.inputmask.escapeRegex(c.radixPoint),".")),isFinite(f)},onBeforeMask:function(b,c){if(""!=c.radixPoint&&isFinite(b))b=b.toString().replace(".",c.radixPoint);else{var d=b.match(/,/g),e=b.match(/\./g);e&&d?e.length>d.length?(b=b.replace(/\./g,""),b=b.replace(",",c.radixPoint)):d.length>e.length?(b=b.replace(/,/g,""),b=b.replace(".",c.radixPoint)):b=b.indexOf(".")<b.indexOf(",")?b.replace(/\./g,""):b=b.replace(/,/g,""):b=b.replace(new RegExp(a.inputmask.escapeRegex(c.groupSeparator),"g"),"")}return 0==c.digits&&(-1!=b.indexOf(".")?b=b.substring(0,b.indexOf(".")):-1!=b.indexOf(",")&&(b=b.substring(0,b.indexOf(",")))),b},canClearPosition:function(b,c,d,e,f){var g=b.validPositions[c].input,h=g!=f.radixPoint&&isFinite(g)||c==d||g==f.groupSeparator||g==f.negationSymbol.front||g==f.negationSymbol.back;if(h&&isFinite(g)){var i;if(!e&&b.buffer){i=b.buffer.join("").substr(0,c).match(f.regex.integerNPart(f));var j=c+1,k=null==i||0==parseInt(i[0].replace(new RegExp(a.inputmask.escapeRegex(f.groupSeparator),"g"),""));if(k)for(;b.validPositions[j]&&(b.validPositions[j].input==f.groupSeparator||"0"==b.validPositions[j].input);)delete b.validPositions[j],j++}var l=[];for(var m in b.validPositions)l.push(b.validPositions[m].input);i=l.join("").match(f.regex.integerNPart(f));var n=a.inArray(f.radixPoint,b.buffer);if(i&&(-1==n||n>=c))if(0==i[0].indexOf("0"))h=i.index!=c||-1==n;else{var o=parseInt(i[0].replace(new RegExp(a.inputmask.escapeRegex(f.groupSeparator),"g"),""));-1!=n&&10>o&&"0"==f.placeholder.charAt(0)&&(b.validPositions[c].input="0",b.p=f.prefix.length+1,h=!1)}}return h}},currency:{prefix:"$ ",groupSeparator:",",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:"0",radixPoint:""}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{phone:{url:"phone-codes/phone-codes.js",maskInit:"+pp(pp)pppppppp",countrycode:"",mask:function(b){b.definitions={p:{validator:function(){return!1},cardinality:1},"#":{validator:"[0-9]",cardinality:1}};var c=[];return a.ajax({url:b.url,async:!1,dataType:"json",success:function(a){c=a},error:function(a,c,d){alert(d+" - "+b.url)}}),c=c.sort(function(a,b){return(a.mask||a)<(b.mask||b)?-1:1}),""!=b.countrycode&&(b.maskInit="+"+b.countrycode+b.maskInit.substring(3)),c.splice(0,0,b.maskInit),c},nojumps:!0,nojumpsThreshold:1,onBeforeMask:function(a,b){var c=a.replace(/^0/g,"");return(c.indexOf(b.countrycode)>1||-1==c.indexOf(b.countrycode))&&(c="+"+b.countrycode+c),c}},phonebe:{alias:"phone",url:"phone-codes/phone-be.js",countrycode:"32",nojumpsThreshold:4}}),a.fn.inputmask}(jQuery),function(a){return a.extend(a.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(a,b){return new RegExp(b.regex).test(a.join(""))},definitions:{r:{validator:function(b,c,d,e,f){function g(a,b){this.matches=[],this.isGroup=a||!1,this.isQuantifier=b||!1,this.quantifier={min:1,max:1},this.repeaterPart=void 0}function h(){var a,b,c=new g,d=[];for(f.regexTokens=[];a=f.tokenizer.exec(f.regex);)switch(b=a[0],b.charAt(0)){case"(":d.push(new g(!0));break;case")":var e=d.pop();d.length>0?d[d.length-1].matches.push(e):c.matches.push(e);break;case"{":case"+":case"*":var h=new g(!1,!0);b=b.replace(/[{}]/g,"");var i=b.split(","),j=isNaN(i[0])?i[0]:parseInt(i[0]),k=1==i.length?j:isNaN(i[1])?i[1]:parseInt(i[1]);if(h.quantifier={min:j,max:k},d.length>0){var l=d[d.length-1].matches;if(a=l.pop(),!a.isGroup){var e=new g(!0);e.matches.push(a),a=e}l.push(a),l.push(h)}else{if(a=c.matches.pop(),!a.isGroup){var e=new g(!0);e.matches.push(a),a=e}c.matches.push(a),c.matches.push(h)}break;default:d.length>0?d[d.length-1].matches.push(b):c.matches.push(b)}c.matches.length>0&&f.regexTokens.push(c)}function i(b,c){var d=!1;c&&(k+="(",m++);for(var e=0;e<b.matches.length;e++){var f=b.matches[e];if(1==f.isGroup)d=i(f,!0);else if(1==f.isQuantifier){var g=a.inArray(f,b.matches),h=b.matches[g-1],j=k;if(isNaN(f.quantifier.max)){for(;f.repeaterPart&&f.repeaterPart!=k&&f.repeaterPart.length>k.length&&!(d=i(h,!0)););d=d||i(h,!0),d&&(f.repeaterPart=k),k=j+f.quantifier.max}else{for(var l=0,o=f.quantifier.max-1;o>l&&!(d=i(h,!0));l++);k=j+"{"+f.quantifier.min+","+f.quantifier.max+"}"}}else if(void 0!=f.matches)for(var p=0;p<f.length&&!(d=i(f[p],c));p++);else{var q;if("["==f.charAt(0)){q=k,q+=f;for(var r=0;m>r;r++)q+=")";var s=new RegExp("^("+q+")$");d=s.test(n)}else for(var t=0,u=f.length;u>t;t++)if("\\"!=f.charAt(t)){q=k,q+=f.substr(0,t+1),q=q.replace(/\|$/,"");for(var r=0;m>r;r++)q+=")";var s=new RegExp("^("+q+")$");if(d=s.test(n))break}k+=f}if(d)break}return c&&(k+=")",m--),d}null==f.regexTokens&&h();var j=c.buffer.slice(),k="",l=!1,m=0;j.splice(d,0,b);for(var n=j.join(""),o=0;o<f.regexTokens.length;o++){var g=f.regexTokens[o];if(l=i(g,g.isGroup))break}return l},cardinality:1}}}}),a.fn.inputmask}(jQuery);
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
* lodash 3.2.0 (Custom Build) lodash.com/license | Underscore.js 1.7.0 underscorejs.org/LICENSE
|
4
|
+
* Build: `lodash modern -o ./lodash.js`
|
5
|
+
*/
|
6
|
+
;(function(){function n(n,t){if(n!==t){var r=n===n,e=t===t;if(n>t||!r||typeof n=="undefined"&&e)return 1;if(n<t||!e||typeof t=="undefined"&&r)return-1}return 0}function t(n,t,r){if(t!==t)return p(n,r);r=(r||0)-1;for(var e=n.length;++r<e;)if(n[r]===t)return r;return-1}function r(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].c;return n}function e(n){return typeof n=="string"?n:null==n?"":n+""}function u(n){return n.charCodeAt(0)}function o(n,t){for(var r=-1,e=n.length;++r<e&&-1<t.indexOf(n.charAt(r)););return r
|
7
|
+
}function i(n,t){for(var r=n.length;r--&&-1<t.indexOf(n.charAt(r)););return r}function f(t,r){return n(t.a,r.a)||t.b-r.b}function a(t,r){for(var e=-1,u=t.a,o=r.a,i=u.length;++e<i;){var f=n(u[e],o[e]);if(f)return f}return t.b-r.b}function c(n){return Wt[n]}function l(n){return Nt[n]}function s(n){return"\\"+Lt[n]}function p(n,t,r){var e=n.length;for(t=r?t||e:(t||0)-1;r?t--:++t<e;){var u=n[t];if(u!==u)return t}return-1}function h(n){return n&&typeof n=="object"||false}function _(n){return 160>=n&&9<=n&&13>=n||32==n||160==n||5760==n||6158==n||8192<=n&&(8202>=n||8232==n||8233==n||8239==n||8287==n||12288==n||65279==n)
|
8
|
+
}function g(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;)n[r]===t&&(n[r]=B,o[++u]=r);return o}function v(n){for(var t=-1,r=n.length;++t<r&&_(n.charCodeAt(t)););return t}function y(n){for(var t=n.length;t--&&_(n.charCodeAt(t)););return t}function d(n){return Ut[n]}function m(_){function Wt(n){if(h(n)&&!(So(n)||n instanceof Ut)){if(n instanceof Nt)return n;if(Uu.call(n,"__chain__")&&Uu.call(n,"__wrapped__"))return he(n)}return new Nt(n)}function Nt(n,t,r){this.__wrapped__=n,this.__actions__=r||[],this.__chain__=!!t
|
9
|
+
}function Ut(n){this.__wrapped__=n,this.__actions__=null,this.__dir__=1,this.__dropCount__=0,this.__filtered__=false,this.__iteratees__=null,this.__takeCount__=so,this.__views__=null}function Ft(){this.__data__={}}function Lt(n){var t=n?n.length:0;for(this.data={hash:to(null),set:new Zu};t--;)this.push(n[t])}function Bt(n,t){var r=n.data;return(typeof t=="string"||Xe(t)?r.set.has(t):r.hash[t])?0:-1}function zt(n,t){var r=-1,e=n.length;for(t||(t=wu(e));++r<e;)t[r]=n[r];return t}function Mt(n,t){for(var r=-1,e=n.length;++r<e&&false!==t(n[r],r,n););return n
|
10
|
+
}function qt(n,t){for(var r=-1,e=n.length;++r<e;)if(!t(n[r],r,n))return false;return true}function Pt(n,t){for(var r=-1,e=n.length,u=-1,o=[];++r<e;){var i=n[r];t(i,r,n)&&(o[++u]=i)}return o}function Kt(n,t){for(var r=-1,e=n.length,u=wu(e);++r<e;)u[r]=t(n[r],r,n);return u}function Vt(n){for(var t=-1,r=n.length,e=lo;++t<r;){var u=n[t];u>e&&(e=u)}return e}function Yt(n,t,r,e){var u=-1,o=n.length;for(e&&o&&(r=n[++u]);++u<o;)r=t(r,n[u],u,n);return r}function Zt(n,t,r,e){var u=n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);
|
11
|
+
return r}function Gt(n,t){for(var r=-1,e=n.length;++r<e;)if(t(n[r],r,n))return true;return false}function Jt(n,t){return typeof n=="undefined"?t:n}function Xt(n,t,r,e){return typeof n!="undefined"&&Uu.call(e,r)?n:t}function Ht(n,t,r){var e=Fo(t);if(!r)return nr(t,n,e);for(var u=-1,o=e.length;++u<o;){var i=e[u],f=n[i],a=r(f,t[i],i,n,t);(a===a?a===f:f!==f)&&(typeof f!="undefined"||i in n)||(n[i]=a)}return n}function Qt(n,t){for(var r=-1,e=n.length,u=oe(e),o=t.length,i=wu(o);++r<o;){var f=t[r];u?(f=parseFloat(f),i[r]=ee(f,e)?n[f]:w):i[r]=n[f]
|
12
|
+
}return i}function nr(n,t,r){r||(r=t,t={});for(var e=-1,u=r.length;++e<u;){var o=r[e];t[o]=n[o]}return t}function tr(n,t,r){var e=typeof n;if("function"==e){if(e=typeof t!="undefined"){var e=Wt.support,u=!(e.funcNames?n.name:e.funcDecomp);if(!u){var o=Wu.call(n);e.funcNames||(u=!dt.test(o)),u||(u=kt.test(o)||He(n),bo(n,u))}e=u}n=e?Nr(n,t,r):n}else n=null==n?vu:"object"==e?br(n):typeof t=="undefined"?jr(n+""):xr(n+"",t);return n}function rr(n,t,r,e,u,o,i){var f;if(r&&(f=u?r(n,e,u):r(n)),typeof f!="undefined")return f;
|
13
|
+
if(!Xe(n))return n;if(e=So(n)){if(f=ne(n),!t)return zt(n,f)}else{var a=Lu.call(n),c=a==K;if(a!=Y&&a!=z&&(!c||u))return Tt[a]?re(n,a,t):u?n:{};if(f=te(c?{}:n),!t)return nr(n,f,Fo(n))}for(o||(o=[]),i||(i=[]),u=o.length;u--;)if(o[u]==n)return i[u];return o.push(n),i.push(f),(e?Mt:_r)(n,function(e,u){f[u]=rr(e,t,r,u,n,o,i)}),f}function er(n,t,r,e){if(typeof n!="function")throw new Ou($);return Gu(function(){n.apply(w,Rr(r,e))},t)}function ur(n,r){var e=n?n.length:0,u=[];if(!e)return u;var o=-1,i=Qr(),f=i==t,a=f&&200<=r.length&&xo(r),c=r.length;
|
14
|
+
a&&(i=Bt,f=false,r=a);n:for(;++o<e;)if(a=n[o],f&&a===a){for(var l=c;l--;)if(r[l]===a)continue n;u.push(a)}else 0>i(r,a)&&u.push(a);return u}function or(n,t){var r=n?n.length:0;if(!oe(r))return _r(n,t);for(var e=-1,u=pe(n);++e<r&&false!==t(u[e],e,u););return n}function ir(n,t){var r=n?n.length:0;if(!oe(r))return gr(n,t);for(var e=pe(n);r--&&false!==t(e[r],r,e););return n}function fr(n,t){var r=true;return or(n,function(n,e,u){return r=!!t(n,e,u)}),r}function ar(n,t){var r=[];return or(n,function(n,e,u){t(n,e,u)&&r.push(n)
|
15
|
+
}),r}function cr(n,t,r,e){var u;return r(n,function(n,r,o){return t(n,r,o)?(u=e?r:n,false):void 0}),u}function lr(n,t,r,e){e=(e||0)-1;for(var u=n.length,o=-1,i=[];++e<u;){var f=n[e];if(h(f)&&oe(f.length)&&(So(f)||Ye(f))){t&&(f=lr(f,t,r));var a=-1,c=f.length;for(i.length+=c;++a<c;)i[++o]=f[a]}else r||(i[++o]=f)}return i}function sr(n,t,r){var e=-1,u=pe(n);r=r(n);for(var o=r.length;++e<o;){var i=r[e];if(false===t(u[i],i,u))break}return n}function pr(n,t,r){var e=pe(n);r=r(n);for(var u=r.length;u--;){var o=r[u];
|
16
|
+
if(false===t(e[o],o,e))break}return n}function hr(n,t){sr(n,t,ou)}function _r(n,t){return sr(n,t,Fo)}function gr(n,t){return pr(n,t,Fo)}function vr(n,t){for(var r=-1,e=t.length,u=-1,o=[];++r<e;){var i=t[r];Je(n[i])&&(o[++u]=i)}return o}function yr(n,t,r){var e=-1,u=typeof t=="function",o=n?n.length:0,i=oe(o)?wu(o):[];return or(n,function(n){var o=u?t:null!=n&&n[t];i[++e]=o?o.apply(n,r):w}),i}function dr(n,t,r,e,u,o){if(n===t)return 0!==n||1/n==1/t;var i=typeof n,f=typeof t;if("function"!=i&&"object"!=i&&"function"!=f&&"object"!=f||null==n||null==t)n=n!==n&&t!==t;
|
17
|
+
else n:{var i=dr,f=So(n),a=So(t),c=D,l=D;f||(c=Lu.call(n),c==z?c=Y:c!=Y&&(f=ru(n))),a||(l=Lu.call(t),l==z?l=Y:l!=Y&&ru(t));var s=c==Y,a=l==Y,l=c==l;if(!l||f||s)if(c=s&&Uu.call(n,"__wrapped__"),a=a&&Uu.call(t,"__wrapped__"),c||a)n=i(c?n.value():n,a?t.value():t,r,e,u,o);else if(l){for(u||(u=[]),o||(o=[]),c=u.length;c--;)if(u[c]==n){n=o[c]==t;break n}u.push(n),o.push(t),n=(f?Zr:Jr)(n,t,i,r,e,u,o),u.pop(),o.pop()}else n=false;else n=Gr(n,t,c)}return n}function mr(n,t,r,e,u){var o=t.length;if(null==n)return!o;
|
18
|
+
for(var i=-1,f=!u;++i<o;)if(f&&e[i]?r[i]!==n[t[i]]:!Uu.call(n,t[i]))return false;for(i=-1;++i<o;){var a=t[i];if(f&&e[i])a=Uu.call(n,a);else{var c=n[a],l=r[i],a=u?u(c,l,a):w;typeof a=="undefined"&&(a=dr(l,c,u,true))}if(!a)return false}return true}function wr(n,t){var r=[];return or(n,function(n,e,u){r.push(t(n,e,u))}),r}function br(n){var t=Fo(n),r=t.length;if(1==r){var e=t[0],u=n[e];if(ie(u))return function(n){return null!=n&&n[e]===u&&Uu.call(n,e)}}for(var o=wu(r),i=wu(r);r--;)u=n[t[r]],o[r]=u,i[r]=ie(u);return function(n){return mr(n,t,o,i)
|
19
|
+
}}function xr(n,t){return ie(t)?function(r){return null!=r&&r[n]===t}:function(r){return null!=r&&dr(t,r[n],null,true)}}function Ar(n,t,r,e,u){var o=oe(t.length)&&(So(t)||ru(t));return(o?Mt:_r)(t,function(t,i,f){if(h(t)){e||(e=[]),u||(u=[]);n:{t=e;for(var a=u,c=t.length,l=f[i];c--;)if(t[c]==l){n[i]=a[c],i=void 0;break n}c=n[i],f=r?r(c,l,i,n,f):w;var s=typeof f=="undefined";s&&(f=l,oe(l.length)&&(So(l)||ru(l))?f=So(c)?c:c?zt(c):[]:No(l)||Ye(l)?f=Ye(c)?eu(c):No(c)?c:{}:s=false),t.push(l),a.push(f),s?n[i]=Ar(f,l,r,t,a):(f===f?f!==c:c===c)&&(n[i]=f),i=void 0
|
20
|
+
}return i}a=n[i],f=r?r(a,t,i,n,f):w,(l=typeof f=="undefined")&&(f=t),!o&&typeof f=="undefined"||!l&&(f===f?f===a:a!==a)||(n[i]=f)}),n}function jr(n){return function(t){return null==t?w:t[n]}}function kr(n,t){return n+Pu(co()*(t-n+1))}function Er(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function Rr(n,t,r){var e=-1,u=n.length;for(t=null==t?0:+t||0,0>t&&(t=-t>u?0:u+t),r=typeof r=="undefined"||r>u?u:+r||0,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=wu(u);++e<u;)r[e]=n[e+t];return r}function Ir(n,t){var r;
|
21
|
+
return or(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function Or(n,r){var e=-1,u=Qr(),o=n.length,i=u==t,f=i&&200<=o,a=f&&xo(),c=[];a?(u=Bt,i=false):(f=false,a=r?[]:c);n:for(;++e<o;){var l=n[e],s=r?r(l,e,n):l;if(i&&l===l){for(var p=a.length;p--;)if(a[p]===s)continue n;r&&a.push(s),c.push(l)}else 0>u(a,s)&&((r||f)&&a.push(s),c.push(l))}return c}function Cr(n,t){for(var r=-1,e=t.length,u=wu(e);++r<e;)u[r]=n[t[r]];return u}function Tr(n,t){var r=n;r instanceof Ut&&(r=r.value());for(var e=-1,u=t.length;++e<u;){var r=[r],o=t[e];
|
22
|
+
Vu.apply(r,o.args),r=o.func.apply(o.thisArg,r)}return r}function Sr(n,t,r){var e=0,u=n?n.length:e;if(typeof t=="number"&&t===t&&u<=_o){for(;e<u;){var o=e+u>>>1,i=n[o];(r?i<=t:i<t)?e=o+1:u=o}return u}return Wr(n,t,vu,r)}function Wr(n,t,r,e){t=r(t);for(var u=0,o=n?n.length:0,i=t!==t,f=typeof t=="undefined";u<o;){var a=Pu((u+o)/2),c=r(n[a]),l=c===c;(i?l||e:f?l&&(e||typeof c!="undefined"):e?c<=t:c<t)?u=a+1:o=a}return oo(o,ho)}function Nr(n,t,r){if(typeof n!="function")return vu;if(typeof t=="undefined")return n;
|
23
|
+
switch(r){case 1:return function(r){return n.call(t,r)};case 3:return function(r,e,u){return n.call(t,r,e,u)};case 4:return function(r,e,u,o){return n.call(t,r,e,u,o)};case 5:return function(r,e,u,o,i){return n.call(t,r,e,u,o,i)}}return function(){return n.apply(t,arguments)}}function Ur(n){return Du.call(n,0)}function Fr(n,t,r){for(var e=r.length,u=-1,o=uo(n.length-e,0),i=-1,f=t.length,a=wu(o+f);++i<f;)a[i]=t[i];for(;++u<e;)a[r[u]]=n[u];for(;o--;)a[i++]=n[u++];return a}function Lr(n,t,r){for(var e=-1,u=r.length,o=-1,i=uo(n.length-u,0),f=-1,a=t.length,c=wu(i+a);++o<i;)c[o]=n[o];
|
24
|
+
for(i=o;++f<a;)c[i+f]=t[f];for(;++e<u;)c[i+r[e]]=n[o++];return c}function $r(n,t){return function(r,e,u){var o=t?t():{};if(e=Hr(e,u,3),So(r)){u=-1;for(var i=r.length;++u<i;){var f=r[u];n(o,f,e(f,u,r),r)}}else or(r,function(t,r,u){n(o,t,e(t,r,u),u)});return o}}function Br(n){return function(){var t=arguments.length,r=arguments[0];if(2>t||null==r)return r;if(3<t&&ue(arguments[1],arguments[2],arguments[3])&&(t=2),3<t&&"function"==typeof arguments[t-2])var e=Nr(arguments[--t-1],arguments[t--],5);else 2<t&&"function"==typeof arguments[t-1]&&(e=arguments[--t]);
|
25
|
+
for(var u=0;++u<t;){var o=arguments[u];o&&n(r,o,e)}return r}}function zr(n,t){function r(){return(this instanceof r?e:n).apply(t,arguments)}var e=Mr(n);return r}function Dr(n){return function(t){var r=-1;t=pu(fu(t));for(var e=t.length,u="";++r<e;)u=n(u,t[r],r);return u}}function Mr(n){return function(){var t=wo(n.prototype),r=n.apply(t,arguments);return Xe(r)?r:t}}function qr(n,t){return function(r,e,o){o&&ue(r,e,o)&&(e=null);var i=Hr(),f=null==e;if(i===tr&&f||(f=false,e=i(e,o,3)),f){if(e=So(r),e||!tu(r))return n(e?r:se(r));
|
26
|
+
e=u}return Xr(r,e,t)}}function Pr(n,t,r,e,u,o,i,f,a,c){function l(){for(var b=arguments.length,j=b,k=wu(b);j--;)k[j]=arguments[j];if(e&&(k=Fr(k,e,u)),o&&(k=Lr(k,o,i)),_||y){var j=l.placeholder,E=g(k,j),b=b-E.length;if(b<c){var O=f?zt(f):null,b=uo(c-b,0),C=_?E:null,E=_?null:E,T=_?k:null,k=_?null:k;return t|=_?R:I,t&=~(_?I:R),v||(t&=~(x|A)),k=Pr(n,t,r,T,C,k,E,O,a,b),k.placeholder=j,k}}if(j=p?r:this,h&&(n=j[m]),f)for(O=k.length,b=oo(f.length,O),C=zt(k);b--;)E=f[b],k[b]=ee(E,O)?C[E]:w;return s&&a<k.length&&(k.length=a),(this instanceof l?d||Mr(n):n).apply(j,k)
|
27
|
+
}var s=t&C,p=t&x,h=t&A,_=t&k,v=t&j,y=t&E,d=!h&&Mr(n),m=n;return l}function Kr(n,t,r){return n=n.length,t=+t,n<t&&ro(t)?(t-=n,r=null==r?" ":r+"",lu(r,Mu(t/r.length)).slice(0,t)):""}function Vr(n,t,r,e){function u(){for(var t=-1,f=arguments.length,a=-1,c=e.length,l=wu(f+c);++a<c;)l[a]=e[a];for(;f--;)l[a++]=arguments[++t];return(this instanceof u?i:n).apply(o?r:this,l)}var o=t&x,i=Mr(n);return u}function Yr(n,t,r,e,u,o,i,f){var a=t&A;if(!a&&typeof n!="function")throw new Ou($);var c=e?e.length:0;if(c||(t&=~(R|I),e=u=null),c-=u?u.length:0,t&I){var l=e,s=u;
|
28
|
+
e=u=null}var p=!a&&Ao(n);if(r=[n,t,r,e,u,l,s,o,i,f],p&&true!==p){e=r[1],t=p[1],f=e|t,o=C|O,u=x|A,i=o|u|j|E;var l=e&C&&!(t&C),s=e&O&&!(t&O),h=(s?r:p)[7],_=(l?r:p)[8];o=f>=o&&f<=i&&(e<O||(s||l)&&h.length<=_),(!(e>=O&&t>u||e>u&&t>=O)||o)&&(t&x&&(r[2]=p[2],f|=e&x?0:j),(e=p[3])&&(u=r[3],r[3]=u?Fr(u,e,p[4]):zt(e),r[4]=u?g(r[3],B):zt(p[4])),(e=p[5])&&(u=r[5],r[5]=u?Lr(u,e,p[6]):zt(e),r[6]=u?g(r[5],B):zt(p[6])),(e=p[7])&&(r[7]=zt(e)),t&C&&(r[8]=null==r[8]?p[8]:oo(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=f),t=r[1],f=r[9]
|
29
|
+
}return r[9]=null==f?a?0:n.length:uo(f-c,0)||0,(p?bo:jo)(t==x?zr(r[0],r[2]):t!=R&&t!=(x|R)||r[4].length?Pr.apply(w,r):Vr.apply(w,r),r)}function Zr(n,t,r,e,u,o,i){var f=-1,a=n.length,c=t.length,l=true;if(a!=c&&(!u||c<=a))return false;for(;l&&++f<a;){var s=n[f],p=t[f],l=w;if(e&&(l=u?e(p,s,f):e(s,p,f)),typeof l=="undefined")if(u)for(var h=c;h--&&(p=t[h],!(l=s&&s===p||r(s,p,e,u,o,i))););else l=s&&s===p||r(s,p,e,u,o,i)}return!!l}function Gr(n,t,r){switch(r){case M:case q:return+n==+t;case P:return n.name==t.name&&n.message==t.message;
|
30
|
+
case V:return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case Z:case G:return n==t+""}return false}function Jr(n,t,r,e,u,o,i){var f=Fo(n),a=f.length,c=Fo(t).length;if(a!=c&&!u)return false;for(var l,c=-1;++c<a;){var s=f[c],p=Uu.call(t,s);if(p){var h=n[s],_=t[s],p=w;e&&(p=u?e(_,h,s):e(h,_,s)),typeof p=="undefined"&&(p=h&&h===_||r(h,_,e,u,o,i))}if(!p)return false;l||(l="constructor"==s)}return l||(r=n.constructor,e=t.constructor,!(r!=e&&"constructor"in n&&"constructor"in t)||typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)?true:false
|
31
|
+
}function Xr(n,t,r){var e=r?so:lo,u=e,o=u;return or(n,function(n,i,f){i=t(n,i,f),((r?i<u:i>u)||i===e&&i===o)&&(u=i,o=n)}),o}function Hr(n,t,r){var e=Wt.callback||_u,e=e===_u?tr:e;return r?e(n,t,r):e}function Qr(n,r,e){var u=Wt.indexOf||de,u=u===de?t:u;return n?u(n,r,e):u}function ne(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&Uu.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function te(n){return n=n.constructor,typeof n=="function"&&n instanceof n||(n=Eu),new n
|
32
|
+
}function re(n,t,r){var e=n.constructor;switch(t){case J:return Ur(n);case M:case q:return new e(+n);case X:case H:case Q:case nt:case tt:case rt:case et:case ut:case ot:return t=n.buffer,new e(r?Ur(t):t,n.byteOffset,n.length);case V:case G:return new e(n);case Z:var u=new e(n.source,yt.exec(n));u.lastIndex=n.lastIndex}return u}function ee(n,t){return n=+n,t=null==t?vo:t,-1<n&&0==n%1&&n<t}function ue(n,t,r){if(!Xe(r))return false;var e=typeof t;return"number"==e?(e=r.length,e=oe(e)&&ee(t,e)):e="string"==e&&t in r,e&&r[t]===n
|
33
|
+
}function oe(n){return typeof n=="number"&&-1<n&&0==n%1&&n<=vo}function ie(n){return n===n&&(0===n?0<1/n:!Xe(n))}function fe(n,t){n=pe(n);for(var r=-1,e=t.length,u={};++r<e;){var o=t[r];o in n&&(u[o]=n[o])}return u}function ae(n,t){var r={};return hr(n,function(n,e,u){t(n,e,u)&&(r[e]=n)}),r}function ce(n){var t;if(!h(n)||Lu.call(n)!=Y||!(Uu.call(n,"constructor")||(t=n.constructor,typeof t!="function"||t instanceof t)))return false;var r;return hr(n,function(n,t){r=t}),typeof r=="undefined"||Uu.call(n,r)
|
34
|
+
}function le(n){for(var t=ou(n),r=t.length,e=r&&n.length,u=Wt.support,u=e&&oe(e)&&(So(n)||u.nonEnumArgs&&Ye(n)),o=-1,i=[];++o<r;){var f=t[o];(u&&ee(f,e)||Uu.call(n,f))&&i.push(f)}return i}function se(n){return null==n?[]:oe(n.length)?Xe(n)?n:Eu(n):iu(n)}function pe(n){return Xe(n)?n:Eu(n)}function he(n){return n instanceof Ut?n.clone():new Nt(n.__wrapped__,n.__chain__,zt(n.__actions__))}function _e(n,t,r){return n&&n.length?((r?ue(n,t,r):null==t)&&(t=1),Rr(n,0>t?0:t)):[]}function ge(n,t,r){var e=n?n.length:0;
|
35
|
+
return e?((r?ue(n,t,r):null==t)&&(t=1),t=e-(+t||0),Rr(n,0,0>t?0:t)):[]}function ve(n,t,r){var e=-1,u=n?n.length:0;for(t=Hr(t,r,3);++e<u;)if(t(n[e],e,n))return e;return-1}function ye(n){return n?n[0]:w}function de(n,r,e){var u=n?n.length:0;if(!u)return-1;if(typeof e=="number")e=0>e?uo(u+e,0):e||0;else if(e)return e=Sr(n,r),n=n[e],(r===r?r===n:n!==n)?e:-1;return t(n,r,e)}function me(n){return _e(n,1)}function we(n,r,e,u){if(!n||!n.length)return[];typeof r!="boolean"&&null!=r&&(u=e,e=ue(n,r,u)?null:r,r=false);
|
36
|
+
var o=Hr();if((o!==tr||null!=e)&&(e=o(e,u,3)),r&&Qr()==t){r=e;var i;e=-1,u=n.length;for(var o=-1,f=[];++e<u;){var a=n[e],c=r?r(a,e,n):a;e&&i===c||(i=c,f[++o]=a)}n=f}else n=Or(n,e);return n}function be(n){for(var t=-1,r=(n&&n.length&&Vt(Kt(n,Nu)))>>>0,e=wu(r);++t<r;)e[t]=Kt(n,jr(t));return e}function xe(n,t){var r=-1,e=n?n.length:0,u={};for(!e||t||So(n[0])||(t=[]);++r<e;){var o=n[r];t?u[o]=t[r]:o&&(u[o[0]]=o[1])}return u}function Ae(n){return n=Wt(n),n.__chain__=true,n}function je(n,t,r){return t.call(r,n)
|
37
|
+
}function ke(n,t,r){var e=n?n.length:0;return oe(e)||(n=iu(n),e=n.length),e?(r=typeof r=="number"?0>r?uo(e+r,0):r||0:0,typeof n=="string"||!So(n)&&tu(n)?r<e&&-1<n.indexOf(t,r):-1<Qr(n,t,r)):false}function Ee(n,t,r){var e=So(n)?qt:fr;return(typeof t!="function"||typeof r!="undefined")&&(t=Hr(t,r,3)),e(n,t)}function Re(n,t,r){var e=So(n)?Pt:ar;return t=Hr(t,r,3),e(n,t)}function Ie(n,t,r){return So(n)?(t=ve(n,t,r),-1<t?n[t]:w):(t=Hr(t,r,3),cr(n,t,or))}function Oe(n,t,r){return typeof t=="function"&&typeof r=="undefined"&&So(n)?Mt(n,t):or(n,Nr(t,r,3))
|
38
|
+
}function Ce(n,t,r){if(typeof t=="function"&&typeof r=="undefined"&&So(n))for(r=n.length;r--&&false!==t(n[r],r,n););else n=ir(n,Nr(t,r,3));return n}function Te(n,t,r){var e=So(n)?Kt:wr;return t=Hr(t,r,3),e(n,t)}function Se(n,t,r,e){return(So(n)?Yt:Er)(n,Hr(t,e,4),r,3>arguments.length,or)}function We(n,t,r,e){return(So(n)?Zt:Er)(n,Hr(t,e,4),r,3>arguments.length,ir)}function Ne(n,t,r){return(r?ue(n,t,r):null==t)?(n=se(n),t=n.length,0<t?n[kr(0,t-1)]:w):(n=Ue(n),n.length=oo(0>t?0:+t||0,n.length),n)}function Ue(n){n=se(n);
|
39
|
+
for(var t=-1,r=n.length,e=wu(r);++t<r;){var u=kr(0,t);t!=u&&(e[t]=e[u]),e[u]=n[t]}return e}function Fe(n,t,r){var e=So(n)?Gt:Ir;return(typeof t!="function"||typeof r!="undefined")&&(t=Hr(t,r,3)),e(n,t)}function Le(n,t){var r;if(typeof t!="function"){if(typeof n!="function")throw new Ou($);var e=n;n=t,t=e}return function(){return 0<--n?r=t.apply(this,arguments):t=null,r}}function $e(n,t){var r=x;if(2<arguments.length)var e=Rr(arguments,2),u=g(e,$e.placeholder),r=r|R;return Yr(n,r,t,e,u)}function Be(n,t){var r=x|A;
|
40
|
+
if(2<arguments.length)var e=Rr(arguments,2),u=g(e,Be.placeholder),r=r|R;return Yr(t,r,n,e,u)}function ze(n,t,r){return r&&ue(n,t,r)&&(t=null),n=Yr(n,k,null,null,null,null,null,t),n.placeholder=ze.placeholder,n}function De(n,t,r){return r&&ue(n,t,r)&&(t=null),n=Yr(n,E,null,null,null,null,null,t),n.placeholder=De.placeholder,n}function Me(n,t,r){function e(){var r=t-(To()-c);0>=r||r>t?(f&&qu(f),r=p,f=s=p=w,r&&(h=To(),a=n.apply(l,i),s||f||(i=l=null))):s=Gu(e,r)}function u(){s&&qu(s),f=s=p=w,(g||_!==t)&&(h=To(),a=n.apply(l,i),s||f||(i=l=null))
|
41
|
+
}function o(){if(i=arguments,c=To(),l=this,p=g&&(s||!v),false===_)var r=v&&!s;else{f||v||(h=c);var o=_-(c-h),y=0>=o||o>_;y?(f&&(f=qu(f)),h=c,a=n.apply(l,i)):f||(f=Gu(u,o))}return y&&s?s=qu(s):s||t===_||(s=Gu(e,t)),r&&(y=true,a=n.apply(l,i)),!y||s||f||(i=l=null),a}var i,f,a,c,l,s,p,h=0,_=false,g=true;if(typeof n!="function")throw new Ou($);if(t=0>t?0:t,true===r)var v=true,g=false;else Xe(r)&&(v=r.leading,_="maxWait"in r&&uo(+r.maxWait||0,t),g="trailing"in r?r.trailing:g);return o.cancel=function(){s&&qu(s),f&&qu(f),f=s=p=w
|
42
|
+
},o}function qe(){var n=arguments,t=n.length-1;if(0>t)return function(n){return n};if(!qt(n,Je))throw new Ou($);return function(){for(var r=t,e=n[r].apply(this,arguments);r--;)e=n[r].call(this,e);return e}}function Pe(n,t){function r(){var e=r.cache,u=t?t.apply(this,arguments):arguments[0];if(e.has(u))return e.get(u);var o=n.apply(this,arguments);return e.set(u,o),o}if(typeof n!="function"||t&&typeof t!="function")throw new Ou($);return r.cache=new Pe.Cache,r}function Ke(n){var t=Rr(arguments,1),r=g(t,Ke.placeholder);
|
43
|
+
return Yr(n,R,null,t,r)}function Ve(n){var t=Rr(arguments,1),r=g(t,Ve.placeholder);return Yr(n,I,null,t,r)}function Ye(n){return oe(h(n)?n.length:w)&&Lu.call(n)==z||false}function Ze(n){return n&&1===n.nodeType&&h(n)&&-1<Lu.call(n).indexOf("Element")||false}function Ge(n){return h(n)&&typeof n.message=="string"&&Lu.call(n)==P||false}function Je(n){return typeof n=="function"||false}function Xe(n){var t=typeof n;return"function"==t||n&&"object"==t||false}function He(n){return null==n?false:Lu.call(n)==K?Bu.test(Wu.call(n)):h(n)&&wt.test(n)||false
|
44
|
+
}function Qe(n){return typeof n=="number"||h(n)&&Lu.call(n)==V||false}function nu(n){return h(n)&&Lu.call(n)==Z||false}function tu(n){return typeof n=="string"||h(n)&&Lu.call(n)==G||false}function ru(n){return h(n)&&oe(n.length)&&Ct[Lu.call(n)]||false}function eu(n){return nr(n,ou(n))}function uu(n){return vr(n,ou(n))}function ou(n){if(null==n)return[];Xe(n)||(n=Eu(n));for(var t=n.length,t=t&&oe(t)&&(So(n)||mo.nonEnumArgs&&Ye(n))&&t||0,r=n.constructor,e=-1,r=typeof r=="function"&&r.prototype===n,u=wu(t),o=0<t;++e<t;)u[e]=e+"";
|
45
|
+
for(var i in n)o&&ee(i,t)||"constructor"==i&&(r||!Uu.call(n,i))||u.push(i);return u}function iu(n){return Cr(n,Fo(n))}function fu(n){return(n=e(n))&&n.replace(bt,c)}function au(n){return(n=e(n))&&jt.test(n)?n.replace(At,"\\$&"):n}function cu(n,t,r){return r&&ue(n,t,r)&&(t=0),ao(n,t)}function lu(n,t){var r="";if(n=e(n),t=+t,1>t||!n||!ro(t))return r;do t%2&&(r+=n),t=Pu(t/2),n+=n;while(t);return r}function su(n,t,r){var u=n;return(n=e(n))?(r?ue(u,t,r):null==t)?n.slice(v(n),y(n)+1):(t+="",n.slice(o(n,t),i(n,t)+1)):n
|
46
|
+
}function pu(n,t,r){return r&&ue(n,t,r)&&(t=null),n=e(n),n.match(t||Rt)||[]}function hu(n){try{return n.apply(w,Rr(arguments,1))}catch(t){return Ge(t)?t:new xu(t)}}function _u(n,t,r){return r&&ue(n,t,r)&&(t=null),h(n)?yu(n):tr(n,t)}function gu(n){return function(){return n}}function vu(n){return n}function yu(n){return br(rr(n,true))}function du(n,t,r){if(null==r){var e=Xe(t),u=e&&Fo(t);((u=u&&u.length&&vr(t,u))?u.length:e)||(u=false,r=t,t=n,n=this)}u||(u=vr(t,Fo(t)));var o=true,e=-1,i=Je(n),f=u.length;
|
47
|
+
!1===r?o=false:Xe(r)&&"chain"in r&&(o=r.chain);for(;++e<f;){r=u[e];var a=t[r];n[r]=a,i&&(n.prototype[r]=function(t){return function(){var r=this.__chain__;if(o||r){var e=n(this.__wrapped__);return(e.__actions__=zt(this.__actions__)).push({func:t,args:arguments,thisArg:n}),e.__chain__=r,e}return r=[this.value()],Vu.apply(r,arguments),t.apply(n,r)}}(a))}return n}function mu(){}_=_?Dt.defaults($t.Object(),_,Dt.pick($t,Ot)):$t;var wu=_.Array,bu=_.Date,xu=_.Error,Au=_.Function,ju=_.Math,ku=_.Number,Eu=_.Object,Ru=_.RegExp,Iu=_.String,Ou=_.TypeError,Cu=wu.prototype,Tu=Eu.prototype,Su=(Su=_.window)&&Su.document,Wu=Au.prototype.toString,Nu=jr("length"),Uu=Tu.hasOwnProperty,Fu=0,Lu=Tu.toString,$u=_._,Bu=Ru("^"+au(Lu).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zu=He(zu=_.ArrayBuffer)&&zu,Du=He(Du=zu&&new zu(0).slice)&&Du,Mu=ju.ceil,qu=_.clearTimeout,Pu=ju.floor,Ku=He(Ku=Eu.getPrototypeOf)&&Ku,Vu=Cu.push,Yu=Tu.propertyIsEnumerable,Zu=He(Zu=_.Set)&&Zu,Gu=_.setTimeout,Ju=Cu.splice,Xu=He(Xu=_.Uint8Array)&&Xu,Hu=He(Hu=_.WeakMap)&&Hu,Qu=function(){try{var n=He(n=_.Float64Array)&&n,t=new n(new zu(10),0,1)&&n
|
48
|
+
}catch(r){}return t}(),no=He(no=wu.isArray)&&no,to=He(to=Eu.create)&&to,ro=_.isFinite,eo=He(eo=Eu.keys)&&eo,uo=ju.max,oo=ju.min,io=He(io=bu.now)&&io,fo=He(fo=ku.isFinite)&&fo,ao=_.parseInt,co=ju.random,lo=ku.NEGATIVE_INFINITY,so=ku.POSITIVE_INFINITY,po=ju.pow(2,32)-1,ho=po-1,_o=po>>>1,go=Qu?Qu.BYTES_PER_ELEMENT:0,vo=ju.pow(2,53)-1,yo=Hu&&new Hu,mo=Wt.support={};!function(n){mo.funcDecomp=!He(_.WinRTError)&&kt.test(m),mo.funcNames=typeof Au.name=="string";try{mo.dom=11===Su.createDocumentFragment().nodeType
|
49
|
+
}catch(t){mo.dom=false}try{mo.nonEnumArgs=!Yu.call(arguments,1)}catch(r){mo.nonEnumArgs=true}}(0,0),Wt.templateSettings={escape:ht,evaluate:_t,interpolate:gt,variable:"",imports:{_:Wt}};var wo=function(){function n(){}return function(t){if(Xe(t)){n.prototype=t;var r=new n;n.prototype=null}return r||_.Object()}}(),bo=yo?function(n,t){return yo.set(n,t),n}:vu;Du||(Ur=zu&&Xu?function(n){var t=n.byteLength,r=Qu?Pu(t/go):0,e=r*go,u=new zu(t);if(r){var o=new Qu(u,0,r);o.set(new Qu(n,0,r))}return t!=e&&(o=new Xu(u,e),o.set(new Xu(n,e))),u
|
50
|
+
}:gu(null));var xo=to&&Zu?function(n){return new Lt(n)}:gu(null),Ao=yo?function(n){return yo.get(n)}:mu,jo=function(){var n=0,t=0;return function(r,e){var u=To(),o=N-(u-t);if(t=u,0<o){if(++n>=W)return r}else n=0;return bo(r,e)}}(),ko=$r(function(n,t,r){Uu.call(n,r)?++n[r]:n[r]=1}),Eo=$r(function(n,t,r){Uu.call(n,r)?n[r].push(t):n[r]=[t]}),Ro=$r(function(n,t,r){n[r]=t}),Io=qr(Vt),Oo=qr(function(n){for(var t=-1,r=n.length,e=so;++t<r;){var u=n[t];u<e&&(e=u)}return e},true),Co=$r(function(n,t,r){n[r?0:1].push(t)
|
51
|
+
},function(){return[[],[]]}),To=io||function(){return(new bu).getTime()},So=no||function(n){return h(n)&&oe(n.length)&&Lu.call(n)==D||false};mo.dom||(Ze=function(n){return n&&1===n.nodeType&&h(n)&&!No(n)||false});var Wo=fo||function(n){return typeof n=="number"&&ro(n)};(Je(/x/)||Xu&&!Je(Xu))&&(Je=function(n){return Lu.call(n)==K});var No=Ku?function(n){if(!n||Lu.call(n)!=Y)return false;var t=n.valueOf,r=He(t)&&(r=Ku(t))&&Ku(r);return r?n==r||Ku(n)==r:ce(n)}:ce,Uo=Br(Ht),Fo=eo?function(n){if(n)var t=n.constructor,r=n.length;
|
52
|
+
return typeof t=="function"&&t.prototype===n||typeof n!="function"&&r&&oe(r)?le(n):Xe(n)?eo(n):[]}:le,Lo=Br(Ar),$o=Dr(function(n,t,r){return t=t.toLowerCase(),n+(r?t.charAt(0).toUpperCase()+t.slice(1):t)}),Bo=Dr(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()});8!=ao(It+"08")&&(cu=function(n,t,r){return(r?ue(n,t,r):null==t)?t=0:t&&(t=+t),n=su(n),ao(n,t||(mt.test(n)?16:10))});var zo=Dr(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()}),Do=Dr(function(n,t,r){return n+(r?" ":"")+(t.charAt(0).toUpperCase()+t.slice(1))
|
53
|
+
});return Nt.prototype=wo(Wt.prototype),Ut.prototype=wo(Nt.prototype),Ut.prototype.constructor=Ut,Ft.prototype["delete"]=function(n){return this.has(n)&&delete this.__data__[n]},Ft.prototype.get=function(n){return"__proto__"==n?w:this.__data__[n]},Ft.prototype.has=function(n){return"__proto__"!=n&&Uu.call(this.__data__,n)},Ft.prototype.set=function(n,t){return"__proto__"!=n&&(this.__data__[n]=t),this},Lt.prototype.push=function(n){var t=this.data;typeof n=="string"||Xe(n)?t.set.add(n):t.hash[n]=true
|
54
|
+
},Pe.Cache=Ft,Wt.after=function(n,t){if(typeof t!="function"){if(typeof n!="function")throw new Ou($);var r=n;n=t,t=r}return n=ro(n=+n)?n:0,function(){return 1>--n?t.apply(this,arguments):void 0}},Wt.ary=function(n,t,r){return r&&ue(n,t,r)&&(t=null),t=n&&null==t?n.length:uo(+t||0,0),Yr(n,C,null,null,null,null,t)},Wt.assign=Uo,Wt.at=function(n){return oe(n?n.length:0)&&(n=se(n)),Qt(n,lr(arguments,false,false,1))},Wt.before=Le,Wt.bind=$e,Wt.bindAll=function(n){for(var t=n,r=1<arguments.length?lr(arguments,false,false,1):uu(n),e=-1,u=r.length;++e<u;){var o=r[e];
|
55
|
+
t[o]=Yr(t[o],x,t)}return t},Wt.bindKey=Be,Wt.callback=_u,Wt.chain=Ae,Wt.chunk=function(n,t,r){t=(r?ue(n,t,r):null==t)?1:uo(+t||1,1),r=0;for(var e=n?n.length:0,u=-1,o=wu(Mu(e/t));r<e;)o[++u]=Rr(n,r,r+=t);return o},Wt.compact=function(n){for(var t=-1,r=n?n.length:0,e=-1,u=[];++t<r;){var o=n[t];o&&(u[++e]=o)}return u},Wt.constant=gu,Wt.countBy=ko,Wt.create=function(n,t,r){var e=wo(n);return r&&ue(n,t,r)&&(t=null),t?nr(t,e,Fo(t)):e},Wt.curry=ze,Wt.curryRight=De,Wt.debounce=Me,Wt.defaults=function(n){if(null==n)return n;
|
56
|
+
var t=zt(arguments);return t.push(Jt),Uo.apply(w,t)},Wt.defer=function(n){return er(n,1,arguments,1)},Wt.delay=function(n,t){return er(n,t,arguments,2)},Wt.difference=function(){for(var n=-1,t=arguments.length;++n<t;){var r=arguments[n];if(So(r)||Ye(r))break}return ur(r,lr(arguments,false,true,++n))},Wt.drop=_e,Wt.dropRight=ge,Wt.dropRightWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];for(t=Hr(t,r,3);e--&&t(n[e],e,n););return Rr(n,0,e+1)},Wt.dropWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];
|
57
|
+
var u=-1;for(t=Hr(t,r,3);++u<e&&t(n[u],u,n););return Rr(n,u)},Wt.fill=function(n,t,r,e){var u=n?n.length:0;if(!u)return[];for(r&&typeof r!="number"&&ue(n,t,r)&&(r=0,e=u),u=n.length,r=null==r?0:+r||0,0>r&&(r=-r>u?0:u+r),e=typeof e=="undefined"||e>u?u:+e||0,0>e&&(e+=u),u=r>e?0:e>>>0,r>>>=0;r<u;)n[r++]=t;return n},Wt.filter=Re,Wt.flatten=function(n,t,r){var e=n?n.length:0;return r&&ue(n,t,r)&&(t=false),e?lr(n,t):[]},Wt.flattenDeep=function(n){return n&&n.length?lr(n,true):[]},Wt.flow=function(){var n=arguments,t=n.length;
|
58
|
+
if(!t)return function(n){return n};if(!qt(n,Je))throw new Ou($);return function(){for(var r=0,e=n[r].apply(this,arguments);++r<t;)e=n[r].call(this,e);return e}},Wt.flowRight=qe,Wt.forEach=Oe,Wt.forEachRight=Ce,Wt.forIn=function(n,t,r){return(typeof t!="function"||typeof r!="undefined")&&(t=Nr(t,r,3)),sr(n,t,ou)},Wt.forInRight=function(n,t,r){return t=Nr(t,r,3),pr(n,t,ou)},Wt.forOwn=function(n,t,r){return(typeof t!="function"||typeof r!="undefined")&&(t=Nr(t,r,3)),_r(n,t)},Wt.forOwnRight=function(n,t,r){return t=Nr(t,r,3),pr(n,t,Fo)
|
59
|
+
},Wt.functions=uu,Wt.groupBy=Eo,Wt.indexBy=Ro,Wt.initial=function(n){return ge(n,1)},Wt.intersection=function(){for(var n=[],r=-1,e=arguments.length,u=[],o=Qr(),i=o==t;++r<e;){var f=arguments[r];(So(f)||Ye(f))&&(n.push(f),u.push(i&&120<=f.length&&xo(r&&f)))}var e=n.length,i=n[0],a=-1,c=i?i.length:0,l=[],s=u[0];n:for(;++a<c;)if(f=i[a],0>(s?Bt(s,f):o(l,f))){for(r=e;--r;){var p=u[r];if(0>(p?Bt(p,f):o(n[r],f)))continue n}s&&s.push(f),l.push(f)}return l},Wt.invert=function(n,t,r){r&&ue(n,t,r)&&(t=null),r=-1;
|
60
|
+
for(var e=Fo(n),u=e.length,o={};++r<u;){var i=e[r],f=n[i];t?Uu.call(o,f)?o[f].push(i):o[f]=[i]:o[f]=i}return o},Wt.invoke=function(n,t){return yr(n,t,Rr(arguments,2))},Wt.keys=Fo,Wt.keysIn=ou,Wt.map=Te,Wt.mapValues=function(n,t,r){var e={};return t=Hr(t,r,3),_r(n,function(n,r,u){e[r]=t(n,r,u)}),e},Wt.matches=yu,Wt.matchesProperty=function(n,t){return xr(n+"",rr(t,true))},Wt.memoize=Pe,Wt.merge=Lo,Wt.mixin=du,Wt.negate=function(n){if(typeof n!="function")throw new Ou($);return function(){return!n.apply(this,arguments)
|
61
|
+
}},Wt.omit=function(n,t,r){if(null==n)return{};if(typeof t!="function"){var e=Kt(lr(arguments,false,false,1),Iu);return fe(n,ur(ou(n),e))}return t=Nr(t,r,3),ae(n,function(n,r,e){return!t(n,r,e)})},Wt.once=function(n){return Le(n,2)},Wt.pairs=function(n){for(var t=-1,r=Fo(n),e=r.length,u=wu(e);++t<e;){var o=r[t];u[t]=[o,n[o]]}return u},Wt.partial=Ke,Wt.partialRight=Ve,Wt.partition=Co,Wt.pick=function(n,t,r){return null==n?{}:typeof t=="function"?ae(n,Nr(t,r,3)):fe(n,lr(arguments,false,false,1))},Wt.pluck=function(n,t){return Te(n,jr(t))
|
62
|
+
},Wt.property=function(n){return jr(n+"")},Wt.propertyOf=function(n){return function(t){return null==n?w:n[t]}},Wt.pull=function(){var n=arguments[0];if(!n||!n.length)return n;for(var t=0,r=Qr(),e=arguments.length;++t<e;)for(var u=0,o=arguments[t];-1<(u=r(n,o,u));)Ju.call(n,u,1);return n},Wt.pullAt=function(t){var r=t||[],e=lr(arguments,false,false,1),u=e.length,o=Qt(r,e);for(e.sort(n);u--;){var i=parseFloat(e[u]);if(i!=f&&ee(i)){var f=i;Ju.call(r,i,1)}}return o},Wt.range=function(n,t,r){r&&ue(n,t,r)&&(t=r=null),n=+n||0,r=null==r?1:+r||0,null==t?(t=n,n=0):t=+t||0;
|
63
|
+
var e=-1;t=uo(Mu((t-n)/(r||1)),0);for(var u=wu(t);++e<t;)u[e]=n,n+=r;return u},Wt.rearg=function(n){var t=lr(arguments,false,false,1);return Yr(n,O,null,null,null,t)},Wt.reject=function(n,t,r){var e=So(n)?Pt:ar;return t=Hr(t,r,3),e(n,function(n,r,e){return!t(n,r,e)})},Wt.remove=function(n,t,r){var e=-1,u=n?n.length:0,o=[];for(t=Hr(t,r,3);++e<u;)r=n[e],t(r,e,n)&&(o.push(r),Ju.call(n,e--,1),u--);return o},Wt.rest=me,Wt.shuffle=Ue,Wt.slice=function(n,t,r){var e=n?n.length:0;return e?(r&&typeof r!="number"&&ue(n,t,r)&&(t=0,r=e),Rr(n,t,r)):[]
|
64
|
+
},Wt.sortBy=function(n,t,e){var u=-1,o=n?n.length:0,i=oe(o)?wu(o):[];return e&&ue(n,t,e)&&(t=null),t=Hr(t,e,3),or(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),r(i,f)},Wt.sortByAll=function(n){var t=arguments;3<t.length&&ue(t[1],t[2],t[3])&&(t=[n,t[1]]);var e=-1,u=n?n.length:0,o=lr(t,false,false,1),i=oe(u)?wu(u):[];return or(n,function(n){for(var t=o.length,r=wu(t);t--;)r[t]=null==n?w:n[o[t]];i[++e]={a:r,b:e,c:n}}),r(i,a)},Wt.spread=function(n){if(typeof n!="function")throw new Ou($);return function(t){return n.apply(this,t)
|
65
|
+
}},Wt.take=function(n,t,r){return n&&n.length?((r?ue(n,t,r):null==t)&&(t=1),Rr(n,0,0>t?0:t)):[]},Wt.takeRight=function(n,t,r){var e=n?n.length:0;return e?((r?ue(n,t,r):null==t)&&(t=1),t=e-(+t||0),Rr(n,0>t?0:t)):[]},Wt.takeRightWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];for(t=Hr(t,r,3);e--&&t(n[e],e,n););return Rr(n,e+1)},Wt.takeWhile=function(n,t,r){var e=n?n.length:0;if(!e)return[];var u=-1;for(t=Hr(t,r,3);++u<e&&t(n[u],u,n););return Rr(n,0,u)},Wt.tap=function(n,t,r){return t.call(r,n),n
|
66
|
+
},Wt.throttle=function(n,t,r){var e=true,u=true;if(typeof n!="function")throw new Ou($);return false===r?e=false:Xe(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),St.leading=e,St.maxWait=+t,St.trailing=u,Me(n,t,St)},Wt.thru=je,Wt.times=function(n,t,r){if(n=+n,1>n||!ro(n))return[];var e=-1,u=wu(oo(n,po));for(t=Nr(t,r,1);++e<n;)e<po?u[e]=t(e):t(e);return u},Wt.toArray=function(n){var t=n?n.length:0;return oe(t)?t?zt(n):[]:iu(n)},Wt.toPlainObject=eu,Wt.transform=function(n,t,r,e){var u=So(n)||ru(n);
|
67
|
+
return t=Hr(t,e,4),null==r&&(u||Xe(n)?(e=n.constructor,r=u?So(n)?new e:[]:wo(Je(e)&&e.prototype)):r={}),(u?Mt:_r)(n,function(n,e,u){return t(r,n,e,u)}),r},Wt.union=function(){return Or(lr(arguments,false,true))},Wt.uniq=we,Wt.unzip=be,Wt.values=iu,Wt.valuesIn=function(n){return Cr(n,ou(n))},Wt.where=function(n,t){return Re(n,br(t))},Wt.without=function(n){return ur(n,Rr(arguments,1))},Wt.wrap=function(n,t){return t=null==t?vu:t,Yr(t,R,null,[n],[])},Wt.xor=function(){for(var n=-1,t=arguments.length;++n<t;){var r=arguments[n];
|
68
|
+
if(So(r)||Ye(r))var e=e?ur(e,r).concat(ur(r,e)):r}return e?Or(e):[]},Wt.zip=function(){for(var n=arguments.length,t=wu(n);n--;)t[n]=arguments[n];return be(t)},Wt.zipObject=xe,Wt.backflow=qe,Wt.collect=Te,Wt.compose=qe,Wt.each=Oe,Wt.eachRight=Ce,Wt.extend=Uo,Wt.iteratee=_u,Wt.methods=uu,Wt.object=xe,Wt.select=Re,Wt.tail=me,Wt.unique=we,du(Wt,Wt),Wt.attempt=hu,Wt.camelCase=$o,Wt.capitalize=function(n){return(n=e(n))&&n.charAt(0).toUpperCase()+n.slice(1)},Wt.clone=function(n,t,r,e){return typeof t!="boolean"&&null!=t&&(e=r,r=ue(n,t,e)?null:t,t=false),r=typeof r=="function"&&Nr(r,e,1),rr(n,t,r)
|
69
|
+
},Wt.cloneDeep=function(n,t,r){return t=typeof t=="function"&&Nr(t,r,1),rr(n,true,t)},Wt.deburr=fu,Wt.endsWith=function(n,t,r){n=e(n),t+="";var u=n.length;return r=(typeof r=="undefined"?u:oo(0>r?0:+r||0,u))-t.length,0<=r&&n.indexOf(t,r)==r},Wt.escape=function(n){return(n=e(n))&&pt.test(n)?n.replace(lt,l):n},Wt.escapeRegExp=au,Wt.every=Ee,Wt.find=Ie,Wt.findIndex=ve,Wt.findKey=function(n,t,r){return t=Hr(t,r,3),cr(n,t,_r,true)},Wt.findLast=function(n,t,r){return t=Hr(t,r,3),cr(n,t,ir)},Wt.findLastIndex=function(n,t,r){var e=n?n.length:0;
|
70
|
+
for(t=Hr(t,r,3);e--;)if(t(n[e],e,n))return e;return-1},Wt.findLastKey=function(n,t,r){return t=Hr(t,r,3),cr(n,t,gr,true)},Wt.findWhere=function(n,t){return Ie(n,br(t))},Wt.first=ye,Wt.has=function(n,t){return n?Uu.call(n,t):false},Wt.identity=vu,Wt.includes=ke,Wt.indexOf=de,Wt.isArguments=Ye,Wt.isArray=So,Wt.isBoolean=function(n){return true===n||false===n||h(n)&&Lu.call(n)==M||false},Wt.isDate=function(n){return h(n)&&Lu.call(n)==q||false},Wt.isElement=Ze,Wt.isEmpty=function(n){if(null==n)return true;var t=n.length;
|
71
|
+
return oe(t)&&(So(n)||tu(n)||Ye(n)||h(n)&&Je(n.splice))?!t:!Fo(n).length},Wt.isEqual=function(n,t,r,e){return r=typeof r=="function"&&Nr(r,e,3),!r&&ie(n)&&ie(t)?n===t:(e=r?r(n,t):w,typeof e=="undefined"?dr(n,t,r):!!e)},Wt.isError=Ge,Wt.isFinite=Wo,Wt.isFunction=Je,Wt.isMatch=function(n,t,r,e){var u=Fo(t),o=u.length;if(r=typeof r=="function"&&Nr(r,e,3),!r&&1==o){var i=u[0];if(e=t[i],ie(e))return null!=n&&e===n[i]&&Uu.call(n,i)}for(var i=wu(o),f=wu(o);o--;)e=i[o]=t[u[o]],f[o]=ie(e);return mr(n,u,i,f,r)
|
72
|
+
},Wt.isNaN=function(n){return Qe(n)&&n!=+n},Wt.isNative=He,Wt.isNull=function(n){return null===n},Wt.isNumber=Qe,Wt.isObject=Xe,Wt.isPlainObject=No,Wt.isRegExp=nu,Wt.isString=tu,Wt.isTypedArray=ru,Wt.isUndefined=function(n){return typeof n=="undefined"},Wt.kebabCase=Bo,Wt.last=function(n){var t=n?n.length:0;return t?n[t-1]:w},Wt.lastIndexOf=function(n,t,r){var e=n?n.length:0;if(!e)return-1;var u=e;if(typeof r=="number")u=(0>r?uo(e+r,0):oo(r||0,e-1))+1;else if(r)return u=Sr(n,t,true)-1,n=n[u],(t===t?t===n:n!==n)?u:-1;
|
73
|
+
if(t!==t)return p(n,u,true);for(;u--;)if(n[u]===t)return u;return-1},Wt.max=Io,Wt.min=Oo,Wt.noConflict=function(){return _._=$u,this},Wt.noop=mu,Wt.now=To,Wt.pad=function(n,t,r){n=e(n),t=+t;var u=n.length;return u<t&&ro(t)?(u=(t-u)/2,t=Pu(u),u=Mu(u),r=Kr("",u,r),r.slice(0,t)+n+r):n},Wt.padLeft=function(n,t,r){return(n=e(n))&&Kr(n,t,r)+n},Wt.padRight=function(n,t,r){return(n=e(n))&&n+Kr(n,t,r)},Wt.parseInt=cu,Wt.random=function(n,t,r){r&&ue(n,t,r)&&(t=r=null);var e=null==n,u=null==t;return null==r&&(u&&typeof n=="boolean"?(r=n,n=1):typeof t=="boolean"&&(r=t,u=true)),e&&u&&(t=1,u=false),n=+n||0,u?(t=n,n=0):t=+t||0,r||n%1||t%1?(r=co(),oo(n+r*(t-n+parseFloat("1e-"+((r+"").length-1))),t)):kr(n,t)
|
74
|
+
},Wt.reduce=Se,Wt.reduceRight=We,Wt.repeat=lu,Wt.result=function(n,t,r){return t=null==n?w:n[t],typeof t=="undefined"&&(t=r),Je(t)?t.call(n):t},Wt.runInContext=m,Wt.size=function(n){var t=n?n.length:0;return oe(t)?t:Fo(n).length},Wt.snakeCase=zo,Wt.some=Fe,Wt.sortedIndex=function(n,t,r,e){var u=Hr(r);return u===tr&&null==r?Sr(n,t):Wr(n,t,u(r,e,1))},Wt.sortedLastIndex=function(n,t,r,e){var u=Hr(r);return u===tr&&null==r?Sr(n,t,true):Wr(n,t,u(r,e,1),true)},Wt.startCase=Do,Wt.startsWith=function(n,t,r){return n=e(n),r=null==r?0:oo(0>r?0:+r||0,n.length),n.lastIndexOf(t,r)==r
|
75
|
+
},Wt.template=function(n,t,r){var u=Wt.templateSettings;r&&ue(n,t,r)&&(t=r=null),n=e(n),t=Ht(Ht({},r||t),u,Xt),r=Ht(Ht({},t.imports),u.imports,Xt);var o,i,f=Fo(r),a=Cr(r,f),c=0;r=t.interpolate||xt;var l="__p+='";r=Ru((t.escape||xt).source+"|"+r.source+"|"+(r===gt?vt:xt).source+"|"+(t.evaluate||xt).source+"|$","g");var p="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";if(n.replace(r,function(t,r,e,u,f,a){return e||(e=u),l+=n.slice(c,a).replace(Et,s),r&&(o=true,l+="'+__e("+r+")+'"),f&&(i=true,l+="';"+f+";\n__p+='"),e&&(l+="'+((__t=("+e+"))==null?'':__t)+'"),c=a+t.length,t
|
76
|
+
}),l+="';",(t=t.variable)||(l="with(obj){"+l+"}"),l=(i?l.replace(it,""):l).replace(ft,"$1").replace(at,"$1;"),l="function("+(t||"obj")+"){"+(t?"":"obj||(obj={});")+"var __t,__p=''"+(o?",__e=_.escape":"")+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}",t=hu(function(){return Au(f,p+"return "+l).apply(w,a)}),t.source=l,Ge(t))throw t;return t},Wt.trim=su,Wt.trimLeft=function(n,t,r){var u=n;return(n=e(n))?n.slice((r?ue(u,t,r):null==t)?v(n):o(n,t+"")):n
|
77
|
+
},Wt.trimRight=function(n,t,r){var u=n;return(n=e(n))?(r?ue(u,t,r):null==t)?n.slice(0,y(n)+1):n.slice(0,i(n,t+"")+1):n},Wt.trunc=function(n,t,r){r&&ue(n,t,r)&&(t=null);var u=T;if(r=S,null!=t)if(Xe(t)){var o="separator"in t?t.separator:o,u="length"in t?+t.length||0:u;r="omission"in t?e(t.omission):r}else u=+t||0;if(n=e(n),u>=n.length)return n;if(u-=r.length,1>u)return r;if(t=n.slice(0,u),null==o)return t+r;if(nu(o)){if(n.slice(u).search(o)){var i,f=n.slice(0,u);for(o.global||(o=Ru(o.source,(yt.exec(o)||"")+"g")),o.lastIndex=0;n=o.exec(f);)i=n.index;
|
78
|
+
t=t.slice(0,null==i?u:i)}}else n.indexOf(o,u)!=u&&(o=t.lastIndexOf(o),-1<o&&(t=t.slice(0,o)));return t+r},Wt.unescape=function(n){return(n=e(n))&&st.test(n)?n.replace(ct,d):n},Wt.uniqueId=function(n){var t=++Fu;return e(n)+t},Wt.words=pu,Wt.all=Ee,Wt.any=Fe,Wt.contains=ke,Wt.detect=Ie,Wt.foldl=Se,Wt.foldr=We,Wt.head=ye,Wt.include=ke,Wt.inject=Se,du(Wt,function(){var n={};return _r(Wt,function(t,r){Wt.prototype[r]||(n[r]=t)}),n}(),false),Wt.sample=Ne,Wt.prototype.sample=function(n){return this.__chain__||null!=n?this.thru(function(t){return Ne(t,n)
|
79
|
+
}):Ne(this.value())},Wt.VERSION=b,Mt("bind bindKey curry curryRight partial partialRight".split(" "),function(n){Wt[n].placeholder=Wt}),Mt(["filter","map","takeWhile"],function(n,t){var r=t==U,e=t==L;Ut.prototype[n]=function(n,u){var o=this.clone(),i=o.__filtered__,f=o.__iteratees__||(o.__iteratees__=[]);return o.__filtered__=i||r||e&&0>o.__dir__,f.push({iteratee:Hr(n,u,3),type:t}),o}}),Mt(["drop","take"],function(n,t){var r="__"+n+"Count__",e=n+"While";Ut.prototype[n]=function(e){e=null==e?1:uo(Pu(e)||0,0);
|
80
|
+
var u=this.clone();if(u.__filtered__){var o=u[r];u[r]=t?oo(o,e):o+e}else(u.__views__||(u.__views__=[])).push({size:e,type:n+(0>u.__dir__?"Right":"")});return u},Ut.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()},Ut.prototype[n+"RightWhile"]=function(n,t){return this.reverse()[e](n,t).reverse()}}),Mt(["first","last"],function(n,t){var r="take"+(t?"Right":"");Ut.prototype[n]=function(){return this[r](1).value()[0]}}),Mt(["initial","rest"],function(n,t){var r="drop"+(t?"":"Right");
|
81
|
+
Ut.prototype[n]=function(){return this[r](1)}}),Mt(["pluck","where"],function(n,t){var r=t?"filter":"map",e=t?br:jr;Ut.prototype[n]=function(n){return this[r](e(n))}}),Ut.prototype.compact=function(){return this.filter(vu)},Ut.prototype.dropWhile=function(n,t){var r;return n=Hr(n,t,3),this.filter(function(t,e,u){return r||(r=!n(t,e,u))})},Ut.prototype.reject=function(n,t){return n=Hr(n,t,3),this.filter(function(t,r,e){return!n(t,r,e)})},Ut.prototype.slice=function(n,t){n=null==n?0:+n||0;var r=0>n?this.takeRight(-n):this.drop(n);
|
82
|
+
return typeof t!="undefined"&&(t=+t||0,r=0>t?r.dropRight(-t):r.take(t-n)),r},Ut.prototype.toArray=function(){return this.drop(0)},_r(Ut.prototype,function(n,t){var r=Wt[t],e=/^(?:first|last)$/.test(t);Wt.prototype[t]=function(){function t(n){return n=[n],Vu.apply(n,o),r.apply(Wt,n)}var u=this.__wrapped__,o=arguments,i=this.__chain__,f=!!this.__actions__.length,a=u instanceof Ut,c=a&&!f;return e&&!i?c?n.call(u):r.call(Wt,this.value()):a||So(u)?(u=n.apply(c?u:new Ut(this),o),e||!f&&!u.__actions__||(u.__actions__||(u.__actions__=[])).push({func:je,args:[t],thisArg:Wt}),new Nt(u,i)):this.thru(t)
|
83
|
+
}}),Mt("concat join pop push shift sort splice unshift".split(" "),function(n){var t=Cu[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:join|pop|shift)$/.test(n);Wt.prototype[n]=function(){var n=arguments;return e&&!this.__chain__?t.apply(this.value(),n):this[r](function(r){return t.apply(r,n)})}}),Ut.prototype.clone=function(){var n=this.__actions__,t=this.__iteratees__,r=this.__views__,e=new Ut(this.__wrapped__);return e.__actions__=n?zt(n):null,e.__dir__=this.__dir__,e.__dropCount__=this.__dropCount__,e.__filtered__=this.__filtered__,e.__iteratees__=t?zt(t):null,e.__takeCount__=this.__takeCount__,e.__views__=r?zt(r):null,e
|
84
|
+
},Ut.prototype.reverse=function(){if(this.__filtered__){var n=new Ut(this);n.__dir__=-1,n.__filtered__=true}else n=this.clone(),n.__dir__*=-1;return n},Ut.prototype.value=function(){var n=this.__wrapped__.value();if(!So(n))return Tr(n,this.__actions__);var t,r=this.__dir__,e=0>r;t=n.length;for(var u=this.__views__,o=0,i=-1,f=u?u.length:0;++i<f;){var a=u[i],c=a.size;switch(a.type){case"drop":o+=c;break;case"dropRight":t-=c;break;case"take":t=oo(t,o+c);break;case"takeRight":o=uo(o,t-c)}}t={start:o,end:t},i=t.start,f=t.end,t=f-i,u=this.__dropCount__,o=oo(t,this.__takeCount__),e=e?f:i-1,f=(i=this.__iteratees__)?i.length:0,a=0,c=[];
|
85
|
+
n:for(;t--&&a<o;){for(var e=e+r,l=-1,s=n[e];++l<f;){var p=i[l],h=p.iteratee(s,e,n),p=p.type;if(p==F)s=h;else if(!h){if(p==U)continue n;break n}}u?u--:c[a++]=s}return c},Wt.prototype.chain=function(){return Ae(this)},Wt.prototype.commit=function(){return new Nt(this.value(),this.__chain__)},Wt.prototype.plant=function(n){for(var t,r=this;r instanceof Nt;){var e=he(r);t?u.__wrapped__=e:t=e;var u=e,r=r.__wrapped__}return u.__wrapped__=n,t},Wt.prototype.reverse=function(){var n=this.__wrapped__;return n instanceof Ut?(this.__actions__.length&&(n=new Ut(this)),new Nt(n.reverse(),this.__chain__)):this.thru(function(n){return n.reverse()
|
86
|
+
})},Wt.prototype.toString=function(){return this.value()+""},Wt.prototype.run=Wt.prototype.toJSON=Wt.prototype.valueOf=Wt.prototype.value=function(){return Tr(this.__wrapped__,this.__actions__)},Wt.prototype.collect=Wt.prototype.map,Wt.prototype.head=Wt.prototype.first,Wt.prototype.select=Wt.prototype.filter,Wt.prototype.tail=Wt.prototype.rest,Wt}var w,b="3.2.0",x=1,A=2,j=4,k=8,E=16,R=32,I=64,O=128,C=256,T=30,S="...",W=150,N=16,U=0,F=1,L=2,$="Expected a function",B="__lodash_placeholder__",z="[object Arguments]",D="[object Array]",M="[object Boolean]",q="[object Date]",P="[object Error]",K="[object Function]",V="[object Number]",Y="[object Object]",Z="[object RegExp]",G="[object String]",J="[object ArrayBuffer]",X="[object Float32Array]",H="[object Float64Array]",Q="[object Int8Array]",nt="[object Int16Array]",tt="[object Int32Array]",rt="[object Uint8Array]",et="[object Uint8ClampedArray]",ut="[object Uint16Array]",ot="[object Uint32Array]",it=/\b__p\+='';/g,ft=/\b(__p\+=)''\+/g,at=/(__e\(.*?\)|\b__t\))\+'';/g,ct=/&(?:amp|lt|gt|quot|#39|#96);/g,lt=/[&<>"'`]/g,st=RegExp(ct.source),pt=RegExp(lt.source),ht=/<%-([\s\S]+?)%>/g,_t=/<%([\s\S]+?)%>/g,gt=/<%=([\s\S]+?)%>/g,vt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,dt=/^\s*function[ \n\r\t]+\w/,mt=/^0[xX]/,wt=/^\[object .+?Constructor\]$/,bt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,xt=/($^)/,At=/[.*+?^${}()|[\]\/\\]/g,jt=RegExp(At.source),kt=/\bthis\b/,Et=/['\n\r\u2028\u2029\\]/g,Rt=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]{2,}(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),It=" \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",Ot="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout document isFinite parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap window WinRTError".split(" "),Ct={};
|
87
|
+
Ct[X]=Ct[H]=Ct[Q]=Ct[nt]=Ct[tt]=Ct[rt]=Ct[et]=Ct[ut]=Ct[ot]=true,Ct[z]=Ct[D]=Ct[J]=Ct[M]=Ct[q]=Ct[P]=Ct[K]=Ct["[object Map]"]=Ct[V]=Ct[Y]=Ct[Z]=Ct["[object Set]"]=Ct[G]=Ct["[object WeakMap]"]=false;var Tt={};Tt[z]=Tt[D]=Tt[J]=Tt[M]=Tt[q]=Tt[X]=Tt[H]=Tt[Q]=Tt[nt]=Tt[tt]=Tt[V]=Tt[Y]=Tt[Z]=Tt[G]=Tt[rt]=Tt[et]=Tt[ut]=Tt[ot]=true,Tt[P]=Tt[K]=Tt["[object Map]"]=Tt["[object Set]"]=Tt["[object WeakMap]"]=false;var St={leading:false,maxWait:0,trailing:false},Wt={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss"},Nt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ut={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ft={"function":true,object:true},Lt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$t=Ft[typeof window]&&window!==(this&&this.window)?window:this,Bt=Ft[typeof exports]&&exports&&!exports.nodeType&&exports,Ft=Ft[typeof module]&&module&&!module.nodeType&&module,zt=Bt&&Ft&&typeof global=="object"&&global;
|
88
|
+
!zt||zt.global!==zt&&zt.window!==zt&&zt.self!==zt||($t=zt);var zt=Ft&&Ft.exports===Bt&&Bt,Dt=m();typeof define=="function"&&typeof define.amd=="object"&&define.amd?($t._=Dt, define(function(){return Dt})):Bt&&Ft?zt?(Ft.exports=Dt)._=Dt:Bt._=Dt:$t._=Dt}).call(this);
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*!
|
2
|
+
* @preserve
|
3
|
+
*
|
4
|
+
* Readmore.js jQuery plugin
|
5
|
+
* Author: @jed_foster
|
6
|
+
* Project home: http://jedfoster.github.io/Readmore.js
|
7
|
+
* Licensed under the MIT license
|
8
|
+
*
|
9
|
+
* Debounce function from http://davidwalsh.name/javascript-debounce-function
|
10
|
+
*/
|
11
|
+
!function(e){"use strict";function t(e,t,a){var i;return function(){var n=this,o=arguments,r=function(){i=null,a||e.apply(n,o)},s=a&&!i;clearTimeout(i),i=setTimeout(r,t),s&&e.apply(n,o)}}function a(e){var t=++h;return String(null==e?"rmjs-":e)+t}function i(e){var t=e.clone().css({height:"auto",width:e.width(),maxHeight:"none",overflow:"hidden"}).insertAfter(e),a=t.outerHeight(),i=parseInt(t.css({maxHeight:""}).css("max-height").replace(/[^-\d\.]/g,""),10),n=e.data("defaultHeight");t.remove();var o=i||e.data("collapsedHeight")||n;e.data({expandedHeight:a,maxHeight:i,collapsedHeight:o}).css({maxHeight:"none"})}function n(e){if(!d[e.selector]){var t=" ";e.embedCSS&&""!==e.blockCSS&&(t+=e.selector+" + [data-readmore-toggle], "+e.selector+"[data-readmore]{"+e.blockCSS+"}"),t+=e.selector+"[data-readmore]{transition: height "+e.speed+"ms;overflow: hidden;}",function(e,t){var a=e.createElement("style");a.type="text/css",a.styleSheet?a.styleSheet.cssText=t:a.appendChild(e.createTextNode(t)),e.getElementsByTagName("head")[0].appendChild(a)}(document,t),d[e.selector]=!0}}function o(t,a){this.element=t,this.options=e.extend({},s,a),n(this.options),this._defaults=s,this._name=r,this.init(),window.addEventListener?(window.addEventListener("load",l),window.addEventListener("resize",l)):(window.attachEvent("load",l),window.attachEvent("resize",l))}var r="readmore",s={speed:100,collapsedHeight:200,heightMargin:16,moreLink:'<a href="#">Read More</a>',lessLink:'<a href="#">Close</a>',embedCSS:!0,blockCSS:"display: block; width: 100%;",startOpen:!1,beforeToggle:function(){},afterToggle:function(){}},d={},h=0,l=t(function(){e("[data-readmore]").each(function(){var t=e(this),a="true"===t.attr("aria-expanded");i(t),t.css({height:t.data(a?"expandedHeight":"collapsedHeight")})})},100);o.prototype={init:function(){var t=this,n=e(this.element);n.data({defaultHeight:this.options.collapsedHeight,heightMargin:this.options.heightMargin}),i(n);var o=n.data("collapsedHeight"),r=n.data("heightMargin");if(n.outerHeight(!0)<=o+r)return!0;var s=n.attr("id")||a(),d=t.options.startOpen?t.options.lessLink:t.options.moreLink;n.attr({"data-readmore":"","aria-expanded":!1,id:s}),n.after(e(d).on("click",function(e){t.toggle(this,n[0],e)}).attr({"data-readmore-toggle":"","aria-controls":s})),t.options.startOpen||n.css({height:o})},toggle:function(t,a,i){i&&i.preventDefault(),t||(t=e('[aria-controls="'+this.element.id+'"]')[0]),a||(a=this.element);var n=this,o=e(a),r="",s="",d=!1,h=o.data("collapsedHeight");o.height()<=h?(r=o.data("expandedHeight")+"px",s="lessLink",d=!0):(r=h,s="moreLink"),n.options.beforeToggle(t,a,!d),o.css({height:r}),o.on("transitionend",function(){n.options.afterToggle(t,a,d),e(this).attr({"aria-expanded":d}).off("transitionend")}),e(t).replaceWith(e(n.options[s]).on("click",function(e){n.toggle(this,a,e)}).attr({"data-readmore-toggle":"","aria-controls":o.attr("id")}))},destroy:function(){e(this.element).each(function(){var t=e(this);t.attr({"data-readmore":null,"aria-expanded":null}).css({maxHeight:"",height:""}).next("[data-readmore-toggle]").remove(),t.removeData()})}},e.fn.readmore=function(t){var a=arguments,i=this.selector;return t=t||{},"object"==typeof t?this.each(function(){if(e.data(this,"plugin_"+r)){var a=e.data(this,"plugin_"+r);a.destroy.apply(a)}t.selector=i,e.data(this,"plugin_"+r,new o(this,t))}):"string"==typeof t&&"_"!==t[0]&&"init"!==t?this.each(function(){var i=e.data(this,"plugin_"+r);i instanceof o&&"function"==typeof i[t]&&i[t].apply(i,Array.prototype.slice.call(a,1))}):void 0}}(jQuery);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
jQuery(document).ready(function($) {
|
2
|
+
|
3
|
+
|
4
|
+
/* Logic to toggle the top menu icon and
|
5
|
+
/* mobile navigation menu */
|
6
|
+
|
7
|
+
$('.mobile-menu-button').click(function(e) {
|
8
|
+
$('.menu-icon').toggleClass('menu-icon-active');
|
9
|
+
$('.mobile-navigation').toggleClass('active');
|
10
|
+
});
|
11
|
+
|
12
|
+
/* implementation of the read more plugin */
|
13
|
+
|
14
|
+
$('.event-long-description').readmore({
|
15
|
+
speed: 75,
|
16
|
+
// TODO: make sure this isn't covering things up, but a good enough implementation for now
|
17
|
+
maxHeight: 184,
|
18
|
+
heightMargin: 36
|
19
|
+
});
|
20
|
+
|
21
|
+
|
22
|
+
});
|
@@ -0,0 +1,1545 @@
|
|
1
|
+
// Underscore.js 1.8.2
|
2
|
+
// http://underscorejs.org
|
3
|
+
// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
4
|
+
// Underscore may be freely distributed under the MIT license.
|
5
|
+
|
6
|
+
(function() {
|
7
|
+
|
8
|
+
// Baseline setup
|
9
|
+
// --------------
|
10
|
+
|
11
|
+
// Establish the root object, `window` in the browser, or `exports` on the server.
|
12
|
+
var root = this;
|
13
|
+
|
14
|
+
// Save the previous value of the `_` variable.
|
15
|
+
var previousUnderscore = root._;
|
16
|
+
|
17
|
+
// Save bytes in the minified (but not gzipped) version:
|
18
|
+
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
|
19
|
+
|
20
|
+
// Create quick reference variables for speed access to core prototypes.
|
21
|
+
var
|
22
|
+
push = ArrayProto.push,
|
23
|
+
slice = ArrayProto.slice,
|
24
|
+
toString = ObjProto.toString,
|
25
|
+
hasOwnProperty = ObjProto.hasOwnProperty;
|
26
|
+
|
27
|
+
// All **ECMAScript 5** native function implementations that we hope to use
|
28
|
+
// are declared here.
|
29
|
+
var
|
30
|
+
nativeIsArray = Array.isArray,
|
31
|
+
nativeKeys = Object.keys,
|
32
|
+
nativeBind = FuncProto.bind,
|
33
|
+
nativeCreate = Object.create;
|
34
|
+
|
35
|
+
// Naked function reference for surrogate-prototype-swapping.
|
36
|
+
var Ctor = function(){};
|
37
|
+
|
38
|
+
// Create a safe reference to the Underscore object for use below.
|
39
|
+
var _ = function(obj) {
|
40
|
+
if (obj instanceof _) return obj;
|
41
|
+
if (!(this instanceof _)) return new _(obj);
|
42
|
+
this._wrapped = obj;
|
43
|
+
};
|
44
|
+
|
45
|
+
// Export the Underscore object for **Node.js**, with
|
46
|
+
// backwards-compatibility for the old `require()` API. If we're in
|
47
|
+
// the browser, add `_` as a global object.
|
48
|
+
if (typeof exports !== 'undefined') {
|
49
|
+
if (typeof module !== 'undefined' && module.exports) {
|
50
|
+
exports = module.exports = _;
|
51
|
+
}
|
52
|
+
exports._ = _;
|
53
|
+
} else {
|
54
|
+
root._ = _;
|
55
|
+
}
|
56
|
+
|
57
|
+
// Current version.
|
58
|
+
_.VERSION = '1.8.2';
|
59
|
+
|
60
|
+
// Internal function that returns an efficient (for current engines) version
|
61
|
+
// of the passed-in callback, to be repeatedly applied in other Underscore
|
62
|
+
// functions.
|
63
|
+
var optimizeCb = function(func, context, argCount) {
|
64
|
+
if (context === void 0) return func;
|
65
|
+
switch (argCount == null ? 3 : argCount) {
|
66
|
+
case 1: return function(value) {
|
67
|
+
return func.call(context, value);
|
68
|
+
};
|
69
|
+
case 2: return function(value, other) {
|
70
|
+
return func.call(context, value, other);
|
71
|
+
};
|
72
|
+
case 3: return function(value, index, collection) {
|
73
|
+
return func.call(context, value, index, collection);
|
74
|
+
};
|
75
|
+
case 4: return function(accumulator, value, index, collection) {
|
76
|
+
return func.call(context, accumulator, value, index, collection);
|
77
|
+
};
|
78
|
+
}
|
79
|
+
return function() {
|
80
|
+
return func.apply(context, arguments);
|
81
|
+
};
|
82
|
+
};
|
83
|
+
|
84
|
+
// A mostly-internal function to generate callbacks that can be applied
|
85
|
+
// to each element in a collection, returning the desired result — either
|
86
|
+
// identity, an arbitrary callback, a property matcher, or a property accessor.
|
87
|
+
var cb = function(value, context, argCount) {
|
88
|
+
if (value == null) return _.identity;
|
89
|
+
if (_.isFunction(value)) return optimizeCb(value, context, argCount);
|
90
|
+
if (_.isObject(value)) return _.matcher(value);
|
91
|
+
return _.property(value);
|
92
|
+
};
|
93
|
+
_.iteratee = function(value, context) {
|
94
|
+
return cb(value, context, Infinity);
|
95
|
+
};
|
96
|
+
|
97
|
+
// An internal function for creating assigner functions.
|
98
|
+
var createAssigner = function(keysFunc, undefinedOnly) {
|
99
|
+
return function(obj) {
|
100
|
+
var length = arguments.length;
|
101
|
+
if (length < 2 || obj == null) return obj;
|
102
|
+
for (var index = 1; index < length; index++) {
|
103
|
+
var source = arguments[index],
|
104
|
+
keys = keysFunc(source),
|
105
|
+
l = keys.length;
|
106
|
+
for (var i = 0; i < l; i++) {
|
107
|
+
var key = keys[i];
|
108
|
+
if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
|
109
|
+
}
|
110
|
+
}
|
111
|
+
return obj;
|
112
|
+
};
|
113
|
+
};
|
114
|
+
|
115
|
+
// An internal function for creating a new object that inherits from another.
|
116
|
+
var baseCreate = function(prototype) {
|
117
|
+
if (!_.isObject(prototype)) return {};
|
118
|
+
if (nativeCreate) return nativeCreate(prototype);
|
119
|
+
Ctor.prototype = prototype;
|
120
|
+
var result = new Ctor;
|
121
|
+
Ctor.prototype = null;
|
122
|
+
return result;
|
123
|
+
};
|
124
|
+
|
125
|
+
// Helper for collection methods to determine whether a collection
|
126
|
+
// should be iterated as an array or as an object
|
127
|
+
// Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
|
128
|
+
var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
|
129
|
+
var isArrayLike = function(collection) {
|
130
|
+
var length = collection != null && collection.length;
|
131
|
+
return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
|
132
|
+
};
|
133
|
+
|
134
|
+
// Collection Functions
|
135
|
+
// --------------------
|
136
|
+
|
137
|
+
// The cornerstone, an `each` implementation, aka `forEach`.
|
138
|
+
// Handles raw objects in addition to array-likes. Treats all
|
139
|
+
// sparse array-likes as if they were dense.
|
140
|
+
_.each = _.forEach = function(obj, iteratee, context) {
|
141
|
+
iteratee = optimizeCb(iteratee, context);
|
142
|
+
var i, length;
|
143
|
+
if (isArrayLike(obj)) {
|
144
|
+
for (i = 0, length = obj.length; i < length; i++) {
|
145
|
+
iteratee(obj[i], i, obj);
|
146
|
+
}
|
147
|
+
} else {
|
148
|
+
var keys = _.keys(obj);
|
149
|
+
for (i = 0, length = keys.length; i < length; i++) {
|
150
|
+
iteratee(obj[keys[i]], keys[i], obj);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
return obj;
|
154
|
+
};
|
155
|
+
|
156
|
+
// Return the results of applying the iteratee to each element.
|
157
|
+
_.map = _.collect = function(obj, iteratee, context) {
|
158
|
+
iteratee = cb(iteratee, context);
|
159
|
+
var keys = !isArrayLike(obj) && _.keys(obj),
|
160
|
+
length = (keys || obj).length,
|
161
|
+
results = Array(length);
|
162
|
+
for (var index = 0; index < length; index++) {
|
163
|
+
var currentKey = keys ? keys[index] : index;
|
164
|
+
results[index] = iteratee(obj[currentKey], currentKey, obj);
|
165
|
+
}
|
166
|
+
return results;
|
167
|
+
};
|
168
|
+
|
169
|
+
// Create a reducing function iterating left or right.
|
170
|
+
function createReduce(dir) {
|
171
|
+
// Optimized iterator function as using arguments.length
|
172
|
+
// in the main function will deoptimize the, see #1991.
|
173
|
+
function iterator(obj, iteratee, memo, keys, index, length) {
|
174
|
+
for (; index >= 0 && index < length; index += dir) {
|
175
|
+
var currentKey = keys ? keys[index] : index;
|
176
|
+
memo = iteratee(memo, obj[currentKey], currentKey, obj);
|
177
|
+
}
|
178
|
+
return memo;
|
179
|
+
}
|
180
|
+
|
181
|
+
return function(obj, iteratee, memo, context) {
|
182
|
+
iteratee = optimizeCb(iteratee, context, 4);
|
183
|
+
var keys = !isArrayLike(obj) && _.keys(obj),
|
184
|
+
length = (keys || obj).length,
|
185
|
+
index = dir > 0 ? 0 : length - 1;
|
186
|
+
// Determine the initial value if none is provided.
|
187
|
+
if (arguments.length < 3) {
|
188
|
+
memo = obj[keys ? keys[index] : index];
|
189
|
+
index += dir;
|
190
|
+
}
|
191
|
+
return iterator(obj, iteratee, memo, keys, index, length);
|
192
|
+
};
|
193
|
+
}
|
194
|
+
|
195
|
+
// **Reduce** builds up a single result from a list of values, aka `inject`,
|
196
|
+
// or `foldl`.
|
197
|
+
_.reduce = _.foldl = _.inject = createReduce(1);
|
198
|
+
|
199
|
+
// The right-associative version of reduce, also known as `foldr`.
|
200
|
+
_.reduceRight = _.foldr = createReduce(-1);
|
201
|
+
|
202
|
+
// Return the first value which passes a truth test. Aliased as `detect`.
|
203
|
+
_.find = _.detect = function(obj, predicate, context) {
|
204
|
+
var key;
|
205
|
+
if (isArrayLike(obj)) {
|
206
|
+
key = _.findIndex(obj, predicate, context);
|
207
|
+
} else {
|
208
|
+
key = _.findKey(obj, predicate, context);
|
209
|
+
}
|
210
|
+
if (key !== void 0 && key !== -1) return obj[key];
|
211
|
+
};
|
212
|
+
|
213
|
+
// Return all the elements that pass a truth test.
|
214
|
+
// Aliased as `select`.
|
215
|
+
_.filter = _.select = function(obj, predicate, context) {
|
216
|
+
var results = [];
|
217
|
+
predicate = cb(predicate, context);
|
218
|
+
_.each(obj, function(value, index, list) {
|
219
|
+
if (predicate(value, index, list)) results.push(value);
|
220
|
+
});
|
221
|
+
return results;
|
222
|
+
};
|
223
|
+
|
224
|
+
// Return all the elements for which a truth test fails.
|
225
|
+
_.reject = function(obj, predicate, context) {
|
226
|
+
return _.filter(obj, _.negate(cb(predicate)), context);
|
227
|
+
};
|
228
|
+
|
229
|
+
// Determine whether all of the elements match a truth test.
|
230
|
+
// Aliased as `all`.
|
231
|
+
_.every = _.all = function(obj, predicate, context) {
|
232
|
+
predicate = cb(predicate, context);
|
233
|
+
var keys = !isArrayLike(obj) && _.keys(obj),
|
234
|
+
length = (keys || obj).length;
|
235
|
+
for (var index = 0; index < length; index++) {
|
236
|
+
var currentKey = keys ? keys[index] : index;
|
237
|
+
if (!predicate(obj[currentKey], currentKey, obj)) return false;
|
238
|
+
}
|
239
|
+
return true;
|
240
|
+
};
|
241
|
+
|
242
|
+
// Determine if at least one element in the object matches a truth test.
|
243
|
+
// Aliased as `any`.
|
244
|
+
_.some = _.any = function(obj, predicate, context) {
|
245
|
+
predicate = cb(predicate, context);
|
246
|
+
var keys = !isArrayLike(obj) && _.keys(obj),
|
247
|
+
length = (keys || obj).length;
|
248
|
+
for (var index = 0; index < length; index++) {
|
249
|
+
var currentKey = keys ? keys[index] : index;
|
250
|
+
if (predicate(obj[currentKey], currentKey, obj)) return true;
|
251
|
+
}
|
252
|
+
return false;
|
253
|
+
};
|
254
|
+
|
255
|
+
// Determine if the array or object contains a given value (using `===`).
|
256
|
+
// Aliased as `includes` and `include`.
|
257
|
+
_.contains = _.includes = _.include = function(obj, target, fromIndex) {
|
258
|
+
if (!isArrayLike(obj)) obj = _.values(obj);
|
259
|
+
return _.indexOf(obj, target, typeof fromIndex == 'number' && fromIndex) >= 0;
|
260
|
+
};
|
261
|
+
|
262
|
+
// Invoke a method (with arguments) on every item in a collection.
|
263
|
+
_.invoke = function(obj, method) {
|
264
|
+
var args = slice.call(arguments, 2);
|
265
|
+
var isFunc = _.isFunction(method);
|
266
|
+
return _.map(obj, function(value) {
|
267
|
+
var func = isFunc ? method : value[method];
|
268
|
+
return func == null ? func : func.apply(value, args);
|
269
|
+
});
|
270
|
+
};
|
271
|
+
|
272
|
+
// Convenience version of a common use case of `map`: fetching a property.
|
273
|
+
_.pluck = function(obj, key) {
|
274
|
+
return _.map(obj, _.property(key));
|
275
|
+
};
|
276
|
+
|
277
|
+
// Convenience version of a common use case of `filter`: selecting only objects
|
278
|
+
// containing specific `key:value` pairs.
|
279
|
+
_.where = function(obj, attrs) {
|
280
|
+
return _.filter(obj, _.matcher(attrs));
|
281
|
+
};
|
282
|
+
|
283
|
+
// Convenience version of a common use case of `find`: getting the first object
|
284
|
+
// containing specific `key:value` pairs.
|
285
|
+
_.findWhere = function(obj, attrs) {
|
286
|
+
return _.find(obj, _.matcher(attrs));
|
287
|
+
};
|
288
|
+
|
289
|
+
// Return the maximum element (or element-based computation).
|
290
|
+
_.max = function(obj, iteratee, context) {
|
291
|
+
var result = -Infinity, lastComputed = -Infinity,
|
292
|
+
value, computed;
|
293
|
+
if (iteratee == null && obj != null) {
|
294
|
+
obj = isArrayLike(obj) ? obj : _.values(obj);
|
295
|
+
for (var i = 0, length = obj.length; i < length; i++) {
|
296
|
+
value = obj[i];
|
297
|
+
if (value > result) {
|
298
|
+
result = value;
|
299
|
+
}
|
300
|
+
}
|
301
|
+
} else {
|
302
|
+
iteratee = cb(iteratee, context);
|
303
|
+
_.each(obj, function(value, index, list) {
|
304
|
+
computed = iteratee(value, index, list);
|
305
|
+
if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
|
306
|
+
result = value;
|
307
|
+
lastComputed = computed;
|
308
|
+
}
|
309
|
+
});
|
310
|
+
}
|
311
|
+
return result;
|
312
|
+
};
|
313
|
+
|
314
|
+
// Return the minimum element (or element-based computation).
|
315
|
+
_.min = function(obj, iteratee, context) {
|
316
|
+
var result = Infinity, lastComputed = Infinity,
|
317
|
+
value, computed;
|
318
|
+
if (iteratee == null && obj != null) {
|
319
|
+
obj = isArrayLike(obj) ? obj : _.values(obj);
|
320
|
+
for (var i = 0, length = obj.length; i < length; i++) {
|
321
|
+
value = obj[i];
|
322
|
+
if (value < result) {
|
323
|
+
result = value;
|
324
|
+
}
|
325
|
+
}
|
326
|
+
} else {
|
327
|
+
iteratee = cb(iteratee, context);
|
328
|
+
_.each(obj, function(value, index, list) {
|
329
|
+
computed = iteratee(value, index, list);
|
330
|
+
if (computed < lastComputed || computed === Infinity && result === Infinity) {
|
331
|
+
result = value;
|
332
|
+
lastComputed = computed;
|
333
|
+
}
|
334
|
+
});
|
335
|
+
}
|
336
|
+
return result;
|
337
|
+
};
|
338
|
+
|
339
|
+
// Shuffle a collection, using the modern version of the
|
340
|
+
// [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
|
341
|
+
_.shuffle = function(obj) {
|
342
|
+
var set = isArrayLike(obj) ? obj : _.values(obj);
|
343
|
+
var length = set.length;
|
344
|
+
var shuffled = Array(length);
|
345
|
+
for (var index = 0, rand; index < length; index++) {
|
346
|
+
rand = _.random(0, index);
|
347
|
+
if (rand !== index) shuffled[index] = shuffled[rand];
|
348
|
+
shuffled[rand] = set[index];
|
349
|
+
}
|
350
|
+
return shuffled;
|
351
|
+
};
|
352
|
+
|
353
|
+
// Sample **n** random values from a collection.
|
354
|
+
// If **n** is not specified, returns a single random element.
|
355
|
+
// The internal `guard` argument allows it to work with `map`.
|
356
|
+
_.sample = function(obj, n, guard) {
|
357
|
+
if (n == null || guard) {
|
358
|
+
if (!isArrayLike(obj)) obj = _.values(obj);
|
359
|
+
return obj[_.random(obj.length - 1)];
|
360
|
+
}
|
361
|
+
return _.shuffle(obj).slice(0, Math.max(0, n));
|
362
|
+
};
|
363
|
+
|
364
|
+
// Sort the object's values by a criterion produced by an iteratee.
|
365
|
+
_.sortBy = function(obj, iteratee, context) {
|
366
|
+
iteratee = cb(iteratee, context);
|
367
|
+
return _.pluck(_.map(obj, function(value, index, list) {
|
368
|
+
return {
|
369
|
+
value: value,
|
370
|
+
index: index,
|
371
|
+
criteria: iteratee(value, index, list)
|
372
|
+
};
|
373
|
+
}).sort(function(left, right) {
|
374
|
+
var a = left.criteria;
|
375
|
+
var b = right.criteria;
|
376
|
+
if (a !== b) {
|
377
|
+
if (a > b || a === void 0) return 1;
|
378
|
+
if (a < b || b === void 0) return -1;
|
379
|
+
}
|
380
|
+
return left.index - right.index;
|
381
|
+
}), 'value');
|
382
|
+
};
|
383
|
+
|
384
|
+
// An internal function used for aggregate "group by" operations.
|
385
|
+
var group = function(behavior) {
|
386
|
+
return function(obj, iteratee, context) {
|
387
|
+
var result = {};
|
388
|
+
iteratee = cb(iteratee, context);
|
389
|
+
_.each(obj, function(value, index) {
|
390
|
+
var key = iteratee(value, index, obj);
|
391
|
+
behavior(result, value, key);
|
392
|
+
});
|
393
|
+
return result;
|
394
|
+
};
|
395
|
+
};
|
396
|
+
|
397
|
+
// Groups the object's values by a criterion. Pass either a string attribute
|
398
|
+
// to group by, or a function that returns the criterion.
|
399
|
+
_.groupBy = group(function(result, value, key) {
|
400
|
+
if (_.has(result, key)) result[key].push(value); else result[key] = [value];
|
401
|
+
});
|
402
|
+
|
403
|
+
// Indexes the object's values by a criterion, similar to `groupBy`, but for
|
404
|
+
// when you know that your index values will be unique.
|
405
|
+
_.indexBy = group(function(result, value, key) {
|
406
|
+
result[key] = value;
|
407
|
+
});
|
408
|
+
|
409
|
+
// Counts instances of an object that group by a certain criterion. Pass
|
410
|
+
// either a string attribute to count by, or a function that returns the
|
411
|
+
// criterion.
|
412
|
+
_.countBy = group(function(result, value, key) {
|
413
|
+
if (_.has(result, key)) result[key]++; else result[key] = 1;
|
414
|
+
});
|
415
|
+
|
416
|
+
// Safely create a real, live array from anything iterable.
|
417
|
+
_.toArray = function(obj) {
|
418
|
+
if (!obj) return [];
|
419
|
+
if (_.isArray(obj)) return slice.call(obj);
|
420
|
+
if (isArrayLike(obj)) return _.map(obj, _.identity);
|
421
|
+
return _.values(obj);
|
422
|
+
};
|
423
|
+
|
424
|
+
// Return the number of elements in an object.
|
425
|
+
_.size = function(obj) {
|
426
|
+
if (obj == null) return 0;
|
427
|
+
return isArrayLike(obj) ? obj.length : _.keys(obj).length;
|
428
|
+
};
|
429
|
+
|
430
|
+
// Split a collection into two arrays: one whose elements all satisfy the given
|
431
|
+
// predicate, and one whose elements all do not satisfy the predicate.
|
432
|
+
_.partition = function(obj, predicate, context) {
|
433
|
+
predicate = cb(predicate, context);
|
434
|
+
var pass = [], fail = [];
|
435
|
+
_.each(obj, function(value, key, obj) {
|
436
|
+
(predicate(value, key, obj) ? pass : fail).push(value);
|
437
|
+
});
|
438
|
+
return [pass, fail];
|
439
|
+
};
|
440
|
+
|
441
|
+
// Array Functions
|
442
|
+
// ---------------
|
443
|
+
|
444
|
+
// Get the first element of an array. Passing **n** will return the first N
|
445
|
+
// values in the array. Aliased as `head` and `take`. The **guard** check
|
446
|
+
// allows it to work with `_.map`.
|
447
|
+
_.first = _.head = _.take = function(array, n, guard) {
|
448
|
+
if (array == null) return void 0;
|
449
|
+
if (n == null || guard) return array[0];
|
450
|
+
return _.initial(array, array.length - n);
|
451
|
+
};
|
452
|
+
|
453
|
+
// Returns everything but the last entry of the array. Especially useful on
|
454
|
+
// the arguments object. Passing **n** will return all the values in
|
455
|
+
// the array, excluding the last N.
|
456
|
+
_.initial = function(array, n, guard) {
|
457
|
+
return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
|
458
|
+
};
|
459
|
+
|
460
|
+
// Get the last element of an array. Passing **n** will return the last N
|
461
|
+
// values in the array.
|
462
|
+
_.last = function(array, n, guard) {
|
463
|
+
if (array == null) return void 0;
|
464
|
+
if (n == null || guard) return array[array.length - 1];
|
465
|
+
return _.rest(array, Math.max(0, array.length - n));
|
466
|
+
};
|
467
|
+
|
468
|
+
// Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
|
469
|
+
// Especially useful on the arguments object. Passing an **n** will return
|
470
|
+
// the rest N values in the array.
|
471
|
+
_.rest = _.tail = _.drop = function(array, n, guard) {
|
472
|
+
return slice.call(array, n == null || guard ? 1 : n);
|
473
|
+
};
|
474
|
+
|
475
|
+
// Trim out all falsy values from an array.
|
476
|
+
_.compact = function(array) {
|
477
|
+
return _.filter(array, _.identity);
|
478
|
+
};
|
479
|
+
|
480
|
+
// Internal implementation of a recursive `flatten` function.
|
481
|
+
var flatten = function(input, shallow, strict, startIndex) {
|
482
|
+
var output = [], idx = 0;
|
483
|
+
for (var i = startIndex || 0, length = input && input.length; i < length; i++) {
|
484
|
+
var value = input[i];
|
485
|
+
if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
|
486
|
+
//flatten current level of array or arguments object
|
487
|
+
if (!shallow) value = flatten(value, shallow, strict);
|
488
|
+
var j = 0, len = value.length;
|
489
|
+
output.length += len;
|
490
|
+
while (j < len) {
|
491
|
+
output[idx++] = value[j++];
|
492
|
+
}
|
493
|
+
} else if (!strict) {
|
494
|
+
output[idx++] = value;
|
495
|
+
}
|
496
|
+
}
|
497
|
+
return output;
|
498
|
+
};
|
499
|
+
|
500
|
+
// Flatten out an array, either recursively (by default), or just one level.
|
501
|
+
_.flatten = function(array, shallow) {
|
502
|
+
return flatten(array, shallow, false);
|
503
|
+
};
|
504
|
+
|
505
|
+
// Return a version of the array that does not contain the specified value(s).
|
506
|
+
_.without = function(array) {
|
507
|
+
return _.difference(array, slice.call(arguments, 1));
|
508
|
+
};
|
509
|
+
|
510
|
+
// Produce a duplicate-free version of the array. If the array has already
|
511
|
+
// been sorted, you have the option of using a faster algorithm.
|
512
|
+
// Aliased as `unique`.
|
513
|
+
_.uniq = _.unique = function(array, isSorted, iteratee, context) {
|
514
|
+
if (array == null) return [];
|
515
|
+
if (!_.isBoolean(isSorted)) {
|
516
|
+
context = iteratee;
|
517
|
+
iteratee = isSorted;
|
518
|
+
isSorted = false;
|
519
|
+
}
|
520
|
+
if (iteratee != null) iteratee = cb(iteratee, context);
|
521
|
+
var result = [];
|
522
|
+
var seen = [];
|
523
|
+
for (var i = 0, length = array.length; i < length; i++) {
|
524
|
+
var value = array[i],
|
525
|
+
computed = iteratee ? iteratee(value, i, array) : value;
|
526
|
+
if (isSorted) {
|
527
|
+
if (!i || seen !== computed) result.push(value);
|
528
|
+
seen = computed;
|
529
|
+
} else if (iteratee) {
|
530
|
+
if (!_.contains(seen, computed)) {
|
531
|
+
seen.push(computed);
|
532
|
+
result.push(value);
|
533
|
+
}
|
534
|
+
} else if (!_.contains(result, value)) {
|
535
|
+
result.push(value);
|
536
|
+
}
|
537
|
+
}
|
538
|
+
return result;
|
539
|
+
};
|
540
|
+
|
541
|
+
// Produce an array that contains the union: each distinct element from all of
|
542
|
+
// the passed-in arrays.
|
543
|
+
_.union = function() {
|
544
|
+
return _.uniq(flatten(arguments, true, true));
|
545
|
+
};
|
546
|
+
|
547
|
+
// Produce an array that contains every item shared between all the
|
548
|
+
// passed-in arrays.
|
549
|
+
_.intersection = function(array) {
|
550
|
+
if (array == null) return [];
|
551
|
+
var result = [];
|
552
|
+
var argsLength = arguments.length;
|
553
|
+
for (var i = 0, length = array.length; i < length; i++) {
|
554
|
+
var item = array[i];
|
555
|
+
if (_.contains(result, item)) continue;
|
556
|
+
for (var j = 1; j < argsLength; j++) {
|
557
|
+
if (!_.contains(arguments[j], item)) break;
|
558
|
+
}
|
559
|
+
if (j === argsLength) result.push(item);
|
560
|
+
}
|
561
|
+
return result;
|
562
|
+
};
|
563
|
+
|
564
|
+
// Take the difference between one array and a number of other arrays.
|
565
|
+
// Only the elements present in just the first array will remain.
|
566
|
+
_.difference = function(array) {
|
567
|
+
var rest = flatten(arguments, true, true, 1);
|
568
|
+
return _.filter(array, function(value){
|
569
|
+
return !_.contains(rest, value);
|
570
|
+
});
|
571
|
+
};
|
572
|
+
|
573
|
+
// Zip together multiple lists into a single array -- elements that share
|
574
|
+
// an index go together.
|
575
|
+
_.zip = function() {
|
576
|
+
return _.unzip(arguments);
|
577
|
+
};
|
578
|
+
|
579
|
+
// Complement of _.zip. Unzip accepts an array of arrays and groups
|
580
|
+
// each array's elements on shared indices
|
581
|
+
_.unzip = function(array) {
|
582
|
+
var length = array && _.max(array, 'length').length || 0;
|
583
|
+
var result = Array(length);
|
584
|
+
|
585
|
+
for (var index = 0; index < length; index++) {
|
586
|
+
result[index] = _.pluck(array, index);
|
587
|
+
}
|
588
|
+
return result;
|
589
|
+
};
|
590
|
+
|
591
|
+
// Converts lists into objects. Pass either a single array of `[key, value]`
|
592
|
+
// pairs, or two parallel arrays of the same length -- one of keys, and one of
|
593
|
+
// the corresponding values.
|
594
|
+
_.object = function(list, values) {
|
595
|
+
var result = {};
|
596
|
+
for (var i = 0, length = list && list.length; i < length; i++) {
|
597
|
+
if (values) {
|
598
|
+
result[list[i]] = values[i];
|
599
|
+
} else {
|
600
|
+
result[list[i][0]] = list[i][1];
|
601
|
+
}
|
602
|
+
}
|
603
|
+
return result;
|
604
|
+
};
|
605
|
+
|
606
|
+
// Return the position of the first occurrence of an item in an array,
|
607
|
+
// or -1 if the item is not included in the array.
|
608
|
+
// If the array is large and already in sort order, pass `true`
|
609
|
+
// for **isSorted** to use binary search.
|
610
|
+
_.indexOf = function(array, item, isSorted) {
|
611
|
+
var i = 0, length = array && array.length;
|
612
|
+
if (typeof isSorted == 'number') {
|
613
|
+
i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
|
614
|
+
} else if (isSorted && length) {
|
615
|
+
i = _.sortedIndex(array, item);
|
616
|
+
return array[i] === item ? i : -1;
|
617
|
+
}
|
618
|
+
if (item !== item) {
|
619
|
+
return _.findIndex(slice.call(array, i), _.isNaN);
|
620
|
+
}
|
621
|
+
for (; i < length; i++) if (array[i] === item) return i;
|
622
|
+
return -1;
|
623
|
+
};
|
624
|
+
|
625
|
+
_.lastIndexOf = function(array, item, from) {
|
626
|
+
var idx = array ? array.length : 0;
|
627
|
+
if (typeof from == 'number') {
|
628
|
+
idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1);
|
629
|
+
}
|
630
|
+
if (item !== item) {
|
631
|
+
return _.findLastIndex(slice.call(array, 0, idx), _.isNaN);
|
632
|
+
}
|
633
|
+
while (--idx >= 0) if (array[idx] === item) return idx;
|
634
|
+
return -1;
|
635
|
+
};
|
636
|
+
|
637
|
+
// Generator function to create the findIndex and findLastIndex functions
|
638
|
+
function createIndexFinder(dir) {
|
639
|
+
return function(array, predicate, context) {
|
640
|
+
predicate = cb(predicate, context);
|
641
|
+
var length = array != null && array.length;
|
642
|
+
var index = dir > 0 ? 0 : length - 1;
|
643
|
+
for (; index >= 0 && index < length; index += dir) {
|
644
|
+
if (predicate(array[index], index, array)) return index;
|
645
|
+
}
|
646
|
+
return -1;
|
647
|
+
};
|
648
|
+
}
|
649
|
+
|
650
|
+
// Returns the first index on an array-like that passes a predicate test
|
651
|
+
_.findIndex = createIndexFinder(1);
|
652
|
+
|
653
|
+
_.findLastIndex = createIndexFinder(-1);
|
654
|
+
|
655
|
+
// Use a comparator function to figure out the smallest index at which
|
656
|
+
// an object should be inserted so as to maintain order. Uses binary search.
|
657
|
+
_.sortedIndex = function(array, obj, iteratee, context) {
|
658
|
+
iteratee = cb(iteratee, context, 1);
|
659
|
+
var value = iteratee(obj);
|
660
|
+
var low = 0, high = array.length;
|
661
|
+
while (low < high) {
|
662
|
+
var mid = Math.floor((low + high) / 2);
|
663
|
+
if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
|
664
|
+
}
|
665
|
+
return low;
|
666
|
+
};
|
667
|
+
|
668
|
+
// Generate an integer Array containing an arithmetic progression. A port of
|
669
|
+
// the native Python `range()` function. See
|
670
|
+
// [the Python documentation](http://docs.python.org/library/functions.html#range).
|
671
|
+
_.range = function(start, stop, step) {
|
672
|
+
if (arguments.length <= 1) {
|
673
|
+
stop = start || 0;
|
674
|
+
start = 0;
|
675
|
+
}
|
676
|
+
step = step || 1;
|
677
|
+
|
678
|
+
var length = Math.max(Math.ceil((stop - start) / step), 0);
|
679
|
+
var range = Array(length);
|
680
|
+
|
681
|
+
for (var idx = 0; idx < length; idx++, start += step) {
|
682
|
+
range[idx] = start;
|
683
|
+
}
|
684
|
+
|
685
|
+
return range;
|
686
|
+
};
|
687
|
+
|
688
|
+
// Function (ahem) Functions
|
689
|
+
// ------------------
|
690
|
+
|
691
|
+
// Determines whether to execute a function as a constructor
|
692
|
+
// or a normal function with the provided arguments
|
693
|
+
var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {
|
694
|
+
if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
|
695
|
+
var self = baseCreate(sourceFunc.prototype);
|
696
|
+
var result = sourceFunc.apply(self, args);
|
697
|
+
if (_.isObject(result)) return result;
|
698
|
+
return self;
|
699
|
+
};
|
700
|
+
|
701
|
+
// Create a function bound to a given object (assigning `this`, and arguments,
|
702
|
+
// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
|
703
|
+
// available.
|
704
|
+
_.bind = function(func, context) {
|
705
|
+
if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
|
706
|
+
if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
|
707
|
+
var args = slice.call(arguments, 2);
|
708
|
+
var bound = function() {
|
709
|
+
return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));
|
710
|
+
};
|
711
|
+
return bound;
|
712
|
+
};
|
713
|
+
|
714
|
+
// Partially apply a function by creating a version that has had some of its
|
715
|
+
// arguments pre-filled, without changing its dynamic `this` context. _ acts
|
716
|
+
// as a placeholder, allowing any combination of arguments to be pre-filled.
|
717
|
+
_.partial = function(func) {
|
718
|
+
var boundArgs = slice.call(arguments, 1);
|
719
|
+
var bound = function() {
|
720
|
+
var position = 0, length = boundArgs.length;
|
721
|
+
var args = Array(length);
|
722
|
+
for (var i = 0; i < length; i++) {
|
723
|
+
args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];
|
724
|
+
}
|
725
|
+
while (position < arguments.length) args.push(arguments[position++]);
|
726
|
+
return executeBound(func, bound, this, this, args);
|
727
|
+
};
|
728
|
+
return bound;
|
729
|
+
};
|
730
|
+
|
731
|
+
// Bind a number of an object's methods to that object. Remaining arguments
|
732
|
+
// are the method names to be bound. Useful for ensuring that all callbacks
|
733
|
+
// defined on an object belong to it.
|
734
|
+
_.bindAll = function(obj) {
|
735
|
+
var i, length = arguments.length, key;
|
736
|
+
if (length <= 1) throw new Error('bindAll must be passed function names');
|
737
|
+
for (i = 1; i < length; i++) {
|
738
|
+
key = arguments[i];
|
739
|
+
obj[key] = _.bind(obj[key], obj);
|
740
|
+
}
|
741
|
+
return obj;
|
742
|
+
};
|
743
|
+
|
744
|
+
// Memoize an expensive function by storing its results.
|
745
|
+
_.memoize = function(func, hasher) {
|
746
|
+
var memoize = function(key) {
|
747
|
+
var cache = memoize.cache;
|
748
|
+
var address = '' + (hasher ? hasher.apply(this, arguments) : key);
|
749
|
+
if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
|
750
|
+
return cache[address];
|
751
|
+
};
|
752
|
+
memoize.cache = {};
|
753
|
+
return memoize;
|
754
|
+
};
|
755
|
+
|
756
|
+
// Delays a function for the given number of milliseconds, and then calls
|
757
|
+
// it with the arguments supplied.
|
758
|
+
_.delay = function(func, wait) {
|
759
|
+
var args = slice.call(arguments, 2);
|
760
|
+
return setTimeout(function(){
|
761
|
+
return func.apply(null, args);
|
762
|
+
}, wait);
|
763
|
+
};
|
764
|
+
|
765
|
+
// Defers a function, scheduling it to run after the current call stack has
|
766
|
+
// cleared.
|
767
|
+
_.defer = _.partial(_.delay, _, 1);
|
768
|
+
|
769
|
+
// Returns a function, that, when invoked, will only be triggered at most once
|
770
|
+
// during a given window of time. Normally, the throttled function will run
|
771
|
+
// as much as it can, without ever going more than once per `wait` duration;
|
772
|
+
// but if you'd like to disable the execution on the leading edge, pass
|
773
|
+
// `{leading: false}`. To disable execution on the trailing edge, ditto.
|
774
|
+
_.throttle = function(func, wait, options) {
|
775
|
+
var context, args, result;
|
776
|
+
var timeout = null;
|
777
|
+
var previous = 0;
|
778
|
+
if (!options) options = {};
|
779
|
+
var later = function() {
|
780
|
+
previous = options.leading === false ? 0 : _.now();
|
781
|
+
timeout = null;
|
782
|
+
result = func.apply(context, args);
|
783
|
+
if (!timeout) context = args = null;
|
784
|
+
};
|
785
|
+
return function() {
|
786
|
+
var now = _.now();
|
787
|
+
if (!previous && options.leading === false) previous = now;
|
788
|
+
var remaining = wait - (now - previous);
|
789
|
+
context = this;
|
790
|
+
args = arguments;
|
791
|
+
if (remaining <= 0 || remaining > wait) {
|
792
|
+
if (timeout) {
|
793
|
+
clearTimeout(timeout);
|
794
|
+
timeout = null;
|
795
|
+
}
|
796
|
+
previous = now;
|
797
|
+
result = func.apply(context, args);
|
798
|
+
if (!timeout) context = args = null;
|
799
|
+
} else if (!timeout && options.trailing !== false) {
|
800
|
+
timeout = setTimeout(later, remaining);
|
801
|
+
}
|
802
|
+
return result;
|
803
|
+
};
|
804
|
+
};
|
805
|
+
|
806
|
+
// Returns a function, that, as long as it continues to be invoked, will not
|
807
|
+
// be triggered. The function will be called after it stops being called for
|
808
|
+
// N milliseconds. If `immediate` is passed, trigger the function on the
|
809
|
+
// leading edge, instead of the trailing.
|
810
|
+
_.debounce = function(func, wait, immediate) {
|
811
|
+
var timeout, args, context, timestamp, result;
|
812
|
+
|
813
|
+
var later = function() {
|
814
|
+
var last = _.now() - timestamp;
|
815
|
+
|
816
|
+
if (last < wait && last >= 0) {
|
817
|
+
timeout = setTimeout(later, wait - last);
|
818
|
+
} else {
|
819
|
+
timeout = null;
|
820
|
+
if (!immediate) {
|
821
|
+
result = func.apply(context, args);
|
822
|
+
if (!timeout) context = args = null;
|
823
|
+
}
|
824
|
+
}
|
825
|
+
};
|
826
|
+
|
827
|
+
return function() {
|
828
|
+
context = this;
|
829
|
+
args = arguments;
|
830
|
+
timestamp = _.now();
|
831
|
+
var callNow = immediate && !timeout;
|
832
|
+
if (!timeout) timeout = setTimeout(later, wait);
|
833
|
+
if (callNow) {
|
834
|
+
result = func.apply(context, args);
|
835
|
+
context = args = null;
|
836
|
+
}
|
837
|
+
|
838
|
+
return result;
|
839
|
+
};
|
840
|
+
};
|
841
|
+
|
842
|
+
// Returns the first function passed as an argument to the second,
|
843
|
+
// allowing you to adjust arguments, run code before and after, and
|
844
|
+
// conditionally execute the original function.
|
845
|
+
_.wrap = function(func, wrapper) {
|
846
|
+
return _.partial(wrapper, func);
|
847
|
+
};
|
848
|
+
|
849
|
+
// Returns a negated version of the passed-in predicate.
|
850
|
+
_.negate = function(predicate) {
|
851
|
+
return function() {
|
852
|
+
return !predicate.apply(this, arguments);
|
853
|
+
};
|
854
|
+
};
|
855
|
+
|
856
|
+
// Returns a function that is the composition of a list of functions, each
|
857
|
+
// consuming the return value of the function that follows.
|
858
|
+
_.compose = function() {
|
859
|
+
var args = arguments;
|
860
|
+
var start = args.length - 1;
|
861
|
+
return function() {
|
862
|
+
var i = start;
|
863
|
+
var result = args[start].apply(this, arguments);
|
864
|
+
while (i--) result = args[i].call(this, result);
|
865
|
+
return result;
|
866
|
+
};
|
867
|
+
};
|
868
|
+
|
869
|
+
// Returns a function that will only be executed on and after the Nth call.
|
870
|
+
_.after = function(times, func) {
|
871
|
+
return function() {
|
872
|
+
if (--times < 1) {
|
873
|
+
return func.apply(this, arguments);
|
874
|
+
}
|
875
|
+
};
|
876
|
+
};
|
877
|
+
|
878
|
+
// Returns a function that will only be executed up to (but not including) the Nth call.
|
879
|
+
_.before = function(times, func) {
|
880
|
+
var memo;
|
881
|
+
return function() {
|
882
|
+
if (--times > 0) {
|
883
|
+
memo = func.apply(this, arguments);
|
884
|
+
}
|
885
|
+
if (times <= 1) func = null;
|
886
|
+
return memo;
|
887
|
+
};
|
888
|
+
};
|
889
|
+
|
890
|
+
// Returns a function that will be executed at most one time, no matter how
|
891
|
+
// often you call it. Useful for lazy initialization.
|
892
|
+
_.once = _.partial(_.before, 2);
|
893
|
+
|
894
|
+
// Object Functions
|
895
|
+
// ----------------
|
896
|
+
|
897
|
+
// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
|
898
|
+
var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
|
899
|
+
var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
|
900
|
+
'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];
|
901
|
+
|
902
|
+
function collectNonEnumProps(obj, keys) {
|
903
|
+
var nonEnumIdx = nonEnumerableProps.length;
|
904
|
+
var constructor = obj.constructor;
|
905
|
+
var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;
|
906
|
+
|
907
|
+
// Constructor is a special case.
|
908
|
+
var prop = 'constructor';
|
909
|
+
if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);
|
910
|
+
|
911
|
+
while (nonEnumIdx--) {
|
912
|
+
prop = nonEnumerableProps[nonEnumIdx];
|
913
|
+
if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
|
914
|
+
keys.push(prop);
|
915
|
+
}
|
916
|
+
}
|
917
|
+
}
|
918
|
+
|
919
|
+
// Retrieve the names of an object's own properties.
|
920
|
+
// Delegates to **ECMAScript 5**'s native `Object.keys`
|
921
|
+
_.keys = function(obj) {
|
922
|
+
if (!_.isObject(obj)) return [];
|
923
|
+
if (nativeKeys) return nativeKeys(obj);
|
924
|
+
var keys = [];
|
925
|
+
for (var key in obj) if (_.has(obj, key)) keys.push(key);
|
926
|
+
// Ahem, IE < 9.
|
927
|
+
if (hasEnumBug) collectNonEnumProps(obj, keys);
|
928
|
+
return keys;
|
929
|
+
};
|
930
|
+
|
931
|
+
// Retrieve all the property names of an object.
|
932
|
+
_.allKeys = function(obj) {
|
933
|
+
if (!_.isObject(obj)) return [];
|
934
|
+
var keys = [];
|
935
|
+
for (var key in obj) keys.push(key);
|
936
|
+
// Ahem, IE < 9.
|
937
|
+
if (hasEnumBug) collectNonEnumProps(obj, keys);
|
938
|
+
return keys;
|
939
|
+
};
|
940
|
+
|
941
|
+
// Retrieve the values of an object's properties.
|
942
|
+
_.values = function(obj) {
|
943
|
+
var keys = _.keys(obj);
|
944
|
+
var length = keys.length;
|
945
|
+
var values = Array(length);
|
946
|
+
for (var i = 0; i < length; i++) {
|
947
|
+
values[i] = obj[keys[i]];
|
948
|
+
}
|
949
|
+
return values;
|
950
|
+
};
|
951
|
+
|
952
|
+
// Returns the results of applying the iteratee to each element of the object
|
953
|
+
// In contrast to _.map it returns an object
|
954
|
+
_.mapObject = function(obj, iteratee, context) {
|
955
|
+
iteratee = cb(iteratee, context);
|
956
|
+
var keys = _.keys(obj),
|
957
|
+
length = keys.length,
|
958
|
+
results = {},
|
959
|
+
currentKey;
|
960
|
+
for (var index = 0; index < length; index++) {
|
961
|
+
currentKey = keys[index];
|
962
|
+
results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
|
963
|
+
}
|
964
|
+
return results;
|
965
|
+
};
|
966
|
+
|
967
|
+
// Convert an object into a list of `[key, value]` pairs.
|
968
|
+
_.pairs = function(obj) {
|
969
|
+
var keys = _.keys(obj);
|
970
|
+
var length = keys.length;
|
971
|
+
var pairs = Array(length);
|
972
|
+
for (var i = 0; i < length; i++) {
|
973
|
+
pairs[i] = [keys[i], obj[keys[i]]];
|
974
|
+
}
|
975
|
+
return pairs;
|
976
|
+
};
|
977
|
+
|
978
|
+
// Invert the keys and values of an object. The values must be serializable.
|
979
|
+
_.invert = function(obj) {
|
980
|
+
var result = {};
|
981
|
+
var keys = _.keys(obj);
|
982
|
+
for (var i = 0, length = keys.length; i < length; i++) {
|
983
|
+
result[obj[keys[i]]] = keys[i];
|
984
|
+
}
|
985
|
+
return result;
|
986
|
+
};
|
987
|
+
|
988
|
+
// Return a sorted list of the function names available on the object.
|
989
|
+
// Aliased as `methods`
|
990
|
+
_.functions = _.methods = function(obj) {
|
991
|
+
var names = [];
|
992
|
+
for (var key in obj) {
|
993
|
+
if (_.isFunction(obj[key])) names.push(key);
|
994
|
+
}
|
995
|
+
return names.sort();
|
996
|
+
};
|
997
|
+
|
998
|
+
// Extend a given object with all the properties in passed-in object(s).
|
999
|
+
_.extend = createAssigner(_.allKeys);
|
1000
|
+
|
1001
|
+
// Assigns a given object with all the own properties in the passed-in object(s)
|
1002
|
+
// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
|
1003
|
+
_.extendOwn = _.assign = createAssigner(_.keys);
|
1004
|
+
|
1005
|
+
// Returns the first key on an object that passes a predicate test
|
1006
|
+
_.findKey = function(obj, predicate, context) {
|
1007
|
+
predicate = cb(predicate, context);
|
1008
|
+
var keys = _.keys(obj), key;
|
1009
|
+
for (var i = 0, length = keys.length; i < length; i++) {
|
1010
|
+
key = keys[i];
|
1011
|
+
if (predicate(obj[key], key, obj)) return key;
|
1012
|
+
}
|
1013
|
+
};
|
1014
|
+
|
1015
|
+
// Return a copy of the object only containing the whitelisted properties.
|
1016
|
+
_.pick = function(object, oiteratee, context) {
|
1017
|
+
var result = {}, obj = object, iteratee, keys;
|
1018
|
+
if (obj == null) return result;
|
1019
|
+
if (_.isFunction(oiteratee)) {
|
1020
|
+
keys = _.allKeys(obj);
|
1021
|
+
iteratee = optimizeCb(oiteratee, context);
|
1022
|
+
} else {
|
1023
|
+
keys = flatten(arguments, false, false, 1);
|
1024
|
+
iteratee = function(value, key, obj) { return key in obj; };
|
1025
|
+
obj = Object(obj);
|
1026
|
+
}
|
1027
|
+
for (var i = 0, length = keys.length; i < length; i++) {
|
1028
|
+
var key = keys[i];
|
1029
|
+
var value = obj[key];
|
1030
|
+
if (iteratee(value, key, obj)) result[key] = value;
|
1031
|
+
}
|
1032
|
+
return result;
|
1033
|
+
};
|
1034
|
+
|
1035
|
+
// Return a copy of the object without the blacklisted properties.
|
1036
|
+
_.omit = function(obj, iteratee, context) {
|
1037
|
+
if (_.isFunction(iteratee)) {
|
1038
|
+
iteratee = _.negate(iteratee);
|
1039
|
+
} else {
|
1040
|
+
var keys = _.map(flatten(arguments, false, false, 1), String);
|
1041
|
+
iteratee = function(value, key) {
|
1042
|
+
return !_.contains(keys, key);
|
1043
|
+
};
|
1044
|
+
}
|
1045
|
+
return _.pick(obj, iteratee, context);
|
1046
|
+
};
|
1047
|
+
|
1048
|
+
// Fill in a given object with default properties.
|
1049
|
+
_.defaults = createAssigner(_.allKeys, true);
|
1050
|
+
|
1051
|
+
// Creates an object that inherits from the given prototype object.
|
1052
|
+
// If additional properties are provided then they will be added to the
|
1053
|
+
// created object.
|
1054
|
+
_.create = function(prototype, props) {
|
1055
|
+
var result = baseCreate(prototype);
|
1056
|
+
if (props) _.extendOwn(result, props);
|
1057
|
+
return result;
|
1058
|
+
};
|
1059
|
+
|
1060
|
+
// Create a (shallow-cloned) duplicate of an object.
|
1061
|
+
_.clone = function(obj) {
|
1062
|
+
if (!_.isObject(obj)) return obj;
|
1063
|
+
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
|
1064
|
+
};
|
1065
|
+
|
1066
|
+
// Invokes interceptor with the obj, and then returns obj.
|
1067
|
+
// The primary purpose of this method is to "tap into" a method chain, in
|
1068
|
+
// order to perform operations on intermediate results within the chain.
|
1069
|
+
_.tap = function(obj, interceptor) {
|
1070
|
+
interceptor(obj);
|
1071
|
+
return obj;
|
1072
|
+
};
|
1073
|
+
|
1074
|
+
// Returns whether an object has a given set of `key:value` pairs.
|
1075
|
+
_.isMatch = function(object, attrs) {
|
1076
|
+
var keys = _.keys(attrs), length = keys.length;
|
1077
|
+
if (object == null) return !length;
|
1078
|
+
var obj = Object(object);
|
1079
|
+
for (var i = 0; i < length; i++) {
|
1080
|
+
var key = keys[i];
|
1081
|
+
if (attrs[key] !== obj[key] || !(key in obj)) return false;
|
1082
|
+
}
|
1083
|
+
return true;
|
1084
|
+
};
|
1085
|
+
|
1086
|
+
|
1087
|
+
// Internal recursive comparison function for `isEqual`.
|
1088
|
+
var eq = function(a, b, aStack, bStack) {
|
1089
|
+
// Identical objects are equal. `0 === -0`, but they aren't identical.
|
1090
|
+
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
|
1091
|
+
if (a === b) return a !== 0 || 1 / a === 1 / b;
|
1092
|
+
// A strict comparison is necessary because `null == undefined`.
|
1093
|
+
if (a == null || b == null) return a === b;
|
1094
|
+
// Unwrap any wrapped objects.
|
1095
|
+
if (a instanceof _) a = a._wrapped;
|
1096
|
+
if (b instanceof _) b = b._wrapped;
|
1097
|
+
// Compare `[[Class]]` names.
|
1098
|
+
var className = toString.call(a);
|
1099
|
+
if (className !== toString.call(b)) return false;
|
1100
|
+
switch (className) {
|
1101
|
+
// Strings, numbers, regular expressions, dates, and booleans are compared by value.
|
1102
|
+
case '[object RegExp]':
|
1103
|
+
// RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
|
1104
|
+
case '[object String]':
|
1105
|
+
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
|
1106
|
+
// equivalent to `new String("5")`.
|
1107
|
+
return '' + a === '' + b;
|
1108
|
+
case '[object Number]':
|
1109
|
+
// `NaN`s are equivalent, but non-reflexive.
|
1110
|
+
// Object(NaN) is equivalent to NaN
|
1111
|
+
if (+a !== +a) return +b !== +b;
|
1112
|
+
// An `egal` comparison is performed for other numeric values.
|
1113
|
+
return +a === 0 ? 1 / +a === 1 / b : +a === +b;
|
1114
|
+
case '[object Date]':
|
1115
|
+
case '[object Boolean]':
|
1116
|
+
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
|
1117
|
+
// millisecond representations. Note that invalid dates with millisecond representations
|
1118
|
+
// of `NaN` are not equivalent.
|
1119
|
+
return +a === +b;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
var areArrays = className === '[object Array]';
|
1123
|
+
if (!areArrays) {
|
1124
|
+
if (typeof a != 'object' || typeof b != 'object') return false;
|
1125
|
+
|
1126
|
+
// Objects with different constructors are not equivalent, but `Object`s or `Array`s
|
1127
|
+
// from different frames are.
|
1128
|
+
var aCtor = a.constructor, bCtor = b.constructor;
|
1129
|
+
if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
|
1130
|
+
_.isFunction(bCtor) && bCtor instanceof bCtor)
|
1131
|
+
&& ('constructor' in a && 'constructor' in b)) {
|
1132
|
+
return false;
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
// Assume equality for cyclic structures. The algorithm for detecting cyclic
|
1136
|
+
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
|
1137
|
+
|
1138
|
+
// Initializing stack of traversed objects.
|
1139
|
+
// It's done here since we only need them for objects and arrays comparison.
|
1140
|
+
aStack = aStack || [];
|
1141
|
+
bStack = bStack || [];
|
1142
|
+
var length = aStack.length;
|
1143
|
+
while (length--) {
|
1144
|
+
// Linear search. Performance is inversely proportional to the number of
|
1145
|
+
// unique nested structures.
|
1146
|
+
if (aStack[length] === a) return bStack[length] === b;
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
// Add the first object to the stack of traversed objects.
|
1150
|
+
aStack.push(a);
|
1151
|
+
bStack.push(b);
|
1152
|
+
|
1153
|
+
// Recursively compare objects and arrays.
|
1154
|
+
if (areArrays) {
|
1155
|
+
// Compare array lengths to determine if a deep comparison is necessary.
|
1156
|
+
length = a.length;
|
1157
|
+
if (length !== b.length) return false;
|
1158
|
+
// Deep compare the contents, ignoring non-numeric properties.
|
1159
|
+
while (length--) {
|
1160
|
+
if (!eq(a[length], b[length], aStack, bStack)) return false;
|
1161
|
+
}
|
1162
|
+
} else {
|
1163
|
+
// Deep compare objects.
|
1164
|
+
var keys = _.keys(a), key;
|
1165
|
+
length = keys.length;
|
1166
|
+
// Ensure that both objects contain the same number of properties before comparing deep equality.
|
1167
|
+
if (_.keys(b).length !== length) return false;
|
1168
|
+
while (length--) {
|
1169
|
+
// Deep compare each member
|
1170
|
+
key = keys[length];
|
1171
|
+
if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
// Remove the first object from the stack of traversed objects.
|
1175
|
+
aStack.pop();
|
1176
|
+
bStack.pop();
|
1177
|
+
return true;
|
1178
|
+
};
|
1179
|
+
|
1180
|
+
// Perform a deep comparison to check if two objects are equal.
|
1181
|
+
_.isEqual = function(a, b) {
|
1182
|
+
return eq(a, b);
|
1183
|
+
};
|
1184
|
+
|
1185
|
+
// Is a given array, string, or object empty?
|
1186
|
+
// An "empty" object has no enumerable own-properties.
|
1187
|
+
_.isEmpty = function(obj) {
|
1188
|
+
if (obj == null) return true;
|
1189
|
+
if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;
|
1190
|
+
return _.keys(obj).length === 0;
|
1191
|
+
};
|
1192
|
+
|
1193
|
+
// Is a given value a DOM element?
|
1194
|
+
_.isElement = function(obj) {
|
1195
|
+
return !!(obj && obj.nodeType === 1);
|
1196
|
+
};
|
1197
|
+
|
1198
|
+
// Is a given value an array?
|
1199
|
+
// Delegates to ECMA5's native Array.isArray
|
1200
|
+
_.isArray = nativeIsArray || function(obj) {
|
1201
|
+
return toString.call(obj) === '[object Array]';
|
1202
|
+
};
|
1203
|
+
|
1204
|
+
// Is a given variable an object?
|
1205
|
+
_.isObject = function(obj) {
|
1206
|
+
var type = typeof obj;
|
1207
|
+
return type === 'function' || type === 'object' && !!obj;
|
1208
|
+
};
|
1209
|
+
|
1210
|
+
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.
|
1211
|
+
_.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {
|
1212
|
+
_['is' + name] = function(obj) {
|
1213
|
+
return toString.call(obj) === '[object ' + name + ']';
|
1214
|
+
};
|
1215
|
+
});
|
1216
|
+
|
1217
|
+
// Define a fallback version of the method in browsers (ahem, IE < 9), where
|
1218
|
+
// there isn't any inspectable "Arguments" type.
|
1219
|
+
if (!_.isArguments(arguments)) {
|
1220
|
+
_.isArguments = function(obj) {
|
1221
|
+
return _.has(obj, 'callee');
|
1222
|
+
};
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
// Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,
|
1226
|
+
// IE 11 (#1621), and in Safari 8 (#1929).
|
1227
|
+
if (typeof /./ != 'function' && typeof Int8Array != 'object') {
|
1228
|
+
_.isFunction = function(obj) {
|
1229
|
+
return typeof obj == 'function' || false;
|
1230
|
+
};
|
1231
|
+
}
|
1232
|
+
|
1233
|
+
// Is a given object a finite number?
|
1234
|
+
_.isFinite = function(obj) {
|
1235
|
+
return isFinite(obj) && !isNaN(parseFloat(obj));
|
1236
|
+
};
|
1237
|
+
|
1238
|
+
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
|
1239
|
+
_.isNaN = function(obj) {
|
1240
|
+
return _.isNumber(obj) && obj !== +obj;
|
1241
|
+
};
|
1242
|
+
|
1243
|
+
// Is a given value a boolean?
|
1244
|
+
_.isBoolean = function(obj) {
|
1245
|
+
return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
|
1246
|
+
};
|
1247
|
+
|
1248
|
+
// Is a given value equal to null?
|
1249
|
+
_.isNull = function(obj) {
|
1250
|
+
return obj === null;
|
1251
|
+
};
|
1252
|
+
|
1253
|
+
// Is a given variable undefined?
|
1254
|
+
_.isUndefined = function(obj) {
|
1255
|
+
return obj === void 0;
|
1256
|
+
};
|
1257
|
+
|
1258
|
+
// Shortcut function for checking if an object has a given property directly
|
1259
|
+
// on itself (in other words, not on a prototype).
|
1260
|
+
_.has = function(obj, key) {
|
1261
|
+
return obj != null && hasOwnProperty.call(obj, key);
|
1262
|
+
};
|
1263
|
+
|
1264
|
+
// Utility Functions
|
1265
|
+
// -----------------
|
1266
|
+
|
1267
|
+
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
|
1268
|
+
// previous owner. Returns a reference to the Underscore object.
|
1269
|
+
_.noConflict = function() {
|
1270
|
+
root._ = previousUnderscore;
|
1271
|
+
return this;
|
1272
|
+
};
|
1273
|
+
|
1274
|
+
// Keep the identity function around for default iteratees.
|
1275
|
+
_.identity = function(value) {
|
1276
|
+
return value;
|
1277
|
+
};
|
1278
|
+
|
1279
|
+
// Predicate-generating functions. Often useful outside of Underscore.
|
1280
|
+
_.constant = function(value) {
|
1281
|
+
return function() {
|
1282
|
+
return value;
|
1283
|
+
};
|
1284
|
+
};
|
1285
|
+
|
1286
|
+
_.noop = function(){};
|
1287
|
+
|
1288
|
+
_.property = function(key) {
|
1289
|
+
return function(obj) {
|
1290
|
+
return obj == null ? void 0 : obj[key];
|
1291
|
+
};
|
1292
|
+
};
|
1293
|
+
|
1294
|
+
// Generates a function for a given object that returns a given property.
|
1295
|
+
_.propertyOf = function(obj) {
|
1296
|
+
return obj == null ? function(){} : function(key) {
|
1297
|
+
return obj[key];
|
1298
|
+
};
|
1299
|
+
};
|
1300
|
+
|
1301
|
+
// Returns a predicate for checking whether an object has a given set of
|
1302
|
+
// `key:value` pairs.
|
1303
|
+
_.matcher = _.matches = function(attrs) {
|
1304
|
+
attrs = _.extendOwn({}, attrs);
|
1305
|
+
return function(obj) {
|
1306
|
+
return _.isMatch(obj, attrs);
|
1307
|
+
};
|
1308
|
+
};
|
1309
|
+
|
1310
|
+
// Run a function **n** times.
|
1311
|
+
_.times = function(n, iteratee, context) {
|
1312
|
+
var accum = Array(Math.max(0, n));
|
1313
|
+
iteratee = optimizeCb(iteratee, context, 1);
|
1314
|
+
for (var i = 0; i < n; i++) accum[i] = iteratee(i);
|
1315
|
+
return accum;
|
1316
|
+
};
|
1317
|
+
|
1318
|
+
// Return a random integer between min and max (inclusive).
|
1319
|
+
_.random = function(min, max) {
|
1320
|
+
if (max == null) {
|
1321
|
+
max = min;
|
1322
|
+
min = 0;
|
1323
|
+
}
|
1324
|
+
return min + Math.floor(Math.random() * (max - min + 1));
|
1325
|
+
};
|
1326
|
+
|
1327
|
+
// A (possibly faster) way to get the current timestamp as an integer.
|
1328
|
+
_.now = Date.now || function() {
|
1329
|
+
return new Date().getTime();
|
1330
|
+
};
|
1331
|
+
|
1332
|
+
// List of HTML entities for escaping.
|
1333
|
+
var escapeMap = {
|
1334
|
+
'&': '&',
|
1335
|
+
'<': '<',
|
1336
|
+
'>': '>',
|
1337
|
+
'"': '"',
|
1338
|
+
"'": ''',
|
1339
|
+
'`': '`'
|
1340
|
+
};
|
1341
|
+
var unescapeMap = _.invert(escapeMap);
|
1342
|
+
|
1343
|
+
// Functions for escaping and unescaping strings to/from HTML interpolation.
|
1344
|
+
var createEscaper = function(map) {
|
1345
|
+
var escaper = function(match) {
|
1346
|
+
return map[match];
|
1347
|
+
};
|
1348
|
+
// Regexes for identifying a key that needs to be escaped
|
1349
|
+
var source = '(?:' + _.keys(map).join('|') + ')';
|
1350
|
+
var testRegexp = RegExp(source);
|
1351
|
+
var replaceRegexp = RegExp(source, 'g');
|
1352
|
+
return function(string) {
|
1353
|
+
string = string == null ? '' : '' + string;
|
1354
|
+
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
|
1355
|
+
};
|
1356
|
+
};
|
1357
|
+
_.escape = createEscaper(escapeMap);
|
1358
|
+
_.unescape = createEscaper(unescapeMap);
|
1359
|
+
|
1360
|
+
// If the value of the named `property` is a function then invoke it with the
|
1361
|
+
// `object` as context; otherwise, return it.
|
1362
|
+
_.result = function(object, property, fallback) {
|
1363
|
+
var value = object == null ? void 0 : object[property];
|
1364
|
+
if (value === void 0) {
|
1365
|
+
value = fallback;
|
1366
|
+
}
|
1367
|
+
return _.isFunction(value) ? value.call(object) : value;
|
1368
|
+
};
|
1369
|
+
|
1370
|
+
// Generate a unique integer id (unique within the entire client session).
|
1371
|
+
// Useful for temporary DOM ids.
|
1372
|
+
var idCounter = 0;
|
1373
|
+
_.uniqueId = function(prefix) {
|
1374
|
+
var id = ++idCounter + '';
|
1375
|
+
return prefix ? prefix + id : id;
|
1376
|
+
};
|
1377
|
+
|
1378
|
+
// By default, Underscore uses ERB-style template delimiters, change the
|
1379
|
+
// following template settings to use alternative delimiters.
|
1380
|
+
_.templateSettings = {
|
1381
|
+
evaluate : /<%([\s\S]+?)%>/g,
|
1382
|
+
interpolate : /<%=([\s\S]+?)%>/g,
|
1383
|
+
escape : /<%-([\s\S]+?)%>/g
|
1384
|
+
};
|
1385
|
+
|
1386
|
+
// When customizing `templateSettings`, if you don't want to define an
|
1387
|
+
// interpolation, evaluation or escaping regex, we need one that is
|
1388
|
+
// guaranteed not to match.
|
1389
|
+
var noMatch = /(.)^/;
|
1390
|
+
|
1391
|
+
// Certain characters need to be escaped so that they can be put into a
|
1392
|
+
// string literal.
|
1393
|
+
var escapes = {
|
1394
|
+
"'": "'",
|
1395
|
+
'\\': '\\',
|
1396
|
+
'\r': 'r',
|
1397
|
+
'\n': 'n',
|
1398
|
+
'\u2028': 'u2028',
|
1399
|
+
'\u2029': 'u2029'
|
1400
|
+
};
|
1401
|
+
|
1402
|
+
var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
|
1403
|
+
|
1404
|
+
var escapeChar = function(match) {
|
1405
|
+
return '\\' + escapes[match];
|
1406
|
+
};
|
1407
|
+
|
1408
|
+
// JavaScript micro-templating, similar to John Resig's implementation.
|
1409
|
+
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
1410
|
+
// and correctly escapes quotes within interpolated code.
|
1411
|
+
// NB: `oldSettings` only exists for backwards compatibility.
|
1412
|
+
_.template = function(text, settings, oldSettings) {
|
1413
|
+
if (!settings && oldSettings) settings = oldSettings;
|
1414
|
+
settings = _.defaults({}, settings, _.templateSettings);
|
1415
|
+
|
1416
|
+
// Combine delimiters into one regular expression via alternation.
|
1417
|
+
var matcher = RegExp([
|
1418
|
+
(settings.escape || noMatch).source,
|
1419
|
+
(settings.interpolate || noMatch).source,
|
1420
|
+
(settings.evaluate || noMatch).source
|
1421
|
+
].join('|') + '|$', 'g');
|
1422
|
+
|
1423
|
+
// Compile the template source, escaping string literals appropriately.
|
1424
|
+
var index = 0;
|
1425
|
+
var source = "__p+='";
|
1426
|
+
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
|
1427
|
+
source += text.slice(index, offset).replace(escaper, escapeChar);
|
1428
|
+
index = offset + match.length;
|
1429
|
+
|
1430
|
+
if (escape) {
|
1431
|
+
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
|
1432
|
+
} else if (interpolate) {
|
1433
|
+
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
|
1434
|
+
} else if (evaluate) {
|
1435
|
+
source += "';\n" + evaluate + "\n__p+='";
|
1436
|
+
}
|
1437
|
+
|
1438
|
+
// Adobe VMs need the match returned to produce the correct offest.
|
1439
|
+
return match;
|
1440
|
+
});
|
1441
|
+
source += "';\n";
|
1442
|
+
|
1443
|
+
// If a variable is not specified, place data values in local scope.
|
1444
|
+
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
|
1445
|
+
|
1446
|
+
source = "var __t,__p='',__j=Array.prototype.join," +
|
1447
|
+
"print=function(){__p+=__j.call(arguments,'');};\n" +
|
1448
|
+
source + 'return __p;\n';
|
1449
|
+
|
1450
|
+
try {
|
1451
|
+
var render = new Function(settings.variable || 'obj', '_', source);
|
1452
|
+
} catch (e) {
|
1453
|
+
e.source = source;
|
1454
|
+
throw e;
|
1455
|
+
}
|
1456
|
+
|
1457
|
+
var template = function(data) {
|
1458
|
+
return render.call(this, data, _);
|
1459
|
+
};
|
1460
|
+
|
1461
|
+
// Provide the compiled source as a convenience for precompilation.
|
1462
|
+
var argument = settings.variable || 'obj';
|
1463
|
+
template.source = 'function(' + argument + '){\n' + source + '}';
|
1464
|
+
|
1465
|
+
return template;
|
1466
|
+
};
|
1467
|
+
|
1468
|
+
// Add a "chain" function. Start chaining a wrapped Underscore object.
|
1469
|
+
_.chain = function(obj) {
|
1470
|
+
var instance = _(obj);
|
1471
|
+
instance._chain = true;
|
1472
|
+
return instance;
|
1473
|
+
};
|
1474
|
+
|
1475
|
+
// OOP
|
1476
|
+
// ---------------
|
1477
|
+
// If Underscore is called as a function, it returns a wrapped object that
|
1478
|
+
// can be used OO-style. This wrapper holds altered versions of all the
|
1479
|
+
// underscore functions. Wrapped objects may be chained.
|
1480
|
+
|
1481
|
+
// Helper function to continue chaining intermediate results.
|
1482
|
+
var result = function(instance, obj) {
|
1483
|
+
return instance._chain ? _(obj).chain() : obj;
|
1484
|
+
};
|
1485
|
+
|
1486
|
+
// Add your own custom functions to the Underscore object.
|
1487
|
+
_.mixin = function(obj) {
|
1488
|
+
_.each(_.functions(obj), function(name) {
|
1489
|
+
var func = _[name] = obj[name];
|
1490
|
+
_.prototype[name] = function() {
|
1491
|
+
var args = [this._wrapped];
|
1492
|
+
push.apply(args, arguments);
|
1493
|
+
return result(this, func.apply(_, args));
|
1494
|
+
};
|
1495
|
+
});
|
1496
|
+
};
|
1497
|
+
|
1498
|
+
// Add all of the Underscore functions to the wrapper object.
|
1499
|
+
_.mixin(_);
|
1500
|
+
|
1501
|
+
// Add all mutator Array functions to the wrapper.
|
1502
|
+
_.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
|
1503
|
+
var method = ArrayProto[name];
|
1504
|
+
_.prototype[name] = function() {
|
1505
|
+
var obj = this._wrapped;
|
1506
|
+
method.apply(obj, arguments);
|
1507
|
+
if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
|
1508
|
+
return result(this, obj);
|
1509
|
+
};
|
1510
|
+
});
|
1511
|
+
|
1512
|
+
// Add all accessor Array functions to the wrapper.
|
1513
|
+
_.each(['concat', 'join', 'slice'], function(name) {
|
1514
|
+
var method = ArrayProto[name];
|
1515
|
+
_.prototype[name] = function() {
|
1516
|
+
return result(this, method.apply(this._wrapped, arguments));
|
1517
|
+
};
|
1518
|
+
});
|
1519
|
+
|
1520
|
+
// Extracts the result from a wrapped and chained object.
|
1521
|
+
_.prototype.value = function() {
|
1522
|
+
return this._wrapped;
|
1523
|
+
};
|
1524
|
+
|
1525
|
+
// Provide unwrapping proxy for some methods used in engine operations
|
1526
|
+
// such as arithmetic and JSON stringification.
|
1527
|
+
_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;
|
1528
|
+
|
1529
|
+
_.prototype.toString = function() {
|
1530
|
+
return '' + this._wrapped;
|
1531
|
+
};
|
1532
|
+
|
1533
|
+
// AMD registration happens at the end for compatibility with AMD loaders
|
1534
|
+
// that may not enforce next-turn semantics on modules. Even though general
|
1535
|
+
// practice for AMD registration is to be anonymous, underscore registers
|
1536
|
+
// as a named module because, like jQuery, it is a base library that is
|
1537
|
+
// popular enough to be bundled in a third party lib, but not be part of
|
1538
|
+
// an AMD load request. Those cases could generate an error when an
|
1539
|
+
// anonymous define() is called outside of a loader request.
|
1540
|
+
if (typeof define === 'function' && define.amd) {
|
1541
|
+
define('underscore', [], function() {
|
1542
|
+
return _;
|
1543
|
+
});
|
1544
|
+
}
|
1545
|
+
}.call(this));
|