tao_on_rails 0.10.0 → 1.0.0.beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/tao/component/component_generator.rb +2 -12
- data/lib/generators/tao/install/install_generator.rb +11 -9
- data/lib/generators/tao/install/templates/app/views/layouts/application.html.erb +0 -1
- data/lib/tao_on_rails/action_view/helpers.rb +1 -1
- data/lib/tao_on_rails/components/base.rb +10 -3
- data/lib/tao_on_rails/engine.rb +0 -4
- data/lib/tao_on_rails/version.rb +1 -1
- metadata +7 -133
- data/lib/assets/javascripts/tao/application.coffee +0 -86
- data/lib/assets/javascripts/tao/attribute_manager.coffee +0 -94
- data/lib/assets/javascripts/tao/component.coffee +0 -175
- data/lib/assets/javascripts/tao/helpers.coffee +0 -34
- data/lib/assets/javascripts/tao/index.coffee +0 -14
- data/lib/assets/javascripts/tao/module.coffee +0 -93
- data/lib/assets/javascripts/tao/page.coffee +0 -9
- data/lib/assets/stylesheets/tao.scss +0 -3
- data/lib/generators/tao/assets/USAGE +0 -18
- data/lib/generators/tao/assets/assets_generator.rb +0 -8
- data/lib/generators/tao/channel/USAGE +0 -9
- data/lib/generators/tao/channel/channel_generator.rb +0 -17
- data/lib/generators/tao/channel/templates/channel.coffee.erb +0 -20
- data/lib/generators/tao/channel/templates/channel.rb.erb +0 -13
- data/lib/generators/tao/coffee/USAGE +0 -15
- data/lib/generators/tao/coffee/coffee_generator.rb +0 -27
- data/lib/generators/tao/coffee/templates/coffee.erb +0 -14
- data/lib/generators/tao/component/templates/component.coffee.erb +0 -5
- data/lib/generators/tao/component/templates/component.scss.erb +0 -3
- data/lib/generators/tao/controller/USAGE +0 -8
- data/lib/generators/tao/controller/controller_generator.rb +0 -20
- data/lib/generators/tao/controller/templates/controller.rb.erb +0 -57
- data/lib/generators/tao/locale/USAGE +0 -11
- data/lib/generators/tao/locale/locale_generator.rb +0 -34
- data/lib/generators/tao/locale/templates/model.yml.erb +0 -7
- data/lib/generators/tao/sass/USAGE +0 -15
- data/lib/generators/tao/sass/sass_generator.rb +0 -27
- data/lib/generators/tao/sass/templates/sass.erb +0 -3
- data/lib/generators/tao/scaffold/USAGE +0 -22
- data/lib/generators/tao/scaffold/scaffold_generator.rb +0 -16
- data/lib/generators/tao/view/USAGE +0 -9
- data/lib/generators/tao/view/templates/create.js.coffee +0 -5
- data/lib/generators/tao/view/templates/destroy.js.coffee +0 -2
- data/lib/generators/tao/view/templates/edit.html.erb +0 -1
- data/lib/generators/tao/view/templates/index.html.erb +0 -1
- data/lib/generators/tao/view/templates/new.html.erb +0 -1
- data/lib/generators/tao/view/templates/show.html.erb +0 -1
- data/lib/generators/tao/view/templates/update.js.coffee +0 -5
- data/lib/generators/tao/view/view_generator.rb +0 -38
- data/vendor/assets/javascripts/polyfills/custom-elements.js +0 -68
- data/vendor/assets/javascripts/polyfills/index.coffee +0 -7
- data/vendor/assets/javascripts/polyfills/native-shim.coffee +0 -117
| @@ -1,27 +0,0 @@ | |
| 1 | 
            -
            module Tao
         | 
| 2 | 
            -
              module Generators
         | 
| 3 | 
            -
                class SassGenerator < Rails::Generators::NamedBase
         | 
| 4 | 
            -
                  source_root File.expand_path('../templates', __FILE__)
         | 
| 5 | 
            -
             | 
| 6 | 
            -
                  argument :actions, type: :array, default: %w(index new edit show), banner: "action action"
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  class_option :variants, type: :array, default: [], desc: "Generate assets for different variants"
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                  attr_reader :page_id
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                  def create_sass_file
         | 
| 13 | 
            -
                    actions.each do |action|
         | 
| 14 | 
            -
                      @page_id = [class_path, file_name, action].flatten.join('-')
         | 
| 15 | 
            -
                      if (variants = options[:variants]).any?
         | 
| 16 | 
            -
                        variants.each do |variant|
         | 
| 17 | 
            -
                          template "sass.erb", File.join("app/assets/stylesheets", variant, name.pluralize, "#{action}_page.scss")
         | 
| 18 | 
            -
                        end
         | 
| 19 | 
            -
                      else
         | 
| 20 | 
            -
                        template "sass.erb", File.join('app/assets/stylesheets', name.pluralize, "#{action}_page.scss")
         | 
| 21 | 
            -
                      end
         | 
| 22 | 
            -
                    end
         | 
| 23 | 
            -
                  end
         | 
| 24 | 
            -
             | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
              end
         | 
| 27 | 
            -
            end
         | 
| @@ -1,22 +0,0 @@ | |
| 1 | 
            -
            Description:
         | 
| 2 | 
            -
                Scaffolds all files in the workflow of tao.
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            Example:
         | 
| 5 | 
            -
                `rails generate tao:scaffold employees/salary index show --channel --locale`
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                Create files:
         | 
| 8 | 
            -
                    app/assets/javascripts/employees/salaries/index_page.coffee
         | 
| 9 | 
            -
                    app/assets/javascripts/employees/salaries/show_page.coffee
         | 
| 10 | 
            -
                    app/assets/stylesheets/employees/salaries/index_page.scss
         | 
| 11 | 
            -
                    app/assets/stylesheets/employees/salaries/show_page.scss
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                    app/views/employees/salaries/index.html.erb
         | 
| 14 | 
            -
                    app/views/employees/salaries/show.html.coffee
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                    app/controllers/employees/salaries_conroller.rb
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                    app/assets/javascripts/channels/employees/salary.coffee
         | 
| 19 | 
            -
                    app/channels/employees/salary_channel.rb
         | 
| 20 | 
            -
             | 
| 21 | 
            -
                    config/locales/models/employees/salaries/en.yml
         | 
| 22 | 
            -
                    config/locales/views/employees/salaries/en.yml
         | 
| @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            module Tao
         | 
| 2 | 
            -
              module Generators
         | 
| 3 | 
            -
                class ScaffoldGenerator < Rails::Generators::NamedBase
         | 
| 4 | 
            -
             | 
| 5 | 
            -
                  argument :actions, type: :array, default: %w(index new create edit update show destroy), banner: "action action"
         | 
| 6 | 
            -
             | 
| 7 | 
            -
                  hook_for 'view', in: :tao, type: :boolean, default: true
         | 
| 8 | 
            -
                  hook_for 'controller', in: :tao, type: :boolean, default: true
         | 
| 9 | 
            -
                  hook_for 'assets', in: :tao, type: :boolean, default: true
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                  hook_for 'locale', in: :tao, type: :array do |instance, locale|
         | 
| 12 | 
            -
                    instance.invoke 'tao:locale', [instance.name] << locale
         | 
| 13 | 
            -
                  end
         | 
| 14 | 
            -
                end
         | 
| 15 | 
            -
              end
         | 
| 16 | 
            -
            end
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            <%%= @<%= @resource %>.inspect %>
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            <%%= @<%= @resource.pluralize %>.inspect %>
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            <%%= @<%= @resource %>.inspect %>
         | 
| @@ -1 +0,0 @@ | |
| 1 | 
            -
            <%%= @<%= @resource %>.inspect %>
         | 
| @@ -1,38 +0,0 @@ | |
| 1 | 
            -
            module Tao
         | 
| 2 | 
            -
              module Generators
         | 
| 3 | 
            -
                class ViewGenerator < Rails::Generators::NamedBase
         | 
| 4 | 
            -
                  source_root File.expand_path('../templates', __FILE__)
         | 
| 5 | 
            -
             | 
| 6 | 
            -
                  argument :actions, type: :array, default: %w(index show new create edit update destroy), banner: "action action"
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                  class_option :variants, type: :array, default: [], desc: "Generate assets for different variants"
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                  attr_reader :resource
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                  def create_view_files
         | 
| 13 | 
            -
                    @resource = file_name.singularize
         | 
| 14 | 
            -
                    view_path = Pathname.new(File.join("app/views", name.pluralize))
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                    actions.each do |action|
         | 
| 17 | 
            -
                      if (variants = options[:variants]).any?
         | 
| 18 | 
            -
                        variants.each do |variant|
         | 
| 19 | 
            -
                          variant = variant == 'default' ? '' : "+#{variant}"
         | 
| 20 | 
            -
                          if action.in? %w(create update destroy)
         | 
| 21 | 
            -
                            template "#{action}.js.coffee", view_path.join("#{action}.js#{variant}.coffee")
         | 
| 22 | 
            -
                          else
         | 
| 23 | 
            -
                            template "#{action}.html.erb", view_path.join("#{action}.html#{variant}.erb")
         | 
| 24 | 
            -
                          end
         | 
| 25 | 
            -
                        end
         | 
| 26 | 
            -
                      else
         | 
| 27 | 
            -
                        if action.in? %w(create update destroy)
         | 
| 28 | 
            -
                          template "#{action}.js.coffee", view_path.join("#{action}.js.coffee")
         | 
| 29 | 
            -
                        else
         | 
| 30 | 
            -
                          template "#{action}.html.erb", view_path.join("#{action}.html.erb")
         | 
| 31 | 
            -
                        end
         | 
| 32 | 
            -
                      end
         | 
| 33 | 
            -
                    end
         | 
| 34 | 
            -
                  end
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                end
         | 
| 37 | 
            -
              end
         | 
| 38 | 
            -
            end
         | 
| @@ -1,68 +0,0 @@ | |
| 1 | 
            -
            (function(){
         | 
| 2 | 
            -
            'use strict';var g=g||{};g.scope={};g.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,f){if(f.get||f.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=f.value)};g.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};g.global=g.getGlobal(this);g.SYMBOL_PREFIX="jscomp_symbol_";
         | 
| 3 | 
            -
            g.initSymbol=function(){g.initSymbol=function(){};g.global.Symbol||(g.global.Symbol=g.Symbol)};g.symbolCounter_=0;g.Symbol=function(a){return g.SYMBOL_PREFIX+(a||"")+g.symbolCounter_++};g.initSymbolIterator=function(){g.initSymbol();var a=g.global.Symbol.iterator;a||(a=g.global.Symbol.iterator=g.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&g.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return g.arrayIterator(this)}});g.initSymbolIterator=function(){}};
         | 
| 4 | 
            -
            g.arrayIterator=function(a){var b=0;return g.iteratorPrototype(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})};g.iteratorPrototype=function(a){g.initSymbolIterator();a={next:a};a[g.global.Symbol.iterator]=function(){return this};return a};g.makeIterator=function(a){g.initSymbolIterator();var b=a[Symbol.iterator];return b?b.call(a):g.arrayIterator(a)};g.owns=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};
         | 
| 5 | 
            -
            g.polyfill=function(a,b){if(b){var f=g.global;a=a.split(".");for(var e=0;e<a.length-1;e++){var c=a[e];c in f||(f[c]={});f=f[c]}a=a[a.length-1];e=f[a];b=b(e);b!=e&&null!=b&&g.defineProperty(f,a,{configurable:!0,writable:!0,value:b})}};
         | 
| 6 | 
            -
            g.polyfill("WeakMap",function(a){function b(a){this.id_=(d+=Math.random()+1).toString();if(a){g.initSymbol();g.initSymbolIterator();a=g.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}}function f(a){g.owns(a,c)||g.defineProperty(a,c,{value:{}})}function e(a){var b=Object[a];b&&(Object[a]=function(a){f(a);return b(a)})}if(function(){if(!a||!Object.seal)return!1;try{var b=Object.seal({}),d=Object.seal({}),c=new a([[b,2],[d,3]]);if(2!=c.get(b)||3!=c.get(d))return!1;c.delete(b);
         | 
| 7 | 
            -
            c.set(d,4);return!c.has(b)&&4==c.get(d)}catch(v){return!1}}())return a;var c="$jscomp_hidden_"+Math.random().toString().substring(2);e("freeze");e("preventExtensions");e("seal");var d=0;b.prototype.set=function(a,b){f(a);if(!g.owns(a,c))throw Error("WeakMap key fail: "+a);a[c][this.id_]=b;return this};b.prototype.get=function(a){return g.owns(a,c)?a[c][this.id_]:void 0};b.prototype.has=function(a){return g.owns(a,c)&&g.owns(a[c],this.id_)};b.prototype.delete=function(a){return g.owns(a,c)&&g.owns(a[c],
         | 
| 8 | 
            -
            this.id_)?delete a[c][this.id_]:!1};return b},"es6-impl","es3");g.MapEntry=function(){};g.ASSUME_NO_NATIVE_MAP=!1;
         | 
| 9 | 
            -
            g.polyfill("Map",function(a){function b(){var a={};return a.previous=a.next=a.head=a}function f(a,b){var d=a.head_;return g.iteratorPrototype(function(){if(d){for(;d.head!=a.head_;)d=d.previous;for(;d.next!=d.head;)return d=d.next,{done:!1,value:b(d)};d=null}return{done:!0,value:void 0}})}function e(a,b){var c;c=b&&typeof b;"object"==c||"function"==c?d.has(b)?c=d.get(b):(c=""+ ++m,d.set(b,c)):c="p_"+b;var f=a.data_[c];if(f&&g.owns(a.data_,c))for(a=0;a<f.length;a++){var e=f[a];if(b!==b&&e.key!==e.key||
         | 
| 10 | 
            -
            b===e.key)return{id:c,list:f,index:a,entry:e}}return{id:c,list:f,index:-1,entry:void 0}}function c(a){this.data_={};this.head_=b();this.size=0;if(a){a=g.makeIterator(a);for(var d;!(d=a.next()).done;)d=d.value,this.set(d[0],d[1])}}if(!g.ASSUME_NO_NATIVE_MAP&&function(){if(!a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var b=Object.seal({x:4}),d=new a(g.makeIterator([[b,"s"]]));if("s"!=d.get(b)||1!=d.size||d.get({x:4})||d.set({x:4},"t")!=d||2!=d.size)return!1;var c=d.entries(),
         | 
| 11 | 
            -
            f=c.next();if(f.done||f.value[0]!=b||"s"!=f.value[1])return!1;f=c.next();return f.done||4!=f.value[0].x||"t"!=f.value[1]||!c.next().done?!1:!0}catch(Q){return!1}}())return a;g.initSymbol();g.initSymbolIterator();var d=new WeakMap;c.prototype.set=function(a,b){var d=e(this,a);d.list||(d.list=this.data_[d.id]=[]);d.entry?d.entry.value=b:(d.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:b},d.list.push(d.entry),this.head_.previous.next=d.entry,this.head_.previous=d.entry,
         | 
| 12 | 
            -
            this.size++);return this};c.prototype.delete=function(a){a=e(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};c.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=b();this.size=0};c.prototype.has=function(a){return!!e(this,a).entry};c.prototype.get=function(a){return(a=e(this,a).entry)&&a.value};c.prototype.entries=function(){return f(this,
         | 
| 13 | 
            -
            function(a){return[a.key,a.value]})};c.prototype.keys=function(){return f(this,function(a){return a.key})};c.prototype.values=function(){return f(this,function(a){return a.value})};c.prototype.forEach=function(a,b){for(var d=this.entries(),c;!(c=d.next()).done;)c=c.value,a.call(b,c[1],c[0],this)};c.prototype[Symbol.iterator]=c.prototype.entries;var m=0;return c},"es6-impl","es3");g.ASSUME_NO_NATIVE_SET=!1;
         | 
| 14 | 
            -
            g.polyfill("Set",function(a){function b(a){this.map_=new Map;if(a){a=g.makeIterator(a);for(var b;!(b=a.next()).done;)this.add(b.value)}this.size=this.map_.size}if(!g.ASSUME_NO_NATIVE_SET&&function(){if(!a||!a.prototype.entries||"function"!=typeof Object.seal)return!1;try{var b=Object.seal({x:4}),e=new a(g.makeIterator([b]));if(!e.has(b)||1!=e.size||e.add(b)!=e||1!=e.size||e.add({x:4})!=e||2!=e.size)return!1;var c=e.entries(),d=c.next();if(d.done||d.value[0]!=b||d.value[1]!=b)return!1;d=c.next();return d.done||
         | 
| 15 | 
            -
            d.value[0]==b||4!=d.value[0].x||d.value[1]!=d.value[0]?!1:c.next().done}catch(m){return!1}}())return a;g.initSymbol();g.initSymbolIterator();b.prototype.add=function(a){this.map_.set(a,a);this.size=this.map_.size;return this};b.prototype.delete=function(a){a=this.map_.delete(a);this.size=this.map_.size;return a};b.prototype.clear=function(){this.map_.clear();this.size=0};b.prototype.has=function(a){return this.map_.has(a)};b.prototype.entries=function(){return this.map_.entries()};b.prototype.values=
         | 
| 16 | 
            -
            function(){return this.map_.values()};b.prototype.keys=b.prototype.values;b.prototype[Symbol.iterator]=b.prototype.values;b.prototype.forEach=function(a,b){var c=this;this.map_.forEach(function(d){return a.call(b,d,d,c)})};return b},"es6-impl","es3");g.EXPOSE_ASYNC_EXECUTOR=!0;g.FORCE_POLYFILL_PROMISE=!1;
         | 
| 17 | 
            -
            g.polyfill("Promise",function(a){function b(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(l){b.reject(l)}}function f(){this.batch_=null}if(a&&!g.FORCE_POLYFILL_PROMISE)return a;f.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};f.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};
         | 
| 18 | 
            -
            var e=g.global.setTimeout;f.prototype.asyncExecuteFunction=function(a){e(a,0)};f.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var c=a[b];delete a[b];try{c()}catch(q){this.asyncThrow_(q)}}}this.batch_=null};f.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};b.prototype.createResolveAndReject_=function(){function a(a){return function(d){c||(c=!0,a.call(b,d))}}var b=this,c=!1;return{resolve:a(this.resolveTo_),
         | 
| 19 | 
            -
            reject:a(this.reject_)}};b.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof b)this.settleSameAsPromise_(a);else{var d;a:switch(typeof a){case "object":d=null!=a;break a;case "function":d=!0;break a;default:d=!1}d?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};b.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(l){this.reject_(l);return}"function"==typeof b?this.settleSameAsThenable_(b,
         | 
| 20 | 
            -
            a):this.fulfill_(a)};b.prototype.reject_=function(a){this.settle_(2,a)};b.prototype.fulfill_=function(a){this.settle_(1,a)};b.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};b.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.onSettledCallbacks_=
         | 
| 21 | 
            -
            null}};var c=new f;b.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};b.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(q){c.reject(q)}};b.prototype.then=function(a,c){function d(a,b){return"function"==typeof a?function(b){try{f(a(b))}catch(G){e(G)}}:b}var f,e,m=new b(function(a,b){f=a;e=b});this.callWhenSettled_(d(a,f),d(c,e));return m};b.prototype.catch=
         | 
| 22 | 
            -
            function(a){return this.then(void 0,a)};b.prototype.callWhenSettled_=function(a,b){function d(){switch(f.state_){case 1:a(f.result_);break;case 2:b(f.result_);break;default:throw Error("Unexpected state: "+f.state_);}}var f=this;null==this.onSettledCallbacks_?c.asyncExecute(d):this.onSettledCallbacks_.push(function(){c.asyncExecute(d)})};b.resolve=function(a){return a instanceof b?a:new b(function(b){b(a)})};b.reject=function(a){return new b(function(b,c){c(a)})};b.race=function(a){return new b(function(c,
         | 
| 23 | 
            -
            d){for(var f=g.makeIterator(a),e=f.next();!e.done;e=f.next())b.resolve(e.value).callWhenSettled_(c,d)})};b.all=function(a){var c=g.makeIterator(a),d=c.next();return d.done?b.resolve([]):new b(function(a,f){function e(b){return function(c){m[b]=c;l--;0==l&&a(m)}}var m=[],l=0;do m.push(void 0),l++,b.resolve(d.value).callWhenSettled_(e(m.length-1),f),d=c.next();while(!d.done)})};g.EXPOSE_ASYNC_EXECUTOR&&(b.$jscomp$new$AsyncExecutor=function(){return new f});return b},"es6-impl","es3");
         | 
| 24 | 
            -
            g.polyfill("Object.setPrototypeOf",function(a){return a?a:"object"!=typeof"".__proto__?null:function(a,f){a.__proto__=f;if(a.__proto__!==f)throw new TypeError(a+" is not extensible");return a}},"es6","es5");var h={},k=new function(){};h.default=k;var n={},p=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function r(a,b){for(;b&&b!==a&&!b.nextSibling;)b=b.parentNode;return b&&b!==a?b.nextSibling:null}
         | 
| 25 | 
            -
            function t(a,b,f){f=void 0===f?new Set:f;for(var e=a;e;){if(e.nodeType===Node.ELEMENT_NODE){var c=e;b(c);var d=c.localName;if("link"===d&&"import"===c.getAttribute("rel")){e=c.import;if(e instanceof Node&&!f.has(e))for(f.add(e),e=e.firstChild;e;e=e.nextSibling)t(e,b,f);e=r(a,c);continue}else if("template"===d){e=r(a,c);continue}if(c=c.__CE_shadowRoot)for(c=c.firstChild;c;c=c.nextSibling)t(c,b,f)}e=e.firstChild?e.firstChild:r(a,e)}}
         | 
| 26 | 
            -
            n.isValidCustomElementName=function(a){var b=p.has(a);a=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a);return!b&&a};n.isConnected=function(a){var b=a.isConnected;if(void 0!==b)return b;for(;a&&!(a.__CE_isImportDocument||a instanceof Document);)a=a.parentNode||(window.ShadowRoot&&a instanceof ShadowRoot?a.host:void 0);return!(!a||!(a.__CE_isImportDocument||a instanceof Document))};n.walkDeepDescendantElements=t;n.setPropertyUnchecked=function(a,b,f){a[b]=f};var u={default:{custom:1,failed:2}};var w={};function x(){this._localNameToDefinition=new Map;this._constructorToDefinition=new Map;this._patches=[];this._hasPatches=!1}x.prototype.setDefinition=function(a,b){this._localNameToDefinition.set(a,b);this._constructorToDefinition.set(b.constructor,b)};x.prototype.localNameToDefinition=function(a){return this._localNameToDefinition.get(a)};x.prototype.constructorToDefinition=function(a){return this._constructorToDefinition.get(a)};x.prototype.addPatch=function(a){this._hasPatches=!0;this._patches.push(a)};
         | 
| 27 | 
            -
            x.prototype.patchTree=function(a){var b=this;this._hasPatches&&n.walkDeepDescendantElements(a,function(a){return b.patch(a)})};x.prototype.patch=function(a){if(this._hasPatches&&!a.__CE_patched){a.__CE_patched=!0;for(var b=0;b<this._patches.length;b++)this._patches[b](a)}};x.prototype.connectTree=function(a){var b=[];n.walkDeepDescendantElements(a,function(a){return b.push(a)});for(a=0;a<b.length;a++){var f=b[a];f.__CE_state===u.default.custom?this.connectedCallback(f):this.upgradeElement(f)}};
         | 
| 28 | 
            -
            x.prototype.disconnectTree=function(a){var b=[];n.walkDeepDescendantElements(a,function(a){return b.push(a)});for(a=0;a<b.length;a++){var f=b[a];f.__CE_state===u.default.custom&&this.disconnectedCallback(f)}};
         | 
| 29 | 
            -
            x.prototype.patchAndUpgradeTree=function(a,b){b=void 0===b?new Set:b;var f=this,e=[];n.walkDeepDescendantElements(a,function(a){if("link"===a.localName&&"import"===a.getAttribute("rel")){var c=a.import;c instanceof Node&&"complete"===c.readyState?(c.__CE_isImportDocument=!0,c.__CE_hasRegistry=!0):a.addEventListener("load",function(){var c=a.import;c.__CE_documentLoadHandled||(c.__CE_documentLoadHandled=!0,c.__CE_isImportDocument=!0,c.__CE_hasRegistry=!0,new Set(b),b.delete(c),f.patchAndUpgradeTree(c,
         | 
| 30 | 
            -
            b))})}else e.push(a)},b);if(this._hasPatches)for(a=0;a<e.length;a++)this.patch(e[a]);for(a=0;a<e.length;a++)this.upgradeElement(e[a])};
         | 
| 31 | 
            -
            x.prototype.upgradeElement=function(a){if(void 0===a.__CE_state){var b=this.localNameToDefinition(a.localName);if(b){b.constructionStack.push(a);var f=b.constructor;try{try{if(new f!==a)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{b.constructionStack.pop()}}catch(d){throw a.__CE_state=u.default.failed,d;}a.__CE_state=u.default.custom;a.__CE_definition=b;if(b.attributeChangedCallback)for(b=b.observedAttributes,f=0;f<b.length;f++){var e=b[f],c=a.getAttribute(e);
         | 
| 32 | 
            -
            null!==c&&this.attributeChangedCallback(a,e,null,c,null)}n.isConnected(a)&&this.connectedCallback(a)}}};x.prototype.connectedCallback=function(a){var b=a.__CE_definition;b.connectedCallback&&b.connectedCallback.call(a)};x.prototype.disconnectedCallback=function(a){var b=a.__CE_definition;b.disconnectedCallback&&b.disconnectedCallback.call(a)};
         | 
| 33 | 
            -
            x.prototype.attributeChangedCallback=function(a,b,f,e,c){var d=a.__CE_definition;d.attributeChangedCallback&&-1<d.observedAttributes.indexOf(b)&&d.attributeChangedCallback.call(a,b,f,e,c)};w.default=x;var y={};function z(a,b){this._internals=a;this._document=b;this._observer=void 0;this._internals.patchAndUpgradeTree(this._document);"loading"===this._document.readyState&&(this._observer=new MutationObserver(this._handleMutations.bind(this)),this._observer.observe(this._document,{childList:!0,subtree:!0}))}z.prototype.disconnect=function(){this._observer&&this._observer.disconnect()};
         | 
| 34 | 
            -
            z.prototype._handleMutations=function(a){var b=this._document.readyState;"interactive"!==b&&"complete"!==b||this.disconnect();for(b=0;b<a.length;b++)for(var f=a[b].addedNodes,e=0;e<f.length;e++)this._internals.patchAndUpgradeTree(f[e])};y.default=z;var A={};function B(){var a=this;this._resolve=this._value=void 0;this._promise=new Promise(function(b){a._resolve=b;a._value&&b(a._value)})}B.prototype.resolve=function(a){if(this._value)throw Error("Already resolved.");this._value=a;this._resolve&&this._resolve(a)};B.prototype.toPromise=function(){return this._promise};A.default=B;var C={};function D(a){this._elementDefinitionIsRunning=!1;this._internals=a;this._whenDefinedDeferred=new Map;this._flushCallback=function(a){return a()};this._flushPending=!1;this._unflushedLocalNames=[];this._documentConstructionObserver=new y.default(a,document)}
         | 
| 35 | 
            -
            D.prototype.define=function(a,b){var f=this;if(!(b instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!n.isValidCustomElementName(a))throw new SyntaxError("The element name '"+a+"' is not valid.");if(this._internals.localNameToDefinition(a))throw Error("A custom element with name '"+a+"' has already been defined.");if(this._elementDefinitionIsRunning)throw Error("A custom element is already being defined.");this._elementDefinitionIsRunning=!0;var e,c,d,m,
         | 
| 36 | 
            -
            l;try{var q=function(a){var b=v[a];if(void 0!==b&&!(b instanceof Function))throw Error("The '"+a+"' callback must be a function.");return b},v=b.prototype;if(!(v instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");e=q("connectedCallback");c=q("disconnectedCallback");d=q("adoptedCallback");m=q("attributeChangedCallback");l=b.observedAttributes||[]}catch(P){return}finally{this._elementDefinitionIsRunning=!1}this._internals.setDefinition(a,{localName:a,
         | 
| 37 | 
            -
            constructor:b,connectedCallback:e,disconnectedCallback:c,adoptedCallback:d,attributeChangedCallback:m,observedAttributes:l,constructionStack:[]});this._unflushedLocalNames.push(a);this._flushPending||(this._flushPending=!0,this._flushCallback(function(){return f._flush()}))};
         | 
| 38 | 
            -
            D.prototype._flush=function(){if(!1!==this._flushPending)for(this._flushPending=!1,this._internals.patchAndUpgradeTree(document);0<this._unflushedLocalNames.length;){var a=this._unflushedLocalNames.shift();(a=this._whenDefinedDeferred.get(a))&&a.resolve(void 0)}};D.prototype.get=function(a){if(a=this._internals.localNameToDefinition(a))return a.constructor};
         | 
| 39 | 
            -
            D.prototype.whenDefined=function(a){if(!n.isValidCustomElementName(a))return Promise.reject(new SyntaxError("'"+a+"' is not a valid custom element name."));var b=this._whenDefinedDeferred.get(a);if(b)return b.toPromise();b=new A.default;this._whenDefinedDeferred.set(a,b);this._internals.localNameToDefinition(a)&&-1===this._unflushedLocalNames.indexOf(a)&&b.resolve(void 0);return b.toPromise()};
         | 
| 40 | 
            -
            D.prototype.polyfillWrapFlushCallback=function(a){this._documentConstructionObserver.disconnect();var b=this._flushCallback;this._flushCallback=function(f){return a(function(){return b(f)})}};window.CustomElementRegistry=D;D.prototype.define=D.prototype.define;D.prototype.get=D.prototype.get;D.prototype.whenDefined=D.prototype.whenDefined;D.prototype.polyfillWrapFlushCallback=D.prototype.polyfillWrapFlushCallback;C.default=D;var E={},F={Document_createElement:window.Document.prototype.createElement,Document_createElementNS:window.Document.prototype.createElementNS,Document_importNode:window.Document.prototype.importNode,Document_prepend:window.Document.prototype.prepend,Document_append:window.Document.prototype.append,Node_cloneNode:window.Node.prototype.cloneNode,Node_appendChild:window.Node.prototype.appendChild,Node_insertBefore:window.Node.prototype.insertBefore,Node_removeChild:window.Node.prototype.removeChild,
         | 
| 41 | 
            -
            Node_replaceChild:window.Node.prototype.replaceChild,Node_textContent:Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),Element_attachShadow:window.Element.prototype.attachShadow,Element_innerHTML:Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),Element_getAttribute:window.Element.prototype.getAttribute,Element_setAttribute:window.Element.prototype.setAttribute,Element_removeAttribute:window.Element.prototype.removeAttribute,Element_getAttributeNS:window.Element.prototype.getAttributeNS,
         | 
| 42 | 
            -
            Element_setAttributeNS:window.Element.prototype.setAttributeNS,Element_removeAttributeNS:window.Element.prototype.removeAttributeNS,Element_insertAdjacentElement:window.Element.prototype.insertAdjacentElement,Element_prepend:window.Element.prototype.prepend,Element_append:window.Element.prototype.append,Element_before:window.Element.prototype.before,Element_after:window.Element.prototype.after,Element_replaceWith:window.Element.prototype.replaceWith,Element_remove:window.Element.prototype.remove,
         | 
| 43 | 
            -
            HTMLElement:window.HTMLElement,HTMLElement_innerHTML:Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),HTMLElement_insertAdjacentElement:window.HTMLElement.prototype.insertAdjacentElement};E.default=F;var H={default:function(a){window.HTMLElement=function(){function b(){var b=this.constructor,e=a.constructorToDefinition(b);if(!e)throw Error("The custom element being constructed was not registered with `customElements`.");var c=e.constructionStack;if(0===c.length)return c=E.default.Document_createElement.call(document,e.localName),Object.setPrototypeOf(c,b.prototype),c.__CE_state=u.default.custom,c.__CE_definition=e,a.patch(c),c;var e=c.length-1,d=c[e];if(d===h.default)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");
         | 
| 44 | 
            -
            c[e]=h.default;Object.setPrototypeOf(d,b.prototype);a.patch(d);return d}b.prototype=E.default.HTMLElement.prototype;return b}()}};var I={default:function(a,b,f){b.prepend=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];d=c.filter(function(a){return a instanceof Node&&n.isConnected(a)});f.prepend.apply(this,c);for(var e=0;e<d.length;e++)a.disconnectTree(d[e]);if(n.isConnected(this))for(d=0;d<c.length;d++)e=c[d],e instanceof Element&&a.connectTree(e)};b.append=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];d=c.filter(function(a){return a instanceof Node&&n.isConnected(a)});f.append.apply(this,
         | 
| 45 | 
            -
            c);for(var e=0;e<d.length;e++)a.disconnectTree(d[e]);if(n.isConnected(this))for(d=0;d<c.length;d++)e=c[d],e instanceof Element&&a.connectTree(e)}}};var J={default:function(a){n.setPropertyUnchecked(Document.prototype,"createElement",function(b){if(this.__CE_hasRegistry){var f=a.localNameToDefinition(b);if(f)return new f.constructor}b=E.default.Document_createElement.call(this,b);a.patch(b);return b});n.setPropertyUnchecked(Document.prototype,"importNode",function(b,f){b=E.default.Document_importNode.call(this,b,f);this.__CE_hasRegistry?a.patchAndUpgradeTree(b):a.patchTree(b);return b});n.setPropertyUnchecked(Document.prototype,"createElementNS",
         | 
| 46 | 
            -
            function(b,f){if(this.__CE_hasRegistry&&(null===b||"http://www.w3.org/1999/xhtml"===b)){var e=a.localNameToDefinition(f);if(e)return new e.constructor}b=E.default.Document_createElementNS.call(this,b,f);a.patch(b);return b});I.default(a,Document.prototype,{prepend:E.default.Document_prepend,append:E.default.Document_append})}};var K={default:function(a){function b(b,e){Object.defineProperty(b,"textContent",{enumerable:e.enumerable,configurable:!0,get:e.get,set:function(b){if(this.nodeType===Node.TEXT_NODE)e.set.call(this,b);else{var c=void 0;if(this.firstChild){var f=this.childNodes,l=f.length;if(0<l&&n.isConnected(this))for(var c=Array(l),q=0;q<l;q++)c[q]=f[q]}e.set.call(this,b);if(c)for(b=0;b<c.length;b++)a.disconnectTree(c[b])}}})}n.setPropertyUnchecked(Node.prototype,"insertBefore",function(b,e){if(b instanceof DocumentFragment){var c=
         | 
| 47 | 
            -
            Array.prototype.slice.apply(b.childNodes);b=E.default.Node_insertBefore.call(this,b,e);if(n.isConnected(this))for(e=0;e<c.length;e++)a.connectTree(c[e]);return b}c=n.isConnected(b);e=E.default.Node_insertBefore.call(this,b,e);c&&a.disconnectTree(b);n.isConnected(this)&&a.connectTree(b);return e});n.setPropertyUnchecked(Node.prototype,"appendChild",function(b){if(b instanceof DocumentFragment){var e=Array.prototype.slice.apply(b.childNodes);b=E.default.Node_appendChild.call(this,b);if(n.isConnected(this))for(var c=
         | 
| 48 | 
            -
            0;c<e.length;c++)a.connectTree(e[c]);return b}e=n.isConnected(b);c=E.default.Node_appendChild.call(this,b);e&&a.disconnectTree(b);n.isConnected(this)&&a.connectTree(b);return c});n.setPropertyUnchecked(Node.prototype,"cloneNode",function(b){b=E.default.Node_cloneNode.call(this,b);this.ownerDocument.__CE_hasRegistry?a.patchAndUpgradeTree(b):a.patchTree(b);return b});n.setPropertyUnchecked(Node.prototype,"removeChild",function(b){var e=n.isConnected(b),c=E.default.Node_removeChild.call(this,b);e&&a.disconnectTree(b);
         | 
| 49 | 
            -
            return c});n.setPropertyUnchecked(Node.prototype,"replaceChild",function(b,e){if(b instanceof DocumentFragment){var c=Array.prototype.slice.apply(b.childNodes);b=E.default.Node_replaceChild.call(this,b,e);if(n.isConnected(this))for(a.disconnectTree(e),e=0;e<c.length;e++)a.connectTree(c[e]);return b}var c=n.isConnected(b),d=E.default.Node_replaceChild.call(this,b,e),f=n.isConnected(this);f&&a.disconnectTree(e);c&&a.disconnectTree(b);f&&a.connectTree(b);return d});E.default.Node_textContent&&E.default.Node_textContent.get?
         | 
| 50 | 
            -
            b(Node.prototype,E.default.Node_textContent):a.addPatch(function(a){b(a,{enumerable:!0,configurable:!0,get:function(){for(var a=[],b=0;b<this.childNodes.length;b++)a.push(this.childNodes[b].textContent);return a.join("")},set:function(a){for(;this.firstChild;)E.default.Node_removeChild.call(this,this.firstChild);E.default.Node_appendChild.call(this,document.createTextNode(a))}})})}};var L={default:function(a,b,f){b.before=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];d=c.filter(function(a){return a instanceof Node&&n.isConnected(a)});f.before.apply(this,c);for(var e=0;e<d.length;e++)a.disconnectTree(d[e]);if(n.isConnected(this))for(d=0;d<c.length;d++)e=c[d],e instanceof Element&&a.connectTree(e)};b.after=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];d=c.filter(function(a){return a instanceof Node&&n.isConnected(a)});f.after.apply(this,
         | 
| 51 | 
            -
            c);for(var e=0;e<d.length;e++)a.disconnectTree(d[e]);if(n.isConnected(this))for(d=0;d<c.length;d++)e=c[d],e instanceof Element&&a.connectTree(e)};b.replaceWith=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];var d=c.filter(function(a){return a instanceof Node&&n.isConnected(a)}),e=n.isConnected(this);f.replaceWith.apply(this,c);for(var l=0;l<d.length;l++)a.disconnectTree(d[l]);if(e)for(a.disconnectTree(this),d=0;d<c.length;d++)e=c[d],e instanceof Element&&a.connectTree(e)};
         | 
| 52 | 
            -
            b.remove=function(){var b=n.isConnected(this);f.remove.call(this);b&&a.disconnectTree(this)}}};var M={default:function(a){function b(b,d){Object.defineProperty(b,"innerHTML",{enumerable:d.enumerable,configurable:!0,get:d.get,set:function(b){var c=this,e=void 0;n.isConnected(this)&&(e=[],n.walkDeepDescendantElements(this,function(a){a!==c&&e.push(a)}));d.set.call(this,b);if(e)for(var f=0;f<e.length;f++){var m=e[f];m.__CE_state===u.default.custom&&a.disconnectedCallback(m)}this.ownerDocument.__CE_hasRegistry?a.patchAndUpgradeTree(this):a.patchTree(this);return b}})}function f(b,d){n.setPropertyUnchecked(b,
         | 
| 53 | 
            -
            "insertAdjacentElement",function(b,c){var e=n.isConnected(c);b=d.call(this,b,c);e&&a.disconnectTree(c);n.isConnected(b)&&a.connectTree(c);return b})}E.default.Element_attachShadow?n.setPropertyUnchecked(Element.prototype,"attachShadow",function(a){return this.__CE_shadowRoot=a=E.default.Element_attachShadow.call(this,a)}):console.warn("Custom Elements: `Element#attachShadow` was not patched.");if(E.default.Element_innerHTML&&E.default.Element_innerHTML.get)b(Element.prototype,E.default.Element_innerHTML);
         | 
| 54 | 
            -
            else if(E.default.HTMLElement_innerHTML&&E.default.HTMLElement_innerHTML.get)b(HTMLElement.prototype,E.default.HTMLElement_innerHTML);else{var e=E.default.Document_createElement.call(document,"div");a.addPatch(function(a){b(a,{enumerable:!0,configurable:!0,get:function(){return E.default.Node_cloneNode.call(this,!0).innerHTML},set:function(a){var b="template"===this.localName?this.content:this;for(e.innerHTML=a;0<b.childNodes.length;)E.default.Node_removeChild.call(b,b.childNodes[0]);for(;0<e.childNodes.length;)E.default.Node_appendChild.call(b,
         | 
| 55 | 
            -
            e.childNodes[0])}})})}n.setPropertyUnchecked(Element.prototype,"setAttribute",function(b,d){if(this.__CE_state!==u.default.custom)return E.default.Element_setAttribute.call(this,b,d);var c=E.default.Element_getAttribute.call(this,b);E.default.Element_setAttribute.call(this,b,d);d=E.default.Element_getAttribute.call(this,b);a.attributeChangedCallback(this,b,c,d,null)});n.setPropertyUnchecked(Element.prototype,"setAttributeNS",function(b,d,e){if(this.__CE_state!==u.default.custom)return E.default.Element_setAttributeNS.call(this,
         | 
| 56 | 
            -
            b,d,e);var c=E.default.Element_getAttributeNS.call(this,b,d);E.default.Element_setAttributeNS.call(this,b,d,e);e=E.default.Element_getAttributeNS.call(this,b,d);a.attributeChangedCallback(this,d,c,e,b)});n.setPropertyUnchecked(Element.prototype,"removeAttribute",function(b){if(this.__CE_state!==u.default.custom)return E.default.Element_removeAttribute.call(this,b);var c=E.default.Element_getAttribute.call(this,b);E.default.Element_removeAttribute.call(this,b);null!==c&&a.attributeChangedCallback(this,
         | 
| 57 | 
            -
            b,c,null,null)});n.setPropertyUnchecked(Element.prototype,"removeAttributeNS",function(b,d){if(this.__CE_state!==u.default.custom)return E.default.Element_removeAttributeNS.call(this,b,d);var c=E.default.Element_getAttributeNS.call(this,b,d);E.default.Element_removeAttributeNS.call(this,b,d);var e=E.default.Element_getAttributeNS.call(this,b,d);c!==e&&a.attributeChangedCallback(this,d,c,e,b)});E.default.HTMLElement_insertAdjacentElement?f(HTMLElement.prototype,E.default.HTMLElement_insertAdjacentElement):
         | 
| 58 | 
            -
            E.default.Element_insertAdjacentElement?f(Element.prototype,E.default.Element_insertAdjacentElement):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");I.default(a,Element.prototype,{prepend:E.default.Element_prepend,append:E.default.Element_append});L.default(a,Element.prototype,{before:E.default.Element_before,after:E.default.Element_after,replaceWith:E.default.Element_replaceWith,remove:E.default.Element_remove})}};/*
         | 
| 59 | 
            -
             | 
| 60 | 
            -
             Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
         | 
| 61 | 
            -
             This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
         | 
| 62 | 
            -
             The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
         | 
| 63 | 
            -
             The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
         | 
| 64 | 
            -
             Code distributed by Google as part of the polymer project is also
         | 
| 65 | 
            -
             subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
         | 
| 66 | 
            -
            */
         | 
| 67 | 
            -
            var N=window.customElements;if(!N||N.forcePolyfill||"function"!=typeof N.define||"function"!=typeof N.get){var O=new w.default;H.default(O);J.default(O);K.default(O);M.default(O);document.__CE_hasRegistry=!0;var customElements=new C.default(O);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:customElements})};
         | 
| 68 | 
            -
            }).call(self);
         | 
| @@ -1,117 +0,0 @@ | |
| 1 | 
            -
            # /**
         | 
| 2 | 
            -
            #  * @license
         | 
| 3 | 
            -
            #  * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
         | 
| 4 | 
            -
            #  * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
         | 
| 5 | 
            -
            #  * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
         | 
| 6 | 
            -
            #  * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
         | 
| 7 | 
            -
            #  * Code distributed by Google as part of the polymer project is also
         | 
| 8 | 
            -
            #  * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
         | 
| 9 | 
            -
            #  */
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            if window.customElements
         | 
| 12 | 
            -
              eval '''
         | 
| 13 | 
            -
              (() => {
         | 
| 14 | 
            -
                'use strict';
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                // Do nothing if `customElements` does not exist.
         | 
| 17 | 
            -
                if (!window.customElements) return;
         | 
| 18 | 
            -
             | 
| 19 | 
            -
                const NativeHTMLElement = window.HTMLElement;
         | 
| 20 | 
            -
                const nativeDefine = window.customElements.define;
         | 
| 21 | 
            -
                const nativeGet = window.customElements.get;
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                /**
         | 
| 24 | 
            -
                 * Map of user-provided constructors to tag names.
         | 
| 25 | 
            -
                 *
         | 
| 26 | 
            -
                 * @type {Map<Function, string>}
         | 
| 27 | 
            -
                 */
         | 
| 28 | 
            -
                const tagnameByConstructor = new Map();
         | 
| 29 | 
            -
             | 
| 30 | 
            -
                /**
         | 
| 31 | 
            -
                 * Map of tag names to user-provided constructors.
         | 
| 32 | 
            -
                 *
         | 
| 33 | 
            -
                 * @type {Map<string, Function>}
         | 
| 34 | 
            -
                 */
         | 
| 35 | 
            -
                const constructorByTagname = new Map();
         | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
                /**
         | 
| 39 | 
            -
                 * Whether the constructors are being called by a browser process, ie parsing
         | 
| 40 | 
            -
                 * or createElement.
         | 
| 41 | 
            -
                 */
         | 
| 42 | 
            -
                let browserConstruction = false;
         | 
| 43 | 
            -
             | 
| 44 | 
            -
                /**
         | 
| 45 | 
            -
                 * Whether the constructors are being called by a user-space process, ie
         | 
| 46 | 
            -
                 * calling an element constructor.
         | 
| 47 | 
            -
                 */
         | 
| 48 | 
            -
                let userConstruction = false;
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                window.HTMLElement = function() {
         | 
| 51 | 
            -
                  if (!browserConstruction) {
         | 
| 52 | 
            -
                    const tagname = tagnameByConstructor.get(this.constructor);
         | 
| 53 | 
            -
                    const fakeClass = nativeGet.call(window.customElements, tagname);
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                    // Make sure that the fake constructor doesn't call back to this constructor
         | 
| 56 | 
            -
                    userConstruction = true;
         | 
| 57 | 
            -
                    const instance = new (fakeClass)();
         | 
| 58 | 
            -
                    return instance;
         | 
| 59 | 
            -
                  }
         | 
| 60 | 
            -
                  // Else do nothing. This will be reached by ES5-style classes doing
         | 
| 61 | 
            -
                  // HTMLElement.call() during initialization
         | 
| 62 | 
            -
                  browserConstruction = false;
         | 
| 63 | 
            -
                };
         | 
| 64 | 
            -
                // By setting the patched HTMLElement's prototype property to the native
         | 
| 65 | 
            -
                // HTMLElement's prototype we make sure that:
         | 
| 66 | 
            -
                //     document.createElement('a') instanceof HTMLElement
         | 
| 67 | 
            -
                // works because instanceof uses HTMLElement.prototype, which is on the
         | 
| 68 | 
            -
                // ptototype chain of built-in elements.
         | 
| 69 | 
            -
                window.HTMLElement.prototype = NativeHTMLElement.prototype;
         | 
| 70 | 
            -
             | 
| 71 | 
            -
                const define = (tagname, elementClass) => {
         | 
| 72 | 
            -
                  const elementProto = elementClass.prototype;
         | 
| 73 | 
            -
                  const StandInElement = class extends NativeHTMLElement {
         | 
| 74 | 
            -
                    constructor() {
         | 
| 75 | 
            -
                      // Call the native HTMLElement constructor, this gives us the
         | 
| 76 | 
            -
                      // under-construction instance as `this`:
         | 
| 77 | 
            -
                      super();
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                      // The prototype will be wrong up because the browser used our fake
         | 
| 80 | 
            -
                      // class, so fix it:
         | 
| 81 | 
            -
                      Object.setPrototypeOf(this, elementProto);
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                      if (!userConstruction) {
         | 
| 84 | 
            -
                        // Make sure that user-defined constructor bottom's out to a do-nothing
         | 
| 85 | 
            -
                        // HTMLElement() call
         | 
| 86 | 
            -
                        browserConstruction = true;
         | 
| 87 | 
            -
                        // Call the user-defined constructor on our instance:
         | 
| 88 | 
            -
                        elementClass.call(this);
         | 
| 89 | 
            -
                      }
         | 
| 90 | 
            -
                      userConstruction = false;
         | 
| 91 | 
            -
                    }
         | 
| 92 | 
            -
                  };
         | 
| 93 | 
            -
                  const standInProto = StandInElement.prototype;
         | 
| 94 | 
            -
                  StandInElement.observedAttributes = elementClass.observedAttributes;
         | 
| 95 | 
            -
                  standInProto.connectedCallback = elementProto.connectedCallback;
         | 
| 96 | 
            -
                  standInProto.disconnectedCallback = elementProto.disconnectedCallback;
         | 
| 97 | 
            -
                  standInProto.attributeChangedCallback = elementProto.attributeChangedCallback;
         | 
| 98 | 
            -
                  standInProto.adoptedCallback = elementProto.adoptedCallback;
         | 
| 99 | 
            -
             | 
| 100 | 
            -
                  tagnameByConstructor.set(elementClass, tagname);
         | 
| 101 | 
            -
                  constructorByTagname.set(tagname, elementClass);
         | 
| 102 | 
            -
                  nativeDefine.call(window.customElements, tagname, StandInElement);
         | 
| 103 | 
            -
                };
         | 
| 104 | 
            -
             | 
| 105 | 
            -
                const get = (tagname) => constructorByTagname.get(tagname);
         | 
| 106 | 
            -
             | 
| 107 | 
            -
                // Workaround for Safari bug where patching customElements can be lost, likely
         | 
| 108 | 
            -
                // due to native wrapper garbage collection issue
         | 
| 109 | 
            -
                Object.defineProperty(window, 'customElements',
         | 
| 110 | 
            -
                  {value: window.customElements, configurable: true, writable: true});
         | 
| 111 | 
            -
                Object.defineProperty(window.customElements, 'define',
         | 
| 112 | 
            -
                  {value: define, configurable: true, writable: true});
         | 
| 113 | 
            -
                Object.defineProperty(window.customElements, 'get',
         | 
| 114 | 
            -
                  {value: get, configurable: true, writable: true});
         | 
| 115 | 
            -
             | 
| 116 | 
            -
              })();
         | 
| 117 | 
            -
            '''
         |