summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-04-15 01:40:48 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-04-15 01:40:48 -0400
commitcdff1a234be0d625c5c824707dbae32ffa6a76dd (patch)
treea9e029f2a98ad72e64d9e09a922ec39ab502a75b
parentf18a6c809f45e71175ced6050d7e57bf4e7e89ba (diff)
parent90873ef7de4bf842fbf6971836a373c555cfcbaa (diff)
Merge branch 'master-nomake'
-rw-r--r--Makefile104
-rw-r--r--Makefile.d/bootstrap-typeahead.js.patch38
-rw-r--r--Makefile.d/homepage.js.in36
-rw-r--r--Makefile.d/jquery-1.8.3.min.js.preamble1
-rw-r--r--Makefile.d/jquery.tablesorter-2.7.min.js.preamble4
-rw-r--r--Makefile.d/konami.js.patch46
-rw-r--r--common.mk28
-rw-r--r--devel/utils.py2
-rw-r--r--devel/views.py3
-rw-r--r--feeds.py84
-rw-r--r--local_settings.py.example4
-rw-r--r--main/models.py6
-rw-r--r--main/templatetags/pgp.py2
-rw-r--r--main/utils.py42
-rw-r--r--mirrors/utils.py70
-rw-r--r--mirrors/views.py26
-rw-r--r--news/models.py7
-rw-r--r--packages/models.py7
-rw-r--r--packages/templatetags/jinja2.py92
-rw-r--r--packages/templatetags/package_extras.py114
-rw-r--r--packages/views/__init__.py4
-rw-r--r--packages/views/search.py6
-rw-r--r--public/views.py14
-rw-r--r--releng/admin.py1
-rw-r--r--releng/migrations/0002_release_last_modified.py22
-rw-r--r--releng/migrations/0003_release_populate_last_modified.py21
-rw-r--r--releng/models.py1
-rw-r--r--releng/views.py5
-rw-r--r--requirements.txt6
-rw-r--r--requirements_prod.txt6
-rw-r--r--settings.py14
-rw-r--r--sitestatic/.gitignore18
-rw-r--r--sitestatic/Makefile27
-rw-r--r--sitestatic/archnavbar/Makefile8
-rw-r--r--sitestatic/archnavbar/archlogo.pngbin5282 -> 0 bytes
-rw-r--r--sitestatic/archweb.css4
-rw-r--r--sitestatic/bootstrap-typeahead.js300
-rw-r--r--sitestatic/bootstrap-typeahead.min.js26
-rw-r--r--sitestatic/favicon.icobin1150 -> 0 bytes
-rw-r--r--sitestatic/jquery-1.8.3.js9472
-rw-r--r--sitestatic/jquery-1.8.3.min.js196
-rw-r--r--sitestatic/jquery.tablesorter-2.7.js1374
-rw-r--r--sitestatic/jquery.tablesorter-2.7.min.js59
-rw-r--r--sitestatic/konami.js105
-rw-r--r--sitestatic/konami.min.js15
-rw-r--r--sitestatic/logos/Makefile15
-rw-r--r--sitestatic/logos/apple-touch-icon-114x114.pngbin2379 -> 0 bytes
-rw-r--r--sitestatic/logos/apple-touch-icon-144x144.pngbin3108 -> 0 bytes
-rw-r--r--sitestatic/logos/apple-touch-icon-57x57.pngbin1233 -> 0 bytes
-rw-r--r--sitestatic/logos/apple-touch-icon-72x72.pngbin1595 -> 0 bytes
-rw-r--r--sitestatic/logos/icon-transparent-64x64.pngbin1428 -> 0 bytes
-rw-r--r--sitestatic/silhouette.pngbin2521 -> 0 bytes
-rw-r--r--templates/feeds/news_description.html2
-rw-r--r--templates/feeds/packages_title.html1
-rw-r--r--templates/packages/details.html230
-rw-r--r--templates/packages/details.html.jinja228
-rw-r--r--templates/packages/details_depend.html.jinja (renamed from templates/packages/details_depend.html)10
-rw-r--r--templates/packages/details_link.html.jinja1
-rw-r--r--templates/packages/details_relatedto.html2
-rw-r--r--templates/packages/details_relatedto.html.jinja3
-rw-r--r--templates/packages/details_requiredby.html.jinja (renamed from templates/packages/details_requiredby.html)2
-rw-r--r--templates/packages/files.html2
-rw-r--r--templates/packages/files_list.html.jinja (renamed from templates/packages/files_list.html)2
-rw-r--r--templates/packages/search.html68
-rw-r--r--templates/packages/search_paginator.html4
-rw-r--r--templates/packages/stale_relations.html12
-rw-r--r--templates/public/index.html59
-rw-r--r--todolists/utils.py2
-rw-r--r--urls.py17
-rw-r--r--visualize/.gitignore2
-rw-r--r--visualize/static/Makefile23
-rw-r--r--visualize/static/d3-3.0.6.js7823
-rw-r--r--visualize/static/d3-3.0.6.min.js280
73 files changed, 832 insertions, 20376 deletions
diff --git a/Makefile b/Makefile
index 6cc53cf5..75540c3e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,103 @@
-subdirs = sitestatic sitestatic/archnavbar sitestatic/logos visualize/static
+# Where are we?
+topdir := $(dir $(lastword $(MAKEFILE_LIST)))
+www = $(topdir)/../web-cache/www
+artwork = $(topdir)/../web-cache/artwork
+branding = $(artwork)/official-2013/optimized-text
-define newline =
+# Where is the the Javascript minimizer?
+JSMIN = { sed -n '1,/\*\//p' $1; closure-compiler --js $1; } > $2
-endef
+# What versions of 3rd party libraries are we using?
+jquery-ver=1.8.3
+bootstrap-ver=2.1.1
+tablesorter-ver=2.7
+d3-ver=3.0.6
+konami-ver=c0f686e647765860ff4d2fcb7b48122785432b75
-default: all ;
+# What files do we make?
+javascripts = \
+ sitestatic/bootstrap-typeahead.js \
+ sitestatic/homepage.js \
+ sitestatic/jquery-$(jquery-ver).min.js \
+ sitestatic/jquery.tablesorter-$(tablesorter-ver).js \
+ sitestatic/jquery.tablesorter-$(tablesorter-ver).min.js \
+ sitestatic/konami.min.js \
+ visualize/static/d3-$(d3-ver).js \
+ visualize/static/d3-$(d3-ver).min.js
+images += sitestatic/favicon.ico sitestatic/silhouette.png
+images += sitestatic/archnavbar/archlogo.png
+images += \
+ sitestatic/logos/apple-touch-icon-114x114.png \
+ sitestatic/logos/apple-touch-icon-144x144.png \
+ sitestatic/logos/apple-touch-icon-57x57.png \
+ sitestatic/logos/apple-touch-icon-72x72.png \
+ sitestatic/logos/icon-transparent-64x64.png
-%:
- $(foreach subdir,$(subdirs),$(MAKE) -C $(subdir) $@$(newline))
+javascript_basenames = $(sort $(patsubst %.min,%,$(patsubst %.js,%,$(javascripts))))
+targets = $(foreach i,$(javascript_basenames),$i.js $i.min.js) $(images)
+
+
+# The base rules
+
+all: $(targets) sitestatic/.gitignore visualize/.gitignore
+clean: sitestatic/.gitignore visualize/.gitignore
+ rm -f -- $(targets)
+.PHONY: all clean
+
+%/.gitignore: $(MAKEFILE_LIST)
+ printf -- '%s\n' $(filter $*/%,$(targets)) > $@
+
+# Turn on sane error handling
+.DELETE_ON_ERROR:
+
+
+# How to download files
+
+$(www)/http/%:
+ mkdir -p '$(@D)'
+ wget 'http://$*' -O '$@'
+ touch '$@'
+
+$(www)/https/%:
+ mkdir -p '$(@D)'
+ wget 'https://$*' -O '$@'
+ touch '$@'
+
+$(branding)/%:
+ gitget checkout 'git://projects.parabola.nu/artwork.git#branch=master' '$(artwork)'
+ make -C '$(branding)'
+
+
+# Non-minimized files
+sitestatic/bootstrap-typeahead.js: sitestatic/%: $(www)/https/raw.github.com/twitter/bootstrap/v$(bootstrap-ver)/js/% Makefile.d/%.patch
+ cp $< $@
+ patch -i Makefile.d/$*.patch $@
+sitestatic/jquery-$(jquery-ver).js: sitestatic/%: $(www)/http/code.jquery.com/%
+ cp $< $@
+sitestatic/jquery.tablesorter-$(tablesorter-ver).js: $(www)/https/raw.github.com/Mottie/tablesorter/v$(tablesorter-ver)/js/jquery.tablesorter.js
+ cp $< $@
+sitestatic/konami.js: sitestatic/%: $(www)/https/raw.github.com/snaptortoise/konami-js/$(konami-ver)/% Makefile.d/%.patch
+ cp $< $@
+ patch -i Makefile.d/$*.patch $@
+sitestatic/homepage.js: sitestatic/bootstrap-typeahead.min.js sitestatic/konami.min.js Makefile.d/homepage.js.in
+ { \
+ echo '/* bootstrap-typeahead.min.js: */' && \
+ cat sitestatic/bootstrap-typeahead.min.js && \
+ echo && \
+ echo '/* konami.min.js: */' && \
+ sed -e 's,^\s*,,' -e 's,^return.*,&;,' sitestatic/konami.min.js && \
+ echo && \
+ echo '/* Main homepage.js content: */' && \
+ cat Makefile.d/homepage.js.in ; \
+ } > $@
+visualize/static/d3-$(d3-ver).js: %: $(www)/https/raw.github.com/mbostock/d3/v$(d3-ver)/d3.js
+ cp $< $@
+
+$(foreach i,$(images),$(eval $i: $$(branding)/$(notdir $i); cp $$< $$@))
+
+
+# The minimization processes
+
+%.min.js: %.js
+ $(call JSMIN,$<,$@)
diff --git a/Makefile.d/bootstrap-typeahead.js.patch b/Makefile.d/bootstrap-typeahead.js.patch
new file mode 100644
index 00000000..dfbab80b
--- /dev/null
+++ b/Makefile.d/bootstrap-typeahead.js.patch
@@ -0,0 +1,38 @@
+commit f3e23371fa0473c82c28932e85570d94e5fc232a
+Author: Dan McGee <dan@archlinux.org>
+Date: Mon Sep 24 20:21:15 2012 -0500
+
+ Don't auto-select the first item in typeahead
+
+ This assumption was baked into the Twitter bootstrap JS; kill it so it
+ is still easy to do a freeform search if wanted.
+
+ Signed-off-by: Dan McGee <dan@archlinux.org>
+
+diff --git a/sitestatic/bootstrap-typeahead.js b/sitestatic/bootstrap-typeahead.js
+index c2ccdea..3d355ae 100644
+--- a/sitestatic/bootstrap-typeahead.js
++++ b/sitestatic/bootstrap-typeahead.js
+@@ -45,9 +45,11 @@
+
+ , select: function () {
+ var val = this.$menu.find('.active').attr('data-value')
+- this.$element
+- .val(this.updater(val))
+- .change()
++ if (val) {
++ this.$element
++ .val(this.updater(val))
++ .change()
++ }
+ return this.hide()
+ }
+
+@@ -141,7 +143,6 @@
+ return i[0]
+ })
+
+- items.first().addClass('active')
+ this.$menu.html(items)
+ return this
+ }
diff --git a/Makefile.d/homepage.js.in b/Makefile.d/homepage.js.in
new file mode 100644
index 00000000..2d6f7910
--- /dev/null
+++ b/Makefile.d/homepage.js.in
@@ -0,0 +1,36 @@
+function setupTypeahead() {
+ $('#pkgsearch-field').typeahead({
+ source: function(query, callback) {
+ $.getJSON('/opensearch/packages/suggest', {q: query}, function(data) {
+ callback(data[1]);
+ });
+ },
+ matcher: function(item) { return true; },
+ sorter: function(items) { return items; },
+ menu: '<ul class="pkgsearch-typeahead"></ul>',
+ items: 10,
+ updater: function(item) {
+ $('#pkgsearch-field').val(item);
+ $('#pkgsearch-form').submit();
+ return item;
+ }
+ }).attr('autocomplete', 'off');
+ $('#pkgsearch-field').keyup(function(e) {
+ if (e.keyCode === 13 &&
+ $('ul.pkgsearch-typeahead li.active').size() === 0) {
+ $('#pkgsearch-form').submit();
+ }
+ });
+}
+
+function setupKonami(image_src) {
+ var konami = new Konami(function() {
+ $('#konami').html('<img src="' + image_src + '" alt=""/>');
+ setTimeout(function() {
+ $('#konami').fadeIn(500);
+ }, 500);
+ $('#konami').click(function() {
+ $('#konami').fadeOut(500);
+ });
+ });
+}
diff --git a/Makefile.d/jquery-1.8.3.min.js.preamble b/Makefile.d/jquery-1.8.3.min.js.preamble
new file mode 100644
index 00000000..ca451d71
--- /dev/null
+++ b/Makefile.d/jquery-1.8.3.min.js.preamble
@@ -0,0 +1 @@
+/*! jQuery v1.8.3 jquery.com | jquery.org/license */ \ No newline at end of file
diff --git a/Makefile.d/jquery.tablesorter-2.7.min.js.preamble b/Makefile.d/jquery.tablesorter-2.7.min.js.preamble
new file mode 100644
index 00000000..e57e2d88
--- /dev/null
+++ b/Makefile.d/jquery.tablesorter-2.7.min.js.preamble
@@ -0,0 +1,4 @@
+/*!
+* TableSorter 2.7 min - Client-side table sorting with ease!
+* Copyright (c) 2007 Christian Bach
+*/ \ No newline at end of file
diff --git a/Makefile.d/konami.js.patch b/Makefile.d/konami.js.patch
new file mode 100644
index 00000000..f6df91c4
--- /dev/null
+++ b/Makefile.d/konami.js.patch
@@ -0,0 +1,46 @@
+--- ..//web-cache/www/https/raw.github.com/snaptortoise/konami-js/c0f686e647765860ff4d2fcb7b48122785432b75/konami.js 2015-04-14 17:46:09.372597458 -0400
++++ sitestatic/konami.js 2015-04-14 22:39:28.549281737 -0400
+@@ -56,7 +56,7 @@
+ load: function(link){
+ this.orig_keys = this.keys;
+ konami.addEvent(document,"touchmove",function(e){
+- if(e.touches.length == 1 && konami.iphone.capture==true){
++ if(e.touches.length == 1 && konami.iphone.capture===true){
+ var touch = e.touches[0];
+ konami.iphone.stop_x = touch.pageX;
+ konami.iphone.stop_y = touch.pageY;
+@@ -66,7 +66,7 @@
+ }
+ });
+ konami.addEvent(document,"touchend",function(evt){
+- if (konami.iphone.tap==true) konami.iphone.check_direction(link);
++ if (konami.iphone.tap===true) konami.iphone.check_direction(link);
+ },false);
+ konami.addEvent(document,"touchstart", function(evt){
+ konami.iphone.start_x = evt.changedTouches[0].pageX
+@@ -76,12 +76,12 @@
+ });
+ },
+ check_direction: function(link){
+- x_magnitude = Math.abs(this.start_x-this.stop_x)
+- y_magnitude = Math.abs(this.start_y-this.stop_y)
+- x = ((this.start_x-this.stop_x) < 0) ? "RIGHT" : "LEFT";
+- y = ((this.start_y-this.stop_y) < 0) ? "DOWN" : "UP";
+- result = (x_magnitude > y_magnitude) ? x : y;
+- result = (this.tap==true) ? "TAP" : result;
++ var x_magnitude = Math.abs(this.start_x-this.stop_x)
++ var y_magnitude = Math.abs(this.start_y-this.stop_y)
++ var x = ((this.start_x-this.stop_x) < 0) ? "RIGHT" : "LEFT";
++ var y = ((this.start_y-this.stop_y) < 0) ? "DOWN" : "UP";
++ var result = (x_magnitude > y_magnitude) ? x : y;
++ result = (this.tap===true) ? "TAP" : result;
+
+ if (result==this.keys[0]) this.keys = this.keys.slice(1,this.keys.length)
+ if (this.keys.length==0) {
+@@ -99,4 +99,4 @@
+ }
+
+ return konami;
+-}
+\ No newline at end of file
++}
diff --git a/common.mk b/common.mk
deleted file mode 100644
index 92f26337..00000000
--- a/common.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-topdir := $(dir $(lastword $(MAKEFILE_LIST)))
-www = $(topdir)/../web-cache/www
-artwork = $(topdir)/../web-cache/artwork
-branding = $(artwork)/official-2013/optimized-text
-
-#JSMIN = cp $1 $2
-#JSMIN = compiler $1
-#JSMIN = uglify-js -nc $1 > $2
-JSMIN = { sed -n '1,/\*\//p' $1; closure-compiler --js $1; } > $2
-
-%.min.js: %.js
- $(call JSMIN,$<,$@)
-
-$(www)/http/%:
- mkdir -p '$(@D)'
- wget 'http://$*' -O '$@'
- touch '$@'
-
-$(www)/https/%:
- mkdir -p '$(@D)'
- wget 'http://$*' -O '$@'
- touch '$@'
-
-$(branding)/%:
- gitget checkout 'git://projects.parabola.nu/artwork.git#branch=master' '$(artwork)'
- make -C '$(branding)'
-
-.PHONY: PHONY
diff --git a/devel/utils.py b/devel/utils.py
index 7dd64972..eaa7d07e 100644
--- a/devel/utils.py
+++ b/devel/utils.py
@@ -10,7 +10,7 @@ from main.utils import cache_function
from main.models import Package
from packages.models import PackageRelation
-@cache_function(300)
+@cache_function(283)
def get_annotated_maintainers():
maintainers = User.objects.filter(is_active=True).order_by(
'first_name', 'last_name')
diff --git a/devel/views.py b/devel/views.py
index 92cb098e..66f6a965 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -197,6 +197,7 @@ def report(request, report_name, username=None):
maints = User.objects.filter(id__in=PackageRelation.objects.filter(
type=PackageRelation.MAINTAINER).values('user'))
+ packages = report.packages(packages, username)
arches = {pkg.arch for pkg in packages}
repos = {pkg.repo for pkg in packages}
context = {
@@ -204,7 +205,7 @@ def report(request, report_name, username=None):
'title': report.description,
'report': report,
'maintainer': user,
- 'packages': report.packages(packages, username),
+ 'packages': packages,
'arches': sorted(arches),
'repos': sorted(repos),
'column_names': report.names,
diff --git a/feeds.py b/feeds.py
index 6a17949c..be0e8dbb 100644
--- a/feeds.py
+++ b/feeds.py
@@ -1,57 +1,37 @@
from datetime import datetime, time
-import hashlib
from pytz import utc
from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.syndication.views import Feed
+from django.db import connection
from django.db.models import Q
from django.utils.feedgenerator import Rss201rev2Feed
from django.views.decorators.http import condition
-from main.utils import retrieve_latest
from main.models import Arch, Repo, Package
from news.models import News
from releng.models import Release
class BatchWritesWrapper(object):
- def __init__(self, outfile, chunks=20):
+ def __init__(self, outfile):
self.outfile = outfile
- self.chunks = chunks
self.buf = []
+
def write(self, s):
buf = self.buf
buf.append(s)
- if len(buf) >= self.chunks:
+ if len(buf) >= 40:
self.outfile.write(''.join(buf))
self.buf = []
+
def flush(self):
self.outfile.write(''.join(self.buf))
self.outfile.flush()
-class GuidNotPermalinkFeed(Rss201rev2Feed):
- @staticmethod
- def check_for_unique_id(f):
- def wrapper(name, contents=None, attrs=None):
- if attrs is None:
- attrs = {}
- if name == 'guid':
- attrs['isPermaLink'] = 'false'
- return f(name, contents, attrs)
- return wrapper
-
- def write_items(self, handler):
- '''
- Totally disgusting. Monkey-patch the handler so if it sees a
- 'unique-id' field come through, add an isPermalink="false" attribute.
- Workaround for http://code.djangoproject.com/ticket/9800
- '''
- handler.addQuickElement = self.check_for_unique_id(
- handler.addQuickElement)
- super(GuidNotPermalinkFeed, self).write_items(handler)
-
+class FasterRssFeed(Rss201rev2Feed):
def write(self, outfile, encoding):
'''
Batch the underlying 'write' calls on the outfile because Python's
@@ -60,28 +40,23 @@ class GuidNotPermalinkFeed(Rss201rev2Feed):
'>' closing tags and over 1600 write calls in our package feed.
'''
wrapper = BatchWritesWrapper(outfile)
- super(GuidNotPermalinkFeed, self).write(wrapper, encoding)
+ super(FasterRssFeed, self).write(wrapper, encoding)
wrapper.flush()
-def package_etag(request, *args, **kwargs):
- latest = retrieve_latest(Package)
- if latest:
- return hashlib.md5(str(kwargs) + str(latest)).hexdigest()
- return None
-
def package_last_modified(request, *args, **kwargs):
- return retrieve_latest(Package)
+ cursor = connection.cursor()
+ cursor.execute("SELECT MAX(last_update) FROM packages")
+ return cursor.fetchone()[0]
class PackageFeed(Feed):
- feed_type = GuidNotPermalinkFeed
+ feed_type = FasterRssFeed
link = '/packages/'
- title_template = 'feeds/packages_title.html'
def __call__(self, request, *args, **kwargs):
- wrapper = condition(etag_func=package_etag, last_modified_func=package_last_modified)
+ wrapper = condition(last_modified_func=package_last_modified)
return wrapper(super(PackageFeed, self).__call__)(request, *args, **kwargs)
__name__ = 'package_feed'
@@ -131,6 +106,8 @@ class PackageFeed(Feed):
def items(self, obj):
return obj['qs']
+ item_guid_is_permalink = False
+
def item_guid(self, item):
# http://diveintomark.org/archives/2004/05/28/howto-atom-id
date = item.last_update
@@ -141,6 +118,9 @@ class PackageFeed(Feed):
def item_pubdate(self, item):
return item.last_update
+ def item_title(self, item):
+ return '%s %s %s' % (item.pkgname, item.full_version, item.arch.name)
+
def item_description(self, item):
return item.pkgdesc
@@ -148,27 +128,22 @@ class PackageFeed(Feed):
return (item.repo.name, item.arch.name)
-def news_etag(request, *args, **kwargs):
- latest = retrieve_latest(News, 'last_modified')
- if latest:
- return hashlib.md5(str(latest)).hexdigest()
- return None
-
def news_last_modified(request, *args, **kwargs):
- return retrieve_latest(News, 'last_modified')
+ cursor = connection.cursor()
+ cursor.execute("SELECT MAX(last_modified) FROM news")
+ return cursor.fetchone()[0]
class NewsFeed(Feed):
- feed_type = GuidNotPermalinkFeed
+ feed_type = FasterRssFeed
title = settings.BRANDING_DISTRONAME+': Recent news updates'
link = '/news/'
description = 'The latest and greatest news from the '+settings.BRANDING_DISTRONAME+' distribution.'
subtitle = description
- description_template = 'feeds/news_description.html'
def __call__(self, request, *args, **kwargs):
- wrapper = condition(etag_func=news_etag, last_modified_func=news_last_modified)
+ wrapper = condition(last_modified_func=news_last_modified)
return wrapper(super(NewsFeed, self).__call__)(request, *args, **kwargs)
__name__ = 'news_feed'
@@ -177,21 +152,29 @@ class NewsFeed(Feed):
return News.objects.select_related('author').order_by(
'-postdate', '-id')[:10]
+ item_guid_is_permalink = False
+
def item_guid(self, item):
return item.guid
def item_pubdate(self, item):
return item.postdate
+ def item_updateddate(self, item):
+ return item.last_modified
+
def item_author_name(self, item):
return item.author.get_full_name()
def item_title(self, item):
return item.title
+ def item_description(self, item):
+ return item.html()
+
class ReleaseFeed(Feed):
- feed_type = GuidNotPermalinkFeed
+ feed_type = FasterRssFeed
title = settings.BRANDING_DISTRONAME+': Releases'
link = '/download/'
@@ -212,6 +195,11 @@ class ReleaseFeed(Feed):
def item_pubdate(self, item):
return datetime.combine(item.release_date, time()).replace(tzinfo=utc)
+ def item_updateddate(self, item):
+ return item.last_modified
+
+ item_guid_is_permalink = False
+
def item_guid(self, item):
# http://diveintomark.org/archives/2004/05/28/howto-atom-id
date = item.release_date
diff --git a/local_settings.py.example b/local_settings.py.example
index 3e33aa7e..44e38459 100644
--- a/local_settings.py.example
+++ b/local_settings.py.example
@@ -1,5 +1,3 @@
-### Django settings for Parabola GNU/Linux-libre project.
-
## Debug settings
DEBUG = False # If you are running without another HTTP server, must be true
TEMPLATE_DEBUG = False
@@ -55,8 +53,6 @@ CACHES = {
#'LOCATION': '127.0.0.1:11211',
}
}
-CACHE_MIDDLEWARE_KEY_PREFIX = 'arch'
-CACHE_MIDDLEWARE_SECONDS = 300
## Use secure session cookies? Make this true if you want all
## logged-in actions to take place over HTTPS only. If developing
diff --git a/main/models.py b/main/models.py
index 09b1adc0..1b95f3fa 100644
--- a/main/models.py
+++ b/main/models.py
@@ -443,12 +443,8 @@ class PackageFile(models.Model):
db_table = 'package_files'
-# connect signals needed to keep cache in line with reality
-from main.utils import refresh_latest
-from django.db.models.signals import pre_save, post_save
+from django.db.models.signals import pre_save
-post_save.connect(refresh_latest, sender=Package,
- dispatch_uid="main.models")
# note: reporead sets the 'created' field on Package objects, so no signal
# listener is set up here to do so
pre_save.connect(set_created_field, sender=Donor,
diff --git a/main/templatetags/pgp.py b/main/templatetags/pgp.py
index cc080439..2417f688 100644
--- a/main/templatetags/pgp.py
+++ b/main/templatetags/pgp.py
@@ -44,7 +44,7 @@ def pgp_key_link(key_id, link_text=None):
return '<a href="%s" title="PGP key search for %s">%s</a>' % values
-@cache_function(1800)
+@cache_function(1741)
def name_for_key(normalized):
try:
matching_key = DeveloperKey.objects.select_related(
diff --git a/main/utils.py b/main/utils.py
index 97cc540a..cf156566 100644
--- a/main/utils.py
+++ b/main/utils.py
@@ -12,11 +12,6 @@ from django.utils.timezone import now
from django.template.defaultfilters import slugify
-CACHE_TIMEOUT = 1800
-INVALIDATE_TIMEOUT = 10
-CACHE_LATEST_PREFIX = 'cache_latest_'
-
-
def cache_function_key(func, args, kwargs):
raw = [func.__name__, func.__module__, args, kwargs]
pickled = pickle.dumps(raw, protocol=pickle.HIGHEST_PROTOCOL)
@@ -76,43 +71,6 @@ def format_http_headers(request):
make_choice = lambda l: [(str(m), str(m)) for m in l]
-# These are in here because we would be jumping around in some import circles
-# and hoops otherwise. The only thing currently using these keys is the feed
-# caching stuff.
-
-def refresh_latest(**kwargs):
- '''A post_save signal handler to clear out the cached latest value for a
- given model.'''
- cache_key = CACHE_LATEST_PREFIX + kwargs['sender'].__name__
- # We could delete the value, but that could open a race condition
- # where the new data wouldn't have been committed yet by the calling
- # thread. Instead, explicitly set it to None for a short amount of time.
- # Hopefully by the time it expires we will have committed, and the cache
- # will be valid again. See "Scaling Django" by Mike Malone, slide 30.
- cache.set(cache_key, None, INVALIDATE_TIMEOUT)
-
-
-def retrieve_latest(sender, latest_by=None):
- # we could break this down based on the request url, but it would probably
- # cost us more in query time to do so.
- cache_key = CACHE_LATEST_PREFIX + sender.__name__
- latest = cache.get(cache_key)
- if latest:
- return latest
- try:
- if latest_by is None:
- latest_by = sender._meta.get_latest_by
- latest = sender.objects.values(latest_by).latest(latest_by)[latest_by]
- # Using add means "don't overwrite anything in there". What could be in
- # there is an explicit None value that our refresh signal set, which
- # means we want to avoid race condition possibilities for a bit.
- cache.add(cache_key, latest, CACHE_TIMEOUT)
- return latest
- except sender.DoesNotExist:
- pass
- return None
-
-
def set_created_field(sender, **kwargs):
'''This will set the 'created' field on any object to the current UTC time
if it is unset.
diff --git a/mirrors/utils.py b/mirrors/utils.py
index fe18cd6a..930adb8d 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -21,9 +21,7 @@ def dictfetchall(cursor):
for row in cursor.fetchall()
]
-@cache_function(178)
-def status_data(cutoff=DEFAULT_CUTOFF, mirror_id=None):
- cutoff_time = now() - cutoff
+def status_data(cutoff_time, mirror_id=None):
if mirror_id is not None:
params = [cutoff_time, mirror_id]
mirror_where = 'AND u.mirror_id = %s'
@@ -84,19 +82,16 @@ GROUP BY l.url_id, u.mirror_id
def annotate_url(url, url_data):
'''Given a MirrorURL object, add a few more attributes to it regarding
status, including completion_pct, delay, and score.'''
- known_attrs = (
- ('success_count', 0),
- ('check_count', 0),
- ('completion_pct', None),
- ('duration_avg', None),
- ('duration_stddev', None),
- ('last_check', None),
- ('last_sync', None),
- ('delay', None),
- ('score', None),
- )
- for k, v in known_attrs:
- setattr(url, k, v)
+ # set up some sane default values in case we are missing anything
+ url.success_count = 0
+ url.check_count = 0
+ url.completion_pct = None
+ url.duration_avg = None
+ url.duration_stddev = None
+ url.last_check = None
+ url.last_sync = None
+ url.delay = None
+ url.score = None
for k, v in url_data.items():
if k not in ('url_id', 'mirror_id'):
setattr(url, k, v)
@@ -107,7 +102,7 @@ def annotate_url(url, url_data):
if url.delay is not None:
hours = url.delay.days * 24.0 + url.delay.seconds / 3600.0
- if url.completion_pct > 0:
+ if url.completion_pct > 0.0:
divisor = url.completion_pct
else:
# arbitrary small value
@@ -115,28 +110,26 @@ def annotate_url(url, url_data):
stddev = url.duration_stddev or 0.0
url.score = (hours + url.duration_avg + stddev) / divisor
+ return url
+
+@cache_function(178)
def get_mirror_statuses(cutoff=DEFAULT_CUTOFF, mirror_id=None, show_all=False):
cutoff_time = now() - cutoff
- valid_urls = MirrorUrl.objects.filter(
- logs__check_time__gte=cutoff_time).distinct()
-
+ urls = MirrorUrl.objects.select_related(
+ 'mirror', 'protocol').order_by('mirror__id', 'url')
if mirror_id:
- valid_urls = valid_urls.filter(mirror_id=mirror_id)
+ urls = urls.filter(mirror_id=mirror_id)
if not show_all:
- valid_urls = valid_urls.filter(active=True, mirror__active=True,
+ urls = urls.filter(active=True, mirror__active=True,
mirror__public=True)
- url_data = status_data(cutoff, mirror_id)
- urls = MirrorUrl.objects.select_related('mirror', 'protocol').filter(
- id__in=valid_urls).order_by('mirror__id', 'url')
-
if urls:
- for url in urls:
- annotate_url(url, url_data.get(url.id, {}))
- last_check = max([u.last_check for u in urls if u.last_check])
- num_checks = max([u.check_count for u in urls])
+ url_data = status_data(cutoff_time, mirror_id)
+ urls = [annotate_url(url, url_data.get(url.id, {})) for url in urls]
+ last_check = max([u.last_check for u in urls if u.last_check] or [None])
+ num_checks = max(u.check_count for u in urls)
check_info = MirrorLog.objects.filter(check_time__gte=cutoff_time)
if mirror_id:
check_info = check_info.filter(url__mirror_id=mirror_id)
@@ -148,6 +141,7 @@ def get_mirror_statuses(cutoff=DEFAULT_CUTOFF, mirror_id=None, show_all=False):
else:
check_frequency = None
else:
+ urls = []
last_check = None
num_checks = 0
check_frequency = None
@@ -195,23 +189,21 @@ def get_mirror_url_for_download(cutoff=DEFAULT_CUTOFF):
if status_data['check_time__max'] is not None:
min_check_time = status_data['check_time__max'] - timedelta(minutes=5)
min_sync_time = status_data['last_sync__max'] - timedelta(minutes=20)
- best_logs = MirrorLog.objects.filter(is_success=True,
+ best_logs = MirrorLog.objects.select_related('url').filter(
+ is_success=True,
check_time__gte=min_check_time, last_sync__gte=min_sync_time,
url__active=True,
url__mirror__public=True, url__mirror__active=True,
url__protocol__default=True).order_by(
'duration')[:1]
if best_logs:
- return MirrorUrl.objects.get(id=best_logs[0].url_id)
+ return best_logs[0].url
mirror_urls = MirrorUrl.objects.filter(active=True,
- mirror__public=True, mirror__active=True, protocol__default=True)
- # look first for a country-agnostic URL, then fall back to any HTTP URL
- filtered_urls = mirror_urls.filter(country='')[:1]
- if not filtered_urls:
- filtered_urls = mirror_urls[:1]
- if not filtered_urls:
+ mirror__public=True, mirror__active=True,
+ protocol__default=True)[:1]
+ if not mirror_urls:
return None
- return filtered_urls[0]
+ return mirror_urls[0]
# vim: set ts=4 sw=4 et:
diff --git a/mirrors/views.py b/mirrors/views.py
index 26b5b802..cffafbf5 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -6,10 +6,12 @@ from operator import attrgetter, itemgetter
from django import forms
from django.forms.widgets import CheckboxSelectMultiple
from django.core.serializers.json import DjangoJSONEncoder
+from django.db import connection
from django.db.models import Q
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.timezone import now
+from django.views.decorators.cache import cache_page
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import condition
from django_countries.data import COUNTRIES
@@ -191,6 +193,8 @@ def mirror_details(request, name):
def mirror_details_json(request, name):
authorized = request.user.is_authenticated()
mirror = get_object_or_404(Mirror, name=name)
+ if not authorized and (not mirror.public or not mirror.active):
+ raise Http404
status_info = get_mirror_statuses(mirror_id=mirror.id,
show_all=authorized)
data = status_info.copy()
@@ -222,7 +226,9 @@ def url_details(request, name, url_id):
def status_last_modified(request, *args, **kwargs):
- return MirrorLog.objects.values_list('check_time', flat=True).latest()
+ cursor = connection.cursor()
+ cursor.execute("SELECT MAX(check_time) FROM mirrors_mirrorlog")
+ return cursor.fetchone()[0]
@condition(last_modified_func=status_last_modified)
@@ -242,7 +248,10 @@ def status(request, tier=None):
if tier is not None and url.mirror.tier != tier:
continue
# split them into good and bad lists based on delay
- if not url.delay or url.delay > bad_timedelta:
+ if url.completion_pct is None:
+ # skip URLs that have never been checked
+ continue
+ elif not url.delay or url.delay > bad_timedelta:
bad_urls.append(url)
else:
good_urls.append(url)
@@ -272,9 +281,6 @@ class MirrorStatusJSONEncoder(DjangoJSONEncoder):
if isinstance(obj, timedelta):
# always returned as integer seconds
return obj.days * 24 * 3600 + obj.seconds
- if hasattr(obj, '__iter__'):
- # mainly for queryset serialization
- return list(obj)
if isinstance(obj, MirrorUrl):
data = {attr: getattr(obj, attr) for attr in self.url_attributes}
country = obj.country
@@ -295,14 +301,15 @@ class ExtendedMirrorStatusJSONEncoder(MirrorStatusJSONEncoder):
if isinstance(obj, MirrorUrl):
data = super(ExtendedMirrorStatusJSONEncoder, self).default(obj)
cutoff = now() - DEFAULT_CUTOFF
- data['logs'] = obj.logs.filter(
- check_time__gte=cutoff).order_by('check_time')
+ data['logs'] = list(obj.logs.filter(
+ check_time__gte=cutoff).order_by('check_time'))
return data
if isinstance(obj, MirrorLog):
return {attr: getattr(obj, attr) for attr in self.log_attributes}
return super(ExtendedMirrorStatusJSONEncoder, self).default(obj)
+@cache_page(67)
@condition(last_modified_func=status_last_modified)
def status_json(request, tier=None):
if tier is not None:
@@ -323,9 +330,6 @@ class LocationJSONEncoder(DjangoJSONEncoder):
'''Base JSONEncoder extended to handle CheckLocation objects.'''
def default(self, obj):
- if hasattr(obj, '__iter__'):
- # mainly for queryset serialization
- return list(obj)
if isinstance(obj, CheckLocation):
return {
'id': obj.pk,
@@ -341,7 +345,7 @@ class LocationJSONEncoder(DjangoJSONEncoder):
def locations_json(request):
data = {}
data['version'] = 1
- data['locations'] = CheckLocation.objects.all().order_by('pk')
+ data['locations'] = list(CheckLocation.objects.all().order_by('pk'))
to_json = json.dumps(data, ensure_ascii=False, cls=LocationJSONEncoder)
response = HttpResponse(to_json, content_type='application/json')
return response
diff --git a/news/models.py b/news/models.py
index d51db7c7..985c1088 100644
--- a/news/models.py
+++ b/news/models.py
@@ -45,12 +45,9 @@ def set_news_fields(sender, **kwargs):
news.guid = 'tag:%s,%s:%s' % (Site.objects.get_current(),
current_time.strftime('%Y-%m-%d'), news.get_absolute_url())
-# connect signals needed to keep cache in line with reality
-from main.utils import refresh_latest
-from django.db.models.signals import pre_save, post_save
-post_save.connect(refresh_latest, sender=News,
- dispatch_uid="news.models")
+from django.db.models.signals import pre_save
+
pre_save.connect(set_news_fields, sender=News,
dispatch_uid="news.models")
diff --git a/packages/models.py b/packages/models.py
index dd69e7d3..03f03422 100644
--- a/packages/models.py
+++ b/packages/models.py
@@ -379,6 +379,13 @@ class RelatedToBase(models.Model):
given criteria. It will not search provisions, but will find packages
named and matching repo characteristics if possible.'''
pkgs = Package.objects.normal().filter(pkgname=self.name)
+ # TODO: this may in fact be faster- select only the fields we know will
+ # actually get used, saving us some bandwidth and hopefully query
+ # construction time. However, reality hasn't quite proved it out yet.
+ #pkgs = Package.objects.select_related('repo', 'arch').only(
+ # 'id', 'pkgname', 'epoch', 'pkgver', 'pkgrel',
+ # 'repo__id', 'repo__name', 'repo__testing', 'repo__staging',
+ # 'arch__id', 'arch__name').filter(pkgname=self.name)
if not self.pkg.arch.agnostic:
# make sure we match architectures if possible
arches = self.pkg.applicable_arches()
diff --git a/packages/templatetags/jinja2.py b/packages/templatetags/jinja2.py
new file mode 100644
index 00000000..a07f87bd
--- /dev/null
+++ b/packages/templatetags/jinja2.py
@@ -0,0 +1,92 @@
+from urllib import urlencode, quote as urlquote, unquote
+from django.utils.html import escape
+from django_jinja import library
+from main.templatetags import pgp
+
+
+@library.filter
+def url_unquote(original_url):
+ try:
+ url = original_url
+ if isinstance(url, unicode):
+ url = url.encode('ascii')
+ url = unquote(url).decode('utf-8')
+ return url
+ except UnicodeError:
+ return original_url
+
+
+def link_encode(url, query):
+ # massage the data into all utf-8 encoded strings first, so urlencode
+ # doesn't barf at the data we pass it
+ query = {k: unicode(v).encode('utf-8') for k, v in query.items()}
+ data = urlencode(query)
+ return "%s?%s" % (url, data)
+
+
+@library.global_function
+def pgp_key_link(key_id, link_text=None):
+ return pgp.pgp_key_link(key_id, link_text)
+
+
+@library.global_function
+def scm_link(package, operation):
+ parts = ("abslibre", operation, package.repo.name.lower(), package.pkgbase)
+ linkbase = (
+ "https://projects.parabola.nu/%s.git/%s/%s/%s")
+ return linkbase % tuple(urlquote(part.encode('utf-8')) for part in parts)
+
+
+@library.global_function
+def wiki_link(package):
+ url = "https://wiki.parabola.nu/index.php"
+ data = {
+ 'title': "Special:Search",
+ 'search': package.pkgname,
+ }
+ return link_encode(url, data)
+
+@library.global_function
+def bugs_list(package):
+ if package.arch.name == 'mips64el':
+ project = "mips64el"
+ else:
+ project = "issue-tracker"
+ url = "https://labs.parabola.nu/projects/%s/search" % project
+ data = {
+ 'titles_only': '1',
+ 'issues': '1',
+ 'q': package.pkgname,
+ }
+ return link_encode(url, data)
+
+
+@library.global_function
+def bug_report(package):
+ url = "https://labs.parabola.nu/projects/"
+ if package.arch.name == 'mips64el':
+ url = url + "mips64el/issues/new"
+ else:
+ url = url + "issue-tracker/issues/new"
+ data = {
+ 'issue[subject]': '[%s] PLEASE ENTER SUMMARY' % package.pkgname,
+ }
+ return link_encode(url, data)
+
+@library.global_function
+def flag_unfree(package):
+ url = "https://labs.parabola.nu/projects/"
+ if package.arch.name == 'mips64el':
+ url = url + "mips64el/issues/new"
+ else:
+ url = url + "issue-tracker/issues/new"
+ data = {
+ 'issue[tracker_id]': '4', # "freedom issue"
+ 'issue[priority_id]': '1', # "freedom issue"
+ 'issue[watcher_user_ids][]': '62', # "dev-list"
+ 'issue[subject]': '[%s] Please put your reasons here (register first if you haven\'t)' % package.pkgname,
+ }
+ return link_encode(url, data)
+
+
+# vim: set ts=4 sw=4 et:
diff --git a/packages/templatetags/package_extras.py b/packages/templatetags/package_extras.py
index e022116a..73a39092 100644
--- a/packages/templatetags/package_extras.py
+++ b/packages/templatetags/package_extras.py
@@ -1,33 +1,13 @@
-from urllib import urlencode, quote as urlquote, unquote
+from urllib import urlencode
try:
from urlparse import parse_qs
except ImportError:
from cgi import parse_qs
from django import template
-from django.utils.html import escape
-
-register = template.Library()
-
-
-def link_encode(url, query):
- # massage the data into all utf-8 encoded strings first, so urlencode
- # doesn't barf at the data we pass it
- query = {k: unicode(v).encode('utf-8') for k, v in query.items()}
- data = urlencode(query).replace('&', '&amp;')
- return "%s?%s" % (url, data)
-@register.filter
-def url_unquote(original_url):
- try:
- url = original_url
- if isinstance(url, unicode):
- url = url.encode('ascii')
- url = unquote(url).decode('utf-8')
- return url
- except UnicodeError:
- return original_url
+register = template.Library()
class BuildQueryStringNode(template.Node):
@@ -79,94 +59,4 @@ def pkg_details_link(pkg, link_title=None, honor_flagged=False):
return link % (pkg.get_absolute_url(), pkg.pkgname, link_content)
-@register.simple_tag
-def multi_pkg_details(pkgs):
- return ', '.join([pkg_details_link(pkg) for pkg in pkgs])
-
-
-@register.simple_tag
-def maintainer_link(user):
- if user:
- # TODO don't hardcode
- title = escape('View packages maintained by ' + user.get_full_name())
- return '<a href="/packages/?maintainer=%s" title="%s">%s</a>' % (
- user.username,
- title,
- user.get_full_name(),
- )
- return ''
-
-
-@register.simple_tag
-def packager_link(user):
- if user:
- # TODO don't hardcode
- title = escape('View packages packaged by ' + user.get_full_name())
- return '<a href="/packages/?packager=%s" title="%s">%s</a>' % (
- user.username,
- title,
- user.get_full_name(),
- )
- return ''
-
-
-@register.simple_tag
-def scm_link(package, operation):
- parts = ("abslibre", operation, package.repo.name.lower(), package.pkgbase)
- linkbase = (
- "https://projects.parabola.nu/%s.git/%s/%s/%s")
- return linkbase % tuple(urlquote(part.encode('utf-8')) for part in parts)
-
-
-@register.simple_tag
-def get_wiki_link(package):
- url = "https://wiki.parabola.nu/index.php"
- data = {
- 'title': "Special:Search",
- 'search': package.pkgname,
- }
- return link_encode(url, data)
-
-@register.simple_tag
-def bugs_list(package):
- if package.arch.name == 'mips64el':
- project = "mips64el"
- else:
- project = "issue-tracker"
- url = "https://labs.parabola.nu/projects/%s/search" % project
- data = {
- 'titles_only': '1',
- 'issues': '1',
- 'q': package.pkgname,
- }
- return link_encode(url, data)
-
-
-@register.simple_tag
-def bug_report(package):
- url = "https://labs.parabola.nu/projects/"
- if package.arch.name == 'mips64el':
- url = url + "mips64el/issues/new"
- else:
- url = url + "issue-tracker/issues/new"
- data = {
- 'issue[subject]': '[%s] PLEASE ENTER SUMMARY' % package.pkgname,
- }
- return link_encode(url, data)
-
-@register.simple_tag
-def flag_unfree(package):
- url = "https://labs.parabola.nu/projects/"
- if package.arch.name == 'mips64el':
- url = url + "mips64el/issues/new"
- else:
- url = url + "issue-tracker/issues/new"
- data = {
- 'issue[tracker_id]': '4', # "freedom issue"
- 'issue[priority_id]': '1', # "freedom issue"
- 'issue[watcher_user_ids][]': '62', # "dev-list"
- 'issue[subject]': '[%s] Please put your reasons here (register first if you haven\'t)' % package.pkgname,
- }
- return link_encode(url, data)
-
# vim: set ts=4 sw=4 et:
diff --git a/packages/views/__init__.py b/packages/views/__init__.py
index 1f8a0169..f3d64548 100644
--- a/packages/views/__init__.py
+++ b/packages/views/__init__.py
@@ -35,7 +35,7 @@ def opensearch(request):
@require_safe
-@cache_control(public=True, max_age=300)
+@cache_control(public=True, max_age=613)
def opensearch_suggest(request):
search_term = request.GET.get('q', '')
if search_term == '':
@@ -55,7 +55,7 @@ def opensearch_suggest(request):
'pkgname', flat=True).order_by('pkgname').distinct()[:10]
results = [search_term, list(names)]
to_json = json.dumps(results, ensure_ascii=False)
- cache.set(cache_key, to_json, 300)
+ cache.set(cache_key, to_json, 613)
return HttpResponse(to_json, content_type='application/x-suggestions+json')
diff --git a/packages/views/search.py b/packages/views/search.py
index b3778172..0b776d79 100644
--- a/packages/views/search.py
+++ b/packages/views/search.py
@@ -45,6 +45,12 @@ class PackageSearchForm(forms.Form):
[('', 'All'), ('unknown', 'Unknown')] + \
[(m.username, m.get_full_name()) for m in maints]
+ def exact_matches(self):
+ # only do exact match search if 'q' is sole parameter
+ if self.changed_data != ['q']:
+ return []
+ return Package.objects.normal().filter(pkgname=self.cleaned_data['q'])
+
def parse_form(form, packages):
if form.cleaned_data['repo']:
diff --git a/public/views.py b/public/views.py
index 19a62fca..0b245071 100644
--- a/public/views.py
+++ b/public/views.py
@@ -17,7 +17,7 @@ from releng.models import Release
from .utils import get_recent_updates
-@cache_control(max_age=300)
+@cache_control(max_age=307)
def index(request):
if request.user.is_authenticated():
def updates():
@@ -45,7 +45,7 @@ USER_LISTS = {
}
-@cache_control(max_age=300)
+@cache_control(max_age=307)
def userlist(request, user_type='hackers'):
users = User.objects.order_by(
'username').select_related('userprofile')
@@ -63,7 +63,7 @@ def userlist(request, user_type='hackers'):
return render(request, 'public/userlist.html', context)
-@cache_control(max_age=300)
+@cache_control(max_age=307)
def donate(request):
context = {
'donors': Donor.objects.filter(visible=True).order_by('name'),
@@ -81,11 +81,11 @@ def _mirror_urls():
return sorted(urls, key=sort_by)
-@cache_control(max_age=300)
+@cache_control(max_age=307)
def download(request):
return HttpResponseRedirect('https://wiki.parabola.nu/Get_Parabola')
-@cache_control(max_age=300)
+@cache_control(max_age=307)
def feeds(request):
repos = Repo.objects.all()
if not request.user.is_authenticated():
@@ -97,7 +97,7 @@ def feeds(request):
return render(request, 'public/feeds.html', context)
-@cache_control(max_age=300)
+@cache_control(max_age=307)
def keys(request):
users = User.objects.filter(is_active=True).select_related(
'userprofile__pgp_key').order_by('first_name', 'last_name')
@@ -134,7 +134,7 @@ def keys(request):
return render(request, 'public/keys.html', context)
-@cache_page(1800)
+@cache_page(1789)
def keys_json(request):
node_list = []
diff --git a/releng/admin.py b/releng/admin.py
index c7e6396e..9c93c4be 100644
--- a/releng/admin.py
+++ b/releng/admin.py
@@ -18,6 +18,7 @@ class ReleaseAdmin(admin.ModelAdmin):
list_display = ('version', 'release_date', 'kernel_version', 'available',
'created')
list_filter = ('available', 'release_date')
+ readonly_fields = ('created', 'last_modified')
SIMPLE_MODELS = (Architecture, BootType, Bootloader, ClockChoice, Filesystem,
diff --git a/releng/migrations/0002_release_last_modified.py b/releng/migrations/0002_release_last_modified.py
new file mode 100644
index 00000000..58502452
--- /dev/null
+++ b/releng/migrations/0002_release_last_modified.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import datetime
+from django.utils.timezone import utc
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('releng', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='release',
+ name='last_modified',
+ field=models.DateTimeField(default=datetime.datetime(2001, 1, 1, tzinfo=utc), editable=False),
+ preserve_default=False,
+ ),
+ ]
diff --git a/releng/migrations/0003_release_populate_last_modified.py b/releng/migrations/0003_release_populate_last_modified.py
new file mode 100644
index 00000000..ec7b6fda
--- /dev/null
+++ b/releng/migrations/0003_release_populate_last_modified.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+def forwards(apps, schema_editor):
+ Release = apps.get_model('releng', 'Release')
+ Release.objects.update(last_modified=models.F('created'))
+
+def backwards(apps, schema_editor):
+ pass
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('releng', '0002_release_last_modified'),
+ ]
+
+ operations = [
+ migrations.RunPython(forwards, backwards)
+ ]
diff --git a/releng/models.py b/releng/models.py
index 66690e81..2f9216bd 100644
--- a/releng/models.py
+++ b/releng/models.py
@@ -120,6 +120,7 @@ class Release(models.Model):
md5_sum = models.CharField('MD5 digest', max_length=32, blank=True)
sha1_sum = models.CharField('SHA1 digest', max_length=40, blank=True)
created = models.DateTimeField(editable=False)
+ last_modified = models.DateTimeField(editable=False)
available = models.BooleanField(default=True)
info = models.TextField('Public information', blank=True)
torrent_data = models.TextField(blank=True,
diff --git a/releng/views.py b/releng/views.py
index af25b966..0fb55b29 100644
--- a/releng/views.py
+++ b/releng/views.py
@@ -247,9 +247,6 @@ class ReleaseJSONEncoder(DjangoJSONEncoder):
'created', 'md5_sum', 'sha1_sum')
def default(self, obj):
- if hasattr(obj, '__iter__'):
- # mainly for queryset serialization
- return list(obj)
if isinstance(obj, Release):
data = {attr: getattr(obj, attr) or None
for attr in self.release_attributes}
@@ -276,7 +273,7 @@ def releases_json(request):
data = {
'version': 1,
- 'releases': releases,
+ 'releases': list(releases),
'latest_version': latest_version,
}
to_json = json.dumps(data, ensure_ascii=False, cls=ReleaseJSONEncoder)
diff --git a/requirements.txt b/requirements.txt
index eff75bad..e1acd2e9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,9 +1,11 @@
-e git+git://github.com/fredj/cssmin.git@master#egg=cssmin
--e git+git://github.com/SmileyChris/django-countries.git@a2c924074dbe2f0b9b3059bf70064aeadf5643ed#egg=django-countries
-Django==1.7
+Django==1.7.1
IPy==0.81
+Jinja2==2.7.3
Markdown==2.4.1
bencode==1.0
+django-jinja==1.0.4
+django_countries==3.0.1
jsmin==2.0.11
pgpdump==1.5
pytz>=2014.7
diff --git a/requirements_prod.txt b/requirements_prod.txt
index c181c3af..ef535eb8 100644
--- a/requirements_prod.txt
+++ b/requirements_prod.txt
@@ -1,9 +1,11 @@
-e git+git://github.com/fredj/cssmin.git@master#egg=cssmin
--e git+git://github.com/SmileyChris/django-countries.git@a2c924074dbe2f0b9b3059bf70064aeadf5643ed#egg=django-countries
-Django==1.7
+Django==1.7.1
IPy==0.81
+Jinja2==2.7.3
Markdown==2.4.1
bencode==1.0
+django-jinja==1.0.4
+django_countries==3.0.1
jsmin==2.0.11
pgpdump==1.5
psycopg2==2.5.4
diff --git a/settings.py b/settings.py
index 074b3749..5ee17af3 100644
--- a/settings.py
+++ b/settings.py
@@ -61,11 +61,13 @@ TEMPLATE_DIRS = (
)
TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.eggs.Loader',
- 'django.template.loaders.app_directories.Loader',
+ 'django_jinja.loaders.FileSystemLoader',
+ 'django_jinja.loaders.AppLoader',
)
+# Send templates matching the following to the Jinja2 engine
+DEFAULT_JINJA2_TEMPLATE_EXTENSION = '.jinja'
+
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
@@ -116,6 +118,7 @@ INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.staticfiles',
'django_countries',
+ 'django_jinja',
'main',
'mirrors',
@@ -186,14 +189,14 @@ TORRENT_TRACKERS = (
'udp://tracker.istole.it:80',
)
-DOMAIN_RE = r'^(.+\.)?parabola.nu$'
+DOMAIN_RE = r'^(.+\.)?parabola(\.nu|gnulinux\.org)$'
BRANDING_APPNAME = 'parabolaweb'
BRANDING_DISTRONAME = 'Parabola GNU/Linux-libre'
BRANDING_SHORTNAME = 'Parabola'
BRANDING_SLUG = 'parabola'
BRANDING_WIKINAME = 'ParabolaWiki'
-BRANDING_EMAIL = 'Parabola Website Notification <nobody@repo.parabola.nu>'
+BRANDING_EMAIL = 'Parabola Website Notification <nobody@parabola.nu>'
BRANDING_OSEARCH_TAGS = 'gnu linuxlibre parabola package software'
## Import local settings
@@ -204,6 +207,7 @@ if not TEMPLATE_DEBUG:
TEMPLATE_LOADERS = (
('django.template.loaders.cached.Loader', TEMPLATE_LOADERS),
)
+ JINJA2_BYTECODE_CACHE_ENABLE = True
# Enable the debug toolbar if requested
if DEBUG_TOOLBAR:
diff --git a/sitestatic/.gitignore b/sitestatic/.gitignore
new file mode 100644
index 00000000..2009cb1d
--- /dev/null
+++ b/sitestatic/.gitignore
@@ -0,0 +1,18 @@
+sitestatic/bootstrap-typeahead.js
+sitestatic/bootstrap-typeahead.min.js
+sitestatic/homepage.js
+sitestatic/homepage.min.js
+sitestatic/jquery-1.8.3.js
+sitestatic/jquery-1.8.3.min.js
+sitestatic/jquery.tablesorter-2.7.js
+sitestatic/jquery.tablesorter-2.7.min.js
+sitestatic/konami.js
+sitestatic/konami.min.js
+sitestatic/favicon.ico
+sitestatic/silhouette.png
+sitestatic/archnavbar/archlogo.png
+sitestatic/logos/apple-touch-icon-114x114.png
+sitestatic/logos/apple-touch-icon-144x144.png
+sitestatic/logos/apple-touch-icon-57x57.png
+sitestatic/logos/apple-touch-icon-72x72.png
+sitestatic/logos/icon-transparent-64x64.png
diff --git a/sitestatic/Makefile b/sitestatic/Makefile
deleted file mode 100644
index d716992f..00000000
--- a/sitestatic/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-include ../common.mk
-
-jquery-ver=1.8.3
-bootstrap-ver=2.1.1
-tablesorter-ver=2.7
-targets = \
- bootstrap-typeahead \
- jquery-$(jquery-ver) \
- jquery.tablesorter-$(tablesorter-ver) \
- konami
-
-target-files=$(addsuffix .js,$(targets)) $(addsuffix .min.js,$(targets)) favicon.ico silhouette.png
-all: $(target-files)
-clean:
- rm -f -- $(target-files)
-
-bootstrap-typeahead.js: %: $(www)/https/raw.github.com/twitter/bootstrap/v$(bootstrap-ver)/js/%
- cp $< $@
-jquery-$(jquery-ver).js: %: $(www)/http/code.jquery.com/%
- cp $< $@
-jquery.tablesorter-$(tablesorter-ver).js: $(www)/https/raw.github.com/Mottie/tablesorter/v$(tablesorter-ver)/js/jquery.tablesorter.js
- cp $< $@
-konami.js: %: $(www)/https/raw.github.com/snaptortoise/konami-js/master/%
- cp $< $@
-
-favicon.ico silhouette.png: %: $(branding)/%
- cp $< $@
diff --git a/sitestatic/archnavbar/Makefile b/sitestatic/archnavbar/Makefile
deleted file mode 100644
index a4b5e777..00000000
--- a/sitestatic/archnavbar/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-include ../../common.mk
-
-all: archlogo.png
-clean:
- rm -f archlogo.png
-
-archlogo.png: %: $(branding)/%
- cp $< $@
diff --git a/sitestatic/archnavbar/archlogo.png b/sitestatic/archnavbar/archlogo.png
deleted file mode 100644
index 8726397a..00000000
--- a/sitestatic/archnavbar/archlogo.png
+++ /dev/null
Binary files differ
diff --git a/sitestatic/archweb.css b/sitestatic/archweb.css
index 0bd327cd..0a16687e 100644
--- a/sitestatic/archweb.css
+++ b/sitestatic/archweb.css
@@ -677,6 +677,10 @@ table.results {
color: red;
}
+ .results tr.empty td {
+ text-align: center;
+ }
+
/* pkglist: layout */
#pkglist-about {
margin-top: 1.5em;
diff --git a/sitestatic/bootstrap-typeahead.js b/sitestatic/bootstrap-typeahead.js
deleted file mode 100644
index c2ccdea2..00000000
--- a/sitestatic/bootstrap-typeahead.js
+++ /dev/null
@@ -1,300 +0,0 @@
-/* =============================================================
- * bootstrap-typeahead.js v2.1.1
- * http://twitter.github.com/bootstrap/javascript.html#typeahead
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function($){
-
- "use strict"; // jshint ;_;
-
-
- /* TYPEAHEAD PUBLIC CLASS DEFINITION
- * ================================= */
-
- var Typeahead = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.typeahead.defaults, options)
- this.matcher = this.options.matcher || this.matcher
- this.sorter = this.options.sorter || this.sorter
- this.highlighter = this.options.highlighter || this.highlighter
- this.updater = this.options.updater || this.updater
- this.$menu = $(this.options.menu).appendTo('body')
- this.source = this.options.source
- this.shown = false
- this.listen()
- }
-
- Typeahead.prototype = {
-
- constructor: Typeahead
-
- , select: function () {
- var val = this.$menu.find('.active').attr('data-value')
- this.$element
- .val(this.updater(val))
- .change()
- return this.hide()
- }
-
- , updater: function (item) {
- return item
- }
-
- , show: function () {
- var pos = $.extend({}, this.$element.offset(), {
- height: this.$element[0].offsetHeight
- })
-
- this.$menu.css({
- top: pos.top + pos.height
- , left: pos.left
- })
-
- this.$menu.show()
- this.shown = true
- return this
- }
-
- , hide: function () {
- this.$menu.hide()
- this.shown = false
- return this
- }
-
- , lookup: function (event) {
- var items
-
- this.query = this.$element.val()
-
- if (!this.query || this.query.length < this.options.minLength) {
- return this.shown ? this.hide() : this
- }
-
- items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
-
- return items ? this.process(items) : this
- }
-
- , process: function (items) {
- var that = this
-
- items = $.grep(items, function (item) {
- return that.matcher(item)
- })
-
- items = this.sorter(items)
-
- if (!items.length) {
- return this.shown ? this.hide() : this
- }
-
- return this.render(items.slice(0, this.options.items)).show()
- }
-
- , matcher: function (item) {
- return ~item.toLowerCase().indexOf(this.query.toLowerCase())
- }
-
- , sorter: function (items) {
- var beginswith = []
- , caseSensitive = []
- , caseInsensitive = []
- , item
-
- while (item = items.shift()) {
- if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
- else if (~item.indexOf(this.query)) caseSensitive.push(item)
- else caseInsensitive.push(item)
- }
-
- return beginswith.concat(caseSensitive, caseInsensitive)
- }
-
- , highlighter: function (item) {
- var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
- return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
- return '<strong>' + match + '</strong>'
- })
- }
-
- , render: function (items) {
- var that = this
-
- items = $(items).map(function (i, item) {
- i = $(that.options.item).attr('data-value', item)
- i.find('a').html(that.highlighter(item))
- return i[0]
- })
-
- items.first().addClass('active')
- this.$menu.html(items)
- return this
- }
-
- , next: function (event) {
- var active = this.$menu.find('.active').removeClass('active')
- , next = active.next()
-
- if (!next.length) {
- next = $(this.$menu.find('li')[0])
- }
-
- next.addClass('active')
- }
-
- , prev: function (event) {
- var active = this.$menu.find('.active').removeClass('active')
- , prev = active.prev()
-
- if (!prev.length) {
- prev = this.$menu.find('li').last()
- }
-
- prev.addClass('active')
- }
-
- , listen: function () {
- this.$element
- .on('blur', $.proxy(this.blur, this))
- .on('keypress', $.proxy(this.keypress, this))
- .on('keyup', $.proxy(this.keyup, this))
-
- if ($.browser.chrome || $.browser.webkit || $.browser.msie) {
- this.$element.on('keydown', $.proxy(this.keydown, this))
- }
-
- this.$menu
- .on('click', $.proxy(this.click, this))
- .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
- }
-
- , move: function (e) {
- if (!this.shown) return
-
- switch(e.keyCode) {
- case 9: // tab
- case 13: // enter
- case 27: // escape
- e.preventDefault()
- break
-
- case 38: // up arrow
- e.preventDefault()
- this.prev()
- break
-
- case 40: // down arrow
- e.preventDefault()
- this.next()
- break
- }
-
- e.stopPropagation()
- }
-
- , keydown: function (e) {
- this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27])
- this.move(e)
- }
-
- , keypress: function (e) {
- if (this.suppressKeyPressRepeat) return
- this.move(e)
- }
-
- , keyup: function (e) {
- switch(e.keyCode) {
- case 40: // down arrow
- case 38: // up arrow
- break
-
- case 9: // tab
- case 13: // enter
- if (!this.shown) return
- this.select()
- break
-
- case 27: // escape
- if (!this.shown) return
- this.hide()
- break
-
- default:
- this.lookup()
- }
-
- e.stopPropagation()
- e.preventDefault()
- }
-
- , blur: function (e) {
- var that = this
- setTimeout(function () { that.hide() }, 150)
- }
-
- , click: function (e) {
- e.stopPropagation()
- e.preventDefault()
- this.select()
- }
-
- , mouseenter: function (e) {
- this.$menu.find('.active').removeClass('active')
- $(e.currentTarget).addClass('active')
- }
-
- }
-
-
- /* TYPEAHEAD PLUGIN DEFINITION
- * =========================== */
-
- $.fn.typeahead = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('typeahead')
- , options = typeof option == 'object' && option
- if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.typeahead.defaults = {
- source: []
- , items: 8
- , menu: '<ul class="typeahead dropdown-menu"></ul>'
- , item: '<li><a href="#"></a></li>'
- , minLength: 1
- }
-
- $.fn.typeahead.Constructor = Typeahead
-
-
- /* TYPEAHEAD DATA-API
- * ================== */
-
- $(function () {
- $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
- var $this = $(this)
- if ($this.data('typeahead')) return
- e.preventDefault()
- $this.typeahead($this.data())
- })
- })
-
-}(window.jQuery);
diff --git a/sitestatic/bootstrap-typeahead.min.js b/sitestatic/bootstrap-typeahead.min.js
deleted file mode 100644
index 3e0e833c..00000000
--- a/sitestatic/bootstrap-typeahead.min.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* =============================================================
- * bootstrap-typeahead.js v2.1.1
- * http://twitter.github.com/bootstrap/javascript.html#typeahead
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-!function(b){var g=function(a,c){this.$element=b(a);this.options=b.extend({},b.fn.typeahead.defaults,c);this.matcher=this.options.matcher||this.matcher;this.sorter=this.options.sorter||this.sorter;this.highlighter=this.options.highlighter||this.highlighter;this.updater=this.options.updater||this.updater;this.$menu=b(this.options.menu).appendTo("body");this.source=this.options.source;this.shown=!1;this.listen()};g.prototype={constructor:g,select:function(){var a=this.$menu.find(".active").attr("data-value");
-this.$element.val(this.updater(a)).change();return this.hide()},updater:function(a){return a},show:function(){var a=b.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});this.$menu.css({top:a.top+a.height,left:a.left});this.$menu.show();this.shown=!0;return this},hide:function(){this.$menu.hide();this.shown=!1;return this},lookup:function(a){this.query=this.$element.val();return!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(a=b.isFunction(this.source)?
-this.source(this.query,b.proxy(this.process,this)):this.source)?this.process(a):this},process:function(a){var c=this;a=b.grep(a,function(a){return c.matcher(a)});a=this.sorter(a);return a.length?this.render(a.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){for(var b=[],e=[],d=[],f;f=a.shift();)f.toLowerCase().indexOf(this.query.toLowerCase())?~f.indexOf(this.query)?e.push(f):d.push(f):
-b.push(f);return b.concat(e,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(a){var c=this;a=b(a).map(function(a,d){a=b(c.options.item).attr("data-value",d);a.find("a").html(c.highlighter(d));return a[0]});a.first().addClass("active");this.$menu.html(a);return this},next:function(a){a=this.$menu.find(".active").removeClass("active").next();a.length||
-(a=b(this.$menu.find("li")[0]));a.addClass("active")},prev:function(a){a=this.$menu.find(".active").removeClass("active").prev();a.length||(a=this.$menu.find("li").last());a.addClass("active")},listen:function(){this.$element.on("blur",b.proxy(this.blur,this)).on("keypress",b.proxy(this.keypress,this)).on("keyup",b.proxy(this.keyup,this));if(b.browser.chrome||b.browser.webkit||b.browser.msie)this.$element.on("keydown",b.proxy(this.keydown,this));this.$menu.on("click",b.proxy(this.click,this)).on("mouseenter",
-"li",b.proxy(this.mouseenter,this))},move:function(a){if(this.shown){switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault();this.prev();break;case 40:a.preventDefault(),this.next()}a.stopPropagation()}},keydown:function(a){this.suppressKeyPressRepeat=!~b.inArray(a.keyCode,[40,38,9,13,27]);this.move(a)},keypress:function(a){this.suppressKeyPressRepeat||this.move(a)},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;
-this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation();a.preventDefault()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation();a.preventDefault();this.select()},mouseenter:function(a){this.$menu.find(".active").removeClass("active");b(a.currentTarget).addClass("active")}};b.fn.typeahead=function(a){return this.each(function(){var c=b(this),e=c.data("typeahead"),d="object"==typeof a&&a;e||c.data("typeahead",
-e=new g(this,d));if("string"==typeof a)e[a]()})};b.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1};b.fn.typeahead.Constructor=g;b(function(){b("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(a){var c=b(this);c.data("typeahead")||(a.preventDefault(),c.typeahead(c.data()))})})}(window.jQuery);
diff --git a/sitestatic/favicon.ico b/sitestatic/favicon.ico
deleted file mode 100644
index c67bbd61..00000000
--- a/sitestatic/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/sitestatic/jquery-1.8.3.js b/sitestatic/jquery-1.8.3.js
deleted file mode 100644
index 8c24ffc6..00000000
--- a/sitestatic/jquery-1.8.3.js
+++ /dev/null
@@ -1,9472 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.8.3
- * http://jquery.com/
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- *
- * Copyright 2012 jQuery Foundation and other contributors
- * Released under the MIT license
- * http://jquery.org/license
- *
- * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
- */
-(function( window, undefined ) {
-var
- // A central reference to the root jQuery(document)
- rootjQuery,
-
- // The deferred used on DOM ready
- readyList,
-
- // Use the correct document accordingly with window argument (sandbox)
- document = window.document,
- location = window.location,
- navigator = window.navigator,
-
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$,
-
- // Save a reference to some core methods
- core_push = Array.prototype.push,
- core_slice = Array.prototype.slice,
- core_indexOf = Array.prototype.indexOf,
- core_toString = Object.prototype.toString,
- core_hasOwn = Object.prototype.hasOwnProperty,
- core_trim = String.prototype.trim,
-
- // Define a local copy of jQuery
- jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context, rootjQuery );
- },
-
- // Used for matching numbers
- core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
-
- // Used for detecting and trimming whitespace
- core_rnotwhite = /\S/,
- core_rspace = /\s+/,
-
- // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
-
- // A simple way to check for HTML strings
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
- rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
- // Match a standalone tag
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
-
- // JSON RegExp
- rvalidchars = /^[\],:{}\s]*$/,
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
- rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
- rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
-
- // Matches dashed string for camelizing
- rmsPrefix = /^-ms-/,
- rdashAlpha = /-([\da-z])/gi,
-
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return ( letter + "" ).toUpperCase();
- },
-
- // The ready event handler and self cleanup method
- DOMContentLoaded = function() {
- if ( document.addEventListener ) {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- } else if ( document.readyState === "complete" ) {
- // we're here because readyState === "complete" in oldIE
- // which is good enough for us to call the dom ready!
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
- },
-
- // [[Class]] -> type pairs
- class2type = {};
-
-jQuery.fn = jQuery.prototype = {
- constructor: jQuery,
- init: function( selector, context, rootjQuery ) {
- var match, elem, ret, doc;
-
- // Handle $(""), $(null), $(undefined), $(false)
- if ( !selector ) {
- return this;
- }
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this.context = this[0] = selector;
- this.length = 1;
- return this;
- }
-
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
-
- } else {
- match = rquickExpr.exec( selector );
- }
-
- // Match html or make sure no context is specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
- doc = ( context && context.nodeType ? context.ownerDocument || context : document );
-
- // scripts is true for back-compat
- selector = jQuery.parseHTML( match[1], doc, true );
- if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
- this.attr.call( selector, context, true );
- }
-
- return jQuery.merge( this, selector );
-
- // HANDLE: $(#id)
- } else {
- elem = document.getElementById( match[2] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id !== match[2] ) {
- return rootjQuery.find( selector );
- }
-
- // Otherwise, we inject the element directly into the jQuery object
- this.length = 1;
- this[0] = elem;
- }
-
- this.context = document;
- this.selector = selector;
- return this;
- }
-
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return ( context || rootjQuery ).find( selector );
-
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return rootjQuery.ready( selector );
- }
-
- if ( selector.selector !== undefined ) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
-
- return jQuery.makeArray( selector, this );
- },
-
- // Start with an empty selector
- selector: "",
-
- // The current version of jQuery being used
- jquery: "1.8.3",
-
- // The default length of a jQuery object is 0
- length: 0,
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- toArray: function() {
- return core_slice.call( this );
- },
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == null ?
-
- // Return a 'clean' array
- this.toArray() :
-
- // Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems, name, selector ) {
-
- // Build a new jQuery matched element set
- var ret = jQuery.merge( this.constructor(), elems );
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- ret.context = this.context;
-
- if ( name === "find" ) {
- ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
- } else if ( name ) {
- ret.selector = this.selector + "." + name + "(" + selector + ")";
- }
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- ready: function( fn ) {
- // Add the callback
- jQuery.ready.promise().done( fn );
-
- return this;
- },
-
- eq: function( i ) {
- i = +i;
- return i === -1 ?
- this.slice( i ) :
- this.slice( i, i + 1 );
- },
-
- first: function() {
- return this.eq( 0 );
- },
-
- last: function() {
- return this.eq( -1 );
- },
-
- slice: function() {
- return this.pushStack( core_slice.apply( this, arguments ),
- "slice", core_slice.call(arguments).join(",") );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
- end: function() {
- return this.prevObject || this.constructor(null);
- },
-
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: core_push,
- sort: [].sort,
- splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
-
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
- target = {};
- }
-
- // extend jQuery itself if only one argument is passed
- if ( length === i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
-
- } else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
-
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
-};
-
-jQuery.extend({
- noConflict: function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
- },
-
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
-
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
-
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
-
- // Handle when the DOM is ready
- ready: function( wait ) {
-
- // Abort if there are pending holds or we're already ready
- if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
- return;
- }
-
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( !document.body ) {
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
-
- // If there are functions bound, to execute
- readyList.resolveWith( document, [ jQuery ] );
-
- // Trigger any bound ready events
- if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger("ready").off("ready");
- }
- },
-
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
- },
-
- isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
- },
-
- isWindow: function( obj ) {
- return obj != null && obj == obj.window;
- },
-
- isNumeric: function( obj ) {
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
- },
-
- type: function( obj ) {
- return obj == null ?
- String( obj ) :
- class2type[ core_toString.call(obj) ] || "object";
- },
-
- isPlainObject: function( obj ) {
- // Must be an Object.
- // Because of IE, we also have to check the presence of the constructor property.
- // Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
-
- try {
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !core_hasOwn.call(obj, "constructor") &&
- !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
- return false;
- }
- } catch ( e ) {
- // IE8,9 Will throw exceptions on certain host objects #9897
- return false;
- }
-
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own.
-
- var key;
- for ( key in obj ) {}
-
- return key === undefined || core_hasOwn.call( obj, key );
- },
-
- isEmptyObject: function( obj ) {
- var name;
- for ( name in obj ) {
- return false;
- }
- return true;
- },
-
- error: function( msg ) {
- throw new Error( msg );
- },
-
- // data: string of html
- // context (optional): If specified, the fragment will be created in this context, defaults to document
- // scripts (optional): If true, will include scripts passed in the html string
- parseHTML: function( data, context, scripts ) {
- var parsed;
- if ( !data || typeof data !== "string" ) {
- return null;
- }
- if ( typeof context === "boolean" ) {
- scripts = context;
- context = 0;
- }
- context = context || document;
-
- // Single tag
- if ( (parsed = rsingleTag.exec( data )) ) {
- return [ context.createElement( parsed[1] ) ];
- }
-
- parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
- return jQuery.merge( [],
- (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
- },
-
- parseJSON: function( data ) {
- if ( !data || typeof data !== "string") {
- return null;
- }
-
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
- data = jQuery.trim( data );
-
- // Attempt to parse using the native JSON parser first
- if ( window.JSON && window.JSON.parse ) {
- return window.JSON.parse( data );
- }
-
- // Make sure the incoming data is actual JSON
- // Logic borrowed from http://json.org/json2.js
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
- .replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
-
- return ( new Function( "return " + data ) )();
-
- }
- jQuery.error( "Invalid JSON: " + data );
- },
-
- // Cross-browser xml parsing
- parseXML: function( data ) {
- var xml, tmp;
- if ( !data || typeof data !== "string" ) {
- return null;
- }
- try {
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
- } catch( e ) {
- xml = undefined;
- }
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
- jQuery.error( "Invalid XML: " + data );
- }
- return xml;
- },
-
- noop: function() {},
-
- // Evaluates a script in a global context
- // Workarounds based on findings by Jim Driscoll
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
- globalEval: function( data ) {
- if ( data && core_rnotwhite.test( data ) ) {
- // We use execScript on Internet Explorer
- // We use an anonymous function so that context is window
- // rather than jQuery in Firefox
- ( window.execScript || function( data ) {
- window[ "eval" ].call( window, data );
- } )( data );
- }
- },
-
- // Convert dashed to camelCase; used by the css and data modules
- // Microsoft forgot to hump their vendor prefix (#9572)
- camelCase: function( string ) {
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
- },
-
- // args is for internal usage only
- each: function( obj, callback, args ) {
- var name,
- i = 0,
- length = obj.length,
- isObj = length === undefined || jQuery.isFunction( obj );
-
- if ( args ) {
- if ( isObj ) {
- for ( name in obj ) {
- if ( callback.apply( obj[ name ], args ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.apply( obj[ i++ ], args ) === false ) {
- break;
- }
- }
- }
-
- // A special, fast, case for the most common use of each
- } else {
- if ( isObj ) {
- for ( name in obj ) {
- if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
- break;
- }
- }
- }
- }
-
- return obj;
- },
-
- // Use native String.trim function wherever possible
- trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
- function( text ) {
- return text == null ?
- "" :
- core_trim.call( text );
- } :
-
- // Otherwise use our own trimming functionality
- function( text ) {
- return text == null ?
- "" :
- ( text + "" ).replace( rtrim, "" );
- },
-
- // results is for internal usage only
- makeArray: function( arr, results ) {
- var type,
- ret = results || [];
-
- if ( arr != null ) {
- // The window, strings (and functions) also have 'length'
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- type = jQuery.type( arr );
-
- if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
- core_push.call( ret, arr );
- } else {
- jQuery.merge( ret, arr );
- }
- }
-
- return ret;
- },
-
- inArray: function( elem, arr, i ) {
- var len;
-
- if ( arr ) {
- if ( core_indexOf ) {
- return core_indexOf.call( arr, elem, i );
- }
-
- len = arr.length;
- i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
-
- for ( ; i < len; i++ ) {
- // Skip accessing in sparse arrays
- if ( i in arr && arr[ i ] === elem ) {
- return i;
- }
- }
- }
-
- return -1;
- },
-
- merge: function( first, second ) {
- var l = second.length,
- i = first.length,
- j = 0;
-
- if ( typeof l === "number" ) {
- for ( ; j < l; j++ ) {
- first[ i++ ] = second[ j ];
- }
-
- } else {
- while ( second[j] !== undefined ) {
- first[ i++ ] = second[ j++ ];
- }
- }
-
- first.length = i;
-
- return first;
- },
-
- grep: function( elems, callback, inv ) {
- var retVal,
- ret = [],
- i = 0,
- length = elems.length;
- inv = !!inv;
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( ; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
- }
- }
-
- return ret;
- },
-
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var value, key,
- ret = [],
- i = 0,
- length = elems.length,
- // jquery objects are treated as arrays
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
- // Go through the array, translating each of the items to their
- if ( isArray ) {
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
-
- // Go through every key on the object,
- } else {
- for ( key in elems ) {
- value = callback( elems[ key ], key, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
- }
-
- // Flatten any nested arrays
- return ret.concat.apply( [], ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- var tmp, args, proxy;
-
- if ( typeof context === "string" ) {
- tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
-
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
-
- // Simulated bind
- args = core_slice.call( arguments, 2 );
- proxy = function() {
- return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
- };
-
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || jQuery.guid++;
-
- return proxy;
- },
-
- // Multifunctional method to get and set values of a collection
- // The value/s can optionally be executed if it's a function
- access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
- var exec,
- bulk = key == null,
- i = 0,
- length = elems.length;
-
- // Sets many values
- if ( key && typeof key === "object" ) {
- for ( i in key ) {
- jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
- }
- chainable = 1;
-
- // Sets one value
- } else if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = pass === undefined && jQuery.isFunction( value );
-
- if ( bulk ) {
- // Bulk operations only iterate when executing function values
- if ( exec ) {
- exec = fn;
- fn = function( elem, key, value ) {
- return exec.call( jQuery( elem ), value );
- };
-
- // Otherwise they run against the entire set
- } else {
- fn.call( elems, value );
- fn = null;
- }
- }
-
- if ( fn ) {
- for (; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
- }
-
- chainable = 1;
- }
-
- return chainable ?
- elems :
-
- // Gets
- bulk ?
- fn.call( elems ) :
- length ? fn( elems[0], key ) : emptyGet;
- },
-
- now: function() {
- return ( new Date() ).getTime();
- }
-});
-
-jQuery.ready.promise = function( obj ) {
- if ( !readyList ) {
-
- readyList = jQuery.Deferred();
-
- // Catch cases where $(document).ready() is called after the browser event has already occurred.
- // we once tried to use readyState "interactive" here, but it caused issues like the one
- // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
- if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- setTimeout( jQuery.ready, 1 );
-
- // Standards-based browsers support DOMContentLoaded
- } else if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else {
- // Ensure firing before onload, maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var top = false;
-
- try {
- top = window.frameElement == null && document.documentElement;
- } catch(e) {}
-
- if ( top && top.doScroll ) {
- (function doScrollCheck() {
- if ( !jQuery.isReady ) {
-
- try {
- // Use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- top.doScroll("left");
- } catch(e) {
- return setTimeout( doScrollCheck, 50 );
- }
-
- // and execute any waiting functions
- jQuery.ready();
- }
- })();
- }
- }
- }
- return readyList.promise( obj );
-};
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-// String to Object options format cache
-var optionsCache = {};
-
-// Convert String-formatted options into Object-formatted ones and store in cache
-function createOptions( options ) {
- var object = optionsCache[ options ] = {};
- jQuery.each( options.split( core_rspace ), function( _, flag ) {
- object[ flag ] = true;
- });
- return object;
-}
-
-/*
- * Create a callback list using the following parameters:
- *
- * options: an optional list of space-separated options that will change how
- * the callback list behaves or a more traditional option object
- *
- * By default a callback list will act like an event callback list and can be
- * "fired" multiple times.
- *
- * Possible options:
- *
- * once: will ensure the callback list can only be fired once (like a Deferred)
- *
- * memory: will keep track of previous values and will call any callback added
- * after the list has been fired right away with the latest "memorized"
- * values (like a Deferred)
- *
- * unique: will ensure a callback can only be added once (no duplicate in the list)
- *
- * stopOnFalse: interrupt callings when a callback returns false
- *
- */
-jQuery.Callbacks = function( options ) {
-
- // Convert options from String-formatted to Object-formatted if needed
- // (we check in cache first)
- options = typeof options === "string" ?
- ( optionsCache[ options ] || createOptions( options ) ) :
- jQuery.extend( {}, options );
-
- var // Last fire value (for non-forgettable lists)
- memory,
- // Flag to know if list was already fired
- fired,
- // Flag to know if list is currently firing
- firing,
- // First callback to fire (used internally by add and fireWith)
- firingStart,
- // End of the loop when firing
- firingLength,
- // Index of currently firing callback (modified by remove if needed)
- firingIndex,
- // Actual callback list
- list = [],
- // Stack of fire calls for repeatable lists
- stack = !options.once && [],
- // Fire callbacks
- fire = function( data ) {
- memory = options.memory && data;
- fired = true;
- firingIndex = firingStart || 0;
- firingStart = 0;
- firingLength = list.length;
- firing = true;
- for ( ; list && firingIndex < firingLength; firingIndex++ ) {
- if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
- memory = false; // To prevent further calls using add
- break;
- }
- }
- firing = false;
- if ( list ) {
- if ( stack ) {
- if ( stack.length ) {
- fire( stack.shift() );
- }
- } else if ( memory ) {
- list = [];
- } else {
- self.disable();
- }
- }
- },
- // Actual Callbacks object
- self = {
- // Add a callback or a collection of callbacks to the list
- add: function() {
- if ( list ) {
- // First, we save the current length
- var start = list.length;
- (function add( args ) {
- jQuery.each( args, function( _, arg ) {
- var type = jQuery.type( arg );
- if ( type === "function" ) {
- if ( !options.unique || !self.has( arg ) ) {
- list.push( arg );
- }
- } else if ( arg && arg.length && type !== "string" ) {
- // Inspect recursively
- add( arg );
- }
- });
- })( arguments );
- // Do we need to add the callbacks to the
- // current firing batch?
- if ( firing ) {
- firingLength = list.length;
- // With memory, if we're not firing then
- // we should call right away
- } else if ( memory ) {
- firingStart = start;
- fire( memory );
- }
- }
- return this;
- },
- // Remove a callback from the list
- remove: function() {
- if ( list ) {
- jQuery.each( arguments, function( _, arg ) {
- var index;
- while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
- list.splice( index, 1 );
- // Handle firing indexes
- if ( firing ) {
- if ( index <= firingLength ) {
- firingLength--;
- }
- if ( index <= firingIndex ) {
- firingIndex--;
- }
- }
- }
- });
- }
- return this;
- },
- // Control if a given callback is in the list
- has: function( fn ) {
- return jQuery.inArray( fn, list ) > -1;
- },
- // Remove all callbacks from the list
- empty: function() {
- list = [];
- return this;
- },
- // Have the list do nothing anymore
- disable: function() {
- list = stack = memory = undefined;
- return this;
- },
- // Is it disabled?
- disabled: function() {
- return !list;
- },
- // Lock the list in its current state
- lock: function() {
- stack = undefined;
- if ( !memory ) {
- self.disable();
- }
- return this;
- },
- // Is it locked?
- locked: function() {
- return !stack;
- },
- // Call all callbacks with the given context and arguments
- fireWith: function( context, args ) {
- args = args || [];
- args = [ context, args.slice ? args.slice() : args ];
- if ( list && ( !fired || stack ) ) {
- if ( firing ) {
- stack.push( args );
- } else {
- fire( args );
- }
- }
- return this;
- },
- // Call all the callbacks with the given arguments
- fire: function() {
- self.fireWith( this, arguments );
- return this;
- },
- // To know if the callbacks have already been called at least once
- fired: function() {
- return !!fired;
- }
- };
-
- return self;
-};
-jQuery.extend({
-
- Deferred: function( func ) {
- var tuples = [
- // action, add listener, listener list, final state
- [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
- [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
- [ "notify", "progress", jQuery.Callbacks("memory") ]
- ],
- state = "pending",
- promise = {
- state: function() {
- return state;
- },
- always: function() {
- deferred.done( arguments ).fail( arguments );
- return this;
- },
- then: function( /* fnDone, fnFail, fnProgress */ ) {
- var fns = arguments;
- return jQuery.Deferred(function( newDefer ) {
- jQuery.each( tuples, function( i, tuple ) {
- var action = tuple[ 0 ],
- fn = fns[ i ];
- // deferred[ done | fail | progress ] for forwarding actions to newDefer
- deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
- function() {
- var returned = fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise()
- .done( newDefer.resolve )
- .fail( newDefer.reject )
- .progress( newDefer.notify );
- } else {
- newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
- }
- } :
- newDefer[ action ]
- );
- });
- fns = null;
- }).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- return obj != null ? jQuery.extend( obj, promise ) : promise;
- }
- },
- deferred = {};
-
- // Keep pipe for back-compat
- promise.pipe = promise.then;
-
- // Add list-specific methods
- jQuery.each( tuples, function( i, tuple ) {
- var list = tuple[ 2 ],
- stateString = tuple[ 3 ];
-
- // promise[ done | fail | progress ] = list.add
- promise[ tuple[1] ] = list.add;
-
- // Handle state
- if ( stateString ) {
- list.add(function() {
- // state = [ resolved | rejected ]
- state = stateString;
-
- // [ reject_list | resolve_list ].disable; progress_list.lock
- }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
- }
-
- // deferred[ resolve | reject | notify ] = list.fire
- deferred[ tuple[0] ] = list.fire;
- deferred[ tuple[0] + "With" ] = list.fireWith;
- });
-
- // Make the deferred a promise
- promise.promise( deferred );
-
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
-
- // All done!
- return deferred;
- },
-
- // Deferred helper
- when: function( subordinate /* , ..., subordinateN */ ) {
- var i = 0,
- resolveValues = core_slice.call( arguments ),
- length = resolveValues.length,
-
- // the count of uncompleted subordinates
- remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
-
- // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
- deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
-
- // Update function for both resolve and progress values
- updateFunc = function( i, contexts, values ) {
- return function( value ) {
- contexts[ i ] = this;
- values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
- if( values === progressValues ) {
- deferred.notifyWith( contexts, values );
- } else if ( !( --remaining ) ) {
- deferred.resolveWith( contexts, values );
- }
- };
- },
-
- progressValues, progressContexts, resolveContexts;
-
- // add listeners to Deferred subordinates; treat others as resolved
- if ( length > 1 ) {
- progressValues = new Array( length );
- progressContexts = new Array( length );
- resolveContexts = new Array( length );
- for ( ; i < length; i++ ) {
- if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
- resolveValues[ i ].promise()
- .done( updateFunc( i, resolveContexts, resolveValues ) )
- .fail( deferred.reject )
- .progress( updateFunc( i, progressContexts, progressValues ) );
- } else {
- --remaining;
- }
- }
- }
-
- // if we're not waiting on anything, resolve the master
- if ( !remaining ) {
- deferred.resolveWith( resolveContexts, resolveValues );
- }
-
- return deferred.promise();
- }
-});
-jQuery.support = (function() {
-
- var support,
- all,
- a,
- select,
- opt,
- input,
- fragment,
- eventName,
- i,
- isSupported,
- clickFn,
- div = document.createElement("div");
-
- // Setup
- div.setAttribute( "className", "t" );
- div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
-
- // Support tests won't run in some limited or non-browser environments
- all = div.getElementsByTagName("*");
- a = div.getElementsByTagName("a")[ 0 ];
- if ( !all || !a || !all.length ) {
- return {};
- }
-
- // First batch of tests
- select = document.createElement("select");
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName("input")[ 0 ];
-
- a.style.cssText = "top:1px;float:left;opacity:.5";
- support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName("tbody").length,
-
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName("link").length,
-
- // Get the style information from getAttribute
- // (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
-
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: ( a.getAttribute("href") === "/a" ),
-
- // Make sure that element opacity exists
- // (IE uses filter instead)
- // Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.5/.test( a.style.opacity ),
-
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
-
- // Make sure that if no value is specified for a checkbox
- // that it defaults to "on".
- // (WebKit defaults to "" instead)
- checkOn: ( input.value === "on" ),
-
- // Make sure that a selected-by-default option has a working selected property.
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: opt.selected,
-
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
- getSetAttribute: div.className !== "t",
-
- // Tests for enctype support on a form (#6743)
- enctype: !!document.createElement("form").enctype,
-
- // Makes sure cloning an html5 element does not cause problems
- // Where outerHTML is undefined, this still works
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
-
- // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
- boxModel: ( document.compatMode === "CSS1Compat" ),
-
- // Will be defined later
- submitBubbles: true,
- changeBubbles: true,
- focusinBubbles: false,
- deleteExpando: true,
- noCloneEvent: true,
- inlineBlockNeedsLayout: false,
- shrinkWrapBlocks: false,
- reliableMarginRight: true,
- boxSizingReliable: true,
- pixelPosition: false
- };
-
- // Make sure checked status is properly cloned
- input.checked = true;
- support.noCloneChecked = input.cloneNode( true ).checked;
-
- // Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as disabled)
- select.disabled = true;
- support.optDisabled = !opt.disabled;
-
- // Test to see if it's possible to delete an expando from an element
- // Fails in Internet Explorer
- try {
- delete div.test;
- } catch( e ) {
- support.deleteExpando = false;
- }
-
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", clickFn = function() {
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- support.noCloneEvent = false;
- });
- div.cloneNode( true ).fireEvent("onclick");
- div.detachEvent( "onclick", clickFn );
- }
-
- // Check if a radio maintains its value
- // after being appended to the DOM
- input = document.createElement("input");
- input.value = "t";
- input.setAttribute( "type", "radio" );
- support.radioValue = input.value === "t";
-
- input.setAttribute( "checked", "checked" );
-
- // #11217 - WebKit loses check when the name is after the checked attribute
- input.setAttribute( "name", "t" );
-
- div.appendChild( input );
- fragment = document.createDocumentFragment();
- fragment.appendChild( div.lastChild );
-
- // WebKit doesn't clone checked state correctly in fragments
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- // Check if a disconnected checkbox will retain its checked
- // value of true after appended to the DOM (IE6/7)
- support.appendChecked = input.checked;
-
- fragment.removeChild( input );
- fragment.appendChild( div );
-
- // Technique from Juriy Zaytsev
- // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
- // We only care about the case where non-standard event systems
- // are used, namely in IE. Short-circuiting here helps us to
- // avoid an eval call (in setAttribute) which can cause CSP
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
- if ( div.attachEvent ) {
- for ( i in {
- submit: true,
- change: true,
- focusin: true
- }) {
- eventName = "on" + i;
- isSupported = ( eventName in div );
- if ( !isSupported ) {
- div.setAttribute( eventName, "return;" );
- isSupported = ( typeof div[ eventName ] === "function" );
- }
- support[ i + "Bubbles" ] = isSupported;
- }
- }
-
- // Run tests that need a body at doc ready
- jQuery(function() {
- var container, div, tds, marginDiv,
- divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
- body = document.getElementsByTagName("body")[0];
-
- if ( !body ) {
- // Return for frameset docs that don't have a body
- return;
- }
-
- container = document.createElement("div");
- container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
- body.insertBefore( container, body.firstChild );
-
- // Construct the test element
- div = document.createElement("div");
- container.appendChild( div );
-
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
- tds = div.getElementsByTagName("td");
- tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
- tds[ 0 ].style.display = "";
- tds[ 1 ].style.display = "none";
-
- // Check if empty table cells still have offsetWidth/Height
- // (IE <= 8 fail this test)
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
-
- // Check box-sizing and margin behavior
- div.innerHTML = "";
- div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
- support.boxSizing = ( div.offsetWidth === 4 );
- support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
-
- // NOTE: To any future maintainer, we've window.getComputedStyle
- // because jsdom on node.js will break without it.
- if ( window.getComputedStyle ) {
- support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
- support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
-
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. For more
- // info see bug #3333
- // Fails in WebKit before Feb 2011 nightlies
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- marginDiv = document.createElement("div");
- marginDiv.style.cssText = div.style.cssText = divReset;
- marginDiv.style.marginRight = marginDiv.style.width = "0";
- div.style.width = "1px";
- div.appendChild( marginDiv );
- support.reliableMarginRight =
- !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
- }
-
- if ( typeof div.style.zoom !== "undefined" ) {
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline' and giving
- // them layout
- // (IE < 8 does this)
- div.innerHTML = "";
- div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
-
- // Check if elements with layout shrink-wrap their children
- // (IE 6 does this)
- div.style.display = "block";
- div.style.overflow = "visible";
- div.innerHTML = "<div></div>";
- div.firstChild.style.width = "5px";
- support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
-
- container.style.zoom = 1;
- }
-
- // Null elements to avoid leaks in IE
- body.removeChild( container );
- container = div = tds = marginDiv = null;
- });
-
- // Null elements to avoid leaks in IE
- fragment.removeChild( div );
- all = a = select = opt = input = fragment = div = null;
-
- return support;
-})();
-var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
- rmultiDash = /([A-Z])/g;
-
-jQuery.extend({
- cache: {},
-
- deletedIds: [],
-
- // Remove at next major release (1.9/2.0)
- uuid: 0,
-
- // Unique for each copy of jQuery on the page
- // Non-digits removed to match rinlinejQuery
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
- // The following elements throw uncatchable exceptions if you
- // attempt to add expando properties to them.
- noData: {
- "embed": true,
- // Ban all objects except for Flash (which handle expandos)
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
- "applet": true
- },
-
- hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
- return !!elem && !isEmptyDataObject( elem );
- },
-
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache, ret,
- internalKey = jQuery.expando,
- getByName = typeof name === "string",
-
- // We have to handle DOM nodes and JS objects differently because IE6-7
- // can't GC object references properly across the DOM-JS boundary
- isNode = elem.nodeType,
-
- // Only DOM nodes need the global jQuery cache; JS object data is
- // attached directly to the object so GC can occur automatically
- cache = isNode ? jQuery.cache : elem,
-
- // Only defining an ID for JS objects if its cache already exists allows
- // the code to shortcut on the same path as a DOM node with no cache
- id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
-
- // Avoid doing any more work than we need to when trying to get data on an
- // object that has no data at all
- if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
- return;
- }
-
- if ( !id ) {
- // Only DOM nodes need a new unique ID for each element since their data
- // ends up in the global cache
- if ( isNode ) {
- elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
- } else {
- id = internalKey;
- }
- }
-
- if ( !cache[ id ] ) {
- cache[ id ] = {};
-
- // Avoids exposing jQuery metadata on plain JS objects when the object
- // is serialized using JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
- }
-
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
- // shallow copied over onto the existing cache
- if ( typeof name === "object" || typeof name === "function" ) {
- if ( pvt ) {
- cache[ id ] = jQuery.extend( cache[ id ], name );
- } else {
- cache[ id ].data = jQuery.extend( cache[ id ].data, name );
- }
- }
-
- thisCache = cache[ id ];
-
- // jQuery data() is stored in a separate object inside the object's internal data
- // cache in order to avoid key collisions between internal data and user-defined
- // data.
- if ( !pvt ) {
- if ( !thisCache.data ) {
- thisCache.data = {};
- }
-
- thisCache = thisCache.data;
- }
-
- if ( data !== undefined ) {
- thisCache[ jQuery.camelCase( name ) ] = data;
- }
-
- // Check for both converted-to-camel and non-converted data property names
- // If a data property was specified
- if ( getByName ) {
-
- // First Try to find as-is property data
- ret = thisCache[ name ];
-
- // Test for null|undefined property data
- if ( ret == null ) {
-
- // Try to find the camelCased property
- ret = thisCache[ jQuery.camelCase( name ) ];
- }
- } else {
- ret = thisCache;
- }
-
- return ret;
- },
-
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache, i, l,
-
- isNode = elem.nodeType,
-
- // See jQuery.data for more information
- cache = isNode ? jQuery.cache : elem,
- id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
-
- // If there is already no cache entry for this object, there is no
- // purpose in continuing
- if ( !cache[ id ] ) {
- return;
- }
-
- if ( name ) {
-
- thisCache = pvt ? cache[ id ] : cache[ id ].data;
-
- if ( thisCache ) {
-
- // Support array or space separated string names for data keys
- if ( !jQuery.isArray( name ) ) {
-
- // try the string as a key before any manipulation
- if ( name in thisCache ) {
- name = [ name ];
- } else {
-
- // split the camel cased version by spaces unless a key with the spaces exists
- name = jQuery.camelCase( name );
- if ( name in thisCache ) {
- name = [ name ];
- } else {
- name = name.split(" ");
- }
- }
- }
-
- for ( i = 0, l = name.length; i < l; i++ ) {
- delete thisCache[ name[i] ];
- }
-
- // If there is no data left in the cache, we want to continue
- // and let the cache object itself get destroyed
- if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
- return;
- }
- }
- }
-
- // See jQuery.data for more information
- if ( !pvt ) {
- delete cache[ id ].data;
-
- // Don't destroy the parent cache unless the internal data object
- // had been the only thing left in it
- if ( !isEmptyDataObject( cache[ id ] ) ) {
- return;
- }
- }
-
- // Destroy the cache
- if ( isNode ) {
- jQuery.cleanData( [ elem ], true );
-
- // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
- } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
- delete cache[ id ];
-
- // When all else fails, null
- } else {
- cache[ id ] = null;
- }
- },
-
- // For internal use only.
- _data: function( elem, name, data ) {
- return jQuery.data( elem, name, data, true );
- },
-
- // A method for determining if a DOM node can handle the data expando
- acceptData: function( elem ) {
- var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
-
- // nodes accept data unless otherwise specified; rejection can be conditional
- return !noData || noData !== true && elem.getAttribute("classid") === noData;
- }
-});
-
-jQuery.fn.extend({
- data: function( key, value ) {
- var parts, part, attr, name, l,
- elem = this[0],
- i = 0,
- data = null;
-
- // Gets all values
- if ( key === undefined ) {
- if ( this.length ) {
- data = jQuery.data( elem );
-
- if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
- attr = elem.attributes;
- for ( l = attr.length; i < l; i++ ) {
- name = attr[i].name;
-
- if ( !name.indexOf( "data-" ) ) {
- name = jQuery.camelCase( name.substring(5) );
-
- dataAttr( elem, name, data[ name ] );
- }
- }
- jQuery._data( elem, "parsedAttrs", true );
- }
- }
-
- return data;
- }
-
- // Sets multiple values
- if ( typeof key === "object" ) {
- return this.each(function() {
- jQuery.data( this, key );
- });
- }
-
- parts = key.split( ".", 2 );
- parts[1] = parts[1] ? "." + parts[1] : "";
- part = parts[1] + "!";
-
- return jQuery.access( this, function( value ) {
-
- if ( value === undefined ) {
- data = this.triggerHandler( "getData" + part, [ parts[0] ] );
-
- // Try to fetch any internally stored data first
- if ( data === undefined && elem ) {
- data = jQuery.data( elem, key );
- data = dataAttr( elem, key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
- }
-
- parts[1] = value;
- this.each(function() {
- var self = jQuery( this );
-
- self.triggerHandler( "setData" + part, parts );
- jQuery.data( this, key, value );
- self.triggerHandler( "changeData" + part, parts );
- });
- }, null, value, arguments.length > 1, null, false );
- },
-
- removeData: function( key ) {
- return this.each(function() {
- jQuery.removeData( this, key );
- });
- }
-});
-
-function dataAttr( elem, key, data ) {
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
-
- var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
-
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- // Only convert to a number if it doesn't change the string
- +data + "" === data ? +data :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch( e ) {}
-
- // Make sure we set the data so it isn't changed later
- jQuery.data( elem, key, data );
-
- } else {
- data = undefined;
- }
- }
-
- return data;
-}
-
-// checks a cache object for emptiness
-function isEmptyDataObject( obj ) {
- var name;
- for ( name in obj ) {
-
- // if the public data object is empty, the private is still empty
- if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
- continue;
- }
- if ( name !== "toJSON" ) {
- return false;
- }
- }
-
- return true;
-}
-jQuery.extend({
- queue: function( elem, type, data ) {
- var queue;
-
- if ( elem ) {
- type = ( type || "fx" ) + "queue";
- queue = jQuery._data( elem, type );
-
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !queue || jQuery.isArray(data) ) {
- queue = jQuery._data( elem, type, jQuery.makeArray(data) );
- } else {
- queue.push( data );
- }
- }
- return queue || [];
- }
- },
-
- dequeue: function( elem, type ) {
- type = type || "fx";
-
- var queue = jQuery.queue( elem, type ),
- startLength = queue.length,
- fn = queue.shift(),
- hooks = jQuery._queueHooks( elem, type ),
- next = function() {
- jQuery.dequeue( elem, type );
- };
-
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- startLength--;
- }
-
- if ( fn ) {
-
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift( "inprogress" );
- }
-
- // clear up the last queue stop function
- delete hooks.stop;
- fn.call( elem, next, hooks );
- }
-
- if ( !startLength && hooks ) {
- hooks.empty.fire();
- }
- },
-
- // not intended for public consumption - generates a queueHooks object, or returns the current one
- _queueHooks: function( elem, type ) {
- var key = type + "queueHooks";
- return jQuery._data( elem, key ) || jQuery._data( elem, key, {
- empty: jQuery.Callbacks("once memory").add(function() {
- jQuery.removeData( elem, type + "queue", true );
- jQuery.removeData( elem, key, true );
- })
- });
- }
-});
-
-jQuery.fn.extend({
- queue: function( type, data ) {
- var setter = 2;
-
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- setter--;
- }
-
- if ( arguments.length < setter ) {
- return jQuery.queue( this[0], type );
- }
-
- return data === undefined ?
- this :
- this.each(function() {
- var queue = jQuery.queue( this, type, data );
-
- // ensure a hooks for this queue
- jQuery._queueHooks( this, type );
-
- if ( type === "fx" && queue[0] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- dequeue: function( type ) {
- return this.each(function() {
- jQuery.dequeue( this, type );
- });
- },
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
- delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
- type = type || "fx";
-
- return this.queue( type, function( next, hooks ) {
- var timeout = setTimeout( next, time );
- hooks.stop = function() {
- clearTimeout( timeout );
- };
- });
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, obj ) {
- var tmp,
- count = 1,
- defer = jQuery.Deferred(),
- elements = this,
- i = this.length,
- resolve = function() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- };
-
- if ( typeof type !== "string" ) {
- obj = type;
- type = undefined;
- }
- type = type || "fx";
-
- while( i-- ) {
- tmp = jQuery._data( elements[ i ], type + "queueHooks" );
- if ( tmp && tmp.empty ) {
- count++;
- tmp.empty.add( resolve );
- }
- }
- resolve();
- return defer.promise( obj );
- }
-});
-var nodeHook, boolHook, fixSpecified,
- rclass = /[\t\r\n]/g,
- rreturn = /\r/g,
- rtype = /^(?:button|input)$/i,
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
- rclickable = /^a(?:rea|)$/i,
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- getSetAttribute = jQuery.support.getSetAttribute;
-
-jQuery.fn.extend({
- attr: function( name, value ) {
- return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
- },
-
- removeAttr: function( name ) {
- return this.each(function() {
- jQuery.removeAttr( this, name );
- });
- },
-
- prop: function( name, value ) {
- return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
- },
-
- removeProp: function( name ) {
- name = jQuery.propFix[ name ] || name;
- return this.each(function() {
- // try/catch handles cases where IE balks (such as removing a property on window)
- try {
- this[ name ] = undefined;
- delete this[ name ];
- } catch( e ) {}
- });
- },
-
- addClass: function( value ) {
- var classNames, i, l, elem,
- setClass, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).addClass( value.call(this, j, this.className) );
- });
- }
-
- if ( value && typeof value === "string" ) {
- classNames = value.split( core_rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 ) {
- if ( !elem.className && classNames.length === 1 ) {
- elem.className = value;
-
- } else {
- setClass = " " + elem.className + " ";
-
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
- setClass += classNames[ c ] + " ";
- }
- }
- elem.className = jQuery.trim( setClass );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var removes, className, elem, c, cl, i, l;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).removeClass( value.call(this, j, this.className) );
- });
- }
- if ( (value && typeof value === "string") || value === undefined ) {
- removes = ( value || "" ).split( core_rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
- if ( elem.nodeType === 1 && elem.className ) {
-
- className = (" " + elem.className + " ").replace( rclass, " " );
-
- // loop over each item in the removal list
- for ( c = 0, cl = removes.length; c < cl; c++ ) {
- // Remove until there is nothing to remove,
- while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
- className = className.replace( " " + removes[ c ] + " " , " " );
- }
- }
- elem.className = value ? jQuery.trim( className ) : "";
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isBool = typeof stateVal === "boolean";
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
- }
-
- return this.each(function() {
- if ( type === "string" ) {
- // toggle individual class names
- var className,
- i = 0,
- self = jQuery( this ),
- state = stateVal,
- classNames = value.split( core_rspace );
-
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space separated list
- state = isBool ? state : !self.hasClass( className );
- self[ state ? "addClass" : "removeClass" ]( className );
- }
-
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery._data( this, "__className__", this.className );
- }
-
- // toggle whole className
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
- }
- });
- },
-
- hasClass: function( selector ) {
- var className = " " + selector + " ",
- i = 0,
- l = this.length;
- for ( ; i < l; i++ ) {
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
- return true;
- }
- }
-
- return false;
- },
-
- val: function( value ) {
- var hooks, ret, isFunction,
- elem = this[0];
-
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
-
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
- return ret;
- }
-
- ret = elem.value;
-
- return typeof ret === "string" ?
- // handle most common string cases
- ret.replace(rreturn, "") :
- // handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
-
- return;
- }
-
- isFunction = jQuery.isFunction( value );
-
- return this.each(function( i ) {
- var val,
- self = jQuery(this);
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( isFunction ) {
- val = value.call( this, i, self.val() );
- } else {
- val = value;
- }
-
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
- return value == null ? "" : value + "";
- });
- }
-
- hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
-
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- });
- }
-});
-
-jQuery.extend({
- valHooks: {
- option: {
- get: function( elem ) {
- // attributes.value is undefined in Blackberry 4.7 but
- // uses .value. See #6932
- var val = elem.attributes.value;
- return !val || val.specified ? elem.value : elem.text;
- }
- },
- select: {
- get: function( elem ) {
- var value, option,
- options = elem.options,
- index = elem.selectedIndex,
- one = elem.type === "select-one" || index < 0,
- values = one ? null : [],
- max = one ? index + 1 : options.length,
- i = index < 0 ?
- max :
- one ? index : 0;
-
- // Loop through all the selected options
- for ( ; i < max; i++ ) {
- option = options[ i ];
-
- // oldIE doesn't update selected after form reset (#2551)
- if ( ( option.selected || i === index ) &&
- // Don't return options that are disabled or in a disabled optgroup
- ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
- ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
-
- // Get the specific value for the option
- value = jQuery( option ).val();
-
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- return values;
- },
-
- set: function( elem, value ) {
- var values = jQuery.makeArray( value );
-
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
-
- if ( !values.length ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- },
-
- // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
- attrFn: {},
-
- attr: function( elem, name, value, pass ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set attributes on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
- return jQuery( elem )[ name ]( value );
- }
-
- // Fallback to prop when attributes are not supported
- if ( typeof elem.getAttribute === "undefined" ) {
- return jQuery.prop( elem, name, value );
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- // All attributes are lowercase
- // Grab necessary hook if one is defined
- if ( notxml ) {
- name = name.toLowerCase();
- hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
- }
-
- if ( value !== undefined ) {
-
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return;
-
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- elem.setAttribute( name, value + "" );
- return value;
- }
-
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
-
- ret = elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return ret === null ?
- undefined :
- ret;
- }
- },
-
- removeAttr: function( elem, value ) {
- var propName, attrNames, name, isBool,
- i = 0;
-
- if ( value && elem.nodeType === 1 ) {
-
- attrNames = value.split( core_rspace );
-
- for ( ; i < attrNames.length; i++ ) {
- name = attrNames[ i ];
-
- if ( name ) {
- propName = jQuery.propFix[ name ] || name;
- isBool = rboolean.test( name );
-
- // See #9699 for explanation of this approach (setting first, then removal)
- // Do not do this for boolean attributes (see #10870)
- if ( !isBool ) {
- jQuery.attr( elem, name, "" );
- }
- elem.removeAttribute( getSetAttribute ? name : propName );
-
- // Set corresponding property to false for boolean attributes
- if ( isBool && propName in elem ) {
- elem[ propName ] = false;
- }
- }
- }
- }
- },
-
- attrHooks: {
- type: {
- set: function( elem, value ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
- // Setting the type on a radio button after the value resets the value in IE6-9
- // Reset value to it's default in case type is set after value
- // This is for element creation
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- },
- // Use the value property for back compat
- // Use the nodeHook for button elements in IE6/7 (#1954)
- value: {
- get: function( elem, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.get( elem, name );
- }
- return name in elem ?
- elem.value :
- null;
- },
- set: function( elem, value, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
- }
- },
-
- propFix: {
- tabindex: "tabIndex",
- readonly: "readOnly",
- "for": "htmlFor",
- "class": "className",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- cellpadding: "cellPadding",
- rowspan: "rowSpan",
- colspan: "colSpan",
- usemap: "useMap",
- frameborder: "frameBorder",
- contenteditable: "contentEditable"
- },
-
- prop: function( elem, name, value ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- if ( notxml ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
-
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- return ( elem[ name ] = value );
- }
-
- } else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
- return elem[ name ];
- }
- }
- },
-
- propHooks: {
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabindex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
- }
- }
-});
-
-// Hook for boolean attributes
-boolHook = {
- get: function( elem, name ) {
- // Align boolean attributes with corresponding properties
- // Fall back to attribute presence where some booleans are not supported
- var attrNode,
- property = jQuery.prop( elem, name );
- return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
- name.toLowerCase() :
- undefined;
- },
- set: function( elem, value, name ) {
- var propName;
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- // value is true since we know at this point it's type boolean and not false
- // Set boolean attributes to the same name and set the DOM property
- propName = jQuery.propFix[ name ] || name;
- if ( propName in elem ) {
- // Only set the IDL specifically if it already exists on the element
- elem[ propName ] = true;
- }
-
- elem.setAttribute( name, name.toLowerCase() );
- }
- return name;
- }
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !getSetAttribute ) {
-
- fixSpecified = {
- name: true,
- id: true,
- coords: true
- };
-
- // Use this for any attribute in IE6/7
- // This fixes almost every IE6/7 issue
- nodeHook = jQuery.valHooks.button = {
- get: function( elem, name ) {
- var ret;
- ret = elem.getAttributeNode( name );
- return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
- ret.value :
- undefined;
- },
- set: function( elem, value, name ) {
- // Set the existing or create a new attribute node
- var ret = elem.getAttributeNode( name );
- if ( !ret ) {
- ret = document.createAttribute( name );
- elem.setAttributeNode( ret );
- }
- return ( ret.value = value + "" );
- }
- };
-
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
- // This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- set: function( elem, value ) {
- if ( value === "" ) {
- elem.setAttribute( name, "auto" );
- return value;
- }
- }
- });
- });
-
- // Set contenteditable to false on removals(#10429)
- // Setting to empty string throws an error as an invalid value
- jQuery.attrHooks.contenteditable = {
- get: nodeHook.get,
- set: function( elem, value, name ) {
- if ( value === "" ) {
- value = "false";
- }
- nodeHook.set( elem, value, name );
- }
- };
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret = elem.getAttribute( name, 2 );
- return ret === null ? undefined : ret;
- }
- });
- });
-}
-
-if ( !jQuery.support.style ) {
- jQuery.attrHooks.style = {
- get: function( elem ) {
- // Return undefined in the case of empty string
- // Normalize to lowercase since IE uppercases css property names
- return elem.style.cssText.toLowerCase() || undefined;
- },
- set: function( elem, value ) {
- return ( elem.style.cssText = value + "" );
- }
- };
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
- get: function( elem ) {
- var parent = elem.parentNode;
-
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- return null;
- }
- });
-}
-
-// IE6/7 call enctype encoding
-if ( !jQuery.support.enctype ) {
- jQuery.propFix.enctype = "encoding";
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- get: function( elem ) {
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
- }
- };
- });
-}
-jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
- }
- }
- });
-});
-var rformElems = /^(?:textarea|input|select)$/i,
- rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
- rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
- rkeyEvent = /^key/,
- rmouseEvent = /^(?:mouse|contextmenu)|click/,
- rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
- hoverHack = function( events ) {
- return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
- };
-
-/*
- * Helper functions for managing events -- not part of the public interface.
- * Props to Dean Edwards' addEvent library for many of the ideas.
- */
-jQuery.event = {
-
- add: function( elem, types, handler, data, selector ) {
-
- var elemData, eventHandle, events,
- t, tns, type, namespaces, handleObj,
- handleObjIn, handlers, special;
-
- // Don't attach events to noData or text/comment nodes (allow plain objects tho)
- if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
- return;
- }
-
- // Caller can pass in an object of custom data in lieu of the handler
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- selector = handleObjIn.selector;
- }
-
- // Make sure that the handler has a unique ID, used to find/remove it later
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
-
- // Init the element's event structure and main handler, if this is the first
- events = elemData.events;
- if ( !events ) {
- elemData.events = events = {};
- }
- eventHandle = elemData.handle;
- if ( !eventHandle ) {
- elemData.handle = eventHandle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
- undefined;
- };
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
- eventHandle.elem = elem;
- }
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- types = jQuery.trim( hoverHack(types) ).split( " " );
- for ( t = 0; t < types.length; t++ ) {
-
- tns = rtypenamespace.exec( types[t] ) || [];
- type = tns[1];
- namespaces = ( tns[2] || "" ).split( "." ).sort();
-
- // If event changes its type, use the special event handlers for the changed type
- special = jQuery.event.special[ type ] || {};
-
- // If selector defined, determine special event api type, otherwise given type
- type = ( selector ? special.delegateType : special.bindType ) || type;
-
- // Update special based on newly reset type
- special = jQuery.event.special[ type ] || {};
-
- // handleObj is passed to all event handlers
- handleObj = jQuery.extend({
- type: type,
- origType: tns[1],
- data: data,
- handler: handler,
- guid: handler.guid,
- selector: selector,
- needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
- namespace: namespaces.join(".")
- }, handleObjIn );
-
- // Init the event handler queue if we're the first
- handlers = events[ type ];
- if ( !handlers ) {
- handlers = events[ type ] = [];
- handlers.delegateCount = 0;
-
- // Only use addEventListener/attachEvent if the special events handler returns false
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
- }
- }
- }
-
- if ( special.add ) {
- special.add.call( elem, handleObj );
-
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
-
- // Add to the element's handler list, delegates in front
- if ( selector ) {
- handlers.splice( handlers.delegateCount++, 0, handleObj );
- } else {
- handlers.push( handleObj );
- }
-
- // Keep track of which events have ever been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- global: {},
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, selector, mappedTypes ) {
-
- var t, tns, type, origType, namespaces, origCount,
- j, events, special, eventType, handleObj,
- elemData = jQuery.hasData( elem ) && jQuery._data( elem );
-
- if ( !elemData || !(events = elemData.events) ) {
- return;
- }
-
- // Once for each type.namespace in types; type may be omitted
- types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
- for ( t = 0; t < types.length; t++ ) {
- tns = rtypenamespace.exec( types[t] ) || [];
- type = origType = tns[1];
- namespaces = tns[2];
-
- // Unbind all events (on this namespace, if provided) for the element
- if ( !type ) {
- for ( type in events ) {
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
- }
- continue;
- }
-
- special = jQuery.event.special[ type ] || {};
- type = ( selector? special.delegateType : special.bindType ) || type;
- eventType = events[ type ] || [];
- origCount = eventType.length;
- namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
-
- // Remove matching events
- for ( j = 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( ( mappedTypes || origType === handleObj.origType ) &&
- ( !handler || handler.guid === handleObj.guid ) &&
- ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
- ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
- eventType.splice( j--, 1 );
-
- if ( handleObj.selector ) {
- eventType.delegateCount--;
- }
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
- }
-
- // Remove generic event handler if we removed something and no more handlers exist
- // (avoids potential for endless recursion during removal of special event handlers)
- if ( eventType.length === 0 && origCount !== eventType.length ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
-
- delete events[ type ];
- }
- }
-
- // Remove the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- delete elemData.handle;
-
- // removeData also checks for emptiness and clears the expando if empty
- // so use it instead of delete
- jQuery.removeData( elem, "events", true );
- }
- },
-
- // Events that are safe to short-circuit if no handlers are attached.
- // Native DOM events should not be added, they may have inline handlers.
- customEvent: {
- "getData": true,
- "setData": true,
- "changeData": true
- },
-
- trigger: function( event, data, elem, onlyHandlers ) {
- // Don't do events on text and comment nodes
- if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
- return;
- }
-
- // Event object or event type
- var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
- type = event.type || event,
- namespaces = [];
-
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
- return;
- }
-
- if ( type.indexOf( "!" ) >= 0 ) {
- // Exclusive events trigger only for the exact event (no namespaces)
- type = type.slice(0, -1);
- exclusive = true;
- }
-
- if ( type.indexOf( "." ) >= 0 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
- type = namespaces.shift();
- namespaces.sort();
- }
-
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
- // No jQuery handlers for this event type, and it can't have inline handlers
- return;
- }
-
- // Caller can pass in an Event, Object, or just an event type string
- event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
- // Object literal
- new jQuery.Event( type, event ) :
- // Just the event type (string)
- new jQuery.Event( type );
-
- event.type = type;
- event.isTrigger = true;
- event.exclusive = exclusive;
- event.namespace = namespaces.join( "." );
- event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
- ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
-
- // Handle a global trigger
- if ( !elem ) {
-
- // TODO: Stop taunting the data cache; remove global events and always attach to document
- cache = jQuery.cache;
- for ( i in cache ) {
- if ( cache[ i ].events && cache[ i ].events[ type ] ) {
- jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
- }
- }
- return;
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- if ( !event.target ) {
- event.target = elem;
- }
-
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data != null ? jQuery.makeArray( data ) : [];
- data.unshift( event );
-
- // Allow special events to draw outside the lines
- special = jQuery.event.special[ type ] || {};
- if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
- return;
- }
-
- // Determine event propagation path in advance, per W3C events spec (#9951)
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
- eventPath = [[ elem, special.bindType || type ]];
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
-
- bubbleType = special.delegateType || type;
- cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
- for ( old = elem; cur; cur = cur.parentNode ) {
- eventPath.push([ cur, bubbleType ]);
- old = cur;
- }
-
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
- if ( old === (elem.ownerDocument || document) ) {
- eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
- }
- }
-
- // Fire handlers on the event path
- for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
-
- cur = eventPath[i][0];
- event.type = eventPath[i][1];
-
- handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
- if ( handle ) {
- handle.apply( cur, data );
- }
- // Note that this is a bare JS function and not a jQuery handler
- handle = ontype && cur[ ontype ];
- if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
- event.preventDefault();
- }
- }
- event.type = type;
-
- // If nobody prevented the default action, do it now
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
-
- if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
- // Call a native DOM method on the target with the same name name as the event.
- // Can't use an .isFunction() check here because IE6/7 fails that test.
- // Don't do default actions on window, that's where global variables be (#6170)
- // IE<9 dies on focus/blur to hidden element (#1486)
- if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
-
- // Don't re-trigger an onFOO event when we call its FOO() method
- old = elem[ ontype ];
-
- if ( old ) {
- elem[ ontype ] = null;
- }
-
- // Prevent re-triggering of the same event, since we already bubbled it above
- jQuery.event.triggered = type;
- elem[ type ]();
- jQuery.event.triggered = undefined;
-
- if ( old ) {
- elem[ ontype ] = old;
- }
- }
- }
- }
-
- return event.result;
- },
-
- dispatch: function( event ) {
-
- // Make a writable jQuery.Event from the native event object
- event = jQuery.event.fix( event || window.event );
-
- var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
- handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
- delegateCount = handlers.delegateCount,
- args = core_slice.call( arguments ),
- run_all = !event.exclusive && !event.namespace,
- special = jQuery.event.special[ event.type ] || {},
- handlerQueue = [];
-
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
- args[0] = event;
- event.delegateTarget = this;
-
- // Call the preDispatch hook for the mapped type, and let it bail if desired
- if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
- return;
- }
-
- // Determine handlers that should run if there are delegated events
- // Avoid non-left-click bubbling in Firefox (#3861)
- if ( delegateCount && !(event.button && event.type === "click") ) {
-
- for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
-
- // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
- if ( cur.disabled !== true || event.type !== "click" ) {
- selMatch = {};
- matches = [];
- for ( i = 0; i < delegateCount; i++ ) {
- handleObj = handlers[ i ];
- sel = handleObj.selector;
-
- if ( selMatch[ sel ] === undefined ) {
- selMatch[ sel ] = handleObj.needsContext ?
- jQuery( sel, this ).index( cur ) >= 0 :
- jQuery.find( sel, this, null, [ cur ] ).length;
- }
- if ( selMatch[ sel ] ) {
- matches.push( handleObj );
- }
- }
- if ( matches.length ) {
- handlerQueue.push({ elem: cur, matches: matches });
- }
- }
- }
- }
-
- // Add the remaining (directly-bound) handlers
- if ( handlers.length > delegateCount ) {
- handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
- }
-
- // Run delegates first; they may want to stop propagation beneath us
- for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
- matched = handlerQueue[ i ];
- event.currentTarget = matched.elem;
-
- for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
- handleObj = matched.matches[ j ];
-
- // Triggered event must either 1) be non-exclusive and have no namespace, or
- // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
- if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
-
- event.data = handleObj.data;
- event.handleObj = handleObj;
-
- ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
- .apply( matched.elem, args );
-
- if ( ret !== undefined ) {
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }
- }
- }
-
- // Call the postDispatch hook for the mapped type
- if ( special.postDispatch ) {
- special.postDispatch.call( this, event );
- }
-
- return event.result;
- },
-
- // Includes some event props shared by KeyEvent and MouseEvent
- // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
- props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
-
- fixHooks: {},
-
- keyHooks: {
- props: "char charCode key keyCode".split(" "),
- filter: function( event, original ) {
-
- // Add which for key events
- if ( event.which == null ) {
- event.which = original.charCode != null ? original.charCode : original.keyCode;
- }
-
- return event;
- }
- },
-
- mouseHooks: {
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
- filter: function( event, original ) {
- var eventDoc, doc, body,
- button = original.button,
- fromElement = original.fromElement;
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && original.clientX != null ) {
- eventDoc = event.target.ownerDocument || document;
- doc = eventDoc.documentElement;
- body = eventDoc.body;
-
- event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
- event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
- }
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && fromElement ) {
- event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && button !== undefined ) {
- event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
- }
-
- return event;
- }
- },
-
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
-
- // Create a writable copy of the event object and normalize some properties
- var i, prop,
- originalEvent = event,
- fixHook = jQuery.event.fixHooks[ event.type ] || {},
- copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
-
- event = jQuery.Event( originalEvent );
-
- for ( i = copy.length; i; ) {
- prop = copy[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
-
- // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
- if ( !event.target ) {
- event.target = originalEvent.srcElement || document;
- }
-
- // Target should not be a text node (#504, Safari)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
-
- // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
- event.metaKey = !!event.metaKey;
-
- return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
- },
-
- special: {
- load: {
- // Prevent triggered image.load events from bubbling to window.load
- noBubble: true
- },
-
- focus: {
- delegateType: "focusin"
- },
- blur: {
- delegateType: "focusout"
- },
-
- beforeunload: {
- setup: function( data, namespaces, eventHandle ) {
- // We only want to do this special case on windows
- if ( jQuery.isWindow( this ) ) {
- this.onbeforeunload = eventHandle;
- }
- },
-
- teardown: function( namespaces, eventHandle ) {
- if ( this.onbeforeunload === eventHandle ) {
- this.onbeforeunload = null;
- }
- }
- }
- },
-
- simulate: function( type, elem, event, bubble ) {
- // Piggyback on a donor event to simulate a different one.
- // Fake originalEvent to avoid donor's stopPropagation, but if the
- // simulated event prevents default then we do the same on the donor.
- var e = jQuery.extend(
- new jQuery.Event(),
- event,
- { type: type,
- isSimulated: true,
- originalEvent: {}
- }
- );
- if ( bubble ) {
- jQuery.event.trigger( e, null, elem );
- } else {
- jQuery.event.dispatch.call( elem, e );
- }
- if ( e.isDefaultPrevented() ) {
- event.preventDefault();
- }
- }
-};
-
-// Some plugins are using, but it's undocumented/deprecated and will be removed.
-// The 1.7 special event interface should provide all the hooks needed now.
-jQuery.event.handle = jQuery.event.dispatch;
-
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- var name = "on" + type;
-
- if ( elem.detachEvent ) {
-
- // #8545, #7054, preventing memory leaks for custom events in IE6-8
- // detachEvent needed property on element, by name of that event, to properly expose it to GC
- if ( typeof elem[ name ] === "undefined" ) {
- elem[ name ] = null;
- }
-
- elem.detachEvent( name, handle );
- }
- };
-
-jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !(this instanceof jQuery.Event) ) {
- return new jQuery.Event( src, props );
- }
-
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
-
- // Create a timestamp if incoming event doesn't have one
- this.timeStamp = src && src.timeStamp || jQuery.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
- return false;
-}
-function returnTrue() {
- return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
- e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
- e.stopPropagation();
- }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-
-// Create mouseenter/leave events using mouseover/out and event-time checks
-jQuery.each({
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-}, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- delegateType: fix,
- bindType: fix,
-
- handle: function( event ) {
- var ret,
- target = this,
- related = event.relatedTarget,
- handleObj = event.handleObj,
- selector = handleObj.selector;
-
- // For mousenter/leave call the handler if related is outside the target.
- // NB: No relatedTarget if the mouse left/entered the browser window
- if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
- event.type = handleObj.origType;
- ret = handleObj.handler.apply( this, arguments );
- event.type = fix;
- }
- return ret;
- }
- };
-});
-
-// IE submit delegation
-if ( !jQuery.support.submitBubbles ) {
-
- jQuery.event.special.submit = {
- setup: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Lazy-add a submit handler when a descendant form may potentially be submitted
- jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
- // Node name check avoids a VML-related crash in IE (#9807)
- var elem = e.target,
- form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
- if ( form && !jQuery._data( form, "_submit_attached" ) ) {
- jQuery.event.add( form, "submit._submit", function( event ) {
- event._submit_bubble = true;
- });
- jQuery._data( form, "_submit_attached", true );
- }
- });
- // return undefined since we don't need an event listener
- },
-
- postDispatch: function( event ) {
- // If form was submitted by the user, bubble the event up the tree
- if ( event._submit_bubble ) {
- delete event._submit_bubble;
- if ( this.parentNode && !event.isTrigger ) {
- jQuery.event.simulate( "submit", this.parentNode, event, true );
- }
- }
- },
-
- teardown: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
- jQuery.event.remove( this, "._submit" );
- }
- };
-}
-
-// IE change delegation and checkbox/radio fix
-if ( !jQuery.support.changeBubbles ) {
-
- jQuery.event.special.change = {
-
- setup: function() {
-
- if ( rformElems.test( this.nodeName ) ) {
- // IE doesn't fire change on a check/radio until blur; trigger it on click
- // after a propertychange. Eat the blur-change in special.change.handle.
- // This still fires onchange a second time for check/radio after blur.
- if ( this.type === "checkbox" || this.type === "radio" ) {
- jQuery.event.add( this, "propertychange._change", function( event ) {
- if ( event.originalEvent.propertyName === "checked" ) {
- this._just_changed = true;
- }
- });
- jQuery.event.add( this, "click._change", function( event ) {
- if ( this._just_changed && !event.isTrigger ) {
- this._just_changed = false;
- }
- // Allow triggered, simulated change events (#11500)
- jQuery.event.simulate( "change", this, event, true );
- });
- }
- return false;
- }
- // Delegated event; lazy-add a change handler on descendant inputs
- jQuery.event.add( this, "beforeactivate._change", function( e ) {
- var elem = e.target;
-
- if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
- jQuery.event.add( elem, "change._change", function( event ) {
- if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
- jQuery.event.simulate( "change", this.parentNode, event, true );
- }
- });
- jQuery._data( elem, "_change_attached", true );
- }
- });
- },
-
- handle: function( event ) {
- var elem = event.target;
-
- // Swallow native change events from checkbox/radio, we already triggered them above
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
- return event.handleObj.handler.apply( this, arguments );
- }
- },
-
- teardown: function() {
- jQuery.event.remove( this, "._change" );
-
- return !rformElems.test( this.nodeName );
- }
- };
-}
-
-// Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler while someone wants focusin/focusout
- var attaches = 0,
- handler = function( event ) {
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
- };
-
- jQuery.event.special[ fix ] = {
- setup: function() {
- if ( attaches++ === 0 ) {
- document.addEventListener( orig, handler, true );
- }
- },
- teardown: function() {
- if ( --attaches === 0 ) {
- document.removeEventListener( orig, handler, true );
- }
- }
- };
- });
-}
-
-jQuery.fn.extend({
-
- on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
- var origFn, type;
-
- // Types can be a map of types/handlers
- if ( typeof types === "object" ) {
- // ( types-Object, selector, data )
- if ( typeof selector !== "string" ) { // && selector != null
- // ( types-Object, data )
- data = data || selector;
- selector = undefined;
- }
- for ( type in types ) {
- this.on( type, selector, data, types[ type ], one );
- }
- return this;
- }
-
- if ( data == null && fn == null ) {
- // ( types, fn )
- fn = selector;
- data = selector = undefined;
- } else if ( fn == null ) {
- if ( typeof selector === "string" ) {
- // ( types, selector, fn )
- fn = data;
- data = undefined;
- } else {
- // ( types, data, fn )
- fn = data;
- data = selector;
- selector = undefined;
- }
- }
- if ( fn === false ) {
- fn = returnFalse;
- } else if ( !fn ) {
- return this;
- }
-
- if ( one === 1 ) {
- origFn = fn;
- fn = function( event ) {
- // Can use an empty set, since event contains the info
- jQuery().off( event );
- return origFn.apply( this, arguments );
- };
- // Use same guid so caller can remove using origFn
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
- }
- return this.each( function() {
- jQuery.event.add( this, types, fn, data, selector );
- });
- },
- one: function( types, selector, data, fn ) {
- return this.on( types, selector, data, fn, 1 );
- },
- off: function( types, selector, fn ) {
- var handleObj, type;
- if ( types && types.preventDefault && types.handleObj ) {
- // ( event ) dispatched jQuery.Event
- handleObj = types.handleObj;
- jQuery( types.delegateTarget ).off(
- handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
- handleObj.selector,
- handleObj.handler
- );
- return this;
- }
- if ( typeof types === "object" ) {
- // ( types-object [, selector] )
- for ( type in types ) {
- this.off( type, selector, types[ type ] );
- }
- return this;
- }
- if ( selector === false || typeof selector === "function" ) {
- // ( types [, fn] )
- fn = selector;
- selector = undefined;
- }
- if ( fn === false ) {
- fn = returnFalse;
- }
- return this.each(function() {
- jQuery.event.remove( this, types, fn, selector );
- });
- },
-
- bind: function( types, data, fn ) {
- return this.on( types, null, data, fn );
- },
- unbind: function( types, fn ) {
- return this.off( types, null, fn );
- },
-
- live: function( types, data, fn ) {
- jQuery( this.context ).on( types, this.selector, data, fn );
- return this;
- },
- die: function( types, fn ) {
- jQuery( this.context ).off( types, this.selector || "**", fn );
- return this;
- },
-
- delegate: function( selector, types, data, fn ) {
- return this.on( types, selector, data, fn );
- },
- undelegate: function( selector, types, fn ) {
- // ( namespace ) or ( selector, types [, fn] )
- return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
- },
-
- trigger: function( type, data ) {
- return this.each(function() {
- jQuery.event.trigger( type, data, this );
- });
- },
- triggerHandler: function( type, data ) {
- if ( this[0] ) {
- return jQuery.event.trigger( type, data, this[0], true );
- }
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments,
- guid = fn.guid || jQuery.guid++,
- i = 0,
- toggler = function( event ) {
- // Figure out which function to execute
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
- jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ lastToggle ].apply( this, arguments ) || false;
- };
-
- // link all the functions, so any of them can unbind this click handler
- toggler.guid = guid;
- while ( i < args.length ) {
- args[ i++ ].guid = guid;
- }
-
- return this.click( toggler );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
-});
-
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
-
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- if ( fn == null ) {
- fn = data;
- data = null;
- }
-
- return arguments.length > 0 ?
- this.on( name, null, data, fn ) :
- this.trigger( name );
- };
-
- if ( rkeyEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
- }
-
- if ( rmouseEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
- }
-});
-/*!
- * Sizzle CSS Selector Engine
- * Copyright 2012 jQuery Foundation and other contributors
- * Released under the MIT license
- * http://sizzlejs.com/
- */
-(function( window, undefined ) {
-
-var cachedruns,
- assertGetIdNotName,
- Expr,
- getText,
- isXML,
- contains,
- compile,
- sortOrder,
- hasDuplicate,
- outermostContext,
-
- baseHasDuplicate = true,
- strundefined = "undefined",
-
- expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
-
- Token = String,
- document = window.document,
- docElem = document.documentElement,
- dirruns = 0,
- done = 0,
- pop = [].pop,
- push = [].push,
- slice = [].slice,
- // Use a stripped-down indexOf if a native one is unavailable
- indexOf = [].indexOf || function( elem ) {
- var i = 0,
- len = this.length;
- for ( ; i < len; i++ ) {
- if ( this[i] === elem ) {
- return i;
- }
- }
- return -1;
- },
-
- // Augment a function for special use by Sizzle
- markFunction = function( fn, value ) {
- fn[ expando ] = value == null || value;
- return fn;
- },
-
- createCache = function() {
- var cache = {},
- keys = [];
-
- return markFunction(function( key, value ) {
- // Only keep the most recent entries
- if ( keys.push( key ) > Expr.cacheLength ) {
- delete cache[ keys.shift() ];
- }
-
- // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
- return (cache[ key + " " ] = value);
- }, cache );
- },
-
- classCache = createCache(),
- tokenCache = createCache(),
- compilerCache = createCache(),
-
- // Regex
-
- // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
- whitespace = "[\\x20\\t\\r\\n\\f]",
- // http://www.w3.org/TR/css3-syntax/#characters
- characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
-
- // Loosely modeled on CSS identifier characters
- // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
- // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
- identifier = characterEncoding.replace( "w", "w#" ),
-
- // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
- operators = "([*^$|!~]?=)",
- attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
- "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
-
- // Prefer arguments not in parens/brackets,
- // then attribute selectors and non-pseudos (denoted by :),
- // then anything else
- // These preferences are here to reduce the number of selectors
- // needing tokenize in the PSEUDO preFilter
- pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
-
- // For matchExpr.POS and matchExpr.needsContext
- pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
- "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",
-
- // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
-
- rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
- rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
- rpseudo = new RegExp( pseudos ),
-
- // Easily-parseable/retrievable ID or TAG or CLASS selectors
- rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
-
- rnot = /^:not/,
- rsibling = /[\x20\t\r\n\f]*[+~]/,
- rendsWithNot = /:not\($/,
-
- rheader = /h\d/i,
- rinputs = /input|select|textarea|button/i,
-
- rbackslash = /\\(?!\\)/g,
-
- matchExpr = {
- "ID": new RegExp( "^#(" + characterEncoding + ")" ),
- "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
- "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
- "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
- "ATTR": new RegExp( "^" + attributes ),
- "PSEUDO": new RegExp( "^" + pseudos ),
- "POS": new RegExp( pos, "i" ),
- "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
- // For use in libraries implementing .is()
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
- },
-
- // Support
-
- // Used for testing something on an element
- assert = function( fn ) {
- var div = document.createElement("div");
-
- try {
- return fn( div );
- } catch (e) {
- return false;
- } finally {
- // release memory in IE
- div = null;
- }
- },
-
- // Check if getElementsByTagName("*") returns only elements
- assertTagNameNoComments = assert(function( div ) {
- div.appendChild( document.createComment("") );
- return !div.getElementsByTagName("*").length;
- }),
-
- // Check if getAttribute returns normalized href attributes
- assertHrefNotNormalized = assert(function( div ) {
- div.innerHTML = "<a href='#'></a>";
- return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
- div.firstChild.getAttribute("href") === "#";
- }),
-
- // Check if attributes should be retrieved by attribute nodes
- assertAttributes = assert(function( div ) {
- div.innerHTML = "<select></select>";
- var type = typeof div.lastChild.getAttribute("multiple");
- // IE8 returns a string for some attributes even when not present
- return type !== "boolean" && type !== "string";
- }),
-
- // Check if getElementsByClassName can be trusted
- assertUsableClassName = assert(function( div ) {
- // Opera can't find a second classname (in 9.6)
- div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
- if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
- return false;
- }
-
- // Safari 3.2 caches class attributes and doesn't catch changes
- div.lastChild.className = "e";
- return div.getElementsByClassName("e").length === 2;
- }),
-
- // Check if getElementById returns elements by name
- // Check if getElementsByName privileges form controls or returns elements by ID
- assertUsableName = assert(function( div ) {
- // Inject content
- div.id = expando + 0;
- div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
- docElem.insertBefore( div, docElem.firstChild );
-
- // Test
- var pass = document.getElementsByName &&
- // buggy browsers will return fewer than the correct 2
- document.getElementsByName( expando ).length === 2 +
- // buggy browsers will return more than the correct 0
- document.getElementsByName( expando + 0 ).length;
- assertGetIdNotName = !document.getElementById( expando );
-
- // Cleanup
- docElem.removeChild( div );
-
- return pass;
- });
-
-// If slice is not available, provide a backup
-try {
- slice.call( docElem.childNodes, 0 )[0].nodeType;
-} catch ( e ) {
- slice = function( i ) {
- var elem,
- results = [];
- for ( ; (elem = this[i]); i++ ) {
- results.push( elem );
- }
- return results;
- };
-}
-
-function Sizzle( selector, context, results, seed ) {
- results = results || [];
- context = context || document;
- var match, elem, xml, m,
- nodeType = context.nodeType;
-
- if ( !selector || typeof selector !== "string" ) {
- return results;
- }
-
- if ( nodeType !== 1 && nodeType !== 9 ) {
- return [];
- }
-
- xml = isXML( context );
-
- if ( !xml && !seed ) {
- if ( (match = rquickExpr.exec( selector )) ) {
- // Speed-up: Sizzle("#ID")
- if ( (m = match[1]) ) {
- if ( nodeType === 9 ) {
- elem = context.getElementById( m );
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE, Opera, and Webkit return items
- // by name instead of ID
- if ( elem.id === m ) {
- results.push( elem );
- return results;
- }
- } else {
- return results;
- }
- } else {
- // Context is not a document
- if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
- contains( context, elem ) && elem.id === m ) {
- results.push( elem );
- return results;
- }
- }
-
- // Speed-up: Sizzle("TAG")
- } else if ( match[2] ) {
- push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
- return results;
-
- // Speed-up: Sizzle(".CLASS")
- } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
- push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
- return results;
- }
- }
- }
-
- // All others
- return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );
-}
-
-Sizzle.matches = function( expr, elements ) {
- return Sizzle( expr, null, null, elements );
-};
-
-Sizzle.matchesSelector = function( elem, expr ) {
- return Sizzle( expr, null, null, [ elem ] ).length > 0;
-};
-
-// Returns a function to use in pseudos for input types
-function createInputPseudo( type ) {
- return function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === type;
- };
-}
-
-// Returns a function to use in pseudos for buttons
-function createButtonPseudo( type ) {
- return function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && elem.type === type;
- };
-}
-
-// Returns a function to use in pseudos for positionals
-function createPositionalPseudo( fn ) {
- return markFunction(function( argument ) {
- argument = +argument;
- return markFunction(function( seed, matches ) {
- var j,
- matchIndexes = fn( [], seed.length, argument ),
- i = matchIndexes.length;
-
- // Match elements found at the specified indexes
- while ( i-- ) {
- if ( seed[ (j = matchIndexes[i]) ] ) {
- seed[j] = !(matches[j] = seed[j]);
- }
- }
- });
- });
-}
-
-/**
- * Utility function for retrieving the text value of an array of DOM nodes
- * @param {Array|Element} elem
- */
-getText = Sizzle.getText = function( elem ) {
- var node,
- ret = "",
- i = 0,
- nodeType = elem.nodeType;
-
- if ( nodeType ) {
- if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
- // Use textContent for elements
- // innerText usage removed for consistency of new lines (see #11153)
- if ( typeof elem.textContent === "string" ) {
- return elem.textContent;
- } else {
- // Traverse its children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
- ret += getText( elem );
- }
- }
- } else if ( nodeType === 3 || nodeType === 4 ) {
- return elem.nodeValue;
- }
- // Do not include comment or processing instruction nodes
- } else {
-
- // If no nodeType, this is expected to be an array
- for ( ; (node = elem[i]); i++ ) {
- // Do not traverse comment nodes
- ret += getText( node );
- }
- }
- return ret;
-};
-
-isXML = Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
- return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-// Element contains another
-contains = Sizzle.contains = docElem.contains ?
- function( a, b ) {
- var adown = a.nodeType === 9 ? a.documentElement : a,
- bup = b && b.parentNode;
- return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
- } :
- docElem.compareDocumentPosition ?
- function( a, b ) {
- return b && !!( a.compareDocumentPosition( b ) & 16 );
- } :
- function( a, b ) {
- while ( (b = b.parentNode) ) {
- if ( b === a ) {
- return true;
- }
- }
- return false;
- };
-
-Sizzle.attr = function( elem, name ) {
- var val,
- xml = isXML( elem );
-
- if ( !xml ) {
- name = name.toLowerCase();
- }
- if ( (val = Expr.attrHandle[ name ]) ) {
- return val( elem );
- }
- if ( xml || assertAttributes ) {
- return elem.getAttribute( name );
- }
- val = elem.getAttributeNode( name );
- return val ?
- typeof elem[ name ] === "boolean" ?
- elem[ name ] ? name : null :
- val.specified ? val.value : null :
- null;
-};
-
-Expr = Sizzle.selectors = {
-
- // Can be adjusted by the user
- cacheLength: 50,
-
- createPseudo: markFunction,
-
- match: matchExpr,
-
- // IE6/7 return a modified href
- attrHandle: assertHrefNotNormalized ?
- {} :
- {
- "href": function( elem ) {
- return elem.getAttribute( "href", 2 );
- },
- "type": function( elem ) {
- return elem.getAttribute("type");
- }
- },
-
- find: {
- "ID": assertGetIdNotName ?
- function( id, context, xml ) {
- if ( typeof context.getElementById !== strundefined && !xml ) {
- var m = context.getElementById( id );
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- } :
- function( id, context, xml ) {
- if ( typeof context.getElementById !== strundefined && !xml ) {
- var m = context.getElementById( id );
-
- return m ?
- m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
- [m] :
- undefined :
- [];
- }
- },
-
- "TAG": assertTagNameNoComments ?
- function( tag, context ) {
- if ( typeof context.getElementsByTagName !== strundefined ) {
- return context.getElementsByTagName( tag );
- }
- } :
- function( tag, context ) {
- var results = context.getElementsByTagName( tag );
-
- // Filter out possible comments
- if ( tag === "*" ) {
- var elem,
- tmp = [],
- i = 0;
-
- for ( ; (elem = results[i]); i++ ) {
- if ( elem.nodeType === 1 ) {
- tmp.push( elem );
- }
- }
-
- return tmp;
- }
- return results;
- },
-
- "NAME": assertUsableName && function( tag, context ) {
- if ( typeof context.getElementsByName !== strundefined ) {
- return context.getElementsByName( name );
- }
- },
-
- "CLASS": assertUsableClassName && function( className, context, xml ) {
- if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
- return context.getElementsByClassName( className );
- }
- }
- },
-
- relative: {
- ">": { dir: "parentNode", first: true },
- " ": { dir: "parentNode" },
- "+": { dir: "previousSibling", first: true },
- "~": { dir: "previousSibling" }
- },
-
- preFilter: {
- "ATTR": function( match ) {
- match[1] = match[1].replace( rbackslash, "" );
-
- // Move the given value to match[3] whether quoted or unquoted
- match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
-
- if ( match[2] === "~=" ) {
- match[3] = " " + match[3] + " ";
- }
-
- return match.slice( 0, 4 );
- },
-
- "CHILD": function( match ) {
- /* matches from matchExpr["CHILD"]
- 1 type (only|nth|...)
- 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
- 3 xn-component of xn+y argument ([+-]?\d*n|)
- 4 sign of xn-component
- 5 x of xn-component
- 6 sign of y-component
- 7 y of y-component
- */
- match[1] = match[1].toLowerCase();
-
- if ( match[1] === "nth" ) {
- // nth-child requires argument
- if ( !match[2] ) {
- Sizzle.error( match[0] );
- }
-
- // numeric x and y parameters for Expr.filter.CHILD
- // remember that false/true cast respectively to 0/1
- match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
- match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
-
- // other types prohibit arguments
- } else if ( match[2] ) {
- Sizzle.error( match[0] );
- }
-
- return match;
- },
-
- "PSEUDO": function( match ) {
- var unquoted, excess;
- if ( matchExpr["CHILD"].test( match[0] ) ) {
- return null;
- }
-
- if ( match[3] ) {
- match[2] = match[3];
- } else if ( (unquoted = match[4]) ) {
- // Only check arguments that contain a pseudo
- if ( rpseudo.test(unquoted) &&
- // Get excess from tokenize (recursively)
- (excess = tokenize( unquoted, true )) &&
- // advance to the next closing parenthesis
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
-
- // excess is a negative index
- unquoted = unquoted.slice( 0, excess );
- match[0] = match[0].slice( 0, excess );
- }
- match[2] = unquoted;
- }
-
- // Return only captures needed by the pseudo filter method (type and argument)
- return match.slice( 0, 3 );
- }
- },
-
- filter: {
- "ID": assertGetIdNotName ?
- function( id ) {
- id = id.replace( rbackslash, "" );
- return function( elem ) {
- return elem.getAttribute("id") === id;
- };
- } :
- function( id ) {
- id = id.replace( rbackslash, "" );
- return function( elem ) {
- var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
- return node && node.value === id;
- };
- },
-
- "TAG": function( nodeName ) {
- if ( nodeName === "*" ) {
- return function() { return true; };
- }
- nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
-
- return function( elem ) {
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
- };
- },
-
- "CLASS": function( className ) {
- var pattern = classCache[ expando ][ className + " " ];
-
- return pattern ||
- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
- classCache( className, function( elem ) {
- return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
- });
- },
-
- "ATTR": function( name, operator, check ) {
- return function( elem, context ) {
- var result = Sizzle.attr( elem, name );
-
- if ( result == null ) {
- return operator === "!=";
- }
- if ( !operator ) {
- return true;
- }
-
- result += "";
-
- return operator === "=" ? result === check :
- operator === "!=" ? result !== check :
- operator === "^=" ? check && result.indexOf( check ) === 0 :
- operator === "*=" ? check && result.indexOf( check ) > -1 :
- operator === "$=" ? check && result.substr( result.length - check.length ) === check :
- operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
- operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
- false;
- };
- },
-
- "CHILD": function( type, argument, first, last ) {
-
- if ( type === "nth" ) {
- return function( elem ) {
- var node, diff,
- parent = elem.parentNode;
-
- if ( first === 1 && last === 0 ) {
- return true;
- }
-
- if ( parent ) {
- diff = 0;
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
- if ( node.nodeType === 1 ) {
- diff++;
- if ( elem === node ) {
- break;
- }
- }
- }
- }
-
- // Incorporate the offset (or cast to NaN), then check against cycle size
- diff -= last;
- return diff === first || ( diff % first === 0 && diff / first >= 0 );
- };
- }
-
- return function( elem ) {
- var node = elem;
-
- switch ( type ) {
- case "only":
- case "first":
- while ( (node = node.previousSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- if ( type === "first" ) {
- return true;
- }
-
- node = elem;
-
- /* falls through */
- case "last":
- while ( (node = node.nextSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- return true;
- }
- };
- },
-
- "PSEUDO": function( pseudo, argument ) {
- // pseudo-class names are case-insensitive
- // http://www.w3.org/TR/selectors/#pseudo-classes
- // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
- // Remember that setFilters inherits from pseudos
- var args,
- fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
- Sizzle.error( "unsupported pseudo: " + pseudo );
-
- // The user may use createPseudo to indicate that
- // arguments are needed to create the filter function
- // just as Sizzle does
- if ( fn[ expando ] ) {
- return fn( argument );
- }
-
- // But maintain support for old signatures
- if ( fn.length > 1 ) {
- args = [ pseudo, pseudo, "", argument ];
- return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
- markFunction(function( seed, matches ) {
- var idx,
- matched = fn( seed, argument ),
- i = matched.length;
- while ( i-- ) {
- idx = indexOf.call( seed, matched[i] );
- seed[ idx ] = !( matches[ idx ] = matched[i] );
- }
- }) :
- function( elem ) {
- return fn( elem, 0, args );
- };
- }
-
- return fn;
- }
- },
-
- pseudos: {
- "not": markFunction(function( selector ) {
- // Trim the selector passed to compile
- // to avoid treating leading and trailing
- // spaces as combinators
- var input = [],
- results = [],
- matcher = compile( selector.replace( rtrim, "$1" ) );
-
- return matcher[ expando ] ?
- markFunction(function( seed, matches, context, xml ) {
- var elem,
- unmatched = matcher( seed, null, xml, [] ),
- i = seed.length;
-
- // Match elements unmatched by `matcher`
- while ( i-- ) {
- if ( (elem = unmatched[i]) ) {
- seed[i] = !(matches[i] = elem);
- }
- }
- }) :
- function( elem, context, xml ) {
- input[0] = elem;
- matcher( input, null, xml, results );
- return !results.pop();
- };
- }),
-
- "has": markFunction(function( selector ) {
- return function( elem ) {
- return Sizzle( selector, elem ).length > 0;
- };
- }),
-
- "contains": markFunction(function( text ) {
- return function( elem ) {
- return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
- };
- }),
-
- "enabled": function( elem ) {
- return elem.disabled === false;
- },
-
- "disabled": function( elem ) {
- return elem.disabled === true;
- },
-
- "checked": function( elem ) {
- // In CSS3, :checked should return both checked and selected elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- var nodeName = elem.nodeName.toLowerCase();
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
- },
-
- "selected": function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
-
- return elem.selected === true;
- },
-
- "parent": function( elem ) {
- return !Expr.pseudos["empty"]( elem );
- },
-
- "empty": function( elem ) {
- // http://www.w3.org/TR/selectors/#empty-pseudo
- // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
- // not comment, processing instructions, or others
- // Thanks to Diego Perini for the nodeName shortcut
- // Greater than "@" means alpha characters (specifically not starting with "#" or "?")
- var nodeType;
- elem = elem.firstChild;
- while ( elem ) {
- if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
- return false;
- }
- elem = elem.nextSibling;
- }
- return true;
- },
-
- "header": function( elem ) {
- return rheader.test( elem.nodeName );
- },
-
- "text": function( elem ) {
- var type, attr;
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
- // use getAttribute instead to test this case
- return elem.nodeName.toLowerCase() === "input" &&
- (type = elem.type) === "text" &&
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
- },
-
- // Input types
- "radio": createInputPseudo("radio"),
- "checkbox": createInputPseudo("checkbox"),
- "file": createInputPseudo("file"),
- "password": createInputPseudo("password"),
- "image": createInputPseudo("image"),
-
- "submit": createButtonPseudo("submit"),
- "reset": createButtonPseudo("reset"),
-
- "button": function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && elem.type === "button" || name === "button";
- },
-
- "input": function( elem ) {
- return rinputs.test( elem.nodeName );
- },
-
- "focus": function( elem ) {
- var doc = elem.ownerDocument;
- return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
- },
-
- "active": function( elem ) {
- return elem === elem.ownerDocument.activeElement;
- },
-
- // Positional types
- "first": createPositionalPseudo(function() {
- return [ 0 ];
- }),
-
- "last": createPositionalPseudo(function( matchIndexes, length ) {
- return [ length - 1 ];
- }),
-
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
- return [ argument < 0 ? argument + length : argument ];
- }),
-
- "even": createPositionalPseudo(function( matchIndexes, length ) {
- for ( var i = 0; i < length; i += 2 ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
-
- "odd": createPositionalPseudo(function( matchIndexes, length ) {
- for ( var i = 1; i < length; i += 2 ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
-
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
- for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- }),
-
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
- for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {
- matchIndexes.push( i );
- }
- return matchIndexes;
- })
- }
-};
-
-function siblingCheck( a, b, ret ) {
- if ( a === b ) {
- return ret;
- }
-
- var cur = a.nextSibling;
-
- while ( cur ) {
- if ( cur === b ) {
- return -1;
- }
-
- cur = cur.nextSibling;
- }
-
- return 1;
-}
-
-sortOrder = docElem.compareDocumentPosition ?
- function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
- a.compareDocumentPosition :
- a.compareDocumentPosition(b) & 4
- ) ? -1 : 1;
- } :
- function( a, b ) {
- // The nodes are identical, we can exit early
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
-
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
- } else if ( a.sourceIndex && b.sourceIndex ) {
- return a.sourceIndex - b.sourceIndex;
- }
-
- var al, bl,
- ap = [],
- bp = [],
- aup = a.parentNode,
- bup = b.parentNode,
- cur = aup;
-
- // If the nodes are siblings (or identical) we can do a quick check
- if ( aup === bup ) {
- return siblingCheck( a, b );
-
- // If no parents were found then the nodes are disconnected
- } else if ( !aup ) {
- return -1;
-
- } else if ( !bup ) {
- return 1;
- }
-
- // Otherwise they're somewhere else in the tree so we need
- // to build up a full list of the parentNodes for comparison
- while ( cur ) {
- ap.unshift( cur );
- cur = cur.parentNode;
- }
-
- cur = bup;
-
- while ( cur ) {
- bp.unshift( cur );
- cur = cur.parentNode;
- }
-
- al = ap.length;
- bl = bp.length;
-
- // Start walking down the tree looking for a discrepancy
- for ( var i = 0; i < al && i < bl; i++ ) {
- if ( ap[i] !== bp[i] ) {
- return siblingCheck( ap[i], bp[i] );
- }
- }
-
- // We ended someplace up the tree so do a sibling check
- return i === al ?
- siblingCheck( a, bp[i], -1 ) :
- siblingCheck( ap[i], b, 1 );
- };
-
-// Always assume the presence of duplicates if sort doesn't
-// pass them to our comparison function (as in Google Chrome).
-[0, 0].sort( sortOrder );
-baseHasDuplicate = !hasDuplicate;
-
-// Document sorting and removing duplicates
-Sizzle.uniqueSort = function( results ) {
- var elem,
- duplicates = [],
- i = 1,
- j = 0;
-
- hasDuplicate = baseHasDuplicate;
- results.sort( sortOrder );
-
- if ( hasDuplicate ) {
- for ( ; (elem = results[i]); i++ ) {
- if ( elem === results[ i - 1 ] ) {
- j = duplicates.push( i );
- }
- }
- while ( j-- ) {
- results.splice( duplicates[ j ], 1 );
- }
- }
-
- return results;
-};
-
-Sizzle.error = function( msg ) {
- throw new Error( "Syntax error, unrecognized expression: " + msg );
-};
-
-function tokenize( selector, parseOnly ) {
- var matched, match, tokens, type,
- soFar, groups, preFilters,
- cached = tokenCache[ expando ][ selector + " " ];
-
- if ( cached ) {
- return parseOnly ? 0 : cached.slice( 0 );
- }
-
- soFar = selector;
- groups = [];
- preFilters = Expr.preFilter;
-
- while ( soFar ) {
-
- // Comma and first run
- if ( !matched || (match = rcomma.exec( soFar )) ) {
- if ( match ) {
- // Don't consume trailing commas as valid
- soFar = soFar.slice( match[0].length ) || soFar;
- }
- groups.push( tokens = [] );
- }
-
- matched = false;
-
- // Combinators
- if ( (match = rcombinators.exec( soFar )) ) {
- tokens.push( matched = new Token( match.shift() ) );
- soFar = soFar.slice( matched.length );
-
- // Cast descendant combinators to space
- matched.type = match[0].replace( rtrim, " " );
- }
-
- // Filters
- for ( type in Expr.filter ) {
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
- (match = preFilters[ type ]( match ))) ) {
-
- tokens.push( matched = new Token( match.shift() ) );
- soFar = soFar.slice( matched.length );
- matched.type = type;
- matched.matches = match;
- }
- }
-
- if ( !matched ) {
- break;
- }
- }
-
- // Return the length of the invalid excess
- // if we're just parsing
- // Otherwise, throw an error or return tokens
- return parseOnly ?
- soFar.length :
- soFar ?
- Sizzle.error( selector ) :
- // Cache the tokens
- tokenCache( selector, groups ).slice( 0 );
-}
-
-function addCombinator( matcher, combinator, base ) {
- var dir = combinator.dir,
- checkNonElements = base && combinator.dir === "parentNode",
- doneName = done++;
-
- return combinator.first ?
- // Check against closest ancestor/preceding element
- function( elem, context, xml ) {
- while ( (elem = elem[ dir ]) ) {
- if ( checkNonElements || elem.nodeType === 1 ) {
- return matcher( elem, context, xml );
- }
- }
- } :
-
- // Check against all ancestor/preceding elements
- function( elem, context, xml ) {
- // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
- if ( !xml ) {
- var cache,
- dirkey = dirruns + " " + doneName + " ",
- cachedkey = dirkey + cachedruns;
- while ( (elem = elem[ dir ]) ) {
- if ( checkNonElements || elem.nodeType === 1 ) {
- if ( (cache = elem[ expando ]) === cachedkey ) {
- return elem.sizset;
- } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
- if ( elem.sizset ) {
- return elem;
- }
- } else {
- elem[ expando ] = cachedkey;
- if ( matcher( elem, context, xml ) ) {
- elem.sizset = true;
- return elem;
- }
- elem.sizset = false;
- }
- }
- }
- } else {
- while ( (elem = elem[ dir ]) ) {
- if ( checkNonElements || elem.nodeType === 1 ) {
- if ( matcher( elem, context, xml ) ) {
- return elem;
- }
- }
- }
- }
- };
-}
-
-function elementMatcher( matchers ) {
- return matchers.length > 1 ?
- function( elem, context, xml ) {
- var i = matchers.length;
- while ( i-- ) {
- if ( !matchers[i]( elem, context, xml ) ) {
- return false;
- }
- }
- return true;
- } :
- matchers[0];
-}
-
-function condense( unmatched, map, filter, context, xml ) {
- var elem,
- newUnmatched = [],
- i = 0,
- len = unmatched.length,
- mapped = map != null;
-
- for ( ; i < len; i++ ) {
- if ( (elem = unmatched[i]) ) {
- if ( !filter || filter( elem, context, xml ) ) {
- newUnmatched.push( elem );
- if ( mapped ) {
- map.push( i );
- }
- }
- }
- }
-
- return newUnmatched;
-}
-
-function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
- if ( postFilter && !postFilter[ expando ] ) {
- postFilter = setMatcher( postFilter );
- }
- if ( postFinder && !postFinder[ expando ] ) {
- postFinder = setMatcher( postFinder, postSelector );
- }
- return markFunction(function( seed, results, context, xml ) {
- var temp, i, elem,
- preMap = [],
- postMap = [],
- preexisting = results.length,
-
- // Get initial elements from seed or context
- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
-
- // Prefilter to get matcher input, preserving a map for seed-results synchronization
- matcherIn = preFilter && ( seed || !selector ) ?
- condense( elems, preMap, preFilter, context, xml ) :
- elems,
-
- matcherOut = matcher ?
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
-
- // ...intermediate processing is necessary
- [] :
-
- // ...otherwise use results directly
- results :
- matcherIn;
-
- // Find primary matches
- if ( matcher ) {
- matcher( matcherIn, matcherOut, context, xml );
- }
-
- // Apply postFilter
- if ( postFilter ) {
- temp = condense( matcherOut, postMap );
- postFilter( temp, [], context, xml );
-
- // Un-match failing elements by moving them back to matcherIn
- i = temp.length;
- while ( i-- ) {
- if ( (elem = temp[i]) ) {
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
- }
- }
- }
-
- if ( seed ) {
- if ( postFinder || preFilter ) {
- if ( postFinder ) {
- // Get the final matcherOut by condensing this intermediate into postFinder contexts
- temp = [];
- i = matcherOut.length;
- while ( i-- ) {
- if ( (elem = matcherOut[i]) ) {
- // Restore matcherIn since elem is not yet a final match
- temp.push( (matcherIn[i] = elem) );
- }
- }
- postFinder( null, (matcherOut = []), temp, xml );
- }
-
- // Move matched elements from seed to results to keep them synchronized
- i = matcherOut.length;
- while ( i-- ) {
- if ( (elem = matcherOut[i]) &&
- (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
-
- seed[temp] = !(results[temp] = elem);
- }
- }
- }
-
- // Add elements to results, through postFinder if defined
- } else {
- matcherOut = condense(
- matcherOut === results ?
- matcherOut.splice( preexisting, matcherOut.length ) :
- matcherOut
- );
- if ( postFinder ) {
- postFinder( null, results, matcherOut, xml );
- } else {
- push.apply( results, matcherOut );
- }
- }
- });
-}
-
-function matcherFromTokens( tokens ) {
- var checkContext, matcher, j,
- len = tokens.length,
- leadingRelative = Expr.relative[ tokens[0].type ],
- implicitRelative = leadingRelative || Expr.relative[" "],
- i = leadingRelative ? 1 : 0,
-
- // The foundational matcher ensures that elements are reachable from top-level context(s)
- matchContext = addCombinator( function( elem ) {
- return elem === checkContext;
- }, implicitRelative, true ),
- matchAnyContext = addCombinator( function( elem ) {
- return indexOf.call( checkContext, elem ) > -1;
- }, implicitRelative, true ),
- matchers = [ function( elem, context, xml ) {
- return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
- (checkContext = context).nodeType ?
- matchContext( elem, context, xml ) :
- matchAnyContext( elem, context, xml ) );
- } ];
-
- for ( ; i < len; i++ ) {
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
- matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
- } else {
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
-
- // Return special upon seeing a positional matcher
- if ( matcher[ expando ] ) {
- // Find the next relative operator (if any) for proper handling
- j = ++i;
- for ( ; j < len; j++ ) {
- if ( Expr.relative[ tokens[j].type ] ) {
- break;
- }
- }
- return setMatcher(
- i > 1 && elementMatcher( matchers ),
- i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
- matcher,
- i < j && matcherFromTokens( tokens.slice( i, j ) ),
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
- j < len && tokens.join("")
- );
- }
- matchers.push( matcher );
- }
- }
-
- return elementMatcher( matchers );
-}
-
-function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
- var bySet = setMatchers.length > 0,
- byElement = elementMatchers.length > 0,
- superMatcher = function( seed, context, xml, results, expandContext ) {
- var elem, j, matcher,
- setMatched = [],
- matchedCount = 0,
- i = "0",
- unmatched = seed && [],
- outermost = expandContext != null,
- contextBackup = outermostContext,
- // We must always have either seed elements or context
- elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
- // Nested matchers should use non-integer dirruns
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
-
- if ( outermost ) {
- outermostContext = context !== document && context;
- cachedruns = superMatcher.el;
- }
-
- // Add elements passing elementMatchers directly to results
- for ( ; (elem = elems[i]) != null; i++ ) {
- if ( byElement && elem ) {
- for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
- if ( matcher( elem, context, xml ) ) {
- results.push( elem );
- break;
- }
- }
- if ( outermost ) {
- dirruns = dirrunsUnique;
- cachedruns = ++superMatcher.el;
- }
- }
-
- // Track unmatched elements for set filters
- if ( bySet ) {
- // They will have gone through all possible matchers
- if ( (elem = !matcher && elem) ) {
- matchedCount--;
- }
-
- // Lengthen the array for every element, matched or not
- if ( seed ) {
- unmatched.push( elem );
- }
- }
- }
-
- // Apply set filters to unmatched elements
- matchedCount += i;
- if ( bySet && i !== matchedCount ) {
- for ( j = 0; (matcher = setMatchers[j]); j++ ) {
- matcher( unmatched, setMatched, context, xml );
- }
-
- if ( seed ) {
- // Reintegrate element matches to eliminate the need for sorting
- if ( matchedCount > 0 ) {
- while ( i-- ) {
- if ( !(unmatched[i] || setMatched[i]) ) {
- setMatched[i] = pop.call( results );
- }
- }
- }
-
- // Discard index placeholder values to get only actual matches
- setMatched = condense( setMatched );
- }
-
- // Add matches to results
- push.apply( results, setMatched );
-
- // Seedless set matches succeeding multiple successful matchers stipulate sorting
- if ( outermost && !seed && setMatched.length > 0 &&
- ( matchedCount + setMatchers.length ) > 1 ) {
-
- Sizzle.uniqueSort( results );
- }
- }
-
- // Override manipulation of globals by nested matchers
- if ( outermost ) {
- dirruns = dirrunsUnique;
- outermostContext = contextBackup;
- }
-
- return unmatched;
- };
-
- superMatcher.el = 0;
- return bySet ?
- markFunction( superMatcher ) :
- superMatcher;
-}
-
-compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
- var i,
- setMatchers = [],
- elementMatchers = [],
- cached = compilerCache[ expando ][ selector + " " ];
-
- if ( !cached ) {
- // Generate a function of recursive functions that can be used to check each element
- if ( !group ) {
- group = tokenize( selector );
- }
- i = group.length;
- while ( i-- ) {
- cached = matcherFromTokens( group[i] );
- if ( cached[ expando ] ) {
- setMatchers.push( cached );
- } else {
- elementMatchers.push( cached );
- }
- }
-
- // Cache the compiled function
- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
- }
- return cached;
-};
-
-function multipleContexts( selector, contexts, results ) {
- var i = 0,
- len = contexts.length;
- for ( ; i < len; i++ ) {
- Sizzle( selector, contexts[i], results );
- }
- return results;
-}
-
-function select( selector, context, results, seed, xml ) {
- var i, tokens, token, type, find,
- match = tokenize( selector ),
- j = match.length;
-
- if ( !seed ) {
- // Try to minimize operations if there is only one group
- if ( match.length === 1 ) {
-
- // Take a shortcut and set the context if the root selector is an ID
- tokens = match[0] = match[0].slice( 0 );
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
- context.nodeType === 9 && !xml &&
- Expr.relative[ tokens[1].type ] ) {
-
- context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
- if ( !context ) {
- return results;
- }
-
- selector = selector.slice( tokens.shift().length );
- }
-
- // Fetch a seed set for right-to-left matching
- for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
- token = tokens[i];
-
- // Abort if we hit a combinator
- if ( Expr.relative[ (type = token.type) ] ) {
- break;
- }
- if ( (find = Expr.find[ type ]) ) {
- // Search, expanding context for leading sibling combinators
- if ( (seed = find(
- token.matches[0].replace( rbackslash, "" ),
- rsibling.test( tokens[0].type ) && context.parentNode || context,
- xml
- )) ) {
-
- // If seed is empty or no tokens remain, we can return early
- tokens.splice( i, 1 );
- selector = seed.length && tokens.join("");
- if ( !selector ) {
- push.apply( results, slice.call( seed, 0 ) );
- return results;
- }
-
- break;
- }
- }
- }
- }
- }
-
- // Compile and execute a filtering function
- // Provide `match` to avoid retokenization if we modified the selector above
- compile( selector, match )(
- seed,
- context,
- xml,
- results,
- rsibling.test( selector )
- );
- return results;
-}
-
-if ( document.querySelectorAll ) {
- (function() {
- var disconnectedMatch,
- oldSelect = select,
- rescape = /'|\\/g,
- rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
-
- // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA
- // A support test would require too much code (would include document ready)
- rbuggyQSA = [ ":focus" ],
-
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
- // A support test would require too much code (would include document ready)
- // just skip matchesSelector for :active
- rbuggyMatches = [ ":active" ],
- matches = docElem.matchesSelector ||
- docElem.mozMatchesSelector ||
- docElem.webkitMatchesSelector ||
- docElem.oMatchesSelector ||
- docElem.msMatchesSelector;
-
- // Build QSA regex
- // Regex strategy adopted from Diego Perini
- assert(function( div ) {
- // Select is set to empty string on purpose
- // This is to test IE's treatment of not explictly
- // setting a boolean content attribute,
- // since its presence should be enough
- // http://bugs.jquery.com/ticket/12359
- div.innerHTML = "<select><option selected=''></option></select>";
-
- // IE8 - Some boolean attributes are not treated correctly
- if ( !div.querySelectorAll("[selected]").length ) {
- rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
- }
-
- // Webkit/Opera - :checked should return selected option elements
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
- // IE8 throws error here (do not put tests after this one)
- if ( !div.querySelectorAll(":checked").length ) {
- rbuggyQSA.push(":checked");
- }
- });
-
- assert(function( div ) {
-
- // Opera 10-12/IE9 - ^= $= *= and empty values
- // Should not select anything
- div.innerHTML = "<p test=''></p>";
- if ( div.querySelectorAll("[test^='']").length ) {
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
- }
-
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
- // IE8 throws error here (do not put tests after this one)
- div.innerHTML = "<input type='hidden'/>";
- if ( !div.querySelectorAll(":enabled").length ) {
- rbuggyQSA.push(":enabled", ":disabled");
- }
- });
-
- // rbuggyQSA always contains :focus, so no need for a length check
- rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
-
- select = function( selector, context, results, seed, xml ) {
- // Only use querySelectorAll when not filtering,
- // when this is not xml,
- // and when no QSA bugs apply
- if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
- var groups, i,
- old = true,
- nid = expando,
- newContext = context,
- newSelector = context.nodeType === 9 && selector;
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
- groups = tokenize( selector );
-
- if ( (old = context.getAttribute("id")) ) {
- nid = old.replace( rescape, "\\$&" );
- } else {
- context.setAttribute( "id", nid );
- }
- nid = "[id='" + nid + "'] ";
-
- i = groups.length;
- while ( i-- ) {
- groups[i] = nid + groups[i].join("");
- }
- newContext = rsibling.test( selector ) && context.parentNode || context;
- newSelector = groups.join(",");
- }
-
- if ( newSelector ) {
- try {
- push.apply( results, slice.call( newContext.querySelectorAll(
- newSelector
- ), 0 ) );
- return results;
- } catch(qsaError) {
- } finally {
- if ( !old ) {
- context.removeAttribute("id");
- }
- }
- }
- }
-
- return oldSelect( selector, context, results, seed, xml );
- };
-
- if ( matches ) {
- assert(function( div ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9)
- disconnectedMatch = matches.call( div, "div" );
-
- // This should fail with an exception
- // Gecko does not error, returns false instead
- try {
- matches.call( div, "[test!='']:sizzle" );
- rbuggyMatches.push( "!=", pseudos );
- } catch ( e ) {}
- });
-
- // rbuggyMatches always contains :active and :focus, so no need for a length check
- rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
-
- Sizzle.matchesSelector = function( elem, expr ) {
- // Make sure that attribute selectors are quoted
- expr = expr.replace( rattributeQuotes, "='$1']" );
-
- // rbuggyMatches always contains :active, so no need for an existence check
- if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
- try {
- var ret = matches.call( elem, expr );
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9
- elem.document && elem.document.nodeType !== 11 ) {
- return ret;
- }
- } catch(e) {}
- }
-
- return Sizzle( expr, null, null, [ elem ] ).length > 0;
- };
- }
- })();
-}
-
-// Deprecated
-Expr.pseudos["nth"] = Expr.pseudos["eq"];
-
-// Back-compat
-function setFilters() {}
-Expr.filters = setFilters.prototype = Expr.pseudos;
-Expr.setFilters = new setFilters();
-
-// Override sizzle attribute retrieval
-Sizzle.attr = jQuery.attr;
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.pseudos;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-})( window );
-var runtil = /Until$/,
- rparentsprev = /^(?:parents|prev(?:Until|All))/,
- isSimple = /^.[^:#\[\.,]*$/,
- rneedsContext = jQuery.expr.match.needsContext,
- // methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
-
-jQuery.fn.extend({
- find: function( selector ) {
- var i, l, length, n, r, ret,
- self = this;
-
- if ( typeof selector !== "string" ) {
- return jQuery( selector ).filter(function() {
- for ( i = 0, l = self.length; i < l; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- });
- }
-
- ret = this.pushStack( "", "find", selector );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- length = ret.length;
- jQuery.find( selector, this[i], ret );
-
- if ( i > 0 ) {
- // Make sure that the results are unique
- for ( n = length; n < ret.length; n++ ) {
- for ( r = 0; r < length; r++ ) {
- if ( ret[r] === ret[n] ) {
- ret.splice(n--, 1);
- break;
- }
- }
- }
- }
- }
-
- return ret;
- },
-
- has: function( target ) {
- var i,
- targets = jQuery( target, this ),
- len = targets.length;
-
- return this.filter(function() {
- for ( i = 0; i < len; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
-
- not: function( selector ) {
- return this.pushStack( winnow(this, selector, false), "not", selector);
- },
-
- filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true), "filter", selector );
- },
-
- is: function( selector ) {
- return !!selector && (
- typeof selector === "string" ?
- // If this is a positional/relative selector, check membership in the returned set
- // so $("p:first").is("p:last") won't return true for a doc with two "p".
- rneedsContext.test( selector ) ?
- jQuery( selector, this.context ).index( this[0] ) >= 0 :
- jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0 );
- },
-
- closest: function( selectors, context ) {
- var cur,
- i = 0,
- l = this.length,
- ret = [],
- pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
-
- for ( ; i < l; i++ ) {
- cur = this[i];
-
- while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
- ret.push( cur );
- break;
- }
- cur = cur.parentNode;
- }
- }
-
- ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
-
- return this.pushStack( ret, "closest", selectors );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
-
- // No argument, return index in parent
- if ( !elem ) {
- return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
- }
-
- // index in selector
- if ( typeof elem === "string" ) {
- return jQuery.inArray( this[0], jQuery( elem ) );
- }
-
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
- },
-
- add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
- all :
- jQuery.unique( all ) );
- },
-
- addBack: function( selector ) {
- return this.add( selector == null ?
- this.prevObject : this.prevObject.filter(selector)
- );
- }
-});
-
-jQuery.fn.andSelf = jQuery.fn.addBack;
-
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
-function sibling( cur, dir ) {
- do {
- cur = cur[ dir ];
- } while ( cur && cur.nodeType !== 1 );
-
- return cur;
-}
-
-jQuery.each({
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return jQuery.dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return sibling( elem, "nextSibling" );
- },
- prev: function( elem ) {
- return sibling( elem, "previousSibling" );
- },
- nextAll: function( elem ) {
- return jQuery.dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return jQuery.dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
- },
- children: function( elem ) {
- return jQuery.sibling( elem.firstChild );
- },
- contents: function( elem ) {
- return jQuery.nodeName( elem, "iframe" ) ?
- elem.contentDocument || elem.contentWindow.document :
- jQuery.merge( [], elem.childNodes );
- }
-}, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until );
-
- if ( !runtil.test( name ) ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- ret = jQuery.filter( selector, ret );
- }
-
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
-
- if ( this.length > 1 && rparentsprev.test( name ) ) {
- ret = ret.reverse();
- }
-
- return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
- };
-});
-
-jQuery.extend({
- filter: function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
- },
-
- dir: function( elem, dir, until ) {
- var matched = [],
- cur = elem[ dir ];
-
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
- if ( cur.nodeType === 1 ) {
- matched.push( cur );
- }
- cur = cur[dir];
- }
- return matched;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- r.push( n );
- }
- }
-
- return r;
- }
-});
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, keep ) {
-
- // Can't pass null or undefined to indexOf in Firefox 4
- // Set to 0 to skip string check
- qualifier = qualifier || 0;
-
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- var retVal = !!qualifier.call( elem, i, elem );
- return retVal === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return ( elem === qualifier ) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
- });
-}
-function createSafeFragment( document ) {
- var list = nodeNames.split( "|" ),
- safeFrag = document.createDocumentFragment();
-
- if ( safeFrag.createElement ) {
- while ( list.length ) {
- safeFrag.createElement(
- list.pop()
- );
- }
- }
- return safeFrag;
-}
-
-var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
- "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
- rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
- rleadingWhitespace = /^\s+/,
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
- rtagName = /<([\w:]+)/,
- rtbody = /<tbody/i,
- rhtml = /<|&#?\w+;/,
- rnoInnerhtml = /<(?:script|style|link)/i,
- rnocache = /<(?:script|object|embed|option|style)/i,
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
- rcheckableType = /^(?:checkbox|radio)$/,
- // checked="checked" or checked
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
- rscriptType = /\/(java|ecma)script/i,
- rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,
- wrapMap = {
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
- legend: [ 1, "<fieldset>", "</fieldset>" ],
- thead: [ 1, "<table>", "</table>" ],
- tr: [ 2, "<table><tbody>", "</tbody></table>" ],
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
- col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
- area: [ 1, "<map>", "</map>" ],
- _default: [ 0, "", "" ]
- },
- safeFragment = createSafeFragment( document ),
- fragmentDiv = safeFragment.appendChild( document.createElement("div") );
-
-wrapMap.optgroup = wrapMap.option;
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
-// unless wrapped in a div with non-breaking characters in front of it.
-if ( !jQuery.support.htmlSerialize ) {
- wrapMap._default = [ 1, "X<div>", "</div>" ];
-}
-
-jQuery.fn.extend({
- text: function( value ) {
- return jQuery.access( this, function( value ) {
- return value === undefined ?
- jQuery.text( this ) :
- this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
- }, null, value, arguments.length );
- },
-
- wrapAll: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapAll( html.call(this, i) );
- });
- }
-
- if ( this[0] ) {
- // The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
-
- if ( this[0].parentNode ) {
- wrap.insertBefore( this[0] );
- }
-
- wrap.map(function() {
- var elem = this;
-
- while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
- elem = elem.firstChild;
- }
-
- return elem;
- }).append( this );
- }
-
- return this;
- },
-
- wrapInner: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapInner( html.call(this, i) );
- });
- }
-
- return this.each(function() {
- var self = jQuery( this ),
- contents = self.contents();
-
- if ( contents.length ) {
- contents.wrapAll( html );
-
- } else {
- self.append( html );
- }
- });
- },
-
- wrap: function( html ) {
- var isFunction = jQuery.isFunction( html );
-
- return this.each(function(i) {
- jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
- });
- },
-
- unwrap: function() {
- return this.parent().each(function() {
- if ( !jQuery.nodeName( this, "body" ) ) {
- jQuery( this ).replaceWith( this.childNodes );
- }
- }).end();
- },
-
- append: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 || this.nodeType === 11 ) {
- this.appendChild( elem );
- }
- });
- },
-
- prepend: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 || this.nodeType === 11 ) {
- this.insertBefore( elem, this.firstChild );
- }
- });
- },
-
- before: function() {
- if ( !isDisconnected( this[0] ) ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this );
- });
- }
-
- if ( arguments.length ) {
- var set = jQuery.clean( arguments );
- return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
- }
- },
-
- after: function() {
- if ( !isDisconnected( this[0] ) ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
- }
-
- if ( arguments.length ) {
- var set = jQuery.clean( arguments );
- return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
- }
- },
-
- // keepData is for internal use only--do not document
- remove: function( selector, keepData ) {
- var elem,
- i = 0;
-
- for ( ; (elem = this[i]) != null; i++ ) {
- if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
- if ( !keepData && elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- jQuery.cleanData( [ elem ] );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- }
- }
-
- return this;
- },
-
- empty: function() {
- var elem,
- i = 0;
-
- for ( ; (elem = this[i]) != null; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- }
-
- // Remove any remaining nodes
- while ( elem.firstChild ) {
- elem.removeChild( elem.firstChild );
- }
- }
-
- return this;
- },
-
- clone: function( dataAndEvents, deepDataAndEvents ) {
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
-
- return this.map( function () {
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- });
- },
-
- html: function( value ) {
- return jQuery.access( this, function( value ) {
- var elem = this[0] || {},
- i = 0,
- l = this.length;
-
- if ( value === undefined ) {
- return elem.nodeType === 1 ?
- elem.innerHTML.replace( rinlinejQuery, "" ) :
- undefined;
- }
-
- // See if we can take a shortcut and just use innerHTML
- if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
- ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
- ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
- !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
-
- value = value.replace( rxhtmlTag, "<$1></$2>" );
-
- try {
- for (; i < l; i++ ) {
- // Remove element nodes and prevent memory leaks
- elem = this[i] || {};
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName( "*" ) );
- elem.innerHTML = value;
- }
- }
-
- elem = 0;
-
- // If using innerHTML throws an exception, use the fallback method
- } catch(e) {}
- }
-
- if ( elem ) {
- this.empty().append( value );
- }
- }, null, value, arguments.length );
- },
-
- replaceWith: function( value ) {
- if ( !isDisconnected( this[0] ) ) {
- // Make sure that the elements are removed from the DOM before they are inserted
- // this can help fix replacing a parent with child elements
- if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this), old = self.html();
- self.replaceWith( value.call( this, i, old ) );
- });
- }
-
- if ( typeof value !== "string" ) {
- value = jQuery( value ).detach();
- }
-
- return this.each(function() {
- var next = this.nextSibling,
- parent = this.parentNode;
-
- jQuery( this ).remove();
-
- if ( next ) {
- jQuery(next).before( value );
- } else {
- jQuery(parent).append( value );
- }
- });
- }
-
- return this.length ?
- this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
- this;
- },
-
- detach: function( selector ) {
- return this.remove( selector, true );
- },
-
- domManip: function( args, table, callback ) {
-
- // Flatten any nested arrays
- args = [].concat.apply( [], args );
-
- var results, first, fragment, iNoClone,
- i = 0,
- value = args[0],
- scripts = [],
- l = this.length;
-
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
- return this.each(function() {
- jQuery(this).domManip( args, table, callback );
- });
- }
-
- if ( jQuery.isFunction(value) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- args[0] = value.call( this, i, table ? self.html() : undefined );
- self.domManip( args, table, callback );
- });
- }
-
- if ( this[0] ) {
- results = jQuery.buildFragment( args, this, scripts );
- fragment = results.fragment;
- first = fragment.firstChild;
-
- if ( fragment.childNodes.length === 1 ) {
- fragment = first;
- }
-
- if ( first ) {
- table = table && jQuery.nodeName( first, "tr" );
-
- // Use the original fragment for the last item instead of the first because it can end up
- // being emptied incorrectly in certain situations (#8070).
- // Fragments from the fragment cache must always be cloned and never used in place.
- for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
- callback.call(
- table && jQuery.nodeName( this[i], "table" ) ?
- findOrAppend( this[i], "tbody" ) :
- this[i],
- i === iNoClone ?
- fragment :
- jQuery.clone( fragment, true, true )
- );
- }
- }
-
- // Fix #11809: Avoid leaking memory
- fragment = first = null;
-
- if ( scripts.length ) {
- jQuery.each( scripts, function( i, elem ) {
- if ( elem.src ) {
- if ( jQuery.ajax ) {
- jQuery.ajax({
- url: elem.src,
- type: "GET",
- dataType: "script",
- async: false,
- global: false,
- "throws": true
- });
- } else {
- jQuery.error("no ajax");
- }
- } else {
- jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- });
- }
- }
-
- return this;
- }
-});
-
-function findOrAppend( elem, tag ) {
- return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
-}
-
-function cloneCopyEvent( src, dest ) {
-
- if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
- return;
- }
-
- var type, i, l,
- oldData = jQuery._data( src ),
- curData = jQuery._data( dest, oldData ),
- events = oldData.events;
-
- if ( events ) {
- delete curData.handle;
- curData.events = {};
-
- for ( type in events ) {
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type, events[ type ][ i ] );
- }
- }
- }
-
- // make the cloned public data object a copy from the original
- if ( curData.data ) {
- curData.data = jQuery.extend( {}, curData.data );
- }
-}
-
-function cloneFixAttributes( src, dest ) {
- var nodeName;
-
- // We do not need to do anything for non-Elements
- if ( dest.nodeType !== 1 ) {
- return;
- }
-
- // clearAttributes removes the attributes, which we don't want,
- // but also removes the attachEvent events, which we *do* want
- if ( dest.clearAttributes ) {
- dest.clearAttributes();
- }
-
- // mergeAttributes, in contrast, only merges back on the
- // original attributes, not the events
- if ( dest.mergeAttributes ) {
- dest.mergeAttributes( src );
- }
-
- nodeName = dest.nodeName.toLowerCase();
-
- if ( nodeName === "object" ) {
- // IE6-10 improperly clones children of object elements using classid.
- // IE10 throws NoModificationAllowedError if parent is null, #12132.
- if ( dest.parentNode ) {
- dest.outerHTML = src.outerHTML;
- }
-
- // This path appears unavoidable for IE9. When cloning an object
- // element in IE9, the outerHTML strategy above is not sufficient.
- // If the src has innerHTML and the destination does not,
- // copy the src.innerHTML into the dest.innerHTML. #10324
- if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
- dest.innerHTML = src.innerHTML;
- }
-
- } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
- // IE6-8 fails to persist the checked state of a cloned checkbox
- // or radio button. Worse, IE6-7 fail to give the cloned element
- // a checked appearance if the defaultChecked value isn't also set
-
- dest.defaultChecked = dest.checked = src.checked;
-
- // IE6-7 get confused and end up setting the value of a cloned
- // checkbox/radio button to an empty string instead of "on"
- if ( dest.value !== src.value ) {
- dest.value = src.value;
- }
-
- // IE6-8 fails to return the selected option to the default selected
- // state when cloning options
- } else if ( nodeName === "option" ) {
- dest.selected = src.defaultSelected;
-
- // IE6-8 fails to set the defaultValue to the correct value when
- // cloning other types of input fields
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
-
- // IE blanks contents when cloning scripts
- } else if ( nodeName === "script" && dest.text !== src.text ) {
- dest.text = src.text;
- }
-
- // Event data gets referenced instead of copied if the expando
- // gets copied too
- dest.removeAttribute( jQuery.expando );
-}
-
-jQuery.buildFragment = function( args, context, scripts ) {
- var fragment, cacheable, cachehit,
- first = args[ 0 ];
-
- // Set context from what may come in as undefined or a jQuery collection or a node
- // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
- // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
- context = context || document;
- context = !context.nodeType && context[0] || context;
- context = context.ownerDocument || context;
-
- // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
- // Cloning options loses the selected state, so don't cache them
- // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
- // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
- // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
- if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
- first.charAt(0) === "<" && !rnocache.test( first ) &&
- (jQuery.support.checkClone || !rchecked.test( first )) &&
- (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
-
- // Mark cacheable and look for a hit
- cacheable = true;
- fragment = jQuery.fragments[ first ];
- cachehit = fragment !== undefined;
- }
-
- if ( !fragment ) {
- fragment = context.createDocumentFragment();
- jQuery.clean( args, context, fragment, scripts );
-
- // Update the cache, but only store false
- // unless this is a second parsing of the same content
- if ( cacheable ) {
- jQuery.fragments[ first ] = cachehit && fragment;
- }
- }
-
- return { fragment: fragment, cacheable: cacheable };
-};
-
-jQuery.fragments = {};
-
-jQuery.each({
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
-}, function( name, original ) {
- jQuery.fn[ name ] = function( selector ) {
- var elems,
- i = 0,
- ret = [],
- insert = jQuery( selector ),
- l = insert.length,
- parent = this.length === 1 && this[0].parentNode;
-
- if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
- insert[ original ]( this[0] );
- return this;
- } else {
- for ( ; i < l; i++ ) {
- elems = ( i > 0 ? this.clone(true) : this ).get();
- jQuery( insert[i] )[ original ]( elems );
- ret = ret.concat( elems );
- }
-
- return this.pushStack( ret, name, insert.selector );
- }
- };
-});
-
-function getAll( elem ) {
- if ( typeof elem.getElementsByTagName !== "undefined" ) {
- return elem.getElementsByTagName( "*" );
-
- } else if ( typeof elem.querySelectorAll !== "undefined" ) {
- return elem.querySelectorAll( "*" );
-
- } else {
- return [];
- }
-}
-
-// Used in clean, fixes the defaultChecked property
-function fixDefaultChecked( elem ) {
- if ( rcheckableType.test( elem.type ) ) {
- elem.defaultChecked = elem.checked;
- }
-}
-
-jQuery.extend({
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var srcElements,
- destElements,
- i,
- clone;
-
- if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
- clone = elem.cloneNode( true );
-
- // IE<=8 does not properly clone detached, unknown element nodes
- } else {
- fragmentDiv.innerHTML = elem.outerHTML;
- fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
- }
-
- if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
- (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
- // IE copies events bound via attachEvent when using cloneNode.
- // Calling detachEvent on the clone will also remove the events
- // from the original. In order to get around this, we use some
- // proprietary methods to clear the events. Thanks to MooTools
- // guys for this hotness.
-
- cloneFixAttributes( elem, clone );
-
- // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- // Weird iteration because IE will replace the length property
- // with an element if you are cloning the body and one of the
- // elements on the page has a name or id of "length"
- for ( i = 0; srcElements[i]; ++i ) {
- // Ensure that the destination node is not null; Fixes #9587
- if ( destElements[i] ) {
- cloneFixAttributes( srcElements[i], destElements[i] );
- }
- }
- }
-
- // Copy the events from the original to the clone
- if ( dataAndEvents ) {
- cloneCopyEvent( elem, clone );
-
- if ( deepDataAndEvents ) {
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- for ( i = 0; srcElements[i]; ++i ) {
- cloneCopyEvent( srcElements[i], destElements[i] );
- }
- }
- }
-
- srcElements = destElements = null;
-
- // Return the cloned set
- return clone;
- },
-
- clean: function( elems, context, fragment, scripts ) {
- var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
- safe = context === document && safeFragment,
- ret = [];
-
- // Ensure that context is a document
- if ( !context || typeof context.createDocumentFragment === "undefined" ) {
- context = document;
- }
-
- // Use the already-created safe fragment if context permits
- for ( i = 0; (elem = elems[i]) != null; i++ ) {
- if ( typeof elem === "number" ) {
- elem += "";
- }
-
- if ( !elem ) {
- continue;
- }
-
- // Convert html string into DOM nodes
- if ( typeof elem === "string" ) {
- if ( !rhtml.test( elem ) ) {
- elem = context.createTextNode( elem );
- } else {
- // Ensure a safe container in which to render the html
- safe = safe || createSafeFragment( context );
- div = context.createElement("div");
- safe.appendChild( div );
-
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, "<$1></$2>");
-
- // Go to html and back, then peel off extra wrappers
- tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
- wrap = wrapMap[ tag ] || wrapMap._default;
- depth = wrap[0];
- div.innerHTML = wrap[1] + elem + wrap[2];
-
- // Move to the right depth
- while ( depth-- ) {
- div = div.lastChild;
- }
-
- // Remove IE's autoinserted <tbody> from table fragments
- if ( !jQuery.support.tbody ) {
-
- // String was a <table>, *may* have spurious <tbody>
- hasBody = rtbody.test(elem);
- tbody = tag === "table" && !hasBody ?
- div.firstChild && div.firstChild.childNodes :
-
- // String was a bare <thead> or <tfoot>
- wrap[1] === "<table>" && !hasBody ?
- div.childNodes :
- [];
-
- for ( j = tbody.length - 1; j >= 0 ; --j ) {
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
- }
- }
- }
-
- // IE completely kills leading whitespace when innerHTML is used
- if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
- div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
- }
-
- elem = div.childNodes;
-
- // Take out of fragment container (we need a fresh div each time)
- div.parentNode.removeChild( div );
- }
- }
-
- if ( elem.nodeType ) {
- ret.push( elem );
- } else {
- jQuery.merge( ret, elem );
- }
- }
-
- // Fix #11356: Clear elements from safeFragment
- if ( div ) {
- elem = div = safe = null;
- }
-
- // Reset defaultChecked for any radios and checkboxes
- // about to be appended to the DOM in IE 6/7 (#8060)
- if ( !jQuery.support.appendChecked ) {
- for ( i = 0; (elem = ret[i]) != null; i++ ) {
- if ( jQuery.nodeName( elem, "input" ) ) {
- fixDefaultChecked( elem );
- } else if ( typeof elem.getElementsByTagName !== "undefined" ) {
- jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
- }
- }
- }
-
- // Append elements to a provided document fragment
- if ( fragment ) {
- // Special handling of each script element
- handleScript = function( elem ) {
- // Check if we consider it executable
- if ( !elem.type || rscriptType.test( elem.type ) ) {
- // Detach the script and store it in the scripts array (if provided) or the fragment
- // Return truthy to indicate that it has been handled
- return scripts ?
- scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
- fragment.appendChild( elem );
- }
- };
-
- for ( i = 0; (elem = ret[i]) != null; i++ ) {
- // Check if we're done after handling an executable script
- if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
- // Append to fragment and handle embedded scripts
- fragment.appendChild( elem );
- if ( typeof elem.getElementsByTagName !== "undefined" ) {
- // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
- jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
-
- // Splice the scripts into ret after their former ancestor and advance our index beyond them
- ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
- i += jsTags.length;
- }
- }
- }
- }
-
- return ret;
- },
-
- cleanData: function( elems, /* internal */ acceptData ) {
- var data, id, elem, type,
- i = 0,
- internalKey = jQuery.expando,
- cache = jQuery.cache,
- deleteExpando = jQuery.support.deleteExpando,
- special = jQuery.event.special;
-
- for ( ; (elem = elems[i]) != null; i++ ) {
-
- if ( acceptData || jQuery.acceptData( elem ) ) {
-
- id = elem[ internalKey ];
- data = id && cache[ id ];
-
- if ( data ) {
- if ( data.events ) {
- for ( type in data.events ) {
- if ( special[ type ] ) {
- jQuery.event.remove( elem, type );
-
- // This is a shortcut to avoid jQuery.event.remove's overhead
- } else {
- jQuery.removeEvent( elem, type, data.handle );
- }
- }
- }
-
- // Remove cache only if it was not already removed by jQuery.event.remove
- if ( cache[ id ] ) {
-
- delete cache[ id ];
-
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( deleteExpando ) {
- delete elem[ internalKey ];
-
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( internalKey );
-
- } else {
- elem[ internalKey ] = null;
- }
-
- jQuery.deletedIds.push( id );
- }
- }
- }
- }
- }
-});
-// Limit scope pollution from any deprecated API
-(function() {
-
-var matched, browser;
-
-// Use of jQuery.browser is frowned upon.
-// More details: http://api.jquery.com/jQuery.browser
-// jQuery.uaMatch maintained for back-compat
-jQuery.uaMatch = function( ua ) {
- ua = ua.toLowerCase();
-
- var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
- /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
- /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
- /(msie) ([\w.]+)/.exec( ua ) ||
- ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
- [];
-
- return {
- browser: match[ 1 ] || "",
- version: match[ 2 ] || "0"
- };
-};
-
-matched = jQuery.uaMatch( navigator.userAgent );
-browser = {};
-
-if ( matched.browser ) {
- browser[ matched.browser ] = true;
- browser.version = matched.version;
-}
-
-// Chrome is Webkit, but Webkit is also Safari.
-if ( browser.chrome ) {
- browser.webkit = true;
-} else if ( browser.webkit ) {
- browser.safari = true;
-}
-
-jQuery.browser = browser;
-
-jQuery.sub = function() {
- function jQuerySub( selector, context ) {
- return new jQuerySub.fn.init( selector, context );
- }
- jQuery.extend( true, jQuerySub, this );
- jQuerySub.superclass = this;
- jQuerySub.fn = jQuerySub.prototype = this();
- jQuerySub.fn.constructor = jQuerySub;
- jQuerySub.sub = this.sub;
- jQuerySub.fn.init = function init( selector, context ) {
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
- context = jQuerySub( context );
- }
-
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
- };
- jQuerySub.fn.init.prototype = jQuerySub.fn;
- var rootjQuerySub = jQuerySub(document);
- return jQuerySub;
-};
-
-})();
-var curCSS, iframe, iframeDoc,
- ralpha = /alpha\([^)]*\)/i,
- ropacity = /opacity=([^)]*)/,
- rposition = /^(top|right|bottom|left)$/,
- // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
- // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
- rdisplayswap = /^(none|table(?!-c[ea]).+)/,
- rmargin = /^margin/,
- rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
- rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
- rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
- elemdisplay = { BODY: "block" },
-
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
- cssNormalTransform = {
- letterSpacing: 0,
- fontWeight: 400
- },
-
- cssExpand = [ "Top", "Right", "Bottom", "Left" ],
- cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
-
- eventsToggle = jQuery.fn.toggle;
-
-// return a css property mapped to a potentially vendor prefixed property
-function vendorPropName( style, name ) {
-
- // shortcut for names that are not vendor prefixed
- if ( name in style ) {
- return name;
- }
-
- // check for vendor prefixed names
- var capName = name.charAt(0).toUpperCase() + name.slice(1),
- origName = name,
- i = cssPrefixes.length;
-
- while ( i-- ) {
- name = cssPrefixes[ i ] + capName;
- if ( name in style ) {
- return name;
- }
- }
-
- return origName;
-}
-
-function isHidden( elem, el ) {
- elem = el || elem;
- return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
-}
-
-function showHide( elements, show ) {
- var elem, display,
- values = [],
- index = 0,
- length = elements.length;
-
- for ( ; index < length; index++ ) {
- elem = elements[ index ];
- if ( !elem.style ) {
- continue;
- }
- values[ index ] = jQuery._data( elem, "olddisplay" );
- if ( show ) {
- // Reset the inline display of this element to learn if it is
- // being hidden by cascaded rules or not
- if ( !values[ index ] && elem.style.display === "none" ) {
- elem.style.display = "";
- }
-
- // Set elements which have been overridden with display: none
- // in a stylesheet to whatever the default browser style is
- // for such an element
- if ( elem.style.display === "" && isHidden( elem ) ) {
- values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
- }
- } else {
- display = curCSS( elem, "display" );
-
- if ( !values[ index ] && display !== "none" ) {
- jQuery._data( elem, "olddisplay", display );
- }
- }
- }
-
- // Set the display of most of the elements in a second loop
- // to avoid the constant reflow
- for ( index = 0; index < length; index++ ) {
- elem = elements[ index ];
- if ( !elem.style ) {
- continue;
- }
- if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
- elem.style.display = show ? values[ index ] || "" : "none";
- }
- }
-
- return elements;
-}
-
-jQuery.fn.extend({
- css: function( name, value ) {
- return jQuery.access( this, function( elem, name, value ) {
- return value !== undefined ?
- jQuery.style( elem, name, value ) :
- jQuery.css( elem, name );
- }, name, value, arguments.length > 1 );
- },
- show: function() {
- return showHide( this, true );
- },
- hide: function() {
- return showHide( this );
- },
- toggle: function( state, fn2 ) {
- var bool = typeof state === "boolean";
-
- if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
- return eventsToggle.apply( this, arguments );
- }
-
- return this.each(function() {
- if ( bool ? state : isHidden( this ) ) {
- jQuery( this ).show();
- } else {
- jQuery( this ).hide();
- }
- });
- }
-});
-
-jQuery.extend({
- // Add in style property hooks for overriding the default
- // behavior of getting and setting a style property
- cssHooks: {
- opacity: {
- get: function( elem, computed ) {
- if ( computed ) {
- // We should always get a number back from opacity
- var ret = curCSS( elem, "opacity" );
- return ret === "" ? "1" : ret;
-
- }
- }
- }
- },
-
- // Exclude the following css properties to add px
- cssNumber: {
- "fillOpacity": true,
- "fontWeight": true,
- "lineHeight": true,
- "opacity": true,
- "orphans": true,
- "widows": true,
- "zIndex": true,
- "zoom": true
- },
-
- // Add in properties whose names you wish to fix before
- // setting or getting the value
- cssProps: {
- // normalize float css property
- "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
- },
-
- // Get and set the style property on a DOM Node
- style: function( elem, name, value, extra ) {
- // Don't set styles on text and comment nodes
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
- return;
- }
-
- // Make sure that we're working with the right name
- var ret, type, hooks,
- origName = jQuery.camelCase( name ),
- style = elem.style;
-
- name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
-
- // gets hook for the prefixed version
- // followed by the unprefixed version
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
-
- // Check if we're setting a value
- if ( value !== undefined ) {
- type = typeof value;
-
- // convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && (ret = rrelNum.exec( value )) ) {
- value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
- // Fixes bug #9237
- type = "number";
- }
-
- // Make sure that NaN and null values aren't set. See: #7116
- if ( value == null || type === "number" && isNaN( value ) ) {
- return;
- }
-
- // If a number was passed in, add 'px' to the (except for certain CSS properties)
- if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
- value += "px";
- }
-
- // If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
- // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
- // Fixes bug #5509
- try {
- style[ name ] = value;
- } catch(e) {}
- }
-
- } else {
- // If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
- return ret;
- }
-
- // Otherwise just get the value from the style object
- return style[ name ];
- }
- },
-
- css: function( elem, name, numeric, extra ) {
- var val, num, hooks,
- origName = jQuery.camelCase( name );
-
- // Make sure that we're working with the right name
- name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
-
- // gets hook for the prefixed version
- // followed by the unprefixed version
- hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
-
- // If a hook was provided get the computed value from there
- if ( hooks && "get" in hooks ) {
- val = hooks.get( elem, true, extra );
- }
-
- // Otherwise, if a way to get the computed value exists, use that
- if ( val === undefined ) {
- val = curCSS( elem, name );
- }
-
- //convert "normal" to computed value
- if ( val === "normal" && name in cssNormalTransform ) {
- val = cssNormalTransform[ name ];
- }
-
- // Return, converting to number if forced or a qualifier was provided and val looks numeric
- if ( numeric || extra !== undefined ) {
- num = parseFloat( val );
- return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
- }
- return val;
- },
-
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var ret, name,
- old = {};
-
- // Remember the old values, and insert the new ones
- for ( name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
-
- ret = callback.call( elem );
-
- // Revert the old values
- for ( name in options ) {
- elem.style[ name ] = old[ name ];
- }
-
- return ret;
- }
-});
-
-// NOTE: To any future maintainer, we've window.getComputedStyle
-// because jsdom on node.js will break without it.
-if ( window.getComputedStyle ) {
- curCSS = function( elem, name ) {
- var ret, width, minWidth, maxWidth,
- computed = window.getComputedStyle( elem, null ),
- style = elem.style;
-
- if ( computed ) {
-
- // getPropertyValue is only needed for .css('filter') in IE9, see #12537
- ret = computed.getPropertyValue( name ) || computed[ name ];
-
- if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
- ret = jQuery.style( elem, name );
- }
-
- // A tribute to the "awesome hack by Dean Edwards"
- // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
- // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
- // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
- if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
- width = style.width;
- minWidth = style.minWidth;
- maxWidth = style.maxWidth;
-
- style.minWidth = style.maxWidth = style.width = ret;
- ret = computed.width;
-
- style.width = width;
- style.minWidth = minWidth;
- style.maxWidth = maxWidth;
- }
- }
-
- return ret;
- };
-} else if ( document.documentElement.currentStyle ) {
- curCSS = function( elem, name ) {
- var left, rsLeft,
- ret = elem.currentStyle && elem.currentStyle[ name ],
- style = elem.style;
-
- // Avoid setting ret to empty string here
- // so we don't default to auto
- if ( ret == null && style && style[ name ] ) {
- ret = style[ name ];
- }
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
-
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- // but not position css attributes, as those are proportional to the parent element instead
- // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
- if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
-
- // Remember the original values
- left = style.left;
- rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
-
- // Put in the new values to get a computed value out
- if ( rsLeft ) {
- elem.runtimeStyle.left = elem.currentStyle.left;
- }
- style.left = name === "fontSize" ? "1em" : ret;
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- if ( rsLeft ) {
- elem.runtimeStyle.left = rsLeft;
- }
- }
-
- return ret === "" ? "auto" : ret;
- };
-}
-
-function setPositiveNumber( elem, value, subtract ) {
- var matches = rnumsplit.exec( value );
- return matches ?
- Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
- value;
-}
-
-function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
- var i = extra === ( isBorderBox ? "border" : "content" ) ?
- // If we already have the right measurement, avoid augmentation
- 4 :
- // Otherwise initialize for horizontal or vertical properties
- name === "width" ? 1 : 0,
-
- val = 0;
-
- for ( ; i < 4; i += 2 ) {
- // both box models exclude margin, so add it if we want it
- if ( extra === "margin" ) {
- // we use jQuery.css instead of curCSS here
- // because of the reliableMarginRight CSS hook!
- val += jQuery.css( elem, extra + cssExpand[ i ], true );
- }
-
- // From this point on we use curCSS for maximum performance (relevant in animations)
- if ( isBorderBox ) {
- // border-box includes padding, so remove it if we want content
- if ( extra === "content" ) {
- val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
- }
-
- // at this point, extra isn't border nor margin, so remove border
- if ( extra !== "margin" ) {
- val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
- }
- } else {
- // at this point, extra isn't content, so add padding
- val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
-
- // at this point, extra isn't content nor padding, so add border
- if ( extra !== "padding" ) {
- val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
- }
- }
- }
-
- return val;
-}
-
-function getWidthOrHeight( elem, name, extra ) {
-
- // Start with offset property, which is equivalent to the border-box value
- var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
- valueIsBorderBox = true,
- isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
-
- // some non-html elements return undefined for offsetWidth, so check for null/undefined
- // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
- // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
- if ( val <= 0 || val == null ) {
- // Fall back to computed then uncomputed css if necessary
- val = curCSS( elem, name );
- if ( val < 0 || val == null ) {
- val = elem.style[ name ];
- }
-
- // Computed unit is not pixels. Stop here and return.
- if ( rnumnonpx.test(val) ) {
- return val;
- }
-
- // we need the check for style in case a browser which returns unreliable values
- // for getComputedStyle silently falls back to the reliable elem.style
- valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
-
- // Normalize "", auto, and prepare for extra
- val = parseFloat( val ) || 0;
- }
-
- // use the active box-sizing model to add/subtract irrelevant styles
- return ( val +
- augmentWidthOrHeight(
- elem,
- name,
- extra || ( isBorderBox ? "border" : "content" ),
- valueIsBorderBox
- )
- ) + "px";
-}
-
-
-// Try to determine the default display value of an element
-function css_defaultDisplay( nodeName ) {
- if ( elemdisplay[ nodeName ] ) {
- return elemdisplay[ nodeName ];
- }
-
- var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
- display = elem.css("display");
- elem.remove();
-
- // If the simple way fails,
- // get element's real default display by attaching it to a temp iframe
- if ( display === "none" || display === "" ) {
- // Use the already-created iframe if possible
- iframe = document.body.appendChild(
- iframe || jQuery.extend( document.createElement("iframe"), {
- frameBorder: 0,
- width: 0,
- height: 0
- })
- );
-
- // Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
- // document to it; WebKit & Firefox won't allow reusing the iframe document.
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write("<!doctype html><html><body>");
- iframeDoc.close();
- }
-
- elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
-
- display = curCSS( elem, "display" );
- document.body.removeChild( iframe );
- }
-
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
-
- return display;
-}
-
-jQuery.each([ "height", "width" ], function( i, name ) {
- jQuery.cssHooks[ name ] = {
- get: function( elem, computed, extra ) {
- if ( computed ) {
- // certain elements can have dimension info if we invisibly show them
- // however, it must have a current display style that would benefit from this
- if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) {
- return jQuery.swap( elem, cssShow, function() {
- return getWidthOrHeight( elem, name, extra );
- });
- } else {
- return getWidthOrHeight( elem, name, extra );
- }
- }
- },
-
- set: function( elem, value, extra ) {
- return setPositiveNumber( elem, value, extra ?
- augmentWidthOrHeight(
- elem,
- name,
- extra,
- jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"
- ) : 0
- );
- }
- };
-});
-
-if ( !jQuery.support.opacity ) {
- jQuery.cssHooks.opacity = {
- get: function( elem, computed ) {
- // IE uses filters for opacity
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
- ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
- computed ? "1" : "";
- },
-
- set: function( elem, value ) {
- var style = elem.style,
- currentStyle = elem.currentStyle,
- opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
- filter = currentStyle && currentStyle.filter || style.filter || "";
-
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- style.zoom = 1;
-
- // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
- if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
- style.removeAttribute ) {
-
- // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
- // if "filter:" is present at all, clearType is disabled, we want to avoid this
- // style.removeAttribute is IE Only, but so apparently is this code path...
- style.removeAttribute( "filter" );
-
- // if there there is no filter style applied in a css rule, we are done
- if ( currentStyle && !currentStyle.filter ) {
- return;
- }
- }
-
- // otherwise, set new filter values
- style.filter = ralpha.test( filter ) ?
- filter.replace( ralpha, opacity ) :
- filter + " " + opacity;
- }
- };
-}
-
-// These hooks cannot be added until DOM ready because the support test
-// for it is not run until after DOM ready
-jQuery(function() {
- if ( !jQuery.support.reliableMarginRight ) {
- jQuery.cssHooks.marginRight = {
- get: function( elem, computed ) {
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- // Work around by temporarily setting element display to inline-block
- return jQuery.swap( elem, { "display": "inline-block" }, function() {
- if ( computed ) {
- return curCSS( elem, "marginRight" );
- }
- });
- }
- };
- }
-
- // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
- // getComputedStyle returns percent when specified for top/left/bottom/right
- // rather than make the css module depend on the offset module, we just check for it here
- if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
- jQuery.each( [ "top", "left" ], function( i, prop ) {
- jQuery.cssHooks[ prop ] = {
- get: function( elem, computed ) {
- if ( computed ) {
- var ret = curCSS( elem, prop );
- // if curCSS returns percentage, fallback to offset
- return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret;
- }
- }
- };
- });
- }
-
-});
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.hidden = function( elem ) {
- return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
- };
-
- jQuery.expr.filters.visible = function( elem ) {
- return !jQuery.expr.filters.hidden( elem );
- };
-}
-
-// These hooks are used by animate to expand properties
-jQuery.each({
- margin: "",
- padding: "",
- border: "Width"
-}, function( prefix, suffix ) {
- jQuery.cssHooks[ prefix + suffix ] = {
- expand: function( value ) {
- var i,
-
- // assumes a single number if not a string
- parts = typeof value === "string" ? value.split(" ") : [ value ],
- expanded = {};
-
- for ( i = 0; i < 4; i++ ) {
- expanded[ prefix + cssExpand[ i ] + suffix ] =
- parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
- }
-
- return expanded;
- }
- };
-
- if ( !rmargin.test( prefix ) ) {
- jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
- }
-});
-var r20 = /%20/g,
- rbracket = /\[\]$/,
- rCRLF = /\r?\n/g,
- rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
- rselectTextarea = /^(?:select|textarea)/i;
-
-jQuery.fn.extend({
- serialize: function() {
- return jQuery.param( this.serializeArray() );
- },
- serializeArray: function() {
- return this.map(function(){
- return this.elements ? jQuery.makeArray( this.elements ) : this;
- })
- .filter(function(){
- return this.name && !this.disabled &&
- ( this.checked || rselectTextarea.test( this.nodeName ) ||
- rinput.test( this.type ) );
- })
- .map(function( i, elem ){
- var val = jQuery( this ).val();
-
- return val == null ?
- null :
- jQuery.isArray( val ) ?
- jQuery.map( val, function( val, i ){
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }) :
- { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }).get();
- }
-});
-
-//Serialize an array of form elements or a set of
-//key/values into a query string
-jQuery.param = function( a, traditional ) {
- var prefix,
- s = [],
- add = function( key, value ) {
- // If value is a function, invoke it and return its value
- value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
- s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
- };
-
- // Set traditional to true for jQuery <= 1.3.2 behavior.
- if ( traditional === undefined ) {
- traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
- }
-
- // If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
- // Serialize the form elements
- jQuery.each( a, function() {
- add( this.name, this.value );
- });
-
- } else {
- // If traditional, encode the "old" way (the way 1.3.2 or older
- // did it), otherwise encode params recursively.
- for ( prefix in a ) {
- buildParams( prefix, a[ prefix ], traditional, add );
- }
- }
-
- // Return the resulting serialization
- return s.join( "&" ).replace( r20, "+" );
-};
-
-function buildParams( prefix, obj, traditional, add ) {
- var name;
-
- if ( jQuery.isArray( obj ) ) {
- // Serialize array item.
- jQuery.each( obj, function( i, v ) {
- if ( traditional || rbracket.test( prefix ) ) {
- // Treat each array item as a scalar.
- add( prefix, v );
-
- } else {
- // If array item is non-scalar (array or object), encode its
- // numeric index to resolve deserialization ambiguity issues.
- // Note that rack (as of 1.0.0) can't currently deserialize
- // nested arrays properly, and attempting to do so may cause
- // a server error. Possible fixes are to modify rack's
- // deserialization algorithm or to provide an option or flag
- // to force array serialization to be shallow.
- buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
- }
- });
-
- } else if ( !traditional && jQuery.type( obj ) === "object" ) {
- // Serialize object item.
- for ( name in obj ) {
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
- }
-
- } else {
- // Serialize scalar item.
- add( prefix, obj );
- }
-}
-var
- // Document location
- ajaxLocParts,
- ajaxLocation,
-
- rhash = /#.*$/,
- rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
- // #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
- rnoContent = /^(?:GET|HEAD)$/,
- rprotocol = /^\/\//,
- rquery = /\?/,
- rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
- rts = /([?&])_=[^&]*/,
- rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
-
- // Keep a copy of the old load method
- _load = jQuery.fn.load,
-
- /* Prefilters
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
- * 2) These are called:
- * - BEFORE asking for a transport
- * - AFTER param serialization (s.data is a string if s.processData is true)
- * 3) key is the dataType
- * 4) the catchall symbol "*" can be used
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
- */
- prefilters = {},
-
- /* Transports bindings
- * 1) key is the dataType
- * 2) the catchall symbol "*" can be used
- * 3) selection will start with transport dataType and THEN go to "*" if needed
- */
- transports = {},
-
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
- allTypes = ["*/"] + ["*"];
-
-// #8138, IE may throw an exception when accessing
-// a field from window.location if document.domain has been set
-try {
- ajaxLocation = location.href;
-} catch( e ) {
- // Use the href attribute of an A element
- // since IE will modify it given document.location
- ajaxLocation = document.createElement( "a" );
- ajaxLocation.href = "";
- ajaxLocation = ajaxLocation.href;
-}
-
-// Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
-
-// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
-function addToPrefiltersOrTransports( structure ) {
-
- // dataTypeExpression is optional and defaults to "*"
- return function( dataTypeExpression, func ) {
-
- if ( typeof dataTypeExpression !== "string" ) {
- func = dataTypeExpression;
- dataTypeExpression = "*";
- }
-
- var dataType, list, placeBefore,
- dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
- i = 0,
- length = dataTypes.length;
-
- if ( jQuery.isFunction( func ) ) {
- // For each dataType in the dataTypeExpression
- for ( ; i < length; i++ ) {
- dataType = dataTypes[ i ];
- // We control if we're asked to add before
- // any existing element
- placeBefore = /^\+/.test( dataType );
- if ( placeBefore ) {
- dataType = dataType.substr( 1 ) || "*";
- }
- list = structure[ dataType ] = structure[ dataType ] || [];
- // then we add to the structure accordingly
- list[ placeBefore ? "unshift" : "push" ]( func );
- }
- }
- };
-}
-
-// Base inspection function for prefilters and transports
-function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
- dataType /* internal */, inspected /* internal */ ) {
-
- dataType = dataType || options.dataTypes[ 0 ];
- inspected = inspected || {};
-
- inspected[ dataType ] = true;
-
- var selection,
- list = structure[ dataType ],
- i = 0,
- length = list ? list.length : 0,
- executeOnly = ( structure === prefilters );
-
- for ( ; i < length && ( executeOnly || !selection ); i++ ) {
- selection = list[ i ]( options, originalOptions, jqXHR );
- // If we got redirected to another dataType
- // we try there if executing only and not done already
- if ( typeof selection === "string" ) {
- if ( !executeOnly || inspected[ selection ] ) {
- selection = undefined;
- } else {
- options.dataTypes.unshift( selection );
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, selection, inspected );
- }
- }
- }
- // If we're only executing or nothing was selected
- // we try the catchall dataType if not done already
- if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, "*", inspected );
- }
- // unnecessary when only executing (prefilters)
- // but it'll be ignored by the caller in that case
- return selection;
-}
-
-// A special extend for ajax options
-// that takes "flat" options (not to be deep extended)
-// Fixes #9887
-function ajaxExtend( target, src ) {
- var key, deep,
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
- for ( key in src ) {
- if ( src[ key ] !== undefined ) {
- ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
- }
- }
- if ( deep ) {
- jQuery.extend( true, target, deep );
- }
-}
-
-jQuery.fn.load = function( url, params, callback ) {
- if ( typeof url !== "string" && _load ) {
- return _load.apply( this, arguments );
- }
-
- // Don't do a request if no elements are being requested
- if ( !this.length ) {
- return this;
- }
-
- var selector, type, response,
- self = this,
- off = url.indexOf(" ");
-
- if ( off >= 0 ) {
- selector = url.slice( off, url.length );
- url = url.slice( 0, off );
- }
-
- // If it's a function
- if ( jQuery.isFunction( params ) ) {
-
- // We assume that it's the callback
- callback = params;
- params = undefined;
-
- // Otherwise, build a param string
- } else if ( params && typeof params === "object" ) {
- type = "POST";
- }
-
- // Request the remote document
- jQuery.ajax({
- url: url,
-
- // if "type" variable is undefined, then "GET" method will be used
- type: type,
- dataType: "html",
- data: params,
- complete: function( jqXHR, status ) {
- if ( callback ) {
- self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
- }
- }
- }).done(function( responseText ) {
-
- // Save response for use in complete callback
- response = arguments;
-
- // See if a selector was specified
- self.html( selector ?
-
- // Create a dummy div to hold the results
- jQuery("<div>")
-
- // inject the contents of the document in, removing the scripts
- // to avoid any 'Permission Denied' errors in IE
- .append( responseText.replace( rscript, "" ) )
-
- // Locate the specified elements
- .find( selector ) :
-
- // If not, just inject the full result
- responseText );
-
- });
-
- return this;
-};
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
- jQuery.fn[ o ] = function( f ){
- return this.on( o, f );
- };
-});
-
-jQuery.each( [ "get", "post" ], function( i, method ) {
- jQuery[ method ] = function( url, data, callback, type ) {
- // shift arguments if data argument was omitted
- if ( jQuery.isFunction( data ) ) {
- type = type || callback;
- callback = data;
- data = undefined;
- }
-
- return jQuery.ajax({
- type: method,
- url: url,
- data: data,
- success: callback,
- dataType: type
- });
- };
-});
-
-jQuery.extend({
-
- getScript: function( url, callback ) {
- return jQuery.get( url, undefined, callback, "script" );
- },
-
- getJSON: function( url, data, callback ) {
- return jQuery.get( url, data, callback, "json" );
- },
-
- // Creates a full fledged settings object into target
- // with both ajaxSettings and settings fields.
- // If target is omitted, writes into ajaxSettings.
- ajaxSetup: function( target, settings ) {
- if ( settings ) {
- // Building a settings object
- ajaxExtend( target, jQuery.ajaxSettings );
- } else {
- // Extending ajaxSettings
- settings = target;
- target = jQuery.ajaxSettings;
- }
- ajaxExtend( target, settings );
- return target;
- },
-
- ajaxSettings: {
- url: ajaxLocation,
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
- global: true,
- type: "GET",
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- processData: true,
- async: true,
- /*
- timeout: 0,
- data: null,
- dataType: null,
- username: null,
- password: null,
- cache: null,
- throws: false,
- traditional: false,
- headers: {},
- */
-
- accepts: {
- xml: "application/xml, text/xml",
- html: "text/html",
- text: "text/plain",
- json: "application/json, text/javascript",
- "*": allTypes
- },
-
- contents: {
- xml: /xml/,
- html: /html/,
- json: /json/
- },
-
- responseFields: {
- xml: "responseXML",
- text: "responseText"
- },
-
- // List of data converters
- // 1) key format is "source_type destination_type" (a single space in-between)
- // 2) the catchall symbol "*" can be used for source_type
- converters: {
-
- // Convert anything to text
- "* text": window.String,
-
- // Text to html (true = no transformation)
- "text html": true,
-
- // Evaluate text as a json expression
- "text json": jQuery.parseJSON,
-
- // Parse text as xml
- "text xml": jQuery.parseXML
- },
-
- // For options that shouldn't be deep extended:
- // you can add your own custom options here if
- // and when you create one that shouldn't be
- // deep extended (see ajaxExtend)
- flatOptions: {
- context: true,
- url: true
- }
- },
-
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
- ajaxTransport: addToPrefiltersOrTransports( transports ),
-
- // Main method
- ajax: function( url, options ) {
-
- // If url is an object, simulate pre-1.5 signature
- if ( typeof url === "object" ) {
- options = url;
- url = undefined;
- }
-
- // Force options to be an object
- options = options || {};
-
- var // ifModified key
- ifModifiedKey,
- // Response headers
- responseHeadersString,
- responseHeaders,
- // transport
- transport,
- // timeout handle
- timeoutTimer,
- // Cross-domain detection vars
- parts,
- // To know if global events are to be dispatched
- fireGlobals,
- // Loop variable
- i,
- // Create the final options object
- s = jQuery.ajaxSetup( {}, options ),
- // Callbacks context
- callbackContext = s.context || s,
- // Context for global events
- // It's the callbackContext if one was provided in the options
- // and if it's a DOM node or a jQuery collection
- globalEventContext = callbackContext !== s &&
- ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
- jQuery( callbackContext ) : jQuery.event,
- // Deferreds
- deferred = jQuery.Deferred(),
- completeDeferred = jQuery.Callbacks( "once memory" ),
- // Status-dependent callbacks
- statusCode = s.statusCode || {},
- // Headers (they are sent all at once)
- requestHeaders = {},
- requestHeadersNames = {},
- // The jqXHR state
- state = 0,
- // Default abort message
- strAbort = "canceled",
- // Fake xhr
- jqXHR = {
-
- readyState: 0,
-
- // Caches the header
- setRequestHeader: function( name, value ) {
- if ( !state ) {
- var lname = name.toLowerCase();
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
-
- // Raw string
- getAllResponseHeaders: function() {
- return state === 2 ? responseHeadersString : null;
- },
-
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( state === 2 ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while( ( match = rheaders.exec( responseHeadersString ) ) ) {
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
- }
- }
- match = responseHeaders[ key.toLowerCase() ];
- }
- return match === undefined ? null : match;
- },
-
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( !state ) {
- s.mimeType = type;
- }
- return this;
- },
-
- // Cancel the request
- abort: function( statusText ) {
- statusText = statusText || strAbort;
- if ( transport ) {
- transport.abort( statusText );
- }
- done( 0, statusText );
- return this;
- }
- };
-
- // Callback for when everything is done
- // It is defined here because jslint complains if it is declared
- // at the end of the function (which would be more logical and readable)
- function done( status, nativeStatusText, responses, headers ) {
- var isSuccess, success, error, response, modified,
- statusText = nativeStatusText;
-
- // Called once
- if ( state === 2 ) {
- return;
- }
-
- // State is "done" now
- state = 2;
-
- // Clear timeout if it exists
- if ( timeoutTimer ) {
- clearTimeout( timeoutTimer );
- }
-
- // Dereference transport for early garbage collection
- // (no matter how long the jqXHR object will be used)
- transport = undefined;
-
- // Cache response headers
- responseHeadersString = headers || "";
-
- // Set readyState
- jqXHR.readyState = status > 0 ? 4 : 0;
-
- // Get response data
- if ( responses ) {
- response = ajaxHandleResponses( s, jqXHR, responses );
- }
-
- // If successful, handle type chaining
- if ( status >= 200 && status < 300 || status === 304 ) {
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
-
- modified = jqXHR.getResponseHeader("Last-Modified");
- if ( modified ) {
- jQuery.lastModified[ ifModifiedKey ] = modified;
- }
- modified = jqXHR.getResponseHeader("Etag");
- if ( modified ) {
- jQuery.etag[ ifModifiedKey ] = modified;
- }
- }
-
- // If not modified
- if ( status === 304 ) {
-
- statusText = "notmodified";
- isSuccess = true;
-
- // If we have data
- } else {
-
- isSuccess = ajaxConvert( s, response );
- statusText = isSuccess.state;
- success = isSuccess.data;
- error = isSuccess.error;
- isSuccess = !error;
- }
- } else {
- // We extract error from statusText
- // then normalize statusText and status for non-aborts
- error = statusText;
- if ( !statusText || status ) {
- statusText = "error";
- if ( status < 0 ) {
- status = 0;
- }
- }
- }
-
- // Set data for the fake xhr object
- jqXHR.status = status;
- jqXHR.statusText = ( nativeStatusText || statusText ) + "";
-
- // Success/Error
- if ( isSuccess ) {
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
- } else {
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
- }
-
- // Status-dependent callbacks
- jqXHR.statusCode( statusCode );
- statusCode = undefined;
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
- [ jqXHR, s, isSuccess ? success : error ] );
- }
-
- // Complete
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
- // Handle the global AJAX counter
- if ( !( --jQuery.active ) ) {
- jQuery.event.trigger( "ajaxStop" );
- }
- }
- }
-
- // Attach deferreds
- deferred.promise( jqXHR );
- jqXHR.success = jqXHR.done;
- jqXHR.error = jqXHR.fail;
- jqXHR.complete = completeDeferred.add;
-
- // Status-dependent callbacks
- jqXHR.statusCode = function( map ) {
- if ( map ) {
- var tmp;
- if ( state < 2 ) {
- for ( tmp in map ) {
- statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
- }
- } else {
- tmp = map[ jqXHR.status ];
- jqXHR.always( tmp );
- }
- }
- return this;
- };
-
- // Remove hash character (#7531: and string promotion)
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
- // We also use the url parameter if available
- s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
-
- // Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
-
- // A cross-domain request is in order when we have a protocol:host:port mismatch
- if ( s.crossDomain == null ) {
- parts = rurl.exec( s.url.toLowerCase() );
- s.crossDomain = !!( parts &&
- ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
- );
- }
-
- // Convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" ) {
- s.data = jQuery.param( s.data, s.traditional );
- }
-
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
-
- // If request was aborted inside a prefilter, stop there
- if ( state === 2 ) {
- return jqXHR;
- }
-
- // We can fire global events as of now if asked to
- fireGlobals = s.global;
-
- // Uppercase the type
- s.type = s.type.toUpperCase();
-
- // Determine if request has content
- s.hasContent = !rnoContent.test( s.type );
-
- // Watch for a new set of requests
- if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger( "ajaxStart" );
- }
-
- // More options handling for requests with no content
- if ( !s.hasContent ) {
-
- // If data is available, append data to url
- if ( s.data ) {
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
- // #9682: remove data so that it's not used in an eventual retry
- delete s.data;
- }
-
- // Get ifModifiedKey before adding the anti-cache parameter
- ifModifiedKey = s.url;
-
- // Add anti-cache in url if needed
- if ( s.cache === false ) {
-
- var ts = jQuery.now(),
- // try replacing _= if it is there
- ret = s.url.replace( rts, "$1_=" + ts );
-
- // if nothing was replaced, add timestamp to the end
- s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
- }
- }
-
- // Set the correct header, if data is being sent
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
- }
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- ifModifiedKey = ifModifiedKey || s.url;
- if ( jQuery.lastModified[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
- }
- if ( jQuery.etag[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
- }
- }
-
- // Set the Accepts header for the server, depending on the dataType
- jqXHR.setRequestHeader(
- "Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
- s.accepts[ "*" ]
- );
-
- // Check for headers option
- for ( i in s.headers ) {
- jqXHR.setRequestHeader( i, s.headers[ i ] );
- }
-
- // Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
- // Abort if not done already and return
- return jqXHR.abort();
-
- }
-
- // aborting is no longer a cancellation
- strAbort = "abort";
-
- // Install callbacks on deferreds
- for ( i in { success: 1, error: 1, complete: 1 } ) {
- jqXHR[ i ]( s[ i ] );
- }
-
- // Get transport
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
-
- // If no transport, we auto-abort
- if ( !transport ) {
- done( -1, "No Transport" );
- } else {
- jqXHR.readyState = 1;
- // Send global event
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
- }
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = setTimeout( function(){
- jqXHR.abort( "timeout" );
- }, s.timeout );
- }
-
- try {
- state = 1;
- transport.send( requestHeaders, done );
- } catch (e) {
- // Propagate exception as error if not done
- if ( state < 2 ) {
- done( -1, e );
- // Simply rethrow otherwise
- } else {
- throw e;
- }
- }
- }
-
- return jqXHR;
- },
-
- // Counter for holding the number of active queries
- active: 0,
-
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {}
-
-});
-
-/* Handles responses to an ajax request:
- * - sets all responseXXX fields accordingly
- * - finds the right dataType (mediates between content-type and expected dataType)
- * - returns the corresponding response
- */
-function ajaxHandleResponses( s, jqXHR, responses ) {
-
- var ct, type, finalDataType, firstDataType,
- contents = s.contents,
- dataTypes = s.dataTypes,
- responseFields = s.responseFields;
-
- // Fill responseXXX fields
- for ( type in responseFields ) {
- if ( type in responses ) {
- jqXHR[ responseFields[type] ] = responses[ type ];
- }
- }
-
- // Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
- dataTypes.shift();
- if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
- }
- }
-
- // Check if we're dealing with a known content-type
- if ( ct ) {
- for ( type in contents ) {
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
- dataTypes.unshift( type );
- break;
- }
- }
- }
-
- // Check to see if we have a response for the expected dataType
- if ( dataTypes[ 0 ] in responses ) {
- finalDataType = dataTypes[ 0 ];
- } else {
- // Try convertible dataTypes
- for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
- finalDataType = type;
- break;
- }
- if ( !firstDataType ) {
- firstDataType = type;
- }
- }
- // Or just use first one
- finalDataType = finalDataType || firstDataType;
- }
-
- // If we found a dataType
- // We add the dataType to the list if needed
- // and return the corresponding response
- if ( finalDataType ) {
- if ( finalDataType !== dataTypes[ 0 ] ) {
- dataTypes.unshift( finalDataType );
- }
- return responses[ finalDataType ];
- }
-}
-
-// Chain conversions given the request and the original response
-function ajaxConvert( s, response ) {
-
- var conv, conv2, current, tmp,
- // Work with a copy of dataTypes in case we need to modify it for conversion
- dataTypes = s.dataTypes.slice(),
- prev = dataTypes[ 0 ],
- converters = {},
- i = 0;
-
- // Apply the dataFilter if provided
- if ( s.dataFilter ) {
- response = s.dataFilter( response, s.dataType );
- }
-
- // Create converters map with lowercased keys
- if ( dataTypes[ 1 ] ) {
- for ( conv in s.converters ) {
- converters[ conv.toLowerCase() ] = s.converters[ conv ];
- }
- }
-
- // Convert to each sequential dataType, tolerating list modification
- for ( ; (current = dataTypes[++i]); ) {
-
- // There's only work to do if current dataType is non-auto
- if ( current !== "*" ) {
-
- // Convert response if prev dataType is non-auto and differs from current
- if ( prev !== "*" && prev !== current ) {
-
- // Seek a direct converter
- conv = converters[ prev + " " + current ] || converters[ "* " + current ];
-
- // If none found, seek a pair
- if ( !conv ) {
- for ( conv2 in converters ) {
-
- // If conv2 outputs current
- tmp = conv2.split(" ");
- if ( tmp[ 1 ] === current ) {
-
- // If prev can be converted to accepted input
- conv = converters[ prev + " " + tmp[ 0 ] ] ||
- converters[ "* " + tmp[ 0 ] ];
- if ( conv ) {
- // Condense equivalence converters
- if ( conv === true ) {
- conv = converters[ conv2 ];
-
- // Otherwise, insert the intermediate dataType
- } else if ( converters[ conv2 ] !== true ) {
- current = tmp[ 0 ];
- dataTypes.splice( i--, 0, current );
- }
-
- break;
- }
- }
- }
- }
-
- // Apply converter (if not an equivalence)
- if ( conv !== true ) {
-
- // Unless errors are allowed to bubble, catch and return them
- if ( conv && s["throws"] ) {
- response = conv( response );
- } else {
- try {
- response = conv( response );
- } catch ( e ) {
- return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
- }
- }
- }
- }
-
- // Update prev for next iteration
- prev = current;
- }
- }
-
- return { state: "success", data: response };
-}
-var oldCallbacks = [],
- rquestion = /\?/,
- rjsonp = /(=)\?(?=&|$)|\?\?/,
- nonce = jQuery.now();
-
-// Default jsonp settings
-jQuery.ajaxSetup({
- jsonp: "callback",
- jsonpCallback: function() {
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
- this[ callback ] = true;
- return callback;
- }
-});
-
-// Detect, normalize options and install callbacks for jsonp requests
-jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
-
- var callbackName, overwritten, responseContainer,
- data = s.data,
- url = s.url,
- hasCallback = s.jsonp !== false,
- replaceInUrl = hasCallback && rjsonp.test( url ),
- replaceInData = hasCallback && !replaceInUrl && typeof data === "string" &&
- !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
- rjsonp.test( data );
-
- // Handle iff the expected data type is "jsonp" or we have a parameter to set
- if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) {
-
- // Get callback name, remembering preexisting value associated with it
- callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
- s.jsonpCallback() :
- s.jsonpCallback;
- overwritten = window[ callbackName ];
-
- // Insert callback into url or form data
- if ( replaceInUrl ) {
- s.url = url.replace( rjsonp, "$1" + callbackName );
- } else if ( replaceInData ) {
- s.data = data.replace( rjsonp, "$1" + callbackName );
- } else if ( hasCallback ) {
- s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
- }
-
- // Use data converter to retrieve json after script execution
- s.converters["script json"] = function() {
- if ( !responseContainer ) {
- jQuery.error( callbackName + " was not called" );
- }
- return responseContainer[ 0 ];
- };
-
- // force json dataType
- s.dataTypes[ 0 ] = "json";
-
- // Install callback
- window[ callbackName ] = function() {
- responseContainer = arguments;
- };
-
- // Clean-up function (fires after converters)
- jqXHR.always(function() {
- // Restore preexisting value
- window[ callbackName ] = overwritten;
-
- // Save back as free
- if ( s[ callbackName ] ) {
- // make sure that re-using the options doesn't screw things around
- s.jsonpCallback = originalSettings.jsonpCallback;
-
- // save the callback name for future use
- oldCallbacks.push( callbackName );
- }
-
- // Call if it was a function and we have a response
- if ( responseContainer && jQuery.isFunction( overwritten ) ) {
- overwritten( responseContainer[ 0 ] );
- }
-
- responseContainer = overwritten = undefined;
- });
-
- // Delegate to script
- return "script";
- }
-});
-// Install script dataType
-jQuery.ajaxSetup({
- accepts: {
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
- },
- contents: {
- script: /javascript|ecmascript/
- },
- converters: {
- "text script": function( text ) {
- jQuery.globalEval( text );
- return text;
- }
- }
-});
-
-// Handle cache's special case and global
-jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- s.global = false;
- }
-});
-
-// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
-
- // This transport only deals with cross domain requests
- if ( s.crossDomain ) {
-
- var script,
- head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
-
- return {
-
- send: function( _, callback ) {
-
- script = document.createElement( "script" );
-
- script.async = "async";
-
- if ( s.scriptCharset ) {
- script.charset = s.scriptCharset;
- }
-
- script.src = s.url;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _, isAbort ) {
-
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
-
- // Remove the script
- if ( head && script.parentNode ) {
- head.removeChild( script );
- }
-
- // Dereference the script
- script = undefined;
-
- // Callback if not abort
- if ( !isAbort ) {
- callback( 200, "success" );
- }
- }
- };
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709 and #4378).
- head.insertBefore( script, head.firstChild );
- },
-
- abort: function() {
- if ( script ) {
- script.onload( 0, 1 );
- }
- }
- };
- }
-});
-var xhrCallbacks,
- // #5280: Internet Explorer will keep connections alive if we don't abort on unload
- xhrOnUnloadAbort = window.ActiveXObject ? function() {
- // Abort all pending requests
- for ( var key in xhrCallbacks ) {
- xhrCallbacks[ key ]( 0, 1 );
- }
- } : false,
- xhrId = 0;
-
-// Functions to create xhrs
-function createStandardXHR() {
- try {
- return new window.XMLHttpRequest();
- } catch( e ) {}
-}
-
-function createActiveXHR() {
- try {
- return new window.ActiveXObject( "Microsoft.XMLHTTP" );
- } catch( e ) {}
-}
-
-// Create the request object
-// (This is still attached to ajaxSettings for backward compatibility)
-jQuery.ajaxSettings.xhr = window.ActiveXObject ?
- /* Microsoft failed to properly
- * implement the XMLHttpRequest in IE7 (can't request local files),
- * so we use the ActiveXObject when it is available
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
- * we need a fallback.
- */
- function() {
- return !this.isLocal && createStandardXHR() || createActiveXHR();
- } :
- // For all other browsers, use the standard XMLHttpRequest object
- createStandardXHR;
-
-// Determine support properties
-(function( xhr ) {
- jQuery.extend( jQuery.support, {
- ajax: !!xhr,
- cors: !!xhr && ( "withCredentials" in xhr )
- });
-})( jQuery.ajaxSettings.xhr() );
-
-// Create transport if the browser can provide an xhr
-if ( jQuery.support.ajax ) {
-
- jQuery.ajaxTransport(function( s ) {
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( !s.crossDomain || jQuery.support.cors ) {
-
- var callback;
-
- return {
- send: function( headers, complete ) {
-
- // Get a new xhr
- var handle, i,
- xhr = s.xhr();
-
- // Open the socket
- // Passing null username, generates a login popup on Opera (#2865)
- if ( s.username ) {
- xhr.open( s.type, s.url, s.async, s.username, s.password );
- } else {
- xhr.open( s.type, s.url, s.async );
- }
-
- // Apply custom fields if provided
- if ( s.xhrFields ) {
- for ( i in s.xhrFields ) {
- xhr[ i ] = s.xhrFields[ i ];
- }
- }
-
- // Override mime type if needed
- if ( s.mimeType && xhr.overrideMimeType ) {
- xhr.overrideMimeType( s.mimeType );
- }
-
- // X-Requested-With header
- // For cross-domain requests, seeing as conditions for a preflight are
- // akin to a jigsaw puzzle, we simply never set it to be sure.
- // (it can always be set on a per-request basis or even using ajaxSetup)
- // For same-domain requests, won't change header if already provided.
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
- headers[ "X-Requested-With" ] = "XMLHttpRequest";
- }
-
- // Need an extra try/catch for cross domain requests in Firefox 3
- try {
- for ( i in headers ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
- } catch( _ ) {}
-
- // Do send the request
- // This may raise an exception which is actually
- // handled in jQuery.ajax (so no try/catch here)
- xhr.send( ( s.hasContent && s.data ) || null );
-
- // Listener
- callback = function( _, isAbort ) {
-
- var status,
- statusText,
- responseHeaders,
- responses,
- xml;
-
- // Firefox throws exceptions when accessing properties
- // of an xhr when a network error occurred
- // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
- try {
-
- // Was never called and is aborted or complete
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
-
- // Only called once
- callback = undefined;
-
- // Do not keep as active anymore
- if ( handle ) {
- xhr.onreadystatechange = jQuery.noop;
- if ( xhrOnUnloadAbort ) {
- delete xhrCallbacks[ handle ];
- }
- }
-
- // If it's an abort
- if ( isAbort ) {
- // Abort it manually if needed
- if ( xhr.readyState !== 4 ) {
- xhr.abort();
- }
- } else {
- status = xhr.status;
- responseHeaders = xhr.getAllResponseHeaders();
- responses = {};
- xml = xhr.responseXML;
-
- // Construct response list
- if ( xml && xml.documentElement /* #4958 */ ) {
- responses.xml = xml;
- }
-
- // When requesting binary data, IE6-9 will throw an exception
- // on any attempt to access responseText (#11426)
- try {
- responses.text = xhr.responseText;
- } catch( e ) {
- }
-
- // Firefox throws an exception when accessing
- // statusText for faulty cross-domain requests
- try {
- statusText = xhr.statusText;
- } catch( e ) {
- // We normalize with Webkit giving an empty statusText
- statusText = "";
- }
-
- // Filter status for non standard behaviors
-
- // If the request is local and we have data: assume a success
- // (success with no data won't get notified, that's the best we
- // can do given current implementations)
- if ( !status && s.isLocal && !s.crossDomain ) {
- status = responses.text ? 200 : 404;
- // IE - #1450: sometimes returns 1223 when it should be 204
- } else if ( status === 1223 ) {
- status = 204;
- }
- }
- }
- } catch( firefoxAccessException ) {
- if ( !isAbort ) {
- complete( -1, firefoxAccessException );
- }
- }
-
- // Call complete if needed
- if ( responses ) {
- complete( status, statusText, responses, responseHeaders );
- }
- };
-
- if ( !s.async ) {
- // if we're in sync mode we fire the callback
- callback();
- } else if ( xhr.readyState === 4 ) {
- // (IE6 & IE7) if it's in cache and has been
- // retrieved directly we need to fire the callback
- setTimeout( callback, 0 );
- } else {
- handle = ++xhrId;
- if ( xhrOnUnloadAbort ) {
- // Create the active xhrs callbacks list if needed
- // and attach the unload handler
- if ( !xhrCallbacks ) {
- xhrCallbacks = {};
- jQuery( window ).unload( xhrOnUnloadAbort );
- }
- // Add to list of active xhrs callbacks
- xhrCallbacks[ handle ] = callback;
- }
- xhr.onreadystatechange = callback;
- }
- },
-
- abort: function() {
- if ( callback ) {
- callback(0,1);
- }
- }
- };
- }
- });
-}
-var fxNow, timerId,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
- rrun = /queueHooks$/,
- animationPrefilters = [ defaultPrefilter ],
- tweeners = {
- "*": [function( prop, value ) {
- var end, unit,
- tween = this.createTween( prop, value ),
- parts = rfxnum.exec( value ),
- target = tween.cur(),
- start = +target || 0,
- scale = 1,
- maxIterations = 20;
-
- if ( parts ) {
- end = +parts[2];
- unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
-
- // We need to compute starting value
- if ( unit !== "px" && start ) {
- // Iteratively approximate from a nonzero starting point
- // Prefer the current property, because this process will be trivial if it uses the same units
- // Fallback to end or a simple constant
- start = jQuery.css( tween.elem, prop, true ) || end || 1;
-
- do {
- // If previous iteration zeroed out, double until we get *something*
- // Use a string for doubling factor so we don't accidentally see scale as unchanged below
- scale = scale || ".5";
-
- // Adjust and apply
- start = start / scale;
- jQuery.style( tween.elem, prop, start + unit );
-
- // Update scale, tolerating zero or NaN from tween.cur()
- // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
- } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
- }
-
- tween.unit = unit;
- tween.start = start;
- // If a +=/-= token was provided, we're doing a relative animation
- tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
- }
- return tween;
- }]
- };
-
-// Animations created synchronously will run synchronously
-function createFxNow() {
- setTimeout(function() {
- fxNow = undefined;
- }, 0 );
- return ( fxNow = jQuery.now() );
-}
-
-function createTweens( animation, props ) {
- jQuery.each( props, function( prop, value ) {
- var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
- index = 0,
- length = collection.length;
- for ( ; index < length; index++ ) {
- if ( collection[ index ].call( animation, prop, value ) ) {
-
- // we're done with this property
- return;
- }
- }
- });
-}
-
-function Animation( elem, properties, options ) {
- var result,
- index = 0,
- tweenerIndex = 0,
- length = animationPrefilters.length,
- deferred = jQuery.Deferred().always( function() {
- // don't match elem in the :animated selector
- delete tick.elem;
- }),
- tick = function() {
- var currentTime = fxNow || createFxNow(),
- remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
- // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
- temp = remaining / animation.duration || 0,
- percent = 1 - temp,
- index = 0,
- length = animation.tweens.length;
-
- for ( ; index < length ; index++ ) {
- animation.tweens[ index ].run( percent );
- }
-
- deferred.notifyWith( elem, [ animation, percent, remaining ]);
-
- if ( percent < 1 && length ) {
- return remaining;
- } else {
- deferred.resolveWith( elem, [ animation ] );
- return false;
- }
- },
- animation = deferred.promise({
- elem: elem,
- props: jQuery.extend( {}, properties ),
- opts: jQuery.extend( true, { specialEasing: {} }, options ),
- originalProperties: properties,
- originalOptions: options,
- startTime: fxNow || createFxNow(),
- duration: options.duration,
- tweens: [],
- createTween: function( prop, end, easing ) {
- var tween = jQuery.Tween( elem, animation.opts, prop, end,
- animation.opts.specialEasing[ prop ] || animation.opts.easing );
- animation.tweens.push( tween );
- return tween;
- },
- stop: function( gotoEnd ) {
- var index = 0,
- // if we are going to the end, we want to run all the tweens
- // otherwise we skip this part
- length = gotoEnd ? animation.tweens.length : 0;
-
- for ( ; index < length ; index++ ) {
- animation.tweens[ index ].run( 1 );
- }
-
- // resolve when we played the last frame
- // otherwise, reject
- if ( gotoEnd ) {
- deferred.resolveWith( elem, [ animation, gotoEnd ] );
- } else {
- deferred.rejectWith( elem, [ animation, gotoEnd ] );
- }
- return this;
- }
- }),
- props = animation.props;
-
- propFilter( props, animation.opts.specialEasing );
-
- for ( ; index < length ; index++ ) {
- result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
- if ( result ) {
- return result;
- }
- }
-
- createTweens( animation, props );
-
- if ( jQuery.isFunction( animation.opts.start ) ) {
- animation.opts.start.call( elem, animation );
- }
-
- jQuery.fx.timer(
- jQuery.extend( tick, {
- anim: animation,
- queue: animation.opts.queue,
- elem: elem
- })
- );
-
- // attach callbacks from options
- return animation.progress( animation.opts.progress )
- .done( animation.opts.done, animation.opts.complete )
- .fail( animation.opts.fail )
- .always( animation.opts.always );
-}
-
-function propFilter( props, specialEasing ) {
- var index, name, easing, value, hooks;
-
- // camelCase, specialEasing and expand cssHook pass
- for ( index in props ) {
- name = jQuery.camelCase( index );
- easing = specialEasing[ name ];
- value = props[ index ];
- if ( jQuery.isArray( value ) ) {
- easing = value[ 1 ];
- value = props[ index ] = value[ 0 ];
- }
-
- if ( index !== name ) {
- props[ name ] = value;
- delete props[ index ];
- }
-
- hooks = jQuery.cssHooks[ name ];
- if ( hooks && "expand" in hooks ) {
- value = hooks.expand( value );
- delete props[ name ];
-
- // not quite $.extend, this wont overwrite keys already present.
- // also - reusing 'index' from above because we have the correct "name"
- for ( index in value ) {
- if ( !( index in props ) ) {
- props[ index ] = value[ index ];
- specialEasing[ index ] = easing;
- }
- }
- } else {
- specialEasing[ name ] = easing;
- }
- }
-}
-
-jQuery.Animation = jQuery.extend( Animation, {
-
- tweener: function( props, callback ) {
- if ( jQuery.isFunction( props ) ) {
- callback = props;
- props = [ "*" ];
- } else {
- props = props.split(" ");
- }
-
- var prop,
- index = 0,
- length = props.length;
-
- for ( ; index < length ; index++ ) {
- prop = props[ index ];
- tweeners[ prop ] = tweeners[ prop ] || [];
- tweeners[ prop ].unshift( callback );
- }
- },
-
- prefilter: function( callback, prepend ) {
- if ( prepend ) {
- animationPrefilters.unshift( callback );
- } else {
- animationPrefilters.push( callback );
- }
- }
-});
-
-function defaultPrefilter( elem, props, opts ) {
- var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
- anim = this,
- style = elem.style,
- orig = {},
- handled = [],
- hidden = elem.nodeType && isHidden( elem );
-
- // handle queue: false promises
- if ( !opts.queue ) {
- hooks = jQuery._queueHooks( elem, "fx" );
- if ( hooks.unqueued == null ) {
- hooks.unqueued = 0;
- oldfire = hooks.empty.fire;
- hooks.empty.fire = function() {
- if ( !hooks.unqueued ) {
- oldfire();
- }
- };
- }
- hooks.unqueued++;
-
- anim.always(function() {
- // doing this makes sure that the complete handler will be called
- // before this completes
- anim.always(function() {
- hooks.unqueued--;
- if ( !jQuery.queue( elem, "fx" ).length ) {
- hooks.empty.fire();
- }
- });
- });
- }
-
- // height/width overflow pass
- if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE does not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
-
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height animated
- if ( jQuery.css( elem, "display" ) === "inline" &&
- jQuery.css( elem, "float" ) === "none" ) {
-
- // inline-level elements accept inline-block;
- // block-level elements need to be inline with layout
- if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
- style.display = "inline-block";
-
- } else {
- style.zoom = 1;
- }
- }
- }
-
- if ( opts.overflow ) {
- style.overflow = "hidden";
- if ( !jQuery.support.shrinkWrapBlocks ) {
- anim.done(function() {
- style.overflow = opts.overflow[ 0 ];
- style.overflowX = opts.overflow[ 1 ];
- style.overflowY = opts.overflow[ 2 ];
- });
- }
- }
-
-
- // show/hide pass
- for ( index in props ) {
- value = props[ index ];
- if ( rfxtypes.exec( value ) ) {
- delete props[ index ];
- toggle = toggle || value === "toggle";
- if ( value === ( hidden ? "hide" : "show" ) ) {
- continue;
- }
- handled.push( index );
- }
- }
-
- length = handled.length;
- if ( length ) {
- dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
- if ( "hidden" in dataShow ) {
- hidden = dataShow.hidden;
- }
-
- // store state if its toggle - enables .stop().toggle() to "reverse"
- if ( toggle ) {
- dataShow.hidden = !hidden;
- }
- if ( hidden ) {
- jQuery( elem ).show();
- } else {
- anim.done(function() {
- jQuery( elem ).hide();
- });
- }
- anim.done(function() {
- var prop;
- jQuery.removeData( elem, "fxshow", true );
- for ( prop in orig ) {
- jQuery.style( elem, prop, orig[ prop ] );
- }
- });
- for ( index = 0 ; index < length ; index++ ) {
- prop = handled[ index ];
- tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
- orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
-
- if ( !( prop in dataShow ) ) {
- dataShow[ prop ] = tween.start;
- if ( hidden ) {
- tween.end = tween.start;
- tween.start = prop === "width" || prop === "height" ? 1 : 0;
- }
- }
- }
- }
-}
-
-function Tween( elem, options, prop, end, easing ) {
- return new Tween.prototype.init( elem, options, prop, end, easing );
-}
-jQuery.Tween = Tween;
-
-Tween.prototype = {
- constructor: Tween,
- init: function( elem, options, prop, end, easing, unit ) {
- this.elem = elem;
- this.prop = prop;
- this.easing = easing || "swing";
- this.options = options;
- this.start = this.now = this.cur();
- this.end = end;
- this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
- },
- cur: function() {
- var hooks = Tween.propHooks[ this.prop ];
-
- return hooks && hooks.get ?
- hooks.get( this ) :
- Tween.propHooks._default.get( this );
- },
- run: function( percent ) {
- var eased,
- hooks = Tween.propHooks[ this.prop ];
-
- if ( this.options.duration ) {
- this.pos = eased = jQuery.easing[ this.easing ](
- percent, this.options.duration * percent, 0, 1, this.options.duration
- );
- } else {
- this.pos = eased = percent;
- }
- this.now = ( this.end - this.start ) * eased + this.start;
-
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
-
- if ( hooks && hooks.set ) {
- hooks.set( this );
- } else {
- Tween.propHooks._default.set( this );
- }
- return this;
- }
-};
-
-Tween.prototype.init.prototype = Tween.prototype;
-
-Tween.propHooks = {
- _default: {
- get: function( tween ) {
- var result;
-
- if ( tween.elem[ tween.prop ] != null &&
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
- return tween.elem[ tween.prop ];
- }
-
- // passing any value as a 4th parameter to .css will automatically
- // attempt a parseFloat and fallback to a string if the parse fails
- // so, simple values such as "10px" are parsed to Float.
- // complex values such as "rotate(1rad)" are returned as is.
- result = jQuery.css( tween.elem, tween.prop, false, "" );
- // Empty strings, null, undefined and "auto" are converted to 0.
- return !result || result === "auto" ? 0 : result;
- },
- set: function( tween ) {
- // use step hook for back compat - use cssHook if its there - use .style if its
- // available and use plain properties where available
- if ( jQuery.fx.step[ tween.prop ] ) {
- jQuery.fx.step[ tween.prop ]( tween );
- } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
- } else {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
- }
-};
-
-// Remove in 2.0 - this supports IE8's panic based approach
-// to setting things on disconnected nodes
-
-Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
- set: function( tween ) {
- if ( tween.elem.nodeType && tween.elem.parentNode ) {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
-};
-
-jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
- var cssFn = jQuery.fn[ name ];
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return speed == null || typeof speed === "boolean" ||
- // special check for .toggle( handler, handler, ... )
- ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
- cssFn.apply( this, arguments ) :
- this.animate( genFx( name, true ), speed, easing, callback );
- };
-});
-
-jQuery.fn.extend({
- fadeTo: function( speed, to, easing, callback ) {
-
- // show any hidden elements after setting opacity to 0
- return this.filter( isHidden ).css( "opacity", 0 ).show()
-
- // animate to the value specified
- .end().animate({ opacity: to }, speed, easing, callback );
- },
- animate: function( prop, speed, easing, callback ) {
- var empty = jQuery.isEmptyObject( prop ),
- optall = jQuery.speed( speed, easing, callback ),
- doAnimation = function() {
- // Operate on a copy of prop so per-property easing won't be lost
- var anim = Animation( this, jQuery.extend( {}, prop ), optall );
-
- // Empty animations resolve immediately
- if ( empty ) {
- anim.stop( true );
- }
- };
-
- return empty || optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
- stop: function( type, clearQueue, gotoEnd ) {
- var stopQueue = function( hooks ) {
- var stop = hooks.stop;
- delete hooks.stop;
- stop( gotoEnd );
- };
-
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
-
- return this.each(function() {
- var dequeue = true,
- index = type != null && type + "queueHooks",
- timers = jQuery.timers,
- data = jQuery._data( this );
-
- if ( index ) {
- if ( data[ index ] && data[ index ].stop ) {
- stopQueue( data[ index ] );
- }
- } else {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
- stopQueue( data[ index ] );
- }
- }
- }
-
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
- timers[ index ].anim.stop( gotoEnd );
- dequeue = false;
- timers.splice( index, 1 );
- }
- }
-
- // start the next in the queue if the last step wasn't forced
- // timers currently will call their complete callbacks, which will dequeue
- // but only if they were gotoEnd
- if ( dequeue || !gotoEnd ) {
- jQuery.dequeue( this, type );
- }
- });
- }
-});
-
-// Generate parameters to create a standard animation
-function genFx( type, includeWidth ) {
- var which,
- attrs = { height: type },
- i = 0;
-
- // if we include width, step value is 1 to do all cssExpand values,
- // if we don't include width, step value is 2 to skip over Left and Right
- includeWidth = includeWidth? 1 : 0;
- for( ; i < 4 ; i += 2 - includeWidth ) {
- which = cssExpand[ i ];
- attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
- }
-
- if ( includeWidth ) {
- attrs.opacity = attrs.width = type;
- }
-
- return attrs;
-}
-
-// Generate shortcuts for custom animations
-jQuery.each({
- slideDown: genFx("show"),
- slideUp: genFx("hide"),
- slideToggle: genFx("toggle"),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
-}, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
-});
-
-jQuery.speed = function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
- };
-
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
-
- // normalize opt.queue - true/undefined/null -> "fx"
- if ( opt.queue == null || opt.queue === true ) {
- opt.queue = "fx";
- }
-
- // Queueing
- opt.old = opt.complete;
-
- opt.complete = function() {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
-
- if ( opt.queue ) {
- jQuery.dequeue( this, opt.queue );
- }
- };
-
- return opt;
-};
-
-jQuery.easing = {
- linear: function( p ) {
- return p;
- },
- swing: function( p ) {
- return 0.5 - Math.cos( p*Math.PI ) / 2;
- }
-};
-
-jQuery.timers = [];
-jQuery.fx = Tween.prototype.init;
-jQuery.fx.tick = function() {
- var timer,
- timers = jQuery.timers,
- i = 0;
-
- fxNow = jQuery.now();
-
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
- // Checks the timer has not already been removed
- if ( !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
-
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- fxNow = undefined;
-};
-
-jQuery.fx.timer = function( timer ) {
- if ( timer() && jQuery.timers.push( timer ) && !timerId ) {
- timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
- }
-};
-
-jQuery.fx.interval = 13;
-
-jQuery.fx.stop = function() {
- clearInterval( timerId );
- timerId = null;
-};
-
-jQuery.fx.speeds = {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
-};
-
-// Back Compat <1.8 extension point
-jQuery.fx.step = {};
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
- };
-}
-var rroot = /^(?:body|html)$/i;
-
-jQuery.fn.offset = function( options ) {
- if ( arguments.length ) {
- return options === undefined ?
- this :
- this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,
- box = { top: 0, left: 0 },
- elem = this[ 0 ],
- doc = elem && elem.ownerDocument;
-
- if ( !doc ) {
- return;
- }
-
- if ( (body = doc.body) === elem ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- docElem = doc.documentElement;
-
- // Make sure it's not a disconnected DOM node
- if ( !jQuery.contains( docElem, elem ) ) {
- return box;
- }
-
- // If we don't have gBCR, just use 0,0 rather than error
- // BlackBerry 5, iOS 3 (original iPhone)
- if ( typeof elem.getBoundingClientRect !== "undefined" ) {
- box = elem.getBoundingClientRect();
- }
- win = getWindow( doc );
- clientTop = docElem.clientTop || body.clientTop || 0;
- clientLeft = docElem.clientLeft || body.clientLeft || 0;
- scrollTop = win.pageYOffset || docElem.scrollTop;
- scrollLeft = win.pageXOffset || docElem.scrollLeft;
- return {
- top: box.top + scrollTop - clientTop,
- left: box.left + scrollLeft - clientLeft
- };
-};
-
-jQuery.offset = {
-
- bodyOffset: function( body ) {
- var top = body.offsetTop,
- left = body.offsetLeft;
-
- if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
- top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
- left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
- }
-
- return { top: top, left: left };
- },
-
- setOffset: function( elem, options, i ) {
- var position = jQuery.css( elem, "position" );
-
- // set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
-
- var curElem = jQuery( elem ),
- curOffset = curElem.offset(),
- curCSSTop = jQuery.css( elem, "top" ),
- curCSSLeft = jQuery.css( elem, "left" ),
- calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
- props = {}, curPosition = {}, curTop, curLeft;
-
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
-
- if ( jQuery.isFunction( options ) ) {
- options = options.call( elem, i, curOffset );
- }
-
- if ( options.top != null ) {
- props.top = ( options.top - curOffset.top ) + curTop;
- }
- if ( options.left != null ) {
- props.left = ( options.left - curOffset.left ) + curLeft;
- }
-
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
-};
-
-
-jQuery.fn.extend({
-
- position: function() {
- if ( !this[0] ) {
- return;
- }
-
- var elem = this[0],
-
- // Get *real* offsetParent
- offsetParent = this.offsetParent(),
-
- // Get correct offsets
- offset = this.offset(),
- parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
-
- // Subtract element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
- offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
-
- // Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
- parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
-
- // Subtract the two offsets
- return {
- top: offset.top - parentOffset.top,
- left: offset.left - parentOffset.left
- };
- },
-
- offsetParent: function() {
- return this.map(function() {
- var offsetParent = this.offsetParent || document.body;
- while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent || document.body;
- });
- }
-});
-
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
- var top = /Y/.test( prop );
-
- jQuery.fn[ method ] = function( val ) {
- return jQuery.access( this, function( elem, method, val ) {
- var win = getWindow( elem );
-
- if ( val === undefined ) {
- return win ? (prop in win) ? win[ prop ] :
- win.document.documentElement[ method ] :
- elem[ method ];
- }
-
- if ( win ) {
- win.scrollTo(
- !top ? val : jQuery( win ).scrollLeft(),
- top ? val : jQuery( win ).scrollTop()
- );
-
- } else {
- elem[ method ] = val;
- }
- }, method, val, arguments.length, null );
- };
-});
-
-function getWindow( elem ) {
- return jQuery.isWindow( elem ) ?
- elem :
- elem.nodeType === 9 ?
- elem.defaultView || elem.parentWindow :
- false;
-}
-// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
-jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
- jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
- // margin is only for outerHeight, outerWidth
- jQuery.fn[ funcName ] = function( margin, value ) {
- var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
- extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
-
- return jQuery.access( this, function( elem, type, value ) {
- var doc;
-
- if ( jQuery.isWindow( elem ) ) {
- // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
- // isn't a whole lot we can do. See pull request at this URL for discussion:
- // https://github.com/jquery/jquery/pull/764
- return elem.document.documentElement[ "client" + name ];
- }
-
- // Get document width or height
- if ( elem.nodeType === 9 ) {
- doc = elem.documentElement;
-
- // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
- // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
- return Math.max(
- elem.body[ "scroll" + name ], doc[ "scroll" + name ],
- elem.body[ "offset" + name ], doc[ "offset" + name ],
- doc[ "client" + name ]
- );
- }
-
- return value === undefined ?
- // Get width or height on the element, requesting but not forcing parseFloat
- jQuery.css( elem, type, value, extra ) :
-
- // Set width or height on the element
- jQuery.style( elem, type, value, extra );
- }, type, chainable ? margin : undefined, chainable, null );
- };
- });
-});
-// Expose jQuery to the global object
-window.jQuery = window.$ = jQuery;
-
-// Expose jQuery as an AMD module, but only for AMD loaders that
-// understand the issues with loading multiple versions of jQuery
-// in a page that all might call define(). The loader will indicate
-// they have special allowances for multiple jQuery versions by
-// specifying define.amd.jQuery = true. Register as a named module,
-// since jQuery can be concatenated with other files that may use define,
-// but not use a proper concatenation script that understands anonymous
-// AMD modules. A named AMD is safest and most robust way to register.
-// Lowercase jquery is used because AMD module names are derived from
-// file names, and jQuery is normally delivered in a lowercase file name.
-// Do this after creating the global so that if an AMD module wants to call
-// noConflict to hide this version of jQuery, it will work.
-if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
- define( "jquery", [], function () { return jQuery; } );
-}
-
-})( window );
diff --git a/sitestatic/jquery-1.8.3.min.js b/sitestatic/jquery-1.8.3.min.js
deleted file mode 100644
index ca4155d4..00000000
--- a/sitestatic/jquery-1.8.3.min.js
+++ /dev/null
@@ -1,196 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.8.3
- * http://jquery.com/
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- *
- * Copyright 2012 jQuery Foundation and other contributors
- * Released under the MIT license
- * http://jquery.org/license
- *
- * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
- */
-(function(r,n){function zb(a){var b=ya[a]={};c.each(a.split(G),function(a,c){b[c]=!0});return b}function za(a,b,d){if(d===n&&1===a.nodeType)if(d="data-"+b.replace(Ab,"-$1").toLowerCase(),d=a.getAttribute(d),"string"===typeof d){try{d="true"===d?!0:"false"===d?!1:"null"===d?null:+d+""===d?+d:Bb.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=n;return d}function ma(a){for(var b in a)if(("data"!==b||!c.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function N(){return!1}function aa(){return!0}
-function Y(a){return!a||!a.parentNode||11===a.parentNode.nodeType}function Aa(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function Ba(a,b,d){b=b||0;if(c.isFunction(b))return c.grep(a,function(a,c){return!!b.call(a,c,a)===d});if(b.nodeType)return c.grep(a,function(a,c){return a===b===d});if("string"===typeof b){var e=c.grep(a,function(a){return 1===a.nodeType});if(Cb.test(b))return c.filter(b,e,!d);b=c.filter(b,e)}return c.grep(a,function(a,e){return 0<=c.inArray(a,b)===d})}function Ca(a){var b=
-Da.split("|");a=a.createDocumentFragment();if(a.createElement)for(;b.length;)a.createElement(b.pop());return a}function Db(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function Ea(a,b){if(1===b.nodeType&&c.hasData(a)){var d,e,f;e=c._data(a);var g=c._data(b,e),h=e.events;if(h)for(d in delete g.handle,g.events={},h)for(e=0,f=h[d].length;e<f;e++)c.event.add(b,d,h[d][e]);g.data&&(g.data=c.extend({},g.data))}}function Fa(a,b){var d;1===b.nodeType&&(b.clearAttributes&&
-b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),d=b.nodeName.toLowerCase(),"object"===d?(b.parentNode&&(b.outerHTML=a.outerHTML),c.support.html5Clone&&a.innerHTML&&!c.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===d&&Ga.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===d?b.selected=a.defaultSelected:"input"===d||"textarea"===d?b.defaultValue=a.defaultValue:"script"===d&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(c.expando))}
-function ba(a){return"undefined"!==typeof a.getElementsByTagName?a.getElementsByTagName("*"):"undefined"!==typeof a.querySelectorAll?a.querySelectorAll("*"):[]}function Ha(a){Ga.test(a.type)&&(a.defaultChecked=a.checked)}function Ia(a,b){if(b in a)return b;for(var d=b.charAt(0).toUpperCase()+b.slice(1),c=b,f=Ja.length;f--;)if(b=Ja[f]+d,b in a)return b;return c}function R(a,b){a=b||a;return"none"===c.css(a,"display")||!c.contains(a.ownerDocument,a)}function Ka(a,b){for(var d,e,f=[],g=0,h=a.length;g<
-h;g++)d=a[g],d.style&&(f[g]=c._data(d,"olddisplay"),b?(f[g]||"none"!==d.style.display||(d.style.display=""),""===d.style.display&&R(d)&&(f[g]=c._data(d,"olddisplay",La(d.nodeName)))):(e=v(d,"display"),f[g]||"none"===e||c._data(d,"olddisplay",e)));for(g=0;g<h;g++)d=a[g],!d.style||b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none");return a}function Ma(a,b,d){return(a=Eb.exec(b))?Math.max(0,a[1]-(d||0))+(a[2]||"px"):b}function Na(a,b,d,e){b=d===(e?"border":"content")?
-4:"width"===b?1:0;for(var f=0;4>b;b+=2)"margin"===d&&(f+=c.css(a,d+C[b],!0)),e?("content"===d&&(f-=parseFloat(v(a,"padding"+C[b]))||0),"margin"!==d&&(f-=parseFloat(v(a,"border"+C[b]+"Width"))||0)):(f+=parseFloat(v(a,"padding"+C[b]))||0,"padding"!==d&&(f+=parseFloat(v(a,"border"+C[b]+"Width"))||0));return f}function Oa(a,b,d){var e="width"===b?a.offsetWidth:a.offsetHeight,f=!0,g=c.support.boxSizing&&"border-box"===c.css(a,"boxSizing");if(0>=e||null==e){e=v(a,b);if(0>e||null==e)e=a.style[b];if(ca.test(e))return e;
-f=g&&(c.support.boxSizingReliable||e===a.style[b]);e=parseFloat(e)||0}return e+Na(a,b,d||(g?"border":"content"),f)+"px"}function La(a){if(na[a])return na[a];var b=c("<"+a+">").appendTo(q.body),d=b.css("display");b.remove();if("none"===d||""===d)F=q.body.appendChild(F||c.extend(q.createElement("iframe"),{frameBorder:0,width:0,height:0})),U&&F.createElement||(U=(F.contentWindow||F.contentDocument).document,U.write("<!doctype html><html><body>"),U.close()),b=U.body.appendChild(U.createElement(a)),d=
-v(b,"display"),q.body.removeChild(F);return na[a]=d}function oa(a,b,d,e){var f;if(c.isArray(b))c.each(b,function(b,c){d||Fb.test(a)?e(a,c):oa(a+"["+("object"===typeof c?b:"")+"]",c,d,e)});else if(d||"object"!==c.type(b))e(a,b);else for(f in b)oa(a+"["+f+"]",b[f],d,e)}function Pa(a){return function(b,d){"string"!==typeof b&&(d=b,b="*");var e,f,g=b.toLowerCase().split(G),h=0,k=g.length;if(c.isFunction(d))for(;h<k;h++)e=g[h],(f=/^\+/.test(e))&&(e=e.substr(1)||"*"),e=a[e]=a[e]||[],e[f?"unshift":"push"](d)}}
-function da(a,b,d,c,f,g){f=f||b.dataTypes[0];g=g||{};g[f]=!0;var h;f=a[f];for(var k=0,l=f?f.length:0,m=a===pa;k<l&&(m||!h);k++)h=f[k](b,d,c),"string"===typeof h&&(!m||g[h]?h=n:(b.dataTypes.unshift(h),h=da(a,b,d,c,h,g)));!m&&h||g["*"]||(h=da(a,b,d,c,"*",g));return h}function Qa(a,b){var d,e,f=c.ajaxSettings.flatOptions||{};for(d in b)b[d]!==n&&((f[d]?a:e||(e={}))[d]=b[d]);e&&c.extend(!0,a,e)}function Ra(){try{return new r.XMLHttpRequest}catch(a){}}function Sa(){setTimeout(function(){V=n},0);return V=
-c.now()}function Gb(a,b){c.each(b,function(b,c){for(var f=(S[b]||[]).concat(S["*"]),g=0,h=f.length;g<h&&!f[g].call(a,b,c);g++);})}function Ta(a,b,d){var e=0,f=Z.length,g=c.Deferred().always(function(){delete h.elem}),h=function(){for(var b=V||Sa(),b=Math.max(0,k.startTime+k.duration-b),d=1-(b/k.duration||0),c=0,e=k.tweens.length;c<e;c++)k.tweens[c].run(d);g.notifyWith(a,[k,d,b]);if(1>d&&e)return b;g.resolveWith(a,[k]);return!1},k=g.promise({elem:a,props:c.extend({},b),opts:c.extend(!0,{specialEasing:{}},
-d),originalProperties:b,originalOptions:d,startTime:V||Sa(),duration:d.duration,tweens:[],createTween:function(b,d,e){b=c.Tween(a,k.opts,b,d,k.opts.specialEasing[b]||k.opts.easing);k.tweens.push(b);return b},stop:function(b){for(var d=0,c=b?k.tweens.length:0;d<c;d++)k.tweens[d].run(1);b?g.resolveWith(a,[k,b]):g.rejectWith(a,[k,b]);return this}});d=k.props;for(Hb(d,k.opts.specialEasing);e<f;e++)if(b=Z[e].call(k,a,d,k.opts))return b;Gb(k,d);c.isFunction(k.opts.start)&&k.opts.start.call(a,k);c.fx.timer(c.extend(h,
-{anim:k,queue:k.opts.queue,elem:a}));return k.progress(k.opts.progress).done(k.opts.done,k.opts.complete).fail(k.opts.fail).always(k.opts.always)}function Hb(a,b){var d,e,f,g,h;for(d in a)if(e=c.camelCase(d),f=b[e],g=a[d],c.isArray(g)&&(f=g[1],g=a[d]=g[0]),d!==e&&(a[e]=g,delete a[d]),(h=c.cssHooks[e])&&"expand"in h)for(d in g=h.expand(g),delete a[e],g)d in a||(a[d]=g[d],b[d]=f);else b[e]=f}function B(a,b,d,c,f){return new B.prototype.init(a,b,d,c,f)}function ea(a,b){var d,c={height:a},f=0;for(b=b?
-1:0;4>f;f+=2-b)d=C[f],c["margin"+d]=c["padding"+d]=a;b&&(c.opacity=c.width=a);return c}function Ua(a){return c.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}var Va,fa,q=r.document,Ib=r.location,Jb=r.navigator,Kb=r.jQuery,Lb=r.$,Wa=Array.prototype.push,w=Array.prototype.slice,Xa=Array.prototype.indexOf,Mb=Object.prototype.toString,qa=Object.prototype.hasOwnProperty,ra=String.prototype.trim,c=function(a,b){return new c.fn.init(a,b,Va)},ha=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
-Nb=/\S/,G=/\s+/,Ob=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,Pb=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,Ya=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Qb=/^[\],:{}\s]*$/,Rb=/(?:^|:|,)(?:\s*\[)+/g,Sb=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,Tb=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,Ub=/^-ms-/,Vb=/-([\da-z])/gi,Wb=function(a,b){return(b+"").toUpperCase()},ia=function(){q.addEventListener?(q.removeEventListener("DOMContentLoaded",ia,!1),c.ready()):"complete"===q.readyState&&(q.detachEvent("onreadystatechange",
-ia),c.ready())},Za={};c.fn=c.prototype={constructor:c,init:function(a,b,d){var e;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if("string"===typeof a){e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&3<=a.length?[null,a,null]:Pb.exec(a);if(!e||!e[1]&&b)return!b||b.jquery?(b||d).find(a):this.constructor(b).find(a);if(e[1])return a=(b=b instanceof c?b[0]:b)&&b.nodeType?b.ownerDocument||b:q,a=c.parseHTML(e[1],a,!0),Ya.test(e[1])&&c.isPlainObject(b)&&this.attr.call(a,
-b,!0),c.merge(this,a);if((b=q.getElementById(e[2]))&&b.parentNode){if(b.id!==e[2])return d.find(a);this.length=1;this[0]=b}this.context=q;this.selector=a;return this}if(c.isFunction(a))return d.ready(a);a.selector!==n&&(this.selector=a.selector,this.context=a.context);return c.makeArray(a,this)},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return w.call(this)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a,
-b,d){a=c.merge(this.constructor(),a);a.prevObject=this;a.context=this.context;"find"===b?a.selector=this.selector+(this.selector?" ":"")+d:b&&(a.selector=this.selector+"."+b+"("+d+")");return a},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.ready.promise().done(a);return this},eq:function(a){a=+a;return-1===a?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(w.apply(this,arguments),"slice",
-w.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:Wa,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a,b,d,e,f,g=arguments[0]||{},h=1,k=arguments.length,l=!1;"boolean"===typeof g&&(l=g,g=arguments[1]||{},h=2);"object"===typeof g||c.isFunction(g)||(g={});k===h&&(g=this,--h);for(;h<k;h++)if(null!=(a=arguments[h]))for(b in a)d=
-g[b],e=a[b],g!==e&&(l&&e&&(c.isPlainObject(e)||(f=c.isArray(e)))?(f?(f=!1,d=d&&c.isArray(d)?d:[]):d=d&&c.isPlainObject(d)?d:{},g[b]=c.extend(l,d,e)):e!==n&&(g[b]=e));return g};c.extend({noConflict:function(a){r.$===c&&(r.$=Lb);a&&r.jQuery===c&&(r.jQuery=Kb);return c},isReady:!1,readyWait:1,holdReady:function(a){a?c.readyWait++:c.ready(!0)},ready:function(a){if(!0===a?!--c.readyWait:!c.isReady){if(!q.body)return setTimeout(c.ready,1);c.isReady=!0;!0!==a&&0<--c.readyWait||(fa.resolveWith(q,[c]),c.fn.trigger&&
-c(q).trigger("ready").off("ready"))}},isFunction:function(a){return"function"===c.type(a)},isArray:Array.isArray||function(a){return"array"===c.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?String(a):Za[Mb.call(a)]||"object"},isPlainObject:function(a){if(!a||"object"!==c.type(a)||a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!qa.call(a,"constructor")&&!qa.call(a.constructor.prototype,
-"isPrototypeOf"))return!1}catch(b){return!1}for(var d in a);return d===n||qa.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw Error(a);},parseHTML:function(a,b,d){var e;if(!a||"string"!==typeof a)return null;"boolean"===typeof b&&(d=b,b=0);b=b||q;if(e=Ya.exec(a))return[b.createElement(e[1])];e=c.buildFragment([a],b,d?null:[]);return c.merge([],(e.cacheable?c.clone(e.fragment):e.fragment).childNodes)},parseJSON:function(a){if(!a||"string"!==typeof a)return null;
-a=c.trim(a);if(r.JSON&&r.JSON.parse)return r.JSON.parse(a);if(Qb.test(a.replace(Sb,"@").replace(Tb,"]").replace(Rb,"")))return(new Function("return "+a))();c.error("Invalid JSON: "+a)},parseXML:function(a){var b,d;if(!a||"string"!==typeof a)return null;try{r.DOMParser?(d=new DOMParser,b=d.parseFromString(a,"text/xml")):(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a))}catch(e){b=n}b&&b.documentElement&&!b.getElementsByTagName("parsererror").length||c.error("Invalid XML: "+a);
-return b},noop:function(){},globalEval:function(a){a&&Nb.test(a)&&(r.execScript||function(a){r.eval.call(r,a)})(a)},camelCase:function(a){return a.replace(Ub,"ms-").replace(Vb,Wb)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,d){var e,f=0,g=a.length,h=g===n||c.isFunction(a);if(d)if(h)for(e in a){if(!1===b.apply(a[e],d))break}else for(;f<g&&!1!==b.apply(a[f++],d););else if(h)for(e in a){if(!1===b.call(a[e],e,a[e]))break}else for(;f<g&&!1!==
-b.call(a[f],f,a[f++]););return a},trim:ra&&!ra.call("\ufeff\u00a0")?function(a){return null==a?"":ra.call(a)}:function(a){return null==a?"":(a+"").replace(Ob,"")},makeArray:function(a,b){var d,e=b||[];null!=a&&(d=c.type(a),null==a.length||"string"===d||"function"===d||"regexp"===d||c.isWindow(a)?Wa.call(e,a):c.merge(e,a));return e},inArray:function(a,b,d){var c;if(b){if(Xa)return Xa.call(b,a,d);c=b.length;for(d=d?0>d?Math.max(0,c+d):d:0;d<c;d++)if(d in b&&b[d]===a)return d}return-1},merge:function(a,
-b){var d=b.length,c=a.length,f=0;if("number"===typeof d)for(;f<d;f++)a[c++]=b[f];else for(;b[f]!==n;)a[c++]=b[f++];a.length=c;return a},grep:function(a,b,d){var c,f=[],g=0,h=a.length;for(d=!!d;g<h;g++)c=!!b(a[g],g),d!==c&&f.push(a[g]);return f},map:function(a,b,d){var e,f,g=[],h=0,k=a.length;if(a instanceof c||k!==n&&"number"===typeof k&&(0<k&&a[0]&&a[k-1]||0===k||c.isArray(a)))for(;h<k;h++)e=b(a[h],h,d),null!=e&&(g[g.length]=e);else for(f in a)e=b(a[f],f,d),null!=e&&(g[g.length]=e);return g.concat.apply([],
-g)},guid:1,proxy:function(a,b){var d,e;"string"===typeof b&&(d=a[b],b=a,a=d);if(!c.isFunction(a))return n;e=w.call(arguments,2);d=function(){return a.apply(b,e.concat(w.call(arguments)))};d.guid=a.guid=a.guid||c.guid++;return d},access:function(a,b,d,e,f,g,h){var k,l=null==d,m=0,s=a.length;if(d&&"object"===typeof d){for(m in d)c.access(a,b,m,d[m],1,g,e);f=1}else if(e!==n){k=h===n&&c.isFunction(e);l&&(k?(k=b,b=function(a,b,d){return k.call(c(a),d)}):(b.call(a,e),b=null));if(b)for(;m<s;m++)b(a[m],d,
-k?e.call(a[m],m,b(a[m],d)):e,h);f=1}return f?a:l?b.call(a):s?b(a[0],d):g},now:function(){return(new Date).getTime()}});c.ready.promise=function(a){if(!fa)if(fa=c.Deferred(),"complete"===q.readyState)setTimeout(c.ready,1);else if(q.addEventListener)q.addEventListener("DOMContentLoaded",ia,!1),r.addEventListener("load",c.ready,!1);else{q.attachEvent("onreadystatechange",ia);r.attachEvent("onload",c.ready);var b=!1;try{b=null==r.frameElement&&q.documentElement}catch(d){}b&&b.doScroll&&function f(){if(!c.isReady){try{b.doScroll("left")}catch(a){return setTimeout(f,
-50)}c.ready()}}()}return fa.promise(a)};c.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){Za["[object "+b+"]"]=b.toLowerCase()});Va=c(q);var ya={};c.Callbacks=function(a){a="string"===typeof a?ya[a]||zb(a):c.extend({},a);var b,d,e,f,g,h,k=[],l=!a.once&&[],m=function(c){b=a.memory&&c;d=!0;h=f||0;f=0;g=k.length;for(e=!0;k&&h<g;h++)if(!1===k[h].apply(c[0],c[1])&&a.stopOnFalse){b=!1;break}e=!1;k&&(l?l.length&&m(l.shift()):b?k=[]:s.disable())},s={add:function(){if(k){var d=
-k.length;(function Xb(b){c.each(b,function(b,d){var e=c.type(d);"function"===e?a.unique&&s.has(d)||k.push(d):d&&d.length&&"string"!==e&&Xb(d)})})(arguments);e?g=k.length:b&&(f=d,m(b))}return this},remove:function(){k&&c.each(arguments,function(a,b){for(var d;-1<(d=c.inArray(b,k,d));)k.splice(d,1),e&&(d<=g&&g--,d<=h&&h--)});return this},has:function(a){return-1<c.inArray(a,k)},empty:function(){k=[];return this},disable:function(){k=l=b=n;return this},disabled:function(){return!k},lock:function(){l=
-n;b||s.disable();return this},locked:function(){return!l},fireWith:function(a,b){b=b||[];b=[a,b.slice?b.slice():b];!k||d&&!l||(e?l.push(b):m(b));return this},fire:function(){s.fireWith(this,arguments);return this},fired:function(){return!!d}};return s};c.extend({Deferred:function(a){var b=[["resolve","done",c.Callbacks("once memory"),"resolved"],["reject","fail",c.Callbacks("once memory"),"rejected"],["notify","progress",c.Callbacks("memory")]],d="pending",e={state:function(){return d},always:function(){f.done(arguments).fail(arguments);
-return this},then:function(){var a=arguments;return c.Deferred(function(d){c.each(b,function(b,e){var m=e[0],s=a[b];f[e[1]](c.isFunction(s)?function(){var a=s.apply(this,arguments);if(a&&c.isFunction(a.promise))a.promise().done(d.resolve).fail(d.reject).progress(d.notify);else d[m+"With"](this===f?d:this,[a])}:d[m])});a=null}).promise()},promise:function(a){return null!=a?c.extend(a,e):e}},f={};e.pipe=e.then;c.each(b,function(a,c){var k=c[2],l=c[3];e[c[1]]=k.add;l&&k.add(function(){d=l},b[a^1][2].disable,
-b[2][2].lock);f[c[0]]=k.fire;f[c[0]+"With"]=k.fireWith});e.promise(f);a&&a.call(f,f);return f},when:function(a){var b=0,d=w.call(arguments),e=d.length,f=1!==e||a&&c.isFunction(a.promise)?e:0,g=1===f?a:c.Deferred(),h=function(a,b,d){return function(c){b[a]=this;d[a]=1<arguments.length?w.call(arguments):c;d===k?g.notifyWith(b,d):--f||g.resolveWith(b,d)}},k,l,m;if(1<e)for(k=Array(e),l=Array(e),m=Array(e);b<e;b++)d[b]&&c.isFunction(d[b].promise)?d[b].promise().done(h(b,m,d)).fail(g.reject).progress(h(b,
-l,k)):--f;f||g.resolveWith(m,d);return g.promise()}});c.support=function(){var a,b,d,e,f,g,h,k=q.createElement("div");k.setAttribute("className","t");k.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";b=k.getElementsByTagName("*");d=k.getElementsByTagName("a")[0];if(!b||!d||!b.length)return{};e=q.createElement("select");f=e.appendChild(q.createElement("option"));b=k.getElementsByTagName("input")[0];d.style.cssText="top:1px;float:left;opacity:.5";a={leadingWhitespace:3===
-k.firstChild.nodeType,tbody:!k.getElementsByTagName("tbody").length,htmlSerialize:!!k.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:"/a"===d.getAttribute("href"),opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:"on"===b.value,optSelected:f.selected,getSetAttribute:"t"!==k.className,enctype:!!q.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==q.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===q.compatMode,
-submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1};b.checked=!0;a.noCloneChecked=b.cloneNode(!0).checked;e.disabled=!0;a.optDisabled=!f.disabled;try{delete k.test}catch(l){a.deleteExpando=!1}!k.addEventListener&&k.attachEvent&&k.fireEvent&&(k.attachEvent("onclick",d=function(){a.noCloneEvent=!1}),k.cloneNode(!0).fireEvent("onclick"),k.detachEvent("onclick",
-d));b=q.createElement("input");b.value="t";b.setAttribute("type","radio");a.radioValue="t"===b.value;b.setAttribute("checked","checked");b.setAttribute("name","t");k.appendChild(b);d=q.createDocumentFragment();d.appendChild(k.lastChild);a.checkClone=d.cloneNode(!0).cloneNode(!0).lastChild.checked;a.appendChecked=b.checked;d.removeChild(b);d.appendChild(k);if(k.attachEvent)for(g in{submit:!0,change:!0,focusin:!0})b="on"+g,h=b in k,h||(k.setAttribute(b,"return;"),h="function"===typeof k[b]),a[g+"Bubbles"]=
-h;c(function(){var b,d,c,e=q.getElementsByTagName("body")[0];e&&(b=q.createElement("div"),b.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",e.insertBefore(b,e.firstChild),d=q.createElement("div"),b.appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",c=d.getElementsByTagName("td"),c[0].style.cssText="padding:0;margin:0;border:0;display:none",h=0===c[0].offsetHeight,c[0].style.display="",c[1].style.display="none",a.reliableHiddenOffsets=
-h&&0===c[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",a.boxSizing=4===d.offsetWidth,a.doesNotIncludeMarginInBodyOffset=1!==e.offsetTop,r.getComputedStyle&&(a.pixelPosition="1%"!==(r.getComputedStyle(d,null)||{}).top,a.boxSizingReliable="4px"===(r.getComputedStyle(d,null)||{width:"4px"}).width,c=q.createElement("div"),c.style.cssText=
-d.style.cssText="padding:0;margin:0;border:0;display:block;overflow:hidden;",c.style.marginRight=c.style.width="0",d.style.width="1px",d.appendChild(c),a.reliableMarginRight=!parseFloat((r.getComputedStyle(c,null)||{}).marginRight)),"undefined"!==typeof d.style.zoom&&(d.innerHTML="",d.style.cssText="padding:0;margin:0;border:0;display:block;overflow:hidden;width:1px;padding:1px;display:inline;zoom:1",a.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.style.overflow="visible",d.innerHTML=
-"<div></div>",d.firstChild.style.width="5px",a.shrinkWrapBlocks=3!==d.offsetWidth,b.style.zoom=1),e.removeChild(b))});d.removeChild(k);b=d=e=f=b=d=k=null;return a}();var Bb=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,Ab=/([A-Z])/g;c.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(c.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?c.cache[a[c.expando]]:a[c.expando];return!!a&&!ma(a)},data:function(a,
-b,d,e){if(c.acceptData(a)){var f=c.expando,g="string"===typeof b,h=a.nodeType,k=h?c.cache:a,l=h?a[f]:a[f]&&f;if(l&&k[l]&&(e||k[l].data)||!g||d!==n){l||(h?a[f]=l=c.deletedIds.pop()||c.guid++:l=f);k[l]||(k[l]={},h||(k[l].toJSON=c.noop));if("object"===typeof b||"function"===typeof b)e?k[l]=c.extend(k[l],b):k[l].data=c.extend(k[l].data,b);a=k[l];e||(a.data||(a.data={}),a=a.data);d!==n&&(a[c.camelCase(b)]=d);g?(d=a[b],null==d&&(d=a[c.camelCase(b)])):d=a;return d}}},removeData:function(a,b,d){if(c.acceptData(a)){var e,
-f,g,h=a.nodeType,k=h?c.cache:a,l=h?a[c.expando]:c.expando;if(k[l]){if(b&&(e=d?k[l]:k[l].data)){c.isArray(b)||(b in e?b=[b]:(b=c.camelCase(b),b=b in e?[b]:b.split(" ")));f=0;for(g=b.length;f<g;f++)delete e[b[f]];if(!(d?ma:c.isEmptyObject)(e))return}if(!d&&(delete k[l].data,!ma(k[l])))return;h?c.cleanData([a],!0):c.support.deleteExpando||k!=k.window?delete k[l]:k[l]=null}}},_data:function(a,b,d){return c.data(a,b,d,!0)},acceptData:function(a){var b=a.nodeName&&c.noData[a.nodeName.toLowerCase()];return!b||
-!0!==b&&a.getAttribute("classid")===b}});c.fn.extend({data:function(a,b){var d,e,f,g,h,k=this[0],l=0,m=null;if(a===n){if(this.length&&(m=c.data(k),1===k.nodeType&&!c._data(k,"parsedAttrs"))){f=k.attributes;for(h=f.length;l<h;l++)g=f[l].name,g.indexOf("data-")||(g=c.camelCase(g.substring(5)),za(k,g,m[g]));c._data(k,"parsedAttrs",!0)}return m}if("object"===typeof a)return this.each(function(){c.data(this,a)});d=a.split(".",2);d[1]=d[1]?"."+d[1]:"";e=d[1]+"!";return c.access(this,function(b){if(b===
-n)return m=this.triggerHandler("getData"+e,[d[0]]),m===n&&k&&(m=c.data(k,a),m=za(k,a,m)),m===n&&d[1]?this.data(d[0]):m;d[1]=b;this.each(function(){var f=c(this);f.triggerHandler("setData"+e,d);c.data(this,a,b);f.triggerHandler("changeData"+e,d)})},null,b,1<arguments.length,null,!1)},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){var e;if(a)return b=(b||"fx")+"queue",e=c._data(a,b),d&&(!e||c.isArray(d)?e=c._data(a,b,c.makeArray(d)):e.push(d)),
-e||[]},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.length,f=d.shift(),g=c._queueHooks(a,b),h=function(){c.dequeue(a,b)};"inprogress"===f&&(f=d.shift(),e--);f&&("fx"===b&&d.unshift("inprogress"),delete g.stop,f.call(a,h,g));!e&&g&&g.empty.fire()},_queueHooks:function(a,b){var d=b+"queueHooks";return c._data(a,d)||c._data(a,d,{empty:c.Callbacks("once memory").add(function(){c.removeData(a,b+"queue",!0);c.removeData(a,d,!0)})})}});c.fn.extend({queue:function(a,b){var d=2;"string"!==typeof a&&
-(b=a,a="fx",d--);return arguments.length<d?c.queue(this[0],a):b===n?this:this.each(function(){var d=c.queue(this,a,b);c._queueHooks(this,a);"fx"===a&&"inprogress"!==d[0]&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;return this.queue(b||"fx",function(b,c){var f=setTimeout(b,a);c.stop=function(){clearTimeout(f)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var d,e=1,f=c.Deferred(),
-g=this,h=this.length,k=function(){--e||f.resolveWith(g,[g])};"string"!==typeof a&&(b=a,a=n);for(a=a||"fx";h--;)(d=c._data(g[h],a+"queueHooks"))&&d.empty&&(e++,d.empty.add(k));k();return f.promise(b)}});var x,$a,ab,bb=/[\t\r\n]/g,Yb=/\r/g,Zb=/^(?:button|input)$/i,$b=/^(?:button|input|object|select|textarea)$/i,ac=/^a(?:rea|)$/i,cb=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,db=c.support.getSetAttribute;c.fn.extend({attr:function(a,
-b){return c.access(this,c.attr,a,b,1<arguments.length)},removeAttr:function(a){return this.each(function(){c.removeAttr(this,a)})},prop:function(a,b){return c.access(this,c.prop,a,b,1<arguments.length)},removeProp:function(a){a=c.propFix[a]||a;return this.each(function(){try{this[a]=n,delete this[a]}catch(b){}})},addClass:function(a){var b,d,e,f,g,h,k;if(c.isFunction(a))return this.each(function(b){c(this).addClass(a.call(this,b,this.className))});if(a&&"string"===typeof a)for(b=a.split(G),d=0,e=
-this.length;d<e;d++)if(f=this[d],1===f.nodeType)if(f.className||1!==b.length){g=" "+f.className+" ";h=0;for(k=b.length;h<k;h++)0>g.indexOf(" "+b[h]+" ")&&(g+=b[h]+" ");f.className=c.trim(g)}else f.className=a;return this},removeClass:function(a){var b,d,e,f,g,h,k;if(c.isFunction(a))return this.each(function(b){c(this).removeClass(a.call(this,b,this.className))});if(a&&"string"===typeof a||a===n)for(b=(a||"").split(G),h=0,k=this.length;h<k;h++)if(e=this[h],1===e.nodeType&&e.className){d=(" "+e.className+
-" ").replace(bb," ");f=0;for(g=b.length;f<g;f++)for(;0<=d.indexOf(" "+b[f]+" ");)d=d.replace(" "+b[f]+" "," ");e.className=a?c.trim(d):""}return this},toggleClass:function(a,b){var d=typeof a,e="boolean"===typeof b;return c.isFunction(a)?this.each(function(d){c(this).toggleClass(a.call(this,d,this.className,b),b)}):this.each(function(){if("string"===d)for(var f,g=0,h=c(this),k=b,l=a.split(G);f=l[g++];)k=e?k:!h.hasClass(f),h[k?"addClass":"removeClass"](f);else if("undefined"===d||"boolean"===d)this.className&&
-c._data(this,"__className__",this.className),this.className=this.className||!1===a?"":c._data(this,"__className__")||""})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if(1===this[b].nodeType&&0<=(" "+this[b].className+" ").replace(bb," ").indexOf(a))return!0;return!1},val:function(a){var b,d,e,f=this[0];if(arguments.length)return e=c.isFunction(a),this.each(function(d){var f=c(this);1===this.nodeType&&(d=e?a.call(this,d,f.val()):a,null==d?d="":"number"===typeof d?d+="":c.isArray(d)&&
-(d=c.map(d,function(a){return null==a?"":a+""})),b=c.valHooks[this.type]||c.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&b.set(this,d,"value")!==n||(this.value=d))});if(f){if((b=c.valHooks[f.type]||c.valHooks[f.nodeName.toLowerCase()])&&"get"in b&&(d=b.get(f,"value"))!==n)return d;d=f.value;return"string"===typeof d?d.replace(Yb,""):null==d?"":d}}});c.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){for(var b,
-d=a.options,e=a.selectedIndex,f=(a="select-one"===a.type||0>e)?null:[],g=a?e+1:d.length,h=0>e?g:a?e:0;h<g;h++)if(b=d[h],!(!b.selected&&h!==e||(c.support.optDisabled?b.disabled:null!==b.getAttribute("disabled"))||b.parentNode.disabled&&c.nodeName(b.parentNode,"optgroup"))){b=c(b).val();if(a)return b;f.push(b)}return f},set:function(a,b){var d=c.makeArray(b);c(a).find("option").each(function(){this.selected=0<=c.inArray(c(this).val(),d)});d.length||(a.selectedIndex=-1);return d}}},attrFn:{},attr:function(a,
-b,d,e){var f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h){if(e&&c.isFunction(c.fn[b]))return c(a)[b](d);if("undefined"===typeof a.getAttribute)return c.prop(a,b,d);if(e=1!==h||!c.isXMLDoc(a))b=b.toLowerCase(),g=c.attrHooks[b]||(cb.test(b)?$a:x);if(d!==n)if(null===d)c.removeAttr(a,b);else{if(g&&"set"in g&&e&&(f=g.set(a,d,b))!==n)return f;a.setAttribute(b,d+"");return d}else{if(g&&"get"in g&&e&&null!==(f=g.get(a,b)))return f;f=a.getAttribute(b);return null===f?n:f}}},removeAttr:function(a,b){var d,e,f,
-g,h=0;if(b&&1===a.nodeType)for(e=b.split(G);h<e.length;h++)if(f=e[h])d=c.propFix[f]||f,(g=cb.test(f))||c.attr(a,f,""),a.removeAttribute(db?f:d),g&&d in a&&(a[d]=!1)},attrHooks:{type:{set:function(a,b){if(Zb.test(a.nodeName)&&a.parentNode)c.error("type property can't be changed");else if(!c.support.radioValue&&"radio"===b&&c.nodeName(a,"input")){var d=a.value;a.setAttribute("type",b);d&&(a.value=d);return b}}},value:{get:function(a,b){return x&&c.nodeName(a,"button")?x.get(a,b):b in a?a.value:null},
-set:function(a,b,d){if(x&&c.nodeName(a,"button"))return x.set(a,b,d);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,b,d){var e,f,g;g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g){if(g=1!==g||!c.isXMLDoc(a))b=c.propFix[b]||b,f=c.propHooks[b];return d!==n?f&&
-"set"in f&&(e=f.set(a,d,b))!==n?e:a[b]=d:f&&"get"in f&&null!==(e=f.get(a,b))?e:a[b]}},propHooks:{tabIndex:{get:function(a){var b=a.getAttributeNode("tabindex");return b&&b.specified?parseInt(b.value,10):$b.test(a.nodeName)||ac.test(a.nodeName)&&a.href?0:n}}}});$a={get:function(a,b){var d,e=c.prop(a,b);return!0===e||"boolean"!==typeof e&&(d=a.getAttributeNode(b))&&!1!==d.nodeValue?b.toLowerCase():n},set:function(a,b,d){!1===b?c.removeAttr(a,d):(b=c.propFix[d]||d,b in a&&(a[b]=!0),a.setAttribute(d,
-d.toLowerCase()));return d}};db||(ab={name:!0,id:!0,coords:!0},x=c.valHooks.button={get:function(a,b){var d;return(d=a.getAttributeNode(b))&&(ab[b]?""!==d.value:d.specified)?d.value:n},set:function(a,b,d){var c=a.getAttributeNode(d);c||(c=q.createAttribute(d),a.setAttributeNode(c));return c.value=b+""}},c.each(["width","height"],function(a,b){c.attrHooks[b]=c.extend(c.attrHooks[b],{set:function(a,c){if(""===c)return a.setAttribute(b,"auto"),c}})}),c.attrHooks.contenteditable={get:x.get,set:function(a,
-b,d){""===b&&(b="false");x.set(a,b,d)}});c.support.hrefNormalized||c.each(["href","src","width","height"],function(a,b){c.attrHooks[b]=c.extend(c.attrHooks[b],{get:function(a){a=a.getAttribute(b,2);return null===a?n:a}})});c.support.style||(c.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||n},set:function(a,b){return a.style.cssText=b+""}});c.support.optSelected||(c.propHooks.selected=c.extend(c.propHooks.selected,{get:function(a){if(a=a.parentNode)a.selectedIndex,a.parentNode&&
-a.parentNode.selectedIndex;return null}}));c.support.enctype||(c.propFix.enctype="encoding");c.support.checkOn||c.each(["radio","checkbox"],function(){c.valHooks[this]={get:function(a){return null===a.getAttribute("value")?"on":a.value}}});c.each(["radio","checkbox"],function(){c.valHooks[this]=c.extend(c.valHooks[this],{set:function(a,b){if(c.isArray(b))return a.checked=0<=c.inArray(c(a).val(),b)}})});var sa=/^(?:textarea|input|select)$/i,eb=/^([^\.]*|)(?:\.(.+)|)$/,bc=/(?:^|\s)hover(\.\S+|)\b/,
-cc=/^key/,dc=/^(?:mouse|contextmenu)|click/,fb=/^(?:focusinfocus|focusoutblur)$/,gb=function(a){return c.event.special.hover?a:a.replace(bc,"mouseenter$1 mouseleave$1")};c.event={add:function(a,b,d,e,f){var g,h,k,l,m,s,p,q,r;if(3!==a.nodeType&&8!==a.nodeType&&b&&d&&(g=c._data(a))){d.handler&&(p=d,d=p.handler,f=p.selector);d.guid||(d.guid=c.guid++);k=g.events;k||(g.events=k={});h=g.handle;h||(g.handle=h=function(a){return"undefined"===typeof c||a&&c.event.triggered===a.type?n:c.event.dispatch.apply(h.elem,
-arguments)},h.elem=a);b=c.trim(gb(b)).split(" ");for(g=0;g<b.length;g++)l=eb.exec(b[g])||[],m=l[1],s=(l[2]||"").split(".").sort(),r=c.event.special[m]||{},m=(f?r.delegateType:r.bindType)||m,r=c.event.special[m]||{},l=c.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:f,needsContext:f&&c.expr.match.needsContext.test(f),namespace:s.join(".")},p),q=k[m],q||(q=k[m]=[],q.delegateCount=0,r.setup&&!1!==r.setup.call(a,e,s,h)||(a.addEventListener?a.addEventListener(m,h,!1):a.attachEvent&&
-a.attachEvent("on"+m,h))),r.add&&(r.add.call(a,l),l.handler.guid||(l.handler.guid=d.guid)),f?q.splice(q.delegateCount++,0,l):q.push(l),c.event.global[m]=!0;a=null}},global:{},remove:function(a,b,d,e,f){var g,h,k,l,m,s,p,n,q,r,v=c.hasData(a)&&c._data(a);if(v&&(p=v.events)){b=c.trim(gb(b||"")).split(" ");for(g=0;g<b.length;g++)if(h=eb.exec(b[g])||[],k=l=h[1],h=h[2],k){n=c.event.special[k]||{};k=(e?n.delegateType:n.bindType)||k;q=p[k]||[];m=q.length;h=h?new RegExp("(^|\\.)"+h.split(".").sort().join("\\.(?:.*\\.|)")+
-"(\\.|$)"):null;for(s=0;s<q.length;s++)r=q[s],!f&&l!==r.origType||d&&d.guid!==r.guid||h&&!h.test(r.namespace)||e&&e!==r.selector&&("**"!==e||!r.selector)||(q.splice(s--,1),r.selector&&q.delegateCount--,n.remove&&n.remove.call(a,r));0===q.length&&m!==q.length&&(n.teardown&&!1!==n.teardown.call(a,h,v.handle)||c.removeEvent(a,k,v.handle),delete p[k])}else for(k in p)c.event.remove(a,k+b[g],d,e,!0);c.isEmptyObject(p)&&(delete v.handle,c.removeData(a,"events",!0))}},customEvent:{getData:!0,setData:!0,
-changeData:!0},trigger:function(a,b,d,e){if(!d||3!==d.nodeType&&8!==d.nodeType){var f,g,h,k,l,m,s=a.type||a;h=[];if(!fb.test(s+c.event.triggered)&&(0<=s.indexOf("!")&&(s=s.slice(0,-1),f=!0),0<=s.indexOf(".")&&(h=s.split("."),s=h.shift(),h.sort()),d&&!c.event.customEvent[s]||c.event.global[s]))if(a="object"===typeof a?a[c.expando]?a:new c.Event(s,a):new c.Event(s),a.type=s,a.isTrigger=!0,a.exclusive=f,a.namespace=h.join("."),a.namespace_re=a.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):
-null,h=0>s.indexOf(":")?"on"+s:"",d){if(a.result=n,a.target||(a.target=d),b=null!=b?c.makeArray(b):[],b.unshift(a),k=c.event.special[s]||{},!k.trigger||!1!==k.trigger.apply(d,b)){m=[[d,k.bindType||s]];if(!e&&!k.noBubble&&!c.isWindow(d)){l=k.delegateType||s;f=fb.test(l+s)?d:d.parentNode;for(g=d;f;f=f.parentNode)m.push([f,l]),g=f;g===(d.ownerDocument||q)&&m.push([g.defaultView||g.parentWindow||r,l])}for(g=0;g<m.length&&!a.isPropagationStopped();g++)f=m[g][0],a.type=m[g][1],(l=(c._data(f,"events")||
-{})[a.type]&&c._data(f,"handle"))&&l.apply(f,b),(l=h&&f[h])&&c.acceptData(f)&&l.apply&&!1===l.apply(f,b)&&a.preventDefault();a.type=s;e||a.isDefaultPrevented()||k._default&&!1!==k._default.apply(d.ownerDocument,b)||"click"===s&&c.nodeName(d,"a")||!c.acceptData(d)||!h||!d[s]||("focus"===s||"blur"===s)&&0===a.target.offsetWidth||c.isWindow(d)||((g=d[h])&&(d[h]=null),c.event.triggered=s,d[s](),c.event.triggered=n,g&&(d[h]=g));return a.result}}else for(g in d=c.cache,d)d[g].events&&d[g].events[s]&&c.event.trigger(a,
-b,d[g].handle.elem,!0)}},dispatch:function(a){a=c.event.fix(a||r.event);var b,d,e,f,g,h,k=(c._data(this,"events")||{})[a.type]||[],l=k.delegateCount,m=w.call(arguments),s=!a.exclusive&&!a.namespace,p=c.event.special[a.type]||{},q=[];m[0]=a;a.delegateTarget=this;if(!p.preDispatch||!1!==p.preDispatch.call(this,a)){if(l&&(!a.button||"click"!==a.type))for(d=a.target;d!=this;d=d.parentNode||this)if(!0!==d.disabled||"click"!==a.type){f={};g=[];for(b=0;b<l;b++)e=k[b],h=e.selector,f[h]===n&&(f[h]=e.needsContext?
-0<=c(h,this).index(d):c.find(h,this,null,[d]).length),f[h]&&g.push(e);g.length&&q.push({elem:d,matches:g})}k.length>l&&q.push({elem:this,matches:k.slice(l)});for(b=0;b<q.length&&!a.isPropagationStopped();b++)for(f=q[b],a.currentTarget=f.elem,d=0;d<f.matches.length&&!a.isImmediatePropagationStopped();d++)if(e=f.matches[d],s||!a.namespace&&!e.namespace||a.namespace_re&&a.namespace_re.test(e.namespace))a.data=e.data,a.handleObj=e,e=((c.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,m),
-e!==n&&(a.result=e,!1===e&&(a.preventDefault(),a.stopPropagation()));p.postDispatch&&p.postDispatch.call(this,a);return a.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:["char","charCode","key","keyCode"],filter:function(a,b){null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
-filter:function(a,b){var d,c,f=b.button,g=b.fromElement;null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||q,c=d.documentElement,d=d.body,a.pageX=b.clientX+(c&&c.scrollLeft||d&&d.scrollLeft||0)-(c&&c.clientLeft||d&&d.clientLeft||0),a.pageY=b.clientY+(c&&c.scrollTop||d&&d.scrollTop||0)-(c&&c.clientTop||d&&d.clientTop||0));!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g);a.which||f===n||(a.which=f&1?1:f&2?3:f&4?2:0);return a}},fix:function(a){if(a[c.expando])return a;var b,
-d,e=a,f=c.event.fixHooks[a.type]||{},g=f.props?this.props.concat(f.props):this.props;a=c.Event(e);for(b=g.length;b;)d=g[--b],a[d]=e[d];a.target||(a.target=e.srcElement||q);3===a.target.nodeType&&(a.target=a.target.parentNode);a.metaKey=!!a.metaKey;return f.filter?f.filter(a,e):a},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,d){c.isWindow(this)&&(this.onbeforeunload=d)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=
-null)}}},simulate:function(a,b,d,e){a=c.extend(new c.Event,d,{type:a,isSimulated:!0,originalEvent:{}});e?c.event.trigger(a,null,b):c.event.dispatch.call(b,a);a.isDefaultPrevented()&&d.preventDefault()}};c.event.handle=c.event.dispatch;c.removeEvent=q.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,!1)}:function(a,b,d){b="on"+b;a.detachEvent&&("undefined"===typeof a[b]&&(a[b]=null),a.detachEvent(b,d))};c.Event=function(a,b){if(!(this instanceof c.Event))return new c.Event(a,
-b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||!1===a.returnValue||a.getPreventDefault&&a.getPreventDefault()?aa:N):this.type=a;b&&c.extend(this,b);this.timeStamp=a&&a.timeStamp||c.now();this[c.expando]=!0};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=aa;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=aa;var a=this.originalEvent;a&&(a.stopPropagation&&
-a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=aa;this.stopPropagation()},isDefaultPrevented:N,isPropagationStopped:N,isImmediatePropagationStopped:N};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={delegateType:b,bindType:b,handle:function(a){var e,f=a.relatedTarget,g=a.handleObj;if(!f||f!==this&&!c.contains(this,f))a.type=g.origType,e=g.handler.apply(this,arguments),a.type=b;return e}}});c.support.submitBubbles||
-(c.event.special.submit={setup:function(){if(c.nodeName(this,"form"))return!1;c.event.add(this,"click._submit keypress._submit",function(a){a=a.target;(a=c.nodeName(a,"input")||c.nodeName(a,"button")?a.form:n)&&!c._data(a,"_submit_attached")&&(c.event.add(a,"submit._submit",function(a){a._submit_bubble=!0}),c._data(a,"_submit_attached",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&c.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(c.nodeName(this,
-"form"))return!1;c.event.remove(this,"._submit")}});c.support.changeBubbles||(c.event.special.change={setup:function(){if(sa.test(this.nodeName)){if("checkbox"===this.type||"radio"===this.type)c.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),c.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1);c.event.simulate("change",this,a,!0)});return!1}c.event.add(this,"beforeactivate._change",
-function(a){a=a.target;sa.test(a.nodeName)&&!c._data(a,"_change_attached")&&(c.event.add(a,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||c.event.simulate("change",this.parentNode,a,!0)}),c._data(a,"_change_attached",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type)return a.handleObj.handler.apply(this,arguments)},teardown:function(){c.event.remove(this,"._change");return!sa.test(this.nodeName)}});
-c.support.focusinBubbles||c.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){c.event.simulate(b,a.target,c.event.fix(a),!0)};c.event.special[b]={setup:function(){0===d++&&q.addEventListener(a,e,!0)},teardown:function(){0===--d&&q.removeEventListener(a,e,!0)}}});c.fn.extend({on:function(a,b,d,e,f){var g,h;if("object"===typeof a){"string"!==typeof b&&(d=d||b,b=n);for(h in a)this.on(h,b,d,a[h],f);return this}null==d&&null==e?(e=b,d=b=n):null==e&&("string"===typeof b?(e=d,d=
-n):(e=d,d=b,b=n));if(!1===e)e=N;else if(!e)return this;1===f&&(g=e,e=function(a){c().off(a);return g.apply(this,arguments)},e.guid=g.guid||(g.guid=c.guid++));return this.each(function(){c.event.add(this,a,e,d,b)})},one:function(a,b,d,c){return this.on(a,b,d,c,1)},off:function(a,b,d){var e;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,c(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if("object"===typeof a){for(e in a)this.off(e,b,a[e]);
-return this}if(!1===b||"function"===typeof b)d=b,b=n;!1===d&&(d=N);return this.each(function(){c.event.remove(this,a,d,b)})},bind:function(a,b,d){return this.on(a,null,b,d)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,d){c(this.context).on(a,this.selector,b,d);return this},die:function(a,b){c(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,d,c){return this.on(b,a,d,c)},undelegate:function(a,b,d){return 1===arguments.length?this.off(a,"**"):this.off(b,
-a||"**",d)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return c.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,d=a.guid||c.guid++,e=0,f=function(d){var f=(c._data(this,"lastToggle"+a.guid)||0)%e;c._data(this,"lastToggle"+a.guid,f+1);d.preventDefault();return b[f].apply(this,arguments)||!1};for(f.guid=d;e<b.length;)b[e++].guid=d;return this.click(f)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||
-a)}});c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){c.fn[b]=function(a,c){null==c&&(c=a,a=null);return 0<arguments.length?this.on(b,null,a,c):this.trigger(b)};cc.test(b)&&(c.event.fixHooks[b]=c.event.keyHooks);dc.test(b)&&(c.event.fixHooks[b]=c.event.mouseHooks)});(function(a,b){function d(a,b,d,c){d=d||[];b=b||
-O;var e,f,g,h,k=b.nodeType;if(!a||"string"!==typeof a)return d;if(1!==k&&9!==k)return[];g=w(b);if(!g&&!c&&(e=Y.exec(a)))if(h=e[1])if(9===k)if((f=b.getElementById(h))&&f.parentNode){if(f.id===h)return d.push(f),d}else return d;else{if(b.ownerDocument&&(f=b.ownerDocument.getElementById(h))&&t(b,f)&&f.id===h)return d.push(f),d}else{if(e[2])return y.apply(d,D.call(b.getElementsByTagName(a),0)),d;if((h=e[3])&&Z&&b.getElementsByClassName)return y.apply(d,D.call(b.getElementsByClassName(h),0)),d}return r(a.replace(F,
-"$1"),b,d,c,g)}function e(a){return function(b){return"input"===b.nodeName.toLowerCase()&&b.type===a}}function f(a){return function(b){var d=b.nodeName.toLowerCase();return("input"===d||"button"===d)&&b.type===a}}function g(a){return K(function(b){b=+b;return K(function(d,c){for(var e,f=a([],d.length,b),g=f.length;g--;)d[e=f[g]]&&(d[e]=!(c[e]=d[e]))})})}function h(a,b,d){if(a===b)return d;for(a=a.nextSibling;a;){if(a===b)return-1;a=a.nextSibling}return 1}function k(a,b){var c,e,f,g,h,k,l;if(h=H[A][a+
-" "])return b?0:h.slice(0);h=a;k=[];for(l=u.preFilter;h;){if(!c||(e=U.exec(h)))e&&(h=h.slice(e[0].length)||h),k.push(f=[]);c=!1;if(e=V.exec(h))f.push(c=new jb(e.shift())),h=h.slice(c.length),c.type=e[0].replace(F," ");for(g in u.filter)!(e=R[g].exec(h))||l[g]&&!(e=l[g](e))||(f.push(c=new jb(e.shift())),h=h.slice(c.length),c.type=g,c.matches=e);if(!c)break}return b?h.length:h?d.error(a):H(a,k).slice(0)}function l(a,b,d){var c=b.dir,e=d&&"parentNode"===b.dir,f=I++;return b.first?function(b,d,f){for(;b=
-b[c];)if(e||1===b.nodeType)return a(b,d,f)}:function(b,d,g){if(!g)for(var h,k=ga+" "+f+" ",hb=k+B;b=b[c];){if(e||1===b.nodeType){if((h=b[A])===hb)return b.sizset;if("string"===typeof h&&0===h.indexOf(k)){if(b.sizset)return b}else{b[A]=hb;if(a(b,d,g))return b.sizset=!0,b;b.sizset=!1}}}else for(;b=b[c];)if((e||1===b.nodeType)&&a(b,d,g))return b}}function m(a){return 1<a.length?function(b,d,c){for(var e=a.length;e--;)if(!a[e](b,d,c))return!1;return!0}:a[0]}function s(a,b,d,c,e){for(var f,g=[],h=0,k=
-a.length,l=null!=b;h<k;h++)if(f=a[h])if(!d||d(f,c,e))g.push(f),l&&b.push(h);return g}function p(a,b,c,e,f,g){e&&!e[A]&&(e=p(e));f&&!f[A]&&(f=p(f,g));return K(function(g,h,k,l){var m,p,n=[],q=[],ib=h.length,r;if(!(r=g)){r=b||"*";for(var t=k.nodeType?[k]:k,M=[],u=0,T=t.length;u<T;u++)d(r,t[u],M);r=M}r=!a||!g&&b?r:s(r,n,a,k,l);t=c?f||(g?a:ib||e)?[]:h:r;c&&c(r,t,k,l);if(e)for(m=s(t,q),e(m,[],k,l),k=m.length;k--;)if(p=m[k])t[q[k]]=!(r[q[k]]=p);if(g){if(f||a){if(f){m=[];for(k=t.length;k--;)(p=t[k])&&m.push(r[k]=
-p);f(null,t=[],m,l)}for(k=t.length;k--;)(p=t[k])&&-1<(m=f?C.call(g,p):n[k])&&(g[m]=!(h[m]=p))}}else t=s(t===h?t.splice(ib,t.length):t),f?f(null,h,t,l):y.apply(h,t)})}function n(a){var b,d,c,e=a.length,f=u.relative[a[0].type];d=f||u.relative[" "];for(var g=f?1:0,h=l(function(a){return a===b},d,!0),k=l(function(a){return-1<C.call(b,a)},d,!0),s=[function(a,d,c){return!f&&(c||d!==ja)||((b=d).nodeType?h(a,d,c):k(a,d,c))}];g<e;g++)if(d=u.relative[a[g].type])s=[l(m(s),d)];else{d=u.filter[a[g].type].apply(null,
-a[g].matches);if(d[A]){for(c=++g;c<e&&!u.relative[a[c].type];c++);return p(1<g&&m(s),1<g&&a.slice(0,g-1).join("").replace(F,"$1"),d,g<c&&n(a.slice(g,c)),c<e&&n(a=a.slice(c)),c<e&&a.join(""))}s.push(d)}return m(s)}function q(a,b){var c=0<b.length,e=0<a.length,f=function(g,h,k,l,m){var p,n,q=[],r=0,t="0",M=g&&[],T=null!=m,L=ja,v=g||e&&u.find.TAG("*",m&&h.parentNode||h),A=ga+=null==L?1:Math.E;T&&(ja=h!==O&&h,B=f.el);for(;null!=(m=v[t]);t++){if(e&&m){for(p=0;n=a[p];p++)if(n(m,h,k)){l.push(m);break}T&&
-(ga=A,B=++f.el)}c&&((m=!n&&m)&&r--,g&&M.push(m))}r+=t;if(c&&t!==r){for(p=0;n=b[p];p++)n(M,q,h,k);if(g){if(0<r)for(;t--;)M[t]||q[t]||(q[t]=ec.call(l));q=s(q)}y.apply(l,q);T&&!g&&0<q.length&&1<r+b.length&&d.uniqueSort(l)}T&&(ga=A,ja=L);return M};f.el=0;return c?K(f):f}function r(a,b,d,c,e){var f,g,h,l,m=k(a);if(!c&&1===m.length){g=m[0]=m[0].slice(0);if(2<g.length&&"ID"===(h=g[0]).type&&9===b.nodeType&&!e&&u.relative[g[1].type]){b=u.find.ID(h.matches[0].replace($,""),b,e)[0];if(!b)return d;a=a.slice(g.shift().length)}for(f=
-R.POS.test(a)?-1:g.length-1;0<=f;f--){h=g[f];if(u.relative[l=h.type])break;if(l=u.find[l])if(c=l(h.matches[0].replace($,""),S.test(g[0].type)&&b.parentNode||b,e)){g.splice(f,1);a=c.length&&g.join("");if(!a)return y.apply(d,D.call(c,0)),d;break}}}x(a,m)(c,b,e,d,S.test(a));return d}function v(){}var B,z,u,J,w,t,x,G,M,ja,T=!0,A=("sizcache"+Math.random()).replace(".",""),jb=String,O=a.document,L=O.documentElement,ga=0,I=0,ec=[].pop,y=[].push,D=[].slice,C=[].indexOf||function(a){for(var b=0,d=this.length;b<
-d;b++)if(this[b]===a)return b;return-1},K=function(a,b){a[A]=null==b||b;return a},E=function(){var a={},b=[];return K(function(d,c){b.push(d)>u.cacheLength&&delete a[b.shift()];return a[d+" "]=c},a)},P=E(),H=E(),Q=E(),E="\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[-\\w]|[^\\x00-\\xa0])+)[\\x20\\t\\r\\n\\f]*(?:([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+"(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+".replace("w","w#")+")|)|)[\\x20\\t\\r\\n\\f]*\\]",N=":((?:\\\\.|[-\\w]|[^\\x00-\\xa0])+)(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+
-E+")|[^:]|\\\\.)*|.*))\\)|)",F=RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$","g"),U=/^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/,V=/^[\x20\t\r\n\f]*([\x20\t\r\n\f>+~])[\x20\t\r\n\f]*/,X=new RegExp(N),Y=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,S=/[\x20\t\r\n\f]*[+~]/,aa=/h\d/i,ba=/input|select|textarea|button/i,$=/\\(?!\\)/g,R={ID:/^#((?:\\.|[-\w]|[^\x00-\xa0])+)/,CLASS:/^\.((?:\\.|[-\w]|[^\x00-\xa0])+)/,NAME:/^\[name=['"]?((?:\\.|[-\w]|[^\x00-\xa0])+)['"]?\]/,TAG:new RegExp("^("+
-"(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+".replace("w","w*")+")"),ATTR:new RegExp("^"+E),PSEUDO:new RegExp("^"+N),POS:/:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i,CHILD:RegExp("^:(only|nth|first|last)-child(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),needsContext:RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)",
-"i")},W=function(a){var b=O.createElement("div");try{return a(b)}catch(d){return!1}finally{}},E=W(function(a){a.appendChild(O.createComment(""));return!a.getElementsByTagName("*").length}),ca=W(function(a){a.innerHTML="<a href='#'></a>";return a.firstChild&&"undefined"!==typeof a.firstChild.getAttribute&&"#"===a.firstChild.getAttribute("href")}),da=W(function(a){a.innerHTML="<select></select>";a=typeof a.lastChild.getAttribute("multiple");return"boolean"!==a&&"string"!==a}),Z=W(function(a){a.innerHTML=
-"<div class='hidden e'></div><div class='hidden'></div>";if(!a.getElementsByClassName||!a.getElementsByClassName("e").length)return!1;a.lastChild.className="e";return 2===a.getElementsByClassName("e").length}),ea=W(function(a){a.id=A+0;a.innerHTML="<a name='"+A+"'></a><div name='"+A+"'></div>";L.insertBefore(a,L.firstChild);var b=O.getElementsByName&&O.getElementsByName(A).length===2+O.getElementsByName(A+0).length;z=!O.getElementById(A);L.removeChild(a);return b});try{D.call(L.childNodes,0)[0].nodeType}catch(fa){D=
-function(a){for(var b,d=[];b=this[a];a++)d.push(b);return d}}d.matches=function(a,b){return d(a,null,null,b)};d.matchesSelector=function(a,b){return 0<d(b,null,null,[a]).length};J=d.getText=function(a){var b,d="",c=0;if(b=a.nodeType)if(1===b||9===b||11===b){if("string"===typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)d+=J(a)}else{if(3===b||4===b)return a.nodeValue}else for(;b=a[c];c++)d+=J(b);return d};w=d.isXML=function(a){return(a=a&&(a.ownerDocument||a).documentElement)?
-"HTML"!==a.nodeName:!1};t=d.contains=L.contains?function(a,b){var d=9===a.nodeType?a.documentElement:a,c=b&&b.parentNode;return a===c||!!(c&&1===c.nodeType&&d.contains&&d.contains(c))}:L.compareDocumentPosition?function(a,b){return b&&!!(a.compareDocumentPosition(b)&16)}:function(a,b){for(;b=b.parentNode;)if(b===a)return!0;return!1};d.attr=function(a,b){var d,c=w(a);c||(b=b.toLowerCase());return(d=u.attrHandle[b])?d(a):c||da?a.getAttribute(b):(d=a.getAttributeNode(b))?"boolean"===typeof a[b]?a[b]?
-b:null:d.specified?d.value:null:null};u=d.selectors={cacheLength:50,createPseudo:K,match:R,attrHandle:ca?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},find:{ID:z?function(a,b,d){if("undefined"!==typeof b.getElementById&&!d)return(a=b.getElementById(a))&&a.parentNode?[a]:[]}:function(a,d,c){if("undefined"!==typeof d.getElementById&&!c)return(d=d.getElementById(a))?d.id===a||"undefined"!==typeof d.getAttributeNode&&d.getAttributeNode("id").value===
-a?[d]:b:[]},TAG:E?function(a,b){if("undefined"!==typeof b.getElementsByTagName)return b.getElementsByTagName(a)}:function(a,b){var d=b.getElementsByTagName(a);if("*"===a){for(var c,e=[],f=0;c=d[f];f++)1===c.nodeType&&e.push(c);return e}return d},NAME:ea&&function(a,b){if("undefined"!==typeof b.getElementsByName)return b.getElementsByName(name)},CLASS:Z&&function(a,b,d){if("undefined"!==typeof b.getElementsByClassName&&!d)return b.getElementsByClassName(a)}},relative:{">":{dir:"parentNode",first:!0},
-" ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){a[1]=a[1].replace($,"");a[3]=(a[4]||a[5]||"").replace($,"");"~="===a[2]&&(a[3]=" "+a[3]+" ");return a.slice(0,4)},CHILD:function(a){a[1]=a[1].toLowerCase();"nth"===a[1]?(a[2]||d.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*("even"===a[2]||"odd"===a[2])),a[4]=+(a[6]+a[7]||"odd"===a[2])):a[2]&&d.error(a[0]);return a},PSEUDO:function(a){var b,d;if(R.CHILD.test(a[0]))return null;if(a[3])a[2]=
-a[3];else if(b=a[4])X.test(b)&&(d=k(b,!0))&&(d=b.indexOf(")",b.length-d)-b.length)&&(b=b.slice(0,d),a[0]=a[0].slice(0,d)),a[2]=b;return a.slice(0,3)}},filter:{ID:z?function(a){a=a.replace($,"");return function(b){return b.getAttribute("id")===a}}:function(a){a=a.replace($,"");return function(b){return(b="undefined"!==typeof b.getAttributeNode&&b.getAttributeNode("id"))&&b.value===a}},TAG:function(a){if("*"===a)return function(){return!0};a=a.replace($,"").toLowerCase();return function(b){return b.nodeName&&
-b.nodeName.toLowerCase()===a}},CLASS:function(a){var b=P[A][a+" "];return b||(b=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+a+"([\\x20\\t\\r\\n\\f]|$)"))&&P(a,function(a){return b.test(a.className||"undefined"!==typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(e,f){var g=d.attr(e,a);if(null==g)return"!="===b;if(!b)return!0;g+="";return"="===b?g===c:"!="===b?g!==c:"^="===b?c&&0===g.indexOf(c):"*="===b?c&&-1<g.indexOf(c):"$="===b?c&&g.substr(g.length-c.length)===
-c:"~="===b?-1<(" "+g+" ").indexOf(c):"|="===b?g===c||g.substr(0,c.length+1)===c+"-":!1}},CHILD:function(a,b,d,c){return"nth"===a?function(a){var b,e;b=a.parentNode;if(1===d&&0===c)return!0;if(b)for(e=0,b=b.firstChild;b&&(1!==b.nodeType||(e++,a!==b));b=b.nextSibling);e-=c;return e===d||0===e%d&&0<=e/d}:function(b){var d=b;switch(a){case "only":case "first":for(;d=d.previousSibling;)if(1===d.nodeType)return!1;if("first"===a)return!0;d=b;case "last":for(;d=d.nextSibling;)if(1===d.nodeType)return!1;return!0}}},
-PSEUDO:function(a,b){var c,e=u.pseudos[a]||u.setFilters[a.toLowerCase()]||d.error("unsupported pseudo: "+a);return e[A]?e(b):1<e.length?(c=[a,a,"",b],u.setFilters.hasOwnProperty(a.toLowerCase())?K(function(a,d){for(var c,f=e(a,b),g=f.length;g--;)c=C.call(a,f[g]),a[c]=!(d[c]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:K(function(a){var b=[],d=[],c=x(a.replace(F,"$1"));return c[A]?K(function(a,b,d,e){e=c(a,null,e,[]);for(var f=a.length;f--;)if(d=e[f])a[f]=!(b[f]=d)}):function(a,e,f){b[0]=
-a;c(b,null,f,d);return!d.pop()}}),has:K(function(a){return function(b){return 0<d(a,b).length}}),contains:K(function(a){return function(b){return-1<(b.textContent||b.innerText||J(b)).indexOf(a)}}),enabled:function(a){return!1===a.disabled},disabled:function(a){return!0===a.disabled},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return!0===a.selected},parent:function(a){return!u.pseudos.empty(a)},
-empty:function(a){var b;for(a=a.firstChild;a;){if("@"<a.nodeName||3===(b=a.nodeType)||4===b)return!1;a=a.nextSibling}return!0},header:function(a){return aa.test(a.nodeName)},text:function(a){var b,d;return"input"===a.nodeName.toLowerCase()&&"text"===(b=a.type)&&(null==(d=a.getAttribute("type"))||d.toLowerCase()===b)},radio:e("radio"),checkbox:e("checkbox"),file:e("file"),password:e("password"),image:e("image"),submit:f("submit"),reset:f("reset"),button:function(a){var b=a.nodeName.toLowerCase();return"input"===
-b&&"button"===a.type||"button"===b},input:function(a){return ba.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return a===b.activeElement&&(!b.hasFocus||b.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},active:function(a){return a===a.ownerDocument.activeElement},first:g(function(){return[0]}),last:g(function(a,b){return[b-1]}),eq:g(function(a,b,d){return[0>d?d+b:d]}),even:g(function(a,b){for(var d=0;d<b;d+=2)a.push(d);return a}),odd:g(function(a,b){for(var d=1;d<b;d+=2)a.push(d);return a}),
-lt:g(function(a,b,d){for(b=0>d?d+b:d;0<=--b;)a.push(b);return a}),gt:g(function(a,b,d){for(d=0>d?d+b:d;++d<b;)a.push(d);return a})}};G=L.compareDocumentPosition?function(a,b){return a===b?(M=!0,0):(a.compareDocumentPosition&&b.compareDocumentPosition?a.compareDocumentPosition(b)&4:a.compareDocumentPosition)?-1:1}:function(a,b){if(a===b)return M=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var d,c,e=[],f=[];d=a.parentNode;c=b.parentNode;var g=d;if(d===c)return h(a,b);if(!d)return-1;
-if(!c)return 1;for(;g;)e.unshift(g),g=g.parentNode;for(g=c;g;)f.unshift(g),g=g.parentNode;d=e.length;c=f.length;for(g=0;g<d&&g<c;g++)if(e[g]!==f[g])return h(e[g],f[g]);return g===d?h(a,f[g],-1):h(e[g],b,1)};[0,0].sort(G);T=!M;d.uniqueSort=function(a){var b,d=[],c=1,e=0;M=T;a.sort(G);if(M){for(;b=a[c];c++)b===a[c-1]&&(e=d.push(c));for(;e--;)a.splice(d[e],1)}return a};d.error=function(a){throw Error("Syntax error, unrecognized expression: "+a);};x=d.compile=function(a,b){var d,c=[],e=[],f=Q[A][a+" "];
-if(!f){b||(b=k(a));for(d=b.length;d--;)f=n(b[d]),f[A]?c.push(f):e.push(f);f=Q(a,q(e,c))}return f};O.querySelectorAll&&function(){var a,b=r,c=/'|\\/g,e=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,f=[":focus"],g=[":active"],h=L.matchesSelector||L.mozMatchesSelector||L.webkitMatchesSelector||L.oMatchesSelector||L.msMatchesSelector;W(function(a){a.innerHTML="<select><option selected=''></option></select>";a.querySelectorAll("[selected]").length||f.push("\\[[\\x20\\t\\r\\n\\f]*(?:checked|disabled|ismap|multiple|readonly|selected|value)");
-a.querySelectorAll(":checked").length||f.push(":checked")});W(function(a){a.innerHTML="<p test=''></p>";a.querySelectorAll("[test^='']").length&&f.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:\"\"|'')");a.innerHTML="<input type='hidden'/>";a.querySelectorAll(":enabled").length||f.push(":enabled",":disabled")});f=new RegExp(f.join("|"));r=function(a,d,e,g,h){if(!g&&!h&&!f.test(a)){var l,m,p=!0,n=A;m=d;l=9===d.nodeType&&a;if(1===d.nodeType&&"object"!==d.nodeName.toLowerCase()){l=k(a);(p=d.getAttribute("id"))?
-n=p.replace(c,"\\$&"):d.setAttribute("id",n);n="[id='"+n+"'] ";for(m=l.length;m--;)l[m]=n+l[m].join("");m=S.test(a)&&d.parentNode||d;l=l.join(",")}if(l)try{return y.apply(e,D.call(m.querySelectorAll(l),0)),e}catch(s){}finally{p||d.removeAttribute("id")}}return b(a,d,e,g,h)};h&&(W(function(b){a=h.call(b,"div");try{h.call(b,"[test!='']:sizzle"),g.push("!=",N)}catch(d){}}),g=new RegExp(g.join("|")),d.matchesSelector=function(b,c){c=c.replace(e,"='$1']");if(!w(b)&&!g.test(c)&&!f.test(c))try{var k=h.call(b,
-c);if(k||a||b.document&&11!==b.document.nodeType)return k}catch(l){}return 0<d(c,null,null,[b]).length})}();u.pseudos.nth=u.pseudos.eq;u.filters=v.prototype=u.pseudos;u.setFilters=new v;d.attr=c.attr;c.find=d;c.expr=d.selectors;c.expr[":"]=c.expr.pseudos;c.unique=d.uniqueSort;c.text=d.getText;c.isXMLDoc=d.isXML;c.contains=d.contains})(r);var fc=/Until$/,gc=/^(?:parents|prev(?:Until|All))/,Cb=/^.[^:#\[\.,]*$/,kb=c.expr.match.needsContext,hc={children:!0,contents:!0,next:!0,prev:!0};c.fn.extend({find:function(a){var b,
-d,e,f,g,h,k=this;if("string"!==typeof a)return c(a).filter(function(){b=0;for(d=k.length;b<d;b++)if(c.contains(k[b],this))return!0});h=this.pushStack("","find",a);b=0;for(d=this.length;b<d;b++)if(e=h.length,c.find(a,this[b],h),0<b)for(f=e;f<h.length;f++)for(g=0;g<e;g++)if(h[g]===h[f]){h.splice(f--,1);break}return h},has:function(a){var b,d=c(a,this),e=d.length;return this.filter(function(){for(b=0;b<e;b++)if(c.contains(this,d[b]))return!0})},not:function(a){return this.pushStack(Ba(this,a,!1),"not",
-a)},filter:function(a){return this.pushStack(Ba(this,a,!0),"filter",a)},is:function(a){return!!a&&("string"===typeof a?kb.test(a)?0<=c(a,this.context).index(this[0]):0<c.filter(a,this).length:0<this.filter(a).length)},closest:function(a,b){for(var d,e=0,f=this.length,g=[],h=kb.test(a)||"string"!==typeof a?c(a,b||this.context):0;e<f;e++)for(d=this[e];d&&d.ownerDocument&&d!==b&&11!==d.nodeType;){if(h?-1<h.index(d):c.find.matchesSelector(d,a)){g.push(d);break}d=d.parentNode}g=1<g.length?c.unique(g):
-g;return this.pushStack(g,"closest",a)},index:function(a){return a?"string"===typeof a?c.inArray(this[0],c(a)):c.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var d="string"===typeof a?c(a,b):c.makeArray(a&&a.nodeType?[a]:a),e=c.merge(this.get(),d);return this.pushStack(Y(d[0])||Y(e[0])?e:c.unique(e))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});c.fn.andSelf=c.fn.addBack;c.each({parent:function(a){return(a=
-a.parentNode)&&11!==a.nodeType?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return Aa(a,"nextSibling")},prev:function(a){return Aa(a,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling((a.parentNode||
-{}).firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.merge([],a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);fc.test(a)||(e=d);e&&"string"===typeof e&&(f=c.filter(e,f));f=1<this.length&&!hc[a]?c.unique(f):f;1<this.length&&gc.test(a)&&(f=f.reverse());return this.pushStack(f,a,w.call(arguments).join(","))}});c.extend({filter:function(a,b,d){d&&(a=":not("+a+")");
-return 1===b.length?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&9!==a.nodeType&&(d===n||1!==a.nodeType||!c(a).is(d));)1===a.nodeType&&e.push(a),a=a[b];return e},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&d.push(a);return d}});var Da="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ic=/ jQuery\d+="(?:null|\d+)"/g,
-ta=/^\s+/,lb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,mb=/<([\w:]+)/,jc=/<tbody/i,kc=/<|&#?\w+;/,lc=/<(?:script|style|link)/i,mc=/<(?:script|object|embed|option|style)/i,ua=new RegExp("<(?:"+Da+")[\\s/>]","i"),Ga=/^(?:checkbox|radio)$/,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,nc=/\/(java|ecma)script/i,oc=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,z={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],
-tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ob=Ca(q),va=ob.appendChild(q.createElement("div"));z.optgroup=z.option;z.tbody=z.tfoot=z.colgroup=z.caption=z.thead;z.th=z.td;c.support.htmlSerialize||(z._default=[1,"X<div>","</div>"]);c.fn.extend({text:function(a){return c.access(this,function(a){return a===n?c.text(this):this.empty().append((this[0]&&
-this[0].ownerDocument||q).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapAll(a.call(this,b))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return c.isFunction(a)?this.each(function(b){c(this).wrapInner(a.call(this,
-b))}):this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){var b=c.isFunction(a);return this.each(function(d){c(this).wrapAll(b?a.call(this,d):a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType||this.appendChild(a)})},prepend:function(){return this.domManip(arguments,
-!0,function(a){1!==this.nodeType&&11!==this.nodeType||this.insertBefore(a,this.firstChild)})},before:function(){if(!Y(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=c.clean(arguments);return this.pushStack(c.merge(a,this),"before",this.selector)}},after:function(){if(!Y(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=c.clean(arguments);return this.pushStack(c.merge(this,
-a),"after",this.selector)}},remove:function(a,b){for(var d,e=0;null!=(d=this[e]);e++)if(!a||c.filter(a,[d]).length)b||1!==d.nodeType||(c.cleanData(d.getElementsByTagName("*")),c.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)for(1===a.nodeType&&c.cleanData(a.getElementsByTagName("*"));a.firstChild;)a.removeChild(a.firstChild);return this},clone:function(a,b){a=null==a?!1:a;b=null==b?a:b;return this.map(function(){return c.clone(this,
-a,b)})},html:function(a){return c.access(this,function(a){var d=this[0]||{},e=0,f=this.length;if(a===n)return 1===d.nodeType?d.innerHTML.replace(ic,""):n;if(!("string"!==typeof a||lc.test(a)||!c.support.htmlSerialize&&ua.test(a)||!c.support.leadingWhitespace&&ta.test(a)||z[(mb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(lb,"<$1></$2>");try{for(;e<f;e++)d=this[e]||{},1===d.nodeType&&(c.cleanData(d.getElementsByTagName("*")),d.innerHTML=a);d=0}catch(g){}}d&&this.empty().append(a)},null,a,arguments.length)},
-replaceWith:function(a){if(!Y(this[0])){if(c.isFunction(a))return this.each(function(b){var d=c(this),e=d.html();d.replaceWith(a.call(this,b,e))});"string"!==typeof a&&(a=c(a).detach());return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}return this.length?this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,b,d){a=[].concat.apply([],a);var e,f,g,h=0,k=a[0],
-l=[],m=this.length;if(!c.support.checkClone&&1<m&&"string"===typeof k&&nb.test(k))return this.each(function(){c(this).domManip(a,b,d)});if(c.isFunction(k))return this.each(function(e){var f=c(this);a[0]=k.call(this,e,b?f.html():n);f.domManip(a,b,d)});if(this[0]){e=c.buildFragment(a,this,l);g=e.fragment;f=g.firstChild;1===g.childNodes.length&&(g=f);if(f)for(b=b&&c.nodeName(f,"tr"),e=e.cacheable||m-1;h<m;h++)d.call(b&&c.nodeName(this[h],"table")?Db(this[h],"tbody"):this[h],h===e?g:c.clone(g,!0,!0));
-g=f=null;l.length&&c.each(l,function(a,b){b.src?c.ajax?c.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):c.error("no ajax"):c.globalEval((b.text||b.textContent||b.innerHTML||"").replace(oc,""));b.parentNode&&b.parentNode.removeChild(b)})}return this}});c.buildFragment=function(a,b,d){var e,f,g,h=a[0];b=b||q;b=!b.nodeType&&b[0]||b;b=b.ownerDocument||b;!(1===a.length&&"string"===typeof h&&512>h.length&&b===q&&"<"===h.charAt(0))||mc.test(h)||!c.support.checkClone&&nb.test(h)||
-!c.support.html5Clone&&ua.test(h)||(f=!0,e=c.fragments[h],g=e!==n);e||(e=b.createDocumentFragment(),c.clean(a,b,e,d),f&&(c.fragments[h]=g&&e));return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e,f=0,g=[];d=c(d);var h=d.length;e=1===this.length&&this[0].parentNode;if((null==e||e&&11===e.nodeType&&1===e.childNodes.length)&&1===h)return d[b](this[0]),this;
-for(;f<h;f++)e=(0<f?this.clone(!0):this).get(),c(d[f])[b](e),g=g.concat(e);return this.pushStack(g,a,d.selector)}});c.extend({clone:function(a,b,d){var e,f,g,h;c.support.html5Clone||c.isXMLDoc(a)||!ua.test("<"+a.nodeName+">")?h=a.cloneNode(!0):(va.innerHTML=a.outerHTML,va.removeChild(h=va.firstChild));if(!(c.support.noCloneEvent&&c.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||c.isXMLDoc(a)))for(Fa(a,h),e=ba(a),f=ba(h),g=0;e[g];++g)f[g]&&Fa(e[g],f[g]);if(b&&(Ea(a,h),d))for(e=ba(a),f=ba(h),
-g=0;e[g];++g)Ea(e[g],f[g]);return h},clean:function(a,b,d,e){var f,g,h,k,l,m,n=b===q&&ob,p=[];b&&"undefined"!==typeof b.createDocumentFragment||(b=q);for(f=0;null!=(h=a[f]);f++)if("number"===typeof h&&(h+=""),h){if("string"===typeof h)if(kc.test(h)){n=n||Ca(b);m=b.createElement("div");n.appendChild(m);h=h.replace(lb,"<$1></$2>");g=(mb.exec(h)||["",""])[1].toLowerCase();k=z[g]||z._default;l=k[0];for(m.innerHTML=k[1]+h+k[2];l--;)m=m.lastChild;if(!c.support.tbody)for(l=jc.test(h),k="table"!==g||l?"<table>"!==
-k[1]||l?[]:m.childNodes:m.firstChild&&m.firstChild.childNodes,g=k.length-1;0<=g;--g)c.nodeName(k[g],"tbody")&&!k[g].childNodes.length&&k[g].parentNode.removeChild(k[g]);!c.support.leadingWhitespace&&ta.test(h)&&m.insertBefore(b.createTextNode(ta.exec(h)[0]),m.firstChild);h=m.childNodes;m.parentNode.removeChild(m)}else h=b.createTextNode(h);h.nodeType?p.push(h):c.merge(p,h)}m&&(h=m=n=null);if(!c.support.appendChecked)for(f=0;null!=(h=p[f]);f++)c.nodeName(h,"input")?Ha(h):"undefined"!==typeof h.getElementsByTagName&&
-c.grep(h.getElementsByTagName("input"),Ha);if(d)for(a=function(a){if(!a.type||nc.test(a.type))return e?e.push(a.parentNode?a.parentNode.removeChild(a):a):d.appendChild(a)},f=0;null!=(h=p[f]);f++)c.nodeName(h,"script")&&a(h)||(d.appendChild(h),"undefined"!==typeof h.getElementsByTagName&&(h=c.grep(c.merge([],h.getElementsByTagName("script")),a),p.splice.apply(p,[f+1,0].concat(h)),f+=h.length));return p},cleanData:function(a,b){for(var d,e,f,g,h=0,k=c.expando,l=c.cache,m=c.support.deleteExpando,n=c.event.special;null!=
-(f=a[h]);h++)if(b||c.acceptData(f))if(d=(e=f[k])&&l[e]){if(d.events)for(g in d.events)n[g]?c.event.remove(f,g):c.removeEvent(f,g,d.handle);l[e]&&(delete l[e],m?delete f[k]:f.removeAttribute?f.removeAttribute(k):f[k]=null,c.deletedIds.push(e))}}});(function(){var a,b;c.uaMatch=function(a){a=a.toLowerCase();a=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||0>a.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||
-[];return{browser:a[1]||"",version:a[2]||"0"}};a=c.uaMatch(Jb.userAgent);b={};a.browser&&(b[a.browser]=!0,b.version=a.version);b.chrome?b.webkit=!0:b.webkit&&(b.safari=!0);c.browser=b;c.sub=function(){function a(b,c){return new a.fn.init(b,c)}c.extend(!0,a,this);a.superclass=this;a.fn=a.prototype=this();a.fn.constructor=a;a.sub=this.sub;a.fn.init=function(f,g){g&&g instanceof c&&!(g instanceof a)&&(g=a(g));return c.fn.init.call(this,f,g,b)};a.fn.init.prototype=a.fn;var b=a(q);return a}})();var v,
-F,U,wa=/alpha\([^)]*\)/i,pc=/opacity=([^)]*)/,qc=/^(top|right|bottom|left)$/,rc=/^(none|table(?!-c[ea]).+)/,pb=/^margin/,Eb=new RegExp("^("+ha+")(.*)$","i"),ca=new RegExp("^("+ha+")(?!px)[a-z%]+$","i"),sc=new RegExp("^([-+])=("+ha+")","i"),na={BODY:"block"},tc={position:"absolute",visibility:"hidden",display:"block"},qb={letterSpacing:0,fontWeight:400},C=["Top","Right","Bottom","Left"],Ja=["Webkit","O","Moz","ms"],uc=c.fn.toggle;c.fn.extend({css:function(a,b){return c.access(this,function(a,b,f){return f!==
-n?c.style(a,b,f):c.css(a,b)},a,b,1<arguments.length)},show:function(){return Ka(this,!0)},hide:function(){return Ka(this)},toggle:function(a,b){var d="boolean"===typeof a;return c.isFunction(a)&&c.isFunction(b)?uc.apply(this,arguments):this.each(function(){(d?a:R(this))?c(this).show():c(this).hide()})}});c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=v(a,"opacity");return""===d?"1":d}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},
-cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g,h,k=c.camelCase(b),l=a.style;b=c.cssProps[k]||(c.cssProps[k]=Ia(l,k));h=c.cssHooks[b]||c.cssHooks[k];if(d!==n){if(g=typeof d,"string"===g&&(f=sc.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(c.css(a,b)),g="number"),!(null==d||"number"===g&&isNaN(d)||("number"!==g||c.cssNumber[k]||(d+="px"),h&&"set"in h&&(d=h.set(a,d,e))===n)))try{l[b]=d}catch(m){}}else return h&&"get"in
-h&&(f=h.get(a,!1,e))!==n?f:l[b]}},css:function(a,b,d,e){var f,g;g=c.camelCase(b);b=c.cssProps[g]||(c.cssProps[g]=Ia(a.style,g));(g=c.cssHooks[b]||c.cssHooks[g])&&"get"in g&&(f=g.get(a,!0,e));f===n&&(f=v(a,b));"normal"===f&&b in qb&&(f=qb[b]);return d||e!==n?(a=parseFloat(f),d||c.isNumeric(a)?a||0:f):f},swap:function(a,b,d){var c,f={};for(c in b)f[c]=a.style[c],a.style[c]=b[c];d=d.call(a);for(c in b)a.style[c]=f[c];return d}});r.getComputedStyle?v=function(a,b){var d,e,f,g,h=r.getComputedStyle(a,null),
-k=a.style;h&&(d=h.getPropertyValue(b)||h[b],""!==d||c.contains(a.ownerDocument,a)||(d=c.style(a,b)),ca.test(d)&&pb.test(b)&&(e=k.width,f=k.minWidth,g=k.maxWidth,k.minWidth=k.maxWidth=k.width=d,d=h.width,k.width=e,k.minWidth=f,k.maxWidth=g));return d}:q.documentElement.currentStyle&&(v=function(a,b){var d,c,f=a.currentStyle&&a.currentStyle[b],g=a.style;null==f&&g&&g[b]&&(f=g[b]);if(ca.test(f)&&!qc.test(b)){d=g.left;if(c=a.runtimeStyle&&a.runtimeStyle.left)a.runtimeStyle.left=a.currentStyle.left;g.left=
-"fontSize"===b?"1em":f;f=g.pixelLeft+"px";g.left=d;c&&(a.runtimeStyle.left=c)}return""===f?"auto":f});c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(a,e,f){if(e)return 0===a.offsetWidth&&rc.test(v(a,"display"))?c.swap(a,tc,function(){return Oa(a,b,f)}):Oa(a,b,f)},set:function(a,e,f){return Ma(a,e,f?Na(a,b,f,c.support.boxSizing&&"border-box"===c.css(a,"boxSizing")):0)}}});c.support.opacity||(c.cssHooks.opacity={get:function(a,b){return pc.test((b&&a.currentStyle?a.currentStyle.filter:
-a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var d=a.style,e=a.currentStyle,f=c.isNumeric(b)?"alpha(opacity="+100*b+")":"",g=e&&e.filter||d.filter||"";d.zoom=1;if(1<=b&&""===c.trim(g.replace(wa,""))&&d.removeAttribute&&(d.removeAttribute("filter"),e&&!e.filter))return;d.filter=wa.test(g)?g.replace(wa,f):g+" "+f}});c(function(){c.support.reliableMarginRight||(c.cssHooks.marginRight={get:function(a,b){return c.swap(a,{display:"inline-block"},function(){if(b)return v(a,
-"marginRight")})}});!c.support.pixelPosition&&c.fn.position&&c.each(["top","left"],function(a,b){c.cssHooks[b]={get:function(a,e){if(e){var f=v(a,b);return ca.test(f)?c(a).position()[b]+"px":f}}}})});c.expr&&c.expr.filters&&(c.expr.filters.hidden=function(a){return 0===a.offsetWidth&&0===a.offsetHeight||!c.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||v(a,"display"))},c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)});c.each({margin:"",padding:"",border:"Width"},
-function(a,b){c.cssHooks[a+b]={expand:function(c){var e="string"===typeof c?c.split(" "):[c],f={};for(c=0;4>c;c++)f[a+C[c]+b]=e[c]||e[c-2]||e[0];return f}};pb.test(a)||(c.cssHooks[a+b].set=Ma)});var vc=/%20/g,Fb=/\[\]$/,rb=/\r?\n/g,wc=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,xc=/^(?:select|textarea)/i;c.fn.extend({serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?
-c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||xc.test(this.nodeName)||wc.test(this.type))}).map(function(a,b){var d=c(this).val();return null==d?null:c.isArray(d)?c.map(d,function(a,c){return{name:b.name,value:a.replace(rb,"\r\n")}}):{name:b.name,value:d.replace(rb,"\r\n")}}).get()}});c.param=function(a,b){var d,e=[],f=function(a,b){b=c.isFunction(b)?b():null==b?"":b;e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};b===n&&(b=c.ajaxSettings&&
-c.ajaxSettings.traditional);if(c.isArray(a)||a.jquery&&!c.isPlainObject(a))c.each(a,function(){f(this.name,this.value)});else for(d in a)oa(d,a[d],b,f);return e.join("&").replace(vc,"+")};var P,Q,yc=/#.*$/,zc=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,Ac=/^(?:GET|HEAD)$/,Bc=/^\/\//,sb=/\?/,Cc=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Dc=/([?&])_=[^&]*/,tb=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,ub=c.fn.load,pa={},vb={},wb=["*/"]+["*"];try{Q=Ib.href}catch(Kc){Q=q.createElement("a"),Q.href=
-"",Q=Q.href}P=tb.exec(Q.toLowerCase())||[];c.fn.load=function(a,b,d){if("string"!==typeof a&&ub)return ub.apply(this,arguments);if(!this.length)return this;var e,f,g,h=this,k=a.indexOf(" ");0<=k&&(e=a.slice(k,a.length),a=a.slice(0,k));c.isFunction(b)?(d=b,b=n):b&&"object"===typeof b&&(f="POST");c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(a,b){d&&h.each(d,g||[a.responseText,b,a])}}).done(function(a){g=arguments;h.html(e?c("<div>").append(a.replace(Cc,"")).find(e):a)});return this};
-c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(a){return this.on(b,a)}});c.each(["get","post"],function(a,b){c[b]=function(a,e,f,g){c.isFunction(e)&&(g=g||f,f=e,e=n);return c.ajax({type:b,url:a,data:e,success:f,dataType:g})}});c.extend({getScript:function(a,b){return c.get(a,n,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},ajaxSetup:function(a,b){b?Qa(a,c.ajaxSettings):(b=a,a=c.ajaxSettings);Qa(a,b);return a},ajaxSettings:{url:Q,
-isLocal:/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/.test(P[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":wb},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":r.String,"text html":!0,"text json":c.parseJSON,"text xml":c.parseXML},
-flatOptions:{context:!0,url:!0}},ajaxPrefilter:Pa(pa),ajaxTransport:Pa(vb),ajax:function(a,b){function d(a,b,d,g){var l,s,u,w,I=b;if(2!==J){J=2;k&&clearTimeout(k);h=n;f=g||"";t.readyState=0<a?4:0;if(d){w=p;g=t;var x,y,D,C,K=w.contents,E=w.dataTypes,F=w.responseFields;for(y in F)y in d&&(g[F[y]]=d[y]);for(;"*"===E[0];)E.shift(),x===n&&(x=w.mimeType||g.getResponseHeader("content-type"));if(x)for(y in K)if(K[y]&&K[y].test(x)){E.unshift(y);break}if(E[0]in d)D=E[0];else{for(y in d){if(!E[0]||w.converters[y+
-" "+E[0]]){D=y;break}C||(C=y)}D=D||C}D?(D!==E[0]&&E.unshift(D),w=d[D]):w=void 0}if(200<=a&&300>a||304===a)if(p.ifModified&&((d=t.getResponseHeader("Last-Modified"))&&(c.lastModified[e]=d),(d=t.getResponseHeader("Etag"))&&(c.etag[e]=d)),304===a)I="notmodified",l=!0;else{a:{s=p;u=w;var H,G,I=s.dataTypes.slice();x=I[0];y={};D=0;s.dataFilter&&(u=s.dataFilter(u,s.dataType));if(I[1])for(H in s.converters)y[H.toLowerCase()]=s.converters[H];for(;d=I[++D];)if("*"!==d){if("*"!==x&&x!==d){H=y[x+" "+d]||y["* "+
-d];if(!H)for(G in y)if(l=G.split(" "),l[1]===d&&(H=y[x+" "+l[0]]||y["* "+l[0]])){!0===H?H=y[G]:!0!==y[G]&&(d=l[0],I.splice(D--,0,d));break}if(!0!==H)if(H&&s["throws"])u=H(u);else try{u=H(u)}catch(N){l={state:"parsererror",error:H?N:"No conversion from "+x+" to "+d};break a}}x=d}l={state:"success",data:u}}I=l.state;s=l.data;u=l.error;l=!u}else if(u=I,!I||a)I="error",0>a&&(a=0);t.status=a;t.statusText=(b||I)+"";l?v.resolveWith(q,[s,I,t]):v.rejectWith(q,[t,I,u]);t.statusCode(z);z=n;m&&r.trigger("ajax"+
-(l?"Success":"Error"),[t,p,l?s:u]);B.fireWith(q,[t,I]);m&&(r.trigger("ajaxComplete",[t,p]),--c.active||c.event.trigger("ajaxStop"))}}"object"===typeof a&&(b=a,a=n);b=b||{};var e,f,g,h,k,l,m,s,p=c.ajaxSetup({},b),q=p.context||p,r=q!==p&&(q.nodeType||q instanceof c)?c(q):c.event,v=c.Deferred(),B=c.Callbacks("once memory"),z=p.statusCode||{},w={},u={},J=0,x="canceled",t={readyState:0,setRequestHeader:function(a,b){if(!J){var c=a.toLowerCase();a=u[c]=u[c]||a;w[a]=b}return this},getAllResponseHeaders:function(){return 2===
-J?f:null},getResponseHeader:function(a){var b;if(2===J){if(!g)for(g={};b=zc.exec(f);)g[b[1].toLowerCase()]=b[2];b=g[a.toLowerCase()]}return b===n?null:b},overrideMimeType:function(a){J||(p.mimeType=a);return this},abort:function(a){a=a||x;h&&h.abort(a);d(0,a);return this}};v.promise(t);t.success=t.done;t.error=t.fail;t.complete=B.add;t.statusCode=function(a){if(a){var b;if(2>J)for(b in a)z[b]=[z[b],a[b]];else b=a[t.status],t.always(b)}return this};p.url=((a||p.url)+"").replace(yc,"").replace(Bc,P[1]+
-"//");p.dataTypes=c.trim(p.dataType||"*").toLowerCase().split(G);null==p.crossDomain&&(l=tb.exec(p.url.toLowerCase()),p.crossDomain=!(!l||l[1]===P[1]&&l[2]===P[2]&&(l[3]||("http:"===l[1]?80:443))==(P[3]||("http:"===P[1]?80:443))));p.data&&p.processData&&"string"!==typeof p.data&&(p.data=c.param(p.data,p.traditional));da(pa,p,b,t);if(2===J)return t;m=p.global;p.type=p.type.toUpperCase();p.hasContent=!Ac.test(p.type);m&&0===c.active++&&c.event.trigger("ajaxStart");if(!p.hasContent&&(p.data&&(p.url+=
-(sb.test(p.url)?"&":"?")+p.data,delete p.data),e=p.url,!1===p.cache)){l=c.now();var C=p.url.replace(Dc,"$1_="+l);p.url=C+(C===p.url?(sb.test(p.url)?"&":"?")+"_="+l:"")}(p.data&&p.hasContent&&!1!==p.contentType||b.contentType)&&t.setRequestHeader("Content-Type",p.contentType);p.ifModified&&(e=e||p.url,c.lastModified[e]&&t.setRequestHeader("If-Modified-Since",c.lastModified[e]),c.etag[e]&&t.setRequestHeader("If-None-Match",c.etag[e]));t.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?
-p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+wb+"; q=0.01":""):p.accepts["*"]);for(s in p.headers)t.setRequestHeader(s,p.headers[s]);if(p.beforeSend&&(!1===p.beforeSend.call(q,t,p)||2===J))return t.abort();x="abort";for(s in{success:1,error:1,complete:1})t[s](p[s]);if(h=da(vb,p,b,t)){t.readyState=1;m&&r.trigger("ajaxSend",[t,p]);p.async&&0<p.timeout&&(k=setTimeout(function(){t.abort("timeout")},p.timeout));try{J=1,h.send(w,d)}catch(F){if(2>J)d(-1,F);else throw F;}}else d(-1,"No Transport");
-return t},active:0,lastModified:{},etag:{}});var xb=[],Ec=/\?/,ka=/(=)\?(?=&|$)|\?\?/,Fc=c.now();c.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=xb.pop()||c.expando+"_"+Fc++;this[a]=!0;return a}});c.ajaxPrefilter("json jsonp",function(a,b,d){var e,f,g,h=a.data,k=a.url,l=!1!==a.jsonp,m=l&&ka.test(k),s=l&&!m&&"string"===typeof h&&!(a.contentType||"").indexOf("application/x-www-form-urlencoded")&&ka.test(h);if("jsonp"===a.dataTypes[0]||m||s)return e=a.jsonpCallback=c.isFunction(a.jsonpCallback)?
-a.jsonpCallback():a.jsonpCallback,f=r[e],m?a.url=k.replace(ka,"$1"+e):s?a.data=h.replace(ka,"$1"+e):l&&(a.url+=(Ec.test(k)?"&":"?")+a.jsonp+"="+e),a.converters["script json"]=function(){g||c.error(e+" was not called");return g[0]},a.dataTypes[0]="json",r[e]=function(){g=arguments},d.always(function(){r[e]=f;a[e]&&(a.jsonpCallback=b.jsonpCallback,xb.push(e));g&&c.isFunction(f)&&f(g[0]);g=f=n}),"script"});c.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},
-contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){c.globalEval(a);return a}}});c.ajaxPrefilter("script",function(a){a.cache===n&&(a.cache=!1);a.crossDomain&&(a.type="GET",a.global=!1)});c.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=q.head||q.getElementsByTagName("head")[0]||q.documentElement;return{send:function(e,f){b=q.createElement("script");b.async="async";a.scriptCharset&&(b.charset=a.scriptCharset);b.src=a.url;b.onload=b.onreadystatechange=function(a,
-e){if(e||!b.readyState||/loaded|complete/.test(b.readyState))b.onload=b.onreadystatechange=null,c&&b.parentNode&&c.removeChild(b),b=n,e||f(200,"success")};c.insertBefore(b,c.firstChild)},abort:function(){if(b)b.onload(0,1)}}}});var X,xa=r.ActiveXObject?function(){for(var a in X)X[a](0,1)}:!1,Gc=0;c.ajaxSettings.xhr=r.ActiveXObject?function(){var a;if(!(a=!this.isLocal&&Ra()))a:{try{a=new r.ActiveXObject("Microsoft.XMLHTTP");break a}catch(b){}a=void 0}return a}:Ra;(function(a){c.extend(c.support,{ajax:!!a,
-cors:!!a&&"withCredentials"in a})})(c.ajaxSettings.xhr());c.support.ajax&&c.ajaxTransport(function(a){if(!a.crossDomain||c.support.cors){var b;return{send:function(d,e){var f,g,h=a.xhr();a.username?h.open(a.type,a.url,a.async,a.username,a.password):h.open(a.type,a.url,a.async);if(a.xhrFields)for(g in a.xhrFields)h[g]=a.xhrFields[g];a.mimeType&&h.overrideMimeType&&h.overrideMimeType(a.mimeType);a.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");try{for(g in d)h.setRequestHeader(g,
-d[g])}catch(k){}h.send(a.hasContent&&a.data||null);b=function(d,g){var k,p,q,r,v;try{if(b&&(g||4===h.readyState))if(b=n,f&&(h.onreadystatechange=c.noop,xa&&delete X[f]),g)4!==h.readyState&&h.abort();else{k=h.status;q=h.getAllResponseHeaders();r={};(v=h.responseXML)&&v.documentElement&&(r.xml=v);try{r.text=h.responseText}catch(w){}try{p=h.statusText}catch(x){p=""}k||!a.isLocal||a.crossDomain?1223===k&&(k=204):k=r.text?200:404}}catch(z){g||e(-1,z)}r&&e(k,p,r,q)};a.async?4===h.readyState?setTimeout(b,
-0):(f=++Gc,xa&&(X||(X={},c(r).unload(xa)),X[f]=b),h.onreadystatechange=b):b()},abort:function(){b&&b(0,1)}}}});var V,la,Hc=/^(?:toggle|show|hide)$/,Ic=new RegExp("^(?:([-+])=|)("+ha+")([a-z%]*)$","i"),Jc=/queueHooks$/,Z=[function(a,b,d){var e,f,g,h,k,l,m=this,n=a.style,p={},q=[],r=a.nodeType&&R(a);d.queue||(k=c._queueHooks(a,"fx"),null==k.unqueued&&(k.unqueued=0,l=k.empty.fire,k.empty.fire=function(){k.unqueued||l()}),k.unqueued++,m.always(function(){m.always(function(){k.unqueued--;c.queue(a,"fx").length||
-k.empty.fire()})}));1===a.nodeType&&("height"in b||"width"in b)&&(d.overflow=[n.overflow,n.overflowX,n.overflowY],"inline"===c.css(a,"display")&&"none"===c.css(a,"float")&&(c.support.inlineBlockNeedsLayout&&"inline"!==La(a.nodeName)?n.zoom=1:n.display="inline-block"));d.overflow&&(n.overflow="hidden",c.support.shrinkWrapBlocks||m.done(function(){n.overflow=d.overflow[0];n.overflowX=d.overflow[1];n.overflowY=d.overflow[2]}));for(e in b)g=b[e],Hc.exec(g)&&(delete b[e],f=f||"toggle"===g,g!==(r?"hide":
-"show")&&q.push(e));if(b=q.length)for(g=c._data(a,"fxshow")||c._data(a,"fxshow",{}),("hidden"in g)&&(r=g.hidden),f&&(g.hidden=!r),r?c(a).show():m.done(function(){c(a).hide()}),m.done(function(){var b;c.removeData(a,"fxshow",!0);for(b in p)c.style(a,b,p[b])}),e=0;e<b;e++)f=q[e],h=m.createTween(f,r?g[f]:0),p[f]=g[f]||c.style(a,f),f in g||(g[f]=h.start,r&&(h.end=h.start,h.start="width"===f||"height"===f?1:0))}],S={"*":[function(a,b){var d,e,f=this.createTween(a,b),g=Ic.exec(b),h=f.cur(),k=+h||0,l=1,
-m=20;if(g){d=+g[2];e=g[3]||(c.cssNumber[a]?"":"px");if("px"!==e&&k){k=c.css(f.elem,a,!0)||d||1;do l=l||".5",k/=l,c.style(f.elem,a,k+e);while(l!==(l=f.cur()/h)&&1!==l&&--m)}f.unit=e;f.start=k;f.end=g[1]?k+(g[1]+1)*d:d}return f}]};c.Animation=c.extend(Ta,{tweener:function(a,b){c.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var d,e=0,f=a.length;e<f;e++)d=a[e],S[d]=S[d]||[],S[d].unshift(b)},prefilter:function(a,b){b?Z.unshift(a):Z.push(a)}});c.Tween=B;B.prototype={constructor:B,init:function(a,b,d,
-e,f,g){this.elem=a;this.prop=d;this.easing=f||"swing";this.options=b;this.start=this.now=this.cur();this.end=e;this.unit=g||(c.cssNumber[d]?"":"px")},cur:function(){var a=B.propHooks[this.prop];return a&&a.get?a.get(this):B.propHooks._default.get(this)},run:function(a){var b,d=B.propHooks[this.prop];this.pos=this.options.duration?b=c.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):b=a;this.now=(this.end-this.start)*b+this.start;this.options.step&&this.options.step.call(this.elem,
-this.now,this);d&&d.set?d.set(this):B.propHooks._default.set(this);return this}};B.prototype.init.prototype=B.prototype;B.propHooks={_default:{get:function(a){return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(a=c.css(a.elem,a.prop,!1,""))&&"auto"!==a?a:0:a.elem[a.prop]},set:function(a){if(c.fx.step[a.prop])c.fx.step[a.prop](a);else a.elem.style&&(null!=a.elem.style[c.cssProps[a.prop]]||c.cssHooks[a.prop])?c.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}};B.propHooks.scrollTop=
-B.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}};c.each(["toggle","show","hide"],function(a,b){var d=c.fn[b];c.fn[b]=function(e,f,g){return null==e||"boolean"===typeof e||!a&&c.isFunction(e)&&c.isFunction(f)?d.apply(this,arguments):this.animate(ea(b,!0),e,f,g)}});c.fn.extend({fadeTo:function(a,b,c,e){return this.filter(R).css("opacity",0).show().end().animate({opacity:b},a,c,e)},animate:function(a,b,d,e){var f=c.isEmptyObject(a),g=c.speed(b,d,e);
-b=function(){var b=Ta(this,c.extend({},a),g);f&&b.stop(!0)};return f||!1===g.queue?this.each(b):this.queue(g.queue,b)},stop:function(a,b,d){var e=function(a){var b=a.stop;delete a.stop;b(d)};"string"!==typeof a&&(d=b,b=a,a=n);b&&!1!==a&&this.queue(a||"fx",[]);return this.each(function(){var b=!0,g=null!=a&&a+"queueHooks",h=c.timers,k=c._data(this);if(g)k[g]&&k[g].stop&&e(k[g]);else for(g in k)k[g]&&k[g].stop&&Jc.test(g)&&e(k[g]);for(g=h.length;g--;)h[g].elem!==this||null!=a&&h[g].queue!==a||(h[g].anim.stop(d),
-b=!1,h.splice(g,1));!b&&d||c.dequeue(this,a)})}});c.each({slideDown:ea("show"),slideUp:ea("hide"),slideToggle:ea("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(a,c,f){return this.animate(b,a,c,f)}});c.speed=function(a,b,d){var e=a&&"object"===typeof a?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:"number"===typeof e.duration?e.duration:e.duration in
-c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;if(null==e.queue||!0===e.queue)e.queue="fx";e.old=e.complete;e.complete=function(){c.isFunction(e.old)&&e.old.call(this);e.queue&&c.dequeue(this,e.queue)};return e};c.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}};c.timers=[];c.fx=B.prototype.init;c.fx.tick=function(){var a,b=c.timers,d=0;for(V=c.now();d<b.length;d++)a=b[d],a()||b[d]!==a||b.splice(d--,1);b.length||c.fx.stop();V=n};c.fx.timer=function(a){a()&&
-c.timers.push(a)&&!la&&(la=setInterval(c.fx.tick,c.fx.interval))};c.fx.interval=13;c.fx.stop=function(){clearInterval(la);la=null};c.fx.speeds={slow:600,fast:200,_default:400};c.fx.step={};c.expr&&c.expr.filters&&(c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length});var yb=/^(?:body|html)$/i;c.fn.offset=function(a){if(arguments.length)return a===n?this:this.each(function(b){c.offset.setOffset(this,a,b)});var b,d,e,f,g,h={top:0,left:0};if(e=(f=this[0])&&
-f.ownerDocument){if((d=e.body)===f)return c.offset.bodyOffset(f);b=e.documentElement;if(!c.contains(b,f))return h;"undefined"!==typeof f.getBoundingClientRect&&(h=f.getBoundingClientRect());e=Ua(e);f=b.clientTop||d.clientTop||0;d=b.clientLeft||d.clientLeft||0;g=e.pageYOffset||b.scrollTop;b=e.pageXOffset||b.scrollLeft;return{top:h.top+g-f,left:h.left+b-d}}};c.offset={bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(c.css(a,"marginTop"))||
-0,d+=parseFloat(c.css(a,"marginLeft"))||0);return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");"static"===e&&(a.style.position="relative");var f=c(a),g=f.offset(),h=c.css(a,"top"),k=c.css(a,"left"),l={},m={};("absolute"===e||"fixed"===e)&&-1<c.inArray("auto",[h,k])?(m=f.position(),e=m.top,k=m.left):(e=parseFloat(h)||0,k=parseFloat(k)||0);c.isFunction(b)&&(b=b.call(a,d,g));null!=b.top&&(l.top=b.top-g.top+e);null!=b.left&&(l.left=b.left-g.left+k);"using"in b?b.using.call(a,l):
-f.css(l)}};c.fn.extend({position:function(){if(this[0]){var a=this[0],b=this.offsetParent(),d=this.offset(),e=yb.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||q.body;a&&!yb.test(a.nodeName)&&
-"static"===c.css(a,"position");)a=a.offsetParent;return a||q.body})}});c.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var d=/Y/.test(b);c.fn[a]=function(e){return c.access(this,function(a,e,h){var k=Ua(a);if(h===n)return k?b in k?k[b]:k.document.documentElement[e]:a[e];k?k.scrollTo(d?c(k).scrollLeft():h,d?h:c(k).scrollTop()):a[e]=h},a,e,arguments.length,null)}});c.each({Height:"height",Width:"width"},function(a,b){c.each({padding:"inner"+a,content:b,"":"outer"+a},function(d,
-e){c.fn[e]=function(e,g){var h=arguments.length&&(d||"boolean"!==typeof e),k=d||(!0===e||!0===g?"margin":"border");return c.access(this,function(b,d,e){return c.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(d=b.documentElement,Math.max(b.body["scroll"+a],d["scroll"+a],b.body["offset"+a],d["offset"+a],d["client"+a])):e===n?c.css(b,d,e,k):c.style(b,d,e,k)},b,h?e:n,h,null)}})});r.jQuery=r.$=c;"function"===typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return c})})(window);
diff --git a/sitestatic/jquery.tablesorter-2.7.js b/sitestatic/jquery.tablesorter-2.7.js
deleted file mode 100644
index f8c443ab..00000000
--- a/sitestatic/jquery.tablesorter-2.7.js
+++ /dev/null
@@ -1,1374 +0,0 @@
-/*!
-* TableSorter 2.7 - Client-side table sorting with ease!
-* @requires jQuery v1.2.6+
-*
-* Copyright (c) 2007 Christian Bach
-* Examples and docs at: http://tablesorter.com
-* Dual licensed under the MIT and GPL licenses:
-* http://www.opensource.org/licenses/mit-license.php
-* http://www.gnu.org/licenses/gpl.html
-*
-* @type jQuery
-* @name tablesorter
-* @cat Plugins/Tablesorter
-* @author Christian Bach/christian.bach@polyester.se
-* @contributor Rob Garrison/https://github.com/Mottie/tablesorter
-*/
-/*jshint browser:true, jquery:true, unused:false, expr: true */
-/*global console:false, alert:false */
-!(function($) {
- "use strict";
- $.extend({
- /*jshint supernew:true */
- tablesorter: new function() {
-
- var ts = this;
-
- ts.version = "2.7";
-
- ts.parsers = [];
- ts.widgets = [];
- ts.defaults = {
-
- // *** appearance
- theme : 'default', // adds tablesorter-{theme} to the table for styling
- widthFixed : false, // adds colgroup to fix widths of columns
- showProcessing : false, // show an indeterminate timer icon in the header when the table is sorted or filtered.
-
- headerTemplate : '{content}',// header layout template (HTML ok); {content} = innerHTML, {icon} = <i/> (class from cssIcon)
- onRenderTemplate : null, // function(index, template){ return template; }, (template is a string)
- onRenderHeader : null, // function(index){}, (nothing to return)
-
- // *** functionality
- cancelSelection : true, // prevent text selection in the header
- dateFormat : 'mmddyyyy', // other options: "ddmmyyy" or "yyyymmdd"
- sortMultiSortKey : 'shiftKey', // key used to select additional columns
- sortResetKey : 'ctrlKey', // key used to remove sorting on a column
- usNumberFormat : true, // false for German "1.234.567,89" or French "1 234 567,89"
- delayInit : false, // if false, the parsed table contents will not update until the first sort
- serverSideSorting: false, // if true, server-side sorting should be performed because client-side sorting will be disabled, but the ui and events will still be used.
-
- // *** sort options
- headers : {}, // set sorter, string, empty, locked order, sortInitialOrder, filter, etc.
- ignoreCase : true, // ignore case while sorting
- sortForce : null, // column(s) first sorted; always applied
- sortList : [], // Initial sort order; applied initially; updated when manually sorted
- sortAppend : null, // column(s) sorted last; always applied
-
- sortInitialOrder : 'asc', // sort direction on first click
- sortLocaleCompare: false, // replace equivalent character (accented characters)
- sortReset : false, // third click on the header will reset column to default - unsorted
- sortRestart : false, // restart sort to "sortInitialOrder" when clicking on previously unsorted columns
-
- emptyTo : 'bottom', // sort empty cell to bottom, top, none, zero
- stringTo : 'max', // sort strings in numerical column as max, min, top, bottom, zero
- textExtraction : 'simple', // text extraction method/function - function(node, table, cellIndex){}
- textSorter : null, // use custom text sorter - function(a,b){ return a.sort(b); } // basic sort
-
- // *** widget options
- widgets: [], // method to add widgets, e.g. widgets: ['zebra']
- widgetOptions : {
- zebra : [ 'even', 'odd' ] // zebra widget alternating row class names
- },
- initWidgets : true, // apply widgets on tablesorter initialization
-
- // *** callbacks
- initialized : null, // function(table){},
-
- // *** css class names
- tableClass : 'tablesorter',
- cssAsc : 'tablesorter-headerAsc',
- cssChildRow : 'tablesorter-childRow', // previously "expand-child"
- cssDesc : 'tablesorter-headerDesc',
- cssHeader : 'tablesorter-header',
- cssHeaderRow : 'tablesorter-headerRow',
- cssIcon : 'tablesorter-icon', // if this class exists, a <i> will be added to the header automatically
- cssInfoBlock : 'tablesorter-infoOnly', // don't sort tbody with this class name
- cssProcessing : 'tablesorter-processing', // processing icon applied to header during sort/filter
-
- // *** selectors
- selectorHeaders : '> thead th, > thead td',
- selectorSort : 'th, td', // jQuery selector of content within selectorHeaders that is clickable to trigger a sort
- selectorRemove : '.remove-me',
-
- // *** advanced
- debug : false,
-
- // *** Internal variables
- headerList: [],
- empties: {},
- strings: {},
- parsers: []
-
- // deprecated; but retained for backwards compatibility
- // widgetZebra: { css: ["even", "odd"] }
-
- };
-
- /* debuging utils */
- function log(s) {
- if (typeof console !== "undefined" && typeof console.log !== "undefined") {
- console.log(s);
- } else {
- alert(s);
- }
- }
-
- function benchmark(s, d) {
- log(s + " (" + (new Date().getTime() - d.getTime()) + "ms)");
- }
-
- ts.benchmark = benchmark;
-
- function getElementText(table, node, cellIndex) {
- if (!node) { return ""; }
- var c = table.config,
- t = c.textExtraction, text = "";
- if (t === "simple") {
- if (c.supportsTextContent) {
- text = node.textContent; // newer browsers support this
- } else {
- text = $(node).text();
- }
- } else {
- if (typeof(t) === "function") {
- text = t(node, table, cellIndex);
- } else if (typeof(t) === "object" && t.hasOwnProperty(cellIndex)) {
- text = t[cellIndex](node, table, cellIndex);
- } else {
- text = c.supportsTextContent ? node.textContent : $(node).text();
- }
- }
- return $.trim(text);
- }
-
- function detectParserForColumn(table, rows, rowIndex, cellIndex) {
- var i, l = ts.parsers.length,
- node = false,
- nodeValue = '',
- keepLooking = true;
- while (nodeValue === '' && keepLooking) {
- rowIndex++;
- if (rows[rowIndex]) {
- node = rows[rowIndex].cells[cellIndex];
- nodeValue = getElementText(table, node, cellIndex);
- if (table.config.debug) {
- log('Checking if value was empty on row ' + rowIndex + ', column: ' + cellIndex + ': ' + nodeValue);
- }
- } else {
- keepLooking = false;
- }
- }
- for (i = 1; i < l; i++) {
- if (ts.parsers[i].is(nodeValue, table, node)) {
- return ts.parsers[i];
- }
- }
- // 0 is always the generic parser (text)
- return ts.parsers[0];
- }
-
- function buildParserCache(table) {
- var c = table.config,
- tb = $(table.tBodies).filter(':not(.' + c.cssInfoBlock + ')'),
- rows, list, l, i, h, ch, p, parsersDebug = "";
- if ( tb.length === 0) {
- return c.debug ? log('*Empty table!* Not building a parser cache') : '';
- }
- rows = tb[0].rows;
- if (rows[0]) {
- list = [];
- l = rows[0].cells.length;
- for (i = 0; i < l; i++) {
- // tons of thanks to AnthonyM1229 for working out the following selector (issue #74) to make this work in IE8!
- // More fixes to this selector to work properly in iOS and jQuery 1.8+ (issue #132 & #174)
- h = c.$headers.filter(':not([colspan])');
- h = h.add( c.$headers.filter('[colspan="1"]') ) // ie8 fix
- .filter('[data-column="' + i + '"]:last');
- ch = c.headers[i];
- // get column parser
- p = ts.getParserById( ts.getData(h, ch, 'sorter') );
- // empty cells behaviour - keeping emptyToBottom for backwards compatibility
- c.empties[i] = ts.getData(h, ch, 'empty') || c.emptyTo || (c.emptyToBottom ? 'bottom' : 'top' );
- // text strings behaviour in numerical sorts
- c.strings[i] = ts.getData(h, ch, 'string') || c.stringTo || 'max';
- if (!p) {
- p = detectParserForColumn(table, rows, -1, i);
- }
- if (c.debug) {
- parsersDebug += "column:" + i + "; parser:" + p.id + "; string:" + c.strings[i] + '; empty: ' + c.empties[i] + "\n";
- }
- list.push(p);
- }
- }
- if (c.debug) {
- log(parsersDebug);
- }
- return list;
- }
-
- /* utils */
- function buildCache(table) {
- var b = table.tBodies,
- tc = table.config,
- totalRows,
- totalCells,
- parsers = tc.parsers,
- t, v, i, j, k, c, cols, cacheTime, colMax = [];
- tc.cache = {};
- // if no parsers found, return - it's an empty table.
- if (!parsers) {
- return tc.debug ? log('*Empty table!* Not building a cache') : '';
- }
- if (tc.debug) {
- cacheTime = new Date();
- }
- // processing icon
- if (tc.showProcessing) {
- ts.isProcessing(table, true);
- }
- for (k = 0; k < b.length; k++) {
- tc.cache[k] = { row: [], normalized: [] };
- // ignore tbodies with class name from css.cssInfoBlock
- if (!$(b[k]).hasClass(tc.cssInfoBlock)) {
- totalRows = (b[k] && b[k].rows.length) || 0;
- totalCells = (b[k].rows[0] && b[k].rows[0].cells.length) || 0;
- for (i = 0; i < totalRows; ++i) {
- /** Add the table data to main data array */
- c = $(b[k].rows[i]);
- cols = [];
- // if this is a child row, add it to the last row's children and continue to the next row
- if (c.hasClass(tc.cssChildRow)) {
- tc.cache[k].row[tc.cache[k].row.length - 1] = tc.cache[k].row[tc.cache[k].row.length - 1].add(c);
- // go to the next for loop
- continue;
- }
- tc.cache[k].row.push(c);
- for (j = 0; j < totalCells; ++j) {
- t = getElementText(table, c[0].cells[j], j);
- // allow parsing if the string is empty, previously parsing would change it to zero,
- // in case the parser needs to extract data from the table cell attributes
- v = parsers[j].format(t, table, c[0].cells[j], j);
- cols.push(v);
- if ((parsers[j].type || '').toLowerCase() === "numeric") {
- colMax[j] = Math.max(Math.abs(v), colMax[j] || 0); // determine column max value (ignore sign)
- }
- }
- cols.push(tc.cache[k].normalized.length); // add position for rowCache
- tc.cache[k].normalized.push(cols);
- }
- tc.cache[k].colMax = colMax;
- }
- }
- if (tc.showProcessing) {
- ts.isProcessing(table); // remove processing icon
- }
- if (tc.debug) {
- benchmark("Building cache for " + totalRows + " rows", cacheTime);
- }
- }
-
- // init flag (true) used by pager plugin to prevent widget application
- function appendToTable(table, init) {
- var c = table.config,
- b = table.tBodies,
- rows = [],
- c2 = c.cache,
- r, n, totalRows, checkCell, $bk, $tb,
- i, j, k, l, pos, appendTime;
- if (!c2[0]) { return; } // empty table - fixes #206
- if (c.debug) {
- appendTime = new Date();
- }
- for (k = 0; k < b.length; k++) {
- $bk = $(b[k]);
- if (!$bk.hasClass(c.cssInfoBlock)) {
- // get tbody
- $tb = ts.processTbody(table, $bk, true);
- r = c2[k].row;
- n = c2[k].normalized;
- totalRows = n.length;
- checkCell = totalRows ? (n[0].length - 1) : 0;
- for (i = 0; i < totalRows; i++) {
- pos = n[i][checkCell];
- rows.push(r[pos]);
- // removeRows used by the pager plugin
- if (!c.appender || !c.removeRows) {
- l = r[pos].length;
- for (j = 0; j < l; j++) {
- $tb.append(r[pos][j]);
- }
- }
- }
- // restore tbody
- ts.processTbody(table, $tb, false);
- }
- }
- if (c.appender) {
- c.appender(table, rows);
- }
- if (c.debug) {
- benchmark("Rebuilt table", appendTime);
- }
- // apply table widgets
- if (!init) { ts.applyWidget(table); }
- // trigger sortend
- $(table).trigger("sortEnd", table);
- }
-
- // computeTableHeaderCellIndexes from:
- // http://www.javascripttoolbox.com/lib/table/examples.php
- // http://www.javascripttoolbox.com/temp/table_cellindex.html
- function computeThIndexes(t) {
- var matrix = [],
- lookup = {},
- trs = $(t).find('thead:eq(0), tfoot').children('tr'), // children tr in tfoot - see issue #196
- i, j, k, l, c, cells, rowIndex, cellId, rowSpan, colSpan, firstAvailCol, matrixrow;
- for (i = 0; i < trs.length; i++) {
- cells = trs[i].cells;
- for (j = 0; j < cells.length; j++) {
- c = cells[j];
- rowIndex = c.parentNode.rowIndex;
- cellId = rowIndex + "-" + c.cellIndex;
- rowSpan = c.rowSpan || 1;
- colSpan = c.colSpan || 1;
- if (typeof(matrix[rowIndex]) === "undefined") {
- matrix[rowIndex] = [];
- }
- // Find first available column in the first row
- for (k = 0; k < matrix[rowIndex].length + 1; k++) {
- if (typeof(matrix[rowIndex][k]) === "undefined") {
- firstAvailCol = k;
- break;
- }
- }
- lookup[cellId] = firstAvailCol;
- // add data-column
- $(c).attr({ 'data-column' : firstAvailCol }); // 'data-row' : rowIndex
- for (k = rowIndex; k < rowIndex + rowSpan; k++) {
- if (typeof(matrix[k]) === "undefined") {
- matrix[k] = [];
- }
- matrixrow = matrix[k];
- for (l = firstAvailCol; l < firstAvailCol + colSpan; l++) {
- matrixrow[l] = "x";
- }
- }
- }
- }
- return lookup;
- }
-
- function formatSortingOrder(v) {
- // look for "d" in "desc" order; return true
- return (/^d/i.test(v) || v === 1);
- }
-
- function buildHeaders(table) {
- var header_index = computeThIndexes(table), ch, $t,
- h, i, t, lock, time, $tableHeaders, c = table.config;
- c.headerList = [], c.headerContent = [];
- if (c.debug) {
- time = new Date();
- }
- i = c.cssIcon ? '<i class="' + c.cssIcon + '"></i>' : ''; // add icon if cssIcon option exists
- $tableHeaders = $(table).find(c.selectorHeaders).each(function(index) {
- $t = $(this);
- ch = c.headers[index];
- c.headerContent[index] = this.innerHTML; // save original header content
- // set up header template
- t = c.headerTemplate.replace(/\{content\}/g, this.innerHTML).replace(/\{icon\}/g, i);
- if (c.onRenderTemplate) {
- h = c.onRenderTemplate.apply($t, [index, t]);
- if (h && typeof h === 'string') { t = h; } // only change t if something is returned
- }
- this.innerHTML = '<div class="tablesorter-header-inner">' + t + '</div>'; // faster than wrapInner
-
- if (c.onRenderHeader) { c.onRenderHeader.apply($t, [index]); }
-
- this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
- this.order = formatSortingOrder( ts.getData($t, ch, 'sortInitialOrder') || c.sortInitialOrder ) ? [1,0,2] : [0,1,2];
- this.count = -1; // set to -1 because clicking on the header automatically adds one
- if (ts.getData($t, ch, 'sorter') === 'false') {
- this.sortDisabled = true;
- $t.addClass('sorter-false');
- } else {
- $t.removeClass('sorter-false');
- }
- this.lockedOrder = false;
- lock = ts.getData($t, ch, 'lockedOrder') || false;
- if (typeof(lock) !== 'undefined' && lock !== false) {
- this.order = this.lockedOrder = formatSortingOrder(lock) ? [1,1,1] : [0,0,0];
- }
- $t.addClass( (this.sortDisabled ? 'sorter-false ' : ' ') + c.cssHeader );
- // add cell to headerList
- c.headerList[index] = this;
- // add to parent in case there are multiple rows
- $t.parent().addClass(c.cssHeaderRow);
- });
- if (table.config.debug) {
- benchmark("Built headers:", time);
- log($tableHeaders);
- }
- return $tableHeaders;
- }
-
- function setHeadersCss(table) {
- var f, i, j, l,
- c = table.config,
- list = c.sortList,
- css = [c.cssAsc, c.cssDesc],
- // find the footer
- $t = $(table).find('tfoot tr').children().removeClass(css.join(' '));
- // remove all header information
- c.$headers.removeClass(css.join(' '));
- l = list.length;
- for (i = 0; i < l; i++) {
- // direction = 2 means reset!
- if (list[i][1] !== 2) {
- // multicolumn sorting updating - choose the :last in case there are nested columns
- f = c.$headers.not('.sorter-false').filter('[data-column="' + list[i][0] + '"]' + (l === 1 ? ':last' : '') );
- if (f.length) {
- for (j = 0; j < f.length; j++) {
- if (!f[j].sortDisabled) {
- f.eq(j).addClass(css[list[i][1]]);
- // add sorted class to footer, if it exists
- if ($t.length) {
- $t.filter('[data-column="' + list[i][0] + '"]').eq(j).addClass(css[list[i][1]]);
- }
- }
- }
- }
- }
- }
- }
-
- function fixColumnWidth(table) {
- if (table.config.widthFixed && $(table).find('colgroup').length === 0) {
- var colgroup = $('<colgroup>'),
- overallWidth = $(table).width();
- $("tr:first td", table.tBodies[0]).each(function() {
- colgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%'));
- });
- $(table).prepend(colgroup);
- }
- }
-
- function updateHeaderSortCount(table, list) {
- var s, t, o, c = table.config,
- sl = list || c.sortList;
- c.sortList = [];
- $.each(sl, function(i,v){
- // ensure all sortList values are numeric - fixes #127
- s = [ parseInt(v[0], 10), parseInt(v[1], 10) ];
- // make sure header exists
- o = c.headerList[s[0]];
- if (o) { // prevents error if sorton array is wrong
- c.sortList.push(s);
- t = $.inArray(s[1], o.order); // fixes issue #167
- o.count = t >= 0 ? t : s[1] % (c.sortReset ? 3 : 2);
- }
- });
- }
-
- function getCachedSortType(parsers, i) {
- return (parsers && parsers[i]) ? parsers[i].type || '' : '';
- }
-
- // sort multiple columns
- function multisort(table) { /*jshint loopfunc:true */
- var dynamicExp, sortWrapper, col, mx = 0, dir = 0, tc = table.config,
- sortList = tc.sortList, l = sortList.length, bl = table.tBodies.length,
- sortTime, i, j, k, c, colMax, cache, lc, s, e, order, orgOrderCol;
- if (tc.serverSideSorting || !tc.cache[0]) { // empty table - fixes #206
- return;
- }
- if (tc.debug) { sortTime = new Date(); }
- for (k = 0; k < bl; k++) {
- colMax = tc.cache[k].colMax;
- cache = tc.cache[k].normalized;
- lc = cache.length;
- orgOrderCol = (cache && cache[0]) ? cache[0].length - 1 : 0;
- cache.sort(function(a, b) {
- // cache is undefined here in IE, so don't use it!
- for (i = 0; i < l; i++) {
- c = sortList[i][0];
- order = sortList[i][1];
- // fallback to natural sort since it is more robust
- s = /n/i.test(getCachedSortType(tc.parsers, c)) ? "Numeric" : "Text";
- s += order === 0 ? "" : "Desc";
- if (/Numeric/.test(s) && tc.strings[c]) {
- // sort strings in numerical columns
- if (typeof (tc.string[tc.strings[c]]) === 'boolean') {
- dir = (order === 0 ? 1 : -1) * (tc.string[tc.strings[c]] ? -1 : 1);
- } else {
- dir = (tc.strings[c]) ? tc.string[tc.strings[c]] || 0 : 0;
- }
- }
- var sort = $.tablesorter["sort" + s](table, a[c], b[c], c, colMax[c], dir);
- if (sort) { return sort; }
- }
- return a[orgOrderCol] - b[orgOrderCol];
- });
- }
- if (tc.debug) { benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time", sortTime); }
- }
-
- function resortComplete($table, callback){
- $table.trigger('updateComplete');
- if (typeof callback === "function") {
- callback($table[0]);
- }
- }
-
- function checkResort($table, flag, callback) {
- if (flag !== false) {
- $table.trigger("sorton", [$table[0].config.sortList, function(){
- resortComplete($table, callback);
- }]);
- } else {
- resortComplete($table, callback);
- }
- }
-
- /* public methods */
- ts.construct = function(settings) {
- return this.each(function() {
- // if no thead or tbody, or tablesorter is already present, quit
- if (!this.tHead || this.tBodies.length === 0 || this.hasInitialized === true) {
- return (this.config.debug) ? log('stopping initialization! No thead, tbody or tablesorter has already been initialized') : '';
- }
- // declare
- var $cell, $this = $(this),
- c, i, j, k = '', a, s, o, downTime,
- m = $.metadata;
- // initialization flag
- this.hasInitialized = false;
- // new blank config object
- this.config = {};
- // merge and extend
- c = $.extend(true, this.config, ts.defaults, settings);
- // save the settings where they read
- $.data(this, "tablesorter", c);
- if (c.debug) { $.data( this, 'startoveralltimer', new Date()); }
- // constants
- c.supportsTextContent = $('<span>x</span>')[0].textContent === 'x';
- c.supportsDataObject = parseFloat($.fn.jquery) >= 1.4;
- // digit sort text location; keeping max+/- for backwards compatibility
- c.string = { 'max': 1, 'min': -1, 'max+': 1, 'max-': -1, 'zero': 0, 'none': 0, 'null': 0, 'top': true, 'bottom': false };
- // add table theme class only if there isn't already one there
- if (!/tablesorter\-/.test($this.attr('class'))) {
- k = (c.theme !== '' ? ' tablesorter-' + c.theme : '');
- }
- $this.addClass(c.tableClass + k);
- // build headers
- c.$headers = buildHeaders(this);
- // try to auto detect column type, and store in tables config
- c.parsers = buildParserCache(this);
- // build the cache for the tbody cells
- // delayInit will delay building the cache until the user starts a sort
- if (!c.delayInit) { buildCache(this); }
- // apply event handling to headers
- // this is to big, perhaps break it out?
- c.$headers
- // http://stackoverflow.com/questions/5312849/jquery-find-self
- .find('*').andSelf().filter(c.selectorSort)
- .unbind('mousedown.tablesorter mouseup.tablesorter')
- .bind('mousedown.tablesorter mouseup.tablesorter', function(e, external) {
- // jQuery v1.2.6 doesn't have closest()
- var $cell = this.tagName.match('TH|TD') ? $(this) : $(this).parents('th, td').filter(':last'), cell = $cell[0];
- // only recognize left clicks
- if ((e.which || e.button) !== 1) { return false; }
- // set timer on mousedown
- if (e.type === 'mousedown') {
- downTime = new Date().getTime();
- return e.target.tagName === "INPUT" ? '' : !c.cancelSelection;
- }
- // ignore long clicks (prevents resizable widget from initializing a sort)
- if (external !== true && (new Date().getTime() - downTime > 250)) { return false; }
- if (c.delayInit && !c.cache) { buildCache($this[0]); }
- if (!cell.sortDisabled) {
- // Only call sortStart if sorting is enabled
- $this.trigger("sortStart", $this[0]);
- // store exp, for speed
- // $cell = $(this);
- k = !e[c.sortMultiSortKey];
- // get current column sort order
- cell.count = e[c.sortResetKey] ? 2 : (cell.count + 1) % (c.sortReset ? 3 : 2);
- // reset all sorts on non-current column - issue #30
- if (c.sortRestart) {
- i = cell;
- c.$headers.each(function() {
- // only reset counts on columns that weren't just clicked on and if not included in a multisort
- if (this !== i && (k || !$(this).is('.' + c.cssDesc + ',.' + c.cssAsc))) {
- this.count = -1;
- }
- });
- }
- // get current column index
- i = cell.column;
- // user only wants to sort on one column
- if (k) {
- // flush the sort list
- c.sortList = [];
- if (c.sortForce !== null) {
- a = c.sortForce;
- for (j = 0; j < a.length; j++) {
- if (a[j][0] !== i) {
- c.sortList.push(a[j]);
- }
- }
- }
- // add column to sort list
- o = cell.order[cell.count];
- if (o < 2) {
- c.sortList.push([i, o]);
- // add other columns if header spans across multiple
- if (cell.colSpan > 1) {
- for (j = 1; j < cell.colSpan; j++) {
- c.sortList.push([i + j, o]);
- }
- }
- }
- // multi column sorting
- } else {
- // get rid of the sortAppend before adding more - fixes issue #115
- if (c.sortAppend && c.sortList.length > 1) {
- if (ts.isValueInArray(c.sortAppend[0][0], c.sortList)) {
- c.sortList.pop();
- }
- }
- // the user has clicked on an already sorted column
- if (ts.isValueInArray(i, c.sortList)) {
- // reverse the sorting direction for all tables
- for (j = 0; j < c.sortList.length; j++) {
- s = c.sortList[j];
- o = c.headerList[s[0]];
- if (s[0] === i) {
- s[1] = o.order[o.count];
- if (s[1] === 2) {
- c.sortList.splice(j,1);
- o.count = -1;
- }
- }
- }
- } else {
- // add column to sort list array
- o = cell.order[cell.count];
- if (o < 2) {
- c.sortList.push([i, o]);
- // add other columns if header spans across multiple
- if (cell.colSpan > 1) {
- for (j = 1; j < cell.colSpan; j++) {
- c.sortList.push([i + j, o]);
- }
- }
- }
- }
- }
- if (c.sortAppend !== null) {
- a = c.sortAppend;
- for (j = 0; j < a.length; j++) {
- if (a[j][0] !== i) {
- c.sortList.push(a[j]);
- }
- }
- }
- // sortBegin event triggered immediately before the sort
- $this.trigger("sortBegin", $this[0]);
- // setTimeout needed so the processing icon shows up
- setTimeout(function(){
- // set css for headers
- setHeadersCss($this[0]);
- multisort($this[0]);
- appendToTable($this[0]);
- }, 1);
- }
- });
- if (c.cancelSelection) {
- // cancel selection
- c.$headers.each(function() {
- this.onselectstart = function() {
- return false;
- };
- });
- }
- // apply easy methods that trigger binded events
- $this
- .unbind('sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave')
- .bind("sortReset", function(){
- c.sortList = [];
- setHeadersCss(this);
- multisort(this);
- appendToTable(this);
- })
- .bind("update", function(e, resort, callback) {
- // remove rows/elements before update
- $(c.selectorRemove, this).remove();
- // rebuild parsers
- c.parsers = buildParserCache(this);
- // rebuild the cache map
- buildCache(this);
- checkResort($this, resort, callback);
- })
- .bind("updateCell", function(e, cell, resort, callback) {
- // get position from the dom
- var l, row, icell,
- t = this, $tb = $(this).find('tbody'),
- // update cache - format: function(s, table, cell, cellIndex)
- // no closest in jQuery v1.2.6 - tbdy = $tb.index( $(cell).closest('tbody') ),$row = $(cell).closest('tr');
- tbdy = $tb.index( $(cell).parents('tbody').filter(':last') ),
- $row = $(cell).parents('tr').filter(':last');
- cell = $(cell)[0]; // in case cell is a jQuery object
- // tbody may not exist if update is initialized while tbody is removed for processing
- if ($tb.length && tbdy >= 0) {
- row = $tb.eq(tbdy).find('tr').index( $row );
- icell = cell.cellIndex;
- l = t.config.cache[tbdy].normalized[row].length - 1;
- t.config.cache[tbdy].row[t.config.cache[tbdy].normalized[row][l]] = $row;
- t.config.cache[tbdy].normalized[row][icell] = c.parsers[icell].format( getElementText(t, cell, icell), t, cell, icell );
- checkResort($this, resort, callback);
- }
- })
- .bind("addRows", function(e, $row, resort, callback) {
- var i, rows = $row.filter('tr').length,
- dat = [], l = $row[0].cells.length, t = this,
- tbdy = $(this).find('tbody').index( $row.closest('tbody') );
- // fixes adding rows to an empty table - see issue #179
- if (!c.parsers) {
- c.parsers = buildParserCache(t);
- }
- // add each row
- for (i = 0; i < rows; i++) {
- // add each cell
- for (j = 0; j < l; j++) {
- dat[j] = c.parsers[j].format( getElementText(t, $row[i].cells[j], j), t, $row[i].cells[j], j );
- }
- // add the row index to the end
- dat.push(c.cache[tbdy].row.length);
- // update cache
- c.cache[tbdy].row.push([$row[i]]);
- c.cache[tbdy].normalized.push(dat);
- dat = [];
- }
- // resort using current settings
- checkResort($this, resort, callback);
- })
- .bind("sorton", function(e, list, callback, init) {
- $(this).trigger("sortStart", this);
- // update header count index
- updateHeaderSortCount(this, list);
- // set css for headers
- setHeadersCss(this);
- // sort the table and append it to the dom
- multisort(this);
- appendToTable(this, init);
- if (typeof callback === "function") {
- callback(this);
- }
- })
- .bind("appendCache", function(e, callback, init) {
- appendToTable(this, init);
- if (typeof callback === "function") {
- callback(this);
- }
- })
- .bind("applyWidgetId", function(e, id) {
- ts.getWidgetById(id).format(this, c, c.widgetOptions);
- })
- .bind("applyWidgets", function(e, init) {
- // apply widgets
- ts.applyWidget(this, init);
- })
- .bind("refreshWidgets", function(e, all, dontapply){
- ts.refreshWidgets(this, all, dontapply);
- })
- .bind("destroy", function(e, c, cb){
- ts.destroy(this, c, cb);
- });
-
- // get sort list from jQuery data or metadata
- // in jQuery < 1.4, an error occurs when calling $this.data()
- if (c.supportsDataObject && typeof $this.data().sortlist !== 'undefined') {
- c.sortList = $this.data().sortlist;
- } else if (m && ($this.metadata() && $this.metadata().sortlist)) {
- c.sortList = $this.metadata().sortlist;
- }
- // apply widget init code
- ts.applyWidget(this, true);
- // if user has supplied a sort list to constructor
- if (c.sortList.length > 0) {
- $this.trigger("sorton", [c.sortList, {}, !c.initWidgets]);
- } else if (c.initWidgets) {
- // apply widget format
- ts.applyWidget(this);
- }
-
- // fixate columns if the users supplies the fixedWidth option
- // do this after theme has been applied
- fixColumnWidth(this);
-
- // show processesing icon
- if (c.showProcessing) {
- $this
- .unbind('sortBegin sortEnd')
- .bind('sortBegin sortEnd', function(e) {
- ts.isProcessing($this[0], e.type === 'sortBegin');
- });
- }
-
- // initialized
- this.hasInitialized = true;
- if (c.debug) {
- ts.benchmark("Overall initialization time", $.data( this, 'startoveralltimer'));
- }
- $this.trigger('tablesorter-initialized', this);
- if (typeof c.initialized === 'function') { c.initialized(this); }
- });
- };
-
- // *** Process table ***
- // add processing indicator
- ts.isProcessing = function(table, toggle, $ths) {
- var c = table.config,
- // default to all headers
- $h = $ths || $(table).find('.' + c.cssHeader);
- if (toggle) {
- if (c.sortList.length > 0) {
- // get headers from the sortList
- $h = $h.filter(function(){
- // get data-column from attr to keep compatibility with jQuery 1.2.6
- return this.sortDisabled ? false : ts.isValueInArray( parseFloat($(this).attr('data-column')), c.sortList);
- });
- }
- $h.addClass(c.cssProcessing);
- } else {
- $h.removeClass(c.cssProcessing);
- }
- };
-
- // detach tbody but save the position
- // don't use tbody because there are portions that look for a tbody index (updateCell)
- ts.processTbody = function(table, $tb, getIt){
- var t, holdr;
- if (getIt) {
- $tb.before('<span class="tablesorter-savemyplace"/>');
- holdr = ($.fn.detach) ? $tb.detach() : $tb.remove();
- return holdr;
- }
- holdr = $(table).find('span.tablesorter-savemyplace');
- $tb.insertAfter( holdr );
- holdr.remove();
- };
-
- ts.clearTableBody = function(table) {
- $(table.tBodies).filter(':not(.' + table.config.cssInfoBlock + ')').empty();
- };
-
- ts.destroy = function(table, removeClasses, callback){
- var $t = $(table), c = table.config,
- $h = $t.find('thead:first');
- // clear flag in case the plugin is initialized again
- table.hasInitialized = false;
- // remove widget added rows
- $h.find('tr:not(.' + c.cssHeaderRow + ')').remove();
- // remove resizer widget stuff
- $h.find('.tablesorter-resizer').remove();
- // remove all widgets
- ts.refreshWidgets(table, true, true);
- // disable tablesorter
- $t
- .removeData('tablesorter')
- .unbind('sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave')
- .find('.' + c.cssHeader)
- .unbind('click mousedown mousemove mouseup')
- .removeClass(c.cssHeader + ' ' + c.cssAsc + ' ' + c.cssDesc)
- .find('.tablesorter-header-inner').each(function(){
- if (c.cssIcon !== '') { $(this).find('.' + c.cssIcon).remove(); }
- $(this).replaceWith( $(this).contents() );
- });
- if (removeClasses !== false) {
- $t.removeClass(c.tableClass);
- }
- if (typeof callback === 'function') {
- callback(table);
- }
- };
-
- // *** sort functions ***
- // regex used in natural sort
- ts.regex = [
- /(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi, // chunk/tokenize numbers & letters
- /(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, //date
- /^0x[0-9a-f]+$/i // hex
- ];
-
- // Natural sort - https://github.com/overset/javascript-natural-sort
- ts.sortText = function(table, a, b, col) {
- if (a === b) { return 0; }
- var c = table.config, e = c.string[ (c.empties[col] || c.emptyTo ) ],
- r = ts.regex, xN, xD, yN, yD, xF, yF, i, mx;
- if (a === '' && e !== 0) { return (typeof(e) === 'boolean') ? (e ? -1 : 1) : -e || -1; }
- if (b === '' && e !== 0) { return (typeof(e) === 'boolean') ? (e ? 1 : -1) : e || 1; }
- if (typeof c.textSorter === 'function') { return c.textSorter(a, b, table, col); }
- // chunk/tokenize
- xN = a.replace(r[0], '\\0$1\\0').replace(/\\0$/, '').replace(/^\\0/, '').split('\\0');
- yN = b.replace(r[0], '\\0$1\\0').replace(/\\0$/, '').replace(/^\\0/, '').split('\\0');
- // numeric, hex or date detection
- xD = parseInt(a.match(r[2]),16) || (xN.length !== 1 && a.match(r[1]) && Date.parse(a));
- yD = parseInt(b.match(r[2]),16) || (xD && b.match(r[1]) && Date.parse(b)) || null;
- // first try and sort Hex codes or Dates
- if (yD) {
- if ( xD < yD ) { return -1; }
- if ( xD > yD ) { return 1; }
- }
- mx = Math.max(xN.length, yN.length);
- // natural sorting through split numeric strings and default strings
- for (i = 0; i < mx; i++) {
- // find floats not starting with '0', string or 0 if not defined
- xF = isNaN(xN[i]) ? xN[i] || 0 : parseFloat(xN[i]) || 0;
- yF = isNaN(yN[i]) ? yN[i] || 0 : parseFloat(yN[i]) || 0;
- // handle numeric vs string comparison - number < string - (Kyle Adams)
- if (isNaN(xF) !== isNaN(yF)) { return (isNaN(xF)) ? 1 : -1; }
- // rely on string comparison if different types - i.e. '02' < 2 != '02' < '2'
- if (typeof xF !== typeof yF) {
- xF += '';
- yF += '';
- }
- if (xF < yF) { return -1; }
- if (xF > yF) { return 1; }
- }
- return 0;
- };
-
- ts.sortTextDesc = function(table, a, b, col) {
- if (a === b) { return 0; }
- var c = table.config, e = c.string[ (c.empties[col] || c.emptyTo ) ];
- if (a === '' && e !== 0) { return (typeof(e) === 'boolean') ? (e ? -1 : 1) : e || 1; }
- if (b === '' && e !== 0) { return (typeof(e) === 'boolean') ? (e ? 1 : -1) : -e || -1; }
- if (typeof c.textSorter === 'function') { return c.textSorter(b, a, table, col); }
- return ts.sortText(table, b, a);
- };
-
- // return text string value by adding up ascii value
- // so the text is somewhat sorted when using a digital sort
- // this is NOT an alphanumeric sort
- ts.getTextValue = function(a, mx, d) {
- if (mx) {
- // make sure the text value is greater than the max numerical value (mx)
- var i, l = a.length, n = mx + d;
- for (i = 0; i < l; i++) {
- n += a.charCodeAt(i);
- }
- return d * n;
- }
- return 0;
- };
-
- ts.sortNumeric = function(table, a, b, col, mx, d) {
- if (a === b) { return 0; }
- var c = table.config, e = c.string[ (c.empties[col] || c.emptyTo ) ];
- if (a === '' && e !== 0) { return (typeof(e) === 'boolean') ? (e ? -1 : 1) : -e || -1; }
- if (b === '' && e !== 0) { return (typeof(e) === 'boolean') ? (e ? 1 : -1) : e || 1; }
- if (isNaN(a)) { a = ts.getTextValue(a, mx, d); }
- if (isNaN(b)) { b = ts.getTextValue(b, mx, d); }
- return a - b;
- };
-
- ts.sortNumericDesc = function(table, a, b, col, mx, d) {
- if (a === b) { return 0; }
- var c = table.config, e = c.string[ (c.empties[col] || c.emptyTo ) ];
- if (a === '' && e !== 0) { return (typeof(e) === 'boolean') ? (e ? -1 : 1) : e || 1; }
- if (b === '' && e !== 0) { return (typeof(e) === 'boolean') ? (e ? 1 : -1) : -e || -1; }
- if (isNaN(a)) { a = ts.getTextValue(a, mx, d); }
- if (isNaN(b)) { b = ts.getTextValue(b, mx, d); }
- return b - a;
- };
-
- // used when replacing accented characters during sorting
- ts.characterEquivalents = {
- "a" : "\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5", // áàâãäąå
- "A" : "\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5", // ÁÀÂÃÄĄÅ
- "c" : "\u00e7\u0107\u010d", // çćč
- "C" : "\u00c7\u0106\u010c", // ÇĆČ
- "e" : "\u00e9\u00e8\u00ea\u00eb\u011b\u0119", // éèêëěę
- "E" : "\u00c9\u00c8\u00ca\u00cb\u011a\u0118", // ÉÈÊËĚĘ
- "i" : "\u00ed\u00ec\u0130\u00ee\u00ef\u0131", // íìİîïı
- "I" : "\u00cd\u00cc\u0130\u00ce\u00cf", // ÍÌİÎÏ
- "o" : "\u00f3\u00f2\u00f4\u00f5\u00f6", // óòôõö
- "O" : "\u00d3\u00d2\u00d4\u00d5\u00d6", // ÓÒÔÕÖ
- "ss": "\u00df", // ß (s sharp)
- "SS": "\u1e9e", // ẞ (Capital sharp s)
- "u" : "\u00fa\u00f9\u00fb\u00fc\u016f", // úùûüů
- "U" : "\u00da\u00d9\u00db\u00dc\u016e" // ÚÙÛÜŮ
- };
- ts.replaceAccents = function(s) {
- var a, acc = '[', eq = ts.characterEquivalents;
- if (!ts.characterRegex) {
- ts.characterRegexArray = {};
- for (a in eq) {
- if (typeof a === 'string') {
- acc += eq[a];
- ts.characterRegexArray[a] = new RegExp('[' + eq[a] + ']', 'g');
- }
- }
- ts.characterRegex = new RegExp(acc + ']');
- }
- if (ts.characterRegex.test(s)) {
- for (a in eq) {
- if (typeof a === 'string') {
- s = s.replace( ts.characterRegexArray[a], a );
- }
- }
- }
- return s;
- };
-
- // *** utilities ***
- ts.isValueInArray = function(v, a) {
- var i, l = a.length;
- for (i = 0; i < l; i++) {
- if (a[i][0] === v) {
- return true;
- }
- }
- return false;
- };
-
- ts.addParser = function(parser) {
- var i, l = ts.parsers.length, a = true;
- for (i = 0; i < l; i++) {
- if (ts.parsers[i].id.toLowerCase() === parser.id.toLowerCase()) {
- a = false;
- }
- }
- if (a) {
- ts.parsers.push(parser);
- }
- };
-
- ts.getParserById = function(name) {
- var i, l = ts.parsers.length;
- for (i = 0; i < l; i++) {
- if (ts.parsers[i].id.toLowerCase() === (name.toString()).toLowerCase()) {
- return ts.parsers[i];
- }
- }
- return false;
- };
-
- ts.addWidget = function(widget) {
- ts.widgets.push(widget);
- };
-
- ts.getWidgetById = function(name) {
- var i, w, l = ts.widgets.length;
- for (i = 0; i < l; i++) {
- w = ts.widgets[i];
- if (w && w.hasOwnProperty('id') && w.id.toLowerCase() === name.toLowerCase()) {
- return w;
- }
- }
- };
-
- ts.applyWidget = function(table, init) {
- var c = table.config,
- wo = c.widgetOptions,
- ws = c.widgets.sort().reverse(), // ensure that widgets are always applied in a certain order
- time, i, w, l = ws.length;
- // make zebra last
- i = $.inArray('zebra', c.widgets);
- if (i >= 0) {
- c.widgets.splice(i,1);
- c.widgets.push('zebra');
- }
- if (c.debug) {
- time = new Date();
- }
- // add selected widgets
- for (i = 0; i < l; i++) {
- w = ts.getWidgetById(ws[i]);
- if ( w ) {
- if (init === true && w.hasOwnProperty('init')) {
- w.init(table, w, c, wo);
- } else if (!init && w.hasOwnProperty('format')) {
- w.format(table, c, wo);
- }
- }
- }
- if (c.debug) {
- benchmark("Completed " + (init === true ? "initializing" : "applying") + " widgets", time);
- }
- };
-
- ts.refreshWidgets = function(table, doAll, dontapply) {
- var i, c = table.config,
- cw = c.widgets,
- w = ts.widgets, l = w.length;
- // remove previous widgets
- for (i = 0; i < l; i++){
- if ( w[i] && w[i].id && (doAll || $.inArray( w[i].id, cw ) < 0) ) {
- if (c.debug) { log( 'Refeshing widgets: Removing ' + w[i].id ); }
- if (w[i].hasOwnProperty('remove')) { w[i].remove(table, c, c.widgetOptions); }
- }
- }
- if (dontapply !== true) {
- ts.applyWidget(table, doAll);
- }
- };
-
- // get sorter, string, empty, etc options for each column from
- // jQuery data, metadata, header option or header class name ("sorter-false")
- // priority = jQuery data > meta > headers option > header class name
- ts.getData = function(h, ch, key) {
- var val = '', $h = $(h), m, cl;
- if (!$h.length) { return ''; }
- m = $.metadata ? $h.metadata() : false;
- cl = ' ' + ($h.attr('class') || '');
- if (typeof $h.data(key) !== 'undefined' || typeof $h.data(key.toLowerCase()) !== 'undefined'){
- // "data-lockedOrder" is assigned to "lockedorder"; but "data-locked-order" is assigned to "lockedOrder"
- // "data-sort-initial-order" is assigned to "sortInitialOrder"
- val += $h.data(key) || $h.data(key.toLowerCase());
- } else if (m && typeof m[key] !== 'undefined') {
- val += m[key];
- } else if (ch && typeof ch[key] !== 'undefined') {
- val += ch[key];
- } else if (cl !== ' ' && cl.match(' ' + key + '-')) {
- // include sorter class name "sorter-text", etc
- val = cl.match( new RegExp(' ' + key + '-(\\w+)') )[1] || '';
- }
- return $.trim(val);
- };
-
- ts.formatFloat = function(s, table) {
- if (typeof(s) !== 'string' || s === '') { return s; }
- // allow using formatFloat without a table; defaults to US number format
- var i,
- t = table && table.config ? table.config.usNumberFormat !== false :
- typeof table !== "undefined" ? table : true;
- if (t) {
- // US Format - 1,234,567.89 -> 1234567.89
- s = s.replace(/,/g,'');
- } else {
- // German Format = 1.234.567,89 -> 1234567.89
- // French Format = 1 234 567,89 -> 1234567.89
- s = s.replace(/[\s|\.]/g,'').replace(/,/g,'.');
- }
- if(/^\s*\([.\d]+\)/.test(s)) {
- // make (#) into a negative number -> (10) = -10
- s = s.replace(/^\s*\(/,'-').replace(/\)/,'');
- }
- i = parseFloat(s);
- // return the text instead of zero
- return isNaN(i) ? $.trim(s) : i;
- };
-
- ts.isDigit = function(s) {
- // replace all unwanted chars and match
- return isNaN(s) ? (/^[\-+(]?\d+[)]?$/).test(s.toString().replace(/[,.'"\s]/g, '')) : true;
- };
-
- }()
- });
-
- // make shortcut
- var ts = $.tablesorter;
-
- // extend plugin scope
- $.fn.extend({
- tablesorter: ts.construct
- });
-
- // add default parsers
- ts.addParser({
- id: "text",
- is: function(s, table, node) {
- return true;
- },
- format: function(s, table, cell, cellIndex) {
- var c = table.config;
- s = $.trim( c.ignoreCase ? s.toLocaleLowerCase() : s );
- return c.sortLocaleCompare ? ts.replaceAccents(s) : s;
- },
- type: "text"
- });
-
- ts.addParser({
- id: "currency",
- is: function(s) {
- return (/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/).test(s); // £$€¤¥¢
- },
- format: function(s, table) {
- return ts.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table);
- },
- type: "numeric"
- });
-
- ts.addParser({
- id: "ipAddress",
- is: function(s) {
- return (/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/).test(s);
- },
- format: function(s, table) {
- var i, a = s.split("."),
- r = "",
- l = a.length;
- for (i = 0; i < l; i++) {
- r += ("00" + a[i]).slice(-3);
- }
- return ts.formatFloat(r, table);
- },
- type: "numeric"
- });
-
- ts.addParser({
- id: "url",
- is: function(s) {
- return (/^(https?|ftp|file):\/\//).test(s);
- },
- format: function(s) {
- return $.trim(s.replace(/(https?|ftp|file):\/\//, ''));
- },
- type: "text"
- });
-
- ts.addParser({
- id: "isoDate",
- is: function(s) {
- return (/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s);
- },
- format: function(s, table) {
- return ts.formatFloat((s !== "") ? (new Date(s.replace(/-/g, "/")).getTime() || "") : "", table);
- },
- type: "numeric"
- });
-
- ts.addParser({
- id: "percent",
- is: function(s) {
- return (/(\d\s?%|%\s?\d)/).test(s);
- },
- format: function(s, table) {
- return ts.formatFloat(s.replace(/%/g, ""), table);
- },
- type: "numeric"
- });
-
- ts.addParser({
- id: "usLongDate",
- is: function(s) {
- // two digit years are not allowed cross-browser
- return (/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i).test(s);
- },
- format: function(s, table) {
- return ts.formatFloat( (new Date(s.replace(/(\S)([AP]M)$/i, "$1 $2")).getTime() || ''), table);
- },
- type: "numeric"
- });
-
- ts.addParser({
- id: "shortDate", // "mmddyyyy", "ddmmyyyy" or "yyyymmdd"
- is: function(s) {
- // testing for ####-##-####, so it's not perfect
- return (/^(\d{1,2}|\d{4})[\/\-\,\.\s+]\d{1,2}[\/\-\.\,\s+](\d{1,2}|\d{4})$/).test(s);
- },
- format: function(s, table, cell, cellIndex) {
- var c = table.config, ci = c.headerList[cellIndex],
- format = ci.shortDateFormat;
- if (typeof format === 'undefined') {
- // cache header formatting so it doesn't getData for every cell in the column
- format = ci.shortDateFormat = ts.getData( ci, c.headers[cellIndex], 'dateFormat') || c.dateFormat;
- }
- s = s.replace(/\s+/g," ").replace(/[\-|\.|\,]/g, "/");
- if (format === "mmddyyyy") {
- s = s.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$3/$1/$2");
- } else if (format === "ddmmyyyy") {
- s = s.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/, "$3/$2/$1");
- } else if (format === "yyyymmdd") {
- s = s.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/, "$1/$2/$3");
- }
- return ts.formatFloat( (new Date(s).getTime() || ''), table);
- },
- type: "numeric"
- });
-
- ts.addParser({
- id: "time",
- is: function(s) {
- return (/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i).test(s);
- },
- format: function(s, table) {
- return ts.formatFloat( (new Date("2000/01/01 " + s.replace(/(\S)([AP]M)$/i, "$1 $2")).getTime() || ""), table);
- },
- type: "numeric"
- });
-
- ts.addParser({
- id: "digit",
- is: function(s) {
- return ts.isDigit(s);
- },
- format: function(s, table) {
- return ts.formatFloat(s.replace(/[^\w,. \-()]/g, ""), table);
- },
- type: "numeric"
- });
-
- ts.addParser({
- id: "metadata",
- is: function(s) {
- return false;
- },
- format: function(s, table, cell) {
- var c = table.config,
- p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;
- return $(cell).metadata()[p];
- },
- type: "numeric"
- });
-
- // add default widgets
- ts.addWidget({
- id: "zebra",
- format: function(table, c, wo) {
- var $tb, $tv, $tr, row, even, time, k, l,
- child = new RegExp(c.cssChildRow, 'i'),
- b = $(table).children('tbody:not(.' + c.cssInfoBlock + ')');
- if (c.debug) {
- time = new Date();
- }
- for (k = 0; k < b.length; k++ ) {
- // loop through the visible rows
- $tb = $(b[k]);
- l = $tb.children('tr').length;
- if (l > 1) {
- row = 0;
- $tv = $tb.children('tr:visible');
- // revered back to using jQuery each - strangely it's the fastest method
- /*jshint loopfunc:true */
- $tv.each(function(){
- $tr = $(this);
- // style children rows the same way the parent row was styled
- if (!child.test(this.className)) { row++; }
- even = (row % 2 === 0);
- $tr.removeClass(wo.zebra[even ? 1 : 0]).addClass(wo.zebra[even ? 0 : 1]);
- });
- }
- }
- if (c.debug) {
- ts.benchmark("Applying Zebra widget", time);
- }
- },
- remove: function(table, c, wo){
- var k, $tb,
- b = $(table).children('tbody:not(.' + c.cssInfoBlock + ')'),
- rmv = (c.widgetOptions.zebra || [ "even", "odd" ]).join(' ');
- for (k = 0; k < b.length; k++ ){
- $tb = $.tablesorter.processTbody(table, $(b[k]), true); // remove tbody
- $tb.children().removeClass(rmv);
- $.tablesorter.processTbody(table, $tb, false); // restore tbody
- }
- }
- });
-
-})(jQuery); \ No newline at end of file
diff --git a/sitestatic/jquery.tablesorter-2.7.min.js b/sitestatic/jquery.tablesorter-2.7.min.js
deleted file mode 100644
index 01956458..00000000
--- a/sitestatic/jquery.tablesorter-2.7.min.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*!
-* TableSorter 2.7 - Client-side table sorting with ease!
-* @requires jQuery v1.2.6+
-*
-* Copyright (c) 2007 Christian Bach
-* Examples and docs at: http://tablesorter.com
-* Dual licensed under the MIT and GPL licenses:
-* http://www.opensource.org/licenses/mit-license.php
-* http://www.gnu.org/licenses/gpl.html
-*
-* @type jQuery
-* @name tablesorter
-* @cat Plugins/Tablesorter
-* @author Christian Bach/christian.bach@polyester.se
-* @contributor Rob Garrison/https://github.com/Mottie/tablesorter
-*/
-!function(l){l.extend({tablesorter:new function(){function e(b){"undefined"!==typeof console&&"undefined"!==typeof console.log?console.log(b):alert(b)}function q(b,c){e(b+" ("+((new Date).getTime()-c.getTime())+"ms)")}function k(b,c,a){if(!c)return"";var d=b.config,g=d.textExtraction,m="",m="simple"===g?d.supportsTextContent?c.textContent:l(c).text():"function"===typeof g?g(c,b,a):"object"===typeof g&&g.hasOwnProperty(a)?g[a](c,b,a):d.supportsTextContent?c.textContent:l(c).text();return l.trim(m)}
-function r(b){var c=b.config,a=l(b.tBodies).filter(":not(."+c.cssInfoBlock+")"),d,g,m,h,w,n,p="";if(0===a.length)return c.debug?e("*Empty table!* Not building a parser cache"):"";a=a[0].rows;if(a[0])for(d=[],g=a[0].cells.length,m=0;m<g;m++){h=c.$headers.filter(":not([colspan])");h=h.add(c.$headers.filter('[colspan="1"]')).filter('[data-column="'+m+'"]:last');w=c.headers[m];n=f.getParserById(f.getData(h,w,"sorter"));c.empties[m]=f.getData(h,w,"empty")||c.emptyTo||(c.emptyToBottom?"bottom":"top");c.strings[m]=
-f.getData(h,w,"string")||c.stringTo||"max";if(!n)a:{h=b;w=a;n=-1;for(var q=m,t=void 0,u=f.parsers.length,v=!1,r="",t=!0;""===r&&t;)n++,w[n]?(v=w[n].cells[q],r=k(h,v,q),h.config.debug&&e("Checking if value was empty on row "+n+", column: "+q+": "+r)):t=!1;for(t=1;t<u;t++)if(f.parsers[t].is(r,h,v)){n=f.parsers[t];break a}n=f.parsers[0]}c.debug&&(p+="column:"+m+"; parser:"+n.id+"; string:"+c.strings[m]+"; empty: "+c.empties[m]+"\n");d.push(n)}c.debug&&e(p);return d}function x(b){var c=b.tBodies,a=b.config,
-d,g,m=a.parsers,h,w,n,p,z,t,u,v=[];a.cache={};if(!m)return a.debug?e("*Empty table!* Not building a cache"):"";a.debug&&(u=new Date);a.showProcessing&&f.isProcessing(b,!0);for(p=0;p<c.length;p++)if(a.cache[p]={row:[],normalized:[]},!l(c[p]).hasClass(a.cssInfoBlock)){d=c[p]&&c[p].rows.length||0;g=c[p].rows[0]&&c[p].rows[0].cells.length||0;for(w=0;w<d;++w)if(z=l(c[p].rows[w]),t=[],z.hasClass(a.cssChildRow))a.cache[p].row[a.cache[p].row.length-1]=a.cache[p].row[a.cache[p].row.length-1].add(z);else{a.cache[p].row.push(z);
-for(n=0;n<g;++n)h=k(b,z[0].cells[n],n),h=m[n].format(h,b,z[0].cells[n],n),t.push(h),"numeric"===(m[n].type||"").toLowerCase()&&(v[n]=Math.max(Math.abs(h),v[n]||0));t.push(a.cache[p].normalized.length);a.cache[p].normalized.push(t)}a.cache[p].colMax=v}a.showProcessing&&f.isProcessing(b);a.debug&&q("Building cache for "+d+" rows",u)}function y(b,c){var a=b.config,d=b.tBodies,g=[],m=a.cache,h,e,n,p,z,t,u,v,k,r,s;if(m[0]){a.debug&&(s=new Date);for(v=0;v<d.length;v++)if(h=l(d[v]),!h.hasClass(a.cssInfoBlock)){z=
-f.processTbody(b,h,!0);h=m[v].row;e=m[v].normalized;p=(n=e.length)?e[0].length-1:0;for(t=0;t<n;t++)if(r=e[t][p],g.push(h[r]),!a.appender||!a.removeRows)for(k=h[r].length,u=0;u<k;u++)z.append(h[r][u]);f.processTbody(b,z,!1)}a.appender&&a.appender(b,g);a.debug&&q("Rebuilt table",s);c||f.applyWidget(b);l(b).trigger("sortEnd",b)}}function A(b){var c=[],a={};b=l(b).find("thead:eq(0), tfoot").children("tr");var d,g,m,h,e,f,p,q,t,u;for(d=0;d<b.length;d++)for(e=b[d].cells,g=0;g<e.length;g++){h=e[g];f=h.parentNode.rowIndex;
-p=f+"-"+h.cellIndex;q=h.rowSpan||1;t=h.colSpan||1;"undefined"===typeof c[f]&&(c[f]=[]);for(m=0;m<c[f].length+1;m++)if("undefined"===typeof c[f][m]){u=m;break}a[p]=u;l(h).attr({"data-column":u});for(m=f;m<f+q;m++)for("undefined"===typeof c[m]&&(c[m]=[]),p=c[m],h=u;h<u+t;h++)p[h]="x"}return a}function B(b){return/^d/i.test(b)||1===b}function D(b){var c=A(b),a,d,g,m,h,w,n,p,k=b.config;k.headerList=[];k.headerContent=[];k.debug&&(n=new Date);m=k.cssIcon?'<i class="'+k.cssIcon+'"></i>':"";p=l(b).find(k.selectorHeaders).each(function(b){d=
-l(this);a=k.headers[b];k.headerContent[b]=this.innerHTML;h=k.headerTemplate.replace(/\{content\}/g,this.innerHTML).replace(/\{icon\}/g,m);k.onRenderTemplate&&(g=k.onRenderTemplate.apply(d,[b,h]))&&"string"===typeof g&&(h=g);this.innerHTML='<div class="tablesorter-header-inner">'+h+"</div>";k.onRenderHeader&&k.onRenderHeader.apply(d,[b]);this.column=c[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=B(f.getData(d,a,"sortInitialOrder")||k.sortInitialOrder)?[1,0,2]:[0,1,2];this.count=-1;"false"===
-f.getData(d,a,"sorter")?(this.sortDisabled=!0,d.addClass("sorter-false")):d.removeClass("sorter-false");this.lockedOrder=!1;w=f.getData(d,a,"lockedOrder")||!1;"undefined"!==typeof w&&!1!==w&&(this.order=this.lockedOrder=B(w)?[1,1,1]:[0,0,0]);d.addClass((this.sortDisabled?"sorter-false ":" ")+k.cssHeader);k.headerList[b]=this;d.parent().addClass(k.cssHeaderRow)});b.config.debug&&(q("Built headers:",n),e(p));return p}function C(b){var c,a,d,g=b.config,m=g.sortList,f=[g.cssAsc,g.cssDesc],e=l(b).find("tfoot tr").children().removeClass(f.join(" "));
-g.$headers.removeClass(f.join(" "));d=m.length;for(c=0;c<d;c++)if(2!==m[c][1]&&(b=g.$headers.not(".sorter-false").filter('[data-column="'+m[c][0]+'"]'+(1===d?":last":"")),b.length))for(a=0;a<b.length;a++)b[a].sortDisabled||(b.eq(a).addClass(f[m[c][1]]),e.length&&e.filter('[data-column="'+m[c][0]+'"]').eq(a).addClass(f[m[c][1]]))}function E(b){if(b.config.widthFixed&&0===l(b).find("colgroup").length){var c=l("<colgroup>"),a=l(b).width();l("tr:first td",b.tBodies[0]).each(function(){c.append(l("<col>").css("width",
-parseInt(l(this).width()/a*1E3,10)/10+"%"))});l(b).prepend(c)}}function I(b,c){var a,d,g,f=b.config,e=c||f.sortList;f.sortList=[];l.each(e,function(c,b){a=[parseInt(b[0],10),parseInt(b[1],10)];if(g=f.headerList[a[0]])f.sortList.push(a),d=l.inArray(a[1],g.order),g.count=0<=d?d:a[1]%(f.sortReset?3:2)})}function J(b,c){return b&&b[c]?b[c].type||"":""}function F(b){var c=0,a=b.config,d=a.sortList,g=d.length,f=b.tBodies.length,e,k,n,p,r,t,u,v,s;if(!a.serverSideSorting&&a.cache[0]){a.debug&&(e=new Date);
-for(n=0;n<f;n++)r=a.cache[n].colMax,s=(t=a.cache[n].normalized)&&t[0]?t[0].length-1:0,t.sort(function(f,e){for(k=0;k<g;k++){p=d[k][0];v=d[k][1];u=/n/i.test(J(a.parsers,p))?"Numeric":"Text";u+=0===v?"":"Desc";/Numeric/.test(u)&&a.strings[p]&&(c="boolean"===typeof a.string[a.strings[p]]?(0===v?1:-1)*(a.string[a.strings[p]]?-1:1):a.strings[p]?a.string[a.strings[p]]||0:0);var m=l.tablesorter["sort"+u](b,f[p],e[p],p,r[p],c);if(m)return m}return f[s]-e[s]});a.debug&&q("Sorting on "+d.toString()+" and dir "+
-v+" time",e)}}function H(b,c){b.trigger("updateComplete");"function"===typeof c&&c(b[0])}function G(b,c,a){!1!==c?b.trigger("sorton",[b[0].config.sortList,function(){H(b,a)}]):H(b,a)}var f=this;f.version="2.7";f.parsers=[];f.widgets=[];f.defaults={theme:"default",widthFixed:!1,showProcessing:!1,headerTemplate:"{content}",onRenderTemplate:null,onRenderHeader:null,cancelSelection:!0,dateFormat:"mmddyyyy",sortMultiSortKey:"shiftKey",sortResetKey:"ctrlKey",usNumberFormat:!0,delayInit:!1,serverSideSorting:!1,
-headers:{},ignoreCase:!0,sortForce:null,sortList:[],sortAppend:null,sortInitialOrder:"asc",sortLocaleCompare:!1,sortReset:!1,sortRestart:!1,emptyTo:"bottom",stringTo:"max",textExtraction:"simple",textSorter:null,widgets:[],widgetOptions:{zebra:["even","odd"]},initWidgets:!0,initialized:null,tableClass:"tablesorter",cssAsc:"tablesorter-headerAsc",cssChildRow:"tablesorter-childRow",cssDesc:"tablesorter-headerDesc",cssHeader:"tablesorter-header",cssHeaderRow:"tablesorter-headerRow",cssIcon:"tablesorter-icon",
-cssInfoBlock:"tablesorter-infoOnly",cssProcessing:"tablesorter-processing",selectorHeaders:"> thead th, > thead td",selectorSort:"th, td",selectorRemove:".remove-me",debug:!1,headerList:[],empties:{},strings:{},parsers:[]};f.benchmark=q;f.construct=function(b){return this.each(function(){if(!this.tHead||0===this.tBodies.length||!0===this.hasInitialized)return this.config.debug?e("stopping initialization! No thead, tbody or tablesorter has already been initialized"):"";var c=l(this),a,d,g,m="",h,q,
-n,p,z=l.metadata;this.hasInitialized=!1;this.config={};a=l.extend(!0,this.config,f.defaults,b);l.data(this,"tablesorter",a);a.debug&&l.data(this,"startoveralltimer",new Date);a.supportsTextContent="x"===l("<span>x</span>")[0].textContent;a.supportsDataObject=1.4<=parseFloat(l.fn.jquery);a.string={max:1,min:-1,"max+":1,"max-":-1,zero:0,none:0,"null":0,top:!0,bottom:!1};/tablesorter\-/.test(c.attr("class"))||(m=""!==a.theme?" tablesorter-"+a.theme:"");c.addClass(a.tableClass+m);a.$headers=D(this);a.parsers=
-r(this);a.delayInit||x(this);a.$headers.find("*").andSelf().filter(a.selectorSort).unbind("mousedown.tablesorter mouseup.tablesorter").bind("mousedown.tablesorter mouseup.tablesorter",function(b,e){var k=(this.tagName.match("TH|TD")?l(this):l(this).parents("th, td").filter(":last"))[0];if(1!==(b.which||b.button))return!1;if("mousedown"===b.type)return p=(new Date).getTime(),"INPUT"===b.target.tagName?"":!a.cancelSelection;if(!0!==e&&250<(new Date).getTime()-p)return!1;a.delayInit&&!a.cache&&x(c[0]);
-if(!k.sortDisabled){c.trigger("sortStart",c[0]);m=!b[a.sortMultiSortKey];k.count=b[a.sortResetKey]?2:(k.count+1)%(a.sortReset?3:2);a.sortRestart&&(d=k,a.$headers.each(function(){this===d||!m&&l(this).is("."+a.cssDesc+",."+a.cssAsc)||(this.count=-1)}));d=k.column;if(m){a.sortList=[];if(null!==a.sortForce)for(h=a.sortForce,g=0;g<h.length;g++)h[g][0]!==d&&a.sortList.push(h[g]);n=k.order[k.count];if(2>n&&(a.sortList.push([d,n]),1<k.colSpan))for(g=1;g<k.colSpan;g++)a.sortList.push([d+g,n])}else if(a.sortAppend&&
-1<a.sortList.length&&f.isValueInArray(a.sortAppend[0][0],a.sortList)&&a.sortList.pop(),f.isValueInArray(d,a.sortList))for(g=0;g<a.sortList.length;g++)q=a.sortList[g],n=a.headerList[q[0]],q[0]===d&&(q[1]=n.order[n.count],2===q[1]&&(a.sortList.splice(g,1),n.count=-1));else if(n=k.order[k.count],2>n&&(a.sortList.push([d,n]),1<k.colSpan))for(g=1;g<k.colSpan;g++)a.sortList.push([d+g,n]);if(null!==a.sortAppend)for(h=a.sortAppend,g=0;g<h.length;g++)h[g][0]!==d&&a.sortList.push(h[g]);c.trigger("sortBegin",
-c[0]);setTimeout(function(){C(c[0]);F(c[0]);y(c[0])},1)}});a.cancelSelection&&a.$headers.each(function(){this.onselectstart=function(){return!1}});c.unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave").bind("sortReset",function(){a.sortList=[];C(this);F(this);y(this)}).bind("update",function(b,d,g){l(a.selectorRemove,this).remove();a.parsers=r(this);x(this);G(c,d,g)}).bind("updateCell",function(b,d,g,f){var e,m,h;e=l(this).find("tbody");
-b=e.index(l(d).parents("tbody").filter(":last"));var q=l(d).parents("tr").filter(":last");d=l(d)[0];e.length&&0<=b&&(m=e.eq(b).find("tr").index(q),h=d.cellIndex,e=this.config.cache[b].normalized[m].length-1,this.config.cache[b].row[this.config.cache[b].normalized[m][e]]=q,this.config.cache[b].normalized[m][h]=a.parsers[h].format(k(this,d,h),this,d,h),G(c,g,f))}).bind("addRows",function(b,d,f,e){var m=d.filter("tr").length,h=[],q=d[0].cells.length,n=l(this).find("tbody").index(d.closest("tbody"));
-a.parsers||(a.parsers=r(this));for(b=0;b<m;b++){for(g=0;g<q;g++)h[g]=a.parsers[g].format(k(this,d[b].cells[g],g),this,d[b].cells[g],g);h.push(a.cache[n].row.length);a.cache[n].row.push([d[b]]);a.cache[n].normalized.push(h);h=[]}G(c,f,e)}).bind("sorton",function(a,b,c,d){l(this).trigger("sortStart",this);I(this,b);C(this);F(this);y(this,d);"function"===typeof c&&c(this)}).bind("appendCache",function(a,b,c){y(this,c);"function"===typeof b&&b(this)}).bind("applyWidgetId",function(b,c){f.getWidgetById(c).format(this,
-a,a.widgetOptions)}).bind("applyWidgets",function(a,b){f.applyWidget(this,b)}).bind("refreshWidgets",function(a,b,c){f.refreshWidgets(this,b,c)}).bind("destroy",function(a,b,c){f.destroy(this,b,c)});a.supportsDataObject&&"undefined"!==typeof c.data().sortlist?a.sortList=c.data().sortlist:z&&c.metadata()&&c.metadata().sortlist&&(a.sortList=c.metadata().sortlist);f.applyWidget(this,!0);0<a.sortList.length?c.trigger("sorton",[a.sortList,{},!a.initWidgets]):a.initWidgets&&f.applyWidget(this);E(this);
-a.showProcessing&&c.unbind("sortBegin sortEnd").bind("sortBegin sortEnd",function(a){f.isProcessing(c[0],"sortBegin"===a.type)});this.hasInitialized=!0;a.debug&&f.benchmark("Overall initialization time",l.data(this,"startoveralltimer"));c.trigger("tablesorter-initialized",this);"function"===typeof a.initialized&&a.initialized(this)})};f.isProcessing=function(b,c,a){var d=b.config;b=a||l(b).find("."+d.cssHeader);c?(0<d.sortList.length&&(b=b.filter(function(){return this.sortDisabled?!1:f.isValueInArray(parseFloat(l(this).attr("data-column")),
-d.sortList)})),b.addClass(d.cssProcessing)):b.removeClass(d.cssProcessing)};f.processTbody=function(b,c,a){if(a)return c.before('<span class="tablesorter-savemyplace"/>'),b=l.fn.detach?c.detach():c.remove();b=l(b).find("span.tablesorter-savemyplace");c.insertAfter(b);b.remove()};f.clearTableBody=function(b){l(b.tBodies).filter(":not(."+b.config.cssInfoBlock+")").empty()};f.destroy=function(b,c,a){var d=l(b),g=b.config,e=d.find("thead:first");b.hasInitialized=!1;e.find("tr:not(."+g.cssHeaderRow+")").remove();
-e.find(".tablesorter-resizer").remove();f.refreshWidgets(b,!0,!0);d.removeData("tablesorter").unbind("sortReset update updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave").find("."+g.cssHeader).unbind("click mousedown mousemove mouseup").removeClass(g.cssHeader+" "+g.cssAsc+" "+g.cssDesc).find(".tablesorter-header-inner").each(function(){""!==g.cssIcon&&l(this).find("."+g.cssIcon).remove();l(this).replaceWith(l(this).contents())});!1!==c&&d.removeClass(g.tableClass);
-"function"===typeof a&&a(b)};f.regex=[/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,/^0x[0-9a-f]+$/i];f.sortText=function(b,c,a,d){if(c===a)return 0;var g=b.config,e=g.string[g.empties[d]||g.emptyTo],h=f.regex;if(""===c&&0!==e)return"boolean"===typeof e?e?-1:1:-e||-1;if(""===a&&0!==e)return"boolean"===typeof e?e?1:-1:e||1;if("function"===typeof g.textSorter)return g.textSorter(c,
-a,b,d);b=c.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");d=a.replace(h[0],"\\0$1\\0").replace(/\\0$/,"").replace(/^\\0/,"").split("\\0");c=parseInt(c.match(h[2]),16)||1!==b.length&&c.match(h[1])&&Date.parse(c);if(a=parseInt(a.match(h[2]),16)||c&&a.match(h[1])&&Date.parse(a)||null){if(c<a)return-1;if(c>a)return 1}g=Math.max(b.length,d.length);for(c=0;c<g;c++){a=isNaN(b[c])?b[c]||0:parseFloat(b[c])||0;h=isNaN(d[c])?d[c]||0:parseFloat(d[c])||0;if(isNaN(a)!==isNaN(h))return isNaN(a)?
-1:-1;typeof a!==typeof h&&(a+="",h+="");if(a<h)return-1;if(a>h)return 1}return 0};f.sortTextDesc=function(b,c,a,d){if(c===a)return 0;var e=b.config,m=e.string[e.empties[d]||e.emptyTo];return""===c&&0!==m?"boolean"===typeof m?m?-1:1:m||1:""===a&&0!==m?"boolean"===typeof m?m?1:-1:-m||-1:"function"===typeof e.textSorter?e.textSorter(a,c,b,d):f.sortText(b,a,c)};f.getTextValue=function(b,c,a){if(c){var d=b.length,e=c+a;for(c=0;c<d;c++)e+=b.charCodeAt(c);return a*e}return 0};f.sortNumeric=function(b,c,
-a,d,e,m){if(c===a)return 0;b=b.config;d=b.string[b.empties[d]||b.emptyTo];if(""===c&&0!==d)return"boolean"===typeof d?d?-1:1:-d||-1;if(""===a&&0!==d)return"boolean"===typeof d?d?1:-1:d||1;isNaN(c)&&(c=f.getTextValue(c,e,m));isNaN(a)&&(a=f.getTextValue(a,e,m));return c-a};f.sortNumericDesc=function(b,c,a,d,e,m){if(c===a)return 0;b=b.config;d=b.string[b.empties[d]||b.emptyTo];if(""===c&&0!==d)return"boolean"===typeof d?d?-1:1:d||1;if(""===a&&0!==d)return"boolean"===typeof d?d?1:-1:-d||-1;isNaN(c)&&
-(c=f.getTextValue(c,e,m));isNaN(a)&&(a=f.getTextValue(a,e,m));return a-c};f.characterEquivalents={a:"\u00e1\u00e0\u00e2\u00e3\u00e4\u0105\u00e5",A:"\u00c1\u00c0\u00c2\u00c3\u00c4\u0104\u00c5",c:"\u00e7\u0107\u010d",C:"\u00c7\u0106\u010c",e:"\u00e9\u00e8\u00ea\u00eb\u011b\u0119",E:"\u00c9\u00c8\u00ca\u00cb\u011a\u0118",i:"\u00ed\u00ec\u0130\u00ee\u00ef\u0131",I:"\u00cd\u00cc\u0130\u00ce\u00cf",o:"\u00f3\u00f2\u00f4\u00f5\u00f6",O:"\u00d3\u00d2\u00d4\u00d5\u00d6",ss:"\u00df",SS:"\u1e9e",u:"\u00fa\u00f9\u00fb\u00fc\u016f",
-U:"\u00da\u00d9\u00db\u00dc\u016e"};f.replaceAccents=function(b){var c,a="[",d=f.characterEquivalents;if(!f.characterRegex){f.characterRegexArray={};for(c in d)"string"===typeof c&&(a+=d[c],f.characterRegexArray[c]=new RegExp("["+d[c]+"]","g"));f.characterRegex=new RegExp(a+"]")}if(f.characterRegex.test(b))for(c in d)"string"===typeof c&&(b=b.replace(f.characterRegexArray[c],c));return b};f.isValueInArray=function(b,c){var a,d=c.length;for(a=0;a<d;a++)if(c[a][0]===b)return!0;return!1};f.addParser=
-function(b){var c,a=f.parsers.length,d=!0;for(c=0;c<a;c++)f.parsers[c].id.toLowerCase()===b.id.toLowerCase()&&(d=!1);d&&f.parsers.push(b)};f.getParserById=function(b){var c,a=f.parsers.length;for(c=0;c<a;c++)if(f.parsers[c].id.toLowerCase()===b.toString().toLowerCase())return f.parsers[c];return!1};f.addWidget=function(b){f.widgets.push(b)};f.getWidgetById=function(b){var c,a,d=f.widgets.length;for(c=0;c<d;c++)if((a=f.widgets[c])&&a.hasOwnProperty("id")&&a.id.toLowerCase()===b.toLowerCase())return a};
-f.applyWidget=function(b,c){var a=b.config,d=a.widgetOptions,e=a.widgets.sort().reverse(),m,h,k,n=e.length;h=l.inArray("zebra",a.widgets);0<=h&&(a.widgets.splice(h,1),a.widgets.push("zebra"));a.debug&&(m=new Date);for(h=0;h<n;h++)(k=f.getWidgetById(e[h]))&&(!0===c&&k.hasOwnProperty("init")?k.init(b,k,a,d):!c&&k.hasOwnProperty("format")&&k.format(b,a,d));a.debug&&q("Completed "+(!0===c?"initializing":"applying")+" widgets",m)};f.refreshWidgets=function(b,c,a){var d,g=b.config,m=g.widgets,h=f.widgets,
-k=h.length;for(d=0;d<k;d++)h[d]&&h[d].id&&(c||0>l.inArray(h[d].id,m))&&(g.debug&&e("Refeshing widgets: Removing "+h[d].id),h[d].hasOwnProperty("remove")&&h[d].remove(b,g,g.widgetOptions));!0!==a&&f.applyWidget(b,c)};f.getData=function(b,c,a){var d="";b=l(b);var e,f;if(!b.length)return"";e=l.metadata?b.metadata():!1;f=" "+(b.attr("class")||"");"undefined"!==typeof b.data(a)||"undefined"!==typeof b.data(a.toLowerCase())?d+=b.data(a)||b.data(a.toLowerCase()):e&&"undefined"!==typeof e[a]?d+=e[a]:c&&"undefined"!==
-typeof c[a]?d+=c[a]:" "!==f&&f.match(" "+a+"-")&&(d=f.match(new RegExp(" "+a+"-(\\w+)"))[1]||"");return l.trim(d)};f.formatFloat=function(b,c){if("string"!==typeof b||""===b)return b;var a;b=(c&&c.config?!1!==c.config.usNumberFormat:"undefined"!==typeof c?c:1)?b.replace(/,/g,""):b.replace(/[\s|\.]/g,"").replace(/,/g,".");/^\s*\([.\d]+\)/.test(b)&&(b=b.replace(/^\s*\(/,"-").replace(/\)/,""));a=parseFloat(b);return isNaN(a)?l.trim(b):a};f.isDigit=function(b){return isNaN(b)?/^[\-+(]?\d+[)]?$/.test(b.toString().replace(/[,.'"\s]/g,
-"")):!0}}});var k=l.tablesorter;l.fn.extend({tablesorter:k.construct});k.addParser({id:"text",is:function(e,k,l){return!0},format:function(e,q,s,r){q=q.config;e=l.trim(q.ignoreCase?e.toLocaleLowerCase():e);return q.sortLocaleCompare?k.replaceAccents(e):e},type:"text"});k.addParser({id:"currency",is:function(e){return/^\(?\d+[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]|[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]\d+\)?$/.test(e)},format:function(e,l){return k.formatFloat(e.replace(/[^\w,. \-()]/g,""),l)},type:"numeric"});
-k.addParser({id:"ipAddress",is:function(e){return/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/.test(e)},format:function(e,l){var s,r=e.split("."),x="",y=r.length;for(s=0;s<y;s++)x+=("00"+r[s]).slice(-3);return k.formatFloat(x,l)},type:"numeric"});k.addParser({id:"url",is:function(e){return/^(https?|ftp|file):\/\//.test(e)},format:function(e){return l.trim(e.replace(/(https?|ftp|file):\/\//,""))},type:"text"});k.addParser({id:"isoDate",is:function(e){return/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(e)},
-format:function(e,l){return k.formatFloat(""!==e?(new Date(e.replace(/-/g,"/"))).getTime()||"":"",l)},type:"numeric"});k.addParser({id:"percent",is:function(e){return/(\d\s?%|%\s?\d)/.test(e)},format:function(e,l){return k.formatFloat(e.replace(/%/g,""),l)},type:"numeric"});k.addParser({id:"usLongDate",is:function(e){return/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i.test(e)},format:function(e,l){return k.formatFloat((new Date(e.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||
-"",l)},type:"numeric"});k.addParser({id:"shortDate",is:function(e){return/^(\d{1,2}|\d{4})[\/\-\,\.\s+]\d{1,2}[\/\-\.\,\s+](\d{1,2}|\d{4})$/.test(e)},format:function(e,l,s,r){s=l.config;var x=s.headerList[r],y=x.shortDateFormat;"undefined"===typeof y&&(y=x.shortDateFormat=k.getData(x,s.headers[r],"dateFormat")||s.dateFormat);e=e.replace(/\s+/g," ").replace(/[\-|\.|\,]/g,"/");"mmddyyyy"===y?e=e.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,"$3/$1/$2"):"ddmmyyyy"===y?e=e.replace(/(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{4})/,
-"$3/$2/$1"):"yyyymmdd"===y&&(e=e.replace(/(\d{4})[\/\s](\d{1,2})[\/\s](\d{1,2})/,"$1/$2/$3"));return k.formatFloat((new Date(e)).getTime()||"",l)},type:"numeric"});k.addParser({id:"time",is:function(e){return/^(([0-2]?\d:[0-5]\d)|([0-1]?\d:[0-5]\d\s?([AP]M)))$/i.test(e)},format:function(e,l){return k.formatFloat((new Date("2000/01/01 "+e.replace(/(\S)([AP]M)$/i,"$1 $2"))).getTime()||"",l)},type:"numeric"});k.addParser({id:"digit",is:function(e){return k.isDigit(e)},format:function(e,l){return k.formatFloat(e.replace(/[^\w,. \-()]/g,
-""),l)},type:"numeric"});k.addParser({id:"metadata",is:function(e){return!1},format:function(e,k,s){e=k.config;e=e.parserMetadataName?e.parserMetadataName:"sortValue";return l(s).metadata()[e]},type:"numeric"});k.addWidget({id:"zebra",format:function(e,q,s){var r,x,y,A,B,D,C=new RegExp(q.cssChildRow,"i"),E=l(e).children("tbody:not(."+q.cssInfoBlock+")");q.debug&&(B=new Date);for(e=0;e<E.length;e++)r=l(E[e]),D=r.children("tr").length,1<D&&(y=0,r=r.children("tr:visible"),r.each(function(){x=l(this);
-C.test(this.className)||y++;A=0===y%2;x.removeClass(s.zebra[A?1:0]).addClass(s.zebra[A?0:1])}));q.debug&&k.benchmark("Applying Zebra widget",B)},remove:function(e,k,s){var r;s=l(e).children("tbody:not(."+k.cssInfoBlock+")");var x=(k.widgetOptions.zebra||["even","odd"]).join(" ");for(k=0;k<s.length;k++)r=l.tablesorter.processTbody(e,l(s[k]),!0),r.children().removeClass(x),l.tablesorter.processTbody(e,r,!1)}})}(jQuery);
diff --git a/sitestatic/konami.js b/sitestatic/konami.js
deleted file mode 100644
index 15882b9f..00000000
--- a/sitestatic/konami.js
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Konami-JS ~
- * :: Now with support for touch events and multiple instances for
- * :: those situations that call for multiple easter eggs!
- * Code: http://konami-js.googlecode.com/
- * Examples: http://www.snaptortoise.com/konami-js
- * Copyright (c) 2009 George Mandis (georgemandis.com, snaptortoise.com)
- * Version: 1.4.2 (9/2/2013)
- * Licensed under the MIT License (http://opensource.org/licenses/MIT)
- * Tested in: Safari 4+, Google Chrome 4+, Firefox 3+, IE7+, Mobile Safari 2.2.1 and Dolphin Browser
- */
-
-var Konami = function (callback) {
- var konami = {
- addEvent: function (obj, type, fn, ref_obj) {
- if (obj.addEventListener)
- obj.addEventListener(type, fn, false);
- else if (obj.attachEvent) {
- // IE
- obj["e" + type + fn] = fn;
- obj[type + fn] = function () {
- obj["e" + type + fn](window.event, ref_obj);
- }
- obj.attachEvent("on" + type, obj[type + fn]);
- }
- },
- input: "",
- pattern: "38384040373937396665",
- load: function (link) {
- this.addEvent(document, "keydown", function (e, ref_obj) {
- if (ref_obj) konami = ref_obj; // IE
- konami.input += e ? e.keyCode : event.keyCode;
- if (konami.input.length > konami.pattern.length)
- konami.input = konami.input.substr((konami.input.length - konami.pattern.length));
- if (konami.input == konami.pattern) {
- konami.code(link);
- konami.input = "";
- e.preventDefault();
- return false;
- }
- }, this);
- this.iphone.load(link);
- },
- code: function (link) {
- window.location = link
- },
- iphone: {
- start_x: 0,
- start_y: 0,
- stop_x: 0,
- stop_y: 0,
- tap: false,
- capture: false,
- orig_keys: "",
- keys: ["UP", "UP", "DOWN", "DOWN", "LEFT", "RIGHT", "LEFT", "RIGHT", "TAP", "TAP"],
- code: function (link) {
- konami.code(link);
- },
- load: function (link) {
- this.orig_keys = this.keys;
- konami.addEvent(document, "touchmove", function (e) {
- if (e.touches.length == 1 && konami.iphone.capture == true) {
- var touch = e.touches[0];
- konami.iphone.stop_x = touch.pageX;
- konami.iphone.stop_y = touch.pageY;
- konami.iphone.tap = false;
- konami.iphone.capture = false;
- konami.iphone.check_direction();
- }
- });
- konami.addEvent(document, "touchend", function (evt) {
- if (konami.iphone.tap == true) konami.iphone.check_direction(link);
- }, false);
- konami.addEvent(document, "touchstart", function (evt) {
- konami.iphone.start_x = evt.changedTouches[0].pageX;
- konami.iphone.start_y = evt.changedTouches[0].pageY;
- konami.iphone.tap = true;
- konami.iphone.capture = true;
- });
- },
- check_direction: function (link) {
- x_magnitude = Math.abs(this.start_x - this.stop_x);
- y_magnitude = Math.abs(this.start_y - this.stop_y);
- x = ((this.start_x - this.stop_x) < 0) ? "RIGHT" : "LEFT";
- y = ((this.start_y - this.stop_y) < 0) ? "DOWN" : "UP";
- result = (x_magnitude > y_magnitude) ? x : y;
- result = (this.tap == true) ? "TAP" : result;
-
- if (result == this.keys[0]) this.keys = this.keys.slice(1, this.keys.length);
- if (this.keys.length == 0) {
- this.keys = this.orig_keys;
- this.code(link);
- }
- }
- }
- }
-
- typeof callback === "string" && konami.load(callback);
- if (typeof callback === "function") {
- konami.code = callback;
- konami.load();
- }
-
- return konami;
-};
diff --git a/sitestatic/konami.min.js b/sitestatic/konami.min.js
deleted file mode 100644
index 6090211c..00000000
--- a/sitestatic/konami.min.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Konami-JS ~
- * :: Now with support for touch events and multiple instances for
- * :: those situations that call for multiple easter eggs!
- * Code: http://konami-js.googlecode.com/
- * Examples: http://www.snaptortoise.com/konami-js
- * Copyright (c) 2009 George Mandis (georgemandis.com, snaptortoise.com)
- * Version: 1.4.2 (9/2/2013)
- * Licensed under the MIT License (http://opensource.org/licenses/MIT)
- * Tested in: Safari 4+, Google Chrome 4+, Firefox 3+, IE7+, Mobile Safari 2.2.1 and Dolphin Browser
- */
-var Konami=function(d){var a={addEvent:function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&(a["e"+b+c]=c,a[b+c]=function(){a["e"+b+c](window.event,d)},a.attachEvent("on"+b,a[b+c]))},input:"",pattern:"38384040373937396665",load:function(e){this.addEvent(document,"keydown",function(b,c){c&&(a=c);a.input+=b?b.keyCode:event.keyCode;a.input.length>a.pattern.length&&(a.input=a.input.substr(a.input.length-a.pattern.length));if(a.input==a.pattern)return a.code(e),a.input="",b.preventDefault(),
-!1},this);this.iphone.load(e)},code:function(a){window.location=a},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:!1,capture:!1,orig_keys:"",keys:"UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT TAP TAP".split(" "),code:function(e){a.code(e)},load:function(e){this.orig_keys=this.keys;a.addEvent(document,"touchmove",function(b){1==b.touches.length&&!0==a.iphone.capture&&(b=b.touches[0],a.iphone.stop_x=b.pageX,a.iphone.stop_y=b.pageY,a.iphone.tap=!1,a.iphone.capture=!1,a.iphone.check_direction())});a.addEvent(document,
-"touchend",function(b){!0==a.iphone.tap&&a.iphone.check_direction(e)},!1);a.addEvent(document,"touchstart",function(b){a.iphone.start_x=b.changedTouches[0].pageX;a.iphone.start_y=b.changedTouches[0].pageY;a.iphone.tap=!0;a.iphone.capture=!0})},check_direction:function(a){x_magnitude=Math.abs(this.start_x-this.stop_x);y_magnitude=Math.abs(this.start_y-this.stop_y);x=0>this.start_x-this.stop_x?"RIGHT":"LEFT";y=0>this.start_y-this.stop_y?"DOWN":"UP";result=x_magnitude>y_magnitude?x:y;result=!0==this.tap?
-"TAP":result;result==this.keys[0]&&(this.keys=this.keys.slice(1,this.keys.length));0==this.keys.length&&(this.keys=this.orig_keys,this.code(a))}}};"string"===typeof d&&a.load(d);"function"===typeof d&&(a.code=d,a.load());return a};
diff --git a/sitestatic/logos/Makefile b/sitestatic/logos/Makefile
deleted file mode 100644
index 1fa00733..00000000
--- a/sitestatic/logos/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-include ../../common.mk
-
-files = \
- apple-touch-icon-114x114.png \
- apple-touch-icon-144x144.png \
- apple-touch-icon-57x57.png \
- apple-touch-icon-72x72.png \
- icon-transparent-64x64.png
-
-all: $(files)
-clean:
- rm -f -- $(files)
-
-$(files): %: $(branding)/%
- cp $< $@
diff --git a/sitestatic/logos/apple-touch-icon-114x114.png b/sitestatic/logos/apple-touch-icon-114x114.png
deleted file mode 100644
index 93fde0fa..00000000
--- a/sitestatic/logos/apple-touch-icon-114x114.png
+++ /dev/null
Binary files differ
diff --git a/sitestatic/logos/apple-touch-icon-144x144.png b/sitestatic/logos/apple-touch-icon-144x144.png
deleted file mode 100644
index 47f0f630..00000000
--- a/sitestatic/logos/apple-touch-icon-144x144.png
+++ /dev/null
Binary files differ
diff --git a/sitestatic/logos/apple-touch-icon-57x57.png b/sitestatic/logos/apple-touch-icon-57x57.png
deleted file mode 100644
index be913884..00000000
--- a/sitestatic/logos/apple-touch-icon-57x57.png
+++ /dev/null
Binary files differ
diff --git a/sitestatic/logos/apple-touch-icon-72x72.png b/sitestatic/logos/apple-touch-icon-72x72.png
deleted file mode 100644
index ce64888b..00000000
--- a/sitestatic/logos/apple-touch-icon-72x72.png
+++ /dev/null
Binary files differ
diff --git a/sitestatic/logos/icon-transparent-64x64.png b/sitestatic/logos/icon-transparent-64x64.png
deleted file mode 100644
index c5cdf066..00000000
--- a/sitestatic/logos/icon-transparent-64x64.png
+++ /dev/null
Binary files differ
diff --git a/sitestatic/silhouette.png b/sitestatic/silhouette.png
deleted file mode 100644
index 9f3fd2c0..00000000
--- a/sitestatic/silhouette.png
+++ /dev/null
Binary files differ
diff --git a/templates/feeds/news_description.html b/templates/feeds/news_description.html
deleted file mode 100644
index 61ceedf3..00000000
--- a/templates/feeds/news_description.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<p>{{obj.author.get_full_name}} wrote:</p>
-{{ obj.html }}
diff --git a/templates/feeds/packages_title.html b/templates/feeds/packages_title.html
deleted file mode 100644
index f92ac684..00000000
--- a/templates/feeds/packages_title.html
+++ /dev/null
@@ -1 +0,0 @@
-{{ obj.pkgname }} {{ obj.full_version }} {{ obj.arch.name }} \ No newline at end of file
diff --git a/templates/packages/details.html b/templates/packages/details.html
index dc185fe1..82f2c604 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -1,239 +1,11 @@
{% extends "base.html" %}
{% load static from staticfiles %}
-{% load package_extras %}
-{% load pgp %}
{% block title %}{{ BRANDING_DISTRONAME }} - {{ pkg.pkgname }} {{ pkg.full_version }} ({{ pkg.arch.name }}){% endblock %}
{% block navbarclass %}anb-packages{% endblock %}
-{% load package_extras %}
{% block content %}
-<div id="pkgdetails" class="box">
-
- <h2>{{ pkg.pkgname }} {{ pkg.full_version }}</h2>
-
- <div id="detailslinks" class="listing">
- <div id="actionlist">
- <h4>Package Actions</h4>
- <ul class="small">
- <li>
- <a href="{% scm_link pkg 'tree' %}" title="View source files for {{ pkg.pkgname }}">Source Files</a> /
- <a href="{% scm_link pkg 'log' %}" title="View changes for {{ pkg.pkgname }}">View Changes</a>
- </li>
- <li>
- <a href="{% bugs_list pkg %}" title="View existing bug tickets for {{ pkg.pkgname }}">Bug Reports</a> /
- <a href="{% bug_report pkg %}" title="Report new bug for {{ pkg.pkgname }}">Add New Bug</a>
- / <a href="{% flag_unfree pkg %}" title="Report {{ pkg.pkgname }} as unfree">Report as unfree</a>
- </li>
- <li><a href="{% get_wiki_link pkg %}" title="Search wiki for {{ pkg.pkgname }}">Search Wiki</a></li>
- {% if pkg.flag_date %}
- <li><span class="flagged">Flagged out-of-date on {{ pkg.flag_date|date }}</span></li>
- {% with pkg.in_testing as tp %}{% if tp %}
- <li><span class="flagged">Version
- <a href="{{ tp.get_absolute_url }}"
- title="Testing package details for {{ tp.pkgname }}">{{ tp.full_version }}</a>
- in testing</span></li>
- {% endif %}{% endwith %}
- {% if perms.main.change_package %}
- <li><a href="unflag/" title="Unflag this package">Click here to unflag</a></li>
- <li><a href="unflag/all/" title="Unflag all matching pkgbase">Click here to unflag all split packages</a></li>
- {% endif %}
- {% else %}
- {% if pkg.repo.name != "Core" and pkg.repo.name != "Extra" and pkg.repo.name != "Testing" and pkg.repo.name != "Community" and pkg.repo.name != "Community-Testing" and pkg.repo.name != "Multilib" and pkg.repo.name != "Multilib-testing" or pkg.arch.name == "mips64el" %}
- <li><a href="flag/" title="Flag {{ pkg.pkgname }} as out-of-date">Flag Package Out-of-Date</a>
- <a href="/packages/flaghelp/"
- title="Get help on package flagging"
- onclick="return !window.open('/packages/flaghelp/','FlagHelp',
- 'height=350,width=450,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no');">(?)</a></li>
- {% elif pkg.arch.name == "i686" or pkg.arch.name == "x86_64" %}
- <li>This package comes from Arch</li>
- {% endif %}
- {% endif %}
- <li><a href="download/" rel="nofollow" title="Download {{ pkg.pkgname }} from mirror">Download From Mirror</a></li>
- </ul>
-
- {% if perms.main.change_package %}
- <form id="pkg-action" method="post" action="/packages/update/">{% csrf_token %}
- <div><input type="hidden" name="pkgid" value="{{ pkg.id }}" /></div>
- <p>{% if user in pkg.maintainers %}
- <input title="Orphan this package" type="submit" name="disown" value="Disown"/>
- {% else %}
- <input title="Adopt this package" type="submit" name="adopt" value="Adopt"/>
- {% endif %}</p>
- </form>
- {% endif %}
- </div>
-
- {% with pkg.elsewhere as others %}{% if others %}
- <div id="elsewhere" class="widget">
- <h4>Versions Elsewhere</h4>
- <ul>
- {% for o in others %}
- <li><a href="{{ o.get_absolute_url }}"
- title="Package details for {{ o.pkgname }}">{{ o.pkgname }} {{ o.full_version }} [{{ o.repo.name|lower }}] ({{ o.arch.name }})</a></li>
- {% endfor %}
- </ul>
- </div>
- {% endif %}{% endwith %}
- </div>
-
- <div itemscope itemtype="http://schema.org/SoftwareApplication">
- <meta itemprop="name" content="{{ pkg.pkgname|escape }}"/>
- <meta itemprop="version" content="{{ pkg.full_version|escape }}"/>
- <meta itemprop="softwareVersion" content="{{ pkg.full_version|escape }}"/>
- <meta itemprop="fileSize" content="{{ pkg.compressed_size }}"/>
- <meta itemprop="dateCreated" content="{{ pkg.build_date|date:"Y-m-d" }}"/>
- <meta itemprop="datePublished" content="{{ pkg.last_update|date:"Y-m-d" }}"/>
- <meta itemprop="operatingSystem" content="Linux"/>
- <div style="display:none" itemprop="provider" itemscope itemtype="http://schema.org/Person">
- <meta itemprop="name" content="{{ pkg.packager.get_full_name|escape }}"/>
- </div>
- <table id="pkginfo">
- <tr>
- <th>Architecture:</th>
- <td><a href="/packages/?arch={{ pkg.arch.name }}"
- title="Browse packages for {{ pkg.arch.name }} architecture">{{ pkg.arch.name }}</a></td>
- </tr><tr>
- <th>Repository:</th>
- <td><a href="/packages/?repo={{ pkg.repo.name|capfirst }}"
- title="Browse the {{ pkg.repo.name|capfirst }} repository">{{ pkg.repo.name|capfirst }}</a></td>
- </tr>
- {% ifequal pkg.pkgname pkg.pkgbase %}
- {% with pkg.split_packages as splits %}{% if splits %}
- <tr>
- <th>Split Packages:</th>
- <td class="wrap relatedto">{% for s in splits %}<span class="related">{% pkg_details_link s %}{% if not forloop.last %}, {% endif %}</span>{% endfor %}</td>
- </tr>
- {% endif %}{% endwith %}
- {% else %}
- <tr>
- <th>Base Package:</th>
- {% with pkg.base_package as base %}{% if base %}
- <td>{% pkg_details_link base %}</td>
- {% else %}
- <td><a href="../{{ pkg.pkgbase }}/"
- title="Split package details for {{ pkg.pkgbase }}">{{ pkg.pkgbase }}</a></td>
- {% endif %}{% endwith %}
- </tr>
- {% endifequal %}
- <tr>
- <th>Description:</th>
- <td class="wrap" itemprop="description">{{ pkg.pkgdesc|default:"" }}</td>
- </tr><tr>
- <th>Upstream URL:</th>
- <td>{% if pkg.url %}<a itemprop="url" href="{{ pkg.url }}"
- title="Visit the website for {{ pkg.pkgname }}">{{ pkg.url|url_unquote }}</a>{% endif %}</td>
- </tr><tr>
- <th>License(s):</th>
- <td class="wrap">{{ pkg.licenses.all|join:", " }}</td>
- </tr>
- {% with pkg.groups.all as groups %}{% if groups %}
- <tr>
- <th>Groups:</th>
- <td class="wrap">{% for g in groups %}
- <a href="/groups/{{ pkg.arch.name }}/{{ g.name }}/"
- title="Group details for {{ g.name }}">{{ g.name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
- </td>
- </tr>
- {% endif %}{% endwith %}
- {% with pkg.provides.all as all_related %}{% if all_related %}
- <tr>
- <th>Provides:</th>
- <td class="wrap relatedto">{% include "packages/details_relatedto.html" %}</td>
- </tr>
- {% endif %}{% endwith %}
- {% with pkg.replaces.all as all_related %}{% if all_related %}
- <tr>
- <th>Replaces:</th>
- <td class="wrap relatedto">{% include "packages/details_relatedto.html" %}</td>
- </tr>
- {% endif %}{% endwith %}
- {% with pkg.conflicts.all as all_related %}{% if all_related %}
- <tr>
- <th>Conflicts:</th>
- <td class="wrap relatedto">{% include "packages/details_relatedto.html" %}</td>
- </tr>
- {% endif %}{% endwith %}
- {% with pkg.reverse_conflicts as rev_conflicts %}{% if rev_conflicts %}
- <tr>
- <th>Reverse Conflicts:</th>
- <td class="wrap relatedto">{% for conflict in rev_conflicts %}
- <span class="related">{% pkg_details_link conflict %}{% if not forloop.last %}, {% endif %}</span>{% endfor %}</td>
- </tr>
- {% endif %}{% endwith %}
- <tr>
- <th>Maintainers:</th>
- {% with pkg.maintainers as maints %}
- <td>{% if maints %}
- {% for m in maints %}
- {% maintainer_link m %}<br/>
- {% endfor %}
- {% else %}Orphan{% endif %}
- </td>
- {% endwith %}
- </tr><tr>
- <th>Package Size:</th>
- <td>{{ pkg.compressed_size|filesizeformat }}</td>
- </tr><tr>
- <th>Installed Size:</th>
- <td>{{ pkg.installed_size|filesizeformat }}</td>
- </tr><tr>
- <th>Last Packager:</th>
- <td>{% with pkg.packager as pkgr %}{% if pkgr %}{% packager_link pkgr %}{% else %}{{ pkg.packager_str }}{% endif %}{% endwith %}</td>
- </tr><tr>
- <th>Build Date:</th>
- <td>{{ pkg.build_date|date:"DATETIME_FORMAT" }} UTC</td>
- </tr>{% if pkg.signature %}<tr>
- <th>Signed By:</th>
- <td>{% with pkg.signer as signer %}{% if signer %}{% pgp_key_link pkg.signature.key_id signer.get_full_name %}{% else %}Unknown ({% pgp_key_link pkg.signature.key_id %}){% endif %}{% endwith %}</td>
- </tr><tr>
- <th>Signature Date:</th>
- <td>{{ pkg.signature.creation_time|date:"DATETIME_FORMAT" }} UTC</td>
- </tr>{% else %}<tr>
- <th>Signed By:</th>
- <td>Unsigned</td>
- </tr>{% endif %}<tr>
- <th>Last Updated:</th>
- <td>{{ pkg.last_update|date:"DATETIME_FORMAT" }} UTC</td>
- </tr>
- {% if user.is_authenticated %}{% with pkg.flag_request as flag_request %}{% if flag_request %}<tr>
- <th>Last Flag Request:</th>
- <td class="wrap">From {{ flag_request.who }} on {{ flag_request.created|date }}:<br/>
- <div class="userdata">{{ flag_request.message|linebreaksbr|default:"{no message}" }}</div></td>
- </tr>{% endif %}{% endwith %}{% endif %}
- </table>
- </div>
-
- <div id="metadata">
- {% with pkg.get_depends as deps %}
- <div id="pkgdeps" class="listing">
- <h3 title="{{ pkg.pkgname }} has the following dependencies">
- Dependencies ({{deps|length}})</h3>
- {% if deps %}<ul id="pkgdepslist">
- {% for depend in deps %}{% include "packages/details_depend.html" %}{% endfor %}
- </ul>{% endif %}
- </div>
- {% endwith %}
- {% with pkg.get_requiredby as rqdby %}
- <div id="pkgreqs" class="listing">
- <h3 title="Packages that require {{ pkg.pkgname }}">
- Required By ({{rqdby|length}})</h3>
- {% if rqdby %}<ul id="pkgreqslist">
- {% for req in rqdby %}{% include "packages/details_requiredby.html" %}{% endfor %}
- </ul>{% endif %}
- </div>
- {% endwith %}
- <div id="pkgfiles" class="listing">
- <h3 title="Complete list of files contained within this package">
- Package Contents</h3>
- <div id="pkgfilelist">
- <p><a id="filelink" href="files/"
- title="Click to view the complete file list for {{ pkg.pkgname }}">
- View the file list for {{ pkg.pkgname }}</a></p>
- </div>
- </div>
- </div>
-</div>
+{% include "packages/details.html.jinja" %}
{% endblock %}
{% block script_block %}
diff --git a/templates/packages/details.html.jinja b/templates/packages/details.html.jinja
new file mode 100644
index 00000000..22c778cb
--- /dev/null
+++ b/templates/packages/details.html.jinja
@@ -0,0 +1,228 @@
+{% import 'packages/details_link.html.jinja' as details %}
+<div id="pkgdetails" class="box">
+ <h2>{{ pkg.pkgname }} {{ pkg.full_version }}</h2>
+
+ <div id="detailslinks" class="listing">
+ <div id="actionlist">
+ <h4>Package Actions</h4>
+ <ul class="small">
+ <li>
+ <a href="{{ scm_link(pkg, 'tree') }}" title="View source files for {{ pkg.pkgname }}">Source Files</a> /
+ <a href="{{ scm_link(pkg, 'log') }}" title="View changes for {{ pkg.pkgname }}">View Changes</a>
+ </li>
+ <li>
+ <a href="{{ bugs_list(pkg) }}" title="View existing bug tickets for {{ pkg.pkgname }}">Bug Reports</a> /
+ <a href="{{ bug_report(pkg) }}" title="Report new bug for {{ pkg.pkgname }}">Add New Bug</a>
+ / <a href="{{ flag_unfree(pkg) }}" title="Report {{ pkg.pkgname }} as unfree">Report as unfree</a>
+ </li>
+ <li><a href="{{ wiki_link(pkg) }}" title="Search wiki for {{ pkg.pkgname }}">Search Wiki</a></li>
+ {% if pkg.flag_date %}
+ <li><span class="flagged">Flagged out-of-date on {{ pkg.flag_date|date }}</span></li>
+ {% with tp = pkg.in_testing() %}{% if tp %}
+ <li><span class="flagged">Version
+ <a href="{{ tp.get_absolute_url() }}"
+ title="Testing package details for {{ tp.pkgname }}">{{ tp.full_version }}</a>
+ in testing</span></li>
+ {% endif %}{% endwith %}
+ {% if perms.main.change_package %}
+ <li><a href="unflag/" title="Unflag this package">Click here to unflag</a></li>
+ <li><a href="unflag/all/" title="Unflag all matching pkgbase">Click here to unflag all split packages</a></li>
+ {% endif %}
+ {% else %}
+ {% if pkg.repo.name != "Core" and pkg.repo.name != "Extra" and pkg.repo.name != "Testing" and pkg.repo.name != "Community" and pkg.repo.name != "Community-Testing" and pkg.repo.name != "Multilib" and pkg.repo.name != "Multilib-testing" or pkg.arch.name == "mips64el" %}
+ <li><a href="flag/" title="Flag {{ pkg.pkgname }} as out-of-date">Flag Package Out-of-Date</a>
+ <a href="/packages/flaghelp/"
+ title="Get help on package flagging"
+ onclick="return !window.open('/packages/flaghelp/','FlagHelp',
+ 'height=350,width=450,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=no');">(?)</a></li>
+ {% elif pkg.arch.name == "i686" or pkg.arch.name == "x86_64" %}
+ <li>This package comes from Arch</li>
+ {% endif %}
+ {% endif %}
+ <li><a href="download/" rel="nofollow" title="Download {{ pkg.pkgname }} from mirror">Download From Mirror</a></li>
+ </ul>
+
+ {% if perms.main.change_package %}
+ <form id="pkg-action" method="post" action="/packages/update/">{% csrf_token %}
+ <div><input type="hidden" name="pkgid" value="{{ pkg.id }}" /></div>
+ <p>{% if user in pkg.maintainers %}
+ <input title="Orphan this package" type="submit" name="disown" value="Disown"/>
+ {% else %}
+ <input title="Adopt this package" type="submit" name="adopt" value="Adopt"/>
+ {% endif %}</p>
+ </form>
+ {% endif %}
+ </div>
+
+ {% with others = pkg.elsewhere() %}{% if others %}
+ <div id="elsewhere" class="widget">
+ <h4>Versions Elsewhere</h4>
+ <ul>
+ {% for o in others %}
+ <li><a href="{{ o.get_absolute_url() }}"
+ title="Package details for {{ o.pkgname }}">{{ o.pkgname }} {{ o.full_version }} [{{ o.repo.name|lower }}] ({{ o.arch.name }})</a></li>
+ {% endfor %}
+ </ul>
+ </div>
+ {% endif %}{% endwith %}
+ </div>
+
+ <div itemscope itemtype="http://schema.org/SoftwareApplication">
+ <meta itemprop="name" content="{{ pkg.pkgname|escape }}"/>
+ <meta itemprop="version" content="{{ pkg.full_version|escape }}"/>
+ <meta itemprop="softwareVersion" content="{{ pkg.full_version|escape }}"/>
+ <meta itemprop="fileSize" content="{{ pkg.compressed_size }}"/>
+ <meta itemprop="dateCreated" content="{{ pkg.build_date|date("Y-m-d") }}"/>
+ <meta itemprop="datePublished" content="{{ pkg.last_update|date("Y-m-d") }}"/>
+ <meta itemprop="operatingSystem" content="{{ BRANDING_DISTRONAME }}"/>
+ {% if pkg.packager %}<div style="display:none" itemprop="provider" itemscope itemtype="http://schema.org/Person">
+ <meta itemprop="name" content="{{ pkg.packager.get_full_name()|escape }}"/>
+ </div>{% endif %}
+ <table id="pkginfo">
+ <tr>
+ <th>Architecture:</th>
+ <td><a href="/packages/?arch={{ pkg.arch.name }}"
+ title="Browse packages for {{ pkg.arch.name }} architecture">{{ pkg.arch.name }}</a></td>
+ </tr><tr>
+ <th>Repository:</th>
+ <td><a href="/packages/?repo={{ pkg.repo.name|capfirst }}"
+ title="Browse the {{ pkg.repo.name|capfirst }} repository">{{ pkg.repo.name|capfirst }}</a></td>
+ </tr>
+ {% if pkg.pkgname == pkg.pkgbase %}
+ {% with splits = pkg.split_packages() %}{% if splits %}
+ <tr>
+ <th>Split Packages:</th>
+ <td class="wrap relatedto">{% for s in splits %}<span class="related">{{ details.details_link(s) }}{% if not loop.last %}, {% endif %}</span>{% endfor %}</td>
+ </tr>
+ {% endif %}{% endwith %}
+ {% else %}
+ <tr>
+ <th>Base Package:</th>
+ {% with base = pkg.base_package() %}{% if base %}
+ <td>{{ details.details_link(base) }}</td>
+ {% else %}
+ <td><a href="../{{ pkg.pkgbase }}/"
+ title="Split package details for {{ pkg.pkgbase }}">{{ pkg.pkgbase }}</a></td>
+ {% endif %}{% endwith %}
+ </tr>
+ {% endif %}
+ <tr>
+ <th>Description:</th>
+ <td class="wrap" itemprop="description">{{ pkg.pkgdesc|default("") }}</td>
+ </tr><tr>
+ <th>Upstream URL:</th>
+ <td>{% if pkg.url %}<a itemprop="url" href="{{ pkg.url }}"
+ title="Visit the website for {{ pkg.pkgname }}">{{ pkg.url|url_unquote }}</a>{% endif %}</td>
+ </tr><tr>
+ <th>License(s):</th>
+ <td class="wrap">{{ pkg.licenses.all()|join(", ") }}</td>
+ </tr>
+ {% with groups = pkg.groups.all() %}{% if groups %}
+ <tr>
+ <th>Groups:</th>
+ <td class="wrap">{% for g in groups %}
+ <a href="/groups/{{ pkg.arch.name }}/{{ g.name }}/"
+ title="Group details for {{ g.name }}">{{ g.name }}</a>{% if not loop.last %}, {% endif %}{% endfor %}
+ </td>
+ </tr>
+ {% endif %}{% endwith %}
+ {% with all_related = pkg.provides.all() %}{% if all_related %}
+ <tr>
+ <th>Provides:</th>
+ <td class="wrap relatedto">{% include "packages/details_relatedto.html.jinja" %}</td>
+ </tr>
+ {% endif %}{% endwith %}
+ {% with all_related = pkg.replaces.all() %}{% if all_related %}
+ <tr>
+ <th>Replaces:</th>
+ <td class="wrap relatedto">{% include "packages/details_relatedto.html.jinja" %}</td>
+ </tr>
+ {% endif %}{% endwith %}
+ {% with all_related = pkg.conflicts.all() %}{% if all_related %}
+ <tr>
+ <th>Conflicts:</th>
+ <td class="wrap relatedto">{% include "packages/details_relatedto.html.jinja" %}</td>
+ </tr>
+ {% endif %}{% endwith %}
+ {% with rev_conflicts = pkg.reverse_conflicts() %}{% if rev_conflicts %}
+ <tr>
+ <th>Reverse Conflicts:</th>
+ <td class="wrap relatedto">{% for conflict in rev_conflicts %}
+ <span class="related">{{ details.details_link(conflict) }}{% if not loop.last %}, {% endif %}</span>{% endfor %}</td>
+ </tr>
+ {% endif %}{% endwith %}
+ <tr>
+ <th>Maintainers:</th>
+ {% with maints = pkg.maintainers %}
+ <td>{% if maints %}{% for m in maints %}
+ <a href="/packages/?maintainer={{ m.username }}"
+ title="View packages maintained by {{ m.get_full_name() }}">{{ m.get_full_name() }}</a><br/>
+ {% endfor %}{% else %}Orphan{% endif %}
+ </td>
+ {% endwith %}
+ </tr><tr>
+ <th>Package Size:</th>
+ <td>{{ pkg.compressed_size|filesizeformat }}</td>
+ </tr><tr>
+ <th>Installed Size:</th>
+ <td>{{ pkg.installed_size|filesizeformat }}</td>
+ </tr><tr>
+ <th>Last Packager:</th>
+ <td>{% with pkgr = pkg.packager %}{% if pkgr %}
+ <a href="/packages/?packager={{ pkgr.username }}"
+ title="View packages packaged by {{ pkgr.get_full_name() }}">{{ pkgr.get_full_name() }}</a>
+ {% else %}{{ pkg.packager_str }}{% endif %}{% endwith %}</td>
+ </tr><tr>
+ <th>Build Date:</th>
+ <td>{{ pkg.build_date|date("DATETIME_FORMAT") }} UTC</td>
+ </tr>{% if pkg.signature %}<tr>
+ <th>Signed By:</th>
+ <td>{% with signer = pkg.signer %}{% if signer %}{{ pgp_key_link(pkg.signature.key_id, signer.get_full_name())|safe }}{% else %}Unknown ({{ pgp_key_link(pkg.signature.key_id)|safe }}){% endif %}{% endwith %}</td>
+ </tr><tr>
+ <th>Signature Date:</th>
+ <td>{{ pkg.signature.creation_time|date("DATETIME_FORMAT") }} UTC</td>
+ </tr>{% else %}<tr>
+ <th>Signed By:</th>
+ <td>Unsigned</td>
+ </tr>{% endif %}<tr>
+ <th>Last Updated:</th>
+ <td>{{ pkg.last_update|date("DATETIME_FORMAT") }} UTC</td>
+ </tr>
+ {% if user.is_authenticated() %}{% with flag_request = pkg.flag_request() %}{% if flag_request %}<tr>
+ <th>Last Flag Request:</th>
+ <td class="wrap">From {{ flag_request.who() }} on {{ flag_request.created|date }}:<br/>
+ <div class="userdata">{{ flag_request.message|linebreaksbr|default("{no message}") }}</div></td>
+ </tr>{% endif %}{% endwith %}{% endif %}
+ </table>
+ </div>
+
+ <div id="metadata">
+ {% with deps = pkg.get_depends() %}
+ <div id="pkgdeps" class="listing">
+ <h3 title="{{ pkg.pkgname }} has the following dependencies">
+ Dependencies ({{deps|length}})</h3>
+ {% if deps %}<ul id="pkgdepslist">
+ {% for depend in deps %}{% include "packages/details_depend.html.jinja" %}{% endfor %}
+ </ul>{% endif %}
+ </div>
+ {% endwith %}
+ {% with rqdby = pkg.get_requiredby() %}
+ <div id="pkgreqs" class="listing">
+ <h3 title="Packages that require {{ pkg.pkgname }}">
+ Required By ({{rqdby|length}})</h3>
+ {% if rqdby %}<ul id="pkgreqslist">
+ {% for req in rqdby %}{% include "packages/details_requiredby.html.jinja" %}{% endfor %}
+ </ul>{% endif %}
+ </div>
+ {% endwith %}
+ <div id="pkgfiles" class="listing">
+ <h3 title="Complete list of files contained within this package">
+ Package Contents</h3>
+ <div id="pkgfilelist">
+ <p><a id="filelink" href="files/"
+ title="Click to view the complete file list for {{ pkg.pkgname }}">
+ View the file list for {{ pkg.pkgname }}</a></p>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/templates/packages/details_depend.html b/templates/packages/details_depend.html.jinja
index b89ffbfa..404793b6 100644
--- a/templates/packages/details_depend.html
+++ b/templates/packages/details_depend.html.jinja
@@ -1,11 +1,11 @@
-{% load package_extras %}<li>{% ifequal depend.pkg None %}
-{% if depend.providers %}{{ depend.dep.name }}{{ depend.dep.comparison|default:"" }}{{ depend.dep.version|default:"" }} <span class="virtual-dep">({% multi_pkg_details depend.providers %})</span>
-{% else %}{{ depend.dep.name }}{{ depend.dep.comparison|default:"" }}{{ depend.dep.version|default:"" }} <span class="virtual-dep">(virtual)</span>
+{% import 'packages/details_link.html.jinja' as details %}<li>{% if depend.pkg == None %}
+{% if depend.providers %}{{ depend.dep.name }}{{ depend.dep.comparison|default("") }}{{ depend.dep.version|default("") }} <span class="virtual-dep">({% for pkg in depend.providers %}{{ details.details_link(pkg) }}{% if not loop.last %}, {% endif %}{% endfor %})</span>
+{% else %}{{ depend.dep.name }}{{ depend.dep.comparison|default("") }}{{ depend.dep.version|default("") }} <span class="virtual-dep">(virtual)</span>
{% endif %}{% else %}
-{% pkg_details_link depend.pkg %}{{ depend.dep.comparison|default:"" }}{{ depend.dep.version|default:"" }}
+{{ details.details_link(depend.pkg) }}{{ depend.dep.comparison|default("") }}{{ depend.dep.version|default("") }}
{% if depend.pkg.repo.testing %} <span class="testing-dep"> (testing)</span>
{% endif %}{% if depend.pkg.repo.staging %} <span class="staging-dep"> (staging)</span>
-{% endif %}{% endifequal %}
+{% endif %}{% endif %}
{% if depend.dep.deptype == 'O' %} <span class="opt-dep"> (optional)</span>
{% endif %}{% if depend.dep.deptype == 'M' %} <span class="make-dep"> (make)</span>
{% endif %}{% if depend.dep.deptype == 'C' %} <span class="check-dep"> (check)</span>
diff --git a/templates/packages/details_link.html.jinja b/templates/packages/details_link.html.jinja
new file mode 100644
index 00000000..b7e75fe5
--- /dev/null
+++ b/templates/packages/details_link.html.jinja
@@ -0,0 +1 @@
+{% macro details_link(pkg) %}<a href="{{ pkg.get_absolute_url() }}" title="View package details for {{ pkg.pkgname }}">{{ pkg.pkgname }}</a>{% endmacro %}
diff --git a/templates/packages/details_relatedto.html b/templates/packages/details_relatedto.html
deleted file mode 100644
index e14375d3..00000000
--- a/templates/packages/details_relatedto.html
+++ /dev/null
@@ -1,2 +0,0 @@
-{% load package_extras %}{% for related in all_related %}{% with related.get_best_satisfier as best_satisfier %}<span class="related">{% ifequal best_satisfier None %}{{ related.name }}{% else %}{% pkg_details_link best_satisfier %}{% endifequal %}{{ related.comparison|default:"" }}{{ related.version|default:"" }}{% if not forloop.last %}, {% endif %}</span>
-{% endwith %}{% endfor %}
diff --git a/templates/packages/details_relatedto.html.jinja b/templates/packages/details_relatedto.html.jinja
new file mode 100644
index 00000000..955fdd37
--- /dev/null
+++ b/templates/packages/details_relatedto.html.jinja
@@ -0,0 +1,3 @@
+{% import 'packages/details_link.html.jinja' as details %}{% for related in all_related %}{% with best_satisfier = related.get_best_satisfier() %}
+<span class="related">{% if best_satisfier == None %}{{ related.name }}{% else %}{{ details.details_link(best_satisfier) }}{% endif %}{{ related.comparison|default("") }}{{ related.version|default("") }}{% if not loop.last %}, {% endif %}</span>
+{% endwith %}{% endfor %}
diff --git a/templates/packages/details_requiredby.html b/templates/packages/details_requiredby.html.jinja
index 504a322f..b083a7fc 100644
--- a/templates/packages/details_requiredby.html
+++ b/templates/packages/details_requiredby.html.jinja
@@ -1,4 +1,4 @@
-{% load package_extras %}<li>{% pkg_details_link req.pkg %}
+{% import 'packages/details_link.html.jinja' as details %}<li>{{ details.details_link(req.pkg) }}
{% if req.name != pkg.pkgname %}<span class="virtual-dep"> (requires {{ req.name }})</span>
{% endif %}{% if req.pkg.repo.testing %}<span class="testing-dep"> (testing)</span>
{% endif %}{% if req.pkg.repo.staging %}<span class="staging-dep"> (staging)</span>
diff --git a/templates/packages/files.html b/templates/packages/files.html
index e2987e5f..667a77cb 100644
--- a/templates/packages/files.html
+++ b/templates/packages/files.html
@@ -9,7 +9,7 @@
<p>Package has {{ files_count }} file{{ files_count|pluralize }} and {{ dir_count }} director{{ dir_count|pluralize:"y,ies" }}.</p>
<p><a href="{{ pkg.get_absolute_url }}">Back to Package</a></p>
<div id="metadata"><div id="pkgfilelist">
- {% include "packages/files_list.html" %}
+ {% include "packages/files_list.html.jinja" %}
</div></div>
</div>
diff --git a/templates/packages/files_list.html b/templates/packages/files_list.html.jinja
index 93a2c847..c8fc3b1a 100644
--- a/templates/packages/files_list.html
+++ b/templates/packages/files_list.html.jinja
@@ -6,7 +6,7 @@ of the package; it may be out of date.</p>
{% if files|length %}
<ul>
{% for file in files %}
-<li class="{% if file.is_directory %}d{% else %}f{% endif %}">{{ file.directory }}{{ file.filename|default:'' }}</li>{% endfor %}
+<li class="{% if file.is_directory %}d{% else %}f{% endif %}">{{ file.directory }}{{ file.filename|default('') }}</li>{% endfor %}
</ul>
{% else %}
<p class="message">Package has no files.</p>
diff --git a/templates/packages/search.html b/templates/packages/search.html
index 29dddeb3..41e36193 100644
--- a/templates/packages/search.html
+++ b/templates/packages/search.html
@@ -2,7 +2,7 @@
{% load cycle from future %}
{% load package_extras %}
-{% block title %}{{ BRANDING_DISTRONAME }} - Package Database{% endblock %}
+{% block title %}{{ BRANDING_DISTRONAME }} - Package Search{% endblock %}
{% block navbarclass %}anb-packages{% endblock %}
{% block head %}
@@ -12,10 +12,7 @@
{% block content %}
<div id="pkglist-search" class="box filter-criteria">
-
- <h2>Package Database</h2>
-
- <h3>Package Search</h3>
+ <h2>Package Search</h2>
<form id="pkg-search" method="get" action="/packages/">
<p>{{ search_form.sort }}</p>
@@ -41,14 +38,49 @@
type="submit" value="Search" /></div>
</fieldset>
</form>
+</div>
-</div><!-- #pkglist-search -->
+{% if not is_paginated or page_obj.number == 1 %}{% with search_form.exact_matches as exact_matches %}{% if exact_matches %}
+<div id="exact-matches" class="box">
+ <div class="pkglist-stats">
+ <p>{{ exact_matches|length }} exact match{{ exact_matches|pluralize:"es" }} found.</p>
+ </div>
+ <table class="results">
+ <thead>
+ <tr>
+ <th>Arch</th>
+ <th>Repo</th>
+ <th>Name</th>
+ <th>Version</th>
+ <th>Description</th>
+ <th>Last Updated</th>
+ <th>Flag Date</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for pkg in exact_matches %}
+ <tr class="{% cycle 'odd' 'even' %}">
+ <td>{{ pkg.arch.name }}</td>
+ <td>{{ pkg.repo.name|capfirst }}</td>
+ <td>{% pkg_details_link pkg %}</td>
+ {% if pkg.flag_date %}
+ <td><span class="flagged">{{ pkg.full_version }}</span></td>
+ {% else %}
+ <td>{{ pkg.full_version }}</td>
+ {% endif %}
+ <td class="wrap">{{ pkg.pkgdesc }}</td>
+ <td>{{ pkg.last_update|date }}</td>
+ <td>{{ pkg.flag_date|date }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+</div>
+{% endif %}{% endwith %}{% endif %}
-{% if package_list %}
<div id="pkglist-results" class="box">
{% include "packages/search_paginator.html" %}
<form id="pkglist-results-form" method="post" action="/packages/update/">{% csrf_token %}
-
<table class="results">
<thead>
<tr>
@@ -70,7 +102,8 @@
</tr>
</thead>
<tbody>
- {% for pkg in package_list %}<tr class="{% cycle 'odd' 'even' %}">
+ {% for pkg in package_list %}
+ <tr class="{% cycle 'odd' 'even' %}">
{% if perms.main.change_package %}
<td><input type="checkbox" name="pkgid" value="{{ pkg.id }}" /></td>
{% endif %}
@@ -85,7 +118,10 @@
<td class="wrap">{{ pkg.pkgdesc }}</td>
<td>{{ pkg.last_update|date }}</td>
<td>{{ pkg.flag_date|date }}</td>
- </tr>{% endfor %}
+ </tr>
+ {% empty %}
+ <tr class="empty"><td colspan="{% if perms.main.change_package %}9{% else %}8{% endif %}"><em>No matching packages found</em></td></tr>
+ {% endfor %}
</tbody>
</table>
{% include "packages/search_paginator.html" %}
@@ -96,18 +132,12 @@
<input title="Orphan selected packages" type="submit" id="disown-btn"
name="disown" value="Disown Packages" /></p>
{% endif %}
-
</form>
-
-</div><!-- #pkglist-results -->
-{% else %}
-<div class="box">
- <p>We couldn't find any packages matching your query. Try searching again
- using different criteria.</p>
</div>
-{% endif %}
-
<div id="pkglist-about" class="box">
+ <p>Can't find what you are looking for? Try searching again
+ using different criteria.</p>
+
<p>You are browsing the {{ BRANDING_DISTRONAME }} package database. From here you can find
detailed information about packages located in the official supported repositories.
If you need the sourceball from where a package is built, you can look at our <a
diff --git a/templates/packages/search_paginator.html b/templates/packages/search_paginator.html
index 3c368b82..a748d26b 100644
--- a/templates/packages/search_paginator.html
+++ b/templates/packages/search_paginator.html
@@ -1,6 +1,6 @@
<div class="pkglist-stats">
{% if is_paginated %}
- <p>{{ paginator.count }} packages found.
+ <p>{{ paginator.count }} matching packages found.
Page {{ page_obj.number }} of {{ paginator.num_pages }}.</p>
<div class="pkglist-nav">
@@ -22,6 +22,6 @@
</span>
</div>
{% else %}
- <p>{{ package_list.count }} packages found.</p>
+ <p>{{ package_list|length }} matching package{{ package_list|pluralize }} found.</p>
{% endif %}
</div>
diff --git a/templates/packages/stale_relations.html b/templates/packages/stale_relations.html
index 91ea033e..949b563e 100644
--- a/templates/packages/stale_relations.html
+++ b/templates/packages/stale_relations.html
@@ -37,7 +37,7 @@
<td>{{ relation.created }}</td>
</tr>
{% empty %}
- <tr class="empty"><td colspan="5"><em>No inactive user relations.</em></td></tr>
+ <tr class="empty"><td colspan="6"><em>No inactive user relations.</em></td></tr>
{% endfor %}
</tbody>
</table>
@@ -66,7 +66,7 @@
<td>{{ relation.last_update.created }}</td>
</tr>
{% empty %}
- <tr class="empty"><td colspan="4"><em>No non-existent pkgbase relations.</em></td></tr>
+ <tr class="empty"><td colspan="6"><em>No non-existent pkgbase relations.</em></td></tr>
{% endfor %}
</tbody>
</table>
@@ -100,7 +100,7 @@
<td class="wrap">{{ relation.repositories|join:", " }}</td>
</tr>
{% empty %}
- <tr class="empty"><td colspan="6"><em>No relations with wrong permissions.</em></td></tr>
+ <tr class="empty"><td colspan="7"><em>No relations with wrong permissions.</em></td></tr>
{% endfor %}
</tbody>
</table>
@@ -117,13 +117,13 @@
<script type="text/javascript" src="{% static "archweb.js" %}"></script>
<script type="text/javascript">
$(document).ready(function() {
- $('#inactive-user:not(:has(tbody tr.empty))').tablesorter({widgets: ['zebra'], headers: { 0: { sorter: false } }, sortList: [[3,0]]});
+ $('#inactive-user:not(:has(tbody tr.empty))').tablesorter({widgets: ['zebra'], headers: { 0: { sorter: false }, 2: { sorter: false } }, sortList: [[1,0]]});
$('#missing-pkgbase:not(:has(tbody tr.empty))').tablesorter({widgets: ['zebra'], headers: { 0: { sorter: false } }, sortList: [[1,0]]});
-});
- $('#wrong-permissions:not(:has(tbody tr.empty))').tablesorter({widgets: ['zebra'], headers: { 0: { sorter: false } }, sortList: [[3,0]]});
+ $('#wrong-permissions:not(:has(tbody tr.empty))').tablesorter({widgets: ['zebra'], headers: { 0: { sorter: false }, 2: { sorter: false } }, sortList: [[1,0]]});
$('table.results').bind('sortEnd', function() {
$('input.relation-checkbox').enableCheckboxRangeSelection();
});
$('input.relation-checkbox').enableCheckboxRangeSelection();
+});
</script>
{% endblock %}
diff --git a/templates/public/index.html b/templates/public/index.html
index 64d19e6d..e7174b45 100644
--- a/templates/public/index.html
+++ b/templates/public/index.html
@@ -110,7 +110,6 @@
{% cache 115 main-page-right secure %}
<div id="nav-sidebar" class="widget">
<h4>Documentation</h4>
-
<ul>
<li><a href="{% wiki_url %}"
title="Community documentation">Wiki</a></li>
@@ -123,7 +122,6 @@
</ul>
<h4>Community</h4>
-
<ul>
<li><a href="{{ MAILMAN_BASE_URL }}/mailman/listinfo/"
title="Community and developer mailing lists">Mailing Lists</a></li>
@@ -134,14 +132,12 @@
</ul>
<h4>Support</h4>
-
<ul>
<li><a href="{% url 'page-donate' %}"
title="Help support {{ BRANDING_DISTRONAME }}">Donate</a></li>
</ul>
<h4>Tools</h4>
-
<ul>
<li><a href="{% url 'mirrorlist' %}"
title="Get a custom mirrorlist from our database">Mirrorlist Updater</a></li>
@@ -149,12 +145,9 @@
title="See a listing of all available mirrors">Mirror List</a></li>
<li><a href="{% url 'mirror-status' %}"
title="Check the status of all known mirrors">Mirror Status</a></li>
- <li><a href="{% url 'packages-differences' %}"
- title="See differences in packages between available architectures">Differences Reports</a></li>
</ul>
<h4>Development</h4>
-
<ul>
<li><a href="{{ PROJECTS_URL }}"
title="Official {{BRANDING_SHORTNAME}} projects (git)">Projects in Git</a></li>
@@ -172,22 +165,26 @@
title="Release Engineering ISO listing">ISO Release List</a></li>
<li><a href="{% url 'visualize-index' %}"
title="View visualizations">Visualizations</a></li>
+ <li><a href="{% url 'packages-differences' %}"
+ title="See differences in packages between available architectures">Differences Reports</a></li>
</ul>
- <h4>More Resources</h4>
-
+ <h4>People</h4>
<ul>
+ <li><a href="{% url 'page-devs' %}" title="Active hackers">Hackers</a></li>
+ <li><a href="{% url 'page-fellows' %}" title="Retired hackers">Fellows</a></li>
<li><a href="{% url 'page-keys' %}"
title="Package/Database signing master keys">Signing Master Keys</a></li>
+ </ul>
+
+ <h4>More Resources</h4>
+ <ul>
<li><a href="{% wiki_url 'Media' %}"
title="{{ BRANDING_DISTRONAME }} in the media">Press Coverage</a></li>
<li><a href="{% url 'page-art' %}" title="{{ BRANDING_SHORTNAME }} logos and other artwork for promotional use">Logos &amp; Artwork</a></li>
<li><a href="{% url 'news-list' %}" title="News Archives">News Archives</a></li>
<li><a href="/feeds/" title="Various RSS Feeds">RSS Feeds</a></li>
- <li><a href="{% url 'page-devs' %}" title="Active hackers">Hackers Profiles</a></li>
- <li><a href="{% url 'page-fellows' %}" title="Retired hackers">Fellows Profiles</a></li>
</ul>
-
</div>
{% comment %}
@@ -227,44 +224,8 @@ donate button would go here
{% load cdn %}{% jquery %}
<script type="text/javascript">
-function setupTypeahead() {
- $('#pkgsearch-field').typeahead({
- source: function(query, callback) {
- $.getJSON('/opensearch/packages/suggest', {q: query}, function(data) {
- callback(data[1]);
- });
- },
- matcher: function(item) { return true; },
- sorter: function(items) { return items; },
- menu: '<ul class="pkgsearch-typeahead"></ul>',
- items: 10,
- updater: function(item) {
- $('#pkgsearch-field').val(item);
- $('#pkgsearch-form').submit();
- return item;
- }
- }).attr('autocomplete', 'off');
- $('#pkgsearch-field').keyup(function(e) {
- if (e.keyCode === 13 &&
- $('ul.pkgsearch-typeahead li.active').size() === 0) {
- $('#pkgsearch-form').submit();
- }
- });
-}
-function setupKonami() {
- var konami = new Konami(function() {
- $('#konami').html('<img src="{% static "vector_tux.png" %}" alt=""/>');
- setTimeout(function() {
- $('#konami').fadeIn(500);
- }, 500);
- $('#konami').click(function() {
- $('#konami').fadeOut(500);
- });
- });
-}
$(document).ready(function() {
- $.ajax({ url: "{% static "bootstrap-typeahead.min.js" %}", cache: true, dataType: "script", success: setupTypeahead });
- $.ajax({ url: "{% static "konami.min.js" %}", cache: true, dataType: "script", success: setupKonami });
+ $.ajax({ url: "{% static "homepage.js" %}", cache: true, dataType: "script", success: function() { setupTypeahead(); setupKonami("{% static "vector_tux.png" %}"); } });
});
</script>
{% endblock %}
diff --git a/todolists/utils.py b/todolists/utils.py
index 7b98c887..e04c2e5e 100644
--- a/todolists/utils.py
+++ b/todolists/utils.py
@@ -6,7 +6,7 @@ from packages.models import Package
def todo_counts():
sql = """
-SELECT todolist_id, count(*), sum(CASE WHEN status = %s THEN 1 ELSE 0 END)
+SELECT todolist_id, count(*), SUM(CASE WHEN status = %s THEN 1 ELSE 0 END)
FROM todolists_todolistpackage
WHERE removed IS NULL
GROUP BY todolist_id
diff --git a/urls.py b/urls.py
index 4bd27ec2..506b83ef 100644
--- a/urls.py
+++ b/urls.py
@@ -40,20 +40,19 @@ urlpatterns += patterns('public.views',
# Feeds patterns, used below
feeds_patterns = patterns('',
(r'^$', 'public.views.feeds', {}, 'feeds-list'),
- (r'^news/$', cache_page(300)(NewsFeed())),
- (r'^packages/$', cache_page(300)(PackageFeed())),
+ (r'^news/$', cache_page(311)(NewsFeed())),
+ (r'^packages/$', cache_page(313)(PackageFeed())),
(r'^packages/(?P<arch>[A-z0-9]+)/$',
- cache_page(300)(PackageFeed())),
+ cache_page(313)(PackageFeed())),
(r'^packages/all/(?P<repo>[A-z0-9\-]+)/$',
- cache_page(300)(PackageFeed())),
+ cache_page(313)(PackageFeed())),
(r'^packages/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$',
- cache_page(300)(PackageFeed())),
- (r'^releases/$', cache_page(300)(ReleaseFeed())),
+ cache_page(313)(PackageFeed())),
+ (r'^releases/$', cache_page(317)(ReleaseFeed())),
)
# Includes and other remaining stuff
urlpatterns += patterns('',
- # cache this static JS resource for 1 week rather than default 5 minutes
(r'^admin/', include(admin.site.urls)),
(r'^devel/', include('devel.urls')),
(r'^feeds/', include(feeds_patterns)),
@@ -74,10 +73,10 @@ urlpatterns += patterns('',
# Sitemaps
urlpatterns += patterns('',
(r'^sitemap.xml$',
- cache_page(1800)(sitemap_views.index),
+ cache_page(1831)(sitemap_views.index),
{'sitemaps': our_sitemaps, 'sitemap_url_name': 'sitemaps'}),
(r'^sitemap-(?P<section>.+)\.xml$',
- cache_page(1800)(sitemap_views.sitemap),
+ cache_page(1831)(sitemap_views.sitemap),
{'sitemaps': our_sitemaps}, 'sitemaps'),
)
diff --git a/visualize/.gitignore b/visualize/.gitignore
new file mode 100644
index 00000000..943783c0
--- /dev/null
+++ b/visualize/.gitignore
@@ -0,0 +1,2 @@
+visualize/static/d3-3.0.6.js
+visualize/static/d3-3.0.6.min.js
diff --git a/visualize/static/Makefile b/visualize/static/Makefile
deleted file mode 100644
index 9a7f9828..00000000
--- a/visualize/static/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-include ../../common.mk
-
-d3-ver=3.0.6
-targets = d3-$(d3-ver)
-
-target-files=$(addsuffix .js,$(targets)) $(addsuffix .min.js,$(targets))
-all: $(target-files)
-clean:
- rm -f -- $(target-files)
-
-d3-$(d3-ver).js: %: \
- $(www)/https/raw.github.com/mbostock/d3/v$(d3-ver)/d3.js \
- $(www)/https/raw.github.com/mbostock/d3/v$(d3-ver)/LICENSE
- { \
- echo '/*! $@ - Data Driven Documents' && \
- echo ' * Version: $(d3-ver)' && \
- echo ' * Homepage: http://mbostock.github.com/d3/' && \
- echo ' * Copyright: 2012, Michael Bostock' && \
- echo ' * Licence: 3-Clause BSD' && \
- echo ' *' && \
- sed 's/.*/ * &/' $(<D)/LICENSE && \
- echo ' */' && \
- cat $< ;} > $@
diff --git a/visualize/static/d3-3.0.6.js b/visualize/static/d3-3.0.6.js
deleted file mode 100644
index 77132218..00000000
--- a/visualize/static/d3-3.0.6.js
+++ /dev/null
@@ -1,7823 +0,0 @@
-/*! d3-3.0.6.js - Data Driven Documents
- * Version: 3.0.6
- * Homepage: http://mbostock.github.com/d3/
- * Copyright: 2012, Michael Bostock
- * Licence: 3-Clause BSD
- *
- * Copyright (c) 2012, Michael Bostock
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * * The name Michael Bostock may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-d3 = function() {
- var π = Math.PI, ε = 1e-6, d3 = {
- version: "3.0.6"
- }, d3_radians = π / 180, d3_degrees = 180 / π, d3_document = document, d3_window = window;
- function d3_target(d) {
- return d.target;
- }
- function d3_source(d) {
- return d.source;
- }
- var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ];
- if (!Date.now) Date.now = function() {
- return +new Date();
- };
- try {
- d3_document.createElement("div").style.setProperty("opacity", 0, "");
- } catch (error) {
- var d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
- d3_style_prototype.setProperty = function(name, value, priority) {
- d3_style_setProperty.call(this, name, value + "", priority);
- };
- }
- function d3_class(ctor, properties) {
- try {
- for (var key in properties) {
- Object.defineProperty(ctor.prototype, key, {
- value: properties[key],
- enumerable: false
- });
- }
- } catch (e) {
- ctor.prototype = properties;
- }
- }
- var d3_array = d3_arraySlice;
- function d3_arrayCopy(pseudoarray) {
- var i = -1, n = pseudoarray.length, array = [];
- while (++i < n) array.push(pseudoarray[i]);
- return array;
- }
- function d3_arraySlice(pseudoarray) {
- return Array.prototype.slice.call(pseudoarray);
- }
- try {
- d3_array(d3_document.documentElement.childNodes)[0].nodeType;
- } catch (e) {
- d3_array = d3_arrayCopy;
- }
- var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
- array.__proto__ = prototype;
- } : function(array, prototype) {
- for (var property in prototype) array[property] = prototype[property];
- };
- d3.map = function(object) {
- var map = new d3_Map();
- for (var key in object) map.set(key, object[key]);
- return map;
- };
- function d3_Map() {}
- d3_class(d3_Map, {
- has: function(key) {
- return d3_map_prefix + key in this;
- },
- get: function(key) {
- return this[d3_map_prefix + key];
- },
- set: function(key, value) {
- return this[d3_map_prefix + key] = value;
- },
- remove: function(key) {
- key = d3_map_prefix + key;
- return key in this && delete this[key];
- },
- keys: function() {
- var keys = [];
- this.forEach(function(key) {
- keys.push(key);
- });
- return keys;
- },
- values: function() {
- var values = [];
- this.forEach(function(key, value) {
- values.push(value);
- });
- return values;
- },
- entries: function() {
- var entries = [];
- this.forEach(function(key, value) {
- entries.push({
- key: key,
- value: value
- });
- });
- return entries;
- },
- forEach: function(f) {
- for (var key in this) {
- if (key.charCodeAt(0) === d3_map_prefixCode) {
- f.call(this, key.substring(1), this[key]);
- }
- }
- }
- });
- var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
- function d3_identity(d) {
- return d;
- }
- function d3_true() {
- return true;
- }
- function d3_functor(v) {
- return typeof v === "function" ? v : function() {
- return v;
- };
- }
- d3.functor = d3_functor;
- d3.rebind = function(target, source) {
- var i = 1, n = arguments.length, method;
- while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
- return target;
- };
- function d3_rebind(target, source, method) {
- return function() {
- var value = method.apply(source, arguments);
- return arguments.length ? target : value;
- };
- }
- d3.ascending = function(a, b) {
- return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
- };
- d3.descending = function(a, b) {
- return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
- };
- d3.mean = function(array, f) {
- var n = array.length, a, m = 0, i = -1, j = 0;
- if (arguments.length === 1) {
- while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
- } else {
- while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
- }
- return j ? m : undefined;
- };
- d3.median = function(array, f) {
- if (arguments.length > 1) array = array.map(f);
- array = array.filter(d3_number);
- return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
- };
- d3.min = function(array, f) {
- var i = -1, n = array.length, a, b;
- if (arguments.length === 1) {
- while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
- while (++i < n) if ((b = array[i]) != null && a > b) a = b;
- } else {
- while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
- }
- return a;
- };
- d3.max = function(array, f) {
- var i = -1, n = array.length, a, b;
- if (arguments.length === 1) {
- while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
- while (++i < n) if ((b = array[i]) != null && b > a) a = b;
- } else {
- while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
- }
- return a;
- };
- d3.extent = function(array, f) {
- var i = -1, n = array.length, a, b, c;
- if (arguments.length === 1) {
- while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
- while (++i < n) if ((b = array[i]) != null) {
- if (a > b) a = b;
- if (c < b) c = b;
- }
- } else {
- while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
- while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
- if (a > b) a = b;
- if (c < b) c = b;
- }
- }
- return [ a, c ];
- };
- d3.random = {
- normal: function(µ, σ) {
- var n = arguments.length;
- if (n < 2) σ = 1;
- if (n < 1) µ = 0;
- return function() {
- var x, y, r;
- do {
- x = Math.random() * 2 - 1;
- y = Math.random() * 2 - 1;
- r = x * x + y * y;
- } while (!r || r > 1);
- return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
- };
- },
- logNormal: function() {
- var random = d3.random.normal.apply(d3, arguments);
- return function() {
- return Math.exp(random());
- };
- },
- irwinHall: function(m) {
- return function() {
- for (var s = 0, j = 0; j < m; j++) s += Math.random();
- return s / m;
- };
- }
- };
- function d3_number(x) {
- return x != null && !isNaN(x);
- }
- d3.sum = function(array, f) {
- var s = 0, n = array.length, a, i = -1;
- if (arguments.length === 1) {
- while (++i < n) if (!isNaN(a = +array[i])) s += a;
- } else {
- while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
- }
- return s;
- };
- d3.quantile = function(values, p) {
- var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;
- return e ? v + e * (values[h] - v) : v;
- };
- d3.shuffle = function(array) {
- var m = array.length, t, i;
- while (m) {
- i = Math.random() * m-- | 0;
- t = array[m], array[m] = array[i], array[i] = t;
- }
- return array;
- };
- d3.transpose = function(matrix) {
- return d3.zip.apply(d3, matrix);
- };
- d3.zip = function() {
- if (!(n = arguments.length)) return [];
- for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
- for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
- zip[j] = arguments[j][i];
- }
- }
- return zips;
- };
- function d3_zipLength(d) {
- return d.length;
- }
- d3.bisector = function(f) {
- return {
- left: function(a, x, lo, hi) {
- if (arguments.length < 3) lo = 0;
- if (arguments.length < 4) hi = a.length;
- while (lo < hi) {
- var mid = lo + hi >>> 1;
- if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
- }
- return lo;
- },
- right: function(a, x, lo, hi) {
- if (arguments.length < 3) lo = 0;
- if (arguments.length < 4) hi = a.length;
- while (lo < hi) {
- var mid = lo + hi >>> 1;
- if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
- }
- return lo;
- }
- };
- };
- var d3_bisector = d3.bisector(function(d) {
- return d;
- });
- d3.bisectLeft = d3_bisector.left;
- d3.bisect = d3.bisectRight = d3_bisector.right;
- d3.nest = function() {
- var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
- function map(array, depth) {
- if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
- var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map(), values, o = {};
- while (++i < n) {
- if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
- values.push(object);
- } else {
- valuesByKey.set(keyValue, [ object ]);
- }
- }
- valuesByKey.forEach(function(keyValue, values) {
- o[keyValue] = map(values, depth);
- });
- return o;
- }
- function entries(map, depth) {
- if (depth >= keys.length) return map;
- var a = [], sortKey = sortKeys[depth++], key;
- for (key in map) {
- a.push({
- key: key,
- values: entries(map[key], depth)
- });
- }
- if (sortKey) a.sort(function(a, b) {
- return sortKey(a.key, b.key);
- });
- return a;
- }
- nest.map = function(array) {
- return map(array, 0);
- };
- nest.entries = function(array) {
- return entries(map(array, 0), 0);
- };
- nest.key = function(d) {
- keys.push(d);
- return nest;
- };
- nest.sortKeys = function(order) {
- sortKeys[keys.length - 1] = order;
- return nest;
- };
- nest.sortValues = function(order) {
- sortValues = order;
- return nest;
- };
- nest.rollup = function(f) {
- rollup = f;
- return nest;
- };
- return nest;
- };
- d3.keys = function(map) {
- var keys = [];
- for (var key in map) keys.push(key);
- return keys;
- };
- d3.values = function(map) {
- var values = [];
- for (var key in map) values.push(map[key]);
- return values;
- };
- d3.entries = function(map) {
- var entries = [];
- for (var key in map) entries.push({
- key: key,
- value: map[key]
- });
- return entries;
- };
- d3.permute = function(array, indexes) {
- var permutes = [], i = -1, n = indexes.length;
- while (++i < n) permutes[i] = array[indexes[i]];
- return permutes;
- };
- d3.merge = function(arrays) {
- return Array.prototype.concat.apply([], arrays);
- };
- function d3_collapse(s) {
- return s.trim().replace(/\s+/g, " ");
- }
- d3.range = function(start, stop, step) {
- if (arguments.length < 3) {
- step = 1;
- if (arguments.length < 2) {
- stop = start;
- start = 0;
- }
- }
- if ((stop - start) / step === Infinity) throw new Error("infinite range");
- var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
- start *= k, stop *= k, step *= k;
- if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
- return range;
- };
- function d3_range_integerScale(x) {
- var k = 1;
- while (x * k % 1) k *= 10;
- return k;
- }
- d3.requote = function(s) {
- return s.replace(d3_requote_re, "\\$&");
- };
- var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
- d3.round = function(x, n) {
- return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
- };
- d3.xhr = function(url, mimeType, callback) {
- var xhr = {}, dispatch = d3.dispatch("progress", "load", "error"), headers = {}, response = d3_identity, request = new (d3_window.XDomainRequest && /^(http(s)?:)?\/\//.test(url) ? XDomainRequest : XMLHttpRequest)();
- "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {
- request.readyState > 3 && respond();
- };
- function respond() {
- var s = request.status;
- !s && request.responseText || s >= 200 && s < 300 || s === 304 ? dispatch.load.call(xhr, response.call(xhr, request)) : dispatch.error.call(xhr, request);
- }
- request.onprogress = function(event) {
- var o = d3.event;
- d3.event = event;
- try {
- dispatch.progress.call(xhr, request);
- } finally {
- d3.event = o;
- }
- };
- xhr.header = function(name, value) {
- name = (name + "").toLowerCase();
- if (arguments.length < 2) return headers[name];
- if (value == null) delete headers[name]; else headers[name] = value + "";
- return xhr;
- };
- xhr.mimeType = function(value) {
- if (!arguments.length) return mimeType;
- mimeType = value == null ? null : value + "";
- return xhr;
- };
- xhr.response = function(value) {
- response = value;
- return xhr;
- };
- [ "get", "post" ].forEach(function(method) {
- xhr[method] = function() {
- return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments)));
- };
- });
- xhr.send = function(method, data, callback) {
- if (arguments.length === 2 && typeof data === "function") callback = data, data = null;
- request.open(method, url, true);
- if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*";
- if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);
- if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);
- if (callback != null) xhr.on("error", callback).on("load", function(request) {
- callback(null, request);
- });
- request.send(data == null ? null : data);
- return xhr;
- };
- xhr.abort = function() {
- request.abort();
- return xhr;
- };
- d3.rebind(xhr, dispatch, "on");
- if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType,
- mimeType = null;
- return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));
- };
- function d3_xhr_fixCallback(callback) {
- return callback.length === 1 ? function(error, request) {
- callback(error == null ? request : null);
- } : callback;
- }
- d3.text = function() {
- return d3.xhr.apply(d3, arguments).response(d3_text);
- };
- function d3_text(request) {
- return request.responseText;
- }
- d3.json = function(url, callback) {
- return d3.xhr(url, "application/json", callback).response(d3_json);
- };
- function d3_json(request) {
- return JSON.parse(request.responseText);
- }
- d3.html = function(url, callback) {
- return d3.xhr(url, "text/html", callback).response(d3_html);
- };
- function d3_html(request) {
- var range = d3_document.createRange();
- range.selectNode(d3_document.body);
- return range.createContextualFragment(request.responseText);
- }
- d3.xml = function() {
- return d3.xhr.apply(d3, arguments).response(d3_xml);
- };
- function d3_xml(request) {
- return request.responseXML;
- }
- var d3_nsPrefix = {
- svg: "http://www.w3.org/2000/svg",
- xhtml: "http://www.w3.org/1999/xhtml",
- xlink: "http://www.w3.org/1999/xlink",
- xml: "http://www.w3.org/XML/1998/namespace",
- xmlns: "http://www.w3.org/2000/xmlns/"
- };
- d3.ns = {
- prefix: d3_nsPrefix,
- qualify: function(name) {
- var i = name.indexOf(":"), prefix = name;
- if (i >= 0) {
- prefix = name.substring(0, i);
- name = name.substring(i + 1);
- }
- return d3_nsPrefix.hasOwnProperty(prefix) ? {
- space: d3_nsPrefix[prefix],
- local: name
- } : name;
- }
- };
- d3.dispatch = function() {
- var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
- while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
- return dispatch;
- };
- function d3_dispatch() {}
- d3_dispatch.prototype.on = function(type, listener) {
- var i = type.indexOf("."), name = "";
- if (i > 0) {
- name = type.substring(i + 1);
- type = type.substring(0, i);
- }
- return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
- };
- function d3_dispatch_event(dispatch) {
- var listeners = [], listenerByName = new d3_Map();
- function event() {
- var z = listeners, i = -1, n = z.length, l;
- while (++i < n) if (l = z[i].on) l.apply(this, arguments);
- return dispatch;
- }
- event.on = function(name, listener) {
- var l = listenerByName.get(name), i;
- if (arguments.length < 2) return l && l.on;
- if (l) {
- l.on = null;
- listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
- listenerByName.remove(name);
- }
- if (listener) listeners.push(listenerByName.set(name, {
- on: listener
- }));
- return dispatch;
- };
- return event;
- }
- d3.format = function(specifier) {
- var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", basePrefix = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
- if (precision) precision = +precision.substring(1);
- if (zfill || fill === "0" && align === "=") {
- zfill = fill = "0";
- align = "=";
- if (comma) width -= Math.floor((width - 1) / 4);
- }
- switch (type) {
- case "n":
- comma = true;
- type = "g";
- break;
-
- case "%":
- scale = 100;
- suffix = "%";
- type = "f";
- break;
-
- case "p":
- scale = 100;
- suffix = "%";
- type = "r";
- break;
-
- case "b":
- case "o":
- case "x":
- case "X":
- if (basePrefix) basePrefix = "0" + type.toLowerCase();
-
- case "c":
- case "d":
- integer = true;
- precision = 0;
- break;
-
- case "s":
- scale = -1;
- type = "r";
- break;
- }
- if (basePrefix === "#") basePrefix = "";
- if (type == "r" && !precision) type = "g";
- type = d3_format_types.get(type) || d3_format_typeDefault;
- var zcomma = zfill && comma;
- return function(value) {
- if (integer && value % 1) return "";
- var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign;
- if (scale < 0) {
- var prefix = d3.formatPrefix(value, precision);
- value = prefix.scale(value);
- suffix = prefix.symbol;
- } else {
- value *= scale;
- }
- value = type(value, precision);
- if (!zfill && comma) value = d3_format_group(value);
- var length = basePrefix.length + value.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
- if (zcomma) value = d3_format_group(padding + value);
- if (d3_format_decimalPoint) value.replace(".", d3_format_decimalPoint);
- negative += basePrefix;
- return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + suffix;
- };
- };
- var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
- var d3_format_types = d3.map({
- b: function(x) {
- return x.toString(2);
- },
- c: function(x) {
- return String.fromCharCode(x);
- },
- o: function(x) {
- return x.toString(8);
- },
- x: function(x) {
- return x.toString(16);
- },
- X: function(x) {
- return x.toString(16).toUpperCase();
- },
- g: function(x, p) {
- return x.toPrecision(p);
- },
- e: function(x, p) {
- return x.toExponential(p);
- },
- f: function(x, p) {
- return x.toFixed(p);
- },
- r: function(x, p) {
- return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p))));
- }
- });
- function d3_format_precision(x, p) {
- return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
- }
- function d3_format_typeDefault(x) {
- return x + "";
- }
- var d3_format_group = d3_identity;
- if (d3_format_grouping) {
- var d3_format_groupingLength = d3_format_grouping.length;
- d3_format_group = function(value) {
- var i = value.lastIndexOf("."), f = i >= 0 ? "." + value.substring(i + 1) : (i = value.length,
- ""), t = [], j = 0, g = d3_format_grouping[0];
- while (i > 0 && g > 0) {
- t.push(value.substring(i -= g, i + g));
- g = d3_format_grouping[j = (j + 1) % d3_format_groupingLength];
- }
- return t.reverse().join(d3_format_thousandsSeparator || "") + f;
- };
- }
- var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
- d3.formatPrefix = function(value, precision) {
- var i = 0;
- if (value) {
- if (value < 0) value *= -1;
- if (precision) value = d3.round(value, d3_format_precision(value, precision));
- i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
- i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
- }
- return d3_formatPrefixes[8 + i / 3];
- };
- function d3_formatPrefix(d, i) {
- var k = Math.pow(10, Math.abs(8 - i) * 3);
- return {
- scale: i > 8 ? function(d) {
- return d / k;
- } : function(d) {
- return d * k;
- },
- symbol: d
- };
- }
- var d3_ease_default = function() {
- return d3_identity;
- };
- var d3_ease = d3.map({
- linear: d3_ease_default,
- poly: d3_ease_poly,
- quad: function() {
- return d3_ease_quad;
- },
- cubic: function() {
- return d3_ease_cubic;
- },
- sin: function() {
- return d3_ease_sin;
- },
- exp: function() {
- return d3_ease_exp;
- },
- circle: function() {
- return d3_ease_circle;
- },
- elastic: d3_ease_elastic,
- back: d3_ease_back,
- bounce: function() {
- return d3_ease_bounce;
- }
- });
- var d3_ease_mode = d3.map({
- "in": d3_identity,
- out: d3_ease_reverse,
- "in-out": d3_ease_reflect,
- "out-in": function(f) {
- return d3_ease_reflect(d3_ease_reverse(f));
- }
- });
- d3.ease = function(name) {
- var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
- t = d3_ease.get(t) || d3_ease_default;
- m = d3_ease_mode.get(m) || d3_identity;
- return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
- };
- function d3_ease_clamp(f) {
- return function(t) {
- return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
- };
- }
- function d3_ease_reverse(f) {
- return function(t) {
- return 1 - f(1 - t);
- };
- }
- function d3_ease_reflect(f) {
- return function(t) {
- return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
- };
- }
- function d3_ease_quad(t) {
- return t * t;
- }
- function d3_ease_cubic(t) {
- return t * t * t;
- }
- function d3_ease_cubicInOut(t) {
- if (t <= 0) return 0;
- if (t >= 1) return 1;
- var t2 = t * t, t3 = t2 * t;
- return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
- }
- function d3_ease_poly(e) {
- return function(t) {
- return Math.pow(t, e);
- };
- }
- function d3_ease_sin(t) {
- return 1 - Math.cos(t * π / 2);
- }
- function d3_ease_exp(t) {
- return Math.pow(2, 10 * (t - 1));
- }
- function d3_ease_circle(t) {
- return 1 - Math.sqrt(1 - t * t);
- }
- function d3_ease_elastic(a, p) {
- var s;
- if (arguments.length < 2) p = .45;
- if (arguments.length) s = p / (2 * π) * Math.asin(1 / a); else a = 1, s = p / 4;
- return function(t) {
- return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * π / p);
- };
- }
- function d3_ease_back(s) {
- if (!s) s = 1.70158;
- return function(t) {
- return t * t * ((s + 1) * t - s);
- };
- }
- function d3_ease_bounce(t) {
- return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
- }
- d3.event = null;
- function d3_eventCancel() {
- d3.event.stopPropagation();
- d3.event.preventDefault();
- }
- function d3_eventSource() {
- var e = d3.event, s;
- while (s = e.sourceEvent) e = s;
- return e;
- }
- function d3_eventDispatch(target) {
- var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
- while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
- dispatch.of = function(thiz, argumentz) {
- return function(e1) {
- try {
- var e0 = e1.sourceEvent = d3.event;
- e1.target = target;
- d3.event = e1;
- dispatch[e1.type].apply(thiz, argumentz);
- } finally {
- d3.event = e0;
- }
- };
- };
- return dispatch;
- }
- d3.transform = function(string) {
- var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
- return (d3.transform = function(string) {
- g.setAttribute("transform", string);
- var t = g.transform.baseVal.consolidate();
- return new d3_transform(t ? t.matrix : d3_transformIdentity);
- })(string);
- };
- function d3_transform(m) {
- var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
- if (r0[0] * r1[1] < r1[0] * r0[1]) {
- r0[0] *= -1;
- r0[1] *= -1;
- kx *= -1;
- kz *= -1;
- }
- this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
- this.translate = [ m.e, m.f ];
- this.scale = [ kx, ky ];
- this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
- }
- d3_transform.prototype.toString = function() {
- return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
- };
- function d3_transformDot(a, b) {
- return a[0] * b[0] + a[1] * b[1];
- }
- function d3_transformNormalize(a) {
- var k = Math.sqrt(d3_transformDot(a, a));
- if (k) {
- a[0] /= k;
- a[1] /= k;
- }
- return k;
- }
- function d3_transformCombine(a, b, k) {
- a[0] += k * b[0];
- a[1] += k * b[1];
- return a;
- }
- var d3_transformIdentity = {
- a: 1,
- b: 0,
- c: 0,
- d: 1,
- e: 0,
- f: 0
- };
- d3.interpolate = function(a, b) {
- var i = d3.interpolators.length, f;
- while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
- return f;
- };
- d3.interpolateNumber = function(a, b) {
- b -= a;
- return function(t) {
- return a + b * t;
- };
- };
- d3.interpolateRound = function(a, b) {
- b -= a;
- return function(t) {
- return Math.round(a + b * t);
- };
- };
- d3.interpolateString = function(a, b) {
- var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
- d3_interpolate_number.lastIndex = 0;
- for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
- if (m.index) s.push(b.substring(s0, s1 = m.index));
- q.push({
- i: s.length,
- x: m[0]
- });
- s.push(null);
- s0 = d3_interpolate_number.lastIndex;
- }
- if (s0 < b.length) s.push(b.substring(s0));
- for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
- o = q[i];
- if (o.x == m[0]) {
- if (o.i) {
- if (s[o.i + 1] == null) {
- s[o.i - 1] += o.x;
- s.splice(o.i, 1);
- for (j = i + 1; j < n; ++j) q[j].i--;
- } else {
- s[o.i - 1] += o.x + s[o.i + 1];
- s.splice(o.i, 2);
- for (j = i + 1; j < n; ++j) q[j].i -= 2;
- }
- } else {
- if (s[o.i + 1] == null) {
- s[o.i] = o.x;
- } else {
- s[o.i] = o.x + s[o.i + 1];
- s.splice(o.i + 1, 1);
- for (j = i + 1; j < n; ++j) q[j].i--;
- }
- }
- q.splice(i, 1);
- n--;
- i--;
- } else {
- o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
- }
- }
- while (i < n) {
- o = q.pop();
- if (s[o.i + 1] == null) {
- s[o.i] = o.x;
- } else {
- s[o.i] = o.x + s[o.i + 1];
- s.splice(o.i + 1, 1);
- }
- n--;
- }
- if (s.length === 1) {
- return s[0] == null ? q[0].x : function() {
- return b;
- };
- }
- return function(t) {
- for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
- return s.join("");
- };
- };
- d3.interpolateTransform = function(a, b) {
- var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
- if (ta[0] != tb[0] || ta[1] != tb[1]) {
- s.push("translate(", null, ",", null, ")");
- q.push({
- i: 1,
- x: d3.interpolateNumber(ta[0], tb[0])
- }, {
- i: 3,
- x: d3.interpolateNumber(ta[1], tb[1])
- });
- } else if (tb[0] || tb[1]) {
- s.push("translate(" + tb + ")");
- } else {
- s.push("");
- }
- if (ra != rb) {
- if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
- q.push({
- i: s.push(s.pop() + "rotate(", null, ")") - 2,
- x: d3.interpolateNumber(ra, rb)
- });
- } else if (rb) {
- s.push(s.pop() + "rotate(" + rb + ")");
- }
- if (wa != wb) {
- q.push({
- i: s.push(s.pop() + "skewX(", null, ")") - 2,
- x: d3.interpolateNumber(wa, wb)
- });
- } else if (wb) {
- s.push(s.pop() + "skewX(" + wb + ")");
- }
- if (ka[0] != kb[0] || ka[1] != kb[1]) {
- n = s.push(s.pop() + "scale(", null, ",", null, ")");
- q.push({
- i: n - 4,
- x: d3.interpolateNumber(ka[0], kb[0])
- }, {
- i: n - 2,
- x: d3.interpolateNumber(ka[1], kb[1])
- });
- } else if (kb[0] != 1 || kb[1] != 1) {
- s.push(s.pop() + "scale(" + kb + ")");
- }
- n = q.length;
- return function(t) {
- var i = -1, o;
- while (++i < n) s[(o = q[i]).i] = o.x(t);
- return s.join("");
- };
- };
- d3.interpolateRgb = function(a, b) {
- a = d3.rgb(a);
- b = d3.rgb(b);
- var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
- return function(t) {
- return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
- };
- };
- d3.interpolateHsl = function(a, b) {
- a = d3.hsl(a);
- b = d3.hsl(b);
- var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
- if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
- return function(t) {
- return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
- };
- };
- d3.interpolateLab = function(a, b) {
- a = d3.lab(a);
- b = d3.lab(b);
- var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
- return function(t) {
- return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
- };
- };
- d3.interpolateHcl = function(a, b) {
- a = d3.hcl(a);
- b = d3.hcl(b);
- var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
- if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
- return function(t) {
- return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
- };
- };
- d3.interpolateArray = function(a, b) {
- var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
- for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
- for (;i < na; ++i) c[i] = a[i];
- for (;i < nb; ++i) c[i] = b[i];
- return function(t) {
- for (i = 0; i < n0; ++i) c[i] = x[i](t);
- return c;
- };
- };
- d3.interpolateObject = function(a, b) {
- var i = {}, c = {}, k;
- for (k in a) {
- if (k in b) {
- i[k] = d3_interpolateByName(k)(a[k], b[k]);
- } else {
- c[k] = a[k];
- }
- }
- for (k in b) {
- if (!(k in a)) {
- c[k] = b[k];
- }
- }
- return function(t) {
- for (k in i) c[k] = i[k](t);
- return c;
- };
- };
- var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
- function d3_interpolateByName(name) {
- return name == "transform" ? d3.interpolateTransform : d3.interpolate;
- }
- d3.interpolators = [ d3.interpolateObject, function(a, b) {
- return b instanceof Array && d3.interpolateArray(a, b);
- }, function(a, b) {
- return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");
- }, function(a, b) {
- return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Color) && d3.interpolateRgb(a, b);
- }, function(a, b) {
- return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);
- } ];
- function d3_uninterpolateNumber(a, b) {
- b = b - (a = +a) ? 1 / (b - a) : 0;
- return function(x) {
- return (x - a) * b;
- };
- }
- function d3_uninterpolateClamp(a, b) {
- b = b - (a = +a) ? 1 / (b - a) : 0;
- return function(x) {
- return Math.max(0, Math.min(1, (x - a) * b));
- };
- }
- function d3_Color() {}
- d3_Color.prototype.toString = function() {
- return this.rgb() + "";
- };
- d3.rgb = function(r, g, b) {
- return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
- };
- function d3_rgb(r, g, b) {
- return new d3_Rgb(r, g, b);
- }
- function d3_Rgb(r, g, b) {
- this.r = r;
- this.g = g;
- this.b = b;
- }
- var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color();
- d3_rgbPrototype.brighter = function(k) {
- k = Math.pow(.7, arguments.length ? k : 1);
- var r = this.r, g = this.g, b = this.b, i = 30;
- if (!r && !g && !b) return d3_rgb(i, i, i);
- if (r && r < i) r = i;
- if (g && g < i) g = i;
- if (b && b < i) b = i;
- return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
- };
- d3_rgbPrototype.darker = function(k) {
- k = Math.pow(.7, arguments.length ? k : 1);
- return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
- };
- d3_rgbPrototype.hsl = function() {
- return d3_rgb_hsl(this.r, this.g, this.b);
- };
- d3_rgbPrototype.toString = function() {
- return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
- };
- function d3_rgb_hex(v) {
- return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
- }
- function d3_rgb_parse(format, rgb, hsl) {
- var r = 0, g = 0, b = 0, m1, m2, name;
- m1 = /([a-z]+)\((.*)\)/i.exec(format);
- if (m1) {
- m2 = m1[2].split(",");
- switch (m1[1]) {
- case "hsl":
- {
- return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
- }
-
- case "rgb":
- {
- return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
- }
- }
- }
- if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
- if (format != null && format.charAt(0) === "#") {
- if (format.length === 4) {
- r = format.charAt(1);
- r += r;
- g = format.charAt(2);
- g += g;
- b = format.charAt(3);
- b += b;
- } else if (format.length === 7) {
- r = format.substring(1, 3);
- g = format.substring(3, 5);
- b = format.substring(5, 7);
- }
- r = parseInt(r, 16);
- g = parseInt(g, 16);
- b = parseInt(b, 16);
- }
- return rgb(r, g, b);
- }
- function d3_rgb_hsl(r, g, b) {
- var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
- if (d) {
- s = l < .5 ? d / (max + min) : d / (2 - max - min);
- if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
- h *= 60;
- } else {
- s = h = 0;
- }
- return d3_hsl(h, s, l);
- }
- function d3_rgb_lab(r, g, b) {
- r = d3_rgb_xyz(r);
- g = d3_rgb_xyz(g);
- b = d3_rgb_xyz(b);
- var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
- return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
- }
- function d3_rgb_xyz(r) {
- return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
- }
- function d3_rgb_parseNumber(c) {
- var f = parseFloat(c);
- return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
- }
- var d3_rgb_names = d3.map({
- aliceblue: "#f0f8ff",
- antiquewhite: "#faebd7",
- aqua: "#00ffff",
- aquamarine: "#7fffd4",
- azure: "#f0ffff",
- beige: "#f5f5dc",
- bisque: "#ffe4c4",
- black: "#000000",
- blanchedalmond: "#ffebcd",
- blue: "#0000ff",
- blueviolet: "#8a2be2",
- brown: "#a52a2a",
- burlywood: "#deb887",
- cadetblue: "#5f9ea0",
- chartreuse: "#7fff00",
- chocolate: "#d2691e",
- coral: "#ff7f50",
- cornflowerblue: "#6495ed",
- cornsilk: "#fff8dc",
- crimson: "#dc143c",
- cyan: "#00ffff",
- darkblue: "#00008b",
- darkcyan: "#008b8b",
- darkgoldenrod: "#b8860b",
- darkgray: "#a9a9a9",
- darkgreen: "#006400",
- darkgrey: "#a9a9a9",
- darkkhaki: "#bdb76b",
- darkmagenta: "#8b008b",
- darkolivegreen: "#556b2f",
- darkorange: "#ff8c00",
- darkorchid: "#9932cc",
- darkred: "#8b0000",
- darksalmon: "#e9967a",
- darkseagreen: "#8fbc8f",
- darkslateblue: "#483d8b",
- darkslategray: "#2f4f4f",
- darkslategrey: "#2f4f4f",
- darkturquoise: "#00ced1",
- darkviolet: "#9400d3",
- deeppink: "#ff1493",
- deepskyblue: "#00bfff",
- dimgray: "#696969",
- dimgrey: "#696969",
- dodgerblue: "#1e90ff",
- firebrick: "#b22222",
- floralwhite: "#fffaf0",
- forestgreen: "#228b22",
- fuchsia: "#ff00ff",
- gainsboro: "#dcdcdc",
- ghostwhite: "#f8f8ff",
- gold: "#ffd700",
- goldenrod: "#daa520",
- gray: "#808080",
- green: "#008000",
- greenyellow: "#adff2f",
- grey: "#808080",
- honeydew: "#f0fff0",
- hotpink: "#ff69b4",
- indianred: "#cd5c5c",
- indigo: "#4b0082",
- ivory: "#fffff0",
- khaki: "#f0e68c",
- lavender: "#e6e6fa",
- lavenderblush: "#fff0f5",
- lawngreen: "#7cfc00",
- lemonchiffon: "#fffacd",
- lightblue: "#add8e6",
- lightcoral: "#f08080",
- lightcyan: "#e0ffff",
- lightgoldenrodyellow: "#fafad2",
- lightgray: "#d3d3d3",
- lightgreen: "#90ee90",
- lightgrey: "#d3d3d3",
- lightpink: "#ffb6c1",
- lightsalmon: "#ffa07a",
- lightseagreen: "#20b2aa",
- lightskyblue: "#87cefa",
- lightslategray: "#778899",
- lightslategrey: "#778899",
- lightsteelblue: "#b0c4de",
- lightyellow: "#ffffe0",
- lime: "#00ff00",
- limegreen: "#32cd32",
- linen: "#faf0e6",
- magenta: "#ff00ff",
- maroon: "#800000",
- mediumaquamarine: "#66cdaa",
- mediumblue: "#0000cd",
- mediumorchid: "#ba55d3",
- mediumpurple: "#9370db",
- mediumseagreen: "#3cb371",
- mediumslateblue: "#7b68ee",
- mediumspringgreen: "#00fa9a",
- mediumturquoise: "#48d1cc",
- mediumvioletred: "#c71585",
- midnightblue: "#191970",
- mintcream: "#f5fffa",
- mistyrose: "#ffe4e1",
- moccasin: "#ffe4b5",
- navajowhite: "#ffdead",
- navy: "#000080",
- oldlace: "#fdf5e6",
- olive: "#808000",
- olivedrab: "#6b8e23",
- orange: "#ffa500",
- orangered: "#ff4500",
- orchid: "#da70d6",
- palegoldenrod: "#eee8aa",
- palegreen: "#98fb98",
- paleturquoise: "#afeeee",
- palevioletred: "#db7093",
- papayawhip: "#ffefd5",
- peachpuff: "#ffdab9",
- peru: "#cd853f",
- pink: "#ffc0cb",
- plum: "#dda0dd",
- powderblue: "#b0e0e6",
- purple: "#800080",
- red: "#ff0000",
- rosybrown: "#bc8f8f",
- royalblue: "#4169e1",
- saddlebrown: "#8b4513",
- salmon: "#fa8072",
- sandybrown: "#f4a460",
- seagreen: "#2e8b57",
- seashell: "#fff5ee",
- sienna: "#a0522d",
- silver: "#c0c0c0",
- skyblue: "#87ceeb",
- slateblue: "#6a5acd",
- slategray: "#708090",
- slategrey: "#708090",
- snow: "#fffafa",
- springgreen: "#00ff7f",
- steelblue: "#4682b4",
- tan: "#d2b48c",
- teal: "#008080",
- thistle: "#d8bfd8",
- tomato: "#ff6347",
- turquoise: "#40e0d0",
- violet: "#ee82ee",
- wheat: "#f5deb3",
- white: "#ffffff",
- whitesmoke: "#f5f5f5",
- yellow: "#ffff00",
- yellowgreen: "#9acd32"
- });
- d3_rgb_names.forEach(function(key, value) {
- d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
- });
- d3.hsl = function(h, s, l) {
- return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
- };
- function d3_hsl(h, s, l) {
- return new d3_Hsl(h, s, l);
- }
- function d3_Hsl(h, s, l) {
- this.h = h;
- this.s = s;
- this.l = l;
- }
- var d3_hslPrototype = d3_Hsl.prototype = new d3_Color();
- d3_hslPrototype.brighter = function(k) {
- k = Math.pow(.7, arguments.length ? k : 1);
- return d3_hsl(this.h, this.s, this.l / k);
- };
- d3_hslPrototype.darker = function(k) {
- k = Math.pow(.7, arguments.length ? k : 1);
- return d3_hsl(this.h, this.s, k * this.l);
- };
- d3_hslPrototype.rgb = function() {
- return d3_hsl_rgb(this.h, this.s, this.l);
- };
- function d3_hsl_rgb(h, s, l) {
- var m1, m2;
- h = h % 360;
- if (h < 0) h += 360;
- s = s < 0 ? 0 : s > 1 ? 1 : s;
- l = l < 0 ? 0 : l > 1 ? 1 : l;
- m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
- m1 = 2 * l - m2;
- function v(h) {
- if (h > 360) h -= 360; else if (h < 0) h += 360;
- if (h < 60) return m1 + (m2 - m1) * h / 60;
- if (h < 180) return m2;
- if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
- return m1;
- }
- function vv(h) {
- return Math.round(v(h) * 255);
- }
- return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
- }
- d3.hcl = function(h, c, l) {
- return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
- };
- function d3_hcl(h, c, l) {
- return new d3_Hcl(h, c, l);
- }
- function d3_Hcl(h, c, l) {
- this.h = h;
- this.c = c;
- this.l = l;
- }
- var d3_hclPrototype = d3_Hcl.prototype = new d3_Color();
- d3_hclPrototype.brighter = function(k) {
- return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
- };
- d3_hclPrototype.darker = function(k) {
- return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
- };
- d3_hclPrototype.rgb = function() {
- return d3_hcl_lab(this.h, this.c, this.l).rgb();
- };
- function d3_hcl_lab(h, c, l) {
- return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
- }
- d3.lab = function(l, a, b) {
- return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
- };
- function d3_lab(l, a, b) {
- return new d3_Lab(l, a, b);
- }
- function d3_Lab(l, a, b) {
- this.l = l;
- this.a = a;
- this.b = b;
- }
- var d3_lab_K = 18;
- var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
- var d3_labPrototype = d3_Lab.prototype = new d3_Color();
- d3_labPrototype.brighter = function(k) {
- return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
- };
- d3_labPrototype.darker = function(k) {
- return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
- };
- d3_labPrototype.rgb = function() {
- return d3_lab_rgb(this.l, this.a, this.b);
- };
- function d3_lab_rgb(l, a, b) {
- var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
- x = d3_lab_xyz(x) * d3_lab_X;
- y = d3_lab_xyz(y) * d3_lab_Y;
- z = d3_lab_xyz(z) * d3_lab_Z;
- return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
- }
- function d3_lab_hcl(l, a, b) {
- return d3_hcl(Math.atan2(b, a) / π * 180, Math.sqrt(a * a + b * b), l);
- }
- function d3_lab_xyz(x) {
- return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
- }
- function d3_xyz_lab(x) {
- return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
- }
- function d3_xyz_rgb(r) {
- return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
- }
- function d3_selection(groups) {
- d3_arraySubclass(groups, d3_selectionPrototype);
- return groups;
- }
- var d3_select = function(s, n) {
- return n.querySelector(s);
- }, d3_selectAll = function(s, n) {
- return n.querySelectorAll(s);
- }, d3_selectRoot = d3_document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
- return d3_selectMatcher.call(n, s);
- };
- if (typeof Sizzle === "function") {
- d3_select = function(s, n) {
- return Sizzle(s, n)[0] || null;
- };
- d3_selectAll = function(s, n) {
- return Sizzle.uniqueSort(Sizzle(s, n));
- };
- d3_selectMatches = Sizzle.matchesSelector;
- }
- var d3_selectionPrototype = [];
- d3.selection = function() {
- return d3_selectionRoot;
- };
- d3.selection.prototype = d3_selectionPrototype;
- d3_selectionPrototype.select = function(selector) {
- var subgroups = [], subgroup, subnode, group, node;
- if (typeof selector !== "function") selector = d3_selection_selector(selector);
- for (var j = -1, m = this.length; ++j < m; ) {
- subgroups.push(subgroup = []);
- subgroup.parentNode = (group = this[j]).parentNode;
- for (var i = -1, n = group.length; ++i < n; ) {
- if (node = group[i]) {
- subgroup.push(subnode = selector.call(node, node.__data__, i));
- if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
- } else {
- subgroup.push(null);
- }
- }
- }
- return d3_selection(subgroups);
- };
- function d3_selection_selector(selector) {
- return function() {
- return d3_select(selector, this);
- };
- }
- d3_selectionPrototype.selectAll = function(selector) {
- var subgroups = [], subgroup, node;
- if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
- for (var j = -1, m = this.length; ++j < m; ) {
- for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
- if (node = group[i]) {
- subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
- subgroup.parentNode = node;
- }
- }
- }
- return d3_selection(subgroups);
- };
- function d3_selection_selectorAll(selector) {
- return function() {
- return d3_selectAll(selector, this);
- };
- }
- d3_selectionPrototype.attr = function(name, value) {
- if (arguments.length < 2) {
- if (typeof name === "string") {
- var node = this.node();
- name = d3.ns.qualify(name);
- return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
- }
- for (value in name) this.each(d3_selection_attr(value, name[value]));
- return this;
- }
- return this.each(d3_selection_attr(name, value));
- };
- function d3_selection_attr(name, value) {
- name = d3.ns.qualify(name);
- function attrNull() {
- this.removeAttribute(name);
- }
- function attrNullNS() {
- this.removeAttributeNS(name.space, name.local);
- }
- function attrConstant() {
- this.setAttribute(name, value);
- }
- function attrConstantNS() {
- this.setAttributeNS(name.space, name.local, value);
- }
- function attrFunction() {
- var x = value.apply(this, arguments);
- if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
- }
- function attrFunctionNS() {
- var x = value.apply(this, arguments);
- if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
- }
- return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
- }
- d3_selectionPrototype.classed = function(name, value) {
- if (arguments.length < 2) {
- if (typeof name === "string") {
- var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
- if (value = node.classList) {
- while (++i < n) if (!value.contains(name[i])) return false;
- } else {
- value = node.className;
- if (value.baseVal != null) value = value.baseVal;
- while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
- }
- return true;
- }
- for (value in name) this.each(d3_selection_classed(value, name[value]));
- return this;
- }
- return this.each(d3_selection_classed(name, value));
- };
- function d3_selection_classedRe(name) {
- return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
- }
- function d3_selection_classed(name, value) {
- name = name.trim().split(/\s+/).map(d3_selection_classedName);
- var n = name.length;
- function classedConstant() {
- var i = -1;
- while (++i < n) name[i](this, value);
- }
- function classedFunction() {
- var i = -1, x = value.apply(this, arguments);
- while (++i < n) name[i](this, x);
- }
- return typeof value === "function" ? classedFunction : classedConstant;
- }
- function d3_selection_classedName(name) {
- var re = d3_selection_classedRe(name);
- return function(node, value) {
- if (c = node.classList) return value ? c.add(name) : c.remove(name);
- var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;
- if (value) {
- re.lastIndex = 0;
- if (!re.test(cv)) {
- cv = d3_collapse(cv + " " + name);
- if (cb) c.baseVal = cv; else node.className = cv;
- }
- } else if (cv) {
- cv = d3_collapse(cv.replace(re, " "));
- if (cb) c.baseVal = cv; else node.className = cv;
- }
- };
- }
- d3_selectionPrototype.style = function(name, value, priority) {
- var n = arguments.length;
- if (n < 3) {
- if (typeof name !== "string") {
- if (n < 2) value = "";
- for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
- return this;
- }
- if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name);
- priority = "";
- }
- return this.each(d3_selection_style(name, value, priority));
- };
- function d3_selection_style(name, value, priority) {
- function styleNull() {
- this.style.removeProperty(name);
- }
- function styleConstant() {
- this.style.setProperty(name, value, priority);
- }
- function styleFunction() {
- var x = value.apply(this, arguments);
- if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
- }
- return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
- }
- d3_selectionPrototype.property = function(name, value) {
- if (arguments.length < 2) {
- if (typeof name === "string") return this.node()[name];
- for (value in name) this.each(d3_selection_property(value, name[value]));
- return this;
- }
- return this.each(d3_selection_property(name, value));
- };
- function d3_selection_property(name, value) {
- function propertyNull() {
- delete this[name];
- }
- function propertyConstant() {
- this[name] = value;
- }
- function propertyFunction() {
- var x = value.apply(this, arguments);
- if (x == null) delete this[name]; else this[name] = x;
- }
- return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
- }
- d3_selectionPrototype.text = function(value) {
- return arguments.length ? this.each(typeof value === "function" ? function() {
- var v = value.apply(this, arguments);
- this.textContent = v == null ? "" : v;
- } : value == null ? function() {
- this.textContent = "";
- } : function() {
- this.textContent = value;
- }) : this.node().textContent;
- };
- d3_selectionPrototype.html = function(value) {
- return arguments.length ? this.each(typeof value === "function" ? function() {
- var v = value.apply(this, arguments);
- this.innerHTML = v == null ? "" : v;
- } : value == null ? function() {
- this.innerHTML = "";
- } : function() {
- this.innerHTML = value;
- }) : this.node().innerHTML;
- };
- d3_selectionPrototype.append = function(name) {
- name = d3.ns.qualify(name);
- function append() {
- return this.appendChild(d3_document.createElementNS(this.namespaceURI, name));
- }
- function appendNS() {
- return this.appendChild(d3_document.createElementNS(name.space, name.local));
- }
- return this.select(name.local ? appendNS : append);
- };
- d3_selectionPrototype.insert = function(name, before) {
- name = d3.ns.qualify(name);
- function insert() {
- return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), d3_select(before, this));
- }
- function insertNS() {
- return this.insertBefore(d3_document.createElementNS(name.space, name.local), d3_select(before, this));
- }
- return this.select(name.local ? insertNS : insert);
- };
- d3_selectionPrototype.remove = function() {
- return this.each(function() {
- var parent = this.parentNode;
- if (parent) parent.removeChild(this);
- });
- };
- d3_selectionPrototype.data = function(value, key) {
- var i = -1, n = this.length, group, node;
- if (!arguments.length) {
- value = new Array(n = (group = this[0]).length);
- while (++i < n) {
- if (node = group[i]) {
- value[i] = node.__data__;
- }
- }
- return value;
- }
- function bind(group, groupData) {
- var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
- if (key) {
- var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue;
- for (i = -1; ++i < n; ) {
- keyValue = key.call(node = group[i], node.__data__, i);
- if (nodeByKeyValue.has(keyValue)) {
- exitNodes[i] = node;
- } else {
- nodeByKeyValue.set(keyValue, node);
- }
- keyValues.push(keyValue);
- }
- for (i = -1; ++i < m; ) {
- keyValue = key.call(groupData, nodeData = groupData[i], i);
- if (node = nodeByKeyValue.get(keyValue)) {
- updateNodes[i] = node;
- node.__data__ = nodeData;
- } else if (!dataByKeyValue.has(keyValue)) {
- enterNodes[i] = d3_selection_dataNode(nodeData);
- }
- dataByKeyValue.set(keyValue, nodeData);
- nodeByKeyValue.remove(keyValue);
- }
- for (i = -1; ++i < n; ) {
- if (nodeByKeyValue.has(keyValues[i])) {
- exitNodes[i] = group[i];
- }
- }
- } else {
- for (i = -1; ++i < n0; ) {
- node = group[i];
- nodeData = groupData[i];
- if (node) {
- node.__data__ = nodeData;
- updateNodes[i] = node;
- } else {
- enterNodes[i] = d3_selection_dataNode(nodeData);
- }
- }
- for (;i < m; ++i) {
- enterNodes[i] = d3_selection_dataNode(groupData[i]);
- }
- for (;i < n; ++i) {
- exitNodes[i] = group[i];
- }
- }
- enterNodes.update = updateNodes;
- enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
- enter.push(enterNodes);
- update.push(updateNodes);
- exit.push(exitNodes);
- }
- var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
- if (typeof value === "function") {
- while (++i < n) {
- bind(group = this[i], value.call(group, group.parentNode.__data__, i));
- }
- } else {
- while (++i < n) {
- bind(group = this[i], value);
- }
- }
- update.enter = function() {
- return enter;
- };
- update.exit = function() {
- return exit;
- };
- return update;
- };
- function d3_selection_dataNode(data) {
- return {
- __data__: data
- };
- }
- d3_selectionPrototype.datum = function(value) {
- return arguments.length ? this.property("__data__", value) : this.property("__data__");
- };
- d3_selectionPrototype.filter = function(filter) {
- var subgroups = [], subgroup, group, node;
- if (typeof filter !== "function") filter = d3_selection_filter(filter);
- for (var j = 0, m = this.length; j < m; j++) {
- subgroups.push(subgroup = []);
- subgroup.parentNode = (group = this[j]).parentNode;
- for (var i = 0, n = group.length; i < n; i++) {
- if ((node = group[i]) && filter.call(node, node.__data__, i)) {
- subgroup.push(node);
- }
- }
- }
- return d3_selection(subgroups);
- };
- function d3_selection_filter(selector) {
- return function() {
- return d3_selectMatches(this, selector);
- };
- }
- d3_selectionPrototype.order = function() {
- for (var j = -1, m = this.length; ++j < m; ) {
- for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
- if (node = group[i]) {
- if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
- next = node;
- }
- }
- }
- return this;
- };
- d3_selectionPrototype.sort = function(comparator) {
- comparator = d3_selection_sortComparator.apply(this, arguments);
- for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
- return this.order();
- };
- function d3_selection_sortComparator(comparator) {
- if (!arguments.length) comparator = d3.ascending;
- return function(a, b) {
- return !a - !b || comparator(a.__data__, b.__data__);
- };
- }
- d3_selectionPrototype.on = function(type, listener, capture) {
- var n = arguments.length;
- if (n < 3) {
- if (typeof type !== "string") {
- if (n < 2) listener = false;
- for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
- return this;
- }
- if (n < 2) return (n = this.node()["__on" + type]) && n._;
- capture = false;
- }
- return this.each(d3_selection_on(type, listener, capture));
- };
- function d3_selection_on(type, listener, capture) {
- var name = "__on" + type, i = type.indexOf(".");
- if (i > 0) type = type.substring(0, i);
- function onRemove() {
- var wrapper = this[name];
- if (wrapper) {
- this.removeEventListener(type, wrapper, wrapper.$);
- delete this[name];
- }
- }
- function onAdd() {
- var node = this, args = d3_array(arguments);
- onRemove.call(this);
- this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);
- wrapper._ = listener;
- function wrapper(e) {
- var o = d3.event;
- d3.event = e;
- args[0] = node.__data__;
- try {
- listener.apply(node, args);
- } finally {
- d3.event = o;
- }
- }
- }
- return listener ? onAdd : onRemove;
- }
- d3_selectionPrototype.each = function(callback) {
- return d3_selection_each(this, function(node, i, j) {
- callback.call(node, node.__data__, i, j);
- });
- };
- function d3_selection_each(groups, callback) {
- for (var j = 0, m = groups.length; j < m; j++) {
- for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
- if (node = group[i]) callback(node, i, j);
- }
- }
- return groups;
- }
- d3_selectionPrototype.call = function(callback) {
- var args = d3_array(arguments);
- callback.apply(args[0] = this, args);
- return this;
- };
- d3_selectionPrototype.empty = function() {
- return !this.node();
- };
- d3_selectionPrototype.node = function() {
- for (var j = 0, m = this.length; j < m; j++) {
- for (var group = this[j], i = 0, n = group.length; i < n; i++) {
- var node = group[i];
- if (node) return node;
- }
- }
- return null;
- };
- d3_selectionPrototype.transition = function() {
- var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = Object.create(d3_transitionInherit);
- transition.time = Date.now();
- for (var j = -1, m = this.length; ++j < m; ) {
- subgroups.push(subgroup = []);
- for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
- if (node = group[i]) d3_transitionNode(node, i, id, transition);
- subgroup.push(node);
- }
- }
- return d3_transition(subgroups, id);
- };
- var d3_selectionRoot = d3_selection([ [ d3_document ] ]);
- d3_selectionRoot[0].parentNode = d3_selectRoot;
- d3.select = function(selector) {
- return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
- };
- d3.selectAll = function(selector) {
- return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
- };
- function d3_selection_enter(selection) {
- d3_arraySubclass(selection, d3_selection_enterPrototype);
- return selection;
- }
- var d3_selection_enterPrototype = [];
- d3.selection.enter = d3_selection_enter;
- d3.selection.enter.prototype = d3_selection_enterPrototype;
- d3_selection_enterPrototype.append = d3_selectionPrototype.append;
- d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
- d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
- d3_selection_enterPrototype.node = d3_selectionPrototype.node;
- d3_selection_enterPrototype.select = function(selector) {
- var subgroups = [], subgroup, subnode, upgroup, group, node;
- for (var j = -1, m = this.length; ++j < m; ) {
- upgroup = (group = this[j]).update;
- subgroups.push(subgroup = []);
- subgroup.parentNode = group.parentNode;
- for (var i = -1, n = group.length; ++i < n; ) {
- if (node = group[i]) {
- subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
- subnode.__data__ = node.__data__;
- } else {
- subgroup.push(null);
- }
- }
- }
- return d3_selection(subgroups);
- };
- function d3_transition(groups, id) {
- d3_arraySubclass(groups, d3_transitionPrototype);
- groups.id = id;
- return groups;
- }
- var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit = {
- ease: d3_ease_cubicInOut,
- delay: 0,
- duration: 250
- };
- d3_transitionPrototype.call = d3_selectionPrototype.call;
- d3_transitionPrototype.empty = d3_selectionPrototype.empty;
- d3_transitionPrototype.node = d3_selectionPrototype.node;
- d3.transition = function(selection) {
- return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition();
- };
- d3.transition.prototype = d3_transitionPrototype;
- function d3_transitionNode(node, i, id, inherit) {
- var lock = node.__transition__ || (node.__transition__ = {
- active: 0,
- count: 0
- }), transition = lock[id];
- if (!transition) {
- var time = inherit.time;
- transition = lock[id] = {
- tween: new d3_Map(),
- event: d3.dispatch("start", "end"),
- time: time,
- ease: inherit.ease,
- delay: inherit.delay,
- duration: inherit.duration
- };
- ++lock.count;
- d3.timer(function(elapsed) {
- var d = node.__data__, ease = transition.ease, event = transition.event, delay = transition.delay, duration = transition.duration, tweened = [];
- return delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time), 1;
- function start(elapsed) {
- if (lock.active > id) return stop();
- lock.active = id;
- event.start.call(node, d, i);
- transition.tween.forEach(function(key, value) {
- if (value = value.call(node, d, i)) {
- tweened.push(value);
- }
- });
- if (!tick(elapsed)) d3.timer(tick, 0, time);
- return 1;
- }
- function tick(elapsed) {
- if (lock.active !== id) return stop();
- var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
- while (n > 0) {
- tweened[--n].call(node, e);
- }
- if (t >= 1) {
- stop();
- event.end.call(node, d, i);
- return 1;
- }
- }
- function stop() {
- if (--lock.count) delete lock[id]; else delete node.__transition__;
- return 1;
- }
- }, 0, time);
- return transition;
- }
- }
- d3_transitionPrototype.select = function(selector) {
- var id = this.id, subgroups = [], subgroup, subnode, node;
- if (typeof selector !== "function") selector = d3_selection_selector(selector);
- for (var j = -1, m = this.length; ++j < m; ) {
- subgroups.push(subgroup = []);
- for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
- if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i))) {
- if ("__data__" in node) subnode.__data__ = node.__data__;
- d3_transitionNode(subnode, i, id, node.__transition__[id]);
- subgroup.push(subnode);
- } else {
- subgroup.push(null);
- }
- }
- }
- return d3_transition(subgroups, id);
- };
- d3_transitionPrototype.selectAll = function(selector) {
- var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition;
- if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
- for (var j = -1, m = this.length; ++j < m; ) {
- for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
- if (node = group[i]) {
- transition = node.__transition__[id];
- subnodes = selector.call(node, node.__data__, i);
- subgroups.push(subgroup = []);
- for (var k = -1, o = subnodes.length; ++k < o; ) {
- d3_transitionNode(subnode = subnodes[k], k, id, transition);
- subgroup.push(subnode);
- }
- }
- }
- }
- return d3_transition(subgroups, id);
- };
- d3_transitionPrototype.filter = function(filter) {
- var subgroups = [], subgroup, group, node;
- if (typeof filter !== "function") filter = d3_selection_filter(filter);
- for (var j = 0, m = this.length; j < m; j++) {
- subgroups.push(subgroup = []);
- for (var group = this[j], i = 0, n = group.length; i < n; i++) {
- if ((node = group[i]) && filter.call(node, node.__data__, i)) {
- subgroup.push(node);
- }
- }
- }
- return d3_transition(subgroups, this.id, this.time).ease(this.ease());
- };
- d3_transitionPrototype.attr = function(nameNS, value) {
- if (arguments.length < 2) {
- for (value in nameNS) this.attr(value, nameNS[value]);
- return this;
- }
- var interpolate = d3_interpolateByName(nameNS), name = d3.ns.qualify(nameNS);
- function attrNull() {
- this.removeAttribute(name);
- }
- function attrNullNS() {
- this.removeAttributeNS(name.space, name.local);
- }
- return d3_transition_tween(this, "attr." + nameNS, value, function(b) {
- function attrString() {
- var a = this.getAttribute(name), i;
- return a !== b && (i = interpolate(a, b), function(t) {
- this.setAttribute(name, i(t));
- });
- }
- function attrStringNS() {
- var a = this.getAttributeNS(name.space, name.local), i;
- return a !== b && (i = interpolate(a, b), function(t) {
- this.setAttributeNS(name.space, name.local, i(t));
- });
- }
- return b == null ? name.local ? attrNullNS : attrNull : (b += "", name.local ? attrStringNS : attrString);
- });
- };
- d3_transitionPrototype.attrTween = function(nameNS, tween) {
- var name = d3.ns.qualify(nameNS);
- function attrTween(d, i) {
- var f = tween.call(this, d, i, this.getAttribute(name));
- return f && function(t) {
- this.setAttribute(name, f(t));
- };
- }
- function attrTweenNS(d, i) {
- var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
- return f && function(t) {
- this.setAttributeNS(name.space, name.local, f(t));
- };
- }
- return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
- };
- d3_transitionPrototype.style = function(name, value, priority) {
- var n = arguments.length;
- if (n < 3) {
- if (typeof name !== "string") {
- if (n < 2) value = "";
- for (priority in name) this.style(priority, name[priority], value);
- return this;
- }
- priority = "";
- }
- var interpolate = d3_interpolateByName(name);
- function styleNull() {
- this.style.removeProperty(name);
- }
- return d3_transition_tween(this, "style." + name, value, function(b) {
- function styleString() {
- var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i;
- return a !== b && (i = interpolate(a, b), function(t) {
- this.style.setProperty(name, i(t), priority);
- });
- }
- return b == null ? styleNull : (b += "", styleString);
- });
- };
- d3_transitionPrototype.styleTween = function(name, tween, priority) {
- if (arguments.length < 3) priority = "";
- return this.tween("style." + name, function(d, i) {
- var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name));
- return f && function(t) {
- this.style.setProperty(name, f(t), priority);
- };
- });
- };
- d3_transitionPrototype.text = function(value) {
- return d3_transition_tween(this, "text", value, d3_transition_text);
- };
- function d3_transition_text(b) {
- if (b == null) b = "";
- return function() {
- this.textContent = b;
- };
- }
- d3_transitionPrototype.remove = function() {
- return this.each("end.transition", function() {
- var p;
- if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
- });
- };
- d3_transitionPrototype.ease = function(value) {
- var id = this.id;
- if (arguments.length < 1) return this.node().__transition__[id].ease;
- if (typeof value !== "function") value = d3.ease.apply(d3, arguments);
- return d3_selection_each(this, function(node) {
- node.__transition__[id].ease = value;
- });
- };
- d3_transitionPrototype.delay = function(value) {
- var id = this.id;
- return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
- node.__transition__[id].delay = value.call(node, node.__data__, i, j) | 0;
- } : (value |= 0, function(node) {
- node.__transition__[id].delay = value;
- }));
- };
- d3_transitionPrototype.duration = function(value) {
- var id = this.id;
- return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
- node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j) | 0);
- } : (value = Math.max(1, value | 0), function(node) {
- node.__transition__[id].duration = value;
- }));
- };
- d3_transitionPrototype.each = function(type, listener) {
- var id = this.id;
- if (arguments.length < 2) {
- var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;
- d3_transitionInheritId = id;
- d3_selection_each(this, function(node, i, j) {
- d3_transitionInherit = node.__transition__[id];
- type.call(node, node.__data__, i, j);
- });
- d3_transitionInherit = inherit;
- d3_transitionInheritId = inheritId;
- } else {
- d3_selection_each(this, function(node) {
- node.__transition__[id].event.on(type, listener);
- });
- }
- return this;
- };
- d3_transitionPrototype.transition = function() {
- var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition;
- for (var j = 0, m = this.length; j < m; j++) {
- subgroups.push(subgroup = []);
- for (var group = this[j], i = 0, n = group.length; i < n; i++) {
- if (node = group[i]) {
- transition = Object.create(node.__transition__[id0]);
- transition.delay += transition.duration;
- d3_transitionNode(node, i, id1, transition);
- }
- subgroup.push(node);
- }
- }
- return d3_transition(subgroups, id1);
- };
- d3_transitionPrototype.tween = function(name, tween) {
- var id = this.id;
- if (arguments.length < 2) return this.node().__transition__[id].tween.get(name);
- return d3_selection_each(this, tween == null ? function(node) {
- node.__transition__[id].tween.remove(name);
- } : function(node) {
- node.__transition__[id].tween.set(name, tween);
- });
- };
- function d3_transition_tween(groups, name, value, tween) {
- var id = groups.id;
- return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) {
- node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j)));
- } : (value = tween(value), function(node) {
- node.__transition__[id].tween.set(name, value);
- }));
- }
- var d3_timer_id = 0, d3_timer_byId = {}, d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
- d3.timer = function(callback, delay, then) {
- if (arguments.length < 3) {
- if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
- then = Date.now();
- }
- var timer = d3_timer_byId[callback.id];
- if (timer && timer.callback === callback) {
- timer.then = then;
- timer.delay = delay;
- } else d3_timer_byId[callback.id = ++d3_timer_id] = d3_timer_queue = {
- callback: callback,
- then: then,
- delay: delay,
- next: d3_timer_queue
- };
- if (!d3_timer_interval) {
- d3_timer_timeout = clearTimeout(d3_timer_timeout);
- d3_timer_interval = 1;
- d3_timer_frame(d3_timer_step);
- }
- };
- function d3_timer_step() {
- var elapsed, now = Date.now(), t1 = d3_timer_queue;
- while (t1) {
- elapsed = now - t1.then;
- if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
- t1 = t1.next;
- }
- var delay = d3_timer_flush() - now;
- if (delay > 24) {
- if (isFinite(delay)) {
- clearTimeout(d3_timer_timeout);
- d3_timer_timeout = setTimeout(d3_timer_step, delay);
- }
- d3_timer_interval = 0;
- } else {
- d3_timer_interval = 1;
- d3_timer_frame(d3_timer_step);
- }
- }
- d3.timer.flush = function() {
- var elapsed, now = Date.now(), t1 = d3_timer_queue;
- while (t1) {
- elapsed = now - t1.then;
- if (!t1.delay) t1.flush = t1.callback(elapsed);
- t1 = t1.next;
- }
- d3_timer_flush();
- };
- function d3_timer_flush() {
- var t0 = null, t1 = d3_timer_queue, then = Infinity;
- while (t1) {
- if (t1.flush) {
- delete d3_timer_byId[t1.callback.id];
- t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
- } else {
- then = Math.min(then, t1.then + t1.delay);
- t1 = (t0 = t1).next;
- }
- }
- return then;
- }
- var d3_timer_frame = d3_window.requestAnimationFrame || d3_window.webkitRequestAnimationFrame || d3_window.mozRequestAnimationFrame || d3_window.oRequestAnimationFrame || d3_window.msRequestAnimationFrame || function(callback) {
- setTimeout(callback, 17);
- };
- d3.mouse = function(container) {
- return d3_mousePoint(container, d3_eventSource());
- };
- var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
- function d3_mousePoint(container, e) {
- var svg = container.ownerSVGElement || container;
- if (svg.createSVGPoint) {
- var point = svg.createSVGPoint();
- if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
- svg = d3.select(d3_document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
- var ctm = svg[0][0].getScreenCTM();
- d3_mouse_bug44083 = !(ctm.f || ctm.e);
- svg.remove();
- }
- if (d3_mouse_bug44083) {
- point.x = e.pageX;
- point.y = e.pageY;
- } else {
- point.x = e.clientX;
- point.y = e.clientY;
- }
- point = point.matrixTransform(container.getScreenCTM().inverse());
- return [ point.x, point.y ];
- }
- var rect = container.getBoundingClientRect();
- return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
- }
- d3.touches = function(container, touches) {
- if (arguments.length < 2) touches = d3_eventSource().touches;
- return touches ? d3_array(touches).map(function(touch) {
- var point = d3_mousePoint(container, touch);
- point.identifier = touch.identifier;
- return point;
- }) : [];
- };
- function d3_noop() {}
- d3.scale = {};
- function d3_scaleExtent(domain) {
- var start = domain[0], stop = domain[domain.length - 1];
- return start < stop ? [ start, stop ] : [ stop, start ];
- }
- function d3_scaleRange(scale) {
- return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
- }
- function d3_scale_nice(domain, nice) {
- var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
- if (x1 < x0) {
- dx = i0, i0 = i1, i1 = dx;
- dx = x0, x0 = x1, x1 = dx;
- }
- if (nice = nice(x1 - x0)) {
- domain[i0] = nice.floor(x0);
- domain[i1] = nice.ceil(x1);
- }
- return domain;
- }
- function d3_scale_niceDefault() {
- return Math;
- }
- d3.scale.linear = function() {
- return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);
- };
- function d3_scale_linear(domain, range, interpolate, clamp) {
- var output, input;
- function rescale() {
- var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
- output = linear(domain, range, uninterpolate, interpolate);
- input = linear(range, domain, uninterpolate, d3.interpolate);
- return scale;
- }
- function scale(x) {
- return output(x);
- }
- scale.invert = function(y) {
- return input(y);
- };
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = x.map(Number);
- return rescale();
- };
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
- scale.rangeRound = function(x) {
- return scale.range(x).interpolate(d3.interpolateRound);
- };
- scale.clamp = function(x) {
- if (!arguments.length) return clamp;
- clamp = x;
- return rescale();
- };
- scale.interpolate = function(x) {
- if (!arguments.length) return interpolate;
- interpolate = x;
- return rescale();
- };
- scale.ticks = function(m) {
- return d3_scale_linearTicks(domain, m);
- };
- scale.tickFormat = function(m) {
- return d3_scale_linearTickFormat(domain, m);
- };
- scale.nice = function() {
- d3_scale_nice(domain, d3_scale_linearNice);
- return rescale();
- };
- scale.copy = function() {
- return d3_scale_linear(domain, range, interpolate, clamp);
- };
- return rescale();
- }
- function d3_scale_linearRebind(scale, linear) {
- return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
- }
- function d3_scale_linearNice(dx) {
- dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
- return dx && {
- floor: function(x) {
- return Math.floor(x / dx) * dx;
- },
- ceil: function(x) {
- return Math.ceil(x / dx) * dx;
- }
- };
- }
- function d3_scale_linearTickRange(domain, m) {
- var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
- if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
- extent[0] = Math.ceil(extent[0] / step) * step;
- extent[1] = Math.floor(extent[1] / step) * step + step * .5;
- extent[2] = step;
- return extent;
- }
- function d3_scale_linearTicks(domain, m) {
- return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
- }
- function d3_scale_linearTickFormat(domain, m) {
- return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
- }
- function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
- var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
- return function(x) {
- return i(u(x));
- };
- }
- function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
- var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
- if (domain[k] < domain[0]) {
- domain = domain.slice().reverse();
- range = range.slice().reverse();
- }
- while (++j <= k) {
- u.push(uninterpolate(domain[j - 1], domain[j]));
- i.push(interpolate(range[j - 1], range[j]));
- }
- return function(x) {
- var j = d3.bisect(domain, x, 1, k) - 1;
- return i[j](u[j](x));
- };
- }
- d3.scale.log = function() {
- return d3_scale_log(d3.scale.linear(), d3_scale_logp);
- };
- function d3_scale_log(linear, log) {
- var pow = log.pow;
- function scale(x) {
- return linear(log(x));
- }
- scale.invert = function(x) {
- return pow(linear.invert(x));
- };
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(pow);
- log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
- pow = log.pow;
- linear.domain(x.map(log));
- return scale;
- };
- scale.nice = function() {
- linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
- return scale;
- };
- scale.ticks = function() {
- var extent = d3_scaleExtent(linear.domain()), ticks = [];
- if (extent.every(isFinite)) {
- var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);
- if (log === d3_scale_logn) {
- ticks.push(pow(i));
- for (;i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
- } else {
- for (;i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
- ticks.push(pow(i));
- }
- for (i = 0; ticks[i] < u; i++) {}
- for (j = ticks.length; ticks[j - 1] > v; j--) {}
- ticks = ticks.slice(i, j);
- }
- return ticks;
- };
- scale.tickFormat = function(n, format) {
- if (arguments.length < 2) format = d3_scale_logFormat;
- if (!arguments.length) return format;
- var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12,
- Math.floor) : (e = 1e-12, Math.ceil), e;
- return function(d) {
- return d / pow(f(log(d) + e)) <= k ? format(d) : "";
- };
- };
- scale.copy = function() {
- return d3_scale_log(linear.copy(), log);
- };
- return d3_scale_linearRebind(scale, linear);
- }
- var d3_scale_logFormat = d3.format(".0e");
- function d3_scale_logp(x) {
- return Math.log(x < 0 ? 0 : x) / Math.LN10;
- }
- function d3_scale_logn(x) {
- return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
- }
- d3_scale_logp.pow = function(x) {
- return Math.pow(10, x);
- };
- d3_scale_logn.pow = function(x) {
- return -Math.pow(10, -x);
- };
- d3.scale.pow = function() {
- return d3_scale_pow(d3.scale.linear(), 1);
- };
- function d3_scale_pow(linear, exponent) {
- var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
- function scale(x) {
- return linear(powp(x));
- }
- scale.invert = function(x) {
- return powb(linear.invert(x));
- };
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(powb);
- linear.domain(x.map(powp));
- return scale;
- };
- scale.ticks = function(m) {
- return d3_scale_linearTicks(scale.domain(), m);
- };
- scale.tickFormat = function(m) {
- return d3_scale_linearTickFormat(scale.domain(), m);
- };
- scale.nice = function() {
- return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
- };
- scale.exponent = function(x) {
- if (!arguments.length) return exponent;
- var domain = scale.domain();
- powp = d3_scale_powPow(exponent = x);
- powb = d3_scale_powPow(1 / exponent);
- return scale.domain(domain);
- };
- scale.copy = function() {
- return d3_scale_pow(linear.copy(), exponent);
- };
- return d3_scale_linearRebind(scale, linear);
- }
- function d3_scale_powPow(e) {
- return function(x) {
- return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
- };
- }
- d3.scale.sqrt = function() {
- return d3.scale.pow().exponent(.5);
- };
- d3.scale.ordinal = function() {
- return d3_scale_ordinal([], {
- t: "range",
- a: [ [] ]
- });
- };
- function d3_scale_ordinal(domain, ranger) {
- var index, range, rangeBand;
- function scale(x) {
- return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
- }
- function steps(start, step) {
- return d3.range(domain.length).map(function(i) {
- return start + step * i;
- });
- }
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = [];
- index = new d3_Map();
- var i = -1, n = x.length, xi;
- while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
- return scale[ranger.t].apply(scale, ranger.a);
- };
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- rangeBand = 0;
- ranger = {
- t: "range",
- a: arguments
- };
- return scale;
- };
- scale.rangePoints = function(x, padding) {
- if (arguments.length < 2) padding = 0;
- var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
- range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
- rangeBand = 0;
- ranger = {
- t: "rangePoints",
- a: arguments
- };
- return scale;
- };
- scale.rangeBands = function(x, padding, outerPadding) {
- if (arguments.length < 2) padding = 0;
- if (arguments.length < 3) outerPadding = padding;
- var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
- range = steps(start + step * outerPadding, step);
- if (reverse) range.reverse();
- rangeBand = step * (1 - padding);
- ranger = {
- t: "rangeBands",
- a: arguments
- };
- return scale;
- };
- scale.rangeRoundBands = function(x, padding, outerPadding) {
- if (arguments.length < 2) padding = 0;
- if (arguments.length < 3) outerPadding = padding;
- var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
- range = steps(start + Math.round(error / 2), step);
- if (reverse) range.reverse();
- rangeBand = Math.round(step * (1 - padding));
- ranger = {
- t: "rangeRoundBands",
- a: arguments
- };
- return scale;
- };
- scale.rangeBand = function() {
- return rangeBand;
- };
- scale.rangeExtent = function() {
- return d3_scaleExtent(ranger.a[0]);
- };
- scale.copy = function() {
- return d3_scale_ordinal(domain, ranger);
- };
- return scale.domain(domain);
- }
- d3.scale.category10 = function() {
- return d3.scale.ordinal().range(d3_category10);
- };
- d3.scale.category20 = function() {
- return d3.scale.ordinal().range(d3_category20);
- };
- d3.scale.category20b = function() {
- return d3.scale.ordinal().range(d3_category20b);
- };
- d3.scale.category20c = function() {
- return d3.scale.ordinal().range(d3_category20c);
- };
- var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
- var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
- var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
- var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
- d3.scale.quantile = function() {
- return d3_scale_quantile([], []);
- };
- function d3_scale_quantile(domain, range) {
- var thresholds;
- function rescale() {
- var k = 0, q = range.length;
- thresholds = [];
- while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
- return scale;
- }
- function scale(x) {
- if (isNaN(x = +x)) return NaN;
- return range[d3.bisect(thresholds, x)];
- }
- scale.domain = function(x) {
- if (!arguments.length) return domain;
- domain = x.filter(function(d) {
- return !isNaN(d);
- }).sort(d3.ascending);
- return rescale();
- };
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
- scale.quantiles = function() {
- return thresholds;
- };
- scale.copy = function() {
- return d3_scale_quantile(domain, range);
- };
- return rescale();
- }
- d3.scale.quantize = function() {
- return d3_scale_quantize(0, 1, [ 0, 1 ]);
- };
- function d3_scale_quantize(x0, x1, range) {
- var kx, i;
- function scale(x) {
- return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
- }
- function rescale() {
- kx = range.length / (x1 - x0);
- i = range.length - 1;
- return scale;
- }
- scale.domain = function(x) {
- if (!arguments.length) return [ x0, x1 ];
- x0 = +x[0];
- x1 = +x[x.length - 1];
- return rescale();
- };
- scale.range = function(x) {
- if (!arguments.length) return range;
- range = x;
- return rescale();
- };
- scale.copy = function() {
- return d3_scale_quantize(x0, x1, range);
- };
- return rescale();
- }
- d3.scale.threshold = function() {
- return d3_scale_threshold([ .5 ], [ 0, 1 ]);
- };
- function d3_scale_threshold(domain, range) {
- function scale(x) {
- return range[d3.bisect(domain, x)];
- }
- scale.domain = function(_) {
- if (!arguments.length) return domain;
- domain = _;
- return scale;
- };
- scale.range = function(_) {
- if (!arguments.length) return range;
- range = _;
- return scale;
- };
- scale.copy = function() {
- return d3_scale_threshold(domain, range);
- };
- return scale;
- }
- d3.scale.identity = function() {
- return d3_scale_identity([ 0, 1 ]);
- };
- function d3_scale_identity(domain) {
- function identity(x) {
- return +x;
- }
- identity.invert = identity;
- identity.domain = identity.range = function(x) {
- if (!arguments.length) return domain;
- domain = x.map(identity);
- return identity;
- };
- identity.ticks = function(m) {
- return d3_scale_linearTicks(domain, m);
- };
- identity.tickFormat = function(m) {
- return d3_scale_linearTickFormat(domain, m);
- };
- identity.copy = function() {
- return d3_scale_identity(domain);
- };
- return identity;
- }
- d3.svg = {};
- d3.svg.arc = function() {
- var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
- function arc() {
- var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0,
- a0 = a1, a1 = da), a1 - a0), df = da < π ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
- return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
- }
- arc.innerRadius = function(v) {
- if (!arguments.length) return innerRadius;
- innerRadius = d3_functor(v);
- return arc;
- };
- arc.outerRadius = function(v) {
- if (!arguments.length) return outerRadius;
- outerRadius = d3_functor(v);
- return arc;
- };
- arc.startAngle = function(v) {
- if (!arguments.length) return startAngle;
- startAngle = d3_functor(v);
- return arc;
- };
- arc.endAngle = function(v) {
- if (!arguments.length) return endAngle;
- endAngle = d3_functor(v);
- return arc;
- };
- arc.centroid = function() {
- var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
- return [ Math.cos(a) * r, Math.sin(a) * r ];
- };
- return arc;
- };
- var d3_svg_arcOffset = -π / 2, d3_svg_arcMax = 2 * π - 1e-6;
- function d3_svg_arcInnerRadius(d) {
- return d.innerRadius;
- }
- function d3_svg_arcOuterRadius(d) {
- return d.outerRadius;
- }
- function d3_svg_arcStartAngle(d) {
- return d.startAngle;
- }
- function d3_svg_arcEndAngle(d) {
- return d.endAngle;
- }
- function d3_svg_line(projection) {
- var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
- function line(data) {
- var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
- function segment() {
- segments.push("M", interpolate(projection(points), tension));
- }
- while (++i < n) {
- if (defined.call(this, d = data[i], i)) {
- points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
- } else if (points.length) {
- segment();
- points = [];
- }
- }
- if (points.length) segment();
- return segments.length ? segments.join("") : null;
- }
- line.x = function(_) {
- if (!arguments.length) return x;
- x = _;
- return line;
- };
- line.y = function(_) {
- if (!arguments.length) return y;
- y = _;
- return line;
- };
- line.defined = function(_) {
- if (!arguments.length) return defined;
- defined = _;
- return line;
- };
- line.interpolate = function(_) {
- if (!arguments.length) return interpolateKey;
- if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
- return line;
- };
- line.tension = function(_) {
- if (!arguments.length) return tension;
- tension = _;
- return line;
- };
- return line;
- }
- d3.svg.line = function() {
- return d3_svg_line(d3_identity);
- };
- function d3_svg_lineX(d) {
- return d[0];
- }
- function d3_svg_lineY(d) {
- return d[1];
- }
- var d3_svg_lineInterpolators = d3.map({
- linear: d3_svg_lineLinear,
- "linear-closed": d3_svg_lineLinearClosed,
- "step-before": d3_svg_lineStepBefore,
- "step-after": d3_svg_lineStepAfter,
- basis: d3_svg_lineBasis,
- "basis-open": d3_svg_lineBasisOpen,
- "basis-closed": d3_svg_lineBasisClosed,
- bundle: d3_svg_lineBundle,
- cardinal: d3_svg_lineCardinal,
- "cardinal-open": d3_svg_lineCardinalOpen,
- "cardinal-closed": d3_svg_lineCardinalClosed,
- monotone: d3_svg_lineMonotone
- });
- d3_svg_lineInterpolators.forEach(function(key, value) {
- value.key = key;
- value.closed = /-closed$/.test(key);
- });
- function d3_svg_lineLinear(points) {
- return points.join("L");
- }
- function d3_svg_lineLinearClosed(points) {
- return d3_svg_lineLinear(points) + "Z";
- }
- function d3_svg_lineStepBefore(points) {
- var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
- while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
- return path.join("");
- }
- function d3_svg_lineStepAfter(points) {
- var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
- while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
- return path.join("");
- }
- function d3_svg_lineCardinalOpen(points, tension) {
- return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
- }
- function d3_svg_lineCardinalClosed(points, tension) {
- return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
- points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
- }
- function d3_svg_lineCardinal(points, tension) {
- return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
- }
- function d3_svg_lineHermite(points, tangents) {
- if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
- return d3_svg_lineLinear(points);
- }
- var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
- if (quad) {
- path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
- p0 = points[1];
- pi = 2;
- }
- if (tangents.length > 1) {
- t = tangents[1];
- p = points[pi];
- pi++;
- path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
- for (var i = 2; i < tangents.length; i++, pi++) {
- p = points[pi];
- t = tangents[i];
- path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
- }
- }
- if (quad) {
- var lp = points[pi];
- path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
- }
- return path;
- }
- function d3_svg_lineCardinalTangents(points, tension) {
- var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
- while (++i < n) {
- p0 = p1;
- p1 = p2;
- p2 = points[i];
- tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
- }
- return tangents;
- }
- function d3_svg_lineBasis(points) {
- if (points.length < 3) return d3_svg_lineLinear(points);
- var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
- d3_svg_lineBasisBezier(path, px, py);
- while (++i < n) {
- pi = points[i];
- px.shift();
- px.push(pi[0]);
- py.shift();
- py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- i = -1;
- while (++i < 2) {
- px.shift();
- px.push(pi[0]);
- py.shift();
- py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
- }
- function d3_svg_lineBasisOpen(points) {
- if (points.length < 4) return d3_svg_lineLinear(points);
- var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
- while (++i < 3) {
- pi = points[i];
- px.push(pi[0]);
- py.push(pi[1]);
- }
- path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
- --i;
- while (++i < n) {
- pi = points[i];
- px.shift();
- px.push(pi[0]);
- py.shift();
- py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
- }
- function d3_svg_lineBasisClosed(points) {
- var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
- while (++i < 4) {
- pi = points[i % n];
- px.push(pi[0]);
- py.push(pi[1]);
- }
- path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
- --i;
- while (++i < m) {
- pi = points[i % n];
- px.shift();
- px.push(pi[0]);
- py.shift();
- py.push(pi[1]);
- d3_svg_lineBasisBezier(path, px, py);
- }
- return path.join("");
- }
- function d3_svg_lineBundle(points, tension) {
- var n = points.length - 1;
- if (n) {
- var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
- while (++i <= n) {
- p = points[i];
- t = i / n;
- p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
- p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
- }
- }
- return d3_svg_lineBasis(points);
- }
- function d3_svg_lineDot4(a, b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
- }
- var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
- function d3_svg_lineBasisBezier(path, x, y) {
- path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
- }
- function d3_svg_lineSlope(p0, p1) {
- return (p1[1] - p0[1]) / (p1[0] - p0[0]);
- }
- function d3_svg_lineFiniteDifferences(points) {
- var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
- while (++i < j) {
- m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
- }
- m[i] = d;
- return m;
- }
- function d3_svg_lineMonotoneTangents(points) {
- var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
- while (++i < j) {
- d = d3_svg_lineSlope(points[i], points[i + 1]);
- if (Math.abs(d) < 1e-6) {
- m[i] = m[i + 1] = 0;
- } else {
- a = m[i] / d;
- b = m[i + 1] / d;
- s = a * a + b * b;
- if (s > 9) {
- s = d * 3 / Math.sqrt(s);
- m[i] = s * a;
- m[i + 1] = s * b;
- }
- }
- }
- i = -1;
- while (++i <= j) {
- s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
- tangents.push([ s || 0, m[i] * s || 0 ]);
- }
- return tangents;
- }
- function d3_svg_lineMonotone(points) {
- return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
- }
- d3.svg.line.radial = function() {
- var line = d3_svg_line(d3_svg_lineRadial);
- line.radius = line.x, delete line.x;
- line.angle = line.y, delete line.y;
- return line;
- };
- function d3_svg_lineRadial(points) {
- var point, i = -1, n = points.length, r, a;
- while (++i < n) {
- point = points[i];
- r = point[0];
- a = point[1] + d3_svg_arcOffset;
- point[0] = r * Math.cos(a);
- point[1] = r * Math.sin(a);
- }
- return points;
- }
- function d3_svg_area(projection) {
- var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
- function area(data) {
- var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
- return x;
- } : d3_functor(x1), fy1 = y0 === y1 ? function() {
- return y;
- } : d3_functor(y1), x, y;
- function segment() {
- segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
- }
- while (++i < n) {
- if (defined.call(this, d = data[i], i)) {
- points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
- points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
- } else if (points0.length) {
- segment();
- points0 = [];
- points1 = [];
- }
- }
- if (points0.length) segment();
- return segments.length ? segments.join("") : null;
- }
- area.x = function(_) {
- if (!arguments.length) return x1;
- x0 = x1 = _;
- return area;
- };
- area.x0 = function(_) {
- if (!arguments.length) return x0;
- x0 = _;
- return area;
- };
- area.x1 = function(_) {
- if (!arguments.length) return x1;
- x1 = _;
- return area;
- };
- area.y = function(_) {
- if (!arguments.length) return y1;
- y0 = y1 = _;
- return area;
- };
- area.y0 = function(_) {
- if (!arguments.length) return y0;
- y0 = _;
- return area;
- };
- area.y1 = function(_) {
- if (!arguments.length) return y1;
- y1 = _;
- return area;
- };
- area.defined = function(_) {
- if (!arguments.length) return defined;
- defined = _;
- return area;
- };
- area.interpolate = function(_) {
- if (!arguments.length) return interpolateKey;
- if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
- interpolateReverse = interpolate.reverse || interpolate;
- L = interpolate.closed ? "M" : "L";
- return area;
- };
- area.tension = function(_) {
- if (!arguments.length) return tension;
- tension = _;
- return area;
- };
- return area;
- }
- d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
- d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
- d3.svg.area = function() {
- return d3_svg_area(d3_identity);
- };
- d3.svg.area.radial = function() {
- var area = d3_svg_area(d3_svg_lineRadial);
- area.radius = area.x, delete area.x;
- area.innerRadius = area.x0, delete area.x0;
- area.outerRadius = area.x1, delete area.x1;
- area.angle = area.y, delete area.y;
- area.startAngle = area.y0, delete area.y0;
- area.endAngle = area.y1, delete area.y1;
- return area;
- };
- d3.svg.chord = function() {
- var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
- function chord(d, i) {
- var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
- return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
- }
- function subgroup(self, f, d, i) {
- var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
- return {
- r: r,
- a0: a0,
- a1: a1,
- p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
- p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
- };
- }
- function equals(a, b) {
- return a.a0 == b.a0 && a.a1 == b.a1;
- }
- function arc(r, p, a) {
- return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p;
- }
- function curve(r0, p0, r1, p1) {
- return "Q 0,0 " + p1;
- }
- chord.radius = function(v) {
- if (!arguments.length) return radius;
- radius = d3_functor(v);
- return chord;
- };
- chord.source = function(v) {
- if (!arguments.length) return source;
- source = d3_functor(v);
- return chord;
- };
- chord.target = function(v) {
- if (!arguments.length) return target;
- target = d3_functor(v);
- return chord;
- };
- chord.startAngle = function(v) {
- if (!arguments.length) return startAngle;
- startAngle = d3_functor(v);
- return chord;
- };
- chord.endAngle = function(v) {
- if (!arguments.length) return endAngle;
- endAngle = d3_functor(v);
- return chord;
- };
- return chord;
- };
- function d3_svg_chordRadius(d) {
- return d.radius;
- }
- d3.svg.diagonal = function() {
- var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;
- function diagonal(d, i) {
- var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
- x: p0.x,
- y: m
- }, {
- x: p3.x,
- y: m
- }, p3 ];
- p = p.map(projection);
- return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
- }
- diagonal.source = function(x) {
- if (!arguments.length) return source;
- source = d3_functor(x);
- return diagonal;
- };
- diagonal.target = function(x) {
- if (!arguments.length) return target;
- target = d3_functor(x);
- return diagonal;
- };
- diagonal.projection = function(x) {
- if (!arguments.length) return projection;
- projection = x;
- return diagonal;
- };
- return diagonal;
- };
- function d3_svg_diagonalProjection(d) {
- return [ d.x, d.y ];
- }
- d3.svg.diagonal.radial = function() {
- var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
- diagonal.projection = function(x) {
- return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
- };
- return diagonal;
- };
- function d3_svg_diagonalRadialProjection(projection) {
- return function() {
- var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
- return [ r * Math.cos(a), r * Math.sin(a) ];
- };
- }
- d3.svg.symbol = function() {
- var type = d3_svg_symbolType, size = d3_svg_symbolSize;
- function symbol(d, i) {
- return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
- }
- symbol.type = function(x) {
- if (!arguments.length) return type;
- type = d3_functor(x);
- return symbol;
- };
- symbol.size = function(x) {
- if (!arguments.length) return size;
- size = d3_functor(x);
- return symbol;
- };
- return symbol;
- };
- function d3_svg_symbolSize() {
- return 64;
- }
- function d3_svg_symbolType() {
- return "circle";
- }
- function d3_svg_symbolCircle(size) {
- var r = Math.sqrt(size / π);
- return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
- }
- var d3_svg_symbols = d3.map({
- circle: d3_svg_symbolCircle,
- cross: function(size) {
- var r = Math.sqrt(size / 5) / 2;
- return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
- },
- diamond: function(size) {
- var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
- return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
- },
- square: function(size) {
- var r = Math.sqrt(size) / 2;
- return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
- },
- "triangle-down": function(size) {
- var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
- return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
- },
- "triangle-up": function(size) {
- var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
- return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
- }
- });
- d3.svg.symbolTypes = d3_svg_symbols.keys();
- var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);
- d3.svg.axis = function() {
- var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
- function axis(g) {
- g.each(function() {
- var g = d3.select(this);
- var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
- var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".tick.minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", ".tick").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
- var tick = g.selectAll(".tick.major").data(ticks, String), tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
- var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
- d3.transition(path));
- var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
- this.__chart__ = scale1;
- tickEnter.append("line");
- tickEnter.append("text");
- var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
- switch (orient) {
- case "bottom":
- {
- tickTransform = d3_svg_axisX;
- subtickEnter.attr("y2", tickMinorSize);
- subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
- lineEnter.attr("y2", tickMajorSize);
- textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
- lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
- textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
- text.attr("dy", ".71em").style("text-anchor", "middle");
- pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
- break;
- }
-
- case "top":
- {
- tickTransform = d3_svg_axisX;
- subtickEnter.attr("y2", -tickMinorSize);
- subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
- lineEnter.attr("y2", -tickMajorSize);
- textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
- lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
- textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
- text.attr("dy", "0em").style("text-anchor", "middle");
- pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
- break;
- }
-
- case "left":
- {
- tickTransform = d3_svg_axisY;
- subtickEnter.attr("x2", -tickMinorSize);
- subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
- lineEnter.attr("x2", -tickMajorSize);
- textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
- lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
- textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
- text.attr("dy", ".32em").style("text-anchor", "end");
- pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
- break;
- }
-
- case "right":
- {
- tickTransform = d3_svg_axisY;
- subtickEnter.attr("x2", tickMinorSize);
- subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
- lineEnter.attr("x2", tickMajorSize);
- textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
- lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
- textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
- text.attr("dy", ".32em").style("text-anchor", "start");
- pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
- break;
- }
- }
- if (scale.ticks) {
- tickEnter.call(tickTransform, scale0);
- tickUpdate.call(tickTransform, scale1);
- tickExit.call(tickTransform, scale1);
- subtickEnter.call(tickTransform, scale0);
- subtickUpdate.call(tickTransform, scale1);
- subtickExit.call(tickTransform, scale1);
- } else {
- var dx = scale1.rangeBand() / 2, x = function(d) {
- return scale1(d) + dx;
- };
- tickEnter.call(tickTransform, x);
- tickUpdate.call(tickTransform, x);
- }
- });
- }
- axis.scale = function(x) {
- if (!arguments.length) return scale;
- scale = x;
- return axis;
- };
- axis.orient = function(x) {
- if (!arguments.length) return orient;
- orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient;
- return axis;
- };
- axis.ticks = function() {
- if (!arguments.length) return tickArguments_;
- tickArguments_ = arguments;
- return axis;
- };
- axis.tickValues = function(x) {
- if (!arguments.length) return tickValues;
- tickValues = x;
- return axis;
- };
- axis.tickFormat = function(x) {
- if (!arguments.length) return tickFormat_;
- tickFormat_ = x;
- return axis;
- };
- axis.tickSize = function(x, y) {
- if (!arguments.length) return tickMajorSize;
- var n = arguments.length - 1;
- tickMajorSize = +x;
- tickMinorSize = n > 1 ? +y : tickMajorSize;
- tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
- return axis;
- };
- axis.tickPadding = function(x) {
- if (!arguments.length) return tickPadding;
- tickPadding = +x;
- return axis;
- };
- axis.tickSubdivide = function(x) {
- if (!arguments.length) return tickSubdivide;
- tickSubdivide = +x;
- return axis;
- };
- return axis;
- };
- var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = {
- top: 1,
- right: 1,
- bottom: 1,
- left: 1
- };
- function d3_svg_axisX(selection, x) {
- selection.attr("transform", function(d) {
- return "translate(" + x(d) + ",0)";
- });
- }
- function d3_svg_axisY(selection, y) {
- selection.attr("transform", function(d) {
- return "translate(0," + y(d) + ")";
- });
- }
- function d3_svg_axisSubdivide(scale, ticks, m) {
- subticks = [];
- if (m && ticks.length > 1) {
- var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
- while (++i < n) {
- for (j = m; --j > 0; ) {
- if ((v = +ticks[i] - j * d) >= extent[0]) {
- subticks.push(v);
- }
- }
- }
- for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
- subticks.push(v);
- }
- }
- return subticks;
- }
- d3.svg.brush = function() {
- var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
- function brush(g) {
- g.each(function() {
- var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
- g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
- bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
- fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
- tz.enter().append("g").attr("class", function(d) {
- return "resize " + d;
- }).style("cursor", function(d) {
- return d3_svg_brushCursor[d];
- }).append("rect").attr("x", function(d) {
- return /[ew]$/.test(d) ? -3 : null;
- }).attr("y", function(d) {
- return /^[ns]/.test(d) ? -3 : null;
- }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
- tz.style("display", brush.empty() ? "none" : null);
- tz.exit().remove();
- if (x) {
- e = d3_scaleRange(x);
- bg.attr("x", e[0]).attr("width", e[1] - e[0]);
- redrawX(g);
- }
- if (y) {
- e = d3_scaleRange(y);
- bg.attr("y", e[0]).attr("height", e[1] - e[0]);
- redrawY(g);
- }
- redraw(g);
- });
- }
- function redraw(g) {
- g.selectAll(".resize").attr("transform", function(d) {
- return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
- });
- }
- function redrawX(g) {
- g.select(".extent").attr("x", extent[0][0]);
- g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
- }
- function redrawY(g) {
- g.select(".extent").attr("y", extent[0][1]);
- g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
- }
- function brushstart() {
- var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
- var w = d3.select(d3_window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
- if (dragging) {
- origin[0] = extent[0][0] - origin[0];
- origin[1] = extent[0][1] - origin[1];
- } else if (resizing) {
- var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
- offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
- origin[0] = extent[ex][0];
- origin[1] = extent[ey][1];
- } else if (d3.event.altKey) center = origin.slice();
- g.style("pointer-events", "none").selectAll(".resize").style("display", null);
- d3.select("body").style("cursor", eventTarget.style("cursor"));
- event_({
- type: "brushstart"
- });
- brushmove();
- d3_eventCancel();
- function mouse() {
- var touches = d3.event.changedTouches;
- return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
- }
- function keydown() {
- if (d3.event.keyCode == 32) {
- if (!dragging) {
- center = null;
- origin[0] -= extent[1][0];
- origin[1] -= extent[1][1];
- dragging = 2;
- }
- d3_eventCancel();
- }
- }
- function keyup() {
- if (d3.event.keyCode == 32 && dragging == 2) {
- origin[0] += extent[1][0];
- origin[1] += extent[1][1];
- dragging = 0;
- d3_eventCancel();
- }
- }
- function brushmove() {
- var point = mouse(), moved = false;
- if (offset) {
- point[0] += offset[0];
- point[1] += offset[1];
- }
- if (!dragging) {
- if (d3.event.altKey) {
- if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
- origin[0] = extent[+(point[0] < center[0])][0];
- origin[1] = extent[+(point[1] < center[1])][1];
- } else center = null;
- }
- if (resizingX && move1(point, x, 0)) {
- redrawX(g);
- moved = true;
- }
- if (resizingY && move1(point, y, 1)) {
- redrawY(g);
- moved = true;
- }
- if (moved) {
- redraw(g);
- event_({
- type: "brush",
- mode: dragging ? "move" : "resize"
- });
- }
- }
- function move1(point, scale, i) {
- var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
- if (dragging) {
- r0 -= position;
- r1 -= size + position;
- }
- min = Math.max(r0, Math.min(r1, point[i]));
- if (dragging) {
- max = (min += position) + size;
- } else {
- if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
- if (position < min) {
- max = min;
- min = position;
- } else {
- max = position;
- }
- }
- if (extent[0][i] !== min || extent[1][i] !== max) {
- extentDomain = null;
- extent[0][i] = min;
- extent[1][i] = max;
- return true;
- }
- }
- function brushend() {
- brushmove();
- g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
- d3.select("body").style("cursor", null);
- w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
- event_({
- type: "brushend"
- });
- d3_eventCancel();
- }
- }
- brush.x = function(z) {
- if (!arguments.length) return x;
- x = z;
- resizes = d3_svg_brushResizes[!x << 1 | !y];
- return brush;
- };
- brush.y = function(z) {
- if (!arguments.length) return y;
- y = z;
- resizes = d3_svg_brushResizes[!x << 1 | !y];
- return brush;
- };
- brush.extent = function(z) {
- var x0, x1, y0, y1, t;
- if (!arguments.length) {
- z = extentDomain || extent;
- if (x) {
- x0 = z[0][0], x1 = z[1][0];
- if (!extentDomain) {
- x0 = extent[0][0], x1 = extent[1][0];
- if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
- if (x1 < x0) t = x0, x0 = x1, x1 = t;
- }
- }
- if (y) {
- y0 = z[0][1], y1 = z[1][1];
- if (!extentDomain) {
- y0 = extent[0][1], y1 = extent[1][1];
- if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
- if (y1 < y0) t = y0, y0 = y1, y1 = t;
- }
- }
- return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
- }
- extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
- if (x) {
- x0 = z[0], x1 = z[1];
- if (y) x0 = x0[0], x1 = x1[0];
- extentDomain[0][0] = x0, extentDomain[1][0] = x1;
- if (x.invert) x0 = x(x0), x1 = x(x1);
- if (x1 < x0) t = x0, x0 = x1, x1 = t;
- extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
- }
- if (y) {
- y0 = z[0], y1 = z[1];
- if (x) y0 = y0[1], y1 = y1[1];
- extentDomain[0][1] = y0, extentDomain[1][1] = y1;
- if (y.invert) y0 = y(y0), y1 = y(y1);
- if (y1 < y0) t = y0, y0 = y1, y1 = t;
- extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
- }
- return brush;
- };
- brush.clear = function() {
- extentDomain = null;
- extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
- return brush;
- };
- brush.empty = function() {
- return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
- };
- return d3.rebind(brush, event, "on");
- };
- var d3_svg_brushCursor = {
- n: "ns-resize",
- e: "ew-resize",
- s: "ns-resize",
- w: "ew-resize",
- nw: "nwse-resize",
- ne: "nesw-resize",
- se: "nwse-resize",
- sw: "nesw-resize"
- };
- var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
- d3.behavior = {};
- d3.behavior.drag = function() {
- var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
- function drag() {
- this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
- }
- function mousedown() {
- var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches ? d3.event.changedTouches[0].identifier : null, offset, origin_ = point(), moved = 0;
- var w = d3.select(d3_window).on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
- if (origin) {
- offset = origin.apply(target, arguments);
- offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
- } else {
- offset = [ 0, 0 ];
- }
- if (touchId == null) d3_eventCancel();
- event_({
- type: "dragstart"
- });
- function point() {
- var p = target.parentNode;
- return touchId != null ? d3.touches(p).filter(function(p) {
- return p.identifier === touchId;
- })[0] : d3.mouse(p);
- }
- function dragmove() {
- if (!target.parentNode) return dragend();
- var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
- moved |= dx | dy;
- origin_ = p;
- d3_eventCancel();
- event_({
- type: "drag",
- x: p[0] + offset[0],
- y: p[1] + offset[1],
- dx: dx,
- dy: dy
- });
- }
- function dragend() {
- event_({
- type: "dragend"
- });
- if (moved) {
- d3_eventCancel();
- if (d3.event.target === eventTarget) w.on("click.drag", click, true);
- }
- w.on(touchId != null ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId != null ? "touchend.drag-" + touchId : "mouseup.drag", null);
- }
- function click() {
- d3_eventCancel();
- w.on("click.drag", null);
- }
- }
- drag.origin = function(x) {
- if (!arguments.length) return origin;
- origin = x;
- return drag;
- };
- return d3.rebind(drag, event, "on");
- };
- d3.behavior.zoom = function() {
- var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
- function zoom() {
- this.on("mousedown.zoom", mousedown).on("mousemove.zoom", mousemove).on(d3_behavior_zoomWheel + ".zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
- }
- zoom.translate = function(x) {
- if (!arguments.length) return translate;
- translate = x.map(Number);
- rescale();
- return zoom;
- };
- zoom.scale = function(x) {
- if (!arguments.length) return scale;
- scale = +x;
- rescale();
- return zoom;
- };
- zoom.scaleExtent = function(x) {
- if (!arguments.length) return scaleExtent;
- scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
- return zoom;
- };
- zoom.x = function(z) {
- if (!arguments.length) return x1;
- x1 = z;
- x0 = z.copy();
- translate = [ 0, 0 ];
- scale = 1;
- return zoom;
- };
- zoom.y = function(z) {
- if (!arguments.length) return y1;
- y1 = z;
- y0 = z.copy();
- translate = [ 0, 0 ];
- scale = 1;
- return zoom;
- };
- function location(p) {
- return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
- }
- function point(l) {
- return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
- }
- function scaleTo(s) {
- scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
- }
- function translateTo(p, l) {
- l = point(l);
- translate[0] += p[0] - l[0];
- translate[1] += p[1] - l[1];
- }
- function rescale() {
- if (x1) x1.domain(x0.range().map(function(x) {
- return (x - translate[0]) / scale;
- }).map(x0.invert));
- if (y1) y1.domain(y0.range().map(function(y) {
- return (y - translate[1]) / scale;
- }).map(y0.invert));
- }
- function dispatch(event) {
- rescale();
- d3.event.preventDefault();
- event({
- type: "zoom",
- scale: scale,
- translate: translate
- });
- }
- function mousedown() {
- var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(d3_window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
- d3_window.focus();
- d3_eventCancel();
- function mousemove() {
- moved = 1;
- translateTo(d3.mouse(target), l);
- dispatch(event_);
- }
- function mouseup() {
- if (moved) d3_eventCancel();
- w.on("mousemove.zoom", null).on("mouseup.zoom", null);
- if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
- }
- function click() {
- d3_eventCancel();
- w.on("click.zoom", null);
- }
- }
- function mousewheel() {
- if (!translate0) translate0 = location(d3.mouse(this));
- scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
- translateTo(d3.mouse(this), translate0);
- dispatch(event.of(this, arguments));
- }
- function mousemove() {
- translate0 = null;
- }
- function dblclick() {
- var p = d3.mouse(this), l = location(p), k = Math.log(scale) / Math.LN2;
- scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1));
- translateTo(p, l);
- dispatch(event.of(this, arguments));
- }
- function touchstart() {
- var touches = d3.touches(this), now = Date.now();
- scale0 = scale;
- translate0 = {};
- touches.forEach(function(t) {
- translate0[t.identifier] = location(t);
- });
- d3_eventCancel();
- if (touches.length === 1) {
- if (now - touchtime < 500) {
- var p = touches[0], l = location(touches[0]);
- scaleTo(scale * 2);
- translateTo(p, l);
- dispatch(event.of(this, arguments));
- }
- touchtime = now;
- }
- }
- function touchmove() {
- var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
- if (p1 = touches[1]) {
- var p1, l1 = translate0[p1.identifier];
- p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
- l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
- scaleTo(d3.event.scale * scale0);
- }
- translateTo(p0, l0);
- touchtime = null;
- dispatch(event.of(this, arguments));
- }
- return d3.rebind(zoom, event, "on");
- };
- var d3_behavior_zoomInfinity = [ 0, Infinity ];
- var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in document ? (d3_behavior_zoomDelta = function() {
- return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);
- }, "wheel") : "onmousewheel" in document ? (d3_behavior_zoomDelta = function() {
- return d3.event.wheelDelta;
- }, "mousewheel") : (d3_behavior_zoomDelta = function() {
- return -d3.event.detail;
- }, "MozMousePixelScroll");
- d3.layout = {};
- d3.layout.bundle = function() {
- return function(links) {
- var paths = [], i = -1, n = links.length;
- while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
- return paths;
- };
- };
- function d3_layout_bundlePath(link) {
- var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
- while (start !== lca) {
- start = start.parent;
- points.push(start);
- }
- var k = points.length;
- while (end !== lca) {
- points.splice(k, 0, end);
- end = end.parent;
- }
- return points;
- }
- function d3_layout_bundleAncestors(node) {
- var ancestors = [], parent = node.parent;
- while (parent != null) {
- ancestors.push(node);
- node = parent;
- parent = parent.parent;
- }
- ancestors.push(node);
- return ancestors;
- }
- function d3_layout_bundleLeastCommonAncestor(a, b) {
- if (a === b) return a;
- var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
- while (aNode === bNode) {
- sharedNode = aNode;
- aNode = aNodes.pop();
- bNode = bNodes.pop();
- }
- return sharedNode;
- }
- d3.layout.chord = function() {
- var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
- function relayout() {
- var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
- chords = [];
- groups = [];
- k = 0, i = -1;
- while (++i < n) {
- x = 0, j = -1;
- while (++j < n) {
- x += matrix[i][j];
- }
- groupSums.push(x);
- subgroupIndex.push(d3.range(n));
- k += x;
- }
- if (sortGroups) {
- groupIndex.sort(function(a, b) {
- return sortGroups(groupSums[a], groupSums[b]);
- });
- }
- if (sortSubgroups) {
- subgroupIndex.forEach(function(d, i) {
- d.sort(function(a, b) {
- return sortSubgroups(matrix[i][a], matrix[i][b]);
- });
- });
- }
- k = (2 * π - padding * n) / k;
- x = 0, i = -1;
- while (++i < n) {
- x0 = x, j = -1;
- while (++j < n) {
- var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
- subgroups[di + "-" + dj] = {
- index: di,
- subindex: dj,
- startAngle: a0,
- endAngle: a1,
- value: v
- };
- }
- groups[di] = {
- index: di,
- startAngle: x0,
- endAngle: x,
- value: (x - x0) / k
- };
- x += padding;
- }
- i = -1;
- while (++i < n) {
- j = i - 1;
- while (++j < n) {
- var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
- if (source.value || target.value) {
- chords.push(source.value < target.value ? {
- source: target,
- target: source
- } : {
- source: source,
- target: target
- });
- }
- }
- }
- if (sortChords) resort();
- }
- function resort() {
- chords.sort(function(a, b) {
- return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
- });
- }
- chord.matrix = function(x) {
- if (!arguments.length) return matrix;
- n = (matrix = x) && matrix.length;
- chords = groups = null;
- return chord;
- };
- chord.padding = function(x) {
- if (!arguments.length) return padding;
- padding = x;
- chords = groups = null;
- return chord;
- };
- chord.sortGroups = function(x) {
- if (!arguments.length) return sortGroups;
- sortGroups = x;
- chords = groups = null;
- return chord;
- };
- chord.sortSubgroups = function(x) {
- if (!arguments.length) return sortSubgroups;
- sortSubgroups = x;
- chords = null;
- return chord;
- };
- chord.sortChords = function(x) {
- if (!arguments.length) return sortChords;
- sortChords = x;
- if (chords) resort();
- return chord;
- };
- chord.chords = function() {
- if (!chords) relayout();
- return chords;
- };
- chord.groups = function() {
- if (!groups) relayout();
- return groups;
- };
- return chord;
- };
- d3.layout.force = function() {
- var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, nodes = [], links = [], distances, strengths, charges;
- function repulse(node) {
- return function(quad, x1, _, x2) {
- if (quad.point !== node) {
- var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
- if ((x2 - x1) * dn < theta) {
- var k = quad.charge * dn * dn;
- node.px -= dx * k;
- node.py -= dy * k;
- return true;
- }
- if (quad.point && isFinite(dn)) {
- var k = quad.pointCharge * dn * dn;
- node.px -= dx * k;
- node.py -= dy * k;
- }
- }
- return !quad.charge;
- };
- }
- force.tick = function() {
- if ((alpha *= .99) < .005) {
- event.end({
- type: "end",
- alpha: alpha = 0
- });
- return true;
- }
- var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
- for (i = 0; i < m; ++i) {
- o = links[i];
- s = o.source;
- t = o.target;
- x = t.x - s.x;
- y = t.y - s.y;
- if (l = x * x + y * y) {
- l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
- x *= l;
- y *= l;
- t.x -= x * (k = s.weight / (t.weight + s.weight));
- t.y -= y * k;
- s.x += x * (k = 1 - k);
- s.y += y * k;
- }
- }
- if (k = alpha * gravity) {
- x = size[0] / 2;
- y = size[1] / 2;
- i = -1;
- if (k) while (++i < n) {
- o = nodes[i];
- o.x += (x - o.x) * k;
- o.y += (y - o.y) * k;
- }
- }
- if (charge) {
- d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
- i = -1;
- while (++i < n) {
- if (!(o = nodes[i]).fixed) {
- q.visit(repulse(o));
- }
- }
- }
- i = -1;
- while (++i < n) {
- o = nodes[i];
- if (o.fixed) {
- o.x = o.px;
- o.y = o.py;
- } else {
- o.x -= (o.px - (o.px = o.x)) * friction;
- o.y -= (o.py - (o.py = o.y)) * friction;
- }
- }
- event.tick({
- type: "tick",
- alpha: alpha
- });
- };
- force.nodes = function(x) {
- if (!arguments.length) return nodes;
- nodes = x;
- return force;
- };
- force.links = function(x) {
- if (!arguments.length) return links;
- links = x;
- return force;
- };
- force.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return force;
- };
- force.linkDistance = function(x) {
- if (!arguments.length) return linkDistance;
- linkDistance = typeof x === "function" ? x : +x;
- return force;
- };
- force.distance = force.linkDistance;
- force.linkStrength = function(x) {
- if (!arguments.length) return linkStrength;
- linkStrength = typeof x === "function" ? x : +x;
- return force;
- };
- force.friction = function(x) {
- if (!arguments.length) return friction;
- friction = +x;
- return force;
- };
- force.charge = function(x) {
- if (!arguments.length) return charge;
- charge = typeof x === "function" ? x : +x;
- return force;
- };
- force.gravity = function(x) {
- if (!arguments.length) return gravity;
- gravity = +x;
- return force;
- };
- force.theta = function(x) {
- if (!arguments.length) return theta;
- theta = +x;
- return force;
- };
- force.alpha = function(x) {
- if (!arguments.length) return alpha;
- x = +x;
- if (alpha) {
- if (x > 0) alpha = x; else alpha = 0;
- } else if (x > 0) {
- event.start({
- type: "start",
- alpha: alpha = x
- });
- d3.timer(force.tick);
- }
- return force;
- };
- force.start = function() {
- var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
- for (i = 0; i < n; ++i) {
- (o = nodes[i]).index = i;
- o.weight = 0;
- }
- for (i = 0; i < m; ++i) {
- o = links[i];
- if (typeof o.source == "number") o.source = nodes[o.source];
- if (typeof o.target == "number") o.target = nodes[o.target];
- ++o.source.weight;
- ++o.target.weight;
- }
- for (i = 0; i < n; ++i) {
- o = nodes[i];
- if (isNaN(o.x)) o.x = position("x", w);
- if (isNaN(o.y)) o.y = position("y", h);
- if (isNaN(o.px)) o.px = o.x;
- if (isNaN(o.py)) o.py = o.y;
- }
- distances = [];
- if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance;
- strengths = [];
- if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength;
- charges = [];
- if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge;
- function position(dimension, size) {
- var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
- while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
- return Math.random() * size;
- }
- function neighbor() {
- if (!neighbors) {
- neighbors = [];
- for (j = 0; j < n; ++j) {
- neighbors[j] = [];
- }
- for (j = 0; j < m; ++j) {
- var o = links[j];
- neighbors[o.source.index].push(o.target);
- neighbors[o.target.index].push(o.source);
- }
- }
- return neighbors[i];
- }
- return force.resume();
- };
- force.resume = function() {
- return force.alpha(.1);
- };
- force.stop = function() {
- return force.alpha(0);
- };
- force.drag = function() {
- if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend);
- if (!arguments.length) return drag;
- this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
- };
- function dragmove(d) {
- d.px = d3.event.x, d.py = d3.event.y;
- force.resume();
- }
- return d3.rebind(force, event, "on");
- };
- function d3_layout_forceDragstart(d) {
- d.fixed |= 2;
- }
- function d3_layout_forceDragend(d) {
- d.fixed &= ~6;
- }
- function d3_layout_forceMouseover(d) {
- d.fixed |= 4;
- d.px = d.x, d.py = d.y;
- }
- function d3_layout_forceMouseout(d) {
- d.fixed &= ~4;
- }
- function d3_layout_forceAccumulate(quad, alpha, charges) {
- var cx = 0, cy = 0;
- quad.charge = 0;
- if (!quad.leaf) {
- var nodes = quad.nodes, n = nodes.length, i = -1, c;
- while (++i < n) {
- c = nodes[i];
- if (c == null) continue;
- d3_layout_forceAccumulate(c, alpha, charges);
- quad.charge += c.charge;
- cx += c.charge * c.cx;
- cy += c.charge * c.cy;
- }
- }
- if (quad.point) {
- if (!quad.leaf) {
- quad.point.x += Math.random() - .5;
- quad.point.y += Math.random() - .5;
- }
- var k = alpha * charges[quad.point.index];
- quad.charge += quad.pointCharge = k;
- cx += k * quad.point.x;
- cy += k * quad.point.y;
- }
- quad.cx = cx / quad.charge;
- quad.cy = cy / quad.charge;
- }
- var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1;
- d3.layout.partition = function() {
- var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
- function position(node, x, dx, dy) {
- var children = node.children;
- node.x = x;
- node.y = node.depth * dy;
- node.dx = dx;
- node.dy = dy;
- if (children && (n = children.length)) {
- var i = -1, n, c, d;
- dx = node.value ? dx / node.value : 0;
- while (++i < n) {
- position(c = children[i], x, d = c.value * dx, dy);
- x += d;
- }
- }
- }
- function depth(node) {
- var children = node.children, d = 0;
- if (children && (n = children.length)) {
- var i = -1, n;
- while (++i < n) d = Math.max(d, depth(children[i]));
- }
- return 1 + d;
- }
- function partition(d, i) {
- var nodes = hierarchy.call(this, d, i);
- position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
- return nodes;
- }
- partition.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return partition;
- };
- return d3_layout_hierarchyRebind(partition, hierarchy);
- };
- d3.layout.pie = function() {
- var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * π;
- function pie(data) {
- var values = data.map(function(d, i) {
- return +value.call(pie, d, i);
- });
- var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
- var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
- var index = d3.range(data.length);
- if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
- return values[j] - values[i];
- } : function(i, j) {
- return sort(data[i], data[j]);
- });
- var arcs = [];
- index.forEach(function(i) {
- var d;
- arcs[i] = {
- data: data[i],
- value: d = values[i],
- startAngle: a,
- endAngle: a += d * k
- };
- });
- return arcs;
- }
- pie.value = function(x) {
- if (!arguments.length) return value;
- value = x;
- return pie;
- };
- pie.sort = function(x) {
- if (!arguments.length) return sort;
- sort = x;
- return pie;
- };
- pie.startAngle = function(x) {
- if (!arguments.length) return startAngle;
- startAngle = x;
- return pie;
- };
- pie.endAngle = function(x) {
- if (!arguments.length) return endAngle;
- endAngle = x;
- return pie;
- };
- return pie;
- };
- var d3_layout_pieSortByValue = {};
- d3.layout.stack = function() {
- var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
- function stack(data, index) {
- var series = data.map(function(d, i) {
- return values.call(stack, d, i);
- });
- var points = series.map(function(d) {
- return d.map(function(v, i) {
- return [ x.call(stack, v, i), y.call(stack, v, i) ];
- });
- });
- var orders = order.call(stack, points, index);
- series = d3.permute(series, orders);
- points = d3.permute(points, orders);
- var offsets = offset.call(stack, points, index);
- var n = series.length, m = series[0].length, i, j, o;
- for (j = 0; j < m; ++j) {
- out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
- for (i = 1; i < n; ++i) {
- out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
- }
- }
- return data;
- }
- stack.values = function(x) {
- if (!arguments.length) return values;
- values = x;
- return stack;
- };
- stack.order = function(x) {
- if (!arguments.length) return order;
- order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
- return stack;
- };
- stack.offset = function(x) {
- if (!arguments.length) return offset;
- offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
- return stack;
- };
- stack.x = function(z) {
- if (!arguments.length) return x;
- x = z;
- return stack;
- };
- stack.y = function(z) {
- if (!arguments.length) return y;
- y = z;
- return stack;
- };
- stack.out = function(z) {
- if (!arguments.length) return out;
- out = z;
- return stack;
- };
- return stack;
- };
- function d3_layout_stackX(d) {
- return d.x;
- }
- function d3_layout_stackY(d) {
- return d.y;
- }
- function d3_layout_stackOut(d, y0, y) {
- d.y0 = y0;
- d.y = y;
- }
- var d3_layout_stackOrders = d3.map({
- "inside-out": function(data) {
- var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
- return max[a] - max[b];
- }), top = 0, bottom = 0, tops = [], bottoms = [];
- for (i = 0; i < n; ++i) {
- j = index[i];
- if (top < bottom) {
- top += sums[j];
- tops.push(j);
- } else {
- bottom += sums[j];
- bottoms.push(j);
- }
- }
- return bottoms.reverse().concat(tops);
- },
- reverse: function(data) {
- return d3.range(data.length).reverse();
- },
- "default": d3_layout_stackOrderDefault
- });
- var d3_layout_stackOffsets = d3.map({
- silhouette: function(data) {
- var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
- for (j = 0; j < m; ++j) {
- for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
- if (o > max) max = o;
- sums.push(o);
- }
- for (j = 0; j < m; ++j) {
- y0[j] = (max - sums[j]) / 2;
- }
- return y0;
- },
- wiggle: function(data) {
- var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
- y0[0] = o = o0 = 0;
- for (j = 1; j < m; ++j) {
- for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
- for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
- for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
- s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
- }
- s2 += s3 * data[i][j][1];
- }
- y0[j] = o -= s1 ? s2 / s1 * dx : 0;
- if (o < o0) o0 = o;
- }
- for (j = 0; j < m; ++j) y0[j] -= o0;
- return y0;
- },
- expand: function(data) {
- var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
- for (j = 0; j < m; ++j) {
- for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
- if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
- }
- for (j = 0; j < m; ++j) y0[j] = 0;
- return y0;
- },
- zero: d3_layout_stackOffsetZero
- });
- function d3_layout_stackOrderDefault(data) {
- return d3.range(data.length);
- }
- function d3_layout_stackOffsetZero(data) {
- var j = -1, m = data[0].length, y0 = [];
- while (++j < m) y0[j] = 0;
- return y0;
- }
- function d3_layout_stackMaxIndex(array) {
- var i = 1, j = 0, v = array[0][1], k, n = array.length;
- for (;i < n; ++i) {
- if ((k = array[i][1]) > v) {
- j = i;
- v = k;
- }
- }
- return j;
- }
- function d3_layout_stackReduceSum(d) {
- return d.reduce(d3_layout_stackSum, 0);
- }
- function d3_layout_stackSum(p, d) {
- return p + d[1];
- }
- d3.layout.histogram = function() {
- var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
- function histogram(data, i) {
- var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
- while (++i < m) {
- bin = bins[i] = [];
- bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
- bin.y = 0;
- }
- if (m > 0) {
- i = -1;
- while (++i < n) {
- x = values[i];
- if (x >= range[0] && x <= range[1]) {
- bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
- bin.y += k;
- bin.push(data[i]);
- }
- }
- }
- return bins;
- }
- histogram.value = function(x) {
- if (!arguments.length) return valuer;
- valuer = x;
- return histogram;
- };
- histogram.range = function(x) {
- if (!arguments.length) return ranger;
- ranger = d3_functor(x);
- return histogram;
- };
- histogram.bins = function(x) {
- if (!arguments.length) return binner;
- binner = typeof x === "number" ? function(range) {
- return d3_layout_histogramBinFixed(range, x);
- } : d3_functor(x);
- return histogram;
- };
- histogram.frequency = function(x) {
- if (!arguments.length) return frequency;
- frequency = !!x;
- return histogram;
- };
- return histogram;
- };
- function d3_layout_histogramBinSturges(range, values) {
- return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
- }
- function d3_layout_histogramBinFixed(range, n) {
- var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
- while (++x <= n) f[x] = m * x + b;
- return f;
- }
- function d3_layout_histogramRange(values) {
- return [ d3.min(values), d3.max(values) ];
- }
- d3.layout.hierarchy = function() {
- var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
- function recurse(node, depth, nodes) {
- var childs = children.call(hierarchy, node, depth);
- node.depth = depth;
- nodes.push(node);
- if (childs && (n = childs.length)) {
- var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
- while (++i < n) {
- d = recurse(childs[i], j, nodes);
- d.parent = node;
- c.push(d);
- v += d.value;
- }
- if (sort) c.sort(sort);
- if (value) node.value = v;
- } else if (value) {
- node.value = +value.call(hierarchy, node, depth) || 0;
- }
- return node;
- }
- function revalue(node, depth) {
- var children = node.children, v = 0;
- if (children && (n = children.length)) {
- var i = -1, n, j = depth + 1;
- while (++i < n) v += revalue(children[i], j);
- } else if (value) {
- v = +value.call(hierarchy, node, depth) || 0;
- }
- if (value) node.value = v;
- return v;
- }
- function hierarchy(d) {
- var nodes = [];
- recurse(d, 0, nodes);
- return nodes;
- }
- hierarchy.sort = function(x) {
- if (!arguments.length) return sort;
- sort = x;
- return hierarchy;
- };
- hierarchy.children = function(x) {
- if (!arguments.length) return children;
- children = x;
- return hierarchy;
- };
- hierarchy.value = function(x) {
- if (!arguments.length) return value;
- value = x;
- return hierarchy;
- };
- hierarchy.revalue = function(root) {
- revalue(root, 0);
- return root;
- };
- return hierarchy;
- };
- function d3_layout_hierarchyRebind(object, hierarchy) {
- d3.rebind(object, hierarchy, "sort", "children", "value");
- object.nodes = object;
- object.links = d3_layout_hierarchyLinks;
- return object;
- }
- function d3_layout_hierarchyChildren(d) {
- return d.children;
- }
- function d3_layout_hierarchyValue(d) {
- return d.value;
- }
- function d3_layout_hierarchySort(a, b) {
- return b.value - a.value;
- }
- function d3_layout_hierarchyLinks(nodes) {
- return d3.merge(nodes.map(function(parent) {
- return (parent.children || []).map(function(child) {
- return {
- source: parent,
- target: child
- };
- });
- }));
- }
- d3.layout.pack = function() {
- var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
- function pack(d, i) {
- var nodes = hierarchy.call(this, d, i), root = nodes[0];
- root.x = 0;
- root.y = 0;
- d3_layout_treeVisitAfter(root, function(d) {
- d.r = Math.sqrt(d.value);
- });
- d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
- var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
- if (padding > 0) {
- var dr = padding * k / 2;
- d3_layout_treeVisitAfter(root, function(d) {
- d.r += dr;
- });
- d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
- d3_layout_treeVisitAfter(root, function(d) {
- d.r -= dr;
- });
- k = Math.max(2 * root.r / w, 2 * root.r / h);
- }
- d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
- return nodes;
- }
- pack.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return pack;
- };
- pack.padding = function(_) {
- if (!arguments.length) return padding;
- padding = +_;
- return pack;
- };
- return d3_layout_hierarchyRebind(pack, hierarchy);
- };
- function d3_layout_packSort(a, b) {
- return a.value - b.value;
- }
- function d3_layout_packInsert(a, b) {
- var c = a._pack_next;
- a._pack_next = b;
- b._pack_prev = a;
- b._pack_next = c;
- c._pack_prev = b;
- }
- function d3_layout_packSplice(a, b) {
- a._pack_next = b;
- b._pack_prev = a;
- }
- function d3_layout_packIntersects(a, b) {
- var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
- return dr * dr - dx * dx - dy * dy > .001;
- }
- function d3_layout_packSiblings(node) {
- if (!(nodes = node.children) || !(n = nodes.length)) return;
- var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
- function bound(node) {
- xMin = Math.min(node.x - node.r, xMin);
- xMax = Math.max(node.x + node.r, xMax);
- yMin = Math.min(node.y - node.r, yMin);
- yMax = Math.max(node.y + node.r, yMax);
- }
- nodes.forEach(d3_layout_packLink);
- a = nodes[0];
- a.x = -a.r;
- a.y = 0;
- bound(a);
- if (n > 1) {
- b = nodes[1];
- b.x = b.r;
- b.y = 0;
- bound(b);
- if (n > 2) {
- c = nodes[2];
- d3_layout_packPlace(a, b, c);
- bound(c);
- d3_layout_packInsert(a, c);
- a._pack_prev = c;
- d3_layout_packInsert(c, b);
- b = a._pack_next;
- for (i = 3; i < n; i++) {
- d3_layout_packPlace(a, b, c = nodes[i]);
- var isect = 0, s1 = 1, s2 = 1;
- for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
- if (d3_layout_packIntersects(j, c)) {
- isect = 1;
- break;
- }
- }
- if (isect == 1) {
- for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
- if (d3_layout_packIntersects(k, c)) {
- break;
- }
- }
- }
- if (isect) {
- if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
- i--;
- } else {
- d3_layout_packInsert(a, c);
- b = c;
- bound(c);
- }
- }
- }
- }
- var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
- for (i = 0; i < n; i++) {
- c = nodes[i];
- c.x -= cx;
- c.y -= cy;
- cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
- }
- node.r = cr;
- nodes.forEach(d3_layout_packUnlink);
- }
- function d3_layout_packLink(node) {
- node._pack_next = node._pack_prev = node;
- }
- function d3_layout_packUnlink(node) {
- delete node._pack_next;
- delete node._pack_prev;
- }
- function d3_layout_packTransform(node, x, y, k) {
- var children = node.children;
- node.x = x += k * node.x;
- node.y = y += k * node.y;
- node.r *= k;
- if (children) {
- var i = -1, n = children.length;
- while (++i < n) d3_layout_packTransform(children[i], x, y, k);
- }
- }
- function d3_layout_packPlace(a, b, c) {
- var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
- if (db && (dx || dy)) {
- var da = b.r + c.r, dc = dx * dx + dy * dy;
- da *= da;
- db *= db;
- var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
- c.x = a.x + x * dx + y * dy;
- c.y = a.y + x * dy - y * dx;
- } else {
- c.x = a.x + db;
- c.y = a.y;
- }
- }
- d3.layout.cluster = function() {
- var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
- function cluster(d, i) {
- var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;
- d3_layout_treeVisitAfter(root, function(node) {
- var children = node.children;
- if (children && children.length) {
- node.x = d3_layout_clusterX(children);
- node.y = d3_layout_clusterY(children);
- } else {
- node.x = previousNode ? x += separation(node, previousNode) : 0;
- node.y = 0;
- previousNode = node;
- }
- });
- var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
- d3_layout_treeVisitAfter(root, function(node) {
- node.x = (node.x - x0) / (x1 - x0) * size[0];
- node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
- });
- return nodes;
- }
- cluster.separation = function(x) {
- if (!arguments.length) return separation;
- separation = x;
- return cluster;
- };
- cluster.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return cluster;
- };
- return d3_layout_hierarchyRebind(cluster, hierarchy);
- };
- function d3_layout_clusterY(children) {
- return 1 + d3.max(children, function(child) {
- return child.y;
- });
- }
- function d3_layout_clusterX(children) {
- return children.reduce(function(x, child) {
- return x + child.x;
- }, 0) / children.length;
- }
- function d3_layout_clusterLeft(node) {
- var children = node.children;
- return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
- }
- function d3_layout_clusterRight(node) {
- var children = node.children, n;
- return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
- }
- d3.layout.tree = function() {
- var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
- function tree(d, i) {
- var nodes = hierarchy.call(this, d, i), root = nodes[0];
- function firstWalk(node, previousSibling) {
- var children = node.children, layout = node._tree;
- if (children && (n = children.length)) {
- var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
- while (++i < n) {
- child = children[i];
- firstWalk(child, previousChild);
- ancestor = apportion(child, previousChild, ancestor);
- previousChild = child;
- }
- d3_layout_treeShift(node);
- var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
- if (previousSibling) {
- layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
- layout.mod = layout.prelim - midpoint;
- } else {
- layout.prelim = midpoint;
- }
- } else {
- if (previousSibling) {
- layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
- }
- }
- }
- function secondWalk(node, x) {
- node.x = node._tree.prelim + x;
- var children = node.children;
- if (children && (n = children.length)) {
- var i = -1, n;
- x += node._tree.mod;
- while (++i < n) {
- secondWalk(children[i], x);
- }
- }
- }
- function apportion(node, previousSibling, ancestor) {
- if (previousSibling) {
- var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
- while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
- vom = d3_layout_treeLeft(vom);
- vop = d3_layout_treeRight(vop);
- vop._tree.ancestor = node;
- shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
- if (shift > 0) {
- d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
- sip += shift;
- sop += shift;
- }
- sim += vim._tree.mod;
- sip += vip._tree.mod;
- som += vom._tree.mod;
- sop += vop._tree.mod;
- }
- if (vim && !d3_layout_treeRight(vop)) {
- vop._tree.thread = vim;
- vop._tree.mod += sim - sop;
- }
- if (vip && !d3_layout_treeLeft(vom)) {
- vom._tree.thread = vip;
- vom._tree.mod += sip - som;
- ancestor = node;
- }
- }
- return ancestor;
- }
- d3_layout_treeVisitAfter(root, function(node, previousSibling) {
- node._tree = {
- ancestor: node,
- prelim: 0,
- mod: 0,
- change: 0,
- shift: 0,
- number: previousSibling ? previousSibling._tree.number + 1 : 0
- };
- });
- firstWalk(root);
- secondWalk(root, -root._tree.prelim);
- var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
- d3_layout_treeVisitAfter(root, function(node) {
- node.x = (node.x - x0) / (x1 - x0) * size[0];
- node.y = node.depth / y1 * size[1];
- delete node._tree;
- });
- return nodes;
- }
- tree.separation = function(x) {
- if (!arguments.length) return separation;
- separation = x;
- return tree;
- };
- tree.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return tree;
- };
- return d3_layout_hierarchyRebind(tree, hierarchy);
- };
- function d3_layout_treeSeparation(a, b) {
- return a.parent == b.parent ? 1 : 2;
- }
- function d3_layout_treeLeft(node) {
- var children = node.children;
- return children && children.length ? children[0] : node._tree.thread;
- }
- function d3_layout_treeRight(node) {
- var children = node.children, n;
- return children && (n = children.length) ? children[n - 1] : node._tree.thread;
- }
- function d3_layout_treeSearch(node, compare) {
- var children = node.children;
- if (children && (n = children.length)) {
- var child, n, i = -1;
- while (++i < n) {
- if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
- node = child;
- }
- }
- }
- return node;
- }
- function d3_layout_treeRightmost(a, b) {
- return a.x - b.x;
- }
- function d3_layout_treeLeftmost(a, b) {
- return b.x - a.x;
- }
- function d3_layout_treeDeepest(a, b) {
- return a.depth - b.depth;
- }
- function d3_layout_treeVisitAfter(node, callback) {
- function visit(node, previousSibling) {
- var children = node.children;
- if (children && (n = children.length)) {
- var child, previousChild = null, i = -1, n;
- while (++i < n) {
- child = children[i];
- visit(child, previousChild);
- previousChild = child;
- }
- }
- callback(node, previousSibling);
- }
- visit(node, null);
- }
- function d3_layout_treeShift(node) {
- var shift = 0, change = 0, children = node.children, i = children.length, child;
- while (--i >= 0) {
- child = children[i]._tree;
- child.prelim += shift;
- child.mod += shift;
- shift += child.shift + (change += child.change);
- }
- }
- function d3_layout_treeMove(ancestor, node, shift) {
- ancestor = ancestor._tree;
- node = node._tree;
- var change = shift / (node.number - ancestor.number);
- ancestor.change += change;
- node.change -= change;
- node.shift += shift;
- node.prelim += shift;
- node.mod += shift;
- }
- function d3_layout_treeAncestor(vim, node, ancestor) {
- return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
- }
- d3.layout.treemap = function() {
- var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5));
- function scale(children, k) {
- var i = -1, n = children.length, child, area;
- while (++i < n) {
- area = (child = children[i]).value * (k < 0 ? 0 : k);
- child.area = isNaN(area) || area <= 0 ? 0 : area;
- }
- }
- function squarify(node) {
- var children = node.children;
- if (children && children.length) {
- var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;
- scale(remaining, rect.dx * rect.dy / node.value);
- row.area = 0;
- while ((n = remaining.length) > 0) {
- row.push(child = remaining[n - 1]);
- row.area += child.area;
- if (mode !== "squarify" || (score = worst(row, u)) <= best) {
- remaining.pop();
- best = score;
- } else {
- row.area -= row.pop().area;
- position(row, u, rect, false);
- u = Math.min(rect.dx, rect.dy);
- row.length = row.area = 0;
- best = Infinity;
- }
- }
- if (row.length) {
- position(row, u, rect, true);
- row.length = row.area = 0;
- }
- children.forEach(squarify);
- }
- }
- function stickify(node) {
- var children = node.children;
- if (children && children.length) {
- var rect = pad(node), remaining = children.slice(), child, row = [];
- scale(remaining, rect.dx * rect.dy / node.value);
- row.area = 0;
- while (child = remaining.pop()) {
- row.push(child);
- row.area += child.area;
- if (child.z != null) {
- position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
- row.length = row.area = 0;
- }
- }
- children.forEach(stickify);
- }
- }
- function worst(row, u) {
- var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
- while (++i < n) {
- if (!(r = row[i].area)) continue;
- if (r < rmin) rmin = r;
- if (r > rmax) rmax = r;
- }
- s *= s;
- u *= u;
- return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
- }
- function position(row, u, rect, flush) {
- var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
- if (u == rect.dx) {
- if (flush || v > rect.dy) v = rect.dy;
- while (++i < n) {
- o = row[i];
- o.x = x;
- o.y = y;
- o.dy = v;
- x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
- }
- o.z = true;
- o.dx += rect.x + rect.dx - x;
- rect.y += v;
- rect.dy -= v;
- } else {
- if (flush || v > rect.dx) v = rect.dx;
- while (++i < n) {
- o = row[i];
- o.x = x;
- o.y = y;
- o.dx = v;
- y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
- }
- o.z = false;
- o.dy += rect.y + rect.dy - y;
- rect.x += v;
- rect.dx -= v;
- }
- }
- function treemap(d) {
- var nodes = stickies || hierarchy(d), root = nodes[0];
- root.x = 0;
- root.y = 0;
- root.dx = size[0];
- root.dy = size[1];
- if (stickies) hierarchy.revalue(root);
- scale([ root ], root.dx * root.dy / root.value);
- (stickies ? stickify : squarify)(root);
- if (sticky) stickies = nodes;
- return nodes;
- }
- treemap.size = function(x) {
- if (!arguments.length) return size;
- size = x;
- return treemap;
- };
- treemap.padding = function(x) {
- if (!arguments.length) return padding;
- function padFunction(node) {
- var p = x.call(treemap, node, node.depth);
- return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
- }
- function padConstant(node) {
- return d3_layout_treemapPad(node, x);
- }
- var type;
- pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ],
- padConstant) : padConstant;
- return treemap;
- };
- treemap.round = function(x) {
- if (!arguments.length) return round != Number;
- round = x ? Math.round : Number;
- return treemap;
- };
- treemap.sticky = function(x) {
- if (!arguments.length) return sticky;
- sticky = x;
- stickies = null;
- return treemap;
- };
- treemap.ratio = function(x) {
- if (!arguments.length) return ratio;
- ratio = x;
- return treemap;
- };
- treemap.mode = function(x) {
- if (!arguments.length) return mode;
- mode = x + "";
- return treemap;
- };
- return d3_layout_hierarchyRebind(treemap, hierarchy);
- };
- function d3_layout_treemapPadNull(node) {
- return {
- x: node.x,
- y: node.y,
- dx: node.dx,
- dy: node.dy
- };
- }
- function d3_layout_treemapPad(node, padding) {
- var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
- if (dx < 0) {
- x += dx / 2;
- dx = 0;
- }
- if (dy < 0) {
- y += dy / 2;
- dy = 0;
- }
- return {
- x: x,
- y: y,
- dx: dx,
- dy: dy
- };
- }
- function d3_dsv(delimiter, mimeType) {
- var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
- function dsv(url, callback) {
- return d3.xhr(url, mimeType, callback).response(response);
- }
- function response(request) {
- return dsv.parse(request.responseText);
- }
- dsv.parse = function(text) {
- var o;
- return dsv.parseRows(text, function(row) {
- if (o) return o(row);
- o = new Function("d", "return {" + row.map(function(name, i) {
- return JSON.stringify(name) + ": d[" + i + "]";
- }).join(",") + "}");
- });
- };
- dsv.parseRows = function(text, f) {
- var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;
- function token() {
- if (I >= N) return EOF;
- if (eol) return eol = false, EOL;
- var j = I;
- if (text.charCodeAt(j) === 34) {
- var i = j;
- while (i++ < N) {
- if (text.charCodeAt(i) === 34) {
- if (text.charCodeAt(i + 1) !== 34) break;
- ++i;
- }
- }
- I = i + 2;
- var c = text.charCodeAt(i + 1);
- if (c === 13) {
- eol = true;
- if (text.charCodeAt(i + 2) === 10) ++I;
- } else if (c === 10) {
- eol = true;
- }
- return text.substring(j + 1, i).replace(/""/g, '"');
- }
- while (I < N) {
- var c = text.charCodeAt(I++), k = 1;
- if (c === 10) eol = true; else if (c === 13) {
- eol = true;
- if (text.charCodeAt(I) === 10) ++I, ++k;
- } else if (c !== delimiterCode) continue;
- return text.substring(j, I - k);
- }
- return text.substring(j);
- }
- while ((t = token()) !== EOF) {
- var a = [];
- while (t !== EOL && t !== EOF) {
- a.push(t);
- t = token();
- }
- if (f && !(a = f(a, n++))) continue;
- rows.push(a);
- }
- return rows;
- };
- dsv.format = function(rows) {
- return rows.map(formatRow).join("\n");
- };
- function formatRow(row) {
- return row.map(formatValue).join(delimiter);
- }
- function formatValue(text) {
- return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
- }
- return dsv;
- }
- d3.csv = d3_dsv(",", "text/csv");
- d3.tsv = d3_dsv(" ", "text/tab-separated-values");
- d3.geo = {};
- d3.geo.stream = function(object, listener) {
- if (d3_geo_streamObjectType.hasOwnProperty(object.type)) {
- d3_geo_streamObjectType[object.type](object, listener);
- } else {
- d3_geo_streamGeometry(object, listener);
- }
- };
- function d3_geo_streamGeometry(geometry, listener) {
- if (d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) {
- d3_geo_streamGeometryType[geometry.type](geometry, listener);
- }
- }
- var d3_geo_streamObjectType = {
- Feature: function(feature, listener) {
- d3_geo_streamGeometry(feature.geometry, listener);
- },
- FeatureCollection: function(object, listener) {
- var features = object.features, i = -1, n = features.length;
- while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
- }
- };
- var d3_geo_streamGeometryType = {
- Sphere: function(object, listener) {
- listener.sphere();
- },
- Point: function(object, listener) {
- var coordinate = object.coordinates;
- listener.point(coordinate[0], coordinate[1]);
- },
- MultiPoint: function(object, listener) {
- var coordinates = object.coordinates, i = -1, n = coordinates.length, coordinate;
- while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]);
- },
- LineString: function(object, listener) {
- d3_geo_streamLine(object.coordinates, listener, 0);
- },
- MultiLineString: function(object, listener) {
- var coordinates = object.coordinates, i = -1, n = coordinates.length;
- while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0);
- },
- Polygon: function(object, listener) {
- d3_geo_streamPolygon(object.coordinates, listener);
- },
- MultiPolygon: function(object, listener) {
- var coordinates = object.coordinates, i = -1, n = coordinates.length;
- while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
- },
- GeometryCollection: function(object, listener) {
- var geometries = object.geometries, i = -1, n = geometries.length;
- while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
- }
- };
- function d3_geo_streamLine(coordinates, listener, closed) {
- var i = -1, n = coordinates.length - closed, coordinate;
- listener.lineStart();
- while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1]);
- listener.lineEnd();
- }
- function d3_geo_streamPolygon(coordinates, listener) {
- var i = -1, n = coordinates.length;
- listener.polygonStart();
- while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1);
- listener.polygonEnd();
- }
- function d3_geo_spherical(cartesian) {
- return [ Math.atan2(cartesian[1], cartesian[0]), Math.asin(Math.max(-1, Math.min(1, cartesian[2]))) ];
- }
- function d3_geo_sphericalEqual(a, b) {
- return Math.abs(a[0] - b[0]) < ε && Math.abs(a[1] - b[1]) < ε;
- }
- function d3_geo_cartesian(spherical) {
- var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
- return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ];
- }
- function d3_geo_cartesianDot(a, b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
- }
- function d3_geo_cartesianCross(a, b) {
- return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];
- }
- function d3_geo_cartesianAdd(a, b) {
- a[0] += b[0];
- a[1] += b[1];
- a[2] += b[2];
- }
- function d3_geo_cartesianScale(vector, k) {
- return [ vector[0] * k, vector[1] * k, vector[2] * k ];
- }
- function d3_geo_cartesianNormalize(d) {
- var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
- d[0] /= l;
- d[1] /= l;
- d[2] /= l;
- }
- function d3_geo_resample(project) {
- var δ2 = .5, maxDepth = 16;
- function resample(stream) {
- var λ0, x0, y0, a0, b0, c0;
- var resample = {
- point: point,
- lineStart: lineStart,
- lineEnd: lineEnd,
- polygonStart: function() {
- stream.polygonStart();
- resample.lineStart = polygonLineStart;
- },
- polygonEnd: function() {
- stream.polygonEnd();
- resample.lineStart = lineStart;
- }
- };
- function point(x, y) {
- x = project(x, y);
- stream.point(x[0], x[1]);
- }
- function lineStart() {
- x0 = NaN;
- resample.point = linePoint;
- stream.lineStart();
- }
- function linePoint(λ, φ) {
- var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);
- resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
- stream.point(x0, y0);
- }
- function lineEnd() {
- resample.point = point;
- stream.lineEnd();
- }
- function polygonLineStart() {
- var λ00, φ00, x00, y00, a00, b00, c00;
- lineStart();
- resample.point = function(λ, φ) {
- linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
- resample.point = linePoint;
- };
- resample.lineEnd = function() {
- resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);
- resample.lineEnd = lineEnd;
- lineEnd();
- };
- }
- return resample;
- }
- function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
- var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
- if (d2 > 4 * δ2 && depth--) {
- var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = Math.abs(Math.abs(c) - 1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
- if (dz * dz / d2 > δ2 || Math.abs((dx * dx2 + dy * dy2) / d2 - .5) > .3) {
- resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
- stream.point(x2, y2);
- resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
- }
- }
- }
- resample.precision = function(_) {
- if (!arguments.length) return Math.sqrt(δ2);
- maxDepth = (δ2 = _ * _) > 0 && 16;
- return resample;
- };
- return resample;
- }
- d3.geo.albersUsa = function() {
- var lower48 = d3.geo.albers();
- var alaska = d3.geo.albers().rotate([ 160, 0 ]).center([ 0, 60 ]).parallels([ 55, 65 ]);
- var hawaii = d3.geo.albers().rotate([ 160, 0 ]).center([ 0, 20 ]).parallels([ 8, 18 ]);
- var puertoRico = d3.geo.albers().rotate([ 60, 0 ]).center([ 0, 10 ]).parallels([ 8, 18 ]);
- function albersUsa(coordinates) {
- return projection(coordinates)(coordinates);
- }
- function projection(point) {
- var lon = point[0], lat = point[1];
- return lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48;
- }
- albersUsa.scale = function(x) {
- if (!arguments.length) return lower48.scale();
- lower48.scale(x);
- alaska.scale(x * .6);
- hawaii.scale(x);
- puertoRico.scale(x * 1.5);
- return albersUsa.translate(lower48.translate());
- };
- albersUsa.translate = function(x) {
- if (!arguments.length) return lower48.translate();
- var dz = lower48.scale(), dx = x[0], dy = x[1];
- lower48.translate(x);
- alaska.translate([ dx - .4 * dz, dy + .17 * dz ]);
- hawaii.translate([ dx - .19 * dz, dy + .2 * dz ]);
- puertoRico.translate([ dx + .58 * dz, dy + .43 * dz ]);
- return albersUsa;
- };
- return albersUsa.scale(lower48.scale());
- };
- function d3_geo_albers(φ0, φ1) {
- var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n;
- function albers(λ, φ) {
- var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
- return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ];
- }
- albers.invert = function(x, y) {
- var ρ0_y = ρ0 - y;
- return [ Math.atan2(x, ρ0_y) / n, Math.asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
- };
- return albers;
- }
- (d3.geo.albers = function() {
- var φ0 = 29.5 * d3_radians, φ1 = 45.5 * d3_radians, m = d3_geo_projectionMutator(d3_geo_albers), p = m(φ0, φ1);
- p.parallels = function(_) {
- if (!arguments.length) return [ φ0 * d3_degrees, φ1 * d3_degrees ];
- return m(φ0 = _[0] * d3_radians, φ1 = _[1] * d3_radians);
- };
- return p.rotate([ 98, 0 ]).center([ 0, 38 ]).scale(1e3);
- }).raw = d3_geo_albers;
- var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) {
- return Math.sqrt(2 / (1 + cosλcosφ));
- }, function(ρ) {
- return 2 * Math.asin(ρ / 2);
- });
- (d3.geo.azimuthalEqualArea = function() {
- return d3_geo_projection(d3_geo_azimuthalEqualArea);
- }).raw = d3_geo_azimuthalEqualArea;
- var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) {
- var c = Math.acos(cosλcosφ);
- return c && c / Math.sin(c);
- }, d3_identity);
- (d3.geo.azimuthalEquidistant = function() {
- return d3_geo_projection(d3_geo_azimuthalEquidistant);
- }).raw = d3_geo_azimuthalEquidistant;
- d3.geo.bounds = d3_geo_bounds(d3_identity);
- function d3_geo_bounds(projectStream) {
- var x0, y0, x1, y1;
- var bound = {
- point: boundPoint,
- lineStart: d3_noop,
- lineEnd: d3_noop,
- polygonStart: function() {
- bound.lineEnd = boundPolygonLineEnd;
- },
- polygonEnd: function() {
- bound.point = boundPoint;
- }
- };
- function boundPoint(x, y) {
- if (x < x0) x0 = x;
- if (x > x1) x1 = x;
- if (y < y0) y0 = y;
- if (y > y1) y1 = y;
- }
- function boundPolygonLineEnd() {
- bound.point = bound.lineEnd = d3_noop;
- }
- return function(feature) {
- y1 = x1 = -(x0 = y0 = Infinity);
- d3.geo.stream(feature, projectStream(bound));
- return [ [ x0, y0 ], [ x1, y1 ] ];
- };
- }
- d3.geo.centroid = function(object) {
- d3_geo_centroidDimension = d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
- d3.geo.stream(object, d3_geo_centroid);
- var m;
- if (d3_geo_centroidW && Math.abs(m = Math.sqrt(d3_geo_centroidX * d3_geo_centroidX + d3_geo_centroidY * d3_geo_centroidY + d3_geo_centroidZ * d3_geo_centroidZ)) > ε) {
- return [ Math.atan2(d3_geo_centroidY, d3_geo_centroidX) * d3_degrees, Math.asin(Math.max(-1, Math.min(1, d3_geo_centroidZ / m))) * d3_degrees ];
- }
- };
- var d3_geo_centroidDimension, d3_geo_centroidW, d3_geo_centroidX, d3_geo_centroidY, d3_geo_centroidZ;
- var d3_geo_centroid = {
- sphere: function() {
- if (d3_geo_centroidDimension < 2) {
- d3_geo_centroidDimension = 2;
- d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
- }
- },
- point: d3_geo_centroidPoint,
- lineStart: d3_geo_centroidLineStart,
- lineEnd: d3_geo_centroidLineEnd,
- polygonStart: function() {
- if (d3_geo_centroidDimension < 2) {
- d3_geo_centroidDimension = 2;
- d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
- }
- d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
- },
- polygonEnd: function() {
- d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
- }
- };
- function d3_geo_centroidPoint(λ, φ) {
- if (d3_geo_centroidDimension) return;
- ++d3_geo_centroidW;
- λ *= d3_radians;
- var cosφ = Math.cos(φ *= d3_radians);
- d3_geo_centroidX += (cosφ * Math.cos(λ) - d3_geo_centroidX) / d3_geo_centroidW;
- d3_geo_centroidY += (cosφ * Math.sin(λ) - d3_geo_centroidY) / d3_geo_centroidW;
- d3_geo_centroidZ += (Math.sin(φ) - d3_geo_centroidZ) / d3_geo_centroidW;
- }
- function d3_geo_centroidRingStart() {
- var λ00, φ00;
- d3_geo_centroidDimension = 1;
- d3_geo_centroidLineStart();
- d3_geo_centroidDimension = 2;
- var linePoint = d3_geo_centroid.point;
- d3_geo_centroid.point = function(λ, φ) {
- linePoint(λ00 = λ, φ00 = φ);
- };
- d3_geo_centroid.lineEnd = function() {
- d3_geo_centroid.point(λ00, φ00);
- d3_geo_centroidLineEnd();
- d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
- };
- }
- function d3_geo_centroidLineStart() {
- var x0, y0, z0;
- if (d3_geo_centroidDimension > 1) return;
- if (d3_geo_centroidDimension < 1) {
- d3_geo_centroidDimension = 1;
- d3_geo_centroidW = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
- }
- d3_geo_centroid.point = function(λ, φ) {
- λ *= d3_radians;
- var cosφ = Math.cos(φ *= d3_radians);
- x0 = cosφ * Math.cos(λ);
- y0 = cosφ * Math.sin(λ);
- z0 = Math.sin(φ);
- d3_geo_centroid.point = nextPoint;
- };
- function nextPoint(λ, φ) {
- λ *= d3_radians;
- var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
- d3_geo_centroidW += w;
- d3_geo_centroidX += w * (x0 + (x0 = x));
- d3_geo_centroidY += w * (y0 + (y0 = y));
- d3_geo_centroidZ += w * (z0 + (z0 = z));
- }
- }
- function d3_geo_centroidLineEnd() {
- d3_geo_centroid.point = d3_geo_centroidPoint;
- }
- d3.geo.circle = function() {
- var origin = [ 0, 0 ], angle, precision = 6, interpolate;
- function circle() {
- var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = [];
- interpolate(null, null, 1, {
- point: function(x, y) {
- ring.push(x = rotate(x, y));
- x[0] *= d3_degrees, x[1] *= d3_degrees;
- }
- });
- return {
- type: "Polygon",
- coordinates: [ ring ]
- };
- }
- circle.origin = function(x) {
- if (!arguments.length) return origin;
- origin = x;
- return circle;
- };
- circle.angle = function(x) {
- if (!arguments.length) return angle;
- interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);
- return circle;
- };
- circle.precision = function(_) {
- if (!arguments.length) return precision;
- interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);
- return circle;
- };
- return circle.angle(90);
- };
- function d3_geo_circleInterpolate(radians, precision) {
- var cr = Math.cos(radians), sr = Math.sin(radians);
- return function(from, to, direction, listener) {
- if (from != null) {
- from = d3_geo_circleAngle(cr, from);
- to = d3_geo_circleAngle(cr, to);
- if (direction > 0 ? from < to : from > to) from += direction * 2 * π;
- } else {
- from = radians + direction * 2 * π;
- to = radians;
- }
- var point;
- for (var step = direction * precision, t = from; direction > 0 ? t > to : t < to; t -= step) {
- listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]);
- }
- };
- }
- function d3_geo_circleAngle(cr, point) {
- var a = d3_geo_cartesian(point);
- a[0] -= cr;
- d3_geo_cartesianNormalize(a);
- var angle = Math.acos(Math.max(-1, Math.min(1, -a[1])));
- return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);
- }
- function d3_geo_clip(pointVisible, clipLine, interpolate) {
- return function(listener) {
- var line = clipLine(listener);
- var clip = {
- point: point,
- lineStart: lineStart,
- lineEnd: lineEnd,
- polygonStart: function() {
- clip.point = pointRing;
- clip.lineStart = ringStart;
- clip.lineEnd = ringEnd;
- invisible = false;
- invisibleArea = visibleArea = 0;
- segments = [];
- listener.polygonStart();
- },
- polygonEnd: function() {
- clip.point = point;
- clip.lineStart = lineStart;
- clip.lineEnd = lineEnd;
- segments = d3.merge(segments);
- if (segments.length) {
- d3_geo_clipPolygon(segments, interpolate, listener);
- } else if (visibleArea < -ε || invisible && invisibleArea < -ε) {
- listener.lineStart();
- interpolate(null, null, 1, listener);
- listener.lineEnd();
- }
- listener.polygonEnd();
- segments = null;
- },
- sphere: function() {
- listener.polygonStart();
- listener.lineStart();
- interpolate(null, null, 1, listener);
- listener.lineEnd();
- listener.polygonEnd();
- }
- };
- function point(λ, φ) {
- if (pointVisible(λ, φ)) listener.point(λ, φ);
- }
- function pointLine(λ, φ) {
- line.point(λ, φ);
- }
- function lineStart() {
- clip.point = pointLine;
- line.lineStart();
- }
- function lineEnd() {
- clip.point = point;
- line.lineEnd();
- }
- var segments, visibleArea, invisibleArea, invisible;
- var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), ring;
- function pointRing(λ, φ) {
- ringListener.point(λ, φ);
- ring.push([ λ, φ ]);
- }
- function ringStart() {
- ringListener.lineStart();
- ring = [];
- }
- function ringEnd() {
- pointRing(ring[0][0], ring[0][1]);
- ringListener.lineEnd();
- var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length;
- if (!n) {
- invisible = true;
- invisibleArea += d3_geo_clipAreaRing(ring, -1);
- ring = null;
- return;
- }
- ring = null;
- if (clean & 1) {
- segment = ringSegments[0];
- visibleArea += d3_geo_clipAreaRing(segment, 1);
- var n = segment.length - 1, i = -1, point;
- listener.lineStart();
- while (++i < n) listener.point((point = segment[i])[0], point[1]);
- listener.lineEnd();
- return;
- }
- if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
- segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));
- }
- return clip;
- };
- }
- function d3_geo_clipPolygon(segments, interpolate, listener) {
- var subject = [], clip = [];
- segments.forEach(function(segment) {
- var n = segment.length;
- if (n <= 1) return;
- var p0 = segment[0], p1 = segment[n - 1], a = {
- point: p0,
- points: segment,
- other: null,
- visited: false,
- entry: true,
- subject: true
- }, b = {
- point: p0,
- points: [ p0 ],
- other: a,
- visited: false,
- entry: false,
- subject: false
- };
- a.other = b;
- subject.push(a);
- clip.push(b);
- a = {
- point: p1,
- points: [ p1 ],
- other: null,
- visited: false,
- entry: false,
- subject: true
- };
- b = {
- point: p1,
- points: [ p1 ],
- other: a,
- visited: false,
- entry: true,
- subject: false
- };
- a.other = b;
- subject.push(a);
- clip.push(b);
- });
- clip.sort(d3_geo_clipSort);
- d3_geo_clipLinkCircular(subject);
- d3_geo_clipLinkCircular(clip);
- if (!subject.length) return;
- var start = subject[0], current, points, point;
- while (1) {
- current = start;
- while (current.visited) if ((current = current.next) === start) return;
- points = current.points;
- listener.lineStart();
- do {
- current.visited = current.other.visited = true;
- if (current.entry) {
- if (current.subject) {
- for (var i = 0; i < points.length; i++) listener.point((point = points[i])[0], point[1]);
- } else {
- interpolate(current.point, current.next.point, 1, listener);
- }
- current = current.next;
- } else {
- if (current.subject) {
- points = current.prev.points;
- for (var i = points.length; --i >= 0; ) listener.point((point = points[i])[0], point[1]);
- } else {
- interpolate(current.point, current.prev.point, -1, listener);
- }
- current = current.prev;
- }
- current = current.other;
- points = current.points;
- } while (!current.visited);
- listener.lineEnd();
- }
- }
- function d3_geo_clipLinkCircular(array) {
- if (!(n = array.length)) return;
- var n, i = 0, a = array[0], b;
- while (++i < n) {
- a.next = b = array[i];
- b.prev = a;
- a = b;
- }
- a.next = b = array[0];
- b.prev = a;
- }
- function d3_geo_clipSort(a, b) {
- return ((a = a.point)[0] < 0 ? a[1] - π / 2 - ε : π / 2 - a[1]) - ((b = b.point)[0] < 0 ? b[1] - π / 2 - ε : π / 2 - b[1]);
- }
- function d3_geo_clipSegmentLength1(segment) {
- return segment.length > 1;
- }
- function d3_geo_clipBufferListener() {
- var lines = [], line;
- return {
- lineStart: function() {
- lines.push(line = []);
- },
- point: function(λ, φ) {
- line.push([ λ, φ ]);
- },
- lineEnd: d3_noop,
- buffer: function() {
- var buffer = lines;
- lines = [];
- line = null;
- return buffer;
- }
- };
- }
- function d3_geo_clipAreaRing(ring, invisible) {
- if (!(n = ring.length)) return 0;
- var n, i = 0, area = 0, p = ring[0], λ = p[0], φ = p[1], cosφ = Math.cos(φ), x0 = Math.atan2(invisible * Math.sin(λ) * cosφ, Math.sin(φ)), y0 = 1 - invisible * Math.cos(λ) * cosφ, x1 = x0, x, y;
- while (++i < n) {
- p = ring[i];
- cosφ = Math.cos(φ = p[1]);
- x = Math.atan2(invisible * Math.sin(λ = p[0]) * cosφ, Math.sin(φ));
- y = 1 - invisible * Math.cos(λ) * cosφ;
- if (Math.abs(y0 - 2) < ε && Math.abs(y - 2) < ε) continue;
- if (Math.abs(y) < ε || Math.abs(y0) < ε) {} else if (Math.abs(Math.abs(x - x0) - π) < ε) {
- if (y + y0 > 2) area += 4 * (x - x0);
- } else if (Math.abs(y0 - 2) < ε) area += 4 * (x - x1); else area += ((3 * π + x - x0) % (2 * π) - π) * (y0 + y);
- x1 = x0, x0 = x, y0 = y;
- }
- return area;
- }
- var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate);
- function d3_geo_clipAntimeridianLine(listener) {
- var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;
- return {
- lineStart: function() {
- listener.lineStart();
- clean = 1;
- },
- point: function(λ1, φ1) {
- var sλ1 = λ1 > 0 ? π : -π, dλ = Math.abs(λ1 - λ0);
- if (Math.abs(dλ - π) < ε) {
- listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? π / 2 : -π / 2);
- listener.point(sλ0, φ0);
- listener.lineEnd();
- listener.lineStart();
- listener.point(sλ1, φ0);
- listener.point(λ1, φ0);
- clean = 0;
- } else if (sλ0 !== sλ1 && dλ >= π) {
- if (Math.abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;
- if (Math.abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;
- φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);
- listener.point(sλ0, φ0);
- listener.lineEnd();
- listener.lineStart();
- listener.point(sλ1, φ0);
- clean = 0;
- }
- listener.point(λ0 = λ1, φ0 = φ1);
- sλ0 = sλ1;
- },
- lineEnd: function() {
- listener.lineEnd();
- λ0 = φ0 = NaN;
- },
- clean: function() {
- return 2 - clean;
- }
- };
- }
- function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {
- var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
- return Math.abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;
- }
- function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {
- var φ;
- if (from == null) {
- φ = direction * π / 2;
- listener.point(-π, φ);
- listener.point(0, φ);
- listener.point(π, φ);
- listener.point(π, 0);
- listener.point(π, -φ);
- listener.point(0, -φ);
- listener.point(-π, -φ);
- listener.point(-π, 0);
- listener.point(-π, φ);
- } else if (Math.abs(from[0] - to[0]) > ε) {
- var s = (from[0] < to[0] ? 1 : -1) * π;
- φ = direction * s / 2;
- listener.point(-s, φ);
- listener.point(0, φ);
- listener.point(s, φ);
- } else {
- listener.point(to[0], to[1]);
- }
- }
- function d3_geo_clipCircle(degrees) {
- var radians = degrees * d3_radians, cr = Math.cos(radians), interpolate = d3_geo_circleInterpolate(radians, 6 * d3_radians);
- return d3_geo_clip(visible, clipLine, interpolate);
- function visible(λ, φ) {
- return Math.cos(λ) * Math.cos(φ) > cr;
- }
- function clipLine(listener) {
- var point0, v0, v00, clean;
- return {
- lineStart: function() {
- v00 = v0 = false;
- clean = 1;
- },
- point: function(λ, φ) {
- var point1 = [ λ, φ ], point2, v = visible(λ, φ);
- if (!point0 && (v00 = v0 = v)) listener.lineStart();
- if (v !== v0) {
- point2 = intersect(point0, point1);
- if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {
- point1[0] += ε;
- point1[1] += ε;
- v = visible(point1[0], point1[1]);
- }
- }
- if (v !== v0) {
- clean = 0;
- if (v0 = v) {
- listener.lineStart();
- point2 = intersect(point1, point0);
- listener.point(point2[0], point2[1]);
- } else {
- point2 = intersect(point0, point1);
- listener.point(point2[0], point2[1]);
- listener.lineEnd();
- }
- point0 = point2;
- }
- if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) listener.point(point1[0], point1[1]);
- point0 = point1;
- },
- lineEnd: function() {
- if (v0) listener.lineEnd();
- point0 = null;
- },
- clean: function() {
- return clean | (v00 && v0) << 1;
- }
- };
- }
- function intersect(a, b) {
- var pa = d3_geo_cartesian(a, 0), pb = d3_geo_cartesian(b, 0);
- var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
- if (!determinant) return a;
- var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2);
- d3_geo_cartesianAdd(A, B);
- var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t = Math.sqrt(w * w - uu * (d3_geo_cartesianDot(A, A) - 1)), q = d3_geo_cartesianScale(u, (-w - t) / uu);
- d3_geo_cartesianAdd(q, A);
- return d3_geo_spherical(q);
- }
- }
- function d3_geo_compose(a, b) {
- function compose(x, y) {
- return x = a(x, y), b(x[0], x[1]);
- }
- if (a.invert && b.invert) compose.invert = function(x, y) {
- return x = b.invert(x, y), x && a.invert(x[0], x[1]);
- };
- return compose;
- }
- function d3_geo_equirectangular(λ, φ) {
- return [ λ, φ ];
- }
- (d3.geo.equirectangular = function() {
- return d3_geo_projection(d3_geo_equirectangular).scale(250 / π);
- }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;
- var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) {
- return 1 / cosλcosφ;
- }, Math.atan);
- (d3.geo.gnomonic = function() {
- return d3_geo_projection(d3_geo_gnomonic);
- }).raw = d3_geo_gnomonic;
- d3.geo.graticule = function() {
- var x1, x0, y1, y0, dx = 22.5, dy = dx, x, y, precision = 2.5;
- function graticule() {
- return {
- type: "MultiLineString",
- coordinates: lines()
- };
- }
- function lines() {
- return d3.range(Math.ceil(x0 / dx) * dx, x1, dx).map(x).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).map(y));
- }
- graticule.lines = function() {
- return lines().map(function(coordinates) {
- return {
- type: "LineString",
- coordinates: coordinates
- };
- });
- };
- graticule.outline = function() {
- return {
- type: "Polygon",
- coordinates: [ x(x0).concat(y(y1).slice(1), x(x1).reverse().slice(1), y(y0).reverse().slice(1)) ]
- };
- };
- graticule.extent = function(_) {
- if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
- x0 = +_[0][0], x1 = +_[1][0];
- y0 = +_[0][1], y1 = +_[1][1];
- if (x0 > x1) _ = x0, x0 = x1, x1 = _;
- if (y0 > y1) _ = y0, y0 = y1, y1 = _;
- return graticule.precision(precision);
- };
- graticule.step = function(_) {
- if (!arguments.length) return [ dx, dy ];
- dx = +_[0], dy = +_[1];
- return graticule;
- };
- graticule.precision = function(_) {
- if (!arguments.length) return precision;
- precision = +_;
- x = d3_geo_graticuleX(y0, y1, precision);
- y = d3_geo_graticuleY(x0, x1, precision);
- return graticule;
- };
- return graticule.extent([ [ -180 + ε, -90 + ε ], [ 180 - ε, 90 - ε ] ]);
- };
- function d3_geo_graticuleX(y0, y1, dy) {
- var y = d3.range(y0, y1 - ε, dy).concat(y1);
- return function(x) {
- return y.map(function(y) {
- return [ x, y ];
- });
- };
- }
- function d3_geo_graticuleY(x0, x1, dx) {
- var x = d3.range(x0, x1 - ε, dx).concat(x1);
- return function(y) {
- return x.map(function(x) {
- return [ x, y ];
- });
- };
- }
- d3.geo.interpolate = function(source, target) {
- return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians);
- };
- function d3_geo_interpolate(x0, y0, x1, y1) {
- var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))), k = 1 / Math.sin(d);
- function interpolate(t) {
- var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
- return [ Math.atan2(y, x) / d3_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_radians ];
- }
- interpolate.distance = d;
- return interpolate;
- }
- d3.geo.greatArc = function() {
- var source = d3_source, source_, target = d3_target, target_, precision = 6 * d3_radians, interpolate;
- function greatArc() {
- var p0 = source_ || source.apply(this, arguments), p1 = target_ || target.apply(this, arguments), i = interpolate || d3.geo.interpolate(p0, p1), t = 0, dt = precision / i.distance, coordinates = [ p0 ];
- while ((t += dt) < 1) coordinates.push(i(t));
- coordinates.push(p1);
- return {
- type: "LineString",
- coordinates: coordinates
- };
- }
- greatArc.distance = function() {
- return (interpolate || d3.geo.interpolate(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments))).distance;
- };
- greatArc.source = function(_) {
- if (!arguments.length) return source;
- source = _, source_ = typeof _ === "function" ? null : _;
- interpolate = source_ && target_ ? d3.geo.interpolate(source_, target_) : null;
- return greatArc;
- };
- greatArc.target = function(_) {
- if (!arguments.length) return target;
- target = _, target_ = typeof _ === "function" ? null : _;
- interpolate = source_ && target_ ? d3.geo.interpolate(source_, target_) : null;
- return greatArc;
- };
- greatArc.precision = function(_) {
- if (!arguments.length) return precision / d3_radians;
- precision = _ * d3_radians;
- return greatArc;
- };
- return greatArc;
- };
- function d3_geo_mercator(λ, φ) {
- return [ λ / (2 * π), Math.max(-.5, Math.min(+.5, Math.log(Math.tan(π / 4 + φ / 2)) / (2 * π))) ];
- }
- d3_geo_mercator.invert = function(x, y) {
- return [ 2 * π * x, 2 * Math.atan(Math.exp(2 * π * y)) - π / 2 ];
- };
- (d3.geo.mercator = function() {
- return d3_geo_projection(d3_geo_mercator).scale(500);
- }).raw = d3_geo_mercator;
- var d3_geo_orthographic = d3_geo_azimuthal(function() {
- return 1;
- }, Math.asin);
- (d3.geo.orthographic = function() {
- return d3_geo_projection(d3_geo_orthographic);
- }).raw = d3_geo_orthographic;
- d3.geo.path = function() {
- var pointRadius = 4.5, projection, context, projectStream, contextStream;
- function path(object) {
- if (object) d3.geo.stream(object, projectStream(contextStream.pointRadius(typeof pointRadius === "function" ? +pointRadius.apply(this, arguments) : pointRadius)));
- return contextStream.result();
- }
- path.area = function(object) {
- d3_geo_pathAreaSum = 0;
- d3.geo.stream(object, projectStream(d3_geo_pathArea));
- return d3_geo_pathAreaSum;
- };
- path.centroid = function(object) {
- d3_geo_centroidDimension = d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
- d3.geo.stream(object, projectStream(d3_geo_pathCentroid));
- return d3_geo_centroidZ ? [ d3_geo_centroidX / d3_geo_centroidZ, d3_geo_centroidY / d3_geo_centroidZ ] : undefined;
- };
- path.bounds = function(object) {
- return d3_geo_bounds(projectStream)(object);
- };
- path.projection = function(_) {
- if (!arguments.length) return projection;
- projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
- return path;
- };
- path.context = function(_) {
- if (!arguments.length) return context;
- contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);
- return path;
- };
- path.pointRadius = function(_) {
- if (!arguments.length) return pointRadius;
- pointRadius = typeof _ === "function" ? _ : +_;
- return path;
- };
- return path.projection(d3.geo.albersUsa()).context(null);
- };
- function d3_geo_pathCircle(radius) {
- return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
- }
- function d3_geo_pathProjectStream(project) {
- var resample = d3_geo_resample(function(λ, φ) {
- return project([ λ * d3_degrees, φ * d3_degrees ]);
- });
- return function(stream) {
- stream = resample(stream);
- return {
- point: function(λ, φ) {
- stream.point(λ * d3_radians, φ * d3_radians);
- },
- sphere: function() {
- stream.sphere();
- },
- lineStart: function() {
- stream.lineStart();
- },
- lineEnd: function() {
- stream.lineEnd();
- },
- polygonStart: function() {
- stream.polygonStart();
- },
- polygonEnd: function() {
- stream.polygonEnd();
- }
- };
- };
- }
- function d3_geo_pathBuffer() {
- var pointCircle = d3_geo_pathCircle(4.5), buffer = [];
- var stream = {
- point: point,
- lineStart: function() {
- stream.point = pointLineStart;
- },
- lineEnd: lineEnd,
- polygonStart: function() {
- stream.lineEnd = lineEndPolygon;
- },
- polygonEnd: function() {
- stream.lineEnd = lineEnd;
- stream.point = point;
- },
- pointRadius: function(_) {
- pointCircle = d3_geo_pathCircle(_);
- return stream;
- },
- result: function() {
- if (buffer.length) {
- var result = buffer.join("");
- buffer = [];
- return result;
- }
- }
- };
- function point(x, y) {
- buffer.push("M", x, ",", y, pointCircle);
- }
- function pointLineStart(x, y) {
- buffer.push("M", x, ",", y);
- stream.point = pointLine;
- }
- function pointLine(x, y) {
- buffer.push("L", x, ",", y);
- }
- function lineEnd() {
- stream.point = point;
- }
- function lineEndPolygon() {
- buffer.push("Z");
- }
- return stream;
- }
- function d3_geo_pathContext(context) {
- var pointRadius = 4.5;
- var stream = {
- point: point,
- lineStart: function() {
- stream.point = pointLineStart;
- },
- lineEnd: lineEnd,
- polygonStart: function() {
- stream.lineEnd = lineEndPolygon;
- },
- polygonEnd: function() {
- stream.lineEnd = lineEnd;
- stream.point = point;
- },
- pointRadius: function(_) {
- pointRadius = _;
- return stream;
- },
- result: d3_noop
- };
- function point(x, y) {
- context.moveTo(x, y);
- context.arc(x, y, pointRadius, 0, 2 * π);
- }
- function pointLineStart(x, y) {
- context.moveTo(x, y);
- stream.point = pointLine;
- }
- function pointLine(x, y) {
- context.lineTo(x, y);
- }
- function lineEnd() {
- stream.point = point;
- }
- function lineEndPolygon() {
- context.closePath();
- }
- return stream;
- }
- var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = {
- point: d3_noop,
- lineStart: d3_noop,
- lineEnd: d3_noop,
- polygonStart: function() {
- d3_geo_pathAreaPolygon = 0;
- d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart;
- },
- polygonEnd: function() {
- d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop;
- d3_geo_pathAreaSum += Math.abs(d3_geo_pathAreaPolygon / 2);
- }
- };
- function d3_geo_pathAreaRingStart() {
- var x00, y00, x0, y0;
- d3_geo_pathArea.point = function(x, y) {
- d3_geo_pathArea.point = nextPoint;
- x00 = x0 = x, y00 = y0 = y;
- };
- function nextPoint(x, y) {
- d3_geo_pathAreaPolygon += y0 * x - x0 * y;
- x0 = x, y0 = y;
- }
- d3_geo_pathArea.lineEnd = function() {
- nextPoint(x00, y00);
- };
- }
- var d3_geo_pathCentroid = {
- point: d3_geo_pathCentroidPoint,
- lineStart: d3_geo_pathCentroidLineStart,
- lineEnd: d3_geo_pathCentroidLineEnd,
- polygonStart: function() {
- d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart;
- },
- polygonEnd: function() {
- d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
- d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart;
- d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd;
- }
- };
- function d3_geo_pathCentroidPoint(x, y) {
- if (d3_geo_centroidDimension) return;
- d3_geo_centroidX += x;
- d3_geo_centroidY += y;
- ++d3_geo_centroidZ;
- }
- function d3_geo_pathCentroidLineStart() {
- var x0, y0;
- if (d3_geo_centroidDimension !== 1) {
- if (d3_geo_centroidDimension < 1) {
- d3_geo_centroidDimension = 1;
- d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
- } else return;
- }
- d3_geo_pathCentroid.point = function(x, y) {
- d3_geo_pathCentroid.point = nextPoint;
- x0 = x, y0 = y;
- };
- function nextPoint(x, y) {
- var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
- d3_geo_centroidX += z * (x0 + x) / 2;
- d3_geo_centroidY += z * (y0 + y) / 2;
- d3_geo_centroidZ += z;
- x0 = x, y0 = y;
- }
- }
- function d3_geo_pathCentroidLineEnd() {
- d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
- }
- function d3_geo_pathCentroidRingStart() {
- var x00, y00, x0, y0;
- if (d3_geo_centroidDimension < 2) {
- d3_geo_centroidDimension = 2;
- d3_geo_centroidX = d3_geo_centroidY = d3_geo_centroidZ = 0;
- }
- d3_geo_pathCentroid.point = function(x, y) {
- d3_geo_pathCentroid.point = nextPoint;
- x00 = x0 = x, y00 = y0 = y;
- };
- function nextPoint(x, y) {
- var z = y0 * x - x0 * y;
- d3_geo_centroidX += z * (x0 + x);
- d3_geo_centroidY += z * (y0 + y);
- d3_geo_centroidZ += z * 3;
- x0 = x, y0 = y;
- }
- d3_geo_pathCentroid.lineEnd = function() {
- nextPoint(x00, y00);
- };
- }
- d3.geo.area = function(object) {
- d3_geo_areaSum = 0;
- d3.geo.stream(object, d3_geo_area);
- return d3_geo_areaSum;
- };
- var d3_geo_areaSum, d3_geo_areaRingU, d3_geo_areaRingV;
- var d3_geo_area = {
- sphere: function() {
- d3_geo_areaSum += 4 * π;
- },
- point: d3_noop,
- lineStart: d3_noop,
- lineEnd: d3_noop,
- polygonStart: function() {
- d3_geo_areaRingU = 1, d3_geo_areaRingV = 0;
- d3_geo_area.lineStart = d3_geo_areaRingStart;
- },
- polygonEnd: function() {
- var area = 2 * Math.atan2(d3_geo_areaRingV, d3_geo_areaRingU);
- d3_geo_areaSum += area < 0 ? 4 * π + area : area;
- d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
- }
- };
- function d3_geo_areaRingStart() {
- var λ00, φ00, λ0, cosφ0, sinφ0;
- d3_geo_area.point = function(λ, φ) {
- d3_geo_area.point = nextPoint;
- λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4),
- sinφ0 = Math.sin(φ);
- };
- function nextPoint(λ, φ) {
- λ *= d3_radians;
- φ = φ * d3_radians / 2 + π / 4;
- var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u0 = d3_geo_areaRingU, v0 = d3_geo_areaRingV, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ);
- d3_geo_areaRingU = u0 * u - v0 * v;
- d3_geo_areaRingV = v0 * u + u0 * v;
- λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
- }
- d3_geo_area.lineEnd = function() {
- nextPoint(λ00, φ00);
- };
- }
- d3.geo.projection = d3_geo_projection;
- d3.geo.projectionMutator = d3_geo_projectionMutator;
- function d3_geo_projection(project) {
- return d3_geo_projectionMutator(function() {
- return project;
- })();
- }
- function d3_geo_projectionMutator(projectAt) {
- var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) {
- x = project(x, y);
- return [ x[0] * k + δx, δy - x[1] * k ];
- }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, clip = d3_geo_clipAntimeridian, clipAngle = null;
- function projection(point) {
- point = projectRotate(point[0] * d3_radians, point[1] * d3_radians);
- return [ point[0] * k + δx, δy - point[1] * k ];
- }
- function invert(point) {
- point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k);
- return point && [ point[0] * d3_degrees, point[1] * d3_degrees ];
- }
- projection.stream = function(stream) {
- return d3_geo_projectionRadiansRotate(rotate, clip(projectResample(stream)));
- };
- projection.clipAngle = function(_) {
- if (!arguments.length) return clipAngle;
- clip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle(clipAngle = +_);
- return projection;
- };
- projection.scale = function(_) {
- if (!arguments.length) return k;
- k = +_;
- return reset();
- };
- projection.translate = function(_) {
- if (!arguments.length) return [ x, y ];
- x = +_[0];
- y = +_[1];
- return reset();
- };
- projection.center = function(_) {
- if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ];
- λ = _[0] % 360 * d3_radians;
- φ = _[1] % 360 * d3_radians;
- return reset();
- };
- projection.rotate = function(_) {
- if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ];
- δλ = _[0] % 360 * d3_radians;
- δφ = _[1] % 360 * d3_radians;
- δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0;
- return reset();
- };
- d3.rebind(projection, projectResample, "precision");
- function reset() {
- projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project);
- var center = project(λ, φ);
- δx = x - center[0] * k;
- δy = y + center[1] * k;
- return projection;
- }
- return function() {
- project = projectAt.apply(this, arguments);
- projection.invert = project.invert && invert;
- return reset();
- };
- }
- function d3_geo_projectionRadiansRotate(rotate, stream) {
- return {
- point: function(x, y) {
- y = rotate(x * d3_radians, y * d3_radians), x = y[0];
- stream.point(x > π ? x - 2 * π : x < -π ? x + 2 * π : x, y[1]);
- },
- sphere: function() {
- stream.sphere();
- },
- lineStart: function() {
- stream.lineStart();
- },
- lineEnd: function() {
- stream.lineEnd();
- },
- polygonStart: function() {
- stream.polygonStart();
- },
- polygonEnd: function() {
- stream.polygonEnd();
- }
- };
- }
- function d3_geo_rotation(δλ, δφ, δγ) {
- return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_equirectangular;
- }
- function d3_geo_forwardRotationλ(δλ) {
- return function(λ, φ) {
- return λ += δλ, [ λ > π ? λ - 2 * π : λ < -π ? λ + 2 * π : λ, φ ];
- };
- }
- function d3_geo_rotationλ(δλ) {
- var rotation = d3_geo_forwardRotationλ(δλ);
- rotation.invert = d3_geo_forwardRotationλ(-δλ);
- return rotation;
- }
- function d3_geo_rotationφγ(δφ, δγ) {
- var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
- function rotation(λ, φ) {
- var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;
- return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδγ + y * sinδγ))) ];
- }
- rotation.invert = function(λ, φ) {
- var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;
- return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδφ - x * sinδφ))) ];
- };
- return rotation;
- }
- var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) {
- return 1 / (1 + cosλcosφ);
- }, function(ρ) {
- return 2 * Math.atan(ρ);
- });
- (d3.geo.stereographic = function() {
- return d3_geo_projection(d3_geo_stereographic);
- }).raw = d3_geo_stereographic;
- function d3_geo_azimuthal(scale, angle) {
- function azimuthal(λ, φ) {
- var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
- return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ];
- }
- azimuthal.invert = function(x, y) {
- var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);
- return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ];
- };
- return azimuthal;
- }
- d3.geom = {};
- d3.geom.hull = function(vertices) {
- if (vertices.length < 3) return [];
- var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
- for (i = 1; i < len; ++i) {
- if (vertices[i][1] < vertices[h][1]) {
- h = i;
- } else if (vertices[i][1] == vertices[h][1]) {
- h = vertices[i][0] < vertices[h][0] ? i : h;
- }
- }
- for (i = 0; i < len; ++i) {
- if (i === h) continue;
- y1 = vertices[i][1] - vertices[h][1];
- x1 = vertices[i][0] - vertices[h][0];
- points.push({
- angle: Math.atan2(y1, x1),
- index: i
- });
- }
- points.sort(function(a, b) {
- return a.angle - b.angle;
- });
- a = points[0].angle;
- v = points[0].index;
- u = 0;
- for (i = 1; i < plen; ++i) {
- j = points[i].index;
- if (a == points[i].angle) {
- x1 = vertices[v][0] - vertices[h][0];
- y1 = vertices[v][1] - vertices[h][1];
- x2 = vertices[j][0] - vertices[h][0];
- y2 = vertices[j][1] - vertices[h][1];
- if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
- points[i].index = -1;
- } else {
- points[u].index = -1;
- a = points[i].angle;
- u = i;
- v = j;
- }
- } else {
- a = points[i].angle;
- u = i;
- v = j;
- }
- }
- stack.push(h);
- for (i = 0, j = 0; i < 2; ++j) {
- if (points[j].index !== -1) {
- stack.push(points[j].index);
- i++;
- }
- }
- sp = stack.length;
- for (;j < plen; ++j) {
- if (points[j].index === -1) continue;
- while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
- --sp;
- }
- stack[sp++] = points[j].index;
- }
- var poly = [];
- for (i = 0; i < sp; ++i) {
- poly.push(vertices[stack[i]]);
- }
- return poly;
- };
- function d3_geom_hullCCW(i1, i2, i3, v) {
- var t, a, b, c, d, e, f;
- t = v[i1];
- a = t[0];
- b = t[1];
- t = v[i2];
- c = t[0];
- d = t[1];
- t = v[i3];
- e = t[0];
- f = t[1];
- return (f - b) * (c - a) - (d - b) * (e - a) > 0;
- }
- d3.geom.polygon = function(coordinates) {
- coordinates.area = function() {
- var i = 0, n = coordinates.length, area = coordinates[n - 1][1] * coordinates[0][0] - coordinates[n - 1][0] * coordinates[0][1];
- while (++i < n) {
- area += coordinates[i - 1][1] * coordinates[i][0] - coordinates[i - 1][0] * coordinates[i][1];
- }
- return area * .5;
- };
- coordinates.centroid = function(k) {
- var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
- if (!arguments.length) k = -1 / (6 * coordinates.area());
- while (++i < n) {
- a = b;
- b = coordinates[i];
- c = a[0] * b[1] - b[0] * a[1];
- x += (a[0] + b[0]) * c;
- y += (a[1] + b[1]) * c;
- }
- return [ x * k, y * k ];
- };
- coordinates.clip = function(subject) {
- var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
- while (++i < n) {
- input = subject.slice();
- subject.length = 0;
- b = coordinates[i];
- c = input[(m = input.length) - 1];
- j = -1;
- while (++j < m) {
- d = input[j];
- if (d3_geom_polygonInside(d, a, b)) {
- if (!d3_geom_polygonInside(c, a, b)) {
- subject.push(d3_geom_polygonIntersect(c, d, a, b));
- }
- subject.push(d);
- } else if (d3_geom_polygonInside(c, a, b)) {
- subject.push(d3_geom_polygonIntersect(c, d, a, b));
- }
- c = d;
- }
- a = b;
- }
- return subject;
- };
- return coordinates;
- };
- function d3_geom_polygonInside(p, a, b) {
- return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
- }
- function d3_geom_polygonIntersect(c, d, a, b) {
- var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
- return [ x1 + ua * x21, y1 + ua * y21 ];
- }
- d3.geom.voronoi = function(vertices) {
- var polygons = vertices.map(function() {
- return [];
- }), Z = 1e6;
- d3_voronoi_tessellate(vertices, function(e) {
- var s1, s2, x1, x2, y1, y2;
- if (e.a === 1 && e.b >= 0) {
- s1 = e.ep.r;
- s2 = e.ep.l;
- } else {
- s1 = e.ep.l;
- s2 = e.ep.r;
- }
- if (e.a === 1) {
- y1 = s1 ? s1.y : -Z;
- x1 = e.c - e.b * y1;
- y2 = s2 ? s2.y : Z;
- x2 = e.c - e.b * y2;
- } else {
- x1 = s1 ? s1.x : -Z;
- y1 = e.c - e.a * x1;
- x2 = s2 ? s2.x : Z;
- y2 = e.c - e.a * x2;
- }
- var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
- polygons[e.region.l.index].push(v1, v2);
- polygons[e.region.r.index].push(v1, v2);
- });
- polygons = polygons.map(function(polygon, i) {
- var cx = vertices[i][0], cy = vertices[i][1], angle = polygon.map(function(v) {
- return Math.atan2(v[0] - cx, v[1] - cy);
- }), order = d3.range(polygon.length).sort(function(a, b) {
- return angle[a] - angle[b];
- });
- return order.filter(function(d, i) {
- return !i || angle[d] - angle[order[i - 1]] > ε;
- }).map(function(d) {
- return polygon[d];
- });
- });
- polygons.forEach(function(polygon, i) {
- var n = polygon.length;
- if (!n) return polygon.push([ -Z, -Z ], [ -Z, Z ], [ Z, Z ], [ Z, -Z ]);
- if (n > 2) return;
- var p0 = vertices[i], p1 = polygon[0], p2 = polygon[1], x0 = p0[0], y0 = p0[1], x1 = p1[0], y1 = p1[1], x2 = p2[0], y2 = p2[1], dx = Math.abs(x2 - x1), dy = y2 - y1;
- if (Math.abs(dy) < ε) {
- var y = y0 < y1 ? -Z : Z;
- polygon.push([ -Z, y ], [ Z, y ]);
- } else if (dx < ε) {
- var x = x0 < x1 ? -Z : Z;
- polygon.push([ x, -Z ], [ x, Z ]);
- } else {
- var y = (x2 - x1) * (y1 - y0) < (x1 - x0) * (y2 - y1) ? Z : -Z, z = Math.abs(dy) - dx;
- if (Math.abs(z) < ε) {
- polygon.push([ dy < 0 ? y : -y, y ]);
- } else {
- if (z > 0) y *= -1;
- polygon.push([ -Z, y ], [ Z, y ]);
- }
- }
- });
- return polygons;
- };
- var d3_voronoi_opposite = {
- l: "r",
- r: "l"
- };
- function d3_voronoi_tessellate(vertices, callback) {
- var Sites = {
- list: vertices.map(function(v, i) {
- return {
- index: i,
- x: v[0],
- y: v[1]
- };
- }).sort(function(a, b) {
- return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
- }),
- bottomSite: null
- };
- var EdgeList = {
- list: [],
- leftEnd: null,
- rightEnd: null,
- init: function() {
- EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
- EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
- EdgeList.leftEnd.r = EdgeList.rightEnd;
- EdgeList.rightEnd.l = EdgeList.leftEnd;
- EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
- },
- createHalfEdge: function(edge, side) {
- return {
- edge: edge,
- side: side,
- vertex: null,
- l: null,
- r: null
- };
- },
- insert: function(lb, he) {
- he.l = lb;
- he.r = lb.r;
- lb.r.l = he;
- lb.r = he;
- },
- leftBound: function(p) {
- var he = EdgeList.leftEnd;
- do {
- he = he.r;
- } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
- he = he.l;
- return he;
- },
- del: function(he) {
- he.l.r = he.r;
- he.r.l = he.l;
- he.edge = null;
- },
- right: function(he) {
- return he.r;
- },
- left: function(he) {
- return he.l;
- },
- leftRegion: function(he) {
- return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
- },
- rightRegion: function(he) {
- return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];
- }
- };
- var Geom = {
- bisect: function(s1, s2) {
- var newEdge = {
- region: {
- l: s1,
- r: s2
- },
- ep: {
- l: null,
- r: null
- }
- };
- var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
- newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
- if (adx > ady) {
- newEdge.a = 1;
- newEdge.b = dy / dx;
- newEdge.c /= dx;
- } else {
- newEdge.b = 1;
- newEdge.a = dx / dy;
- newEdge.c /= dy;
- }
- return newEdge;
- },
- intersect: function(el1, el2) {
- var e1 = el1.edge, e2 = el2.edge;
- if (!e1 || !e2 || e1.region.r == e2.region.r) {
- return null;
- }
- var d = e1.a * e2.b - e1.b * e2.a;
- if (Math.abs(d) < 1e-10) {
- return null;
- }
- var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
- if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
- el = el1;
- e = e1;
- } else {
- el = el2;
- e = e2;
- }
- var rightOfSite = xint >= e.region.r.x;
- if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
- return null;
- }
- return {
- x: xint,
- y: yint
- };
- },
- rightOf: function(he, p) {
- var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
- if (rightOfSite && he.side === "l") {
- return 1;
- }
- if (!rightOfSite && he.side === "r") {
- return 0;
- }
- if (e.a === 1) {
- var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
- if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
- above = fast = dyp >= e.b * dxp;
- } else {
- above = p.x + p.y * e.b > e.c;
- if (e.b < 0) {
- above = !above;
- }
- if (!above) {
- fast = 1;
- }
- }
- if (!fast) {
- var dxs = topsite.x - e.region.l.x;
- above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
- if (e.b < 0) {
- above = !above;
- }
- }
- } else {
- var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
- above = t1 * t1 > t2 * t2 + t3 * t3;
- }
- return he.side === "l" ? above : !above;
- },
- endPoint: function(edge, side, site) {
- edge.ep[side] = site;
- if (!edge.ep[d3_voronoi_opposite[side]]) return;
- callback(edge);
- },
- distance: function(s, t) {
- var dx = s.x - t.x, dy = s.y - t.y;
- return Math.sqrt(dx * dx + dy * dy);
- }
- };
- var EventQueue = {
- list: [],
- insert: function(he, site, offset) {
- he.vertex = site;
- he.ystar = site.y + offset;
- for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
- var next = list[i];
- if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
- continue;
- } else {
- break;
- }
- }
- list.splice(i, 0, he);
- },
- del: function(he) {
- for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
- ls.splice(i, 1);
- },
- empty: function() {
- return EventQueue.list.length === 0;
- },
- nextEvent: function(he) {
- for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
- if (ls[i] == he) return ls[i + 1];
- }
- return null;
- },
- min: function() {
- var elem = EventQueue.list[0];
- return {
- x: elem.vertex.x,
- y: elem.ystar
- };
- },
- extractMin: function() {
- return EventQueue.list.shift();
- }
- };
- EdgeList.init();
- Sites.bottomSite = Sites.list.shift();
- var newSite = Sites.list.shift(), newIntStar;
- var lbnd, rbnd, llbnd, rrbnd, bisector;
- var bot, top, temp, p, v;
- var e, pm;
- while (true) {
- if (!EventQueue.empty()) {
- newIntStar = EventQueue.min();
- }
- if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
- lbnd = EdgeList.leftBound(newSite);
- rbnd = EdgeList.right(lbnd);
- bot = EdgeList.rightRegion(lbnd);
- e = Geom.bisect(bot, newSite);
- bisector = EdgeList.createHalfEdge(e, "l");
- EdgeList.insert(lbnd, bisector);
- p = Geom.intersect(lbnd, bisector);
- if (p) {
- EventQueue.del(lbnd);
- EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
- }
- lbnd = bisector;
- bisector = EdgeList.createHalfEdge(e, "r");
- EdgeList.insert(lbnd, bisector);
- p = Geom.intersect(bisector, rbnd);
- if (p) {
- EventQueue.insert(bisector, p, Geom.distance(p, newSite));
- }
- newSite = Sites.list.shift();
- } else if (!EventQueue.empty()) {
- lbnd = EventQueue.extractMin();
- llbnd = EdgeList.left(lbnd);
- rbnd = EdgeList.right(lbnd);
- rrbnd = EdgeList.right(rbnd);
- bot = EdgeList.leftRegion(lbnd);
- top = EdgeList.rightRegion(rbnd);
- v = lbnd.vertex;
- Geom.endPoint(lbnd.edge, lbnd.side, v);
- Geom.endPoint(rbnd.edge, rbnd.side, v);
- EdgeList.del(lbnd);
- EventQueue.del(rbnd);
- EdgeList.del(rbnd);
- pm = "l";
- if (bot.y > top.y) {
- temp = bot;
- bot = top;
- top = temp;
- pm = "r";
- }
- e = Geom.bisect(bot, top);
- bisector = EdgeList.createHalfEdge(e, pm);
- EdgeList.insert(llbnd, bisector);
- Geom.endPoint(e, d3_voronoi_opposite[pm], v);
- p = Geom.intersect(llbnd, bisector);
- if (p) {
- EventQueue.del(llbnd);
- EventQueue.insert(llbnd, p, Geom.distance(p, bot));
- }
- p = Geom.intersect(bisector, rrbnd);
- if (p) {
- EventQueue.insert(bisector, p, Geom.distance(p, bot));
- }
- } else {
- break;
- }
- }
- for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
- callback(lbnd.edge);
- }
- }
- d3.geom.delaunay = function(vertices) {
- var edges = vertices.map(function() {
- return [];
- }), triangles = [];
- d3_voronoi_tessellate(vertices, function(e) {
- edges[e.region.l.index].push(vertices[e.region.r.index]);
- });
- edges.forEach(function(edge, i) {
- var v = vertices[i], cx = v[0], cy = v[1];
- edge.forEach(function(v) {
- v.angle = Math.atan2(v[0] - cx, v[1] - cy);
- });
- edge.sort(function(a, b) {
- return a.angle - b.angle;
- });
- for (var j = 0, m = edge.length - 1; j < m; j++) {
- triangles.push([ v, edge[j], edge[j + 1] ]);
- }
- });
- return triangles;
- };
- d3.geom.quadtree = function(points, x1, y1, x2, y2) {
- var p, i = -1, n = points.length;
- if (arguments.length < 5) {
- if (arguments.length === 3) {
- y2 = y1;
- x2 = x1;
- y1 = x1 = 0;
- } else {
- x1 = y1 = Infinity;
- x2 = y2 = -Infinity;
- while (++i < n) {
- p = points[i];
- if (p.x < x1) x1 = p.x;
- if (p.y < y1) y1 = p.y;
- if (p.x > x2) x2 = p.x;
- if (p.y > y2) y2 = p.y;
- }
- }
- }
- var dx = x2 - x1, dy = y2 - y1;
- if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
- function insert(n, p, x1, y1, x2, y2) {
- if (isNaN(p.x) || isNaN(p.y)) return;
- if (n.leaf) {
- var v = n.point;
- if (v) {
- if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
- insertChild(n, p, x1, y1, x2, y2);
- } else {
- n.point = null;
- insertChild(n, v, x1, y1, x2, y2);
- insertChild(n, p, x1, y1, x2, y2);
- }
- } else {
- n.point = p;
- }
- } else {
- insertChild(n, p, x1, y1, x2, y2);
- }
- }
- function insertChild(n, p, x1, y1, x2, y2) {
- var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
- n.leaf = false;
- n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
- if (right) x1 = sx; else x2 = sx;
- if (bottom) y1 = sy; else y2 = sy;
- insert(n, p, x1, y1, x2, y2);
- }
- var root = d3_geom_quadtreeNode();
- root.add = function(p) {
- insert(root, p, x1, y1, x2, y2);
- };
- root.visit = function(f) {
- d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
- };
- points.forEach(root.add);
- return root;
- };
- function d3_geom_quadtreeNode() {
- return {
- leaf: true,
- nodes: [],
- point: null
- };
- }
- function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
- if (!f(node, x1, y1, x2, y2)) {
- var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
- if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
- if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
- if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
- if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
- }
- }
- d3.time = {};
- var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
- function d3_time_utc() {
- this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
- }
- d3_time_utc.prototype = {
- getDate: function() {
- return this._.getUTCDate();
- },
- getDay: function() {
- return this._.getUTCDay();
- },
- getFullYear: function() {
- return this._.getUTCFullYear();
- },
- getHours: function() {
- return this._.getUTCHours();
- },
- getMilliseconds: function() {
- return this._.getUTCMilliseconds();
- },
- getMinutes: function() {
- return this._.getUTCMinutes();
- },
- getMonth: function() {
- return this._.getUTCMonth();
- },
- getSeconds: function() {
- return this._.getUTCSeconds();
- },
- getTime: function() {
- return this._.getTime();
- },
- getTimezoneOffset: function() {
- return 0;
- },
- valueOf: function() {
- return this._.valueOf();
- },
- setDate: function() {
- d3_time_prototype.setUTCDate.apply(this._, arguments);
- },
- setDay: function() {
- d3_time_prototype.setUTCDay.apply(this._, arguments);
- },
- setFullYear: function() {
- d3_time_prototype.setUTCFullYear.apply(this._, arguments);
- },
- setHours: function() {
- d3_time_prototype.setUTCHours.apply(this._, arguments);
- },
- setMilliseconds: function() {
- d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
- },
- setMinutes: function() {
- d3_time_prototype.setUTCMinutes.apply(this._, arguments);
- },
- setMonth: function() {
- d3_time_prototype.setUTCMonth.apply(this._, arguments);
- },
- setSeconds: function() {
- d3_time_prototype.setUTCSeconds.apply(this._, arguments);
- },
- setTime: function() {
- d3_time_prototype.setTime.apply(this._, arguments);
- }
- };
- var d3_time_prototype = Date.prototype;
- var d3_time_formatDateTime = "%a %b %e %X %Y", d3_time_formatDate = "%m/%d/%Y", d3_time_formatTime = "%H:%M:%S";
- var d3_time_days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], d3_time_dayAbbreviations = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
- d3.time.format = function(template) {
- var n = template.length;
- function format(date) {
- var string = [], i = -1, j = 0, c, p, f;
- while (++i < n) {
- if (template.charCodeAt(i) === 37) {
- string.push(template.substring(j, i));
- if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);
- if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p);
- string.push(c);
- j = i + 1;
- }
- }
- string.push(template.substring(j, i));
- return string.join("");
- }
- format.parse = function(string) {
- var d = {
- y: 1900,
- m: 0,
- d: 1,
- H: 0,
- M: 0,
- S: 0,
- L: 0
- }, i = d3_time_parse(d, template, string, 0);
- if (i != string.length) return null;
- if ("p" in d) d.H = d.H % 12 + d.p * 12;
- var date = new d3_time();
- date.setFullYear(d.y, d.m, d.d);
- date.setHours(d.H, d.M, d.S, d.L);
- return date;
- };
- format.toString = function() {
- return template;
- };
- return format;
- };
- function d3_time_parse(date, template, string, j) {
- var c, p, i = 0, n = template.length, m = string.length;
- while (i < n) {
- if (j >= m) return -1;
- c = template.charCodeAt(i++);
- if (c === 37) {
- p = d3_time_parsers[template.charAt(i++)];
- if (!p || (j = p(date, string, j)) < 0) return -1;
- } else if (c != string.charCodeAt(j++)) {
- return -1;
- }
- }
- return j;
- }
- function d3_time_formatRe(names) {
- return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
- }
- function d3_time_formatLookup(names) {
- var map = new d3_Map(), i = -1, n = names.length;
- while (++i < n) map.set(names[i].toLowerCase(), i);
- return map;
- }
- function d3_time_formatPad(value, fill, width) {
- value += "";
- var length = value.length;
- return length < width ? new Array(width - length + 1).join(fill) + value : value;
- }
- var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
- var d3_time_formatPads = {
- "-": "",
- _: " ",
- "0": "0"
- };
- var d3_time_formats = {
- a: function(d) {
- return d3_time_dayAbbreviations[d.getDay()];
- },
- A: function(d) {
- return d3_time_days[d.getDay()];
- },
- b: function(d) {
- return d3_time_monthAbbreviations[d.getMonth()];
- },
- B: function(d) {
- return d3_time_months[d.getMonth()];
- },
- c: d3.time.format(d3_time_formatDateTime),
- d: function(d, p) {
- return d3_time_formatPad(d.getDate(), p, 2);
- },
- e: function(d, p) {
- return d3_time_formatPad(d.getDate(), p, 2);
- },
- H: function(d, p) {
- return d3_time_formatPad(d.getHours(), p, 2);
- },
- I: function(d, p) {
- return d3_time_formatPad(d.getHours() % 12 || 12, p, 2);
- },
- j: function(d, p) {
- return d3_time_formatPad(1 + d3.time.dayOfYear(d), p, 3);
- },
- L: function(d, p) {
- return d3_time_formatPad(d.getMilliseconds(), p, 3);
- },
- m: function(d, p) {
- return d3_time_formatPad(d.getMonth() + 1, p, 2);
- },
- M: function(d, p) {
- return d3_time_formatPad(d.getMinutes(), p, 2);
- },
- p: function(d) {
- return d.getHours() >= 12 ? "PM" : "AM";
- },
- S: function(d, p) {
- return d3_time_formatPad(d.getSeconds(), p, 2);
- },
- U: function(d, p) {
- return d3_time_formatPad(d3.time.sundayOfYear(d), p, 2);
- },
- w: function(d) {
- return d.getDay();
- },
- W: function(d, p) {
- return d3_time_formatPad(d3.time.mondayOfYear(d), p, 2);
- },
- x: d3.time.format(d3_time_formatDate),
- X: d3.time.format(d3_time_formatTime),
- y: function(d, p) {
- return d3_time_formatPad(d.getFullYear() % 100, p, 2);
- },
- Y: function(d, p) {
- return d3_time_formatPad(d.getFullYear() % 1e4, p, 4);
- },
- Z: d3_time_zone,
- "%": function() {
- return "%";
- }
- };
- var d3_time_parsers = {
- a: d3_time_parseWeekdayAbbrev,
- A: d3_time_parseWeekday,
- b: d3_time_parseMonthAbbrev,
- B: d3_time_parseMonth,
- c: d3_time_parseLocaleFull,
- d: d3_time_parseDay,
- e: d3_time_parseDay,
- H: d3_time_parseHour24,
- I: d3_time_parseHour24,
- L: d3_time_parseMilliseconds,
- m: d3_time_parseMonthNumber,
- M: d3_time_parseMinutes,
- p: d3_time_parseAmPm,
- S: d3_time_parseSeconds,
- x: d3_time_parseLocaleDate,
- X: d3_time_parseLocaleTime,
- y: d3_time_parseYear,
- Y: d3_time_parseFullYear
- };
- function d3_time_parseWeekdayAbbrev(date, string, i) {
- d3_time_dayAbbrevRe.lastIndex = 0;
- var n = d3_time_dayAbbrevRe.exec(string.substring(i));
- return n ? i += n[0].length : -1;
- }
- function d3_time_parseWeekday(date, string, i) {
- d3_time_dayRe.lastIndex = 0;
- var n = d3_time_dayRe.exec(string.substring(i));
- return n ? i += n[0].length : -1;
- }
- function d3_time_parseMonthAbbrev(date, string, i) {
- d3_time_monthAbbrevRe.lastIndex = 0;
- var n = d3_time_monthAbbrevRe.exec(string.substring(i));
- return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
- }
- function d3_time_parseMonth(date, string, i) {
- d3_time_monthRe.lastIndex = 0;
- var n = d3_time_monthRe.exec(string.substring(i));
- return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
- }
- function d3_time_parseLocaleFull(date, string, i) {
- return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
- }
- function d3_time_parseLocaleDate(date, string, i) {
- return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
- }
- function d3_time_parseLocaleTime(date, string, i) {
- return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
- }
- function d3_time_parseFullYear(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 4));
- return n ? (date.y = +n[0], i += n[0].length) : -1;
- }
- function d3_time_parseYear(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
- }
- function d3_time_expandYear(d) {
- return d + (d > 68 ? 1900 : 2e3);
- }
- function d3_time_parseMonthNumber(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
- }
- function d3_time_parseDay(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.d = +n[0], i += n[0].length) : -1;
- }
- function d3_time_parseHour24(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.H = +n[0], i += n[0].length) : -1;
- }
- function d3_time_parseMinutes(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.M = +n[0], i += n[0].length) : -1;
- }
- function d3_time_parseSeconds(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 2));
- return n ? (date.S = +n[0], i += n[0].length) : -1;
- }
- function d3_time_parseMilliseconds(date, string, i) {
- d3_time_numberRe.lastIndex = 0;
- var n = d3_time_numberRe.exec(string.substring(i, i + 3));
- return n ? (date.L = +n[0], i += n[0].length) : -1;
- }
- var d3_time_numberRe = /^\s*\d+/;
- function d3_time_parseAmPm(date, string, i) {
- var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
- return n == null ? -1 : (date.p = n, i);
- }
- var d3_time_amPmLookup = d3.map({
- am: 0,
- pm: 1
- });
- function d3_time_zone(d) {
- var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
- return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2);
- }
- d3.time.format.utc = function(template) {
- var local = d3.time.format(template);
- function format(date) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time();
- utc._ = date;
- return local(utc);
- } finally {
- d3_time = Date;
- }
- }
- format.parse = function(string) {
- try {
- d3_time = d3_time_utc;
- var date = local.parse(string);
- return date && date._;
- } finally {
- d3_time = Date;
- }
- };
- format.toString = local.toString;
- return format;
- };
- var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
- d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
- function d3_time_formatIsoNative(date) {
- return date.toISOString();
- }
- d3_time_formatIsoNative.parse = function(string) {
- var date = new Date(string);
- return isNaN(date) ? null : date;
- };
- d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
- function d3_time_interval(local, step, number) {
- function round(date) {
- var d0 = local(date), d1 = offset(d0, 1);
- return date - d0 < d1 - date ? d0 : d1;
- }
- function ceil(date) {
- step(date = local(new d3_time(date - 1)), 1);
- return date;
- }
- function offset(date, k) {
- step(date = new d3_time(+date), k);
- return date;
- }
- function range(t0, t1, dt) {
- var time = ceil(t0), times = [];
- if (dt > 1) {
- while (time < t1) {
- if (!(number(time) % dt)) times.push(new Date(+time));
- step(time, 1);
- }
- } else {
- while (time < t1) times.push(new Date(+time)), step(time, 1);
- }
- return times;
- }
- function range_utc(t0, t1, dt) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time_utc();
- utc._ = t0;
- return range(utc, t1, dt);
- } finally {
- d3_time = Date;
- }
- }
- local.floor = local;
- local.round = round;
- local.ceil = ceil;
- local.offset = offset;
- local.range = range;
- var utc = local.utc = d3_time_interval_utc(local);
- utc.floor = utc;
- utc.round = d3_time_interval_utc(round);
- utc.ceil = d3_time_interval_utc(ceil);
- utc.offset = d3_time_interval_utc(offset);
- utc.range = range_utc;
- return local;
- }
- function d3_time_interval_utc(method) {
- return function(date, k) {
- try {
- d3_time = d3_time_utc;
- var utc = new d3_time_utc();
- utc._ = date;
- return method(utc, k)._;
- } finally {
- d3_time = Date;
- }
- };
- }
- d3.time.second = d3_time_interval(function(date) {
- return new d3_time(Math.floor(date / 1e3) * 1e3);
- }, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 1e3);
- }, function(date) {
- return date.getSeconds();
- });
- d3.time.seconds = d3.time.second.range;
- d3.time.seconds.utc = d3.time.second.utc.range;
- d3.time.minute = d3_time_interval(function(date) {
- return new d3_time(Math.floor(date / 6e4) * 6e4);
- }, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 6e4);
- }, function(date) {
- return date.getMinutes();
- });
- d3.time.minutes = d3.time.minute.range;
- d3.time.minutes.utc = d3.time.minute.utc.range;
- d3.time.hour = d3_time_interval(function(date) {
- var timezone = date.getTimezoneOffset() / 60;
- return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
- }, function(date, offset) {
- date.setTime(date.getTime() + Math.floor(offset) * 36e5);
- }, function(date) {
- return date.getHours();
- });
- d3.time.hours = d3.time.hour.range;
- d3.time.hours.utc = d3.time.hour.utc.range;
- d3.time.day = d3_time_interval(function(date) {
- var day = new d3_time(1970, 0);
- day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
- return day;
- }, function(date, offset) {
- date.setDate(date.getDate() + offset);
- }, function(date) {
- return date.getDate() - 1;
- });
- d3.time.days = d3.time.day.range;
- d3.time.days.utc = d3.time.day.utc.range;
- d3.time.dayOfYear = function(date) {
- var year = d3.time.year(date);
- return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
- };
- d3_time_daySymbols.forEach(function(day, i) {
- day = day.toLowerCase();
- i = 7 - i;
- var interval = d3.time[day] = d3_time_interval(function(date) {
- (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
- return date;
- }, function(date, offset) {
- date.setDate(date.getDate() + Math.floor(offset) * 7);
- }, function(date) {
- var day = d3.time.year(date).getDay();
- return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
- });
- d3.time[day + "s"] = interval.range;
- d3.time[day + "s"].utc = interval.utc.range;
- d3.time[day + "OfYear"] = function(date) {
- var day = d3.time.year(date).getDay();
- return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
- };
- });
- d3.time.week = d3.time.sunday;
- d3.time.weeks = d3.time.sunday.range;
- d3.time.weeks.utc = d3.time.sunday.utc.range;
- d3.time.weekOfYear = d3.time.sundayOfYear;
- d3.time.month = d3_time_interval(function(date) {
- date = d3.time.day(date);
- date.setDate(1);
- return date;
- }, function(date, offset) {
- date.setMonth(date.getMonth() + offset);
- }, function(date) {
- return date.getMonth();
- });
- d3.time.months = d3.time.month.range;
- d3.time.months.utc = d3.time.month.utc.range;
- d3.time.year = d3_time_interval(function(date) {
- date = d3.time.day(date);
- date.setMonth(0, 1);
- return date;
- }, function(date, offset) {
- date.setFullYear(date.getFullYear() + offset);
- }, function(date) {
- return date.getFullYear();
- });
- d3.time.years = d3.time.year.range;
- d3.time.years.utc = d3.time.year.utc.range;
- function d3_time_scale(linear, methods, format) {
- function scale(x) {
- return linear(x);
- }
- scale.invert = function(x) {
- return d3_time_scaleDate(linear.invert(x));
- };
- scale.domain = function(x) {
- if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
- linear.domain(x);
- return scale;
- };
- scale.nice = function(m) {
- return scale.domain(d3_scale_nice(scale.domain(), function() {
- return m;
- }));
- };
- scale.ticks = function(m, k) {
- var extent = d3_time_scaleExtent(scale.domain());
- if (typeof m !== "function") {
- var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
- if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
- if (!i) return linear.ticks(m).map(d3_time_scaleDate);
- if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
- m = methods[i];
- k = m[1];
- m = m[0].range;
- }
- return m(extent[0], new Date(+extent[1] + 1), k);
- };
- scale.tickFormat = function() {
- return format;
- };
- scale.copy = function() {
- return d3_time_scale(linear.copy(), methods, format);
- };
- return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
- }
- function d3_time_scaleExtent(domain) {
- var start = domain[0], stop = domain[domain.length - 1];
- return start < stop ? [ start, stop ] : [ stop, start ];
- }
- function d3_time_scaleDate(t) {
- return new Date(t);
- }
- function d3_time_scaleFormat(formats) {
- return function(date) {
- var i = formats.length - 1, f = formats[i];
- while (!f[1](date)) f = formats[--i];
- return f[0](date);
- };
- }
- function d3_time_scaleSetYear(y) {
- var d = new Date(y, 0, 1);
- d.setFullYear(y);
- return d;
- }
- function d3_time_scaleGetYear(d) {
- var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
- return y + (d - d0) / (d1 - d0);
- }
- var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
- var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
- var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), d3_true ], [ d3.time.format("%B"), function(d) {
- return d.getMonth();
- } ], [ d3.time.format("%b %d"), function(d) {
- return d.getDate() != 1;
- } ], [ d3.time.format("%a %d"), function(d) {
- return d.getDay() && d.getDate() != 1;
- } ], [ d3.time.format("%I %p"), function(d) {
- return d.getHours();
- } ], [ d3.time.format("%I:%M"), function(d) {
- return d.getMinutes();
- } ], [ d3.time.format(":%S"), function(d) {
- return d.getSeconds();
- } ], [ d3.time.format(".%L"), function(d) {
- return d.getMilliseconds();
- } ] ];
- var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
- d3_time_scaleLocalMethods.year = function(extent, m) {
- return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
- };
- d3.time.scale = function() {
- return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
- };
- var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
- return [ m[0].utc, m[1] ];
- });
- var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), d3_true ], [ d3.time.format.utc("%B"), function(d) {
- return d.getUTCMonth();
- } ], [ d3.time.format.utc("%b %d"), function(d) {
- return d.getUTCDate() != 1;
- } ], [ d3.time.format.utc("%a %d"), function(d) {
- return d.getUTCDay() && d.getUTCDate() != 1;
- } ], [ d3.time.format.utc("%I %p"), function(d) {
- return d.getUTCHours();
- } ], [ d3.time.format.utc("%I:%M"), function(d) {
- return d.getUTCMinutes();
- } ], [ d3.time.format.utc(":%S"), function(d) {
- return d.getUTCSeconds();
- } ], [ d3.time.format.utc(".%L"), function(d) {
- return d.getUTCMilliseconds();
- } ] ];
- var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
- function d3_time_scaleUTCSetYear(y) {
- var d = new Date(Date.UTC(y, 0, 1));
- d.setUTCFullYear(y);
- return d;
- }
- function d3_time_scaleUTCGetYear(d) {
- var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
- return y + (d - d0) / (d1 - d0);
- }
- d3_time_scaleUTCMethods.year = function(extent, m) {
- return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
- };
- d3.time.scale.utc = function() {
- return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
- };
- return d3;
-}(); \ No newline at end of file
diff --git a/visualize/static/d3-3.0.6.min.js b/visualize/static/d3-3.0.6.min.js
deleted file mode 100644
index 0a238da1..00000000
--- a/visualize/static/d3-3.0.6.min.js
+++ /dev/null
@@ -1,280 +0,0 @@
-/*! d3-3.0.6.js - Data Driven Documents
- * Version: 3.0.6
- * Homepage: http://mbostock.github.com/d3/
- * Copyright: 2012, Michael Bostock
- * Licence: 3-Clause BSD
- *
- * Copyright (c) 2012, Michael Bostock
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * * The name Michael Bostock may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-d3=function(){function rb(a){return a.target}function sb(a){return a.source}function Je(a){for(var b=-1,c=a.length,d=[];++b<c;)d.push(a[b]);return d}function ba(){}function V(a){return a}function za(){return!0}function F(a){return"function"===typeof a?a:function(){return a}}function Ke(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function tb(a){return null!=a&&!isNaN(a)}function Le(a){return a.length}function Me(a){return 1===a.length?function(b,c){a(null==b?c:
-null)}:a}function Ne(a){return a.responseText}function Oe(a){return JSON.parse(a.responseText)}function Pe(a){var b=W.createRange();b.selectNode(W.body);return b.createContextualFragment(a.responseText)}function Qe(a){return a.responseXML}function ub(){}function zc(a){function b(){for(var b=c,d=-1,h=b.length,k;++d<h;)(k=b[d].on)&&k.apply(this,arguments);return a}var c=[],d=new ba;b.on=function(b,f){var h=d.get(b),k;if(2>arguments.length)return h&&h.on;h&&(h.on=null,c=c.slice(0,k=c.indexOf(h)).concat(c.slice(k+
-1)),d.remove(b));f&&c.push(d.set(b,{on:f}));return a};return b}function vb(a,b){return b-(a?Math.ceil(Math.log(a)/Math.LN10):1)}function Re(a){return a+""}function Se(a){return function(b){return 0>=b?0:1<=b?1:a(b)}}function Ac(a){return function(b){return 1-a(1-b)}}function Bc(a){return function(b){return.5*(.5>b?a(2*b):2-a(2-2*b))}}function Te(a){return a*a}function Ue(a){return a*a*a}function Ve(a){return 1-Math.cos(a*u/2)}function We(a){return Math.pow(2,10*(a-1))}function Xe(a){return 1-Math.sqrt(1-
-a*a)}function Ye(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}function X(){g.event.stopPropagation();g.event.preventDefault()}function Cc(){for(var a=g.event,b;b=a.sourceEvent;)a=b;return a}function wb(a){for(var b=new ub,c=0,d=arguments.length;++c<d;)b[arguments[c]]=zc(b);b.of=function(c,d){return function(h){try{var k=h.sourceEvent=g.event;h.target=a;g.event=h;b[h.type].apply(c,d)}finally{g.event=k}}};
-return b}function Dc(a){var b=[a.a,a.b],c=[a.c,a.d],d=Ec(b),e=b[0]*c[0]+b[1]*c[1],f=-e;c[0]+=f*b[0];c[1]+=f*b[1];f=Ec(c)||0;b[0]*c[1]<c[0]*b[1]&&(b[0]*=-1,b[1]*=-1,d*=-1,e*=-1);this.rotate=(d?Math.atan2(b[1],b[0]):Math.atan2(-c[0],c[1]))*O;this.translate=[a.e,a.f];this.scale=[d,f];this.skew=f?Math.atan2(e,f)*O:0}function Ec(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]);b&&(a[0]/=b,a[1]/=b);return b}function xb(a){return"transform"==a?g.interpolateTransform:g.interpolate}function Ze(a,b){b=b-(a=+a)?1/(b-
-a):0;return function(c){return(c-a)*b}}function $e(a,b){b=b-(a=+a)?1/(b-a):0;return function(c){return Math.max(0,Math.min(1,(c-a)*b))}}function qa(){}function ca(a,b,c){return new yb(a,b,c)}function yb(a,b,c){this.r=a;this.g=b;this.b=c}function ra(a){return 16>a?"0"+Math.max(0,a).toString(16):Math.min(255,a).toString(16)}function zb(a,b,c){var d=0,e=0,f=0,h,k;if(h=/([a-z]+)\((.*)\)/i.exec(a))switch(k=h[2].split(","),h[1]){case "hsl":return c(parseFloat(k[0]),parseFloat(k[1])/100,parseFloat(k[2])/
-100);case "rgb":return b(Ab(k[0]),Ab(k[1]),Ab(k[2]))}if(c=Ka.get(a))return b(c.r,c.g,c.b);null!=a&&"#"===a.charAt(0)&&(4===a.length?(d=a.charAt(1),d+=d,e=a.charAt(2),e+=e,f=a.charAt(3),f+=f):7===a.length&&(d=a.substring(1,3),e=a.substring(3,5),f=a.substring(5,7)),d=parseInt(d,16),e=parseInt(e,16),f=parseInt(f,16));return b(d,e,f)}function Fc(a,b,c){var d=Math.min(a/=255,b/=255,c/=255),e=Math.max(a,b,c),f=e-d,h=(e+d)/2;f?(d=.5>h?f/(e+d):f/(2-e-d),a=60*(a==e?(b-c)/f+(b<c?6:0):b==e?(c-a)/f+2:(a-b)/f+
-4)):d=a=0;return sa(a,d,h)}function Gc(a,b,c){a=Bb(a);b=Bb(b);c=Bb(c);var d=Cb((.4124564*a+.3575761*b+.1804375*c)/Hc),e=Cb((.2126729*a+.7151522*b+.072175*c)/Ic);a=Cb((.0193339*a+.119192*b+.9503041*c)/Jc);return ta(116*e-16,500*(d-e),200*(e-a))}function Bb(a){return.04045>=(a/=255)?a/12.92:Math.pow((a+.055)/1.055,2.4)}function Ab(a){var b=parseFloat(a);return"%"===a.charAt(a.length-1)?Math.round(2.55*b):b}function sa(a,b,c){return new Db(a,b,c)}function Db(a,b,c){this.h=a;this.s=b;this.l=c}function La(a,
-b,c){function d(a){360<a?a-=360:0>a&&(a+=360);return 60>a?e+(f-e)*a/60:180>a?f:240>a?e+(f-e)*(240-a)/60:e}var e,f;a%=360;0>a&&(a+=360);b=0>b?0:1<b?1:b;c=0>c?0:1<c?1:c;f=.5>=c?c*(1+b):c+b-c*b;e=2*c-f;return ca(Math.round(255*d(a+120)),Math.round(255*d(a)),Math.round(255*d(a-120)))}function Aa(a,b,c){return new Ma(a,b,c)}function Ma(a,b,c){this.h=a;this.c=b;this.l=c}function Eb(a,b,c){return ta(c,Math.cos(a*=w)*b,Math.sin(a)*b)}function ta(a,b,c){return new Na(a,b,c)}function Na(a,b,c){this.l=a;this.a=
-b;this.b=c}function Kc(a,b,c){a=(a+16)/116;c=a-c/200;b=Fb(a+b/500)*Hc;a=Fb(a)*Ic;c=Fb(c)*Jc;return ca(Gb(3.2404542*b-1.5371385*a-.4985314*c),Gb(-.969266*b+1.8760108*a+.041556*c),Gb(.0556434*b-.2040259*a+1.0572252*c))}function Lc(a,b,c){return Aa(Math.atan2(c,b)/u*180,Math.sqrt(b*b+c*c),a)}function Fb(a){return.206893034<a?a*a*a:(a-4/29)/7.787037}function Cb(a){return.008856<a?Math.pow(a,1/3):7.787037*a+4/29}function Gb(a){return Math.round(255*(.00304>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055))}function da(a){Hb(a,
-C);return a}function Mc(a){return function(){return Oa(a,this)}}function Nc(a){return function(){return Oc(a,this)}}function Pc(a,b){function c(){this.removeAttribute(a)}function d(){this.removeAttributeNS(a.space,a.local)}function e(){this.setAttribute(a,b)}function f(){this.setAttributeNS(a.space,a.local,b)}function h(){var c=b.apply(this,arguments);null==c?this.removeAttribute(a):this.setAttribute(a,c)}function k(){var c=b.apply(this,arguments);null==c?this.removeAttributeNS(a.space,a.local):this.setAttributeNS(a.space,
-a.local,c)}a=g.ns.qualify(a);return null==b?a.local?d:c:"function"===typeof b?a.local?k:h:a.local?f:e}function Qc(a){return new RegExp("(?:^|\\s+)"+g.requote(a)+"(?:\\s+|$)","g")}function Rc(a,b){function c(){for(var c=-1;++c<e;)a[c](this,b)}function d(){for(var c=-1,d=b.apply(this,arguments);++c<e;)a[c](this,d)}a=a.trim().split(/\s+/).map(af);var e=a.length;return"function"===typeof b?d:c}function af(a){var b=Qc(a);return function(c,d){if(e=c.classList)return d?e.add(a):e.remove(a);var e=c.className,
-f=null!=e.baseVal,h=f?e.baseVal:e;d?(b.lastIndex=0,b.test(h)||(h=(h+" "+a).trim().replace(/\s+/g," "),f?e.baseVal=h:c.className=h)):h&&(h=h.replace(b," ").trim().replace(/\s+/g," "),f?e.baseVal=h:c.className=h)}}function Sc(a,b,c){function d(){this.style.removeProperty(a)}function e(){this.style.setProperty(a,b,c)}function f(){var e=b.apply(this,arguments);null==e?this.style.removeProperty(a):this.style.setProperty(a,e,c)}return null==b?d:"function"===typeof b?f:e}function Tc(a,b){function c(){delete this[a]}
-function d(){this[a]=b}function e(){var c=b.apply(this,arguments);null==c?delete this[a]:this[a]=c}return null==b?c:"function"===typeof b?e:d}function Uc(a){return function(){return Vc(this,a)}}function bf(a){arguments.length||(a=g.ascending);return function(b,c){return!b-!c||a(b.__data__,c.__data__)}}function Wc(a,b,c){function d(){var b=this[f];b&&(this.removeEventListener(a,b,b.$),delete this[f])}function e(){function e(a){var c=g.event;g.event=a;m[0]=h.__data__;try{b.apply(h,m)}finally{g.event=
-c}}var h=this,m=ha(arguments);d.call(this);this.addEventListener(a,this[f]=e,e.$=c);e._=b}var f="__on"+a,h=a.indexOf(".");0<h&&(a=a.substring(0,h));return b?e:d}function ia(a,b){for(var c=0,d=a.length;c<d;c++)for(var e=a[c],f=0,h=e.length,k;f<h;f++)(k=e[f])&&b(k,f,c);return a}function Xc(a){Hb(a,ma);return a}function Ba(a,b){Hb(a,M);a.id=b;return a}function Pa(a,b,c,d){var e=a.__transition__||(a.__transition__={active:0,count:0}),f=e[c];if(!f){var h=d.time,f=e[c]={tween:new ba,event:g.dispatch("start",
-"end"),time:h,ease:d.ease,delay:d.delay,duration:d.duration};++e.count;g.timer(function(d){function l(d){if(e.active>c)return n();e.active=c;r.start.call(a,p,b);f.tween.forEach(function(c,e){(e=e.call(a,p,b))&&v.push(e)});m(d)||g.timer(m,0,h);return 1}function m(d){if(e.active!==c)return n();d=(d-s)/t;for(var f=q(d),h=v.length;0<h;)v[--h].call(a,f);if(1<=d)return n(),r.end.call(a,p,b),1}function n(){--e.count?delete e[c]:delete a.__transition__;return 1}var p=a.__data__,q=f.ease,r=f.event,s=f.delay,
-t=f.duration,v=[];return s<=d?l(d):g.timer(l,s,h),1},0,h);return f}}function cf(a){null==a&&(a="");return function(){this.textContent=a}}function Ib(a,b,c,d){var e=a.id;return ia(a,"function"===typeof c?function(a,h,k){a.__transition__[e].tween.set(b,d(c.call(a,a.__data__,h,k)))}:(c=d(c),function(a){a.__transition__[e].tween.set(b,c)}))}function Jb(){for(var a,b=Date.now(),c=ua;c;)a=b-c.then,a>=c.delay&&(c.flush=c.callback(a)),c=c.next;a=Yc()-b;24<a?(isFinite(a)&&(clearTimeout(Qa),Qa=setTimeout(Jb,
-a)),Ra=0):(Ra=1,Zc(Jb))}function Yc(){for(var a=null,b=ua,c=Infinity;b;)b.flush?(delete Kb[b.callback.id],b=a?a.next=b.next:ua=b.next):(c=Math.min(c,b.then+b.delay),b=(a=b).next);return c}function $c(a,b){var c=a.ownerSVGElement||a;if(c.createSVGPoint){var d=c.createSVGPoint();if(0>Lb&&(P.scrollX||P.scrollY)){var c=g.select(W.body).append("svg").style("position","absolute").style("top",0).style("left",0),e=c[0][0].getScreenCTM();Lb=!(e.f||e.e);c.remove()}Lb?(d.x=b.pageX,d.y=b.pageY):(d.x=b.clientX,
-d.y=b.clientY);d=d.matrixTransform(a.getScreenCTM().inverse());return[d.x,d.y]}c=a.getBoundingClientRect();return[b.clientX-c.left-a.clientLeft,b.clientY-c.top-a.clientTop]}function T(){}function Ca(a){var b=a[0];a=a[a.length-1];return b<a?[b,a]:[a,b]}function Sa(a){return a.rangeExtent?a.rangeExtent():Ca(a.range())}function Ta(a,b){var c=0,d=a.length-1,e=a[c],f=a[d],h;f<e&&(h=c,c=d,d=h,h=e,e=f,f=h);if(b=b(f-e))a[c]=b.floor(e),a[d]=b.ceil(f);return a}function df(){return Math}function ad(a,b,c,d){function e(){var e=
-2<Math.min(a.length,b.length)?ef:ff,m=d?$e:Ze;h=e(a,b,m,c);k=e(b,a,m,g.interpolate);return f}function f(a){return h(a)}var h,k;f.invert=function(a){return k(a)};f.domain=function(b){if(!arguments.length)return a;a=b.map(Number);return e()};f.range=function(a){if(!arguments.length)return b;b=a;return e()};f.rangeRound=function(a){return f.range(a).interpolate(g.interpolateRound)};f.clamp=function(a){if(!arguments.length)return d;d=a;return e()};f.interpolate=function(a){if(!arguments.length)return c;
-c=a;return e()};f.ticks=function(b){return Mb(a,b)};f.tickFormat=function(b){return Nb(a,b)};f.nice=function(){Ta(a,bd);return e()};f.copy=function(){return ad(a,b,c,d)};return e()}function cd(a,b){return g.rebind(a,b,"range","rangeRound","interpolate","clamp")}function bd(a){return(a=Math.pow(10,Math.round(Math.log(a)/Math.LN10)-1))&&{floor:function(b){return Math.floor(b/a)*a},ceil:function(b){return Math.ceil(b/a)*a}}}function dd(a,b){var c=Ca(a),d=c[1]-c[0],e=Math.pow(10,Math.floor(Math.log(d/
-b)/Math.LN10)),d=b/d*e;.15>=d?e*=10:.35>=d?e*=5:.75>=d&&(e*=2);c[0]=Math.ceil(c[0]/e)*e;c[1]=Math.floor(c[1]/e)*e+.5*e;c[2]=e;return c}function Mb(a,b){return g.range.apply(g,dd(a,b))}function Nb(a,b){return g.format(",."+Math.max(0,-Math.floor(Math.log(dd(a,b)[2])/Math.LN10+.01))+"f")}function ff(a,b,c,d){var e=c(a[0],a[1]),f=d(b[0],b[1]);return function(a){return f(e(a))}}function ef(a,b,c,d){var e=[],f=[],h=0,k=Math.min(a.length,b.length)-1;a[k]<a[0]&&(a=a.slice().reverse(),b=b.slice().reverse());
-for(;++h<=k;)e.push(c(a[h-1],a[h])),f.push(d(b[h-1],b[h]));return function(b){var c=g.bisect(a,b,1,k)-1;return f[c](e[c](b))}}function ed(a,b){function c(c){return a(b(c))}var d=b.pow;c.invert=function(b){return d(a.invert(b))};c.domain=function(e){if(!arguments.length)return a.domain().map(d);b=0>e[0]?Ua:Ob;d=b.pow;a.domain(e.map(b));return c};c.nice=function(){a.domain(Ta(a.domain(),df));return c};c.ticks=function(){var c=Ca(a.domain()),f=[];if(c.every(isFinite)){var h=Math.floor(c[0]),k=Math.ceil(c[1]),
-l=d(c[0]),c=d(c[1]);if(b===Ua)for(f.push(d(h));h++<k;)for(var m=9;0<m;m--)f.push(d(h)*m);else{for(;h<k;h++)for(m=1;10>m;m++)f.push(d(h)*m);f.push(d(h))}for(h=0;f[h]<l;h++);for(k=f.length;f[k-1]>c;k--);f=f.slice(h,k)}return f};c.tickFormat=function(a,f){2>arguments.length&&(f=gf);if(!arguments.length)return f;var h=Math.max(.1,a/c.ticks().length),k=b===Ua?(l=-1E-12,Math.floor):(l=1E-12,Math.ceil),l;return function(a){return a/d(k(b(a)+l))<=h?f(a):""}};c.copy=function(){return ed(a.copy(),b)};return cd(c,
-a)}function Ob(a){return Math.log(0>a?0:a)/Math.LN10}function Ua(a){return-Math.log(0<a?0:-a)/Math.LN10}function fd(a,b){function c(b){return a(d(b))}var d=Va(b),e=Va(1/b);c.invert=function(b){return e(a.invert(b))};c.domain=function(b){if(!arguments.length)return a.domain().map(e);a.domain(b.map(d));return c};c.ticks=function(a){return Mb(c.domain(),a)};c.tickFormat=function(a){return Nb(c.domain(),a)};c.nice=function(){return c.domain(Ta(c.domain(),bd))};c.exponent=function(a){if(!arguments.length)return b;
-var h=c.domain();d=Va(b=a);e=Va(1/b);return c.domain(h)};c.copy=function(){return fd(a.copy(),b)};return cd(c,a)}function Va(a){return function(b){return 0>b?-Math.pow(-b,a):Math.pow(b,a)}}function gd(a,b){function c(b){return f[((e.get(b)||e.set(b,a.push(b)))-1)%f.length]}function d(b,c){return g.range(a.length).map(function(a){return b+c*a})}var e,f,h;c.domain=function(d){if(!arguments.length)return a;a=[];e=new ba;for(var f=-1,h=d.length,g;++f<h;)e.has(g=d[f])||e.set(g,a.push(g));return c[b.t].apply(c,
-b.a)};c.range=function(a){if(!arguments.length)return f;f=a;h=0;b={t:"range",a:arguments};return c};c.rangePoints=function(e,l){2>arguments.length&&(l=0);var m=e[0],g=e[1],p=(g-m)/(Math.max(1,a.length-1)+l);f=d(2>a.length?(m+g)/2:m+p*l/2,p);h=0;b={t:"rangePoints",a:arguments};return c};c.rangeBands=function(e,l,m){2>arguments.length&&(l=0);3>arguments.length&&(m=l);var g=e[1]<e[0],p=e[g-0],q=(e[1-g]-p)/(a.length-l+2*m);f=d(p+q*m,q);g&&f.reverse();h=q*(1-l);b={t:"rangeBands",a:arguments};return c};
-c.rangeRoundBands=function(e,l,m){2>arguments.length&&(l=0);3>arguments.length&&(m=l);var g=e[1]<e[0],p=e[g-0],q=e[1-g],r=Math.floor((q-p)/(a.length-l+2*m));f=d(p+Math.round((q-p-(a.length-l)*r)/2),r);g&&f.reverse();h=Math.round(r*(1-l));b={t:"rangeRoundBands",a:arguments};return c};c.rangeBand=function(){return h};c.rangeExtent=function(){return Ca(b.a[0])};c.copy=function(){return gd(a,b)};return c.domain(a)}function hd(a,b){function c(){var c=0,h=b.length;for(e=[];++c<h;)e[c-1]=g.quantile(a,c/
-h);return d}function d(a){return isNaN(a=+a)?NaN:b[g.bisect(e,a)]}var e;d.domain=function(b){if(!arguments.length)return a;a=b.filter(function(a){return!isNaN(a)}).sort(g.ascending);return c()};d.range=function(a){if(!arguments.length)return b;b=a;return c()};d.quantiles=function(){return e};d.copy=function(){return hd(a,b)};return c()}function id(a,b,c){function d(b){return c[Math.max(0,Math.min(h,Math.floor(f*(b-a))))]}function e(){f=c.length/(b-a);h=c.length-1;return d}var f,h;d.domain=function(c){if(!arguments.length)return[a,
-b];a=+c[0];b=+c[c.length-1];return e()};d.range=function(a){if(!arguments.length)return c;c=a;return e()};d.copy=function(){return id(a,b,c)};return e()}function jd(a,b){function c(c){return b[g.bisect(a,c)]}c.domain=function(b){if(!arguments.length)return a;a=b;return c};c.range=function(a){if(!arguments.length)return b;b=a;return c};c.copy=function(){return jd(a,b)};return c}function kd(a){function b(a){return+a}b.invert=b;b.domain=b.range=function(c){if(!arguments.length)return a;a=c.map(b);return b};
-b.ticks=function(b){return Mb(a,b)};b.tickFormat=function(b){return Nb(a,b)};b.copy=function(){return kd(a)};return b}function hf(a){return a.innerRadius}function jf(a){return a.outerRadius}function ld(a){return a.startAngle}function md(a){return a.endAngle}function nd(a){function b(b){function h(){g.push("M",f(a(p),k))}for(var g=[],p=[],q=-1,r=b.length,s,t=F(c),v=F(d);++q<r;)e.call(this,s=b[q],q)?p.push([+t.call(this,s,q),+v.call(this,s,q)]):p.length&&(h(),p=[]);p.length&&h();return g.length?g.join(""):
-null}var c=Pb,d=od,e=za,f=U,h=f.key,k=.7;b.x=function(a){if(!arguments.length)return c;c=a;return b};b.y=function(a){if(!arguments.length)return d;d=a;return b};b.defined=function(a){if(!arguments.length)return e;e=a;return b};b.interpolate=function(a){if(!arguments.length)return h;h="function"===typeof a?f=a:(f=Qb.get(a)||U).key;return b};b.tension=function(a){if(!arguments.length)return k;k=a;return b};return b}function Pb(a){return a[0]}function od(a){return a[1]}function U(a){return a.join("L")}
-function Rb(a){for(var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];++b<c;)e.push("V",(d=a[b])[1],"H",d[0]);return e.join("")}function Sb(a){for(var b=0,c=a.length,d=a[0],e=[d[0],",",d[1]];++b<c;)e.push("H",(d=a[b])[0],"V",d[1]);return e.join("")}function Wa(a,b){if(1>b.length||a.length!=b.length&&a.length!=b.length+2)return U(a);var c=a.length!=b.length,d="",e=a[0],f=a[1],h=b[0],k=h,l=1;c&&(d+="Q"+(f[0]-2*h[0]/3)+","+(f[1]-2*h[1]/3)+","+f[0]+","+f[1],e=a[1],l=2);if(1<b.length)for(k=b[1],f=a[l],l++,d+=
-"C"+(e[0]+h[0])+","+(e[1]+h[1])+","+(f[0]-k[0])+","+(f[1]-k[1])+","+f[0]+","+f[1],e=2;e<b.length;e++,l++)f=a[l],k=b[e],d+="S"+(f[0]-k[0])+","+(f[1]-k[1])+","+f[0]+","+f[1];c&&(c=a[l],d+="Q"+(f[0]+2*k[0]/3)+","+(f[1]+2*k[1]/3)+","+c[0]+","+c[1]);return d}function Tb(a,b){for(var c=[],d=(1-b)/2,e,f=a[0],h=a[1],k=1,l=a.length;++k<l;)e=f,f=h,h=a[k],c.push([d*(h[0]-e[0]),d*(h[1]-e[1])]);return c}function pd(a){if(3>a.length)return U(a);var b=1,c=a.length,d=a[0],e=d[0],f=d[1],h=[e,e,e,(d=a[1])[0]],k=[f,
-f,f,d[1]],e=[e,",",f];for(Da(e,h,k);++b<c;)d=a[b],h.shift(),h.push(d[0]),k.shift(),k.push(d[1]),Da(e,h,k);for(b=-1;2>++b;)h.shift(),h.push(d[0]),k.shift(),k.push(d[1]),Da(e,h,k);return e.join("")}function aa(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}function Da(a,b,c){a.push("C",aa(qd,b),",",aa(qd,c),",",aa(rd,b),",",aa(rd,c),",",aa(va,b),",",aa(va,c))}function Ub(a,b){return(b[1]-a[1])/(b[0]-a[0])}function sd(a){for(var b,c=-1,d=a.length,e,f;++c<d;)b=a[c],e=b[0],f=b[1]+na,b[0]=e*Math.cos(f),
-b[1]=e*Math.sin(f);return a}function td(a){function b(b){function l(){s.push("M",k(a(v),p),g,m(a(t.reverse()),p),"Z")}for(var s=[],t=[],v=[],x=-1,z=b.length,y,G=F(c),H=F(e),D=c===d?function(){return E}:F(d),B=e===f?function(){return wa}:F(f),E,wa;++x<z;)h.call(this,y=b[x],x)?(t.push([E=+G.call(this,y,x),wa=+H.call(this,y,x)]),v.push([+D.call(this,y,x),+B.call(this,y,x)])):t.length&&(l(),t=[],v=[]);t.length&&l();return s.length?s.join(""):null}var c=Pb,d=Pb,e=0,f=od,h=za,k=U,l=k.key,m=k,g="L",p=.7;
-b.x=function(a){if(!arguments.length)return d;c=d=a;return b};b.x0=function(a){if(!arguments.length)return c;c=a;return b};b.x1=function(a){if(!arguments.length)return d;d=a;return b};b.y=function(a){if(!arguments.length)return f;e=f=a;return b};b.y0=function(a){if(!arguments.length)return e;e=a;return b};b.y1=function(a){if(!arguments.length)return f;f=a;return b};b.defined=function(a){if(!arguments.length)return h;h=a;return b};b.interpolate=function(a){if(!arguments.length)return l;l="function"===
-typeof a?k=a:(k=Qb.get(a)||U).key;m=k.reverse||k;g=k.closed?"M":"L";return b};b.tension=function(a){if(!arguments.length)return p;p=a;return b};return b}function kf(a){return a.radius}function ud(a){return[a.x,a.y]}function lf(a){return function(){var b=a.apply(this,arguments),c=b[0],b=b[1]+na;return[c*Math.cos(b),c*Math.sin(b)]}}function mf(){return 64}function nf(){return"circle"}function vd(a){a=Math.sqrt(a/u);return"M0,"+a+"A"+a+","+a+" 0 1,1 0,"+-a+"A"+a+","+a+" 0 1,1 0,"+a+"Z"}function wd(a,
-b){a.attr("transform",function(a){return"translate("+b(a)+",0)"})}function xd(a,b){a.attr("transform",function(a){return"translate(0,"+b(a)+")"})}function of(a,b,c){d=[];if(c&&1<b.length){a=Ca(a.domain());for(var d,e=-1,f=b.length,h=(b[1]-b[0])/++c,k,l;++e<f;)for(k=c;0<--k;)(l=+b[e]-k*h)>=a[0]&&d.push(l);--e;for(k=0;++k<c&&(l=+b[e]+k*h)<a[1];)d.push(l)}return d}function pf(a){var b=a.source;a=a.target;var c;var d=a;if(b===d)c=b;else{c=yd(b);for(var d=yd(d),e=c.pop(),f=d.pop(),h=null;e===f;)h=e,e=
-c.pop(),f=d.pop();c=h}for(d=[b];b!==c;)b=b.parent,d.push(b);for(b=d.length;a!==c;)d.splice(b,0,a),a=a.parent;return d}function yd(a){for(var b=[],c=a.parent;null!=c;)b.push(a),a=c,c=c.parent;b.push(a);return b}function qf(a){a.fixed|=2}function rf(a){a.fixed&=-7}function sf(a){a.fixed|=4;a.px=a.x;a.py=a.y}function tf(a){a.fixed&=-5}function zd(a,b,c){var d=0,e=0;a.charge=0;if(!a.leaf)for(var f=a.nodes,h=f.length,k=-1,l;++k<h;)l=f[k],null!=l&&(zd(l,b,c),a.charge+=l.charge,d+=l.charge*l.cx,e+=l.charge*
-l.cy);a.point&&(a.leaf||(a.point.x+=Math.random()-.5,a.point.y+=Math.random()-.5),b*=c[a.point.index],a.charge+=a.pointCharge=b,d+=b*a.point.x,e+=b*a.point.y);a.cx=d/a.charge;a.cy=e/a.charge}function uf(a){return a.x}function vf(a){return a.y}function wf(a,b,c){a.y0=b;a.y=c}function Vb(a){return g.range(a.length)}function Wb(a){var b=-1;a=a[0].length;for(var c=[];++b<a;)c[b]=0;return c}function xf(a){for(var b=1,c=0,d=a[0][1],e,f=a.length;b<f;++b)(e=a[b][1])>d&&(c=b,d=e);return c}function yf(a){return a.reduce(zf,
-0)}function zf(a,b){return a+b[1]}function Af(a,b){return Ad(a,Math.ceil(Math.log(b.length)/Math.LN2+1))}function Ad(a,b){for(var c=-1,d=+a[0],e=(a[1]-d)/b,f=[];++c<=b;)f[c]=e*c+d;return f}function Bf(a){return[g.min(a),g.max(a)]}function Ea(a,b){g.rebind(a,b,"sort","children","value");a.nodes=a;a.links=Cf;return a}function Df(a){return a.children}function Ef(a){return a.value}function Ff(a,b){return b.value-a.value}function Cf(a){return g.merge(a.map(function(a){return(a.children||[]).map(function(c){return{source:a,
-target:c}})}))}function Gf(a,b){return a.value-b.value}function Xb(a,b){var c=a._pack_next;a._pack_next=b;b._pack_prev=a;b._pack_next=c;c._pack_prev=b}function Bd(a,b){a._pack_next=b;b._pack_prev=a}function Cd(a,b){var c=b.x-a.x,d=b.y-a.y,e=a.r+b.r;return.001<e*e-c*c-d*d}function Dd(a){function b(a){d=Math.min(a.x-a.r,d);e=Math.max(a.x+a.r,e);f=Math.min(a.y-a.r,f);h=Math.max(a.y+a.r,h)}if((c=a.children)&&(r=c.length)){var c,d=Infinity,e=-Infinity,f=Infinity,h=-Infinity,k,l,m,g,p,q,r;c.forEach(Hf);
-k=c[0];k.x=-k.r;k.y=0;b(k);if(1<r&&(l=c[1],l.x=l.r,l.y=0,b(l),2<r))for(m=c[2],Ed(k,l,m),b(m),Xb(k,m),k._pack_prev=m,Xb(m,l),l=k._pack_next,g=3;g<r;g++){Ed(k,l,m=c[g]);var s=0,t=1,v=1;for(p=l._pack_next;p!==l;p=p._pack_next,t++)if(Cd(p,m)){s=1;break}if(1==s)for(q=k._pack_prev;q!==p._pack_prev&&!Cd(q,m);q=q._pack_prev,v++);s?(t<v||t==v&&l.r<k.r?Bd(k,l=p):Bd(k=q,l),g--):(Xb(k,m),l=m,b(m))}k=(d+e)/2;l=(f+h)/2;for(g=p=0;g<r;g++)m=c[g],m.x-=k,m.y-=l,p=Math.max(p,m.r+Math.sqrt(m.x*m.x+m.y*m.y));a.r=p;c.forEach(If)}}
-function Hf(a){a._pack_next=a._pack_prev=a}function If(a){delete a._pack_next;delete a._pack_prev}function Fd(a,b,c,d){var e=a.children;a.x=b+=d*a.x;a.y=c+=d*a.y;a.r*=d;if(e){a=-1;for(var f=e.length;++a<f;)Fd(e[a],b,c,d)}}function Ed(a,b,c){var d=a.r+c.r,e=b.x-a.x,f=b.y-a.y;if(d&&(e||f)){var h=b.r+c.r,k=e*e+f*f,h=h*h,d=d*d;b=.5+(d-h)/(2*k);h=Math.sqrt(Math.max(0,2*h*(d+k)-(d-=k)*d-h*h))/(2*k);c.x=a.x+b*e+h*f;c.y=a.y+b*f-h*e}else c.x=a.x+d,c.y=a.y}function Jf(a){return 1+g.max(a,function(a){return a.y})}
-function Kf(a){return a.reduce(function(a,c){return a+c.x},0)/a.length}function Gd(a){var b=a.children;return b&&b.length?Gd(b[0]):a}function Hd(a){var b=a.children,c;return b&&(c=b.length)?Hd(b[c-1]):a}function Id(a,b){return a.parent==b.parent?1:2}function Yb(a){var b=a.children;return b&&b.length?b[0]:a._tree.thread}function Zb(a){var b=a.children,c;return b&&(c=b.length)?b[c-1]:a._tree.thread}function Xa(a,b){var c=a.children;if(c&&(e=c.length))for(var d,e,f=-1;++f<e;)0<b(d=Xa(c[f],b),a)&&(a=
-d);return a}function Lf(a,b){return a.x-b.x}function Mf(a,b){return b.x-a.x}function Nf(a,b){return a.depth-b.depth}function ea(a,b){function c(a,e){var f=a.children;if(f&&(g=f.length))for(var h,k=null,l=-1,g;++l<g;)h=f[l],c(h,k),k=h;b(a,e)}c(a,null)}function $b(a){return{x:a.x,y:a.y,dx:a.dx,dy:a.dy}}function Jd(a,b){var c=a.x+b[3],d=a.y+b[0],e=a.dx-b[1]-b[3],f=a.dy-b[0]-b[2];0>e&&(c+=e/2,e=0);0>f&&(d+=f/2,f=0);return{x:c,y:d,dx:e,dy:f}}function Kd(a,b){function c(a,c){return g.xhr(a,b,c).response(d)}
-function d(a){return c.parse(a.responseText)}function e(b){return b.map(f).join(a)}function f(a){return h.test(a)?'"'+a.replace(/\"/g,'""')+'"':a}var h=new RegExp('["'+a+"\n]"),k=a.charCodeAt(0);c.parse=function(a){var b;return c.parseRows(a,function(a){if(b)return b(a);b=new Function("d","return {"+a.map(function(a,b){return JSON.stringify(a)+": d["+b+"]"}).join(",")+"}")})};c.parseRows=function(a,b){function c(){if(g>=h)return d;if(z)return z=!1,e;var b=g;if(34===a.charCodeAt(b)){for(var f=b;f++<
-h;)if(34===a.charCodeAt(f)){if(34!==a.charCodeAt(f+1))break;++f}g=f+2;var m=a.charCodeAt(f+1);13===m?(z=!0,10===a.charCodeAt(f+2)&&++g):10===m&&(z=!0);return a.substring(b+1,f).replace(/""/g,'"')}for(;g<h;){m=a.charCodeAt(g++);f=1;if(10===m)z=!0;else if(13===m)z=!0,10===a.charCodeAt(g)&&(++g,++f);else if(m!==k)continue;return a.substring(b,g-f)}return a.substring(b)}for(var e={},d={},f=[],h=a.length,g=0,v=0,x,z;(x=c())!==d;){for(var y=[];x!==e&&x!==d;)y.push(x),x=c();b&&!(y=b(y,v++))||f.push(y)}return f};
-c.format=function(a){return a.map(e).join("\n")};return c}function Ya(a,b){if(Ld.hasOwnProperty(a.type))Ld[a.type](a,b)}function ac(a,b,c){var d=-1;c=a.length-c;var e;for(b.lineStart();++d<c;)e=a[d],b.point(e[0],e[1]);b.lineEnd()}function Md(a,b){var c=-1,d=a.length;for(b.polygonStart();++c<d;)ac(a[c],b,1);b.polygonEnd()}function Nd(a){return[Math.atan2(a[1],a[0]),Math.asin(Math.max(-1,Math.min(1,a[2])))]}function bc(a,b){return Math.abs(a[0]-b[0])<A&&Math.abs(a[1]-b[1])<A}function Za(a){var b=a[0];
-a=a[1];var c=Math.cos(a);return[c*Math.cos(b),c*Math.sin(b),Math.sin(a)]}function $a(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}function Od(a,b){return[a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]]}function cc(a,b){return[a[0]*b,a[1]*b,a[2]*b]}function Pd(a){function b(b){function d(c,e){c=a(c,e);b.point(c[0],c[1])}function k(){q=NaN;x.point=l;b.lineStart()}function l(d,h){var k=Za([d,h]),l=a(d,h);c(q,r,p,s,t,v,q=l[0],r=l[1],p=d,s=k[0],t=k[1],v=k[2],e,b);b.point(q,r)}function g(){x.point=
-d;b.lineEnd()}function n(){var a,d,h,n,D,B;k();x.point=function(b,c){l(a=b,c);d=q;h=r;n=s;D=t;B=v;x.point=l};x.lineEnd=function(){c(q,r,p,s,t,v,d,h,a,n,D,B,e,b);x.lineEnd=g;g()}}var p,q,r,s,t,v,x={point:d,lineStart:k,lineEnd:g,polygonStart:function(){b.polygonStart();x.lineStart=n},polygonEnd:function(){b.polygonEnd();x.lineStart=k}};return x}function c(b,e,k,l,g,n,p,q,r,s,t,v,x,z){var y=p-b,G=q-e,H=y*y+G*G;if(H>4*d&&x--){var D=l+s,B=g+t,E=n+v,wa=Math.sqrt(D*D+B*B+E*E),L=Math.asin(E/=wa),u=Math.abs(Math.abs(E)-
-1)<A?(k+r)/2:Math.atan2(B,D),fa=a(u,L),L=fa[0],fa=fa[1],w=L-b,C=fa-e,I=G*w-y*C;if(I*I/H>d||.3<Math.abs((y*w+G*C)/H-.5))c(b,e,k,l,g,n,L,fa,u,D/=wa,B/=wa,E,x,z),z.point(L,fa),c(L,fa,u,D,B,E,p,q,r,s,t,v,x,z)}}var d=.5,e=16;b.precision=function(a){if(!arguments.length)return Math.sqrt(d);e=0<(d=a*a)&&16;return b};return b}function Qd(a,b){function c(a,b){var c=Math.sqrt(f-2*e*Math.sin(b))/e;return[c*Math.sin(a*=e),h-c*Math.cos(a)]}var d=Math.sin(a),e=(d+Math.sin(b))/2,f=1+d*(2*e-d),h=Math.sqrt(f)/e;c.invert=
-function(a,b){var c=h-b;return[Math.atan2(a,c)/e,Math.asin((f-(a*a+c*c)*e*e)/(2*e))]};return c}function Rd(a){function b(a,b){a<d&&(d=a);a>f&&(f=a);b<e&&(e=b);b>h&&(h=b)}function c(){k.point=k.lineEnd=T}var d,e,f,h,k={point:b,lineStart:T,lineEnd:T,polygonStart:function(){k.lineEnd=c},polygonEnd:function(){k.point=b}};return function(b){h=f=-(d=e=Infinity);g.geo.stream(b,a(k));return[[d,e],[f,h]]}}function Sd(a,b){if(!N){++Y;a*=w;var c=Math.cos(b*=w);J+=(c*Math.cos(a)-J)/Y;K+=(c*Math.sin(a)-K)/Y;I+=
-(Math.sin(b)-I)/Y}}function Of(){var a,b;N=1;dc();N=2;var c=Z.point;Z.point=function(d,e){c(a=d,b=e)};Z.lineEnd=function(){Z.point(a,b);ec();Z.lineEnd=ec}}function dc(){function a(a,f){a*=w;var h=Math.cos(f*=w),k=h*Math.cos(a),h=h*Math.sin(a),l=Math.sin(f),g=Math.atan2(Math.sqrt((g=c*l-d*h)*g+(g=d*k-b*l)*g+(g=b*h-c*k)*g),b*k+c*h+d*l);Y+=g;J+=g*(b+(b=k));K+=g*(c+(c=h));I+=g*(d+(d=l))}var b,c,d;1<N||(1>N&&(N=1,Y=J=K=I=0),Z.point=function(e,f){e*=w;var h=Math.cos(f*=w);b=h*Math.cos(e);c=h*Math.sin(e);
-d=Math.sin(f);Z.point=a})}function ec(){Z.point=Sd}function fc(a,b){var c=Math.cos(a),d=Math.sin(a);return function(e,f,h,k){if(null!=e){if(e=Td(c,e),f=Td(c,f),0<h?e<f:e>f)e+=2*h*u}else e=a+2*h*u,f=a;for(var l,g=h*b;0<h?e>f:e<f;e-=g)k.point((l=Nd([c,-d*Math.cos(e),-d*Math.sin(e)]))[0],l[1])}}function Td(a,b){var c=Za(b);c[0]-=a;var d=Math.sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2]);c[0]/=d;c[1]/=d;c[2]/=d;d=Math.acos(Math.max(-1,Math.min(1,-c[1])));return((0>-c[2]?-d:d)+2*Math.PI-A)%(2*Math.PI)}function Ud(a,
-b,c){return function(d){function e(b,c){a(b,c)&&d.point(b,c)}function f(a,b){p.point(a,b)}function h(){q.point=f;p.lineStart()}function k(){q.point=e;p.lineEnd()}function l(a,b){z.point(a,b);y.push([a,b])}function m(){z.lineStart();y=[]}function n(){l(y[0][0],y[0][1]);z.lineEnd();var a=z.clean(),b=x.buffer(),c=b.length;if(c)if(y=null,a&1){a=b[0];s+=Vd(a,1);var c=a.length-1,b=-1,e;for(d.lineStart();++b<c;)d.point((e=a[b])[0],e[1]);d.lineEnd()}else 1<c&&a&2&&b.push(b.pop().concat(b.shift())),r.push(b.filter(Pf));
-else v=!0,t+=Vd(y,-1),y=null}var p=b(d),q={point:e,lineStart:h,lineEnd:k,polygonStart:function(){q.point=l;q.lineStart=m;q.lineEnd=n;v=!1;t=s=0;r=[];d.polygonStart()},polygonEnd:function(){q.point=e;q.lineStart=h;q.lineEnd=k;r=g.merge(r);if(r.length)Qf(r,c,d);else if(s<-A||v&&t<-A)d.lineStart(),c(null,null,1,d),d.lineEnd();d.polygonEnd();r=null},sphere:function(){d.polygonStart();d.lineStart();c(null,null,1,d);d.lineEnd();d.polygonEnd()}},r,s,t,v,x=Rf(),z=b(x),y;return q}}function Qf(a,b,c){var d=
-[],e=[];a.forEach(function(a){var b=a.length;if(!(1>=b)){var c=a[0],b=a[b-1];a={point:c,points:a,other:null,visited:!1,entry:!0,subject:!0};c={point:c,points:[c],other:a,visited:!1,entry:!1,subject:!1};a.other=c;d.push(a);e.push(c);a={point:b,points:[b],other:null,visited:!1,entry:!1,subject:!0};c={point:b,points:[b],other:a,visited:!1,entry:!0,subject:!1};a.other=c;d.push(a);e.push(c)}});e.sort(Sf);Wd(d);Wd(e);if(d.length){a=d[0];for(var f,h,k;;){for(f=a;f.visited;)if((f=f.next)===a)return;h=f.points;
-c.lineStart();do{f.visited=f.other.visited=!0;if(f.entry){if(f.subject)for(var l=0;l<h.length;l++)c.point((k=h[l])[0],k[1]);else b(f.point,f.next.point,1,c);f=f.next}else{if(f.subject)for(h=f.prev.points,l=h.length;0<=--l;)c.point((k=h[l])[0],k[1]);else b(f.point,f.prev.point,-1,c);f=f.prev}f=f.other;h=f.points}while(!f.visited);c.lineEnd()}}}function Wd(a){if(b=a.length){for(var b,c=0,d=a[0],e;++c<b;)d.next=e=a[c],e.prev=d,d=e;d.next=e=a[0];e.prev=d}}function Sf(a,b){return(0>(a=a.point)[0]?a[1]-
-u/2-A:u/2-a[1])-(0>(b=b.point)[0]?b[1]-u/2-A:u/2-b[1])}function Pf(a){return 1<a.length}function Rf(){var a=[],b;return{lineStart:function(){a.push(b=[])},point:function(a,d){b.push([a,d])},lineEnd:T,buffer:function(){var c=a;a=[];b=null;return c}}}function Vd(a,b){if(!(c=a.length))return 0;for(var c,d=0,e=0,f=a[0],h=f[0],k=f[1],l=Math.cos(k),g=Math.atan2(b*Math.sin(h)*l,Math.sin(k)),n=1-b*Math.cos(h)*l,p=g;++d<c;)f=a[d],l=Math.cos(k=f[1]),f=Math.atan2(b*Math.sin(h=f[0])*l,Math.sin(k)),h=1-b*Math.cos(h)*
-l,Math.abs(n-2)<A&&Math.abs(h-2)<A||(Math.abs(h)<A||Math.abs(n)<A||(Math.abs(Math.abs(f-g)-u)<A?2<h+n&&(e+=4*(f-g)):e=Math.abs(n-2)<A?e+4*(f-p):e+((3*u+f-g)%(2*u)-u)*(n+h)),p=g,g=f,n=h);return e}function Tf(a){function b(a,b){return Math.cos(a)*Math.cos(b)>d}function c(a,b){var c=Za(a,0),k=Za(b,0),l=[1,0,0],k=Od(c,k),g=$a(k,k),c=k[0],n=g-c*c;if(!n)return a;g=d*g/n;n=-d*c/n;c=Od(l,k);l=cc(l,g);k=cc(k,n);l[0]+=k[0];l[1]+=k[1];l[2]+=k[2];k=$a(l,c);g=$a(c,c);n=Math.sqrt(k*k-g*($a(l,l)-1));c=cc(c,(-k-
-n)/g);c[0]+=l[0];c[1]+=l[1];c[2]+=l[2];return Nd(c)}a*=w;var d=Math.cos(a);a=fc(a,6*w);return Ud(b,function(a){var d,h,k,l;return{lineStart:function(){k=h=!1;l=1},point:function(g,n){var p=[g,n],q,r=b(g,n);!d&&(k=h=r)&&a.lineStart();r!==h&&(q=c(d,p),bc(d,q)||bc(p,q))&&(p[0]+=A,p[1]+=A,r=b(p[0],p[1]));r!==h&&(l=0,(h=r)?(a.lineStart(),q=c(p,d),a.point(q[0],q[1])):(q=c(d,p),a.point(q[0],q[1]),a.lineEnd()),d=q);!r||d&&bc(d,p)||a.point(p[0],p[1]);d=p},lineEnd:function(){h&&a.lineEnd();d=null},clean:function(){return l|
-(k&&h)<<1}}},a)}function Xd(a,b){function c(c,e){return c=a(c,e),b(c[0],c[1])}a.invert&&b.invert&&(c.invert=function(c,e){return c=b.invert(c,e),c&&a.invert(c[0],c[1])});return c}function ab(a,b){return[a,b]}function Uf(a,b,c){var d=g.range(a,b-A,c).concat(b);return function(a){return d.map(function(b){return[a,b]})}}function Vf(a,b,c){var d=g.range(a,b-A,c).concat(b);return function(a){return d.map(function(b){return[b,a]})}}function Wf(a,b,c,d){function e(a){var b=Math.sin(a*=q)*r,c=Math.sin(q-
-a)*r;a=c*l+b*n;var d=c*g+b*p,b=c*h+b*k;return[Math.atan2(d,a)/w,Math.atan2(b,Math.sqrt(a*a+d*d))/w]}var f=Math.cos(b),h=Math.sin(b);b=Math.cos(d);var k=Math.sin(d),l=f*Math.cos(a),g=f*Math.sin(a),n=b*Math.cos(c),p=b*Math.sin(c),q=Math.acos(Math.max(-1,Math.min(1,h*k+f*b*Math.cos(c-a)))),r=1/Math.sin(q);e.distance=q;return e}function gc(a,b){return[a/(2*u),Math.max(-.5,Math.min(.5,Math.log(Math.tan(u/4+b/2))/(2*u)))]}function Yd(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+-2*a+"a"+a+","+a+" 0 1,1 0,"+
-2*a+"z"}function Xf(a){var b=Pd(function(b,d){return a([b*O,d*O])});return function(a){a=b(a);return{point:function(b,e){a.point(b*w,e*w)},sphere:function(){a.sphere()},lineStart:function(){a.lineStart()},lineEnd:function(){a.lineEnd()},polygonStart:function(){a.polygonStart()},polygonEnd:function(){a.polygonEnd()}}}}function Yf(){function a(a,b){h.push("M",a,",",b,f)}function b(a,b){h.push("M",a,",",b);k.point=c}function c(a,b){h.push("L",a,",",b)}function d(){k.point=a}function e(){h.push("Z")}
-var f=Yd(4.5),h=[],k={point:a,lineStart:function(){k.point=b},lineEnd:d,polygonStart:function(){k.lineEnd=e},polygonEnd:function(){k.lineEnd=d;k.point=a},pointRadius:function(a){f=Yd(a);return k},result:function(){if(h.length){var a=h.join("");h=[];return a}}};return k}function Zf(a){function b(b,c){a.moveTo(b,c);a.arc(b,c,h,0,2*u)}function c(b,c){a.moveTo(b,c);k.point=d}function d(b,c){a.lineTo(b,c)}function e(){k.point=b}function f(){a.closePath()}var h=4.5,k={point:b,lineStart:function(){k.point=
-c},lineEnd:e,polygonStart:function(){k.lineEnd=f},polygonEnd:function(){k.lineEnd=e;k.point=b},pointRadius:function(a){h=a;return k},result:T};return k}function $f(){function a(a,b){bb+=e*a-d*b;d=a;e=b}var b,c,d,e;ja.point=function(f,h){ja.point=a;b=d=f;c=e=h};ja.lineEnd=function(){a(b,c)}}function hc(a,b){N||(J+=a,K+=b,++I)}function Zd(){function a(a,e){var f=a-b,h=e-c,f=Math.sqrt(f*f+h*h);J+=f*(b+a)/2;K+=f*(c+e)/2;I+=f;b=a;c=e}var b,c;if(1!==N)if(1>N)N=1,J=K=I=0;else return;$.point=function(d,e){$.point=
-a;b=d;c=e}}function $d(){$.point=hc}function ag(){function a(a,b){var c=e*a-d*b;J+=c*(d+a);K+=c*(e+b);I+=3*c;d=a;e=b}var b,c,d,e;2>N&&(N=2,J=K=I=0);$.point=function(f,h){$.point=a;b=d=f;c=e=h};$.lineEnd=function(){a(b,c)}}function bg(){function a(a,b){a*=w;b=b*w/2+u/4;var c=a-d,g=Math.cos(b),n=Math.sin(b),p=f*n,q=cb,r=db,s=e*g+p*Math.cos(c),c=p*Math.sin(c);cb=q*s-r*c;db=r*s+q*c;d=a;e=g;f=n}var b,c,d,e,f;ka.point=function(h,k){ka.point=a;d=(b=h)*w;e=Math.cos(k=(c=k)*w/2+u/4);f=Math.sin(k)};ka.lineEnd=
-function(){a(b,c)}}function la(a){return ic(function(){return a})()}function ic(a){function b(a){a=h(a[0]*w,a[1]*w);return[a[0]*l+v,x-a[1]*l]}function c(a){return(a=h.invert((a[0]-v)/l,(x-a[1])/l))&&[a[0]*O,a[1]*O]}function d(){h=Xd(f=ae(r,s,t),e);var a=e(p,q);v=m-a[0]*l;x=n+a[1]*l;return b}var e,f,h,k=Pd(function(a,b){a=e(a,b);return[a[0]*l+v,x-a[1]*l]}),l=150,m=480,n=250,p=0,q=0,r=0,s=0,t=0,v,x,z=be,y=null;b.stream=function(a){return cg(f,z(k(a)))};b.clipAngle=function(a){if(!arguments.length)return y;
-z=null==a?(y=a,be):Tf(y=+a);return b};b.scale=function(a){if(!arguments.length)return l;l=+a;return d()};b.translate=function(a){if(!arguments.length)return[m,n];m=+a[0];n=+a[1];return d()};b.center=function(a){if(!arguments.length)return[p*O,q*O];p=a[0]%360*w;q=a[1]%360*w;return d()};b.rotate=function(a){if(!arguments.length)return[r*O,s*O,t*O];r=a[0]%360*w;s=a[1]%360*w;t=2<a.length?a[2]%360*w:0;return d()};g.rebind(b,k,"precision");return function(){e=a.apply(this,arguments);b.invert=e.invert&&
-c;return d()}}function cg(a,b){return{point:function(c,d){d=a(c*w,d*w);c=d[0];b.point(c>u?c-2*u:c<-u?c+2*u:c,d[1])},sphere:function(){b.sphere()},lineStart:function(){b.lineStart()},lineEnd:function(){b.lineEnd()},polygonStart:function(){b.polygonStart()},polygonEnd:function(){b.polygonEnd()}}}function ae(a,b,c){return a?b||c?Xd(ce(a),de(b,c)):ce(a):b||c?de(b,c):ab}function ee(a){return function(b,c){return b+=a,[b>u?b-2*u:b<-u?b+2*u:b,c]}}function ce(a){var b=ee(a);b.invert=ee(-a);return b}function de(a,
-b){function c(a,b){var c=Math.cos(b),g=Math.cos(a)*c,c=Math.sin(a)*c,p=Math.sin(b),q=p*d+g*e;return[Math.atan2(c*f-q*h,g*d-p*e),Math.asin(Math.max(-1,Math.min(1,q*f+c*h)))]}var d=Math.cos(a),e=Math.sin(a),f=Math.cos(b),h=Math.sin(b);c.invert=function(a,b){var c=Math.cos(b),g=Math.cos(a)*c,c=Math.sin(a)*c,p=Math.sin(b),q=p*f-c*h;return[Math.atan2(c*f+p*h,g*d+q*e),Math.asin(Math.max(-1,Math.min(1,q*d-g*e)))]};return c}function Fa(a,b){function c(b,c){var f=Math.cos(b),h=Math.cos(c),f=a(f*h);return[f*
-h*Math.sin(b),f*Math.sin(c)]}c.invert=function(a,c){var f=Math.sqrt(a*a+c*c),h=b(f),k=Math.sin(h),h=Math.cos(h);return[Math.atan2(a*k,f*h),Math.asin(f&&c*k/f)]};return c}function dg(a,b,c,d){var e,f,h;a=d[a];e=a[0];f=a[1];a=d[b];b=a[0];h=a[1];a=d[c];return 0<(a[1]-f)*(b-e)-(h-f)*(a[0]-e)}function jc(a,b,c){return(c[0]-b[0])*(a[1]-b[1])<(c[1]-b[1])*(a[0]-b[0])}function fe(a,b,c,d){var e=a[0],f=c[0],h=b[0]-e,k=d[0]-f;a=a[1];c=c[1];b=b[1]-a;d=d[1]-c;f=(k*(a-c)-d*(e-f))/(d*h-k*b);return[e+f*h,a+f*b]}
-function ge(a,b){var c=a.map(function(a,b){return{index:b,x:a[0],y:a[1]}}).sort(function(a,b){return a.y<b.y?-1:a.y>b.y?1:a.x<b.x?-1:a.x>b.x?1:0}),d=null,e={list:[],leftEnd:null,rightEnd:null,init:function(){e.leftEnd=e.createHalfEdge(null,"l");e.rightEnd=e.createHalfEdge(null,"l");e.leftEnd.r=e.rightEnd;e.rightEnd.l=e.leftEnd;e.list.unshift(e.leftEnd,e.rightEnd)},createHalfEdge:function(a,b){return{edge:a,side:b,vertex:null,l:null,r:null}},insert:function(a,b){b.l=a;b.r=a.r;a.r.l=b;a.r=b},leftBound:function(a){var b=
-e.leftEnd;do b=b.r;while(b!=e.rightEnd&&f.rightOf(b,a));return b=b.l},del:function(a){a.l.r=a.r;a.r.l=a.l;a.edge=null},right:function(a){return a.r},left:function(a){return a.l},leftRegion:function(a){return null==a.edge?d:a.edge.region[a.side]},rightRegion:function(a){return null==a.edge?d:a.edge.region[kc[a.side]]}},f={bisect:function(a,b){var c={region:{l:a,r:b},ep:{l:null,r:null}},d=b.x-a.x,e=b.y-a.y;c.c=a.x*d+a.y*e+.5*(d*d+e*e);(0<d?d:-d)>(0<e?e:-e)?(c.a=1,c.b=e/d,c.c/=d):(c.b=1,c.a=d/e,c.c/=
-e);return c},intersect:function(a,b){var c=a.edge,d=b.edge;if(!c||!d||c.region.r==d.region.r)return null;var e=c.a*d.b-c.b*d.a;if(1E-10>Math.abs(e))return null;var f=(c.c*d.b-d.c*c.b)/e,e=(d.c*c.a-c.c*d.a)/e,h=c.region.r,k=d.region.r;h.y<k.y||h.y==k.y&&h.x<k.x?h=a:(h=b,c=d);return(c=f>=c.region.r.x)&&"l"===h.side||!c&&"r"===h.side?null:{x:f,y:e}},rightOf:function(a,b){var c=a.edge,d=c.region.r,e=b.x>d.x;if(e&&"l"===a.side)return 1;if(!e&&"r"===a.side)return 0;if(1===c.a){var f=b.y-d.y,h=b.x-d.x,k=
-0,g=0;!e&&0>c.b||e&&0<=c.b?g=k=f>=c.b*h:(g=b.x+b.y*c.b>c.c,0>c.b&&(g=!g),g||(k=1));k||(d=d.x-c.region.l.x,g=c.b*(h*h-f*f)<d*f*(1+2*h/d+c.b*c.b),0>c.b&&(g=!g))}else h=c.c-c.a*b.x,c=b.y-h,f=b.x-d.x,d=h-d.y,g=c*c>f*f+d*d;return"l"===a.side?g:!g},endPoint:function(a,c,d){a.ep[c]=d;a.ep[kc[c]]&&b(a)},distance:function(a,b){var c=a.x-b.x,d=a.y-b.y;return Math.sqrt(c*c+d*d)}},h={list:[],insert:function(a,b,c){a.vertex=b;a.ystar=b.y+c;c=0;for(var d=h.list,e=d.length;c<e;c++){var f=d[c];if(!(a.ystar>f.ystar||
-a.ystar==f.ystar&&b.x>f.vertex.x))break}d.splice(c,0,a)},del:function(a){for(var b=0,c=h.list,d=c.length;b<d&&c[b]!=a;++b);c.splice(b,1)},empty:function(){return 0===h.list.length},nextEvent:function(a){for(var b=0,c=h.list,d=c.length;b<d;++b)if(c[b]==a)return c[b+1];return null},min:function(){var a=h.list[0];return{x:a.vertex.x,y:a.ystar}},extractMin:function(){return h.list.shift()}};e.init();for(var d=c.shift(),k=c.shift(),g,m,n,p,q,r,s,t,v;;)if(h.empty()||(g=h.min()),k&&(h.empty()||k.y<g.y||
-k.y==g.y&&k.x<g.x)){m=e.leftBound(k);n=e.right(m);s=e.rightRegion(m);v=f.bisect(s,k);r=e.createHalfEdge(v,"l");e.insert(m,r);if(t=f.intersect(m,r))h.del(m),h.insert(m,t,f.distance(t,k));m=r;r=e.createHalfEdge(v,"r");e.insert(m,r);(t=f.intersect(r,n))&&h.insert(r,t,f.distance(t,k));k=c.shift()}else if(h.empty())break;else{m=h.extractMin();p=e.left(m);n=e.right(m);q=e.right(n);s=e.leftRegion(m);r=e.rightRegion(n);t=m.vertex;f.endPoint(m.edge,m.side,t);f.endPoint(n.edge,n.side,t);e.del(m);h.del(n);e.del(n);
-m="l";s.y>r.y&&(m=s,s=r,r=m,m="r");v=f.bisect(s,r);r=e.createHalfEdge(v,m);e.insert(p,r);f.endPoint(v,kc[m],t);if(t=f.intersect(p,r))h.del(p),h.insert(p,t,f.distance(t,s));(t=f.intersect(r,q))&&h.insert(r,t,f.distance(t,s))}for(m=e.right(e.leftEnd);m!=e.rightEnd;m=e.right(m))b(m.edge)}function Ga(a,b,c,d,e,f){if(!a(b,c,d,e,f)){var h=.5*(c+e),k=.5*(d+f);b=b.nodes;b[0]&&Ga(a,b[0],c,d,h,k);b[1]&&Ga(a,b[1],h,d,e,k);b[2]&&Ga(a,b[2],c,k,h,f);b[3]&&Ga(a,b[3],h,k,e,f)}}function oa(){this._=new Date(1<arguments.length?
-Date.UTC.apply(this,arguments):arguments[0])}function eb(a,b,c,d){for(var e,f=0,h=b.length,k=c.length;f<h;){if(d>=k)return-1;e=b.charCodeAt(f++);if(37===e){if(e=eg[b.charAt(f++)],!e||0>(d=e(a,c,d)))return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function fb(a){return new RegExp("^(?:"+a.map(g.requote).join("|")+")","i")}function he(a){for(var b=new ba,c=-1,d=a.length;++c<d;)b.set(a[c].toLowerCase(),c);return b}function S(a,b,c){a+="";var d=a.length;return d<c?Array(c-d+1).join(b)+a:a}function ie(a,
-b,c){Q.lastIndex=0;return(b=Q.exec(b.substring(c,c+2)))?(a.d=+b[0],c+b[0].length):-1}function je(a,b,c){Q.lastIndex=0;return(b=Q.exec(b.substring(c,c+2)))?(a.H=+b[0],c+b[0].length):-1}function lc(a){return a.toISOString()}function pa(a,b,c){function d(b){var c=a(b),d=f(c,1);return b-c<d-b?c:d}function e(c){b(c=a(new R(c-1)),1);return c}function f(a,c){b(a=new R(+a),c);return a}function h(a,d,f){a=e(a);var h=[];if(1<f)for(;a<d;)c(a)%f||h.push(new Date(+a)),b(a,1);else for(;a<d;)h.push(new Date(+a)),
-b(a,1);return h}a.floor=a;a.round=d;a.ceil=e;a.offset=f;a.range=h;var k=a.utc=gb(a);k.floor=k;k.round=gb(d);k.ceil=gb(e);k.offset=gb(f);k.range=function(a,b,c){try{R=oa;var d=new oa;d._=a;return h(d,b,c)}finally{R=Date}};return a}function gb(a){return function(b,c){try{R=oa;var d=new oa;d._=b;return a(d,c)._}finally{R=Date}}}function mc(a,b,c){function d(b){return a(b)}d.invert=function(b){return nc(a.invert(b))};d.domain=function(b){if(!arguments.length)return a.domain().map(nc);a.domain(b);return d};
-d.nice=function(a){return d.domain(Ta(d.domain(),function(){return a}))};d.ticks=function(c,f){var h,k=d.domain();h=k[0];k=k[k.length-1];h=h<k?[h,k]:[k,h];if("function"!==typeof c){var k=(h[1]-h[0])/c,l=g.bisect(hb,k);if(l==hb.length)return b.year(h,c);if(!l)return a.ticks(c).map(nc);Math.log(k/hb[l-1])<Math.log(hb[l]/k)&&--l;c=b[l];f=c[1];c=c[0].range}return c(h[0],new Date(+h[1]+1),f)};d.tickFormat=function(){return c};d.copy=function(){return mc(a.copy(),b,c)};return g.rebind(d,a,"range","rangeRound",
-"interpolate","clamp")}function nc(a){return new Date(a)}function ke(a){return function(b){for(var c=a.length-1,d=a[c];!d[1](b);)d=a[--c];return d[0](b)}}function oc(a){var b=new Date(a,0,1);b.setFullYear(a);return b}function fg(a){var b=a.getFullYear(),c=oc(b),d=oc(b+1);return b+(a-c)/(d-c)}function pc(a){var b=new Date(Date.UTC(a,0,1));b.setUTCFullYear(a);return b}function gg(a){var b=a.getUTCFullYear(),c=pc(b),d=pc(b+1);return b+(a-c)/(d-c)}var u=Math.PI,A=1E-6,g={version:"3.0.6"},w=u/180,O=180/
-u,W=document,P=window,ib=[3,3];Date.now||(Date.now=function(){return+new Date});try{W.createElement("div").style.setProperty("opacity",0,"")}catch(Ng){var le=P.CSSStyleDeclaration.prototype,hg=le.setProperty;le.setProperty=function(a,b,c){hg.call(this,a,b+"",c)}}var ha=function(a){return Array.prototype.slice.call(a)};try{ha(W.documentElement.childNodes)[0].nodeType}catch(Og){ha=Je}var Hb=[].__proto__?function(a,b){a.__proto__=b}:function(a,b){for(var c in b)a[c]=b[c]};g.map=function(a){var b=new ba,
-c;for(c in a)b.set(c,a[c]);return b};(function(a,b){try{for(var c in b)Object.defineProperty(a.prototype,c,{value:b[c],enumerable:!1})}catch(d){a.prototype=b}})(ba,{has:function(a){return Ha+a in this},get:function(a){return this[Ha+a]},set:function(a,b){return this[Ha+a]=b},remove:function(a){a=Ha+a;return a in this&&delete this[a]},keys:function(){var a=[];this.forEach(function(b){a.push(b)});return a},values:function(){var a=[];this.forEach(function(b,c){a.push(c)});return a},entries:function(){var a=
-[];this.forEach(function(b,c){a.push({key:b,value:c})});return a},forEach:function(a){for(var b in this)b.charCodeAt(0)===ig&&a.call(this,b.substring(1),this[b])}});var Ha="\x00",ig=Ha.charCodeAt(0);g.functor=F;g.rebind=function(a,b){for(var c=1,d=arguments.length,e;++c<d;)a[e=arguments[c]]=Ke(a,b,b[e]);return a};g.ascending=function(a,b){return a<b?-1:a>b?1:a>=b?0:NaN};g.descending=function(a,b){return b<a?-1:b>a?1:b>=a?0:NaN};g.mean=function(a,b){var c=a.length,d,e=0,f=-1,h=0;if(1===arguments.length)for(;++f<
-c;)tb(d=a[f])&&(e+=(d-e)/++h);else for(;++f<c;)tb(d=b.call(a,a[f],f))&&(e+=(d-e)/++h);return h?e:void 0};g.median=function(a,b){1<arguments.length&&(a=a.map(b));a=a.filter(tb);return a.length?g.quantile(a.sort(g.ascending),.5):void 0};g.min=function(a,b){var c=-1,d=a.length,e,f;if(1===arguments.length){for(;++c<d&&(null==(e=a[c])||e!=e);)e=void 0;for(;++c<d;)null!=(f=a[c])&&e>f&&(e=f)}else{for(;++c<d&&(null==(e=b.call(a,a[c],c))||e!=e);)e=void 0;for(;++c<d;)null!=(f=b.call(a,a[c],c))&&e>f&&(e=f)}return e};
-g.max=function(a,b){var c=-1,d=a.length,e,f;if(1===arguments.length){for(;++c<d&&(null==(e=a[c])||e!=e);)e=void 0;for(;++c<d;)null!=(f=a[c])&&f>e&&(e=f)}else{for(;++c<d&&(null==(e=b.call(a,a[c],c))||e!=e);)e=void 0;for(;++c<d;)null!=(f=b.call(a,a[c],c))&&f>e&&(e=f)}return e};g.extent=function(a,b){var c=-1,d=a.length,e,f,h;if(1===arguments.length){for(;++c<d&&(null==(e=h=a[c])||e!=e);)e=h=void 0;for(;++c<d;)null!=(f=a[c])&&(e>f&&(e=f),h<f&&(h=f))}else{for(;++c<d&&(null==(e=h=b.call(a,a[c],c))||e!=
-e);)e=void 0;for(;++c<d;)null!=(f=b.call(a,a[c],c))&&(e>f&&(e=f),h<f&&(h=f))}return[e,h]};g.random={normal:function(a,b){var c=arguments.length;2>c&&(b=1);1>c&&(a=0);return function(){var c,e;do c=2*Math.random()-1,e=2*Math.random()-1,e=c*c+e*e;while(!e||1<e);return a+b*c*Math.sqrt(-2*Math.log(e)/e)}},logNormal:function(){var a=g.random.normal.apply(g,arguments);return function(){return Math.exp(a())}},irwinHall:function(a){return function(){for(var b=0,c=0;c<a;c++)b+=Math.random();return b/a}}};
-g.sum=function(a,b){var c=0,d=a.length,e,f=-1;if(1===arguments.length)for(;++f<d;)isNaN(e=+a[f])||(c+=e);else for(;++f<d;)isNaN(e=+b.call(a,a[f],f))||(c+=e);return c};g.quantile=function(a,b){var c=(a.length-1)*b+1,d=Math.floor(c),e=+a[d-1];return(c-=d)?e+c*(a[d]-e):e};g.shuffle=function(a){for(var b=a.length,c,d;b;)d=Math.random()*b--|0,c=a[b],a[b]=a[d],a[d]=c;return a};g.transpose=function(a){return g.zip.apply(g,a)};g.zip=function(){if(!(e=arguments.length))return[];for(var a=-1,b=g.min(arguments,
-Le),c=Array(b);++a<b;)for(var d=-1,e,f=c[a]=Array(e);++d<e;)f[d]=arguments[d][a];return c};g.bisector=function(a){return{left:function(b,c,d,e){3>arguments.length&&(d=0);4>arguments.length&&(e=b.length);for(;d<e;){var f=d+e>>>1;a.call(b,b[f],f)<c?d=f+1:e=f}return d},right:function(b,c,d,e){3>arguments.length&&(d=0);4>arguments.length&&(e=b.length);for(;d<e;){var f=d+e>>>1;c<a.call(b,b[f],f)?e=f:d=f+1}return d}}};var me=g.bisector(function(a){return a});g.bisectLeft=me.left;g.bisect=g.bisectRight=
-me.right;g.nest=function(){function a(b,e){if(e>=d.length)return h?h.call(c,b):f?b.sort(f):b;for(var g=-1,n=b.length,p=d[e++],q,r,s=new ba,t,v={};++g<n;)(t=s.get(q=p(r=b[g])))?t.push(r):s.set(q,[r]);s.forEach(function(b,c){v[b]=a(c,e)});return v}function b(a,c){if(c>=d.length)return a;var f=[],h=e[c++],g;for(g in a)f.push({key:g,values:b(a[g],c)});h&&f.sort(function(a,b){return h(a.key,b.key)});return f}var c={},d=[],e=[],f,h;c.map=function(b){return a(b,0)};c.entries=function(c){return b(a(c,0),
-0)};c.key=function(a){d.push(a);return c};c.sortKeys=function(a){e[d.length-1]=a;return c};c.sortValues=function(a){f=a;return c};c.rollup=function(a){h=a;return c};return c};g.keys=function(a){var b=[],c;for(c in a)b.push(c);return b};g.values=function(a){var b=[],c;for(c in a)b.push(a[c]);return b};g.entries=function(a){var b=[],c;for(c in a)b.push({key:c,value:a[c]});return b};g.permute=function(a,b){for(var c=[],d=-1,e=b.length;++d<e;)c[d]=a[b[d]];return c};g.merge=function(a){return Array.prototype.concat.apply([],
-a)};g.range=function(a,b,c){3>arguments.length&&(c=1,2>arguments.length&&(b=a,a=0));if(Infinity===(b-a)/c)throw Error("infinite range");var d=[],e;e=Math.abs(c);for(var f=1;e*f%1;)f*=10;e=f;var f=-1,h;a*=e;b*=e;c*=e;if(0>c)for(;(h=a+c*++f)>b;)d.push(h/e);else for(;(h=a+c*++f)<b;)d.push(h/e);return d};g.requote=function(a){return a.replace(jg,"\\$&")};var jg=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;g.round=function(a,b){return b?Math.round(a*(b=Math.pow(10,b)))/b:Math.round(a)};g.xhr=function(a,b,c){function d(){var a=
-l.status;!a&&l.responseText||200<=a&&300>a||304===a?f.load.call(e,k.call(e,l)):f.error.call(e,l)}var e={},f=g.dispatch("progress","load","error"),h={},k=V,l=new (P.XDomainRequest&&/^(http(s)?:)?\/\//.test(a)?XDomainRequest:XMLHttpRequest);"onload"in l?l.onload=l.onerror=d:l.onreadystatechange=function(){3<l.readyState&&d()};l.onprogress=function(a){var b=g.event;g.event=a;try{f.progress.call(e,l)}finally{g.event=b}};e.header=function(a,b){a=(a+"").toLowerCase();if(2>arguments.length)return h[a];null==
-b?delete h[a]:h[a]=b+"";return e};e.mimeType=function(a){if(!arguments.length)return b;b=null==a?null:a+"";return e};e.response=function(a){k=a;return e};["get","post"].forEach(function(a){e[a]=function(){return e.send.apply(e,[a].concat(ha(arguments)))}});e.send=function(c,d,f){2===arguments.length&&"function"===typeof d&&(f=d,d=null);l.open(c,a,!0);null==b||"accept"in h||(h.accept=b+",*/*");if(l.setRequestHeader)for(var k in h)l.setRequestHeader(k,h[k]);null!=b&&l.overrideMimeType&&l.overrideMimeType(b);
-if(null!=f)e.on("error",f).on("load",function(a){f(null,a)});l.send(null==d?null:d);return e};e.abort=function(){l.abort();return e};g.rebind(e,f,"on");2===arguments.length&&"function"===typeof b&&(c=b,b=null);return null==c?e:e.get(Me(c))};g.text=function(){return g.xhr.apply(g,arguments).response(Ne)};g.json=function(a,b){return g.xhr(a,"application/json",b).response(Oe)};g.html=function(a,b){return g.xhr(a,"text/html",b).response(Pe)};g.xml=function(){return g.xhr.apply(g,arguments).response(Qe)};
-var qc={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};g.ns={prefix:qc,qualify:function(a){var b=a.indexOf(":"),c=a;0<=b&&(c=a.substring(0,b),a=a.substring(b+1));return qc.hasOwnProperty(c)?{space:qc[c],local:a}:a}};g.dispatch=function(){for(var a=new ub,b=-1,c=arguments.length;++b<c;)a[arguments[b]]=zc(a);return a};ub.prototype.on=function(a,b){var c=a.indexOf("."),
-d="";0<c&&(d=a.substring(c+1),a=a.substring(0,c));return 2>arguments.length?this[a].on(d):this[a].on(d,b)};g.format=function(a){a=kg.exec(a);var b=a[1]||" ",c=a[2]||">",d=a[3]||"",e=a[4]||"",f=a[5],h=+a[6],k=a[7],l=a[8],m=a[9],n=1,p="",q=!1;l&&(l=+l.substring(1));if(f||"0"===b&&"="===c)f=b="0",c="=",k&&(h-=Math.floor((h-1)/4));switch(m){case "n":k=!0;m="g";break;case "%":n=100;p="%";m="f";break;case "p":n=100;p="%";m="r";break;case "b":case "o":case "x":case "X":e&&(e="0"+m.toLowerCase());case "c":case "d":q=
-!0;l=0;break;case "s":n=-1,m="r"}"#"===e&&(e="");"r"!=m||l||(m="g");var m=lg.get(m)||Re,r=f&&k;return function(a){if(q&&a%1)return"";var t=0>a||0===a&&0>1/a?(a=-a,"-"):d;if(0>n){var v=g.formatPrefix(a,l);a=v.scale(a);p=v.symbol}else a*=n;a=m(a,l);!f&&k&&(a=rc(a));var v=e.length+a.length+(r?0:t.length),x=v<h?Array(v=h-v+1).join(b):"";r&&(a=rc(x+a));a.replace(".",".");t+=e;return("<"===c?t+a+x:">"===c?x+t+a:"^"===c?x.substring(0,v>>=1)+t+a+x.substring(v):t+(r?a:x+a))+p}};var kg=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,
-lg=g.map({b:function(a){return a.toString(2)},c:function(a){return String.fromCharCode(a)},o:function(a){return a.toString(8)},x:function(a){return a.toString(16)},X:function(a){return a.toString(16).toUpperCase()},g:function(a,b){return a.toPrecision(b)},e:function(a,b){return a.toExponential(b)},f:function(a,b){return a.toFixed(b)},r:function(a,b){return(a=g.round(a,vb(a,b))).toFixed(Math.max(0,Math.min(20,vb(a*(1+1E-15),b))))}}),rc=V;if(ib)var mg=ib.length,rc=function(a){for(var b=a.lastIndexOf("."),
-c=0<=b?"."+a.substring(b+1):(b=a.length,""),d=[],e=0,f=ib[0];0<b&&0<f;)d.push(a.substring(b-=f,b+f)),f=ib[e=(e+1)%mg];return d.reverse().join(",")+c};var ng="y z a f p n \u00b5 m k M G T P E Z Y".split(" ").map(function(a,b){var c=Math.pow(10,3*Math.abs(8-b));return{scale:8<b?function(a){return a/c}:function(a){return a*c},symbol:a}});g.formatPrefix=function(a,b){var c=0;a&&(0>a&&(a*=-1),b&&(a=g.round(a,vb(a,b))),c=1+Math.floor(1E-12+Math.log(a)/Math.LN10),c=Math.max(-24,Math.min(24,3*Math.floor((0>=
-c?c+1:c-1)/3))));return ng[8+c/3]};var ne=function(){return V},og=g.map({linear:ne,poly:function(a){return function(b){return Math.pow(b,a)}},quad:function(){return Te},cubic:function(){return Ue},sin:function(){return Ve},exp:function(){return We},circle:function(){return Xe},elastic:function(a,b){var c;2>arguments.length&&(b=.45);arguments.length?c=b/(2*u)*Math.asin(1/a):(a=1,c=b/4);return function(d){return 1+a*Math.pow(2,10*-d)*Math.sin(2*(d-c)*u/b)}},back:function(a){a||(a=1.70158);return function(b){return b*
-b*((a+1)*b-a)}},bounce:function(){return Ye}}),pg=g.map({"in":V,out:Ac,"in-out":Bc,"out-in":function(a){return Bc(Ac(a))}});g.ease=function(a){var b=a.indexOf("-"),c=0<=b?a.substring(0,b):a,b=0<=b?a.substring(b+1):"in",c=og.get(c)||ne,b=pg.get(b)||V;return Se(b(c.apply(null,Array.prototype.slice.call(arguments,1))))};g.event=null;g.transform=function(a){var b=W.createElementNS(g.ns.prefix.svg,"g");return(g.transform=function(a){b.setAttribute("transform",a);a=b.transform.baseVal.consolidate();return new Dc(a?
-a.matrix:qg)})(a)};Dc.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var qg={a:1,b:0,c:0,d:1,e:0,f:0};g.interpolate=function(a,b){for(var c=g.interpolators.length,d;0<=--c&&!(d=g.interpolators[c](a,b)););return d};g.interpolateNumber=function(a,b){b-=a;return function(c){return a+b*c}};g.interpolateRound=function(a,b){b-=a;return function(c){return Math.round(a+b*c)}};g.interpolateString=function(a,b){var c,d,e=
-0,f=[],h=[],k,l;for(d=jb.lastIndex=0;c=jb.exec(b);++d)c.index&&f.push(b.substring(e,c.index)),h.push({i:f.length,x:c[0]}),f.push(null),e=jb.lastIndex;e<b.length&&f.push(b.substring(e));d=0;for(k=h.length;(c=jb.exec(a))&&d<k;++d)if(l=h[d],l.x==c[0]){if(l.i)if(null==f[l.i+1])for(f[l.i-1]+=l.x,f.splice(l.i,1),c=d+1;c<k;++c)h[c].i--;else for(f[l.i-1]+=l.x+f[l.i+1],f.splice(l.i,2),c=d+1;c<k;++c)h[c].i-=2;else if(null==f[l.i+1])f[l.i]=l.x;else for(f[l.i]=l.x+f[l.i+1],f.splice(l.i+1,1),c=d+1;c<k;++c)h[c].i--;
-h.splice(d,1);k--;d--}else l.x=g.interpolateNumber(parseFloat(c[0]),parseFloat(l.x));for(;d<k;)l=h.pop(),null==f[l.i+1]?f[l.i]=l.x:(f[l.i]=l.x+f[l.i+1],f.splice(l.i+1,1)),k--;return 1===f.length?null==f[0]?h[0].x:function(){return b}:function(a){for(d=0;d<k;++d)f[(l=h[d]).i]=l.x(a);return f.join("")}};g.interpolateTransform=function(a,b){var c=[],d=[],e,f=g.transform(a),h=g.transform(b),k=f.translate,l=h.translate,m=f.rotate,n=h.rotate,p=f.skew,q=h.skew,f=f.scale,h=h.scale;k[0]!=l[0]||k[1]!=l[1]?
-(c.push("translate(",null,",",null,")"),d.push({i:1,x:g.interpolateNumber(k[0],l[0])},{i:3,x:g.interpolateNumber(k[1],l[1])})):l[0]||l[1]?c.push("translate("+l+")"):c.push("");m!=n?(180<m-n?n+=360:180<n-m&&(m+=360),d.push({i:c.push(c.pop()+"rotate(",null,")")-2,x:g.interpolateNumber(m,n)})):n&&c.push(c.pop()+"rotate("+n+")");p!=q?d.push({i:c.push(c.pop()+"skewX(",null,")")-2,x:g.interpolateNumber(p,q)}):q&&c.push(c.pop()+"skewX("+q+")");f[0]!=h[0]||f[1]!=h[1]?(e=c.push(c.pop()+"scale(",null,",",null,
-")"),d.push({i:e-4,x:g.interpolateNumber(f[0],h[0])},{i:e-2,x:g.interpolateNumber(f[1],h[1])})):1==h[0]&&1==h[1]||c.push(c.pop()+"scale("+h+")");e=d.length;return function(a){for(var b=-1,f;++b<e;)c[(f=d[b]).i]=f.x(a);return c.join("")}};g.interpolateRgb=function(a,b){a=g.rgb(a);b=g.rgb(b);var c=a.r,d=a.g,e=a.b,f=b.r-c,h=b.g-d,k=b.b-e;return function(a){return"#"+ra(Math.round(c+f*a))+ra(Math.round(d+h*a))+ra(Math.round(e+k*a))}};g.interpolateHsl=function(a,b){a=g.hsl(a);b=g.hsl(b);var c=a.h,d=a.s,
-e=a.l,f=b.h-c,h=b.s-d,k=b.l-e;180<f?f-=360:-180>f&&(f+=360);return function(a){return La(c+f*a,d+h*a,e+k*a)+""}};g.interpolateLab=function(a,b){a=g.lab(a);b=g.lab(b);var c=a.l,d=a.a,e=a.b,f=b.l-c,h=b.a-d,k=b.b-e;return function(a){return Kc(c+f*a,d+h*a,e+k*a)+""}};g.interpolateHcl=function(a,b){a=g.hcl(a);b=g.hcl(b);var c=a.h,d=a.c,e=a.l,f=b.h-c,h=b.c-d,k=b.l-e;180<f?f-=360:-180>f&&(f+=360);return function(a){return Eb(c+f*a,d+h*a,e+k*a)+""}};g.interpolateArray=function(a,b){var c=[],d=[],e=a.length,
-f=b.length,h=Math.min(a.length,b.length),k;for(k=0;k<h;++k)c.push(g.interpolate(a[k],b[k]));for(;k<e;++k)d[k]=a[k];for(;k<f;++k)d[k]=b[k];return function(a){for(k=0;k<h;++k)d[k]=c[k](a);return d}};g.interpolateObject=function(a,b){var c={},d={},e;for(e in a)e in b?c[e]=xb(e)(a[e],b[e]):d[e]=a[e];for(e in b)e in a||(d[e]=b[e]);return function(a){for(e in c)d[e]=c[e](a);return d}};var jb=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;g.interpolators=[g.interpolateObject,function(a,b){return b instanceof
-Array&&g.interpolateArray(a,b)},function(a,b){return("string"===typeof a||"string"===typeof b)&&g.interpolateString(a+"",b+"")},function(a,b){return("string"===typeof b?Ka.has(b)||/^(#|rgb\(|hsl\()/.test(b):b instanceof qa)&&g.interpolateRgb(a,b)},function(a,b){return!isNaN(a=+a)&&!isNaN(b=+b)&&g.interpolateNumber(a,b)}];qa.prototype.toString=function(){return this.rgb()+""};g.rgb=function(a,b,c){return 1===arguments.length?a instanceof yb?ca(a.r,a.g,a.b):zb(""+a,ca,La):ca(~~a,~~b,~~c)};var kb=yb.prototype=
-new qa;kb.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);var b=this.r,c=this.g,d=this.b;if(!b&&!c&&!d)return ca(30,30,30);b&&30>b&&(b=30);c&&30>c&&(c=30);d&&30>d&&(d=30);return ca(Math.min(255,Math.floor(b/a)),Math.min(255,Math.floor(c/a)),Math.min(255,Math.floor(d/a)))};kb.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return ca(Math.floor(a*this.r),Math.floor(a*this.g),Math.floor(a*this.b))};kb.hsl=function(){return Fc(this.r,this.g,this.b)};kb.toString=function(){return"#"+ra(this.r)+
-ra(this.g)+ra(this.b)};var Ka=g.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",
-darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",
-gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",
-lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",
-mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",
-seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});Ka.forEach(function(a,b){Ka.set(a,zb(b,ca,La))});g.hsl=function(a,b,c){return 1===arguments.length?
-a instanceof Db?sa(a.h,a.s,a.l):zb(""+a,Fc,sa):sa(+a,+b,+c)};var sc=Db.prototype=new qa;sc.brighter=function(a){a=Math.pow(.7,arguments.length?a:1);return sa(this.h,this.s,this.l/a)};sc.darker=function(a){a=Math.pow(.7,arguments.length?a:1);return sa(this.h,this.s,a*this.l)};sc.rgb=function(){return La(this.h,this.s,this.l)};g.hcl=function(a,b,c){return 1===arguments.length?a instanceof Ma?Aa(a.h,a.c,a.l):a instanceof Na?Lc(a.l,a.a,a.b):Lc((a=Gc((a=g.rgb(a)).r,a.g,a.b)).l,a.a,a.b):Aa(+a,+b,+c)};var tc=
-Ma.prototype=new qa;tc.brighter=function(a){return Aa(this.h,this.c,Math.min(100,this.l+lb*(arguments.length?a:1)))};tc.darker=function(a){return Aa(this.h,this.c,Math.max(0,this.l-lb*(arguments.length?a:1)))};tc.rgb=function(){return Eb(this.h,this.c,this.l).rgb()};g.lab=function(a,b,c){return 1===arguments.length?a instanceof Na?ta(a.l,a.a,a.b):a instanceof Ma?Eb(a.l,a.c,a.h):Gc((a=g.rgb(a)).r,a.g,a.b):ta(+a,+b,+c)};var lb=18,Hc=.95047,Ic=1,Jc=1.08883,uc=Na.prototype=new qa;uc.brighter=function(a){return ta(Math.min(100,
-this.l+lb*(arguments.length?a:1)),this.a,this.b)};uc.darker=function(a){return ta(Math.max(0,this.l-lb*(arguments.length?a:1)),this.a,this.b)};uc.rgb=function(){return Kc(this.l,this.a,this.b)};var Oa=function(a,b){return b.querySelector(a)},Oc=function(a,b){return b.querySelectorAll(a)},xa=W.documentElement,rg=xa.matchesSelector||xa.webkitMatchesSelector||xa.mozMatchesSelector||xa.msMatchesSelector||xa.oMatchesSelector,Vc=function(a,b){return rg.call(a,b)};"function"===typeof Sizzle&&(Oa=function(a,
-b){return Sizzle(a,b)[0]||null},Oc=function(a,b){return Sizzle.uniqueSort(Sizzle(a,b))},Vc=Sizzle.matchesSelector);var C=[];g.selection=function(){return Ia};g.selection.prototype=C;C.select=function(a){var b=[],c,d,e,f;"function"!==typeof a&&(a=Mc(a));for(var h=-1,k=this.length;++h<k;){b.push(c=[]);c.parentNode=(e=this[h]).parentNode;for(var g=-1,m=e.length;++g<m;)(f=e[g])?(c.push(d=a.call(f,f.__data__,g)),d&&"__data__"in f&&(d.__data__=f.__data__)):c.push(null)}return da(b)};C.selectAll=function(a){var b=
-[],c,d;"function"!==typeof a&&(a=Nc(a));for(var e=-1,f=this.length;++e<f;)for(var h=this[e],k=-1,g=h.length;++k<g;)if(d=h[k])b.push(c=ha(a.call(d,d.__data__,k))),c.parentNode=d;return da(b)};C.attr=function(a,b){if(2>arguments.length){if("string"===typeof a){var c=this.node();a=g.ns.qualify(a);return a.local?c.getAttributeNS(a.space,a.local):c.getAttribute(a)}for(b in a)this.each(Pc(b,a[b]));return this}return this.each(Pc(a,b))};C.classed=function(a,b){if(2>arguments.length){if("string"===typeof a){var c=
-this.node(),d=(a=a.trim().split(/^|\s+/g)).length,e=-1;if(b=c.classList)for(;++e<d;){if(!b.contains(a[e]))return!1}else for(b=c.className,null!=b.baseVal&&(b=b.baseVal);++e<d;)if(!Qc(a[e]).test(b))return!1;return!0}for(b in a)this.each(Rc(b,a[b]));return this}return this.each(Rc(a,b))};C.style=function(a,b,c){var d=arguments.length;if(3>d){if("string"!==typeof a){2>d&&(b="");for(c in a)this.each(Sc(c,a[c],b));return this}if(2>d)return P.getComputedStyle(this.node(),null).getPropertyValue(a);c=""}return this.each(Sc(a,
-b,c))};C.property=function(a,b){if(2>arguments.length){if("string"===typeof a)return this.node()[a];for(b in a)this.each(Tc(b,a[b]));return this}return this.each(Tc(a,b))};C.text=function(a){return arguments.length?this.each("function"===typeof a?function(){var b=a.apply(this,arguments);this.textContent=null==b?"":b}:null==a?function(){this.textContent=""}:function(){this.textContent=a}):this.node().textContent};C.html=function(a){return arguments.length?this.each("function"===typeof a?function(){var b=
-a.apply(this,arguments);this.innerHTML=null==b?"":b}:null==a?function(){this.innerHTML=""}:function(){this.innerHTML=a}):this.node().innerHTML};C.append=function(a){function b(){return this.appendChild(W.createElementNS(this.namespaceURI,a))}function c(){return this.appendChild(W.createElementNS(a.space,a.local))}a=g.ns.qualify(a);return this.select(a.local?c:b)};C.insert=function(a,b){function c(){return this.insertBefore(W.createElementNS(this.namespaceURI,a),Oa(b,this))}function d(){return this.insertBefore(W.createElementNS(a.space,
-a.local),Oa(b,this))}a=g.ns.qualify(a);return this.select(a.local?d:c)};C.remove=function(){return this.each(function(){var a=this.parentNode;a&&a.removeChild(this)})};C.data=function(a,b){function c(a,c){var d,e=a.length,f=c.length,h=Math.min(e,f),v=Array(f),x=Array(f),z=Array(e),y,G;if(b){var h=new ba,H=new ba,D=[],B;for(d=-1;++d<e;)B=b.call(y=a[d],y.__data__,d),h.has(B)?z[d]=y:h.set(B,y),D.push(B);for(d=-1;++d<f;)B=b.call(c,G=c[d],d),(y=h.get(B))?(v[d]=y,y.__data__=G):H.has(B)||(x[d]={__data__:G}),
-H.set(B,G),h.remove(B);for(d=-1;++d<e;)h.has(D[d])&&(z[d]=a[d])}else{for(d=-1;++d<h;)y=a[d],G=c[d],y?(y.__data__=G,v[d]=y):x[d]={__data__:G};for(;d<f;++d)x[d]={__data__:c[d]};for(;d<e;++d)z[d]=a[d]}x.update=v;x.parentNode=v.parentNode=z.parentNode=a.parentNode;k.push(x);g.push(v);m.push(z)}var d=-1,e=this.length,f,h;if(!arguments.length){for(a=Array(e=(f=this[0]).length);++d<e;)if(h=f[d])a[d]=h.__data__;return a}var k=Xc([]),g=da([]),m=da([]);if("function"===typeof a)for(;++d<e;)c(f=this[d],a.call(f,
-f.parentNode.__data__,d));else for(;++d<e;)c(f=this[d],a);g.enter=function(){return k};g.exit=function(){return m};return g};C.datum=function(a){return arguments.length?this.property("__data__",a):this.property("__data__")};C.filter=function(a){var b=[],c,d,e;"function"!==typeof a&&(a=Uc(a));for(var f=0,h=this.length;f<h;f++){b.push(c=[]);c.parentNode=(d=this[f]).parentNode;for(var k=0,g=d.length;k<g;k++)(e=d[k])&&a.call(e,e.__data__,k)&&c.push(e)}return da(b)};C.order=function(){for(var a=-1,b=this.length;++a<
-b;)for(var c=this[a],d=c.length-1,e=c[d],f;0<=--d;)if(f=c[d])e&&e!==f.nextSibling&&e.parentNode.insertBefore(f,e),e=f;return this};C.sort=function(a){a=bf.apply(this,arguments);for(var b=-1,c=this.length;++b<c;)this[b].sort(a);return this.order()};C.on=function(a,b,c){var d=arguments.length;if(3>d){if("string"!==typeof a){2>d&&(b=!1);for(c in a)this.each(Wc(c,a[c],b));return this}if(2>d)return(d=this.node()["__on"+a])&&d._;c=!1}return this.each(Wc(a,b,c))};C.each=function(a){return ia(this,function(b,
-c,d){a.call(b,b.__data__,c,d)})};C.call=function(a){var b=ha(arguments);a.apply(b[0]=this,b);return this};C.empty=function(){return!this.node()};C.node=function(){for(var a=0,b=this.length;a<b;a++)for(var c=this[a],d=0,e=c.length;d<e;d++){var f=c[d];if(f)return f}return null};C.transition=function(){var a=Ja||++oe,b=[],c,d,e=Object.create(mb);e.time=Date.now();for(var f=-1,h=this.length;++f<h;){b.push(c=[]);for(var k=this[f],g=-1,m=k.length;++g<m;)(d=k[g])&&Pa(d,g,a,e),c.push(d)}return Ba(b,a)};var Ia=
-da([[W]]);Ia[0].parentNode=xa;g.select=function(a){return"string"===typeof a?Ia.select(a):da([[a]])};g.selectAll=function(a){return"string"===typeof a?Ia.selectAll(a):da([ha(a)])};var ma=[];g.selection.enter=Xc;g.selection.enter.prototype=ma;ma.append=C.append;ma.insert=C.insert;ma.empty=C.empty;ma.node=C.node;ma.select=function(a){for(var b=[],c,d,e,f,h,k=-1,g=this.length;++k<g;){e=(f=this[k]).update;b.push(c=[]);c.parentNode=f.parentNode;for(var m=-1,n=f.length;++m<n;)(h=f[m])?(c.push(e[m]=d=a.call(f.parentNode,
-h.__data__,m)),d.__data__=h.__data__):c.push(null)}return da(b)};var M=[],oe=0,Ja,mb={ease:function(a){if(0>=a)return 0;if(1<=a)return 1;var b=a*a,c=b*a;return 4*(.5>a?c:3*(a-b)+c-.75)},delay:0,duration:250};M.call=C.call;M.empty=C.empty;M.node=C.node;g.transition=function(a){return arguments.length?Ja?a.transition():a:Ia.transition()};g.transition.prototype=M;M.select=function(a){var b=this.id,c=[],d,e,f;"function"!==typeof a&&(a=Mc(a));for(var h=-1,k=this.length;++h<k;){c.push(d=[]);for(var g=this[h],
-m=-1,n=g.length;++m<n;)(f=g[m])&&(e=a.call(f,f.__data__,m))?("__data__"in f&&(e.__data__=f.__data__),Pa(e,m,b,f.__transition__[b]),d.push(e)):d.push(null)}return Ba(c,b)};M.selectAll=function(a){var b=this.id,c=[],d,e,f,h;"function"!==typeof a&&(a=Nc(a));for(var k=-1,g=this.length;++k<g;)for(var m=this[k],n=-1,p=m.length;++n<p;)if(d=m[n]){h=d.__transition__[b];e=a.call(d,d.__data__,n);c.push(d=[]);for(var q=-1,r=e.length;++q<r;)Pa(f=e[q],q,b,h),d.push(f)}return Ba(c,b)};M.filter=function(a){var b=
-[],c,d,e;"function"!==typeof a&&(a=Uc(a));for(var f=0,h=this.length;f<h;f++){b.push(c=[]);d=this[f];for(var k=0,g=d.length;k<g;k++)(e=d[k])&&a.call(e,e.__data__,k)&&c.push(e)}return Ba(b,this.id,this.time).ease(this.ease())};M.attr=function(a,b){function c(){this.removeAttribute(f)}function d(){this.removeAttributeNS(f.space,f.local)}if(2>arguments.length){for(b in a)this.attr(b,a[b]);return this}var e=xb(a),f=g.ns.qualify(a);return Ib(this,"attr."+a,b,function(a){function b(){var c=this.getAttribute(f),
-d;return c!==a&&(d=e(c,a),function(a){this.setAttribute(f,d(a))})}function g(){var b=this.getAttributeNS(f.space,f.local),c;return b!==a&&(c=e(b,a),function(a){this.setAttributeNS(f.space,f.local,c(a))})}return null==a?f.local?d:c:(a+="",f.local?g:b)})};M.attrTween=function(a,b){function c(a,c){var d=b.call(this,a,c,this.getAttribute(e));return d&&function(a){this.setAttribute(e,d(a))}}function d(a,c){var d=b.call(this,a,c,this.getAttributeNS(e.space,e.local));return d&&function(a){this.setAttributeNS(e.space,
-e.local,d(a))}}var e=g.ns.qualify(a);return this.tween("attr."+a,e.local?d:c)};M.style=function(a,b,c){function d(){this.style.removeProperty(a)}var e=arguments.length;if(3>e){if("string"!==typeof a){2>e&&(b="");for(c in a)this.style(c,a[c],b);return this}c=""}var f=xb(a);return Ib(this,"style."+a,b,function(b){function e(){var d=P.getComputedStyle(this,null).getPropertyValue(a),k;return d!==b&&(k=f(d,b),function(b){this.style.setProperty(a,k(b),c)})}return null==b?d:(b+="",e)})};M.styleTween=function(a,
-b,c){3>arguments.length&&(c="");return this.tween("style."+a,function(d,e){var f=b.call(this,d,e,P.getComputedStyle(this,null).getPropertyValue(a));return f&&function(b){this.style.setProperty(a,f(b),c)}})};M.text=function(a){return Ib(this,"text",a,cf)};M.remove=function(){return this.each("end.transition",function(){var a;!this.__transition__&&(a=this.parentNode)&&a.removeChild(this)})};M.ease=function(a){var b=this.id;if(1>arguments.length)return this.node().__transition__[b].ease;"function"!==
-typeof a&&(a=g.ease.apply(g,arguments));return ia(this,function(c){c.__transition__[b].ease=a})};M.delay=function(a){var b=this.id;return ia(this,"function"===typeof a?function(c,d,e){c.__transition__[b].delay=a.call(c,c.__data__,d,e)|0}:(a|=0,function(c){c.__transition__[b].delay=a}))};M.duration=function(a){var b=this.id;return ia(this,"function"===typeof a?function(c,d,e){c.__transition__[b].duration=Math.max(1,a.call(c,c.__data__,d,e)|0)}:(a=Math.max(1,a|0),function(c){c.__transition__[b].duration=
-a}))};M.each=function(a,b){var c=this.id;if(2>arguments.length){var d=mb,e=Ja;Ja=c;ia(this,function(b,d,e){mb=b.__transition__[c];a.call(b,b.__data__,d,e)});mb=d;Ja=e}else ia(this,function(d){d.__transition__[c].event.on(a,b)});return this};M.transition=function(){for(var a=this.id,b=++oe,c=[],d,e,f,h,k=0,g=this.length;k<g;k++){c.push(d=[]);e=this[k];for(var m=0,n=e.length;m<n;m++){if(f=e[m])h=Object.create(f.__transition__[a]),h.delay+=h.duration,Pa(f,m,b,h);d.push(f)}}return Ba(c,b)};M.tween=function(a,
-b){var c=this.id;return 2>arguments.length?this.node().__transition__[c].tween.get(a):ia(this,null==b?function(b){b.__transition__[c].tween.remove(a)}:function(d){d.__transition__[c].tween.set(a,b)})};var sg=0,Kb={},ua=null,Ra,Qa;g.timer=function(a,b,c){if(3>arguments.length){if(2>arguments.length)b=0;else if(!isFinite(b))return;c=Date.now()}var d=Kb[a.id];d&&d.callback===a?(d.then=c,d.delay=b):Kb[a.id=++sg]=ua={callback:a,then:c,delay:b,next:ua};Ra||(Qa=clearTimeout(Qa),Ra=1,Zc(Jb))};g.timer.flush=
-function(){for(var a,b=Date.now(),c=ua;c;)a=b-c.then,c.delay||(c.flush=c.callback(a)),c=c.next;Yc()};var Zc=P.requestAnimationFrame||P.webkitRequestAnimationFrame||P.mozRequestAnimationFrame||P.oRequestAnimationFrame||P.msRequestAnimationFrame||function(a){setTimeout(a,17)};g.mouse=function(a){return $c(a,Cc())};var Lb=/WebKit/.test(P.navigator.userAgent)?-1:0;g.touches=function(a,b){2>arguments.length&&(b=Cc().touches);return b?ha(b).map(function(b){var d=$c(a,b);d.identifier=b.identifier;return d}):
-[]};g.scale={};g.scale.linear=function(){return ad([0,1],[0,1],g.interpolate,!1)};g.scale.log=function(){return ed(g.scale.linear(),Ob)};var gf=g.format(".0e");Ob.pow=function(a){return Math.pow(10,a)};Ua.pow=function(a){return-Math.pow(10,-a)};g.scale.pow=function(){return fd(g.scale.linear(),1)};g.scale.sqrt=function(){return g.scale.pow().exponent(.5)};g.scale.ordinal=function(){return gd([],{t:"range",a:[[]]})};g.scale.category10=function(){return g.scale.ordinal().range(tg)};g.scale.category20=
-function(){return g.scale.ordinal().range(ug)};g.scale.category20b=function(){return g.scale.ordinal().range(vg)};g.scale.category20c=function(){return g.scale.ordinal().range(wg)};var tg="#1f77b4 #ff7f0e #2ca02c #d62728 #9467bd #8c564b #e377c2 #7f7f7f #bcbd22 #17becf".split(" "),ug="#1f77b4 #aec7e8 #ff7f0e #ffbb78 #2ca02c #98df8a #d62728 #ff9896 #9467bd #c5b0d5 #8c564b #c49c94 #e377c2 #f7b6d2 #7f7f7f #c7c7c7 #bcbd22 #dbdb8d #17becf #9edae5".split(" "),vg="#393b79 #5254a3 #6b6ecf #9c9ede #637939 #8ca252 #b5cf6b #cedb9c #8c6d31 #bd9e39 #e7ba52 #e7cb94 #843c39 #ad494a #d6616b #e7969c #7b4173 #a55194 #ce6dbd #de9ed6".split(" "),
-wg="#3182bd #6baed6 #9ecae1 #c6dbef #e6550d #fd8d3c #fdae6b #fdd0a2 #31a354 #74c476 #a1d99b #c7e9c0 #756bb1 #9e9ac8 #bcbddc #dadaeb #636363 #969696 #bdbdbd #d9d9d9".split(" ");g.scale.quantile=function(){return hd([],[])};g.scale.quantize=function(){return id(0,1,[0,1])};g.scale.threshold=function(){return jd([.5],[0,1])};g.scale.identity=function(){return kd([0,1])};g.svg={};g.svg.arc=function(){function a(){var a=b.apply(this,arguments),h=c.apply(this,arguments),k=d.apply(this,arguments)+na,g=e.apply(this,
-arguments)+na,m=(g<k&&(m=k,k=g,g=m),g-k),n=m<u?"0":"1",p=Math.cos(k),k=Math.sin(k),q=Math.cos(g),g=Math.sin(g);return m>=xg?a?"M0,"+h+"A"+h+","+h+" 0 1,1 0,"+-h+"A"+h+","+h+" 0 1,1 0,"+h+"M0,"+a+"A"+a+","+a+" 0 1,0 0,"+-a+"A"+a+","+a+" 0 1,0 0,"+a+"Z":"M0,"+h+"A"+h+","+h+" 0 1,1 0,"+-h+"A"+h+","+h+" 0 1,1 0,"+h+"Z":a?"M"+h*p+","+h*k+"A"+h+","+h+" 0 "+n+",1 "+h*q+","+h*g+"L"+a*q+","+a*g+"A"+a+","+a+" 0 "+n+",0 "+a*p+","+a*k+"Z":"M"+h*p+","+h*k+"A"+h+","+h+" 0 "+n+",1 "+h*q+","+h*g+"L0,0Z"}var b=hf,
-c=jf,d=ld,e=md;a.innerRadius=function(c){if(!arguments.length)return b;b=F(c);return a};a.outerRadius=function(b){if(!arguments.length)return c;c=F(b);return a};a.startAngle=function(b){if(!arguments.length)return d;d=F(b);return a};a.endAngle=function(b){if(!arguments.length)return e;e=F(b);return a};a.centroid=function(){var a=(b.apply(this,arguments)+c.apply(this,arguments))/2,h=(d.apply(this,arguments)+e.apply(this,arguments))/2+na;return[Math.cos(h)*a,Math.sin(h)*a]};return a};var na=-u/2,xg=
-2*u-1E-6;g.svg.line=function(){return nd(V)};var Qb=g.map({linear:U,"linear-closed":function(a){return U(a)+"Z"},"step-before":Rb,"step-after":Sb,basis:pd,"basis-open":function(a){if(4>a.length)return U(a);for(var b=[],c=-1,d=a.length,e,f=[0],h=[0];3>++c;)e=a[c],f.push(e[0]),h.push(e[1]);b.push(aa(va,f)+","+aa(va,h));for(--c;++c<d;)e=a[c],f.shift(),f.push(e[0]),h.shift(),h.push(e[1]),Da(b,f,h);return b.join("")},"basis-closed":function(a){for(var b,c=-1,d=a.length,e=d+4,f,h=[],g=[];4>++c;)f=a[c%d],
-h.push(f[0]),g.push(f[1]);b=[aa(va,h),",",aa(va,g)];for(--c;++c<e;)f=a[c%d],h.shift(),h.push(f[0]),g.shift(),g.push(f[1]),Da(b,h,g);return b.join("")},bundle:function(a,b){var c=a.length-1;if(c)for(var d=a[0][0],e=a[0][1],f=a[c][0]-d,h=a[c][1]-e,g=-1,l,m;++g<=c;)l=a[g],m=g/c,l[0]=b*l[0]+(1-b)*(d+m*f),l[1]=b*l[1]+(1-b)*(e+m*h);return pd(a)},cardinal:function(a,b){return 3>a.length?U(a):a[0]+Wa(a,Tb(a,b))},"cardinal-open":function(a,b){return 4>a.length?U(a):a[1]+Wa(a.slice(1,a.length-1),Tb(a,b))},
-"cardinal-closed":function(a,b){return 3>a.length?U(a):a[0]+Wa((a.push(a[0]),a),Tb([a[a.length-2]].concat(a,[a[1]]),b))},monotone:function(a){if(3>a.length)a=U(a);else{var b=a[0],c=[],d,e,f,h;d=0;e=a.length-1;var g=[];f=a[1];for(h=g[0]=Ub(a[0],f);++d<e;)g[d]=(h+(h=Ub(f,f=a[d+1])))/2;g[d]=h;for(var l=-1,m=a.length-1;++l<m;)d=Ub(a[l],a[l+1]),1E-6>Math.abs(d)?g[l]=g[l+1]=0:(e=g[l]/d,f=g[l+1]/d,h=e*e+f*f,9<h&&(h=3*d/Math.sqrt(h),g[l]=h*e,g[l+1]=h*f));for(l=-1;++l<=m;)h=(a[Math.min(m,l+1)][0]-a[Math.max(0,
-l-1)][0])/(6*(1+g[l]*g[l])),c.push([h||0,g[l]*h||0]);a=b+Wa(a,c)}return a}});Qb.forEach(function(a,b){b.key=a;b.closed=/-closed$/.test(a)});var qd=[0,2/3,1/3,0],rd=[0,1/3,2/3,0],va=[0,1/6,2/3,1/6];g.svg.line.radial=function(){var a=nd(sd);a.radius=a.x;delete a.x;a.angle=a.y;delete a.y;return a};Rb.reverse=Sb;Sb.reverse=Rb;g.svg.area=function(){return td(V)};g.svg.area.radial=function(){var a=td(sd);a.radius=a.x;delete a.x;a.innerRadius=a.x0;delete a.x0;a.outerRadius=a.x1;delete a.x1;a.angle=a.y;delete a.y;
-a.startAngle=a.y0;delete a.y0;a.endAngle=a.y1;delete a.y1;return a};g.svg.chord=function(){function a(a,f){var h=b(this,d,a,f),g=b(this,e,a,f);return"M"+h.p0+c(h.r,h.p1,h.a1-h.a0)+(h.a0==g.a0&&h.a1==g.a1?"Q 0,0 "+h.p0:"Q 0,0 "+g.p0+c(g.r,g.p1,g.a1-g.a0)+("Q 0,0 "+h.p0))+"Z"}function b(a,b,c,d){var e=b.call(a,c,d);b=f.call(a,e,d);c=h.call(a,e,d)+na;a=g.call(a,e,d)+na;return{r:b,a0:c,a1:a,p0:[b*Math.cos(c),b*Math.sin(c)],p1:[b*Math.cos(a),b*Math.sin(a)]}}function c(a,b,c){return"A"+a+","+a+" 0 "+ +(c>
-u)+",1 "+b}var d=sb,e=rb,f=kf,h=ld,g=md;a.radius=function(b){if(!arguments.length)return f;f=F(b);return a};a.source=function(b){if(!arguments.length)return d;d=F(b);return a};a.target=function(b){if(!arguments.length)return e;e=F(b);return a};a.startAngle=function(b){if(!arguments.length)return h;h=F(b);return a};a.endAngle=function(b){if(!arguments.length)return g;g=F(b);return a};return a};g.svg.diagonal=function(){function a(a,f){var h=b.call(this,a,f),g=c.call(this,a,f),l=(h.y+g.y)/2,h=[h,{x:h.x,
-y:l},{x:g.x,y:l},g],h=h.map(d);return"M"+h[0]+"C"+h[1]+" "+h[2]+" "+h[3]}var b=sb,c=rb,d=ud;a.source=function(c){if(!arguments.length)return b;b=F(c);return a};a.target=function(b){if(!arguments.length)return c;c=F(b);return a};a.projection=function(b){if(!arguments.length)return d;d=b;return a};return a};g.svg.diagonal.radial=function(){var a=g.svg.diagonal(),b=ud,c=a.projection;a.projection=function(a){return arguments.length?c(lf(b=a)):b};return a};g.svg.symbol=function(){function a(a,e){return(pe.get(b.call(this,
-a,e))||vd)(c.call(this,a,e))}var b=nf,c=mf;a.type=function(c){if(!arguments.length)return b;b=F(c);return a};a.size=function(b){if(!arguments.length)return c;c=F(b);return a};return a};var pe=g.map({circle:vd,cross:function(a){a=Math.sqrt(a/5)/2;return"M"+-3*a+","+-a+"H"+-a+"V"+-3*a+"H"+a+"V"+-a+"H"+3*a+"V"+a+"H"+a+"V"+3*a+"H"+-a+"V"+a+"H"+-3*a+"Z"},diamond:function(a){a=Math.sqrt(a/(2*qe));var b=a*qe;return"M0,"+-a+"L"+b+",0 0,"+a+" "+-b+",0Z"},square:function(a){a=Math.sqrt(a)/2;return"M"+-a+","+
--a+"L"+a+","+-a+" "+a+","+a+" "+-a+","+a+"Z"},"triangle-down":function(a){a=Math.sqrt(a/nb);var b=a*nb/2;return"M0,"+b+"L"+a+","+-b+" "+-a+","+-b+"Z"},"triangle-up":function(a){a=Math.sqrt(a/nb);var b=a*nb/2;return"M0,"+-b+"L"+a+","+b+" "+-a+","+b+"Z"}});g.svg.symbolTypes=pe.keys();var nb=Math.sqrt(3),qe=Math.tan(30*w);g.svg.axis=function(){function a(a){a.each(function(){var a=g.select(this),p=null==l?b.ticks?b.ticks.apply(b,k):b.domain():l,s=null==m?b.tickFormat?b.tickFormat.apply(b,k):String:m,
-t=of(b,p,n),v=a.selectAll(".tick.minor").data(t,String),t=v.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1E-6),x=g.transition(v.exit()).style("opacity",1E-6).remove(),v=g.transition(v).style("opacity",1),z=a.selectAll(".tick.major").data(p,String),p=z.enter().insert("g","path").attr("class","tick major").style("opacity",1E-6),y=g.transition(z.exit()).style("opacity",1E-6).remove(),G=g.transition(z).style("opacity",1),H,D=Sa(b),a=a.selectAll(".domain").data([0]),a=(a.enter().append("path").attr("class",
-"domain"),g.transition(a)),B=b.copy(),E=this.__chart__||B;this.__chart__=B;p.append("line");p.append("text");var u=p.select("line"),L=G.select("line"),s=z.select("text").text(s),z=p.select("text"),w=G.select("text");switch(c){case "bottom":H=wd;t.attr("y2",e);v.attr("x2",0).attr("y2",e);u.attr("y2",d);z.attr("y",Math.max(d,0)+h);L.attr("x2",0).attr("y2",d);w.attr("x",0).attr("y",Math.max(d,0)+h);s.attr("dy",".71em").style("text-anchor","middle");a.attr("d","M"+D[0]+","+f+"V0H"+D[1]+"V"+f);break;case "top":H=
-wd;t.attr("y2",-e);v.attr("x2",0).attr("y2",-e);u.attr("y2",-d);z.attr("y",-(Math.max(d,0)+h));L.attr("x2",0).attr("y2",-d);w.attr("x",0).attr("y",-(Math.max(d,0)+h));s.attr("dy","0em").style("text-anchor","middle");a.attr("d","M"+D[0]+","+-f+"V0H"+D[1]+"V"+-f);break;case "left":H=xd;t.attr("x2",-e);v.attr("x2",-e).attr("y2",0);u.attr("x2",-d);z.attr("x",-(Math.max(d,0)+h));L.attr("x2",-d).attr("y2",0);w.attr("x",-(Math.max(d,0)+h)).attr("y",0);s.attr("dy",".32em").style("text-anchor","end");a.attr("d",
-"M"+-f+","+D[0]+"H0V"+D[1]+"H"+-f);break;case "right":H=xd,t.attr("x2",e),v.attr("x2",e).attr("y2",0),u.attr("x2",d),z.attr("x",Math.max(d,0)+h),L.attr("x2",d).attr("y2",0),w.attr("x",Math.max(d,0)+h).attr("y",0),s.attr("dy",".32em").style("text-anchor","start"),a.attr("d","M"+f+","+D[0]+"H0V"+D[1]+"H"+f)}if(b.ticks)p.call(H,E),G.call(H,B),y.call(H,B),t.call(H,E),v.call(H,B),x.call(H,B);else{var fa=B.rangeBand()/2,t=function(a){return B(a)+fa};p.call(H,t);G.call(H,t)}})}var b=g.scale.linear(),c=re,
-d=6,e=6,f=6,h=3,k=[10],l=null,m,n=0;a.scale=function(c){if(!arguments.length)return b;b=c;return a};a.orient=function(b){if(!arguments.length)return c;c=b in yg?b+"":re;return a};a.ticks=function(){if(!arguments.length)return k;k=arguments;return a};a.tickValues=function(b){if(!arguments.length)return l;l=b;return a};a.tickFormat=function(b){if(!arguments.length)return m;m=b;return a};a.tickSize=function(b,c){if(!arguments.length)return d;var h=arguments.length-1;d=+b;e=1<h?+c:d;f=0<h?+arguments[h]:
-d;return a};a.tickPadding=function(b){if(!arguments.length)return h;h=+b;return a};a.tickSubdivide=function(b){if(!arguments.length)return n;n=+b;return a};return a};var re="bottom",yg={top:1,right:1,bottom:1,left:1};g.svg.brush=function(){function a(f){f.each(function(){var f=g.select(this),m=f.selectAll(".background").data([0]),p=f.selectAll(".extent").data([0]),n=f.selectAll(".resize").data(l,String);f.style("pointer-events","all").on("mousedown.brush",e).on("touchstart.brush",e);m.enter().append("rect").attr("class",
-"background").style("visibility","hidden").style("cursor","crosshair");p.enter().append("rect").attr("class","extent").style("cursor","move");n.enter().append("g").attr("class",function(a){return"resize "+a}).style("cursor",function(a){return zg[a]}).append("rect").attr("x",function(a){return/[ew]$/.test(a)?-3:null}).attr("y",function(a){return/^[ns]/.test(a)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden");n.style("display",a.empty()?"none":null);n.exit().remove();h&&(p=Sa(h),
-m.attr("x",p[0]).attr("width",p[1]-p[0]),c(f));k&&(p=Sa(k),m.attr("y",p[0]).attr("height",p[1]-p[0]),d(f));b(f)})}function b(a){a.selectAll(".resize").attr("transform",function(a){return"translate("+m[+/e$/.test(a)][0]+","+m[+/^s/.test(a)][1]+")"})}function c(a){a.select(".extent").attr("x",m[0][0]);a.selectAll(".extent,.n>rect,.s>rect").attr("width",m[1][0]-m[0][0])}function d(a){a.select(".extent").attr("y",m[0][1]);a.selectAll(".extent,.e>rect,.w>rect").attr("height",m[1][1]-m[0][1])}function e(){function e(){var a=
-g.event.changedTouches;return a?g.touches(t,a)[0]:g.mouse(t)}function l(){var a=e(),f=!1;u&&(a[0]+=u[0],a[1]+=u[1]);D||(g.event.altKey?(B||(B=[(m[0][0]+m[1][0])/2,(m[0][1]+m[1][1])/2]),E[0]=m[+(a[0]<B[0])][0],E[1]=m[+(a[1]<B[1])][1]):B=null);G&&r(a,h,0)&&(c(z),f=!0);H&&r(a,k,1)&&(d(z),f=!0);f&&(b(z),x({type:"brush",mode:D?"move":"resize"}))}function r(a,b,c){var d=Sa(b);b=d[0];var e=d[1],d=E[c],f=m[1][c]-m[0][c];D&&(b-=d,e-=f+d);a=Math.max(b,Math.min(e,a[c]));D?b=(a+=d)+f:(B&&(d=Math.max(b,Math.min(e,
-2*B[c]-a))),d<a?(b=a,a=d):b=d);if(m[0][c]!==a||m[1][c]!==b)return n=null,m[0][c]=a,m[1][c]=b,!0}function s(){l();z.style("pointer-events","all").selectAll(".resize").style("display",a.empty()?"none":null);g.select("body").style("cursor",null);L.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null);x({type:"brushend"});X()}var t=this,v=g.select(g.event.target),x=f.of(t,arguments),z=g.select(t),y=v.datum(),
-G=!/^(n|s)$/.test(y)&&h,H=!/^(e|w)$/.test(y)&&k,D=v.classed("extent"),B,E=e(),u,L=g.select(P).on("mousemove.brush",l).on("mouseup.brush",s).on("touchmove.brush",l).on("touchend.brush",s).on("keydown.brush",function(){32==g.event.keyCode&&(D||(B=null,E[0]-=m[1][0],E[1]-=m[1][1],D=2),X())}).on("keyup.brush",function(){32==g.event.keyCode&&2==D&&(E[0]+=m[1][0],E[1]+=m[1][1],D=0,X())});if(D)E[0]=m[0][0]-E[0],E[1]=m[0][1]-E[1];else if(y){var w=+/w$/.test(y),y=+/^n/.test(y);u=[m[1-w][0]-E[0],m[1-y][1]-
-E[1]];E[0]=m[w][0];E[1]=m[y][1]}else g.event.altKey&&(B=E.slice());z.style("pointer-events","none").selectAll(".resize").style("display",null);g.select("body").style("cursor",v.style("cursor"));x({type:"brushstart"});l();X()}var f=wb(a,"brushstart","brush","brushend"),h=null,k=null,l=vc[0],m=[[0,0],[0,0]],n;a.x=function(b){if(!arguments.length)return h;h=b;l=vc[!h<<1|!k];return a};a.y=function(b){if(!arguments.length)return k;k=b;l=vc[!h<<1|!k];return a};a.extent=function(b){var c,d,e,f,g;if(!arguments.length)return b=
-n||m,h&&(c=b[0][0],d=b[1][0],n||(c=m[0][0],d=m[1][0],h.invert&&(c=h.invert(c),d=h.invert(d)),d<c&&(g=c,c=d,d=g))),k&&(e=b[0][1],f=b[1][1],n||(e=m[0][1],f=m[1][1],k.invert&&(e=k.invert(e),f=k.invert(f)),f<e&&(g=e,e=f,f=g))),h&&k?[[c,e],[d,f]]:h?[c,d]:k&&[e,f];n=[[0,0],[0,0]];h&&(c=b[0],d=b[1],k&&(c=c[0],d=d[0]),n[0][0]=c,n[1][0]=d,h.invert&&(c=h(c),d=h(d)),d<c&&(g=c,c=d,d=g),m[0][0]=c|0,m[1][0]=d|0);k&&(e=b[0],f=b[1],h&&(e=e[1],f=f[1]),n[0][1]=e,n[1][1]=f,k.invert&&(e=k(e),f=k(f)),f<e&&(g=e,e=f,f=
-g),m[0][1]=e|0,m[1][1]=f|0);return a};a.clear=function(){n=null;m[0][0]=m[0][1]=m[1][0]=m[1][1]=0;return a};a.empty=function(){return h&&m[0][0]===m[1][0]||k&&m[0][1]===m[1][1]};return g.rebind(a,f,"on")};var zg={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},vc=["n e s w nw ne se sw".split(" "),["e","w"],["n","s"],[]];g.behavior={};g.behavior.drag=function(){function a(){this.on("mousedown.drag",b).on("touchstart.drag",
-b)}function b(){function a(){var b=k.parentNode;return null!=n?g.touches(b).filter(function(a){return a.identifier===n})[0]:g.mouse(b)}function b(){l({type:"dragend"});if(r&&(X(),g.event.target===m))s.on("click.drag",h,!0);s.on(null!=n?"touchmove.drag-"+n:"mousemove.drag",null).on(null!=n?"touchend.drag-"+n:"mouseup.drag",null)}function h(){X();s.on("click.drag",null)}var k=this,l=c.of(k,arguments),m=g.event.target,n=g.event.touches?g.event.changedTouches[0].identifier:null,p,q=a(),r=0,s=g.select(P).on(null!=
-n?"touchmove.drag-"+n:"mousemove.drag",function(){if(!k.parentNode)return b();var c=a(),d=c[0]-q[0],h=c[1]-q[1];r=r|d|h;q=c;X();l({type:"drag",x:c[0]+p[0],y:c[1]+p[1],dx:d,dy:h})}).on(null!=n?"touchend.drag-"+n:"mouseup.drag",b,!0);d?(p=d.apply(k,arguments),p=[p.x-q[0],p.y-q[1]]):p=[0,0];null==n&&X();l({type:"dragstart"})}var c=wb(a,"drag","dragstart","dragend"),d=null;a.origin=function(b){if(!arguments.length)return d;d=b;return a};return g.rebind(a,c,"on")};g.behavior.zoom=function(){function a(){this.on("mousedown.zoom",
-h).on("mousemove.zoom",l).on(Ag+".zoom",k).on("dblclick.zoom",m).on("touchstart.zoom",n).on("touchmove.zoom",p).on("touchend.zoom",n)}function b(a){return[(a[0]-q[0])/s,(a[1]-q[1])/s]}function c(a){s=Math.max(v[0],Math.min(v[1],a))}function d(a,b){b=[b[0]*s+q[0],b[1]*s+q[1]];q[0]+=a[0]-b[0];q[1]+=a[1]-b[1]}function e(){y&&y.domain(z.range().map(function(a){return(a-q[0])/s}).map(z.invert));H&&H.domain(G.range().map(function(a){return(a-q[1])/s}).map(G.invert))}function f(a){e();g.event.preventDefault();
-a({type:"zoom",scale:s,translate:q})}function h(){function a(){X();l.on("click.zoom",null)}var c=this,e=x.of(c,arguments),h=g.event.target,k=0,l=g.select(P).on("mousemove.zoom",function(){k=1;d(g.mouse(c),m);f(e)}).on("mouseup.zoom",function(){k&&X();l.on("mousemove.zoom",null).on("mouseup.zoom",null);if(k&&g.event.target===h)l.on("click.zoom",a,!0)}),m=b(g.mouse(c));P.focus();X()}function k(){r||(r=b(g.mouse(this)));c(Math.pow(2,.002*ob())*s);d(g.mouse(this),r);f(x.of(this,arguments))}function l(){r=
-null}function m(){var a=g.mouse(this),e=b(a),h=Math.log(s)/Math.LN2;c(Math.pow(2,g.event.shiftKey?Math.ceil(h)-1:Math.floor(h)+1));d(a,e);f(x.of(this,arguments))}function n(){var a=g.touches(this),e=Date.now();t=s;r={};a.forEach(function(a){r[a.identifier]=b(a)});X();if(1===a.length){if(500>e-D){var h=a[0],a=b(a[0]);c(2*s);d(h,a);f(x.of(this,arguments))}D=e}}function p(){var a=g.touches(this),b=a[0],e=r[b.identifier];if(a=a[1]){var h=r[a.identifier],b=[(b[0]+a[0])/2,(b[1]+a[1])/2],e=[(e[0]+h[0])/
-2,(e[1]+h[1])/2];c(g.event.scale*t)}d(b,e);D=null;f(x.of(this,arguments))}var q=[0,0],r,s=1,t,v=se,x=wb(a,"zoom"),z,y,G,H,D;a.translate=function(b){if(!arguments.length)return q;q=b.map(Number);e();return a};a.scale=function(b){if(!arguments.length)return s;s=+b;e();return a};a.scaleExtent=function(b){if(!arguments.length)return v;v=null==b?se:b.map(Number);return a};a.x=function(b){if(!arguments.length)return y;y=b;z=b.copy();q=[0,0];s=1;return a};a.y=function(b){if(!arguments.length)return H;H=
-b;G=b.copy();q=[0,0];s=1;return a};return g.rebind(a,x,"on")};var se=[0,Infinity],ob,Ag="onwheel"in document?(ob=function(){return-g.event.deltaY*(g.event.deltaMode?120:1)},"wheel"):"onmousewheel"in document?(ob=function(){return g.event.wheelDelta},"mousewheel"):(ob=function(){return-g.event.detail},"MozMousePixelScroll");g.layout={};g.layout.bundle=function(){return function(a){for(var b=[],c=-1,d=a.length;++c<d;)b.push(pf(a[c]));return b}};g.layout.chord=function(){function a(){var a={},c=[],r=
-g.range(h),s=[],t,v,x,z,y;d=[];e=[];t=0;for(z=-1;++z<h;){v=0;for(y=-1;++y<h;)v+=f[z][y];c.push(v);s.push(g.range(h));t+=v}l&&r.sort(function(a,b){return l(c[a],c[b])});m&&s.forEach(function(a,b){a.sort(function(a,c){return m(f[b][a],f[b][c])})});t=(2*u-k*h)/t;v=0;for(z=-1;++z<h;){x=v;for(y=-1;++y<h;){var G=r[z],H=s[G][y],D=f[G][H],B=v,E=v+=D*t;a[G+"-"+H]={index:G,subindex:H,startAngle:B,endAngle:E,value:D}}e[G]={index:G,startAngle:x,endAngle:v,value:(v-x)/t};v+=k}for(z=-1;++z<h;)for(y=z-1;++y<h;)r=
-a[z+"-"+y],s=a[y+"-"+z],(r.value||s.value)&&d.push(r.value<s.value?{source:s,target:r}:{source:r,target:s});n&&b()}function b(){d.sort(function(a,b){return n((a.source.value+a.target.value)/2,(b.source.value+b.target.value)/2)})}var c={},d,e,f,h,k=0,l,m,n;c.matrix=function(a){if(!arguments.length)return f;h=(f=a)&&f.length;d=e=null;return c};c.padding=function(a){if(!arguments.length)return k;k=a;d=e=null;return c};c.sortGroups=function(a){if(!arguments.length)return l;l=a;d=e=null;return c};c.sortSubgroups=
-function(a){if(!arguments.length)return m;m=a;d=null;return c};c.sortChords=function(a){if(!arguments.length)return n;n=a;d&&b();return c};c.chords=function(){d||a();return d};c.groups=function(){e||a();return e};return c};g.layout.force=function(){function a(a){return function(b,c,d,e){if(b.point!==a){d=b.cx-a.x;var f=b.cy-a.y,h=1/Math.sqrt(d*d+f*f);if((e-c)*h<q)return c=b.charge*h*h,a.px-=d*c,a.py-=f*c,!0;b.point&&isFinite(h)&&(c=b.pointCharge*h*h,a.px-=d*c,a.py-=f*c)}return!b.charge}}function b(a){a.px=
-g.event.x;a.py=g.event.y;c.resume()}var c={},d=g.dispatch("start","tick","end"),e=[1,1],f,h,k=.9,l=Bg,m=Cg,n=-30,p=.1,q=.8,r=[],s=[],t,v,x;c.tick=function(){if(.005>(h*=.99))return d.end({type:"end",alpha:h=0}),!0;var b=r.length,c=s.length,f,l,m,q,u,w,L;for(f=0;f<c;++f)if(l=s[f],m=l.source,q=l.target,w=q.x-m.x,L=q.y-m.y,u=w*w+L*L)u=h*v[f]*((u=Math.sqrt(u))-t[f])/u,w*=u,L*=u,q.x-=w*(u=m.weight/(q.weight+m.weight)),q.y-=L*u,m.x+=w*(u=1-u),m.y+=L*u;if(u=h*p)if(w=e[0]/2,L=e[1]/2,f=-1,u)for(;++f<b;)l=
-r[f],l.x+=(w-l.x)*u,l.y+=(L-l.y)*u;if(n)for(zd(c=g.geom.quadtree(r),h,x),f=-1;++f<b;)(l=r[f]).fixed||c.visit(a(l));for(f=-1;++f<b;)l=r[f],l.fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*k,l.y-=(l.py-(l.py=l.y))*k);d.tick({type:"tick",alpha:h})};c.nodes=function(a){if(!arguments.length)return r;r=a;return c};c.links=function(a){if(!arguments.length)return s;s=a;return c};c.size=function(a){if(!arguments.length)return e;e=a;return c};c.linkDistance=function(a){if(!arguments.length)return l;l="function"===
-typeof a?a:+a;return c};c.distance=c.linkDistance;c.linkStrength=function(a){if(!arguments.length)return m;m="function"===typeof a?a:+a;return c};c.friction=function(a){if(!arguments.length)return k;k=+a;return c};c.charge=function(a){if(!arguments.length)return n;n="function"===typeof a?a:+a;return c};c.gravity=function(a){if(!arguments.length)return p;p=+a;return c};c.theta=function(a){if(!arguments.length)return q;q=+a;return c};c.alpha=function(a){if(!arguments.length)return h;a=+a;h?h=0<a?a:
-0:0<a&&(d.start({type:"start",alpha:h=a}),g.timer(c.tick));return c};c.start=function(){function a(c,e){var g;if(!p){p=[];for(d=0;d<f;++d)p[d]=[];for(d=0;d<h;++d)g=s[d],p[g.source.index].push(g.target),p[g.target.index].push(g.source)}g=p[b];for(var k=-1,l=g.length,m;++k<l;)if(!isNaN(m=g[k][c]))return m;return Math.random()*e}var b,d,f=r.length,h=s.length,g=e[0],k=e[1],p,q;for(b=0;b<f;++b)(q=r[b]).index=b,q.weight=0;for(b=0;b<h;++b)q=s[b],"number"==typeof q.source&&(q.source=r[q.source]),"number"==
-typeof q.target&&(q.target=r[q.target]),++q.source.weight,++q.target.weight;for(b=0;b<f;++b)q=r[b],isNaN(q.x)&&(q.x=a("x",g)),isNaN(q.y)&&(q.y=a("y",k)),isNaN(q.px)&&(q.px=q.x),isNaN(q.py)&&(q.py=q.y);t=[];if("function"===typeof l)for(b=0;b<h;++b)t[b]=+l.call(this,s[b],b);else for(b=0;b<h;++b)t[b]=l;v=[];if("function"===typeof m)for(b=0;b<h;++b)v[b]=+m.call(this,s[b],b);else for(b=0;b<h;++b)v[b]=m;x=[];if("function"===typeof n)for(b=0;b<f;++b)x[b]=+n.call(this,r[b],b);else for(b=0;b<f;++b)x[b]=n;
-return c.resume()};c.resume=function(){return c.alpha(.1)};c.stop=function(){return c.alpha(0)};c.drag=function(){f||(f=g.behavior.drag().origin(V).on("dragstart.force",qf).on("drag.force",b).on("dragend.force",rf));if(!arguments.length)return f;this.on("mouseover.force",sf).on("mouseout.force",tf).call(f)};return g.rebind(c,d,"on")};var Bg=20,Cg=1;g.layout.partition=function(){function a(b,c,d,e){var g=b.children;b.x=c;b.y=b.depth*e;b.dx=d;b.dy=e;if(g&&(p=g.length)){var n=-1,p,q;for(d=b.value?d/
-b.value:0;++n<p;)a(q=g[n],c,b=q.value*d,e),c+=b}}function b(a){a=a.children;var c=0;if(a&&(e=a.length))for(var d=-1,e;++d<e;)c=Math.max(c,b(a[d]));return 1+c}function c(c,h){var g=d.call(this,c,h);a(g[0],0,e[0],e[1]/b(g[0]));return g}var d=g.layout.hierarchy(),e=[1,1];c.size=function(a){if(!arguments.length)return e;e=a;return c};return Ea(c,d)};g.layout.pie=function(){function a(f){var h=f.map(function(c,d){return+b.call(a,c,d)}),k=+("function"===typeof d?d.apply(this,arguments):d),l=(("function"===
-typeof e?e.apply(this,arguments):e)-d)/g.sum(h),m=g.range(f.length);null!=c&&m.sort(c===te?function(a,b){return h[b]-h[a]}:function(a,b){return c(f[a],f[b])});var n=[];m.forEach(function(a){var b;n[a]={data:f[a],value:b=h[a],startAngle:k,endAngle:k+=b*l}});return n}var b=Number,c=te,d=0,e=2*u;a.value=function(c){if(!arguments.length)return b;b=c;return a};a.sort=function(b){if(!arguments.length)return c;c=b;return a};a.startAngle=function(b){if(!arguments.length)return d;d=b;return a};a.endAngle=
-function(b){if(!arguments.length)return e;e=b;return a};return a};var te={};g.layout.stack=function(){function a(k,l){var m=k.map(function(c,d){return b.call(a,c,d)}),n=m.map(function(b){return b.map(function(b,c){return[f.call(a,b,c),h.call(a,b,c)]})}),p=c.call(a,n,l),m=g.permute(m,p),n=g.permute(n,p),p=d.call(a,n,l),q=m.length,r=m[0].length,s,t,v;for(t=0;t<r;++t)for(e.call(a,m[0][t],v=p[t],n[0][t][1]),s=1;s<q;++s)e.call(a,m[s][t],v+=n[s-1][t][1],n[s][t][1]);return k}var b=V,c=Vb,d=Wb,e=wf,f=uf,
-h=vf;a.values=function(c){if(!arguments.length)return b;b=c;return a};a.order=function(b){if(!arguments.length)return c;c="function"===typeof b?b:Dg.get(b)||Vb;return a};a.offset=function(b){if(!arguments.length)return d;d="function"===typeof b?b:Eg.get(b)||Wb;return a};a.x=function(b){if(!arguments.length)return f;f=b;return a};a.y=function(b){if(!arguments.length)return h;h=b;return a};a.out=function(b){if(!arguments.length)return e;e=b;return a};return a};var Dg=g.map({"inside-out":function(a){var b=
-a.length,c,d=a.map(xf),e=a.map(yf),f=g.range(b).sort(function(a,b){return d[a]-d[b]}),h=0,k=0,l=[],m=[];for(a=0;a<b;++a)c=f[a],h<k?(h+=e[c],l.push(c)):(k+=e[c],m.push(c));return m.reverse().concat(l)},reverse:function(a){return g.range(a.length).reverse()},"default":Vb}),Eg=g.map({silhouette:function(a){var b=a.length,c=a[0].length,d=[],e=0,f,h,g,l=[];for(h=0;h<c;++h){for(g=f=0;f<b;f++)g+=a[f][h][1];g>e&&(e=g);d.push(g)}for(h=0;h<c;++h)l[h]=(e-d[h])/2;return l},wiggle:function(a){var b=a.length,c=
-a[0],d=c.length,e,f,h,g,l,m,n,p,q,r=[];r[0]=p=q=0;for(f=1;f<d;++f){for(g=e=0;e<b;++e)g+=a[e][f][1];l=e=0;for(n=c[f][0]-c[f-1][0];e<b;++e){h=0;for(m=(a[e][f][1]-a[e][f-1][1])/(2*n);h<e;++h)m+=(a[h][f][1]-a[h][f-1][1])/n;l+=m*a[e][f][1]}r[f]=p-=g?l/g*n:0;p<q&&(q=p)}for(f=0;f<d;++f)r[f]-=q;return r},expand:function(a){var b=a.length,c=a[0].length,d=1/b,e,f,h,g=[];for(f=0;f<c;++f){for(h=e=0;e<b;e++)h+=a[e][f][1];if(h)for(e=0;e<b;e++)a[e][f][1]/=h;else for(e=0;e<b;e++)a[e][f][1]=d}for(f=0;f<c;++f)g[f]=
-0;return g},zero:Wb});g.layout.histogram=function(){function a(a,h){var k=[],l=a.map(c,this),m=d.call(this,l,h),n=e.call(this,m,l,h),p;h=-1;for(var q=l.length,r=n.length-1,s=b?1:1/q;++h<r;)p=k[h]=[],p.dx=n[h+1]-(p.x=n[h]),p.y=0;if(0<r)for(h=-1;++h<q;)p=l[h],p>=m[0]&&p<=m[1]&&(p=k[g.bisect(n,p,1,r)-1],p.y+=s,p.push(a[h]));return k}var b=!0,c=Number,d=Bf,e=Af;a.value=function(b){if(!arguments.length)return c;c=b;return a};a.range=function(b){if(!arguments.length)return d;d=F(b);return a};a.bins=function(b){if(!arguments.length)return e;
-e="number"===typeof b?function(a){return Ad(a,b)}:F(b);return a};a.frequency=function(c){if(!arguments.length)return b;b=!!c;return a};return a};g.layout.hierarchy=function(){function a(b,g,l){var m=e.call(c,b,g);b.depth=g;l.push(b);if(m&&(p=m.length)){var n=-1,p,q=b.children=[],r=0;g+=1;for(var s;++n<p;)s=a(m[n],g,l),s.parent=b,q.push(s),r+=s.value;d&&q.sort(d);f&&(b.value=r)}else f&&(b.value=+f.call(c,b,g)||0);return b}function b(a,d){var e=a.children,g=0;if(e&&(p=e.length))for(var n=-1,p,q=d+1;++n<
-p;)g+=b(e[n],q);else f&&(g=+f.call(c,a,d)||0);f&&(a.value=g);return g}function c(b){var c=[];a(b,0,c);return c}var d=Ff,e=Df,f=Ef;c.sort=function(a){if(!arguments.length)return d;d=a;return c};c.children=function(a){if(!arguments.length)return e;e=a;return c};c.value=function(a){if(!arguments.length)return f;f=a;return c};c.revalue=function(a){b(a,0);return a};return c};g.layout.pack=function(){function a(a,f){var h=b.call(this,a,f),g=h[0];g.x=0;g.y=0;ea(g,function(a){a.r=Math.sqrt(a.value)});ea(g,
-Dd);var l=d[0],m=d[1],n=Math.max(2*g.r/l,2*g.r/m);if(0<c){var p=c*n/2;ea(g,function(a){a.r+=p});ea(g,Dd);ea(g,function(a){a.r-=p});n=Math.max(2*g.r/l,2*g.r/m)}Fd(g,l/2,m/2,1/n);return h}var b=g.layout.hierarchy().sort(Gf),c=0,d=[1,1];a.size=function(b){if(!arguments.length)return d;d=b;return a};a.padding=function(b){if(!arguments.length)return c;c=+b;return a};return Ea(a,b)};g.layout.cluster=function(){function a(a,f){var h=b.call(this,a,f),g=h[0],l,m=0;ea(g,function(a){var b=a.children;b&&b.length?
-(a.x=Kf(b),a.y=Jf(b)):(a.x=l?m+=c(a,l):0,a.y=0,l=a)});var n=Gd(g),p=Hd(g),q=n.x-c(n,p)/2,r=p.x+c(p,n)/2;ea(g,function(a){a.x=(a.x-q)/(r-q)*d[0];a.y=(1-(g.y?a.y/g.y:1))*d[1]});return h}var b=g.layout.hierarchy().sort(null).value(null),c=Id,d=[1,1];a.separation=function(b){if(!arguments.length)return c;c=b;return a};a.size=function(b){if(!arguments.length)return d;d=b;return a};return Ea(a,b)};g.layout.tree=function(){function a(a,f){function h(a,b){var d=a.children,e=a._tree;if(d&&(f=d.length)){for(var f,
-g=d[0],k,l=g,m,p=-1;++p<f;){m=d[p];h(m,k);var n=m;if(k){for(var q=n,s=n,r=n.parent.children[0],t=q._tree.mod,u=s._tree.mod,w=k._tree.mod,C=r._tree.mod,A=void 0;k=Zb(k),q=Yb(q),k&&q;){r=Yb(r);s=Zb(s);s._tree.ancestor=n;A=k._tree.prelim+w-q._tree.prelim-t+c(k,q);if(0<A){var I=k._tree.ancestor.parent==n.parent?k._tree.ancestor:l,F=n,J=A,I=I._tree,F=F._tree,K=J/(F.number-I.number);I.change+=K;F.change-=K;F.shift+=J;F.prelim+=J;F.mod+=J;t+=A;u+=A}w+=k._tree.mod;t+=q._tree.mod;C+=r._tree.mod;u+=s._tree.mod}k&&
-!Zb(s)&&(s._tree.thread=k,s._tree.mod+=w-u);q&&!Yb(r)&&(r._tree.thread=q,r._tree.mod+=t-C,l=n)}k=m}f=d=0;p=a.children;for(n=p.length;0<=--n;)l=p[n]._tree,l.prelim+=d,l.mod+=d,d+=l.shift+(f+=l.change);g=.5*(g._tree.prelim+m._tree.prelim);b?(e.prelim=b._tree.prelim+c(a,b),e.mod=e.prelim-g):e.prelim=g}else b&&(e.prelim=b._tree.prelim+c(a,b))}function g(a,b){a.x=a._tree.prelim+b;var c=a.children;if(c&&(e=c.length)){var d=-1,e;for(b+=a._tree.mod;++d<e;)g(c[d],b)}}var l=b.call(this,a,f),m=l[0];ea(m,function(a,
-b){a._tree={ancestor:a,prelim:0,mod:0,change:0,shift:0,number:b?b._tree.number+1:0}});h(m);g(m,-m._tree.prelim);var n=Xa(m,Mf),p=Xa(m,Lf),q=Xa(m,Nf),r=n.x-c(n,p)/2,s=p.x+c(p,n)/2,t=q.depth||1;ea(m,function(a){a.x=(a.x-r)/(s-r)*d[0];a.y=a.depth/t*d[1];delete a._tree});return l}var b=g.layout.hierarchy().sort(null).value(null),c=Id,d=[1,1];a.separation=function(b){if(!arguments.length)return c;c=b;return a};a.size=function(b){if(!arguments.length)return d;d=b;return a};return Ea(a,b)};g.layout.treemap=
-function(){function a(a,b){for(var c=-1,d=a.length,e,f;++c<d;)f=(e=a[c]).value*(0>b?0:b),e.area=isNaN(f)||0>=f?0:f}function b(c){var e=c.children;if(e&&e.length){var f=m(c),h=[],g=e.slice(),k=Infinity,l,p="slice"===q?f.dx:"dice"===q?f.dy:"slice-dice"===q?c.depth&1?f.dy:f.dx:Math.min(f.dx,f.dy);a(g,f.dx*f.dy/c.value);for(h.area=0;0<(c=g.length);){h.push(c=g[c-1]);h.area+=c.area;if(!(c="squarify"!==q)){l=p;c=h.area;for(var n=void 0,u=0,w=Infinity,A=-1,C=h.length;++A<C;)if(n=h[A].area)n<w&&(w=n),n>u&&
-(u=n);c*=c;l*=l;c=(l=c?Math.max(l*u*r/c,c/(l*w*r)):Infinity)<=k}c?(g.pop(),k=l):(h.area-=h.pop().area,d(h,p,f,!1),p=Math.min(f.dx,f.dy),h.length=h.area=0,k=Infinity)}h.length&&(d(h,p,f,!0),h.length=h.area=0);e.forEach(b)}}function c(b){var e=b.children;if(e&&e.length){var f=m(b),h=e.slice(),g=[];a(h,f.dx*f.dy/b.value);for(g.area=0;b=h.pop();)g.push(b),g.area+=b.area,null!=b.z&&(d(g,b.z?f.dx:f.dy,f,!h.length),g.length=g.area=0);e.forEach(c)}}function d(a,b,c,d){var e=-1,f=a.length,g=c.x,k=c.y,l=b?
-h(a.area/b):0,m;if(b==c.dx){if(d||l>c.dy)l=c.dy;for(;++e<f;)m=a[e],m.x=g,m.y=k,m.dy=l,g+=m.dx=Math.min(c.x+c.dx-g,l?h(m.area/l):0);m.z=!0;m.dx+=c.x+c.dx-g;c.y+=l;c.dy-=l}else{if(d||l>c.dx)l=c.dx;for(;++e<f;)m=a[e],m.x=g,m.y=k,m.dx=l,k+=m.dy=Math.min(c.y+c.dy-k,l?h(m.area/l):0);m.z=!1;m.dy+=c.y+c.dy-k;c.x+=l;c.dx-=l}}function e(d){d=p||f(d);var e=d[0];e.x=0;e.y=0;e.dx=k[0];e.dy=k[1];p&&f.revalue(e);a([e],e.dx*e.dy/e.value);(p?c:b)(e);n&&(p=d);return d}var f=g.layout.hierarchy(),h=Math.round,k=[1,1],
-l=null,m=$b,n=!1,p,q="squarify",r=.5*(1+Math.sqrt(5));e.size=function(a){if(!arguments.length)return k;k=a;return e};e.padding=function(a){function b(c){var d=a.call(e,c,c.depth);return null==d?$b(c):Jd(c,"number"===typeof d?[d,d,d,d]:d)}function c(b){return Jd(b,a)}if(!arguments.length)return l;var d;m=null==(l=a)?$b:"function"===(d=typeof a)?b:"number"===d?(a=[a,a,a,a],c):c;return e};e.round=function(a){if(!arguments.length)return h!=Number;h=a?Math.round:Number;return e};e.sticky=function(a){if(!arguments.length)return n;
-n=a;p=null;return e};e.ratio=function(a){if(!arguments.length)return r;r=a;return e};e.mode=function(a){if(!arguments.length)return q;q=a+"";return e};return Ea(e,f)};g.csv=Kd(",","text/csv");g.tsv=Kd("\t","text/tab-separated-values");g.geo={};g.geo.stream=function(a,b){if(ue.hasOwnProperty(a.type))ue[a.type](a,b);else Ya(a,b)};var ue={Feature:function(a,b){Ya(a.geometry,b)},FeatureCollection:function(a,b){for(var c=a.features,d=-1,e=c.length;++d<e;)Ya(c[d].geometry,b)}},Ld={Sphere:function(a,b){b.sphere()},
-Point:function(a,b){var c=a.coordinates;b.point(c[0],c[1])},MultiPoint:function(a,b){for(var c=a.coordinates,d=-1,e=c.length,f;++d<e;)f=c[d],b.point(f[0],f[1])},LineString:function(a,b){ac(a.coordinates,b,0)},MultiLineString:function(a,b){for(var c=a.coordinates,d=-1,e=c.length;++d<e;)ac(c[d],b,0)},Polygon:function(a,b){Md(a.coordinates,b)},MultiPolygon:function(a,b){for(var c=a.coordinates,d=-1,e=c.length;++d<e;)Md(c[d],b)},GeometryCollection:function(a,b){for(var c=a.geometries,d=-1,e=c.length;++d<
-e;)Ya(c[d],b)}};g.geo.albersUsa=function(){function a(a){var h=a[0],g=a[1];return(50<g?c:-140>h?d:21>g?e:b)(a)}var b=g.geo.albers(),c=g.geo.albers().rotate([160,0]).center([0,60]).parallels([55,65]),d=g.geo.albers().rotate([160,0]).center([0,20]).parallels([8,18]),e=g.geo.albers().rotate([60,0]).center([0,10]).parallels([8,18]);a.scale=function(f){if(!arguments.length)return b.scale();b.scale(f);c.scale(.6*f);d.scale(f);e.scale(1.5*f);return a.translate(b.translate())};a.translate=function(f){if(!arguments.length)return b.translate();
-var h=b.scale(),g=f[0],l=f[1];b.translate(f);c.translate([g-.4*h,l+.17*h]);d.translate([g-.19*h,l+.2*h]);e.translate([g+.58*h,l+.43*h]);return a};return a.scale(b.scale())};(g.geo.albers=function(){var a=29.5*w,b=45.5*w,c=ic(Qd),d=c(a,b);d.parallels=function(d){return arguments.length?c(a=d[0]*w,b=d[1]*w):[a*O,b*O]};return d.rotate([98,0]).center([0,38]).scale(1E3)}).raw=Qd;var ve=Fa(function(a){return Math.sqrt(2/(1+a))},function(a){return 2*Math.asin(a/2)});(g.geo.azimuthalEqualArea=function(){return la(ve)}).raw=
-ve;var we=Fa(function(a){return(a=Math.acos(a))&&a/Math.sin(a)},V);(g.geo.azimuthalEquidistant=function(){return la(we)}).raw=we;g.geo.bounds=Rd(V);g.geo.centroid=function(a){N=Y=J=K=I=0;g.geo.stream(a,Z);var b;if(Y&&Math.abs(b=Math.sqrt(J*J+K*K+I*I))>A)return[Math.atan2(K,J)*O,Math.asin(Math.max(-1,Math.min(1,I/b)))*O]};var N,Y,J,K,I,Z={sphere:function(){2>N&&(N=2,Y=J=K=I=0)},point:Sd,lineStart:dc,lineEnd:ec,polygonStart:function(){2>N&&(N=2,Y=J=K=I=0);Z.lineStart=Of},polygonEnd:function(){Z.lineStart=
-dc}};g.geo.circle=function(){function a(){var a="function"===typeof b?b.apply(this,arguments):b,c=ae(-a[0]*w,-a[1]*w,0).invert,d=[];e(null,null,1,{point:function(a,b){d.push(a=c(a,b));a[0]*=O;a[1]*=O}});return{type:"Polygon",coordinates:[d]}}var b=[0,0],c,d=6,e;a.origin=function(c){if(!arguments.length)return b;b=c;return a};a.angle=function(b){if(!arguments.length)return c;e=fc((c=+b)*w,d*w);return a};a.precision=function(b){if(!arguments.length)return d;e=fc(c*w,(d=+b)*w);return a};return a.angle(90)};
-var be=Ud(za,function(a){var b=NaN,c=NaN,d=NaN,e;return{lineStart:function(){a.lineStart();e=1},point:function(f,h){var g=0<f?u:-u,l=Math.abs(f-b);if(Math.abs(l-u)<A)a.point(b,c=0<(c+h)/2?u/2:-u/2),a.point(d,c),a.lineEnd(),a.lineStart(),a.point(g,c),a.point(f,c),e=0;else if(d!==g&&l>=u){Math.abs(b-d)<A&&(b-=d*A);Math.abs(f-g)<A&&(f-=g*A);var l=b,m=c,n=f,p,q,r=Math.sin(l-n);c=Math.abs(r)>A?Math.atan((Math.sin(m)*(q=Math.cos(h))*Math.sin(n)-Math.sin(h)*(p=Math.cos(m))*Math.sin(l))/(p*q*r)):(m+h)/2;
-a.point(d,c);a.lineEnd();a.lineStart();a.point(g,c);e=0}a.point(b=f,c=h);d=g},lineEnd:function(){a.lineEnd();b=c=NaN},clean:function(){return 2-e}}},function(a,b,c,d){null==a?(c=c*u/2,d.point(-u,c),d.point(0,c),d.point(u,c),d.point(u,0),d.point(u,-c),d.point(0,-c),d.point(-u,-c),d.point(-u,0),d.point(-u,c)):Math.abs(a[0]-b[0])>A?(a=(a[0]<b[0]?1:-1)*u,c=c*a/2,d.point(-a,c),d.point(0,c),d.point(a,c)):d.point(b[0],b[1])});(g.geo.equirectangular=function(){return la(ab).scale(250/u)}).raw=ab.invert=ab;
-var xe=Fa(function(a){return 1/a},Math.atan);(g.geo.gnomonic=function(){return la(xe)}).raw=xe;g.geo.graticule=function(){function a(){return{type:"MultiLineString",coordinates:b()}}function b(){return g.range(Math.ceil(d/h)*h,c,h).map(l).concat(g.range(Math.ceil(f/k)*k,e,k).map(m))}var c,d,e,f,h=22.5,k=h,l,m,n=2.5;a.lines=function(){return b().map(function(a){return{type:"LineString",coordinates:a}})};a.outline=function(){return{type:"Polygon",coordinates:[l(d).concat(m(e).slice(1),l(c).reverse().slice(1),
-m(f).reverse().slice(1))]}};a.extent=function(b){if(!arguments.length)return[[d,f],[c,e]];d=+b[0][0];c=+b[1][0];f=+b[0][1];e=+b[1][1];d>c&&(b=d,d=c,c=b);f>e&&(b=f,f=e,e=b);return a.precision(n)};a.step=function(b){if(!arguments.length)return[h,k];h=+b[0];k=+b[1];return a};a.precision=function(b){if(!arguments.length)return n;n=+b;l=Uf(f,e,n);m=Vf(d,c,n);return a};return a.extent([[-180+A,-90+A],[180-A,90-A]])};g.geo.interpolate=function(a,b){return Wf(a[0]*w,a[1]*w,b[0]*w,b[1]*w)};g.geo.greatArc=
-function(){function a(){for(var a=c||b.apply(this,arguments),l=e||d.apply(this,arguments),m=h||g.geo.interpolate(a,l),n=0,p=f/m.distance,a=[a];1>(n+=p);)a.push(m(n));a.push(l);return{type:"LineString",coordinates:a}}var b=sb,c,d=rb,e,f=6*w,h;a.distance=function(){return(h||g.geo.interpolate(c||b.apply(this,arguments),e||d.apply(this,arguments))).distance};a.source=function(d){if(!arguments.length)return b;b=d;h=(c="function"===typeof d?null:d)&&e?g.geo.interpolate(c,e):null;return a};a.target=function(b){if(!arguments.length)return d;
-d=b;e="function"===typeof b?null:b;h=c&&e?g.geo.interpolate(c,e):null;return a};a.precision=function(b){if(!arguments.length)return f/w;f=b*w;return a};return a};gc.invert=function(a,b){return[2*u*a,2*Math.atan(Math.exp(2*u*b))-u/2]};(g.geo.mercator=function(){return la(gc).scale(500)}).raw=gc;var ye=Fa(function(){return 1},Math.asin);(g.geo.orthographic=function(){return la(ye)}).raw=ye;g.geo.path=function(){function a(a){a&&g.geo.stream(a,e(f.pointRadius("function"===typeof b?+b.apply(this,arguments):
-b)));return f.result()}var b=4.5,c,d,e,f;a.area=function(a){pb=0;g.geo.stream(a,e(ja));return pb};a.centroid=function(a){N=J=K=I=0;g.geo.stream(a,e($));return I?[J/I,K/I]:void 0};a.bounds=function(a){return Rd(e)(a)};a.projection=function(b){if(!arguments.length)return c;e=(c=b)?b.stream||Xf(b):V;return a};a.context=function(b){if(!arguments.length)return d;f=null==(d=b)?new Yf:new Zf(b);return a};a.pointRadius=function(c){if(!arguments.length)return b;b="function"===typeof c?c:+c;return a};return a.projection(g.geo.albersUsa()).context(null)};
-var pb,bb,ja={point:T,lineStart:T,lineEnd:T,polygonStart:function(){bb=0;ja.lineStart=$f},polygonEnd:function(){ja.lineStart=ja.lineEnd=ja.point=T;pb+=Math.abs(bb/2)}},$={point:hc,lineStart:Zd,lineEnd:$d,polygonStart:function(){$.lineStart=ag},polygonEnd:function(){$.point=hc;$.lineStart=Zd;$.lineEnd=$d}};g.geo.area=function(a){ya=0;g.geo.stream(a,ka);return ya};var ya,cb,db,ka={sphere:function(){ya+=4*u},point:T,lineStart:T,lineEnd:T,polygonStart:function(){cb=1;db=0;ka.lineStart=bg},polygonEnd:function(){var a=
-2*Math.atan2(db,cb);ya+=0>a?4*u+a:a;ka.lineStart=ka.lineEnd=ka.point=T}};g.geo.projection=la;g.geo.projectionMutator=ic;var ze=Fa(function(a){return 1/(1+a)},function(a){return 2*Math.atan(a)});(g.geo.stereographic=function(){return la(ze)}).raw=ze;g.geom={};g.geom.hull=function(a){if(3>a.length)return[];var b=a.length,c=b-1,d=[],e=[],f,h=0,g,l,m,n,p,q,r;for(f=1;f<b;++f)a[f][1]<a[h][1]?h=f:a[f][1]==a[h][1]&&(h=a[f][0]<a[h][0]?f:h);for(f=0;f<b;++f)f!==h&&(l=a[f][1]-a[h][1],g=a[f][0]-a[h][0],d.push({angle:Math.atan2(l,
-g),index:f}));d.sort(function(a,b){return a.angle-b.angle});r=d[0].angle;q=d[0].index;p=0;for(f=1;f<c;++f)b=d[f].index,r==d[f].angle?(g=a[q][0]-a[h][0],l=a[q][1]-a[h][1],m=a[b][0]-a[h][0],n=a[b][1]-a[h][1],g*g+l*l>=m*m+n*n?d[f].index=-1:(d[p].index=-1,r=d[f].angle,p=f,q=b)):(r=d[f].angle,p=f,q=b);e.push(h);for(b=f=0;2>f;++b)-1!==d[b].index&&(e.push(d[b].index),f++);for(h=e.length;b<c;++b)if(-1!==d[b].index){for(;!dg(e[h-2],e[h-1],d[b].index,a);)--h;e[h++]=d[b].index}c=[];for(f=0;f<h;++f)c.push(a[e[f]]);
-return c};g.geom.polygon=function(a){a.area=function(){for(var b=0,c=a.length,d=a[c-1][1]*a[0][0]-a[c-1][0]*a[0][1];++b<c;)d+=a[b-1][1]*a[b][0]-a[b-1][0]*a[b][1];return.5*d};a.centroid=function(b){var c=-1,d=a.length,e=0,f=0,h,g=a[d-1],l;for(arguments.length||(b=-1/(6*a.area()));++c<d;)h=g,g=a[c],l=h[0]*g[1]-g[0]*h[1],e+=(h[0]+g[0])*l,f+=(h[1]+g[1])*l;return[e*b,f*b]};a.clip=function(b){for(var c,d=-1,e=a.length,f,h,g=a[e-1],l,m,n;++d<e;){c=b.slice();b.length=0;l=a[d];m=c[(h=c.length)-1];for(f=-1;++f<
-h;)n=c[f],jc(n,g,l)?(jc(m,g,l)||b.push(fe(m,n,g,l)),b.push(n)):jc(m,g,l)&&b.push(fe(m,n,g,l)),m=n;g=l}return b};return a};g.geom.voronoi=function(a){var b=a.map(function(){return[]});ge(a,function(a){var d,e,f,g;1===a.a&&0<=a.b?(d=a.ep.r,e=a.ep.l):(d=a.ep.l,e=a.ep.r);1===a.a?(f=d?d.y:-1E6,d=a.c-a.b*f,g=e?e.y:1E6,e=a.c-a.b*g):(d=d?d.x:-1E6,f=a.c-a.a*d,e=e?e.x:1E6,g=a.c-a.a*e);d=[d,f];e=[e,g];b[a.region.l.index].push(d,e);b[a.region.r.index].push(d,e)});b=b.map(function(b,d){var e=a[d][0],f=a[d][1],
-h=b.map(function(a){return Math.atan2(a[0]-e,a[1]-f)}),k=g.range(b.length).sort(function(a,b){return h[a]-h[b]});return k.filter(function(a,b){return!b||h[a]-h[k[b-1]]>A}).map(function(a){return b[a]})});b.forEach(function(b,d){var e=b.length;if(!e)return b.push([-1E6,-1E6],[-1E6,1E6],[1E6,1E6],[1E6,-1E6]);if(!(2<e)){var f=a[d],g=b[0],k=b[1],e=f[0],f=f[1],l=g[0],g=g[1],m=k[0],n=k[1],p=Math.abs(m-l),k=n-g;Math.abs(k)<A?(e=f<g?-1E6:1E6,b.push([-1E6,e],[1E6,e])):p<A?(e=e<l?-1E6:1E6,b.push([e,-1E6],[e,
-1E6])):(e=(m-l)*(g-f)<(l-e)*(n-g)?1E6:-1E6,f=Math.abs(k)-p,Math.abs(f)<A?b.push([0>k?e:-e,e]):(0<f&&(e*=-1),b.push([-1E6,e],[1E6,e])))}});return b};var kc={l:"r",r:"l"};g.geom.delaunay=function(a){var b=a.map(function(){return[]}),c=[];ge(a,function(c){b[c.region.l.index].push(a[c.region.r.index])});b.forEach(function(b,e){var f=a[e],g=f[0],k=f[1];b.forEach(function(a){a.angle=Math.atan2(a[0]-g,a[1]-k)});b.sort(function(a,b){return a.angle-b.angle});for(var l=0,m=b.length-1;l<m;l++)c.push([f,b[l],
-b[l+1]])});return c};g.geom.quadtree=function(a,b,c,d,e){function f(a,b,c,d,e,f){if(!isNaN(b.x)&&!isNaN(b.y))if(a.leaf){var k=a.point;k?(.01>Math.abs(k.x-b.x)+Math.abs(k.y-b.y)||(a.point=null,g(a,k,c,d,e,f)),g(a,b,c,d,e,f)):a.point=b}else g(a,b,c,d,e,f)}function g(a,b,c,d,e,h){var k=.5*(c+e),l=.5*(d+h),m=b.x>=k,n=b.y>=l,u=(n<<1)+m;a.leaf=!1;a=a.nodes[u]||(a.nodes[u]={leaf:!0,nodes:[],point:null});m?c=k:e=k;n?d=l:h=l;f(a,b,c,d,e,h)}var k,l=-1,m=a.length;if(5>arguments.length)if(3===arguments.length)e=
-c,d=b,c=b=0;else for(b=c=Infinity,d=e=-Infinity;++l<m;)k=a[l],k.x<b&&(b=k.x),k.y<c&&(c=k.y),k.x>d&&(d=k.x),k.y>e&&(e=k.y);k=d-b;l=e-c;k>l?e=c+k:d=b+l;var n={leaf:!0,nodes:[],point:null,add:function(a){f(n,a,b,c,d,e)},visit:function(a){Ga(a,n,b,c,d,e)}};a.forEach(n.add);return n};g.time={};var R=Date;oa.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},
-getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){ga.setUTCDate.apply(this._,arguments)},setDay:function(){ga.setUTCDay.apply(this._,arguments)},setFullYear:function(){ga.setUTCFullYear.apply(this._,
-arguments)},setHours:function(){ga.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){ga.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){ga.setUTCMinutes.apply(this._,arguments)},setMonth:function(){ga.setUTCMonth.apply(this._,arguments)},setSeconds:function(){ga.setUTCSeconds.apply(this._,arguments)},setTime:function(){ga.setTime.apply(this._,arguments)}};var ga=Date.prototype,Ae="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),Be="Sun Mon Tue Wed Thu Fri Sat".split(" "),
-wc="January February March April May June July August September October November December".split(" "),xc="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ");g.time.format=function(a){function b(b){for(var e=[],f=-1,g=0,k,l;++f<c;)if(37===a.charCodeAt(f)){e.push(a.substring(g,f));null!=(k=Fg[g=a.charAt(++f)])&&(g=a.charAt(++f));if(l=qb[g])g=l(b,null==k?"e"===g?" ":"0":k);e.push(g);g=f+1}e.push(a.substring(g,f));return e.join("")}var c=a.length;b.parse=function(b){var c={y:1900,m:0,d:1,H:0,
-M:0,S:0,L:0};if(eb(c,a,b,0)!=b.length)return null;"p"in c&&(c.H=c.H%12+12*c.p);b=new R;b.setFullYear(c.y,c.m,c.d);b.setHours(c.H,c.M,c.S,c.L);return b};b.toString=function(){return a};return b};var Ce=fb(Ae),De=fb(Be),Ee=fb(wc),Gg=he(wc),Fe=fb(xc),Hg=he(xc),Fg={"-":"",_:" ",0:"0"},qb={a:function(a){return Be[a.getDay()]},A:function(a){return Ae[a.getDay()]},b:function(a){return xc[a.getMonth()]},B:function(a){return wc[a.getMonth()]},c:g.time.format("%a %b %e %X %Y"),d:function(a,b){return S(a.getDate(),
-b,2)},e:function(a,b){return S(a.getDate(),b,2)},H:function(a,b){return S(a.getHours(),b,2)},I:function(a,b){return S(a.getHours()%12||12,b,2)},j:function(a,b){return S(1+g.time.dayOfYear(a),b,3)},L:function(a,b){return S(a.getMilliseconds(),b,3)},m:function(a,b){return S(a.getMonth()+1,b,2)},M:function(a,b){return S(a.getMinutes(),b,2)},p:function(a){return 12<=a.getHours()?"PM":"AM"},S:function(a,b){return S(a.getSeconds(),b,2)},U:function(a,b){return S(g.time.sundayOfYear(a),b,2)},w:function(a){return a.getDay()},
-W:function(a,b){return S(g.time.mondayOfYear(a),b,2)},x:g.time.format("%m/%d/%Y"),X:g.time.format("%H:%M:%S"),y:function(a,b){return S(a.getFullYear()%100,b,2)},Y:function(a,b){return S(a.getFullYear()%1E4,b,4)},Z:function(a){var b=a.getTimezoneOffset();a=0<b?"-":"+";var c=~~(Math.abs(b)/60),b=Math.abs(b)%60;return a+S(c,"0",2)+S(b,"0",2)},"%":function(){return"%"}},eg={a:function(a,b,c){De.lastIndex=0;return(a=De.exec(b.substring(c)))?c+a[0].length:-1},A:function(a,b,c){Ce.lastIndex=0;return(a=Ce.exec(b.substring(c)))?
-c+a[0].length:-1},b:function(a,b,c){Fe.lastIndex=0;return(b=Fe.exec(b.substring(c)))?(a.m=Hg.get(b[0].toLowerCase()),c+b[0].length):-1},B:function(a,b,c){Ee.lastIndex=0;return(b=Ee.exec(b.substring(c)))?(a.m=Gg.get(b[0].toLowerCase()),c+b[0].length):-1},c:function(a,b,c){return eb(a,qb.c.toString(),b,c)},d:ie,e:ie,H:je,I:je,L:function(a,b,c){Q.lastIndex=0;return(b=Q.exec(b.substring(c,c+3)))?(a.L=+b[0],c+b[0].length):-1},m:function(a,b,c){Q.lastIndex=0;return(b=Q.exec(b.substring(c,c+2)))?(a.m=b[0]-
-1,c+b[0].length):-1},M:function(a,b,c){Q.lastIndex=0;return(b=Q.exec(b.substring(c,c+2)))?(a.M=+b[0],c+b[0].length):-1},p:function(a,b,c){b=Ig.get(b.substring(c,c+=2).toLowerCase());return null==b?-1:(a.p=b,c)},S:function(a,b,c){Q.lastIndex=0;return(b=Q.exec(b.substring(c,c+2)))?(a.S=+b[0],c+b[0].length):-1},x:function(a,b,c){return eb(a,qb.x.toString(),b,c)},X:function(a,b,c){return eb(a,qb.X.toString(),b,c)},y:function(a,b,c){Q.lastIndex=0;if(b=Q.exec(b.substring(c,c+2))){var d=+b[0];a=(a.y=d+(68<
-d?1900:2E3),c+b[0].length)}else a=-1;return a},Y:function(a,b,c){Q.lastIndex=0;return(b=Q.exec(b.substring(c,c+4)))?(a.y=+b[0],c+b[0].length):-1}},Q=/^\s*\d+/,Ig=g.map({am:0,pm:1});g.time.format.utc=function(a){function b(a){try{R=oa;var b=new R;b._=a;return c(b)}finally{R=Date}}var c=g.time.format(a);b.parse=function(a){try{R=oa;var b=c.parse(a);return b&&b._}finally{R=Date}};b.toString=c.toString;return b};var Ge=g.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");g.time.format.iso=Date.prototype.toISOString?
-lc:Ge;lc.parse=function(a){a=new Date(a);return isNaN(a)?null:a};lc.toString=Ge.toString;g.time.second=pa(function(a){return new R(1E3*Math.floor(a/1E3))},function(a,b){a.setTime(a.getTime()+1E3*Math.floor(b))},function(a){return a.getSeconds()});g.time.seconds=g.time.second.range;g.time.seconds.utc=g.time.second.utc.range;g.time.minute=pa(function(a){return new R(6E4*Math.floor(a/6E4))},function(a,b){a.setTime(a.getTime()+6E4*Math.floor(b))},function(a){return a.getMinutes()});g.time.minutes=g.time.minute.range;
-g.time.minutes.utc=g.time.minute.utc.range;g.time.hour=pa(function(a){var b=a.getTimezoneOffset()/60;return new R(36E5*(Math.floor(a/36E5-b)+b))},function(a,b){a.setTime(a.getTime()+36E5*Math.floor(b))},function(a){return a.getHours()});g.time.hours=g.time.hour.range;g.time.hours.utc=g.time.hour.utc.range;g.time.day=pa(function(a){var b=new R(1970,0);b.setFullYear(a.getFullYear(),a.getMonth(),a.getDate());return b},function(a,b){a.setDate(a.getDate()+b)},function(a){return a.getDate()-1});g.time.days=
-g.time.day.range;g.time.days.utc=g.time.day.utc.range;g.time.dayOfYear=function(a){var b=g.time.year(a);return Math.floor((a-b-6E4*(a.getTimezoneOffset()-b.getTimezoneOffset()))/864E5)};"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ").forEach(function(a,b){a=a.toLowerCase();b=7-b;var c=g.time[a]=pa(function(a){(a=g.time.day(a)).setDate(a.getDate()-(a.getDay()+b)%7);return a},function(a,b){a.setDate(a.getDate()+7*Math.floor(b))},function(a){var c=g.time.year(a).getDay();return Math.floor((g.time.dayOfYear(a)+
-(c+b)%7)/7)-(c!==b)});g.time[a+"s"]=c.range;g.time[a+"s"].utc=c.utc.range;g.time[a+"OfYear"]=function(a){var c=g.time.year(a).getDay();return Math.floor((g.time.dayOfYear(a)+(c+b)%7)/7)}});g.time.week=g.time.sunday;g.time.weeks=g.time.sunday.range;g.time.weeks.utc=g.time.sunday.utc.range;g.time.weekOfYear=g.time.sundayOfYear;g.time.month=pa(function(a){a=g.time.day(a);a.setDate(1);return a},function(a,b){a.setMonth(a.getMonth()+b)},function(a){return a.getMonth()});g.time.months=g.time.month.range;
-g.time.months.utc=g.time.month.utc.range;g.time.year=pa(function(a){a=g.time.day(a);a.setMonth(0,1);return a},function(a,b){a.setFullYear(a.getFullYear()+b)},function(a){return a.getFullYear()});g.time.years=g.time.year.range;g.time.years.utc=g.time.year.utc.range;var hb=[1E3,5E3,15E3,3E4,6E4,3E5,9E5,18E5,36E5,108E5,216E5,432E5,864E5,1728E5,6048E5,2592E6,7776E6,31536E6],yc=[[g.time.second,1],[g.time.second,5],[g.time.second,15],[g.time.second,30],[g.time.minute,1],[g.time.minute,5],[g.time.minute,
-15],[g.time.minute,30],[g.time.hour,1],[g.time.hour,3],[g.time.hour,6],[g.time.hour,12],[g.time.day,1],[g.time.day,2],[g.time.week,1],[g.time.month,1],[g.time.month,3],[g.time.year,1]],Jg=[[g.time.format("%Y"),za],[g.time.format("%B"),function(a){return a.getMonth()}],[g.time.format("%b %d"),function(a){return 1!=a.getDate()}],[g.time.format("%a %d"),function(a){return a.getDay()&&1!=a.getDate()}],[g.time.format("%I %p"),function(a){return a.getHours()}],[g.time.format("%I:%M"),function(a){return a.getMinutes()}],
-[g.time.format(":%S"),function(a){return a.getSeconds()}],[g.time.format(".%L"),function(a){return a.getMilliseconds()}]],He=g.scale.linear(),Kg=ke(Jg);yc.year=function(a,b){return He.domain(a.map(fg)).ticks(b).map(oc)};g.time.scale=function(){return mc(g.scale.linear(),yc,Kg)};var Ie=yc.map(function(a){return[a[0].utc,a[1]]}),Lg=[[g.time.format.utc("%Y"),za],[g.time.format.utc("%B"),function(a){return a.getUTCMonth()}],[g.time.format.utc("%b %d"),function(a){return 1!=a.getUTCDate()}],[g.time.format.utc("%a %d"),
-function(a){return a.getUTCDay()&&1!=a.getUTCDate()}],[g.time.format.utc("%I %p"),function(a){return a.getUTCHours()}],[g.time.format.utc("%I:%M"),function(a){return a.getUTCMinutes()}],[g.time.format.utc(":%S"),function(a){return a.getUTCSeconds()}],[g.time.format.utc(".%L"),function(a){return a.getUTCMilliseconds()}]],Mg=ke(Lg);Ie.year=function(a,b){return He.domain(a.map(gg)).ticks(b).map(pc)};g.time.scale.utc=function(){return mc(g.scale.linear(),Ie,Mg)};return g}();