From 088631b7b871de8520730dff43d4595cab5cbff7 Mon Sep 17 00:00:00 2001 From: Martin Emde Date: Fri, 26 Jan 2024 14:39:59 -0800 Subject: [PATCH] Implement importmap-rails with minimal js changes Add importmap:verify to check vendored javascript Run importmap:verify as part of lint Update content security policy based on recommendations from google csp validator in order to get importmap script tag to load. Use a random base64 if a nonce isn't available from the session Use script-src: sha256-* instead of nonce for importmap script tag This allows the importmap to be cached without creating a long lived nonce in the cache Fix issue with blank cookie causing rack-test crash --- .github/workflows/lint.yml | 10 + Dockerfile | 2 +- Gemfile | 6 +- Gemfile.lock | 12 +- app/assets/config/manifest.js | 3 +- app/assets/javascripts/application.js | 24 - app/controllers/application_controller.rb | 17 + app/helpers/application_helper.rb | 7 + .../api_key_form.js | 4 +- app/javascript/application.js | 16 + .../autocomplete.js | 6 + .../clipboard_buttons.js | 3 + app/javascript/handle-click.js | 16 + .../javascripts => javascript}/mobile-nav.js | 3 + .../multifactor_auths.js | 3 + .../oidc_api_key_role_form.js | 2 + .../javascripts => javascript}/pages.js | 14 +- .../javascripts => javascript}/popup-nav.js | 4 +- .../javascripts => javascript}/search.js | 2 + .../transitive_dependencies.js | 2 + .../javascripts => javascript}/webauthn.js | 5 +- app/views/layouts/application.html.erb | 3 +- app/views/stats/index.html.erb | 2 +- bin/importmap | 4 + config/importmap.rb | 12 + .../initializers/content_security_policy.rb | 17 +- lib/gemcutter/middleware/admin_auth.rb | 6 +- lib/tasks/helpers/importmap_helper.rb | 53 ++ lib/tasks/importmap.rake | 48 + test/system/autocompletes_test.rb | 11 +- test/system/stats_test.rb | 2 +- vendor/assets/javascripts/clipboard.js | 864 ------------------ vendor/javascript/@rails--ujs.js | 2 + vendor/javascript/clipboard.js | 186 ++++ .../github-buttons.js} | 0 vendor/javascript/jquery.js | 55 ++ .../webauthn-json.js | 6 + 37 files changed, 508 insertions(+), 924 deletions(-) delete mode 100644 app/assets/javascripts/application.js rename app/{assets/javascripts => javascript}/api_key_form.js (96%) create mode 100644 app/javascript/application.js rename app/{assets/javascripts => javascript}/autocomplete.js (89%) rename app/{assets/javascripts => javascript}/clipboard_buttons.js (93%) create mode 100644 app/javascript/handle-click.js rename app/{assets/javascripts => javascript}/mobile-nav.js (96%) rename app/{assets/javascripts => javascript}/multifactor_auths.js (94%) rename app/{assets/javascripts => javascript}/oidc_api_key_role_form.js (97%) rename app/{assets/javascripts => javascript}/pages.js (89%) rename app/{assets/javascripts => javascript}/popup-nav.js (87%) rename app/{assets/javascripts => javascript}/search.js (97%) rename app/{assets/javascripts => javascript}/transitive_dependencies.js (98%) rename app/{assets/javascripts => javascript}/webauthn.js (98%) create mode 100755 bin/importmap create mode 100644 config/importmap.rb create mode 100644 lib/tasks/helpers/importmap_helper.rb create mode 100644 lib/tasks/importmap.rake delete mode 100644 vendor/assets/javascripts/clipboard.js create mode 100644 vendor/javascript/@rails--ujs.js create mode 100644 vendor/javascript/clipboard.js rename vendor/{assets/javascripts/github_buttons.js => javascript/github-buttons.js} (100%) create mode 100644 vendor/javascript/jquery.js rename vendor/{assets/javascripts => javascript}/webauthn-json.js (94%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a01b1cdf9e3..84012ca4999 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,6 +28,16 @@ jobs: bundler-cache: true - name: Brakeman run: bundle exec brakeman + importmap: + name: Importmap Verify + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: ruby/setup-ruby@bd03e04863f52d169e18a2b190e8fa6b84938215 # v1.170.0 + with: + bundler-cache: true + - name: Importmap Verify + run: bundle exec rake importmap:verify kubeconform: name: Kubeconform runs-on: ubuntu-22.04 diff --git a/Dockerfile b/Dockerfile index cdc543586f7..500824e5c91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,7 +87,7 @@ COPY --link config/database.yml.sample /app/config/database.yml RUN < 3.2" gem "high_voltage", "~> 3.1" gem "honeybadger", "~> 5.4" gem "http_accept_language", "~> 2.1" -gem "jquery-rails", "~> 4.5" gem "kaminari", "~> 1.2" gem "launchdarkly-server-sdk", "~> 8.1" gem "mail", "~> 2.8" @@ -43,7 +42,6 @@ gem "searchkick", "~> 5.3" gem "faraday_middleware-aws-sigv4", "~> 1.0" gem "xml-simple", "~> 1.1" gem "compact_index", "~> 0.15.0" -gem "sprockets-rails", "~> 3.4" gem "rack-attack", "~> 6.6" gem "rqrcode", "~> 2.1" gem "rotp", "~> 6.2" @@ -73,6 +71,10 @@ gem "pp", "0.5.0" gem "csv", "~> 3.2" # zeitwerk-2.6.12 gem "observer", "~> 0.1.2" # launchdarkly-server-sdk-8.0.0 +# Assets +gem "sprockets-rails", "~> 3.4" +gem "importmap-rails", "~> 2.0" + group :assets, :development do gem "tailwindcss-rails", "~> 2.3" end diff --git a/Gemfile.lock b/Gemfile.lock index ce61d650a8e..51eeb207ac3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -290,6 +290,10 @@ GEM multi_xml (>= 0.5.2) i18n (1.14.1) concurrent-ruby (~> 1.0) + importmap-rails (2.0.1) + actionpack (>= 6.0.0) + activesupport (>= 6.0.0) + railties (>= 6.0.0) inline_svg (1.9.0) activesupport (>= 3.0) nokogiri (>= 1.6) @@ -300,10 +304,6 @@ GEM jmespath (1.6.2) job-iteration (1.4.1) activejob (>= 5.2) - jquery-rails (4.6.0) - rails-dom-testing (>= 1, < 3) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) json (2.7.1) json-jwt (1.16.5) activesupport (>= 4.2) @@ -784,7 +784,7 @@ DEPENDENCIES high_voltage (~> 3.1) honeybadger (~> 5.4) http_accept_language (~> 2.1) - jquery-rails (~> 4.5) + importmap-rails (~> 2.0) kaminari (~> 1.2) launchdarkly-server-sdk (~> 8.1) launchy (~> 2.5) @@ -964,12 +964,12 @@ CHECKSUMS http_accept_language (2.1.1) sha256=0043f0d55a148cf45b604dbdd197cb36437133e990016c68c892d49dbea31634 httparty (0.21.0) sha256=00ef7bf9a71f30a3bff88edeb5b16a34bea883ab67c246b3f0db2d6794fe1214 i18n (1.14.1) sha256=9d03698903547c060928e70a9bc8b6b87fda674453cda918fc7ab80235ae4a61 + importmap-rails (2.0.1) sha256=e739a6e70c09f797688c6983fa79567ec1edc9becc30d55b3f7cc897b1825586 inline_svg (1.9.0) sha256=f44c5e3d2e401fd619ad3047b7c8cee384517d855edb1d1fb1a248d3cae535d6 io-console (0.7.2) sha256=f0dccff252f877a4f60d04a4dc6b442b185ebffb4b320ab69212a92b48a7a221 irb (1.11.1) sha256=0700d626c92f7d47d12e73932ddb0c11b73c1f00608f5eae78dbc44968690842 jmespath (1.6.2) sha256=238d774a58723d6c090494c8879b5e9918c19485f7e840f2c1c7532cf84ebcb1 job-iteration (1.4.1) sha256=7243c40e4decc3d49529867e9c504afaea332976c967ffdebed9ff863c6424af - jquery-rails (4.6.0) sha256=3c4e6bf47274340b44d836b8aa1b5472c6d451e2739af5ec094421f39025a7e2 json (2.7.1) sha256=187ea312fb58420ff0c40f40af1862651d4295c8675267c6a1c353f1a0ac3265 json-jwt (1.16.5) sha256=c899d6d9c6892e1ed8e423ac153837d4ca4f7069777342f0e3a3398482f309fb jwt (2.7.1) sha256=07357cd2f180739b2f8184eda969e252d850ac996ed0a23f616e8ff0a90ae19b diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index 996515ed84c..57810e7d1a6 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,4 +1,5 @@ //= link application.css -//= link application.js //= link_tree ../../../vendor/assets/images //= link_tree ../builds +//= link_tree ../../javascript .js +//= link_tree ../../../vendor/javascript .js diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js deleted file mode 100644 index 9c370293063..00000000000 --- a/app/assets/javascripts/application.js +++ /dev/null @@ -1,24 +0,0 @@ -// This is a manifest file that'll be compiled into including all the files listed below. -// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically -// be included in the compiled file accessible from http://example.com/assets/application.js -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -//= require jquery3 -//= require jquery_ujs -//= require clipboard -//= require github_buttons -//= require webauthn-json -//= require_tree . - -function handleClick(event, nav, removeNavExpandedClass, addNavExpandedClass) { - var isMobileNavExpanded = nav.popUp.hasClass(nav.expandedClass); - - event.preventDefault(); - - if (isMobileNavExpanded) { - removeNavExpandedClass(); - } else { - addNavExpandedClass(); - } -} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 039686d19df..9ebfc0a52c7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -17,6 +17,23 @@ class ApplicationController < ActionController::Base add_flash_types :notice_html + ### + # Content security policy override for script-src + # This is necessary because we use a SHA256 for the importmap script tag + # because caching behavior of the mostly static pages could mean longer lived nonces + # being served from cache instead of unique nonces for each request. + # This ensures that importmap passes CSP and can be cached safely. + content_security_policy do |policy| + policy.script_src( + :self, + "'sha256-#{Digest::SHA256.base64digest(Rails.application.importmap.to_json(resolver: ApplicationController.helpers))}'", + "https://secure.gaug.es", + "https://www.fastly-insights.com", + "https://unpkg.com/@hotwired/stimulus/dist/stimulus.umd.js", + "https://unpkg.com/stimulus-rails-nested-form/dist/stimulus-rails-nested-form.umd.js" + ) + end + def set_locale I18n.locale = user_locale diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bdf9d6b692d..9f70493f8a0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -13,6 +13,13 @@ def atom_feed_link(title, url) title: title) end + # Copied from importmap-rails but with the nonce removed. We rely on the sha256 hash instead. + # Relying on the hash improves the caching behavior by not sending the cached nonce to the client. + def javascript_inline_importmap_tag(importmap_json = Rails.application.importmap.to_json(resolver: self)) + tag.script importmap_json.html_safe, + type: "importmap", "data-turbo-track": "reload" + end + def short_info(rubygem) info = gem_info(rubygem).strip.truncate(90) escape_once(sanitize(info)) diff --git a/app/assets/javascripts/api_key_form.js b/app/javascript/api_key_form.js similarity index 96% rename from app/assets/javascripts/api_key_form.js rename to app/javascript/api_key_form.js index 71c8db372f2..28c9443618c 100644 --- a/app/assets/javascripts/api_key_form.js +++ b/app/javascript/api_key_form.js @@ -1,4 +1,6 @@ -$(function() { +import $ from "jquery"; + +$(function () { var enableGemScopeCheckboxes = $("#push_rubygem, #yank_rubygem, #add_owner, #remove_owner"); var hiddenRubygemId = "hidden_api_key_rubygem_id"; toggleGemSelector(); diff --git a/app/javascript/application.js b/app/javascript/application.js new file mode 100644 index 00000000000..4dc20bab71d --- /dev/null +++ b/app/javascript/application.js @@ -0,0 +1,16 @@ +// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails +import Rails from "@rails/ujs"; +Rails.start(); + +import "./api_key_form"; +import "./autocomplete"; +import "./clipboard_buttons"; +import "./mobile-nav"; +import "./multifactor_auths"; +import "./oidc_api_key_role_form"; +import "./pages"; +import "./popup-nav"; +import "./search"; +import "./transitive_dependencies"; +import "./webauthn"; +import "github-buttons"; diff --git a/app/assets/javascripts/autocomplete.js b/app/javascript/autocomplete.js similarity index 89% rename from app/assets/javascripts/autocomplete.js rename to app/javascript/autocomplete.js index 2ec6f66c149..b8523c4b391 100644 --- a/app/assets/javascripts/autocomplete.js +++ b/app/javascript/autocomplete.js @@ -1,3 +1,5 @@ +import $ from "jquery"; + $(function() { if ($('#home_query').length){ autocomplete($('#home_query')); @@ -13,6 +15,8 @@ $(function() { search.bind('input', function(e) { var term = $.trim($(search).val()); if (term.length >= 2) { + search.removeClass('autocomplete-done'); + search.addClass('autocomplete-loading'); $.ajax({ url: '/api/v1/search/autocomplete', type: 'GET', @@ -20,6 +24,8 @@ $(function() { processData: false, dataType: 'json' }).done(function(data) { + search.removeClass('autocomplete-loading'); + search.addClass('autocomplete-done'); addToSuggestList(search, data); }); } else { diff --git a/app/assets/javascripts/clipboard_buttons.js b/app/javascript/clipboard_buttons.js similarity index 93% rename from app/assets/javascripts/clipboard_buttons.js rename to app/javascript/clipboard_buttons.js index 4b3f0036b43..23dcd50b1fe 100644 --- a/app/assets/javascripts/clipboard_buttons.js +++ b/app/javascript/clipboard_buttons.js @@ -1,3 +1,6 @@ +import $ from "jquery"; +import ClipboardJS from "clipboard"; + $(function() { var clipboard = new ClipboardJS('.gem__code__icon'); var copyTooltip = $('.gem__code__tooltip--copy'); diff --git a/app/javascript/handle-click.js b/app/javascript/handle-click.js new file mode 100644 index 00000000000..c1cac780c37 --- /dev/null +++ b/app/javascript/handle-click.js @@ -0,0 +1,16 @@ +export function handleClick( + event, + nav, + removeNavExpandedClass, + addNavExpandedClass +) { + var isMobileNavExpanded = nav.popUp.hasClass(nav.expandedClass); + + event.preventDefault(); + + if (isMobileNavExpanded) { + removeNavExpandedClass(); + } else { + addNavExpandedClass(); + } +} diff --git a/app/assets/javascripts/mobile-nav.js b/app/javascript/mobile-nav.js similarity index 96% rename from app/assets/javascripts/mobile-nav.js rename to app/javascript/mobile-nav.js index 445ab1d8dff..ee2d658971a 100644 --- a/app/assets/javascripts/mobile-nav.js +++ b/app/javascript/mobile-nav.js @@ -1,3 +1,6 @@ +import $ from "jquery"; +import { handleClick } from "./handle-click"; + $(function() { // cache jQuery lookups into variables // so we don't have to traverse the DOM every time diff --git a/app/assets/javascripts/multifactor_auths.js b/app/javascript/multifactor_auths.js similarity index 94% rename from app/assets/javascripts/multifactor_auths.js rename to app/javascript/multifactor_auths.js index 9bf65609fc8..365d2db89e4 100644 --- a/app/assets/javascripts/multifactor_auths.js +++ b/app/javascript/multifactor_auths.js @@ -1,3 +1,6 @@ +import $ from "jquery"; +import ClipboardJS from "clipboard"; + function popUp (e) { e.preventDefault(); e.returnValue = ""; diff --git a/app/assets/javascripts/oidc_api_key_role_form.js b/app/javascript/oidc_api_key_role_form.js similarity index 97% rename from app/assets/javascripts/oidc_api_key_role_form.js rename to app/javascript/oidc_api_key_role_form.js index 76654487870..55752d5fa37 100644 --- a/app/assets/javascripts/oidc_api_key_role_form.js +++ b/app/javascript/oidc_api_key_role_form.js @@ -1,3 +1,5 @@ +import $ from "jquery"; + $(function () { function wire() { var removeNestedButtons = $("button.form__remove_nested_button"); diff --git a/app/assets/javascripts/pages.js b/app/javascript/pages.js similarity index 89% rename from app/assets/javascripts/pages.js rename to app/javascript/pages.js index a65eca563d9..729c93d6e5b 100644 --- a/app/assets/javascripts/pages.js +++ b/app/javascript/pages.js @@ -1,5 +1,7 @@ +import $ from "jquery"; + //data page -$(document).ready(function() { +$(function() { var getDumpData = function(target, type) { return $.get('https://s3-us-west-2.amazonaws.com/rubygems-dumps/?prefix=production/public_' + type).done(function(data) { var files, xml; @@ -56,16 +58,18 @@ $(document).ready(function() { getDumpData('ul.rubygems-dump-listing-postgresql', 'postgresql'); getDumpData('ul.rubygems-dump-listing-redis', 'redis'); } + }); //stats page -$('.stats__graph__gem__meter').each(function() { - bar_width = $(this).data("bar_width"); - $(this).animate({ width: bar_width + '%' }, 700).removeClass('t-item--hidden').css("display", "block"); +$(function() { + $('.stats__graph__gem__meter').each(function() { + $(this).animate({ width: $(this).data("bar-width") + '%' }, 700).removeClass('t-item--hidden').css("display", "block"); + }); }); //gem page -$(document).ready(function() { +$(function() { $('.gem__users__mfa-text.mfa-warn').on('click', function() { $('.gem__users__mfa-text.mfa-warn').toggleClass('t-item--hidden'); diff --git a/app/assets/javascripts/popup-nav.js b/app/javascript/popup-nav.js similarity index 87% rename from app/assets/javascripts/popup-nav.js rename to app/javascript/popup-nav.js index ed86b3d6735..002b07ac4a8 100644 --- a/app/assets/javascripts/popup-nav.js +++ b/app/javascript/popup-nav.js @@ -1,3 +1,6 @@ +import $ from "jquery"; +import { handleClick } from "./handle-click"; + $(function() { var arrowIcon = $('.header__popup-link'); var popupNav = $('.header__popup__nav-links'); @@ -17,4 +20,3 @@ $(function() { handleClick(e, nav, removeNavExpandedClass, addNavExpandedClass); }); }); - diff --git a/app/assets/javascripts/search.js b/app/javascript/search.js similarity index 97% rename from app/assets/javascripts/search.js rename to app/javascript/search.js index 6c4ecae4439..22f8283ed11 100644 --- a/app/assets/javascripts/search.js +++ b/app/javascript/search.js @@ -1,3 +1,5 @@ +import $ from "jquery"; + if($("#advanced-search").length){ var $main = $('#home_query'); var $name = $('input#name'); diff --git a/app/assets/javascripts/transitive_dependencies.js b/app/javascript/transitive_dependencies.js similarity index 98% rename from app/assets/javascripts/transitive_dependencies.js rename to app/javascript/transitive_dependencies.js index 36cccd41a68..d9faadbb6bb 100755 --- a/app/assets/javascripts/transitive_dependencies.js +++ b/app/javascript/transitive_dependencies.js @@ -1,3 +1,5 @@ +import $ from "jquery"; + $(document).on('click', '.deps_expanded-link', function () { var current = $(this); var gem_id = $(this).attr('data-gem_id'); diff --git a/app/assets/javascripts/webauthn.js b/app/javascript/webauthn.js similarity index 98% rename from app/assets/javascripts/webauthn.js rename to app/javascript/webauthn.js index 30aff380ac9..406e11dd887 100644 --- a/app/assets/javascripts/webauthn.js +++ b/app/javascript/webauthn.js @@ -1,3 +1,6 @@ +import $ from "jquery"; +import { bufferToBase64url, base64urlToBuffer } from "webauthn-json" + (function() { const handleEvent = function(event) { event.preventDefault(); @@ -48,7 +51,7 @@ }; const parseCreationOptionsFromJSON = function(json) { - return { + return { ...json, challenge: base64urlToBuffer(json.challenge), user: { ...json.user, id: base64urlToBuffer(json.user.id) }, diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 0753cbb8f9e..6c2f99f75ef 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -21,6 +21,7 @@ <%= render "layouts/feeds" %> <%= csrf_meta_tag %> <%= yield :head %> + <%= javascript_importmap_tags %> @@ -216,8 +217,6 @@ <% end %> - - <%= javascript_include_tag "application" %> <%= yield :javascript %> diff --git a/app/views/stats/index.html.erb b/app/views/stats/index.html.erb index cd9b8cdc5ae..69555fc487f 100644 --- a/app/views/stats/index.html.erb +++ b/app/views/stats/index.html.erb @@ -27,7 +27,7 @@

<%= link_to gem.name, rubygem_path(gem.slug) %>

-
+
<%= number_to_delimited gem.downloads %>
diff --git a/bin/importmap b/bin/importmap new file mode 100755 index 00000000000..36502ab16c7 --- /dev/null +++ b/bin/importmap @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby + +require_relative "../config/application" +require "importmap/commands" diff --git a/config/importmap.rb b/config/importmap.rb new file mode 100644 index 00000000000..dddcf10bd8a --- /dev/null +++ b/config/importmap.rb @@ -0,0 +1,12 @@ +# Pin npm packages by running ./bin/importmap + +pin "application", preload: true + +# vendored and adapted from https://github.com/mdo/github-buttons/blob/master/src/js.js +pin "github-buttons" +# vendored from github in the before times +pin "webauthn-json" + +pin "jquery" # @3.7.1 +pin "@rails/ujs", to: "@rails--ujs.js" # @7.1.3 +pin "clipboard" # @2.0.11 diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 6537637532e..af52e1a9434 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -10,13 +10,19 @@ policy.img_src :self, "https://secure.gaug.es", "https://gravatar.com", "https://www.gravatar.com", "https://secure.gravatar.com", "https://*.fastly-insights.com", "https://avatars.githubusercontent.com" policy.object_src :none - policy.script_src :self, "https://secure.gaug.es", "https://www.fastly-insights.com", - "https://unpkg.com/@hotwired/stimulus/dist/stimulus.umd.js", "https://unpkg.com/stimulus-rails-nested-form/dist/stimulus-rails-nested-form.umd.js" + # NOTE: This scirpt_src is overridden for all requests in ApplicationController + # This is the baseline in case the override is ever skipped + policy.script_src :self, + "https://secure.gaug.es", + "https://www.fastly-insights.com", + "https://unpkg.com/@hotwired/stimulus/dist/stimulus.umd.js", + "https://unpkg.com/stimulus-rails-nested-form/dist/stimulus-rails-nested-form.umd.js" policy.style_src :self, "https://fonts.googleapis.com" policy.connect_src :self, "https://s3-us-west-2.amazonaws.com/rubygems-dumps/", "https://*.fastly-insights.com", "https://fastly-insights.com", "https://api.github.com", "http://localhost:*" policy.form_action :self, "https://github.com/login/oauth/authorize" policy.frame_ancestors :self + policy.base_uri :self # Specify URI for violation reports policy.report_uri lambda { @@ -45,7 +51,12 @@ end # Generate session nonces for permitted importmap, inline scripts, and inline styles. -Rails.application.config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +Rails.application.config.content_security_policy_nonce_generator = lambda { |request| + # Suggested nonce generator doesn't work on first page load https://github.com/rails/rails/issues/48463 + # Related PR attempting to fix: https://github.com/rails/rails/pull/48510 + request.session.send(:load_for_write!) # force session to be created + request.session.id.to_s.presence || SecureRandom.base64(16) +} Rails.application.config.content_security_policy_nonce_directives = %w[script-src style-src] # Report CSP violations to a specified URI. See: diff --git a/lib/gemcutter/middleware/admin_auth.rb b/lib/gemcutter/middleware/admin_auth.rb index 0e6075ecc21..4037502321c 100644 --- a/lib/gemcutter/middleware/admin_auth.rb +++ b/lib/gemcutter/middleware/admin_auth.rb @@ -32,7 +32,11 @@ def call end return if allow_unauthenticated_request?(request) login_page = ApplicationController.renderer.new(request.env).render(template: "avo/login", layout: false) - [200, { "cache-control" => "private, max-age=0", "set-cookie" => cookies.to_header }, [login_page]] + + headers = { "cache-control" => "private, max-age=0", "set-cookie" => cookies.to_header } + headers.compact_blank! + + [200, headers, [login_page]] end private diff --git a/lib/tasks/helpers/importmap_helper.rb b/lib/tasks/helpers/importmap_helper.rb new file mode 100644 index 00000000000..861bcc589ca --- /dev/null +++ b/lib/tasks/helpers/importmap_helper.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +require "importmap/packager" + +module ImportmapHelper + VerifyError = Class.new(StandardError) + + class Packager < Importmap::Packager + self.endpoint = URI("https://api.jspm.io/generate") + + # Copied from https://github.com/rails/importmap-rails/pull/237 + def verify(package, url) + ensure_vendor_directory_exists + + return unless vendored_package_path(package).file? + verify_vendored_package(package, url) + end + + def verify_vendored_package(package, url) + vendored_body = vendored_package_path(package).read.strip + remote_body = load_package_file(package, url).strip + + return true if vendored_body == remote_body + + raise ImportmapHelper::VerifyError, "Vendored #{package}#{extract_package_version_from(url)} does not match remote #{url}" + end + + def load_package_file(package, url) + response = Net::HTTP.get_response(URI(url)) + + if response.code == "200" + format_vendored_package(package, url, response.body) + else + handle_failure_response(response) + end + end + + def format_vendored_package(package, url, source) + formatted = +"" + if Gem::Version.new(Importmap::VERSION) > Gem::Version.new("2.0.1") + formatted.concat "// #{package}#{extract_package_version_from(url)} downloaded from #{url}\n\n" + end + formatted.concat remove_sourcemap_comment_from(source).force_encoding("UTF-8") + formatted + end + + def save_vendored_package(package, _url, source) + File.write(vendored_package_path(package), source) + end + + public :vendored_package_path + end +end diff --git a/lib/tasks/importmap.rake b/lib/tasks/importmap.rake new file mode 100644 index 00000000000..e941b84d6c2 --- /dev/null +++ b/lib/tasks/importmap.rake @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require "importmap/npm" +require "tasks/helpers/importmap_helper" + +namespace :importmap do + desc "Verify downloaded packages in vendor/javascript" + task :verify do # rubocop:disable Rails/RakeEnvironment + all_files = Rails.root.glob("vendor/javascript/*.js").map { |p| p.relative_path_from(Rails.root) } + all_files.delete(Pathname.new("vendor/javascript/github-buttons.js")) || raise("importmap:verify expected github-buttons.js not found") + all_files.delete(Pathname.new("vendor/javascript/webauthn-json.js")) || raise("importmap:verify expected webauthn-json.js not found") + + npm = Importmap::Npm.new(Rails.root.join("config/importmap.rb")) + + packages = npm.packages_with_versions.map do |p, v| + v.blank? ? p : [p, v].join("@") + end + + puts "Verifying packages in vendor/javascript" + + packager = ImportmapHelper::Packager.new + + if (imports = packager.import(*packages, env: "production", from: "jspm.io")) + imports.each do |package, url| + puts %(Verifying "#{package}" download from #{url}) + packager.verify(package, url) + path = packager.vendored_package_path(package) + puts %(Verified "#{package}" at #{path}) + all_files.delete path + end + + if all_files.empty? + puts "All pinned js in vendor/javascript verified." + else + puts "Remaining files in vendor not verified:" + # ignore known manually vendored files or raise if they get deleted without updating the task + + all_files.each do |f| + puts " - #{f}" + end + exit 1 + end + else + warn "No packages found" + exit 1 + end + end +end diff --git a/test/system/autocompletes_test.rb b/test/system/autocompletes_test.rb index e1e76ba4858..54dfc3c5504 100644 --- a/test/system/autocompletes_test.rb +++ b/test/system/autocompletes_test.rb @@ -13,16 +13,7 @@ class AutocompletesTest < ApplicationSystemTestCase visit root_path @fill_field = find_by_id "home_query" @fill_field.set "rubo" - wait_for_ajax - end - - def wait_for_ajax - Timeout.timeout(Capybara.default_max_wait_time) do - loop do - active = page.evaluate_script("jQuery.active") - break if active.zero? - end - end + page.find(".autocomplete-done", wait: Capybara.default_max_wait_time) end test "search field" do diff --git a/test/system/stats_test.rb b/test/system/stats_test.rb index b6a164f473f..d12e116a11d 100644 --- a/test/system/stats_test.rb +++ b/test/system/stats_test.rb @@ -8,7 +8,7 @@ class StatsTest < ApplicationSystemTestCase test "downloads animation bar" do visit stats_path - assert page.find(:css, ".stats__graph__gem__meter") + assert page.find(".stats__graph__gem__meter", wait: Capybara.default_max_wait_time) assert page.has_content?(@rubygem.downloads) end end diff --git a/vendor/assets/javascripts/clipboard.js b/vendor/assets/javascripts/clipboard.js deleted file mode 100644 index c7d5312c846..00000000000 --- a/vendor/assets/javascripts/clipboard.js +++ /dev/null @@ -1,864 +0,0 @@ -/*! - * clipboard.js v2.0.8 - * https://clipboardjs.com/ - * - * Licensed MIT © Zeno Rocha - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["ClipboardJS"] = factory(); - else - root["ClipboardJS"] = factory(); -})(this, function() { -return /******/ (function() { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ 747: -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, { - "default": function() { return /* binding */ clipboard; } -}); - -// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js -var tiny_emitter = __webpack_require__(279); -var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter); -// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js -var listen = __webpack_require__(370); -var listen_default = /*#__PURE__*/__webpack_require__.n(listen); -// EXTERNAL MODULE: ./node_modules/select/src/select.js -var src_select = __webpack_require__(817); -var select_default = /*#__PURE__*/__webpack_require__.n(src_select); -;// CONCATENATED MODULE: ./src/common/command.js -/** - * Executes a given operation type. - * @param {String} type - * @return {Boolean} - */ -function command(type) { - try { - return document.execCommand(type); - } catch (err) { - return false; - } -} -;// CONCATENATED MODULE: ./src/clipboard-action-cut.js - - -/** - * Cut action wrapper. - * @param {HTMLElement} target - * @return {String} - */ - -var ClipboardActionCut = function ClipboardActionCut(target) { - var selectedText = select_default()(target); - command('cut'); - return selectedText; -}; - -/* harmony default export */ var clipboard_action_cut = (ClipboardActionCut); -;// CONCATENATED MODULE: ./src/common/create-fake-element.js -/** - * Creates a fake textarea element with a value. - * @param {String} value - * @return {HTMLElement} - */ -function createFakeElement(value) { - var isRTL = document.documentElement.getAttribute('dir') === 'rtl'; - var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS - - fakeElement.style.fontSize = '12pt'; // Reset box model - - fakeElement.style.border = '0'; - fakeElement.style.padding = '0'; - fakeElement.style.margin = '0'; // Move element out of screen horizontally - - fakeElement.style.position = 'absolute'; - fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically - - var yPosition = window.pageYOffset || document.documentElement.scrollTop; - fakeElement.style.top = "".concat(yPosition, "px"); - fakeElement.setAttribute('readonly', ''); - fakeElement.value = value; - return fakeElement; -} -;// CONCATENATED MODULE: ./src/clipboard-action-copy.js - - - -/** - * Copy action wrapper. - * @param {String|HTMLElement} target - * @param {Object} options - * @return {String} - */ - -var ClipboardActionCopy = function ClipboardActionCopy(target) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { - container: document.body - }; - var selectedText = ''; - - if (typeof target === 'string') { - var fakeElement = createFakeElement(target); - options.container.appendChild(fakeElement); - selectedText = select_default()(fakeElement); - command('copy'); - fakeElement.remove(); - } else { - selectedText = select_default()(target); - command('copy'); - } - - return selectedText; -}; - -/* harmony default export */ var clipboard_action_copy = (ClipboardActionCopy); -;// CONCATENATED MODULE: ./src/clipboard-action-default.js -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - - - -/** - * Inner function which performs selection from either `text` or `target` - * properties and then executes copy or cut operations. - * @param {Object} options - */ - -var ClipboardActionDefault = function ClipboardActionDefault() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - // Defines base properties passed from constructor. - var _options$action = options.action, - action = _options$action === void 0 ? 'copy' : _options$action, - container = options.container, - target = options.target, - text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'. - - if (action !== 'copy' && action !== 'cut') { - throw new Error('Invalid "action" value, use either "copy" or "cut"'); - } // Sets the `target` property using an element that will be have its content copied. - - - if (target !== undefined) { - if (target && _typeof(target) === 'object' && target.nodeType === 1) { - if (action === 'copy' && target.hasAttribute('disabled')) { - throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); - } - - if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { - throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); - } - } else { - throw new Error('Invalid "target" value, use a valid Element'); - } - } // Define selection strategy based on `text` property. - - - if (text) { - return clipboard_action_copy(text, { - container: container - }); - } // Defines which selection strategy based on `target` property. - - - if (target) { - return action === 'cut' ? clipboard_action_cut(target) : clipboard_action_copy(target, { - container: container - }); - } -}; - -/* harmony default export */ var clipboard_action_default = (ClipboardActionDefault); -;// CONCATENATED MODULE: ./src/clipboard.js -function clipboard_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return clipboard_typeof(obj); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } - -function _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - - - - - - -/** - * Helper function to retrieve attribute value. - * @param {String} suffix - * @param {Element} element - */ - -function getAttributeValue(suffix, element) { - var attribute = "data-clipboard-".concat(suffix); - - if (!element.hasAttribute(attribute)) { - return; - } - - return element.getAttribute(attribute); -} -/** - * Base class which takes one or more elements, adds event listeners to them, - * and instantiates a new `ClipboardAction` on each click. - */ - - -var Clipboard = /*#__PURE__*/function (_Emitter) { - _inherits(Clipboard, _Emitter); - - var _super = _createSuper(Clipboard); - - /** - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - * @param {Object} options - */ - function Clipboard(trigger, options) { - var _this; - - _classCallCheck(this, Clipboard); - - _this = _super.call(this); - _this.ClipboardActionCut = clipboard_action_cut.bind(_assertThisInitialized(_this)); - _this.ClipboardActionCopy = clipboard_action_copy.bind(_assertThisInitialized(_this)); - - _this.resolveOptions(options); - - _this.listenClick(trigger); - - return _this; - } - /** - * Defines if attributes would be resolved using internal setter functions - * or custom functions that were passed in the constructor. - * @param {Object} options - */ - - - _createClass(Clipboard, [{ - key: "resolveOptions", - value: function resolveOptions() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - this.action = typeof options.action === 'function' ? options.action : this.defaultAction; - this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; - this.text = typeof options.text === 'function' ? options.text : this.defaultText; - this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body; - } - /** - * Adds a click event listener to the passed trigger. - * @param {String|HTMLElement|HTMLCollection|NodeList} trigger - */ - - }, { - key: "listenClick", - value: function listenClick(trigger) { - var _this2 = this; - - this.listener = listen_default()(trigger, 'click', function (e) { - return _this2.onClick(e); - }); - } - /** - * Defines a new `ClipboardAction` on each click event. - * @param {Event} e - */ - - }, { - key: "onClick", - value: function onClick(e) { - var trigger = e.delegateTarget || e.currentTarget; - var selectedText = clipboard_action_default({ - action: this.action(trigger), - container: this.container, - target: this.target(trigger), - text: this.text(trigger) - }); // Fires an event based on the copy operation result. - - this.emit(selectedText ? 'success' : 'error', { - action: this.action, - text: selectedText, - trigger: trigger, - clearSelection: function clearSelection() { - if (trigger) { - trigger.focus(); - } - - document.activeElement.blur(); - window.getSelection().removeAllRanges(); - } - }); - } - /** - * Default `action` lookup function. - * @param {Element} trigger - */ - - }, { - key: "defaultAction", - value: function defaultAction(trigger) { - return getAttributeValue('action', trigger); - } - /** - * Default `target` lookup function. - * @param {Element} trigger - */ - - }, { - key: "defaultTarget", - value: function defaultTarget(trigger) { - var selector = getAttributeValue('target', trigger); - - if (selector) { - return document.querySelector(selector); - } - } - }, { - key: "defaultText", - - /** - * Default `text` lookup function. - * @param {Element} trigger - */ - value: function defaultText(trigger) { - return getAttributeValue('text', trigger); - } - /** - * Destroy lifecycle. - */ - - }, { - key: "destroy", - value: function destroy() { - this.listener.destroy(); - } - }], [{ - key: "copy", - value: function copy(target) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { - container: document.body - }; - return clipboard_action_copy(target, options); - } - }, { - key: "cut", - value: function cut(target) { - return clipboard_action_cut(target); - } - /** - * Returns the support of the given action, or all actions if no action is - * given. - * @param {String} [action] - */ - - }, { - key: "isSupported", - value: function isSupported() { - var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; - var actions = typeof action === 'string' ? [action] : action; - var support = !!document.queryCommandSupported; - actions.forEach(function (action) { - support = support && !!document.queryCommandSupported(action); - }); - return support; - } - }]); - - return Clipboard; -}((tiny_emitter_default())); - -/* harmony default export */ var clipboard = (Clipboard); - -/***/ }), - -/***/ 828: -/***/ (function(module) { - -var DOCUMENT_NODE_TYPE = 9; - -/** - * A polyfill for Element.matches() - */ -if (typeof Element !== 'undefined' && !Element.prototype.matches) { - var proto = Element.prototype; - - proto.matches = proto.matchesSelector || - proto.mozMatchesSelector || - proto.msMatchesSelector || - proto.oMatchesSelector || - proto.webkitMatchesSelector; -} - -/** - * Finds the closest parent that matches a selector. - * - * @param {Element} element - * @param {String} selector - * @return {Function} - */ -function closest (element, selector) { - while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { - if (typeof element.matches === 'function' && - element.matches(selector)) { - return element; - } - element = element.parentNode; - } -} - -module.exports = closest; - - -/***/ }), - -/***/ 438: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -var closest = __webpack_require__(828); - -/** - * Delegates event to a selector. - * - * @param {Element} element - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @param {Boolean} useCapture - * @return {Object} - */ -function _delegate(element, selector, type, callback, useCapture) { - var listenerFn = listener.apply(this, arguments); - - element.addEventListener(type, listenerFn, useCapture); - - return { - destroy: function() { - element.removeEventListener(type, listenerFn, useCapture); - } - } -} - -/** - * Delegates event to a selector. - * - * @param {Element|String|Array} [elements] - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @param {Boolean} useCapture - * @return {Object} - */ -function delegate(elements, selector, type, callback, useCapture) { - // Handle the regular Element usage - if (typeof elements.addEventListener === 'function') { - return _delegate.apply(null, arguments); - } - - // Handle Element-less usage, it defaults to global delegation - if (typeof type === 'function') { - // Use `document` as the first parameter, then apply arguments - // This is a short way to .unshift `arguments` without running into deoptimizations - return _delegate.bind(null, document).apply(null, arguments); - } - - // Handle Selector-based usage - if (typeof elements === 'string') { - elements = document.querySelectorAll(elements); - } - - // Handle Array-like based usage - return Array.prototype.map.call(elements, function (element) { - return _delegate(element, selector, type, callback, useCapture); - }); -} - -/** - * Finds closest match and invokes callback. - * - * @param {Element} element - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @return {Function} - */ -function listener(element, selector, type, callback) { - return function(e) { - e.delegateTarget = closest(e.target, selector); - - if (e.delegateTarget) { - callback.call(element, e); - } - } -} - -module.exports = delegate; - - -/***/ }), - -/***/ 879: -/***/ (function(__unused_webpack_module, exports) { - -/** - * Check if argument is a HTML element. - * - * @param {Object} value - * @return {Boolean} - */ -exports.node = function(value) { - return value !== undefined - && value instanceof HTMLElement - && value.nodeType === 1; -}; - -/** - * Check if argument is a list of HTML elements. - * - * @param {Object} value - * @return {Boolean} - */ -exports.nodeList = function(value) { - var type = Object.prototype.toString.call(value); - - return value !== undefined - && (type === '[object NodeList]' || type === '[object HTMLCollection]') - && ('length' in value) - && (value.length === 0 || exports.node(value[0])); -}; - -/** - * Check if argument is a string. - * - * @param {Object} value - * @return {Boolean} - */ -exports.string = function(value) { - return typeof value === 'string' - || value instanceof String; -}; - -/** - * Check if argument is a function. - * - * @param {Object} value - * @return {Boolean} - */ -exports.fn = function(value) { - var type = Object.prototype.toString.call(value); - - return type === '[object Function]'; -}; - - -/***/ }), - -/***/ 370: -/***/ (function(module, __unused_webpack_exports, __webpack_require__) { - -var is = __webpack_require__(879); -var delegate = __webpack_require__(438); - -/** - * Validates all params and calls the right - * listener function based on its target type. - * - * @param {String|HTMLElement|HTMLCollection|NodeList} target - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listen(target, type, callback) { - if (!target && !type && !callback) { - throw new Error('Missing required arguments'); - } - - if (!is.string(type)) { - throw new TypeError('Second argument must be a String'); - } - - if (!is.fn(callback)) { - throw new TypeError('Third argument must be a Function'); - } - - if (is.node(target)) { - return listenNode(target, type, callback); - } - else if (is.nodeList(target)) { - return listenNodeList(target, type, callback); - } - else if (is.string(target)) { - return listenSelector(target, type, callback); - } - else { - throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); - } -} - -/** - * Adds an event listener to a HTML element - * and returns a remove listener function. - * - * @param {HTMLElement} node - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listenNode(node, type, callback) { - node.addEventListener(type, callback); - - return { - destroy: function() { - node.removeEventListener(type, callback); - } - } -} - -/** - * Add an event listener to a list of HTML elements - * and returns a remove listener function. - * - * @param {NodeList|HTMLCollection} nodeList - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listenNodeList(nodeList, type, callback) { - Array.prototype.forEach.call(nodeList, function(node) { - node.addEventListener(type, callback); - }); - - return { - destroy: function() { - Array.prototype.forEach.call(nodeList, function(node) { - node.removeEventListener(type, callback); - }); - } - } -} - -/** - * Add an event listener to a selector - * and returns a remove listener function. - * - * @param {String} selector - * @param {String} type - * @param {Function} callback - * @return {Object} - */ -function listenSelector(selector, type, callback) { - return delegate(document.body, selector, type, callback); -} - -module.exports = listen; - - -/***/ }), - -/***/ 817: -/***/ (function(module) { - -function select(element) { - var selectedText; - - if (element.nodeName === 'SELECT') { - element.focus(); - - selectedText = element.value; - } - else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { - var isReadOnly = element.hasAttribute('readonly'); - - if (!isReadOnly) { - element.setAttribute('readonly', ''); - } - - element.select(); - element.setSelectionRange(0, element.value.length); - - if (!isReadOnly) { - element.removeAttribute('readonly'); - } - - selectedText = element.value; - } - else { - if (element.hasAttribute('contenteditable')) { - element.focus(); - } - - var selection = window.getSelection(); - var range = document.createRange(); - - range.selectNodeContents(element); - selection.removeAllRanges(); - selection.addRange(range); - - selectedText = selection.toString(); - } - - return selectedText; -} - -module.exports = select; - - -/***/ }), - -/***/ 279: -/***/ (function(module) { - -function E () { - // Keep this empty so it's easier to inherit from - // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) -} - -E.prototype = { - on: function (name, callback, ctx) { - var e = this.e || (this.e = {}); - - (e[name] || (e[name] = [])).push({ - fn: callback, - ctx: ctx - }); - - return this; - }, - - once: function (name, callback, ctx) { - var self = this; - function listener () { - self.off(name, listener); - callback.apply(ctx, arguments); - }; - - listener._ = callback - return this.on(name, listener, ctx); - }, - - emit: function (name) { - var data = [].slice.call(arguments, 1); - var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); - var i = 0; - var len = evtArr.length; - - for (i; i < len; i++) { - evtArr[i].fn.apply(evtArr[i].ctx, data); - } - - return this; - }, - - off: function (name, callback) { - var e = this.e || (this.e = {}); - var evts = e[name]; - var liveEvents = []; - - if (evts && callback) { - for (var i = 0, len = evts.length; i < len; i++) { - if (evts[i].fn !== callback && evts[i].fn._ !== callback) - liveEvents.push(evts[i]); - } - } - - // Remove event from queue to prevent memory leak - // Suggested by https://github.com/lazd - // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 - - (liveEvents.length) - ? e[name] = liveEvents - : delete e[name]; - - return this; - } -}; - -module.exports = E; -module.exports.TinyEmitter = E; - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ !function() { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ !function() { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ }(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); -/******/ -/************************************************************************/ -/******/ // module exports must be returned from runtime so entry inlining is disabled -/******/ // startup -/******/ // Load entry module and return exports -/******/ return __webpack_require__(747); -/******/ })() -.default; -}); \ No newline at end of file diff --git a/vendor/javascript/@rails--ujs.js b/vendor/javascript/@rails--ujs.js new file mode 100644 index 00000000000..bb3135b1de5 --- /dev/null +++ b/vendor/javascript/@rails--ujs.js @@ -0,0 +1,2 @@ +const t="a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]";const e={selector:"button[data-remote]:not([form]), button[data-confirm]:not([form])",exclude:"form button"};const n="select[data-remote], input[data-remote], textarea[data-remote]";const o="form:not([data-turbo=true])";const a="form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])";const r="input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled";const c="input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled";const s="input[name][type=file]:not([disabled])";const i="a[data-disable-with], a[data-disable]";const u="button[data-remote][data-disable-with], button[data-remote][data-disable]";let l=null;const loadCSPNonce=()=>{const t=document.querySelector("meta[name=csp-nonce]");return l=t&&t.content};const cspNonce=()=>l||loadCSPNonce();const d=Element.prototype.matches||Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector;const matches=function(t,e){return e.exclude?d.call(t,e.selector)&&!d.call(t,e.exclude):d.call(t,e)};const m="_ujsData";const getData=(t,e)=>t[m]?t[m][e]:void 0;const setData=function(t,e,n){t[m]||(t[m]={});return t[m][e]=n};const $=t=>Array.prototype.slice.call(document.querySelectorAll(t));const isContentEditable=function(t){var e=false;do{if(t.isContentEditable){e=true;break}t=t.parentElement}while(t);return e};const csrfToken=()=>{const t=document.querySelector("meta[name=csrf-token]");return t&&t.content};const csrfParam=()=>{const t=document.querySelector("meta[name=csrf-param]");return t&&t.content};const CSRFProtection=t=>{const e=csrfToken();if(e)return t.setRequestHeader("X-CSRF-Token",e)};const refreshCSRFTokens=()=>{const t=csrfToken();const e=csrfParam();if(t&&e)return $('form input[name="'+e+'"]').forEach((e=>e.value=t))};const p={"*":"*/*",text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript",script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"};const ajax=t=>{t=prepareOptions(t);var e=createXHR(t,(function(){const n=processResponse(e.response!=null?e.response:e.responseText,e.getResponseHeader("Content-Type"));Math.floor(e.status/100)===2?typeof t.success==="function"&&t.success(n,e.statusText,e):typeof t.error==="function"&&t.error(n,e.statusText,e);return typeof t.complete==="function"?t.complete(e,e.statusText):void 0}));return!(t.beforeSend&&!t.beforeSend(e,t))&&(e.readyState===XMLHttpRequest.OPENED?e.send(t.data):void 0)};var prepareOptions=function(t){t.url=t.url||location.href;t.type=t.type.toUpperCase();t.type==="GET"&&t.data&&(t.url.indexOf("?")<0?t.url+="?"+t.data:t.url+="&"+t.data);t.dataType in p||(t.dataType="*");t.accept=p[t.dataType];t.dataType!=="*"&&(t.accept+=", */*; q=0.01");return t};var createXHR=function(t,e){const n=new XMLHttpRequest;n.open(t.type,t.url,true);n.setRequestHeader("Accept",t.accept);typeof t.data==="string"&&n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");if(!t.crossDomain){n.setRequestHeader("X-Requested-With","XMLHttpRequest");CSRFProtection(n)}n.withCredentials=!!t.withCredentials;n.onreadystatechange=function(){if(n.readyState===XMLHttpRequest.DONE)return e(n)};return n};var processResponse=function(t,e){if(typeof t==="string"&&typeof e==="string")if(e.match(/\bjson\b/))try{t=JSON.parse(t)}catch(t){}else if(e.match(/\b(?:java|ecma)script\b/)){const e=document.createElement("script");e.setAttribute("nonce",cspNonce());e.text=t;document.head.appendChild(e).parentNode.removeChild(e)}else if(e.match(/\b(xml|html|svg)\b/)){const n=new DOMParser;e=e.replace(/;.+/,"");try{t=n.parseFromString(t,e)}catch(t){}}return t};const href=t=>t.href;const isCrossDomain=function(t){const e=document.createElement("a");e.href=location.href;const n=document.createElement("a");try{n.href=t;return!((!n.protocol||n.protocol===":")&&!n.host||e.protocol+"//"+e.host===n.protocol+"//"+n.host)}catch(t){return true}};let f;let{CustomEvent:b}=window;if(typeof b!=="function"){b=function(t,e){const n=document.createEvent("CustomEvent");n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail);return n};b.prototype=window.Event.prototype;({preventDefault:f}=b.prototype);b.prototype.preventDefault=function(){const t=f.call(this);this.cancelable&&!this.defaultPrevented&&Object.defineProperty(this,"defaultPrevented",{get(){return true}});return t}}const fire=(t,e,n)=>{const o=new b(e,{bubbles:true,cancelable:true,detail:n});t.dispatchEvent(o);return!o.defaultPrevented};const stopEverything=t=>{fire(t.target,"ujs:everythingStopped");t.preventDefault();t.stopPropagation();t.stopImmediatePropagation()};const delegate=(t,e,n,o)=>t.addEventListener(n,(function(t){let{target:n}=t;while(!!(n instanceof Element)&&!matches(n,e))n=n.parentNode;if(n instanceof Element&&o.call(n,t)===false){t.preventDefault();t.stopPropagation()}}));const toArray=t=>Array.prototype.slice.call(t);const serializeElement=(t,e)=>{let n=[t];matches(t,"form")&&(n=toArray(t.elements));const o=[];n.forEach((function(t){t.name&&!t.disabled&&(matches(t,"fieldset[disabled] *")||(matches(t,"select")?toArray(t.options).forEach((function(e){e.selected&&o.push({name:t.name,value:e.value})})):(t.checked||["radio","checkbox","submit"].indexOf(t.type)===-1)&&o.push({name:t.name,value:t.value})))}));e&&o.push(e);return o.map((function(t){return t.name?`${encodeURIComponent(t.name)}=${encodeURIComponent(t.value)}`:t})).join("&")};const formElements=(t,e)=>matches(t,"form")?toArray(t.elements).filter((t=>matches(t,e))):toArray(t.querySelectorAll(e));const handleConfirmWithRails=t=>function(e){allowAction(this,t)||stopEverything(e)};const confirm=(t,e)=>window.confirm(t);var allowAction=function(t,e){let n;const o=t.getAttribute("data-confirm");if(!o)return true;let a=false;if(fire(t,"confirm")){try{a=e.confirm(o,t)}catch(t){}n=fire(t,"confirm:complete",[a])}return a&&n};const handleDisabledElement=function(t){const e=this;e.disabled&&stopEverything(t)};const enableElement=t=>{let e;if(t instanceof Event){if(isXhrRedirect(t))return;e=t.target}else e=t;if(!isContentEditable(e))return matches(e,i)?enableLinkElement(e):matches(e,u)||matches(e,c)?enableFormElement(e):matches(e,o)?enableFormElements(e):void 0};const disableElement=t=>{const e=t instanceof Event?t.target:t;if(!isContentEditable(e))return matches(e,i)?disableLinkElement(e):matches(e,u)||matches(e,r)?disableFormElement(e):matches(e,o)?disableFormElements(e):void 0};var disableLinkElement=function(t){if(getData(t,"ujs:disabled"))return;const e=t.getAttribute("data-disable-with");if(e!=null){setData(t,"ujs:enable-with",t.innerHTML);t.innerHTML=e}t.addEventListener("click",stopEverything);return setData(t,"ujs:disabled",true)};var enableLinkElement=function(t){const e=getData(t,"ujs:enable-with");if(e!=null){t.innerHTML=e;setData(t,"ujs:enable-with",null)}t.removeEventListener("click",stopEverything);return setData(t,"ujs:disabled",null)};var disableFormElements=t=>formElements(t,r).forEach(disableFormElement);var disableFormElement=function(t){if(getData(t,"ujs:disabled"))return;const e=t.getAttribute("data-disable-with");if(e!=null)if(matches(t,"button")){setData(t,"ujs:enable-with",t.innerHTML);t.innerHTML=e}else{setData(t,"ujs:enable-with",t.value);t.value=e}t.disabled=true;return setData(t,"ujs:disabled",true)};var enableFormElements=t=>formElements(t,c).forEach((t=>enableFormElement(t)));var enableFormElement=function(t){const e=getData(t,"ujs:enable-with");if(e!=null){matches(t,"button")?t.innerHTML=e:t.value=e;setData(t,"ujs:enable-with",null)}t.disabled=false;return setData(t,"ujs:disabled",null)};var isXhrRedirect=function(t){const e=t.detail?t.detail[0]:void 0;return e&&e.getResponseHeader("X-Xhr-Redirect")};const handleMethodWithRails=t=>function(e){const n=this;const o=n.getAttribute("data-method");if(!o)return;if(isContentEditable(this))return;const a=t.href(n);const r=csrfToken();const c=csrfParam();const s=document.createElement("form");let i=``;c&&r&&!isCrossDomain(a)&&(i+=``);i+='';s.method="post";s.action=a;s.target=n.target;s.innerHTML=i;s.style.display="none";document.body.appendChild(s);s.querySelector('[type="submit"]').click();stopEverything(e)};const isRemote=function(t){const e=t.getAttribute("data-remote");return e!=null&&e!=="false"};const handleRemoteWithRails=t=>function(a){let r,c,s;const i=this;if(!isRemote(i))return true;if(!fire(i,"ajax:before")){fire(i,"ajax:stopped");return false}if(isContentEditable(i)){fire(i,"ajax:stopped");return false}const u=i.getAttribute("data-with-credentials");const l=i.getAttribute("data-type")||"script";if(matches(i,o)){const t=getData(i,"ujs:submit-button");c=getData(i,"ujs:submit-button-formmethod")||i.getAttribute("method")||"get";s=getData(i,"ujs:submit-button-formaction")||i.getAttribute("action")||location.href;c.toUpperCase()==="GET"&&(s=s.replace(/\?.*$/,""));if(i.enctype==="multipart/form-data"){r=new FormData(i);t!=null&&r.append(t.name,t.value)}else r=serializeElement(i,t);setData(i,"ujs:submit-button",null);setData(i,"ujs:submit-button-formmethod",null);setData(i,"ujs:submit-button-formaction",null)}else if(matches(i,e)||matches(i,n)){c=i.getAttribute("data-method");s=i.getAttribute("data-url");r=serializeElement(i,i.getAttribute("data-params"))}else{c=i.getAttribute("data-method");s=t.href(i);r=i.getAttribute("data-params")}ajax({type:c||"GET",url:s,data:r,dataType:l,beforeSend(t,e){if(fire(i,"ajax:beforeSend",[t,e]))return fire(i,"ajax:send",[t]);fire(i,"ajax:stopped");return false},success(...t){return fire(i,"ajax:success",t)},error(...t){return fire(i,"ajax:error",t)},complete(...t){return fire(i,"ajax:complete",t)},crossDomain:isCrossDomain(s),withCredentials:u!=null&&u!=="false"});stopEverything(a)};const formSubmitButtonClick=function(t){const e=this;const{form:n}=e;if(n){e.name&&setData(n,"ujs:submit-button",{name:e.name,value:e.value});setData(n,"ujs:formnovalidate-button",e.formNoValidate);setData(n,"ujs:submit-button-formaction",e.getAttribute("formaction"));return setData(n,"ujs:submit-button-formmethod",e.getAttribute("formmethod"))}};const preventInsignificantClick=function(t){const e=this;const n=(e.getAttribute("data-method")||"GET").toUpperCase();const o=e.getAttribute("data-params");const a=t.metaKey||t.ctrlKey;const r=a&&n==="GET"&&!o;const c=t.button!=null&&t.button!==0;(c||r)&&t.stopImmediatePropagation()};const h={$:$,ajax:ajax,buttonClickSelector:e,buttonDisableSelector:u,confirm:confirm,cspNonce:cspNonce,csrfToken:csrfToken,csrfParam:csrfParam,CSRFProtection:CSRFProtection,delegate:delegate,disableElement:disableElement,enableElement:enableElement,fileInputSelector:s,fire:fire,formElements:formElements,formEnableSelector:c,formDisableSelector:r,formInputClickSelector:a,formSubmitButtonClick:formSubmitButtonClick,formSubmitSelector:o,getData:getData,handleDisabledElement:handleDisabledElement,href:href,inputChangeSelector:n,isCrossDomain:isCrossDomain,linkClickSelector:t,linkDisableSelector:i,loadCSPNonce:loadCSPNonce,matches:matches,preventInsignificantClick:preventInsignificantClick,refreshCSRFTokens:refreshCSRFTokens,serializeElement:serializeElement,setData:setData,stopEverything:stopEverything};const y=handleConfirmWithRails(h);h.handleConfirm=y;const j=handleMethodWithRails(h);h.handleMethod=j;const v=handleRemoteWithRails(h);h.handleRemote=v;const start=function(){if(window._rails_loaded)throw new Error("rails-ujs has already been loaded!");window.addEventListener("pageshow",(function(){$(c).forEach((function(t){getData(t,"ujs:disabled")&&enableElement(t)}));$(i).forEach((function(t){getData(t,"ujs:disabled")&&enableElement(t)}))}));delegate(document,i,"ajax:complete",enableElement);delegate(document,i,"ajax:stopped",enableElement);delegate(document,u,"ajax:complete",enableElement);delegate(document,u,"ajax:stopped",enableElement);delegate(document,t,"click",preventInsignificantClick);delegate(document,t,"click",handleDisabledElement);delegate(document,t,"click",y);delegate(document,t,"click",disableElement);delegate(document,t,"click",v);delegate(document,t,"click",j);delegate(document,e,"click",preventInsignificantClick);delegate(document,e,"click",handleDisabledElement);delegate(document,e,"click",y);delegate(document,e,"click",disableElement);delegate(document,e,"click",v);delegate(document,n,"change",handleDisabledElement);delegate(document,n,"change",y);delegate(document,n,"change",v);delegate(document,o,"submit",handleDisabledElement);delegate(document,o,"submit",y);delegate(document,o,"submit",v);delegate(document,o,"submit",(t=>setTimeout((()=>disableElement(t)),13)));delegate(document,o,"ajax:send",disableElement);delegate(document,o,"ajax:complete",enableElement);delegate(document,a,"click",preventInsignificantClick);delegate(document,a,"click",handleDisabledElement);delegate(document,a,"click",y);delegate(document,a,"click",formSubmitButtonClick);document.addEventListener("DOMContentLoaded",refreshCSRFTokens);document.addEventListener("DOMContentLoaded",loadCSPNonce);return window._rails_loaded=true};h.start=start;if(typeof jQuery!=="undefined"&&jQuery&&jQuery.ajax){if(jQuery.rails)throw new Error("If you load both jquery_ujs and rails-ujs, use rails-ujs only.");jQuery.rails=h;jQuery.ajaxPrefilter((function(t,e,n){if(!t.crossDomain)return CSRFProtection(n)}))}export{h as default}; + diff --git a/vendor/javascript/clipboard.js b/vendor/javascript/clipboard.js new file mode 100644 index 00000000000..6f86b6ef044 --- /dev/null +++ b/vendor/javascript/clipboard.js @@ -0,0 +1,186 @@ +var t="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof self?self:global;var e={};(function webpackUniversalModuleDefinition(t,n){e=n()})(0,(function(){return function(){var e={686:function(e,n,r){r.d(n,{default:function(){return h}});var o=r(279);var i=r.n(o);var a=r(370);var u=r.n(a);var c=r(817);var l=r.n(c); +/** + * Executes a given operation type. + * @param {String} type + * @return {Boolean} + */ +function command(t){try{return document.execCommand(t)}catch(t){return false}} +/** + * Cut action wrapper. + * @param {String|HTMLElement} target + * @return {String} + */ +var f=function ClipboardActionCut(t){var e=l()(t);command("cut");return e};var s=f; +/** + * Creates a fake textarea element with a value. + * @param {String} value + * @return {HTMLElement} + */ +function createFakeElement(t){var e="rtl"===document.documentElement.getAttribute("dir");var n=document.createElement("textarea");n.style.fontSize="12pt";n.style.border="0";n.style.padding="0";n.style.margin="0";n.style.position="absolute";n.style[e?"right":"left"]="-9999px";var r=window.pageYOffset||document.documentElement.scrollTop;n.style.top="".concat(r,"px");n.setAttribute("readonly","");n.value=t;return n} +/** + * Create fake copy action wrapper using a fake element. + * @param {String} target + * @param {Object} options + * @return {String} + */ +var p=function fakeCopyAction(t,e){var n=createFakeElement(t);e.container.appendChild(n);var r=l()(n);command("copy");n.remove();return r}; +/** + * Copy action wrapper. + * @param {String|HTMLElement} target + * @param {Object} options + * @return {String} + */var d=function ClipboardActionCopy(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body};var n="";if("string"===typeof t)n=p(t,e);else if(t instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(null===t||void 0===t?void 0:t.type))n=p(t.value,e);else{n=l()(t);command("copy")}return n};var y=d;function _typeof(t){_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return _typeof(t)} +/** + * Inner function which performs selection from either `text` or `target` + * properties and then executes copy or cut operations. + * @param {Object} options + */var v=function ClipboardActionDefault(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e=t.action,n=void 0===e?"copy":e,r=t.container,o=t.target,i=t.text;if("copy"!==n&&"cut"!==n)throw new Error('Invalid "action" value, use either "copy" or "cut"');if(void 0!==o){if(!o||"object"!==_typeof(o)||1!==o.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===n&&o.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===n&&(o.hasAttribute("readonly")||o.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes')}return i?y(i,{container:r}):o?"cut"===n?s(o):y(o,{container:r}):void 0};var b=v;function clipboard_typeof(t){clipboard_typeof="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function _typeof(t){return typeof t}:function _typeof(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};return clipboard_typeof(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};(this||t).action="function"===typeof e.action?e.action:(this||t).defaultAction;(this||t).target="function"===typeof e.target?e.target:(this||t).defaultTarget;(this||t).text="function"===typeof e.text?e.text:(this||t).defaultText;(this||t).container="object"===clipboard_typeof(e.container)?e.container:document.body} +/** + * Adds a click event listener to the passed trigger. + * @param {String|HTMLElement|HTMLCollection|NodeList} trigger + */},{key:"listenClick",value:function listenClick(e){var n=this||t;(this||t).listener=u()(e,"click",(function(t){return n.onClick(t)}))} +/** + * Defines a new `ClipboardAction` on each click event. + * @param {Event} e + */},{key:"onClick",value:function onClick(e){var n=e.delegateTarget||e.currentTarget;var r=this.action(n)||"copy";var o=b({action:r,container:(this||t).container,target:this.target(n),text:this.text(n)});this.emit(o?"success":"error",{action:r,text:o,trigger:n,clearSelection:function clearSelection(){n&&n.focus();window.getSelection().removeAllRanges()}})} +/** + * Default `action` lookup function. + * @param {Element} trigger + */},{key:"defaultAction",value:function defaultAction(t){return getAttributeValue("action",t)} +/** + * Default `target` lookup function. + * @param {Element} trigger + */},{key:"defaultTarget",value:function defaultTarget(t){var e=getAttributeValue("target",t);if(e)return document.querySelector(e)} +/** + * Allow fire programmatically a copy action + * @param {String|HTMLElement} target + * @param {Object} options + * @returns Text copied. + */},{key:"defaultText", +/** + * Default `text` lookup function. + * @param {Element} trigger + */ +value:function defaultText(t){return getAttributeValue("text",t)}},{key:"destroy",value:function destroy(){(this||t).listener.destroy()}}],[{key:"copy",value:function copy(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{container:document.body};return y(t,e)} +/** + * Allow fire programmatically a cut action + * @param {String|HTMLElement} target + * @returns Text cutted. + */},{key:"cut",value:function cut(t){return s(t)} +/** + * Returns the support of the given action, or all actions if no action is + * given. + * @param {String} [action] + */},{key:"isSupported",value:function isSupported(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"];var e="string"===typeof t?[t]:t;var n=!!document.queryCommandSupported;e.forEach((function(t){n=n&&!!document.queryCommandSupported(t)}));return n}}]);return Clipboard}(i());var h=_},828:function(t){var e=9;if("undefined"!==typeof Element&&!Element.prototype.matches){var n=Element.prototype;n.matches=n.matchesSelector||n.mozMatchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.webkitMatchesSelector} +/** + * Finds the closest parent that matches a selector. + * + * @param {Element} element + * @param {String} selector + * @return {Function} + */function closest(t,n){while(t&&t.nodeType!==e){if("function"===typeof t.matches&&t.matches(n))return t;t=t.parentNode}}t.exports=closest},438:function(e,n,r){var o=r(828); +/** + * Delegates event to a selector. + * + * @param {Element} element + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @param {Boolean} useCapture + * @return {Object} + */function _delegate(e,n,r,o,i){var a=listener.apply(this||t,arguments);e.addEventListener(r,a,i);return{destroy:function(){e.removeEventListener(r,a,i)}}} +/** + * Delegates event to a selector. + * + * @param {Element|String|Array} [elements] + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @param {Boolean} useCapture + * @return {Object} + */function delegate(t,e,n,r,o){if("function"===typeof t.addEventListener)return _delegate.apply(null,arguments);if("function"===typeof n)return _delegate.bind(null,document).apply(null,arguments);"string"===typeof t&&(t=document.querySelectorAll(t));return Array.prototype.map.call(t,(function(t){return _delegate(t,e,n,r,o)}))} +/** + * Finds closest match and invokes callback. + * + * @param {Element} element + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @return {Function} + */function listener(t,e,n,r){return function(n){n.delegateTarget=o(n.target,e);n.delegateTarget&&r.call(t,n)}}e.exports=delegate},879:function(t,e){ +/** + * Check if argument is a HTML element. + * + * @param {Object} value + * @return {Boolean} + */ +e.node=function(t){return void 0!==t&&t instanceof HTMLElement&&1===t.nodeType}; +/** + * Check if argument is a list of HTML elements. + * + * @param {Object} value + * @return {Boolean} + */e.nodeList=function(t){var n=Object.prototype.toString.call(t);return void 0!==t&&("[object NodeList]"===n||"[object HTMLCollection]"===n)&&"length"in t&&(0===t.length||e.node(t[0]))}; +/** + * Check if argument is a string. + * + * @param {Object} value + * @return {Boolean} + */e.string=function(t){return"string"===typeof t||t instanceof String}; +/** + * Check if argument is a function. + * + * @param {Object} value + * @return {Boolean} + */e.fn=function(t){var e=Object.prototype.toString.call(t);return"[object Function]"===e}},370:function(t,e,n){var r=n(879);var o=n(438); +/** + * Validates all params and calls the right + * listener function based on its target type. + * + * @param {String|HTMLElement|HTMLCollection|NodeList} target + * @param {String} type + * @param {Function} callback + * @return {Object} + */function listen(t,e,n){if(!t&&!e&&!n)throw new Error("Missing required arguments");if(!r.string(e))throw new TypeError("Second argument must be a String");if(!r.fn(n))throw new TypeError("Third argument must be a Function");if(r.node(t))return listenNode(t,e,n);if(r.nodeList(t))return listenNodeList(t,e,n);if(r.string(t))return listenSelector(t,e,n);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")} +/** + * Adds an event listener to a HTML element + * and returns a remove listener function. + * + * @param {HTMLElement} node + * @param {String} type + * @param {Function} callback + * @return {Object} + */function listenNode(t,e,n){t.addEventListener(e,n);return{destroy:function(){t.removeEventListener(e,n)}}} +/** + * Add an event listener to a list of HTML elements + * and returns a remove listener function. + * + * @param {NodeList|HTMLCollection} nodeList + * @param {String} type + * @param {Function} callback + * @return {Object} + */function listenNodeList(t,e,n){Array.prototype.forEach.call(t,(function(t){t.addEventListener(e,n)}));return{destroy:function(){Array.prototype.forEach.call(t,(function(t){t.removeEventListener(e,n)}))}}} +/** + * Add an event listener to a selector + * and returns a remove listener function. + * + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @return {Object} + */function listenSelector(t,e,n){return o(document.body,t,e,n)}t.exports=listen},817:function(t){function select(t){var e;if("SELECT"===t.nodeName){t.focus();e=t.value}else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var n=t.hasAttribute("readonly");n||t.setAttribute("readonly","");t.select();t.setSelectionRange(0,t.value.length);n||t.removeAttribute("readonly");e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var r=window.getSelection();var o=document.createRange();o.selectNodeContents(t);r.removeAllRanges();r.addRange(o);e=r.toString()}return e}t.exports=select},279:function(e){function E(){}E.prototype={on:function(e,n,r){var o=(this||t).e||((this||t).e={});(o[e]||(o[e]=[])).push({fn:n,ctx:r});return this||t},once:function(e,n,r){var o=this||t;function listener(){o.off(e,listener);n.apply(r,arguments)}listener._=n;return this.on(e,listener,r)},emit:function(e){var n=[].slice.call(arguments,1);var r=(((this||t).e||((this||t).e={}))[e]||[]).slice();var o=0;var i=r.length;for(o;o=0&&r0&&t-1 in e)}function nodeName(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var w=r.pop;var T=r.sort;var C=r.splice;var S="[\\x20\\t\\r\\n\\f]";var k=new RegExp("^"+S+"+|((?:^|[^\\\\])(?:\\\\.)*)"+S+"+$","g");jQuery.contains=function(e,t){var n=t&&t.parentNode;return e===n||!!(n&&1===n.nodeType&&(e.contains?e.contains(n):e.compareDocumentPosition&&16&e.compareDocumentPosition(n)))};var A=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;function fcssescape(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e}jQuery.escapeSelector=function(e){return(e+"").replace(A,fcssescape)};var E=v,D=s;(function(){var n,i,a,s,l,c,d,p,g,m,v=D,y=jQuery.expando,x=0,b=0,A=createCache(),N=createCache(),j=createCache(),P=createCache(),sortOrder=function(e,t){e===t&&(l=true);return 0},H="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="(?:\\\\[\\da-fA-F]{1,6}"+S+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",L="\\["+S+"*("+M+")(?:"+S+"*([*^$|!~]?=)"+S+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+S+"*\\]",q=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+L+")*)|.*)\\)|)",O=new RegExp(S+"+","g"),F=new RegExp("^"+S+"*,"+S+"*"),R=new RegExp("^"+S+"*([>+~]|"+S+")"+S+"*"),I=new RegExp(S+"|>"),W=new RegExp(q),$=new RegExp("^"+M+"$"),B={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+L),PSEUDO:new RegExp("^"+q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+S+"*(even|odd|(([+-]|)(\\d*)n|)"+S+"*(?:([+-]|)"+S+"*(\\d+)|))"+S+"*\\)|)","i"),bool:new RegExp("^(?:"+H+")$","i"),needsContext:new RegExp("^"+S+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+S+"*((?:-\\d)?\\d*)"+S+"*\\)|)(?=[^-]|$)","i")},_=/^(?:input|select|textarea|button)$/i,z=/^h\d$/i,X=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,U=/[+~]/,G=new RegExp("\\\\[\\da-fA-F]{1,6}"+S+"?|\\\\([^\\r\\n\\f])","g"),funescape=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},unloadHandler=function(){setDocument()},V=addCombinator((function(e){return true===e.disabled&&nodeName(e,"fieldset")}),{dir:"parentNode",next:"legend"});function safeActiveElement(){try{return c.activeElement}catch(e){}}try{v.apply(r=o.call(E.childNodes),E.childNodes);r[E.childNodes.length].nodeType}catch(e){v={apply:function(e,t){D.apply(e,o.call(t))},call:function(e){D.apply(e,o.call(arguments,1))}}}function find(e,t,n,r){var i,o,a,s,u,l,f,d=t&&t.ownerDocument,m=t?t.nodeType:9;n=n||[];if("string"!==typeof e||!e||1!==m&&9!==m&&11!==m)return n;if(!r){setDocument(t);t=t||c;if(p){if(11!==m&&(u=X.exec(e)))if(i=u[1]){if(9===m){if(!(a=t.getElementById(i)))return n;if(a.id===i){v.call(n,a);return n}}else if(d&&(a=d.getElementById(i))&&find.contains(t,a)&&a.id===i){v.call(n,a);return n}}else{if(u[2]){v.apply(n,t.getElementsByTagName(e));return n}if((i=u[3])&&t.getElementsByClassName){v.apply(n,t.getElementsByClassName(i));return n}}if(!P[e+" "]&&(!g||!g.test(e))){f=e;d=t;if(1===m&&(I.test(e)||R.test(e))){d=U.test(e)&&testContext(t.parentNode)||t;d==t&&h.scope||((s=t.getAttribute("id"))?s=jQuery.escapeSelector(s):t.setAttribute("id",s=y));l=tokenize(e);o=l.length;while(o--)l[o]=(s?"#"+s:":scope")+" "+toSelector(l[o]);f=l.join(",")}try{v.apply(n,d.querySelectorAll(f));return n}catch(t){P(e,true)}finally{s===y&&t.removeAttribute("id")}}}}return select(e.replace(k,"$1"),t,n,r)} +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */function createCache(){var e=[];function cache(t,n){e.push(t+" ")>i.cacheLength&&delete cache[e.shift()];return cache[t+" "]=n}return cache} +/** + * Mark a function for special use by jQuery selector module + * @param {Function} fn The function to mark + */function markFunction(e){e[y]=true;return e} +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */function assert(e){var t=c.createElement("fieldset");try{return!!e(t)}catch(e){return false}finally{t.parentNode&&t.parentNode.removeChild(t);t=null}} +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */function createInputPseudo(e){return function(t){return nodeName(t,"input")&&t.type===e}} +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */function createButtonPseudo(e){return function(t){return(nodeName(t,"input")||nodeName(t,"button"))&&t.type===e}} +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */function createDisabledPseudo(e){return function(t){return"form"in t?t.parentNode&&false===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&V(t)===e:t.disabled===e:"label"in t&&t.disabled===e}} +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */function createPositionalPseudo(e){return markFunction((function(t){t=+t;return markFunction((function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))}))}))} +/** + * Checks a node for validity as a jQuery selector context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */function testContext(e){return e&&"undefined"!==typeof e.getElementsByTagName&&e} +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [node] An element or document object to use to set the document + * @returns {Object} Returns the current document + */function setDocument(e){var t,n=e?e.ownerDocument||e:E;if(n==c||9!==n.nodeType||!n.documentElement)return c;c=n;d=c.documentElement;p=!jQuery.isXMLDoc(c);m=d.matches||d.webkitMatchesSelector||d.msMatchesSelector;d.msMatchesSelector&&E!=c&&(t=c.defaultView)&&t.top!==t&&t.addEventListener("unload",unloadHandler);h.getById=assert((function(e){d.appendChild(e).id=jQuery.expando;return!c.getElementsByName||!c.getElementsByName(jQuery.expando).length}));h.disconnectedMatch=assert((function(e){return m.call(e,"*")}));h.scope=assert((function(){return c.querySelectorAll(":scope")}));h.cssHas=assert((function(){try{c.querySelector(":has(*,:jqfake)");return false}catch(e){return true}}));if(h.getById){i.filter.ID=function(e){var t=e.replace(G,funescape);return function(e){return e.getAttribute("id")===t}};i.find.ID=function(e,t){if("undefined"!==typeof t.getElementById&&p){var n=t.getElementById(e);return n?[n]:[]}}}else{i.filter.ID=function(e){var t=e.replace(G,funescape);return function(e){var n="undefined"!==typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}};i.find.ID=function(e,t){if("undefined"!==typeof t.getElementById&&p){var n,r,i,o=t.getElementById(e);if(o){n=o.getAttributeNode("id");if(n&&n.value===e)return[o];i=t.getElementsByName(e);r=0;while(o=i[r++]){n=o.getAttributeNode("id");if(n&&n.value===e)return[o]}}return[]}}}i.find.TAG=function(e,t){return"undefined"!==typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)};i.find.CLASS=function(e,t){if("undefined"!==typeof t.getElementsByClassName&&p)return t.getElementsByClassName(e)};g=[];assert((function(e){var t;d.appendChild(e).innerHTML="";e.querySelectorAll("[selected]").length||g.push("\\["+S+"*(?:value|"+H+")");e.querySelectorAll("[id~="+y+"-]").length||g.push("~=");e.querySelectorAll("a#"+y+"+*").length||g.push(".#.+[+~]");e.querySelectorAll(":checked").length||g.push(":checked");t=c.createElement("input");t.setAttribute("type","hidden");e.appendChild(t).setAttribute("name","D");d.appendChild(e).disabled=true;2!==e.querySelectorAll(":disabled").length&&g.push(":enabled",":disabled");t=c.createElement("input");t.setAttribute("name","");e.appendChild(t);e.querySelectorAll("[name='']").length||g.push("\\["+S+"*name"+S+"*="+S+"*(?:''|\"\")")}));h.cssHas||g.push(":has");g=g.length&&new RegExp(g.join("|"));sortOrder=function(e,t){if(e===t){l=true;return 0}var n=!e.compareDocumentPosition-!t.compareDocumentPosition;if(n)return n;n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1;return 1&n||!h.sortDetached&&t.compareDocumentPosition(e)===n?e===c||e.ownerDocument==E&&find.contains(E,e)?-1:t===c||t.ownerDocument==E&&find.contains(E,t)?1:s?u.call(s,e)-u.call(s,t):0:4&n?-1:1};return c}find.matches=function(e,t){return find(e,null,null,t)};find.matchesSelector=function(e,t){setDocument(e);if(p&&!P[t+" "]&&(!g||!g.test(t)))try{var n=m.call(e,t);if(n||h.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){P(t,true)}return find(t,c,null,[e]).length>0};find.contains=function(e,t){(e.ownerDocument||e)!=c&&setDocument(e);return jQuery.contains(e,t)};find.attr=function(e,t){(e.ownerDocument||e)!=c&&setDocument(e);var n=i.attrHandle[t.toLowerCase()],r=n&&f.call(i.attrHandle,t.toLowerCase())?n(e,t,!p):void 0;return void 0!==r?r:e.getAttribute(t)};find.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)}; +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */jQuery.uniqueSort=function(e){var t,n=[],r=0,i=0;l=!h.sortStable;s=!h.sortStable&&o.call(e,0);T.call(e,sortOrder);if(l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)C.call(e,n[r],1)}s=null;return e};jQuery.fn.uniqueSort=function(){return this.pushStack(jQuery.uniqueSort(o.apply(this||e)))};i=jQuery.expr={cacheLength:50,createPseudo:markFunction,match:B,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){e[1]=e[1].replace(G,funescape);e[3]=(e[3]||e[4]||e[5]||"").replace(G,funescape);"~="===e[2]&&(e[3]=" "+e[3]+" ");return e.slice(0,4)},CHILD:function(e){e[1]=e[1].toLowerCase();if("nth"===e[1].slice(0,3)){e[3]||find.error(e[0]);e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3]));e[5]=+(e[7]+e[8]||"odd"===e[3])}else e[3]&&find.error(e[0]);return e},PSEUDO:function(e){var t,n=!e[6]&&e[2];if(B.CHILD.test(e[0]))return null;if(e[3])e[2]=e[4]||e[5]||"";else if(n&&W.test(n)&&(t=tokenize(n,true))&&(t=n.indexOf(")",n.length-t)-n.length)){e[0]=e[0].slice(0,t);e[2]=n.slice(0,t)}return e.slice(0,3)}},filter:{TAG:function(e){var t=e.replace(G,funescape).toLowerCase();return"*"===e?function(){return true}:function(e){return nodeName(e,t)}},CLASS:function(e){var t=A[e+" "];return t||(t=new RegExp("(^|"+S+")"+e+"("+S+"|$)"))&&A(e,(function(e){return t.test("string"===typeof e.className&&e.className||"undefined"!==typeof e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=find.attr(r,e);if(null==i)return"!="===t;if(!t)return true;i+="";return"="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(O," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-")}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,d,p,h=o!==a?"nextSibling":"previousSibling",g=t.parentNode,m=s&&t.nodeName.toLowerCase(),v=!u&&!s,b=false;if(g){if(o){while(h){f=t;while(f=f[h])if(s?nodeName(f,m):1===f.nodeType)return false;p=h="only"===e&&!p&&"nextSibling"}return true}p=[a?g.firstChild:g.lastChild];if(a&&v){c=g[y]||(g[y]={});l=c[e]||[];d=l[0]===x&&l[1];b=d&&l[2];f=d&&g.childNodes[d];while(f=++d&&f&&f[h]||(b=d=0)||p.pop())if(1===f.nodeType&&++b&&f===t){c[e]=[x,d,b];break}}else{if(v){c=t[y]||(t[y]={});l=c[e]||[];d=l[0]===x&&l[1];b=d}if(false===b)while(f=++d&&f&&f[h]||(b=d=0)||p.pop())if((s?nodeName(f,m):1===f.nodeType)&&++b){if(v){c=f[y]||(f[y]={});c[e]=[x,b]}if(f===t)break}}b-=i;return b===r||b%r===0&&b/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||find.error("unsupported pseudo: "+e);if(r[y])return r(t);if(r.length>1){n=[e,e,"",t];return i.setFilters.hasOwnProperty(e.toLowerCase())?markFunction((function(e,n){var i,o=r(e,t),a=o.length;while(a--){i=u.call(e,o[a]);e[i]=!(n[i]=o[a])}})):function(e){return r(e,0,n)}}return r}},pseudos:{not:markFunction((function(e){var t=[],n=[],r=compile(e.replace(k,"$1"));return r[y]?markFunction((function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))})):function(e,i,o){t[0]=e;r(t,null,o,n);t[0]=null;return!n.pop()}})),has:markFunction((function(e){return function(t){return find(e,t).length>0}})),contains:markFunction((function(e){e=e.replace(G,funescape);return function(t){return(t.textContent||jQuery.text(t)).indexOf(e)>-1}})),lang:markFunction((function(e){$.test(e||"")||find.error("unsupported lang: "+e);e=e.replace(G,funescape).toLowerCase();return function(t){var n;do{if(n=p?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang")){n=n.toLowerCase();return n===e||0===n.indexOf(e+"-")}}while((t=t.parentNode)&&1===t.nodeType);return false}})),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(e){return e===d},focus:function(e){return e===safeActiveElement()&&c.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:createDisabledPseudo(false),disabled:createDisabledPseudo(true),checked:function(e){return nodeName(e,"input")&&!!e.checked||nodeName(e,"option")&&!!e.selected},selected:function(e){e.parentNode&&e.parentNode.selectedIndex;return true===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return false;return true},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return z.test(e.nodeName)},input:function(e){return _.test(e.nodeName)},button:function(e){return nodeName(e,"input")&&"button"===e.type||nodeName(e,"button")},text:function(e){var t;return nodeName(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:createPositionalPseudo((function(){return[0]})),last:createPositionalPseudo((function(e,t){return[t-1]})),eq:createPositionalPseudo((function(e,t,n){return[n<0?n+t:n]})),even:createPositionalPseudo((function(e,t){var n=0;for(;nt?t:n;for(;--r>=0;)e.push(r);return e})),gt:createPositionalPseudo((function(e,t,n){var r=n<0?n+t:n;for(;++r1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return false;return true}:e[0]}function multipleContexts(e,t,n){var r=0,i=t.length;for(;r-1&&(o[c]=!(a[c]=d))}}else{p=condense(p===a?p.splice(m,p.length):p);i?i(null,a,p,l):v.apply(a,p)}}))}function matcherFromTokens(e){var t,n,r,o=e.length,s=i.relative[e[0].type],l=s||i.relative[" "],c=s?1:0,f=addCombinator((function(e){return e===t}),l,true),d=addCombinator((function(e){return u.call(t,e)>-1}),l,true),p=[function(e,n,r){var i=!s&&(r||n!=a)||((t=n).nodeType?f(e,n,r):d(e,n,r));t=null;return i}];for(;c1&&elementMatcher(p),c>1&&toSelector(e.slice(0,c-1).concat({value:" "===e[c-2].type?"*":""})).replace(k,"$1"),n,c0,r=e.length>0,superMatcher=function(o,s,u,l,f){var d,h,g,m=0,y="0",b=o&&[],T=[],C=a,S=o||r&&i.find.TAG("*",f),k=x+=null==C?1:Math.random()||.1,A=S.length;f&&(a=s==c||s||f);for(;y!==A&&null!=(d=S[y]);y++){if(r&&d){h=0;if(!s&&d.ownerDocument!=c){setDocument(d);u=!p}while(g=e[h++])if(g(d,s||c,u)){v.call(l,d);break}f&&(x=k)}if(n){(d=!g&&d)&&m--;o&&b.push(d)}}m+=y;if(n&&y!==m){h=0;while(g=t[h++])g(b,T,s,u);if(o){if(m>0)while(y--)b[y]||T[y]||(T[y]=w.call(l));T=condense(T)}v.apply(l,T);f&&!o&&T.length>0&&m+t.length>1&&jQuery.uniqueSort(l)}if(f){x=k;a=C}return b};return n?markFunction(superMatcher):superMatcher}function compile(e,t){var n,r=[],i=[],o=j[e+" "];if(!o){t||(t=tokenize(e));n=t.length;while(n--){o=matcherFromTokens(t[n]);o[y]?r.push(o):i.push(o)}o=j(e,matcherFromGroupMatchers(i,r));o.selector=e}return o} +/** + * A low-level selection function that works with jQuery's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with jQuery selector compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */function select(e,t,n,r){var o,a,s,u,l,c="function"===typeof e&&e,f=!r&&tokenize(e=c.selector||e);n=n||[];if(1===f.length){a=f[0]=f[0].slice(0);if(a.length>2&&"ID"===(s=a[0]).type&&9===t.nodeType&&p&&i.relative[a[1].type]){t=(i.find.ID(s.matches[0].replace(G,funescape),t)||[])[0];if(!t)return n;c&&(t=t.parentNode);e=e.slice(a.shift().value.length)}o=B.needsContext.test(e)?0:a.length;while(o--){s=a[o];if(i.relative[u=s.type])break;if((l=i.find[u])&&(r=l(s.matches[0].replace(G,funescape),U.test(a[0].type)&&testContext(t.parentNode)||t))){a.splice(o,1);e=r.length&&toSelector(a);if(!e){v.apply(n,r);return n}break}}}(c||compile(e,f))(r,t,!p,n,!t||U.test(e)&&testContext(t.parentNode)||t);return n}h.sortStable=y.split("").sort(sortOrder).join("")===y;setDocument();h.sortDetached=assert((function(e){return 1&e.compareDocumentPosition(c.createElement("fieldset"))}));jQuery.find=find;jQuery.expr[":"]=jQuery.expr.pseudos;jQuery.unique=jQuery.uniqueSort;find.compile=compile;find.select=select;find.setDocument=setDocument;find.tokenize=tokenize;find.escape=jQuery.escapeSelector;find.getText=jQuery.text;find.isXML=jQuery.isXMLDoc;find.selectors=jQuery.expr;find.support=jQuery.support;find.uniqueSort=jQuery.uniqueSort})();var dir=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&jQuery(e).is(n))break;r.push(e)}return r};var siblings=function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n};var N=jQuery.expr.match.needsContext;var j=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function winnow(e,t,n){return g(t)?jQuery.grep(e,(function(e,r){return!!t.call(e,r,e)!==n})):t.nodeType?jQuery.grep(e,(function(e){return e===t!==n})):"string"!==typeof t?jQuery.grep(e,(function(e){return u.call(t,e)>-1!==n})):jQuery.filter(t,e,n)}jQuery.filter=function(e,t,n){var r=t[0];n&&(e=":not("+e+")");return 1===t.length&&1===r.nodeType?jQuery.find.matchesSelector(r,e)?[r]:[]:jQuery.find.matches(e,jQuery.grep(t,(function(e){return 1===e.nodeType})))};jQuery.fn.extend({find:function(t){var n,r,i=(this||e).length,o=this||e;if("string"!==typeof t)return this.pushStack(jQuery(t).filter((function(){for(n=0;n1?jQuery.uniqueSort(r):r},filter:function(t){return this.pushStack(winnow(this||e,t||[],false))},not:function(t){return this.pushStack(winnow(this||e,t||[],true))},is:function(t){return!!winnow(this||e,"string"===typeof t&&N.test(t)?jQuery(t):t||[],false).length}});var P,H=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,M=jQuery.fn.init=function(t,n,r){var i,o;if(!t)return this||e;r=r||P;if("string"===typeof t){i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:H.exec(t);if(!i||!i[1]&&n)return!n||n.jquery?(n||r).find(t):this.constructor(n).find(t);if(i[1]){n=n instanceof jQuery?n[0]:n;jQuery.merge(this||e,jQuery.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:v,true));if(j.test(i[1])&&jQuery.isPlainObject(n))for(i in n)g((this||e)[i])?this[i](n[i]):this.attr(i,n[i]);return this||e}o=v.getElementById(i[2]);if(o){(this||e)[0]=o;(this||e).length=1}return this||e}if(t.nodeType){(this||e)[0]=t;(this||e).length=1;return this||e}return g(t)?void 0!==r.ready?r.ready(t):t(jQuery):jQuery.makeArray(t,this||e)};M.prototype=jQuery.fn;P=jQuery(v);var L=/^(?:parents|prev(?:Until|All))/,q={children:true,contents:true,next:true,prev:true};jQuery.fn.extend({has:function(t){var n=jQuery(t,this||e),r=n.length;return this.filter((function(){var t=0;for(;t-1:1===r.nodeType&&jQuery.find.matchesSelector(r,t))){a.push(r);break}return this.pushStack(a.length>1?jQuery.uniqueSort(a):a)},index:function(t){return t?"string"===typeof t?u.call(jQuery(t),(this||e)[0]):u.call(this||e,t.jquery?t[0]:t):(this||e)[0]&&(this||e)[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(e,t))))},addBack:function(t){return this.add(null==t?(this||e).prevObject:(this||e).prevObject.filter(t))}});function sibling(e,t){while((e=e[t])&&1!==e.nodeType);return e}jQuery.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return dir(e,"parentNode")},parentsUntil:function(e,t,n){return dir(e,"parentNode",n)},next:function(e){return sibling(e,"nextSibling")},prev:function(e){return sibling(e,"previousSibling")},nextAll:function(e){return dir(e,"nextSibling")},prevAll:function(e){return dir(e,"previousSibling")},nextUntil:function(e,t,n){return dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return dir(e,"previousSibling",n)},siblings:function(e){return siblings((e.parentNode||{}).firstChild,e)},children:function(e){return siblings(e.firstChild)},contents:function(e){if(null!=e.contentDocument&&i(e.contentDocument))return e.contentDocument;nodeName(e,"template")&&(e=e.content||e);return jQuery.merge([],e.childNodes)}},(function(t,n){jQuery.fn[t]=function(r,i){var o=jQuery.map(this||e,n,r);"Until"!==t.slice(-5)&&(i=r);i&&"string"===typeof i&&(o=jQuery.filter(i,o));if((this||e).length>1){q[t]||jQuery.uniqueSort(o);L.test(t)&&o.reverse()}return this.pushStack(o)}}));var O=/[^\x20\t\r\n\f]+/g;function createOptions(e){var t={};jQuery.each(e.match(O)||[],(function(e,n){t[n]=true}));return t}jQuery.Callbacks=function(t){t="string"===typeof t?createOptions(t):jQuery.extend({},t);var n,r,i,o,a=[],s=[],u=-1,fire=function(){o=o||t.once;i=n=true;for(;s.length;u=-1){r=s.shift();while(++u-1){a.splice(n,1);n<=u&&u--}}));return this||e},has:function(e){return e?jQuery.inArray(e,a)>-1:a.length>0},empty:function(){a&&(a=[]);return this||e},disable:function(){o=s=[];a=r="";return this||e},disabled:function(){return!a},lock:function(){o=s=[];r||n||(a=r="");return this||e},locked:function(){return!!o},fireWith:function(t,r){if(!o){r=r||[];r=[t,r.slice?r.slice():r];s.push(r);n||fire()}return this||e},fire:function(){l.fireWith(this||e,arguments);return this||e},fired:function(){return!!i}};return l};function Identity(e){return e}function Thrower(e){throw e}function adoptValue(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}jQuery.extend({Deferred:function(n){var r=[["notify","progress",jQuery.Callbacks("memory"),jQuery.Callbacks("memory"),2],["resolve","done",jQuery.Callbacks("once memory"),jQuery.Callbacks("once memory"),0,"resolved"],["reject","fail",jQuery.Callbacks("once memory"),jQuery.Callbacks("once memory"),1,"rejected"]],i="pending",o={state:function(){return i},always:function(){a.done(arguments).fail(arguments);return this||e},catch:function(e){return o.then(null,e)},pipe:function(){var t=arguments;return jQuery.Deferred((function(n){jQuery.each(r,(function(r,i){var o=g(t[i[4]])&&t[i[4]];a[i[1]]((function(){var t=o&&o.apply(this||e,arguments);t&&g(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this||e,o?[t]:arguments)}))}));t=null})).promise()},then:function(n,i,o){var a=0;function resolve(n,r,i,o){return function(){var s=this||e,u=arguments,mightThrow=function(){var e,t;if(!(n=a){if(i!==Thrower){s=void 0;u=[e]}r.rejectWith(s,u)}}};if(n)l();else{jQuery.Deferred.getErrorHook?l.error=jQuery.Deferred.getErrorHook():jQuery.Deferred.getStackHook&&(l.error=jQuery.Deferred.getStackHook());t.setTimeout(l)}}}return jQuery.Deferred((function(e){r[0][3].add(resolve(0,e,g(o)?o:Identity,e.notifyWith));r[1][3].add(resolve(0,e,g(n)?n:Identity));r[2][3].add(resolve(0,e,g(i)?i:Thrower))})).promise()},promise:function(e){return null!=e?jQuery.extend(e,o):o}},a={};jQuery.each(r,(function(t,n){var s=n[2],u=n[5];o[n[1]]=s.add;u&&s.add((function(){i=u}),r[3-t][2].disable,r[3-t][3].disable,r[0][2].lock,r[0][3].lock);s.add(n[3].fire);a[n[0]]=function(){a[n[0]+"With"]((this||e)===a?void 0:this||e,arguments);return this||e};a[n[0]+"With"]=s.fireWith}));o.promise(a);n&&n.call(a,a);return a},when:function(t){var n=arguments.length,r=n,i=Array(r),a=o.call(arguments),s=jQuery.Deferred(),updateFunc=function(t){return function(r){i[t]=this||e;a[t]=arguments.length>1?o.call(arguments):r;--n||s.resolveWith(i,a)}};if(n<=1){adoptValue(t,s.done(updateFunc(r)).resolve,s.reject,!n);if("pending"===s.state()||g(a[r]&&a[r].then))return s.then()}while(r--)adoptValue(a[r],updateFunc(r),s.reject);return s.promise()}});var F=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;jQuery.Deferred.exceptionHook=function(e,n){t.console&&t.console.warn&&e&&F.test(e.name)&&t.console.warn("jQuery.Deferred exception: "+e.message,e.stack,n)};jQuery.readyException=function(e){t.setTimeout((function(){throw e}))};var R=jQuery.Deferred();jQuery.fn.ready=function(t){R.then(t).catch((function(e){jQuery.readyException(e)}));return this||e};jQuery.extend({isReady:false,readyWait:1,ready:function(e){if(!(true===e?--jQuery.readyWait:jQuery.isReady)){jQuery.isReady=true;true!==e&&--jQuery.readyWait>0||R.resolveWith(v,[jQuery])}}});jQuery.ready.then=R.then;function completed(){v.removeEventListener("DOMContentLoaded",completed);t.removeEventListener("load",completed);jQuery.ready()}if("complete"===v.readyState||"loading"!==v.readyState&&!v.documentElement.doScroll)t.setTimeout(jQuery.ready);else{v.addEventListener("DOMContentLoaded",completed);t.addEventListener("load",completed)}var access=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===toType(n)){i=true;for(s in n)access(e,t,s,n[s],true,o,a)}else if(void 0!==r){i=true;g(r)||(a=true);if(l)if(a){t.call(e,r);t=null}else{l=t;t=function(e,t,n){return l.call(jQuery(e),n)}}if(t)for(;s1,null,true)},removeData:function(t){return this.each((function(){B.remove(this||e,t)}))}});jQuery.extend({queue:function(e,t,n){var r;if(e){t=(t||"fx")+"queue";r=$.get(e,t);n&&(!r||Array.isArray(n)?r=$.access(e,t,jQuery.makeArray(n)):r.push(n));return r||[]}},dequeue:function(e,t){t=t||"fx";var n=jQuery.queue(e,t),r=n.length,i=n.shift(),o=jQuery._queueHooks(e,t),next=function(){jQuery.dequeue(e,t)};if("inprogress"===i){i=n.shift();r--}if(i){"fx"===t&&n.unshift("inprogress");delete o.stop;i.call(e,next,o)}!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return $.get(e,n)||$.access(e,n,{empty:jQuery.Callbacks("once memory").add((function(){$.remove(e,[t+"queue",n])}))})}});jQuery.fn.extend({queue:function(t,n){var r=2;if("string"!==typeof t){n=t;t="fx";r--}return arguments.length\x20\t\r\n\f]*)/i;var Z=/^$|^module$|\/(?:java|ecma)script/i;(function(){var e=v.createDocumentFragment(),t=e.appendChild(v.createElement("div")),n=v.createElement("input");n.setAttribute("type","radio");n.setAttribute("checked","checked");n.setAttribute("name","t");t.appendChild(n);h.checkClone=t.cloneNode(true).cloneNode(true).lastChild.checked;t.innerHTML="";h.noCloneChecked=!!t.cloneNode(true).lastChild.defaultValue;t.innerHTML="";h.option=!!t.lastChild})();var ee={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ee.tbody=ee.tfoot=ee.colgroup=ee.caption=ee.thead;ee.th=ee.td;h.option||(ee.optgroup=ee.option=[1,""]);function getAll(e,t){var n;n="undefined"!==typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!==typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&nodeName(e,t)?jQuery.merge([e],n):n}function setGlobalEval(e,t){var n=0,r=e.length;for(;n-1)i&&i.push(o);else{l=isAttached(o);a=getAll(f.appendChild(o),"script");l&&setGlobalEval(a);if(n){c=0;while(o=a[c++])Z.test(o.type||"")&&n.push(o)}}return f}var ne=/^([^.]*)(?:\.(.+)|)/;function returnTrue(){return true}function returnFalse(){return false}function on(t,n,r,i,o,a){var s,u;if("object"===typeof n){if("string"!==typeof r){i=i||r;r=void 0}for(u in n)on(t,u,r,i,n[u],a);return t}if(null==i&&null==o){o=r;i=r=void 0}else if(null==o)if("string"===typeof r){o=i;i=void 0}else{o=i;i=r;r=void 0}if(false===o)o=returnFalse;else if(!o)return t;if(1===a){s=o;o=function(t){jQuery().off(t);return s.apply(this||e,arguments)};o.guid=s.guid||(s.guid=jQuery.guid++)}return t.each((function(){jQuery.event.add(this||e,n,o,i,r)}))}jQuery.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,d,p,h,g,m=$.get(e);if(acceptData(e)){if(n.handler){o=n;n=o.handler;i=o.selector}i&&jQuery.find.matchesSelector(V,i);n.guid||(n.guid=jQuery.guid++);(u=m.events)||(u=m.events=Object.create(null));(a=m.handle)||(a=m.handle=function(t){return"undefined"!==typeof jQuery&&jQuery.event.triggered!==t.type?jQuery.event.dispatch.apply(e,arguments):void 0});t=(t||"").match(O)||[""];l=t.length;while(l--){s=ne.exec(t[l])||[];p=g=s[1];h=(s[2]||"").split(".").sort();if(p){f=jQuery.event.special[p]||{};p=(i?f.delegateType:f.bindType)||p;f=jQuery.event.special[p]||{};c=jQuery.extend({type:p,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&jQuery.expr.match.needsContext.test(i),namespace:h.join(".")},o);if(!(d=u[p])){d=u[p]=[];d.delegateCount=0;f.setup&&false!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(p,a)}if(f.add){f.add.call(e,c);c.handler.guid||(c.handler.guid=n.guid)}i?d.splice(d.delegateCount++,0,c):d.push(c);jQuery.event.global[p]=true}}}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,d,p,h,g,m=$.hasData(e)&&$.get(e);if(m&&(u=m.events)){t=(t||"").match(O)||[""];l=t.length;while(l--){s=ne.exec(t[l])||[];p=g=s[1];h=(s[2]||"").split(".").sort();if(p){f=jQuery.event.special[p]||{};p=(r?f.delegateType:f.bindType)||p;d=u[p]||[];s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)");a=o=d.length;while(o--){c=d[o];if((i||g===c.origType)&&(!n||n.guid===c.guid)&&(!s||s.test(c.namespace))&&(!r||r===c.selector||"**"===r&&c.selector)){d.splice(o,1);c.selector&&d.delegateCount--;f.remove&&f.remove.call(e,c)}}if(a&&!d.length){f.teardown&&false!==f.teardown.call(e,h,m.handle)||jQuery.removeEvent(e,p,m.handle);delete u[p]}}else for(p in u)jQuery.event.remove(e,p+t[l],n,r,true)}jQuery.isEmptyObject(u)&&$.remove(e,"handle events")}},dispatch:function(t){var n,r,i,o,a,s,u=new Array(arguments.length),l=jQuery.event.fix(t),c=($.get(this||e,"events")||Object.create(null))[l.type]||[],f=jQuery.event.special[l.type]||{};u[0]=l;for(n=1;n=1))for(;c!==(this||e);c=c.parentNode||this||e)if(1===c.nodeType&&!("click"===t.type&&true===c.disabled)){a=[];s={};for(r=0;r-1:jQuery.find(o,this||e,null,[c]).length);s[o]&&a.push(i)}a.length&&u.push({elem:c,handlers:a})}c=this||e;l\s*$/g;function manipulationTarget(e,t){return nodeName(e,"table")&&nodeName(11!==t.nodeType?t:t.firstChild,"tr")&&jQuery(e).children("tbody")[0]||e}function disableScript(e){e.type=(null!==e.getAttribute("type"))+"/"+e.type;return e}function restoreScript(e){"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type");return e}function cloneCopyEvent(e,t){var n,r,i,o,a,s,u;if(1===t.nodeType){if($.hasData(e)){o=$.get(e);u=o.events;if(u){$.remove(t,"handle events");for(i in u)for(n=0,r=u[i].length;n1&&"string"===typeof v&&!h.checkClone&&ie.test(v))return t.each((function(o){var a=t.eq(o);y&&(n[0]=v.call(this||e,o,a.html()));domManip(a,n,r,i)}));if(p){o=buildFragment(n,t[0].ownerDocument,false,t,i);s=o.firstChild;1===o.childNodes.length&&(o=s);if(s||i){u=jQuery.map(getAll(o,"script"),disableScript);l=u.length;for(;d0&&setGlobalEval(a,!u&&getAll(e,"script"));return s},cleanData:function(e){var t,n,r,i=jQuery.event.special,o=0;for(;void 0!==(n=e[o]);o++)if(acceptData(n)){if(t=n[$.expando]){if(t.events)for(r in t.events)i[r]?jQuery.event.remove(n,r):jQuery.removeEvent(n,r,t.handle);n[$.expando]=void 0}n[B.expando]&&(n[B.expando]=void 0)}}});jQuery.fn.extend({detach:function(t){return remove(this||e,t,true)},remove:function(t){return remove(this||e,t)},text:function(t){return access(this||e,(function(t){return void 0===t?jQuery.text(this||e):this.empty().each((function(){1!==(this||e).nodeType&&11!==(this||e).nodeType&&9!==(this||e).nodeType||((this||e).textContent=t)}))}),null,t,arguments.length)},append:function(){return domManip(this||e,arguments,(function(t){if(1===(this||e).nodeType||11===(this||e).nodeType||9===(this||e).nodeType){var n=manipulationTarget(this||e,t);n.appendChild(t)}}))},prepend:function(){return domManip(this||e,arguments,(function(t){if(1===(this||e).nodeType||11===(this||e).nodeType||9===(this||e).nodeType){var n=manipulationTarget(this||e,t);n.insertBefore(t,n.firstChild)}}))},before:function(){return domManip(this||e,arguments,(function(t){(this||e).parentNode&&(this||e).parentNode.insertBefore(t,this||e)}))},after:function(){return domManip(this||e,arguments,(function(t){(this||e).parentNode&&(this||e).parentNode.insertBefore(t,(this||e).nextSibling)}))},empty:function(){var t,n=0;for(;null!=(t=(this||e)[n]);n++)if(1===t.nodeType){jQuery.cleanData(getAll(t,false));t.textContent=""}return this||e},clone:function(t,n){t=null!=t&&t;n=null==n?t:n;return this.map((function(){return jQuery.clone(this||e,t,n)}))},html:function(t){return access(this||e,(function(t){var n=(this||e)[0]||{},r=0,i=(this||e).length;if(void 0===t&&1===n.nodeType)return n.innerHTML;if("string"===typeof t&&!re.test(t)&&!ee[(K.exec(t)||["",""])[1].toLowerCase()]){t=jQuery.htmlPrefilter(t);try{for(;r=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0);return u+l}function getWidthOrHeight(e,t,n){var r=getStyles(e),i=!h.boxSizingReliable()||n,o=i&&"border-box"===jQuery.css(e,"boxSizing",false,r),a=o,s=curCSS(e,t,r),u="offset"+t[0].toUpperCase()+t.slice(1);if(ae.test(s)){if(!n)return s;s="auto"}if((!h.boxSizingReliable()&&o||!h.reliableTrDimensions()&&nodeName(e,"tr")||"auto"===s||!parseFloat(s)&&"inline"===jQuery.css(e,"display",false,r))&&e.getClientRects().length){o="border-box"===jQuery.css(e,"boxSizing",false,r);a=u in e;a&&(s=e[u])}s=parseFloat(s)||0;return s+boxModelAdjustment(e,t,n||(o?"border":"content"),a,r,s)+"px"}jQuery.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=curCSS(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:true,aspectRatio:true,borderImageSlice:true,columnCount:true,flexGrow:true,flexShrink:true,fontWeight:true,gridArea:true,gridColumn:true,gridColumnEnd:true,gridColumnStart:true,gridRow:true,gridRowEnd:true,gridRowStart:true,lineHeight:true,opacity:true,order:true,orphans:true,scale:true,widows:true,zIndex:true,zoom:true,fillOpacity:true,floodOpacity:true,stopOpacity:true,strokeMiterlimit:true,strokeOpacity:true},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=camelCase(t),u=se.test(t),l=e.style;u||(t=finalPropName(s));a=jQuery.cssHooks[t]||jQuery.cssHooks[s];if(void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,false,r))?i:l[t];o=typeof n;if("string"===o&&(i=U.exec(n))&&i[1]){n=adjustCSS(e,t,i);o="number"}if(null!=n&&n===n){"number"!==o||u||(n+=i&&i[3]||(jQuery.cssNumber[s]?"":"px"));h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit");a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n)}}},css:function(e,t,n,r){var i,o,a,s=camelCase(t),u=se.test(t);u||(t=finalPropName(s));a=jQuery.cssHooks[t]||jQuery.cssHooks[s];a&&"get"in a&&(i=a.get(e,true,n));void 0===i&&(i=curCSS(e,t,r));"normal"===i&&t in he&&(i=he[t]);if(""===n||n){o=parseFloat(i);return true===n||isFinite(o)?o||0:i}return i}});jQuery.each(["height","width"],(function(e,t){jQuery.cssHooks[t]={get:function(e,n,r){if(n)return!de.test(jQuery.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?getWidthOrHeight(e,t,r):swap(e,pe,(function(){return getWidthOrHeight(e,t,r)}))},set:function(e,n,r){var i,o=getStyles(e),a=!h.scrollboxSize()&&"absolute"===o.position,s=a||r,u=s&&"border-box"===jQuery.css(e,"boxSizing",false,o),l=r?boxModelAdjustment(e,t,r,u,o):0;u&&a&&(l-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-boxModelAdjustment(e,t,"border",false,o)-.5));if(l&&(i=U.exec(n))&&"px"!==(i[3]||"px")){e.style[t]=n;n=jQuery.css(e,t)}return setPositiveNumber(e,n,l)}}}));jQuery.cssHooks.marginLeft=addGetHookIf(h.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(curCSS(e,"marginLeft"))||e.getBoundingClientRect().left-swap(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"}));jQuery.each({margin:"",padding:"",border:"Width"},(function(e,t){jQuery.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"===typeof n?n.split(" "):[n];for(;r<4;r++)i[e+G[r]+t]=o[r]||o[r-2]||o[0];return i}};"margin"!==e&&(jQuery.cssHooks[e+t].set=setPositiveNumber)}));jQuery.fn.extend({css:function(t,n){return access(this||e,(function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){r=getStyles(e);i=t.length;for(;a1)}});function Tween(e,t,n,r,i){return new Tween.prototype.init(e,t,n,r,i)}jQuery.Tween=Tween;Tween.prototype={constructor:Tween,init:function(t,n,r,i,o,a){(this||e).elem=t;(this||e).prop=r;(this||e).easing=o||jQuery.easing._default;(this||e).options=n;(this||e).start=(this||e).now=this.cur();(this||e).end=i;(this||e).unit=a||(jQuery.cssNumber[r]?"":"px")},cur:function(){var t=Tween.propHooks[(this||e).prop];return t&&t.get?t.get(this||e):Tween.propHooks._default.get(this||e)},run:function(t){var n,r=Tween.propHooks[(this||e).prop];(this||e).options.duration?(this||e).pos=n=jQuery.easing[(this||e).easing](t,(this||e).options.duration*t,0,1,(this||e).options.duration):(this||e).pos=n=t;(this||e).now=((this||e).end-(this||e).start)*n+(this||e).start;(this||e).options.step&&(this||e).options.step.call((this||e).elem,(this||e).now,this||e);r&&r.set?r.set(this||e):Tween.propHooks._default.set(this||e);return this||e}};Tween.prototype.init.prototype=Tween.prototype;Tween.propHooks={_default:{get:function(e){var t;if(1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop])return e.elem[e.prop];t=jQuery.css(e.elem,e.prop,"");return t&&"auto"!==t?t:0},set:function(e){jQuery.fx.step[e.prop]?jQuery.fx.step[e.prop](e):1!==e.elem.nodeType||!jQuery.cssHooks[e.prop]&&null==e.elem.style[finalPropName(e.prop)]?e.elem[e.prop]=e.now:jQuery.style(e.elem,e.prop,e.now+e.unit)}}};Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}};jQuery.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"};jQuery.fx=Tween.prototype.init;jQuery.fx.step={};var ge,me,ve=/^(?:toggle|show|hide)$/,ye=/queueHooks$/;function schedule(){if(me){false===v.hidden&&t.requestAnimationFrame?t.requestAnimationFrame(schedule):t.setTimeout(schedule,jQuery.fx.interval);jQuery.fx.tick()}}function createFxNow(){t.setTimeout((function(){ge=void 0}));return ge=Date.now()}function genFx(e,t){var n,r=0,i={height:e};t=t?1:0;for(;r<4;r+=2-t){n=G[r];i["margin"+n]=i["padding"+n]=e}t&&(i.opacity=i.width=e);return i}function createTween(e,t,n){var r,i=(Animation.tweeners[t]||[]).concat(Animation.tweeners["*"]),o=0,a=i.length;for(;o1)},removeAttr:function(t){return this.each((function(){jQuery.removeAttr(this||e,t)}))}});jQuery.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o){if("undefined"===typeof e.getAttribute)return jQuery.prop(e,t,n);1===o&&jQuery.isXMLDoc(e)||(i=jQuery.attrHooks[t.toLowerCase()]||(jQuery.expr.match.bool.test(t)?xe:void 0));if(void 0!==n){if(null===n){jQuery.removeAttr(e,t);return}if(i&&"set"in i&&void 0!==(r=i.set(e,n,t)))return r;e.setAttribute(t,n+"");return n}if(i&&"get"in i&&null!==(r=i.get(e,t)))return r;r=jQuery.find.attr(e,t);return null==r?void 0:r}},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&nodeName(e,"input")){var n=e.value;e.setAttribute("type",t);n&&(e.value=n);return t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(O);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}});xe={set:function(e,t,n){false===t?jQuery.removeAttr(e,n):e.setAttribute(n,n);return n}};jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=be[t]||jQuery.find.attr;be[t]=function(e,t,r){var i,o,a=t.toLowerCase();if(!r){o=be[a];be[a]=i;i=null!=n(e,t,r)?a:null;be[a]=o}return i}}));var we=/^(?:input|select|textarea|button)$/i,Te=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(t,n){return access(this||e,jQuery.prop,t,n,arguments.length>1)},removeProp:function(t){return this.each((function(){delete(this||e)[jQuery.propFix[t]||t]}))}});jQuery.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o){if(1!==o||!jQuery.isXMLDoc(e)){t=jQuery.propFix[t]||t;i=jQuery.propHooks[t]}return void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]}},propHooks:{tabIndex:{get:function(e){var t=jQuery.find.attr(e,"tabindex");return t?parseInt(t,10):we.test(e.nodeName)||Te.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}});h.optSelected||(jQuery.propHooks.selected={get:function(e){var t=e.parentNode;t&&t.parentNode&&t.parentNode.selectedIndex;return null},set:function(e){var t=e.parentNode;if(t){t.selectedIndex;t.parentNode&&t.parentNode.selectedIndex}}});jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){jQuery.propFix[this.toLowerCase()]=this||e}));function stripAndCollapse(e){var t=e.match(O)||[];return t.join(" ")}function getClass(e){return e.getAttribute&&e.getAttribute("class")||""}function classesToArray(e){return Array.isArray(e)?e:"string"===typeof e&&e.match(O)||[]}jQuery.fn.extend({addClass:function(t){var n,r,i,o,a,s;if(g(t))return this.each((function(n){jQuery(this||e).addClass(t.call(this||e,n,getClass(this||e)))}));n=classesToArray(t);return n.length?this.each((function(){i=getClass(this||e);r=1===(this||e).nodeType&&" "+stripAndCollapse(i)+" ";if(r){for(a=0;a-1)r=r.replace(" "+o+" "," ")}s=stripAndCollapse(r);i!==s&&this.setAttribute("class",s)}})):this||e},toggleClass:function(t,n){var r,i,o,a,s=typeof t,u="string"===s||Array.isArray(t);if(g(t))return this.each((function(r){jQuery(this||e).toggleClass(t.call(this||e,r,getClass(this||e),n),n)}));if("boolean"===typeof n&&u)return n?this.addClass(t):this.removeClass(t);r=classesToArray(t);return this.each((function(){if(u){a=jQuery(this||e);for(o=0;o-1)return true;return false}});var Ce=/\r/g;jQuery.fn.extend({val:function(t){var n,r,i,o=(this||e)[0];if(arguments.length){i=g(t);return this.each((function(r){var o;if(1===(this||e).nodeType){o=i?t.call(this||e,r,jQuery(this||e).val()):t;null==o?o="":"number"===typeof o?o+="":Array.isArray(o)&&(o=jQuery.map(o,(function(e){return null==e?"":e+""})));n=jQuery.valHooks[(this||e).type]||jQuery.valHooks[(this||e).nodeName.toLowerCase()];n&&"set"in n&&void 0!==n.set(this||e,o,"value")||((this||e).value=o)}}))}if(o){n=jQuery.valHooks[o.type]||jQuery.valHooks[o.nodeName.toLowerCase()];if(n&&"get"in n&&void 0!==(r=n.get(o,"value")))return r;r=o.value;return"string"===typeof r?r.replace(Ce,""):null==r?"":r}}});jQuery.extend({valHooks:{option:{get:function(e){var t=jQuery.find.attr(e,"value");return null!=t?t:stripAndCollapse(jQuery.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;r=o<0?u:a?o:0;for(;r-1)&&(n=true)}n||(e.selectedIndex=-1);return o}}}});jQuery.each(["radio","checkbox"],(function(){jQuery.valHooks[this||e]={set:function(e,t){if(Array.isArray(t))return e.checked=jQuery.inArray(jQuery(e).val(),t)>-1}};h.checkOn||(jQuery.valHooks[this||e].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var Se=t.location;var ke={guid:Date.now()};var Ae=/\?/;jQuery.parseXML=function(e){var n,r;if(!e||"string"!==typeof e)return null;try{n=(new t.DOMParser).parseFromString(e,"text/xml")}catch(e){}r=n&&n.getElementsByTagName("parsererror")[0];n&&!r||jQuery.error("Invalid XML: "+(r?jQuery.map(r.childNodes,(function(e){return e.textContent})).join("\n"):e));return n};var Ee=/^(?:focusinfocus|focusoutblur)$/,stopPropagationCallback=function(e){e.stopPropagation()};jQuery.extend(jQuery.event,{trigger:function(e,n,r,i){var o,a,s,u,l,c,d,p,h=[r||v],y=f.call(e,"type")?e.type:e,x=f.call(e,"namespace")?e.namespace.split("."):[];a=p=s=r=r||v;if(3!==r.nodeType&&8!==r.nodeType&&!Ee.test(y+jQuery.event.triggered)){if(y.indexOf(".")>-1){x=y.split(".");y=x.shift();x.sort()}l=y.indexOf(":")<0&&"on"+y;e=e[jQuery.expando]?e:new jQuery.Event(y,"object"===typeof e&&e);e.isTrigger=i?2:3;e.namespace=x.join(".");e.rnamespace=e.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;e.result=void 0;e.target||(e.target=r);n=null==n?[e]:jQuery.makeArray(n,[e]);d=jQuery.event.special[y]||{};if(i||!d.trigger||false!==d.trigger.apply(r,n)){if(!i&&!d.noBubble&&!m(r)){u=d.delegateType||y;Ee.test(u+y)||(a=a.parentNode);for(;a;a=a.parentNode){h.push(a);s=a}s===(r.ownerDocument||v)&&h.push(s.defaultView||s.parentWindow||t)}o=0;while((a=h[o++])&&!e.isPropagationStopped()){p=a;e.type=o>1?u:d.bindType||y;c=($.get(a,"events")||Object.create(null))[e.type]&&$.get(a,"handle");c&&c.apply(a,n);c=l&&a[l];if(c&&c.apply&&acceptData(a)){e.result=c.apply(a,n);false===e.result&&e.preventDefault()}}e.type=y;if(!i&&!e.isDefaultPrevented()&&(!d._default||false===d._default.apply(h.pop(),n))&&acceptData(r)&&l&&g(r[y])&&!m(r)){s=r[l];s&&(r[l]=null);jQuery.event.triggered=y;e.isPropagationStopped()&&p.addEventListener(y,stopPropagationCallback);r[y]();e.isPropagationStopped()&&p.removeEventListener(y,stopPropagationCallback);jQuery.event.triggered=void 0;s&&(r[l]=s)}return e.result}}},simulate:function(e,t,n){var r=jQuery.extend(new jQuery.Event,n,{type:e,isSimulated:true});jQuery.event.trigger(r,null,t)}});jQuery.fn.extend({trigger:function(t,n){return this.each((function(){jQuery.event.trigger(t,n,this||e)}))},triggerHandler:function(t,n){var r=(this||e)[0];if(r)return jQuery.event.trigger(t,n,r,true)}});var De=/\[\]$/,Ne=/\r?\n/g,je=/^(?:submit|button|image|reset|file)$/i,Pe=/^(?:input|select|textarea|keygen)/i;function buildParams(e,t,n,r){var i;if(Array.isArray(t))jQuery.each(t,(function(t,i){n||De.test(e)?r(e,i):buildParams(e+"["+("object"===typeof i&&null!=i?t:"")+"]",i,n,r)}));else if(n||"object"!==toType(t))r(e,t);else for(i in t)buildParams(e+"["+i+"]",t[i],n,r)}jQuery.param=function(t,n){var r,i=[],add=function(e,t){var n=g(t)?t():t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!jQuery.isPlainObject(t))jQuery.each(t,(function(){add((this||e).name,(this||e).value)}));else for(r in t)buildParams(r,t[r],n,add);return i.join("&")};jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=jQuery.prop(this||e,"elements");return t?jQuery.makeArray(t):this||e})).filter((function(){var t=(this||e).type;return(this||e).name&&!jQuery(this||e).is(":disabled")&&Pe.test((this||e).nodeName)&&!je.test(t)&&((this||e).checked||!J.test(t))})).map((function(t,n){var r=jQuery(this||e).val();return null==r?null:Array.isArray(r)?jQuery.map(r,(function(e){return{name:n.name,value:e.replace(Ne,"\r\n")}})):{name:n.name,value:r.replace(Ne,"\r\n")}})).get()}});var He=/%20/g,Me=/#.*$/,Le=/([?&])_=[^&]*/,qe=/^(.*?):[ \t]*([^\r\n]*)$/gm,Oe=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Fe=/^(?:GET|HEAD)$/,Re=/^\/\//,Ie={},We={},$e="*/".concat("*"),Be=v.createElement("a");Be.href=Se.href;function addToPrefiltersOrTransports(e){return function(t,n){if("string"!==typeof t){n=t;t="*"}var r,i=0,o=t.toLowerCase().match(O)||[];if(g(n))while(r=o[i++])if("+"===r[0]){r=r.slice(1)||"*";(e[r]=e[r]||[]).unshift(n)}else(e[r]=e[r]||[]).push(n)}}function inspectPrefiltersOrTransports(e,t,n,r){var i={},o=e===We;function inspect(a){var s;i[a]=true;jQuery.each(e[a]||[],(function(e,a){var u=a(t,n,r);if("string"===typeof u&&!o&&!i[u]){t.dataTypes.unshift(u);inspect(u);return false}if(o)return!(s=u)}));return s}return inspect(t.dataTypes[0])||!i["*"]&&inspect("*")}function ajaxExtend(e,t){var n,r,i=jQuery.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);r&&jQuery.extend(true,e,r);return e}function ajaxHandleResponses(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0]){u.shift();void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"))}if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o){o!==u[0]&&u.unshift(o);return n[o]}}function ajaxConvert(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o){e.responseFields[o]&&(n[e.responseFields[o]]=t);!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType));u=o;o=c.shift();if(o)if("*"===o)o=u;else if("*"!==u&&u!==o){a=l[u+" "+o]||l["* "+o];if(!a)for(i in l){s=i.split(" ");if(s[1]===o){a=l[u+" "+s[0]]||l["* "+s[0]];if(a){if(true===a)a=l[i];else if(true!==l[i]){o=s[0];c.unshift(s[1])}break}}}if(true!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}}return{state:"success",data:t}}jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Se.href,type:"GET",isLocal:Oe.test(Se.protocol),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$e,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":JSON.parse,"text xml":jQuery.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(e,t){return t?ajaxExtend(ajaxExtend(e,jQuery.ajaxSettings),t):ajaxExtend(jQuery.ajaxSettings,e)},ajaxPrefilter:addToPrefiltersOrTransports(Ie),ajaxTransport:addToPrefiltersOrTransports(We),ajax:function(n,r){if("object"===typeof n){r=n;n=void 0}r=r||{};var i,o,a,s,u,l,c,f,d,p,h=jQuery.ajaxSetup({},r),g=h.context||h,m=h.context&&(g.nodeType||g.jquery)?jQuery(g):jQuery.event,y=jQuery.Deferred(),x=jQuery.Callbacks("once memory"),b=h.statusCode||{},w={},T={},C="canceled",S={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=qe.exec(a))s[t[1].toLowerCase()+" "]=(s[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=s[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(t,n){if(null==c){t=T[t.toLowerCase()]=T[t.toLowerCase()]||t;w[t]=n}return this||e},overrideMimeType:function(t){null==c&&(h.mimeType=t);return this||e},statusCode:function(t){var n;if(t)if(c)S.always(t[S.status]);else for(n in t)b[n]=[b[n],t[n]];return this||e},abort:function(t){var n=t||C;i&&i.abort(n);done(0,n);return this||e}};y.promise(S);h.url=((n||h.url||Se.href)+"").replace(Re,Se.protocol+"//");h.type=r.method||r.type||h.method||h.type;h.dataTypes=(h.dataType||"*").toLowerCase().match(O)||[""];if(null==h.crossDomain){l=v.createElement("a");try{l.href=h.url;l.href=l.href;h.crossDomain=Be.protocol+"//"+Be.host!==l.protocol+"//"+l.host}catch(e){h.crossDomain=true}}h.data&&h.processData&&"string"!==typeof h.data&&(h.data=jQuery.param(h.data,h.traditional));inspectPrefiltersOrTransports(Ie,h,r,S);if(c)return S;f=jQuery.event&&h.global;f&&0===jQuery.active++&&jQuery.event.trigger("ajaxStart");h.type=h.type.toUpperCase();h.hasContent=!Fe.test(h.type);o=h.url.replace(Me,"");if(h.hasContent)h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(He,"+"));else{p=h.url.slice(o.length);if(h.data&&(h.processData||"string"===typeof h.data)){o+=(Ae.test(o)?"&":"?")+h.data;delete h.data}if(false===h.cache){o=o.replace(Le,"$1");p=(Ae.test(o)?"&":"?")+"_="+ke.guid+++p}h.url=o+p}if(h.ifModified){jQuery.lastModified[o]&&S.setRequestHeader("If-Modified-Since",jQuery.lastModified[o]);jQuery.etag[o]&&S.setRequestHeader("If-None-Match",jQuery.etag[o])}(h.data&&h.hasContent&&false!==h.contentType||r.contentType)&&S.setRequestHeader("Content-Type",h.contentType);S.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$e+"; q=0.01":""):h.accepts["*"]);for(d in h.headers)S.setRequestHeader(d,h.headers[d]);if(h.beforeSend&&(false===h.beforeSend.call(g,S,h)||c))return S.abort();C="abort";x.add(h.complete);S.done(h.success);S.fail(h.error);i=inspectPrefiltersOrTransports(We,h,r,S);if(i){S.readyState=1;f&&m.trigger("ajaxSend",[S,h]);if(c)return S;h.async&&h.timeout>0&&(u=t.setTimeout((function(){S.abort("timeout")}),h.timeout));try{c=false;i.send(w,done)}catch(e){if(c)throw e;done(-1,e)}}else done(-1,"No Transport");function done(e,n,r,s){var l,d,p,v,w,T=n;if(!c){c=true;u&&t.clearTimeout(u);i=void 0;a=s||"";S.readyState=e>0?4:0;l=e>=200&&e<300||304===e;r&&(v=ajaxHandleResponses(h,S,r));!l&&jQuery.inArray("script",h.dataTypes)>-1&&jQuery.inArray("json",h.dataTypes)<0&&(h.converters["text script"]=function(){});v=ajaxConvert(h,v,S,l);if(l){if(h.ifModified){w=S.getResponseHeader("Last-Modified");w&&(jQuery.lastModified[o]=w);w=S.getResponseHeader("etag");w&&(jQuery.etag[o]=w)}if(204===e||"HEAD"===h.type)T="nocontent";else if(304===e)T="notmodified";else{T=v.state;d=v.data;p=v.error;l=!p}}else{p=T;if(e||!T){T="error";e<0&&(e=0)}}S.status=e;S.statusText=(n||T)+"";l?y.resolveWith(g,[d,T,S]):y.rejectWith(g,[S,T,p]);S.statusCode(b);b=void 0;f&&m.trigger(l?"ajaxSuccess":"ajaxError",[S,h,l?d:p]);x.fireWith(g,[S,T]);if(f){m.trigger("ajaxComplete",[S,h]);--jQuery.active||jQuery.event.trigger("ajaxStop")}}}return S},getJSON:function(e,t,n){return jQuery.get(e,t,n,"json")},getScript:function(e,t){return jQuery.get(e,void 0,t,"script")}});jQuery.each(["get","post"],(function(e,t){jQuery[t]=function(e,n,r,i){if(g(n)){i=i||r;r=n;n=void 0}return jQuery.ajax(jQuery.extend({url:e,type:t,dataType:i,data:n,success:r},jQuery.isPlainObject(e)&&e))}}));jQuery.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}));jQuery._evalUrl=function(e,t,n){return jQuery.ajax({url:e,type:"GET",dataType:"script",cache:true,async:false,global:false,converters:{"text script":function(){}},dataFilter:function(e){jQuery.globalEval(e,t,n)}})};jQuery.fn.extend({wrapAll:function(t){var n;if((this||e)[0]){g(t)&&(t=t.call((this||e)[0]));n=jQuery(t,(this||e)[0].ownerDocument).eq(0).clone(true);(this||e)[0].parentNode&&n.insertBefore((this||e)[0]);n.map((function(){var t=this||e;while(t.firstElementChild)t=t.firstElementChild;return t})).append(this||e)}return this||e},wrapInner:function(t){return g(t)?this.each((function(n){jQuery(this||e).wrapInner(t.call(this||e,n))})):this.each((function(){var n=jQuery(this||e),r=n.contents();r.length?r.wrapAll(t):n.append(t)}))},wrap:function(t){var n=g(t);return this.each((function(r){jQuery(this||e).wrapAll(n?t.call(this||e,r):t)}))},unwrap:function(t){this.parent(t).not("body").each((function(){jQuery(this||e).replaceWith((this||e).childNodes)}));return this||e}});jQuery.expr.pseudos.hidden=function(e){return!jQuery.expr.pseudos.visible(e)};jQuery.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)};jQuery.ajaxSettings.xhr=function(){try{return new t.XMLHttpRequest}catch(e){}};var _e={0:200,1223:204},ze=jQuery.ajaxSettings.xhr();h.cors=!!ze&&"withCredentials"in ze;h.ajax=ze=!!ze;jQuery.ajaxTransport((function(e){var n,r;if(h.cors||ze&&!e.crossDomain)return{send:function(i,o){var a,s=e.xhr();s.open(e.type,e.url,e.async,e.username,e.password);if(e.xhrFields)for(a in e.xhrFields)s[a]=e.xhrFields[a];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType);e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){if(n){n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null;"abort"===e?s.abort():"error"===e?"number"!==typeof s.status?o(0,"error"):o(s.status,s.statusText):o(_e[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!==typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders())}}};s.onload=n();r=s.onerror=s.ontimeout=n("error");void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&t.setTimeout((function(){n&&r()}))};n=n("abort");try{s.send(e.hasContent&&e.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}));jQuery.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=false)}));jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){jQuery.globalEval(e);return e}}});jQuery.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=false);e.crossDomain&&(e.type="GET")}));jQuery.ajaxTransport("script",(function(e){if(e.crossDomain||e.scriptAttrs){var t,n;return{send:function(r,i){t=jQuery("