{"version":3,"file":"js/application-e68e035707afd205aedf.js","sources":["webpack:///webpack/bootstrap","webpack:///./app/javascript/packs/application.js","webpack:///./app/javascript/src/answers/conditions.js","webpack:///./app/javascript/src/answers/edit.js","webpack:///./app/javascript/src/answers/rdaMetadata.js","webpack:///./app/javascript/src/contributors/form.js","webpack:///./app/javascript/src/devise/invitations/edit.js","webpack:///./app/javascript/src/devise/passwords/edit.js","webpack:///./app/javascript/src/devise/registrations/edit.js","webpack:///./app/javascript/src/devise/registrations/new.js","webpack:///./app/javascript/src/guidances/newEdit.js","webpack:///./app/javascript/src/locale/en_GB/timeago.js","webpack:///./app/javascript/src/notes/index.js","webpack:///./app/javascript/src/orgAdmin/conditions/updateConditions.js","webpack:///./app/javascript/src/orgAdmin/phases/newEdit.js","webpack:///./app/javascript/src/orgAdmin/phases/preview.js","webpack:///./app/javascript/src/orgAdmin/phases/show.js","webpack:///./app/javascript/src/orgAdmin/questionOptions/index.js","webpack:///./app/javascript/src/orgAdmin/questions/sharedEventHandlers.js","webpack:///./app/javascript/src/orgAdmin/sections/index.js","webpack:///./app/javascript/src/orgAdmin/templates/edit.js","webpack:///./app/javascript/src/orgAdmin/templates/index.js","webpack:///./app/javascript/src/orgAdmin/templates/new.js","webpack:///./app/javascript/src/orgs/adminEdit.js","webpack:///./app/javascript/src/orgs/shibbolethDs.js","webpack:///./app/javascript/src/plans/download.js","webpack:///./app/javascript/src/plans/editDetails.js","webpack:///./app/javascript/src/plans/index.js.erb","webpack:///./app/javascript/src/plans/new.js","webpack:///./app/javascript/src/plans/share.js","webpack:///./app/javascript/src/publicTemplates/show.js","webpack:///./app/javascript/src/researchOutputs/form.js","webpack:///./app/javascript/src/roles/edit.js","webpack:///./app/javascript/src/shared/createAccountForm.js","webpack:///./app/javascript/src/shared/signInForm.js","webpack:///./app/javascript/src/superAdmin/apiClients/form.js","webpack:///./app/javascript/src/superAdmin/notifications/edit.js","webpack:///./app/javascript/src/superAdmin/themes/newEdit.js","webpack:///./app/javascript/src/superAdmin/users/edit.js","webpack:///./app/javascript/src/usage/index.js","webpack:///./app/javascript/src/users/adminGrantPermissions.js","webpack:///./app/javascript/src/users/notificationPreferences.js","webpack:///./app/javascript/src/utils/accordion.js","webpack:///./app/javascript/src/utils/autoComplete.js","webpack:///./app/javascript/src/utils/charts.js","webpack:///./app/javascript/src/utils/conditionalFields.js","webpack:///./app/javascript/src/utils/constants.js","webpack:///./app/javascript/src/utils/datePicker.js","webpack:///./app/javascript/src/utils/debounce.js","webpack:///./app/javascript/src/utils/externalLink.js","webpack:///./app/javascript/src/utils/isType.js","webpack:///./app/javascript/src/utils/isValidInputType.js","webpack:///./app/javascript/src/utils/links.js","webpack:///./app/javascript/src/utils/modalSearch.js","webpack:///./app/javascript/src/utils/notificationHelper.js","webpack:///./app/javascript/src/utils/outOfFocus.js","webpack:///./app/javascript/src/utils/paginable.js","webpack:///./app/javascript/src/utils/panelHeading.js","webpack:///./app/javascript/src/utils/passwordHelper.js","webpack:///./app/javascript/src/utils/popoverHelper.js","webpack:///./app/javascript/src/utils/requiredField.js","webpack:///./app/javascript/src/utils/scrollTo.js","webpack:///./app/javascript/src/utils/sectionUpdate.js","webpack:///./app/javascript/src/utils/spinner.js","webpack:///./app/javascript/src/utils/tabHelper.js","webpack:///./app/javascript/src/utils/timeagoFactory.js.erb","webpack:///./app/javascript/src/utils/tinymce.js.erb","webpack:///./app/javascript/src/utils/tooltipHelper.js","webpack:///./node_modules/@rails/ujs/lib/assets/compiled/rails-ujs.js","webpack:///./node_modules/bootstrap-3-typeahead/bootstrap3-typeahead.js","webpack:///./node_modules/bootstrap-sass/assets/javascripts/bootstrap/popover.js","webpack:///./node_modules/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js","webpack:///./node_modules/bootstrap-select/dist/js/bootstrap-select.js","webpack:///./node_modules/bootstrap/dist/js/npm.js","webpack:///./node_modules/bootstrap/js/affix.js","webpack:///./node_modules/bootstrap/js/alert.js","webpack:///./node_modules/bootstrap/js/button.js","webpack:///./node_modules/bootstrap/js/carousel.js","webpack:///./node_modules/bootstrap/js/collapse.js","webpack:///./node_modules/bootstrap/js/dropdown.js","webpack:///./node_modules/bootstrap/js/modal.js","webpack:///./node_modules/bootstrap/js/popover.js","webpack:///./node_modules/bootstrap/js/scrollspy.js","webpack:///./node_modules/bootstrap/js/tab.js","webpack:///./node_modules/bootstrap/js/tooltip.js","webpack:///./node_modules/bootstrap/js/transition.js","webpack:///./node_modules/chart.js/dist/Chart.js","webpack:///./node_modules/core-js/internals/a-callable.js","webpack:///./node_modules/core-js/internals/a-constructor.js","webpack:///./node_modules/core-js/internals/a-possible-prototype.js","webpack:///./node_modules/core-js/internals/add-to-unscopables.js","webpack:///./node_modules/core-js/internals/advance-string-index.js","webpack:///./node_modules/core-js/internals/an-instance.js","webpack:///./node_modules/core-js/internals/an-object.js","webpack:///./node_modules/core-js/internals/array-buffer-native.js","webpack:///./node_modules/core-js/internals/array-buffer-non-extensible.js","webpack:///./node_modules/core-js/internals/array-buffer-view-core.js","webpack:///./node_modules/core-js/internals/array-buffer.js","webpack:///./node_modules/core-js/internals/array-copy-within.js","webpack:///./node_modules/core-js/internals/array-fill.js","webpack:///./node_modules/core-js/internals/array-for-each.js","webpack:///./node_modules/core-js/internals/array-from-constructor-and-list.js","webpack:///./node_modules/core-js/internals/array-from.js","webpack:///./node_modules/core-js/internals/array-includes.js","webpack:///./node_modules/core-js/internals/array-iteration.js","webpack:///./node_modules/core-js/internals/array-last-index-of.js","webpack:///./node_modules/core-js/internals/array-method-has-species-support.js","webpack:///./node_modules/core-js/internals/array-method-is-strict.js","webpack:///./node_modules/core-js/internals/array-reduce.js","webpack:///./node_modules/core-js/internals/array-slice-simple.js","webpack:///./node_modules/core-js/internals/array-slice.js","webpack:///./node_modules/core-js/internals/array-sort.js","webpack:///./node_modules/core-js/internals/array-species-constructor.js","webpack:///./node_modules/core-js/internals/array-species-create.js","webpack:///./node_modules/core-js/internals/call-with-safe-iteration-closing.js","webpack:///./node_modules/core-js/internals/check-correctness-of-iteration.js","webpack:///./node_modules/core-js/internals/classof-raw.js","webpack:///./node_modules/core-js/internals/classof.js","webpack:///./node_modules/core-js/internals/collection-strong.js","webpack:///./node_modules/core-js/internals/collection-weak.js","webpack:///./node_modules/core-js/internals/collection.js","webpack:///./node_modules/core-js/internals/copy-constructor-properties.js","webpack:///./node_modules/core-js/internals/correct-is-regexp-logic.js","webpack:///./node_modules/core-js/internals/correct-prototype-getter.js","webpack:///./node_modules/core-js/internals/create-html.js","webpack:///./node_modules/core-js/internals/create-iterator-constructor.js","webpack:///./node_modules/core-js/internals/create-non-enumerable-property.js","webpack:///./node_modules/core-js/internals/create-property-descriptor.js","webpack:///./node_modules/core-js/internals/create-property.js","webpack:///./node_modules/core-js/internals/date-to-primitive.js","webpack:///./node_modules/core-js/internals/define-iterator.js","webpack:///./node_modules/core-js/internals/define-well-known-symbol.js","webpack:///./node_modules/core-js/internals/descriptors.js","webpack:///./node_modules/core-js/internals/document-create-element.js","webpack:///./node_modules/core-js/internals/dom-iterables.js","webpack:///./node_modules/core-js/internals/dom-token-list-prototype.js","webpack:///./node_modules/core-js/internals/engine-ff-version.js","webpack:///./node_modules/core-js/internals/engine-is-browser.js","webpack:///./node_modules/core-js/internals/engine-is-ie-or-edge.js","webpack:///./node_modules/core-js/internals/engine-is-ios-pebble.js","webpack:///./node_modules/core-js/internals/engine-is-ios.js","webpack:///./node_modules/core-js/internals/engine-is-node.js","webpack:///./node_modules/core-js/internals/engine-is-webos-webkit.js","webpack:///./node_modules/core-js/internals/engine-user-agent.js","webpack:///./node_modules/core-js/internals/engine-v8-version.js","webpack:///./node_modules/core-js/internals/engine-webkit-version.js","webpack:///./node_modules/core-js/internals/enum-bug-keys.js","webpack:///./node_modules/core-js/internals/export.js","webpack:///./node_modules/core-js/internals/fails.js","webpack:///./node_modules/core-js/internals/fix-regexp-well-known-symbol-logic.js","webpack:///./node_modules/core-js/internals/flatten-into-array.js","webpack:///./node_modules/core-js/internals/freezing.js","webpack:///./node_modules/core-js/internals/function-apply.js","webpack:///./node_modules/core-js/internals/function-bind-context.js","webpack:///./node_modules/core-js/internals/function-bind-native.js","webpack:///./node_modules/core-js/internals/function-bind.js","webpack:///./node_modules/core-js/internals/function-call.js","webpack:///./node_modules/core-js/internals/function-name.js","webpack:///./node_modules/core-js/internals/function-uncurry-this.js","webpack:///./node_modules/core-js/internals/get-built-in.js","webpack:///./node_modules/core-js/internals/get-iterator-method.js","webpack:///./node_modules/core-js/internals/get-iterator.js","webpack:///./node_modules/core-js/internals/get-method.js","webpack:///./node_modules/core-js/internals/get-substitution.js","webpack:///./node_modules/core-js/internals/global.js","webpack:///./node_modules/core-js/internals/has-own-property.js","webpack:///./node_modules/core-js/internals/hidden-keys.js","webpack:///./node_modules/core-js/internals/host-report-errors.js","webpack:///./node_modules/core-js/internals/html.js","webpack:///./node_modules/core-js/internals/ie8-dom-define.js","webpack:///./node_modules/core-js/internals/ieee754.js","webpack:///./node_modules/core-js/internals/indexed-object.js","webpack:///./node_modules/core-js/internals/inherit-if-required.js","webpack:///./node_modules/core-js/internals/inspect-source.js","webpack:///./node_modules/core-js/internals/internal-metadata.js","webpack:///./node_modules/core-js/internals/internal-state.js","webpack:///./node_modules/core-js/internals/is-array-iterator-method.js","webpack:///./node_modules/core-js/internals/is-array.js","webpack:///./node_modules/core-js/internals/is-callable.js","webpack:///./node_modules/core-js/internals/is-constructor.js","webpack:///./node_modules/core-js/internals/is-data-descriptor.js","webpack:///./node_modules/core-js/internals/is-forced.js","webpack:///./node_modules/core-js/internals/is-integral-number.js","webpack:///./node_modules/core-js/internals/is-object.js","webpack:///./node_modules/core-js/internals/is-pure.js","webpack:///./node_modules/core-js/internals/is-regexp.js","webpack:///./node_modules/core-js/internals/is-symbol.js","webpack:///./node_modules/core-js/internals/iterate.js","webpack:///./node_modules/core-js/internals/iterator-close.js","webpack:///./node_modules/core-js/internals/iterators-core.js","webpack:///./node_modules/core-js/internals/iterators.js","webpack:///./node_modules/core-js/internals/length-of-array-like.js","webpack:///./node_modules/core-js/internals/math-expm1.js","webpack:///./node_modules/core-js/internals/math-fround.js","webpack:///./node_modules/core-js/internals/math-log10.js","webpack:///./node_modules/core-js/internals/math-log1p.js","webpack:///./node_modules/core-js/internals/math-sign.js","webpack:///./node_modules/core-js/internals/microtask.js","webpack:///./node_modules/core-js/internals/native-promise-constructor.js","webpack:///./node_modules/core-js/internals/native-symbol.js","webpack:///./node_modules/core-js/internals/native-url.js","webpack:///./node_modules/core-js/internals/native-weak-map.js","webpack:///./node_modules/core-js/internals/new-promise-capability.js","webpack:///./node_modules/core-js/internals/not-a-regexp.js","webpack:///./node_modules/core-js/internals/number-is-finite.js","webpack:///./node_modules/core-js/internals/number-parse-float.js","webpack:///./node_modules/core-js/internals/number-parse-int.js","webpack:///./node_modules/core-js/internals/object-assign.js","webpack:///./node_modules/core-js/internals/object-create.js","webpack:///./node_modules/core-js/internals/object-define-properties.js","webpack:///./node_modules/core-js/internals/object-define-property.js","webpack:///./node_modules/core-js/internals/object-get-own-property-descriptor.js","webpack:///./node_modules/core-js/internals/object-get-own-property-names-external.js","webpack:///./node_modules/core-js/internals/object-get-own-property-names.js","webpack:///./node_modules/core-js/internals/object-get-own-property-symbols.js","webpack:///./node_modules/core-js/internals/object-get-prototype-of.js","webpack:///./node_modules/core-js/internals/object-is-extensible.js","webpack:///./node_modules/core-js/internals/object-is-prototype-of.js","webpack:///./node_modules/core-js/internals/object-keys-internal.js","webpack:///./node_modules/core-js/internals/object-keys.js","webpack:///./node_modules/core-js/internals/object-property-is-enumerable.js","webpack:///./node_modules/core-js/internals/object-prototype-accessors-forced.js","webpack:///./node_modules/core-js/internals/object-set-prototype-of.js","webpack:///./node_modules/core-js/internals/object-to-array.js","webpack:///./node_modules/core-js/internals/object-to-string.js","webpack:///./node_modules/core-js/internals/ordinary-to-primitive.js","webpack:///./node_modules/core-js/internals/own-keys.js","webpack:///./node_modules/core-js/internals/path.js","webpack:///./node_modules/core-js/internals/perform.js","webpack:///./node_modules/core-js/internals/promise-resolve.js","webpack:///./node_modules/core-js/internals/queue.js","webpack:///./node_modules/core-js/internals/redefine-all.js","webpack:///./node_modules/core-js/internals/redefine.js","webpack:///./node_modules/core-js/internals/regexp-exec-abstract.js","webpack:///./node_modules/core-js/internals/regexp-exec.js","webpack:///./node_modules/core-js/internals/regexp-flags.js","webpack:///./node_modules/core-js/internals/regexp-sticky-helpers.js","webpack:///./node_modules/core-js/internals/regexp-unsupported-dot-all.js","webpack:///./node_modules/core-js/internals/regexp-unsupported-ncg.js","webpack:///./node_modules/core-js/internals/require-object-coercible.js","webpack:///./node_modules/core-js/internals/same-value.js","webpack:///./node_modules/core-js/internals/set-global.js","webpack:///./node_modules/core-js/internals/set-species.js","webpack:///./node_modules/core-js/internals/set-to-string-tag.js","webpack:///./node_modules/core-js/internals/shared-key.js","webpack:///./node_modules/core-js/internals/shared-store.js","webpack:///./node_modules/core-js/internals/shared.js","webpack:///./node_modules/core-js/internals/species-constructor.js","webpack:///./node_modules/core-js/internals/string-html-forced.js","webpack:///./node_modules/core-js/internals/string-multibyte.js","webpack:///./node_modules/core-js/internals/string-pad-webkit-bug.js","webpack:///./node_modules/core-js/internals/string-pad.js","webpack:///./node_modules/core-js/internals/string-punycode-to-ascii.js","webpack:///./node_modules/core-js/internals/string-repeat.js","webpack:///./node_modules/core-js/internals/string-trim-forced.js","webpack:///./node_modules/core-js/internals/string-trim.js","webpack:///./node_modules/core-js/internals/task.js","webpack:///./node_modules/core-js/internals/this-number-value.js","webpack:///./node_modules/core-js/internals/to-absolute-index.js","webpack:///./node_modules/core-js/internals/to-index.js","webpack:///./node_modules/core-js/internals/to-indexed-object.js","webpack:///./node_modules/core-js/internals/to-integer-or-infinity.js","webpack:///./node_modules/core-js/internals/to-length.js","webpack:///./node_modules/core-js/internals/to-object.js","webpack:///./node_modules/core-js/internals/to-offset.js","webpack:///./node_modules/core-js/internals/to-positive-integer.js","webpack:///./node_modules/core-js/internals/to-primitive.js","webpack:///./node_modules/core-js/internals/to-property-key.js","webpack:///./node_modules/core-js/internals/to-string-tag-support.js","webpack:///./node_modules/core-js/internals/to-string.js","webpack:///./node_modules/core-js/internals/try-to-string.js","webpack:///./node_modules/core-js/internals/typed-array-constructor.js","webpack:///./node_modules/core-js/internals/typed-array-constructors-require-wrappers.js","webpack:///./node_modules/core-js/internals/typed-array-from-species-and-list.js","webpack:///./node_modules/core-js/internals/typed-array-from.js","webpack:///./node_modules/core-js/internals/typed-array-species-constructor.js","webpack:///./node_modules/core-js/internals/uid.js","webpack:///./node_modules/core-js/internals/use-symbol-as-uid.js","webpack:///./node_modules/core-js/internals/v8-prototype-define-bug.js","webpack:///./node_modules/core-js/internals/validate-arguments-length.js","webpack:///./node_modules/core-js/internals/well-known-symbol-wrapped.js","webpack:///./node_modules/core-js/internals/well-known-symbol.js","webpack:///./node_modules/core-js/internals/whitespaces.js","webpack:///./node_modules/core-js/modules/es.array-buffer.constructor.js","webpack:///./node_modules/core-js/modules/es.array-buffer.is-view.js","webpack:///./node_modules/core-js/modules/es.array-buffer.slice.js","webpack:///./node_modules/core-js/modules/es.array.concat.js","webpack:///./node_modules/core-js/modules/es.array.copy-within.js","webpack:///./node_modules/core-js/modules/es.array.fill.js","webpack:///./node_modules/core-js/modules/es.array.filter.js","webpack:///./node_modules/core-js/modules/es.array.find-index.js","webpack:///./node_modules/core-js/modules/es.array.find.js","webpack:///./node_modules/core-js/modules/es.array.flat-map.js","webpack:///./node_modules/core-js/modules/es.array.flat.js","webpack:///./node_modules/core-js/modules/es.array.from.js","webpack:///./node_modules/core-js/modules/es.array.includes.js","webpack:///./node_modules/core-js/modules/es.array.index-of.js","webpack:///./node_modules/core-js/modules/es.array.iterator.js","webpack:///./node_modules/core-js/modules/es.array.join.js","webpack:///./node_modules/core-js/modules/es.array.last-index-of.js","webpack:///./node_modules/core-js/modules/es.array.map.js","webpack:///./node_modules/core-js/modules/es.array.of.js","webpack:///./node_modules/core-js/modules/es.array.reduce-right.js","webpack:///./node_modules/core-js/modules/es.array.reduce.js","webpack:///./node_modules/core-js/modules/es.array.slice.js","webpack:///./node_modules/core-js/modules/es.array.sort.js","webpack:///./node_modules/core-js/modules/es.array.species.js","webpack:///./node_modules/core-js/modules/es.array.splice.js","webpack:///./node_modules/core-js/modules/es.array.unscopables.flat-map.js","webpack:///./node_modules/core-js/modules/es.array.unscopables.flat.js","webpack:///./node_modules/core-js/modules/es.date.to-primitive.js","webpack:///./node_modules/core-js/modules/es.function.has-instance.js","webpack:///./node_modules/core-js/modules/es.function.name.js","webpack:///./node_modules/core-js/modules/es.json.to-string-tag.js","webpack:///./node_modules/core-js/modules/es.map.js","webpack:///./node_modules/core-js/modules/es.math.acosh.js","webpack:///./node_modules/core-js/modules/es.math.asinh.js","webpack:///./node_modules/core-js/modules/es.math.atanh.js","webpack:///./node_modules/core-js/modules/es.math.cbrt.js","webpack:///./node_modules/core-js/modules/es.math.clz32.js","webpack:///./node_modules/core-js/modules/es.math.cosh.js","webpack:///./node_modules/core-js/modules/es.math.expm1.js","webpack:///./node_modules/core-js/modules/es.math.fround.js","webpack:///./node_modules/core-js/modules/es.math.hypot.js","webpack:///./node_modules/core-js/modules/es.math.imul.js","webpack:///./node_modules/core-js/modules/es.math.log10.js","webpack:///./node_modules/core-js/modules/es.math.log1p.js","webpack:///./node_modules/core-js/modules/es.math.log2.js","webpack:///./node_modules/core-js/modules/es.math.sign.js","webpack:///./node_modules/core-js/modules/es.math.sinh.js","webpack:///./node_modules/core-js/modules/es.math.tanh.js","webpack:///./node_modules/core-js/modules/es.math.to-string-tag.js","webpack:///./node_modules/core-js/modules/es.math.trunc.js","webpack:///./node_modules/core-js/modules/es.number.constructor.js","webpack:///./node_modules/core-js/modules/es.number.epsilon.js","webpack:///./node_modules/core-js/modules/es.number.is-finite.js","webpack:///./node_modules/core-js/modules/es.number.is-integer.js","webpack:///./node_modules/core-js/modules/es.number.is-nan.js","webpack:///./node_modules/core-js/modules/es.number.is-safe-integer.js","webpack:///./node_modules/core-js/modules/es.number.max-safe-integer.js","webpack:///./node_modules/core-js/modules/es.number.min-safe-integer.js","webpack:///./node_modules/core-js/modules/es.number.parse-float.js","webpack:///./node_modules/core-js/modules/es.number.parse-int.js","webpack:///./node_modules/core-js/modules/es.number.to-fixed.js","webpack:///./node_modules/core-js/modules/es.object.assign.js","webpack:///./node_modules/core-js/modules/es.object.define-getter.js","webpack:///./node_modules/core-js/modules/es.object.define-properties.js","webpack:///./node_modules/core-js/modules/es.object.define-property.js","webpack:///./node_modules/core-js/modules/es.object.define-setter.js","webpack:///./node_modules/core-js/modules/es.object.entries.js","webpack:///./node_modules/core-js/modules/es.object.freeze.js","webpack:///./node_modules/core-js/modules/es.object.from-entries.js","webpack:///./node_modules/core-js/modules/es.object.get-own-property-descriptor.js","webpack:///./node_modules/core-js/modules/es.object.get-own-property-descriptors.js","webpack:///./node_modules/core-js/modules/es.object.get-own-property-names.js","webpack:///./node_modules/core-js/modules/es.object.get-prototype-of.js","webpack:///./node_modules/core-js/modules/es.object.is-extensible.js","webpack:///./node_modules/core-js/modules/es.object.is-frozen.js","webpack:///./node_modules/core-js/modules/es.object.is-sealed.js","webpack:///./node_modules/core-js/modules/es.object.is.js","webpack:///./node_modules/core-js/modules/es.object.keys.js","webpack:///./node_modules/core-js/modules/es.object.lookup-getter.js","webpack:///./node_modules/core-js/modules/es.object.lookup-setter.js","webpack:///./node_modules/core-js/modules/es.object.prevent-extensions.js","webpack:///./node_modules/core-js/modules/es.object.seal.js","webpack:///./node_modules/core-js/modules/es.object.set-prototype-of.js","webpack:///./node_modules/core-js/modules/es.object.to-string.js","webpack:///./node_modules/core-js/modules/es.object.values.js","webpack:///./node_modules/core-js/modules/es.parse-float.js","webpack:///./node_modules/core-js/modules/es.parse-int.js","webpack:///./node_modules/core-js/modules/es.promise.finally.js","webpack:///./node_modules/core-js/modules/es.promise.js","webpack:///./node_modules/core-js/modules/es.reflect.apply.js","webpack:///./node_modules/core-js/modules/es.reflect.construct.js","webpack:///./node_modules/core-js/modules/es.reflect.define-property.js","webpack:///./node_modules/core-js/modules/es.reflect.delete-property.js","webpack:///./node_modules/core-js/modules/es.reflect.get-own-property-descriptor.js","webpack:///./node_modules/core-js/modules/es.reflect.get-prototype-of.js","webpack:///./node_modules/core-js/modules/es.reflect.get.js","webpack:///./node_modules/core-js/modules/es.reflect.has.js","webpack:///./node_modules/core-js/modules/es.reflect.is-extensible.js","webpack:///./node_modules/core-js/modules/es.reflect.own-keys.js","webpack:///./node_modules/core-js/modules/es.reflect.prevent-extensions.js","webpack:///./node_modules/core-js/modules/es.reflect.set-prototype-of.js","webpack:///./node_modules/core-js/modules/es.reflect.set.js","webpack:///./node_modules/core-js/modules/es.regexp.constructor.js","webpack:///./node_modules/core-js/modules/es.regexp.exec.js","webpack:///./node_modules/core-js/modules/es.regexp.flags.js","webpack:///./node_modules/core-js/modules/es.regexp.to-string.js","webpack:///./node_modules/core-js/modules/es.set.js","webpack:///./node_modules/core-js/modules/es.string.anchor.js","webpack:///./node_modules/core-js/modules/es.string.big.js","webpack:///./node_modules/core-js/modules/es.string.blink.js","webpack:///./node_modules/core-js/modules/es.string.bold.js","webpack:///./node_modules/core-js/modules/es.string.code-point-at.js","webpack:///./node_modules/core-js/modules/es.string.ends-with.js","webpack:///./node_modules/core-js/modules/es.string.fixed.js","webpack:///./node_modules/core-js/modules/es.string.fontcolor.js","webpack:///./node_modules/core-js/modules/es.string.fontsize.js","webpack:///./node_modules/core-js/modules/es.string.from-code-point.js","webpack:///./node_modules/core-js/modules/es.string.includes.js","webpack:///./node_modules/core-js/modules/es.string.italics.js","webpack:///./node_modules/core-js/modules/es.string.iterator.js","webpack:///./node_modules/core-js/modules/es.string.link.js","webpack:///./node_modules/core-js/modules/es.string.match.js","webpack:///./node_modules/core-js/modules/es.string.pad-end.js","webpack:///./node_modules/core-js/modules/es.string.pad-start.js","webpack:///./node_modules/core-js/modules/es.string.raw.js","webpack:///./node_modules/core-js/modules/es.string.repeat.js","webpack:///./node_modules/core-js/modules/es.string.replace.js","webpack:///./node_modules/core-js/modules/es.string.search.js","webpack:///./node_modules/core-js/modules/es.string.small.js","webpack:///./node_modules/core-js/modules/es.string.split.js","webpack:///./node_modules/core-js/modules/es.string.starts-with.js","webpack:///./node_modules/core-js/modules/es.string.strike.js","webpack:///./node_modules/core-js/modules/es.string.sub.js","webpack:///./node_modules/core-js/modules/es.string.sup.js","webpack:///./node_modules/core-js/modules/es.string.trim-end.js","webpack:///./node_modules/core-js/modules/es.string.trim-start.js","webpack:///./node_modules/core-js/modules/es.string.trim.js","webpack:///./node_modules/core-js/modules/es.symbol.async-iterator.js","webpack:///./node_modules/core-js/modules/es.symbol.description.js","webpack:///./node_modules/core-js/modules/es.symbol.has-instance.js","webpack:///./node_modules/core-js/modules/es.symbol.is-concat-spreadable.js","webpack:///./node_modules/core-js/modules/es.symbol.iterator.js","webpack:///./node_modules/core-js/modules/es.symbol.js","webpack:///./node_modules/core-js/modules/es.symbol.match.js","webpack:///./node_modules/core-js/modules/es.symbol.replace.js","webpack:///./node_modules/core-js/modules/es.symbol.search.js","webpack:///./node_modules/core-js/modules/es.symbol.species.js","webpack:///./node_modules/core-js/modules/es.symbol.split.js","webpack:///./node_modules/core-js/modules/es.symbol.to-primitive.js","webpack:///./node_modules/core-js/modules/es.symbol.to-string-tag.js","webpack:///./node_modules/core-js/modules/es.symbol.unscopables.js","webpack:///./node_modules/core-js/modules/es.typed-array.copy-within.js","webpack:///./node_modules/core-js/modules/es.typed-array.every.js","webpack:///./node_modules/core-js/modules/es.typed-array.fill.js","webpack:///./node_modules/core-js/modules/es.typed-array.filter.js","webpack:///./node_modules/core-js/modules/es.typed-array.find-index.js","webpack:///./node_modules/core-js/modules/es.typed-array.find.js","webpack:///./node_modules/core-js/modules/es.typed-array.float32-array.js","webpack:///./node_modules/core-js/modules/es.typed-array.float64-array.js","webpack:///./node_modules/core-js/modules/es.typed-array.for-each.js","webpack:///./node_modules/core-js/modules/es.typed-array.from.js","webpack:///./node_modules/core-js/modules/es.typed-array.includes.js","webpack:///./node_modules/core-js/modules/es.typed-array.index-of.js","webpack:///./node_modules/core-js/modules/es.typed-array.int16-array.js","webpack:///./node_modules/core-js/modules/es.typed-array.int32-array.js","webpack:///./node_modules/core-js/modules/es.typed-array.int8-array.js","webpack:///./node_modules/core-js/modules/es.typed-array.iterator.js","webpack:///./node_modules/core-js/modules/es.typed-array.join.js","webpack:///./node_modules/core-js/modules/es.typed-array.last-index-of.js","webpack:///./node_modules/core-js/modules/es.typed-array.map.js","webpack:///./node_modules/core-js/modules/es.typed-array.of.js","webpack:///./node_modules/core-js/modules/es.typed-array.reduce-right.js","webpack:///./node_modules/core-js/modules/es.typed-array.reduce.js","webpack:///./node_modules/core-js/modules/es.typed-array.reverse.js","webpack:///./node_modules/core-js/modules/es.typed-array.set.js","webpack:///./node_modules/core-js/modules/es.typed-array.slice.js","webpack:///./node_modules/core-js/modules/es.typed-array.some.js","webpack:///./node_modules/core-js/modules/es.typed-array.sort.js","webpack:///./node_modules/core-js/modules/es.typed-array.subarray.js","webpack:///./node_modules/core-js/modules/es.typed-array.to-locale-string.js","webpack:///./node_modules/core-js/modules/es.typed-array.to-string.js","webpack:///./node_modules/core-js/modules/es.typed-array.uint16-array.js","webpack:///./node_modules/core-js/modules/es.typed-array.uint32-array.js","webpack:///./node_modules/core-js/modules/es.typed-array.uint8-array.js","webpack:///./node_modules/core-js/modules/es.typed-array.uint8-clamped-array.js","webpack:///./node_modules/core-js/modules/es.weak-map.js","webpack:///./node_modules/core-js/modules/es.weak-set.js","webpack:///./node_modules/core-js/modules/web.dom-collections.for-each.js","webpack:///./node_modules/core-js/modules/web.dom-collections.iterator.js","webpack:///./node_modules/core-js/modules/web.immediate.js","webpack:///./node_modules/core-js/modules/web.queue-microtask.js","webpack:///./node_modules/core-js/modules/web.url-search-params.js","webpack:///./node_modules/core-js/modules/web.url.js","webpack:///./node_modules/core-js/modules/web.url.to-json.js","webpack:///./node_modules/jquery-ui/ui/data.js","webpack:///./node_modules/jquery-ui/ui/ie.js","webpack:///./node_modules/jquery-ui/ui/keycode.js","webpack:///./node_modules/jquery-ui/ui/position.js","webpack:///./node_modules/jquery-ui/ui/safe-active-element.js","webpack:///./node_modules/jquery-ui/ui/scroll-parent.js","webpack:///./node_modules/jquery-ui/ui/unique-id.js","webpack:///./node_modules/jquery-ui/ui/version.js","webpack:///./node_modules/jquery-ui/ui/widget.js","webpack:///./node_modules/jquery-ui/ui/widgets/autocomplete.js","webpack:///./node_modules/jquery-ui/ui/widgets/datepicker.js","webpack:///./node_modules/jquery-ui/ui/widgets/menu.js","webpack:///./node_modules/jquery-ui/ui/widgets/mouse.js","webpack:///./node_modules/jquery-ui/ui/widgets/sortable.js","webpack:///./node_modules/jquery/dist/jquery.js","webpack:///./node_modules/js-cookie/src/js.cookie.js","webpack:///./node_modules/moment/locale sync ^\\.\\/.*$","webpack:///./node_modules/moment/locale/af.js","webpack:///./node_modules/moment/locale/ar-dz.js","webpack:///./node_modules/moment/locale/ar-kw.js","webpack:///./node_modules/moment/locale/ar-ly.js","webpack:///./node_modules/moment/locale/ar-ma.js","webpack:///./node_modules/moment/locale/ar-sa.js","webpack:///./node_modules/moment/locale/ar-tn.js","webpack:///./node_modules/moment/locale/ar.js","webpack:///./node_modules/moment/locale/az.js","webpack:///./node_modules/moment/locale/be.js","webpack:///./node_modules/moment/locale/bg.js","webpack:///./node_modules/moment/locale/bm.js","webpack:///./node_modules/moment/locale/bn-bd.js","webpack:///./node_modules/moment/locale/bn.js","webpack:///./node_modules/moment/locale/bo.js","webpack:///./node_modules/moment/locale/br.js","webpack:///./node_modules/moment/locale/bs.js","webpack:///./node_modules/moment/locale/ca.js","webpack:///./node_modules/moment/locale/cs.js","webpack:///./node_modules/moment/locale/cv.js","webpack:///./node_modules/moment/locale/cy.js","webpack:///./node_modules/moment/locale/da.js","webpack:///./node_modules/moment/locale/de-at.js","webpack:///./node_modules/moment/locale/de-ch.js","webpack:///./node_modules/moment/locale/de.js","webpack:///./node_modules/moment/locale/dv.js","webpack:///./node_modules/moment/locale/el.js","webpack:///./node_modules/moment/locale/en-SG.js","webpack:///./node_modules/moment/locale/en-au.js","webpack:///./node_modules/moment/locale/en-ca.js","webpack:///./node_modules/moment/locale/en-gb.js","webpack:///./node_modules/moment/locale/en-ie.js","webpack:///./node_modules/moment/locale/en-il.js","webpack:///./node_modules/moment/locale/en-in.js","webpack:///./node_modules/moment/locale/en-nz.js","webpack:///./node_modules/moment/locale/en-sg.js","webpack:///./node_modules/moment/locale/eo.js","webpack:///./node_modules/moment/locale/es-do.js","webpack:///./node_modules/moment/locale/es-mx.js","webpack:///./node_modules/moment/locale/es-us.js","webpack:///./node_modules/moment/locale/es.js","webpack:///./node_modules/moment/locale/et.js","webpack:///./node_modules/moment/locale/eu.js","webpack:///./node_modules/moment/locale/fa.js","webpack:///./node_modules/moment/locale/fi.js","webpack:///./node_modules/moment/locale/fil.js","webpack:///./node_modules/moment/locale/fo.js","webpack:///./node_modules/moment/locale/fr-ca.js","webpack:///./node_modules/moment/locale/fr-ch.js","webpack:///./node_modules/moment/locale/fr.js","webpack:///./node_modules/moment/locale/fy.js","webpack:///./node_modules/moment/locale/ga.js","webpack:///./node_modules/moment/locale/gd.js","webpack:///./node_modules/moment/locale/gl.js","webpack:///./node_modules/moment/locale/gom-deva.js","webpack:///./node_modules/moment/locale/gom-latn.js","webpack:///./node_modules/moment/locale/gu.js","webpack:///./node_modules/moment/locale/he.js","webpack:///./node_modules/moment/locale/hi.js","webpack:///./node_modules/moment/locale/hr.js","webpack:///./node_modules/moment/locale/hu.js","webpack:///./node_modules/moment/locale/hy-am.js","webpack:///./node_modules/moment/locale/id.js","webpack:///./node_modules/moment/locale/is.js","webpack:///./node_modules/moment/locale/it-ch.js","webpack:///./node_modules/moment/locale/it.js","webpack:///./node_modules/moment/locale/ja.js","webpack:///./node_modules/moment/locale/jv.js","webpack:///./node_modules/moment/locale/ka.js","webpack:///./node_modules/moment/locale/kk.js","webpack:///./node_modules/moment/locale/km.js","webpack:///./node_modules/moment/locale/kn.js","webpack:///./node_modules/moment/locale/ko.js","webpack:///./node_modules/moment/locale/ku.js","webpack:///./node_modules/moment/locale/ky.js","webpack:///./node_modules/moment/locale/lb.js","webpack:///./node_modules/moment/locale/lo.js","webpack:///./node_modules/moment/locale/lt.js","webpack:///./node_modules/moment/locale/lv.js","webpack:///./node_modules/moment/locale/me.js","webpack:///./node_modules/moment/locale/mi.js","webpack:///./node_modules/moment/locale/mk.js","webpack:///./node_modules/moment/locale/ml.js","webpack:///./node_modules/moment/locale/mn.js","webpack:///./node_modules/moment/locale/mr.js","webpack:///./node_modules/moment/locale/ms-my.js","webpack:///./node_modules/moment/locale/ms.js","webpack:///./node_modules/moment/locale/mt.js","webpack:///./node_modules/moment/locale/my.js","webpack:///./node_modules/moment/locale/nb.js","webpack:///./node_modules/moment/locale/ne.js","webpack:///./node_modules/moment/locale/nl-be.js","webpack:///./node_modules/moment/locale/nl.js","webpack:///./node_modules/moment/locale/nn.js","webpack:///./node_modules/moment/locale/oc-lnc.js","webpack:///./node_modules/moment/locale/pa-in.js","webpack:///./node_modules/moment/locale/pl.js","webpack:///./node_modules/moment/locale/pt-br.js","webpack:///./node_modules/moment/locale/pt.js","webpack:///./node_modules/moment/locale/ro.js","webpack:///./node_modules/moment/locale/ru.js","webpack:///./node_modules/moment/locale/sd.js","webpack:///./node_modules/moment/locale/se.js","webpack:///./node_modules/moment/locale/si.js","webpack:///./node_modules/moment/locale/sk.js","webpack:///./node_modules/moment/locale/sl.js","webpack:///./node_modules/moment/locale/sq.js","webpack:///./node_modules/moment/locale/sr-cyrl.js","webpack:///./node_modules/moment/locale/sr.js","webpack:///./node_modules/moment/locale/ss.js","webpack:///./node_modules/moment/locale/sv.js","webpack:///./node_modules/moment/locale/sw.js","webpack:///./node_modules/moment/locale/ta.js","webpack:///./node_modules/moment/locale/te.js","webpack:///./node_modules/moment/locale/tet.js","webpack:///./node_modules/moment/locale/tg.js","webpack:///./node_modules/moment/locale/th.js","webpack:///./node_modules/moment/locale/tk.js","webpack:///./node_modules/moment/locale/tl-ph.js","webpack:///./node_modules/moment/locale/tlh.js","webpack:///./node_modules/moment/locale/tr.js","webpack:///./node_modules/moment/locale/tzl.js","webpack:///./node_modules/moment/locale/tzm-latn.js","webpack:///./node_modules/moment/locale/tzm.js","webpack:///./node_modules/moment/locale/ug-cn.js","webpack:///./node_modules/moment/locale/uk.js","webpack:///./node_modules/moment/locale/ur.js","webpack:///./node_modules/moment/locale/uz-latn.js","webpack:///./node_modules/moment/locale/uz.js","webpack:///./node_modules/moment/locale/vi.js","webpack:///./node_modules/moment/locale/x-pseudo.js","webpack:///./node_modules/moment/locale/yo.js","webpack:///./node_modules/moment/locale/zh-cn.js","webpack:///./node_modules/moment/locale/zh-hk.js","webpack:///./node_modules/moment/locale/zh-mo.js","webpack:///./node_modules/moment/locale/zh-tw.js","webpack:///./node_modules/moment/moment.js","webpack:///./node_modules/number-to-text/converters/en-us.js","webpack:///./node_modules/number-to-text/index.js","webpack:///./node_modules/number-to-text/lib/Converter.js","webpack:///./node_modules/process/browser.js","webpack:///./node_modules/regenerator-runtime/runtime.js","webpack:///./node_modules/setimmediate/setImmediate.js","webpack:///./node_modules/timeago.js/esm/format.js","webpack:///./node_modules/timeago.js/esm/index.js","webpack:///./node_modules/timeago.js/esm/lang/en_US.js","webpack:///./node_modules/timeago.js/esm/lang/zh_CN.js","webpack:///./node_modules/timeago.js/esm/realtime.js","webpack:///./node_modules/timeago.js/esm/register.js","webpack:///./node_modules/timeago.js/esm/utils/date.js","webpack:///./node_modules/timeago.js/esm/utils/dom.js","webpack:///./node_modules/timers-browserify/main.js","webpack:///./node_modules/tinymce/plugins/advlist/index.js","webpack:///./node_modules/tinymce/plugins/advlist/plugin.js","webpack:///./node_modules/tinymce/plugins/autoresize/index.js","webpack:///./node_modules/tinymce/plugins/autoresize/plugin.js","webpack:///./node_modules/tinymce/plugins/link/index.js","webpack:///./node_modules/tinymce/plugins/link/plugin.js","webpack:///./node_modules/tinymce/plugins/lists/index.js","webpack:///./node_modules/tinymce/plugins/lists/plugin.js","webpack:///./node_modules/tinymce/plugins/paste/index.js","webpack:///./node_modules/tinymce/plugins/paste/plugin.js","webpack:///./node_modules/tinymce/plugins/table/index.js","webpack:///./node_modules/tinymce/plugins/table/plugin.js","webpack:///./node_modules/tinymce/themes/modern/theme.js","webpack:///./node_modules/tinymce/tinymce.js","webpack:///(webpack)/buildin/global.js","webpack:///(webpack)/buildin/module.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/packs/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./app/javascript/packs/application.js\");\n","/* eslint no-console:0 */\n// This file is automatically compiled by Webpack, along with any other files\n// present in this directory. You're encouraged to place your actual application logic in\n// a relevant structure within app/javascript and only use these pack files to reference\n// that code so it'll be compiled.\n//\n// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate\n// layout file, like app/views/layouts/application.html.erb\n\nimport 'core-js/stable';\nimport 'regenerator-runtime/runtime';\n\n// Pull in Bootstrap JS functionality\nimport 'bootstrap';\nimport 'bootstrap-3-typeahead';\nimport 'bootstrap-select';\n\n// Uncomment to copy all static images under ../images to the output folder and reference\n// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)\n// or the `imagePath` JavaScript helper below.\n//\n// const images = require.context('../images', true)\n// const imagePath = (name) => images(name, true)\n\n// Utilities\nimport '../src/utils/accordion';\nimport '../src/utils/autoComplete';\nimport '../src/utils/externalLink';\nimport '../src/utils/modalSearch';\nimport '../src/utils/outOfFocus';\nimport '../src/utils/paginable';\nimport '../src/utils/panelHeading';\nimport '../src/utils/popoverHelper';\nimport '../src/utils/requiredField';\nimport '../src/utils/tabHelper';\nimport '../src/utils/tooltipHelper';\n\n// Specific functions from the Utilities files that will be made available to\n// the js.erb templates in the `window.x` statements below\nimport { renderAlert, renderNotice } from '../src/utils/notificationHelper';\nimport toggleSpinner from '../src/utils/spinner';\n\n// View specific JS\nimport '../src/answers/conditions';\nimport '../src/answers/edit';\nimport '../src/answers/rdaMetadata';\nimport '../src/contributors/form';\nimport '../src/devise/invitations/edit';\nimport '../src/devise/passwords/edit';\nimport '../src/devise/registrations/edit';\nimport '../src/devise/registrations/new';\nimport '../src/guidances/newEdit';\nimport '../src/notes/index';\nimport '../src/orgs/adminEdit';\nimport '../src/orgs/shibbolethDs';\nimport '../src/plans/download';\nimport '../src/plans/editDetails';\nimport '../src/plans/index.js.erb';\nimport '../src/plans/new';\nimport '../src/plans/share';\nimport '../src/publicTemplates/show';\nimport '../src/researchOutputs/form';\nimport '../src/roles/edit';\nimport '../src/shared/createAccountForm';\nimport '../src/shared/signInForm';\nimport '../src/usage/index';\nimport '../src/users/adminGrantPermissions';\nimport '../src/users/notificationPreferences';\n\n// OrgAdmin view specific JS\nimport '../src/orgAdmin/conditions/updateConditions';\nimport '../src/orgAdmin/phases/newEdit';\nimport '../src/orgAdmin/phases/preview';\nimport '../src/orgAdmin/phases/show';\nimport '../src/orgAdmin/questionOptions/index';\nimport '../src/orgAdmin/questions/sharedEventHandlers';\nimport '../src/orgAdmin/sections/index';\nimport '../src/orgAdmin/templates/edit';\nimport '../src/orgAdmin/templates/index';\nimport '../src/orgAdmin/templates/new';\n\n// SuperAdmin view specific JS\nimport '../src/superAdmin/apiClients/form';\nimport '../src/superAdmin/notifications/edit';\nimport '../src/superAdmin/themes/newEdit';\nimport '../src/superAdmin/users/edit';\n\n// Since we're using Webpacker to manage JS we need to startup Rails' Unobtrusive JS\n// and Turbolinks. ActiveStorage and ActionCable would also need to be in here\n// if we decide to implement either before Rails 6\nrequire('@rails/ujs').start();\n\n// TODO: Disabled turbolinks for the time being because our custom JS is not\n// properly setup to work with it. We should review the docs:\n// https://github.com/turbolinks/turbolinks\n// require('turbolinks').start();\n// require(\"@rails/activestorage\").start()\n// require(\"@rails/actioncable\").start()\n\n// Setup JS functions/libraries so that they're available within the js.erb templates\nwindow.$ = jQuery;\nwindow.jQuery = jQuery;\n\n// Allow js.erb files to access the notificationHelper functions\nwindow.renderAlert = renderAlert;\nwindow.renderNotice = renderNotice;\nwindow.toggleSpinner = toggleSpinner;\n","import { updateSectionProgress, getQuestionDiv } from '../utils/sectionUpdate';\n\n$(() => {\n if ($('.answering-phase').length > 0) { // check phase has (standard) questions\n // hide already removed questions on load\n const removeData = $('#progress-data').data('remove');\n removeData.forEach((id) => {\n getQuestionDiv(id).hide();\n });\n\n // update progress on section panel on load\n const sectionsInfo = $('#progress-data').data('sections');\n sectionsInfo.forEach((sectionInfo) => {\n const forms = $(`#collapse-${sectionInfo.id}`).find('form');\n if (forms.length > 0) { // ensure current phase\n updateSectionProgress(sectionInfo.id, sectionInfo.no_ans, sectionInfo.no_qns);\n }\n });\n }\n});\n","import {\n isObject,\n isNumber,\n isString,\n} from '../utils/isType';\nimport { Tinymce } from '../utils/tinymce.js.erb';\nimport debounce from '../utils/debounce';\nimport { updateSectionProgress, getQuestionDiv } from '../utils/sectionUpdate';\nimport datePicker from '../utils/datePicker';\nimport TimeagoFactory from '../utils/timeagoFactory.js.erb';\n\n$(() => {\n const editorClass = 'tinymce_answer';\n const showSavingMessage = (jQuery) => jQuery.closest('.question-form').find('[data-status=\"saving\"]').show();\n const hideSavingMessage = (jQuery) => jQuery.closest('.question-form').find('[data-status=\"saving\"]').hide();\n const closestErrorSavingMessage = (jQuery) => jQuery.closest('.question-form').find('[data-status=\"error-saving\"]');\n const questionId = (jQuery) => jQuery.closest('.form-answer').attr('data-autosave');\n const isStale = (jQuery) => jQuery.closest('.question-form').find('.answer-locking').text().trim().length !== 0;\n const isReadOnly = () => $('.form-answer fieldset:disabled').length > 0;\n const showOrHideQuestions = (data) => {\n data.section_data.forEach((section) => {\n updateSectionProgress(section.sec_id, section.no_ans, section.no_qns);\n });\n data.qn_data.to_hide.forEach((questionid) => {\n getQuestionDiv(questionid).slideUp();\n });\n data.qn_data.to_show.forEach((questionid) => {\n getQuestionDiv(questionid).slideDown();\n });\n };\n /*\n * A map of debounced functions, one for each input, textarea or select change at any\n * form with class form-answer. The key represents a question id and the value holds\n * the debounced function for a given input, textarea or select. Note, this map is\n * populated on demand, i.e. the first time a change is made at a given input, textarea\n * or select within the form, a new key-value should be created. Succesive times, the\n * debounced function should be retrieved instead.\n */\n const debounceMap = {};\n const autoSaving = (jQuery) => {\n if (!isStale(jQuery)) {\n jQuery.closest('.form-answer').trigger('submit');\n }\n };\n const doneCallback = (data, jQuery) => {\n const form = jQuery.closest('form');\n // Validation for the data object received\n if (isObject(data)) {\n if (isObject(data.question)) { // Object related to question within data received\n if (isNumber(data.question.id)) {\n if (isString(data.question.answer_status)) {\n $(`#answer-status-${data.question.id}`).html(data.question.answer_status);\n TimeagoFactory.render($('time.timeago'));\n }\n if (isString(data.question.locking)) { // When an answer is stale...\n // Removes event handlers for the saved form\n detachEventHandlers(form); // eslint-disable-line no-use-before-define\n // Reflesh form view with the new partial form received\n $(`#answer-form-${data.question.id}`).html(data.question.form);\n // Retrieves the newly form added to the DOM\n const newForm = $(`#answer-form-${data.question.id}`).find('form');\n // Attaches event handlers for the new form\n attachEventHandlers(newForm); // eslint-disable-line no-use-before-define\n // Refresh optimistic locking view with the form that caused the locking\n $(`#answer-locking-${data.question.id}`).html(data.question.locking);\n } else { // When answer is NOT stale...\n $(`#answer-locking-${data.question.id}`).html('');\n if (isNumber(data.question.answer_lock_version)) {\n form.find('#answer_lock_version').val(data.question.answer_lock_version);\n }\n }\n }\n }// End Object related to question within data received\n if (isObject(data.plan)) { // Object related to plan within data received\n if (isString(data.plan.progress)) {\n $('.progress').html(data.plan.progress);\n }\n }\n showOrHideQuestions(data);\n }\n };\n const failCallback = (error, jQuery) => {\n closestErrorSavingMessage(jQuery).html(\n (isObject(error.responseJSON) && isString(error.responseJSON.detail))\n ? error.responseJSON.detail : error.statusText,\n ).show();\n };\n const changeHandler = (e) => {\n const target = $(e.target);\n const id = questionId(target);\n if (!debounceMap[id]) {\n debounceMap[id] = debounce(autoSaving);\n }\n debounceMap[id](target);\n };\n const submitHandler = (e) => {\n e.preventDefault();\n const target = $(e.target);\n const form = target.closest('form');\n const id = questionId(target);\n if (debounceMap[id]) {\n // Cancels the delated execution of autoSaving\n // (e.g. user clicks the button before the delay is met)\n debounceMap[id].cancel();\n }\n $.ajax({\n method: form.attr('method'),\n url: form.attr('action'),\n data: form.serializeArray(),\n beforeSend: () => {\n showSavingMessage(target);\n },\n complete: () => {\n hideSavingMessage(target);\n },\n }).done((data) => {\n doneCallback(data, target);\n }).fail((error) => {\n failCallback(error, target);\n });\n };\n const blurHandler = (editor) => {\n const target = $(editor.getElement());\n const id = questionId(target);\n if (editor.isDirty()) {\n editor.save(); // Saves contents from editor to the textarea element\n if (!debounceMap[id]) {\n debounceMap[id] = debounce(autoSaving);\n }\n debounceMap[id](target);\n }\n };\n const focusHandler = (editor) => {\n const id = questionId($(editor.getElement()));\n if (debounceMap[id]) {\n /* Cancels the delayed execution of autoSaving, either because user\n * transitioned from an option_based question to the comment or\n * because the target element triggered blur and focus before\n * the delayed execution of autoSaving.\n */\n debounceMap[id].cancel();\n }\n };\n const formHandlers = ({ jQuery, attachment = 'off' }) => {\n // Listeners to change and submit for a form\n jQuery[attachment]('change', changeHandler);\n jQuery[attachment]('submit', submitHandler);\n };\n const editorHandlers = (editor) => {\n // Listeners to blur and focus events for a tinymce instance\n editor.on('Blur', () => blurHandler(editor));\n editor.on('Focus', () => focusHandler(editor));\n };\n /*\n Detaches events from a specific form including its tinymce editor\n @param { objecg } - jQueryForm to remove events\n */\n const detachEventHandlers = (jQueryForm) => {\n formHandlers({ jQuery: jQueryForm, attachment: 'off' });\n const tinymceId = jQueryForm.find(`.${editorClass}`).attr('id');\n Tinymce.destroyEditorById(tinymceId);\n };\n /*\n Attaches events for a specific form including its tinymce editor\n @param { objecg } - jQueryForm to add events\n */\n const attachEventHandlers = (jQueryForm) => {\n formHandlers({ jQuery: jQueryForm, attachment: 'on' });\n const tinymceId = jQueryForm.find(`.${editorClass}`).attr('id');\n Tinymce.init({ selector: `#${tinymceId}` });\n editorHandlers(Tinymce.findEditorById(tinymceId));\n };\n // Initial load\n TimeagoFactory.render($('time.timeago'));\n Tinymce.init({ selector: `.${editorClass}` });\n if (!isReadOnly()) {\n // Attaches form and tinymce event handlers\n Tinymce.findEditorsByClassName(editorClass).forEach(editorHandlers);\n formHandlers({ jQuery: $('.form-answer'), attachment: 'on' });\n } else {\n // Sets the editor mode for each editor to readonly\n Tinymce.findEditorsByClassName(editorClass).forEach((editor) => {\n editor.setMode('readonly');\n });\n }\n\n datePicker();\n\n // Clicking the 'Comments & Guidance' div should toggle the guidance & comments section\n $(document).on('click', '.toggle-guidance-section', (e) => {\n const target = $(e.currentTarget);\n target.parents('.question-body').find('.guidance-section').toggle();\n target.find('span.fa-chevron-right, span.fa-chevron-left')\n .toggleClass('fa-chevron-right')\n .toggleClass('fa-chevron-left');\n });\n});\n","import { isUndefined, isObject } from '../utils/isType';\n\n$(() => {\n // url for the api we will be querying\n let url = '';\n\n // key/value lookup for standards\n const descriptions = {};\n // cleaned up structure of the API results\n const minTree = {};\n // keeps track of how many waiting api-requests still need to run\n let noWaiting = 0;\n\n // prune the min_tree where there are no standards\n // opporates on the principal that no two subjects have the same name\n function removeUnused(name) {\n const num = Object.keys(minTree).find((x) => minTree[x].name === name);\n // if not top level standard\n if (isUndefined(num)) {\n // for each top level standard\n Object.keys(minTree).forEach((knum) => {\n const child = Object.keys(minTree[knum].children)\n .find((x) => minTree[knum].children[x].name === name);\n if (isObject(child)) {\n delete minTree[knum].children[child];\n $(`.rda_metadata .sub-subject select option[value=\"${name}\"]`).remove();\n }\n });\n } else {\n delete minTree[num];\n // remove min_tree[num] from top-level dropdowns\n $(`.rda_metadata .subject select option[value=\"${name}\"]`).remove();\n }\n }\n\n function getDescription(id) {\n $.ajax({\n url: url + id.slice(4),\n type: 'GET',\n crossDomain: true,\n dataType: 'json',\n }).done((results) => {\n descriptions[id] = {};\n descriptions[id].title = results.title;\n descriptions[id].description = results.description;\n noWaiting -= 1;\n });\n }\n\n // init descriptions lookup table based on passed ids\n function initDescriptions(ids) {\n ids.forEach((id) => {\n if (!(id in descriptions)) {\n noWaiting += 1;\n getDescription(id);\n }\n });\n }\n\n // takes in a subset of the min_tree which has name and standards properties\n // initializes the standards property to the result of an AJAX POST\n function getStandards(name, num, child) {\n // slice -4 from url to remove '/api/'\n noWaiting += 1;\n $.ajax({\n url: `${url.slice(0, -4)}query/schemes`,\n type: 'POST',\n crossDomain: true,\n data: `keyword=${name}`,\n dataType: 'json',\n }).done((result) => {\n if (isUndefined(child)) {\n minTree[num].standards = result.ids;\n } else {\n minTree[num].children[child].standards = result.ids;\n }\n if (result.ids.length < 1) {\n removeUnused(name);\n }\n noWaiting -= 1;\n initDescriptions(result.ids);\n });\n }\n\n // clean up the data initially returned from the API\n function cleanTree(apiTree) {\n // iterate over api_tree\n Object.keys(apiTree).forEach((num) => {\n minTree[num] = {};\n minTree[num].name = apiTree[num].name;\n minTree[num].children = [];\n if (apiTree[num].children !== undefined) {\n Object.keys(apiTree[num].children).forEach((child) => {\n minTree[num].children[child] = {};\n minTree[num].children[child].name = apiTree[num].children[child].name;\n minTree[num].children[child].standards = [];\n getStandards(minTree[num].children[child].name, num, child);\n });\n }\n // init a standards on top level\n minTree[num].standards = [];\n getStandards(minTree[num].name, num, undefined);\n });\n }\n\n // create object for typeahead\n function initTypeahead() {\n const data = [];\n const simpdat = [];\n Object.keys(descriptions).forEach((id) => {\n data.push({ value: descriptions[id].title, id });\n simpdat.push(descriptions[id].title);\n });\n const typ = $('.standards-typeahead');\n typ.typeahead({ source: simpdat });\n }\n\n function initStandards() {\n // for each metadata question, init selected standards according to html\n $('.rda_metadata').each(function () { // eslint-disable-line func-names\n // list of selected standards\n const selectedStandards = $(this).find('.selected_standards .list');\n // form listing of standards\n const formStandards = $(this).next('form').find('#standards');\n // need to pull in the value from frm_stds\n const standardsArray = JSON.parse(formStandards.val());\n // init the data value\n formStandards.data('standard', standardsArray);\n Object.keys(standardsArray).forEach((key) => {\n // add the standard to list\n if (key === standardsArray[key]) {\n selectedStandards.append(`
  • ${key}${descriptions[key].title}
  • `);\n }\n });\n });\n }\n\n function waitAndUpdate() {\n if (noWaiting > 0) {\n // if we are waiting on api responces, call this function in 1 seccond\n setTimeout(waitAndUpdate, 1000);\n } else {\n // update all the dropdowns/ standards explore box (calling on subject\n // will suffice since it will necisarily update sub-subject)\n $('.rda_metadata .subject select').change();\n initStandards();\n initTypeahead();\n }\n }\n\n // given a subject name, returns the portion of the min_tree applicable\n function getSubject(subjectText) {\n const num = Object.keys(minTree).find((x) => minTree[x].name === subjectText);\n return minTree[num];\n }\n\n // given a subsubject name and an array of children, data, return the\n // applicable child\n function getSubSubject(subsubjectText, data) {\n const child = Object.keys(data).find((x) => data[x].name === subsubjectText);\n return data[child];\n }\n\n function updateSaveStatus(group) {\n // update save/autosave status\n group.next('form').find('fieldset input').change();\n }\n\n // change sub-subjects and standards based on selected subject\n $('.rda_metadata').on('change', '.subject select', (e) => {\n const target = $(e.currentTarget);\n const group = target.closest('.rda_metadata');\n const subSubject = group.find('.sub-subject select');\n const subjectText = target.find(':selected').text();\n // find subject in min_tree\n const subject = getSubject(subjectText);\n // check to see if this object has no children(and thus it's own standards)\n if (subject.children.length === 0) {\n // hide sub-subject since there's no data for it\n subSubject.closest('div').hide();\n // update the standards display selector\n $('.rda_metadata .sub-subject select').change();\n } else {\n // show the sub-subject incase it was previously hidden\n subSubject.closest('div').show();\n // update the sub-subject display selector\n subSubject.find('option').remove();\n subject.children.forEach((child) => {\n $('`);\n });\n // If there is only one template, set the input field value and submit the form\n // otherwise show the dropdown list and the 'Multiple templates found message'\n if (data.templates.length === 1) {\n $('#plan_template_id option').attr('selected', 'true');\n $('#multiple-templates').hide();\n $('#available-templates').fadeOut();\n } else {\n $('#multiple-templates').show();\n $('#available-templates').fadeIn();\n }\n toggleSubmit();\n } else {\n error();\n }\n }\n };\n\n // TODO: Refactor this whole thing when we redo the create plan\n // workflow and use js.erb instead!\n const getValue = (context) => {\n if (context.length > 0) {\n const hidden = $(context).find('.autocomplete-result');\n if (hidden.length > 0 && hidden.val().length > 0\n && hidden.val() !== '{}' && hidden.val() !== '{\"name\":\"\"}') {\n return hidden.val();\n }\n }\n return '{}';\n };\n\n const validOptions = (context) => {\n let ret = false;\n if ($(context).length > 0) {\n const checkbox = $(context).find('input.toggle-autocomplete');\n const val = getValue(context);\n\n if (val.length > 0 && val !== '{}') {\n const json = JSON.parse(val);\n // If the json ONLY contains a name then it is not a valid selection\n ret = (checkbox.prop('checked') || json.id !== undefined);\n } else {\n // Otherwise just focus on the checkbox\n ret = checkbox.prop('checked');\n }\n }\n return ret;\n };\n\n // When one of the autocomplete fields changes, fetch the available templates\n const handleComboboxChange = debounce(() => {\n const orgContext = $('#research-org-controls');\n const funderContext = $('#funder-org-controls');\n const validOrg = validOptions(orgContext);\n const validFunder = validOptions(funderContext);\n\n if (!validOrg || !validFunder) {\n $('#available-templates').fadeOut();\n $('#plan_template_id').find(':selected').removeAttr('selected');\n $('#plan_template_id').val('');\n toggleSubmit();\n } else {\n // Clear out the old template dropdown contents\n $('#plan_template_id option').remove();\n\n let orgId = orgContext.find('input[id$=\"org_id\"]').val();\n let funderId = funderContext.find('input[id$=\"funder_id\"]').val();\n\n // For some reason Rails freaks out it everything is empty so send\n // the word \"none\" instead and handle on the controller side\n if (orgId.length <= 0) {\n orgId = '\"none\"';\n }\n if (funderId.length <= 0) {\n funderId = '\"none\"';\n }\n const data = `{\"plan\": {\"research_org_id\":${orgId},\"funder_id\":${funderId}}}`;\n\n // Fetch the available templates based on the funder and research org selected\n $.ajax({\n url: $('#template-option-target').val(),\n data: JSON.parse(data),\n }).done(success).fail(error);\n }\n }, 150);\n\n // When one of the checkboxes is clicked, disable the autocomplete input and clear its contents\n const handleCheckboxClick = (autocomplete, checkbox) => {\n // Clear and then Disable/Enable the textbox and hide\n // any textbox warnings\n const checked = checkbox.prop('checked');\n autocomplete.val('');\n autocomplete.prop('disabled', checked);\n autocomplete.siblings('.autocomplete-result').val('');\n autocomplete.siblings('.autocomplete-warning').hide();\n\n handleComboboxChange();\n };\n\n const initOrgSelection = (context) => {\n const section = $(context);\n\n if (section.length > 0) {\n initAutocomplete(`${context} .autocomplete`);\n\n const autocomplete = $(section).find('.autocomplete');\n const hidden = autocomplete.siblings('.autocomplete-result');\n const checkbox = $(section).find('input.toggle-autocomplete');\n\n hidden.on('change', () => {\n handleComboboxChange();\n });\n\n checkbox.on('click', () => {\n handleCheckboxClick(autocomplete, checkbox);\n });\n\n if (checkbox.prop('checked')) {\n handleCheckboxClick(autocomplete, checkbox);\n }\n }\n };\n\n ['#research-org-controls', '#funder-org-controls'].forEach((el) => {\n if ($(el).length > 0) {\n initOrgSelection(el);\n }\n });\n\n const defaultVisibility = $('#plan_visibility').val();\n\n // When the user checks the 'mock project' box we need to set the\n // visibility to 'is_test'\n $('#new_plan #is_test').click((e) => {\n $('#plan_visibility').val(($(e.currentTarget)[0].checked ? 'is_test' : defaultVisibility));\n });\n\n // Initialize the form\n $('#new_plan #available-templates').hide();\n handleComboboxChange();\n // Scrub out the large arrays of data used for the Org Selector JS so that they\n // are not a part of the form submissiomn\n scrubOrgSelectionParamsOnSubmit('#new_plan');\n toggleSubmit();\n});\n","import * as notifier from '../utils/notificationHelper';\nimport { isObject, isString } from '../utils/isType';\n\n$(() => {\n $('#set_visibility').on('ajax:success', (e) => {\n const data = e.detail[0];\n if (isObject(data) && isString(data.msg)) {\n notifier.renderNotice(data.msg);\n }\n });\n $('#set_visibility').on('ajax:error', (e) => {\n const xhr = e.detail[2];\n if (isObject(xhr.responseJSON)) {\n notifier.renderAlert(xhr.responseJSON.msg);\n } else {\n notifier.renderAlert(`${xhr.statusCode} - ${xhr.statusText}`);\n }\n });\n\n $('.toggle-existing-user-access')\n .on('ajax:success', (e) => {\n const data = e.detail[0];\n notifier.renderNotice(`foo: ${data.msg}`);\n })\n .on('ajax:error', (e) => {\n const xhr = e.detail[2];\n if (isObject(xhr.responseJSON)) {\n notifier.renderAlert(xhr.responseJSON.msg);\n } else {\n notifier.renderAlert(`${xhr.statusCode} - ${xhr.statusText}`);\n }\n });\n});\n","$(() => {\n $('body').on('click', '.copy-link', (e) => {\n const link = $(e.currentTarget).siblings('.direct-link');\n\n $('#link-modal').on('show.bs.modal', () => {\n $('#link').val(link.attr('href'));\n });\n });\n\n $('body').on('click', '#copy-link-btn', () => {\n $('#link').select();\n // eslint-disable-next-line\n document.execCommand('copy');\n });\n});\n","import getConstant from '../utils/constants';\nimport { isUndefined, isObject } from '../utils/isType';\nimport { Tinymce } from '../utils/tinymce.js.erb';\n\n$(() => {\n const form = $('.research_output_form');\n\n if (!isUndefined(form) && isObject(form)) {\n Tinymce.init({ selector: '#research_output_description' });\n }\n\n // Expands/Collapses the search results 'More info'/'Less info' section\n $('body').on('click', '.modal-search-result .more-info a.more-info-link', (e) => {\n e.preventDefault();\n const link = $(e.target);\n\n if (link.length > 0) {\n const info = $(link).siblings('div.info');\n\n if (info.length > 0) {\n if (info.hasClass('hidden')) {\n info.removeClass('hidden');\n link.text(`${getConstant('LESS_INFO')}`);\n } else {\n info.addClass('hidden');\n link.text(`${getConstant('MORE_INFO')}`);\n }\n }\n }\n });\n\n // Put the facet text into the modal search window's search box when the user\n // clicks on one\n $('body').on('click', '.modal-search-result a.facet', (e) => {\n const link = $(e.target);\n\n if (link.length > 0) {\n const textField = link.closest('.modal-body').find('input.autocomplete');\n\n if (textField.length > 0) {\n textField.val(link.text());\n }\n }\n });\n});\n","import { renderNotice, renderAlert } from '../utils/notificationHelper';\nimport { isString, isObject } from '../utils/isType';\nimport { scrollTo } from '../utils/scrollTo';\n\n$(() => {\n $('form.edit_role select').on('change', (e) => {\n $(e.target).closest('form').submit();\n });\n $('form.edit_role').on('ajax:success', (e) => {\n const data = e.detail[0];\n if (isObject(data) && isString(data.msg)) {\n renderNotice(data.msg);\n scrollTo('#notification-area');\n }\n });\n $('form.edit_role').on('ajax:error', (e) => {\n if (isObject(e.detail[2])) {\n const error = e.detail[2].responseJSON;\n if (isObject(error) && isString(error)) {\n renderAlert(error.msg);\n scrollTo('#notification-area');\n }\n }\n });\n});\n","import { initAutocomplete, scrubOrgSelectionParamsOnSubmit } from '../utils/autoComplete';\nimport { togglisePasswords } from '../utils/passwordHelper';\n\n$(() => {\n initAutocomplete('#create-account-org-controls .autocomplete');\n // Scrub out the large arrays of data used for the Org Selector JS so that they\n // are not a part of the form submissiomn\n scrubOrgSelectionParamsOnSubmit('#create_account_form');\n togglisePasswords({ selector: '#create_account_form' });\n});\n","import * as Cookies from 'js-cookie';\nimport { isValidText } from '../utils/isValidInputType';\n\n$(() => {\n // Constants and methods\n const rememberEmail = $('#sign_in_form input[name=\"remember_email\"]');\n const userEmail = $('#sign_in_form input[name=\"user[email]\"]');\n const emailCookieKey = 'dmproadmap_email';\n const getEmailCookie = () => Cookies.get(emailCookieKey);\n const setEmailCookie = (value = null) => {\n if (value === null) {\n Cookies.remove(emailCookieKey);\n } else {\n Cookies.set(emailCookieKey, value, { expires: 14 });\n }\n };\n // Event handlers\n rememberEmail.click(() => {\n if (rememberEmail.is(':checked')) {\n setEmailCookie(userEmail.val());\n } else {\n setEmailCookie(null);\n }\n });\n userEmail.change(() => {\n if (rememberEmail.is(':checked')) {\n setEmailCookie(userEmail.val());\n }\n });\n // Initialisation\n if (isValidText(getEmailCookie())) {\n rememberEmail.attr('checked', 'checked');\n userEmail.val(getEmailCookie());\n }\n});\n","import { initAutocomplete } from '../../utils/autoComplete';\n\n$(() => {\n if ($('#api-client-org-controls').length > 0) {\n initAutocomplete('#api-client-org-controls .autocomplete');\n }\n});\n","import { Tinymce } from '../../utils/tinymce.js.erb';\n\n// add the info on selecting the check from notification suitable\nimport { paginableSelector } from '../../utils/paginable';\nimport * as notifier from '../../utils/notificationHelper';\n\n$(() => {\n Tinymce.init({ selector: '.notification-text', forced_root_block: '' });\n\n $(paginableSelector).on('click, change', '.enable_notification input[type=\"checkbox\"]', (e) => {\n const form = $(e.target).closest('form');\n form.submit();\n });\n\n $(paginableSelector).on('ajax:success', '.enable_notification', (e) => {\n const data = e.detail[0];\n if (data.code === 1 && data.msg && data.msg !== '') {\n notifier.renderNotice(data.msg);\n } else {\n notifier.renderAlert(data.msg);\n }\n });\n});\n","import { Tinymce } from '../../utils/tinymce.js.erb';\n\n$(() => {\n Tinymce.init({ selector: '#theme_description' });\n});\n","import { initAutocomplete, scrubOrgSelectionParamsOnSubmit } from '../../utils/autoComplete';\n\n$(() => {\n const updateMergeConfirmation = (userSelect) => {\n // update the confirmation dialogue with the selected user's email address\n const editingUserEmail = $('#superadmin_user_email').val();\n const chosenUserEmail = userSelect.find('option:selected').text();\n const submitButton = userSelect.closest('form').find(':submit');\n submitButton.attr('data-confirm',\n `Confirm Account Merge: The account for ${editingUserEmail} will be merged with ${chosenUserEmail}.\n All plans and account information for ${chosenUserEmail} will now be accessible via ${editingUserEmail}.\n The account for ${chosenUserEmail} will then be destroyed.`);\n };\n\n $('#merge_form').on('ajax:success', (e) => {\n const data = e.detail[0];\n // replace the search form with the merge form\n $('#merge_form_container').html(data.form);\n const userSelect = $('#merge_id');\n userSelect.on('change', () => updateMergeConfirmation(userSelect));\n userSelect.change();\n });\n\n if ($('#super-admin-user-org-controls').length > 0) {\n initAutocomplete('#super-admin-user-org-controls .autocomplete');\n // Scrub out the large arrays of data used for the Org Selector JS so that they\n // are not a part of the form submissiomn\n scrubOrgSelectionParamsOnSubmit('#super_admin_user_edit');\n }\n});\n","import { isObject, isUndefined } from '../utils/isType';\nimport { initializeCharts, createChart, drawHorizontalBar } from '../utils/charts';\n\n$(() => {\n // handles the checkbox for filtered-plans\n $('#filter_plans_form').on('click, change', 'input[type=\"checkbox\"]', (e) => {\n const form = $(e.target).closest('form');\n form.submit();\n });\n\n // fns to handle the separator character menu\n // for CSV download\n const changeStatFnGen = (str) => {\n const fn = (item) => {\n /* eslint no-param-reassign: [\"error\", { \"props\": false }] */\n item.href = item.href.replace(/sep=.*/, str);\n };\n return fn;\n };\n\n // attach listener to separator select menu\n // on change look for \"stat\" elements and chnage their query param\n const fieldSep = document.getElementById('csv-field-sep');\n if (fieldSep !== null) {\n fieldSep.addEventListener('click', (e) => {\n const statElems = document.getElementsByClassName('stat');\n const newSep = 'sep='.concat(encodeURIComponent(e.target.value));\n const changeStatFn = changeStatFnGen(newSep);\n Array.from(statElems).forEach(changeStatFn);\n });\n }\n\n initializeCharts();\n\n const labelToUrl = (label) => {\n const parts = label.split('-');\n return `search=${parts[0]} 20${parts[1]}&commit=Search&click_through=true`;\n };\n\n // Create the Users joined chart\n if (!isUndefined($('#users_joined').val())) {\n const usersData = JSON.parse($('#users_joined').val());\n if (isObject(usersData)) {\n const chart = createChart('#yearly_users', usersData, '', (event) => {\n const segment = chart.getElementAtEvent(event)[0];\n if (!isUndefined(segment)) {\n const target = $('#users_click_target').val();\n /* eslint-disable no-underscore-dangle, no-restricted-globals */\n const label = chart.data.labels[segment._index];\n $(location).attr('href', `${target}?${labelToUrl(label)}`);\n /* eslint-enable no-underscore-dangle, no-restricted-globals */\n }\n });\n }\n }\n\n // Create the Plans created chart\n if (!isUndefined($('#plans_created').val())) {\n const plansData = JSON.parse($('#plans_created').val());\n if (isObject(plansData)) {\n const chart = createChart('#yearly_plans', plansData, '', (event) => {\n const segment = chart.getElementAtEvent(event)[0];\n if (!isUndefined(segment)) {\n const target = $('#plans_click_target').val();\n /* eslint-disable no-underscore-dangle, no-restricted-globals */\n const label = chart.data.labels[segment._index];\n $(location).attr('href', `${target}?${labelToUrl(label)}`);\n /* eslint-enable no-underscore-dangle, no-restricted-globals */\n }\n });\n }\n }\n // TODO: Most of these event listeners would not be necessary if JQuery and\n // all other JS libraries were available to the js.erb files. Reevaluate\n // this JS once we move to Rails 5 and properly configure webpacker\n let drawnChartByTemplate = null;\n const monthlyPlanTemplatesChart = document.getElementById('monthly_plans_by_template');\n // Add event listeners that draw and destroy the chart\n if (isObject(monthlyPlanTemplatesChart)) {\n monthlyPlanTemplatesChart.addEventListener('renderChart', (e) => {\n drawnChartByTemplate = drawHorizontalBar($('#monthly_plans_by_template'), e.detail);\n // Assigning the chart to a window variable here so that we can fire\n // the events from the js.erb\n window.templatePlansChart = document.getElementById('monthly_plans_by_template');\n });\n monthlyPlanTemplatesChart.addEventListener('destroyChart', () => {\n if (drawnChartByTemplate) {\n drawnChartByTemplate.destroy();\n }\n });\n }\n\n const monthlyPlanUsingTemplatesChart = document.getElementById('monthly_plans_using_template');\n // Add event listeners that draw the chart if it exists\n if (isObject(monthlyPlanUsingTemplatesChart)) {\n monthlyPlanUsingTemplatesChart.addEventListener('renderChart', (e) => {\n drawHorizontalBar($('#monthly_plans_using_template'), e.detail);\n });\n }\n\n // Create the initial Plans per template chart if the chart exists\n if (isObject(monthlyPlanTemplatesChart)) {\n const templatePlansData = JSON.parse($('#plans_by_template').val());\n const drawPer = new CustomEvent('renderChart', { detail: templatePlansData });\n document.getElementById('monthly_plans_by_template').dispatchEvent(drawPer);\n }\n // Create the initial Plans using template chart if the chart exists\n if (isObject(monthlyPlanUsingTemplatesChart)) {\n const usingTemplatePlansData = JSON.parse($('#plans_using_template').val());\n const drawUsing = new CustomEvent('renderChart', { detail: usingTemplatePlansData });\n document.getElementById('monthly_plans_using_template').dispatchEvent(drawUsing);\n }\n});\n","import { isObject, isString } from '../utils/isType';\nimport { renderNotice, renderAlert } from '../utils/notificationHelper';\nimport { scrollTo } from '../utils/scrollTo';\n\n$(() => {\n // Activate/Deactivate user account\n $('body').on('ajax:success', '.activate-user', (e) => {\n const data = e.detail[0];\n if (data.code === 1 && data.msg && data.msg !== '') {\n renderNotice(data.msg);\n } else {\n renderAlert(data.msg);\n }\n });\n $('body').on('ajax:error', '.activate-user', () => {\n renderAlert('Unexpected error');\n });\n\n let currentPrivileges = null;\n $('body').on('click', 'a[href$=\"admin_grant_permissions\"]', (e) => {\n e.preventDefault();\n const target = $(e.target);\n currentPrivileges = target.closest('td').find('.privilege-description');\n $.ajax({\n method: 'GET',\n url: target.attr('href'),\n }).done((data) => {\n $('#modal-permissions').html(data.user.html);\n if ($('.org_grant_privileges:checked').length === $('.org_grant_privileges').length) {\n $('#org_admin_privileges').prop('checked', true);\n }\n if ($('.super_grant_privileges:checked').length === $('.super_grant_privileges').length) {\n $('#super_admin_privileges').prop('checked', true);\n }\n }).fail((xhr) => {\n const error = xhr.responseJSON;\n if (isObject(error) && isString(error.msg)) {\n $('#modal-permissions').html(error.msg);\n } else {\n $('#modal-permissions').html('Unexpected error');\n }\n }).always(() => {\n // The modal is deferred until a successful response is got\n $('#modal-permissions').modal('show');\n });\n });\n // Event delegation handler after a successful response is obtained\n $('body').on('ajax:success', '.admin_update_permissions', (e) => {\n const data = e.detail[0];\n if (isObject(data)) {\n if (isString(data.msg)) {\n renderNotice(data.msg);\n scrollTo('#notification-area');\n }\n if (isString(data.current_privileges) && currentPrivileges.length > 0) {\n currentPrivileges.html(data.current_privileges);\n }\n }\n $('#modal-permissions').modal('hide');\n });\n // Event delegation handler after an error response is obtained\n $('body').on('ajax:error', '.admin_update_permissions', (e) => {\n const xhr = e.detail[2];\n if (isObject(xhr)) {\n const error = xhr.responseJSON;\n if (isObject(xhr) && isString(error.msg)) {\n renderAlert(error.msg);\n scrollTo('#notification-area');\n }\n }\n $('#modal-permissions').modal('hide');\n });\n});\n\n$(() => {\n $('body').on('click', '#org_admin_privileges', () => {\n if ($('#org_admin_privileges').prop('checked')) {\n $('.org_grant_privileges:checkbox').prop('checked', true);\n } else {\n $('.org_grant_privileges:checkbox').prop('checked', false);\n }\n });\n $('body').on('change', '.org_grant_privileges', () => {\n if ($('.org_grant_privileges:checked').length === $('.org_grant_privileges').length) {\n $('#org_admin_privileges').prop('checked', true);\n } else {\n $('#org_admin_privileges').prop('checked', false);\n }\n });\n});\n\n$(() => {\n $('body').on('click', '#super_admin_privileges', () => {\n if ($('#super_admin_privileges').prop('checked')) {\n $('.super_grant_privileges:checkbox').prop('checked', true);\n } else {\n $('.super_grant_privileges:checkbox').prop('checked', false);\n }\n });\n $('body').on('change', '.super_grant_privileges', () => {\n if ($('.super_grant_privileges:checked').length === $('.super_grant_privileges').length) {\n $('#super_admin_privileges').prop('checked', true);\n } else {\n $('#super_admin_privileges').prop('checked', false);\n }\n });\n});\n","$(() => {\n $('#select_all').click(() => {\n $('.preferences').find('input[type=\"checkbox\"]').prop('checked', true);\n });\n\n $('#deselect_all').click(() => {\n $('.preferences').find('input[type=\"checkbox\"]').prop('checked', false);\n });\n\n $('#preferences_registration_form').on('submit', (e) => {\n const target = $(e.target);\n target.find('input[type=\"checkbox\"]').each((i, el) => {\n const check = $(el);\n if (!check.prop('checked')) {\n target.append(``);\n }\n });\n });\n});\n","/*\n * This method expects an expand/collapse all link to be contained within a div with\n * the '.accordion-controls' class. The div container should have a 'data-parent' that\n * corresponds with the id of your accordion container. The links should have a\n * 'data-toggle-direction' attribute that contains either 'show' or 'hide'.\n * ------------------------------------------------------------\n *
    \n * <%= _('expand all') %>\n * <%= _('collapse all') %>\n *
    \n *\n * Your accordion should follow the Boostrap 3.x layout:\n * ------------------------------------------------------------\n *
    \n *
    \n *
    \n *

    \n * \n * Section A\n * \n *

    \n *
    \n *
    \n *
    \n * This is test section A.\n *
    \n *
    \n *
    \n *
    \n */\n$(() => {\n $('body').on('click', '.accordion-controls a', (e) => {\n e.preventDefault();\n const currentTarget = $(e.currentTarget);\n const target = $(e.target);\n const direction = target.attr('data-toggle-direction');\n const parentTargetName = currentTarget.parent().attr('data-parent');\n if (direction) {\n // Selects all .panel elements where the parent is currentTarget.attr('data-parent') and\n // after gets the immediately children whose class selector is panel-collapse\n const parentTarget = $(`#${parentTargetName}`).length ? $(`#${parentTargetName}`) : $(`.${parentTargetName}`);\n $(parentTarget).find('.panel').find('.panel-collapse').each((i, el) => {\n const panelCollapse = $(el);\n // Expands or collapses the panel according to the\n // direction passed (e.g. show --> expands, hide --> collapses)\n if (direction === 'show') {\n if (!panelCollapse.find('.panel-body').attr('data-loaded') || !panelCollapse.hasClass('in')) {\n panelCollapse.prev()[0].click();\n }\n } else {\n panelCollapse.collapse(direction);\n }\n // Sets icon at panel-title accordingly\n panelCollapse.prev().find('i.fa')\n .removeClass('fa-plus fa-minus').addClass(direction === 'show' ? 'fa-minus' : 'fa-plus');\n });\n }\n });\n});\n","import 'jquery-ui/autocomplete';\nimport getConstant from './constants';\nimport { isObject, isString, isArray } from './isType';\n\n// Updates the ARIA help text that lets the user know how many suggestions\nconst updateAriaHelper = (autocomplete, suggestionCount) => {\n if (isObject(autocomplete)) {\n const helper = autocomplete.siblings('.autocomplete-help');\n\n if (isObject(helper)) {\n const text = getConstant('AUTOCOMPLETE_ARIA_HELPER');\n helper.html(text.replace('%{n}', suggestionCount));\n } else {\n helper.html(getConstant('AUTOCOMPLETE_ARIA_HELPER_EMPTY'));\n }\n }\n};\n\n// Places the results into the crosswalk, updates the Aria helper and then\n// extracts the 'name' from each result and returns it for consumption by\n// the JQuery UI autocomplete widget\nconst processAjaxResults = (autocomplete, crosswalk, results) => {\n let out = [];\n\n if (isObject(autocomplete) && isObject(crosswalk) && isArray(results)) {\n crosswalk.attr('value', JSON.stringify(results));\n updateAriaHelper(autocomplete, results.length);\n out = results.map((item) => item.name);\n } else {\n crosswalk.attr('value', JSON.stringify([]));\n updateAriaHelper(autocomplete, 0);\n }\n return out;\n};\n\n// Extract the AJAX query arguments from the autocomplete\nconst queryArgs = (autocomplete, searchTerm) => {\n const namespace = autocomplete.attr('data-namespace');\n const attribute = autocomplete.attr('data-attribute');\n\n return `{\"${namespace}\":{\"${attribute}\":\"${searchTerm}\"}}`;\n};\n\n// Displays/hides a 'Loading ...' message while waiting for an AJAX response\nconst toggleLoadingMessage = (context) => {\n const selections = $(context);\n const msg = getConstant('AUTOCOMPLETE_SEARCHING');\n const loadingMessage = `
  • ${msg}
  • `;\n\n if (selections.length > 0) {\n const message = selections.find('.loading-message');\n const menu = selections.find('ul.ui-menu');\n\n menu.show();\n\n if (message.length > 0) {\n message.remove();\n } else {\n menu.html(loadingMessage);\n }\n }\n};\n\n// Makes an AJAX request to the specified target\nconst search = (autocomplete, term, crosswalk, callback) => {\n if (isObject(autocomplete) && isObject(crosswalk) && isString(term)) {\n const url = autocomplete.attr('data-url');\n const method = autocomplete.attr('data-method');\n const data = JSON.parse(queryArgs(autocomplete, term));\n\n if (isString(url) && term.length > 2) {\n toggleLoadingMessage(autocomplete.siblings('div[id$=\"_ui-front\"]'));\n\n $.ajax({\n url, method, data,\n }).done((results) => {\n callback(processAjaxResults(autocomplete, crosswalk, results));\n }).fail(() => {\n callback(processAjaxResults(autocomplete, crosswalk, []));\n });\n }\n }\n};\n\nconst toggleWarning = (autocomplete, displayIt) => {\n const warning = autocomplete.siblings('.autocomplete-warning');\n\n if (warning.length > 0) {\n if (displayIt) {\n warning.removeClass('hide').show();\n } else {\n warning.addClass('hide').hide();\n }\n }\n};\n\n// Looks up the value in the crosswalk\nconst findInCrosswalk = (selection, crosswalk) => {\n // Default to the name only\n let out = JSON.stringify({ name: selection });\n // If the user selected an item and the crosswalk exists then try to\n // find it in the crosswalk.\n if (selection.length > 0 && crosswalk.length > 0) {\n const json = JSON.parse(crosswalk.val());\n const found = json.find((item) => item != null && item.name === selection);\n // If the crosswalk was empty then out becomes undefined\n out = (found === undefined ? out : JSON.stringify(found));\n }\n return out;\n};\n\n// Returns false if the selection is the default `{\"name\":\"[value]\"}`\nconst warnableSelection = (selection) => {\n if (selection.length > 0) {\n const json = Object.keys(JSON.parse(selection));\n return (json.length <= 1 && json[0] === 'name');\n }\n return false;\n};\n\n// Updates the hidden id field with the contents from the crosswalk for the\n// selected name\nconst handleSelection = (autocomplete, hidden, crosswalk, selection) => {\n const out = findInCrosswalk(selection, crosswalk);\n\n toggleWarning(autocomplete, warnableSelection(out));\n\n // Set the ID and trigger the onChange event for any view specific\n // JS to trigger events\n hidden.val(out).trigger('change');\n return true;\n};\n\n// Clear out the Sources and Crosswalk hidden fields for the given autocomplete\nconst scrubCrosswalkAndSource = (context) => {\n if (isObject(context) && context.length > 0) {\n const id = context.attr('id');\n const crosswalk = context.siblings(`#${id.replace('_name', '_crosswalk')}`);\n if (isObject(crosswalk) && crosswalk.length > 0) {\n crosswalk.val('[]');\n }\n\n const sources = context.siblings(`#${id.replace('_name', '_sources')}`);\n if (isObject(sources) && sources.length > 0) {\n sources.val('[]');\n }\n }\n};\n\n// Removes all of the Sources and Crosswalk content before form submission\nexport const scrubOrgSelectionParamsOnSubmit = (formSelector) => {\n const form = $(formSelector);\n\n if (isObject(form) && form.length > 0) {\n form.on('submit', () => {\n form.find('.autocomplete').each((_idx, el) => {\n scrubCrosswalkAndSource($(el));\n });\n });\n }\n};\n\nexport const initAutocomplete = (selector) => {\n if (isString(selector)) {\n const context = $(selector);\n\n if (isObject(context) && context.length > 0) {\n const id = context.attr('id');\n const front = context.siblings('div[id$=\"_ui-front\"]');\n const crosswalk = context.siblings(`#${id.replace('_name', '_crosswalk')}`);\n const hidden = context.siblings('.autocomplete-result');\n\n toggleWarning(context, false);\n\n // If the crosswalk is empty, make sure it is valid JSON\n if (!crosswalk.val()) {\n crosswalk.val(JSON.stringify([]));\n }\n\n // If a data-url was defined then this is an AJAX autocomplete\n if (context.attr('data-url') && isObject(crosswalk)) {\n // Setup the autocomplete and set it's source to the appropriate\n context.autocomplete({\n source: (req, resp) => search(context, req.term, crosswalk, resp),\n select: (e, ui) => handleSelection(context, hidden, crosswalk, ui.item.label),\n minLength: 3,\n delay: 600,\n appendTo: front,\n });\n } else {\n const source = context.siblings(`#${id.replace('_name', '_sources')}`);\n if (source) {\n // Setup the autocomplete and set it's source to the appropriate\n context.autocomplete({\n source: JSON.parse(source.val()),\n select: (e, ui) => handleSelection(context, hidden, crosswalk, ui.item.label),\n minLength: 1,\n delay: 300,\n appendTo: front,\n });\n }\n }\n\n // Handle manual entry (instead of autocomplete selection)\n context.on('keyup', (e) => {\n const code = (e.keyCode || e.which);\n // Only pay attention to key presses that would actually\n // change the contents of the field\n if ((code >= 48 && code <= 111) || (code >= 144 && code <= 222)\n || code === 8 || code === 9) {\n handleSelection(context, hidden, crosswalk, context.val());\n }\n });\n\n // Set the hidden id field to the value in the crosswalk\n // or the default `{\"name\":\"[value in textbox]\"}`\n hidden.val(findInCrosswalk(context.val(), crosswalk));\n }\n }\n};\n","import Chart from 'chart.js';\n\n// Set Aspect Rate (width of X-axis/height of Y-axis) based on\n// choice of selectedLastDayOfMonth in Time picker string value. Note aspect\nexport const getAspectRatio = (diffInMonths) => {\n let ratio;\n try {\n switch (diffInMonths) {\n case 0:\n case 1:\n ratio = 5;\n break;\n case 2:\n case 3:\n ratio = 3.5;\n break;\n case 4:\n case 5:\n case 6:\n ratio = 2.5;\n break;\n case 7:\n case 8:\n case 9:\n case 10:\n ratio = 2;\n break;\n case 11:\n case 12:\n ratio = 1.5;\n break;\n default:\n ratio = 0.9;\n }\n } catch (e) {\n ratio = 0.9;\n }\n return ratio;\n};\n\n// Register a plugin for displaying a message for no data\nexport const initializeCharts = () => {\n Chart.plugins.register({\n afterDraw: (chart) => {\n if (chart.data.datasets.length === 0) {\n const { ctx, width, height } = {\n ctx: chart.chart.ctx,\n width: chart.chart.width,\n height: chart.chart.height,\n };\n chart.clear();\n ctx.save();\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.font = '25px bold';\n ctx.fillText('No data to display for selected time period', width / 2, height / 2);\n ctx.restore();\n }\n },\n });\n};\n\nexport const createChart = (selector, data, appendTolabel = '', onClickHandler = null) => {\n const chart = new Chart($(selector), { // eslint-disable-line no-new\n type: 'bar',\n data: {\n labels: Object.keys(data),\n datasets: [{\n data: Object.keys(data).map((k) => data[k]),\n backgroundColor: '#4F5253',\n // TODO parameterised according to roadmap main colour instance\n }],\n },\n options: {\n legend: {\n display: false,\n },\n tooltips: {\n callbacks: {\n label: (tooltipItem) => `${tooltipItem.yLabel} ${appendTolabel}`,\n },\n },\n scales: {\n yAxes: [{\n ticks: { min: 0, suggestedMax: 50 },\n }],\n },\n onClick: onClickHandler,\n },\n });\n return chart;\n};\n\nexport const drawHorizontalBar = (canvasSelector, data) => {\n const aspectRatio = getAspectRatio(data.labels.length);\n const chart = new Chart(canvasSelector, { // eslint-disable-line no-new\n type: 'horizontalBar',\n data,\n options: {\n responsive: true,\n maintainAspectRatio: true,\n aspectRatio,\n scales: {\n xAxes: [{\n ticks: { beginAtZero: true, stepSize: 10 },\n stacked: true,\n }],\n yAxes: [{\n stacked: true,\n }],\n },\n },\n });\n return chart;\n};\n","// Logic to hide/dsiplay a set of fields based on whether or not a related checkbox is clicked\n//\n// Expecting the checkbox and the corresponding fields to be wrapped in\n// a element\n//\n// For example see: app/views/plans/_edit_details.html.erb\n// app/javascript/src/plans/editDetails.js\n//\nimport { Tinymce } from './tinymce.js.erb';\n\n// Expecting `context` to be the field that triggers the hide/show of the corresponding fields\nexport default function toggleConditionalFields(context, showThem) {\n const container = $(context).closest('conditional');\n\n if (container.length > 0) {\n if (showThem === true) {\n container.find('.toggleable-field').show();\n\n // Resize any TinyMCE editors\n container.find('.toggleable-field').find('.tinymce').each((_idx, el) => {\n const tinymceEditor = Tinymce.findEditorById($(el).attr('id'));\n if (tinymceEditor) {\n $(tinymceEditor.iframeElement).height(tinymceEditor.settings.autoresize_min_height);\n }\n });\n } else {\n // Clear the contents of any textarea select boxes or input fields\n container.find('.toggleable-field').find('input, textarea, select').val('').change();\n\n // TODO: clear check boxes and radio buttons as needed\n\n // Clear the contents of any TinyMCE editors\n container.find('.toggleable-field').find('.tinymce').each((_idx, el) => {\n const tinymceEditor = Tinymce.findEditorById($(el).attr('id'));\n if (tinymceEditor) {\n tinymceEditor.setContent('');\n }\n });\n\n container.find('.toggleable-field').hide();\n }\n }\n}\n","import { isObject, isString } from './isType';\n\nlet constants = {};\nexport default (key) => constants[key];\n$(() => {\n // js-constants is defined in views/layouts/application.html.erb\n const target = $('#js-constants');\n if (isObject(target) && isString(target.val())) {\n constants = JSON.parse(target.val());\n }\n});\n","import 'jquery-ui/datepicker';\n\n/*\n * Date picker polyfill:\n * Wire up the JQuery UI DatePicker if the browser does not support the HTML5 date\n */\nexport default () => {\n if ($('[type=\"date\"]').prop('type') !== 'date') {\n $('[type=\"date\"]').datepicker({\n dateFormat: 'yy-mm-dd',\n constrainInput: true,\n navigationAsDateFormat: true,\n goToCurrent: true,\n });\n }\n};\n","import { isFunction, isNumber } from './isType';\n\nexport default function debounce(func, wait) {\n if (isFunction(func)) {\n let timeoutID = null;\n const delay = isNumber(wait) ? wait : 1000;\n const closureDebounce = (...args) => {\n const delayed = () => {\n timeoutID = null;\n func.apply(this, args);\n };\n clearTimeout(timeoutID);\n timeoutID = setTimeout(delayed, delay);\n };\n closureDebounce.cancel = () => {\n if (timeoutID) {\n clearTimeout(timeoutID);\n return true;\n }\n return false;\n };\n return closureDebounce;\n }\n return null;\n}\n","import getConstant from './constants';\n\n// Globally ensure that any URLs that are directing the user offsite open in a new tab/window\n$(() => {\n $('body').click('a[href^=\"http\"]', (e) => {\n const link = $(e.target);\n const protocol = new RegExp('^https?');\n const regex = new RegExp(`^https?://${getConstant('HOST')}`);\n const exceptions = {\n ids: ['connect-orcid-button', 'view-all-templates'],\n };\n // Internal links are typically just the path, but also check for other domains\n if (\n !link.attr('target')\n && protocol.test(link.attr('href'))\n && !regex.test(link.attr('href'))\n && !(exceptions.ids.indexOf(link.attr('id')) >= 0)\n ) {\n link.attr('target', '_blank');\n link.addClass('has-new-window-popup-info');\n // Add span as child of link.\n link.append($(`${getConstant('OPENS_IN_A_NEW_WINDOW_TEXT')}`));\n }\n });\n\n $('a[href^=\"http\"]').each((index, value) => {\n const link = $(value);\n const protocol = new RegExp('^https?');\n const regex = new RegExp(`^https?://${getConstant('HOST')}`);\n const exceptions = {\n ids: ['connect-orcid-button', 'view-all-templates'],\n };\n // Internal links are typically just the path, but also check for other domains\n if (\n !link.attr('target')\n && protocol.test(link.attr('href'))\n && !regex.test(link.attr('href'))\n && !(exceptions.ids.indexOf(link.attr('id')) >= 0)\n ) {\n link.attr('target', '_blank');\n link.addClass('has-new-window-popup-info');\n // Add span as child of link.\n link.append($(`${getConstant('OPENS_IN_A_NEW_WINDOW_TEXT')}`));\n }\n });\n});\n","/*\n Checks whether or the value passed is type Array.\n @param value to check\n @return true or false\n*/\nexport const isArray = (value) => Array.isArray(value);\n/*\n Checks whether or the value passed is type boolean.\n Note the use of new is discouraged, e.g. new Boolean(true) and might return false in some cases\n @param value to check\n @return true or false\n*/\nexport const isBoolean = (value) => typeof value === 'boolean';\n/*\n Checks whether or the value passed is type Date.\n @param value to check\n @return true or false\n*/\nexport const isDate = (value) => Object.prototype.toString.call(value) === '[object Date]';\n/*\n Checks whether or the value passed is type function.\n Note the use of new is discouraged, e.g. new Function(...) and might return false in some cases\n @param value to check\n @return true or false\n*/\nexport const isFunction = (value) => typeof value === 'function';\n/*\n Checks whether or the value passed is type number.\n Note the use of new is discouraged, e.g. new Number(1) and might return false in some cases.\n This method will return true for NaN and Infinity too.\n @param value to check\n @return true or false\n*/\nexport const isNumber = (value) => typeof value === 'number';\n/*\n Checks whether or the value passed is type null.\n @param value to check\n @return true or false\n*/\nexport const isNull = (value) => value === null;\n/*\n Checks whether or the value passed is type object.\n This will return true for any kind of object (Array, Date, RegExp ...) so consider\n using more accurate method defined here.\n @param value to check\n @return true or false\n*/\nexport const isObject = (value) => value !== null && typeof value === 'object';\n/*\n Checks whether or the value passed is type RegExp\n @param value to check\n @return true or false\n*/\nexport const isRegExp = (value) => Object.prototype.toString.call(value) === '[object RegExp]';\n/*\n Checks whether or the value passed is type string.\n Note the use of new is discouraged, e.g. new String('aaa') and might return false in some cases\n @param value to check\n @return true or false\n*/\nexport const isString = (value) => typeof value === 'string';\n/*\n Checks whether or the value passed is type undefined.\n @param value to check\n @return true or false\n*/\nexport const isUndefined = (value) => value === undefined;\n","import { isObject, isString, isNumber } from './isType';\nimport getConstant from './constants';\n/*\n Validates whether or not the value passed matches to a valid email\n @param value String to search for a match\n @return true or false\n*/\nexport const isValidEmail = (value) => {\n if (isString(value)) {\n return /[^@\\s]+@(?:[-a-zA-Z0-9]+\\.)+[a-zA-Z]{2,}$/.test(value);\n }\n return false;\n};\n\n/*\n Validates whether or not the value passed matches to a valid url\n @param value String to search for a match\n @return true or false\n*/\nexport const isValidUrl = (value) => {\n if (isString(value)) {\n return /https?:\\/\\/[-a-zA-Z0-9@:%_+.~#?&=]{2,256}\\.[a-z]{2,4}\\b(\\/[-a-zA-Z0-9@:%_+.~#?&=]*)?/.test(value);\n }\n return false;\n};\n\n/*\n Validates whether or not the value passed is a valid number.\n @param value Number to validate\n*/\nexport const isValidNumber = (value) => {\n if (isString(value)\n && value.trim().length > 0) { // Only if is non-empty string value we try to convert to Number\n // since Number([]), Number(new Date()), Number(null) are converted to zero\n return !Number.isNaN(Number(value));\n }\n return isNumber(value);\n};\n\n/*\n Validates whether or not the value passed falls between the min and max length\n string specified for a password.\n @param value String to verify its length\n @return true or false\n*/\nexport const isValidPassword = (value) => {\n const minLength = getConstant('PASSWORD_MIN_LENGTH') || 8;\n const maxLength = getConstant('PASSWORD_MAX_LENGTH') || 128;\n if (isString(value)) {\n const trimmed = value.trim();\n return trimmed.length >= minLength && trimmed.length <= maxLength;\n }\n return false;\n};\n\n/*\n Validates whether or not the value passed is a non-empty String type.\n @param value String to verify its length\n @return true or false\n*/\nexport const isValidText = (value) => {\n if (isString(value)) {\n return value.trim().length > 0;\n }\n return false;\n};\n\nexport const isValidCheckbox = (el) => {\n if (isObject(el)) {\n return el.is(':checked');\n }\n return false;\n};\n\nexport const isValidMultiCheckbox = (el) => {\n if (isObject(el) && isObject(el.closest('fieldset'))) {\n return el.closest('fieldset').find('input:checked').length > 0;\n }\n return false;\n};\n","import 'number-to-text/converters/en-us';\nimport { convertToText } from 'number-to-text/index';\nimport { isFunction } from './isType';\n\nconst getLinks = (elem) => $(elem).find('.link').map((i, el) => {\n const link = $(el);\n // toggleValidations(link);\n const linkVal = link.find('input[name=\"link_link\"]').val();\n const textVal = link.find('input[name=\"link_text\"]').val();\n if (linkVal || textVal) {\n return { link: linkVal, text: textVal };\n }\n // If linkVal and textVal are empty trigger delete handler\n link.find('.delete').first().trigger('click');\n return undefined;\n}).get();\n\n/*\n * Iterates through any links class found and for each one found,\n * executes the function cb by passing two parameters: the data-context value\n * and value param being an Array of link objects (e.g. [{ link: String, text: String }, ...])\n * that represent the values for the input texts introduced.\n*/\nexport const eachLinks = (cb) => {\n if (isFunction(cb)) {\n $('.links').each((i, el) => {\n cb($(el).attr('data-context'), getLinks(el));\n });\n }\n return eachLinks;\n};\neachLinks.done = (cb) => {\n if (isFunction(cb)) {\n cb();\n }\n};\n\n$(() => {\n const regExp = /([^\\d]*)(\\d)+/;\n const replacer = (match, p1, p2) => `${p1}${(p2 * 1) + 1}`;\n const replacerFor = (i, el) => $(el).attr('for', $(el).attr('for').replace(regExp, replacer));\n const replacerId = (i, el) => $(el).attr('id', $(el).attr('id').replace(regExp, replacer));\n const changeIds = (jqueryElem) => {\n jqueryElem.find('label').each(replacerFor);\n jqueryElem.find('input[type=\"text\"]').each(replacerId);\n };\n const clearVals = (jqueryElem) => {\n jqueryElem.find('input[type=\"text\"]').each((i, el) => {\n $(el).val('');\n });\n };\n const linksLength = (jqueryElem) => jqueryElem.closest('.links').find('.link').length;\n const maxNumberLinks = (jqueryElem) => jqueryElem.closest('.links').attr('data-max-number-links') * 1;\n\n $('.links').on('click', '.new', (e) => {\n e.preventDefault();\n const target = $(e.target);\n const max = maxNumberLinks(target);\n const nbrLinks = linksLength(target);\n if (nbrLinks < max) {\n const lastLink = target.closest('.links').find('.link').last();\n const clonedLink = lastLink.clone();\n changeIds(clonedLink);\n clearVals(clonedLink);\n lastLink.after(clonedLink);\n // Hide the add link if we have now reached the limit\n if (nbrLinks + 1 >= max) {\n $(target).closest('.links').find('a.new').addClass('hide');\n }\n }\n });\n\n $('.links').on('click', '.delete', (e) => {\n e.preventDefault();\n const target = $(e.target);\n const max = maxNumberLinks(target);\n const nbrLinks = linksLength(target);\n if (nbrLinks > 1) {\n // If this brought us below the max nbr of links then show the add new link\n if ((nbrLinks - 1) < max) {\n target.closest('.links').find('a.new').removeClass('hide');\n }\n target.closest('.link').remove();\n } else {\n const link = target.closest('.link');\n clearVals(link);\n }\n });\n $('.links').find('.max-number-links').each((i, el) => {\n const target = $(el);\n const max = target.closest('.links').attr('data-max-number-links');\n target.text(convertToText(max).toLowerCase());\n });\n});\n\nexport { eachLinks as default };\n","$(() => {\n // Add the selected item to the selections section\n $('body').on('click', 'a.modal-search-result-selector', (e) => {\n e.preventDefault();\n const link = $(e.target);\n\n if (link.length > 0) {\n const selectedBlock = $(e.target).closest('.modal-search-result');\n const resultsBlock = $(e.target).closest('.modal-search-results');\n\n if (resultsBlock.length > 0 && selectedBlock.length > 0) {\n const selectionsBlockId = resultsBlock.attr('id').replace('-results', '-selections');\n\n if (selectionsBlockId !== undefined) {\n const selectionsBlock = $(`#${selectionsBlockId}`);\n\n if (selectionsBlock.length > 0) {\n const clone = selectedBlock.clone();\n clone.find('.modal-search-result-selector').addClass('hidden');\n clone.find('.modal-search-result-unselector').removeClass('hidden');\n clone.find('.tags').remove();\n selectionsBlock.append(clone);\n selectedBlock.remove();\n }\n }\n }\n }\n });\n\n // Remove the selected item\n $('body').on('click', 'a.modal-search-result-unselector', (e) => {\n e.preventDefault();\n const selection = $(e.target).closest('.modal-search-result');\n\n if (selection.length > 0) {\n selection.remove();\n }\n });\n});\n","import { isString, isObject } from './isType';\n\n/*\n Helpers that will display the specified message in in the notification\n area at the top of the page\n*/\n\nexport function hideNotifications() {\n $('#notification-area')\n .addClass('hide')\n .removeClass('notification-area--floating');\n}\n\nfunction renderMessage(options = {}) {\n const notificationArea = $('#notification-area');\n\n if (isString(options.message) && isObject(notificationArea)) {\n notificationArea\n .removeClass('alert-info', 'alert-warning')\n .addClass(options.className);\n\n if (options.floating) {\n notificationArea.addClass('notification-area--floating');\n }\n\n notificationArea.find('i, span').remove();\n notificationArea.append(`\n \n ${options.message}\n `);\n\n notificationArea.removeClass('hide');\n\n if (options.autoDismiss) {\n setTimeout(() => { hideNotifications(); }, 5000);\n }\n }\n}\n\nexport function renderNotice(msg, options = {}) {\n renderMessage({\n message: msg,\n icon: 'check-circle',\n className: 'alert-info',\n floating: options.floating === true,\n autoDismiss: options.autoDismiss === true,\n });\n}\n\nexport function renderAlert(msg, options = {}) {\n renderMessage({\n message: msg,\n icon: 'times-circle',\n className: 'alert-warning',\n floating: options.floating === true,\n autoDismiss: options.autoDismiss === true,\n });\n}\n","$(() => {\n // This bit of code currently only closes dropdown\n // menus in a table when the focus is no longer in the containing cell.\n\n // List of focusable Elements on page\n const focusables = $('td, .dropdown, .dropdown-toggle, a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex], [contenteditable]');\n\n focusables.each((i, el) => {\n const focusable = $(el); // JQuery object\n // On entrying a new focusable element we respond to event\n focusable.focusin(() => {\n $('td').children('.dropdown.open').each((j, elj) => {\n const td = $(elj).parent(); // DOM Element\n const dropdownBtn = $(elj).find('.dropdown-toggle'); // JQuery object\n // Close dropdown menu if the focus is not the table cell containing the dropdown\n if (!($.contains(td.get(0), focusable.get(0)) || focusable.is(td))) {\n dropdownBtn.dropdown('toggle');\n }\n });\n });\n });\n});\n","export const paginableSelector = '.paginable';\n\n$(() => {\n const onAjaxSuccessHandler = (e) => {\n const data = e.detail[0];\n $(e.target).closest(paginableSelector).replaceWith(data.html);\n };\n // Event listener for Ajax success event captured in response to a paginable link clicked or\n // search form submitted. Note the presence of a selector for on (e.g. a[data-remote=\"true\"])\n // so that descendant elements from .paginable-results that are added in future are also\n // automatically handled.\n $('body').on('ajax:success',\n 'form.paginable-action[data-remote=\"true\"], a.paginable-action[data-remote=\"true\"]',\n onAjaxSuccessHandler);\n});\n\nexport { paginableSelector as default };\n","$(() => {\n $('body').on('click', '.heading-button', (e) => {\n $(e.currentTarget)\n .find('i.fa-plus, i.fa-minus')\n .toggleClass('fa-plus')\n .toggleClass('fa-minus');\n });\n});\n","import getConstant from './constants';\nimport { isObject, isString, isArray } from './isType';\n\nconst getHelpBlock = (id) => {\n if (isString(id)) {\n return `\n ${getConstant('VALIDATION_MESSAGE_PASSWORDS_MATCH')}`;\n }\n return '';\n};\n\nconst togglePassword = (password) => {\n $(password).attr('type', ($(password).attr('type') === 'password' ? 'text' : 'password'));\n};\n\nconst isValid = ((pwd, confirmation) => pwd === confirmation\n);\n\nconst valid = (el, block) => {\n $(el).attr('aria-invalid', false);\n $(el).parent().removeClass('has-error');\n $(block).hide();\n};\nconst invalid = (el, block) => {\n $(el).attr('aria-invalid', true);\n $(el).parent().addClass('has-error');\n $(block).show();\n};\n\nexport const addMatchingPasswordValidator = (options) => {\n if (isObject(options) && isString(options.selector)) {\n const id = `${$(options.selector).attr('id')}_password_matcher`;\n\n const pwd = $(options.selector).find('#user_password');\n const cnf = $(options.selector).find('#user_password_confirmation');\n const sbmt = $(options.selector).find('[type=\"submit\"]');\n\n if (isObject(pwd) && isObject(cnf) && isObject(sbmt)) {\n if (isValid($(pwd).val(), $(cnf).val())) {\n $(cnf).parent().append(getHelpBlock(id));\n $(cnf).attr('aria-describedby', id);\n\n $(sbmt).click((e) => {\n if (cnf.val() !== pwd.val()) {\n e.preventDefault();\n invalid(cnf, `#${id}`);\n } else {\n valid(cnf, `#${id}`);\n }\n });\n }\n }\n }\n};\n\n/*\n * This function is expecting your HTML to be in the following format. Only one toggle\n * is needed per form. It will toggle all password fields within the containing form:\n * \n */\nexport const togglisePasswords = (options) => {\n if (isObject(options) && isString(options.selector)) {\n const toggle = $(`${options.selector} .passwords_toggle`);\n const pwds = $(`${options.selector} input[type=\"password\"]`);\n\n if (pwds && toggle) {\n toggle.on('change', () => {\n if (isArray(pwds)) {\n pwds.forEach((pwd) => {\n togglePassword(pwd);\n });\n } else {\n togglePassword(pwds);\n }\n });\n }\n }\n};\n","import 'bootstrap-sass/popover';\n\n$(() => {\n $('[data-toggle=\"popover\"]').popover({\n animated: 'fade',\n placement: 'right',\n });\n});\n","import getConstant from './constants';\nimport { isObject } from './isType';\n\nconst asterisk = `* `;\n\nexport const addAsterisk = (el) => {\n const target = $(el);\n if (isObject(target)) {\n // If the element is part of a Fieldset then place the asterisk before the
    \n if (target.closest('fieldset').length > 0 && target.closest('fieldset').find('legend').length > 0) {\n const legend = target.closest('fieldset').find('legend');\n legend.html(`${asterisk} ${legend.html()}`);\n\n // If the element is a radio button or checkbox place the asterisk after the label\n } else if (target.is('[input=\"checkbox\"]') || target.is('[input=\"radio\"]')) {\n target.after(asterisk);\n\n // Else place the asterisk before the corresponding label\n } else {\n const label = target.closest('.form-group').find('label');\n if (isObject(label)) {\n $(label[0]).before(asterisk);\n }\n }\n }\n};\n\nexport const addAsterisks = (el) => {\n $(el).find('[aria-required=true]').each((idx, jqObject) => {\n addAsterisk(jqObject);\n });\n};\n\n$(() => {\n addAsterisks('body');\n});\n","import { isString, isNumber } from './isType';\n\n/*\n Scrolls browser window to the selector specified\n @param selector - String CSS selector\n @param duration (optional) - Number or String that determines how long the animation will run\n*/\nexport const scrollTo = (selector, duration) => {\n if (isString(selector)) {\n $('html, body').animate({\n scrollTop: $(selector).offset().top,\n }, isNumber(duration) || isString(duration) ? duration : 500);\n }\n};\n\nexport { scrollTo as default };\n","// update details in section progress panel\nexport const updateSectionProgress = (id, numSecAnswers, numSecQuestions) => {\n const progressDiv = $(`#section-panel-${id}`).find('.section-status');\n progressDiv.html(`(${numSecAnswers} / ${numSecQuestions})`);\n const heading = progressDiv.closest('.panel-heading');\n if (numSecQuestions === 0) { // disable section if empty\n if (heading.parent().attr('aria-expanded') === 'true') {\n heading.parent().trigger('click');\n }\n heading.addClass('empty-section');\n heading.closest('.panel').find(`#collapse-${id}`).hide();\n heading.closest('.panel').find('i.fa-plus, i.fa-minus').removeClass('fa-plus').removeClass('fa-minus');\n } else if (heading.hasClass('empty-section')) { // enable section if questions re-added\n heading.removeClass('empty-section');\n heading.closest('.panel').find('i[aria-hidden=\"true\"]').addClass('fa-plus');\n heading.closest('.panel').find(`#collapse-${id}`).css('display', '');\n }\n};\n\n// given a question id find the containing div\n// used inconditional questions\nexport const getQuestionDiv = (id) => $(`#answer-form-${id}`).closest('.question-body');\n","// Will display a spinner at the start of any UJS/Ajax call and then hide it after the\n// controller responds.\nconst toggleSpinner = (visible) => {\n const spinnerBlock = $('.spinner-border');\n\n if (spinnerBlock.length > 0) {\n if (visible) {\n spinnerBlock.removeClass('hidden');\n } else {\n spinnerBlock.addClass('hidden');\n }\n }\n};\n\n$(() => {\n $('body').on('ajax:beforeSend', () => {\n toggleSpinner(true);\n });\n\n $('body').on('ajax:complete', () => {\n toggleSpinner(false);\n });\n\n $('body').on('ajax:error', () => {\n toggleSpinner(false);\n });\n\n $('body').on('ajax:stopped', () => {\n toggleSpinner(false);\n });\n\n $('body').on('ajax:success', () => {\n toggleSpinner(false);\n });\n\n toggleSpinner(false);\n});\n\nexport default (visible) => toggleSpinner(visible);\n","/* eslint-env browser */ // This allows us to reference 'window' below\n\n$(() => {\n // If the URL contains a tab reference then show that tab\n const loc = window.location.hash;\n if (loc) {\n $(`ul.nav a[href=\"${loc}\"]`).tab('show');\n }\n $('ul.nav a[data-toggle=\"tab\"]').click((e) => {\n const target = $(e.target);\n $(target).tab('show');\n // Commented out because was causing screen to jump\n // window.location.hash = $(target).attr('href');\n });\n});\n","import getConstant from './constants';\n\n// Dynamically register all of the available locales if they have a timeago file\n\n\n \n \n \n import en_GB from '../locale/en_GB/timeago';\n \n\n\nconst TimeagoFactory = (() => {\n // Register all of the locales with Timeago\n \n timeago.register('en_GB', en_GB);\n \n\n const defaultLocale = 'en_GB'\n\n const convertTime = (currentLocale, el) => {\n return timeago.format($(el).attr('datetime'), `${currentLocale}`);\n };\n\n return {\n render: (el) => {\n const currentLocale = getConstant('CURRENT_LOCALE') || defaultLocale;\n\n if (el.length > 1) {\n // If we were passed an array of JQuery elements then handle each one\n $(el).each((idx, e) => {\n $(e).text(convertTime(currentLocale, e));\n });\n } else {\n $(el).text(convertTime(currentLocale, el));\n }\n },\n };\n})();\n\nexport default TimeagoFactory;\n","// Import TinyMCE\nimport tinymce from 'tinymce/tinymce';\n// Import TinyMCE theme\nimport 'tinymce/themes/modern/theme';\n// Plugins\nimport 'tinymce/plugins/table';\nimport 'tinymce/plugins/lists';\nimport 'tinymce/plugins/autoresize';\nimport 'tinymce/plugins/link';\nimport 'tinymce/plugins/paste';\nimport 'tinymce/plugins/advlist';\n\n// Other dependencies\nimport { isObject, isString } from './isType';\n\n// Pull in the rails helper functions\n\n\n// // Configuration extracted from\n// // https://www.tinymce.com/docs/advanced/usage-with-module-loaders/\nexport const defaultOptions = {\n selector: '.tinymce',\n statusbar: true,\n menubar: false,\n toolbar: 'bold italic | bullist numlist | link | table',\n plugins: 'table autoresize link paste advlist lists',\n browser_spellcheck: true,\n advlist_bullet_styles: 'circle,disc,square', // Only disc bullets display on htmltoword\n target_list: false,\n elementpath: false,\n resize: true,\n autoresize_min_height: 230,\n autoresize_bottom_margin: 10,\n branding: false,\n extended_valid_elements: 'iframe[tooltip] , a[href|target=_blank]',\n paste_auto_cleanup_on_paste: true,\n paste_remove_styles: true,\n paste_retain_style_properties: 'none',\n paste_convert_middot_lists: true,\n paste_remove_styles_if_webkit: true,\n paste_remove_spans: true,\n paste_strip_class_attributes: 'all',\n table_default_attributes: {\n border: 1,\n },\n // editorManager.baseURL is not resolved properly for IE since document.currentScript\n // is not supported, see issue https://github.com/tinymce/tinymce/issues/358\n skin_url: '/tinymce/skins/lightgray',\n content_css: ['/tinymce/tinymce.css'],\n};\n/*\n This function is invoked anytime a new editor is initialised (e.g. Tinymce.init())\n and shrinks a tinymce editor to the minimum height specified at autoresize_min_height\n editor's settings. Since there are cases that tinymce editor is loaded in the DOM\n but has display:none style, the iframe associated gets the height of the screen's device\n and using this function there is no need to wait until the tinymce gains focus to be autoresized.\n*/\nconst resizeEditors = (editors) => {\n editors.forEach((editor) => {\n $(editor.iframeElement).height(editor.settings.autoresize_min_height);\n });\n};\n\n/*\n This function is invoked after the Tinymce widget is initialized. It moves the\n connection with the label from the hidden field (that the Tinymce writes to\n behind the scenes) to the Tinymce iframe so that screen readers read the correct\n label when the tinymce iframe receives focus.\n */\nconst attachLabelToIframe = (tinymceContext, hiddenFieldSelector) => {\n const iframe = $(tinymceContext).siblings('.mce-container').find('iframe');\n const hiddenField = $(hiddenFieldSelector);\n\n if (isObject(iframe) && isObject(hiddenField)) {\n const id = hiddenField.attr('id');\n const lbl = iframe.closest('form').find(`label[for=\"${id}\"]`);\n if (isObject(lbl)) {\n // Connect the label to the iframe\n lbl.attr('for', iframe.attr('id'));\n }\n }\n};\n\nexport const Tinymce = {\n /*\n Initialises a tinymce editor given the object passed. If a non-valid object is passed,\n the defaultOptions object is used instead\n @param options - An object with tinyMCE properties\n */\n init(options = {}) {\n if (isObject(options)) {\n tinymce.init($.extend(true, defaultOptions, options)).then(resizeEditors);\n } else {\n tinymce.init(defaultOptions).then(resizeEditors);\n }\n\n // Connect the label to the Tinymce iframe\n $(options.selector).each((idx, el) => {\n attachLabelToIframe(el, options.selector);\n });\n },\n /*\n Finds any tinyMCE editor whose target element/textarea has the className passed\n @param className - A string representing the class name of the tinyMCE editor\n target element/textarea to look for\n @return An Array of tinymce.Editor objects\n */\n findEditorsByClassName(className) {\n if (isString(className)) {\n return tinymce.editors.reduce((acc, e) => {\n if ($(e.getElement()).hasClass(className)) {\n return acc.concat([e]);\n }\n return acc;\n }, []);\n }\n return [];\n },\n /*\n Finds a tinyMCE editor whose target element/textarea has the id passed\n @param id - A string representing the id of the tinyMCE editor target\n element/textarea to look for\n @return tinymce.Editor object, otherwise undefined\n */\n findEditorById(id) {\n if (isString(id)) {\n return tinymce.editors.find(el => el.id === id);\n }\n return undefined;\n },\n /*\n Destroy every editor instance whose target element/textarea has the className passed. This\n method executes for each editor the method defined at tinymce.Editor.destroy (e.g. https://www.tinymce.com/docs/api/tinymce/tinymce.editor/#destroy).\n @param className - A string representing the class name of the tinyMCE editor\n target element/textarea to look for\n @return undefined\n */\n destroyEditorsByClassName(className) {\n const editors = this.findEditorsByClassName(className);\n editors.forEach(ed => ed.destroy(false));\n },\n /*\n Destroy an editor instance whose target element/textarea has HTML id passed. This method\n executes tinymce.Editor.destroy (e.g. https://www.tinymce.com/docs/api/tinymce/tinymce.editor/#destroy) for a successfull id found.\n @return undefined\n */\n destroyEditorById(id) {\n const editor = this.findEditorById(id);\n if (editor) {\n editor.destroy(false);\n }\n },\n};\n","import 'bootstrap-sass/tooltip';\n\n$(() => {\n // When using a tooltip on a tinymce textarea, add the HTML attributes for the tooltips to\n // the parent `
    `. TODO: this does not work on focus though since tinymce\n // uses an iframe and we can't detect when the editor window gains focus. It only works on hover.\n //\n // If the content of the tooltip contains HTML, then add `data-html=\"true\"` to the element\n // Default behaviour for all tootips, when attribute data-placement not set\n $('[data-toggle=\"tooltip\"]:not([data-placement])').tooltip({\n animated: 'fade',\n placement: 'right',\n });\n\n // Don't set placement property if data-placement present\n $('[data-toggle=\"tooltip\"][data-placement]').tooltip({\n animated: 'fade',\n });\n});\n","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/*\nUnobtrusive JavaScript\nhttps://github.com/rails/rails/blob/main/actionview/app/assets/javascripts\nReleased under the MIT license\n */\n;\n(function () {\n var context = this;\n (function () {\n (function () {\n this.Rails = {\n linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]',\n buttonClickSelector: {\n selector: 'button[data-remote]:not([form]), button[data-confirm]:not([form])',\n exclude: 'form button'\n },\n inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',\n formSubmitSelector: 'form:not([data-turbo=true])',\n formInputClickSelector: '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])',\n formDisableSelector: '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',\n formEnableSelector: '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',\n fileInputSelector: 'input[name][type=file]:not([disabled])',\n linkDisableSelector: 'a[data-disable-with], a[data-disable]',\n buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]'\n };\n }).call(this);\n }).call(context);\n var Rails = context.Rails;\n (function () {\n (function () {\n var nonce;\n nonce = null;\n\n Rails.loadCSPNonce = function () {\n var ref;\n return nonce = (ref = document.querySelector(\"meta[name=csp-nonce]\")) != null ? ref.content : void 0;\n };\n\n Rails.cspNonce = function () {\n return nonce != null ? nonce : Rails.loadCSPNonce();\n };\n }).call(this);\n (function () {\n var expando, m;\n m = Element.prototype.matches || Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector;\n\n Rails.matches = function (element, selector) {\n if (selector.exclude != null) {\n return m.call(element, selector.selector) && !m.call(element, selector.exclude);\n } else {\n return m.call(element, selector);\n }\n };\n\n expando = '_ujsData';\n\n Rails.getData = function (element, key) {\n var ref;\n return (ref = element[expando]) != null ? ref[key] : void 0;\n };\n\n Rails.setData = function (element, key, value) {\n if (element[expando] == null) {\n element[expando] = {};\n }\n\n return element[expando][key] = value;\n };\n\n Rails.$ = function (selector) {\n return Array.prototype.slice.call(document.querySelectorAll(selector));\n };\n }).call(this);\n (function () {\n var $, csrfParam, csrfToken;\n $ = Rails.$;\n\n csrfToken = Rails.csrfToken = function () {\n var meta;\n meta = document.querySelector('meta[name=csrf-token]');\n return meta && meta.content;\n };\n\n csrfParam = Rails.csrfParam = function () {\n var meta;\n meta = document.querySelector('meta[name=csrf-param]');\n return meta && meta.content;\n };\n\n Rails.CSRFProtection = function (xhr) {\n var token;\n token = csrfToken();\n\n if (token != null) {\n return xhr.setRequestHeader('X-CSRF-Token', token);\n }\n };\n\n Rails.refreshCSRFTokens = function () {\n var param, token;\n token = csrfToken();\n param = csrfParam();\n\n if (token != null && param != null) {\n return $('form input[name=\"' + param + '\"]').forEach(function (input) {\n return input.value = token;\n });\n }\n };\n }).call(this);\n (function () {\n var CustomEvent, fire, matches, preventDefault;\n matches = Rails.matches;\n CustomEvent = window.CustomEvent;\n\n if (typeof CustomEvent !== 'function') {\n CustomEvent = function CustomEvent(event, params) {\n var evt;\n evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n preventDefault = CustomEvent.prototype.preventDefault;\n\n CustomEvent.prototype.preventDefault = function () {\n var result;\n result = preventDefault.call(this);\n\n if (this.cancelable && !this.defaultPrevented) {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function get() {\n return true;\n }\n });\n }\n\n return result;\n };\n }\n\n fire = Rails.fire = function (obj, name, data) {\n var event;\n event = new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail: data\n });\n obj.dispatchEvent(event);\n return !event.defaultPrevented;\n };\n\n Rails.stopEverything = function (e) {\n fire(e.target, 'ujs:everythingStopped');\n e.preventDefault();\n e.stopPropagation();\n return e.stopImmediatePropagation();\n };\n\n Rails.delegate = function (element, selector, eventType, handler) {\n return element.addEventListener(eventType, function (e) {\n var target;\n target = e.target;\n\n while (!(!(target instanceof Element) || matches(target, selector))) {\n target = target.parentNode;\n }\n\n if (target instanceof Element && handler.call(target, e) === false) {\n e.preventDefault();\n return e.stopPropagation();\n }\n });\n };\n }).call(this);\n (function () {\n var AcceptHeaders, CSRFProtection, createXHR, cspNonce, fire, prepareOptions, processResponse;\n cspNonce = Rails.cspNonce, CSRFProtection = Rails.CSRFProtection, fire = Rails.fire;\n AcceptHeaders = {\n '*': '*/*',\n text: 'text/plain',\n html: 'text/html',\n xml: 'application/xml, text/xml',\n json: 'application/json, text/javascript',\n script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'\n };\n\n Rails.ajax = function (options) {\n var xhr;\n options = prepareOptions(options);\n xhr = createXHR(options, function () {\n var ref, response;\n response = processResponse((ref = xhr.response) != null ? ref : xhr.responseText, xhr.getResponseHeader('Content-Type'));\n\n if (Math.floor(xhr.status / 100) === 2) {\n if (typeof options.success === \"function\") {\n options.success(response, xhr.statusText, xhr);\n }\n } else {\n if (typeof options.error === \"function\") {\n options.error(response, xhr.statusText, xhr);\n }\n }\n\n return typeof options.complete === \"function\" ? options.complete(xhr, xhr.statusText) : void 0;\n });\n\n if (options.beforeSend != null && !options.beforeSend(xhr, options)) {\n return false;\n }\n\n if (xhr.readyState === XMLHttpRequest.OPENED) {\n return xhr.send(options.data);\n }\n };\n\n prepareOptions = function prepareOptions(options) {\n options.url = options.url || location.href;\n options.type = options.type.toUpperCase();\n\n if (options.type === 'GET' && options.data) {\n if (options.url.indexOf('?') < 0) {\n options.url += '?' + options.data;\n } else {\n options.url += '&' + options.data;\n }\n }\n\n if (AcceptHeaders[options.dataType] == null) {\n options.dataType = '*';\n }\n\n options.accept = AcceptHeaders[options.dataType];\n\n if (options.dataType !== '*') {\n options.accept += ', */*; q=0.01';\n }\n\n return options;\n };\n\n createXHR = function createXHR(options, done) {\n var xhr;\n xhr = new XMLHttpRequest();\n xhr.open(options.type, options.url, true);\n xhr.setRequestHeader('Accept', options.accept);\n\n if (typeof options.data === 'string') {\n xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');\n }\n\n if (!options.crossDomain) {\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n CSRFProtection(xhr);\n }\n\n xhr.withCredentials = !!options.withCredentials;\n\n xhr.onreadystatechange = function () {\n if (xhr.readyState === XMLHttpRequest.DONE) {\n return done(xhr);\n }\n };\n\n return xhr;\n };\n\n processResponse = function processResponse(response, type) {\n var parser, script;\n\n if (typeof response === 'string' && typeof type === 'string') {\n if (type.match(/\\bjson\\b/)) {\n try {\n response = JSON.parse(response);\n } catch (error) {}\n } else if (type.match(/\\b(?:java|ecma)script\\b/)) {\n script = document.createElement('script');\n script.setAttribute('nonce', cspNonce());\n script.text = response;\n document.head.appendChild(script).parentNode.removeChild(script);\n } else if (type.match(/\\b(xml|html|svg)\\b/)) {\n parser = new DOMParser();\n type = type.replace(/;.+/, '');\n\n try {\n response = parser.parseFromString(response, type);\n } catch (error) {}\n }\n }\n\n return response;\n };\n\n Rails.href = function (element) {\n return element.href;\n };\n\n Rails.isCrossDomain = function (url) {\n var e, originAnchor, urlAnchor;\n originAnchor = document.createElement('a');\n originAnchor.href = location.href;\n urlAnchor = document.createElement('a');\n\n try {\n urlAnchor.href = url;\n return !((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host || originAnchor.protocol + '//' + originAnchor.host === urlAnchor.protocol + '//' + urlAnchor.host);\n } catch (error) {\n e = error;\n return true;\n }\n };\n }).call(this);\n (function () {\n var matches, toArray;\n matches = Rails.matches;\n\n toArray = function toArray(e) {\n return Array.prototype.slice.call(e);\n };\n\n Rails.serializeElement = function (element, additionalParam) {\n var inputs, params;\n inputs = [element];\n\n if (matches(element, 'form')) {\n inputs = toArray(element.elements);\n }\n\n params = [];\n inputs.forEach(function (input) {\n if (!input.name || input.disabled) {\n return;\n }\n\n if (matches(input, 'fieldset[disabled] *')) {\n return;\n }\n\n if (matches(input, 'select')) {\n return toArray(input.options).forEach(function (option) {\n if (option.selected) {\n return params.push({\n name: input.name,\n value: option.value\n });\n }\n });\n } else if (input.checked || ['radio', 'checkbox', 'submit'].indexOf(input.type) === -1) {\n return params.push({\n name: input.name,\n value: input.value\n });\n }\n });\n\n if (additionalParam) {\n params.push(additionalParam);\n }\n\n return params.map(function (param) {\n if (param.name != null) {\n return encodeURIComponent(param.name) + \"=\" + encodeURIComponent(param.value);\n } else {\n return param;\n }\n }).join('&');\n };\n\n Rails.formElements = function (form, selector) {\n if (matches(form, 'form')) {\n return toArray(form.elements).filter(function (el) {\n return matches(el, selector);\n });\n } else {\n return toArray(form.querySelectorAll(selector));\n }\n };\n }).call(this);\n (function () {\n var allowAction, fire, stopEverything;\n fire = Rails.fire, stopEverything = Rails.stopEverything;\n\n Rails.handleConfirm = function (e) {\n if (!allowAction(this)) {\n return stopEverything(e);\n }\n };\n\n Rails.confirm = function (message, element) {\n return confirm(message);\n };\n\n allowAction = function allowAction(element) {\n var answer, callback, message;\n message = element.getAttribute('data-confirm');\n\n if (!message) {\n return true;\n }\n\n answer = false;\n\n if (fire(element, 'confirm')) {\n try {\n answer = Rails.confirm(message, element);\n } catch (error) {}\n\n callback = fire(element, 'confirm:complete', [answer]);\n }\n\n return answer && callback;\n };\n }).call(this);\n (function () {\n var disableFormElement, disableFormElements, disableLinkElement, enableFormElement, enableFormElements, enableLinkElement, formElements, getData, isXhrRedirect, matches, setData, stopEverything;\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, stopEverything = Rails.stopEverything, formElements = Rails.formElements;\n\n Rails.handleDisabledElement = function (e) {\n var element;\n element = this;\n\n if (element.disabled) {\n return stopEverything(e);\n }\n };\n\n Rails.enableElement = function (e) {\n var element;\n\n if (e instanceof Event) {\n if (isXhrRedirect(e)) {\n return;\n }\n\n element = e.target;\n } else {\n element = e;\n }\n\n if (matches(element, Rails.linkDisableSelector)) {\n return enableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formEnableSelector)) {\n return enableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return enableFormElements(element);\n }\n };\n\n Rails.disableElement = function (e) {\n var element;\n element = e instanceof Event ? e.target : e;\n\n if (matches(element, Rails.linkDisableSelector)) {\n return disableLinkElement(element);\n } else if (matches(element, Rails.buttonDisableSelector) || matches(element, Rails.formDisableSelector)) {\n return disableFormElement(element);\n } else if (matches(element, Rails.formSubmitSelector)) {\n return disableFormElements(element);\n }\n };\n\n disableLinkElement = function disableLinkElement(element) {\n var replacement;\n\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n\n replacement = element.getAttribute('data-disable-with');\n\n if (replacement != null) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n }\n\n element.addEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', true);\n };\n\n enableLinkElement = function enableLinkElement(element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n\n if (originalText != null) {\n element.innerHTML = originalText;\n setData(element, 'ujs:enable-with', null);\n }\n\n element.removeEventListener('click', stopEverything);\n return setData(element, 'ujs:disabled', null);\n };\n\n disableFormElements = function disableFormElements(form) {\n return formElements(form, Rails.formDisableSelector).forEach(disableFormElement);\n };\n\n disableFormElement = function disableFormElement(element) {\n var replacement;\n\n if (getData(element, 'ujs:disabled')) {\n return;\n }\n\n replacement = element.getAttribute('data-disable-with');\n\n if (replacement != null) {\n if (matches(element, 'button')) {\n setData(element, 'ujs:enable-with', element.innerHTML);\n element.innerHTML = replacement;\n } else {\n setData(element, 'ujs:enable-with', element.value);\n element.value = replacement;\n }\n }\n\n element.disabled = true;\n return setData(element, 'ujs:disabled', true);\n };\n\n enableFormElements = function enableFormElements(form) {\n return formElements(form, Rails.formEnableSelector).forEach(enableFormElement);\n };\n\n enableFormElement = function enableFormElement(element) {\n var originalText;\n originalText = getData(element, 'ujs:enable-with');\n\n if (originalText != null) {\n if (matches(element, 'button')) {\n element.innerHTML = originalText;\n } else {\n element.value = originalText;\n }\n\n setData(element, 'ujs:enable-with', null);\n }\n\n element.disabled = false;\n return setData(element, 'ujs:disabled', null);\n };\n\n isXhrRedirect = function isXhrRedirect(event) {\n var ref, xhr;\n xhr = (ref = event.detail) != null ? ref[0] : void 0;\n return (xhr != null ? xhr.getResponseHeader(\"X-Xhr-Redirect\") : void 0) != null;\n };\n }).call(this);\n (function () {\n var stopEverything;\n stopEverything = Rails.stopEverything;\n\n Rails.handleMethod = function (e) {\n var csrfParam, csrfToken, form, formContent, href, link, method;\n link = this;\n method = link.getAttribute('data-method');\n\n if (!method) {\n return;\n }\n\n href = Rails.href(link);\n csrfToken = Rails.csrfToken();\n csrfParam = Rails.csrfParam();\n form = document.createElement('form');\n formContent = \"\";\n\n if (csrfParam != null && csrfToken != null && !Rails.isCrossDomain(href)) {\n formContent += \"\";\n }\n\n formContent += '';\n form.method = 'post';\n form.action = href;\n form.target = link.target;\n form.innerHTML = formContent;\n form.style.display = 'none';\n document.body.appendChild(form);\n form.querySelector('[type=\"submit\"]').click();\n return stopEverything(e);\n };\n }).call(this);\n (function () {\n var ajax,\n fire,\n getData,\n isCrossDomain,\n isRemote,\n matches,\n serializeElement,\n setData,\n stopEverything,\n slice = [].slice;\n matches = Rails.matches, getData = Rails.getData, setData = Rails.setData, fire = Rails.fire, stopEverything = Rails.stopEverything, ajax = Rails.ajax, isCrossDomain = Rails.isCrossDomain, serializeElement = Rails.serializeElement;\n\n isRemote = function isRemote(element) {\n var value;\n value = element.getAttribute('data-remote');\n return value != null && value !== 'false';\n };\n\n Rails.handleRemote = function (e) {\n var button, data, dataType, element, method, url, withCredentials;\n element = this;\n\n if (!isRemote(element)) {\n return true;\n }\n\n if (!fire(element, 'ajax:before')) {\n fire(element, 'ajax:stopped');\n return false;\n }\n\n withCredentials = element.getAttribute('data-with-credentials');\n dataType = element.getAttribute('data-type') || 'script';\n\n if (matches(element, Rails.formSubmitSelector)) {\n button = getData(element, 'ujs:submit-button');\n method = getData(element, 'ujs:submit-button-formmethod') || element.method;\n url = getData(element, 'ujs:submit-button-formaction') || element.getAttribute('action') || location.href;\n\n if (method.toUpperCase() === 'GET') {\n url = url.replace(/\\?.*$/, '');\n }\n\n if (element.enctype === 'multipart/form-data') {\n data = new FormData(element);\n\n if (button != null) {\n data.append(button.name, button.value);\n }\n } else {\n data = serializeElement(element, button);\n }\n\n setData(element, 'ujs:submit-button', null);\n setData(element, 'ujs:submit-button-formmethod', null);\n setData(element, 'ujs:submit-button-formaction', null);\n } else if (matches(element, Rails.buttonClickSelector) || matches(element, Rails.inputChangeSelector)) {\n method = element.getAttribute('data-method');\n url = element.getAttribute('data-url');\n data = serializeElement(element, element.getAttribute('data-params'));\n } else {\n method = element.getAttribute('data-method');\n url = Rails.href(element);\n data = element.getAttribute('data-params');\n }\n\n ajax({\n type: method || 'GET',\n url: url,\n data: data,\n dataType: dataType,\n beforeSend: function beforeSend(xhr, options) {\n if (fire(element, 'ajax:beforeSend', [xhr, options])) {\n return fire(element, 'ajax:send', [xhr]);\n } else {\n fire(element, 'ajax:stopped');\n return false;\n }\n },\n success: function success() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:success', args);\n },\n error: function error() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:error', args);\n },\n complete: function complete() {\n var args;\n args = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n return fire(element, 'ajax:complete', args);\n },\n crossDomain: isCrossDomain(url),\n withCredentials: withCredentials != null && withCredentials !== 'false'\n });\n return stopEverything(e);\n };\n\n Rails.formSubmitButtonClick = function (e) {\n var button, form;\n button = this;\n form = button.form;\n\n if (!form) {\n return;\n }\n\n if (button.name) {\n setData(form, 'ujs:submit-button', {\n name: button.name,\n value: button.value\n });\n }\n\n setData(form, 'ujs:formnovalidate-button', button.formNoValidate);\n setData(form, 'ujs:submit-button-formaction', button.getAttribute('formaction'));\n return setData(form, 'ujs:submit-button-formmethod', button.getAttribute('formmethod'));\n };\n\n Rails.preventInsignificantClick = function (e) {\n var data, insignificantMetaClick, link, metaClick, method, nonPrimaryMouseClick;\n link = this;\n method = (link.getAttribute('data-method') || 'GET').toUpperCase();\n data = link.getAttribute('data-params');\n metaClick = e.metaKey || e.ctrlKey;\n insignificantMetaClick = metaClick && method === 'GET' && !data;\n nonPrimaryMouseClick = e.button != null && e.button !== 0;\n\n if (nonPrimaryMouseClick || insignificantMetaClick) {\n return e.stopImmediatePropagation();\n }\n };\n }).call(this);\n (function () {\n var $, CSRFProtection, delegate, disableElement, enableElement, fire, formSubmitButtonClick, getData, handleConfirm, handleDisabledElement, handleMethod, handleRemote, loadCSPNonce, preventInsignificantClick, refreshCSRFTokens;\n fire = Rails.fire, delegate = Rails.delegate, getData = Rails.getData, $ = Rails.$, refreshCSRFTokens = Rails.refreshCSRFTokens, CSRFProtection = Rails.CSRFProtection, loadCSPNonce = Rails.loadCSPNonce, enableElement = Rails.enableElement, disableElement = Rails.disableElement, handleDisabledElement = Rails.handleDisabledElement, handleConfirm = Rails.handleConfirm, preventInsignificantClick = Rails.preventInsignificantClick, handleRemote = Rails.handleRemote, formSubmitButtonClick = Rails.formSubmitButtonClick, handleMethod = Rails.handleMethod;\n\n if (typeof jQuery !== \"undefined\" && jQuery !== null && jQuery.ajax != null) {\n if (jQuery.rails) {\n throw new Error('If you load both jquery_ujs and rails-ujs, use rails-ujs only.');\n }\n\n jQuery.rails = Rails;\n jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {\n if (!options.crossDomain) {\n return CSRFProtection(xhr);\n }\n });\n }\n\n Rails.start = function () {\n if (window._rails_loaded) {\n throw new Error('rails-ujs has already been loaded!');\n }\n\n window.addEventListener('pageshow', function () {\n $(Rails.formEnableSelector).forEach(function (el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n return $(Rails.linkDisableSelector).forEach(function (el) {\n if (getData(el, 'ujs:disabled')) {\n return enableElement(el);\n }\n });\n });\n delegate(document, Rails.linkDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.linkDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.buttonDisableSelector, 'ajax:stopped', enableElement);\n delegate(document, Rails.linkClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.linkClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.linkClickSelector, 'click', handleConfirm);\n delegate(document, Rails.linkClickSelector, 'click', disableElement);\n delegate(document, Rails.linkClickSelector, 'click', handleRemote);\n delegate(document, Rails.linkClickSelector, 'click', handleMethod);\n delegate(document, Rails.buttonClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.buttonClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleConfirm);\n delegate(document, Rails.buttonClickSelector, 'click', disableElement);\n delegate(document, Rails.buttonClickSelector, 'click', handleRemote);\n delegate(document, Rails.inputChangeSelector, 'change', handleDisabledElement);\n delegate(document, Rails.inputChangeSelector, 'change', handleConfirm);\n delegate(document, Rails.inputChangeSelector, 'change', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', handleDisabledElement);\n delegate(document, Rails.formSubmitSelector, 'submit', handleConfirm);\n delegate(document, Rails.formSubmitSelector, 'submit', handleRemote);\n delegate(document, Rails.formSubmitSelector, 'submit', function (e) {\n return setTimeout(function () {\n return disableElement(e);\n }, 13);\n });\n delegate(document, Rails.formSubmitSelector, 'ajax:send', disableElement);\n delegate(document, Rails.formSubmitSelector, 'ajax:complete', enableElement);\n delegate(document, Rails.formInputClickSelector, 'click', preventInsignificantClick);\n delegate(document, Rails.formInputClickSelector, 'click', handleDisabledElement);\n delegate(document, Rails.formInputClickSelector, 'click', handleConfirm);\n delegate(document, Rails.formInputClickSelector, 'click', formSubmitButtonClick);\n document.addEventListener('DOMContentLoaded', refreshCSRFTokens);\n document.addEventListener('DOMContentLoaded', loadCSPNonce);\n return window._rails_loaded = true;\n };\n\n if (window.Rails === Rails && fire(document, 'rails:attachBindings')) {\n Rails.start();\n }\n }).call(this);\n }).call(this);\n\n if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === \"object\" && module.exports) {\n module.exports = Rails;\n } else if (typeof define === \"function\" && define.amd) {\n define(Rails);\n }\n}).call(this);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* =============================================================\n * bootstrap3-typeahead.js v4.0.2\n * https://github.com/bassjobsen/Bootstrap-3-Typeahead\n * =============================================================\n * Original written by @mdo and @fat\n * =============================================================\n * Copyright 2014 Bass Jobsen @bassjobsen\n *\n * Licensed under the Apache License, Version 2.0 (the 'License');\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an 'AS IS' BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * ============================================================ */\n(function (root, factory) {\n 'use strict'; // CommonJS module is defined\n\n if (typeof module !== 'undefined' && module.exports) {\n module.exports = factory(require('jquery'));\n } // AMD module is defined\n else if (typeof define === 'function' && define.amd) {\n define(['jquery'], function ($) {\n return factory($);\n });\n } else {\n factory(root.jQuery);\n }\n})(this, function ($) {\n 'use strict'; // jshint laxcomma: true\n\n /* TYPEAHEAD PUBLIC CLASS DEFINITION\n * ================================= */\n\n var Typeahead = function Typeahead(element, options) {\n this.$element = $(element);\n this.options = $.extend({}, $.fn.typeahead.defaults, options);\n this.matcher = this.options.matcher || this.matcher;\n this.sorter = this.options.sorter || this.sorter;\n this.select = this.options.select || this.select;\n this.autoSelect = typeof this.options.autoSelect == 'boolean' ? this.options.autoSelect : true;\n this.highlighter = this.options.highlighter || this.highlighter;\n this.render = this.options.render || this.render;\n this.updater = this.options.updater || this.updater;\n this.displayText = this.options.displayText || this.displayText;\n this.source = this.options.source;\n this.delay = this.options.delay;\n this.$menu = $(this.options.menu);\n this.$appendTo = this.options.appendTo ? $(this.options.appendTo) : null;\n this.fitToElement = typeof this.options.fitToElement == 'boolean' ? this.options.fitToElement : false;\n this.shown = false;\n this.listen();\n this.showHintOnFocus = typeof this.options.showHintOnFocus == 'boolean' || this.options.showHintOnFocus === \"all\" ? this.options.showHintOnFocus : false;\n this.afterSelect = this.options.afterSelect;\n this.addItem = false;\n this.value = this.$element.val() || this.$element.text();\n };\n\n Typeahead.prototype = {\n constructor: Typeahead,\n select: function select() {\n var val = this.$menu.find('.active').data('value');\n this.$element.data('active', val);\n\n if (this.autoSelect || val) {\n var newVal = this.updater(val); // Updater can be set to any random functions via \"options\" parameter in constructor above.\n // Add null check for cases when updater returns void or undefined.\n\n if (!newVal) {\n newVal = '';\n }\n\n this.$element.val(this.displayText(newVal) || newVal).text(this.displayText(newVal) || newVal).change();\n this.afterSelect(newVal);\n }\n\n return this.hide();\n },\n updater: function updater(item) {\n return item;\n },\n setSource: function setSource(source) {\n this.source = source;\n },\n show: function show() {\n var pos = $.extend({}, this.$element.position(), {\n height: this.$element[0].offsetHeight\n });\n var scrollHeight = typeof this.options.scrollHeight == 'function' ? this.options.scrollHeight.call() : this.options.scrollHeight;\n var element;\n\n if (this.shown) {\n element = this.$menu;\n } else if (this.$appendTo) {\n element = this.$menu.appendTo(this.$appendTo);\n this.hasSameParent = this.$appendTo.is(this.$element.parent());\n } else {\n element = this.$menu.insertAfter(this.$element);\n this.hasSameParent = true;\n }\n\n if (!this.hasSameParent) {\n // We cannot rely on the element position, need to position relative to the window\n element.css(\"position\", \"fixed\");\n var offset = this.$element.offset();\n pos.top = offset.top;\n pos.left = offset.left;\n } // The rules for bootstrap are: 'dropup' in the parent and 'dropdown-menu-right' in the element.\n // Note that to get right alignment, you'll need to specify `menu` in the options to be:\n // '
      '\n\n\n var dropup = $(element).parent().hasClass('dropup');\n var newTop = dropup ? 'auto' : pos.top + pos.height + scrollHeight;\n var right = $(element).hasClass('dropdown-menu-right');\n var newLeft = right ? 'auto' : pos.left; // it seems like setting the css is a bad idea (just let Bootstrap do it), but I'll keep the old\n // logic in place except for the dropup/right-align cases.\n\n element.css({\n top: newTop,\n left: newLeft\n }).show();\n\n if (this.options.fitToElement === true) {\n element.css(\"width\", this.$element.outerWidth() + \"px\");\n }\n\n this.shown = true;\n return this;\n },\n hide: function hide() {\n this.$menu.hide();\n this.shown = false;\n return this;\n },\n lookup: function lookup(query) {\n var items;\n\n if (typeof query != 'undefined' && query !== null) {\n this.query = query;\n } else {\n this.query = this.$element.val() || this.$element.text() || '';\n }\n\n if (this.query.length < this.options.minLength && !this.options.showHintOnFocus) {\n return this.shown ? this.hide() : this;\n }\n\n var worker = $.proxy(function () {\n if ($.isFunction(this.source)) {\n this.source(this.query, $.proxy(this.process, this));\n } else if (this.source) {\n this.process(this.source);\n }\n }, this);\n clearTimeout(this.lookupWorker);\n this.lookupWorker = setTimeout(worker, this.delay);\n },\n process: function process(items) {\n var that = this;\n items = $.grep(items, function (item) {\n return that.matcher(item);\n });\n items = this.sorter(items);\n\n if (!items.length && !this.options.addItem) {\n return this.shown ? this.hide() : this;\n }\n\n if (items.length > 0) {\n this.$element.data('active', items[0]);\n } else {\n this.$element.data('active', null);\n } // Add item\n\n\n if (this.options.addItem) {\n items.push(this.options.addItem);\n }\n\n if (this.options.items == 'all') {\n return this.render(items).show();\n } else {\n return this.render(items.slice(0, this.options.items)).show();\n }\n },\n matcher: function matcher(item) {\n var it = this.displayText(item);\n return ~it.toLowerCase().indexOf(this.query.toLowerCase());\n },\n sorter: function sorter(items) {\n var beginswith = [];\n var caseSensitive = [];\n var caseInsensitive = [];\n var item;\n\n while (item = items.shift()) {\n var it = this.displayText(item);\n if (!it.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item);else if (~it.indexOf(this.query)) caseSensitive.push(item);else caseInsensitive.push(item);\n }\n\n return beginswith.concat(caseSensitive, caseInsensitive);\n },\n highlighter: function highlighter(item) {\n var html = $('
      ');\n var query = this.query;\n var i = item.toLowerCase().indexOf(query.toLowerCase());\n var len = query.length;\n var leftPart;\n var middlePart;\n var rightPart;\n var strong;\n\n if (len === 0) {\n return html.text(item).html();\n }\n\n while (i > -1) {\n leftPart = item.substr(0, i);\n middlePart = item.substr(i, len);\n rightPart = item.substr(i + len);\n strong = $('').text(middlePart);\n html.append(document.createTextNode(leftPart)).append(strong);\n item = rightPart;\n i = item.toLowerCase().indexOf(query.toLowerCase());\n }\n\n return html.append(document.createTextNode(item)).html();\n },\n render: function render(items) {\n var that = this;\n var self = this;\n var activeFound = false;\n var data = [];\n var _category = that.options.separator;\n $.each(items, function (key, value) {\n // inject separator\n if (key > 0 && value[_category] !== items[key - 1][_category]) {\n data.push({\n __type: 'divider'\n });\n } // inject category header\n\n\n if (value[_category] && (key === 0 || value[_category] !== items[key - 1][_category])) {\n data.push({\n __type: 'category',\n name: value[_category]\n });\n }\n\n data.push(value);\n });\n items = $(data).map(function (i, item) {\n if ((item.__type || false) == 'category') {\n return $(that.options.headerHtml).text(item.name)[0];\n }\n\n if ((item.__type || false) == 'divider') {\n return $(that.options.headerDivider)[0];\n }\n\n var text = self.displayText(item);\n i = $(that.options.item).data('value', item);\n i.find('a').html(that.highlighter(text, item));\n\n if (text == self.$element.val()) {\n i.addClass('active');\n self.$element.data('active', item);\n activeFound = true;\n }\n\n return i[0];\n });\n\n if (this.autoSelect && !activeFound) {\n items.filter(':not(.dropdown-header)').first().addClass('active');\n this.$element.data('active', items.first().data('value'));\n }\n\n this.$menu.html(items);\n return this;\n },\n displayText: function displayText(item) {\n return typeof item !== 'undefined' && typeof item.name != 'undefined' && item.name || item;\n },\n next: function next(event) {\n var active = this.$menu.find('.active').removeClass('active');\n var next = active.next();\n\n if (!next.length) {\n next = $(this.$menu.find('li')[0]);\n }\n\n next.addClass('active');\n },\n prev: function prev(event) {\n var active = this.$menu.find('.active').removeClass('active');\n var prev = active.prev();\n\n if (!prev.length) {\n prev = this.$menu.find('li').last();\n }\n\n prev.addClass('active');\n },\n listen: function listen() {\n this.$element.on('focus', $.proxy(this.focus, this)).on('blur', $.proxy(this.blur, this)).on('keypress', $.proxy(this.keypress, this)).on('input', $.proxy(this.input, this)).on('keyup', $.proxy(this.keyup, this));\n\n if (this.eventSupported('keydown')) {\n this.$element.on('keydown', $.proxy(this.keydown, this));\n }\n\n this.$menu.on('click', $.proxy(this.click, this)).on('mouseenter', 'li', $.proxy(this.mouseenter, this)).on('mouseleave', 'li', $.proxy(this.mouseleave, this)).on('mousedown', $.proxy(this.mousedown, this));\n },\n destroy: function destroy() {\n this.$element.data('typeahead', null);\n this.$element.data('active', null);\n this.$element.off('focus').off('blur').off('keypress').off('input').off('keyup');\n\n if (this.eventSupported('keydown')) {\n this.$element.off('keydown');\n }\n\n this.$menu.remove();\n this.destroyed = true;\n },\n eventSupported: function eventSupported(eventName) {\n var isSupported = (eventName in this.$element);\n\n if (!isSupported) {\n this.$element.setAttribute(eventName, 'return;');\n isSupported = typeof this.$element[eventName] === 'function';\n }\n\n return isSupported;\n },\n move: function move(e) {\n if (!this.shown) return;\n\n switch (e.keyCode) {\n case 9: // tab\n\n case 13: // enter\n\n case 27:\n // escape\n e.preventDefault();\n break;\n\n case 38:\n // up arrow\n // with the shiftKey (this is actually the left parenthesis)\n if (e.shiftKey) return;\n e.preventDefault();\n this.prev();\n break;\n\n case 40:\n // down arrow\n // with the shiftKey (this is actually the right parenthesis)\n if (e.shiftKey) return;\n e.preventDefault();\n this.next();\n break;\n }\n },\n keydown: function keydown(e) {\n this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40, 38, 9, 13, 27]);\n\n if (!this.shown && e.keyCode == 40) {\n this.lookup();\n } else {\n this.move(e);\n }\n },\n keypress: function keypress(e) {\n if (this.suppressKeyPressRepeat) return;\n this.move(e);\n },\n input: function input(e) {\n // This is a fixed for IE10/11 that fires the input event when a placehoder is changed\n // (https://connect.microsoft.com/IE/feedback/details/810538/ie-11-fires-input-event-on-focus)\n var currentValue = this.$element.val() || this.$element.text();\n\n if (this.value !== currentValue) {\n this.value = currentValue;\n this.lookup();\n }\n },\n keyup: function keyup(e) {\n if (this.destroyed) {\n return;\n }\n\n switch (e.keyCode) {\n case 40: // down arrow\n\n case 38: // up arrow\n\n case 16: // shift\n\n case 17: // ctrl\n\n case 18:\n // alt\n break;\n\n case 9: // tab\n\n case 13:\n // enter\n if (!this.shown) return;\n this.select();\n break;\n\n case 27:\n // escape\n if (!this.shown) return;\n this.hide();\n break;\n }\n },\n focus: function focus(e) {\n if (!this.focused) {\n this.focused = true;\n\n if (this.options.showHintOnFocus && this.skipShowHintOnFocus !== true) {\n if (this.options.showHintOnFocus === \"all\") {\n this.lookup(\"\");\n } else {\n this.lookup();\n }\n }\n }\n\n if (this.skipShowHintOnFocus) {\n this.skipShowHintOnFocus = false;\n }\n },\n blur: function blur(e) {\n if (!this.mousedover && !this.mouseddown && this.shown) {\n this.hide();\n this.focused = false;\n } else if (this.mouseddown) {\n // This is for IE that blurs the input when user clicks on scroll.\n // We set the focus back on the input and prevent the lookup to occur again\n this.skipShowHintOnFocus = true;\n this.$element.focus();\n this.mouseddown = false;\n }\n },\n click: function click(e) {\n e.preventDefault();\n this.skipShowHintOnFocus = true;\n this.select();\n this.$element.focus();\n this.hide();\n },\n mouseenter: function mouseenter(e) {\n this.mousedover = true;\n this.$menu.find('.active').removeClass('active');\n $(e.currentTarget).addClass('active');\n },\n mouseleave: function mouseleave(e) {\n this.mousedover = false;\n if (!this.focused && this.shown) this.hide();\n },\n\n /**\n * We track the mousedown for IE. When clicking on the menu scrollbar, IE makes the input blur thus hiding the menu.\n */\n mousedown: function mousedown(e) {\n this.mouseddown = true;\n this.$menu.one(\"mouseup\", function (e) {\n // IE won't fire this, but FF and Chrome will so we reset our flag for them here\n this.mouseddown = false;\n }.bind(this));\n }\n };\n /* TYPEAHEAD PLUGIN DEFINITION\n * =========================== */\n\n var old = $.fn.typeahead;\n\n $.fn.typeahead = function (option) {\n var arg = arguments;\n\n if (typeof option == 'string' && option == 'getActive') {\n return this.data('active');\n }\n\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('typeahead');\n var options = _typeof(option) == 'object' && option;\n if (!data) $this.data('typeahead', data = new Typeahead(this, options));\n\n if (typeof option == 'string' && data[option]) {\n if (arg.length > 1) {\n data[option].apply(data, Array.prototype.slice.call(arg, 1));\n } else {\n data[option]();\n }\n }\n });\n };\n\n $.fn.typeahead.defaults = {\n source: [],\n items: 8,\n menu: '
        ',\n item: '
      • ',\n minLength: 1,\n scrollHeight: 0,\n autoSelect: true,\n afterSelect: $.noop,\n addItem: false,\n delay: 0,\n separator: 'category',\n headerHtml: '
      • ',\n headerDivider: '
      • '\n };\n $.fn.typeahead.Constructor = Typeahead;\n /* TYPEAHEAD NO CONFLICT\n * =================== */\n\n $.fn.typeahead.noConflict = function () {\n $.fn.typeahead = old;\n return this;\n };\n /* TYPEAHEAD DATA-API\n * ================== */\n\n\n $(document).on('focus.typeahead.data-api', '[data-provide=\"typeahead\"]', function (e) {\n var $this = $(this);\n if ($this.data('typeahead')) return;\n $this.typeahead($this.data());\n });\n});","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: popover.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#popovers\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // POPOVER PUBLIC CLASS DEFINITION\n // ===============================\n\n var Popover = function Popover(element, options) {\n this.init('popover', element, options);\n };\n\n if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js');\n Popover.VERSION = '3.4.1';\n Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {\n placement: 'right',\n trigger: 'click',\n content: '',\n template: '

        '\n }); // NOTE: POPOVER EXTENDS tooltip.js\n // ================================\n\n Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype);\n Popover.prototype.constructor = Popover;\n\n Popover.prototype.getDefaults = function () {\n return Popover.DEFAULTS;\n };\n\n Popover.prototype.setContent = function () {\n var $tip = this.tip();\n var title = this.getTitle();\n var content = this.getContent();\n\n if (this.options.html) {\n var typeContent = _typeof(content);\n\n if (this.options.sanitize) {\n title = this.sanitizeHtml(title);\n\n if (typeContent === 'string') {\n content = this.sanitizeHtml(content);\n }\n }\n\n $tip.find('.popover-title').html(title);\n $tip.find('.popover-content').children().detach().end()[typeContent === 'string' ? 'html' : 'append'](content);\n } else {\n $tip.find('.popover-title').text(title);\n $tip.find('.popover-content').children().detach().end().text(content);\n }\n\n $tip.removeClass('fade top bottom left right in'); // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do\n // this manually by checking the contents.\n\n if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();\n };\n\n Popover.prototype.hasContent = function () {\n return this.getTitle() || this.getContent();\n };\n\n Popover.prototype.getContent = function () {\n var $e = this.$element;\n var o = this.options;\n return $e.attr('data-content') || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content);\n };\n\n Popover.prototype.arrow = function () {\n return this.$arrow = this.$arrow || this.tip().find('.arrow');\n }; // POPOVER PLUGIN DEFINITION\n // =========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.popover');\n var options = _typeof(option) == 'object' && option;\n if (!data && /destroy|hide/.test(option)) return;\n if (!data) $this.data('bs.popover', data = new Popover(this, options));\n if (typeof option == 'string') data[option]();\n });\n }\n\n var old = $.fn.popover;\n $.fn.popover = Plugin;\n $.fn.popover.Constructor = Popover; // POPOVER NO CONFLICT\n // ===================\n\n $.fn.popover.noConflict = function () {\n $.fn.popover = old;\n return this;\n };\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: tooltip.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#tooltip\n * Inspired by the original jQuery.tipsy by Jason Frame\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict';\n\n var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];\n var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];\n var ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i;\n var DefaultWhitelist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n div: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n };\n /**\n * A pattern that recognizes a commonly useful subset of URLs that are safe.\n *\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\n */\n\n var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;\n /**\n * A pattern that matches safe data URLs. Only matches image, video and audio types.\n *\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\n */\n\n var DATA_URL_PATTERN = /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;\n\n function allowedAttribute(attr, allowedAttributeList) {\n var attrName = attr.nodeName.toLowerCase();\n\n if ($.inArray(attrName, allowedAttributeList) !== -1) {\n if ($.inArray(attrName, uriAttrs) !== -1) {\n return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));\n }\n\n return true;\n }\n\n var regExp = $(allowedAttributeList).filter(function (index, value) {\n return value instanceof RegExp;\n }); // Check if a regular expression validates the attribute.\n\n for (var i = 0, l = regExp.length; i < l; i++) {\n if (attrName.match(regExp[i])) {\n return true;\n }\n }\n\n return false;\n }\n\n function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {\n if (unsafeHtml.length === 0) {\n return unsafeHtml;\n }\n\n if (sanitizeFn && typeof sanitizeFn === 'function') {\n return sanitizeFn(unsafeHtml);\n } // IE 8 and below don't support createHTMLDocument\n\n\n if (!document.implementation || !document.implementation.createHTMLDocument) {\n return unsafeHtml;\n }\n\n var createdDocument = document.implementation.createHTMLDocument('sanitization');\n createdDocument.body.innerHTML = unsafeHtml;\n var whitelistKeys = $.map(whiteList, function (el, i) {\n return i;\n });\n var elements = $(createdDocument.body).find('*');\n\n for (var i = 0, len = elements.length; i < len; i++) {\n var el = elements[i];\n var elName = el.nodeName.toLowerCase();\n\n if ($.inArray(elName, whitelistKeys) === -1) {\n el.parentNode.removeChild(el);\n continue;\n }\n\n var attributeList = $.map(el.attributes, function (el) {\n return el;\n });\n var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);\n\n for (var j = 0, len2 = attributeList.length; j < len2; j++) {\n if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {\n el.removeAttribute(attributeList[j].nodeName);\n }\n }\n }\n\n return createdDocument.body.innerHTML;\n } // TOOLTIP PUBLIC CLASS DEFINITION\n // ===============================\n\n\n var Tooltip = function Tooltip(element, options) {\n this.type = null;\n this.options = null;\n this.enabled = null;\n this.timeout = null;\n this.hoverState = null;\n this.$element = null;\n this.inState = null;\n this.init('tooltip', element, options);\n };\n\n Tooltip.VERSION = '3.4.1';\n Tooltip.TRANSITION_DURATION = 150;\n Tooltip.DEFAULTS = {\n animation: true,\n placement: 'top',\n selector: false,\n template: '
        ',\n trigger: 'hover focus',\n title: '',\n delay: 0,\n html: false,\n container: false,\n viewport: {\n selector: 'body',\n padding: 0\n },\n sanitize: true,\n sanitizeFn: null,\n whiteList: DefaultWhitelist\n };\n\n Tooltip.prototype.init = function (type, element, options) {\n this.enabled = true;\n this.type = type;\n this.$element = $(element);\n this.options = this.getOptions(options);\n this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : this.options.viewport.selector || this.options.viewport);\n this.inState = {\n click: false,\n hover: false,\n focus: false\n };\n\n if (this.$element[0] instanceof document.constructor && !this.options.selector) {\n throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!');\n }\n\n var triggers = this.options.trigger.split(' ');\n\n for (var i = triggers.length; i--;) {\n var trigger = triggers[i];\n\n if (trigger == 'click') {\n this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this));\n } else if (trigger != 'manual') {\n var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin';\n var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';\n this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this));\n this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this));\n }\n }\n\n this.options.selector ? this._options = $.extend({}, this.options, {\n trigger: 'manual',\n selector: ''\n }) : this.fixTitle();\n };\n\n Tooltip.prototype.getDefaults = function () {\n return Tooltip.DEFAULTS;\n };\n\n Tooltip.prototype.getOptions = function (options) {\n var dataAttributes = this.$element.data();\n\n for (var dataAttr in dataAttributes) {\n if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {\n delete dataAttributes[dataAttr];\n }\n }\n\n options = $.extend({}, this.getDefaults(), dataAttributes, options);\n\n if (options.delay && typeof options.delay == 'number') {\n options.delay = {\n show: options.delay,\n hide: options.delay\n };\n }\n\n if (options.sanitize) {\n options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn);\n }\n\n return options;\n };\n\n Tooltip.prototype.getDelegateOptions = function () {\n var options = {};\n var defaults = this.getDefaults();\n this._options && $.each(this._options, function (key, value) {\n if (defaults[key] != value) options[key] = value;\n });\n return options;\n };\n\n Tooltip.prototype.enter = function (obj) {\n var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type);\n\n if (!self) {\n self = new this.constructor(obj.currentTarget, this.getDelegateOptions());\n $(obj.currentTarget).data('bs.' + this.type, self);\n }\n\n if (obj instanceof $.Event) {\n self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true;\n }\n\n if (self.tip().hasClass('in') || self.hoverState == 'in') {\n self.hoverState = 'in';\n return;\n }\n\n clearTimeout(self.timeout);\n self.hoverState = 'in';\n if (!self.options.delay || !self.options.delay.show) return self.show();\n self.timeout = setTimeout(function () {\n if (self.hoverState == 'in') self.show();\n }, self.options.delay.show);\n };\n\n Tooltip.prototype.isInStateTrue = function () {\n for (var key in this.inState) {\n if (this.inState[key]) return true;\n }\n\n return false;\n };\n\n Tooltip.prototype.leave = function (obj) {\n var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type);\n\n if (!self) {\n self = new this.constructor(obj.currentTarget, this.getDelegateOptions());\n $(obj.currentTarget).data('bs.' + this.type, self);\n }\n\n if (obj instanceof $.Event) {\n self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false;\n }\n\n if (self.isInStateTrue()) return;\n clearTimeout(self.timeout);\n self.hoverState = 'out';\n if (!self.options.delay || !self.options.delay.hide) return self.hide();\n self.timeout = setTimeout(function () {\n if (self.hoverState == 'out') self.hide();\n }, self.options.delay.hide);\n };\n\n Tooltip.prototype.show = function () {\n var e = $.Event('show.bs.' + this.type);\n\n if (this.hasContent() && this.enabled) {\n this.$element.trigger(e);\n var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]);\n if (e.isDefaultPrevented() || !inDom) return;\n var that = this;\n var $tip = this.tip();\n var tipId = this.getUID(this.type);\n this.setContent();\n $tip.attr('id', tipId);\n this.$element.attr('aria-describedby', tipId);\n if (this.options.animation) $tip.addClass('fade');\n var placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement;\n var autoToken = /\\s?auto?\\s?/i;\n var autoPlace = autoToken.test(placement);\n if (autoPlace) placement = placement.replace(autoToken, '') || 'top';\n $tip.detach().css({\n top: 0,\n left: 0,\n display: 'block'\n }).addClass(placement).data('bs.' + this.type, this);\n this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element);\n this.$element.trigger('inserted.bs.' + this.type);\n var pos = this.getPosition();\n var actualWidth = $tip[0].offsetWidth;\n var actualHeight = $tip[0].offsetHeight;\n\n if (autoPlace) {\n var orgPlacement = placement;\n var viewportDim = this.getPosition(this.$viewport);\n placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : placement;\n $tip.removeClass(orgPlacement).addClass(placement);\n }\n\n var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);\n this.applyPlacement(calculatedOffset, placement);\n\n var complete = function complete() {\n var prevHoverState = that.hoverState;\n that.$element.trigger('shown.bs.' + that.type);\n that.hoverState = null;\n if (prevHoverState == 'out') that.leave(that);\n };\n\n $.support.transition && this.$tip.hasClass('fade') ? $tip.one('bsTransitionEnd', complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete();\n }\n };\n\n Tooltip.prototype.applyPlacement = function (offset, placement) {\n var $tip = this.tip();\n var width = $tip[0].offsetWidth;\n var height = $tip[0].offsetHeight; // manually read margins because getBoundingClientRect includes difference\n\n var marginTop = parseInt($tip.css('margin-top'), 10);\n var marginLeft = parseInt($tip.css('margin-left'), 10); // we must check for NaN for ie 8/9\n\n if (isNaN(marginTop)) marginTop = 0;\n if (isNaN(marginLeft)) marginLeft = 0;\n offset.top += marginTop;\n offset.left += marginLeft; // $.fn.offset doesn't round pixel values\n // so we use setOffset directly with our own function B-0\n\n $.offset.setOffset($tip[0], $.extend({\n using: function using(props) {\n $tip.css({\n top: Math.round(props.top),\n left: Math.round(props.left)\n });\n }\n }, offset), 0);\n $tip.addClass('in'); // check to see if placing tip in new offset caused the tip to resize itself\n\n var actualWidth = $tip[0].offsetWidth;\n var actualHeight = $tip[0].offsetHeight;\n\n if (placement == 'top' && actualHeight != height) {\n offset.top = offset.top + height - actualHeight;\n }\n\n var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight);\n if (delta.left) offset.left += delta.left;else offset.top += delta.top;\n var isVertical = /top|bottom/.test(placement);\n var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight;\n var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight';\n $tip.offset(offset);\n this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical);\n };\n\n Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {\n this.arrow().css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%').css(isVertical ? 'top' : 'left', '');\n };\n\n Tooltip.prototype.setContent = function () {\n var $tip = this.tip();\n var title = this.getTitle();\n\n if (this.options.html) {\n if (this.options.sanitize) {\n title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn);\n }\n\n $tip.find('.tooltip-inner').html(title);\n } else {\n $tip.find('.tooltip-inner').text(title);\n }\n\n $tip.removeClass('fade in top bottom left right');\n };\n\n Tooltip.prototype.hide = function (callback) {\n var that = this;\n var $tip = $(this.$tip);\n var e = $.Event('hide.bs.' + this.type);\n\n function complete() {\n if (that.hoverState != 'in') $tip.detach();\n\n if (that.$element) {\n // TODO: Check whether guarding this code with this `if` is really necessary.\n that.$element.removeAttr('aria-describedby').trigger('hidden.bs.' + that.type);\n }\n\n callback && callback();\n }\n\n this.$element.trigger(e);\n if (e.isDefaultPrevented()) return;\n $tip.removeClass('in');\n $.support.transition && $tip.hasClass('fade') ? $tip.one('bsTransitionEnd', complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete();\n this.hoverState = null;\n return this;\n };\n\n Tooltip.prototype.fixTitle = function () {\n var $e = this.$element;\n\n if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {\n $e.attr('data-original-title', $e.attr('title') || '').attr('title', '');\n }\n };\n\n Tooltip.prototype.hasContent = function () {\n return this.getTitle();\n };\n\n Tooltip.prototype.getPosition = function ($element) {\n $element = $element || this.$element;\n var el = $element[0];\n var isBody = el.tagName == 'BODY';\n var elRect = el.getBoundingClientRect();\n\n if (elRect.width == null) {\n // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093\n elRect = $.extend({}, elRect, {\n width: elRect.right - elRect.left,\n height: elRect.bottom - elRect.top\n });\n }\n\n var isSvg = window.SVGElement && el instanceof window.SVGElement; // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.\n // See https://github.com/twbs/bootstrap/issues/20280\n\n var elOffset = isBody ? {\n top: 0,\n left: 0\n } : isSvg ? null : $element.offset();\n var scroll = {\n scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop()\n };\n var outerDims = isBody ? {\n width: $(window).width(),\n height: $(window).height()\n } : null;\n return $.extend({}, elRect, scroll, outerDims, elOffset);\n };\n\n Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {\n return placement == 'bottom' ? {\n top: pos.top + pos.height,\n left: pos.left + pos.width / 2 - actualWidth / 2\n } : placement == 'top' ? {\n top: pos.top - actualHeight,\n left: pos.left + pos.width / 2 - actualWidth / 2\n } : placement == 'left' ? {\n top: pos.top + pos.height / 2 - actualHeight / 2,\n left: pos.left - actualWidth\n } :\n /* placement == 'right' */\n {\n top: pos.top + pos.height / 2 - actualHeight / 2,\n left: pos.left + pos.width\n };\n };\n\n Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {\n var delta = {\n top: 0,\n left: 0\n };\n if (!this.$viewport) return delta;\n var viewportPadding = this.options.viewport && this.options.viewport.padding || 0;\n var viewportDimensions = this.getPosition(this.$viewport);\n\n if (/right|left/.test(placement)) {\n var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll;\n var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight;\n\n if (topEdgeOffset < viewportDimensions.top) {\n // top overflow\n delta.top = viewportDimensions.top - topEdgeOffset;\n } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) {\n // bottom overflow\n delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset;\n }\n } else {\n var leftEdgeOffset = pos.left - viewportPadding;\n var rightEdgeOffset = pos.left + viewportPadding + actualWidth;\n\n if (leftEdgeOffset < viewportDimensions.left) {\n // left overflow\n delta.left = viewportDimensions.left - leftEdgeOffset;\n } else if (rightEdgeOffset > viewportDimensions.right) {\n // right overflow\n delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset;\n }\n }\n\n return delta;\n };\n\n Tooltip.prototype.getTitle = function () {\n var title;\n var $e = this.$element;\n var o = this.options;\n title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title);\n return title;\n };\n\n Tooltip.prototype.getUID = function (prefix) {\n do {\n prefix += ~~(Math.random() * 1000000);\n } while (document.getElementById(prefix));\n\n return prefix;\n };\n\n Tooltip.prototype.tip = function () {\n if (!this.$tip) {\n this.$tip = $(this.options.template);\n\n if (this.$tip.length != 1) {\n throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!');\n }\n }\n\n return this.$tip;\n };\n\n Tooltip.prototype.arrow = function () {\n return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow');\n };\n\n Tooltip.prototype.enable = function () {\n this.enabled = true;\n };\n\n Tooltip.prototype.disable = function () {\n this.enabled = false;\n };\n\n Tooltip.prototype.toggleEnabled = function () {\n this.enabled = !this.enabled;\n };\n\n Tooltip.prototype.toggle = function (e) {\n var self = this;\n\n if (e) {\n self = $(e.currentTarget).data('bs.' + this.type);\n\n if (!self) {\n self = new this.constructor(e.currentTarget, this.getDelegateOptions());\n $(e.currentTarget).data('bs.' + this.type, self);\n }\n }\n\n if (e) {\n self.inState.click = !self.inState.click;\n if (self.isInStateTrue()) self.enter(self);else self.leave(self);\n } else {\n self.tip().hasClass('in') ? self.leave(self) : self.enter(self);\n }\n };\n\n Tooltip.prototype.destroy = function () {\n var that = this;\n clearTimeout(this.timeout);\n this.hide(function () {\n that.$element.off('.' + that.type).removeData('bs.' + that.type);\n\n if (that.$tip) {\n that.$tip.detach();\n }\n\n that.$tip = null;\n that.$arrow = null;\n that.$viewport = null;\n that.$element = null;\n });\n };\n\n Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {\n return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn);\n }; // TOOLTIP PLUGIN DEFINITION\n // =========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.tooltip');\n var options = _typeof(option) == 'object' && option;\n if (!data && /destroy|hide/.test(option)) return;\n if (!data) $this.data('bs.tooltip', data = new Tooltip(this, options));\n if (typeof option == 'string') data[option]();\n });\n }\n\n var old = $.fn.tooltip;\n $.fn.tooltip = Plugin;\n $.fn.tooltip.Constructor = Tooltip; // TOOLTIP NO CONFLICT\n // ===================\n\n $.fn.tooltip.noConflict = function () {\n $.fn.tooltip = old;\n return this;\n };\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/*!\r\n * Bootstrap-select v1.13.18 (https://developer.snapappointments.com/bootstrap-select)\r\n *\r\n * Copyright 2012-2020 SnapAppointments, LLC\r\n * Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)\r\n */\n(function (root, factory) {\n if (root === undefined && window !== undefined) root = window;\n\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module unless amdModuleId is set\n define([\"jquery\"], function (a0) {\n return factory(a0);\n });\n } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory(require(\"jquery\"));\n } else {\n factory(root[\"jQuery\"]);\n }\n})(this, function (jQuery) {\n (function ($) {\n 'use strict';\n\n var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];\n var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];\n var ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i;\n var DefaultWhitelist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', 'tabindex', 'style', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n div: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n };\n /**\r\n * A pattern that recognizes a commonly useful subset of URLs that are safe.\r\n *\r\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\r\n */\n\n var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;\n /**\r\n * A pattern that matches safe data URLs. Only matches image, video and audio types.\r\n *\r\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\r\n */\n\n var DATA_URL_PATTERN = /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;\n\n function allowedAttribute(attr, allowedAttributeList) {\n var attrName = attr.nodeName.toLowerCase();\n\n if ($.inArray(attrName, allowedAttributeList) !== -1) {\n if ($.inArray(attrName, uriAttrs) !== -1) {\n return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));\n }\n\n return true;\n }\n\n var regExp = $(allowedAttributeList).filter(function (index, value) {\n return value instanceof RegExp;\n }); // Check if a regular expression validates the attribute.\n\n for (var i = 0, l = regExp.length; i < l; i++) {\n if (attrName.match(regExp[i])) {\n return true;\n }\n }\n\n return false;\n }\n\n function sanitizeHtml(unsafeElements, whiteList, sanitizeFn) {\n if (sanitizeFn && typeof sanitizeFn === 'function') {\n return sanitizeFn(unsafeElements);\n }\n\n var whitelistKeys = Object.keys(whiteList);\n\n for (var i = 0, len = unsafeElements.length; i < len; i++) {\n var elements = unsafeElements[i].querySelectorAll('*');\n\n for (var j = 0, len2 = elements.length; j < len2; j++) {\n var el = elements[j];\n var elName = el.nodeName.toLowerCase();\n\n if (whitelistKeys.indexOf(elName) === -1) {\n el.parentNode.removeChild(el);\n continue;\n }\n\n var attributeList = [].slice.call(el.attributes);\n var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);\n\n for (var k = 0, len3 = attributeList.length; k < len3; k++) {\n var attr = attributeList[k];\n\n if (!allowedAttribute(attr, whitelistedAttributes)) {\n el.removeAttribute(attr.nodeName);\n }\n }\n }\n }\n } // Polyfill for browsers with no classList support\n // Remove in v2\n\n\n if (!('classList' in document.createElement('_'))) {\n (function (view) {\n if (!('Element' in view)) return;\n\n var classListProp = 'classList',\n protoProp = 'prototype',\n elemCtrProto = view.Element[protoProp],\n objCtr = Object,\n classListGetter = function classListGetter() {\n var $elem = $(this);\n return {\n add: function add(classes) {\n classes = Array.prototype.slice.call(arguments).join(' ');\n return $elem.addClass(classes);\n },\n remove: function remove(classes) {\n classes = Array.prototype.slice.call(arguments).join(' ');\n return $elem.removeClass(classes);\n },\n toggle: function toggle(classes, force) {\n return $elem.toggleClass(classes, force);\n },\n contains: function contains(classes) {\n return $elem.hasClass(classes);\n }\n };\n };\n\n if (objCtr.defineProperty) {\n var classListPropDesc = {\n get: classListGetter,\n enumerable: true,\n configurable: true\n };\n\n try {\n objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);\n } catch (ex) {\n // IE 8 doesn't support enumerable:true\n // adding undefined to fight this issue https://github.com/eligrey/classList.js/issues/36\n // modernie IE8-MSW7 machine has IE8 8.0.6001.18702 and is affected\n if (ex.number === undefined || ex.number === -0x7FF5EC54) {\n classListPropDesc.enumerable = false;\n objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);\n }\n }\n } else if (objCtr[protoProp].__defineGetter__) {\n elemCtrProto.__defineGetter__(classListProp, classListGetter);\n }\n })(window);\n }\n\n var testElement = document.createElement('_');\n testElement.classList.add('c1', 'c2');\n\n if (!testElement.classList.contains('c2')) {\n var _add = DOMTokenList.prototype.add,\n _remove = DOMTokenList.prototype.remove;\n\n DOMTokenList.prototype.add = function () {\n Array.prototype.forEach.call(arguments, _add.bind(this));\n };\n\n DOMTokenList.prototype.remove = function () {\n Array.prototype.forEach.call(arguments, _remove.bind(this));\n };\n }\n\n testElement.classList.toggle('c3', false); // Polyfill for IE 10 and Firefox <24, where classList.toggle does not\n // support the second argument.\n\n if (testElement.classList.contains('c3')) {\n var _toggle = DOMTokenList.prototype.toggle;\n\n DOMTokenList.prototype.toggle = function (token, force) {\n if (1 in arguments && !this.contains(token) === !force) {\n return force;\n } else {\n return _toggle.call(this, token);\n }\n };\n }\n\n testElement = null; // shallow array comparison\n\n function isEqual(array1, array2) {\n return array1.length === array2.length && array1.every(function (element, index) {\n return element === array2[index];\n });\n }\n\n ; // \n\n if (!String.prototype.startsWith) {\n (function () {\n 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`\n\n var defineProperty = function () {\n // IE 8 only supports `Object.defineProperty` on DOM elements\n try {\n var object = {};\n var $defineProperty = Object.defineProperty;\n var result = $defineProperty(object, object, object) && $defineProperty;\n } catch (error) {}\n\n return result;\n }();\n\n var toString = {}.toString;\n\n var startsWith = function startsWith(search) {\n if (this == null) {\n throw new TypeError();\n }\n\n var string = String(this);\n\n if (search && toString.call(search) == '[object RegExp]') {\n throw new TypeError();\n }\n\n var stringLength = string.length;\n var searchString = String(search);\n var searchLength = searchString.length;\n var position = arguments.length > 1 ? arguments[1] : undefined; // `ToInteger`\n\n var pos = position ? Number(position) : 0;\n\n if (pos != pos) {\n // better `isNaN`\n pos = 0;\n }\n\n var start = Math.min(Math.max(pos, 0), stringLength); // Avoid the `indexOf` call if no match is possible\n\n if (searchLength + start > stringLength) {\n return false;\n }\n\n var index = -1;\n\n while (++index < searchLength) {\n if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) {\n return false;\n }\n }\n\n return true;\n };\n\n if (defineProperty) {\n defineProperty(String.prototype, 'startsWith', {\n 'value': startsWith,\n 'configurable': true,\n 'writable': true\n });\n } else {\n String.prototype.startsWith = startsWith;\n }\n })();\n }\n\n if (!Object.keys) {\n Object.keys = function (o, // object\n k, // key\n r // result array\n ) {\n // initialize object and result\n r = []; // iterate over object keys\n\n for (k in o) {\n // fill result array with non-prototypical keys\n r.hasOwnProperty.call(o, k) && r.push(k);\n } // return result\n\n\n return r;\n };\n }\n\n if (HTMLSelectElement && !HTMLSelectElement.prototype.hasOwnProperty('selectedOptions')) {\n Object.defineProperty(HTMLSelectElement.prototype, 'selectedOptions', {\n get: function get() {\n return this.querySelectorAll(':checked');\n }\n });\n }\n\n function getSelectedOptions(select, ignoreDisabled) {\n var selectedOptions = select.selectedOptions,\n options = [],\n opt;\n\n if (ignoreDisabled) {\n for (var i = 0, len = selectedOptions.length; i < len; i++) {\n opt = selectedOptions[i];\n\n if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) {\n options.push(opt);\n }\n }\n\n return options;\n }\n\n return selectedOptions;\n } // much faster than $.val()\n\n\n function getSelectValues(select, selectedOptions) {\n var value = [],\n options = selectedOptions || select.selectedOptions,\n opt;\n\n for (var i = 0, len = options.length; i < len; i++) {\n opt = options[i];\n\n if (!(opt.disabled || opt.parentNode.tagName === 'OPTGROUP' && opt.parentNode.disabled)) {\n value.push(opt.value);\n }\n }\n\n if (!select.multiple) {\n return !value.length ? null : value[0];\n }\n\n return value;\n } // set data-selected on select element if the value has been programmatically selected\n // prior to initialization of bootstrap-select\n // * consider removing or replacing an alternative method *\n\n\n var valHooks = {\n useDefault: false,\n _set: $.valHooks.select.set\n };\n\n $.valHooks.select.set = function (elem, value) {\n if (value && !valHooks.useDefault) $(elem).data('selected', true);\n return valHooks._set.apply(this, arguments);\n };\n\n var changedArguments = null;\n\n var EventIsSupported = function () {\n try {\n new Event('change');\n return true;\n } catch (e) {\n return false;\n }\n }();\n\n $.fn.triggerNative = function (eventName) {\n var el = this[0],\n event;\n\n if (el.dispatchEvent) {\n // for modern browsers & IE9+\n if (EventIsSupported) {\n // For modern browsers\n event = new Event(eventName, {\n bubbles: true\n });\n } else {\n // For IE since it doesn't support Event constructor\n event = document.createEvent('Event');\n event.initEvent(eventName, true, false);\n }\n\n el.dispatchEvent(event);\n } else if (el.fireEvent) {\n // for IE8\n event = document.createEventObject();\n event.eventType = eventName;\n el.fireEvent('on' + eventName, event);\n } else {\n // fall back to jQuery.trigger\n this.trigger(eventName);\n }\n }; // \n\n\n function stringSearch(li, searchString, method, normalize) {\n var stringTypes = ['display', 'subtext', 'tokens'],\n searchSuccess = false;\n\n for (var i = 0; i < stringTypes.length; i++) {\n var stringType = stringTypes[i],\n string = li[stringType];\n\n if (string) {\n string = string.toString(); // Strip HTML tags. This isn't perfect, but it's much faster than any other method\n\n if (stringType === 'display') {\n string = string.replace(/<[^>]+>/g, '');\n }\n\n if (normalize) string = normalizeToBase(string);\n string = string.toUpperCase();\n\n if (method === 'contains') {\n searchSuccess = string.indexOf(searchString) >= 0;\n } else {\n searchSuccess = string.startsWith(searchString);\n }\n\n if (searchSuccess) break;\n }\n }\n\n return searchSuccess;\n }\n\n function toInteger(value) {\n return parseInt(value, 10) || 0;\n } // Borrowed from Lodash (_.deburr)\n\n /** Used to map Latin Unicode letters to basic Latin letters. */\n\n\n var deburredLetters = {\n // Latin-1 Supplement block.\n '\\xc0': 'A',\n '\\xc1': 'A',\n '\\xc2': 'A',\n '\\xc3': 'A',\n '\\xc4': 'A',\n '\\xc5': 'A',\n '\\xe0': 'a',\n '\\xe1': 'a',\n '\\xe2': 'a',\n '\\xe3': 'a',\n '\\xe4': 'a',\n '\\xe5': 'a',\n '\\xc7': 'C',\n '\\xe7': 'c',\n '\\xd0': 'D',\n '\\xf0': 'd',\n '\\xc8': 'E',\n '\\xc9': 'E',\n '\\xca': 'E',\n '\\xcb': 'E',\n '\\xe8': 'e',\n '\\xe9': 'e',\n '\\xea': 'e',\n '\\xeb': 'e',\n '\\xcc': 'I',\n '\\xcd': 'I',\n '\\xce': 'I',\n '\\xcf': 'I',\n '\\xec': 'i',\n '\\xed': 'i',\n '\\xee': 'i',\n '\\xef': 'i',\n '\\xd1': 'N',\n '\\xf1': 'n',\n '\\xd2': 'O',\n '\\xd3': 'O',\n '\\xd4': 'O',\n '\\xd5': 'O',\n '\\xd6': 'O',\n '\\xd8': 'O',\n '\\xf2': 'o',\n '\\xf3': 'o',\n '\\xf4': 'o',\n '\\xf5': 'o',\n '\\xf6': 'o',\n '\\xf8': 'o',\n '\\xd9': 'U',\n '\\xda': 'U',\n '\\xdb': 'U',\n '\\xdc': 'U',\n '\\xf9': 'u',\n '\\xfa': 'u',\n '\\xfb': 'u',\n '\\xfc': 'u',\n '\\xdd': 'Y',\n '\\xfd': 'y',\n '\\xff': 'y',\n '\\xc6': 'Ae',\n '\\xe6': 'ae',\n '\\xde': 'Th',\n '\\xfe': 'th',\n '\\xdf': 'ss',\n // Latin Extended-A block.\n \"\\u0100\": 'A',\n \"\\u0102\": 'A',\n \"\\u0104\": 'A',\n \"\\u0101\": 'a',\n \"\\u0103\": 'a',\n \"\\u0105\": 'a',\n \"\\u0106\": 'C',\n \"\\u0108\": 'C',\n \"\\u010A\": 'C',\n \"\\u010C\": 'C',\n \"\\u0107\": 'c',\n \"\\u0109\": 'c',\n \"\\u010B\": 'c',\n \"\\u010D\": 'c',\n \"\\u010E\": 'D',\n \"\\u0110\": 'D',\n \"\\u010F\": 'd',\n \"\\u0111\": 'd',\n \"\\u0112\": 'E',\n \"\\u0114\": 'E',\n \"\\u0116\": 'E',\n \"\\u0118\": 'E',\n \"\\u011A\": 'E',\n \"\\u0113\": 'e',\n \"\\u0115\": 'e',\n \"\\u0117\": 'e',\n \"\\u0119\": 'e',\n \"\\u011B\": 'e',\n \"\\u011C\": 'G',\n \"\\u011E\": 'G',\n \"\\u0120\": 'G',\n \"\\u0122\": 'G',\n \"\\u011D\": 'g',\n \"\\u011F\": 'g',\n \"\\u0121\": 'g',\n \"\\u0123\": 'g',\n \"\\u0124\": 'H',\n \"\\u0126\": 'H',\n \"\\u0125\": 'h',\n \"\\u0127\": 'h',\n \"\\u0128\": 'I',\n \"\\u012A\": 'I',\n \"\\u012C\": 'I',\n \"\\u012E\": 'I',\n \"\\u0130\": 'I',\n \"\\u0129\": 'i',\n \"\\u012B\": 'i',\n \"\\u012D\": 'i',\n \"\\u012F\": 'i',\n \"\\u0131\": 'i',\n \"\\u0134\": 'J',\n \"\\u0135\": 'j',\n \"\\u0136\": 'K',\n \"\\u0137\": 'k',\n \"\\u0138\": 'k',\n \"\\u0139\": 'L',\n \"\\u013B\": 'L',\n \"\\u013D\": 'L',\n \"\\u013F\": 'L',\n \"\\u0141\": 'L',\n \"\\u013A\": 'l',\n \"\\u013C\": 'l',\n \"\\u013E\": 'l',\n \"\\u0140\": 'l',\n \"\\u0142\": 'l',\n \"\\u0143\": 'N',\n \"\\u0145\": 'N',\n \"\\u0147\": 'N',\n \"\\u014A\": 'N',\n \"\\u0144\": 'n',\n \"\\u0146\": 'n',\n \"\\u0148\": 'n',\n \"\\u014B\": 'n',\n \"\\u014C\": 'O',\n \"\\u014E\": 'O',\n \"\\u0150\": 'O',\n \"\\u014D\": 'o',\n \"\\u014F\": 'o',\n \"\\u0151\": 'o',\n \"\\u0154\": 'R',\n \"\\u0156\": 'R',\n \"\\u0158\": 'R',\n \"\\u0155\": 'r',\n \"\\u0157\": 'r',\n \"\\u0159\": 'r',\n \"\\u015A\": 'S',\n \"\\u015C\": 'S',\n \"\\u015E\": 'S',\n \"\\u0160\": 'S',\n \"\\u015B\": 's',\n \"\\u015D\": 's',\n \"\\u015F\": 's',\n \"\\u0161\": 's',\n \"\\u0162\": 'T',\n \"\\u0164\": 'T',\n \"\\u0166\": 'T',\n \"\\u0163\": 't',\n \"\\u0165\": 't',\n \"\\u0167\": 't',\n \"\\u0168\": 'U',\n \"\\u016A\": 'U',\n \"\\u016C\": 'U',\n \"\\u016E\": 'U',\n \"\\u0170\": 'U',\n \"\\u0172\": 'U',\n \"\\u0169\": 'u',\n \"\\u016B\": 'u',\n \"\\u016D\": 'u',\n \"\\u016F\": 'u',\n \"\\u0171\": 'u',\n \"\\u0173\": 'u',\n \"\\u0174\": 'W',\n \"\\u0175\": 'w',\n \"\\u0176\": 'Y',\n \"\\u0177\": 'y',\n \"\\u0178\": 'Y',\n \"\\u0179\": 'Z',\n \"\\u017B\": 'Z',\n \"\\u017D\": 'Z',\n \"\\u017A\": 'z',\n \"\\u017C\": 'z',\n \"\\u017E\": 'z',\n \"\\u0132\": 'IJ',\n \"\\u0133\": 'ij',\n \"\\u0152\": 'Oe',\n \"\\u0153\": 'oe',\n \"\\u0149\": \"'n\",\n \"\\u017F\": 's'\n };\n /** Used to match Latin Unicode letters (excluding mathematical operators). */\n\n var reLatin = /[\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\xff\\u0100-\\u017f]/g;\n /** Used to compose unicode character classes. */\n\n var rsComboMarksRange = \"\\\\u0300-\\\\u036f\",\n reComboHalfMarksRange = \"\\\\ufe20-\\\\ufe2f\",\n rsComboSymbolsRange = \"\\\\u20d0-\\\\u20ff\",\n rsComboMarksExtendedRange = \"\\\\u1ab0-\\\\u1aff\",\n rsComboMarksSupplementRange = \"\\\\u1dc0-\\\\u1dff\",\n rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange + rsComboMarksExtendedRange + rsComboMarksSupplementRange;\n /** Used to compose unicode capture groups. */\n\n var rsCombo = '[' + rsComboRange + ']';\n /**\r\n * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and\r\n * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).\r\n */\n\n var reComboMark = RegExp(rsCombo, 'g');\n\n function deburrLetter(key) {\n return deburredLetters[key];\n }\n\n ;\n\n function normalizeToBase(string) {\n string = string.toString();\n return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');\n } // List of HTML entities for escaping.\n\n\n var escapeMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n }; // Functions for escaping and unescaping strings to/from HTML interpolation.\n\n var createEscaper = function createEscaper(map) {\n var escaper = function escaper(match) {\n return map[match];\n }; // Regexes for identifying a key that needs to be escaped.\n\n\n var source = '(?:' + Object.keys(map).join('|') + ')';\n var testRegexp = RegExp(source);\n var replaceRegexp = RegExp(source, 'g');\n return function (string) {\n string = string == null ? '' : '' + string;\n return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;\n };\n };\n\n var htmlEscape = createEscaper(escapeMap);\n /**\r\n * ------------------------------------------------------------------------\r\n * Constants\r\n * ------------------------------------------------------------------------\r\n */\n\n var keyCodeMap = {\n 32: ' ',\n 48: '0',\n 49: '1',\n 50: '2',\n 51: '3',\n 52: '4',\n 53: '5',\n 54: '6',\n 55: '7',\n 56: '8',\n 57: '9',\n 59: ';',\n 65: 'A',\n 66: 'B',\n 67: 'C',\n 68: 'D',\n 69: 'E',\n 70: 'F',\n 71: 'G',\n 72: 'H',\n 73: 'I',\n 74: 'J',\n 75: 'K',\n 76: 'L',\n 77: 'M',\n 78: 'N',\n 79: 'O',\n 80: 'P',\n 81: 'Q',\n 82: 'R',\n 83: 'S',\n 84: 'T',\n 85: 'U',\n 86: 'V',\n 87: 'W',\n 88: 'X',\n 89: 'Y',\n 90: 'Z',\n 96: '0',\n 97: '1',\n 98: '2',\n 99: '3',\n 100: '4',\n 101: '5',\n 102: '6',\n 103: '7',\n 104: '8',\n 105: '9'\n };\n var keyCodes = {\n ESCAPE: 27,\n // KeyboardEvent.which value for Escape (Esc) key\n ENTER: 13,\n // KeyboardEvent.which value for Enter key\n SPACE: 32,\n // KeyboardEvent.which value for space key\n TAB: 9,\n // KeyboardEvent.which value for tab key\n ARROW_UP: 38,\n // KeyboardEvent.which value for up arrow key\n ARROW_DOWN: 40 // KeyboardEvent.which value for down arrow key\n\n };\n var version = {\n success: false,\n major: '3'\n };\n\n try {\n version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.');\n version.major = version.full[0];\n version.success = true;\n } catch (err) {// do nothing\n }\n\n var selectId = 0;\n var EVENT_KEY = '.bs.select';\n var classNames = {\n DISABLED: 'disabled',\n DIVIDER: 'divider',\n SHOW: 'open',\n DROPUP: 'dropup',\n MENU: 'dropdown-menu',\n MENURIGHT: 'dropdown-menu-right',\n MENULEFT: 'dropdown-menu-left',\n // to-do: replace with more advanced template/customization options\n BUTTONCLASS: 'btn-default',\n POPOVERHEADER: 'popover-title',\n ICONBASE: 'glyphicon',\n TICKICON: 'glyphicon-ok'\n };\n var Selector = {\n MENU: '.' + classNames.MENU\n };\n var elementTemplates = {\n div: document.createElement('div'),\n span: document.createElement('span'),\n i: document.createElement('i'),\n subtext: document.createElement('small'),\n a: document.createElement('a'),\n li: document.createElement('li'),\n whitespace: document.createTextNode(\"\\xA0\"),\n fragment: document.createDocumentFragment()\n };\n elementTemplates.noResults = elementTemplates.li.cloneNode(false);\n elementTemplates.noResults.className = 'no-results';\n elementTemplates.a.setAttribute('role', 'option');\n elementTemplates.a.className = 'dropdown-item';\n elementTemplates.subtext.className = 'text-muted';\n elementTemplates.text = elementTemplates.span.cloneNode(false);\n elementTemplates.text.className = 'text';\n elementTemplates.checkMark = elementTemplates.span.cloneNode(false);\n var REGEXP_ARROW = new RegExp(keyCodes.ARROW_UP + '|' + keyCodes.ARROW_DOWN);\n var REGEXP_TAB_OR_ESCAPE = new RegExp('^' + keyCodes.TAB + '$|' + keyCodes.ESCAPE);\n var generateOption = {\n li: function li(content, classes, optgroup) {\n var li = elementTemplates.li.cloneNode(false);\n\n if (content) {\n if (content.nodeType === 1 || content.nodeType === 11) {\n li.appendChild(content);\n } else {\n li.innerHTML = content;\n }\n }\n\n if (typeof classes !== 'undefined' && classes !== '') li.className = classes;\n if (typeof optgroup !== 'undefined' && optgroup !== null) li.classList.add('optgroup-' + optgroup);\n return li;\n },\n a: function a(text, classes, inline) {\n var a = elementTemplates.a.cloneNode(true);\n\n if (text) {\n if (text.nodeType === 11) {\n a.appendChild(text);\n } else {\n a.insertAdjacentHTML('beforeend', text);\n }\n }\n\n if (typeof classes !== 'undefined' && classes !== '') a.classList.add.apply(a.classList, classes.split(/\\s+/));\n if (inline) a.setAttribute('style', inline);\n return a;\n },\n text: function text(options, useFragment) {\n var textElement = elementTemplates.text.cloneNode(false),\n subtextElement,\n iconElement;\n\n if (options.content) {\n textElement.innerHTML = options.content;\n } else {\n textElement.textContent = options.text;\n\n if (options.icon) {\n var whitespace = elementTemplates.whitespace.cloneNode(false); // need to use for icons in the button to prevent a breaking change\n // note: switch to span in next major release\n\n iconElement = (useFragment === true ? elementTemplates.i : elementTemplates.span).cloneNode(false);\n iconElement.className = this.options.iconBase + ' ' + options.icon;\n elementTemplates.fragment.appendChild(iconElement);\n elementTemplates.fragment.appendChild(whitespace);\n }\n\n if (options.subtext) {\n subtextElement = elementTemplates.subtext.cloneNode(false);\n subtextElement.textContent = options.subtext;\n textElement.appendChild(subtextElement);\n }\n }\n\n if (useFragment === true) {\n while (textElement.childNodes.length > 0) {\n elementTemplates.fragment.appendChild(textElement.childNodes[0]);\n }\n } else {\n elementTemplates.fragment.appendChild(textElement);\n }\n\n return elementTemplates.fragment;\n },\n label: function label(options) {\n var textElement = elementTemplates.text.cloneNode(false),\n subtextElement,\n iconElement;\n textElement.innerHTML = options.display;\n\n if (options.icon) {\n var whitespace = elementTemplates.whitespace.cloneNode(false);\n iconElement = elementTemplates.span.cloneNode(false);\n iconElement.className = this.options.iconBase + ' ' + options.icon;\n elementTemplates.fragment.appendChild(iconElement);\n elementTemplates.fragment.appendChild(whitespace);\n }\n\n if (options.subtext) {\n subtextElement = elementTemplates.subtext.cloneNode(false);\n subtextElement.textContent = options.subtext;\n textElement.appendChild(subtextElement);\n }\n\n elementTemplates.fragment.appendChild(textElement);\n return elementTemplates.fragment;\n }\n };\n\n function showNoResults(searchMatch, searchValue) {\n if (!searchMatch.length) {\n elementTemplates.noResults.innerHTML = this.options.noneResultsText.replace('{0}', '\"' + htmlEscape(searchValue) + '\"');\n this.$menuInner[0].firstChild.appendChild(elementTemplates.noResults);\n }\n }\n\n var Selectpicker = function Selectpicker(element, options) {\n var that = this; // bootstrap-select has been initialized - revert valHooks.select.set back to its original function\n\n if (!valHooks.useDefault) {\n $.valHooks.select.set = valHooks._set;\n valHooks.useDefault = true;\n }\n\n this.$element = $(element);\n this.$newElement = null;\n this.$button = null;\n this.$menu = null;\n this.options = options;\n this.selectpicker = {\n main: {},\n search: {},\n current: {},\n // current changes if a search is in progress\n view: {},\n isSearching: false,\n keydown: {\n keyHistory: '',\n resetKeyHistory: {\n start: function start() {\n return setTimeout(function () {\n that.selectpicker.keydown.keyHistory = '';\n }, 800);\n }\n }\n }\n };\n this.sizeInfo = {}; // If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a\n // data-attribute)\n\n if (this.options.title === null) {\n this.options.title = this.$element.attr('title');\n } // Format window padding\n\n\n var winPad = this.options.windowPadding;\n\n if (typeof winPad === 'number') {\n this.options.windowPadding = [winPad, winPad, winPad, winPad];\n } // Expose public methods\n\n\n this.val = Selectpicker.prototype.val;\n this.render = Selectpicker.prototype.render;\n this.refresh = Selectpicker.prototype.refresh;\n this.setStyle = Selectpicker.prototype.setStyle;\n this.selectAll = Selectpicker.prototype.selectAll;\n this.deselectAll = Selectpicker.prototype.deselectAll;\n this.destroy = Selectpicker.prototype.destroy;\n this.remove = Selectpicker.prototype.remove;\n this.show = Selectpicker.prototype.show;\n this.hide = Selectpicker.prototype.hide;\n this.init();\n };\n\n Selectpicker.VERSION = '1.13.18'; // part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both.\n\n Selectpicker.DEFAULTS = {\n noneSelectedText: 'Nothing selected',\n noneResultsText: 'No results matched {0}',\n countSelectedText: function countSelectedText(numSelected, numTotal) {\n return numSelected == 1 ? '{0} item selected' : '{0} items selected';\n },\n maxOptionsText: function maxOptionsText(numAll, numGroup) {\n return [numAll == 1 ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)', numGroup == 1 ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)'];\n },\n selectAllText: 'Select All',\n deselectAllText: 'Deselect All',\n doneButton: false,\n doneButtonText: 'Close',\n multipleSeparator: ', ',\n styleBase: 'btn',\n style: classNames.BUTTONCLASS,\n size: 'auto',\n title: null,\n selectedTextFormat: 'values',\n width: false,\n container: false,\n hideDisabled: false,\n showSubtext: false,\n showIcon: true,\n showContent: true,\n dropupAuto: true,\n header: false,\n liveSearch: false,\n liveSearchPlaceholder: null,\n liveSearchNormalize: false,\n liveSearchStyle: 'contains',\n actionsBox: false,\n iconBase: classNames.ICONBASE,\n tickIcon: classNames.TICKICON,\n showTick: false,\n template: {\n caret: ''\n },\n maxOptions: false,\n mobile: false,\n selectOnTab: false,\n dropdownAlignRight: false,\n windowPadding: 0,\n virtualScroll: 600,\n display: false,\n sanitize: true,\n sanitizeFn: null,\n whiteList: DefaultWhitelist\n };\n Selectpicker.prototype = {\n constructor: Selectpicker,\n init: function init() {\n var that = this,\n id = this.$element.attr('id'),\n element = this.$element[0],\n form = element.form;\n selectId++;\n this.selectId = 'bs-select-' + selectId;\n element.classList.add('bs-select-hidden');\n this.multiple = this.$element.prop('multiple');\n this.autofocus = this.$element.prop('autofocus');\n\n if (element.classList.contains('show-tick')) {\n this.options.showTick = true;\n }\n\n this.$newElement = this.createDropdown();\n this.buildData();\n this.$element.after(this.$newElement).prependTo(this.$newElement); // ensure select is associated with form element if it got unlinked after moving it inside newElement\n\n if (form && element.form === null) {\n if (!form.id) form.id = 'form-' + this.selectId;\n element.setAttribute('form', form.id);\n }\n\n this.$button = this.$newElement.children('button');\n this.$menu = this.$newElement.children(Selector.MENU);\n this.$menuInner = this.$menu.children('.inner');\n this.$searchbox = this.$menu.find('input');\n element.classList.remove('bs-select-hidden');\n if (this.options.dropdownAlignRight === true) this.$menu[0].classList.add(classNames.MENURIGHT);\n\n if (typeof id !== 'undefined') {\n this.$button.attr('data-id', id);\n }\n\n this.checkDisabled();\n this.clickListener();\n\n if (this.options.liveSearch) {\n this.liveSearchListener();\n this.focusedParent = this.$searchbox[0];\n } else {\n this.focusedParent = this.$menuInner[0];\n }\n\n this.setStyle();\n this.render();\n this.setWidth();\n\n if (this.options.container) {\n this.selectPosition();\n } else {\n this.$element.on('hide' + EVENT_KEY, function () {\n if (that.isVirtual()) {\n // empty menu on close\n var menuInner = that.$menuInner[0],\n emptyMenu = menuInner.firstChild.cloneNode(false); // replace the existing UL with an empty one - this is faster than $.empty() or innerHTML = ''\n\n menuInner.replaceChild(emptyMenu, menuInner.firstChild);\n menuInner.scrollTop = 0;\n }\n });\n }\n\n this.$menu.data('this', this);\n this.$newElement.data('this', this);\n if (this.options.mobile) this.mobile();\n this.$newElement.on({\n 'hide.bs.dropdown': function hideBsDropdown(e) {\n that.$element.trigger('hide' + EVENT_KEY, e);\n },\n 'hidden.bs.dropdown': function hiddenBsDropdown(e) {\n that.$element.trigger('hidden' + EVENT_KEY, e);\n },\n 'show.bs.dropdown': function showBsDropdown(e) {\n that.$element.trigger('show' + EVENT_KEY, e);\n },\n 'shown.bs.dropdown': function shownBsDropdown(e) {\n that.$element.trigger('shown' + EVENT_KEY, e);\n }\n });\n\n if (element.hasAttribute('required')) {\n this.$element.on('invalid' + EVENT_KEY, function () {\n that.$button[0].classList.add('bs-invalid');\n that.$element.on('shown' + EVENT_KEY + '.invalid', function () {\n that.$element.val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened\n .off('shown' + EVENT_KEY + '.invalid');\n }).on('rendered' + EVENT_KEY, function () {\n // if select is no longer invalid, remove the bs-invalid class\n if (this.validity.valid) that.$button[0].classList.remove('bs-invalid');\n that.$element.off('rendered' + EVENT_KEY);\n });\n that.$button.on('blur' + EVENT_KEY, function () {\n that.$element.trigger('focus').trigger('blur');\n that.$button.off('blur' + EVENT_KEY);\n });\n });\n }\n\n setTimeout(function () {\n that.buildList();\n that.$element.trigger('loaded' + EVENT_KEY);\n });\n },\n createDropdown: function createDropdown() {\n // Options\n // If we are multiple or showTick option is set, then add the show-tick class\n var showTick = this.multiple || this.options.showTick ? ' show-tick' : '',\n multiselectable = this.multiple ? ' aria-multiselectable=\"true\"' : '',\n inputGroup = '',\n autofocus = this.autofocus ? ' autofocus' : '';\n\n if (version.major < 4 && this.$element.parent().hasClass('input-group')) {\n inputGroup = ' input-group-btn';\n } // Elements\n\n\n var drop,\n header = '',\n searchbox = '',\n actionsbox = '',\n donebutton = '';\n\n if (this.options.header) {\n header = '
        ' + '' + this.options.header + '
        ';\n }\n\n if (this.options.liveSearch) {\n searchbox = '
        ' + '' + '
        ';\n }\n\n if (this.multiple && this.options.actionsBox) {\n actionsbox = '
        ' + '
        ' + '' + '' + '
        ' + '
        ';\n }\n\n if (this.multiple && this.options.doneButton) {\n donebutton = '
        ' + '
        ' + '' + '
        ' + '
        ';\n }\n\n drop = '
        ' + '' + '
        ' + header + searchbox + actionsbox + '
        ' + '
          ' + '
        ' + '
        ' + donebutton + '
        ' + '
        ';\n return $(drop);\n },\n setPositionData: function setPositionData() {\n this.selectpicker.view.canHighlight = [];\n this.selectpicker.view.size = 0;\n this.selectpicker.view.firstHighlightIndex = false;\n\n for (var i = 0; i < this.selectpicker.current.data.length; i++) {\n var li = this.selectpicker.current.data[i],\n canHighlight = true;\n\n if (li.type === 'divider') {\n canHighlight = false;\n li.height = this.sizeInfo.dividerHeight;\n } else if (li.type === 'optgroup-label') {\n canHighlight = false;\n li.height = this.sizeInfo.dropdownHeaderHeight;\n } else {\n li.height = this.sizeInfo.liHeight;\n }\n\n if (li.disabled) canHighlight = false;\n this.selectpicker.view.canHighlight.push(canHighlight);\n\n if (canHighlight) {\n this.selectpicker.view.size++;\n li.posinset = this.selectpicker.view.size;\n if (this.selectpicker.view.firstHighlightIndex === false) this.selectpicker.view.firstHighlightIndex = i;\n }\n\n li.position = (i === 0 ? 0 : this.selectpicker.current.data[i - 1].position) + li.height;\n }\n },\n isVirtual: function isVirtual() {\n return this.options.virtualScroll !== false && this.selectpicker.main.elements.length >= this.options.virtualScroll || this.options.virtualScroll === true;\n },\n createView: function createView(isSearching, setSize, refresh) {\n var that = this,\n scrollTop = 0,\n active = [],\n selected,\n prevActive;\n this.selectpicker.isSearching = isSearching;\n this.selectpicker.current = isSearching ? this.selectpicker.search : this.selectpicker.main;\n this.setPositionData();\n\n if (setSize) {\n if (refresh) {\n scrollTop = this.$menuInner[0].scrollTop;\n } else if (!that.multiple) {\n var element = that.$element[0],\n selectedIndex = (element.options[element.selectedIndex] || {}).liIndex;\n\n if (typeof selectedIndex === 'number' && that.options.size !== false) {\n var selectedData = that.selectpicker.main.data[selectedIndex],\n position = selectedData && selectedData.position;\n\n if (position) {\n scrollTop = position - (that.sizeInfo.menuInnerHeight + that.sizeInfo.liHeight) / 2;\n }\n }\n }\n }\n\n scroll(scrollTop, true);\n this.$menuInner.off('scroll.createView').on('scroll.createView', function (e, updateValue) {\n if (!that.noScroll) scroll(this.scrollTop, updateValue);\n that.noScroll = false;\n });\n\n function scroll(scrollTop, init) {\n var size = that.selectpicker.current.elements.length,\n chunks = [],\n chunkSize,\n chunkCount,\n firstChunk,\n lastChunk,\n currentChunk,\n prevPositions,\n positionIsDifferent,\n previousElements,\n menuIsDifferent = true,\n isVirtual = that.isVirtual();\n that.selectpicker.view.scrollTop = scrollTop;\n chunkSize = Math.ceil(that.sizeInfo.menuInnerHeight / that.sizeInfo.liHeight * 1.5); // number of options in a chunk\n\n chunkCount = Math.round(size / chunkSize) || 1; // number of chunks\n\n for (var i = 0; i < chunkCount; i++) {\n var endOfChunk = (i + 1) * chunkSize;\n\n if (i === chunkCount - 1) {\n endOfChunk = size;\n }\n\n chunks[i] = [i * chunkSize + (!i ? 0 : 1), endOfChunk];\n if (!size) break;\n\n if (currentChunk === undefined && scrollTop - 1 <= that.selectpicker.current.data[endOfChunk - 1].position - that.sizeInfo.menuInnerHeight) {\n currentChunk = i;\n }\n }\n\n if (currentChunk === undefined) currentChunk = 0;\n prevPositions = [that.selectpicker.view.position0, that.selectpicker.view.position1]; // always display previous, current, and next chunks\n\n firstChunk = Math.max(0, currentChunk - 1);\n lastChunk = Math.min(chunkCount - 1, currentChunk + 1);\n that.selectpicker.view.position0 = isVirtual === false ? 0 : Math.max(0, chunks[firstChunk][0]) || 0;\n that.selectpicker.view.position1 = isVirtual === false ? size : Math.min(size, chunks[lastChunk][1]) || 0;\n positionIsDifferent = prevPositions[0] !== that.selectpicker.view.position0 || prevPositions[1] !== that.selectpicker.view.position1;\n\n if (that.activeIndex !== undefined) {\n prevActive = that.selectpicker.main.elements[that.prevActiveIndex];\n active = that.selectpicker.main.elements[that.activeIndex];\n selected = that.selectpicker.main.elements[that.selectedIndex];\n\n if (init) {\n if (that.activeIndex !== that.selectedIndex) {\n that.defocusItem(active);\n }\n\n that.activeIndex = undefined;\n }\n\n if (that.activeIndex && that.activeIndex !== that.selectedIndex) {\n that.defocusItem(selected);\n }\n }\n\n if (that.prevActiveIndex !== undefined && that.prevActiveIndex !== that.activeIndex && that.prevActiveIndex !== that.selectedIndex) {\n that.defocusItem(prevActive);\n }\n\n if (init || positionIsDifferent) {\n previousElements = that.selectpicker.view.visibleElements ? that.selectpicker.view.visibleElements.slice() : [];\n\n if (isVirtual === false) {\n that.selectpicker.view.visibleElements = that.selectpicker.current.elements;\n } else {\n that.selectpicker.view.visibleElements = that.selectpicker.current.elements.slice(that.selectpicker.view.position0, that.selectpicker.view.position1);\n }\n\n that.setOptionStatus(); // if searching, check to make sure the list has actually been updated before updating DOM\n // this prevents unnecessary repaints\n\n if (isSearching || isVirtual === false && init) menuIsDifferent = !isEqual(previousElements, that.selectpicker.view.visibleElements); // if virtual scroll is disabled and not searching,\n // menu should never need to be updated more than once\n\n if ((init || isVirtual === true) && menuIsDifferent) {\n var menuInner = that.$menuInner[0],\n menuFragment = document.createDocumentFragment(),\n emptyMenu = menuInner.firstChild.cloneNode(false),\n marginTop,\n marginBottom,\n elements = that.selectpicker.view.visibleElements,\n toSanitize = []; // replace the existing UL with an empty one - this is faster than $.empty()\n\n menuInner.replaceChild(emptyMenu, menuInner.firstChild);\n\n for (var i = 0, visibleElementsLen = elements.length; i < visibleElementsLen; i++) {\n var element = elements[i],\n elText,\n elementData;\n\n if (that.options.sanitize) {\n elText = element.lastChild;\n\n if (elText) {\n elementData = that.selectpicker.current.data[i + that.selectpicker.view.position0];\n\n if (elementData && elementData.content && !elementData.sanitized) {\n toSanitize.push(elText);\n elementData.sanitized = true;\n }\n }\n }\n\n menuFragment.appendChild(element);\n }\n\n if (that.options.sanitize && toSanitize.length) {\n sanitizeHtml(toSanitize, that.options.whiteList, that.options.sanitizeFn);\n }\n\n if (isVirtual === true) {\n marginTop = that.selectpicker.view.position0 === 0 ? 0 : that.selectpicker.current.data[that.selectpicker.view.position0 - 1].position;\n marginBottom = that.selectpicker.view.position1 > size - 1 ? 0 : that.selectpicker.current.data[size - 1].position - that.selectpicker.current.data[that.selectpicker.view.position1 - 1].position;\n menuInner.firstChild.style.marginTop = marginTop + 'px';\n menuInner.firstChild.style.marginBottom = marginBottom + 'px';\n } else {\n menuInner.firstChild.style.marginTop = 0;\n menuInner.firstChild.style.marginBottom = 0;\n }\n\n menuInner.firstChild.appendChild(menuFragment); // if an option is encountered that is wider than the current menu width, update the menu width accordingly\n // switch to ResizeObserver with increased browser support\n\n if (isVirtual === true && that.sizeInfo.hasScrollBar) {\n var menuInnerInnerWidth = menuInner.firstChild.offsetWidth;\n\n if (init && menuInnerInnerWidth < that.sizeInfo.menuInnerInnerWidth && that.sizeInfo.totalMenuWidth > that.sizeInfo.selectWidth) {\n menuInner.firstChild.style.minWidth = that.sizeInfo.menuInnerInnerWidth + 'px';\n } else if (menuInnerInnerWidth > that.sizeInfo.menuInnerInnerWidth) {\n // set to 0 to get actual width of menu\n that.$menu[0].style.minWidth = 0;\n var actualMenuWidth = menuInner.firstChild.offsetWidth;\n\n if (actualMenuWidth > that.sizeInfo.menuInnerInnerWidth) {\n that.sizeInfo.menuInnerInnerWidth = actualMenuWidth;\n menuInner.firstChild.style.minWidth = that.sizeInfo.menuInnerInnerWidth + 'px';\n } // reset to default CSS styling\n\n\n that.$menu[0].style.minWidth = '';\n }\n }\n }\n }\n\n that.prevActiveIndex = that.activeIndex;\n\n if (!that.options.liveSearch) {\n that.$menuInner.trigger('focus');\n } else if (isSearching && init) {\n var index = 0,\n newActive;\n\n if (!that.selectpicker.view.canHighlight[index]) {\n index = 1 + that.selectpicker.view.canHighlight.slice(1).indexOf(true);\n }\n\n newActive = that.selectpicker.view.visibleElements[index];\n that.defocusItem(that.selectpicker.view.currentActive);\n that.activeIndex = (that.selectpicker.current.data[index] || {}).index;\n that.focusItem(newActive);\n }\n }\n\n $(window).off('resize' + EVENT_KEY + '.' + this.selectId + '.createView').on('resize' + EVENT_KEY + '.' + this.selectId + '.createView', function () {\n var isActive = that.$newElement.hasClass(classNames.SHOW);\n if (isActive) scroll(that.$menuInner[0].scrollTop);\n });\n },\n focusItem: function focusItem(li, liData, noStyle) {\n if (li) {\n liData = liData || this.selectpicker.main.data[this.activeIndex];\n var a = li.firstChild;\n\n if (a) {\n a.setAttribute('aria-setsize', this.selectpicker.view.size);\n a.setAttribute('aria-posinset', liData.posinset);\n\n if (noStyle !== true) {\n this.focusedParent.setAttribute('aria-activedescendant', a.id);\n li.classList.add('active');\n a.classList.add('active');\n }\n }\n }\n },\n defocusItem: function defocusItem(li) {\n if (li) {\n li.classList.remove('active');\n if (li.firstChild) li.firstChild.classList.remove('active');\n }\n },\n setPlaceholder: function setPlaceholder() {\n var that = this,\n updateIndex = false;\n\n if (this.options.title && !this.multiple) {\n if (!this.selectpicker.view.titleOption) this.selectpicker.view.titleOption = document.createElement('option'); // this option doesn't create a new
      • element, but does add a new option at the start,\n // so startIndex should increase to prevent having to check every option for the bs-title-option class\n\n updateIndex = true;\n var element = this.$element[0],\n selectTitleOption = false,\n titleNotAppended = !this.selectpicker.view.titleOption.parentNode,\n selectedIndex = element.selectedIndex,\n selectedOption = element.options[selectedIndex],\n navigation = window.performance && window.performance.getEntriesByType('navigation'),\n // Safari doesn't support getEntriesByType('navigation') - fall back to performance.navigation\n isNotBackForward = navigation && navigation.length ? navigation[0].type !== 'back_forward' : window.performance.navigation.type !== 2;\n\n if (titleNotAppended) {\n // Use native JS to prepend option (faster)\n this.selectpicker.view.titleOption.className = 'bs-title-option';\n this.selectpicker.view.titleOption.value = ''; // Check if selected or data-selected attribute is already set on an option. If not, select the titleOption option.\n // the selected item may have been changed by user or programmatically before the bootstrap select plugin runs,\n // if so, the select will have the data-selected attribute\n\n selectTitleOption = !selectedOption || selectedIndex === 0 && selectedOption.defaultSelected === false && this.$element.data('selected') === undefined;\n }\n\n if (titleNotAppended || this.selectpicker.view.titleOption.index !== 0) {\n element.insertBefore(this.selectpicker.view.titleOption, element.firstChild);\n } // Set selected *after* appending to select,\n // otherwise the option doesn't get selected in IE\n // set using selectedIndex, as setting the selected attr to true here doesn't work in IE11\n\n\n if (selectTitleOption && isNotBackForward) {\n element.selectedIndex = 0;\n } else if (document.readyState !== 'complete') {\n // if navigation type is back_forward, there's a chance the select will have its value set by BFCache\n // wait for that value to be set, then run render again\n window.addEventListener('pageshow', function () {\n if (that.selectpicker.view.displayedValue !== element.value) that.render();\n });\n }\n }\n\n return updateIndex;\n },\n buildData: function buildData() {\n var optionSelector = ':not([hidden]):not([data-hidden=\"true\"])',\n mainData = [],\n optID = 0,\n startIndex = this.setPlaceholder() ? 1 : 0; // append the titleOption if necessary and skip the first option in the loop\n\n if (this.options.hideDisabled) optionSelector += ':not(:disabled)';\n var selectOptions = this.$element[0].querySelectorAll('select > *' + optionSelector);\n\n function addDivider(config) {\n var previousData = mainData[mainData.length - 1]; // ensure optgroup doesn't create back-to-back dividers\n\n if (previousData && previousData.type === 'divider' && (previousData.optID || config.optID)) {\n return;\n }\n\n config = config || {};\n config.type = 'divider';\n mainData.push(config);\n }\n\n function addOption(option, config) {\n config = config || {};\n config.divider = option.getAttribute('data-divider') === 'true';\n\n if (config.divider) {\n addDivider({\n optID: config.optID\n });\n } else {\n var liIndex = mainData.length,\n cssText = option.style.cssText,\n inlineStyle = cssText ? htmlEscape(cssText) : '',\n optionClass = (option.className || '') + (config.optgroupClass || '');\n if (config.optID) optionClass = 'opt ' + optionClass;\n config.optionClass = optionClass.trim();\n config.inlineStyle = inlineStyle;\n config.text = option.textContent;\n config.content = option.getAttribute('data-content');\n config.tokens = option.getAttribute('data-tokens');\n config.subtext = option.getAttribute('data-subtext');\n config.icon = option.getAttribute('data-icon');\n option.liIndex = liIndex;\n config.display = config.content || config.text;\n config.type = 'option';\n config.index = liIndex;\n config.option = option;\n config.selected = !!option.selected;\n config.disabled = config.disabled || !!option.disabled;\n mainData.push(config);\n }\n }\n\n function addOptgroup(index, selectOptions) {\n var optgroup = selectOptions[index],\n // skip placeholder option\n previous = index - 1 < startIndex ? false : selectOptions[index - 1],\n next = selectOptions[index + 1],\n options = optgroup.querySelectorAll('option' + optionSelector);\n if (!options.length) return;\n var config = {\n display: htmlEscape(optgroup.label),\n subtext: optgroup.getAttribute('data-subtext'),\n icon: optgroup.getAttribute('data-icon'),\n type: 'optgroup-label',\n optgroupClass: ' ' + (optgroup.className || '')\n },\n headerIndex,\n lastIndex;\n optID++;\n\n if (previous) {\n addDivider({\n optID: optID\n });\n }\n\n config.optID = optID;\n mainData.push(config);\n\n for (var j = 0, len = options.length; j < len; j++) {\n var option = options[j];\n\n if (j === 0) {\n headerIndex = mainData.length - 1;\n lastIndex = headerIndex + len;\n }\n\n addOption(option, {\n headerIndex: headerIndex,\n lastIndex: lastIndex,\n optID: config.optID,\n optgroupClass: config.optgroupClass,\n disabled: optgroup.disabled\n });\n }\n\n if (next) {\n addDivider({\n optID: optID\n });\n }\n }\n\n for (var len = selectOptions.length, i = startIndex; i < len; i++) {\n var item = selectOptions[i];\n\n if (item.tagName !== 'OPTGROUP') {\n addOption(item, {});\n } else {\n addOptgroup(i, selectOptions);\n }\n }\n\n this.selectpicker.main.data = this.selectpicker.current.data = mainData;\n },\n buildList: function buildList() {\n var that = this,\n selectData = this.selectpicker.main.data,\n mainElements = [],\n widestOptionLength = 0;\n\n if ((that.options.showTick || that.multiple) && !elementTemplates.checkMark.parentNode) {\n elementTemplates.checkMark.className = this.options.iconBase + ' ' + that.options.tickIcon + ' check-mark';\n elementTemplates.a.appendChild(elementTemplates.checkMark);\n }\n\n function buildElement(item) {\n var liElement,\n combinedLength = 0;\n\n switch (item.type) {\n case 'divider':\n liElement = generateOption.li(false, classNames.DIVIDER, item.optID ? item.optID + 'div' : undefined);\n break;\n\n case 'option':\n liElement = generateOption.li(generateOption.a(generateOption.text.call(that, item), item.optionClass, item.inlineStyle), '', item.optID);\n\n if (liElement.firstChild) {\n liElement.firstChild.id = that.selectId + '-' + item.index;\n }\n\n break;\n\n case 'optgroup-label':\n liElement = generateOption.li(generateOption.label.call(that, item), 'dropdown-header' + item.optgroupClass, item.optID);\n break;\n }\n\n item.element = liElement;\n mainElements.push(liElement); // count the number of characters in the option - not perfect, but should work in most cases\n\n if (item.display) combinedLength += item.display.length;\n if (item.subtext) combinedLength += item.subtext.length; // if there is an icon, ensure this option's width is checked\n\n if (item.icon) combinedLength += 1;\n\n if (combinedLength > widestOptionLength) {\n widestOptionLength = combinedLength; // guess which option is the widest\n // use this when calculating menu width\n // not perfect, but it's fast, and the width will be updating accordingly when scrolling\n\n that.selectpicker.view.widestOption = mainElements[mainElements.length - 1];\n }\n }\n\n for (var len = selectData.length, i = 0; i < len; i++) {\n var item = selectData[i];\n buildElement(item);\n }\n\n this.selectpicker.main.elements = this.selectpicker.current.elements = mainElements;\n },\n findLis: function findLis() {\n return this.$menuInner.find('.inner > li');\n },\n render: function render() {\n var that = this,\n element = this.$element[0],\n // ensure titleOption is appended and selected (if necessary) before getting selectedOptions\n placeholderSelected = this.setPlaceholder() && element.selectedIndex === 0,\n selectedOptions = getSelectedOptions(element, this.options.hideDisabled),\n selectedCount = selectedOptions.length,\n button = this.$button[0],\n buttonInner = button.querySelector('.filter-option-inner-inner'),\n multipleSeparator = document.createTextNode(this.options.multipleSeparator),\n titleFragment = elementTemplates.fragment.cloneNode(false),\n showCount,\n countMax,\n hasContent = false;\n button.classList.toggle('bs-placeholder', that.multiple ? !selectedCount : !getSelectValues(element, selectedOptions));\n\n if (!that.multiple && selectedOptions.length === 1) {\n that.selectpicker.view.displayedValue = getSelectValues(element, selectedOptions);\n }\n\n if (this.options.selectedTextFormat === 'static') {\n titleFragment = generateOption.text.call(this, {\n text: this.options.title\n }, true);\n } else {\n showCount = this.multiple && this.options.selectedTextFormat.indexOf('count') !== -1 && selectedCount > 1; // determine if the number of selected options will be shown (showCount === true)\n\n if (showCount) {\n countMax = this.options.selectedTextFormat.split('>');\n showCount = countMax.length > 1 && selectedCount > countMax[1] || countMax.length === 1 && selectedCount >= 2;\n } // only loop through all selected options if the count won't be shown\n\n\n if (showCount === false) {\n if (!placeholderSelected) {\n for (var selectedIndex = 0; selectedIndex < selectedCount; selectedIndex++) {\n if (selectedIndex < 50) {\n var option = selectedOptions[selectedIndex],\n thisData = this.selectpicker.main.data[option.liIndex],\n titleOptions = {};\n\n if (this.multiple && selectedIndex > 0) {\n titleFragment.appendChild(multipleSeparator.cloneNode(false));\n }\n\n if (option.title) {\n titleOptions.text = option.title;\n } else if (thisData) {\n if (thisData.content && that.options.showContent) {\n titleOptions.content = thisData.content.toString();\n hasContent = true;\n } else {\n if (that.options.showIcon) {\n titleOptions.icon = thisData.icon;\n }\n\n if (that.options.showSubtext && !that.multiple && thisData.subtext) titleOptions.subtext = ' ' + thisData.subtext;\n titleOptions.text = option.textContent.trim();\n }\n }\n\n titleFragment.appendChild(generateOption.text.call(this, titleOptions, true));\n } else {\n break;\n }\n } // add ellipsis\n\n\n if (selectedCount > 49) {\n titleFragment.appendChild(document.createTextNode('...'));\n }\n }\n } else {\n var optionSelector = ':not([hidden]):not([data-hidden=\"true\"]):not([data-divider=\"true\"])';\n if (this.options.hideDisabled) optionSelector += ':not(:disabled)'; // If this is a multiselect, and selectedTextFormat is count, then show 1 of 2 selected, etc.\n\n var totalCount = this.$element[0].querySelectorAll('select > option' + optionSelector + ', optgroup' + optionSelector + ' option' + optionSelector).length,\n tr8nText = typeof this.options.countSelectedText === 'function' ? this.options.countSelectedText(selectedCount, totalCount) : this.options.countSelectedText;\n titleFragment = generateOption.text.call(this, {\n text: tr8nText.replace('{0}', selectedCount.toString()).replace('{1}', totalCount.toString())\n }, true);\n }\n }\n\n if (this.options.title == undefined) {\n // use .attr to ensure undefined is returned if title attribute is not set\n this.options.title = this.$element.attr('title');\n } // If the select doesn't have a title, then use the default, or if nothing is set at all, use noneSelectedText\n\n\n if (!titleFragment.childNodes.length) {\n titleFragment = generateOption.text.call(this, {\n text: typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText\n }, true);\n } // strip all HTML tags and trim the result, then unescape any escaped tags\n\n\n button.title = titleFragment.textContent.replace(/<[^>]*>?/g, '').trim();\n\n if (this.options.sanitize && hasContent) {\n sanitizeHtml([titleFragment], that.options.whiteList, that.options.sanitizeFn);\n }\n\n buttonInner.innerHTML = '';\n buttonInner.appendChild(titleFragment);\n\n if (version.major < 4 && this.$newElement[0].classList.contains('bs3-has-addon')) {\n var filterExpand = button.querySelector('.filter-expand'),\n clone = buttonInner.cloneNode(true);\n clone.className = 'filter-expand';\n\n if (filterExpand) {\n button.replaceChild(clone, filterExpand);\n } else {\n button.appendChild(clone);\n }\n }\n\n this.$element.trigger('rendered' + EVENT_KEY);\n },\n\n /**\r\n * @param [style]\r\n * @param [status]\r\n */\n setStyle: function setStyle(newStyle, status) {\n var button = this.$button[0],\n newElement = this.$newElement[0],\n style = this.options.style.trim(),\n buttonClass;\n\n if (this.$element.attr('class')) {\n this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\\[.*\\]/gi, ''));\n }\n\n if (version.major < 4) {\n newElement.classList.add('bs3');\n\n if (newElement.parentNode.classList && newElement.parentNode.classList.contains('input-group') && (newElement.previousElementSibling || newElement.nextElementSibling) && (newElement.previousElementSibling || newElement.nextElementSibling).classList.contains('input-group-addon')) {\n newElement.classList.add('bs3-has-addon');\n }\n }\n\n if (newStyle) {\n buttonClass = newStyle.trim();\n } else {\n buttonClass = style;\n }\n\n if (status == 'add') {\n if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' '));\n } else if (status == 'remove') {\n if (buttonClass) button.classList.remove.apply(button.classList, buttonClass.split(' '));\n } else {\n if (style) button.classList.remove.apply(button.classList, style.split(' '));\n if (buttonClass) button.classList.add.apply(button.classList, buttonClass.split(' '));\n }\n },\n liHeight: function liHeight(refresh) {\n if (!refresh && (this.options.size === false || Object.keys(this.sizeInfo).length)) return;\n var newElement = elementTemplates.div.cloneNode(false),\n menu = elementTemplates.div.cloneNode(false),\n menuInner = elementTemplates.div.cloneNode(false),\n menuInnerInner = document.createElement('ul'),\n divider = elementTemplates.li.cloneNode(false),\n dropdownHeader = elementTemplates.li.cloneNode(false),\n li,\n a = elementTemplates.a.cloneNode(false),\n text = elementTemplates.span.cloneNode(false),\n header = this.options.header && this.$menu.find('.' + classNames.POPOVERHEADER).length > 0 ? this.$menu.find('.' + classNames.POPOVERHEADER)[0].cloneNode(true) : null,\n search = this.options.liveSearch ? elementTemplates.div.cloneNode(false) : null,\n actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null,\n doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null,\n firstOption = this.$element.find('option')[0];\n this.sizeInfo.selectWidth = this.$newElement[0].offsetWidth;\n text.className = 'text';\n a.className = 'dropdown-item ' + (firstOption ? firstOption.className : '');\n newElement.className = this.$menu[0].parentNode.className + ' ' + classNames.SHOW;\n newElement.style.width = 0; // ensure button width doesn't affect natural width of menu when calculating\n\n if (this.options.width === 'auto') menu.style.minWidth = 0;\n menu.className = classNames.MENU + ' ' + classNames.SHOW;\n menuInner.className = 'inner ' + classNames.SHOW;\n menuInnerInner.className = classNames.MENU + ' inner ' + (version.major === '4' ? classNames.SHOW : '');\n divider.className = classNames.DIVIDER;\n dropdownHeader.className = 'dropdown-header';\n text.appendChild(document.createTextNode(\"\\u200B\"));\n\n if (this.selectpicker.current.data.length) {\n for (var i = 0; i < this.selectpicker.current.data.length; i++) {\n var data = this.selectpicker.current.data[i];\n\n if (data.type === 'option') {\n li = data.element;\n break;\n }\n }\n } else {\n li = elementTemplates.li.cloneNode(false);\n a.appendChild(text);\n li.appendChild(a);\n }\n\n dropdownHeader.appendChild(text.cloneNode(true));\n\n if (this.selectpicker.view.widestOption) {\n menuInnerInner.appendChild(this.selectpicker.view.widestOption.cloneNode(true));\n }\n\n menuInnerInner.appendChild(li);\n menuInnerInner.appendChild(divider);\n menuInnerInner.appendChild(dropdownHeader);\n if (header) menu.appendChild(header);\n\n if (search) {\n var input = document.createElement('input');\n search.className = 'bs-searchbox';\n input.className = 'form-control';\n search.appendChild(input);\n menu.appendChild(search);\n }\n\n if (actions) menu.appendChild(actions);\n menuInner.appendChild(menuInnerInner);\n menu.appendChild(menuInner);\n if (doneButton) menu.appendChild(doneButton);\n newElement.appendChild(menu);\n document.body.appendChild(newElement);\n var liHeight = li.offsetHeight,\n dropdownHeaderHeight = dropdownHeader ? dropdownHeader.offsetHeight : 0,\n headerHeight = header ? header.offsetHeight : 0,\n searchHeight = search ? search.offsetHeight : 0,\n actionsHeight = actions ? actions.offsetHeight : 0,\n doneButtonHeight = doneButton ? doneButton.offsetHeight : 0,\n dividerHeight = $(divider).outerHeight(true),\n // fall back to jQuery if getComputedStyle is not supported\n menuStyle = window.getComputedStyle ? window.getComputedStyle(menu) : false,\n menuWidth = menu.offsetWidth,\n $menu = menuStyle ? null : $(menu),\n menuPadding = {\n vert: toInteger(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) + toInteger(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) + toInteger(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) + toInteger(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')),\n horiz: toInteger(menuStyle ? menuStyle.paddingLeft : $menu.css('paddingLeft')) + toInteger(menuStyle ? menuStyle.paddingRight : $menu.css('paddingRight')) + toInteger(menuStyle ? menuStyle.borderLeftWidth : $menu.css('borderLeftWidth')) + toInteger(menuStyle ? menuStyle.borderRightWidth : $menu.css('borderRightWidth'))\n },\n menuExtras = {\n vert: menuPadding.vert + toInteger(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) + toInteger(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2,\n horiz: menuPadding.horiz + toInteger(menuStyle ? menuStyle.marginLeft : $menu.css('marginLeft')) + toInteger(menuStyle ? menuStyle.marginRight : $menu.css('marginRight')) + 2\n },\n scrollBarWidth;\n menuInner.style.overflowY = 'scroll';\n scrollBarWidth = menu.offsetWidth - menuWidth;\n document.body.removeChild(newElement);\n this.sizeInfo.liHeight = liHeight;\n this.sizeInfo.dropdownHeaderHeight = dropdownHeaderHeight;\n this.sizeInfo.headerHeight = headerHeight;\n this.sizeInfo.searchHeight = searchHeight;\n this.sizeInfo.actionsHeight = actionsHeight;\n this.sizeInfo.doneButtonHeight = doneButtonHeight;\n this.sizeInfo.dividerHeight = dividerHeight;\n this.sizeInfo.menuPadding = menuPadding;\n this.sizeInfo.menuExtras = menuExtras;\n this.sizeInfo.menuWidth = menuWidth;\n this.sizeInfo.menuInnerInnerWidth = menuWidth - menuPadding.horiz;\n this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth;\n this.sizeInfo.scrollBarWidth = scrollBarWidth;\n this.sizeInfo.selectHeight = this.$newElement[0].offsetHeight;\n this.setPositionData();\n },\n getSelectPosition: function getSelectPosition() {\n var that = this,\n $window = $(window),\n pos = that.$newElement.offset(),\n $container = $(that.options.container),\n containerPos;\n\n if (that.options.container && $container.length && !$container.is('body')) {\n containerPos = $container.offset();\n containerPos.top += parseInt($container.css('borderTopWidth'));\n containerPos.left += parseInt($container.css('borderLeftWidth'));\n } else {\n containerPos = {\n top: 0,\n left: 0\n };\n }\n\n var winPad = that.options.windowPadding;\n this.sizeInfo.selectOffsetTop = pos.top - containerPos.top - $window.scrollTop();\n this.sizeInfo.selectOffsetBot = $window.height() - this.sizeInfo.selectOffsetTop - this.sizeInfo.selectHeight - containerPos.top - winPad[2];\n this.sizeInfo.selectOffsetLeft = pos.left - containerPos.left - $window.scrollLeft();\n this.sizeInfo.selectOffsetRight = $window.width() - this.sizeInfo.selectOffsetLeft - this.sizeInfo.selectWidth - containerPos.left - winPad[1];\n this.sizeInfo.selectOffsetTop -= winPad[0];\n this.sizeInfo.selectOffsetLeft -= winPad[3];\n },\n setMenuSize: function setMenuSize(isAuto) {\n this.getSelectPosition();\n\n var selectWidth = this.sizeInfo.selectWidth,\n liHeight = this.sizeInfo.liHeight,\n headerHeight = this.sizeInfo.headerHeight,\n searchHeight = this.sizeInfo.searchHeight,\n actionsHeight = this.sizeInfo.actionsHeight,\n doneButtonHeight = this.sizeInfo.doneButtonHeight,\n divHeight = this.sizeInfo.dividerHeight,\n menuPadding = this.sizeInfo.menuPadding,\n menuInnerHeight,\n menuHeight,\n divLength = 0,\n minHeight,\n _minHeight,\n maxHeight,\n menuInnerMinHeight,\n estimate,\n isDropup;\n\n if (this.options.dropupAuto) {\n // Get the estimated height of the menu without scrollbars.\n // This is useful for smaller menus, where there might be plenty of room\n // below the button without setting dropup, but we can't know\n // the exact height of the menu until createView is called later\n estimate = liHeight * this.selectpicker.current.elements.length + menuPadding.vert;\n isDropup = this.sizeInfo.selectOffsetTop - this.sizeInfo.selectOffsetBot > this.sizeInfo.menuExtras.vert && estimate + this.sizeInfo.menuExtras.vert + 50 > this.sizeInfo.selectOffsetBot; // ensure dropup doesn't change while searching (so menu doesn't bounce back and forth)\n\n if (this.selectpicker.isSearching === true) {\n isDropup = this.selectpicker.dropup;\n }\n\n this.$newElement.toggleClass(classNames.DROPUP, isDropup);\n this.selectpicker.dropup = isDropup;\n }\n\n if (this.options.size === 'auto') {\n _minHeight = this.selectpicker.current.elements.length > 3 ? this.sizeInfo.liHeight * 3 + this.sizeInfo.menuExtras.vert - 2 : 0;\n menuHeight = this.sizeInfo.selectOffsetBot - this.sizeInfo.menuExtras.vert;\n minHeight = _minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight;\n menuInnerMinHeight = Math.max(_minHeight - menuPadding.vert, 0);\n\n if (this.$newElement.hasClass(classNames.DROPUP)) {\n menuHeight = this.sizeInfo.selectOffsetTop - this.sizeInfo.menuExtras.vert;\n }\n\n maxHeight = menuHeight;\n menuInnerHeight = menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding.vert;\n } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) {\n for (var i = 0; i < this.options.size; i++) {\n if (this.selectpicker.current.data[i].type === 'divider') divLength++;\n }\n\n menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding.vert;\n menuInnerHeight = menuHeight - menuPadding.vert;\n maxHeight = menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight;\n minHeight = menuInnerMinHeight = '';\n }\n\n this.$menu.css({\n 'max-height': maxHeight + 'px',\n 'overflow': 'hidden',\n 'min-height': minHeight + 'px'\n });\n this.$menuInner.css({\n 'max-height': menuInnerHeight + 'px',\n 'overflow-y': 'auto',\n 'min-height': menuInnerMinHeight + 'px'\n }); // ensure menuInnerHeight is always a positive number to prevent issues calculating chunkSize in createView\n\n this.sizeInfo.menuInnerHeight = Math.max(menuInnerHeight, 1);\n\n if (this.selectpicker.current.data.length && this.selectpicker.current.data[this.selectpicker.current.data.length - 1].position > this.sizeInfo.menuInnerHeight) {\n this.sizeInfo.hasScrollBar = true;\n this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth + this.sizeInfo.scrollBarWidth;\n }\n\n if (this.options.dropdownAlignRight === 'auto') {\n this.$menu.toggleClass(classNames.MENURIGHT, this.sizeInfo.selectOffsetLeft > this.sizeInfo.selectOffsetRight && this.sizeInfo.selectOffsetRight < this.sizeInfo.totalMenuWidth - selectWidth);\n }\n\n if (this.dropdown && this.dropdown._popper) this.dropdown._popper.update();\n },\n setSize: function setSize(refresh) {\n this.liHeight(refresh);\n if (this.options.header) this.$menu.css('padding-top', 0);\n\n if (this.options.size !== false) {\n var that = this,\n $window = $(window);\n this.setMenuSize();\n\n if (this.options.liveSearch) {\n this.$searchbox.off('input.setMenuSize propertychange.setMenuSize').on('input.setMenuSize propertychange.setMenuSize', function () {\n return that.setMenuSize();\n });\n }\n\n if (this.options.size === 'auto') {\n $window.off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize').on('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize', function () {\n return that.setMenuSize();\n });\n } else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) {\n $window.off('resize' + EVENT_KEY + '.' + this.selectId + '.setMenuSize' + ' scroll' + EVENT_KEY + '.' + this.selectId + '.setMenuSize');\n }\n }\n\n this.createView(false, true, refresh);\n },\n setWidth: function setWidth() {\n var that = this;\n\n if (this.options.width === 'auto') {\n requestAnimationFrame(function () {\n that.$menu.css('min-width', '0');\n that.$element.on('loaded' + EVENT_KEY, function () {\n that.liHeight();\n that.setMenuSize(); // Get correct width if element is hidden\n\n var $selectClone = that.$newElement.clone().appendTo('body'),\n btnWidth = $selectClone.css('width', 'auto').children('button').outerWidth();\n $selectClone.remove(); // Set width to whatever's larger, button title or longest option\n\n that.sizeInfo.selectWidth = Math.max(that.sizeInfo.totalMenuWidth, btnWidth);\n that.$newElement.css('width', that.sizeInfo.selectWidth + 'px');\n });\n });\n } else if (this.options.width === 'fit') {\n // Remove inline min-width so width can be changed from 'auto'\n this.$menu.css('min-width', '');\n this.$newElement.css('width', '').addClass('fit-width');\n } else if (this.options.width) {\n // Remove inline min-width so width can be changed from 'auto'\n this.$menu.css('min-width', '');\n this.$newElement.css('width', this.options.width);\n } else {\n // Remove inline min-width/width so width can be changed\n this.$menu.css('min-width', '');\n this.$newElement.css('width', '');\n } // Remove fit-width class if width is changed programmatically\n\n\n if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') {\n this.$newElement[0].classList.remove('fit-width');\n }\n },\n selectPosition: function selectPosition() {\n this.$bsContainer = $('
        ');\n\n var that = this,\n $container = $(this.options.container),\n pos,\n containerPos,\n actualHeight,\n getPlacement = function getPlacement($element) {\n var containerPosition = {},\n // fall back to dropdown's default display setting if display is not manually set\n display = that.options.display || ( // Bootstrap 3 doesn't have $.fn.dropdown.Constructor.Default\n $.fn.dropdown.Constructor.Default ? $.fn.dropdown.Constructor.Default.display : false);\n that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass(classNames.DROPUP, $element.hasClass(classNames.DROPUP));\n pos = $element.offset();\n\n if (!$container.is('body')) {\n containerPos = $container.offset();\n containerPos.top += parseInt($container.css('borderTopWidth')) - $container.scrollTop();\n containerPos.left += parseInt($container.css('borderLeftWidth')) - $container.scrollLeft();\n } else {\n containerPos = {\n top: 0,\n left: 0\n };\n }\n\n actualHeight = $element.hasClass(classNames.DROPUP) ? 0 : $element[0].offsetHeight; // Bootstrap 4+ uses Popper for menu positioning\n\n if (version.major < 4 || display === 'static') {\n containerPosition.top = pos.top - containerPos.top + actualHeight;\n containerPosition.left = pos.left - containerPos.left;\n }\n\n containerPosition.width = $element[0].offsetWidth;\n that.$bsContainer.css(containerPosition);\n };\n\n this.$button.on('click.bs.dropdown.data-api', function () {\n if (that.isDisabled()) {\n return;\n }\n\n getPlacement(that.$newElement);\n that.$bsContainer.appendTo(that.options.container).toggleClass(classNames.SHOW, !that.$button.hasClass(classNames.SHOW)).append(that.$menu);\n });\n $(window).off('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId).on('resize' + EVENT_KEY + '.' + this.selectId + ' scroll' + EVENT_KEY + '.' + this.selectId, function () {\n var isActive = that.$newElement.hasClass(classNames.SHOW);\n if (isActive) getPlacement(that.$newElement);\n });\n this.$element.on('hide' + EVENT_KEY, function () {\n that.$menu.data('height', that.$menu.height());\n that.$bsContainer.detach();\n });\n },\n setOptionStatus: function setOptionStatus(selectedOnly) {\n var that = this;\n that.noScroll = false;\n\n if (that.selectpicker.view.visibleElements && that.selectpicker.view.visibleElements.length) {\n for (var i = 0; i < that.selectpicker.view.visibleElements.length; i++) {\n var liData = that.selectpicker.current.data[i + that.selectpicker.view.position0],\n option = liData.option;\n\n if (option) {\n if (selectedOnly !== true) {\n that.setDisabled(liData.index, liData.disabled);\n }\n\n that.setSelected(liData.index, option.selected);\n }\n }\n }\n },\n\n /**\r\n * @param {number} index - the index of the option that is being changed\r\n * @param {boolean} selected - true if the option is being selected, false if being deselected\r\n */\n setSelected: function setSelected(index, selected) {\n var li = this.selectpicker.main.elements[index],\n liData = this.selectpicker.main.data[index],\n activeIndexIsSet = this.activeIndex !== undefined,\n thisIsActive = this.activeIndex === index,\n prevActive,\n a,\n // if current option is already active\n // OR\n // if the current option is being selected, it's NOT multiple, and\n // activeIndex is undefined:\n // - when the menu is first being opened, OR\n // - after a search has been performed, OR\n // - when retainActive is false when selecting a new option (i.e. index of the newly selected option is not the same as the current activeIndex)\n keepActive = thisIsActive || selected && !this.multiple && !activeIndexIsSet;\n liData.selected = selected;\n a = li.firstChild;\n\n if (selected) {\n this.selectedIndex = index;\n }\n\n li.classList.toggle('selected', selected);\n\n if (keepActive) {\n this.focusItem(li, liData);\n this.selectpicker.view.currentActive = li;\n this.activeIndex = index;\n } else {\n this.defocusItem(li);\n }\n\n if (a) {\n a.classList.toggle('selected', selected);\n\n if (selected) {\n a.setAttribute('aria-selected', true);\n } else {\n if (this.multiple) {\n a.setAttribute('aria-selected', false);\n } else {\n a.removeAttribute('aria-selected');\n }\n }\n }\n\n if (!keepActive && !activeIndexIsSet && selected && this.prevActiveIndex !== undefined) {\n prevActive = this.selectpicker.main.elements[this.prevActiveIndex];\n this.defocusItem(prevActive);\n }\n },\n\n /**\r\n * @param {number} index - the index of the option that is being disabled\r\n * @param {boolean} disabled - true if the option is being disabled, false if being enabled\r\n */\n setDisabled: function setDisabled(index, disabled) {\n var li = this.selectpicker.main.elements[index],\n a;\n this.selectpicker.main.data[index].disabled = disabled;\n a = li.firstChild;\n li.classList.toggle(classNames.DISABLED, disabled);\n\n if (a) {\n if (version.major === '4') a.classList.toggle(classNames.DISABLED, disabled);\n\n if (disabled) {\n a.setAttribute('aria-disabled', disabled);\n a.setAttribute('tabindex', -1);\n } else {\n a.removeAttribute('aria-disabled');\n a.setAttribute('tabindex', 0);\n }\n }\n },\n isDisabled: function isDisabled() {\n return this.$element[0].disabled;\n },\n checkDisabled: function checkDisabled() {\n if (this.isDisabled()) {\n this.$newElement[0].classList.add(classNames.DISABLED);\n this.$button.addClass(classNames.DISABLED).attr('aria-disabled', true);\n } else {\n if (this.$button[0].classList.contains(classNames.DISABLED)) {\n this.$newElement[0].classList.remove(classNames.DISABLED);\n this.$button.removeClass(classNames.DISABLED).attr('aria-disabled', false);\n }\n }\n },\n clickListener: function clickListener() {\n var that = this,\n $document = $(document);\n $document.data('spaceSelect', false);\n this.$button.on('keyup', function (e) {\n if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) {\n e.preventDefault();\n $document.data('spaceSelect', false);\n }\n });\n this.$newElement.on('show.bs.dropdown', function () {\n if (version.major > 3 && !that.dropdown) {\n that.dropdown = that.$button.data('bs.dropdown');\n that.dropdown._menu = that.$menu[0];\n }\n });\n this.$button.on('click.bs.dropdown.data-api', function () {\n if (!that.$newElement.hasClass(classNames.SHOW)) {\n that.setSize();\n }\n });\n\n function setFocus() {\n if (that.options.liveSearch) {\n that.$searchbox.trigger('focus');\n } else {\n that.$menuInner.trigger('focus');\n }\n }\n\n function checkPopperExists() {\n if (that.dropdown && that.dropdown._popper && that.dropdown._popper.state.isCreated) {\n setFocus();\n } else {\n requestAnimationFrame(checkPopperExists);\n }\n }\n\n this.$element.on('shown' + EVENT_KEY, function () {\n if (that.$menuInner[0].scrollTop !== that.selectpicker.view.scrollTop) {\n that.$menuInner[0].scrollTop = that.selectpicker.view.scrollTop;\n }\n\n if (version.major > 3) {\n requestAnimationFrame(checkPopperExists);\n } else {\n setFocus();\n }\n }); // ensure posinset and setsize are correct before selecting an option via a click\n\n this.$menuInner.on('mouseenter', 'li a', function (e) {\n var hoverLi = this.parentElement,\n position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0,\n index = Array.prototype.indexOf.call(hoverLi.parentElement.children, hoverLi),\n hoverData = that.selectpicker.current.data[index + position0];\n that.focusItem(hoverLi, hoverData, true);\n });\n this.$menuInner.on('click', 'li a', function (e, retainActive) {\n var $this = $(this),\n element = that.$element[0],\n position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0,\n clickedData = that.selectpicker.current.data[$this.parent().index() + position0],\n clickedIndex = clickedData.index,\n prevValue = getSelectValues(element),\n prevIndex = element.selectedIndex,\n prevOption = element.options[prevIndex],\n triggerChange = true; // Don't close on multi choice menu\n\n if (that.multiple && that.options.maxOptions !== 1) {\n e.stopPropagation();\n }\n\n e.preventDefault(); // Don't run if the select is disabled\n\n if (!that.isDisabled() && !$this.parent().hasClass(classNames.DISABLED)) {\n var option = clickedData.option,\n $option = $(option),\n state = option.selected,\n $optgroup = $option.parent('optgroup'),\n $optgroupOptions = $optgroup.find('option'),\n maxOptions = that.options.maxOptions,\n maxOptionsGrp = $optgroup.data('maxOptions') || false;\n if (clickedIndex === that.activeIndex) retainActive = true;\n\n if (!retainActive) {\n that.prevActiveIndex = that.activeIndex;\n that.activeIndex = undefined;\n }\n\n if (!that.multiple) {\n // Deselect all others if not multi select box\n if (prevOption) prevOption.selected = false;\n option.selected = true;\n that.setSelected(clickedIndex, true);\n } else {\n // Toggle the one we have chosen if we are multi select.\n option.selected = !state;\n that.setSelected(clickedIndex, !state);\n that.focusedParent.focus();\n\n if (maxOptions !== false || maxOptionsGrp !== false) {\n var maxReached = maxOptions < getSelectedOptions(element).length,\n maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length;\n\n if (maxOptions && maxReached || maxOptionsGrp && maxReachedGrp) {\n if (maxOptions && maxOptions == 1) {\n element.selectedIndex = -1;\n option.selected = true;\n that.setOptionStatus(true);\n } else if (maxOptionsGrp && maxOptionsGrp == 1) {\n for (var i = 0; i < $optgroupOptions.length; i++) {\n var _option = $optgroupOptions[i];\n _option.selected = false;\n that.setSelected(_option.liIndex, false);\n }\n\n option.selected = true;\n that.setSelected(clickedIndex, true);\n } else {\n var maxOptionsText = typeof that.options.maxOptionsText === 'string' ? [that.options.maxOptionsText, that.options.maxOptionsText] : that.options.maxOptionsText,\n maxOptionsArr = typeof maxOptionsText === 'function' ? maxOptionsText(maxOptions, maxOptionsGrp) : maxOptionsText,\n maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),\n maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),\n $notify = $('
        '); // If {var} is set in array, replace it\n\n /** @deprecated */\n\n if (maxOptionsArr[2]) {\n maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]);\n maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]);\n }\n\n option.selected = false;\n that.$menu.append($notify);\n\n if (maxOptions && maxReached) {\n $notify.append($('
        ' + maxTxt + '
        '));\n triggerChange = false;\n that.$element.trigger('maxReached' + EVENT_KEY);\n }\n\n if (maxOptionsGrp && maxReachedGrp) {\n $notify.append($('
        ' + maxTxtGrp + '
        '));\n triggerChange = false;\n that.$element.trigger('maxReachedGrp' + EVENT_KEY);\n }\n\n setTimeout(function () {\n that.setSelected(clickedIndex, false);\n }, 10);\n $notify[0].classList.add('fadeOut');\n setTimeout(function () {\n $notify.remove();\n }, 1050);\n }\n }\n }\n }\n\n if (!that.multiple || that.multiple && that.options.maxOptions === 1) {\n that.$button.trigger('focus');\n } else if (that.options.liveSearch) {\n that.$searchbox.trigger('focus');\n } // Trigger select 'change'\n\n\n if (triggerChange) {\n if (that.multiple || prevIndex !== element.selectedIndex) {\n // $option.prop('selected') is current option state (selected/unselected). prevValue is the value of the select prior to being changed.\n changedArguments = [option.index, $option.prop('selected'), prevValue];\n that.$element.triggerNative('change');\n }\n }\n }\n });\n this.$menu.on('click', 'li.' + classNames.DISABLED + ' a, .' + classNames.POPOVERHEADER + ', .' + classNames.POPOVERHEADER + ' :not(.close)', function (e) {\n if (e.currentTarget == this) {\n e.preventDefault();\n e.stopPropagation();\n\n if (that.options.liveSearch && !$(e.target).hasClass('close')) {\n that.$searchbox.trigger('focus');\n } else {\n that.$button.trigger('focus');\n }\n }\n });\n this.$menuInner.on('click', '.divider, .dropdown-header', function (e) {\n e.preventDefault();\n e.stopPropagation();\n\n if (that.options.liveSearch) {\n that.$searchbox.trigger('focus');\n } else {\n that.$button.trigger('focus');\n }\n });\n this.$menu.on('click', '.' + classNames.POPOVERHEADER + ' .close', function () {\n that.$button.trigger('click');\n });\n this.$searchbox.on('click', function (e) {\n e.stopPropagation();\n });\n this.$menu.on('click', '.actions-btn', function (e) {\n if (that.options.liveSearch) {\n that.$searchbox.trigger('focus');\n } else {\n that.$button.trigger('focus');\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n if ($(this).hasClass('bs-select-all')) {\n that.selectAll();\n } else {\n that.deselectAll();\n }\n });\n this.$button.on('focus' + EVENT_KEY, function (e) {\n var tabindex = that.$element[0].getAttribute('tabindex'); // only change when button is actually focused\n\n if (tabindex !== undefined && e.originalEvent && e.originalEvent.isTrusted) {\n // apply select element's tabindex to ensure correct order is followed when tabbing to the next element\n this.setAttribute('tabindex', tabindex); // set element's tabindex to -1 to allow for reverse tabbing\n\n that.$element[0].setAttribute('tabindex', -1);\n that.selectpicker.view.tabindex = tabindex;\n }\n }).on('blur' + EVENT_KEY, function (e) {\n // revert everything to original tabindex\n if (that.selectpicker.view.tabindex !== undefined && e.originalEvent && e.originalEvent.isTrusted) {\n that.$element[0].setAttribute('tabindex', that.selectpicker.view.tabindex);\n this.setAttribute('tabindex', -1);\n that.selectpicker.view.tabindex = undefined;\n }\n });\n this.$element.on('change' + EVENT_KEY, function () {\n that.render();\n that.$element.trigger('changed' + EVENT_KEY, changedArguments);\n changedArguments = null;\n }).on('focus' + EVENT_KEY, function () {\n if (!that.options.mobile) that.$button[0].focus();\n });\n },\n liveSearchListener: function liveSearchListener() {\n var that = this;\n this.$button.on('click.bs.dropdown.data-api', function () {\n if (!!that.$searchbox.val()) {\n that.$searchbox.val('');\n that.selectpicker.search.previousValue = undefined;\n }\n });\n this.$searchbox.on('click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api', function (e) {\n e.stopPropagation();\n });\n this.$searchbox.on('input propertychange', function () {\n var searchValue = that.$searchbox[0].value;\n that.selectpicker.search.elements = [];\n that.selectpicker.search.data = [];\n\n if (searchValue) {\n var i,\n searchMatch = [],\n q = searchValue.toUpperCase(),\n cache = {},\n cacheArr = [],\n searchStyle = that._searchStyle(),\n normalizeSearch = that.options.liveSearchNormalize;\n\n if (normalizeSearch) q = normalizeToBase(q);\n\n for (var i = 0; i < that.selectpicker.main.data.length; i++) {\n var li = that.selectpicker.main.data[i];\n\n if (!cache[i]) {\n cache[i] = stringSearch(li, q, searchStyle, normalizeSearch);\n }\n\n if (cache[i] && li.headerIndex !== undefined && cacheArr.indexOf(li.headerIndex) === -1) {\n if (li.headerIndex > 0) {\n cache[li.headerIndex - 1] = true;\n cacheArr.push(li.headerIndex - 1);\n }\n\n cache[li.headerIndex] = true;\n cacheArr.push(li.headerIndex);\n cache[li.lastIndex + 1] = true;\n }\n\n if (cache[i] && li.type !== 'optgroup-label') cacheArr.push(i);\n }\n\n for (var i = 0, cacheLen = cacheArr.length; i < cacheLen; i++) {\n var index = cacheArr[i],\n prevIndex = cacheArr[i - 1],\n li = that.selectpicker.main.data[index],\n liPrev = that.selectpicker.main.data[prevIndex];\n\n if (li.type !== 'divider' || li.type === 'divider' && liPrev && liPrev.type !== 'divider' && cacheLen - 1 !== i) {\n that.selectpicker.search.data.push(li);\n searchMatch.push(that.selectpicker.main.elements[index]);\n }\n }\n\n that.activeIndex = undefined;\n that.noScroll = true;\n that.$menuInner.scrollTop(0);\n that.selectpicker.search.elements = searchMatch;\n that.createView(true);\n showNoResults.call(that, searchMatch, searchValue);\n } else if (that.selectpicker.search.previousValue) {\n // for IE11 (#2402)\n that.$menuInner.scrollTop(0);\n that.createView(false);\n }\n\n that.selectpicker.search.previousValue = searchValue;\n });\n },\n _searchStyle: function _searchStyle() {\n return this.options.liveSearchStyle || 'contains';\n },\n val: function val(value) {\n var element = this.$element[0];\n\n if (typeof value !== 'undefined') {\n var prevValue = getSelectValues(element);\n changedArguments = [null, null, prevValue];\n this.$element.val(value).trigger('changed' + EVENT_KEY, changedArguments);\n\n if (this.$newElement.hasClass(classNames.SHOW)) {\n if (this.multiple) {\n this.setOptionStatus(true);\n } else {\n var liSelectedIndex = (element.options[element.selectedIndex] || {}).liIndex;\n\n if (typeof liSelectedIndex === 'number') {\n this.setSelected(this.selectedIndex, false);\n this.setSelected(liSelectedIndex, true);\n }\n }\n }\n\n this.render();\n changedArguments = null;\n return this.$element;\n } else {\n return this.$element.val();\n }\n },\n changeAll: function changeAll(status) {\n if (!this.multiple) return;\n if (typeof status === 'undefined') status = true;\n var element = this.$element[0],\n previousSelected = 0,\n currentSelected = 0,\n prevValue = getSelectValues(element);\n element.classList.add('bs-select-hidden');\n\n for (var i = 0, data = this.selectpicker.current.data, len = data.length; i < len; i++) {\n var liData = data[i],\n option = liData.option;\n\n if (option && !liData.disabled && liData.type !== 'divider') {\n if (liData.selected) previousSelected++;\n option.selected = status;\n if (status === true) currentSelected++;\n }\n }\n\n element.classList.remove('bs-select-hidden');\n if (previousSelected === currentSelected) return;\n this.setOptionStatus();\n changedArguments = [null, null, prevValue];\n this.$element.triggerNative('change');\n },\n selectAll: function selectAll() {\n return this.changeAll(true);\n },\n deselectAll: function deselectAll() {\n return this.changeAll(false);\n },\n toggle: function toggle(e) {\n e = e || window.event;\n if (e) e.stopPropagation();\n this.$button.trigger('click.bs.dropdown.data-api');\n },\n keydown: function keydown(e) {\n var $this = $(this),\n isToggle = $this.hasClass('dropdown-toggle'),\n $parent = isToggle ? $this.closest('.dropdown') : $this.closest(Selector.MENU),\n that = $parent.data('this'),\n $items = that.findLis(),\n index,\n isActive,\n liActive,\n activeLi,\n offset,\n updateScroll = false,\n downOnTab = e.which === keyCodes.TAB && !isToggle && !that.options.selectOnTab,\n isArrowKey = REGEXP_ARROW.test(e.which) || downOnTab,\n scrollTop = that.$menuInner[0].scrollTop,\n isVirtual = that.isVirtual(),\n position0 = isVirtual === true ? that.selectpicker.view.position0 : 0; // do nothing if a function key is pressed\n\n if (e.which >= 112 && e.which <= 123) return;\n isActive = that.$newElement.hasClass(classNames.SHOW);\n\n if (!isActive && (isArrowKey || e.which >= 48 && e.which <= 57 || e.which >= 96 && e.which <= 105 || e.which >= 65 && e.which <= 90)) {\n that.$button.trigger('click.bs.dropdown.data-api');\n\n if (that.options.liveSearch) {\n that.$searchbox.trigger('focus');\n return;\n }\n }\n\n if (e.which === keyCodes.ESCAPE && isActive) {\n e.preventDefault();\n that.$button.trigger('click.bs.dropdown.data-api').trigger('focus');\n }\n\n if (isArrowKey) {\n // if up or down\n if (!$items.length) return;\n liActive = that.selectpicker.main.elements[that.activeIndex];\n index = liActive ? Array.prototype.indexOf.call(liActive.parentElement.children, liActive) : -1;\n\n if (index !== -1) {\n that.defocusItem(liActive);\n }\n\n if (e.which === keyCodes.ARROW_UP) {\n // up\n if (index !== -1) index--;\n if (index + position0 < 0) index += $items.length;\n\n if (!that.selectpicker.view.canHighlight[index + position0]) {\n index = that.selectpicker.view.canHighlight.slice(0, index + position0).lastIndexOf(true) - position0;\n if (index === -1) index = $items.length - 1;\n }\n } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) {\n // down\n index++;\n if (index + position0 >= that.selectpicker.view.canHighlight.length) index = that.selectpicker.view.firstHighlightIndex;\n\n if (!that.selectpicker.view.canHighlight[index + position0]) {\n index = index + 1 + that.selectpicker.view.canHighlight.slice(index + position0 + 1).indexOf(true);\n }\n }\n\n e.preventDefault();\n var liActiveIndex = position0 + index;\n\n if (e.which === keyCodes.ARROW_UP) {\n // up\n // scroll to bottom and highlight last option\n if (position0 === 0 && index === $items.length - 1) {\n that.$menuInner[0].scrollTop = that.$menuInner[0].scrollHeight;\n liActiveIndex = that.selectpicker.current.elements.length - 1;\n } else {\n activeLi = that.selectpicker.current.data[liActiveIndex];\n offset = activeLi.position - activeLi.height;\n updateScroll = offset < scrollTop;\n }\n } else if (e.which === keyCodes.ARROW_DOWN || downOnTab) {\n // down\n // scroll to top and highlight first option\n if (index === that.selectpicker.view.firstHighlightIndex) {\n that.$menuInner[0].scrollTop = 0;\n liActiveIndex = that.selectpicker.view.firstHighlightIndex;\n } else {\n activeLi = that.selectpicker.current.data[liActiveIndex];\n offset = activeLi.position - that.sizeInfo.menuInnerHeight;\n updateScroll = offset > scrollTop;\n }\n }\n\n liActive = that.selectpicker.current.elements[liActiveIndex];\n that.activeIndex = that.selectpicker.current.data[liActiveIndex].index;\n that.focusItem(liActive);\n that.selectpicker.view.currentActive = liActive;\n if (updateScroll) that.$menuInner[0].scrollTop = offset;\n\n if (that.options.liveSearch) {\n that.$searchbox.trigger('focus');\n } else {\n $this.trigger('focus');\n }\n } else if (!$this.is('input') && !REGEXP_TAB_OR_ESCAPE.test(e.which) || e.which === keyCodes.SPACE && that.selectpicker.keydown.keyHistory) {\n var searchMatch,\n matches = [],\n keyHistory;\n e.preventDefault();\n that.selectpicker.keydown.keyHistory += keyCodeMap[e.which];\n if (that.selectpicker.keydown.resetKeyHistory.cancel) clearTimeout(that.selectpicker.keydown.resetKeyHistory.cancel);\n that.selectpicker.keydown.resetKeyHistory.cancel = that.selectpicker.keydown.resetKeyHistory.start();\n keyHistory = that.selectpicker.keydown.keyHistory; // if all letters are the same, set keyHistory to just the first character when searching\n\n if (/^(.)\\1+$/.test(keyHistory)) {\n keyHistory = keyHistory.charAt(0);\n } // find matches\n\n\n for (var i = 0; i < that.selectpicker.current.data.length; i++) {\n var li = that.selectpicker.current.data[i],\n hasMatch;\n hasMatch = stringSearch(li, keyHistory, 'startsWith', true);\n\n if (hasMatch && that.selectpicker.view.canHighlight[i]) {\n matches.push(li.index);\n }\n }\n\n if (matches.length) {\n var matchIndex = 0;\n $items.removeClass('active').find('a').removeClass('active'); // either only one key has been pressed or they are all the same key\n\n if (keyHistory.length === 1) {\n matchIndex = matches.indexOf(that.activeIndex);\n\n if (matchIndex === -1 || matchIndex === matches.length - 1) {\n matchIndex = 0;\n } else {\n matchIndex++;\n }\n }\n\n searchMatch = matches[matchIndex];\n activeLi = that.selectpicker.main.data[searchMatch];\n\n if (scrollTop - activeLi.position > 0) {\n offset = activeLi.position - activeLi.height;\n updateScroll = true;\n } else {\n offset = activeLi.position - that.sizeInfo.menuInnerHeight; // if the option is already visible at the current scroll position, just keep it the same\n\n updateScroll = activeLi.position > scrollTop + that.sizeInfo.menuInnerHeight;\n }\n\n liActive = that.selectpicker.main.elements[searchMatch];\n that.activeIndex = matches[matchIndex];\n that.focusItem(liActive);\n if (liActive) liActive.firstChild.focus();\n if (updateScroll) that.$menuInner[0].scrollTop = offset;\n $this.trigger('focus');\n }\n } // Select focused option if \"Enter\", \"Spacebar\" or \"Tab\" (when selectOnTab is true) are pressed inside the menu.\n\n\n if (isActive && (e.which === keyCodes.SPACE && !that.selectpicker.keydown.keyHistory || e.which === keyCodes.ENTER || e.which === keyCodes.TAB && that.options.selectOnTab)) {\n if (e.which !== keyCodes.SPACE) e.preventDefault();\n\n if (!that.options.liveSearch || e.which !== keyCodes.SPACE) {\n that.$menuInner.find('.active a').trigger('click', true); // retain active class\n\n $this.trigger('focus');\n\n if (!that.options.liveSearch) {\n // Prevent screen from scrolling if the user hits the spacebar\n e.preventDefault(); // Fixes spacebar selection of dropdown items in FF & IE\n\n $(document).data('spaceSelect', true);\n }\n }\n }\n },\n mobile: function mobile() {\n // ensure mobile is set to true if mobile function is called after init\n this.options.mobile = true;\n this.$element[0].classList.add('mobile-device');\n },\n refresh: function refresh() {\n // update options if data attributes have been changed\n var config = $.extend({}, this.options, this.$element.data());\n this.options = config;\n this.checkDisabled();\n this.buildData();\n this.setStyle();\n this.render();\n this.buildList();\n this.setWidth();\n this.setSize(true);\n this.$element.trigger('refreshed' + EVENT_KEY);\n },\n hide: function hide() {\n this.$newElement.hide();\n },\n show: function show() {\n this.$newElement.show();\n },\n remove: function remove() {\n this.$newElement.remove();\n this.$element.remove();\n },\n destroy: function destroy() {\n this.$newElement.before(this.$element).remove();\n\n if (this.$bsContainer) {\n this.$bsContainer.remove();\n } else {\n this.$menu.remove();\n }\n\n if (this.selectpicker.view.titleOption && this.selectpicker.view.titleOption.parentNode) {\n this.selectpicker.view.titleOption.parentNode.removeChild(this.selectpicker.view.titleOption);\n }\n\n this.$element.off(EVENT_KEY).removeData('selectpicker').removeClass('bs-select-hidden selectpicker');\n $(window).off(EVENT_KEY + '.' + this.selectId);\n }\n }; // SELECTPICKER PLUGIN DEFINITION\n // ==============================\n\n function Plugin(option) {\n // get the args of the outer function..\n var args = arguments; // The arguments of the function are explicitly re-defined from the argument list, because the shift causes them\n // to get lost/corrupted in android 2.3 and IE9 #715 #775\n\n var _option = option;\n [].shift.apply(args); // if the version was not set successfully\n\n if (!version.success) {\n // try to retreive it again\n try {\n version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.');\n } catch (err) {\n // fall back to use BootstrapVersion if set\n if (Selectpicker.BootstrapVersion) {\n version.full = Selectpicker.BootstrapVersion.split(' ')[0].split('.');\n } else {\n version.full = [version.major, '0', '0'];\n console.warn('There was an issue retrieving Bootstrap\\'s version. ' + 'Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. ' + 'If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.', err);\n }\n }\n\n version.major = version.full[0];\n version.success = true;\n }\n\n if (version.major === '4') {\n // some defaults need to be changed if using Bootstrap 4\n // check to see if they have already been manually changed before forcing them to update\n var toUpdate = [];\n if (Selectpicker.DEFAULTS.style === classNames.BUTTONCLASS) toUpdate.push({\n name: 'style',\n className: 'BUTTONCLASS'\n });\n if (Selectpicker.DEFAULTS.iconBase === classNames.ICONBASE) toUpdate.push({\n name: 'iconBase',\n className: 'ICONBASE'\n });\n if (Selectpicker.DEFAULTS.tickIcon === classNames.TICKICON) toUpdate.push({\n name: 'tickIcon',\n className: 'TICKICON'\n });\n classNames.DIVIDER = 'dropdown-divider';\n classNames.SHOW = 'show';\n classNames.BUTTONCLASS = 'btn-light';\n classNames.POPOVERHEADER = 'popover-header';\n classNames.ICONBASE = '';\n classNames.TICKICON = 'bs-ok-default';\n\n for (var i = 0; i < toUpdate.length; i++) {\n var option = toUpdate[i];\n Selectpicker.DEFAULTS[option.name] = classNames[option.className];\n }\n }\n\n var value;\n var chain = this.each(function () {\n var $this = $(this);\n\n if ($this.is('select')) {\n var data = $this.data('selectpicker'),\n options = _typeof(_option) == 'object' && _option;\n\n if (!data) {\n var dataAttributes = $this.data();\n\n for (var dataAttr in dataAttributes) {\n if (Object.prototype.hasOwnProperty.call(dataAttributes, dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {\n delete dataAttributes[dataAttr];\n }\n }\n\n var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, dataAttributes, options);\n config.template = $.extend({}, Selectpicker.DEFAULTS.template, $.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}, dataAttributes.template, options.template);\n $this.data('selectpicker', data = new Selectpicker(this, config));\n } else if (options) {\n for (var i in options) {\n if (Object.prototype.hasOwnProperty.call(options, i)) {\n data.options[i] = options[i];\n }\n }\n }\n\n if (typeof _option == 'string') {\n if (data[_option] instanceof Function) {\n value = data[_option].apply(data, args);\n } else {\n value = data.options[_option];\n }\n }\n }\n });\n\n if (typeof value !== 'undefined') {\n // noinspection JSUnusedAssignment\n return value;\n } else {\n return chain;\n }\n }\n\n var old = $.fn.selectpicker;\n $.fn.selectpicker = Plugin;\n $.fn.selectpicker.Constructor = Selectpicker; // SELECTPICKER NO CONFLICT\n // ========================\n\n $.fn.selectpicker.noConflict = function () {\n $.fn.selectpicker = old;\n return this;\n }; // get Bootstrap's keydown event handler for either Bootstrap 4 or Bootstrap 3\n\n\n function keydownHandler() {\n if ($.fn.dropdown) {\n // wait to define until function is called in case Bootstrap isn't loaded yet\n var bootstrapKeydown = $.fn.dropdown.Constructor._dataApiKeydownHandler || $.fn.dropdown.Constructor.prototype.keydown;\n return bootstrapKeydown.apply(this, arguments);\n }\n }\n\n $(document).off('keydown.bs.dropdown.data-api').on('keydown.bs.dropdown.data-api', ':not(.bootstrap-select) > [data-toggle=\"dropdown\"]', keydownHandler).on('keydown.bs.dropdown.data-api', ':not(.bootstrap-select) > .dropdown-menu', keydownHandler).on('keydown' + EVENT_KEY, '.bootstrap-select [data-toggle=\"dropdown\"], .bootstrap-select [role=\"listbox\"], .bootstrap-select .bs-searchbox input', Selectpicker.prototype.keydown).on('focusin.modal', '.bootstrap-select [data-toggle=\"dropdown\"], .bootstrap-select [role=\"listbox\"], .bootstrap-select .bs-searchbox input', function (e) {\n e.stopPropagation();\n }); // SELECTPICKER DATA-API\n // =====================\n\n $(window).on('load' + EVENT_KEY + '.data-api', function () {\n $('.selectpicker').each(function () {\n var $selectpicker = $(this);\n Plugin.call($selectpicker, $selectpicker.data());\n });\n });\n })(jQuery);\n});","// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.\nrequire('../../js/transition.js');\n\nrequire('../../js/alert.js');\n\nrequire('../../js/button.js');\n\nrequire('../../js/carousel.js');\n\nrequire('../../js/collapse.js');\n\nrequire('../../js/dropdown.js');\n\nrequire('../../js/modal.js');\n\nrequire('../../js/tooltip.js');\n\nrequire('../../js/popover.js');\n\nrequire('../../js/scrollspy.js');\n\nrequire('../../js/tab.js');\n\nrequire('../../js/affix.js');","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: affix.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#affix\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // AFFIX CLASS DEFINITION\n // ======================\n\n var Affix = function Affix(element, options) {\n this.options = $.extend({}, Affix.DEFAULTS, options);\n var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target);\n this.$target = target.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)).on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this));\n this.$element = $(element);\n this.affixed = null;\n this.unpin = null;\n this.pinnedOffset = null;\n this.checkPosition();\n };\n\n Affix.VERSION = '3.4.1';\n Affix.RESET = 'affix affix-top affix-bottom';\n Affix.DEFAULTS = {\n offset: 0,\n target: window\n };\n\n Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {\n var scrollTop = this.$target.scrollTop();\n var position = this.$element.offset();\n var targetHeight = this.$target.height();\n if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false;\n\n if (this.affixed == 'bottom') {\n if (offsetTop != null) return scrollTop + this.unpin <= position.top ? false : 'bottom';\n return scrollTop + targetHeight <= scrollHeight - offsetBottom ? false : 'bottom';\n }\n\n var initializing = this.affixed == null;\n var colliderTop = initializing ? scrollTop : position.top;\n var colliderHeight = initializing ? targetHeight : height;\n if (offsetTop != null && scrollTop <= offsetTop) return 'top';\n if (offsetBottom != null && colliderTop + colliderHeight >= scrollHeight - offsetBottom) return 'bottom';\n return false;\n };\n\n Affix.prototype.getPinnedOffset = function () {\n if (this.pinnedOffset) return this.pinnedOffset;\n this.$element.removeClass(Affix.RESET).addClass('affix');\n var scrollTop = this.$target.scrollTop();\n var position = this.$element.offset();\n return this.pinnedOffset = position.top - scrollTop;\n };\n\n Affix.prototype.checkPositionWithEventLoop = function () {\n setTimeout($.proxy(this.checkPosition, this), 1);\n };\n\n Affix.prototype.checkPosition = function () {\n if (!this.$element.is(':visible')) return;\n var height = this.$element.height();\n var offset = this.options.offset;\n var offsetTop = offset.top;\n var offsetBottom = offset.bottom;\n var scrollHeight = Math.max($(document).height(), $(document.body).height());\n if (_typeof(offset) != 'object') offsetBottom = offsetTop = offset;\n if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element);\n if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element);\n var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom);\n\n if (this.affixed != affix) {\n if (this.unpin != null) this.$element.css('top', '');\n var affixType = 'affix' + (affix ? '-' + affix : '');\n var e = $.Event(affixType + '.bs.affix');\n this.$element.trigger(e);\n if (e.isDefaultPrevented()) return;\n this.affixed = affix;\n this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null;\n this.$element.removeClass(Affix.RESET).addClass(affixType).trigger(affixType.replace('affix', 'affixed') + '.bs.affix');\n }\n\n if (affix == 'bottom') {\n this.$element.offset({\n top: scrollHeight - height - offsetBottom\n });\n }\n }; // AFFIX PLUGIN DEFINITION\n // =======================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.affix');\n var options = _typeof(option) == 'object' && option;\n if (!data) $this.data('bs.affix', data = new Affix(this, options));\n if (typeof option == 'string') data[option]();\n });\n }\n\n var old = $.fn.affix;\n $.fn.affix = Plugin;\n $.fn.affix.Constructor = Affix; // AFFIX NO CONFLICT\n // =================\n\n $.fn.affix.noConflict = function () {\n $.fn.affix = old;\n return this;\n }; // AFFIX DATA-API\n // ==============\n\n\n $(window).on('load', function () {\n $('[data-spy=\"affix\"]').each(function () {\n var $spy = $(this);\n var data = $spy.data();\n data.offset = data.offset || {};\n if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom;\n if (data.offsetTop != null) data.offset.top = data.offsetTop;\n Plugin.call($spy, data);\n });\n });\n}(jQuery);","/* ========================================================================\n * Bootstrap: alert.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#alerts\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // ALERT CLASS DEFINITION\n // ======================\n\n var dismiss = '[data-dismiss=\"alert\"]';\n\n var Alert = function Alert(el) {\n $(el).on('click', dismiss, this.close);\n };\n\n Alert.VERSION = '3.4.1';\n Alert.TRANSITION_DURATION = 150;\n\n Alert.prototype.close = function (e) {\n var $this = $(this);\n var selector = $this.attr('data-target');\n\n if (!selector) {\n selector = $this.attr('href');\n selector = selector && selector.replace(/.*(?=#[^\\s]*$)/, ''); // strip for ie7\n }\n\n selector = selector === '#' ? [] : selector;\n var $parent = $(document).find(selector);\n if (e) e.preventDefault();\n\n if (!$parent.length) {\n $parent = $this.closest('.alert');\n }\n\n $parent.trigger(e = $.Event('close.bs.alert'));\n if (e.isDefaultPrevented()) return;\n $parent.removeClass('in');\n\n function removeElement() {\n // detach from parent, fire event then clean up data\n $parent.detach().trigger('closed.bs.alert').remove();\n }\n\n $.support.transition && $parent.hasClass('fade') ? $parent.one('bsTransitionEnd', removeElement).emulateTransitionEnd(Alert.TRANSITION_DURATION) : removeElement();\n }; // ALERT PLUGIN DEFINITION\n // =======================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.alert');\n if (!data) $this.data('bs.alert', data = new Alert(this));\n if (typeof option == 'string') data[option].call($this);\n });\n }\n\n var old = $.fn.alert;\n $.fn.alert = Plugin;\n $.fn.alert.Constructor = Alert; // ALERT NO CONFLICT\n // =================\n\n $.fn.alert.noConflict = function () {\n $.fn.alert = old;\n return this;\n }; // ALERT DATA-API\n // ==============\n\n\n $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close);\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: button.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#buttons\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // BUTTON PUBLIC CLASS DEFINITION\n // ==============================\n\n var Button = function Button(element, options) {\n this.$element = $(element);\n this.options = $.extend({}, Button.DEFAULTS, options);\n this.isLoading = false;\n };\n\n Button.VERSION = '3.4.1';\n Button.DEFAULTS = {\n loadingText: 'loading...'\n };\n\n Button.prototype.setState = function (state) {\n var d = 'disabled';\n var $el = this.$element;\n var val = $el.is('input') ? 'val' : 'html';\n var data = $el.data();\n state += 'Text';\n if (data.resetText == null) $el.data('resetText', $el[val]()); // push to event loop to allow forms to submit\n\n setTimeout($.proxy(function () {\n $el[val](data[state] == null ? this.options[state] : data[state]);\n\n if (state == 'loadingText') {\n this.isLoading = true;\n $el.addClass(d).attr(d, d).prop(d, true);\n } else if (this.isLoading) {\n this.isLoading = false;\n $el.removeClass(d).removeAttr(d).prop(d, false);\n }\n }, this), 0);\n };\n\n Button.prototype.toggle = function () {\n var changed = true;\n var $parent = this.$element.closest('[data-toggle=\"buttons\"]');\n\n if ($parent.length) {\n var $input = this.$element.find('input');\n\n if ($input.prop('type') == 'radio') {\n if ($input.prop('checked')) changed = false;\n $parent.find('.active').removeClass('active');\n this.$element.addClass('active');\n } else if ($input.prop('type') == 'checkbox') {\n if ($input.prop('checked') !== this.$element.hasClass('active')) changed = false;\n this.$element.toggleClass('active');\n }\n\n $input.prop('checked', this.$element.hasClass('active'));\n if (changed) $input.trigger('change');\n } else {\n this.$element.attr('aria-pressed', !this.$element.hasClass('active'));\n this.$element.toggleClass('active');\n }\n }; // BUTTON PLUGIN DEFINITION\n // ========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.button');\n var options = _typeof(option) == 'object' && option;\n if (!data) $this.data('bs.button', data = new Button(this, options));\n if (option == 'toggle') data.toggle();else if (option) data.setState(option);\n });\n }\n\n var old = $.fn.button;\n $.fn.button = Plugin;\n $.fn.button.Constructor = Button; // BUTTON NO CONFLICT\n // ==================\n\n $.fn.button.noConflict = function () {\n $.fn.button = old;\n return this;\n }; // BUTTON DATA-API\n // ===============\n\n\n $(document).on('click.bs.button.data-api', '[data-toggle^=\"button\"]', function (e) {\n var $btn = $(e.target).closest('.btn');\n Plugin.call($btn, 'toggle');\n\n if (!$(e.target).is('input[type=\"radio\"], input[type=\"checkbox\"]')) {\n // Prevent double click on radios, and the double selections (so cancellation) on checkboxes\n e.preventDefault(); // The target component still receive the focus\n\n if ($btn.is('input,button')) $btn.trigger('focus');else $btn.find('input:visible,button:visible').first().trigger('focus');\n }\n }).on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^=\"button\"]', function (e) {\n $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type));\n });\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: carousel.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#carousel\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // CAROUSEL CLASS DEFINITION\n // =========================\n\n var Carousel = function Carousel(element, options) {\n this.$element = $(element);\n this.$indicators = this.$element.find('.carousel-indicators');\n this.options = options;\n this.paused = null;\n this.sliding = null;\n this.interval = null;\n this.$active = null;\n this.$items = null;\n this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this));\n this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element.on('mouseenter.bs.carousel', $.proxy(this.pause, this)).on('mouseleave.bs.carousel', $.proxy(this.cycle, this));\n };\n\n Carousel.VERSION = '3.4.1';\n Carousel.TRANSITION_DURATION = 600;\n Carousel.DEFAULTS = {\n interval: 5000,\n pause: 'hover',\n wrap: true,\n keyboard: true\n };\n\n Carousel.prototype.keydown = function (e) {\n if (/input|textarea/i.test(e.target.tagName)) return;\n\n switch (e.which) {\n case 37:\n this.prev();\n break;\n\n case 39:\n this.next();\n break;\n\n default:\n return;\n }\n\n e.preventDefault();\n };\n\n Carousel.prototype.cycle = function (e) {\n e || (this.paused = false);\n this.interval && clearInterval(this.interval);\n this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval));\n return this;\n };\n\n Carousel.prototype.getItemIndex = function (item) {\n this.$items = item.parent().children('.item');\n return this.$items.index(item || this.$active);\n };\n\n Carousel.prototype.getItemForDirection = function (direction, active) {\n var activeIndex = this.getItemIndex(active);\n var willWrap = direction == 'prev' && activeIndex === 0 || direction == 'next' && activeIndex == this.$items.length - 1;\n if (willWrap && !this.options.wrap) return active;\n var delta = direction == 'prev' ? -1 : 1;\n var itemIndex = (activeIndex + delta) % this.$items.length;\n return this.$items.eq(itemIndex);\n };\n\n Carousel.prototype.to = function (pos) {\n var that = this;\n var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'));\n if (pos > this.$items.length - 1 || pos < 0) return;\n if (this.sliding) return this.$element.one('slid.bs.carousel', function () {\n that.to(pos);\n }); // yes, \"slid\"\n\n if (activeIndex == pos) return this.pause().cycle();\n return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos));\n };\n\n Carousel.prototype.pause = function (e) {\n e || (this.paused = true);\n\n if (this.$element.find('.next, .prev').length && $.support.transition) {\n this.$element.trigger($.support.transition.end);\n this.cycle(true);\n }\n\n this.interval = clearInterval(this.interval);\n return this;\n };\n\n Carousel.prototype.next = function () {\n if (this.sliding) return;\n return this.slide('next');\n };\n\n Carousel.prototype.prev = function () {\n if (this.sliding) return;\n return this.slide('prev');\n };\n\n Carousel.prototype.slide = function (type, next) {\n var $active = this.$element.find('.item.active');\n var $next = next || this.getItemForDirection(type, $active);\n var isCycling = this.interval;\n var direction = type == 'next' ? 'left' : 'right';\n var that = this;\n if ($next.hasClass('active')) return this.sliding = false;\n var relatedTarget = $next[0];\n var slideEvent = $.Event('slide.bs.carousel', {\n relatedTarget: relatedTarget,\n direction: direction\n });\n this.$element.trigger(slideEvent);\n if (slideEvent.isDefaultPrevented()) return;\n this.sliding = true;\n isCycling && this.pause();\n\n if (this.$indicators.length) {\n this.$indicators.find('.active').removeClass('active');\n var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]);\n $nextIndicator && $nextIndicator.addClass('active');\n }\n\n var slidEvent = $.Event('slid.bs.carousel', {\n relatedTarget: relatedTarget,\n direction: direction\n }); // yes, \"slid\"\n\n if ($.support.transition && this.$element.hasClass('slide')) {\n $next.addClass(type);\n\n if (_typeof($next) === 'object' && $next.length) {\n $next[0].offsetWidth; // force reflow\n }\n\n $active.addClass(direction);\n $next.addClass(direction);\n $active.one('bsTransitionEnd', function () {\n $next.removeClass([type, direction].join(' ')).addClass('active');\n $active.removeClass(['active', direction].join(' '));\n that.sliding = false;\n setTimeout(function () {\n that.$element.trigger(slidEvent);\n }, 0);\n }).emulateTransitionEnd(Carousel.TRANSITION_DURATION);\n } else {\n $active.removeClass('active');\n $next.addClass('active');\n this.sliding = false;\n this.$element.trigger(slidEvent);\n }\n\n isCycling && this.cycle();\n return this;\n }; // CAROUSEL PLUGIN DEFINITION\n // ==========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.carousel');\n var options = $.extend({}, Carousel.DEFAULTS, $this.data(), _typeof(option) == 'object' && option);\n var action = typeof option == 'string' ? option : options.slide;\n if (!data) $this.data('bs.carousel', data = new Carousel(this, options));\n if (typeof option == 'number') data.to(option);else if (action) data[action]();else if (options.interval) data.pause().cycle();\n });\n }\n\n var old = $.fn.carousel;\n $.fn.carousel = Plugin;\n $.fn.carousel.Constructor = Carousel; // CAROUSEL NO CONFLICT\n // ====================\n\n $.fn.carousel.noConflict = function () {\n $.fn.carousel = old;\n return this;\n }; // CAROUSEL DATA-API\n // =================\n\n\n var clickHandler = function clickHandler(e) {\n var $this = $(this);\n var href = $this.attr('href');\n\n if (href) {\n href = href.replace(/.*(?=#[^\\s]+$)/, ''); // strip for ie7\n }\n\n var target = $this.attr('data-target') || href;\n var $target = $(document).find(target);\n if (!$target.hasClass('carousel')) return;\n var options = $.extend({}, $target.data(), $this.data());\n var slideIndex = $this.attr('data-slide-to');\n if (slideIndex) options.interval = false;\n Plugin.call($target, options);\n\n if (slideIndex) {\n $target.data('bs.carousel').to(slideIndex);\n }\n\n e.preventDefault();\n };\n\n $(document).on('click.bs.carousel.data-api', '[data-slide]', clickHandler).on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler);\n $(window).on('load', function () {\n $('[data-ride=\"carousel\"]').each(function () {\n var $carousel = $(this);\n Plugin.call($carousel, $carousel.data());\n });\n });\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: collapse.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#collapse\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n/* jshint latedef: false */\n+function ($) {\n 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION\n // ================================\n\n var Collapse = function Collapse(element, options) {\n this.$element = $(element);\n this.options = $.extend({}, Collapse.DEFAULTS, options);\n this.$trigger = $('[data-toggle=\"collapse\"][href=\"#' + element.id + '\"],' + '[data-toggle=\"collapse\"][data-target=\"#' + element.id + '\"]');\n this.transitioning = null;\n\n if (this.options.parent) {\n this.$parent = this.getParent();\n } else {\n this.addAriaAndCollapsedClass(this.$element, this.$trigger);\n }\n\n if (this.options.toggle) this.toggle();\n };\n\n Collapse.VERSION = '3.4.1';\n Collapse.TRANSITION_DURATION = 350;\n Collapse.DEFAULTS = {\n toggle: true\n };\n\n Collapse.prototype.dimension = function () {\n var hasWidth = this.$element.hasClass('width');\n return hasWidth ? 'width' : 'height';\n };\n\n Collapse.prototype.show = function () {\n if (this.transitioning || this.$element.hasClass('in')) return;\n var activesData;\n var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing');\n\n if (actives && actives.length) {\n activesData = actives.data('bs.collapse');\n if (activesData && activesData.transitioning) return;\n }\n\n var startEvent = $.Event('show.bs.collapse');\n this.$element.trigger(startEvent);\n if (startEvent.isDefaultPrevented()) return;\n\n if (actives && actives.length) {\n Plugin.call(actives, 'hide');\n activesData || actives.data('bs.collapse', null);\n }\n\n var dimension = this.dimension();\n this.$element.removeClass('collapse').addClass('collapsing')[dimension](0).attr('aria-expanded', true);\n this.$trigger.removeClass('collapsed').attr('aria-expanded', true);\n this.transitioning = 1;\n\n var complete = function complete() {\n this.$element.removeClass('collapsing').addClass('collapse in')[dimension]('');\n this.transitioning = 0;\n this.$element.trigger('shown.bs.collapse');\n };\n\n if (!$.support.transition) return complete.call(this);\n var scrollSize = $.camelCase(['scroll', dimension].join('-'));\n this.$element.one('bsTransitionEnd', $.proxy(complete, this)).emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]);\n };\n\n Collapse.prototype.hide = function () {\n if (this.transitioning || !this.$element.hasClass('in')) return;\n var startEvent = $.Event('hide.bs.collapse');\n this.$element.trigger(startEvent);\n if (startEvent.isDefaultPrevented()) return;\n var dimension = this.dimension();\n this.$element[dimension](this.$element[dimension]())[0].offsetHeight;\n this.$element.addClass('collapsing').removeClass('collapse in').attr('aria-expanded', false);\n this.$trigger.addClass('collapsed').attr('aria-expanded', false);\n this.transitioning = 1;\n\n var complete = function complete() {\n this.transitioning = 0;\n this.$element.removeClass('collapsing').addClass('collapse').trigger('hidden.bs.collapse');\n };\n\n if (!$.support.transition) return complete.call(this);\n this.$element[dimension](0).one('bsTransitionEnd', $.proxy(complete, this)).emulateTransitionEnd(Collapse.TRANSITION_DURATION);\n };\n\n Collapse.prototype.toggle = function () {\n this[this.$element.hasClass('in') ? 'hide' : 'show']();\n };\n\n Collapse.prototype.getParent = function () {\n return $(document).find(this.options.parent).find('[data-toggle=\"collapse\"][data-parent=\"' + this.options.parent + '\"]').each($.proxy(function (i, element) {\n var $element = $(element);\n this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element);\n }, this)).end();\n };\n\n Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {\n var isOpen = $element.hasClass('in');\n $element.attr('aria-expanded', isOpen);\n $trigger.toggleClass('collapsed', !isOpen).attr('aria-expanded', isOpen);\n };\n\n function getTargetFromTrigger($trigger) {\n var href;\n var target = $trigger.attr('data-target') || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\\s]+$)/, ''); // strip for ie7\n\n return $(document).find(target);\n } // COLLAPSE PLUGIN DEFINITION\n // ==========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.collapse');\n var options = $.extend({}, Collapse.DEFAULTS, $this.data(), _typeof(option) == 'object' && option);\n if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false;\n if (!data) $this.data('bs.collapse', data = new Collapse(this, options));\n if (typeof option == 'string') data[option]();\n });\n }\n\n var old = $.fn.collapse;\n $.fn.collapse = Plugin;\n $.fn.collapse.Constructor = Collapse; // COLLAPSE NO CONFLICT\n // ====================\n\n $.fn.collapse.noConflict = function () {\n $.fn.collapse = old;\n return this;\n }; // COLLAPSE DATA-API\n // =================\n\n\n $(document).on('click.bs.collapse.data-api', '[data-toggle=\"collapse\"]', function (e) {\n var $this = $(this);\n if (!$this.attr('data-target')) e.preventDefault();\n var $target = getTargetFromTrigger($this);\n var data = $target.data('bs.collapse');\n var option = data ? 'toggle' : $this.data();\n Plugin.call($target, option);\n });\n}(jQuery);","/* ========================================================================\n * Bootstrap: dropdown.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#dropdowns\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // DROPDOWN CLASS DEFINITION\n // =========================\n\n var backdrop = '.dropdown-backdrop';\n var toggle = '[data-toggle=\"dropdown\"]';\n\n var Dropdown = function Dropdown(element) {\n $(element).on('click.bs.dropdown', this.toggle);\n };\n\n Dropdown.VERSION = '3.4.1';\n\n function getParent($this) {\n var selector = $this.attr('data-target');\n\n if (!selector) {\n selector = $this.attr('href');\n selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\\s]*$)/, ''); // strip for ie7\n }\n\n var $parent = selector !== '#' ? $(document).find(selector) : null;\n return $parent && $parent.length ? $parent : $this.parent();\n }\n\n function clearMenus(e) {\n if (e && e.which === 3) return;\n $(backdrop).remove();\n $(toggle).each(function () {\n var $this = $(this);\n var $parent = getParent($this);\n var relatedTarget = {\n relatedTarget: this\n };\n if (!$parent.hasClass('open')) return;\n if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return;\n $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget));\n if (e.isDefaultPrevented()) return;\n $this.attr('aria-expanded', 'false');\n $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget));\n });\n }\n\n Dropdown.prototype.toggle = function (e) {\n var $this = $(this);\n if ($this.is('.disabled, :disabled')) return;\n var $parent = getParent($this);\n var isActive = $parent.hasClass('open');\n clearMenus();\n\n if (!isActive) {\n if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {\n // if mobile we use a backdrop because click events don't delegate\n $(document.createElement('div')).addClass('dropdown-backdrop').insertAfter($(this)).on('click', clearMenus);\n }\n\n var relatedTarget = {\n relatedTarget: this\n };\n $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget));\n if (e.isDefaultPrevented()) return;\n $this.trigger('focus').attr('aria-expanded', 'true');\n $parent.toggleClass('open').trigger($.Event('shown.bs.dropdown', relatedTarget));\n }\n\n return false;\n };\n\n Dropdown.prototype.keydown = function (e) {\n if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return;\n var $this = $(this);\n e.preventDefault();\n e.stopPropagation();\n if ($this.is('.disabled, :disabled')) return;\n var $parent = getParent($this);\n var isActive = $parent.hasClass('open');\n\n if (!isActive && e.which != 27 || isActive && e.which == 27) {\n if (e.which == 27) $parent.find(toggle).trigger('focus');\n return $this.trigger('click');\n }\n\n var desc = ' li:not(.disabled):visible a';\n var $items = $parent.find('.dropdown-menu' + desc);\n if (!$items.length) return;\n var index = $items.index(e.target);\n if (e.which == 38 && index > 0) index--; // up\n\n if (e.which == 40 && index < $items.length - 1) index++; // down\n\n if (!~index) index = 0;\n $items.eq(index).trigger('focus');\n }; // DROPDOWN PLUGIN DEFINITION\n // ==========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.dropdown');\n if (!data) $this.data('bs.dropdown', data = new Dropdown(this));\n if (typeof option == 'string') data[option].call($this);\n });\n }\n\n var old = $.fn.dropdown;\n $.fn.dropdown = Plugin;\n $.fn.dropdown.Constructor = Dropdown; // DROPDOWN NO CONFLICT\n // ====================\n\n $.fn.dropdown.noConflict = function () {\n $.fn.dropdown = old;\n return this;\n }; // APPLY TO STANDARD DROPDOWN ELEMENTS\n // ===================================\n\n\n $(document).on('click.bs.dropdown.data-api', clearMenus).on('click.bs.dropdown.data-api', '.dropdown form', function (e) {\n e.stopPropagation();\n }).on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle).on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown).on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown);\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: modal.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#modals\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // MODAL CLASS DEFINITION\n // ======================\n\n var Modal = function Modal(element, options) {\n this.options = options;\n this.$body = $(document.body);\n this.$element = $(element);\n this.$dialog = this.$element.find('.modal-dialog');\n this.$backdrop = null;\n this.isShown = null;\n this.originalBodyPad = null;\n this.scrollbarWidth = 0;\n this.ignoreBackdropClick = false;\n this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom';\n\n if (this.options.remote) {\n this.$element.find('.modal-content').load(this.options.remote, $.proxy(function () {\n this.$element.trigger('loaded.bs.modal');\n }, this));\n }\n };\n\n Modal.VERSION = '3.4.1';\n Modal.TRANSITION_DURATION = 300;\n Modal.BACKDROP_TRANSITION_DURATION = 150;\n Modal.DEFAULTS = {\n backdrop: true,\n keyboard: true,\n show: true\n };\n\n Modal.prototype.toggle = function (_relatedTarget) {\n return this.isShown ? this.hide() : this.show(_relatedTarget);\n };\n\n Modal.prototype.show = function (_relatedTarget) {\n var that = this;\n var e = $.Event('show.bs.modal', {\n relatedTarget: _relatedTarget\n });\n this.$element.trigger(e);\n if (this.isShown || e.isDefaultPrevented()) return;\n this.isShown = true;\n this.checkScrollbar();\n this.setScrollbar();\n this.$body.addClass('modal-open');\n this.escape();\n this.resize();\n this.$element.on('click.dismiss.bs.modal', '[data-dismiss=\"modal\"]', $.proxy(this.hide, this));\n this.$dialog.on('mousedown.dismiss.bs.modal', function () {\n that.$element.one('mouseup.dismiss.bs.modal', function (e) {\n if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true;\n });\n });\n this.backdrop(function () {\n var transition = $.support.transition && that.$element.hasClass('fade');\n\n if (!that.$element.parent().length) {\n that.$element.appendTo(that.$body); // don't move modals dom position\n }\n\n that.$element.show().scrollTop(0);\n that.adjustDialog();\n\n if (transition) {\n that.$element[0].offsetWidth; // force reflow\n }\n\n that.$element.addClass('in');\n that.enforceFocus();\n var e = $.Event('shown.bs.modal', {\n relatedTarget: _relatedTarget\n });\n transition ? that.$dialog // wait for modal to slide in\n .one('bsTransitionEnd', function () {\n that.$element.trigger('focus').trigger(e);\n }).emulateTransitionEnd(Modal.TRANSITION_DURATION) : that.$element.trigger('focus').trigger(e);\n });\n };\n\n Modal.prototype.hide = function (e) {\n if (e) e.preventDefault();\n e = $.Event('hide.bs.modal');\n this.$element.trigger(e);\n if (!this.isShown || e.isDefaultPrevented()) return;\n this.isShown = false;\n this.escape();\n this.resize();\n $(document).off('focusin.bs.modal');\n this.$element.removeClass('in').off('click.dismiss.bs.modal').off('mouseup.dismiss.bs.modal');\n this.$dialog.off('mousedown.dismiss.bs.modal');\n $.support.transition && this.$element.hasClass('fade') ? this.$element.one('bsTransitionEnd', $.proxy(this.hideModal, this)).emulateTransitionEnd(Modal.TRANSITION_DURATION) : this.hideModal();\n };\n\n Modal.prototype.enforceFocus = function () {\n $(document).off('focusin.bs.modal') // guard against infinite focus loop\n .on('focusin.bs.modal', $.proxy(function (e) {\n if (document !== e.target && this.$element[0] !== e.target && !this.$element.has(e.target).length) {\n this.$element.trigger('focus');\n }\n }, this));\n };\n\n Modal.prototype.escape = function () {\n if (this.isShown && this.options.keyboard) {\n this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {\n e.which == 27 && this.hide();\n }, this));\n } else if (!this.isShown) {\n this.$element.off('keydown.dismiss.bs.modal');\n }\n };\n\n Modal.prototype.resize = function () {\n if (this.isShown) {\n $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this));\n } else {\n $(window).off('resize.bs.modal');\n }\n };\n\n Modal.prototype.hideModal = function () {\n var that = this;\n this.$element.hide();\n this.backdrop(function () {\n that.$body.removeClass('modal-open');\n that.resetAdjustments();\n that.resetScrollbar();\n that.$element.trigger('hidden.bs.modal');\n });\n };\n\n Modal.prototype.removeBackdrop = function () {\n this.$backdrop && this.$backdrop.remove();\n this.$backdrop = null;\n };\n\n Modal.prototype.backdrop = function (callback) {\n var that = this;\n var animate = this.$element.hasClass('fade') ? 'fade' : '';\n\n if (this.isShown && this.options.backdrop) {\n var doAnimate = $.support.transition && animate;\n this.$backdrop = $(document.createElement('div')).addClass('modal-backdrop ' + animate).appendTo(this.$body);\n this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {\n if (this.ignoreBackdropClick) {\n this.ignoreBackdropClick = false;\n return;\n }\n\n if (e.target !== e.currentTarget) return;\n this.options.backdrop == 'static' ? this.$element[0].focus() : this.hide();\n }, this));\n if (doAnimate) this.$backdrop[0].offsetWidth; // force reflow\n\n this.$backdrop.addClass('in');\n if (!callback) return;\n doAnimate ? this.$backdrop.one('bsTransitionEnd', callback).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callback();\n } else if (!this.isShown && this.$backdrop) {\n this.$backdrop.removeClass('in');\n\n var callbackRemove = function callbackRemove() {\n that.removeBackdrop();\n callback && callback();\n };\n\n $.support.transition && this.$element.hasClass('fade') ? this.$backdrop.one('bsTransitionEnd', callbackRemove).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callbackRemove();\n } else if (callback) {\n callback();\n }\n }; // these following methods are used to handle overflowing modals\n\n\n Modal.prototype.handleUpdate = function () {\n this.adjustDialog();\n };\n\n Modal.prototype.adjustDialog = function () {\n var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight;\n this.$element.css({\n paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',\n paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''\n });\n };\n\n Modal.prototype.resetAdjustments = function () {\n this.$element.css({\n paddingLeft: '',\n paddingRight: ''\n });\n };\n\n Modal.prototype.checkScrollbar = function () {\n var fullWindowWidth = window.innerWidth;\n\n if (!fullWindowWidth) {\n // workaround for missing window.innerWidth in IE8\n var documentElementRect = document.documentElement.getBoundingClientRect();\n fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);\n }\n\n this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth;\n this.scrollbarWidth = this.measureScrollbar();\n };\n\n Modal.prototype.setScrollbar = function () {\n var bodyPad = parseInt(this.$body.css('padding-right') || 0, 10);\n this.originalBodyPad = document.body.style.paddingRight || '';\n var scrollbarWidth = this.scrollbarWidth;\n\n if (this.bodyIsOverflowing) {\n this.$body.css('padding-right', bodyPad + scrollbarWidth);\n $(this.fixedContent).each(function (index, element) {\n var actualPadding = element.style.paddingRight;\n var calculatedPadding = $(element).css('padding-right');\n $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px');\n });\n }\n };\n\n Modal.prototype.resetScrollbar = function () {\n this.$body.css('padding-right', this.originalBodyPad);\n $(this.fixedContent).each(function (index, element) {\n var padding = $(element).data('padding-right');\n $(element).removeData('padding-right');\n element.style.paddingRight = padding ? padding : '';\n });\n };\n\n Modal.prototype.measureScrollbar = function () {\n // thx walsh\n var scrollDiv = document.createElement('div');\n scrollDiv.className = 'modal-scrollbar-measure';\n this.$body.append(scrollDiv);\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;\n this.$body[0].removeChild(scrollDiv);\n return scrollbarWidth;\n }; // MODAL PLUGIN DEFINITION\n // =======================\n\n\n function Plugin(option, _relatedTarget) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.modal');\n var options = $.extend({}, Modal.DEFAULTS, $this.data(), _typeof(option) == 'object' && option);\n if (!data) $this.data('bs.modal', data = new Modal(this, options));\n if (typeof option == 'string') data[option](_relatedTarget);else if (options.show) data.show(_relatedTarget);\n });\n }\n\n var old = $.fn.modal;\n $.fn.modal = Plugin;\n $.fn.modal.Constructor = Modal; // MODAL NO CONFLICT\n // =================\n\n $.fn.modal.noConflict = function () {\n $.fn.modal = old;\n return this;\n }; // MODAL DATA-API\n // ==============\n\n\n $(document).on('click.bs.modal.data-api', '[data-toggle=\"modal\"]', function (e) {\n var $this = $(this);\n var href = $this.attr('href');\n var target = $this.attr('data-target') || href && href.replace(/.*(?=#[^\\s]+$)/, ''); // strip for ie7\n\n var $target = $(document).find(target);\n var option = $target.data('bs.modal') ? 'toggle' : $.extend({\n remote: !/#/.test(href) && href\n }, $target.data(), $this.data());\n if ($this.is('a')) e.preventDefault();\n $target.one('show.bs.modal', function (showEvent) {\n if (showEvent.isDefaultPrevented()) return; // only register focus restorer if modal will actually get shown\n\n $target.one('hidden.bs.modal', function () {\n $this.is(':visible') && $this.trigger('focus');\n });\n });\n Plugin.call($target, option, this);\n });\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: popover.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#popovers\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // POPOVER PUBLIC CLASS DEFINITION\n // ===============================\n\n var Popover = function Popover(element, options) {\n this.init('popover', element, options);\n };\n\n if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js');\n Popover.VERSION = '3.4.1';\n Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {\n placement: 'right',\n trigger: 'click',\n content: '',\n template: '

        '\n }); // NOTE: POPOVER EXTENDS tooltip.js\n // ================================\n\n Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype);\n Popover.prototype.constructor = Popover;\n\n Popover.prototype.getDefaults = function () {\n return Popover.DEFAULTS;\n };\n\n Popover.prototype.setContent = function () {\n var $tip = this.tip();\n var title = this.getTitle();\n var content = this.getContent();\n\n if (this.options.html) {\n var typeContent = _typeof(content);\n\n if (this.options.sanitize) {\n title = this.sanitizeHtml(title);\n\n if (typeContent === 'string') {\n content = this.sanitizeHtml(content);\n }\n }\n\n $tip.find('.popover-title').html(title);\n $tip.find('.popover-content').children().detach().end()[typeContent === 'string' ? 'html' : 'append'](content);\n } else {\n $tip.find('.popover-title').text(title);\n $tip.find('.popover-content').children().detach().end().text(content);\n }\n\n $tip.removeClass('fade top bottom left right in'); // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do\n // this manually by checking the contents.\n\n if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide();\n };\n\n Popover.prototype.hasContent = function () {\n return this.getTitle() || this.getContent();\n };\n\n Popover.prototype.getContent = function () {\n var $e = this.$element;\n var o = this.options;\n return $e.attr('data-content') || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content);\n };\n\n Popover.prototype.arrow = function () {\n return this.$arrow = this.$arrow || this.tip().find('.arrow');\n }; // POPOVER PLUGIN DEFINITION\n // =========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.popover');\n var options = _typeof(option) == 'object' && option;\n if (!data && /destroy|hide/.test(option)) return;\n if (!data) $this.data('bs.popover', data = new Popover(this, options));\n if (typeof option == 'string') data[option]();\n });\n }\n\n var old = $.fn.popover;\n $.fn.popover = Plugin;\n $.fn.popover.Constructor = Popover; // POPOVER NO CONFLICT\n // ===================\n\n $.fn.popover.noConflict = function () {\n $.fn.popover = old;\n return this;\n };\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: scrollspy.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#scrollspy\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // SCROLLSPY CLASS DEFINITION\n // ==========================\n\n function ScrollSpy(element, options) {\n this.$body = $(document.body);\n this.$scrollElement = $(element).is(document.body) ? $(window) : $(element);\n this.options = $.extend({}, ScrollSpy.DEFAULTS, options);\n this.selector = (this.options.target || '') + ' .nav li > a';\n this.offsets = [];\n this.targets = [];\n this.activeTarget = null;\n this.scrollHeight = 0;\n this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this));\n this.refresh();\n this.process();\n }\n\n ScrollSpy.VERSION = '3.4.1';\n ScrollSpy.DEFAULTS = {\n offset: 10\n };\n\n ScrollSpy.prototype.getScrollHeight = function () {\n return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight);\n };\n\n ScrollSpy.prototype.refresh = function () {\n var that = this;\n var offsetMethod = 'offset';\n var offsetBase = 0;\n this.offsets = [];\n this.targets = [];\n this.scrollHeight = this.getScrollHeight();\n\n if (!$.isWindow(this.$scrollElement[0])) {\n offsetMethod = 'position';\n offsetBase = this.$scrollElement.scrollTop();\n }\n\n this.$body.find(this.selector).map(function () {\n var $el = $(this);\n var href = $el.data('target') || $el.attr('href');\n var $href = /^#./.test(href) && $(href);\n return $href && $href.length && $href.is(':visible') && [[$href[offsetMethod]().top + offsetBase, href]] || null;\n }).sort(function (a, b) {\n return a[0] - b[0];\n }).each(function () {\n that.offsets.push(this[0]);\n that.targets.push(this[1]);\n });\n };\n\n ScrollSpy.prototype.process = function () {\n var scrollTop = this.$scrollElement.scrollTop() + this.options.offset;\n var scrollHeight = this.getScrollHeight();\n var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height();\n var offsets = this.offsets;\n var targets = this.targets;\n var activeTarget = this.activeTarget;\n var i;\n\n if (this.scrollHeight != scrollHeight) {\n this.refresh();\n }\n\n if (scrollTop >= maxScroll) {\n return activeTarget != (i = targets[targets.length - 1]) && this.activate(i);\n }\n\n if (activeTarget && scrollTop < offsets[0]) {\n this.activeTarget = null;\n return this.clear();\n }\n\n for (i = offsets.length; i--;) {\n activeTarget != targets[i] && scrollTop >= offsets[i] && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) && this.activate(targets[i]);\n }\n };\n\n ScrollSpy.prototype.activate = function (target) {\n this.activeTarget = target;\n this.clear();\n var selector = this.selector + '[data-target=\"' + target + '\"],' + this.selector + '[href=\"' + target + '\"]';\n var active = $(selector).parents('li').addClass('active');\n\n if (active.parent('.dropdown-menu').length) {\n active = active.closest('li.dropdown').addClass('active');\n }\n\n active.trigger('activate.bs.scrollspy');\n };\n\n ScrollSpy.prototype.clear = function () {\n $(this.selector).parentsUntil(this.options.target, '.active').removeClass('active');\n }; // SCROLLSPY PLUGIN DEFINITION\n // ===========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.scrollspy');\n var options = _typeof(option) == 'object' && option;\n if (!data) $this.data('bs.scrollspy', data = new ScrollSpy(this, options));\n if (typeof option == 'string') data[option]();\n });\n }\n\n var old = $.fn.scrollspy;\n $.fn.scrollspy = Plugin;\n $.fn.scrollspy.Constructor = ScrollSpy; // SCROLLSPY NO CONFLICT\n // =====================\n\n $.fn.scrollspy.noConflict = function () {\n $.fn.scrollspy = old;\n return this;\n }; // SCROLLSPY DATA-API\n // ==================\n\n\n $(window).on('load.bs.scrollspy.data-api', function () {\n $('[data-spy=\"scroll\"]').each(function () {\n var $spy = $(this);\n Plugin.call($spy, $spy.data());\n });\n });\n}(jQuery);","/* ========================================================================\n * Bootstrap: tab.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#tabs\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // TAB CLASS DEFINITION\n // ====================\n\n var Tab = function Tab(element) {\n // jscs:disable requireDollarBeforejQueryAssignment\n this.element = $(element); // jscs:enable requireDollarBeforejQueryAssignment\n };\n\n Tab.VERSION = '3.4.1';\n Tab.TRANSITION_DURATION = 150;\n\n Tab.prototype.show = function () {\n var $this = this.element;\n var $ul = $this.closest('ul:not(.dropdown-menu)');\n var selector = $this.data('target');\n\n if (!selector) {\n selector = $this.attr('href');\n selector = selector && selector.replace(/.*(?=#[^\\s]*$)/, ''); // strip for ie7\n }\n\n if ($this.parent('li').hasClass('active')) return;\n var $previous = $ul.find('.active:last a');\n var hideEvent = $.Event('hide.bs.tab', {\n relatedTarget: $this[0]\n });\n var showEvent = $.Event('show.bs.tab', {\n relatedTarget: $previous[0]\n });\n $previous.trigger(hideEvent);\n $this.trigger(showEvent);\n if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return;\n var $target = $(document).find(selector);\n this.activate($this.closest('li'), $ul);\n this.activate($target, $target.parent(), function () {\n $previous.trigger({\n type: 'hidden.bs.tab',\n relatedTarget: $this[0]\n });\n $this.trigger({\n type: 'shown.bs.tab',\n relatedTarget: $previous[0]\n });\n });\n };\n\n Tab.prototype.activate = function (element, container, callback) {\n var $active = container.find('> .active');\n var transition = callback && $.support.transition && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length);\n\n function next() {\n $active.removeClass('active').find('> .dropdown-menu > .active').removeClass('active').end().find('[data-toggle=\"tab\"]').attr('aria-expanded', false);\n element.addClass('active').find('[data-toggle=\"tab\"]').attr('aria-expanded', true);\n\n if (transition) {\n element[0].offsetWidth; // reflow for transition\n\n element.addClass('in');\n } else {\n element.removeClass('fade');\n }\n\n if (element.parent('.dropdown-menu').length) {\n element.closest('li.dropdown').addClass('active').end().find('[data-toggle=\"tab\"]').attr('aria-expanded', true);\n }\n\n callback && callback();\n }\n\n $active.length && transition ? $active.one('bsTransitionEnd', next).emulateTransitionEnd(Tab.TRANSITION_DURATION) : next();\n $active.removeClass('in');\n }; // TAB PLUGIN DEFINITION\n // =====================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.tab');\n if (!data) $this.data('bs.tab', data = new Tab(this));\n if (typeof option == 'string') data[option]();\n });\n }\n\n var old = $.fn.tab;\n $.fn.tab = Plugin;\n $.fn.tab.Constructor = Tab; // TAB NO CONFLICT\n // ===============\n\n $.fn.tab.noConflict = function () {\n $.fn.tab = old;\n return this;\n }; // TAB DATA-API\n // ============\n\n\n var clickHandler = function clickHandler(e) {\n e.preventDefault();\n Plugin.call($(this), 'show');\n };\n\n $(document).on('click.bs.tab.data-api', '[data-toggle=\"tab\"]', clickHandler).on('click.bs.tab.data-api', '[data-toggle=\"pill\"]', clickHandler);\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/* ========================================================================\n * Bootstrap: tooltip.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#tooltip\n * Inspired by the original jQuery.tipsy by Jason Frame\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict';\n\n var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];\n var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];\n var ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i;\n var DefaultWhitelist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n div: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n };\n /**\n * A pattern that recognizes a commonly useful subset of URLs that are safe.\n *\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\n */\n\n var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;\n /**\n * A pattern that matches safe data URLs. Only matches image, video and audio types.\n *\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\n */\n\n var DATA_URL_PATTERN = /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;\n\n function allowedAttribute(attr, allowedAttributeList) {\n var attrName = attr.nodeName.toLowerCase();\n\n if ($.inArray(attrName, allowedAttributeList) !== -1) {\n if ($.inArray(attrName, uriAttrs) !== -1) {\n return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));\n }\n\n return true;\n }\n\n var regExp = $(allowedAttributeList).filter(function (index, value) {\n return value instanceof RegExp;\n }); // Check if a regular expression validates the attribute.\n\n for (var i = 0, l = regExp.length; i < l; i++) {\n if (attrName.match(regExp[i])) {\n return true;\n }\n }\n\n return false;\n }\n\n function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {\n if (unsafeHtml.length === 0) {\n return unsafeHtml;\n }\n\n if (sanitizeFn && typeof sanitizeFn === 'function') {\n return sanitizeFn(unsafeHtml);\n } // IE 8 and below don't support createHTMLDocument\n\n\n if (!document.implementation || !document.implementation.createHTMLDocument) {\n return unsafeHtml;\n }\n\n var createdDocument = document.implementation.createHTMLDocument('sanitization');\n createdDocument.body.innerHTML = unsafeHtml;\n var whitelistKeys = $.map(whiteList, function (el, i) {\n return i;\n });\n var elements = $(createdDocument.body).find('*');\n\n for (var i = 0, len = elements.length; i < len; i++) {\n var el = elements[i];\n var elName = el.nodeName.toLowerCase();\n\n if ($.inArray(elName, whitelistKeys) === -1) {\n el.parentNode.removeChild(el);\n continue;\n }\n\n var attributeList = $.map(el.attributes, function (el) {\n return el;\n });\n var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);\n\n for (var j = 0, len2 = attributeList.length; j < len2; j++) {\n if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {\n el.removeAttribute(attributeList[j].nodeName);\n }\n }\n }\n\n return createdDocument.body.innerHTML;\n } // TOOLTIP PUBLIC CLASS DEFINITION\n // ===============================\n\n\n var Tooltip = function Tooltip(element, options) {\n this.type = null;\n this.options = null;\n this.enabled = null;\n this.timeout = null;\n this.hoverState = null;\n this.$element = null;\n this.inState = null;\n this.init('tooltip', element, options);\n };\n\n Tooltip.VERSION = '3.4.1';\n Tooltip.TRANSITION_DURATION = 150;\n Tooltip.DEFAULTS = {\n animation: true,\n placement: 'top',\n selector: false,\n template: '
        ',\n trigger: 'hover focus',\n title: '',\n delay: 0,\n html: false,\n container: false,\n viewport: {\n selector: 'body',\n padding: 0\n },\n sanitize: true,\n sanitizeFn: null,\n whiteList: DefaultWhitelist\n };\n\n Tooltip.prototype.init = function (type, element, options) {\n this.enabled = true;\n this.type = type;\n this.$element = $(element);\n this.options = this.getOptions(options);\n this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : this.options.viewport.selector || this.options.viewport);\n this.inState = {\n click: false,\n hover: false,\n focus: false\n };\n\n if (this.$element[0] instanceof document.constructor && !this.options.selector) {\n throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!');\n }\n\n var triggers = this.options.trigger.split(' ');\n\n for (var i = triggers.length; i--;) {\n var trigger = triggers[i];\n\n if (trigger == 'click') {\n this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this));\n } else if (trigger != 'manual') {\n var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin';\n var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout';\n this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this));\n this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this));\n }\n }\n\n this.options.selector ? this._options = $.extend({}, this.options, {\n trigger: 'manual',\n selector: ''\n }) : this.fixTitle();\n };\n\n Tooltip.prototype.getDefaults = function () {\n return Tooltip.DEFAULTS;\n };\n\n Tooltip.prototype.getOptions = function (options) {\n var dataAttributes = this.$element.data();\n\n for (var dataAttr in dataAttributes) {\n if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {\n delete dataAttributes[dataAttr];\n }\n }\n\n options = $.extend({}, this.getDefaults(), dataAttributes, options);\n\n if (options.delay && typeof options.delay == 'number') {\n options.delay = {\n show: options.delay,\n hide: options.delay\n };\n }\n\n if (options.sanitize) {\n options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn);\n }\n\n return options;\n };\n\n Tooltip.prototype.getDelegateOptions = function () {\n var options = {};\n var defaults = this.getDefaults();\n this._options && $.each(this._options, function (key, value) {\n if (defaults[key] != value) options[key] = value;\n });\n return options;\n };\n\n Tooltip.prototype.enter = function (obj) {\n var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type);\n\n if (!self) {\n self = new this.constructor(obj.currentTarget, this.getDelegateOptions());\n $(obj.currentTarget).data('bs.' + this.type, self);\n }\n\n if (obj instanceof $.Event) {\n self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true;\n }\n\n if (self.tip().hasClass('in') || self.hoverState == 'in') {\n self.hoverState = 'in';\n return;\n }\n\n clearTimeout(self.timeout);\n self.hoverState = 'in';\n if (!self.options.delay || !self.options.delay.show) return self.show();\n self.timeout = setTimeout(function () {\n if (self.hoverState == 'in') self.show();\n }, self.options.delay.show);\n };\n\n Tooltip.prototype.isInStateTrue = function () {\n for (var key in this.inState) {\n if (this.inState[key]) return true;\n }\n\n return false;\n };\n\n Tooltip.prototype.leave = function (obj) {\n var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type);\n\n if (!self) {\n self = new this.constructor(obj.currentTarget, this.getDelegateOptions());\n $(obj.currentTarget).data('bs.' + this.type, self);\n }\n\n if (obj instanceof $.Event) {\n self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false;\n }\n\n if (self.isInStateTrue()) return;\n clearTimeout(self.timeout);\n self.hoverState = 'out';\n if (!self.options.delay || !self.options.delay.hide) return self.hide();\n self.timeout = setTimeout(function () {\n if (self.hoverState == 'out') self.hide();\n }, self.options.delay.hide);\n };\n\n Tooltip.prototype.show = function () {\n var e = $.Event('show.bs.' + this.type);\n\n if (this.hasContent() && this.enabled) {\n this.$element.trigger(e);\n var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]);\n if (e.isDefaultPrevented() || !inDom) return;\n var that = this;\n var $tip = this.tip();\n var tipId = this.getUID(this.type);\n this.setContent();\n $tip.attr('id', tipId);\n this.$element.attr('aria-describedby', tipId);\n if (this.options.animation) $tip.addClass('fade');\n var placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement;\n var autoToken = /\\s?auto?\\s?/i;\n var autoPlace = autoToken.test(placement);\n if (autoPlace) placement = placement.replace(autoToken, '') || 'top';\n $tip.detach().css({\n top: 0,\n left: 0,\n display: 'block'\n }).addClass(placement).data('bs.' + this.type, this);\n this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element);\n this.$element.trigger('inserted.bs.' + this.type);\n var pos = this.getPosition();\n var actualWidth = $tip[0].offsetWidth;\n var actualHeight = $tip[0].offsetHeight;\n\n if (autoPlace) {\n var orgPlacement = placement;\n var viewportDim = this.getPosition(this.$viewport);\n placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : placement;\n $tip.removeClass(orgPlacement).addClass(placement);\n }\n\n var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);\n this.applyPlacement(calculatedOffset, placement);\n\n var complete = function complete() {\n var prevHoverState = that.hoverState;\n that.$element.trigger('shown.bs.' + that.type);\n that.hoverState = null;\n if (prevHoverState == 'out') that.leave(that);\n };\n\n $.support.transition && this.$tip.hasClass('fade') ? $tip.one('bsTransitionEnd', complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete();\n }\n };\n\n Tooltip.prototype.applyPlacement = function (offset, placement) {\n var $tip = this.tip();\n var width = $tip[0].offsetWidth;\n var height = $tip[0].offsetHeight; // manually read margins because getBoundingClientRect includes difference\n\n var marginTop = parseInt($tip.css('margin-top'), 10);\n var marginLeft = parseInt($tip.css('margin-left'), 10); // we must check for NaN for ie 8/9\n\n if (isNaN(marginTop)) marginTop = 0;\n if (isNaN(marginLeft)) marginLeft = 0;\n offset.top += marginTop;\n offset.left += marginLeft; // $.fn.offset doesn't round pixel values\n // so we use setOffset directly with our own function B-0\n\n $.offset.setOffset($tip[0], $.extend({\n using: function using(props) {\n $tip.css({\n top: Math.round(props.top),\n left: Math.round(props.left)\n });\n }\n }, offset), 0);\n $tip.addClass('in'); // check to see if placing tip in new offset caused the tip to resize itself\n\n var actualWidth = $tip[0].offsetWidth;\n var actualHeight = $tip[0].offsetHeight;\n\n if (placement == 'top' && actualHeight != height) {\n offset.top = offset.top + height - actualHeight;\n }\n\n var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight);\n if (delta.left) offset.left += delta.left;else offset.top += delta.top;\n var isVertical = /top|bottom/.test(placement);\n var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight;\n var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight';\n $tip.offset(offset);\n this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical);\n };\n\n Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {\n this.arrow().css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%').css(isVertical ? 'top' : 'left', '');\n };\n\n Tooltip.prototype.setContent = function () {\n var $tip = this.tip();\n var title = this.getTitle();\n\n if (this.options.html) {\n if (this.options.sanitize) {\n title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn);\n }\n\n $tip.find('.tooltip-inner').html(title);\n } else {\n $tip.find('.tooltip-inner').text(title);\n }\n\n $tip.removeClass('fade in top bottom left right');\n };\n\n Tooltip.prototype.hide = function (callback) {\n var that = this;\n var $tip = $(this.$tip);\n var e = $.Event('hide.bs.' + this.type);\n\n function complete() {\n if (that.hoverState != 'in') $tip.detach();\n\n if (that.$element) {\n // TODO: Check whether guarding this code with this `if` is really necessary.\n that.$element.removeAttr('aria-describedby').trigger('hidden.bs.' + that.type);\n }\n\n callback && callback();\n }\n\n this.$element.trigger(e);\n if (e.isDefaultPrevented()) return;\n $tip.removeClass('in');\n $.support.transition && $tip.hasClass('fade') ? $tip.one('bsTransitionEnd', complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete();\n this.hoverState = null;\n return this;\n };\n\n Tooltip.prototype.fixTitle = function () {\n var $e = this.$element;\n\n if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {\n $e.attr('data-original-title', $e.attr('title') || '').attr('title', '');\n }\n };\n\n Tooltip.prototype.hasContent = function () {\n return this.getTitle();\n };\n\n Tooltip.prototype.getPosition = function ($element) {\n $element = $element || this.$element;\n var el = $element[0];\n var isBody = el.tagName == 'BODY';\n var elRect = el.getBoundingClientRect();\n\n if (elRect.width == null) {\n // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093\n elRect = $.extend({}, elRect, {\n width: elRect.right - elRect.left,\n height: elRect.bottom - elRect.top\n });\n }\n\n var isSvg = window.SVGElement && el instanceof window.SVGElement; // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.\n // See https://github.com/twbs/bootstrap/issues/20280\n\n var elOffset = isBody ? {\n top: 0,\n left: 0\n } : isSvg ? null : $element.offset();\n var scroll = {\n scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop()\n };\n var outerDims = isBody ? {\n width: $(window).width(),\n height: $(window).height()\n } : null;\n return $.extend({}, elRect, scroll, outerDims, elOffset);\n };\n\n Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {\n return placement == 'bottom' ? {\n top: pos.top + pos.height,\n left: pos.left + pos.width / 2 - actualWidth / 2\n } : placement == 'top' ? {\n top: pos.top - actualHeight,\n left: pos.left + pos.width / 2 - actualWidth / 2\n } : placement == 'left' ? {\n top: pos.top + pos.height / 2 - actualHeight / 2,\n left: pos.left - actualWidth\n } :\n /* placement == 'right' */\n {\n top: pos.top + pos.height / 2 - actualHeight / 2,\n left: pos.left + pos.width\n };\n };\n\n Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {\n var delta = {\n top: 0,\n left: 0\n };\n if (!this.$viewport) return delta;\n var viewportPadding = this.options.viewport && this.options.viewport.padding || 0;\n var viewportDimensions = this.getPosition(this.$viewport);\n\n if (/right|left/.test(placement)) {\n var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll;\n var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight;\n\n if (topEdgeOffset < viewportDimensions.top) {\n // top overflow\n delta.top = viewportDimensions.top - topEdgeOffset;\n } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) {\n // bottom overflow\n delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset;\n }\n } else {\n var leftEdgeOffset = pos.left - viewportPadding;\n var rightEdgeOffset = pos.left + viewportPadding + actualWidth;\n\n if (leftEdgeOffset < viewportDimensions.left) {\n // left overflow\n delta.left = viewportDimensions.left - leftEdgeOffset;\n } else if (rightEdgeOffset > viewportDimensions.right) {\n // right overflow\n delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset;\n }\n }\n\n return delta;\n };\n\n Tooltip.prototype.getTitle = function () {\n var title;\n var $e = this.$element;\n var o = this.options;\n title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title);\n return title;\n };\n\n Tooltip.prototype.getUID = function (prefix) {\n do {\n prefix += ~~(Math.random() * 1000000);\n } while (document.getElementById(prefix));\n\n return prefix;\n };\n\n Tooltip.prototype.tip = function () {\n if (!this.$tip) {\n this.$tip = $(this.options.template);\n\n if (this.$tip.length != 1) {\n throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!');\n }\n }\n\n return this.$tip;\n };\n\n Tooltip.prototype.arrow = function () {\n return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow');\n };\n\n Tooltip.prototype.enable = function () {\n this.enabled = true;\n };\n\n Tooltip.prototype.disable = function () {\n this.enabled = false;\n };\n\n Tooltip.prototype.toggleEnabled = function () {\n this.enabled = !this.enabled;\n };\n\n Tooltip.prototype.toggle = function (e) {\n var self = this;\n\n if (e) {\n self = $(e.currentTarget).data('bs.' + this.type);\n\n if (!self) {\n self = new this.constructor(e.currentTarget, this.getDelegateOptions());\n $(e.currentTarget).data('bs.' + this.type, self);\n }\n }\n\n if (e) {\n self.inState.click = !self.inState.click;\n if (self.isInStateTrue()) self.enter(self);else self.leave(self);\n } else {\n self.tip().hasClass('in') ? self.leave(self) : self.enter(self);\n }\n };\n\n Tooltip.prototype.destroy = function () {\n var that = this;\n clearTimeout(this.timeout);\n this.hide(function () {\n that.$element.off('.' + that.type).removeData('bs.' + that.type);\n\n if (that.$tip) {\n that.$tip.detach();\n }\n\n that.$tip = null;\n that.$arrow = null;\n that.$viewport = null;\n that.$element = null;\n });\n };\n\n Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {\n return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn);\n }; // TOOLTIP PLUGIN DEFINITION\n // =========================\n\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this);\n var data = $this.data('bs.tooltip');\n var options = _typeof(option) == 'object' && option;\n if (!data && /destroy|hide/.test(option)) return;\n if (!data) $this.data('bs.tooltip', data = new Tooltip(this, options));\n if (typeof option == 'string') data[option]();\n });\n }\n\n var old = $.fn.tooltip;\n $.fn.tooltip = Plugin;\n $.fn.tooltip.Constructor = Tooltip; // TOOLTIP NO CONFLICT\n // ===================\n\n $.fn.tooltip.noConflict = function () {\n $.fn.tooltip = old;\n return this;\n };\n}(jQuery);","/* ========================================================================\n * Bootstrap: transition.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#transitions\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n+function ($) {\n 'use strict'; // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/)\n // ============================================================\n\n function transitionEnd() {\n var el = document.createElement('bootstrap');\n var transEndEventNames = {\n WebkitTransition: 'webkitTransitionEnd',\n MozTransition: 'transitionend',\n OTransition: 'oTransitionEnd otransitionend',\n transition: 'transitionend'\n };\n\n for (var name in transEndEventNames) {\n if (el.style[name] !== undefined) {\n return {\n end: transEndEventNames[name]\n };\n }\n }\n\n return false; // explicit for ie8 ( ._.)\n } // https://blog.alexmaccaw.com/css-transitions\n\n\n $.fn.emulateTransitionEnd = function (duration) {\n var called = false;\n var $el = this;\n $(this).one('bsTransitionEnd', function () {\n called = true;\n });\n\n var callback = function callback() {\n if (!called) $($el).trigger($.support.transition.end);\n };\n\n setTimeout(callback, duration);\n return this;\n };\n\n $(function () {\n $.support.transition = transitionEnd();\n if (!$.support.transition) return;\n $.event.special.bsTransitionEnd = {\n bindType: $.support.transition.end,\n delegateType: $.support.transition.end,\n handle: function handle(e) {\n if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments);\n }\n };\n });\n}(jQuery);","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/*!\n * Chart.js v2.9.4\n * https://www.chartjs.org\n * (c) 2020 Chart.js Contributors\n * Released under the MIT License\n */\n(function (global, factory) {\n (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory(function () {\n try {\n return require('moment');\n } catch (e) {}\n }()) : typeof define === 'function' && define.amd ? define(['require'], function (require) {\n return factory(function () {\n try {\n return require('moment');\n } catch (e) {}\n }());\n }) : (global = global || self, global.Chart = factory(global.moment));\n})(this, function (moment) {\n 'use strict';\n\n moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;\n\n function createCommonjsModule(fn, module) {\n return module = {\n exports: {}\n }, fn(module, module.exports), module.exports;\n }\n\n function getCjsExportFromNamespace(n) {\n return n && n['default'] || n;\n }\n\n var colorName = {\n \"aliceblue\": [240, 248, 255],\n \"antiquewhite\": [250, 235, 215],\n \"aqua\": [0, 255, 255],\n \"aquamarine\": [127, 255, 212],\n \"azure\": [240, 255, 255],\n \"beige\": [245, 245, 220],\n \"bisque\": [255, 228, 196],\n \"black\": [0, 0, 0],\n \"blanchedalmond\": [255, 235, 205],\n \"blue\": [0, 0, 255],\n \"blueviolet\": [138, 43, 226],\n \"brown\": [165, 42, 42],\n \"burlywood\": [222, 184, 135],\n \"cadetblue\": [95, 158, 160],\n \"chartreuse\": [127, 255, 0],\n \"chocolate\": [210, 105, 30],\n \"coral\": [255, 127, 80],\n \"cornflowerblue\": [100, 149, 237],\n \"cornsilk\": [255, 248, 220],\n \"crimson\": [220, 20, 60],\n \"cyan\": [0, 255, 255],\n \"darkblue\": [0, 0, 139],\n \"darkcyan\": [0, 139, 139],\n \"darkgoldenrod\": [184, 134, 11],\n \"darkgray\": [169, 169, 169],\n \"darkgreen\": [0, 100, 0],\n \"darkgrey\": [169, 169, 169],\n \"darkkhaki\": [189, 183, 107],\n \"darkmagenta\": [139, 0, 139],\n \"darkolivegreen\": [85, 107, 47],\n \"darkorange\": [255, 140, 0],\n \"darkorchid\": [153, 50, 204],\n \"darkred\": [139, 0, 0],\n \"darksalmon\": [233, 150, 122],\n \"darkseagreen\": [143, 188, 143],\n \"darkslateblue\": [72, 61, 139],\n \"darkslategray\": [47, 79, 79],\n \"darkslategrey\": [47, 79, 79],\n \"darkturquoise\": [0, 206, 209],\n \"darkviolet\": [148, 0, 211],\n \"deeppink\": [255, 20, 147],\n \"deepskyblue\": [0, 191, 255],\n \"dimgray\": [105, 105, 105],\n \"dimgrey\": [105, 105, 105],\n \"dodgerblue\": [30, 144, 255],\n \"firebrick\": [178, 34, 34],\n \"floralwhite\": [255, 250, 240],\n \"forestgreen\": [34, 139, 34],\n \"fuchsia\": [255, 0, 255],\n \"gainsboro\": [220, 220, 220],\n \"ghostwhite\": [248, 248, 255],\n \"gold\": [255, 215, 0],\n \"goldenrod\": [218, 165, 32],\n \"gray\": [128, 128, 128],\n \"green\": [0, 128, 0],\n \"greenyellow\": [173, 255, 47],\n \"grey\": [128, 128, 128],\n \"honeydew\": [240, 255, 240],\n \"hotpink\": [255, 105, 180],\n \"indianred\": [205, 92, 92],\n \"indigo\": [75, 0, 130],\n \"ivory\": [255, 255, 240],\n \"khaki\": [240, 230, 140],\n \"lavender\": [230, 230, 250],\n \"lavenderblush\": [255, 240, 245],\n \"lawngreen\": [124, 252, 0],\n \"lemonchiffon\": [255, 250, 205],\n \"lightblue\": [173, 216, 230],\n \"lightcoral\": [240, 128, 128],\n \"lightcyan\": [224, 255, 255],\n \"lightgoldenrodyellow\": [250, 250, 210],\n \"lightgray\": [211, 211, 211],\n \"lightgreen\": [144, 238, 144],\n \"lightgrey\": [211, 211, 211],\n \"lightpink\": [255, 182, 193],\n \"lightsalmon\": [255, 160, 122],\n \"lightseagreen\": [32, 178, 170],\n \"lightskyblue\": [135, 206, 250],\n \"lightslategray\": [119, 136, 153],\n \"lightslategrey\": [119, 136, 153],\n \"lightsteelblue\": [176, 196, 222],\n \"lightyellow\": [255, 255, 224],\n \"lime\": [0, 255, 0],\n \"limegreen\": [50, 205, 50],\n \"linen\": [250, 240, 230],\n \"magenta\": [255, 0, 255],\n \"maroon\": [128, 0, 0],\n \"mediumaquamarine\": [102, 205, 170],\n \"mediumblue\": [0, 0, 205],\n \"mediumorchid\": [186, 85, 211],\n \"mediumpurple\": [147, 112, 219],\n \"mediumseagreen\": [60, 179, 113],\n \"mediumslateblue\": [123, 104, 238],\n \"mediumspringgreen\": [0, 250, 154],\n \"mediumturquoise\": [72, 209, 204],\n \"mediumvioletred\": [199, 21, 133],\n \"midnightblue\": [25, 25, 112],\n \"mintcream\": [245, 255, 250],\n \"mistyrose\": [255, 228, 225],\n \"moccasin\": [255, 228, 181],\n \"navajowhite\": [255, 222, 173],\n \"navy\": [0, 0, 128],\n \"oldlace\": [253, 245, 230],\n \"olive\": [128, 128, 0],\n \"olivedrab\": [107, 142, 35],\n \"orange\": [255, 165, 0],\n \"orangered\": [255, 69, 0],\n \"orchid\": [218, 112, 214],\n \"palegoldenrod\": [238, 232, 170],\n \"palegreen\": [152, 251, 152],\n \"paleturquoise\": [175, 238, 238],\n \"palevioletred\": [219, 112, 147],\n \"papayawhip\": [255, 239, 213],\n \"peachpuff\": [255, 218, 185],\n \"peru\": [205, 133, 63],\n \"pink\": [255, 192, 203],\n \"plum\": [221, 160, 221],\n \"powderblue\": [176, 224, 230],\n \"purple\": [128, 0, 128],\n \"rebeccapurple\": [102, 51, 153],\n \"red\": [255, 0, 0],\n \"rosybrown\": [188, 143, 143],\n \"royalblue\": [65, 105, 225],\n \"saddlebrown\": [139, 69, 19],\n \"salmon\": [250, 128, 114],\n \"sandybrown\": [244, 164, 96],\n \"seagreen\": [46, 139, 87],\n \"seashell\": [255, 245, 238],\n \"sienna\": [160, 82, 45],\n \"silver\": [192, 192, 192],\n \"skyblue\": [135, 206, 235],\n \"slateblue\": [106, 90, 205],\n \"slategray\": [112, 128, 144],\n \"slategrey\": [112, 128, 144],\n \"snow\": [255, 250, 250],\n \"springgreen\": [0, 255, 127],\n \"steelblue\": [70, 130, 180],\n \"tan\": [210, 180, 140],\n \"teal\": [0, 128, 128],\n \"thistle\": [216, 191, 216],\n \"tomato\": [255, 99, 71],\n \"turquoise\": [64, 224, 208],\n \"violet\": [238, 130, 238],\n \"wheat\": [245, 222, 179],\n \"white\": [255, 255, 255],\n \"whitesmoke\": [245, 245, 245],\n \"yellow\": [255, 255, 0],\n \"yellowgreen\": [154, 205, 50]\n };\n var conversions = createCommonjsModule(function (module) {\n /* MIT license */\n // NOTE: conversions should only return primitive values (i.e. arrays, or\n // values that give correct `typeof` results).\n // do not use box values types (i.e. Number(), String(), etc.)\n var reverseKeywords = {};\n\n for (var key in colorName) {\n if (colorName.hasOwnProperty(key)) {\n reverseKeywords[colorName[key]] = key;\n }\n }\n\n var convert = module.exports = {\n rgb: {\n channels: 3,\n labels: 'rgb'\n },\n hsl: {\n channels: 3,\n labels: 'hsl'\n },\n hsv: {\n channels: 3,\n labels: 'hsv'\n },\n hwb: {\n channels: 3,\n labels: 'hwb'\n },\n cmyk: {\n channels: 4,\n labels: 'cmyk'\n },\n xyz: {\n channels: 3,\n labels: 'xyz'\n },\n lab: {\n channels: 3,\n labels: 'lab'\n },\n lch: {\n channels: 3,\n labels: 'lch'\n },\n hex: {\n channels: 1,\n labels: ['hex']\n },\n keyword: {\n channels: 1,\n labels: ['keyword']\n },\n ansi16: {\n channels: 1,\n labels: ['ansi16']\n },\n ansi256: {\n channels: 1,\n labels: ['ansi256']\n },\n hcg: {\n channels: 3,\n labels: ['h', 'c', 'g']\n },\n apple: {\n channels: 3,\n labels: ['r16', 'g16', 'b16']\n },\n gray: {\n channels: 1,\n labels: ['gray']\n }\n }; // hide .channels and .labels properties\n\n for (var model in convert) {\n if (convert.hasOwnProperty(model)) {\n if (!('channels' in convert[model])) {\n throw new Error('missing channels property: ' + model);\n }\n\n if (!('labels' in convert[model])) {\n throw new Error('missing channel labels property: ' + model);\n }\n\n if (convert[model].labels.length !== convert[model].channels) {\n throw new Error('channel and label counts mismatch: ' + model);\n }\n\n var channels = convert[model].channels;\n var labels = convert[model].labels;\n delete convert[model].channels;\n delete convert[model].labels;\n Object.defineProperty(convert[model], 'channels', {\n value: channels\n });\n Object.defineProperty(convert[model], 'labels', {\n value: labels\n });\n }\n }\n\n convert.rgb.hsl = function (rgb) {\n var r = rgb[0] / 255;\n var g = rgb[1] / 255;\n var b = rgb[2] / 255;\n var min = Math.min(r, g, b);\n var max = Math.max(r, g, b);\n var delta = max - min;\n var h;\n var s;\n var l;\n\n if (max === min) {\n h = 0;\n } else if (r === max) {\n h = (g - b) / delta;\n } else if (g === max) {\n h = 2 + (b - r) / delta;\n } else if (b === max) {\n h = 4 + (r - g) / delta;\n }\n\n h = Math.min(h * 60, 360);\n\n if (h < 0) {\n h += 360;\n }\n\n l = (min + max) / 2;\n\n if (max === min) {\n s = 0;\n } else if (l <= 0.5) {\n s = delta / (max + min);\n } else {\n s = delta / (2 - max - min);\n }\n\n return [h, s * 100, l * 100];\n };\n\n convert.rgb.hsv = function (rgb) {\n var rdif;\n var gdif;\n var bdif;\n var h;\n var s;\n var r = rgb[0] / 255;\n var g = rgb[1] / 255;\n var b = rgb[2] / 255;\n var v = Math.max(r, g, b);\n var diff = v - Math.min(r, g, b);\n\n var diffc = function diffc(c) {\n return (v - c) / 6 / diff + 1 / 2;\n };\n\n if (diff === 0) {\n h = s = 0;\n } else {\n s = diff / v;\n rdif = diffc(r);\n gdif = diffc(g);\n bdif = diffc(b);\n\n if (r === v) {\n h = bdif - gdif;\n } else if (g === v) {\n h = 1 / 3 + rdif - bdif;\n } else if (b === v) {\n h = 2 / 3 + gdif - rdif;\n }\n\n if (h < 0) {\n h += 1;\n } else if (h > 1) {\n h -= 1;\n }\n }\n\n return [h * 360, s * 100, v * 100];\n };\n\n convert.rgb.hwb = function (rgb) {\n var r = rgb[0];\n var g = rgb[1];\n var b = rgb[2];\n var h = convert.rgb.hsl(rgb)[0];\n var w = 1 / 255 * Math.min(r, Math.min(g, b));\n b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n return [h, w * 100, b * 100];\n };\n\n convert.rgb.cmyk = function (rgb) {\n var r = rgb[0] / 255;\n var g = rgb[1] / 255;\n var b = rgb[2] / 255;\n var c;\n var m;\n var y;\n var k;\n k = Math.min(1 - r, 1 - g, 1 - b);\n c = (1 - r - k) / (1 - k) || 0;\n m = (1 - g - k) / (1 - k) || 0;\n y = (1 - b - k) / (1 - k) || 0;\n return [c * 100, m * 100, y * 100, k * 100];\n };\n /**\n * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n * */\n\n\n function comparativeDistance(x, y) {\n return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);\n }\n\n convert.rgb.keyword = function (rgb) {\n var reversed = reverseKeywords[rgb];\n\n if (reversed) {\n return reversed;\n }\n\n var currentClosestDistance = Infinity;\n var currentClosestKeyword;\n\n for (var keyword in colorName) {\n if (colorName.hasOwnProperty(keyword)) {\n var value = colorName[keyword]; // Compute comparative distance\n\n var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest\n\n if (distance < currentClosestDistance) {\n currentClosestDistance = distance;\n currentClosestKeyword = keyword;\n }\n }\n }\n\n return currentClosestKeyword;\n };\n\n convert.keyword.rgb = function (keyword) {\n return colorName[keyword];\n };\n\n convert.rgb.xyz = function (rgb) {\n var r = rgb[0] / 255;\n var g = rgb[1] / 255;\n var b = rgb[2] / 255; // assume sRGB\n\n r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;\n g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;\n b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;\n var x = r * 0.4124 + g * 0.3576 + b * 0.1805;\n var y = r * 0.2126 + g * 0.7152 + b * 0.0722;\n var z = r * 0.0193 + g * 0.1192 + b * 0.9505;\n return [x * 100, y * 100, z * 100];\n };\n\n convert.rgb.lab = function (rgb) {\n var xyz = convert.rgb.xyz(rgb);\n var x = xyz[0];\n var y = xyz[1];\n var z = xyz[2];\n var l;\n var a;\n var b;\n x /= 95.047;\n y /= 100;\n z /= 108.883;\n x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;\n y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;\n z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;\n l = 116 * y - 16;\n a = 500 * (x - y);\n b = 200 * (y - z);\n return [l, a, b];\n };\n\n convert.hsl.rgb = function (hsl) {\n var h = hsl[0] / 360;\n var s = hsl[1] / 100;\n var l = hsl[2] / 100;\n var t1;\n var t2;\n var t3;\n var rgb;\n var val;\n\n if (s === 0) {\n val = l * 255;\n return [val, val, val];\n }\n\n if (l < 0.5) {\n t2 = l * (1 + s);\n } else {\n t2 = l + s - l * s;\n }\n\n t1 = 2 * l - t2;\n rgb = [0, 0, 0];\n\n for (var i = 0; i < 3; i++) {\n t3 = h + 1 / 3 * -(i - 1);\n\n if (t3 < 0) {\n t3++;\n }\n\n if (t3 > 1) {\n t3--;\n }\n\n if (6 * t3 < 1) {\n val = t1 + (t2 - t1) * 6 * t3;\n } else if (2 * t3 < 1) {\n val = t2;\n } else if (3 * t3 < 2) {\n val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n } else {\n val = t1;\n }\n\n rgb[i] = val * 255;\n }\n\n return rgb;\n };\n\n convert.hsl.hsv = function (hsl) {\n var h = hsl[0];\n var s = hsl[1] / 100;\n var l = hsl[2] / 100;\n var smin = s;\n var lmin = Math.max(l, 0.01);\n var sv;\n var v;\n l *= 2;\n s *= l <= 1 ? l : 2 - l;\n smin *= lmin <= 1 ? lmin : 2 - lmin;\n v = (l + s) / 2;\n sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);\n return [h, sv * 100, v * 100];\n };\n\n convert.hsv.rgb = function (hsv) {\n var h = hsv[0] / 60;\n var s = hsv[1] / 100;\n var v = hsv[2] / 100;\n var hi = Math.floor(h) % 6;\n var f = h - Math.floor(h);\n var p = 255 * v * (1 - s);\n var q = 255 * v * (1 - s * f);\n var t = 255 * v * (1 - s * (1 - f));\n v *= 255;\n\n switch (hi) {\n case 0:\n return [v, t, p];\n\n case 1:\n return [q, v, p];\n\n case 2:\n return [p, v, t];\n\n case 3:\n return [p, q, v];\n\n case 4:\n return [t, p, v];\n\n case 5:\n return [v, p, q];\n }\n };\n\n convert.hsv.hsl = function (hsv) {\n var h = hsv[0];\n var s = hsv[1] / 100;\n var v = hsv[2] / 100;\n var vmin = Math.max(v, 0.01);\n var lmin;\n var sl;\n var l;\n l = (2 - s) * v;\n lmin = (2 - s) * vmin;\n sl = s * vmin;\n sl /= lmin <= 1 ? lmin : 2 - lmin;\n sl = sl || 0;\n l /= 2;\n return [h, sl * 100, l * 100];\n }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb\n\n\n convert.hwb.rgb = function (hwb) {\n var h = hwb[0] / 360;\n var wh = hwb[1] / 100;\n var bl = hwb[2] / 100;\n var ratio = wh + bl;\n var i;\n var v;\n var f;\n var n; // wh + bl cant be > 1\n\n if (ratio > 1) {\n wh /= ratio;\n bl /= ratio;\n }\n\n i = Math.floor(6 * h);\n v = 1 - bl;\n f = 6 * h - i;\n\n if ((i & 0x01) !== 0) {\n f = 1 - f;\n }\n\n n = wh + f * (v - wh); // linear interpolation\n\n var r;\n var g;\n var b;\n\n switch (i) {\n default:\n case 6:\n case 0:\n r = v;\n g = n;\n b = wh;\n break;\n\n case 1:\n r = n;\n g = v;\n b = wh;\n break;\n\n case 2:\n r = wh;\n g = v;\n b = n;\n break;\n\n case 3:\n r = wh;\n g = n;\n b = v;\n break;\n\n case 4:\n r = n;\n g = wh;\n b = v;\n break;\n\n case 5:\n r = v;\n g = wh;\n b = n;\n break;\n }\n\n return [r * 255, g * 255, b * 255];\n };\n\n convert.cmyk.rgb = function (cmyk) {\n var c = cmyk[0] / 100;\n var m = cmyk[1] / 100;\n var y = cmyk[2] / 100;\n var k = cmyk[3] / 100;\n var r;\n var g;\n var b;\n r = 1 - Math.min(1, c * (1 - k) + k);\n g = 1 - Math.min(1, m * (1 - k) + k);\n b = 1 - Math.min(1, y * (1 - k) + k);\n return [r * 255, g * 255, b * 255];\n };\n\n convert.xyz.rgb = function (xyz) {\n var x = xyz[0] / 100;\n var y = xyz[1] / 100;\n var z = xyz[2] / 100;\n var r;\n var g;\n var b;\n r = x * 3.2406 + y * -1.5372 + z * -0.4986;\n g = x * -0.9689 + y * 1.8758 + z * 0.0415;\n b = x * 0.0557 + y * -0.2040 + z * 1.0570; // assume sRGB\n\n r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;\n g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;\n b = b > 0.0031308 ? 1.055 * Math.pow(b, 1.0 / 2.4) - 0.055 : b * 12.92;\n r = Math.min(Math.max(0, r), 1);\n g = Math.min(Math.max(0, g), 1);\n b = Math.min(Math.max(0, b), 1);\n return [r * 255, g * 255, b * 255];\n };\n\n convert.xyz.lab = function (xyz) {\n var x = xyz[0];\n var y = xyz[1];\n var z = xyz[2];\n var l;\n var a;\n var b;\n x /= 95.047;\n y /= 100;\n z /= 108.883;\n x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;\n y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;\n z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;\n l = 116 * y - 16;\n a = 500 * (x - y);\n b = 200 * (y - z);\n return [l, a, b];\n };\n\n convert.lab.xyz = function (lab) {\n var l = lab[0];\n var a = lab[1];\n var b = lab[2];\n var x;\n var y;\n var z;\n y = (l + 16) / 116;\n x = a / 500 + y;\n z = y - b / 200;\n var y2 = Math.pow(y, 3);\n var x2 = Math.pow(x, 3);\n var z2 = Math.pow(z, 3);\n y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n x *= 95.047;\n y *= 100;\n z *= 108.883;\n return [x, y, z];\n };\n\n convert.lab.lch = function (lab) {\n var l = lab[0];\n var a = lab[1];\n var b = lab[2];\n var hr;\n var h;\n var c;\n hr = Math.atan2(b, a);\n h = hr * 360 / 2 / Math.PI;\n\n if (h < 0) {\n h += 360;\n }\n\n c = Math.sqrt(a * a + b * b);\n return [l, c, h];\n };\n\n convert.lch.lab = function (lch) {\n var l = lch[0];\n var c = lch[1];\n var h = lch[2];\n var a;\n var b;\n var hr;\n hr = h / 360 * 2 * Math.PI;\n a = c * Math.cos(hr);\n b = c * Math.sin(hr);\n return [l, a, b];\n };\n\n convert.rgb.ansi16 = function (args) {\n var r = args[0];\n var g = args[1];\n var b = args[2];\n var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization\n\n value = Math.round(value / 50);\n\n if (value === 0) {\n return 30;\n }\n\n var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));\n\n if (value === 2) {\n ansi += 60;\n }\n\n return ansi;\n };\n\n convert.hsv.ansi16 = function (args) {\n // optimization here; we already know the value and don't need to get\n // it converted for us.\n return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n };\n\n convert.rgb.ansi256 = function (args) {\n var r = args[0];\n var g = args[1];\n var b = args[2]; // we use the extended greyscale palette here, with the exception of\n // black and white. normal palette only has 4 greyscale shades.\n\n if (r === g && g === b) {\n if (r < 8) {\n return 16;\n }\n\n if (r > 248) {\n return 231;\n }\n\n return Math.round((r - 8) / 247 * 24) + 232;\n }\n\n var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);\n return ansi;\n };\n\n convert.ansi16.rgb = function (args) {\n var color = args % 10; // handle greyscale\n\n if (color === 0 || color === 7) {\n if (args > 50) {\n color += 3.5;\n }\n\n color = color / 10.5 * 255;\n return [color, color, color];\n }\n\n var mult = (~~(args > 50) + 1) * 0.5;\n var r = (color & 1) * mult * 255;\n var g = (color >> 1 & 1) * mult * 255;\n var b = (color >> 2 & 1) * mult * 255;\n return [r, g, b];\n };\n\n convert.ansi256.rgb = function (args) {\n // handle greyscale\n if (args >= 232) {\n var c = (args - 232) * 10 + 8;\n return [c, c, c];\n }\n\n args -= 16;\n var rem;\n var r = Math.floor(args / 36) / 5 * 255;\n var g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n var b = rem % 6 / 5 * 255;\n return [r, g, b];\n };\n\n convert.rgb.hex = function (args) {\n var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);\n var string = integer.toString(16).toUpperCase();\n return '000000'.substring(string.length) + string;\n };\n\n convert.hex.rgb = function (args) {\n var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\n if (!match) {\n return [0, 0, 0];\n }\n\n var colorString = match[0];\n\n if (match[0].length === 3) {\n colorString = colorString.split('').map(function (char) {\n return char + char;\n }).join('');\n }\n\n var integer = parseInt(colorString, 16);\n var r = integer >> 16 & 0xFF;\n var g = integer >> 8 & 0xFF;\n var b = integer & 0xFF;\n return [r, g, b];\n };\n\n convert.rgb.hcg = function (rgb) {\n var r = rgb[0] / 255;\n var g = rgb[1] / 255;\n var b = rgb[2] / 255;\n var max = Math.max(Math.max(r, g), b);\n var min = Math.min(Math.min(r, g), b);\n var chroma = max - min;\n var grayscale;\n var hue;\n\n if (chroma < 1) {\n grayscale = min / (1 - chroma);\n } else {\n grayscale = 0;\n }\n\n if (chroma <= 0) {\n hue = 0;\n } else if (max === r) {\n hue = (g - b) / chroma % 6;\n } else if (max === g) {\n hue = 2 + (b - r) / chroma;\n } else {\n hue = 4 + (r - g) / chroma + 4;\n }\n\n hue /= 6;\n hue %= 1;\n return [hue * 360, chroma * 100, grayscale * 100];\n };\n\n convert.hsl.hcg = function (hsl) {\n var s = hsl[1] / 100;\n var l = hsl[2] / 100;\n var c = 1;\n var f = 0;\n\n if (l < 0.5) {\n c = 2.0 * s * l;\n } else {\n c = 2.0 * s * (1.0 - l);\n }\n\n if (c < 1.0) {\n f = (l - 0.5 * c) / (1.0 - c);\n }\n\n return [hsl[0], c * 100, f * 100];\n };\n\n convert.hsv.hcg = function (hsv) {\n var s = hsv[1] / 100;\n var v = hsv[2] / 100;\n var c = s * v;\n var f = 0;\n\n if (c < 1.0) {\n f = (v - c) / (1 - c);\n }\n\n return [hsv[0], c * 100, f * 100];\n };\n\n convert.hcg.rgb = function (hcg) {\n var h = hcg[0] / 360;\n var c = hcg[1] / 100;\n var g = hcg[2] / 100;\n\n if (c === 0.0) {\n return [g * 255, g * 255, g * 255];\n }\n\n var pure = [0, 0, 0];\n var hi = h % 1 * 6;\n var v = hi % 1;\n var w = 1 - v;\n var mg = 0;\n\n switch (Math.floor(hi)) {\n case 0:\n pure[0] = 1;\n pure[1] = v;\n pure[2] = 0;\n break;\n\n case 1:\n pure[0] = w;\n pure[1] = 1;\n pure[2] = 0;\n break;\n\n case 2:\n pure[0] = 0;\n pure[1] = 1;\n pure[2] = v;\n break;\n\n case 3:\n pure[0] = 0;\n pure[1] = w;\n pure[2] = 1;\n break;\n\n case 4:\n pure[0] = v;\n pure[1] = 0;\n pure[2] = 1;\n break;\n\n default:\n pure[0] = 1;\n pure[1] = 0;\n pure[2] = w;\n }\n\n mg = (1.0 - c) * g;\n return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];\n };\n\n convert.hcg.hsv = function (hcg) {\n var c = hcg[1] / 100;\n var g = hcg[2] / 100;\n var v = c + g * (1.0 - c);\n var f = 0;\n\n if (v > 0.0) {\n f = c / v;\n }\n\n return [hcg[0], f * 100, v * 100];\n };\n\n convert.hcg.hsl = function (hcg) {\n var c = hcg[1] / 100;\n var g = hcg[2] / 100;\n var l = g * (1.0 - c) + 0.5 * c;\n var s = 0;\n\n if (l > 0.0 && l < 0.5) {\n s = c / (2 * l);\n } else if (l >= 0.5 && l < 1.0) {\n s = c / (2 * (1 - l));\n }\n\n return [hcg[0], s * 100, l * 100];\n };\n\n convert.hcg.hwb = function (hcg) {\n var c = hcg[1] / 100;\n var g = hcg[2] / 100;\n var v = c + g * (1.0 - c);\n return [hcg[0], (v - c) * 100, (1 - v) * 100];\n };\n\n convert.hwb.hcg = function (hwb) {\n var w = hwb[1] / 100;\n var b = hwb[2] / 100;\n var v = 1 - b;\n var c = v - w;\n var g = 0;\n\n if (c < 1) {\n g = (v - c) / (1 - c);\n }\n\n return [hwb[0], c * 100, g * 100];\n };\n\n convert.apple.rgb = function (apple) {\n return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];\n };\n\n convert.rgb.apple = function (rgb) {\n return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];\n };\n\n convert.gray.rgb = function (args) {\n return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n };\n\n convert.gray.hsl = convert.gray.hsv = function (args) {\n return [0, 0, args[0]];\n };\n\n convert.gray.hwb = function (gray) {\n return [0, 100, gray[0]];\n };\n\n convert.gray.cmyk = function (gray) {\n return [0, 0, 0, gray[0]];\n };\n\n convert.gray.lab = function (gray) {\n return [gray[0], 0, 0];\n };\n\n convert.gray.hex = function (gray) {\n var val = Math.round(gray[0] / 100 * 255) & 0xFF;\n var integer = (val << 16) + (val << 8) + val;\n var string = integer.toString(16).toUpperCase();\n return '000000'.substring(string.length) + string;\n };\n\n convert.rgb.gray = function (rgb) {\n var val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n return [val / 255 * 100];\n };\n });\n var conversions_1 = conversions.rgb;\n var conversions_2 = conversions.hsl;\n var conversions_3 = conversions.hsv;\n var conversions_4 = conversions.hwb;\n var conversions_5 = conversions.cmyk;\n var conversions_6 = conversions.xyz;\n var conversions_7 = conversions.lab;\n var conversions_8 = conversions.lch;\n var conversions_9 = conversions.hex;\n var conversions_10 = conversions.keyword;\n var conversions_11 = conversions.ansi16;\n var conversions_12 = conversions.ansi256;\n var conversions_13 = conversions.hcg;\n var conversions_14 = conversions.apple;\n var conversions_15 = conversions.gray;\n /*\n \tthis function routes a model to all other models.\n \n \tall functions that are routed have a property `.conversion` attached\n \tto the returned synthetic function. This property is an array\n \tof strings, each with the steps in between the 'from' and 'to'\n \tcolor models (inclusive).\n \n \tconversions that are not possible simply are not included.\n */\n\n function buildGraph() {\n var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\n var models = Object.keys(conversions);\n\n for (var len = models.length, i = 0; i < len; i++) {\n graph[models[i]] = {\n // http://jsperf.com/1-vs-infinity\n // micro-opt, but this is simple.\n distance: -1,\n parent: null\n };\n }\n\n return graph;\n } // https://en.wikipedia.org/wiki/Breadth-first_search\n\n\n function deriveBFS(fromModel) {\n var graph = buildGraph();\n var queue = [fromModel]; // unshift -> queue -> pop\n\n graph[fromModel].distance = 0;\n\n while (queue.length) {\n var current = queue.pop();\n var adjacents = Object.keys(conversions[current]);\n\n for (var len = adjacents.length, i = 0; i < len; i++) {\n var adjacent = adjacents[i];\n var node = graph[adjacent];\n\n if (node.distance === -1) {\n node.distance = graph[current].distance + 1;\n node.parent = current;\n queue.unshift(adjacent);\n }\n }\n }\n\n return graph;\n }\n\n function link(from, to) {\n return function (args) {\n return to(from(args));\n };\n }\n\n function wrapConversion(toModel, graph) {\n var path = [graph[toModel].parent, toModel];\n var fn = conversions[graph[toModel].parent][toModel];\n var cur = graph[toModel].parent;\n\n while (graph[cur].parent) {\n path.unshift(graph[cur].parent);\n fn = link(conversions[graph[cur].parent][cur], fn);\n cur = graph[cur].parent;\n }\n\n fn.conversion = path;\n return fn;\n }\n\n var route = function route(fromModel) {\n var graph = deriveBFS(fromModel);\n var conversion = {};\n var models = Object.keys(graph);\n\n for (var len = models.length, i = 0; i < len; i++) {\n var toModel = models[i];\n var node = graph[toModel];\n\n if (node.parent === null) {\n // no possible conversion, or this node is the source model.\n continue;\n }\n\n conversion[toModel] = wrapConversion(toModel, graph);\n }\n\n return conversion;\n };\n\n var convert = {};\n var models = Object.keys(conversions);\n\n function wrapRaw(fn) {\n var wrappedFn = function wrappedFn(args) {\n if (args === undefined || args === null) {\n return args;\n }\n\n if (arguments.length > 1) {\n args = Array.prototype.slice.call(arguments);\n }\n\n return fn(args);\n }; // preserve .conversion property if there is one\n\n\n if ('conversion' in fn) {\n wrappedFn.conversion = fn.conversion;\n }\n\n return wrappedFn;\n }\n\n function wrapRounded(fn) {\n var wrappedFn = function wrappedFn(args) {\n if (args === undefined || args === null) {\n return args;\n }\n\n if (arguments.length > 1) {\n args = Array.prototype.slice.call(arguments);\n }\n\n var result = fn(args); // we're assuming the result is an array here.\n // see notice in conversions.js; don't use box types\n // in conversion functions.\n\n if (_typeof(result) === 'object') {\n for (var len = result.length, i = 0; i < len; i++) {\n result[i] = Math.round(result[i]);\n }\n }\n\n return result;\n }; // preserve .conversion property if there is one\n\n\n if ('conversion' in fn) {\n wrappedFn.conversion = fn.conversion;\n }\n\n return wrappedFn;\n }\n\n models.forEach(function (fromModel) {\n convert[fromModel] = {};\n Object.defineProperty(convert[fromModel], 'channels', {\n value: conversions[fromModel].channels\n });\n Object.defineProperty(convert[fromModel], 'labels', {\n value: conversions[fromModel].labels\n });\n var routes = route(fromModel);\n var routeModels = Object.keys(routes);\n routeModels.forEach(function (toModel) {\n var fn = routes[toModel];\n convert[fromModel][toModel] = wrapRounded(fn);\n convert[fromModel][toModel].raw = wrapRaw(fn);\n });\n });\n var colorConvert = convert;\n var colorName$1 = {\n \"aliceblue\": [240, 248, 255],\n \"antiquewhite\": [250, 235, 215],\n \"aqua\": [0, 255, 255],\n \"aquamarine\": [127, 255, 212],\n \"azure\": [240, 255, 255],\n \"beige\": [245, 245, 220],\n \"bisque\": [255, 228, 196],\n \"black\": [0, 0, 0],\n \"blanchedalmond\": [255, 235, 205],\n \"blue\": [0, 0, 255],\n \"blueviolet\": [138, 43, 226],\n \"brown\": [165, 42, 42],\n \"burlywood\": [222, 184, 135],\n \"cadetblue\": [95, 158, 160],\n \"chartreuse\": [127, 255, 0],\n \"chocolate\": [210, 105, 30],\n \"coral\": [255, 127, 80],\n \"cornflowerblue\": [100, 149, 237],\n \"cornsilk\": [255, 248, 220],\n \"crimson\": [220, 20, 60],\n \"cyan\": [0, 255, 255],\n \"darkblue\": [0, 0, 139],\n \"darkcyan\": [0, 139, 139],\n \"darkgoldenrod\": [184, 134, 11],\n \"darkgray\": [169, 169, 169],\n \"darkgreen\": [0, 100, 0],\n \"darkgrey\": [169, 169, 169],\n \"darkkhaki\": [189, 183, 107],\n \"darkmagenta\": [139, 0, 139],\n \"darkolivegreen\": [85, 107, 47],\n \"darkorange\": [255, 140, 0],\n \"darkorchid\": [153, 50, 204],\n \"darkred\": [139, 0, 0],\n \"darksalmon\": [233, 150, 122],\n \"darkseagreen\": [143, 188, 143],\n \"darkslateblue\": [72, 61, 139],\n \"darkslategray\": [47, 79, 79],\n \"darkslategrey\": [47, 79, 79],\n \"darkturquoise\": [0, 206, 209],\n \"darkviolet\": [148, 0, 211],\n \"deeppink\": [255, 20, 147],\n \"deepskyblue\": [0, 191, 255],\n \"dimgray\": [105, 105, 105],\n \"dimgrey\": [105, 105, 105],\n \"dodgerblue\": [30, 144, 255],\n \"firebrick\": [178, 34, 34],\n \"floralwhite\": [255, 250, 240],\n \"forestgreen\": [34, 139, 34],\n \"fuchsia\": [255, 0, 255],\n \"gainsboro\": [220, 220, 220],\n \"ghostwhite\": [248, 248, 255],\n \"gold\": [255, 215, 0],\n \"goldenrod\": [218, 165, 32],\n \"gray\": [128, 128, 128],\n \"green\": [0, 128, 0],\n \"greenyellow\": [173, 255, 47],\n \"grey\": [128, 128, 128],\n \"honeydew\": [240, 255, 240],\n \"hotpink\": [255, 105, 180],\n \"indianred\": [205, 92, 92],\n \"indigo\": [75, 0, 130],\n \"ivory\": [255, 255, 240],\n \"khaki\": [240, 230, 140],\n \"lavender\": [230, 230, 250],\n \"lavenderblush\": [255, 240, 245],\n \"lawngreen\": [124, 252, 0],\n \"lemonchiffon\": [255, 250, 205],\n \"lightblue\": [173, 216, 230],\n \"lightcoral\": [240, 128, 128],\n \"lightcyan\": [224, 255, 255],\n \"lightgoldenrodyellow\": [250, 250, 210],\n \"lightgray\": [211, 211, 211],\n \"lightgreen\": [144, 238, 144],\n \"lightgrey\": [211, 211, 211],\n \"lightpink\": [255, 182, 193],\n \"lightsalmon\": [255, 160, 122],\n \"lightseagreen\": [32, 178, 170],\n \"lightskyblue\": [135, 206, 250],\n \"lightslategray\": [119, 136, 153],\n \"lightslategrey\": [119, 136, 153],\n \"lightsteelblue\": [176, 196, 222],\n \"lightyellow\": [255, 255, 224],\n \"lime\": [0, 255, 0],\n \"limegreen\": [50, 205, 50],\n \"linen\": [250, 240, 230],\n \"magenta\": [255, 0, 255],\n \"maroon\": [128, 0, 0],\n \"mediumaquamarine\": [102, 205, 170],\n \"mediumblue\": [0, 0, 205],\n \"mediumorchid\": [186, 85, 211],\n \"mediumpurple\": [147, 112, 219],\n \"mediumseagreen\": [60, 179, 113],\n \"mediumslateblue\": [123, 104, 238],\n \"mediumspringgreen\": [0, 250, 154],\n \"mediumturquoise\": [72, 209, 204],\n \"mediumvioletred\": [199, 21, 133],\n \"midnightblue\": [25, 25, 112],\n \"mintcream\": [245, 255, 250],\n \"mistyrose\": [255, 228, 225],\n \"moccasin\": [255, 228, 181],\n \"navajowhite\": [255, 222, 173],\n \"navy\": [0, 0, 128],\n \"oldlace\": [253, 245, 230],\n \"olive\": [128, 128, 0],\n \"olivedrab\": [107, 142, 35],\n \"orange\": [255, 165, 0],\n \"orangered\": [255, 69, 0],\n \"orchid\": [218, 112, 214],\n \"palegoldenrod\": [238, 232, 170],\n \"palegreen\": [152, 251, 152],\n \"paleturquoise\": [175, 238, 238],\n \"palevioletred\": [219, 112, 147],\n \"papayawhip\": [255, 239, 213],\n \"peachpuff\": [255, 218, 185],\n \"peru\": [205, 133, 63],\n \"pink\": [255, 192, 203],\n \"plum\": [221, 160, 221],\n \"powderblue\": [176, 224, 230],\n \"purple\": [128, 0, 128],\n \"rebeccapurple\": [102, 51, 153],\n \"red\": [255, 0, 0],\n \"rosybrown\": [188, 143, 143],\n \"royalblue\": [65, 105, 225],\n \"saddlebrown\": [139, 69, 19],\n \"salmon\": [250, 128, 114],\n \"sandybrown\": [244, 164, 96],\n \"seagreen\": [46, 139, 87],\n \"seashell\": [255, 245, 238],\n \"sienna\": [160, 82, 45],\n \"silver\": [192, 192, 192],\n \"skyblue\": [135, 206, 235],\n \"slateblue\": [106, 90, 205],\n \"slategray\": [112, 128, 144],\n \"slategrey\": [112, 128, 144],\n \"snow\": [255, 250, 250],\n \"springgreen\": [0, 255, 127],\n \"steelblue\": [70, 130, 180],\n \"tan\": [210, 180, 140],\n \"teal\": [0, 128, 128],\n \"thistle\": [216, 191, 216],\n \"tomato\": [255, 99, 71],\n \"turquoise\": [64, 224, 208],\n \"violet\": [238, 130, 238],\n \"wheat\": [245, 222, 179],\n \"white\": [255, 255, 255],\n \"whitesmoke\": [245, 245, 245],\n \"yellow\": [255, 255, 0],\n \"yellowgreen\": [154, 205, 50]\n };\n /* MIT license */\n\n var colorString = {\n getRgba: getRgba,\n getHsla: getHsla,\n getRgb: getRgb,\n getHsl: getHsl,\n getHwb: getHwb,\n getAlpha: getAlpha,\n hexString: hexString,\n rgbString: rgbString,\n rgbaString: rgbaString,\n percentString: percentString,\n percentaString: percentaString,\n hslString: hslString,\n hslaString: hslaString,\n hwbString: hwbString,\n keyword: keyword\n };\n\n function getRgba(string) {\n if (!string) {\n return;\n }\n\n var abbr = /^#([a-fA-F0-9]{3,4})$/i,\n hex = /^#([a-fA-F0-9]{6}([a-fA-F0-9]{2})?)$/i,\n rgba = /^rgba?\\(\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)$/i,\n per = /^rgba?\\(\\s*([+-]?[\\d\\.]+)\\%\\s*,\\s*([+-]?[\\d\\.]+)\\%\\s*,\\s*([+-]?[\\d\\.]+)\\%\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)$/i,\n keyword = /(\\w+)/;\n var rgb = [0, 0, 0],\n a = 1,\n match = string.match(abbr),\n hexAlpha = \"\";\n\n if (match) {\n match = match[1];\n hexAlpha = match[3];\n\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = parseInt(match[i] + match[i], 16);\n }\n\n if (hexAlpha) {\n a = Math.round(parseInt(hexAlpha + hexAlpha, 16) / 255 * 100) / 100;\n }\n } else if (match = string.match(hex)) {\n hexAlpha = match[2];\n match = match[1];\n\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16);\n }\n\n if (hexAlpha) {\n a = Math.round(parseInt(hexAlpha, 16) / 255 * 100) / 100;\n }\n } else if (match = string.match(rgba)) {\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = parseInt(match[i + 1]);\n }\n\n a = parseFloat(match[4]);\n } else if (match = string.match(per)) {\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);\n }\n\n a = parseFloat(match[4]);\n } else if (match = string.match(keyword)) {\n if (match[1] == \"transparent\") {\n return [0, 0, 0, 0];\n }\n\n rgb = colorName$1[match[1]];\n\n if (!rgb) {\n return;\n }\n }\n\n for (var i = 0; i < rgb.length; i++) {\n rgb[i] = scale(rgb[i], 0, 255);\n }\n\n if (!a && a != 0) {\n a = 1;\n } else {\n a = scale(a, 0, 1);\n }\n\n rgb[3] = a;\n return rgb;\n }\n\n function getHsla(string) {\n if (!string) {\n return;\n }\n\n var hsl = /^hsla?\\(\\s*([+-]?\\d+)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)/;\n var match = string.match(hsl);\n\n if (match) {\n var alpha = parseFloat(match[4]);\n var h = scale(parseInt(match[1]), 0, 360),\n s = scale(parseFloat(match[2]), 0, 100),\n l = scale(parseFloat(match[3]), 0, 100),\n a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);\n return [h, s, l, a];\n }\n }\n\n function getHwb(string) {\n if (!string) {\n return;\n }\n\n var hwb = /^hwb\\(\\s*([+-]?\\d+)(?:deg)?\\s*,\\s*([+-]?[\\d\\.]+)%\\s*,\\s*([+-]?[\\d\\.]+)%\\s*(?:,\\s*([+-]?[\\d\\.]+)\\s*)?\\)/;\n var match = string.match(hwb);\n\n if (match) {\n var alpha = parseFloat(match[4]);\n var h = scale(parseInt(match[1]), 0, 360),\n w = scale(parseFloat(match[2]), 0, 100),\n b = scale(parseFloat(match[3]), 0, 100),\n a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);\n return [h, w, b, a];\n }\n }\n\n function getRgb(string) {\n var rgba = getRgba(string);\n return rgba && rgba.slice(0, 3);\n }\n\n function getHsl(string) {\n var hsla = getHsla(string);\n return hsla && hsla.slice(0, 3);\n }\n\n function getAlpha(string) {\n var vals = getRgba(string);\n\n if (vals) {\n return vals[3];\n } else if (vals = getHsla(string)) {\n return vals[3];\n } else if (vals = getHwb(string)) {\n return vals[3];\n }\n } // generators\n\n\n function hexString(rgba, a) {\n var a = a !== undefined && rgba.length === 3 ? a : rgba[3];\n return \"#\" + hexDouble(rgba[0]) + hexDouble(rgba[1]) + hexDouble(rgba[2]) + (a >= 0 && a < 1 ? hexDouble(Math.round(a * 255)) : \"\");\n }\n\n function rgbString(rgba, alpha) {\n if (alpha < 1 || rgba[3] && rgba[3] < 1) {\n return rgbaString(rgba, alpha);\n }\n\n return \"rgb(\" + rgba[0] + \", \" + rgba[1] + \", \" + rgba[2] + \")\";\n }\n\n function rgbaString(rgba, alpha) {\n if (alpha === undefined) {\n alpha = rgba[3] !== undefined ? rgba[3] : 1;\n }\n\n return \"rgba(\" + rgba[0] + \", \" + rgba[1] + \", \" + rgba[2] + \", \" + alpha + \")\";\n }\n\n function percentString(rgba, alpha) {\n if (alpha < 1 || rgba[3] && rgba[3] < 1) {\n return percentaString(rgba, alpha);\n }\n\n var r = Math.round(rgba[0] / 255 * 100),\n g = Math.round(rgba[1] / 255 * 100),\n b = Math.round(rgba[2] / 255 * 100);\n return \"rgb(\" + r + \"%, \" + g + \"%, \" + b + \"%)\";\n }\n\n function percentaString(rgba, alpha) {\n var r = Math.round(rgba[0] / 255 * 100),\n g = Math.round(rgba[1] / 255 * 100),\n b = Math.round(rgba[2] / 255 * 100);\n return \"rgba(\" + r + \"%, \" + g + \"%, \" + b + \"%, \" + (alpha || rgba[3] || 1) + \")\";\n }\n\n function hslString(hsla, alpha) {\n if (alpha < 1 || hsla[3] && hsla[3] < 1) {\n return hslaString(hsla, alpha);\n }\n\n return \"hsl(\" + hsla[0] + \", \" + hsla[1] + \"%, \" + hsla[2] + \"%)\";\n }\n\n function hslaString(hsla, alpha) {\n if (alpha === undefined) {\n alpha = hsla[3] !== undefined ? hsla[3] : 1;\n }\n\n return \"hsla(\" + hsla[0] + \", \" + hsla[1] + \"%, \" + hsla[2] + \"%, \" + alpha + \")\";\n } // hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax\n // (hwb have alpha optional & 1 is default value)\n\n\n function hwbString(hwb, alpha) {\n if (alpha === undefined) {\n alpha = hwb[3] !== undefined ? hwb[3] : 1;\n }\n\n return \"hwb(\" + hwb[0] + \", \" + hwb[1] + \"%, \" + hwb[2] + \"%\" + (alpha !== undefined && alpha !== 1 ? \", \" + alpha : \"\") + \")\";\n }\n\n function keyword(rgb) {\n return reverseNames[rgb.slice(0, 3)];\n } // helpers\n\n\n function scale(num, min, max) {\n return Math.min(Math.max(min, num), max);\n }\n\n function hexDouble(num) {\n var str = num.toString(16).toUpperCase();\n return str.length < 2 ? \"0\" + str : str;\n } //create a list of reverse color names\n\n\n var reverseNames = {};\n\n for (var name in colorName$1) {\n reverseNames[colorName$1[name]] = name;\n }\n /* MIT license */\n\n\n var Color = function Color(obj) {\n if (obj instanceof Color) {\n return obj;\n }\n\n if (!(this instanceof Color)) {\n return new Color(obj);\n }\n\n this.valid = false;\n this.values = {\n rgb: [0, 0, 0],\n hsl: [0, 0, 0],\n hsv: [0, 0, 0],\n hwb: [0, 0, 0],\n cmyk: [0, 0, 0, 0],\n alpha: 1\n }; // parse Color() argument\n\n var vals;\n\n if (typeof obj === 'string') {\n vals = colorString.getRgba(obj);\n\n if (vals) {\n this.setValues('rgb', vals);\n } else if (vals = colorString.getHsla(obj)) {\n this.setValues('hsl', vals);\n } else if (vals = colorString.getHwb(obj)) {\n this.setValues('hwb', vals);\n }\n } else if (_typeof(obj) === 'object') {\n vals = obj;\n\n if (vals.r !== undefined || vals.red !== undefined) {\n this.setValues('rgb', vals);\n } else if (vals.l !== undefined || vals.lightness !== undefined) {\n this.setValues('hsl', vals);\n } else if (vals.v !== undefined || vals.value !== undefined) {\n this.setValues('hsv', vals);\n } else if (vals.w !== undefined || vals.whiteness !== undefined) {\n this.setValues('hwb', vals);\n } else if (vals.c !== undefined || vals.cyan !== undefined) {\n this.setValues('cmyk', vals);\n }\n }\n };\n\n Color.prototype = {\n isValid: function isValid() {\n return this.valid;\n },\n rgb: function rgb() {\n return this.setSpace('rgb', arguments);\n },\n hsl: function hsl() {\n return this.setSpace('hsl', arguments);\n },\n hsv: function hsv() {\n return this.setSpace('hsv', arguments);\n },\n hwb: function hwb() {\n return this.setSpace('hwb', arguments);\n },\n cmyk: function cmyk() {\n return this.setSpace('cmyk', arguments);\n },\n rgbArray: function rgbArray() {\n return this.values.rgb;\n },\n hslArray: function hslArray() {\n return this.values.hsl;\n },\n hsvArray: function hsvArray() {\n return this.values.hsv;\n },\n hwbArray: function hwbArray() {\n var values = this.values;\n\n if (values.alpha !== 1) {\n return values.hwb.concat([values.alpha]);\n }\n\n return values.hwb;\n },\n cmykArray: function cmykArray() {\n return this.values.cmyk;\n },\n rgbaArray: function rgbaArray() {\n var values = this.values;\n return values.rgb.concat([values.alpha]);\n },\n hslaArray: function hslaArray() {\n var values = this.values;\n return values.hsl.concat([values.alpha]);\n },\n alpha: function alpha(val) {\n if (val === undefined) {\n return this.values.alpha;\n }\n\n this.setValues('alpha', val);\n return this;\n },\n red: function red(val) {\n return this.setChannel('rgb', 0, val);\n },\n green: function green(val) {\n return this.setChannel('rgb', 1, val);\n },\n blue: function blue(val) {\n return this.setChannel('rgb', 2, val);\n },\n hue: function hue(val) {\n if (val) {\n val %= 360;\n val = val < 0 ? 360 + val : val;\n }\n\n return this.setChannel('hsl', 0, val);\n },\n saturation: function saturation(val) {\n return this.setChannel('hsl', 1, val);\n },\n lightness: function lightness(val) {\n return this.setChannel('hsl', 2, val);\n },\n saturationv: function saturationv(val) {\n return this.setChannel('hsv', 1, val);\n },\n whiteness: function whiteness(val) {\n return this.setChannel('hwb', 1, val);\n },\n blackness: function blackness(val) {\n return this.setChannel('hwb', 2, val);\n },\n value: function value(val) {\n return this.setChannel('hsv', 2, val);\n },\n cyan: function cyan(val) {\n return this.setChannel('cmyk', 0, val);\n },\n magenta: function magenta(val) {\n return this.setChannel('cmyk', 1, val);\n },\n yellow: function yellow(val) {\n return this.setChannel('cmyk', 2, val);\n },\n black: function black(val) {\n return this.setChannel('cmyk', 3, val);\n },\n hexString: function hexString() {\n return colorString.hexString(this.values.rgb);\n },\n rgbString: function rgbString() {\n return colorString.rgbString(this.values.rgb, this.values.alpha);\n },\n rgbaString: function rgbaString() {\n return colorString.rgbaString(this.values.rgb, this.values.alpha);\n },\n percentString: function percentString() {\n return colorString.percentString(this.values.rgb, this.values.alpha);\n },\n hslString: function hslString() {\n return colorString.hslString(this.values.hsl, this.values.alpha);\n },\n hslaString: function hslaString() {\n return colorString.hslaString(this.values.hsl, this.values.alpha);\n },\n hwbString: function hwbString() {\n return colorString.hwbString(this.values.hwb, this.values.alpha);\n },\n keyword: function keyword() {\n return colorString.keyword(this.values.rgb, this.values.alpha);\n },\n rgbNumber: function rgbNumber() {\n var rgb = this.values.rgb;\n return rgb[0] << 16 | rgb[1] << 8 | rgb[2];\n },\n luminosity: function luminosity() {\n // http://www.w3.org/TR/WCAG20/#relativeluminancedef\n var rgb = this.values.rgb;\n var lum = [];\n\n for (var i = 0; i < rgb.length; i++) {\n var chan = rgb[i] / 255;\n lum[i] = chan <= 0.03928 ? chan / 12.92 : Math.pow((chan + 0.055) / 1.055, 2.4);\n }\n\n return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];\n },\n contrast: function contrast(color2) {\n // http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n var lum1 = this.luminosity();\n var lum2 = color2.luminosity();\n\n if (lum1 > lum2) {\n return (lum1 + 0.05) / (lum2 + 0.05);\n }\n\n return (lum2 + 0.05) / (lum1 + 0.05);\n },\n level: function level(color2) {\n var contrastRatio = this.contrast(color2);\n\n if (contrastRatio >= 7.1) {\n return 'AAA';\n }\n\n return contrastRatio >= 4.5 ? 'AA' : '';\n },\n dark: function dark() {\n // YIQ equation from http://24ways.org/2010/calculating-color-contrast\n var rgb = this.values.rgb;\n var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;\n return yiq < 128;\n },\n light: function light() {\n return !this.dark();\n },\n negate: function negate() {\n var rgb = [];\n\n for (var i = 0; i < 3; i++) {\n rgb[i] = 255 - this.values.rgb[i];\n }\n\n this.setValues('rgb', rgb);\n return this;\n },\n lighten: function lighten(ratio) {\n var hsl = this.values.hsl;\n hsl[2] += hsl[2] * ratio;\n this.setValues('hsl', hsl);\n return this;\n },\n darken: function darken(ratio) {\n var hsl = this.values.hsl;\n hsl[2] -= hsl[2] * ratio;\n this.setValues('hsl', hsl);\n return this;\n },\n saturate: function saturate(ratio) {\n var hsl = this.values.hsl;\n hsl[1] += hsl[1] * ratio;\n this.setValues('hsl', hsl);\n return this;\n },\n desaturate: function desaturate(ratio) {\n var hsl = this.values.hsl;\n hsl[1] -= hsl[1] * ratio;\n this.setValues('hsl', hsl);\n return this;\n },\n whiten: function whiten(ratio) {\n var hwb = this.values.hwb;\n hwb[1] += hwb[1] * ratio;\n this.setValues('hwb', hwb);\n return this;\n },\n blacken: function blacken(ratio) {\n var hwb = this.values.hwb;\n hwb[2] += hwb[2] * ratio;\n this.setValues('hwb', hwb);\n return this;\n },\n greyscale: function greyscale() {\n var rgb = this.values.rgb; // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale\n\n var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;\n this.setValues('rgb', [val, val, val]);\n return this;\n },\n clearer: function clearer(ratio) {\n var alpha = this.values.alpha;\n this.setValues('alpha', alpha - alpha * ratio);\n return this;\n },\n opaquer: function opaquer(ratio) {\n var alpha = this.values.alpha;\n this.setValues('alpha', alpha + alpha * ratio);\n return this;\n },\n rotate: function rotate(degrees) {\n var hsl = this.values.hsl;\n var hue = (hsl[0] + degrees) % 360;\n hsl[0] = hue < 0 ? 360 + hue : hue;\n this.setValues('hsl', hsl);\n return this;\n },\n\n /**\n * Ported from sass implementation in C\n * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209\n */\n mix: function mix(mixinColor, weight) {\n var color1 = this;\n var color2 = mixinColor;\n var p = weight === undefined ? 0.5 : weight;\n var w = 2 * p - 1;\n var a = color1.alpha() - color2.alpha();\n var w1 = ((w * a === -1 ? w : (w + a) / (1 + w * a)) + 1) / 2.0;\n var w2 = 1 - w1;\n return this.rgb(w1 * color1.red() + w2 * color2.red(), w1 * color1.green() + w2 * color2.green(), w1 * color1.blue() + w2 * color2.blue()).alpha(color1.alpha() * p + color2.alpha() * (1 - p));\n },\n toJSON: function toJSON() {\n return this.rgb();\n },\n clone: function clone() {\n // NOTE(SB): using node-clone creates a dependency to Buffer when using browserify,\n // making the final build way to big to embed in Chart.js. So let's do it manually,\n // assuming that values to clone are 1 dimension arrays containing only numbers,\n // except 'alpha' which is a number.\n var result = new Color();\n var source = this.values;\n var target = result.values;\n var value, type;\n\n for (var prop in source) {\n if (source.hasOwnProperty(prop)) {\n value = source[prop];\n type = {}.toString.call(value);\n\n if (type === '[object Array]') {\n target[prop] = value.slice(0);\n } else if (type === '[object Number]') {\n target[prop] = value;\n } else {\n console.error('unexpected color value:', value);\n }\n }\n }\n\n return result;\n }\n };\n Color.prototype.spaces = {\n rgb: ['red', 'green', 'blue'],\n hsl: ['hue', 'saturation', 'lightness'],\n hsv: ['hue', 'saturation', 'value'],\n hwb: ['hue', 'whiteness', 'blackness'],\n cmyk: ['cyan', 'magenta', 'yellow', 'black']\n };\n Color.prototype.maxes = {\n rgb: [255, 255, 255],\n hsl: [360, 100, 100],\n hsv: [360, 100, 100],\n hwb: [360, 100, 100],\n cmyk: [100, 100, 100, 100]\n };\n\n Color.prototype.getValues = function (space) {\n var values = this.values;\n var vals = {};\n\n for (var i = 0; i < space.length; i++) {\n vals[space.charAt(i)] = values[space][i];\n }\n\n if (values.alpha !== 1) {\n vals.a = values.alpha;\n } // {r: 255, g: 255, b: 255, a: 0.4}\n\n\n return vals;\n };\n\n Color.prototype.setValues = function (space, vals) {\n var values = this.values;\n var spaces = this.spaces;\n var maxes = this.maxes;\n var alpha = 1;\n var i;\n this.valid = true;\n\n if (space === 'alpha') {\n alpha = vals;\n } else if (vals.length) {\n // [10, 10, 10]\n values[space] = vals.slice(0, space.length);\n alpha = vals[space.length];\n } else if (vals[space.charAt(0)] !== undefined) {\n // {r: 10, g: 10, b: 10}\n for (i = 0; i < space.length; i++) {\n values[space][i] = vals[space.charAt(i)];\n }\n\n alpha = vals.a;\n } else if (vals[spaces[space][0]] !== undefined) {\n // {red: 10, green: 10, blue: 10}\n var chans = spaces[space];\n\n for (i = 0; i < space.length; i++) {\n values[space][i] = vals[chans[i]];\n }\n\n alpha = vals.alpha;\n }\n\n values.alpha = Math.max(0, Math.min(1, alpha === undefined ? values.alpha : alpha));\n\n if (space === 'alpha') {\n return false;\n }\n\n var capped; // cap values of the space prior converting all values\n\n for (i = 0; i < space.length; i++) {\n capped = Math.max(0, Math.min(maxes[space][i], values[space][i]));\n values[space][i] = Math.round(capped);\n } // convert to all the other color spaces\n\n\n for (var sname in spaces) {\n if (sname !== space) {\n values[sname] = colorConvert[space][sname](values[space]);\n }\n }\n\n return true;\n };\n\n Color.prototype.setSpace = function (space, args) {\n var vals = args[0];\n\n if (vals === undefined) {\n // color.rgb()\n return this.getValues(space);\n } // color.rgb(10, 10, 10)\n\n\n if (typeof vals === 'number') {\n vals = Array.prototype.slice.call(args);\n }\n\n this.setValues(space, vals);\n return this;\n };\n\n Color.prototype.setChannel = function (space, index, val) {\n var svalues = this.values[space];\n\n if (val === undefined) {\n // color.red()\n return svalues[index];\n } else if (val === svalues[index]) {\n // color.red(color.red())\n return this;\n } // color.red(100)\n\n\n svalues[index] = val;\n this.setValues(space, svalues);\n return this;\n };\n\n if (typeof window !== 'undefined') {\n window.Color = Color;\n }\n\n var chartjsColor = Color;\n\n function isValidKey(key) {\n return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;\n }\n /**\r\n * @namespace Chart.helpers\r\n */\n\n\n var helpers = {\n /**\r\n * An empty function that can be used, for example, for optional callback.\r\n */\n noop: function noop() {},\n\n /**\r\n * Returns a unique id, sequentially generated from a global variable.\r\n * @returns {number}\r\n * @function\r\n */\n uid: function () {\n var id = 0;\n return function () {\n return id++;\n };\n }(),\n\n /**\r\n * Returns true if `value` is neither null nor undefined, else returns false.\r\n * @param {*} value - The value to test.\r\n * @returns {boolean}\r\n * @since 2.7.0\r\n */\n isNullOrUndef: function isNullOrUndef(value) {\n return value === null || typeof value === 'undefined';\n },\n\n /**\r\n * Returns true if `value` is an array (including typed arrays), else returns false.\r\n * @param {*} value - The value to test.\r\n * @returns {boolean}\r\n * @function\r\n */\n isArray: function isArray(value) {\n if (Array.isArray && Array.isArray(value)) {\n return true;\n }\n\n var type = Object.prototype.toString.call(value);\n\n if (type.substr(0, 7) === '[object' && type.substr(-6) === 'Array]') {\n return true;\n }\n\n return false;\n },\n\n /**\r\n * Returns true if `value` is an object (excluding null), else returns false.\r\n * @param {*} value - The value to test.\r\n * @returns {boolean}\r\n * @since 2.7.0\r\n */\n isObject: function isObject(value) {\n return value !== null && Object.prototype.toString.call(value) === '[object Object]';\n },\n\n /**\r\n * Returns true if `value` is a finite number, else returns false\r\n * @param {*} value - The value to test.\r\n * @returns {boolean}\r\n */\n isFinite: function (_isFinite) {\n function isFinite(_x) {\n return _isFinite.apply(this, arguments);\n }\n\n isFinite.toString = function () {\n return _isFinite.toString();\n };\n\n return isFinite;\n }(function (value) {\n return (typeof value === 'number' || value instanceof Number) && isFinite(value);\n }),\n\n /**\r\n * Returns `value` if defined, else returns `defaultValue`.\r\n * @param {*} value - The value to return if defined.\r\n * @param {*} defaultValue - The value to return if `value` is undefined.\r\n * @returns {*}\r\n */\n valueOrDefault: function valueOrDefault(value, defaultValue) {\n return typeof value === 'undefined' ? defaultValue : value;\n },\n\n /**\r\n * Returns value at the given `index` in array if defined, else returns `defaultValue`.\r\n * @param {Array} value - The array to lookup for value at `index`.\r\n * @param {number} index - The index in `value` to lookup for value.\r\n * @param {*} defaultValue - The value to return if `value[index]` is undefined.\r\n * @returns {*}\r\n */\n valueAtIndexOrDefault: function valueAtIndexOrDefault(value, index, defaultValue) {\n return helpers.valueOrDefault(helpers.isArray(value) ? value[index] : value, defaultValue);\n },\n\n /**\r\n * Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the\r\n * value returned by `fn`. If `fn` is not a function, this method returns undefined.\r\n * @param {function} fn - The function to call.\r\n * @param {Array|undefined|null} args - The arguments with which `fn` should be called.\r\n * @param {object} [thisArg] - The value of `this` provided for the call to `fn`.\r\n * @returns {*}\r\n */\n callback: function callback(fn, args, thisArg) {\n if (fn && typeof fn.call === 'function') {\n return fn.apply(thisArg, args);\n }\n },\n\n /**\r\n * Note(SB) for performance sake, this method should only be used when loopable type\r\n * is unknown or in none intensive code (not called often and small loopable). Else\r\n * it's preferable to use a regular for() loop and save extra function calls.\r\n * @param {object|Array} loopable - The object or array to be iterated.\r\n * @param {function} fn - The function to call for each item.\r\n * @param {object} [thisArg] - The value of `this` provided for the call to `fn`.\r\n * @param {boolean} [reverse] - If true, iterates backward on the loopable.\r\n */\n each: function each(loopable, fn, thisArg, reverse) {\n var i, len, keys;\n\n if (helpers.isArray(loopable)) {\n len = loopable.length;\n\n if (reverse) {\n for (i = len - 1; i >= 0; i--) {\n fn.call(thisArg, loopable[i], i);\n }\n } else {\n for (i = 0; i < len; i++) {\n fn.call(thisArg, loopable[i], i);\n }\n }\n } else if (helpers.isObject(loopable)) {\n keys = Object.keys(loopable);\n len = keys.length;\n\n for (i = 0; i < len; i++) {\n fn.call(thisArg, loopable[keys[i]], keys[i]);\n }\n }\n },\n\n /**\r\n * Returns true if the `a0` and `a1` arrays have the same content, else returns false.\r\n * @see https://stackoverflow.com/a/14853974\r\n * @param {Array} a0 - The array to compare\r\n * @param {Array} a1 - The array to compare\r\n * @returns {boolean}\r\n */\n arrayEquals: function arrayEquals(a0, a1) {\n var i, ilen, v0, v1;\n\n if (!a0 || !a1 || a0.length !== a1.length) {\n return false;\n }\n\n for (i = 0, ilen = a0.length; i < ilen; ++i) {\n v0 = a0[i];\n v1 = a1[i];\n\n if (v0 instanceof Array && v1 instanceof Array) {\n if (!helpers.arrayEquals(v0, v1)) {\n return false;\n }\n } else if (v0 !== v1) {\n // NOTE: two different object instances will never be equal: {x:20} != {x:20}\n return false;\n }\n }\n\n return true;\n },\n\n /**\r\n * Returns a deep copy of `source` without keeping references on objects and arrays.\r\n * @param {*} source - The value to clone.\r\n * @returns {*}\r\n */\n clone: function clone(source) {\n if (helpers.isArray(source)) {\n return source.map(helpers.clone);\n }\n\n if (helpers.isObject(source)) {\n var target = Object.create(source);\n var keys = Object.keys(source);\n var klen = keys.length;\n var k = 0;\n\n for (; k < klen; ++k) {\n target[keys[k]] = helpers.clone(source[keys[k]]);\n }\n\n return target;\n }\n\n return source;\n },\n\n /**\r\n * The default merger when Chart.helpers.merge is called without merger option.\r\n * Note(SB): also used by mergeConfig and mergeScaleConfig as fallback.\r\n * @private\r\n */\n _merger: function _merger(key, target, source, options) {\n if (!isValidKey(key)) {\n // We want to ensure we do not copy prototypes over\n // as this can pollute global namespaces\n return;\n }\n\n var tval = target[key];\n var sval = source[key];\n\n if (helpers.isObject(tval) && helpers.isObject(sval)) {\n helpers.merge(tval, sval, options);\n } else {\n target[key] = helpers.clone(sval);\n }\n },\n\n /**\r\n * Merges source[key] in target[key] only if target[key] is undefined.\r\n * @private\r\n */\n _mergerIf: function _mergerIf(key, target, source) {\n if (!isValidKey(key)) {\n // We want to ensure we do not copy prototypes over\n // as this can pollute global namespaces\n return;\n }\n\n var tval = target[key];\n var sval = source[key];\n\n if (helpers.isObject(tval) && helpers.isObject(sval)) {\n helpers.mergeIf(tval, sval);\n } else if (!target.hasOwnProperty(key)) {\n target[key] = helpers.clone(sval);\n }\n },\n\n /**\r\n * Recursively deep copies `source` properties into `target` with the given `options`.\r\n * IMPORTANT: `target` is not cloned and will be updated with `source` properties.\r\n * @param {object} target - The target object in which all sources are merged into.\r\n * @param {object|object[]} source - Object(s) to merge into `target`.\r\n * @param {object} [options] - Merging options:\r\n * @param {function} [options.merger] - The merge method (key, target, source, options)\r\n * @returns {object} The `target` object.\r\n */\n merge: function merge(target, source, options) {\n var sources = helpers.isArray(source) ? source : [source];\n var ilen = sources.length;\n var merge, i, keys, klen, k;\n\n if (!helpers.isObject(target)) {\n return target;\n }\n\n options = options || {};\n merge = options.merger || helpers._merger;\n\n for (i = 0; i < ilen; ++i) {\n source = sources[i];\n\n if (!helpers.isObject(source)) {\n continue;\n }\n\n keys = Object.keys(source);\n\n for (k = 0, klen = keys.length; k < klen; ++k) {\n merge(keys[k], target, source, options);\n }\n }\n\n return target;\n },\n\n /**\r\n * Recursively deep copies `source` properties into `target` *only* if not defined in target.\r\n * IMPORTANT: `target` is not cloned and will be updated with `source` properties.\r\n * @param {object} target - The target object in which all sources are merged into.\r\n * @param {object|object[]} source - Object(s) to merge into `target`.\r\n * @returns {object} The `target` object.\r\n */\n mergeIf: function mergeIf(target, source) {\n return helpers.merge(target, source, {\n merger: helpers._mergerIf\n });\n },\n\n /**\r\n * Applies the contents of two or more objects together into the first object.\r\n * @param {object} target - The target object in which all objects are merged into.\r\n * @param {object} arg1 - Object containing additional properties to merge in target.\r\n * @param {object} argN - Additional objects containing properties to merge in target.\r\n * @returns {object} The `target` object.\r\n */\n extend: Object.assign || function (target) {\n return helpers.merge(target, [].slice.call(arguments, 1), {\n merger: function merger(key, dst, src) {\n dst[key] = src[key];\n }\n });\n },\n\n /**\r\n * Basic javascript inheritance based on the model created in Backbone.js\r\n */\n inherits: function inherits(extensions) {\n var me = this;\n var ChartElement = extensions && extensions.hasOwnProperty('constructor') ? extensions.constructor : function () {\n return me.apply(this, arguments);\n };\n\n var Surrogate = function Surrogate() {\n this.constructor = ChartElement;\n };\n\n Surrogate.prototype = me.prototype;\n ChartElement.prototype = new Surrogate();\n ChartElement.extend = helpers.inherits;\n\n if (extensions) {\n helpers.extend(ChartElement.prototype, extensions);\n }\n\n ChartElement.__super__ = me.prototype;\n return ChartElement;\n },\n _deprecated: function _deprecated(scope, value, previous, current) {\n if (value !== undefined) {\n console.warn(scope + ': \"' + previous + '\" is deprecated. Please use \"' + current + '\" instead');\n }\n }\n };\n var helpers_core = helpers; // DEPRECATIONS\n\n /**\r\n * Provided for backward compatibility, use Chart.helpers.callback instead.\r\n * @function Chart.helpers.callCallback\r\n * @deprecated since version 2.6.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n\n helpers.callCallback = helpers.callback;\n /**\r\n * Provided for backward compatibility, use Array.prototype.indexOf instead.\r\n * Array.prototype.indexOf compatibility: Chrome, Opera, Safari, FF1.5+, IE9+\r\n * @function Chart.helpers.indexOf\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n\n helpers.indexOf = function (array, item, fromIndex) {\n return Array.prototype.indexOf.call(array, item, fromIndex);\n };\n /**\r\n * Provided for backward compatibility, use Chart.helpers.valueOrDefault instead.\r\n * @function Chart.helpers.getValueOrDefault\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n\n\n helpers.getValueOrDefault = helpers.valueOrDefault;\n /**\r\n * Provided for backward compatibility, use Chart.helpers.valueAtIndexOrDefault instead.\r\n * @function Chart.helpers.getValueAtIndexOrDefault\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n\n helpers.getValueAtIndexOrDefault = helpers.valueAtIndexOrDefault;\n /**\r\n * Easing functions adapted from Robert Penner's easing equations.\r\n * @namespace Chart.helpers.easingEffects\r\n * @see http://www.robertpenner.com/easing/\r\n */\n\n var effects = {\n linear: function linear(t) {\n return t;\n },\n easeInQuad: function easeInQuad(t) {\n return t * t;\n },\n easeOutQuad: function easeOutQuad(t) {\n return -t * (t - 2);\n },\n easeInOutQuad: function easeInOutQuad(t) {\n if ((t /= 0.5) < 1) {\n return 0.5 * t * t;\n }\n\n return -0.5 * (--t * (t - 2) - 1);\n },\n easeInCubic: function easeInCubic(t) {\n return t * t * t;\n },\n easeOutCubic: function easeOutCubic(t) {\n return (t = t - 1) * t * t + 1;\n },\n easeInOutCubic: function easeInOutCubic(t) {\n if ((t /= 0.5) < 1) {\n return 0.5 * t * t * t;\n }\n\n return 0.5 * ((t -= 2) * t * t + 2);\n },\n easeInQuart: function easeInQuart(t) {\n return t * t * t * t;\n },\n easeOutQuart: function easeOutQuart(t) {\n return -((t = t - 1) * t * t * t - 1);\n },\n easeInOutQuart: function easeInOutQuart(t) {\n if ((t /= 0.5) < 1) {\n return 0.5 * t * t * t * t;\n }\n\n return -0.5 * ((t -= 2) * t * t * t - 2);\n },\n easeInQuint: function easeInQuint(t) {\n return t * t * t * t * t;\n },\n easeOutQuint: function easeOutQuint(t) {\n return (t = t - 1) * t * t * t * t + 1;\n },\n easeInOutQuint: function easeInOutQuint(t) {\n if ((t /= 0.5) < 1) {\n return 0.5 * t * t * t * t * t;\n }\n\n return 0.5 * ((t -= 2) * t * t * t * t + 2);\n },\n easeInSine: function easeInSine(t) {\n return -Math.cos(t * (Math.PI / 2)) + 1;\n },\n easeOutSine: function easeOutSine(t) {\n return Math.sin(t * (Math.PI / 2));\n },\n easeInOutSine: function easeInOutSine(t) {\n return -0.5 * (Math.cos(Math.PI * t) - 1);\n },\n easeInExpo: function easeInExpo(t) {\n return t === 0 ? 0 : Math.pow(2, 10 * (t - 1));\n },\n easeOutExpo: function easeOutExpo(t) {\n return t === 1 ? 1 : -Math.pow(2, -10 * t) + 1;\n },\n easeInOutExpo: function easeInOutExpo(t) {\n if (t === 0) {\n return 0;\n }\n\n if (t === 1) {\n return 1;\n }\n\n if ((t /= 0.5) < 1) {\n return 0.5 * Math.pow(2, 10 * (t - 1));\n }\n\n return 0.5 * (-Math.pow(2, -10 * --t) + 2);\n },\n easeInCirc: function easeInCirc(t) {\n if (t >= 1) {\n return t;\n }\n\n return -(Math.sqrt(1 - t * t) - 1);\n },\n easeOutCirc: function easeOutCirc(t) {\n return Math.sqrt(1 - (t = t - 1) * t);\n },\n easeInOutCirc: function easeInOutCirc(t) {\n if ((t /= 0.5) < 1) {\n return -0.5 * (Math.sqrt(1 - t * t) - 1);\n }\n\n return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);\n },\n easeInElastic: function easeInElastic(t) {\n var s = 1.70158;\n var p = 0;\n var a = 1;\n\n if (t === 0) {\n return 0;\n }\n\n if (t === 1) {\n return 1;\n }\n\n if (!p) {\n p = 0.3;\n }\n\n if (a < 1) {\n a = 1;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(1 / a);\n }\n\n return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));\n },\n easeOutElastic: function easeOutElastic(t) {\n var s = 1.70158;\n var p = 0;\n var a = 1;\n\n if (t === 0) {\n return 0;\n }\n\n if (t === 1) {\n return 1;\n }\n\n if (!p) {\n p = 0.3;\n }\n\n if (a < 1) {\n a = 1;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(1 / a);\n }\n\n return a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1;\n },\n easeInOutElastic: function easeInOutElastic(t) {\n var s = 1.70158;\n var p = 0;\n var a = 1;\n\n if (t === 0) {\n return 0;\n }\n\n if ((t /= 0.5) === 2) {\n return 1;\n }\n\n if (!p) {\n p = 0.45;\n }\n\n if (a < 1) {\n a = 1;\n s = p / 4;\n } else {\n s = p / (2 * Math.PI) * Math.asin(1 / a);\n }\n\n if (t < 1) {\n return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));\n }\n\n return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * 0.5 + 1;\n },\n easeInBack: function easeInBack(t) {\n var s = 1.70158;\n return t * t * ((s + 1) * t - s);\n },\n easeOutBack: function easeOutBack(t) {\n var s = 1.70158;\n return (t = t - 1) * t * ((s + 1) * t + s) + 1;\n },\n easeInOutBack: function easeInOutBack(t) {\n var s = 1.70158;\n\n if ((t /= 0.5) < 1) {\n return 0.5 * (t * t * (((s *= 1.525) + 1) * t - s));\n }\n\n return 0.5 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2);\n },\n easeInBounce: function easeInBounce(t) {\n return 1 - effects.easeOutBounce(1 - t);\n },\n easeOutBounce: function easeOutBounce(t) {\n if (t < 1 / 2.75) {\n return 7.5625 * t * t;\n }\n\n if (t < 2 / 2.75) {\n return 7.5625 * (t -= 1.5 / 2.75) * t + 0.75;\n }\n\n if (t < 2.5 / 2.75) {\n return 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375;\n }\n\n return 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375;\n },\n easeInOutBounce: function easeInOutBounce(t) {\n if (t < 0.5) {\n return effects.easeInBounce(t * 2) * 0.5;\n }\n\n return effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5;\n }\n };\n var helpers_easing = {\n effects: effects\n }; // DEPRECATIONS\n\n /**\r\n * Provided for backward compatibility, use Chart.helpers.easing.effects instead.\r\n * @function Chart.helpers.easingEffects\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n\n helpers_core.easingEffects = effects;\n var PI = Math.PI;\n var RAD_PER_DEG = PI / 180;\n var DOUBLE_PI = PI * 2;\n var HALF_PI = PI / 2;\n var QUARTER_PI = PI / 4;\n var TWO_THIRDS_PI = PI * 2 / 3;\n /**\r\n * @namespace Chart.helpers.canvas\r\n */\n\n var exports$1 = {\n /**\r\n * Clears the entire canvas associated to the given `chart`.\r\n * @param {Chart} chart - The chart for which to clear the canvas.\r\n */\n clear: function clear(chart) {\n chart.ctx.clearRect(0, 0, chart.width, chart.height);\n },\n\n /**\r\n * Creates a \"path\" for a rectangle with rounded corners at position (x, y) with a\r\n * given size (width, height) and the same `radius` for all corners.\r\n * @param {CanvasRenderingContext2D} ctx - The canvas 2D Context.\r\n * @param {number} x - The x axis of the coordinate for the rectangle starting point.\r\n * @param {number} y - The y axis of the coordinate for the rectangle starting point.\r\n * @param {number} width - The rectangle's width.\r\n * @param {number} height - The rectangle's height.\r\n * @param {number} radius - The rounded amount (in pixels) for the four corners.\r\n * @todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object?\r\n */\n roundedRect: function roundedRect(ctx, x, y, width, height, radius) {\n if (radius) {\n var r = Math.min(radius, height / 2, width / 2);\n var left = x + r;\n var top = y + r;\n var right = x + width - r;\n var bottom = y + height - r;\n ctx.moveTo(x, top);\n\n if (left < right && top < bottom) {\n ctx.arc(left, top, r, -PI, -HALF_PI);\n ctx.arc(right, top, r, -HALF_PI, 0);\n ctx.arc(right, bottom, r, 0, HALF_PI);\n ctx.arc(left, bottom, r, HALF_PI, PI);\n } else if (left < right) {\n ctx.moveTo(left, y);\n ctx.arc(right, top, r, -HALF_PI, HALF_PI);\n ctx.arc(left, top, r, HALF_PI, PI + HALF_PI);\n } else if (top < bottom) {\n ctx.arc(left, top, r, -PI, 0);\n ctx.arc(left, bottom, r, 0, PI);\n } else {\n ctx.arc(left, top, r, -PI, PI);\n }\n\n ctx.closePath();\n ctx.moveTo(x, y);\n } else {\n ctx.rect(x, y, width, height);\n }\n },\n drawPoint: function drawPoint(ctx, style, radius, x, y, rotation) {\n var type, xOffset, yOffset, size, cornerRadius;\n var rad = (rotation || 0) * RAD_PER_DEG;\n\n if (style && _typeof(style) === 'object') {\n type = style.toString();\n\n if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {\n ctx.save();\n ctx.translate(x, y);\n ctx.rotate(rad);\n ctx.drawImage(style, -style.width / 2, -style.height / 2, style.width, style.height);\n ctx.restore();\n return;\n }\n }\n\n if (isNaN(radius) || radius <= 0) {\n return;\n }\n\n ctx.beginPath();\n\n switch (style) {\n // Default includes circle\n default:\n ctx.arc(x, y, radius, 0, DOUBLE_PI);\n ctx.closePath();\n break;\n\n case 'triangle':\n ctx.moveTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);\n rad += TWO_THIRDS_PI;\n ctx.lineTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);\n rad += TWO_THIRDS_PI;\n ctx.lineTo(x + Math.sin(rad) * radius, y - Math.cos(rad) * radius);\n ctx.closePath();\n break;\n\n case 'rectRounded':\n // NOTE: the rounded rect implementation changed to use `arc` instead of\n // `quadraticCurveTo` since it generates better results when rect is\n // almost a circle. 0.516 (instead of 0.5) produces results with visually\n // closer proportion to the previous impl and it is inscribed in the\n // circle with `radius`. For more details, see the following PRs:\n // https://github.com/chartjs/Chart.js/issues/5597\n // https://github.com/chartjs/Chart.js/issues/5858\n cornerRadius = radius * 0.516;\n size = radius - cornerRadius;\n xOffset = Math.cos(rad + QUARTER_PI) * size;\n yOffset = Math.sin(rad + QUARTER_PI) * size;\n ctx.arc(x - xOffset, y - yOffset, cornerRadius, rad - PI, rad - HALF_PI);\n ctx.arc(x + yOffset, y - xOffset, cornerRadius, rad - HALF_PI, rad);\n ctx.arc(x + xOffset, y + yOffset, cornerRadius, rad, rad + HALF_PI);\n ctx.arc(x - yOffset, y + xOffset, cornerRadius, rad + HALF_PI, rad + PI);\n ctx.closePath();\n break;\n\n case 'rect':\n if (!rotation) {\n size = Math.SQRT1_2 * radius;\n ctx.rect(x - size, y - size, 2 * size, 2 * size);\n break;\n }\n\n rad += QUARTER_PI;\n\n /* falls through */\n\n case 'rectRot':\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n ctx.moveTo(x - xOffset, y - yOffset);\n ctx.lineTo(x + yOffset, y - xOffset);\n ctx.lineTo(x + xOffset, y + yOffset);\n ctx.lineTo(x - yOffset, y + xOffset);\n ctx.closePath();\n break;\n\n case 'crossRot':\n rad += QUARTER_PI;\n\n /* falls through */\n\n case 'cross':\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n ctx.moveTo(x - xOffset, y - yOffset);\n ctx.lineTo(x + xOffset, y + yOffset);\n ctx.moveTo(x + yOffset, y - xOffset);\n ctx.lineTo(x - yOffset, y + xOffset);\n break;\n\n case 'star':\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n ctx.moveTo(x - xOffset, y - yOffset);\n ctx.lineTo(x + xOffset, y + yOffset);\n ctx.moveTo(x + yOffset, y - xOffset);\n ctx.lineTo(x - yOffset, y + xOffset);\n rad += QUARTER_PI;\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n ctx.moveTo(x - xOffset, y - yOffset);\n ctx.lineTo(x + xOffset, y + yOffset);\n ctx.moveTo(x + yOffset, y - xOffset);\n ctx.lineTo(x - yOffset, y + xOffset);\n break;\n\n case 'line':\n xOffset = Math.cos(rad) * radius;\n yOffset = Math.sin(rad) * radius;\n ctx.moveTo(x - xOffset, y - yOffset);\n ctx.lineTo(x + xOffset, y + yOffset);\n break;\n\n case 'dash':\n ctx.moveTo(x, y);\n ctx.lineTo(x + Math.cos(rad) * radius, y + Math.sin(rad) * radius);\n break;\n }\n\n ctx.fill();\n ctx.stroke();\n },\n\n /**\r\n * Returns true if the point is inside the rectangle\r\n * @param {object} point - The point to test\r\n * @param {object} area - The rectangle\r\n * @returns {boolean}\r\n * @private\r\n */\n _isPointInArea: function _isPointInArea(point, area) {\n var epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.\n\n return point.x > area.left - epsilon && point.x < area.right + epsilon && point.y > area.top - epsilon && point.y < area.bottom + epsilon;\n },\n clipArea: function clipArea(ctx, area) {\n ctx.save();\n ctx.beginPath();\n ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);\n ctx.clip();\n },\n unclipArea: function unclipArea(ctx) {\n ctx.restore();\n },\n lineTo: function lineTo(ctx, previous, target, flip) {\n var stepped = target.steppedLine;\n\n if (stepped) {\n if (stepped === 'middle') {\n var midpoint = (previous.x + target.x) / 2.0;\n ctx.lineTo(midpoint, flip ? target.y : previous.y);\n ctx.lineTo(midpoint, flip ? previous.y : target.y);\n } else if (stepped === 'after' && !flip || stepped !== 'after' && flip) {\n ctx.lineTo(previous.x, target.y);\n } else {\n ctx.lineTo(target.x, previous.y);\n }\n\n ctx.lineTo(target.x, target.y);\n return;\n }\n\n if (!target.tension) {\n ctx.lineTo(target.x, target.y);\n return;\n }\n\n ctx.bezierCurveTo(flip ? previous.controlPointPreviousX : previous.controlPointNextX, flip ? previous.controlPointPreviousY : previous.controlPointNextY, flip ? target.controlPointNextX : target.controlPointPreviousX, flip ? target.controlPointNextY : target.controlPointPreviousY, target.x, target.y);\n }\n };\n var helpers_canvas = exports$1; // DEPRECATIONS\n\n /**\r\n * Provided for backward compatibility, use Chart.helpers.canvas.clear instead.\r\n * @namespace Chart.helpers.clear\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n\n helpers_core.clear = exports$1.clear;\n /**\r\n * Provided for backward compatibility, use Chart.helpers.canvas.roundedRect instead.\r\n * @namespace Chart.helpers.drawRoundedRectangle\r\n * @deprecated since version 2.7.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n\n helpers_core.drawRoundedRectangle = function (ctx) {\n ctx.beginPath();\n exports$1.roundedRect.apply(exports$1, arguments);\n };\n\n var defaults = {\n /**\r\n * @private\r\n */\n _set: function _set(scope, values) {\n return helpers_core.merge(this[scope] || (this[scope] = {}), values);\n }\n }; // TODO(v3): remove 'global' from namespace. all default are global and\n // there's inconsistency around which options are under 'global'\n\n defaults._set('global', {\n defaultColor: 'rgba(0,0,0,0.1)',\n defaultFontColor: '#666',\n defaultFontFamily: \"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif\",\n defaultFontSize: 12,\n defaultFontStyle: 'normal',\n defaultLineHeight: 1.2,\n showLines: true\n });\n\n var core_defaults = defaults;\n var valueOrDefault = helpers_core.valueOrDefault;\n /**\r\n * Converts the given font object into a CSS font string.\r\n * @param {object} font - A font object.\r\n * @return {string} The CSS font string. See https://developer.mozilla.org/en-US/docs/Web/CSS/font\r\n * @private\r\n */\n\n function toFontString(font) {\n if (!font || helpers_core.isNullOrUndef(font.size) || helpers_core.isNullOrUndef(font.family)) {\n return null;\n }\n\n return (font.style ? font.style + ' ' : '') + (font.weight ? font.weight + ' ' : '') + font.size + 'px ' + font.family;\n }\n /**\r\n * @alias Chart.helpers.options\r\n * @namespace\r\n */\n\n\n var helpers_options = {\n /**\r\n * Converts the given line height `value` in pixels for a specific font `size`.\r\n * @param {number|string} value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').\r\n * @param {number} size - The font size (in pixels) used to resolve relative `value`.\r\n * @returns {number} The effective line height in pixels (size * 1.2 if value is invalid).\r\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height\r\n * @since 2.7.0\r\n */\n toLineHeight: function toLineHeight(value, size) {\n var matches = ('' + value).match(/^(normal|(\\d+(?:\\.\\d+)?)(px|em|%)?)$/);\n\n if (!matches || matches[1] === 'normal') {\n return size * 1.2;\n }\n\n value = +matches[2];\n\n switch (matches[3]) {\n case 'px':\n return value;\n\n case '%':\n value /= 100;\n break;\n }\n\n return size * value;\n },\n\n /**\r\n * Converts the given value into a padding object with pre-computed width/height.\r\n * @param {number|object} value - If a number, set the value to all TRBL component,\r\n * else, if and object, use defined properties and sets undefined ones to 0.\r\n * @returns {object} The padding values (top, right, bottom, left, width, height)\r\n * @since 2.7.0\r\n */\n toPadding: function toPadding(value) {\n var t, r, b, l;\n\n if (helpers_core.isObject(value)) {\n t = +value.top || 0;\n r = +value.right || 0;\n b = +value.bottom || 0;\n l = +value.left || 0;\n } else {\n t = r = b = l = +value || 0;\n }\n\n return {\n top: t,\n right: r,\n bottom: b,\n left: l,\n height: t + b,\n width: l + r\n };\n },\n\n /**\r\n * Parses font options and returns the font object.\r\n * @param {object} options - A object that contains font options to be parsed.\r\n * @return {object} The font object.\r\n * @todo Support font.* options and renamed to toFont().\r\n * @private\r\n */\n _parseFont: function _parseFont(options) {\n var globalDefaults = core_defaults.global;\n var size = valueOrDefault(options.fontSize, globalDefaults.defaultFontSize);\n var font = {\n family: valueOrDefault(options.fontFamily, globalDefaults.defaultFontFamily),\n lineHeight: helpers_core.options.toLineHeight(valueOrDefault(options.lineHeight, globalDefaults.defaultLineHeight), size),\n size: size,\n style: valueOrDefault(options.fontStyle, globalDefaults.defaultFontStyle),\n weight: null,\n string: ''\n };\n font.string = toFontString(font);\n return font;\n },\n\n /**\r\n * Evaluates the given `inputs` sequentially and returns the first defined value.\r\n * @param {Array} inputs - An array of values, falling back to the last value.\r\n * @param {object} [context] - If defined and the current value is a function, the value\r\n * is called with `context` as first argument and the result becomes the new input.\r\n * @param {number} [index] - If defined and the current value is an array, the value\r\n * at `index` become the new input.\r\n * @param {object} [info] - object to return information about resolution in\r\n * @param {boolean} [info.cacheable] - Will be set to `false` if option is not cacheable.\r\n * @since 2.7.0\r\n */\n resolve: function resolve(inputs, context, index, info) {\n var cacheable = true;\n var i, ilen, value;\n\n for (i = 0, ilen = inputs.length; i < ilen; ++i) {\n value = inputs[i];\n\n if (value === undefined) {\n continue;\n }\n\n if (context !== undefined && typeof value === 'function') {\n value = value(context);\n cacheable = false;\n }\n\n if (index !== undefined && helpers_core.isArray(value)) {\n value = value[index];\n cacheable = false;\n }\n\n if (value !== undefined) {\n if (info && !cacheable) {\n info.cacheable = false;\n }\n\n return value;\n }\n }\n }\n };\n /**\r\n * @alias Chart.helpers.math\r\n * @namespace\r\n */\n\n var exports$2 = {\n /**\r\n * Returns an array of factors sorted from 1 to sqrt(value)\r\n * @private\r\n */\n _factorize: function _factorize(value) {\n var result = [];\n var sqrt = Math.sqrt(value);\n var i;\n\n for (i = 1; i < sqrt; i++) {\n if (value % i === 0) {\n result.push(i);\n result.push(value / i);\n }\n }\n\n if (sqrt === (sqrt | 0)) {\n // if value is a square number\n result.push(sqrt);\n }\n\n result.sort(function (a, b) {\n return a - b;\n }).pop();\n return result;\n },\n log10: Math.log10 || function (x) {\n var exponent = Math.log(x) * Math.LOG10E; // Math.LOG10E = 1 / Math.LN10.\n // Check for whole powers of 10,\n // which due to floating point rounding error should be corrected.\n\n var powerOf10 = Math.round(exponent);\n var isPowerOf10 = x === Math.pow(10, powerOf10);\n return isPowerOf10 ? powerOf10 : exponent;\n }\n };\n var helpers_math = exports$2; // DEPRECATIONS\n\n /**\r\n * Provided for backward compatibility, use Chart.helpers.math.log10 instead.\r\n * @namespace Chart.helpers.log10\r\n * @deprecated since version 2.9.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n\n helpers_core.log10 = exports$2.log10;\n\n var getRtlAdapter = function getRtlAdapter(rectX, width) {\n return {\n x: function x(_x2) {\n return rectX + rectX + width - _x2;\n },\n setWidth: function setWidth(w) {\n width = w;\n },\n textAlign: function textAlign(align) {\n if (align === 'center') {\n return align;\n }\n\n return align === 'right' ? 'left' : 'right';\n },\n xPlus: function xPlus(x, value) {\n return x - value;\n },\n leftForLtr: function leftForLtr(x, itemWidth) {\n return x - itemWidth;\n }\n };\n };\n\n var getLtrAdapter = function getLtrAdapter() {\n return {\n x: function x(_x3) {\n return _x3;\n },\n setWidth: function setWidth(w) {// eslint-disable-line no-unused-vars\n },\n textAlign: function textAlign(align) {\n return align;\n },\n xPlus: function xPlus(x, value) {\n return x + value;\n },\n leftForLtr: function leftForLtr(x, _itemWidth) {\n // eslint-disable-line no-unused-vars\n return x;\n }\n };\n };\n\n var getAdapter = function getAdapter(rtl, rectX, width) {\n return rtl ? getRtlAdapter(rectX, width) : getLtrAdapter();\n };\n\n var overrideTextDirection = function overrideTextDirection(ctx, direction) {\n var style, original;\n\n if (direction === 'ltr' || direction === 'rtl') {\n style = ctx.canvas.style;\n original = [style.getPropertyValue('direction'), style.getPropertyPriority('direction')];\n style.setProperty('direction', direction, 'important');\n ctx.prevTextDirection = original;\n }\n };\n\n var restoreTextDirection = function restoreTextDirection(ctx) {\n var original = ctx.prevTextDirection;\n\n if (original !== undefined) {\n delete ctx.prevTextDirection;\n ctx.canvas.style.setProperty('direction', original[0], original[1]);\n }\n };\n\n var helpers_rtl = {\n getRtlAdapter: getAdapter,\n overrideTextDirection: overrideTextDirection,\n restoreTextDirection: restoreTextDirection\n };\n var helpers$1 = helpers_core;\n var easing = helpers_easing;\n var canvas = helpers_canvas;\n var options = helpers_options;\n var math = helpers_math;\n var rtl = helpers_rtl;\n helpers$1.easing = easing;\n helpers$1.canvas = canvas;\n helpers$1.options = options;\n helpers$1.math = math;\n helpers$1.rtl = rtl;\n\n function interpolate(start, view, model, ease) {\n var keys = Object.keys(model);\n var i, ilen, key, actual, origin, target, type, c0, c1;\n\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n key = keys[i];\n target = model[key]; // if a value is added to the model after pivot() has been called, the view\n // doesn't contain it, so let's initialize the view to the target value.\n\n if (!view.hasOwnProperty(key)) {\n view[key] = target;\n }\n\n actual = view[key];\n\n if (actual === target || key[0] === '_') {\n continue;\n }\n\n if (!start.hasOwnProperty(key)) {\n start[key] = actual;\n }\n\n origin = start[key];\n type = _typeof(target);\n\n if (type === _typeof(origin)) {\n if (type === 'string') {\n c0 = chartjsColor(origin);\n\n if (c0.valid) {\n c1 = chartjsColor(target);\n\n if (c1.valid) {\n view[key] = c1.mix(c0, ease).rgbString();\n continue;\n }\n }\n } else if (helpers$1.isFinite(origin) && helpers$1.isFinite(target)) {\n view[key] = origin + (target - origin) * ease;\n continue;\n }\n }\n\n view[key] = target;\n }\n }\n\n var Element = function Element(configuration) {\n helpers$1.extend(this, configuration);\n this.initialize.apply(this, arguments);\n };\n\n helpers$1.extend(Element.prototype, {\n _type: undefined,\n initialize: function initialize() {\n this.hidden = false;\n },\n pivot: function pivot() {\n var me = this;\n\n if (!me._view) {\n me._view = helpers$1.extend({}, me._model);\n }\n\n me._start = {};\n return me;\n },\n transition: function transition(ease) {\n var me = this;\n var model = me._model;\n var start = me._start;\n var view = me._view; // No animation -> No Transition\n\n if (!model || ease === 1) {\n me._view = helpers$1.extend({}, model);\n me._start = null;\n return me;\n }\n\n if (!view) {\n view = me._view = {};\n }\n\n if (!start) {\n start = me._start = {};\n }\n\n interpolate(start, view, model, ease);\n return me;\n },\n tooltipPosition: function tooltipPosition() {\n return {\n x: this._model.x,\n y: this._model.y\n };\n },\n hasValue: function hasValue() {\n return helpers$1.isNumber(this._model.x) && helpers$1.isNumber(this._model.y);\n }\n });\n Element.extend = helpers$1.inherits;\n var core_element = Element;\n var exports$3 = core_element.extend({\n chart: null,\n // the animation associated chart instance\n currentStep: 0,\n // the current animation step\n numSteps: 60,\n // default number of steps\n easing: '',\n // the easing to use for this animation\n render: null,\n // render function used by the animation service\n onAnimationProgress: null,\n // user specified callback to fire on each step of the animation\n onAnimationComplete: null // user specified callback to fire when the animation finishes\n\n });\n var core_animation = exports$3; // DEPRECATIONS\n\n /**\r\n * Provided for backward compatibility, use Chart.Animation instead\r\n * @prop Chart.Animation#animationObject\r\n * @deprecated since version 2.6.0\r\n * @todo remove at version 3\r\n */\n\n Object.defineProperty(exports$3.prototype, 'animationObject', {\n get: function get() {\n return this;\n }\n });\n /**\r\n * Provided for backward compatibility, use Chart.Animation#chart instead\r\n * @prop Chart.Animation#chartInstance\r\n * @deprecated since version 2.6.0\r\n * @todo remove at version 3\r\n */\n\n Object.defineProperty(exports$3.prototype, 'chartInstance', {\n get: function get() {\n return this.chart;\n },\n set: function set(value) {\n this.chart = value;\n }\n });\n\n core_defaults._set('global', {\n animation: {\n duration: 1000,\n easing: 'easeOutQuart',\n onProgress: helpers$1.noop,\n onComplete: helpers$1.noop\n }\n });\n\n var core_animations = {\n animations: [],\n request: null,\n\n /**\r\n * @param {Chart} chart - The chart to animate.\r\n * @param {Chart.Animation} animation - The animation that we will animate.\r\n * @param {number} duration - The animation duration in ms.\r\n * @param {boolean} lazy - if true, the chart is not marked as animating to enable more responsive interactions\r\n */\n addAnimation: function addAnimation(chart, animation, duration, lazy) {\n var animations = this.animations;\n var i, ilen;\n animation.chart = chart;\n animation.startTime = Date.now();\n animation.duration = duration;\n\n if (!lazy) {\n chart.animating = true;\n }\n\n for (i = 0, ilen = animations.length; i < ilen; ++i) {\n if (animations[i].chart === chart) {\n animations[i] = animation;\n return;\n }\n }\n\n animations.push(animation); // If there are no animations queued, manually kickstart a digest, for lack of a better word\n\n if (animations.length === 1) {\n this.requestAnimationFrame();\n }\n },\n cancelAnimation: function cancelAnimation(chart) {\n var index = helpers$1.findIndex(this.animations, function (animation) {\n return animation.chart === chart;\n });\n\n if (index !== -1) {\n this.animations.splice(index, 1);\n chart.animating = false;\n }\n },\n requestAnimationFrame: function requestAnimationFrame() {\n var me = this;\n\n if (me.request === null) {\n // Skip animation frame requests until the active one is executed.\n // This can happen when processing mouse events, e.g. 'mousemove'\n // and 'mouseout' events will trigger multiple renders.\n me.request = helpers$1.requestAnimFrame.call(window, function () {\n me.request = null;\n me.startDigest();\n });\n }\n },\n\n /**\r\n * @private\r\n */\n startDigest: function startDigest() {\n var me = this;\n me.advance(); // Do we have more stuff to animate?\n\n if (me.animations.length > 0) {\n me.requestAnimationFrame();\n }\n },\n\n /**\r\n * @private\r\n */\n advance: function advance() {\n var animations = this.animations;\n var animation, chart, numSteps, nextStep;\n var i = 0; // 1 animation per chart, so we are looping charts here\n\n while (i < animations.length) {\n animation = animations[i];\n chart = animation.chart;\n numSteps = animation.numSteps; // Make sure that currentStep starts at 1\n // https://github.com/chartjs/Chart.js/issues/6104\n\n nextStep = Math.floor((Date.now() - animation.startTime) / animation.duration * numSteps) + 1;\n animation.currentStep = Math.min(nextStep, numSteps);\n helpers$1.callback(animation.render, [chart, animation], chart);\n helpers$1.callback(animation.onAnimationProgress, [animation], chart);\n\n if (animation.currentStep >= numSteps) {\n helpers$1.callback(animation.onAnimationComplete, [animation], chart);\n chart.animating = false;\n animations.splice(i, 1);\n } else {\n ++i;\n }\n }\n }\n };\n var resolve = helpers$1.options.resolve;\n var arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'];\n /**\r\n * Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',\r\n * 'unshift') and notify the listener AFTER the array has been altered. Listeners are\r\n * called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments.\r\n */\n\n function listenArrayEvents(array, listener) {\n if (array._chartjs) {\n array._chartjs.listeners.push(listener);\n\n return;\n }\n\n Object.defineProperty(array, '_chartjs', {\n configurable: true,\n enumerable: false,\n value: {\n listeners: [listener]\n }\n });\n arrayEvents.forEach(function (key) {\n var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);\n var base = array[key];\n Object.defineProperty(array, key, {\n configurable: true,\n enumerable: false,\n value: function value() {\n var args = Array.prototype.slice.call(arguments);\n var res = base.apply(this, args);\n helpers$1.each(array._chartjs.listeners, function (object) {\n if (typeof object[method] === 'function') {\n object[method].apply(object, args);\n }\n });\n return res;\n }\n });\n });\n }\n /**\r\n * Removes the given array event listener and cleanup extra attached properties (such as\r\n * the _chartjs stub and overridden methods) if array doesn't have any more listeners.\r\n */\n\n\n function unlistenArrayEvents(array, listener) {\n var stub = array._chartjs;\n\n if (!stub) {\n return;\n }\n\n var listeners = stub.listeners;\n var index = listeners.indexOf(listener);\n\n if (index !== -1) {\n listeners.splice(index, 1);\n }\n\n if (listeners.length > 0) {\n return;\n }\n\n arrayEvents.forEach(function (key) {\n delete array[key];\n });\n delete array._chartjs;\n } // Base class for all dataset controllers (line, bar, etc)\n\n\n var DatasetController = function DatasetController(chart, datasetIndex) {\n this.initialize(chart, datasetIndex);\n };\n\n helpers$1.extend(DatasetController.prototype, {\n /**\r\n * Element type used to generate a meta dataset (e.g. Chart.element.Line).\r\n * @type {Chart.core.element}\r\n */\n datasetElementType: null,\n\n /**\r\n * Element type used to generate a meta data (e.g. Chart.element.Point).\r\n * @type {Chart.core.element}\r\n */\n dataElementType: null,\n\n /**\r\n * Dataset element option keys to be resolved in _resolveDatasetElementOptions.\r\n * A derived controller may override this to resolve controller-specific options.\r\n * The keys defined here are for backward compatibility for legend styles.\r\n * @private\r\n */\n _datasetElementOptions: ['backgroundColor', 'borderCapStyle', 'borderColor', 'borderDash', 'borderDashOffset', 'borderJoinStyle', 'borderWidth'],\n\n /**\r\n * Data element option keys to be resolved in _resolveDataElementOptions.\r\n * A derived controller may override this to resolve controller-specific options.\r\n * The keys defined here are for backward compatibility for legend styles.\r\n * @private\r\n */\n _dataElementOptions: ['backgroundColor', 'borderColor', 'borderWidth', 'pointStyle'],\n initialize: function initialize(chart, datasetIndex) {\n var me = this;\n me.chart = chart;\n me.index = datasetIndex;\n me.linkScales();\n me.addElements();\n me._type = me.getMeta().type;\n },\n updateIndex: function updateIndex(datasetIndex) {\n this.index = datasetIndex;\n },\n linkScales: function linkScales() {\n var me = this;\n var meta = me.getMeta();\n var chart = me.chart;\n var scales = chart.scales;\n var dataset = me.getDataset();\n var scalesOpts = chart.options.scales;\n\n if (meta.xAxisID === null || !(meta.xAxisID in scales) || dataset.xAxisID) {\n meta.xAxisID = dataset.xAxisID || scalesOpts.xAxes[0].id;\n }\n\n if (meta.yAxisID === null || !(meta.yAxisID in scales) || dataset.yAxisID) {\n meta.yAxisID = dataset.yAxisID || scalesOpts.yAxes[0].id;\n }\n },\n getDataset: function getDataset() {\n return this.chart.data.datasets[this.index];\n },\n getMeta: function getMeta() {\n return this.chart.getDatasetMeta(this.index);\n },\n getScaleForId: function getScaleForId(scaleID) {\n return this.chart.scales[scaleID];\n },\n\n /**\r\n * @private\r\n */\n _getValueScaleId: function _getValueScaleId() {\n return this.getMeta().yAxisID;\n },\n\n /**\r\n * @private\r\n */\n _getIndexScaleId: function _getIndexScaleId() {\n return this.getMeta().xAxisID;\n },\n\n /**\r\n * @private\r\n */\n _getValueScale: function _getValueScale() {\n return this.getScaleForId(this._getValueScaleId());\n },\n\n /**\r\n * @private\r\n */\n _getIndexScale: function _getIndexScale() {\n return this.getScaleForId(this._getIndexScaleId());\n },\n reset: function reset() {\n this._update(true);\n },\n\n /**\r\n * @private\r\n */\n destroy: function destroy() {\n if (this._data) {\n unlistenArrayEvents(this._data, this);\n }\n },\n createMetaDataset: function createMetaDataset() {\n var me = this;\n var type = me.datasetElementType;\n return type && new type({\n _chart: me.chart,\n _datasetIndex: me.index\n });\n },\n createMetaData: function createMetaData(index) {\n var me = this;\n var type = me.dataElementType;\n return type && new type({\n _chart: me.chart,\n _datasetIndex: me.index,\n _index: index\n });\n },\n addElements: function addElements() {\n var me = this;\n var meta = me.getMeta();\n var data = me.getDataset().data || [];\n var metaData = meta.data;\n var i, ilen;\n\n for (i = 0, ilen = data.length; i < ilen; ++i) {\n metaData[i] = metaData[i] || me.createMetaData(i);\n }\n\n meta.dataset = meta.dataset || me.createMetaDataset();\n },\n addElementAndReset: function addElementAndReset(index) {\n var element = this.createMetaData(index);\n this.getMeta().data.splice(index, 0, element);\n this.updateElement(element, index, true);\n },\n buildOrUpdateElements: function buildOrUpdateElements() {\n var me = this;\n var dataset = me.getDataset();\n var data = dataset.data || (dataset.data = []); // In order to correctly handle data addition/deletion animation (an thus simulate\n // real-time charts), we need to monitor these data modifications and synchronize\n // the internal meta data accordingly.\n\n if (me._data !== data) {\n if (me._data) {\n // This case happens when the user replaced the data array instance.\n unlistenArrayEvents(me._data, me);\n }\n\n if (data && Object.isExtensible(data)) {\n listenArrayEvents(data, me);\n }\n\n me._data = data;\n } // Re-sync meta data in case the user replaced the data array or if we missed\n // any updates and so make sure that we handle number of datapoints changing.\n\n\n me.resyncElements();\n },\n\n /**\r\n * Returns the merged user-supplied and default dataset-level options\r\n * @private\r\n */\n _configure: function _configure() {\n var me = this;\n me._config = helpers$1.merge(Object.create(null), [me.chart.options.datasets[me._type], me.getDataset()], {\n merger: function merger(key, target, source) {\n if (key !== '_meta' && key !== 'data') {\n helpers$1._merger(key, target, source);\n }\n }\n });\n },\n _update: function _update(reset) {\n var me = this;\n\n me._configure();\n\n me._cachedDataOpts = null;\n me.update(reset);\n },\n update: helpers$1.noop,\n transition: function transition(easingValue) {\n var meta = this.getMeta();\n var elements = meta.data || [];\n var ilen = elements.length;\n var i = 0;\n\n for (; i < ilen; ++i) {\n elements[i].transition(easingValue);\n }\n\n if (meta.dataset) {\n meta.dataset.transition(easingValue);\n }\n },\n draw: function draw() {\n var meta = this.getMeta();\n var elements = meta.data || [];\n var ilen = elements.length;\n var i = 0;\n\n if (meta.dataset) {\n meta.dataset.draw();\n }\n\n for (; i < ilen; ++i) {\n elements[i].draw();\n }\n },\n\n /**\r\n * Returns a set of predefined style properties that should be used to represent the dataset\r\n * or the data if the index is specified\r\n * @param {number} index - data index\r\n * @return {IStyleInterface} style object\r\n */\n getStyle: function getStyle(index) {\n var me = this;\n var meta = me.getMeta();\n var dataset = meta.dataset;\n var style;\n\n me._configure();\n\n if (dataset && index === undefined) {\n style = me._resolveDatasetElementOptions(dataset || {});\n } else {\n index = index || 0;\n style = me._resolveDataElementOptions(meta.data[index] || {}, index);\n }\n\n if (style.fill === false || style.fill === null) {\n style.backgroundColor = style.borderColor;\n }\n\n return style;\n },\n\n /**\r\n * @private\r\n */\n _resolveDatasetElementOptions: function _resolveDatasetElementOptions(element, hover) {\n var me = this;\n var chart = me.chart;\n var datasetOpts = me._config;\n var custom = element.custom || {};\n var options = chart.options.elements[me.datasetElementType.prototype._type] || {};\n var elementOptions = me._datasetElementOptions;\n var values = {};\n var i, ilen, key, readKey; // Scriptable options\n\n var context = {\n chart: chart,\n dataset: me.getDataset(),\n datasetIndex: me.index,\n hover: hover\n };\n\n for (i = 0, ilen = elementOptions.length; i < ilen; ++i) {\n key = elementOptions[i];\n readKey = hover ? 'hover' + key.charAt(0).toUpperCase() + key.slice(1) : key;\n values[key] = resolve([custom[readKey], datasetOpts[readKey], options[readKey]], context);\n }\n\n return values;\n },\n\n /**\r\n * @private\r\n */\n _resolveDataElementOptions: function _resolveDataElementOptions(element, index) {\n var me = this;\n var custom = element && element.custom;\n var cached = me._cachedDataOpts;\n\n if (cached && !custom) {\n return cached;\n }\n\n var chart = me.chart;\n var datasetOpts = me._config;\n var options = chart.options.elements[me.dataElementType.prototype._type] || {};\n var elementOptions = me._dataElementOptions;\n var values = {}; // Scriptable options\n\n var context = {\n chart: chart,\n dataIndex: index,\n dataset: me.getDataset(),\n datasetIndex: me.index\n }; // `resolve` sets cacheable to `false` if any option is indexed or scripted\n\n var info = {\n cacheable: !custom\n };\n var keys, i, ilen, key;\n custom = custom || {};\n\n if (helpers$1.isArray(elementOptions)) {\n for (i = 0, ilen = elementOptions.length; i < ilen; ++i) {\n key = elementOptions[i];\n values[key] = resolve([custom[key], datasetOpts[key], options[key]], context, index, info);\n }\n } else {\n keys = Object.keys(elementOptions);\n\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n key = keys[i];\n values[key] = resolve([custom[key], datasetOpts[elementOptions[key]], datasetOpts[key], options[key]], context, index, info);\n }\n }\n\n if (info.cacheable) {\n me._cachedDataOpts = Object.freeze(values);\n }\n\n return values;\n },\n removeHoverStyle: function removeHoverStyle(element) {\n helpers$1.merge(element._model, element.$previousStyle || {});\n delete element.$previousStyle;\n },\n setHoverStyle: function setHoverStyle(element) {\n var dataset = this.chart.data.datasets[element._datasetIndex];\n var index = element._index;\n var custom = element.custom || {};\n var model = element._model;\n var getHoverColor = helpers$1.getHoverColor;\n element.$previousStyle = {\n backgroundColor: model.backgroundColor,\n borderColor: model.borderColor,\n borderWidth: model.borderWidth\n };\n model.backgroundColor = resolve([custom.hoverBackgroundColor, dataset.hoverBackgroundColor, getHoverColor(model.backgroundColor)], undefined, index);\n model.borderColor = resolve([custom.hoverBorderColor, dataset.hoverBorderColor, getHoverColor(model.borderColor)], undefined, index);\n model.borderWidth = resolve([custom.hoverBorderWidth, dataset.hoverBorderWidth, model.borderWidth], undefined, index);\n },\n\n /**\r\n * @private\r\n */\n _removeDatasetHoverStyle: function _removeDatasetHoverStyle() {\n var element = this.getMeta().dataset;\n\n if (element) {\n this.removeHoverStyle(element);\n }\n },\n\n /**\r\n * @private\r\n */\n _setDatasetHoverStyle: function _setDatasetHoverStyle() {\n var element = this.getMeta().dataset;\n var prev = {};\n var i, ilen, key, keys, hoverOptions, model;\n\n if (!element) {\n return;\n }\n\n model = element._model;\n hoverOptions = this._resolveDatasetElementOptions(element, true);\n keys = Object.keys(hoverOptions);\n\n for (i = 0, ilen = keys.length; i < ilen; ++i) {\n key = keys[i];\n prev[key] = model[key];\n model[key] = hoverOptions[key];\n }\n\n element.$previousStyle = prev;\n },\n\n /**\r\n * @private\r\n */\n resyncElements: function resyncElements() {\n var me = this;\n var meta = me.getMeta();\n var data = me.getDataset().data;\n var numMeta = meta.data.length;\n var numData = data.length;\n\n if (numData < numMeta) {\n meta.data.splice(numData, numMeta - numData);\n } else if (numData > numMeta) {\n me.insertElements(numMeta, numData - numMeta);\n }\n },\n\n /**\r\n * @private\r\n */\n insertElements: function insertElements(start, count) {\n for (var i = 0; i < count; ++i) {\n this.addElementAndReset(start + i);\n }\n },\n\n /**\r\n * @private\r\n */\n onDataPush: function onDataPush() {\n var count = arguments.length;\n this.insertElements(this.getDataset().data.length - count, count);\n },\n\n /**\r\n * @private\r\n */\n onDataPop: function onDataPop() {\n this.getMeta().data.pop();\n },\n\n /**\r\n * @private\r\n */\n onDataShift: function onDataShift() {\n this.getMeta().data.shift();\n },\n\n /**\r\n * @private\r\n */\n onDataSplice: function onDataSplice(start, count) {\n this.getMeta().data.splice(start, count);\n this.insertElements(start, arguments.length - 2);\n },\n\n /**\r\n * @private\r\n */\n onDataUnshift: function onDataUnshift() {\n this.insertElements(0, arguments.length);\n }\n });\n DatasetController.extend = helpers$1.inherits;\n var core_datasetController = DatasetController;\n var TAU = Math.PI * 2;\n\n core_defaults._set('global', {\n elements: {\n arc: {\n backgroundColor: core_defaults.global.defaultColor,\n borderColor: '#fff',\n borderWidth: 2,\n borderAlign: 'center'\n }\n }\n });\n\n function clipArc(ctx, arc) {\n var startAngle = arc.startAngle;\n var endAngle = arc.endAngle;\n var pixelMargin = arc.pixelMargin;\n var angleMargin = pixelMargin / arc.outerRadius;\n var x = arc.x;\n var y = arc.y; // Draw an inner border by cliping the arc and drawing a double-width border\n // Enlarge the clipping arc by 0.33 pixels to eliminate glitches between borders\n\n ctx.beginPath();\n ctx.arc(x, y, arc.outerRadius, startAngle - angleMargin, endAngle + angleMargin);\n\n if (arc.innerRadius > pixelMargin) {\n angleMargin = pixelMargin / arc.innerRadius;\n ctx.arc(x, y, arc.innerRadius - pixelMargin, endAngle + angleMargin, startAngle - angleMargin, true);\n } else {\n ctx.arc(x, y, pixelMargin, endAngle + Math.PI / 2, startAngle - Math.PI / 2);\n }\n\n ctx.closePath();\n ctx.clip();\n }\n\n function drawFullCircleBorders(ctx, vm, arc, inner) {\n var endAngle = arc.endAngle;\n var i;\n\n if (inner) {\n arc.endAngle = arc.startAngle + TAU;\n clipArc(ctx, arc);\n arc.endAngle = endAngle;\n\n if (arc.endAngle === arc.startAngle && arc.fullCircles) {\n arc.endAngle += TAU;\n arc.fullCircles--;\n }\n }\n\n ctx.beginPath();\n ctx.arc(arc.x, arc.y, arc.innerRadius, arc.startAngle + TAU, arc.startAngle, true);\n\n for (i = 0; i < arc.fullCircles; ++i) {\n ctx.stroke();\n }\n\n ctx.beginPath();\n ctx.arc(arc.x, arc.y, vm.outerRadius, arc.startAngle, arc.startAngle + TAU);\n\n for (i = 0; i < arc.fullCircles; ++i) {\n ctx.stroke();\n }\n }\n\n function drawBorder(ctx, vm, arc) {\n var inner = vm.borderAlign === 'inner';\n\n if (inner) {\n ctx.lineWidth = vm.borderWidth * 2;\n ctx.lineJoin = 'round';\n } else {\n ctx.lineWidth = vm.borderWidth;\n ctx.lineJoin = 'bevel';\n }\n\n if (arc.fullCircles) {\n drawFullCircleBorders(ctx, vm, arc, inner);\n }\n\n if (inner) {\n clipArc(ctx, arc);\n }\n\n ctx.beginPath();\n ctx.arc(arc.x, arc.y, vm.outerRadius, arc.startAngle, arc.endAngle);\n ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);\n ctx.closePath();\n ctx.stroke();\n }\n\n var element_arc = core_element.extend({\n _type: 'arc',\n inLabelRange: function inLabelRange(mouseX) {\n var vm = this._view;\n\n if (vm) {\n return Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2);\n }\n\n return false;\n },\n inRange: function inRange(chartX, chartY) {\n var vm = this._view;\n\n if (vm) {\n var pointRelativePosition = helpers$1.getAngleFromPoint(vm, {\n x: chartX,\n y: chartY\n });\n var angle = pointRelativePosition.angle;\n var distance = pointRelativePosition.distance; // Sanitise angle range\n\n var startAngle = vm.startAngle;\n var endAngle = vm.endAngle;\n\n while (endAngle < startAngle) {\n endAngle += TAU;\n }\n\n while (angle > endAngle) {\n angle -= TAU;\n }\n\n while (angle < startAngle) {\n angle += TAU;\n } // Check if within the range of the open/close angle\n\n\n var betweenAngles = angle >= startAngle && angle <= endAngle;\n var withinRadius = distance >= vm.innerRadius && distance <= vm.outerRadius;\n return betweenAngles && withinRadius;\n }\n\n return false;\n },\n getCenterPoint: function getCenterPoint() {\n var vm = this._view;\n var halfAngle = (vm.startAngle + vm.endAngle) / 2;\n var halfRadius = (vm.innerRadius + vm.outerRadius) / 2;\n return {\n x: vm.x + Math.cos(halfAngle) * halfRadius,\n y: vm.y + Math.sin(halfAngle) * halfRadius\n };\n },\n getArea: function getArea() {\n var vm = this._view;\n return Math.PI * ((vm.endAngle - vm.startAngle) / (2 * Math.PI)) * (Math.pow(vm.outerRadius, 2) - Math.pow(vm.innerRadius, 2));\n },\n tooltipPosition: function tooltipPosition() {\n var vm = this._view;\n var centreAngle = vm.startAngle + (vm.endAngle - vm.startAngle) / 2;\n var rangeFromCentre = (vm.outerRadius - vm.innerRadius) / 2 + vm.innerRadius;\n return {\n x: vm.x + Math.cos(centreAngle) * rangeFromCentre,\n y: vm.y + Math.sin(centreAngle) * rangeFromCentre\n };\n },\n draw: function draw() {\n var ctx = this._chart.ctx;\n var vm = this._view;\n var pixelMargin = vm.borderAlign === 'inner' ? 0.33 : 0;\n var arc = {\n x: vm.x,\n y: vm.y,\n innerRadius: vm.innerRadius,\n outerRadius: Math.max(vm.outerRadius - pixelMargin, 0),\n pixelMargin: pixelMargin,\n startAngle: vm.startAngle,\n endAngle: vm.endAngle,\n fullCircles: Math.floor(vm.circumference / TAU)\n };\n var i;\n ctx.save();\n ctx.fillStyle = vm.backgroundColor;\n ctx.strokeStyle = vm.borderColor;\n\n if (arc.fullCircles) {\n arc.endAngle = arc.startAngle + TAU;\n ctx.beginPath();\n ctx.arc(arc.x, arc.y, arc.outerRadius, arc.startAngle, arc.endAngle);\n ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);\n ctx.closePath();\n\n for (i = 0; i < arc.fullCircles; ++i) {\n ctx.fill();\n }\n\n arc.endAngle = arc.startAngle + vm.circumference % TAU;\n }\n\n ctx.beginPath();\n ctx.arc(arc.x, arc.y, arc.outerRadius, arc.startAngle, arc.endAngle);\n ctx.arc(arc.x, arc.y, arc.innerRadius, arc.endAngle, arc.startAngle, true);\n ctx.closePath();\n ctx.fill();\n\n if (vm.borderWidth) {\n drawBorder(ctx, vm, arc);\n }\n\n ctx.restore();\n }\n });\n var valueOrDefault$1 = helpers$1.valueOrDefault;\n var defaultColor = core_defaults.global.defaultColor;\n\n core_defaults._set('global', {\n elements: {\n line: {\n tension: 0.4,\n backgroundColor: defaultColor,\n borderWidth: 3,\n borderColor: defaultColor,\n borderCapStyle: 'butt',\n borderDash: [],\n borderDashOffset: 0.0,\n borderJoinStyle: 'miter',\n capBezierPoints: true,\n fill: true // do we fill in the area between the line and its base axis\n\n }\n }\n });\n\n var element_line = core_element.extend({\n _type: 'line',\n draw: function draw() {\n var me = this;\n var vm = me._view;\n var ctx = me._chart.ctx;\n var spanGaps = vm.spanGaps;\n\n var points = me._children.slice(); // clone array\n\n\n var globalDefaults = core_defaults.global;\n var globalOptionLineElements = globalDefaults.elements.line;\n var lastDrawnIndex = -1;\n var closePath = me._loop;\n var index, previous, currentVM;\n\n if (!points.length) {\n return;\n }\n\n if (me._loop) {\n for (index = 0; index < points.length; ++index) {\n previous = helpers$1.previousItem(points, index); // If the line has an open path, shift the point array\n\n if (!points[index]._view.skip && previous._view.skip) {\n points = points.slice(index).concat(points.slice(0, index));\n closePath = spanGaps;\n break;\n }\n } // If the line has a close path, add the first point again\n\n\n if (closePath) {\n points.push(points[0]);\n }\n }\n\n ctx.save(); // Stroke Line Options\n\n ctx.lineCap = vm.borderCapStyle || globalOptionLineElements.borderCapStyle; // IE 9 and 10 do not support line dash\n\n if (ctx.setLineDash) {\n ctx.setLineDash(vm.borderDash || globalOptionLineElements.borderDash);\n }\n\n ctx.lineDashOffset = valueOrDefault$1(vm.borderDashOffset, globalOptionLineElements.borderDashOffset);\n ctx.lineJoin = vm.borderJoinStyle || globalOptionLineElements.borderJoinStyle;\n ctx.lineWidth = valueOrDefault$1(vm.borderWidth, globalOptionLineElements.borderWidth);\n ctx.strokeStyle = vm.borderColor || globalDefaults.defaultColor; // Stroke Line\n\n ctx.beginPath(); // First point moves to it's starting position no matter what\n\n currentVM = points[0]._view;\n\n if (!currentVM.skip) {\n ctx.moveTo(currentVM.x, currentVM.y);\n lastDrawnIndex = 0;\n }\n\n for (index = 1; index < points.length; ++index) {\n currentVM = points[index]._view;\n previous = lastDrawnIndex === -1 ? helpers$1.previousItem(points, index) : points[lastDrawnIndex];\n\n if (!currentVM.skip) {\n if (lastDrawnIndex !== index - 1 && !spanGaps || lastDrawnIndex === -1) {\n // There was a gap and this is the first point after the gap\n ctx.moveTo(currentVM.x, currentVM.y);\n } else {\n // Line to next point\n helpers$1.canvas.lineTo(ctx, previous._view, currentVM);\n }\n\n lastDrawnIndex = index;\n }\n }\n\n if (closePath) {\n ctx.closePath();\n }\n\n ctx.stroke();\n ctx.restore();\n }\n });\n var valueOrDefault$2 = helpers$1.valueOrDefault;\n var defaultColor$1 = core_defaults.global.defaultColor;\n\n core_defaults._set('global', {\n elements: {\n point: {\n radius: 3,\n pointStyle: 'circle',\n backgroundColor: defaultColor$1,\n borderColor: defaultColor$1,\n borderWidth: 1,\n // Hover\n hitRadius: 1,\n hoverRadius: 4,\n hoverBorderWidth: 1\n }\n }\n });\n\n function xRange(mouseX) {\n var vm = this._view;\n return vm ? Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius : false;\n }\n\n function yRange(mouseY) {\n var vm = this._view;\n return vm ? Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius : false;\n }\n\n var element_point = core_element.extend({\n _type: 'point',\n inRange: function inRange(mouseX, mouseY) {\n var vm = this._view;\n return vm ? Math.pow(mouseX - vm.x, 2) + Math.pow(mouseY - vm.y, 2) < Math.pow(vm.hitRadius + vm.radius, 2) : false;\n },\n inLabelRange: xRange,\n inXRange: xRange,\n inYRange: yRange,\n getCenterPoint: function getCenterPoint() {\n var vm = this._view;\n return {\n x: vm.x,\n y: vm.y\n };\n },\n getArea: function getArea() {\n return Math.PI * Math.pow(this._view.radius, 2);\n },\n tooltipPosition: function tooltipPosition() {\n var vm = this._view;\n return {\n x: vm.x,\n y: vm.y,\n padding: vm.radius + vm.borderWidth\n };\n },\n draw: function draw(chartArea) {\n var vm = this._view;\n var ctx = this._chart.ctx;\n var pointStyle = vm.pointStyle;\n var rotation = vm.rotation;\n var radius = vm.radius;\n var x = vm.x;\n var y = vm.y;\n var globalDefaults = core_defaults.global;\n var defaultColor = globalDefaults.defaultColor; // eslint-disable-line no-shadow\n\n if (vm.skip) {\n return;\n } // Clipping for Points.\n\n\n if (chartArea === undefined || helpers$1.canvas._isPointInArea(vm, chartArea)) {\n ctx.strokeStyle = vm.borderColor || defaultColor;\n ctx.lineWidth = valueOrDefault$2(vm.borderWidth, globalDefaults.elements.point.borderWidth);\n ctx.fillStyle = vm.backgroundColor || defaultColor;\n helpers$1.canvas.drawPoint(ctx, pointStyle, radius, x, y, rotation);\n }\n }\n });\n var defaultColor$2 = core_defaults.global.defaultColor;\n\n core_defaults._set('global', {\n elements: {\n rectangle: {\n backgroundColor: defaultColor$2,\n borderColor: defaultColor$2,\n borderSkipped: 'bottom',\n borderWidth: 0\n }\n }\n });\n\n function isVertical(vm) {\n return vm && vm.width !== undefined;\n }\n /**\r\n * Helper function to get the bounds of the bar regardless of the orientation\r\n * @param bar {Chart.Element.Rectangle} the bar\r\n * @return {Bounds} bounds of the bar\r\n * @private\r\n */\n\n\n function getBarBounds(vm) {\n var x1, x2, y1, y2, half;\n\n if (isVertical(vm)) {\n half = vm.width / 2;\n x1 = vm.x - half;\n x2 = vm.x + half;\n y1 = Math.min(vm.y, vm.base);\n y2 = Math.max(vm.y, vm.base);\n } else {\n half = vm.height / 2;\n x1 = Math.min(vm.x, vm.base);\n x2 = Math.max(vm.x, vm.base);\n y1 = vm.y - half;\n y2 = vm.y + half;\n }\n\n return {\n left: x1,\n top: y1,\n right: x2,\n bottom: y2\n };\n }\n\n function swap(orig, v1, v2) {\n return orig === v1 ? v2 : orig === v2 ? v1 : orig;\n }\n\n function parseBorderSkipped(vm) {\n var edge = vm.borderSkipped;\n var res = {};\n\n if (!edge) {\n return res;\n }\n\n if (vm.horizontal) {\n if (vm.base > vm.x) {\n edge = swap(edge, 'left', 'right');\n }\n } else if (vm.base < vm.y) {\n edge = swap(edge, 'bottom', 'top');\n }\n\n res[edge] = true;\n return res;\n }\n\n function parseBorderWidth(vm, maxW, maxH) {\n var value = vm.borderWidth;\n var skip = parseBorderSkipped(vm);\n var t, r, b, l;\n\n if (helpers$1.isObject(value)) {\n t = +value.top || 0;\n r = +value.right || 0;\n b = +value.bottom || 0;\n l = +value.left || 0;\n } else {\n t = r = b = l = +value || 0;\n }\n\n return {\n t: skip.top || t < 0 ? 0 : t > maxH ? maxH : t,\n r: skip.right || r < 0 ? 0 : r > maxW ? maxW : r,\n b: skip.bottom || b < 0 ? 0 : b > maxH ? maxH : b,\n l: skip.left || l < 0 ? 0 : l > maxW ? maxW : l\n };\n }\n\n function boundingRects(vm) {\n var bounds = getBarBounds(vm);\n var width = bounds.right - bounds.left;\n var height = bounds.bottom - bounds.top;\n var border = parseBorderWidth(vm, width / 2, height / 2);\n return {\n outer: {\n x: bounds.left,\n y: bounds.top,\n w: width,\n h: height\n },\n inner: {\n x: bounds.left + border.l,\n y: bounds.top + border.t,\n w: width - border.l - border.r,\n h: height - border.t - border.b\n }\n };\n }\n\n function _inRange(vm, x, y) {\n var skipX = x === null;\n var skipY = y === null;\n var bounds = !vm || skipX && skipY ? false : getBarBounds(vm);\n return bounds && (skipX || x >= bounds.left && x <= bounds.right) && (skipY || y >= bounds.top && y <= bounds.bottom);\n }\n\n var element_rectangle = core_element.extend({\n _type: 'rectangle',\n draw: function draw() {\n var ctx = this._chart.ctx;\n var vm = this._view;\n var rects = boundingRects(vm);\n var outer = rects.outer;\n var inner = rects.inner;\n ctx.fillStyle = vm.backgroundColor;\n ctx.fillRect(outer.x, outer.y, outer.w, outer.h);\n\n if (outer.w === inner.w && outer.h === inner.h) {\n return;\n }\n\n ctx.save();\n ctx.beginPath();\n ctx.rect(outer.x, outer.y, outer.w, outer.h);\n ctx.clip();\n ctx.fillStyle = vm.borderColor;\n ctx.rect(inner.x, inner.y, inner.w, inner.h);\n ctx.fill('evenodd');\n ctx.restore();\n },\n height: function height() {\n var vm = this._view;\n return vm.base - vm.y;\n },\n inRange: function inRange(mouseX, mouseY) {\n return _inRange(this._view, mouseX, mouseY);\n },\n inLabelRange: function inLabelRange(mouseX, mouseY) {\n var vm = this._view;\n return isVertical(vm) ? _inRange(vm, mouseX, null) : _inRange(vm, null, mouseY);\n },\n inXRange: function inXRange(mouseX) {\n return _inRange(this._view, mouseX, null);\n },\n inYRange: function inYRange(mouseY) {\n return _inRange(this._view, null, mouseY);\n },\n getCenterPoint: function getCenterPoint() {\n var vm = this._view;\n var x, y;\n\n if (isVertical(vm)) {\n x = vm.x;\n y = (vm.y + vm.base) / 2;\n } else {\n x = (vm.x + vm.base) / 2;\n y = vm.y;\n }\n\n return {\n x: x,\n y: y\n };\n },\n getArea: function getArea() {\n var vm = this._view;\n return isVertical(vm) ? vm.width * Math.abs(vm.y - vm.base) : vm.height * Math.abs(vm.x - vm.base);\n },\n tooltipPosition: function tooltipPosition() {\n var vm = this._view;\n return {\n x: vm.x,\n y: vm.y\n };\n }\n });\n var elements = {};\n var Arc = element_arc;\n var Line = element_line;\n var Point = element_point;\n var Rectangle = element_rectangle;\n elements.Arc = Arc;\n elements.Line = Line;\n elements.Point = Point;\n elements.Rectangle = Rectangle;\n var deprecated = helpers$1._deprecated;\n var valueOrDefault$3 = helpers$1.valueOrDefault;\n\n core_defaults._set('bar', {\n hover: {\n mode: 'label'\n },\n scales: {\n xAxes: [{\n type: 'category',\n offset: true,\n gridLines: {\n offsetGridLines: true\n }\n }],\n yAxes: [{\n type: 'linear'\n }]\n }\n });\n\n core_defaults._set('global', {\n datasets: {\n bar: {\n categoryPercentage: 0.8,\n barPercentage: 0.9\n }\n }\n });\n /**\r\n * Computes the \"optimal\" sample size to maintain bars equally sized while preventing overlap.\r\n * @private\r\n */\n\n\n function computeMinSampleSize(scale, pixels) {\n var min = scale._length;\n var prev, curr, i, ilen;\n\n for (i = 1, ilen = pixels.length; i < ilen; ++i) {\n min = Math.min(min, Math.abs(pixels[i] - pixels[i - 1]));\n }\n\n for (i = 0, ilen = scale.getTicks().length; i < ilen; ++i) {\n curr = scale.getPixelForTick(i);\n min = i > 0 ? Math.min(min, Math.abs(curr - prev)) : min;\n prev = curr;\n }\n\n return min;\n }\n /**\r\n * Computes an \"ideal\" category based on the absolute bar thickness or, if undefined or null,\r\n * uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This\r\n * mode currently always generates bars equally sized (until we introduce scriptable options?).\r\n * @private\r\n */\n\n\n function computeFitCategoryTraits(index, ruler, options) {\n var thickness = options.barThickness;\n var count = ruler.stackCount;\n var curr = ruler.pixels[index];\n var min = helpers$1.isNullOrUndef(thickness) ? computeMinSampleSize(ruler.scale, ruler.pixels) : -1;\n var size, ratio;\n\n if (helpers$1.isNullOrUndef(thickness)) {\n size = min * options.categoryPercentage;\n ratio = options.barPercentage;\n } else {\n // When bar thickness is enforced, category and bar percentages are ignored.\n // Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')\n // and deprecate barPercentage since this value is ignored when thickness is absolute.\n size = thickness * count;\n ratio = 1;\n }\n\n return {\n chunk: size / count,\n ratio: ratio,\n start: curr - size / 2\n };\n }\n /**\r\n * Computes an \"optimal\" category that globally arranges bars side by side (no gap when\r\n * percentage options are 1), based on the previous and following categories. This mode\r\n * generates bars with different widths when data are not evenly spaced.\r\n * @private\r\n */\n\n\n function computeFlexCategoryTraits(index, ruler, options) {\n var pixels = ruler.pixels;\n var curr = pixels[index];\n var prev = index > 0 ? pixels[index - 1] : null;\n var next = index < pixels.length - 1 ? pixels[index + 1] : null;\n var percent = options.categoryPercentage;\n var start, size;\n\n if (prev === null) {\n // first data: its size is double based on the next point or,\n // if it's also the last data, we use the scale size.\n prev = curr - (next === null ? ruler.end - ruler.start : next - curr);\n }\n\n if (next === null) {\n // last data: its size is also double based on the previous point.\n next = curr + curr - prev;\n }\n\n start = curr - (curr - Math.min(prev, next)) / 2 * percent;\n size = Math.abs(next - prev) / 2 * percent;\n return {\n chunk: size / ruler.stackCount,\n ratio: options.barPercentage,\n start: start\n };\n }\n\n var controller_bar = core_datasetController.extend({\n dataElementType: elements.Rectangle,\n\n /**\r\n * @private\r\n */\n _dataElementOptions: ['backgroundColor', 'borderColor', 'borderSkipped', 'borderWidth', 'barPercentage', 'barThickness', 'categoryPercentage', 'maxBarThickness', 'minBarLength'],\n initialize: function initialize() {\n var me = this;\n var meta, scaleOpts;\n core_datasetController.prototype.initialize.apply(me, arguments);\n meta = me.getMeta();\n meta.stack = me.getDataset().stack;\n meta.bar = true;\n scaleOpts = me._getIndexScale().options;\n deprecated('bar chart', scaleOpts.barPercentage, 'scales.[x/y]Axes.barPercentage', 'dataset.barPercentage');\n deprecated('bar chart', scaleOpts.barThickness, 'scales.[x/y]Axes.barThickness', 'dataset.barThickness');\n deprecated('bar chart', scaleOpts.categoryPercentage, 'scales.[x/y]Axes.categoryPercentage', 'dataset.categoryPercentage');\n deprecated('bar chart', me._getValueScale().options.minBarLength, 'scales.[x/y]Axes.minBarLength', 'dataset.minBarLength');\n deprecated('bar chart', scaleOpts.maxBarThickness, 'scales.[x/y]Axes.maxBarThickness', 'dataset.maxBarThickness');\n },\n update: function update(reset) {\n var me = this;\n var rects = me.getMeta().data;\n var i, ilen;\n me._ruler = me.getRuler();\n\n for (i = 0, ilen = rects.length; i < ilen; ++i) {\n me.updateElement(rects[i], i, reset);\n }\n },\n updateElement: function updateElement(rectangle, index, reset) {\n var me = this;\n var meta = me.getMeta();\n var dataset = me.getDataset();\n\n var options = me._resolveDataElementOptions(rectangle, index);\n\n rectangle._xScale = me.getScaleForId(meta.xAxisID);\n rectangle._yScale = me.getScaleForId(meta.yAxisID);\n rectangle._datasetIndex = me.index;\n rectangle._index = index;\n rectangle._model = {\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderSkipped: options.borderSkipped,\n borderWidth: options.borderWidth,\n datasetLabel: dataset.label,\n label: me.chart.data.labels[index]\n };\n\n if (helpers$1.isArray(dataset.data[index])) {\n rectangle._model.borderSkipped = null;\n }\n\n me._updateElementGeometry(rectangle, index, reset, options);\n\n rectangle.pivot();\n },\n\n /**\r\n * @private\r\n */\n _updateElementGeometry: function _updateElementGeometry(rectangle, index, reset, options) {\n var me = this;\n var model = rectangle._model;\n\n var vscale = me._getValueScale();\n\n var base = vscale.getBasePixel();\n var horizontal = vscale.isHorizontal();\n var ruler = me._ruler || me.getRuler();\n var vpixels = me.calculateBarValuePixels(me.index, index, options);\n var ipixels = me.calculateBarIndexPixels(me.index, index, ruler, options);\n model.horizontal = horizontal;\n model.base = reset ? base : vpixels.base;\n model.x = horizontal ? reset ? base : vpixels.head : ipixels.center;\n model.y = horizontal ? ipixels.center : reset ? base : vpixels.head;\n model.height = horizontal ? ipixels.size : undefined;\n model.width = horizontal ? undefined : ipixels.size;\n },\n\n /**\r\n * Returns the stacks based on groups and bar visibility.\r\n * @param {number} [last] - The dataset index\r\n * @returns {string[]} The list of stack IDs\r\n * @private\r\n */\n _getStacks: function _getStacks(last) {\n var me = this;\n\n var scale = me._getIndexScale();\n\n var metasets = scale._getMatchingVisibleMetas(me._type);\n\n var stacked = scale.options.stacked;\n var ilen = metasets.length;\n var stacks = [];\n var i, meta;\n\n for (i = 0; i < ilen; ++i) {\n meta = metasets[i]; // stacked | meta.stack\n // | found | not found | undefined\n // false | x | x | x\n // true | | x |\n // undefined | | x | x\n\n if (stacked === false || stacks.indexOf(meta.stack) === -1 || stacked === undefined && meta.stack === undefined) {\n stacks.push(meta.stack);\n }\n\n if (meta.index === last) {\n break;\n }\n }\n\n return stacks;\n },\n\n /**\r\n * Returns the effective number of stacks based on groups and bar visibility.\r\n * @private\r\n */\n getStackCount: function getStackCount() {\n return this._getStacks().length;\n },\n\n /**\r\n * Returns the stack index for the given dataset based on groups and bar visibility.\r\n * @param {number} [datasetIndex] - The dataset index\r\n * @param {string} [name] - The stack name to find\r\n * @returns {number} The stack index\r\n * @private\r\n */\n getStackIndex: function getStackIndex(datasetIndex, name) {\n var stacks = this._getStacks(datasetIndex);\n\n var index = name !== undefined ? stacks.indexOf(name) : -1; // indexOf returns -1 if element is not present\n\n return index === -1 ? stacks.length - 1 : index;\n },\n\n /**\r\n * @private\r\n */\n getRuler: function getRuler() {\n var me = this;\n\n var scale = me._getIndexScale();\n\n var pixels = [];\n var i, ilen;\n\n for (i = 0, ilen = me.getMeta().data.length; i < ilen; ++i) {\n pixels.push(scale.getPixelForValue(null, i, me.index));\n }\n\n return {\n pixels: pixels,\n start: scale._startPixel,\n end: scale._endPixel,\n stackCount: me.getStackCount(),\n scale: scale\n };\n },\n\n /**\r\n * Note: pixel values are not clamped to the scale area.\r\n * @private\r\n */\n calculateBarValuePixels: function calculateBarValuePixels(datasetIndex, index, options) {\n var me = this;\n var chart = me.chart;\n\n var scale = me._getValueScale();\n\n var isHorizontal = scale.isHorizontal();\n var datasets = chart.data.datasets;\n\n var metasets = scale._getMatchingVisibleMetas(me._type);\n\n var value = scale._parseValue(datasets[datasetIndex].data[index]);\n\n var minBarLength = options.minBarLength;\n var stacked = scale.options.stacked;\n var stack = me.getMeta().stack;\n var start = value.start === undefined ? 0 : value.max >= 0 && value.min >= 0 ? value.min : value.max;\n var length = value.start === undefined ? value.end : value.max >= 0 && value.min >= 0 ? value.max - value.min : value.min - value.max;\n var ilen = metasets.length;\n var i, imeta, ivalue, base, head, size, stackLength;\n\n if (stacked || stacked === undefined && stack !== undefined) {\n for (i = 0; i < ilen; ++i) {\n imeta = metasets[i];\n\n if (imeta.index === datasetIndex) {\n break;\n }\n\n if (imeta.stack === stack) {\n stackLength = scale._parseValue(datasets[imeta.index].data[index]);\n ivalue = stackLength.start === undefined ? stackLength.end : stackLength.min >= 0 && stackLength.max >= 0 ? stackLength.max : stackLength.min;\n\n if (value.min < 0 && ivalue < 0 || value.max >= 0 && ivalue > 0) {\n start += ivalue;\n }\n }\n }\n }\n\n base = scale.getPixelForValue(start);\n head = scale.getPixelForValue(start + length);\n size = head - base;\n\n if (minBarLength !== undefined && Math.abs(size) < minBarLength) {\n size = minBarLength;\n\n if (length >= 0 && !isHorizontal || length < 0 && isHorizontal) {\n head = base - minBarLength;\n } else {\n head = base + minBarLength;\n }\n }\n\n return {\n size: size,\n base: base,\n head: head,\n center: head + size / 2\n };\n },\n\n /**\r\n * @private\r\n */\n calculateBarIndexPixels: function calculateBarIndexPixels(datasetIndex, index, ruler, options) {\n var me = this;\n var range = options.barThickness === 'flex' ? computeFlexCategoryTraits(index, ruler, options) : computeFitCategoryTraits(index, ruler, options);\n var stackIndex = me.getStackIndex(datasetIndex, me.getMeta().stack);\n var center = range.start + range.chunk * stackIndex + range.chunk / 2;\n var size = Math.min(valueOrDefault$3(options.maxBarThickness, Infinity), range.chunk * range.ratio);\n return {\n base: center - size / 2,\n head: center + size / 2,\n center: center,\n size: size\n };\n },\n draw: function draw() {\n var me = this;\n var chart = me.chart;\n\n var scale = me._getValueScale();\n\n var rects = me.getMeta().data;\n var dataset = me.getDataset();\n var ilen = rects.length;\n var i = 0;\n helpers$1.canvas.clipArea(chart.ctx, chart.chartArea);\n\n for (; i < ilen; ++i) {\n var val = scale._parseValue(dataset.data[i]);\n\n if (!isNaN(val.min) && !isNaN(val.max)) {\n rects[i].draw();\n }\n }\n\n helpers$1.canvas.unclipArea(chart.ctx);\n },\n\n /**\r\n * @private\r\n */\n _resolveDataElementOptions: function _resolveDataElementOptions() {\n var me = this;\n var values = helpers$1.extend({}, core_datasetController.prototype._resolveDataElementOptions.apply(me, arguments));\n\n var indexOpts = me._getIndexScale().options;\n\n var valueOpts = me._getValueScale().options;\n\n values.barPercentage = valueOrDefault$3(indexOpts.barPercentage, values.barPercentage);\n values.barThickness = valueOrDefault$3(indexOpts.barThickness, values.barThickness);\n values.categoryPercentage = valueOrDefault$3(indexOpts.categoryPercentage, values.categoryPercentage);\n values.maxBarThickness = valueOrDefault$3(indexOpts.maxBarThickness, values.maxBarThickness);\n values.minBarLength = valueOrDefault$3(valueOpts.minBarLength, values.minBarLength);\n return values;\n }\n });\n var valueOrDefault$4 = helpers$1.valueOrDefault;\n var resolve$1 = helpers$1.options.resolve;\n\n core_defaults._set('bubble', {\n hover: {\n mode: 'single'\n },\n scales: {\n xAxes: [{\n type: 'linear',\n // bubble should probably use a linear scale by default\n position: 'bottom',\n id: 'x-axis-0' // need an ID so datasets can reference the scale\n\n }],\n yAxes: [{\n type: 'linear',\n position: 'left',\n id: 'y-axis-0'\n }]\n },\n tooltips: {\n callbacks: {\n title: function title() {\n // Title doesn't make sense for scatter since we format the data as a point\n return '';\n },\n label: function label(item, data) {\n var datasetLabel = data.datasets[item.datasetIndex].label || '';\n var dataPoint = data.datasets[item.datasetIndex].data[item.index];\n return datasetLabel + ': (' + item.xLabel + ', ' + item.yLabel + ', ' + dataPoint.r + ')';\n }\n }\n }\n });\n\n var controller_bubble = core_datasetController.extend({\n /**\r\n * @protected\r\n */\n dataElementType: elements.Point,\n\n /**\r\n * @private\r\n */\n _dataElementOptions: ['backgroundColor', 'borderColor', 'borderWidth', 'hoverBackgroundColor', 'hoverBorderColor', 'hoverBorderWidth', 'hoverRadius', 'hitRadius', 'pointStyle', 'rotation'],\n\n /**\r\n * @protected\r\n */\n update: function update(reset) {\n var me = this;\n var meta = me.getMeta();\n var points = meta.data; // Update Points\n\n helpers$1.each(points, function (point, index) {\n me.updateElement(point, index, reset);\n });\n },\n\n /**\r\n * @protected\r\n */\n updateElement: function updateElement(point, index, reset) {\n var me = this;\n var meta = me.getMeta();\n var custom = point.custom || {};\n var xScale = me.getScaleForId(meta.xAxisID);\n var yScale = me.getScaleForId(meta.yAxisID);\n\n var options = me._resolveDataElementOptions(point, index);\n\n var data = me.getDataset().data[index];\n var dsIndex = me.index;\n var x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(_typeof(data) === 'object' ? data : NaN, index, dsIndex);\n var y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex);\n point._xScale = xScale;\n point._yScale = yScale;\n point._options = options;\n point._datasetIndex = dsIndex;\n point._index = index;\n point._model = {\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: options.borderWidth,\n hitRadius: options.hitRadius,\n pointStyle: options.pointStyle,\n rotation: options.rotation,\n radius: reset ? 0 : options.radius,\n skip: custom.skip || isNaN(x) || isNaN(y),\n x: x,\n y: y\n };\n point.pivot();\n },\n\n /**\r\n * @protected\r\n */\n setHoverStyle: function setHoverStyle(point) {\n var model = point._model;\n var options = point._options;\n var getHoverColor = helpers$1.getHoverColor;\n point.$previousStyle = {\n backgroundColor: model.backgroundColor,\n borderColor: model.borderColor,\n borderWidth: model.borderWidth,\n radius: model.radius\n };\n model.backgroundColor = valueOrDefault$4(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\n model.borderColor = valueOrDefault$4(options.hoverBorderColor, getHoverColor(options.borderColor));\n model.borderWidth = valueOrDefault$4(options.hoverBorderWidth, options.borderWidth);\n model.radius = options.radius + options.hoverRadius;\n },\n\n /**\r\n * @private\r\n */\n _resolveDataElementOptions: function _resolveDataElementOptions(point, index) {\n var me = this;\n var chart = me.chart;\n var dataset = me.getDataset();\n var custom = point.custom || {};\n var data = dataset.data[index] || {};\n\n var values = core_datasetController.prototype._resolveDataElementOptions.apply(me, arguments); // Scriptable options\n\n\n var context = {\n chart: chart,\n dataIndex: index,\n dataset: dataset,\n datasetIndex: me.index\n }; // In case values were cached (and thus frozen), we need to clone the values\n\n if (me._cachedDataOpts === values) {\n values = helpers$1.extend({}, values);\n } // Custom radius resolution\n\n\n values.radius = resolve$1([custom.radius, data.r, me._config.radius, chart.options.elements.point.radius], context, index);\n return values;\n }\n });\n var valueOrDefault$5 = helpers$1.valueOrDefault;\n var PI$1 = Math.PI;\n var DOUBLE_PI$1 = PI$1 * 2;\n var HALF_PI$1 = PI$1 / 2;\n\n core_defaults._set('doughnut', {\n animation: {\n // Boolean - Whether we animate the rotation of the Doughnut\n animateRotate: true,\n // Boolean - Whether we animate scaling the Doughnut from the centre\n animateScale: false\n },\n hover: {\n mode: 'single'\n },\n legendCallback: function legendCallback(chart) {\n var list = document.createElement('ul');\n var data = chart.data;\n var datasets = data.datasets;\n var labels = data.labels;\n var i, ilen, listItem, listItemSpan;\n list.setAttribute('class', chart.id + '-legend');\n\n if (datasets.length) {\n for (i = 0, ilen = datasets[0].data.length; i < ilen; ++i) {\n listItem = list.appendChild(document.createElement('li'));\n listItemSpan = listItem.appendChild(document.createElement('span'));\n listItemSpan.style.backgroundColor = datasets[0].backgroundColor[i];\n\n if (labels[i]) {\n listItem.appendChild(document.createTextNode(labels[i]));\n }\n }\n }\n\n return list.outerHTML;\n },\n legend: {\n labels: {\n generateLabels: function generateLabels(chart) {\n var data = chart.data;\n\n if (data.labels.length && data.datasets.length) {\n return data.labels.map(function (label, i) {\n var meta = chart.getDatasetMeta(0);\n var style = meta.controller.getStyle(i);\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n lineWidth: style.borderWidth,\n hidden: isNaN(data.datasets[0].data[i]) || meta.data[i].hidden,\n // Extra data used for toggling the correct item\n index: i\n };\n });\n }\n\n return [];\n }\n },\n onClick: function onClick(e, legendItem) {\n var index = legendItem.index;\n var chart = this.chart;\n var i, ilen, meta;\n\n for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {\n meta = chart.getDatasetMeta(i); // toggle visibility of index if exists\n\n if (meta.data[index]) {\n meta.data[index].hidden = !meta.data[index].hidden;\n }\n }\n\n chart.update();\n }\n },\n // The percentage of the chart that we cut out of the middle.\n cutoutPercentage: 50,\n // The rotation of the chart, where the first data arc begins.\n rotation: -HALF_PI$1,\n // The total circumference of the chart.\n circumference: DOUBLE_PI$1,\n // Need to override these to give a nice default\n tooltips: {\n callbacks: {\n title: function title() {\n return '';\n },\n label: function label(tooltipItem, data) {\n var dataLabel = data.labels[tooltipItem.index];\n var value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];\n\n if (helpers$1.isArray(dataLabel)) {\n // show value on first line of multiline label\n // need to clone because we are changing the value\n dataLabel = dataLabel.slice();\n dataLabel[0] += value;\n } else {\n dataLabel += value;\n }\n\n return dataLabel;\n }\n }\n }\n });\n\n var controller_doughnut = core_datasetController.extend({\n dataElementType: elements.Arc,\n linkScales: helpers$1.noop,\n\n /**\r\n * @private\r\n */\n _dataElementOptions: ['backgroundColor', 'borderColor', 'borderWidth', 'borderAlign', 'hoverBackgroundColor', 'hoverBorderColor', 'hoverBorderWidth'],\n // Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly\n getRingIndex: function getRingIndex(datasetIndex) {\n var ringIndex = 0;\n\n for (var j = 0; j < datasetIndex; ++j) {\n if (this.chart.isDatasetVisible(j)) {\n ++ringIndex;\n }\n }\n\n return ringIndex;\n },\n update: function update(reset) {\n var me = this;\n var chart = me.chart;\n var chartArea = chart.chartArea;\n var opts = chart.options;\n var ratioX = 1;\n var ratioY = 1;\n var offsetX = 0;\n var offsetY = 0;\n var meta = me.getMeta();\n var arcs = meta.data;\n var cutout = opts.cutoutPercentage / 100 || 0;\n var circumference = opts.circumference;\n\n var chartWeight = me._getRingWeight(me.index);\n\n var maxWidth, maxHeight, i, ilen; // If the chart's circumference isn't a full circle, calculate size as a ratio of the width/height of the arc\n\n if (circumference < DOUBLE_PI$1) {\n var startAngle = opts.rotation % DOUBLE_PI$1;\n startAngle += startAngle >= PI$1 ? -DOUBLE_PI$1 : startAngle < -PI$1 ? DOUBLE_PI$1 : 0;\n var endAngle = startAngle + circumference;\n var startX = Math.cos(startAngle);\n var startY = Math.sin(startAngle);\n var endX = Math.cos(endAngle);\n var endY = Math.sin(endAngle);\n var contains0 = startAngle <= 0 && endAngle >= 0 || endAngle >= DOUBLE_PI$1;\n var contains90 = startAngle <= HALF_PI$1 && endAngle >= HALF_PI$1 || endAngle >= DOUBLE_PI$1 + HALF_PI$1;\n var contains180 = startAngle === -PI$1 || endAngle >= PI$1;\n var contains270 = startAngle <= -HALF_PI$1 && endAngle >= -HALF_PI$1 || endAngle >= PI$1 + HALF_PI$1;\n var minX = contains180 ? -1 : Math.min(startX, startX * cutout, endX, endX * cutout);\n var minY = contains270 ? -1 : Math.min(startY, startY * cutout, endY, endY * cutout);\n var maxX = contains0 ? 1 : Math.max(startX, startX * cutout, endX, endX * cutout);\n var maxY = contains90 ? 1 : Math.max(startY, startY * cutout, endY, endY * cutout);\n ratioX = (maxX - minX) / 2;\n ratioY = (maxY - minY) / 2;\n offsetX = -(maxX + minX) / 2;\n offsetY = -(maxY + minY) / 2;\n }\n\n for (i = 0, ilen = arcs.length; i < ilen; ++i) {\n arcs[i]._options = me._resolveDataElementOptions(arcs[i], i);\n }\n\n chart.borderWidth = me.getMaxBorderWidth();\n maxWidth = (chartArea.right - chartArea.left - chart.borderWidth) / ratioX;\n maxHeight = (chartArea.bottom - chartArea.top - chart.borderWidth) / ratioY;\n chart.outerRadius = Math.max(Math.min(maxWidth, maxHeight) / 2, 0);\n chart.innerRadius = Math.max(chart.outerRadius * cutout, 0);\n chart.radiusLength = (chart.outerRadius - chart.innerRadius) / (me._getVisibleDatasetWeightTotal() || 1);\n chart.offsetX = offsetX * chart.outerRadius;\n chart.offsetY = offsetY * chart.outerRadius;\n meta.total = me.calculateTotal();\n me.outerRadius = chart.outerRadius - chart.radiusLength * me._getRingWeightOffset(me.index);\n me.innerRadius = Math.max(me.outerRadius - chart.radiusLength * chartWeight, 0);\n\n for (i = 0, ilen = arcs.length; i < ilen; ++i) {\n me.updateElement(arcs[i], i, reset);\n }\n },\n updateElement: function updateElement(arc, index, reset) {\n var me = this;\n var chart = me.chart;\n var chartArea = chart.chartArea;\n var opts = chart.options;\n var animationOpts = opts.animation;\n var centerX = (chartArea.left + chartArea.right) / 2;\n var centerY = (chartArea.top + chartArea.bottom) / 2;\n var startAngle = opts.rotation; // non reset case handled later\n\n var endAngle = opts.rotation; // non reset case handled later\n\n var dataset = me.getDataset();\n var circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / DOUBLE_PI$1);\n var innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius;\n var outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius;\n var options = arc._options || {};\n helpers$1.extend(arc, {\n // Utility\n _datasetIndex: me.index,\n _index: index,\n // Desired view properties\n _model: {\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: options.borderWidth,\n borderAlign: options.borderAlign,\n x: centerX + chart.offsetX,\n y: centerY + chart.offsetY,\n startAngle: startAngle,\n endAngle: endAngle,\n circumference: circumference,\n outerRadius: outerRadius,\n innerRadius: innerRadius,\n label: helpers$1.valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index])\n }\n });\n var model = arc._model; // Set correct angles if not resetting\n\n if (!reset || !animationOpts.animateRotate) {\n if (index === 0) {\n model.startAngle = opts.rotation;\n } else {\n model.startAngle = me.getMeta().data[index - 1]._model.endAngle;\n }\n\n model.endAngle = model.startAngle + model.circumference;\n }\n\n arc.pivot();\n },\n calculateTotal: function calculateTotal() {\n var dataset = this.getDataset();\n var meta = this.getMeta();\n var total = 0;\n var value;\n helpers$1.each(meta.data, function (element, index) {\n value = dataset.data[index];\n\n if (!isNaN(value) && !element.hidden) {\n total += Math.abs(value);\n }\n });\n /* if (total === 0) {\r\n \ttotal = NaN;\r\n }*/\n\n return total;\n },\n calculateCircumference: function calculateCircumference(value) {\n var total = this.getMeta().total;\n\n if (total > 0 && !isNaN(value)) {\n return DOUBLE_PI$1 * (Math.abs(value) / total);\n }\n\n return 0;\n },\n // gets the max border or hover width to properly scale pie charts\n getMaxBorderWidth: function getMaxBorderWidth(arcs) {\n var me = this;\n var max = 0;\n var chart = me.chart;\n var i, ilen, meta, arc, controller, options, borderWidth, hoverWidth;\n\n if (!arcs) {\n // Find the outmost visible dataset\n for (i = 0, ilen = chart.data.datasets.length; i < ilen; ++i) {\n if (chart.isDatasetVisible(i)) {\n meta = chart.getDatasetMeta(i);\n arcs = meta.data;\n\n if (i !== me.index) {\n controller = meta.controller;\n }\n\n break;\n }\n }\n }\n\n if (!arcs) {\n return 0;\n }\n\n for (i = 0, ilen = arcs.length; i < ilen; ++i) {\n arc = arcs[i];\n\n if (controller) {\n controller._configure();\n\n options = controller._resolveDataElementOptions(arc, i);\n } else {\n options = arc._options;\n }\n\n if (options.borderAlign !== 'inner') {\n borderWidth = options.borderWidth;\n hoverWidth = options.hoverBorderWidth;\n max = borderWidth > max ? borderWidth : max;\n max = hoverWidth > max ? hoverWidth : max;\n }\n }\n\n return max;\n },\n\n /**\r\n * @protected\r\n */\n setHoverStyle: function setHoverStyle(arc) {\n var model = arc._model;\n var options = arc._options;\n var getHoverColor = helpers$1.getHoverColor;\n arc.$previousStyle = {\n backgroundColor: model.backgroundColor,\n borderColor: model.borderColor,\n borderWidth: model.borderWidth\n };\n model.backgroundColor = valueOrDefault$5(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\n model.borderColor = valueOrDefault$5(options.hoverBorderColor, getHoverColor(options.borderColor));\n model.borderWidth = valueOrDefault$5(options.hoverBorderWidth, options.borderWidth);\n },\n\n /**\r\n * Get radius length offset of the dataset in relation to the visible datasets weights. This allows determining the inner and outer radius correctly\r\n * @private\r\n */\n _getRingWeightOffset: function _getRingWeightOffset(datasetIndex) {\n var ringWeightOffset = 0;\n\n for (var i = 0; i < datasetIndex; ++i) {\n if (this.chart.isDatasetVisible(i)) {\n ringWeightOffset += this._getRingWeight(i);\n }\n }\n\n return ringWeightOffset;\n },\n\n /**\r\n * @private\r\n */\n _getRingWeight: function _getRingWeight(dataSetIndex) {\n return Math.max(valueOrDefault$5(this.chart.data.datasets[dataSetIndex].weight, 1), 0);\n },\n\n /**\r\n * Returns the sum of all visibile data set weights. This value can be 0.\r\n * @private\r\n */\n _getVisibleDatasetWeightTotal: function _getVisibleDatasetWeightTotal() {\n return this._getRingWeightOffset(this.chart.data.datasets.length);\n }\n });\n\n core_defaults._set('horizontalBar', {\n hover: {\n mode: 'index',\n axis: 'y'\n },\n scales: {\n xAxes: [{\n type: 'linear',\n position: 'bottom'\n }],\n yAxes: [{\n type: 'category',\n position: 'left',\n offset: true,\n gridLines: {\n offsetGridLines: true\n }\n }]\n },\n elements: {\n rectangle: {\n borderSkipped: 'left'\n }\n },\n tooltips: {\n mode: 'index',\n axis: 'y'\n }\n });\n\n core_defaults._set('global', {\n datasets: {\n horizontalBar: {\n categoryPercentage: 0.8,\n barPercentage: 0.9\n }\n }\n });\n\n var controller_horizontalBar = controller_bar.extend({\n /**\r\n * @private\r\n */\n _getValueScaleId: function _getValueScaleId() {\n return this.getMeta().xAxisID;\n },\n\n /**\r\n * @private\r\n */\n _getIndexScaleId: function _getIndexScaleId() {\n return this.getMeta().yAxisID;\n }\n });\n var valueOrDefault$6 = helpers$1.valueOrDefault;\n var resolve$2 = helpers$1.options.resolve;\n var isPointInArea = helpers$1.canvas._isPointInArea;\n\n core_defaults._set('line', {\n showLines: true,\n spanGaps: false,\n hover: {\n mode: 'label'\n },\n scales: {\n xAxes: [{\n type: 'category',\n id: 'x-axis-0'\n }],\n yAxes: [{\n type: 'linear',\n id: 'y-axis-0'\n }]\n }\n });\n\n function scaleClip(scale, halfBorderWidth) {\n var tickOpts = scale && scale.options.ticks || {};\n var reverse = tickOpts.reverse;\n var min = tickOpts.min === undefined ? halfBorderWidth : 0;\n var max = tickOpts.max === undefined ? halfBorderWidth : 0;\n return {\n start: reverse ? max : min,\n end: reverse ? min : max\n };\n }\n\n function defaultClip(xScale, yScale, borderWidth) {\n var halfBorderWidth = borderWidth / 2;\n var x = scaleClip(xScale, halfBorderWidth);\n var y = scaleClip(yScale, halfBorderWidth);\n return {\n top: y.end,\n right: x.end,\n bottom: y.start,\n left: x.start\n };\n }\n\n function toClip(value) {\n var t, r, b, l;\n\n if (helpers$1.isObject(value)) {\n t = value.top;\n r = value.right;\n b = value.bottom;\n l = value.left;\n } else {\n t = r = b = l = value;\n }\n\n return {\n top: t,\n right: r,\n bottom: b,\n left: l\n };\n }\n\n var controller_line = core_datasetController.extend({\n datasetElementType: elements.Line,\n dataElementType: elements.Point,\n\n /**\r\n * @private\r\n */\n _datasetElementOptions: ['backgroundColor', 'borderCapStyle', 'borderColor', 'borderDash', 'borderDashOffset', 'borderJoinStyle', 'borderWidth', 'cubicInterpolationMode', 'fill'],\n\n /**\r\n * @private\r\n */\n _dataElementOptions: {\n backgroundColor: 'pointBackgroundColor',\n borderColor: 'pointBorderColor',\n borderWidth: 'pointBorderWidth',\n hitRadius: 'pointHitRadius',\n hoverBackgroundColor: 'pointHoverBackgroundColor',\n hoverBorderColor: 'pointHoverBorderColor',\n hoverBorderWidth: 'pointHoverBorderWidth',\n hoverRadius: 'pointHoverRadius',\n pointStyle: 'pointStyle',\n radius: 'pointRadius',\n rotation: 'pointRotation'\n },\n update: function update(reset) {\n var me = this;\n var meta = me.getMeta();\n var line = meta.dataset;\n var points = meta.data || [];\n var options = me.chart.options;\n var config = me._config;\n var showLine = me._showLine = valueOrDefault$6(config.showLine, options.showLines);\n var i, ilen;\n me._xScale = me.getScaleForId(meta.xAxisID);\n me._yScale = me.getScaleForId(meta.yAxisID); // Update Line\n\n if (showLine) {\n // Compatibility: If the properties are defined with only the old name, use those values\n if (config.tension !== undefined && config.lineTension === undefined) {\n config.lineTension = config.tension;\n } // Utility\n\n\n line._scale = me._yScale;\n line._datasetIndex = me.index; // Data\n\n line._children = points; // Model\n\n line._model = me._resolveDatasetElementOptions(line);\n line.pivot();\n } // Update Points\n\n\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n me.updateElement(points[i], i, reset);\n }\n\n if (showLine && line._model.tension !== 0) {\n me.updateBezierControlPoints();\n } // Now pivot the point for animation\n\n\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n points[i].pivot();\n }\n },\n updateElement: function updateElement(point, index, reset) {\n var me = this;\n var meta = me.getMeta();\n var custom = point.custom || {};\n var dataset = me.getDataset();\n var datasetIndex = me.index;\n var value = dataset.data[index];\n var xScale = me._xScale;\n var yScale = me._yScale;\n var lineModel = meta.dataset._model;\n var x, y;\n\n var options = me._resolveDataElementOptions(point, index);\n\n x = xScale.getPixelForValue(_typeof(value) === 'object' ? value : NaN, index, datasetIndex);\n y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex); // Utility\n\n point._xScale = xScale;\n point._yScale = yScale;\n point._options = options;\n point._datasetIndex = datasetIndex;\n point._index = index; // Desired view properties\n\n point._model = {\n x: x,\n y: y,\n skip: custom.skip || isNaN(x) || isNaN(y),\n // Appearance\n radius: options.radius,\n pointStyle: options.pointStyle,\n rotation: options.rotation,\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: options.borderWidth,\n tension: valueOrDefault$6(custom.tension, lineModel ? lineModel.tension : 0),\n steppedLine: lineModel ? lineModel.steppedLine : false,\n // Tooltip\n hitRadius: options.hitRadius\n };\n },\n\n /**\r\n * @private\r\n */\n _resolveDatasetElementOptions: function _resolveDatasetElementOptions(element) {\n var me = this;\n var config = me._config;\n var custom = element.custom || {};\n var options = me.chart.options;\n var lineOptions = options.elements.line;\n\n var values = core_datasetController.prototype._resolveDatasetElementOptions.apply(me, arguments); // The default behavior of lines is to break at null values, according\n // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158\n // This option gives lines the ability to span gaps\n\n\n values.spanGaps = valueOrDefault$6(config.spanGaps, options.spanGaps);\n values.tension = valueOrDefault$6(config.lineTension, lineOptions.tension);\n values.steppedLine = resolve$2([custom.steppedLine, config.steppedLine, lineOptions.stepped]);\n values.clip = toClip(valueOrDefault$6(config.clip, defaultClip(me._xScale, me._yScale, values.borderWidth)));\n return values;\n },\n calculatePointY: function calculatePointY(value, index, datasetIndex) {\n var me = this;\n var chart = me.chart;\n var yScale = me._yScale;\n var sumPos = 0;\n var sumNeg = 0;\n var i, ds, dsMeta, stackedRightValue, rightValue, metasets, ilen;\n\n if (yScale.options.stacked) {\n rightValue = +yScale.getRightValue(value);\n metasets = chart._getSortedVisibleDatasetMetas();\n ilen = metasets.length;\n\n for (i = 0; i < ilen; ++i) {\n dsMeta = metasets[i];\n\n if (dsMeta.index === datasetIndex) {\n break;\n }\n\n ds = chart.data.datasets[dsMeta.index];\n\n if (dsMeta.type === 'line' && dsMeta.yAxisID === yScale.id) {\n stackedRightValue = +yScale.getRightValue(ds.data[index]);\n\n if (stackedRightValue < 0) {\n sumNeg += stackedRightValue || 0;\n } else {\n sumPos += stackedRightValue || 0;\n }\n }\n }\n\n if (rightValue < 0) {\n return yScale.getPixelForValue(sumNeg + rightValue);\n }\n\n return yScale.getPixelForValue(sumPos + rightValue);\n }\n\n return yScale.getPixelForValue(value);\n },\n updateBezierControlPoints: function updateBezierControlPoints() {\n var me = this;\n var chart = me.chart;\n var meta = me.getMeta();\n var lineModel = meta.dataset._model;\n var area = chart.chartArea;\n var points = meta.data || [];\n var i, ilen, model, controlPoints; // Only consider points that are drawn in case the spanGaps option is used\n\n if (lineModel.spanGaps) {\n points = points.filter(function (pt) {\n return !pt._model.skip;\n });\n }\n\n function capControlPoint(pt, min, max) {\n return Math.max(Math.min(pt, max), min);\n }\n\n if (lineModel.cubicInterpolationMode === 'monotone') {\n helpers$1.splineCurveMonotone(points);\n } else {\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n model = points[i]._model;\n controlPoints = helpers$1.splineCurve(helpers$1.previousItem(points, i)._model, model, helpers$1.nextItem(points, i)._model, lineModel.tension);\n model.controlPointPreviousX = controlPoints.previous.x;\n model.controlPointPreviousY = controlPoints.previous.y;\n model.controlPointNextX = controlPoints.next.x;\n model.controlPointNextY = controlPoints.next.y;\n }\n }\n\n if (chart.options.elements.line.capBezierPoints) {\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n model = points[i]._model;\n\n if (isPointInArea(model, area)) {\n if (i > 0 && isPointInArea(points[i - 1]._model, area)) {\n model.controlPointPreviousX = capControlPoint(model.controlPointPreviousX, area.left, area.right);\n model.controlPointPreviousY = capControlPoint(model.controlPointPreviousY, area.top, area.bottom);\n }\n\n if (i < points.length - 1 && isPointInArea(points[i + 1]._model, area)) {\n model.controlPointNextX = capControlPoint(model.controlPointNextX, area.left, area.right);\n model.controlPointNextY = capControlPoint(model.controlPointNextY, area.top, area.bottom);\n }\n }\n }\n }\n },\n draw: function draw() {\n var me = this;\n var chart = me.chart;\n var meta = me.getMeta();\n var points = meta.data || [];\n var area = chart.chartArea;\n var canvas = chart.canvas;\n var i = 0;\n var ilen = points.length;\n var clip;\n\n if (me._showLine) {\n clip = meta.dataset._model.clip;\n helpers$1.canvas.clipArea(chart.ctx, {\n left: clip.left === false ? 0 : area.left - clip.left,\n right: clip.right === false ? canvas.width : area.right + clip.right,\n top: clip.top === false ? 0 : area.top - clip.top,\n bottom: clip.bottom === false ? canvas.height : area.bottom + clip.bottom\n });\n meta.dataset.draw();\n helpers$1.canvas.unclipArea(chart.ctx);\n } // Draw the points\n\n\n for (; i < ilen; ++i) {\n points[i].draw(area);\n }\n },\n\n /**\r\n * @protected\r\n */\n setHoverStyle: function setHoverStyle(point) {\n var model = point._model;\n var options = point._options;\n var getHoverColor = helpers$1.getHoverColor;\n point.$previousStyle = {\n backgroundColor: model.backgroundColor,\n borderColor: model.borderColor,\n borderWidth: model.borderWidth,\n radius: model.radius\n };\n model.backgroundColor = valueOrDefault$6(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\n model.borderColor = valueOrDefault$6(options.hoverBorderColor, getHoverColor(options.borderColor));\n model.borderWidth = valueOrDefault$6(options.hoverBorderWidth, options.borderWidth);\n model.radius = valueOrDefault$6(options.hoverRadius, options.radius);\n }\n });\n var resolve$3 = helpers$1.options.resolve;\n\n core_defaults._set('polarArea', {\n scale: {\n type: 'radialLinear',\n angleLines: {\n display: false\n },\n gridLines: {\n circular: true\n },\n pointLabels: {\n display: false\n },\n ticks: {\n beginAtZero: true\n }\n },\n // Boolean - Whether to animate the rotation of the chart\n animation: {\n animateRotate: true,\n animateScale: true\n },\n startAngle: -0.5 * Math.PI,\n legendCallback: function legendCallback(chart) {\n var list = document.createElement('ul');\n var data = chart.data;\n var datasets = data.datasets;\n var labels = data.labels;\n var i, ilen, listItem, listItemSpan;\n list.setAttribute('class', chart.id + '-legend');\n\n if (datasets.length) {\n for (i = 0, ilen = datasets[0].data.length; i < ilen; ++i) {\n listItem = list.appendChild(document.createElement('li'));\n listItemSpan = listItem.appendChild(document.createElement('span'));\n listItemSpan.style.backgroundColor = datasets[0].backgroundColor[i];\n\n if (labels[i]) {\n listItem.appendChild(document.createTextNode(labels[i]));\n }\n }\n }\n\n return list.outerHTML;\n },\n legend: {\n labels: {\n generateLabels: function generateLabels(chart) {\n var data = chart.data;\n\n if (data.labels.length && data.datasets.length) {\n return data.labels.map(function (label, i) {\n var meta = chart.getDatasetMeta(0);\n var style = meta.controller.getStyle(i);\n return {\n text: label,\n fillStyle: style.backgroundColor,\n strokeStyle: style.borderColor,\n lineWidth: style.borderWidth,\n hidden: isNaN(data.datasets[0].data[i]) || meta.data[i].hidden,\n // Extra data used for toggling the correct item\n index: i\n };\n });\n }\n\n return [];\n }\n },\n onClick: function onClick(e, legendItem) {\n var index = legendItem.index;\n var chart = this.chart;\n var i, ilen, meta;\n\n for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {\n meta = chart.getDatasetMeta(i);\n meta.data[index].hidden = !meta.data[index].hidden;\n }\n\n chart.update();\n }\n },\n // Need to override these to give a nice default\n tooltips: {\n callbacks: {\n title: function title() {\n return '';\n },\n label: function label(item, data) {\n return data.labels[item.index] + ': ' + item.yLabel;\n }\n }\n }\n });\n\n var controller_polarArea = core_datasetController.extend({\n dataElementType: elements.Arc,\n linkScales: helpers$1.noop,\n\n /**\r\n * @private\r\n */\n _dataElementOptions: ['backgroundColor', 'borderColor', 'borderWidth', 'borderAlign', 'hoverBackgroundColor', 'hoverBorderColor', 'hoverBorderWidth'],\n\n /**\r\n * @private\r\n */\n _getIndexScaleId: function _getIndexScaleId() {\n return this.chart.scale.id;\n },\n\n /**\r\n * @private\r\n */\n _getValueScaleId: function _getValueScaleId() {\n return this.chart.scale.id;\n },\n update: function update(reset) {\n var me = this;\n var dataset = me.getDataset();\n var meta = me.getMeta();\n var start = me.chart.options.startAngle || 0;\n var starts = me._starts = [];\n var angles = me._angles = [];\n var arcs = meta.data;\n var i, ilen, angle;\n\n me._updateRadius();\n\n meta.count = me.countVisibleElements();\n\n for (i = 0, ilen = dataset.data.length; i < ilen; i++) {\n starts[i] = start;\n angle = me._computeAngle(i);\n angles[i] = angle;\n start += angle;\n }\n\n for (i = 0, ilen = arcs.length; i < ilen; ++i) {\n arcs[i]._options = me._resolveDataElementOptions(arcs[i], i);\n me.updateElement(arcs[i], i, reset);\n }\n },\n\n /**\r\n * @private\r\n */\n _updateRadius: function _updateRadius() {\n var me = this;\n var chart = me.chart;\n var chartArea = chart.chartArea;\n var opts = chart.options;\n var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);\n chart.outerRadius = Math.max(minSize / 2, 0);\n chart.innerRadius = Math.max(opts.cutoutPercentage ? chart.outerRadius / 100 * opts.cutoutPercentage : 1, 0);\n chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();\n me.outerRadius = chart.outerRadius - chart.radiusLength * me.index;\n me.innerRadius = me.outerRadius - chart.radiusLength;\n },\n updateElement: function updateElement(arc, index, reset) {\n var me = this;\n var chart = me.chart;\n var dataset = me.getDataset();\n var opts = chart.options;\n var animationOpts = opts.animation;\n var scale = chart.scale;\n var labels = chart.data.labels;\n var centerX = scale.xCenter;\n var centerY = scale.yCenter; // var negHalfPI = -0.5 * Math.PI;\n\n var datasetStartAngle = opts.startAngle;\n var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);\n var startAngle = me._starts[index];\n var endAngle = startAngle + (arc.hidden ? 0 : me._angles[index]);\n var resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);\n var options = arc._options || {};\n helpers$1.extend(arc, {\n // Utility\n _datasetIndex: me.index,\n _index: index,\n _scale: scale,\n // Desired view properties\n _model: {\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: options.borderWidth,\n borderAlign: options.borderAlign,\n x: centerX,\n y: centerY,\n innerRadius: 0,\n outerRadius: reset ? resetRadius : distance,\n startAngle: reset && animationOpts.animateRotate ? datasetStartAngle : startAngle,\n endAngle: reset && animationOpts.animateRotate ? datasetStartAngle : endAngle,\n label: helpers$1.valueAtIndexOrDefault(labels, index, labels[index])\n }\n });\n arc.pivot();\n },\n countVisibleElements: function countVisibleElements() {\n var dataset = this.getDataset();\n var meta = this.getMeta();\n var count = 0;\n helpers$1.each(meta.data, function (element, index) {\n if (!isNaN(dataset.data[index]) && !element.hidden) {\n count++;\n }\n });\n return count;\n },\n\n /**\r\n * @protected\r\n */\n setHoverStyle: function setHoverStyle(arc) {\n var model = arc._model;\n var options = arc._options;\n var getHoverColor = helpers$1.getHoverColor;\n var valueOrDefault = helpers$1.valueOrDefault;\n arc.$previousStyle = {\n backgroundColor: model.backgroundColor,\n borderColor: model.borderColor,\n borderWidth: model.borderWidth\n };\n model.backgroundColor = valueOrDefault(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\n model.borderColor = valueOrDefault(options.hoverBorderColor, getHoverColor(options.borderColor));\n model.borderWidth = valueOrDefault(options.hoverBorderWidth, options.borderWidth);\n },\n\n /**\r\n * @private\r\n */\n _computeAngle: function _computeAngle(index) {\n var me = this;\n var count = this.getMeta().count;\n var dataset = me.getDataset();\n var meta = me.getMeta();\n\n if (isNaN(dataset.data[index]) || meta.data[index].hidden) {\n return 0;\n } // Scriptable options\n\n\n var context = {\n chart: me.chart,\n dataIndex: index,\n dataset: dataset,\n datasetIndex: me.index\n };\n return resolve$3([me.chart.options.elements.arc.angle, 2 * Math.PI / count], context, index);\n }\n });\n\n core_defaults._set('pie', helpers$1.clone(core_defaults.doughnut));\n\n core_defaults._set('pie', {\n cutoutPercentage: 0\n }); // Pie charts are Doughnut chart with different defaults\n\n\n var controller_pie = controller_doughnut;\n var valueOrDefault$7 = helpers$1.valueOrDefault;\n\n core_defaults._set('radar', {\n spanGaps: false,\n scale: {\n type: 'radialLinear'\n },\n elements: {\n line: {\n fill: 'start',\n tension: 0 // no bezier in radar\n\n }\n }\n });\n\n var controller_radar = core_datasetController.extend({\n datasetElementType: elements.Line,\n dataElementType: elements.Point,\n linkScales: helpers$1.noop,\n\n /**\r\n * @private\r\n */\n _datasetElementOptions: ['backgroundColor', 'borderWidth', 'borderColor', 'borderCapStyle', 'borderDash', 'borderDashOffset', 'borderJoinStyle', 'fill'],\n\n /**\r\n * @private\r\n */\n _dataElementOptions: {\n backgroundColor: 'pointBackgroundColor',\n borderColor: 'pointBorderColor',\n borderWidth: 'pointBorderWidth',\n hitRadius: 'pointHitRadius',\n hoverBackgroundColor: 'pointHoverBackgroundColor',\n hoverBorderColor: 'pointHoverBorderColor',\n hoverBorderWidth: 'pointHoverBorderWidth',\n hoverRadius: 'pointHoverRadius',\n pointStyle: 'pointStyle',\n radius: 'pointRadius',\n rotation: 'pointRotation'\n },\n\n /**\r\n * @private\r\n */\n _getIndexScaleId: function _getIndexScaleId() {\n return this.chart.scale.id;\n },\n\n /**\r\n * @private\r\n */\n _getValueScaleId: function _getValueScaleId() {\n return this.chart.scale.id;\n },\n update: function update(reset) {\n var me = this;\n var meta = me.getMeta();\n var line = meta.dataset;\n var points = meta.data || [];\n var scale = me.chart.scale;\n var config = me._config;\n var i, ilen; // Compatibility: If the properties are defined with only the old name, use those values\n\n if (config.tension !== undefined && config.lineTension === undefined) {\n config.lineTension = config.tension;\n } // Utility\n\n\n line._scale = scale;\n line._datasetIndex = me.index; // Data\n\n line._children = points;\n line._loop = true; // Model\n\n line._model = me._resolveDatasetElementOptions(line);\n line.pivot(); // Update Points\n\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n me.updateElement(points[i], i, reset);\n } // Update bezier control points\n\n\n me.updateBezierControlPoints(); // Now pivot the point for animation\n\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n points[i].pivot();\n }\n },\n updateElement: function updateElement(point, index, reset) {\n var me = this;\n var custom = point.custom || {};\n var dataset = me.getDataset();\n var scale = me.chart.scale;\n var pointPosition = scale.getPointPositionForValue(index, dataset.data[index]);\n\n var options = me._resolveDataElementOptions(point, index);\n\n var lineModel = me.getMeta().dataset._model;\n\n var x = reset ? scale.xCenter : pointPosition.x;\n var y = reset ? scale.yCenter : pointPosition.y; // Utility\n\n point._scale = scale;\n point._options = options;\n point._datasetIndex = me.index;\n point._index = index; // Desired view properties\n\n point._model = {\n x: x,\n // value not used in dataset scale, but we want a consistent API between scales\n y: y,\n skip: custom.skip || isNaN(x) || isNaN(y),\n // Appearance\n radius: options.radius,\n pointStyle: options.pointStyle,\n rotation: options.rotation,\n backgroundColor: options.backgroundColor,\n borderColor: options.borderColor,\n borderWidth: options.borderWidth,\n tension: valueOrDefault$7(custom.tension, lineModel ? lineModel.tension : 0),\n // Tooltip\n hitRadius: options.hitRadius\n };\n },\n\n /**\r\n * @private\r\n */\n _resolveDatasetElementOptions: function _resolveDatasetElementOptions() {\n var me = this;\n var config = me._config;\n var options = me.chart.options;\n\n var values = core_datasetController.prototype._resolveDatasetElementOptions.apply(me, arguments);\n\n values.spanGaps = valueOrDefault$7(config.spanGaps, options.spanGaps);\n values.tension = valueOrDefault$7(config.lineTension, options.elements.line.tension);\n return values;\n },\n updateBezierControlPoints: function updateBezierControlPoints() {\n var me = this;\n var meta = me.getMeta();\n var area = me.chart.chartArea;\n var points = meta.data || [];\n var i, ilen, model, controlPoints; // Only consider points that are drawn in case the spanGaps option is used\n\n if (meta.dataset._model.spanGaps) {\n points = points.filter(function (pt) {\n return !pt._model.skip;\n });\n }\n\n function capControlPoint(pt, min, max) {\n return Math.max(Math.min(pt, max), min);\n }\n\n for (i = 0, ilen = points.length; i < ilen; ++i) {\n model = points[i]._model;\n controlPoints = helpers$1.splineCurve(helpers$1.previousItem(points, i, true)._model, model, helpers$1.nextItem(points, i, true)._model, model.tension); // Prevent the bezier going outside of the bounds of the graph\n\n model.controlPointPreviousX = capControlPoint(controlPoints.previous.x, area.left, area.right);\n model.controlPointPreviousY = capControlPoint(controlPoints.previous.y, area.top, area.bottom);\n model.controlPointNextX = capControlPoint(controlPoints.next.x, area.left, area.right);\n model.controlPointNextY = capControlPoint(controlPoints.next.y, area.top, area.bottom);\n }\n },\n setHoverStyle: function setHoverStyle(point) {\n var model = point._model;\n var options = point._options;\n var getHoverColor = helpers$1.getHoverColor;\n point.$previousStyle = {\n backgroundColor: model.backgroundColor,\n borderColor: model.borderColor,\n borderWidth: model.borderWidth,\n radius: model.radius\n };\n model.backgroundColor = valueOrDefault$7(options.hoverBackgroundColor, getHoverColor(options.backgroundColor));\n model.borderColor = valueOrDefault$7(options.hoverBorderColor, getHoverColor(options.borderColor));\n model.borderWidth = valueOrDefault$7(options.hoverBorderWidth, options.borderWidth);\n model.radius = valueOrDefault$7(options.hoverRadius, options.radius);\n }\n });\n\n core_defaults._set('scatter', {\n hover: {\n mode: 'single'\n },\n scales: {\n xAxes: [{\n id: 'x-axis-1',\n // need an ID so datasets can reference the scale\n type: 'linear',\n // scatter should not use a category axis\n position: 'bottom'\n }],\n yAxes: [{\n id: 'y-axis-1',\n type: 'linear',\n position: 'left'\n }]\n },\n tooltips: {\n callbacks: {\n title: function title() {\n return ''; // doesn't make sense for scatter since data are formatted as a point\n },\n label: function label(item) {\n return '(' + item.xLabel + ', ' + item.yLabel + ')';\n }\n }\n }\n });\n\n core_defaults._set('global', {\n datasets: {\n scatter: {\n showLine: false\n }\n }\n }); // Scatter charts use line controllers\n\n\n var controller_scatter = controller_line; // NOTE export a map in which the key represents the controller type, not\n // the class, and so must be CamelCase in order to be correctly retrieved\n // by the controller in core.controller.js (`controllers[meta.type]`).\n\n var controllers = {\n bar: controller_bar,\n bubble: controller_bubble,\n doughnut: controller_doughnut,\n horizontalBar: controller_horizontalBar,\n line: controller_line,\n polarArea: controller_polarArea,\n pie: controller_pie,\n radar: controller_radar,\n scatter: controller_scatter\n };\n /**\r\n * Helper function to get relative position for an event\r\n * @param {Event|IEvent} event - The event to get the position for\r\n * @param {Chart} chart - The chart\r\n * @returns {object} the event position\r\n */\n\n function getRelativePosition(e, chart) {\n if (e.native) {\n return {\n x: e.x,\n y: e.y\n };\n }\n\n return helpers$1.getRelativePosition(e, chart);\n }\n /**\r\n * Helper function to traverse all of the visible elements in the chart\r\n * @param {Chart} chart - the chart\r\n * @param {function} handler - the callback to execute for each visible item\r\n */\n\n\n function parseVisibleItems(chart, handler) {\n var metasets = chart._getSortedVisibleDatasetMetas();\n\n var metadata, i, j, ilen, jlen, element;\n\n for (i = 0, ilen = metasets.length; i < ilen; ++i) {\n metadata = metasets[i].data;\n\n for (j = 0, jlen = metadata.length; j < jlen; ++j) {\n element = metadata[j];\n\n if (!element._view.skip) {\n handler(element);\n }\n }\n }\n }\n /**\r\n * Helper function to get the items that intersect the event position\r\n * @param {ChartElement[]} items - elements to filter\r\n * @param {object} position - the point to be nearest to\r\n * @return {ChartElement[]} the nearest items\r\n */\n\n\n function getIntersectItems(chart, position) {\n var elements = [];\n parseVisibleItems(chart, function (element) {\n if (element.inRange(position.x, position.y)) {\n elements.push(element);\n }\n });\n return elements;\n }\n /**\r\n * Helper function to get the items nearest to the event position considering all visible items in teh chart\r\n * @param {Chart} chart - the chart to look at elements from\r\n * @param {object} position - the point to be nearest to\r\n * @param {boolean} intersect - if true, only consider items that intersect the position\r\n * @param {function} distanceMetric - function to provide the distance between points\r\n * @return {ChartElement[]} the nearest items\r\n */\n\n\n function getNearestItems(chart, position, intersect, distanceMetric) {\n var minDistance = Number.POSITIVE_INFINITY;\n var nearestItems = [];\n parseVisibleItems(chart, function (element) {\n if (intersect && !element.inRange(position.x, position.y)) {\n return;\n }\n\n var center = element.getCenterPoint();\n var distance = distanceMetric(position, center);\n\n if (distance < minDistance) {\n nearestItems = [element];\n minDistance = distance;\n } else if (distance === minDistance) {\n // Can have multiple items at the same distance in which case we sort by size\n nearestItems.push(element);\n }\n });\n return nearestItems;\n }\n /**\r\n * Get a distance metric function for two points based on the\r\n * axis mode setting\r\n * @param {string} axis - the axis mode. x|y|xy\r\n */\n\n\n function getDistanceMetricForAxis(axis) {\n var useX = axis.indexOf('x') !== -1;\n var useY = axis.indexOf('y') !== -1;\n return function (pt1, pt2) {\n var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;\n var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;\n return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));\n };\n }\n\n function indexMode(chart, e, options) {\n var position = getRelativePosition(e, chart); // Default axis for index mode is 'x' to match old behaviour\n\n options.axis = options.axis || 'x';\n var distanceMetric = getDistanceMetricForAxis(options.axis);\n var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);\n var elements = [];\n\n if (!items.length) {\n return [];\n }\n\n chart._getSortedVisibleDatasetMetas().forEach(function (meta) {\n var element = meta.data[items[0]._index]; // don't count items that are skipped (null data)\n\n if (element && !element._view.skip) {\n elements.push(element);\n }\n });\n\n return elements;\n }\n /**\r\n * @interface IInteractionOptions\r\n */\n\n /**\r\n * If true, only consider items that intersect the point\r\n * @name IInterfaceOptions#boolean\r\n * @type Boolean\r\n */\n\n /**\r\n * Contains interaction related functions\r\n * @namespace Chart.Interaction\r\n */\n\n\n var core_interaction = {\n // Helper function for different modes\n modes: {\n single: function single(chart, e) {\n var position = getRelativePosition(e, chart);\n var elements = [];\n parseVisibleItems(chart, function (element) {\n if (element.inRange(position.x, position.y)) {\n elements.push(element);\n return elements;\n }\n });\n return elements.slice(0, 1);\n },\n\n /**\r\n * @function Chart.Interaction.modes.label\r\n * @deprecated since version 2.4.0\r\n * @todo remove at version 3\r\n * @private\r\n */\n label: indexMode,\n\n /**\r\n * Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something\r\n * If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item\r\n * @function Chart.Interaction.modes.index\r\n * @since v2.4.0\r\n * @param {Chart} chart - the chart we are returning items from\r\n * @param {Event} e - the event we are find things at\r\n * @param {IInteractionOptions} options - options to use during interaction\r\n * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n */\n index: indexMode,\n\n /**\r\n * Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something\r\n * If the options.intersect is false, we find the nearest item and return the items in that dataset\r\n * @function Chart.Interaction.modes.dataset\r\n * @param {Chart} chart - the chart we are returning items from\r\n * @param {Event} e - the event we are find things at\r\n * @param {IInteractionOptions} options - options to use during interaction\r\n * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n */\n dataset: function dataset(chart, e, options) {\n var position = getRelativePosition(e, chart);\n options.axis = options.axis || 'xy';\n var distanceMetric = getDistanceMetricForAxis(options.axis);\n var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);\n\n if (items.length > 0) {\n items = chart.getDatasetMeta(items[0]._datasetIndex).data;\n }\n\n return items;\n },\n\n /**\r\n * @function Chart.Interaction.modes.x-axis\r\n * @deprecated since version 2.4.0. Use index mode and intersect == true\r\n * @todo remove at version 3\r\n * @private\r\n */\n 'x-axis': function xAxis(chart, e) {\n return indexMode(chart, e, {\n intersect: false\n });\n },\n\n /**\r\n * Point mode returns all elements that hit test based on the event position\r\n * of the event\r\n * @function Chart.Interaction.modes.intersect\r\n * @param {Chart} chart - the chart we are returning items from\r\n * @param {Event} e - the event we are find things at\r\n * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n */\n point: function point(chart, e) {\n var position = getRelativePosition(e, chart);\n return getIntersectItems(chart, position);\n },\n\n /**\r\n * nearest mode returns the element closest to the point\r\n * @function Chart.Interaction.modes.intersect\r\n * @param {Chart} chart - the chart we are returning items from\r\n * @param {Event} e - the event we are find things at\r\n * @param {IInteractionOptions} options - options to use\r\n * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n */\n nearest: function nearest(chart, e, options) {\n var position = getRelativePosition(e, chart);\n options.axis = options.axis || 'xy';\n var distanceMetric = getDistanceMetricForAxis(options.axis);\n return getNearestItems(chart, position, options.intersect, distanceMetric);\n },\n\n /**\r\n * x mode returns the elements that hit-test at the current x coordinate\r\n * @function Chart.Interaction.modes.x\r\n * @param {Chart} chart - the chart we are returning items from\r\n * @param {Event} e - the event we are find things at\r\n * @param {IInteractionOptions} options - options to use\r\n * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n */\n x: function x(chart, e, options) {\n var position = getRelativePosition(e, chart);\n var items = [];\n var intersectsItem = false;\n parseVisibleItems(chart, function (element) {\n if (element.inXRange(position.x)) {\n items.push(element);\n }\n\n if (element.inRange(position.x, position.y)) {\n intersectsItem = true;\n }\n }); // If we want to trigger on an intersect and we don't have any items\n // that intersect the position, return nothing\n\n if (options.intersect && !intersectsItem) {\n items = [];\n }\n\n return items;\n },\n\n /**\r\n * y mode returns the elements that hit-test at the current y coordinate\r\n * @function Chart.Interaction.modes.y\r\n * @param {Chart} chart - the chart we are returning items from\r\n * @param {Event} e - the event we are find things at\r\n * @param {IInteractionOptions} options - options to use\r\n * @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned\r\n */\n y: function y(chart, e, options) {\n var position = getRelativePosition(e, chart);\n var items = [];\n var intersectsItem = false;\n parseVisibleItems(chart, function (element) {\n if (element.inYRange(position.y)) {\n items.push(element);\n }\n\n if (element.inRange(position.x, position.y)) {\n intersectsItem = true;\n }\n }); // If we want to trigger on an intersect and we don't have any items\n // that intersect the position, return nothing\n\n if (options.intersect && !intersectsItem) {\n items = [];\n }\n\n return items;\n }\n }\n };\n var extend = helpers$1.extend;\n\n function filterByPosition(array, position) {\n return helpers$1.where(array, function (v) {\n return v.pos === position;\n });\n }\n\n function sortByWeight(array, reverse) {\n return array.sort(function (a, b) {\n var v0 = reverse ? b : a;\n var v1 = reverse ? a : b;\n return v0.weight === v1.weight ? v0.index - v1.index : v0.weight - v1.weight;\n });\n }\n\n function wrapBoxes(boxes) {\n var layoutBoxes = [];\n var i, ilen, box;\n\n for (i = 0, ilen = (boxes || []).length; i < ilen; ++i) {\n box = boxes[i];\n layoutBoxes.push({\n index: i,\n box: box,\n pos: box.position,\n horizontal: box.isHorizontal(),\n weight: box.weight\n });\n }\n\n return layoutBoxes;\n }\n\n function setLayoutDims(layouts, params) {\n var i, ilen, layout;\n\n for (i = 0, ilen = layouts.length; i < ilen; ++i) {\n layout = layouts[i]; // store width used instead of chartArea.w in fitBoxes\n\n layout.width = layout.horizontal ? layout.box.fullWidth && params.availableWidth : params.vBoxMaxWidth; // store height used instead of chartArea.h in fitBoxes\n\n layout.height = layout.horizontal && params.hBoxMaxHeight;\n }\n }\n\n function buildLayoutBoxes(boxes) {\n var layoutBoxes = wrapBoxes(boxes);\n var left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);\n var right = sortByWeight(filterByPosition(layoutBoxes, 'right'));\n var top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);\n var bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));\n return {\n leftAndTop: left.concat(top),\n rightAndBottom: right.concat(bottom),\n chartArea: filterByPosition(layoutBoxes, 'chartArea'),\n vertical: left.concat(right),\n horizontal: top.concat(bottom)\n };\n }\n\n function getCombinedMax(maxPadding, chartArea, a, b) {\n return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);\n }\n\n function updateDims(chartArea, params, layout) {\n var box = layout.box;\n var maxPadding = chartArea.maxPadding;\n var newWidth, newHeight;\n\n if (layout.size) {\n // this layout was already counted for, lets first reduce old size\n chartArea[layout.pos] -= layout.size;\n }\n\n layout.size = layout.horizontal ? box.height : box.width;\n chartArea[layout.pos] += layout.size;\n\n if (box.getPadding) {\n var boxPadding = box.getPadding();\n maxPadding.top = Math.max(maxPadding.top, boxPadding.top);\n maxPadding.left = Math.max(maxPadding.left, boxPadding.left);\n maxPadding.bottom = Math.max(maxPadding.bottom, boxPadding.bottom);\n maxPadding.right = Math.max(maxPadding.right, boxPadding.right);\n }\n\n newWidth = params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right');\n newHeight = params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom');\n\n if (newWidth !== chartArea.w || newHeight !== chartArea.h) {\n chartArea.w = newWidth;\n chartArea.h = newHeight; // return true if chart area changed in layout's direction\n\n var sizes = layout.horizontal ? [newWidth, chartArea.w] : [newHeight, chartArea.h];\n return sizes[0] !== sizes[1] && (!isNaN(sizes[0]) || !isNaN(sizes[1]));\n }\n }\n\n function handleMaxPadding(chartArea) {\n var maxPadding = chartArea.maxPadding;\n\n function updatePos(pos) {\n var change = Math.max(maxPadding[pos] - chartArea[pos], 0);\n chartArea[pos] += change;\n return change;\n }\n\n chartArea.y += updatePos('top');\n chartArea.x += updatePos('left');\n updatePos('right');\n updatePos('bottom');\n }\n\n function getMargins(horizontal, chartArea) {\n var maxPadding = chartArea.maxPadding;\n\n function marginForPositions(positions) {\n var margin = {\n left: 0,\n top: 0,\n right: 0,\n bottom: 0\n };\n positions.forEach(function (pos) {\n margin[pos] = Math.max(chartArea[pos], maxPadding[pos]);\n });\n return margin;\n }\n\n return horizontal ? marginForPositions(['left', 'right']) : marginForPositions(['top', 'bottom']);\n }\n\n function fitBoxes(boxes, chartArea, params) {\n var refitBoxes = [];\n var i, ilen, layout, box, refit, changed;\n\n for (i = 0, ilen = boxes.length; i < ilen; ++i) {\n layout = boxes[i];\n box = layout.box;\n box.update(layout.width || chartArea.w, layout.height || chartArea.h, getMargins(layout.horizontal, chartArea));\n\n if (updateDims(chartArea, params, layout)) {\n changed = true;\n\n if (refitBoxes.length) {\n // Dimensions changed and there were non full width boxes before this\n // -> we have to refit those\n refit = true;\n }\n }\n\n if (!box.fullWidth) {\n // fullWidth boxes don't need to be re-fitted in any case\n refitBoxes.push(layout);\n }\n }\n\n return refit ? fitBoxes(refitBoxes, chartArea, params) || changed : changed;\n }\n\n function placeBoxes(boxes, chartArea, params) {\n var userPadding = params.padding;\n var x = chartArea.x;\n var y = chartArea.y;\n var i, ilen, layout, box;\n\n for (i = 0, ilen = boxes.length; i < ilen; ++i) {\n layout = boxes[i];\n box = layout.box;\n\n if (layout.horizontal) {\n box.left = box.fullWidth ? userPadding.left : chartArea.left;\n box.right = box.fullWidth ? params.outerWidth - userPadding.right : chartArea.left + chartArea.w;\n box.top = y;\n box.bottom = y + box.height;\n box.width = box.right - box.left;\n y = box.bottom;\n } else {\n box.left = x;\n box.right = x + box.width;\n box.top = chartArea.top;\n box.bottom = chartArea.top + chartArea.h;\n box.height = box.bottom - box.top;\n x = box.right;\n }\n }\n\n chartArea.x = x;\n chartArea.y = y;\n }\n\n core_defaults._set('global', {\n layout: {\n padding: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n }\n }\n });\n /**\r\n * @interface ILayoutItem\r\n * @prop {string} position - The position of the item in the chart layout. Possible values are\r\n * 'left', 'top', 'right', 'bottom', and 'chartArea'\r\n * @prop {number} weight - The weight used to sort the item. Higher weights are further away from the chart area\r\n * @prop {boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down\r\n * @prop {function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)\r\n * @prop {function} update - Takes two parameters: width and height. Returns size of item\r\n * @prop {function} getPadding - Returns an object with padding on the edges\r\n * @prop {number} width - Width of item. Must be valid after update()\r\n * @prop {number} height - Height of item. Must be valid after update()\r\n * @prop {number} left - Left edge of the item. Set by layout system and cannot be used in update\r\n * @prop {number} top - Top edge of the item. Set by layout system and cannot be used in update\r\n * @prop {number} right - Right edge of the item. Set by layout system and cannot be used in update\r\n * @prop {number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update\r\n */\n // The layout service is very self explanatory. It's responsible for the layout within a chart.\n // Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need\n // It is this service's responsibility of carrying out that layout.\n\n\n var core_layouts = {\n defaults: {},\n\n /**\r\n * Register a box to a chart.\r\n * A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.\r\n * @param {Chart} chart - the chart to use\r\n * @param {ILayoutItem} item - the item to add to be layed out\r\n */\n addBox: function addBox(chart, item) {\n if (!chart.boxes) {\n chart.boxes = [];\n } // initialize item with default values\n\n\n item.fullWidth = item.fullWidth || false;\n item.position = item.position || 'top';\n item.weight = item.weight || 0;\n\n item._layers = item._layers || function () {\n return [{\n z: 0,\n draw: function draw() {\n item.draw.apply(item, arguments);\n }\n }];\n };\n\n chart.boxes.push(item);\n },\n\n /**\r\n * Remove a layoutItem from a chart\r\n * @param {Chart} chart - the chart to remove the box from\r\n * @param {ILayoutItem} layoutItem - the item to remove from the layout\r\n */\n removeBox: function removeBox(chart, layoutItem) {\n var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;\n\n if (index !== -1) {\n chart.boxes.splice(index, 1);\n }\n },\n\n /**\r\n * Sets (or updates) options on the given `item`.\r\n * @param {Chart} chart - the chart in which the item lives (or will be added to)\r\n * @param {ILayoutItem} item - the item to configure with the given options\r\n * @param {object} options - the new item options.\r\n */\n configure: function configure(chart, item, options) {\n var props = ['fullWidth', 'position', 'weight'];\n var ilen = props.length;\n var i = 0;\n var prop;\n\n for (; i < ilen; ++i) {\n prop = props[i];\n\n if (options.hasOwnProperty(prop)) {\n item[prop] = options[prop];\n }\n }\n },\n\n /**\r\n * Fits boxes of the given chart into the given size by having each box measure itself\r\n * then running a fitting algorithm\r\n * @param {Chart} chart - the chart\r\n * @param {number} width - the width to fit into\r\n * @param {number} height - the height to fit into\r\n */\n update: function update(chart, width, height) {\n if (!chart) {\n return;\n }\n\n var layoutOptions = chart.options.layout || {};\n var padding = helpers$1.options.toPadding(layoutOptions.padding);\n var availableWidth = width - padding.width;\n var availableHeight = height - padding.height;\n var boxes = buildLayoutBoxes(chart.boxes);\n var verticalBoxes = boxes.vertical;\n var horizontalBoxes = boxes.horizontal; // Essentially we now have any number of boxes on each of the 4 sides.\n // Our canvas looks like the following.\n // The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and\n // B1 is the bottom axis\n // There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays\n // These locations are single-box locations only, when trying to register a chartArea location that is already taken,\n // an error will be thrown.\n //\n // |----------------------------------------------------|\n // | T1 (Full Width) |\n // |----------------------------------------------------|\n // | | | T2 | |\n // | |----|-------------------------------------|----|\n // | | | C1 | | C2 | |\n // | | |----| |----| |\n // | | | | |\n // | L1 | L2 | ChartArea (C0) | R1 |\n // | | | | |\n // | | |----| |----| |\n // | | | C3 | | C4 | |\n // | |----|-------------------------------------|----|\n // | | | B1 | |\n // |----------------------------------------------------|\n // | B2 (Full Width) |\n // |----------------------------------------------------|\n //\n\n var params = Object.freeze({\n outerWidth: width,\n outerHeight: height,\n padding: padding,\n availableWidth: availableWidth,\n vBoxMaxWidth: availableWidth / 2 / verticalBoxes.length,\n hBoxMaxHeight: availableHeight / 2\n });\n var chartArea = extend({\n maxPadding: extend({}, padding),\n w: availableWidth,\n h: availableHeight,\n x: padding.left,\n y: padding.top\n }, padding);\n setLayoutDims(verticalBoxes.concat(horizontalBoxes), params); // First fit vertical boxes\n\n fitBoxes(verticalBoxes, chartArea, params); // Then fit horizontal boxes\n\n if (fitBoxes(horizontalBoxes, chartArea, params)) {\n // if the area changed, re-fit vertical boxes\n fitBoxes(verticalBoxes, chartArea, params);\n }\n\n handleMaxPadding(chartArea); // Finally place the boxes to correct coordinates\n\n placeBoxes(boxes.leftAndTop, chartArea, params); // Move to opposite side of chart\n\n chartArea.x += chartArea.w;\n chartArea.y += chartArea.h;\n placeBoxes(boxes.rightAndBottom, chartArea, params);\n chart.chartArea = {\n left: chartArea.left,\n top: chartArea.top,\n right: chartArea.left + chartArea.w,\n bottom: chartArea.top + chartArea.h\n }; // Finally update boxes in chartArea (radial scale for example)\n\n helpers$1.each(boxes.chartArea, function (layout) {\n var box = layout.box;\n extend(box, chart.chartArea);\n box.update(chartArea.w, chartArea.h);\n });\n }\n };\n /**\r\n * Platform fallback implementation (minimal).\r\n * @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939\r\n */\n\n var platform_basic = {\n acquireContext: function acquireContext(item) {\n if (item && item.canvas) {\n // Support for any object associated to a canvas (including a context2d)\n item = item.canvas;\n }\n\n return item && item.getContext('2d') || null;\n }\n };\n var platform_dom = \"/*\\r\\n * DOM element rendering detection\\r\\n * https://davidwalsh.name/detect-node-insertion\\r\\n */\\r\\n@keyframes chartjs-render-animation {\\r\\n\\tfrom { opacity: 0.99; }\\r\\n\\tto { opacity: 1; }\\r\\n}\\r\\n\\r\\n.chartjs-render-monitor {\\r\\n\\tanimation: chartjs-render-animation 0.001s;\\r\\n}\\r\\n\\r\\n/*\\r\\n * DOM element resizing detection\\r\\n * https://github.com/marcj/css-element-queries\\r\\n */\\r\\n.chartjs-size-monitor,\\r\\n.chartjs-size-monitor-expand,\\r\\n.chartjs-size-monitor-shrink {\\r\\n\\tposition: absolute;\\r\\n\\tdirection: ltr;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n\\tright: 0;\\r\\n\\tbottom: 0;\\r\\n\\toverflow: hidden;\\r\\n\\tpointer-events: none;\\r\\n\\tvisibility: hidden;\\r\\n\\tz-index: -1;\\r\\n}\\r\\n\\r\\n.chartjs-size-monitor-expand > div {\\r\\n\\tposition: absolute;\\r\\n\\twidth: 1000000px;\\r\\n\\theight: 1000000px;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n}\\r\\n\\r\\n.chartjs-size-monitor-shrink > div {\\r\\n\\tposition: absolute;\\r\\n\\twidth: 200%;\\r\\n\\theight: 200%;\\r\\n\\tleft: 0;\\r\\n\\ttop: 0;\\r\\n}\\r\\n\";\n var platform_dom$1 = /*#__PURE__*/Object.freeze({\n __proto__: null,\n 'default': platform_dom\n });\n var stylesheet = getCjsExportFromNamespace(platform_dom$1);\n var EXPANDO_KEY = '$chartjs';\n var CSS_PREFIX = 'chartjs-';\n var CSS_SIZE_MONITOR = CSS_PREFIX + 'size-monitor';\n var CSS_RENDER_MONITOR = CSS_PREFIX + 'render-monitor';\n var CSS_RENDER_ANIMATION = CSS_PREFIX + 'render-animation';\n var ANIMATION_START_EVENTS = ['animationstart', 'webkitAnimationStart'];\n /**\r\n * DOM event types -> Chart.js event types.\r\n * Note: only events with different types are mapped.\r\n * @see https://developer.mozilla.org/en-US/docs/Web/Events\r\n */\n\n var EVENT_TYPES = {\n touchstart: 'mousedown',\n touchmove: 'mousemove',\n touchend: 'mouseup',\n pointerenter: 'mouseenter',\n pointerdown: 'mousedown',\n pointermove: 'mousemove',\n pointerup: 'mouseup',\n pointerleave: 'mouseout',\n pointerout: 'mouseout'\n };\n /**\r\n * The \"used\" size is the final value of a dimension property after all calculations have\r\n * been performed. This method uses the computed style of `element` but returns undefined\r\n * if the computed style is not expressed in pixels. That can happen in some cases where\r\n * `element` has a size relative to its parent and this last one is not yet displayed,\r\n * for example because of `display: none` on a parent node.\r\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value\r\n * @returns {number} Size in pixels or undefined if unknown.\r\n */\n\n function readUsedSize(element, property) {\n var value = helpers$1.getStyle(element, property);\n var matches = value && value.match(/^(\\d+)(\\.\\d+)?px$/);\n return matches ? Number(matches[1]) : undefined;\n }\n /**\r\n * Initializes the canvas style and render size without modifying the canvas display size,\r\n * since responsiveness is handled by the controller.resize() method. The config is used\r\n * to determine the aspect ratio to apply in case no explicit height has been specified.\r\n */\n\n\n function initCanvas(canvas, config) {\n var style = canvas.style; // NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it\n // returns null or '' if no explicit value has been set to the canvas attribute.\n\n var renderHeight = canvas.getAttribute('height');\n var renderWidth = canvas.getAttribute('width'); // Chart.js modifies some canvas values that we want to restore on destroy\n\n canvas[EXPANDO_KEY] = {\n initial: {\n height: renderHeight,\n width: renderWidth,\n style: {\n display: style.display,\n height: style.height,\n width: style.width\n }\n }\n }; // Force canvas to display as block to avoid extra space caused by inline\n // elements, which would interfere with the responsive resize process.\n // https://github.com/chartjs/Chart.js/issues/2538\n\n style.display = style.display || 'block';\n\n if (renderWidth === null || renderWidth === '') {\n var displayWidth = readUsedSize(canvas, 'width');\n\n if (displayWidth !== undefined) {\n canvas.width = displayWidth;\n }\n }\n\n if (renderHeight === null || renderHeight === '') {\n if (canvas.style.height === '') {\n // If no explicit render height and style height, let's apply the aspect ratio,\n // which one can be specified by the user but also by charts as default option\n // (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2.\n canvas.height = canvas.width / (config.options.aspectRatio || 2);\n } else {\n var displayHeight = readUsedSize(canvas, 'height');\n\n if (displayWidth !== undefined) {\n canvas.height = displayHeight;\n }\n }\n }\n\n return canvas;\n }\n /**\r\n * Detects support for options object argument in addEventListener.\r\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support\r\n * @private\r\n */\n\n\n var supportsEventListenerOptions = function () {\n var supports = false;\n\n try {\n var options = Object.defineProperty({}, 'passive', {\n // eslint-disable-next-line getter-return\n get: function get() {\n supports = true;\n }\n });\n window.addEventListener('e', null, options);\n } catch (e) {// continue regardless of error\n }\n\n return supports;\n }(); // Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.\n // https://github.com/chartjs/Chart.js/issues/4287\n\n\n var eventListenerOptions = supportsEventListenerOptions ? {\n passive: true\n } : false;\n\n function addListener(node, type, listener) {\n node.addEventListener(type, listener, eventListenerOptions);\n }\n\n function removeListener(node, type, listener) {\n node.removeEventListener(type, listener, eventListenerOptions);\n }\n\n function createEvent(type, chart, x, y, nativeEvent) {\n return {\n type: type,\n chart: chart,\n native: nativeEvent || null,\n x: x !== undefined ? x : null,\n y: y !== undefined ? y : null\n };\n }\n\n function fromNativeEvent(event, chart) {\n var type = EVENT_TYPES[event.type] || event.type;\n var pos = helpers$1.getRelativePosition(event, chart);\n return createEvent(type, chart, pos.x, pos.y, event);\n }\n\n function throttled(fn, thisArg) {\n var ticking = false;\n var args = [];\n return function () {\n args = Array.prototype.slice.call(arguments);\n thisArg = thisArg || this;\n\n if (!ticking) {\n ticking = true;\n helpers$1.requestAnimFrame.call(window, function () {\n ticking = false;\n fn.apply(thisArg, args);\n });\n }\n };\n }\n\n function createDiv(cls) {\n var el = document.createElement('div');\n el.className = cls || '';\n return el;\n } // Implementation based on https://github.com/marcj/css-element-queries\n\n\n function createResizer(handler) {\n var maxSize = 1000000; // NOTE(SB) Don't use innerHTML because it could be considered unsafe.\n // https://github.com/chartjs/Chart.js/issues/5902\n\n var resizer = createDiv(CSS_SIZE_MONITOR);\n var expand = createDiv(CSS_SIZE_MONITOR + '-expand');\n var shrink = createDiv(CSS_SIZE_MONITOR + '-shrink');\n expand.appendChild(createDiv());\n shrink.appendChild(createDiv());\n resizer.appendChild(expand);\n resizer.appendChild(shrink);\n\n resizer._reset = function () {\n expand.scrollLeft = maxSize;\n expand.scrollTop = maxSize;\n shrink.scrollLeft = maxSize;\n shrink.scrollTop = maxSize;\n };\n\n var onScroll = function onScroll() {\n resizer._reset();\n\n handler();\n };\n\n addListener(expand, 'scroll', onScroll.bind(expand, 'expand'));\n addListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));\n return resizer;\n } // https://davidwalsh.name/detect-node-insertion\n\n\n function watchForRender(node, handler) {\n var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});\n\n var proxy = expando.renderProxy = function (e) {\n if (e.animationName === CSS_RENDER_ANIMATION) {\n handler();\n }\n };\n\n helpers$1.each(ANIMATION_START_EVENTS, function (type) {\n addListener(node, type, proxy);\n }); // #4737: Chrome might skip the CSS animation when the CSS_RENDER_MONITOR class\n // is removed then added back immediately (same animation frame?). Accessing the\n // `offsetParent` property will force a reflow and re-evaluate the CSS animation.\n // https://gist.github.com/paulirish/5d52fb081b3570c81e3a#box-metrics\n // https://github.com/chartjs/Chart.js/issues/4737\n\n expando.reflow = !!node.offsetParent;\n node.classList.add(CSS_RENDER_MONITOR);\n }\n\n function unwatchForRender(node) {\n var expando = node[EXPANDO_KEY] || {};\n var proxy = expando.renderProxy;\n\n if (proxy) {\n helpers$1.each(ANIMATION_START_EVENTS, function (type) {\n removeListener(node, type, proxy);\n });\n delete expando.renderProxy;\n }\n\n node.classList.remove(CSS_RENDER_MONITOR);\n }\n\n function addResizeListener(node, listener, chart) {\n var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {}); // Let's keep track of this added resizer and thus avoid DOM query when removing it.\n\n var resizer = expando.resizer = createResizer(throttled(function () {\n if (expando.resizer) {\n var container = chart.options.maintainAspectRatio && node.parentNode;\n var w = container ? container.clientWidth : 0;\n listener(createEvent('resize', chart));\n\n if (container && container.clientWidth < w && chart.canvas) {\n // If the container size shrank during chart resize, let's assume\n // scrollbar appeared. So we resize again with the scrollbar visible -\n // effectively making chart smaller and the scrollbar hidden again.\n // Because we are inside `throttled`, and currently `ticking`, scroll\n // events are ignored during this whole 2 resize process.\n // If we assumed wrong and something else happened, we are resizing\n // twice in a frame (potential performance issue)\n listener(createEvent('resize', chart));\n }\n }\n })); // The resizer needs to be attached to the node parent, so we first need to be\n // sure that `node` is attached to the DOM before injecting the resizer element.\n\n watchForRender(node, function () {\n if (expando.resizer) {\n var container = node.parentNode;\n\n if (container && container !== resizer.parentNode) {\n container.insertBefore(resizer, container.firstChild);\n } // The container size might have changed, let's reset the resizer state.\n\n\n resizer._reset();\n }\n });\n }\n\n function removeResizeListener(node) {\n var expando = node[EXPANDO_KEY] || {};\n var resizer = expando.resizer;\n delete expando.resizer;\n unwatchForRender(node);\n\n if (resizer && resizer.parentNode) {\n resizer.parentNode.removeChild(resizer);\n }\n }\n /**\r\n * Injects CSS styles inline if the styles are not already present.\r\n * @param {HTMLDocument|ShadowRoot} rootNode - the node to contain the \").appendTo(body);\n } // We need to make sure to grab the zIndex before setting the\n // opacity, because setting the opacity to anything lower than 1\n // causes the zIndex to change from \"auto\" to 0.\n\n\n if (o.zIndex) {\n // zIndex option\n if (this.helper.css(\"zIndex\")) {\n this._storedZIndex = this.helper.css(\"zIndex\");\n }\n\n this.helper.css(\"zIndex\", o.zIndex);\n }\n\n if (o.opacity) {\n // opacity option\n if (this.helper.css(\"opacity\")) {\n this._storedOpacity = this.helper.css(\"opacity\");\n }\n\n this.helper.css(\"opacity\", o.opacity);\n } //Prepare scrolling\n\n\n if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== \"HTML\") {\n this.overflowOffset = this.scrollParent.offset();\n } //Call callbacks\n\n\n this._trigger(\"start\", event, this._uiHash()); //Recache the helper size\n\n\n if (!this._preserveHelperProportions) {\n this._cacheHelperProportions();\n } //Post \"activate\" events to possible containers\n\n\n if (!noActivation) {\n for (i = this.containers.length - 1; i >= 0; i--) {\n this.containers[i]._trigger(\"activate\", event, this._uiHash(this));\n }\n } //Prepare possible droppables\n\n\n if ($.ui.ddmanager) {\n $.ui.ddmanager.current = this;\n }\n\n if ($.ui.ddmanager && !o.dropBehaviour) {\n $.ui.ddmanager.prepareOffsets(this, event);\n }\n\n this.dragging = true;\n\n this._addClass(this.helper, \"ui-sortable-helper\"); //Move the helper, if needed\n\n\n if (!this.helper.parent().is(this.appendTo)) {\n this.helper.detach().appendTo(this.appendTo); //Update position\n\n this.offset.parent = this._getParentOffset();\n } //Generate the original position\n\n\n this.position = this.originalPosition = this._generatePosition(event);\n this.originalPageX = event.pageX;\n this.originalPageY = event.pageY;\n this.lastPositionAbs = this.positionAbs = this._convertPositionTo(\"absolute\");\n\n this._mouseDrag(event);\n\n return true;\n },\n _scroll: function _scroll(event) {\n var o = this.options,\n scrolled = false;\n\n if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== \"HTML\") {\n if (this.overflowOffset.top + this.scrollParent[0].offsetHeight - event.pageY < o.scrollSensitivity) {\n this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;\n } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) {\n this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;\n }\n\n if (this.overflowOffset.left + this.scrollParent[0].offsetWidth - event.pageX < o.scrollSensitivity) {\n this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;\n } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) {\n this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;\n }\n } else {\n if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) {\n scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);\n } else if (this.window.height() - (event.pageY - this.document.scrollTop()) < o.scrollSensitivity) {\n scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);\n }\n\n if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {\n scrolled = this.document.scrollLeft(this.document.scrollLeft() - o.scrollSpeed);\n } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) < o.scrollSensitivity) {\n scrolled = this.document.scrollLeft(this.document.scrollLeft() + o.scrollSpeed);\n }\n }\n\n return scrolled;\n },\n _mouseDrag: function _mouseDrag(event) {\n var i,\n item,\n itemElement,\n intersection,\n o = this.options; //Compute the helpers position\n\n this.position = this._generatePosition(event);\n this.positionAbs = this._convertPositionTo(\"absolute\"); //Set the helper position\n\n if (!this.options.axis || this.options.axis !== \"y\") {\n this.helper[0].style.left = this.position.left + \"px\";\n }\n\n if (!this.options.axis || this.options.axis !== \"x\") {\n this.helper[0].style.top = this.position.top + \"px\";\n } //Do scrolling\n\n\n if (o.scroll) {\n if (this._scroll(event) !== false) {\n //Update item positions used in position checks\n this._refreshItemPositions(true);\n\n if ($.ui.ddmanager && !o.dropBehaviour) {\n $.ui.ddmanager.prepareOffsets(this, event);\n }\n }\n }\n\n this.dragDirection = {\n vertical: this._getDragVerticalDirection(),\n horizontal: this._getDragHorizontalDirection()\n }; //Rearrange\n\n for (i = this.items.length - 1; i >= 0; i--) {\n //Cache variables and intersection, continue if no intersection\n item = this.items[i];\n itemElement = item.item[0];\n intersection = this._intersectsWithPointer(item);\n\n if (!intersection) {\n continue;\n } // Only put the placeholder inside the current Container, skip all\n // items from other containers. This works because when moving\n // an item from one container to another the\n // currentContainer is switched before the placeholder is moved.\n //\n // Without this, moving items in \"sub-sortables\" can cause\n // the placeholder to jitter between the outer and inner container.\n\n\n if (item.instance !== this.currentContainer) {\n continue;\n } // Cannot intersect with itself\n // no useless actions that have been done before\n // no action if the item moved is the parent of the item checked\n\n\n if (itemElement !== this.currentItem[0] && this.placeholder[intersection === 1 ? \"next\" : \"prev\"]()[0] !== itemElement && !$.contains(this.placeholder[0], itemElement) && (this.options.type === \"semi-dynamic\" ? !$.contains(this.element[0], itemElement) : true)) {\n this.direction = intersection === 1 ? \"down\" : \"up\";\n\n if (this.options.tolerance === \"pointer\" || this._intersectsWithSides(item)) {\n this._rearrange(event, item);\n } else {\n break;\n }\n\n this._trigger(\"change\", event, this._uiHash());\n\n break;\n }\n } //Post events to containers\n\n\n this._contactContainers(event); //Interconnect with droppables\n\n\n if ($.ui.ddmanager) {\n $.ui.ddmanager.drag(this, event);\n } //Call callbacks\n\n\n this._trigger(\"sort\", event, this._uiHash());\n\n this.lastPositionAbs = this.positionAbs;\n return false;\n },\n _mouseStop: function _mouseStop(event, noPropagation) {\n if (!event) {\n return;\n } //If we are using droppables, inform the manager about the drop\n\n\n if ($.ui.ddmanager && !this.options.dropBehaviour) {\n $.ui.ddmanager.drop(this, event);\n }\n\n if (this.options.revert) {\n var that = this,\n cur = this.placeholder.offset(),\n axis = this.options.axis,\n animation = {};\n\n if (!axis || axis === \"x\") {\n animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft);\n }\n\n if (!axis || axis === \"y\") {\n animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop);\n }\n\n this.reverting = true;\n $(this.helper).animate(animation, parseInt(this.options.revert, 10) || 500, function () {\n that._clear(event);\n });\n } else {\n this._clear(event, noPropagation);\n }\n\n return false;\n },\n cancel: function cancel() {\n if (this.dragging) {\n this._mouseUp(new $.Event(\"mouseup\", {\n target: null\n }));\n\n if (this.options.helper === \"original\") {\n this.currentItem.css(this._storedCSS);\n\n this._removeClass(this.currentItem, \"ui-sortable-helper\");\n } else {\n this.currentItem.show();\n } //Post deactivating events to containers\n\n\n for (var i = this.containers.length - 1; i >= 0; i--) {\n this.containers[i]._trigger(\"deactivate\", null, this._uiHash(this));\n\n if (this.containers[i].containerCache.over) {\n this.containers[i]._trigger(\"out\", null, this._uiHash(this));\n\n this.containers[i].containerCache.over = 0;\n }\n }\n }\n\n if (this.placeholder) {\n //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,\n // it unbinds ALL events from the original node!\n if (this.placeholder[0].parentNode) {\n this.placeholder[0].parentNode.removeChild(this.placeholder[0]);\n }\n\n if (this.options.helper !== \"original\" && this.helper && this.helper[0].parentNode) {\n this.helper.remove();\n }\n\n $.extend(this, {\n helper: null,\n dragging: false,\n reverting: false,\n _noFinalSort: null\n });\n\n if (this.domPosition.prev) {\n $(this.domPosition.prev).after(this.currentItem);\n } else {\n $(this.domPosition.parent).prepend(this.currentItem);\n }\n }\n\n return this;\n },\n serialize: function serialize(o) {\n var items = this._getItemsAsjQuery(o && o.connected),\n str = [];\n\n o = o || {};\n $(items).each(function () {\n var res = ($(o.item || this).attr(o.attribute || \"id\") || \"\").match(o.expression || /(.+)[\\-=_](.+)/);\n\n if (res) {\n str.push((o.key || res[1] + \"[]\") + \"=\" + (o.key && o.expression ? res[1] : res[2]));\n }\n });\n\n if (!str.length && o.key) {\n str.push(o.key + \"=\");\n }\n\n return str.join(\"&\");\n },\n toArray: function toArray(o) {\n var items = this._getItemsAsjQuery(o && o.connected),\n ret = [];\n\n o = o || {};\n items.each(function () {\n ret.push($(o.item || this).attr(o.attribute || \"id\") || \"\");\n });\n return ret;\n },\n\n /* Be careful with the following core functions */\n _intersectsWith: function _intersectsWith(item) {\n var x1 = this.positionAbs.left,\n x2 = x1 + this.helperProportions.width,\n y1 = this.positionAbs.top,\n y2 = y1 + this.helperProportions.height,\n l = item.left,\n r = l + item.width,\n t = item.top,\n b = t + item.height,\n dyClick = this.offset.click.top,\n dxClick = this.offset.click.left,\n isOverElementHeight = this.options.axis === \"x\" || y1 + dyClick > t && y1 + dyClick < b,\n isOverElementWidth = this.options.axis === \"y\" || x1 + dxClick > l && x1 + dxClick < r,\n isOverElement = isOverElementHeight && isOverElementWidth;\n\n if (this.options.tolerance === \"pointer\" || this.options.forcePointerForContainers || this.options.tolerance !== \"pointer\" && this.helperProportions[this.floating ? \"width\" : \"height\"] > item[this.floating ? \"width\" : \"height\"]) {\n return isOverElement;\n } else {\n return l < x1 + this.helperProportions.width / 2 && // Right Half\n x2 - this.helperProportions.width / 2 < r && // Left Half\n t < y1 + this.helperProportions.height / 2 && // Bottom Half\n y2 - this.helperProportions.height / 2 < b; // Top Half\n }\n },\n _intersectsWithPointer: function _intersectsWithPointer(item) {\n var verticalDirection,\n horizontalDirection,\n isOverElementHeight = this.options.axis === \"x\" || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),\n isOverElementWidth = this.options.axis === \"y\" || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),\n isOverElement = isOverElementHeight && isOverElementWidth;\n\n if (!isOverElement) {\n return false;\n }\n\n verticalDirection = this.dragDirection.vertical;\n horizontalDirection = this.dragDirection.horizontal;\n return this.floating ? horizontalDirection === \"right\" || verticalDirection === \"down\" ? 2 : 1 : verticalDirection && (verticalDirection === \"down\" ? 2 : 1);\n },\n _intersectsWithSides: function _intersectsWithSides(item) {\n var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + item.height / 2, item.height),\n isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + item.width / 2, item.width),\n verticalDirection = this.dragDirection.vertical,\n horizontalDirection = this.dragDirection.horizontal;\n\n if (this.floating && horizontalDirection) {\n return horizontalDirection === \"right\" && isOverRightHalf || horizontalDirection === \"left\" && !isOverRightHalf;\n } else {\n return verticalDirection && (verticalDirection === \"down\" && isOverBottomHalf || verticalDirection === \"up\" && !isOverBottomHalf);\n }\n },\n _getDragVerticalDirection: function _getDragVerticalDirection() {\n var delta = this.positionAbs.top - this.lastPositionAbs.top;\n return delta !== 0 && (delta > 0 ? \"down\" : \"up\");\n },\n _getDragHorizontalDirection: function _getDragHorizontalDirection() {\n var delta = this.positionAbs.left - this.lastPositionAbs.left;\n return delta !== 0 && (delta > 0 ? \"right\" : \"left\");\n },\n refresh: function refresh(event) {\n this._refreshItems(event);\n\n this._setHandleClassName();\n\n this.refreshPositions();\n return this;\n },\n _connectWith: function _connectWith() {\n var options = this.options;\n return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith;\n },\n _getItemsAsjQuery: function _getItemsAsjQuery(connected) {\n var i,\n j,\n cur,\n inst,\n items = [],\n queries = [],\n connectWith = this._connectWith();\n\n if (connectWith && connected) {\n for (i = connectWith.length - 1; i >= 0; i--) {\n cur = $(connectWith[i], this.document[0]);\n\n for (j = cur.length - 1; j >= 0; j--) {\n inst = $.data(cur[j], this.widgetFullName);\n\n if (inst && inst !== this && !inst.options.disabled) {\n queries.push([typeof inst.options.items === \"function\" ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(\".ui-sortable-helper\").not(\".ui-sortable-placeholder\"), inst]);\n }\n }\n }\n }\n\n queries.push([typeof this.options.items === \"function\" ? this.options.items.call(this.element, null, {\n options: this.options,\n item: this.currentItem\n }) : $(this.options.items, this.element).not(\".ui-sortable-helper\").not(\".ui-sortable-placeholder\"), this]);\n\n function addItems() {\n items.push(this);\n }\n\n for (i = queries.length - 1; i >= 0; i--) {\n queries[i][0].each(addItems);\n }\n\n return $(items);\n },\n _removeCurrentsFromItems: function _removeCurrentsFromItems() {\n var list = this.currentItem.find(\":data(\" + this.widgetName + \"-item)\");\n this.items = $.grep(this.items, function (item) {\n for (var j = 0; j < list.length; j++) {\n if (list[j] === item.item[0]) {\n return false;\n }\n }\n\n return true;\n });\n },\n _refreshItems: function _refreshItems(event) {\n this.items = [];\n this.containers = [this];\n\n var i,\n j,\n cur,\n inst,\n targetData,\n _queries,\n item,\n queriesLength,\n items = this.items,\n queries = [[typeof this.options.items === \"function\" ? this.options.items.call(this.element[0], event, {\n item: this.currentItem\n }) : $(this.options.items, this.element), this]],\n connectWith = this._connectWith(); //Shouldn't be run the first time through due to massive slow-down\n\n\n if (connectWith && this.ready) {\n for (i = connectWith.length - 1; i >= 0; i--) {\n cur = $(connectWith[i], this.document[0]);\n\n for (j = cur.length - 1; j >= 0; j--) {\n inst = $.data(cur[j], this.widgetFullName);\n\n if (inst && inst !== this && !inst.options.disabled) {\n queries.push([typeof inst.options.items === \"function\" ? inst.options.items.call(inst.element[0], event, {\n item: this.currentItem\n }) : $(inst.options.items, inst.element), inst]);\n this.containers.push(inst);\n }\n }\n }\n }\n\n for (i = queries.length - 1; i >= 0; i--) {\n targetData = queries[i][1];\n _queries = queries[i][0];\n\n for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) {\n item = $(_queries[j]); // Data for target checking (mouse manager)\n\n item.data(this.widgetName + \"-item\", targetData);\n items.push({\n item: item,\n instance: targetData,\n width: 0,\n height: 0,\n left: 0,\n top: 0\n });\n }\n }\n },\n _refreshItemPositions: function _refreshItemPositions(fast) {\n var i, item, t, p;\n\n for (i = this.items.length - 1; i >= 0; i--) {\n item = this.items[i]; //We ignore calculating positions of all connected containers when we're not over them\n\n if (this.currentContainer && item.instance !== this.currentContainer && item.item[0] !== this.currentItem[0]) {\n continue;\n }\n\n t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;\n\n if (!fast) {\n item.width = t.outerWidth();\n item.height = t.outerHeight();\n }\n\n p = t.offset();\n item.left = p.left;\n item.top = p.top;\n }\n },\n refreshPositions: function refreshPositions(fast) {\n // Determine whether items are being displayed horizontally\n this.floating = this.items.length ? this.options.axis === \"x\" || this._isFloating(this.items[0].item) : false; // This has to be redone because due to the item being moved out/into the offsetParent,\n // the offsetParent's position will change\n\n if (this.offsetParent && this.helper) {\n this.offset.parent = this._getParentOffset();\n }\n\n this._refreshItemPositions(fast);\n\n var i, p;\n\n if (this.options.custom && this.options.custom.refreshContainers) {\n this.options.custom.refreshContainers.call(this);\n } else {\n for (i = this.containers.length - 1; i >= 0; i--) {\n p = this.containers[i].element.offset();\n this.containers[i].containerCache.left = p.left;\n this.containers[i].containerCache.top = p.top;\n this.containers[i].containerCache.width = this.containers[i].element.outerWidth();\n this.containers[i].containerCache.height = this.containers[i].element.outerHeight();\n }\n }\n\n return this;\n },\n _createPlaceholder: function _createPlaceholder(that) {\n that = that || this;\n var className,\n nodeName,\n o = that.options;\n\n if (!o.placeholder || o.placeholder.constructor === String) {\n className = o.placeholder;\n nodeName = that.currentItem[0].nodeName.toLowerCase();\n o.placeholder = {\n element: function element() {\n var element = $(\"<\" + nodeName + \">\", that.document[0]);\n\n that._addClass(element, \"ui-sortable-placeholder\", className || that.currentItem[0].className)._removeClass(element, \"ui-sortable-helper\");\n\n if (nodeName === \"tbody\") {\n that._createTrPlaceholder(that.currentItem.find(\"tr\").eq(0), $(\"\", that.document[0]).appendTo(element));\n } else if (nodeName === \"tr\") {\n that._createTrPlaceholder(that.currentItem, element);\n } else if (nodeName === \"img\") {\n element.attr(\"src\", that.currentItem.attr(\"src\"));\n }\n\n if (!className) {\n element.css(\"visibility\", \"hidden\");\n }\n\n return element;\n },\n update: function update(container, p) {\n // 1. If a className is set as 'placeholder option, we don't force sizes -\n // the class is responsible for that\n // 2. The option 'forcePlaceholderSize can be enabled to force it even if a\n // class name is specified\n if (className && !o.forcePlaceholderSize) {\n return;\n } // If the element doesn't have a actual height or width by itself (without\n // styles coming from a stylesheet), it receives the inline height and width\n // from the dragged item. Or, if it's a tbody or tr, it's going to have a height\n // anyway since we're populating them with s above, but they're unlikely to\n // be the correct height on their own if the row heights are dynamic, so we'll\n // always assign the height of the dragged item given forcePlaceholderSize\n // is true.\n\n\n if (!p.height() || o.forcePlaceholderSize && (nodeName === \"tbody\" || nodeName === \"tr\")) {\n p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css(\"paddingTop\") || 0, 10) - parseInt(that.currentItem.css(\"paddingBottom\") || 0, 10));\n }\n\n if (!p.width()) {\n p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css(\"paddingLeft\") || 0, 10) - parseInt(that.currentItem.css(\"paddingRight\") || 0, 10));\n }\n }\n };\n } //Create the placeholder\n\n\n that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); //Append it after the actual current item\n\n that.currentItem.after(that.placeholder); //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)\n\n o.placeholder.update(that, that.placeholder);\n },\n _createTrPlaceholder: function _createTrPlaceholder(sourceTr, targetTr) {\n var that = this;\n sourceTr.children().each(function () {\n $(\" \", that.document[0]).attr(\"colspan\", $(this).attr(\"colspan\") || 1).appendTo(targetTr);\n });\n },\n _contactContainers: function _contactContainers(event) {\n var i,\n j,\n dist,\n itemWithLeastDistance,\n posProperty,\n sizeProperty,\n cur,\n nearBottom,\n floating,\n axis,\n innermostContainer = null,\n innermostIndex = null; // Get innermost container that intersects with item\n\n for (i = this.containers.length - 1; i >= 0; i--) {\n // Never consider a container that's located within the item itself\n if ($.contains(this.currentItem[0], this.containers[i].element[0])) {\n continue;\n }\n\n if (this._intersectsWith(this.containers[i].containerCache)) {\n // If we've already found a container and it's more \"inner\" than this, then continue\n if (innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) {\n continue;\n }\n\n innermostContainer = this.containers[i];\n innermostIndex = i;\n } else {\n // container doesn't intersect. trigger \"out\" event if necessary\n if (this.containers[i].containerCache.over) {\n this.containers[i]._trigger(\"out\", event, this._uiHash(this));\n\n this.containers[i].containerCache.over = 0;\n }\n }\n } // If no intersecting containers found, return\n\n\n if (!innermostContainer) {\n return;\n } // Move the item into the container if it's not there already\n\n\n if (this.containers.length === 1) {\n if (!this.containers[innermostIndex].containerCache.over) {\n this.containers[innermostIndex]._trigger(\"over\", event, this._uiHash(this));\n\n this.containers[innermostIndex].containerCache.over = 1;\n }\n } else {\n // When entering a new container, we will find the item with the least distance and\n // append our item near it\n dist = 10000;\n itemWithLeastDistance = null;\n floating = innermostContainer.floating || this._isFloating(this.currentItem);\n posProperty = floating ? \"left\" : \"top\";\n sizeProperty = floating ? \"width\" : \"height\";\n axis = floating ? \"pageX\" : \"pageY\";\n\n for (j = this.items.length - 1; j >= 0; j--) {\n if (!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {\n continue;\n }\n\n if (this.items[j].item[0] === this.currentItem[0]) {\n continue;\n }\n\n cur = this.items[j].item.offset()[posProperty];\n nearBottom = false;\n\n if (event[axis] - cur > this.items[j][sizeProperty] / 2) {\n nearBottom = true;\n }\n\n if (Math.abs(event[axis] - cur) < dist) {\n dist = Math.abs(event[axis] - cur);\n itemWithLeastDistance = this.items[j];\n this.direction = nearBottom ? \"up\" : \"down\";\n }\n } //Check if dropOnEmpty is enabled\n\n\n if (!itemWithLeastDistance && !this.options.dropOnEmpty) {\n return;\n }\n\n if (this.currentContainer === this.containers[innermostIndex]) {\n if (!this.currentContainer.containerCache.over) {\n this.containers[innermostIndex]._trigger(\"over\", event, this._uiHash());\n\n this.currentContainer.containerCache.over = 1;\n }\n\n return;\n }\n\n if (itemWithLeastDistance) {\n this._rearrange(event, itemWithLeastDistance, null, true);\n } else {\n this._rearrange(event, null, this.containers[innermostIndex].element, true);\n }\n\n this._trigger(\"change\", event, this._uiHash());\n\n this.containers[innermostIndex]._trigger(\"change\", event, this._uiHash(this));\n\n this.currentContainer = this.containers[innermostIndex]; //Update the placeholder\n\n this.options.placeholder.update(this.currentContainer, this.placeholder); //Update scrollParent\n\n this.scrollParent = this.placeholder.scrollParent(); //Update overflowOffset\n\n if (this.scrollParent[0] !== this.document[0] && this.scrollParent[0].tagName !== \"HTML\") {\n this.overflowOffset = this.scrollParent.offset();\n }\n\n this.containers[innermostIndex]._trigger(\"over\", event, this._uiHash(this));\n\n this.containers[innermostIndex].containerCache.over = 1;\n }\n },\n _createHelper: function _createHelper(event) {\n var o = this.options,\n helper = typeof o.helper === \"function\" ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : o.helper === \"clone\" ? this.currentItem.clone() : this.currentItem; //Add the helper to the DOM if that didn't happen already\n\n if (!helper.parents(\"body\").length) {\n this.appendTo[0].appendChild(helper[0]);\n }\n\n if (helper[0] === this.currentItem[0]) {\n this._storedCSS = {\n width: this.currentItem[0].style.width,\n height: this.currentItem[0].style.height,\n position: this.currentItem.css(\"position\"),\n top: this.currentItem.css(\"top\"),\n left: this.currentItem.css(\"left\")\n };\n }\n\n if (!helper[0].style.width || o.forceHelperSize) {\n helper.width(this.currentItem.width());\n }\n\n if (!helper[0].style.height || o.forceHelperSize) {\n helper.height(this.currentItem.height());\n }\n\n return helper;\n },\n _adjustOffsetFromHelper: function _adjustOffsetFromHelper(obj) {\n if (typeof obj === \"string\") {\n obj = obj.split(\" \");\n }\n\n if (Array.isArray(obj)) {\n obj = {\n left: +obj[0],\n top: +obj[1] || 0\n };\n }\n\n if (\"left\" in obj) {\n this.offset.click.left = obj.left + this.margins.left;\n }\n\n if (\"right\" in obj) {\n this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;\n }\n\n if (\"top\" in obj) {\n this.offset.click.top = obj.top + this.margins.top;\n }\n\n if (\"bottom\" in obj) {\n this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;\n }\n },\n _getParentOffset: function _getParentOffset() {\n //Get the offsetParent and cache its position\n this.offsetParent = this.helper.offsetParent();\n var po = this.offsetParent.offset(); // This is a special case where we need to modify a offset calculated on start, since the\n // following happened:\n // 1. The position of the helper is absolute, so it's position is calculated based on the\n // next positioned parent\n // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't\n // the document, which means that the scroll is included in the initial calculation of the\n // offset of the parent, and never recalculated upon drag\n\n if (this.cssPosition === \"absolute\" && this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) {\n po.left += this.scrollParent.scrollLeft();\n po.top += this.scrollParent.scrollTop();\n } // This needs to be actually done for all browsers, since pageX/pageY includes this\n // information with an ugly IE fix\n\n\n if (this.offsetParent[0] === this.document[0].body || this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === \"html\" && $.ui.ie) {\n po = {\n top: 0,\n left: 0\n };\n }\n\n return {\n top: po.top + (parseInt(this.offsetParent.css(\"borderTopWidth\"), 10) || 0),\n left: po.left + (parseInt(this.offsetParent.css(\"borderLeftWidth\"), 10) || 0)\n };\n },\n _getRelativeOffset: function _getRelativeOffset() {\n if (this.cssPosition === \"relative\") {\n var p = this.currentItem.position();\n return {\n top: p.top - (parseInt(this.helper.css(\"top\"), 10) || 0) + this.scrollParent.scrollTop(),\n left: p.left - (parseInt(this.helper.css(\"left\"), 10) || 0) + this.scrollParent.scrollLeft()\n };\n } else {\n return {\n top: 0,\n left: 0\n };\n }\n },\n _cacheMargins: function _cacheMargins() {\n this.margins = {\n left: parseInt(this.currentItem.css(\"marginLeft\"), 10) || 0,\n top: parseInt(this.currentItem.css(\"marginTop\"), 10) || 0\n };\n },\n _cacheHelperProportions: function _cacheHelperProportions() {\n this.helperProportions = {\n width: this.helper.outerWidth(),\n height: this.helper.outerHeight()\n };\n },\n _setContainment: function _setContainment() {\n var ce,\n co,\n over,\n o = this.options;\n\n if (o.containment === \"parent\") {\n o.containment = this.helper[0].parentNode;\n }\n\n if (o.containment === \"document\" || o.containment === \"window\") {\n this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, o.containment === \"document\" ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left, (o.containment === \"document\" ? this.document.height() || document.body.parentNode.scrollHeight : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top];\n }\n\n if (!/^(document|window|parent)$/.test(o.containment)) {\n ce = $(o.containment)[0];\n co = $(o.containment).offset();\n over = $(ce).css(\"overflow\") !== \"hidden\";\n this.containment = [co.left + (parseInt($(ce).css(\"borderLeftWidth\"), 10) || 0) + (parseInt($(ce).css(\"paddingLeft\"), 10) || 0) - this.margins.left, co.top + (parseInt($(ce).css(\"borderTopWidth\"), 10) || 0) + (parseInt($(ce).css(\"paddingTop\"), 10) || 0) - this.margins.top, co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css(\"borderLeftWidth\"), 10) || 0) - (parseInt($(ce).css(\"paddingRight\"), 10) || 0) - this.helperProportions.width - this.margins.left, co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css(\"borderTopWidth\"), 10) || 0) - (parseInt($(ce).css(\"paddingBottom\"), 10) || 0) - this.helperProportions.height - this.margins.top];\n }\n },\n _convertPositionTo: function _convertPositionTo(d, pos) {\n if (!pos) {\n pos = this.position;\n }\n\n var mod = d === \"absolute\" ? 1 : -1,\n scroll = this.cssPosition === \"absolute\" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,\n scrollIsRootNode = /(html|body)/i.test(scroll[0].tagName);\n return {\n top: // The absolute mouse position\n pos.top + // Only for relative positioned nodes: Relative offset from element to offset parent\n this.offset.relative.top * mod + // The offsetParent's offset without borders (offset + border)\n this.offset.parent.top * mod - (this.cssPosition === \"fixed\" ? -this.scrollParent.scrollTop() : scrollIsRootNode ? 0 : scroll.scrollTop()) * mod,\n left: // The absolute mouse position\n pos.left + // Only for relative positioned nodes: Relative offset from element to offset parent\n this.offset.relative.left * mod + // The offsetParent's offset without borders (offset + border)\n this.offset.parent.left * mod - (this.cssPosition === \"fixed\" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft()) * mod\n };\n },\n _generatePosition: function _generatePosition(event) {\n var top,\n left,\n o = this.options,\n pageX = event.pageX,\n pageY = event.pageY,\n scroll = this.cssPosition === \"absolute\" && !(this.scrollParent[0] !== this.document[0] && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,\n scrollIsRootNode = /(html|body)/i.test(scroll[0].tagName); // This is another very weird special case that only happens for relative elements:\n // 1. If the css position is relative\n // 2. and the scroll parent is the document or similar to the offset parent\n // we have to refresh the relative offset during the scroll so there are no jumps\n\n if (this.cssPosition === \"relative\" && !(this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0])) {\n this.offset.relative = this._getRelativeOffset();\n }\n /*\n * - Position constraining -\n * Constrain the position to a mix of grid, containment.\n */\n\n\n if (this.originalPosition) {\n //If we are not dragging yet, we won't check for options\n if (this.containment) {\n if (event.pageX - this.offset.click.left < this.containment[0]) {\n pageX = this.containment[0] + this.offset.click.left;\n }\n\n if (event.pageY - this.offset.click.top < this.containment[1]) {\n pageY = this.containment[1] + this.offset.click.top;\n }\n\n if (event.pageX - this.offset.click.left > this.containment[2]) {\n pageX = this.containment[2] + this.offset.click.left;\n }\n\n if (event.pageY - this.offset.click.top > this.containment[3]) {\n pageY = this.containment[3] + this.offset.click.top;\n }\n }\n\n if (o.grid) {\n top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];\n pageY = this.containment ? top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3] ? top : top - this.offset.click.top >= this.containment[1] ? top - o.grid[1] : top + o.grid[1] : top;\n left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];\n pageX = this.containment ? left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2] ? left : left - this.offset.click.left >= this.containment[0] ? left - o.grid[0] : left + o.grid[0] : left;\n }\n }\n\n return {\n top: // The absolute mouse position\n pageY - // Click offset (relative to the element)\n this.offset.click.top - // Only for relative positioned nodes: Relative offset from element to offset parent\n this.offset.relative.top - // The offsetParent's offset without borders (offset + border)\n this.offset.parent.top + (this.cssPosition === \"fixed\" ? -this.scrollParent.scrollTop() : scrollIsRootNode ? 0 : scroll.scrollTop()),\n left: // The absolute mouse position\n pageX - // Click offset (relative to the element)\n this.offset.click.left - // Only for relative positioned nodes: Relative offset from element to offset parent\n this.offset.relative.left - // The offsetParent's offset without borders (offset + border)\n this.offset.parent.left + (this.cssPosition === \"fixed\" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft())\n };\n },\n _rearrange: function _rearrange(event, i, a, hardRefresh) {\n if (a) {\n a[0].appendChild(this.placeholder[0]);\n } else {\n i.item[0].parentNode.insertBefore(this.placeholder[0], this.direction === \"down\" ? i.item[0] : i.item[0].nextSibling);\n } //Various things done here to improve the performance:\n // 1. we create a setTimeout, that calls refreshPositions\n // 2. on the instance, we have a counter variable, that get's higher after every append\n // 3. on the local scope, we copy the counter variable, and check in the timeout,\n // if it's still the same\n // 4. this lets only the last addition to the timeout stack through\n\n\n this.counter = this.counter ? ++this.counter : 1;\n var counter = this.counter;\n\n this._delay(function () {\n if (counter === this.counter) {\n //Precompute after each DOM insertion, NOT on mousemove\n this.refreshPositions(!hardRefresh);\n }\n });\n },\n _clear: function _clear(event, noPropagation) {\n this.reverting = false; // We delay all events that have to be triggered to after the point where the placeholder\n // has been removed and everything else normalized again\n\n var i,\n delayedTriggers = []; // We first have to update the dom position of the actual currentItem\n // Note: don't do it if the current item is already removed (by a user), or it gets\n // reappended (see #4088)\n\n if (!this._noFinalSort && this.currentItem.parent().length) {\n this.placeholder.before(this.currentItem);\n }\n\n this._noFinalSort = null;\n\n if (this.helper[0] === this.currentItem[0]) {\n for (i in this._storedCSS) {\n if (this._storedCSS[i] === \"auto\" || this._storedCSS[i] === \"static\") {\n this._storedCSS[i] = \"\";\n }\n }\n\n this.currentItem.css(this._storedCSS);\n\n this._removeClass(this.currentItem, \"ui-sortable-helper\");\n } else {\n this.currentItem.show();\n }\n\n if (this.fromOutside && !noPropagation) {\n delayedTriggers.push(function (event) {\n this._trigger(\"receive\", event, this._uiHash(this.fromOutside));\n });\n }\n\n if ((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(\".ui-sortable-helper\")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {\n // Trigger update callback if the DOM position has changed\n delayedTriggers.push(function (event) {\n this._trigger(\"update\", event, this._uiHash());\n });\n } // Check if the items Container has Changed and trigger appropriate\n // events.\n\n\n if (this !== this.currentContainer) {\n if (!noPropagation) {\n delayedTriggers.push(function (event) {\n this._trigger(\"remove\", event, this._uiHash());\n });\n delayedTriggers.push(function (c) {\n return function (event) {\n c._trigger(\"receive\", event, this._uiHash(this));\n };\n }.call(this, this.currentContainer));\n delayedTriggers.push(function (c) {\n return function (event) {\n c._trigger(\"update\", event, this._uiHash(this));\n };\n }.call(this, this.currentContainer));\n }\n } //Post events to containers\n\n\n function delayEvent(type, instance, container) {\n return function (event) {\n container._trigger(type, event, instance._uiHash(instance));\n };\n }\n\n for (i = this.containers.length - 1; i >= 0; i--) {\n if (!noPropagation) {\n delayedTriggers.push(delayEvent(\"deactivate\", this, this.containers[i]));\n }\n\n if (this.containers[i].containerCache.over) {\n delayedTriggers.push(delayEvent(\"out\", this, this.containers[i]));\n this.containers[i].containerCache.over = 0;\n }\n } //Do what was originally in plugins\n\n\n if (this.storedCursor) {\n this.document.find(\"body\").css(\"cursor\", this.storedCursor);\n this.storedStylesheet.remove();\n }\n\n if (this._storedOpacity) {\n this.helper.css(\"opacity\", this._storedOpacity);\n }\n\n if (this._storedZIndex) {\n this.helper.css(\"zIndex\", this._storedZIndex === \"auto\" ? \"\" : this._storedZIndex);\n }\n\n this.dragging = false;\n\n if (!noPropagation) {\n this._trigger(\"beforeStop\", event, this._uiHash());\n } //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,\n // it unbinds ALL events from the original node!\n\n\n this.placeholder[0].parentNode.removeChild(this.placeholder[0]);\n\n if (!this.cancelHelperRemoval) {\n if (this.helper[0] !== this.currentItem[0]) {\n this.helper.remove();\n }\n\n this.helper = null;\n }\n\n if (!noPropagation) {\n for (i = 0; i < delayedTriggers.length; i++) {\n // Trigger all delayed events\n delayedTriggers[i].call(this, event);\n }\n\n this._trigger(\"stop\", event, this._uiHash());\n }\n\n this.fromOutside = false;\n return !this.cancelHelperRemoval;\n },\n _trigger: function _trigger() {\n if ($.Widget.prototype._trigger.apply(this, arguments) === false) {\n this.cancel();\n }\n },\n _uiHash: function _uiHash(_inst) {\n var inst = _inst || this;\n return {\n helper: inst.helper,\n placeholder: inst.placeholder || $([]),\n position: inst.position,\n originalPosition: inst.originalPosition,\n offset: inst.positionAbs,\n item: inst.currentItem,\n sender: _inst ? _inst.element : null\n };\n }\n });\n});","function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n/*!\n * jQuery JavaScript Library v3.6.0\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * Copyright OpenJS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2021-03-02T17:08Z\n */\n(function (global, factory) {\n \"use strict\";\n\n if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) === \"object\" && _typeof(module.exports) === \"object\") {\n // For CommonJS and CommonJS-like environments where a proper `window`\n // is present, execute the factory and get jQuery.\n // For environments that do not have a `window` with a `document`\n // (such as Node.js), expose a factory as module.exports.\n // This accentuates the need for the creation of a real `window`.\n // e.g. var jQuery = require(\"jquery\")(window);\n // See ticket #14549 for more info.\n module.exports = global.document ? factory(global, true) : function (w) {\n if (!w.document) {\n throw new Error(\"jQuery requires a window with a document\");\n }\n\n return factory(w);\n };\n } else {\n factory(global);\n } // Pass this if window is not defined yet\n\n})(typeof window !== \"undefined\" ? window : this, function (window, noGlobal) {\n // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n // enough that all such attempts are guarded in a try block.\n \"use strict\";\n\n var arr = [];\n var getProto = Object.getPrototypeOf;\n var _slice = arr.slice;\n var flat = arr.flat ? function (array) {\n return arr.flat.call(array);\n } : function (array) {\n return arr.concat.apply([], array);\n };\n var push = arr.push;\n var indexOf = arr.indexOf;\n var class2type = {};\n var toString = class2type.toString;\n var hasOwn = class2type.hasOwnProperty;\n var fnToString = hasOwn.toString;\n var ObjectFunctionString = fnToString.call(Object);\n var support = {};\n\n var isFunction = function isFunction(obj) {\n // Support: Chrome <=57, Firefox <=52\n // In some browsers, typeof returns \"function\" for HTML elements\n // (i.e., `typeof document.createElement( \"object\" ) === \"function\"`).\n // We don't want to classify *any* DOM node as a function.\n // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5\n // Plus for old WebKit, typeof returns \"function\" for HTML collections\n // (e.g., `typeof document.getElementsByTagName(\"div\") === \"function\"`). (gh-4756)\n return typeof obj === \"function\" && typeof obj.nodeType !== \"number\" && typeof obj.item !== \"function\";\n };\n\n var isWindow = function isWindow(obj) {\n return obj != null && obj === obj.window;\n };\n\n var document = window.document;\n var preservedScriptAttributes = {\n type: true,\n src: true,\n nonce: true,\n noModule: true\n };\n\n function DOMEval(code, node, doc) {\n doc = doc || document;\n var i,\n val,\n script = doc.createElement(\"script\");\n script.text = code;\n\n if (node) {\n for (i in preservedScriptAttributes) {\n // Support: Firefox 64+, Edge 18+\n // Some browsers don't support the \"nonce\" property on scripts.\n // On the other hand, just using `getAttribute` is not enough as\n // the `nonce` attribute is reset to an empty string whenever it\n // becomes browsing-context connected.\n // See https://github.com/whatwg/html/issues/2369\n // See https://html.spec.whatwg.org/#nonce-attributes\n // The `node.getAttribute` check was added for the sake of\n // `jQuery.globalEval` so that it can fake a nonce-containing node\n // via an object.\n val = node[i] || node.getAttribute && node.getAttribute(i);\n\n if (val) {\n script.setAttribute(i, val);\n }\n }\n }\n\n doc.head.appendChild(script).parentNode.removeChild(script);\n }\n\n function toType(obj) {\n if (obj == null) {\n return obj + \"\";\n } // Support: Android <=2.3 only (functionish RegExp)\n\n\n return _typeof(obj) === \"object\" || typeof obj === \"function\" ? class2type[toString.call(obj)] || \"object\" : _typeof(obj);\n }\n /* global Symbol */\n // Defining this global in .eslintrc.json would create a danger of using the global\n // unguarded in another place, it seems safer to define global only for this module\n\n\n var version = \"3.6.0\",\n // Define a local copy of jQuery\n jQuery = function jQuery(selector, context) {\n // The jQuery object is actually just the init constructor 'enhanced'\n // Need init if jQuery is called (just allow error to be thrown if not included)\n return new jQuery.fn.init(selector, context);\n };\n\n jQuery.fn = jQuery.prototype = {\n // The current version of jQuery being used\n jquery: version,\n constructor: jQuery,\n // The default length of a jQuery object is 0\n length: 0,\n toArray: function toArray() {\n return _slice.call(this);\n },\n // Get the Nth element in the matched element set OR\n // Get the whole matched element set as a clean array\n get: function get(num) {\n // Return all the elements in a clean array\n if (num == null) {\n return _slice.call(this);\n } // Return just the one element from the set\n\n\n return num < 0 ? this[num + this.length] : this[num];\n },\n // Take an array of elements and push it onto the stack\n // (returning the new matched element set)\n pushStack: function pushStack(elems) {\n // Build a new jQuery matched element set\n var ret = jQuery.merge(this.constructor(), elems); // Add the old object onto the stack (as a reference)\n\n ret.prevObject = this; // Return the newly-formed element set\n\n return ret;\n },\n // Execute a callback for every element in the matched set.\n each: function each(callback) {\n return jQuery.each(this, callback);\n },\n map: function map(callback) {\n return this.pushStack(jQuery.map(this, function (elem, i) {\n return callback.call(elem, i, elem);\n }));\n },\n slice: function slice() {\n return this.pushStack(_slice.apply(this, arguments));\n },\n first: function first() {\n return this.eq(0);\n },\n last: function last() {\n return this.eq(-1);\n },\n even: function even() {\n return this.pushStack(jQuery.grep(this, function (_elem, i) {\n return (i + 1) % 2;\n }));\n },\n odd: function odd() {\n return this.pushStack(jQuery.grep(this, function (_elem, i) {\n return i % 2;\n }));\n },\n eq: function eq(i) {\n var len = this.length,\n j = +i + (i < 0 ? len : 0);\n return this.pushStack(j >= 0 && j < len ? [this[j]] : []);\n },\n end: function end() {\n return this.prevObject || this.constructor();\n },\n // For internal use only.\n // Behaves like an Array's method, not like a jQuery method.\n push: push,\n sort: arr.sort,\n splice: arr.splice\n };\n\n jQuery.extend = jQuery.fn.extend = function () {\n var options,\n name,\n src,\n copy,\n copyIsArray,\n clone,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false; // Handle a deep copy situation\n\n if (typeof target === \"boolean\") {\n deep = target; // Skip the boolean and the target\n\n target = arguments[i] || {};\n i++;\n } // Handle case when target is a string or something (possible in deep copy)\n\n\n if (_typeof(target) !== \"object\" && !isFunction(target)) {\n target = {};\n } // Extend jQuery itself if only one argument is passed\n\n\n if (i === length) {\n target = this;\n i--;\n }\n\n for (; i < length; i++) {\n // Only deal with non-null/undefined values\n if ((options = arguments[i]) != null) {\n // Extend the base object\n for (name in options) {\n copy = options[name]; // Prevent Object.prototype pollution\n // Prevent never-ending loop\n\n if (name === \"__proto__\" || target === copy) {\n continue;\n } // Recurse if we're merging plain objects or arrays\n\n\n if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {\n src = target[name]; // Ensure proper type for the source value\n\n if (copyIsArray && !Array.isArray(src)) {\n clone = [];\n } else if (!copyIsArray && !jQuery.isPlainObject(src)) {\n clone = {};\n } else {\n clone = src;\n }\n\n copyIsArray = false; // Never move original objects, clone them\n\n target[name] = jQuery.extend(deep, clone, copy); // Don't bring in undefined values\n } else if (copy !== undefined) {\n target[name] = copy;\n }\n }\n }\n } // Return the modified object\n\n\n return target;\n };\n\n jQuery.extend({\n // Unique for each copy of jQuery on the page\n expando: \"jQuery\" + (version + Math.random()).replace(/\\D/g, \"\"),\n // Assume jQuery is ready without the ready module\n isReady: true,\n error: function error(msg) {\n throw new Error(msg);\n },\n noop: function noop() {},\n isPlainObject: function isPlainObject(obj) {\n var proto, Ctor; // Detect obvious negatives\n // Use toString instead of jQuery.type to catch host objects\n\n if (!obj || toString.call(obj) !== \"[object Object]\") {\n return false;\n }\n\n proto = getProto(obj); // Objects with no prototype (e.g., `Object.create( null )`) are plain\n\n if (!proto) {\n return true;\n } // Objects with prototype are plain iff they were constructed by a global Object function\n\n\n Ctor = hasOwn.call(proto, \"constructor\") && proto.constructor;\n return typeof Ctor === \"function\" && fnToString.call(Ctor) === ObjectFunctionString;\n },\n isEmptyObject: function isEmptyObject(obj) {\n var name;\n\n for (name in obj) {\n return false;\n }\n\n return true;\n },\n // Evaluates a script in a provided context; falls back to the global one\n // if not specified.\n globalEval: function globalEval(code, options, doc) {\n DOMEval(code, {\n nonce: options && options.nonce\n }, doc);\n },\n each: function each(obj, callback) {\n var length,\n i = 0;\n\n if (isArrayLike(obj)) {\n length = obj.length;\n\n for (; i < length; i++) {\n if (callback.call(obj[i], i, obj[i]) === false) {\n break;\n }\n }\n } else {\n for (i in obj) {\n if (callback.call(obj[i], i, obj[i]) === false) {\n break;\n }\n }\n }\n\n return obj;\n },\n // results is for internal usage only\n makeArray: function makeArray(arr, results) {\n var ret = results || [];\n\n if (arr != null) {\n if (isArrayLike(Object(arr))) {\n jQuery.merge(ret, typeof arr === \"string\" ? [arr] : arr);\n } else {\n push.call(ret, arr);\n }\n }\n\n return ret;\n },\n inArray: function inArray(elem, arr, i) {\n return arr == null ? -1 : indexOf.call(arr, elem, i);\n },\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n merge: function merge(first, second) {\n var len = +second.length,\n j = 0,\n i = first.length;\n\n for (; j < len; j++) {\n first[i++] = second[j];\n }\n\n first.length = i;\n return first;\n },\n grep: function grep(elems, callback, invert) {\n var callbackInverse,\n matches = [],\n i = 0,\n length = elems.length,\n callbackExpect = !invert; // Go through the array, only saving the items\n // that pass the validator function\n\n for (; i < length; i++) {\n callbackInverse = !callback(elems[i], i);\n\n if (callbackInverse !== callbackExpect) {\n matches.push(elems[i]);\n }\n }\n\n return matches;\n },\n // arg is for internal usage only\n map: function map(elems, callback, arg) {\n var length,\n value,\n i = 0,\n ret = []; // Go through the array, translating each of the items to their new values\n\n if (isArrayLike(elems)) {\n length = elems.length;\n\n for (; i < length; i++) {\n value = callback(elems[i], i, arg);\n\n if (value != null) {\n ret.push(value);\n }\n } // Go through every key on the object,\n\n } else {\n for (i in elems) {\n value = callback(elems[i], i, arg);\n\n if (value != null) {\n ret.push(value);\n }\n }\n } // Flatten any nested arrays\n\n\n return flat(ret);\n },\n // A global GUID counter for objects\n guid: 1,\n // jQuery.support is not used in Core but other projects attach their\n // properties to it so it needs to exist.\n support: support\n });\n\n if (typeof Symbol === \"function\") {\n jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];\n } // Populate the class2type map\n\n\n jQuery.each(\"Boolean Number String Function Array Date RegExp Object Error Symbol\".split(\" \"), function (_i, name) {\n class2type[\"[object \" + name + \"]\"] = name.toLowerCase();\n });\n\n function isArrayLike(obj) {\n // Support: real iOS 8.2 only (not reproducible in simulator)\n // `in` check used to prevent JIT error (gh-2145)\n // hasOwn isn't used here due to false negatives\n // regarding Nodelist length in IE\n var length = !!obj && \"length\" in obj && obj.length,\n type = toType(obj);\n\n if (isFunction(obj) || isWindow(obj)) {\n return false;\n }\n\n return type === \"array\" || length === 0 || typeof length === \"number\" && length > 0 && length - 1 in obj;\n }\n\n var Sizzle =\n /*!\n * Sizzle CSS Selector Engine v2.3.6\n * https://sizzlejs.com/\n *\n * Copyright JS Foundation and other contributors\n * Released under the MIT license\n * https://js.foundation/\n *\n * Date: 2021-02-16\n */\n function (window) {\n var i,\n support,\n Expr,\n getText,\n isXML,\n tokenize,\n compile,\n select,\n outermostContext,\n sortInput,\n hasDuplicate,\n // Local document vars\n setDocument,\n document,\n docElem,\n documentIsHTML,\n rbuggyQSA,\n rbuggyMatches,\n matches,\n contains,\n // Instance-specific data\n expando = \"sizzle\" + 1 * new Date(),\n preferredDoc = window.document,\n dirruns = 0,\n done = 0,\n classCache = createCache(),\n tokenCache = createCache(),\n compilerCache = createCache(),\n nonnativeSelectorCache = createCache(),\n sortOrder = function sortOrder(a, b) {\n if (a === b) {\n hasDuplicate = true;\n }\n\n return 0;\n },\n // Instance methods\n hasOwn = {}.hasOwnProperty,\n arr = [],\n pop = arr.pop,\n pushNative = arr.push,\n push = arr.push,\n slice = arr.slice,\n // Use a stripped-down indexOf as it's faster than native\n // https://jsperf.com/thor-indexof-vs-for/5\n indexOf = function indexOf(list, elem) {\n var i = 0,\n len = list.length;\n\n for (; i < len; i++) {\n if (list[i] === elem) {\n return i;\n }\n }\n\n return -1;\n },\n booleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|\" + \"ismap|loop|multiple|open|readonly|required|scoped\",\n // Regular expressions\n // http://www.w3.org/TR/css3-selectors/#whitespace\n whitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram\n identifier = \"(?:\\\\\\\\[\\\\da-fA-F]{1,6}\" + whitespace + \"?|\\\\\\\\[^\\\\r\\\\n\\\\f]|[\\\\w-]|[^\\0-\\\\x7f])+\",\n // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors\n attributes = \"\\\\[\" + whitespace + \"*(\" + identifier + \")(?:\" + whitespace + // Operator (capture 2)\n \"*([*^$|!~]?=)\" + whitespace + // \"Attribute values must be CSS identifiers [capture 5]\n // or strings [capture 3 or capture 4]\"\n \"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\" + identifier + \"))|)\" + whitespace + \"*\\\\]\",\n pseudos = \":(\" + identifier + \")(?:\\\\((\" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n // 1. quoted (capture 3; capture 4 or capture 5)\n \"('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|\" + // 2. simple (capture 6)\n \"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes + \")*)|\" + // 3. anything else (capture 2)\n \".*\" + \")\\\\)|)\",\n // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n rwhitespace = new RegExp(whitespace + \"+\", \"g\"),\n rtrim = new RegExp(\"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\"),\n rcomma = new RegExp(\"^\" + whitespace + \"*,\" + whitespace + \"*\"),\n rcombinators = new RegExp(\"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace + \"*\"),\n rdescend = new RegExp(whitespace + \"|>\"),\n rpseudo = new RegExp(pseudos),\n ridentifier = new RegExp(\"^\" + identifier + \"$\"),\n matchExpr = {\n \"ID\": new RegExp(\"^#(\" + identifier + \")\"),\n \"CLASS\": new RegExp(\"^\\\\.(\" + identifier + \")\"),\n \"TAG\": new RegExp(\"^(\" + identifier + \"|[*])\"),\n \"ATTR\": new RegExp(\"^\" + attributes),\n \"PSEUDO\": new RegExp(\"^\" + pseudos),\n \"CHILD\": new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" + whitespace + \"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace + \"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\"),\n \"bool\": new RegExp(\"^(?:\" + booleans + \")$\", \"i\"),\n // For use in libraries implementing .is()\n // We use this for POS matching in `select`\n \"needsContext\": new RegExp(\"^\" + whitespace + \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" + whitespace + \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\")\n },\n rhtml = /HTML$/i,\n rinputs = /^(?:input|select|textarea|button)$/i,\n rheader = /^h\\d$/i,\n rnative = /^[^{]+\\{\\s*\\[native \\w/,\n // Easily-parseable/retrievable ID or TAG or CLASS selectors\n rquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n rsibling = /[+~]/,\n // CSS escapes\n // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n runescape = new RegExp(\"\\\\\\\\[\\\\da-fA-F]{1,6}\" + whitespace + \"?|\\\\\\\\([^\\\\r\\\\n\\\\f])\", \"g\"),\n funescape = function funescape(escape, nonHex) {\n var high = \"0x\" + escape.slice(1) - 0x10000;\n return nonHex ? // Strip the backslash prefix from a non-hex escape sequence\n nonHex : // Replace a hexadecimal escape sequence with the encoded Unicode code point\n // Support: IE <=11+\n // For values outside the Basic Multilingual Plane (BMP), manually construct a\n // surrogate pair\n high < 0 ? String.fromCharCode(high + 0x10000) : String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);\n },\n // CSS string/identifier serialization\n // https://drafts.csswg.org/cssom/#common-serializing-idioms\n rcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\0-\\x1f\\x7f-\\uFFFF\\w-]/g,\n fcssescape = function fcssescape(ch, asCodePoint) {\n if (asCodePoint) {\n // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n if (ch === \"\\0\") {\n return \"\\uFFFD\";\n } // Control characters and (dependent upon position) numbers get escaped as code points\n\n\n return ch.slice(0, -1) + \"\\\\\" + ch.charCodeAt(ch.length - 1).toString(16) + \" \";\n } // Other potentially-special ASCII characters get backslash-escaped\n\n\n return \"\\\\\" + ch;\n },\n // Used for iframes\n // See setDocument()\n // Removing the function wrapper causes a \"Permission Denied\"\n // error in IE\n unloadHandler = function unloadHandler() {\n setDocument();\n },\n inDisabledFieldset = addCombinator(function (elem) {\n return elem.disabled === true && elem.nodeName.toLowerCase() === \"fieldset\";\n }, {\n dir: \"parentNode\",\n next: \"legend\"\n }); // Optimize for push.apply( _, NodeList )\n\n\n try {\n push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes); // Support: Android<4.0\n // Detect silently failing push.apply\n // eslint-disable-next-line no-unused-expressions\n\n arr[preferredDoc.childNodes.length].nodeType;\n } catch (e) {\n push = {\n apply: arr.length ? // Leverage slice if possible\n function (target, els) {\n pushNative.apply(target, slice.call(els));\n } : // Support: IE<9\n // Otherwise append directly\n function (target, els) {\n var j = target.length,\n i = 0; // Can't trust NodeList.length\n\n while (target[j++] = els[i++]) {}\n\n target.length = j - 1;\n }\n };\n }\n\n function Sizzle(selector, context, results, seed) {\n var m,\n i,\n elem,\n nid,\n match,\n groups,\n newSelector,\n newContext = context && context.ownerDocument,\n // nodeType defaults to 9, since context defaults to document\n nodeType = context ? context.nodeType : 9;\n results = results || []; // Return early from calls with invalid selector or context\n\n if (typeof selector !== \"string\" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {\n return results;\n } // Try to shortcut find operations (as opposed to filters) in HTML documents\n\n\n if (!seed) {\n setDocument(context);\n context = context || document;\n\n if (documentIsHTML) {\n // If the selector is sufficiently simple, try using a \"get*By*\" DOM method\n // (excepting DocumentFragment context, where the methods don't exist)\n if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {\n // ID selector\n if (m = match[1]) {\n // Document context\n if (nodeType === 9) {\n if (elem = context.getElementById(m)) {\n // Support: IE, Opera, Webkit\n // TODO: identify versions\n // getElementById can match elements by name instead of ID\n if (elem.id === m) {\n results.push(elem);\n return results;\n }\n } else {\n return results;\n } // Element context\n\n } else {\n // Support: IE, Opera, Webkit\n // TODO: identify versions\n // getElementById can match elements by name instead of ID\n if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {\n results.push(elem);\n return results;\n }\n } // Type selector\n\n } else if (match[2]) {\n push.apply(results, context.getElementsByTagName(selector));\n return results; // Class selector\n } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {\n push.apply(results, context.getElementsByClassName(m));\n return results;\n }\n } // Take advantage of querySelectorAll\n\n\n if (support.qsa && !nonnativeSelectorCache[selector + \" \"] && (!rbuggyQSA || !rbuggyQSA.test(selector)) && ( // Support: IE 8 only\n // Exclude object elements\n nodeType !== 1 || context.nodeName.toLowerCase() !== \"object\")) {\n newSelector = selector;\n newContext = context; // qSA considers elements outside a scoping root when evaluating child or\n // descendant combinators, which is not what we want.\n // In such cases, we work around the behavior by prefixing every selector in the\n // list with an ID selector referencing the scope context.\n // The technique has to be used as well when a leading combinator is used\n // as such selectors are not recognized by querySelectorAll.\n // Thanks to Andrew Dupont for this technique.\n\n if (nodeType === 1 && (rdescend.test(selector) || rcombinators.test(selector))) {\n // Expand context for sibling selectors\n newContext = rsibling.test(selector) && testContext(context.parentNode) || context; // We can use :scope instead of the ID hack if the browser\n // supports it & if we're not changing the context.\n\n if (newContext !== context || !support.scope) {\n // Capture the context ID, setting it first if necessary\n if (nid = context.getAttribute(\"id\")) {\n nid = nid.replace(rcssescape, fcssescape);\n } else {\n context.setAttribute(\"id\", nid = expando);\n }\n } // Prefix every selector in the list\n\n\n groups = tokenize(selector);\n i = groups.length;\n\n while (i--) {\n groups[i] = (nid ? \"#\" + nid : \":scope\") + \" \" + toSelector(groups[i]);\n }\n\n newSelector = groups.join(\",\");\n }\n\n try {\n push.apply(results, newContext.querySelectorAll(newSelector));\n return results;\n } catch (qsaError) {\n nonnativeSelectorCache(selector, true);\n } finally {\n if (nid === expando) {\n context.removeAttribute(\"id\");\n }\n }\n }\n }\n } // All others\n\n\n return select(selector.replace(rtrim, \"$1\"), context, results, seed);\n }\n /**\n * Create key-value caches of limited size\n * @returns {function(string, object)} Returns the Object data after storing it on itself with\n *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n *\tdeleting the oldest entry\n */\n\n\n function createCache() {\n var keys = [];\n\n function cache(key, value) {\n // Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n if (keys.push(key + \" \") > Expr.cacheLength) {\n // Only keep the most recent entries\n delete cache[keys.shift()];\n }\n\n return cache[key + \" \"] = value;\n }\n\n return cache;\n }\n /**\n * Mark a function for special use by Sizzle\n * @param {Function} fn The function to mark\n */\n\n\n function markFunction(fn) {\n fn[expando] = true;\n return fn;\n }\n /**\n * Support testing using an element\n * @param {Function} fn Passed the created element and returns a boolean result\n */\n\n\n function assert(fn) {\n var el = document.createElement(\"fieldset\");\n\n try {\n return !!fn(el);\n } catch (e) {\n return false;\n } finally {\n // Remove from its parent by default\n if (el.parentNode) {\n el.parentNode.removeChild(el);\n } // release memory in IE\n\n\n el = null;\n }\n }\n /**\n * Adds the same handler for all of the specified attrs\n * @param {String} attrs Pipe-separated list of attributes\n * @param {Function} handler The method that will be applied\n */\n\n\n function addHandle(attrs, handler) {\n var arr = attrs.split(\"|\"),\n i = arr.length;\n\n while (i--) {\n Expr.attrHandle[arr[i]] = handler;\n }\n }\n /**\n * Checks document order of two siblings\n * @param {Element} a\n * @param {Element} b\n * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b\n */\n\n\n function siblingCheck(a, b) {\n var cur = b && a,\n diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex; // Use IE sourceIndex if available on both nodes\n\n if (diff) {\n return diff;\n } // Check if b follows a\n\n\n if (cur) {\n while (cur = cur.nextSibling) {\n if (cur === b) {\n return -1;\n }\n }\n }\n\n return a ? 1 : -1;\n }\n /**\n * Returns a function to use in pseudos for input types\n * @param {String} type\n */\n\n\n function createInputPseudo(type) {\n return function (elem) {\n var name = elem.nodeName.toLowerCase();\n return name === \"input\" && elem.type === type;\n };\n }\n /**\n * Returns a function to use in pseudos for buttons\n * @param {String} type\n */\n\n\n function createButtonPseudo(type) {\n return function (elem) {\n var name = elem.nodeName.toLowerCase();\n return (name === \"input\" || name === \"button\") && elem.type === type;\n };\n }\n /**\n * Returns a function to use in pseudos for :enabled/:disabled\n * @param {Boolean} disabled true for :disabled; false for :enabled\n */\n\n\n function createDisabledPseudo(disabled) {\n // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable\n return function (elem) {\n // Only certain elements can match :enabled or :disabled\n // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled\n // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled\n if (\"form\" in elem) {\n // Check for inherited disabledness on relevant non-disabled elements:\n // * listed form-associated elements in a disabled fieldset\n // https://html.spec.whatwg.org/multipage/forms.html#category-listed\n // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled\n // * option elements in a disabled optgroup\n // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled\n // All such elements have a \"form\" property.\n if (elem.parentNode && elem.disabled === false) {\n // Option elements defer to a parent optgroup if present\n if (\"label\" in elem) {\n if (\"label\" in elem.parentNode) {\n return elem.parentNode.disabled === disabled;\n } else {\n return elem.disabled === disabled;\n }\n } // Support: IE 6 - 11\n // Use the isDisabled shortcut property to check for disabled fieldset ancestors\n\n\n return elem.isDisabled === disabled || // Where there is no isDisabled, check manually\n\n /* jshint -W018 */\n elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;\n }\n\n return elem.disabled === disabled; // Try to winnow out elements that can't be disabled before trusting the disabled property.\n // Some victims get caught in our net (label, legend, menu, track), but it shouldn't\n // even exist on them, let alone have a boolean value.\n } else if (\"label\" in elem) {\n return elem.disabled === disabled;\n } // Remaining elements are neither :enabled nor :disabled\n\n\n return false;\n };\n }\n /**\n * Returns a function to use in pseudos for positionals\n * @param {Function} fn\n */\n\n\n function createPositionalPseudo(fn) {\n return markFunction(function (argument) {\n argument = +argument;\n return markFunction(function (seed, matches) {\n var j,\n matchIndexes = fn([], seed.length, argument),\n i = matchIndexes.length; // Match elements found at the specified indexes\n\n while (i--) {\n if (seed[j = matchIndexes[i]]) {\n seed[j] = !(matches[j] = seed[j]);\n }\n }\n });\n });\n }\n /**\n * Checks a node for validity as a Sizzle context\n * @param {Element|Object=} context\n * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n */\n\n\n function testContext(context) {\n return context && typeof context.getElementsByTagName !== \"undefined\" && context;\n } // Expose support vars for convenience\n\n\n support = Sizzle.support = {};\n /**\n * Detects XML nodes\n * @param {Element|Object} elem An element or a document\n * @returns {Boolean} True iff elem is a non-HTML XML node\n */\n\n isXML = Sizzle.isXML = function (elem) {\n var namespace = elem && elem.namespaceURI,\n docElem = elem && (elem.ownerDocument || elem).documentElement; // Support: IE <=8\n // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes\n // https://bugs.jquery.com/ticket/4833\n\n return !rhtml.test(namespace || docElem && docElem.nodeName || \"HTML\");\n };\n /**\n * Sets document-related variables once based on the current document\n * @param {Element|Object} [doc] An element or document object to use to set the document\n * @returns {Object} Returns the current document\n */\n\n\n setDocument = Sizzle.setDocument = function (node) {\n var hasCompare,\n subWindow,\n doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n\n if (doc == document || doc.nodeType !== 9 || !doc.documentElement) {\n return document;\n } // Update global variables\n\n\n document = doc;\n docElem = document.documentElement;\n documentIsHTML = !isXML(document); // Support: IE 9 - 11+, Edge 12 - 18+\n // Accessing iframe documents after unload throws \"permission denied\" errors (jQuery #13936)\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n\n if (preferredDoc != document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {\n // Support: IE 11, Edge\n if (subWindow.addEventListener) {\n subWindow.addEventListener(\"unload\", unloadHandler, false); // Support: IE 9 - 10 only\n } else if (subWindow.attachEvent) {\n subWindow.attachEvent(\"onunload\", unloadHandler);\n }\n } // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,\n // Safari 4 - 5 only, Opera <=11.6 - 12.x only\n // IE/Edge & older browsers don't support the :scope pseudo-class.\n // Support: Safari 6.0 only\n // Safari 6.0 supports :scope but it's an alias of :root there.\n\n\n support.scope = assert(function (el) {\n docElem.appendChild(el).appendChild(document.createElement(\"div\"));\n return typeof el.querySelectorAll !== \"undefined\" && !el.querySelectorAll(\":scope fieldset div\").length;\n });\n /* Attributes\n ---------------------------------------------------------------------- */\n // Support: IE<8\n // Verify that getAttribute really returns attributes and not properties\n // (excepting IE8 booleans)\n\n support.attributes = assert(function (el) {\n el.className = \"i\";\n return !el.getAttribute(\"className\");\n });\n /* getElement(s)By*\n ---------------------------------------------------------------------- */\n // Check if getElementsByTagName(\"*\") returns only elements\n\n support.getElementsByTagName = assert(function (el) {\n el.appendChild(document.createComment(\"\"));\n return !el.getElementsByTagName(\"*\").length;\n }); // Support: IE<9\n\n support.getElementsByClassName = rnative.test(document.getElementsByClassName); // Support: IE<10\n // Check if getElementById returns elements by name\n // The broken getElementById methods don't pick up programmatically-set names,\n // so use a roundabout getElementsByName test\n\n support.getById = assert(function (el) {\n docElem.appendChild(el).id = expando;\n return !document.getElementsByName || !document.getElementsByName(expando).length;\n }); // ID filter and find\n\n if (support.getById) {\n Expr.filter[\"ID\"] = function (id) {\n var attrId = id.replace(runescape, funescape);\n return function (elem) {\n return elem.getAttribute(\"id\") === attrId;\n };\n };\n\n Expr.find[\"ID\"] = function (id, context) {\n if (typeof context.getElementById !== \"undefined\" && documentIsHTML) {\n var elem = context.getElementById(id);\n return elem ? [elem] : [];\n }\n };\n } else {\n Expr.filter[\"ID\"] = function (id) {\n var attrId = id.replace(runescape, funescape);\n return function (elem) {\n var node = typeof elem.getAttributeNode !== \"undefined\" && elem.getAttributeNode(\"id\");\n return node && node.value === attrId;\n };\n }; // Support: IE 6 - 7 only\n // getElementById is not reliable as a find shortcut\n\n\n Expr.find[\"ID\"] = function (id, context) {\n if (typeof context.getElementById !== \"undefined\" && documentIsHTML) {\n var node,\n i,\n elems,\n elem = context.getElementById(id);\n\n if (elem) {\n // Verify the id attribute\n node = elem.getAttributeNode(\"id\");\n\n if (node && node.value === id) {\n return [elem];\n } // Fall back on getElementsByName\n\n\n elems = context.getElementsByName(id);\n i = 0;\n\n while (elem = elems[i++]) {\n node = elem.getAttributeNode(\"id\");\n\n if (node && node.value === id) {\n return [elem];\n }\n }\n }\n\n return [];\n }\n };\n } // Tag\n\n\n Expr.find[\"TAG\"] = support.getElementsByTagName ? function (tag, context) {\n if (typeof context.getElementsByTagName !== \"undefined\") {\n return context.getElementsByTagName(tag); // DocumentFragment nodes don't have gEBTN\n } else if (support.qsa) {\n return context.querySelectorAll(tag);\n }\n } : function (tag, context) {\n var elem,\n tmp = [],\n i = 0,\n // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too\n results = context.getElementsByTagName(tag); // Filter out possible comments\n\n if (tag === \"*\") {\n while (elem = results[i++]) {\n if (elem.nodeType === 1) {\n tmp.push(elem);\n }\n }\n\n return tmp;\n }\n\n return results;\n }; // Class\n\n Expr.find[\"CLASS\"] = support.getElementsByClassName && function (className, context) {\n if (typeof context.getElementsByClassName !== \"undefined\" && documentIsHTML) {\n return context.getElementsByClassName(className);\n }\n };\n /* QSA/matchesSelector\n ---------------------------------------------------------------------- */\n // QSA and matchesSelector support\n // matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n\n\n rbuggyMatches = []; // qSa(:focus) reports false when true (Chrome 21)\n // We allow this because of a bug in IE8/9 that throws an error\n // whenever `document.activeElement` is accessed on an iframe\n // So, we allow :focus to pass through QSA all the time to avoid the IE error\n // See https://bugs.jquery.com/ticket/13378\n\n rbuggyQSA = [];\n\n if (support.qsa = rnative.test(document.querySelectorAll)) {\n // Build QSA regex\n // Regex strategy adopted from Diego Perini\n assert(function (el) {\n var input; // Select is set to empty string on purpose\n // This is to test IE's treatment of not explicitly\n // setting a boolean content attribute,\n // since its presence should be enough\n // https://bugs.jquery.com/ticket/12359\n\n docElem.appendChild(el).innerHTML = \"\" + \"\"; // Support: IE8, Opera 11-12.16\n // Nothing should be selected when empty strings follow ^= or $= or *=\n // The test attribute must be unknown in Opera but \"safe\" for WinRT\n // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section\n\n if (el.querySelectorAll(\"[msallowcapture^='']\").length) {\n rbuggyQSA.push(\"[*^$]=\" + whitespace + \"*(?:''|\\\"\\\")\");\n } // Support: IE8\n // Boolean attributes and \"value\" are not treated correctly\n\n\n if (!el.querySelectorAll(\"[selected]\").length) {\n rbuggyQSA.push(\"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\");\n } // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+\n\n\n if (!el.querySelectorAll(\"[id~=\" + expando + \"-]\").length) {\n rbuggyQSA.push(\"~=\");\n } // Support: IE 11+, Edge 15 - 18+\n // IE 11/Edge don't find elements on a `[name='']` query in some cases.\n // Adding a temporary attribute to the document before the selection works\n // around the issue.\n // Interestingly, IE 10 & older don't seem to have the issue.\n\n\n input = document.createElement(\"input\");\n input.setAttribute(\"name\", \"\");\n el.appendChild(input);\n\n if (!el.querySelectorAll(\"[name='']\").length) {\n rbuggyQSA.push(\"\\\\[\" + whitespace + \"*name\" + whitespace + \"*=\" + whitespace + \"*(?:''|\\\"\\\")\");\n } // Webkit/Opera - :checked should return selected option elements\n // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n // IE8 throws error here and will not see later tests\n\n\n if (!el.querySelectorAll(\":checked\").length) {\n rbuggyQSA.push(\":checked\");\n } // Support: Safari 8+, iOS 8+\n // https://bugs.webkit.org/show_bug.cgi?id=136851\n // In-page `selector#id sibling-combinator selector` fails\n\n\n if (!el.querySelectorAll(\"a#\" + expando + \"+*\").length) {\n rbuggyQSA.push(\".#.+[+~]\");\n } // Support: Firefox <=3.6 - 5 only\n // Old Firefox doesn't throw on a badly-escaped identifier.\n\n\n el.querySelectorAll(\"\\\\\\f\");\n rbuggyQSA.push(\"[\\\\r\\\\n\\\\f]\");\n });\n assert(function (el) {\n el.innerHTML = \"\" + \"\"; // Support: Windows 8 Native Apps\n // The type and name attributes are restricted during .innerHTML assignment\n\n var input = document.createElement(\"input\");\n input.setAttribute(\"type\", \"hidden\");\n el.appendChild(input).setAttribute(\"name\", \"D\"); // Support: IE8\n // Enforce case-sensitivity of name attribute\n\n if (el.querySelectorAll(\"[name=d]\").length) {\n rbuggyQSA.push(\"name\" + whitespace + \"*[*^$|!~]?=\");\n } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n // IE8 throws error here and will not see later tests\n\n\n if (el.querySelectorAll(\":enabled\").length !== 2) {\n rbuggyQSA.push(\":enabled\", \":disabled\");\n } // Support: IE9-11+\n // IE's :disabled selector does not pick up the children of disabled fieldsets\n\n\n docElem.appendChild(el).disabled = true;\n\n if (el.querySelectorAll(\":disabled\").length !== 2) {\n rbuggyQSA.push(\":enabled\", \":disabled\");\n } // Support: Opera 10 - 11 only\n // Opera 10-11 does not throw on post-comma invalid pseudos\n\n\n el.querySelectorAll(\"*,:x\");\n rbuggyQSA.push(\",.*:\");\n });\n }\n\n if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {\n assert(function (el) {\n // Check to see if it's possible to do matchesSelector\n // on a disconnected node (IE 9)\n support.disconnectedMatch = matches.call(el, \"*\"); // This should fail with an exception\n // Gecko does not error, returns false instead\n\n matches.call(el, \"[s!='']:x\");\n rbuggyMatches.push(\"!=\", pseudos);\n });\n }\n\n rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join(\"|\"));\n rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join(\"|\"));\n /* Contains\n ---------------------------------------------------------------------- */\n\n hasCompare = rnative.test(docElem.compareDocumentPosition); // Element contains another\n // Purposefully self-exclusive\n // As in, an element does not contain itself\n\n contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {\n var adown = a.nodeType === 9 ? a.documentElement : a,\n bup = b && b.parentNode;\n return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));\n } : function (a, b) {\n if (b) {\n while (b = b.parentNode) {\n if (b === a) {\n return true;\n }\n }\n }\n\n return false;\n };\n /* Sorting\n ---------------------------------------------------------------------- */\n // Document order sorting\n\n sortOrder = hasCompare ? function (a, b) {\n // Flag for duplicate removal\n if (a === b) {\n hasDuplicate = true;\n return 0;\n } // Sort on method existence if only one input has compareDocumentPosition\n\n\n var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n\n if (compare) {\n return compare;\n } // Calculate position if both inputs belong to the same document\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n\n\n compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : // Otherwise we know they are disconnected\n 1; // Disconnected nodes\n\n if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {\n // Choose the first element that is related to our preferred document\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if (a == document || a.ownerDocument == preferredDoc && contains(preferredDoc, a)) {\n return -1;\n } // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n\n\n if (b == document || b.ownerDocument == preferredDoc && contains(preferredDoc, b)) {\n return 1;\n } // Maintain original order\n\n\n return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;\n }\n\n return compare & 4 ? -1 : 1;\n } : function (a, b) {\n // Exit early if the nodes are identical\n if (a === b) {\n hasDuplicate = true;\n return 0;\n }\n\n var cur,\n i = 0,\n aup = a.parentNode,\n bup = b.parentNode,\n ap = [a],\n bp = [b]; // Parentless nodes are either documents or disconnected\n\n if (!aup || !bup) {\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n\n /* eslint-disable eqeqeq */\n return a == document ? -1 : b == document ? 1 :\n /* eslint-enable eqeqeq */\n aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0; // If the nodes are siblings, we can do a quick check\n } else if (aup === bup) {\n return siblingCheck(a, b);\n } // Otherwise we need full lists of their ancestors for comparison\n\n\n cur = a;\n\n while (cur = cur.parentNode) {\n ap.unshift(cur);\n }\n\n cur = b;\n\n while (cur = cur.parentNode) {\n bp.unshift(cur);\n } // Walk down the tree looking for a discrepancy\n\n\n while (ap[i] === bp[i]) {\n i++;\n }\n\n return i ? // Do a sibling check if the nodes have a common ancestor\n siblingCheck(ap[i], bp[i]) : // Otherwise nodes in our document sort first\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n\n /* eslint-disable eqeqeq */\n ap[i] == preferredDoc ? -1 : bp[i] == preferredDoc ? 1 :\n /* eslint-enable eqeqeq */\n 0;\n };\n return document;\n };\n\n Sizzle.matches = function (expr, elements) {\n return Sizzle(expr, null, null, elements);\n };\n\n Sizzle.matchesSelector = function (elem, expr) {\n setDocument(elem);\n\n if (support.matchesSelector && documentIsHTML && !nonnativeSelectorCache[expr + \" \"] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {\n try {\n var ret = matches.call(elem, expr); // IE 9's matchesSelector returns false on disconnected nodes\n\n if (ret || support.disconnectedMatch || // As well, disconnected nodes are said to be in a document\n // fragment in IE 9\n elem.document && elem.document.nodeType !== 11) {\n return ret;\n }\n } catch (e) {\n nonnativeSelectorCache(expr, true);\n }\n }\n\n return Sizzle(expr, document, null, [elem]).length > 0;\n };\n\n Sizzle.contains = function (context, elem) {\n // Set document vars if needed\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if ((context.ownerDocument || context) != document) {\n setDocument(context);\n }\n\n return contains(context, elem);\n };\n\n Sizzle.attr = function (elem, name) {\n // Set document vars if needed\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n if ((elem.ownerDocument || elem) != document) {\n setDocument(elem);\n }\n\n var fn = Expr.attrHandle[name.toLowerCase()],\n // Don't get fooled by Object.prototype properties (jQuery #13807)\n val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;\n return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;\n };\n\n Sizzle.escape = function (sel) {\n return (sel + \"\").replace(rcssescape, fcssescape);\n };\n\n Sizzle.error = function (msg) {\n throw new Error(\"Syntax error, unrecognized expression: \" + msg);\n };\n /**\n * Document sorting and removing duplicates\n * @param {ArrayLike} results\n */\n\n\n Sizzle.uniqueSort = function (results) {\n var elem,\n duplicates = [],\n j = 0,\n i = 0; // Unless we *know* we can detect duplicates, assume their presence\n\n hasDuplicate = !support.detectDuplicates;\n sortInput = !support.sortStable && results.slice(0);\n results.sort(sortOrder);\n\n if (hasDuplicate) {\n while (elem = results[i++]) {\n if (elem === results[i]) {\n j = duplicates.push(i);\n }\n }\n\n while (j--) {\n results.splice(duplicates[j], 1);\n }\n } // Clear input after sorting to release objects\n // See https://github.com/jquery/sizzle/pull/225\n\n\n sortInput = null;\n return results;\n };\n /**\n * Utility function for retrieving the text value of an array of DOM nodes\n * @param {Array|Element} elem\n */\n\n\n getText = Sizzle.getText = function (elem) {\n var node,\n ret = \"\",\n i = 0,\n nodeType = elem.nodeType;\n\n if (!nodeType) {\n // If no nodeType, this is expected to be an array\n while (node = elem[i++]) {\n // Do not traverse comment nodes\n ret += getText(node);\n }\n } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {\n // Use textContent for elements\n // innerText usage removed for consistency of new lines (jQuery #11153)\n if (typeof elem.textContent === \"string\") {\n return elem.textContent;\n } else {\n // Traverse its children\n for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n ret += getText(elem);\n }\n }\n } else if (nodeType === 3 || nodeType === 4) {\n return elem.nodeValue;\n } // Do not include comment or processing instruction nodes\n\n\n return ret;\n };\n\n Expr = Sizzle.selectors = {\n // Can be adjusted by the user\n cacheLength: 50,\n createPseudo: markFunction,\n match: matchExpr,\n attrHandle: {},\n find: {},\n relative: {\n \">\": {\n dir: \"parentNode\",\n first: true\n },\n \" \": {\n dir: \"parentNode\"\n },\n \"+\": {\n dir: \"previousSibling\",\n first: true\n },\n \"~\": {\n dir: \"previousSibling\"\n }\n },\n preFilter: {\n \"ATTR\": function ATTR(match) {\n match[1] = match[1].replace(runescape, funescape); // Move the given value to match[3] whether quoted or unquoted\n\n match[3] = (match[3] || match[4] || match[5] || \"\").replace(runescape, funescape);\n\n if (match[2] === \"~=\") {\n match[3] = \" \" + match[3] + \" \";\n }\n\n return match.slice(0, 4);\n },\n \"CHILD\": function CHILD(match) {\n /* matches from matchExpr[\"CHILD\"]\n \t1 type (only|nth|...)\n \t2 what (child|of-type)\n \t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n \t4 xn-component of xn+y argument ([+-]?\\d*n|)\n \t5 sign of xn-component\n \t6 x of xn-component\n \t7 sign of y-component\n \t8 y of y-component\n */\n match[1] = match[1].toLowerCase();\n\n if (match[1].slice(0, 3) === \"nth\") {\n // nth-* requires argument\n if (!match[3]) {\n Sizzle.error(match[0]);\n } // numeric x and y parameters for Expr.filter.CHILD\n // remember that false/true cast respectively to 0/1\n\n\n match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === \"even\" || match[3] === \"odd\"));\n match[5] = +(match[7] + match[8] || match[3] === \"odd\"); // other types prohibit arguments\n } else if (match[3]) {\n Sizzle.error(match[0]);\n }\n\n return match;\n },\n \"PSEUDO\": function PSEUDO(match) {\n var excess,\n unquoted = !match[6] && match[2];\n\n if (matchExpr[\"CHILD\"].test(match[0])) {\n return null;\n } // Accept quoted arguments as-is\n\n\n if (match[3]) {\n match[2] = match[4] || match[5] || \"\"; // Strip excess characters from unquoted arguments\n } else if (unquoted && rpseudo.test(unquoted) && ( // Get excess from tokenize (recursively)\n excess = tokenize(unquoted, true)) && ( // advance to the next closing parenthesis\n excess = unquoted.indexOf(\")\", unquoted.length - excess) - unquoted.length)) {\n // excess is a negative index\n match[0] = match[0].slice(0, excess);\n match[2] = unquoted.slice(0, excess);\n } // Return only captures needed by the pseudo filter method (type and argument)\n\n\n return match.slice(0, 3);\n }\n },\n filter: {\n \"TAG\": function TAG(nodeNameSelector) {\n var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();\n return nodeNameSelector === \"*\" ? function () {\n return true;\n } : function (elem) {\n return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n };\n },\n \"CLASS\": function CLASS(className) {\n var pattern = classCache[className + \" \"];\n return pattern || (pattern = new RegExp(\"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\")) && classCache(className, function (elem) {\n return pattern.test(typeof elem.className === \"string\" && elem.className || typeof elem.getAttribute !== \"undefined\" && elem.getAttribute(\"class\") || \"\");\n });\n },\n \"ATTR\": function ATTR(name, operator, check) {\n return function (elem) {\n var result = Sizzle.attr(elem, name);\n\n if (result == null) {\n return operator === \"!=\";\n }\n\n if (!operator) {\n return true;\n }\n\n result += \"\";\n /* eslint-disable max-len */\n\n return operator === \"=\" ? result === check : operator === \"!=\" ? result !== check : operator === \"^=\" ? check && result.indexOf(check) === 0 : operator === \"*=\" ? check && result.indexOf(check) > -1 : operator === \"$=\" ? check && result.slice(-check.length) === check : operator === \"~=\" ? (\" \" + result.replace(rwhitespace, \" \") + \" \").indexOf(check) > -1 : operator === \"|=\" ? result === check || result.slice(0, check.length + 1) === check + \"-\" : false;\n /* eslint-enable max-len */\n };\n },\n \"CHILD\": function CHILD(type, what, _argument, first, last) {\n var simple = type.slice(0, 3) !== \"nth\",\n forward = type.slice(-4) !== \"last\",\n ofType = what === \"of-type\";\n return first === 1 && last === 0 ? // Shortcut for :nth-*(n)\n function (elem) {\n return !!elem.parentNode;\n } : function (elem, _context, xml) {\n var cache,\n uniqueCache,\n outerCache,\n node,\n nodeIndex,\n start,\n dir = simple !== forward ? \"nextSibling\" : \"previousSibling\",\n parent = elem.parentNode,\n name = ofType && elem.nodeName.toLowerCase(),\n useCache = !xml && !ofType,\n diff = false;\n\n if (parent) {\n // :(first|last|only)-(child|of-type)\n if (simple) {\n while (dir) {\n node = elem;\n\n while (node = node[dir]) {\n if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {\n return false;\n }\n } // Reverse direction for :only-* (if we haven't yet done so)\n\n\n start = dir = type === \"only\" && !start && \"nextSibling\";\n }\n\n return true;\n }\n\n start = [forward ? parent.firstChild : parent.lastChild]; // non-xml :nth-child(...) stores cache data on `parent`\n\n if (forward && useCache) {\n // Seek `elem` from a previously-cached index\n // ...in a gzip-friendly way\n node = parent;\n outerCache = node[expando] || (node[expando] = {}); // Support: IE <9 only\n // Defend against cloned attroperties (jQuery gh-1709)\n\n uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});\n cache = uniqueCache[type] || [];\n nodeIndex = cache[0] === dirruns && cache[1];\n diff = nodeIndex && cache[2];\n node = nodeIndex && parent.childNodes[nodeIndex];\n\n while (node = ++nodeIndex && node && node[dir] || ( // Fallback to seeking `elem` from the start\n diff = nodeIndex = 0) || start.pop()) {\n // When found, cache indexes on `parent` and break\n if (node.nodeType === 1 && ++diff && node === elem) {\n uniqueCache[type] = [dirruns, nodeIndex, diff];\n break;\n }\n }\n } else {\n // Use previously-cached element index if available\n if (useCache) {\n // ...in a gzip-friendly way\n node = elem;\n outerCache = node[expando] || (node[expando] = {}); // Support: IE <9 only\n // Defend against cloned attroperties (jQuery gh-1709)\n\n uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});\n cache = uniqueCache[type] || [];\n nodeIndex = cache[0] === dirruns && cache[1];\n diff = nodeIndex;\n } // xml :nth-child(...)\n // or :nth-last-child(...) or :nth(-last)?-of-type(...)\n\n\n if (diff === false) {\n // Use the same loop as above to seek `elem` from the start\n while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {\n if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {\n // Cache the index of each encountered element\n if (useCache) {\n outerCache = node[expando] || (node[expando] = {}); // Support: IE <9 only\n // Defend against cloned attroperties (jQuery gh-1709)\n\n uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});\n uniqueCache[type] = [dirruns, diff];\n }\n\n if (node === elem) {\n break;\n }\n }\n }\n }\n } // Incorporate the offset, then check against cycle size\n\n\n diff -= last;\n return diff === first || diff % first === 0 && diff / first >= 0;\n }\n };\n },\n \"PSEUDO\": function PSEUDO(pseudo, argument) {\n // pseudo-class names are case-insensitive\n // http://www.w3.org/TR/selectors/#pseudo-classes\n // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n // Remember that setFilters inherits from pseudos\n var args,\n fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error(\"unsupported pseudo: \" + pseudo); // The user may use createPseudo to indicate that\n // arguments are needed to create the filter function\n // just as Sizzle does\n\n if (fn[expando]) {\n return fn(argument);\n } // But maintain support for old signatures\n\n\n if (fn.length > 1) {\n args = [pseudo, pseudo, \"\", argument];\n return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {\n var idx,\n matched = fn(seed, argument),\n i = matched.length;\n\n while (i--) {\n idx = indexOf(seed, matched[i]);\n seed[idx] = !(matches[idx] = matched[i]);\n }\n }) : function (elem) {\n return fn(elem, 0, args);\n };\n }\n\n return fn;\n }\n },\n pseudos: {\n // Potentially complex pseudos\n \"not\": markFunction(function (selector) {\n // Trim the selector passed to compile\n // to avoid treating leading and trailing\n // spaces as combinators\n var input = [],\n results = [],\n matcher = compile(selector.replace(rtrim, \"$1\"));\n return matcher[expando] ? markFunction(function (seed, matches, _context, xml) {\n var elem,\n unmatched = matcher(seed, null, xml, []),\n i = seed.length; // Match elements unmatched by `matcher`\n\n while (i--) {\n if (elem = unmatched[i]) {\n seed[i] = !(matches[i] = elem);\n }\n }\n }) : function (elem, _context, xml) {\n input[0] = elem;\n matcher(input, null, xml, results); // Don't keep the element (issue #299)\n\n input[0] = null;\n return !results.pop();\n };\n }),\n \"has\": markFunction(function (selector) {\n return function (elem) {\n return Sizzle(selector, elem).length > 0;\n };\n }),\n \"contains\": markFunction(function (text) {\n text = text.replace(runescape, funescape);\n return function (elem) {\n return (elem.textContent || getText(elem)).indexOf(text) > -1;\n };\n }),\n // \"Whether an element is represented by a :lang() selector\n // is based solely on the element's language value\n // being equal to the identifier C,\n // or beginning with the identifier C immediately followed by \"-\".\n // The matching of C against the element's language value is performed case-insensitively.\n // The identifier C does not have to be a valid language name.\"\n // http://www.w3.org/TR/selectors/#lang-pseudo\n \"lang\": markFunction(function (lang) {\n // lang value must be a valid identifier\n if (!ridentifier.test(lang || \"\")) {\n Sizzle.error(\"unsupported lang: \" + lang);\n }\n\n lang = lang.replace(runescape, funescape).toLowerCase();\n return function (elem) {\n var elemLang;\n\n do {\n if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\")) {\n elemLang = elemLang.toLowerCase();\n return elemLang === lang || elemLang.indexOf(lang + \"-\") === 0;\n }\n } while ((elem = elem.parentNode) && elem.nodeType === 1);\n\n return false;\n };\n }),\n // Miscellaneous\n \"target\": function target(elem) {\n var hash = window.location && window.location.hash;\n return hash && hash.slice(1) === elem.id;\n },\n \"root\": function root(elem) {\n return elem === docElem;\n },\n \"focus\": function focus(elem) {\n return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n },\n // Boolean properties\n \"enabled\": createDisabledPseudo(false),\n \"disabled\": createDisabledPseudo(true),\n \"checked\": function checked(elem) {\n // In CSS3, :checked should return both checked and selected elements\n // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n var nodeName = elem.nodeName.toLowerCase();\n return nodeName === \"input\" && !!elem.checked || nodeName === \"option\" && !!elem.selected;\n },\n \"selected\": function selected(elem) {\n // Accessing this property makes selected-by-default\n // options in Safari work properly\n if (elem.parentNode) {\n // eslint-disable-next-line no-unused-expressions\n elem.parentNode.selectedIndex;\n }\n\n return elem.selected === true;\n },\n // Contents\n \"empty\": function empty(elem) {\n // http://www.w3.org/TR/selectors/#empty-pseudo\n // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n // but not by others (comment: 8; processing instruction: 7; etc.)\n // nodeType < 6 works because attributes (2) do not appear as children\n for (elem = elem.firstChild; elem; elem = elem.nextSibling) {\n if (elem.nodeType < 6) {\n return false;\n }\n }\n\n return true;\n },\n \"parent\": function parent(elem) {\n return !Expr.pseudos[\"empty\"](elem);\n },\n // Element/input types\n \"header\": function header(elem) {\n return rheader.test(elem.nodeName);\n },\n \"input\": function input(elem) {\n return rinputs.test(elem.nodeName);\n },\n \"button\": function button(elem) {\n var name = elem.nodeName.toLowerCase();\n return name === \"input\" && elem.type === \"button\" || name === \"button\";\n },\n \"text\": function text(elem) {\n var attr;\n return elem.nodeName.toLowerCase() === \"input\" && elem.type === \"text\" && ( // Support: IE<8\n // New HTML5 attribute values (e.g., \"search\") appear with elem.type === \"text\"\n (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === \"text\");\n },\n // Position-in-collection\n \"first\": createPositionalPseudo(function () {\n return [0];\n }),\n \"last\": createPositionalPseudo(function (_matchIndexes, length) {\n return [length - 1];\n }),\n \"eq\": createPositionalPseudo(function (_matchIndexes, length, argument) {\n return [argument < 0 ? argument + length : argument];\n }),\n \"even\": createPositionalPseudo(function (matchIndexes, length) {\n var i = 0;\n\n for (; i < length; i += 2) {\n matchIndexes.push(i);\n }\n\n return matchIndexes;\n }),\n \"odd\": createPositionalPseudo(function (matchIndexes, length) {\n var i = 1;\n\n for (; i < length; i += 2) {\n matchIndexes.push(i);\n }\n\n return matchIndexes;\n }),\n \"lt\": createPositionalPseudo(function (matchIndexes, length, argument) {\n var i = argument < 0 ? argument + length : argument > length ? length : argument;\n\n for (; --i >= 0;) {\n matchIndexes.push(i);\n }\n\n return matchIndexes;\n }),\n \"gt\": createPositionalPseudo(function (matchIndexes, length, argument) {\n var i = argument < 0 ? argument + length : argument;\n\n for (; ++i < length;) {\n matchIndexes.push(i);\n }\n\n return matchIndexes;\n })\n }\n };\n Expr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"]; // Add button/input type pseudos\n\n for (i in {\n radio: true,\n checkbox: true,\n file: true,\n password: true,\n image: true\n }) {\n Expr.pseudos[i] = createInputPseudo(i);\n }\n\n for (i in {\n submit: true,\n reset: true\n }) {\n Expr.pseudos[i] = createButtonPseudo(i);\n } // Easy API for creating new setFilters\n\n\n function setFilters() {}\n\n setFilters.prototype = Expr.filters = Expr.pseudos;\n Expr.setFilters = new setFilters();\n\n tokenize = Sizzle.tokenize = function (selector, parseOnly) {\n var matched,\n match,\n tokens,\n type,\n soFar,\n groups,\n preFilters,\n cached = tokenCache[selector + \" \"];\n\n if (cached) {\n return parseOnly ? 0 : cached.slice(0);\n }\n\n soFar = selector;\n groups = [];\n preFilters = Expr.preFilter;\n\n while (soFar) {\n // Comma and first run\n if (!matched || (match = rcomma.exec(soFar))) {\n if (match) {\n // Don't consume trailing commas as valid\n soFar = soFar.slice(match[0].length) || soFar;\n }\n\n groups.push(tokens = []);\n }\n\n matched = false; // Combinators\n\n if (match = rcombinators.exec(soFar)) {\n matched = match.shift();\n tokens.push({\n value: matched,\n // Cast descendant combinators to space\n type: match[0].replace(rtrim, \" \")\n });\n soFar = soFar.slice(matched.length);\n } // Filters\n\n\n for (type in Expr.filter) {\n if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {\n matched = match.shift();\n tokens.push({\n value: matched,\n type: type,\n matches: match\n });\n soFar = soFar.slice(matched.length);\n }\n }\n\n if (!matched) {\n break;\n }\n } // Return the length of the invalid excess\n // if we're just parsing\n // Otherwise, throw an error or return tokens\n\n\n return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : // Cache the tokens\n tokenCache(selector, groups).slice(0);\n };\n\n function toSelector(tokens) {\n var i = 0,\n len = tokens.length,\n selector = \"\";\n\n for (; i < len; i++) {\n selector += tokens[i].value;\n }\n\n return selector;\n }\n\n function addCombinator(matcher, combinator, base) {\n var dir = combinator.dir,\n skip = combinator.next,\n key = skip || dir,\n checkNonElements = base && key === \"parentNode\",\n doneName = done++;\n return combinator.first ? // Check against closest ancestor/preceding element\n function (elem, context, xml) {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n return matcher(elem, context, xml);\n }\n }\n\n return false;\n } : // Check against all ancestor/preceding elements\n function (elem, context, xml) {\n var oldCache,\n uniqueCache,\n outerCache,\n newCache = [dirruns, doneName]; // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching\n\n if (xml) {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n if (matcher(elem, context, xml)) {\n return true;\n }\n }\n }\n } else {\n while (elem = elem[dir]) {\n if (elem.nodeType === 1 || checkNonElements) {\n outerCache = elem[expando] || (elem[expando] = {}); // Support: IE <9 only\n // Defend against cloned attroperties (jQuery gh-1709)\n\n uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});\n\n if (skip && skip === elem.nodeName.toLowerCase()) {\n elem = elem[dir] || elem;\n } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {\n // Assign to newCache so results back-propagate to previous elements\n return newCache[2] = oldCache[2];\n } else {\n // Reuse newcache so results back-propagate to previous elements\n uniqueCache[key] = newCache; // A match means we're done; a fail means we have to keep checking\n\n if (newCache[2] = matcher(elem, context, xml)) {\n return true;\n }\n }\n }\n }\n }\n\n return false;\n };\n }\n\n function elementMatcher(matchers) {\n return matchers.length > 1 ? function (elem, context, xml) {\n var i = matchers.length;\n\n while (i--) {\n if (!matchers[i](elem, context, xml)) {\n return false;\n }\n }\n\n return true;\n } : matchers[0];\n }\n\n function multipleContexts(selector, contexts, results) {\n var i = 0,\n len = contexts.length;\n\n for (; i < len; i++) {\n Sizzle(selector, contexts[i], results);\n }\n\n return results;\n }\n\n function condense(unmatched, map, filter, context, xml) {\n var elem,\n newUnmatched = [],\n i = 0,\n len = unmatched.length,\n mapped = map != null;\n\n for (; i < len; i++) {\n if (elem = unmatched[i]) {\n if (!filter || filter(elem, context, xml)) {\n newUnmatched.push(elem);\n\n if (mapped) {\n map.push(i);\n }\n }\n }\n }\n\n return newUnmatched;\n }\n\n function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {\n if (postFilter && !postFilter[expando]) {\n postFilter = setMatcher(postFilter);\n }\n\n if (postFinder && !postFinder[expando]) {\n postFinder = setMatcher(postFinder, postSelector);\n }\n\n return markFunction(function (seed, results, context, xml) {\n var temp,\n i,\n elem,\n preMap = [],\n postMap = [],\n preexisting = results.length,\n // Get initial elements from seed or context\n elems = seed || multipleContexts(selector || \"*\", context.nodeType ? [context] : context, []),\n // Prefilter to get matcher input, preserving a map for seed-results synchronization\n matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,\n matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n postFinder || (seed ? preFilter : preexisting || postFilter) ? // ...intermediate processing is necessary\n [] : // ...otherwise use results directly\n results : matcherIn; // Find primary matches\n\n if (matcher) {\n matcher(matcherIn, matcherOut, context, xml);\n } // Apply postFilter\n\n\n if (postFilter) {\n temp = condense(matcherOut, postMap);\n postFilter(temp, [], context, xml); // Un-match failing elements by moving them back to matcherIn\n\n i = temp.length;\n\n while (i--) {\n if (elem = temp[i]) {\n matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);\n }\n }\n }\n\n if (seed) {\n if (postFinder || preFilter) {\n if (postFinder) {\n // Get the final matcherOut by condensing this intermediate into postFinder contexts\n temp = [];\n i = matcherOut.length;\n\n while (i--) {\n if (elem = matcherOut[i]) {\n // Restore matcherIn since elem is not yet a final match\n temp.push(matcherIn[i] = elem);\n }\n }\n\n postFinder(null, matcherOut = [], temp, xml);\n } // Move matched elements from seed to results to keep them synchronized\n\n\n i = matcherOut.length;\n\n while (i--) {\n if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {\n seed[temp] = !(results[temp] = elem);\n }\n }\n } // Add elements to results, through postFinder if defined\n\n } else {\n matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);\n\n if (postFinder) {\n postFinder(null, results, matcherOut, xml);\n } else {\n push.apply(results, matcherOut);\n }\n }\n });\n }\n\n function matcherFromTokens(tokens) {\n var checkContext,\n matcher,\n j,\n len = tokens.length,\n leadingRelative = Expr.relative[tokens[0].type],\n implicitRelative = leadingRelative || Expr.relative[\" \"],\n i = leadingRelative ? 1 : 0,\n // The foundational matcher ensures that elements are reachable from top-level context(s)\n matchContext = addCombinator(function (elem) {\n return elem === checkContext;\n }, implicitRelative, true),\n matchAnyContext = addCombinator(function (elem) {\n return indexOf(checkContext, elem) > -1;\n }, implicitRelative, true),\n matchers = [function (elem, context, xml) {\n var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml)); // Avoid hanging onto element (issue #299)\n\n checkContext = null;\n return ret;\n }];\n\n for (; i < len; i++) {\n if (matcher = Expr.relative[tokens[i].type]) {\n matchers = [addCombinator(elementMatcher(matchers), matcher)];\n } else {\n matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); // Return special upon seeing a positional matcher\n\n if (matcher[expando]) {\n // Find the next relative operator (if any) for proper handling\n j = ++i;\n\n for (; j < len; j++) {\n if (Expr.relative[tokens[j].type]) {\n break;\n }\n }\n\n return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector( // If the preceding token was a descendant combinator, insert an implicit any-element `*`\n tokens.slice(0, i - 1).concat({\n value: tokens[i - 2].type === \" \" ? \"*\" : \"\"\n })).replace(rtrim, \"$1\"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));\n }\n\n matchers.push(matcher);\n }\n }\n\n return elementMatcher(matchers);\n }\n\n function matcherFromGroupMatchers(elementMatchers, setMatchers) {\n var bySet = setMatchers.length > 0,\n byElement = elementMatchers.length > 0,\n superMatcher = function superMatcher(seed, context, xml, results, outermost) {\n var elem,\n j,\n matcher,\n matchedCount = 0,\n i = \"0\",\n unmatched = seed && [],\n setMatched = [],\n contextBackup = outermostContext,\n // We must always have either seed elements or outermost context\n elems = seed || byElement && Expr.find[\"TAG\"](\"*\", outermost),\n // Use integer dirruns iff this is the outermost matcher\n dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,\n len = elems.length;\n\n if (outermost) {\n // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n outermostContext = context == document || context || outermost;\n } // Add elements passing elementMatchers directly to results\n // Support: IE<9, Safari\n // Tolerate NodeList properties (IE: \"length\"; Safari: ) matching elements by id\n\n\n for (; i !== len && (elem = elems[i]) != null; i++) {\n if (byElement && elem) {\n j = 0; // Support: IE 11+, Edge 17 - 18+\n // IE/Edge sometimes throw a \"Permission denied\" error when strict-comparing\n // two documents; shallow comparisons work.\n // eslint-disable-next-line eqeqeq\n\n if (!context && elem.ownerDocument != document) {\n setDocument(elem);\n xml = !documentIsHTML;\n }\n\n while (matcher = elementMatchers[j++]) {\n if (matcher(elem, context || document, xml)) {\n results.push(elem);\n break;\n }\n }\n\n if (outermost) {\n dirruns = dirrunsUnique;\n }\n } // Track unmatched elements for set filters\n\n\n if (bySet) {\n // They will have gone through all possible matchers\n if (elem = !matcher && elem) {\n matchedCount--;\n } // Lengthen the array for every element, matched or not\n\n\n if (seed) {\n unmatched.push(elem);\n }\n }\n } // `i` is now the count of elements visited above, and adding it to `matchedCount`\n // makes the latter nonnegative.\n\n\n matchedCount += i; // Apply set filters to unmatched elements\n // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`\n // equals `i`), unless we didn't visit _any_ elements in the above loop because we have\n // no element matchers and no seed.\n // Incrementing an initially-string \"0\" `i` allows `i` to remain a string only in that\n // case, which will result in a \"00\" `matchedCount` that differs from `i` but is also\n // numerically zero.\n\n if (bySet && i !== matchedCount) {\n j = 0;\n\n while (matcher = setMatchers[j++]) {\n matcher(unmatched, setMatched, context, xml);\n }\n\n if (seed) {\n // Reintegrate element matches to eliminate the need for sorting\n if (matchedCount > 0) {\n while (i--) {\n if (!(unmatched[i] || setMatched[i])) {\n setMatched[i] = pop.call(results);\n }\n }\n } // Discard index placeholder values to get only actual matches\n\n\n setMatched = condense(setMatched);\n } // Add matches to results\n\n\n push.apply(results, setMatched); // Seedless set matches succeeding multiple successful matchers stipulate sorting\n\n if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {\n Sizzle.uniqueSort(results);\n }\n } // Override manipulation of globals by nested matchers\n\n\n if (outermost) {\n dirruns = dirrunsUnique;\n outermostContext = contextBackup;\n }\n\n return unmatched;\n };\n\n return bySet ? markFunction(superMatcher) : superMatcher;\n }\n\n compile = Sizzle.compile = function (selector, match\n /* Internal Use Only */\n ) {\n var i,\n setMatchers = [],\n elementMatchers = [],\n cached = compilerCache[selector + \" \"];\n\n if (!cached) {\n // Generate a function of recursive functions that can be used to check each element\n if (!match) {\n match = tokenize(selector);\n }\n\n i = match.length;\n\n while (i--) {\n cached = matcherFromTokens(match[i]);\n\n if (cached[expando]) {\n setMatchers.push(cached);\n } else {\n elementMatchers.push(cached);\n }\n } // Cache the compiled function\n\n\n cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers)); // Save selector and tokenization\n\n cached.selector = selector;\n }\n\n return cached;\n };\n /**\n * A low-level selection function that works with Sizzle's compiled\n * selector functions\n * @param {String|Function} selector A selector or a pre-compiled\n * selector function built with Sizzle.compile\n * @param {Element} context\n * @param {Array} [results]\n * @param {Array} [seed] A set of elements to match against\n */\n\n\n select = Sizzle.select = function (selector, context, results, seed) {\n var i,\n tokens,\n token,\n type,\n find,\n compiled = typeof selector === \"function\" && selector,\n match = !seed && tokenize(selector = compiled.selector || selector);\n results = results || []; // Try to minimize operations if there is only one selector in the list and no seed\n // (the latter of which guarantees us context)\n\n if (match.length === 1) {\n // Reduce context if the leading compound selector is an ID\n tokens = match[0] = match[0].slice(0);\n\n if (tokens.length > 2 && (token = tokens[0]).type === \"ID\" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {\n context = (Expr.find[\"ID\"](token.matches[0].replace(runescape, funescape), context) || [])[0];\n\n if (!context) {\n return results; // Precompiled matchers will still verify ancestry, so step up a level\n } else if (compiled) {\n context = context.parentNode;\n }\n\n selector = selector.slice(tokens.shift().value.length);\n } // Fetch a seed set for right-to-left matching\n\n\n i = matchExpr[\"needsContext\"].test(selector) ? 0 : tokens.length;\n\n while (i--) {\n token = tokens[i]; // Abort if we hit a combinator\n\n if (Expr.relative[type = token.type]) {\n break;\n }\n\n if (find = Expr.find[type]) {\n // Search, expanding context for leading sibling combinators\n if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {\n // If seed is empty or no tokens remain, we can return early\n tokens.splice(i, 1);\n selector = seed.length && toSelector(tokens);\n\n if (!selector) {\n push.apply(results, seed);\n return results;\n }\n\n break;\n }\n }\n }\n } // Compile and execute a filtering function if one is not provided\n // Provide `match` to avoid retokenization if we modified the selector above\n\n\n (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);\n return results;\n }; // One-time assignments\n // Sort stability\n\n\n support.sortStable = expando.split(\"\").sort(sortOrder).join(\"\") === expando; // Support: Chrome 14-35+\n // Always assume duplicates if they aren't passed to the comparison function\n\n support.detectDuplicates = !!hasDuplicate; // Initialize against the default document\n\n setDocument(); // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)\n // Detached nodes confoundingly follow *each other*\n\n support.sortDetached = assert(function (el) {\n // Should return 1, but returns 4 (following)\n return el.compareDocumentPosition(document.createElement(\"fieldset\")) & 1;\n }); // Support: IE<8\n // Prevent attribute/property \"interpolation\"\n // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx\n\n if (!assert(function (el) {\n el.innerHTML = \"\";\n return el.firstChild.getAttribute(\"href\") === \"#\";\n })) {\n addHandle(\"type|href|height|width\", function (elem, name, isXML) {\n if (!isXML) {\n return elem.getAttribute(name, name.toLowerCase() === \"type\" ? 1 : 2);\n }\n });\n } // Support: IE<9\n // Use defaultValue in place of getAttribute(\"value\")\n\n\n if (!support.attributes || !assert(function (el) {\n el.innerHTML = \"\";\n el.firstChild.setAttribute(\"value\", \"\");\n return el.firstChild.getAttribute(\"value\") === \"\";\n })) {\n addHandle(\"value\", function (elem, _name, isXML) {\n if (!isXML && elem.nodeName.toLowerCase() === \"input\") {\n return elem.defaultValue;\n }\n });\n } // Support: IE<9\n // Use getAttributeNode to fetch booleans when getAttribute lies\n\n\n if (!assert(function (el) {\n return el.getAttribute(\"disabled\") == null;\n })) {\n addHandle(booleans, function (elem, name, isXML) {\n var val;\n\n if (!isXML) {\n return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;\n }\n });\n }\n\n return Sizzle;\n }(window);\n\n jQuery.find = Sizzle;\n jQuery.expr = Sizzle.selectors; // Deprecated\n\n jQuery.expr[\":\"] = jQuery.expr.pseudos;\n jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;\n jQuery.text = Sizzle.getText;\n jQuery.isXMLDoc = Sizzle.isXML;\n jQuery.contains = Sizzle.contains;\n jQuery.escapeSelector = Sizzle.escape;\n\n var dir = function dir(elem, _dir, until) {\n var matched = [],\n truncate = until !== undefined;\n\n while ((elem = elem[_dir]) && elem.nodeType !== 9) {\n if (elem.nodeType === 1) {\n if (truncate && jQuery(elem).is(until)) {\n break;\n }\n\n matched.push(elem);\n }\n }\n\n return matched;\n };\n\n var _siblings = function siblings(n, elem) {\n var matched = [];\n\n for (; n; n = n.nextSibling) {\n if (n.nodeType === 1 && n !== elem) {\n matched.push(n);\n }\n }\n\n return matched;\n };\n\n var rneedsContext = jQuery.expr.match.needsContext;\n\n function nodeName(elem, name) {\n return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n }\n\n var rsingleTag = /^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i; // Implement the identical functionality for filter and not\n\n function winnow(elements, qualifier, not) {\n if (isFunction(qualifier)) {\n return jQuery.grep(elements, function (elem, i) {\n return !!qualifier.call(elem, i, elem) !== not;\n });\n } // Single element\n\n\n if (qualifier.nodeType) {\n return jQuery.grep(elements, function (elem) {\n return elem === qualifier !== not;\n });\n } // Arraylike of elements (jQuery, arguments, Array)\n\n\n if (typeof qualifier !== \"string\") {\n return jQuery.grep(elements, function (elem) {\n return indexOf.call(qualifier, elem) > -1 !== not;\n });\n } // Filtered directly for both simple and complex selectors\n\n\n return jQuery.filter(qualifier, elements, not);\n }\n\n jQuery.filter = function (expr, elems, not) {\n var elem = elems[0];\n\n if (not) {\n expr = \":not(\" + expr + \")\";\n }\n\n if (elems.length === 1 && elem.nodeType === 1) {\n return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];\n }\n\n return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {\n return elem.nodeType === 1;\n }));\n };\n\n jQuery.fn.extend({\n find: function find(selector) {\n var i,\n ret,\n len = this.length,\n self = this;\n\n if (typeof selector !== \"string\") {\n return this.pushStack(jQuery(selector).filter(function () {\n for (i = 0; i < len; i++) {\n if (jQuery.contains(self[i], this)) {\n return true;\n }\n }\n }));\n }\n\n ret = this.pushStack([]);\n\n for (i = 0; i < len; i++) {\n jQuery.find(selector, self[i], ret);\n }\n\n return len > 1 ? jQuery.uniqueSort(ret) : ret;\n },\n filter: function filter(selector) {\n return this.pushStack(winnow(this, selector || [], false));\n },\n not: function not(selector) {\n return this.pushStack(winnow(this, selector || [], true));\n },\n is: function is(selector) {\n return !!winnow(this, // If this is a positional/relative selector, check membership in the returned set\n // so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n typeof selector === \"string\" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;\n }\n }); // Initialize a jQuery object\n // A central reference to the root jQuery(document)\n\n var rootjQuery,\n // A simple way to check for HTML strings\n // Prioritize #id over to avoid XSS via location.hash (#9521)\n // Strict HTML recognition (#11290: must start with <)\n // Shortcut simple #id case for speed\n rquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/,\n init = jQuery.fn.init = function (selector, context, root) {\n var match, elem; // HANDLE: $(\"\"), $(null), $(undefined), $(false)\n\n if (!selector) {\n return this;\n } // Method init() accepts an alternate rootjQuery\n // so migrate can support jQuery.sub (gh-2101)\n\n\n root = root || rootjQuery; // Handle HTML strings\n\n if (typeof selector === \"string\") {\n if (selector[0] === \"<\" && selector[selector.length - 1] === \">\" && selector.length >= 3) {\n // Assume that strings that start and end with <> are HTML and skip the regex check\n match = [null, selector, null];\n } else {\n match = rquickExpr.exec(selector);\n } // Match html or make sure no context is specified for #id\n\n\n if (match && (match[1] || !context)) {\n // HANDLE: $(html) -> $(array)\n if (match[1]) {\n context = context instanceof jQuery ? context[0] : context; // Option to run scripts is true for back-compat\n // Intentionally let the error be thrown if parseHTML is not present\n\n jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true)); // HANDLE: $(html, props)\n\n if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {\n for (match in context) {\n // Properties of context are called as methods if possible\n if (isFunction(this[match])) {\n this[match](context[match]); // ...and otherwise set as attributes\n } else {\n this.attr(match, context[match]);\n }\n }\n }\n\n return this; // HANDLE: $(#id)\n } else {\n elem = document.getElementById(match[2]);\n\n if (elem) {\n // Inject the element directly into the jQuery object\n this[0] = elem;\n this.length = 1;\n }\n\n return this;\n } // HANDLE: $(expr, $(...))\n\n } else if (!context || context.jquery) {\n return (context || root).find(selector); // HANDLE: $(expr, context)\n // (which is just equivalent to: $(context).find(expr)\n } else {\n return this.constructor(context).find(selector);\n } // HANDLE: $(DOMElement)\n\n } else if (selector.nodeType) {\n this[0] = selector;\n this.length = 1;\n return this; // HANDLE: $(function)\n // Shortcut for document ready\n } else if (isFunction(selector)) {\n return root.ready !== undefined ? root.ready(selector) : // Execute immediately if ready is not present\n selector(jQuery);\n }\n\n return jQuery.makeArray(selector, this);\n }; // Give the init function the jQuery prototype for later instantiation\n\n\n init.prototype = jQuery.fn; // Initialize central reference\n\n rootjQuery = jQuery(document);\n var rparentsprev = /^(?:parents|prev(?:Until|All))/,\n // Methods guaranteed to produce a unique set when starting from a unique set\n guaranteedUnique = {\n children: true,\n contents: true,\n next: true,\n prev: true\n };\n jQuery.fn.extend({\n has: function has(target) {\n var targets = jQuery(target, this),\n l = targets.length;\n return this.filter(function () {\n var i = 0;\n\n for (; i < l; i++) {\n if (jQuery.contains(this, targets[i])) {\n return true;\n }\n }\n });\n },\n closest: function closest(selectors, context) {\n var cur,\n i = 0,\n l = this.length,\n matched = [],\n targets = typeof selectors !== \"string\" && jQuery(selectors); // Positional selectors never match, since there's no _selection_ context\n\n if (!rneedsContext.test(selectors)) {\n for (; i < l; i++) {\n for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {\n // Always skip document fragments\n if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : // Don't pass non-elements to Sizzle\n cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {\n matched.push(cur);\n break;\n }\n }\n }\n }\n\n return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);\n },\n // Determine the position of an element within the set\n index: function index(elem) {\n // No argument, return index in parent\n if (!elem) {\n return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;\n } // Index in selector\n\n\n if (typeof elem === \"string\") {\n return indexOf.call(jQuery(elem), this[0]);\n } // Locate the position of the desired element\n\n\n return indexOf.call(this, // If it receives a jQuery object, the first element is used\n elem.jquery ? elem[0] : elem);\n },\n add: function add(selector, context) {\n return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));\n },\n addBack: function addBack(selector) {\n return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));\n }\n });\n\n function sibling(cur, dir) {\n while ((cur = cur[dir]) && cur.nodeType !== 1) {}\n\n return cur;\n }\n\n jQuery.each({\n parent: function parent(elem) {\n var parent = elem.parentNode;\n return parent && parent.nodeType !== 11 ? parent : null;\n },\n parents: function parents(elem) {\n return dir(elem, \"parentNode\");\n },\n parentsUntil: function parentsUntil(elem, _i, until) {\n return dir(elem, \"parentNode\", until);\n },\n next: function next(elem) {\n return sibling(elem, \"nextSibling\");\n },\n prev: function prev(elem) {\n return sibling(elem, \"previousSibling\");\n },\n nextAll: function nextAll(elem) {\n return dir(elem, \"nextSibling\");\n },\n prevAll: function prevAll(elem) {\n return dir(elem, \"previousSibling\");\n },\n nextUntil: function nextUntil(elem, _i, until) {\n return dir(elem, \"nextSibling\", until);\n },\n prevUntil: function prevUntil(elem, _i, until) {\n return dir(elem, \"previousSibling\", until);\n },\n siblings: function siblings(elem) {\n return _siblings((elem.parentNode || {}).firstChild, elem);\n },\n children: function children(elem) {\n return _siblings(elem.firstChild);\n },\n contents: function contents(elem) {\n if (elem.contentDocument != null && // Support: IE 11+\n // elements with no `data` attribute has an object\n // `contentDocument` with a `null` prototype.\n getProto(elem.contentDocument)) {\n return elem.contentDocument;\n } // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only\n // Treat the template element as a regular one in browsers that\n // don't support it.\n\n\n if (nodeName(elem, \"template\")) {\n elem = elem.content || elem;\n }\n\n return jQuery.merge([], elem.childNodes);\n }\n }, function (name, fn) {\n jQuery.fn[name] = function (until, selector) {\n var matched = jQuery.map(this, fn, until);\n\n if (name.slice(-5) !== \"Until\") {\n selector = until;\n }\n\n if (selector && typeof selector === \"string\") {\n matched = jQuery.filter(selector, matched);\n }\n\n if (this.length > 1) {\n // Remove duplicates\n if (!guaranteedUnique[name]) {\n jQuery.uniqueSort(matched);\n } // Reverse order for parents* and prev-derivatives\n\n\n if (rparentsprev.test(name)) {\n matched.reverse();\n }\n }\n\n return this.pushStack(matched);\n };\n });\n var rnothtmlwhite = /[^\\x20\\t\\r\\n\\f]+/g; // Convert String-formatted options into Object-formatted ones\n\n function createOptions(options) {\n var object = {};\n jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {\n object[flag] = true;\n });\n return object;\n }\n /*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\n\n\n jQuery.Callbacks = function (options) {\n // Convert options from String-formatted to Object-formatted if needed\n // (we check in cache first)\n options = typeof options === \"string\" ? createOptions(options) : jQuery.extend({}, options);\n\n var // Flag to know if list is currently firing\n firing,\n // Last fire value for non-forgettable lists\n memory,\n // Flag to know if list was already fired\n _fired,\n // Flag to prevent firing\n _locked,\n // Actual callback list\n list = [],\n // Queue of execution data for repeatable lists\n queue = [],\n // Index of currently firing callback (modified by add/remove as needed)\n firingIndex = -1,\n // Fire callbacks\n fire = function fire() {\n // Enforce single-firing\n _locked = _locked || options.once; // Execute callbacks for all pending executions,\n // respecting firingIndex overrides and runtime changes\n\n _fired = firing = true;\n\n for (; queue.length; firingIndex = -1) {\n memory = queue.shift();\n\n while (++firingIndex < list.length) {\n // Run callback and check for early termination\n if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {\n // Jump to end and forget the data so .add doesn't re-fire\n firingIndex = list.length;\n memory = false;\n }\n }\n } // Forget the data if we're done with it\n\n\n if (!options.memory) {\n memory = false;\n }\n\n firing = false; // Clean up if we're done firing for good\n\n if (_locked) {\n // Keep an empty list if we have data for future add calls\n if (memory) {\n list = []; // Otherwise, this object is spent\n } else {\n list = \"\";\n }\n }\n },\n // Actual Callbacks object\n self = {\n // Add a callback or a collection of callbacks to the list\n add: function add() {\n if (list) {\n // If we have memory from a past run, we should fire after adding\n if (memory && !firing) {\n firingIndex = list.length - 1;\n queue.push(memory);\n }\n\n (function add(args) {\n jQuery.each(args, function (_, arg) {\n if (isFunction(arg)) {\n if (!options.unique || !self.has(arg)) {\n list.push(arg);\n }\n } else if (arg && arg.length && toType(arg) !== \"string\") {\n // Inspect recursively\n add(arg);\n }\n });\n })(arguments);\n\n if (memory && !firing) {\n fire();\n }\n }\n\n return this;\n },\n // Remove a callback from the list\n remove: function remove() {\n jQuery.each(arguments, function (_, arg) {\n var index;\n\n while ((index = jQuery.inArray(arg, list, index)) > -1) {\n list.splice(index, 1); // Handle firing indexes\n\n if (index <= firingIndex) {\n firingIndex--;\n }\n }\n });\n return this;\n },\n // Check if a given callback is in the list.\n // If no argument is given, return whether or not list has callbacks attached.\n has: function has(fn) {\n return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;\n },\n // Remove all callbacks from the list\n empty: function empty() {\n if (list) {\n list = [];\n }\n\n return this;\n },\n // Disable .fire and .add\n // Abort any current/pending executions\n // Clear all callbacks and values\n disable: function disable() {\n _locked = queue = [];\n list = memory = \"\";\n return this;\n },\n disabled: function disabled() {\n return !list;\n },\n // Disable .fire\n // Also disable .add unless we have memory (since it would have no effect)\n // Abort any pending executions\n lock: function lock() {\n _locked = queue = [];\n\n if (!memory && !firing) {\n list = memory = \"\";\n }\n\n return this;\n },\n locked: function locked() {\n return !!_locked;\n },\n // Call all callbacks with the given context and arguments\n fireWith: function fireWith(context, args) {\n if (!_locked) {\n args = args || [];\n args = [context, args.slice ? args.slice() : args];\n queue.push(args);\n\n if (!firing) {\n fire();\n }\n }\n\n return this;\n },\n // Call all the callbacks with the given arguments\n fire: function fire() {\n self.fireWith(this, arguments);\n return this;\n },\n // To know if the callbacks have already been called at least once\n fired: function fired() {\n return !!_fired;\n }\n };\n\n return self;\n };\n\n function Identity(v) {\n return v;\n }\n\n function Thrower(ex) {\n throw ex;\n }\n\n function adoptValue(value, resolve, reject, noValue) {\n var method;\n\n try {\n // Check for promise aspect first to privilege synchronous behavior\n if (value && isFunction(method = value.promise)) {\n method.call(value).done(resolve).fail(reject); // Other thenables\n } else if (value && isFunction(method = value.then)) {\n method.call(value, resolve, reject); // Other non-thenables\n } else {\n // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:\n // * false: [ value ].slice( 0 ) => resolve( value )\n // * true: [ value ].slice( 1 ) => resolve()\n resolve.apply(undefined, [value].slice(noValue));\n } // For Promises/A+, convert exceptions into rejections\n // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in\n // Deferred#then to conditionally suppress rejection.\n\n } catch (value) {\n // Support: Android 4.0 only\n // Strict mode functions invoked without .call/.apply get global-object context\n reject.apply(undefined, [value]);\n }\n }\n\n jQuery.extend({\n Deferred: function Deferred(func) {\n var tuples = [// action, add listener, callbacks,\n // ... .then handlers, argument index, [final state]\n [\"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\"]],\n _state = \"pending\",\n _promise = {\n state: function state() {\n return _state;\n },\n always: function always() {\n deferred.done(arguments).fail(arguments);\n return this;\n },\n \"catch\": function _catch(fn) {\n return _promise.then(null, fn);\n },\n // Keep pipe for back-compat\n pipe: function\n /* fnDone, fnFail, fnProgress */\n pipe() {\n var fns = arguments;\n return jQuery.Deferred(function (newDefer) {\n jQuery.each(tuples, function (_i, tuple) {\n // Map tuples (progress, done, fail) to arguments (done, fail, progress)\n var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]]; // deferred.progress(function() { bind to newDefer or newDefer.notify })\n // deferred.done(function() { bind to newDefer or newDefer.resolve })\n // deferred.fail(function() { bind to newDefer or newDefer.reject })\n\n deferred[tuple[1]](function () {\n var returned = fn && fn.apply(this, arguments);\n\n if (returned && isFunction(returned.promise)) {\n returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);\n } else {\n newDefer[tuple[0] + \"With\"](this, fn ? [returned] : arguments);\n }\n });\n });\n fns = null;\n }).promise();\n },\n then: function then(onFulfilled, onRejected, onProgress) {\n var maxDepth = 0;\n\n function resolve(depth, deferred, handler, special) {\n return function () {\n var that = this,\n args = arguments,\n mightThrow = function mightThrow() {\n var returned, then; // Support: Promises/A+ section 2.3.3.3.3\n // https://promisesaplus.com/#point-59\n // Ignore double-resolution attempts\n\n if (depth < maxDepth) {\n return;\n }\n\n returned = handler.apply(that, args); // Support: Promises/A+ section 2.3.1\n // https://promisesaplus.com/#point-48\n\n if (returned === deferred.promise()) {\n throw new TypeError(\"Thenable self-resolution\");\n } // Support: Promises/A+ sections 2.3.3.1, 3.5\n // https://promisesaplus.com/#point-54\n // https://promisesaplus.com/#point-75\n // Retrieve `then` only once\n\n\n then = returned && ( // Support: Promises/A+ section 2.3.4\n // https://promisesaplus.com/#point-64\n // Only check objects and functions for thenability\n _typeof(returned) === \"object\" || typeof returned === \"function\") && returned.then; // Handle a returned thenable\n\n if (isFunction(then)) {\n // Special processors (notify) just wait for resolution\n if (special) {\n then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special)); // Normal processors (resolve) also hook into progress\n } else {\n // ...and disregard older resolution values\n maxDepth++;\n then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));\n } // Handle all other returned values\n\n } else {\n // Only substitute handlers pass on context\n // and multiple values (non-spec behavior)\n if (handler !== Identity) {\n that = undefined;\n args = [returned];\n } // Process the value(s)\n // Default process is resolve\n\n\n (special || deferred.resolveWith)(that, args);\n }\n },\n // Only normal processors (resolve) catch and reject exceptions\n process = special ? mightThrow : function () {\n try {\n mightThrow();\n } catch (e) {\n if (jQuery.Deferred.exceptionHook) {\n jQuery.Deferred.exceptionHook(e, process.stackTrace);\n } // Support: Promises/A+ section 2.3.3.3.4.1\n // https://promisesaplus.com/#point-61\n // Ignore post-resolution exceptions\n\n\n if (depth + 1 >= maxDepth) {\n // Only substitute handlers pass on context\n // and multiple values (non-spec behavior)\n if (handler !== Thrower) {\n that = undefined;\n args = [e];\n }\n\n deferred.rejectWith(that, args);\n }\n }\n }; // Support: Promises/A+ section 2.3.3.3.1\n // https://promisesaplus.com/#point-57\n // Re-resolve promises immediately to dodge false rejection from\n // subsequent errors\n\n\n if (depth) {\n process();\n } else {\n // Call an optional hook to record the stack, in case of exception\n // since it's otherwise lost when execution goes async\n if (jQuery.Deferred.getStackHook) {\n process.stackTrace = jQuery.Deferred.getStackHook();\n }\n\n window.setTimeout(process);\n }\n };\n }\n\n return jQuery.Deferred(function (newDefer) {\n // progress_handlers.add( ... )\n tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith)); // fulfilled_handlers.add( ... )\n\n tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity)); // rejected_handlers.add( ... )\n\n tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));\n }).promise();\n },\n // Get a promise for this deferred\n // If obj is provided, the promise aspect is added to the object\n promise: function promise(obj) {\n return obj != null ? jQuery.extend(obj, _promise) : _promise;\n }\n },\n deferred = {}; // Add list-specific methods\n\n jQuery.each(tuples, function (i, tuple) {\n var list = tuple[2],\n stateString = tuple[5]; // promise.progress = list.add\n // promise.done = list.add\n // promise.fail = list.add\n\n _promise[tuple[1]] = list.add; // Handle state\n\n if (stateString) {\n list.add(function () {\n // state = \"resolved\" (i.e., fulfilled)\n // state = \"rejected\"\n _state = stateString;\n }, // rejected_callbacks.disable\n // fulfilled_callbacks.disable\n tuples[3 - i][2].disable, // rejected_handlers.disable\n // fulfilled_handlers.disable\n tuples[3 - i][3].disable, // progress_callbacks.lock\n tuples[0][2].lock, // progress_handlers.lock\n tuples[0][3].lock);\n } // progress_handlers.fire\n // fulfilled_handlers.fire\n // rejected_handlers.fire\n\n\n list.add(tuple[3].fire); // deferred.notify = function() { deferred.notifyWith(...) }\n // deferred.resolve = function() { deferred.resolveWith(...) }\n // deferred.reject = function() { deferred.rejectWith(...) }\n\n deferred[tuple[0]] = function () {\n deferred[tuple[0] + \"With\"](this === deferred ? undefined : this, arguments);\n return this;\n }; // deferred.notifyWith = list.fireWith\n // deferred.resolveWith = list.fireWith\n // deferred.rejectWith = list.fireWith\n\n\n deferred[tuple[0] + \"With\"] = list.fireWith;\n }); // Make the deferred a promise\n\n _promise.promise(deferred); // Call given func if any\n\n\n if (func) {\n func.call(deferred, deferred);\n } // All done!\n\n\n return deferred;\n },\n // Deferred helper\n when: function when(singleValue) {\n var // count of uncompleted subordinates\n remaining = arguments.length,\n // count of unprocessed arguments\n i = remaining,\n // subordinate fulfillment data\n resolveContexts = Array(i),\n resolveValues = _slice.call(arguments),\n // the primary Deferred\n primary = jQuery.Deferred(),\n // subordinate callback factory\n updateFunc = function updateFunc(i) {\n return function (value) {\n resolveContexts[i] = this;\n resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;\n\n if (! --remaining) {\n primary.resolveWith(resolveContexts, resolveValues);\n }\n };\n }; // Single- and empty arguments are adopted like Promise.resolve\n\n\n if (remaining <= 1) {\n adoptValue(singleValue, primary.done(updateFunc(i)).resolve, primary.reject, !remaining); // Use .then() to unwrap secondary thenables (cf. gh-3000)\n\n if (primary.state() === \"pending\" || isFunction(resolveValues[i] && resolveValues[i].then)) {\n return primary.then();\n }\n } // Multiple arguments are aggregated like Promise.all array elements\n\n\n while (i--) {\n adoptValue(resolveValues[i], updateFunc(i), primary.reject);\n }\n\n return primary.promise();\n }\n }); // These usually indicate a programmer mistake during development,\n // warn about them ASAP rather than swallowing them by default.\n\n var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;\n\n jQuery.Deferred.exceptionHook = function (error, stack) {\n // Support: IE 8 - 9 only\n // Console exists when dev tools are open, which can happen at any time\n if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {\n window.console.warn(\"jQuery.Deferred exception: \" + error.message, error.stack, stack);\n }\n };\n\n jQuery.readyException = function (error) {\n window.setTimeout(function () {\n throw error;\n });\n }; // The deferred used on DOM ready\n\n\n var readyList = jQuery.Deferred();\n\n jQuery.fn.ready = function (fn) {\n readyList.then(fn) // Wrap jQuery.readyException in a function so that the lookup\n // happens at the time of error handling instead of callback\n // registration.\n .catch(function (error) {\n jQuery.readyException(error);\n });\n return this;\n };\n\n jQuery.extend({\n // Is the DOM ready to be used? Set to true once it occurs.\n isReady: false,\n // A counter to track how many items to wait for before\n // the ready event fires. See #6781\n readyWait: 1,\n // Handle when the DOM is ready\n ready: function ready(wait) {\n // Abort if there are pending holds or we're already ready\n if (wait === true ? --jQuery.readyWait : jQuery.isReady) {\n return;\n } // Remember that the DOM is ready\n\n\n jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be\n\n if (wait !== true && --jQuery.readyWait > 0) {\n return;\n } // If there are functions bound, to execute\n\n\n readyList.resolveWith(document, [jQuery]);\n }\n });\n jQuery.ready.then = readyList.then; // The ready event handler and self cleanup method\n\n function completed() {\n document.removeEventListener(\"DOMContentLoaded\", completed);\n window.removeEventListener(\"load\", completed);\n jQuery.ready();\n } // Catch cases where $(document).ready() is called\n // after the browser event has already occurred.\n // Support: IE <=9 - 10 only\n // Older IE sometimes signals \"interactive\" too soon\n\n\n if (document.readyState === \"complete\" || document.readyState !== \"loading\" && !document.documentElement.doScroll) {\n // Handle it asynchronously to allow scripts the opportunity to delay ready\n window.setTimeout(jQuery.ready);\n } else {\n // Use the handy event callback\n document.addEventListener(\"DOMContentLoaded\", completed); // A fallback to window.onload, that will always work\n\n window.addEventListener(\"load\", completed);\n } // Multifunctional method to get and set values of a collection\n // The value/s can optionally be executed if it's a function\n\n\n var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {\n var i = 0,\n len = elems.length,\n bulk = key == null; // Sets many values\n\n if (toType(key) === \"object\") {\n chainable = true;\n\n for (i in key) {\n access(elems, fn, i, key[i], true, emptyGet, raw);\n } // Sets one value\n\n } else if (value !== undefined) {\n chainable = true;\n\n if (!isFunction(value)) {\n raw = true;\n }\n\n if (bulk) {\n // Bulk operations run against the entire set\n if (raw) {\n fn.call(elems, value);\n fn = null; // ...except when executing function values\n } else {\n bulk = fn;\n\n fn = function fn(elem, _key, value) {\n return bulk.call(jQuery(elem), value);\n };\n }\n }\n\n if (fn) {\n for (; i < len; i++) {\n fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));\n }\n }\n }\n\n if (chainable) {\n return elems;\n } // Gets\n\n\n if (bulk) {\n return fn.call(elems);\n }\n\n return len ? fn(elems[0], key) : emptyGet;\n }; // Matches dashed string for camelizing\n\n\n var rmsPrefix = /^-ms-/,\n rdashAlpha = /-([a-z])/g; // Used by camelCase as callback to replace()\n\n function fcamelCase(_all, letter) {\n return letter.toUpperCase();\n } // Convert dashed to camelCase; used by the css and data modules\n // Support: IE <=9 - 11, Edge 12 - 15\n // Microsoft forgot to hump their vendor prefix (#9572)\n\n\n function camelCase(string) {\n return string.replace(rmsPrefix, \"ms-\").replace(rdashAlpha, fcamelCase);\n }\n\n var acceptData = function acceptData(owner) {\n // Accepts only:\n // - Node\n // - Node.ELEMENT_NODE\n // - Node.DOCUMENT_NODE\n // - Object\n // - Any\n return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;\n };\n\n function Data() {\n this.expando = jQuery.expando + Data.uid++;\n }\n\n Data.uid = 1;\n Data.prototype = {\n cache: function cache(owner) {\n // Check if the owner object already has a cache\n var value = owner[this.expando]; // If not, create one\n\n if (!value) {\n value = {}; // We can accept data for non-element nodes in modern browsers,\n // but we should not, see #8335.\n // Always return an empty object.\n\n if (acceptData(owner)) {\n // If it is a node unlikely to be stringify-ed or looped over\n // use plain assignment\n if (owner.nodeType) {\n owner[this.expando] = value; // Otherwise secure it in a non-enumerable property\n // configurable must be true to allow the property to be\n // deleted when data is removed\n } else {\n Object.defineProperty(owner, this.expando, {\n value: value,\n configurable: true\n });\n }\n }\n }\n\n return value;\n },\n set: function set(owner, data, value) {\n var prop,\n cache = this.cache(owner); // Handle: [ owner, key, value ] args\n // Always use camelCase key (gh-2257)\n\n if (typeof data === \"string\") {\n cache[camelCase(data)] = value; // Handle: [ owner, { properties } ] args\n } else {\n // Copy the properties one-by-one to the cache object\n for (prop in data) {\n cache[camelCase(prop)] = data[prop];\n }\n }\n\n return cache;\n },\n get: function get(owner, key) {\n return key === undefined ? this.cache(owner) : // Always use camelCase key (gh-2257)\n owner[this.expando] && owner[this.expando][camelCase(key)];\n },\n access: function access(owner, key, value) {\n // In cases where either:\n //\n // 1. No key was specified\n // 2. A string key was specified, but no value provided\n //\n // Take the \"read\" path and allow the get method to determine\n // which value to return, respectively either:\n //\n // 1. The entire cache object\n // 2. The data stored at the key\n //\n if (key === undefined || key && typeof key === \"string\" && value === undefined) {\n return this.get(owner, key);\n } // When the key is not a string, or both a key and value\n // are specified, set or extend (existing objects) with either:\n //\n // 1. An object of properties\n // 2. A key and value\n //\n\n\n this.set(owner, key, value); // Since the \"set\" path can have two possible entry points\n // return the expected data based on which path was taken[*]\n\n return value !== undefined ? value : key;\n },\n remove: function remove(owner, key) {\n var i,\n cache = owner[this.expando];\n\n if (cache === undefined) {\n return;\n }\n\n if (key !== undefined) {\n // Support array or space separated string of keys\n if (Array.isArray(key)) {\n // If key is an array of keys...\n // We always set camelCase keys, so remove that.\n key = key.map(camelCase);\n } else {\n key = camelCase(key); // If a key with the spaces exists, use it.\n // Otherwise, create an array by matching non-whitespace\n\n key = key in cache ? [key] : key.match(rnothtmlwhite) || [];\n }\n\n i = key.length;\n\n while (i--) {\n delete cache[key[i]];\n }\n } // Remove the expando if there's no more data\n\n\n if (key === undefined || jQuery.isEmptyObject(cache)) {\n // Support: Chrome <=35 - 45\n // Webkit & Blink performance suffers when deleting properties\n // from DOM nodes, so set to undefined instead\n // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)\n if (owner.nodeType) {\n owner[this.expando] = undefined;\n } else {\n delete owner[this.expando];\n }\n }\n },\n hasData: function hasData(owner) {\n var cache = owner[this.expando];\n return cache !== undefined && !jQuery.isEmptyObject(cache);\n }\n };\n var dataPriv = new Data();\n var dataUser = new Data(); //\tImplementation Summary\n //\n //\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n //\t2. Improve the module's maintainability by reducing the storage\n //\t\tpaths to a single mechanism.\n //\t3. Use the same single mechanism to support \"private\" and \"user\" data.\n //\t4. _Never_ expose \"private\" data to user code (TODO: Drop _data, _removeData)\n //\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n //\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n\n var rbrace = /^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,\n rmultiDash = /[A-Z]/g;\n\n function getData(data) {\n if (data === \"true\") {\n return true;\n }\n\n if (data === \"false\") {\n return false;\n }\n\n if (data === \"null\") {\n return null;\n } // Only convert to a number if it doesn't change the string\n\n\n if (data === +data + \"\") {\n return +data;\n }\n\n if (rbrace.test(data)) {\n return JSON.parse(data);\n }\n\n return data;\n }\n\n function dataAttr(elem, key, data) {\n var name; // If nothing was found internally, try to fetch any\n // data from the HTML5 data-* attribute\n\n if (data === undefined && elem.nodeType === 1) {\n name = \"data-\" + key.replace(rmultiDash, \"-$&\").toLowerCase();\n data = elem.getAttribute(name);\n\n if (typeof data === \"string\") {\n try {\n data = getData(data);\n } catch (e) {} // Make sure we set the data so it isn't changed later\n\n\n dataUser.set(elem, key, data);\n } else {\n data = undefined;\n }\n }\n\n return data;\n }\n\n jQuery.extend({\n hasData: function hasData(elem) {\n return dataUser.hasData(elem) || dataPriv.hasData(elem);\n },\n data: function data(elem, name, _data) {\n return dataUser.access(elem, name, _data);\n },\n removeData: function removeData(elem, name) {\n dataUser.remove(elem, name);\n },\n // TODO: Now that all calls to _data and _removeData have been replaced\n // with direct calls to dataPriv methods, these can be deprecated.\n _data: function _data(elem, name, data) {\n return dataPriv.access(elem, name, data);\n },\n _removeData: function _removeData(elem, name) {\n dataPriv.remove(elem, name);\n }\n });\n jQuery.fn.extend({\n data: function data(key, value) {\n var i,\n name,\n data,\n elem = this[0],\n attrs = elem && elem.attributes; // Gets all values\n\n if (key === undefined) {\n if (this.length) {\n data = dataUser.get(elem);\n\n if (elem.nodeType === 1 && !dataPriv.get(elem, \"hasDataAttrs\")) {\n i = attrs.length;\n\n while (i--) {\n // Support: IE 11 only\n // The attrs elements can be null (#14894)\n if (attrs[i]) {\n name = attrs[i].name;\n\n if (name.indexOf(\"data-\") === 0) {\n name = camelCase(name.slice(5));\n dataAttr(elem, name, data[name]);\n }\n }\n }\n\n dataPriv.set(elem, \"hasDataAttrs\", true);\n }\n }\n\n return data;\n } // Sets multiple values\n\n\n if (_typeof(key) === \"object\") {\n return this.each(function () {\n dataUser.set(this, key);\n });\n }\n\n return access(this, function (value) {\n var data; // The calling jQuery object (element matches) is not empty\n // (and therefore has an element appears at this[ 0 ]) and the\n // `value` parameter was not undefined. An empty jQuery object\n // will result in `undefined` for elem = this[ 0 ] which will\n // throw an exception if an attempt to read a data cache is made.\n\n if (elem && value === undefined) {\n // Attempt to get data from the cache\n // The key will always be camelCased in Data\n data = dataUser.get(elem, key);\n\n if (data !== undefined) {\n return data;\n } // Attempt to \"discover\" the data in\n // HTML5 custom data-* attrs\n\n\n data = dataAttr(elem, key);\n\n if (data !== undefined) {\n return data;\n } // We tried really hard, but the data doesn't exist.\n\n\n return;\n } // Set the data...\n\n\n this.each(function () {\n // We always store the camelCased key\n dataUser.set(this, key, value);\n });\n }, null, value, arguments.length > 1, null, true);\n },\n removeData: function removeData(key) {\n return this.each(function () {\n dataUser.remove(this, key);\n });\n }\n });\n jQuery.extend({\n queue: function queue(elem, type, data) {\n var queue;\n\n if (elem) {\n type = (type || \"fx\") + \"queue\";\n queue = dataPriv.get(elem, type); // Speed up dequeue by getting out quickly if this is just a lookup\n\n if (data) {\n if (!queue || Array.isArray(data)) {\n queue = dataPriv.access(elem, type, jQuery.makeArray(data));\n } else {\n queue.push(data);\n }\n }\n\n return queue || [];\n }\n },\n dequeue: function dequeue(elem, type) {\n type = type || \"fx\";\n\n var queue = jQuery.queue(elem, type),\n startLength = queue.length,\n fn = queue.shift(),\n hooks = jQuery._queueHooks(elem, type),\n next = function next() {\n jQuery.dequeue(elem, type);\n }; // If the fx queue is dequeued, always remove the progress sentinel\n\n\n if (fn === \"inprogress\") {\n fn = queue.shift();\n startLength--;\n }\n\n if (fn) {\n // Add a progress sentinel to prevent the fx queue from being\n // automatically dequeued\n if (type === \"fx\") {\n queue.unshift(\"inprogress\");\n } // Clear up the last queue stop function\n\n\n delete hooks.stop;\n fn.call(elem, next, hooks);\n }\n\n if (!startLength && hooks) {\n hooks.empty.fire();\n }\n },\n // Not public - generate a queueHooks object, or return the current one\n _queueHooks: function _queueHooks(elem, type) {\n var key = type + \"queueHooks\";\n return dataPriv.get(elem, key) || dataPriv.access(elem, key, {\n empty: jQuery.Callbacks(\"once memory\").add(function () {\n dataPriv.remove(elem, [type + \"queue\", key]);\n })\n });\n }\n });\n jQuery.fn.extend({\n queue: function queue(type, data) {\n var setter = 2;\n\n if (typeof type !== \"string\") {\n data = type;\n type = \"fx\";\n setter--;\n }\n\n if (arguments.length < setter) {\n return jQuery.queue(this[0], type);\n }\n\n return data === undefined ? this : this.each(function () {\n var queue = jQuery.queue(this, type, data); // Ensure a hooks for this queue\n\n jQuery._queueHooks(this, type);\n\n if (type === \"fx\" && queue[0] !== \"inprogress\") {\n jQuery.dequeue(this, type);\n }\n });\n },\n dequeue: function dequeue(type) {\n return this.each(function () {\n jQuery.dequeue(this, type);\n });\n },\n clearQueue: function clearQueue(type) {\n return this.queue(type || \"fx\", []);\n },\n // Get a promise resolved when queues of a certain type\n // are emptied (fx is the type by default)\n promise: function promise(type, obj) {\n var tmp,\n count = 1,\n defer = jQuery.Deferred(),\n elements = this,\n i = this.length,\n resolve = function resolve() {\n if (! --count) {\n defer.resolveWith(elements, [elements]);\n }\n };\n\n if (typeof type !== \"string\") {\n obj = type;\n type = undefined;\n }\n\n type = type || \"fx\";\n\n while (i--) {\n tmp = dataPriv.get(elements[i], type + \"queueHooks\");\n\n if (tmp && tmp.empty) {\n count++;\n tmp.empty.add(resolve);\n }\n }\n\n resolve();\n return defer.promise(obj);\n }\n });\n var pnum = /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source;\n var rcssNum = new RegExp(\"^(?:([+-])=|)(\" + pnum + \")([a-z%]*)$\", \"i\");\n var cssExpand = [\"Top\", \"Right\", \"Bottom\", \"Left\"];\n var documentElement = document.documentElement;\n\n var isAttached = function isAttached(elem) {\n return jQuery.contains(elem.ownerDocument, elem);\n },\n composed = {\n composed: true\n }; // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only\n // Check attachment across shadow DOM boundaries when possible (gh-3504)\n // Support: iOS 10.0-10.2 only\n // Early iOS 10 versions support `attachShadow` but not `getRootNode`,\n // leading to errors. We need to check for `getRootNode`.\n\n\n if (documentElement.getRootNode) {\n isAttached = function isAttached(elem) {\n return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument;\n };\n }\n\n var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {\n // isHiddenWithinTree might be called from jQuery#filter function;\n // in that case, element will be second argument\n elem = el || elem; // Inline style trumps all\n\n return elem.style.display === \"none\" || elem.style.display === \"\" && // Otherwise, check computed style\n // Support: Firefox <=43 - 45\n // Disconnected elements can have computed display: none, so first confirm that elem is\n // in the document.\n isAttached(elem) && jQuery.css(elem, \"display\") === \"none\";\n };\n\n function adjustCSS(elem, prop, valueParts, tween) {\n var adjusted,\n scale,\n maxIterations = 20,\n currentValue = tween ? function () {\n return tween.cur();\n } : function () {\n return jQuery.css(elem, prop, \"\");\n },\n initial = currentValue(),\n unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? \"\" : \"px\"),\n // Starting value computation is required for potential unit mismatches\n initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== \"px\" && +initial) && rcssNum.exec(jQuery.css(elem, prop));\n\n if (initialInUnit && initialInUnit[3] !== unit) {\n // Support: Firefox <=54\n // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)\n initial = initial / 2; // Trust units reported by jQuery.css\n\n unit = unit || initialInUnit[3]; // Iteratively approximate from a nonzero starting point\n\n initialInUnit = +initial || 1;\n\n while (maxIterations--) {\n // Evaluate and update our best guess (doubling guesses that zero out).\n // Finish if the scale equals or crosses 1 (making the old*new product non-positive).\n jQuery.style(elem, prop, initialInUnit + unit);\n\n if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {\n maxIterations = 0;\n }\n\n initialInUnit = initialInUnit / scale;\n }\n\n initialInUnit = initialInUnit * 2;\n jQuery.style(elem, prop, initialInUnit + unit); // Make sure we update the tween properties later on\n\n valueParts = valueParts || [];\n }\n\n if (valueParts) {\n initialInUnit = +initialInUnit || +initial || 0; // Apply relative offset (+=/-=) if specified\n\n adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];\n\n if (tween) {\n tween.unit = unit;\n tween.start = initialInUnit;\n tween.end = adjusted;\n }\n }\n\n return adjusted;\n }\n\n var defaultDisplayMap = {};\n\n function getDefaultDisplay(elem) {\n var temp,\n doc = elem.ownerDocument,\n nodeName = elem.nodeName,\n display = defaultDisplayMap[nodeName];\n\n if (display) {\n return display;\n }\n\n temp = doc.body.appendChild(doc.createElement(nodeName));\n display = jQuery.css(temp, \"display\");\n temp.parentNode.removeChild(temp);\n\n if (display === \"none\") {\n display = \"block\";\n }\n\n defaultDisplayMap[nodeName] = display;\n return display;\n }\n\n function showHide(elements, show) {\n var display,\n elem,\n values = [],\n index = 0,\n length = elements.length; // Determine new display value for elements that need to change\n\n for (; index < length; index++) {\n elem = elements[index];\n\n if (!elem.style) {\n continue;\n }\n\n display = elem.style.display;\n\n if (show) {\n // Since we force visibility upon cascade-hidden elements, an immediate (and slow)\n // check is required in this first loop unless we have a nonempty display value (either\n // inline or about-to-be-restored)\n if (display === \"none\") {\n values[index] = dataPriv.get(elem, \"display\") || null;\n\n if (!values[index]) {\n elem.style.display = \"\";\n }\n }\n\n if (elem.style.display === \"\" && isHiddenWithinTree(elem)) {\n values[index] = getDefaultDisplay(elem);\n }\n } else {\n if (display !== \"none\") {\n values[index] = \"none\"; // Remember what we're overwriting\n\n dataPriv.set(elem, \"display\", display);\n }\n }\n } // Set the display of the elements in a second loop to avoid constant reflow\n\n\n for (index = 0; index < length; index++) {\n if (values[index] != null) {\n elements[index].style.display = values[index];\n }\n }\n\n return elements;\n }\n\n jQuery.fn.extend({\n show: function show() {\n return showHide(this, true);\n },\n hide: function hide() {\n return showHide(this);\n },\n toggle: function toggle(state) {\n if (typeof state === \"boolean\") {\n return state ? this.show() : this.hide();\n }\n\n return this.each(function () {\n if (isHiddenWithinTree(this)) {\n jQuery(this).show();\n } else {\n jQuery(this).hide();\n }\n });\n }\n });\n var rcheckableType = /^(?:checkbox|radio)$/i;\n var rtagName = /<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i;\n var rscriptType = /^$|^module$|\\/(?:java|ecma)script/i;\n\n (function () {\n var fragment = document.createDocumentFragment(),\n div = fragment.appendChild(document.createElement(\"div\")),\n input = document.createElement(\"input\"); // Support: Android 4.0 - 4.3 only\n // Check state lost if the name is set (#11217)\n // Support: Windows Web Apps (WWA)\n // `name` and `type` must use .setAttribute for WWA (#14901)\n\n input.setAttribute(\"type\", \"radio\");\n input.setAttribute(\"checked\", \"checked\");\n input.setAttribute(\"name\", \"t\");\n div.appendChild(input); // Support: Android <=4.1 only\n // Older WebKit doesn't clone checked state correctly in fragments\n\n support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; // Support: IE <=11 only\n // Make sure textarea (and checkbox) defaultValue is properly cloned\n\n div.innerHTML = \"\";\n support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; // Support: IE <=9 only\n // IE <=9 replaces \";\n support.option = !!div.lastChild;\n })(); // We have to close these tags to support XHTML (#13200)\n\n\n var wrapMap = {\n // XHTML parsers do not magically insert elements in the\n // same way that tag soup parsers do. So we cannot shorten\n // this by omitting or other required elements.\n thead: [1, \"\", \"
        \"],\n col: [2, \"\", \"
        \"],\n tr: [2, \"\", \"
        \"],\n td: [3, \"\", \"
        \"],\n _default: [0, \"\", \"\"]\n };\n wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n wrapMap.th = wrapMap.td; // Support: IE <=9 only\n\n if (!support.option) {\n wrapMap.optgroup = wrapMap.option = [1, \"\"];\n }\n\n function getAll(context, tag) {\n // Support: IE <=9 - 11 only\n // Use typeof to avoid zero-argument method invocation on host objects (#15151)\n var ret;\n\n if (typeof context.getElementsByTagName !== \"undefined\") {\n ret = context.getElementsByTagName(tag || \"*\");\n } else if (typeof context.querySelectorAll !== \"undefined\") {\n ret = context.querySelectorAll(tag || \"*\");\n } else {\n ret = [];\n }\n\n if (tag === undefined || tag && nodeName(context, tag)) {\n return jQuery.merge([context], ret);\n }\n\n return ret;\n } // Mark scripts as having already been evaluated\n\n\n function setGlobalEval(elems, refElements) {\n var i = 0,\n l = elems.length;\n\n for (; i < l; i++) {\n dataPriv.set(elems[i], \"globalEval\", !refElements || dataPriv.get(refElements[i], \"globalEval\"));\n }\n }\n\n var rhtml = /<|&#?\\w+;/;\n\n function buildFragment(elems, context, scripts, selection, ignored) {\n var elem,\n tmp,\n tag,\n wrap,\n attached,\n j,\n fragment = context.createDocumentFragment(),\n nodes = [],\n i = 0,\n l = elems.length;\n\n for (; i < l; i++) {\n elem = elems[i];\n\n if (elem || elem === 0) {\n // Add nodes directly\n if (toType(elem) === \"object\") {\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n jQuery.merge(nodes, elem.nodeType ? [elem] : elem); // Convert non-html into a text node\n } else if (!rhtml.test(elem)) {\n nodes.push(context.createTextNode(elem)); // Convert html into DOM nodes\n } else {\n tmp = tmp || fragment.appendChild(context.createElement(\"div\")); // Deserialize a standard representation\n\n tag = (rtagName.exec(elem) || [\"\", \"\"])[1].toLowerCase();\n wrap = wrapMap[tag] || wrapMap._default;\n tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2]; // Descend through wrappers to the right content\n\n j = wrap[0];\n\n while (j--) {\n tmp = tmp.lastChild;\n } // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n\n\n jQuery.merge(nodes, tmp.childNodes); // Remember the top-level container\n\n tmp = fragment.firstChild; // Ensure the created nodes are orphaned (#12392)\n\n tmp.textContent = \"\";\n }\n }\n } // Remove wrapper from fragment\n\n\n fragment.textContent = \"\";\n i = 0;\n\n while (elem = nodes[i++]) {\n // Skip elements already in the context collection (trac-4087)\n if (selection && jQuery.inArray(elem, selection) > -1) {\n if (ignored) {\n ignored.push(elem);\n }\n\n continue;\n }\n\n attached = isAttached(elem); // Append to fragment\n\n tmp = getAll(fragment.appendChild(elem), \"script\"); // Preserve script evaluation history\n\n if (attached) {\n setGlobalEval(tmp);\n } // Capture executables\n\n\n if (scripts) {\n j = 0;\n\n while (elem = tmp[j++]) {\n if (rscriptType.test(elem.type || \"\")) {\n scripts.push(elem);\n }\n }\n }\n }\n\n return fragment;\n }\n\n var rtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n\n function returnTrue() {\n return true;\n }\n\n function returnFalse() {\n return false;\n } // Support: IE <=9 - 11+\n // focus() and blur() are asynchronous, except when they are no-op.\n // So expect focus to be synchronous when the element is already active,\n // and blur to be synchronous when the element is not already active.\n // (focus and blur are always synchronous in other supported browsers,\n // this just defines when we can count on it).\n\n\n function expectSync(elem, type) {\n return elem === safeActiveElement() === (type === \"focus\");\n } // Support: IE <=9 only\n // Accessing document.activeElement can throw unexpectedly\n // https://bugs.jquery.com/ticket/13393\n\n\n function safeActiveElement() {\n try {\n return document.activeElement;\n } catch (err) {}\n }\n\n function _on(elem, types, selector, data, fn, one) {\n var origFn, type; // Types can be a map of types/handlers\n\n if (_typeof(types) === \"object\") {\n // ( types-Object, selector, data )\n if (typeof selector !== \"string\") {\n // ( types-Object, data )\n data = data || selector;\n selector = undefined;\n }\n\n for (type in types) {\n _on(elem, type, selector, data, types[type], one);\n }\n\n return elem;\n }\n\n if (data == null && fn == null) {\n // ( types, fn )\n fn = selector;\n data = selector = undefined;\n } else if (fn == null) {\n if (typeof selector === \"string\") {\n // ( types, selector, fn )\n fn = data;\n data = undefined;\n } else {\n // ( types, data, fn )\n fn = data;\n data = selector;\n selector = undefined;\n }\n }\n\n if (fn === false) {\n fn = returnFalse;\n } else if (!fn) {\n return elem;\n }\n\n if (one === 1) {\n origFn = fn;\n\n fn = function fn(event) {\n // Can use an empty set, since event contains the info\n jQuery().off(event);\n return origFn.apply(this, arguments);\n }; // Use same guid so caller can remove using origFn\n\n\n fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);\n }\n\n return elem.each(function () {\n jQuery.event.add(this, types, fn, data, selector);\n });\n }\n /*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards' addEvent library for many of the ideas.\n */\n\n\n jQuery.event = {\n global: {},\n add: function add(elem, types, handler, data, selector) {\n var handleObjIn,\n eventHandle,\n tmp,\n events,\n t,\n handleObj,\n special,\n handlers,\n type,\n namespaces,\n origType,\n elemData = dataPriv.get(elem); // Only attach events to objects that accept data\n\n if (!acceptData(elem)) {\n return;\n } // Caller can pass in an object of custom data in lieu of the handler\n\n\n if (handler.handler) {\n handleObjIn = handler;\n handler = handleObjIn.handler;\n selector = handleObjIn.selector;\n } // Ensure that invalid selectors throw exceptions at attach time\n // Evaluate against documentElement in case elem is a non-element node (e.g., document)\n\n\n if (selector) {\n jQuery.find.matchesSelector(documentElement, selector);\n } // Make sure that the handler has a unique ID, used to find/remove it later\n\n\n if (!handler.guid) {\n handler.guid = jQuery.guid++;\n } // Init the element's event structure and main handler, if this is the first\n\n\n if (!(events = elemData.events)) {\n events = elemData.events = Object.create(null);\n }\n\n if (!(eventHandle = elemData.handle)) {\n eventHandle = elemData.handle = function (e) {\n // Discard the second event of a jQuery.event.trigger() and\n // when an event is called after a page has unloaded\n return typeof jQuery !== \"undefined\" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;\n };\n } // Handle multiple events separated by a space\n\n\n types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n t = types.length;\n\n while (t--) {\n tmp = rtypenamespace.exec(types[t]) || [];\n type = origType = tmp[1];\n namespaces = (tmp[2] || \"\").split(\".\").sort(); // There *must* be a type, no attaching namespace-only handlers\n\n if (!type) {\n continue;\n } // If event changes its type, use the special event handlers for the changed type\n\n\n special = jQuery.event.special[type] || {}; // If selector defined, determine special event api type, otherwise given type\n\n type = (selector ? special.delegateType : special.bindType) || type; // Update special based on newly reset type\n\n special = jQuery.event.special[type] || {}; // handleObj is passed to all event handlers\n\n handleObj = jQuery.extend({\n type: type,\n origType: origType,\n data: data,\n handler: handler,\n guid: handler.guid,\n selector: selector,\n needsContext: selector && jQuery.expr.match.needsContext.test(selector),\n namespace: namespaces.join(\".\")\n }, handleObjIn); // Init the event handler queue if we're the first\n\n if (!(handlers = events[type])) {\n handlers = events[type] = [];\n handlers.delegateCount = 0; // Only use addEventListener if the special events handler returns false\n\n if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {\n if (elem.addEventListener) {\n elem.addEventListener(type, eventHandle);\n }\n }\n }\n\n if (special.add) {\n special.add.call(elem, handleObj);\n\n if (!handleObj.handler.guid) {\n handleObj.handler.guid = handler.guid;\n }\n } // Add to the element's handler list, delegates in front\n\n\n if (selector) {\n handlers.splice(handlers.delegateCount++, 0, handleObj);\n } else {\n handlers.push(handleObj);\n } // Keep track of which events have ever been used, for event optimization\n\n\n jQuery.event.global[type] = true;\n }\n },\n // Detach an event or set of events from an element\n remove: function remove(elem, types, handler, selector, mappedTypes) {\n var j,\n origCount,\n tmp,\n events,\n t,\n handleObj,\n special,\n handlers,\n type,\n namespaces,\n origType,\n elemData = dataPriv.hasData(elem) && dataPriv.get(elem);\n\n if (!elemData || !(events = elemData.events)) {\n return;\n } // Once for each type.namespace in types; type may be omitted\n\n\n types = (types || \"\").match(rnothtmlwhite) || [\"\"];\n t = types.length;\n\n while (t--) {\n tmp = rtypenamespace.exec(types[t]) || [];\n type = origType = tmp[1];\n namespaces = (tmp[2] || \"\").split(\".\").sort(); // Unbind all events (on this namespace, if provided) for the element\n\n if (!type) {\n for (type in events) {\n jQuery.event.remove(elem, type + types[t], handler, selector, true);\n }\n\n continue;\n }\n\n special = jQuery.event.special[type] || {};\n type = (selector ? special.delegateType : special.bindType) || type;\n handlers = events[type] || [];\n tmp = tmp[2] && new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\"); // Remove matching events\n\n origCount = j = handlers.length;\n\n while (j--) {\n handleObj = handlers[j];\n\n if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === \"**\" && handleObj.selector)) {\n handlers.splice(j, 1);\n\n if (handleObj.selector) {\n handlers.delegateCount--;\n }\n\n if (special.remove) {\n special.remove.call(elem, handleObj);\n }\n }\n } // Remove generic event handler if we removed something and no more handlers exist\n // (avoids potential for endless recursion during removal of special event handlers)\n\n\n if (origCount && !handlers.length) {\n if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {\n jQuery.removeEvent(elem, type, elemData.handle);\n }\n\n delete events[type];\n }\n } // Remove data and the expando if it's no longer used\n\n\n if (jQuery.isEmptyObject(events)) {\n dataPriv.remove(elem, \"handle events\");\n }\n },\n dispatch: function dispatch(nativeEvent) {\n var i,\n j,\n ret,\n matched,\n handleObj,\n handlerQueue,\n args = new Array(arguments.length),\n // Make a writable jQuery.Event from the native event object\n event = jQuery.event.fix(nativeEvent),\n handlers = (dataPriv.get(this, \"events\") || Object.create(null))[event.type] || [],\n special = jQuery.event.special[event.type] || {}; // Use the fix-ed jQuery.Event rather than the (read-only) native event\n\n args[0] = event;\n\n for (i = 1; i < arguments.length; i++) {\n args[i] = arguments[i];\n }\n\n event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired\n\n if (special.preDispatch && special.preDispatch.call(this, event) === false) {\n return;\n } // Determine handlers\n\n\n handlerQueue = jQuery.event.handlers.call(this, event, handlers); // Run delegates first; they may want to stop propagation beneath us\n\n i = 0;\n\n while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {\n event.currentTarget = matched.elem;\n j = 0;\n\n while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {\n // If the event is namespaced, then each handler is only invoked if it is\n // specially universal or its namespaces are a superset of the event's.\n if (!event.rnamespace || handleObj.namespace === false || event.rnamespace.test(handleObj.namespace)) {\n event.handleObj = handleObj;\n event.data = handleObj.data;\n ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);\n\n if (ret !== undefined) {\n if ((event.result = ret) === false) {\n event.preventDefault();\n event.stopPropagation();\n }\n }\n }\n }\n } // Call the postDispatch hook for the mapped type\n\n\n if (special.postDispatch) {\n special.postDispatch.call(this, event);\n }\n\n return event.result;\n },\n handlers: function handlers(event, _handlers) {\n var i,\n handleObj,\n sel,\n matchedHandlers,\n matchedSelectors,\n handlerQueue = [],\n delegateCount = _handlers.delegateCount,\n cur = event.target; // Find delegate handlers\n\n if (delegateCount && // Support: IE <=9\n // Black-hole SVG instance trees (trac-13180)\n cur.nodeType && // Support: Firefox <=42\n // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)\n // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click\n // Support: IE 11 only\n // ...but not arrow key \"clicks\" of radio inputs, which can have `button` -1 (gh-2343)\n !(event.type === \"click\" && event.button >= 1)) {\n for (; cur !== this; cur = cur.parentNode || this) {\n // Don't check non-elements (#13208)\n // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n if (cur.nodeType === 1 && !(event.type === \"click\" && cur.disabled === true)) {\n matchedHandlers = [];\n matchedSelectors = {};\n\n for (i = 0; i < delegateCount; i++) {\n handleObj = _handlers[i]; // Don't conflict with Object.prototype properties (#13203)\n\n sel = handleObj.selector + \" \";\n\n if (matchedSelectors[sel] === undefined) {\n matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;\n }\n\n if (matchedSelectors[sel]) {\n matchedHandlers.push(handleObj);\n }\n }\n\n if (matchedHandlers.length) {\n handlerQueue.push({\n elem: cur,\n handlers: matchedHandlers\n });\n }\n }\n }\n } // Add the remaining (directly-bound) handlers\n\n\n cur = this;\n\n if (delegateCount < _handlers.length) {\n handlerQueue.push({\n elem: cur,\n handlers: _handlers.slice(delegateCount)\n });\n }\n\n return handlerQueue;\n },\n addProp: function addProp(name, hook) {\n Object.defineProperty(jQuery.Event.prototype, name, {\n enumerable: true,\n configurable: true,\n get: isFunction(hook) ? function () {\n if (this.originalEvent) {\n return hook(this.originalEvent);\n }\n } : function () {\n if (this.originalEvent) {\n return this.originalEvent[name];\n }\n },\n set: function set(value) {\n Object.defineProperty(this, name, {\n enumerable: true,\n configurable: true,\n writable: true,\n value: value\n });\n }\n });\n },\n fix: function fix(originalEvent) {\n return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);\n },\n special: {\n load: {\n // Prevent triggered image.load events from bubbling to window.load\n noBubble: true\n },\n click: {\n // Utilize native event to ensure correct state for checkable inputs\n setup: function setup(data) {\n // For mutual compressibility with _default, replace `this` access with a local var.\n // `|| data` is dead code meant only to preserve the variable through minification.\n var el = this || data; // Claim the first handler\n\n if (rcheckableType.test(el.type) && el.click && nodeName(el, \"input\")) {\n // dataPriv.set( el, \"click\", ... )\n leverageNative(el, \"click\", returnTrue);\n } // Return false to allow normal processing in the caller\n\n\n return false;\n },\n trigger: function trigger(data) {\n // For mutual compressibility with _default, replace `this` access with a local var.\n // `|| data` is dead code meant only to preserve the variable through minification.\n var el = this || data; // Force setup before triggering a click\n\n if (rcheckableType.test(el.type) && el.click && nodeName(el, \"input\")) {\n leverageNative(el, \"click\");\n } // Return non-false to allow normal event-path propagation\n\n\n return true;\n },\n // For cross-browser consistency, suppress native .click() on links\n // Also prevent it if we're currently inside a leveraged native-event stack\n _default: function _default(event) {\n var target = event.target;\n return rcheckableType.test(target.type) && target.click && nodeName(target, \"input\") && dataPriv.get(target, \"click\") || nodeName(target, \"a\");\n }\n },\n beforeunload: {\n postDispatch: function postDispatch(event) {\n // Support: Firefox 20+\n // Firefox doesn't alert if the returnValue field is not set.\n if (event.result !== undefined && event.originalEvent) {\n event.originalEvent.returnValue = event.result;\n }\n }\n }\n }\n }; // Ensure the presence of an event listener that handles manually-triggered\n // synthetic events by interrupting progress until reinvoked in response to\n // *native* events that it fires directly, ensuring that state changes have\n // already occurred before other listeners are invoked.\n\n function leverageNative(el, type, expectSync) {\n // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add\n if (!expectSync) {\n if (dataPriv.get(el, type) === undefined) {\n jQuery.event.add(el, type, returnTrue);\n }\n\n return;\n } // Register the controller as a special universal handler for all event namespaces\n\n\n dataPriv.set(el, type, false);\n jQuery.event.add(el, type, {\n namespace: false,\n handler: function handler(event) {\n var notAsync,\n result,\n saved = dataPriv.get(this, type);\n\n if (event.isTrigger & 1 && this[type]) {\n // Interrupt processing of the outer synthetic .trigger()ed event\n // Saved data should be false in such cases, but might be a leftover capture object\n // from an async native handler (gh-4350)\n if (!saved.length) {\n // Store arguments for use when handling the inner native event\n // There will always be at least one argument (an event object), so this array\n // will not be confused with a leftover capture object.\n saved = _slice.call(arguments);\n dataPriv.set(this, type, saved); // Trigger the native event and capture its result\n // Support: IE <=9 - 11+\n // focus() and blur() are asynchronous\n\n notAsync = expectSync(this, type);\n this[type]();\n result = dataPriv.get(this, type);\n\n if (saved !== result || notAsync) {\n dataPriv.set(this, type, false);\n } else {\n result = {};\n }\n\n if (saved !== result) {\n // Cancel the outer synthetic event\n event.stopImmediatePropagation();\n event.preventDefault(); // Support: Chrome 86+\n // In Chrome, if an element having a focusout handler is blurred by\n // clicking outside of it, it invokes the handler synchronously. If\n // that handler calls `.remove()` on the element, the data is cleared,\n // leaving `result` undefined. We need to guard against this.\n\n return result && result.value;\n } // If this is an inner synthetic event for an event with a bubbling surrogate\n // (focus or blur), assume that the surrogate already propagated from triggering the\n // native event and prevent that from happening again here.\n // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the\n // bubbling surrogate propagates *after* the non-bubbling base), but that seems\n // less bad than duplication.\n\n } else if ((jQuery.event.special[type] || {}).delegateType) {\n event.stopPropagation();\n } // If this is a native event triggered above, everything is now in order\n // Fire an inner synthetic event with the original arguments\n\n } else if (saved.length) {\n // ...and capture the result\n dataPriv.set(this, type, {\n value: jQuery.event.trigger( // Support: IE <=9 - 11+\n // Extend with the prototype to reset the above stopImmediatePropagation()\n jQuery.extend(saved[0], jQuery.Event.prototype), saved.slice(1), this)\n }); // Abort handling of the native event\n\n event.stopImmediatePropagation();\n }\n }\n });\n }\n\n jQuery.removeEvent = function (elem, type, handle) {\n // This \"if\" is needed for plain objects\n if (elem.removeEventListener) {\n elem.removeEventListener(type, handle);\n }\n };\n\n jQuery.Event = function (src, props) {\n // Allow instantiation without the 'new' keyword\n if (!(this instanceof jQuery.Event)) {\n return new jQuery.Event(src, props);\n } // Event object\n\n\n if (src && src.type) {\n this.originalEvent = src;\n this.type = src.type; // Events bubbling up the document may have been marked as prevented\n // by a handler lower down the tree; reflect the correct value.\n\n this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && // Support: Android <=2.3 only\n src.returnValue === false ? returnTrue : returnFalse; // Create target properties\n // Support: Safari <=6 - 7 only\n // Target should not be a text node (#504, #13143)\n\n this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;\n this.currentTarget = src.currentTarget;\n this.relatedTarget = src.relatedTarget; // Event type\n } else {\n this.type = src;\n } // Put explicitly provided properties onto the event object\n\n\n if (props) {\n jQuery.extend(this, props);\n } // Create a timestamp if incoming event doesn't have one\n\n\n this.timeStamp = src && src.timeStamp || Date.now(); // Mark it as fixed\n\n this[jQuery.expando] = true;\n }; // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\n\n\n jQuery.Event.prototype = {\n constructor: jQuery.Event,\n isDefaultPrevented: returnFalse,\n isPropagationStopped: returnFalse,\n isImmediatePropagationStopped: returnFalse,\n isSimulated: false,\n preventDefault: function preventDefault() {\n var e = this.originalEvent;\n this.isDefaultPrevented = returnTrue;\n\n if (e && !this.isSimulated) {\n e.preventDefault();\n }\n },\n stopPropagation: function stopPropagation() {\n var e = this.originalEvent;\n this.isPropagationStopped = returnTrue;\n\n if (e && !this.isSimulated) {\n e.stopPropagation();\n }\n },\n stopImmediatePropagation: function stopImmediatePropagation() {\n var e = this.originalEvent;\n this.isImmediatePropagationStopped = returnTrue;\n\n if (e && !this.isSimulated) {\n e.stopImmediatePropagation();\n }\n\n this.stopPropagation();\n }\n }; // Includes all common event props including KeyEvent and MouseEvent specific props\n\n jQuery.each({\n altKey: true,\n bubbles: true,\n cancelable: true,\n changedTouches: true,\n ctrlKey: true,\n detail: true,\n eventPhase: true,\n metaKey: true,\n pageX: true,\n pageY: true,\n shiftKey: true,\n view: true,\n \"char\": true,\n code: true,\n charCode: true,\n key: true,\n keyCode: true,\n button: true,\n buttons: true,\n clientX: true,\n clientY: true,\n offsetX: true,\n offsetY: true,\n pointerId: true,\n pointerType: true,\n screenX: true,\n screenY: true,\n targetTouches: true,\n toElement: true,\n touches: true,\n which: true\n }, jQuery.event.addProp);\n jQuery.each({\n focus: \"focusin\",\n blur: \"focusout\"\n }, function (type, delegateType) {\n jQuery.event.special[type] = {\n // Utilize native event if possible so blur/focus sequence is correct\n setup: function setup() {\n // Claim the first handler\n // dataPriv.set( this, \"focus\", ... )\n // dataPriv.set( this, \"blur\", ... )\n leverageNative(this, type, expectSync); // Return false to allow normal processing in the caller\n\n return false;\n },\n trigger: function trigger() {\n // Force setup before trigger\n leverageNative(this, type); // Return non-false to allow normal event-path propagation\n\n return true;\n },\n // Suppress native focus or blur as it's already being fired\n // in leverageNative.\n _default: function _default() {\n return true;\n },\n delegateType: delegateType\n };\n }); // Create mouseenter/leave events using mouseover/out and event-time checks\n // so that event delegation works in jQuery.\n // Do the same for pointerenter/pointerleave and pointerover/pointerout\n //\n // Support: Safari 7 only\n // Safari sends mouseenter too often; see:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n // for the description of the bug (it existed in older Chrome versions as well).\n\n jQuery.each({\n mouseenter: \"mouseover\",\n mouseleave: \"mouseout\",\n pointerenter: \"pointerover\",\n pointerleave: \"pointerout\"\n }, function (orig, fix) {\n jQuery.event.special[orig] = {\n delegateType: fix,\n bindType: fix,\n handle: function handle(event) {\n var ret,\n target = this,\n related = event.relatedTarget,\n handleObj = event.handleObj; // For mouseenter/leave call the handler if related is outside the target.\n // NB: No relatedTarget if the mouse left/entered the browser window\n\n if (!related || related !== target && !jQuery.contains(target, related)) {\n event.type = handleObj.origType;\n ret = handleObj.handler.apply(this, arguments);\n event.type = fix;\n }\n\n return ret;\n }\n };\n });\n jQuery.fn.extend({\n on: function on(types, selector, data, fn) {\n return _on(this, types, selector, data, fn);\n },\n one: function one(types, selector, data, fn) {\n return _on(this, types, selector, data, fn, 1);\n },\n off: function off(types, selector, fn) {\n var handleObj, type;\n\n if (types && types.preventDefault && types.handleObj) {\n // ( event ) dispatched jQuery.Event\n handleObj = types.handleObj;\n jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + \".\" + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);\n return this;\n }\n\n if (_typeof(types) === \"object\") {\n // ( types-object [, selector] )\n for (type in types) {\n this.off(type, selector, types[type]);\n }\n\n return this;\n }\n\n if (selector === false || typeof selector === \"function\") {\n // ( types [, fn] )\n fn = selector;\n selector = undefined;\n }\n\n if (fn === false) {\n fn = returnFalse;\n }\n\n return this.each(function () {\n jQuery.event.remove(this, types, fn, selector);\n });\n }\n });\n var // Support: IE <=10 - 11, Edge 12 - 13 only\n // In IE/Edge using regex groups here causes severe slowdowns.\n // See https://connect.microsoft.com/IE/feedback/details/1736512/\n rnoInnerhtml = /\\s*$/g; // Prefer a tbody over its parent table for containing new rows\n\n function manipulationTarget(elem, content) {\n if (nodeName(elem, \"table\") && nodeName(content.nodeType !== 11 ? content : content.firstChild, \"tr\")) {\n return jQuery(elem).children(\"tbody\")[0] || elem;\n }\n\n return elem;\n } // Replace/restore the type attribute of script elements for safe DOM manipulation\n\n\n function disableScript(elem) {\n elem.type = (elem.getAttribute(\"type\") !== null) + \"/\" + elem.type;\n return elem;\n }\n\n function restoreScript(elem) {\n if ((elem.type || \"\").slice(0, 5) === \"true/\") {\n elem.type = elem.type.slice(5);\n } else {\n elem.removeAttribute(\"type\");\n }\n\n return elem;\n }\n\n function cloneCopyEvent(src, dest) {\n var i, l, type, pdataOld, udataOld, udataCur, events;\n\n if (dest.nodeType !== 1) {\n return;\n } // 1. Copy private data: events, handlers, etc.\n\n\n if (dataPriv.hasData(src)) {\n pdataOld = dataPriv.get(src);\n events = pdataOld.events;\n\n if (events) {\n dataPriv.remove(dest, \"handle events\");\n\n for (type in events) {\n for (i = 0, l = events[type].length; i < l; i++) {\n jQuery.event.add(dest, type, events[type][i]);\n }\n }\n }\n } // 2. Copy user data\n\n\n if (dataUser.hasData(src)) {\n udataOld = dataUser.access(src);\n udataCur = jQuery.extend({}, udataOld);\n dataUser.set(dest, udataCur);\n }\n } // Fix IE bugs, see support tests\n\n\n function fixInput(src, dest) {\n var nodeName = dest.nodeName.toLowerCase(); // Fails to persist the checked state of a cloned checkbox or radio button.\n\n if (nodeName === \"input\" && rcheckableType.test(src.type)) {\n dest.checked = src.checked; // Fails to return the selected option to the default selected state when cloning options\n } else if (nodeName === \"input\" || nodeName === \"textarea\") {\n dest.defaultValue = src.defaultValue;\n }\n }\n\n function domManip(collection, args, callback, ignored) {\n // Flatten any nested arrays\n args = flat(args);\n var fragment,\n first,\n scripts,\n hasScripts,\n node,\n doc,\n i = 0,\n l = collection.length,\n iNoClone = l - 1,\n value = args[0],\n valueIsFunction = isFunction(value); // We can't cloneNode fragments that contain checked, in WebKit\n\n if (valueIsFunction || l > 1 && typeof value === \"string\" && !support.checkClone && rchecked.test(value)) {\n return collection.each(function (index) {\n var self = collection.eq(index);\n\n if (valueIsFunction) {\n args[0] = value.call(this, index, self.html());\n }\n\n domManip(self, args, callback, ignored);\n });\n }\n\n if (l) {\n fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);\n first = fragment.firstChild;\n\n if (fragment.childNodes.length === 1) {\n fragment = first;\n } // Require either new content or an interest in ignored elements to invoke the callback\n\n\n if (first || ignored) {\n scripts = jQuery.map(getAll(fragment, \"script\"), disableScript);\n hasScripts = scripts.length; // Use the original fragment for the last item\n // instead of the first because it can end up\n // being emptied incorrectly in certain situations (#8070).\n\n for (; i < l; i++) {\n node = fragment;\n\n if (i !== iNoClone) {\n node = jQuery.clone(node, true, true); // Keep references to cloned scripts for later restoration\n\n if (hasScripts) {\n // Support: Android <=4.0 only, PhantomJS 1 only\n // push.apply(_, arraylike) throws on ancient WebKit\n jQuery.merge(scripts, getAll(node, \"script\"));\n }\n }\n\n callback.call(collection[i], node, i);\n }\n\n if (hasScripts) {\n doc = scripts[scripts.length - 1].ownerDocument; // Reenable scripts\n\n jQuery.map(scripts, restoreScript); // Evaluate executable scripts on first document insertion\n\n for (i = 0; i < hasScripts; i++) {\n node = scripts[i];\n\n if (rscriptType.test(node.type || \"\") && !dataPriv.access(node, \"globalEval\") && jQuery.contains(doc, node)) {\n if (node.src && (node.type || \"\").toLowerCase() !== \"module\") {\n // Optional AJAX dependency, but won't run scripts if not present\n if (jQuery._evalUrl && !node.noModule) {\n jQuery._evalUrl(node.src, {\n nonce: node.nonce || node.getAttribute(\"nonce\")\n }, doc);\n }\n } else {\n DOMEval(node.textContent.replace(rcleanScript, \"\"), node, doc);\n }\n }\n }\n }\n }\n }\n\n return collection;\n }\n\n function _remove(elem, selector, keepData) {\n var node,\n nodes = selector ? jQuery.filter(selector, elem) : elem,\n i = 0;\n\n for (; (node = nodes[i]) != null; i++) {\n if (!keepData && node.nodeType === 1) {\n jQuery.cleanData(getAll(node));\n }\n\n if (node.parentNode) {\n if (keepData && isAttached(node)) {\n setGlobalEval(getAll(node, \"script\"));\n }\n\n node.parentNode.removeChild(node);\n }\n }\n\n return elem;\n }\n\n jQuery.extend({\n htmlPrefilter: function htmlPrefilter(html) {\n return html;\n },\n clone: function clone(elem, dataAndEvents, deepDataAndEvents) {\n var i,\n l,\n srcElements,\n destElements,\n clone = elem.cloneNode(true),\n inPage = isAttached(elem); // Fix IE cloning issues\n\n if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {\n // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2\n destElements = getAll(clone);\n srcElements = getAll(elem);\n\n for (i = 0, l = srcElements.length; i < l; i++) {\n fixInput(srcElements[i], destElements[i]);\n }\n } // Copy the events from the original to the clone\n\n\n if (dataAndEvents) {\n if (deepDataAndEvents) {\n srcElements = srcElements || getAll(elem);\n destElements = destElements || getAll(clone);\n\n for (i = 0, l = srcElements.length; i < l; i++) {\n cloneCopyEvent(srcElements[i], destElements[i]);\n }\n } else {\n cloneCopyEvent(elem, clone);\n }\n } // Preserve script evaluation history\n\n\n destElements = getAll(clone, \"script\");\n\n if (destElements.length > 0) {\n setGlobalEval(destElements, !inPage && getAll(elem, \"script\"));\n } // Return the cloned set\n\n\n return clone;\n },\n cleanData: function cleanData(elems) {\n var data,\n elem,\n type,\n special = jQuery.event.special,\n i = 0;\n\n for (; (elem = elems[i]) !== undefined; i++) {\n if (acceptData(elem)) {\n if (data = elem[dataPriv.expando]) {\n if (data.events) {\n for (type in data.events) {\n if (special[type]) {\n jQuery.event.remove(elem, type); // This is a shortcut to avoid jQuery.event.remove's overhead\n } else {\n jQuery.removeEvent(elem, type, data.handle);\n }\n }\n } // Support: Chrome <=35 - 45+\n // Assign undefined instead of using delete, see Data#remove\n\n\n elem[dataPriv.expando] = undefined;\n }\n\n if (elem[dataUser.expando]) {\n // Support: Chrome <=35 - 45+\n // Assign undefined instead of using delete, see Data#remove\n elem[dataUser.expando] = undefined;\n }\n }\n }\n }\n });\n jQuery.fn.extend({\n detach: function detach(selector) {\n return _remove(this, selector, true);\n },\n remove: function remove(selector) {\n return _remove(this, selector);\n },\n text: function text(value) {\n return access(this, function (value) {\n return value === undefined ? jQuery.text(this) : this.empty().each(function () {\n if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n this.textContent = value;\n }\n });\n }, null, value, arguments.length);\n },\n append: function append() {\n return domManip(this, arguments, function (elem) {\n if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n var target = manipulationTarget(this, elem);\n target.appendChild(elem);\n }\n });\n },\n prepend: function prepend() {\n return domManip(this, arguments, function (elem) {\n if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {\n var target = manipulationTarget(this, elem);\n target.insertBefore(elem, target.firstChild);\n }\n });\n },\n before: function before() {\n return domManip(this, arguments, function (elem) {\n if (this.parentNode) {\n this.parentNode.insertBefore(elem, this);\n }\n });\n },\n after: function after() {\n return domManip(this, arguments, function (elem) {\n if (this.parentNode) {\n this.parentNode.insertBefore(elem, this.nextSibling);\n }\n });\n },\n empty: function empty() {\n var elem,\n i = 0;\n\n for (; (elem = this[i]) != null; i++) {\n if (elem.nodeType === 1) {\n // Prevent memory leaks\n jQuery.cleanData(getAll(elem, false)); // Remove any remaining nodes\n\n elem.textContent = \"\";\n }\n }\n\n return this;\n },\n clone: function clone(dataAndEvents, deepDataAndEvents) {\n dataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n return this.map(function () {\n return jQuery.clone(this, dataAndEvents, deepDataAndEvents);\n });\n },\n html: function html(value) {\n return access(this, function (value) {\n var elem = this[0] || {},\n i = 0,\n l = this.length;\n\n if (value === undefined && elem.nodeType === 1) {\n return elem.innerHTML;\n } // See if we can take a shortcut and just use innerHTML\n\n\n if (typeof value === \"string\" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || [\"\", \"\"])[1].toLowerCase()]) {\n value = jQuery.htmlPrefilter(value);\n\n try {\n for (; i < l; i++) {\n elem = this[i] || {}; // Remove element nodes and prevent memory leaks\n\n if (elem.nodeType === 1) {\n jQuery.cleanData(getAll(elem, false));\n elem.innerHTML = value;\n }\n }\n\n elem = 0; // If using innerHTML throws an exception, use the fallback method\n } catch (e) {}\n }\n\n if (elem) {\n this.empty().append(value);\n }\n }, null, value, arguments.length);\n },\n replaceWith: function replaceWith() {\n var ignored = []; // Make the changes, replacing each non-ignored context element with the new content\n\n return domManip(this, arguments, function (elem) {\n var parent = this.parentNode;\n\n if (jQuery.inArray(this, ignored) < 0) {\n jQuery.cleanData(getAll(this));\n\n if (parent) {\n parent.replaceChild(elem, this);\n }\n } // Force callback invocation\n\n }, ignored);\n }\n });\n jQuery.each({\n appendTo: \"append\",\n prependTo: \"prepend\",\n insertBefore: \"before\",\n insertAfter: \"after\",\n replaceAll: \"replaceWith\"\n }, function (name, original) {\n jQuery.fn[name] = function (selector) {\n var elems,\n ret = [],\n insert = jQuery(selector),\n last = insert.length - 1,\n i = 0;\n\n for (; i <= last; i++) {\n elems = i === last ? this : this.clone(true);\n jQuery(insert[i])[original](elems); // Support: Android <=4.0 only, PhantomJS 1 only\n // .get() because push.apply(_, arraylike) throws on ancient WebKit\n\n push.apply(ret, elems.get());\n }\n\n return this.pushStack(ret);\n };\n });\n var rnumnonpx = new RegExp(\"^(\" + pnum + \")(?!px)[a-z%]+$\", \"i\");\n\n var getStyles = function getStyles(elem) {\n // Support: IE <=11 only, Firefox <=30 (#15098, #14150)\n // IE throws on elements created in popups\n // FF meanwhile throws on frame elements through \"defaultView.getComputedStyle\"\n var view = elem.ownerDocument.defaultView;\n\n if (!view || !view.opener) {\n view = window;\n }\n\n return view.getComputedStyle(elem);\n };\n\n var swap = function swap(elem, options, callback) {\n var ret,\n name,\n old = {}; // Remember the old values, and insert the new ones\n\n for (name in options) {\n old[name] = elem.style[name];\n elem.style[name] = options[name];\n }\n\n ret = callback.call(elem); // Revert the old values\n\n for (name in options) {\n elem.style[name] = old[name];\n }\n\n return ret;\n };\n\n var rboxStyle = new RegExp(cssExpand.join(\"|\"), \"i\");\n\n (function () {\n // Executing both pixelPosition & boxSizingReliable tests require only one layout\n // so they're executed at the same time to save the second computation.\n function computeStyleTests() {\n // This is a singleton, we need to execute it only once\n if (!div) {\n return;\n }\n\n container.style.cssText = \"position:absolute;left:-11111px;width:60px;\" + \"margin-top:1px;padding:0;border:0\";\n div.style.cssText = \"position:relative;display:block;box-sizing:border-box;overflow:scroll;\" + \"margin:auto;border:1px;padding:1px;\" + \"width:60%;top:1%\";\n documentElement.appendChild(container).appendChild(div);\n var divStyle = window.getComputedStyle(div);\n pixelPositionVal = divStyle.top !== \"1%\"; // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44\n\n reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12; // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3\n // Some styles come back with percentage values, even though they shouldn't\n\n div.style.right = \"60%\";\n pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36; // Support: IE 9 - 11 only\n // Detect misreporting of content dimensions for box-sizing:border-box elements\n\n boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36; // Support: IE 9 only\n // Detect overflow:scroll screwiness (gh-3699)\n // Support: Chrome <=64\n // Don't get tricked when zoom affects offsetWidth (gh-4029)\n\n div.style.position = \"absolute\";\n scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;\n documentElement.removeChild(container); // Nullify the div so it wouldn't be stored in the memory and\n // it will also be a sign that checks already performed\n\n div = null;\n }\n\n function roundPixelMeasures(measure) {\n return Math.round(parseFloat(measure));\n }\n\n var pixelPositionVal,\n boxSizingReliableVal,\n scrollboxSizeVal,\n pixelBoxStylesVal,\n reliableTrDimensionsVal,\n reliableMarginLeftVal,\n container = document.createElement(\"div\"),\n div = document.createElement(\"div\"); // Finish early in limited (non-browser) environments\n\n if (!div.style) {\n return;\n } // Support: IE <=9 - 11 only\n // Style of cloned element affects source element cloned (#8908)\n\n\n div.style.backgroundClip = \"content-box\";\n div.cloneNode(true).style.backgroundClip = \"\";\n support.clearCloneStyle = div.style.backgroundClip === \"content-box\";\n jQuery.extend(support, {\n boxSizingReliable: function boxSizingReliable() {\n computeStyleTests();\n return boxSizingReliableVal;\n },\n pixelBoxStyles: function pixelBoxStyles() {\n computeStyleTests();\n return pixelBoxStylesVal;\n },\n pixelPosition: function pixelPosition() {\n computeStyleTests();\n return pixelPositionVal;\n },\n reliableMarginLeft: function reliableMarginLeft() {\n computeStyleTests();\n return reliableMarginLeftVal;\n },\n scrollboxSize: function scrollboxSize() {\n computeStyleTests();\n return scrollboxSizeVal;\n },\n // Support: IE 9 - 11+, Edge 15 - 18+\n // IE/Edge misreport `getComputedStyle` of table rows with width/height\n // set in CSS while `offset*` properties report correct values.\n // Behavior in IE 9 is more subtle than in newer versions & it passes\n // some versions of this test; make sure not to make it pass there!\n //\n // Support: Firefox 70+\n // Only Firefox includes border widths\n // in computed dimensions. (gh-4529)\n reliableTrDimensions: function reliableTrDimensions() {\n var table, tr, trChild, trStyle;\n\n if (reliableTrDimensionsVal == null) {\n table = document.createElement(\"table\");\n tr = document.createElement(\"tr\");\n trChild = document.createElement(\"div\");\n table.style.cssText = \"position:absolute;left:-11111px;border-collapse:separate\";\n tr.style.cssText = \"border:1px solid\"; // Support: Chrome 86+\n // Height set through cssText does not get applied.\n // Computed height then comes back as 0.\n\n tr.style.height = \"1px\";\n trChild.style.height = \"9px\"; // Support: Android 8 Chrome 86+\n // In our bodyBackground.html iframe,\n // display for all div elements is set to \"inline\",\n // which causes a problem only in Android 8 Chrome 86.\n // Ensuring the div is display: block\n // gets around this issue.\n\n trChild.style.display = \"block\";\n documentElement.appendChild(table).appendChild(tr).appendChild(trChild);\n trStyle = window.getComputedStyle(tr);\n reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight;\n documentElement.removeChild(table);\n }\n\n return reliableTrDimensionsVal;\n }\n });\n })();\n\n function curCSS(elem, name, computed) {\n var width,\n minWidth,\n maxWidth,\n ret,\n // Support: Firefox 51+\n // Retrieving style before computed somehow\n // fixes an issue with getting wrong values\n // on detached elements\n style = elem.style;\n computed = computed || getStyles(elem); // getPropertyValue is needed for:\n // .css('filter') (IE 9 only, #12537)\n // .css('--customProperty) (#3144)\n\n if (computed) {\n ret = computed.getPropertyValue(name) || computed[name];\n\n if (ret === \"\" && !isAttached(elem)) {\n ret = jQuery.style(elem, name);\n } // A tribute to the \"awesome hack by Dean Edwards\"\n // Android Browser returns percentage for some values,\n // but width seems to be reliably pixels.\n // This is against the CSSOM draft spec:\n // https://drafts.csswg.org/cssom/#resolved-values\n\n\n if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {\n // Remember the original values\n width = style.width;\n minWidth = style.minWidth;\n maxWidth = style.maxWidth; // Put in the new values to get a computed value out\n\n style.minWidth = style.maxWidth = style.width = ret;\n ret = computed.width; // Revert the changed values\n\n style.width = width;\n style.minWidth = minWidth;\n style.maxWidth = maxWidth;\n }\n }\n\n return ret !== undefined ? // Support: IE <=9 - 11 only\n // IE returns zIndex value as an integer.\n ret + \"\" : ret;\n }\n\n function addGetHookIf(conditionFn, hookFn) {\n // Define the hook, we'll check on the first run if it's really needed.\n return {\n get: function get() {\n if (conditionFn()) {\n // Hook not needed (or it's not possible to use it due\n // to missing dependency), remove it.\n delete this.get;\n return;\n } // Hook needed; redefine it so that the support test is not executed again.\n\n\n return (this.get = hookFn).apply(this, arguments);\n }\n };\n }\n\n var cssPrefixes = [\"Webkit\", \"Moz\", \"ms\"],\n emptyStyle = document.createElement(\"div\").style,\n vendorProps = {}; // Return a vendor-prefixed property or undefined\n\n function vendorPropName(name) {\n // Check for vendor prefixed names\n var capName = name[0].toUpperCase() + name.slice(1),\n i = cssPrefixes.length;\n\n while (i--) {\n name = cssPrefixes[i] + capName;\n\n if (name in emptyStyle) {\n return name;\n }\n }\n } // Return a potentially-mapped jQuery.cssProps or vendor prefixed property\n\n\n function finalPropName(name) {\n var final = jQuery.cssProps[name] || vendorProps[name];\n\n if (final) {\n return final;\n }\n\n if (name in emptyStyle) {\n return name;\n }\n\n return vendorProps[name] = vendorPropName(name) || name;\n }\n\n var // Swappable if display is none or starts with table\n // except \"table\", \"table-cell\", or \"table-caption\"\n // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n rdisplayswap = /^(none|table(?!-c[ea]).+)/,\n rcustomProp = /^--/,\n cssShow = {\n position: \"absolute\",\n visibility: \"hidden\",\n display: \"block\"\n },\n cssNormalTransform = {\n letterSpacing: \"0\",\n fontWeight: \"400\"\n };\n\n function setPositiveNumber(_elem, value, subtract) {\n // Any relative (+/-) values have already been\n // normalized at this point\n var matches = rcssNum.exec(value);\n return matches ? // Guard against undefined \"subtract\", e.g., when used as in cssHooks\n Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || \"px\") : value;\n }\n\n function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {\n var i = dimension === \"width\" ? 1 : 0,\n extra = 0,\n delta = 0; // Adjustment may not be necessary\n\n if (box === (isBorderBox ? \"border\" : \"content\")) {\n return 0;\n }\n\n for (; i < 4; i += 2) {\n // Both box models exclude margin\n if (box === \"margin\") {\n delta += jQuery.css(elem, box + cssExpand[i], true, styles);\n } // If we get here with a content-box, we're seeking \"padding\" or \"border\" or \"margin\"\n\n\n if (!isBorderBox) {\n // Add padding\n delta += jQuery.css(elem, \"padding\" + cssExpand[i], true, styles); // For \"border\" or \"margin\", add border\n\n if (box !== \"padding\") {\n delta += jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles); // But still keep track of it otherwise\n } else {\n extra += jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n } // If we get here with a border-box (content + padding + border), we're seeking \"content\" or\n // \"padding\" or \"margin\"\n\n } else {\n // For \"content\", subtract padding\n if (box === \"content\") {\n delta -= jQuery.css(elem, \"padding\" + cssExpand[i], true, styles);\n } // For \"content\" or \"padding\", subtract border\n\n\n if (box !== \"margin\") {\n delta -= jQuery.css(elem, \"border\" + cssExpand[i] + \"Width\", true, styles);\n }\n }\n } // Account for positive content-box scroll gutter when requested by providing computedVal\n\n\n if (!isBorderBox && computedVal >= 0) {\n // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border\n // Assuming integer scroll gutter, subtract the rest and round down\n delta += Math.max(0, Math.ceil(elem[\"offset\" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter\n // Use an explicit zero to avoid NaN (gh-3964)\n )) || 0;\n }\n\n return delta;\n }\n\n function getWidthOrHeight(elem, dimension, extra) {\n // Start with computed style\n var styles = getStyles(elem),\n // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).\n // Fake content-box until we know it's needed to know the true value.\n boxSizingNeeded = !support.boxSizingReliable() || extra,\n isBorderBox = boxSizingNeeded && jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\",\n valueIsBorderBox = isBorderBox,\n val = curCSS(elem, dimension, styles),\n offsetProp = \"offset\" + dimension[0].toUpperCase() + dimension.slice(1); // Support: Firefox <=54\n // Return a confounding non-pixel value or feign ignorance, as appropriate.\n\n if (rnumnonpx.test(val)) {\n if (!extra) {\n return val;\n }\n\n val = \"auto\";\n } // Support: IE 9 - 11 only\n // Use offsetWidth/offsetHeight for when box sizing is unreliable.\n // In those cases, the computed value can be trusted to be border-box.\n\n\n if ((!support.boxSizingReliable() && isBorderBox || // Support: IE 10 - 11+, Edge 15 - 18+\n // IE/Edge misreport `getComputedStyle` of table rows with width/height\n // set in CSS while `offset*` properties report correct values.\n // Interestingly, in some cases IE 9 doesn't suffer from this issue.\n !support.reliableTrDimensions() && nodeName(elem, \"tr\") || // Fall back to offsetWidth/offsetHeight when value is \"auto\"\n // This happens for inline elements with no explicit setting (gh-3571)\n val === \"auto\" || // Support: Android <=4.1 - 4.3 only\n // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)\n !parseFloat(val) && jQuery.css(elem, \"display\", false, styles) === \"inline\") && // Make sure the element is visible & connected\n elem.getClientRects().length) {\n isBorderBox = jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\"; // Where available, offsetWidth/offsetHeight approximate border box dimensions.\n // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the\n // retrieved value as a content box dimension.\n\n valueIsBorderBox = offsetProp in elem;\n\n if (valueIsBorderBox) {\n val = elem[offsetProp];\n }\n } // Normalize \"\" and auto\n\n\n val = parseFloat(val) || 0; // Adjust for the element's box model\n\n return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? \"border\" : \"content\"), valueIsBorderBox, styles, // Provide the current computed size to request scroll gutter calculation (gh-3589)\n val) + \"px\";\n }\n\n jQuery.extend({\n // Add in style property hooks for overriding the default\n // behavior of getting and setting a style property\n cssHooks: {\n opacity: {\n get: function get(elem, computed) {\n if (computed) {\n // We should always get a number back from opacity\n var ret = curCSS(elem, \"opacity\");\n return ret === \"\" ? \"1\" : ret;\n }\n }\n }\n },\n // Don't automatically add \"px\" to these possibly-unitless properties\n cssNumber: {\n \"animationIterationCount\": true,\n \"columnCount\": true,\n \"fillOpacity\": true,\n \"flexGrow\": true,\n \"flexShrink\": true,\n \"fontWeight\": true,\n \"gridArea\": true,\n \"gridColumn\": true,\n \"gridColumnEnd\": true,\n \"gridColumnStart\": true,\n \"gridRow\": true,\n \"gridRowEnd\": true,\n \"gridRowStart\": true,\n \"lineHeight\": true,\n \"opacity\": true,\n \"order\": true,\n \"orphans\": true,\n \"widows\": true,\n \"zIndex\": true,\n \"zoom\": true\n },\n // Add in properties whose names you wish to fix before\n // setting or getting the value\n cssProps: {},\n // Get and set the style property on a DOM Node\n style: function style(elem, name, value, extra) {\n // Don't set styles on text and comment nodes\n if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {\n return;\n } // Make sure that we're working with the right name\n\n\n var ret,\n type,\n hooks,\n origName = camelCase(name),\n isCustomProp = rcustomProp.test(name),\n style = elem.style; // Make sure that we're working with the right name. We don't\n // want to query the value if it is a CSS custom property\n // since they are user-defined.\n\n if (!isCustomProp) {\n name = finalPropName(origName);\n } // Gets hook for the prefixed version, then unprefixed version\n\n\n hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; // Check if we're setting a value\n\n if (value !== undefined) {\n type = _typeof(value); // Convert \"+=\" or \"-=\" to relative numbers (#7345)\n\n if (type === \"string\" && (ret = rcssNum.exec(value)) && ret[1]) {\n value = adjustCSS(elem, name, ret); // Fixes bug #9237\n\n type = \"number\";\n } // Make sure that null and NaN values aren't set (#7116)\n\n\n if (value == null || value !== value) {\n return;\n } // If a number was passed in, add the unit (except for certain CSS properties)\n // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append\n // \"px\" to a few hardcoded values.\n\n\n if (type === \"number\" && !isCustomProp) {\n value += ret && ret[3] || (jQuery.cssNumber[origName] ? \"\" : \"px\");\n } // background-* props affect original clone's values\n\n\n if (!support.clearCloneStyle && value === \"\" && name.indexOf(\"background\") === 0) {\n style[name] = \"inherit\";\n } // If a hook was provided, use that value, otherwise just set the specified value\n\n\n if (!hooks || !(\"set\" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {\n if (isCustomProp) {\n style.setProperty(name, value);\n } else {\n style[name] = value;\n }\n }\n } else {\n // If a hook was provided get the non-computed value from there\n if (hooks && \"get\" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {\n return ret;\n } // Otherwise just get the value from the style object\n\n\n return style[name];\n }\n },\n css: function css(elem, name, extra, styles) {\n var val,\n num,\n hooks,\n origName = camelCase(name),\n isCustomProp = rcustomProp.test(name); // Make sure that we're working with the right name. We don't\n // want to modify the value if it is a CSS custom property\n // since they are user-defined.\n\n if (!isCustomProp) {\n name = finalPropName(origName);\n } // Try prefixed name followed by the unprefixed name\n\n\n hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; // If a hook was provided get the computed value from there\n\n if (hooks && \"get\" in hooks) {\n val = hooks.get(elem, true, extra);\n } // Otherwise, if a way to get the computed value exists, use that\n\n\n if (val === undefined) {\n val = curCSS(elem, name, styles);\n } // Convert \"normal\" to computed value\n\n\n if (val === \"normal\" && name in cssNormalTransform) {\n val = cssNormalTransform[name];\n } // Make numeric if forced or a qualifier was provided and val looks numeric\n\n\n if (extra === \"\" || extra) {\n num = parseFloat(val);\n return extra === true || isFinite(num) ? num || 0 : val;\n }\n\n return val;\n }\n });\n jQuery.each([\"height\", \"width\"], function (_i, dimension) {\n jQuery.cssHooks[dimension] = {\n get: function get(elem, computed, extra) {\n if (computed) {\n // Certain elements can have dimension info if we invisibly show them\n // but it must have a current display style that would benefit\n return rdisplayswap.test(jQuery.css(elem, \"display\")) && ( // Support: Safari 8+\n // Table columns in Safari have non-zero offsetWidth & zero\n // getBoundingClientRect().width unless display is changed.\n // Support: IE <=11 only\n // Running getBoundingClientRect on a disconnected node\n // in IE throws an error.\n !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {\n return getWidthOrHeight(elem, dimension, extra);\n }) : getWidthOrHeight(elem, dimension, extra);\n }\n },\n set: function set(elem, value, extra) {\n var matches,\n styles = getStyles(elem),\n // Only read styles.position if the test has a chance to fail\n // to avoid forcing a reflow.\n scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === \"absolute\",\n // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)\n boxSizingNeeded = scrollboxSizeBuggy || extra,\n isBorderBox = boxSizingNeeded && jQuery.css(elem, \"boxSizing\", false, styles) === \"border-box\",\n subtract = extra ? boxModelAdjustment(elem, dimension, extra, isBorderBox, styles) : 0; // Account for unreliable border-box dimensions by comparing offset* to computed and\n // faking a content-box to get border and padding (gh-3699)\n\n if (isBorderBox && scrollboxSizeBuggy) {\n subtract -= Math.ceil(elem[\"offset\" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, \"border\", false, styles) - 0.5);\n } // Convert to pixels if value adjustment is needed\n\n\n if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || \"px\") !== \"px\") {\n elem.style[dimension] = value;\n value = jQuery.css(elem, dimension);\n }\n\n return setPositiveNumber(elem, value, subtract);\n }\n };\n });\n jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {\n if (computed) {\n return (parseFloat(curCSS(elem, \"marginLeft\")) || elem.getBoundingClientRect().left - swap(elem, {\n marginLeft: 0\n }, function () {\n return elem.getBoundingClientRect().left;\n })) + \"px\";\n }\n }); // These hooks are used by animate to expand properties\n\n jQuery.each({\n margin: \"\",\n padding: \"\",\n border: \"Width\"\n }, function (prefix, suffix) {\n jQuery.cssHooks[prefix + suffix] = {\n expand: function expand(value) {\n var i = 0,\n expanded = {},\n // Assumes a single number if not a string\n parts = typeof value === \"string\" ? value.split(\" \") : [value];\n\n for (; i < 4; i++) {\n expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];\n }\n\n return expanded;\n }\n };\n\n if (prefix !== \"margin\") {\n jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;\n }\n });\n jQuery.fn.extend({\n css: function css(name, value) {\n return access(this, function (elem, name, value) {\n var styles,\n len,\n map = {},\n i = 0;\n\n if (Array.isArray(name)) {\n styles = getStyles(elem);\n len = name.length;\n\n for (; i < len; i++) {\n map[name[i]] = jQuery.css(elem, name[i], false, styles);\n }\n\n return map;\n }\n\n return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);\n }, name, value, arguments.length > 1);\n }\n });\n\n function Tween(elem, options, prop, end, easing) {\n return new Tween.prototype.init(elem, options, prop, end, easing);\n }\n\n jQuery.Tween = Tween;\n Tween.prototype = {\n constructor: Tween,\n init: function init(elem, options, prop, end, easing, unit) {\n this.elem = elem;\n this.prop = prop;\n this.easing = easing || jQuery.easing._default;\n this.options = options;\n this.start = this.now = this.cur();\n this.end = end;\n this.unit = unit || (jQuery.cssNumber[prop] ? \"\" : \"px\");\n },\n cur: function cur() {\n var hooks = Tween.propHooks[this.prop];\n return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);\n },\n run: function run(percent) {\n var eased,\n hooks = Tween.propHooks[this.prop];\n\n if (this.options.duration) {\n this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);\n } else {\n this.pos = eased = percent;\n }\n\n this.now = (this.end - this.start) * eased + this.start;\n\n if (this.options.step) {\n this.options.step.call(this.elem, this.now, this);\n }\n\n if (hooks && hooks.set) {\n hooks.set(this);\n } else {\n Tween.propHooks._default.set(this);\n }\n\n return this;\n }\n };\n Tween.prototype.init.prototype = Tween.prototype;\n Tween.propHooks = {\n _default: {\n get: function get(tween) {\n var result; // Use a property on the element directly when it is not a DOM element,\n // or when there is no matching style property that exists.\n\n if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {\n return tween.elem[tween.prop];\n } // Passing an empty string as a 3rd parameter to .css will automatically\n // attempt a parseFloat and fallback to a string if the parse fails.\n // Simple values such as \"10px\" are parsed to Float;\n // complex values such as \"rotate(1rad)\" are returned as-is.\n\n\n result = jQuery.css(tween.elem, tween.prop, \"\"); // Empty strings, null, undefined and \"auto\" are converted to 0.\n\n return !result || result === \"auto\" ? 0 : result;\n },\n set: function set(tween) {\n // Use step hook for back compat.\n // Use cssHook if its there.\n // Use .style if available and use plain properties where available.\n if (jQuery.fx.step[tween.prop]) {\n jQuery.fx.step[tween.prop](tween);\n } else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) {\n jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);\n } else {\n tween.elem[tween.prop] = tween.now;\n }\n }\n }\n }; // Support: IE <=9 only\n // Panic based approach to setting things on disconnected nodes\n\n Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n set: function set(tween) {\n if (tween.elem.nodeType && tween.elem.parentNode) {\n tween.elem[tween.prop] = tween.now;\n }\n }\n };\n jQuery.easing = {\n linear: function linear(p) {\n return p;\n },\n swing: function swing(p) {\n return 0.5 - Math.cos(p * Math.PI) / 2;\n },\n _default: \"swing\"\n };\n jQuery.fx = Tween.prototype.init; // Back compat <1.8 extension point\n\n jQuery.fx.step = {};\n var fxNow,\n inProgress,\n rfxtypes = /^(?:toggle|show|hide)$/,\n rrun = /queueHooks$/;\n\n function schedule() {\n if (inProgress) {\n if (document.hidden === false && window.requestAnimationFrame) {\n window.requestAnimationFrame(schedule);\n } else {\n window.setTimeout(schedule, jQuery.fx.interval);\n }\n\n jQuery.fx.tick();\n }\n } // Animations created synchronously will run synchronously\n\n\n function createFxNow() {\n window.setTimeout(function () {\n fxNow = undefined;\n });\n return fxNow = Date.now();\n } // Generate parameters to create a standard animation\n\n\n function genFx(type, includeWidth) {\n var which,\n i = 0,\n attrs = {\n height: type\n }; // If we include width, step value is 1 to do all cssExpand values,\n // otherwise step value is 2 to skip over Left and Right\n\n includeWidth = includeWidth ? 1 : 0;\n\n for (; i < 4; i += 2 - includeWidth) {\n which = cssExpand[i];\n attrs[\"margin\" + which] = attrs[\"padding\" + which] = type;\n }\n\n if (includeWidth) {\n attrs.opacity = attrs.width = type;\n }\n\n return attrs;\n }\n\n function createTween(value, prop, animation) {\n var tween,\n collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners[\"*\"]),\n index = 0,\n length = collection.length;\n\n for (; index < length; index++) {\n if (tween = collection[index].call(animation, prop, value)) {\n // We're done with this property\n return tween;\n }\n }\n }\n\n function defaultPrefilter(elem, props, opts) {\n var prop,\n value,\n toggle,\n hooks,\n oldfire,\n propTween,\n restoreDisplay,\n display,\n isBox = \"width\" in props || \"height\" in props,\n anim = this,\n orig = {},\n style = elem.style,\n hidden = elem.nodeType && isHiddenWithinTree(elem),\n dataShow = dataPriv.get(elem, \"fxshow\"); // Queue-skipping animations hijack the fx hooks\n\n if (!opts.queue) {\n hooks = jQuery._queueHooks(elem, \"fx\");\n\n if (hooks.unqueued == null) {\n hooks.unqueued = 0;\n oldfire = hooks.empty.fire;\n\n hooks.empty.fire = function () {\n if (!hooks.unqueued) {\n oldfire();\n }\n };\n }\n\n hooks.unqueued++;\n anim.always(function () {\n // Ensure the complete handler is called before this completes\n anim.always(function () {\n hooks.unqueued--;\n\n if (!jQuery.queue(elem, \"fx\").length) {\n hooks.empty.fire();\n }\n });\n });\n } // Detect show/hide animations\n\n\n for (prop in props) {\n value = props[prop];\n\n if (rfxtypes.test(value)) {\n delete props[prop];\n toggle = toggle || value === \"toggle\";\n\n if (value === (hidden ? \"hide\" : \"show\")) {\n // Pretend to be hidden if this is a \"show\" and\n // there is still data from a stopped show/hide\n if (value === \"show\" && dataShow && dataShow[prop] !== undefined) {\n hidden = true; // Ignore all other no-op show/hide data\n } else {\n continue;\n }\n }\n\n orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);\n }\n } // Bail out if this is a no-op like .hide().hide()\n\n\n propTween = !jQuery.isEmptyObject(props);\n\n if (!propTween && jQuery.isEmptyObject(orig)) {\n return;\n } // Restrict \"overflow\" and \"display\" styles during box animations\n\n\n if (isBox && elem.nodeType === 1) {\n // Support: IE <=9 - 11, Edge 12 - 15\n // Record all 3 overflow attributes because IE does not infer the shorthand\n // from identically-valued overflowX and overflowY and Edge just mirrors\n // the overflowX value there.\n opts.overflow = [style.overflow, style.overflowX, style.overflowY]; // Identify a display type, preferring old show/hide data over the CSS cascade\n\n restoreDisplay = dataShow && dataShow.display;\n\n if (restoreDisplay == null) {\n restoreDisplay = dataPriv.get(elem, \"display\");\n }\n\n display = jQuery.css(elem, \"display\");\n\n if (display === \"none\") {\n if (restoreDisplay) {\n display = restoreDisplay;\n } else {\n // Get nonempty value(s) by temporarily forcing visibility\n showHide([elem], true);\n restoreDisplay = elem.style.display || restoreDisplay;\n display = jQuery.css(elem, \"display\");\n showHide([elem]);\n }\n } // Animate inline elements as inline-block\n\n\n if (display === \"inline\" || display === \"inline-block\" && restoreDisplay != null) {\n if (jQuery.css(elem, \"float\") === \"none\") {\n // Restore the original display value at the end of pure show/hide animations\n if (!propTween) {\n anim.done(function () {\n style.display = restoreDisplay;\n });\n\n if (restoreDisplay == null) {\n display = style.display;\n restoreDisplay = display === \"none\" ? \"\" : display;\n }\n }\n\n style.display = \"inline-block\";\n }\n }\n }\n\n if (opts.overflow) {\n style.overflow = \"hidden\";\n anim.always(function () {\n style.overflow = opts.overflow[0];\n style.overflowX = opts.overflow[1];\n style.overflowY = opts.overflow[2];\n });\n } // Implement show/hide animations\n\n\n propTween = false;\n\n for (prop in orig) {\n // General show/hide setup for this element animation\n if (!propTween) {\n if (dataShow) {\n if (\"hidden\" in dataShow) {\n hidden = dataShow.hidden;\n }\n } else {\n dataShow = dataPriv.access(elem, \"fxshow\", {\n display: restoreDisplay\n });\n } // Store hidden/visible for toggle so `.stop().toggle()` \"reverses\"\n\n\n if (toggle) {\n dataShow.hidden = !hidden;\n } // Show elements before animating them\n\n\n if (hidden) {\n showHide([elem], true);\n }\n /* eslint-disable no-loop-func */\n\n\n anim.done(function () {\n /* eslint-enable no-loop-func */\n // The final step of a \"hide\" animation is actually hiding the element\n if (!hidden) {\n showHide([elem]);\n }\n\n dataPriv.remove(elem, \"fxshow\");\n\n for (prop in orig) {\n jQuery.style(elem, prop, orig[prop]);\n }\n });\n } // Per-property setup\n\n\n propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);\n\n if (!(prop in dataShow)) {\n dataShow[prop] = propTween.start;\n\n if (hidden) {\n propTween.end = propTween.start;\n propTween.start = 0;\n }\n }\n }\n }\n\n function propFilter(props, specialEasing) {\n var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass\n\n for (index in props) {\n name = camelCase(index);\n easing = specialEasing[name];\n value = props[index];\n\n if (Array.isArray(value)) {\n easing = value[1];\n value = props[index] = value[0];\n }\n\n if (index !== name) {\n props[name] = value;\n delete props[index];\n }\n\n hooks = jQuery.cssHooks[name];\n\n if (hooks && \"expand\" in hooks) {\n value = hooks.expand(value);\n delete props[name]; // Not quite $.extend, this won't overwrite existing keys.\n // Reusing 'index' because we have the correct \"name\"\n\n for (index in value) {\n if (!(index in props)) {\n props[index] = value[index];\n specialEasing[index] = easing;\n }\n }\n } else {\n specialEasing[name] = easing;\n }\n }\n }\n\n function Animation(elem, properties, options) {\n var result,\n stopped,\n index = 0,\n length = Animation.prefilters.length,\n deferred = jQuery.Deferred().always(function () {\n // Don't match elem in the :animated selector\n delete tick.elem;\n }),\n tick = function tick() {\n if (stopped) {\n return false;\n }\n\n var currentTime = fxNow || createFxNow(),\n remaining = Math.max(0, animation.startTime + animation.duration - currentTime),\n // Support: Android 2.3 only\n // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)\n temp = remaining / animation.duration || 0,\n percent = 1 - temp,\n index = 0,\n length = animation.tweens.length;\n\n for (; index < length; index++) {\n animation.tweens[index].run(percent);\n }\n\n deferred.notifyWith(elem, [animation, percent, remaining]); // If there's more to do, yield\n\n if (percent < 1 && length) {\n return remaining;\n } // If this was an empty animation, synthesize a final progress notification\n\n\n if (!length) {\n deferred.notifyWith(elem, [animation, 1, 0]);\n } // Resolve the animation and report its conclusion\n\n\n deferred.resolveWith(elem, [animation]);\n return false;\n },\n animation = deferred.promise({\n elem: elem,\n props: jQuery.extend({}, properties),\n opts: jQuery.extend(true, {\n specialEasing: {},\n easing: jQuery.easing._default\n }, options),\n originalProperties: properties,\n originalOptions: options,\n startTime: fxNow || createFxNow(),\n duration: options.duration,\n tweens: [],\n createTween: function createTween(prop, end) {\n var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);\n animation.tweens.push(tween);\n return tween;\n },\n stop: function stop(gotoEnd) {\n var index = 0,\n // If we are going to the end, we want to run all the tweens\n // otherwise we skip this part\n length = gotoEnd ? animation.tweens.length : 0;\n\n if (stopped) {\n return this;\n }\n\n stopped = true;\n\n for (; index < length; index++) {\n animation.tweens[index].run(1);\n } // Resolve when we played the last frame; otherwise, reject\n\n\n if (gotoEnd) {\n deferred.notifyWith(elem, [animation, 1, 0]);\n deferred.resolveWith(elem, [animation, gotoEnd]);\n } else {\n deferred.rejectWith(elem, [animation, gotoEnd]);\n }\n\n return this;\n }\n }),\n props = animation.props;\n\n propFilter(props, animation.opts.specialEasing);\n\n for (; index < length; index++) {\n result = Animation.prefilters[index].call(animation, elem, props, animation.opts);\n\n if (result) {\n if (isFunction(result.stop)) {\n jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);\n }\n\n return result;\n }\n }\n\n jQuery.map(props, createTween, animation);\n\n if (isFunction(animation.opts.start)) {\n animation.opts.start.call(elem, animation);\n } // Attach callbacks from options\n\n\n animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);\n jQuery.fx.timer(jQuery.extend(tick, {\n elem: elem,\n anim: animation,\n queue: animation.opts.queue\n }));\n return animation;\n }\n\n jQuery.Animation = jQuery.extend(Animation, {\n tweeners: {\n \"*\": [function (prop, value) {\n var tween = this.createTween(prop, value);\n adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);\n return tween;\n }]\n },\n tweener: function tweener(props, callback) {\n if (isFunction(props)) {\n callback = props;\n props = [\"*\"];\n } else {\n props = props.match(rnothtmlwhite);\n }\n\n var prop,\n index = 0,\n length = props.length;\n\n for (; index < length; index++) {\n prop = props[index];\n Animation.tweeners[prop] = Animation.tweeners[prop] || [];\n Animation.tweeners[prop].unshift(callback);\n }\n },\n prefilters: [defaultPrefilter],\n prefilter: function prefilter(callback, prepend) {\n if (prepend) {\n Animation.prefilters.unshift(callback);\n } else {\n Animation.prefilters.push(callback);\n }\n }\n });\n\n jQuery.speed = function (speed, easing, fn) {\n var opt = speed && _typeof(speed) === \"object\" ? jQuery.extend({}, speed) : {\n complete: fn || !fn && easing || isFunction(speed) && speed,\n duration: speed,\n easing: fn && easing || easing && !isFunction(easing) && easing\n }; // Go to the end state if fx are off\n\n if (jQuery.fx.off) {\n opt.duration = 0;\n } else {\n if (typeof opt.duration !== \"number\") {\n if (opt.duration in jQuery.fx.speeds) {\n opt.duration = jQuery.fx.speeds[opt.duration];\n } else {\n opt.duration = jQuery.fx.speeds._default;\n }\n }\n } // Normalize opt.queue - true/undefined/null -> \"fx\"\n\n\n if (opt.queue == null || opt.queue === true) {\n opt.queue = \"fx\";\n } // Queueing\n\n\n opt.old = opt.complete;\n\n opt.complete = function () {\n if (isFunction(opt.old)) {\n opt.old.call(this);\n }\n\n if (opt.queue) {\n jQuery.dequeue(this, opt.queue);\n }\n };\n\n return opt;\n };\n\n jQuery.fn.extend({\n fadeTo: function fadeTo(speed, to, easing, callback) {\n // Show any hidden elements after setting opacity to 0\n return this.filter(isHiddenWithinTree).css(\"opacity\", 0).show() // Animate to the value specified\n .end().animate({\n opacity: to\n }, speed, easing, callback);\n },\n animate: function animate(prop, speed, easing, callback) {\n var empty = jQuery.isEmptyObject(prop),\n optall = jQuery.speed(speed, easing, callback),\n doAnimation = function doAnimation() {\n // Operate on a copy of prop so per-property easing won't be lost\n var anim = Animation(this, jQuery.extend({}, prop), optall); // Empty animations, or finishing resolves immediately\n\n if (empty || dataPriv.get(this, \"finish\")) {\n anim.stop(true);\n }\n };\n\n doAnimation.finish = doAnimation;\n return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);\n },\n stop: function stop(type, clearQueue, gotoEnd) {\n var stopQueue = function stopQueue(hooks) {\n var stop = hooks.stop;\n delete hooks.stop;\n stop(gotoEnd);\n };\n\n if (typeof type !== \"string\") {\n gotoEnd = clearQueue;\n clearQueue = type;\n type = undefined;\n }\n\n if (clearQueue) {\n this.queue(type || \"fx\", []);\n }\n\n return this.each(function () {\n var dequeue = true,\n index = type != null && type + \"queueHooks\",\n timers = jQuery.timers,\n data = dataPriv.get(this);\n\n if (index) {\n if (data[index] && data[index].stop) {\n stopQueue(data[index]);\n }\n } else {\n for (index in data) {\n if (data[index] && data[index].stop && rrun.test(index)) {\n stopQueue(data[index]);\n }\n }\n }\n\n for (index = timers.length; index--;) {\n if (timers[index].elem === this && (type == null || timers[index].queue === type)) {\n timers[index].anim.stop(gotoEnd);\n dequeue = false;\n timers.splice(index, 1);\n }\n } // Start the next in the queue if the last step wasn't forced.\n // Timers currently will call their complete callbacks, which\n // will dequeue but only if they were gotoEnd.\n\n\n if (dequeue || !gotoEnd) {\n jQuery.dequeue(this, type);\n }\n });\n },\n finish: function finish(type) {\n if (type !== false) {\n type = type || \"fx\";\n }\n\n return this.each(function () {\n var index,\n data = dataPriv.get(this),\n queue = data[type + \"queue\"],\n hooks = data[type + \"queueHooks\"],\n timers = jQuery.timers,\n length = queue ? queue.length : 0; // Enable finishing flag on private data\n\n data.finish = true; // Empty the queue first\n\n jQuery.queue(this, type, []);\n\n if (hooks && hooks.stop) {\n hooks.stop.call(this, true);\n } // Look for any active animations, and finish them\n\n\n for (index = timers.length; index--;) {\n if (timers[index].elem === this && timers[index].queue === type) {\n timers[index].anim.stop(true);\n timers.splice(index, 1);\n }\n } // Look for any animations in the old queue and finish them\n\n\n for (index = 0; index < length; index++) {\n if (queue[index] && queue[index].finish) {\n queue[index].finish.call(this);\n }\n } // Turn off finishing flag\n\n\n delete data.finish;\n });\n }\n });\n jQuery.each([\"toggle\", \"show\", \"hide\"], function (_i, name) {\n var cssFn = jQuery.fn[name];\n\n jQuery.fn[name] = function (speed, easing, callback) {\n return speed == null || typeof speed === \"boolean\" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);\n };\n }); // Generate shortcuts for custom animations\n\n jQuery.each({\n slideDown: genFx(\"show\"),\n slideUp: genFx(\"hide\"),\n slideToggle: genFx(\"toggle\"),\n fadeIn: {\n opacity: \"show\"\n },\n fadeOut: {\n opacity: \"hide\"\n },\n fadeToggle: {\n opacity: \"toggle\"\n }\n }, function (name, props) {\n jQuery.fn[name] = function (speed, easing, callback) {\n return this.animate(props, speed, easing, callback);\n };\n });\n jQuery.timers = [];\n\n jQuery.fx.tick = function () {\n var timer,\n i = 0,\n timers = jQuery.timers;\n fxNow = Date.now();\n\n for (; i < timers.length; i++) {\n timer = timers[i]; // Run the timer and safely remove it when done (allowing for external removal)\n\n if (!timer() && timers[i] === timer) {\n timers.splice(i--, 1);\n }\n }\n\n if (!timers.length) {\n jQuery.fx.stop();\n }\n\n fxNow = undefined;\n };\n\n jQuery.fx.timer = function (timer) {\n jQuery.timers.push(timer);\n jQuery.fx.start();\n };\n\n jQuery.fx.interval = 13;\n\n jQuery.fx.start = function () {\n if (inProgress) {\n return;\n }\n\n inProgress = true;\n schedule();\n };\n\n jQuery.fx.stop = function () {\n inProgress = null;\n };\n\n jQuery.fx.speeds = {\n slow: 600,\n fast: 200,\n // Default speed\n _default: 400\n }; // Based off of the plugin by Clint Helfers, with permission.\n // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/\n\n jQuery.fn.delay = function (time, type) {\n time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;\n type = type || \"fx\";\n return this.queue(type, function (next, hooks) {\n var timeout = window.setTimeout(next, time);\n\n hooks.stop = function () {\n window.clearTimeout(timeout);\n };\n });\n };\n\n (function () {\n var input = document.createElement(\"input\"),\n select = document.createElement(\"select\"),\n opt = select.appendChild(document.createElement(\"option\"));\n input.type = \"checkbox\"; // Support: Android <=4.3 only\n // Default value for a checkbox should be \"on\"\n\n support.checkOn = input.value !== \"\"; // Support: IE <=11 only\n // Must access selectedIndex to make default options select\n\n support.optSelected = opt.selected; // Support: IE <=11 only\n // An input loses its value after becoming a radio\n\n input = document.createElement(\"input\");\n input.value = \"t\";\n input.type = \"radio\";\n support.radioValue = input.value === \"t\";\n })();\n\n var boolHook,\n attrHandle = jQuery.expr.attrHandle;\n jQuery.fn.extend({\n attr: function attr(name, value) {\n return access(this, jQuery.attr, name, value, arguments.length > 1);\n },\n removeAttr: function removeAttr(name) {\n return this.each(function () {\n jQuery.removeAttr(this, name);\n });\n }\n });\n jQuery.extend({\n attr: function attr(elem, name, value) {\n var ret,\n hooks,\n nType = elem.nodeType; // Don't get/set attributes on text, comment and attribute nodes\n\n if (nType === 3 || nType === 8 || nType === 2) {\n return;\n } // Fallback to prop when attributes are not supported\n\n\n if (typeof elem.getAttribute === \"undefined\") {\n return jQuery.prop(elem, name, value);\n } // Attribute hooks are determined by the lowercase version\n // Grab necessary hook if one is defined\n\n\n if (nType !== 1 || !jQuery.isXMLDoc(elem)) {\n hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);\n }\n\n if (value !== undefined) {\n if (value === null) {\n jQuery.removeAttr(elem, name);\n return;\n }\n\n if (hooks && \"set\" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {\n return ret;\n }\n\n elem.setAttribute(name, value + \"\");\n return value;\n }\n\n if (hooks && \"get\" in hooks && (ret = hooks.get(elem, name)) !== null) {\n return ret;\n }\n\n ret = jQuery.find.attr(elem, name); // Non-existent attributes return null, we normalize to undefined\n\n return ret == null ? undefined : ret;\n },\n attrHooks: {\n type: {\n set: function set(elem, value) {\n if (!support.radioValue && value === \"radio\" && nodeName(elem, \"input\")) {\n var val = elem.value;\n elem.setAttribute(\"type\", value);\n\n if (val) {\n elem.value = val;\n }\n\n return value;\n }\n }\n }\n },\n removeAttr: function removeAttr(elem, value) {\n var name,\n i = 0,\n // Attribute names can contain non-HTML whitespace characters\n // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n attrNames = value && value.match(rnothtmlwhite);\n\n if (attrNames && elem.nodeType === 1) {\n while (name = attrNames[i++]) {\n elem.removeAttribute(name);\n }\n }\n }\n }); // Hooks for boolean attributes\n\n boolHook = {\n set: function set(elem, value, name) {\n if (value === false) {\n // Remove boolean attributes when set to false\n jQuery.removeAttr(elem, name);\n } else {\n elem.setAttribute(name, name);\n }\n\n return name;\n }\n };\n jQuery.each(jQuery.expr.match.bool.source.match(/\\w+/g), function (_i, name) {\n var getter = attrHandle[name] || jQuery.find.attr;\n\n attrHandle[name] = function (elem, name, isXML) {\n var ret,\n handle,\n lowercaseName = name.toLowerCase();\n\n if (!isXML) {\n // Avoid an infinite loop by temporarily removing this function from the getter\n handle = attrHandle[lowercaseName];\n attrHandle[lowercaseName] = ret;\n ret = getter(elem, name, isXML) != null ? lowercaseName : null;\n attrHandle[lowercaseName] = handle;\n }\n\n return ret;\n };\n });\n var rfocusable = /^(?:input|select|textarea|button)$/i,\n rclickable = /^(?:a|area)$/i;\n jQuery.fn.extend({\n prop: function prop(name, value) {\n return access(this, jQuery.prop, name, value, arguments.length > 1);\n },\n removeProp: function removeProp(name) {\n return this.each(function () {\n delete this[jQuery.propFix[name] || name];\n });\n }\n });\n jQuery.extend({\n prop: function prop(elem, name, value) {\n var ret,\n hooks,\n nType = elem.nodeType; // Don't get/set properties on text, comment and attribute nodes\n\n if (nType === 3 || nType === 8 || nType === 2) {\n return;\n }\n\n if (nType !== 1 || !jQuery.isXMLDoc(elem)) {\n // Fix name and attach hooks\n name = jQuery.propFix[name] || name;\n hooks = jQuery.propHooks[name];\n }\n\n if (value !== undefined) {\n if (hooks && \"set\" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {\n return ret;\n }\n\n return elem[name] = value;\n }\n\n if (hooks && \"get\" in hooks && (ret = hooks.get(elem, name)) !== null) {\n return ret;\n }\n\n return elem[name];\n },\n propHooks: {\n tabIndex: {\n get: function get(elem) {\n // Support: IE <=9 - 11 only\n // elem.tabIndex doesn't always return the\n // correct value when it hasn't been explicitly set\n // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n // Use proper attribute retrieval(#12072)\n var tabindex = jQuery.find.attr(elem, \"tabindex\");\n\n if (tabindex) {\n return parseInt(tabindex, 10);\n }\n\n if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {\n return 0;\n }\n\n return -1;\n }\n }\n },\n propFix: {\n \"for\": \"htmlFor\",\n \"class\": \"className\"\n }\n }); // Support: IE <=11 only\n // Accessing the selectedIndex property\n // forces the browser to respect setting selected\n // on the option\n // The getter ensures a default option is selected\n // when in an optgroup\n // eslint rule \"no-unused-expressions\" is disabled for this code\n // since it considers such accessions noop\n\n if (!support.optSelected) {\n jQuery.propHooks.selected = {\n get: function get(elem) {\n /* eslint no-unused-expressions: \"off\" */\n var parent = elem.parentNode;\n\n if (parent && parent.parentNode) {\n parent.parentNode.selectedIndex;\n }\n\n return null;\n },\n set: function set(elem) {\n /* eslint no-unused-expressions: \"off\" */\n var parent = elem.parentNode;\n\n if (parent) {\n parent.selectedIndex;\n\n if (parent.parentNode) {\n parent.parentNode.selectedIndex;\n }\n }\n }\n };\n }\n\n jQuery.each([\"tabIndex\", \"readOnly\", \"maxLength\", \"cellSpacing\", \"cellPadding\", \"rowSpan\", \"colSpan\", \"useMap\", \"frameBorder\", \"contentEditable\"], function () {\n jQuery.propFix[this.toLowerCase()] = this;\n }); // Strip and collapse whitespace according to HTML spec\n // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace\n\n function stripAndCollapse(value) {\n var tokens = value.match(rnothtmlwhite) || [];\n return tokens.join(\" \");\n }\n\n function getClass(elem) {\n return elem.getAttribute && elem.getAttribute(\"class\") || \"\";\n }\n\n function classesToArray(value) {\n if (Array.isArray(value)) {\n return value;\n }\n\n if (typeof value === \"string\") {\n return value.match(rnothtmlwhite) || [];\n }\n\n return [];\n }\n\n jQuery.fn.extend({\n addClass: function addClass(value) {\n var classes,\n elem,\n cur,\n curValue,\n clazz,\n j,\n finalValue,\n i = 0;\n\n if (isFunction(value)) {\n return this.each(function (j) {\n jQuery(this).addClass(value.call(this, j, getClass(this)));\n });\n }\n\n classes = classesToArray(value);\n\n if (classes.length) {\n while (elem = this[i++]) {\n curValue = getClass(elem);\n cur = elem.nodeType === 1 && \" \" + stripAndCollapse(curValue) + \" \";\n\n if (cur) {\n j = 0;\n\n while (clazz = classes[j++]) {\n if (cur.indexOf(\" \" + clazz + \" \") < 0) {\n cur += clazz + \" \";\n }\n } // Only assign if different to avoid unneeded rendering.\n\n\n finalValue = stripAndCollapse(cur);\n\n if (curValue !== finalValue) {\n elem.setAttribute(\"class\", finalValue);\n }\n }\n }\n }\n\n return this;\n },\n removeClass: function removeClass(value) {\n var classes,\n elem,\n cur,\n curValue,\n clazz,\n j,\n finalValue,\n i = 0;\n\n if (isFunction(value)) {\n return this.each(function (j) {\n jQuery(this).removeClass(value.call(this, j, getClass(this)));\n });\n }\n\n if (!arguments.length) {\n return this.attr(\"class\", \"\");\n }\n\n classes = classesToArray(value);\n\n if (classes.length) {\n while (elem = this[i++]) {\n curValue = getClass(elem); // This expression is here for better compressibility (see addClass)\n\n cur = elem.nodeType === 1 && \" \" + stripAndCollapse(curValue) + \" \";\n\n if (cur) {\n j = 0;\n\n while (clazz = classes[j++]) {\n // Remove *all* instances\n while (cur.indexOf(\" \" + clazz + \" \") > -1) {\n cur = cur.replace(\" \" + clazz + \" \", \" \");\n }\n } // Only assign if different to avoid unneeded rendering.\n\n\n finalValue = stripAndCollapse(cur);\n\n if (curValue !== finalValue) {\n elem.setAttribute(\"class\", finalValue);\n }\n }\n }\n }\n\n return this;\n },\n toggleClass: function toggleClass(value, stateVal) {\n var type = _typeof(value),\n isValidValue = type === \"string\" || Array.isArray(value);\n\n if (typeof stateVal === \"boolean\" && isValidValue) {\n return stateVal ? this.addClass(value) : this.removeClass(value);\n }\n\n if (isFunction(value)) {\n return this.each(function (i) {\n jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);\n });\n }\n\n return this.each(function () {\n var className, i, self, classNames;\n\n if (isValidValue) {\n // Toggle individual class names\n i = 0;\n self = jQuery(this);\n classNames = classesToArray(value);\n\n while (className = classNames[i++]) {\n // Check each className given, space separated list\n if (self.hasClass(className)) {\n self.removeClass(className);\n } else {\n self.addClass(className);\n }\n } // Toggle whole class name\n\n } else if (value === undefined || type === \"boolean\") {\n className = getClass(this);\n\n if (className) {\n // Store className if set\n dataPriv.set(this, \"__className__\", className);\n } // If the element has a class name or if we're passed `false`,\n // then remove the whole classname (if there was one, the above saved it).\n // Otherwise bring back whatever was previously saved (if anything),\n // falling back to the empty string if nothing was stored.\n\n\n if (this.setAttribute) {\n this.setAttribute(\"class\", className || value === false ? \"\" : dataPriv.get(this, \"__className__\") || \"\");\n }\n }\n });\n },\n hasClass: function hasClass(selector) {\n var className,\n elem,\n i = 0;\n className = \" \" + selector + \" \";\n\n while (elem = this[i++]) {\n if (elem.nodeType === 1 && (\" \" + stripAndCollapse(getClass(elem)) + \" \").indexOf(className) > -1) {\n return true;\n }\n }\n\n return false;\n }\n });\n var rreturn = /\\r/g;\n jQuery.fn.extend({\n val: function val(value) {\n var hooks,\n ret,\n valueIsFunction,\n elem = this[0];\n\n if (!arguments.length) {\n if (elem) {\n hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];\n\n if (hooks && \"get\" in hooks && (ret = hooks.get(elem, \"value\")) !== undefined) {\n return ret;\n }\n\n ret = elem.value; // Handle most common string cases\n\n if (typeof ret === \"string\") {\n return ret.replace(rreturn, \"\");\n } // Handle cases where value is null/undef or number\n\n\n return ret == null ? \"\" : ret;\n }\n\n return;\n }\n\n valueIsFunction = isFunction(value);\n return this.each(function (i) {\n var val;\n\n if (this.nodeType !== 1) {\n return;\n }\n\n if (valueIsFunction) {\n val = value.call(this, i, jQuery(this).val());\n } else {\n val = value;\n } // Treat null/undefined as \"\"; convert numbers to string\n\n\n if (val == null) {\n val = \"\";\n } else if (typeof val === \"number\") {\n val += \"\";\n } else if (Array.isArray(val)) {\n val = jQuery.map(val, function (value) {\n return value == null ? \"\" : value + \"\";\n });\n }\n\n hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; // If set returns undefined, fall back to normal setting\n\n if (!hooks || !(\"set\" in hooks) || hooks.set(this, val, \"value\") === undefined) {\n this.value = val;\n }\n });\n }\n });\n jQuery.extend({\n valHooks: {\n option: {\n get: function get(elem) {\n var val = jQuery.find.attr(elem, \"value\");\n return val != null ? val : // Support: IE <=10 - 11 only\n // option.text throws exceptions (#14686, #14858)\n // Strip and collapse whitespace\n // https://html.spec.whatwg.org/#strip-and-collapse-whitespace\n stripAndCollapse(jQuery.text(elem));\n }\n },\n select: {\n get: function get(elem) {\n var value,\n option,\n i,\n options = elem.options,\n index = elem.selectedIndex,\n one = elem.type === \"select-one\",\n values = one ? null : [],\n max = one ? index + 1 : options.length;\n\n if (index < 0) {\n i = max;\n } else {\n i = one ? index : 0;\n } // Loop through all the selected options\n\n\n for (; i < max; i++) {\n option = options[i]; // Support: IE <=9 only\n // IE8-9 doesn't update selected after form reset (#2551)\n\n if ((option.selected || i === index) && // Don't return options that are disabled or in a disabled optgroup\n !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, \"optgroup\"))) {\n // Get the specific value for the option\n value = jQuery(option).val(); // We don't need an array for one selects\n\n if (one) {\n return value;\n } // Multi-Selects return an array\n\n\n values.push(value);\n }\n }\n\n return values;\n },\n set: function set(elem, value) {\n var optionSet,\n option,\n options = elem.options,\n values = jQuery.makeArray(value),\n i = options.length;\n\n while (i--) {\n option = options[i];\n /* eslint-disable no-cond-assign */\n\n if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {\n optionSet = true;\n }\n /* eslint-enable no-cond-assign */\n\n } // Force browsers to behave consistently when non-matching value is set\n\n\n if (!optionSet) {\n elem.selectedIndex = -1;\n }\n\n return values;\n }\n }\n }\n }); // Radios and checkboxes getter/setter\n\n jQuery.each([\"radio\", \"checkbox\"], function () {\n jQuery.valHooks[this] = {\n set: function set(elem, value) {\n if (Array.isArray(value)) {\n return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;\n }\n }\n };\n\n if (!support.checkOn) {\n jQuery.valHooks[this].get = function (elem) {\n return elem.getAttribute(\"value\") === null ? \"on\" : elem.value;\n };\n }\n }); // Return jQuery for attributes-only inclusion\n\n support.focusin = \"onfocusin\" in window;\n\n var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n stopPropagationCallback = function stopPropagationCallback(e) {\n e.stopPropagation();\n };\n\n jQuery.extend(jQuery.event, {\n trigger: function trigger(event, data, elem, onlyHandlers) {\n var i,\n cur,\n tmp,\n bubbleType,\n ontype,\n handle,\n special,\n lastElement,\n eventPath = [elem || document],\n type = hasOwn.call(event, \"type\") ? event.type : event,\n namespaces = hasOwn.call(event, \"namespace\") ? event.namespace.split(\".\") : [];\n cur = lastElement = tmp = elem = elem || document; // Don't do events on text and comment nodes\n\n if (elem.nodeType === 3 || elem.nodeType === 8) {\n return;\n } // focus/blur morphs to focusin/out; ensure we're not firing them right now\n\n\n if (rfocusMorph.test(type + jQuery.event.triggered)) {\n return;\n }\n\n if (type.indexOf(\".\") > -1) {\n // Namespaced trigger; create a regexp to match event type in handle()\n namespaces = type.split(\".\");\n type = namespaces.shift();\n namespaces.sort();\n }\n\n ontype = type.indexOf(\":\") < 0 && \"on\" + type; // Caller can pass in a jQuery.Event object, Object, or just an event type string\n\n event = event[jQuery.expando] ? event : new jQuery.Event(type, _typeof(event) === \"object\" && event); // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n\n event.isTrigger = onlyHandlers ? 2 : 3;\n event.namespace = namespaces.join(\".\");\n event.rnamespace = event.namespace ? new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") : null; // Clean up the event in case it is being reused\n\n event.result = undefined;\n\n if (!event.target) {\n event.target = elem;\n } // Clone any incoming data and prepend the event, creating the handler arg list\n\n\n data = data == null ? [event] : jQuery.makeArray(data, [event]); // Allow special events to draw outside the lines\n\n special = jQuery.event.special[type] || {};\n\n if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {\n return;\n } // Determine event propagation path in advance, per W3C events spec (#9951)\n // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n\n\n if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {\n bubbleType = special.delegateType || type;\n\n if (!rfocusMorph.test(bubbleType + type)) {\n cur = cur.parentNode;\n }\n\n for (; cur; cur = cur.parentNode) {\n eventPath.push(cur);\n tmp = cur;\n } // Only add window if we got to document (e.g., not plain obj or detached DOM)\n\n\n if (tmp === (elem.ownerDocument || document)) {\n eventPath.push(tmp.defaultView || tmp.parentWindow || window);\n }\n } // Fire handlers on the event path\n\n\n i = 0;\n\n while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {\n lastElement = cur;\n event.type = i > 1 ? bubbleType : special.bindType || type; // jQuery handler\n\n handle = (dataPriv.get(cur, \"events\") || Object.create(null))[event.type] && dataPriv.get(cur, \"handle\");\n\n if (handle) {\n handle.apply(cur, data);\n } // Native handler\n\n\n handle = ontype && cur[ontype];\n\n if (handle && handle.apply && acceptData(cur)) {\n event.result = handle.apply(cur, data);\n\n if (event.result === false) {\n event.preventDefault();\n }\n }\n }\n\n event.type = type; // If nobody prevented the default action, do it now\n\n if (!onlyHandlers && !event.isDefaultPrevented()) {\n if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {\n // Call a native DOM method on the target with the same name as the event.\n // Don't do default actions on window, that's where global variables be (#6170)\n if (ontype && isFunction(elem[type]) && !isWindow(elem)) {\n // Don't re-trigger an onFOO event when we call its FOO() method\n tmp = elem[ontype];\n\n if (tmp) {\n elem[ontype] = null;\n } // Prevent re-triggering of the same event, since we already bubbled it above\n\n\n jQuery.event.triggered = type;\n\n if (event.isPropagationStopped()) {\n lastElement.addEventListener(type, stopPropagationCallback);\n }\n\n elem[type]();\n\n if (event.isPropagationStopped()) {\n lastElement.removeEventListener(type, stopPropagationCallback);\n }\n\n jQuery.event.triggered = undefined;\n\n if (tmp) {\n elem[ontype] = tmp;\n }\n }\n }\n }\n\n return event.result;\n },\n // Piggyback on a donor event to simulate a different one\n // Used only for `focus(in | out)` events\n simulate: function simulate(type, elem, event) {\n var e = jQuery.extend(new jQuery.Event(), event, {\n type: type,\n isSimulated: true\n });\n jQuery.event.trigger(e, null, elem);\n }\n });\n jQuery.fn.extend({\n trigger: function trigger(type, data) {\n return this.each(function () {\n jQuery.event.trigger(type, data, this);\n });\n },\n triggerHandler: function triggerHandler(type, data) {\n var elem = this[0];\n\n if (elem) {\n return jQuery.event.trigger(type, data, elem, true);\n }\n }\n }); // Support: Firefox <=44\n // Firefox doesn't have focus(in | out) events\n // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n //\n // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n // focus(in | out) events fire after focus & blur events,\n // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\n\n if (!support.focusin) {\n jQuery.each({\n focus: \"focusin\",\n blur: \"focusout\"\n }, function (orig, fix) {\n // Attach a single capturing handler on the document while someone wants focusin/focusout\n var handler = function handler(event) {\n jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));\n };\n\n jQuery.event.special[fix] = {\n setup: function setup() {\n // Handle: regular nodes (via `this.ownerDocument`), window\n // (via `this.document`) & document (via `this`).\n var doc = this.ownerDocument || this.document || this,\n attaches = dataPriv.access(doc, fix);\n\n if (!attaches) {\n doc.addEventListener(orig, handler, true);\n }\n\n dataPriv.access(doc, fix, (attaches || 0) + 1);\n },\n teardown: function teardown() {\n var doc = this.ownerDocument || this.document || this,\n attaches = dataPriv.access(doc, fix) - 1;\n\n if (!attaches) {\n doc.removeEventListener(orig, handler, true);\n dataPriv.remove(doc, fix);\n } else {\n dataPriv.access(doc, fix, attaches);\n }\n }\n };\n });\n }\n\n var location = window.location;\n var nonce = {\n guid: Date.now()\n };\n var rquery = /\\?/; // Cross-browser xml parsing\n\n jQuery.parseXML = function (data) {\n var xml, parserErrorElem;\n\n if (!data || typeof data !== \"string\") {\n return null;\n } // Support: IE 9 - 11 only\n // IE throws on parseFromString with invalid input.\n\n\n try {\n xml = new window.DOMParser().parseFromString(data, \"text/xml\");\n } catch (e) {}\n\n parserErrorElem = xml && xml.getElementsByTagName(\"parsererror\")[0];\n\n if (!xml || parserErrorElem) {\n jQuery.error(\"Invalid XML: \" + (parserErrorElem ? jQuery.map(parserErrorElem.childNodes, function (el) {\n return el.textContent;\n }).join(\"\\n\") : data));\n }\n\n return xml;\n };\n\n var rbracket = /\\[\\]$/,\n rCRLF = /\\r?\\n/g,\n rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,\n rsubmittable = /^(?:input|select|textarea|keygen)/i;\n\n function buildParams(prefix, obj, traditional, add) {\n var name;\n\n if (Array.isArray(obj)) {\n // Serialize array item.\n jQuery.each(obj, function (i, v) {\n if (traditional || rbracket.test(prefix)) {\n // Treat each array item as a scalar.\n add(prefix, v);\n } else {\n // Item is non-scalar (array or object), encode its numeric index.\n buildParams(prefix + \"[\" + (_typeof(v) === \"object\" && v != null ? i : \"\") + \"]\", v, traditional, add);\n }\n });\n } else if (!traditional && toType(obj) === \"object\") {\n // Serialize object item.\n for (name in obj) {\n buildParams(prefix + \"[\" + name + \"]\", obj[name], traditional, add);\n }\n } else {\n // Serialize scalar item.\n add(prefix, obj);\n }\n } // Serialize an array of form elements or a set of\n // key/values into a query string\n\n\n jQuery.param = function (a, traditional) {\n var prefix,\n s = [],\n add = function add(key, valueOrFunction) {\n // If value is a function, invoke it and use its return value\n var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;\n s[s.length] = encodeURIComponent(key) + \"=\" + encodeURIComponent(value == null ? \"\" : value);\n };\n\n if (a == null) {\n return \"\";\n } // If an array was passed in, assume that it is an array of form elements.\n\n\n if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {\n // Serialize the form elements\n jQuery.each(a, function () {\n add(this.name, this.value);\n });\n } else {\n // If traditional, encode the \"old\" way (the way 1.3.2 or older\n // did it), otherwise encode params recursively.\n for (prefix in a) {\n buildParams(prefix, a[prefix], traditional, add);\n }\n } // Return the resulting serialization\n\n\n return s.join(\"&\");\n };\n\n jQuery.fn.extend({\n serialize: function serialize() {\n return jQuery.param(this.serializeArray());\n },\n serializeArray: function serializeArray() {\n return this.map(function () {\n // Can add propHook for \"elements\" to filter or add form elements\n var elements = jQuery.prop(this, \"elements\");\n return elements ? jQuery.makeArray(elements) : this;\n }).filter(function () {\n var type = this.type; // Use .is( \":disabled\" ) so that fieldset[disabled] works\n\n return this.name && !jQuery(this).is(\":disabled\") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));\n }).map(function (_i, elem) {\n var val = jQuery(this).val();\n\n if (val == null) {\n return null;\n }\n\n if (Array.isArray(val)) {\n return jQuery.map(val, function (val) {\n return {\n name: elem.name,\n value: val.replace(rCRLF, \"\\r\\n\")\n };\n });\n }\n\n return {\n name: elem.name,\n value: val.replace(rCRLF, \"\\r\\n\")\n };\n }).get();\n }\n });\n var r20 = /%20/g,\n rhash = /#.*$/,\n rantiCache = /([?&])_=[^&]*/,\n rheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg,\n // #7653, #8125, #8152: local protocol detection\n rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,\n rnoContent = /^(?:GET|HEAD)$/,\n rprotocol = /^\\/\\//,\n\n /* Prefilters\n * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n * 2) These are called:\n * - BEFORE asking for a transport\n * - AFTER param serialization (s.data is a string if s.processData is true)\n * 3) key is the dataType\n * 4) the catchall symbol \"*\" can be used\n * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n */\n prefilters = {},\n\n /* Transports bindings\n * 1) key is the dataType\n * 2) the catchall symbol \"*\" can be used\n * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n */\n transports = {},\n // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n allTypes = \"*/\".concat(\"*\"),\n // Anchor tag for parsing the document origin\n originAnchor = document.createElement(\"a\");\n originAnchor.href = location.href; // Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\n\n function addToPrefiltersOrTransports(structure) {\n // dataTypeExpression is optional and defaults to \"*\"\n return function (dataTypeExpression, func) {\n if (typeof dataTypeExpression !== \"string\") {\n func = dataTypeExpression;\n dataTypeExpression = \"*\";\n }\n\n var dataType,\n i = 0,\n dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];\n\n if (isFunction(func)) {\n // For each dataType in the dataTypeExpression\n while (dataType = dataTypes[i++]) {\n // Prepend if requested\n if (dataType[0] === \"+\") {\n dataType = dataType.slice(1) || \"*\";\n (structure[dataType] = structure[dataType] || []).unshift(func); // Otherwise append\n } else {\n (structure[dataType] = structure[dataType] || []).push(func);\n }\n }\n }\n };\n } // Base inspection function for prefilters and transports\n\n\n function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {\n var inspected = {},\n seekingTransport = structure === transports;\n\n function inspect(dataType) {\n var selected;\n inspected[dataType] = true;\n jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {\n var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);\n\n if (typeof dataTypeOrTransport === \"string\" && !seekingTransport && !inspected[dataTypeOrTransport]) {\n options.dataTypes.unshift(dataTypeOrTransport);\n inspect(dataTypeOrTransport);\n return false;\n } else if (seekingTransport) {\n return !(selected = dataTypeOrTransport);\n }\n });\n return selected;\n }\n\n return inspect(options.dataTypes[0]) || !inspected[\"*\"] && inspect(\"*\");\n } // A special extend for ajax options\n // that takes \"flat\" options (not to be deep extended)\n // Fixes #9887\n\n\n function ajaxExtend(target, src) {\n var key,\n deep,\n flatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n for (key in src) {\n if (src[key] !== undefined) {\n (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];\n }\n }\n\n if (deep) {\n jQuery.extend(true, target, deep);\n }\n\n return target;\n }\n /* Handles responses to an ajax request:\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\n\n\n function ajaxHandleResponses(s, jqXHR, responses) {\n var ct,\n type,\n finalDataType,\n firstDataType,\n contents = s.contents,\n dataTypes = s.dataTypes; // Remove auto dataType and get content-type in the process\n\n while (dataTypes[0] === \"*\") {\n dataTypes.shift();\n\n if (ct === undefined) {\n ct = s.mimeType || jqXHR.getResponseHeader(\"Content-Type\");\n }\n } // Check if we're dealing with a known content-type\n\n\n if (ct) {\n for (type in contents) {\n if (contents[type] && contents[type].test(ct)) {\n dataTypes.unshift(type);\n break;\n }\n }\n } // Check to see if we have a response for the expected dataType\n\n\n if (dataTypes[0] in responses) {\n finalDataType = dataTypes[0];\n } else {\n // Try convertible dataTypes\n for (type in responses) {\n if (!dataTypes[0] || s.converters[type + \" \" + dataTypes[0]]) {\n finalDataType = type;\n break;\n }\n\n if (!firstDataType) {\n firstDataType = type;\n }\n } // Or just use first one\n\n\n finalDataType = finalDataType || firstDataType;\n } // If we found a dataType\n // We add the dataType to the list if needed\n // and return the corresponding response\n\n\n if (finalDataType) {\n if (finalDataType !== dataTypes[0]) {\n dataTypes.unshift(finalDataType);\n }\n\n return responses[finalDataType];\n }\n }\n /* Chain conversions given the request and the original response\n * Also sets the responseXXX fields on the jqXHR instance\n */\n\n\n function ajaxConvert(s, response, jqXHR, isSuccess) {\n var conv2,\n current,\n conv,\n tmp,\n prev,\n converters = {},\n // Work with a copy of dataTypes in case we need to modify it for conversion\n dataTypes = s.dataTypes.slice(); // Create converters map with lowercased keys\n\n if (dataTypes[1]) {\n for (conv in s.converters) {\n converters[conv.toLowerCase()] = s.converters[conv];\n }\n }\n\n current = dataTypes.shift(); // Convert to each sequential dataType\n\n while (current) {\n if (s.responseFields[current]) {\n jqXHR[s.responseFields[current]] = response;\n } // Apply the dataFilter if provided\n\n\n if (!prev && isSuccess && s.dataFilter) {\n response = s.dataFilter(response, s.dataType);\n }\n\n prev = current;\n current = dataTypes.shift();\n\n if (current) {\n // There's only work to do if current dataType is non-auto\n if (current === \"*\") {\n current = prev; // Convert response if prev dataType is non-auto and differs from current\n } else if (prev !== \"*\" && prev !== current) {\n // Seek a direct converter\n conv = converters[prev + \" \" + current] || converters[\"* \" + current]; // If none found, seek a pair\n\n if (!conv) {\n for (conv2 in converters) {\n // If conv2 outputs current\n tmp = conv2.split(\" \");\n\n if (tmp[1] === current) {\n // If prev can be converted to accepted input\n conv = converters[prev + \" \" + tmp[0]] || converters[\"* \" + tmp[0]];\n\n if (conv) {\n // Condense equivalence converters\n if (conv === true) {\n conv = converters[conv2]; // Otherwise, insert the intermediate dataType\n } else if (converters[conv2] !== true) {\n current = tmp[0];\n dataTypes.unshift(tmp[1]);\n }\n\n break;\n }\n }\n }\n } // Apply converter (if not an equivalence)\n\n\n if (conv !== true) {\n // Unless errors are allowed to bubble, catch and return them\n if (conv && s.throws) {\n response = conv(response);\n } else {\n try {\n response = conv(response);\n } catch (e) {\n return {\n state: \"parsererror\",\n error: conv ? e : \"No conversion from \" + prev + \" to \" + current\n };\n }\n }\n }\n }\n }\n }\n\n return {\n state: \"success\",\n data: response\n };\n }\n\n jQuery.extend({\n // Counter for holding the number of active queries\n active: 0,\n // Last-Modified header cache for next request\n lastModified: {},\n etag: {},\n ajaxSettings: {\n url: location.href,\n type: \"GET\",\n isLocal: rlocalProtocol.test(location.protocol),\n global: true,\n processData: true,\n async: true,\n contentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n\n /*\n timeout: 0,\n data: null,\n dataType: null,\n username: null,\n password: null,\n cache: null,\n throws: false,\n traditional: false,\n headers: {},\n */\n accepts: {\n \"*\": allTypes,\n text: \"text/plain\",\n html: \"text/html\",\n xml: \"application/xml, text/xml\",\n json: \"application/json, text/javascript\"\n },\n contents: {\n xml: /\\bxml\\b/,\n html: /\\bhtml/,\n json: /\\bjson\\b/\n },\n responseFields: {\n xml: \"responseXML\",\n text: \"responseText\",\n json: \"responseJSON\"\n },\n // Data converters\n // Keys separate source (or catchall \"*\") and destination types with a single space\n converters: {\n // Convert anything to text\n \"* text\": String,\n // Text to html (true = no transformation)\n \"text html\": true,\n // Evaluate text as a json expression\n \"text json\": JSON.parse,\n // Parse text as xml\n \"text xml\": jQuery.parseXML\n },\n // For options that shouldn't be deep extended:\n // you can add your own custom options here if\n // and when you create one that shouldn't be\n // deep extended (see ajaxExtend)\n flatOptions: {\n url: true,\n context: true\n }\n },\n // Creates a full fledged settings object into target\n // with both ajaxSettings and settings fields.\n // If target is omitted, writes into ajaxSettings.\n ajaxSetup: function ajaxSetup(target, settings) {\n return settings ? // Building a settings object\n ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : // Extending ajaxSettings\n ajaxExtend(jQuery.ajaxSettings, target);\n },\n ajaxPrefilter: addToPrefiltersOrTransports(prefilters),\n ajaxTransport: addToPrefiltersOrTransports(transports),\n // Main method\n ajax: function ajax(url, options) {\n // If url is an object, simulate pre-1.5 signature\n if (_typeof(url) === \"object\") {\n options = url;\n url = undefined;\n } // Force options to be an object\n\n\n options = options || {};\n\n var transport,\n // URL without anti-cache param\n cacheURL,\n // Response headers\n responseHeadersString,\n responseHeaders,\n // timeout handle\n timeoutTimer,\n // Url cleanup var\n urlAnchor,\n // Request state (becomes false upon send and true upon completion)\n completed,\n // To know if global events are to be dispatched\n fireGlobals,\n // Loop variable\n i,\n // uncached part of the url\n uncached,\n // Create the final options object\n s = jQuery.ajaxSetup({}, options),\n // Callbacks context\n callbackContext = s.context || s,\n // Context for global events is callbackContext if it is a DOM node or jQuery collection\n globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,\n // Deferreds\n deferred = jQuery.Deferred(),\n completeDeferred = jQuery.Callbacks(\"once memory\"),\n // Status-dependent callbacks\n _statusCode = s.statusCode || {},\n // Headers (they are sent all at once)\n requestHeaders = {},\n requestHeadersNames = {},\n // Default abort message\n strAbort = \"canceled\",\n // Fake xhr\n jqXHR = {\n readyState: 0,\n // Builds headers hashtable if needed\n getResponseHeader: function getResponseHeader(key) {\n var match;\n\n if (completed) {\n if (!responseHeaders) {\n responseHeaders = {};\n\n while (match = rheaders.exec(responseHeadersString)) {\n responseHeaders[match[1].toLowerCase() + \" \"] = (responseHeaders[match[1].toLowerCase() + \" \"] || []).concat(match[2]);\n }\n }\n\n match = responseHeaders[key.toLowerCase() + \" \"];\n }\n\n return match == null ? null : match.join(\", \");\n },\n // Raw string\n getAllResponseHeaders: function getAllResponseHeaders() {\n return completed ? responseHeadersString : null;\n },\n // Caches the header\n setRequestHeader: function setRequestHeader(name, value) {\n if (completed == null) {\n name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;\n requestHeaders[name] = value;\n }\n\n return this;\n },\n // Overrides response content-type header\n overrideMimeType: function overrideMimeType(type) {\n if (completed == null) {\n s.mimeType = type;\n }\n\n return this;\n },\n // Status-dependent callbacks\n statusCode: function statusCode(map) {\n var code;\n\n if (map) {\n if (completed) {\n // Execute the appropriate callbacks\n jqXHR.always(map[jqXHR.status]);\n } else {\n // Lazy-add the new callbacks in a way that preserves old ones\n for (code in map) {\n _statusCode[code] = [_statusCode[code], map[code]];\n }\n }\n }\n\n return this;\n },\n // Cancel the request\n abort: function abort(statusText) {\n var finalText = statusText || strAbort;\n\n if (transport) {\n transport.abort(finalText);\n }\n\n done(0, finalText);\n return this;\n }\n }; // Attach deferreds\n\n\n deferred.promise(jqXHR); // Add protocol if not provided (prefilters might expect it)\n // Handle falsy url in the settings object (#10093: consistency with old signature)\n // We also use the url parameter if available\n\n s.url = ((url || s.url || location.href) + \"\").replace(rprotocol, location.protocol + \"//\"); // Alias method option to type as per ticket #12004\n\n s.type = options.method || options.type || s.method || s.type; // Extract dataTypes list\n\n s.dataTypes = (s.dataType || \"*\").toLowerCase().match(rnothtmlwhite) || [\"\"]; // A cross-domain request is in order when the origin doesn't match the current origin.\n\n if (s.crossDomain == null) {\n urlAnchor = document.createElement(\"a\"); // Support: IE <=8 - 11, Edge 12 - 15\n // IE throws exception on accessing the href property if url is malformed,\n // e.g. http://example.com:80x/\n\n try {\n urlAnchor.href = s.url; // Support: IE <=8 - 11 only\n // Anchor's host property isn't correctly set when s.url is relative\n\n urlAnchor.href = urlAnchor.href;\n s.crossDomain = originAnchor.protocol + \"//\" + originAnchor.host !== urlAnchor.protocol + \"//\" + urlAnchor.host;\n } catch (e) {\n // If there is an error parsing the URL, assume it is crossDomain,\n // it can be rejected by the transport if it is invalid\n s.crossDomain = true;\n }\n } // Convert data if not already a string\n\n\n if (s.data && s.processData && typeof s.data !== \"string\") {\n s.data = jQuery.param(s.data, s.traditional);\n } // Apply prefilters\n\n\n inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); // If request was aborted inside a prefilter, stop there\n\n if (completed) {\n return jqXHR;\n } // We can fire global events as of now if asked to\n // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)\n\n\n fireGlobals = jQuery.event && s.global; // Watch for a new set of requests\n\n if (fireGlobals && jQuery.active++ === 0) {\n jQuery.event.trigger(\"ajaxStart\");\n } // Uppercase the type\n\n\n s.type = s.type.toUpperCase(); // Determine if request has content\n\n s.hasContent = !rnoContent.test(s.type); // Save the URL in case we're toying with the If-Modified-Since\n // and/or If-None-Match header later on\n // Remove hash to simplify url manipulation\n\n cacheURL = s.url.replace(rhash, \"\"); // More options handling for requests with no content\n\n if (!s.hasContent) {\n // Remember the hash so we can put it back\n uncached = s.url.slice(cacheURL.length); // If data is available and should be processed, append data to url\n\n if (s.data && (s.processData || typeof s.data === \"string\")) {\n cacheURL += (rquery.test(cacheURL) ? \"&\" : \"?\") + s.data; // #9682: remove data so that it's not used in an eventual retry\n\n delete s.data;\n } // Add or update anti-cache param if needed\n\n\n if (s.cache === false) {\n cacheURL = cacheURL.replace(rantiCache, \"$1\");\n uncached = (rquery.test(cacheURL) ? \"&\" : \"?\") + \"_=\" + nonce.guid++ + uncached;\n } // Put hash and anti-cache on the URL that will be requested (gh-1732)\n\n\n s.url = cacheURL + uncached; // Change '%20' to '+' if this is encoded form body content (gh-2658)\n } else if (s.data && s.processData && (s.contentType || \"\").indexOf(\"application/x-www-form-urlencoded\") === 0) {\n s.data = s.data.replace(r20, \"+\");\n } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\n\n if (s.ifModified) {\n if (jQuery.lastModified[cacheURL]) {\n jqXHR.setRequestHeader(\"If-Modified-Since\", jQuery.lastModified[cacheURL]);\n }\n\n if (jQuery.etag[cacheURL]) {\n jqXHR.setRequestHeader(\"If-None-Match\", jQuery.etag[cacheURL]);\n }\n } // Set the correct header, if data is being sent\n\n\n if (s.data && s.hasContent && s.contentType !== false || options.contentType) {\n jqXHR.setRequestHeader(\"Content-Type\", s.contentType);\n } // Set the Accepts header for the server, depending on the dataType\n\n\n jqXHR.setRequestHeader(\"Accept\", s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\") : s.accepts[\"*\"]); // Check for headers option\n\n for (i in s.headers) {\n jqXHR.setRequestHeader(i, s.headers[i]);\n } // Allow custom headers/mimetypes and early abort\n\n\n if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {\n // Abort if not done already and return\n return jqXHR.abort();\n } // Aborting is no longer a cancellation\n\n\n strAbort = \"abort\"; // Install callbacks on deferreds\n\n completeDeferred.add(s.complete);\n jqXHR.done(s.success);\n jqXHR.fail(s.error); // Get transport\n\n transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); // If no transport, we auto-abort\n\n if (!transport) {\n done(-1, \"No Transport\");\n } else {\n jqXHR.readyState = 1; // Send global event\n\n if (fireGlobals) {\n globalEventContext.trigger(\"ajaxSend\", [jqXHR, s]);\n } // If request was aborted inside ajaxSend, stop there\n\n\n if (completed) {\n return jqXHR;\n } // Timeout\n\n\n if (s.async && s.timeout > 0) {\n timeoutTimer = window.setTimeout(function () {\n jqXHR.abort(\"timeout\");\n }, s.timeout);\n }\n\n try {\n completed = false;\n transport.send(requestHeaders, done);\n } catch (e) {\n // Rethrow post-completion exceptions\n if (completed) {\n throw e;\n } // Propagate others as results\n\n\n done(-1, e);\n }\n } // Callback for when everything is done\n\n\n function done(status, nativeStatusText, responses, headers) {\n var isSuccess,\n success,\n error,\n response,\n modified,\n statusText = nativeStatusText; // Ignore repeat invocations\n\n if (completed) {\n return;\n }\n\n completed = true; // Clear timeout if it exists\n\n if (timeoutTimer) {\n window.clearTimeout(timeoutTimer);\n } // Dereference transport for early garbage collection\n // (no matter how long the jqXHR object will be used)\n\n\n transport = undefined; // Cache response headers\n\n responseHeadersString = headers || \"\"; // Set readyState\n\n jqXHR.readyState = status > 0 ? 4 : 0; // Determine if successful\n\n isSuccess = status >= 200 && status < 300 || status === 304; // Get response data\n\n if (responses) {\n response = ajaxHandleResponses(s, jqXHR, responses);\n } // Use a noop converter for missing script but not if jsonp\n\n\n if (!isSuccess && jQuery.inArray(\"script\", s.dataTypes) > -1 && jQuery.inArray(\"json\", s.dataTypes) < 0) {\n s.converters[\"text script\"] = function () {};\n } // Convert no matter what (that way responseXXX fields are always set)\n\n\n response = ajaxConvert(s, response, jqXHR, isSuccess); // If successful, handle type chaining\n\n if (isSuccess) {\n // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n if (s.ifModified) {\n modified = jqXHR.getResponseHeader(\"Last-Modified\");\n\n if (modified) {\n jQuery.lastModified[cacheURL] = modified;\n }\n\n modified = jqXHR.getResponseHeader(\"etag\");\n\n if (modified) {\n jQuery.etag[cacheURL] = modified;\n }\n } // if no content\n\n\n if (status === 204 || s.type === \"HEAD\") {\n statusText = \"nocontent\"; // if not modified\n } else if (status === 304) {\n statusText = \"notmodified\"; // If we have data, let's convert it\n } else {\n statusText = response.state;\n success = response.data;\n error = response.error;\n isSuccess = !error;\n }\n } else {\n // Extract error from statusText and normalize for non-aborts\n error = statusText;\n\n if (status || !statusText) {\n statusText = \"error\";\n\n if (status < 0) {\n status = 0;\n }\n }\n } // Set data for the fake xhr object\n\n\n jqXHR.status = status;\n jqXHR.statusText = (nativeStatusText || statusText) + \"\"; // Success/Error\n\n if (isSuccess) {\n deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);\n } else {\n deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);\n } // Status-dependent callbacks\n\n\n jqXHR.statusCode(_statusCode);\n _statusCode = undefined;\n\n if (fireGlobals) {\n globalEventContext.trigger(isSuccess ? \"ajaxSuccess\" : \"ajaxError\", [jqXHR, s, isSuccess ? success : error]);\n } // Complete\n\n\n completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);\n\n if (fireGlobals) {\n globalEventContext.trigger(\"ajaxComplete\", [jqXHR, s]); // Handle the global AJAX counter\n\n if (! --jQuery.active) {\n jQuery.event.trigger(\"ajaxStop\");\n }\n }\n }\n\n return jqXHR;\n },\n getJSON: function getJSON(url, data, callback) {\n return jQuery.get(url, data, callback, \"json\");\n },\n getScript: function getScript(url, callback) {\n return jQuery.get(url, undefined, callback, \"script\");\n }\n });\n jQuery.each([\"get\", \"post\"], function (_i, method) {\n jQuery[method] = function (url, data, callback, type) {\n // Shift arguments if data argument was omitted\n if (isFunction(data)) {\n type = type || callback;\n callback = data;\n data = undefined;\n } // The url can be an options object (which then must have .url)\n\n\n return jQuery.ajax(jQuery.extend({\n url: url,\n type: method,\n dataType: type,\n data: data,\n success: callback\n }, jQuery.isPlainObject(url) && url));\n };\n });\n jQuery.ajaxPrefilter(function (s) {\n var i;\n\n for (i in s.headers) {\n if (i.toLowerCase() === \"content-type\") {\n s.contentType = s.headers[i] || \"\";\n }\n }\n });\n\n jQuery._evalUrl = function (url, options, doc) {\n return jQuery.ajax({\n url: url,\n // Make this explicit, since user can override this through ajaxSetup (#11264)\n type: \"GET\",\n dataType: \"script\",\n cache: true,\n async: false,\n global: false,\n // Only evaluate the response if it is successful (gh-4126)\n // dataFilter is not invoked for failure responses, so using it instead\n // of the default converter is kludgy but it works.\n converters: {\n \"text script\": function textScript() {}\n },\n dataFilter: function dataFilter(response) {\n jQuery.globalEval(response, options, doc);\n }\n });\n };\n\n jQuery.fn.extend({\n wrapAll: function wrapAll(html) {\n var wrap;\n\n if (this[0]) {\n if (isFunction(html)) {\n html = html.call(this[0]);\n } // The elements to wrap the target around\n\n\n wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);\n\n if (this[0].parentNode) {\n wrap.insertBefore(this[0]);\n }\n\n wrap.map(function () {\n var elem = this;\n\n while (elem.firstElementChild) {\n elem = elem.firstElementChild;\n }\n\n return elem;\n }).append(this);\n }\n\n return this;\n },\n wrapInner: function wrapInner(html) {\n if (isFunction(html)) {\n return this.each(function (i) {\n jQuery(this).wrapInner(html.call(this, i));\n });\n }\n\n return this.each(function () {\n var self = jQuery(this),\n contents = self.contents();\n\n if (contents.length) {\n contents.wrapAll(html);\n } else {\n self.append(html);\n }\n });\n },\n wrap: function wrap(html) {\n var htmlIsFunction = isFunction(html);\n return this.each(function (i) {\n jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);\n });\n },\n unwrap: function unwrap(selector) {\n this.parent(selector).not(\"body\").each(function () {\n jQuery(this).replaceWith(this.childNodes);\n });\n return this;\n }\n });\n\n jQuery.expr.pseudos.hidden = function (elem) {\n return !jQuery.expr.pseudos.visible(elem);\n };\n\n jQuery.expr.pseudos.visible = function (elem) {\n return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);\n };\n\n jQuery.ajaxSettings.xhr = function () {\n try {\n return new window.XMLHttpRequest();\n } catch (e) {}\n };\n\n var xhrSuccessStatus = {\n // File protocol always yields status code 0, assume 200\n 0: 200,\n // Support: IE <=9 only\n // #1450: sometimes IE returns 1223 when it should be 204\n 1223: 204\n },\n xhrSupported = jQuery.ajaxSettings.xhr();\n support.cors = !!xhrSupported && \"withCredentials\" in xhrSupported;\n support.ajax = xhrSupported = !!xhrSupported;\n jQuery.ajaxTransport(function (options) {\n var _callback, errorCallback; // Cross domain only allowed if supported through XMLHttpRequest\n\n\n if (support.cors || xhrSupported && !options.crossDomain) {\n return {\n send: function send(headers, complete) {\n var i,\n xhr = options.xhr();\n xhr.open(options.type, options.url, options.async, options.username, options.password); // Apply custom fields if provided\n\n if (options.xhrFields) {\n for (i in options.xhrFields) {\n xhr[i] = options.xhrFields[i];\n }\n } // Override mime type if needed\n\n\n if (options.mimeType && xhr.overrideMimeType) {\n xhr.overrideMimeType(options.mimeType);\n } // X-Requested-With header\n // For cross-domain requests, seeing as conditions for a preflight are\n // akin to a jigsaw puzzle, we simply never set it to be sure.\n // (it can always be set on a per-request basis or even using ajaxSetup)\n // For same-domain requests, won't change header if already provided.\n\n\n if (!options.crossDomain && !headers[\"X-Requested-With\"]) {\n headers[\"X-Requested-With\"] = \"XMLHttpRequest\";\n } // Set headers\n\n\n for (i in headers) {\n xhr.setRequestHeader(i, headers[i]);\n } // Callback\n\n\n _callback = function callback(type) {\n return function () {\n if (_callback) {\n _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;\n\n if (type === \"abort\") {\n xhr.abort();\n } else if (type === \"error\") {\n // Support: IE <=9 only\n // On a manual native abort, IE9 throws\n // errors on any property access that is not readyState\n if (typeof xhr.status !== \"number\") {\n complete(0, \"error\");\n } else {\n complete( // File: protocol always yields status 0; see #8605, #14207\n xhr.status, xhr.statusText);\n }\n } else {\n complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText, // Support: IE <=9 only\n // IE9 has no XHR2 but throws on binary (trac-11426)\n // For XHR2 non-text, let the caller handle it (gh-2498)\n (xhr.responseType || \"text\") !== \"text\" || typeof xhr.responseText !== \"string\" ? {\n binary: xhr.response\n } : {\n text: xhr.responseText\n }, xhr.getAllResponseHeaders());\n }\n }\n };\n }; // Listen to events\n\n\n xhr.onload = _callback();\n errorCallback = xhr.onerror = xhr.ontimeout = _callback(\"error\"); // Support: IE 9 only\n // Use onreadystatechange to replace onabort\n // to handle uncaught aborts\n\n if (xhr.onabort !== undefined) {\n xhr.onabort = errorCallback;\n } else {\n xhr.onreadystatechange = function () {\n // Check readyState before timeout as it changes\n if (xhr.readyState === 4) {\n // Allow onerror to be called first,\n // but that will not handle a native abort\n // Also, save errorCallback to a variable\n // as xhr.onerror cannot be accessed\n window.setTimeout(function () {\n if (_callback) {\n errorCallback();\n }\n });\n }\n };\n } // Create the abort callback\n\n\n _callback = _callback(\"abort\");\n\n try {\n // Do send the request (this may raise an exception)\n xhr.send(options.hasContent && options.data || null);\n } catch (e) {\n // #14683: Only rethrow if this hasn't been notified as an error yet\n if (_callback) {\n throw e;\n }\n }\n },\n abort: function abort() {\n if (_callback) {\n _callback();\n }\n }\n };\n }\n }); // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)\n\n jQuery.ajaxPrefilter(function (s) {\n if (s.crossDomain) {\n s.contents.script = false;\n }\n }); // Install script dataType\n\n jQuery.ajaxSetup({\n accepts: {\n script: \"text/javascript, application/javascript, \" + \"application/ecmascript, application/x-ecmascript\"\n },\n contents: {\n script: /\\b(?:java|ecma)script\\b/\n },\n converters: {\n \"text script\": function textScript(text) {\n jQuery.globalEval(text);\n return text;\n }\n }\n }); // Handle cache's special case and crossDomain\n\n jQuery.ajaxPrefilter(\"script\", function (s) {\n if (s.cache === undefined) {\n s.cache = false;\n }\n\n if (s.crossDomain) {\n s.type = \"GET\";\n }\n }); // Bind script tag hack transport\n\n jQuery.ajaxTransport(\"script\", function (s) {\n // This transport only deals with cross domain or forced-by-attrs requests\n if (s.crossDomain || s.scriptAttrs) {\n var script, _callback2;\n\n return {\n send: function send(_, complete) {\n script = jQuery(\"