From c7597bb1ec7c6b7984895f0af5786094acb25543 Mon Sep 17 00:00:00 2001 From: Mario Romano Date: Thu, 7 Apr 2016 20:38:44 +0100 Subject: [PATCH] comunication between components --- bower_components/iron-signals/.bower.json | 39 + bower_components/iron-signals/.gitignore | 1 + bower_components/iron-signals/.travis.yml | 22 + bower_components/iron-signals/CONTRIBUTING.md | 72 + bower_components/iron-signals/README.md | 38 + bower_components/iron-signals/bower.json | 29 + bower_components/iron-signals/demo/index.html | 52 + bower_components/iron-signals/index.html | 23 + .../iron-signals/iron-signals.html | 81 + bower_components/polymer/.bower.json | 39 + bower_components/polymer/LICENSE.txt | 27 + bower_components/polymer/bower.json | 29 + bower_components/polymer/polymer-micro.html | 685 ++ bower_components/polymer/polymer-mini.html | 2166 +++++ bower_components/polymer/polymer.html | 4816 +++++++++++ bower_components/webcomponentsjs/.bower.json | 30 + .../webcomponentsjs/CustomElements.js | 1041 +++ .../webcomponentsjs/CustomElements.min.js | 11 + .../webcomponentsjs/HTMLImports.js | 1157 +++ .../webcomponentsjs/HTMLImports.min.js | 11 + .../webcomponentsjs/MutationObserver.js | 350 + .../webcomponentsjs/MutationObserver.min.js | 11 + bower_components/webcomponentsjs/README.md | 155 + bower_components/webcomponentsjs/ShadowDOM.js | 4493 ++++++++++ .../webcomponentsjs/ShadowDOM.min.js | 13 + bower_components/webcomponentsjs/bower.json | 21 + bower_components/webcomponentsjs/package.json | 31 + .../webcomponentsjs/webcomponents-lite.js | 2501 ++++++ .../webcomponentsjs/webcomponents-lite.min.js | 12 + .../webcomponentsjs/webcomponents.js | 7218 +++++++++++++++++ .../webcomponentsjs/webcomponents.min.js | 14 + .../bower_components/iron-signals/README.md | 3 + .../bower_components/iron-signals/index.html | 26 + web-components/alfresco-file-list/README.md | 8 + .../src/alfresco-file-list.html | 9 +- web-components/file-upload/README.md | 8 + web-components/file-upload/file-upload.html | 14 +- 37 files changed, 25254 insertions(+), 2 deletions(-) create mode 100644 bower_components/iron-signals/.bower.json create mode 100644 bower_components/iron-signals/.gitignore create mode 100644 bower_components/iron-signals/.travis.yml create mode 100644 bower_components/iron-signals/CONTRIBUTING.md create mode 100644 bower_components/iron-signals/README.md create mode 100644 bower_components/iron-signals/bower.json create mode 100644 bower_components/iron-signals/demo/index.html create mode 100644 bower_components/iron-signals/index.html create mode 100644 bower_components/iron-signals/iron-signals.html create mode 100644 bower_components/polymer/.bower.json create mode 100644 bower_components/polymer/LICENSE.txt create mode 100644 bower_components/polymer/bower.json create mode 100644 bower_components/polymer/polymer-micro.html create mode 100644 bower_components/polymer/polymer-mini.html create mode 100644 bower_components/polymer/polymer.html create mode 100644 bower_components/webcomponentsjs/.bower.json create mode 100644 bower_components/webcomponentsjs/CustomElements.js create mode 100644 bower_components/webcomponentsjs/CustomElements.min.js create mode 100644 bower_components/webcomponentsjs/HTMLImports.js create mode 100644 bower_components/webcomponentsjs/HTMLImports.min.js create mode 100644 bower_components/webcomponentsjs/MutationObserver.js create mode 100644 bower_components/webcomponentsjs/MutationObserver.min.js create mode 100644 bower_components/webcomponentsjs/README.md create mode 100644 bower_components/webcomponentsjs/ShadowDOM.js create mode 100644 bower_components/webcomponentsjs/ShadowDOM.min.js create mode 100644 bower_components/webcomponentsjs/bower.json create mode 100644 bower_components/webcomponentsjs/package.json create mode 100644 bower_components/webcomponentsjs/webcomponents-lite.js create mode 100644 bower_components/webcomponentsjs/webcomponents-lite.min.js create mode 100644 bower_components/webcomponentsjs/webcomponents.js create mode 100644 bower_components/webcomponentsjs/webcomponents.min.js diff --git a/bower_components/iron-signals/.bower.json b/bower_components/iron-signals/.bower.json new file mode 100644 index 0000000000..7b32d2f3ee --- /dev/null +++ b/bower_components/iron-signals/.bower.json @@ -0,0 +1,39 @@ +{ + "name": "iron-signals", + "version": "1.0.3", + "description": "Basic publish-subscribe functionality", + "keywords": [ + "web-component", + "polymer", + "signals" + ], + "authors": [ + "The Polymer Authors" + ], + "repository": { + "type": "git", + "url": "git://github.com/PolymerElements/iron-signals.git" + }, + "main": "iron-signals.html", + "license": "http://polymer.github.io/LICENSE.txt", + "homepage": "https://github.com/PolymerElements/iron-signals/", + "dependencies": { + "polymer": "Polymer/polymer#^1.0.0" + }, + "devDependencies": { + "paper-styles": "PolymerElements/paper-styles#^1.0.2", + "iron-component-page": "PolymerElements/iron-component-page#^1.0.0", + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" + }, + "ignore": [], + "_release": "1.0.3", + "_resolution": { + "type": "version", + "tag": "v1.0.3", + "commit": "95dbcefcc0fcb5c7c639d7bae35774269ac7081a" + }, + "_source": "git://github.com/PolymerElements/iron-signals.git", + "_target": "~1.0.3", + "_originalSource": "PolymerElements/iron-signals", + "_direct": true +} \ No newline at end of file diff --git a/bower_components/iron-signals/.gitignore b/bower_components/iron-signals/.gitignore new file mode 100644 index 0000000000..8d4ae2536a --- /dev/null +++ b/bower_components/iron-signals/.gitignore @@ -0,0 +1 @@ +bower_components diff --git a/bower_components/iron-signals/.travis.yml b/bower_components/iron-signals/.travis.yml new file mode 100644 index 0000000000..7ad4c94fb8 --- /dev/null +++ b/bower_components/iron-signals/.travis.yml @@ -0,0 +1,22 @@ +language: node_js +sudo: false +before_script: + - npm install web-component-tester + - npm install bower + - 'export PATH=$PWD/node_modules/.bin:$PATH' + - bower install +env: + global: + - secure: Ow7qCwI/k4tl7r491MyEcxOmnbBC2wQV9YifaBeiI6VPRmasy8I9NShIidVepv1EVznVcp+ZGGVeggpEFQWdnDGOKDORtjI0IoRkcHfzD9I+bAAJemnfhnrC/qJO6Ef620VdRofqyMQOBntpzU/ju5bZfl9D/Vp9Tqe2pOkDF6s= + - secure: nBva4HhjWS/f43MrKNxVEImHW9csrV2aEAQhQjtLq8Tz8S7VwP1HqZfIgI2QQ7OEpYNVkz/3vQNutQWVCx6Pp/qmVfRt/K4oIsF7qIfSBz70hcv7AWxicOF3Lxf59peh7MZb8nFAZCMjGgZrmIgXUdJIve/8LaPXwYf+QuFBS68= +node_js: 4 +addons: + firefox: '42.0' + apt: + sources: + - google-chrome + packages: + - google-chrome-stable +script: + - xvfb-run wct + - "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi" diff --git a/bower_components/iron-signals/CONTRIBUTING.md b/bower_components/iron-signals/CONTRIBUTING.md new file mode 100644 index 0000000000..7b10141565 --- /dev/null +++ b/bower_components/iron-signals/CONTRIBUTING.md @@ -0,0 +1,72 @@ + + +# Polymer Elements +## Guide for Contributors + +Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines: + +### Filing Issues + +**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions: + + 1. **Who will use the feature?** _“As someone filling out a form…”_ + 2. **When will they use the feature?** _“When I enter an invalid value…”_ + 3. **What is the user’s goal?** _“I want to be visually notified that the value needs to be corrected…”_ + +**If you are filing an issue to report a bug**, please provide: + + 1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug: + + ```markdown + The `paper-foo` element causes the page to turn pink when clicked. + + ## Expected outcome + + The page stays the same color. + + ## Actual outcome + + The page turns pink. + + ## Steps to reproduce + + 1. Put a `paper-foo` element in the page. + 2. Open the page in a web browser. + 3. Click the `paper-foo` element. + ``` + + 2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [http://jsbin.com/cagaye](http://jsbin.com/cagaye/edit?html,output). + + 3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers. + +### Submitting Pull Requests + +**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request. + +When submitting pull requests, please provide: + + 1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues using the following syntax: + + ```markdown + (For a single issue) + Fixes #20 + + (For multiple issues) + Fixes #32, #40 + ``` + + 2. **A succinct description of the design** used to fix any related issues. For example: + + ```markdown + This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked. + ``` + + 3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered. + +If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so don’t be afraid to ask us if you need help with that! diff --git a/bower_components/iron-signals/README.md b/bower_components/iron-signals/README.md new file mode 100644 index 0000000000..a6a376c725 --- /dev/null +++ b/bower_components/iron-signals/README.md @@ -0,0 +1,38 @@ + + + +[![Build Status](https://travis-ci.org/PolymerElements/iron-signals.svg?branch=master)](https://travis-ci.org/PolymerElements/iron-signals) + +_[Demo and API Docs](https://elements.polymer-project.org/elements/iron-signals)_ + + +##<iron-signals> + + +`iron-signals` provides basic publish-subscribe functionality. + +Note: avoid using `iron-signals` whenever you can use +a controller (parent element) to mediate communication +instead. + +To send a signal, fire a custom event of type `iron-signal`, with +a detail object containing `name` and `data` fields. + + this.fire('iron-signal', {name: 'hello', data: null}); + +To receive a signal, listen for `iron-signal-` event on a +`iron-signals` element. + + + +You can fire a signal event from anywhere, and all +`iron-signals` elements will receive the event, regardless +of where they are in DOM. diff --git a/bower_components/iron-signals/bower.json b/bower_components/iron-signals/bower.json new file mode 100644 index 0000000000..184b4e01cf --- /dev/null +++ b/bower_components/iron-signals/bower.json @@ -0,0 +1,29 @@ +{ + "name": "iron-signals", + "version": "1.0.3", + "description": "Basic publish-subscribe functionality", + "keywords": [ + "web-component", + "polymer", + "signals" + ], + "authors": [ + "The Polymer Authors" + ], + "repository": { + "type": "git", + "url": "git://github.com/PolymerElements/iron-signals.git" + }, + "main": "iron-signals.html", + "license": "http://polymer.github.io/LICENSE.txt", + "homepage": "https://github.com/PolymerElements/iron-signals/", + "dependencies": { + "polymer": "Polymer/polymer#^1.0.0" + }, + "devDependencies": { + "paper-styles": "PolymerElements/paper-styles#^1.0.2", + "iron-component-page": "PolymerElements/iron-component-page#^1.0.0", + "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" + }, + "ignore": [] +} diff --git a/bower_components/iron-signals/demo/index.html b/bower_components/iron-signals/demo/index.html new file mode 100644 index 0000000000..494cba17c8 --- /dev/null +++ b/bower_components/iron-signals/demo/index.html @@ -0,0 +1,52 @@ + + + + + iron-signals demo + + + + + + + + + + + +
+ +

<iron-signal>

+ + + + +
+ + + + + diff --git a/bower_components/iron-signals/index.html b/bower_components/iron-signals/index.html new file mode 100644 index 0000000000..246af101d1 --- /dev/null +++ b/bower_components/iron-signals/index.html @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + diff --git a/bower_components/iron-signals/iron-signals.html b/bower_components/iron-signals/iron-signals.html new file mode 100644 index 0000000000..dcf2e59418 --- /dev/null +++ b/bower_components/iron-signals/iron-signals.html @@ -0,0 +1,81 @@ + + + + diff --git a/bower_components/polymer/.bower.json b/bower_components/polymer/.bower.json new file mode 100644 index 0000000000..3e8a4009a3 --- /dev/null +++ b/bower_components/polymer/.bower.json @@ -0,0 +1,39 @@ +{ + "name": "polymer", + "version": "1.4.0", + "main": [ + "polymer.html", + "polymer-mini.html", + "polymer-micro.html" + ], + "license": "http://polymer.github.io/LICENSE.txt", + "ignore": [ + "/.*", + "/test/", + "gen-changelog.sh" + ], + "authors": [ + "The Polymer Authors (http://polymer.github.io/AUTHORS.txt)" + ], + "repository": { + "type": "git", + "url": "https://github.com/Polymer/polymer.git" + }, + "dependencies": { + "webcomponentsjs": "^0.7.20" + }, + "devDependencies": { + "web-component-tester": "*" + }, + "private": true, + "homepage": "https://github.com/Polymer/polymer", + "_release": "1.4.0", + "_resolution": { + "type": "version", + "tag": "v1.4.0", + "commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514" + }, + "_source": "git://github.com/Polymer/polymer.git", + "_target": "^1.0.0", + "_originalSource": "Polymer/polymer" +} \ No newline at end of file diff --git a/bower_components/polymer/LICENSE.txt b/bower_components/polymer/LICENSE.txt new file mode 100644 index 0000000000..95987bac86 --- /dev/null +++ b/bower_components/polymer/LICENSE.txt @@ -0,0 +1,27 @@ +// Copyright (c) 2014 The Polymer Authors. 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may 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 THE COPYRIGHT +// OWNER OR CONTRIBUTORS 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. diff --git a/bower_components/polymer/bower.json b/bower_components/polymer/bower.json new file mode 100644 index 0000000000..a3174857ed --- /dev/null +++ b/bower_components/polymer/bower.json @@ -0,0 +1,29 @@ +{ + "name": "polymer", + "version": "1.4.0", + "main": [ + "polymer.html", + "polymer-mini.html", + "polymer-micro.html" + ], + "license": "http://polymer.github.io/LICENSE.txt", + "ignore": [ + "/.*", + "/test/", + "gen-changelog.sh" + ], + "authors": [ + "The Polymer Authors (http://polymer.github.io/AUTHORS.txt)" + ], + "repository": { + "type": "git", + "url": "https://github.com/Polymer/polymer.git" + }, + "dependencies": { + "webcomponentsjs": "^0.7.20" + }, + "devDependencies": { + "web-component-tester": "*" + }, + "private": true +} diff --git a/bower_components/polymer/polymer-micro.html b/bower_components/polymer/polymer-micro.html new file mode 100644 index 0000000000..cd3b5ea525 --- /dev/null +++ b/bower_components/polymer/polymer-micro.html @@ -0,0 +1,685 @@ + + + + + \ No newline at end of file diff --git a/bower_components/polymer/polymer-mini.html b/bower_components/polymer/polymer-mini.html new file mode 100644 index 0000000000..7b5df9c933 --- /dev/null +++ b/bower_components/polymer/polymer-mini.html @@ -0,0 +1,2166 @@ + + + + + \ No newline at end of file diff --git a/bower_components/polymer/polymer.html b/bower_components/polymer/polymer.html new file mode 100644 index 0000000000..c94128b7fe --- /dev/null +++ b/bower_components/polymer/polymer.html @@ -0,0 +1,4816 @@ + + + + + diff --git a/bower_components/webcomponentsjs/.bower.json b/bower_components/webcomponentsjs/.bower.json new file mode 100644 index 0000000000..bb8c8070f1 --- /dev/null +++ b/bower_components/webcomponentsjs/.bower.json @@ -0,0 +1,30 @@ +{ + "name": "webcomponentsjs", + "main": "webcomponents.js", + "version": "0.7.21", + "homepage": "http://webcomponents.org", + "authors": [ + "The Polymer Authors" + ], + "repository": { + "type": "git", + "url": "https://github.com/webcomponents/webcomponentsjs.git" + }, + "keywords": [ + "webcomponents" + ], + "license": "BSD", + "ignore": [], + "devDependencies": { + "web-component-tester": "^4.0.1" + }, + "_release": "0.7.21", + "_resolution": { + "type": "version", + "tag": "v0.7.21", + "commit": "19ffcd921e1aef84b55f515b00eb56e8e9116126" + }, + "_source": "https://github.com/Polymer/webcomponentsjs.git", + "_target": "^0.7.20", + "_originalSource": "webcomponentsjs" +} \ No newline at end of file diff --git a/bower_components/webcomponentsjs/CustomElements.js b/bower_components/webcomponentsjs/CustomElements.js new file mode 100644 index 0000000000..85cc7e29fe --- /dev/null +++ b/bower_components/webcomponentsjs/CustomElements.js @@ -0,0 +1,1041 @@ +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ +// @version 0.7.21 +if (typeof WeakMap === "undefined") { + (function() { + var defineProperty = Object.defineProperty; + var counter = Date.now() % 1e9; + var WeakMap = function() { + this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__"); + }; + WeakMap.prototype = { + set: function(key, value) { + var entry = key[this.name]; + if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, { + value: [ key, value ], + writable: true + }); + return this; + }, + get: function(key) { + var entry; + return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined; + }, + "delete": function(key) { + var entry = key[this.name]; + if (!entry || entry[0] !== key) return false; + entry[0] = entry[1] = undefined; + return true; + }, + has: function(key) { + var entry = key[this.name]; + if (!entry) return false; + return entry[0] === key; + } + }; + window.WeakMap = WeakMap; + })(); +} + +(function(global) { + if (global.JsMutationObserver) { + return; + } + var registrationsTable = new WeakMap(); + var setImmediate; + if (/Trident|Edge/.test(navigator.userAgent)) { + setImmediate = setTimeout; + } else if (window.setImmediate) { + setImmediate = window.setImmediate; + } else { + var setImmediateQueue = []; + var sentinel = String(Math.random()); + window.addEventListener("message", function(e) { + if (e.data === sentinel) { + var queue = setImmediateQueue; + setImmediateQueue = []; + queue.forEach(function(func) { + func(); + }); + } + }); + setImmediate = function(func) { + setImmediateQueue.push(func); + window.postMessage(sentinel, "*"); + }; + } + var isScheduled = false; + var scheduledObservers = []; + function scheduleCallback(observer) { + scheduledObservers.push(observer); + if (!isScheduled) { + isScheduled = true; + setImmediate(dispatchCallbacks); + } + } + function wrapIfNeeded(node) { + return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node; + } + function dispatchCallbacks() { + isScheduled = false; + var observers = scheduledObservers; + scheduledObservers = []; + observers.sort(function(o1, o2) { + return o1.uid_ - o2.uid_; + }); + var anyNonEmpty = false; + observers.forEach(function(observer) { + var queue = observer.takeRecords(); + removeTransientObserversFor(observer); + if (queue.length) { + observer.callback_(queue, observer); + anyNonEmpty = true; + } + }); + if (anyNonEmpty) dispatchCallbacks(); + } + function removeTransientObserversFor(observer) { + observer.nodes_.forEach(function(node) { + var registrations = registrationsTable.get(node); + if (!registrations) return; + registrations.forEach(function(registration) { + if (registration.observer === observer) registration.removeTransientObservers(); + }); + }); + } + function forEachAncestorAndObserverEnqueueRecord(target, callback) { + for (var node = target; node; node = node.parentNode) { + var registrations = registrationsTable.get(node); + if (registrations) { + for (var j = 0; j < registrations.length; j++) { + var registration = registrations[j]; + var options = registration.options; + if (node !== target && !options.subtree) continue; + var record = callback(options); + if (record) registration.enqueue(record); + } + } + } + } + var uidCounter = 0; + function JsMutationObserver(callback) { + this.callback_ = callback; + this.nodes_ = []; + this.records_ = []; + this.uid_ = ++uidCounter; + } + JsMutationObserver.prototype = { + observe: function(target, options) { + target = wrapIfNeeded(target); + if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) { + throw new SyntaxError(); + } + var registrations = registrationsTable.get(target); + if (!registrations) registrationsTable.set(target, registrations = []); + var registration; + for (var i = 0; i < registrations.length; i++) { + if (registrations[i].observer === this) { + registration = registrations[i]; + registration.removeListeners(); + registration.options = options; + break; + } + } + if (!registration) { + registration = new Registration(this, target, options); + registrations.push(registration); + this.nodes_.push(target); + } + registration.addListeners(); + }, + disconnect: function() { + this.nodes_.forEach(function(node) { + var registrations = registrationsTable.get(node); + for (var i = 0; i < registrations.length; i++) { + var registration = registrations[i]; + if (registration.observer === this) { + registration.removeListeners(); + registrations.splice(i, 1); + break; + } + } + }, this); + this.records_ = []; + }, + takeRecords: function() { + var copyOfRecords = this.records_; + this.records_ = []; + return copyOfRecords; + } + }; + function MutationRecord(type, target) { + this.type = type; + this.target = target; + this.addedNodes = []; + this.removedNodes = []; + this.previousSibling = null; + this.nextSibling = null; + this.attributeName = null; + this.attributeNamespace = null; + this.oldValue = null; + } + function copyMutationRecord(original) { + var record = new MutationRecord(original.type, original.target); + record.addedNodes = original.addedNodes.slice(); + record.removedNodes = original.removedNodes.slice(); + record.previousSibling = original.previousSibling; + record.nextSibling = original.nextSibling; + record.attributeName = original.attributeName; + record.attributeNamespace = original.attributeNamespace; + record.oldValue = original.oldValue; + return record; + } + var currentRecord, recordWithOldValue; + function getRecord(type, target) { + return currentRecord = new MutationRecord(type, target); + } + function getRecordWithOldValue(oldValue) { + if (recordWithOldValue) return recordWithOldValue; + recordWithOldValue = copyMutationRecord(currentRecord); + recordWithOldValue.oldValue = oldValue; + return recordWithOldValue; + } + function clearRecords() { + currentRecord = recordWithOldValue = undefined; + } + function recordRepresentsCurrentMutation(record) { + return record === recordWithOldValue || record === currentRecord; + } + function selectRecord(lastRecord, newRecord) { + if (lastRecord === newRecord) return lastRecord; + if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue; + return null; + } + function Registration(observer, target, options) { + this.observer = observer; + this.target = target; + this.options = options; + this.transientObservedNodes = []; + } + Registration.prototype = { + enqueue: function(record) { + var records = this.observer.records_; + var length = records.length; + if (records.length > 0) { + var lastRecord = records[length - 1]; + var recordToReplaceLast = selectRecord(lastRecord, record); + if (recordToReplaceLast) { + records[length - 1] = recordToReplaceLast; + return; + } + } else { + scheduleCallback(this.observer); + } + records[length] = record; + }, + addListeners: function() { + this.addListeners_(this.target); + }, + addListeners_: function(node) { + var options = this.options; + if (options.attributes) node.addEventListener("DOMAttrModified", this, true); + if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true); + if (options.childList) node.addEventListener("DOMNodeInserted", this, true); + if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true); + }, + removeListeners: function() { + this.removeListeners_(this.target); + }, + removeListeners_: function(node) { + var options = this.options; + if (options.attributes) node.removeEventListener("DOMAttrModified", this, true); + if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true); + if (options.childList) node.removeEventListener("DOMNodeInserted", this, true); + if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true); + }, + addTransientObserver: function(node) { + if (node === this.target) return; + this.addListeners_(node); + this.transientObservedNodes.push(node); + var registrations = registrationsTable.get(node); + if (!registrations) registrationsTable.set(node, registrations = []); + registrations.push(this); + }, + removeTransientObservers: function() { + var transientObservedNodes = this.transientObservedNodes; + this.transientObservedNodes = []; + transientObservedNodes.forEach(function(node) { + this.removeListeners_(node); + var registrations = registrationsTable.get(node); + for (var i = 0; i < registrations.length; i++) { + if (registrations[i] === this) { + registrations.splice(i, 1); + break; + } + } + }, this); + }, + handleEvent: function(e) { + e.stopImmediatePropagation(); + switch (e.type) { + case "DOMAttrModified": + var name = e.attrName; + var namespace = e.relatedNode.namespaceURI; + var target = e.target; + var record = new getRecord("attributes", target); + record.attributeName = name; + record.attributeNamespace = namespace; + var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.attributes) return; + if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) { + return; + } + if (options.attributeOldValue) return getRecordWithOldValue(oldValue); + return record; + }); + break; + + case "DOMCharacterDataModified": + var target = e.target; + var record = getRecord("characterData", target); + var oldValue = e.prevValue; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.characterData) return; + if (options.characterDataOldValue) return getRecordWithOldValue(oldValue); + return record; + }); + break; + + case "DOMNodeRemoved": + this.addTransientObserver(e.target); + + case "DOMNodeInserted": + var changedNode = e.target; + var addedNodes, removedNodes; + if (e.type === "DOMNodeInserted") { + addedNodes = [ changedNode ]; + removedNodes = []; + } else { + addedNodes = []; + removedNodes = [ changedNode ]; + } + var previousSibling = changedNode.previousSibling; + var nextSibling = changedNode.nextSibling; + var record = getRecord("childList", e.target.parentNode); + record.addedNodes = addedNodes; + record.removedNodes = removedNodes; + record.previousSibling = previousSibling; + record.nextSibling = nextSibling; + forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) { + if (!options.childList) return; + return record; + }); + } + clearRecords(); + } + }; + global.JsMutationObserver = JsMutationObserver; + if (!global.MutationObserver) { + global.MutationObserver = JsMutationObserver; + JsMutationObserver._isPolyfilled = true; + } +})(self); + +(function(scope) { + "use strict"; + if (!window.performance) { + var start = Date.now(); + window.performance = { + now: function() { + return Date.now() - start; + } + }; + } + if (!window.requestAnimationFrame) { + window.requestAnimationFrame = function() { + var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; + return nativeRaf ? function(callback) { + return nativeRaf(function() { + callback(performance.now()); + }); + } : function(callback) { + return window.setTimeout(callback, 1e3 / 60); + }; + }(); + } + if (!window.cancelAnimationFrame) { + window.cancelAnimationFrame = function() { + return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) { + clearTimeout(id); + }; + }(); + } + var workingDefaultPrevented = function() { + var e = document.createEvent("Event"); + e.initEvent("foo", true, true); + e.preventDefault(); + return e.defaultPrevented; + }(); + if (!workingDefaultPrevented) { + var origPreventDefault = Event.prototype.preventDefault; + Event.prototype.preventDefault = function() { + if (!this.cancelable) { + return; + } + origPreventDefault.call(this); + Object.defineProperty(this, "defaultPrevented", { + get: function() { + return true; + }, + configurable: true + }); + }; + } + var isIE = /Trident/.test(navigator.userAgent); + if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") { + window.CustomEvent = function(inType, params) { + params = params || {}; + var e = document.createEvent("CustomEvent"); + e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail); + return e; + }; + window.CustomEvent.prototype = window.Event.prototype; + } + if (!window.Event || isIE && typeof window.Event !== "function") { + var origEvent = window.Event; + window.Event = function(inType, params) { + params = params || {}; + var e = document.createEvent("Event"); + e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable)); + return e; + }; + window.Event.prototype = origEvent.prototype; + } +})(window.WebComponents); + +window.CustomElements = window.CustomElements || { + flags: {} +}; + +(function(scope) { + var flags = scope.flags; + var modules = []; + var addModule = function(module) { + modules.push(module); + }; + var initializeModules = function() { + modules.forEach(function(module) { + module(scope); + }); + }; + scope.addModule = addModule; + scope.initializeModules = initializeModules; + scope.hasNative = Boolean(document.registerElement); + scope.isIE = /Trident/.test(navigator.userAgent); + scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || window.HTMLImports.useNative); +})(window.CustomElements); + +window.CustomElements.addModule(function(scope) { + var IMPORT_LINK_TYPE = window.HTMLImports ? window.HTMLImports.IMPORT_LINK_TYPE : "none"; + function forSubtree(node, cb) { + findAllElements(node, function(e) { + if (cb(e)) { + return true; + } + forRoots(e, cb); + }); + forRoots(node, cb); + } + function findAllElements(node, find, data) { + var e = node.firstElementChild; + if (!e) { + e = node.firstChild; + while (e && e.nodeType !== Node.ELEMENT_NODE) { + e = e.nextSibling; + } + } + while (e) { + if (find(e, data) !== true) { + findAllElements(e, find, data); + } + e = e.nextElementSibling; + } + return null; + } + function forRoots(node, cb) { + var root = node.shadowRoot; + while (root) { + forSubtree(root, cb); + root = root.olderShadowRoot; + } + } + function forDocumentTree(doc, cb) { + _forDocumentTree(doc, cb, []); + } + function _forDocumentTree(doc, cb, processingDocuments) { + doc = window.wrap(doc); + if (processingDocuments.indexOf(doc) >= 0) { + return; + } + processingDocuments.push(doc); + var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]"); + for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) { + if (n.import) { + _forDocumentTree(n.import, cb, processingDocuments); + } + } + cb(doc); + } + scope.forDocumentTree = forDocumentTree; + scope.forSubtree = forSubtree; +}); + +window.CustomElements.addModule(function(scope) { + var flags = scope.flags; + var forSubtree = scope.forSubtree; + var forDocumentTree = scope.forDocumentTree; + function addedNode(node, isAttached) { + return added(node, isAttached) || addedSubtree(node, isAttached); + } + function added(node, isAttached) { + if (scope.upgrade(node, isAttached)) { + return true; + } + if (isAttached) { + attached(node); + } + } + function addedSubtree(node, isAttached) { + forSubtree(node, function(e) { + if (added(e, isAttached)) { + return true; + } + }); + } + var hasThrottledAttached = window.MutationObserver._isPolyfilled && flags["throttle-attached"]; + scope.hasPolyfillMutations = hasThrottledAttached; + scope.hasThrottledAttached = hasThrottledAttached; + var isPendingMutations = false; + var pendingMutations = []; + function deferMutation(fn) { + pendingMutations.push(fn); + if (!isPendingMutations) { + isPendingMutations = true; + setTimeout(takeMutations); + } + } + function takeMutations() { + isPendingMutations = false; + var $p = pendingMutations; + for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) { + p(); + } + pendingMutations = []; + } + function attached(element) { + if (hasThrottledAttached) { + deferMutation(function() { + _attached(element); + }); + } else { + _attached(element); + } + } + function _attached(element) { + if (element.__upgraded__ && !element.__attached) { + element.__attached = true; + if (element.attachedCallback) { + element.attachedCallback(); + } + } + } + function detachedNode(node) { + detached(node); + forSubtree(node, function(e) { + detached(e); + }); + } + function detached(element) { + if (hasThrottledAttached) { + deferMutation(function() { + _detached(element); + }); + } else { + _detached(element); + } + } + function _detached(element) { + if (element.__upgraded__ && element.__attached) { + element.__attached = false; + if (element.detachedCallback) { + element.detachedCallback(); + } + } + } + function inDocument(element) { + var p = element; + var doc = window.wrap(document); + while (p) { + if (p == doc) { + return true; + } + p = p.parentNode || p.nodeType === Node.DOCUMENT_FRAGMENT_NODE && p.host; + } + } + function watchShadow(node) { + if (node.shadowRoot && !node.shadowRoot.__watched) { + flags.dom && console.log("watching shadow-root for: ", node.localName); + var root = node.shadowRoot; + while (root) { + observe(root); + root = root.olderShadowRoot; + } + } + } + function handler(root, mutations) { + if (flags.dom) { + var mx = mutations[0]; + if (mx && mx.type === "childList" && mx.addedNodes) { + if (mx.addedNodes) { + var d = mx.addedNodes[0]; + while (d && d !== document && !d.host) { + d = d.parentNode; + } + var u = d && (d.URL || d._URL || d.host && d.host.localName) || ""; + u = u.split("/?").shift().split("/").pop(); + } + } + console.group("mutations (%d) [%s]", mutations.length, u || ""); + } + var isAttached = inDocument(root); + mutations.forEach(function(mx) { + if (mx.type === "childList") { + forEach(mx.addedNodes, function(n) { + if (!n.localName) { + return; + } + addedNode(n, isAttached); + }); + forEach(mx.removedNodes, function(n) { + if (!n.localName) { + return; + } + detachedNode(n); + }); + } + }); + flags.dom && console.groupEnd(); + } + function takeRecords(node) { + node = window.wrap(node); + if (!node) { + node = window.wrap(document); + } + while (node.parentNode) { + node = node.parentNode; + } + var observer = node.__observer; + if (observer) { + handler(node, observer.takeRecords()); + takeMutations(); + } + } + var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach); + function observe(inRoot) { + if (inRoot.__observer) { + return; + } + var observer = new MutationObserver(handler.bind(this, inRoot)); + observer.observe(inRoot, { + childList: true, + subtree: true + }); + inRoot.__observer = observer; + } + function upgradeDocument(doc) { + doc = window.wrap(doc); + flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop()); + var isMainDocument = doc === window.wrap(document); + addedNode(doc, isMainDocument); + observe(doc); + flags.dom && console.groupEnd(); + } + function upgradeDocumentTree(doc) { + forDocumentTree(doc, upgradeDocument); + } + var originalCreateShadowRoot = Element.prototype.createShadowRoot; + if (originalCreateShadowRoot) { + Element.prototype.createShadowRoot = function() { + var root = originalCreateShadowRoot.call(this); + window.CustomElements.watchShadow(this); + return root; + }; + } + scope.watchShadow = watchShadow; + scope.upgradeDocumentTree = upgradeDocumentTree; + scope.upgradeDocument = upgradeDocument; + scope.upgradeSubtree = addedSubtree; + scope.upgradeAll = addedNode; + scope.attached = attached; + scope.takeRecords = takeRecords; +}); + +window.CustomElements.addModule(function(scope) { + var flags = scope.flags; + function upgrade(node, isAttached) { + if (node.localName === "template") { + if (window.HTMLTemplateElement && HTMLTemplateElement.decorate) { + HTMLTemplateElement.decorate(node); + } + } + if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) { + var is = node.getAttribute("is"); + var definition = scope.getRegisteredDefinition(node.localName) || scope.getRegisteredDefinition(is); + if (definition) { + if (is && definition.tag == node.localName || !is && !definition.extends) { + return upgradeWithDefinition(node, definition, isAttached); + } + } + } + } + function upgradeWithDefinition(element, definition, isAttached) { + flags.upgrade && console.group("upgrade:", element.localName); + if (definition.is) { + element.setAttribute("is", definition.is); + } + implementPrototype(element, definition); + element.__upgraded__ = true; + created(element); + if (isAttached) { + scope.attached(element); + } + scope.upgradeSubtree(element, isAttached); + flags.upgrade && console.groupEnd(); + return element; + } + function implementPrototype(element, definition) { + if (Object.__proto__) { + element.__proto__ = definition.prototype; + } else { + customMixin(element, definition.prototype, definition.native); + element.__proto__ = definition.prototype; + } + } + function customMixin(inTarget, inSrc, inNative) { + var used = {}; + var p = inSrc; + while (p !== inNative && p !== HTMLElement.prototype) { + var keys = Object.getOwnPropertyNames(p); + for (var i = 0, k; k = keys[i]; i++) { + if (!used[k]) { + Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k)); + used[k] = 1; + } + } + p = Object.getPrototypeOf(p); + } + } + function created(element) { + if (element.createdCallback) { + element.createdCallback(); + } + } + scope.upgrade = upgrade; + scope.upgradeWithDefinition = upgradeWithDefinition; + scope.implementPrototype = implementPrototype; +}); + +window.CustomElements.addModule(function(scope) { + var isIE = scope.isIE; + var upgradeDocumentTree = scope.upgradeDocumentTree; + var upgradeAll = scope.upgradeAll; + var upgradeWithDefinition = scope.upgradeWithDefinition; + var implementPrototype = scope.implementPrototype; + var useNative = scope.useNative; + function register(name, options) { + var definition = options || {}; + if (!name) { + throw new Error("document.registerElement: first argument `name` must not be empty"); + } + if (name.indexOf("-") < 0) { + throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'."); + } + if (isReservedTag(name)) { + throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid."); + } + if (getRegisteredDefinition(name)) { + throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered"); + } + if (!definition.prototype) { + definition.prototype = Object.create(HTMLElement.prototype); + } + definition.__name = name.toLowerCase(); + definition.lifecycle = definition.lifecycle || {}; + definition.ancestry = ancestry(definition.extends); + resolveTagName(definition); + resolvePrototypeChain(definition); + overrideAttributeApi(definition.prototype); + registerDefinition(definition.__name, definition); + definition.ctor = generateConstructor(definition); + definition.ctor.prototype = definition.prototype; + definition.prototype.constructor = definition.ctor; + if (scope.ready) { + upgradeDocumentTree(document); + } + return definition.ctor; + } + function overrideAttributeApi(prototype) { + if (prototype.setAttribute._polyfilled) { + return; + } + var setAttribute = prototype.setAttribute; + prototype.setAttribute = function(name, value) { + changeAttribute.call(this, name, value, setAttribute); + }; + var removeAttribute = prototype.removeAttribute; + prototype.removeAttribute = function(name) { + changeAttribute.call(this, name, null, removeAttribute); + }; + prototype.setAttribute._polyfilled = true; + } + function changeAttribute(name, value, operation) { + name = name.toLowerCase(); + var oldValue = this.getAttribute(name); + operation.apply(this, arguments); + var newValue = this.getAttribute(name); + if (this.attributeChangedCallback && newValue !== oldValue) { + this.attributeChangedCallback(name, oldValue, newValue); + } + } + function isReservedTag(name) { + for (var i = 0; i < reservedTagList.length; i++) { + if (name === reservedTagList[i]) { + return true; + } + } + } + var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ]; + function ancestry(extnds) { + var extendee = getRegisteredDefinition(extnds); + if (extendee) { + return ancestry(extendee.extends).concat([ extendee ]); + } + return []; + } + function resolveTagName(definition) { + var baseTag = definition.extends; + for (var i = 0, a; a = definition.ancestry[i]; i++) { + baseTag = a.is && a.tag; + } + definition.tag = baseTag || definition.__name; + if (baseTag) { + definition.is = definition.__name; + } + } + function resolvePrototypeChain(definition) { + if (!Object.__proto__) { + var nativePrototype = HTMLElement.prototype; + if (definition.is) { + var inst = document.createElement(definition.tag); + nativePrototype = Object.getPrototypeOf(inst); + } + var proto = definition.prototype, ancestor; + var foundPrototype = false; + while (proto) { + if (proto == nativePrototype) { + foundPrototype = true; + } + ancestor = Object.getPrototypeOf(proto); + if (ancestor) { + proto.__proto__ = ancestor; + } + proto = ancestor; + } + if (!foundPrototype) { + console.warn(definition.tag + " prototype not found in prototype chain for " + definition.is); + } + definition.native = nativePrototype; + } + } + function instantiate(definition) { + return upgradeWithDefinition(domCreateElement(definition.tag), definition); + } + var registry = {}; + function getRegisteredDefinition(name) { + if (name) { + return registry[name.toLowerCase()]; + } + } + function registerDefinition(name, definition) { + registry[name] = definition; + } + function generateConstructor(definition) { + return function() { + return instantiate(definition); + }; + } + var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; + function createElementNS(namespace, tag, typeExtension) { + if (namespace === HTML_NAMESPACE) { + return createElement(tag, typeExtension); + } else { + return domCreateElementNS(namespace, tag); + } + } + function createElement(tag, typeExtension) { + if (tag) { + tag = tag.toLowerCase(); + } + if (typeExtension) { + typeExtension = typeExtension.toLowerCase(); + } + var definition = getRegisteredDefinition(typeExtension || tag); + if (definition) { + if (tag == definition.tag && typeExtension == definition.is) { + return new definition.ctor(); + } + if (!typeExtension && !definition.is) { + return new definition.ctor(); + } + } + var element; + if (typeExtension) { + element = createElement(tag); + element.setAttribute("is", typeExtension); + return element; + } + element = domCreateElement(tag); + if (tag.indexOf("-") >= 0) { + implementPrototype(element, HTMLElement); + } + return element; + } + var domCreateElement = document.createElement.bind(document); + var domCreateElementNS = document.createElementNS.bind(document); + var isInstance; + if (!Object.__proto__ && !useNative) { + isInstance = function(obj, ctor) { + if (obj instanceof ctor) { + return true; + } + var p = obj; + while (p) { + if (p === ctor.prototype) { + return true; + } + p = p.__proto__; + } + return false; + }; + } else { + isInstance = function(obj, base) { + return obj instanceof base; + }; + } + function wrapDomMethodToForceUpgrade(obj, methodName) { + var orig = obj[methodName]; + obj[methodName] = function() { + var n = orig.apply(this, arguments); + upgradeAll(n); + return n; + }; + } + wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode"); + wrapDomMethodToForceUpgrade(document, "importNode"); + if (isIE) { + (function() { + var importNode = document.importNode; + document.importNode = function() { + var n = importNode.apply(document, arguments); + if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) { + var f = document.createDocumentFragment(); + f.appendChild(n); + return f; + } else { + return n; + } + }; + })(); + } + document.registerElement = register; + document.createElement = createElement; + document.createElementNS = createElementNS; + scope.registry = registry; + scope.instanceof = isInstance; + scope.reservedTagList = reservedTagList; + scope.getRegisteredDefinition = getRegisteredDefinition; + document.register = document.registerElement; +}); + +(function(scope) { + var useNative = scope.useNative; + var initializeModules = scope.initializeModules; + var isIE = scope.isIE; + if (useNative) { + var nop = function() {}; + scope.watchShadow = nop; + scope.upgrade = nop; + scope.upgradeAll = nop; + scope.upgradeDocumentTree = nop; + scope.upgradeSubtree = nop; + scope.takeRecords = nop; + scope.instanceof = function(obj, base) { + return obj instanceof base; + }; + } else { + initializeModules(); + } + var upgradeDocumentTree = scope.upgradeDocumentTree; + var upgradeDocument = scope.upgradeDocument; + if (!window.wrap) { + if (window.ShadowDOMPolyfill) { + window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded; + window.unwrap = window.ShadowDOMPolyfill.unwrapIfNeeded; + } else { + window.wrap = window.unwrap = function(node) { + return node; + }; + } + } + if (window.HTMLImports) { + window.HTMLImports.__importsParsingHook = function(elt) { + if (elt.import) { + upgradeDocument(wrap(elt.import)); + } + }; + } + function bootstrap() { + upgradeDocumentTree(window.wrap(document)); + window.CustomElements.ready = true; + var requestAnimationFrame = window.requestAnimationFrame || function(f) { + setTimeout(f, 16); + }; + requestAnimationFrame(function() { + setTimeout(function() { + window.CustomElements.readyTime = Date.now(); + if (window.HTMLImports) { + window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime; + } + document.dispatchEvent(new CustomEvent("WebComponentsReady", { + bubbles: true + })); + }); + }); + } + if (document.readyState === "complete" || scope.flags.eager) { + bootstrap(); + } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) { + bootstrap(); + } else { + var loadEvent = window.HTMLImports && !window.HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded"; + window.addEventListener(loadEvent, bootstrap); + } +})(window.CustomElements); \ No newline at end of file diff --git a/bower_components/webcomponentsjs/CustomElements.min.js b/bower_components/webcomponentsjs/CustomElements.min.js new file mode 100644 index 0000000000..192d49380c --- /dev/null +++ b/bower_components/webcomponentsjs/CustomElements.min.js @@ -0,0 +1,11 @@ +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ +// @version 0.7.21 +"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var o=t[this.name];return o&&o[0]===t?o[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),function(e){function t(e){E.push(e),b||(b=!0,w(o))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function o(){b=!1;var e=E;E=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();r(e),n.length&&(e.callback_(n,e),t=!0)}),t&&o()}function r(e){e.nodes_.forEach(function(t){var n=v.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var o=v.get(n);if(o)for(var r=0;r0){var r=n[o-1],i=m(r,e);if(i)return void(n[o-1]=i)}else t(this.observer);n[o]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;n=0)){n.push(e);for(var o,r=e.querySelectorAll("link[rel="+a+"]"),d=0,s=r.length;s>d&&(o=r[d]);d++)o["import"]&&i(o["import"],t,n);t(e)}}var a=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=r,e.forSubtree=t}),window.CustomElements.addModule(function(e){function t(e,t){return n(e,t)||o(e,t)}function n(t,n){return e.upgrade(t,n)?!0:void(n&&a(t))}function o(e,t){b(e,function(e){return n(e,t)?!0:void 0})}function r(e){N.push(e),y||(y=!0,setTimeout(i))}function i(){y=!1;for(var e,t=N,n=0,o=t.length;o>n&&(e=t[n]);n++)e();N=[]}function a(e){_?r(function(){d(e)}):d(e)}function d(e){e.__upgraded__&&!e.__attached&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function s(e){u(e),b(e,function(e){u(e)})}function u(e){_?r(function(){c(e)}):c(e)}function c(e){e.__upgraded__&&e.__attached&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function l(e){for(var t=e,n=window.wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host}}function f(e){if(e.shadowRoot&&!e.shadowRoot.__watched){g.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)w(t),t=t.olderShadowRoot}}function m(e,n){if(g.dom){var o=n[0];if(o&&"childList"===o.type&&o.addedNodes&&o.addedNodes){for(var r=o.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var i=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";i=i.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",n.length,i||"")}var a=l(e);n.forEach(function(e){"childList"===e.type&&(M(e.addedNodes,function(e){e.localName&&t(e,a)}),M(e.removedNodes,function(e){e.localName&&s(e)}))}),g.dom&&console.groupEnd()}function p(e){for(e=window.wrap(e),e||(e=window.wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(m(e,t.takeRecords()),i())}function w(e){if(!e.__observer){var t=new MutationObserver(m.bind(this,e));t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function v(e){e=window.wrap(e),g.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop());var n=e===window.wrap(document);t(e,n),w(e),g.dom&&console.groupEnd()}function h(e){E(e,v)}var g=e.flags,b=e.forSubtree,E=e.forDocumentTree,_=window.MutationObserver._isPolyfilled&&g["throttle-attached"];e.hasPolyfillMutations=_,e.hasThrottledAttached=_;var y=!1,N=[],M=Array.prototype.forEach.call.bind(Array.prototype.forEach),O=Element.prototype.createShadowRoot;O&&(Element.prototype.createShadowRoot=function(){var e=O.call(this);return window.CustomElements.watchShadow(this),e}),e.watchShadow=f,e.upgradeDocumentTree=h,e.upgradeDocument=v,e.upgradeSubtree=o,e.upgradeAll=t,e.attached=a,e.takeRecords=p}),window.CustomElements.addModule(function(e){function t(t,o){if("template"===t.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(t),!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var r=t.getAttribute("is"),i=e.getRegisteredDefinition(t.localName)||e.getRegisteredDefinition(r);if(i&&(r&&i.tag==t.localName||!r&&!i["extends"]))return n(t,i,o)}}function n(t,n,r){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAttribute("is",n.is),o(t,n),t.__upgraded__=!0,i(t),r&&e.attached(t),e.upgradeSubtree(t,r),a.upgrade&&console.groupEnd(),t}function o(e,t){Object.__proto__?e.__proto__=t.prototype:(r(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function r(e,t,n){for(var o={},r=t;r!==n&&r!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(r),d=0;i=a[d];d++)o[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i)),o[i]=1);r=Object.getPrototypeOf(r)}}function i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=n,e.implementPrototype=o}),window.CustomElements.addModule(function(e){function t(t,o){var s=o||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(r(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(u(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return s.prototype||(s.prototype=Object.create(HTMLElement.prototype)),s.__name=t.toLowerCase(),s.lifecycle=s.lifecycle||{},s.ancestry=i(s["extends"]),a(s),d(s),n(s.prototype),c(s.__name,s),s.ctor=l(s),s.ctor.prototype=s.prototype,s.prototype.constructor=s.ctor,e.ready&&h(document),s.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){o.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){o.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function o(e,t,n){e=e.toLowerCase();var o=this.getAttribute(e);n.apply(this,arguments);var r=this.getAttribute(e);this.attributeChangedCallback&&r!==o&&this.attributeChangedCallback(e,o,r)}function r(e){for(var t=0;t=0&&E(o,HTMLElement),o)}function p(e,t){var n=e[t];e[t]=function(){var e=n.apply(this,arguments);return g(e),e}}var w,v=e.isIE,h=e.upgradeDocumentTree,g=e.upgradeAll,b=e.upgradeWithDefinition,E=e.implementPrototype,_=e.useNative,y=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],N={},M="http://www.w3.org/1999/xhtml",O=document.createElement.bind(document),D=document.createElementNS.bind(document);w=Object.__proto__||_?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},p(Node.prototype,"cloneNode"),p(document,"importNode"),v&&!function(){var e=document.importNode;document.importNode=function(){var t=e.apply(document,arguments);if(t.nodeType==t.DOCUMENT_FRAGMENT_NODE){var n=document.createDocumentFragment();return n.appendChild(t),n}return t}}(),document.registerElement=t,document.createElement=m,document.createElementNS=f,e.registry=N,e["instanceof"]=w,e.reservedTagList=y,e.getRegisteredDefinition=u,document.register=document.registerElement}),function(e){function t(){i(window.wrap(document)),window.CustomElements.ready=!0;var e=window.requestAnimationFrame||function(e){setTimeout(e,16)};e(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}var n=e.useNative,o=e.initializeModules;e.isIE;if(n){var r=function(){};e.watchShadow=r,e.upgrade=r,e.upgradeAll=r,e.upgradeDocumentTree=r,e.upgradeSubtree=r,e.takeRecords=r,e["instanceof"]=function(e,t){return e instanceof t}}else o();var i=e.upgradeDocumentTree,a=e.upgradeDocument;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(e){e["import"]&&a(wrap(e["import"]))}),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var d=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(d,t)}else t()}(window.CustomElements); \ No newline at end of file diff --git a/bower_components/webcomponentsjs/HTMLImports.js b/bower_components/webcomponentsjs/HTMLImports.js new file mode 100644 index 0000000000..047e5ac326 --- /dev/null +++ b/bower_components/webcomponentsjs/HTMLImports.js @@ -0,0 +1,1157 @@ +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ +// @version 0.7.21 +if (typeof WeakMap === "undefined") { + (function() { + var defineProperty = Object.defineProperty; + var counter = Date.now() % 1e9; + var WeakMap = function() { + this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__"); + }; + WeakMap.prototype = { + set: function(key, value) { + var entry = key[this.name]; + if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, { + value: [ key, value ], + writable: true + }); + return this; + }, + get: function(key) { + var entry; + return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined; + }, + "delete": function(key) { + var entry = key[this.name]; + if (!entry || entry[0] !== key) return false; + entry[0] = entry[1] = undefined; + return true; + }, + has: function(key) { + var entry = key[this.name]; + if (!entry) return false; + return entry[0] === key; + } + }; + window.WeakMap = WeakMap; + })(); +} + +(function(global) { + if (global.JsMutationObserver) { + return; + } + var registrationsTable = new WeakMap(); + var setImmediate; + if (/Trident|Edge/.test(navigator.userAgent)) { + setImmediate = setTimeout; + } else if (window.setImmediate) { + setImmediate = window.setImmediate; + } else { + var setImmediateQueue = []; + var sentinel = String(Math.random()); + window.addEventListener("message", function(e) { + if (e.data === sentinel) { + var queue = setImmediateQueue; + setImmediateQueue = []; + queue.forEach(function(func) { + func(); + }); + } + }); + setImmediate = function(func) { + setImmediateQueue.push(func); + window.postMessage(sentinel, "*"); + }; + } + var isScheduled = false; + var scheduledObservers = []; + function scheduleCallback(observer) { + scheduledObservers.push(observer); + if (!isScheduled) { + isScheduled = true; + setImmediate(dispatchCallbacks); + } + } + function wrapIfNeeded(node) { + return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node; + } + function dispatchCallbacks() { + isScheduled = false; + var observers = scheduledObservers; + scheduledObservers = []; + observers.sort(function(o1, o2) { + return o1.uid_ - o2.uid_; + }); + var anyNonEmpty = false; + observers.forEach(function(observer) { + var queue = observer.takeRecords(); + removeTransientObserversFor(observer); + if (queue.length) { + observer.callback_(queue, observer); + anyNonEmpty = true; + } + }); + if (anyNonEmpty) dispatchCallbacks(); + } + function removeTransientObserversFor(observer) { + observer.nodes_.forEach(function(node) { + var registrations = registrationsTable.get(node); + if (!registrations) return; + registrations.forEach(function(registration) { + if (registration.observer === observer) registration.removeTransientObservers(); + }); + }); + } + function forEachAncestorAndObserverEnqueueRecord(target, callback) { + for (var node = target; node; node = node.parentNode) { + var registrations = registrationsTable.get(node); + if (registrations) { + for (var j = 0; j < registrations.length; j++) { + var registration = registrations[j]; + var options = registration.options; + if (node !== target && !options.subtree) continue; + var record = callback(options); + if (record) registration.enqueue(record); + } + } + } + } + var uidCounter = 0; + function JsMutationObserver(callback) { + this.callback_ = callback; + this.nodes_ = []; + this.records_ = []; + this.uid_ = ++uidCounter; + } + JsMutationObserver.prototype = { + observe: function(target, options) { + target = wrapIfNeeded(target); + if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) { + throw new SyntaxError(); + } + var registrations = registrationsTable.get(target); + if (!registrations) registrationsTable.set(target, registrations = []); + var registration; + for (var i = 0; i < registrations.length; i++) { + if (registrations[i].observer === this) { + registration = registrations[i]; + registration.removeListeners(); + registration.options = options; + break; + } + } + if (!registration) { + registration = new Registration(this, target, options); + registrations.push(registration); + this.nodes_.push(target); + } + registration.addListeners(); + }, + disconnect: function() { + this.nodes_.forEach(function(node) { + var registrations = registrationsTable.get(node); + for (var i = 0; i < registrations.length; i++) { + var registration = registrations[i]; + if (registration.observer === this) { + registration.removeListeners(); + registrations.splice(i, 1); + break; + } + } + }, this); + this.records_ = []; + }, + takeRecords: function() { + var copyOfRecords = this.records_; + this.records_ = []; + return copyOfRecords; + } + }; + function MutationRecord(type, target) { + this.type = type; + this.target = target; + this.addedNodes = []; + this.removedNodes = []; + this.previousSibling = null; + this.nextSibling = null; + this.attributeName = null; + this.attributeNamespace = null; + this.oldValue = null; + } + function copyMutationRecord(original) { + var record = new MutationRecord(original.type, original.target); + record.addedNodes = original.addedNodes.slice(); + record.removedNodes = original.removedNodes.slice(); + record.previousSibling = original.previousSibling; + record.nextSibling = original.nextSibling; + record.attributeName = original.attributeName; + record.attributeNamespace = original.attributeNamespace; + record.oldValue = original.oldValue; + return record; + } + var currentRecord, recordWithOldValue; + function getRecord(type, target) { + return currentRecord = new MutationRecord(type, target); + } + function getRecordWithOldValue(oldValue) { + if (recordWithOldValue) return recordWithOldValue; + recordWithOldValue = copyMutationRecord(currentRecord); + recordWithOldValue.oldValue = oldValue; + return recordWithOldValue; + } + function clearRecords() { + currentRecord = recordWithOldValue = undefined; + } + function recordRepresentsCurrentMutation(record) { + return record === recordWithOldValue || record === currentRecord; + } + function selectRecord(lastRecord, newRecord) { + if (lastRecord === newRecord) return lastRecord; + if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue; + return null; + } + function Registration(observer, target, options) { + this.observer = observer; + this.target = target; + this.options = options; + this.transientObservedNodes = []; + } + Registration.prototype = { + enqueue: function(record) { + var records = this.observer.records_; + var length = records.length; + if (records.length > 0) { + var lastRecord = records[length - 1]; + var recordToReplaceLast = selectRecord(lastRecord, record); + if (recordToReplaceLast) { + records[length - 1] = recordToReplaceLast; + return; + } + } else { + scheduleCallback(this.observer); + } + records[length] = record; + }, + addListeners: function() { + this.addListeners_(this.target); + }, + addListeners_: function(node) { + var options = this.options; + if (options.attributes) node.addEventListener("DOMAttrModified", this, true); + if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true); + if (options.childList) node.addEventListener("DOMNodeInserted", this, true); + if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true); + }, + removeListeners: function() { + this.removeListeners_(this.target); + }, + removeListeners_: function(node) { + var options = this.options; + if (options.attributes) node.removeEventListener("DOMAttrModified", this, true); + if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true); + if (options.childList) node.removeEventListener("DOMNodeInserted", this, true); + if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true); + }, + addTransientObserver: function(node) { + if (node === this.target) return; + this.addListeners_(node); + this.transientObservedNodes.push(node); + var registrations = registrationsTable.get(node); + if (!registrations) registrationsTable.set(node, registrations = []); + registrations.push(this); + }, + removeTransientObservers: function() { + var transientObservedNodes = this.transientObservedNodes; + this.transientObservedNodes = []; + transientObservedNodes.forEach(function(node) { + this.removeListeners_(node); + var registrations = registrationsTable.get(node); + for (var i = 0; i < registrations.length; i++) { + if (registrations[i] === this) { + registrations.splice(i, 1); + break; + } + } + }, this); + }, + handleEvent: function(e) { + e.stopImmediatePropagation(); + switch (e.type) { + case "DOMAttrModified": + var name = e.attrName; + var namespace = e.relatedNode.namespaceURI; + var target = e.target; + var record = new getRecord("attributes", target); + record.attributeName = name; + record.attributeNamespace = namespace; + var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.attributes) return; + if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) { + return; + } + if (options.attributeOldValue) return getRecordWithOldValue(oldValue); + return record; + }); + break; + + case "DOMCharacterDataModified": + var target = e.target; + var record = getRecord("characterData", target); + var oldValue = e.prevValue; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.characterData) return; + if (options.characterDataOldValue) return getRecordWithOldValue(oldValue); + return record; + }); + break; + + case "DOMNodeRemoved": + this.addTransientObserver(e.target); + + case "DOMNodeInserted": + var changedNode = e.target; + var addedNodes, removedNodes; + if (e.type === "DOMNodeInserted") { + addedNodes = [ changedNode ]; + removedNodes = []; + } else { + addedNodes = []; + removedNodes = [ changedNode ]; + } + var previousSibling = changedNode.previousSibling; + var nextSibling = changedNode.nextSibling; + var record = getRecord("childList", e.target.parentNode); + record.addedNodes = addedNodes; + record.removedNodes = removedNodes; + record.previousSibling = previousSibling; + record.nextSibling = nextSibling; + forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) { + if (!options.childList) return; + return record; + }); + } + clearRecords(); + } + }; + global.JsMutationObserver = JsMutationObserver; + if (!global.MutationObserver) { + global.MutationObserver = JsMutationObserver; + JsMutationObserver._isPolyfilled = true; + } +})(self); + +(function(scope) { + "use strict"; + if (!window.performance) { + var start = Date.now(); + window.performance = { + now: function() { + return Date.now() - start; + } + }; + } + if (!window.requestAnimationFrame) { + window.requestAnimationFrame = function() { + var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame; + return nativeRaf ? function(callback) { + return nativeRaf(function() { + callback(performance.now()); + }); + } : function(callback) { + return window.setTimeout(callback, 1e3 / 60); + }; + }(); + } + if (!window.cancelAnimationFrame) { + window.cancelAnimationFrame = function() { + return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) { + clearTimeout(id); + }; + }(); + } + var workingDefaultPrevented = function() { + var e = document.createEvent("Event"); + e.initEvent("foo", true, true); + e.preventDefault(); + return e.defaultPrevented; + }(); + if (!workingDefaultPrevented) { + var origPreventDefault = Event.prototype.preventDefault; + Event.prototype.preventDefault = function() { + if (!this.cancelable) { + return; + } + origPreventDefault.call(this); + Object.defineProperty(this, "defaultPrevented", { + get: function() { + return true; + }, + configurable: true + }); + }; + } + var isIE = /Trident/.test(navigator.userAgent); + if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") { + window.CustomEvent = function(inType, params) { + params = params || {}; + var e = document.createEvent("CustomEvent"); + e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail); + return e; + }; + window.CustomEvent.prototype = window.Event.prototype; + } + if (!window.Event || isIE && typeof window.Event !== "function") { + var origEvent = window.Event; + window.Event = function(inType, params) { + params = params || {}; + var e = document.createEvent("Event"); + e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable)); + return e; + }; + window.Event.prototype = origEvent.prototype; + } +})(window.WebComponents); + +window.HTMLImports = window.HTMLImports || { + flags: {} +}; + +(function(scope) { + var IMPORT_LINK_TYPE = "import"; + var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link")); + var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill); + var wrap = function(node) { + return hasShadowDOMPolyfill ? window.ShadowDOMPolyfill.wrapIfNeeded(node) : node; + }; + var rootDocument = wrap(document); + var currentScriptDescriptor = { + get: function() { + var script = window.HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null); + return wrap(script); + }, + configurable: true + }; + Object.defineProperty(document, "_currentScript", currentScriptDescriptor); + Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor); + var isIE = /Trident/.test(navigator.userAgent); + function whenReady(callback, doc) { + doc = doc || rootDocument; + whenDocumentReady(function() { + watchImportsLoad(callback, doc); + }, doc); + } + var requiredReadyState = isIE ? "complete" : "interactive"; + var READY_EVENT = "readystatechange"; + function isDocumentReady(doc) { + return doc.readyState === "complete" || doc.readyState === requiredReadyState; + } + function whenDocumentReady(callback, doc) { + if (!isDocumentReady(doc)) { + var checkReady = function() { + if (doc.readyState === "complete" || doc.readyState === requiredReadyState) { + doc.removeEventListener(READY_EVENT, checkReady); + whenDocumentReady(callback, doc); + } + }; + doc.addEventListener(READY_EVENT, checkReady); + } else if (callback) { + callback(); + } + } + function markTargetLoaded(event) { + event.target.__loaded = true; + } + function watchImportsLoad(callback, doc) { + var imports = doc.querySelectorAll("link[rel=import]"); + var parsedCount = 0, importCount = imports.length, newImports = [], errorImports = []; + function checkDone() { + if (parsedCount == importCount && callback) { + callback({ + allImports: imports, + loadedImports: newImports, + errorImports: errorImports + }); + } + } + function loadedImport(e) { + markTargetLoaded(e); + newImports.push(this); + parsedCount++; + checkDone(); + } + function errorLoadingImport(e) { + errorImports.push(this); + parsedCount++; + checkDone(); + } + if (importCount) { + for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) { + if (isImportLoaded(imp)) { + newImports.push(this); + parsedCount++; + checkDone(); + } else { + imp.addEventListener("load", loadedImport); + imp.addEventListener("error", errorLoadingImport); + } + } + } else { + checkDone(); + } + } + function isImportLoaded(link) { + return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed; + } + if (useNative) { + new MutationObserver(function(mxns) { + for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) { + if (m.addedNodes) { + handleImports(m.addedNodes); + } + } + }).observe(document.head, { + childList: true + }); + function handleImports(nodes) { + for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) { + if (isImport(n)) { + handleImport(n); + } + } + } + function isImport(element) { + return element.localName === "link" && element.rel === "import"; + } + function handleImport(element) { + var loaded = element.import; + if (loaded) { + markTargetLoaded({ + target: element + }); + } else { + element.addEventListener("load", markTargetLoaded); + element.addEventListener("error", markTargetLoaded); + } + } + (function() { + if (document.readyState === "loading") { + var imports = document.querySelectorAll("link[rel=import]"); + for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) { + handleImport(imp); + } + } + })(); + } + whenReady(function(detail) { + window.HTMLImports.ready = true; + window.HTMLImports.readyTime = new Date().getTime(); + var evt = rootDocument.createEvent("CustomEvent"); + evt.initCustomEvent("HTMLImportsLoaded", true, true, detail); + rootDocument.dispatchEvent(evt); + }); + scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE; + scope.useNative = useNative; + scope.rootDocument = rootDocument; + scope.whenReady = whenReady; + scope.isIE = isIE; +})(window.HTMLImports); + +(function(scope) { + var modules = []; + var addModule = function(module) { + modules.push(module); + }; + var initializeModules = function() { + modules.forEach(function(module) { + module(scope); + }); + }; + scope.addModule = addModule; + scope.initializeModules = initializeModules; +})(window.HTMLImports); + +window.HTMLImports.addModule(function(scope) { + var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g; + var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g; + var path = { + resolveUrlsInStyle: function(style, linkUrl) { + var doc = style.ownerDocument; + var resolver = doc.createElement("a"); + style.textContent = this.resolveUrlsInCssText(style.textContent, linkUrl, resolver); + return style; + }, + resolveUrlsInCssText: function(cssText, linkUrl, urlObj) { + var r = this.replaceUrls(cssText, urlObj, linkUrl, CSS_URL_REGEXP); + r = this.replaceUrls(r, urlObj, linkUrl, CSS_IMPORT_REGEXP); + return r; + }, + replaceUrls: function(text, urlObj, linkUrl, regexp) { + return text.replace(regexp, function(m, pre, url, post) { + var urlPath = url.replace(/["']/g, ""); + if (linkUrl) { + urlPath = new URL(urlPath, linkUrl).href; + } + urlObj.href = urlPath; + urlPath = urlObj.href; + return pre + "'" + urlPath + "'" + post; + }); + } + }; + scope.path = path; +}); + +window.HTMLImports.addModule(function(scope) { + var xhr = { + async: true, + ok: function(request) { + return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0; + }, + load: function(url, next, nextContext) { + var request = new XMLHttpRequest(); + if (scope.flags.debug || scope.flags.bust) { + url += "?" + Math.random(); + } + request.open("GET", url, xhr.async); + request.addEventListener("readystatechange", function(e) { + if (request.readyState === 4) { + var redirectedUrl = null; + try { + var locationHeader = request.getResponseHeader("Location"); + if (locationHeader) { + redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader; + } + } catch (e) { + console.error(e.message); + } + next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl); + } + }); + request.send(); + return request; + }, + loadDocument: function(url, next, nextContext) { + this.load(url, next, nextContext).responseType = "document"; + } + }; + scope.xhr = xhr; +}); + +window.HTMLImports.addModule(function(scope) { + var xhr = scope.xhr; + var flags = scope.flags; + var Loader = function(onLoad, onComplete) { + this.cache = {}; + this.onload = onLoad; + this.oncomplete = onComplete; + this.inflight = 0; + this.pending = {}; + }; + Loader.prototype = { + addNodes: function(nodes) { + this.inflight += nodes.length; + for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) { + this.require(n); + } + this.checkDone(); + }, + addNode: function(node) { + this.inflight++; + this.require(node); + this.checkDone(); + }, + require: function(elt) { + var url = elt.src || elt.href; + elt.__nodeUrl = url; + if (!this.dedupe(url, elt)) { + this.fetch(url, elt); + } + }, + dedupe: function(url, elt) { + if (this.pending[url]) { + this.pending[url].push(elt); + return true; + } + var resource; + if (this.cache[url]) { + this.onload(url, elt, this.cache[url]); + this.tail(); + return true; + } + this.pending[url] = [ elt ]; + return false; + }, + fetch: function(url, elt) { + flags.load && console.log("fetch", url, elt); + if (!url) { + setTimeout(function() { + this.receive(url, elt, { + error: "href must be specified" + }, null); + }.bind(this), 0); + } else if (url.match(/^data:/)) { + var pieces = url.split(","); + var header = pieces[0]; + var body = pieces[1]; + if (header.indexOf(";base64") > -1) { + body = atob(body); + } else { + body = decodeURIComponent(body); + } + setTimeout(function() { + this.receive(url, elt, null, body); + }.bind(this), 0); + } else { + var receiveXhr = function(err, resource, redirectedUrl) { + this.receive(url, elt, err, resource, redirectedUrl); + }.bind(this); + xhr.load(url, receiveXhr); + } + }, + receive: function(url, elt, err, resource, redirectedUrl) { + this.cache[url] = resource; + var $p = this.pending[url]; + for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) { + this.onload(url, p, resource, err, redirectedUrl); + this.tail(); + } + this.pending[url] = null; + }, + tail: function() { + --this.inflight; + this.checkDone(); + }, + checkDone: function() { + if (!this.inflight) { + this.oncomplete(); + } + } + }; + scope.Loader = Loader; +}); + +window.HTMLImports.addModule(function(scope) { + var Observer = function(addCallback) { + this.addCallback = addCallback; + this.mo = new MutationObserver(this.handler.bind(this)); + }; + Observer.prototype = { + handler: function(mutations) { + for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) { + if (m.type === "childList" && m.addedNodes.length) { + this.addedNodes(m.addedNodes); + } + } + }, + addedNodes: function(nodes) { + if (this.addCallback) { + this.addCallback(nodes); + } + for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) { + if (n.children && n.children.length) { + this.addedNodes(n.children); + } + } + }, + observe: function(root) { + this.mo.observe(root, { + childList: true, + subtree: true + }); + } + }; + scope.Observer = Observer; +}); + +window.HTMLImports.addModule(function(scope) { + var path = scope.path; + var rootDocument = scope.rootDocument; + var flags = scope.flags; + var isIE = scope.isIE; + var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE; + var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]"; + var importParser = { + documentSelectors: IMPORT_SELECTOR, + importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","), + map: { + link: "parseLink", + script: "parseScript", + style: "parseStyle" + }, + dynamicElements: [], + parseNext: function() { + var next = this.nextToParse(); + if (next) { + this.parse(next); + } + }, + parse: function(elt) { + if (this.isParsed(elt)) { + flags.parse && console.log("[%s] is already parsed", elt.localName); + return; + } + var fn = this[this.map[elt.localName]]; + if (fn) { + this.markParsing(elt); + fn.call(this, elt); + } + }, + parseDynamic: function(elt, quiet) { + this.dynamicElements.push(elt); + if (!quiet) { + this.parseNext(); + } + }, + markParsing: function(elt) { + flags.parse && console.log("parsing", elt); + this.parsingElement = elt; + }, + markParsingComplete: function(elt) { + elt.__importParsed = true; + this.markDynamicParsingComplete(elt); + if (elt.__importElement) { + elt.__importElement.__importParsed = true; + this.markDynamicParsingComplete(elt.__importElement); + } + this.parsingElement = null; + flags.parse && console.log("completed", elt); + }, + markDynamicParsingComplete: function(elt) { + var i = this.dynamicElements.indexOf(elt); + if (i >= 0) { + this.dynamicElements.splice(i, 1); + } + }, + parseImport: function(elt) { + elt.import = elt.__doc; + if (window.HTMLImports.__importsParsingHook) { + window.HTMLImports.__importsParsingHook(elt); + } + if (elt.import) { + elt.import.__importParsed = true; + } + this.markParsingComplete(elt); + if (elt.__resource && !elt.__error) { + elt.dispatchEvent(new CustomEvent("load", { + bubbles: false + })); + } else { + elt.dispatchEvent(new CustomEvent("error", { + bubbles: false + })); + } + if (elt.__pending) { + var fn; + while (elt.__pending.length) { + fn = elt.__pending.shift(); + if (fn) { + fn({ + target: elt + }); + } + } + } + this.parseNext(); + }, + parseLink: function(linkElt) { + if (nodeIsImport(linkElt)) { + this.parseImport(linkElt); + } else { + linkElt.href = linkElt.href; + this.parseGeneric(linkElt); + } + }, + parseStyle: function(elt) { + var src = elt; + elt = cloneStyle(elt); + src.__appliedElement = elt; + elt.__importElement = src; + this.parseGeneric(elt); + }, + parseGeneric: function(elt) { + this.trackElement(elt); + this.addElementToDocument(elt); + }, + rootImportForElement: function(elt) { + var n = elt; + while (n.ownerDocument.__importLink) { + n = n.ownerDocument.__importLink; + } + return n; + }, + addElementToDocument: function(elt) { + var port = this.rootImportForElement(elt.__importElement || elt); + port.parentNode.insertBefore(elt, port); + }, + trackElement: function(elt, callback) { + var self = this; + var done = function(e) { + elt.removeEventListener("load", done); + elt.removeEventListener("error", done); + if (callback) { + callback(e); + } + self.markParsingComplete(elt); + self.parseNext(); + }; + elt.addEventListener("load", done); + elt.addEventListener("error", done); + if (isIE && elt.localName === "style") { + var fakeLoad = false; + if (elt.textContent.indexOf("@import") == -1) { + fakeLoad = true; + } else if (elt.sheet) { + fakeLoad = true; + var csr = elt.sheet.cssRules; + var len = csr ? csr.length : 0; + for (var i = 0, r; i < len && (r = csr[i]); i++) { + if (r.type === CSSRule.IMPORT_RULE) { + fakeLoad = fakeLoad && Boolean(r.styleSheet); + } + } + } + if (fakeLoad) { + setTimeout(function() { + elt.dispatchEvent(new CustomEvent("load", { + bubbles: false + })); + }); + } + } + }, + parseScript: function(scriptElt) { + var script = document.createElement("script"); + script.__importElement = scriptElt; + script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt); + scope.currentScript = scriptElt; + this.trackElement(script, function(e) { + if (script.parentNode) { + script.parentNode.removeChild(script); + } + scope.currentScript = null; + }); + this.addElementToDocument(script); + }, + nextToParse: function() { + this._mayParse = []; + return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic()); + }, + nextToParseInDoc: function(doc, link) { + if (doc && this._mayParse.indexOf(doc) < 0) { + this._mayParse.push(doc); + var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc)); + for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) { + if (!this.isParsed(n)) { + if (this.hasResource(n)) { + return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n; + } else { + return; + } + } + } + } + return link; + }, + nextToParseDynamic: function() { + return this.dynamicElements[0]; + }, + parseSelectorsForNode: function(node) { + var doc = node.ownerDocument || node; + return doc === rootDocument ? this.documentSelectors : this.importsSelectors; + }, + isParsed: function(node) { + return node.__importParsed; + }, + needsDynamicParsing: function(elt) { + return this.dynamicElements.indexOf(elt) >= 0; + }, + hasResource: function(node) { + if (nodeIsImport(node) && node.__doc === undefined) { + return false; + } + return true; + } + }; + function nodeIsImport(elt) { + return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE; + } + function generateScriptDataUrl(script) { + var scriptContent = generateScriptContent(script); + return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent); + } + function generateScriptContent(script) { + return script.textContent + generateSourceMapHint(script); + } + function generateSourceMapHint(script) { + var owner = script.ownerDocument; + owner.__importedScripts = owner.__importedScripts || 0; + var moniker = script.ownerDocument.baseURI; + var num = owner.__importedScripts ? "-" + owner.__importedScripts : ""; + owner.__importedScripts++; + return "\n//# sourceURL=" + moniker + num + ".js\n"; + } + function cloneStyle(style) { + var clone = style.ownerDocument.createElement("style"); + clone.textContent = style.textContent; + path.resolveUrlsInStyle(clone); + return clone; + } + scope.parser = importParser; + scope.IMPORT_SELECTOR = IMPORT_SELECTOR; +}); + +window.HTMLImports.addModule(function(scope) { + var flags = scope.flags; + var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE; + var IMPORT_SELECTOR = scope.IMPORT_SELECTOR; + var rootDocument = scope.rootDocument; + var Loader = scope.Loader; + var Observer = scope.Observer; + var parser = scope.parser; + var importer = { + documents: {}, + documentPreloadSelectors: IMPORT_SELECTOR, + importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","), + loadNode: function(node) { + importLoader.addNode(node); + }, + loadSubtree: function(parent) { + var nodes = this.marshalNodes(parent); + importLoader.addNodes(nodes); + }, + marshalNodes: function(parent) { + return parent.querySelectorAll(this.loadSelectorsForNode(parent)); + }, + loadSelectorsForNode: function(node) { + var doc = node.ownerDocument || node; + return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors; + }, + loaded: function(url, elt, resource, err, redirectedUrl) { + flags.load && console.log("loaded", url, elt); + elt.__resource = resource; + elt.__error = err; + if (isImportLink(elt)) { + var doc = this.documents[url]; + if (doc === undefined) { + doc = err ? null : makeDocument(resource, redirectedUrl || url); + if (doc) { + doc.__importLink = elt; + this.bootDocument(doc); + } + this.documents[url] = doc; + } + elt.__doc = doc; + } + parser.parseNext(); + }, + bootDocument: function(doc) { + this.loadSubtree(doc); + this.observer.observe(doc); + parser.parseNext(); + }, + loadedAll: function() { + parser.parseNext(); + } + }; + var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer)); + importer.observer = new Observer(); + function isImportLink(elt) { + return isLinkRel(elt, IMPORT_LINK_TYPE); + } + function isLinkRel(elt, rel) { + return elt.localName === "link" && elt.getAttribute("rel") === rel; + } + function hasBaseURIAccessor(doc) { + return !!Object.getOwnPropertyDescriptor(doc, "baseURI"); + } + function makeDocument(resource, url) { + var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE); + doc._URL = url; + var base = doc.createElement("base"); + base.setAttribute("href", url); + if (!doc.baseURI && !hasBaseURIAccessor(doc)) { + Object.defineProperty(doc, "baseURI", { + value: url + }); + } + var meta = doc.createElement("meta"); + meta.setAttribute("charset", "utf-8"); + doc.head.appendChild(meta); + doc.head.appendChild(base); + doc.body.innerHTML = resource; + if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) { + HTMLTemplateElement.bootstrap(doc); + } + return doc; + } + if (!document.baseURI) { + var baseURIDescriptor = { + get: function() { + var base = document.querySelector("base"); + return base ? base.href : window.location.href; + }, + configurable: true + }; + Object.defineProperty(document, "baseURI", baseURIDescriptor); + Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor); + } + scope.importer = importer; + scope.importLoader = importLoader; +}); + +window.HTMLImports.addModule(function(scope) { + var parser = scope.parser; + var importer = scope.importer; + var dynamic = { + added: function(nodes) { + var owner, parsed, loading; + for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) { + if (!owner) { + owner = n.ownerDocument; + parsed = parser.isParsed(owner); + } + loading = this.shouldLoadNode(n); + if (loading) { + importer.loadNode(n); + } + if (this.shouldParseNode(n) && parsed) { + parser.parseDynamic(n, loading); + } + } + }, + shouldLoadNode: function(node) { + return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node)); + }, + shouldParseNode: function(node) { + return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node)); + } + }; + importer.observer.addCallback = dynamic.added.bind(dynamic); + var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector; +}); + +(function(scope) { + var initializeModules = scope.initializeModules; + var isIE = scope.isIE; + if (scope.useNative) { + return; + } + initializeModules(); + var rootDocument = scope.rootDocument; + function bootstrap() { + window.HTMLImports.importer.bootDocument(rootDocument); + } + if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) { + bootstrap(); + } else { + document.addEventListener("DOMContentLoaded", bootstrap); + } +})(window.HTMLImports); \ No newline at end of file diff --git a/bower_components/webcomponentsjs/HTMLImports.min.js b/bower_components/webcomponentsjs/HTMLImports.min.js new file mode 100644 index 0000000000..c7773e028e --- /dev/null +++ b/bower_components/webcomponentsjs/HTMLImports.min.js @@ -0,0 +1,11 @@ +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ +// @version 0.7.21 +"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];return r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),function(e){function t(e){E.push(e),g||(g=!0,f(r))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function r(){g=!1;var e=E;E=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();o(e),n.length&&(e.callback_(n,e),t=!0)}),t&&r()}function o(e){e.nodes_.forEach(function(t){var n=v.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var r=v.get(n);if(r)for(var o=0;o0){var o=n[r-1],i=m(o,e);if(i)return void(n[r-1]=i)}else t(this.observer);n[r]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;nm&&(h=s[m]);m++)a(h)?(u.push(this),d++,n()):(h.addEventListener("load",r),h.addEventListener("error",i));else n()}function a(e){return l?e.__loaded||e["import"]&&"loading"!==e["import"].readyState:e.__importParsed}function s(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)d(t)&&c(t)}function d(e){return"link"===e.localName&&"import"===e.rel}function c(e){var t=e["import"];t?o({target:e}):(e.addEventListener("load",o),e.addEventListener("error",o))}var u="import",l=Boolean(u in document.createElement("link")),h=Boolean(window.ShadowDOMPolyfill),m=function(e){return h?window.ShadowDOMPolyfill.wrapIfNeeded(e):e},p=m(document),f={get:function(){var e=window.HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return m(e)},configurable:!0};Object.defineProperty(document,"_currentScript",f),Object.defineProperty(p,"_currentScript",f);var v=/Trident/.test(navigator.userAgent),w=v?"complete":"interactive",b="readystatechange";l&&(new MutationObserver(function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),n=0,r=t.length;r>n&&(e=t[n]);n++)c(e)}()),t(function(e){window.HTMLImports.ready=!0,window.HTMLImports.readyTime=(new Date).getTime();var t=p.createEvent("CustomEvent");t.initCustomEvent("HTMLImportsLoaded",!0,!0,e),p.dispatchEvent(t)}),e.IMPORT_LINK_TYPE=u,e.useNative=l,e.rootDocument=p,e.whenReady=t,e.isIE=v}(window.HTMLImports),function(e){var t=[],n=function(e){t.push(e)},r=function(){t.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=r}(window.HTMLImports),window.HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,n=/(@import[\s]+(?!url\())([^;]*)(;)/g,r={resolveUrlsInStyle:function(e,t){var n=e.ownerDocument,r=n.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,t,r),e},resolveUrlsInCssText:function(e,r,o){var i=this.replaceUrls(e,o,r,t);return i=this.replaceUrls(i,o,r,n)},replaceUrls:function(e,t,n,r){return e.replace(r,function(e,r,o,i){var a=o.replace(/["']/g,"");return n&&(a=new URL(a,n).href),t.href=a,a=t.href,r+"'"+a+"'"+i})}};e.path=r}),window.HTMLImports.addModule(function(e){var t={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(n,r,o){var i=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(n+="?"+Math.random()),i.open("GET",n,t.async),i.addEventListener("readystatechange",function(e){if(4===i.readyState){var n=null;try{var a=i.getResponseHeader("Location");a&&(n="/"===a.substr(0,1)?location.origin+a:a)}catch(e){console.error(e.message)}r.call(o,!t.ok(i)&&i,i.response||i.responseText,n)}}),i.send(),i},loadDocument:function(e,t,n){this.load(e,t,n).responseType="document"}};e.xhr=t}),window.HTMLImports.addModule(function(e){var t=e.xhr,n=e.flags,r=function(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};r.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,r){if(n.load&&console.log("fetch",e,r),e)if(e.match(/^data:/)){var o=e.split(","),i=o[0],a=o[1];a=i.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,r,null,a)}.bind(this),0)}else{var s=function(t,n,o){this.receive(e,r,t,n,o)}.bind(this);t.load(e,s)}else setTimeout(function(){this.receive(e,r,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,n,r,o){this.cache[e]=r;for(var i,a=this.pending[e],s=0,d=a.length;d>s&&(i=a[s]);s++)this.onload(e,i,r,n,o),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=r}),window.HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),window.HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===u}function n(e){var t=r(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function r(e){return e.textContent+o(e)}function o(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var n=e.ownerDocument.baseURI,r=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+n+r+".js\n"}function i(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,d=e.flags,c=e.isIE,u=e.IMPORT_LINK_TYPE,l="link[rel="+u+"]",h={documentSelectors:l,importsSelectors:[l,"link[rel=stylesheet]:not([type])","style:not([type])","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(d.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){d.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,d.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(e["import"]=e.__doc,window.HTMLImports.__importsParsingHook&&window.HTMLImports.__importsParsingHook(e),e["import"]&&(e["import"].__importParsed=!0),this.markParsingComplete(e),e.__resource&&!e.__error?e.dispatchEvent(new CustomEvent("load",{bubbles:!1})):e.dispatchEvent(new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=i(e),t.__appliedElement=e,e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(e,t){var n=this,r=function(o){e.removeEventListener("load",r),e.removeEventListener("error",r),t&&t(o),n.markParsingComplete(e),n.parseNext()};if(e.addEventListener("load",r),e.addEventListener("error",r),c&&"style"===e.localName){var o=!1;if(-1==e.textContent.indexOf("@import"))o=!0;else if(e.sheet){o=!0;for(var i,a=e.sheet.cssRules,s=a?a.length:0,d=0;s>d&&(i=a[d]);d++)i.type===CSSRule.IMPORT_RULE&&(o=o&&Boolean(i.styleSheet))}o&&setTimeout(function(){e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(t){var r=document.createElement("script");r.__importElement=t,r.src=t.src?t.src:n(t),e.currentScript=t,this.trackElement(r,function(t){r.parentNode&&r.parentNode.removeChild(r),e.currentScript=null}),this.addElementToDocument(r)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,n){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var r,o=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,a=o.length;a>i&&(r=o[i]);i++)if(!this.isParsed(r))return this.hasResource(r)?t(r)?this.nextToParseInDoc(r.__doc,r):r:void 0}return n},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return t(e)&&void 0===e.__doc?!1:!0}};e.parser=h,e.IMPORT_SELECTOR=l}),window.HTMLImports.addModule(function(e){function t(e){return n(e,a)}function n(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function r(e){return!!Object.getOwnPropertyDescriptor(e,"baseURI")}function o(e,t){var n=document.implementation.createHTMLDocument(a);n._URL=t;var o=n.createElement("base");o.setAttribute("href",t),n.baseURI||r(n)||Object.defineProperty(n,"baseURI",{value:t});var i=n.createElement("meta");return i.setAttribute("charset","utf-8"),n.head.appendChild(i),n.head.appendChild(o),n.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}var i=e.flags,a=e.IMPORT_LINK_TYPE,s=e.IMPORT_SELECTOR,d=e.rootDocument,c=e.Loader,u=e.Observer,l=e.parser,h={documents:{},documentPreloadSelectors:s,importsPreloadSelectors:[s].join(","),loadNode:function(e){m.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);m.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===d?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,n,r,a,s){if(i.load&&console.log("loaded",e,n),n.__resource=r,n.__error=a,t(n)){var d=this.documents[e];void 0===d&&(d=a?null:o(r,s||e),d&&(d.__importLink=n,this.bootDocument(d)),this.documents[e]=d),n.__doc=d}l.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),l.parseNext()},loadedAll:function(){l.parseNext()}},m=new c(h.loaded.bind(h),h.loadedAll.bind(h));if(h.observer=new u,!document.baseURI){var p={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",p),Object.defineProperty(d,"baseURI",p)}e.importer=h,e.importLoader=m}),window.HTMLImports.addModule(function(e){var t=e.parser,n=e.importer,r={added:function(e){for(var r,o,i,a,s=0,d=e.length;d>s&&(a=e[s]);s++)r||(r=a.ownerDocument,o=t.isParsed(r)),i=this.shouldLoadNode(a),i&&n.loadNode(a),this.shouldParseNode(a)&&o&&t.parseDynamic(a,i)},shouldLoadNode:function(e){return 1===e.nodeType&&o.call(e,n.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&o.call(e,t.parseSelectorsForNode(e))}};n.observer.addCallback=r.added.bind(r);var o=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){window.HTMLImports.importer.bootDocument(r)}var n=e.initializeModules;e.isIE;if(!e.useNative){n();var r=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(window.HTMLImports); \ No newline at end of file diff --git a/bower_components/webcomponentsjs/MutationObserver.js b/bower_components/webcomponentsjs/MutationObserver.js new file mode 100644 index 0000000000..84965e5752 --- /dev/null +++ b/bower_components/webcomponentsjs/MutationObserver.js @@ -0,0 +1,350 @@ +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ +// @version 0.7.21 +if (typeof WeakMap === "undefined") { + (function() { + var defineProperty = Object.defineProperty; + var counter = Date.now() % 1e9; + var WeakMap = function() { + this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__"); + }; + WeakMap.prototype = { + set: function(key, value) { + var entry = key[this.name]; + if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, { + value: [ key, value ], + writable: true + }); + return this; + }, + get: function(key) { + var entry; + return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined; + }, + "delete": function(key) { + var entry = key[this.name]; + if (!entry || entry[0] !== key) return false; + entry[0] = entry[1] = undefined; + return true; + }, + has: function(key) { + var entry = key[this.name]; + if (!entry) return false; + return entry[0] === key; + } + }; + window.WeakMap = WeakMap; + })(); +} + +(function(global) { + if (global.JsMutationObserver) { + return; + } + var registrationsTable = new WeakMap(); + var setImmediate; + if (/Trident|Edge/.test(navigator.userAgent)) { + setImmediate = setTimeout; + } else if (window.setImmediate) { + setImmediate = window.setImmediate; + } else { + var setImmediateQueue = []; + var sentinel = String(Math.random()); + window.addEventListener("message", function(e) { + if (e.data === sentinel) { + var queue = setImmediateQueue; + setImmediateQueue = []; + queue.forEach(function(func) { + func(); + }); + } + }); + setImmediate = function(func) { + setImmediateQueue.push(func); + window.postMessage(sentinel, "*"); + }; + } + var isScheduled = false; + var scheduledObservers = []; + function scheduleCallback(observer) { + scheduledObservers.push(observer); + if (!isScheduled) { + isScheduled = true; + setImmediate(dispatchCallbacks); + } + } + function wrapIfNeeded(node) { + return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node; + } + function dispatchCallbacks() { + isScheduled = false; + var observers = scheduledObservers; + scheduledObservers = []; + observers.sort(function(o1, o2) { + return o1.uid_ - o2.uid_; + }); + var anyNonEmpty = false; + observers.forEach(function(observer) { + var queue = observer.takeRecords(); + removeTransientObserversFor(observer); + if (queue.length) { + observer.callback_(queue, observer); + anyNonEmpty = true; + } + }); + if (anyNonEmpty) dispatchCallbacks(); + } + function removeTransientObserversFor(observer) { + observer.nodes_.forEach(function(node) { + var registrations = registrationsTable.get(node); + if (!registrations) return; + registrations.forEach(function(registration) { + if (registration.observer === observer) registration.removeTransientObservers(); + }); + }); + } + function forEachAncestorAndObserverEnqueueRecord(target, callback) { + for (var node = target; node; node = node.parentNode) { + var registrations = registrationsTable.get(node); + if (registrations) { + for (var j = 0; j < registrations.length; j++) { + var registration = registrations[j]; + var options = registration.options; + if (node !== target && !options.subtree) continue; + var record = callback(options); + if (record) registration.enqueue(record); + } + } + } + } + var uidCounter = 0; + function JsMutationObserver(callback) { + this.callback_ = callback; + this.nodes_ = []; + this.records_ = []; + this.uid_ = ++uidCounter; + } + JsMutationObserver.prototype = { + observe: function(target, options) { + target = wrapIfNeeded(target); + if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) { + throw new SyntaxError(); + } + var registrations = registrationsTable.get(target); + if (!registrations) registrationsTable.set(target, registrations = []); + var registration; + for (var i = 0; i < registrations.length; i++) { + if (registrations[i].observer === this) { + registration = registrations[i]; + registration.removeListeners(); + registration.options = options; + break; + } + } + if (!registration) { + registration = new Registration(this, target, options); + registrations.push(registration); + this.nodes_.push(target); + } + registration.addListeners(); + }, + disconnect: function() { + this.nodes_.forEach(function(node) { + var registrations = registrationsTable.get(node); + for (var i = 0; i < registrations.length; i++) { + var registration = registrations[i]; + if (registration.observer === this) { + registration.removeListeners(); + registrations.splice(i, 1); + break; + } + } + }, this); + this.records_ = []; + }, + takeRecords: function() { + var copyOfRecords = this.records_; + this.records_ = []; + return copyOfRecords; + } + }; + function MutationRecord(type, target) { + this.type = type; + this.target = target; + this.addedNodes = []; + this.removedNodes = []; + this.previousSibling = null; + this.nextSibling = null; + this.attributeName = null; + this.attributeNamespace = null; + this.oldValue = null; + } + function copyMutationRecord(original) { + var record = new MutationRecord(original.type, original.target); + record.addedNodes = original.addedNodes.slice(); + record.removedNodes = original.removedNodes.slice(); + record.previousSibling = original.previousSibling; + record.nextSibling = original.nextSibling; + record.attributeName = original.attributeName; + record.attributeNamespace = original.attributeNamespace; + record.oldValue = original.oldValue; + return record; + } + var currentRecord, recordWithOldValue; + function getRecord(type, target) { + return currentRecord = new MutationRecord(type, target); + } + function getRecordWithOldValue(oldValue) { + if (recordWithOldValue) return recordWithOldValue; + recordWithOldValue = copyMutationRecord(currentRecord); + recordWithOldValue.oldValue = oldValue; + return recordWithOldValue; + } + function clearRecords() { + currentRecord = recordWithOldValue = undefined; + } + function recordRepresentsCurrentMutation(record) { + return record === recordWithOldValue || record === currentRecord; + } + function selectRecord(lastRecord, newRecord) { + if (lastRecord === newRecord) return lastRecord; + if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue; + return null; + } + function Registration(observer, target, options) { + this.observer = observer; + this.target = target; + this.options = options; + this.transientObservedNodes = []; + } + Registration.prototype = { + enqueue: function(record) { + var records = this.observer.records_; + var length = records.length; + if (records.length > 0) { + var lastRecord = records[length - 1]; + var recordToReplaceLast = selectRecord(lastRecord, record); + if (recordToReplaceLast) { + records[length - 1] = recordToReplaceLast; + return; + } + } else { + scheduleCallback(this.observer); + } + records[length] = record; + }, + addListeners: function() { + this.addListeners_(this.target); + }, + addListeners_: function(node) { + var options = this.options; + if (options.attributes) node.addEventListener("DOMAttrModified", this, true); + if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true); + if (options.childList) node.addEventListener("DOMNodeInserted", this, true); + if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true); + }, + removeListeners: function() { + this.removeListeners_(this.target); + }, + removeListeners_: function(node) { + var options = this.options; + if (options.attributes) node.removeEventListener("DOMAttrModified", this, true); + if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true); + if (options.childList) node.removeEventListener("DOMNodeInserted", this, true); + if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true); + }, + addTransientObserver: function(node) { + if (node === this.target) return; + this.addListeners_(node); + this.transientObservedNodes.push(node); + var registrations = registrationsTable.get(node); + if (!registrations) registrationsTable.set(node, registrations = []); + registrations.push(this); + }, + removeTransientObservers: function() { + var transientObservedNodes = this.transientObservedNodes; + this.transientObservedNodes = []; + transientObservedNodes.forEach(function(node) { + this.removeListeners_(node); + var registrations = registrationsTable.get(node); + for (var i = 0; i < registrations.length; i++) { + if (registrations[i] === this) { + registrations.splice(i, 1); + break; + } + } + }, this); + }, + handleEvent: function(e) { + e.stopImmediatePropagation(); + switch (e.type) { + case "DOMAttrModified": + var name = e.attrName; + var namespace = e.relatedNode.namespaceURI; + var target = e.target; + var record = new getRecord("attributes", target); + record.attributeName = name; + record.attributeNamespace = namespace; + var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.attributes) return; + if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) { + return; + } + if (options.attributeOldValue) return getRecordWithOldValue(oldValue); + return record; + }); + break; + + case "DOMCharacterDataModified": + var target = e.target; + var record = getRecord("characterData", target); + var oldValue = e.prevValue; + forEachAncestorAndObserverEnqueueRecord(target, function(options) { + if (!options.characterData) return; + if (options.characterDataOldValue) return getRecordWithOldValue(oldValue); + return record; + }); + break; + + case "DOMNodeRemoved": + this.addTransientObserver(e.target); + + case "DOMNodeInserted": + var changedNode = e.target; + var addedNodes, removedNodes; + if (e.type === "DOMNodeInserted") { + addedNodes = [ changedNode ]; + removedNodes = []; + } else { + addedNodes = []; + removedNodes = [ changedNode ]; + } + var previousSibling = changedNode.previousSibling; + var nextSibling = changedNode.nextSibling; + var record = getRecord("childList", e.target.parentNode); + record.addedNodes = addedNodes; + record.removedNodes = removedNodes; + record.previousSibling = previousSibling; + record.nextSibling = nextSibling; + forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) { + if (!options.childList) return; + return record; + }); + } + clearRecords(); + } + }; + global.JsMutationObserver = JsMutationObserver; + if (!global.MutationObserver) { + global.MutationObserver = JsMutationObserver; + JsMutationObserver._isPolyfilled = true; + } +})(self); \ No newline at end of file diff --git a/bower_components/webcomponentsjs/MutationObserver.min.js b/bower_components/webcomponentsjs/MutationObserver.min.js new file mode 100644 index 0000000000..a50ec72ab0 --- /dev/null +++ b/bower_components/webcomponentsjs/MutationObserver.min.js @@ -0,0 +1,11 @@ +/** + * @license + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt + * Code distributed by Google as part of the polymer project is also + * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt + */ +// @version 0.7.21 +"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,r=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};r.prototype={set:function(t,r){var i=t[this.name];return i&&i[0]===t?i[1]=r:e(t,this.name,{value:[t,r],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=r}(),function(e){function t(e){N.push(e),O||(O=!0,b(i))}function r(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function i(){O=!1;var e=N;N=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var r=e.takeRecords();n(e),r.length&&(e.callback_(r,e),t=!0)}),t&&i()}function n(e){e.nodes_.forEach(function(t){var r=p.get(t);r&&r.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function a(e,t){for(var r=e;r;r=r.parentNode){var i=p.get(r);if(i)for(var n=0;n0){var n=r[i-1],a=l(n,e);if(a)return void(r[i-1]=a)}else t(this.observer);r[i]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=p.get(e);t||p.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=p.get(e),r=0;r` tags in the main document block the loading of such imports. This is to ensure the imports have loaded and any registered elements in them have been upgraded. + +The webcomponents.js and webcomponents-lite.js polyfills parse element definitions and handle their upgrade asynchronously. If prematurely fetching the element from the DOM before it has an opportunity to upgrade, you'll be working with an `HTMLUnknownElement`. + +For these situations (or when you need an approximate replacement for the Polymer 0.5 `polymer-ready` behavior), you can use the `WebComponentsReady` event as a signal before interacting with the element. The criteria for this event to fire is all Custom Elements with definitions registered by the time HTML Imports available at load time have loaded have upgraded. + +```js +window.addEventListener('WebComponentsReady', function(e) { + // imports are loaded and elements have been registered + console.log('Components are ready'); +}); +``` + +## Known Issues + + * [Limited CSS encapsulation](#encapsulation) + * [Element wrapping / unwrapping limitations](#wrapping) + * [Custom element's constructor property is unreliable](#constructor) + * [Contenteditable elements do not trigger MutationObserver](#contentedit) + * [ShadowCSS: :host-context(...):host(...) doesn't work](#hostcontext) + * [ShadowCSS: :host(.zot:not(.bar:nth-child(2))) doesn't work](#nestedparens) + * [HTML imports: document.currentScript doesn't work as expected](#currentscript) + * [execCommand isn't supported under Shadow DOM](#execcommand) + +### Limited CSS encapsulation +Under native Shadow DOM, CSS selectors cannot cross the shadow boundary. This means document level styles don't apply to shadow roots, and styles defined within a shadow root don't apply outside of that shadow root. [Several selectors](http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom-201/) are provided to be able to deal with the shadow boundary. + +The Shadow DOM polyfill can't prevent document styles from leaking into shadow roots. It can, however, encapsulate styles within shadow roots to some extent. This behavior isn't automatically emulated by the Shadow DOM polyfill, but it can be achieved by manually using the included ShadowCSS shim: + +``` +WebComponents.ShadowCSS.shimStyling( shadowRoot, scope ); +``` + +... where `shadowRoot` is the shadow root of a DOM element, and `scope` is the name of the scope used to prefix the selectors. This removes all `