vendor: 3,595 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = "/"; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = 9); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
vendor: 1,757 bytes, lines 89-111
89/***/ "./Themes/Cynoebook/node_modules/bootstrap/dist/js/npm.js": 90/*!****************************************************************!*\ 91 !*** ./Themes/Cynoebook/node_modules/bootstrap/dist/js/npm.js ***! 92 \****************************************************************/ 93/*! no static exports found */ 94/***/ (function(module, exports, __webpack_require__) { 95 96// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 97__webpack_require__(/*! ../../js/transition.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/transition.js") 98__webpack_require__(/*! ../../js/alert.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/alert.js") 99__webpack_require__(/*! ../../js/button.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/button.js") 100__webpack_require__(/*! ../../js/carousel.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/carousel.js") 101__webpack_require__(/*! ../../js/collapse.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/collapse.js") 102__webpack_require__(/*! ../../js/dropdown.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/dropdown.js") 103__webpack_require__(/*! ../../js/modal.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/modal.js") 104__webpack_require__(/*! ../../js/tooltip.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/tooltip.js") 105__webpack_require__(/*! ../../js/popover.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/popover.js") 106__webpack_require__(/*! ../../js/scrollspy.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/scrollspy.js") 107__webpack_require__(/*! ../../js/tab.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/tab.js") 108__webpack_require__(/*! ../../js/affix.js */ "./Themes/Cynoebook/node_modules/bootstrap/js/affix.js") 109 110/***/ }), 111
vendor: 5,304 bytes, lines 112-286
112/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/affix.js": 113/*!*************************************************************!*\ 114 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/affix.js ***! 115 \*************************************************************/ 116/*! no static exports found */ 117/***/ (function(module, exports) { 118 119/* ======================================================================== 120 * Bootstrap: affix.js v3.4.1 121 * https://getbootstrap.com/docs/3.4/javascript/#affix 122 * ======================================================================== 123 * Copyright 2011-2019 Twitter, Inc. 124 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 125 * ======================================================================== */ 126 127 128+function ($) { 129 'use strict'; 130 131 // AFFIX CLASS DEFINITION 132 // ====================== 133 134 var Affix = function (element, options) { 135 this.options = $.extend({}, Affix.DEFAULTS, options) 136 137 var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target) 138 139 this.$target = target 140 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) 141 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) 142 143 this.$element = $(element) 144 this.affixed = null 145 this.unpin = null 146 this.pinnedOffset = null 147 148 this.checkPosition() 149 } 150 151 Affix.VERSION = '3.4.1' 152 153 Affix.RESET = 'affix affix-top affix-bottom' 154 155 Affix.DEFAULTS = { 156 offset: 0, 157 target: window 158 } 159 160 Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { 161 var scrollTop = this.$target.scrollTop() 162 var position = this.$element.offset() 163 var targetHeight = this.$target.height() 164 165 if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false 166 167 if (this.affixed == 'bottom') { 168 if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' 169 return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' 170 } 171 172 var initializing = this.affixed == null 173 var colliderTop = initializing ? scrollTop : position.top 174 var colliderHeight = initializing ? targetHeight : height 175 176 if (offsetTop != null && scrollTop <= offsetTop) return 'top' 177 if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' 178 179 return false 180 } 181 182 Affix.prototype.getPinnedOffset = function () { 183 if (this.pinnedOffset) return this.pinnedOffset 184 this.$element.removeClass(Affix.RESET).addClass('affix') 185 var scrollTop = this.$target.scrollTop() 186 var position = this.$element.offset() 187 return (this.pinnedOffset = position.top - scrollTop) 188 } 189 190 Affix.prototype.checkPositionWithEventLoop = function () { 191 setTimeout($.proxy(this.checkPosition, this), 1) 192 } 193 194 Affix.prototype.checkPosition = function () { 195 if (!this.$element.is(':visible')) return 196 197 var height = this.$element.height() 198 var offset = this.options.offset 199 var offsetTop = offset.top 200 var offsetBottom = offset.bottom 201 var scrollHeight = Math.max($(document).height(), $(document.body).height()) 202 203 if (typeof offset != 'object') offsetBottom = offsetTop = offset 204 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) 205 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) 206 207 var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) 208 209 if (this.affixed != affix) { 210 if (this.unpin != null) this.$element.css('top', '') 211 212 var affixType = 'affix' + (affix ? '-' + affix : '') 213 var e = $.Event(affixType + '.bs.affix') 214 215 this.$element.trigger(e) 216 217 if (e.isDefaultPrevented()) return 218 219 this.affixed = affix 220 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null 221 222 this.$element 223 .removeClass(Affix.RESET) 224 .addClass(affixType) 225 .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') 226 } 227 228 if (affix == 'bottom') { 229 this.$element.offset({ 230 top: scrollHeight - height - offsetBottom 231 }) 232 } 233 } 234 235 236 // AFFIX PLUGIN DEFINITION 237 // ======================= 238 239 function Plugin(option) { 240 return this.each(function () { 241 var $this = $(this) 242 var data = $this.data('bs.affix') 243 var options = typeof option == 'object' && option 244 245 if (!data) $this.data('bs.affix', (data = new Affix(this, options))) 246 if (typeof option == 'string') data[option]() 247 }) 248 } 249 250 var old = $.fn.affix 251 252 $.fn.affix = Plugin 253 $.fn.affix.Constructor = Affix 254 255 256 // AFFIX NO CONFLICT 257 // ================= 258 259 $.fn.affix.noConflict = function () { 260 $.fn.affix = old 261 return this 262 } 263 264 265 // AFFIX DATA-API 266 // ============== 267 268 $(window).on('load', function () { 269 $('[data-spy="affix"]').each(function () { 270 var $spy = $(this) 271 var data = $spy.data() 272 273 data.offset = data.offset || {} 274 275 if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom 276 if (data.offsetTop != null) data.offset.top = data.offsetTop 277 278 Plugin.call($spy, data) 279 }) 280 }) 281 282}(jQuery); 283 284 285/***/ }), 286
vendor: 2,679 bytes, lines 287-392
287/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/alert.js": 288/*!*************************************************************!*\ 289 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/alert.js ***! 290 \*************************************************************/ 291/*! no static exports found */ 292/***/ (function(module, exports) { 293 294/* ======================================================================== 295 * Bootstrap: alert.js v3.4.1 296 * https://getbootstrap.com/docs/3.4/javascript/#alerts 297 * ======================================================================== 298 * Copyright 2011-2019 Twitter, Inc. 299 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 300 * ======================================================================== */ 301 302 303+function ($) { 304 'use strict'; 305 306 // ALERT CLASS DEFINITION 307 // ====================== 308 309 var dismiss = '[data-dismiss="alert"]' 310 var Alert = function (el) { 311 $(el).on('click', dismiss, this.close) 312 } 313 314 Alert.VERSION = '3.4.1' 315 316 Alert.TRANSITION_DURATION = 150 317 318 Alert.prototype.close = function (e) { 319 var $this = $(this) 320 var selector = $this.attr('data-target') 321 322 if (!selector) { 323 selector = $this.attr('href') 324 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 325 } 326 327 selector = selector === '#' ? [] : selector 328 var $parent = $(document).find(selector) 329 330 if (e) e.preventDefault() 331 332 if (!$parent.length) { 333 $parent = $this.closest('.alert') 334 } 335 336 $parent.trigger(e = $.Event('close.bs.alert')) 337 338 if (e.isDefaultPrevented()) return 339 340 $parent.removeClass('in') 341 342 function removeElement() { 343 // detach from parent, fire event then clean up data 344 $parent.detach().trigger('closed.bs.alert').remove() 345 } 346 347 $.support.transition && $parent.hasClass('fade') ? 348 $parent 349 .one('bsTransitionEnd', removeElement) 350 .emulateTransitionEnd(Alert.TRANSITION_DURATION) : 351 removeElement() 352 } 353 354 355 // ALERT PLUGIN DEFINITION 356 // ======================= 357 358 function Plugin(option) { 359 return this.each(function () { 360 var $this = $(this) 361 var data = $this.data('bs.alert') 362 363 if (!data) $this.data('bs.alert', (data = new Alert(this))) 364 if (typeof option == 'string') data[option].call($this) 365 }) 366 } 367 368 var old = $.fn.alert 369 370 $.fn.alert = Plugin 371 $.fn.alert.Constructor = Alert 372 373 374 // ALERT NO CONFLICT 375 // ================= 376 377 $.fn.alert.noConflict = function () { 378 $.fn.alert = old 379 return this 380 } 381 382 383 // ALERT DATA-API 384 // ============== 385 386 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) 387 388}(jQuery); 389 390 391/***/ }), 392
vendor: 4,181 bytes, lines 393-528
393/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/button.js": 394/*!**************************************************************!*\ 395 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/button.js ***! 396 \**************************************************************/ 397/*! no static exports found */ 398/***/ (function(module, exports) { 399 400/* ======================================================================== 401 * Bootstrap: button.js v3.4.1 402 * https://getbootstrap.com/docs/3.4/javascript/#buttons 403 * ======================================================================== 404 * Copyright 2011-2019 Twitter, Inc. 405 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 406 * ======================================================================== */ 407 408 409+function ($) { 410 'use strict'; 411 412 // BUTTON PUBLIC CLASS DEFINITION 413 // ============================== 414 415 var Button = function (element, options) { 416 this.$element = $(element) 417 this.options = $.extend({}, Button.DEFAULTS, options) 418 this.isLoading = false 419 } 420 421 Button.VERSION = '3.4.1' 422 423 Button.DEFAULTS = { 424 loadingText: 'loading...' 425 } 426 427 Button.prototype.setState = function (state) { 428 var d = 'disabled' 429 var $el = this.$element 430 var val = $el.is('input') ? 'val' : 'html' 431 var data = $el.data() 432 433 state += 'Text' 434 435 if (data.resetText == null) $el.data('resetText', $el[val]()) 436 437 // push to event loop to allow forms to submit 438 setTimeout($.proxy(function () { 439 $el[val](data[state] == null ? this.options[state] : data[state]) 440 441 if (state == 'loadingText') { 442 this.isLoading = true 443 $el.addClass(d).attr(d, d).prop(d, true) 444 } else if (this.isLoading) { 445 this.isLoading = false 446 $el.removeClass(d).removeAttr(d).prop(d, false) 447 } 448 }, this), 0) 449 } 450 451 Button.prototype.toggle = function () { 452 var changed = true 453 var $parent = this.$element.closest('[data-toggle="buttons"]') 454 455 if ($parent.length) { 456 var $input = this.$element.find('input') 457 if ($input.prop('type') == 'radio') { 458 if ($input.prop('checked')) changed = false 459 $parent.find('.active').removeClass('active') 460 this.$element.addClass('active') 461 } else if ($input.prop('type') == 'checkbox') { 462 if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false 463 this.$element.toggleClass('active') 464 } 465 $input.prop('checked', this.$element.hasClass('active')) 466 if (changed) $input.trigger('change') 467 } else { 468 this.$element.attr('aria-pressed', !this.$element.hasClass('active')) 469 this.$element.toggleClass('active') 470 } 471 } 472 473 474 // BUTTON PLUGIN DEFINITION 475 // ======================== 476 477 function Plugin(option) { 478 return this.each(function () { 479 var $this = $(this) 480 var data = $this.data('bs.button') 481 var options = typeof option == 'object' && option 482 483 if (!data) $this.data('bs.button', (data = new Button(this, options))) 484 485 if (option == 'toggle') data.toggle() 486 else if (option) data.setState(option) 487 }) 488 } 489 490 var old = $.fn.button 491 492 $.fn.button = Plugin 493 $.fn.button.Constructor = Button 494 495 496 // BUTTON NO CONFLICT 497 // ================== 498 499 $.fn.button.noConflict = function () { 500 $.fn.button = old 501 return this 502 } 503 504 505 // BUTTON DATA-API 506 // =============== 507 508 $(document) 509 .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { 510 var $btn = $(e.target).closest('.btn') 511 Plugin.call($btn, 'toggle') 512 if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) { 513 // Prevent double click on radios, and the double selections (so cancellation) on checkboxes 514 e.preventDefault() 515 // The target component still receive the focus 516 if ($btn.is('input,button')) $btn.trigger('focus') 517 else $btn.find('input:visible,button:visible').first().trigger('focus') 518 } 519 }) 520 .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { 521 $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) 522 }) 523 524}(jQuery); 525 526 527/***/ }), 528
vendor: 7,647 bytes, lines 529-785
529/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/carousel.js": 530/*!****************************************************************!*\ 531 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/carousel.js ***! 532 \****************************************************************/ 533/*! no static exports found */ 534/***/ (function(module, exports) { 535 536/* ======================================================================== 537 * Bootstrap: carousel.js v3.4.1 538 * https://getbootstrap.com/docs/3.4/javascript/#carousel 539 * ======================================================================== 540 * Copyright 2011-2019 Twitter, Inc. 541 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 542 * ======================================================================== */ 543 544 545+function ($) { 546 'use strict'; 547 548 // CAROUSEL CLASS DEFINITION 549 // ========================= 550 551 var Carousel = function (element, options) { 552 this.$element = $(element) 553 this.$indicators = this.$element.find('.carousel-indicators') 554 this.options = options 555 this.paused = null 556 this.sliding = null 557 this.interval = null 558 this.$active = null 559 this.$items = null 560 561 this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) 562 563 this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element 564 .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) 565 .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) 566 } 567 568 Carousel.VERSION = '3.4.1' 569 570 Carousel.TRANSITION_DURATION = 600 571 572 Carousel.DEFAULTS = { 573 interval: 5000, 574 pause: 'hover', 575 wrap: true, 576 keyboard: true 577 } 578 579 Carousel.prototype.keydown = function (e) { 580 if (/input|textarea/i.test(e.target.tagName)) return 581 switch (e.which) { 582 case 37: this.prev(); break 583 case 39: this.next(); break 584 default: return 585 } 586 587 e.preventDefault() 588 } 589 590 Carousel.prototype.cycle = function (e) { 591 e || (this.paused = false) 592 593 this.interval && clearInterval(this.interval) 594 595 this.options.interval 596 && !this.paused 597 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) 598 599 return this 600 } 601 602 Carousel.prototype.getItemIndex = function (item) { 603 this.$items = item.parent().children('.item') 604 return this.$items.index(item || this.$active) 605 } 606 607 Carousel.prototype.getItemForDirection = function (direction, active) { 608 var activeIndex = this.getItemIndex(active) 609 var willWrap = (direction == 'prev' && activeIndex === 0) 610 || (direction == 'next' && activeIndex == (this.$items.length - 1)) 611 if (willWrap && !this.options.wrap) return active 612 var delta = direction == 'prev' ? -1 : 1 613 var itemIndex = (activeIndex + delta) % this.$items.length 614 return this.$items.eq(itemIndex) 615 } 616 617 Carousel.prototype.to = function (pos) { 618 var that = this 619 var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) 620 621 if (pos > (this.$items.length - 1) || pos < 0) return 622 623 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" 624 if (activeIndex == pos) return this.pause().cycle() 625 626 return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) 627 } 628 629 Carousel.prototype.pause = function (e) { 630 e || (this.paused = true) 631 632 if (this.$element.find('.next, .prev').length && $.support.transition) { 633 this.$element.trigger($.support.transition.end) 634 this.cycle(true) 635 } 636 637 this.interval = clearInterval(this.interval) 638 639 return this 640 } 641 642 Carousel.prototype.next = function () { 643 if (this.sliding) return 644 return this.slide('next') 645 } 646 647 Carousel.prototype.prev = function () { 648 if (this.sliding) return 649 return this.slide('prev') 650 } 651 652 Carousel.prototype.slide = function (type, next) { 653 var $active = this.$element.find('.item.active') 654 var $next = next || this.getItemForDirection(type, $active) 655 var isCycling = this.interval 656 var direction = type == 'next' ? 'left' : 'right' 657 var that = this 658 659 if ($next.hasClass('active')) return (this.sliding = false) 660 661 var relatedTarget = $next[0] 662 var slideEvent = $.Event('slide.bs.carousel', { 663 relatedTarget: relatedTarget, 664 direction: direction 665 }) 666 this.$element.trigger(slideEvent) 667 if (slideEvent.isDefaultPrevented()) return 668 669 this.sliding = true 670 671 isCycling && this.pause() 672 673 if (this.$indicators.length) { 674 this.$indicators.find('.active').removeClass('active') 675 var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) 676 $nextIndicator && $nextIndicator.addClass('active') 677 } 678 679 var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" 680 if ($.support.transition && this.$element.hasClass('slide')) { 681 $next.addClass(type) 682 if (typeof $next === 'object' && $next.length) { 683 $next[0].offsetWidth // force reflow 684 } 685 $active.addClass(direction) 686 $next.addClass(direction) 687 $active 688 .one('bsTransitionEnd', function () { 689 $next.removeClass([type, direction].join(' ')).addClass('active') 690 $active.removeClass(['active', direction].join(' ')) 691 that.sliding = false 692 setTimeout(function () { 693 that.$element.trigger(slidEvent) 694 }, 0) 695 }) 696 .emulateTransitionEnd(Carousel.TRANSITION_DURATION) 697 } else { 698 $active.removeClass('active') 699 $next.addClass('active') 700 this.sliding = false 701 this.$element.trigger(slidEvent) 702 } 703 704 isCycling && this.cycle() 705 706 return this 707 } 708 709 710 // CAROUSEL PLUGIN DEFINITION 711 // ========================== 712 713 function Plugin(option) { 714 return this.each(function () { 715 var $this = $(this) 716 var data = $this.data('bs.carousel') 717 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) 718 var action = typeof option == 'string' ? option : options.slide 719 720 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) 721 if (typeof option == 'number') data.to(option) 722 else if (action) data[action]() 723 else if (options.interval) data.pause().cycle() 724 }) 725 } 726 727 var old = $.fn.carousel 728 729 $.fn.carousel = Plugin 730 $.fn.carousel.Constructor = Carousel 731 732 733 // CAROUSEL NO CONFLICT 734 // ==================== 735 736 $.fn.carousel.noConflict = function () { 737 $.fn.carousel = old 738 return this 739 } 740 741 742 // CAROUSEL DATA-API 743 // ================= 744 745 var clickHandler = function (e) { 746 var $this = $(this) 747 var href = $this.attr('href') 748 if (href) { 749 href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 750 } 751 752 var target = $this.attr('data-target') || href 753 var $target = $(document).find(target) 754 755 if (!$target.hasClass('carousel')) return 756 757 var options = $.extend({}, $target.data(), $this.data()) 758 var slideIndex = $this.attr('data-slide-to') 759 if (slideIndex) options.interval = false 760 761 Plugin.call($target, options) 762 763 if (slideIndex) { 764 $target.data('bs.carousel').to(slideIndex) 765 } 766 767 e.preventDefault() 768 } 769 770 $(document) 771 .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) 772 .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) 773 774 $(window).on('load', function () { 775 $('[data-ride="carousel"]').each(function () { 776 var $carousel = $(this) 777 Plugin.call($carousel, $carousel.data()) 778 }) 779 }) 780 781}(jQuery); 782 783 784/***/ }), 785
vendor: 6,386 bytes, lines 786-1008
786/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/collapse.js": 787/*!****************************************************************!*\ 788 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/collapse.js ***! 789 \****************************************************************/ 790/*! no static exports found */ 791/***/ (function(module, exports) { 792 793/* ======================================================================== 794 * Bootstrap: collapse.js v3.4.1 795 * https://getbootstrap.com/docs/3.4/javascript/#collapse 796 * ======================================================================== 797 * Copyright 2011-2019 Twitter, Inc. 798 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 799 * ======================================================================== */ 800 801/* jshint latedef: false */ 802 803+function ($) { 804 'use strict'; 805 806 // COLLAPSE PUBLIC CLASS DEFINITION 807 // ================================ 808 809 var Collapse = function (element, options) { 810 this.$element = $(element) 811 this.options = $.extend({}, Collapse.DEFAULTS, options) 812 this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + 813 '[data-toggle="collapse"][data-target="#' + element.id + '"]') 814 this.transitioning = null 815 816 if (this.options.parent) { 817 this.$parent = this.getParent() 818 } else { 819 this.addAriaAndCollapsedClass(this.$element, this.$trigger) 820 } 821 822 if (this.options.toggle) this.toggle() 823 } 824 825 Collapse.VERSION = '3.4.1' 826 827 Collapse.TRANSITION_DURATION = 350 828 829 Collapse.DEFAULTS = { 830 toggle: true 831 } 832 833 Collapse.prototype.dimension = function () { 834 var hasWidth = this.$element.hasClass('width') 835 return hasWidth ? 'width' : 'height' 836 } 837 838 Collapse.prototype.show = function () { 839 if (this.transitioning || this.$element.hasClass('in')) return 840 841 var activesData 842 var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') 843 844 if (actives && actives.length) { 845 activesData = actives.data('bs.collapse') 846 if (activesData && activesData.transitioning) return 847 } 848 849 var startEvent = $.Event('show.bs.collapse') 850 this.$element.trigger(startEvent) 851 if (startEvent.isDefaultPrevented()) return 852 853 if (actives && actives.length) { 854 Plugin.call(actives, 'hide') 855 activesData || actives.data('bs.collapse', null) 856 } 857 858 var dimension = this.dimension() 859 860 this.$element 861 .removeClass('collapse') 862 .addClass('collapsing')[dimension](0) 863 .attr('aria-expanded', true) 864 865 this.$trigger 866 .removeClass('collapsed') 867 .attr('aria-expanded', true) 868 869 this.transitioning = 1 870 871 var complete = function () { 872 this.$element 873 .removeClass('collapsing') 874 .addClass('collapse in')[dimension]('') 875 this.transitioning = 0 876 this.$element 877 .trigger('shown.bs.collapse') 878 } 879 880 if (!$.support.transition) return complete.call(this) 881 882 var scrollSize = $.camelCase(['scroll', dimension].join('-')) 883 884 this.$element 885 .one('bsTransitionEnd', $.proxy(complete, this)) 886 .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) 887 } 888 889 Collapse.prototype.hide = function () { 890 if (this.transitioning || !this.$element.hasClass('in')) return 891 892 var startEvent = $.Event('hide.bs.collapse') 893 this.$element.trigger(startEvent) 894 if (startEvent.isDefaultPrevented()) return 895 896 var dimension = this.dimension() 897 898 this.$element[dimension](this.$element[dimension]())[0].offsetHeight 899 900 this.$element 901 .addClass('collapsing') 902 .removeClass('collapse in') 903 .attr('aria-expanded', false) 904 905 this.$trigger 906 .addClass('collapsed') 907 .attr('aria-expanded', false) 908 909 this.transitioning = 1 910 911 var complete = function () { 912 this.transitioning = 0 913 this.$element 914 .removeClass('collapsing') 915 .addClass('collapse') 916 .trigger('hidden.bs.collapse') 917 } 918 919 if (!$.support.transition) return complete.call(this) 920 921 this.$element 922 [dimension](0) 923 .one('bsTransitionEnd', $.proxy(complete, this)) 924 .emulateTransitionEnd(Collapse.TRANSITION_DURATION) 925 } 926 927 Collapse.prototype.toggle = function () { 928 this[this.$element.hasClass('in') ? 'hide' : 'show']() 929 } 930 931 Collapse.prototype.getParent = function () { 932 return $(document).find(this.options.parent) 933 .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') 934 .each($.proxy(function (i, element) { 935 var $element = $(element) 936 this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) 937 }, this)) 938 .end() 939 } 940 941 Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { 942 var isOpen = $element.hasClass('in') 943 944 $element.attr('aria-expanded', isOpen) 945 $trigger 946 .toggleClass('collapsed', !isOpen) 947 .attr('aria-expanded', isOpen) 948 } 949 950 function getTargetFromTrigger($trigger) { 951 var href 952 var target = $trigger.attr('data-target') 953 || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 954 955 return $(document).find(target) 956 } 957 958 959 // COLLAPSE PLUGIN DEFINITION 960 // ========================== 961 962 function Plugin(option) { 963 return this.each(function () { 964 var $this = $(this) 965 var data = $this.data('bs.collapse') 966 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) 967 968 if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false 969 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) 970 if (typeof option == 'string') data[option]() 971 }) 972 } 973 974 var old = $.fn.collapse 975 976 $.fn.collapse = Plugin 977 $.fn.collapse.Constructor = Collapse 978 979 980 // COLLAPSE NO CONFLICT 981 // ==================== 982 983 $.fn.collapse.noConflict = function () { 984 $.fn.collapse = old 985 return this 986 } 987 988 989 // COLLAPSE DATA-API 990 // ================= 991 992 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { 993 var $this = $(this) 994 995 if (!$this.attr('data-target')) e.preventDefault() 996 997 var $target = getTargetFromTrigger($this) 998 var data = $target.data('bs.collapse') 999 var option = data ? 'toggle' : $this.data() 1000 1001 Plugin.call($target, option) 1002 }) 1003 1004}(jQuery); 1005 1006 1007/***/ }), 1008
vendor: 5,137 bytes, lines 1009-1184
1009/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/dropdown.js": 1010/*!****************************************************************!*\ 1011 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/dropdown.js ***! 1012 \****************************************************************/ 1013/*! no static exports found */ 1014/***/ (function(module, exports) { 1015 1016/* ======================================================================== 1017 * Bootstrap: dropdown.js v3.4.1 1018 * https://getbootstrap.com/docs/3.4/javascript/#dropdowns 1019 * ======================================================================== 1020 * Copyright 2011-2019 Twitter, Inc. 1021 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1022 * ======================================================================== */ 1023 1024 1025+function ($) { 1026 'use strict'; 1027 1028 // DROPDOWN CLASS DEFINITION 1029 // ========================= 1030 1031 var backdrop = '.dropdown-backdrop' 1032 var toggle = '[data-toggle="dropdown"]' 1033 var Dropdown = function (element) { 1034 $(element).on('click.bs.dropdown', this.toggle) 1035 } 1036 1037 Dropdown.VERSION = '3.4.1' 1038 1039 function getParent($this) { 1040 var selector = $this.attr('data-target') 1041 1042 if (!selector) { 1043 selector = $this.attr('href') 1044 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 1045 } 1046 1047 var $parent = selector !== '#' ? $(document).find(selector) : null 1048 1049 return $parent && $parent.length ? $parent : $this.parent() 1050 } 1051 1052 function clearMenus(e) { 1053 if (e && e.which === 3) return 1054 $(backdrop).remove() 1055 $(toggle).each(function () { 1056 var $this = $(this) 1057 var $parent = getParent($this) 1058 var relatedTarget = { relatedTarget: this } 1059 1060 if (!$parent.hasClass('open')) return 1061 1062 if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return 1063 1064 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) 1065 1066 if (e.isDefaultPrevented()) return 1067 1068 $this.attr('aria-expanded', 'false') 1069 $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget)) 1070 }) 1071 } 1072 1073 Dropdown.prototype.toggle = function (e) { 1074 var $this = $(this) 1075 1076 if ($this.is('.disabled, :disabled')) return 1077 1078 var $parent = getParent($this) 1079 var isActive = $parent.hasClass('open') 1080 1081 clearMenus() 1082 1083 if (!isActive) { 1084 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { 1085 // if mobile we use a backdrop because click events don't delegate 1086 $(document.createElement('div')) 1087 .addClass('dropdown-backdrop') 1088 .insertAfter($(this)) 1089 .on('click', clearMenus) 1090 } 1091 1092 var relatedTarget = { relatedTarget: this } 1093 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) 1094 1095 if (e.isDefaultPrevented()) return 1096 1097 $this 1098 .trigger('focus') 1099 .attr('aria-expanded', 'true') 1100 1101 $parent 1102 .toggleClass('open') 1103 .trigger($.Event('shown.bs.dropdown', relatedTarget)) 1104 } 1105 1106 return false 1107 } 1108 1109 Dropdown.prototype.keydown = function (e) { 1110 if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return 1111 1112 var $this = $(this) 1113 1114 e.preventDefault() 1115 e.stopPropagation() 1116 1117 if ($this.is('.disabled, :disabled')) return 1118 1119 var $parent = getParent($this) 1120 var isActive = $parent.hasClass('open') 1121 1122 if (!isActive && e.which != 27 || isActive && e.which == 27) { 1123 if (e.which == 27) $parent.find(toggle).trigger('focus') 1124 return $this.trigger('click') 1125 } 1126 1127 var desc = ' li:not(.disabled):visible a' 1128 var $items = $parent.find('.dropdown-menu' + desc) 1129 1130 if (!$items.length) return 1131 1132 var index = $items.index(e.target) 1133 1134 if (e.which == 38 && index > 0) index-- // up 1135 if (e.which == 40 && index < $items.length - 1) index++ // down 1136 if (!~index) index = 0 1137 1138 $items.eq(index).trigger('focus') 1139 } 1140 1141 1142 // DROPDOWN PLUGIN DEFINITION 1143 // ========================== 1144 1145 function Plugin(option) { 1146 return this.each(function () { 1147 var $this = $(this) 1148 var data = $this.data('bs.dropdown') 1149 1150 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) 1151 if (typeof option == 'string') data[option].call($this) 1152 }) 1153 } 1154 1155 var old = $.fn.dropdown 1156 1157 $.fn.dropdown = Plugin 1158 $.fn.dropdown.Constructor = Dropdown 1159 1160 1161 // DROPDOWN NO CONFLICT 1162 // ==================== 1163 1164 $.fn.dropdown.noConflict = function () { 1165 $.fn.dropdown = old 1166 return this 1167 } 1168 1169 1170 // APPLY TO STANDARD DROPDOWN ELEMENTS 1171 // =================================== 1172 1173 $(document) 1174 .on('click.bs.dropdown.data-api', clearMenus) 1175 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) 1176 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) 1177 .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) 1178 .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) 1179 1180}(jQuery); 1181 1182 1183/***/ }), 1184
vendor: 10,957 bytes, lines 1185-1553
1185/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/modal.js": 1186/*!*************************************************************!*\ 1187 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/modal.js ***! 1188 \*************************************************************/ 1189/*! no static exports found */ 1190/***/ (function(module, exports) { 1191 1192/* ======================================================================== 1193 * Bootstrap: modal.js v3.4.1 1194 * https://getbootstrap.com/docs/3.4/javascript/#modals 1195 * ======================================================================== 1196 * Copyright 2011-2019 Twitter, Inc. 1197 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1198 * ======================================================================== */ 1199 1200 1201+function ($) { 1202 'use strict'; 1203 1204 // MODAL CLASS DEFINITION 1205 // ====================== 1206 1207 var Modal = function (element, options) { 1208 this.options = options 1209 this.$body = $(document.body) 1210 this.$element = $(element) 1211 this.$dialog = this.$element.find('.modal-dialog') 1212 this.$backdrop = null 1213 this.isShown = null 1214 this.originalBodyPad = null 1215 this.scrollbarWidth = 0 1216 this.ignoreBackdropClick = false 1217 this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom' 1218 1219 if (this.options.remote) { 1220 this.$element 1221 .find('.modal-content') 1222 .load(this.options.remote, $.proxy(function () { 1223 this.$element.trigger('loaded.bs.modal') 1224 }, this)) 1225 } 1226 } 1227 1228 Modal.VERSION = '3.4.1' 1229 1230 Modal.TRANSITION_DURATION = 300 1231 Modal.BACKDROP_TRANSITION_DURATION = 150 1232 1233 Modal.DEFAULTS = { 1234 backdrop: true, 1235 keyboard: true, 1236 show: true 1237 } 1238 1239 Modal.prototype.toggle = function (_relatedTarget) { 1240 return this.isShown ? this.hide() : this.show(_relatedTarget) 1241 } 1242 1243 Modal.prototype.show = function (_relatedTarget) { 1244 var that = this 1245 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) 1246 1247 this.$element.trigger(e) 1248 1249 if (this.isShown || e.isDefaultPrevented()) return 1250 1251 this.isShown = true 1252 1253 this.checkScrollbar() 1254 this.setScrollbar() 1255 this.$body.addClass('modal-open') 1256 1257 this.escape() 1258 this.resize() 1259 1260 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) 1261 1262 this.$dialog.on('mousedown.dismiss.bs.modal', function () { 1263 that.$element.one('mouseup.dismiss.bs.modal', function (e) { 1264 if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true 1265 }) 1266 }) 1267 1268 this.backdrop(function () { 1269 var transition = $.support.transition && that.$element.hasClass('fade') 1270 1271 if (!that.$element.parent().length) { 1272 that.$element.appendTo(that.$body) // don't move modals dom position 1273 } 1274 1275 that.$element 1276 .show() 1277 .scrollTop(0) 1278 1279 that.adjustDialog() 1280 1281 if (transition) { 1282 that.$element[0].offsetWidth // force reflow 1283 } 1284 1285 that.$element.addClass('in') 1286 1287 that.enforceFocus() 1288 1289 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) 1290 1291 transition ? 1292 that.$dialog // wait for modal to slide in 1293 .one('bsTransitionEnd', function () { 1294 that.$element.trigger('focus').trigger(e) 1295 }) 1296 .emulateTransitionEnd(Modal.TRANSITION_DURATION) : 1297 that.$element.trigger('focus').trigger(e) 1298 }) 1299 } 1300 1301 Modal.prototype.hide = function (e) { 1302 if (e) e.preventDefault() 1303 1304 e = $.Event('hide.bs.modal') 1305 1306 this.$element.trigger(e) 1307 1308 if (!this.isShown || e.isDefaultPrevented()) return 1309 1310 this.isShown = false 1311 1312 this.escape() 1313 this.resize() 1314 1315 $(document).off('focusin.bs.modal') 1316 1317 this.$element 1318 .removeClass('in') 1319 .off('click.dismiss.bs.modal') 1320 .off('mouseup.dismiss.bs.modal') 1321 1322 this.$dialog.off('mousedown.dismiss.bs.modal') 1323 1324 $.support.transition && this.$element.hasClass('fade') ? 1325 this.$element 1326 .one('bsTransitionEnd', $.proxy(this.hideModal, this)) 1327 .emulateTransitionEnd(Modal.TRANSITION_DURATION) : 1328 this.hideModal() 1329 } 1330 1331 Modal.prototype.enforceFocus = function () { 1332 $(document) 1333 .off('focusin.bs.modal') // guard against infinite focus loop 1334 .on('focusin.bs.modal', $.proxy(function (e) { 1335 if (document !== e.target && 1336 this.$element[0] !== e.target && 1337 !this.$element.has(e.target).length) { 1338 this.$element.trigger('focus') 1339 } 1340 }, this)) 1341 } 1342 1343 Modal.prototype.escape = function () { 1344 if (this.isShown && this.options.keyboard) { 1345 this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { 1346 e.which == 27 && this.hide() 1347 }, this)) 1348 } else if (!this.isShown) { 1349 this.$element.off('keydown.dismiss.bs.modal') 1350 } 1351 } 1352 1353 Modal.prototype.resize = function () { 1354 if (this.isShown) { 1355 $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) 1356 } else { 1357 $(window).off('resize.bs.modal') 1358 } 1359 } 1360 1361 Modal.prototype.hideModal = function () { 1362 var that = this 1363 this.$element.hide() 1364 this.backdrop(function () { 1365 that.$body.removeClass('modal-open') 1366 that.resetAdjustments() 1367 that.resetScrollbar() 1368 that.$element.trigger('hidden.bs.modal') 1369 }) 1370 } 1371 1372 Modal.prototype.removeBackdrop = function () { 1373 this.$backdrop && this.$backdrop.remove() 1374 this.$backdrop = null 1375 } 1376 1377 Modal.prototype.backdrop = function (callback) { 1378 var that = this 1379 var animate = this.$element.hasClass('fade') ? 'fade' : '' 1380 1381 if (this.isShown && this.options.backdrop) { 1382 var doAnimate = $.support.transition && animate 1383 1384 this.$backdrop = $(document.createElement('div')) 1385 .addClass('modal-backdrop ' + animate) 1386 .appendTo(this.$body) 1387 1388 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { 1389 if (this.ignoreBackdropClick) { 1390 this.ignoreBackdropClick = false 1391 return 1392 } 1393 if (e.target !== e.currentTarget) return 1394 this.options.backdrop == 'static' 1395 ? this.$element[0].focus() 1396 : this.hide() 1397 }, this)) 1398 1399 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow 1400 1401 this.$backdrop.addClass('in') 1402 1403 if (!callback) return 1404 1405 doAnimate ? 1406 this.$backdrop 1407 .one('bsTransitionEnd', callback) 1408 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : 1409 callback() 1410 1411 } else if (!this.isShown && this.$backdrop) { 1412 this.$backdrop.removeClass('in') 1413 1414 var callbackRemove = function () { 1415 that.removeBackdrop() 1416 callback && callback() 1417 } 1418 $.support.transition && this.$element.hasClass('fade') ? 1419 this.$backdrop 1420 .one('bsTransitionEnd', callbackRemove) 1421 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : 1422 callbackRemove() 1423 1424 } else if (callback) { 1425 callback() 1426 } 1427 } 1428 1429 // these following methods are used to handle overflowing modals 1430 1431 Modal.prototype.handleUpdate = function () { 1432 this.adjustDialog() 1433 } 1434 1435 Modal.prototype.adjustDialog = function () { 1436 var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight 1437 1438 this.$element.css({ 1439 paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', 1440 paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' 1441 }) 1442 } 1443 1444 Modal.prototype.resetAdjustments = function () { 1445 this.$element.css({ 1446 paddingLeft: '', 1447 paddingRight: '' 1448 }) 1449 } 1450 1451 Modal.prototype.checkScrollbar = function () { 1452 var fullWindowWidth = window.innerWidth 1453 if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 1454 var documentElementRect = document.documentElement.getBoundingClientRect() 1455 fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) 1456 } 1457 this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth 1458 this.scrollbarWidth = this.measureScrollbar() 1459 } 1460 1461 Modal.prototype.setScrollbar = function () { 1462 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) 1463 this.originalBodyPad = document.body.style.paddingRight || '' 1464 var scrollbarWidth = this.scrollbarWidth 1465 if (this.bodyIsOverflowing) { 1466 this.$body.css('padding-right', bodyPad + scrollbarWidth) 1467 $(this.fixedContent).each(function (index, element) { 1468 var actualPadding = element.style.paddingRight 1469 var calculatedPadding = $(element).css('padding-right') 1470 $(element) 1471 .data('padding-right', actualPadding) 1472 .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px') 1473 }) 1474 } 1475 } 1476 1477 Modal.prototype.resetScrollbar = function () { 1478 this.$body.css('padding-right', this.originalBodyPad) 1479 $(this.fixedContent).each(function (index, element) { 1480 var padding = $(element).data('padding-right') 1481 $(element).removeData('padding-right') 1482 element.style.paddingRight = padding ? padding : '' 1483 }) 1484 } 1485 1486 Modal.prototype.measureScrollbar = function () { // thx walsh 1487 var scrollDiv = document.createElement('div') 1488 scrollDiv.className = 'modal-scrollbar-measure' 1489 this.$body.append(scrollDiv) 1490 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth 1491 this.$body[0].removeChild(scrollDiv) 1492 return scrollbarWidth 1493 } 1494 1495 1496 // MODAL PLUGIN DEFINITION 1497 // ======================= 1498 1499 function Plugin(option, _relatedTarget) { 1500 return this.each(function () { 1501 var $this = $(this) 1502 var data = $this.data('bs.modal') 1503 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) 1504 1505 if (!data) $this.data('bs.modal', (data = new Modal(this, options))) 1506 if (typeof option == 'string') data[option](_relatedTarget) 1507 else if (options.show) data.show(_relatedTarget) 1508 }) 1509 } 1510 1511 var old = $.fn.modal 1512 1513 $.fn.modal = Plugin 1514 $.fn.modal.Constructor = Modal 1515 1516 1517 // MODAL NO CONFLICT 1518 // ================= 1519 1520 $.fn.modal.noConflict = function () { 1521 $.fn.modal = old 1522 return this 1523 } 1524 1525 1526 // MODAL DATA-API 1527 // ============== 1528 1529 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { 1530 var $this = $(this) 1531 var href = $this.attr('href') 1532 var target = $this.attr('data-target') || 1533 (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 1534 1535 var $target = $(document).find(target) 1536 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) 1537 1538 if ($this.is('a')) e.preventDefault() 1539 1540 $target.one('show.bs.modal', function (showEvent) { 1541 if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown 1542 $target.one('hidden.bs.modal', function () { 1543 $this.is(':visible') && $this.trigger('focus') 1544 }) 1545 }) 1546 Plugin.call($target, option, this) 1547 }) 1548 1549}(jQuery); 1550 1551 1552/***/ }), 1553
vendor: 3,796 bytes, lines 1554-1687
1554/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/popover.js": 1555/*!***************************************************************!*\ 1556 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/popover.js ***! 1557 \***************************************************************/ 1558/*! no static exports found */ 1559/***/ (function(module, exports) { 1560 1561/* ======================================================================== 1562 * Bootstrap: popover.js v3.4.1 1563 * https://getbootstrap.com/docs/3.4/javascript/#popovers 1564 * ======================================================================== 1565 * Copyright 2011-2019 Twitter, Inc. 1566 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1567 * ======================================================================== */ 1568 1569 1570+function ($) { 1571 'use strict'; 1572 1573 // POPOVER PUBLIC CLASS DEFINITION 1574 // =============================== 1575 1576 var Popover = function (element, options) { 1577 this.init('popover', element, options) 1578 } 1579 1580 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') 1581 1582 Popover.VERSION = '3.4.1' 1583 1584 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { 1585 placement: 'right', 1586 trigger: 'click', 1587 content: '', 1588 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 1589 }) 1590 1591 1592 // NOTE: POPOVER EXTENDS tooltip.js 1593 // ================================ 1594 1595 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) 1596 1597 Popover.prototype.constructor = Popover 1598 1599 Popover.prototype.getDefaults = function () { 1600 return Popover.DEFAULTS 1601 } 1602 1603 Popover.prototype.setContent = function () { 1604 var $tip = this.tip() 1605 var title = this.getTitle() 1606 var content = this.getContent() 1607 1608 if (this.options.html) { 1609 var typeContent = typeof content 1610 1611 if (this.options.sanitize) { 1612 title = this.sanitizeHtml(title) 1613 1614 if (typeContent === 'string') { 1615 content = this.sanitizeHtml(content) 1616 } 1617 } 1618 1619 $tip.find('.popover-title').html(title) 1620 $tip.find('.popover-content').children().detach().end()[ 1621 typeContent === 'string' ? 'html' : 'append' 1622 ](content) 1623 } else { 1624 $tip.find('.popover-title').text(title) 1625 $tip.find('.popover-content').children().detach().end().text(content) 1626 } 1627 1628 $tip.removeClass('fade top bottom left right in') 1629 1630 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 1631 // this manually by checking the contents. 1632 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() 1633 } 1634 1635 Popover.prototype.hasContent = function () { 1636 return this.getTitle() || this.getContent() 1637 } 1638 1639 Popover.prototype.getContent = function () { 1640 var $e = this.$element 1641 var o = this.options 1642 1643 return $e.attr('data-content') 1644 || (typeof o.content == 'function' ? 1645 o.content.call($e[0]) : 1646 o.content) 1647 } 1648 1649 Popover.prototype.arrow = function () { 1650 return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 1651 } 1652 1653 1654 // POPOVER PLUGIN DEFINITION 1655 // ========================= 1656 1657 function Plugin(option) { 1658 return this.each(function () { 1659 var $this = $(this) 1660 var data = $this.data('bs.popover') 1661 var options = typeof option == 'object' && option 1662 1663 if (!data && /destroy|hide/.test(option)) return 1664 if (!data) $this.data('bs.popover', (data = new Popover(this, options))) 1665 if (typeof option == 'string') data[option]() 1666 }) 1667 } 1668 1669 var old = $.fn.popover 1670 1671 $.fn.popover = Plugin 1672 $.fn.popover.Constructor = Popover 1673 1674 1675 // POPOVER NO CONFLICT 1676 // =================== 1677 1678 $.fn.popover.noConflict = function () { 1679 $.fn.popover = old 1680 return this 1681 } 1682 1683}(jQuery); 1684 1685 1686/***/ }), 1687
vendor: 5,076 bytes, lines 1688-1870
1688/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/scrollspy.js": 1689/*!*****************************************************************!*\ 1690 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/scrollspy.js ***! 1691 \*****************************************************************/ 1692/*! no static exports found */ 1693/***/ (function(module, exports) { 1694 1695/* ======================================================================== 1696 * Bootstrap: scrollspy.js v3.4.1 1697 * https://getbootstrap.com/docs/3.4/javascript/#scrollspy 1698 * ======================================================================== 1699 * Copyright 2011-2019 Twitter, Inc. 1700 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1701 * ======================================================================== */ 1702 1703 1704+function ($) { 1705 'use strict'; 1706 1707 // SCROLLSPY CLASS DEFINITION 1708 // ========================== 1709 1710 function ScrollSpy(element, options) { 1711 this.$body = $(document.body) 1712 this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) 1713 this.options = $.extend({}, ScrollSpy.DEFAULTS, options) 1714 this.selector = (this.options.target || '') + ' .nav li > a' 1715 this.offsets = [] 1716 this.targets = [] 1717 this.activeTarget = null 1718 this.scrollHeight = 0 1719 1720 this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) 1721 this.refresh() 1722 this.process() 1723 } 1724 1725 ScrollSpy.VERSION = '3.4.1' 1726 1727 ScrollSpy.DEFAULTS = { 1728 offset: 10 1729 } 1730 1731 ScrollSpy.prototype.getScrollHeight = function () { 1732 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 1733 } 1734 1735 ScrollSpy.prototype.refresh = function () { 1736 var that = this 1737 var offsetMethod = 'offset' 1738 var offsetBase = 0 1739 1740 this.offsets = [] 1741 this.targets = [] 1742 this.scrollHeight = this.getScrollHeight() 1743 1744 if (!$.isWindow(this.$scrollElement[0])) { 1745 offsetMethod = 'position' 1746 offsetBase = this.$scrollElement.scrollTop() 1747 } 1748 1749 this.$body 1750 .find(this.selector) 1751 .map(function () { 1752 var $el = $(this) 1753 var href = $el.data('target') || $el.attr('href') 1754 var $href = /^#./.test(href) && $(href) 1755 1756 return ($href 1757 && $href.length 1758 && $href.is(':visible') 1759 && [[$href[offsetMethod]().top + offsetBase, href]]) || null 1760 }) 1761 .sort(function (a, b) { return a[0] - b[0] }) 1762 .each(function () { 1763 that.offsets.push(this[0]) 1764 that.targets.push(this[1]) 1765 }) 1766 } 1767 1768 ScrollSpy.prototype.process = function () { 1769 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 1770 var scrollHeight = this.getScrollHeight() 1771 var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() 1772 var offsets = this.offsets 1773 var targets = this.targets 1774 var activeTarget = this.activeTarget 1775 var i 1776 1777 if (this.scrollHeight != scrollHeight) { 1778 this.refresh() 1779 } 1780 1781 if (scrollTop >= maxScroll) { 1782 return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) 1783 } 1784 1785 if (activeTarget && scrollTop < offsets[0]) { 1786 this.activeTarget = null 1787 return this.clear() 1788 } 1789 1790 for (i = offsets.length; i--;) { 1791 activeTarget != targets[i] 1792 && scrollTop >= offsets[i] 1793 && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) 1794 && this.activate(targets[i]) 1795 } 1796 } 1797 1798 ScrollSpy.prototype.activate = function (target) { 1799 this.activeTarget = target 1800 1801 this.clear() 1802 1803 var selector = this.selector + 1804 '[data-target="' + target + '"],' + 1805 this.selector + '[href="' + target + '"]' 1806 1807 var active = $(selector) 1808 .parents('li') 1809 .addClass('active') 1810 1811 if (active.parent('.dropdown-menu').length) { 1812 active = active 1813 .closest('li.dropdown') 1814 .addClass('active') 1815 } 1816 1817 active.trigger('activate.bs.scrollspy') 1818 } 1819 1820 ScrollSpy.prototype.clear = function () { 1821 $(this.selector) 1822 .parentsUntil(this.options.target, '.active') 1823 .removeClass('active') 1824 } 1825 1826 1827 // SCROLLSPY PLUGIN DEFINITION 1828 // =========================== 1829 1830 function Plugin(option) { 1831 return this.each(function () { 1832 var $this = $(this) 1833 var data = $this.data('bs.scrollspy') 1834 var options = typeof option == 'object' && option 1835 1836 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) 1837 if (typeof option == 'string') data[option]() 1838 }) 1839 } 1840 1841 var old = $.fn.scrollspy 1842 1843 $.fn.scrollspy = Plugin 1844 $.fn.scrollspy.Constructor = ScrollSpy 1845 1846 1847 // SCROLLSPY NO CONFLICT 1848 // ===================== 1849 1850 $.fn.scrollspy.noConflict = function () { 1851 $.fn.scrollspy = old 1852 return this 1853 } 1854 1855 1856 // SCROLLSPY DATA-API 1857 // ================== 1858 1859 $(window).on('load.bs.scrollspy.data-api', function () { 1860 $('[data-spy="scroll"]').each(function () { 1861 var $spy = $(this) 1862 Plugin.call($spy, $spy.data()) 1863 }) 1864 }) 1865 1866}(jQuery); 1867 1868 1869/***/ }), 1870
vendor: 4,255 bytes, lines 1871-2036
1871/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/tab.js": 1872/*!***********************************************************!*\ 1873 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/tab.js ***! 1874 \***********************************************************/ 1875/*! no static exports found */ 1876/***/ (function(module, exports) { 1877 1878/* ======================================================================== 1879 * Bootstrap: tab.js v3.4.1 1880 * https://getbootstrap.com/docs/3.4/javascript/#tabs 1881 * ======================================================================== 1882 * Copyright 2011-2019 Twitter, Inc. 1883 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1884 * ======================================================================== */ 1885 1886 1887+function ($) { 1888 'use strict'; 1889 1890 // TAB CLASS DEFINITION 1891 // ==================== 1892 1893 var Tab = function (element) { 1894 // jscs:disable requireDollarBeforejQueryAssignment 1895 this.element = $(element) 1896 // jscs:enable requireDollarBeforejQueryAssignment 1897 } 1898 1899 Tab.VERSION = '3.4.1' 1900 1901 Tab.TRANSITION_DURATION = 150 1902 1903 Tab.prototype.show = function () { 1904 var $this = this.element 1905 var $ul = $this.closest('ul:not(.dropdown-menu)') 1906 var selector = $this.data('target') 1907 1908 if (!selector) { 1909 selector = $this.attr('href') 1910 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 1911 } 1912 1913 if ($this.parent('li').hasClass('active')) return 1914 1915 var $previous = $ul.find('.active:last a') 1916 var hideEvent = $.Event('hide.bs.tab', { 1917 relatedTarget: $this[0] 1918 }) 1919 var showEvent = $.Event('show.bs.tab', { 1920 relatedTarget: $previous[0] 1921 }) 1922 1923 $previous.trigger(hideEvent) 1924 $this.trigger(showEvent) 1925 1926 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return 1927 1928 var $target = $(document).find(selector) 1929 1930 this.activate($this.closest('li'), $ul) 1931 this.activate($target, $target.parent(), function () { 1932 $previous.trigger({ 1933 type: 'hidden.bs.tab', 1934 relatedTarget: $this[0] 1935 }) 1936 $this.trigger({ 1937 type: 'shown.bs.tab', 1938 relatedTarget: $previous[0] 1939 }) 1940 }) 1941 } 1942 1943 Tab.prototype.activate = function (element, container, callback) { 1944 var $active = container.find('> .active') 1945 var transition = callback 1946 && $.support.transition 1947 && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) 1948 1949 function next() { 1950 $active 1951 .removeClass('active') 1952 .find('> .dropdown-menu > .active') 1953 .removeClass('active') 1954 .end() 1955 .find('[data-toggle="tab"]') 1956 .attr('aria-expanded', false) 1957 1958 element 1959 .addClass('active') 1960 .find('[data-toggle="tab"]') 1961 .attr('aria-expanded', true) 1962 1963 if (transition) { 1964 element[0].offsetWidth // reflow for transition 1965 element.addClass('in') 1966 } else { 1967 element.removeClass('fade') 1968 } 1969 1970 if (element.parent('.dropdown-menu').length) { 1971 element 1972 .closest('li.dropdown') 1973 .addClass('active') 1974 .end() 1975 .find('[data-toggle="tab"]') 1976 .attr('aria-expanded', true) 1977 } 1978 1979 callback && callback() 1980 } 1981 1982 $active.length && transition ? 1983 $active 1984 .one('bsTransitionEnd', next) 1985 .emulateTransitionEnd(Tab.TRANSITION_DURATION) : 1986 next() 1987 1988 $active.removeClass('in') 1989 } 1990 1991 1992 // TAB PLUGIN DEFINITION 1993 // ===================== 1994 1995 function Plugin(option) { 1996 return this.each(function () { 1997 var $this = $(this) 1998 var data = $this.data('bs.tab') 1999 2000 if (!data) $this.data('bs.tab', (data = new Tab(this))) 2001 if (typeof option == 'string') data[option]() 2002 }) 2003 } 2004 2005 var old = $.fn.tab 2006 2007 $.fn.tab = Plugin 2008 $.fn.tab.Constructor = Tab 2009 2010 2011 // TAB NO CONFLICT 2012 // =============== 2013 2014 $.fn.tab.noConflict = function () { 2015 $.fn.tab = old 2016 return this 2017 } 2018 2019 2020 // TAB DATA-API 2021 // ============ 2022 2023 var clickHandler = function (e) { 2024 e.preventDefault() 2025 Plugin.call($(this), 'show') 2026 } 2027 2028 $(document) 2029 .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) 2030 .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) 2031 2032}(jQuery); 2033 2034 2035/***/ }), 2036
vendor: 21,488 bytes, lines 2037-2724
2037/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/tooltip.js": 2038/*!***************************************************************!*\ 2039 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/tooltip.js ***! 2040 \***************************************************************/ 2041/*! no static exports found */ 2042/***/ (function(module, exports) { 2043 2044/* ======================================================================== 2045 * Bootstrap: tooltip.js v3.4.1 2046 * https://getbootstrap.com/docs/3.4/javascript/#tooltip 2047 * Inspired by the original jQuery.tipsy by Jason Frame 2048 * ======================================================================== 2049 * Copyright 2011-2019 Twitter, Inc. 2050 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2051 * ======================================================================== */ 2052 2053+function ($) { 2054 'use strict'; 2055 2056 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'] 2057 2058 var uriAttrs = [ 2059 'background', 2060 'cite', 2061 'href', 2062 'itemtype', 2063 'longdesc', 2064 'poster', 2065 'src', 2066 'xlink:href' 2067 ] 2068 2069 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i 2070 2071 var DefaultWhitelist = { 2072 // Global attributes allowed on any supplied element below. 2073 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 2074 a: ['target', 'href', 'title', 'rel'], 2075 area: [], 2076 b: [], 2077 br: [], 2078 col: [], 2079 code: [], 2080 div: [], 2081 em: [], 2082 hr: [], 2083 h1: [], 2084 h2: [], 2085 h3: [], 2086 h4: [], 2087 h5: [], 2088 h6: [], 2089 i: [], 2090 img: ['src', 'alt', 'title', 'width', 'height'], 2091 li: [], 2092 ol: [], 2093 p: [], 2094 pre: [], 2095 s: [], 2096 small: [], 2097 span: [], 2098 sub: [], 2099 sup: [], 2100 strong: [], 2101 u: [], 2102 ul: [] 2103 } 2104 2105 /** 2106 * A pattern that recognizes a commonly useful subset of URLs that are safe. 2107 * 2108 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 2109 */ 2110 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi 2111 2112 /** 2113 * A pattern that matches safe data URLs. Only matches image, video and audio types. 2114 * 2115 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 2116 */ 2117 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 2118 2119 function allowedAttribute(attr, allowedAttributeList) { 2120 var attrName = attr.nodeName.toLowerCase() 2121 2122 if ($.inArray(attrName, allowedAttributeList) !== -1) { 2123 if ($.inArray(attrName, uriAttrs) !== -1) { 2124 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)) 2125 } 2126 2127 return true 2128 } 2129 2130 var regExp = $(allowedAttributeList).filter(function (index, value) { 2131 return value instanceof RegExp 2132 }) 2133 2134 // Check if a regular expression validates the attribute. 2135 for (var i = 0, l = regExp.length; i < l; i++) { 2136 if (attrName.match(regExp[i])) { 2137 return true 2138 } 2139 } 2140 2141 return false 2142 } 2143 2144 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 2145 if (unsafeHtml.length === 0) { 2146 return unsafeHtml 2147 } 2148 2149 if (sanitizeFn && typeof sanitizeFn === 'function') { 2150 return sanitizeFn(unsafeHtml) 2151 } 2152 2153 // IE 8 and below don't support createHTMLDocument 2154 if (!document.implementation || !document.implementation.createHTMLDocument) { 2155 return unsafeHtml 2156 } 2157 2158 var createdDocument = document.implementation.createHTMLDocument('sanitization') 2159 createdDocument.body.innerHTML = unsafeHtml 2160 2161 var whitelistKeys = $.map(whiteList, function (el, i) { return i }) 2162 var elements = $(createdDocument.body).find('*') 2163 2164 for (var i = 0, len = elements.length; i < len; i++) { 2165 var el = elements[i] 2166 var elName = el.nodeName.toLowerCase() 2167 2168 if ($.inArray(elName, whitelistKeys) === -1) { 2169 el.parentNode.removeChild(el) 2170 2171 continue 2172 } 2173 2174 var attributeList = $.map(el.attributes, function (el) { return el }) 2175 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []) 2176 2177 for (var j = 0, len2 = attributeList.length; j < len2; j++) { 2178 if (!allowedAttribute(attributeList[j], whitelistedAttributes)) { 2179 el.removeAttribute(attributeList[j].nodeName) 2180 } 2181 } 2182 } 2183 2184 return createdDocument.body.innerHTML 2185 } 2186 2187 // TOOLTIP PUBLIC CLASS DEFINITION 2188 // =============================== 2189 2190 var Tooltip = function (element, options) { 2191 this.type = null 2192 this.options = null 2193 this.enabled = null 2194 this.timeout = null 2195 this.hoverState = null 2196 this.$element = null 2197 this.inState = null 2198 2199 this.init('tooltip', element, options) 2200 } 2201 2202 Tooltip.VERSION = '3.4.1' 2203 2204 Tooltip.TRANSITION_DURATION = 150 2205 2206 Tooltip.DEFAULTS = { 2207 animation: true, 2208 placement: 'top', 2209 selector: false, 2210 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', 2211 trigger: 'hover focus', 2212 title: '', 2213 delay: 0, 2214 html: false, 2215 container: false, 2216 viewport: { 2217 selector: 'body', 2218 padding: 0 2219 }, 2220 sanitize : true, 2221 sanitizeFn : null, 2222 whiteList : DefaultWhitelist 2223 } 2224 2225 Tooltip.prototype.init = function (type, element, options) { 2226 this.enabled = true 2227 this.type = type 2228 this.$element = $(element) 2229 this.options = this.getOptions(options) 2230 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)) 2231 this.inState = { click: false, hover: false, focus: false } 2232 2233 if (this.$element[0] instanceof document.constructor && !this.options.selector) { 2234 throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') 2235 } 2236 2237 var triggers = this.options.trigger.split(' ') 2238 2239 for (var i = triggers.length; i--;) { 2240 var trigger = triggers[i] 2241 2242 if (trigger == 'click') { 2243 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) 2244 } else if (trigger != 'manual') { 2245 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' 2246 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' 2247 2248 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) 2249 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) 2250 } 2251 } 2252 2253 this.options.selector ? 2254 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : 2255 this.fixTitle() 2256 } 2257 2258 Tooltip.prototype.getDefaults = function () { 2259 return Tooltip.DEFAULTS 2260 } 2261 2262 Tooltip.prototype.getOptions = function (options) { 2263 var dataAttributes = this.$element.data() 2264 2265 for (var dataAttr in dataAttributes) { 2266 if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) { 2267 delete dataAttributes[dataAttr] 2268 } 2269 } 2270 2271 options = $.extend({}, this.getDefaults(), dataAttributes, options) 2272 2273 if (options.delay && typeof options.delay == 'number') { 2274 options.delay = { 2275 show: options.delay, 2276 hide: options.delay 2277 } 2278 } 2279 2280 if (options.sanitize) { 2281 options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn) 2282 } 2283 2284 return options 2285 } 2286 2287 Tooltip.prototype.getDelegateOptions = function () { 2288 var options = {} 2289 var defaults = this.getDefaults() 2290 2291 this._options && $.each(this._options, function (key, value) { 2292 if (defaults[key] != value) options[key] = value 2293 }) 2294 2295 return options 2296 } 2297 2298 Tooltip.prototype.enter = function (obj) { 2299 var self = obj instanceof this.constructor ? 2300 obj : $(obj.currentTarget).data('bs.' + this.type) 2301 2302 if (!self) { 2303 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 2304 $(obj.currentTarget).data('bs.' + this.type, self) 2305 } 2306 2307 if (obj instanceof $.Event) { 2308 self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true 2309 } 2310 2311 if (self.tip().hasClass('in') || self.hoverState == 'in') { 2312 self.hoverState = 'in' 2313 return 2314 } 2315 2316 clearTimeout(self.timeout) 2317 2318 self.hoverState = 'in' 2319 2320 if (!self.options.delay || !self.options.delay.show) return self.show() 2321 2322 self.timeout = setTimeout(function () { 2323 if (self.hoverState == 'in') self.show() 2324 }, self.options.delay.show) 2325 } 2326 2327 Tooltip.prototype.isInStateTrue = function () { 2328 for (var key in this.inState) { 2329 if (this.inState[key]) return true 2330 } 2331 2332 return false 2333 } 2334 2335 Tooltip.prototype.leave = function (obj) { 2336 var self = obj instanceof this.constructor ? 2337 obj : $(obj.currentTarget).data('bs.' + this.type) 2338 2339 if (!self) { 2340 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 2341 $(obj.currentTarget).data('bs.' + this.type, self) 2342 } 2343 2344 if (obj instanceof $.Event) { 2345 self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false 2346 } 2347 2348 if (self.isInStateTrue()) return 2349 2350 clearTimeout(self.timeout) 2351 2352 self.hoverState = 'out' 2353 2354 if (!self.options.delay || !self.options.delay.hide) return self.hide() 2355 2356 self.timeout = setTimeout(function () { 2357 if (self.hoverState == 'out') self.hide() 2358 }, self.options.delay.hide) 2359 } 2360 2361 Tooltip.prototype.show = function () { 2362 var e = $.Event('show.bs.' + this.type) 2363 2364 if (this.hasContent() && this.enabled) { 2365 this.$element.trigger(e) 2366 2367 var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) 2368 if (e.isDefaultPrevented() || !inDom) return 2369 var that = this 2370 2371 var $tip = this.tip() 2372 2373 var tipId = this.getUID(this.type) 2374 2375 this.setContent() 2376 $tip.attr('id', tipId) 2377 this.$element.attr('aria-describedby', tipId) 2378 2379 if (this.options.animation) $tip.addClass('fade') 2380 2381 var placement = typeof this.options.placement == 'function' ? 2382 this.options.placement.call(this, $tip[0], this.$element[0]) : 2383 this.options.placement 2384 2385 var autoToken = /\s?auto?\s?/i 2386 var autoPlace = autoToken.test(placement) 2387 if (autoPlace) placement = placement.replace(autoToken, '') || 'top' 2388 2389 $tip 2390 .detach() 2391 .css({ top: 0, left: 0, display: 'block' }) 2392 .addClass(placement) 2393 .data('bs.' + this.type, this) 2394 2395 this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element) 2396 this.$element.trigger('inserted.bs.' + this.type) 2397 2398 var pos = this.getPosition() 2399 var actualWidth = $tip[0].offsetWidth 2400 var actualHeight = $tip[0].offsetHeight 2401 2402 if (autoPlace) { 2403 var orgPlacement = placement 2404 var viewportDim = this.getPosition(this.$viewport) 2405 2406 placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : 2407 placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : 2408 placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : 2409 placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : 2410 placement 2411 2412 $tip 2413 .removeClass(orgPlacement) 2414 .addClass(placement) 2415 } 2416 2417 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) 2418 2419 this.applyPlacement(calculatedOffset, placement) 2420 2421 var complete = function () { 2422 var prevHoverState = that.hoverState 2423 that.$element.trigger('shown.bs.' + that.type) 2424 that.hoverState = null 2425 2426 if (prevHoverState == 'out') that.leave(that) 2427 } 2428 2429 $.support.transition && this.$tip.hasClass('fade') ? 2430 $tip 2431 .one('bsTransitionEnd', complete) 2432 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 2433 complete() 2434 } 2435 } 2436 2437 Tooltip.prototype.applyPlacement = function (offset, placement) { 2438 var $tip = this.tip() 2439 var width = $tip[0].offsetWidth 2440 var height = $tip[0].offsetHeight 2441 2442 // manually read margins because getBoundingClientRect includes difference 2443 var marginTop = parseInt($tip.css('margin-top'), 10) 2444 var marginLeft = parseInt($tip.css('margin-left'), 10) 2445 2446 // we must check for NaN for ie 8/9 2447 if (isNaN(marginTop)) marginTop = 0 2448 if (isNaN(marginLeft)) marginLeft = 0 2449 2450 offset.top += marginTop 2451 offset.left += marginLeft 2452 2453 // $.fn.offset doesn't round pixel values 2454 // so we use setOffset directly with our own function B-0 2455 $.offset.setOffset($tip[0], $.extend({ 2456 using: function (props) { 2457 $tip.css({ 2458 top: Math.round(props.top), 2459 left: Math.round(props.left) 2460 }) 2461 } 2462 }, offset), 0) 2463 2464 $tip.addClass('in') 2465 2466 // check to see if placing tip in new offset caused the tip to resize itself 2467 var actualWidth = $tip[0].offsetWidth 2468 var actualHeight = $tip[0].offsetHeight 2469 2470 if (placement == 'top' && actualHeight != height) { 2471 offset.top = offset.top + height - actualHeight 2472 } 2473 2474 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) 2475 2476 if (delta.left) offset.left += delta.left 2477 else offset.top += delta.top 2478 2479 var isVertical = /top|bottom/.test(placement) 2480 var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight 2481 var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' 2482 2483 $tip.offset(offset) 2484 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) 2485 } 2486 2487 Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { 2488 this.arrow() 2489 .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') 2490 .css(isVertical ? 'top' : 'left', '') 2491 } 2492 2493 Tooltip.prototype.setContent = function () { 2494 var $tip = this.tip() 2495 var title = this.getTitle() 2496 2497 if (this.options.html) { 2498 if (this.options.sanitize) { 2499 title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn) 2500 } 2501 2502 $tip.find('.tooltip-inner').html(title) 2503 } else { 2504 $tip.find('.tooltip-inner').text(title) 2505 } 2506 2507 $tip.removeClass('fade in top bottom left right') 2508 } 2509 2510 Tooltip.prototype.hide = function (callback) { 2511 var that = this 2512 var $tip = $(this.$tip) 2513 var e = $.Event('hide.bs.' + this.type) 2514 2515 function complete() { 2516 if (that.hoverState != 'in') $tip.detach() 2517 if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary. 2518 that.$element 2519 .removeAttr('aria-describedby') 2520 .trigger('hidden.bs.' + that.type) 2521 } 2522 callback && callback() 2523 } 2524 2525 this.$element.trigger(e) 2526 2527 if (e.isDefaultPrevented()) return 2528 2529 $tip.removeClass('in') 2530 2531 $.support.transition && $tip.hasClass('fade') ? 2532 $tip 2533 .one('bsTransitionEnd', complete) 2534 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 2535 complete() 2536 2537 this.hoverState = null 2538 2539 return this 2540 } 2541 2542 Tooltip.prototype.fixTitle = function () { 2543 var $e = this.$element 2544 if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { 2545 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') 2546 } 2547 } 2548 2549 Tooltip.prototype.hasContent = function () { 2550 return this.getTitle() 2551 } 2552 2553 Tooltip.prototype.getPosition = function ($element) { 2554 $element = $element || this.$element 2555 2556 var el = $element[0] 2557 var isBody = el.tagName == 'BODY' 2558 2559 var elRect = el.getBoundingClientRect() 2560 if (elRect.width == null) { 2561 // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 2562 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) 2563 } 2564 var isSvg = window.SVGElement && el instanceof window.SVGElement 2565 // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3. 2566 // See https://github.com/twbs/bootstrap/issues/20280 2567 var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset()) 2568 var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } 2569 var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null 2570 2571 return $.extend({}, elRect, scroll, outerDims, elOffset) 2572 } 2573 2574 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { 2575 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : 2576 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : 2577 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : 2578 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } 2579 2580 } 2581 2582 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { 2583 var delta = { top: 0, left: 0 } 2584 if (!this.$viewport) return delta 2585 2586 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 2587 var viewportDimensions = this.getPosition(this.$viewport) 2588 2589 if (/right|left/.test(placement)) { 2590 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll 2591 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight 2592 if (topEdgeOffset < viewportDimensions.top) { // top overflow 2593 delta.top = viewportDimensions.top - topEdgeOffset 2594 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow 2595 delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset 2596 } 2597 } else { 2598 var leftEdgeOffset = pos.left - viewportPadding 2599 var rightEdgeOffset = pos.left + viewportPadding + actualWidth 2600 if (leftEdgeOffset < viewportDimensions.left) { // left overflow 2601 delta.left = viewportDimensions.left - leftEdgeOffset 2602 } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow 2603 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset 2604 } 2605 } 2606 2607 return delta 2608 } 2609 2610 Tooltip.prototype.getTitle = function () { 2611 var title 2612 var $e = this.$element 2613 var o = this.options 2614 2615 title = $e.attr('data-original-title') 2616 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) 2617 2618 return title 2619 } 2620 2621 Tooltip.prototype.getUID = function (prefix) { 2622 do prefix += ~~(Math.random() * 1000000) 2623 while (document.getElementById(prefix)) 2624 return prefix 2625 } 2626 2627 Tooltip.prototype.tip = function () { 2628 if (!this.$tip) { 2629 this.$tip = $(this.options.template) 2630 if (this.$tip.length != 1) { 2631 throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') 2632 } 2633 } 2634 return this.$tip 2635 } 2636 2637 Tooltip.prototype.arrow = function () { 2638 return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) 2639 } 2640 2641 Tooltip.prototype.enable = function () { 2642 this.enabled = true 2643 } 2644 2645 Tooltip.prototype.disable = function () { 2646 this.enabled = false 2647 } 2648 2649 Tooltip.prototype.toggleEnabled = function () { 2650 this.enabled = !this.enabled 2651 } 2652 2653 Tooltip.prototype.toggle = function (e) { 2654 var self = this 2655 if (e) { 2656 self = $(e.currentTarget).data('bs.' + this.type) 2657 if (!self) { 2658 self = new this.constructor(e.currentTarget, this.getDelegateOptions()) 2659 $(e.currentTarget).data('bs.' + this.type, self) 2660 } 2661 } 2662 2663 if (e) { 2664 self.inState.click = !self.inState.click 2665 if (self.isInStateTrue()) self.enter(self) 2666 else self.leave(self) 2667 } else { 2668 self.tip().hasClass('in') ? self.leave(self) : self.enter(self) 2669 } 2670 } 2671 2672 Tooltip.prototype.destroy = function () { 2673 var that = this 2674 clearTimeout(this.timeout) 2675 this.hide(function () { 2676 that.$element.off('.' + that.type).removeData('bs.' + that.type) 2677 if (that.$tip) { 2678 that.$tip.detach() 2679 } 2680 that.$tip = null 2681 that.$arrow = null 2682 that.$viewport = null 2683 that.$element = null 2684 }) 2685 } 2686 2687 Tooltip.prototype.sanitizeHtml = function (unsafeHtml) { 2688 return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn) 2689 } 2690 2691 // TOOLTIP PLUGIN DEFINITION 2692 // ========================= 2693 2694 function Plugin(option) { 2695 return this.each(function () { 2696 var $this = $(this) 2697 var data = $this.data('bs.tooltip') 2698 var options = typeof option == 'object' && option 2699 2700 if (!data && /destroy|hide/.test(option)) return 2701 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) 2702 if (typeof option == 'string') data[option]() 2703 }) 2704 } 2705 2706 var old = $.fn.tooltip 2707 2708 $.fn.tooltip = Plugin 2709 $.fn.tooltip.Constructor = Tooltip 2710 2711 2712 // TOOLTIP NO CONFLICT 2713 // =================== 2714 2715 $.fn.tooltip.noConflict = function () { 2716 $.fn.tooltip = old 2717 return this 2718 } 2719 2720}(jQuery); 2721 2722 2723/***/ }), 2724
vendor: 2,202 bytes, lines 2725-2794
2725/***/ "./Themes/Cynoebook/node_modules/bootstrap/js/transition.js": 2726/*!******************************************************************!*\ 2727 !*** ./Themes/Cynoebook/node_modules/bootstrap/js/transition.js ***! 2728 \******************************************************************/ 2729/*! no static exports found */ 2730/***/ (function(module, exports) { 2731 2732/* ======================================================================== 2733 * Bootstrap: transition.js v3.4.1 2734 * https://getbootstrap.com/docs/3.4/javascript/#transitions 2735 * ======================================================================== 2736 * Copyright 2011-2019 Twitter, Inc. 2737 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2738 * ======================================================================== */ 2739 2740 2741+function ($) { 2742 'use strict'; 2743 2744 // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/) 2745 // ============================================================ 2746 2747 function transitionEnd() { 2748 var el = document.createElement('bootstrap') 2749 2750 var transEndEventNames = { 2751 WebkitTransition : 'webkitTransitionEnd', 2752 MozTransition : 'transitionend', 2753 OTransition : 'oTransitionEnd otransitionend', 2754 transition : 'transitionend' 2755 } 2756 2757 for (var name in transEndEventNames) { 2758 if (el.style[name] !== undefined) { 2759 return { end: transEndEventNames[name] } 2760 } 2761 } 2762 2763 return false // explicit for ie8 ( ._.) 2764 } 2765 2766 // https://blog.alexmaccaw.com/css-transitions 2767 $.fn.emulateTransitionEnd = function (duration) { 2768 var called = false 2769 var $el = this 2770 $(this).one('bsTransitionEnd', function () { called = true }) 2771 var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 2772 setTimeout(callback, duration) 2773 return this 2774 } 2775 2776 $(function () { 2777 $.support.transition = transitionEnd() 2778 2779 if (!$.support.transition) return 2780 2781 $.event.special.bsTransitionEnd = { 2782 bindType: $.support.transition.end, 2783 delegateType: $.support.transition.end, 2784 handle: function (e) { 2785 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 2786 } 2787 } 2788 }) 2789 2790}(jQuery); 2791 2792 2793/***/ }), 2794
vendor: 38,338 bytes, lines 2795-3847
2795/***/ "./Themes/Cynoebook/node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js": 2796/*!******************************************************************************************!*\ 2797 !*** ./Themes/Cynoebook/node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js ***! 2798 \******************************************************************************************/ 2799/*! no static exports found */ 2800/***/ (function(module, exports, __webpack_require__) { 2801 2802var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** 2803 * Ajax Autocomplete for jQuery, version 1.5.0 2804 * (c) 2017 Tomas Kirda 2805 * 2806 * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. 2807 * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete 2808 */ 2809 2810// Expose plugin as an AMD module if AMD loader is present: 2811(function (factory) { 2812 "use strict"; 2813 if (true) { 2814 // AMD. Register as an anonymous module. 2815 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./Themes/Cynoebook/node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 2816 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 2817 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 2818 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 2819 } else {} 2820})( 2821 /** 2822 * @param {jQuery} $ 2823 */ 2824 function ($) { 2825 "use strict"; 2826 2827 var utils = { 2828 escapeRegExChars: function (value) { 2829 return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); 2830 }, 2831 createNode: function (containerClass) { 2832 var div = document.createElement("div"); 2833 div.className = containerClass; 2834 div.style.position = "absolute"; 2835 div.style.display = "none"; 2836 return div; 2837 }, 2838 }, 2839 keys = { ESC: 27, TAB: 9, RETURN: 13, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40 }, 2840 noop = $.noop; 2841 2842 function Autocomplete(el, options) { 2843 var that = this; 2844 2845 // Shared variables: 2846 that.element = el; 2847 that.el = $(el); 2848 that.suggestions = []; 2849 that.badQueries = []; 2850 that.selectedIndex = -1; 2851 that.currentValue = that.element.value; 2852 that.timeoutId = null; 2853 that.cachedResponse = {}; 2854 that.onChangeTimeout = null; 2855 that.onChange = null; 2856 that.isLocal = false; 2857 that.suggestionsContainer = null; 2858 that.noSuggestionsContainer = null; 2859 that.options = $.extend(true, {}, Autocomplete.defaults, options); 2860 that.classes = { 2861 selected: "autocomplete-selected", 2862 suggestion: "autocomplete-suggestion", 2863 }; 2864 that.hint = null; 2865 that.hintValue = ""; 2866 that.selection = null; 2867 2868 // Initialize and set options: 2869 that.initialize(); 2870 that.setOptions(options); 2871 } 2872 2873 Autocomplete.utils = utils; 2874 2875 $.Autocomplete = Autocomplete; 2876 2877 Autocomplete.defaults = { 2878 ajaxSettings: {}, 2879 autoSelectFirst: false, 2880 appendTo: "body", 2881 serviceUrl: null, 2882 lookup: null, 2883 onSelect: null, 2884 onHint: null, 2885 width: "auto", 2886 minChars: 1, 2887 maxHeight: 300, 2888 deferRequestBy: 0, 2889 params: {}, 2890 formatResult: _formatResult, 2891 formatGroup: _formatGroup, 2892 delimiter: null, 2893 zIndex: 9999, 2894 type: "GET", 2895 noCache: false, 2896 onSearchStart: noop, 2897 onSearchComplete: noop, 2898 onSearchError: noop, 2899 preserveInput: false, 2900 containerClass: "autocomplete-suggestions", 2901 tabDisabled: false, 2902 dataType: "text", 2903 currentRequest: null, 2904 triggerSelectOnValidInput: true, 2905 preventBadQueries: true, 2906 lookupFilter: _lookupFilter, 2907 paramName: "query", 2908 transformResult: _transformResult, 2909 showNoSuggestionNotice: false, 2910 noSuggestionNotice: "No results", 2911 orientation: "bottom", 2912 forceFixPosition: false, 2913 }; 2914 2915 function _lookupFilter(suggestion, originalQuery, queryLowerCase) { 2916 return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1; 2917 } 2918 2919 function _transformResult(response) { 2920 return typeof response === "string" ? JSON.parse(response) : response; 2921 } 2922 2923 function _formatResult(suggestion, currentValue) { 2924 // Do not replace anything if the current value is empty 2925 if (!currentValue) { 2926 return suggestion.value; 2927 } 2928 2929 var pattern = "(" + utils.escapeRegExChars(currentValue) + ")"; 2930 2931 return suggestion.value 2932 .replace(new RegExp(pattern, "gi"), "<strong>$1</strong>") 2933 .replace(/&/g, "&") 2934 .replace(/</g, "<") 2935 .replace(/>/g, ">") 2936 .replace(/"/g, """) 2937 .replace(/<(\/?strong)>/g, "<$1>"); 2938 } 2939 2940 function _formatGroup(suggestion, category) { 2941 return '<div class="autocomplete-group">' + category + "</div>"; 2942 } 2943 2944 Autocomplete.prototype = { 2945 initialize: function () { 2946 var that = this, 2947 suggestionSelector = "." + that.classes.suggestion, 2948 selected = that.classes.selected, 2949 options = that.options, 2950 container; 2951 2952 that.element.setAttribute("autocomplete", "off"); 2953 2954 // html() deals with many types: htmlString or Element or Array or jQuery 2955 that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>') 2956 .html(this.options.noSuggestionNotice) 2957 .get(0); 2958 2959 that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass); 2960 2961 container = $(that.suggestionsContainer); 2962 2963 container.appendTo(options.appendTo || "body"); 2964 2965 // Only set width if it was provided: 2966 if (options.width !== "auto") { 2967 container.css("width", options.width); 2968 } 2969 2970 // Listen for mouse over event on suggestions list: 2971 container.on("mouseover.autocomplete", suggestionSelector, function () { 2972 that.activate($(this).data("index")); 2973 }); 2974 2975 // Deselect active element when mouse leaves suggestions container: 2976 container.on("mouseout.autocomplete", function () { 2977 that.selectedIndex = -1; 2978 container.children("." + selected).removeClass(selected); 2979 }); 2980 2981 // Listen for click event on suggestions list: 2982 container.on("click.autocomplete", suggestionSelector, function () { 2983 that.select($(this).data("index")); 2984 }); 2985 2986 container.on("click.autocomplete", function () { 2987 clearTimeout(that.blurTimeoutId); 2988 }); 2989 2990 that.fixPositionCapture = function () { 2991 if (that.visible) { 2992 that.fixPosition(); 2993 } 2994 }; 2995 2996 $(window).on("resize.autocomplete", that.fixPositionCapture); 2997 2998 that.el.on("keydown.autocomplete", function (e) { 2999 that.onKeyPress(e); 3000 }); 3001 that.el.on("keyup.autocomplete", function (e) { 3002 that.onKeyUp(e); 3003 }); 3004 that.el.on("blur.autocomplete", function () { 3005 that.onBlur(); 3006 }); 3007 that.el.on("focus.autocomplete", function () { 3008 that.onFocus(); 3009 }); 3010 that.el.on("change.autocomplete", function (e) { 3011 that.onKeyUp(e); 3012 }); 3013 that.el.on("input.autocomplete", function (e) { 3014 that.onKeyUp(e); 3015 }); 3016 }, 3017 3018 onFocus: function () { 3019 var that = this; 3020 3021 if (that.disabled) { 3022 return; 3023 } 3024 3025 that.fixPosition(); 3026 3027 if (that.el.val().length >= that.options.minChars) { 3028 that.onValueChange(); 3029 } 3030 }, 3031 3032 onBlur: function () { 3033 var that = this, 3034 options = that.options, 3035 value = that.el.val(), 3036 query = that.getQuery(value); 3037 3038 // If user clicked on a suggestion, hide() will 3039 // be canceled, otherwise close suggestions 3040 that.blurTimeoutId = setTimeout(function () { 3041 that.hide(); 3042 3043 if (that.selection && that.currentValue !== query) { 3044 (options.onInvalidateSelection || $.noop).call(that.element); 3045 } 3046 }, 200); 3047 }, 3048 3049 abortAjax: function () { 3050 var that = this; 3051 if (that.currentRequest) { 3052 that.currentRequest.abort(); 3053 that.currentRequest = null; 3054 } 3055 }, 3056 3057 setOptions: function (suppliedOptions) { 3058 var that = this, 3059 options = $.extend({}, that.options, suppliedOptions); 3060 3061 that.isLocal = Array.isArray(options.lookup); 3062 3063 if (that.isLocal) { 3064 options.lookup = that.verifySuggestionsFormat(options.lookup); 3065 } 3066 3067 options.orientation = that.validateOrientation(options.orientation, "bottom"); 3068 3069 // Adjust height, width and z-index: 3070 $(that.suggestionsContainer).css({ 3071 "max-height": options.maxHeight + "px", 3072 width: options.width + "px", 3073 "z-index": options.zIndex, 3074 }); 3075 3076 this.options = options; 3077 }, 3078 3079 clearCache: function () { 3080 this.cachedResponse = {}; 3081 this.badQueries = []; 3082 }, 3083 3084 clear: function () { 3085 this.clearCache(); 3086 this.currentValue = ""; 3087 this.suggestions = []; 3088 }, 3089 3090 disable: function () { 3091 var that = this; 3092 that.disabled = true; 3093 clearTimeout(that.onChangeTimeout); 3094 that.abortAjax(); 3095 }, 3096 3097 enable: function () { 3098 this.disabled = false; 3099 }, 3100 3101 fixPosition: function () { 3102 // Use only when container has already its content 3103 3104 var that = this, 3105 $container = $(that.suggestionsContainer), 3106 containerParent = $container.parent().get(0); 3107 // Fix position automatically when appended to body. 3108 // In other cases force parameter must be given. 3109 if (containerParent !== document.body && !that.options.forceFixPosition) { 3110 return; 3111 } 3112 3113 // Choose orientation 3114 var orientation = that.options.orientation, 3115 containerHeight = $container.outerHeight(), 3116 height = that.el.outerHeight(), 3117 offset = that.el.offset(), 3118 styles = { top: offset.top, left: offset.left }; 3119 3120 if (orientation === "auto") { 3121 var viewPortHeight = $(window).height(), 3122 scrollTop = $(window).scrollTop(), 3123 topOverflow = -scrollTop + offset.top - containerHeight, 3124 bottomOverflow = 3125 scrollTop + viewPortHeight - (offset.top + height + containerHeight); 3126 3127 orientation = 3128 Math.max(topOverflow, bottomOverflow) === topOverflow ? "top" : "bottom"; 3129 } 3130 3131 if (orientation === "top") { 3132 styles.top += -containerHeight; 3133 } else { 3134 styles.top += height; 3135 } 3136 3137 // If container is not positioned to body, 3138 // correct its position using offset parent offset 3139 if (containerParent !== document.body) { 3140 var opacity = $container.css("opacity"), 3141 parentOffsetDiff; 3142 3143 if (!that.visible) { 3144 $container.css("opacity", 0).show(); 3145 } 3146 3147 parentOffsetDiff = $container.offsetParent().offset(); 3148 styles.top -= parentOffsetDiff.top; 3149 styles.top += containerParent.scrollTop; 3150 styles.left -= parentOffsetDiff.left; 3151 3152 if (!that.visible) { 3153 $container.css("opacity", opacity).hide(); 3154 } 3155 } 3156 3157 if (that.options.width === "auto") { 3158 styles.width = that.el.outerWidth() + "px"; 3159 } 3160 3161 $container.css(styles); 3162 }, 3163 3164 isCursorAtEnd: function () { 3165 var that = this, 3166 valLength = that.el.val().length, 3167 selectionStart = that.element.selectionStart, 3168 range; 3169 3170 if (typeof selectionStart === "number") { 3171 return selectionStart === valLength; 3172 } 3173 if (document.selection) { 3174 range = document.selection.createRange(); 3175 range.moveStart("character", -valLength); 3176 return valLength === range.text.length; 3177 } 3178 return true; 3179 }, 3180 3181 onKeyPress: function (e) { 3182 var that = this; 3183 3184 // If suggestions are hidden and user presses arrow down, display suggestions: 3185 if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) { 3186 that.suggest(); 3187 return; 3188 } 3189 3190 if (that.disabled || !that.visible) { 3191 return; 3192 } 3193 3194 switch (e.which) { 3195 case keys.ESC: 3196 that.el.val(that.currentValue); 3197 that.hide(); 3198 break; 3199 case keys.RIGHT: 3200 if (that.hint && that.options.onHint && that.isCursorAtEnd()) { 3201 that.selectHint(); 3202 break; 3203 } 3204 return; 3205 case keys.TAB: 3206 if (that.hint && that.options.onHint) { 3207 that.selectHint(); 3208 return; 3209 } 3210 if (that.selectedIndex === -1) { 3211 that.hide(); 3212 return; 3213 } 3214 that.select(that.selectedIndex); 3215 if (that.options.tabDisabled === false) { 3216 return; 3217 } 3218 break; 3219 case keys.RETURN: 3220 if (that.selectedIndex === -1) { 3221 that.hide(); 3222 return; 3223 } 3224 that.select(that.selectedIndex); 3225 break; 3226 case keys.UP: 3227 that.moveUp(); 3228 break; 3229 case keys.DOWN: 3230 that.moveDown(); 3231 break; 3232 default: 3233 return; 3234 } 3235 3236 // Cancel event if function did not return: 3237 e.stopImmediatePropagation(); 3238 e.preventDefault(); 3239 }, 3240 3241 onKeyUp: function (e) { 3242 var that = this; 3243 3244 if (that.disabled) { 3245 return; 3246 } 3247 3248 switch (e.which) { 3249 case keys.UP: 3250 case keys.DOWN: 3251 return; 3252 } 3253 3254 clearTimeout(that.onChangeTimeout); 3255 3256 if (that.currentValue !== that.el.val()) { 3257 that.findBestHint(); 3258 if (that.options.deferRequestBy > 0) { 3259 // Defer lookup in case when value changes very quickly: 3260 that.onChangeTimeout = setTimeout(function () { 3261 that.onValueChange(); 3262 }, that.options.deferRequestBy); 3263 } else { 3264 that.onValueChange(); 3265 } 3266 } 3267 }, 3268 3269 onValueChange: function () { 3270 if (this.ignoreValueChange) { 3271 this.ignoreValueChange = false; 3272 return; 3273 } 3274 3275 var that = this, 3276 options = that.options, 3277 value = that.el.val(), 3278 query = that.getQuery(value); 3279 3280 if (that.selection && that.currentValue !== query) { 3281 that.selection = null; 3282 (options.onInvalidateSelection || $.noop).call(that.element); 3283 } 3284 3285 clearTimeout(that.onChangeTimeout); 3286 that.currentValue = value; 3287 that.selectedIndex = -1; 3288 3289 // Check existing suggestion for the match before proceeding: 3290 if (options.triggerSelectOnValidInput && that.isExactMatch(query)) { 3291 that.select(0); 3292 return; 3293 } 3294 3295 if (query.length < options.minChars) { 3296 that.hide(); 3297 } else { 3298 that.getSuggestions(query); 3299 } 3300 }, 3301 3302 isExactMatch: function (query) { 3303 var suggestions = this.suggestions; 3304 3305 return ( 3306 suggestions.length === 1 && 3307 suggestions[0].value.toLowerCase() === query.toLowerCase() 3308 ); 3309 }, 3310 3311 getQuery: function (value) { 3312 var delimiter = this.options.delimiter, 3313 parts; 3314 3315 if (!delimiter) { 3316 return value; 3317 } 3318 parts = value.split(delimiter); 3319 return parts[parts.length - 1].trim(); 3320 }, 3321 3322 getSuggestionsLocal: function (query) { 3323 var that = this, 3324 options = that.options, 3325 queryLowerCase = query.toLowerCase(), 3326 filter = options.lookupFilter, 3327 limit = parseInt(options.lookupLimit, 10), 3328 data; 3329 3330 data = { 3331 suggestions: $.grep(options.lookup, function (suggestion) { 3332 return filter(suggestion, query, queryLowerCase); 3333 }), 3334 }; 3335 3336 if (limit && data.suggestions.length > limit) { 3337 data.suggestions = data.suggestions.slice(0, limit); 3338 } 3339 3340 return data; 3341 }, 3342 3343 getSuggestions: function (q) { 3344 var response, 3345 that = this, 3346 options = that.options, 3347 serviceUrl = options.serviceUrl, 3348 params, 3349 cacheKey, 3350 ajaxSettings; 3351 3352 options.params[options.paramName] = q; 3353 3354 if (options.onSearchStart.call(that.element, options.params) === false) { 3355 return; 3356 } 3357 3358 params = options.ignoreParams ? null : options.params; 3359 3360 if (typeof options.lookup === "function") { 3361 options.lookup(q, function (data) { 3362 that.suggestions = data.suggestions; 3363 that.suggest(); 3364 options.onSearchComplete.call(that.element, q, data.suggestions); 3365 }); 3366 return; 3367 } 3368 3369 if (that.isLocal) { 3370 response = that.getSuggestionsLocal(q); 3371 } else { 3372 if (typeof serviceUrl === "function") { 3373 serviceUrl = serviceUrl.call(that.element, q); 3374 } 3375 cacheKey = serviceUrl + "?" + $.param(params || {}); 3376 response = that.cachedResponse[cacheKey]; 3377 } 3378 3379 if (response && Array.isArray(response.suggestions)) { 3380 that.suggestions = response.suggestions; 3381 that.suggest(); 3382 options.onSearchComplete.call(that.element, q, response.suggestions); 3383 } else if (!that.isBadQuery(q)) { 3384 that.abortAjax(); 3385 3386 ajaxSettings = { 3387 url: serviceUrl, 3388 data: params, 3389 type: options.type, 3390 dataType: options.dataType, 3391 }; 3392 3393 $.extend(ajaxSettings, options.ajaxSettings); 3394 3395 that.currentRequest = $.ajax(ajaxSettings) 3396 .done(function (data) { 3397 var result; 3398 that.currentRequest = null; 3399 result = options.transformResult(data, q); 3400 that.processResponse(result, q, cacheKey); 3401 options.onSearchComplete.call(that.element, q, result.suggestions); 3402 }) 3403 .fail(function (jqXHR, textStatus, errorThrown) { 3404 options.onSearchError.call( 3405 that.element, 3406 q, 3407 jqXHR, 3408 textStatus, 3409 errorThrown 3410 ); 3411 }); 3412 } else { 3413 options.onSearchComplete.call(that.element, q, []); 3414 } 3415 }, 3416 3417 isBadQuery: function (q) { 3418 if (!this.options.preventBadQueries) { 3419 return false; 3420 } 3421 3422 var badQueries = this.badQueries, 3423 i = badQueries.length; 3424 3425 while (i--) { 3426 if (q.indexOf(badQueries[i]) === 0) { 3427 return true; 3428 } 3429 } 3430 3431 return false; 3432 }, 3433 3434 hide: function () { 3435 var that = this, 3436 container = $(that.suggestionsContainer); 3437 3438 if (typeof that.options.onHide === "function" && that.visible) { 3439 that.options.onHide.call(that.element, container); 3440 } 3441 3442 that.visible = false; 3443 that.selectedIndex = -1; 3444 clearTimeout(that.onChangeTimeout); 3445 $(that.suggestionsContainer).hide(); 3446 that.onHint(null); 3447 }, 3448 3449 suggest: function () { 3450 if (!this.suggestions.length) { 3451 if (this.options.showNoSuggestionNotice) { 3452 this.noSuggestions(); 3453 } else { 3454 this.hide(); 3455 } 3456 return; 3457 } 3458 3459 var that = this, 3460 options = that.options, 3461 groupBy = options.groupBy, 3462 formatResult = options.formatResult, 3463 value = that.getQuery(that.currentValue), 3464 className = that.classes.suggestion, 3465 classSelected = that.classes.selected, 3466 container = $(that.suggestionsContainer), 3467 noSuggestionsContainer = $(that.noSuggestionsContainer), 3468 beforeRender = options.beforeRender, 3469 html = "", 3470 category, 3471 formatGroup = function (suggestion) { 3472 var currentCategory = suggestion.data[groupBy]; 3473 3474 if (category === currentCategory) { 3475 return ""; 3476 } 3477 3478 category = currentCategory; 3479 3480 return options.formatGroup(suggestion, category); 3481 }; 3482 3483 if (options.triggerSelectOnValidInput && that.isExactMatch(value)) { 3484 that.select(0); 3485 return; 3486 } 3487 3488 // Build suggestions inner HTML: 3489 $.each(that.suggestions, function (i, suggestion) { 3490 if (groupBy) { 3491 html += formatGroup(suggestion, value, i); 3492 } 3493 3494 html += 3495 '<div class="' + 3496 className + 3497 '" data-index="' + 3498 i + 3499 '">' + 3500 formatResult(suggestion, value, i) + 3501 "</div>"; 3502 }); 3503 3504 this.adjustContainerWidth(); 3505 3506 noSuggestionsContainer.detach(); 3507 container.html(html); 3508 3509 if (typeof beforeRender === "function") { 3510 beforeRender.call(that.element, container, that.suggestions); 3511 } 3512 3513 that.fixPosition(); 3514 container.show(); 3515 3516 // Select first value by default: 3517 if (options.autoSelectFirst) { 3518 that.selectedIndex = 0; 3519 container.scrollTop(0); 3520 container 3521 .children("." + className) 3522 .first() 3523 .addClass(classSelected); 3524 } 3525 3526 that.visible = true; 3527 that.findBestHint(); 3528 }, 3529 3530 noSuggestions: function () { 3531 var that = this, 3532 beforeRender = that.options.beforeRender, 3533 container = $(that.suggestionsContainer), 3534 noSuggestionsContainer = $(that.noSuggestionsContainer); 3535 3536 this.adjustContainerWidth(); 3537 3538 // Some explicit steps. Be careful here as it easy to get 3539 // noSuggestionsContainer removed from DOM if not detached properly. 3540 noSuggestionsContainer.detach(); 3541 3542 // clean suggestions if any 3543 container.empty(); 3544 container.append(noSuggestionsContainer); 3545 3546 if (typeof beforeRender === "function") { 3547 beforeRender.call(that.element, container, that.suggestions); 3548 } 3549 3550 that.fixPosition(); 3551 3552 container.show(); 3553 that.visible = true; 3554 }, 3555 3556 adjustContainerWidth: function () { 3557 var that = this, 3558 options = that.options, 3559 width, 3560 container = $(that.suggestionsContainer); 3561 3562 // If width is auto, adjust width before displaying suggestions, 3563 // because if instance was created before input had width, it will be zero. 3564 // Also it adjusts if input width has changed. 3565 if (options.width === "auto") { 3566 width = that.el.outerWidth(); 3567 container.css("width", width > 0 ? width : 300); 3568 } else if (options.width === "flex") { 3569 // Trust the source! Unset the width property so it will be the max length 3570 // the containing elements. 3571 container.css("width", ""); 3572 } 3573 }, 3574 3575 findBestHint: function () { 3576 var that = this, 3577 value = that.el.val().toLowerCase(), 3578 bestMatch = null; 3579 3580 if (!value) { 3581 return; 3582 } 3583 3584 $.each(that.suggestions, function (i, suggestion) { 3585 var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0; 3586 if (foundMatch) { 3587 bestMatch = suggestion; 3588 } 3589 return !foundMatch; 3590 }); 3591 3592 that.onHint(bestMatch); 3593 }, 3594 3595 onHint: function (suggestion) { 3596 var that = this, 3597 onHintCallback = that.options.onHint, 3598 hintValue = ""; 3599 3600 if (suggestion) { 3601 hintValue = 3602 that.currentValue + suggestion.value.substr(that.currentValue.length); 3603 } 3604 if (that.hintValue !== hintValue) { 3605 that.hintValue = hintValue; 3606 that.hint = suggestion; 3607 if (typeof onHintCallback === "function") { 3608 onHintCallback.call(that.element, hintValue); 3609 } 3610 } 3611 }, 3612 3613 verifySuggestionsFormat: function (suggestions) { 3614 // If suggestions is string array, convert them to supported format: 3615 if (suggestions.length && typeof suggestions[0] === "string") { 3616 return $.map(suggestions, function (value) { 3617 return { value: value, data: null }; 3618 }); 3619 } 3620 3621 return suggestions; 3622 }, 3623 3624 validateOrientation: function (orientation, fallback) { 3625 orientation = (orientation || "").trim().toLowerCase(); 3626 3627 if ($.inArray(orientation, ["auto", "bottom", "top"]) === -1) { 3628 orientation = fallback; 3629 } 3630 3631 return orientation; 3632 }, 3633 3634 processResponse: function (result, originalQuery, cacheKey) { 3635 var that = this, 3636 options = that.options; 3637 3638 result.suggestions = that.verifySuggestionsFormat(result.suggestions); 3639 3640 // Cache results if cache is not disabled: 3641 if (!options.noCache) { 3642 that.cachedResponse[cacheKey] = result; 3643 if (options.preventBadQueries && !result.suggestions.length) { 3644 that.badQueries.push(originalQuery); 3645 } 3646 } 3647 3648 // Return if originalQuery is not matching current query: 3649 if (originalQuery !== that.getQuery(that.currentValue)) { 3650 return; 3651 } 3652 3653 that.suggestions = result.suggestions; 3654 that.suggest(); 3655 }, 3656 3657 activate: function (index) { 3658 var that = this, 3659 activeItem, 3660 selected = that.classes.selected, 3661 container = $(that.suggestionsContainer), 3662 children = container.find("." + that.classes.suggestion); 3663 3664 container.find("." + selected).removeClass(selected); 3665 3666 that.selectedIndex = index; 3667 3668 if (that.selectedIndex !== -1 && children.length > that.selectedIndex) { 3669 activeItem = children.get(that.selectedIndex); 3670 $(activeItem).addClass(selected); 3671 return activeItem; 3672 } 3673 3674 return null; 3675 }, 3676 3677 selectHint: function () { 3678 var that = this, 3679 i = $.inArray(that.hint, that.suggestions); 3680 3681 that.select(i); 3682 }, 3683 3684 select: function (i) { 3685 var that = this; 3686 that.hide(); 3687 that.onSelect(i); 3688 }, 3689 3690 moveUp: function () { 3691 var that = this; 3692 3693 if (that.selectedIndex === -1) { 3694 return; 3695 } 3696 3697 if (that.selectedIndex === 0) { 3698 $(that.suggestionsContainer) 3699 .children("." + that.classes.suggestion) 3700 .first() 3701 .removeClass(that.classes.selected); 3702 that.selectedIndex = -1; 3703 that.ignoreValueChange = false; 3704 that.el.val(that.currentValue); 3705 that.findBestHint(); 3706 return; 3707 } 3708 3709 that.adjustScroll(that.selectedIndex - 1); 3710 }, 3711 3712 moveDown: function () { 3713 var that = this; 3714 3715 if (that.selectedIndex === that.suggestions.length - 1) { 3716 return; 3717 } 3718 3719 that.adjustScroll(that.selectedIndex + 1); 3720 }, 3721 3722 adjustScroll: function (index) { 3723 var that = this, 3724 activeItem = that.activate(index); 3725 3726 if (!activeItem) { 3727 return; 3728 } 3729 3730 var offsetTop, 3731 upperBound, 3732 lowerBound, 3733 heightDelta = $(activeItem).outerHeight(); 3734 3735 offsetTop = activeItem.offsetTop; 3736 upperBound = $(that.suggestionsContainer).scrollTop(); 3737 lowerBound = upperBound + that.options.maxHeight - heightDelta; 3738 3739 if (offsetTop < upperBound) { 3740 $(that.suggestionsContainer).scrollTop(offsetTop); 3741 } else if (offsetTop > lowerBound) { 3742 $(that.suggestionsContainer).scrollTop( 3743 offsetTop - that.options.maxHeight + heightDelta 3744 ); 3745 } 3746 3747 if (!that.options.preserveInput) { 3748 // During onBlur event, browser will trigger "change" event, 3749 // because value has changed, to avoid side effect ignore, 3750 // that event, so that correct suggestion can be selected 3751 // when clicking on suggestion with a mouse 3752 that.ignoreValueChange = true; 3753 that.el.val(that.getValue(that.suggestions[index].value)); 3754 } 3755 3756 that.onHint(null); 3757 }, 3758 3759 onSelect: function (index) { 3760 var that = this, 3761 onSelectCallback = that.options.onSelect, 3762 suggestion = that.suggestions[index]; 3763 3764 that.currentValue = that.getValue(suggestion.value); 3765 3766 if (that.currentValue !== that.el.val() && !that.options.preserveInput) { 3767 that.el.val(that.currentValue); 3768 } 3769 3770 that.onHint(null); 3771 that.suggestions = []; 3772 that.selection = suggestion; 3773 3774 if (typeof onSelectCallback === "function") { 3775 onSelectCallback.call(that.element, suggestion); 3776 } 3777 }, 3778 3779 getValue: function (value) { 3780 var that = this, 3781 delimiter = that.options.delimiter, 3782 currentValue, 3783 parts; 3784 3785 if (!delimiter) { 3786 return value; 3787 } 3788 3789 currentValue = that.currentValue; 3790 parts = currentValue.split(delimiter); 3791 3792 if (parts.length === 1) { 3793 return value; 3794 } 3795 3796 return ( 3797 currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + 3798 value 3799 ); 3800 }, 3801 3802 dispose: function () { 3803 var that = this; 3804 that.el.off(".autocomplete").removeData("autocomplete"); 3805 $(window).off("resize.autocomplete", that.fixPositionCapture); 3806 $(that.suggestionsContainer).remove(); 3807 }, 3808 }; 3809 3810 // Create chainable jQuery plugin: 3811 $.fn.devbridgeAutocomplete = function (options, args) { 3812 var dataKey = "autocomplete"; 3813 // If function invoked without argument return 3814 // instance of the first matched element: 3815 if (!arguments.length) { 3816 return this.first().data(dataKey); 3817 } 3818 3819 return this.each(function () { 3820 var inputElement = $(this), 3821 instance = inputElement.data(dataKey); 3822 3823 if (typeof options === "string") { 3824 if (instance && typeof instance[options] === "function") { 3825 instance[options](args); 3826 } 3827 } else { 3828 // If instance already exists, destroy it: 3829 if (instance && instance.dispose) { 3830 instance.dispose(); 3831 } 3832 instance = new Autocomplete(this, options); 3833 inputElement.data(dataKey, instance); 3834 } 3835 }); 3836 }; 3837 3838 // Don't overwrite if it already exists 3839 if (!$.fn.autocomplete) { 3840 $.fn.autocomplete = $.fn.devbridgeAutocomplete; 3841 } 3842 } 3843); 3844 3845 3846/***/ }), 3847
vendor: 14,243 bytes, lines 3848-4332
3848/***/ "./Themes/Cynoebook/node_modules/jquery-slimscroll/jquery.slimscroll.js": 3849/*!******************************************************************************!*\ 3850 !*** ./Themes/Cynoebook/node_modules/jquery-slimscroll/jquery.slimscroll.js ***! 3851 \******************************************************************************/ 3852/*! no static exports found */ 3853/***/ (function(module, exports) { 3854 3855/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la) 3856 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 3857 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 3858 * 3859 * Version: 1.3.8 3860 * 3861 */ 3862(function($) { 3863 3864 $.fn.extend({ 3865 slimScroll: function(options) { 3866 3867 var defaults = { 3868 3869 // width in pixels of the visible scroll area 3870 width : 'auto', 3871 3872 // height in pixels of the visible scroll area 3873 height : '250px', 3874 3875 // width in pixels of the scrollbar and rail 3876 size : '7px', 3877 3878 // scrollbar color, accepts any hex/color value 3879 color: '#000', 3880 3881 // scrollbar position - left/right 3882 position : 'right', 3883 3884 // distance in pixels between the side edge and the scrollbar 3885 distance : '1px', 3886 3887 // default scroll position on load - top / bottom / $('selector') 3888 start : 'top', 3889 3890 // sets scrollbar opacity 3891 opacity : .4, 3892 3893 // enables always-on mode for the scrollbar 3894 alwaysVisible : false, 3895 3896 // check if we should hide the scrollbar when user is hovering over 3897 disableFadeOut : false, 3898 3899 // sets visibility of the rail 3900 railVisible : false, 3901 3902 // sets rail color 3903 railColor : '#333', 3904 3905 // sets rail opacity 3906 railOpacity : .2, 3907 3908 // whether we should use jQuery UI Draggable to enable bar dragging 3909 railDraggable : true, 3910 3911 // defautlt CSS class of the slimscroll rail 3912 railClass : 'slimScrollRail', 3913 3914 // defautlt CSS class of the slimscroll bar 3915 barClass : 'slimScrollBar', 3916 3917 // defautlt CSS class of the slimscroll wrapper 3918 wrapperClass : 'slimScrollDiv', 3919 3920 // check if mousewheel should scroll the window if we reach top/bottom 3921 allowPageScroll : false, 3922 3923 // scroll amount applied to each mouse wheel step 3924 wheelStep : 20, 3925 3926 // scroll amount applied when user is using gestures 3927 touchScrollStep : 200, 3928 3929 // sets border radius 3930 borderRadius: '7px', 3931 3932 // sets border radius of the rail 3933 railBorderRadius : '7px' 3934 }; 3935 3936 var o = $.extend(defaults, options); 3937 3938 // do it for every element that matches selector 3939 this.each(function(){ 3940 3941 var isOverPanel, isOverBar, isDragg, queueHide, touchDif, 3942 barHeight, percentScroll, lastScroll, 3943 divS = '<div></div>', 3944 minBarHeight = 30, 3945 releaseScroll = false; 3946 3947 // used in event handlers and for better minification 3948 var me = $(this); 3949 3950 // ensure we are not binding it again 3951 if (me.parent().hasClass(o.wrapperClass)) 3952 { 3953 // start from last bar position 3954 var offset = me.scrollTop(); 3955 3956 // find bar and rail 3957 bar = me.siblings('.' + o.barClass); 3958 rail = me.siblings('.' + o.railClass); 3959 3960 getBarHeight(); 3961 3962 // check if we should scroll existing instance 3963 if ($.isPlainObject(options)) 3964 { 3965 // Pass height: auto to an existing slimscroll object to force a resize after contents have changed 3966 if ( 'height' in options && options.height == 'auto' ) { 3967 me.parent().css('height', 'auto'); 3968 me.css('height', 'auto'); 3969 var height = me.parent().parent().height(); 3970 me.parent().css('height', height); 3971 me.css('height', height); 3972 } else if ('height' in options) { 3973 var h = options.height; 3974 me.parent().css('height', h); 3975 me.css('height', h); 3976 } 3977 3978 if ('scrollTo' in options) 3979 { 3980 // jump to a static point 3981 offset = parseInt(o.scrollTo); 3982 } 3983 else if ('scrollBy' in options) 3984 { 3985 // jump by value pixels 3986 offset += parseInt(o.scrollBy); 3987 } 3988 else if ('destroy' in options) 3989 { 3990 // remove slimscroll elements 3991 bar.remove(); 3992 rail.remove(); 3993 me.unwrap(); 3994 return; 3995 } 3996 3997 // scroll content by the given offset 3998 scrollContent(offset, false, true); 3999 } 4000 4001 return; 4002 } 4003 else if ($.isPlainObject(options)) 4004 { 4005 if ('destroy' in options) 4006 { 4007 return; 4008 } 4009 } 4010 4011 // optionally set height to the parent's height 4012 o.height = (o.height == 'auto') ? me.parent().height() : o.height; 4013 4014 // wrap content 4015 var wrapper = $(divS) 4016 .addClass(o.wrapperClass) 4017 .css({ 4018 position: 'relative', 4019 overflow: 'hidden', 4020 width: o.width, 4021 height: o.height 4022 }); 4023 4024 // update style for the div 4025 me.css({ 4026 overflow: 'hidden', 4027 width: o.width, 4028 height: o.height 4029 }); 4030 4031 // create scrollbar rail 4032 var rail = $(divS) 4033 .addClass(o.railClass) 4034 .css({ 4035 width: o.size, 4036 height: '100%', 4037 position: 'absolute', 4038 top: 0, 4039 display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none', 4040 'border-radius': o.railBorderRadius, 4041 background: o.railColor, 4042 opacity: o.railOpacity, 4043 zIndex: 90 4044 }); 4045 4046 // create scrollbar 4047 var bar = $(divS) 4048 .addClass(o.barClass) 4049 .css({ 4050 background: o.color, 4051 width: o.size, 4052 position: 'absolute', 4053 top: 0, 4054 opacity: o.opacity, 4055 display: o.alwaysVisible ? 'block' : 'none', 4056 'border-radius' : o.borderRadius, 4057 BorderRadius: o.borderRadius, 4058 MozBorderRadius: o.borderRadius, 4059 WebkitBorderRadius: o.borderRadius, 4060 zIndex: 99 4061 }); 4062 4063 // set position 4064 var posCss = (o.position == 'right') ? { right: o.distance } : { left: o.distance }; 4065 rail.css(posCss); 4066 bar.css(posCss); 4067 4068 // wrap it 4069 me.wrap(wrapper); 4070 4071 // append to parent div 4072 me.parent().append(bar); 4073 me.parent().append(rail); 4074 4075 // make it draggable and no longer dependent on the jqueryUI 4076 if (o.railDraggable){ 4077 bar.bind("mousedown", function(e) { 4078 var $doc = $(document); 4079 isDragg = true; 4080 t = parseFloat(bar.css('top')); 4081 pageY = e.pageY; 4082 4083 $doc.bind("mousemove.slimscroll", function(e){ 4084 currTop = t + e.pageY - pageY; 4085 bar.css('top', currTop); 4086 scrollContent(0, bar.position().top, false);// scroll content 4087 }); 4088 4089 $doc.bind("mouseup.slimscroll", function(e) { 4090 isDragg = false;hideBar(); 4091 $doc.unbind('.slimscroll'); 4092 }); 4093 return false; 4094 }).bind("selectstart.slimscroll", function(e){ 4095 e.stopPropagation(); 4096 e.preventDefault(); 4097 return false; 4098 }); 4099 } 4100 4101 // on rail over 4102 rail.hover(function(){ 4103 showBar(); 4104 }, function(){ 4105 hideBar(); 4106 }); 4107 4108 // on bar over 4109 bar.hover(function(){ 4110 isOverBar = true; 4111 }, function(){ 4112 isOverBar = false; 4113 }); 4114 4115 // show on parent mouseover 4116 me.hover(function(){ 4117 isOverPanel = true; 4118 showBar(); 4119 hideBar(); 4120 }, function(){ 4121 isOverPanel = false; 4122 hideBar(); 4123 }); 4124 4125 // support for mobile 4126 me.bind('touchstart', function(e,b){ 4127 if (e.originalEvent.touches.length) 4128 { 4129 // record where touch started 4130 touchDif = e.originalEvent.touches[0].pageY; 4131 } 4132 }); 4133 4134 me.bind('touchmove', function(e){ 4135 // prevent scrolling the page if necessary 4136 if(!releaseScroll) 4137 { 4138 e.originalEvent.preventDefault(); 4139 } 4140 if (e.originalEvent.touches.length) 4141 { 4142 // see how far user swiped 4143 var diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep; 4144 // scroll content 4145 scrollContent(diff, true); 4146 touchDif = e.originalEvent.touches[0].pageY; 4147 } 4148 }); 4149 4150 // set up initial height 4151 getBarHeight(); 4152 4153 // check start position 4154 if (o.start === 'bottom') 4155 { 4156 // scroll content to bottom 4157 bar.css({ top: me.outerHeight() - bar.outerHeight() }); 4158 scrollContent(0, true); 4159 } 4160 else if (o.start !== 'top') 4161 { 4162 // assume jQuery selector 4163 scrollContent($(o.start).position().top, null, true); 4164 4165 // make sure bar stays hidden 4166 if (!o.alwaysVisible) { bar.hide(); } 4167 } 4168 4169 // attach scroll events 4170 attachWheel(this); 4171 4172 function _onWheel(e) 4173 { 4174 // use mouse wheel only when mouse is over 4175 if (!isOverPanel) { return; } 4176 4177 var e = e || window.event; 4178 4179 var delta = 0; 4180 if (e.wheelDelta) { delta = -e.wheelDelta/120; } 4181 if (e.detail) { delta = e.detail / 3; } 4182 4183 var target = e.target || e.srcTarget || e.srcElement; 4184 if ($(target).closest('.' + o.wrapperClass).is(me.parent())) { 4185 // scroll content 4186 scrollContent(delta, true); 4187 } 4188 4189 // stop window scroll 4190 if (e.preventDefault && !releaseScroll) { e.preventDefault(); } 4191 if (!releaseScroll) { e.returnValue = false; } 4192 } 4193 4194 function scrollContent(y, isWheel, isJump) 4195 { 4196 releaseScroll = false; 4197 var delta = y; 4198 var maxTop = me.outerHeight() - bar.outerHeight(); 4199 4200 if (isWheel) 4201 { 4202 // move bar with mouse wheel 4203 delta = parseInt(bar.css('top')) + y * parseInt(o.wheelStep) / 100 * bar.outerHeight(); 4204 4205 // move bar, make sure it doesn't go out 4206 delta = Math.min(Math.max(delta, 0), maxTop); 4207 4208 // if scrolling down, make sure a fractional change to the 4209 // scroll position isn't rounded away when the scrollbar's CSS is set 4210 // this flooring of delta would happened automatically when 4211 // bar.css is set below, but we floor here for clarity 4212 delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta); 4213 4214 // scroll the scrollbar 4215 bar.css({ top: delta + 'px' }); 4216 } 4217 4218 // calculate actual scroll amount 4219 percentScroll = parseInt(bar.css('top')) / (me.outerHeight() - bar.outerHeight()); 4220 delta = percentScroll * (me[0].scrollHeight - me.outerHeight()); 4221 4222 if (isJump) 4223 { 4224 delta = y; 4225 var offsetTop = delta / me[0].scrollHeight * me.outerHeight(); 4226 offsetTop = Math.min(Math.max(offsetTop, 0), maxTop); 4227 bar.css({ top: offsetTop + 'px' }); 4228 } 4229 4230 // scroll content 4231 me.scrollTop(delta); 4232 4233 // fire scrolling event 4234 me.trigger('slimscrolling', ~~delta); 4235 4236 // ensure bar is visible 4237 showBar(); 4238 4239 // trigger hide when scroll is stopped 4240 hideBar(); 4241 } 4242 4243 function attachWheel(target) 4244 { 4245 if (window.addEventListener) 4246 { 4247 target.addEventListener('DOMMouseScroll', _onWheel, false ); 4248 target.addEventListener('mousewheel', _onWheel, false ); 4249 } 4250 else 4251 { 4252 document.attachEvent("onmousewheel", _onWheel) 4253 } 4254 } 4255 4256 function getBarHeight() 4257 { 4258 // calculate scrollbar height and make sure it is not too small 4259 barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight); 4260 bar.css({ height: barHeight + 'px' }); 4261 4262 // hide scrollbar if content is not long enough 4263 var display = barHeight == me.outerHeight() ? 'none' : 'block'; 4264 bar.css({ display: display }); 4265 } 4266 4267 function showBar() 4268 { 4269 // recalculate bar height 4270 getBarHeight(); 4271 clearTimeout(queueHide); 4272 4273 // when bar reached top or bottom 4274 if (percentScroll == ~~percentScroll) 4275 { 4276 //release wheel 4277 releaseScroll = o.allowPageScroll; 4278 4279 // publish approporiate event 4280 if (lastScroll != percentScroll) 4281 { 4282 var msg = (~~percentScroll == 0) ? 'top' : 'bottom'; 4283 me.trigger('slimscroll', msg); 4284 } 4285 } 4286 else 4287 { 4288 releaseScroll = false; 4289 } 4290 lastScroll = percentScroll; 4291 4292 // show only when required 4293 if(barHeight >= me.outerHeight()) { 4294 //allow window scroll 4295 releaseScroll = true; 4296 return; 4297 } 4298 bar.stop(true,true).fadeIn('fast'); 4299 if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); } 4300 } 4301 4302 function hideBar() 4303 { 4304 // only hide when options allow it 4305 if (!o.alwaysVisible) 4306 { 4307 queueHide = setTimeout(function(){ 4308 if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg) 4309 { 4310 bar.fadeOut('slow'); 4311 rail.fadeOut('slow'); 4312 } 4313 }, 1000); 4314 } 4315 } 4316 4317 }); 4318 4319 // maintain chainability 4320 return this; 4321 } 4322 }); 4323 4324 $.fn.extend({ 4325 slimscroll: $.fn.slimScroll 4326 }); 4327 4328})(jQuery); 4329 4330 4331/***/ }), 4332
vendor: 4,620 bytes, lines 4333-4506
4333/***/ "./Themes/Cynoebook/node_modules/jquery.easing/jquery.easing.js": 4334/*!**********************************************************************!*\ 4335 !*** ./Themes/Cynoebook/node_modules/jquery.easing/jquery.easing.js ***! 4336 \**********************************************************************/ 4337/*! no static exports found */ 4338/***/ (function(module, exports, __webpack_require__) { 4339 4340var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* 4341 * jQuery Easing v1.4.1 - http://gsgd.co.uk/sandbox/jquery/easing/ 4342 * Open source under the BSD License. 4343 * Copyright © 2008 George McGinley Smith 4344 * All rights reserved. 4345 * https://raw.github.com/gdsmith/jquery-easing/master/LICENSE 4346*/ 4347 4348(function (factory) { 4349 if (true) { 4350 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./Themes/Cynoebook/node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($) { 4351 return factory($); 4352 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 4353 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 4354 } else {} 4355})(function($){ 4356 4357// Preserve the original jQuery "swing" easing as "jswing" 4358$.easing.jswing = $.easing.swing; 4359 4360var pow = Math.pow, 4361 sqrt = Math.sqrt, 4362 sin = Math.sin, 4363 cos = Math.cos, 4364 PI = Math.PI, 4365 c1 = 1.70158, 4366 c2 = c1 * 1.525, 4367 c3 = c1 + 1, 4368 c4 = ( 2 * PI ) / 3, 4369 c5 = ( 2 * PI ) / 4.5; 4370 4371// x is the fraction of animation progress, in the range 0..1 4372function bounceOut(x) { 4373 var n1 = 7.5625, 4374 d1 = 2.75; 4375 if ( x < 1/d1 ) { 4376 return n1*x*x; 4377 } else if ( x < 2/d1 ) { 4378 return n1*(x-=(1.5/d1))*x + 0.75; 4379 } else if ( x < 2.5/d1 ) { 4380 return n1*(x-=(2.25/d1))*x + 0.9375; 4381 } else { 4382 return n1*(x-=(2.625/d1))*x + 0.984375; 4383 } 4384} 4385 4386$.extend( $.easing, 4387{ 4388 def: 'easeOutQuad', 4389 swing: function (x) { 4390 return $.easing[$.easing.def](x); 4391 }, 4392 easeInQuad: function (x) { 4393 return x * x; 4394 }, 4395 easeOutQuad: function (x) { 4396 return 1 - ( 1 - x ) * ( 1 - x ); 4397 }, 4398 easeInOutQuad: function (x) { 4399 return x < 0.5 ? 4400 2 * x * x : 4401 1 - pow( -2 * x + 2, 2 ) / 2; 4402 }, 4403 easeInCubic: function (x) { 4404 return x * x * x; 4405 }, 4406 easeOutCubic: function (x) { 4407 return 1 - pow( 1 - x, 3 ); 4408 }, 4409 easeInOutCubic: function (x) { 4410 return x < 0.5 ? 4411 4 * x * x * x : 4412 1 - pow( -2 * x + 2, 3 ) / 2; 4413 }, 4414 easeInQuart: function (x) { 4415 return x * x * x * x; 4416 }, 4417 easeOutQuart: function (x) { 4418 return 1 - pow( 1 - x, 4 ); 4419 }, 4420 easeInOutQuart: function (x) { 4421 return x < 0.5 ? 4422 8 * x * x * x * x : 4423 1 - pow( -2 * x + 2, 4 ) / 2; 4424 }, 4425 easeInQuint: function (x) { 4426 return x * x * x * x * x; 4427 }, 4428 easeOutQuint: function (x) { 4429 return 1 - pow( 1 - x, 5 ); 4430 }, 4431 easeInOutQuint: function (x) { 4432 return x < 0.5 ? 4433 16 * x * x * x * x * x : 4434 1 - pow( -2 * x + 2, 5 ) / 2; 4435 }, 4436 easeInSine: function (x) { 4437 return 1 - cos( x * PI/2 ); 4438 }, 4439 easeOutSine: function (x) { 4440 return sin( x * PI/2 ); 4441 }, 4442 easeInOutSine: function (x) { 4443 return -( cos( PI * x ) - 1 ) / 2; 4444 }, 4445 easeInExpo: function (x) { 4446 return x === 0 ? 0 : pow( 2, 10 * x - 10 ); 4447 }, 4448 easeOutExpo: function (x) { 4449 return x === 1 ? 1 : 1 - pow( 2, -10 * x ); 4450 }, 4451 easeInOutExpo: function (x) { 4452 return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? 4453 pow( 2, 20 * x - 10 ) / 2 : 4454 ( 2 - pow( 2, -20 * x + 10 ) ) / 2; 4455 }, 4456 easeInCirc: function (x) { 4457 return 1 - sqrt( 1 - pow( x, 2 ) ); 4458 }, 4459 easeOutCirc: function (x) { 4460 return sqrt( 1 - pow( x - 1, 2 ) ); 4461 }, 4462 easeInOutCirc: function (x) { 4463 return x < 0.5 ? 4464 ( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 : 4465 ( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2; 4466 }, 4467 easeInElastic: function (x) { 4468 return x === 0 ? 0 : x === 1 ? 1 : 4469 -pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 ); 4470 }, 4471 easeOutElastic: function (x) { 4472 return x === 0 ? 0 : x === 1 ? 1 : 4473 pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1; 4474 }, 4475 easeInOutElastic: function (x) { 4476 return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? 4477 -( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 : 4478 pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1; 4479 }, 4480 easeInBack: function (x) { 4481 return c3 * x * x * x - c1 * x * x; 4482 }, 4483 easeOutBack: function (x) { 4484 return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 ); 4485 }, 4486 easeInOutBack: function (x) { 4487 return x < 0.5 ? 4488 ( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 : 4489 ( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2; 4490 }, 4491 easeInBounce: function (x) { 4492 return 1 - bounceOut( 1 - x ); 4493 }, 4494 easeOutBounce: bounceOut, 4495 easeInOutBounce: function (x) { 4496 return x < 0.5 ? 4497 ( 1 - bounceOut( 1 - 2 * x ) ) / 2 : 4498 ( 1 + bounceOut( 2 * x - 1 ) ) / 2; 4499 } 4500}); 4501 4502}); 4503 4504 4505/***/ }), 4506
vendor: 285,877 bytes, lines 4507-15234
4507/***/ "./Themes/Cynoebook/node_modules/jquery/dist/jquery.js": 4508/*!*************************************************************!*\ 4509 !*** ./Themes/Cynoebook/node_modules/jquery/dist/jquery.js ***! 4510 \*************************************************************/ 4511/*! no static exports found */ 4512/***/ (function(module, exports, __webpack_require__) { 4513 4514var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 4515 * jQuery JavaScript Library v3.7.1 4516 * https://jquery.com/ 4517 * 4518 * Copyright OpenJS Foundation and other contributors 4519 * Released under the MIT license 4520 * https://jquery.org/license 4521 * 4522 * Date: 2023-08-28T13:37Z 4523 */ 4524( function( global, factory ) { 4525 4526 "use strict"; 4527 4528 if ( true && typeof module.exports === "object" ) { 4529 4530 // For CommonJS and CommonJS-like environments where a proper `window` 4531 // is present, execute the factory and get jQuery. 4532 // For environments that do not have a `window` with a `document` 4533 // (such as Node.js), expose a factory as module.exports. 4534 // This accentuates the need for the creation of a real `window`. 4535 // e.g. var jQuery = require("jquery")(window); 4536 // See ticket trac-14549 for more info. 4537 module.exports = global.document ? 4538 factory( global, true ) : 4539 function( w ) { 4540 if ( !w.document ) { 4541 throw new Error( "jQuery requires a window with a document" ); 4542 } 4543 return factory( w ); 4544 }; 4545 } else { 4546 factory( global ); 4547 } 4548 4549// Pass this if window is not defined yet 4550} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 4551 4552// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 4553// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 4554// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 4555// enough that all such attempts are guarded in a try block. 4556"use strict"; 4557 4558var arr = []; 4559 4560var getProto = Object.getPrototypeOf; 4561 4562var slice = arr.slice; 4563 4564var flat = arr.flat ? function( array ) { 4565 return arr.flat.call( array ); 4566} : function( array ) { 4567 return arr.concat.apply( [], array ); 4568}; 4569 4570 4571var push = arr.push; 4572 4573var indexOf = arr.indexOf; 4574 4575var class2type = {}; 4576 4577var toString = class2type.toString; 4578 4579var hasOwn = class2type.hasOwnProperty; 4580 4581var fnToString = hasOwn.toString; 4582 4583var ObjectFunctionString = fnToString.call( Object ); 4584 4585var support = {}; 4586 4587var isFunction = function isFunction( obj ) { 4588 4589 // Support: Chrome <=57, Firefox <=52 4590 // In some browsers, typeof returns "function" for HTML <object> elements 4591 // (i.e., `typeof document.createElement( "object" ) === "function"`). 4592 // We don't want to classify *any* DOM node as a function. 4593 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 4594 // Plus for old WebKit, typeof returns "function" for HTML collections 4595 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 4596 return typeof obj === "function" && typeof obj.nodeType !== "number" && 4597 typeof obj.item !== "function"; 4598 }; 4599 4600 4601var isWindow = function isWindow( obj ) { 4602 return obj != null && obj === obj.window; 4603 }; 4604 4605 4606var document = window.document; 4607 4608 4609 4610 var preservedScriptAttributes = { 4611 type: true, 4612 src: true, 4613 nonce: true, 4614 noModule: true 4615 }; 4616 4617 function DOMEval( code, node, doc ) { 4618 doc = doc || document; 4619 4620 var i, val, 4621 script = doc.createElement( "script" ); 4622 4623 script.text = code; 4624 if ( node ) { 4625 for ( i in preservedScriptAttributes ) { 4626 4627 // Support: Firefox 64+, Edge 18+ 4628 // Some browsers don't support the "nonce" property on scripts. 4629 // On the other hand, just using `getAttribute` is not enough as 4630 // the `nonce` attribute is reset to an empty string whenever it 4631 // becomes browsing-context connected. 4632 // See https://github.com/whatwg/html/issues/2369 4633 // See https://html.spec.whatwg.org/#nonce-attributes 4634 // The `node.getAttribute` check was added for the sake of 4635 // `jQuery.globalEval` so that it can fake a nonce-containing node 4636 // via an object. 4637 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 4638 if ( val ) { 4639 script.setAttribute( i, val ); 4640 } 4641 } 4642 } 4643 doc.head.appendChild( script ).parentNode.removeChild( script ); 4644 } 4645 4646 4647function toType( obj ) { 4648 if ( obj == null ) { 4649 return obj + ""; 4650 } 4651 4652 // Support: Android <=2.3 only (functionish RegExp) 4653 return typeof obj === "object" || typeof obj === "function" ? 4654 class2type[ toString.call( obj ) ] || "object" : 4655 typeof obj; 4656} 4657/* global Symbol */ 4658// Defining this global in .eslintrc.json would create a danger of using the global 4659// unguarded in another place, it seems safer to define global only for this module 4660 4661 4662 4663var version = "3.7.1", 4664 4665 rhtmlSuffix = /HTML$/i, 4666 4667 // Define a local copy of jQuery 4668 jQuery = function( selector, context ) { 4669 4670 // The jQuery object is actually just the init constructor 'enhanced' 4671 // Need init if jQuery is called (just allow error to be thrown if not included) 4672 return new jQuery.fn.init( selector, context ); 4673 }; 4674 4675jQuery.fn = jQuery.prototype = { 4676 4677 // The current version of jQuery being used 4678 jquery: version, 4679 4680 constructor: jQuery, 4681 4682 // The default length of a jQuery object is 0 4683 length: 0, 4684 4685 toArray: function() { 4686 return slice.call( this ); 4687 }, 4688 4689 // Get the Nth element in the matched element set OR 4690 // Get the whole matched element set as a clean array 4691 get: function( num ) { 4692 4693 // Return all the elements in a clean array 4694 if ( num == null ) { 4695 return slice.call( this ); 4696 } 4697 4698 // Return just the one element from the set 4699 return num < 0 ? this[ num + this.length ] : this[ num ]; 4700 }, 4701 4702 // Take an array of elements and push it onto the stack 4703 // (returning the new matched element set) 4704 pushStack: function( elems ) { 4705 4706 // Build a new jQuery matched element set 4707 var ret = jQuery.merge( this.constructor(), elems ); 4708 4709 // Add the old object onto the stack (as a reference) 4710 ret.prevObject = this; 4711 4712 // Return the newly-formed element set 4713 return ret; 4714 }, 4715 4716 // Execute a callback for every element in the matched set. 4717 each: function( callback ) { 4718 return jQuery.each( this, callback ); 4719 }, 4720 4721 map: function( callback ) { 4722 return this.pushStack( jQuery.map( this, function( elem, i ) { 4723 return callback.call( elem, i, elem ); 4724 } ) ); 4725 }, 4726 4727 slice: function() { 4728 return this.pushStack( slice.apply( this, arguments ) ); 4729 }, 4730 4731 first: function() { 4732 return this.eq( 0 ); 4733 }, 4734 4735 last: function() { 4736 return this.eq( -1 ); 4737 }, 4738 4739 even: function() { 4740 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 4741 return ( i + 1 ) % 2; 4742 } ) ); 4743 }, 4744 4745 odd: function() { 4746 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 4747 return i % 2; 4748 } ) ); 4749 }, 4750 4751 eq: function( i ) { 4752 var len = this.length, 4753 j = +i + ( i < 0 ? len : 0 ); 4754 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 4755 }, 4756 4757 end: function() { 4758 return this.prevObject || this.constructor(); 4759 }, 4760 4761 // For internal use only. 4762 // Behaves like an Array's method, not like a jQuery method. 4763 push: push, 4764 sort: arr.sort, 4765 splice: arr.splice 4766}; 4767 4768jQuery.extend = jQuery.fn.extend = function() { 4769 var options, name, src, copy, copyIsArray, clone, 4770 target = arguments[ 0 ] || {}, 4771 i = 1, 4772 length = arguments.length, 4773 deep = false; 4774 4775 // Handle a deep copy situation 4776 if ( typeof target === "boolean" ) { 4777 deep = target; 4778 4779 // Skip the boolean and the target 4780 target = arguments[ i ] || {}; 4781 i++; 4782 } 4783 4784 // Handle case when target is a string or something (possible in deep copy) 4785 if ( typeof target !== "object" && !isFunction( target ) ) { 4786 target = {}; 4787 } 4788 4789 // Extend jQuery itself if only one argument is passed 4790 if ( i === length ) { 4791 target = this; 4792 i--; 4793 } 4794 4795 for ( ; i < length; i++ ) { 4796 4797 // Only deal with non-null/undefined values 4798 if ( ( options = arguments[ i ] ) != null ) { 4799 4800 // Extend the base object 4801 for ( name in options ) { 4802 copy = options[ name ]; 4803 4804 // Prevent Object.prototype pollution 4805 // Prevent never-ending loop 4806 if ( name === "__proto__" || target === copy ) { 4807 continue; 4808 } 4809 4810 // Recurse if we're merging plain objects or arrays 4811 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 4812 ( copyIsArray = Array.isArray( copy ) ) ) ) { 4813 src = target[ name ]; 4814 4815 // Ensure proper type for the source value 4816 if ( copyIsArray && !Array.isArray( src ) ) { 4817 clone = []; 4818 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 4819 clone = {}; 4820 } else { 4821 clone = src; 4822 } 4823 copyIsArray = false; 4824 4825 // Never move original objects, clone them 4826 target[ name ] = jQuery.extend( deep, clone, copy ); 4827 4828 // Don't bring in undefined values 4829 } else if ( copy !== undefined ) { 4830 target[ name ] = copy; 4831 } 4832 } 4833 } 4834 } 4835 4836 // Return the modified object 4837 return target; 4838}; 4839 4840jQuery.extend( { 4841 4842 // Unique for each copy of jQuery on the page 4843 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 4844 4845 // Assume jQuery is ready without the ready module 4846 isReady: true, 4847 4848 error: function( msg ) { 4849 throw new Error( msg ); 4850 }, 4851 4852 noop: function() {}, 4853 4854 isPlainObject: function( obj ) { 4855 var proto, Ctor; 4856 4857 // Detect obvious negatives 4858 // Use toString instead of jQuery.type to catch host objects 4859 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 4860 return false; 4861 } 4862 4863 proto = getProto( obj ); 4864 4865 // Objects with no prototype (e.g., `Object.create( null )`) are plain 4866 if ( !proto ) { 4867 return true; 4868 } 4869 4870 // Objects with prototype are plain iff they were constructed by a global Object function 4871 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 4872 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 4873 }, 4874 4875 isEmptyObject: function( obj ) { 4876 var name; 4877 4878 for ( name in obj ) { 4879 return false; 4880 } 4881 return true; 4882 }, 4883 4884 // Evaluates a script in a provided context; falls back to the global one 4885 // if not specified. 4886 globalEval: function( code, options, doc ) { 4887 DOMEval( code, { nonce: options && options.nonce }, doc ); 4888 }, 4889 4890 each: function( obj, callback ) { 4891 var length, i = 0; 4892 4893 if ( isArrayLike( obj ) ) { 4894 length = obj.length; 4895 for ( ; i < length; i++ ) { 4896 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 4897 break; 4898 } 4899 } 4900 } else { 4901 for ( i in obj ) { 4902 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 4903 break; 4904 } 4905 } 4906 } 4907 4908 return obj; 4909 }, 4910 4911 4912 // Retrieve the text value of an array of DOM nodes 4913 text: function( elem ) { 4914 var node, 4915 ret = "", 4916 i = 0, 4917 nodeType = elem.nodeType; 4918 4919 if ( !nodeType ) { 4920 4921 // If no nodeType, this is expected to be an array 4922 while ( ( node = elem[ i++ ] ) ) { 4923 4924 // Do not traverse comment nodes 4925 ret += jQuery.text( node ); 4926 } 4927 } 4928 if ( nodeType === 1 || nodeType === 11 ) { 4929 return elem.textContent; 4930 } 4931 if ( nodeType === 9 ) { 4932 return elem.documentElement.textContent; 4933 } 4934 if ( nodeType === 3 || nodeType === 4 ) { 4935 return elem.nodeValue; 4936 } 4937 4938 // Do not include comment or processing instruction nodes 4939 4940 return ret; 4941 }, 4942 4943 // results is for internal usage only 4944 makeArray: function( arr, results ) { 4945 var ret = results || []; 4946 4947 if ( arr != null ) { 4948 if ( isArrayLike( Object( arr ) ) ) { 4949 jQuery.merge( ret, 4950 typeof arr === "string" ? 4951 [ arr ] : arr 4952 ); 4953 } else { 4954 push.call( ret, arr ); 4955 } 4956 } 4957 4958 return ret; 4959 }, 4960 4961 inArray: function( elem, arr, i ) { 4962 return arr == null ? -1 : indexOf.call( arr, elem, i ); 4963 }, 4964 4965 isXMLDoc: function( elem ) { 4966 var namespace = elem && elem.namespaceURI, 4967 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 4968 4969 // Assume HTML when documentElement doesn't yet exist, such as inside 4970 // document fragments. 4971 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 4972 }, 4973 4974 // Support: Android <=4.0 only, PhantomJS 1 only 4975 // push.apply(_, arraylike) throws on ancient WebKit 4976 merge: function( first, second ) { 4977 var len = +second.length, 4978 j = 0, 4979 i = first.length; 4980 4981 for ( ; j < len; j++ ) { 4982 first[ i++ ] = second[ j ]; 4983 } 4984 4985 first.length = i; 4986 4987 return first; 4988 }, 4989 4990 grep: function( elems, callback, invert ) { 4991 var callbackInverse, 4992 matches = [], 4993 i = 0, 4994 length = elems.length, 4995 callbackExpect = !invert; 4996 4997 // Go through the array, only saving the items 4998 // that pass the validator function 4999 for ( ; i < length; i++ ) { 5000 callbackInverse = !callback( elems[ i ], i ); 5001 if ( callbackInverse !== callbackExpect ) { 5002 matches.push( elems[ i ] ); 5003 } 5004 } 5005 5006 return matches; 5007 }, 5008 5009 // arg is for internal usage only 5010 map: function( elems, callback, arg ) { 5011 var length, value, 5012 i = 0, 5013 ret = []; 5014 5015 // Go through the array, translating each of the items to their new values 5016 if ( isArrayLike( elems ) ) { 5017 length = elems.length; 5018 for ( ; i < length; i++ ) { 5019 value = callback( elems[ i ], i, arg ); 5020 5021 if ( value != null ) { 5022 ret.push( value ); 5023 } 5024 } 5025 5026 // Go through every key on the object, 5027 } else { 5028 for ( i in elems ) { 5029 value = callback( elems[ i ], i, arg ); 5030 5031 if ( value != null ) { 5032 ret.push( value ); 5033 } 5034 } 5035 } 5036 5037 // Flatten any nested arrays 5038 return flat( ret ); 5039 }, 5040 5041 // A global GUID counter for objects 5042 guid: 1, 5043 5044 // jQuery.support is not used in Core but other projects attach their 5045 // properties to it so it needs to exist. 5046 support: support 5047} ); 5048 5049if ( typeof Symbol === "function" ) { 5050 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 5051} 5052 5053// Populate the class2type map 5054jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 5055 function( _i, name ) { 5056 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 5057 } ); 5058 5059function isArrayLike( obj ) { 5060 5061 // Support: real iOS 8.2 only (not reproducible in simulator) 5062 // `in` check used to prevent JIT error (gh-2145) 5063 // hasOwn isn't used here due to false negatives 5064 // regarding Nodelist length in IE 5065 var length = !!obj && "length" in obj && obj.length, 5066 type = toType( obj ); 5067 5068 if ( isFunction( obj ) || isWindow( obj ) ) { 5069 return false; 5070 } 5071 5072 return type === "array" || length === 0 || 5073 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 5074} 5075 5076 5077function nodeName( elem, name ) { 5078 5079 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 5080 5081} 5082var pop = arr.pop; 5083 5084 5085var sort = arr.sort; 5086 5087 5088var splice = arr.splice; 5089 5090 5091var whitespace = "[\\x20\\t\\r\\n\\f]"; 5092 5093 5094var rtrimCSS = new RegExp( 5095 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 5096 "g" 5097); 5098 5099 5100 5101 5102// Note: an element does not contain itself 5103jQuery.contains = function( a, b ) { 5104 var bup = b && b.parentNode; 5105 5106 return a === bup || !!( bup && bup.nodeType === 1 && ( 5107 5108 // Support: IE 9 - 11+ 5109 // IE doesn't have `contains` on SVG. 5110 a.contains ? 5111 a.contains( bup ) : 5112 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 5113 ) ); 5114}; 5115 5116 5117 5118 5119// CSS string/identifier serialization 5120// https://drafts.csswg.org/cssom/#common-serializing-idioms 5121var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 5122 5123function fcssescape( ch, asCodePoint ) { 5124 if ( asCodePoint ) { 5125 5126 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 5127 if ( ch === "\0" ) { 5128 return "\uFFFD"; 5129 } 5130 5131 // Control characters and (dependent upon position) numbers get escaped as code points 5132 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 5133 } 5134 5135 // Other potentially-special ASCII characters get backslash-escaped 5136 return "\\" + ch; 5137} 5138 5139jQuery.escapeSelector = function( sel ) { 5140 return ( sel + "" ).replace( rcssescape, fcssescape ); 5141}; 5142 5143 5144 5145 5146var preferredDoc = document, 5147 pushNative = push; 5148 5149( function() { 5150 5151var i, 5152 Expr, 5153 outermostContext, 5154 sortInput, 5155 hasDuplicate, 5156 push = pushNative, 5157 5158 // Local document vars 5159 document, 5160 documentElement, 5161 documentIsHTML, 5162 rbuggyQSA, 5163 matches, 5164 5165 // Instance-specific data 5166 expando = jQuery.expando, 5167 dirruns = 0, 5168 done = 0, 5169 classCache = createCache(), 5170 tokenCache = createCache(), 5171 compilerCache = createCache(), 5172 nonnativeSelectorCache = createCache(), 5173 sortOrder = function( a, b ) { 5174 if ( a === b ) { 5175 hasDuplicate = true; 5176 } 5177 return 0; 5178 }, 5179 5180 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 5181 "loop|multiple|open|readonly|required|scoped", 5182 5183 // Regular expressions 5184 5185 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 5186 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 5187 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 5188 5189 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 5190 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 5191 5192 // Operator (capture 2) 5193 "*([*^$|!~]?=)" + whitespace + 5194 5195 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 5196 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 5197 whitespace + "*\\]", 5198 5199 pseudos = ":(" + identifier + ")(?:\\((" + 5200 5201 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 5202 // 1. quoted (capture 3; capture 4 or capture 5) 5203 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 5204 5205 // 2. simple (capture 6) 5206 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 5207 5208 // 3. anything else (capture 2) 5209 ".*" + 5210 ")\\)|)", 5211 5212 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 5213 rwhitespace = new RegExp( whitespace + "+", "g" ), 5214 5215 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 5216 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 5217 whitespace + "*" ), 5218 rdescend = new RegExp( whitespace + "|>" ), 5219 5220 rpseudo = new RegExp( pseudos ), 5221 ridentifier = new RegExp( "^" + identifier + "$" ), 5222 5223 matchExpr = { 5224 ID: new RegExp( "^#(" + identifier + ")" ), 5225 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 5226 TAG: new RegExp( "^(" + identifier + "|[*])" ), 5227 ATTR: new RegExp( "^" + attributes ), 5228 PSEUDO: new RegExp( "^" + pseudos ), 5229 CHILD: new RegExp( 5230 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 5231 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 5232 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 5233 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 5234 5235 // For use in libraries implementing .is() 5236 // We use this for POS matching in `select` 5237 needsContext: new RegExp( "^" + whitespace + 5238 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 5239 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 5240 }, 5241 5242 rinputs = /^(?:input|select|textarea|button)$/i, 5243 rheader = /^h\d$/i, 5244 5245 // Easily-parseable/retrievable ID or TAG or CLASS selectors 5246 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 5247 5248 rsibling = /[+~]/, 5249 5250 // CSS escapes 5251 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 5252 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 5253 "?|\\\\([^\\r\\n\\f])", "g" ), 5254 funescape = function( escape, nonHex ) { 5255 var high = "0x" + escape.slice( 1 ) - 0x10000; 5256 5257 if ( nonHex ) { 5258 5259 // Strip the backslash prefix from a non-hex escape sequence 5260 return nonHex; 5261 } 5262 5263 // Replace a hexadecimal escape sequence with the encoded Unicode code point 5264 // Support: IE <=11+ 5265 // For values outside the Basic Multilingual Plane (BMP), manually construct a 5266 // surrogate pair 5267 return high < 0 ? 5268 String.fromCharCode( high + 0x10000 ) : 5269 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 5270 }, 5271 5272 // Used for iframes; see `setDocument`. 5273 // Support: IE 9 - 11+, Edge 12 - 18+ 5274 // Removing the function wrapper causes a "Permission Denied" 5275 // error in IE/Edge. 5276 unloadHandler = function() { 5277 setDocument(); 5278 }, 5279 5280 inDisabledFieldset = addCombinator( 5281 function( elem ) { 5282 return elem.disabled === true && nodeName( elem, "fieldset" ); 5283 }, 5284 { dir: "parentNode", next: "legend" } 5285 ); 5286 5287// Support: IE <=9 only 5288// Accessing document.activeElement can throw unexpectedly 5289// https://bugs.jquery.com/ticket/13393 5290function safeActiveElement() { 5291 try { 5292 return document.activeElement; 5293 } catch ( err ) { } 5294} 5295 5296// Optimize for push.apply( _, NodeList ) 5297try { 5298 push.apply( 5299 ( arr = slice.call( preferredDoc.childNodes ) ), 5300 preferredDoc.childNodes 5301 ); 5302 5303 // Support: Android <=4.0 5304 // Detect silently failing push.apply 5305 // eslint-disable-next-line no-unused-expressions 5306 arr[ preferredDoc.childNodes.length ].nodeType; 5307} catch ( e ) { 5308 push = { 5309 apply: function( target, els ) { 5310 pushNative.apply( target, slice.call( els ) ); 5311 }, 5312 call: function( target ) { 5313 pushNative.apply( target, slice.call( arguments, 1 ) ); 5314 } 5315 }; 5316} 5317 5318function find( selector, context, results, seed ) { 5319 var m, i, elem, nid, match, groups, newSelector, 5320 newContext = context && context.ownerDocument, 5321 5322 // nodeType defaults to 9, since context defaults to document 5323 nodeType = context ? context.nodeType : 9; 5324 5325 results = results || []; 5326 5327 // Return early from calls with invalid selector or context 5328 if ( typeof selector !== "string" || !selector || 5329 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 5330 5331 return results; 5332 } 5333 5334 // Try to shortcut find operations (as opposed to filters) in HTML documents 5335 if ( !seed ) { 5336 setDocument( context ); 5337 context = context || document; 5338 5339 if ( documentIsHTML ) { 5340 5341 // If the selector is sufficiently simple, try using a "get*By*" DOM method 5342 // (excepting DocumentFragment context, where the methods don't exist) 5343 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 5344 5345 // ID selector 5346 if ( ( m = match[ 1 ] ) ) { 5347 5348 // Document context 5349 if ( nodeType === 9 ) { 5350 if ( ( elem = context.getElementById( m ) ) ) { 5351 5352 // Support: IE 9 only 5353 // getElementById can match elements by name instead of ID 5354 if ( elem.id === m ) { 5355 push.call( results, elem ); 5356 return results; 5357 } 5358 } else { 5359 return results; 5360 } 5361 5362 // Element context 5363 } else { 5364 5365 // Support: IE 9 only 5366 // getElementById can match elements by name instead of ID 5367 if ( newContext && ( elem = newContext.getElementById( m ) ) && 5368 find.contains( context, elem ) && 5369 elem.id === m ) { 5370 5371 push.call( results, elem ); 5372 return results; 5373 } 5374 } 5375 5376 // Type selector 5377 } else if ( match[ 2 ] ) { 5378 push.apply( results, context.getElementsByTagName( selector ) ); 5379 return results; 5380 5381 // Class selector 5382 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 5383 push.apply( results, context.getElementsByClassName( m ) ); 5384 return results; 5385 } 5386 } 5387 5388 // Take advantage of querySelectorAll 5389 if ( !nonnativeSelectorCache[ selector + " " ] && 5390 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 5391 5392 newSelector = selector; 5393 newContext = context; 5394 5395 // qSA considers elements outside a scoping root when evaluating child or 5396 // descendant combinators, which is not what we want. 5397 // In such cases, we work around the behavior by prefixing every selector in the 5398 // list with an ID selector referencing the scope context. 5399 // The technique has to be used as well when a leading combinator is used 5400 // as such selectors are not recognized by querySelectorAll. 5401 // Thanks to Andrew Dupont for this technique. 5402 if ( nodeType === 1 && 5403 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 5404 5405 // Expand context for sibling selectors 5406 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 5407 context; 5408 5409 // We can use :scope instead of the ID hack if the browser 5410 // supports it & if we're not changing the context. 5411 // Support: IE 11+, Edge 17 - 18+ 5412 // IE/Edge sometimes throw a "Permission denied" error when 5413 // strict-comparing two documents; shallow comparisons work. 5414 // eslint-disable-next-line eqeqeq 5415 if ( newContext != context || !support.scope ) { 5416 5417 // Capture the context ID, setting it first if necessary 5418 if ( ( nid = context.getAttribute( "id" ) ) ) { 5419 nid = jQuery.escapeSelector( nid ); 5420 } else { 5421 context.setAttribute( "id", ( nid = expando ) ); 5422 } 5423 } 5424 5425 // Prefix every selector in the list 5426 groups = tokenize( selector ); 5427 i = groups.length; 5428 while ( i-- ) { 5429 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 5430 toSelector( groups[ i ] ); 5431 } 5432 newSelector = groups.join( "," ); 5433 } 5434 5435 try { 5436 push.apply( results, 5437 newContext.querySelectorAll( newSelector ) 5438 ); 5439 return results; 5440 } catch ( qsaError ) { 5441 nonnativeSelectorCache( selector, true ); 5442 } finally { 5443 if ( nid === expando ) { 5444 context.removeAttribute( "id" ); 5445 } 5446 } 5447 } 5448 } 5449 } 5450 5451 // All others 5452 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 5453} 5454 5455/** 5456 * Create key-value caches of limited size 5457 * @returns {function(string, object)} Returns the Object data after storing it on itself with 5458 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 5459 * deleting the oldest entry 5460 */ 5461function createCache() { 5462 var keys = []; 5463 5464 function cache( key, value ) { 5465 5466 // Use (key + " ") to avoid collision with native prototype properties 5467 // (see https://github.com/jquery/sizzle/issues/157) 5468 if ( keys.push( key + " " ) > Expr.cacheLength ) { 5469 5470 // Only keep the most recent entries 5471 delete cache[ keys.shift() ]; 5472 } 5473 return ( cache[ key + " " ] = value ); 5474 } 5475 return cache; 5476} 5477 5478/** 5479 * Mark a function for special use by jQuery selector module 5480 * @param {Function} fn The function to mark 5481 */ 5482function markFunction( fn ) { 5483 fn[ expando ] = true; 5484 return fn; 5485} 5486 5487/** 5488 * Support testing using an element 5489 * @param {Function} fn Passed the created element and returns a boolean result 5490 */ 5491function assert( fn ) { 5492 var el = document.createElement( "fieldset" ); 5493 5494 try { 5495 return !!fn( el ); 5496 } catch ( e ) { 5497 return false; 5498 } finally { 5499 5500 // Remove from its parent by default 5501 if ( el.parentNode ) { 5502 el.parentNode.removeChild( el ); 5503 } 5504 5505 // release memory in IE 5506 el = null; 5507 } 5508} 5509 5510/** 5511 * Returns a function to use in pseudos for input types 5512 * @param {String} type 5513 */ 5514function createInputPseudo( type ) { 5515 return function( elem ) { 5516 return nodeName( elem, "input" ) && elem.type === type; 5517 }; 5518} 5519 5520/** 5521 * Returns a function to use in pseudos for buttons 5522 * @param {String} type 5523 */ 5524function createButtonPseudo( type ) { 5525 return function( elem ) { 5526 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 5527 elem.type === type; 5528 }; 5529} 5530 5531/** 5532 * Returns a function to use in pseudos for :enabled/:disabled 5533 * @param {Boolean} disabled true for :disabled; false for :enabled 5534 */ 5535function createDisabledPseudo( disabled ) { 5536 5537 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 5538 return function( elem ) { 5539 5540 // Only certain elements can match :enabled or :disabled 5541 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 5542 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 5543 if ( "form" in elem ) { 5544 5545 // Check for inherited disabledness on relevant non-disabled elements: 5546 // * listed form-associated elements in a disabled fieldset 5547 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 5548 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 5549 // * option elements in a disabled optgroup 5550 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 5551 // All such elements have a "form" property. 5552 if ( elem.parentNode && elem.disabled === false ) { 5553 5554 // Option elements defer to a parent optgroup if present 5555 if ( "label" in elem ) { 5556 if ( "label" in elem.parentNode ) { 5557 return elem.parentNode.disabled === disabled; 5558 } else { 5559 return elem.disabled === disabled; 5560 } 5561 } 5562 5563 // Support: IE 6 - 11+ 5564 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 5565 return elem.isDisabled === disabled || 5566 5567 // Where there is no isDisabled, check manually 5568 elem.isDisabled !== !disabled && 5569 inDisabledFieldset( elem ) === disabled; 5570 } 5571 5572 return elem.disabled === disabled; 5573 5574 // Try to winnow out elements that can't be disabled before trusting the disabled property. 5575 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 5576 // even exist on them, let alone have a boolean value. 5577 } else if ( "label" in elem ) { 5578 return elem.disabled === disabled; 5579 } 5580 5581 // Remaining elements are neither :enabled nor :disabled 5582 return false; 5583 }; 5584} 5585 5586/** 5587 * Returns a function to use in pseudos for positionals 5588 * @param {Function} fn 5589 */ 5590function createPositionalPseudo( fn ) { 5591 return markFunction( function( argument ) { 5592 argument = +argument; 5593 return markFunction( function( seed, matches ) { 5594 var j, 5595 matchIndexes = fn( [], seed.length, argument ), 5596 i = matchIndexes.length; 5597 5598 // Match elements found at the specified indexes 5599 while ( i-- ) { 5600 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 5601 seed[ j ] = !( matches[ j ] = seed[ j ] ); 5602 } 5603 } 5604 } ); 5605 } ); 5606} 5607 5608/** 5609 * Checks a node for validity as a jQuery selector context 5610 * @param {Element|Object=} context 5611 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 5612 */ 5613function testContext( context ) { 5614 return context && typeof context.getElementsByTagName !== "undefined" && context; 5615} 5616 5617/** 5618 * Sets document-related variables once based on the current document 5619 * @param {Element|Object} [node] An element or document object to use to set the document 5620 * @returns {Object} Returns the current document 5621 */ 5622function setDocument( node ) { 5623 var subWindow, 5624 doc = node ? node.ownerDocument || node : preferredDoc; 5625 5626 // Return early if doc is invalid or already selected 5627 // Support: IE 11+, Edge 17 - 18+ 5628 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5629 // two documents; shallow comparisons work. 5630 // eslint-disable-next-line eqeqeq 5631 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 5632 return document; 5633 } 5634 5635 // Update global variables 5636 document = doc; 5637 documentElement = document.documentElement; 5638 documentIsHTML = !jQuery.isXMLDoc( document ); 5639 5640 // Support: iOS 7 only, IE 9 - 11+ 5641 // Older browsers didn't support unprefixed `matches`. 5642 matches = documentElement.matches || 5643 documentElement.webkitMatchesSelector || 5644 documentElement.msMatchesSelector; 5645 5646 // Support: IE 9 - 11+, Edge 12 - 18+ 5647 // Accessing iframe documents after unload throws "permission denied" errors 5648 // (see trac-13936). 5649 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, 5650 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. 5651 if ( documentElement.msMatchesSelector && 5652 5653 // Support: IE 11+, Edge 17 - 18+ 5654 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5655 // two documents; shallow comparisons work. 5656 // eslint-disable-next-line eqeqeq 5657 preferredDoc != document && 5658 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 5659 5660 // Support: IE 9 - 11+, Edge 12 - 18+ 5661 subWindow.addEventListener( "unload", unloadHandler ); 5662 } 5663 5664 // Support: IE <10 5665 // Check if getElementById returns elements by name 5666 // The broken getElementById methods don't pick up programmatically-set names, 5667 // so use a roundabout getElementsByName test 5668 support.getById = assert( function( el ) { 5669 documentElement.appendChild( el ).id = jQuery.expando; 5670 return !document.getElementsByName || 5671 !document.getElementsByName( jQuery.expando ).length; 5672 } ); 5673 5674 // Support: IE 9 only 5675 // Check to see if it's possible to do matchesSelector 5676 // on a disconnected node. 5677 support.disconnectedMatch = assert( function( el ) { 5678 return matches.call( el, "*" ); 5679 } ); 5680 5681 // Support: IE 9 - 11+, Edge 12 - 18+ 5682 // IE/Edge don't support the :scope pseudo-class. 5683 support.scope = assert( function() { 5684 return document.querySelectorAll( ":scope" ); 5685 } ); 5686 5687 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 5688 // Make sure the `:has()` argument is parsed unforgivingly. 5689 // We include `*` in the test to detect buggy implementations that are 5690 // _selectively_ forgiving (specifically when the list includes at least 5691 // one valid selector). 5692 // Note that we treat complete lack of support for `:has()` as if it were 5693 // spec-compliant support, which is fine because use of `:has()` in such 5694 // environments will fail in the qSA path and fall back to jQuery traversal 5695 // anyway. 5696 support.cssHas = assert( function() { 5697 try { 5698 document.querySelector( ":has(*,:jqfake)" ); 5699 return false; 5700 } catch ( e ) { 5701 return true; 5702 } 5703 } ); 5704 5705 // ID filter and find 5706 if ( support.getById ) { 5707 Expr.filter.ID = function( id ) { 5708 var attrId = id.replace( runescape, funescape ); 5709 return function( elem ) { 5710 return elem.getAttribute( "id" ) === attrId; 5711 }; 5712 }; 5713 Expr.find.ID = function( id, context ) { 5714 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 5715 var elem = context.getElementById( id ); 5716 return elem ? [ elem ] : []; 5717 } 5718 }; 5719 } else { 5720 Expr.filter.ID = function( id ) { 5721 var attrId = id.replace( runescape, funescape ); 5722 return function( elem ) { 5723 var node = typeof elem.getAttributeNode !== "undefined" && 5724 elem.getAttributeNode( "id" ); 5725 return node && node.value === attrId; 5726 }; 5727 }; 5728 5729 // Support: IE 6 - 7 only 5730 // getElementById is not reliable as a find shortcut 5731 Expr.find.ID = function( id, context ) { 5732 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 5733 var node, i, elems, 5734 elem = context.getElementById( id ); 5735 5736 if ( elem ) { 5737 5738 // Verify the id attribute 5739 node = elem.getAttributeNode( "id" ); 5740 if ( node && node.value === id ) { 5741 return [ elem ]; 5742 } 5743 5744 // Fall back on getElementsByName 5745 elems = context.getElementsByName( id ); 5746 i = 0; 5747 while ( ( elem = elems[ i++ ] ) ) { 5748 node = elem.getAttributeNode( "id" ); 5749 if ( node && node.value === id ) { 5750 return [ elem ]; 5751 } 5752 } 5753 } 5754 5755 return []; 5756 } 5757 }; 5758 } 5759 5760 // Tag 5761 Expr.find.TAG = function( tag, context ) { 5762 if ( typeof context.getElementsByTagName !== "undefined" ) { 5763 return context.getElementsByTagName( tag ); 5764 5765 // DocumentFragment nodes don't have gEBTN 5766 } else { 5767 return context.querySelectorAll( tag ); 5768 } 5769 }; 5770 5771 // Class 5772 Expr.find.CLASS = function( className, context ) { 5773 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 5774 return context.getElementsByClassName( className ); 5775 } 5776 }; 5777 5778 /* QSA/matchesSelector 5779 ---------------------------------------------------------------------- */ 5780 5781 // QSA and matchesSelector support 5782 5783 rbuggyQSA = []; 5784 5785 // Build QSA regex 5786 // Regex strategy adopted from Diego Perini 5787 assert( function( el ) { 5788 5789 var input; 5790 5791 documentElement.appendChild( el ).innerHTML = 5792 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 5793 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 5794 "<option selected=''></option></select>"; 5795 5796 // Support: iOS <=7 - 8 only 5797 // Boolean attributes and "value" are not treated correctly in some XML documents 5798 if ( !el.querySelectorAll( "[selected]" ).length ) { 5799 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 5800 } 5801 5802 // Support: iOS <=7 - 8 only 5803 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 5804 rbuggyQSA.push( "~=" ); 5805 } 5806 5807 // Support: iOS 8 only 5808 // https://bugs.webkit.org/show_bug.cgi?id=136851 5809 // In-page `selector#id sibling-combinator selector` fails 5810 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 5811 rbuggyQSA.push( ".#.+[+~]" ); 5812 } 5813 5814 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 5815 // In some of the document kinds, these selectors wouldn't work natively. 5816 // This is probably OK but for backwards compatibility we want to maintain 5817 // handling them through jQuery traversal in jQuery 3.x. 5818 if ( !el.querySelectorAll( ":checked" ).length ) { 5819 rbuggyQSA.push( ":checked" ); 5820 } 5821 5822 // Support: Windows 8 Native Apps 5823 // The type and name attributes are restricted during .innerHTML assignment 5824 input = document.createElement( "input" ); 5825 input.setAttribute( "type", "hidden" ); 5826 el.appendChild( input ).setAttribute( "name", "D" ); 5827 5828 // Support: IE 9 - 11+ 5829 // IE's :disabled selector does not pick up the children of disabled fieldsets 5830 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 5831 // In some of the document kinds, these selectors wouldn't work natively. 5832 // This is probably OK but for backwards compatibility we want to maintain 5833 // handling them through jQuery traversal in jQuery 3.x. 5834 documentElement.appendChild( el ).disabled = true; 5835 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 5836 rbuggyQSA.push( ":enabled", ":disabled" ); 5837 } 5838 5839 // Support: IE 11+, Edge 15 - 18+ 5840 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 5841 // Adding a temporary attribute to the document before the selection works 5842 // around the issue. 5843 // Interestingly, IE 10 & older don't seem to have the issue. 5844 input = document.createElement( "input" ); 5845 input.setAttribute( "name", "" ); 5846 el.appendChild( input ); 5847 if ( !el.querySelectorAll( "[name='']" ).length ) { 5848 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 5849 whitespace + "*(?:''|\"\")" ); 5850 } 5851 } ); 5852 5853 if ( !support.cssHas ) { 5854 5855 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 5856 // Our regular `try-catch` mechanism fails to detect natively-unsupported 5857 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 5858 // in browsers that parse the `:has()` argument as a forgiving selector list. 5859 // https://drafts.csswg.org/selectors/#relational now requires the argument 5860 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 5861 rbuggyQSA.push( ":has" ); 5862 } 5863 5864 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 5865 5866 /* Sorting 5867 ---------------------------------------------------------------------- */ 5868 5869 // Document order sorting 5870 sortOrder = function( a, b ) { 5871 5872 // Flag for duplicate removal 5873 if ( a === b ) { 5874 hasDuplicate = true; 5875 return 0; 5876 } 5877 5878 // Sort on method existence if only one input has compareDocumentPosition 5879 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 5880 if ( compare ) { 5881 return compare; 5882 } 5883 5884 // Calculate position if both inputs belong to the same document 5885 // Support: IE 11+, Edge 17 - 18+ 5886 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5887 // two documents; shallow comparisons work. 5888 // eslint-disable-next-line eqeqeq 5889 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 5890 a.compareDocumentPosition( b ) : 5891 5892 // Otherwise we know they are disconnected 5893 1; 5894 5895 // Disconnected nodes 5896 if ( compare & 1 || 5897 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 5898 5899 // Choose the first element that is related to our preferred document 5900 // Support: IE 11+, Edge 17 - 18+ 5901 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5902 // two documents; shallow comparisons work. 5903 // eslint-disable-next-line eqeqeq 5904 if ( a === document || a.ownerDocument == preferredDoc && 5905 find.contains( preferredDoc, a ) ) { 5906 return -1; 5907 } 5908 5909 // Support: IE 11+, Edge 17 - 18+ 5910 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5911 // two documents; shallow comparisons work. 5912 // eslint-disable-next-line eqeqeq 5913 if ( b === document || b.ownerDocument == preferredDoc && 5914 find.contains( preferredDoc, b ) ) { 5915 return 1; 5916 } 5917 5918 // Maintain original order 5919 return sortInput ? 5920 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 5921 0; 5922 } 5923 5924 return compare & 4 ? -1 : 1; 5925 }; 5926 5927 return document; 5928} 5929 5930find.matches = function( expr, elements ) { 5931 return find( expr, null, null, elements ); 5932}; 5933 5934find.matchesSelector = function( elem, expr ) { 5935 setDocument( elem ); 5936 5937 if ( documentIsHTML && 5938 !nonnativeSelectorCache[ expr + " " ] && 5939 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 5940 5941 try { 5942 var ret = matches.call( elem, expr ); 5943 5944 // IE 9's matchesSelector returns false on disconnected nodes 5945 if ( ret || support.disconnectedMatch || 5946 5947 // As well, disconnected nodes are said to be in a document 5948 // fragment in IE 9 5949 elem.document && elem.document.nodeType !== 11 ) { 5950 return ret; 5951 } 5952 } catch ( e ) { 5953 nonnativeSelectorCache( expr, true ); 5954 } 5955 } 5956 5957 return find( expr, document, null, [ elem ] ).length > 0; 5958}; 5959 5960find.contains = function( context, elem ) { 5961 5962 // Set document vars if needed 5963 // Support: IE 11+, Edge 17 - 18+ 5964 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5965 // two documents; shallow comparisons work. 5966 // eslint-disable-next-line eqeqeq 5967 if ( ( context.ownerDocument || context ) != document ) { 5968 setDocument( context ); 5969 } 5970 return jQuery.contains( context, elem ); 5971}; 5972 5973 5974find.attr = function( elem, name ) { 5975 5976 // Set document vars if needed 5977 // Support: IE 11+, Edge 17 - 18+ 5978 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 5979 // two documents; shallow comparisons work. 5980 // eslint-disable-next-line eqeqeq 5981 if ( ( elem.ownerDocument || elem ) != document ) { 5982 setDocument( elem ); 5983 } 5984 5985 var fn = Expr.attrHandle[ name.toLowerCase() ], 5986 5987 // Don't get fooled by Object.prototype properties (see trac-13807) 5988 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 5989 fn( elem, name, !documentIsHTML ) : 5990 undefined; 5991 5992 if ( val !== undefined ) { 5993 return val; 5994 } 5995 5996 return elem.getAttribute( name ); 5997}; 5998 5999find.error = function( msg ) { 6000 throw new Error( "Syntax error, unrecognized expression: " + msg ); 6001}; 6002 6003/** 6004 * Document sorting and removing duplicates 6005 * @param {ArrayLike} results 6006 */ 6007jQuery.uniqueSort = function( results ) { 6008 var elem, 6009 duplicates = [], 6010 j = 0, 6011 i = 0; 6012 6013 // Unless we *know* we can detect duplicates, assume their presence 6014 // 6015 // Support: Android <=4.0+ 6016 // Testing for detecting duplicates is unpredictable so instead assume we can't 6017 // depend on duplicate detection in all browsers without a stable sort. 6018 hasDuplicate = !support.sortStable; 6019 sortInput = !support.sortStable && slice.call( results, 0 ); 6020 sort.call( results, sortOrder ); 6021 6022 if ( hasDuplicate ) { 6023 while ( ( elem = results[ i++ ] ) ) { 6024 if ( elem === results[ i ] ) { 6025 j = duplicates.push( i ); 6026 } 6027 } 6028 while ( j-- ) { 6029 splice.call( results, duplicates[ j ], 1 ); 6030 } 6031 } 6032 6033 // Clear input after sorting to release objects 6034 // See https://github.com/jquery/sizzle/pull/225 6035 sortInput = null; 6036 6037 return results; 6038}; 6039 6040jQuery.fn.uniqueSort = function() { 6041 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 6042}; 6043 6044Expr = jQuery.expr = { 6045 6046 // Can be adjusted by the user 6047 cacheLength: 50, 6048 6049 createPseudo: markFunction, 6050 6051 match: matchExpr, 6052 6053 attrHandle: {}, 6054 6055 find: {}, 6056 6057 relative: { 6058 ">": { dir: "parentNode", first: true }, 6059 " ": { dir: "parentNode" }, 6060 "+": { dir: "previousSibling", first: true }, 6061 "~": { dir: "previousSibling" } 6062 }, 6063 6064 preFilter: { 6065 ATTR: function( match ) { 6066 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 6067 6068 // Move the given value to match[3] whether quoted or unquoted 6069 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 6070 .replace( runescape, funescape ); 6071 6072 if ( match[ 2 ] === "~=" ) { 6073 match[ 3 ] = " " + match[ 3 ] + " "; 6074 } 6075 6076 return match.slice( 0, 4 ); 6077 }, 6078 6079 CHILD: function( match ) { 6080 6081 /* matches from matchExpr["CHILD"] 6082 1 type (only|nth|...) 6083 2 what (child|of-type) 6084 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 6085 4 xn-component of xn+y argument ([+-]?\d*n|) 6086 5 sign of xn-component 6087 6 x of xn-component 6088 7 sign of y-component 6089 8 y of y-component 6090 */ 6091 match[ 1 ] = match[ 1 ].toLowerCase(); 6092 6093 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 6094 6095 // nth-* requires argument 6096 if ( !match[ 3 ] ) { 6097 find.error( match[ 0 ] ); 6098 } 6099 6100 // numeric x and y parameters for Expr.filter.CHILD 6101 // remember that false/true cast respectively to 0/1 6102 match[ 4 ] = +( match[ 4 ] ? 6103 match[ 5 ] + ( match[ 6 ] || 1 ) : 6104 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 6105 ); 6106 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 6107 6108 // other types prohibit arguments 6109 } else if ( match[ 3 ] ) { 6110 find.error( match[ 0 ] ); 6111 } 6112 6113 return match; 6114 }, 6115 6116 PSEUDO: function( match ) { 6117 var excess, 6118 unquoted = !match[ 6 ] && match[ 2 ]; 6119 6120 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 6121 return null; 6122 } 6123 6124 // Accept quoted arguments as-is 6125 if ( match[ 3 ] ) { 6126 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 6127 6128 // Strip excess characters from unquoted arguments 6129 } else if ( unquoted && rpseudo.test( unquoted ) && 6130 6131 // Get excess from tokenize (recursively) 6132 ( excess = tokenize( unquoted, true ) ) && 6133 6134 // advance to the next closing parenthesis 6135 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 6136 6137 // excess is a negative index 6138 match[ 0 ] = match[ 0 ].slice( 0, excess ); 6139 match[ 2 ] = unquoted.slice( 0, excess ); 6140 } 6141 6142 // Return only captures needed by the pseudo filter method (type and argument) 6143 return match.slice( 0, 3 ); 6144 } 6145 }, 6146 6147 filter: { 6148 6149 TAG: function( nodeNameSelector ) { 6150 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 6151 return nodeNameSelector === "*" ? 6152 function() { 6153 return true; 6154 } : 6155 function( elem ) { 6156 return nodeName( elem, expectedNodeName ); 6157 }; 6158 }, 6159 6160 CLASS: function( className ) { 6161 var pattern = classCache[ className + " " ]; 6162 6163 return pattern || 6164 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 6165 "(" + whitespace + "|$)" ) ) && 6166 classCache( className, function( elem ) { 6167 return pattern.test( 6168 typeof elem.className === "string" && elem.className || 6169 typeof elem.getAttribute !== "undefined" && 6170 elem.getAttribute( "class" ) || 6171 "" 6172 ); 6173 } ); 6174 }, 6175 6176 ATTR: function( name, operator, check ) { 6177 return function( elem ) { 6178 var result = find.attr( elem, name ); 6179 6180 if ( result == null ) { 6181 return operator === "!="; 6182 } 6183 if ( !operator ) { 6184 return true; 6185 } 6186 6187 result += ""; 6188 6189 if ( operator === "=" ) { 6190 return result === check; 6191 } 6192 if ( operator === "!=" ) { 6193 return result !== check; 6194 } 6195 if ( operator === "^=" ) { 6196 return check && result.indexOf( check ) === 0; 6197 } 6198 if ( operator === "*=" ) { 6199 return check && result.indexOf( check ) > -1; 6200 } 6201 if ( operator === "$=" ) { 6202 return check && result.slice( -check.length ) === check; 6203 } 6204 if ( operator === "~=" ) { 6205 return ( " " + result.replace( rwhitespace, " " ) + " " ) 6206 .indexOf( check ) > -1; 6207 } 6208 if ( operator === "|=" ) { 6209 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 6210 } 6211 6212 return false; 6213 }; 6214 }, 6215 6216 CHILD: function( type, what, _argument, first, last ) { 6217 var simple = type.slice( 0, 3 ) !== "nth", 6218 forward = type.slice( -4 ) !== "last", 6219 ofType = what === "of-type"; 6220 6221 return first === 1 && last === 0 ? 6222 6223 // Shortcut for :nth-*(n) 6224 function( elem ) { 6225 return !!elem.parentNode; 6226 } : 6227 6228 function( elem, _context, xml ) { 6229 var cache, outerCache, node, nodeIndex, start, 6230 dir = simple !== forward ? "nextSibling" : "previousSibling", 6231 parent = elem.parentNode, 6232 name = ofType && elem.nodeName.toLowerCase(), 6233 useCache = !xml && !ofType, 6234 diff = false; 6235 6236 if ( parent ) { 6237 6238 // :(first|last|only)-(child|of-type) 6239 if ( simple ) { 6240 while ( dir ) { 6241 node = elem; 6242 while ( ( node = node[ dir ] ) ) { 6243 if ( ofType ? 6244 nodeName( node, name ) : 6245 node.nodeType === 1 ) { 6246 6247 return false; 6248 } 6249 } 6250 6251 // Reverse direction for :only-* (if we haven't yet done so) 6252 start = dir = type === "only" && !start && "nextSibling"; 6253 } 6254 return true; 6255 } 6256 6257 start = [ forward ? parent.firstChild : parent.lastChild ]; 6258 6259 // non-xml :nth-child(...) stores cache data on `parent` 6260 if ( forward && useCache ) { 6261 6262 // Seek `elem` from a previously-cached index 6263 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 6264 cache = outerCache[ type ] || []; 6265 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 6266 diff = nodeIndex && cache[ 2 ]; 6267 node = nodeIndex && parent.childNodes[ nodeIndex ]; 6268 6269 while ( ( node = ++nodeIndex && node && node[ dir ] || 6270 6271 // Fallback to seeking `elem` from the start 6272 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 6273 6274 // When found, cache indexes on `parent` and break 6275 if ( node.nodeType === 1 && ++diff && node === elem ) { 6276 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 6277 break; 6278 } 6279 } 6280 6281 } else { 6282 6283 // Use previously-cached element index if available 6284 if ( useCache ) { 6285 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 6286 cache = outerCache[ type ] || []; 6287 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 6288 diff = nodeIndex; 6289 } 6290 6291 // xml :nth-child(...) 6292 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 6293 if ( diff === false ) { 6294 6295 // Use the same loop as above to seek `elem` from the start 6296 while ( ( node = ++nodeIndex && node && node[ dir ] || 6297 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 6298 6299 if ( ( ofType ? 6300 nodeName( node, name ) : 6301 node.nodeType === 1 ) && 6302 ++diff ) { 6303 6304 // Cache the index of each encountered element 6305 if ( useCache ) { 6306 outerCache = node[ expando ] || 6307 ( node[ expando ] = {} ); 6308 outerCache[ type ] = [ dirruns, diff ]; 6309 } 6310 6311 if ( node === elem ) { 6312 break; 6313 } 6314 } 6315 } 6316 } 6317 } 6318 6319 // Incorporate the offset, then check against cycle size 6320 diff -= last; 6321 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 6322 } 6323 }; 6324 }, 6325 6326 PSEUDO: function( pseudo, argument ) { 6327 6328 // pseudo-class names are case-insensitive 6329 // https://www.w3.org/TR/selectors/#pseudo-classes 6330 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 6331 // Remember that setFilters inherits from pseudos 6332 var args, 6333 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 6334 find.error( "unsupported pseudo: " + pseudo ); 6335 6336 // The user may use createPseudo to indicate that 6337 // arguments are needed to create the filter function 6338 // just as jQuery does 6339 if ( fn[ expando ] ) { 6340 return fn( argument ); 6341 } 6342 6343 // But maintain support for old signatures 6344 if ( fn.length > 1 ) { 6345 args = [ pseudo, pseudo, "", argument ]; 6346 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 6347 markFunction( function( seed, matches ) { 6348 var idx, 6349 matched = fn( seed, argument ), 6350 i = matched.length; 6351 while ( i-- ) { 6352 idx = indexOf.call( seed, matched[ i ] ); 6353 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 6354 } 6355 } ) : 6356 function( elem ) { 6357 return fn( elem, 0, args ); 6358 }; 6359 } 6360 6361 return fn; 6362 } 6363 }, 6364 6365 pseudos: { 6366 6367 // Potentially complex pseudos 6368 not: markFunction( function( selector ) { 6369 6370 // Trim the selector passed to compile 6371 // to avoid treating leading and trailing 6372 // spaces as combinators 6373 var input = [], 6374 results = [], 6375 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 6376 6377 return matcher[ expando ] ? 6378 markFunction( function( seed, matches, _context, xml ) { 6379 var elem, 6380 unmatched = matcher( seed, null, xml, [] ), 6381 i = seed.length; 6382 6383 // Match elements unmatched by `matcher` 6384 while ( i-- ) { 6385 if ( ( elem = unmatched[ i ] ) ) { 6386 seed[ i ] = !( matches[ i ] = elem ); 6387 } 6388 } 6389 } ) : 6390 function( elem, _context, xml ) { 6391 input[ 0 ] = elem; 6392 matcher( input, null, xml, results ); 6393 6394 // Don't keep the element 6395 // (see https://github.com/jquery/sizzle/issues/299) 6396 input[ 0 ] = null; 6397 return !results.pop(); 6398 }; 6399 } ), 6400 6401 has: markFunction( function( selector ) { 6402 return function( elem ) { 6403 return find( selector, elem ).length > 0; 6404 }; 6405 } ), 6406 6407 contains: markFunction( function( text ) { 6408 text = text.replace( runescape, funescape ); 6409 return function( elem ) { 6410 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 6411 }; 6412 } ), 6413 6414 // "Whether an element is represented by a :lang() selector 6415 // is based solely on the element's language value 6416 // being equal to the identifier C, 6417 // or beginning with the identifier C immediately followed by "-". 6418 // The matching of C against the element's language value is performed case-insensitively. 6419 // The identifier C does not have to be a valid language name." 6420 // https://www.w3.org/TR/selectors/#lang-pseudo 6421 lang: markFunction( function( lang ) { 6422 6423 // lang value must be a valid identifier 6424 if ( !ridentifier.test( lang || "" ) ) { 6425 find.error( "unsupported lang: " + lang ); 6426 } 6427 lang = lang.replace( runescape, funescape ).toLowerCase(); 6428 return function( elem ) { 6429 var elemLang; 6430 do { 6431 if ( ( elemLang = documentIsHTML ? 6432 elem.lang : 6433 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 6434 6435 elemLang = elemLang.toLowerCase(); 6436 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 6437 } 6438 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 6439 return false; 6440 }; 6441 } ), 6442 6443 // Miscellaneous 6444 target: function( elem ) { 6445 var hash = window.location && window.location.hash; 6446 return hash && hash.slice( 1 ) === elem.id; 6447 }, 6448 6449 root: function( elem ) { 6450 return elem === documentElement; 6451 }, 6452 6453 focus: function( elem ) { 6454 return elem === safeActiveElement() && 6455 document.hasFocus() && 6456 !!( elem.type || elem.href || ~elem.tabIndex ); 6457 }, 6458 6459 // Boolean properties 6460 enabled: createDisabledPseudo( false ), 6461 disabled: createDisabledPseudo( true ), 6462 6463 checked: function( elem ) { 6464 6465 // In CSS3, :checked should return both checked and selected elements 6466 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 6467 return ( nodeName( elem, "input" ) && !!elem.checked ) || 6468 ( nodeName( elem, "option" ) && !!elem.selected ); 6469 }, 6470 6471 selected: function( elem ) { 6472 6473 // Support: IE <=11+ 6474 // Accessing the selectedIndex property 6475 // forces the browser to treat the default option as 6476 // selected when in an optgroup. 6477 if ( elem.parentNode ) { 6478 // eslint-disable-next-line no-unused-expressions 6479 elem.parentNode.selectedIndex; 6480 } 6481 6482 return elem.selected === true; 6483 }, 6484 6485 // Contents 6486 empty: function( elem ) { 6487 6488 // https://www.w3.org/TR/selectors/#empty-pseudo 6489 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 6490 // but not by others (comment: 8; processing instruction: 7; etc.) 6491 // nodeType < 6 works because attributes (2) do not appear as children 6492 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 6493 if ( elem.nodeType < 6 ) { 6494 return false; 6495 } 6496 } 6497 return true; 6498 }, 6499 6500 parent: function( elem ) { 6501 return !Expr.pseudos.empty( elem ); 6502 }, 6503 6504 // Element/input types 6505 header: function( elem ) { 6506 return rheader.test( elem.nodeName ); 6507 }, 6508 6509 input: function( elem ) { 6510 return rinputs.test( elem.nodeName ); 6511 }, 6512 6513 button: function( elem ) { 6514 return nodeName( elem, "input" ) && elem.type === "button" || 6515 nodeName( elem, "button" ); 6516 }, 6517 6518 text: function( elem ) { 6519 var attr; 6520 return nodeName( elem, "input" ) && elem.type === "text" && 6521 6522 // Support: IE <10 only 6523 // New HTML5 attribute values (e.g., "search") appear 6524 // with elem.type === "text" 6525 ( ( attr = elem.getAttribute( "type" ) ) == null || 6526 attr.toLowerCase() === "text" ); 6527 }, 6528 6529 // Position-in-collection 6530 first: createPositionalPseudo( function() { 6531 return [ 0 ]; 6532 } ), 6533 6534 last: createPositionalPseudo( function( _matchIndexes, length ) { 6535 return [ length - 1 ]; 6536 } ), 6537 6538 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 6539 return [ argument < 0 ? argument + length : argument ]; 6540 } ), 6541 6542 even: createPositionalPseudo( function( matchIndexes, length ) { 6543 var i = 0; 6544 for ( ; i < length; i += 2 ) { 6545 matchIndexes.push( i ); 6546 } 6547 return matchIndexes; 6548 } ), 6549 6550 odd: createPositionalPseudo( function( matchIndexes, length ) { 6551 var i = 1; 6552 for ( ; i < length; i += 2 ) { 6553 matchIndexes.push( i ); 6554 } 6555 return matchIndexes; 6556 } ), 6557 6558 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 6559 var i; 6560 6561 if ( argument < 0 ) { 6562 i = argument + length; 6563 } else if ( argument > length ) { 6564 i = length; 6565 } else { 6566 i = argument; 6567 } 6568 6569 for ( ; --i >= 0; ) { 6570 matchIndexes.push( i ); 6571 } 6572 return matchIndexes; 6573 } ), 6574 6575 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 6576 var i = argument < 0 ? argument + length : argument; 6577 for ( ; ++i < length; ) { 6578 matchIndexes.push( i ); 6579 } 6580 return matchIndexes; 6581 } ) 6582 } 6583}; 6584 6585Expr.pseudos.nth = Expr.pseudos.eq; 6586 6587// Add button/input type pseudos 6588for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 6589 Expr.pseudos[ i ] = createInputPseudo( i ); 6590} 6591for ( i in { submit: true, reset: true } ) { 6592 Expr.pseudos[ i ] = createButtonPseudo( i ); 6593} 6594 6595// Easy API for creating new setFilters 6596function setFilters() {} 6597setFilters.prototype = Expr.filters = Expr.pseudos; 6598Expr.setFilters = new setFilters(); 6599 6600function tokenize( selector, parseOnly ) { 6601 var matched, match, tokens, type, 6602 soFar, groups, preFilters, 6603 cached = tokenCache[ selector + " " ]; 6604 6605 if ( cached ) { 6606 return parseOnly ? 0 : cached.slice( 0 ); 6607 } 6608 6609 soFar = selector; 6610 groups = []; 6611 preFilters = Expr.preFilter; 6612 6613 while ( soFar ) { 6614 6615 // Comma and first run 6616 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 6617 if ( match ) { 6618 6619 // Don't consume trailing commas as valid 6620 soFar = soFar.slice( match[ 0 ].length ) || soFar; 6621 } 6622 groups.push( ( tokens = [] ) ); 6623 } 6624 6625 matched = false; 6626 6627 // Combinators 6628 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 6629 matched = match.shift(); 6630 tokens.push( { 6631 value: matched, 6632 6633 // Cast descendant combinators to space 6634 type: match[ 0 ].replace( rtrimCSS, " " ) 6635 } ); 6636 soFar = soFar.slice( matched.length ); 6637 } 6638 6639 // Filters 6640 for ( type in Expr.filter ) { 6641 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 6642 ( match = preFilters[ type ]( match ) ) ) ) { 6643 matched = match.shift(); 6644 tokens.push( { 6645 value: matched, 6646 type: type, 6647 matches: match 6648 } ); 6649 soFar = soFar.slice( matched.length ); 6650 } 6651 } 6652 6653 if ( !matched ) { 6654 break; 6655 } 6656 } 6657 6658 // Return the length of the invalid excess 6659 // if we're just parsing 6660 // Otherwise, throw an error or return tokens 6661 if ( parseOnly ) { 6662 return soFar.length; 6663 } 6664 6665 return soFar ? 6666 find.error( selector ) : 6667 6668 // Cache the tokens 6669 tokenCache( selector, groups ).slice( 0 ); 6670} 6671 6672function toSelector( tokens ) { 6673 var i = 0, 6674 len = tokens.length, 6675 selector = ""; 6676 for ( ; i < len; i++ ) { 6677 selector += tokens[ i ].value; 6678 } 6679 return selector; 6680} 6681 6682function addCombinator( matcher, combinator, base ) { 6683 var dir = combinator.dir, 6684 skip = combinator.next, 6685 key = skip || dir, 6686 checkNonElements = base && key === "parentNode", 6687 doneName = done++; 6688 6689 return combinator.first ? 6690 6691 // Check against closest ancestor/preceding element 6692 function( elem, context, xml ) { 6693 while ( ( elem = elem[ dir ] ) ) { 6694 if ( elem.nodeType === 1 || checkNonElements ) { 6695 return matcher( elem, context, xml ); 6696 } 6697 } 6698 return false; 6699 } : 6700 6701 // Check against all ancestor/preceding elements 6702 function( elem, context, xml ) { 6703 var oldCache, outerCache, 6704 newCache = [ dirruns, doneName ]; 6705 6706 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 6707 if ( xml ) { 6708 while ( ( elem = elem[ dir ] ) ) { 6709 if ( elem.nodeType === 1 || checkNonElements ) { 6710 if ( matcher( elem, context, xml ) ) { 6711 return true; 6712 } 6713 } 6714 } 6715 } else { 6716 while ( ( elem = elem[ dir ] ) ) { 6717 if ( elem.nodeType === 1 || checkNonElements ) { 6718 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 6719 6720 if ( skip && nodeName( elem, skip ) ) { 6721 elem = elem[ dir ] || elem; 6722 } else if ( ( oldCache = outerCache[ key ] ) && 6723 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 6724 6725 // Assign to newCache so results back-propagate to previous elements 6726 return ( newCache[ 2 ] = oldCache[ 2 ] ); 6727 } else { 6728 6729 // Reuse newcache so results back-propagate to previous elements 6730 outerCache[ key ] = newCache; 6731 6732 // A match means we're done; a fail means we have to keep checking 6733 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 6734 return true; 6735 } 6736 } 6737 } 6738 } 6739 } 6740 return false; 6741 }; 6742} 6743 6744function elementMatcher( matchers ) { 6745 return matchers.length > 1 ? 6746 function( elem, context, xml ) { 6747 var i = matchers.length; 6748 while ( i-- ) { 6749 if ( !matchers[ i ]( elem, context, xml ) ) { 6750 return false; 6751 } 6752 } 6753 return true; 6754 } : 6755 matchers[ 0 ]; 6756} 6757 6758function multipleContexts( selector, contexts, results ) { 6759 var i = 0, 6760 len = contexts.length; 6761 for ( ; i < len; i++ ) { 6762 find( selector, contexts[ i ], results ); 6763 } 6764 return results; 6765} 6766 6767function condense( unmatched, map, filter, context, xml ) { 6768 var elem, 6769 newUnmatched = [], 6770 i = 0, 6771 len = unmatched.length, 6772 mapped = map != null; 6773 6774 for ( ; i < len; i++ ) { 6775 if ( ( elem = unmatched[ i ] ) ) { 6776 if ( !filter || filter( elem, context, xml ) ) { 6777 newUnmatched.push( elem ); 6778 if ( mapped ) { 6779 map.push( i ); 6780 } 6781 } 6782 } 6783 } 6784 6785 return newUnmatched; 6786} 6787 6788function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 6789 if ( postFilter && !postFilter[ expando ] ) { 6790 postFilter = setMatcher( postFilter ); 6791 } 6792 if ( postFinder && !postFinder[ expando ] ) { 6793 postFinder = setMatcher( postFinder, postSelector ); 6794 } 6795 return markFunction( function( seed, results, context, xml ) { 6796 var temp, i, elem, matcherOut, 6797 preMap = [], 6798 postMap = [], 6799 preexisting = results.length, 6800 6801 // Get initial elements from seed or context 6802 elems = seed || 6803 multipleContexts( selector || "*", 6804 context.nodeType ? [ context ] : context, [] ), 6805 6806 // Prefilter to get matcher input, preserving a map for seed-results synchronization 6807 matcherIn = preFilter && ( seed || !selector ) ? 6808 condense( elems, preMap, preFilter, context, xml ) : 6809 elems; 6810 6811 if ( matcher ) { 6812 6813 // If we have a postFinder, or filtered seed, or non-seed postFilter 6814 // or preexisting results, 6815 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 6816 6817 // ...intermediate processing is necessary 6818 [] : 6819 6820 // ...otherwise use results directly 6821 results; 6822 6823 // Find primary matches 6824 matcher( matcherIn, matcherOut, context, xml ); 6825 } else { 6826 matcherOut = matcherIn; 6827 } 6828 6829 // Apply postFilter 6830 if ( postFilter ) { 6831 temp = condense( matcherOut, postMap ); 6832 postFilter( temp, [], context, xml ); 6833 6834 // Un-match failing elements by moving them back to matcherIn 6835 i = temp.length; 6836 while ( i-- ) { 6837 if ( ( elem = temp[ i ] ) ) { 6838 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 6839 } 6840 } 6841 } 6842 6843 if ( seed ) { 6844 if ( postFinder || preFilter ) { 6845 if ( postFinder ) { 6846 6847 // Get the final matcherOut by condensing this intermediate into postFinder contexts 6848 temp = []; 6849 i = matcherOut.length; 6850 while ( i-- ) { 6851 if ( ( elem = matcherOut[ i ] ) ) { 6852 6853 // Restore matcherIn since elem is not yet a final match 6854 temp.push( ( matcherIn[ i ] = elem ) ); 6855 } 6856 } 6857 postFinder( null, ( matcherOut = [] ), temp, xml ); 6858 } 6859 6860 // Move matched elements from seed to results to keep them synchronized 6861 i = matcherOut.length; 6862 while ( i-- ) { 6863 if ( ( elem = matcherOut[ i ] ) && 6864 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { 6865 6866 seed[ temp ] = !( results[ temp ] = elem ); 6867 } 6868 } 6869 } 6870 6871 // Add elements to results, through postFinder if defined 6872 } else { 6873 matcherOut = condense( 6874 matcherOut === results ? 6875 matcherOut.splice( preexisting, matcherOut.length ) : 6876 matcherOut 6877 ); 6878 if ( postFinder ) { 6879 postFinder( null, results, matcherOut, xml ); 6880 } else { 6881 push.apply( results, matcherOut ); 6882 } 6883 } 6884 } ); 6885} 6886 6887function matcherFromTokens( tokens ) { 6888 var checkContext, matcher, j, 6889 len = tokens.length, 6890 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 6891 implicitRelative = leadingRelative || Expr.relative[ " " ], 6892 i = leadingRelative ? 1 : 0, 6893 6894 // The foundational matcher ensures that elements are reachable from top-level context(s) 6895 matchContext = addCombinator( function( elem ) { 6896 return elem === checkContext; 6897 }, implicitRelative, true ), 6898 matchAnyContext = addCombinator( function( elem ) { 6899 return indexOf.call( checkContext, elem ) > -1; 6900 }, implicitRelative, true ), 6901 matchers = [ function( elem, context, xml ) { 6902 6903 // Support: IE 11+, Edge 17 - 18+ 6904 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 6905 // two documents; shallow comparisons work. 6906 // eslint-disable-next-line eqeqeq 6907 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 6908 ( checkContext = context ).nodeType ? 6909 matchContext( elem, context, xml ) : 6910 matchAnyContext( elem, context, xml ) ); 6911 6912 // Avoid hanging onto element 6913 // (see https://github.com/jquery/sizzle/issues/299) 6914 checkContext = null; 6915 return ret; 6916 } ]; 6917 6918 for ( ; i < len; i++ ) { 6919 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 6920 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 6921 } else { 6922 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 6923 6924 // Return special upon seeing a positional matcher 6925 if ( matcher[ expando ] ) { 6926 6927 // Find the next relative operator (if any) for proper handling 6928 j = ++i; 6929 for ( ; j < len; j++ ) { 6930 if ( Expr.relative[ tokens[ j ].type ] ) { 6931 break; 6932 } 6933 } 6934 return setMatcher( 6935 i > 1 && elementMatcher( matchers ), 6936 i > 1 && toSelector( 6937 6938 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 6939 tokens.slice( 0, i - 1 ) 6940 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 6941 ).replace( rtrimCSS, "$1" ), 6942 matcher, 6943 i < j && matcherFromTokens( tokens.slice( i, j ) ), 6944 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 6945 j < len && toSelector( tokens ) 6946 ); 6947 } 6948 matchers.push( matcher ); 6949 } 6950 } 6951 6952 return elementMatcher( matchers ); 6953} 6954 6955function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 6956 var bySet = setMatchers.length > 0, 6957 byElement = elementMatchers.length > 0, 6958 superMatcher = function( seed, context, xml, results, outermost ) { 6959 var elem, j, matcher, 6960 matchedCount = 0, 6961 i = "0", 6962 unmatched = seed && [], 6963 setMatched = [], 6964 contextBackup = outermostContext, 6965 6966 // We must always have either seed elements or outermost context 6967 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 6968 6969 // Use integer dirruns iff this is the outermost matcher 6970 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 6971 len = elems.length; 6972 6973 if ( outermost ) { 6974 6975 // Support: IE 11+, Edge 17 - 18+ 6976 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 6977 // two documents; shallow comparisons work. 6978 // eslint-disable-next-line eqeqeq 6979 outermostContext = context == document || context || outermost; 6980 } 6981 6982 // Add elements passing elementMatchers directly to results 6983 // Support: iOS <=7 - 9 only 6984 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 6985 // elements by id. (see trac-14142) 6986 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 6987 if ( byElement && elem ) { 6988 j = 0; 6989 6990 // Support: IE 11+, Edge 17 - 18+ 6991 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 6992 // two documents; shallow comparisons work. 6993 // eslint-disable-next-line eqeqeq 6994 if ( !context && elem.ownerDocument != document ) { 6995 setDocument( elem ); 6996 xml = !documentIsHTML; 6997 } 6998 while ( ( matcher = elementMatchers[ j++ ] ) ) { 6999 if ( matcher( elem, context || document, xml ) ) { 7000 push.call( results, elem ); 7001 break; 7002 } 7003 } 7004 if ( outermost ) { 7005 dirruns = dirrunsUnique; 7006 } 7007 } 7008 7009 // Track unmatched elements for set filters 7010 if ( bySet ) { 7011 7012 // They will have gone through all possible matchers 7013 if ( ( elem = !matcher && elem ) ) { 7014 matchedCount--; 7015 } 7016 7017 // Lengthen the array for every element, matched or not 7018 if ( seed ) { 7019 unmatched.push( elem ); 7020 } 7021 } 7022 } 7023 7024 // `i` is now the count of elements visited above, and adding it to `matchedCount` 7025 // makes the latter nonnegative. 7026 matchedCount += i; 7027 7028 // Apply set filters to unmatched elements 7029 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 7030 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 7031 // no element matchers and no seed. 7032 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 7033 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 7034 // numerically zero. 7035 if ( bySet && i !== matchedCount ) { 7036 j = 0; 7037 while ( ( matcher = setMatchers[ j++ ] ) ) { 7038 matcher( unmatched, setMatched, context, xml ); 7039 } 7040 7041 if ( seed ) { 7042 7043 // Reintegrate element matches to eliminate the need for sorting 7044 if ( matchedCount > 0 ) { 7045 while ( i-- ) { 7046 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 7047 setMatched[ i ] = pop.call( results ); 7048 } 7049 } 7050 } 7051 7052 // Discard index placeholder values to get only actual matches 7053 setMatched = condense( setMatched ); 7054 } 7055 7056 // Add matches to results 7057 push.apply( results, setMatched ); 7058 7059 // Seedless set matches succeeding multiple successful matchers stipulate sorting 7060 if ( outermost && !seed && setMatched.length > 0 && 7061 ( matchedCount + setMatchers.length ) > 1 ) { 7062 7063 jQuery.uniqueSort( results ); 7064 } 7065 } 7066 7067 // Override manipulation of globals by nested matchers 7068 if ( outermost ) { 7069 dirruns = dirrunsUnique; 7070 outermostContext = contextBackup; 7071 } 7072 7073 return unmatched; 7074 }; 7075 7076 return bySet ? 7077 markFunction( superMatcher ) : 7078 superMatcher; 7079} 7080 7081function compile( selector, match /* Internal Use Only */ ) { 7082 var i, 7083 setMatchers = [], 7084 elementMatchers = [], 7085 cached = compilerCache[ selector + " " ]; 7086 7087 if ( !cached ) { 7088 7089 // Generate a function of recursive functions that can be used to check each element 7090 if ( !match ) { 7091 match = tokenize( selector ); 7092 } 7093 i = match.length; 7094 while ( i-- ) { 7095 cached = matcherFromTokens( match[ i ] ); 7096 if ( cached[ expando ] ) { 7097 setMatchers.push( cached ); 7098 } else { 7099 elementMatchers.push( cached ); 7100 } 7101 } 7102 7103 // Cache the compiled function 7104 cached = compilerCache( selector, 7105 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 7106 7107 // Save selector and tokenization 7108 cached.selector = selector; 7109 } 7110 return cached; 7111} 7112 7113/** 7114 * A low-level selection function that works with jQuery's compiled 7115 * selector functions 7116 * @param {String|Function} selector A selector or a pre-compiled 7117 * selector function built with jQuery selector compile 7118 * @param {Element} context 7119 * @param {Array} [results] 7120 * @param {Array} [seed] A set of elements to match against 7121 */ 7122function select( selector, context, results, seed ) { 7123 var i, tokens, token, type, find, 7124 compiled = typeof selector === "function" && selector, 7125 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 7126 7127 results = results || []; 7128 7129 // Try to minimize operations if there is only one selector in the list and no seed 7130 // (the latter of which guarantees us context) 7131 if ( match.length === 1 ) { 7132 7133 // Reduce context if the leading compound selector is an ID 7134 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 7135 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 7136 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 7137 7138 context = ( Expr.find.ID( 7139 token.matches[ 0 ].replace( runescape, funescape ), 7140 context 7141 ) || [] )[ 0 ]; 7142 if ( !context ) { 7143 return results; 7144 7145 // Precompiled matchers will still verify ancestry, so step up a level 7146 } else if ( compiled ) { 7147 context = context.parentNode; 7148 } 7149 7150 selector = selector.slice( tokens.shift().value.length ); 7151 } 7152 7153 // Fetch a seed set for right-to-left matching 7154 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 7155 while ( i-- ) { 7156 token = tokens[ i ]; 7157 7158 // Abort if we hit a combinator 7159 if ( Expr.relative[ ( type = token.type ) ] ) { 7160 break; 7161 } 7162 if ( ( find = Expr.find[ type ] ) ) { 7163 7164 // Search, expanding context for leading sibling combinators 7165 if ( ( seed = find( 7166 token.matches[ 0 ].replace( runescape, funescape ), 7167 rsibling.test( tokens[ 0 ].type ) && 7168 testContext( context.parentNode ) || context 7169 ) ) ) { 7170 7171 // If seed is empty or no tokens remain, we can return early 7172 tokens.splice( i, 1 ); 7173 selector = seed.length && toSelector( tokens ); 7174 if ( !selector ) { 7175 push.apply( results, seed ); 7176 return results; 7177 } 7178 7179 break; 7180 } 7181 } 7182 } 7183 } 7184 7185 // Compile and execute a filtering function if one is not provided 7186 // Provide `match` to avoid retokenization if we modified the selector above 7187 ( compiled || compile( selector, match ) )( 7188 seed, 7189 context, 7190 !documentIsHTML, 7191 results, 7192 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 7193 ); 7194 return results; 7195} 7196 7197// One-time assignments 7198 7199// Support: Android <=4.0 - 4.1+ 7200// Sort stability 7201support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 7202 7203// Initialize against the default document 7204setDocument(); 7205 7206// Support: Android <=4.0 - 4.1+ 7207// Detached nodes confoundingly follow *each other* 7208support.sortDetached = assert( function( el ) { 7209 7210 // Should return 1, but returns 4 (following) 7211 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 7212} ); 7213 7214jQuery.find = find; 7215 7216// Deprecated 7217jQuery.expr[ ":" ] = jQuery.expr.pseudos; 7218jQuery.unique = jQuery.uniqueSort; 7219 7220// These have always been private, but they used to be documented as part of 7221// Sizzle so let's maintain them for now for backwards compatibility purposes. 7222find.compile = compile; 7223find.select = select; 7224find.setDocument = setDocument; 7225find.tokenize = tokenize; 7226 7227find.escape = jQuery.escapeSelector; 7228find.getText = jQuery.text; 7229find.isXML = jQuery.isXMLDoc; 7230find.selectors = jQuery.expr; 7231find.support = jQuery.support; 7232find.uniqueSort = jQuery.uniqueSort; 7233 7234 /* eslint-enable */ 7235 7236} )(); 7237 7238 7239var dir = function( elem, dir, until ) { 7240 var matched = [], 7241 truncate = until !== undefined; 7242 7243 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 7244 if ( elem.nodeType === 1 ) { 7245 if ( truncate && jQuery( elem ).is( until ) ) { 7246 break; 7247 } 7248 matched.push( elem ); 7249 } 7250 } 7251 return matched; 7252}; 7253 7254 7255var siblings = function( n, elem ) { 7256 var matched = []; 7257 7258 for ( ; n; n = n.nextSibling ) { 7259 if ( n.nodeType === 1 && n !== elem ) { 7260 matched.push( n ); 7261 } 7262 } 7263 7264 return matched; 7265}; 7266 7267 7268var rneedsContext = jQuery.expr.match.needsContext; 7269 7270var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 7271 7272 7273 7274// Implement the identical functionality for filter and not 7275function winnow( elements, qualifier, not ) { 7276 if ( isFunction( qualifier ) ) { 7277 return jQuery.grep( elements, function( elem, i ) { 7278 return !!qualifier.call( elem, i, elem ) !== not; 7279 } ); 7280 } 7281 7282 // Single element 7283 if ( qualifier.nodeType ) { 7284 return jQuery.grep( elements, function( elem ) { 7285 return ( elem === qualifier ) !== not; 7286 } ); 7287 } 7288 7289 // Arraylike of elements (jQuery, arguments, Array) 7290 if ( typeof qualifier !== "string" ) { 7291 return jQuery.grep( elements, function( elem ) { 7292 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 7293 } ); 7294 } 7295 7296 // Filtered directly for both simple and complex selectors 7297 return jQuery.filter( qualifier, elements, not ); 7298} 7299 7300jQuery.filter = function( expr, elems, not ) { 7301 var elem = elems[ 0 ]; 7302 7303 if ( not ) { 7304 expr = ":not(" + expr + ")"; 7305 } 7306 7307 if ( elems.length === 1 && elem.nodeType === 1 ) { 7308 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 7309 } 7310 7311 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 7312 return elem.nodeType === 1; 7313 } ) ); 7314}; 7315 7316jQuery.fn.extend( { 7317 find: function( selector ) { 7318 var i, ret, 7319 len = this.length, 7320 self = this; 7321 7322 if ( typeof selector !== "string" ) { 7323 return this.pushStack( jQuery( selector ).filter( function() { 7324 for ( i = 0; i < len; i++ ) { 7325 if ( jQuery.contains( self[ i ], this ) ) { 7326 return true; 7327 } 7328 } 7329 } ) ); 7330 } 7331 7332 ret = this.pushStack( [] ); 7333 7334 for ( i = 0; i < len; i++ ) { 7335 jQuery.find( selector, self[ i ], ret ); 7336 } 7337 7338 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 7339 }, 7340 filter: function( selector ) { 7341 return this.pushStack( winnow( this, selector || [], false ) ); 7342 }, 7343 not: function( selector ) { 7344 return this.pushStack( winnow( this, selector || [], true ) ); 7345 }, 7346 is: function( selector ) { 7347 return !!winnow( 7348 this, 7349 7350 // If this is a positional/relative selector, check membership in the returned set 7351 // so $("p:first").is("p:last") won't return true for a doc with two "p". 7352 typeof selector === "string" && rneedsContext.test( selector ) ? 7353 jQuery( selector ) : 7354 selector || [], 7355 false 7356 ).length; 7357 } 7358} ); 7359 7360 7361// Initialize a jQuery object 7362 7363 7364// A central reference to the root jQuery(document) 7365var rootjQuery, 7366 7367 // A simple way to check for HTML strings 7368 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 7369 // Strict HTML recognition (trac-11290: must start with <) 7370 // Shortcut simple #id case for speed 7371 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 7372 7373 init = jQuery.fn.init = function( selector, context, root ) { 7374 var match, elem; 7375 7376 // HANDLE: $(""), $(null), $(undefined), $(false) 7377 if ( !selector ) { 7378 return this; 7379 } 7380 7381 // Method init() accepts an alternate rootjQuery 7382 // so migrate can support jQuery.sub (gh-2101) 7383 root = root || rootjQuery; 7384 7385 // Handle HTML strings 7386 if ( typeof selector === "string" ) { 7387 if ( selector[ 0 ] === "<" && 7388 selector[ selector.length - 1 ] === ">" && 7389 selector.length >= 3 ) { 7390 7391 // Assume that strings that start and end with <> are HTML and skip the regex check 7392 match = [ null, selector, null ]; 7393 7394 } else { 7395 match = rquickExpr.exec( selector ); 7396 } 7397 7398 // Match html or make sure no context is specified for #id 7399 if ( match && ( match[ 1 ] || !context ) ) { 7400 7401 // HANDLE: $(html) -> $(array) 7402 if ( match[ 1 ] ) { 7403 context = context instanceof jQuery ? context[ 0 ] : context; 7404 7405 // Option to run scripts is true for back-compat 7406 // Intentionally let the error be thrown if parseHTML is not present 7407 jQuery.merge( this, jQuery.parseHTML( 7408 match[ 1 ], 7409 context && context.nodeType ? context.ownerDocument || context : document, 7410 true 7411 ) ); 7412 7413 // HANDLE: $(html, props) 7414 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 7415 for ( match in context ) { 7416 7417 // Properties of context are called as methods if possible 7418 if ( isFunction( this[ match ] ) ) { 7419 this[ match ]( context[ match ] ); 7420 7421 // ...and otherwise set as attributes 7422 } else { 7423 this.attr( match, context[ match ] ); 7424 } 7425 } 7426 } 7427 7428 return this; 7429 7430 // HANDLE: $(#id) 7431 } else { 7432 elem = document.getElementById( match[ 2 ] ); 7433 7434 if ( elem ) { 7435 7436 // Inject the element directly into the jQuery object 7437 this[ 0 ] = elem; 7438 this.length = 1; 7439 } 7440 return this; 7441 } 7442 7443 // HANDLE: $(expr, $(...)) 7444 } else if ( !context || context.jquery ) { 7445 return ( context || root ).find( selector ); 7446 7447 // HANDLE: $(expr, context) 7448 // (which is just equivalent to: $(context).find(expr) 7449 } else { 7450 return this.constructor( context ).find( selector ); 7451 } 7452 7453 // HANDLE: $(DOMElement) 7454 } else if ( selector.nodeType ) { 7455 this[ 0 ] = selector; 7456 this.length = 1; 7457 return this; 7458 7459 // HANDLE: $(function) 7460 // Shortcut for document ready 7461 } else if ( isFunction( selector ) ) { 7462 return root.ready !== undefined ? 7463 root.ready( selector ) : 7464 7465 // Execute immediately if ready is not present 7466 selector( jQuery ); 7467 } 7468 7469 return jQuery.makeArray( selector, this ); 7470 }; 7471 7472// Give the init function the jQuery prototype for later instantiation 7473init.prototype = jQuery.fn; 7474 7475// Initialize central reference 7476rootjQuery = jQuery( document ); 7477 7478 7479var rparentsprev = /^(?:parents|prev(?:Until|All))/, 7480 7481 // Methods guaranteed to produce a unique set when starting from a unique set 7482 guaranteedUnique = { 7483 children: true, 7484 contents: true, 7485 next: true, 7486 prev: true 7487 }; 7488 7489jQuery.fn.extend( { 7490 has: function( target ) { 7491 var targets = jQuery( target, this ), 7492 l = targets.length; 7493 7494 return this.filter( function() { 7495 var i = 0; 7496 for ( ; i < l; i++ ) { 7497 if ( jQuery.contains( this, targets[ i ] ) ) { 7498 return true; 7499 } 7500 } 7501 } ); 7502 }, 7503 7504 closest: function( selectors, context ) { 7505 var cur, 7506 i = 0, 7507 l = this.length, 7508 matched = [], 7509 targets = typeof selectors !== "string" && jQuery( selectors ); 7510 7511 // Positional selectors never match, since there's no _selection_ context 7512 if ( !rneedsContext.test( selectors ) ) { 7513 for ( ; i < l; i++ ) { 7514 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 7515 7516 // Always skip document fragments 7517 if ( cur.nodeType < 11 && ( targets ? 7518 targets.index( cur ) > -1 : 7519 7520 // Don't pass non-elements to jQuery#find 7521 cur.nodeType === 1 && 7522 jQuery.find.matchesSelector( cur, selectors ) ) ) { 7523 7524 matched.push( cur ); 7525 break; 7526 } 7527 } 7528 } 7529 } 7530 7531 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 7532 }, 7533 7534 // Determine the position of an element within the set 7535 index: function( elem ) { 7536 7537 // No argument, return index in parent 7538 if ( !elem ) { 7539 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 7540 } 7541 7542 // Index in selector 7543 if ( typeof elem === "string" ) { 7544 return indexOf.call( jQuery( elem ), this[ 0 ] ); 7545 } 7546 7547 // Locate the position of the desired element 7548 return indexOf.call( this, 7549 7550 // If it receives a jQuery object, the first element is used 7551 elem.jquery ? elem[ 0 ] : elem 7552 ); 7553 }, 7554 7555 add: function( selector, context ) { 7556 return this.pushStack( 7557 jQuery.uniqueSort( 7558 jQuery.merge( this.get(), jQuery( selector, context ) ) 7559 ) 7560 ); 7561 }, 7562 7563 addBack: function( selector ) { 7564 return this.add( selector == null ? 7565 this.prevObject : this.prevObject.filter( selector ) 7566 ); 7567 } 7568} ); 7569 7570function sibling( cur, dir ) { 7571 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 7572 return cur; 7573} 7574 7575jQuery.each( { 7576 parent: function( elem ) { 7577 var parent = elem.parentNode; 7578 return parent && parent.nodeType !== 11 ? parent : null; 7579 }, 7580 parents: function( elem ) { 7581 return dir( elem, "parentNode" ); 7582 }, 7583 parentsUntil: function( elem, _i, until ) { 7584 return dir( elem, "parentNode", until ); 7585 }, 7586 next: function( elem ) { 7587 return sibling( elem, "nextSibling" ); 7588 }, 7589 prev: function( elem ) { 7590 return sibling( elem, "previousSibling" ); 7591 }, 7592 nextAll: function( elem ) { 7593 return dir( elem, "nextSibling" ); 7594 }, 7595 prevAll: function( elem ) { 7596 return dir( elem, "previousSibling" ); 7597 }, 7598 nextUntil: function( elem, _i, until ) { 7599 return dir( elem, "nextSibling", until ); 7600 }, 7601 prevUntil: function( elem, _i, until ) { 7602 return dir( elem, "previousSibling", until ); 7603 }, 7604 siblings: function( elem ) { 7605 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 7606 }, 7607 children: function( elem ) { 7608 return siblings( elem.firstChild ); 7609 }, 7610 contents: function( elem ) { 7611 if ( elem.contentDocument != null && 7612 7613 // Support: IE 11+ 7614 // <object> elements with no `data` attribute has an object 7615 // `contentDocument` with a `null` prototype. 7616 getProto( elem.contentDocument ) ) { 7617 7618 return elem.contentDocument; 7619 } 7620 7621 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 7622 // Treat the template element as a regular one in browsers that 7623 // don't support it. 7624 if ( nodeName( elem, "template" ) ) { 7625 elem = elem.content || elem; 7626 } 7627 7628 return jQuery.merge( [], elem.childNodes ); 7629 } 7630}, function( name, fn ) { 7631 jQuery.fn[ name ] = function( until, selector ) { 7632 var matched = jQuery.map( this, fn, until ); 7633 7634 if ( name.slice( -5 ) !== "Until" ) { 7635 selector = until; 7636 } 7637 7638 if ( selector && typeof selector === "string" ) { 7639 matched = jQuery.filter( selector, matched ); 7640 } 7641 7642 if ( this.length > 1 ) { 7643 7644 // Remove duplicates 7645 if ( !guaranteedUnique[ name ] ) { 7646 jQuery.uniqueSort( matched ); 7647 } 7648 7649 // Reverse order for parents* and prev-derivatives 7650 if ( rparentsprev.test( name ) ) { 7651 matched.reverse(); 7652 } 7653 } 7654 7655 return this.pushStack( matched ); 7656 }; 7657} ); 7658var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 7659 7660 7661 7662// Convert String-formatted options into Object-formatted ones 7663function createOptions( options ) { 7664 var object = {}; 7665 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 7666 object[ flag ] = true; 7667 } ); 7668 return object; 7669} 7670 7671/* 7672 * Create a callback list using the following parameters: 7673 * 7674 * options: an optional list of space-separated options that will change how 7675 * the callback list behaves or a more traditional option object 7676 * 7677 * By default a callback list will act like an event callback list and can be 7678 * "fired" multiple times. 7679 * 7680 * Possible options: 7681 * 7682 * once: will ensure the callback list can only be fired once (like a Deferred) 7683 * 7684 * memory: will keep track of previous values and will call any callback added 7685 * after the list has been fired right away with the latest "memorized" 7686 * values (like a Deferred) 7687 * 7688 * unique: will ensure a callback can only be added once (no duplicate in the list) 7689 * 7690 * stopOnFalse: interrupt callings when a callback returns false 7691 * 7692 */ 7693jQuery.Callbacks = function( options ) { 7694 7695 // Convert options from String-formatted to Object-formatted if needed 7696 // (we check in cache first) 7697 options = typeof options === "string" ? 7698 createOptions( options ) : 7699 jQuery.extend( {}, options ); 7700 7701 var // Flag to know if list is currently firing 7702 firing, 7703 7704 // Last fire value for non-forgettable lists 7705 memory, 7706 7707 // Flag to know if list was already fired 7708 fired, 7709 7710 // Flag to prevent firing 7711 locked, 7712 7713 // Actual callback list 7714 list = [], 7715 7716 // Queue of execution data for repeatable lists 7717 queue = [], 7718 7719 // Index of currently firing callback (modified by add/remove as needed) 7720 firingIndex = -1, 7721 7722 // Fire callbacks 7723 fire = function() { 7724 7725 // Enforce single-firing 7726 locked = locked || options.once; 7727 7728 // Execute callbacks for all pending executions, 7729 // respecting firingIndex overrides and runtime changes 7730 fired = firing = true; 7731 for ( ; queue.length; firingIndex = -1 ) { 7732 memory = queue.shift(); 7733 while ( ++firingIndex < list.length ) { 7734 7735 // Run callback and check for early termination 7736 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 7737 options.stopOnFalse ) { 7738 7739 // Jump to end and forget the data so .add doesn't re-fire 7740 firingIndex = list.length; 7741 memory = false; 7742 } 7743 } 7744 } 7745 7746 // Forget the data if we're done with it 7747 if ( !options.memory ) { 7748 memory = false; 7749 } 7750 7751 firing = false; 7752 7753 // Clean up if we're done firing for good 7754 if ( locked ) { 7755 7756 // Keep an empty list if we have data for future add calls 7757 if ( memory ) { 7758 list = []; 7759 7760 // Otherwise, this object is spent 7761 } else { 7762 list = ""; 7763 } 7764 } 7765 }, 7766 7767 // Actual Callbacks object 7768 self = { 7769 7770 // Add a callback or a collection of callbacks to the list 7771 add: function() { 7772 if ( list ) { 7773 7774 // If we have memory from a past run, we should fire after adding 7775 if ( memory && !firing ) { 7776 firingIndex = list.length - 1; 7777 queue.push( memory ); 7778 } 7779 7780 ( function add( args ) { 7781 jQuery.each( args, function( _, arg ) { 7782 if ( isFunction( arg ) ) { 7783 if ( !options.unique || !self.has( arg ) ) { 7784 list.push( arg ); 7785 } 7786 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 7787 7788 // Inspect recursively 7789 add( arg ); 7790 } 7791 } ); 7792 } )( arguments ); 7793 7794 if ( memory && !firing ) { 7795 fire(); 7796 } 7797 } 7798 return this; 7799 }, 7800 7801 // Remove a callback from the list 7802 remove: function() { 7803 jQuery.each( arguments, function( _, arg ) { 7804 var index; 7805 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 7806 list.splice( index, 1 ); 7807 7808 // Handle firing indexes 7809 if ( index <= firingIndex ) { 7810 firingIndex--; 7811 } 7812 } 7813 } ); 7814 return this; 7815 }, 7816 7817 // Check if a given callback is in the list. 7818 // If no argument is given, return whether or not list has callbacks attached. 7819 has: function( fn ) { 7820 return fn ? 7821 jQuery.inArray( fn, list ) > -1 : 7822 list.length > 0; 7823 }, 7824 7825 // Remove all callbacks from the list 7826 empty: function() { 7827 if ( list ) { 7828 list = []; 7829 } 7830 return this; 7831 }, 7832 7833 // Disable .fire and .add 7834 // Abort any current/pending executions 7835 // Clear all callbacks and values 7836 disable: function() { 7837 locked = queue = []; 7838 list = memory = ""; 7839 return this; 7840 }, 7841 disabled: function() { 7842 return !list; 7843 }, 7844 7845 // Disable .fire 7846 // Also disable .add unless we have memory (since it would have no effect) 7847 // Abort any pending executions 7848 lock: function() { 7849 locked = queue = []; 7850 if ( !memory && !firing ) { 7851 list = memory = ""; 7852 } 7853 return this; 7854 }, 7855 locked: function() { 7856 return !!locked; 7857 }, 7858 7859 // Call all callbacks with the given context and arguments 7860 fireWith: function( context, args ) { 7861 if ( !locked ) { 7862 args = args || []; 7863 args = [ context, args.slice ? args.slice() : args ]; 7864 queue.push( args ); 7865 if ( !firing ) { 7866 fire(); 7867 } 7868 } 7869 return this; 7870 }, 7871 7872 // Call all the callbacks with the given arguments 7873 fire: function() { 7874 self.fireWith( this, arguments ); 7875 return this; 7876 }, 7877 7878 // To know if the callbacks have already been called at least once 7879 fired: function() { 7880 return !!fired; 7881 } 7882 }; 7883 7884 return self; 7885}; 7886 7887 7888function Identity( v ) { 7889 return v; 7890} 7891function Thrower( ex ) { 7892 throw ex; 7893} 7894 7895function adoptValue( value, resolve, reject, noValue ) { 7896 var method; 7897 7898 try { 7899 7900 // Check for promise aspect first to privilege synchronous behavior 7901 if ( value && isFunction( ( method = value.promise ) ) ) { 7902 method.call( value ).done( resolve ).fail( reject ); 7903 7904 // Other thenables 7905 } else if ( value && isFunction( ( method = value.then ) ) ) { 7906 method.call( value, resolve, reject ); 7907 7908 // Other non-thenables 7909 } else { 7910 7911 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 7912 // * false: [ value ].slice( 0 ) => resolve( value ) 7913 // * true: [ value ].slice( 1 ) => resolve() 7914 resolve.apply( undefined, [ value ].slice( noValue ) ); 7915 } 7916 7917 // For Promises/A+, convert exceptions into rejections 7918 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 7919 // Deferred#then to conditionally suppress rejection. 7920 } catch ( value ) { 7921 7922 // Support: Android 4.0 only 7923 // Strict mode functions invoked without .call/.apply get global-object context 7924 reject.apply( undefined, [ value ] ); 7925 } 7926} 7927 7928jQuery.extend( { 7929 7930 Deferred: function( func ) { 7931 var tuples = [ 7932 7933 // action, add listener, callbacks, 7934 // ... .then handlers, argument index, [final state] 7935 [ "notify", "progress", jQuery.Callbacks( "memory" ), 7936 jQuery.Callbacks( "memory" ), 2 ], 7937 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 7938 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 7939 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 7940 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 7941 ], 7942 state = "pending", 7943 promise = { 7944 state: function() { 7945 return state; 7946 }, 7947 always: function() { 7948 deferred.done( arguments ).fail( arguments ); 7949 return this; 7950 }, 7951 "catch": function( fn ) { 7952 return promise.then( null, fn ); 7953 }, 7954 7955 // Keep pipe for back-compat 7956 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 7957 var fns = arguments; 7958 7959 return jQuery.Deferred( function( newDefer ) { 7960 jQuery.each( tuples, function( _i, tuple ) { 7961 7962 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 7963 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 7964 7965 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 7966 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 7967 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 7968 deferred[ tuple[ 1 ] ]( function() { 7969 var returned = fn && fn.apply( this, arguments ); 7970 if ( returned && isFunction( returned.promise ) ) { 7971 returned.promise() 7972 .progress( newDefer.notify ) 7973 .done( newDefer.resolve ) 7974 .fail( newDefer.reject ); 7975 } else { 7976 newDefer[ tuple[ 0 ] + "With" ]( 7977 this, 7978 fn ? [ returned ] : arguments 7979 ); 7980 } 7981 } ); 7982 } ); 7983 fns = null; 7984 } ).promise(); 7985 }, 7986 then: function( onFulfilled, onRejected, onProgress ) { 7987 var maxDepth = 0; 7988 function resolve( depth, deferred, handler, special ) { 7989 return function() { 7990 var that = this, 7991 args = arguments, 7992 mightThrow = function() { 7993 var returned, then; 7994 7995 // Support: Promises/A+ section 2.3.3.3.3 7996 // https://promisesaplus.com/#point-59 7997 // Ignore double-resolution attempts 7998 if ( depth < maxDepth ) { 7999 return; 8000 } 8001 8002 returned = handler.apply( that, args ); 8003 8004 // Support: Promises/A+ section 2.3.1 8005 // https://promisesaplus.com/#point-48 8006 if ( returned === deferred.promise() ) { 8007 throw new TypeError( "Thenable self-resolution" ); 8008 } 8009 8010 // Support: Promises/A+ sections 2.3.3.1, 3.5 8011 // https://promisesaplus.com/#point-54 8012 // https://promisesaplus.com/#point-75 8013 // Retrieve `then` only once 8014 then = returned && 8015 8016 // Support: Promises/A+ section 2.3.4 8017 // https://promisesaplus.com/#point-64 8018 // Only check objects and functions for thenability 8019 ( typeof returned === "object" || 8020 typeof returned === "function" ) && 8021 returned.then; 8022 8023 // Handle a returned thenable 8024 if ( isFunction( then ) ) { 8025 8026 // Special processors (notify) just wait for resolution 8027 if ( special ) { 8028 then.call( 8029 returned, 8030 resolve( maxDepth, deferred, Identity, special ), 8031 resolve( maxDepth, deferred, Thrower, special ) 8032 ); 8033 8034 // Normal processors (resolve) also hook into progress 8035 } else { 8036 8037 // ...and disregard older resolution values 8038 maxDepth++; 8039 8040 then.call( 8041 returned, 8042 resolve( maxDepth, deferred, Identity, special ), 8043 resolve( maxDepth, deferred, Thrower, special ), 8044 resolve( maxDepth, deferred, Identity, 8045 deferred.notifyWith ) 8046 ); 8047 } 8048 8049 // Handle all other returned values 8050 } else { 8051 8052 // Only substitute handlers pass on context 8053 // and multiple values (non-spec behavior) 8054 if ( handler !== Identity ) { 8055 that = undefined; 8056 args = [ returned ]; 8057 } 8058 8059 // Process the value(s) 8060 // Default process is resolve 8061 ( special || deferred.resolveWith )( that, args ); 8062 } 8063 }, 8064 8065 // Only normal processors (resolve) catch and reject exceptions 8066 process = special ? 8067 mightThrow : 8068 function() { 8069 try { 8070 mightThrow(); 8071 } catch ( e ) { 8072 8073 if ( jQuery.Deferred.exceptionHook ) { 8074 jQuery.Deferred.exceptionHook( e, 8075 process.error ); 8076 } 8077 8078 // Support: Promises/A+ section 2.3.3.3.4.1 8079 // https://promisesaplus.com/#point-61 8080 // Ignore post-resolution exceptions 8081 if ( depth + 1 >= maxDepth ) { 8082 8083 // Only substitute handlers pass on context 8084 // and multiple values (non-spec behavior) 8085 if ( handler !== Thrower ) { 8086 that = undefined; 8087 args = [ e ]; 8088 } 8089 8090 deferred.rejectWith( that, args ); 8091 } 8092 } 8093 }; 8094 8095 // Support: Promises/A+ section 2.3.3.3.1 8096 // https://promisesaplus.com/#point-57 8097 // Re-resolve promises immediately to dodge false rejection from 8098 // subsequent errors 8099 if ( depth ) { 8100 process(); 8101 } else { 8102 8103 // Call an optional hook to record the error, in case of exception 8104 // since it's otherwise lost when execution goes async 8105 if ( jQuery.Deferred.getErrorHook ) { 8106 process.error = jQuery.Deferred.getErrorHook(); 8107 8108 // The deprecated alias of the above. While the name suggests 8109 // returning the stack, not an error instance, jQuery just passes 8110 // it directly to `console.warn` so both will work; an instance 8111 // just better cooperates with source maps. 8112 } else if ( jQuery.Deferred.getStackHook ) { 8113 process.error = jQuery.Deferred.getStackHook(); 8114 } 8115 window.setTimeout( process ); 8116 } 8117 }; 8118 } 8119 8120 return jQuery.Deferred( function( newDefer ) { 8121 8122 // progress_handlers.add( ... ) 8123 tuples[ 0 ][ 3 ].add( 8124 resolve( 8125 0, 8126 newDefer, 8127 isFunction( onProgress ) ? 8128 onProgress : 8129 Identity, 8130 newDefer.notifyWith 8131 ) 8132 ); 8133 8134 // fulfilled_handlers.add( ... ) 8135 tuples[ 1 ][ 3 ].add( 8136 resolve( 8137 0, 8138 newDefer, 8139 isFunction( onFulfilled ) ? 8140 onFulfilled : 8141 Identity 8142 ) 8143 ); 8144 8145 // rejected_handlers.add( ... ) 8146 tuples[ 2 ][ 3 ].add( 8147 resolve( 8148 0, 8149 newDefer, 8150 isFunction( onRejected ) ? 8151 onRejected : 8152 Thrower 8153 ) 8154 ); 8155 } ).promise(); 8156 }, 8157 8158 // Get a promise for this deferred 8159 // If obj is provided, the promise aspect is added to the object 8160 promise: function( obj ) { 8161 return obj != null ? jQuery.extend( obj, promise ) : promise; 8162 } 8163 }, 8164 deferred = {}; 8165 8166 // Add list-specific methods 8167 jQuery.each( tuples, function( i, tuple ) { 8168 var list = tuple[ 2 ], 8169 stateString = tuple[ 5 ]; 8170 8171 // promise.progress = list.add 8172 // promise.done = list.add 8173 // promise.fail = list.add 8174 promise[ tuple[ 1 ] ] = list.add; 8175 8176 // Handle state 8177 if ( stateString ) { 8178 list.add( 8179 function() { 8180 8181 // state = "resolved" (i.e., fulfilled) 8182 // state = "rejected" 8183 state = stateString; 8184 }, 8185 8186 // rejected_callbacks.disable 8187 // fulfilled_callbacks.disable 8188 tuples[ 3 - i ][ 2 ].disable, 8189 8190 // rejected_handlers.disable 8191 // fulfilled_handlers.disable 8192 tuples[ 3 - i ][ 3 ].disable, 8193 8194 // progress_callbacks.lock 8195 tuples[ 0 ][ 2 ].lock, 8196 8197 // progress_handlers.lock 8198 tuples[ 0 ][ 3 ].lock 8199 ); 8200 } 8201 8202 // progress_handlers.fire 8203 // fulfilled_handlers.fire 8204 // rejected_handlers.fire 8205 list.add( tuple[ 3 ].fire ); 8206 8207 // deferred.notify = function() { deferred.notifyWith(...) } 8208 // deferred.resolve = function() { deferred.resolveWith(...) } 8209 // deferred.reject = function() { deferred.rejectWith(...) } 8210 deferred[ tuple[ 0 ] ] = function() { 8211 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 8212 return this; 8213 }; 8214 8215 // deferred.notifyWith = list.fireWith 8216 // deferred.resolveWith = list.fireWith 8217 // deferred.rejectWith = list.fireWith 8218 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 8219 } ); 8220 8221 // Make the deferred a promise 8222 promise.promise( deferred ); 8223 8224 // Call given func if any 8225 if ( func ) { 8226 func.call( deferred, deferred ); 8227 } 8228 8229 // All done! 8230 return deferred; 8231 }, 8232 8233 // Deferred helper 8234 when: function( singleValue ) { 8235 var 8236 8237 // count of uncompleted subordinates 8238 remaining = arguments.length, 8239 8240 // count of unprocessed arguments 8241 i = remaining, 8242 8243 // subordinate fulfillment data 8244 resolveContexts = Array( i ), 8245 resolveValues = slice.call( arguments ), 8246 8247 // the primary Deferred 8248 primary = jQuery.Deferred(), 8249 8250 // subordinate callback factory 8251 updateFunc = function( i ) { 8252 return function( value ) { 8253 resolveContexts[ i ] = this; 8254 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 8255 if ( !( --remaining ) ) { 8256 primary.resolveWith( resolveContexts, resolveValues ); 8257 } 8258 }; 8259 }; 8260 8261 // Single- and empty arguments are adopted like Promise.resolve 8262 if ( remaining <= 1 ) { 8263 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 8264 !remaining ); 8265 8266 // Use .then() to unwrap secondary thenables (cf. gh-3000) 8267 if ( primary.state() === "pending" || 8268 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 8269 8270 return primary.then(); 8271 } 8272 } 8273 8274 // Multiple arguments are aggregated like Promise.all array elements 8275 while ( i-- ) { 8276 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 8277 } 8278 8279 return primary.promise(); 8280 } 8281} ); 8282 8283 8284// These usually indicate a programmer mistake during development, 8285// warn about them ASAP rather than swallowing them by default. 8286var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 8287 8288// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 8289// captured before the async barrier to get the original error cause 8290// which may otherwise be hidden. 8291jQuery.Deferred.exceptionHook = function( error, asyncError ) { 8292 8293 // Support: IE 8 - 9 only 8294 // Console exists when dev tools are open, which can happen at any time 8295 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 8296 window.console.warn( "jQuery.Deferred exception: " + error.message, 8297 error.stack, asyncError ); 8298 } 8299}; 8300 8301 8302 8303 8304jQuery.readyException = function( error ) { 8305 window.setTimeout( function() { 8306 throw error; 8307 } ); 8308}; 8309 8310 8311 8312 8313// The deferred used on DOM ready 8314var readyList = jQuery.Deferred(); 8315 8316jQuery.fn.ready = function( fn ) { 8317 8318 readyList 8319 .then( fn ) 8320 8321 // Wrap jQuery.readyException in a function so that the lookup 8322 // happens at the time of error handling instead of callback 8323 // registration. 8324 .catch( function( error ) { 8325 jQuery.readyException( error ); 8326 } ); 8327 8328 return this; 8329}; 8330 8331jQuery.extend( { 8332 8333 // Is the DOM ready to be used? Set to true once it occurs. 8334 isReady: false, 8335 8336 // A counter to track how many items to wait for before 8337 // the ready event fires. See trac-6781 8338 readyWait: 1, 8339 8340 // Handle when the DOM is ready 8341 ready: function( wait ) { 8342 8343 // Abort if there are pending holds or we're already ready 8344 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 8345 return; 8346 } 8347 8348 // Remember that the DOM is ready 8349 jQuery.isReady = true; 8350 8351 // If a normal DOM Ready event fired, decrement, and wait if need be 8352 if ( wait !== true && --jQuery.readyWait > 0 ) { 8353 return; 8354 } 8355 8356 // If there are functions bound, to execute 8357 readyList.resolveWith( document, [ jQuery ] ); 8358 } 8359} ); 8360 8361jQuery.ready.then = readyList.then; 8362 8363// The ready event handler and self cleanup method 8364function completed() { 8365 document.removeEventListener( "DOMContentLoaded", completed ); 8366 window.removeEventListener( "load", completed ); 8367 jQuery.ready(); 8368} 8369 8370// Catch cases where $(document).ready() is called 8371// after the browser event has already occurred. 8372// Support: IE <=9 - 10 only 8373// Older IE sometimes signals "interactive" too soon 8374if ( document.readyState === "complete" || 8375 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 8376 8377 // Handle it asynchronously to allow scripts the opportunity to delay ready 8378 window.setTimeout( jQuery.ready ); 8379 8380} else { 8381 8382 // Use the handy event callback 8383 document.addEventListener( "DOMContentLoaded", completed ); 8384 8385 // A fallback to window.onload, that will always work 8386 window.addEventListener( "load", completed ); 8387} 8388 8389 8390 8391 8392// Multifunctional method to get and set values of a collection 8393// The value/s can optionally be executed if it's a function 8394var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 8395 var i = 0, 8396 len = elems.length, 8397 bulk = key == null; 8398 8399 // Sets many values 8400 if ( toType( key ) === "object" ) { 8401 chainable = true; 8402 for ( i in key ) { 8403 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 8404 } 8405 8406 // Sets one value 8407 } else if ( value !== undefined ) { 8408 chainable = true; 8409 8410 if ( !isFunction( value ) ) { 8411 raw = true; 8412 } 8413 8414 if ( bulk ) { 8415 8416 // Bulk operations run against the entire set 8417 if ( raw ) { 8418 fn.call( elems, value ); 8419 fn = null; 8420 8421 // ...except when executing function values 8422 } else { 8423 bulk = fn; 8424 fn = function( elem, _key, value ) { 8425 return bulk.call( jQuery( elem ), value ); 8426 }; 8427 } 8428 } 8429 8430 if ( fn ) { 8431 for ( ; i < len; i++ ) { 8432 fn( 8433 elems[ i ], key, raw ? 8434 value : 8435 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 8436 ); 8437 } 8438 } 8439 } 8440 8441 if ( chainable ) { 8442 return elems; 8443 } 8444 8445 // Gets 8446 if ( bulk ) { 8447 return fn.call( elems ); 8448 } 8449 8450 return len ? fn( elems[ 0 ], key ) : emptyGet; 8451}; 8452 8453 8454// Matches dashed string for camelizing 8455var rmsPrefix = /^-ms-/, 8456 rdashAlpha = /-([a-z])/g; 8457 8458// Used by camelCase as callback to replace() 8459function fcamelCase( _all, letter ) { 8460 return letter.toUpperCase(); 8461} 8462 8463// Convert dashed to camelCase; used by the css and data modules 8464// Support: IE <=9 - 11, Edge 12 - 15 8465// Microsoft forgot to hump their vendor prefix (trac-9572) 8466function camelCase( string ) { 8467 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 8468} 8469var acceptData = function( owner ) { 8470 8471 // Accepts only: 8472 // - Node 8473 // - Node.ELEMENT_NODE 8474 // - Node.DOCUMENT_NODE 8475 // - Object 8476 // - Any 8477 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 8478}; 8479 8480 8481 8482 8483function Data() { 8484 this.expando = jQuery.expando + Data.uid++; 8485} 8486 8487Data.uid = 1; 8488 8489Data.prototype = { 8490 8491 cache: function( owner ) { 8492 8493 // Check if the owner object already has a cache 8494 var value = owner[ this.expando ]; 8495 8496 // If not, create one 8497 if ( !value ) { 8498 value = {}; 8499 8500 // We can accept data for non-element nodes in modern browsers, 8501 // but we should not, see trac-8335. 8502 // Always return an empty object. 8503 if ( acceptData( owner ) ) { 8504 8505 // If it is a node unlikely to be stringify-ed or looped over 8506 // use plain assignment 8507 if ( owner.nodeType ) { 8508 owner[ this.expando ] = value; 8509 8510 // Otherwise secure it in a non-enumerable property 8511 // configurable must be true to allow the property to be 8512 // deleted when data is removed 8513 } else { 8514 Object.defineProperty( owner, this.expando, { 8515 value: value, 8516 configurable: true 8517 } ); 8518 } 8519 } 8520 } 8521 8522 return value; 8523 }, 8524 set: function( owner, data, value ) { 8525 var prop, 8526 cache = this.cache( owner ); 8527 8528 // Handle: [ owner, key, value ] args 8529 // Always use camelCase key (gh-2257) 8530 if ( typeof data === "string" ) { 8531 cache[ camelCase( data ) ] = value; 8532 8533 // Handle: [ owner, { properties } ] args 8534 } else { 8535 8536 // Copy the properties one-by-one to the cache object 8537 for ( prop in data ) { 8538 cache[ camelCase( prop ) ] = data[ prop ]; 8539 } 8540 } 8541 return cache; 8542 }, 8543 get: function( owner, key ) { 8544 return key === undefined ? 8545 this.cache( owner ) : 8546 8547 // Always use camelCase key (gh-2257) 8548 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 8549 }, 8550 access: function( owner, key, value ) { 8551 8552 // In cases where either: 8553 // 8554 // 1. No key was specified 8555 // 2. A string key was specified, but no value provided 8556 // 8557 // Take the "read" path and allow the get method to determine 8558 // which value to return, respectively either: 8559 // 8560 // 1. The entire cache object 8561 // 2. The data stored at the key 8562 // 8563 if ( key === undefined || 8564 ( ( key && typeof key === "string" ) && value === undefined ) ) { 8565 8566 return this.get( owner, key ); 8567 } 8568 8569 // When the key is not a string, or both a key and value 8570 // are specified, set or extend (existing objects) with either: 8571 // 8572 // 1. An object of properties 8573 // 2. A key and value 8574 // 8575 this.set( owner, key, value ); 8576 8577 // Since the "set" path can have two possible entry points 8578 // return the expected data based on which path was taken[*] 8579 return value !== undefined ? value : key; 8580 }, 8581 remove: function( owner, key ) { 8582 var i, 8583 cache = owner[ this.expando ]; 8584 8585 if ( cache === undefined ) { 8586 return; 8587 } 8588 8589 if ( key !== undefined ) { 8590 8591 // Support array or space separated string of keys 8592 if ( Array.isArray( key ) ) { 8593 8594 // If key is an array of keys... 8595 // We always set camelCase keys, so remove that. 8596 key = key.map( camelCase ); 8597 } else { 8598 key = camelCase( key ); 8599 8600 // If a key with the spaces exists, use it. 8601 // Otherwise, create an array by matching non-whitespace 8602 key = key in cache ? 8603 [ key ] : 8604 ( key.match( rnothtmlwhite ) || [] ); 8605 } 8606 8607 i = key.length; 8608 8609 while ( i-- ) { 8610 delete cache[ key[ i ] ]; 8611 } 8612 } 8613 8614 // Remove the expando if there's no more data 8615 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 8616 8617 // Support: Chrome <=35 - 45 8618 // Webkit & Blink performance suffers when deleting properties 8619 // from DOM nodes, so set to undefined instead 8620 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 8621 if ( owner.nodeType ) { 8622 owner[ this.expando ] = undefined; 8623 } else { 8624 delete owner[ this.expando ]; 8625 } 8626 } 8627 }, 8628 hasData: function( owner ) { 8629 var cache = owner[ this.expando ]; 8630 return cache !== undefined && !jQuery.isEmptyObject( cache ); 8631 } 8632}; 8633var dataPriv = new Data(); 8634 8635var dataUser = new Data(); 8636 8637 8638 8639// Implementation Summary 8640// 8641// 1. Enforce API surface and semantic compatibility with 1.9.x branch 8642// 2. Improve the module's maintainability by reducing the storage 8643// paths to a single mechanism. 8644// 3. Use the same single mechanism to support "private" and "user" data. 8645// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 8646// 5. Avoid exposing implementation details on user objects (eg. expando properties) 8647// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 8648 8649var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 8650 rmultiDash = /[A-Z]/g; 8651 8652function getData( data ) { 8653 if ( data === "true" ) { 8654 return true; 8655 } 8656 8657 if ( data === "false" ) { 8658 return false; 8659 } 8660 8661 if ( data === "null" ) { 8662 return null; 8663 } 8664 8665 // Only convert to a number if it doesn't change the string 8666 if ( data === +data + "" ) { 8667 return +data; 8668 } 8669 8670 if ( rbrace.test( data ) ) { 8671 return JSON.parse( data ); 8672 } 8673 8674 return data; 8675} 8676 8677function dataAttr( elem, key, data ) { 8678 var name; 8679 8680 // If nothing was found internally, try to fetch any 8681 // data from the HTML5 data-* attribute 8682 if ( data === undefined && elem.nodeType === 1 ) { 8683 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 8684 data = elem.getAttribute( name ); 8685 8686 if ( typeof data === "string" ) { 8687 try { 8688 data = getData( data ); 8689 } catch ( e ) {} 8690 8691 // Make sure we set the data so it isn't changed later 8692 dataUser.set( elem, key, data ); 8693 } else { 8694 data = undefined; 8695 } 8696 } 8697 return data; 8698} 8699 8700jQuery.extend( { 8701 hasData: function( elem ) { 8702 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 8703 }, 8704 8705 data: function( elem, name, data ) { 8706 return dataUser.access( elem, name, data ); 8707 }, 8708 8709 removeData: function( elem, name ) { 8710 dataUser.remove( elem, name ); 8711 }, 8712 8713 // TODO: Now that all calls to _data and _removeData have been replaced 8714 // with direct calls to dataPriv methods, these can be deprecated. 8715 _data: function( elem, name, data ) { 8716 return dataPriv.access( elem, name, data ); 8717 }, 8718 8719 _removeData: function( elem, name ) { 8720 dataPriv.remove( elem, name ); 8721 } 8722} ); 8723 8724jQuery.fn.extend( { 8725 data: function( key, value ) { 8726 var i, name, data, 8727 elem = this[ 0 ], 8728 attrs = elem && elem.attributes; 8729 8730 // Gets all values 8731 if ( key === undefined ) { 8732 if ( this.length ) { 8733 data = dataUser.get( elem ); 8734 8735 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 8736 i = attrs.length; 8737 while ( i-- ) { 8738 8739 // Support: IE 11 only 8740 // The attrs elements can be null (trac-14894) 8741 if ( attrs[ i ] ) { 8742 name = attrs[ i ].name; 8743 if ( name.indexOf( "data-" ) === 0 ) { 8744 name = camelCase( name.slice( 5 ) ); 8745 dataAttr( elem, name, data[ name ] ); 8746 } 8747 } 8748 } 8749 dataPriv.set( elem, "hasDataAttrs", true ); 8750 } 8751 } 8752 8753 return data; 8754 } 8755 8756 // Sets multiple values 8757 if ( typeof key === "object" ) { 8758 return this.each( function() { 8759 dataUser.set( this, key ); 8760 } ); 8761 } 8762 8763 return access( this, function( value ) { 8764 var data; 8765 8766 // The calling jQuery object (element matches) is not empty 8767 // (and therefore has an element appears at this[ 0 ]) and the 8768 // `value` parameter was not undefined. An empty jQuery object 8769 // will result in `undefined` for elem = this[ 0 ] which will 8770 // throw an exception if an attempt to read a data cache is made. 8771 if ( elem && value === undefined ) { 8772 8773 // Attempt to get data from the cache 8774 // The key will always be camelCased in Data 8775 data = dataUser.get( elem, key ); 8776 if ( data !== undefined ) { 8777 return data; 8778 } 8779 8780 // Attempt to "discover" the data in 8781 // HTML5 custom data-* attrs 8782 data = dataAttr( elem, key ); 8783 if ( data !== undefined ) { 8784 return data; 8785 } 8786 8787 // We tried really hard, but the data doesn't exist. 8788 return; 8789 } 8790 8791 // Set the data... 8792 this.each( function() { 8793 8794 // We always store the camelCased key 8795 dataUser.set( this, key, value ); 8796 } ); 8797 }, null, value, arguments.length > 1, null, true ); 8798 }, 8799 8800 removeData: function( key ) { 8801 return this.each( function() { 8802 dataUser.remove( this, key ); 8803 } ); 8804 } 8805} ); 8806 8807 8808jQuery.extend( { 8809 queue: function( elem, type, data ) { 8810 var queue; 8811 8812 if ( elem ) { 8813 type = ( type || "fx" ) + "queue"; 8814 queue = dataPriv.get( elem, type ); 8815 8816 // Speed up dequeue by getting out quickly if this is just a lookup 8817 if ( data ) { 8818 if ( !queue || Array.isArray( data ) ) { 8819 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 8820 } else { 8821 queue.push( data ); 8822 } 8823 } 8824 return queue || []; 8825 } 8826 }, 8827 8828 dequeue: function( elem, type ) { 8829 type = type || "fx"; 8830 8831 var queue = jQuery.queue( elem, type ), 8832 startLength = queue.length, 8833 fn = queue.shift(), 8834 hooks = jQuery._queueHooks( elem, type ), 8835 next = function() { 8836 jQuery.dequeue( elem, type ); 8837 }; 8838 8839 // If the fx queue is dequeued, always remove the progress sentinel 8840 if ( fn === "inprogress" ) { 8841 fn = queue.shift(); 8842 startLength--; 8843 } 8844 8845 if ( fn ) { 8846 8847 // Add a progress sentinel to prevent the fx queue from being 8848 // automatically dequeued 8849 if ( type === "fx" ) { 8850 queue.unshift( "inprogress" ); 8851 } 8852 8853 // Clear up the last queue stop function 8854 delete hooks.stop; 8855 fn.call( elem, next, hooks ); 8856 } 8857 8858 if ( !startLength && hooks ) { 8859 hooks.empty.fire(); 8860 } 8861 }, 8862 8863 // Not public - generate a queueHooks object, or return the current one 8864 _queueHooks: function( elem, type ) { 8865 var key = type + "queueHooks"; 8866 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 8867 empty: jQuery.Callbacks( "once memory" ).add( function() { 8868 dataPriv.remove( elem, [ type + "queue", key ] ); 8869 } ) 8870 } ); 8871 } 8872} ); 8873 8874jQuery.fn.extend( { 8875 queue: function( type, data ) { 8876 var setter = 2; 8877 8878 if ( typeof type !== "string" ) { 8879 data = type; 8880 type = "fx"; 8881 setter--; 8882 } 8883 8884 if ( arguments.length < setter ) { 8885 return jQuery.queue( this[ 0 ], type ); 8886 } 8887 8888 return data === undefined ? 8889 this : 8890 this.each( function() { 8891 var queue = jQuery.queue( this, type, data ); 8892 8893 // Ensure a hooks for this queue 8894 jQuery._queueHooks( this, type ); 8895 8896 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 8897 jQuery.dequeue( this, type ); 8898 } 8899 } ); 8900 }, 8901 dequeue: function( type ) { 8902 return this.each( function() { 8903 jQuery.dequeue( this, type ); 8904 } ); 8905 }, 8906 clearQueue: function( type ) { 8907 return this.queue( type || "fx", [] ); 8908 }, 8909 8910 // Get a promise resolved when queues of a certain type 8911 // are emptied (fx is the type by default) 8912 promise: function( type, obj ) { 8913 var tmp, 8914 count = 1, 8915 defer = jQuery.Deferred(), 8916 elements = this, 8917 i = this.length, 8918 resolve = function() { 8919 if ( !( --count ) ) { 8920 defer.resolveWith( elements, [ elements ] ); 8921 } 8922 }; 8923 8924 if ( typeof type !== "string" ) { 8925 obj = type; 8926 type = undefined; 8927 } 8928 type = type || "fx"; 8929 8930 while ( i-- ) { 8931 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 8932 if ( tmp && tmp.empty ) { 8933 count++; 8934 tmp.empty.add( resolve ); 8935 } 8936 } 8937 resolve(); 8938 return defer.promise( obj ); 8939 } 8940} ); 8941var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 8942 8943var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 8944 8945 8946var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 8947 8948var documentElement = document.documentElement; 8949 8950 8951 8952 var isAttached = function( elem ) { 8953 return jQuery.contains( elem.ownerDocument, elem ); 8954 }, 8955 composed = { composed: true }; 8956 8957 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 8958 // Check attachment across shadow DOM boundaries when possible (gh-3504) 8959 // Support: iOS 10.0-10.2 only 8960 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 8961 // leading to errors. We need to check for `getRootNode`. 8962 if ( documentElement.getRootNode ) { 8963 isAttached = function( elem ) { 8964 return jQuery.contains( elem.ownerDocument, elem ) || 8965 elem.getRootNode( composed ) === elem.ownerDocument; 8966 }; 8967 } 8968var isHiddenWithinTree = function( elem, el ) { 8969 8970 // isHiddenWithinTree might be called from jQuery#filter function; 8971 // in that case, element will be second argument 8972 elem = el || elem; 8973 8974 // Inline style trumps all 8975 return elem.style.display === "none" || 8976 elem.style.display === "" && 8977 8978 // Otherwise, check computed style 8979 // Support: Firefox <=43 - 45 8980 // Disconnected elements can have computed display: none, so first confirm that elem is 8981 // in the document. 8982 isAttached( elem ) && 8983 8984 jQuery.css( elem, "display" ) === "none"; 8985 }; 8986 8987 8988 8989function adjustCSS( elem, prop, valueParts, tween ) { 8990 var adjusted, scale, 8991 maxIterations = 20, 8992 currentValue = tween ? 8993 function() { 8994 return tween.cur(); 8995 } : 8996 function() { 8997 return jQuery.css( elem, prop, "" ); 8998 }, 8999 initial = currentValue(), 9000 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 9001 9002 // Starting value computation is required for potential unit mismatches 9003 initialInUnit = elem.nodeType && 9004 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 9005 rcssNum.exec( jQuery.css( elem, prop ) ); 9006 9007 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 9008 9009 // Support: Firefox <=54 9010 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 9011 initial = initial / 2; 9012 9013 // Trust units reported by jQuery.css 9014 unit = unit || initialInUnit[ 3 ]; 9015 9016 // Iteratively approximate from a nonzero starting point 9017 initialInUnit = +initial || 1; 9018 9019 while ( maxIterations-- ) { 9020 9021 // Evaluate and update our best guess (doubling guesses that zero out). 9022 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 9023 jQuery.style( elem, prop, initialInUnit + unit ); 9024 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 9025 maxIterations = 0; 9026 } 9027 initialInUnit = initialInUnit / scale; 9028 9029 } 9030 9031 initialInUnit = initialInUnit * 2; 9032 jQuery.style( elem, prop, initialInUnit + unit ); 9033 9034 // Make sure we update the tween properties later on 9035 valueParts = valueParts || []; 9036 } 9037 9038 if ( valueParts ) { 9039 initialInUnit = +initialInUnit || +initial || 0; 9040 9041 // Apply relative offset (+=/-=) if specified 9042 adjusted = valueParts[ 1 ] ? 9043 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 9044 +valueParts[ 2 ]; 9045 if ( tween ) { 9046 tween.unit = unit; 9047 tween.start = initialInUnit; 9048 tween.end = adjusted; 9049 } 9050 } 9051 return adjusted; 9052} 9053 9054 9055var defaultDisplayMap = {}; 9056 9057function getDefaultDisplay( elem ) { 9058 var temp, 9059 doc = elem.ownerDocument, 9060 nodeName = elem.nodeName, 9061 display = defaultDisplayMap[ nodeName ]; 9062 9063 if ( display ) { 9064 return display; 9065 } 9066 9067 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 9068 display = jQuery.css( temp, "display" ); 9069 9070 temp.parentNode.removeChild( temp ); 9071 9072 if ( display === "none" ) { 9073 display = "block"; 9074 } 9075 defaultDisplayMap[ nodeName ] = display; 9076 9077 return display; 9078} 9079 9080function showHide( elements, show ) { 9081 var display, elem, 9082 values = [], 9083 index = 0, 9084 length = elements.length; 9085 9086 // Determine new display value for elements that need to change 9087 for ( ; index < length; index++ ) { 9088 elem = elements[ index ]; 9089 if ( !elem.style ) { 9090 continue; 9091 } 9092 9093 display = elem.style.display; 9094 if ( show ) { 9095 9096 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 9097 // check is required in this first loop unless we have a nonempty display value (either 9098 // inline or about-to-be-restored) 9099 if ( display === "none" ) { 9100 values[ index ] = dataPriv.get( elem, "display" ) || null; 9101 if ( !values[ index ] ) { 9102 elem.style.display = ""; 9103 } 9104 } 9105 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 9106 values[ index ] = getDefaultDisplay( elem ); 9107 } 9108 } else { 9109 if ( display !== "none" ) { 9110 values[ index ] = "none"; 9111 9112 // Remember what we're overwriting 9113 dataPriv.set( elem, "display", display ); 9114 } 9115 } 9116 } 9117 9118 // Set the display of the elements in a second loop to avoid constant reflow 9119 for ( index = 0; index < length; index++ ) { 9120 if ( values[ index ] != null ) { 9121 elements[ index ].style.display = values[ index ]; 9122 } 9123 } 9124 9125 return elements; 9126} 9127 9128jQuery.fn.extend( { 9129 show: function() { 9130 return showHide( this, true ); 9131 }, 9132 hide: function() { 9133 return showHide( this ); 9134 }, 9135 toggle: function( state ) { 9136 if ( typeof state === "boolean" ) { 9137 return state ? this.show() : this.hide(); 9138 } 9139 9140 return this.each( function() { 9141 if ( isHiddenWithinTree( this ) ) { 9142 jQuery( this ).show(); 9143 } else { 9144 jQuery( this ).hide(); 9145 } 9146 } ); 9147 } 9148} ); 9149var rcheckableType = ( /^(?:checkbox|radio)$/i ); 9150 9151var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 9152 9153var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 9154 9155 9156 9157( function() { 9158 var fragment = document.createDocumentFragment(), 9159 div = fragment.appendChild( document.createElement( "div" ) ), 9160 input = document.createElement( "input" ); 9161 9162 // Support: Android 4.0 - 4.3 only 9163 // Check state lost if the name is set (trac-11217) 9164 // Support: Windows Web Apps (WWA) 9165 // `name` and `type` must use .setAttribute for WWA (trac-14901) 9166 input.setAttribute( "type", "radio" ); 9167 input.setAttribute( "checked", "checked" ); 9168 input.setAttribute( "name", "t" ); 9169 9170 div.appendChild( input ); 9171 9172 // Support: Android <=4.1 only 9173 // Older WebKit doesn't clone checked state correctly in fragments 9174 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 9175 9176 // Support: IE <=11 only 9177 // Make sure textarea (and checkbox) defaultValue is properly cloned 9178 div.innerHTML = "<textarea>x</textarea>"; 9179 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 9180 9181 // Support: IE <=9 only 9182 // IE <=9 replaces <option> tags with their contents when inserted outside of 9183 // the select element. 9184 div.innerHTML = "<option></option>"; 9185 support.option = !!div.lastChild; 9186} )(); 9187 9188 9189// We have to close these tags to support XHTML (trac-13200) 9190var wrapMap = { 9191 9192 // XHTML parsers do not magically insert elements in the 9193 // same way that tag soup parsers do. So we cannot shorten 9194 // this by omitting <tbody> or other required elements. 9195 thead: [ 1, "<table>", "</table>" ], 9196 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 9197 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 9198 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 9199 9200 _default: [ 0, "", "" ] 9201}; 9202 9203wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 9204wrapMap.th = wrapMap.td; 9205 9206// Support: IE <=9 only 9207if ( !support.option ) { 9208 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 9209} 9210 9211 9212function getAll( context, tag ) { 9213 9214 // Support: IE <=9 - 11 only 9215 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 9216 var ret; 9217 9218 if ( typeof context.getElementsByTagName !== "undefined" ) { 9219 ret = context.getElementsByTagName( tag || "*" ); 9220 9221 } else if ( typeof context.querySelectorAll !== "undefined" ) { 9222 ret = context.querySelectorAll( tag || "*" ); 9223 9224 } else { 9225 ret = []; 9226 } 9227 9228 if ( tag === undefined || tag && nodeName( context, tag ) ) { 9229 return jQuery.merge( [ context ], ret ); 9230 } 9231 9232 return ret; 9233} 9234 9235 9236// Mark scripts as having already been evaluated 9237function setGlobalEval( elems, refElements ) { 9238 var i = 0, 9239 l = elems.length; 9240 9241 for ( ; i < l; i++ ) { 9242 dataPriv.set( 9243 elems[ i ], 9244 "globalEval", 9245 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 9246 ); 9247 } 9248} 9249 9250 9251var rhtml = /<|&#?\w+;/; 9252 9253function buildFragment( elems, context, scripts, selection, ignored ) { 9254 var elem, tmp, tag, wrap, attached, j, 9255 fragment = context.createDocumentFragment(), 9256 nodes = [], 9257 i = 0, 9258 l = elems.length; 9259 9260 for ( ; i < l; i++ ) { 9261 elem = elems[ i ]; 9262 9263 if ( elem || elem === 0 ) { 9264 9265 // Add nodes directly 9266 if ( toType( elem ) === "object" ) { 9267 9268 // Support: Android <=4.0 only, PhantomJS 1 only 9269 // push.apply(_, arraylike) throws on ancient WebKit 9270 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 9271 9272 // Convert non-html into a text node 9273 } else if ( !rhtml.test( elem ) ) { 9274 nodes.push( context.createTextNode( elem ) ); 9275 9276 // Convert html into DOM nodes 9277 } else { 9278 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 9279 9280 // Deserialize a standard representation 9281 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 9282 wrap = wrapMap[ tag ] || wrapMap._default; 9283 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 9284 9285 // Descend through wrappers to the right content 9286 j = wrap[ 0 ]; 9287 while ( j-- ) { 9288 tmp = tmp.lastChild; 9289 } 9290 9291 // Support: Android <=4.0 only, PhantomJS 1 only 9292 // push.apply(_, arraylike) throws on ancient WebKit 9293 jQuery.merge( nodes, tmp.childNodes ); 9294 9295 // Remember the top-level container 9296 tmp = fragment.firstChild; 9297 9298 // Ensure the created nodes are orphaned (trac-12392) 9299 tmp.textContent = ""; 9300 } 9301 } 9302 } 9303 9304 // Remove wrapper from fragment 9305 fragment.textContent = ""; 9306 9307 i = 0; 9308 while ( ( elem = nodes[ i++ ] ) ) { 9309 9310 // Skip elements already in the context collection (trac-4087) 9311 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 9312 if ( ignored ) { 9313 ignored.push( elem ); 9314 } 9315 continue; 9316 } 9317 9318 attached = isAttached( elem ); 9319 9320 // Append to fragment 9321 tmp = getAll( fragment.appendChild( elem ), "script" ); 9322 9323 // Preserve script evaluation history 9324 if ( attached ) { 9325 setGlobalEval( tmp ); 9326 } 9327 9328 // Capture executables 9329 if ( scripts ) { 9330 j = 0; 9331 while ( ( elem = tmp[ j++ ] ) ) { 9332 if ( rscriptType.test( elem.type || "" ) ) { 9333 scripts.push( elem ); 9334 } 9335 } 9336 } 9337 } 9338 9339 return fragment; 9340} 9341 9342 9343var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 9344 9345function returnTrue() { 9346 return true; 9347} 9348 9349function returnFalse() { 9350 return false; 9351} 9352 9353function on( elem, types, selector, data, fn, one ) { 9354 var origFn, type; 9355 9356 // Types can be a map of types/handlers 9357 if ( typeof types === "object" ) { 9358 9359 // ( types-Object, selector, data ) 9360 if ( typeof selector !== "string" ) { 9361 9362 // ( types-Object, data ) 9363 data = data || selector; 9364 selector = undefined; 9365 } 9366 for ( type in types ) { 9367 on( elem, type, selector, data, types[ type ], one ); 9368 } 9369 return elem; 9370 } 9371 9372 if ( data == null && fn == null ) { 9373 9374 // ( types, fn ) 9375 fn = selector; 9376 data = selector = undefined; 9377 } else if ( fn == null ) { 9378 if ( typeof selector === "string" ) { 9379 9380 // ( types, selector, fn ) 9381 fn = data; 9382 data = undefined; 9383 } else { 9384 9385 // ( types, data, fn ) 9386 fn = data; 9387 data = selector; 9388 selector = undefined; 9389 } 9390 } 9391 if ( fn === false ) { 9392 fn = returnFalse; 9393 } else if ( !fn ) { 9394 return elem; 9395 } 9396 9397 if ( one === 1 ) { 9398 origFn = fn; 9399 fn = function( event ) { 9400 9401 // Can use an empty set, since event contains the info 9402 jQuery().off( event ); 9403 return origFn.apply( this, arguments ); 9404 }; 9405 9406 // Use same guid so caller can remove using origFn 9407 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 9408 } 9409 return elem.each( function() { 9410 jQuery.event.add( this, types, fn, data, selector ); 9411 } ); 9412} 9413 9414/* 9415 * Helper functions for managing events -- not part of the public interface. 9416 * Props to Dean Edwards' addEvent library for many of the ideas. 9417 */ 9418jQuery.event = { 9419 9420 global: {}, 9421 9422 add: function( elem, types, handler, data, selector ) { 9423 9424 var handleObjIn, eventHandle, tmp, 9425 events, t, handleObj, 9426 special, handlers, type, namespaces, origType, 9427 elemData = dataPriv.get( elem ); 9428 9429 // Only attach events to objects that accept data 9430 if ( !acceptData( elem ) ) { 9431 return; 9432 } 9433 9434 // Caller can pass in an object of custom data in lieu of the handler 9435 if ( handler.handler ) { 9436 handleObjIn = handler; 9437 handler = handleObjIn.handler; 9438 selector = handleObjIn.selector; 9439 } 9440 9441 // Ensure that invalid selectors throw exceptions at attach time 9442 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 9443 if ( selector ) { 9444 jQuery.find.matchesSelector( documentElement, selector ); 9445 } 9446 9447 // Make sure that the handler has a unique ID, used to find/remove it later 9448 if ( !handler.guid ) { 9449 handler.guid = jQuery.guid++; 9450 } 9451 9452 // Init the element's event structure and main handler, if this is the first 9453 if ( !( events = elemData.events ) ) { 9454 events = elemData.events = Object.create( null ); 9455 } 9456 if ( !( eventHandle = elemData.handle ) ) { 9457 eventHandle = elemData.handle = function( e ) { 9458 9459 // Discard the second event of a jQuery.event.trigger() and 9460 // when an event is called after a page has unloaded 9461 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 9462 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 9463 }; 9464 } 9465 9466 // Handle multiple events separated by a space 9467 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 9468 t = types.length; 9469 while ( t-- ) { 9470 tmp = rtypenamespace.exec( types[ t ] ) || []; 9471 type = origType = tmp[ 1 ]; 9472 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 9473 9474 // There *must* be a type, no attaching namespace-only handlers 9475 if ( !type ) { 9476 continue; 9477 } 9478 9479 // If event changes its type, use the special event handlers for the changed type 9480 special = jQuery.event.special[ type ] || {}; 9481 9482 // If selector defined, determine special event api type, otherwise given type 9483 type = ( selector ? special.delegateType : special.bindType ) || type; 9484 9485 // Update special based on newly reset type 9486 special = jQuery.event.special[ type ] || {}; 9487 9488 // handleObj is passed to all event handlers 9489 handleObj = jQuery.extend( { 9490 type: type, 9491 origType: origType, 9492 data: data, 9493 handler: handler, 9494 guid: handler.guid, 9495 selector: selector, 9496 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 9497 namespace: namespaces.join( "." ) 9498 }, handleObjIn ); 9499 9500 // Init the event handler queue if we're the first 9501 if ( !( handlers = events[ type ] ) ) { 9502 handlers = events[ type ] = []; 9503 handlers.delegateCount = 0; 9504 9505 // Only use addEventListener if the special events handler returns false 9506 if ( !special.setup || 9507 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 9508 9509 if ( elem.addEventListener ) { 9510 elem.addEventListener( type, eventHandle ); 9511 } 9512 } 9513 } 9514 9515 if ( special.add ) { 9516 special.add.call( elem, handleObj ); 9517 9518 if ( !handleObj.handler.guid ) { 9519 handleObj.handler.guid = handler.guid; 9520 } 9521 } 9522 9523 // Add to the element's handler list, delegates in front 9524 if ( selector ) { 9525 handlers.splice( handlers.delegateCount++, 0, handleObj ); 9526 } else { 9527 handlers.push( handleObj ); 9528 } 9529 9530 // Keep track of which events have ever been used, for event optimization 9531 jQuery.event.global[ type ] = true; 9532 } 9533 9534 }, 9535 9536 // Detach an event or set of events from an element 9537 remove: function( elem, types, handler, selector, mappedTypes ) { 9538 9539 var j, origCount, tmp, 9540 events, t, handleObj, 9541 special, handlers, type, namespaces, origType, 9542 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 9543 9544 if ( !elemData || !( events = elemData.events ) ) { 9545 return; 9546 } 9547 9548 // Once for each type.namespace in types; type may be omitted 9549 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 9550 t = types.length; 9551 while ( t-- ) { 9552 tmp = rtypenamespace.exec( types[ t ] ) || []; 9553 type = origType = tmp[ 1 ]; 9554 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 9555 9556 // Unbind all events (on this namespace, if provided) for the element 9557 if ( !type ) { 9558 for ( type in events ) { 9559 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 9560 } 9561 continue; 9562 } 9563 9564 special = jQuery.event.special[ type ] || {}; 9565 type = ( selector ? special.delegateType : special.bindType ) || type; 9566 handlers = events[ type ] || []; 9567 tmp = tmp[ 2 ] && 9568 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 9569 9570 // Remove matching events 9571 origCount = j = handlers.length; 9572 while ( j-- ) { 9573 handleObj = handlers[ j ]; 9574 9575 if ( ( mappedTypes || origType === handleObj.origType ) && 9576 ( !handler || handler.guid === handleObj.guid ) && 9577 ( !tmp || tmp.test( handleObj.namespace ) ) && 9578 ( !selector || selector === handleObj.selector || 9579 selector === "**" && handleObj.selector ) ) { 9580 handlers.splice( j, 1 ); 9581 9582 if ( handleObj.selector ) { 9583 handlers.delegateCount--; 9584 } 9585 if ( special.remove ) { 9586 special.remove.call( elem, handleObj ); 9587 } 9588 } 9589 } 9590 9591 // Remove generic event handler if we removed something and no more handlers exist 9592 // (avoids potential for endless recursion during removal of special event handlers) 9593 if ( origCount && !handlers.length ) { 9594 if ( !special.teardown || 9595 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 9596 9597 jQuery.removeEvent( elem, type, elemData.handle ); 9598 } 9599 9600 delete events[ type ]; 9601 } 9602 } 9603 9604 // Remove data and the expando if it's no longer used 9605 if ( jQuery.isEmptyObject( events ) ) { 9606 dataPriv.remove( elem, "handle events" ); 9607 } 9608 }, 9609 9610 dispatch: function( nativeEvent ) { 9611 9612 var i, j, ret, matched, handleObj, handlerQueue, 9613 args = new Array( arguments.length ), 9614 9615 // Make a writable jQuery.Event from the native event object 9616 event = jQuery.event.fix( nativeEvent ), 9617 9618 handlers = ( 9619 dataPriv.get( this, "events" ) || Object.create( null ) 9620 )[ event.type ] || [], 9621 special = jQuery.event.special[ event.type ] || {}; 9622 9623 // Use the fix-ed jQuery.Event rather than the (read-only) native event 9624 args[ 0 ] = event; 9625 9626 for ( i = 1; i < arguments.length; i++ ) { 9627 args[ i ] = arguments[ i ]; 9628 } 9629 9630 event.delegateTarget = this; 9631 9632 // Call the preDispatch hook for the mapped type, and let it bail if desired 9633 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 9634 return; 9635 } 9636 9637 // Determine handlers 9638 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 9639 9640 // Run delegates first; they may want to stop propagation beneath us 9641 i = 0; 9642 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 9643 event.currentTarget = matched.elem; 9644 9645 j = 0; 9646 while ( ( handleObj = matched.handlers[ j++ ] ) && 9647 !event.isImmediatePropagationStopped() ) { 9648 9649 // If the event is namespaced, then each handler is only invoked if it is 9650 // specially universal or its namespaces are a superset of the event's. 9651 if ( !event.rnamespace || handleObj.namespace === false || 9652 event.rnamespace.test( handleObj.namespace ) ) { 9653 9654 event.handleObj = handleObj; 9655 event.data = handleObj.data; 9656 9657 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 9658 handleObj.handler ).apply( matched.elem, args ); 9659 9660 if ( ret !== undefined ) { 9661 if ( ( event.result = ret ) === false ) { 9662 event.preventDefault(); 9663 event.stopPropagation(); 9664 } 9665 } 9666 } 9667 } 9668 } 9669 9670 // Call the postDispatch hook for the mapped type 9671 if ( special.postDispatch ) { 9672 special.postDispatch.call( this, event ); 9673 } 9674 9675 return event.result; 9676 }, 9677 9678 handlers: function( event, handlers ) { 9679 var i, handleObj, sel, matchedHandlers, matchedSelectors, 9680 handlerQueue = [], 9681 delegateCount = handlers.delegateCount, 9682 cur = event.target; 9683 9684 // Find delegate handlers 9685 if ( delegateCount && 9686 9687 // Support: IE <=9 9688 // Black-hole SVG <use> instance trees (trac-13180) 9689 cur.nodeType && 9690 9691 // Support: Firefox <=42 9692 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 9693 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 9694 // Support: IE 11 only 9695 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 9696 !( event.type === "click" && event.button >= 1 ) ) { 9697 9698 for ( ; cur !== this; cur = cur.parentNode || this ) { 9699 9700 // Don't check non-elements (trac-13208) 9701 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 9702 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 9703 matchedHandlers = []; 9704 matchedSelectors = {}; 9705 for ( i = 0; i < delegateCount; i++ ) { 9706 handleObj = handlers[ i ]; 9707 9708 // Don't conflict with Object.prototype properties (trac-13203) 9709 sel = handleObj.selector + " "; 9710 9711 if ( matchedSelectors[ sel ] === undefined ) { 9712 matchedSelectors[ sel ] = handleObj.needsContext ? 9713 jQuery( sel, this ).index( cur ) > -1 : 9714 jQuery.find( sel, this, null, [ cur ] ).length; 9715 } 9716 if ( matchedSelectors[ sel ] ) { 9717 matchedHandlers.push( handleObj ); 9718 } 9719 } 9720 if ( matchedHandlers.length ) { 9721 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 9722 } 9723 } 9724 } 9725 } 9726 9727 // Add the remaining (directly-bound) handlers 9728 cur = this; 9729 if ( delegateCount < handlers.length ) { 9730 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 9731 } 9732 9733 return handlerQueue; 9734 }, 9735 9736 addProp: function( name, hook ) { 9737 Object.defineProperty( jQuery.Event.prototype, name, { 9738 enumerable: true, 9739 configurable: true, 9740 9741 get: isFunction( hook ) ? 9742 function() { 9743 if ( this.originalEvent ) { 9744 return hook( this.originalEvent ); 9745 } 9746 } : 9747 function() { 9748 if ( this.originalEvent ) { 9749 return this.originalEvent[ name ]; 9750 } 9751 }, 9752 9753 set: function( value ) { 9754 Object.defineProperty( this, name, { 9755 enumerable: true, 9756 configurable: true, 9757 writable: true, 9758 value: value 9759 } ); 9760 } 9761 } ); 9762 }, 9763 9764 fix: function( originalEvent ) { 9765 return originalEvent[ jQuery.expando ] ? 9766 originalEvent : 9767 new jQuery.Event( originalEvent ); 9768 }, 9769 9770 special: { 9771 load: { 9772 9773 // Prevent triggered image.load events from bubbling to window.load 9774 noBubble: true 9775 }, 9776 click: { 9777 9778 // Utilize native event to ensure correct state for checkable inputs 9779 setup: function( data ) { 9780 9781 // For mutual compressibility with _default, replace `this` access with a local var. 9782 // `|| data` is dead code meant only to preserve the variable through minification. 9783 var el = this || data; 9784 9785 // Claim the first handler 9786 if ( rcheckableType.test( el.type ) && 9787 el.click && nodeName( el, "input" ) ) { 9788 9789 // dataPriv.set( el, "click", ... ) 9790 leverageNative( el, "click", true ); 9791 } 9792 9793 // Return false to allow normal processing in the caller 9794 return false; 9795 }, 9796 trigger: function( data ) { 9797 9798 // For mutual compressibility with _default, replace `this` access with a local var. 9799 // `|| data` is dead code meant only to preserve the variable through minification. 9800 var el = this || data; 9801 9802 // Force setup before triggering a click 9803 if ( rcheckableType.test( el.type ) && 9804 el.click && nodeName( el, "input" ) ) { 9805 9806 leverageNative( el, "click" ); 9807 } 9808 9809 // Return non-false to allow normal event-path propagation 9810 return true; 9811 }, 9812 9813 // For cross-browser consistency, suppress native .click() on links 9814 // Also prevent it if we're currently inside a leveraged native-event stack 9815 _default: function( event ) { 9816 var target = event.target; 9817 return rcheckableType.test( target.type ) && 9818 target.click && nodeName( target, "input" ) && 9819 dataPriv.get( target, "click" ) || 9820 nodeName( target, "a" ); 9821 } 9822 }, 9823 9824 beforeunload: { 9825 postDispatch: function( event ) { 9826 9827 // Support: Firefox 20+ 9828 // Firefox doesn't alert if the returnValue field is not set. 9829 if ( event.result !== undefined && event.originalEvent ) { 9830 event.originalEvent.returnValue = event.result; 9831 } 9832 } 9833 } 9834 } 9835}; 9836 9837// Ensure the presence of an event listener that handles manually-triggered 9838// synthetic events by interrupting progress until reinvoked in response to 9839// *native* events that it fires directly, ensuring that state changes have 9840// already occurred before other listeners are invoked. 9841function leverageNative( el, type, isSetup ) { 9842 9843 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 9844 if ( !isSetup ) { 9845 if ( dataPriv.get( el, type ) === undefined ) { 9846 jQuery.event.add( el, type, returnTrue ); 9847 } 9848 return; 9849 } 9850 9851 // Register the controller as a special universal handler for all event namespaces 9852 dataPriv.set( el, type, false ); 9853 jQuery.event.add( el, type, { 9854 namespace: false, 9855 handler: function( event ) { 9856 var result, 9857 saved = dataPriv.get( this, type ); 9858 9859 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 9860 9861 // Interrupt processing of the outer synthetic .trigger()ed event 9862 if ( !saved ) { 9863 9864 // Store arguments for use when handling the inner native event 9865 // There will always be at least one argument (an event object), so this array 9866 // will not be confused with a leftover capture object. 9867 saved = slice.call( arguments ); 9868 dataPriv.set( this, type, saved ); 9869 9870 // Trigger the native event and capture its result 9871 this[ type ](); 9872 result = dataPriv.get( this, type ); 9873 dataPriv.set( this, type, false ); 9874 9875 if ( saved !== result ) { 9876 9877 // Cancel the outer synthetic event 9878 event.stopImmediatePropagation(); 9879 event.preventDefault(); 9880 9881 return result; 9882 } 9883 9884 // If this is an inner synthetic event for an event with a bubbling surrogate 9885 // (focus or blur), assume that the surrogate already propagated from triggering 9886 // the native event and prevent that from happening again here. 9887 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 9888 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 9889 // less bad than duplication. 9890 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 9891 event.stopPropagation(); 9892 } 9893 9894 // If this is a native event triggered above, everything is now in order 9895 // Fire an inner synthetic event with the original arguments 9896 } else if ( saved ) { 9897 9898 // ...and capture the result 9899 dataPriv.set( this, type, jQuery.event.trigger( 9900 saved[ 0 ], 9901 saved.slice( 1 ), 9902 this 9903 ) ); 9904 9905 // Abort handling of the native event by all jQuery handlers while allowing 9906 // native handlers on the same element to run. On target, this is achieved 9907 // by stopping immediate propagation just on the jQuery event. However, 9908 // the native event is re-wrapped by a jQuery one on each level of the 9909 // propagation so the only way to stop it for jQuery is to stop it for 9910 // everyone via native `stopPropagation()`. This is not a problem for 9911 // focus/blur which don't bubble, but it does also stop click on checkboxes 9912 // and radios. We accept this limitation. 9913 event.stopPropagation(); 9914 event.isImmediatePropagationStopped = returnTrue; 9915 } 9916 } 9917 } ); 9918} 9919 9920jQuery.removeEvent = function( elem, type, handle ) { 9921 9922 // This "if" is needed for plain objects 9923 if ( elem.removeEventListener ) { 9924 elem.removeEventListener( type, handle ); 9925 } 9926}; 9927 9928jQuery.Event = function( src, props ) { 9929 9930 // Allow instantiation without the 'new' keyword 9931 if ( !( this instanceof jQuery.Event ) ) { 9932 return new jQuery.Event( src, props ); 9933 } 9934 9935 // Event object 9936 if ( src && src.type ) { 9937 this.originalEvent = src; 9938 this.type = src.type; 9939 9940 // Events bubbling up the document may have been marked as prevented 9941 // by a handler lower down the tree; reflect the correct value. 9942 this.isDefaultPrevented = src.defaultPrevented || 9943 src.defaultPrevented === undefined && 9944 9945 // Support: Android <=2.3 only 9946 src.returnValue === false ? 9947 returnTrue : 9948 returnFalse; 9949 9950 // Create target properties 9951 // Support: Safari <=6 - 7 only 9952 // Target should not be a text node (trac-504, trac-13143) 9953 this.target = ( src.target && src.target.nodeType === 3 ) ? 9954 src.target.parentNode : 9955 src.target; 9956 9957 this.currentTarget = src.currentTarget; 9958 this.relatedTarget = src.relatedTarget; 9959 9960 // Event type 9961 } else { 9962 this.type = src; 9963 } 9964 9965 // Put explicitly provided properties onto the event object 9966 if ( props ) { 9967 jQuery.extend( this, props ); 9968 } 9969 9970 // Create a timestamp if incoming event doesn't have one 9971 this.timeStamp = src && src.timeStamp || Date.now(); 9972 9973 // Mark it as fixed 9974 this[ jQuery.expando ] = true; 9975}; 9976 9977// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 9978// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 9979jQuery.Event.prototype = { 9980 constructor: jQuery.Event, 9981 isDefaultPrevented: returnFalse, 9982 isPropagationStopped: returnFalse, 9983 isImmediatePropagationStopped: returnFalse, 9984 isSimulated: false, 9985 9986 preventDefault: function() { 9987 var e = this.originalEvent; 9988 9989 this.isDefaultPrevented = returnTrue; 9990 9991 if ( e && !this.isSimulated ) { 9992 e.preventDefault(); 9993 } 9994 }, 9995 stopPropagation: function() { 9996 var e = this.originalEvent; 9997 9998 this.isPropagationStopped = returnTrue; 9999 10000 if ( e && !this.isSimulated ) { 10001 e.stopPropagation(); 10002 } 10003 }, 10004 stopImmediatePropagation: function() { 10005 var e = this.originalEvent; 10006 10007 this.isImmediatePropagationStopped = returnTrue; 10008 10009 if ( e && !this.isSimulated ) { 10010 e.stopImmediatePropagation(); 10011 } 10012 10013 this.stopPropagation(); 10014 } 10015}; 10016 10017// Includes all common event props including KeyEvent and MouseEvent specific props 10018jQuery.each( { 10019 altKey: true, 10020 bubbles: true, 10021 cancelable: true, 10022 changedTouches: true, 10023 ctrlKey: true, 10024 detail: true, 10025 eventPhase: true, 10026 metaKey: true, 10027 pageX: true, 10028 pageY: true, 10029 shiftKey: true, 10030 view: true, 10031 "char": true, 10032 code: true, 10033 charCode: true, 10034 key: true, 10035 keyCode: true, 10036 button: true, 10037 buttons: true, 10038 clientX: true, 10039 clientY: true, 10040 offsetX: true, 10041 offsetY: true, 10042 pointerId: true, 10043 pointerType: true, 10044 screenX: true, 10045 screenY: true, 10046 targetTouches: true, 10047 toElement: true, 10048 touches: true, 10049 which: true 10050}, jQuery.event.addProp ); 10051 10052jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 10053 10054 function focusMappedHandler( nativeEvent ) { 10055 if ( document.documentMode ) { 10056 10057 // Support: IE 11+ 10058 // Attach a single focusin/focusout handler on the document while someone wants 10059 // focus/blur. This is because the former are synchronous in IE while the latter 10060 // are async. In other browsers, all those handlers are invoked synchronously. 10061 10062 // `handle` from private data would already wrap the event, but we need 10063 // to change the `type` here. 10064 var handle = dataPriv.get( this, "handle" ), 10065 event = jQuery.event.fix( nativeEvent ); 10066 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 10067 event.isSimulated = true; 10068 10069 // First, handle focusin/focusout 10070 handle( nativeEvent ); 10071 10072 // ...then, handle focus/blur 10073 // 10074 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 10075 // invoking the handler at the lower level. 10076 if ( event.target === event.currentTarget ) { 10077 10078 // The setup part calls `leverageNative`, which, in turn, calls 10079 // `jQuery.event.add`, so event handle will already have been set 10080 // by this point. 10081 handle( event ); 10082 } 10083 } else { 10084 10085 // For non-IE browsers, attach a single capturing handler on the document 10086 // while someone wants focusin/focusout. 10087 jQuery.event.simulate( delegateType, nativeEvent.target, 10088 jQuery.event.fix( nativeEvent ) ); 10089 } 10090 } 10091 10092 jQuery.event.special[ type ] = { 10093 10094 // Utilize native event if possible so blur/focus sequence is correct 10095 setup: function() { 10096 10097 var attaches; 10098 10099 // Claim the first handler 10100 // dataPriv.set( this, "focus", ... ) 10101 // dataPriv.set( this, "blur", ... ) 10102 leverageNative( this, type, true ); 10103 10104 if ( document.documentMode ) { 10105 10106 // Support: IE 9 - 11+ 10107 // We use the same native handler for focusin & focus (and focusout & blur) 10108 // so we need to coordinate setup & teardown parts between those events. 10109 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 10110 attaches = dataPriv.get( this, delegateType ); 10111 if ( !attaches ) { 10112 this.addEventListener( delegateType, focusMappedHandler ); 10113 } 10114 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 10115 } else { 10116 10117 // Return false to allow normal processing in the caller 10118 return false; 10119 } 10120 }, 10121 trigger: function() { 10122 10123 // Force setup before trigger 10124 leverageNative( this, type ); 10125 10126 // Return non-false to allow normal event-path propagation 10127 return true; 10128 }, 10129 10130 teardown: function() { 10131 var attaches; 10132 10133 if ( document.documentMode ) { 10134 attaches = dataPriv.get( this, delegateType ) - 1; 10135 if ( !attaches ) { 10136 this.removeEventListener( delegateType, focusMappedHandler ); 10137 dataPriv.remove( this, delegateType ); 10138 } else { 10139 dataPriv.set( this, delegateType, attaches ); 10140 } 10141 } else { 10142 10143 // Return false to indicate standard teardown should be applied 10144 return false; 10145 } 10146 }, 10147 10148 // Suppress native focus or blur if we're currently inside 10149 // a leveraged native-event stack 10150 _default: function( event ) { 10151 return dataPriv.get( event.target, type ); 10152 }, 10153 10154 delegateType: delegateType 10155 }; 10156 10157 // Support: Firefox <=44 10158 // Firefox doesn't have focus(in | out) events 10159 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 10160 // 10161 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 10162 // focus(in | out) events fire after focus & blur events, 10163 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 10164 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 10165 // 10166 // Support: IE 9 - 11+ 10167 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 10168 // attach a single handler for both events in IE. 10169 jQuery.event.special[ delegateType ] = { 10170 setup: function() { 10171 10172 // Handle: regular nodes (via `this.ownerDocument`), window 10173 // (via `this.document`) & document (via `this`). 10174 var doc = this.ownerDocument || this.document || this, 10175 dataHolder = document.documentMode ? this : doc, 10176 attaches = dataPriv.get( dataHolder, delegateType ); 10177 10178 // Support: IE 9 - 11+ 10179 // We use the same native handler for focusin & focus (and focusout & blur) 10180 // so we need to coordinate setup & teardown parts between those events. 10181 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 10182 if ( !attaches ) { 10183 if ( document.documentMode ) { 10184 this.addEventListener( delegateType, focusMappedHandler ); 10185 } else { 10186 doc.addEventListener( type, focusMappedHandler, true ); 10187 } 10188 } 10189 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 10190 }, 10191 teardown: function() { 10192 var doc = this.ownerDocument || this.document || this, 10193 dataHolder = document.documentMode ? this : doc, 10194 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 10195 10196 if ( !attaches ) { 10197 if ( document.documentMode ) { 10198 this.removeEventListener( delegateType, focusMappedHandler ); 10199 } else { 10200 doc.removeEventListener( type, focusMappedHandler, true ); 10201 } 10202 dataPriv.remove( dataHolder, delegateType ); 10203 } else { 10204 dataPriv.set( dataHolder, delegateType, attaches ); 10205 } 10206 } 10207 }; 10208} ); 10209 10210// Create mouseenter/leave events using mouseover/out and event-time checks 10211// so that event delegation works in jQuery. 10212// Do the same for pointerenter/pointerleave and pointerover/pointerout 10213// 10214// Support: Safari 7 only 10215// Safari sends mouseenter too often; see: 10216// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 10217// for the description of the bug (it existed in older Chrome versions as well). 10218jQuery.each( { 10219 mouseenter: "mouseover", 10220 mouseleave: "mouseout", 10221 pointerenter: "pointerover", 10222 pointerleave: "pointerout" 10223}, function( orig, fix ) { 10224 jQuery.event.special[ orig ] = { 10225 delegateType: fix, 10226 bindType: fix, 10227 10228 handle: function( event ) { 10229 var ret, 10230 target = this, 10231 related = event.relatedTarget, 10232 handleObj = event.handleObj; 10233 10234 // For mouseenter/leave call the handler if related is outside the target. 10235 // NB: No relatedTarget if the mouse left/entered the browser window 10236 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 10237 event.type = handleObj.origType; 10238 ret = handleObj.handler.apply( this, arguments ); 10239 event.type = fix; 10240 } 10241 return ret; 10242 } 10243 }; 10244} ); 10245 10246jQuery.fn.extend( { 10247 10248 on: function( types, selector, data, fn ) { 10249 return on( this, types, selector, data, fn ); 10250 }, 10251 one: function( types, selector, data, fn ) { 10252 return on( this, types, selector, data, fn, 1 ); 10253 }, 10254 off: function( types, selector, fn ) { 10255 var handleObj, type; 10256 if ( types && types.preventDefault && types.handleObj ) { 10257 10258 // ( event ) dispatched jQuery.Event 10259 handleObj = types.handleObj; 10260 jQuery( types.delegateTarget ).off( 10261 handleObj.namespace ? 10262 handleObj.origType + "." + handleObj.namespace : 10263 handleObj.origType, 10264 handleObj.selector, 10265 handleObj.handler 10266 ); 10267 return this; 10268 } 10269 if ( typeof types === "object" ) { 10270 10271 // ( types-object [, selector] ) 10272 for ( type in types ) { 10273 this.off( type, selector, types[ type ] ); 10274 } 10275 return this; 10276 } 10277 if ( selector === false || typeof selector === "function" ) { 10278 10279 // ( types [, fn] ) 10280 fn = selector; 10281 selector = undefined; 10282 } 10283 if ( fn === false ) { 10284 fn = returnFalse; 10285 } 10286 return this.each( function() { 10287 jQuery.event.remove( this, types, fn, selector ); 10288 } ); 10289 } 10290} ); 10291 10292 10293var 10294 10295 // Support: IE <=10 - 11, Edge 12 - 13 only 10296 // In IE/Edge using regex groups here causes severe slowdowns. 10297 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 10298 rnoInnerhtml = /<script|<style|<link/i, 10299 10300 // checked="checked" or checked 10301 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 10302 10303 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 10304 10305// Prefer a tbody over its parent table for containing new rows 10306function manipulationTarget( elem, content ) { 10307 if ( nodeName( elem, "table" ) && 10308 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 10309 10310 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 10311 } 10312 10313 return elem; 10314} 10315 10316// Replace/restore the type attribute of script elements for safe DOM manipulation 10317function disableScript( elem ) { 10318 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 10319 return elem; 10320} 10321function restoreScript( elem ) { 10322 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 10323 elem.type = elem.type.slice( 5 ); 10324 } else { 10325 elem.removeAttribute( "type" ); 10326 } 10327 10328 return elem; 10329} 10330 10331function cloneCopyEvent( src, dest ) { 10332 var i, l, type, pdataOld, udataOld, udataCur, events; 10333 10334 if ( dest.nodeType !== 1 ) { 10335 return; 10336 } 10337 10338 // 1. Copy private data: events, handlers, etc. 10339 if ( dataPriv.hasData( src ) ) { 10340 pdataOld = dataPriv.get( src ); 10341 events = pdataOld.events; 10342 10343 if ( events ) { 10344 dataPriv.remove( dest, "handle events" ); 10345 10346 for ( type in events ) { 10347 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 10348 jQuery.event.add( dest, type, events[ type ][ i ] ); 10349 } 10350 } 10351 } 10352 } 10353 10354 // 2. Copy user data 10355 if ( dataUser.hasData( src ) ) { 10356 udataOld = dataUser.access( src ); 10357 udataCur = jQuery.extend( {}, udataOld ); 10358 10359 dataUser.set( dest, udataCur ); 10360 } 10361} 10362 10363// Fix IE bugs, see support tests 10364function fixInput( src, dest ) { 10365 var nodeName = dest.nodeName.toLowerCase(); 10366 10367 // Fails to persist the checked state of a cloned checkbox or radio button. 10368 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 10369 dest.checked = src.checked; 10370 10371 // Fails to return the selected option to the default selected state when cloning options 10372 } else if ( nodeName === "input" || nodeName === "textarea" ) { 10373 dest.defaultValue = src.defaultValue; 10374 } 10375} 10376 10377function domManip( collection, args, callback, ignored ) { 10378 10379 // Flatten any nested arrays 10380 args = flat( args ); 10381 10382 var fragment, first, scripts, hasScripts, node, doc, 10383 i = 0, 10384 l = collection.length, 10385 iNoClone = l - 1, 10386 value = args[ 0 ], 10387 valueIsFunction = isFunction( value ); 10388 10389 // We can't cloneNode fragments that contain checked, in WebKit 10390 if ( valueIsFunction || 10391 ( l > 1 && typeof value === "string" && 10392 !support.checkClone && rchecked.test( value ) ) ) { 10393 return collection.each( function( index ) { 10394 var self = collection.eq( index ); 10395 if ( valueIsFunction ) { 10396 args[ 0 ] = value.call( this, index, self.html() ); 10397 } 10398 domManip( self, args, callback, ignored ); 10399 } ); 10400 } 10401 10402 if ( l ) { 10403 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 10404 first = fragment.firstChild; 10405 10406 if ( fragment.childNodes.length === 1 ) { 10407 fragment = first; 10408 } 10409 10410 // Require either new content or an interest in ignored elements to invoke the callback 10411 if ( first || ignored ) { 10412 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 10413 hasScripts = scripts.length; 10414 10415 // Use the original fragment for the last item 10416 // instead of the first because it can end up 10417 // being emptied incorrectly in certain situations (trac-8070). 10418 for ( ; i < l; i++ ) { 10419 node = fragment; 10420 10421 if ( i !== iNoClone ) { 10422 node = jQuery.clone( node, true, true ); 10423 10424 // Keep references to cloned scripts for later restoration 10425 if ( hasScripts ) { 10426 10427 // Support: Android <=4.0 only, PhantomJS 1 only 10428 // push.apply(_, arraylike) throws on ancient WebKit 10429 jQuery.merge( scripts, getAll( node, "script" ) ); 10430 } 10431 } 10432 10433 callback.call( collection[ i ], node, i ); 10434 } 10435 10436 if ( hasScripts ) { 10437 doc = scripts[ scripts.length - 1 ].ownerDocument; 10438 10439 // Re-enable scripts 10440 jQuery.map( scripts, restoreScript ); 10441 10442 // Evaluate executable scripts on first document insertion 10443 for ( i = 0; i < hasScripts; i++ ) { 10444 node = scripts[ i ]; 10445 if ( rscriptType.test( node.type || "" ) && 10446 !dataPriv.access( node, "globalEval" ) && 10447 jQuery.contains( doc, node ) ) { 10448 10449 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 10450 10451 // Optional AJAX dependency, but won't run scripts if not present 10452 if ( jQuery._evalUrl && !node.noModule ) { 10453 jQuery._evalUrl( node.src, { 10454 nonce: node.nonce || node.getAttribute( "nonce" ) 10455 }, doc ); 10456 } 10457 } else { 10458 10459 // Unwrap a CDATA section containing script contents. This shouldn't be 10460 // needed as in XML documents they're already not visible when 10461 // inspecting element contents and in HTML documents they have no 10462 // meaning but we're preserving that logic for backwards compatibility. 10463 // This will be removed completely in 4.0. See gh-4904. 10464 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 10465 } 10466 } 10467 } 10468 } 10469 } 10470 } 10471 10472 return collection; 10473} 10474 10475function remove( elem, selector, keepData ) { 10476 var node, 10477 nodes = selector ? jQuery.filter( selector, elem ) : elem, 10478 i = 0; 10479 10480 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 10481 if ( !keepData && node.nodeType === 1 ) { 10482 jQuery.cleanData( getAll( node ) ); 10483 } 10484 10485 if ( node.parentNode ) { 10486 if ( keepData && isAttached( node ) ) { 10487 setGlobalEval( getAll( node, "script" ) ); 10488 } 10489 node.parentNode.removeChild( node ); 10490 } 10491 } 10492 10493 return elem; 10494} 10495 10496jQuery.extend( { 10497 htmlPrefilter: function( html ) { 10498 return html; 10499 }, 10500 10501 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 10502 var i, l, srcElements, destElements, 10503 clone = elem.cloneNode( true ), 10504 inPage = isAttached( elem ); 10505 10506 // Fix IE cloning issues 10507 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 10508 !jQuery.isXMLDoc( elem ) ) { 10509 10510 // We eschew jQuery#find here for performance reasons: 10511 // https://jsperf.com/getall-vs-sizzle/2 10512 destElements = getAll( clone ); 10513 srcElements = getAll( elem ); 10514 10515 for ( i = 0, l = srcElements.length; i < l; i++ ) { 10516 fixInput( srcElements[ i ], destElements[ i ] ); 10517 } 10518 } 10519 10520 // Copy the events from the original to the clone 10521 if ( dataAndEvents ) { 10522 if ( deepDataAndEvents ) { 10523 srcElements = srcElements || getAll( elem ); 10524 destElements = destElements || getAll( clone ); 10525 10526 for ( i = 0, l = srcElements.length; i < l; i++ ) { 10527 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 10528 } 10529 } else { 10530 cloneCopyEvent( elem, clone ); 10531 } 10532 } 10533 10534 // Preserve script evaluation history 10535 destElements = getAll( clone, "script" ); 10536 if ( destElements.length > 0 ) { 10537 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 10538 } 10539 10540 // Return the cloned set 10541 return clone; 10542 }, 10543 10544 cleanData: function( elems ) { 10545 var data, elem, type, 10546 special = jQuery.event.special, 10547 i = 0; 10548 10549 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 10550 if ( acceptData( elem ) ) { 10551 if ( ( data = elem[ dataPriv.expando ] ) ) { 10552 if ( data.events ) { 10553 for ( type in data.events ) { 10554 if ( special[ type ] ) { 10555 jQuery.event.remove( elem, type ); 10556 10557 // This is a shortcut to avoid jQuery.event.remove's overhead 10558 } else { 10559 jQuery.removeEvent( elem, type, data.handle ); 10560 } 10561 } 10562 } 10563 10564 // Support: Chrome <=35 - 45+ 10565 // Assign undefined instead of using delete, see Data#remove 10566 elem[ dataPriv.expando ] = undefined; 10567 } 10568 if ( elem[ dataUser.expando ] ) { 10569 10570 // Support: Chrome <=35 - 45+ 10571 // Assign undefined instead of using delete, see Data#remove 10572 elem[ dataUser.expando ] = undefined; 10573 } 10574 } 10575 } 10576 } 10577} ); 10578 10579jQuery.fn.extend( { 10580 detach: function( selector ) { 10581 return remove( this, selector, true ); 10582 }, 10583 10584 remove: function( selector ) { 10585 return remove( this, selector ); 10586 }, 10587 10588 text: function( value ) { 10589 return access( this, function( value ) { 10590 return value === undefined ? 10591 jQuery.text( this ) : 10592 this.empty().each( function() { 10593 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 10594 this.textContent = value; 10595 } 10596 } ); 10597 }, null, value, arguments.length ); 10598 }, 10599 10600 append: function() { 10601 return domManip( this, arguments, function( elem ) { 10602 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 10603 var target = manipulationTarget( this, elem ); 10604 target.appendChild( elem ); 10605 } 10606 } ); 10607 }, 10608 10609 prepend: function() { 10610 return domManip( this, arguments, function( elem ) { 10611 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 10612 var target = manipulationTarget( this, elem ); 10613 target.insertBefore( elem, target.firstChild ); 10614 } 10615 } ); 10616 }, 10617 10618 before: function() { 10619 return domManip( this, arguments, function( elem ) { 10620 if ( this.parentNode ) { 10621 this.parentNode.insertBefore( elem, this ); 10622 } 10623 } ); 10624 }, 10625 10626 after: function() { 10627 return domManip( this, arguments, function( elem ) { 10628 if ( this.parentNode ) { 10629 this.parentNode.insertBefore( elem, this.nextSibling ); 10630 } 10631 } ); 10632 }, 10633 10634 empty: function() { 10635 var elem, 10636 i = 0; 10637 10638 for ( ; ( elem = this[ i ] ) != null; i++ ) { 10639 if ( elem.nodeType === 1 ) { 10640 10641 // Prevent memory leaks 10642 jQuery.cleanData( getAll( elem, false ) ); 10643 10644 // Remove any remaining nodes 10645 elem.textContent = ""; 10646 } 10647 } 10648 10649 return this; 10650 }, 10651 10652 clone: function( dataAndEvents, deepDataAndEvents ) { 10653 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 10654 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 10655 10656 return this.map( function() { 10657 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 10658 } ); 10659 }, 10660 10661 html: function( value ) { 10662 return access( this, function( value ) { 10663 var elem = this[ 0 ] || {}, 10664 i = 0, 10665 l = this.length; 10666 10667 if ( value === undefined && elem.nodeType === 1 ) { 10668 return elem.innerHTML; 10669 } 10670 10671 // See if we can take a shortcut and just use innerHTML 10672 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 10673 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 10674 10675 value = jQuery.htmlPrefilter( value ); 10676 10677 try { 10678 for ( ; i < l; i++ ) { 10679 elem = this[ i ] || {}; 10680 10681 // Remove element nodes and prevent memory leaks 10682 if ( elem.nodeType === 1 ) { 10683 jQuery.cleanData( getAll( elem, false ) ); 10684 elem.innerHTML = value; 10685 } 10686 } 10687 10688 elem = 0; 10689 10690 // If using innerHTML throws an exception, use the fallback method 10691 } catch ( e ) {} 10692 } 10693 10694 if ( elem ) { 10695 this.empty().append( value ); 10696 } 10697 }, null, value, arguments.length ); 10698 }, 10699 10700 replaceWith: function() { 10701 var ignored = []; 10702 10703 // Make the changes, replacing each non-ignored context element with the new content 10704 return domManip( this, arguments, function( elem ) { 10705 var parent = this.parentNode; 10706 10707 if ( jQuery.inArray( this, ignored ) < 0 ) { 10708 jQuery.cleanData( getAll( this ) ); 10709 if ( parent ) { 10710 parent.replaceChild( elem, this ); 10711 } 10712 } 10713 10714 // Force callback invocation 10715 }, ignored ); 10716 } 10717} ); 10718 10719jQuery.each( { 10720 appendTo: "append", 10721 prependTo: "prepend", 10722 insertBefore: "before", 10723 insertAfter: "after", 10724 replaceAll: "replaceWith" 10725}, function( name, original ) { 10726 jQuery.fn[ name ] = function( selector ) { 10727 var elems, 10728 ret = [], 10729 insert = jQuery( selector ), 10730 last = insert.length - 1, 10731 i = 0; 10732 10733 for ( ; i <= last; i++ ) { 10734 elems = i === last ? this : this.clone( true ); 10735 jQuery( insert[ i ] )[ original ]( elems ); 10736 10737 // Support: Android <=4.0 only, PhantomJS 1 only 10738 // .get() because push.apply(_, arraylike) throws on ancient WebKit 10739 push.apply( ret, elems.get() ); 10740 } 10741 10742 return this.pushStack( ret ); 10743 }; 10744} ); 10745var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 10746 10747var rcustomProp = /^--/; 10748 10749 10750var getStyles = function( elem ) { 10751 10752 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 10753 // IE throws on elements created in popups 10754 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 10755 var view = elem.ownerDocument.defaultView; 10756 10757 if ( !view || !view.opener ) { 10758 view = window; 10759 } 10760 10761 return view.getComputedStyle( elem ); 10762 }; 10763 10764var swap = function( elem, options, callback ) { 10765 var ret, name, 10766 old = {}; 10767 10768 // Remember the old values, and insert the new ones 10769 for ( name in options ) { 10770 old[ name ] = elem.style[ name ]; 10771 elem.style[ name ] = options[ name ]; 10772 } 10773 10774 ret = callback.call( elem ); 10775 10776 // Revert the old values 10777 for ( name in options ) { 10778 elem.style[ name ] = old[ name ]; 10779 } 10780 10781 return ret; 10782}; 10783 10784 10785var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 10786 10787 10788 10789( function() { 10790 10791 // Executing both pixelPosition & boxSizingReliable tests require only one layout 10792 // so they're executed at the same time to save the second computation. 10793 function computeStyleTests() { 10794 10795 // This is a singleton, we need to execute it only once 10796 if ( !div ) { 10797 return; 10798 } 10799 10800 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 10801 "margin-top:1px;padding:0;border:0"; 10802 div.style.cssText = 10803 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 10804 "margin:auto;border:1px;padding:1px;" + 10805 "width:60%;top:1%"; 10806 documentElement.appendChild( container ).appendChild( div ); 10807 10808 var divStyle = window.getComputedStyle( div ); 10809 pixelPositionVal = divStyle.top !== "1%"; 10810 10811 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 10812 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 10813 10814 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 10815 // Some styles come back with percentage values, even though they shouldn't 10816 div.style.right = "60%"; 10817 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 10818 10819 // Support: IE 9 - 11 only 10820 // Detect misreporting of content dimensions for box-sizing:border-box elements 10821 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 10822 10823 // Support: IE 9 only 10824 // Detect overflow:scroll screwiness (gh-3699) 10825 // Support: Chrome <=64 10826 // Don't get tricked when zoom affects offsetWidth (gh-4029) 10827 div.style.position = "absolute"; 10828 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 10829 10830 documentElement.removeChild( container ); 10831 10832 // Nullify the div so it wouldn't be stored in the memory and 10833 // it will also be a sign that checks already performed 10834 div = null; 10835 } 10836 10837 function roundPixelMeasures( measure ) { 10838 return Math.round( parseFloat( measure ) ); 10839 } 10840 10841 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 10842 reliableTrDimensionsVal, reliableMarginLeftVal, 10843 container = document.createElement( "div" ), 10844 div = document.createElement( "div" ); 10845 10846 // Finish early in limited (non-browser) environments 10847 if ( !div.style ) { 10848 return; 10849 } 10850 10851 // Support: IE <=9 - 11 only 10852 // Style of cloned element affects source element cloned (trac-8908) 10853 div.style.backgroundClip = "content-box"; 10854 div.cloneNode( true ).style.backgroundClip = ""; 10855 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 10856 10857 jQuery.extend( support, { 10858 boxSizingReliable: function() { 10859 computeStyleTests(); 10860 return boxSizingReliableVal; 10861 }, 10862 pixelBoxStyles: function() { 10863 computeStyleTests(); 10864 return pixelBoxStylesVal; 10865 }, 10866 pixelPosition: function() { 10867 computeStyleTests(); 10868 return pixelPositionVal; 10869 }, 10870 reliableMarginLeft: function() { 10871 computeStyleTests(); 10872 return reliableMarginLeftVal; 10873 }, 10874 scrollboxSize: function() { 10875 computeStyleTests(); 10876 return scrollboxSizeVal; 10877 }, 10878 10879 // Support: IE 9 - 11+, Edge 15 - 18+ 10880 // IE/Edge misreport `getComputedStyle` of table rows with width/height 10881 // set in CSS while `offset*` properties report correct values. 10882 // Behavior in IE 9 is more subtle than in newer versions & it passes 10883 // some versions of this test; make sure not to make it pass there! 10884 // 10885 // Support: Firefox 70+ 10886 // Only Firefox includes border widths 10887 // in computed dimensions. (gh-4529) 10888 reliableTrDimensions: function() { 10889 var table, tr, trChild, trStyle; 10890 if ( reliableTrDimensionsVal == null ) { 10891 table = document.createElement( "table" ); 10892 tr = document.createElement( "tr" ); 10893 trChild = document.createElement( "div" ); 10894 10895 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 10896 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 10897 10898 // Support: Chrome 86+ 10899 // Height set through cssText does not get applied. 10900 // Computed height then comes back as 0. 10901 tr.style.height = "1px"; 10902 trChild.style.height = "9px"; 10903 10904 // Support: Android 8 Chrome 86+ 10905 // In our bodyBackground.html iframe, 10906 // display for all div elements is set to "inline", 10907 // which causes a problem only in Android 8 Chrome 86. 10908 // Ensuring the div is `display: block` 10909 // gets around this issue. 10910 trChild.style.display = "block"; 10911 10912 documentElement 10913 .appendChild( table ) 10914 .appendChild( tr ) 10915 .appendChild( trChild ); 10916 10917 trStyle = window.getComputedStyle( tr ); 10918 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 10919 parseInt( trStyle.borderTopWidth, 10 ) + 10920 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 10921 10922 documentElement.removeChild( table ); 10923 } 10924 return reliableTrDimensionsVal; 10925 } 10926 } ); 10927} )(); 10928 10929 10930function curCSS( elem, name, computed ) { 10931 var width, minWidth, maxWidth, ret, 10932 isCustomProp = rcustomProp.test( name ), 10933 10934 // Support: Firefox 51+ 10935 // Retrieving style before computed somehow 10936 // fixes an issue with getting wrong values 10937 // on detached elements 10938 style = elem.style; 10939 10940 computed = computed || getStyles( elem ); 10941 10942 // getPropertyValue is needed for: 10943 // .css('filter') (IE 9 only, trac-12537) 10944 // .css('--customProperty) (gh-3144) 10945 if ( computed ) { 10946 10947 // Support: IE <=9 - 11+ 10948 // IE only supports `"float"` in `getPropertyValue`; in computed styles 10949 // it's only available as `"cssFloat"`. We no longer modify properties 10950 // sent to `.css()` apart from camelCasing, so we need to check both. 10951 // Normally, this would create difference in behavior: if 10952 // `getPropertyValue` returns an empty string, the value returned 10953 // by `.css()` would be `undefined`. This is usually the case for 10954 // disconnected elements. However, in IE even disconnected elements 10955 // with no styles return `"none"` for `getPropertyValue( "float" )` 10956 ret = computed.getPropertyValue( name ) || computed[ name ]; 10957 10958 if ( isCustomProp && ret ) { 10959 10960 // Support: Firefox 105+, Chrome <=105+ 10961 // Spec requires trimming whitespace for custom properties (gh-4926). 10962 // Firefox only trims leading whitespace. Chrome just collapses 10963 // both leading & trailing whitespace to a single space. 10964 // 10965 // Fall back to `undefined` if empty string returned. 10966 // This collapses a missing definition with property defined 10967 // and set to an empty string but there's no standard API 10968 // allowing us to differentiate them without a performance penalty 10969 // and returning `undefined` aligns with older jQuery. 10970 // 10971 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 10972 // as whitespace while CSS does not, but this is not a problem 10973 // because CSS preprocessing replaces them with U+000A LINE FEED 10974 // (which *is* CSS whitespace) 10975 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 10976 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 10977 } 10978 10979 if ( ret === "" && !isAttached( elem ) ) { 10980 ret = jQuery.style( elem, name ); 10981 } 10982 10983 // A tribute to the "awesome hack by Dean Edwards" 10984 // Android Browser returns percentage for some values, 10985 // but width seems to be reliably pixels. 10986 // This is against the CSSOM draft spec: 10987 // https://drafts.csswg.org/cssom/#resolved-values 10988 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 10989 10990 // Remember the original values 10991 width = style.width; 10992 minWidth = style.minWidth; 10993 maxWidth = style.maxWidth; 10994 10995 // Put in the new values to get a computed value out 10996 style.minWidth = style.maxWidth = style.width = ret; 10997 ret = computed.width; 10998 10999 // Revert the changed values 11000 style.width = width; 11001 style.minWidth = minWidth; 11002 style.maxWidth = maxWidth; 11003 } 11004 } 11005 11006 return ret !== undefined ? 11007 11008 // Support: IE <=9 - 11 only 11009 // IE returns zIndex value as an integer. 11010 ret + "" : 11011 ret; 11012} 11013 11014 11015function addGetHookIf( conditionFn, hookFn ) { 11016 11017 // Define the hook, we'll check on the first run if it's really needed. 11018 return { 11019 get: function() { 11020 if ( conditionFn() ) { 11021 11022 // Hook not needed (or it's not possible to use it due 11023 // to missing dependency), remove it. 11024 delete this.get; 11025 return; 11026 } 11027 11028 // Hook needed; redefine it so that the support test is not executed again. 11029 return ( this.get = hookFn ).apply( this, arguments ); 11030 } 11031 }; 11032} 11033 11034 11035var cssPrefixes = [ "Webkit", "Moz", "ms" ], 11036 emptyStyle = document.createElement( "div" ).style, 11037 vendorProps = {}; 11038 11039// Return a vendor-prefixed property or undefined 11040function vendorPropName( name ) { 11041 11042 // Check for vendor prefixed names 11043 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 11044 i = cssPrefixes.length; 11045 11046 while ( i-- ) { 11047 name = cssPrefixes[ i ] + capName; 11048 if ( name in emptyStyle ) { 11049 return name; 11050 } 11051 } 11052} 11053 11054// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 11055function finalPropName( name ) { 11056 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 11057 11058 if ( final ) { 11059 return final; 11060 } 11061 if ( name in emptyStyle ) { 11062 return name; 11063 } 11064 return vendorProps[ name ] = vendorPropName( name ) || name; 11065} 11066 11067 11068var 11069 11070 // Swappable if display is none or starts with table 11071 // except "table", "table-cell", or "table-caption" 11072 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 11073 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 11074 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 11075 cssNormalTransform = { 11076 letterSpacing: "0", 11077 fontWeight: "400" 11078 }; 11079 11080function setPositiveNumber( _elem, value, subtract ) { 11081 11082 // Any relative (+/-) values have already been 11083 // normalized at this point 11084 var matches = rcssNum.exec( value ); 11085 return matches ? 11086 11087 // Guard against undefined "subtract", e.g., when used as in cssHooks 11088 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 11089 value; 11090} 11091 11092function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 11093 var i = dimension === "width" ? 1 : 0, 11094 extra = 0, 11095 delta = 0, 11096 marginDelta = 0; 11097 11098 // Adjustment may not be necessary 11099 if ( box === ( isBorderBox ? "border" : "content" ) ) { 11100 return 0; 11101 } 11102 11103 for ( ; i < 4; i += 2 ) { 11104 11105 // Both box models exclude margin 11106 // Count margin delta separately to only add it after scroll gutter adjustment. 11107 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 11108 if ( box === "margin" ) { 11109 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 11110 } 11111 11112 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 11113 if ( !isBorderBox ) { 11114 11115 // Add padding 11116 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 11117 11118 // For "border" or "margin", add border 11119 if ( box !== "padding" ) { 11120 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 11121 11122 // But still keep track of it otherwise 11123 } else { 11124 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 11125 } 11126 11127 // If we get here with a border-box (content + padding + border), we're seeking "content" or 11128 // "padding" or "margin" 11129 } else { 11130 11131 // For "content", subtract padding 11132 if ( box === "content" ) { 11133 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 11134 } 11135 11136 // For "content" or "padding", subtract border 11137 if ( box !== "margin" ) { 11138 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 11139 } 11140 } 11141 } 11142 11143 // Account for positive content-box scroll gutter when requested by providing computedVal 11144 if ( !isBorderBox && computedVal >= 0 ) { 11145 11146 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 11147 // Assuming integer scroll gutter, subtract the rest and round down 11148 delta += Math.max( 0, Math.ceil( 11149 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 11150 computedVal - 11151 delta - 11152 extra - 11153 0.5 11154 11155 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 11156 // Use an explicit zero to avoid NaN (gh-3964) 11157 ) ) || 0; 11158 } 11159 11160 return delta + marginDelta; 11161} 11162 11163function getWidthOrHeight( elem, dimension, extra ) { 11164 11165 // Start with computed style 11166 var styles = getStyles( elem ), 11167 11168 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 11169 // Fake content-box until we know it's needed to know the true value. 11170 boxSizingNeeded = !support.boxSizingReliable() || extra, 11171 isBorderBox = boxSizingNeeded && 11172 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 11173 valueIsBorderBox = isBorderBox, 11174 11175 val = curCSS( elem, dimension, styles ), 11176 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 11177 11178 // Support: Firefox <=54 11179 // Return a confounding non-pixel value or feign ignorance, as appropriate. 11180 if ( rnumnonpx.test( val ) ) { 11181 if ( !extra ) { 11182 return val; 11183 } 11184 val = "auto"; 11185 } 11186 11187 11188 // Support: IE 9 - 11 only 11189 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 11190 // In those cases, the computed value can be trusted to be border-box. 11191 if ( ( !support.boxSizingReliable() && isBorderBox || 11192 11193 // Support: IE 10 - 11+, Edge 15 - 18+ 11194 // IE/Edge misreport `getComputedStyle` of table rows with width/height 11195 // set in CSS while `offset*` properties report correct values. 11196 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 11197 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 11198 11199 // Fall back to offsetWidth/offsetHeight when value is "auto" 11200 // This happens for inline elements with no explicit setting (gh-3571) 11201 val === "auto" || 11202 11203 // Support: Android <=4.1 - 4.3 only 11204 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 11205 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 11206 11207 // Make sure the element is visible & connected 11208 elem.getClientRects().length ) { 11209 11210 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 11211 11212 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 11213 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 11214 // retrieved value as a content box dimension. 11215 valueIsBorderBox = offsetProp in elem; 11216 if ( valueIsBorderBox ) { 11217 val = elem[ offsetProp ]; 11218 } 11219 } 11220 11221 // Normalize "" and auto 11222 val = parseFloat( val ) || 0; 11223 11224 // Adjust for the element's box model 11225 return ( val + 11226 boxModelAdjustment( 11227 elem, 11228 dimension, 11229 extra || ( isBorderBox ? "border" : "content" ), 11230 valueIsBorderBox, 11231 styles, 11232 11233 // Provide the current computed size to request scroll gutter calculation (gh-3589) 11234 val 11235 ) 11236 ) + "px"; 11237} 11238 11239jQuery.extend( { 11240 11241 // Add in style property hooks for overriding the default 11242 // behavior of getting and setting a style property 11243 cssHooks: { 11244 opacity: { 11245 get: function( elem, computed ) { 11246 if ( computed ) { 11247 11248 // We should always get a number back from opacity 11249 var ret = curCSS( elem, "opacity" ); 11250 return ret === "" ? "1" : ret; 11251 } 11252 } 11253 } 11254 }, 11255 11256 // Don't automatically add "px" to these possibly-unitless properties 11257 cssNumber: { 11258 animationIterationCount: true, 11259 aspectRatio: true, 11260 borderImageSlice: true, 11261 columnCount: true, 11262 flexGrow: true, 11263 flexShrink: true, 11264 fontWeight: true, 11265 gridArea: true, 11266 gridColumn: true, 11267 gridColumnEnd: true, 11268 gridColumnStart: true, 11269 gridRow: true, 11270 gridRowEnd: true, 11271 gridRowStart: true, 11272 lineHeight: true, 11273 opacity: true, 11274 order: true, 11275 orphans: true, 11276 scale: true, 11277 widows: true, 11278 zIndex: true, 11279 zoom: true, 11280 11281 // SVG-related 11282 fillOpacity: true, 11283 floodOpacity: true, 11284 stopOpacity: true, 11285 strokeMiterlimit: true, 11286 strokeOpacity: true 11287 }, 11288 11289 // Add in properties whose names you wish to fix before 11290 // setting or getting the value 11291 cssProps: {}, 11292 11293 // Get and set the style property on a DOM Node 11294 style: function( elem, name, value, extra ) { 11295 11296 // Don't set styles on text and comment nodes 11297 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 11298 return; 11299 } 11300 11301 // Make sure that we're working with the right name 11302 var ret, type, hooks, 11303 origName = camelCase( name ), 11304 isCustomProp = rcustomProp.test( name ), 11305 style = elem.style; 11306 11307 // Make sure that we're working with the right name. We don't 11308 // want to query the value if it is a CSS custom property 11309 // since they are user-defined. 11310 if ( !isCustomProp ) { 11311 name = finalPropName( origName ); 11312 } 11313 11314 // Gets hook for the prefixed version, then unprefixed version 11315 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 11316 11317 // Check if we're setting a value 11318 if ( value !== undefined ) { 11319 type = typeof value; 11320 11321 // Convert "+=" or "-=" to relative numbers (trac-7345) 11322 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 11323 value = adjustCSS( elem, name, ret ); 11324 11325 // Fixes bug trac-9237 11326 type = "number"; 11327 } 11328 11329 // Make sure that null and NaN values aren't set (trac-7116) 11330 if ( value == null || value !== value ) { 11331 return; 11332 } 11333 11334 // If a number was passed in, add the unit (except for certain CSS properties) 11335 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 11336 // "px" to a few hardcoded values. 11337 if ( type === "number" && !isCustomProp ) { 11338 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 11339 } 11340 11341 // background-* props affect original clone's values 11342 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 11343 style[ name ] = "inherit"; 11344 } 11345 11346 // If a hook was provided, use that value, otherwise just set the specified value 11347 if ( !hooks || !( "set" in hooks ) || 11348 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 11349 11350 if ( isCustomProp ) { 11351 style.setProperty( name, value ); 11352 } else { 11353 style[ name ] = value; 11354 } 11355 } 11356 11357 } else { 11358 11359 // If a hook was provided get the non-computed value from there 11360 if ( hooks && "get" in hooks && 11361 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 11362 11363 return ret; 11364 } 11365 11366 // Otherwise just get the value from the style object 11367 return style[ name ]; 11368 } 11369 }, 11370 11371 css: function( elem, name, extra, styles ) { 11372 var val, num, hooks, 11373 origName = camelCase( name ), 11374 isCustomProp = rcustomProp.test( name ); 11375 11376 // Make sure that we're working with the right name. We don't 11377 // want to modify the value if it is a CSS custom property 11378 // since they are user-defined. 11379 if ( !isCustomProp ) { 11380 name = finalPropName( origName ); 11381 } 11382 11383 // Try prefixed name followed by the unprefixed name 11384 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 11385 11386 // If a hook was provided get the computed value from there 11387 if ( hooks && "get" in hooks ) { 11388 val = hooks.get( elem, true, extra ); 11389 } 11390 11391 // Otherwise, if a way to get the computed value exists, use that 11392 if ( val === undefined ) { 11393 val = curCSS( elem, name, styles ); 11394 } 11395 11396 // Convert "normal" to computed value 11397 if ( val === "normal" && name in cssNormalTransform ) { 11398 val = cssNormalTransform[ name ]; 11399 } 11400 11401 // Make numeric if forced or a qualifier was provided and val looks numeric 11402 if ( extra === "" || extra ) { 11403 num = parseFloat( val ); 11404 return extra === true || isFinite( num ) ? num || 0 : val; 11405 } 11406 11407 return val; 11408 } 11409} ); 11410 11411jQuery.each( [ "height", "width" ], function( _i, dimension ) { 11412 jQuery.cssHooks[ dimension ] = { 11413 get: function( elem, computed, extra ) { 11414 if ( computed ) { 11415 11416 // Certain elements can have dimension info if we invisibly show them 11417 // but it must have a current display style that would benefit 11418 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 11419 11420 // Support: Safari 8+ 11421 // Table columns in Safari have non-zero offsetWidth & zero 11422 // getBoundingClientRect().width unless display is changed. 11423 // Support: IE <=11 only 11424 // Running getBoundingClientRect on a disconnected node 11425 // in IE throws an error. 11426 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 11427 swap( elem, cssShow, function() { 11428 return getWidthOrHeight( elem, dimension, extra ); 11429 } ) : 11430 getWidthOrHeight( elem, dimension, extra ); 11431 } 11432 }, 11433 11434 set: function( elem, value, extra ) { 11435 var matches, 11436 styles = getStyles( elem ), 11437 11438 // Only read styles.position if the test has a chance to fail 11439 // to avoid forcing a reflow. 11440 scrollboxSizeBuggy = !support.scrollboxSize() && 11441 styles.position === "absolute", 11442 11443 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 11444 boxSizingNeeded = scrollboxSizeBuggy || extra, 11445 isBorderBox = boxSizingNeeded && 11446 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 11447 subtract = extra ? 11448 boxModelAdjustment( 11449 elem, 11450 dimension, 11451 extra, 11452 isBorderBox, 11453 styles 11454 ) : 11455 0; 11456 11457 // Account for unreliable border-box dimensions by comparing offset* to computed and 11458 // faking a content-box to get border and padding (gh-3699) 11459 if ( isBorderBox && scrollboxSizeBuggy ) { 11460 subtract -= Math.ceil( 11461 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 11462 parseFloat( styles[ dimension ] ) - 11463 boxModelAdjustment( elem, dimension, "border", false, styles ) - 11464 0.5 11465 ); 11466 } 11467 11468 // Convert to pixels if value adjustment is needed 11469 if ( subtract && ( matches = rcssNum.exec( value ) ) && 11470 ( matches[ 3 ] || "px" ) !== "px" ) { 11471 11472 elem.style[ dimension ] = value; 11473 value = jQuery.css( elem, dimension ); 11474 } 11475 11476 return setPositiveNumber( elem, value, subtract ); 11477 } 11478 }; 11479} ); 11480 11481jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 11482 function( elem, computed ) { 11483 if ( computed ) { 11484 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 11485 elem.getBoundingClientRect().left - 11486 swap( elem, { marginLeft: 0 }, function() { 11487 return elem.getBoundingClientRect().left; 11488 } ) 11489 ) + "px"; 11490 } 11491 } 11492); 11493 11494// These hooks are used by animate to expand properties 11495jQuery.each( { 11496 margin: "", 11497 padding: "", 11498 border: "Width" 11499}, function( prefix, suffix ) { 11500 jQuery.cssHooks[ prefix + suffix ] = { 11501 expand: function( value ) { 11502 var i = 0, 11503 expanded = {}, 11504 11505 // Assumes a single number if not a string 11506 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 11507 11508 for ( ; i < 4; i++ ) { 11509 expanded[ prefix + cssExpand[ i ] + suffix ] = 11510 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 11511 } 11512 11513 return expanded; 11514 } 11515 }; 11516 11517 if ( prefix !== "margin" ) { 11518 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 11519 } 11520} ); 11521 11522jQuery.fn.extend( { 11523 css: function( name, value ) { 11524 return access( this, function( elem, name, value ) { 11525 var styles, len, 11526 map = {}, 11527 i = 0; 11528 11529 if ( Array.isArray( name ) ) { 11530 styles = getStyles( elem ); 11531 len = name.length; 11532 11533 for ( ; i < len; i++ ) { 11534 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 11535 } 11536 11537 return map; 11538 } 11539 11540 return value !== undefined ? 11541 jQuery.style( elem, name, value ) : 11542 jQuery.css( elem, name ); 11543 }, name, value, arguments.length > 1 ); 11544 } 11545} ); 11546 11547 11548function Tween( elem, options, prop, end, easing ) { 11549 return new Tween.prototype.init( elem, options, prop, end, easing ); 11550} 11551jQuery.Tween = Tween; 11552 11553Tween.prototype = { 11554 constructor: Tween, 11555 init: function( elem, options, prop, end, easing, unit ) { 11556 this.elem = elem; 11557 this.prop = prop; 11558 this.easing = easing || jQuery.easing._default; 11559 this.options = options; 11560 this.start = this.now = this.cur(); 11561 this.end = end; 11562 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 11563 }, 11564 cur: function() { 11565 var hooks = Tween.propHooks[ this.prop ]; 11566 11567 return hooks && hooks.get ? 11568 hooks.get( this ) : 11569 Tween.propHooks._default.get( this ); 11570 }, 11571 run: function( percent ) { 11572 var eased, 11573 hooks = Tween.propHooks[ this.prop ]; 11574 11575 if ( this.options.duration ) { 11576 this.pos = eased = jQuery.easing[ this.easing ]( 11577 percent, this.options.duration * percent, 0, 1, this.options.duration 11578 ); 11579 } else { 11580 this.pos = eased = percent; 11581 } 11582 this.now = ( this.end - this.start ) * eased + this.start; 11583 11584 if ( this.options.step ) { 11585 this.options.step.call( this.elem, this.now, this ); 11586 } 11587 11588 if ( hooks && hooks.set ) { 11589 hooks.set( this ); 11590 } else { 11591 Tween.propHooks._default.set( this ); 11592 } 11593 return this; 11594 } 11595}; 11596 11597Tween.prototype.init.prototype = Tween.prototype; 11598 11599Tween.propHooks = { 11600 _default: { 11601 get: function( tween ) { 11602 var result; 11603 11604 // Use a property on the element directly when it is not a DOM element, 11605 // or when there is no matching style property that exists. 11606 if ( tween.elem.nodeType !== 1 || 11607 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 11608 return tween.elem[ tween.prop ]; 11609 } 11610 11611 // Passing an empty string as a 3rd parameter to .css will automatically 11612 // attempt a parseFloat and fallback to a string if the parse fails. 11613 // Simple values such as "10px" are parsed to Float; 11614 // complex values such as "rotate(1rad)" are returned as-is. 11615 result = jQuery.css( tween.elem, tween.prop, "" ); 11616 11617 // Empty strings, null, undefined and "auto" are converted to 0. 11618 return !result || result === "auto" ? 0 : result; 11619 }, 11620 set: function( tween ) { 11621 11622 // Use step hook for back compat. 11623 // Use cssHook if its there. 11624 // Use .style if available and use plain properties where available. 11625 if ( jQuery.fx.step[ tween.prop ] ) { 11626 jQuery.fx.step[ tween.prop ]( tween ); 11627 } else if ( tween.elem.nodeType === 1 && ( 11628 jQuery.cssHooks[ tween.prop ] || 11629 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 11630 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 11631 } else { 11632 tween.elem[ tween.prop ] = tween.now; 11633 } 11634 } 11635 } 11636}; 11637 11638// Support: IE <=9 only 11639// Panic based approach to setting things on disconnected nodes 11640Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 11641 set: function( tween ) { 11642 if ( tween.elem.nodeType && tween.elem.parentNode ) { 11643 tween.elem[ tween.prop ] = tween.now; 11644 } 11645 } 11646}; 11647 11648jQuery.easing = { 11649 linear: function( p ) { 11650 return p; 11651 }, 11652 swing: function( p ) { 11653 return 0.5 - Math.cos( p * Math.PI ) / 2; 11654 }, 11655 _default: "swing" 11656}; 11657 11658jQuery.fx = Tween.prototype.init; 11659 11660// Back compat <1.8 extension point 11661jQuery.fx.step = {}; 11662 11663 11664 11665 11666var 11667 fxNow, inProgress, 11668 rfxtypes = /^(?:toggle|show|hide)$/, 11669 rrun = /queueHooks$/; 11670 11671function schedule() { 11672 if ( inProgress ) { 11673 if ( document.hidden === false && window.requestAnimationFrame ) { 11674 window.requestAnimationFrame( schedule ); 11675 } else { 11676 window.setTimeout( schedule, jQuery.fx.interval ); 11677 } 11678 11679 jQuery.fx.tick(); 11680 } 11681} 11682 11683// Animations created synchronously will run synchronously 11684function createFxNow() { 11685 window.setTimeout( function() { 11686 fxNow = undefined; 11687 } ); 11688 return ( fxNow = Date.now() ); 11689} 11690 11691// Generate parameters to create a standard animation 11692function genFx( type, includeWidth ) { 11693 var which, 11694 i = 0, 11695 attrs = { height: type }; 11696 11697 // If we include width, step value is 1 to do all cssExpand values, 11698 // otherwise step value is 2 to skip over Left and Right 11699 includeWidth = includeWidth ? 1 : 0; 11700 for ( ; i < 4; i += 2 - includeWidth ) { 11701 which = cssExpand[ i ]; 11702 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 11703 } 11704 11705 if ( includeWidth ) { 11706 attrs.opacity = attrs.width = type; 11707 } 11708 11709 return attrs; 11710} 11711 11712function createTween( value, prop, animation ) { 11713 var tween, 11714 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 11715 index = 0, 11716 length = collection.length; 11717 for ( ; index < length; index++ ) { 11718 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 11719 11720 // We're done with this property 11721 return tween; 11722 } 11723 } 11724} 11725 11726function defaultPrefilter( elem, props, opts ) { 11727 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 11728 isBox = "width" in props || "height" in props, 11729 anim = this, 11730 orig = {}, 11731 style = elem.style, 11732 hidden = elem.nodeType && isHiddenWithinTree( elem ), 11733 dataShow = dataPriv.get( elem, "fxshow" ); 11734 11735 // Queue-skipping animations hijack the fx hooks 11736 if ( !opts.queue ) { 11737 hooks = jQuery._queueHooks( elem, "fx" ); 11738 if ( hooks.unqueued == null ) { 11739 hooks.unqueued = 0; 11740 oldfire = hooks.empty.fire; 11741 hooks.empty.fire = function() { 11742 if ( !hooks.unqueued ) { 11743 oldfire(); 11744 } 11745 }; 11746 } 11747 hooks.unqueued++; 11748 11749 anim.always( function() { 11750 11751 // Ensure the complete handler is called before this completes 11752 anim.always( function() { 11753 hooks.unqueued--; 11754 if ( !jQuery.queue( elem, "fx" ).length ) { 11755 hooks.empty.fire(); 11756 } 11757 } ); 11758 } ); 11759 } 11760 11761 // Detect show/hide animations 11762 for ( prop in props ) { 11763 value = props[ prop ]; 11764 if ( rfxtypes.test( value ) ) { 11765 delete props[ prop ]; 11766 toggle = toggle || value === "toggle"; 11767 if ( value === ( hidden ? "hide" : "show" ) ) { 11768 11769 // Pretend to be hidden if this is a "show" and 11770 // there is still data from a stopped show/hide 11771 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 11772 hidden = true; 11773 11774 // Ignore all other no-op show/hide data 11775 } else { 11776 continue; 11777 } 11778 } 11779 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 11780 } 11781 } 11782 11783 // Bail out if this is a no-op like .hide().hide() 11784 propTween = !jQuery.isEmptyObject( props ); 11785 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 11786 return; 11787 } 11788 11789 // Restrict "overflow" and "display" styles during box animations 11790 if ( isBox && elem.nodeType === 1 ) { 11791 11792 // Support: IE <=9 - 11, Edge 12 - 15 11793 // Record all 3 overflow attributes because IE does not infer the shorthand 11794 // from identically-valued overflowX and overflowY and Edge just mirrors 11795 // the overflowX value there. 11796 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 11797 11798 // Identify a display type, preferring old show/hide data over the CSS cascade 11799 restoreDisplay = dataShow && dataShow.display; 11800 if ( restoreDisplay == null ) { 11801 restoreDisplay = dataPriv.get( elem, "display" ); 11802 } 11803 display = jQuery.css( elem, "display" ); 11804 if ( display === "none" ) { 11805 if ( restoreDisplay ) { 11806 display = restoreDisplay; 11807 } else { 11808 11809 // Get nonempty value(s) by temporarily forcing visibility 11810 showHide( [ elem ], true ); 11811 restoreDisplay = elem.style.display || restoreDisplay; 11812 display = jQuery.css( elem, "display" ); 11813 showHide( [ elem ] ); 11814 } 11815 } 11816 11817 // Animate inline elements as inline-block 11818 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 11819 if ( jQuery.css( elem, "float" ) === "none" ) { 11820 11821 // Restore the original display value at the end of pure show/hide animations 11822 if ( !propTween ) { 11823 anim.done( function() { 11824 style.display = restoreDisplay; 11825 } ); 11826 if ( restoreDisplay == null ) { 11827 display = style.display; 11828 restoreDisplay = display === "none" ? "" : display; 11829 } 11830 } 11831 style.display = "inline-block"; 11832 } 11833 } 11834 } 11835 11836 if ( opts.overflow ) { 11837 style.overflow = "hidden"; 11838 anim.always( function() { 11839 style.overflow = opts.overflow[ 0 ]; 11840 style.overflowX = opts.overflow[ 1 ]; 11841 style.overflowY = opts.overflow[ 2 ]; 11842 } ); 11843 } 11844 11845 // Implement show/hide animations 11846 propTween = false; 11847 for ( prop in orig ) { 11848 11849 // General show/hide setup for this element animation 11850 if ( !propTween ) { 11851 if ( dataShow ) { 11852 if ( "hidden" in dataShow ) { 11853 hidden = dataShow.hidden; 11854 } 11855 } else { 11856 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 11857 } 11858 11859 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 11860 if ( toggle ) { 11861 dataShow.hidden = !hidden; 11862 } 11863 11864 // Show elements before animating them 11865 if ( hidden ) { 11866 showHide( [ elem ], true ); 11867 } 11868 11869 /* eslint-disable no-loop-func */ 11870 11871 anim.done( function() { 11872 11873 /* eslint-enable no-loop-func */ 11874 11875 // The final step of a "hide" animation is actually hiding the element 11876 if ( !hidden ) { 11877 showHide( [ elem ] ); 11878 } 11879 dataPriv.remove( elem, "fxshow" ); 11880 for ( prop in orig ) { 11881 jQuery.style( elem, prop, orig[ prop ] ); 11882 } 11883 } ); 11884 } 11885 11886 // Per-property setup 11887 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 11888 if ( !( prop in dataShow ) ) { 11889 dataShow[ prop ] = propTween.start; 11890 if ( hidden ) { 11891 propTween.end = propTween.start; 11892 propTween.start = 0; 11893 } 11894 } 11895 } 11896} 11897 11898function propFilter( props, specialEasing ) { 11899 var index, name, easing, value, hooks; 11900 11901 // camelCase, specialEasing and expand cssHook pass 11902 for ( index in props ) { 11903 name = camelCase( index ); 11904 easing = specialEasing[ name ]; 11905 value = props[ index ]; 11906 if ( Array.isArray( value ) ) { 11907 easing = value[ 1 ]; 11908 value = props[ index ] = value[ 0 ]; 11909 } 11910 11911 if ( index !== name ) { 11912 props[ name ] = value; 11913 delete props[ index ]; 11914 } 11915 11916 hooks = jQuery.cssHooks[ name ]; 11917 if ( hooks && "expand" in hooks ) { 11918 value = hooks.expand( value ); 11919 delete props[ name ]; 11920 11921 // Not quite $.extend, this won't overwrite existing keys. 11922 // Reusing 'index' because we have the correct "name" 11923 for ( index in value ) { 11924 if ( !( index in props ) ) { 11925 props[ index ] = value[ index ]; 11926 specialEasing[ index ] = easing; 11927 } 11928 } 11929 } else { 11930 specialEasing[ name ] = easing; 11931 } 11932 } 11933} 11934 11935function Animation( elem, properties, options ) { 11936 var result, 11937 stopped, 11938 index = 0, 11939 length = Animation.prefilters.length, 11940 deferred = jQuery.Deferred().always( function() { 11941 11942 // Don't match elem in the :animated selector 11943 delete tick.elem; 11944 } ), 11945 tick = function() { 11946 if ( stopped ) { 11947 return false; 11948 } 11949 var currentTime = fxNow || createFxNow(), 11950 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 11951 11952 // Support: Android 2.3 only 11953 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 11954 temp = remaining / animation.duration || 0, 11955 percent = 1 - temp, 11956 index = 0, 11957 length = animation.tweens.length; 11958 11959 for ( ; index < length; index++ ) { 11960 animation.tweens[ index ].run( percent ); 11961 } 11962 11963 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 11964 11965 // If there's more to do, yield 11966 if ( percent < 1 && length ) { 11967 return remaining; 11968 } 11969 11970 // If this was an empty animation, synthesize a final progress notification 11971 if ( !length ) { 11972 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 11973 } 11974 11975 // Resolve the animation and report its conclusion 11976 deferred.resolveWith( elem, [ animation ] ); 11977 return false; 11978 }, 11979 animation = deferred.promise( { 11980 elem: elem, 11981 props: jQuery.extend( {}, properties ), 11982 opts: jQuery.extend( true, { 11983 specialEasing: {}, 11984 easing: jQuery.easing._default 11985 }, options ), 11986 originalProperties: properties, 11987 originalOptions: options, 11988 startTime: fxNow || createFxNow(), 11989 duration: options.duration, 11990 tweens: [], 11991 createTween: function( prop, end ) { 11992 var tween = jQuery.Tween( elem, animation.opts, prop, end, 11993 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 11994 animation.tweens.push( tween ); 11995 return tween; 11996 }, 11997 stop: function( gotoEnd ) { 11998 var index = 0, 11999 12000 // If we are going to the end, we want to run all the tweens 12001 // otherwise we skip this part 12002 length = gotoEnd ? animation.tweens.length : 0; 12003 if ( stopped ) { 12004 return this; 12005 } 12006 stopped = true; 12007 for ( ; index < length; index++ ) { 12008 animation.tweens[ index ].run( 1 ); 12009 } 12010 12011 // Resolve when we played the last frame; otherwise, reject 12012 if ( gotoEnd ) { 12013 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 12014 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 12015 } else { 12016 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 12017 } 12018 return this; 12019 } 12020 } ), 12021 props = animation.props; 12022 12023 propFilter( props, animation.opts.specialEasing ); 12024 12025 for ( ; index < length; index++ ) { 12026 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 12027 if ( result ) { 12028 if ( isFunction( result.stop ) ) { 12029 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 12030 result.stop.bind( result ); 12031 } 12032 return result; 12033 } 12034 } 12035 12036 jQuery.map( props, createTween, animation ); 12037 12038 if ( isFunction( animation.opts.start ) ) { 12039 animation.opts.start.call( elem, animation ); 12040 } 12041 12042 // Attach callbacks from options 12043 animation 12044 .progress( animation.opts.progress ) 12045 .done( animation.opts.done, animation.opts.complete ) 12046 .fail( animation.opts.fail ) 12047 .always( animation.opts.always ); 12048 12049 jQuery.fx.timer( 12050 jQuery.extend( tick, { 12051 elem: elem, 12052 anim: animation, 12053 queue: animation.opts.queue 12054 } ) 12055 ); 12056 12057 return animation; 12058} 12059 12060jQuery.Animation = jQuery.extend( Animation, { 12061 12062 tweeners: { 12063 "*": [ function( prop, value ) { 12064 var tween = this.createTween( prop, value ); 12065 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 12066 return tween; 12067 } ] 12068 }, 12069 12070 tweener: function( props, callback ) { 12071 if ( isFunction( props ) ) { 12072 callback = props; 12073 props = [ "*" ]; 12074 } else { 12075 props = props.match( rnothtmlwhite ); 12076 } 12077 12078 var prop, 12079 index = 0, 12080 length = props.length; 12081 12082 for ( ; index < length; index++ ) { 12083 prop = props[ index ]; 12084 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 12085 Animation.tweeners[ prop ].unshift( callback ); 12086 } 12087 }, 12088 12089 prefilters: [ defaultPrefilter ], 12090 12091 prefilter: function( callback, prepend ) { 12092 if ( prepend ) { 12093 Animation.prefilters.unshift( callback ); 12094 } else { 12095 Animation.prefilters.push( callback ); 12096 } 12097 } 12098} ); 12099 12100jQuery.speed = function( speed, easing, fn ) { 12101 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 12102 complete: fn || !fn && easing || 12103 isFunction( speed ) && speed, 12104 duration: speed, 12105 easing: fn && easing || easing && !isFunction( easing ) && easing 12106 }; 12107 12108 // Go to the end state if fx are off 12109 if ( jQuery.fx.off ) { 12110 opt.duration = 0; 12111 12112 } else { 12113 if ( typeof opt.duration !== "number" ) { 12114 if ( opt.duration in jQuery.fx.speeds ) { 12115 opt.duration = jQuery.fx.speeds[ opt.duration ]; 12116 12117 } else { 12118 opt.duration = jQuery.fx.speeds._default; 12119 } 12120 } 12121 } 12122 12123 // Normalize opt.queue - true/undefined/null -> "fx" 12124 if ( opt.queue == null || opt.queue === true ) { 12125 opt.queue = "fx"; 12126 } 12127 12128 // Queueing 12129 opt.old = opt.complete; 12130 12131 opt.complete = function() { 12132 if ( isFunction( opt.old ) ) { 12133 opt.old.call( this ); 12134 } 12135 12136 if ( opt.queue ) { 12137 jQuery.dequeue( this, opt.queue ); 12138 } 12139 }; 12140 12141 return opt; 12142}; 12143 12144jQuery.fn.extend( { 12145 fadeTo: function( speed, to, easing, callback ) { 12146 12147 // Show any hidden elements after setting opacity to 0 12148 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 12149 12150 // Animate to the value specified 12151 .end().animate( { opacity: to }, speed, easing, callback ); 12152 }, 12153 animate: function( prop, speed, easing, callback ) { 12154 var empty = jQuery.isEmptyObject( prop ), 12155 optall = jQuery.speed( speed, easing, callback ), 12156 doAnimation = function() { 12157 12158 // Operate on a copy of prop so per-property easing won't be lost 12159 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 12160 12161 // Empty animations, or finishing resolves immediately 12162 if ( empty || dataPriv.get( this, "finish" ) ) { 12163 anim.stop( true ); 12164 } 12165 }; 12166 12167 doAnimation.finish = doAnimation; 12168 12169 return empty || optall.queue === false ? 12170 this.each( doAnimation ) : 12171 this.queue( optall.queue, doAnimation ); 12172 }, 12173 stop: function( type, clearQueue, gotoEnd ) { 12174 var stopQueue = function( hooks ) { 12175 var stop = hooks.stop; 12176 delete hooks.stop; 12177 stop( gotoEnd ); 12178 }; 12179 12180 if ( typeof type !== "string" ) { 12181 gotoEnd = clearQueue; 12182 clearQueue = type; 12183 type = undefined; 12184 } 12185 if ( clearQueue ) { 12186 this.queue( type || "fx", [] ); 12187 } 12188 12189 return this.each( function() { 12190 var dequeue = true, 12191 index = type != null && type + "queueHooks", 12192 timers = jQuery.timers, 12193 data = dataPriv.get( this ); 12194 12195 if ( index ) { 12196 if ( data[ index ] && data[ index ].stop ) { 12197 stopQueue( data[ index ] ); 12198 } 12199 } else { 12200 for ( index in data ) { 12201 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 12202 stopQueue( data[ index ] ); 12203 } 12204 } 12205 } 12206 12207 for ( index = timers.length; index--; ) { 12208 if ( timers[ index ].elem === this && 12209 ( type == null || timers[ index ].queue === type ) ) { 12210 12211 timers[ index ].anim.stop( gotoEnd ); 12212 dequeue = false; 12213 timers.splice( index, 1 ); 12214 } 12215 } 12216 12217 // Start the next in the queue if the last step wasn't forced. 12218 // Timers currently will call their complete callbacks, which 12219 // will dequeue but only if they were gotoEnd. 12220 if ( dequeue || !gotoEnd ) { 12221 jQuery.dequeue( this, type ); 12222 } 12223 } ); 12224 }, 12225 finish: function( type ) { 12226 if ( type !== false ) { 12227 type = type || "fx"; 12228 } 12229 return this.each( function() { 12230 var index, 12231 data = dataPriv.get( this ), 12232 queue = data[ type + "queue" ], 12233 hooks = data[ type + "queueHooks" ], 12234 timers = jQuery.timers, 12235 length = queue ? queue.length : 0; 12236 12237 // Enable finishing flag on private data 12238 data.finish = true; 12239 12240 // Empty the queue first 12241 jQuery.queue( this, type, [] ); 12242 12243 if ( hooks && hooks.stop ) { 12244 hooks.stop.call( this, true ); 12245 } 12246 12247 // Look for any active animations, and finish them 12248 for ( index = timers.length; index--; ) { 12249 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 12250 timers[ index ].anim.stop( true ); 12251 timers.splice( index, 1 ); 12252 } 12253 } 12254 12255 // Look for any animations in the old queue and finish them 12256 for ( index = 0; index < length; index++ ) { 12257 if ( queue[ index ] && queue[ index ].finish ) { 12258 queue[ index ].finish.call( this ); 12259 } 12260 } 12261 12262 // Turn off finishing flag 12263 delete data.finish; 12264 } ); 12265 } 12266} ); 12267 12268jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 12269 var cssFn = jQuery.fn[ name ]; 12270 jQuery.fn[ name ] = function( speed, easing, callback ) { 12271 return speed == null || typeof speed === "boolean" ? 12272 cssFn.apply( this, arguments ) : 12273 this.animate( genFx( name, true ), speed, easing, callback ); 12274 }; 12275} ); 12276 12277// Generate shortcuts for custom animations 12278jQuery.each( { 12279 slideDown: genFx( "show" ), 12280 slideUp: genFx( "hide" ), 12281 slideToggle: genFx( "toggle" ), 12282 fadeIn: { opacity: "show" }, 12283 fadeOut: { opacity: "hide" }, 12284 fadeToggle: { opacity: "toggle" } 12285}, function( name, props ) { 12286 jQuery.fn[ name ] = function( speed, easing, callback ) { 12287 return this.animate( props, speed, easing, callback ); 12288 }; 12289} ); 12290 12291jQuery.timers = []; 12292jQuery.fx.tick = function() { 12293 var timer, 12294 i = 0, 12295 timers = jQuery.timers; 12296 12297 fxNow = Date.now(); 12298 12299 for ( ; i < timers.length; i++ ) { 12300 timer = timers[ i ]; 12301 12302 // Run the timer and safely remove it when done (allowing for external removal) 12303 if ( !timer() && timers[ i ] === timer ) { 12304 timers.splice( i--, 1 ); 12305 } 12306 } 12307 12308 if ( !timers.length ) { 12309 jQuery.fx.stop(); 12310 } 12311 fxNow = undefined; 12312}; 12313 12314jQuery.fx.timer = function( timer ) { 12315 jQuery.timers.push( timer ); 12316 jQuery.fx.start(); 12317}; 12318 12319jQuery.fx.interval = 13; 12320jQuery.fx.start = function() { 12321 if ( inProgress ) { 12322 return; 12323 } 12324 12325 inProgress = true; 12326 schedule(); 12327}; 12328 12329jQuery.fx.stop = function() { 12330 inProgress = null; 12331}; 12332 12333jQuery.fx.speeds = { 12334 slow: 600, 12335 fast: 200, 12336 12337 // Default speed 12338 _default: 400 12339}; 12340 12341 12342// Based off of the plugin by Clint Helfers, with permission. 12343jQuery.fn.delay = function( time, type ) { 12344 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 12345 type = type || "fx"; 12346 12347 return this.queue( type, function( next, hooks ) { 12348 var timeout = window.setTimeout( next, time ); 12349 hooks.stop = function() { 12350 window.clearTimeout( timeout ); 12351 }; 12352 } ); 12353}; 12354 12355 12356( function() { 12357 var input = document.createElement( "input" ), 12358 select = document.createElement( "select" ), 12359 opt = select.appendChild( document.createElement( "option" ) ); 12360 12361 input.type = "checkbox"; 12362 12363 // Support: Android <=4.3 only 12364 // Default value for a checkbox should be "on" 12365 support.checkOn = input.value !== ""; 12366 12367 // Support: IE <=11 only 12368 // Must access selectedIndex to make default options select 12369 support.optSelected = opt.selected; 12370 12371 // Support: IE <=11 only 12372 // An input loses its value after becoming a radio 12373 input = document.createElement( "input" ); 12374 input.value = "t"; 12375 input.type = "radio"; 12376 support.radioValue = input.value === "t"; 12377} )(); 12378 12379 12380var boolHook, 12381 attrHandle = jQuery.expr.attrHandle; 12382 12383jQuery.fn.extend( { 12384 attr: function( name, value ) { 12385 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 12386 }, 12387 12388 removeAttr: function( name ) { 12389 return this.each( function() { 12390 jQuery.removeAttr( this, name ); 12391 } ); 12392 } 12393} ); 12394 12395jQuery.extend( { 12396 attr: function( elem, name, value ) { 12397 var ret, hooks, 12398 nType = elem.nodeType; 12399 12400 // Don't get/set attributes on text, comment and attribute nodes 12401 if ( nType === 3 || nType === 8 || nType === 2 ) { 12402 return; 12403 } 12404 12405 // Fallback to prop when attributes are not supported 12406 if ( typeof elem.getAttribute === "undefined" ) { 12407 return jQuery.prop( elem, name, value ); 12408 } 12409 12410 // Attribute hooks are determined by the lowercase version 12411 // Grab necessary hook if one is defined 12412 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 12413 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 12414 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 12415 } 12416 12417 if ( value !== undefined ) { 12418 if ( value === null ) { 12419 jQuery.removeAttr( elem, name ); 12420 return; 12421 } 12422 12423 if ( hooks && "set" in hooks && 12424 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 12425 return ret; 12426 } 12427 12428 elem.setAttribute( name, value + "" ); 12429 return value; 12430 } 12431 12432 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 12433 return ret; 12434 } 12435 12436 ret = jQuery.find.attr( elem, name ); 12437 12438 // Non-existent attributes return null, we normalize to undefined 12439 return ret == null ? undefined : ret; 12440 }, 12441 12442 attrHooks: { 12443 type: { 12444 set: function( elem, value ) { 12445 if ( !support.radioValue && value === "radio" && 12446 nodeName( elem, "input" ) ) { 12447 var val = elem.value; 12448 elem.setAttribute( "type", value ); 12449 if ( val ) { 12450 elem.value = val; 12451 } 12452 return value; 12453 } 12454 } 12455 } 12456 }, 12457 12458 removeAttr: function( elem, value ) { 12459 var name, 12460 i = 0, 12461 12462 // Attribute names can contain non-HTML whitespace characters 12463 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 12464 attrNames = value && value.match( rnothtmlwhite ); 12465 12466 if ( attrNames && elem.nodeType === 1 ) { 12467 while ( ( name = attrNames[ i++ ] ) ) { 12468 elem.removeAttribute( name ); 12469 } 12470 } 12471 } 12472} ); 12473 12474// Hooks for boolean attributes 12475boolHook = { 12476 set: function( elem, value, name ) { 12477 if ( value === false ) { 12478 12479 // Remove boolean attributes when set to false 12480 jQuery.removeAttr( elem, name ); 12481 } else { 12482 elem.setAttribute( name, name ); 12483 } 12484 return name; 12485 } 12486}; 12487 12488jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 12489 var getter = attrHandle[ name ] || jQuery.find.attr; 12490 12491 attrHandle[ name ] = function( elem, name, isXML ) { 12492 var ret, handle, 12493 lowercaseName = name.toLowerCase(); 12494 12495 if ( !isXML ) { 12496 12497 // Avoid an infinite loop by temporarily removing this function from the getter 12498 handle = attrHandle[ lowercaseName ]; 12499 attrHandle[ lowercaseName ] = ret; 12500 ret = getter( elem, name, isXML ) != null ? 12501 lowercaseName : 12502 null; 12503 attrHandle[ lowercaseName ] = handle; 12504 } 12505 return ret; 12506 }; 12507} ); 12508 12509 12510 12511 12512var rfocusable = /^(?:input|select|textarea|button)$/i, 12513 rclickable = /^(?:a|area)$/i; 12514 12515jQuery.fn.extend( { 12516 prop: function( name, value ) { 12517 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 12518 }, 12519 12520 removeProp: function( name ) { 12521 return this.each( function() { 12522 delete this[ jQuery.propFix[ name ] || name ]; 12523 } ); 12524 } 12525} ); 12526 12527jQuery.extend( { 12528 prop: function( elem, name, value ) { 12529 var ret, hooks, 12530 nType = elem.nodeType; 12531 12532 // Don't get/set properties on text, comment and attribute nodes 12533 if ( nType === 3 || nType === 8 || nType === 2 ) { 12534 return; 12535 } 12536 12537 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 12538 12539 // Fix name and attach hooks 12540 name = jQuery.propFix[ name ] || name; 12541 hooks = jQuery.propHooks[ name ]; 12542 } 12543 12544 if ( value !== undefined ) { 12545 if ( hooks && "set" in hooks && 12546 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 12547 return ret; 12548 } 12549 12550 return ( elem[ name ] = value ); 12551 } 12552 12553 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 12554 return ret; 12555 } 12556 12557 return elem[ name ]; 12558 }, 12559 12560 propHooks: { 12561 tabIndex: { 12562 get: function( elem ) { 12563 12564 // Support: IE <=9 - 11 only 12565 // elem.tabIndex doesn't always return the 12566 // correct value when it hasn't been explicitly set 12567 // Use proper attribute retrieval (trac-12072) 12568 var tabindex = jQuery.find.attr( elem, "tabindex" ); 12569 12570 if ( tabindex ) { 12571 return parseInt( tabindex, 10 ); 12572 } 12573 12574 if ( 12575 rfocusable.test( elem.nodeName ) || 12576 rclickable.test( elem.nodeName ) && 12577 elem.href 12578 ) { 12579 return 0; 12580 } 12581 12582 return -1; 12583 } 12584 } 12585 }, 12586 12587 propFix: { 12588 "for": "htmlFor", 12589 "class": "className" 12590 } 12591} ); 12592 12593// Support: IE <=11 only 12594// Accessing the selectedIndex property 12595// forces the browser to respect setting selected 12596// on the option 12597// The getter ensures a default option is selected 12598// when in an optgroup 12599// eslint rule "no-unused-expressions" is disabled for this code 12600// since it considers such accessions noop 12601if ( !support.optSelected ) { 12602 jQuery.propHooks.selected = { 12603 get: function( elem ) { 12604 12605 /* eslint no-unused-expressions: "off" */ 12606 12607 var parent = elem.parentNode; 12608 if ( parent && parent.parentNode ) { 12609 parent.parentNode.selectedIndex; 12610 } 12611 return null; 12612 }, 12613 set: function( elem ) { 12614 12615 /* eslint no-unused-expressions: "off" */ 12616 12617 var parent = elem.parentNode; 12618 if ( parent ) { 12619 parent.selectedIndex; 12620 12621 if ( parent.parentNode ) { 12622 parent.parentNode.selectedIndex; 12623 } 12624 } 12625 } 12626 }; 12627} 12628 12629jQuery.each( [ 12630 "tabIndex", 12631 "readOnly", 12632 "maxLength", 12633 "cellSpacing", 12634 "cellPadding", 12635 "rowSpan", 12636 "colSpan", 12637 "useMap", 12638 "frameBorder", 12639 "contentEditable" 12640], function() { 12641 jQuery.propFix[ this.toLowerCase() ] = this; 12642} ); 12643 12644 12645 12646 12647 // Strip and collapse whitespace according to HTML spec 12648 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 12649 function stripAndCollapse( value ) { 12650 var tokens = value.match( rnothtmlwhite ) || []; 12651 return tokens.join( " " ); 12652 } 12653 12654 12655function getClass( elem ) { 12656 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 12657} 12658 12659function classesToArray( value ) { 12660 if ( Array.isArray( value ) ) { 12661 return value; 12662 } 12663 if ( typeof value === "string" ) { 12664 return value.match( rnothtmlwhite ) || []; 12665 } 12666 return []; 12667} 12668 12669jQuery.fn.extend( { 12670 addClass: function( value ) { 12671 var classNames, cur, curValue, className, i, finalValue; 12672 12673 if ( isFunction( value ) ) { 12674 return this.each( function( j ) { 12675 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 12676 } ); 12677 } 12678 12679 classNames = classesToArray( value ); 12680 12681 if ( classNames.length ) { 12682 return this.each( function() { 12683 curValue = getClass( this ); 12684 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 12685 12686 if ( cur ) { 12687 for ( i = 0; i < classNames.length; i++ ) { 12688 className = classNames[ i ]; 12689 if ( cur.indexOf( " " + className + " " ) < 0 ) { 12690 cur += className + " "; 12691 } 12692 } 12693 12694 // Only assign if different to avoid unneeded rendering. 12695 finalValue = stripAndCollapse( cur ); 12696 if ( curValue !== finalValue ) { 12697 this.setAttribute( "class", finalValue ); 12698 } 12699 } 12700 } ); 12701 } 12702 12703 return this; 12704 }, 12705 12706 removeClass: function( value ) { 12707 var classNames, cur, curValue, className, i, finalValue; 12708 12709 if ( isFunction( value ) ) { 12710 return this.each( function( j ) { 12711 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 12712 } ); 12713 } 12714 12715 if ( !arguments.length ) { 12716 return this.attr( "class", "" ); 12717 } 12718 12719 classNames = classesToArray( value ); 12720 12721 if ( classNames.length ) { 12722 return this.each( function() { 12723 curValue = getClass( this ); 12724 12725 // This expression is here for better compressibility (see addClass) 12726 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 12727 12728 if ( cur ) { 12729 for ( i = 0; i < classNames.length; i++ ) { 12730 className = classNames[ i ]; 12731 12732 // Remove *all* instances 12733 while ( cur.indexOf( " " + className + " " ) > -1 ) { 12734 cur = cur.replace( " " + className + " ", " " ); 12735 } 12736 } 12737 12738 // Only assign if different to avoid unneeded rendering. 12739 finalValue = stripAndCollapse( cur ); 12740 if ( curValue !== finalValue ) { 12741 this.setAttribute( "class", finalValue ); 12742 } 12743 } 12744 } ); 12745 } 12746 12747 return this; 12748 }, 12749 12750 toggleClass: function( value, stateVal ) { 12751 var classNames, className, i, self, 12752 type = typeof value, 12753 isValidValue = type === "string" || Array.isArray( value ); 12754 12755 if ( isFunction( value ) ) { 12756 return this.each( function( i ) { 12757 jQuery( this ).toggleClass( 12758 value.call( this, i, getClass( this ), stateVal ), 12759 stateVal 12760 ); 12761 } ); 12762 } 12763 12764 if ( typeof stateVal === "boolean" && isValidValue ) { 12765 return stateVal ? this.addClass( value ) : this.removeClass( value ); 12766 } 12767 12768 classNames = classesToArray( value ); 12769 12770 return this.each( function() { 12771 if ( isValidValue ) { 12772 12773 // Toggle individual class names 12774 self = jQuery( this ); 12775 12776 for ( i = 0; i < classNames.length; i++ ) { 12777 className = classNames[ i ]; 12778 12779 // Check each className given, space separated list 12780 if ( self.hasClass( className ) ) { 12781 self.removeClass( className ); 12782 } else { 12783 self.addClass( className ); 12784 } 12785 } 12786 12787 // Toggle whole class name 12788 } else if ( value === undefined || type === "boolean" ) { 12789 className = getClass( this ); 12790 if ( className ) { 12791 12792 // Store className if set 12793 dataPriv.set( this, "__className__", className ); 12794 } 12795 12796 // If the element has a class name or if we're passed `false`, 12797 // then remove the whole classname (if there was one, the above saved it). 12798 // Otherwise bring back whatever was previously saved (if anything), 12799 // falling back to the empty string if nothing was stored. 12800 if ( this.setAttribute ) { 12801 this.setAttribute( "class", 12802 className || value === false ? 12803 "" : 12804 dataPriv.get( this, "__className__" ) || "" 12805 ); 12806 } 12807 } 12808 } ); 12809 }, 12810 12811 hasClass: function( selector ) { 12812 var className, elem, 12813 i = 0; 12814 12815 className = " " + selector + " "; 12816 while ( ( elem = this[ i++ ] ) ) { 12817 if ( elem.nodeType === 1 && 12818 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 12819 return true; 12820 } 12821 } 12822 12823 return false; 12824 } 12825} ); 12826 12827 12828 12829 12830var rreturn = /\r/g; 12831 12832jQuery.fn.extend( { 12833 val: function( value ) { 12834 var hooks, ret, valueIsFunction, 12835 elem = this[ 0 ]; 12836 12837 if ( !arguments.length ) { 12838 if ( elem ) { 12839 hooks = jQuery.valHooks[ elem.type ] || 12840 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 12841 12842 if ( hooks && 12843 "get" in hooks && 12844 ( ret = hooks.get( elem, "value" ) ) !== undefined 12845 ) { 12846 return ret; 12847 } 12848 12849 ret = elem.value; 12850 12851 // Handle most common string cases 12852 if ( typeof ret === "string" ) { 12853 return ret.replace( rreturn, "" ); 12854 } 12855 12856 // Handle cases where value is null/undef or number 12857 return ret == null ? "" : ret; 12858 } 12859 12860 return; 12861 } 12862 12863 valueIsFunction = isFunction( value ); 12864 12865 return this.each( function( i ) { 12866 var val; 12867 12868 if ( this.nodeType !== 1 ) { 12869 return; 12870 } 12871 12872 if ( valueIsFunction ) { 12873 val = value.call( this, i, jQuery( this ).val() ); 12874 } else { 12875 val = value; 12876 } 12877 12878 // Treat null/undefined as ""; convert numbers to string 12879 if ( val == null ) { 12880 val = ""; 12881 12882 } else if ( typeof val === "number" ) { 12883 val += ""; 12884 12885 } else if ( Array.isArray( val ) ) { 12886 val = jQuery.map( val, function( value ) { 12887 return value == null ? "" : value + ""; 12888 } ); 12889 } 12890 12891 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 12892 12893 // If set returns undefined, fall back to normal setting 12894 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 12895 this.value = val; 12896 } 12897 } ); 12898 } 12899} ); 12900 12901jQuery.extend( { 12902 valHooks: { 12903 option: { 12904 get: function( elem ) { 12905 12906 var val = jQuery.find.attr( elem, "value" ); 12907 return val != null ? 12908 val : 12909 12910 // Support: IE <=10 - 11 only 12911 // option.text throws exceptions (trac-14686, trac-14858) 12912 // Strip and collapse whitespace 12913 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 12914 stripAndCollapse( jQuery.text( elem ) ); 12915 } 12916 }, 12917 select: { 12918 get: function( elem ) { 12919 var value, option, i, 12920 options = elem.options, 12921 index = elem.selectedIndex, 12922 one = elem.type === "select-one", 12923 values = one ? null : [], 12924 max = one ? index + 1 : options.length; 12925 12926 if ( index < 0 ) { 12927 i = max; 12928 12929 } else { 12930 i = one ? index : 0; 12931 } 12932 12933 // Loop through all the selected options 12934 for ( ; i < max; i++ ) { 12935 option = options[ i ]; 12936 12937 // Support: IE <=9 only 12938 // IE8-9 doesn't update selected after form reset (trac-2551) 12939 if ( ( option.selected || i === index ) && 12940 12941 // Don't return options that are disabled or in a disabled optgroup 12942 !option.disabled && 12943 ( !option.parentNode.disabled || 12944 !nodeName( option.parentNode, "optgroup" ) ) ) { 12945 12946 // Get the specific value for the option 12947 value = jQuery( option ).val(); 12948 12949 // We don't need an array for one selects 12950 if ( one ) { 12951 return value; 12952 } 12953 12954 // Multi-Selects return an array 12955 values.push( value ); 12956 } 12957 } 12958 12959 return values; 12960 }, 12961 12962 set: function( elem, value ) { 12963 var optionSet, option, 12964 options = elem.options, 12965 values = jQuery.makeArray( value ), 12966 i = options.length; 12967 12968 while ( i-- ) { 12969 option = options[ i ]; 12970 12971 /* eslint-disable no-cond-assign */ 12972 12973 if ( option.selected = 12974 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 12975 ) { 12976 optionSet = true; 12977 } 12978 12979 /* eslint-enable no-cond-assign */ 12980 } 12981 12982 // Force browsers to behave consistently when non-matching value is set 12983 if ( !optionSet ) { 12984 elem.selectedIndex = -1; 12985 } 12986 return values; 12987 } 12988 } 12989 } 12990} ); 12991 12992// Radios and checkboxes getter/setter 12993jQuery.each( [ "radio", "checkbox" ], function() { 12994 jQuery.valHooks[ this ] = { 12995 set: function( elem, value ) { 12996 if ( Array.isArray( value ) ) { 12997 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 12998 } 12999 } 13000 }; 13001 if ( !support.checkOn ) { 13002 jQuery.valHooks[ this ].get = function( elem ) { 13003 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 13004 }; 13005 } 13006} ); 13007 13008 13009 13010 13011// Return jQuery for attributes-only inclusion 13012var location = window.location; 13013 13014var nonce = { guid: Date.now() }; 13015 13016var rquery = ( /\?/ ); 13017 13018 13019 13020// Cross-browser xml parsing 13021jQuery.parseXML = function( data ) { 13022 var xml, parserErrorElem; 13023 if ( !data || typeof data !== "string" ) { 13024 return null; 13025 } 13026 13027 // Support: IE 9 - 11 only 13028 // IE throws on parseFromString with invalid input. 13029 try { 13030 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 13031 } catch ( e ) {} 13032 13033 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 13034 if ( !xml || parserErrorElem ) { 13035 jQuery.error( "Invalid XML: " + ( 13036 parserErrorElem ? 13037 jQuery.map( parserErrorElem.childNodes, function( el ) { 13038 return el.textContent; 13039 } ).join( "\n" ) : 13040 data 13041 ) ); 13042 } 13043 return xml; 13044}; 13045 13046 13047var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 13048 stopPropagationCallback = function( e ) { 13049 e.stopPropagation(); 13050 }; 13051 13052jQuery.extend( jQuery.event, { 13053 13054 trigger: function( event, data, elem, onlyHandlers ) { 13055 13056 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 13057 eventPath = [ elem || document ], 13058 type = hasOwn.call( event, "type" ) ? event.type : event, 13059 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 13060 13061 cur = lastElement = tmp = elem = elem || document; 13062 13063 // Don't do events on text and comment nodes 13064 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 13065 return; 13066 } 13067 13068 // focus/blur morphs to focusin/out; ensure we're not firing them right now 13069 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 13070 return; 13071 } 13072 13073 if ( type.indexOf( "." ) > -1 ) { 13074 13075 // Namespaced trigger; create a regexp to match event type in handle() 13076 namespaces = type.split( "." ); 13077 type = namespaces.shift(); 13078 namespaces.sort(); 13079 } 13080 ontype = type.indexOf( ":" ) < 0 && "on" + type; 13081 13082 // Caller can pass in a jQuery.Event object, Object, or just an event type string 13083 event = event[ jQuery.expando ] ? 13084 event : 13085 new jQuery.Event( type, typeof event === "object" && event ); 13086 13087 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 13088 event.isTrigger = onlyHandlers ? 2 : 3; 13089 event.namespace = namespaces.join( "." ); 13090 event.rnamespace = event.namespace ? 13091 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 13092 null; 13093 13094 // Clean up the event in case it is being reused 13095 event.result = undefined; 13096 if ( !event.target ) { 13097 event.target = elem; 13098 } 13099 13100 // Clone any incoming data and prepend the event, creating the handler arg list 13101 data = data == null ? 13102 [ event ] : 13103 jQuery.makeArray( data, [ event ] ); 13104 13105 // Allow special events to draw outside the lines 13106 special = jQuery.event.special[ type ] || {}; 13107 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 13108 return; 13109 } 13110 13111 // Determine event propagation path in advance, per W3C events spec (trac-9951) 13112 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 13113 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 13114 13115 bubbleType = special.delegateType || type; 13116 if ( !rfocusMorph.test( bubbleType + type ) ) { 13117 cur = cur.parentNode; 13118 } 13119 for ( ; cur; cur = cur.parentNode ) { 13120 eventPath.push( cur ); 13121 tmp = cur; 13122 } 13123 13124 // Only add window if we got to document (e.g., not plain obj or detached DOM) 13125 if ( tmp === ( elem.ownerDocument || document ) ) { 13126 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 13127 } 13128 } 13129 13130 // Fire handlers on the event path 13131 i = 0; 13132 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 13133 lastElement = cur; 13134 event.type = i > 1 ? 13135 bubbleType : 13136 special.bindType || type; 13137 13138 // jQuery handler 13139 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 13140 dataPriv.get( cur, "handle" ); 13141 if ( handle ) { 13142 handle.apply( cur, data ); 13143 } 13144 13145 // Native handler 13146 handle = ontype && cur[ ontype ]; 13147 if ( handle && handle.apply && acceptData( cur ) ) { 13148 event.result = handle.apply( cur, data ); 13149 if ( event.result === false ) { 13150 event.preventDefault(); 13151 } 13152 } 13153 } 13154 event.type = type; 13155 13156 // If nobody prevented the default action, do it now 13157 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 13158 13159 if ( ( !special._default || 13160 special._default.apply( eventPath.pop(), data ) === false ) && 13161 acceptData( elem ) ) { 13162 13163 // Call a native DOM method on the target with the same name as the event. 13164 // Don't do default actions on window, that's where global variables be (trac-6170) 13165 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 13166 13167 // Don't re-trigger an onFOO event when we call its FOO() method 13168 tmp = elem[ ontype ]; 13169 13170 if ( tmp ) { 13171 elem[ ontype ] = null; 13172 } 13173 13174 // Prevent re-triggering of the same event, since we already bubbled it above 13175 jQuery.event.triggered = type; 13176 13177 if ( event.isPropagationStopped() ) { 13178 lastElement.addEventListener( type, stopPropagationCallback ); 13179 } 13180 13181 elem[ type ](); 13182 13183 if ( event.isPropagationStopped() ) { 13184 lastElement.removeEventListener( type, stopPropagationCallback ); 13185 } 13186 13187 jQuery.event.triggered = undefined; 13188 13189 if ( tmp ) { 13190 elem[ ontype ] = tmp; 13191 } 13192 } 13193 } 13194 } 13195 13196 return event.result; 13197 }, 13198 13199 // Piggyback on a donor event to simulate a different one 13200 // Used only for `focus(in | out)` events 13201 simulate: function( type, elem, event ) { 13202 var e = jQuery.extend( 13203 new jQuery.Event(), 13204 event, 13205 { 13206 type: type, 13207 isSimulated: true 13208 } 13209 ); 13210 13211 jQuery.event.trigger( e, null, elem ); 13212 } 13213 13214} ); 13215 13216jQuery.fn.extend( { 13217 13218 trigger: function( type, data ) { 13219 return this.each( function() { 13220 jQuery.event.trigger( type, data, this ); 13221 } ); 13222 }, 13223 triggerHandler: function( type, data ) { 13224 var elem = this[ 0 ]; 13225 if ( elem ) { 13226 return jQuery.event.trigger( type, data, elem, true ); 13227 } 13228 } 13229} ); 13230 13231 13232var 13233 rbracket = /\[\]$/, 13234 rCRLF = /\r?\n/g, 13235 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 13236 rsubmittable = /^(?:input|select|textarea|keygen)/i; 13237 13238function buildParams( prefix, obj, traditional, add ) { 13239 var name; 13240 13241 if ( Array.isArray( obj ) ) { 13242 13243 // Serialize array item. 13244 jQuery.each( obj, function( i, v ) { 13245 if ( traditional || rbracket.test( prefix ) ) { 13246 13247 // Treat each array item as a scalar. 13248 add( prefix, v ); 13249 13250 } else { 13251 13252 // Item is non-scalar (array or object), encode its numeric index. 13253 buildParams( 13254 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 13255 v, 13256 traditional, 13257 add 13258 ); 13259 } 13260 } ); 13261 13262 } else if ( !traditional && toType( obj ) === "object" ) { 13263 13264 // Serialize object item. 13265 for ( name in obj ) { 13266 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 13267 } 13268 13269 } else { 13270 13271 // Serialize scalar item. 13272 add( prefix, obj ); 13273 } 13274} 13275 13276// Serialize an array of form elements or a set of 13277// key/values into a query string 13278jQuery.param = function( a, traditional ) { 13279 var prefix, 13280 s = [], 13281 add = function( key, valueOrFunction ) { 13282 13283 // If value is a function, invoke it and use its return value 13284 var value = isFunction( valueOrFunction ) ? 13285 valueOrFunction() : 13286 valueOrFunction; 13287 13288 s[ s.length ] = encodeURIComponent( key ) + "=" + 13289 encodeURIComponent( value == null ? "" : value ); 13290 }; 13291 13292 if ( a == null ) { 13293 return ""; 13294 } 13295 13296 // If an array was passed in, assume that it is an array of form elements. 13297 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 13298 13299 // Serialize the form elements 13300 jQuery.each( a, function() { 13301 add( this.name, this.value ); 13302 } ); 13303 13304 } else { 13305 13306 // If traditional, encode the "old" way (the way 1.3.2 or older 13307 // did it), otherwise encode params recursively. 13308 for ( prefix in a ) { 13309 buildParams( prefix, a[ prefix ], traditional, add ); 13310 } 13311 } 13312 13313 // Return the resulting serialization 13314 return s.join( "&" ); 13315}; 13316 13317jQuery.fn.extend( { 13318 serialize: function() { 13319 return jQuery.param( this.serializeArray() ); 13320 }, 13321 serializeArray: function() { 13322 return this.map( function() { 13323 13324 // Can add propHook for "elements" to filter or add form elements 13325 var elements = jQuery.prop( this, "elements" ); 13326 return elements ? jQuery.makeArray( elements ) : this; 13327 } ).filter( function() { 13328 var type = this.type; 13329 13330 // Use .is( ":disabled" ) so that fieldset[disabled] works 13331 return this.name && !jQuery( this ).is( ":disabled" ) && 13332 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 13333 ( this.checked || !rcheckableType.test( type ) ); 13334 } ).map( function( _i, elem ) { 13335 var val = jQuery( this ).val(); 13336 13337 if ( val == null ) { 13338 return null; 13339 } 13340 13341 if ( Array.isArray( val ) ) { 13342 return jQuery.map( val, function( val ) { 13343 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 13344 } ); 13345 } 13346 13347 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 13348 } ).get(); 13349 } 13350} ); 13351 13352 13353var 13354 r20 = /%20/g, 13355 rhash = /#.*$/, 13356 rantiCache = /([?&])_=[^&]*/, 13357 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 13358 13359 // trac-7653, trac-8125, trac-8152: local protocol detection 13360 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 13361 rnoContent = /^(?:GET|HEAD)$/, 13362 rprotocol = /^\/\//, 13363 13364 /* Prefilters 13365 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 13366 * 2) These are called: 13367 * - BEFORE asking for a transport 13368 * - AFTER param serialization (s.data is a string if s.processData is true) 13369 * 3) key is the dataType 13370 * 4) the catchall symbol "*" can be used 13371 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 13372 */ 13373 prefilters = {}, 13374 13375 /* Transports bindings 13376 * 1) key is the dataType 13377 * 2) the catchall symbol "*" can be used 13378 * 3) selection will start with transport dataType and THEN go to "*" if needed 13379 */ 13380 transports = {}, 13381 13382 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 13383 allTypes = "*/".concat( "*" ), 13384 13385 // Anchor tag for parsing the document origin 13386 originAnchor = document.createElement( "a" ); 13387 13388originAnchor.href = location.href; 13389 13390// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 13391function addToPrefiltersOrTransports( structure ) { 13392 13393 // dataTypeExpression is optional and defaults to "*" 13394 return function( dataTypeExpression, func ) { 13395 13396 if ( typeof dataTypeExpression !== "string" ) { 13397 func = dataTypeExpression; 13398 dataTypeExpression = "*"; 13399 } 13400 13401 var dataType, 13402 i = 0, 13403 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 13404 13405 if ( isFunction( func ) ) { 13406 13407 // For each dataType in the dataTypeExpression 13408 while ( ( dataType = dataTypes[ i++ ] ) ) { 13409 13410 // Prepend if requested 13411 if ( dataType[ 0 ] === "+" ) { 13412 dataType = dataType.slice( 1 ) || "*"; 13413 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 13414 13415 // Otherwise append 13416 } else { 13417 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 13418 } 13419 } 13420 } 13421 }; 13422} 13423 13424// Base inspection function for prefilters and transports 13425function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 13426 13427 var inspected = {}, 13428 seekingTransport = ( structure === transports ); 13429 13430 function inspect( dataType ) { 13431 var selected; 13432 inspected[ dataType ] = true; 13433 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 13434 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 13435 if ( typeof dataTypeOrTransport === "string" && 13436 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 13437 13438 options.dataTypes.unshift( dataTypeOrTransport ); 13439 inspect( dataTypeOrTransport ); 13440 return false; 13441 } else if ( seekingTransport ) { 13442 return !( selected = dataTypeOrTransport ); 13443 } 13444 } ); 13445 return selected; 13446 } 13447 13448 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 13449} 13450 13451// A special extend for ajax options 13452// that takes "flat" options (not to be deep extended) 13453// Fixes trac-9887 13454function ajaxExtend( target, src ) { 13455 var key, deep, 13456 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 13457 13458 for ( key in src ) { 13459 if ( src[ key ] !== undefined ) { 13460 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 13461 } 13462 } 13463 if ( deep ) { 13464 jQuery.extend( true, target, deep ); 13465 } 13466 13467 return target; 13468} 13469 13470/* Handles responses to an ajax request: 13471 * - finds the right dataType (mediates between content-type and expected dataType) 13472 * - returns the corresponding response 13473 */ 13474function ajaxHandleResponses( s, jqXHR, responses ) { 13475 13476 var ct, type, finalDataType, firstDataType, 13477 contents = s.contents, 13478 dataTypes = s.dataTypes; 13479 13480 // Remove auto dataType and get content-type in the process 13481 while ( dataTypes[ 0 ] === "*" ) { 13482 dataTypes.shift(); 13483 if ( ct === undefined ) { 13484 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 13485 } 13486 } 13487 13488 // Check if we're dealing with a known content-type 13489 if ( ct ) { 13490 for ( type in contents ) { 13491 if ( contents[ type ] && contents[ type ].test( ct ) ) { 13492 dataTypes.unshift( type ); 13493 break; 13494 } 13495 } 13496 } 13497 13498 // Check to see if we have a response for the expected dataType 13499 if ( dataTypes[ 0 ] in responses ) { 13500 finalDataType = dataTypes[ 0 ]; 13501 } else { 13502 13503 // Try convertible dataTypes 13504 for ( type in responses ) { 13505 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 13506 finalDataType = type; 13507 break; 13508 } 13509 if ( !firstDataType ) { 13510 firstDataType = type; 13511 } 13512 } 13513 13514 // Or just use first one 13515 finalDataType = finalDataType || firstDataType; 13516 } 13517 13518 // If we found a dataType 13519 // We add the dataType to the list if needed 13520 // and return the corresponding response 13521 if ( finalDataType ) { 13522 if ( finalDataType !== dataTypes[ 0 ] ) { 13523 dataTypes.unshift( finalDataType ); 13524 } 13525 return responses[ finalDataType ]; 13526 } 13527} 13528 13529/* Chain conversions given the request and the original response 13530 * Also sets the responseXXX fields on the jqXHR instance 13531 */ 13532function ajaxConvert( s, response, jqXHR, isSuccess ) { 13533 var conv2, current, conv, tmp, prev, 13534 converters = {}, 13535 13536 // Work with a copy of dataTypes in case we need to modify it for conversion 13537 dataTypes = s.dataTypes.slice(); 13538 13539 // Create converters map with lowercased keys 13540 if ( dataTypes[ 1 ] ) { 13541 for ( conv in s.converters ) { 13542 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 13543 } 13544 } 13545 13546 current = dataTypes.shift(); 13547 13548 // Convert to each sequential dataType 13549 while ( current ) { 13550 13551 if ( s.responseFields[ current ] ) { 13552 jqXHR[ s.responseFields[ current ] ] = response; 13553 } 13554 13555 // Apply the dataFilter if provided 13556 if ( !prev && isSuccess && s.dataFilter ) { 13557 response = s.dataFilter( response, s.dataType ); 13558 } 13559 13560 prev = current; 13561 current = dataTypes.shift(); 13562 13563 if ( current ) { 13564 13565 // There's only work to do if current dataType is non-auto 13566 if ( current === "*" ) { 13567 13568 current = prev; 13569 13570 // Convert response if prev dataType is non-auto and differs from current 13571 } else if ( prev !== "*" && prev !== current ) { 13572 13573 // Seek a direct converter 13574 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 13575 13576 // If none found, seek a pair 13577 if ( !conv ) { 13578 for ( conv2 in converters ) { 13579 13580 // If conv2 outputs current 13581 tmp = conv2.split( " " ); 13582 if ( tmp[ 1 ] === current ) { 13583 13584 // If prev can be converted to accepted input 13585 conv = converters[ prev + " " + tmp[ 0 ] ] || 13586 converters[ "* " + tmp[ 0 ] ]; 13587 if ( conv ) { 13588 13589 // Condense equivalence converters 13590 if ( conv === true ) { 13591 conv = converters[ conv2 ]; 13592 13593 // Otherwise, insert the intermediate dataType 13594 } else if ( converters[ conv2 ] !== true ) { 13595 current = tmp[ 0 ]; 13596 dataTypes.unshift( tmp[ 1 ] ); 13597 } 13598 break; 13599 } 13600 } 13601 } 13602 } 13603 13604 // Apply converter (if not an equivalence) 13605 if ( conv !== true ) { 13606 13607 // Unless errors are allowed to bubble, catch and return them 13608 if ( conv && s.throws ) { 13609 response = conv( response ); 13610 } else { 13611 try { 13612 response = conv( response ); 13613 } catch ( e ) { 13614 return { 13615 state: "parsererror", 13616 error: conv ? e : "No conversion from " + prev + " to " + current 13617 }; 13618 } 13619 } 13620 } 13621 } 13622 } 13623 } 13624 13625 return { state: "success", data: response }; 13626} 13627 13628jQuery.extend( { 13629 13630 // Counter for holding the number of active queries 13631 active: 0, 13632 13633 // Last-Modified header cache for next request 13634 lastModified: {}, 13635 etag: {}, 13636 13637 ajaxSettings: { 13638 url: location.href, 13639 type: "GET", 13640 isLocal: rlocalProtocol.test( location.protocol ), 13641 global: true, 13642 processData: true, 13643 async: true, 13644 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 13645 13646 /* 13647 timeout: 0, 13648 data: null, 13649 dataType: null, 13650 username: null, 13651 password: null, 13652 cache: null, 13653 throws: false, 13654 traditional: false, 13655 headers: {}, 13656 */ 13657 13658 accepts: { 13659 "*": allTypes, 13660 text: "text/plain", 13661 html: "text/html", 13662 xml: "application/xml, text/xml", 13663 json: "application/json, text/javascript" 13664 }, 13665 13666 contents: { 13667 xml: /\bxml\b/, 13668 html: /\bhtml/, 13669 json: /\bjson\b/ 13670 }, 13671 13672 responseFields: { 13673 xml: "responseXML", 13674 text: "responseText", 13675 json: "responseJSON" 13676 }, 13677 13678 // Data converters 13679 // Keys separate source (or catchall "*") and destination types with a single space 13680 converters: { 13681 13682 // Convert anything to text 13683 "* text": String, 13684 13685 // Text to html (true = no transformation) 13686 "text html": true, 13687 13688 // Evaluate text as a json expression 13689 "text json": JSON.parse, 13690 13691 // Parse text as xml 13692 "text xml": jQuery.parseXML 13693 }, 13694 13695 // For options that shouldn't be deep extended: 13696 // you can add your own custom options here if 13697 // and when you create one that shouldn't be 13698 // deep extended (see ajaxExtend) 13699 flatOptions: { 13700 url: true, 13701 context: true 13702 } 13703 }, 13704 13705 // Creates a full fledged settings object into target 13706 // with both ajaxSettings and settings fields. 13707 // If target is omitted, writes into ajaxSettings. 13708 ajaxSetup: function( target, settings ) { 13709 return settings ? 13710 13711 // Building a settings object 13712 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 13713 13714 // Extending ajaxSettings 13715 ajaxExtend( jQuery.ajaxSettings, target ); 13716 }, 13717 13718 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 13719 ajaxTransport: addToPrefiltersOrTransports( transports ), 13720 13721 // Main method 13722 ajax: function( url, options ) { 13723 13724 // If url is an object, simulate pre-1.5 signature 13725 if ( typeof url === "object" ) { 13726 options = url; 13727 url = undefined; 13728 } 13729 13730 // Force options to be an object 13731 options = options || {}; 13732 13733 var transport, 13734 13735 // URL without anti-cache param 13736 cacheURL, 13737 13738 // Response headers 13739 responseHeadersString, 13740 responseHeaders, 13741 13742 // timeout handle 13743 timeoutTimer, 13744 13745 // Url cleanup var 13746 urlAnchor, 13747 13748 // Request state (becomes false upon send and true upon completion) 13749 completed, 13750 13751 // To know if global events are to be dispatched 13752 fireGlobals, 13753 13754 // Loop variable 13755 i, 13756 13757 // uncached part of the url 13758 uncached, 13759 13760 // Create the final options object 13761 s = jQuery.ajaxSetup( {}, options ), 13762 13763 // Callbacks context 13764 callbackContext = s.context || s, 13765 13766 // Context for global events is callbackContext if it is a DOM node or jQuery collection 13767 globalEventContext = s.context && 13768 ( callbackContext.nodeType || callbackContext.jquery ) ? 13769 jQuery( callbackContext ) : 13770 jQuery.event, 13771 13772 // Deferreds 13773 deferred = jQuery.Deferred(), 13774 completeDeferred = jQuery.Callbacks( "once memory" ), 13775 13776 // Status-dependent callbacks 13777 statusCode = s.statusCode || {}, 13778 13779 // Headers (they are sent all at once) 13780 requestHeaders = {}, 13781 requestHeadersNames = {}, 13782 13783 // Default abort message 13784 strAbort = "canceled", 13785 13786 // Fake xhr 13787 jqXHR = { 13788 readyState: 0, 13789 13790 // Builds headers hashtable if needed 13791 getResponseHeader: function( key ) { 13792 var match; 13793 if ( completed ) { 13794 if ( !responseHeaders ) { 13795 responseHeaders = {}; 13796 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 13797 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 13798 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 13799 .concat( match[ 2 ] ); 13800 } 13801 } 13802 match = responseHeaders[ key.toLowerCase() + " " ]; 13803 } 13804 return match == null ? null : match.join( ", " ); 13805 }, 13806 13807 // Raw string 13808 getAllResponseHeaders: function() { 13809 return completed ? responseHeadersString : null; 13810 }, 13811 13812 // Caches the header 13813 setRequestHeader: function( name, value ) { 13814 if ( completed == null ) { 13815 name = requestHeadersNames[ name.toLowerCase() ] = 13816 requestHeadersNames[ name.toLowerCase() ] || name; 13817 requestHeaders[ name ] = value; 13818 } 13819 return this; 13820 }, 13821 13822 // Overrides response content-type header 13823 overrideMimeType: function( type ) { 13824 if ( completed == null ) { 13825 s.mimeType = type; 13826 } 13827 return this; 13828 }, 13829 13830 // Status-dependent callbacks 13831 statusCode: function( map ) { 13832 var code; 13833 if ( map ) { 13834 if ( completed ) { 13835 13836 // Execute the appropriate callbacks 13837 jqXHR.always( map[ jqXHR.status ] ); 13838 } else { 13839 13840 // Lazy-add the new callbacks in a way that preserves old ones 13841 for ( code in map ) { 13842 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 13843 } 13844 } 13845 } 13846 return this; 13847 }, 13848 13849 // Cancel the request 13850 abort: function( statusText ) { 13851 var finalText = statusText || strAbort; 13852 if ( transport ) { 13853 transport.abort( finalText ); 13854 } 13855 done( 0, finalText ); 13856 return this; 13857 } 13858 }; 13859 13860 // Attach deferreds 13861 deferred.promise( jqXHR ); 13862 13863 // Add protocol if not provided (prefilters might expect it) 13864 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 13865 // We also use the url parameter if available 13866 s.url = ( ( url || s.url || location.href ) + "" ) 13867 .replace( rprotocol, location.protocol + "//" ); 13868 13869 // Alias method option to type as per ticket trac-12004 13870 s.type = options.method || options.type || s.method || s.type; 13871 13872 // Extract dataTypes list 13873 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 13874 13875 // A cross-domain request is in order when the origin doesn't match the current origin. 13876 if ( s.crossDomain == null ) { 13877 urlAnchor = document.createElement( "a" ); 13878 13879 // Support: IE <=8 - 11, Edge 12 - 15 13880 // IE throws exception on accessing the href property if url is malformed, 13881 // e.g. http://example.com:80x/ 13882 try { 13883 urlAnchor.href = s.url; 13884 13885 // Support: IE <=8 - 11 only 13886 // Anchor's host property isn't correctly set when s.url is relative 13887 urlAnchor.href = urlAnchor.href; 13888 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 13889 urlAnchor.protocol + "//" + urlAnchor.host; 13890 } catch ( e ) { 13891 13892 // If there is an error parsing the URL, assume it is crossDomain, 13893 // it can be rejected by the transport if it is invalid 13894 s.crossDomain = true; 13895 } 13896 } 13897 13898 // Convert data if not already a string 13899 if ( s.data && s.processData && typeof s.data !== "string" ) { 13900 s.data = jQuery.param( s.data, s.traditional ); 13901 } 13902 13903 // Apply prefilters 13904 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 13905 13906 // If request was aborted inside a prefilter, stop there 13907 if ( completed ) { 13908 return jqXHR; 13909 } 13910 13911 // We can fire global events as of now if asked to 13912 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 13913 fireGlobals = jQuery.event && s.global; 13914 13915 // Watch for a new set of requests 13916 if ( fireGlobals && jQuery.active++ === 0 ) { 13917 jQuery.event.trigger( "ajaxStart" ); 13918 } 13919 13920 // Uppercase the type 13921 s.type = s.type.toUpperCase(); 13922 13923 // Determine if request has content 13924 s.hasContent = !rnoContent.test( s.type ); 13925 13926 // Save the URL in case we're toying with the If-Modified-Since 13927 // and/or If-None-Match header later on 13928 // Remove hash to simplify url manipulation 13929 cacheURL = s.url.replace( rhash, "" ); 13930 13931 // More options handling for requests with no content 13932 if ( !s.hasContent ) { 13933 13934 // Remember the hash so we can put it back 13935 uncached = s.url.slice( cacheURL.length ); 13936 13937 // If data is available and should be processed, append data to url 13938 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 13939 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 13940 13941 // trac-9682: remove data so that it's not used in an eventual retry 13942 delete s.data; 13943 } 13944 13945 // Add or update anti-cache param if needed 13946 if ( s.cache === false ) { 13947 cacheURL = cacheURL.replace( rantiCache, "$1" ); 13948 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 13949 uncached; 13950 } 13951 13952 // Put hash and anti-cache on the URL that will be requested (gh-1732) 13953 s.url = cacheURL + uncached; 13954 13955 // Change '%20' to '+' if this is encoded form body content (gh-2658) 13956 } else if ( s.data && s.processData && 13957 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 13958 s.data = s.data.replace( r20, "+" ); 13959 } 13960 13961 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 13962 if ( s.ifModified ) { 13963 if ( jQuery.lastModified[ cacheURL ] ) { 13964 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 13965 } 13966 if ( jQuery.etag[ cacheURL ] ) { 13967 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 13968 } 13969 } 13970 13971 // Set the correct header, if data is being sent 13972 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 13973 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 13974 } 13975 13976 // Set the Accepts header for the server, depending on the dataType 13977 jqXHR.setRequestHeader( 13978 "Accept", 13979 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 13980 s.accepts[ s.dataTypes[ 0 ] ] + 13981 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 13982 s.accepts[ "*" ] 13983 ); 13984 13985 // Check for headers option 13986 for ( i in s.headers ) { 13987 jqXHR.setRequestHeader( i, s.headers[ i ] ); 13988 } 13989 13990 // Allow custom headers/mimetypes and early abort 13991 if ( s.beforeSend && 13992 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 13993 13994 // Abort if not done already and return 13995 return jqXHR.abort(); 13996 } 13997 13998 // Aborting is no longer a cancellation 13999 strAbort = "abort"; 14000 14001 // Install callbacks on deferreds 14002 completeDeferred.add( s.complete ); 14003 jqXHR.done( s.success ); 14004 jqXHR.fail( s.error ); 14005 14006 // Get transport 14007 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 14008 14009 // If no transport, we auto-abort 14010 if ( !transport ) { 14011 done( -1, "No Transport" ); 14012 } else { 14013 jqXHR.readyState = 1; 14014 14015 // Send global event 14016 if ( fireGlobals ) { 14017 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 14018 } 14019 14020 // If request was aborted inside ajaxSend, stop there 14021 if ( completed ) { 14022 return jqXHR; 14023 } 14024 14025 // Timeout 14026 if ( s.async && s.timeout > 0 ) { 14027 timeoutTimer = window.setTimeout( function() { 14028 jqXHR.abort( "timeout" ); 14029 }, s.timeout ); 14030 } 14031 14032 try { 14033 completed = false; 14034 transport.send( requestHeaders, done ); 14035 } catch ( e ) { 14036 14037 // Rethrow post-completion exceptions 14038 if ( completed ) { 14039 throw e; 14040 } 14041 14042 // Propagate others as results 14043 done( -1, e ); 14044 } 14045 } 14046 14047 // Callback for when everything is done 14048 function done( status, nativeStatusText, responses, headers ) { 14049 var isSuccess, success, error, response, modified, 14050 statusText = nativeStatusText; 14051 14052 // Ignore repeat invocations 14053 if ( completed ) { 14054 return; 14055 } 14056 14057 completed = true; 14058 14059 // Clear timeout if it exists 14060 if ( timeoutTimer ) { 14061 window.clearTimeout( timeoutTimer ); 14062 } 14063 14064 // Dereference transport for early garbage collection 14065 // (no matter how long the jqXHR object will be used) 14066 transport = undefined; 14067 14068 // Cache response headers 14069 responseHeadersString = headers || ""; 14070 14071 // Set readyState 14072 jqXHR.readyState = status > 0 ? 4 : 0; 14073 14074 // Determine if successful 14075 isSuccess = status >= 200 && status < 300 || status === 304; 14076 14077 // Get response data 14078 if ( responses ) { 14079 response = ajaxHandleResponses( s, jqXHR, responses ); 14080 } 14081 14082 // Use a noop converter for missing script but not if jsonp 14083 if ( !isSuccess && 14084 jQuery.inArray( "script", s.dataTypes ) > -1 && 14085 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 14086 s.converters[ "text script" ] = function() {}; 14087 } 14088 14089 // Convert no matter what (that way responseXXX fields are always set) 14090 response = ajaxConvert( s, response, jqXHR, isSuccess ); 14091 14092 // If successful, handle type chaining 14093 if ( isSuccess ) { 14094 14095 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 14096 if ( s.ifModified ) { 14097 modified = jqXHR.getResponseHeader( "Last-Modified" ); 14098 if ( modified ) { 14099 jQuery.lastModified[ cacheURL ] = modified; 14100 } 14101 modified = jqXHR.getResponseHeader( "etag" ); 14102 if ( modified ) { 14103 jQuery.etag[ cacheURL ] = modified; 14104 } 14105 } 14106 14107 // if no content 14108 if ( status === 204 || s.type === "HEAD" ) { 14109 statusText = "nocontent"; 14110 14111 // if not modified 14112 } else if ( status === 304 ) { 14113 statusText = "notmodified"; 14114 14115 // If we have data, let's convert it 14116 } else { 14117 statusText = response.state; 14118 success = response.data; 14119 error = response.error; 14120 isSuccess = !error; 14121 } 14122 } else { 14123 14124 // Extract error from statusText and normalize for non-aborts 14125 error = statusText; 14126 if ( status || !statusText ) { 14127 statusText = "error"; 14128 if ( status < 0 ) { 14129 status = 0; 14130 } 14131 } 14132 } 14133 14134 // Set data for the fake xhr object 14135 jqXHR.status = status; 14136 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 14137 14138 // Success/Error 14139 if ( isSuccess ) { 14140 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 14141 } else { 14142 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 14143 } 14144 14145 // Status-dependent callbacks 14146 jqXHR.statusCode( statusCode ); 14147 statusCode = undefined; 14148 14149 if ( fireGlobals ) { 14150 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 14151 [ jqXHR, s, isSuccess ? success : error ] ); 14152 } 14153 14154 // Complete 14155 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 14156 14157 if ( fireGlobals ) { 14158 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 14159 14160 // Handle the global AJAX counter 14161 if ( !( --jQuery.active ) ) { 14162 jQuery.event.trigger( "ajaxStop" ); 14163 } 14164 } 14165 } 14166 14167 return jqXHR; 14168 }, 14169 14170 getJSON: function( url, data, callback ) { 14171 return jQuery.get( url, data, callback, "json" ); 14172 }, 14173 14174 getScript: function( url, callback ) { 14175 return jQuery.get( url, undefined, callback, "script" ); 14176 } 14177} ); 14178 14179jQuery.each( [ "get", "post" ], function( _i, method ) { 14180 jQuery[ method ] = function( url, data, callback, type ) { 14181 14182 // Shift arguments if data argument was omitted 14183 if ( isFunction( data ) ) { 14184 type = type || callback; 14185 callback = data; 14186 data = undefined; 14187 } 14188 14189 // The url can be an options object (which then must have .url) 14190 return jQuery.ajax( jQuery.extend( { 14191 url: url, 14192 type: method, 14193 dataType: type, 14194 data: data, 14195 success: callback 14196 }, jQuery.isPlainObject( url ) && url ) ); 14197 }; 14198} ); 14199 14200jQuery.ajaxPrefilter( function( s ) { 14201 var i; 14202 for ( i in s.headers ) { 14203 if ( i.toLowerCase() === "content-type" ) { 14204 s.contentType = s.headers[ i ] || ""; 14205 } 14206 } 14207} ); 14208 14209 14210jQuery._evalUrl = function( url, options, doc ) { 14211 return jQuery.ajax( { 14212 url: url, 14213 14214 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 14215 type: "GET", 14216 dataType: "script", 14217 cache: true, 14218 async: false, 14219 global: false, 14220 14221 // Only evaluate the response if it is successful (gh-4126) 14222 // dataFilter is not invoked for failure responses, so using it instead 14223 // of the default converter is kludgy but it works. 14224 converters: { 14225 "text script": function() {} 14226 }, 14227 dataFilter: function( response ) { 14228 jQuery.globalEval( response, options, doc ); 14229 } 14230 } ); 14231}; 14232 14233 14234jQuery.fn.extend( { 14235 wrapAll: function( html ) { 14236 var wrap; 14237 14238 if ( this[ 0 ] ) { 14239 if ( isFunction( html ) ) { 14240 html = html.call( this[ 0 ] ); 14241 } 14242 14243 // The elements to wrap the target around 14244 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 14245 14246 if ( this[ 0 ].parentNode ) { 14247 wrap.insertBefore( this[ 0 ] ); 14248 } 14249 14250 wrap.map( function() { 14251 var elem = this; 14252 14253 while ( elem.firstElementChild ) { 14254 elem = elem.firstElementChild; 14255 } 14256 14257 return elem; 14258 } ).append( this ); 14259 } 14260 14261 return this; 14262 }, 14263 14264 wrapInner: function( html ) { 14265 if ( isFunction( html ) ) { 14266 return this.each( function( i ) { 14267 jQuery( this ).wrapInner( html.call( this, i ) ); 14268 } ); 14269 } 14270 14271 return this.each( function() { 14272 var self = jQuery( this ), 14273 contents = self.contents(); 14274 14275 if ( contents.length ) { 14276 contents.wrapAll( html ); 14277 14278 } else { 14279 self.append( html ); 14280 } 14281 } ); 14282 }, 14283 14284 wrap: function( html ) { 14285 var htmlIsFunction = isFunction( html ); 14286 14287 return this.each( function( i ) { 14288 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 14289 } ); 14290 }, 14291 14292 unwrap: function( selector ) { 14293 this.parent( selector ).not( "body" ).each( function() { 14294 jQuery( this ).replaceWith( this.childNodes ); 14295 } ); 14296 return this; 14297 } 14298} ); 14299 14300 14301jQuery.expr.pseudos.hidden = function( elem ) { 14302 return !jQuery.expr.pseudos.visible( elem ); 14303}; 14304jQuery.expr.pseudos.visible = function( elem ) { 14305 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 14306}; 14307 14308 14309 14310 14311jQuery.ajaxSettings.xhr = function() { 14312 try { 14313 return new window.XMLHttpRequest(); 14314 } catch ( e ) {} 14315}; 14316 14317var xhrSuccessStatus = { 14318 14319 // File protocol always yields status code 0, assume 200 14320 0: 200, 14321 14322 // Support: IE <=9 only 14323 // trac-1450: sometimes IE returns 1223 when it should be 204 14324 1223: 204 14325 }, 14326 xhrSupported = jQuery.ajaxSettings.xhr(); 14327 14328support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 14329support.ajax = xhrSupported = !!xhrSupported; 14330 14331jQuery.ajaxTransport( function( options ) { 14332 var callback, errorCallback; 14333 14334 // Cross domain only allowed if supported through XMLHttpRequest 14335 if ( support.cors || xhrSupported && !options.crossDomain ) { 14336 return { 14337 send: function( headers, complete ) { 14338 var i, 14339 xhr = options.xhr(); 14340 14341 xhr.open( 14342 options.type, 14343 options.url, 14344 options.async, 14345 options.username, 14346 options.password 14347 ); 14348 14349 // Apply custom fields if provided 14350 if ( options.xhrFields ) { 14351 for ( i in options.xhrFields ) { 14352 xhr[ i ] = options.xhrFields[ i ]; 14353 } 14354 } 14355 14356 // Override mime type if needed 14357 if ( options.mimeType && xhr.overrideMimeType ) { 14358 xhr.overrideMimeType( options.mimeType ); 14359 } 14360 14361 // X-Requested-With header 14362 // For cross-domain requests, seeing as conditions for a preflight are 14363 // akin to a jigsaw puzzle, we simply never set it to be sure. 14364 // (it can always be set on a per-request basis or even using ajaxSetup) 14365 // For same-domain requests, won't change header if already provided. 14366 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 14367 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 14368 } 14369 14370 // Set headers 14371 for ( i in headers ) { 14372 xhr.setRequestHeader( i, headers[ i ] ); 14373 } 14374 14375 // Callback 14376 callback = function( type ) { 14377 return function() { 14378 if ( callback ) { 14379 callback = errorCallback = xhr.onload = 14380 xhr.onerror = xhr.onabort = xhr.ontimeout = 14381 xhr.onreadystatechange = null; 14382 14383 if ( type === "abort" ) { 14384 xhr.abort(); 14385 } else if ( type === "error" ) { 14386 14387 // Support: IE <=9 only 14388 // On a manual native abort, IE9 throws 14389 // errors on any property access that is not readyState 14390 if ( typeof xhr.status !== "number" ) { 14391 complete( 0, "error" ); 14392 } else { 14393 complete( 14394 14395 // File: protocol always yields status 0; see trac-8605, trac-14207 14396 xhr.status, 14397 xhr.statusText 14398 ); 14399 } 14400 } else { 14401 complete( 14402 xhrSuccessStatus[ xhr.status ] || xhr.status, 14403 xhr.statusText, 14404 14405 // Support: IE <=9 only 14406 // IE9 has no XHR2 but throws on binary (trac-11426) 14407 // For XHR2 non-text, let the caller handle it (gh-2498) 14408 ( xhr.responseType || "text" ) !== "text" || 14409 typeof xhr.responseText !== "string" ? 14410 { binary: xhr.response } : 14411 { text: xhr.responseText }, 14412 xhr.getAllResponseHeaders() 14413 ); 14414 } 14415 } 14416 }; 14417 }; 14418 14419 // Listen to events 14420 xhr.onload = callback(); 14421 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 14422 14423 // Support: IE 9 only 14424 // Use onreadystatechange to replace onabort 14425 // to handle uncaught aborts 14426 if ( xhr.onabort !== undefined ) { 14427 xhr.onabort = errorCallback; 14428 } else { 14429 xhr.onreadystatechange = function() { 14430 14431 // Check readyState before timeout as it changes 14432 if ( xhr.readyState === 4 ) { 14433 14434 // Allow onerror to be called first, 14435 // but that will not handle a native abort 14436 // Also, save errorCallback to a variable 14437 // as xhr.onerror cannot be accessed 14438 window.setTimeout( function() { 14439 if ( callback ) { 14440 errorCallback(); 14441 } 14442 } ); 14443 } 14444 }; 14445 } 14446 14447 // Create the abort callback 14448 callback = callback( "abort" ); 14449 14450 try { 14451 14452 // Do send the request (this may raise an exception) 14453 xhr.send( options.hasContent && options.data || null ); 14454 } catch ( e ) { 14455 14456 // trac-14683: Only rethrow if this hasn't been notified as an error yet 14457 if ( callback ) { 14458 throw e; 14459 } 14460 } 14461 }, 14462 14463 abort: function() { 14464 if ( callback ) { 14465 callback(); 14466 } 14467 } 14468 }; 14469 } 14470} ); 14471 14472 14473 14474 14475// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 14476jQuery.ajaxPrefilter( function( s ) { 14477 if ( s.crossDomain ) { 14478 s.contents.script = false; 14479 } 14480} ); 14481 14482// Install script dataType 14483jQuery.ajaxSetup( { 14484 accepts: { 14485 script: "text/javascript, application/javascript, " + 14486 "application/ecmascript, application/x-ecmascript" 14487 }, 14488 contents: { 14489 script: /\b(?:java|ecma)script\b/ 14490 }, 14491 converters: { 14492 "text script": function( text ) { 14493 jQuery.globalEval( text ); 14494 return text; 14495 } 14496 } 14497} ); 14498 14499// Handle cache's special case and crossDomain 14500jQuery.ajaxPrefilter( "script", function( s ) { 14501 if ( s.cache === undefined ) { 14502 s.cache = false; 14503 } 14504 if ( s.crossDomain ) { 14505 s.type = "GET"; 14506 } 14507} ); 14508 14509// Bind script tag hack transport 14510jQuery.ajaxTransport( "script", function( s ) { 14511 14512 // This transport only deals with cross domain or forced-by-attrs requests 14513 if ( s.crossDomain || s.scriptAttrs ) { 14514 var script, callback; 14515 return { 14516 send: function( _, complete ) { 14517 script = jQuery( "<script>" ) 14518 .attr( s.scriptAttrs || {} ) 14519 .prop( { charset: s.scriptCharset, src: s.url } ) 14520 .on( "load error", callback = function( evt ) { 14521 script.remove(); 14522 callback = null; 14523 if ( evt ) { 14524 complete( evt.type === "error" ? 404 : 200, evt.type ); 14525 } 14526 } ); 14527 14528 // Use native DOM manipulation to avoid our domManip AJAX trickery 14529 document.head.appendChild( script[ 0 ] ); 14530 }, 14531 abort: function() { 14532 if ( callback ) { 14533 callback(); 14534 } 14535 } 14536 }; 14537 } 14538} ); 14539 14540 14541 14542 14543var oldCallbacks = [], 14544 rjsonp = /(=)\?(?=&|$)|\?\?/; 14545 14546// Default jsonp settings 14547jQuery.ajaxSetup( { 14548 jsonp: "callback", 14549 jsonpCallback: function() { 14550 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 14551 this[ callback ] = true; 14552 return callback; 14553 } 14554} ); 14555 14556// Detect, normalize options and install callbacks for jsonp requests 14557jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 14558 14559 var callbackName, overwritten, responseContainer, 14560 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 14561 "url" : 14562 typeof s.data === "string" && 14563 ( s.contentType || "" ) 14564 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 14565 rjsonp.test( s.data ) && "data" 14566 ); 14567 14568 // Handle iff the expected data type is "jsonp" or we have a parameter to set 14569 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 14570 14571 // Get callback name, remembering preexisting value associated with it 14572 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 14573 s.jsonpCallback() : 14574 s.jsonpCallback; 14575 14576 // Insert callback into url or form data 14577 if ( jsonProp ) { 14578 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 14579 } else if ( s.jsonp !== false ) { 14580 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 14581 } 14582 14583 // Use data converter to retrieve json after script execution 14584 s.converters[ "script json" ] = function() { 14585 if ( !responseContainer ) { 14586 jQuery.error( callbackName + " was not called" ); 14587 } 14588 return responseContainer[ 0 ]; 14589 }; 14590 14591 // Force json dataType 14592 s.dataTypes[ 0 ] = "json"; 14593 14594 // Install callback 14595 overwritten = window[ callbackName ]; 14596 window[ callbackName ] = function() { 14597 responseContainer = arguments; 14598 }; 14599 14600 // Clean-up function (fires after converters) 14601 jqXHR.always( function() { 14602 14603 // If previous value didn't exist - remove it 14604 if ( overwritten === undefined ) { 14605 jQuery( window ).removeProp( callbackName ); 14606 14607 // Otherwise restore preexisting value 14608 } else { 14609 window[ callbackName ] = overwritten; 14610 } 14611 14612 // Save back as free 14613 if ( s[ callbackName ] ) { 14614 14615 // Make sure that re-using the options doesn't screw things around 14616 s.jsonpCallback = originalSettings.jsonpCallback; 14617 14618 // Save the callback name for future use 14619 oldCallbacks.push( callbackName ); 14620 } 14621 14622 // Call if it was a function and we have a response 14623 if ( responseContainer && isFunction( overwritten ) ) { 14624 overwritten( responseContainer[ 0 ] ); 14625 } 14626 14627 responseContainer = overwritten = undefined; 14628 } ); 14629 14630 // Delegate to script 14631 return "script"; 14632 } 14633} ); 14634 14635 14636 14637 14638// Support: Safari 8 only 14639// In Safari 8 documents created via document.implementation.createHTMLDocument 14640// collapse sibling forms: the second one becomes a child of the first one. 14641// Because of that, this security measure has to be disabled in Safari 8. 14642// https://bugs.webkit.org/show_bug.cgi?id=137337 14643support.createHTMLDocument = ( function() { 14644 var body = document.implementation.createHTMLDocument( "" ).body; 14645 body.innerHTML = "<form></form><form></form>"; 14646 return body.childNodes.length === 2; 14647} )(); 14648 14649 14650// Argument "data" should be string of html 14651// context (optional): If specified, the fragment will be created in this context, 14652// defaults to document 14653// keepScripts (optional): If true, will include scripts passed in the html string 14654jQuery.parseHTML = function( data, context, keepScripts ) { 14655 if ( typeof data !== "string" ) { 14656 return []; 14657 } 14658 if ( typeof context === "boolean" ) { 14659 keepScripts = context; 14660 context = false; 14661 } 14662 14663 var base, parsed, scripts; 14664 14665 if ( !context ) { 14666 14667 // Stop scripts or inline event handlers from being executed immediately 14668 // by using document.implementation 14669 if ( support.createHTMLDocument ) { 14670 context = document.implementation.createHTMLDocument( "" ); 14671 14672 // Set the base href for the created document 14673 // so any parsed elements with URLs 14674 // are based on the document's URL (gh-2965) 14675 base = context.createElement( "base" ); 14676 base.href = document.location.href; 14677 context.head.appendChild( base ); 14678 } else { 14679 context = document; 14680 } 14681 } 14682 14683 parsed = rsingleTag.exec( data ); 14684 scripts = !keepScripts && []; 14685 14686 // Single tag 14687 if ( parsed ) { 14688 return [ context.createElement( parsed[ 1 ] ) ]; 14689 } 14690 14691 parsed = buildFragment( [ data ], context, scripts ); 14692 14693 if ( scripts && scripts.length ) { 14694 jQuery( scripts ).remove(); 14695 } 14696 14697 return jQuery.merge( [], parsed.childNodes ); 14698}; 14699 14700 14701/** 14702 * Load a url into a page 14703 */ 14704jQuery.fn.load = function( url, params, callback ) { 14705 var selector, type, response, 14706 self = this, 14707 off = url.indexOf( " " ); 14708 14709 if ( off > -1 ) { 14710 selector = stripAndCollapse( url.slice( off ) ); 14711 url = url.slice( 0, off ); 14712 } 14713 14714 // If it's a function 14715 if ( isFunction( params ) ) { 14716 14717 // We assume that it's the callback 14718 callback = params; 14719 params = undefined; 14720 14721 // Otherwise, build a param string 14722 } else if ( params && typeof params === "object" ) { 14723 type = "POST"; 14724 } 14725 14726 // If we have elements to modify, make the request 14727 if ( self.length > 0 ) { 14728 jQuery.ajax( { 14729 url: url, 14730 14731 // If "type" variable is undefined, then "GET" method will be used. 14732 // Make value of this field explicit since 14733 // user can override it through ajaxSetup method 14734 type: type || "GET", 14735 dataType: "html", 14736 data: params 14737 } ).done( function( responseText ) { 14738 14739 // Save response for use in complete callback 14740 response = arguments; 14741 14742 self.html( selector ? 14743 14744 // If a selector was specified, locate the right elements in a dummy div 14745 // Exclude scripts to avoid IE 'Permission Denied' errors 14746 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 14747 14748 // Otherwise use the full result 14749 responseText ); 14750 14751 // If the request succeeds, this function gets "data", "status", "jqXHR" 14752 // but they are ignored because response was set above. 14753 // If it fails, this function gets "jqXHR", "status", "error" 14754 } ).always( callback && function( jqXHR, status ) { 14755 self.each( function() { 14756 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 14757 } ); 14758 } ); 14759 } 14760 14761 return this; 14762}; 14763 14764 14765 14766 14767jQuery.expr.pseudos.animated = function( elem ) { 14768 return jQuery.grep( jQuery.timers, function( fn ) { 14769 return elem === fn.elem; 14770 } ).length; 14771}; 14772 14773 14774 14775 14776jQuery.offset = { 14777 setOffset: function( elem, options, i ) { 14778 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 14779 position = jQuery.css( elem, "position" ), 14780 curElem = jQuery( elem ), 14781 props = {}; 14782 14783 // Set position first, in-case top/left are set even on static elem 14784 if ( position === "static" ) { 14785 elem.style.position = "relative"; 14786 } 14787 14788 curOffset = curElem.offset(); 14789 curCSSTop = jQuery.css( elem, "top" ); 14790 curCSSLeft = jQuery.css( elem, "left" ); 14791 calculatePosition = ( position === "absolute" || position === "fixed" ) && 14792 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 14793 14794 // Need to be able to calculate position if either 14795 // top or left is auto and position is either absolute or fixed 14796 if ( calculatePosition ) { 14797 curPosition = curElem.position(); 14798 curTop = curPosition.top; 14799 curLeft = curPosition.left; 14800 14801 } else { 14802 curTop = parseFloat( curCSSTop ) || 0; 14803 curLeft = parseFloat( curCSSLeft ) || 0; 14804 } 14805 14806 if ( isFunction( options ) ) { 14807 14808 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 14809 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 14810 } 14811 14812 if ( options.top != null ) { 14813 props.top = ( options.top - curOffset.top ) + curTop; 14814 } 14815 if ( options.left != null ) { 14816 props.left = ( options.left - curOffset.left ) + curLeft; 14817 } 14818 14819 if ( "using" in options ) { 14820 options.using.call( elem, props ); 14821 14822 } else { 14823 curElem.css( props ); 14824 } 14825 } 14826}; 14827 14828jQuery.fn.extend( { 14829 14830 // offset() relates an element's border box to the document origin 14831 offset: function( options ) { 14832 14833 // Preserve chaining for setter 14834 if ( arguments.length ) { 14835 return options === undefined ? 14836 this : 14837 this.each( function( i ) { 14838 jQuery.offset.setOffset( this, options, i ); 14839 } ); 14840 } 14841 14842 var rect, win, 14843 elem = this[ 0 ]; 14844 14845 if ( !elem ) { 14846 return; 14847 } 14848 14849 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 14850 // Support: IE <=11 only 14851 // Running getBoundingClientRect on a 14852 // disconnected node in IE throws an error 14853 if ( !elem.getClientRects().length ) { 14854 return { top: 0, left: 0 }; 14855 } 14856 14857 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 14858 rect = elem.getBoundingClientRect(); 14859 win = elem.ownerDocument.defaultView; 14860 return { 14861 top: rect.top + win.pageYOffset, 14862 left: rect.left + win.pageXOffset 14863 }; 14864 }, 14865 14866 // position() relates an element's margin box to its offset parent's padding box 14867 // This corresponds to the behavior of CSS absolute positioning 14868 position: function() { 14869 if ( !this[ 0 ] ) { 14870 return; 14871 } 14872 14873 var offsetParent, offset, doc, 14874 elem = this[ 0 ], 14875 parentOffset = { top: 0, left: 0 }; 14876 14877 // position:fixed elements are offset from the viewport, which itself always has zero offset 14878 if ( jQuery.css( elem, "position" ) === "fixed" ) { 14879 14880 // Assume position:fixed implies availability of getBoundingClientRect 14881 offset = elem.getBoundingClientRect(); 14882 14883 } else { 14884 offset = this.offset(); 14885 14886 // Account for the *real* offset parent, which can be the document or its root element 14887 // when a statically positioned element is identified 14888 doc = elem.ownerDocument; 14889 offsetParent = elem.offsetParent || doc.documentElement; 14890 while ( offsetParent && 14891 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 14892 jQuery.css( offsetParent, "position" ) === "static" ) { 14893 14894 offsetParent = offsetParent.parentNode; 14895 } 14896 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 14897 14898 // Incorporate borders into its offset, since they are outside its content origin 14899 parentOffset = jQuery( offsetParent ).offset(); 14900 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 14901 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 14902 } 14903 } 14904 14905 // Subtract parent offsets and element margins 14906 return { 14907 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 14908 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 14909 }; 14910 }, 14911 14912 // This method will return documentElement in the following cases: 14913 // 1) For the element inside the iframe without offsetParent, this method will return 14914 // documentElement of the parent window 14915 // 2) For the hidden or detached element 14916 // 3) For body or html element, i.e. in case of the html node - it will return itself 14917 // 14918 // but those exceptions were never presented as a real life use-cases 14919 // and might be considered as more preferable results. 14920 // 14921 // This logic, however, is not guaranteed and can change at any point in the future 14922 offsetParent: function() { 14923 return this.map( function() { 14924 var offsetParent = this.offsetParent; 14925 14926 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 14927 offsetParent = offsetParent.offsetParent; 14928 } 14929 14930 return offsetParent || documentElement; 14931 } ); 14932 } 14933} ); 14934 14935// Create scrollLeft and scrollTop methods 14936jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 14937 var top = "pageYOffset" === prop; 14938 14939 jQuery.fn[ method ] = function( val ) { 14940 return access( this, function( elem, method, val ) { 14941 14942 // Coalesce documents and windows 14943 var win; 14944 if ( isWindow( elem ) ) { 14945 win = elem; 14946 } else if ( elem.nodeType === 9 ) { 14947 win = elem.defaultView; 14948 } 14949 14950 if ( val === undefined ) { 14951 return win ? win[ prop ] : elem[ method ]; 14952 } 14953 14954 if ( win ) { 14955 win.scrollTo( 14956 !top ? val : win.pageXOffset, 14957 top ? val : win.pageYOffset 14958 ); 14959 14960 } else { 14961 elem[ method ] = val; 14962 } 14963 }, method, val, arguments.length ); 14964 }; 14965} ); 14966 14967// Support: Safari <=7 - 9.1, Chrome <=37 - 49 14968// Add the top/left cssHooks using jQuery.fn.position 14969// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 14970// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 14971// getComputedStyle returns percent when specified for top/left/bottom/right; 14972// rather than make the css module depend on the offset module, just check for it here 14973jQuery.each( [ "top", "left" ], function( _i, prop ) { 14974 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 14975 function( elem, computed ) { 14976 if ( computed ) { 14977 computed = curCSS( elem, prop ); 14978 14979 // If curCSS returns percentage, fallback to offset 14980 return rnumnonpx.test( computed ) ? 14981 jQuery( elem ).position()[ prop ] + "px" : 14982 computed; 14983 } 14984 } 14985 ); 14986} ); 14987 14988 14989// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 14990jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 14991 jQuery.each( { 14992 padding: "inner" + name, 14993 content: type, 14994 "": "outer" + name 14995 }, function( defaultExtra, funcName ) { 14996 14997 // Margin is only for outerHeight, outerWidth 14998 jQuery.fn[ funcName ] = function( margin, value ) { 14999 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 15000 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 15001 15002 return access( this, function( elem, type, value ) { 15003 var doc; 15004 15005 if ( isWindow( elem ) ) { 15006 15007 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 15008 return funcName.indexOf( "outer" ) === 0 ? 15009 elem[ "inner" + name ] : 15010 elem.document.documentElement[ "client" + name ]; 15011 } 15012 15013 // Get document width or height 15014 if ( elem.nodeType === 9 ) { 15015 doc = elem.documentElement; 15016 15017 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 15018 // whichever is greatest 15019 return Math.max( 15020 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 15021 elem.body[ "offset" + name ], doc[ "offset" + name ], 15022 doc[ "client" + name ] 15023 ); 15024 } 15025 15026 return value === undefined ? 15027 15028 // Get width or height on the element, requesting but not forcing parseFloat 15029 jQuery.css( elem, type, extra ) : 15030 15031 // Set width or height on the element 15032 jQuery.style( elem, type, value, extra ); 15033 }, type, chainable ? margin : undefined, chainable ); 15034 }; 15035 } ); 15036} ); 15037 15038 15039jQuery.each( [ 15040 "ajaxStart", 15041 "ajaxStop", 15042 "ajaxComplete", 15043 "ajaxError", 15044 "ajaxSuccess", 15045 "ajaxSend" 15046], function( _i, type ) { 15047 jQuery.fn[ type ] = function( fn ) { 15048 return this.on( type, fn ); 15049 }; 15050} ); 15051 15052 15053 15054 15055jQuery.fn.extend( { 15056 15057 bind: function( types, data, fn ) { 15058 return this.on( types, null, data, fn ); 15059 }, 15060 unbind: function( types, fn ) { 15061 return this.off( types, null, fn ); 15062 }, 15063 15064 delegate: function( selector, types, data, fn ) { 15065 return this.on( types, selector, data, fn ); 15066 }, 15067 undelegate: function( selector, types, fn ) { 15068 15069 // ( namespace ) or ( selector, types [, fn] ) 15070 return arguments.length === 1 ? 15071 this.off( selector, "**" ) : 15072 this.off( types, selector || "**", fn ); 15073 }, 15074 15075 hover: function( fnOver, fnOut ) { 15076 return this 15077 .on( "mouseenter", fnOver ) 15078 .on( "mouseleave", fnOut || fnOver ); 15079 } 15080} ); 15081 15082jQuery.each( 15083 ( "blur focus focusin focusout resize scroll click dblclick " + 15084 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 15085 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 15086 function( _i, name ) { 15087 15088 // Handle event binding 15089 jQuery.fn[ name ] = function( data, fn ) { 15090 return arguments.length > 0 ? 15091 this.on( name, null, data, fn ) : 15092 this.trigger( name ); 15093 }; 15094 } 15095); 15096 15097 15098 15099 15100// Support: Android <=4.0 only 15101// Make sure we trim BOM and NBSP 15102// Require that the "whitespace run" starts from a non-whitespace 15103// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 15104var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 15105 15106// Bind a function to a context, optionally partially applying any 15107// arguments. 15108// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 15109// However, it is not slated for removal any time soon 15110jQuery.proxy = function( fn, context ) { 15111 var tmp, args, proxy; 15112 15113 if ( typeof context === "string" ) { 15114 tmp = fn[ context ]; 15115 context = fn; 15116 fn = tmp; 15117 } 15118 15119 // Quick check to determine if target is callable, in the spec 15120 // this throws a TypeError, but we will just return undefined. 15121 if ( !isFunction( fn ) ) { 15122 return undefined; 15123 } 15124 15125 // Simulated bind 15126 args = slice.call( arguments, 2 ); 15127 proxy = function() { 15128 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 15129 }; 15130 15131 // Set the guid of unique handler to the same of original handler, so it can be removed 15132 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 15133 15134 return proxy; 15135}; 15136 15137jQuery.holdReady = function( hold ) { 15138 if ( hold ) { 15139 jQuery.readyWait++; 15140 } else { 15141 jQuery.ready( true ); 15142 } 15143}; 15144jQuery.isArray = Array.isArray; 15145jQuery.parseJSON = JSON.parse; 15146jQuery.nodeName = nodeName; 15147jQuery.isFunction = isFunction; 15148jQuery.isWindow = isWindow; 15149jQuery.camelCase = camelCase; 15150jQuery.type = toType; 15151 15152jQuery.now = Date.now; 15153 15154jQuery.isNumeric = function( obj ) { 15155 15156 // As of jQuery 3.0, isNumeric is limited to 15157 // strings and numbers (primitives or objects) 15158 // that can be coerced to finite numbers (gh-2662) 15159 var type = jQuery.type( obj ); 15160 return ( type === "number" || type === "string" ) && 15161 15162 // parseFloat NaNs numeric-cast false positives ("") 15163 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 15164 // subtraction forces infinities to NaN 15165 !isNaN( obj - parseFloat( obj ) ); 15166}; 15167 15168jQuery.trim = function( text ) { 15169 return text == null ? 15170 "" : 15171 ( text + "" ).replace( rtrim, "$1" ); 15172}; 15173 15174 15175 15176// Register as a named AMD module, since jQuery can be concatenated with other 15177// files that may use define, but not via a proper concatenation script that 15178// understands anonymous AMD modules. A named AMD is safest and most robust 15179// way to register. Lowercase jquery is used because AMD module names are 15180// derived from file names, and jQuery is normally delivered in a lowercase 15181// file name. Do this after creating the global so that if an AMD module wants 15182// to call noConflict to hide this version of jQuery, it will work. 15183 15184// Note that for maximum portability, libraries that are not jQuery should 15185// declare themselves as anonymous modules, and avoid setting a global if an 15186// AMD loader is present. jQuery is a special case. For more information, see 15187// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 15188 15189if ( true ) { 15190 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 15191 return jQuery; 15192 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 15193 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 15194} 15195 15196 15197 15198 15199var 15200 15201 // Map over jQuery in case of overwrite 15202 _jQuery = window.jQuery, 15203 15204 // Map over the $ in case of overwrite 15205 _$ = window.$; 15206 15207jQuery.noConflict = function( deep ) { 15208 if ( window.$ === jQuery ) { 15209 window.$ = _$; 15210 } 15211 15212 if ( deep && window.jQuery === jQuery ) { 15213 window.jQuery = _jQuery; 15214 } 15215 15216 return jQuery; 15217}; 15218 15219// Expose jQuery and $ identifiers, even in AMD 15220// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 15221// and CommonJS for browser emulators (trac-13566) 15222if ( typeof noGlobal === "undefined" ) { 15223 window.jQuery = window.$ = jQuery; 15224} 15225 15226 15227 15228 15229return jQuery; 15230} ); 15231 15232 15233/***/ }), 15234
vendor: 4,007 bytes, lines 15235-15379
15235/***/ "./Themes/Cynoebook/node_modules/microplugin/src/microplugin.js": 15236/*!**********************************************************************!*\ 15237 !*** ./Themes/Cynoebook/node_modules/microplugin/src/microplugin.js ***! 15238 \**********************************************************************/ 15239/*! no static exports found */ 15240/***/ (function(module, exports, __webpack_require__) { 15241 15242var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/** 15243 * microplugin.js 15244 * Copyright (c) 2013 Brian Reavis & contributors 15245 * 15246 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 15247 * file except in compliance with the License. You may obtain a copy of the License at: 15248 * http://www.apache.org/licenses/LICENSE-2.0 15249 * 15250 * Unless required by applicable law or agreed to in writing, software distributed under 15251 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 15252 * ANY KIND, either express or implied. See the License for the specific language 15253 * governing permissions and limitations under the License. 15254 * 15255 * @author Brian Reavis <[email protected]> 15256 */ 15257 15258(function(root, factory) { 15259 if (true) { 15260 !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 15261 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 15262 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 15263 __WEBPACK_AMD_DEFINE_FACTORY__), 15264 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 15265 } else {} 15266}(this, function() { 15267 var MicroPlugin = {}; 15268 15269 MicroPlugin.mixin = function(Interface) { 15270 Interface.plugins = {}; 15271 15272 /** 15273 * Initializes the listed plugins (with options). 15274 * Acceptable formats: 15275 * 15276 * List (without options): 15277 * ['a', 'b', 'c'] 15278 * 15279 * List (with options): 15280 * [{'name': 'a', options: {}}, {'name': 'b', options: {}}] 15281 * 15282 * Hash (with options): 15283 * {'a': { ... }, 'b': { ... }, 'c': { ... }} 15284 * 15285 * @param {mixed} plugins 15286 */ 15287 Interface.prototype.initializePlugins = function(plugins) { 15288 var i, n, key; 15289 var self = this; 15290 var queue = []; 15291 15292 self.plugins = { 15293 names : [], 15294 settings : {}, 15295 requested : {}, 15296 loaded : {} 15297 }; 15298 15299 if (utils.isArray(plugins)) { 15300 for (i = 0, n = plugins.length; i < n; i++) { 15301 if (typeof plugins[i] === 'string') { 15302 queue.push(plugins[i]); 15303 } else { 15304 self.plugins.settings[plugins[i].name] = plugins[i].options; 15305 queue.push(plugins[i].name); 15306 } 15307 } 15308 } else if (plugins) { 15309 for (key in plugins) { 15310 if (plugins.hasOwnProperty(key)) { 15311 self.plugins.settings[key] = plugins[key]; 15312 queue.push(key); 15313 } 15314 } 15315 } 15316 15317 while (queue.length) { 15318 self.require(queue.shift()); 15319 } 15320 }; 15321 15322 Interface.prototype.loadPlugin = function(name) { 15323 var self = this; 15324 var plugins = self.plugins; 15325 var plugin = Interface.plugins[name]; 15326 15327 if (!Interface.plugins.hasOwnProperty(name)) { 15328 throw new Error('Unable to find "' + name + '" plugin'); 15329 } 15330 15331 plugins.requested[name] = true; 15332 plugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]); 15333 plugins.names.push(name); 15334 }; 15335 15336 /** 15337 * Initializes a plugin. 15338 * 15339 * @param {string} name 15340 */ 15341 Interface.prototype.require = function(name) { 15342 var self = this; 15343 var plugins = self.plugins; 15344 15345 if (!self.plugins.loaded.hasOwnProperty(name)) { 15346 if (plugins.requested[name]) { 15347 throw new Error('Plugin has circular dependency ("' + name + '")'); 15348 } 15349 self.loadPlugin(name); 15350 } 15351 15352 return plugins.loaded[name]; 15353 }; 15354 15355 /** 15356 * Registers a plugin. 15357 * 15358 * @param {string} name 15359 * @param {function} fn 15360 */ 15361 Interface.define = function(name, fn) { 15362 Interface.plugins[name] = { 15363 'name' : name, 15364 'fn' : fn 15365 }; 15366 }; 15367 }; 15368 15369 var utils = { 15370 isArray: Array.isArray || function(vArg) { 15371 return Object.prototype.toString.call(vArg) === '[object Array]'; 15372 } 15373 }; 15374 15375 return MicroPlugin; 15376})); 15377 15378/***/ }), 15379
vendor: 153,821 bytes, lines 15380-21480
15380/***/ "./Themes/Cynoebook/node_modules/select2/dist/js/select2.js": 15381/*!******************************************************************!*\ 15382 !*** ./Themes/Cynoebook/node_modules/select2/dist/js/select2.js ***! 15383 \******************************************************************/ 15384/*! no static exports found */ 15385/***/ (function(module, exports, __webpack_require__) { 15386 15387var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var require;var require;/*! 15388 * Select2 4.0.13 15389 * https://select2.github.io 15390 * 15391 * Released under the MIT license 15392 * https://github.com/select2/select2/blob/master/LICENSE.md 15393 */ 15394;(function (factory) { 15395 if (true) { 15396 // AMD. Register as an anonymous module. 15397 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./Themes/Cynoebook/node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 15398 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 15399 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 15400 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 15401 } else {} 15402} (function (jQuery) { 15403 // This is needed so we can catch the AMD loader configuration and use it 15404 // The inner file should be wrapped (by `banner.start.js`) in a function that 15405 // returns the AMD loader references. 15406 var S2 =(function () { 15407 // Restore the Select2 AMD loader so it can be used 15408 // Needed mostly in the language files, where the loader is not inserted 15409 if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { 15410 var S2 = jQuery.fn.select2.amd; 15411 } 15412var S2;(function () { if (!S2 || !S2.requirejs) { 15413if (!S2) { S2 = {}; } else { require = S2; } 15414/** 15415 * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. 15416 * Released under MIT license, http://github.com/requirejs/almond/LICENSE 15417 */ 15418//Going sloppy to avoid 'use strict' string cost, but strict practices should 15419//be followed. 15420/*global setTimeout: false */ 15421 15422var requirejs, require, define; 15423(function (undef) { 15424 var main, req, makeMap, handlers, 15425 defined = {}, 15426 waiting = {}, 15427 config = {}, 15428 defining = {}, 15429 hasOwn = Object.prototype.hasOwnProperty, 15430 aps = [].slice, 15431 jsSuffixRegExp = /\.js$/; 15432 15433 function hasProp(obj, prop) { 15434 return hasOwn.call(obj, prop); 15435 } 15436 15437 /** 15438 * Given a relative module name, like ./something, normalize it to 15439 * a real name that can be mapped to a path. 15440 * @param {String} name the relative name 15441 * @param {String} baseName a real name that the name arg is relative 15442 * to. 15443 * @returns {String} normalized name 15444 */ 15445 function normalize(name, baseName) { 15446 var nameParts, nameSegment, mapValue, foundMap, lastIndex, 15447 foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, 15448 baseParts = baseName && baseName.split("/"), 15449 map = config.map, 15450 starMap = (map && map['*']) || {}; 15451 15452 //Adjust any relative paths. 15453 if (name) { 15454 name = name.split('/'); 15455 lastIndex = name.length - 1; 15456 15457 // If wanting node ID compatibility, strip .js from end 15458 // of IDs. Have to do this here, and not in nameToUrl 15459 // because node allows either .js or non .js to map 15460 // to same file. 15461 if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { 15462 name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); 15463 } 15464 15465 // Starts with a '.' so need the baseName 15466 if (name[0].charAt(0) === '.' && baseParts) { 15467 //Convert baseName to array, and lop off the last part, 15468 //so that . matches that 'directory' and not name of the baseName's 15469 //module. For instance, baseName of 'one/two/three', maps to 15470 //'one/two/three.js', but we want the directory, 'one/two' for 15471 //this normalization. 15472 normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); 15473 name = normalizedBaseParts.concat(name); 15474 } 15475 15476 //start trimDots 15477 for (i = 0; i < name.length; i++) { 15478 part = name[i]; 15479 if (part === '.') { 15480 name.splice(i, 1); 15481 i -= 1; 15482 } else if (part === '..') { 15483 // If at the start, or previous value is still .., 15484 // keep them so that when converted to a path it may 15485 // still work when converted to a path, even though 15486 // as an ID it is less than ideal. In larger point 15487 // releases, may be better to just kick out an error. 15488 if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { 15489 continue; 15490 } else if (i > 0) { 15491 name.splice(i - 1, 2); 15492 i -= 2; 15493 } 15494 } 15495 } 15496 //end trimDots 15497 15498 name = name.join('/'); 15499 } 15500 15501 //Apply map config if available. 15502 if ((baseParts || starMap) && map) { 15503 nameParts = name.split('/'); 15504 15505 for (i = nameParts.length; i > 0; i -= 1) { 15506 nameSegment = nameParts.slice(0, i).join("/"); 15507 15508 if (baseParts) { 15509 //Find the longest baseName segment match in the config. 15510 //So, do joins on the biggest to smallest lengths of baseParts. 15511 for (j = baseParts.length; j > 0; j -= 1) { 15512 mapValue = map[baseParts.slice(0, j).join('/')]; 15513 15514 //baseName segment has config, find if it has one for 15515 //this name. 15516 if (mapValue) { 15517 mapValue = mapValue[nameSegment]; 15518 if (mapValue) { 15519 //Match, update name to the new value. 15520 foundMap = mapValue; 15521 foundI = i; 15522 break; 15523 } 15524 } 15525 } 15526 } 15527 15528 if (foundMap) { 15529 break; 15530 } 15531 15532 //Check for a star map match, but just hold on to it, 15533 //if there is a shorter segment match later in a matching 15534 //config, then favor over this star map. 15535 if (!foundStarMap && starMap && starMap[nameSegment]) { 15536 foundStarMap = starMap[nameSegment]; 15537 starI = i; 15538 } 15539 } 15540 15541 if (!foundMap && foundStarMap) { 15542 foundMap = foundStarMap; 15543 foundI = starI; 15544 } 15545 15546 if (foundMap) { 15547 nameParts.splice(0, foundI, foundMap); 15548 name = nameParts.join('/'); 15549 } 15550 } 15551 15552 return name; 15553 } 15554 15555 function makeRequire(relName, forceSync) { 15556 return function () { 15557 //A version of a require function that passes a moduleName 15558 //value for items that may need to 15559 //look up paths relative to the moduleName 15560 var args = aps.call(arguments, 0); 15561 15562 //If first arg is not require('string'), and there is only 15563 //one arg, it is the array form without a callback. Insert 15564 //a null so that the following concat is correct. 15565 if (typeof args[0] !== 'string' && args.length === 1) { 15566 args.push(null); 15567 } 15568 return req.apply(undef, args.concat([relName, forceSync])); 15569 }; 15570 } 15571 15572 function makeNormalize(relName) { 15573 return function (name) { 15574 return normalize(name, relName); 15575 }; 15576 } 15577 15578 function makeLoad(depName) { 15579 return function (value) { 15580 defined[depName] = value; 15581 }; 15582 } 15583 15584 function callDep(name) { 15585 if (hasProp(waiting, name)) { 15586 var args = waiting[name]; 15587 delete waiting[name]; 15588 defining[name] = true; 15589 main.apply(undef, args); 15590 } 15591 15592 if (!hasProp(defined, name) && !hasProp(defining, name)) { 15593 throw new Error('No ' + name); 15594 } 15595 return defined[name]; 15596 } 15597 15598 //Turns a plugin!resource to [plugin, resource] 15599 //with the plugin being undefined if the name 15600 //did not have a plugin prefix. 15601 function splitPrefix(name) { 15602 var prefix, 15603 index = name ? name.indexOf('!') : -1; 15604 if (index > -1) { 15605 prefix = name.substring(0, index); 15606 name = name.substring(index + 1, name.length); 15607 } 15608 return [prefix, name]; 15609 } 15610 15611 //Creates a parts array for a relName where first part is plugin ID, 15612 //second part is resource ID. Assumes relName has already been normalized. 15613 function makeRelParts(relName) { 15614 return relName ? splitPrefix(relName) : []; 15615 } 15616 15617 /** 15618 * Makes a name map, normalizing the name, and using a plugin 15619 * for normalization if necessary. Grabs a ref to plugin 15620 * too, as an optimization. 15621 */ 15622 makeMap = function (name, relParts) { 15623 var plugin, 15624 parts = splitPrefix(name), 15625 prefix = parts[0], 15626 relResourceName = relParts[1]; 15627 15628 name = parts[1]; 15629 15630 if (prefix) { 15631 prefix = normalize(prefix, relResourceName); 15632 plugin = callDep(prefix); 15633 } 15634 15635 //Normalize according 15636 if (prefix) { 15637 if (plugin && plugin.normalize) { 15638 name = plugin.normalize(name, makeNormalize(relResourceName)); 15639 } else { 15640 name = normalize(name, relResourceName); 15641 } 15642 } else { 15643 name = normalize(name, relResourceName); 15644 parts = splitPrefix(name); 15645 prefix = parts[0]; 15646 name = parts[1]; 15647 if (prefix) { 15648 plugin = callDep(prefix); 15649 } 15650 } 15651 15652 //Using ridiculous property names for space reasons 15653 return { 15654 f: prefix ? prefix + '!' + name : name, //fullName 15655 n: name, 15656 pr: prefix, 15657 p: plugin 15658 }; 15659 }; 15660 15661 function makeConfig(name) { 15662 return function () { 15663 return (config && config.config && config.config[name]) || {}; 15664 }; 15665 } 15666 15667 handlers = { 15668 require: function (name) { 15669 return makeRequire(name); 15670 }, 15671 exports: function (name) { 15672 var e = defined[name]; 15673 if (typeof e !== 'undefined') { 15674 return e; 15675 } else { 15676 return (defined[name] = {}); 15677 } 15678 }, 15679 module: function (name) { 15680 return { 15681 id: name, 15682 uri: '', 15683 exports: defined[name], 15684 config: makeConfig(name) 15685 }; 15686 } 15687 }; 15688 15689 main = function (name, deps, callback, relName) { 15690 var cjsModule, depName, ret, map, i, relParts, 15691 args = [], 15692 callbackType = typeof callback, 15693 usingExports; 15694 15695 //Use name if no relName 15696 relName = relName || name; 15697 relParts = makeRelParts(relName); 15698 15699 //Call the callback to define the module, if necessary. 15700 if (callbackType === 'undefined' || callbackType === 'function') { 15701 //Pull out the defined dependencies and pass the ordered 15702 //values to the callback. 15703 //Default to [require, exports, module] if no deps 15704 deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; 15705 for (i = 0; i < deps.length; i += 1) { 15706 map = makeMap(deps[i], relParts); 15707 depName = map.f; 15708 15709 //Fast path CommonJS standard dependencies. 15710 if (depName === "require") { 15711 args[i] = handlers.require(name); 15712 } else if (depName === "exports") { 15713 //CommonJS module spec 1.1 15714 args[i] = handlers.exports(name); 15715 usingExports = true; 15716 } else if (depName === "module") { 15717 //CommonJS module spec 1.1 15718 cjsModule = args[i] = handlers.module(name); 15719 } else if (hasProp(defined, depName) || 15720 hasProp(waiting, depName) || 15721 hasProp(defining, depName)) { 15722 args[i] = callDep(depName); 15723 } else if (map.p) { 15724 map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); 15725 args[i] = defined[depName]; 15726 } else { 15727 throw new Error(name + ' missing ' + depName); 15728 } 15729 } 15730 15731 ret = callback ? callback.apply(defined[name], args) : undefined; 15732 15733 if (name) { 15734 //If setting exports via "module" is in play, 15735 //favor that over return value and exports. After that, 15736 //favor a non-undefined return value over exports use. 15737 if (cjsModule && cjsModule.exports !== undef && 15738 cjsModule.exports !== defined[name]) { 15739 defined[name] = cjsModule.exports; 15740 } else if (ret !== undef || !usingExports) { 15741 //Use the return value from the function. 15742 defined[name] = ret; 15743 } 15744 } 15745 } else if (name) { 15746 //May just be an object definition for the module. Only 15747 //worry about defining if have a module name. 15748 defined[name] = callback; 15749 } 15750 }; 15751 15752 requirejs = require = req = function (deps, callback, relName, forceSync, alt) { 15753 if (typeof deps === "string") { 15754 if (handlers[deps]) { 15755 //callback in this case is really relName 15756 return handlers[deps](callback); 15757 } 15758 //Just return the module wanted. In this scenario, the 15759 //deps arg is the module name, and second arg (if passed) 15760 //is just the relName. 15761 //Normalize module name, if it contains . or .. 15762 return callDep(makeMap(deps, makeRelParts(callback)).f); 15763 } else if (!deps.splice) { 15764 //deps is a config object, not an array. 15765 config = deps; 15766 if (config.deps) { 15767 req(config.deps, config.callback); 15768 } 15769 if (!callback) { 15770 return; 15771 } 15772 15773 if (callback.splice) { 15774 //callback is an array, which means it is a dependency list. 15775 //Adjust args if there are dependencies 15776 deps = callback; 15777 callback = relName; 15778 relName = null; 15779 } else { 15780 deps = undef; 15781 } 15782 } 15783 15784 //Support require(['a']) 15785 callback = callback || function () {}; 15786 15787 //If relName is a function, it is an errback handler, 15788 //so remove it. 15789 if (typeof relName === 'function') { 15790 relName = forceSync; 15791 forceSync = alt; 15792 } 15793 15794 //Simulate async callback; 15795 if (forceSync) { 15796 main(undef, deps, callback, relName); 15797 } else { 15798 //Using a non-zero value because of concern for what old browsers 15799 //do, and latest browsers "upgrade" to 4 if lower value is used: 15800 //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: 15801 //If want a value immediately, use require('id') instead -- something 15802 //that works in almond on the global level, but not guaranteed and 15803 //unlikely to work in other AMD implementations. 15804 setTimeout(function () { 15805 main(undef, deps, callback, relName); 15806 }, 4); 15807 } 15808 15809 return req; 15810 }; 15811 15812 /** 15813 * Just drops the config on the floor, but returns req in case 15814 * the config return value is used. 15815 */ 15816 req.config = function (cfg) { 15817 return req(cfg); 15818 }; 15819 15820 /** 15821 * Expose module registry for debugging and tooling 15822 */ 15823 requirejs._defined = defined; 15824 15825 define = function (name, deps, callback) { 15826 if (typeof name !== 'string') { 15827 throw new Error('See almond README: incorrect module build, no module name'); 15828 } 15829 15830 //This module may not have dependencies 15831 if (!deps.splice) { 15832 //deps is not an array, so probably means 15833 //an object literal or factory function for 15834 //the value. Adjust args. 15835 callback = deps; 15836 deps = []; 15837 } 15838 15839 if (!hasProp(defined, name) && !hasProp(waiting, name)) { 15840 waiting[name] = [name, deps, callback]; 15841 } 15842 }; 15843 15844 define.amd = { 15845 jQuery: true 15846 }; 15847}()); 15848 15849S2.requirejs = requirejs;S2.require = require;S2.define = define; 15850} 15851}()); 15852S2.define("almond", function(){}); 15853 15854/* global jQuery:false, $:false */ 15855S2.define('jquery',[],function () { 15856 var _$ = jQuery || $; 15857 15858 if (_$ == null && console && console.error) { 15859 console.error( 15860 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + 15861 'found. Make sure that you are including jQuery before Select2 on your ' + 15862 'web page.' 15863 ); 15864 } 15865 15866 return _$; 15867}); 15868 15869S2.define('select2/utils',[ 15870 'jquery' 15871], function ($) { 15872 var Utils = {}; 15873 15874 Utils.Extend = function (ChildClass, SuperClass) { 15875 var __hasProp = {}.hasOwnProperty; 15876 15877 function BaseConstructor () { 15878 this.constructor = ChildClass; 15879 } 15880 15881 for (var key in SuperClass) { 15882 if (__hasProp.call(SuperClass, key)) { 15883 ChildClass[key] = SuperClass[key]; 15884 } 15885 } 15886 15887 BaseConstructor.prototype = SuperClass.prototype; 15888 ChildClass.prototype = new BaseConstructor(); 15889 ChildClass.__super__ = SuperClass.prototype; 15890 15891 return ChildClass; 15892 }; 15893 15894 function getMethods (theClass) { 15895 var proto = theClass.prototype; 15896 15897 var methods = []; 15898 15899 for (var methodName in proto) { 15900 var m = proto[methodName]; 15901 15902 if (typeof m !== 'function') { 15903 continue; 15904 } 15905 15906 if (methodName === 'constructor') { 15907 continue; 15908 } 15909 15910 methods.push(methodName); 15911 } 15912 15913 return methods; 15914 } 15915 15916 Utils.Decorate = function (SuperClass, DecoratorClass) { 15917 var decoratedMethods = getMethods(DecoratorClass); 15918 var superMethods = getMethods(SuperClass); 15919 15920 function DecoratedClass () { 15921 var unshift = Array.prototype.unshift; 15922 15923 var argCount = DecoratorClass.prototype.constructor.length; 15924 15925 var calledConstructor = SuperClass.prototype.constructor; 15926 15927 if (argCount > 0) { 15928 unshift.call(arguments, SuperClass.prototype.constructor); 15929 15930 calledConstructor = DecoratorClass.prototype.constructor; 15931 } 15932 15933 calledConstructor.apply(this, arguments); 15934 } 15935 15936 DecoratorClass.displayName = SuperClass.displayName; 15937 15938 function ctr () { 15939 this.constructor = DecoratedClass; 15940 } 15941 15942 DecoratedClass.prototype = new ctr(); 15943 15944 for (var m = 0; m < superMethods.length; m++) { 15945 var superMethod = superMethods[m]; 15946 15947 DecoratedClass.prototype[superMethod] = 15948 SuperClass.prototype[superMethod]; 15949 } 15950 15951 var calledMethod = function (methodName) { 15952 // Stub out the original method if it's not decorating an actual method 15953 var originalMethod = function () {}; 15954 15955 if (methodName in DecoratedClass.prototype) { 15956 originalMethod = DecoratedClass.prototype[methodName]; 15957 } 15958 15959 var decoratedMethod = DecoratorClass.prototype[methodName]; 15960 15961 return function () { 15962 var unshift = Array.prototype.unshift; 15963 15964 unshift.call(arguments, originalMethod); 15965 15966 return decoratedMethod.apply(this, arguments); 15967 }; 15968 }; 15969 15970 for (var d = 0; d < decoratedMethods.length; d++) { 15971 var decoratedMethod = decoratedMethods[d]; 15972 15973 DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); 15974 } 15975 15976 return DecoratedClass; 15977 }; 15978 15979 var Observable = function () { 15980 this.listeners = {}; 15981 }; 15982 15983 Observable.prototype.on = function (event, callback) { 15984 this.listeners = this.listeners || {}; 15985 15986 if (event in this.listeners) { 15987 this.listeners[event].push(callback); 15988 } else { 15989 this.listeners[event] = [callback]; 15990 } 15991 }; 15992 15993 Observable.prototype.trigger = function (event) { 15994 var slice = Array.prototype.slice; 15995 var params = slice.call(arguments, 1); 15996 15997 this.listeners = this.listeners || {}; 15998 15999 // Params should always come in as an array 16000 if (params == null) { 16001 params = []; 16002 } 16003 16004 // If there are no arguments to the event, use a temporary object 16005 if (params.length === 0) { 16006 params.push({}); 16007 } 16008 16009 // Set the `_type` of the first object to the event 16010 params[0]._type = event; 16011 16012 if (event in this.listeners) { 16013 this.invoke(this.listeners[event], slice.call(arguments, 1)); 16014 } 16015 16016 if ('*' in this.listeners) { 16017 this.invoke(this.listeners['*'], arguments); 16018 } 16019 }; 16020 16021 Observable.prototype.invoke = function (listeners, params) { 16022 for (var i = 0, len = listeners.length; i < len; i++) { 16023 listeners[i].apply(this, params); 16024 } 16025 }; 16026 16027 Utils.Observable = Observable; 16028 16029 Utils.generateChars = function (length) { 16030 var chars = ''; 16031 16032 for (var i = 0; i < length; i++) { 16033 var randomChar = Math.floor(Math.random() * 36); 16034 chars += randomChar.toString(36); 16035 } 16036 16037 return chars; 16038 }; 16039 16040 Utils.bind = function (func, context) { 16041 return function () { 16042 func.apply(context, arguments); 16043 }; 16044 }; 16045 16046 Utils._convertData = function (data) { 16047 for (var originalKey in data) { 16048 var keys = originalKey.split('-'); 16049 16050 var dataLevel = data; 16051 16052 if (keys.length === 1) { 16053 continue; 16054 } 16055 16056 for (var k = 0; k < keys.length; k++) { 16057 var key = keys[k]; 16058 16059 // Lowercase the first letter 16060 // By default, dash-separated becomes camelCase 16061 key = key.substring(0, 1).toLowerCase() + key.substring(1); 16062 16063 if (!(key in dataLevel)) { 16064 dataLevel[key] = {}; 16065 } 16066 16067 if (k == keys.length - 1) { 16068 dataLevel[key] = data[originalKey]; 16069 } 16070 16071 dataLevel = dataLevel[key]; 16072 } 16073 16074 delete data[originalKey]; 16075 } 16076 16077 return data; 16078 }; 16079 16080 Utils.hasScroll = function (index, el) { 16081 // Adapted from the function created by @ShadowScripter 16082 // and adapted by @BillBarry on the Stack Exchange Code Review website. 16083 // The original code can be found at 16084 // http://codereview.stackexchange.com/q/13338 16085 // and was designed to be used with the Sizzle selector engine. 16086 16087 var $el = $(el); 16088 var overflowX = el.style.overflowX; 16089 var overflowY = el.style.overflowY; 16090 16091 //Check both x and y declarations 16092 if (overflowX === overflowY && 16093 (overflowY === 'hidden' || overflowY === 'visible')) { 16094 return false; 16095 } 16096 16097 if (overflowX === 'scroll' || overflowY === 'scroll') { 16098 return true; 16099 } 16100 16101 return ($el.innerHeight() < el.scrollHeight || 16102 $el.innerWidth() < el.scrollWidth); 16103 }; 16104 16105 Utils.escapeMarkup = function (markup) { 16106 var replaceMap = { 16107 '\\': '\', 16108 '&': '&', 16109 '<': '<', 16110 '>': '>', 16111 '"': '"', 16112 '\'': ''', 16113 '/': '/' 16114 }; 16115 16116 // Do not try to escape the markup if it's not a string 16117 if (typeof markup !== 'string') { 16118 return markup; 16119 } 16120 16121 return String(markup).replace(/[&<>"'\/\\]/g, function (match) { 16122 return replaceMap[match]; 16123 }); 16124 }; 16125 16126 // Append an array of jQuery nodes to a given element. 16127 Utils.appendMany = function ($element, $nodes) { 16128 // jQuery 1.7.x does not support $.fn.append() with an array 16129 // Fall back to a jQuery object collection using $.fn.add() 16130 if ($.fn.jquery.substr(0, 3) === '1.7') { 16131 var $jqNodes = $(); 16132 16133 $.map($nodes, function (node) { 16134 $jqNodes = $jqNodes.add(node); 16135 }); 16136 16137 $nodes = $jqNodes; 16138 } 16139 16140 $element.append($nodes); 16141 }; 16142 16143 // Cache objects in Utils.__cache instead of $.data (see #4346) 16144 Utils.__cache = {}; 16145 16146 var id = 0; 16147 Utils.GetUniqueElementId = function (element) { 16148 // Get a unique element Id. If element has no id, 16149 // creates a new unique number, stores it in the id 16150 // attribute and returns the new id. 16151 // If an id already exists, it simply returns it. 16152 16153 var select2Id = element.getAttribute('data-select2-id'); 16154 if (select2Id == null) { 16155 // If element has id, use it. 16156 if (element.id) { 16157 select2Id = element.id; 16158 element.setAttribute('data-select2-id', select2Id); 16159 } else { 16160 element.setAttribute('data-select2-id', ++id); 16161 select2Id = id.toString(); 16162 } 16163 } 16164 return select2Id; 16165 }; 16166 16167 Utils.StoreData = function (element, name, value) { 16168 // Stores an item in the cache for a specified element. 16169 // name is the cache key. 16170 var id = Utils.GetUniqueElementId(element); 16171 if (!Utils.__cache[id]) { 16172 Utils.__cache[id] = {}; 16173 } 16174 16175 Utils.__cache[id][name] = value; 16176 }; 16177 16178 Utils.GetData = function (element, name) { 16179 // Retrieves a value from the cache by its key (name) 16180 // name is optional. If no name specified, return 16181 // all cache items for the specified element. 16182 // and for a specified element. 16183 var id = Utils.GetUniqueElementId(element); 16184 if (name) { 16185 if (Utils.__cache[id]) { 16186 if (Utils.__cache[id][name] != null) { 16187 return Utils.__cache[id][name]; 16188 } 16189 return $(element).data(name); // Fallback to HTML5 data attribs. 16190 } 16191 return $(element).data(name); // Fallback to HTML5 data attribs. 16192 } else { 16193 return Utils.__cache[id]; 16194 } 16195 }; 16196 16197 Utils.RemoveData = function (element) { 16198 // Removes all cached items for a specified element. 16199 var id = Utils.GetUniqueElementId(element); 16200 if (Utils.__cache[id] != null) { 16201 delete Utils.__cache[id]; 16202 } 16203 16204 element.removeAttribute('data-select2-id'); 16205 }; 16206 16207 return Utils; 16208}); 16209 16210S2.define('select2/results',[ 16211 'jquery', 16212 './utils' 16213], function ($, Utils) { 16214 function Results ($element, options, dataAdapter) { 16215 this.$element = $element; 16216 this.data = dataAdapter; 16217 this.options = options; 16218 16219 Results.__super__.constructor.call(this); 16220 } 16221 16222 Utils.Extend(Results, Utils.Observable); 16223 16224 Results.prototype.render = function () { 16225 var $results = $( 16226 '<ul class="select2-results__options" role="listbox"></ul>' 16227 ); 16228 16229 if (this.options.get('multiple')) { 16230 $results.attr('aria-multiselectable', 'true'); 16231 } 16232 16233 this.$results = $results; 16234 16235 return $results; 16236 }; 16237 16238 Results.prototype.clear = function () { 16239 this.$results.empty(); 16240 }; 16241 16242 Results.prototype.displayMessage = function (params) { 16243 var escapeMarkup = this.options.get('escapeMarkup'); 16244 16245 this.clear(); 16246 this.hideLoading(); 16247 16248 var $message = $( 16249 '<li role="alert" aria-live="assertive"' + 16250 ' class="select2-results__option"></li>' 16251 ); 16252 16253 var message = this.options.get('translations').get(params.message); 16254 16255 $message.append( 16256 escapeMarkup( 16257 message(params.args) 16258 ) 16259 ); 16260 16261 $message[0].className += ' select2-results__message'; 16262 16263 this.$results.append($message); 16264 }; 16265 16266 Results.prototype.hideMessages = function () { 16267 this.$results.find('.select2-results__message').remove(); 16268 }; 16269 16270 Results.prototype.append = function (data) { 16271 this.hideLoading(); 16272 16273 var $options = []; 16274 16275 if (data.results == null || data.results.length === 0) { 16276 if (this.$results.children().length === 0) { 16277 this.trigger('results:message', { 16278 message: 'noResults' 16279 }); 16280 } 16281 16282 return; 16283 } 16284 16285 data.results = this.sort(data.results); 16286 16287 for (var d = 0; d < data.results.length; d++) { 16288 var item = data.results[d]; 16289 16290 var $option = this.option(item); 16291 16292 $options.push($option); 16293 } 16294 16295 this.$results.append($options); 16296 }; 16297 16298 Results.prototype.position = function ($results, $dropdown) { 16299 var $resultsContainer = $dropdown.find('.select2-results'); 16300 $resultsContainer.append($results); 16301 }; 16302 16303 Results.prototype.sort = function (data) { 16304 var sorter = this.options.get('sorter'); 16305 16306 return sorter(data); 16307 }; 16308 16309 Results.prototype.highlightFirstItem = function () { 16310 var $options = this.$results 16311 .find('.select2-results__option[aria-selected]'); 16312 16313 var $selected = $options.filter('[aria-selected=true]'); 16314 16315 // Check if there are any selected options 16316 if ($selected.length > 0) { 16317 // If there are selected options, highlight the first 16318 $selected.first().trigger('mouseenter'); 16319 } else { 16320 // If there are no selected options, highlight the first option 16321 // in the dropdown 16322 $options.first().trigger('mouseenter'); 16323 } 16324 16325 this.ensureHighlightVisible(); 16326 }; 16327 16328 Results.prototype.setClasses = function () { 16329 var self = this; 16330 16331 this.data.current(function (selected) { 16332 var selectedIds = $.map(selected, function (s) { 16333 return s.id.toString(); 16334 }); 16335 16336 var $options = self.$results 16337 .find('.select2-results__option[aria-selected]'); 16338 16339 $options.each(function () { 16340 var $option = $(this); 16341 16342 var item = Utils.GetData(this, 'data'); 16343 16344 // id needs to be converted to a string when comparing 16345 var id = '' + item.id; 16346 16347 if ((item.element != null && item.element.selected) || 16348 (item.element == null && $.inArray(id, selectedIds) > -1)) { 16349 $option.attr('aria-selected', 'true'); 16350 } else { 16351 $option.attr('aria-selected', 'false'); 16352 } 16353 }); 16354 16355 }); 16356 }; 16357 16358 Results.prototype.showLoading = function (params) { 16359 this.hideLoading(); 16360 16361 var loadingMore = this.options.get('translations').get('searching'); 16362 16363 var loading = { 16364 disabled: true, 16365 loading: true, 16366 text: loadingMore(params) 16367 }; 16368 var $loading = this.option(loading); 16369 $loading.className += ' loading-results'; 16370 16371 this.$results.prepend($loading); 16372 }; 16373 16374 Results.prototype.hideLoading = function () { 16375 this.$results.find('.loading-results').remove(); 16376 }; 16377 16378 Results.prototype.option = function (data) { 16379 var option = document.createElement('li'); 16380 option.className = 'select2-results__option'; 16381 16382 var attrs = { 16383 'role': 'option', 16384 'aria-selected': 'false' 16385 }; 16386 16387 var matches = window.Element.prototype.matches || 16388 window.Element.prototype.msMatchesSelector || 16389 window.Element.prototype.webkitMatchesSelector; 16390 16391 if ((data.element != null && matches.call(data.element, ':disabled')) || 16392 (data.element == null && data.disabled)) { 16393 delete attrs['aria-selected']; 16394 attrs['aria-disabled'] = 'true'; 16395 } 16396 16397 if (data.id == null) { 16398 delete attrs['aria-selected']; 16399 } 16400 16401 if (data._resultId != null) { 16402 option.id = data._resultId; 16403 } 16404 16405 if (data.title) { 16406 option.title = data.title; 16407 } 16408 16409 if (data.children) { 16410 attrs.role = 'group'; 16411 attrs['aria-label'] = data.text; 16412 delete attrs['aria-selected']; 16413 } 16414 16415 for (var attr in attrs) { 16416 var val = attrs[attr]; 16417 16418 option.setAttribute(attr, val); 16419 } 16420 16421 if (data.children) { 16422 var $option = $(option); 16423 16424 var label = document.createElement('strong'); 16425 label.className = 'select2-results__group'; 16426 16427 var $label = $(label); 16428 this.template(data, label); 16429 16430 var $children = []; 16431 16432 for (var c = 0; c < data.children.length; c++) { 16433 var child = data.children[c]; 16434 16435 var $child = this.option(child); 16436 16437 $children.push($child); 16438 } 16439 16440 var $childrenContainer = $('<ul></ul>', { 16441 'class': 'select2-results__options select2-results__options--nested' 16442 }); 16443 16444 $childrenContainer.append($children); 16445 16446 $option.append(label); 16447 $option.append($childrenContainer); 16448 } else { 16449 this.template(data, option); 16450 } 16451 16452 Utils.StoreData(option, 'data', data); 16453 16454 return option; 16455 }; 16456 16457 Results.prototype.bind = function (container, $container) { 16458 var self = this; 16459 16460 var id = container.id + '-results'; 16461 16462 this.$results.attr('id', id); 16463 16464 container.on('results:all', function (params) { 16465 self.clear(); 16466 self.append(params.data); 16467 16468 if (container.isOpen()) { 16469 self.setClasses(); 16470 self.highlightFirstItem(); 16471 } 16472 }); 16473 16474 container.on('results:append', function (params) { 16475 self.append(params.data); 16476 16477 if (container.isOpen()) { 16478 self.setClasses(); 16479 } 16480 }); 16481 16482 container.on('query', function (params) { 16483 self.hideMessages(); 16484 self.showLoading(params); 16485 }); 16486 16487 container.on('select', function () { 16488 if (!container.isOpen()) { 16489 return; 16490 } 16491 16492 self.setClasses(); 16493 16494 if (self.options.get('scrollAfterSelect')) { 16495 self.highlightFirstItem(); 16496 } 16497 }); 16498 16499 container.on('unselect', function () { 16500 if (!container.isOpen()) { 16501 return; 16502 } 16503 16504 self.setClasses(); 16505 16506 if (self.options.get('scrollAfterSelect')) { 16507 self.highlightFirstItem(); 16508 } 16509 }); 16510 16511 container.on('open', function () { 16512 // When the dropdown is open, aria-expended="true" 16513 self.$results.attr('aria-expanded', 'true'); 16514 self.$results.attr('aria-hidden', 'false'); 16515 16516 self.setClasses(); 16517 self.ensureHighlightVisible(); 16518 }); 16519 16520 container.on('close', function () { 16521 // When the dropdown is closed, aria-expended="false" 16522 self.$results.attr('aria-expanded', 'false'); 16523 self.$results.attr('aria-hidden', 'true'); 16524 self.$results.removeAttr('aria-activedescendant'); 16525 }); 16526 16527 container.on('results:toggle', function () { 16528 var $highlighted = self.getHighlightedResults(); 16529 16530 if ($highlighted.length === 0) { 16531 return; 16532 } 16533 16534 $highlighted.trigger('mouseup'); 16535 }); 16536 16537 container.on('results:select', function () { 16538 var $highlighted = self.getHighlightedResults(); 16539 16540 if ($highlighted.length === 0) { 16541 return; 16542 } 16543 16544 var data = Utils.GetData($highlighted[0], 'data'); 16545 16546 if ($highlighted.attr('aria-selected') == 'true') { 16547 self.trigger('close', {}); 16548 } else { 16549 self.trigger('select', { 16550 data: data 16551 }); 16552 } 16553 }); 16554 16555 container.on('results:previous', function () { 16556 var $highlighted = self.getHighlightedResults(); 16557 16558 var $options = self.$results.find('[aria-selected]'); 16559 16560 var currentIndex = $options.index($highlighted); 16561 16562 // If we are already at the top, don't move further 16563 // If no options, currentIndex will be -1 16564 if (currentIndex <= 0) { 16565 return; 16566 } 16567 16568 var nextIndex = currentIndex - 1; 16569 16570 // If none are highlighted, highlight the first 16571 if ($highlighted.length === 0) { 16572 nextIndex = 0; 16573 } 16574 16575 var $next = $options.eq(nextIndex); 16576 16577 $next.trigger('mouseenter'); 16578 16579 var currentOffset = self.$results.offset().top; 16580 var nextTop = $next.offset().top; 16581 var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); 16582 16583 if (nextIndex === 0) { 16584 self.$results.scrollTop(0); 16585 } else if (nextTop - currentOffset < 0) { 16586 self.$results.scrollTop(nextOffset); 16587 } 16588 }); 16589 16590 container.on('results:next', function () { 16591 var $highlighted = self.getHighlightedResults(); 16592 16593 var $options = self.$results.find('[aria-selected]'); 16594 16595 var currentIndex = $options.index($highlighted); 16596 16597 var nextIndex = currentIndex + 1; 16598 16599 // If we are at the last option, stay there 16600 if (nextIndex >= $options.length) { 16601 return; 16602 } 16603 16604 var $next = $options.eq(nextIndex); 16605 16606 $next.trigger('mouseenter'); 16607 16608 var currentOffset = self.$results.offset().top + 16609 self.$results.outerHeight(false); 16610 var nextBottom = $next.offset().top + $next.outerHeight(false); 16611 var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; 16612 16613 if (nextIndex === 0) { 16614 self.$results.scrollTop(0); 16615 } else if (nextBottom > currentOffset) { 16616 self.$results.scrollTop(nextOffset); 16617 } 16618 }); 16619 16620 container.on('results:focus', function (params) { 16621 params.element.addClass('select2-results__option--highlighted'); 16622 }); 16623 16624 container.on('results:message', function (params) { 16625 self.displayMessage(params); 16626 }); 16627 16628 if ($.fn.mousewheel) { 16629 this.$results.on('mousewheel', function (e) { 16630 var top = self.$results.scrollTop(); 16631 16632 var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; 16633 16634 var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; 16635 var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); 16636 16637 if (isAtTop) { 16638 self.$results.scrollTop(0); 16639 16640 e.preventDefault(); 16641 e.stopPropagation(); 16642 } else if (isAtBottom) { 16643 self.$results.scrollTop( 16644 self.$results.get(0).scrollHeight - self.$results.height() 16645 ); 16646 16647 e.preventDefault(); 16648 e.stopPropagation(); 16649 } 16650 }); 16651 } 16652 16653 this.$results.on('mouseup', '.select2-results__option[aria-selected]', 16654 function (evt) { 16655 var $this = $(this); 16656 16657 var data = Utils.GetData(this, 'data'); 16658 16659 if ($this.attr('aria-selected') === 'true') { 16660 if (self.options.get('multiple')) { 16661 self.trigger('unselect', { 16662 originalEvent: evt, 16663 data: data 16664 }); 16665 } else { 16666 self.trigger('close', {}); 16667 } 16668 16669 return; 16670 } 16671 16672 self.trigger('select', { 16673 originalEvent: evt, 16674 data: data 16675 }); 16676 }); 16677 16678 this.$results.on('mouseenter', '.select2-results__option[aria-selected]', 16679 function (evt) { 16680 var data = Utils.GetData(this, 'data'); 16681 16682 self.getHighlightedResults() 16683 .removeClass('select2-results__option--highlighted'); 16684 16685 self.trigger('results:focus', { 16686 data: data, 16687 element: $(this) 16688 }); 16689 }); 16690 }; 16691 16692 Results.prototype.getHighlightedResults = function () { 16693 var $highlighted = this.$results 16694 .find('.select2-results__option--highlighted'); 16695 16696 return $highlighted; 16697 }; 16698 16699 Results.prototype.destroy = function () { 16700 this.$results.remove(); 16701 }; 16702 16703 Results.prototype.ensureHighlightVisible = function () { 16704 var $highlighted = this.getHighlightedResults(); 16705 16706 if ($highlighted.length === 0) { 16707 return; 16708 } 16709 16710 var $options = this.$results.find('[aria-selected]'); 16711 16712 var currentIndex = $options.index($highlighted); 16713 16714 var currentOffset = this.$results.offset().top; 16715 var nextTop = $highlighted.offset().top; 16716 var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); 16717 16718 var offsetDelta = nextTop - currentOffset; 16719 nextOffset -= $highlighted.outerHeight(false) * 2; 16720 16721 if (currentIndex <= 2) { 16722 this.$results.scrollTop(0); 16723 } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { 16724 this.$results.scrollTop(nextOffset); 16725 } 16726 }; 16727 16728 Results.prototype.template = function (result, container) { 16729 var template = this.options.get('templateResult'); 16730 var escapeMarkup = this.options.get('escapeMarkup'); 16731 16732 var content = template(result, container); 16733 16734 if (content == null) { 16735 container.style.display = 'none'; 16736 } else if (typeof content === 'string') { 16737 container.innerHTML = escapeMarkup(content); 16738 } else { 16739 $(container).append(content); 16740 } 16741 }; 16742 16743 return Results; 16744}); 16745 16746S2.define('select2/keys',[ 16747 16748], function () { 16749 var KEYS = { 16750 BACKSPACE: 8, 16751 TAB: 9, 16752 ENTER: 13, 16753 SHIFT: 16, 16754 CTRL: 17, 16755 ALT: 18, 16756 ESC: 27, 16757 SPACE: 32, 16758 PAGE_UP: 33, 16759 PAGE_DOWN: 34, 16760 END: 35, 16761 HOME: 36, 16762 LEFT: 37, 16763 UP: 38, 16764 RIGHT: 39, 16765 DOWN: 40, 16766 DELETE: 46 16767 }; 16768 16769 return KEYS; 16770}); 16771 16772S2.define('select2/selection/base',[ 16773 'jquery', 16774 '../utils', 16775 '../keys' 16776], function ($, Utils, KEYS) { 16777 function BaseSelection ($element, options) { 16778 this.$element = $element; 16779 this.options = options; 16780 16781 BaseSelection.__super__.constructor.call(this); 16782 } 16783 16784 Utils.Extend(BaseSelection, Utils.Observable); 16785 16786 BaseSelection.prototype.render = function () { 16787 var $selection = $( 16788 '<span class="select2-selection" role="combobox" ' + 16789 ' aria-haspopup="true" aria-expanded="false">' + 16790 '</span>' 16791 ); 16792 16793 this._tabindex = 0; 16794 16795 if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { 16796 this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); 16797 } else if (this.$element.attr('tabindex') != null) { 16798 this._tabindex = this.$element.attr('tabindex'); 16799 } 16800 16801 $selection.attr('title', this.$element.attr('title')); 16802 $selection.attr('tabindex', this._tabindex); 16803 $selection.attr('aria-disabled', 'false'); 16804 16805 this.$selection = $selection; 16806 16807 return $selection; 16808 }; 16809 16810 BaseSelection.prototype.bind = function (container, $container) { 16811 var self = this; 16812 16813 var resultsId = container.id + '-results'; 16814 16815 this.container = container; 16816 16817 this.$selection.on('focus', function (evt) { 16818 self.trigger('focus', evt); 16819 }); 16820 16821 this.$selection.on('blur', function (evt) { 16822 self._handleBlur(evt); 16823 }); 16824 16825 this.$selection.on('keydown', function (evt) { 16826 self.trigger('keypress', evt); 16827 16828 if (evt.which === KEYS.SPACE) { 16829 evt.preventDefault(); 16830 } 16831 }); 16832 16833 container.on('results:focus', function (params) { 16834 self.$selection.attr('aria-activedescendant', params.data._resultId); 16835 }); 16836 16837 container.on('selection:update', function (params) { 16838 self.update(params.data); 16839 }); 16840 16841 container.on('open', function () { 16842 // When the dropdown is open, aria-expanded="true" 16843 self.$selection.attr('aria-expanded', 'true'); 16844 self.$selection.attr('aria-owns', resultsId); 16845 16846 self._attachCloseHandler(container); 16847 }); 16848 16849 container.on('close', function () { 16850 // When the dropdown is closed, aria-expanded="false" 16851 self.$selection.attr('aria-expanded', 'false'); 16852 self.$selection.removeAttr('aria-activedescendant'); 16853 self.$selection.removeAttr('aria-owns'); 16854 16855 self.$selection.trigger('focus'); 16856 16857 self._detachCloseHandler(container); 16858 }); 16859 16860 container.on('enable', function () { 16861 self.$selection.attr('tabindex', self._tabindex); 16862 self.$selection.attr('aria-disabled', 'false'); 16863 }); 16864 16865 container.on('disable', function () { 16866 self.$selection.attr('tabindex', '-1'); 16867 self.$selection.attr('aria-disabled', 'true'); 16868 }); 16869 }; 16870 16871 BaseSelection.prototype._handleBlur = function (evt) { 16872 var self = this; 16873 16874 // This needs to be delayed as the active element is the body when the tab 16875 // key is pressed, possibly along with others. 16876 window.setTimeout(function () { 16877 // Don't trigger `blur` if the focus is still in the selection 16878 if ( 16879 (document.activeElement == self.$selection[0]) || 16880 ($.contains(self.$selection[0], document.activeElement)) 16881 ) { 16882 return; 16883 } 16884 16885 self.trigger('blur', evt); 16886 }, 1); 16887 }; 16888 16889 BaseSelection.prototype._attachCloseHandler = function (container) { 16890 16891 $(document.body).on('mousedown.select2.' + container.id, function (e) { 16892 var $target = $(e.target); 16893 16894 var $select = $target.closest('.select2'); 16895 16896 var $all = $('.select2.select2-container--open'); 16897 16898 $all.each(function () { 16899 if (this == $select[0]) { 16900 return; 16901 } 16902 16903 var $element = Utils.GetData(this, 'element'); 16904 16905 $element.select2('close'); 16906 }); 16907 }); 16908 }; 16909 16910 BaseSelection.prototype._detachCloseHandler = function (container) { 16911 $(document.body).off('mousedown.select2.' + container.id); 16912 }; 16913 16914 BaseSelection.prototype.position = function ($selection, $container) { 16915 var $selectionContainer = $container.find('.selection'); 16916 $selectionContainer.append($selection); 16917 }; 16918 16919 BaseSelection.prototype.destroy = function () { 16920 this._detachCloseHandler(this.container); 16921 }; 16922 16923 BaseSelection.prototype.update = function (data) { 16924 throw new Error('The `update` method must be defined in child classes.'); 16925 }; 16926 16927 /** 16928 * Helper method to abstract the "enabled" (not "disabled") state of this 16929 * object. 16930 * 16931 * @return {true} if the instance is not disabled. 16932 * @return {false} if the instance is disabled. 16933 */ 16934 BaseSelection.prototype.isEnabled = function () { 16935 return !this.isDisabled(); 16936 }; 16937 16938 /** 16939 * Helper method to abstract the "disabled" state of this object. 16940 * 16941 * @return {true} if the disabled option is true. 16942 * @return {false} if the disabled option is false. 16943 */ 16944 BaseSelection.prototype.isDisabled = function () { 16945 return this.options.get('disabled'); 16946 }; 16947 16948 return BaseSelection; 16949}); 16950 16951S2.define('select2/selection/single',[ 16952 'jquery', 16953 './base', 16954 '../utils', 16955 '../keys' 16956], function ($, BaseSelection, Utils, KEYS) { 16957 function SingleSelection () { 16958 SingleSelection.__super__.constructor.apply(this, arguments); 16959 } 16960 16961 Utils.Extend(SingleSelection, BaseSelection); 16962 16963 SingleSelection.prototype.render = function () { 16964 var $selection = SingleSelection.__super__.render.call(this); 16965 16966 $selection.addClass('select2-selection--single'); 16967 16968 $selection.html( 16969 '<span class="select2-selection__rendered"></span>' + 16970 '<span class="select2-selection__arrow" role="presentation">' + 16971 '<b role="presentation"></b>' + 16972 '</span>' 16973 ); 16974 16975 return $selection; 16976 }; 16977 16978 SingleSelection.prototype.bind = function (container, $container) { 16979 var self = this; 16980 16981 SingleSelection.__super__.bind.apply(this, arguments); 16982 16983 var id = container.id + '-container'; 16984 16985 this.$selection.find('.select2-selection__rendered') 16986 .attr('id', id) 16987 .attr('role', 'textbox') 16988 .attr('aria-readonly', 'true'); 16989 this.$selection.attr('aria-labelledby', id); 16990 16991 this.$selection.on('mousedown', function (evt) { 16992 // Only respond to left clicks 16993 if (evt.which !== 1) { 16994 return; 16995 } 16996 16997 self.trigger('toggle', { 16998 originalEvent: evt 16999 }); 17000 }); 17001 17002 this.$selection.on('focus', function (evt) { 17003 // User focuses on the container 17004 }); 17005 17006 this.$selection.on('blur', function (evt) { 17007 // User exits the container 17008 }); 17009 17010 container.on('focus', function (evt) { 17011 if (!container.isOpen()) { 17012 self.$selection.trigger('focus'); 17013 } 17014 }); 17015 }; 17016 17017 SingleSelection.prototype.clear = function () { 17018 var $rendered = this.$selection.find('.select2-selection__rendered'); 17019 $rendered.empty(); 17020 $rendered.removeAttr('title'); // clear tooltip on empty 17021 }; 17022 17023 SingleSelection.prototype.display = function (data, container) { 17024 var template = this.options.get('templateSelection'); 17025 var escapeMarkup = this.options.get('escapeMarkup'); 17026 17027 return escapeMarkup(template(data, container)); 17028 }; 17029 17030 SingleSelection.prototype.selectionContainer = function () { 17031 return $('<span></span>'); 17032 }; 17033 17034 SingleSelection.prototype.update = function (data) { 17035 if (data.length === 0) { 17036 this.clear(); 17037 return; 17038 } 17039 17040 var selection = data[0]; 17041 17042 var $rendered = this.$selection.find('.select2-selection__rendered'); 17043 var formatted = this.display(selection, $rendered); 17044 17045 $rendered.empty().append(formatted); 17046 17047 var title = selection.title || selection.text; 17048 17049 if (title) { 17050 $rendered.attr('title', title); 17051 } else { 17052 $rendered.removeAttr('title'); 17053 } 17054 }; 17055 17056 return SingleSelection; 17057}); 17058 17059S2.define('select2/selection/multiple',[ 17060 'jquery', 17061 './base', 17062 '../utils' 17063], function ($, BaseSelection, Utils) { 17064 function MultipleSelection ($element, options) { 17065 MultipleSelection.__super__.constructor.apply(this, arguments); 17066 } 17067 17068 Utils.Extend(MultipleSelection, BaseSelection); 17069 17070 MultipleSelection.prototype.render = function () { 17071 var $selection = MultipleSelection.__super__.render.call(this); 17072 17073 $selection.addClass('select2-selection--multiple'); 17074 17075 $selection.html( 17076 '<ul class="select2-selection__rendered"></ul>' 17077 ); 17078 17079 return $selection; 17080 }; 17081 17082 MultipleSelection.prototype.bind = function (container, $container) { 17083 var self = this; 17084 17085 MultipleSelection.__super__.bind.apply(this, arguments); 17086 17087 this.$selection.on('click', function (evt) { 17088 self.trigger('toggle', { 17089 originalEvent: evt 17090 }); 17091 }); 17092 17093 this.$selection.on( 17094 'click', 17095 '.select2-selection__choice__remove', 17096 function (evt) { 17097 // Ignore the event if it is disabled 17098 if (self.isDisabled()) { 17099 return; 17100 } 17101 17102 var $remove = $(this); 17103 var $selection = $remove.parent(); 17104 17105 var data = Utils.GetData($selection[0], 'data'); 17106 17107 self.trigger('unselect', { 17108 originalEvent: evt, 17109 data: data 17110 }); 17111 } 17112 ); 17113 }; 17114 17115 MultipleSelection.prototype.clear = function () { 17116 var $rendered = this.$selection.find('.select2-selection__rendered'); 17117 $rendered.empty(); 17118 $rendered.removeAttr('title'); 17119 }; 17120 17121 MultipleSelection.prototype.display = function (data, container) { 17122 var template = this.options.get('templateSelection'); 17123 var escapeMarkup = this.options.get('escapeMarkup'); 17124 17125 return escapeMarkup(template(data, container)); 17126 }; 17127 17128 MultipleSelection.prototype.selectionContainer = function () { 17129 var $container = $( 17130 '<li class="select2-selection__choice">' + 17131 '<span class="select2-selection__choice__remove" role="presentation">' + 17132 '×' + 17133 '</span>' + 17134 '</li>' 17135 ); 17136 17137 return $container; 17138 }; 17139 17140 MultipleSelection.prototype.update = function (data) { 17141 this.clear(); 17142 17143 if (data.length === 0) { 17144 return; 17145 } 17146 17147 var $selections = []; 17148 17149 for (var d = 0; d < data.length; d++) { 17150 var selection = data[d]; 17151 17152 var $selection = this.selectionContainer(); 17153 var formatted = this.display(selection, $selection); 17154 17155 $selection.append(formatted); 17156 17157 var title = selection.title || selection.text; 17158 17159 if (title) { 17160 $selection.attr('title', title); 17161 } 17162 17163 Utils.StoreData($selection[0], 'data', selection); 17164 17165 $selections.push($selection); 17166 } 17167 17168 var $rendered = this.$selection.find('.select2-selection__rendered'); 17169 17170 Utils.appendMany($rendered, $selections); 17171 }; 17172 17173 return MultipleSelection; 17174}); 17175 17176S2.define('select2/selection/placeholder',[ 17177 '../utils' 17178], function (Utils) { 17179 function Placeholder (decorated, $element, options) { 17180 this.placeholder = this.normalizePlaceholder(options.get('placeholder')); 17181 17182 decorated.call(this, $element, options); 17183 } 17184 17185 Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { 17186 if (typeof placeholder === 'string') { 17187 placeholder = { 17188 id: '', 17189 text: placeholder 17190 }; 17191 } 17192 17193 return placeholder; 17194 }; 17195 17196 Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { 17197 var $placeholder = this.selectionContainer(); 17198 17199 $placeholder.html(this.display(placeholder)); 17200 $placeholder.addClass('select2-selection__placeholder') 17201 .removeClass('select2-selection__choice'); 17202 17203 return $placeholder; 17204 }; 17205 17206 Placeholder.prototype.update = function (decorated, data) { 17207 var singlePlaceholder = ( 17208 data.length == 1 && data[0].id != this.placeholder.id 17209 ); 17210 var multipleSelections = data.length > 1; 17211 17212 if (multipleSelections || singlePlaceholder) { 17213 return decorated.call(this, data); 17214 } 17215 17216 this.clear(); 17217 17218 var $placeholder = this.createPlaceholder(this.placeholder); 17219 17220 this.$selection.find('.select2-selection__rendered').append($placeholder); 17221 }; 17222 17223 return Placeholder; 17224}); 17225 17226S2.define('select2/selection/allowClear',[ 17227 'jquery', 17228 '../keys', 17229 '../utils' 17230], function ($, KEYS, Utils) { 17231 function AllowClear () { } 17232 17233 AllowClear.prototype.bind = function (decorated, container, $container) { 17234 var self = this; 17235 17236 decorated.call(this, container, $container); 17237 17238 if (this.placeholder == null) { 17239 if (this.options.get('debug') && window.console && console.error) { 17240 console.error( 17241 'Select2: The `allowClear` option should be used in combination ' + 17242 'with the `placeholder` option.' 17243 ); 17244 } 17245 } 17246 17247 this.$selection.on('mousedown', '.select2-selection__clear', 17248 function (evt) { 17249 self._handleClear(evt); 17250 }); 17251 17252 container.on('keypress', function (evt) { 17253 self._handleKeyboardClear(evt, container); 17254 }); 17255 }; 17256 17257 AllowClear.prototype._handleClear = function (_, evt) { 17258 // Ignore the event if it is disabled 17259 if (this.isDisabled()) { 17260 return; 17261 } 17262 17263 var $clear = this.$selection.find('.select2-selection__clear'); 17264 17265 // Ignore the event if nothing has been selected 17266 if ($clear.length === 0) { 17267 return; 17268 } 17269 17270 evt.stopPropagation(); 17271 17272 var data = Utils.GetData($clear[0], 'data'); 17273 17274 var previousVal = this.$element.val(); 17275 this.$element.val(this.placeholder.id); 17276 17277 var unselectData = { 17278 data: data 17279 }; 17280 this.trigger('clear', unselectData); 17281 if (unselectData.prevented) { 17282 this.$element.val(previousVal); 17283 return; 17284 } 17285 17286 for (var d = 0; d < data.length; d++) { 17287 unselectData = { 17288 data: data[d] 17289 }; 17290 17291 // Trigger the `unselect` event, so people can prevent it from being 17292 // cleared. 17293 this.trigger('unselect', unselectData); 17294 17295 // If the event was prevented, don't clear it out. 17296 if (unselectData.prevented) { 17297 this.$element.val(previousVal); 17298 return; 17299 } 17300 } 17301 17302 this.$element.trigger('input').trigger('change'); 17303 17304 this.trigger('toggle', {}); 17305 }; 17306 17307 AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { 17308 if (container.isOpen()) { 17309 return; 17310 } 17311 17312 if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { 17313 this._handleClear(evt); 17314 } 17315 }; 17316 17317 AllowClear.prototype.update = function (decorated, data) { 17318 decorated.call(this, data); 17319 17320 if (this.$selection.find('.select2-selection__placeholder').length > 0 || 17321 data.length === 0) { 17322 return; 17323 } 17324 17325 var removeAll = this.options.get('translations').get('removeAllItems'); 17326 17327 var $remove = $( 17328 '<span class="select2-selection__clear" title="' + removeAll() +'">' + 17329 '×' + 17330 '</span>' 17331 ); 17332 Utils.StoreData($remove[0], 'data', data); 17333 17334 this.$selection.find('.select2-selection__rendered').prepend($remove); 17335 }; 17336 17337 return AllowClear; 17338}); 17339 17340S2.define('select2/selection/search',[ 17341 'jquery', 17342 '../utils', 17343 '../keys' 17344], function ($, Utils, KEYS) { 17345 function Search (decorated, $element, options) { 17346 decorated.call(this, $element, options); 17347 } 17348 17349 Search.prototype.render = function (decorated) { 17350 var $search = $( 17351 '<li class="select2-search select2-search--inline">' + 17352 '<input class="select2-search__field" type="search" tabindex="-1"' + 17353 ' autocomplete="off" autocorrect="off" autocapitalize="none"' + 17354 ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + 17355 '</li>' 17356 ); 17357 17358 this.$searchContainer = $search; 17359 this.$search = $search.find('input'); 17360 17361 var $rendered = decorated.call(this); 17362 17363 this._transferTabIndex(); 17364 17365 return $rendered; 17366 }; 17367 17368 Search.prototype.bind = function (decorated, container, $container) { 17369 var self = this; 17370 17371 var resultsId = container.id + '-results'; 17372 17373 decorated.call(this, container, $container); 17374 17375 container.on('open', function () { 17376 self.$search.attr('aria-controls', resultsId); 17377 self.$search.trigger('focus'); 17378 }); 17379 17380 container.on('close', function () { 17381 self.$search.val(''); 17382 self.$search.removeAttr('aria-controls'); 17383 self.$search.removeAttr('aria-activedescendant'); 17384 self.$search.trigger('focus'); 17385 }); 17386 17387 container.on('enable', function () { 17388 self.$search.prop('disabled', false); 17389 17390 self._transferTabIndex(); 17391 }); 17392 17393 container.on('disable', function () { 17394 self.$search.prop('disabled', true); 17395 }); 17396 17397 container.on('focus', function (evt) { 17398 self.$search.trigger('focus'); 17399 }); 17400 17401 container.on('results:focus', function (params) { 17402 if (params.data._resultId) { 17403 self.$search.attr('aria-activedescendant', params.data._resultId); 17404 } else { 17405 self.$search.removeAttr('aria-activedescendant'); 17406 } 17407 }); 17408 17409 this.$selection.on('focusin', '.select2-search--inline', function (evt) { 17410 self.trigger('focus', evt); 17411 }); 17412 17413 this.$selection.on('focusout', '.select2-search--inline', function (evt) { 17414 self._handleBlur(evt); 17415 }); 17416 17417 this.$selection.on('keydown', '.select2-search--inline', function (evt) { 17418 evt.stopPropagation(); 17419 17420 self.trigger('keypress', evt); 17421 17422 self._keyUpPrevented = evt.isDefaultPrevented(); 17423 17424 var key = evt.which; 17425 17426 if (key === KEYS.BACKSPACE && self.$search.val() === '') { 17427 var $previousChoice = self.$searchContainer 17428 .prev('.select2-selection__choice'); 17429 17430 if ($previousChoice.length > 0) { 17431 var item = Utils.GetData($previousChoice[0], 'data'); 17432 17433 self.searchRemoveChoice(item); 17434 17435 evt.preventDefault(); 17436 } 17437 } 17438 }); 17439 17440 this.$selection.on('click', '.select2-search--inline', function (evt) { 17441 if (self.$search.val()) { 17442 evt.stopPropagation(); 17443 } 17444 }); 17445 17446 // Try to detect the IE version should the `documentMode` property that 17447 // is stored on the document. This is only implemented in IE and is 17448 // slightly cleaner than doing a user agent check. 17449 // This property is not available in Edge, but Edge also doesn't have 17450 // this bug. 17451 var msie = document.documentMode; 17452 var disableInputEvents = msie && msie <= 11; 17453 17454 // Workaround for browsers which do not support the `input` event 17455 // This will prevent double-triggering of events for browsers which support 17456 // both the `keyup` and `input` events. 17457 this.$selection.on( 17458 'input.searchcheck', 17459 '.select2-search--inline', 17460 function (evt) { 17461 // IE will trigger the `input` event when a placeholder is used on a 17462 // search box. To get around this issue, we are forced to ignore all 17463 // `input` events in IE and keep using `keyup`. 17464 if (disableInputEvents) { 17465 self.$selection.off('input.search input.searchcheck'); 17466 return; 17467 } 17468 17469 // Unbind the duplicated `keyup` event 17470 self.$selection.off('keyup.search'); 17471 } 17472 ); 17473 17474 this.$selection.on( 17475 'keyup.search input.search', 17476 '.select2-search--inline', 17477 function (evt) { 17478 // IE will trigger the `input` event when a placeholder is used on a 17479 // search box. To get around this issue, we are forced to ignore all 17480 // `input` events in IE and keep using `keyup`. 17481 if (disableInputEvents && evt.type === 'input') { 17482 self.$selection.off('input.search input.searchcheck'); 17483 return; 17484 } 17485 17486 var key = evt.which; 17487 17488 // We can freely ignore events from modifier keys 17489 if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { 17490 return; 17491 } 17492 17493 // Tabbing will be handled during the `keydown` phase 17494 if (key == KEYS.TAB) { 17495 return; 17496 } 17497 17498 self.handleSearch(evt); 17499 } 17500 ); 17501 }; 17502 17503 /** 17504 * This method will transfer the tabindex attribute from the rendered 17505 * selection to the search box. This allows for the search box to be used as 17506 * the primary focus instead of the selection container. 17507 * 17508 * @private 17509 */ 17510 Search.prototype._transferTabIndex = function (decorated) { 17511 this.$search.attr('tabindex', this.$selection.attr('tabindex')); 17512 this.$selection.attr('tabindex', '-1'); 17513 }; 17514 17515 Search.prototype.createPlaceholder = function (decorated, placeholder) { 17516 this.$search.attr('placeholder', placeholder.text); 17517 }; 17518 17519 Search.prototype.update = function (decorated, data) { 17520 var searchHadFocus = this.$search[0] == document.activeElement; 17521 17522 this.$search.attr('placeholder', ''); 17523 17524 decorated.call(this, data); 17525 17526 this.$selection.find('.select2-selection__rendered') 17527 .append(this.$searchContainer); 17528 17529 this.resizeSearch(); 17530 if (searchHadFocus) { 17531 this.$search.trigger('focus'); 17532 } 17533 }; 17534 17535 Search.prototype.handleSearch = function () { 17536 this.resizeSearch(); 17537 17538 if (!this._keyUpPrevented) { 17539 var input = this.$search.val(); 17540 17541 this.trigger('query', { 17542 term: input 17543 }); 17544 } 17545 17546 this._keyUpPrevented = false; 17547 }; 17548 17549 Search.prototype.searchRemoveChoice = function (decorated, item) { 17550 this.trigger('unselect', { 17551 data: item 17552 }); 17553 17554 this.$search.val(item.text); 17555 this.handleSearch(); 17556 }; 17557 17558 Search.prototype.resizeSearch = function () { 17559 this.$search.css('width', '25px'); 17560 17561 var width = ''; 17562 17563 if (this.$search.attr('placeholder') !== '') { 17564 width = this.$selection.find('.select2-selection__rendered').width(); 17565 } else { 17566 var minimumWidth = this.$search.val().length + 1; 17567 17568 width = (minimumWidth * 0.75) + 'em'; 17569 } 17570 17571 this.$search.css('width', width); 17572 }; 17573 17574 return Search; 17575}); 17576 17577S2.define('select2/selection/eventRelay',[ 17578 'jquery' 17579], function ($) { 17580 function EventRelay () { } 17581 17582 EventRelay.prototype.bind = function (decorated, container, $container) { 17583 var self = this; 17584 var relayEvents = [ 17585 'open', 'opening', 17586 'close', 'closing', 17587 'select', 'selecting', 17588 'unselect', 'unselecting', 17589 'clear', 'clearing' 17590 ]; 17591 17592 var preventableEvents = [ 17593 'opening', 'closing', 'selecting', 'unselecting', 'clearing' 17594 ]; 17595 17596 decorated.call(this, container, $container); 17597 17598 container.on('*', function (name, params) { 17599 // Ignore events that should not be relayed 17600 if ($.inArray(name, relayEvents) === -1) { 17601 return; 17602 } 17603 17604 // The parameters should always be an object 17605 params = params || {}; 17606 17607 // Generate the jQuery event for the Select2 event 17608 var evt = $.Event('select2:' + name, { 17609 params: params 17610 }); 17611 17612 self.$element.trigger(evt); 17613 17614 // Only handle preventable events if it was one 17615 if ($.inArray(name, preventableEvents) === -1) { 17616 return; 17617 } 17618 17619 params.prevented = evt.isDefaultPrevented(); 17620 }); 17621 }; 17622 17623 return EventRelay; 17624}); 17625 17626S2.define('select2/translation',[ 17627 'jquery', 17628 'require' 17629], function ($, require) { 17630 function Translation (dict) { 17631 this.dict = dict || {}; 17632 } 17633 17634 Translation.prototype.all = function () { 17635 return this.dict; 17636 }; 17637 17638 Translation.prototype.get = function (key) { 17639 return this.dict[key]; 17640 }; 17641 17642 Translation.prototype.extend = function (translation) { 17643 this.dict = $.extend({}, translation.all(), this.dict); 17644 }; 17645 17646 // Static functions 17647 17648 Translation._cache = {}; 17649 17650 Translation.loadPath = function (path) { 17651 if (!(path in Translation._cache)) { 17652 var translations = require(path); 17653 17654 Translation._cache[path] = translations; 17655 } 17656 17657 return new Translation(Translation._cache[path]); 17658 }; 17659 17660 return Translation; 17661}); 17662 17663S2.define('select2/diacritics',[ 17664 17665], function () { 17666 var diacritics = { 17667 '\u24B6': 'A', 17668 '\uFF21': 'A', 17669 '\u00C0': 'A', 17670 '\u00C1': 'A', 17671 '\u00C2': 'A', 17672 '\u1EA6': 'A', 17673 '\u1EA4': 'A', 17674 '\u1EAA': 'A', 17675 '\u1EA8': 'A', 17676 '\u00C3': 'A', 17677 '\u0100': 'A', 17678 '\u0102': 'A', 17679 '\u1EB0': 'A', 17680 '\u1EAE': 'A', 17681 '\u1EB4': 'A', 17682 '\u1EB2': 'A', 17683 '\u0226': 'A', 17684 '\u01E0': 'A', 17685 '\u00C4': 'A', 17686 '\u01DE': 'A', 17687 '\u1EA2': 'A', 17688 '\u00C5': 'A', 17689 '\u01FA': 'A', 17690 '\u01CD': 'A', 17691 '\u0200': 'A', 17692 '\u0202': 'A', 17693 '\u1EA0': 'A', 17694 '\u1EAC': 'A', 17695 '\u1EB6': 'A', 17696 '\u1E00': 'A', 17697 '\u0104': 'A', 17698 '\u023A': 'A', 17699 '\u2C6F': 'A', 17700 '\uA732': 'AA', 17701 '\u00C6': 'AE', 17702 '\u01FC': 'AE', 17703 '\u01E2': 'AE', 17704 '\uA734': 'AO', 17705 '\uA736': 'AU', 17706 '\uA738': 'AV', 17707 '\uA73A': 'AV', 17708 '\uA73C': 'AY', 17709 '\u24B7': 'B', 17710 '\uFF22': 'B', 17711 '\u1E02': 'B', 17712 '\u1E04': 'B', 17713 '\u1E06': 'B', 17714 '\u0243': 'B', 17715 '\u0182': 'B', 17716 '\u0181': 'B', 17717 '\u24B8': 'C', 17718 '\uFF23': 'C', 17719 '\u0106': 'C', 17720 '\u0108': 'C', 17721 '\u010A': 'C', 17722 '\u010C': 'C', 17723 '\u00C7': 'C', 17724 '\u1E08': 'C', 17725 '\u0187': 'C', 17726 '\u023B': 'C', 17727 '\uA73E': 'C', 17728 '\u24B9': 'D', 17729 '\uFF24': 'D', 17730 '\u1E0A': 'D', 17731 '\u010E': 'D', 17732 '\u1E0C': 'D', 17733 '\u1E10': 'D', 17734 '\u1E12': 'D', 17735 '\u1E0E': 'D', 17736 '\u0110': 'D', 17737 '\u018B': 'D', 17738 '\u018A': 'D', 17739 '\u0189': 'D', 17740 '\uA779': 'D', 17741 '\u01F1': 'DZ', 17742 '\u01C4': 'DZ', 17743 '\u01F2': 'Dz', 17744 '\u01C5': 'Dz', 17745 '\u24BA': 'E', 17746 '\uFF25': 'E', 17747 '\u00C8': 'E', 17748 '\u00C9': 'E', 17749 '\u00CA': 'E', 17750 '\u1EC0': 'E', 17751 '\u1EBE': 'E', 17752 '\u1EC4': 'E', 17753 '\u1EC2': 'E', 17754 '\u1EBC': 'E', 17755 '\u0112': 'E', 17756 '\u1E14': 'E', 17757 '\u1E16': 'E', 17758 '\u0114': 'E', 17759 '\u0116': 'E', 17760 '\u00CB': 'E', 17761 '\u1EBA': 'E', 17762 '\u011A': 'E', 17763 '\u0204': 'E', 17764 '\u0206': 'E', 17765 '\u1EB8': 'E', 17766 '\u1EC6': 'E', 17767 '\u0228': 'E', 17768 '\u1E1C': 'E', 17769 '\u0118': 'E', 17770 '\u1E18': 'E', 17771 '\u1E1A': 'E', 17772 '\u0190': 'E', 17773 '\u018E': 'E', 17774 '\u24BB': 'F', 17775 '\uFF26': 'F', 17776 '\u1E1E': 'F', 17777 '\u0191': 'F', 17778 '\uA77B': 'F', 17779 '\u24BC': 'G', 17780 '\uFF27': 'G', 17781 '\u01F4': 'G', 17782 '\u011C': 'G', 17783 '\u1E20': 'G', 17784 '\u011E': 'G', 17785 '\u0120': 'G', 17786 '\u01E6': 'G', 17787 '\u0122': 'G', 17788 '\u01E4': 'G', 17789 '\u0193': 'G', 17790 '\uA7A0': 'G', 17791 '\uA77D': 'G', 17792 '\uA77E': 'G', 17793 '\u24BD': 'H', 17794 '\uFF28': 'H', 17795 '\u0124': 'H', 17796 '\u1E22': 'H', 17797 '\u1E26': 'H', 17798 '\u021E': 'H', 17799 '\u1E24': 'H', 17800 '\u1E28': 'H', 17801 '\u1E2A': 'H', 17802 '\u0126': 'H', 17803 '\u2C67': 'H', 17804 '\u2C75': 'H', 17805 '\uA78D': 'H', 17806 '\u24BE': 'I', 17807 '\uFF29': 'I', 17808 '\u00CC': 'I', 17809 '\u00CD': 'I', 17810 '\u00CE': 'I', 17811 '\u0128': 'I', 17812 '\u012A': 'I', 17813 '\u012C': 'I', 17814 '\u0130': 'I', 17815 '\u00CF': 'I', 17816 '\u1E2E': 'I', 17817 '\u1EC8': 'I', 17818 '\u01CF': 'I', 17819 '\u0208': 'I', 17820 '\u020A': 'I', 17821 '\u1ECA': 'I', 17822 '\u012E': 'I', 17823 '\u1E2C': 'I', 17824 '\u0197': 'I', 17825 '\u24BF': 'J', 17826 '\uFF2A': 'J', 17827 '\u0134': 'J', 17828 '\u0248': 'J', 17829 '\u24C0': 'K', 17830 '\uFF2B': 'K', 17831 '\u1E30': 'K', 17832 '\u01E8': 'K', 17833 '\u1E32': 'K', 17834 '\u0136': 'K', 17835 '\u1E34': 'K', 17836 '\u0198': 'K', 17837 '\u2C69': 'K', 17838 '\uA740': 'K', 17839 '\uA742': 'K', 17840 '\uA744': 'K', 17841 '\uA7A2': 'K', 17842 '\u24C1': 'L', 17843 '\uFF2C': 'L', 17844 '\u013F': 'L', 17845 '\u0139': 'L', 17846 '\u013D': 'L', 17847 '\u1E36': 'L', 17848 '\u1E38': 'L', 17849 '\u013B': 'L', 17850 '\u1E3C': 'L', 17851 '\u1E3A': 'L', 17852 '\u0141': 'L', 17853 '\u023D': 'L', 17854 '\u2C62': 'L', 17855 '\u2C60': 'L', 17856 '\uA748': 'L', 17857 '\uA746': 'L', 17858 '\uA780': 'L', 17859 '\u01C7': 'LJ', 17860 '\u01C8': 'Lj', 17861 '\u24C2': 'M', 17862 '\uFF2D': 'M', 17863 '\u1E3E': 'M', 17864 '\u1E40': 'M', 17865 '\u1E42': 'M', 17866 '\u2C6E': 'M', 17867 '\u019C': 'M', 17868 '\u24C3': 'N', 17869 '\uFF2E': 'N', 17870 '\u01F8': 'N', 17871 '\u0143': 'N', 17872 '\u00D1': 'N', 17873 '\u1E44': 'N', 17874 '\u0147': 'N', 17875 '\u1E46': 'N', 17876 '\u0145': 'N', 17877 '\u1E4A': 'N', 17878 '\u1E48': 'N', 17879 '\u0220': 'N', 17880 '\u019D': 'N', 17881 '\uA790': 'N', 17882 '\uA7A4': 'N', 17883 '\u01CA': 'NJ', 17884 '\u01CB': 'Nj', 17885 '\u24C4': 'O', 17886 '\uFF2F': 'O', 17887 '\u00D2': 'O', 17888 '\u00D3': 'O', 17889 '\u00D4': 'O', 17890 '\u1ED2': 'O', 17891 '\u1ED0': 'O', 17892 '\u1ED6': 'O', 17893 '\u1ED4': 'O', 17894 '\u00D5': 'O', 17895 '\u1E4C': 'O', 17896 '\u022C': 'O', 17897 '\u1E4E': 'O', 17898 '\u014C': 'O', 17899 '\u1E50': 'O', 17900 '\u1E52': 'O', 17901 '\u014E': 'O', 17902 '\u022E': 'O', 17903 '\u0230': 'O', 17904 '\u00D6': 'O', 17905 '\u022A': 'O', 17906 '\u1ECE': 'O', 17907 '\u0150': 'O', 17908 '\u01D1': 'O', 17909 '\u020C': 'O', 17910 '\u020E': 'O', 17911 '\u01A0': 'O', 17912 '\u1EDC': 'O', 17913 '\u1EDA': 'O', 17914 '\u1EE0': 'O', 17915 '\u1EDE': 'O', 17916 '\u1EE2': 'O', 17917 '\u1ECC': 'O', 17918 '\u1ED8': 'O', 17919 '\u01EA': 'O', 17920 '\u01EC': 'O', 17921 '\u00D8': 'O', 17922 '\u01FE': 'O', 17923 '\u0186': 'O', 17924 '\u019F': 'O', 17925 '\uA74A': 'O', 17926 '\uA74C': 'O', 17927 '\u0152': 'OE', 17928 '\u01A2': 'OI', 17929 '\uA74E': 'OO', 17930 '\u0222': 'OU', 17931 '\u24C5': 'P', 17932 '\uFF30': 'P', 17933 '\u1E54': 'P', 17934 '\u1E56': 'P', 17935 '\u01A4': 'P', 17936 '\u2C63': 'P', 17937 '\uA750': 'P', 17938 '\uA752': 'P', 17939 '\uA754': 'P', 17940 '\u24C6': 'Q', 17941 '\uFF31': 'Q', 17942 '\uA756': 'Q', 17943 '\uA758': 'Q', 17944 '\u024A': 'Q', 17945 '\u24C7': 'R', 17946 '\uFF32': 'R', 17947 '\u0154': 'R', 17948 '\u1E58': 'R', 17949 '\u0158': 'R', 17950 '\u0210': 'R', 17951 '\u0212': 'R', 17952 '\u1E5A': 'R', 17953 '\u1E5C': 'R', 17954 '\u0156': 'R', 17955 '\u1E5E': 'R', 17956 '\u024C': 'R', 17957 '\u2C64': 'R', 17958 '\uA75A': 'R', 17959 '\uA7A6': 'R', 17960 '\uA782': 'R', 17961 '\u24C8': 'S', 17962 '\uFF33': 'S', 17963 '\u1E9E': 'S', 17964 '\u015A': 'S', 17965 '\u1E64': 'S', 17966 '\u015C': 'S', 17967 '\u1E60': 'S', 17968 '\u0160': 'S', 17969 '\u1E66': 'S', 17970 '\u1E62': 'S', 17971 '\u1E68': 'S', 17972 '\u0218': 'S', 17973 '\u015E': 'S', 17974 '\u2C7E': 'S', 17975 '\uA7A8': 'S', 17976 '\uA784': 'S', 17977 '\u24C9': 'T', 17978 '\uFF34': 'T', 17979 '\u1E6A': 'T', 17980 '\u0164': 'T', 17981 '\u1E6C': 'T', 17982 '\u021A': 'T', 17983 '\u0162': 'T', 17984 '\u1E70': 'T', 17985 '\u1E6E': 'T', 17986 '\u0166': 'T', 17987 '\u01AC': 'T', 17988 '\u01AE': 'T', 17989 '\u023E': 'T', 17990 '\uA786': 'T', 17991 '\uA728': 'TZ', 17992 '\u24CA': 'U', 17993 '\uFF35': 'U', 17994 '\u00D9': 'U', 17995 '\u00DA': 'U', 17996 '\u00DB': 'U', 17997 '\u0168': 'U', 17998 '\u1E78': 'U', 17999 '\u016A': 'U', 18000 '\u1E7A': 'U', 18001 '\u016C': 'U', 18002 '\u00DC': 'U', 18003 '\u01DB': 'U', 18004 '\u01D7': 'U', 18005 '\u01D5': 'U', 18006 '\u01D9': 'U', 18007 '\u1EE6': 'U', 18008 '\u016E': 'U', 18009 '\u0170': 'U', 18010 '\u01D3': 'U', 18011 '\u0214': 'U', 18012 '\u0216': 'U', 18013 '\u01AF': 'U', 18014 '\u1EEA': 'U', 18015 '\u1EE8': 'U', 18016 '\u1EEE': 'U', 18017 '\u1EEC': 'U', 18018 '\u1EF0': 'U', 18019 '\u1EE4': 'U', 18020 '\u1E72': 'U', 18021 '\u0172': 'U', 18022 '\u1E76': 'U', 18023 '\u1E74': 'U', 18024 '\u0244': 'U', 18025 '\u24CB': 'V', 18026 '\uFF36': 'V', 18027 '\u1E7C': 'V', 18028 '\u1E7E': 'V', 18029 '\u01B2': 'V', 18030 '\uA75E': 'V', 18031 '\u0245': 'V', 18032 '\uA760': 'VY', 18033 '\u24CC': 'W', 18034 '\uFF37': 'W', 18035 '\u1E80': 'W', 18036 '\u1E82': 'W', 18037 '\u0174': 'W', 18038 '\u1E86': 'W', 18039 '\u1E84': 'W', 18040 '\u1E88': 'W', 18041 '\u2C72': 'W', 18042 '\u24CD': 'X', 18043 '\uFF38': 'X', 18044 '\u1E8A': 'X', 18045 '\u1E8C': 'X', 18046 '\u24CE': 'Y', 18047 '\uFF39': 'Y', 18048 '\u1EF2': 'Y', 18049 '\u00DD': 'Y', 18050 '\u0176': 'Y', 18051 '\u1EF8': 'Y', 18052 '\u0232': 'Y', 18053 '\u1E8E': 'Y', 18054 '\u0178': 'Y', 18055 '\u1EF6': 'Y', 18056 '\u1EF4': 'Y', 18057 '\u01B3': 'Y', 18058 '\u024E': 'Y', 18059 '\u1EFE': 'Y', 18060 '\u24CF': 'Z', 18061 '\uFF3A': 'Z', 18062 '\u0179': 'Z', 18063 '\u1E90': 'Z', 18064 '\u017B': 'Z', 18065 '\u017D': 'Z', 18066 '\u1E92': 'Z', 18067 '\u1E94': 'Z', 18068 '\u01B5': 'Z', 18069 '\u0224': 'Z', 18070 '\u2C7F': 'Z', 18071 '\u2C6B': 'Z', 18072 '\uA762': 'Z', 18073 '\u24D0': 'a', 18074 '\uFF41': 'a', 18075 '\u1E9A': 'a', 18076 '\u00E0': 'a', 18077 '\u00E1': 'a', 18078 '\u00E2': 'a', 18079 '\u1EA7': 'a', 18080 '\u1EA5': 'a', 18081 '\u1EAB': 'a', 18082 '\u1EA9': 'a', 18083 '\u00E3': 'a', 18084 '\u0101': 'a', 18085 '\u0103': 'a', 18086 '\u1EB1': 'a', 18087 '\u1EAF': 'a', 18088 '\u1EB5': 'a', 18089 '\u1EB3': 'a', 18090 '\u0227': 'a', 18091 '\u01E1': 'a', 18092 '\u00E4': 'a', 18093 '\u01DF': 'a', 18094 '\u1EA3': 'a', 18095 '\u00E5': 'a', 18096 '\u01FB': 'a', 18097 '\u01CE': 'a', 18098 '\u0201': 'a', 18099 '\u0203': 'a', 18100 '\u1EA1': 'a', 18101 '\u1EAD': 'a', 18102 '\u1EB7': 'a', 18103 '\u1E01': 'a', 18104 '\u0105': 'a', 18105 '\u2C65': 'a', 18106 '\u0250': 'a', 18107 '\uA733': 'aa', 18108 '\u00E6': 'ae', 18109 '\u01FD': 'ae', 18110 '\u01E3': 'ae', 18111 '\uA735': 'ao', 18112 '\uA737': 'au', 18113 '\uA739': 'av', 18114 '\uA73B': 'av', 18115 '\uA73D': 'ay', 18116 '\u24D1': 'b', 18117 '\uFF42': 'b', 18118 '\u1E03': 'b', 18119 '\u1E05': 'b', 18120 '\u1E07': 'b', 18121 '\u0180': 'b', 18122 '\u0183': 'b', 18123 '\u0253': 'b', 18124 '\u24D2': 'c', 18125 '\uFF43': 'c', 18126 '\u0107': 'c', 18127 '\u0109': 'c', 18128 '\u010B': 'c', 18129 '\u010D': 'c', 18130 '\u00E7': 'c', 18131 '\u1E09': 'c', 18132 '\u0188': 'c', 18133 '\u023C': 'c', 18134 '\uA73F': 'c', 18135 '\u2184': 'c', 18136 '\u24D3': 'd', 18137 '\uFF44': 'd', 18138 '\u1E0B': 'd', 18139 '\u010F': 'd', 18140 '\u1E0D': 'd', 18141 '\u1E11': 'd', 18142 '\u1E13': 'd', 18143 '\u1E0F': 'd', 18144 '\u0111': 'd', 18145 '\u018C': 'd', 18146 '\u0256': 'd', 18147 '\u0257': 'd', 18148 '\uA77A': 'd', 18149 '\u01F3': 'dz', 18150 '\u01C6': 'dz', 18151 '\u24D4': 'e', 18152 '\uFF45': 'e', 18153 '\u00E8': 'e', 18154 '\u00E9': 'e', 18155 '\u00EA': 'e', 18156 '\u1EC1': 'e', 18157 '\u1EBF': 'e', 18158 '\u1EC5': 'e', 18159 '\u1EC3': 'e', 18160 '\u1EBD': 'e', 18161 '\u0113': 'e', 18162 '\u1E15': 'e', 18163 '\u1E17': 'e', 18164 '\u0115': 'e', 18165 '\u0117': 'e', 18166 '\u00EB': 'e', 18167 '\u1EBB': 'e', 18168 '\u011B': 'e', 18169 '\u0205': 'e', 18170 '\u0207': 'e', 18171 '\u1EB9': 'e', 18172 '\u1EC7': 'e', 18173 '\u0229': 'e', 18174 '\u1E1D': 'e', 18175 '\u0119': 'e', 18176 '\u1E19': 'e', 18177 '\u1E1B': 'e', 18178 '\u0247': 'e', 18179 '\u025B': 'e', 18180 '\u01DD': 'e', 18181 '\u24D5': 'f', 18182 '\uFF46': 'f', 18183 '\u1E1F': 'f', 18184 '\u0192': 'f', 18185 '\uA77C': 'f', 18186 '\u24D6': 'g', 18187 '\uFF47': 'g', 18188 '\u01F5': 'g', 18189 '\u011D': 'g', 18190 '\u1E21': 'g', 18191 '\u011F': 'g', 18192 '\u0121': 'g', 18193 '\u01E7': 'g', 18194 '\u0123': 'g', 18195 '\u01E5': 'g', 18196 '\u0260': 'g', 18197 '\uA7A1': 'g', 18198 '\u1D79': 'g', 18199 '\uA77F': 'g', 18200 '\u24D7': 'h', 18201 '\uFF48': 'h', 18202 '\u0125': 'h', 18203 '\u1E23': 'h', 18204 '\u1E27': 'h', 18205 '\u021F': 'h', 18206 '\u1E25': 'h', 18207 '\u1E29': 'h', 18208 '\u1E2B': 'h', 18209 '\u1E96': 'h', 18210 '\u0127': 'h', 18211 '\u2C68': 'h', 18212 '\u2C76': 'h', 18213 '\u0265': 'h', 18214 '\u0195': 'hv', 18215 '\u24D8': 'i', 18216 '\uFF49': 'i', 18217 '\u00EC': 'i', 18218 '\u00ED': 'i', 18219 '\u00EE': 'i', 18220 '\u0129': 'i', 18221 '\u012B': 'i', 18222 '\u012D': 'i', 18223 '\u00EF': 'i', 18224 '\u1E2F': 'i', 18225 '\u1EC9': 'i', 18226 '\u01D0': 'i', 18227 '\u0209': 'i', 18228 '\u020B': 'i', 18229 '\u1ECB': 'i', 18230 '\u012F': 'i', 18231 '\u1E2D': 'i', 18232 '\u0268': 'i', 18233 '\u0131': 'i', 18234 '\u24D9': 'j', 18235 '\uFF4A': 'j', 18236 '\u0135': 'j', 18237 '\u01F0': 'j', 18238 '\u0249': 'j', 18239 '\u24DA': 'k', 18240 '\uFF4B': 'k', 18241 '\u1E31': 'k', 18242 '\u01E9': 'k', 18243 '\u1E33': 'k', 18244 '\u0137': 'k', 18245 '\u1E35': 'k', 18246 '\u0199': 'k', 18247 '\u2C6A': 'k', 18248 '\uA741': 'k', 18249 '\uA743': 'k', 18250 '\uA745': 'k', 18251 '\uA7A3': 'k', 18252 '\u24DB': 'l', 18253 '\uFF4C': 'l', 18254 '\u0140': 'l', 18255 '\u013A': 'l', 18256 '\u013E': 'l', 18257 '\u1E37': 'l', 18258 '\u1E39': 'l', 18259 '\u013C': 'l', 18260 '\u1E3D': 'l', 18261 '\u1E3B': 'l', 18262 '\u017F': 'l', 18263 '\u0142': 'l', 18264 '\u019A': 'l', 18265 '\u026B': 'l', 18266 '\u2C61': 'l', 18267 '\uA749': 'l', 18268 '\uA781': 'l', 18269 '\uA747': 'l', 18270 '\u01C9': 'lj', 18271 '\u24DC': 'm', 18272 '\uFF4D': 'm', 18273 '\u1E3F': 'm', 18274 '\u1E41': 'm', 18275 '\u1E43': 'm', 18276 '\u0271': 'm', 18277 '\u026F': 'm', 18278 '\u24DD': 'n', 18279 '\uFF4E': 'n', 18280 '\u01F9': 'n', 18281 '\u0144': 'n', 18282 '\u00F1': 'n', 18283 '\u1E45': 'n', 18284 '\u0148': 'n', 18285 '\u1E47': 'n', 18286 '\u0146': 'n', 18287 '\u1E4B': 'n', 18288 '\u1E49': 'n', 18289 '\u019E': 'n', 18290 '\u0272': 'n', 18291 '\u0149': 'n', 18292 '\uA791': 'n', 18293 '\uA7A5': 'n', 18294 '\u01CC': 'nj', 18295 '\u24DE': 'o', 18296 '\uFF4F': 'o', 18297 '\u00F2': 'o', 18298 '\u00F3': 'o', 18299 '\u00F4': 'o', 18300 '\u1ED3': 'o', 18301 '\u1ED1': 'o', 18302 '\u1ED7': 'o', 18303 '\u1ED5': 'o', 18304 '\u00F5': 'o', 18305 '\u1E4D': 'o', 18306 '\u022D': 'o', 18307 '\u1E4F': 'o', 18308 '\u014D': 'o', 18309 '\u1E51': 'o', 18310 '\u1E53': 'o', 18311 '\u014F': 'o', 18312 '\u022F': 'o', 18313 '\u0231': 'o', 18314 '\u00F6': 'o', 18315 '\u022B': 'o', 18316 '\u1ECF': 'o', 18317 '\u0151': 'o', 18318 '\u01D2': 'o', 18319 '\u020D': 'o', 18320 '\u020F': 'o', 18321 '\u01A1': 'o', 18322 '\u1EDD': 'o', 18323 '\u1EDB': 'o', 18324 '\u1EE1': 'o', 18325 '\u1EDF': 'o', 18326 '\u1EE3': 'o', 18327 '\u1ECD': 'o', 18328 '\u1ED9': 'o', 18329 '\u01EB': 'o', 18330 '\u01ED': 'o', 18331 '\u00F8': 'o', 18332 '\u01FF': 'o', 18333 '\u0254': 'o', 18334 '\uA74B': 'o', 18335 '\uA74D': 'o', 18336 '\u0275': 'o', 18337 '\u0153': 'oe', 18338 '\u01A3': 'oi', 18339 '\u0223': 'ou', 18340 '\uA74F': 'oo', 18341 '\u24DF': 'p', 18342 '\uFF50': 'p', 18343 '\u1E55': 'p', 18344 '\u1E57': 'p', 18345 '\u01A5': 'p', 18346 '\u1D7D': 'p', 18347 '\uA751': 'p', 18348 '\uA753': 'p', 18349 '\uA755': 'p', 18350 '\u24E0': 'q', 18351 '\uFF51': 'q', 18352 '\u024B': 'q', 18353 '\uA757': 'q', 18354 '\uA759': 'q', 18355 '\u24E1': 'r', 18356 '\uFF52': 'r', 18357 '\u0155': 'r', 18358 '\u1E59': 'r', 18359 '\u0159': 'r', 18360 '\u0211': 'r', 18361 '\u0213': 'r', 18362 '\u1E5B': 'r', 18363 '\u1E5D': 'r', 18364 '\u0157': 'r', 18365 '\u1E5F': 'r', 18366 '\u024D': 'r', 18367 '\u027D': 'r', 18368 '\uA75B': 'r', 18369 '\uA7A7': 'r', 18370 '\uA783': 'r', 18371 '\u24E2': 's', 18372 '\uFF53': 's', 18373 '\u00DF': 's', 18374 '\u015B': 's', 18375 '\u1E65': 's', 18376 '\u015D': 's', 18377 '\u1E61': 's', 18378 '\u0161': 's', 18379 '\u1E67': 's', 18380 '\u1E63': 's', 18381 '\u1E69': 's', 18382 '\u0219': 's', 18383 '\u015F': 's', 18384 '\u023F': 's', 18385 '\uA7A9': 's', 18386 '\uA785': 's', 18387 '\u1E9B': 's', 18388 '\u24E3': 't', 18389 '\uFF54': 't', 18390 '\u1E6B': 't', 18391 '\u1E97': 't', 18392 '\u0165': 't', 18393 '\u1E6D': 't', 18394 '\u021B': 't', 18395 '\u0163': 't', 18396 '\u1E71': 't', 18397 '\u1E6F': 't', 18398 '\u0167': 't', 18399 '\u01AD': 't', 18400 '\u0288': 't', 18401 '\u2C66': 't', 18402 '\uA787': 't', 18403 '\uA729': 'tz', 18404 '\u24E4': 'u', 18405 '\uFF55': 'u', 18406 '\u00F9': 'u', 18407 '\u00FA': 'u', 18408 '\u00FB': 'u', 18409 '\u0169': 'u', 18410 '\u1E79': 'u', 18411 '\u016B': 'u', 18412 '\u1E7B': 'u', 18413 '\u016D': 'u', 18414 '\u00FC': 'u', 18415 '\u01DC': 'u', 18416 '\u01D8': 'u', 18417 '\u01D6': 'u', 18418 '\u01DA': 'u', 18419 '\u1EE7': 'u', 18420 '\u016F': 'u', 18421 '\u0171': 'u', 18422 '\u01D4': 'u', 18423 '\u0215': 'u', 18424 '\u0217': 'u', 18425 '\u01B0': 'u', 18426 '\u1EEB': 'u', 18427 '\u1EE9': 'u', 18428 '\u1EEF': 'u', 18429 '\u1EED': 'u', 18430 '\u1EF1': 'u', 18431 '\u1EE5': 'u', 18432 '\u1E73': 'u', 18433 '\u0173': 'u', 18434 '\u1E77': 'u', 18435 '\u1E75': 'u', 18436 '\u0289': 'u', 18437 '\u24E5': 'v', 18438 '\uFF56': 'v', 18439 '\u1E7D': 'v', 18440 '\u1E7F': 'v', 18441 '\u028B': 'v', 18442 '\uA75F': 'v', 18443 '\u028C': 'v', 18444 '\uA761': 'vy', 18445 '\u24E6': 'w', 18446 '\uFF57': 'w', 18447 '\u1E81': 'w', 18448 '\u1E83': 'w', 18449 '\u0175': 'w', 18450 '\u1E87': 'w', 18451 '\u1E85': 'w', 18452 '\u1E98': 'w', 18453 '\u1E89': 'w', 18454 '\u2C73': 'w', 18455 '\u24E7': 'x', 18456 '\uFF58': 'x', 18457 '\u1E8B': 'x', 18458 '\u1E8D': 'x', 18459 '\u24E8': 'y', 18460 '\uFF59': 'y', 18461 '\u1EF3': 'y', 18462 '\u00FD': 'y', 18463 '\u0177': 'y', 18464 '\u1EF9': 'y', 18465 '\u0233': 'y', 18466 '\u1E8F': 'y', 18467 '\u00FF': 'y', 18468 '\u1EF7': 'y', 18469 '\u1E99': 'y', 18470 '\u1EF5': 'y', 18471 '\u01B4': 'y', 18472 '\u024F': 'y', 18473 '\u1EFF': 'y', 18474 '\u24E9': 'z', 18475 '\uFF5A': 'z', 18476 '\u017A': 'z', 18477 '\u1E91': 'z', 18478 '\u017C': 'z', 18479 '\u017E': 'z', 18480 '\u1E93': 'z', 18481 '\u1E95': 'z', 18482 '\u01B6': 'z', 18483 '\u0225': 'z', 18484 '\u0240': 'z', 18485 '\u2C6C': 'z', 18486 '\uA763': 'z', 18487 '\u0386': '\u0391', 18488 '\u0388': '\u0395', 18489 '\u0389': '\u0397', 18490 '\u038A': '\u0399', 18491 '\u03AA': '\u0399', 18492 '\u038C': '\u039F', 18493 '\u038E': '\u03A5', 18494 '\u03AB': '\u03A5', 18495 '\u038F': '\u03A9', 18496 '\u03AC': '\u03B1', 18497 '\u03AD': '\u03B5', 18498 '\u03AE': '\u03B7', 18499 '\u03AF': '\u03B9', 18500 '\u03CA': '\u03B9', 18501 '\u0390': '\u03B9', 18502 '\u03CC': '\u03BF', 18503 '\u03CD': '\u03C5', 18504 '\u03CB': '\u03C5', 18505 '\u03B0': '\u03C5', 18506 '\u03CE': '\u03C9', 18507 '\u03C2': '\u03C3', 18508 '\u2019': '\'' 18509 }; 18510 18511 return diacritics; 18512}); 18513 18514S2.define('select2/data/base',[ 18515 '../utils' 18516], function (Utils) { 18517 function BaseAdapter ($element, options) { 18518 BaseAdapter.__super__.constructor.call(this); 18519 } 18520 18521 Utils.Extend(BaseAdapter, Utils.Observable); 18522 18523 BaseAdapter.prototype.current = function (callback) { 18524 throw new Error('The `current` method must be defined in child classes.'); 18525 }; 18526 18527 BaseAdapter.prototype.query = function (params, callback) { 18528 throw new Error('The `query` method must be defined in child classes.'); 18529 }; 18530 18531 BaseAdapter.prototype.bind = function (container, $container) { 18532 // Can be implemented in subclasses 18533 }; 18534 18535 BaseAdapter.prototype.destroy = function () { 18536 // Can be implemented in subclasses 18537 }; 18538 18539 BaseAdapter.prototype.generateResultId = function (container, data) { 18540 var id = container.id + '-result-'; 18541 18542 id += Utils.generateChars(4); 18543 18544 if (data.id != null) { 18545 id += '-' + data.id.toString(); 18546 } else { 18547 id += '-' + Utils.generateChars(4); 18548 } 18549 return id; 18550 }; 18551 18552 return BaseAdapter; 18553}); 18554 18555S2.define('select2/data/select',[ 18556 './base', 18557 '../utils', 18558 'jquery' 18559], function (BaseAdapter, Utils, $) { 18560 function SelectAdapter ($element, options) { 18561 this.$element = $element; 18562 this.options = options; 18563 18564 SelectAdapter.__super__.constructor.call(this); 18565 } 18566 18567 Utils.Extend(SelectAdapter, BaseAdapter); 18568 18569 SelectAdapter.prototype.current = function (callback) { 18570 var data = []; 18571 var self = this; 18572 18573 this.$element.find(':selected').each(function () { 18574 var $option = $(this); 18575 18576 var option = self.item($option); 18577 18578 data.push(option); 18579 }); 18580 18581 callback(data); 18582 }; 18583 18584 SelectAdapter.prototype.select = function (data) { 18585 var self = this; 18586 18587 data.selected = true; 18588 18589 // If data.element is a DOM node, use it instead 18590 if ($(data.element).is('option')) { 18591 data.element.selected = true; 18592 18593 this.$element.trigger('input').trigger('change'); 18594 18595 return; 18596 } 18597 18598 if (this.$element.prop('multiple')) { 18599 this.current(function (currentData) { 18600 var val = []; 18601 18602 data = [data]; 18603 data.push.apply(data, currentData); 18604 18605 for (var d = 0; d < data.length; d++) { 18606 var id = data[d].id; 18607 18608 if ($.inArray(id, val) === -1) { 18609 val.push(id); 18610 } 18611 } 18612 18613 self.$element.val(val); 18614 self.$element.trigger('input').trigger('change'); 18615 }); 18616 } else { 18617 var val = data.id; 18618 18619 this.$element.val(val); 18620 this.$element.trigger('input').trigger('change'); 18621 } 18622 }; 18623 18624 SelectAdapter.prototype.unselect = function (data) { 18625 var self = this; 18626 18627 if (!this.$element.prop('multiple')) { 18628 return; 18629 } 18630 18631 data.selected = false; 18632 18633 if ($(data.element).is('option')) { 18634 data.element.selected = false; 18635 18636 this.$element.trigger('input').trigger('change'); 18637 18638 return; 18639 } 18640 18641 this.current(function (currentData) { 18642 var val = []; 18643 18644 for (var d = 0; d < currentData.length; d++) { 18645 var id = currentData[d].id; 18646 18647 if (id !== data.id && $.inArray(id, val) === -1) { 18648 val.push(id); 18649 } 18650 } 18651 18652 self.$element.val(val); 18653 18654 self.$element.trigger('input').trigger('change'); 18655 }); 18656 }; 18657 18658 SelectAdapter.prototype.bind = function (container, $container) { 18659 var self = this; 18660 18661 this.container = container; 18662 18663 container.on('select', function (params) { 18664 self.select(params.data); 18665 }); 18666 18667 container.on('unselect', function (params) { 18668 self.unselect(params.data); 18669 }); 18670 }; 18671 18672 SelectAdapter.prototype.destroy = function () { 18673 // Remove anything added to child elements 18674 this.$element.find('*').each(function () { 18675 // Remove any custom data set by Select2 18676 Utils.RemoveData(this); 18677 }); 18678 }; 18679 18680 SelectAdapter.prototype.query = function (params, callback) { 18681 var data = []; 18682 var self = this; 18683 18684 var $options = this.$element.children(); 18685 18686 $options.each(function () { 18687 var $option = $(this); 18688 18689 if (!$option.is('option') && !$option.is('optgroup')) { 18690 return; 18691 } 18692 18693 var option = self.item($option); 18694 18695 var matches = self.matches(params, option); 18696 18697 if (matches !== null) { 18698 data.push(matches); 18699 } 18700 }); 18701 18702 callback({ 18703 results: data 18704 }); 18705 }; 18706 18707 SelectAdapter.prototype.addOptions = function ($options) { 18708 Utils.appendMany(this.$element, $options); 18709 }; 18710 18711 SelectAdapter.prototype.option = function (data) { 18712 var option; 18713 18714 if (data.children) { 18715 option = document.createElement('optgroup'); 18716 option.label = data.text; 18717 } else { 18718 option = document.createElement('option'); 18719 18720 if (option.textContent !== undefined) { 18721 option.textContent = data.text; 18722 } else { 18723 option.innerText = data.text; 18724 } 18725 } 18726 18727 if (data.id !== undefined) { 18728 option.value = data.id; 18729 } 18730 18731 if (data.disabled) { 18732 option.disabled = true; 18733 } 18734 18735 if (data.selected) { 18736 option.selected = true; 18737 } 18738 18739 if (data.title) { 18740 option.title = data.title; 18741 } 18742 18743 var $option = $(option); 18744 18745 var normalizedData = this._normalizeItem(data); 18746 normalizedData.element = option; 18747 18748 // Override the option's data with the combined data 18749 Utils.StoreData(option, 'data', normalizedData); 18750 18751 return $option; 18752 }; 18753 18754 SelectAdapter.prototype.item = function ($option) { 18755 var data = {}; 18756 18757 data = Utils.GetData($option[0], 'data'); 18758 18759 if (data != null) { 18760 return data; 18761 } 18762 18763 if ($option.is('option')) { 18764 data = { 18765 id: $option.val(), 18766 text: $option.text(), 18767 disabled: $option.prop('disabled'), 18768 selected: $option.prop('selected'), 18769 title: $option.prop('title') 18770 }; 18771 } else if ($option.is('optgroup')) { 18772 data = { 18773 text: $option.prop('label'), 18774 children: [], 18775 title: $option.prop('title') 18776 }; 18777 18778 var $children = $option.children('option'); 18779 var children = []; 18780 18781 for (var c = 0; c < $children.length; c++) { 18782 var $child = $($children[c]); 18783 18784 var child = this.item($child); 18785 18786 children.push(child); 18787 } 18788 18789 data.children = children; 18790 } 18791 18792 data = this._normalizeItem(data); 18793 data.element = $option[0]; 18794 18795 Utils.StoreData($option[0], 'data', data); 18796 18797 return data; 18798 }; 18799 18800 SelectAdapter.prototype._normalizeItem = function (item) { 18801 if (item !== Object(item)) { 18802 item = { 18803 id: item, 18804 text: item 18805 }; 18806 } 18807 18808 item = $.extend({}, { 18809 text: '' 18810 }, item); 18811 18812 var defaults = { 18813 selected: false, 18814 disabled: false 18815 }; 18816 18817 if (item.id != null) { 18818 item.id = item.id.toString(); 18819 } 18820 18821 if (item.text != null) { 18822 item.text = item.text.toString(); 18823 } 18824 18825 if (item._resultId == null && item.id && this.container != null) { 18826 item._resultId = this.generateResultId(this.container, item); 18827 } 18828 18829 return $.extend({}, defaults, item); 18830 }; 18831 18832 SelectAdapter.prototype.matches = function (params, data) { 18833 var matcher = this.options.get('matcher'); 18834 18835 return matcher(params, data); 18836 }; 18837 18838 return SelectAdapter; 18839}); 18840 18841S2.define('select2/data/array',[ 18842 './select', 18843 '../utils', 18844 'jquery' 18845], function (SelectAdapter, Utils, $) { 18846 function ArrayAdapter ($element, options) { 18847 this._dataToConvert = options.get('data') || []; 18848 18849 ArrayAdapter.__super__.constructor.call(this, $element, options); 18850 } 18851 18852 Utils.Extend(ArrayAdapter, SelectAdapter); 18853 18854 ArrayAdapter.prototype.bind = function (container, $container) { 18855 ArrayAdapter.__super__.bind.call(this, container, $container); 18856 18857 this.addOptions(this.convertToOptions(this._dataToConvert)); 18858 }; 18859 18860 ArrayAdapter.prototype.select = function (data) { 18861 var $option = this.$element.find('option').filter(function (i, elm) { 18862 return elm.value == data.id.toString(); 18863 }); 18864 18865 if ($option.length === 0) { 18866 $option = this.option(data); 18867 18868 this.addOptions($option); 18869 } 18870 18871 ArrayAdapter.__super__.select.call(this, data); 18872 }; 18873 18874 ArrayAdapter.prototype.convertToOptions = function (data) { 18875 var self = this; 18876 18877 var $existing = this.$element.find('option'); 18878 var existingIds = $existing.map(function () { 18879 return self.item($(this)).id; 18880 }).get(); 18881 18882 var $options = []; 18883 18884 // Filter out all items except for the one passed in the argument 18885 function onlyItem (item) { 18886 return function () { 18887 return $(this).val() == item.id; 18888 }; 18889 } 18890 18891 for (var d = 0; d < data.length; d++) { 18892 var item = this._normalizeItem(data[d]); 18893 18894 // Skip items which were pre-loaded, only merge the data 18895 if ($.inArray(item.id, existingIds) >= 0) { 18896 var $existingOption = $existing.filter(onlyItem(item)); 18897 18898 var existingData = this.item($existingOption); 18899 var newData = $.extend(true, {}, item, existingData); 18900 18901 var $newOption = this.option(newData); 18902 18903 $existingOption.replaceWith($newOption); 18904 18905 continue; 18906 } 18907 18908 var $option = this.option(item); 18909 18910 if (item.children) { 18911 var $children = this.convertToOptions(item.children); 18912 18913 Utils.appendMany($option, $children); 18914 } 18915 18916 $options.push($option); 18917 } 18918 18919 return $options; 18920 }; 18921 18922 return ArrayAdapter; 18923}); 18924 18925S2.define('select2/data/ajax',[ 18926 './array', 18927 '../utils', 18928 'jquery' 18929], function (ArrayAdapter, Utils, $) { 18930 function AjaxAdapter ($element, options) { 18931 this.ajaxOptions = this._applyDefaults(options.get('ajax')); 18932 18933 if (this.ajaxOptions.processResults != null) { 18934 this.processResults = this.ajaxOptions.processResults; 18935 } 18936 18937 AjaxAdapter.__super__.constructor.call(this, $element, options); 18938 } 18939 18940 Utils.Extend(AjaxAdapter, ArrayAdapter); 18941 18942 AjaxAdapter.prototype._applyDefaults = function (options) { 18943 var defaults = { 18944 data: function (params) { 18945 return $.extend({}, params, { 18946 q: params.term 18947 }); 18948 }, 18949 transport: function (params, success, failure) { 18950 var $request = $.ajax(params); 18951 18952 $request.then(success); 18953 $request.fail(failure); 18954 18955 return $request; 18956 } 18957 }; 18958 18959 return $.extend({}, defaults, options, true); 18960 }; 18961 18962 AjaxAdapter.prototype.processResults = function (results) { 18963 return results; 18964 }; 18965 18966 AjaxAdapter.prototype.query = function (params, callback) { 18967 var matches = []; 18968 var self = this; 18969 18970 if (this._request != null) { 18971 // JSONP requests cannot always be aborted 18972 if ($.isFunction(this._request.abort)) { 18973 this._request.abort(); 18974 } 18975 18976 this._request = null; 18977 } 18978 18979 var options = $.extend({ 18980 type: 'GET' 18981 }, this.ajaxOptions); 18982 18983 if (typeof options.url === 'function') { 18984 options.url = options.url.call(this.$element, params); 18985 } 18986 18987 if (typeof options.data === 'function') { 18988 options.data = options.data.call(this.$element, params); 18989 } 18990 18991 function request () { 18992 var $request = options.transport(options, function (data) { 18993 var results = self.processResults(data, params); 18994 18995 if (self.options.get('debug') && window.console && console.error) { 18996 // Check to make sure that the response included a `results` key. 18997 if (!results || !results.results || !$.isArray(results.results)) { 18998 console.error( 18999 'Select2: The AJAX results did not return an array in the ' + 19000 '`results` key of the response.' 19001 ); 19002 } 19003 } 19004 19005 callback(results); 19006 }, function () { 19007 // Attempt to detect if a request was aborted 19008 // Only works if the transport exposes a status property 19009 if ('status' in $request && 19010 ($request.status === 0 || $request.status === '0')) { 19011 return; 19012 } 19013 19014 self.trigger('results:message', { 19015 message: 'errorLoading' 19016 }); 19017 }); 19018 19019 self._request = $request; 19020 } 19021 19022 if (this.ajaxOptions.delay && params.term != null) { 19023 if (this._queryTimeout) { 19024 window.clearTimeout(this._queryTimeout); 19025 } 19026 19027 this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); 19028 } else { 19029 request(); 19030 } 19031 }; 19032 19033 return AjaxAdapter; 19034}); 19035 19036S2.define('select2/data/tags',[ 19037 'jquery' 19038], function ($) { 19039 function Tags (decorated, $element, options) { 19040 var tags = options.get('tags'); 19041 19042 var createTag = options.get('createTag'); 19043 19044 if (createTag !== undefined) { 19045 this.createTag = createTag; 19046 } 19047 19048 var insertTag = options.get('insertTag'); 19049 19050 if (insertTag !== undefined) { 19051 this.insertTag = insertTag; 19052 } 19053 19054 decorated.call(this, $element, options); 19055 19056 if ($.isArray(tags)) { 19057 for (var t = 0; t < tags.length; t++) { 19058 var tag = tags[t]; 19059 var item = this._normalizeItem(tag); 19060 19061 var $option = this.option(item); 19062 19063 this.$element.append($option); 19064 } 19065 } 19066 } 19067 19068 Tags.prototype.query = function (decorated, params, callback) { 19069 var self = this; 19070 19071 this._removeOldTags(); 19072 19073 if (params.term == null || params.page != null) { 19074 decorated.call(this, params, callback); 19075 return; 19076 } 19077 19078 function wrapper (obj, child) { 19079 var data = obj.results; 19080 19081 for (var i = 0; i < data.length; i++) { 19082 var option = data[i]; 19083 19084 var checkChildren = ( 19085 option.children != null && 19086 !wrapper({ 19087 results: option.children 19088 }, true) 19089 ); 19090 19091 var optionText = (option.text || '').toUpperCase(); 19092 var paramsTerm = (params.term || '').toUpperCase(); 19093 19094 var checkText = optionText === paramsTerm; 19095 19096 if (checkText || checkChildren) { 19097 if (child) { 19098 return false; 19099 } 19100 19101 obj.data = data; 19102 callback(obj); 19103 19104 return; 19105 } 19106 } 19107 19108 if (child) { 19109 return true; 19110 } 19111 19112 var tag = self.createTag(params); 19113 19114 if (tag != null) { 19115 var $option = self.option(tag); 19116 $option.attr('data-select2-tag', true); 19117 19118 self.addOptions([$option]); 19119 19120 self.insertTag(data, tag); 19121 } 19122 19123 obj.results = data; 19124 19125 callback(obj); 19126 } 19127 19128 decorated.call(this, params, wrapper); 19129 }; 19130 19131 Tags.prototype.createTag = function (decorated, params) { 19132 var term = $.trim(params.term); 19133 19134 if (term === '') { 19135 return null; 19136 } 19137 19138 return { 19139 id: term, 19140 text: term 19141 }; 19142 }; 19143 19144 Tags.prototype.insertTag = function (_, data, tag) { 19145 data.unshift(tag); 19146 }; 19147 19148 Tags.prototype._removeOldTags = function (_) { 19149 var $options = this.$element.find('option[data-select2-tag]'); 19150 19151 $options.each(function () { 19152 if (this.selected) { 19153 return; 19154 } 19155 19156 $(this).remove(); 19157 }); 19158 }; 19159 19160 return Tags; 19161}); 19162 19163S2.define('select2/data/tokenizer',[ 19164 'jquery' 19165], function ($) { 19166 function Tokenizer (decorated, $element, options) { 19167 var tokenizer = options.get('tokenizer'); 19168 19169 if (tokenizer !== undefined) { 19170 this.tokenizer = tokenizer; 19171 } 19172 19173 decorated.call(this, $element, options); 19174 } 19175 19176 Tokenizer.prototype.bind = function (decorated, container, $container) { 19177 decorated.call(this, container, $container); 19178 19179 this.$search = container.dropdown.$search || container.selection.$search || 19180 $container.find('.select2-search__field'); 19181 }; 19182 19183 Tokenizer.prototype.query = function (decorated, params, callback) { 19184 var self = this; 19185 19186 function createAndSelect (data) { 19187 // Normalize the data object so we can use it for checks 19188 var item = self._normalizeItem(data); 19189 19190 // Check if the data object already exists as a tag 19191 // Select it if it doesn't 19192 var $existingOptions = self.$element.find('option').filter(function () { 19193 return $(this).val() === item.id; 19194 }); 19195 19196 // If an existing option wasn't found for it, create the option 19197 if (!$existingOptions.length) { 19198 var $option = self.option(item); 19199 $option.attr('data-select2-tag', true); 19200 19201 self._removeOldTags(); 19202 self.addOptions([$option]); 19203 } 19204 19205 // Select the item, now that we know there is an option for it 19206 select(item); 19207 } 19208 19209 function select (data) { 19210 self.trigger('select', { 19211 data: data 19212 }); 19213 } 19214 19215 params.term = params.term || ''; 19216 19217 var tokenData = this.tokenizer(params, this.options, createAndSelect); 19218 19219 if (tokenData.term !== params.term) { 19220 // Replace the search term if we have the search box 19221 if (this.$search.length) { 19222 this.$search.val(tokenData.term); 19223 this.$search.trigger('focus'); 19224 } 19225 19226 params.term = tokenData.term; 19227 } 19228 19229 decorated.call(this, params, callback); 19230 }; 19231 19232 Tokenizer.prototype.tokenizer = function (_, params, options, callback) { 19233 var separators = options.get('tokenSeparators') || []; 19234 var term = params.term; 19235 var i = 0; 19236 19237 var createTag = this.createTag || function (params) { 19238 return { 19239 id: params.term, 19240 text: params.term 19241 }; 19242 }; 19243 19244 while (i < term.length) { 19245 var termChar = term[i]; 19246 19247 if ($.inArray(termChar, separators) === -1) { 19248 i++; 19249 19250 continue; 19251 } 19252 19253 var part = term.substr(0, i); 19254 var partParams = $.extend({}, params, { 19255 term: part 19256 }); 19257 19258 var data = createTag(partParams); 19259 19260 if (data == null) { 19261 i++; 19262 continue; 19263 } 19264 19265 callback(data); 19266 19267 // Reset the term to not include the tokenized portion 19268 term = term.substr(i + 1) || ''; 19269 i = 0; 19270 } 19271 19272 return { 19273 term: term 19274 }; 19275 }; 19276 19277 return Tokenizer; 19278}); 19279 19280S2.define('select2/data/minimumInputLength',[ 19281 19282], function () { 19283 function MinimumInputLength (decorated, $e, options) { 19284 this.minimumInputLength = options.get('minimumInputLength'); 19285 19286 decorated.call(this, $e, options); 19287 } 19288 19289 MinimumInputLength.prototype.query = function (decorated, params, callback) { 19290 params.term = params.term || ''; 19291 19292 if (params.term.length < this.minimumInputLength) { 19293 this.trigger('results:message', { 19294 message: 'inputTooShort', 19295 args: { 19296 minimum: this.minimumInputLength, 19297 input: params.term, 19298 params: params 19299 } 19300 }); 19301 19302 return; 19303 } 19304 19305 decorated.call(this, params, callback); 19306 }; 19307 19308 return MinimumInputLength; 19309}); 19310 19311S2.define('select2/data/maximumInputLength',[ 19312 19313], function () { 19314 function MaximumInputLength (decorated, $e, options) { 19315 this.maximumInputLength = options.get('maximumInputLength'); 19316 19317 decorated.call(this, $e, options); 19318 } 19319 19320 MaximumInputLength.prototype.query = function (decorated, params, callback) { 19321 params.term = params.term || ''; 19322 19323 if (this.maximumInputLength > 0 && 19324 params.term.length > this.maximumInputLength) { 19325 this.trigger('results:message', { 19326 message: 'inputTooLong', 19327 args: { 19328 maximum: this.maximumInputLength, 19329 input: params.term, 19330 params: params 19331 } 19332 }); 19333 19334 return; 19335 } 19336 19337 decorated.call(this, params, callback); 19338 }; 19339 19340 return MaximumInputLength; 19341}); 19342 19343S2.define('select2/data/maximumSelectionLength',[ 19344 19345], function (){ 19346 function MaximumSelectionLength (decorated, $e, options) { 19347 this.maximumSelectionLength = options.get('maximumSelectionLength'); 19348 19349 decorated.call(this, $e, options); 19350 } 19351 19352 MaximumSelectionLength.prototype.bind = 19353 function (decorated, container, $container) { 19354 var self = this; 19355 19356 decorated.call(this, container, $container); 19357 19358 container.on('select', function () { 19359 self._checkIfMaximumSelected(); 19360 }); 19361 }; 19362 19363 MaximumSelectionLength.prototype.query = 19364 function (decorated, params, callback) { 19365 var self = this; 19366 19367 this._checkIfMaximumSelected(function () { 19368 decorated.call(self, params, callback); 19369 }); 19370 }; 19371 19372 MaximumSelectionLength.prototype._checkIfMaximumSelected = 19373 function (_, successCallback) { 19374 var self = this; 19375 19376 this.current(function (currentData) { 19377 var count = currentData != null ? currentData.length : 0; 19378 if (self.maximumSelectionLength > 0 && 19379 count >= self.maximumSelectionLength) { 19380 self.trigger('results:message', { 19381 message: 'maximumSelected', 19382 args: { 19383 maximum: self.maximumSelectionLength 19384 } 19385 }); 19386 return; 19387 } 19388 19389 if (successCallback) { 19390 successCallback(); 19391 } 19392 }); 19393 }; 19394 19395 return MaximumSelectionLength; 19396}); 19397 19398S2.define('select2/dropdown',[ 19399 'jquery', 19400 './utils' 19401], function ($, Utils) { 19402 function Dropdown ($element, options) { 19403 this.$element = $element; 19404 this.options = options; 19405 19406 Dropdown.__super__.constructor.call(this); 19407 } 19408 19409 Utils.Extend(Dropdown, Utils.Observable); 19410 19411 Dropdown.prototype.render = function () { 19412 var $dropdown = $( 19413 '<span class="select2-dropdown">' + 19414 '<span class="select2-results"></span>' + 19415 '</span>' 19416 ); 19417 19418 $dropdown.attr('dir', this.options.get('dir')); 19419 19420 this.$dropdown = $dropdown; 19421 19422 return $dropdown; 19423 }; 19424 19425 Dropdown.prototype.bind = function () { 19426 // Should be implemented in subclasses 19427 }; 19428 19429 Dropdown.prototype.position = function ($dropdown, $container) { 19430 // Should be implemented in subclasses 19431 }; 19432 19433 Dropdown.prototype.destroy = function () { 19434 // Remove the dropdown from the DOM 19435 this.$dropdown.remove(); 19436 }; 19437 19438 return Dropdown; 19439}); 19440 19441S2.define('select2/dropdown/search',[ 19442 'jquery', 19443 '../utils' 19444], function ($, Utils) { 19445 function Search () { } 19446 19447 Search.prototype.render = function (decorated) { 19448 var $rendered = decorated.call(this); 19449 19450 var $search = $( 19451 '<span class="select2-search select2-search--dropdown">' + 19452 '<input class="select2-search__field" type="search" tabindex="-1"' + 19453 ' autocomplete="off" autocorrect="off" autocapitalize="none"' + 19454 ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + 19455 '</span>' 19456 ); 19457 19458 this.$searchContainer = $search; 19459 this.$search = $search.find('input'); 19460 19461 $rendered.prepend($search); 19462 19463 return $rendered; 19464 }; 19465 19466 Search.prototype.bind = function (decorated, container, $container) { 19467 var self = this; 19468 19469 var resultsId = container.id + '-results'; 19470 19471 decorated.call(this, container, $container); 19472 19473 this.$search.on('keydown', function (evt) { 19474 self.trigger('keypress', evt); 19475 19476 self._keyUpPrevented = evt.isDefaultPrevented(); 19477 }); 19478 19479 // Workaround for browsers which do not support the `input` event 19480 // This will prevent double-triggering of events for browsers which support 19481 // both the `keyup` and `input` events. 19482 this.$search.on('input', function (evt) { 19483 // Unbind the duplicated `keyup` event 19484 $(this).off('keyup'); 19485 }); 19486 19487 this.$search.on('keyup input', function (evt) { 19488 self.handleSearch(evt); 19489 }); 19490 19491 container.on('open', function () { 19492 self.$search.attr('tabindex', 0); 19493 self.$search.attr('aria-controls', resultsId); 19494 19495 self.$search.trigger('focus'); 19496 19497 window.setTimeout(function () { 19498 self.$search.trigger('focus'); 19499 }, 0); 19500 }); 19501 19502 container.on('close', function () { 19503 self.$search.attr('tabindex', -1); 19504 self.$search.removeAttr('aria-controls'); 19505 self.$search.removeAttr('aria-activedescendant'); 19506 19507 self.$search.val(''); 19508 self.$search.trigger('blur'); 19509 }); 19510 19511 container.on('focus', function () { 19512 if (!container.isOpen()) { 19513 self.$search.trigger('focus'); 19514 } 19515 }); 19516 19517 container.on('results:all', function (params) { 19518 if (params.query.term == null || params.query.term === '') { 19519 var showSearch = self.showSearch(params); 19520 19521 if (showSearch) { 19522 self.$searchContainer.removeClass('select2-search--hide'); 19523 } else { 19524 self.$searchContainer.addClass('select2-search--hide'); 19525 } 19526 } 19527 }); 19528 19529 container.on('results:focus', function (params) { 19530 if (params.data._resultId) { 19531 self.$search.attr('aria-activedescendant', params.data._resultId); 19532 } else { 19533 self.$search.removeAttr('aria-activedescendant'); 19534 } 19535 }); 19536 }; 19537 19538 Search.prototype.handleSearch = function (evt) { 19539 if (!this._keyUpPrevented) { 19540 var input = this.$search.val(); 19541 19542 this.trigger('query', { 19543 term: input 19544 }); 19545 } 19546 19547 this._keyUpPrevented = false; 19548 }; 19549 19550 Search.prototype.showSearch = function (_, params) { 19551 return true; 19552 }; 19553 19554 return Search; 19555}); 19556 19557S2.define('select2/dropdown/hidePlaceholder',[ 19558 19559], function () { 19560 function HidePlaceholder (decorated, $element, options, dataAdapter) { 19561 this.placeholder = this.normalizePlaceholder(options.get('placeholder')); 19562 19563 decorated.call(this, $element, options, dataAdapter); 19564 } 19565 19566 HidePlaceholder.prototype.append = function (decorated, data) { 19567 data.results = this.removePlaceholder(data.results); 19568 19569 decorated.call(this, data); 19570 }; 19571 19572 HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { 19573 if (typeof placeholder === 'string') { 19574 placeholder = { 19575 id: '', 19576 text: placeholder 19577 }; 19578 } 19579 19580 return placeholder; 19581 }; 19582 19583 HidePlaceholder.prototype.removePlaceholder = function (_, data) { 19584 var modifiedData = data.slice(0); 19585 19586 for (var d = data.length - 1; d >= 0; d--) { 19587 var item = data[d]; 19588 19589 if (this.placeholder.id === item.id) { 19590 modifiedData.splice(d, 1); 19591 } 19592 } 19593 19594 return modifiedData; 19595 }; 19596 19597 return HidePlaceholder; 19598}); 19599 19600S2.define('select2/dropdown/infiniteScroll',[ 19601 'jquery' 19602], function ($) { 19603 function InfiniteScroll (decorated, $element, options, dataAdapter) { 19604 this.lastParams = {}; 19605 19606 decorated.call(this, $element, options, dataAdapter); 19607 19608 this.$loadingMore = this.createLoadingMore(); 19609 this.loading = false; 19610 } 19611 19612 InfiniteScroll.prototype.append = function (decorated, data) { 19613 this.$loadingMore.remove(); 19614 this.loading = false; 19615 19616 decorated.call(this, data); 19617 19618 if (this.showLoadingMore(data)) { 19619 this.$results.append(this.$loadingMore); 19620 this.loadMoreIfNeeded(); 19621 } 19622 }; 19623 19624 InfiniteScroll.prototype.bind = function (decorated, container, $container) { 19625 var self = this; 19626 19627 decorated.call(this, container, $container); 19628 19629 container.on('query', function (params) { 19630 self.lastParams = params; 19631 self.loading = true; 19632 }); 19633 19634 container.on('query:append', function (params) { 19635 self.lastParams = params; 19636 self.loading = true; 19637 }); 19638 19639 this.$results.on('scroll', this.loadMoreIfNeeded.bind(this)); 19640 }; 19641 19642 InfiniteScroll.prototype.loadMoreIfNeeded = function () { 19643 var isLoadMoreVisible = $.contains( 19644 document.documentElement, 19645 this.$loadingMore[0] 19646 ); 19647 19648 if (this.loading || !isLoadMoreVisible) { 19649 return; 19650 } 19651 19652 var currentOffset = this.$results.offset().top + 19653 this.$results.outerHeight(false); 19654 var loadingMoreOffset = this.$loadingMore.offset().top + 19655 this.$loadingMore.outerHeight(false); 19656 19657 if (currentOffset + 50 >= loadingMoreOffset) { 19658 this.loadMore(); 19659 } 19660 }; 19661 19662 InfiniteScroll.prototype.loadMore = function () { 19663 this.loading = true; 19664 19665 var params = $.extend({}, {page: 1}, this.lastParams); 19666 19667 params.page++; 19668 19669 this.trigger('query:append', params); 19670 }; 19671 19672 InfiniteScroll.prototype.showLoadingMore = function (_, data) { 19673 return data.pagination && data.pagination.more; 19674 }; 19675 19676 InfiniteScroll.prototype.createLoadingMore = function () { 19677 var $option = $( 19678 '<li ' + 19679 'class="select2-results__option select2-results__option--load-more"' + 19680 'role="option" aria-disabled="true"></li>' 19681 ); 19682 19683 var message = this.options.get('translations').get('loadingMore'); 19684 19685 $option.html(message(this.lastParams)); 19686 19687 return $option; 19688 }; 19689 19690 return InfiniteScroll; 19691}); 19692 19693S2.define('select2/dropdown/attachBody',[ 19694 'jquery', 19695 '../utils' 19696], function ($, Utils) { 19697 function AttachBody (decorated, $element, options) { 19698 this.$dropdownParent = $(options.get('dropdownParent') || document.body); 19699 19700 decorated.call(this, $element, options); 19701 } 19702 19703 AttachBody.prototype.bind = function (decorated, container, $container) { 19704 var self = this; 19705 19706 decorated.call(this, container, $container); 19707 19708 container.on('open', function () { 19709 self._showDropdown(); 19710 self._attachPositioningHandler(container); 19711 19712 // Must bind after the results handlers to ensure correct sizing 19713 self._bindContainerResultHandlers(container); 19714 }); 19715 19716 container.on('close', function () { 19717 self._hideDropdown(); 19718 self._detachPositioningHandler(container); 19719 }); 19720 19721 this.$dropdownContainer.on('mousedown', function (evt) { 19722 evt.stopPropagation(); 19723 }); 19724 }; 19725 19726 AttachBody.prototype.destroy = function (decorated) { 19727 decorated.call(this); 19728 19729 this.$dropdownContainer.remove(); 19730 }; 19731 19732 AttachBody.prototype.position = function (decorated, $dropdown, $container) { 19733 // Clone all of the container classes 19734 $dropdown.attr('class', $container.attr('class')); 19735 19736 $dropdown.removeClass('select2'); 19737 $dropdown.addClass('select2-container--open'); 19738 19739 $dropdown.css({ 19740 position: 'absolute', 19741 top: -999999 19742 }); 19743 19744 this.$container = $container; 19745 }; 19746 19747 AttachBody.prototype.render = function (decorated) { 19748 var $container = $('<span></span>'); 19749 19750 var $dropdown = decorated.call(this); 19751 $container.append($dropdown); 19752 19753 this.$dropdownContainer = $container; 19754 19755 return $container; 19756 }; 19757 19758 AttachBody.prototype._hideDropdown = function (decorated) { 19759 this.$dropdownContainer.detach(); 19760 }; 19761 19762 AttachBody.prototype._bindContainerResultHandlers = 19763 function (decorated, container) { 19764 19765 // These should only be bound once 19766 if (this._containerResultsHandlersBound) { 19767 return; 19768 } 19769 19770 var self = this; 19771 19772 container.on('results:all', function () { 19773 self._positionDropdown(); 19774 self._resizeDropdown(); 19775 }); 19776 19777 container.on('results:append', function () { 19778 self._positionDropdown(); 19779 self._resizeDropdown(); 19780 }); 19781 19782 container.on('results:message', function () { 19783 self._positionDropdown(); 19784 self._resizeDropdown(); 19785 }); 19786 19787 container.on('select', function () { 19788 self._positionDropdown(); 19789 self._resizeDropdown(); 19790 }); 19791 19792 container.on('unselect', function () { 19793 self._positionDropdown(); 19794 self._resizeDropdown(); 19795 }); 19796 19797 this._containerResultsHandlersBound = true; 19798 }; 19799 19800 AttachBody.prototype._attachPositioningHandler = 19801 function (decorated, container) { 19802 var self = this; 19803 19804 var scrollEvent = 'scroll.select2.' + container.id; 19805 var resizeEvent = 'resize.select2.' + container.id; 19806 var orientationEvent = 'orientationchange.select2.' + container.id; 19807 19808 var $watchers = this.$container.parents().filter(Utils.hasScroll); 19809 $watchers.each(function () { 19810 Utils.StoreData(this, 'select2-scroll-position', { 19811 x: $(this).scrollLeft(), 19812 y: $(this).scrollTop() 19813 }); 19814 }); 19815 19816 $watchers.on(scrollEvent, function (ev) { 19817 var position = Utils.GetData(this, 'select2-scroll-position'); 19818 $(this).scrollTop(position.y); 19819 }); 19820 19821 $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, 19822 function (e) { 19823 self._positionDropdown(); 19824 self._resizeDropdown(); 19825 }); 19826 }; 19827 19828 AttachBody.prototype._detachPositioningHandler = 19829 function (decorated, container) { 19830 var scrollEvent = 'scroll.select2.' + container.id; 19831 var resizeEvent = 'resize.select2.' + container.id; 19832 var orientationEvent = 'orientationchange.select2.' + container.id; 19833 19834 var $watchers = this.$container.parents().filter(Utils.hasScroll); 19835 $watchers.off(scrollEvent); 19836 19837 $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); 19838 }; 19839 19840 AttachBody.prototype._positionDropdown = function () { 19841 var $window = $(window); 19842 19843 var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); 19844 var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); 19845 19846 var newDirection = null; 19847 19848 var offset = this.$container.offset(); 19849 19850 offset.bottom = offset.top + this.$container.outerHeight(false); 19851 19852 var container = { 19853 height: this.$container.outerHeight(false) 19854 }; 19855 19856 container.top = offset.top; 19857 container.bottom = offset.top + container.height; 19858 19859 var dropdown = { 19860 height: this.$dropdown.outerHeight(false) 19861 }; 19862 19863 var viewport = { 19864 top: $window.scrollTop(), 19865 bottom: $window.scrollTop() + $window.height() 19866 }; 19867 19868 var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); 19869 var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); 19870 19871 var css = { 19872 left: offset.left, 19873 top: container.bottom 19874 }; 19875 19876 // Determine what the parent element is to use for calculating the offset 19877 var $offsetParent = this.$dropdownParent; 19878 19879 // For statically positioned elements, we need to get the element 19880 // that is determining the offset 19881 if ($offsetParent.css('position') === 'static') { 19882 $offsetParent = $offsetParent.offsetParent(); 19883 } 19884 19885 var parentOffset = { 19886 top: 0, 19887 left: 0 19888 }; 19889 19890 if ( 19891 $.contains(document.body, $offsetParent[0]) || 19892 $offsetParent[0].isConnected 19893 ) { 19894 parentOffset = $offsetParent.offset(); 19895 } 19896 19897 css.top -= parentOffset.top; 19898 css.left -= parentOffset.left; 19899 19900 if (!isCurrentlyAbove && !isCurrentlyBelow) { 19901 newDirection = 'below'; 19902 } 19903 19904 if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { 19905 newDirection = 'above'; 19906 } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { 19907 newDirection = 'below'; 19908 } 19909 19910 if (newDirection == 'above' || 19911 (isCurrentlyAbove && newDirection !== 'below')) { 19912 css.top = container.top - parentOffset.top - dropdown.height; 19913 } 19914 19915 if (newDirection != null) { 19916 this.$dropdown 19917 .removeClass('select2-dropdown--below select2-dropdown--above') 19918 .addClass('select2-dropdown--' + newDirection); 19919 this.$container 19920 .removeClass('select2-container--below select2-container--above') 19921 .addClass('select2-container--' + newDirection); 19922 } 19923 19924 this.$dropdownContainer.css(css); 19925 }; 19926 19927 AttachBody.prototype._resizeDropdown = function () { 19928 var css = { 19929 width: this.$container.outerWidth(false) + 'px' 19930 }; 19931 19932 if (this.options.get('dropdownAutoWidth')) { 19933 css.minWidth = css.width; 19934 css.position = 'relative'; 19935 css.width = 'auto'; 19936 } 19937 19938 this.$dropdown.css(css); 19939 }; 19940 19941 AttachBody.prototype._showDropdown = function (decorated) { 19942 this.$dropdownContainer.appendTo(this.$dropdownParent); 19943 19944 this._positionDropdown(); 19945 this._resizeDropdown(); 19946 }; 19947 19948 return AttachBody; 19949}); 19950 19951S2.define('select2/dropdown/minimumResultsForSearch',[ 19952 19953], function () { 19954 function countResults (data) { 19955 var count = 0; 19956 19957 for (var d = 0; d < data.length; d++) { 19958 var item = data[d]; 19959 19960 if (item.children) { 19961 count += countResults(item.children); 19962 } else { 19963 count++; 19964 } 19965 } 19966 19967 return count; 19968 } 19969 19970 function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { 19971 this.minimumResultsForSearch = options.get('minimumResultsForSearch'); 19972 19973 if (this.minimumResultsForSearch < 0) { 19974 this.minimumResultsForSearch = Infinity; 19975 } 19976 19977 decorated.call(this, $element, options, dataAdapter); 19978 } 19979 19980 MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { 19981 if (countResults(params.data.results) < this.minimumResultsForSearch) { 19982 return false; 19983 } 19984 19985 return decorated.call(this, params); 19986 }; 19987 19988 return MinimumResultsForSearch; 19989}); 19990 19991S2.define('select2/dropdown/selectOnClose',[ 19992 '../utils' 19993], function (Utils) { 19994 function SelectOnClose () { } 19995 19996 SelectOnClose.prototype.bind = function (decorated, container, $container) { 19997 var self = this; 19998 19999 decorated.call(this, container, $container); 20000 20001 container.on('close', function (params) { 20002 self._handleSelectOnClose(params); 20003 }); 20004 }; 20005 20006 SelectOnClose.prototype._handleSelectOnClose = function (_, params) { 20007 if (params && params.originalSelect2Event != null) { 20008 var event = params.originalSelect2Event; 20009 20010 // Don't select an item if the close event was triggered from a select or 20011 // unselect event 20012 if (event._type === 'select' || event._type === 'unselect') { 20013 return; 20014 } 20015 } 20016 20017 var $highlightedResults = this.getHighlightedResults(); 20018 20019 // Only select highlighted results 20020 if ($highlightedResults.length < 1) { 20021 return; 20022 } 20023 20024 var data = Utils.GetData($highlightedResults[0], 'data'); 20025 20026 // Don't re-select already selected resulte 20027 if ( 20028 (data.element != null && data.element.selected) || 20029 (data.element == null && data.selected) 20030 ) { 20031 return; 20032 } 20033 20034 this.trigger('select', { 20035 data: data 20036 }); 20037 }; 20038 20039 return SelectOnClose; 20040}); 20041 20042S2.define('select2/dropdown/closeOnSelect',[ 20043 20044], function () { 20045 function CloseOnSelect () { } 20046 20047 CloseOnSelect.prototype.bind = function (decorated, container, $container) { 20048 var self = this; 20049 20050 decorated.call(this, container, $container); 20051 20052 container.on('select', function (evt) { 20053 self._selectTriggered(evt); 20054 }); 20055 20056 container.on('unselect', function (evt) { 20057 self._selectTriggered(evt); 20058 }); 20059 }; 20060 20061 CloseOnSelect.prototype._selectTriggered = function (_, evt) { 20062 var originalEvent = evt.originalEvent; 20063 20064 // Don't close if the control key is being held 20065 if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) { 20066 return; 20067 } 20068 20069 this.trigger('close', { 20070 originalEvent: originalEvent, 20071 originalSelect2Event: evt 20072 }); 20073 }; 20074 20075 return CloseOnSelect; 20076}); 20077 20078S2.define('select2/i18n/en',[],function () { 20079 // English 20080 return { 20081 errorLoading: function () { 20082 return 'The results could not be loaded.'; 20083 }, 20084 inputTooLong: function (args) { 20085 var overChars = args.input.length - args.maximum; 20086 20087 var message = 'Please delete ' + overChars + ' character'; 20088 20089 if (overChars != 1) { 20090 message += 's'; 20091 } 20092 20093 return message; 20094 }, 20095 inputTooShort: function (args) { 20096 var remainingChars = args.minimum - args.input.length; 20097 20098 var message = 'Please enter ' + remainingChars + ' or more characters'; 20099 20100 return message; 20101 }, 20102 loadingMore: function () { 20103 return 'Loading more resultsâ¦'; 20104 }, 20105 maximumSelected: function (args) { 20106 var message = 'You can only select ' + args.maximum + ' item'; 20107 20108 if (args.maximum != 1) { 20109 message += 's'; 20110 } 20111 20112 return message; 20113 }, 20114 noResults: function () { 20115 return 'No results found'; 20116 }, 20117 searching: function () { 20118 return 'Searchingâ¦'; 20119 }, 20120 removeAllItems: function () { 20121 return 'Remove all items'; 20122 } 20123 }; 20124}); 20125 20126S2.define('select2/defaults',[ 20127 'jquery', 20128 'require', 20129 20130 './results', 20131 20132 './selection/single', 20133 './selection/multiple', 20134 './selection/placeholder', 20135 './selection/allowClear', 20136 './selection/search', 20137 './selection/eventRelay', 20138 20139 './utils', 20140 './translation', 20141 './diacritics', 20142 20143 './data/select', 20144 './data/array', 20145 './data/ajax', 20146 './data/tags', 20147 './data/tokenizer', 20148 './data/minimumInputLength', 20149 './data/maximumInputLength', 20150 './data/maximumSelectionLength', 20151 20152 './dropdown', 20153 './dropdown/search', 20154 './dropdown/hidePlaceholder', 20155 './dropdown/infiniteScroll', 20156 './dropdown/attachBody', 20157 './dropdown/minimumResultsForSearch', 20158 './dropdown/selectOnClose', 20159 './dropdown/closeOnSelect', 20160 20161 './i18n/en' 20162], function ($, require, 20163 20164 ResultsList, 20165 20166 SingleSelection, MultipleSelection, Placeholder, AllowClear, 20167 SelectionSearch, EventRelay, 20168 20169 Utils, Translation, DIACRITICS, 20170 20171 SelectData, ArrayData, AjaxData, Tags, Tokenizer, 20172 MinimumInputLength, MaximumInputLength, MaximumSelectionLength, 20173 20174 Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, 20175 AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, 20176 20177 EnglishTranslation) { 20178 function Defaults () { 20179 this.reset(); 20180 } 20181 20182 Defaults.prototype.apply = function (options) { 20183 options = $.extend(true, {}, this.defaults, options); 20184 20185 if (options.dataAdapter == null) { 20186 if (options.ajax != null) { 20187 options.dataAdapter = AjaxData; 20188 } else if (options.data != null) { 20189 options.dataAdapter = ArrayData; 20190 } else { 20191 options.dataAdapter = SelectData; 20192 } 20193 20194 if (options.minimumInputLength > 0) { 20195 options.dataAdapter = Utils.Decorate( 20196 options.dataAdapter, 20197 MinimumInputLength 20198 ); 20199 } 20200 20201 if (options.maximumInputLength > 0) { 20202 options.dataAdapter = Utils.Decorate( 20203 options.dataAdapter, 20204 MaximumInputLength 20205 ); 20206 } 20207 20208 if (options.maximumSelectionLength > 0) { 20209 options.dataAdapter = Utils.Decorate( 20210 options.dataAdapter, 20211 MaximumSelectionLength 20212 ); 20213 } 20214 20215 if (options.tags) { 20216 options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); 20217 } 20218 20219 if (options.tokenSeparators != null || options.tokenizer != null) { 20220 options.dataAdapter = Utils.Decorate( 20221 options.dataAdapter, 20222 Tokenizer 20223 ); 20224 } 20225 20226 if (options.query != null) { 20227 var Query = require(options.amdBase + 'compat/query'); 20228 20229 options.dataAdapter = Utils.Decorate( 20230 options.dataAdapter, 20231 Query 20232 ); 20233 } 20234 20235 if (options.initSelection != null) { 20236 var InitSelection = require(options.amdBase + 'compat/initSelection'); 20237 20238 options.dataAdapter = Utils.Decorate( 20239 options.dataAdapter, 20240 InitSelection 20241 ); 20242 } 20243 } 20244 20245 if (options.resultsAdapter == null) { 20246 options.resultsAdapter = ResultsList; 20247 20248 if (options.ajax != null) { 20249 options.resultsAdapter = Utils.Decorate( 20250 options.resultsAdapter, 20251 InfiniteScroll 20252 ); 20253 } 20254 20255 if (options.placeholder != null) { 20256 options.resultsAdapter = Utils.Decorate( 20257 options.resultsAdapter, 20258 HidePlaceholder 20259 ); 20260 } 20261 20262 if (options.selectOnClose) { 20263 options.resultsAdapter = Utils.Decorate( 20264 options.resultsAdapter, 20265 SelectOnClose 20266 ); 20267 } 20268 } 20269 20270 if (options.dropdownAdapter == null) { 20271 if (options.multiple) { 20272 options.dropdownAdapter = Dropdown; 20273 } else { 20274 var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); 20275 20276 options.dropdownAdapter = SearchableDropdown; 20277 } 20278 20279 if (options.minimumResultsForSearch !== 0) { 20280 options.dropdownAdapter = Utils.Decorate( 20281 options.dropdownAdapter, 20282 MinimumResultsForSearch 20283 ); 20284 } 20285 20286 if (options.closeOnSelect) { 20287 options.dropdownAdapter = Utils.Decorate( 20288 options.dropdownAdapter, 20289 CloseOnSelect 20290 ); 20291 } 20292 20293 if ( 20294 options.dropdownCssClass != null || 20295 options.dropdownCss != null || 20296 options.adaptDropdownCssClass != null 20297 ) { 20298 var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); 20299 20300 options.dropdownAdapter = Utils.Decorate( 20301 options.dropdownAdapter, 20302 DropdownCSS 20303 ); 20304 } 20305 20306 options.dropdownAdapter = Utils.Decorate( 20307 options.dropdownAdapter, 20308 AttachBody 20309 ); 20310 } 20311 20312 if (options.selectionAdapter == null) { 20313 if (options.multiple) { 20314 options.selectionAdapter = MultipleSelection; 20315 } else { 20316 options.selectionAdapter = SingleSelection; 20317 } 20318 20319 // Add the placeholder mixin if a placeholder was specified 20320 if (options.placeholder != null) { 20321 options.selectionAdapter = Utils.Decorate( 20322 options.selectionAdapter, 20323 Placeholder 20324 ); 20325 } 20326 20327 if (options.allowClear) { 20328 options.selectionAdapter = Utils.Decorate( 20329 options.selectionAdapter, 20330 AllowClear 20331 ); 20332 } 20333 20334 if (options.multiple) { 20335 options.selectionAdapter = Utils.Decorate( 20336 options.selectionAdapter, 20337 SelectionSearch 20338 ); 20339 } 20340 20341 if ( 20342 options.containerCssClass != null || 20343 options.containerCss != null || 20344 options.adaptContainerCssClass != null 20345 ) { 20346 var ContainerCSS = require(options.amdBase + 'compat/containerCss'); 20347 20348 options.selectionAdapter = Utils.Decorate( 20349 options.selectionAdapter, 20350 ContainerCSS 20351 ); 20352 } 20353 20354 options.selectionAdapter = Utils.Decorate( 20355 options.selectionAdapter, 20356 EventRelay 20357 ); 20358 } 20359 20360 // If the defaults were not previously applied from an element, it is 20361 // possible for the language option to have not been resolved 20362 options.language = this._resolveLanguage(options.language); 20363 20364 // Always fall back to English since it will always be complete 20365 options.language.push('en'); 20366 20367 var uniqueLanguages = []; 20368 20369 for (var l = 0; l < options.language.length; l++) { 20370 var language = options.language[l]; 20371 20372 if (uniqueLanguages.indexOf(language) === -1) { 20373 uniqueLanguages.push(language); 20374 } 20375 } 20376 20377 options.language = uniqueLanguages; 20378 20379 options.translations = this._processTranslations( 20380 options.language, 20381 options.debug 20382 ); 20383 20384 return options; 20385 }; 20386 20387 Defaults.prototype.reset = function () { 20388 function stripDiacritics (text) { 20389 // Used 'uni range + named function' from http://jsperf.com/diacritics/18 20390 function match(a) { 20391 return DIACRITICS[a] || a; 20392 } 20393 20394 return text.replace(/[^\u0000-\u007E]/g, match); 20395 } 20396 20397 function matcher (params, data) { 20398 // Always return the object if there is nothing to compare 20399 if ($.trim(params.term) === '') { 20400 return data; 20401 } 20402 20403 // Do a recursive check for options with children 20404 if (data.children && data.children.length > 0) { 20405 // Clone the data object if there are children 20406 // This is required as we modify the object to remove any non-matches 20407 var match = $.extend(true, {}, data); 20408 20409 // Check each child of the option 20410 for (var c = data.children.length - 1; c >= 0; c--) { 20411 var child = data.children[c]; 20412 20413 var matches = matcher(params, child); 20414 20415 // If there wasn't a match, remove the object in the array 20416 if (matches == null) { 20417 match.children.splice(c, 1); 20418 } 20419 } 20420 20421 // If any children matched, return the new object 20422 if (match.children.length > 0) { 20423 return match; 20424 } 20425 20426 // If there were no matching children, check just the plain object 20427 return matcher(params, match); 20428 } 20429 20430 var original = stripDiacritics(data.text).toUpperCase(); 20431 var term = stripDiacritics(params.term).toUpperCase(); 20432 20433 // Check if the text contains the term 20434 if (original.indexOf(term) > -1) { 20435 return data; 20436 } 20437 20438 // If it doesn't contain the term, don't return anything 20439 return null; 20440 } 20441 20442 this.defaults = { 20443 amdBase: './', 20444 amdLanguageBase: './i18n/', 20445 closeOnSelect: true, 20446 debug: false, 20447 dropdownAutoWidth: false, 20448 escapeMarkup: Utils.escapeMarkup, 20449 language: {}, 20450 matcher: matcher, 20451 minimumInputLength: 0, 20452 maximumInputLength: 0, 20453 maximumSelectionLength: 0, 20454 minimumResultsForSearch: 0, 20455 selectOnClose: false, 20456 scrollAfterSelect: false, 20457 sorter: function (data) { 20458 return data; 20459 }, 20460 templateResult: function (result) { 20461 return result.text; 20462 }, 20463 templateSelection: function (selection) { 20464 return selection.text; 20465 }, 20466 theme: 'default', 20467 width: 'resolve' 20468 }; 20469 }; 20470 20471 Defaults.prototype.applyFromElement = function (options, $element) { 20472 var optionLanguage = options.language; 20473 var defaultLanguage = this.defaults.language; 20474 var elementLanguage = $element.prop('lang'); 20475 var parentLanguage = $element.closest('[lang]').prop('lang'); 20476 20477 var languages = Array.prototype.concat.call( 20478 this._resolveLanguage(elementLanguage), 20479 this._resolveLanguage(optionLanguage), 20480 this._resolveLanguage(defaultLanguage), 20481 this._resolveLanguage(parentLanguage) 20482 ); 20483 20484 options.language = languages; 20485 20486 return options; 20487 }; 20488 20489 Defaults.prototype._resolveLanguage = function (language) { 20490 if (!language) { 20491 return []; 20492 } 20493 20494 if ($.isEmptyObject(language)) { 20495 return []; 20496 } 20497 20498 if ($.isPlainObject(language)) { 20499 return [language]; 20500 } 20501 20502 var languages; 20503 20504 if (!$.isArray(language)) { 20505 languages = [language]; 20506 } else { 20507 languages = language; 20508 } 20509 20510 var resolvedLanguages = []; 20511 20512 for (var l = 0; l < languages.length; l++) { 20513 resolvedLanguages.push(languages[l]); 20514 20515 if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) { 20516 // Extract the region information if it is included 20517 var languageParts = languages[l].split('-'); 20518 var baseLanguage = languageParts[0]; 20519 20520 resolvedLanguages.push(baseLanguage); 20521 } 20522 } 20523 20524 return resolvedLanguages; 20525 }; 20526 20527 Defaults.prototype._processTranslations = function (languages, debug) { 20528 var translations = new Translation(); 20529 20530 for (var l = 0; l < languages.length; l++) { 20531 var languageData = new Translation(); 20532 20533 var language = languages[l]; 20534 20535 if (typeof language === 'string') { 20536 try { 20537 // Try to load it with the original name 20538 languageData = Translation.loadPath(language); 20539 } catch (e) { 20540 try { 20541 // If we couldn't load it, check if it wasn't the full path 20542 language = this.defaults.amdLanguageBase + language; 20543 languageData = Translation.loadPath(language); 20544 } catch (ex) { 20545 // The translation could not be loaded at all. Sometimes this is 20546 // because of a configuration problem, other times this can be 20547 // because of how Select2 helps load all possible translation files 20548 if (debug && window.console && console.warn) { 20549 console.warn( 20550 'Select2: The language file for "' + language + '" could ' + 20551 'not be automatically loaded. A fallback will be used instead.' 20552 ); 20553 } 20554 } 20555 } 20556 } else if ($.isPlainObject(language)) { 20557 languageData = new Translation(language); 20558 } else { 20559 languageData = language; 20560 } 20561 20562 translations.extend(languageData); 20563 } 20564 20565 return translations; 20566 }; 20567 20568 Defaults.prototype.set = function (key, value) { 20569 var camelKey = $.camelCase(key); 20570 20571 var data = {}; 20572 data[camelKey] = value; 20573 20574 var convertedData = Utils._convertData(data); 20575 20576 $.extend(true, this.defaults, convertedData); 20577 }; 20578 20579 var defaults = new Defaults(); 20580 20581 return defaults; 20582}); 20583 20584S2.define('select2/options',[ 20585 'require', 20586 'jquery', 20587 './defaults', 20588 './utils' 20589], function (require, $, Defaults, Utils) { 20590 function Options (options, $element) { 20591 this.options = options; 20592 20593 if ($element != null) { 20594 this.fromElement($element); 20595 } 20596 20597 if ($element != null) { 20598 this.options = Defaults.applyFromElement(this.options, $element); 20599 } 20600 20601 this.options = Defaults.apply(this.options); 20602 20603 if ($element && $element.is('input')) { 20604 var InputCompat = require(this.get('amdBase') + 'compat/inputData'); 20605 20606 this.options.dataAdapter = Utils.Decorate( 20607 this.options.dataAdapter, 20608 InputCompat 20609 ); 20610 } 20611 } 20612 20613 Options.prototype.fromElement = function ($e) { 20614 var excludedData = ['select2']; 20615 20616 if (this.options.multiple == null) { 20617 this.options.multiple = $e.prop('multiple'); 20618 } 20619 20620 if (this.options.disabled == null) { 20621 this.options.disabled = $e.prop('disabled'); 20622 } 20623 20624 if (this.options.dir == null) { 20625 if ($e.prop('dir')) { 20626 this.options.dir = $e.prop('dir'); 20627 } else if ($e.closest('[dir]').prop('dir')) { 20628 this.options.dir = $e.closest('[dir]').prop('dir'); 20629 } else { 20630 this.options.dir = 'ltr'; 20631 } 20632 } 20633 20634 $e.prop('disabled', this.options.disabled); 20635 $e.prop('multiple', this.options.multiple); 20636 20637 if (Utils.GetData($e[0], 'select2Tags')) { 20638 if (this.options.debug && window.console && console.warn) { 20639 console.warn( 20640 'Select2: The `data-select2-tags` attribute has been changed to ' + 20641 'use the `data-data` and `data-tags="true"` attributes and will be ' + 20642 'removed in future versions of Select2.' 20643 ); 20644 } 20645 20646 Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); 20647 Utils.StoreData($e[0], 'tags', true); 20648 } 20649 20650 if (Utils.GetData($e[0], 'ajaxUrl')) { 20651 if (this.options.debug && window.console && console.warn) { 20652 console.warn( 20653 'Select2: The `data-ajax-url` attribute has been changed to ' + 20654 '`data-ajax--url` and support for the old attribute will be removed' + 20655 ' in future versions of Select2.' 20656 ); 20657 } 20658 20659 $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); 20660 Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); 20661 } 20662 20663 var dataset = {}; 20664 20665 function upperCaseLetter(_, letter) { 20666 return letter.toUpperCase(); 20667 } 20668 20669 // Pre-load all of the attributes which are prefixed with `data-` 20670 for (var attr = 0; attr < $e[0].attributes.length; attr++) { 20671 var attributeName = $e[0].attributes[attr].name; 20672 var prefix = 'data-'; 20673 20674 if (attributeName.substr(0, prefix.length) == prefix) { 20675 // Get the contents of the attribute after `data-` 20676 var dataName = attributeName.substring(prefix.length); 20677 20678 // Get the data contents from the consistent source 20679 // This is more than likely the jQuery data helper 20680 var dataValue = Utils.GetData($e[0], dataName); 20681 20682 // camelCase the attribute name to match the spec 20683 var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter); 20684 20685 // Store the data attribute contents into the dataset since 20686 dataset[camelDataName] = dataValue; 20687 } 20688 } 20689 20690 // Prefer the element's `dataset` attribute if it exists 20691 // jQuery 1.x does not correctly handle data attributes with multiple dashes 20692 if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { 20693 dataset = $.extend(true, {}, $e[0].dataset, dataset); 20694 } 20695 20696 // Prefer our internal data cache if it exists 20697 var data = $.extend(true, {}, Utils.GetData($e[0]), dataset); 20698 20699 data = Utils._convertData(data); 20700 20701 for (var key in data) { 20702 if ($.inArray(key, excludedData) > -1) { 20703 continue; 20704 } 20705 20706 if ($.isPlainObject(this.options[key])) { 20707 $.extend(this.options[key], data[key]); 20708 } else { 20709 this.options[key] = data[key]; 20710 } 20711 } 20712 20713 return this; 20714 }; 20715 20716 Options.prototype.get = function (key) { 20717 return this.options[key]; 20718 }; 20719 20720 Options.prototype.set = function (key, val) { 20721 this.options[key] = val; 20722 }; 20723 20724 return Options; 20725}); 20726 20727S2.define('select2/core',[ 20728 'jquery', 20729 './options', 20730 './utils', 20731 './keys' 20732], function ($, Options, Utils, KEYS) { 20733 var Select2 = function ($element, options) { 20734 if (Utils.GetData($element[0], 'select2') != null) { 20735 Utils.GetData($element[0], 'select2').destroy(); 20736 } 20737 20738 this.$element = $element; 20739 20740 this.id = this._generateId($element); 20741 20742 options = options || {}; 20743 20744 this.options = new Options(options, $element); 20745 20746 Select2.__super__.constructor.call(this); 20747 20748 // Set up the tabindex 20749 20750 var tabindex = $element.attr('tabindex') || 0; 20751 Utils.StoreData($element[0], 'old-tabindex', tabindex); 20752 $element.attr('tabindex', '-1'); 20753 20754 // Set up containers and adapters 20755 20756 var DataAdapter = this.options.get('dataAdapter'); 20757 this.dataAdapter = new DataAdapter($element, this.options); 20758 20759 var $container = this.render(); 20760 20761 this._placeContainer($container); 20762 20763 var SelectionAdapter = this.options.get('selectionAdapter'); 20764 this.selection = new SelectionAdapter($element, this.options); 20765 this.$selection = this.selection.render(); 20766 20767 this.selection.position(this.$selection, $container); 20768 20769 var DropdownAdapter = this.options.get('dropdownAdapter'); 20770 this.dropdown = new DropdownAdapter($element, this.options); 20771 this.$dropdown = this.dropdown.render(); 20772 20773 this.dropdown.position(this.$dropdown, $container); 20774 20775 var ResultsAdapter = this.options.get('resultsAdapter'); 20776 this.results = new ResultsAdapter($element, this.options, this.dataAdapter); 20777 this.$results = this.results.render(); 20778 20779 this.results.position(this.$results, this.$dropdown); 20780 20781 // Bind events 20782 20783 var self = this; 20784 20785 // Bind the container to all of the adapters 20786 this._bindAdapters(); 20787 20788 // Register any DOM event handlers 20789 this._registerDomEvents(); 20790 20791 // Register any internal event handlers 20792 this._registerDataEvents(); 20793 this._registerSelectionEvents(); 20794 this._registerDropdownEvents(); 20795 this._registerResultsEvents(); 20796 this._registerEvents(); 20797 20798 // Set the initial state 20799 this.dataAdapter.current(function (initialData) { 20800 self.trigger('selection:update', { 20801 data: initialData 20802 }); 20803 }); 20804 20805 // Hide the original select 20806 $element.addClass('select2-hidden-accessible'); 20807 $element.attr('aria-hidden', 'true'); 20808 20809 // Synchronize any monitored attributes 20810 this._syncAttributes(); 20811 20812 Utils.StoreData($element[0], 'select2', this); 20813 20814 // Ensure backwards compatibility with $element.data('select2'). 20815 $element.data('select2', this); 20816 }; 20817 20818 Utils.Extend(Select2, Utils.Observable); 20819 20820 Select2.prototype._generateId = function ($element) { 20821 var id = ''; 20822 20823 if ($element.attr('id') != null) { 20824 id = $element.attr('id'); 20825 } else if ($element.attr('name') != null) { 20826 id = $element.attr('name') + '-' + Utils.generateChars(2); 20827 } else { 20828 id = Utils.generateChars(4); 20829 } 20830 20831 id = id.replace(/(:|\.|\[|\]|,)/g, ''); 20832 id = 'select2-' + id; 20833 20834 return id; 20835 }; 20836 20837 Select2.prototype._placeContainer = function ($container) { 20838 $container.insertAfter(this.$element); 20839 20840 var width = this._resolveWidth(this.$element, this.options.get('width')); 20841 20842 if (width != null) { 20843 $container.css('width', width); 20844 } 20845 }; 20846 20847 Select2.prototype._resolveWidth = function ($element, method) { 20848 var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; 20849 20850 if (method == 'resolve') { 20851 var styleWidth = this._resolveWidth($element, 'style'); 20852 20853 if (styleWidth != null) { 20854 return styleWidth; 20855 } 20856 20857 return this._resolveWidth($element, 'element'); 20858 } 20859 20860 if (method == 'element') { 20861 var elementWidth = $element.outerWidth(false); 20862 20863 if (elementWidth <= 0) { 20864 return 'auto'; 20865 } 20866 20867 return elementWidth + 'px'; 20868 } 20869 20870 if (method == 'style') { 20871 var style = $element.attr('style'); 20872 20873 if (typeof(style) !== 'string') { 20874 return null; 20875 } 20876 20877 var attrs = style.split(';'); 20878 20879 for (var i = 0, l = attrs.length; i < l; i = i + 1) { 20880 var attr = attrs[i].replace(/\s/g, ''); 20881 var matches = attr.match(WIDTH); 20882 20883 if (matches !== null && matches.length >= 1) { 20884 return matches[1]; 20885 } 20886 } 20887 20888 return null; 20889 } 20890 20891 if (method == 'computedstyle') { 20892 var computedStyle = window.getComputedStyle($element[0]); 20893 20894 return computedStyle.width; 20895 } 20896 20897 return method; 20898 }; 20899 20900 Select2.prototype._bindAdapters = function () { 20901 this.dataAdapter.bind(this, this.$container); 20902 this.selection.bind(this, this.$container); 20903 20904 this.dropdown.bind(this, this.$container); 20905 this.results.bind(this, this.$container); 20906 }; 20907 20908 Select2.prototype._registerDomEvents = function () { 20909 var self = this; 20910 20911 this.$element.on('change.select2', function () { 20912 self.dataAdapter.current(function (data) { 20913 self.trigger('selection:update', { 20914 data: data 20915 }); 20916 }); 20917 }); 20918 20919 this.$element.on('focus.select2', function (evt) { 20920 self.trigger('focus', evt); 20921 }); 20922 20923 this._syncA = Utils.bind(this._syncAttributes, this); 20924 this._syncS = Utils.bind(this._syncSubtree, this); 20925 20926 if (this.$element[0].attachEvent) { 20927 this.$element[0].attachEvent('onpropertychange', this._syncA); 20928 } 20929 20930 var observer = window.MutationObserver || 20931 window.WebKitMutationObserver || 20932 window.MozMutationObserver 20933 ; 20934 20935 if (observer != null) { 20936 this._observer = new observer(function (mutations) { 20937 self._syncA(); 20938 self._syncS(null, mutations); 20939 }); 20940 this._observer.observe(this.$element[0], { 20941 attributes: true, 20942 childList: true, 20943 subtree: false 20944 }); 20945 } else if (this.$element[0].addEventListener) { 20946 this.$element[0].addEventListener( 20947 'DOMAttrModified', 20948 self._syncA, 20949 false 20950 ); 20951 this.$element[0].addEventListener( 20952 'DOMNodeInserted', 20953 self._syncS, 20954 false 20955 ); 20956 this.$element[0].addEventListener( 20957 'DOMNodeRemoved', 20958 self._syncS, 20959 false 20960 ); 20961 } 20962 }; 20963 20964 Select2.prototype._registerDataEvents = function () { 20965 var self = this; 20966 20967 this.dataAdapter.on('*', function (name, params) { 20968 self.trigger(name, params); 20969 }); 20970 }; 20971 20972 Select2.prototype._registerSelectionEvents = function () { 20973 var self = this; 20974 var nonRelayEvents = ['toggle', 'focus']; 20975 20976 this.selection.on('toggle', function () { 20977 self.toggleDropdown(); 20978 }); 20979 20980 this.selection.on('focus', function (params) { 20981 self.focus(params); 20982 }); 20983 20984 this.selection.on('*', function (name, params) { 20985 if ($.inArray(name, nonRelayEvents) !== -1) { 20986 return; 20987 } 20988 20989 self.trigger(name, params); 20990 }); 20991 }; 20992 20993 Select2.prototype._registerDropdownEvents = function () { 20994 var self = this; 20995 20996 this.dropdown.on('*', function (name, params) { 20997 self.trigger(name, params); 20998 }); 20999 }; 21000 21001 Select2.prototype._registerResultsEvents = function () { 21002 var self = this; 21003 21004 this.results.on('*', function (name, params) { 21005 self.trigger(name, params); 21006 }); 21007 }; 21008 21009 Select2.prototype._registerEvents = function () { 21010 var self = this; 21011 21012 this.on('open', function () { 21013 self.$container.addClass('select2-container--open'); 21014 }); 21015 21016 this.on('close', function () { 21017 self.$container.removeClass('select2-container--open'); 21018 }); 21019 21020 this.on('enable', function () { 21021 self.$container.removeClass('select2-container--disabled'); 21022 }); 21023 21024 this.on('disable', function () { 21025 self.$container.addClass('select2-container--disabled'); 21026 }); 21027 21028 this.on('blur', function () { 21029 self.$container.removeClass('select2-container--focus'); 21030 }); 21031 21032 this.on('query', function (params) { 21033 if (!self.isOpen()) { 21034 self.trigger('open', {}); 21035 } 21036 21037 this.dataAdapter.query(params, function (data) { 21038 self.trigger('results:all', { 21039 data: data, 21040 query: params 21041 }); 21042 }); 21043 }); 21044 21045 this.on('query:append', function (params) { 21046 this.dataAdapter.query(params, function (data) { 21047 self.trigger('results:append', { 21048 data: data, 21049 query: params 21050 }); 21051 }); 21052 }); 21053 21054 this.on('keypress', function (evt) { 21055 var key = evt.which; 21056 21057 if (self.isOpen()) { 21058 if (key === KEYS.ESC || key === KEYS.TAB || 21059 (key === KEYS.UP && evt.altKey)) { 21060 self.close(evt); 21061 21062 evt.preventDefault(); 21063 } else if (key === KEYS.ENTER) { 21064 self.trigger('results:select', {}); 21065 21066 evt.preventDefault(); 21067 } else if ((key === KEYS.SPACE && evt.ctrlKey)) { 21068 self.trigger('results:toggle', {}); 21069 21070 evt.preventDefault(); 21071 } else if (key === KEYS.UP) { 21072 self.trigger('results:previous', {}); 21073 21074 evt.preventDefault(); 21075 } else if (key === KEYS.DOWN) { 21076 self.trigger('results:next', {}); 21077 21078 evt.preventDefault(); 21079 } 21080 } else { 21081 if (key === KEYS.ENTER || key === KEYS.SPACE || 21082 (key === KEYS.DOWN && evt.altKey)) { 21083 self.open(); 21084 21085 evt.preventDefault(); 21086 } 21087 } 21088 }); 21089 }; 21090 21091 Select2.prototype._syncAttributes = function () { 21092 this.options.set('disabled', this.$element.prop('disabled')); 21093 21094 if (this.isDisabled()) { 21095 if (this.isOpen()) { 21096 this.close(); 21097 } 21098 21099 this.trigger('disable', {}); 21100 } else { 21101 this.trigger('enable', {}); 21102 } 21103 }; 21104 21105 Select2.prototype._isChangeMutation = function (evt, mutations) { 21106 var changed = false; 21107 var self = this; 21108 21109 // Ignore any mutation events raised for elements that aren't options or 21110 // optgroups. This handles the case when the select element is destroyed 21111 if ( 21112 evt && evt.target && ( 21113 evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' 21114 ) 21115 ) { 21116 return; 21117 } 21118 21119 if (!mutations) { 21120 // If mutation events aren't supported, then we can only assume that the 21121 // change affected the selections 21122 changed = true; 21123 } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { 21124 for (var n = 0; n < mutations.addedNodes.length; n++) { 21125 var node = mutations.addedNodes[n]; 21126 21127 if (node.selected) { 21128 changed = true; 21129 } 21130 } 21131 } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { 21132 changed = true; 21133 } else if ($.isArray(mutations)) { 21134 $.each(mutations, function(evt, mutation) { 21135 if (self._isChangeMutation(evt, mutation)) { 21136 // We've found a change mutation. 21137 // Let's escape from the loop and continue 21138 changed = true; 21139 return false; 21140 } 21141 }); 21142 } 21143 return changed; 21144 }; 21145 21146 Select2.prototype._syncSubtree = function (evt, mutations) { 21147 var changed = this._isChangeMutation(evt, mutations); 21148 var self = this; 21149 21150 // Only re-pull the data if we think there is a change 21151 if (changed) { 21152 this.dataAdapter.current(function (currentData) { 21153 self.trigger('selection:update', { 21154 data: currentData 21155 }); 21156 }); 21157 } 21158 }; 21159 21160 /** 21161 * Override the trigger method to automatically trigger pre-events when 21162 * there are events that can be prevented. 21163 */ 21164 Select2.prototype.trigger = function (name, args) { 21165 var actualTrigger = Select2.__super__.trigger; 21166 var preTriggerMap = { 21167 'open': 'opening', 21168 'close': 'closing', 21169 'select': 'selecting', 21170 'unselect': 'unselecting', 21171 'clear': 'clearing' 21172 }; 21173 21174 if (args === undefined) { 21175 args = {}; 21176 } 21177 21178 if (name in preTriggerMap) { 21179 var preTriggerName = preTriggerMap[name]; 21180 var preTriggerArgs = { 21181 prevented: false, 21182 name: name, 21183 args: args 21184 }; 21185 21186 actualTrigger.call(this, preTriggerName, preTriggerArgs); 21187 21188 if (preTriggerArgs.prevented) { 21189 args.prevented = true; 21190 21191 return; 21192 } 21193 } 21194 21195 actualTrigger.call(this, name, args); 21196 }; 21197 21198 Select2.prototype.toggleDropdown = function () { 21199 if (this.isDisabled()) { 21200 return; 21201 } 21202 21203 if (this.isOpen()) { 21204 this.close(); 21205 } else { 21206 this.open(); 21207 } 21208 }; 21209 21210 Select2.prototype.open = function () { 21211 if (this.isOpen()) { 21212 return; 21213 } 21214 21215 if (this.isDisabled()) { 21216 return; 21217 } 21218 21219 this.trigger('query', {}); 21220 }; 21221 21222 Select2.prototype.close = function (evt) { 21223 if (!this.isOpen()) { 21224 return; 21225 } 21226 21227 this.trigger('close', { originalEvent : evt }); 21228 }; 21229 21230 /** 21231 * Helper method to abstract the "enabled" (not "disabled") state of this 21232 * object. 21233 * 21234 * @return {true} if the instance is not disabled. 21235 * @return {false} if the instance is disabled. 21236 */ 21237 Select2.prototype.isEnabled = function () { 21238 return !this.isDisabled(); 21239 }; 21240 21241 /** 21242 * Helper method to abstract the "disabled" state of this object. 21243 * 21244 * @return {true} if the disabled option is true. 21245 * @return {false} if the disabled option is false. 21246 */ 21247 Select2.prototype.isDisabled = function () { 21248 return this.options.get('disabled'); 21249 }; 21250 21251 Select2.prototype.isOpen = function () { 21252 return this.$container.hasClass('select2-container--open'); 21253 }; 21254 21255 Select2.prototype.hasFocus = function () { 21256 return this.$container.hasClass('select2-container--focus'); 21257 }; 21258 21259 Select2.prototype.focus = function (data) { 21260 // No need to re-trigger focus events if we are already focused 21261 if (this.hasFocus()) { 21262 return; 21263 } 21264 21265 this.$container.addClass('select2-container--focus'); 21266 this.trigger('focus', {}); 21267 }; 21268 21269 Select2.prototype.enable = function (args) { 21270 if (this.options.get('debug') && window.console && console.warn) { 21271 console.warn( 21272 'Select2: The `select2("enable")` method has been deprecated and will' + 21273 ' be removed in later Select2 versions. Use $element.prop("disabled")' + 21274 ' instead.' 21275 ); 21276 } 21277 21278 if (args == null || args.length === 0) { 21279 args = [true]; 21280 } 21281 21282 var disabled = !args[0]; 21283 21284 this.$element.prop('disabled', disabled); 21285 }; 21286 21287 Select2.prototype.data = function () { 21288 if (this.options.get('debug') && 21289 arguments.length > 0 && window.console && console.warn) { 21290 console.warn( 21291 'Select2: Data can no longer be set using `select2("data")`. You ' + 21292 'should consider setting the value instead using `$element.val()`.' 21293 ); 21294 } 21295 21296 var data = []; 21297 21298 this.dataAdapter.current(function (currentData) { 21299 data = currentData; 21300 }); 21301 21302 return data; 21303 }; 21304 21305 Select2.prototype.val = function (args) { 21306 if (this.options.get('debug') && window.console && console.warn) { 21307 console.warn( 21308 'Select2: The `select2("val")` method has been deprecated and will be' + 21309 ' removed in later Select2 versions. Use $element.val() instead.' 21310 ); 21311 } 21312 21313 if (args == null || args.length === 0) { 21314 return this.$element.val(); 21315 } 21316 21317 var newVal = args[0]; 21318 21319 if ($.isArray(newVal)) { 21320 newVal = $.map(newVal, function (obj) { 21321 return obj.toString(); 21322 }); 21323 } 21324 21325 this.$element.val(newVal).trigger('input').trigger('change'); 21326 }; 21327 21328 Select2.prototype.destroy = function () { 21329 this.$container.remove(); 21330 21331 if (this.$element[0].detachEvent) { 21332 this.$element[0].detachEvent('onpropertychange', this._syncA); 21333 } 21334 21335 if (this._observer != null) { 21336 this._observer.disconnect(); 21337 this._observer = null; 21338 } else if (this.$element[0].removeEventListener) { 21339 this.$element[0] 21340 .removeEventListener('DOMAttrModified', this._syncA, false); 21341 this.$element[0] 21342 .removeEventListener('DOMNodeInserted', this._syncS, false); 21343 this.$element[0] 21344 .removeEventListener('DOMNodeRemoved', this._syncS, false); 21345 } 21346 21347 this._syncA = null; 21348 this._syncS = null; 21349 21350 this.$element.off('.select2'); 21351 this.$element.attr('tabindex', 21352 Utils.GetData(this.$element[0], 'old-tabindex')); 21353 21354 this.$element.removeClass('select2-hidden-accessible'); 21355 this.$element.attr('aria-hidden', 'false'); 21356 Utils.RemoveData(this.$element[0]); 21357 this.$element.removeData('select2'); 21358 21359 this.dataAdapter.destroy(); 21360 this.selection.destroy(); 21361 this.dropdown.destroy(); 21362 this.results.destroy(); 21363 21364 this.dataAdapter = null; 21365 this.selection = null; 21366 this.dropdown = null; 21367 this.results = null; 21368 }; 21369 21370 Select2.prototype.render = function () { 21371 var $container = $( 21372 '<span class="select2 select2-container">' + 21373 '<span class="selection"></span>' + 21374 '<span class="dropdown-wrapper" aria-hidden="true"></span>' + 21375 '</span>' 21376 ); 21377 21378 $container.attr('dir', this.options.get('dir')); 21379 21380 this.$container = $container; 21381 21382 this.$container.addClass('select2-container--' + this.options.get('theme')); 21383 21384 Utils.StoreData($container[0], 'element', this.$element); 21385 21386 return $container; 21387 }; 21388 21389 return Select2; 21390}); 21391 21392S2.define('jquery-mousewheel',[ 21393 'jquery' 21394], function ($) { 21395 // Used to shim jQuery.mousewheel for non-full builds. 21396 return $; 21397}); 21398 21399S2.define('jquery.select2',[ 21400 'jquery', 21401 'jquery-mousewheel', 21402 21403 './select2/core', 21404 './select2/defaults', 21405 './select2/utils' 21406], function ($, _, Select2, Defaults, Utils) { 21407 if ($.fn.select2 == null) { 21408 // All methods that should return the element 21409 var thisMethods = ['open', 'close', 'destroy']; 21410 21411 $.fn.select2 = function (options) { 21412 options = options || {}; 21413 21414 if (typeof options === 'object') { 21415 this.each(function () { 21416 var instanceOptions = $.extend(true, {}, options); 21417 21418 var instance = new Select2($(this), instanceOptions); 21419 }); 21420 21421 return this; 21422 } else if (typeof options === 'string') { 21423 var ret; 21424 var args = Array.prototype.slice.call(arguments, 1); 21425 21426 this.each(function () { 21427 var instance = Utils.GetData(this, 'select2'); 21428 21429 if (instance == null && window.console && console.error) { 21430 console.error( 21431 'The select2(\'' + options + '\') method was called on an ' + 21432 'element that is not using Select2.' 21433 ); 21434 } 21435 21436 ret = instance[options].apply(instance, args); 21437 }); 21438 21439 // Check if we should be returning `this` 21440 if ($.inArray(options, thisMethods) > -1) { 21441 return this; 21442 } 21443 21444 return ret; 21445 } else { 21446 throw new Error('Invalid arguments for Select2: ' + options); 21447 } 21448 }; 21449 } 21450 21451 if ($.fn.select2.defaults == null) { 21452 $.fn.select2.defaults = Defaults; 21453 } 21454 21455 return Select2; 21456}); 21457 21458 // Return the AMD loader configuration so it can be used outside of this file 21459 return { 21460 define: S2.define, 21461 require: S2.require 21462 }; 21463}()); 21464 21465 // Autoload the jQuery bindings 21466 // We know that all of the modules exist above this, so we're safe 21467 var select2 = S2.require('jquery.select2'); 21468 21469 // Hold the AMD module references on the jQuery function that was just loaded 21470 // This allows Select2 to use the internal loader outside of this file, such 21471 // as in the language files. 21472 jQuery.fn.select2.amd = S2; 21473 21474 // Return the Select2 instance for anyone who is importing it. 21475 return select2; 21476})); 21477 21478 21479/***/ }), 21480
vendor: 90,324 bytes, lines 21481-24744
21481/***/ "./Themes/Cynoebook/node_modules/selectize/dist/js/selectize.js": 21482/*!**********************************************************************!*\ 21483 !*** ./Themes/Cynoebook/node_modules/selectize/dist/js/selectize.js ***! 21484 \**********************************************************************/ 21485/*! no static exports found */ 21486/***/ (function(module, exports, __webpack_require__) { 21487 21488var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** 21489 * selectize.js (v0.12.6) 21490 * Copyright (c) 2013â2015 Brian Reavis & contributors 21491 * 21492 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 21493 * file except in compliance with the License. You may obtain a copy of the License at: 21494 * http://www.apache.org/licenses/LICENSE-2.0 21495 * 21496 * Unless required by applicable law or agreed to in writing, software distributed under 21497 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 21498 * ANY KIND, either express or implied. See the License for the specific language 21499 * governing permissions and limitations under the License. 21500 * 21501 * @author Brian Reavis <[email protected]> 21502 */ 21503 21504/*jshint curly:false */ 21505/*jshint browser:true */ 21506 21507(function(root, factory) { 21508 if (true) { 21509 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./Themes/Cynoebook/node_modules/jquery/dist/jquery.js"),__webpack_require__(/*! sifter */ "./Themes/Cynoebook/node_modules/sifter/sifter.js"),__webpack_require__(/*! microplugin */ "./Themes/Cynoebook/node_modules/microplugin/src/microplugin.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 21510 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 21511 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 21512 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 21513 } else {} 21514}(this, function($, Sifter, MicroPlugin) { 21515 'use strict'; 21516 21517 var highlight = function($element, pattern) { 21518 if (typeof pattern === 'string' && !pattern.length) return; 21519 var regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern; 21520 21521 var highlight = function(node) { 21522 var skip = 0; 21523 // Wrap matching part of text node with highlighting <span>, e.g. 21524 // Soccer -> <span class="highlight">Soc</span>cer for regex = /soc/i 21525 if (node.nodeType === 3) { 21526 var pos = node.data.search(regex); 21527 if (pos >= 0 && node.data.length > 0) { 21528 var match = node.data.match(regex); 21529 var spannode = document.createElement('span'); 21530 spannode.className = 'highlight'; 21531 var middlebit = node.splitText(pos); 21532 var endbit = middlebit.splitText(match[0].length); 21533 var middleclone = middlebit.cloneNode(true); 21534 spannode.appendChild(middleclone); 21535 middlebit.parentNode.replaceChild(spannode, middlebit); 21536 skip = 1; 21537 } 21538 } 21539 // Recurse element node, looking for child text nodes to highlight, unless element 21540 // is childless, <script>, <style>, or already highlighted: <span class="hightlight"> 21541 else if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName) && ( node.className !== 'highlight' || node.tagName !== 'SPAN' )) { 21542 for (var i = 0; i < node.childNodes.length; ++i) { 21543 i += highlight(node.childNodes[i]); 21544 } 21545 } 21546 return skip; 21547 }; 21548 21549 return $element.each(function() { 21550 highlight(this); 21551 }); 21552 }; 21553 21554 /** 21555 * removeHighlight fn copied from highlight v5 and 21556 * edited to remove with() and pass js strict mode 21557 */ 21558 $.fn.removeHighlight = function() { 21559 return this.find("span.highlight").each(function() { 21560 this.parentNode.firstChild.nodeName; 21561 var parent = this.parentNode; 21562 parent.replaceChild(this.firstChild, this); 21563 parent.normalize(); 21564 }).end(); 21565 }; 21566 21567 21568 var MicroEvent = function() {}; 21569 MicroEvent.prototype = { 21570 on: function(event, fct){ 21571 this._events = this._events || {}; 21572 this._events[event] = this._events[event] || []; 21573 this._events[event].push(fct); 21574 }, 21575 off: function(event, fct){ 21576 var n = arguments.length; 21577 if (n === 0) return delete this._events; 21578 if (n === 1) return delete this._events[event]; 21579 21580 this._events = this._events || {}; 21581 if (event in this._events === false) return; 21582 this._events[event].splice(this._events[event].indexOf(fct), 1); 21583 }, 21584 trigger: function(event /* , args... */){ 21585 this._events = this._events || {}; 21586 if (event in this._events === false) return; 21587 for (var i = 0; i < this._events[event].length; i++){ 21588 this._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1)); 21589 } 21590 } 21591 }; 21592 21593 /** 21594 * Mixin will delegate all MicroEvent.js function in the destination object. 21595 * 21596 * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent 21597 * 21598 * @param {object} the object which will support MicroEvent 21599 */ 21600 MicroEvent.mixin = function(destObject){ 21601 var props = ['on', 'off', 'trigger']; 21602 for (var i = 0; i < props.length; i++){ 21603 destObject.prototype[props[i]] = MicroEvent.prototype[props[i]]; 21604 } 21605 }; 21606 21607 var IS_MAC = /Mac/.test(navigator.userAgent); 21608 21609 var KEY_A = 65; 21610 var KEY_COMMA = 188; 21611 var KEY_RETURN = 13; 21612 var KEY_ESC = 27; 21613 var KEY_LEFT = 37; 21614 var KEY_UP = 38; 21615 var KEY_P = 80; 21616 var KEY_RIGHT = 39; 21617 var KEY_DOWN = 40; 21618 var KEY_N = 78; 21619 var KEY_BACKSPACE = 8; 21620 var KEY_DELETE = 46; 21621 var KEY_SHIFT = 16; 21622 var KEY_CMD = IS_MAC ? 91 : 17; 21623 var KEY_CTRL = IS_MAC ? 18 : 17; 21624 var KEY_TAB = 9; 21625 21626 var TAG_SELECT = 1; 21627 var TAG_INPUT = 2; 21628 21629 // for now, android support in general is too spotty to support validity 21630 var SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity; 21631 21632 21633 var isset = function(object) { 21634 return typeof object !== 'undefined'; 21635 }; 21636 21637 /** 21638 * Converts a scalar to its best string representation 21639 * for hash keys and HTML attribute values. 21640 * 21641 * Transformations: 21642 * 'str' -> 'str' 21643 * null -> '' 21644 * undefined -> '' 21645 * true -> '1' 21646 * false -> '0' 21647 * 0 -> '0' 21648 * 1 -> '1' 21649 * 21650 * @param {string} value 21651 * @returns {string|null} 21652 */ 21653 var hash_key = function(value) { 21654 if (typeof value === 'undefined' || value === null) return null; 21655 if (typeof value === 'boolean') return value ? '1' : '0'; 21656 return value + ''; 21657 }; 21658 21659 /** 21660 * Escapes a string for use within HTML. 21661 * 21662 * @param {string} str 21663 * @returns {string} 21664 */ 21665 var escape_html = function(str) { 21666 return (str + '') 21667 .replace(/&/g, '&') 21668 .replace(/</g, '<') 21669 .replace(/>/g, '>') 21670 .replace(/"/g, '"'); 21671 }; 21672 21673 /** 21674 * Escapes "$" characters in replacement strings. 21675 * 21676 * @param {string} str 21677 * @returns {string} 21678 */ 21679 var escape_replace = function(str) { 21680 return (str + '').replace(/\$/g, '$$$$'); 21681 }; 21682 21683 var hook = {}; 21684 21685 /** 21686 * Wraps `method` on `self` so that `fn` 21687 * is invoked before the original method. 21688 * 21689 * @param {object} self 21690 * @param {string} method 21691 * @param {function} fn 21692 */ 21693 hook.before = function(self, method, fn) { 21694 var original = self[method]; 21695 self[method] = function() { 21696 fn.apply(self, arguments); 21697 return original.apply(self, arguments); 21698 }; 21699 }; 21700 21701 /** 21702 * Wraps `method` on `self` so that `fn` 21703 * is invoked after the original method. 21704 * 21705 * @param {object} self 21706 * @param {string} method 21707 * @param {function} fn 21708 */ 21709 hook.after = function(self, method, fn) { 21710 var original = self[method]; 21711 self[method] = function() { 21712 var result = original.apply(self, arguments); 21713 fn.apply(self, arguments); 21714 return result; 21715 }; 21716 }; 21717 21718 /** 21719 * Wraps `fn` so that it can only be invoked once. 21720 * 21721 * @param {function} fn 21722 * @returns {function} 21723 */ 21724 var once = function(fn) { 21725 var called = false; 21726 return function() { 21727 if (called) return; 21728 called = true; 21729 fn.apply(this, arguments); 21730 }; 21731 }; 21732 21733 /** 21734 * Wraps `fn` so that it can only be called once 21735 * every `delay` milliseconds (invoked on the falling edge). 21736 * 21737 * @param {function} fn 21738 * @param {int} delay 21739 * @returns {function} 21740 */ 21741 var debounce = function(fn, delay) { 21742 var timeout; 21743 return function() { 21744 var self = this; 21745 var args = arguments; 21746 window.clearTimeout(timeout); 21747 timeout = window.setTimeout(function() { 21748 fn.apply(self, args); 21749 }, delay); 21750 }; 21751 }; 21752 21753 /** 21754 * Debounce all fired events types listed in `types` 21755 * while executing the provided `fn`. 21756 * 21757 * @param {object} self 21758 * @param {array} types 21759 * @param {function} fn 21760 */ 21761 var debounce_events = function(self, types, fn) { 21762 var type; 21763 var trigger = self.trigger; 21764 var event_args = {}; 21765 21766 // override trigger method 21767 self.trigger = function() { 21768 var type = arguments[0]; 21769 if (types.indexOf(type) !== -1) { 21770 event_args[type] = arguments; 21771 } else { 21772 return trigger.apply(self, arguments); 21773 } 21774 }; 21775 21776 // invoke provided function 21777 fn.apply(self, []); 21778 self.trigger = trigger; 21779 21780 // trigger queued events 21781 for (type in event_args) { 21782 if (event_args.hasOwnProperty(type)) { 21783 trigger.apply(self, event_args[type]); 21784 } 21785 } 21786 }; 21787 21788 /** 21789 * A workaround for http://bugs.jquery.com/ticket/6696 21790 * 21791 * @param {object} $parent - Parent element to listen on. 21792 * @param {string} event - Event name. 21793 * @param {string} selector - Descendant selector to filter by. 21794 * @param {function} fn - Event handler. 21795 */ 21796 var watchChildEvent = function($parent, event, selector, fn) { 21797 $parent.on(event, selector, function(e) { 21798 var child = e.target; 21799 while (child && child.parentNode !== $parent[0]) { 21800 child = child.parentNode; 21801 } 21802 e.currentTarget = child; 21803 return fn.apply(this, [e]); 21804 }); 21805 }; 21806 21807 /** 21808 * Determines the current selection within a text input control. 21809 * Returns an object containing: 21810 * - start 21811 * - length 21812 * 21813 * @param {object} input 21814 * @returns {object} 21815 */ 21816 var getSelection = function(input) { 21817 var result = {}; 21818 if ('selectionStart' in input) { 21819 result.start = input.selectionStart; 21820 result.length = input.selectionEnd - result.start; 21821 } else if (document.selection) { 21822 input.focus(); 21823 var sel = document.selection.createRange(); 21824 var selLen = document.selection.createRange().text.length; 21825 sel.moveStart('character', -input.value.length); 21826 result.start = sel.text.length - selLen; 21827 result.length = selLen; 21828 } 21829 return result; 21830 }; 21831 21832 /** 21833 * Copies CSS properties from one element to another. 21834 * 21835 * @param {object} $from 21836 * @param {object} $to 21837 * @param {array} properties 21838 */ 21839 var transferStyles = function($from, $to, properties) { 21840 var i, n, styles = {}; 21841 if (properties) { 21842 for (i = 0, n = properties.length; i < n; i++) { 21843 styles[properties[i]] = $from.css(properties[i]); 21844 } 21845 } else { 21846 styles = $from.css(); 21847 } 21848 $to.css(styles); 21849 }; 21850 21851 /** 21852 * Measures the width of a string within a 21853 * parent element (in pixels). 21854 * 21855 * @param {string} str 21856 * @param {object} $parent 21857 * @returns {int} 21858 */ 21859 var measureString = function(str, $parent) { 21860 if (!str) { 21861 return 0; 21862 } 21863 21864 if (!Selectize.$testInput) { 21865 Selectize.$testInput = $('<span />').css({ 21866 position: 'absolute', 21867 top: -99999, 21868 left: -99999, 21869 width: 'auto', 21870 padding: 0, 21871 whiteSpace: 'pre' 21872 }).appendTo('body'); 21873 } 21874 21875 Selectize.$testInput.text(str); 21876 21877 transferStyles($parent, Selectize.$testInput, [ 21878 'letterSpacing', 21879 'fontSize', 21880 'fontFamily', 21881 'fontWeight', 21882 'textTransform' 21883 ]); 21884 21885 return Selectize.$testInput.width(); 21886 }; 21887 21888 /** 21889 * Sets up an input to grow horizontally as the user 21890 * types. If the value is changed manually, you can 21891 * trigger the "update" handler to resize: 21892 * 21893 * $input.trigger('update'); 21894 * 21895 * @param {object} $input 21896 */ 21897 var autoGrow = function($input) { 21898 var currentWidth = null; 21899 21900 var update = function(e, options) { 21901 var value, keyCode, printable, placeholder, width; 21902 var shift, character, selection; 21903 e = e || window.event || {}; 21904 options = options || {}; 21905 21906 if (e.metaKey || e.altKey) return; 21907 if (!options.force && $input.data('grow') === false) return; 21908 21909 value = $input.val(); 21910 if (e.type && e.type.toLowerCase() === 'keydown') { 21911 keyCode = e.keyCode; 21912 printable = ( 21913 (keyCode >= 48 && keyCode <= 57) || // 0-9 21914 (keyCode >= 65 && keyCode <= 90) || // a-z 21915 (keyCode >= 96 && keyCode <= 111) || // numpad 0-9, numeric operators 21916 (keyCode >= 186 && keyCode <= 222) || // semicolon, equal, comma, dash, etc. 21917 keyCode === 32 // space 21918 ); 21919 21920 if (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) { 21921 selection = getSelection($input[0]); 21922 if (selection.length) { 21923 value = value.substring(0, selection.start) + value.substring(selection.start + selection.length); 21924 } else if (keyCode === KEY_BACKSPACE && selection.start) { 21925 value = value.substring(0, selection.start - 1) + value.substring(selection.start + 1); 21926 } else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') { 21927 value = value.substring(0, selection.start) + value.substring(selection.start + 1); 21928 } 21929 } else if (printable) { 21930 shift = e.shiftKey; 21931 character = String.fromCharCode(e.keyCode); 21932 if (shift) character = character.toUpperCase(); 21933 else character = character.toLowerCase(); 21934 value += character; 21935 } 21936 } 21937 21938 placeholder = $input.attr('placeholder'); 21939 if (!value && placeholder) { 21940 value = placeholder; 21941 } 21942 21943 width = measureString(value, $input) + 4; 21944 if (width !== currentWidth) { 21945 currentWidth = width; 21946 $input.width(width); 21947 $input.triggerHandler('resize'); 21948 } 21949 }; 21950 21951 $input.on('keydown keyup update blur', update); 21952 update(); 21953 }; 21954 21955 var domToString = function(d) { 21956 var tmp = document.createElement('div'); 21957 21958 tmp.appendChild(d.cloneNode(true)); 21959 21960 return tmp.innerHTML; 21961 }; 21962 21963 var logError = function(message, options){ 21964 if(!options) options = {}; 21965 var component = "Selectize"; 21966 21967 console.error(component + ": " + message) 21968 21969 if(options.explanation){ 21970 // console.group is undefined in <IE11 21971 if(console.group) console.group(); 21972 console.error(options.explanation); 21973 if(console.group) console.groupEnd(); 21974 } 21975 } 21976 21977 21978 var Selectize = function($input, settings) { 21979 var key, i, n, dir, input, self = this; 21980 input = $input[0]; 21981 input.selectize = self; 21982 21983 // detect rtl environment 21984 var computedStyle = window.getComputedStyle && window.getComputedStyle(input, null); 21985 dir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction; 21986 dir = dir || $input.parents('[dir]:first').attr('dir') || ''; 21987 21988 // setup default state 21989 $.extend(self, { 21990 order : 0, 21991 settings : settings, 21992 $input : $input, 21993 tabIndex : $input.attr('tabindex') || '', 21994 tagType : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT, 21995 rtl : /rtl/i.test(dir), 21996 21997 eventNS : '.selectize' + (++Selectize.count), 21998 highlightedValue : null, 21999 isBlurring : false, 22000 isOpen : false, 22001 isDisabled : false, 22002 isRequired : $input.is('[required]'), 22003 isInvalid : false, 22004 isLocked : false, 22005 isFocused : false, 22006 isInputHidden : false, 22007 isSetup : false, 22008 isShiftDown : false, 22009 isCmdDown : false, 22010 isCtrlDown : false, 22011 ignoreFocus : false, 22012 ignoreBlur : false, 22013 ignoreHover : false, 22014 hasOptions : false, 22015 currentResults : null, 22016 lastValue : '', 22017 caretPos : 0, 22018 loading : 0, 22019 loadedSearches : {}, 22020 22021 $activeOption : null, 22022 $activeItems : [], 22023 22024 optgroups : {}, 22025 options : {}, 22026 userOptions : {}, 22027 items : [], 22028 renderCache : {}, 22029 onSearchChange : settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle) 22030 }); 22031 22032 // search system 22033 self.sifter = new Sifter(this.options, {diacritics: settings.diacritics}); 22034 22035 // build options table 22036 if (self.settings.options) { 22037 for (i = 0, n = self.settings.options.length; i < n; i++) { 22038 self.registerOption(self.settings.options[i]); 22039 } 22040 delete self.settings.options; 22041 } 22042 22043 // build optgroup table 22044 if (self.settings.optgroups) { 22045 for (i = 0, n = self.settings.optgroups.length; i < n; i++) { 22046 self.registerOptionGroup(self.settings.optgroups[i]); 22047 } 22048 delete self.settings.optgroups; 22049 } 22050 22051 // option-dependent defaults 22052 self.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi'); 22053 if (typeof self.settings.hideSelected !== 'boolean') { 22054 self.settings.hideSelected = self.settings.mode === 'multi'; 22055 } 22056 22057 self.initializePlugins(self.settings.plugins); 22058 self.setupCallbacks(); 22059 self.setupTemplates(); 22060 self.setup(); 22061 }; 22062 22063 // mixins 22064 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 22065 22066 MicroEvent.mixin(Selectize); 22067 22068 if(typeof MicroPlugin !== "undefined"){ 22069 MicroPlugin.mixin(Selectize); 22070 }else{ 22071 logError("Dependency MicroPlugin is missing", 22072 {explanation: 22073 "Make sure you either: (1) are using the \"standalone\" "+ 22074 "version of Selectize, or (2) require MicroPlugin before you "+ 22075 "load Selectize."} 22076 ); 22077 } 22078 22079 22080 // methods 22081 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 22082 22083 $.extend(Selectize.prototype, { 22084 22085 /** 22086 * Creates all elements and sets up event bindings. 22087 */ 22088 setup: function() { 22089 var self = this; 22090 var settings = self.settings; 22091 var eventNS = self.eventNS; 22092 var $window = $(window); 22093 var $document = $(document); 22094 var $input = self.$input; 22095 22096 var $wrapper; 22097 var $control; 22098 var $control_input; 22099 var $dropdown; 22100 var $dropdown_content; 22101 var $dropdown_parent; 22102 var inputMode; 22103 var timeout_blur; 22104 var timeout_focus; 22105 var classes; 22106 var classes_plugins; 22107 var inputId; 22108 22109 inputMode = self.settings.mode; 22110 classes = $input.attr('class') || ''; 22111 22112 $wrapper = $('<div>').addClass(settings.wrapperClass).addClass(classes).addClass(inputMode); 22113 $control = $('<div>').addClass(settings.inputClass).addClass('items').appendTo($wrapper); 22114 $control_input = $('<input type="text" autocomplete="off" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex); 22115 $dropdown_parent = $(settings.dropdownParent || $wrapper); 22116 $dropdown = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent); 22117 $dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown); 22118 22119 if(inputId = $input.attr('id')) { 22120 $control_input.attr('id', inputId + '-selectized'); 22121 $("label[for='"+inputId+"']").attr('for', inputId + '-selectized'); 22122 } 22123 22124 if(self.settings.copyClassesToDropdown) { 22125 $dropdown.addClass(classes); 22126 } 22127 22128 $wrapper.css({ 22129 width: $input[0].style.width 22130 }); 22131 22132 if (self.plugins.names.length) { 22133 classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-'); 22134 $wrapper.addClass(classes_plugins); 22135 $dropdown.addClass(classes_plugins); 22136 } 22137 22138 if ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) { 22139 $input.attr('multiple', 'multiple'); 22140 } 22141 22142 if (self.settings.placeholder) { 22143 $control_input.attr('placeholder', settings.placeholder); 22144 } 22145 22146 // if splitOn was not passed in, construct it from the delimiter to allow pasting universally 22147 if (!self.settings.splitOn && self.settings.delimiter) { 22148 var delimiterEscaped = self.settings.delimiter.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); 22149 self.settings.splitOn = new RegExp('\\s*' + delimiterEscaped + '+\\s*'); 22150 } 22151 22152 if ($input.attr('autocorrect')) { 22153 $control_input.attr('autocorrect', $input.attr('autocorrect')); 22154 } 22155 22156 if ($input.attr('autocapitalize')) { 22157 $control_input.attr('autocapitalize', $input.attr('autocapitalize')); 22158 } 22159 $control_input[0].type = $input[0].type; 22160 22161 self.$wrapper = $wrapper; 22162 self.$control = $control; 22163 self.$control_input = $control_input; 22164 self.$dropdown = $dropdown; 22165 self.$dropdown_content = $dropdown_content; 22166 22167 $dropdown.on('mouseenter mousedown click', '[data-disabled]>[data-selectable]', function(e) { e.stopImmediatePropagation(); }); 22168 $dropdown.on('mouseenter', '[data-selectable]', function() { return self.onOptionHover.apply(self, arguments); }); 22169 $dropdown.on('mousedown click', '[data-selectable]', function() { return self.onOptionSelect.apply(self, arguments); }); 22170 watchChildEvent($control, 'mousedown', '*:not(input)', function() { return self.onItemSelect.apply(self, arguments); }); 22171 autoGrow($control_input); 22172 22173 $control.on({ 22174 mousedown : function() { return self.onMouseDown.apply(self, arguments); }, 22175 click : function() { return self.onClick.apply(self, arguments); } 22176 }); 22177 22178 $control_input.on({ 22179 mousedown : function(e) { e.stopPropagation(); }, 22180 keydown : function() { return self.onKeyDown.apply(self, arguments); }, 22181 keyup : function() { return self.onKeyUp.apply(self, arguments); }, 22182 keypress : function() { return self.onKeyPress.apply(self, arguments); }, 22183 resize : function() { self.positionDropdown.apply(self, []); }, 22184 blur : function() { return self.onBlur.apply(self, arguments); }, 22185 focus : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); }, 22186 paste : function() { return self.onPaste.apply(self, arguments); } 22187 }); 22188 22189 $document.on('keydown' + eventNS, function(e) { 22190 self.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey']; 22191 self.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey']; 22192 self.isShiftDown = e.shiftKey; 22193 }); 22194 22195 $document.on('keyup' + eventNS, function(e) { 22196 if (e.keyCode === KEY_CTRL) self.isCtrlDown = false; 22197 if (e.keyCode === KEY_SHIFT) self.isShiftDown = false; 22198 if (e.keyCode === KEY_CMD) self.isCmdDown = false; 22199 }); 22200 22201 $document.on('mousedown' + eventNS, function(e) { 22202 if (self.isFocused) { 22203 // prevent events on the dropdown scrollbar from causing the control to blur 22204 if (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) { 22205 return false; 22206 } 22207 // blur on click outside 22208 if (!self.$control.has(e.target).length && e.target !== self.$control[0]) { 22209 self.blur(e.target); 22210 } 22211 } 22212 }); 22213 22214 $window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function() { 22215 if (self.isOpen) { 22216 self.positionDropdown.apply(self, arguments); 22217 } 22218 }); 22219 $window.on('mousemove' + eventNS, function() { 22220 self.ignoreHover = false; 22221 }); 22222 22223 // store original children and tab index so that they can be 22224 // restored when the destroy() method is called. 22225 this.revertSettings = { 22226 $children : $input.children().detach(), 22227 tabindex : $input.attr('tabindex') 22228 }; 22229 22230 $input.attr('tabindex', -1).hide().after(self.$wrapper); 22231 22232 if ($.isArray(settings.items)) { 22233 self.setValue(settings.items); 22234 delete settings.items; 22235 } 22236 22237 // feature detect for the validation API 22238 if (SUPPORTS_VALIDITY_API) { 22239 $input.on('invalid' + eventNS, function(e) { 22240 e.preventDefault(); 22241 self.isInvalid = true; 22242 self.refreshState(); 22243 }); 22244 } 22245 22246 self.updateOriginalInput(); 22247 self.refreshItems(); 22248 self.refreshState(); 22249 self.updatePlaceholder(); 22250 self.isSetup = true; 22251 22252 if ($input.is(':disabled')) { 22253 self.disable(); 22254 } 22255 22256 self.on('change', this.onChange); 22257 22258 $input.data('selectize', self); 22259 $input.addClass('selectized'); 22260 self.trigger('initialize'); 22261 22262 // preload options 22263 if (settings.preload === true) { 22264 self.onSearchChange(''); 22265 } 22266 22267 }, 22268 22269 /** 22270 * Sets up default rendering functions. 22271 */ 22272 setupTemplates: function() { 22273 var self = this; 22274 var field_label = self.settings.labelField; 22275 var field_optgroup = self.settings.optgroupLabelField; 22276 22277 var templates = { 22278 'optgroup': function(data) { 22279 return '<div class="optgroup">' + data.html + '</div>'; 22280 }, 22281 'optgroup_header': function(data, escape) { 22282 return '<div class="optgroup-header">' + escape(data[field_optgroup]) + '</div>'; 22283 }, 22284 'option': function(data, escape) { 22285 return '<div class="option">' + escape(data[field_label]) + '</div>'; 22286 }, 22287 'item': function(data, escape) { 22288 return '<div class="item">' + escape(data[field_label]) + '</div>'; 22289 }, 22290 'option_create': function(data, escape) { 22291 return '<div class="create">Add <strong>' + escape(data.input) + '</strong>…</div>'; 22292 } 22293 }; 22294 22295 self.settings.render = $.extend({}, templates, self.settings.render); 22296 }, 22297 22298 /** 22299 * Maps fired events to callbacks provided 22300 * in the settings used when creating the control. 22301 */ 22302 setupCallbacks: function() { 22303 var key, fn, callbacks = { 22304 'initialize' : 'onInitialize', 22305 'change' : 'onChange', 22306 'item_add' : 'onItemAdd', 22307 'item_remove' : 'onItemRemove', 22308 'clear' : 'onClear', 22309 'option_add' : 'onOptionAdd', 22310 'option_remove' : 'onOptionRemove', 22311 'option_clear' : 'onOptionClear', 22312 'optgroup_add' : 'onOptionGroupAdd', 22313 'optgroup_remove' : 'onOptionGroupRemove', 22314 'optgroup_clear' : 'onOptionGroupClear', 22315 'dropdown_open' : 'onDropdownOpen', 22316 'dropdown_close' : 'onDropdownClose', 22317 'type' : 'onType', 22318 'load' : 'onLoad', 22319 'focus' : 'onFocus', 22320 'blur' : 'onBlur' 22321 }; 22322 22323 for (key in callbacks) { 22324 if (callbacks.hasOwnProperty(key)) { 22325 fn = this.settings[callbacks[key]]; 22326 if (fn) this.on(key, fn); 22327 } 22328 } 22329 }, 22330 22331 /** 22332 * Triggered when the main control element 22333 * has a click event. 22334 * 22335 * @param {object} e 22336 * @return {boolean} 22337 */ 22338 onClick: function(e) { 22339 var self = this; 22340 22341 // necessary for mobile webkit devices (manual focus triggering 22342 // is ignored unless invoked within a click event) 22343 // also necessary to reopen a dropdown that has been closed by 22344 // closeAfterSelect 22345 if (!self.isFocused || !self.isOpen) { 22346 self.focus(); 22347 e.preventDefault(); 22348 } 22349 }, 22350 22351 /** 22352 * Triggered when the main control element 22353 * has a mouse down event. 22354 * 22355 * @param {object} e 22356 * @return {boolean} 22357 */ 22358 onMouseDown: function(e) { 22359 var self = this; 22360 var defaultPrevented = e.isDefaultPrevented(); 22361 var $target = $(e.target); 22362 22363 if (self.isFocused) { 22364 // retain focus by preventing native handling. if the 22365 // event target is the input it should not be modified. 22366 // otherwise, text selection within the input won't work. 22367 if (e.target !== self.$control_input[0]) { 22368 if (self.settings.mode === 'single') { 22369 // toggle dropdown 22370 self.isOpen ? self.close() : self.open(); 22371 } else if (!defaultPrevented) { 22372 self.setActiveItem(null); 22373 } 22374 return false; 22375 } 22376 } else { 22377 // give control focus 22378 if (!defaultPrevented) { 22379 window.setTimeout(function() { 22380 self.focus(); 22381 }, 0); 22382 } 22383 } 22384 }, 22385 22386 /** 22387 * Triggered when the value of the control has been changed. 22388 * This should propagate the event to the original DOM 22389 * input / select element. 22390 */ 22391 onChange: function() { 22392 this.$input.trigger('change'); 22393 }, 22394 22395 /** 22396 * Triggered on <input> paste. 22397 * 22398 * @param {object} e 22399 * @returns {boolean} 22400 */ 22401 onPaste: function(e) { 22402 var self = this; 22403 22404 if (self.isFull() || self.isInputHidden || self.isLocked) { 22405 e.preventDefault(); 22406 return; 22407 } 22408 22409 // If a regex or string is included, this will split the pasted 22410 // input and create Items for each separate value 22411 if (self.settings.splitOn) { 22412 22413 // Wait for pasted text to be recognized in value 22414 setTimeout(function() { 22415 var pastedText = self.$control_input.val(); 22416 if(!pastedText.match(self.settings.splitOn)){ return } 22417 22418 var splitInput = $.trim(pastedText).split(self.settings.splitOn); 22419 for (var i = 0, n = splitInput.length; i < n; i++) { 22420 self.createItem(splitInput[i]); 22421 } 22422 }, 0); 22423 } 22424 }, 22425 22426 /** 22427 * Triggered on <input> keypress. 22428 * 22429 * @param {object} e 22430 * @returns {boolean} 22431 */ 22432 onKeyPress: function(e) { 22433 if (this.isLocked) return e && e.preventDefault(); 22434 var character = String.fromCharCode(e.keyCode || e.which); 22435 if (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) { 22436 this.createItem(); 22437 e.preventDefault(); 22438 return false; 22439 } 22440 }, 22441 22442 /** 22443 * Triggered on <input> keydown. 22444 * 22445 * @param {object} e 22446 * @returns {boolean} 22447 */ 22448 onKeyDown: function(e) { 22449 var isInput = e.target === this.$control_input[0]; 22450 var self = this; 22451 22452 if (self.isLocked) { 22453 if (e.keyCode !== KEY_TAB) { 22454 e.preventDefault(); 22455 } 22456 return; 22457 } 22458 22459 switch (e.keyCode) { 22460 case KEY_A: 22461 if (self.isCmdDown) { 22462 self.selectAll(); 22463 return; 22464 } 22465 break; 22466 case KEY_ESC: 22467 if (self.isOpen) { 22468 e.preventDefault(); 22469 e.stopPropagation(); 22470 self.close(); 22471 } 22472 return; 22473 case KEY_N: 22474 if (!e.ctrlKey || e.altKey) break; 22475 case KEY_DOWN: 22476 if (!self.isOpen && self.hasOptions) { 22477 self.open(); 22478 } else if (self.$activeOption) { 22479 self.ignoreHover = true; 22480 var $next = self.getAdjacentOption(self.$activeOption, 1); 22481 if ($next.length) self.setActiveOption($next, true, true); 22482 } 22483 e.preventDefault(); 22484 return; 22485 case KEY_P: 22486 if (!e.ctrlKey || e.altKey) break; 22487 case KEY_UP: 22488 if (self.$activeOption) { 22489 self.ignoreHover = true; 22490 var $prev = self.getAdjacentOption(self.$activeOption, -1); 22491 if ($prev.length) self.setActiveOption($prev, true, true); 22492 } 22493 e.preventDefault(); 22494 return; 22495 case KEY_RETURN: 22496 if (self.isOpen && self.$activeOption) { 22497 self.onOptionSelect({currentTarget: self.$activeOption}); 22498 e.preventDefault(); 22499 } 22500 return; 22501 case KEY_LEFT: 22502 self.advanceSelection(-1, e); 22503 return; 22504 case KEY_RIGHT: 22505 self.advanceSelection(1, e); 22506 return; 22507 case KEY_TAB: 22508 if (self.settings.selectOnTab && self.isOpen && self.$activeOption) { 22509 self.onOptionSelect({currentTarget: self.$activeOption}); 22510 22511 // Default behaviour is to jump to the next field, we only want this 22512 // if the current field doesn't accept any more entries 22513 if (!self.isFull()) { 22514 e.preventDefault(); 22515 } 22516 } 22517 if (self.settings.create && self.createItem()) { 22518 e.preventDefault(); 22519 } 22520 return; 22521 case KEY_BACKSPACE: 22522 case KEY_DELETE: 22523 self.deleteSelection(e); 22524 return; 22525 } 22526 22527 if ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) { 22528 e.preventDefault(); 22529 return; 22530 } 22531 }, 22532 22533 /** 22534 * Triggered on <input> keyup. 22535 * 22536 * @param {object} e 22537 * @returns {boolean} 22538 */ 22539 onKeyUp: function(e) { 22540 var self = this; 22541 22542 if (self.isLocked) return e && e.preventDefault(); 22543 var value = self.$control_input.val() || ''; 22544 if (self.lastValue !== value) { 22545 self.lastValue = value; 22546 self.onSearchChange(value); 22547 self.refreshOptions(); 22548 self.trigger('type', value); 22549 } 22550 }, 22551 22552 /** 22553 * Invokes the user-provide option provider / loader. 22554 * 22555 * Note: this function is debounced in the Selectize 22556 * constructor (by `settings.loadThrottle` milliseconds) 22557 * 22558 * @param {string} value 22559 */ 22560 onSearchChange: function(value) { 22561 var self = this; 22562 var fn = self.settings.load; 22563 if (!fn) return; 22564 if (self.loadedSearches.hasOwnProperty(value)) return; 22565 self.loadedSearches[value] = true; 22566 self.load(function(callback) { 22567 fn.apply(self, [value, callback]); 22568 }); 22569 }, 22570 22571 /** 22572 * Triggered on <input> focus. 22573 * 22574 * @param {object} e (optional) 22575 * @returns {boolean} 22576 */ 22577 onFocus: function(e) { 22578 var self = this; 22579 var wasFocused = self.isFocused; 22580 22581 if (self.isDisabled) { 22582 self.blur(); 22583 e && e.preventDefault(); 22584 return false; 22585 } 22586 22587 if (self.ignoreFocus) return; 22588 self.isFocused = true; 22589 if (self.settings.preload === 'focus') self.onSearchChange(''); 22590 22591 if (!wasFocused) self.trigger('focus'); 22592 22593 if (!self.$activeItems.length) { 22594 self.showInput(); 22595 self.setActiveItem(null); 22596 self.refreshOptions(!!self.settings.openOnFocus); 22597 } 22598 22599 self.refreshState(); 22600 }, 22601 22602 /** 22603 * Triggered on <input> blur. 22604 * 22605 * @param {object} e 22606 * @param {Element} dest 22607 */ 22608 onBlur: function(e, dest) { 22609 var self = this; 22610 if (!self.isFocused) return; 22611 self.isFocused = false; 22612 22613 if (self.ignoreFocus) { 22614 return; 22615 } else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) { 22616 // necessary to prevent IE closing the dropdown when the scrollbar is clicked 22617 self.ignoreBlur = true; 22618 self.onFocus(e); 22619 return; 22620 } 22621 22622 var deactivate = function() { 22623 self.close(); 22624 self.setTextboxValue(''); 22625 self.setActiveItem(null); 22626 self.setActiveOption(null); 22627 self.setCaret(self.items.length); 22628 self.refreshState(); 22629 22630 // IE11 bug: element still marked as active 22631 dest && dest.focus && dest.focus(); 22632 22633 self.isBlurring = false; 22634 self.ignoreFocus = false; 22635 self.trigger('blur'); 22636 }; 22637 22638 self.isBlurring = true; 22639 self.ignoreFocus = true; 22640 if (self.settings.create && self.settings.createOnBlur) { 22641 self.createItem(null, false, deactivate); 22642 } else { 22643 deactivate(); 22644 } 22645 }, 22646 22647 /** 22648 * Triggered when the user rolls over 22649 * an option in the autocomplete dropdown menu. 22650 * 22651 * @param {object} e 22652 * @returns {boolean} 22653 */ 22654 onOptionHover: function(e) { 22655 if (this.ignoreHover) return; 22656 this.setActiveOption(e.currentTarget, false); 22657 }, 22658 22659 /** 22660 * Triggered when the user clicks on an option 22661 * in the autocomplete dropdown menu. 22662 * 22663 * @param {object} e 22664 * @returns {boolean} 22665 */ 22666 onOptionSelect: function(e) { 22667 var value, $target, $option, self = this; 22668 22669 if (e.preventDefault) { 22670 e.preventDefault(); 22671 e.stopPropagation(); 22672 } 22673 22674 $target = $(e.currentTarget); 22675 if ($target.hasClass('create')) { 22676 self.createItem(null, function() { 22677 if (self.settings.closeAfterSelect) { 22678 self.close(); 22679 } 22680 }); 22681 } else { 22682 value = $target.attr('data-value'); 22683 if (typeof value !== 'undefined') { 22684 self.lastQuery = null; 22685 self.setTextboxValue(''); 22686 self.addItem(value); 22687 if (self.settings.closeAfterSelect) { 22688 self.close(); 22689 } else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) { 22690 self.setActiveOption(self.getOption(value)); 22691 } 22692 } 22693 } 22694 }, 22695 22696 /** 22697 * Triggered when the user clicks on an item 22698 * that has been selected. 22699 * 22700 * @param {object} e 22701 * @returns {boolean} 22702 */ 22703 onItemSelect: function(e) { 22704 var self = this; 22705 22706 if (self.isLocked) return; 22707 if (self.settings.mode === 'multi') { 22708 e.preventDefault(); 22709 self.setActiveItem(e.currentTarget, e); 22710 } 22711 }, 22712 22713 /** 22714 * Invokes the provided method that provides 22715 * results to a callback---which are then added 22716 * as options to the control. 22717 * 22718 * @param {function} fn 22719 */ 22720 load: function(fn) { 22721 var self = this; 22722 var $wrapper = self.$wrapper.addClass(self.settings.loadingClass); 22723 22724 self.loading++; 22725 fn.apply(self, [function(results) { 22726 self.loading = Math.max(self.loading - 1, 0); 22727 if (results && results.length) { 22728 self.addOption(results); 22729 self.refreshOptions(self.isFocused && !self.isInputHidden); 22730 } 22731 if (!self.loading) { 22732 $wrapper.removeClass(self.settings.loadingClass); 22733 } 22734 self.trigger('load', results); 22735 }]); 22736 }, 22737 22738 /** 22739 * Sets the input field of the control to the specified value. 22740 * 22741 * @param {string} value 22742 */ 22743 setTextboxValue: function(value) { 22744 var $input = this.$control_input; 22745 var changed = $input.val() !== value; 22746 if (changed) { 22747 $input.val(value).triggerHandler('update'); 22748 this.lastValue = value; 22749 } 22750 }, 22751 22752 /** 22753 * Returns the value of the control. If multiple items 22754 * can be selected (e.g. <select multiple>), this returns 22755 * an array. If only one item can be selected, this 22756 * returns a string. 22757 * 22758 * @returns {mixed} 22759 */ 22760 getValue: function() { 22761 if (this.tagType === TAG_SELECT && this.$input.attr('multiple')) { 22762 return this.items; 22763 } else { 22764 return this.items.join(this.settings.delimiter); 22765 } 22766 }, 22767 22768 /** 22769 * Resets the selected items to the given value. 22770 * 22771 * @param {mixed} value 22772 */ 22773 setValue: function(value, silent) { 22774 var events = silent ? [] : ['change']; 22775 22776 debounce_events(this, events, function() { 22777 this.clear(silent); 22778 this.addItems(value, silent); 22779 }); 22780 }, 22781 22782 /** 22783 * Sets the selected item. 22784 * 22785 * @param {object} $item 22786 * @param {object} e (optional) 22787 */ 22788 setActiveItem: function($item, e) { 22789 var self = this; 22790 var eventName; 22791 var i, idx, begin, end, item, swap; 22792 var $last; 22793 22794 if (self.settings.mode === 'single') return; 22795 $item = $($item); 22796 22797 // clear the active selection 22798 if (!$item.length) { 22799 $(self.$activeItems).removeClass('active'); 22800 self.$activeItems = []; 22801 if (self.isFocused) { 22802 self.showInput(); 22803 } 22804 return; 22805 } 22806 22807 // modify selection 22808 eventName = e && e.type.toLowerCase(); 22809 22810 if (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) { 22811 $last = self.$control.children('.active:last'); 22812 begin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]); 22813 end = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]); 22814 if (begin > end) { 22815 swap = begin; 22816 begin = end; 22817 end = swap; 22818 } 22819 for (i = begin; i <= end; i++) { 22820 item = self.$control[0].childNodes[i]; 22821 if (self.$activeItems.indexOf(item) === -1) { 22822 $(item).addClass('active'); 22823 self.$activeItems.push(item); 22824 } 22825 } 22826 e.preventDefault(); 22827 } else if ((eventName === 'mousedown' && self.isCtrlDown) || (eventName === 'keydown' && this.isShiftDown)) { 22828 if ($item.hasClass('active')) { 22829 idx = self.$activeItems.indexOf($item[0]); 22830 self.$activeItems.splice(idx, 1); 22831 $item.removeClass('active'); 22832 } else { 22833 self.$activeItems.push($item.addClass('active')[0]); 22834 } 22835 } else { 22836 $(self.$activeItems).removeClass('active'); 22837 self.$activeItems = [$item.addClass('active')[0]]; 22838 } 22839 22840 // ensure control has focus 22841 self.hideInput(); 22842 if (!this.isFocused) { 22843 self.focus(); 22844 } 22845 }, 22846 22847 /** 22848 * Sets the selected item in the dropdown menu 22849 * of available options. 22850 * 22851 * @param {object} $object 22852 * @param {boolean} scroll 22853 * @param {boolean} animate 22854 */ 22855 setActiveOption: function($option, scroll, animate) { 22856 var height_menu, height_item, y; 22857 var scroll_top, scroll_bottom; 22858 var self = this; 22859 22860 if (self.$activeOption) self.$activeOption.removeClass('active'); 22861 self.$activeOption = null; 22862 22863 $option = $($option); 22864 if (!$option.length) return; 22865 22866 self.$activeOption = $option.addClass('active'); 22867 22868 if (scroll || !isset(scroll)) { 22869 22870 height_menu = self.$dropdown_content.height(); 22871 height_item = self.$activeOption.outerHeight(true); 22872 scroll = self.$dropdown_content.scrollTop() || 0; 22873 y = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll; 22874 scroll_top = y; 22875 scroll_bottom = y - height_menu + height_item; 22876 22877 if (y + height_item > height_menu + scroll) { 22878 self.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0); 22879 } else if (y < scroll) { 22880 self.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0); 22881 } 22882 22883 } 22884 }, 22885 22886 /** 22887 * Selects all items (CTRL + A). 22888 */ 22889 selectAll: function() { 22890 var self = this; 22891 if (self.settings.mode === 'single') return; 22892 22893 self.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active')); 22894 if (self.$activeItems.length) { 22895 self.hideInput(); 22896 self.close(); 22897 } 22898 self.focus(); 22899 }, 22900 22901 /** 22902 * Hides the input element out of view, while 22903 * retaining its focus. 22904 */ 22905 hideInput: function() { 22906 var self = this; 22907 22908 self.setTextboxValue(''); 22909 self.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000}); 22910 self.isInputHidden = true; 22911 }, 22912 22913 /** 22914 * Restores input visibility. 22915 */ 22916 showInput: function() { 22917 this.$control_input.css({opacity: 1, position: 'relative', left: 0}); 22918 this.isInputHidden = false; 22919 }, 22920 22921 /** 22922 * Gives the control focus. 22923 */ 22924 focus: function() { 22925 var self = this; 22926 if (self.isDisabled) return; 22927 22928 self.ignoreFocus = true; 22929 self.$control_input[0].focus(); 22930 window.setTimeout(function() { 22931 self.ignoreFocus = false; 22932 self.onFocus(); 22933 }, 0); 22934 }, 22935 22936 /** 22937 * Forces the control out of focus. 22938 * 22939 * @param {Element} dest 22940 */ 22941 blur: function(dest) { 22942 this.$control_input[0].blur(); 22943 this.onBlur(null, dest); 22944 }, 22945 22946 /** 22947 * Returns a function that scores an object 22948 * to show how good of a match it is to the 22949 * provided query. 22950 * 22951 * @param {string} query 22952 * @param {object} options 22953 * @return {function} 22954 */ 22955 getScoreFunction: function(query) { 22956 return this.sifter.getScoreFunction(query, this.getSearchOptions()); 22957 }, 22958 22959 /** 22960 * Returns search options for sifter (the system 22961 * for scoring and sorting results). 22962 * 22963 * @see https://github.com/brianreavis/sifter.js 22964 * @return {object} 22965 */ 22966 getSearchOptions: function() { 22967 var settings = this.settings; 22968 var sort = settings.sortField; 22969 if (typeof sort === 'string') { 22970 sort = [{field: sort}]; 22971 } 22972 22973 return { 22974 fields : settings.searchField, 22975 conjunction : settings.searchConjunction, 22976 sort : sort, 22977 nesting : settings.nesting 22978 }; 22979 }, 22980 22981 /** 22982 * Searches through available options and returns 22983 * a sorted array of matches. 22984 * 22985 * Returns an object containing: 22986 * 22987 * - query {string} 22988 * - tokens {array} 22989 * - total {int} 22990 * - items {array} 22991 * 22992 * @param {string} query 22993 * @returns {object} 22994 */ 22995 search: function(query) { 22996 var i, value, score, result, calculateScore; 22997 var self = this; 22998 var settings = self.settings; 22999 var options = this.getSearchOptions(); 23000 23001 // validate user-provided result scoring function 23002 if (settings.score) { 23003 calculateScore = self.settings.score.apply(this, [query]); 23004 if (typeof calculateScore !== 'function') { 23005 throw new Error('Selectize "score" setting must be a function that returns a function'); 23006 } 23007 } 23008 23009 // perform search 23010 if (query !== self.lastQuery) { 23011 self.lastQuery = query; 23012 result = self.sifter.search(query, $.extend(options, {score: calculateScore})); 23013 self.currentResults = result; 23014 } else { 23015 result = $.extend(true, {}, self.currentResults); 23016 } 23017 23018 // filter out selected items 23019 if (settings.hideSelected) { 23020 for (i = result.items.length - 1; i >= 0; i--) { 23021 if (self.items.indexOf(hash_key(result.items[i].id)) !== -1) { 23022 result.items.splice(i, 1); 23023 } 23024 } 23025 } 23026 23027 return result; 23028 }, 23029 23030 /** 23031 * Refreshes the list of available options shown 23032 * in the autocomplete dropdown menu. 23033 * 23034 * @param {boolean} triggerDropdown 23035 */ 23036 refreshOptions: function(triggerDropdown) { 23037 var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option; 23038 var $active, $active_before, $create; 23039 23040 if (typeof triggerDropdown === 'undefined') { 23041 triggerDropdown = true; 23042 } 23043 23044 var self = this; 23045 var query = $.trim(self.$control_input.val()); 23046 var results = self.search(query); 23047 var $dropdown_content = self.$dropdown_content; 23048 var active_before = self.$activeOption && hash_key(self.$activeOption.attr('data-value')); 23049 23050 // build markup 23051 n = results.items.length; 23052 if (typeof self.settings.maxOptions === 'number') { 23053 n = Math.min(n, self.settings.maxOptions); 23054 } 23055 23056 // render and group available options individually 23057 groups = {}; 23058 groups_order = []; 23059 23060 for (i = 0; i < n; i++) { 23061 option = self.options[results.items[i].id]; 23062 option_html = self.render('option', option); 23063 optgroup = option[self.settings.optgroupField] || ''; 23064 optgroups = $.isArray(optgroup) ? optgroup : [optgroup]; 23065 23066 for (j = 0, k = optgroups && optgroups.length; j < k; j++) { 23067 optgroup = optgroups[j]; 23068 if (!self.optgroups.hasOwnProperty(optgroup)) { 23069 optgroup = ''; 23070 } 23071 if (!groups.hasOwnProperty(optgroup)) { 23072 groups[optgroup] = document.createDocumentFragment(); 23073 groups_order.push(optgroup); 23074 } 23075 groups[optgroup].appendChild(option_html); 23076 } 23077 } 23078 23079 // sort optgroups 23080 if (this.settings.lockOptgroupOrder) { 23081 groups_order.sort(function(a, b) { 23082 var a_order = self.optgroups[a].$order || 0; 23083 var b_order = self.optgroups[b].$order || 0; 23084 return a_order - b_order; 23085 }); 23086 } 23087 23088 // render optgroup headers & join groups 23089 html = document.createDocumentFragment(); 23090 for (i = 0, n = groups_order.length; i < n; i++) { 23091 optgroup = groups_order[i]; 23092 if (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) { 23093 // render the optgroup header and options within it, 23094 // then pass it to the wrapper template 23095 html_children = document.createDocumentFragment(); 23096 html_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup])); 23097 html_children.appendChild(groups[optgroup]); 23098 23099 html.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], { 23100 html: domToString(html_children), 23101 dom: html_children 23102 }))); 23103 } else { 23104 html.appendChild(groups[optgroup]); 23105 } 23106 } 23107 23108 $dropdown_content.html(html); 23109 23110 // highlight matching terms inline 23111 if (self.settings.highlight) { 23112 $dropdown_content.removeHighlight(); 23113 if (results.query.length && results.tokens.length) { 23114 for (i = 0, n = results.tokens.length; i < n; i++) { 23115 highlight($dropdown_content, results.tokens[i].regex); 23116 } 23117 } 23118 } 23119 23120 // add "selected" class to selected options 23121 if (!self.settings.hideSelected) { 23122 for (i = 0, n = self.items.length; i < n; i++) { 23123 self.getOption(self.items[i]).addClass('selected'); 23124 } 23125 } 23126 23127 // add create option 23128 has_create_option = self.canCreate(query); 23129 if (has_create_option) { 23130 $dropdown_content.prepend(self.render('option_create', {input: query})); 23131 $create = $($dropdown_content[0].childNodes[0]); 23132 } 23133 23134 // activate 23135 self.hasOptions = results.items.length > 0 || has_create_option; 23136 if (self.hasOptions) { 23137 if (results.items.length > 0) { 23138 $active_before = active_before && self.getOption(active_before); 23139 if ($active_before && $active_before.length) { 23140 $active = $active_before; 23141 } else if (self.settings.mode === 'single' && self.items.length) { 23142 $active = self.getOption(self.items[0]); 23143 } 23144 if (!$active || !$active.length) { 23145 if ($create && !self.settings.addPrecedence) { 23146 $active = self.getAdjacentOption($create, 1); 23147 } else { 23148 $active = $dropdown_content.find('[data-selectable]:first'); 23149 } 23150 } 23151 } else { 23152 $active = $create; 23153 } 23154 self.setActiveOption($active); 23155 if (triggerDropdown && !self.isOpen) { self.open(); } 23156 } else { 23157 self.setActiveOption(null); 23158 if (triggerDropdown && self.isOpen) { self.close(); } 23159 } 23160 }, 23161 23162 /** 23163 * Adds an available option. If it already exists, 23164 * nothing will happen. Note: this does not refresh 23165 * the options list dropdown (use `refreshOptions` 23166 * for that). 23167 * 23168 * Usage: 23169 * 23170 * this.addOption(data) 23171 * 23172 * @param {object|array} data 23173 */ 23174 addOption: function(data) { 23175 var i, n, value, self = this; 23176 23177 if ($.isArray(data)) { 23178 for (i = 0, n = data.length; i < n; i++) { 23179 self.addOption(data[i]); 23180 } 23181 return; 23182 } 23183 23184 if (value = self.registerOption(data)) { 23185 self.userOptions[value] = true; 23186 self.lastQuery = null; 23187 self.trigger('option_add', value, data); 23188 } 23189 }, 23190 23191 /** 23192 * Registers an option to the pool of options. 23193 * 23194 * @param {object} data 23195 * @return {boolean|string} 23196 */ 23197 registerOption: function(data) { 23198 var key = hash_key(data[this.settings.valueField]); 23199 if (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false; 23200 data.$order = data.$order || ++this.order; 23201 this.options[key] = data; 23202 return key; 23203 }, 23204 23205 /** 23206 * Registers an option group to the pool of option groups. 23207 * 23208 * @param {object} data 23209 * @return {boolean|string} 23210 */ 23211 registerOptionGroup: function(data) { 23212 var key = hash_key(data[this.settings.optgroupValueField]); 23213 if (!key) return false; 23214 23215 data.$order = data.$order || ++this.order; 23216 this.optgroups[key] = data; 23217 return key; 23218 }, 23219 23220 /** 23221 * Registers a new optgroup for options 23222 * to be bucketed into. 23223 * 23224 * @param {string} id 23225 * @param {object} data 23226 */ 23227 addOptionGroup: function(id, data) { 23228 data[this.settings.optgroupValueField] = id; 23229 if (id = this.registerOptionGroup(data)) { 23230 this.trigger('optgroup_add', id, data); 23231 } 23232 }, 23233 23234 /** 23235 * Removes an existing option group. 23236 * 23237 * @param {string} id 23238 */ 23239 removeOptionGroup: function(id) { 23240 if (this.optgroups.hasOwnProperty(id)) { 23241 delete this.optgroups[id]; 23242 this.renderCache = {}; 23243 this.trigger('optgroup_remove', id); 23244 } 23245 }, 23246 23247 /** 23248 * Clears all existing option groups. 23249 */ 23250 clearOptionGroups: function() { 23251 this.optgroups = {}; 23252 this.renderCache = {}; 23253 this.trigger('optgroup_clear'); 23254 }, 23255 23256 /** 23257 * Updates an option available for selection. If 23258 * it is visible in the selected items or options 23259 * dropdown, it will be re-rendered automatically. 23260 * 23261 * @param {string} value 23262 * @param {object} data 23263 */ 23264 updateOption: function(value, data) { 23265 var self = this; 23266 var $item, $item_new; 23267 var value_new, index_item, cache_items, cache_options, order_old; 23268 23269 value = hash_key(value); 23270 value_new = hash_key(data[self.settings.valueField]); 23271 23272 // sanity checks 23273 if (value === null) return; 23274 if (!self.options.hasOwnProperty(value)) return; 23275 if (typeof value_new !== 'string') throw new Error('Value must be set in option data'); 23276 23277 order_old = self.options[value].$order; 23278 23279 // update references 23280 if (value_new !== value) { 23281 delete self.options[value]; 23282 index_item = self.items.indexOf(value); 23283 if (index_item !== -1) { 23284 self.items.splice(index_item, 1, value_new); 23285 } 23286 } 23287 data.$order = data.$order || order_old; 23288 self.options[value_new] = data; 23289 23290 // invalidate render cache 23291 cache_items = self.renderCache['item']; 23292 cache_options = self.renderCache['option']; 23293 23294 if (cache_items) { 23295 delete cache_items[value]; 23296 delete cache_items[value_new]; 23297 } 23298 if (cache_options) { 23299 delete cache_options[value]; 23300 delete cache_options[value_new]; 23301 } 23302 23303 // update the item if it's selected 23304 if (self.items.indexOf(value_new) !== -1) { 23305 $item = self.getItem(value); 23306 $item_new = $(self.render('item', data)); 23307 if ($item.hasClass('active')) $item_new.addClass('active'); 23308 $item.replaceWith($item_new); 23309 } 23310 23311 // invalidate last query because we might have updated the sortField 23312 self.lastQuery = null; 23313 23314 // update dropdown contents 23315 if (self.isOpen) { 23316 self.refreshOptions(false); 23317 } 23318 }, 23319 23320 /** 23321 * Removes a single option. 23322 * 23323 * @param {string} value 23324 * @param {boolean} silent 23325 */ 23326 removeOption: function(value, silent) { 23327 var self = this; 23328 value = hash_key(value); 23329 23330 var cache_items = self.renderCache['item']; 23331 var cache_options = self.renderCache['option']; 23332 if (cache_items) delete cache_items[value]; 23333 if (cache_options) delete cache_options[value]; 23334 23335 delete self.userOptions[value]; 23336 delete self.options[value]; 23337 self.lastQuery = null; 23338 self.trigger('option_remove', value); 23339 self.removeItem(value, silent); 23340 }, 23341 23342 /** 23343 * Clears all options. 23344 */ 23345 clearOptions: function() { 23346 var self = this; 23347 23348 self.loadedSearches = {}; 23349 self.userOptions = {}; 23350 self.renderCache = {}; 23351 var options = self.options; 23352 $.each(self.options, function(key, value) { 23353 if(self.items.indexOf(key) == -1) { 23354 delete options[key]; 23355 } 23356 }); 23357 self.options = self.sifter.items = options; 23358 self.lastQuery = null; 23359 self.trigger('option_clear'); 23360 }, 23361 23362 /** 23363 * Returns the jQuery element of the option 23364 * matching the given value. 23365 * 23366 * @param {string} value 23367 * @returns {object} 23368 */ 23369 getOption: function(value) { 23370 return this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]')); 23371 }, 23372 23373 /** 23374 * Returns the jQuery element of the next or 23375 * previous selectable option. 23376 * 23377 * @param {object} $option 23378 * @param {int} direction can be 1 for next or -1 for previous 23379 * @return {object} 23380 */ 23381 getAdjacentOption: function($option, direction) { 23382 var $options = this.$dropdown.find('[data-selectable]'); 23383 var index = $options.index($option) + direction; 23384 23385 return index >= 0 && index < $options.length ? $options.eq(index) : $(); 23386 }, 23387 23388 /** 23389 * Finds the first element with a "data-value" attribute 23390 * that matches the given value. 23391 * 23392 * @param {mixed} value 23393 * @param {object} $els 23394 * @return {object} 23395 */ 23396 getElementWithValue: function(value, $els) { 23397 value = hash_key(value); 23398 23399 if (typeof value !== 'undefined' && value !== null) { 23400 for (var i = 0, n = $els.length; i < n; i++) { 23401 if ($els[i].getAttribute('data-value') === value) { 23402 return $($els[i]); 23403 } 23404 } 23405 } 23406 23407 return $(); 23408 }, 23409 23410 /** 23411 * Returns the jQuery element of the item 23412 * matching the given value. 23413 * 23414 * @param {string} value 23415 * @returns {object} 23416 */ 23417 getItem: function(value) { 23418 return this.getElementWithValue(value, this.$control.children()); 23419 }, 23420 23421 /** 23422 * "Selects" multiple items at once. Adds them to the list 23423 * at the current caret position. 23424 * 23425 * @param {string} value 23426 * @param {boolean} silent 23427 */ 23428 addItems: function(values, silent) { 23429 this.buffer = document.createDocumentFragment(); 23430 23431 var childNodes = this.$control[0].childNodes; 23432 for (var i = 0; i < childNodes.length; i++) { 23433 this.buffer.appendChild(childNodes[i]); 23434 } 23435 23436 var items = $.isArray(values) ? values : [values]; 23437 for (var i = 0, n = items.length; i < n; i++) { 23438 this.isPending = (i < n - 1); 23439 this.addItem(items[i], silent); 23440 } 23441 23442 var control = this.$control[0]; 23443 control.insertBefore(this.buffer, control.firstChild); 23444 23445 this.buffer = null; 23446 }, 23447 23448 /** 23449 * "Selects" an item. Adds it to the list 23450 * at the current caret position. 23451 * 23452 * @param {string} value 23453 * @param {boolean} silent 23454 */ 23455 addItem: function(value, silent) { 23456 var events = silent ? [] : ['change']; 23457 23458 debounce_events(this, events, function() { 23459 var $item, $option, $options; 23460 var self = this; 23461 var inputMode = self.settings.mode; 23462 var i, active, value_next, wasFull; 23463 value = hash_key(value); 23464 23465 if (self.items.indexOf(value) !== -1) { 23466 if (inputMode === 'single') self.close(); 23467 return; 23468 } 23469 23470 if (!self.options.hasOwnProperty(value)) return; 23471 if (inputMode === 'single') self.clear(silent); 23472 if (inputMode === 'multi' && self.isFull()) return; 23473 23474 $item = $(self.render('item', self.options[value])); 23475 wasFull = self.isFull(); 23476 self.items.splice(self.caretPos, 0, value); 23477 self.insertAtCaret($item); 23478 if (!self.isPending || (!wasFull && self.isFull())) { 23479 self.refreshState(); 23480 } 23481 23482 if (self.isSetup) { 23483 $options = self.$dropdown_content.find('[data-selectable]'); 23484 23485 // update menu / remove the option (if this is not one item being added as part of series) 23486 if (!self.isPending) { 23487 $option = self.getOption(value); 23488 value_next = self.getAdjacentOption($option, 1).attr('data-value'); 23489 self.refreshOptions(self.isFocused && inputMode !== 'single'); 23490 if (value_next) { 23491 self.setActiveOption(self.getOption(value_next)); 23492 } 23493 } 23494 23495 // hide the menu if the maximum number of items have been selected or no options are left 23496 if (!$options.length || self.isFull()) { 23497 self.close(); 23498 } else if (!self.isPending) { 23499 self.positionDropdown(); 23500 } 23501 23502 self.updatePlaceholder(); 23503 self.trigger('item_add', value, $item); 23504 23505 if (!self.isPending) { 23506 self.updateOriginalInput({silent: silent}); 23507 } 23508 } 23509 }); 23510 }, 23511 23512 /** 23513 * Removes the selected item matching 23514 * the provided value. 23515 * 23516 * @param {string} value 23517 */ 23518 removeItem: function(value, silent) { 23519 var self = this; 23520 var $item, i, idx; 23521 23522 $item = (value instanceof $) ? value : self.getItem(value); 23523 value = hash_key($item.attr('data-value')); 23524 i = self.items.indexOf(value); 23525 23526 if (i !== -1) { 23527 $item.remove(); 23528 if ($item.hasClass('active')) { 23529 idx = self.$activeItems.indexOf($item[0]); 23530 self.$activeItems.splice(idx, 1); 23531 } 23532 23533 self.items.splice(i, 1); 23534 self.lastQuery = null; 23535 if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) { 23536 self.removeOption(value, silent); 23537 } 23538 23539 if (i < self.caretPos) { 23540 self.setCaret(self.caretPos - 1); 23541 } 23542 23543 self.refreshState(); 23544 self.updatePlaceholder(); 23545 self.updateOriginalInput({silent: silent}); 23546 self.positionDropdown(); 23547 self.trigger('item_remove', value, $item); 23548 } 23549 }, 23550 23551 /** 23552 * Invokes the `create` method provided in the 23553 * selectize options that should provide the data 23554 * for the new item, given the user input. 23555 * 23556 * Once this completes, it will be added 23557 * to the item list. 23558 * 23559 * @param {string} value 23560 * @param {boolean} [triggerDropdown] 23561 * @param {function} [callback] 23562 * @return {boolean} 23563 */ 23564 createItem: function(input, triggerDropdown) { 23565 var self = this; 23566 var caret = self.caretPos; 23567 input = input || $.trim(self.$control_input.val() || ''); 23568 23569 var callback = arguments[arguments.length - 1]; 23570 if (typeof callback !== 'function') callback = function() {}; 23571 23572 if (typeof triggerDropdown !== 'boolean') { 23573 triggerDropdown = true; 23574 } 23575 23576 if (!self.canCreate(input)) { 23577 callback(); 23578 return false; 23579 } 23580 23581 self.lock(); 23582 23583 var setup = (typeof self.settings.create === 'function') ? this.settings.create : function(input) { 23584 var data = {}; 23585 data[self.settings.labelField] = input; 23586 data[self.settings.valueField] = input; 23587 return data; 23588 }; 23589 23590 var create = once(function(data) { 23591 self.unlock(); 23592 23593 if (!data || typeof data !== 'object') return callback(); 23594 var value = hash_key(data[self.settings.valueField]); 23595 if (typeof value !== 'string') return callback(); 23596 23597 self.setTextboxValue(''); 23598 self.addOption(data); 23599 self.setCaret(caret); 23600 self.addItem(value); 23601 self.refreshOptions(triggerDropdown && self.settings.mode !== 'single'); 23602 callback(data); 23603 }); 23604 23605 var output = setup.apply(this, [input, create]); 23606 if (typeof output !== 'undefined') { 23607 create(output); 23608 } 23609 23610 return true; 23611 }, 23612 23613 /** 23614 * Re-renders the selected item lists. 23615 */ 23616 refreshItems: function() { 23617 this.lastQuery = null; 23618 23619 if (this.isSetup) { 23620 this.addItem(this.items); 23621 } 23622 23623 this.refreshState(); 23624 this.updateOriginalInput(); 23625 }, 23626 23627 /** 23628 * Updates all state-dependent attributes 23629 * and CSS classes. 23630 */ 23631 refreshState: function() { 23632 this.refreshValidityState(); 23633 this.refreshClasses(); 23634 }, 23635 23636 /** 23637 * Update the `required` attribute of both input and control input. 23638 * 23639 * The `required` property needs to be activated on the control input 23640 * for the error to be displayed at the right place. `required` also 23641 * needs to be temporarily deactivated on the input since the input is 23642 * hidden and can't show errors. 23643 */ 23644 refreshValidityState: function() { 23645 if (!this.isRequired) return false; 23646 23647 var invalid = !this.items.length; 23648 23649 this.isInvalid = invalid; 23650 this.$control_input.prop('required', invalid); 23651 this.$input.prop('required', !invalid); 23652 }, 23653 23654 /** 23655 * Updates all state-dependent CSS classes. 23656 */ 23657 refreshClasses: function() { 23658 var self = this; 23659 var isFull = self.isFull(); 23660 var isLocked = self.isLocked; 23661 23662 self.$wrapper 23663 .toggleClass('rtl', self.rtl); 23664 23665 self.$control 23666 .toggleClass('focus', self.isFocused) 23667 .toggleClass('disabled', self.isDisabled) 23668 .toggleClass('required', self.isRequired) 23669 .toggleClass('invalid', self.isInvalid) 23670 .toggleClass('locked', isLocked) 23671 .toggleClass('full', isFull).toggleClass('not-full', !isFull) 23672 .toggleClass('input-active', self.isFocused && !self.isInputHidden) 23673 .toggleClass('dropdown-active', self.isOpen) 23674 .toggleClass('has-options', !$.isEmptyObject(self.options)) 23675 .toggleClass('has-items', self.items.length > 0); 23676 23677 self.$control_input.data('grow', !isFull && !isLocked); 23678 }, 23679 23680 /** 23681 * Determines whether or not more items can be added 23682 * to the control without exceeding the user-defined maximum. 23683 * 23684 * @returns {boolean} 23685 */ 23686 isFull: function() { 23687 return this.settings.maxItems !== null && this.items.length >= this.settings.maxItems; 23688 }, 23689 23690 /** 23691 * Refreshes the original <select> or <input> 23692 * element to reflect the current state. 23693 */ 23694 updateOriginalInput: function(opts) { 23695 var i, n, options, label, self = this; 23696 opts = opts || {}; 23697 23698 if (self.tagType === TAG_SELECT) { 23699 options = []; 23700 for (i = 0, n = self.items.length; i < n; i++) { 23701 label = self.options[self.items[i]][self.settings.labelField] || ''; 23702 options.push('<option value="' + escape_html(self.items[i]) + '" selected="selected">' + escape_html(label) + '</option>'); 23703 } 23704 if (!options.length && !this.$input.attr('multiple')) { 23705 options.push('<option value="" selected="selected"></option>'); 23706 } 23707 self.$input.html(options.join('')); 23708 } else { 23709 self.$input.val(self.getValue()); 23710 self.$input.attr('value',self.$input.val()); 23711 } 23712 23713 if (self.isSetup) { 23714 if (!opts.silent) { 23715 self.trigger('change', self.$input.val()); 23716 } 23717 } 23718 }, 23719 23720 /** 23721 * Shows/hide the input placeholder depending 23722 * on if there items in the list already. 23723 */ 23724 updatePlaceholder: function() { 23725 if (!this.settings.placeholder) return; 23726 var $input = this.$control_input; 23727 23728 if (this.items.length) { 23729 $input.removeAttr('placeholder'); 23730 } else { 23731 $input.attr('placeholder', this.settings.placeholder); 23732 } 23733 $input.triggerHandler('update', {force: true}); 23734 }, 23735 23736 /** 23737 * Shows the autocomplete dropdown containing 23738 * the available options. 23739 */ 23740 open: function() { 23741 var self = this; 23742 23743 if (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return; 23744 self.focus(); 23745 self.isOpen = true; 23746 self.refreshState(); 23747 self.$dropdown.css({visibility: 'hidden', display: 'block'}); 23748 self.positionDropdown(); 23749 self.$dropdown.css({visibility: 'visible'}); 23750 self.trigger('dropdown_open', self.$dropdown); 23751 }, 23752 23753 /** 23754 * Closes the autocomplete dropdown menu. 23755 */ 23756 close: function() { 23757 var self = this; 23758 var trigger = self.isOpen; 23759 23760 if (self.settings.mode === 'single' && self.items.length) { 23761 self.hideInput(); 23762 23763 // Do not trigger blur while inside a blur event, 23764 // this fixes some weird tabbing behavior in FF and IE. 23765 // See #1164 23766 if (!self.isBlurring) { 23767 self.$control_input.blur(); // close keyboard on iOS 23768 } 23769 } 23770 23771 self.isOpen = false; 23772 self.$dropdown.hide(); 23773 self.setActiveOption(null); 23774 self.refreshState(); 23775 23776 if (trigger) self.trigger('dropdown_close', self.$dropdown); 23777 }, 23778 23779 /** 23780 * Calculates and applies the appropriate 23781 * position of the dropdown. 23782 */ 23783 positionDropdown: function() { 23784 var $control = this.$control; 23785 var offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position(); 23786 offset.top += $control.outerHeight(true); 23787 23788 this.$dropdown.css({ 23789 width : $control[0].getBoundingClientRect().width, 23790 top : offset.top, 23791 left : offset.left 23792 }); 23793 }, 23794 23795 /** 23796 * Resets / clears all selected items 23797 * from the control. 23798 * 23799 * @param {boolean} silent 23800 */ 23801 clear: function(silent) { 23802 var self = this; 23803 23804 if (!self.items.length) return; 23805 self.$control.children(':not(input)').remove(); 23806 self.items = []; 23807 self.lastQuery = null; 23808 self.setCaret(0); 23809 self.setActiveItem(null); 23810 self.updatePlaceholder(); 23811 self.updateOriginalInput({silent: silent}); 23812 self.refreshState(); 23813 self.showInput(); 23814 self.trigger('clear'); 23815 }, 23816 23817 /** 23818 * A helper method for inserting an element 23819 * at the current caret position. 23820 * 23821 * @param {object} $el 23822 */ 23823 insertAtCaret: function($el) { 23824 var caret = Math.min(this.caretPos, this.items.length); 23825 var el = $el[0]; 23826 var target = this.buffer || this.$control[0]; 23827 23828 if (caret === 0) { 23829 target.insertBefore(el, target.firstChild); 23830 } else { 23831 target.insertBefore(el, target.childNodes[caret]); 23832 } 23833 23834 this.setCaret(caret + 1); 23835 }, 23836 23837 /** 23838 * Removes the current selected item(s). 23839 * 23840 * @param {object} e (optional) 23841 * @returns {boolean} 23842 */ 23843 deleteSelection: function(e) { 23844 var i, n, direction, selection, values, caret, option_select, $option_select, $tail; 23845 var self = this; 23846 23847 direction = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1; 23848 selection = getSelection(self.$control_input[0]); 23849 23850 if (self.$activeOption && !self.settings.hideSelected) { 23851 option_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value'); 23852 } 23853 23854 // determine items that will be removed 23855 values = []; 23856 23857 if (self.$activeItems.length) { 23858 $tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first')); 23859 caret = self.$control.children(':not(input)').index($tail); 23860 if (direction > 0) { caret++; } 23861 23862 for (i = 0, n = self.$activeItems.length; i < n; i++) { 23863 values.push($(self.$activeItems[i]).attr('data-value')); 23864 } 23865 if (e) { 23866 e.preventDefault(); 23867 e.stopPropagation(); 23868 } 23869 } else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) { 23870 if (direction < 0 && selection.start === 0 && selection.length === 0) { 23871 values.push(self.items[self.caretPos - 1]); 23872 } else if (direction > 0 && selection.start === self.$control_input.val().length) { 23873 values.push(self.items[self.caretPos]); 23874 } 23875 } 23876 23877 // allow the callback to abort 23878 if (!values.length || (typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false)) { 23879 return false; 23880 } 23881 23882 // perform removal 23883 if (typeof caret !== 'undefined') { 23884 self.setCaret(caret); 23885 } 23886 while (values.length) { 23887 self.removeItem(values.pop()); 23888 } 23889 23890 self.showInput(); 23891 self.positionDropdown(); 23892 self.refreshOptions(true); 23893 23894 // select previous option 23895 if (option_select) { 23896 $option_select = self.getOption(option_select); 23897 if ($option_select.length) { 23898 self.setActiveOption($option_select); 23899 } 23900 } 23901 23902 return true; 23903 }, 23904 23905 /** 23906 * Selects the previous / next item (depending 23907 * on the `direction` argument). 23908 * 23909 * > 0 - right 23910 * < 0 - left 23911 * 23912 * @param {int} direction 23913 * @param {object} e (optional) 23914 */ 23915 advanceSelection: function(direction, e) { 23916 var tail, selection, idx, valueLength, cursorAtEdge, $tail; 23917 var self = this; 23918 23919 if (direction === 0) return; 23920 if (self.rtl) direction *= -1; 23921 23922 tail = direction > 0 ? 'last' : 'first'; 23923 selection = getSelection(self.$control_input[0]); 23924 23925 if (self.isFocused && !self.isInputHidden) { 23926 valueLength = self.$control_input.val().length; 23927 cursorAtEdge = direction < 0 23928 ? selection.start === 0 && selection.length === 0 23929 : selection.start === valueLength; 23930 23931 if (cursorAtEdge && !valueLength) { 23932 self.advanceCaret(direction, e); 23933 } 23934 } else { 23935 $tail = self.$control.children('.active:' + tail); 23936 if ($tail.length) { 23937 idx = self.$control.children(':not(input)').index($tail); 23938 self.setActiveItem(null); 23939 self.setCaret(direction > 0 ? idx + 1 : idx); 23940 } 23941 } 23942 }, 23943 23944 /** 23945 * Moves the caret left / right. 23946 * 23947 * @param {int} direction 23948 * @param {object} e (optional) 23949 */ 23950 advanceCaret: function(direction, e) { 23951 var self = this, fn, $adj; 23952 23953 if (direction === 0) return; 23954 23955 fn = direction > 0 ? 'next' : 'prev'; 23956 if (self.isShiftDown) { 23957 $adj = self.$control_input[fn](); 23958 if ($adj.length) { 23959 self.hideInput(); 23960 self.setActiveItem($adj); 23961 e && e.preventDefault(); 23962 } 23963 } else { 23964 self.setCaret(self.caretPos + direction); 23965 } 23966 }, 23967 23968 /** 23969 * Moves the caret to the specified index. 23970 * 23971 * @param {int} i 23972 */ 23973 setCaret: function(i) { 23974 var self = this; 23975 23976 if (self.settings.mode === 'single') { 23977 i = self.items.length; 23978 } else { 23979 i = Math.max(0, Math.min(self.items.length, i)); 23980 } 23981 23982 if(!self.isPending) { 23983 // the input must be moved by leaving it in place and moving the 23984 // siblings, due to the fact that focus cannot be restored once lost 23985 // on mobile webkit devices 23986 var j, n, fn, $children, $child; 23987 $children = self.$control.children(':not(input)'); 23988 for (j = 0, n = $children.length; j < n; j++) { 23989 $child = $($children[j]).detach(); 23990 if (j < i) { 23991 self.$control_input.before($child); 23992 } else { 23993 self.$control.append($child); 23994 } 23995 } 23996 } 23997 23998 self.caretPos = i; 23999 }, 24000 24001 /** 24002 * Disables user input on the control. Used while 24003 * items are being asynchronously created. 24004 */ 24005 lock: function() { 24006 this.close(); 24007 this.isLocked = true; 24008 this.refreshState(); 24009 }, 24010 24011 /** 24012 * Re-enables user input on the control. 24013 */ 24014 unlock: function() { 24015 this.isLocked = false; 24016 this.refreshState(); 24017 }, 24018 24019 /** 24020 * Disables user input on the control completely. 24021 * While disabled, it cannot receive focus. 24022 */ 24023 disable: function() { 24024 var self = this; 24025 self.$input.prop('disabled', true); 24026 self.$control_input.prop('disabled', true).prop('tabindex', -1); 24027 self.isDisabled = true; 24028 self.lock(); 24029 }, 24030 24031 /** 24032 * Enables the control so that it can respond 24033 * to focus and user input. 24034 */ 24035 enable: function() { 24036 var self = this; 24037 self.$input.prop('disabled', false); 24038 self.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex); 24039 self.isDisabled = false; 24040 self.unlock(); 24041 }, 24042 24043 /** 24044 * Completely destroys the control and 24045 * unbinds all event listeners so that it can 24046 * be garbage collected. 24047 */ 24048 destroy: function() { 24049 var self = this; 24050 var eventNS = self.eventNS; 24051 var revertSettings = self.revertSettings; 24052 24053 self.trigger('destroy'); 24054 self.off(); 24055 self.$wrapper.remove(); 24056 self.$dropdown.remove(); 24057 24058 self.$input 24059 .html('') 24060 .append(revertSettings.$children) 24061 .removeAttr('tabindex') 24062 .removeClass('selectized') 24063 .attr({tabindex: revertSettings.tabindex}) 24064 .show(); 24065 24066 self.$control_input.removeData('grow'); 24067 self.$input.removeData('selectize'); 24068 24069 if (--Selectize.count == 0 && Selectize.$testInput) { 24070 Selectize.$testInput.remove(); 24071 Selectize.$testInput = undefined; 24072 } 24073 24074 $(window).off(eventNS); 24075 $(document).off(eventNS); 24076 $(document.body).off(eventNS); 24077 24078 delete self.$input[0].selectize; 24079 }, 24080 24081 /** 24082 * A helper method for rendering "item" and 24083 * "option" templates, given the data. 24084 * 24085 * @param {string} templateName 24086 * @param {object} data 24087 * @returns {string} 24088 */ 24089 render: function(templateName, data) { 24090 var value, id, label; 24091 var html = ''; 24092 var cache = false; 24093 var self = this; 24094 var regex_tag = /^[\t \r\n]*<([a-z][a-z0-9\-_]*(?:\:[a-z][a-z0-9\-_]*)?)/i; 24095 24096 if (templateName === 'option' || templateName === 'item') { 24097 value = hash_key(data[self.settings.valueField]); 24098 cache = !!value; 24099 } 24100 24101 // pull markup from cache if it exists 24102 if (cache) { 24103 if (!isset(self.renderCache[templateName])) { 24104 self.renderCache[templateName] = {}; 24105 } 24106 if (self.renderCache[templateName].hasOwnProperty(value)) { 24107 return self.renderCache[templateName][value]; 24108 } 24109 } 24110 24111 // render markup 24112 html = $(self.settings.render[templateName].apply(this, [data, escape_html])); 24113 24114 // add mandatory attributes 24115 if (templateName === 'option' || templateName === 'option_create') { 24116 if (!data[self.settings.disabledField]) { 24117 html.attr('data-selectable', ''); 24118 } 24119 } 24120 else if (templateName === 'optgroup') { 24121 id = data[self.settings.optgroupValueField] || ''; 24122 html.attr('data-group', id); 24123 if(data[self.settings.disabledField]) { 24124 html.attr('data-disabled', ''); 24125 } 24126 } 24127 if (templateName === 'option' || templateName === 'item') { 24128 html.attr('data-value', value || ''); 24129 } 24130 24131 // update cache 24132 if (cache) { 24133 self.renderCache[templateName][value] = html[0]; 24134 } 24135 24136 return html[0]; 24137 }, 24138 24139 /** 24140 * Clears the render cache for a template. If 24141 * no template is given, clears all render 24142 * caches. 24143 * 24144 * @param {string} templateName 24145 */ 24146 clearCache: function(templateName) { 24147 var self = this; 24148 if (typeof templateName === 'undefined') { 24149 self.renderCache = {}; 24150 } else { 24151 delete self.renderCache[templateName]; 24152 } 24153 }, 24154 24155 /** 24156 * Determines whether or not to display the 24157 * create item prompt, given a user input. 24158 * 24159 * @param {string} input 24160 * @return {boolean} 24161 */ 24162 canCreate: function(input) { 24163 var self = this; 24164 if (!self.settings.create) return false; 24165 var filter = self.settings.createFilter; 24166 return input.length 24167 && (typeof filter !== 'function' || filter.apply(self, [input])) 24168 && (typeof filter !== 'string' || new RegExp(filter).test(input)) 24169 && (!(filter instanceof RegExp) || filter.test(input)); 24170 } 24171 24172 }); 24173 24174 24175 Selectize.count = 0; 24176 Selectize.defaults = { 24177 options: [], 24178 optgroups: [], 24179 24180 plugins: [], 24181 delimiter: ',', 24182 splitOn: null, // regexp or string for splitting up values from a paste command 24183 persist: true, 24184 diacritics: true, 24185 create: false, 24186 createOnBlur: false, 24187 createFilter: null, 24188 highlight: true, 24189 openOnFocus: true, 24190 maxOptions: 1000, 24191 maxItems: null, 24192 hideSelected: null, 24193 addPrecedence: false, 24194 selectOnTab: false, 24195 preload: false, 24196 allowEmptyOption: false, 24197 closeAfterSelect: false, 24198 24199 scrollDuration: 60, 24200 loadThrottle: 300, 24201 loadingClass: 'loading', 24202 24203 dataAttr: 'data-data', 24204 optgroupField: 'optgroup', 24205 valueField: 'value', 24206 labelField: 'text', 24207 disabledField: 'disabled', 24208 optgroupLabelField: 'label', 24209 optgroupValueField: 'value', 24210 lockOptgroupOrder: false, 24211 24212 sortField: '$order', 24213 searchField: ['text'], 24214 searchConjunction: 'and', 24215 24216 mode: null, 24217 wrapperClass: 'selectize-control', 24218 inputClass: 'selectize-input', 24219 dropdownClass: 'selectize-dropdown', 24220 dropdownContentClass: 'selectize-dropdown-content', 24221 24222 dropdownParent: null, 24223 24224 copyClassesToDropdown: true, 24225 24226 /* 24227 load : null, // function(query, callback) { ... } 24228 score : null, // function(search) { ... } 24229 onInitialize : null, // function() { ... } 24230 onChange : null, // function(value) { ... } 24231 onItemAdd : null, // function(value, $item) { ... } 24232 onItemRemove : null, // function(value) { ... } 24233 onClear : null, // function() { ... } 24234 onOptionAdd : null, // function(value, data) { ... } 24235 onOptionRemove : null, // function(value) { ... } 24236 onOptionClear : null, // function() { ... } 24237 onOptionGroupAdd : null, // function(id, data) { ... } 24238 onOptionGroupRemove : null, // function(id) { ... } 24239 onOptionGroupClear : null, // function() { ... } 24240 onDropdownOpen : null, // function($dropdown) { ... } 24241 onDropdownClose : null, // function($dropdown) { ... } 24242 onType : null, // function(str) { ... } 24243 onDelete : null, // function(values) { ... } 24244 */ 24245 24246 render: { 24247 /* 24248 item: null, 24249 optgroup: null, 24250 optgroup_header: null, 24251 option: null, 24252 option_create: null 24253 */ 24254 } 24255 }; 24256 24257 24258 $.fn.selectize = function(settings_user) { 24259 var defaults = $.fn.selectize.defaults; 24260 var settings = $.extend({}, defaults, settings_user); 24261 var attr_data = settings.dataAttr; 24262 var field_label = settings.labelField; 24263 var field_value = settings.valueField; 24264 var field_disabled = settings.disabledField; 24265 var field_optgroup = settings.optgroupField; 24266 var field_optgroup_label = settings.optgroupLabelField; 24267 var field_optgroup_value = settings.optgroupValueField; 24268 24269 /** 24270 * Initializes selectize from a <input type="text"> element. 24271 * 24272 * @param {object} $input 24273 * @param {object} settings_element 24274 */ 24275 var init_textbox = function($input, settings_element) { 24276 var i, n, values, option; 24277 24278 var data_raw = $input.attr(attr_data); 24279 24280 if (!data_raw) { 24281 var value = $.trim($input.val() || ''); 24282 if (!settings.allowEmptyOption && !value.length) return; 24283 values = value.split(settings.delimiter); 24284 for (i = 0, n = values.length; i < n; i++) { 24285 option = {}; 24286 option[field_label] = values[i]; 24287 option[field_value] = values[i]; 24288 settings_element.options.push(option); 24289 } 24290 settings_element.items = values; 24291 } else { 24292 settings_element.options = JSON.parse(data_raw); 24293 for (i = 0, n = settings_element.options.length; i < n; i++) { 24294 settings_element.items.push(settings_element.options[i][field_value]); 24295 } 24296 } 24297 }; 24298 24299 /** 24300 * Initializes selectize from a <select> element. 24301 * 24302 * @param {object} $input 24303 * @param {object} settings_element 24304 */ 24305 var init_select = function($input, settings_element) { 24306 var i, n, tagName, $children, order = 0; 24307 var options = settings_element.options; 24308 var optionsMap = {}; 24309 24310 var readData = function($el) { 24311 var data = attr_data && $el.attr(attr_data); 24312 if (typeof data === 'string' && data.length) { 24313 return JSON.parse(data); 24314 } 24315 return null; 24316 }; 24317 24318 var addOption = function($option, group) { 24319 $option = $($option); 24320 24321 var value = hash_key($option.val()); 24322 if (!value && !settings.allowEmptyOption) return; 24323 24324 // if the option already exists, it's probably been 24325 // duplicated in another optgroup. in this case, push 24326 // the current group to the "optgroup" property on the 24327 // existing option so that it's rendered in both places. 24328 if (optionsMap.hasOwnProperty(value)) { 24329 if (group) { 24330 var arr = optionsMap[value][field_optgroup]; 24331 if (!arr) { 24332 optionsMap[value][field_optgroup] = group; 24333 } else if (!$.isArray(arr)) { 24334 optionsMap[value][field_optgroup] = [arr, group]; 24335 } else { 24336 arr.push(group); 24337 } 24338 } 24339 return; 24340 } 24341 24342 var option = readData($option) || {}; 24343 option[field_label] = option[field_label] || $option.text(); 24344 option[field_value] = option[field_value] || value; 24345 option[field_disabled] = option[field_disabled] || $option.prop('disabled'); 24346 option[field_optgroup] = option[field_optgroup] || group; 24347 24348 optionsMap[value] = option; 24349 options.push(option); 24350 24351 if ($option.is(':selected')) { 24352 settings_element.items.push(value); 24353 } 24354 }; 24355 24356 var addGroup = function($optgroup) { 24357 var i, n, id, optgroup, $options; 24358 24359 $optgroup = $($optgroup); 24360 id = $optgroup.attr('label'); 24361 24362 if (id) { 24363 optgroup = readData($optgroup) || {}; 24364 optgroup[field_optgroup_label] = id; 24365 optgroup[field_optgroup_value] = id; 24366 optgroup[field_disabled] = $optgroup.prop('disabled'); 24367 settings_element.optgroups.push(optgroup); 24368 } 24369 24370 $options = $('option', $optgroup); 24371 for (i = 0, n = $options.length; i < n; i++) { 24372 addOption($options[i], id); 24373 } 24374 }; 24375 24376 settings_element.maxItems = $input.attr('multiple') ? null : 1; 24377 24378 $children = $input.children(); 24379 for (i = 0, n = $children.length; i < n; i++) { 24380 tagName = $children[i].tagName.toLowerCase(); 24381 if (tagName === 'optgroup') { 24382 addGroup($children[i]); 24383 } else if (tagName === 'option') { 24384 addOption($children[i]); 24385 } 24386 } 24387 }; 24388 24389 return this.each(function() { 24390 if (this.selectize) return; 24391 24392 var instance; 24393 var $input = $(this); 24394 var tag_name = this.tagName.toLowerCase(); 24395 var placeholder = $input.attr('placeholder') || $input.attr('data-placeholder'); 24396 if (!placeholder && !settings.allowEmptyOption) { 24397 placeholder = $input.children('option[value=""]').text(); 24398 } 24399 24400 var settings_element = { 24401 'placeholder' : placeholder, 24402 'options' : [], 24403 'optgroups' : [], 24404 'items' : [] 24405 }; 24406 24407 if (tag_name === 'select') { 24408 init_select($input, settings_element); 24409 } else { 24410 init_textbox($input, settings_element); 24411 } 24412 24413 instance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user)); 24414 }); 24415 }; 24416 24417 $.fn.selectize.defaults = Selectize.defaults; 24418 $.fn.selectize.support = { 24419 validity: SUPPORTS_VALIDITY_API 24420 }; 24421 24422 24423 Selectize.define('drag_drop', function(options) { 24424 if (!$.fn.sortable) throw new Error('The "drag_drop" plugin requires jQuery UI "sortable".'); 24425 if (this.settings.mode !== 'multi') return; 24426 var self = this; 24427 24428 self.lock = (function() { 24429 var original = self.lock; 24430 return function() { 24431 var sortable = self.$control.data('sortable'); 24432 if (sortable) sortable.disable(); 24433 return original.apply(self, arguments); 24434 }; 24435 })(); 24436 24437 self.unlock = (function() { 24438 var original = self.unlock; 24439 return function() { 24440 var sortable = self.$control.data('sortable'); 24441 if (sortable) sortable.enable(); 24442 return original.apply(self, arguments); 24443 }; 24444 })(); 24445 24446 self.setup = (function() { 24447 var original = self.setup; 24448 return function() { 24449 original.apply(this, arguments); 24450 24451 var $control = self.$control.sortable({ 24452 items: '[data-value]', 24453 forcePlaceholderSize: true, 24454 disabled: self.isLocked, 24455 start: function(e, ui) { 24456 ui.placeholder.css('width', ui.helper.css('width')); 24457 $control.css({overflow: 'visible'}); 24458 }, 24459 stop: function() { 24460 $control.css({overflow: 'hidden'}); 24461 var active = self.$activeItems ? self.$activeItems.slice() : null; 24462 var values = []; 24463 $control.children('[data-value]').each(function() { 24464 values.push($(this).attr('data-value')); 24465 }); 24466 self.setValue(values); 24467 self.setActiveItem(active); 24468 } 24469 }); 24470 }; 24471 })(); 24472 24473 }); 24474 24475 Selectize.define('dropdown_header', function(options) { 24476 var self = this; 24477 24478 options = $.extend({ 24479 title : 'Untitled', 24480 headerClass : 'selectize-dropdown-header', 24481 titleRowClass : 'selectize-dropdown-header-title', 24482 labelClass : 'selectize-dropdown-header-label', 24483 closeClass : 'selectize-dropdown-header-close', 24484 24485 html: function(data) { 24486 return ( 24487 '<div class="' + data.headerClass + '">' + 24488 '<div class="' + data.titleRowClass + '">' + 24489 '<span class="' + data.labelClass + '">' + data.title + '</span>' + 24490 '<a href="javascript:void(0)" class="' + data.closeClass + '">×</a>' + 24491 '</div>' + 24492 '</div>' 24493 ); 24494 } 24495 }, options); 24496 24497 self.setup = (function() { 24498 var original = self.setup; 24499 return function() { 24500 original.apply(self, arguments); 24501 self.$dropdown_header = $(options.html(options)); 24502 self.$dropdown.prepend(self.$dropdown_header); 24503 }; 24504 })(); 24505 24506 }); 24507 24508 Selectize.define('optgroup_columns', function(options) { 24509 var self = this; 24510 24511 options = $.extend({ 24512 equalizeWidth : true, 24513 equalizeHeight : true 24514 }, options); 24515 24516 this.getAdjacentOption = function($option, direction) { 24517 var $options = $option.closest('[data-group]').find('[data-selectable]'); 24518 var index = $options.index($option) + direction; 24519 24520 return index >= 0 && index < $options.length ? $options.eq(index) : $(); 24521 }; 24522 24523 this.onKeyDown = (function() { 24524 var original = self.onKeyDown; 24525 return function(e) { 24526 var index, $option, $options, $optgroup; 24527 24528 if (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) { 24529 self.ignoreHover = true; 24530 $optgroup = this.$activeOption.closest('[data-group]'); 24531 index = $optgroup.find('[data-selectable]').index(this.$activeOption); 24532 24533 if(e.keyCode === KEY_LEFT) { 24534 $optgroup = $optgroup.prev('[data-group]'); 24535 } else { 24536 $optgroup = $optgroup.next('[data-group]'); 24537 } 24538 24539 $options = $optgroup.find('[data-selectable]'); 24540 $option = $options.eq(Math.min($options.length - 1, index)); 24541 if ($option.length) { 24542 this.setActiveOption($option); 24543 } 24544 return; 24545 } 24546 24547 return original.apply(this, arguments); 24548 }; 24549 })(); 24550 24551 var getScrollbarWidth = function() { 24552 var div; 24553 var width = getScrollbarWidth.width; 24554 var doc = document; 24555 24556 if (typeof width === 'undefined') { 24557 div = doc.createElement('div'); 24558 div.innerHTML = '<div style="width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;"><div style="width:1px;height:100px;"></div></div>'; 24559 div = div.firstChild; 24560 doc.body.appendChild(div); 24561 width = getScrollbarWidth.width = div.offsetWidth - div.clientWidth; 24562 doc.body.removeChild(div); 24563 } 24564 return width; 24565 }; 24566 24567 var equalizeSizes = function() { 24568 var i, n, height_max, width, width_last, width_parent, $optgroups; 24569 24570 $optgroups = $('[data-group]', self.$dropdown_content); 24571 n = $optgroups.length; 24572 if (!n || !self.$dropdown_content.width()) return; 24573 24574 if (options.equalizeHeight) { 24575 height_max = 0; 24576 for (i = 0; i < n; i++) { 24577 height_max = Math.max(height_max, $optgroups.eq(i).height()); 24578 } 24579 $optgroups.css({height: height_max}); 24580 } 24581 24582 if (options.equalizeWidth) { 24583 width_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth(); 24584 width = Math.round(width_parent / n); 24585 $optgroups.css({width: width}); 24586 if (n > 1) { 24587 width_last = width_parent - width * (n - 1); 24588 $optgroups.eq(n - 1).css({width: width_last}); 24589 } 24590 } 24591 }; 24592 24593 if (options.equalizeHeight || options.equalizeWidth) { 24594 hook.after(this, 'positionDropdown', equalizeSizes); 24595 hook.after(this, 'refreshOptions', equalizeSizes); 24596 } 24597 24598 24599 }); 24600 24601 Selectize.define('remove_button', function(options) { 24602 options = $.extend({ 24603 label : '×', 24604 title : 'Remove', 24605 className : 'remove', 24606 append : true 24607 }, options); 24608 24609 var singleClose = function(thisRef, options) { 24610 24611 options.className = 'remove-single'; 24612 24613 var self = thisRef; 24614 var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>'; 24615 24616 /** 24617 * Appends an element as a child (with raw HTML). 24618 * 24619 * @param {string} html_container 24620 * @param {string} html_element 24621 * @return {string} 24622 */ 24623 var append = function(html_container, html_element) { 24624 return $('<span>').append(html_container) 24625 .append(html_element); 24626 }; 24627 24628 thisRef.setup = (function() { 24629 var original = self.setup; 24630 return function() { 24631 // override the item rendering method to add the button to each 24632 if (options.append) { 24633 var id = $(self.$input.context).attr('id'); 24634 var selectizer = $('#'+id); 24635 24636 var render_item = self.settings.render.item; 24637 self.settings.render.item = function(data) { 24638 return append(render_item.apply(thisRef, arguments), html); 24639 }; 24640 } 24641 24642 original.apply(thisRef, arguments); 24643 24644 // add event listener 24645 thisRef.$control.on('click', '.' + options.className, function(e) { 24646 e.preventDefault(); 24647 if (self.isLocked) return; 24648 24649 self.clear(); 24650 }); 24651 24652 }; 24653 })(); 24654 }; 24655 24656 var multiClose = function(thisRef, options) { 24657 24658 var self = thisRef; 24659 var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>'; 24660 24661 /** 24662 * Appends an element as a child (with raw HTML). 24663 * 24664 * @param {string} html_container 24665 * @param {string} html_element 24666 * @return {string} 24667 */ 24668 var append = function(html_container, html_element) { 24669 var pos = html_container.search(/(<\/[^>]+>\s*)$/); 24670 return html_container.substring(0, pos) + html_element + html_container.substring(pos); 24671 }; 24672 24673 thisRef.setup = (function() { 24674 var original = self.setup; 24675 return function() { 24676 // override the item rendering method to add the button to each 24677 if (options.append) { 24678 var render_item = self.settings.render.item; 24679 self.settings.render.item = function(data) { 24680 return append(render_item.apply(thisRef, arguments), html); 24681 }; 24682 } 24683 24684 original.apply(thisRef, arguments); 24685 24686 // add event listener 24687 thisRef.$control.on('click', '.' + options.className, function(e) { 24688 e.preventDefault(); 24689 if (self.isLocked) return; 24690 24691 var $item = $(e.currentTarget).parent(); 24692 self.setActiveItem($item); 24693 if (self.deleteSelection()) { 24694 self.setCaret(self.items.length); 24695 } 24696 }); 24697 24698 }; 24699 })(); 24700 }; 24701 24702 if (this.settings.mode === 'single') { 24703 singleClose(this, options); 24704 return; 24705 } else { 24706 multiClose(this, options); 24707 } 24708 }); 24709 24710 24711 Selectize.define('restore_on_backspace', function(options) { 24712 var self = this; 24713 24714 options.text = options.text || function(option) { 24715 return option[this.settings.labelField]; 24716 }; 24717 24718 this.onKeyDown = (function() { 24719 var original = self.onKeyDown; 24720 return function(e) { 24721 var index, option; 24722 if (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) { 24723 index = this.caretPos - 1; 24724 if (index >= 0 && index < this.items.length) { 24725 option = this.options[this.items[index]]; 24726 if (this.deleteSelection(e)) { 24727 this.setTextboxValue(options.text.apply(this, [option])); 24728 this.refreshOptions(true); 24729 } 24730 e.preventDefault(); 24731 return; 24732 } 24733 } 24734 return original.apply(this, arguments); 24735 }; 24736 })(); 24737 }); 24738 24739 24740 return Selectize; 24741})); 24742 24743/***/ }), 24744
vendor: 14,220 bytes, lines 24745-25253
24745/***/ "./Themes/Cynoebook/node_modules/sifter/sifter.js": 24746/*!********************************************************!*\ 24747 !*** ./Themes/Cynoebook/node_modules/sifter/sifter.js ***! 24748 \********************************************************/ 24749/*! no static exports found */ 24750/***/ (function(module, exports, __webpack_require__) { 24751 24752var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/** 24753 * sifter.js 24754 * Copyright (c) 2013 Brian Reavis & contributors 24755 * 24756 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 24757 * file except in compliance with the License. You may obtain a copy of the License at: 24758 * http://www.apache.org/licenses/LICENSE-2.0 24759 * 24760 * Unless required by applicable law or agreed to in writing, software distributed under 24761 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 24762 * ANY KIND, either express or implied. See the License for the specific language 24763 * governing permissions and limitations under the License. 24764 * 24765 * @author Brian Reavis <[email protected]> 24766 */ 24767 24768(function(root, factory) { 24769 if (true) { 24770 !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 24771 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 24772 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 24773 __WEBPACK_AMD_DEFINE_FACTORY__), 24774 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 24775 } else {} 24776}(this, function() { 24777 24778 /** 24779 * Textually searches arrays and hashes of objects 24780 * by property (or multiple properties). Designed 24781 * specifically for autocomplete. 24782 * 24783 * @constructor 24784 * @param {array|object} items 24785 * @param {object} items 24786 */ 24787 var Sifter = function(items, settings) { 24788 this.items = items; 24789 this.settings = settings || {diacritics: true}; 24790 }; 24791 24792 /** 24793 * Splits a search string into an array of individual 24794 * regexps to be used to match results. 24795 * 24796 * @param {string} query 24797 * @returns {array} 24798 */ 24799 Sifter.prototype.tokenize = function(query) { 24800 query = trim(String(query || '').toLowerCase()); 24801 if (!query || !query.length) return []; 24802 24803 var i, n, regex, letter; 24804 var tokens = []; 24805 var words = query.split(/ +/); 24806 24807 for (i = 0, n = words.length; i < n; i++) { 24808 regex = escape_regex(words[i]); 24809 if (this.settings.diacritics) { 24810 for (letter in DIACRITICS) { 24811 if (DIACRITICS.hasOwnProperty(letter)) { 24812 regex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]); 24813 } 24814 } 24815 } 24816 tokens.push({ 24817 string : words[i], 24818 regex : new RegExp(regex, 'i') 24819 }); 24820 } 24821 24822 return tokens; 24823 }; 24824 24825 /** 24826 * Iterates over arrays and hashes. 24827 * 24828 * ``` 24829 * this.iterator(this.items, function(item, id) { 24830 * // invoked for each item 24831 * }); 24832 * ``` 24833 * 24834 * @param {array|object} object 24835 */ 24836 Sifter.prototype.iterator = function(object, callback) { 24837 var iterator; 24838 if (is_array(object)) { 24839 iterator = Array.prototype.forEach || function(callback) { 24840 for (var i = 0, n = this.length; i < n; i++) { 24841 callback(this[i], i, this); 24842 } 24843 }; 24844 } else { 24845 iterator = function(callback) { 24846 for (var key in this) { 24847 if (this.hasOwnProperty(key)) { 24848 callback(this[key], key, this); 24849 } 24850 } 24851 }; 24852 } 24853 24854 iterator.apply(object, [callback]); 24855 }; 24856 24857 /** 24858 * Returns a function to be used to score individual results. 24859 * 24860 * Good matches will have a higher score than poor matches. 24861 * If an item is not a match, 0 will be returned by the function. 24862 * 24863 * @param {object|string} search 24864 * @param {object} options (optional) 24865 * @returns {function} 24866 */ 24867 Sifter.prototype.getScoreFunction = function(search, options) { 24868 var self, fields, tokens, token_count, nesting; 24869 24870 self = this; 24871 search = self.prepareSearch(search, options); 24872 tokens = search.tokens; 24873 fields = search.options.fields; 24874 token_count = tokens.length; 24875 nesting = search.options.nesting; 24876 24877 /** 24878 * Calculates how close of a match the 24879 * given value is against a search token. 24880 * 24881 * @param {mixed} value 24882 * @param {object} token 24883 * @return {number} 24884 */ 24885 var scoreValue = function(value, token) { 24886 var score, pos; 24887 24888 if (!value) return 0; 24889 value = String(value || ''); 24890 pos = value.search(token.regex); 24891 if (pos === -1) return 0; 24892 score = token.string.length / value.length; 24893 if (pos === 0) score += 0.5; 24894 return score; 24895 }; 24896 24897 /** 24898 * Calculates the score of an object 24899 * against the search query. 24900 * 24901 * @param {object} token 24902 * @param {object} data 24903 * @return {number} 24904 */ 24905 var scoreObject = (function() { 24906 var field_count = fields.length; 24907 if (!field_count) { 24908 return function() { return 0; }; 24909 } 24910 if (field_count === 1) { 24911 return function(token, data) { 24912 return scoreValue(getattr(data, fields[0], nesting), token); 24913 }; 24914 } 24915 return function(token, data) { 24916 for (var i = 0, sum = 0; i < field_count; i++) { 24917 sum += scoreValue(getattr(data, fields[i], nesting), token); 24918 } 24919 return sum / field_count; 24920 }; 24921 })(); 24922 24923 if (!token_count) { 24924 return function() { return 0; }; 24925 } 24926 if (token_count === 1) { 24927 return function(data) { 24928 return scoreObject(tokens[0], data); 24929 }; 24930 } 24931 24932 if (search.options.conjunction === 'and') { 24933 return function(data) { 24934 var score; 24935 for (var i = 0, sum = 0; i < token_count; i++) { 24936 score = scoreObject(tokens[i], data); 24937 if (score <= 0) return 0; 24938 sum += score; 24939 } 24940 return sum / token_count; 24941 }; 24942 } else { 24943 return function(data) { 24944 for (var i = 0, sum = 0; i < token_count; i++) { 24945 sum += scoreObject(tokens[i], data); 24946 } 24947 return sum / token_count; 24948 }; 24949 } 24950 }; 24951 24952 /** 24953 * Returns a function that can be used to compare two 24954 * results, for sorting purposes. If no sorting should 24955 * be performed, `null` will be returned. 24956 * 24957 * @param {string|object} search 24958 * @param {object} options 24959 * @return function(a,b) 24960 */ 24961 Sifter.prototype.getSortFunction = function(search, options) { 24962 var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort; 24963 24964 self = this; 24965 search = self.prepareSearch(search, options); 24966 sort = (!search.query && options.sort_empty) || options.sort; 24967 24968 /** 24969 * Fetches the specified sort field value 24970 * from a search result item. 24971 * 24972 * @param {string} name 24973 * @param {object} result 24974 * @return {mixed} 24975 */ 24976 get_field = function(name, result) { 24977 if (name === '$score') return result.score; 24978 return getattr(self.items[result.id], name, options.nesting); 24979 }; 24980 24981 // parse options 24982 fields = []; 24983 if (sort) { 24984 for (i = 0, n = sort.length; i < n; i++) { 24985 if (search.query || sort[i].field !== '$score') { 24986 fields.push(sort[i]); 24987 } 24988 } 24989 } 24990 24991 // the "$score" field is implied to be the primary 24992 // sort field, unless it's manually specified 24993 if (search.query) { 24994 implicit_score = true; 24995 for (i = 0, n = fields.length; i < n; i++) { 24996 if (fields[i].field === '$score') { 24997 implicit_score = false; 24998 break; 24999 } 25000 } 25001 if (implicit_score) { 25002 fields.unshift({field: '$score', direction: 'desc'}); 25003 } 25004 } else { 25005 for (i = 0, n = fields.length; i < n; i++) { 25006 if (fields[i].field === '$score') { 25007 fields.splice(i, 1); 25008 break; 25009 } 25010 } 25011 } 25012 25013 multipliers = []; 25014 for (i = 0, n = fields.length; i < n; i++) { 25015 multipliers.push(fields[i].direction === 'desc' ? -1 : 1); 25016 } 25017 25018 // build function 25019 fields_count = fields.length; 25020 if (!fields_count) { 25021 return null; 25022 } else if (fields_count === 1) { 25023 field = fields[0].field; 25024 multiplier = multipliers[0]; 25025 return function(a, b) { 25026 return multiplier * cmp( 25027 get_field(field, a), 25028 get_field(field, b) 25029 ); 25030 }; 25031 } else { 25032 return function(a, b) { 25033 var i, result, a_value, b_value, field; 25034 for (i = 0; i < fields_count; i++) { 25035 field = fields[i].field; 25036 result = multipliers[i] * cmp( 25037 get_field(field, a), 25038 get_field(field, b) 25039 ); 25040 if (result) return result; 25041 } 25042 return 0; 25043 }; 25044 } 25045 }; 25046 25047 /** 25048 * Parses a search query and returns an object 25049 * with tokens and fields ready to be populated 25050 * with results. 25051 * 25052 * @param {string} query 25053 * @param {object} options 25054 * @returns {object} 25055 */ 25056 Sifter.prototype.prepareSearch = function(query, options) { 25057 if (typeof query === 'object') return query; 25058 25059 options = extend({}, options); 25060 25061 var option_fields = options.fields; 25062 var option_sort = options.sort; 25063 var option_sort_empty = options.sort_empty; 25064 25065 if (option_fields && !is_array(option_fields)) options.fields = [option_fields]; 25066 if (option_sort && !is_array(option_sort)) options.sort = [option_sort]; 25067 if (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty]; 25068 25069 return { 25070 options : options, 25071 query : String(query || '').toLowerCase(), 25072 tokens : this.tokenize(query), 25073 total : 0, 25074 items : [] 25075 }; 25076 }; 25077 25078 /** 25079 * Searches through all items and returns a sorted array of matches. 25080 * 25081 * The `options` parameter can contain: 25082 * 25083 * - fields {string|array} 25084 * - sort {array} 25085 * - score {function} 25086 * - filter {bool} 25087 * - limit {integer} 25088 * 25089 * Returns an object containing: 25090 * 25091 * - options {object} 25092 * - query {string} 25093 * - tokens {array} 25094 * - total {int} 25095 * - items {array} 25096 * 25097 * @param {string} query 25098 * @param {object} options 25099 * @returns {object} 25100 */ 25101 Sifter.prototype.search = function(query, options) { 25102 var self = this, value, score, search, calculateScore; 25103 var fn_sort; 25104 var fn_score; 25105 25106 search = this.prepareSearch(query, options); 25107 options = search.options; 25108 query = search.query; 25109 25110 // generate result scoring function 25111 fn_score = options.score || self.getScoreFunction(search); 25112 25113 // perform search and sort 25114 if (query.length) { 25115 self.iterator(self.items, function(item, id) { 25116 score = fn_score(item); 25117 if (options.filter === false || score > 0) { 25118 search.items.push({'score': score, 'id': id}); 25119 } 25120 }); 25121 } else { 25122 self.iterator(self.items, function(item, id) { 25123 search.items.push({'score': 1, 'id': id}); 25124 }); 25125 } 25126 25127 fn_sort = self.getSortFunction(search, options); 25128 if (fn_sort) search.items.sort(fn_sort); 25129 25130 // apply limits 25131 search.total = search.items.length; 25132 if (typeof options.limit === 'number') { 25133 search.items = search.items.slice(0, options.limit); 25134 } 25135 25136 return search; 25137 }; 25138 25139 // utilities 25140 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25141 25142 var cmp = function(a, b) { 25143 if (typeof a === 'number' && typeof b === 'number') { 25144 return a > b ? 1 : (a < b ? -1 : 0); 25145 } 25146 a = asciifold(String(a || '')); 25147 b = asciifold(String(b || '')); 25148 if (a > b) return 1; 25149 if (b > a) return -1; 25150 return 0; 25151 }; 25152 25153 var extend = function(a, b) { 25154 var i, n, k, object; 25155 for (i = 1, n = arguments.length; i < n; i++) { 25156 object = arguments[i]; 25157 if (!object) continue; 25158 for (k in object) { 25159 if (object.hasOwnProperty(k)) { 25160 a[k] = object[k]; 25161 } 25162 } 25163 } 25164 return a; 25165 }; 25166 25167 /** 25168 * A property getter resolving dot-notation 25169 * @param {Object} obj The root object to fetch property on 25170 * @param {String} name The optionally dotted property name to fetch 25171 * @param {Boolean} nesting Handle nesting or not 25172 * @return {Object} The resolved property value 25173 */ 25174 var getattr = function(obj, name, nesting) { 25175 if (!obj || !name) return; 25176 if (!nesting) return obj[name]; 25177 var names = name.split("."); 25178 while(names.length && (obj = obj[names.shift()])); 25179 return obj; 25180 }; 25181 25182 var trim = function(str) { 25183 return (str + '').replace(/^\s+|\s+$|/g, ''); 25184 }; 25185 25186 var escape_regex = function(str) { 25187 return (str + '').replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1'); 25188 }; 25189 25190 var is_array = Array.isArray || (typeof $ !== 'undefined' && $.isArray) || function(object) { 25191 return Object.prototype.toString.call(object) === '[object Array]'; 25192 }; 25193 25194 var DIACRITICS = { 25195 'a': '[aá¸á¸ÄÄÃâÇÇȺⱥȦȧẠạÃäÃà ÃáÄÄÃÃ£Ã Ã¥Ä ÄÃÄ Ä]', 25196 'b': '[bâ¢Î²ÎB฿ðá]', 25197 'c': '[cÄÄÄÄÄÄÄÄCÌcÌÃçá¸á¸È»È¼ÆÆÉá´ï¼£ï½]', 25198 'd': '[dÄÄá¸á¸á¸á¸á¸á¸á¸á¸á¸á¸ÄÄD̦d̦ÆÉÆÉÆÆáµá¶á¶È¡á´ Dï½Ã°]', 25199 'e': '[eÃéÃèÃêá¸á¸ÄÄÄÄẼẽá¸á¸áººáº»ÄÄÃëÄÄȨȩÄÄá¶ÉÉÈÈ áº¾áº¿á»á»á»á» á»á»á¸á¸á¸á¸á¸á¸ÈÈẸẹá»á»â±¸á´ï¼¥ï½ ÉÇÆÆÎµ]', 25200 'f': '[fÆÆá¸á¸]', 25201 'g': '[gÉ¢â²Ç¤Ç¥ÄÄÄÄĢģÆÉ Ä Ä¡]', 25202 'h': '[hĤĥĦħḨḩáºáºá¸¤á¸¥á¸¢á¸£É¦Ê°Ç¶Æ]', 25203 'i': '[iÃÃÃìĬÄÃîÇÇÃïḮḯĨĩĮįĪīá»á»ÈÈÈÈá»á»á¸¬á¸ÆÉ¨É¨Ìáµ»á¶Ä°iIıɪIï½]', 25204 'j': '[jȷĴĵÉÉÊÉʲ]', 25205 'k': '[kÆÆêêḰḱǨǩḲḳḴḵκϰâ]', 25206 'l': '[lÅÅĽľĻļĹĺḶḷḸḹḼḽḺḻĿÅȽÆâ± ⱡⱢɫɬᶠÉÈ´ÊLï½]', 25207 'n': '[nÅÅǸǹÅÅÃñá¹á¹ Å Åá¹á¹á¹á¹á¹á¹NÌnÌÆÉ²È Æáµ°á¶É³ÈµÉ´ï¼®ï½ÅÅ]', 25208 'o': '[oÃøÃöÃóÃòÃôÇÇÅÅÅÅȮȯá»á»ÆÉµÆ Æ¡á»á»ÅÅÃõǪǫÈÈÕÖ ]', 25209 'p': '[pá¹á¹á¹á¹â±£áµ½Æ¤Æ¥áµ±]', 25210 'q': '[qêêÊ ÉÉêêqÌ]', 25211 'r': '[rÅÅÉÉÅÅÅÅá¹á¹ÈÈÈÈá¹á¹â±¤É½]', 25212 's': '[sÅÅṠṡṢṣê¨ê©ÅÅÅ Å¡ÅÅÈÈSÌsÌ]', 25213 't': '[tÅ¤Å¥á¹ªá¹«Å¢Å£á¹¬á¹Æ®ÊÈÈṰṱṮṯƬÆ]', 25214 'u': '[uŬÅÉÊỤụÃüÃúÃùÃûÇÇŰűŬů¯Æ°á»¦á»§ÅªÅ«Å¨Å©Å²Å³ÈÈâª]', 25215 'v': '[vṼṽṾṿƲÊêêâ±±Ê]', 25216 'w': '[wáºáºáºáºÅ´Åµáºáº áºáºáºáº]', 25217 'x': '[xáºáºáºáºÏ]', 25218 'y': '[yÃýỲỳŶŷŸÿỸỹáºáºá»´á»µÉÉÆ³Æ´]', 25219 'z': '[zŹźáºáºÅ½Å¾Å»Å¼áºáºáºáºÆµÆ¶]' 25220 }; 25221 25222 var asciifold = (function() { 25223 var i, n, k, chunk; 25224 var foreignletters = ''; 25225 var lookup = {}; 25226 for (k in DIACRITICS) { 25227 if (DIACRITICS.hasOwnProperty(k)) { 25228 chunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1); 25229 foreignletters += chunk; 25230 for (i = 0, n = chunk.length; i < n; i++) { 25231 lookup[chunk.charAt(i)] = k; 25232 } 25233 } 25234 } 25235 var regexp = new RegExp('[' + foreignletters + ']', 'g'); 25236 return function(str) { 25237 return str.replace(regexp, function(foreignletter) { 25238 return lookup[foreignletter]; 25239 }).toLowerCase(); 25240 }; 25241 })(); 25242 25243 25244 // export 25245 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25246 25247 return Sifter; 25248})); 25249 25250 25251 25252/***/ }), 25253
vendor: 89,730 bytes, lines 25254-28274
25254/***/ "./Themes/Cynoebook/node_modules/slick-carousel/slick/slick.js": 25255/*!*********************************************************************!*\ 25256 !*** ./Themes/Cynoebook/node_modules/slick-carousel/slick/slick.js ***! 25257 \*********************************************************************/ 25258/*! no static exports found */ 25259/***/ (function(module, exports, __webpack_require__) { 25260 25261var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* 25262 _ _ _ _ 25263 ___| (_) ___| | __ (_)___ 25264/ __| | |/ __| |/ / | / __| 25265\__ \ | | (__| < _ | \__ \ 25266|___/_|_|\___|_|\_(_)/ |___/ 25267 |__/ 25268 25269 Version: 1.8.1 25270 Author: Ken Wheeler 25271 Website: http://kenwheeler.github.io 25272 Docs: http://kenwheeler.github.io/slick 25273 Repo: http://github.com/kenwheeler/slick 25274 Issues: http://github.com/kenwheeler/slick/issues 25275 25276 */ 25277/* global window, document, define, jQuery, setInterval, clearInterval */ 25278;(function(factory) { 25279 'use strict'; 25280 if (true) { 25281 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./Themes/Cynoebook/node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 25282 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 25283 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 25284 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 25285 } else {} 25286 25287}(function($) { 25288 'use strict'; 25289 var Slick = window.Slick || {}; 25290 25291 Slick = (function() { 25292 25293 var instanceUid = 0; 25294 25295 function Slick(element, settings) { 25296 25297 var _ = this, dataSettings; 25298 25299 _.defaults = { 25300 accessibility: true, 25301 adaptiveHeight: false, 25302 appendArrows: $(element), 25303 appendDots: $(element), 25304 arrows: true, 25305 asNavFor: null, 25306 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 25307 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 25308 autoplay: false, 25309 autoplaySpeed: 3000, 25310 centerMode: false, 25311 centerPadding: '50px', 25312 cssEase: 'ease', 25313 customPaging: function(slider, i) { 25314 return $('<button type="button" />').text(i + 1); 25315 }, 25316 dots: false, 25317 dotsClass: 'slick-dots', 25318 draggable: true, 25319 easing: 'linear', 25320 edgeFriction: 0.35, 25321 fade: false, 25322 focusOnSelect: false, 25323 focusOnChange: false, 25324 infinite: true, 25325 initialSlide: 0, 25326 lazyLoad: 'ondemand', 25327 mobileFirst: false, 25328 pauseOnHover: true, 25329 pauseOnFocus: true, 25330 pauseOnDotsHover: false, 25331 respondTo: 'window', 25332 responsive: null, 25333 rows: 1, 25334 rtl: false, 25335 slide: '', 25336 slidesPerRow: 1, 25337 slidesToShow: 1, 25338 slidesToScroll: 1, 25339 speed: 500, 25340 swipe: true, 25341 swipeToSlide: false, 25342 touchMove: true, 25343 touchThreshold: 5, 25344 useCSS: true, 25345 useTransform: true, 25346 variableWidth: false, 25347 vertical: false, 25348 verticalSwiping: false, 25349 waitForAnimate: true, 25350 zIndex: 1000 25351 }; 25352 25353 _.initials = { 25354 animating: false, 25355 dragging: false, 25356 autoPlayTimer: null, 25357 currentDirection: 0, 25358 currentLeft: null, 25359 currentSlide: 0, 25360 direction: 1, 25361 $dots: null, 25362 listWidth: null, 25363 listHeight: null, 25364 loadIndex: 0, 25365 $nextArrow: null, 25366 $prevArrow: null, 25367 scrolling: false, 25368 slideCount: null, 25369 slideWidth: null, 25370 $slideTrack: null, 25371 $slides: null, 25372 sliding: false, 25373 slideOffset: 0, 25374 swipeLeft: null, 25375 swiping: false, 25376 $list: null, 25377 touchObject: {}, 25378 transformsEnabled: false, 25379 unslicked: false 25380 }; 25381 25382 $.extend(_, _.initials); 25383 25384 _.activeBreakpoint = null; 25385 _.animType = null; 25386 _.animProp = null; 25387 _.breakpoints = []; 25388 _.breakpointSettings = []; 25389 _.cssTransitions = false; 25390 _.focussed = false; 25391 _.interrupted = false; 25392 _.hidden = 'hidden'; 25393 _.paused = true; 25394 _.positionProp = null; 25395 _.respondTo = null; 25396 _.rowCount = 1; 25397 _.shouldClick = true; 25398 _.$slider = $(element); 25399 _.$slidesCache = null; 25400 _.transformType = null; 25401 _.transitionType = null; 25402 _.visibilityChange = 'visibilitychange'; 25403 _.windowWidth = 0; 25404 _.windowTimer = null; 25405 25406 dataSettings = $(element).data('slick') || {}; 25407 25408 _.options = $.extend({}, _.defaults, settings, dataSettings); 25409 25410 _.currentSlide = _.options.initialSlide; 25411 25412 _.originalSettings = _.options; 25413 25414 if (typeof document.mozHidden !== 'undefined') { 25415 _.hidden = 'mozHidden'; 25416 _.visibilityChange = 'mozvisibilitychange'; 25417 } else if (typeof document.webkitHidden !== 'undefined') { 25418 _.hidden = 'webkitHidden'; 25419 _.visibilityChange = 'webkitvisibilitychange'; 25420 } 25421 25422 _.autoPlay = $.proxy(_.autoPlay, _); 25423 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 25424 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 25425 _.changeSlide = $.proxy(_.changeSlide, _); 25426 _.clickHandler = $.proxy(_.clickHandler, _); 25427 _.selectHandler = $.proxy(_.selectHandler, _); 25428 _.setPosition = $.proxy(_.setPosition, _); 25429 _.swipeHandler = $.proxy(_.swipeHandler, _); 25430 _.dragHandler = $.proxy(_.dragHandler, _); 25431 _.keyHandler = $.proxy(_.keyHandler, _); 25432 25433 _.instanceUid = instanceUid++; 25434 25435 // A simple way to check for HTML strings 25436 // Strict HTML recognition (must start with <) 25437 // Extracted from jQuery v1.11 source 25438 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 25439 25440 25441 _.registerBreakpoints(); 25442 _.init(true); 25443 25444 } 25445 25446 return Slick; 25447 25448 }()); 25449 25450 Slick.prototype.activateADA = function() { 25451 var _ = this; 25452 25453 _.$slideTrack.find('.slick-active').attr({ 25454 'aria-hidden': 'false' 25455 }).find('a, input, button, select').attr({ 25456 'tabindex': '0' 25457 }); 25458 25459 }; 25460 25461 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 25462 25463 var _ = this; 25464 25465 if (typeof(index) === 'boolean') { 25466 addBefore = index; 25467 index = null; 25468 } else if (index < 0 || (index >= _.slideCount)) { 25469 return false; 25470 } 25471 25472 _.unload(); 25473 25474 if (typeof(index) === 'number') { 25475 if (index === 0 && _.$slides.length === 0) { 25476 $(markup).appendTo(_.$slideTrack); 25477 } else if (addBefore) { 25478 $(markup).insertBefore(_.$slides.eq(index)); 25479 } else { 25480 $(markup).insertAfter(_.$slides.eq(index)); 25481 } 25482 } else { 25483 if (addBefore === true) { 25484 $(markup).prependTo(_.$slideTrack); 25485 } else { 25486 $(markup).appendTo(_.$slideTrack); 25487 } 25488 } 25489 25490 _.$slides = _.$slideTrack.children(this.options.slide); 25491 25492 _.$slideTrack.children(this.options.slide).detach(); 25493 25494 _.$slideTrack.append(_.$slides); 25495 25496 _.$slides.each(function(index, element) { 25497 $(element).attr('data-slick-index', index); 25498 }); 25499 25500 _.$slidesCache = _.$slides; 25501 25502 _.reinit(); 25503 25504 }; 25505 25506 Slick.prototype.animateHeight = function() { 25507 var _ = this; 25508 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 25509 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 25510 _.$list.animate({ 25511 height: targetHeight 25512 }, _.options.speed); 25513 } 25514 }; 25515 25516 Slick.prototype.animateSlide = function(targetLeft, callback) { 25517 25518 var animProps = {}, 25519 _ = this; 25520 25521 _.animateHeight(); 25522 25523 if (_.options.rtl === true && _.options.vertical === false) { 25524 targetLeft = -targetLeft; 25525 } 25526 if (_.transformsEnabled === false) { 25527 if (_.options.vertical === false) { 25528 _.$slideTrack.animate({ 25529 left: targetLeft 25530 }, _.options.speed, _.options.easing, callback); 25531 } else { 25532 _.$slideTrack.animate({ 25533 top: targetLeft 25534 }, _.options.speed, _.options.easing, callback); 25535 } 25536 25537 } else { 25538 25539 if (_.cssTransitions === false) { 25540 if (_.options.rtl === true) { 25541 _.currentLeft = -(_.currentLeft); 25542 } 25543 $({ 25544 animStart: _.currentLeft 25545 }).animate({ 25546 animStart: targetLeft 25547 }, { 25548 duration: _.options.speed, 25549 easing: _.options.easing, 25550 step: function(now) { 25551 now = Math.ceil(now); 25552 if (_.options.vertical === false) { 25553 animProps[_.animType] = 'translate(' + 25554 now + 'px, 0px)'; 25555 _.$slideTrack.css(animProps); 25556 } else { 25557 animProps[_.animType] = 'translate(0px,' + 25558 now + 'px)'; 25559 _.$slideTrack.css(animProps); 25560 } 25561 }, 25562 complete: function() { 25563 if (callback) { 25564 callback.call(); 25565 } 25566 } 25567 }); 25568 25569 } else { 25570 25571 _.applyTransition(); 25572 targetLeft = Math.ceil(targetLeft); 25573 25574 if (_.options.vertical === false) { 25575 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 25576 } else { 25577 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 25578 } 25579 _.$slideTrack.css(animProps); 25580 25581 if (callback) { 25582 setTimeout(function() { 25583 25584 _.disableTransition(); 25585 25586 callback.call(); 25587 }, _.options.speed); 25588 } 25589 25590 } 25591 25592 } 25593 25594 }; 25595 25596 Slick.prototype.getNavTarget = function() { 25597 25598 var _ = this, 25599 asNavFor = _.options.asNavFor; 25600 25601 if ( asNavFor && asNavFor !== null ) { 25602 asNavFor = $(asNavFor).not(_.$slider); 25603 } 25604 25605 return asNavFor; 25606 25607 }; 25608 25609 Slick.prototype.asNavFor = function(index) { 25610 25611 var _ = this, 25612 asNavFor = _.getNavTarget(); 25613 25614 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 25615 asNavFor.each(function() { 25616 var target = $(this).slick('getSlick'); 25617 if(!target.unslicked) { 25618 target.slideHandler(index, true); 25619 } 25620 }); 25621 } 25622 25623 }; 25624 25625 Slick.prototype.applyTransition = function(slide) { 25626 25627 var _ = this, 25628 transition = {}; 25629 25630 if (_.options.fade === false) { 25631 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 25632 } else { 25633 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 25634 } 25635 25636 if (_.options.fade === false) { 25637 _.$slideTrack.css(transition); 25638 } else { 25639 _.$slides.eq(slide).css(transition); 25640 } 25641 25642 }; 25643 25644 Slick.prototype.autoPlay = function() { 25645 25646 var _ = this; 25647 25648 _.autoPlayClear(); 25649 25650 if ( _.slideCount > _.options.slidesToShow ) { 25651 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 25652 } 25653 25654 }; 25655 25656 Slick.prototype.autoPlayClear = function() { 25657 25658 var _ = this; 25659 25660 if (_.autoPlayTimer) { 25661 clearInterval(_.autoPlayTimer); 25662 } 25663 25664 }; 25665 25666 Slick.prototype.autoPlayIterator = function() { 25667 25668 var _ = this, 25669 slideTo = _.currentSlide + _.options.slidesToScroll; 25670 25671 if ( !_.paused && !_.interrupted && !_.focussed ) { 25672 25673 if ( _.options.infinite === false ) { 25674 25675 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 25676 _.direction = 0; 25677 } 25678 25679 else if ( _.direction === 0 ) { 25680 25681 slideTo = _.currentSlide - _.options.slidesToScroll; 25682 25683 if ( _.currentSlide - 1 === 0 ) { 25684 _.direction = 1; 25685 } 25686 25687 } 25688 25689 } 25690 25691 _.slideHandler( slideTo ); 25692 25693 } 25694 25695 }; 25696 25697 Slick.prototype.buildArrows = function() { 25698 25699 var _ = this; 25700 25701 if (_.options.arrows === true ) { 25702 25703 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 25704 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 25705 25706 if( _.slideCount > _.options.slidesToShow ) { 25707 25708 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 25709 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 25710 25711 if (_.htmlExpr.test(_.options.prevArrow)) { 25712 _.$prevArrow.prependTo(_.options.appendArrows); 25713 } 25714 25715 if (_.htmlExpr.test(_.options.nextArrow)) { 25716 _.$nextArrow.appendTo(_.options.appendArrows); 25717 } 25718 25719 if (_.options.infinite !== true) { 25720 _.$prevArrow 25721 .addClass('slick-disabled') 25722 .attr('aria-disabled', 'true'); 25723 } 25724 25725 } else { 25726 25727 _.$prevArrow.add( _.$nextArrow ) 25728 25729 .addClass('slick-hidden') 25730 .attr({ 25731 'aria-disabled': 'true', 25732 'tabindex': '-1' 25733 }); 25734 25735 } 25736 25737 } 25738 25739 }; 25740 25741 Slick.prototype.buildDots = function() { 25742 25743 var _ = this, 25744 i, dot; 25745 25746 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 25747 25748 _.$slider.addClass('slick-dotted'); 25749 25750 dot = $('<ul />').addClass(_.options.dotsClass); 25751 25752 for (i = 0; i <= _.getDotCount(); i += 1) { 25753 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 25754 } 25755 25756 _.$dots = dot.appendTo(_.options.appendDots); 25757 25758 _.$dots.find('li').first().addClass('slick-active'); 25759 25760 } 25761 25762 }; 25763 25764 Slick.prototype.buildOut = function() { 25765 25766 var _ = this; 25767 25768 _.$slides = 25769 _.$slider 25770 .children( _.options.slide + ':not(.slick-cloned)') 25771 .addClass('slick-slide'); 25772 25773 _.slideCount = _.$slides.length; 25774 25775 _.$slides.each(function(index, element) { 25776 $(element) 25777 .attr('data-slick-index', index) 25778 .data('originalStyling', $(element).attr('style') || ''); 25779 }); 25780 25781 _.$slider.addClass('slick-slider'); 25782 25783 _.$slideTrack = (_.slideCount === 0) ? 25784 $('<div class="slick-track"/>').appendTo(_.$slider) : 25785 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 25786 25787 _.$list = _.$slideTrack.wrap( 25788 '<div class="slick-list"/>').parent(); 25789 _.$slideTrack.css('opacity', 0); 25790 25791 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 25792 _.options.slidesToScroll = 1; 25793 } 25794 25795 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 25796 25797 _.setupInfinite(); 25798 25799 _.buildArrows(); 25800 25801 _.buildDots(); 25802 25803 _.updateDots(); 25804 25805 25806 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 25807 25808 if (_.options.draggable === true) { 25809 _.$list.addClass('draggable'); 25810 } 25811 25812 }; 25813 25814 Slick.prototype.buildRows = function() { 25815 25816 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 25817 25818 newSlides = document.createDocumentFragment(); 25819 originalSlides = _.$slider.children(); 25820 25821 if(_.options.rows > 0) { 25822 25823 slidesPerSection = _.options.slidesPerRow * _.options.rows; 25824 numOfSlides = Math.ceil( 25825 originalSlides.length / slidesPerSection 25826 ); 25827 25828 for(a = 0; a < numOfSlides; a++){ 25829 var slide = document.createElement('div'); 25830 for(b = 0; b < _.options.rows; b++) { 25831 var row = document.createElement('div'); 25832 for(c = 0; c < _.options.slidesPerRow; c++) { 25833 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 25834 if (originalSlides.get(target)) { 25835 row.appendChild(originalSlides.get(target)); 25836 } 25837 } 25838 slide.appendChild(row); 25839 } 25840 newSlides.appendChild(slide); 25841 } 25842 25843 _.$slider.empty().append(newSlides); 25844 _.$slider.children().children().children() 25845 .css({ 25846 'width':(100 / _.options.slidesPerRow) + '%', 25847 'display': 'inline-block' 25848 }); 25849 25850 } 25851 25852 }; 25853 25854 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 25855 25856 var _ = this, 25857 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 25858 var sliderWidth = _.$slider.width(); 25859 var windowWidth = window.innerWidth || $(window).width(); 25860 25861 if (_.respondTo === 'window') { 25862 respondToWidth = windowWidth; 25863 } else if (_.respondTo === 'slider') { 25864 respondToWidth = sliderWidth; 25865 } else if (_.respondTo === 'min') { 25866 respondToWidth = Math.min(windowWidth, sliderWidth); 25867 } 25868 25869 if ( _.options.responsive && 25870 _.options.responsive.length && 25871 _.options.responsive !== null) { 25872 25873 targetBreakpoint = null; 25874 25875 for (breakpoint in _.breakpoints) { 25876 if (_.breakpoints.hasOwnProperty(breakpoint)) { 25877 if (_.originalSettings.mobileFirst === false) { 25878 if (respondToWidth < _.breakpoints[breakpoint]) { 25879 targetBreakpoint = _.breakpoints[breakpoint]; 25880 } 25881 } else { 25882 if (respondToWidth > _.breakpoints[breakpoint]) { 25883 targetBreakpoint = _.breakpoints[breakpoint]; 25884 } 25885 } 25886 } 25887 } 25888 25889 if (targetBreakpoint !== null) { 25890 if (_.activeBreakpoint !== null) { 25891 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 25892 _.activeBreakpoint = 25893 targetBreakpoint; 25894 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 25895 _.unslick(targetBreakpoint); 25896 } else { 25897 _.options = $.extend({}, _.originalSettings, 25898 _.breakpointSettings[ 25899 targetBreakpoint]); 25900 if (initial === true) { 25901 _.currentSlide = _.options.initialSlide; 25902 } 25903 _.refresh(initial); 25904 } 25905 triggerBreakpoint = targetBreakpoint; 25906 } 25907 } else { 25908 _.activeBreakpoint = targetBreakpoint; 25909 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 25910 _.unslick(targetBreakpoint); 25911 } else { 25912 _.options = $.extend({}, _.originalSettings, 25913 _.breakpointSettings[ 25914 targetBreakpoint]); 25915 if (initial === true) { 25916 _.currentSlide = _.options.initialSlide; 25917 } 25918 _.refresh(initial); 25919 } 25920 triggerBreakpoint = targetBreakpoint; 25921 } 25922 } else { 25923 if (_.activeBreakpoint !== null) { 25924 _.activeBreakpoint = null; 25925 _.options = _.originalSettings; 25926 if (initial === true) { 25927 _.currentSlide = _.options.initialSlide; 25928 } 25929 _.refresh(initial); 25930 triggerBreakpoint = targetBreakpoint; 25931 } 25932 } 25933 25934 // only trigger breakpoints during an actual break. not on initialize. 25935 if( !initial && triggerBreakpoint !== false ) { 25936 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 25937 } 25938 } 25939 25940 }; 25941 25942 Slick.prototype.changeSlide = function(event, dontAnimate) { 25943 25944 var _ = this, 25945 $target = $(event.currentTarget), 25946 indexOffset, slideOffset, unevenOffset; 25947 25948 // If target is a link, prevent default action. 25949 if($target.is('a')) { 25950 event.preventDefault(); 25951 } 25952 25953 // If target is not the <li> element (ie: a child), find the <li>. 25954 if(!$target.is('li')) { 25955 $target = $target.closest('li'); 25956 } 25957 25958 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 25959 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 25960 25961 switch (event.data.message) { 25962 25963 case 'previous': 25964 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 25965 if (_.slideCount > _.options.slidesToShow) { 25966 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 25967 } 25968 break; 25969 25970 case 'next': 25971 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 25972 if (_.slideCount > _.options.slidesToShow) { 25973 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 25974 } 25975 break; 25976 25977 case 'index': 25978 var index = event.data.index === 0 ? 0 : 25979 event.data.index || $target.index() * _.options.slidesToScroll; 25980 25981 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 25982 $target.children().trigger('focus'); 25983 break; 25984 25985 default: 25986 return; 25987 } 25988 25989 }; 25990 25991 Slick.prototype.checkNavigable = function(index) { 25992 25993 var _ = this, 25994 navigables, prevNavigable; 25995 25996 navigables = _.getNavigableIndexes(); 25997 prevNavigable = 0; 25998 if (index > navigables[navigables.length - 1]) { 25999 index = navigables[navigables.length - 1]; 26000 } else { 26001 for (var n in navigables) { 26002 if (index < navigables[n]) { 26003 index = prevNavigable; 26004 break; 26005 } 26006 prevNavigable = navigables[n]; 26007 } 26008 } 26009 26010 return index; 26011 }; 26012 26013 Slick.prototype.cleanUpEvents = function() { 26014 26015 var _ = this; 26016 26017 if (_.options.dots && _.$dots !== null) { 26018 26019 $('li', _.$dots) 26020 .off('click.slick', _.changeSlide) 26021 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 26022 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 26023 26024 if (_.options.accessibility === true) { 26025 _.$dots.off('keydown.slick', _.keyHandler); 26026 } 26027 } 26028 26029 _.$slider.off('focus.slick blur.slick'); 26030 26031 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 26032 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 26033 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 26034 26035 if (_.options.accessibility === true) { 26036 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 26037 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 26038 } 26039 } 26040 26041 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 26042 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 26043 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 26044 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 26045 26046 _.$list.off('click.slick', _.clickHandler); 26047 26048 $(document).off(_.visibilityChange, _.visibility); 26049 26050 _.cleanUpSlideEvents(); 26051 26052 if (_.options.accessibility === true) { 26053 _.$list.off('keydown.slick', _.keyHandler); 26054 } 26055 26056 if (_.options.focusOnSelect === true) { 26057 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 26058 } 26059 26060 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 26061 26062 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 26063 26064 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 26065 26066 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 26067 26068 }; 26069 26070 Slick.prototype.cleanUpSlideEvents = function() { 26071 26072 var _ = this; 26073 26074 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 26075 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 26076 26077 }; 26078 26079 Slick.prototype.cleanUpRows = function() { 26080 26081 var _ = this, originalSlides; 26082 26083 if(_.options.rows > 0) { 26084 originalSlides = _.$slides.children().children(); 26085 originalSlides.removeAttr('style'); 26086 _.$slider.empty().append(originalSlides); 26087 } 26088 26089 }; 26090 26091 Slick.prototype.clickHandler = function(event) { 26092 26093 var _ = this; 26094 26095 if (_.shouldClick === false) { 26096 event.stopImmediatePropagation(); 26097 event.stopPropagation(); 26098 event.preventDefault(); 26099 } 26100 26101 }; 26102 26103 Slick.prototype.destroy = function(refresh) { 26104 26105 var _ = this; 26106 26107 _.autoPlayClear(); 26108 26109 _.touchObject = {}; 26110 26111 _.cleanUpEvents(); 26112 26113 $('.slick-cloned', _.$slider).detach(); 26114 26115 if (_.$dots) { 26116 _.$dots.remove(); 26117 } 26118 26119 if ( _.$prevArrow && _.$prevArrow.length ) { 26120 26121 _.$prevArrow 26122 .removeClass('slick-disabled slick-arrow slick-hidden') 26123 .removeAttr('aria-hidden aria-disabled tabindex') 26124 .css('display',''); 26125 26126 if ( _.htmlExpr.test( _.options.prevArrow )) { 26127 _.$prevArrow.remove(); 26128 } 26129 } 26130 26131 if ( _.$nextArrow && _.$nextArrow.length ) { 26132 26133 _.$nextArrow 26134 .removeClass('slick-disabled slick-arrow slick-hidden') 26135 .removeAttr('aria-hidden aria-disabled tabindex') 26136 .css('display',''); 26137 26138 if ( _.htmlExpr.test( _.options.nextArrow )) { 26139 _.$nextArrow.remove(); 26140 } 26141 } 26142 26143 26144 if (_.$slides) { 26145 26146 _.$slides 26147 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 26148 .removeAttr('aria-hidden') 26149 .removeAttr('data-slick-index') 26150 .each(function(){ 26151 $(this).attr('style', $(this).data('originalStyling')); 26152 }); 26153 26154 _.$slideTrack.children(this.options.slide).detach(); 26155 26156 _.$slideTrack.detach(); 26157 26158 _.$list.detach(); 26159 26160 _.$slider.append(_.$slides); 26161 } 26162 26163 _.cleanUpRows(); 26164 26165 _.$slider.removeClass('slick-slider'); 26166 _.$slider.removeClass('slick-initialized'); 26167 _.$slider.removeClass('slick-dotted'); 26168 26169 _.unslicked = true; 26170 26171 if(!refresh) { 26172 _.$slider.trigger('destroy', [_]); 26173 } 26174 26175 }; 26176 26177 Slick.prototype.disableTransition = function(slide) { 26178 26179 var _ = this, 26180 transition = {}; 26181 26182 transition[_.transitionType] = ''; 26183 26184 if (_.options.fade === false) { 26185 _.$slideTrack.css(transition); 26186 } else { 26187 _.$slides.eq(slide).css(transition); 26188 } 26189 26190 }; 26191 26192 Slick.prototype.fadeSlide = function(slideIndex, callback) { 26193 26194 var _ = this; 26195 26196 if (_.cssTransitions === false) { 26197 26198 _.$slides.eq(slideIndex).css({ 26199 zIndex: _.options.zIndex 26200 }); 26201 26202 _.$slides.eq(slideIndex).animate({ 26203 opacity: 1 26204 }, _.options.speed, _.options.easing, callback); 26205 26206 } else { 26207 26208 _.applyTransition(slideIndex); 26209 26210 _.$slides.eq(slideIndex).css({ 26211 opacity: 1, 26212 zIndex: _.options.zIndex 26213 }); 26214 26215 if (callback) { 26216 setTimeout(function() { 26217 26218 _.disableTransition(slideIndex); 26219 26220 callback.call(); 26221 }, _.options.speed); 26222 } 26223 26224 } 26225 26226 }; 26227 26228 Slick.prototype.fadeSlideOut = function(slideIndex) { 26229 26230 var _ = this; 26231 26232 if (_.cssTransitions === false) { 26233 26234 _.$slides.eq(slideIndex).animate({ 26235 opacity: 0, 26236 zIndex: _.options.zIndex - 2 26237 }, _.options.speed, _.options.easing); 26238 26239 } else { 26240 26241 _.applyTransition(slideIndex); 26242 26243 _.$slides.eq(slideIndex).css({ 26244 opacity: 0, 26245 zIndex: _.options.zIndex - 2 26246 }); 26247 26248 } 26249 26250 }; 26251 26252 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 26253 26254 var _ = this; 26255 26256 if (filter !== null) { 26257 26258 _.$slidesCache = _.$slides; 26259 26260 _.unload(); 26261 26262 _.$slideTrack.children(this.options.slide).detach(); 26263 26264 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 26265 26266 _.reinit(); 26267 26268 } 26269 26270 }; 26271 26272 Slick.prototype.focusHandler = function() { 26273 26274 var _ = this; 26275 26276 _.$slider 26277 .off('focus.slick blur.slick') 26278 .on('focus.slick blur.slick', '*', function(event) { 26279 26280 event.stopImmediatePropagation(); 26281 var $sf = $(this); 26282 26283 setTimeout(function() { 26284 26285 if( _.options.pauseOnFocus ) { 26286 _.focussed = $sf.is(':focus'); 26287 _.autoPlay(); 26288 } 26289 26290 }, 0); 26291 26292 }); 26293 }; 26294 26295 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 26296 26297 var _ = this; 26298 return _.currentSlide; 26299 26300 }; 26301 26302 Slick.prototype.getDotCount = function() { 26303 26304 var _ = this; 26305 26306 var breakPoint = 0; 26307 var counter = 0; 26308 var pagerQty = 0; 26309 26310 if (_.options.infinite === true) { 26311 if (_.slideCount <= _.options.slidesToShow) { 26312 ++pagerQty; 26313 } else { 26314 while (breakPoint < _.slideCount) { 26315 ++pagerQty; 26316 breakPoint = counter + _.options.slidesToScroll; 26317 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 26318 } 26319 } 26320 } else if (_.options.centerMode === true) { 26321 pagerQty = _.slideCount; 26322 } else if(!_.options.asNavFor) { 26323 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 26324 }else { 26325 while (breakPoint < _.slideCount) { 26326 ++pagerQty; 26327 breakPoint = counter + _.options.slidesToScroll; 26328 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 26329 } 26330 } 26331 26332 return pagerQty - 1; 26333 26334 }; 26335 26336 Slick.prototype.getLeft = function(slideIndex) { 26337 26338 var _ = this, 26339 targetLeft, 26340 verticalHeight, 26341 verticalOffset = 0, 26342 targetSlide, 26343 coef; 26344 26345 _.slideOffset = 0; 26346 verticalHeight = _.$slides.first().outerHeight(true); 26347 26348 if (_.options.infinite === true) { 26349 if (_.slideCount > _.options.slidesToShow) { 26350 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 26351 coef = -1 26352 26353 if (_.options.vertical === true && _.options.centerMode === true) { 26354 if (_.options.slidesToShow === 2) { 26355 coef = -1.5; 26356 } else if (_.options.slidesToShow === 1) { 26357 coef = -2 26358 } 26359 } 26360 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 26361 } 26362 if (_.slideCount % _.options.slidesToScroll !== 0) { 26363 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 26364 if (slideIndex > _.slideCount) { 26365 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 26366 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 26367 } else { 26368 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 26369 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 26370 } 26371 } 26372 } 26373 } else { 26374 if (slideIndex + _.options.slidesToShow > _.slideCount) { 26375 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 26376 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 26377 } 26378 } 26379 26380 if (_.slideCount <= _.options.slidesToShow) { 26381 _.slideOffset = 0; 26382 verticalOffset = 0; 26383 } 26384 26385 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 26386 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 26387 } else if (_.options.centerMode === true && _.options.infinite === true) { 26388 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 26389 } else if (_.options.centerMode === true) { 26390 _.slideOffset = 0; 26391 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 26392 } 26393 26394 if (_.options.vertical === false) { 26395 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 26396 } else { 26397 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 26398 } 26399 26400 if (_.options.variableWidth === true) { 26401 26402 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 26403 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 26404 } else { 26405 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 26406 } 26407 26408 if (_.options.rtl === true) { 26409 if (targetSlide[0]) { 26410 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 26411 } else { 26412 targetLeft = 0; 26413 } 26414 } else { 26415 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 26416 } 26417 26418 if (_.options.centerMode === true) { 26419 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 26420 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 26421 } else { 26422 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 26423 } 26424 26425 if (_.options.rtl === true) { 26426 if (targetSlide[0]) { 26427 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 26428 } else { 26429 targetLeft = 0; 26430 } 26431 } else { 26432 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 26433 } 26434 26435 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 26436 } 26437 } 26438 26439 return targetLeft; 26440 26441 }; 26442 26443 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 26444 26445 var _ = this; 26446 26447 return _.options[option]; 26448 26449 }; 26450 26451 Slick.prototype.getNavigableIndexes = function() { 26452 26453 var _ = this, 26454 breakPoint = 0, 26455 counter = 0, 26456 indexes = [], 26457 max; 26458 26459 if (_.options.infinite === false) { 26460 max = _.slideCount; 26461 } else { 26462 breakPoint = _.options.slidesToScroll * -1; 26463 counter = _.options.slidesToScroll * -1; 26464 max = _.slideCount * 2; 26465 } 26466 26467 while (breakPoint < max) { 26468 indexes.push(breakPoint); 26469 breakPoint = counter + _.options.slidesToScroll; 26470 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 26471 } 26472 26473 return indexes; 26474 26475 }; 26476 26477 Slick.prototype.getSlick = function() { 26478 26479 return this; 26480 26481 }; 26482 26483 Slick.prototype.getSlideCount = function() { 26484 26485 var _ = this, 26486 slidesTraversed, swipedSlide, centerOffset; 26487 26488 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 26489 26490 if (_.options.swipeToSlide === true) { 26491 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 26492 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 26493 swipedSlide = slide; 26494 return false; 26495 } 26496 }); 26497 26498 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 26499 26500 return slidesTraversed; 26501 26502 } else { 26503 return _.options.slidesToScroll; 26504 } 26505 26506 }; 26507 26508 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 26509 26510 var _ = this; 26511 26512 _.changeSlide({ 26513 data: { 26514 message: 'index', 26515 index: parseInt(slide) 26516 } 26517 }, dontAnimate); 26518 26519 }; 26520 26521 Slick.prototype.init = function(creation) { 26522 26523 var _ = this; 26524 26525 if (!$(_.$slider).hasClass('slick-initialized')) { 26526 26527 $(_.$slider).addClass('slick-initialized'); 26528 26529 _.buildRows(); 26530 _.buildOut(); 26531 _.setProps(); 26532 _.startLoad(); 26533 _.loadSlider(); 26534 _.initializeEvents(); 26535 _.updateArrows(); 26536 _.updateDots(); 26537 _.checkResponsive(true); 26538 _.focusHandler(); 26539 26540 } 26541 26542 if (creation) { 26543 _.$slider.trigger('init', [_]); 26544 } 26545 26546 if (_.options.accessibility === true) { 26547 _.initADA(); 26548 } 26549 26550 if ( _.options.autoplay ) { 26551 26552 _.paused = false; 26553 _.autoPlay(); 26554 26555 } 26556 26557 }; 26558 26559 Slick.prototype.initADA = function() { 26560 var _ = this, 26561 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 26562 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 26563 return (val >= 0) && (val < _.slideCount); 26564 }); 26565 26566 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 26567 'aria-hidden': 'true', 26568 'tabindex': '-1' 26569 }).find('a, input, button, select').attr({ 26570 'tabindex': '-1' 26571 }); 26572 26573 if (_.$dots !== null) { 26574 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 26575 var slideControlIndex = tabControlIndexes.indexOf(i); 26576 26577 $(this).attr({ 26578 'role': 'tabpanel', 26579 'id': 'slick-slide' + _.instanceUid + i, 26580 'tabindex': -1 26581 }); 26582 26583 if (slideControlIndex !== -1) { 26584 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex 26585 if ($('#' + ariaButtonControl).length) { 26586 $(this).attr({ 26587 'aria-describedby': ariaButtonControl 26588 }); 26589 } 26590 } 26591 }); 26592 26593 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 26594 var mappedSlideIndex = tabControlIndexes[i]; 26595 26596 $(this).attr({ 26597 'role': 'presentation' 26598 }); 26599 26600 $(this).find('button').first().attr({ 26601 'role': 'tab', 26602 'id': 'slick-slide-control' + _.instanceUid + i, 26603 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 26604 'aria-label': (i + 1) + ' of ' + numDotGroups, 26605 'aria-selected': null, 26606 'tabindex': '-1' 26607 }); 26608 26609 }).eq(_.currentSlide).find('button').attr({ 26610 'aria-selected': 'true', 26611 'tabindex': '0' 26612 }).end(); 26613 } 26614 26615 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 26616 if (_.options.focusOnChange) { 26617 _.$slides.eq(i).attr({'tabindex': '0'}); 26618 } else { 26619 _.$slides.eq(i).removeAttr('tabindex'); 26620 } 26621 } 26622 26623 _.activateADA(); 26624 26625 }; 26626 26627 Slick.prototype.initArrowEvents = function() { 26628 26629 var _ = this; 26630 26631 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 26632 _.$prevArrow 26633 .off('click.slick') 26634 .on('click.slick', { 26635 message: 'previous' 26636 }, _.changeSlide); 26637 _.$nextArrow 26638 .off('click.slick') 26639 .on('click.slick', { 26640 message: 'next' 26641 }, _.changeSlide); 26642 26643 if (_.options.accessibility === true) { 26644 _.$prevArrow.on('keydown.slick', _.keyHandler); 26645 _.$nextArrow.on('keydown.slick', _.keyHandler); 26646 } 26647 } 26648 26649 }; 26650 26651 Slick.prototype.initDotEvents = function() { 26652 26653 var _ = this; 26654 26655 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 26656 $('li', _.$dots).on('click.slick', { 26657 message: 'index' 26658 }, _.changeSlide); 26659 26660 if (_.options.accessibility === true) { 26661 _.$dots.on('keydown.slick', _.keyHandler); 26662 } 26663 } 26664 26665 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 26666 26667 $('li', _.$dots) 26668 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 26669 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 26670 26671 } 26672 26673 }; 26674 26675 Slick.prototype.initSlideEvents = function() { 26676 26677 var _ = this; 26678 26679 if ( _.options.pauseOnHover ) { 26680 26681 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 26682 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 26683 26684 } 26685 26686 }; 26687 26688 Slick.prototype.initializeEvents = function() { 26689 26690 var _ = this; 26691 26692 _.initArrowEvents(); 26693 26694 _.initDotEvents(); 26695 _.initSlideEvents(); 26696 26697 _.$list.on('touchstart.slick mousedown.slick', { 26698 action: 'start' 26699 }, _.swipeHandler); 26700 _.$list.on('touchmove.slick mousemove.slick', { 26701 action: 'move' 26702 }, _.swipeHandler); 26703 _.$list.on('touchend.slick mouseup.slick', { 26704 action: 'end' 26705 }, _.swipeHandler); 26706 _.$list.on('touchcancel.slick mouseleave.slick', { 26707 action: 'end' 26708 }, _.swipeHandler); 26709 26710 _.$list.on('click.slick', _.clickHandler); 26711 26712 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 26713 26714 if (_.options.accessibility === true) { 26715 _.$list.on('keydown.slick', _.keyHandler); 26716 } 26717 26718 if (_.options.focusOnSelect === true) { 26719 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 26720 } 26721 26722 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 26723 26724 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 26725 26726 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 26727 26728 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 26729 $(_.setPosition); 26730 26731 }; 26732 26733 Slick.prototype.initUI = function() { 26734 26735 var _ = this; 26736 26737 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 26738 26739 _.$prevArrow.show(); 26740 _.$nextArrow.show(); 26741 26742 } 26743 26744 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 26745 26746 _.$dots.show(); 26747 26748 } 26749 26750 }; 26751 26752 Slick.prototype.keyHandler = function(event) { 26753 26754 var _ = this; 26755 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 26756 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 26757 if (event.keyCode === 37 && _.options.accessibility === true) { 26758 _.changeSlide({ 26759 data: { 26760 message: _.options.rtl === true ? 'next' : 'previous' 26761 } 26762 }); 26763 } else if (event.keyCode === 39 && _.options.accessibility === true) { 26764 _.changeSlide({ 26765 data: { 26766 message: _.options.rtl === true ? 'previous' : 'next' 26767 } 26768 }); 26769 } 26770 } 26771 26772 }; 26773 26774 Slick.prototype.lazyLoad = function() { 26775 26776 var _ = this, 26777 loadRange, cloneRange, rangeStart, rangeEnd; 26778 26779 function loadImages(imagesScope) { 26780 26781 $('img[data-lazy]', imagesScope).each(function() { 26782 26783 var image = $(this), 26784 imageSource = $(this).attr('data-lazy'), 26785 imageSrcSet = $(this).attr('data-srcset'), 26786 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 26787 imageToLoad = document.createElement('img'); 26788 26789 imageToLoad.onload = function() { 26790 26791 image 26792 .animate({ opacity: 0 }, 100, function() { 26793 26794 if (imageSrcSet) { 26795 image 26796 .attr('srcset', imageSrcSet ); 26797 26798 if (imageSizes) { 26799 image 26800 .attr('sizes', imageSizes ); 26801 } 26802 } 26803 26804 image 26805 .attr('src', imageSource) 26806 .animate({ opacity: 1 }, 200, function() { 26807 image 26808 .removeAttr('data-lazy data-srcset data-sizes') 26809 .removeClass('slick-loading'); 26810 }); 26811 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 26812 }); 26813 26814 }; 26815 26816 imageToLoad.onerror = function() { 26817 26818 image 26819 .removeAttr( 'data-lazy' ) 26820 .removeClass( 'slick-loading' ) 26821 .addClass( 'slick-lazyload-error' ); 26822 26823 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 26824 26825 }; 26826 26827 imageToLoad.src = imageSource; 26828 26829 }); 26830 26831 } 26832 26833 if (_.options.centerMode === true) { 26834 if (_.options.infinite === true) { 26835 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 26836 rangeEnd = rangeStart + _.options.slidesToShow + 2; 26837 } else { 26838 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 26839 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 26840 } 26841 } else { 26842 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 26843 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 26844 if (_.options.fade === true) { 26845 if (rangeStart > 0) rangeStart--; 26846 if (rangeEnd <= _.slideCount) rangeEnd++; 26847 } 26848 } 26849 26850 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 26851 26852 if (_.options.lazyLoad === 'anticipated') { 26853 var prevSlide = rangeStart - 1, 26854 nextSlide = rangeEnd, 26855 $slides = _.$slider.find('.slick-slide'); 26856 26857 for (var i = 0; i < _.options.slidesToScroll; i++) { 26858 if (prevSlide < 0) prevSlide = _.slideCount - 1; 26859 loadRange = loadRange.add($slides.eq(prevSlide)); 26860 loadRange = loadRange.add($slides.eq(nextSlide)); 26861 prevSlide--; 26862 nextSlide++; 26863 } 26864 } 26865 26866 loadImages(loadRange); 26867 26868 if (_.slideCount <= _.options.slidesToShow) { 26869 cloneRange = _.$slider.find('.slick-slide'); 26870 loadImages(cloneRange); 26871 } else 26872 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 26873 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 26874 loadImages(cloneRange); 26875 } else if (_.currentSlide === 0) { 26876 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 26877 loadImages(cloneRange); 26878 } 26879 26880 }; 26881 26882 Slick.prototype.loadSlider = function() { 26883 26884 var _ = this; 26885 26886 _.setPosition(); 26887 26888 _.$slideTrack.css({ 26889 opacity: 1 26890 }); 26891 26892 _.$slider.removeClass('slick-loading'); 26893 26894 _.initUI(); 26895 26896 if (_.options.lazyLoad === 'progressive') { 26897 _.progressiveLazyLoad(); 26898 } 26899 26900 }; 26901 26902 Slick.prototype.next = Slick.prototype.slickNext = function() { 26903 26904 var _ = this; 26905 26906 _.changeSlide({ 26907 data: { 26908 message: 'next' 26909 } 26910 }); 26911 26912 }; 26913 26914 Slick.prototype.orientationChange = function() { 26915 26916 var _ = this; 26917 26918 _.checkResponsive(); 26919 _.setPosition(); 26920 26921 }; 26922 26923 Slick.prototype.pause = Slick.prototype.slickPause = function() { 26924 26925 var _ = this; 26926 26927 _.autoPlayClear(); 26928 _.paused = true; 26929 26930 }; 26931 26932 Slick.prototype.play = Slick.prototype.slickPlay = function() { 26933 26934 var _ = this; 26935 26936 _.autoPlay(); 26937 _.options.autoplay = true; 26938 _.paused = false; 26939 _.focussed = false; 26940 _.interrupted = false; 26941 26942 }; 26943 26944 Slick.prototype.postSlide = function(index) { 26945 26946 var _ = this; 26947 26948 if( !_.unslicked ) { 26949 26950 _.$slider.trigger('afterChange', [_, index]); 26951 26952 _.animating = false; 26953 26954 if (_.slideCount > _.options.slidesToShow) { 26955 _.setPosition(); 26956 } 26957 26958 _.swipeLeft = null; 26959 26960 if ( _.options.autoplay ) { 26961 _.autoPlay(); 26962 } 26963 26964 if (_.options.accessibility === true) { 26965 _.initADA(); 26966 26967 if (_.options.focusOnChange) { 26968 var $currentSlide = $(_.$slides.get(_.currentSlide)); 26969 $currentSlide.attr('tabindex', 0).focus(); 26970 } 26971 } 26972 26973 } 26974 26975 }; 26976 26977 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 26978 26979 var _ = this; 26980 26981 _.changeSlide({ 26982 data: { 26983 message: 'previous' 26984 } 26985 }); 26986 26987 }; 26988 26989 Slick.prototype.preventDefault = function(event) { 26990 26991 event.preventDefault(); 26992 26993 }; 26994 26995 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 26996 26997 tryCount = tryCount || 1; 26998 26999 var _ = this, 27000 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 27001 image, 27002 imageSource, 27003 imageSrcSet, 27004 imageSizes, 27005 imageToLoad; 27006 27007 if ( $imgsToLoad.length ) { 27008 27009 image = $imgsToLoad.first(); 27010 imageSource = image.attr('data-lazy'); 27011 imageSrcSet = image.attr('data-srcset'); 27012 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 27013 imageToLoad = document.createElement('img'); 27014 27015 imageToLoad.onload = function() { 27016 27017 if (imageSrcSet) { 27018 image 27019 .attr('srcset', imageSrcSet ); 27020 27021 if (imageSizes) { 27022 image 27023 .attr('sizes', imageSizes ); 27024 } 27025 } 27026 27027 image 27028 .attr( 'src', imageSource ) 27029 .removeAttr('data-lazy data-srcset data-sizes') 27030 .removeClass('slick-loading'); 27031 27032 if ( _.options.adaptiveHeight === true ) { 27033 _.setPosition(); 27034 } 27035 27036 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 27037 _.progressiveLazyLoad(); 27038 27039 }; 27040 27041 imageToLoad.onerror = function() { 27042 27043 if ( tryCount < 3 ) { 27044 27045 /** 27046 * try to load the image 3 times, 27047 * leave a slight delay so we don't get 27048 * servers blocking the request. 27049 */ 27050 setTimeout( function() { 27051 _.progressiveLazyLoad( tryCount + 1 ); 27052 }, 500 ); 27053 27054 } else { 27055 27056 image 27057 .removeAttr( 'data-lazy' ) 27058 .removeClass( 'slick-loading' ) 27059 .addClass( 'slick-lazyload-error' ); 27060 27061 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 27062 27063 _.progressiveLazyLoad(); 27064 27065 } 27066 27067 }; 27068 27069 imageToLoad.src = imageSource; 27070 27071 } else { 27072 27073 _.$slider.trigger('allImagesLoaded', [ _ ]); 27074 27075 } 27076 27077 }; 27078 27079 Slick.prototype.refresh = function( initializing ) { 27080 27081 var _ = this, currentSlide, lastVisibleIndex; 27082 27083 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 27084 27085 // in non-infinite sliders, we don't want to go past the 27086 // last visible index. 27087 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 27088 _.currentSlide = lastVisibleIndex; 27089 } 27090 27091 // if less slides than to show, go to start. 27092 if ( _.slideCount <= _.options.slidesToShow ) { 27093 _.currentSlide = 0; 27094 27095 } 27096 27097 currentSlide = _.currentSlide; 27098 27099 _.destroy(true); 27100 27101 $.extend(_, _.initials, { currentSlide: currentSlide }); 27102 27103 _.init(); 27104 27105 if( !initializing ) { 27106 27107 _.changeSlide({ 27108 data: { 27109 message: 'index', 27110 index: currentSlide 27111 } 27112 }, false); 27113 27114 } 27115 27116 }; 27117 27118 Slick.prototype.registerBreakpoints = function() { 27119 27120 var _ = this, breakpoint, currentBreakpoint, l, 27121 responsiveSettings = _.options.responsive || null; 27122 27123 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 27124 27125 _.respondTo = _.options.respondTo || 'window'; 27126 27127 for ( breakpoint in responsiveSettings ) { 27128 27129 l = _.breakpoints.length-1; 27130 27131 if (responsiveSettings.hasOwnProperty(breakpoint)) { 27132 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 27133 27134 // loop through the breakpoints and cut out any existing 27135 // ones with the same breakpoint number, we don't want dupes. 27136 while( l >= 0 ) { 27137 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 27138 _.breakpoints.splice(l,1); 27139 } 27140 l--; 27141 } 27142 27143 _.breakpoints.push(currentBreakpoint); 27144 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 27145 27146 } 27147 27148 } 27149 27150 _.breakpoints.sort(function(a, b) { 27151 return ( _.options.mobileFirst ) ? a-b : b-a; 27152 }); 27153 27154 } 27155 27156 }; 27157 27158 Slick.prototype.reinit = function() { 27159 27160 var _ = this; 27161 27162 _.$slides = 27163 _.$slideTrack 27164 .children(_.options.slide) 27165 .addClass('slick-slide'); 27166 27167 _.slideCount = _.$slides.length; 27168 27169 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 27170 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 27171 } 27172 27173 if (_.slideCount <= _.options.slidesToShow) { 27174 _.currentSlide = 0; 27175 } 27176 27177 _.registerBreakpoints(); 27178 27179 _.setProps(); 27180 _.setupInfinite(); 27181 _.buildArrows(); 27182 _.updateArrows(); 27183 _.initArrowEvents(); 27184 _.buildDots(); 27185 _.updateDots(); 27186 _.initDotEvents(); 27187 _.cleanUpSlideEvents(); 27188 _.initSlideEvents(); 27189 27190 _.checkResponsive(false, true); 27191 27192 if (_.options.focusOnSelect === true) { 27193 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 27194 } 27195 27196 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 27197 27198 _.setPosition(); 27199 _.focusHandler(); 27200 27201 _.paused = !_.options.autoplay; 27202 _.autoPlay(); 27203 27204 _.$slider.trigger('reInit', [_]); 27205 27206 }; 27207 27208 Slick.prototype.resize = function() { 27209 27210 var _ = this; 27211 27212 if ($(window).width() !== _.windowWidth) { 27213 clearTimeout(_.windowDelay); 27214 _.windowDelay = window.setTimeout(function() { 27215 _.windowWidth = $(window).width(); 27216 _.checkResponsive(); 27217 if( !_.unslicked ) { _.setPosition(); } 27218 }, 50); 27219 } 27220 }; 27221 27222 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 27223 27224 var _ = this; 27225 27226 if (typeof(index) === 'boolean') { 27227 removeBefore = index; 27228 index = removeBefore === true ? 0 : _.slideCount - 1; 27229 } else { 27230 index = removeBefore === true ? --index : index; 27231 } 27232 27233 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 27234 return false; 27235 } 27236 27237 _.unload(); 27238 27239 if (removeAll === true) { 27240 _.$slideTrack.children().remove(); 27241 } else { 27242 _.$slideTrack.children(this.options.slide).eq(index).remove(); 27243 } 27244 27245 _.$slides = _.$slideTrack.children(this.options.slide); 27246 27247 _.$slideTrack.children(this.options.slide).detach(); 27248 27249 _.$slideTrack.append(_.$slides); 27250 27251 _.$slidesCache = _.$slides; 27252 27253 _.reinit(); 27254 27255 }; 27256 27257 Slick.prototype.setCSS = function(position) { 27258 27259 var _ = this, 27260 positionProps = {}, 27261 x, y; 27262 27263 if (_.options.rtl === true) { 27264 position = -position; 27265 } 27266 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 27267 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 27268 27269 positionProps[_.positionProp] = position; 27270 27271 if (_.transformsEnabled === false) { 27272 _.$slideTrack.css(positionProps); 27273 } else { 27274 positionProps = {}; 27275 if (_.cssTransitions === false) { 27276 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 27277 _.$slideTrack.css(positionProps); 27278 } else { 27279 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 27280 _.$slideTrack.css(positionProps); 27281 } 27282 } 27283 27284 }; 27285 27286 Slick.prototype.setDimensions = function() { 27287 27288 var _ = this; 27289 27290 if (_.options.vertical === false) { 27291 if (_.options.centerMode === true) { 27292 _.$list.css({ 27293 padding: ('0px ' + _.options.centerPadding) 27294 }); 27295 } 27296 } else { 27297 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 27298 if (_.options.centerMode === true) { 27299 _.$list.css({ 27300 padding: (_.options.centerPadding + ' 0px') 27301 }); 27302 } 27303 } 27304 27305 _.listWidth = _.$list.width(); 27306 _.listHeight = _.$list.height(); 27307 27308 27309 if (_.options.vertical === false && _.options.variableWidth === false) { 27310 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 27311 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 27312 27313 } else if (_.options.variableWidth === true) { 27314 _.$slideTrack.width(5000 * _.slideCount); 27315 } else { 27316 _.slideWidth = Math.ceil(_.listWidth); 27317 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 27318 } 27319 27320 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 27321 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 27322 27323 }; 27324 27325 Slick.prototype.setFade = function() { 27326 27327 var _ = this, 27328 targetLeft; 27329 27330 _.$slides.each(function(index, element) { 27331 targetLeft = (_.slideWidth * index) * -1; 27332 if (_.options.rtl === true) { 27333 $(element).css({ 27334 position: 'relative', 27335 right: targetLeft, 27336 top: 0, 27337 zIndex: _.options.zIndex - 2, 27338 opacity: 0 27339 }); 27340 } else { 27341 $(element).css({ 27342 position: 'relative', 27343 left: targetLeft, 27344 top: 0, 27345 zIndex: _.options.zIndex - 2, 27346 opacity: 0 27347 }); 27348 } 27349 }); 27350 27351 _.$slides.eq(_.currentSlide).css({ 27352 zIndex: _.options.zIndex - 1, 27353 opacity: 1 27354 }); 27355 27356 }; 27357 27358 Slick.prototype.setHeight = function() { 27359 27360 var _ = this; 27361 27362 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 27363 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 27364 _.$list.css('height', targetHeight); 27365 } 27366 27367 }; 27368 27369 Slick.prototype.setOption = 27370 Slick.prototype.slickSetOption = function() { 27371 27372 /** 27373 * accepts arguments in format of: 27374 * 27375 * - for changing a single option's value: 27376 * .slick("setOption", option, value, refresh ) 27377 * 27378 * - for changing a set of responsive options: 27379 * .slick("setOption", 'responsive', [{}, ...], refresh ) 27380 * 27381 * - for updating multiple values at once (not responsive) 27382 * .slick("setOption", { 'option': value, ... }, refresh ) 27383 */ 27384 27385 var _ = this, l, item, option, value, refresh = false, type; 27386 27387 if( $.type( arguments[0] ) === 'object' ) { 27388 27389 option = arguments[0]; 27390 refresh = arguments[1]; 27391 type = 'multiple'; 27392 27393 } else if ( $.type( arguments[0] ) === 'string' ) { 27394 27395 option = arguments[0]; 27396 value = arguments[1]; 27397 refresh = arguments[2]; 27398 27399 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 27400 27401 type = 'responsive'; 27402 27403 } else if ( typeof arguments[1] !== 'undefined' ) { 27404 27405 type = 'single'; 27406 27407 } 27408 27409 } 27410 27411 if ( type === 'single' ) { 27412 27413 _.options[option] = value; 27414 27415 27416 } else if ( type === 'multiple' ) { 27417 27418 $.each( option , function( opt, val ) { 27419 27420 _.options[opt] = val; 27421 27422 }); 27423 27424 27425 } else if ( type === 'responsive' ) { 27426 27427 for ( item in value ) { 27428 27429 if( $.type( _.options.responsive ) !== 'array' ) { 27430 27431 _.options.responsive = [ value[item] ]; 27432 27433 } else { 27434 27435 l = _.options.responsive.length-1; 27436 27437 // loop through the responsive object and splice out duplicates. 27438 while( l >= 0 ) { 27439 27440 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 27441 27442 _.options.responsive.splice(l,1); 27443 27444 } 27445 27446 l--; 27447 27448 } 27449 27450 _.options.responsive.push( value[item] ); 27451 27452 } 27453 27454 } 27455 27456 } 27457 27458 if ( refresh ) { 27459 27460 _.unload(); 27461 _.reinit(); 27462 27463 } 27464 27465 }; 27466 27467 Slick.prototype.setPosition = function() { 27468 27469 var _ = this; 27470 27471 _.setDimensions(); 27472 27473 _.setHeight(); 27474 27475 if (_.options.fade === false) { 27476 _.setCSS(_.getLeft(_.currentSlide)); 27477 } else { 27478 _.setFade(); 27479 } 27480 27481 _.$slider.trigger('setPosition', [_]); 27482 27483 }; 27484 27485 Slick.prototype.setProps = function() { 27486 27487 var _ = this, 27488 bodyStyle = document.body.style; 27489 27490 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 27491 27492 if (_.positionProp === 'top') { 27493 _.$slider.addClass('slick-vertical'); 27494 } else { 27495 _.$slider.removeClass('slick-vertical'); 27496 } 27497 27498 if (bodyStyle.WebkitTransition !== undefined || 27499 bodyStyle.MozTransition !== undefined || 27500 bodyStyle.msTransition !== undefined) { 27501 if (_.options.useCSS === true) { 27502 _.cssTransitions = true; 27503 } 27504 } 27505 27506 if ( _.options.fade ) { 27507 if ( typeof _.options.zIndex === 'number' ) { 27508 if( _.options.zIndex < 3 ) { 27509 _.options.zIndex = 3; 27510 } 27511 } else { 27512 _.options.zIndex = _.defaults.zIndex; 27513 } 27514 } 27515 27516 if (bodyStyle.OTransform !== undefined) { 27517 _.animType = 'OTransform'; 27518 _.transformType = '-o-transform'; 27519 _.transitionType = 'OTransition'; 27520 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 27521 } 27522 if (bodyStyle.MozTransform !== undefined) { 27523 _.animType = 'MozTransform'; 27524 _.transformType = '-moz-transform'; 27525 _.transitionType = 'MozTransition'; 27526 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 27527 } 27528 if (bodyStyle.webkitTransform !== undefined) { 27529 _.animType = 'webkitTransform'; 27530 _.transformType = '-webkit-transform'; 27531 _.transitionType = 'webkitTransition'; 27532 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 27533 } 27534 if (bodyStyle.msTransform !== undefined) { 27535 _.animType = 'msTransform'; 27536 _.transformType = '-ms-transform'; 27537 _.transitionType = 'msTransition'; 27538 if (bodyStyle.msTransform === undefined) _.animType = false; 27539 } 27540 if (bodyStyle.transform !== undefined && _.animType !== false) { 27541 _.animType = 'transform'; 27542 _.transformType = 'transform'; 27543 _.transitionType = 'transition'; 27544 } 27545 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 27546 }; 27547 27548 27549 Slick.prototype.setSlideClasses = function(index) { 27550 27551 var _ = this, 27552 centerOffset, allSlides, indexOffset, remainder; 27553 27554 allSlides = _.$slider 27555 .find('.slick-slide') 27556 .removeClass('slick-active slick-center slick-current') 27557 .attr('aria-hidden', 'true'); 27558 27559 _.$slides 27560 .eq(index) 27561 .addClass('slick-current'); 27562 27563 if (_.options.centerMode === true) { 27564 27565 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 27566 27567 centerOffset = Math.floor(_.options.slidesToShow / 2); 27568 27569 if (_.options.infinite === true) { 27570 27571 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 27572 _.$slides 27573 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 27574 .addClass('slick-active') 27575 .attr('aria-hidden', 'false'); 27576 27577 } else { 27578 27579 indexOffset = _.options.slidesToShow + index; 27580 allSlides 27581 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 27582 .addClass('slick-active') 27583 .attr('aria-hidden', 'false'); 27584 27585 } 27586 27587 if (index === 0) { 27588 27589 allSlides 27590 .eq(allSlides.length - 1 - _.options.slidesToShow) 27591 .addClass('slick-center'); 27592 27593 } else if (index === _.slideCount - 1) { 27594 27595 allSlides 27596 .eq(_.options.slidesToShow) 27597 .addClass('slick-center'); 27598 27599 } 27600 27601 } 27602 27603 _.$slides 27604 .eq(index) 27605 .addClass('slick-center'); 27606 27607 } else { 27608 27609 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 27610 27611 _.$slides 27612 .slice(index, index + _.options.slidesToShow) 27613 .addClass('slick-active') 27614 .attr('aria-hidden', 'false'); 27615 27616 } else if (allSlides.length <= _.options.slidesToShow) { 27617 27618 allSlides 27619 .addClass('slick-active') 27620 .attr('aria-hidden', 'false'); 27621 27622 } else { 27623 27624 remainder = _.slideCount % _.options.slidesToShow; 27625 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 27626 27627 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 27628 27629 allSlides 27630 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 27631 .addClass('slick-active') 27632 .attr('aria-hidden', 'false'); 27633 27634 } else { 27635 27636 allSlides 27637 .slice(indexOffset, indexOffset + _.options.slidesToShow) 27638 .addClass('slick-active') 27639 .attr('aria-hidden', 'false'); 27640 27641 } 27642 27643 } 27644 27645 } 27646 27647 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 27648 _.lazyLoad(); 27649 } 27650 }; 27651 27652 Slick.prototype.setupInfinite = function() { 27653 27654 var _ = this, 27655 i, slideIndex, infiniteCount; 27656 27657 if (_.options.fade === true) { 27658 _.options.centerMode = false; 27659 } 27660 27661 if (_.options.infinite === true && _.options.fade === false) { 27662 27663 slideIndex = null; 27664 27665 if (_.slideCount > _.options.slidesToShow) { 27666 27667 if (_.options.centerMode === true) { 27668 infiniteCount = _.options.slidesToShow + 1; 27669 } else { 27670 infiniteCount = _.options.slidesToShow; 27671 } 27672 27673 for (i = _.slideCount; i > (_.slideCount - 27674 infiniteCount); i -= 1) { 27675 slideIndex = i - 1; 27676 $(_.$slides[slideIndex]).clone(true).attr('id', '') 27677 .attr('data-slick-index', slideIndex - _.slideCount) 27678 .prependTo(_.$slideTrack).addClass('slick-cloned'); 27679 } 27680 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 27681 slideIndex = i; 27682 $(_.$slides[slideIndex]).clone(true).attr('id', '') 27683 .attr('data-slick-index', slideIndex + _.slideCount) 27684 .appendTo(_.$slideTrack).addClass('slick-cloned'); 27685 } 27686 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 27687 $(this).attr('id', ''); 27688 }); 27689 27690 } 27691 27692 } 27693 27694 }; 27695 27696 Slick.prototype.interrupt = function( toggle ) { 27697 27698 var _ = this; 27699 27700 if( !toggle ) { 27701 _.autoPlay(); 27702 } 27703 _.interrupted = toggle; 27704 27705 }; 27706 27707 Slick.prototype.selectHandler = function(event) { 27708 27709 var _ = this; 27710 27711 var targetElement = 27712 $(event.target).is('.slick-slide') ? 27713 $(event.target) : 27714 $(event.target).parents('.slick-slide'); 27715 27716 var index = parseInt(targetElement.attr('data-slick-index')); 27717 27718 if (!index) index = 0; 27719 27720 if (_.slideCount <= _.options.slidesToShow) { 27721 27722 _.slideHandler(index, false, true); 27723 return; 27724 27725 } 27726 27727 _.slideHandler(index); 27728 27729 }; 27730 27731 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 27732 27733 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 27734 _ = this, navTarget; 27735 27736 sync = sync || false; 27737 27738 if (_.animating === true && _.options.waitForAnimate === true) { 27739 return; 27740 } 27741 27742 if (_.options.fade === true && _.currentSlide === index) { 27743 return; 27744 } 27745 27746 if (sync === false) { 27747 _.asNavFor(index); 27748 } 27749 27750 targetSlide = index; 27751 targetLeft = _.getLeft(targetSlide); 27752 slideLeft = _.getLeft(_.currentSlide); 27753 27754 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 27755 27756 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 27757 if (_.options.fade === false) { 27758 targetSlide = _.currentSlide; 27759 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 27760 _.animateSlide(slideLeft, function() { 27761 _.postSlide(targetSlide); 27762 }); 27763 } else { 27764 _.postSlide(targetSlide); 27765 } 27766 } 27767 return; 27768 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 27769 if (_.options.fade === false) { 27770 targetSlide = _.currentSlide; 27771 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 27772 _.animateSlide(slideLeft, function() { 27773 _.postSlide(targetSlide); 27774 }); 27775 } else { 27776 _.postSlide(targetSlide); 27777 } 27778 } 27779 return; 27780 } 27781 27782 if ( _.options.autoplay ) { 27783 clearInterval(_.autoPlayTimer); 27784 } 27785 27786 if (targetSlide < 0) { 27787 if (_.slideCount % _.options.slidesToScroll !== 0) { 27788 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 27789 } else { 27790 animSlide = _.slideCount + targetSlide; 27791 } 27792 } else if (targetSlide >= _.slideCount) { 27793 if (_.slideCount % _.options.slidesToScroll !== 0) { 27794 animSlide = 0; 27795 } else { 27796 animSlide = targetSlide - _.slideCount; 27797 } 27798 } else { 27799 animSlide = targetSlide; 27800 } 27801 27802 _.animating = true; 27803 27804 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 27805 27806 oldSlide = _.currentSlide; 27807 _.currentSlide = animSlide; 27808 27809 _.setSlideClasses(_.currentSlide); 27810 27811 if ( _.options.asNavFor ) { 27812 27813 navTarget = _.getNavTarget(); 27814 navTarget = navTarget.slick('getSlick'); 27815 27816 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 27817 navTarget.setSlideClasses(_.currentSlide); 27818 } 27819 27820 } 27821 27822 _.updateDots(); 27823 _.updateArrows(); 27824 27825 if (_.options.fade === true) { 27826 if (dontAnimate !== true) { 27827 27828 _.fadeSlideOut(oldSlide); 27829 27830 _.fadeSlide(animSlide, function() { 27831 _.postSlide(animSlide); 27832 }); 27833 27834 } else { 27835 _.postSlide(animSlide); 27836 } 27837 _.animateHeight(); 27838 return; 27839 } 27840 27841 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 27842 _.animateSlide(targetLeft, function() { 27843 _.postSlide(animSlide); 27844 }); 27845 } else { 27846 _.postSlide(animSlide); 27847 } 27848 27849 }; 27850 27851 Slick.prototype.startLoad = function() { 27852 27853 var _ = this; 27854 27855 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 27856 27857 _.$prevArrow.hide(); 27858 _.$nextArrow.hide(); 27859 27860 } 27861 27862 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 27863 27864 _.$dots.hide(); 27865 27866 } 27867 27868 _.$slider.addClass('slick-loading'); 27869 27870 }; 27871 27872 Slick.prototype.swipeDirection = function() { 27873 27874 var xDist, yDist, r, swipeAngle, _ = this; 27875 27876 xDist = _.touchObject.startX - _.touchObject.curX; 27877 yDist = _.touchObject.startY - _.touchObject.curY; 27878 r = Math.atan2(yDist, xDist); 27879 27880 swipeAngle = Math.round(r * 180 / Math.PI); 27881 if (swipeAngle < 0) { 27882 swipeAngle = 360 - Math.abs(swipeAngle); 27883 } 27884 27885 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 27886 return (_.options.rtl === false ? 'left' : 'right'); 27887 } 27888 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 27889 return (_.options.rtl === false ? 'left' : 'right'); 27890 } 27891 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 27892 return (_.options.rtl === false ? 'right' : 'left'); 27893 } 27894 if (_.options.verticalSwiping === true) { 27895 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 27896 return 'down'; 27897 } else { 27898 return 'up'; 27899 } 27900 } 27901 27902 return 'vertical'; 27903 27904 }; 27905 27906 Slick.prototype.swipeEnd = function(event) { 27907 27908 var _ = this, 27909 slideCount, 27910 direction; 27911 27912 _.dragging = false; 27913 _.swiping = false; 27914 27915 if (_.scrolling) { 27916 _.scrolling = false; 27917 return false; 27918 } 27919 27920 _.interrupted = false; 27921 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 27922 27923 if ( _.touchObject.curX === undefined ) { 27924 return false; 27925 } 27926 27927 if ( _.touchObject.edgeHit === true ) { 27928 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 27929 } 27930 27931 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 27932 27933 direction = _.swipeDirection(); 27934 27935 switch ( direction ) { 27936 27937 case 'left': 27938 case 'down': 27939 27940 slideCount = 27941 _.options.swipeToSlide ? 27942 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 27943 _.currentSlide + _.getSlideCount(); 27944 27945 _.currentDirection = 0; 27946 27947 break; 27948 27949 case 'right': 27950 case 'up': 27951 27952 slideCount = 27953 _.options.swipeToSlide ? 27954 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 27955 _.currentSlide - _.getSlideCount(); 27956 27957 _.currentDirection = 1; 27958 27959 break; 27960 27961 default: 27962 27963 27964 } 27965 27966 if( direction != 'vertical' ) { 27967 27968 _.slideHandler( slideCount ); 27969 _.touchObject = {}; 27970 _.$slider.trigger('swipe', [_, direction ]); 27971 27972 } 27973 27974 } else { 27975 27976 if ( _.touchObject.startX !== _.touchObject.curX ) { 27977 27978 _.slideHandler( _.currentSlide ); 27979 _.touchObject = {}; 27980 27981 } 27982 27983 } 27984 27985 }; 27986 27987 Slick.prototype.swipeHandler = function(event) { 27988 27989 var _ = this; 27990 27991 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 27992 return; 27993 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 27994 return; 27995 } 27996 27997 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 27998 event.originalEvent.touches.length : 1; 27999 28000 _.touchObject.minSwipe = _.listWidth / _.options 28001 .touchThreshold; 28002 28003 if (_.options.verticalSwiping === true) { 28004 _.touchObject.minSwipe = _.listHeight / _.options 28005 .touchThreshold; 28006 } 28007 28008 switch (event.data.action) { 28009 28010 case 'start': 28011 _.swipeStart(event); 28012 break; 28013 28014 case 'move': 28015 _.swipeMove(event); 28016 break; 28017 28018 case 'end': 28019 _.swipeEnd(event); 28020 break; 28021 28022 } 28023 28024 }; 28025 28026 Slick.prototype.swipeMove = function(event) { 28027 28028 var _ = this, 28029 edgeWasHit = false, 28030 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 28031 28032 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 28033 28034 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 28035 return false; 28036 } 28037 28038 curLeft = _.getLeft(_.currentSlide); 28039 28040 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 28041 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 28042 28043 _.touchObject.swipeLength = Math.round(Math.sqrt( 28044 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 28045 28046 verticalSwipeLength = Math.round(Math.sqrt( 28047 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 28048 28049 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 28050 _.scrolling = true; 28051 return false; 28052 } 28053 28054 if (_.options.verticalSwiping === true) { 28055 _.touchObject.swipeLength = verticalSwipeLength; 28056 } 28057 28058 swipeDirection = _.swipeDirection(); 28059 28060 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 28061 _.swiping = true; 28062 event.preventDefault(); 28063 } 28064 28065 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 28066 if (_.options.verticalSwiping === true) { 28067 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 28068 } 28069 28070 28071 swipeLength = _.touchObject.swipeLength; 28072 28073 _.touchObject.edgeHit = false; 28074 28075 if (_.options.infinite === false) { 28076 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 28077 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 28078 _.touchObject.edgeHit = true; 28079 } 28080 } 28081 28082 if (_.options.vertical === false) { 28083 _.swipeLeft = curLeft + swipeLength * positionOffset; 28084 } else { 28085 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 28086 } 28087 if (_.options.verticalSwiping === true) { 28088 _.swipeLeft = curLeft + swipeLength * positionOffset; 28089 } 28090 28091 if (_.options.fade === true || _.options.touchMove === false) { 28092 return false; 28093 } 28094 28095 if (_.animating === true) { 28096 _.swipeLeft = null; 28097 return false; 28098 } 28099 28100 _.setCSS(_.swipeLeft); 28101 28102 }; 28103 28104 Slick.prototype.swipeStart = function(event) { 28105 28106 var _ = this, 28107 touches; 28108 28109 _.interrupted = true; 28110 28111 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 28112 _.touchObject = {}; 28113 return false; 28114 } 28115 28116 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 28117 touches = event.originalEvent.touches[0]; 28118 } 28119 28120 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 28121 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 28122 28123 _.dragging = true; 28124 28125 }; 28126 28127 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 28128 28129 var _ = this; 28130 28131 if (_.$slidesCache !== null) { 28132 28133 _.unload(); 28134 28135 _.$slideTrack.children(this.options.slide).detach(); 28136 28137 _.$slidesCache.appendTo(_.$slideTrack); 28138 28139 _.reinit(); 28140 28141 } 28142 28143 }; 28144 28145 Slick.prototype.unload = function() { 28146 28147 var _ = this; 28148 28149 $('.slick-cloned', _.$slider).remove(); 28150 28151 if (_.$dots) { 28152 _.$dots.remove(); 28153 } 28154 28155 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 28156 _.$prevArrow.remove(); 28157 } 28158 28159 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 28160 _.$nextArrow.remove(); 28161 } 28162 28163 _.$slides 28164 .removeClass('slick-slide slick-active slick-visible slick-current') 28165 .attr('aria-hidden', 'true') 28166 .css('width', ''); 28167 28168 }; 28169 28170 Slick.prototype.unslick = function(fromBreakpoint) { 28171 28172 var _ = this; 28173 _.$slider.trigger('unslick', [_, fromBreakpoint]); 28174 _.destroy(); 28175 28176 }; 28177 28178 Slick.prototype.updateArrows = function() { 28179 28180 var _ = this, 28181 centerOffset; 28182 28183 centerOffset = Math.floor(_.options.slidesToShow / 2); 28184 28185 if ( _.options.arrows === true && 28186 _.slideCount > _.options.slidesToShow && 28187 !_.options.infinite ) { 28188 28189 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 28190 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 28191 28192 if (_.currentSlide === 0) { 28193 28194 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 28195 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 28196 28197 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 28198 28199 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 28200 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 28201 28202 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 28203 28204 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 28205 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 28206 28207 } 28208 28209 } 28210 28211 }; 28212 28213 Slick.prototype.updateDots = function() { 28214 28215 var _ = this; 28216 28217 if (_.$dots !== null) { 28218 28219 _.$dots 28220 .find('li') 28221 .removeClass('slick-active') 28222 .end(); 28223 28224 _.$dots 28225 .find('li') 28226 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 28227 .addClass('slick-active'); 28228 28229 } 28230 28231 }; 28232 28233 Slick.prototype.visibility = function() { 28234 28235 var _ = this; 28236 28237 if ( _.options.autoplay ) { 28238 28239 if ( document[_.hidden] ) { 28240 28241 _.interrupted = true; 28242 28243 } else { 28244 28245 _.interrupted = false; 28246 28247 } 28248 28249 } 28250 28251 }; 28252 28253 $.fn.slick = function() { 28254 var _ = this, 28255 opt = arguments[0], 28256 args = Array.prototype.slice.call(arguments, 1), 28257 l = _.length, 28258 i, 28259 ret; 28260 for (i = 0; i < l; i++) { 28261 if (typeof opt == 'object' || typeof opt == 'undefined') 28262 _[i].slick = new Slick(_[i], opt); 28263 else 28264 ret = _[i].slick[opt].apply(_[i].slick, args); 28265 if (typeof ret != 'undefined') return ret; 28266 } 28267 return _; 28268 }; 28269 28270})); 28271 28272 28273/***/ }), 28274
vendor: 16,849 bytes, lines 28275-28638
28275/***/ "./Themes/Cynoebook/node_modules/slick-lightbox/dist/slick-lightbox.js": 28276/*!*****************************************************************************!*\ 28277 !*** ./Themes/Cynoebook/node_modules/slick-lightbox/dist/slick-lightbox.js ***! 28278 \*****************************************************************************/ 28279/*! no static exports found */ 28280/***/ (function(module, exports, __webpack_require__) { 28281 28282"use strict"; 28283 28284(function ($) { 28285 var SlickLightbox, defaults; 28286 SlickLightbox = function () { 28287 /* 28288 The core class. 28289 */ 28290 function SlickLightbox(element, options1) { 28291 var slickLightbox; 28292 this.options = options1; 28293 /* Binds the plugin. */ 28294 this.$element = $(element); 28295 this.didInit = false; 28296 slickLightbox = this; 28297 this.$element.on('click.slickLightbox', this.options.itemSelector, function (e) { 28298 var $clickedItem, $items; 28299 e.preventDefault(); 28300 $clickedItem = $(this); 28301 $clickedItem.blur(); 28302 if (typeof slickLightbox.options.shouldOpen === 'function') { 28303 if (!slickLightbox.options.shouldOpen(slickLightbox, $clickedItem, e)) { 28304 return; 28305 } 28306 } 28307 $items = slickLightbox.$element.find(slickLightbox.options.itemSelector); 28308 if (slickLightbox.elementIsSlick()) { 28309 $items = slickLightbox.filterOutSlickClones($items); 28310 $clickedItem = slickLightbox.handlePossibleCloneClick($clickedItem, $items); 28311 } 28312 return slickLightbox.init($items.index($clickedItem)); 28313 }); 28314 } 28315 SlickLightbox.prototype.init = function (index) { 28316 /* Creates the lightbox, opens it, binds events and calls `slick`. Accepts `index` of the element, that triggered it (so that we know, on which slide to start slick). */ 28317 this.didInit = true; 28318 this.detectIE(); 28319 this.createModal(); 28320 this.bindEvents(); 28321 this.initSlick(index); 28322 return this.open(); 28323 }; 28324 SlickLightbox.prototype.createModalItems = function () { 28325 /* Creates individual slides to be used with slick. If `options.images` array is specified, it uses it's contents, otherwise loops through elements' `options.itemSelector`. */ 28326 var $items, createItem, itemTemplate, lazyPlaceholder, length, links; 28327 lazyPlaceholder = this.options.lazyPlaceholder || 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; 28328 itemTemplate = function (source, caption, lazy) { 28329 var imgSourceParams; 28330 if (lazy === true) { 28331 imgSourceParams = ' data-lazy="' + source + '" src="' + lazyPlaceholder + '" '; 28332 } else { 28333 imgSourceParams = ' src="' + source + '" '; 28334 } 28335 return '<div class="slick-lightbox-slick-item">\n <div class="slick-lightbox-slick-item-inner">\n <img class="slick-lightbox-slick-img" ' + imgSourceParams + ' />\n ' + caption + '\n </div>\n</div>'; 28336 }; 28337 if (this.options.images) { 28338 links = $.map(this.options.images, function (_this) { 28339 return function (img) { 28340 return itemTemplate(img, _this.options.lazy); 28341 }; 28342 }(this)); 28343 } else { 28344 $items = this.filterOutSlickClones(this.$element.find(this.options.itemSelector)); 28345 length = $items.length; 28346 createItem = function (_this) { 28347 return function (el, index) { 28348 var caption, info, src; 28349 info = { 28350 index: index, 28351 length: length 28352 }; 28353 caption = _this.getElementCaption(el, info); 28354 src = _this.getElementSrc(el); 28355 return itemTemplate(src, caption, _this.options.lazy); 28356 }; 28357 }(this); 28358 links = $.map($items, createItem); 28359 } 28360 return links; 28361 }; 28362 SlickLightbox.prototype.createModal = function () { 28363 /* Creates a `slick`-friendly modal. */ 28364 var html, links; 28365 links = this.createModalItems(); 28366 html = '<div class="slick-lightbox slick-lightbox-hide-init' + (this.isIE ? ' slick-lightbox-ie' : '') + '" style="background: ' + this.options.background + ';">\n <div class="slick-lightbox-inner">\n <div class="slick-lightbox-slick slick-caption-' + this.options.captionPosition + '">' + links.join('') + '</div>\n <div>\n<div>'; 28367 this.$modalElement = $(html); 28368 this.$parts = {}; 28369 this.$parts['closeButton'] = $(this.options.layouts.closeButton); 28370 this.$modalElement.find('.slick-lightbox-inner').append(this.$parts['closeButton']); 28371 return $('body').append(this.$modalElement); 28372 }; 28373 SlickLightbox.prototype.initSlick = function (index) { 28374 /* Runs slick by default, using `options.slick` if provided. If `options.slick` is a function, it gets fired instead of us initializing slick. Merges in initialSlide option. */ 28375 var additional; 28376 additional = { initialSlide: index }; 28377 if (this.options.lazy) { 28378 additional.lazyLoad = 'ondemand'; 28379 } 28380 if (this.options.slick != null) { 28381 if (typeof this.options.slick === 'function') { 28382 this.slick = this.options.slick(this.$modalElement); 28383 } else { 28384 this.slick = this.$modalElement.find('.slick-lightbox-slick').slick($.extend({}, this.options.slick, additional)); 28385 } 28386 } else { 28387 this.slick = this.$modalElement.find('.slick-lightbox-slick').slick(additional); 28388 } 28389 return this.$modalElement.trigger('init.slickLightbox'); 28390 }; 28391 SlickLightbox.prototype.open = function () { 28392 /* Opens the lightbox. */ 28393 if (this.options.useHistoryApi) { 28394 this.writeHistory(); 28395 } 28396 this.$element.trigger('show.slickLightbox'); 28397 setTimeout(function (_this) { 28398 return function () { 28399 return _this.$element.trigger('shown.slickLightbox'); 28400 }; 28401 }(this), this.getTransitionDuration()); 28402 return this.$modalElement.removeClass('slick-lightbox-hide-init'); 28403 }; 28404 SlickLightbox.prototype.close = function () { 28405 /* Closes the lightbox and destroys it, maintaining the original element bindings. */ 28406 this.$element.trigger('hide.slickLightbox'); 28407 setTimeout(function (_this) { 28408 return function () { 28409 return _this.$element.trigger('hidden.slickLightbox'); 28410 }; 28411 }(this), this.getTransitionDuration()); 28412 this.$modalElement.addClass('slick-lightbox-hide'); 28413 return this.destroy(); 28414 }; 28415 SlickLightbox.prototype.bindEvents = function () { 28416 /* Binds global events. */ 28417 var resizeSlides; 28418 resizeSlides = function (_this) { 28419 return function () { 28420 var h; 28421 h = _this.$modalElement.find('.slick-lightbox-inner').height(); 28422 _this.$modalElement.find('.slick-lightbox-slick-item').height(h); 28423 return _this.$modalElement.find('.slick-lightbox-slick-img, .slick-lightbox-slick-item-inner').css('max-height', Math.round(_this.options.imageMaxHeight * h)); 28424 }; 28425 }(this); 28426 $(window).on('orientationchange.slickLightbox resize.slickLightbox', resizeSlides); 28427 if (this.options.useHistoryApi) { 28428 $(window).on('popstate.slickLightbox', function (_this) { 28429 return function () { 28430 return _this.close(); 28431 }; 28432 }(this)); 28433 } 28434 this.$modalElement.on('init.slickLightbox', resizeSlides); 28435 this.$modalElement.on('destroy.slickLightbox', function (_this) { 28436 return function () { 28437 return _this.destroy(); 28438 }; 28439 }(this)); 28440 this.$element.on('destroy.slickLightbox', function (_this) { 28441 return function () { 28442 return _this.destroy(true); 28443 }; 28444 }(this)); 28445 this.$parts['closeButton'].on('click.slickLightbox touchstart.slickLightbox', function (_this) { 28446 return function (e) { 28447 e.preventDefault(); 28448 return _this.close(); 28449 }; 28450 }(this)); 28451 if (this.options.closeOnEscape || this.options.navigateByKeyboard) { 28452 $(document).on('keydown.slickLightbox', function (_this) { 28453 return function (e) { 28454 var code; 28455 code = e.keyCode ? e.keyCode : e.which; 28456 if (_this.options.navigateByKeyboard) { 28457 if (code === 37) { 28458 _this.slideSlick('left'); 28459 } else if (code === 39) { 28460 _this.slideSlick('right'); 28461 } 28462 } 28463 if (_this.options.closeOnEscape) { 28464 if (code === 27) { 28465 return _this.close(); 28466 } 28467 } 28468 }; 28469 }(this)); 28470 } 28471 if (this.options.closeOnBackdropClick) { 28472 this.$modalElement.on('click.slickLightbox touchstart.slickLightbox', '.slick-lightbox-slick-img', function (e) { 28473 return e.stopPropagation(); 28474 }); 28475 return this.$modalElement.on('click.slickLightbox', '.slick-lightbox-slick-item', function (_this) { 28476 return function (e) { 28477 e.preventDefault(); 28478 return _this.close(); 28479 }; 28480 }(this)); 28481 } 28482 }; 28483 SlickLightbox.prototype.slideSlick = function (direction) { 28484 /* Moves the slick prev or next. */ 28485 if (direction === 'left') { 28486 return this.slick.slick('slickPrev'); 28487 } else { 28488 return this.slick.slick('slickNext'); 28489 } 28490 }; 28491 SlickLightbox.prototype.detectIE = function () { 28492 /* Detects usage of IE8 and lower. */ 28493 var ieversion; 28494 this.isIE = false; 28495 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { 28496 ieversion = new Number(RegExp.$1); 28497 if (ieversion < 9) { 28498 return this.isIE = true; 28499 } 28500 } 28501 }; 28502 SlickLightbox.prototype.getElementCaption = function (el, info) { 28503 /* Returns caption for each slide based on the type of `options.caption`. */ 28504 var c; 28505 if (!this.options.caption) { 28506 return ''; 28507 } 28508 c = function () { 28509 switch (typeof this.options.caption) { 28510 case 'function': 28511 return this.options.caption(el, info); 28512 case 'string': 28513 return $(el).data(this.options.caption); 28514 } 28515 }.call(this); 28516 return '<span class="slick-lightbox-slick-caption">' + c + '</span>'; 28517 }; 28518 SlickLightbox.prototype.getElementSrc = function (el) { 28519 /* Returns src for each slide image based on the type of `options.src`. */ 28520 switch (typeof this.options.src) { 28521 case 'function': 28522 return this.options.src(el); 28523 case 'string': 28524 return $(el).attr(this.options.src); 28525 default: 28526 return el.href; 28527 } 28528 }; 28529 SlickLightbox.prototype.unbindEvents = function () { 28530 /* Unbinds global events. */ 28531 $(window).off('.slickLightbox'); 28532 $(document).off('.slickLightbox'); 28533 return this.$modalElement.off('.slickLightbox'); 28534 }; 28535 SlickLightbox.prototype.destroy = function (unbindAnchors) { 28536 if (unbindAnchors == null) { 28537 unbindAnchors = false; 28538 } 28539 /* Destroys the lightbox and unbinds global events. If `true` is passed as an argument, unbinds the original element as well. */ 28540 if (this.didInit) { 28541 this.unbindEvents(); 28542 setTimeout(function (_this) { 28543 return function () { 28544 return _this.$modalElement.remove(); 28545 }; 28546 }(this), this.options.destroyTimeout); 28547 } 28548 if (unbindAnchors) { 28549 this.$element.off('.slickLightbox'); 28550 return this.$element.off('.slickLightbox', this.options.itemSelector); 28551 } 28552 }; 28553 SlickLightbox.prototype.destroyPrevious = function () { 28554 /* Destroys lightboxes currently in DOM. */ 28555 return $('body').children('.slick-lightbox').trigger('destroy.slickLightbox'); 28556 }; 28557 SlickLightbox.prototype.getTransitionDuration = function () { 28558 /* Detects the transition duration to know when to remove stuff from DOM etc. */ 28559 var duration; 28560 if (this.transitionDuration) { 28561 return this.transitionDuration; 28562 } 28563 duration = this.$modalElement.css('transition-duration'); 28564 if (typeof duration === 'undefined') { 28565 return this.transitionDuration = 500; 28566 } else { 28567 return this.transitionDuration = duration.indexOf('ms') > -1 ? parseFloat(duration) : parseFloat(duration) * 1000; 28568 } 28569 }; 28570 SlickLightbox.prototype.writeHistory = function () { 28571 /* Writes an empty state to the history API if supported. */ 28572 return typeof history !== 'undefined' && history !== null ? typeof history.pushState === 'function' ? history.pushState(null, null, '') : void 0 : void 0; 28573 }; 28574 SlickLightbox.prototype.filterOutSlickClones = function ($items) { 28575 /* Removes all slick clones from the set of elements. Only does so, if the target element is a slick slider. */ 28576 if (!this.elementIsSlick()) { 28577 return $items; 28578 } 28579 return $items = $items.filter(function () { 28580 var $item; 28581 $item = $(this); 28582 return !$item.hasClass('slick-cloned') && $item.parents('.slick-cloned').length === 0; 28583 }); 28584 }; 28585 SlickLightbox.prototype.handlePossibleCloneClick = function ($clickedItem, $items) { 28586 var href; 28587 if (!this.elementIsSlick()) { 28588 return $clickedItem; 28589 } 28590 if (!$clickedItem.closest('.slick-slide').hasClass('slick-cloned')) { 28591 return $clickedItem; 28592 } 28593 href = $clickedItem.attr('href'); 28594 return $items.filter(function () { 28595 return $(this).attr('href') === href; 28596 }).first(); 28597 }; 28598 SlickLightbox.prototype.elementIsSlick = function () { 28599 return this.$element.hasClass('slick-slider'); 28600 }; 28601 return SlickLightbox; 28602 }(); 28603 defaults = { 28604 background: 'rgba(0,0,0,.8)', 28605 closeOnEscape: true, 28606 closeOnBackdropClick: true, 28607 destroyTimeout: 500, 28608 itemSelector: 'a', 28609 navigateByKeyboard: true, 28610 src: false, 28611 caption: false, 28612 captionPosition: 'dynamic', 28613 images: false, 28614 slick: {}, 28615 useHistoryApi: false, 28616 layouts: { closeButton: '<button type="button" class="slick-lightbox-close"></button>' }, 28617 shouldOpen: null, 28618 imageMaxHeight: 0.9, 28619 lazy: false 28620 }; 28621 $.fn.slickLightbox = function (options) { 28622 /* Fires the plugin. */ 28623 options = $.extend({}, defaults, options); 28624 $(this).each(function () { 28625 return this.slickLightbox = new SlickLightbox(this, options); 28626 }); 28627 return this; 28628 }; 28629 $.fn.unslickLightbox = function () { 28630 /* Removes everything. */ 28631 return $(this).trigger('destroy.slickLightbox').each(function () { 28632 return this.slickLightbox = null; 28633 }); 28634 }; 28635}(jQuery)); 28636 28637/***/ }), 28638
vendor: 400,262 bytes, lines 28639-40469
28639/***/ "./Themes/Cynoebook/node_modules/vue/dist/vue.common.dev.js": 28640/*!******************************************************************!*\ 28641 !*** ./Themes/Cynoebook/node_modules/vue/dist/vue.common.dev.js ***! 28642 \******************************************************************/ 28643/*! no static exports found */ 28644/***/ (function(module, exports, __webpack_require__) { 28645 28646"use strict"; 28647/* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*! 28648 * Vue.js v2.7.16 28649 * (c) 2014-2023 Evan You 28650 * Released under the MIT License. 28651 */ 28652 28653 28654const emptyObject = Object.freeze({}); 28655const isArray = Array.isArray; 28656// These helpers produce better VM code in JS engines due to their 28657// explicitness and function inlining. 28658function isUndef(v) { 28659 return v === undefined || v === null; 28660} 28661function isDef(v) { 28662 return v !== undefined && v !== null; 28663} 28664function isTrue(v) { 28665 return v === true; 28666} 28667function isFalse(v) { 28668 return v === false; 28669} 28670/** 28671 * Check if value is primitive. 28672 */ 28673function isPrimitive(value) { 28674 return (typeof value === 'string' || 28675 typeof value === 'number' || 28676 // $flow-disable-line 28677 typeof value === 'symbol' || 28678 typeof value === 'boolean'); 28679} 28680function isFunction(value) { 28681 return typeof value === 'function'; 28682} 28683/** 28684 * Quick object check - this is primarily used to tell 28685 * objects from primitive values when we know the value 28686 * is a JSON-compliant type. 28687 */ 28688function isObject(obj) { 28689 return obj !== null && typeof obj === 'object'; 28690} 28691/** 28692 * Get the raw type string of a value, e.g., [object Object]. 28693 */ 28694const _toString = Object.prototype.toString; 28695function toRawType(value) { 28696 return _toString.call(value).slice(8, -1); 28697} 28698/** 28699 * Strict object type check. Only returns true 28700 * for plain JavaScript objects. 28701 */ 28702function isPlainObject(obj) { 28703 return _toString.call(obj) === '[object Object]'; 28704} 28705function isRegExp(v) { 28706 return _toString.call(v) === '[object RegExp]'; 28707} 28708/** 28709 * Check if val is a valid array index. 28710 */ 28711function isValidArrayIndex(val) { 28712 const n = parseFloat(String(val)); 28713 return n >= 0 && Math.floor(n) === n && isFinite(val); 28714} 28715function isPromise(val) { 28716 return (isDef(val) && 28717 typeof val.then === 'function' && 28718 typeof val.catch === 'function'); 28719} 28720/** 28721 * Convert a value to a string that is actually rendered. 28722 */ 28723function toString(val) { 28724 return val == null 28725 ? '' 28726 : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) 28727 ? JSON.stringify(val, replacer, 2) 28728 : String(val); 28729} 28730function replacer(_key, val) { 28731 // avoid circular deps from v3 28732 if (val && val.__v_isRef) { 28733 return val.value; 28734 } 28735 return val; 28736} 28737/** 28738 * Convert an input value to a number for persistence. 28739 * If the conversion fails, return original string. 28740 */ 28741function toNumber(val) { 28742 const n = parseFloat(val); 28743 return isNaN(n) ? val : n; 28744} 28745/** 28746 * Make a map and return a function for checking if a key 28747 * is in that map. 28748 */ 28749function makeMap(str, expectsLowerCase) { 28750 const map = Object.create(null); 28751 const list = str.split(','); 28752 for (let i = 0; i < list.length; i++) { 28753 map[list[i]] = true; 28754 } 28755 return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val]; 28756} 28757/** 28758 * Check if a tag is a built-in tag. 28759 */ 28760const isBuiltInTag = makeMap('slot,component', true); 28761/** 28762 * Check if an attribute is a reserved attribute. 28763 */ 28764const isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); 28765/** 28766 * Remove an item from an array. 28767 */ 28768function remove$2(arr, item) { 28769 const len = arr.length; 28770 if (len) { 28771 // fast path for the only / last item 28772 if (item === arr[len - 1]) { 28773 arr.length = len - 1; 28774 return; 28775 } 28776 const index = arr.indexOf(item); 28777 if (index > -1) { 28778 return arr.splice(index, 1); 28779 } 28780 } 28781} 28782/** 28783 * Check whether an object has the property. 28784 */ 28785const hasOwnProperty = Object.prototype.hasOwnProperty; 28786function hasOwn(obj, key) { 28787 return hasOwnProperty.call(obj, key); 28788} 28789/** 28790 * Create a cached version of a pure function. 28791 */ 28792function cached(fn) { 28793 const cache = Object.create(null); 28794 return function cachedFn(str) { 28795 const hit = cache[str]; 28796 return hit || (cache[str] = fn(str)); 28797 }; 28798} 28799/** 28800 * Camelize a hyphen-delimited string. 28801 */ 28802const camelizeRE = /-(\w)/g; 28803const camelize = cached((str) => { 28804 return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : '')); 28805}); 28806/** 28807 * Capitalize a string. 28808 */ 28809const capitalize = cached((str) => { 28810 return str.charAt(0).toUpperCase() + str.slice(1); 28811}); 28812/** 28813 * Hyphenate a camelCase string. 28814 */ 28815const hyphenateRE = /\B([A-Z])/g; 28816const hyphenate = cached((str) => { 28817 return str.replace(hyphenateRE, '-$1').toLowerCase(); 28818}); 28819/** 28820 * Simple bind polyfill for environments that do not support it, 28821 * e.g., PhantomJS 1.x. Technically, we don't need this anymore 28822 * since native bind is now performant enough in most browsers. 28823 * But removing it would mean breaking code that was able to run in 28824 * PhantomJS 1.x, so this must be kept for backward compatibility. 28825 */ 28826/* istanbul ignore next */ 28827function polyfillBind(fn, ctx) { 28828 function boundFn(a) { 28829 const l = arguments.length; 28830 return l 28831 ? l > 1 28832 ? fn.apply(ctx, arguments) 28833 : fn.call(ctx, a) 28834 : fn.call(ctx); 28835 } 28836 boundFn._length = fn.length; 28837 return boundFn; 28838} 28839function nativeBind(fn, ctx) { 28840 return fn.bind(ctx); 28841} 28842// @ts-expect-error bind cannot be `undefined` 28843const bind$1 = Function.prototype.bind ? nativeBind : polyfillBind; 28844/** 28845 * Convert an Array-like object to a real Array. 28846 */ 28847function toArray(list, start) { 28848 start = start || 0; 28849 let i = list.length - start; 28850 const ret = new Array(i); 28851 while (i--) { 28852 ret[i] = list[i + start]; 28853 } 28854 return ret; 28855} 28856/** 28857 * Mix properties into target object. 28858 */ 28859function extend(to, _from) { 28860 for (const key in _from) { 28861 to[key] = _from[key]; 28862 } 28863 return to; 28864} 28865/** 28866 * Merge an Array of Objects into a single Object. 28867 */ 28868function toObject(arr) { 28869 const res = {}; 28870 for (let i = 0; i < arr.length; i++) { 28871 if (arr[i]) { 28872 extend(res, arr[i]); 28873 } 28874 } 28875 return res; 28876} 28877/* eslint-disable no-unused-vars */ 28878/** 28879 * Perform no operation. 28880 * Stubbing args to make Flow happy without leaving useless transpiled code 28881 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). 28882 */ 28883function noop(a, b, c) { } 28884/** 28885 * Always return false. 28886 */ 28887const no = (a, b, c) => false; 28888/* eslint-enable no-unused-vars */ 28889/** 28890 * Return the same value. 28891 */ 28892const identity = (_) => _; 28893/** 28894 * Generate a string containing static keys from compiler modules. 28895 */ 28896function genStaticKeys$1(modules) { 28897 return modules 28898 .reduce((keys, m) => keys.concat(m.staticKeys || []), []) 28899 .join(','); 28900} 28901/** 28902 * Check if two values are loosely equal - that is, 28903 * if they are plain objects, do they have the same shape? 28904 */ 28905function looseEqual(a, b) { 28906 if (a === b) 28907 return true; 28908 const isObjectA = isObject(a); 28909 const isObjectB = isObject(b); 28910 if (isObjectA && isObjectB) { 28911 try { 28912 const isArrayA = Array.isArray(a); 28913 const isArrayB = Array.isArray(b); 28914 if (isArrayA && isArrayB) { 28915 return (a.length === b.length && 28916 a.every((e, i) => { 28917 return looseEqual(e, b[i]); 28918 })); 28919 } 28920 else if (a instanceof Date && b instanceof Date) { 28921 return a.getTime() === b.getTime(); 28922 } 28923 else if (!isArrayA && !isArrayB) { 28924 const keysA = Object.keys(a); 28925 const keysB = Object.keys(b); 28926 return (keysA.length === keysB.length && 28927 keysA.every(key => { 28928 return looseEqual(a[key], b[key]); 28929 })); 28930 } 28931 else { 28932 /* istanbul ignore next */ 28933 return false; 28934 } 28935 } 28936 catch (e) { 28937 /* istanbul ignore next */ 28938 return false; 28939 } 28940 } 28941 else if (!isObjectA && !isObjectB) { 28942 return String(a) === String(b); 28943 } 28944 else { 28945 return false; 28946 } 28947} 28948/** 28949 * Return the first index at which a loosely equal value can be 28950 * found in the array (if value is a plain object, the array must 28951 * contain an object of the same shape), or -1 if it is not present. 28952 */ 28953function looseIndexOf(arr, val) { 28954 for (let i = 0; i < arr.length; i++) { 28955 if (looseEqual(arr[i], val)) 28956 return i; 28957 } 28958 return -1; 28959} 28960/** 28961 * Ensure a function is called only once. 28962 */ 28963function once(fn) { 28964 let called = false; 28965 return function () { 28966 if (!called) { 28967 called = true; 28968 fn.apply(this, arguments); 28969 } 28970 }; 28971} 28972// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill 28973function hasChanged(x, y) { 28974 if (x === y) { 28975 return x === 0 && 1 / x !== 1 / y; 28976 } 28977 else { 28978 return x === x || y === y; 28979 } 28980} 28981 28982const SSR_ATTR = 'data-server-rendered'; 28983const ASSET_TYPES = ['component', 'directive', 'filter']; 28984const LIFECYCLE_HOOKS = [ 28985 'beforeCreate', 28986 'created', 28987 'beforeMount', 28988 'mounted', 28989 'beforeUpdate', 28990 'updated', 28991 'beforeDestroy', 28992 'destroyed', 28993 'activated', 28994 'deactivated', 28995 'errorCaptured', 28996 'serverPrefetch', 28997 'renderTracked', 28998 'renderTriggered' 28999]; 29000 29001var config = { 29002 /** 29003 * Option merge strategies (used in core/util/options) 29004 */ 29005 // $flow-disable-line 29006 optionMergeStrategies: Object.create(null), 29007 /** 29008 * Whether to suppress warnings. 29009 */ 29010 silent: false, 29011 /** 29012 * Show production mode tip message on boot? 29013 */ 29014 productionTip: true, 29015 /** 29016 * Whether to enable devtools 29017 */ 29018 devtools: true, 29019 /** 29020 * Whether to record perf 29021 */ 29022 performance: false, 29023 /** 29024 * Error handler for watcher errors 29025 */ 29026 errorHandler: null, 29027 /** 29028 * Warn handler for watcher warns 29029 */ 29030 warnHandler: null, 29031 /** 29032 * Ignore certain custom elements 29033 */ 29034 ignoredElements: [], 29035 /** 29036 * Custom user key aliases for v-on 29037 */ 29038 // $flow-disable-line 29039 keyCodes: Object.create(null), 29040 /** 29041 * Check if a tag is reserved so that it cannot be registered as a 29042 * component. This is platform-dependent and may be overwritten. 29043 */ 29044 isReservedTag: no, 29045 /** 29046 * Check if an attribute is reserved so that it cannot be used as a component 29047 * prop. This is platform-dependent and may be overwritten. 29048 */ 29049 isReservedAttr: no, 29050 /** 29051 * Check if a tag is an unknown element. 29052 * Platform-dependent. 29053 */ 29054 isUnknownElement: no, 29055 /** 29056 * Get the namespace of an element 29057 */ 29058 getTagNamespace: noop, 29059 /** 29060 * Parse the real tag name for the specific platform. 29061 */ 29062 parsePlatformTagName: identity, 29063 /** 29064 * Check if an attribute must be bound using property, e.g. value 29065 * Platform-dependent. 29066 */ 29067 mustUseProp: no, 29068 /** 29069 * Perform updates asynchronously. Intended to be used by Vue Test Utils 29070 * This will significantly reduce performance if set to false. 29071 */ 29072 async: true, 29073 /** 29074 * Exposed for legacy reasons 29075 */ 29076 _lifecycleHooks: LIFECYCLE_HOOKS 29077}; 29078 29079/** 29080 * unicode letters used for parsing html tags, component names and property paths. 29081 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname 29082 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS 29083 */ 29084const unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/; 29085/** 29086 * Check if a string starts with $ or _ 29087 */ 29088function isReserved(str) { 29089 const c = (str + '').charCodeAt(0); 29090 return c === 0x24 || c === 0x5f; 29091} 29092/** 29093 * Define a property. 29094 */ 29095function def(obj, key, val, enumerable) { 29096 Object.defineProperty(obj, key, { 29097 value: val, 29098 enumerable: !!enumerable, 29099 writable: true, 29100 configurable: true 29101 }); 29102} 29103/** 29104 * Parse simple path. 29105 */ 29106const bailRE = new RegExp(`[^${unicodeRegExp.source}.$_\\d]`); 29107function parsePath(path) { 29108 if (bailRE.test(path)) { 29109 return; 29110 } 29111 const segments = path.split('.'); 29112 return function (obj) { 29113 for (let i = 0; i < segments.length; i++) { 29114 if (!obj) 29115 return; 29116 obj = obj[segments[i]]; 29117 } 29118 return obj; 29119 }; 29120} 29121 29122// can we use __proto__? 29123const hasProto = '__proto__' in {}; 29124// Browser environment sniffing 29125const inBrowser = typeof window !== 'undefined'; 29126const UA = inBrowser && window.navigator.userAgent.toLowerCase(); 29127const isIE = UA && /msie|trident/.test(UA); 29128const isIE9 = UA && UA.indexOf('msie 9.0') > 0; 29129const isEdge = UA && UA.indexOf('edge/') > 0; 29130UA && UA.indexOf('android') > 0; 29131const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA); 29132UA && /chrome\/\d+/.test(UA) && !isEdge; 29133UA && /phantomjs/.test(UA); 29134const isFF = UA && UA.match(/firefox\/(\d+)/); 29135// Firefox has a "watch" function on Object.prototype... 29136// @ts-expect-error firebox support 29137const nativeWatch = {}.watch; 29138let supportsPassive = false; 29139if (inBrowser) { 29140 try { 29141 const opts = {}; 29142 Object.defineProperty(opts, 'passive', { 29143 get() { 29144 /* istanbul ignore next */ 29145 supportsPassive = true; 29146 } 29147 }); // https://github.com/facebook/flow/issues/285 29148 window.addEventListener('test-passive', null, opts); 29149 } 29150 catch (e) { } 29151} 29152// this needs to be lazy-evaled because vue may be required before 29153// vue-server-renderer can set VUE_ENV 29154let _isServer; 29155const isServerRendering = () => { 29156 if (_isServer === undefined) { 29157 /* istanbul ignore if */ 29158 if (!inBrowser && typeof global !== 'undefined') { 29159 // detect presence of vue-server-renderer and avoid 29160 // Webpack shimming the process 29161 _isServer = 29162 global['process'] && global['process'].env.VUE_ENV === 'server'; 29163 } 29164 else { 29165 _isServer = false; 29166 } 29167 } 29168 return _isServer; 29169}; 29170// detect devtools 29171const devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; 29172/* istanbul ignore next */ 29173function isNative(Ctor) { 29174 return typeof Ctor === 'function' && /native code/.test(Ctor.toString()); 29175} 29176const hasSymbol = typeof Symbol !== 'undefined' && 29177 isNative(Symbol) && 29178 typeof Reflect !== 'undefined' && 29179 isNative(Reflect.ownKeys); 29180let _Set; // $flow-disable-line 29181/* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) { 29182 // use native Set when available. 29183 _Set = Set; 29184} 29185else { 29186 // a non-standard Set polyfill that only works with primitive keys. 29187 _Set = class Set { 29188 constructor() { 29189 this.set = Object.create(null); 29190 } 29191 has(key) { 29192 return this.set[key] === true; 29193 } 29194 add(key) { 29195 this.set[key] = true; 29196 } 29197 clear() { 29198 this.set = Object.create(null); 29199 } 29200 }; 29201} 29202 29203let currentInstance = null; 29204/** 29205 * This is exposed for compatibility with v3 (e.g. some functions in VueUse 29206 * relies on it). Do not use this internally, just use `currentInstance`. 29207 * 29208 * @internal this function needs manual type declaration because it relies 29209 * on previously manually authored types from Vue 2 29210 */ 29211function getCurrentInstance() { 29212 return currentInstance && { proxy: currentInstance }; 29213} 29214/** 29215 * @internal 29216 */ 29217function setCurrentInstance(vm = null) { 29218 if (!vm) 29219 currentInstance && currentInstance._scope.off(); 29220 currentInstance = vm; 29221 vm && vm._scope.on(); 29222} 29223 29224/** 29225 * @internal 29226 */ 29227class VNode { 29228 constructor(tag, data, children, text, elm, context, componentOptions, asyncFactory) { 29229 this.tag = tag; 29230 this.data = data; 29231 this.children = children; 29232 this.text = text; 29233 this.elm = elm; 29234 this.ns = undefined; 29235 this.context = context; 29236 this.fnContext = undefined; 29237 this.fnOptions = undefined; 29238 this.fnScopeId = undefined; 29239 this.key = data && data.key; 29240 this.componentOptions = componentOptions; 29241 this.componentInstance = undefined; 29242 this.parent = undefined; 29243 this.raw = false; 29244 this.isStatic = false; 29245 this.isRootInsert = true; 29246 this.isComment = false; 29247 this.isCloned = false; 29248 this.isOnce = false; 29249 this.asyncFactory = asyncFactory; 29250 this.asyncMeta = undefined; 29251 this.isAsyncPlaceholder = false; 29252 } 29253 // DEPRECATED: alias for componentInstance for backwards compat. 29254 /* istanbul ignore next */ 29255 get child() { 29256 return this.componentInstance; 29257 } 29258} 29259const createEmptyVNode = (text = '') => { 29260 const node = new VNode(); 29261 node.text = text; 29262 node.isComment = true; 29263 return node; 29264}; 29265function createTextVNode(val) { 29266 return new VNode(undefined, undefined, undefined, String(val)); 29267} 29268// optimized shallow clone 29269// used for static nodes and slot nodes because they may be reused across 29270// multiple renders, cloning them avoids errors when DOM manipulations rely 29271// on their elm reference. 29272function cloneVNode(vnode) { 29273 const cloned = new VNode(vnode.tag, vnode.data, 29274 // #7975 29275 // clone children array to avoid mutating original in case of cloning 29276 // a child. 29277 vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory); 29278 cloned.ns = vnode.ns; 29279 cloned.isStatic = vnode.isStatic; 29280 cloned.key = vnode.key; 29281 cloned.isComment = vnode.isComment; 29282 cloned.fnContext = vnode.fnContext; 29283 cloned.fnOptions = vnode.fnOptions; 29284 cloned.fnScopeId = vnode.fnScopeId; 29285 cloned.asyncMeta = vnode.asyncMeta; 29286 cloned.isCloned = true; 29287 return cloned; 29288} 29289 29290/* not type checking this file because flow doesn't play well with Proxy */ 29291let initProxy; 29292{ 29293 const allowedGlobals = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' + 29294 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 29295 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' + 29296 'require' // for Webpack/Browserify 29297 ); 29298 const warnNonPresent = (target, key) => { 29299 warn$2(`Property or method "${key}" is not defined on the instance but ` + 29300 'referenced during render. Make sure that this property is reactive, ' + 29301 'either in the data option, or for class-based components, by ' + 29302 'initializing the property. ' + 29303 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target); 29304 }; 29305 const warnReservedPrefix = (target, key) => { 29306 warn$2(`Property "${key}" must be accessed with "$data.${key}" because ` + 29307 'properties starting with "$" or "_" are not proxied in the Vue instance to ' + 29308 'prevent conflicts with Vue internals. ' + 29309 'See: https://v2.vuejs.org/v2/api/#data', target); 29310 }; 29311 const hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy); 29312 if (hasProxy) { 29313 const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact'); 29314 config.keyCodes = new Proxy(config.keyCodes, { 29315 set(target, key, value) { 29316 if (isBuiltInModifier(key)) { 29317 warn$2(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`); 29318 return false; 29319 } 29320 else { 29321 target[key] = value; 29322 return true; 29323 } 29324 } 29325 }); 29326 } 29327 const hasHandler = { 29328 has(target, key) { 29329 const has = key in target; 29330 const isAllowed = allowedGlobals(key) || 29331 (typeof key === 'string' && 29332 key.charAt(0) === '_' && 29333 !(key in target.$data)); 29334 if (!has && !isAllowed) { 29335 if (key in target.$data) 29336 warnReservedPrefix(target, key); 29337 else 29338 warnNonPresent(target, key); 29339 } 29340 return has || !isAllowed; 29341 } 29342 }; 29343 const getHandler = { 29344 get(target, key) { 29345 if (typeof key === 'string' && !(key in target)) { 29346 if (key in target.$data) 29347 warnReservedPrefix(target, key); 29348 else 29349 warnNonPresent(target, key); 29350 } 29351 return target[key]; 29352 } 29353 }; 29354 initProxy = function initProxy(vm) { 29355 if (hasProxy) { 29356 // determine which proxy handler to use 29357 const options = vm.$options; 29358 const handlers = options.render && options.render._withStripped ? getHandler : hasHandler; 29359 vm._renderProxy = new Proxy(vm, handlers); 29360 } 29361 else { 29362 vm._renderProxy = vm; 29363 } 29364 }; 29365} 29366 29367let uid$2 = 0; 29368const pendingCleanupDeps = []; 29369const cleanupDeps = () => { 29370 for (let i = 0; i < pendingCleanupDeps.length; i++) { 29371 const dep = pendingCleanupDeps[i]; 29372 dep.subs = dep.subs.filter(s => s); 29373 dep._pending = false; 29374 } 29375 pendingCleanupDeps.length = 0; 29376}; 29377/** 29378 * A dep is an observable that can have multiple 29379 * directives subscribing to it. 29380 * @internal 29381 */ 29382class Dep { 29383 constructor() { 29384 // pending subs cleanup 29385 this._pending = false; 29386 this.id = uid$2++; 29387 this.subs = []; 29388 } 29389 addSub(sub) { 29390 this.subs.push(sub); 29391 } 29392 removeSub(sub) { 29393 // #12696 deps with massive amount of subscribers are extremely slow to 29394 // clean up in Chromium 29395 // to workaround this, we unset the sub for now, and clear them on 29396 // next scheduler flush. 29397 this.subs[this.subs.indexOf(sub)] = null; 29398 if (!this._pending) { 29399 this._pending = true; 29400 pendingCleanupDeps.push(this); 29401 } 29402 } 29403 depend(info) { 29404 if (Dep.target) { 29405 Dep.target.addDep(this); 29406 if (info && Dep.target.onTrack) { 29407 Dep.target.onTrack(Object.assign({ effect: Dep.target }, info)); 29408 } 29409 } 29410 } 29411 notify(info) { 29412 // stabilize the subscriber list first 29413 const subs = this.subs.filter(s => s); 29414 if (!config.async) { 29415 // subs aren't sorted in scheduler if not running async 29416 // we need to sort them now to make sure they fire in correct 29417 // order 29418 subs.sort((a, b) => a.id - b.id); 29419 } 29420 for (let i = 0, l = subs.length; i < l; i++) { 29421 const sub = subs[i]; 29422 if (info) { 29423 sub.onTrigger && 29424 sub.onTrigger(Object.assign({ effect: subs[i] }, info)); 29425 } 29426 sub.update(); 29427 } 29428 } 29429} 29430// The current target watcher being evaluated. 29431// This is globally unique because only one watcher 29432// can be evaluated at a time. 29433Dep.target = null; 29434const targetStack = []; 29435function pushTarget(target) { 29436 targetStack.push(target); 29437 Dep.target = target; 29438} 29439function popTarget() { 29440 targetStack.pop(); 29441 Dep.target = targetStack[targetStack.length - 1]; 29442} 29443 29444/* 29445 * not type checking this file because flow doesn't play well with 29446 * dynamically accessing methods on Array prototype 29447 */ 29448const arrayProto = Array.prototype; 29449const arrayMethods = Object.create(arrayProto); 29450const methodsToPatch = [ 29451 'push', 29452 'pop', 29453 'shift', 29454 'unshift', 29455 'splice', 29456 'sort', 29457 'reverse' 29458]; 29459/** 29460 * Intercept mutating methods and emit events 29461 */ 29462methodsToPatch.forEach(function (method) { 29463 // cache original method 29464 const original = arrayProto[method]; 29465 def(arrayMethods, method, function mutator(...args) { 29466 const result = original.apply(this, args); 29467 const ob = this.__ob__; 29468 let inserted; 29469 switch (method) { 29470 case 'push': 29471 case 'unshift': 29472 inserted = args; 29473 break; 29474 case 'splice': 29475 inserted = args.slice(2); 29476 break; 29477 } 29478 if (inserted) 29479 ob.observeArray(inserted); 29480 // notify change 29481 { 29482 ob.dep.notify({ 29483 type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */, 29484 target: this, 29485 key: method 29486 }); 29487 } 29488 return result; 29489 }); 29490}); 29491 29492const arrayKeys = Object.getOwnPropertyNames(arrayMethods); 29493const NO_INITIAL_VALUE = {}; 29494/** 29495 * In some cases we may want to disable observation inside a component's 29496 * update computation. 29497 */ 29498let shouldObserve = true; 29499function toggleObserving(value) { 29500 shouldObserve = value; 29501} 29502// ssr mock dep 29503const mockDep = { 29504 notify: noop, 29505 depend: noop, 29506 addSub: noop, 29507 removeSub: noop 29508}; 29509/** 29510 * Observer class that is attached to each observed 29511 * object. Once attached, the observer converts the target 29512 * object's property keys into getter/setters that 29513 * collect dependencies and dispatch updates. 29514 */ 29515class Observer { 29516 constructor(value, shallow = false, mock = false) { 29517 this.value = value; 29518 this.shallow = shallow; 29519 this.mock = mock; 29520 // this.value = value 29521 this.dep = mock ? mockDep : new Dep(); 29522 this.vmCount = 0; 29523 def(value, '__ob__', this); 29524 if (isArray(value)) { 29525 if (!mock) { 29526 if (hasProto) { 29527 value.__proto__ = arrayMethods; 29528 /* eslint-enable no-proto */ 29529 } 29530 else { 29531 for (let i = 0, l = arrayKeys.length; i < l; i++) { 29532 const key = arrayKeys[i]; 29533 def(value, key, arrayMethods[key]); 29534 } 29535 } 29536 } 29537 if (!shallow) { 29538 this.observeArray(value); 29539 } 29540 } 29541 else { 29542 /** 29543 * Walk through all properties and convert them into 29544 * getter/setters. This method should only be called when 29545 * value type is Object. 29546 */ 29547 const keys = Object.keys(value); 29548 for (let i = 0; i < keys.length; i++) { 29549 const key = keys[i]; 29550 defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock); 29551 } 29552 } 29553 } 29554 /** 29555 * Observe a list of Array items. 29556 */ 29557 observeArray(value) { 29558 for (let i = 0, l = value.length; i < l; i++) { 29559 observe(value[i], false, this.mock); 29560 } 29561 } 29562} 29563// helpers 29564/** 29565 * Attempt to create an observer instance for a value, 29566 * returns the new observer if successfully observed, 29567 * or the existing observer if the value already has one. 29568 */ 29569function observe(value, shallow, ssrMockReactivity) { 29570 if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { 29571 return value.__ob__; 29572 } 29573 if (shouldObserve && 29574 (ssrMockReactivity || !isServerRendering()) && 29575 (isArray(value) || isPlainObject(value)) && 29576 Object.isExtensible(value) && 29577 !value.__v_skip /* ReactiveFlags.SKIP */ && 29578 !isRef(value) && 29579 !(value instanceof VNode)) { 29580 return new Observer(value, shallow, ssrMockReactivity); 29581 } 29582} 29583/** 29584 * Define a reactive property on an Object. 29585 */ 29586function defineReactive(obj, key, val, customSetter, shallow, mock, observeEvenIfShallow = false) { 29587 const dep = new Dep(); 29588 const property = Object.getOwnPropertyDescriptor(obj, key); 29589 if (property && property.configurable === false) { 29590 return; 29591 } 29592 // cater for pre-defined getter/setters 29593 const getter = property && property.get; 29594 const setter = property && property.set; 29595 if ((!getter || setter) && 29596 (val === NO_INITIAL_VALUE || arguments.length === 2)) { 29597 val = obj[key]; 29598 } 29599 let childOb = shallow ? val && val.__ob__ : observe(val, false, mock); 29600 Object.defineProperty(obj, key, { 29601 enumerable: true, 29602 configurable: true, 29603 get: function reactiveGetter() { 29604 const value = getter ? getter.call(obj) : val; 29605 if (Dep.target) { 29606 { 29607 dep.depend({ 29608 target: obj, 29609 type: "get" /* TrackOpTypes.GET */, 29610 key 29611 }); 29612 } 29613 if (childOb) { 29614 childOb.dep.depend(); 29615 if (isArray(value)) { 29616 dependArray(value); 29617 } 29618 } 29619 } 29620 return isRef(value) && !shallow ? value.value : value; 29621 }, 29622 set: function reactiveSetter(newVal) { 29623 const value = getter ? getter.call(obj) : val; 29624 if (!hasChanged(value, newVal)) { 29625 return; 29626 } 29627 if (customSetter) { 29628 customSetter(); 29629 } 29630 if (setter) { 29631 setter.call(obj, newVal); 29632 } 29633 else if (getter) { 29634 // #7981: for accessor properties without setter 29635 return; 29636 } 29637 else if (!shallow && isRef(value) && !isRef(newVal)) { 29638 value.value = newVal; 29639 return; 29640 } 29641 else { 29642 val = newVal; 29643 } 29644 childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock); 29645 { 29646 dep.notify({ 29647 type: "set" /* TriggerOpTypes.SET */, 29648 target: obj, 29649 key, 29650 newValue: newVal, 29651 oldValue: value 29652 }); 29653 } 29654 } 29655 }); 29656 return dep; 29657} 29658function set(target, key, val) { 29659 if ((isUndef(target) || isPrimitive(target))) { 29660 warn$2(`Cannot set reactive property on undefined, null, or primitive value: ${target}`); 29661 } 29662 if (isReadonly(target)) { 29663 warn$2(`Set operation on key "${key}" failed: target is readonly.`); 29664 return; 29665 } 29666 const ob = target.__ob__; 29667 if (isArray(target) && isValidArrayIndex(key)) { 29668 target.length = Math.max(target.length, key); 29669 target.splice(key, 1, val); 29670 // when mocking for SSR, array methods are not hijacked 29671 if (ob && !ob.shallow && ob.mock) { 29672 observe(val, false, true); 29673 } 29674 return val; 29675 } 29676 if (key in target && !(key in Object.prototype)) { 29677 target[key] = val; 29678 return val; 29679 } 29680 if (target._isVue || (ob && ob.vmCount)) { 29681 warn$2('Avoid adding reactive properties to a Vue instance or its root $data ' + 29682 'at runtime - declare it upfront in the data option.'); 29683 return val; 29684 } 29685 if (!ob) { 29686 target[key] = val; 29687 return val; 29688 } 29689 defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock); 29690 { 29691 ob.dep.notify({ 29692 type: "add" /* TriggerOpTypes.ADD */, 29693 target: target, 29694 key, 29695 newValue: val, 29696 oldValue: undefined 29697 }); 29698 } 29699 return val; 29700} 29701function del(target, key) { 29702 if ((isUndef(target) || isPrimitive(target))) { 29703 warn$2(`Cannot delete reactive property on undefined, null, or primitive value: ${target}`); 29704 } 29705 if (isArray(target) && isValidArrayIndex(key)) { 29706 target.splice(key, 1); 29707 return; 29708 } 29709 const ob = target.__ob__; 29710 if (target._isVue || (ob && ob.vmCount)) { 29711 warn$2('Avoid deleting properties on a Vue instance or its root $data ' + 29712 '- just set it to null.'); 29713 return; 29714 } 29715 if (isReadonly(target)) { 29716 warn$2(`Delete operation on key "${key}" failed: target is readonly.`); 29717 return; 29718 } 29719 if (!hasOwn(target, key)) { 29720 return; 29721 } 29722 delete target[key]; 29723 if (!ob) { 29724 return; 29725 } 29726 { 29727 ob.dep.notify({ 29728 type: "delete" /* TriggerOpTypes.DELETE */, 29729 target: target, 29730 key 29731 }); 29732 } 29733} 29734/** 29735 * Collect dependencies on array elements when the array is touched, since 29736 * we cannot intercept array element access like property getters. 29737 */ 29738function dependArray(value) { 29739 for (let e, i = 0, l = value.length; i < l; i++) { 29740 e = value[i]; 29741 if (e && e.__ob__) { 29742 e.__ob__.dep.depend(); 29743 } 29744 if (isArray(e)) { 29745 dependArray(e); 29746 } 29747 } 29748} 29749 29750function reactive(target) { 29751 makeReactive(target, false); 29752 return target; 29753} 29754/** 29755 * Return a shallowly-reactive copy of the original object, where only the root 29756 * level properties are reactive. It also does not auto-unwrap refs (even at the 29757 * root level). 29758 */ 29759function shallowReactive(target) { 29760 makeReactive(target, true); 29761 def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true); 29762 return target; 29763} 29764function makeReactive(target, shallow) { 29765 // if trying to observe a readonly proxy, return the readonly version. 29766 if (!isReadonly(target)) { 29767 { 29768 if (isArray(target)) { 29769 warn$2(`Avoid using Array as root value for ${shallow ? `shallowReactive()` : `reactive()`} as it cannot be tracked in watch() or watchEffect(). Use ${shallow ? `shallowRef()` : `ref()`} instead. This is a Vue-2-only limitation.`); 29770 } 29771 const existingOb = target && target.__ob__; 29772 if (existingOb && existingOb.shallow !== shallow) { 29773 warn$2(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`); 29774 } 29775 } 29776 const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */); 29777 if (!ob) { 29778 if (target == null || isPrimitive(target)) { 29779 warn$2(`value cannot be made reactive: ${String(target)}`); 29780 } 29781 if (isCollectionType(target)) { 29782 warn$2(`Vue 2 does not support reactive collection types such as Map or Set.`); 29783 } 29784 } 29785 } 29786} 29787function isReactive(value) { 29788 if (isReadonly(value)) { 29789 return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]); 29790 } 29791 return !!(value && value.__ob__); 29792} 29793function isShallow(value) { 29794 return !!(value && value.__v_isShallow); 29795} 29796function isReadonly(value) { 29797 return !!(value && value.__v_isReadonly); 29798} 29799function isProxy(value) { 29800 return isReactive(value) || isReadonly(value); 29801} 29802function toRaw(observed) { 29803 const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */]; 29804 return raw ? toRaw(raw) : observed; 29805} 29806function markRaw(value) { 29807 // non-extensible objects won't be observed anyway 29808 if (Object.isExtensible(value)) { 29809 def(value, "__v_skip" /* ReactiveFlags.SKIP */, true); 29810 } 29811 return value; 29812} 29813/** 29814 * @internal 29815 */ 29816function isCollectionType(value) { 29817 const type = toRawType(value); 29818 return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet'); 29819} 29820 29821/** 29822 * @internal 29823 */ 29824const RefFlag = `__v_isRef`; 29825function isRef(r) { 29826 return !!(r && r.__v_isRef === true); 29827} 29828function ref$1(value) { 29829 return createRef(value, false); 29830} 29831function shallowRef(value) { 29832 return createRef(value, true); 29833} 29834function createRef(rawValue, shallow) { 29835 if (isRef(rawValue)) { 29836 return rawValue; 29837 } 29838 const ref = {}; 29839 def(ref, RefFlag, true); 29840 def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow); 29841 def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering())); 29842 return ref; 29843} 29844function triggerRef(ref) { 29845 if (!ref.dep) { 29846 warn$2(`received object is not a triggerable ref.`); 29847 } 29848 { 29849 ref.dep && 29850 ref.dep.notify({ 29851 type: "set" /* TriggerOpTypes.SET */, 29852 target: ref, 29853 key: 'value' 29854 }); 29855 } 29856} 29857function unref(ref) { 29858 return isRef(ref) ? ref.value : ref; 29859} 29860function proxyRefs(objectWithRefs) { 29861 if (isReactive(objectWithRefs)) { 29862 return objectWithRefs; 29863 } 29864 const proxy = {}; 29865 const keys = Object.keys(objectWithRefs); 29866 for (let i = 0; i < keys.length; i++) { 29867 proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]); 29868 } 29869 return proxy; 29870} 29871function proxyWithRefUnwrap(target, source, key) { 29872 Object.defineProperty(target, key, { 29873 enumerable: true, 29874 configurable: true, 29875 get: () => { 29876 const val = source[key]; 29877 if (isRef(val)) { 29878 return val.value; 29879 } 29880 else { 29881 const ob = val && val.__ob__; 29882 if (ob) 29883 ob.dep.depend(); 29884 return val; 29885 } 29886 }, 29887 set: value => { 29888 const oldValue = source[key]; 29889 if (isRef(oldValue) && !isRef(value)) { 29890 oldValue.value = value; 29891 } 29892 else { 29893 source[key] = value; 29894 } 29895 } 29896 }); 29897} 29898function customRef(factory) { 29899 const dep = new Dep(); 29900 const { get, set } = factory(() => { 29901 { 29902 dep.depend({ 29903 target: ref, 29904 type: "get" /* TrackOpTypes.GET */, 29905 key: 'value' 29906 }); 29907 } 29908 }, () => { 29909 { 29910 dep.notify({ 29911 target: ref, 29912 type: "set" /* TriggerOpTypes.SET */, 29913 key: 'value' 29914 }); 29915 } 29916 }); 29917 const ref = { 29918 get value() { 29919 return get(); 29920 }, 29921 set value(newVal) { 29922 set(newVal); 29923 } 29924 }; 29925 def(ref, RefFlag, true); 29926 return ref; 29927} 29928function toRefs(object) { 29929 if (!isReactive(object)) { 29930 warn$2(`toRefs() expects a reactive object but received a plain one.`); 29931 } 29932 const ret = isArray(object) ? new Array(object.length) : {}; 29933 for (const key in object) { 29934 ret[key] = toRef(object, key); 29935 } 29936 return ret; 29937} 29938function toRef(object, key, defaultValue) { 29939 const val = object[key]; 29940 if (isRef(val)) { 29941 return val; 29942 } 29943 const ref = { 29944 get value() { 29945 const val = object[key]; 29946 return val === undefined ? defaultValue : val; 29947 }, 29948 set value(newVal) { 29949 object[key] = newVal; 29950 } 29951 }; 29952 def(ref, RefFlag, true); 29953 return ref; 29954} 29955 29956const rawToReadonlyFlag = `__v_rawToReadonly`; 29957const rawToShallowReadonlyFlag = `__v_rawToShallowReadonly`; 29958function readonly(target) { 29959 return createReadonly(target, false); 29960} 29961function createReadonly(target, shallow) { 29962 if (!isPlainObject(target)) { 29963 { 29964 if (isArray(target)) { 29965 warn$2(`Vue 2 does not support readonly arrays.`); 29966 } 29967 else if (isCollectionType(target)) { 29968 warn$2(`Vue 2 does not support readonly collection types such as Map or Set.`); 29969 } 29970 else { 29971 warn$2(`value cannot be made readonly: ${typeof target}`); 29972 } 29973 } 29974 return target; 29975 } 29976 if (!Object.isExtensible(target)) { 29977 warn$2(`Vue 2 does not support creating readonly proxy for non-extensible object.`); 29978 } 29979 // already a readonly object 29980 if (isReadonly(target)) { 29981 return target; 29982 } 29983 // already has a readonly proxy 29984 const existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag; 29985 const existingProxy = target[existingFlag]; 29986 if (existingProxy) { 29987 return existingProxy; 29988 } 29989 const proxy = Object.create(Object.getPrototypeOf(target)); 29990 def(target, existingFlag, proxy); 29991 def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true); 29992 def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target); 29993 if (isRef(target)) { 29994 def(proxy, RefFlag, true); 29995 } 29996 if (shallow || isShallow(target)) { 29997 def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true); 29998 } 29999 const keys = Object.keys(target); 30000 for (let i = 0; i < keys.length; i++) { 30001 defineReadonlyProperty(proxy, target, keys[i], shallow); 30002 } 30003 return proxy; 30004} 30005function defineReadonlyProperty(proxy, target, key, shallow) { 30006 Object.defineProperty(proxy, key, { 30007 enumerable: true, 30008 configurable: true, 30009 get() { 30010 const val = target[key]; 30011 return shallow || !isPlainObject(val) ? val : readonly(val); 30012 }, 30013 set() { 30014 warn$2(`Set operation on key "${key}" failed: target is readonly.`); 30015 } 30016 }); 30017} 30018/** 30019 * Returns a reactive-copy of the original object, where only the root level 30020 * properties are readonly, and does NOT unwrap refs nor recursively convert 30021 * returned properties. 30022 * This is used for creating the props proxy object for stateful components. 30023 */ 30024function shallowReadonly(target) { 30025 return createReadonly(target, true); 30026} 30027 30028function computed(getterOrOptions, debugOptions) { 30029 let getter; 30030 let setter; 30031 const onlyGetter = isFunction(getterOrOptions); 30032 if (onlyGetter) { 30033 getter = getterOrOptions; 30034 setter = () => { 30035 warn$2('Write operation failed: computed value is readonly'); 30036 } 30037 ; 30038 } 30039 else { 30040 getter = getterOrOptions.get; 30041 setter = getterOrOptions.set; 30042 } 30043 const watcher = isServerRendering() 30044 ? null 30045 : new Watcher(currentInstance, getter, noop, { lazy: true }); 30046 if (watcher && debugOptions) { 30047 watcher.onTrack = debugOptions.onTrack; 30048 watcher.onTrigger = debugOptions.onTrigger; 30049 } 30050 const ref = { 30051 // some libs rely on the presence effect for checking computed refs 30052 // from normal refs, but the implementation doesn't matter 30053 effect: watcher, 30054 get value() { 30055 if (watcher) { 30056 if (watcher.dirty) { 30057 watcher.evaluate(); 30058 } 30059 if (Dep.target) { 30060 if (Dep.target.onTrack) { 30061 Dep.target.onTrack({ 30062 effect: Dep.target, 30063 target: ref, 30064 type: "get" /* TrackOpTypes.GET */, 30065 key: 'value' 30066 }); 30067 } 30068 watcher.depend(); 30069 } 30070 return watcher.value; 30071 } 30072 else { 30073 return getter(); 30074 } 30075 }, 30076 set value(newVal) { 30077 setter(newVal); 30078 } 30079 }; 30080 def(ref, RefFlag, true); 30081 def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter); 30082 return ref; 30083} 30084 30085let mark; 30086let measure; 30087{ 30088 const perf = inBrowser && window.performance; 30089 /* istanbul ignore if */ 30090 if (perf && 30091 // @ts-ignore 30092 perf.mark && 30093 // @ts-ignore 30094 perf.measure && 30095 // @ts-ignore 30096 perf.clearMarks && 30097 // @ts-ignore 30098 perf.clearMeasures) { 30099 mark = tag => perf.mark(tag); 30100 measure = (name, startTag, endTag) => { 30101 perf.measure(name, startTag, endTag); 30102 perf.clearMarks(startTag); 30103 perf.clearMarks(endTag); 30104 // perf.clearMeasures(name) 30105 }; 30106 } 30107} 30108 30109const normalizeEvent = cached((name) => { 30110 const passive = name.charAt(0) === '&'; 30111 name = passive ? name.slice(1) : name; 30112 const once = name.charAt(0) === '~'; // Prefixed last, checked first 30113 name = once ? name.slice(1) : name; 30114 const capture = name.charAt(0) === '!'; 30115 name = capture ? name.slice(1) : name; 30116 return { 30117 name, 30118 once, 30119 capture, 30120 passive 30121 }; 30122}); 30123function createFnInvoker(fns, vm) { 30124 function invoker() { 30125 const fns = invoker.fns; 30126 if (isArray(fns)) { 30127 const cloned = fns.slice(); 30128 for (let i = 0; i < cloned.length; i++) { 30129 invokeWithErrorHandling(cloned[i], null, arguments, vm, `v-on handler`); 30130 } 30131 } 30132 else { 30133 // return handler return value for single handlers 30134 return invokeWithErrorHandling(fns, null, arguments, vm, `v-on handler`); 30135 } 30136 } 30137 invoker.fns = fns; 30138 return invoker; 30139} 30140function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) { 30141 let name, cur, old, event; 30142 for (name in on) { 30143 cur = on[name]; 30144 old = oldOn[name]; 30145 event = normalizeEvent(name); 30146 if (isUndef(cur)) { 30147 warn$2(`Invalid handler for event "${event.name}": got ` + String(cur), vm); 30148 } 30149 else if (isUndef(old)) { 30150 if (isUndef(cur.fns)) { 30151 cur = on[name] = createFnInvoker(cur, vm); 30152 } 30153 if (isTrue(event.once)) { 30154 cur = on[name] = createOnceHandler(event.name, cur, event.capture); 30155 } 30156 add(event.name, cur, event.capture, event.passive, event.params); 30157 } 30158 else if (cur !== old) { 30159 old.fns = cur; 30160 on[name] = old; 30161 } 30162 } 30163 for (name in oldOn) { 30164 if (isUndef(on[name])) { 30165 event = normalizeEvent(name); 30166 remove(event.name, oldOn[name], event.capture); 30167 } 30168 } 30169} 30170 30171function mergeVNodeHook(def, hookKey, hook) { 30172 if (def instanceof VNode) { 30173 def = def.data.hook || (def.data.hook = {}); 30174 } 30175 let invoker; 30176 const oldHook = def[hookKey]; 30177 function wrappedHook() { 30178 hook.apply(this, arguments); 30179 // important: remove merged hook to ensure it's called only once 30180 // and prevent memory leak 30181 remove$2(invoker.fns, wrappedHook); 30182 } 30183 if (isUndef(oldHook)) { 30184 // no existing hook 30185 invoker = createFnInvoker([wrappedHook]); 30186 } 30187 else { 30188 /* istanbul ignore if */ 30189 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { 30190 // already a merged invoker 30191 invoker = oldHook; 30192 invoker.fns.push(wrappedHook); 30193 } 30194 else { 30195 // existing plain hook 30196 invoker = createFnInvoker([oldHook, wrappedHook]); 30197 } 30198 } 30199 invoker.merged = true; 30200 def[hookKey] = invoker; 30201} 30202 30203function extractPropsFromVNodeData(data, Ctor, tag) { 30204 // we are only extracting raw values here. 30205 // validation and default values are handled in the child 30206 // component itself. 30207 const propOptions = Ctor.options.props; 30208 if (isUndef(propOptions)) { 30209 return; 30210 } 30211 const res = {}; 30212 const { attrs, props } = data; 30213 if (isDef(attrs) || isDef(props)) { 30214 for (const key in propOptions) { 30215 const altKey = hyphenate(key); 30216 { 30217 const keyInLowerCase = key.toLowerCase(); 30218 if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) { 30219 tip(`Prop "${keyInLowerCase}" is passed to component ` + 30220 `${formatComponentName( 30221 // @ts-expect-error tag is string 30222 tag || Ctor)}, but the declared prop name is` + 30223 ` "${key}". ` + 30224 `Note that HTML attributes are case-insensitive and camelCased ` + 30225 `props need to use their kebab-case equivalents when using in-DOM ` + 30226 `templates. You should probably use "${altKey}" instead of "${key}".`); 30227 } 30228 } 30229 checkProp(res, props, key, altKey, true) || 30230 checkProp(res, attrs, key, altKey, false); 30231 } 30232 } 30233 return res; 30234} 30235function checkProp(res, hash, key, altKey, preserve) { 30236 if (isDef(hash)) { 30237 if (hasOwn(hash, key)) { 30238 res[key] = hash[key]; 30239 if (!preserve) { 30240 delete hash[key]; 30241 } 30242 return true; 30243 } 30244 else if (hasOwn(hash, altKey)) { 30245 res[key] = hash[altKey]; 30246 if (!preserve) { 30247 delete hash[altKey]; 30248 } 30249 return true; 30250 } 30251 } 30252 return false; 30253} 30254 30255// The template compiler attempts to minimize the need for normalization by 30256// statically analyzing the template at compile time. 30257// 30258// For plain HTML markup, normalization can be completely skipped because the 30259// generated render function is guaranteed to return Array<VNode>. There are 30260// two cases where extra normalization is needed: 30261// 1. When the children contains components - because a functional component 30262// may return an Array instead of a single root. In this case, just a simple 30263// normalization is needed - if any child is an Array, we flatten the whole 30264// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep 30265// because functional components already normalize their own children. 30266function simpleNormalizeChildren(children) { 30267 for (let i = 0; i < children.length; i++) { 30268 if (isArray(children[i])) { 30269 return Array.prototype.concat.apply([], children); 30270 } 30271 } 30272 return children; 30273} 30274// 2. When the children contains constructs that always generated nested Arrays, 30275// e.g. <template>, <slot>, v-for, or when the children is provided by user 30276// with hand-written render functions / JSX. In such cases a full normalization 30277// is needed to cater to all possible types of children values. 30278function normalizeChildren(children) { 30279 return isPrimitive(children) 30280 ? [createTextVNode(children)] 30281 : isArray(children) 30282 ? normalizeArrayChildren(children) 30283 : undefined; 30284} 30285function isTextNode(node) { 30286 return isDef(node) && isDef(node.text) && isFalse(node.isComment); 30287} 30288function normalizeArrayChildren(children, nestedIndex) { 30289 const res = []; 30290 let i, c, lastIndex, last; 30291 for (i = 0; i < children.length; i++) { 30292 c = children[i]; 30293 if (isUndef(c) || typeof c === 'boolean') 30294 continue; 30295 lastIndex = res.length - 1; 30296 last = res[lastIndex]; 30297 // nested 30298 if (isArray(c)) { 30299 if (c.length > 0) { 30300 c = normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`); 30301 // merge adjacent text nodes 30302 if (isTextNode(c[0]) && isTextNode(last)) { 30303 res[lastIndex] = createTextVNode(last.text + c[0].text); 30304 c.shift(); 30305 } 30306 res.push.apply(res, c); 30307 } 30308 } 30309 else if (isPrimitive(c)) { 30310 if (isTextNode(last)) { 30311 // merge adjacent text nodes 30312 // this is necessary for SSR hydration because text nodes are 30313 // essentially merged when rendered to HTML strings 30314 res[lastIndex] = createTextVNode(last.text + c); 30315 } 30316 else if (c !== '') { 30317 // convert primitive to vnode 30318 res.push(createTextVNode(c)); 30319 } 30320 } 30321 else { 30322 if (isTextNode(c) && isTextNode(last)) { 30323 // merge adjacent text nodes 30324 res[lastIndex] = createTextVNode(last.text + c.text); 30325 } 30326 else { 30327 // default key for nested array children (likely generated by v-for) 30328 if (isTrue(children._isVList) && 30329 isDef(c.tag) && 30330 isUndef(c.key) && 30331 isDef(nestedIndex)) { 30332 c.key = `__vlist${nestedIndex}_${i}__`; 30333 } 30334 res.push(c); 30335 } 30336 } 30337 } 30338 return res; 30339} 30340 30341const SIMPLE_NORMALIZE = 1; 30342const ALWAYS_NORMALIZE = 2; 30343// wrapper function for providing a more flexible interface 30344// without getting yelled at by flow 30345function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) { 30346 if (isArray(data) || isPrimitive(data)) { 30347 normalizationType = children; 30348 children = data; 30349 data = undefined; 30350 } 30351 if (isTrue(alwaysNormalize)) { 30352 normalizationType = ALWAYS_NORMALIZE; 30353 } 30354 return _createElement(context, tag, data, children, normalizationType); 30355} 30356function _createElement(context, tag, data, children, normalizationType) { 30357 if (isDef(data) && isDef(data.__ob__)) { 30358 warn$2(`Avoid using observed data object as vnode data: ${JSON.stringify(data)}\n` + 'Always create fresh vnode data objects in each render!', context); 30359 return createEmptyVNode(); 30360 } 30361 // object syntax in v-bind 30362 if (isDef(data) && isDef(data.is)) { 30363 tag = data.is; 30364 } 30365 if (!tag) { 30366 // in case of component :is set to falsy value 30367 return createEmptyVNode(); 30368 } 30369 // warn against non-primitive key 30370 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)) { 30371 warn$2('Avoid using non-primitive value as key, ' + 30372 'use string/number value instead.', context); 30373 } 30374 // support single function children as default scoped slot 30375 if (isArray(children) && isFunction(children[0])) { 30376 data = data || {}; 30377 data.scopedSlots = { default: children[0] }; 30378 children.length = 0; 30379 } 30380 if (normalizationType === ALWAYS_NORMALIZE) { 30381 children = normalizeChildren(children); 30382 } 30383 else if (normalizationType === SIMPLE_NORMALIZE) { 30384 children = simpleNormalizeChildren(children); 30385 } 30386 let vnode, ns; 30387 if (typeof tag === 'string') { 30388 let Ctor; 30389 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); 30390 if (config.isReservedTag(tag)) { 30391 // platform built-in elements 30392 if (isDef(data) && 30393 isDef(data.nativeOn) && 30394 data.tag !== 'component') { 30395 warn$2(`The .native modifier for v-on is only valid on components but it was used on <${tag}>.`, context); 30396 } 30397 vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context); 30398 } 30399 else if ((!data || !data.pre) && 30400 isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) { 30401 // component 30402 vnode = createComponent(Ctor, data, context, children, tag); 30403 } 30404 else { 30405 // unknown or unlisted namespaced elements 30406 // check at runtime because it may get assigned a namespace when its 30407 // parent normalizes children 30408 vnode = new VNode(tag, data, children, undefined, undefined, context); 30409 } 30410 } 30411 else { 30412 // direct component options / constructor 30413 vnode = createComponent(tag, data, context, children); 30414 } 30415 if (isArray(vnode)) { 30416 return vnode; 30417 } 30418 else if (isDef(vnode)) { 30419 if (isDef(ns)) 30420 applyNS(vnode, ns); 30421 if (isDef(data)) 30422 registerDeepBindings(data); 30423 return vnode; 30424 } 30425 else { 30426 return createEmptyVNode(); 30427 } 30428} 30429function applyNS(vnode, ns, force) { 30430 vnode.ns = ns; 30431 if (vnode.tag === 'foreignObject') { 30432 // use default namespace inside foreignObject 30433 ns = undefined; 30434 force = true; 30435 } 30436 if (isDef(vnode.children)) { 30437 for (let i = 0, l = vnode.children.length; i < l; i++) { 30438 const child = vnode.children[i]; 30439 if (isDef(child.tag) && 30440 (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { 30441 applyNS(child, ns, force); 30442 } 30443 } 30444 } 30445} 30446// ref #5318 30447// necessary to ensure parent re-render when deep bindings like :style and 30448// :class are used on slot nodes 30449function registerDeepBindings(data) { 30450 if (isObject(data.style)) { 30451 traverse(data.style); 30452 } 30453 if (isObject(data.class)) { 30454 traverse(data.class); 30455 } 30456} 30457 30458/** 30459 * Runtime helper for rendering v-for lists. 30460 */ 30461function renderList(val, render) { 30462 let ret = null, i, l, keys, key; 30463 if (isArray(val) || typeof val === 'string') { 30464 ret = new Array(val.length); 30465 for (i = 0, l = val.length; i < l; i++) { 30466 ret[i] = render(val[i], i); 30467 } 30468 } 30469 else if (typeof val === 'number') { 30470 ret = new Array(val); 30471 for (i = 0; i < val; i++) { 30472 ret[i] = render(i + 1, i); 30473 } 30474 } 30475 else if (isObject(val)) { 30476 if (hasSymbol && val[Symbol.iterator]) { 30477 ret = []; 30478 const iterator = val[Symbol.iterator](); 30479 let result = iterator.next(); 30480 while (!result.done) { 30481 ret.push(render(result.value, ret.length)); 30482 result = iterator.next(); 30483 } 30484 } 30485 else { 30486 keys = Object.keys(val); 30487 ret = new Array(keys.length); 30488 for (i = 0, l = keys.length; i < l; i++) { 30489 key = keys[i]; 30490 ret[i] = render(val[key], key, i); 30491 } 30492 } 30493 } 30494 if (!isDef(ret)) { 30495 ret = []; 30496 } 30497 ret._isVList = true; 30498 return ret; 30499} 30500 30501/** 30502 * Runtime helper for rendering <slot> 30503 */ 30504function renderSlot(name, fallbackRender, props, bindObject) { 30505 const scopedSlotFn = this.$scopedSlots[name]; 30506 let nodes; 30507 if (scopedSlotFn) { 30508 // scoped slot 30509 props = props || {}; 30510 if (bindObject) { 30511 if (!isObject(bindObject)) { 30512 warn$2('slot v-bind without argument expects an Object', this); 30513 } 30514 props = extend(extend({}, bindObject), props); 30515 } 30516 nodes = 30517 scopedSlotFn(props) || 30518 (isFunction(fallbackRender) ? fallbackRender() : fallbackRender); 30519 } 30520 else { 30521 nodes = 30522 this.$slots[name] || 30523 (isFunction(fallbackRender) ? fallbackRender() : fallbackRender); 30524 } 30525 const target = props && props.slot; 30526 if (target) { 30527 return this.$createElement('template', { slot: target }, nodes); 30528 } 30529 else { 30530 return nodes; 30531 } 30532} 30533 30534/** 30535 * Runtime helper for resolving filters 30536 */ 30537function resolveFilter(id) { 30538 return resolveAsset(this.$options, 'filters', id, true) || identity; 30539} 30540 30541function isKeyNotMatch(expect, actual) { 30542 if (isArray(expect)) { 30543 return expect.indexOf(actual) === -1; 30544 } 30545 else { 30546 return expect !== actual; 30547 } 30548} 30549/** 30550 * Runtime helper for checking keyCodes from config. 30551 * exposed as Vue.prototype._k 30552 * passing in eventKeyName as last argument separately for backwards compat 30553 */ 30554function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) { 30555 const mappedKeyCode = config.keyCodes[key] || builtInKeyCode; 30556 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { 30557 return isKeyNotMatch(builtInKeyName, eventKeyName); 30558 } 30559 else if (mappedKeyCode) { 30560 return isKeyNotMatch(mappedKeyCode, eventKeyCode); 30561 } 30562 else if (eventKeyName) { 30563 return hyphenate(eventKeyName) !== key; 30564 } 30565 return eventKeyCode === undefined; 30566} 30567 30568/** 30569 * Runtime helper for merging v-bind="object" into a VNode's data. 30570 */ 30571function bindObjectProps(data, tag, value, asProp, isSync) { 30572 if (value) { 30573 if (!isObject(value)) { 30574 warn$2('v-bind without argument expects an Object or Array value', this); 30575 } 30576 else { 30577 if (isArray(value)) { 30578 value = toObject(value); 30579 } 30580 let hash; 30581 for (const key in value) { 30582 if (key === 'class' || key === 'style' || isReservedAttribute(key)) { 30583 hash = data; 30584 } 30585 else { 30586 const type = data.attrs && data.attrs.type; 30587 hash = 30588 asProp || config.mustUseProp(tag, type, key) 30589 ? data.domProps || (data.domProps = {}) 30590 : data.attrs || (data.attrs = {}); 30591 } 30592 const camelizedKey = camelize(key); 30593 const hyphenatedKey = hyphenate(key); 30594 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) { 30595 hash[key] = value[key]; 30596 if (isSync) { 30597 const on = data.on || (data.on = {}); 30598 on[`update:${key}`] = function ($event) { 30599 value[key] = $event; 30600 }; 30601 } 30602 } 30603 } 30604 } 30605 } 30606 return data; 30607} 30608 30609/** 30610 * Runtime helper for rendering static trees. 30611 */ 30612function renderStatic(index, isInFor) { 30613 const cached = this._staticTrees || (this._staticTrees = []); 30614 let tree = cached[index]; 30615 // if has already-rendered static tree and not inside v-for, 30616 // we can reuse the same tree. 30617 if (tree && !isInFor) { 30618 return tree; 30619 } 30620 // otherwise, render a fresh tree. 30621 tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates 30622 ); 30623 markStatic$1(tree, `__static__${index}`, false); 30624 return tree; 30625} 30626/** 30627 * Runtime helper for v-once. 30628 * Effectively it means marking the node as static with a unique key. 30629 */ 30630function markOnce(tree, index, key) { 30631 markStatic$1(tree, `__once__${index}${key ? `_${key}` : ``}`, true); 30632 return tree; 30633} 30634function markStatic$1(tree, key, isOnce) { 30635 if (isArray(tree)) { 30636 for (let i = 0; i < tree.length; i++) { 30637 if (tree[i] && typeof tree[i] !== 'string') { 30638 markStaticNode(tree[i], `${key}_${i}`, isOnce); 30639 } 30640 } 30641 } 30642 else { 30643 markStaticNode(tree, key, isOnce); 30644 } 30645} 30646function markStaticNode(node, key, isOnce) { 30647 node.isStatic = true; 30648 node.key = key; 30649 node.isOnce = isOnce; 30650} 30651 30652function bindObjectListeners(data, value) { 30653 if (value) { 30654 if (!isPlainObject(value)) { 30655 warn$2('v-on without argument expects an Object value', this); 30656 } 30657 else { 30658 const on = (data.on = data.on ? extend({}, data.on) : {}); 30659 for (const key in value) { 30660 const existing = on[key]; 30661 const ours = value[key]; 30662 on[key] = existing ? [].concat(existing, ours) : ours; 30663 } 30664 } 30665 } 30666 return data; 30667} 30668 30669function resolveScopedSlots(fns, res, 30670// the following are added in 2.6 30671hasDynamicKeys, contentHashKey) { 30672 res = res || { $stable: !hasDynamicKeys }; 30673 for (let i = 0; i < fns.length; i++) { 30674 const slot = fns[i]; 30675 if (isArray(slot)) { 30676 resolveScopedSlots(slot, res, hasDynamicKeys); 30677 } 30678 else if (slot) { 30679 // marker for reverse proxying v-slot without scope on this.$slots 30680 // @ts-expect-error 30681 if (slot.proxy) { 30682 // @ts-expect-error 30683 slot.fn.proxy = true; 30684 } 30685 res[slot.key] = slot.fn; 30686 } 30687 } 30688 if (contentHashKey) { 30689 res.$key = contentHashKey; 30690 } 30691 return res; 30692} 30693 30694// helper to process dynamic keys for dynamic arguments in v-bind and v-on. 30695function bindDynamicKeys(baseObj, values) { 30696 for (let i = 0; i < values.length; i += 2) { 30697 const key = values[i]; 30698 if (typeof key === 'string' && key) { 30699 baseObj[values[i]] = values[i + 1]; 30700 } 30701 else if (key !== '' && key !== null) { 30702 // null is a special value for explicitly removing a binding 30703 warn$2(`Invalid value for dynamic directive argument (expected string or null): ${key}`, this); 30704 } 30705 } 30706 return baseObj; 30707} 30708// helper to dynamically append modifier runtime markers to event names. 30709// ensure only append when value is already string, otherwise it will be cast 30710// to string and cause the type check to miss. 30711function prependModifier(value, symbol) { 30712 return typeof value === 'string' ? symbol + value : value; 30713} 30714 30715function installRenderHelpers(target) { 30716 target._o = markOnce; 30717 target._n = toNumber; 30718 target._s = toString; 30719 target._l = renderList; 30720 target._t = renderSlot; 30721 target._q = looseEqual; 30722 target._i = looseIndexOf; 30723 target._m = renderStatic; 30724 target._f = resolveFilter; 30725 target._k = checkKeyCodes; 30726 target._b = bindObjectProps; 30727 target._v = createTextVNode; 30728 target._e = createEmptyVNode; 30729 target._u = resolveScopedSlots; 30730 target._g = bindObjectListeners; 30731 target._d = bindDynamicKeys; 30732 target._p = prependModifier; 30733} 30734 30735/** 30736 * Runtime helper for resolving raw children VNodes into a slot object. 30737 */ 30738function resolveSlots(children, context) { 30739 if (!children || !children.length) { 30740 return {}; 30741 } 30742 const slots = {}; 30743 for (let i = 0, l = children.length; i < l; i++) { 30744 const child = children[i]; 30745 const data = child.data; 30746 // remove slot attribute if the node is resolved as a Vue slot node 30747 if (data && data.attrs && data.attrs.slot) { 30748 delete data.attrs.slot; 30749 } 30750 // named slots should only be respected if the vnode was rendered in the 30751 // same context. 30752 if ((child.context === context || child.fnContext === context) && 30753 data && 30754 data.slot != null) { 30755 const name = data.slot; 30756 const slot = slots[name] || (slots[name] = []); 30757 if (child.tag === 'template') { 30758 slot.push.apply(slot, child.children || []); 30759 } 30760 else { 30761 slot.push(child); 30762 } 30763 } 30764 else { 30765 (slots.default || (slots.default = [])).push(child); 30766 } 30767 } 30768 // ignore slots that contains only whitespace 30769 for (const name in slots) { 30770 if (slots[name].every(isWhitespace)) { 30771 delete slots[name]; 30772 } 30773 } 30774 return slots; 30775} 30776function isWhitespace(node) { 30777 return (node.isComment && !node.asyncFactory) || node.text === ' '; 30778} 30779 30780function isAsyncPlaceholder(node) { 30781 // @ts-expect-error not really boolean type 30782 return node.isComment && node.asyncFactory; 30783} 30784 30785function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) { 30786 let res; 30787 const hasNormalSlots = Object.keys(normalSlots).length > 0; 30788 const isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots; 30789 const key = scopedSlots && scopedSlots.$key; 30790 if (!scopedSlots) { 30791 res = {}; 30792 } 30793 else if (scopedSlots._normalized) { 30794 // fast path 1: child component re-render only, parent did not change 30795 return scopedSlots._normalized; 30796 } 30797 else if (isStable && 30798 prevScopedSlots && 30799 prevScopedSlots !== emptyObject && 30800 key === prevScopedSlots.$key && 30801 !hasNormalSlots && 30802 !prevScopedSlots.$hasNormal) { 30803 // fast path 2: stable scoped slots w/ no normal slots to proxy, 30804 // only need to normalize once 30805 return prevScopedSlots; 30806 } 30807 else { 30808 res = {}; 30809 for (const key in scopedSlots) { 30810 if (scopedSlots[key] && key[0] !== '$') { 30811 res[key] = normalizeScopedSlot(ownerVm, normalSlots, key, scopedSlots[key]); 30812 } 30813 } 30814 } 30815 // expose normal slots on scopedSlots 30816 for (const key in normalSlots) { 30817 if (!(key in res)) { 30818 res[key] = proxyNormalSlot(normalSlots, key); 30819 } 30820 } 30821 // avoriaz seems to mock a non-extensible $scopedSlots object 30822 // and when that is passed down this would cause an error 30823 if (scopedSlots && Object.isExtensible(scopedSlots)) { 30824 scopedSlots._normalized = res; 30825 } 30826 def(res, '$stable', isStable); 30827 def(res, '$key', key); 30828 def(res, '$hasNormal', hasNormalSlots); 30829 return res; 30830} 30831function normalizeScopedSlot(vm, normalSlots, key, fn) { 30832 const normalized = function () { 30833 const cur = currentInstance; 30834 setCurrentInstance(vm); 30835 let res = arguments.length ? fn.apply(null, arguments) : fn({}); 30836 res = 30837 res && typeof res === 'object' && !isArray(res) 30838 ? [res] // single vnode 30839 : normalizeChildren(res); 30840 const vnode = res && res[0]; 30841 setCurrentInstance(cur); 30842 return res && 30843 (!vnode || 30844 (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391 30845 ? undefined 30846 : res; 30847 }; 30848 // this is a slot using the new v-slot syntax without scope. although it is 30849 // compiled as a scoped slot, render fn users would expect it to be present 30850 // on this.$slots because the usage is semantically a normal slot. 30851 if (fn.proxy) { 30852 Object.defineProperty(normalSlots, key, { 30853 get: normalized, 30854 enumerable: true, 30855 configurable: true 30856 }); 30857 } 30858 return normalized; 30859} 30860function proxyNormalSlot(slots, key) { 30861 return () => slots[key]; 30862} 30863 30864function initSetup(vm) { 30865 const options = vm.$options; 30866 const setup = options.setup; 30867 if (setup) { 30868 const ctx = (vm._setupContext = createSetupContext(vm)); 30869 setCurrentInstance(vm); 30870 pushTarget(); 30871 const setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, `setup`); 30872 popTarget(); 30873 setCurrentInstance(); 30874 if (isFunction(setupResult)) { 30875 // render function 30876 // @ts-ignore 30877 options.render = setupResult; 30878 } 30879 else if (isObject(setupResult)) { 30880 // bindings 30881 if (setupResult instanceof VNode) { 30882 warn$2(`setup() should not return VNodes directly - ` + 30883 `return a render function instead.`); 30884 } 30885 vm._setupState = setupResult; 30886 // __sfc indicates compiled bindings from <script setup> 30887 if (!setupResult.__sfc) { 30888 for (const key in setupResult) { 30889 if (!isReserved(key)) { 30890 proxyWithRefUnwrap(vm, setupResult, key); 30891 } 30892 else { 30893 warn$2(`Avoid using variables that start with _ or $ in setup().`); 30894 } 30895 } 30896 } 30897 else { 30898 // exposed for compiled render fn 30899 const proxy = (vm._setupProxy = {}); 30900 for (const key in setupResult) { 30901 if (key !== '__sfc') { 30902 proxyWithRefUnwrap(proxy, setupResult, key); 30903 } 30904 } 30905 } 30906 } 30907 else if (setupResult !== undefined) { 30908 warn$2(`setup() should return an object. Received: ${setupResult === null ? 'null' : typeof setupResult}`); 30909 } 30910 } 30911} 30912function createSetupContext(vm) { 30913 let exposeCalled = false; 30914 return { 30915 get attrs() { 30916 if (!vm._attrsProxy) { 30917 const proxy = (vm._attrsProxy = {}); 30918 def(proxy, '_v_attr_proxy', true); 30919 syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs'); 30920 } 30921 return vm._attrsProxy; 30922 }, 30923 get listeners() { 30924 if (!vm._listenersProxy) { 30925 const proxy = (vm._listenersProxy = {}); 30926 syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners'); 30927 } 30928 return vm._listenersProxy; 30929 }, 30930 get slots() { 30931 return initSlotsProxy(vm); 30932 }, 30933 emit: bind$1(vm.$emit, vm), 30934 expose(exposed) { 30935 { 30936 if (exposeCalled) { 30937 warn$2(`expose() should be called only once per setup().`, vm); 30938 } 30939 exposeCalled = true; 30940 } 30941 if (exposed) { 30942 Object.keys(exposed).forEach(key => proxyWithRefUnwrap(vm, exposed, key)); 30943 } 30944 } 30945 }; 30946} 30947function syncSetupProxy(to, from, prev, instance, type) { 30948 let changed = false; 30949 for (const key in from) { 30950 if (!(key in to)) { 30951 changed = true; 30952 defineProxyAttr(to, key, instance, type); 30953 } 30954 else if (from[key] !== prev[key]) { 30955 changed = true; 30956 } 30957 } 30958 for (const key in to) { 30959 if (!(key in from)) { 30960 changed = true; 30961 delete to[key]; 30962 } 30963 } 30964 return changed; 30965} 30966function defineProxyAttr(proxy, key, instance, type) { 30967 Object.defineProperty(proxy, key, { 30968 enumerable: true, 30969 configurable: true, 30970 get() { 30971 return instance[type][key]; 30972 } 30973 }); 30974} 30975function initSlotsProxy(vm) { 30976 if (!vm._slotsProxy) { 30977 syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots); 30978 } 30979 return vm._slotsProxy; 30980} 30981function syncSetupSlots(to, from) { 30982 for (const key in from) { 30983 to[key] = from[key]; 30984 } 30985 for (const key in to) { 30986 if (!(key in from)) { 30987 delete to[key]; 30988 } 30989 } 30990} 30991/** 30992 * @internal use manual type def because public setup context type relies on 30993 * legacy VNode types 30994 */ 30995function useSlots() { 30996 return getContext().slots; 30997} 30998/** 30999 * @internal use manual type def because public setup context type relies on 31000 * legacy VNode types 31001 */ 31002function useAttrs() { 31003 return getContext().attrs; 31004} 31005/** 31006 * Vue 2 only 31007 * @internal use manual type def because public setup context type relies on 31008 * legacy VNode types 31009 */ 31010function useListeners() { 31011 return getContext().listeners; 31012} 31013function getContext() { 31014 if (!currentInstance) { 31015 warn$2(`useContext() called without active instance.`); 31016 } 31017 const vm = currentInstance; 31018 return vm._setupContext || (vm._setupContext = createSetupContext(vm)); 31019} 31020/** 31021 * Runtime helper for merging default declarations. Imported by compiled code 31022 * only. 31023 * @internal 31024 */ 31025function mergeDefaults(raw, defaults) { 31026 const props = isArray(raw) 31027 ? raw.reduce((normalized, p) => ((normalized[p] = {}), normalized), {}) 31028 : raw; 31029 for (const key in defaults) { 31030 const opt = props[key]; 31031 if (opt) { 31032 if (isArray(opt) || isFunction(opt)) { 31033 props[key] = { type: opt, default: defaults[key] }; 31034 } 31035 else { 31036 opt.default = defaults[key]; 31037 } 31038 } 31039 else if (opt === null) { 31040 props[key] = { default: defaults[key] }; 31041 } 31042 else { 31043 warn$2(`props default key "${key}" has no corresponding declaration.`); 31044 } 31045 } 31046 return props; 31047} 31048 31049function initRender(vm) { 31050 vm._vnode = null; // the root of the child tree 31051 vm._staticTrees = null; // v-once cached trees 31052 const options = vm.$options; 31053 const parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree 31054 const renderContext = parentVnode && parentVnode.context; 31055 vm.$slots = resolveSlots(options._renderChildren, renderContext); 31056 vm.$scopedSlots = parentVnode 31057 ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots) 31058 : emptyObject; 31059 // bind the createElement fn to this instance 31060 // so that we get proper render context inside it. 31061 // args order: tag, data, children, normalizationType, alwaysNormalize 31062 // internal version is used by render functions compiled from templates 31063 // @ts-expect-error 31064 vm._c = (a, b, c, d) => createElement$1(vm, a, b, c, d, false); 31065 // normalization is always applied for the public version, used in 31066 // user-written render functions. 31067 // @ts-expect-error 31068 vm.$createElement = (a, b, c, d) => createElement$1(vm, a, b, c, d, true); 31069 // $attrs & $listeners are exposed for easier HOC creation. 31070 // they need to be reactive so that HOCs using them are always updated 31071 const parentData = parentVnode && parentVnode.data; 31072 /* istanbul ignore else */ 31073 { 31074 defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, () => { 31075 !isUpdatingChildComponent && warn$2(`$attrs is readonly.`, vm); 31076 }, true); 31077 defineReactive(vm, '$listeners', options._parentListeners || emptyObject, () => { 31078 !isUpdatingChildComponent && warn$2(`$listeners is readonly.`, vm); 31079 }, true); 31080 } 31081} 31082let currentRenderingInstance = null; 31083function renderMixin(Vue) { 31084 // install runtime convenience helpers 31085 installRenderHelpers(Vue.prototype); 31086 Vue.prototype.$nextTick = function (fn) { 31087 return nextTick(fn, this); 31088 }; 31089 Vue.prototype._render = function () { 31090 const vm = this; 31091 const { render, _parentVnode } = vm.$options; 31092 if (_parentVnode && vm._isMounted) { 31093 vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots); 31094 if (vm._slotsProxy) { 31095 syncSetupSlots(vm._slotsProxy, vm.$scopedSlots); 31096 } 31097 } 31098 // set parent vnode. this allows render functions to have access 31099 // to the data on the placeholder node. 31100 vm.$vnode = _parentVnode; 31101 // render self 31102 const prevInst = currentInstance; 31103 const prevRenderInst = currentRenderingInstance; 31104 let vnode; 31105 try { 31106 setCurrentInstance(vm); 31107 currentRenderingInstance = vm; 31108 vnode = render.call(vm._renderProxy, vm.$createElement); 31109 } 31110 catch (e) { 31111 handleError(e, vm, `render`); 31112 // return error render result, 31113 // or previous vnode to prevent render error causing blank component 31114 /* istanbul ignore else */ 31115 if (vm.$options.renderError) { 31116 try { 31117 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); 31118 } 31119 catch (e) { 31120 handleError(e, vm, `renderError`); 31121 vnode = vm._vnode; 31122 } 31123 } 31124 else { 31125 vnode = vm._vnode; 31126 } 31127 } 31128 finally { 31129 currentRenderingInstance = prevRenderInst; 31130 setCurrentInstance(prevInst); 31131 } 31132 // if the returned array contains only a single node, allow it 31133 if (isArray(vnode) && vnode.length === 1) { 31134 vnode = vnode[0]; 31135 } 31136 // return empty vnode in case the render function errored out 31137 if (!(vnode instanceof VNode)) { 31138 if (isArray(vnode)) { 31139 warn$2('Multiple root nodes returned from render function. Render function ' + 31140 'should return a single root node.', vm); 31141 } 31142 vnode = createEmptyVNode(); 31143 } 31144 // set parent 31145 vnode.parent = _parentVnode; 31146 return vnode; 31147 }; 31148} 31149 31150function ensureCtor(comp, base) { 31151 if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) { 31152 comp = comp.default; 31153 } 31154 return isObject(comp) ? base.extend(comp) : comp; 31155} 31156function createAsyncPlaceholder(factory, data, context, children, tag) { 31157 const node = createEmptyVNode(); 31158 node.asyncFactory = factory; 31159 node.asyncMeta = { data, context, children, tag }; 31160 return node; 31161} 31162function resolveAsyncComponent(factory, baseCtor) { 31163 if (isTrue(factory.error) && isDef(factory.errorComp)) { 31164 return factory.errorComp; 31165 } 31166 if (isDef(factory.resolved)) { 31167 return factory.resolved; 31168 } 31169 const owner = currentRenderingInstance; 31170 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) { 31171 // already pending 31172 factory.owners.push(owner); 31173 } 31174 if (isTrue(factory.loading) && isDef(factory.loadingComp)) { 31175 return factory.loadingComp; 31176 } 31177 if (owner && !isDef(factory.owners)) { 31178 const owners = (factory.owners = [owner]); 31179 let sync = true; 31180 let timerLoading = null; 31181 let timerTimeout = null; 31182 owner.$on('hook:destroyed', () => remove$2(owners, owner)); 31183 const forceRender = (renderCompleted) => { 31184 for (let i = 0, l = owners.length; i < l; i++) { 31185 owners[i].$forceUpdate(); 31186 } 31187 if (renderCompleted) { 31188 owners.length = 0; 31189 if (timerLoading !== null) { 31190 clearTimeout(timerLoading); 31191 timerLoading = null; 31192 } 31193 if (timerTimeout !== null) { 31194 clearTimeout(timerTimeout); 31195 timerTimeout = null; 31196 } 31197 } 31198 }; 31199 const resolve = once((res) => { 31200 // cache resolved 31201 factory.resolved = ensureCtor(res, baseCtor); 31202 // invoke callbacks only if this is not a synchronous resolve 31203 // (async resolves are shimmed as synchronous during SSR) 31204 if (!sync) { 31205 forceRender(true); 31206 } 31207 else { 31208 owners.length = 0; 31209 } 31210 }); 31211 const reject = once(reason => { 31212 warn$2(`Failed to resolve async component: ${String(factory)}` + 31213 (reason ? `\nReason: ${reason}` : '')); 31214 if (isDef(factory.errorComp)) { 31215 factory.error = true; 31216 forceRender(true); 31217 } 31218 }); 31219 const res = factory(resolve, reject); 31220 if (isObject(res)) { 31221 if (isPromise(res)) { 31222 // () => Promise 31223 if (isUndef(factory.resolved)) { 31224 res.then(resolve, reject); 31225 } 31226 } 31227 else if (isPromise(res.component)) { 31228 res.component.then(resolve, reject); 31229 if (isDef(res.error)) { 31230 factory.errorComp = ensureCtor(res.error, baseCtor); 31231 } 31232 if (isDef(res.loading)) { 31233 factory.loadingComp = ensureCtor(res.loading, baseCtor); 31234 if (res.delay === 0) { 31235 factory.loading = true; 31236 } 31237 else { 31238 // @ts-expect-error NodeJS timeout type 31239 timerLoading = setTimeout(() => { 31240 timerLoading = null; 31241 if (isUndef(factory.resolved) && isUndef(factory.error)) { 31242 factory.loading = true; 31243 forceRender(false); 31244 } 31245 }, res.delay || 200); 31246 } 31247 } 31248 if (isDef(res.timeout)) { 31249 // @ts-expect-error NodeJS timeout type 31250 timerTimeout = setTimeout(() => { 31251 timerTimeout = null; 31252 if (isUndef(factory.resolved)) { 31253 reject(`timeout (${res.timeout}ms)` ); 31254 } 31255 }, res.timeout); 31256 } 31257 } 31258 } 31259 sync = false; 31260 // return in case resolved synchronously 31261 return factory.loading ? factory.loadingComp : factory.resolved; 31262 } 31263} 31264 31265function getFirstComponentChild(children) { 31266 if (isArray(children)) { 31267 for (let i = 0; i < children.length; i++) { 31268 const c = children[i]; 31269 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { 31270 return c; 31271 } 31272 } 31273 } 31274} 31275 31276function initEvents(vm) { 31277 vm._events = Object.create(null); 31278 vm._hasHookEvent = false; 31279 // init parent attached events 31280 const listeners = vm.$options._parentListeners; 31281 if (listeners) { 31282 updateComponentListeners(vm, listeners); 31283 } 31284} 31285let target$1; 31286function add$1(event, fn) { 31287 target$1.$on(event, fn); 31288} 31289function remove$1(event, fn) { 31290 target$1.$off(event, fn); 31291} 31292function createOnceHandler$1(event, fn) { 31293 const _target = target$1; 31294 return function onceHandler() { 31295 const res = fn.apply(null, arguments); 31296 if (res !== null) { 31297 _target.$off(event, onceHandler); 31298 } 31299 }; 31300} 31301function updateComponentListeners(vm, listeners, oldListeners) { 31302 target$1 = vm; 31303 updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm); 31304 target$1 = undefined; 31305} 31306function eventsMixin(Vue) { 31307 const hookRE = /^hook:/; 31308 Vue.prototype.$on = function (event, fn) { 31309 const vm = this; 31310 if (isArray(event)) { 31311 for (let i = 0, l = event.length; i < l; i++) { 31312 vm.$on(event[i], fn); 31313 } 31314 } 31315 else { 31316 (vm._events[event] || (vm._events[event] = [])).push(fn); 31317 // optimize hook:event cost by using a boolean flag marked at registration 31318 // instead of a hash lookup 31319 if (hookRE.test(event)) { 31320 vm._hasHookEvent = true; 31321 } 31322 } 31323 return vm; 31324 }; 31325 Vue.prototype.$once = function (event, fn) { 31326 const vm = this; 31327 function on() { 31328 vm.$off(event, on); 31329 fn.apply(vm, arguments); 31330 } 31331 on.fn = fn; 31332 vm.$on(event, on); 31333 return vm; 31334 }; 31335 Vue.prototype.$off = function (event, fn) { 31336 const vm = this; 31337 // all 31338 if (!arguments.length) { 31339 vm._events = Object.create(null); 31340 return vm; 31341 } 31342 // array of events 31343 if (isArray(event)) { 31344 for (let i = 0, l = event.length; i < l; i++) { 31345 vm.$off(event[i], fn); 31346 } 31347 return vm; 31348 } 31349 // specific event 31350 const cbs = vm._events[event]; 31351 if (!cbs) { 31352 return vm; 31353 } 31354 if (!fn) { 31355 vm._events[event] = null; 31356 return vm; 31357 } 31358 // specific handler 31359 let cb; 31360 let i = cbs.length; 31361 while (i--) { 31362 cb = cbs[i]; 31363 if (cb === fn || cb.fn === fn) { 31364 cbs.splice(i, 1); 31365 break; 31366 } 31367 } 31368 return vm; 31369 }; 31370 Vue.prototype.$emit = function (event) { 31371 const vm = this; 31372 { 31373 const lowerCaseEvent = event.toLowerCase(); 31374 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { 31375 tip(`Event "${lowerCaseEvent}" is emitted in component ` + 31376 `${formatComponentName(vm)} but the handler is registered for "${event}". ` + 31377 `Note that HTML attributes are case-insensitive and you cannot use ` + 31378 `v-on to listen to camelCase events when using in-DOM templates. ` + 31379 `You should probably use "${hyphenate(event)}" instead of "${event}".`); 31380 } 31381 } 31382 let cbs = vm._events[event]; 31383 if (cbs) { 31384 cbs = cbs.length > 1 ? toArray(cbs) : cbs; 31385 const args = toArray(arguments, 1); 31386 const info = `event handler for "${event}"`; 31387 for (let i = 0, l = cbs.length; i < l; i++) { 31388 invokeWithErrorHandling(cbs[i], vm, args, vm, info); 31389 } 31390 } 31391 return vm; 31392 }; 31393} 31394 31395let activeEffectScope; 31396class EffectScope { 31397 constructor(detached = false) { 31398 this.detached = detached; 31399 /** 31400 * @internal 31401 */ 31402 this.active = true; 31403 /** 31404 * @internal 31405 */ 31406 this.effects = []; 31407 /** 31408 * @internal 31409 */ 31410 this.cleanups = []; 31411 this.parent = activeEffectScope; 31412 if (!detached && activeEffectScope) { 31413 this.index = 31414 (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1; 31415 } 31416 } 31417 run(fn) { 31418 if (this.active) { 31419 const currentEffectScope = activeEffectScope; 31420 try { 31421 activeEffectScope = this; 31422 return fn(); 31423 } 31424 finally { 31425 activeEffectScope = currentEffectScope; 31426 } 31427 } 31428 else { 31429 warn$2(`cannot run an inactive effect scope.`); 31430 } 31431 } 31432 /** 31433 * This should only be called on non-detached scopes 31434 * @internal 31435 */ 31436 on() { 31437 activeEffectScope = this; 31438 } 31439 /** 31440 * This should only be called on non-detached scopes 31441 * @internal 31442 */ 31443 off() { 31444 activeEffectScope = this.parent; 31445 } 31446 stop(fromParent) { 31447 if (this.active) { 31448 let i, l; 31449 for (i = 0, l = this.effects.length; i < l; i++) { 31450 this.effects[i].teardown(); 31451 } 31452 for (i = 0, l = this.cleanups.length; i < l; i++) { 31453 this.cleanups[i](); 31454 } 31455 if (this.scopes) { 31456 for (i = 0, l = this.scopes.length; i < l; i++) { 31457 this.scopes[i].stop(true); 31458 } 31459 } 31460 // nested scope, dereference from parent to avoid memory leaks 31461 if (!this.detached && this.parent && !fromParent) { 31462 // optimized O(1) removal 31463 const last = this.parent.scopes.pop(); 31464 if (last && last !== this) { 31465 this.parent.scopes[this.index] = last; 31466 last.index = this.index; 31467 } 31468 } 31469 this.parent = undefined; 31470 this.active = false; 31471 } 31472 } 31473} 31474function effectScope(detached) { 31475 return new EffectScope(detached); 31476} 31477/** 31478 * @internal 31479 */ 31480function recordEffectScope(effect, scope = activeEffectScope) { 31481 if (scope && scope.active) { 31482 scope.effects.push(effect); 31483 } 31484} 31485function getCurrentScope() { 31486 return activeEffectScope; 31487} 31488function onScopeDispose(fn) { 31489 if (activeEffectScope) { 31490 activeEffectScope.cleanups.push(fn); 31491 } 31492 else { 31493 warn$2(`onScopeDispose() is called when there is no active effect scope` + 31494 ` to be associated with.`); 31495 } 31496} 31497 31498let activeInstance = null; 31499let isUpdatingChildComponent = false; 31500function setActiveInstance(vm) { 31501 const prevActiveInstance = activeInstance; 31502 activeInstance = vm; 31503 return () => { 31504 activeInstance = prevActiveInstance; 31505 }; 31506} 31507function initLifecycle(vm) { 31508 const options = vm.$options; 31509 // locate first non-abstract parent 31510 let parent = options.parent; 31511 if (parent && !options.abstract) { 31512 while (parent.$options.abstract && parent.$parent) { 31513 parent = parent.$parent; 31514 } 31515 parent.$children.push(vm); 31516 } 31517 vm.$parent = parent; 31518 vm.$root = parent ? parent.$root : vm; 31519 vm.$children = []; 31520 vm.$refs = {}; 31521 vm._provided = parent ? parent._provided : Object.create(null); 31522 vm._watcher = null; 31523 vm._inactive = null; 31524 vm._directInactive = false; 31525 vm._isMounted = false; 31526 vm._isDestroyed = false; 31527 vm._isBeingDestroyed = false; 31528} 31529function lifecycleMixin(Vue) { 31530 Vue.prototype._update = function (vnode, hydrating) { 31531 const vm = this; 31532 const prevEl = vm.$el; 31533 const prevVnode = vm._vnode; 31534 const restoreActiveInstance = setActiveInstance(vm); 31535 vm._vnode = vnode; 31536 // Vue.prototype.__patch__ is injected in entry points 31537 // based on the rendering backend used. 31538 if (!prevVnode) { 31539 // initial render 31540 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); 31541 } 31542 else { 31543 // updates 31544 vm.$el = vm.__patch__(prevVnode, vnode); 31545 } 31546 restoreActiveInstance(); 31547 // update __vue__ reference 31548 if (prevEl) { 31549 prevEl.__vue__ = null; 31550 } 31551 if (vm.$el) { 31552 vm.$el.__vue__ = vm; 31553 } 31554 // if parent is an HOC, update its $el as well 31555 let wrapper = vm; 31556 while (wrapper && 31557 wrapper.$vnode && 31558 wrapper.$parent && 31559 wrapper.$vnode === wrapper.$parent._vnode) { 31560 wrapper.$parent.$el = wrapper.$el; 31561 wrapper = wrapper.$parent; 31562 } 31563 // updated hook is called by the scheduler to ensure that children are 31564 // updated in a parent's updated hook. 31565 }; 31566 Vue.prototype.$forceUpdate = function () { 31567 const vm = this; 31568 if (vm._watcher) { 31569 vm._watcher.update(); 31570 } 31571 }; 31572 Vue.prototype.$destroy = function () { 31573 const vm = this; 31574 if (vm._isBeingDestroyed) { 31575 return; 31576 } 31577 callHook$1(vm, 'beforeDestroy'); 31578 vm._isBeingDestroyed = true; 31579 // remove self from parent 31580 const parent = vm.$parent; 31581 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { 31582 remove$2(parent.$children, vm); 31583 } 31584 // teardown scope. this includes both the render watcher and other 31585 // watchers created 31586 vm._scope.stop(); 31587 // remove reference from data ob 31588 // frozen object may not have observer. 31589 if (vm._data.__ob__) { 31590 vm._data.__ob__.vmCount--; 31591 } 31592 // call the last hook... 31593 vm._isDestroyed = true; 31594 // invoke destroy hooks on current rendered tree 31595 vm.__patch__(vm._vnode, null); 31596 // fire destroyed hook 31597 callHook$1(vm, 'destroyed'); 31598 // turn off all instance listeners. 31599 vm.$off(); 31600 // remove __vue__ reference 31601 if (vm.$el) { 31602 vm.$el.__vue__ = null; 31603 } 31604 // release circular reference (#6759) 31605 if (vm.$vnode) { 31606 vm.$vnode.parent = null; 31607 } 31608 }; 31609} 31610function mountComponent(vm, el, hydrating) { 31611 vm.$el = el; 31612 if (!vm.$options.render) { 31613 // @ts-expect-error invalid type 31614 vm.$options.render = createEmptyVNode; 31615 { 31616 /* istanbul ignore if */ 31617 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || 31618 vm.$options.el || 31619 el) { 31620 warn$2('You are using the runtime-only build of Vue where the template ' + 31621 'compiler is not available. Either pre-compile the templates into ' + 31622 'render functions, or use the compiler-included build.', vm); 31623 } 31624 else { 31625 warn$2('Failed to mount component: template or render function not defined.', vm); 31626 } 31627 } 31628 } 31629 callHook$1(vm, 'beforeMount'); 31630 let updateComponent; 31631 /* istanbul ignore if */ 31632 if (config.performance && mark) { 31633 updateComponent = () => { 31634 const name = vm._name; 31635 const id = vm._uid; 31636 const startTag = `vue-perf-start:${id}`; 31637 const endTag = `vue-perf-end:${id}`; 31638 mark(startTag); 31639 const vnode = vm._render(); 31640 mark(endTag); 31641 measure(`vue ${name} render`, startTag, endTag); 31642 mark(startTag); 31643 vm._update(vnode, hydrating); 31644 mark(endTag); 31645 measure(`vue ${name} patch`, startTag, endTag); 31646 }; 31647 } 31648 else { 31649 updateComponent = () => { 31650 vm._update(vm._render(), hydrating); 31651 }; 31652 } 31653 const watcherOptions = { 31654 before() { 31655 if (vm._isMounted && !vm._isDestroyed) { 31656 callHook$1(vm, 'beforeUpdate'); 31657 } 31658 } 31659 }; 31660 { 31661 watcherOptions.onTrack = e => callHook$1(vm, 'renderTracked', [e]); 31662 watcherOptions.onTrigger = e => callHook$1(vm, 'renderTriggered', [e]); 31663 } 31664 // we set this to vm._watcher inside the watcher's constructor 31665 // since the watcher's initial patch may call $forceUpdate (e.g. inside child 31666 // component's mounted hook), which relies on vm._watcher being already defined 31667 new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */); 31668 hydrating = false; 31669 // flush buffer for flush: "pre" watchers queued in setup() 31670 const preWatchers = vm._preWatchers; 31671 if (preWatchers) { 31672 for (let i = 0; i < preWatchers.length; i++) { 31673 preWatchers[i].run(); 31674 } 31675 } 31676 // manually mounted instance, call mounted on self 31677 // mounted is called for render-created child components in its inserted hook 31678 if (vm.$vnode == null) { 31679 vm._isMounted = true; 31680 callHook$1(vm, 'mounted'); 31681 } 31682 return vm; 31683} 31684function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) { 31685 { 31686 isUpdatingChildComponent = true; 31687 } 31688 // determine whether component has slot children 31689 // we need to do this before overwriting $options._renderChildren. 31690 // check if there are dynamic scopedSlots (hand-written or compiled but with 31691 // dynamic slot names). Static scoped slots compiled from template has the 31692 // "$stable" marker. 31693 const newScopedSlots = parentVnode.data.scopedSlots; 31694 const oldScopedSlots = vm.$scopedSlots; 31695 const hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) || 31696 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) || 31697 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) || 31698 (!newScopedSlots && vm.$scopedSlots.$key)); 31699 // Any static slot children from the parent may have changed during parent's 31700 // update. Dynamic scoped slots may also have changed. In such cases, a forced 31701 // update is necessary to ensure correctness. 31702 let needsForceUpdate = !!(renderChildren || // has new static slots 31703 vm.$options._renderChildren || // has old static slots 31704 hasDynamicScopedSlot); 31705 const prevVNode = vm.$vnode; 31706 vm.$options._parentVnode = parentVnode; 31707 vm.$vnode = parentVnode; // update vm's placeholder node without re-render 31708 if (vm._vnode) { 31709 // update child tree's parent 31710 vm._vnode.parent = parentVnode; 31711 } 31712 vm.$options._renderChildren = renderChildren; 31713 // update $attrs and $listeners hash 31714 // these are also reactive so they may trigger child update if the child 31715 // used them during render 31716 const attrs = parentVnode.data.attrs || emptyObject; 31717 if (vm._attrsProxy) { 31718 // force update if attrs are accessed and has changed since it may be 31719 // passed to a child component. 31720 if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) { 31721 needsForceUpdate = true; 31722 } 31723 } 31724 vm.$attrs = attrs; 31725 // update listeners 31726 listeners = listeners || emptyObject; 31727 const prevListeners = vm.$options._parentListeners; 31728 if (vm._listenersProxy) { 31729 syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners'); 31730 } 31731 vm.$listeners = vm.$options._parentListeners = listeners; 31732 updateComponentListeners(vm, listeners, prevListeners); 31733 // update props 31734 if (propsData && vm.$options.props) { 31735 toggleObserving(false); 31736 const props = vm._props; 31737 const propKeys = vm.$options._propKeys || []; 31738 for (let i = 0; i < propKeys.length; i++) { 31739 const key = propKeys[i]; 31740 const propOptions = vm.$options.props; // wtf flow? 31741 props[key] = validateProp(key, propOptions, propsData, vm); 31742 } 31743 toggleObserving(true); 31744 // keep a copy of raw propsData 31745 vm.$options.propsData = propsData; 31746 } 31747 // resolve slots + force update if has children 31748 if (needsForceUpdate) { 31749 vm.$slots = resolveSlots(renderChildren, parentVnode.context); 31750 vm.$forceUpdate(); 31751 } 31752 { 31753 isUpdatingChildComponent = false; 31754 } 31755} 31756function isInInactiveTree(vm) { 31757 while (vm && (vm = vm.$parent)) { 31758 if (vm._inactive) 31759 return true; 31760 } 31761 return false; 31762} 31763function activateChildComponent(vm, direct) { 31764 if (direct) { 31765 vm._directInactive = false; 31766 if (isInInactiveTree(vm)) { 31767 return; 31768 } 31769 } 31770 else if (vm._directInactive) { 31771 return; 31772 } 31773 if (vm._inactive || vm._inactive === null) { 31774 vm._inactive = false; 31775 for (let i = 0; i < vm.$children.length; i++) { 31776 activateChildComponent(vm.$children[i]); 31777 } 31778 callHook$1(vm, 'activated'); 31779 } 31780} 31781function deactivateChildComponent(vm, direct) { 31782 if (direct) { 31783 vm._directInactive = true; 31784 if (isInInactiveTree(vm)) { 31785 return; 31786 } 31787 } 31788 if (!vm._inactive) { 31789 vm._inactive = true; 31790 for (let i = 0; i < vm.$children.length; i++) { 31791 deactivateChildComponent(vm.$children[i]); 31792 } 31793 callHook$1(vm, 'deactivated'); 31794 } 31795} 31796function callHook$1(vm, hook, args, setContext = true) { 31797 // #7573 disable dep collection when invoking lifecycle hooks 31798 pushTarget(); 31799 const prevInst = currentInstance; 31800 const prevScope = getCurrentScope(); 31801 setContext && setCurrentInstance(vm); 31802 const handlers = vm.$options[hook]; 31803 const info = `${hook} hook`; 31804 if (handlers) { 31805 for (let i = 0, j = handlers.length; i < j; i++) { 31806 invokeWithErrorHandling(handlers[i], vm, args || null, vm, info); 31807 } 31808 } 31809 if (vm._hasHookEvent) { 31810 vm.$emit('hook:' + hook); 31811 } 31812 if (setContext) { 31813 setCurrentInstance(prevInst); 31814 prevScope && prevScope.on(); 31815 } 31816 popTarget(); 31817} 31818 31819const MAX_UPDATE_COUNT = 100; 31820const queue = []; 31821const activatedChildren = []; 31822let has = {}; 31823let circular = {}; 31824let waiting = false; 31825let flushing = false; 31826let index$1 = 0; 31827/** 31828 * Reset the scheduler's state. 31829 */ 31830function resetSchedulerState() { 31831 index$1 = queue.length = activatedChildren.length = 0; 31832 has = {}; 31833 { 31834 circular = {}; 31835 } 31836 waiting = flushing = false; 31837} 31838// Async edge case #6566 requires saving the timestamp when event listeners are 31839// attached. However, calling performance.now() has a perf overhead especially 31840// if the page has thousands of event listeners. Instead, we take a timestamp 31841// every time the scheduler flushes and use that for all event listeners 31842// attached during that flush. 31843let currentFlushTimestamp = 0; 31844// Async edge case fix requires storing an event listener's attach timestamp. 31845let getNow = Date.now; 31846// Determine what event timestamp the browser is using. Annoyingly, the 31847// timestamp can either be hi-res (relative to page load) or low-res 31848// (relative to UNIX epoch), so in order to compare time we have to use the 31849// same timestamp type when saving the flush timestamp. 31850// All IE versions use low-res event timestamps, and have problematic clock 31851// implementations (#9632) 31852if (inBrowser && !isIE) { 31853 const performance = window.performance; 31854 if (performance && 31855 typeof performance.now === 'function' && 31856 getNow() > document.createEvent('Event').timeStamp) { 31857 // if the event timestamp, although evaluated AFTER the Date.now(), is 31858 // smaller than it, it means the event is using a hi-res timestamp, 31859 // and we need to use the hi-res version for event listener timestamps as 31860 // well. 31861 getNow = () => performance.now(); 31862 } 31863} 31864const sortCompareFn = (a, b) => { 31865 if (a.post) { 31866 if (!b.post) 31867 return 1; 31868 } 31869 else if (b.post) { 31870 return -1; 31871 } 31872 return a.id - b.id; 31873}; 31874/** 31875 * Flush both queues and run the watchers. 31876 */ 31877function flushSchedulerQueue() { 31878 currentFlushTimestamp = getNow(); 31879 flushing = true; 31880 let watcher, id; 31881 // Sort queue before flush. 31882 // This ensures that: 31883 // 1. Components are updated from parent to child. (because parent is always 31884 // created before the child) 31885 // 2. A component's user watchers are run before its render watcher (because 31886 // user watchers are created before the render watcher) 31887 // 3. If a component is destroyed during a parent component's watcher run, 31888 // its watchers can be skipped. 31889 queue.sort(sortCompareFn); 31890 // do not cache length because more watchers might be pushed 31891 // as we run existing watchers 31892 for (index$1 = 0; index$1 < queue.length; index$1++) { 31893 watcher = queue[index$1]; 31894 if (watcher.before) { 31895 watcher.before(); 31896 } 31897 id = watcher.id; 31898 has[id] = null; 31899 watcher.run(); 31900 // in dev build, check and stop circular updates. 31901 if (has[id] != null) { 31902 circular[id] = (circular[id] || 0) + 1; 31903 if (circular[id] > MAX_UPDATE_COUNT) { 31904 warn$2('You may have an infinite update loop ' + 31905 (watcher.user 31906 ? `in watcher with expression "${watcher.expression}"` 31907 : `in a component render function.`), watcher.vm); 31908 break; 31909 } 31910 } 31911 } 31912 // keep copies of post queues before resetting state 31913 const activatedQueue = activatedChildren.slice(); 31914 const updatedQueue = queue.slice(); 31915 resetSchedulerState(); 31916 // call component updated and activated hooks 31917 callActivatedHooks(activatedQueue); 31918 callUpdatedHooks(updatedQueue); 31919 cleanupDeps(); 31920 // devtool hook 31921 /* istanbul ignore if */ 31922 if (devtools && config.devtools) { 31923 devtools.emit('flush'); 31924 } 31925} 31926function callUpdatedHooks(queue) { 31927 let i = queue.length; 31928 while (i--) { 31929 const watcher = queue[i]; 31930 const vm = watcher.vm; 31931 if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { 31932 callHook$1(vm, 'updated'); 31933 } 31934 } 31935} 31936/** 31937 * Queue a kept-alive component that was activated during patch. 31938 * The queue will be processed after the entire tree has been patched. 31939 */ 31940function queueActivatedComponent(vm) { 31941 // setting _inactive to false here so that a render function can 31942 // rely on checking whether it's in an inactive tree (e.g. router-view) 31943 vm._inactive = false; 31944 activatedChildren.push(vm); 31945} 31946function callActivatedHooks(queue) { 31947 for (let i = 0; i < queue.length; i++) { 31948 queue[i]._inactive = true; 31949 activateChildComponent(queue[i], true /* true */); 31950 } 31951} 31952/** 31953 * Push a watcher into the watcher queue. 31954 * Jobs with duplicate IDs will be skipped unless it's 31955 * pushed when the queue is being flushed. 31956 */ 31957function queueWatcher(watcher) { 31958 const id = watcher.id; 31959 if (has[id] != null) { 31960 return; 31961 } 31962 if (watcher === Dep.target && watcher.noRecurse) { 31963 return; 31964 } 31965 has[id] = true; 31966 if (!flushing) { 31967 queue.push(watcher); 31968 } 31969 else { 31970 // if already flushing, splice the watcher based on its id 31971 // if already past its id, it will be run next immediately. 31972 let i = queue.length - 1; 31973 while (i > index$1 && queue[i].id > watcher.id) { 31974 i--; 31975 } 31976 queue.splice(i + 1, 0, watcher); 31977 } 31978 // queue the flush 31979 if (!waiting) { 31980 waiting = true; 31981 if (!config.async) { 31982 flushSchedulerQueue(); 31983 return; 31984 } 31985 nextTick(flushSchedulerQueue); 31986 } 31987} 31988 31989const WATCHER = `watcher`; 31990const WATCHER_CB = `${WATCHER} callback`; 31991const WATCHER_GETTER = `${WATCHER} getter`; 31992const WATCHER_CLEANUP = `${WATCHER} cleanup`; 31993// Simple effect. 31994function watchEffect(effect, options) { 31995 return doWatch(effect, null, options); 31996} 31997function watchPostEffect(effect, options) { 31998 return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'post' }) )); 31999} 32000function watchSyncEffect(effect, options) { 32001 return doWatch(effect, null, (Object.assign(Object.assign({}, options), { flush: 'sync' }) )); 32002} 32003// initial value for watchers to trigger on undefined initial values 32004const INITIAL_WATCHER_VALUE = {}; 32005// implementation 32006function watch(source, cb, options) { 32007 if (typeof cb !== 'function') { 32008 warn$2(`\`watch(fn, options?)\` signature has been moved to a separate API. ` + 32009 `Use \`watchEffect(fn, options?)\` instead. \`watch\` now only ` + 32010 `supports \`watch(source, cb, options?) signature.`); 32011 } 32012 return doWatch(source, cb, options); 32013} 32014function doWatch(source, cb, { immediate, deep, flush = 'pre', onTrack, onTrigger } = emptyObject) { 32015 if (!cb) { 32016 if (immediate !== undefined) { 32017 warn$2(`watch() "immediate" option is only respected when using the ` + 32018 `watch(source, callback, options?) signature.`); 32019 } 32020 if (deep !== undefined) { 32021 warn$2(`watch() "deep" option is only respected when using the ` + 32022 `watch(source, callback, options?) signature.`); 32023 } 32024 } 32025 const warnInvalidSource = (s) => { 32026 warn$2(`Invalid watch source: ${s}. A watch source can only be a getter/effect ` + 32027 `function, a ref, a reactive object, or an array of these types.`); 32028 }; 32029 const instance = currentInstance; 32030 const call = (fn, type, args = null) => { 32031 const res = invokeWithErrorHandling(fn, null, args, instance, type); 32032 if (deep && res && res.__ob__) 32033 res.__ob__.dep.depend(); 32034 return res; 32035 }; 32036 let getter; 32037 let forceTrigger = false; 32038 let isMultiSource = false; 32039 if (isRef(source)) { 32040 getter = () => source.value; 32041 forceTrigger = isShallow(source); 32042 } 32043 else if (isReactive(source)) { 32044 getter = () => { 32045 source.__ob__.dep.depend(); 32046 return source; 32047 }; 32048 deep = true; 32049 } 32050 else if (isArray(source)) { 32051 isMultiSource = true; 32052 forceTrigger = source.some(s => isReactive(s) || isShallow(s)); 32053 getter = () => source.map(s => { 32054 if (isRef(s)) { 32055 return s.value; 32056 } 32057 else if (isReactive(s)) { 32058 s.__ob__.dep.depend(); 32059 return traverse(s); 32060 } 32061 else if (isFunction(s)) { 32062 return call(s, WATCHER_GETTER); 32063 } 32064 else { 32065 warnInvalidSource(s); 32066 } 32067 }); 32068 } 32069 else if (isFunction(source)) { 32070 if (cb) { 32071 // getter with cb 32072 getter = () => call(source, WATCHER_GETTER); 32073 } 32074 else { 32075 // no cb -> simple effect 32076 getter = () => { 32077 if (instance && instance._isDestroyed) { 32078 return; 32079 } 32080 if (cleanup) { 32081 cleanup(); 32082 } 32083 return call(source, WATCHER, [onCleanup]); 32084 }; 32085 } 32086 } 32087 else { 32088 getter = noop; 32089 warnInvalidSource(source); 32090 } 32091 if (cb && deep) { 32092 const baseGetter = getter; 32093 getter = () => traverse(baseGetter()); 32094 } 32095 let cleanup; 32096 let onCleanup = (fn) => { 32097 cleanup = watcher.onStop = () => { 32098 call(fn, WATCHER_CLEANUP); 32099 }; 32100 }; 32101 // in SSR there is no need to setup an actual effect, and it should be noop 32102 // unless it's eager 32103 if (isServerRendering()) { 32104 // we will also not call the invalidate callback (+ runner is not set up) 32105 onCleanup = noop; 32106 if (!cb) { 32107 getter(); 32108 } 32109 else if (immediate) { 32110 call(cb, WATCHER_CB, [ 32111 getter(), 32112 isMultiSource ? [] : undefined, 32113 onCleanup 32114 ]); 32115 } 32116 return noop; 32117 } 32118 const watcher = new Watcher(currentInstance, getter, noop, { 32119 lazy: true 32120 }); 32121 watcher.noRecurse = !cb; 32122 let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE; 32123 // overwrite default run 32124 watcher.run = () => { 32125 if (!watcher.active) { 32126 return; 32127 } 32128 if (cb) { 32129 // watch(source, cb) 32130 const newValue = watcher.get(); 32131 if (deep || 32132 forceTrigger || 32133 (isMultiSource 32134 ? newValue.some((v, i) => hasChanged(v, oldValue[i])) 32135 : hasChanged(newValue, oldValue))) { 32136 // cleanup before running cb again 32137 if (cleanup) { 32138 cleanup(); 32139 } 32140 call(cb, WATCHER_CB, [ 32141 newValue, 32142 // pass undefined as the old value when it's changed for the first time 32143 oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue, 32144 onCleanup 32145 ]); 32146 oldValue = newValue; 32147 } 32148 } 32149 else { 32150 // watchEffect 32151 watcher.get(); 32152 } 32153 }; 32154 if (flush === 'sync') { 32155 watcher.update = watcher.run; 32156 } 32157 else if (flush === 'post') { 32158 watcher.post = true; 32159 watcher.update = () => queueWatcher(watcher); 32160 } 32161 else { 32162 // pre 32163 watcher.update = () => { 32164 if (instance && instance === currentInstance && !instance._isMounted) { 32165 // pre-watcher triggered before 32166 const buffer = instance._preWatchers || (instance._preWatchers = []); 32167 if (buffer.indexOf(watcher) < 0) 32168 buffer.push(watcher); 32169 } 32170 else { 32171 queueWatcher(watcher); 32172 } 32173 }; 32174 } 32175 { 32176 watcher.onTrack = onTrack; 32177 watcher.onTrigger = onTrigger; 32178 } 32179 // initial run 32180 if (cb) { 32181 if (immediate) { 32182 watcher.run(); 32183 } 32184 else { 32185 oldValue = watcher.get(); 32186 } 32187 } 32188 else if (flush === 'post' && instance) { 32189 instance.$once('hook:mounted', () => watcher.get()); 32190 } 32191 else { 32192 watcher.get(); 32193 } 32194 return () => { 32195 watcher.teardown(); 32196 }; 32197} 32198 32199function provide(key, value) { 32200 if (!currentInstance) { 32201 { 32202 warn$2(`provide() can only be used inside setup().`); 32203 } 32204 } 32205 else { 32206 // TS doesn't allow symbol as index type 32207 resolveProvided(currentInstance)[key] = value; 32208 } 32209} 32210function resolveProvided(vm) { 32211 // by default an instance inherits its parent's provides object 32212 // but when it needs to provide values of its own, it creates its 32213 // own provides object using parent provides object as prototype. 32214 // this way in `inject` we can simply look up injections from direct 32215 // parent and let the prototype chain do the work. 32216 const existing = vm._provided; 32217 const parentProvides = vm.$parent && vm.$parent._provided; 32218 if (parentProvides === existing) { 32219 return (vm._provided = Object.create(parentProvides)); 32220 } 32221 else { 32222 return existing; 32223 } 32224} 32225function inject(key, defaultValue, treatDefaultAsFactory = false) { 32226 // fallback to `currentRenderingInstance` so that this can be called in 32227 // a functional component 32228 const instance = currentInstance; 32229 if (instance) { 32230 // #2400 32231 // to support `app.use` plugins, 32232 // fallback to appContext's `provides` if the instance is at root 32233 const provides = instance.$parent && instance.$parent._provided; 32234 if (provides && key in provides) { 32235 // TS doesn't allow symbol as index type 32236 return provides[key]; 32237 } 32238 else if (arguments.length > 1) { 32239 return treatDefaultAsFactory && isFunction(defaultValue) 32240 ? defaultValue.call(instance) 32241 : defaultValue; 32242 } 32243 else { 32244 warn$2(`injection "${String(key)}" not found.`); 32245 } 32246 } 32247 else { 32248 warn$2(`inject() can only be used inside setup() or functional components.`); 32249 } 32250} 32251 32252/** 32253 * @internal this function needs manual public type declaration because it relies 32254 * on previously manually authored types from Vue 2 32255 */ 32256function h(type, props, children) { 32257 if (!currentInstance) { 32258 warn$2(`globally imported h() can only be invoked when there is an active ` + 32259 `component instance, e.g. synchronously in a component's render or setup function.`); 32260 } 32261 return createElement$1(currentInstance, type, props, children, 2, true); 32262} 32263 32264function handleError(err, vm, info) { 32265 // Deactivate deps tracking while processing error handler to avoid possible infinite rendering. 32266 // See: https://github.com/vuejs/vuex/issues/1505 32267 pushTarget(); 32268 try { 32269 if (vm) { 32270 let cur = vm; 32271 while ((cur = cur.$parent)) { 32272 const hooks = cur.$options.errorCaptured; 32273 if (hooks) { 32274 for (let i = 0; i < hooks.length; i++) { 32275 try { 32276 const capture = hooks[i].call(cur, err, vm, info) === false; 32277 if (capture) 32278 return; 32279 } 32280 catch (e) { 32281 globalHandleError(e, cur, 'errorCaptured hook'); 32282 } 32283 } 32284 } 32285 } 32286 } 32287 globalHandleError(err, vm, info); 32288 } 32289 finally { 32290 popTarget(); 32291 } 32292} 32293function invokeWithErrorHandling(handler, context, args, vm, info) { 32294 let res; 32295 try { 32296 res = args ? handler.apply(context, args) : handler.call(context); 32297 if (res && !res._isVue && isPromise(res) && !res._handled) { 32298 res.catch(e => handleError(e, vm, info + ` (Promise/async)`)); 32299 res._handled = true; 32300 } 32301 } 32302 catch (e) { 32303 handleError(e, vm, info); 32304 } 32305 return res; 32306} 32307function globalHandleError(err, vm, info) { 32308 if (config.errorHandler) { 32309 try { 32310 return config.errorHandler.call(null, err, vm, info); 32311 } 32312 catch (e) { 32313 // if the user intentionally throws the original error in the handler, 32314 // do not log it twice 32315 if (e !== err) { 32316 logError(e, null, 'config.errorHandler'); 32317 } 32318 } 32319 } 32320 logError(err, vm, info); 32321} 32322function logError(err, vm, info) { 32323 { 32324 warn$2(`Error in ${info}: "${err.toString()}"`, vm); 32325 } 32326 /* istanbul ignore else */ 32327 if (inBrowser && typeof console !== 'undefined') { 32328 console.error(err); 32329 } 32330 else { 32331 throw err; 32332 } 32333} 32334 32335/* globals MutationObserver */ 32336let isUsingMicroTask = false; 32337const callbacks = []; 32338let pending = false; 32339function flushCallbacks() { 32340 pending = false; 32341 const copies = callbacks.slice(0); 32342 callbacks.length = 0; 32343 for (let i = 0; i < copies.length; i++) { 32344 copies[i](); 32345 } 32346} 32347// Here we have async deferring wrappers using microtasks. 32348// In 2.5 we used (macro) tasks (in combination with microtasks). 32349// However, it has subtle problems when state is changed right before repaint 32350// (e.g. #6813, out-in transitions). 32351// Also, using (macro) tasks in event handler would cause some weird behaviors 32352// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109). 32353// So we now use microtasks everywhere, again. 32354// A major drawback of this tradeoff is that there are some scenarios 32355// where microtasks have too high a priority and fire in between supposedly 32356// sequential events (e.g. #4521, #6690, which have workarounds) 32357// or even between bubbling of the same event (#6566). 32358let timerFunc; 32359// The nextTick behavior leverages the microtask queue, which can be accessed 32360// via either native Promise.then or MutationObserver. 32361// MutationObserver has wider support, however it is seriously bugged in 32362// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It 32363// completely stops working after triggering a few times... so, if native 32364// Promise is available, we will use it: 32365/* istanbul ignore next, $flow-disable-line */ 32366if (typeof Promise !== 'undefined' && isNative(Promise)) { 32367 const p = Promise.resolve(); 32368 timerFunc = () => { 32369 p.then(flushCallbacks); 32370 // In problematic UIWebViews, Promise.then doesn't completely break, but 32371 // it can get stuck in a weird state where callbacks are pushed into the 32372 // microtask queue but the queue isn't being flushed, until the browser 32373 // needs to do some other work, e.g. handle a timer. Therefore we can 32374 // "force" the microtask queue to be flushed by adding an empty timer. 32375 if (isIOS) 32376 setTimeout(noop); 32377 }; 32378 isUsingMicroTask = true; 32379} 32380else if (!isIE && 32381 typeof MutationObserver !== 'undefined' && 32382 (isNative(MutationObserver) || 32383 // PhantomJS and iOS 7.x 32384 MutationObserver.toString() === '[object MutationObserverConstructor]')) { 32385 // Use MutationObserver where native Promise is not available, 32386 // e.g. PhantomJS, iOS7, Android 4.4 32387 // (#6466 MutationObserver is unreliable in IE11) 32388 let counter = 1; 32389 const observer = new MutationObserver(flushCallbacks); 32390 const textNode = document.createTextNode(String(counter)); 32391 observer.observe(textNode, { 32392 characterData: true 32393 }); 32394 timerFunc = () => { 32395 counter = (counter + 1) % 2; 32396 textNode.data = String(counter); 32397 }; 32398 isUsingMicroTask = true; 32399} 32400else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { 32401 // Fallback to setImmediate. 32402 // Technically it leverages the (macro) task queue, 32403 // but it is still a better choice than setTimeout. 32404 timerFunc = () => { 32405 setImmediate(flushCallbacks); 32406 }; 32407} 32408else { 32409 // Fallback to setTimeout. 32410 timerFunc = () => { 32411 setTimeout(flushCallbacks, 0); 32412 }; 32413} 32414/** 32415 * @internal 32416 */ 32417function nextTick(cb, ctx) { 32418 let _resolve; 32419 callbacks.push(() => { 32420 if (cb) { 32421 try { 32422 cb.call(ctx); 32423 } 32424 catch (e) { 32425 handleError(e, ctx, 'nextTick'); 32426 } 32427 } 32428 else if (_resolve) { 32429 _resolve(ctx); 32430 } 32431 }); 32432 if (!pending) { 32433 pending = true; 32434 timerFunc(); 32435 } 32436 // $flow-disable-line 32437 if (!cb && typeof Promise !== 'undefined') { 32438 return new Promise(resolve => { 32439 _resolve = resolve; 32440 }); 32441 } 32442} 32443 32444function useCssModule(name = '$style') { 32445 /* istanbul ignore else */ 32446 { 32447 if (!currentInstance) { 32448 warn$2(`useCssModule must be called inside setup()`); 32449 return emptyObject; 32450 } 32451 const mod = currentInstance[name]; 32452 if (!mod) { 32453 warn$2(`Current instance does not have CSS module named "${name}".`); 32454 return emptyObject; 32455 } 32456 return mod; 32457 } 32458} 32459 32460/** 32461 * Runtime helper for SFC's CSS variable injection feature. 32462 * @private 32463 */ 32464function useCssVars(getter) { 32465 if (!inBrowser && !false) 32466 return; 32467 const instance = currentInstance; 32468 if (!instance) { 32469 warn$2(`useCssVars is called without current active component instance.`); 32470 return; 32471 } 32472 watchPostEffect(() => { 32473 const el = instance.$el; 32474 const vars = getter(instance, instance._setupProxy); 32475 if (el && el.nodeType === 1) { 32476 const style = el.style; 32477 for (const key in vars) { 32478 style.setProperty(`--${key}`, vars[key]); 32479 } 32480 } 32481 }); 32482} 32483 32484/** 32485 * v3-compatible async component API. 32486 * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts 32487 * because it relies on existing manual types 32488 */ 32489function defineAsyncComponent(source) { 32490 if (isFunction(source)) { 32491 source = { loader: source }; 32492 } 32493 const { loader, loadingComponent, errorComponent, delay = 200, timeout, // undefined = never times out 32494 suspensible = false, // in Vue 3 default is true 32495 onError: userOnError } = source; 32496 if (suspensible) { 32497 warn$2(`The suspensible option for async components is not supported in Vue2. It is ignored.`); 32498 } 32499 let pendingRequest = null; 32500 let retries = 0; 32501 const retry = () => { 32502 retries++; 32503 pendingRequest = null; 32504 return load(); 32505 }; 32506 const load = () => { 32507 let thisRequest; 32508 return (pendingRequest || 32509 (thisRequest = pendingRequest = 32510 loader() 32511 .catch(err => { 32512 err = err instanceof Error ? err : new Error(String(err)); 32513 if (userOnError) { 32514 return new Promise((resolve, reject) => { 32515 const userRetry = () => resolve(retry()); 32516 const userFail = () => reject(err); 32517 userOnError(err, userRetry, userFail, retries + 1); 32518 }); 32519 } 32520 else { 32521 throw err; 32522 } 32523 }) 32524 .then((comp) => { 32525 if (thisRequest !== pendingRequest && pendingRequest) { 32526 return pendingRequest; 32527 } 32528 if (!comp) { 32529 warn$2(`Async component loader resolved to undefined. ` + 32530 `If you are using retry(), make sure to return its return value.`); 32531 } 32532 // interop module default 32533 if (comp && 32534 (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) { 32535 comp = comp.default; 32536 } 32537 if (comp && !isObject(comp) && !isFunction(comp)) { 32538 throw new Error(`Invalid async component load result: ${comp}`); 32539 } 32540 return comp; 32541 }))); 32542 }; 32543 return () => { 32544 const component = load(); 32545 return { 32546 component, 32547 delay, 32548 timeout, 32549 error: errorComponent, 32550 loading: loadingComponent 32551 }; 32552 }; 32553} 32554 32555function createLifeCycle(hookName) { 32556 return (fn, target = currentInstance) => { 32557 if (!target) { 32558 warn$2(`${formatName(hookName)} is called when there is no active component instance to be ` + 32559 `associated with. ` + 32560 `Lifecycle injection APIs can only be used during execution of setup().`); 32561 return; 32562 } 32563 return injectHook(target, hookName, fn); 32564 }; 32565} 32566function formatName(name) { 32567 if (name === 'beforeDestroy') { 32568 name = 'beforeUnmount'; 32569 } 32570 else if (name === 'destroyed') { 32571 name = 'unmounted'; 32572 } 32573 return `on${name[0].toUpperCase() + name.slice(1)}`; 32574} 32575function injectHook(instance, hookName, fn) { 32576 const options = instance.$options; 32577 options[hookName] = mergeLifecycleHook(options[hookName], fn); 32578} 32579const onBeforeMount = createLifeCycle('beforeMount'); 32580const onMounted = createLifeCycle('mounted'); 32581const onBeforeUpdate = createLifeCycle('beforeUpdate'); 32582const onUpdated = createLifeCycle('updated'); 32583const onBeforeUnmount = createLifeCycle('beforeDestroy'); 32584const onUnmounted = createLifeCycle('destroyed'); 32585const onActivated = createLifeCycle('activated'); 32586const onDeactivated = createLifeCycle('deactivated'); 32587const onServerPrefetch = createLifeCycle('serverPrefetch'); 32588const onRenderTracked = createLifeCycle('renderTracked'); 32589const onRenderTriggered = createLifeCycle('renderTriggered'); 32590const injectErrorCapturedHook = createLifeCycle('errorCaptured'); 32591function onErrorCaptured(hook, target = currentInstance) { 32592 injectErrorCapturedHook(hook, target); 32593} 32594 32595/** 32596 * Note: also update dist/vue.runtime.mjs when adding new exports to this file. 32597 */ 32598const version = '2.7.16'; 32599/** 32600 * @internal type is manually declared in <root>/types/v3-define-component.d.ts 32601 */ 32602function defineComponent(options) { 32603 return options; 32604} 32605 32606var vca = /*#__PURE__*/Object.freeze({ 32607 __proto__: null, 32608 version: version, 32609 defineComponent: defineComponent, 32610 ref: ref$1, 32611 shallowRef: shallowRef, 32612 isRef: isRef, 32613 toRef: toRef, 32614 toRefs: toRefs, 32615 unref: unref, 32616 proxyRefs: proxyRefs, 32617 customRef: customRef, 32618 triggerRef: triggerRef, 32619 reactive: reactive, 32620 isReactive: isReactive, 32621 isReadonly: isReadonly, 32622 isShallow: isShallow, 32623 isProxy: isProxy, 32624 shallowReactive: shallowReactive, 32625 markRaw: markRaw, 32626 toRaw: toRaw, 32627 readonly: readonly, 32628 shallowReadonly: shallowReadonly, 32629 computed: computed, 32630 watch: watch, 32631 watchEffect: watchEffect, 32632 watchPostEffect: watchPostEffect, 32633 watchSyncEffect: watchSyncEffect, 32634 EffectScope: EffectScope, 32635 effectScope: effectScope, 32636 onScopeDispose: onScopeDispose, 32637 getCurrentScope: getCurrentScope, 32638 provide: provide, 32639 inject: inject, 32640 h: h, 32641 getCurrentInstance: getCurrentInstance, 32642 useSlots: useSlots, 32643 useAttrs: useAttrs, 32644 useListeners: useListeners, 32645 mergeDefaults: mergeDefaults, 32646 nextTick: nextTick, 32647 set: set, 32648 del: del, 32649 useCssModule: useCssModule, 32650 useCssVars: useCssVars, 32651 defineAsyncComponent: defineAsyncComponent, 32652 onBeforeMount: onBeforeMount, 32653 onMounted: onMounted, 32654 onBeforeUpdate: onBeforeUpdate, 32655 onUpdated: onUpdated, 32656 onBeforeUnmount: onBeforeUnmount, 32657 onUnmounted: onUnmounted, 32658 onActivated: onActivated, 32659 onDeactivated: onDeactivated, 32660 onServerPrefetch: onServerPrefetch, 32661 onRenderTracked: onRenderTracked, 32662 onRenderTriggered: onRenderTriggered, 32663 onErrorCaptured: onErrorCaptured 32664}); 32665 32666const seenObjects = new _Set(); 32667/** 32668 * Recursively traverse an object to evoke all converted 32669 * getters, so that every nested property inside the object 32670 * is collected as a "deep" dependency. 32671 */ 32672function traverse(val) { 32673 _traverse(val, seenObjects); 32674 seenObjects.clear(); 32675 return val; 32676} 32677function _traverse(val, seen) { 32678 let i, keys; 32679 const isA = isArray(val); 32680 if ((!isA && !isObject(val)) || 32681 val.__v_skip /* ReactiveFlags.SKIP */ || 32682 Object.isFrozen(val) || 32683 val instanceof VNode) { 32684 return; 32685 } 32686 if (val.__ob__) { 32687 const depId = val.__ob__.dep.id; 32688 if (seen.has(depId)) { 32689 return; 32690 } 32691 seen.add(depId); 32692 } 32693 if (isA) { 32694 i = val.length; 32695 while (i--) 32696 _traverse(val[i], seen); 32697 } 32698 else if (isRef(val)) { 32699 _traverse(val.value, seen); 32700 } 32701 else { 32702 keys = Object.keys(val); 32703 i = keys.length; 32704 while (i--) 32705 _traverse(val[keys[i]], seen); 32706 } 32707} 32708 32709let uid$1 = 0; 32710/** 32711 * A watcher parses an expression, collects dependencies, 32712 * and fires callback when the expression value changes. 32713 * This is used for both the $watch() api and directives. 32714 * @internal 32715 */ 32716class Watcher { 32717 constructor(vm, expOrFn, cb, options, isRenderWatcher) { 32718 recordEffectScope(this, 32719 // if the active effect scope is manually created (not a component scope), 32720 // prioritize it 32721 activeEffectScope && !activeEffectScope._vm 32722 ? activeEffectScope 32723 : vm 32724 ? vm._scope 32725 : undefined); 32726 if ((this.vm = vm) && isRenderWatcher) { 32727 vm._watcher = this; 32728 } 32729 // options 32730 if (options) { 32731 this.deep = !!options.deep; 32732 this.user = !!options.user; 32733 this.lazy = !!options.lazy; 32734 this.sync = !!options.sync; 32735 this.before = options.before; 32736 { 32737 this.onTrack = options.onTrack; 32738 this.onTrigger = options.onTrigger; 32739 } 32740 } 32741 else { 32742 this.deep = this.user = this.lazy = this.sync = false; 32743 } 32744 this.cb = cb; 32745 this.id = ++uid$1; // uid for batching 32746 this.active = true; 32747 this.post = false; 32748 this.dirty = this.lazy; // for lazy watchers 32749 this.deps = []; 32750 this.newDeps = []; 32751 this.depIds = new _Set(); 32752 this.newDepIds = new _Set(); 32753 this.expression = expOrFn.toString() ; 32754 // parse expression for getter 32755 if (isFunction(expOrFn)) { 32756 this.getter = expOrFn; 32757 } 32758 else { 32759 this.getter = parsePath(expOrFn); 32760 if (!this.getter) { 32761 this.getter = noop; 32762 warn$2(`Failed watching path: "${expOrFn}" ` + 32763 'Watcher only accepts simple dot-delimited paths. ' + 32764 'For full control, use a function instead.', vm); 32765 } 32766 } 32767 this.value = this.lazy ? undefined : this.get(); 32768 } 32769 /** 32770 * Evaluate the getter, and re-collect dependencies. 32771 */ 32772 get() { 32773 pushTarget(this); 32774 let value; 32775 const vm = this.vm; 32776 try { 32777 value = this.getter.call(vm, vm); 32778 } 32779 catch (e) { 32780 if (this.user) { 32781 handleError(e, vm, `getter for watcher "${this.expression}"`); 32782 } 32783 else { 32784 throw e; 32785 } 32786 } 32787 finally { 32788 // "touch" every property so they are all tracked as 32789 // dependencies for deep watching 32790 if (this.deep) { 32791 traverse(value); 32792 } 32793 popTarget(); 32794 this.cleanupDeps(); 32795 } 32796 return value; 32797 } 32798 /** 32799 * Add a dependency to this directive. 32800 */ 32801 addDep(dep) { 32802 const id = dep.id; 32803 if (!this.newDepIds.has(id)) { 32804 this.newDepIds.add(id); 32805 this.newDeps.push(dep); 32806 if (!this.depIds.has(id)) { 32807 dep.addSub(this); 32808 } 32809 } 32810 } 32811 /** 32812 * Clean up for dependency collection. 32813 */ 32814 cleanupDeps() { 32815 let i = this.deps.length; 32816 while (i--) { 32817 const dep = this.deps[i]; 32818 if (!this.newDepIds.has(dep.id)) { 32819 dep.removeSub(this); 32820 } 32821 } 32822 let tmp = this.depIds; 32823 this.depIds = this.newDepIds; 32824 this.newDepIds = tmp; 32825 this.newDepIds.clear(); 32826 tmp = this.deps; 32827 this.deps = this.newDeps; 32828 this.newDeps = tmp; 32829 this.newDeps.length = 0; 32830 } 32831 /** 32832 * Subscriber interface. 32833 * Will be called when a dependency changes. 32834 */ 32835 update() { 32836 /* istanbul ignore else */ 32837 if (this.lazy) { 32838 this.dirty = true; 32839 } 32840 else if (this.sync) { 32841 this.run(); 32842 } 32843 else { 32844 queueWatcher(this); 32845 } 32846 } 32847 /** 32848 * Scheduler job interface. 32849 * Will be called by the scheduler. 32850 */ 32851 run() { 32852 if (this.active) { 32853 const value = this.get(); 32854 if (value !== this.value || 32855 // Deep watchers and watchers on Object/Arrays should fire even 32856 // when the value is the same, because the value may 32857 // have mutated. 32858 isObject(value) || 32859 this.deep) { 32860 // set new value 32861 const oldValue = this.value; 32862 this.value = value; 32863 if (this.user) { 32864 const info = `callback for watcher "${this.expression}"`; 32865 invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info); 32866 } 32867 else { 32868 this.cb.call(this.vm, value, oldValue); 32869 } 32870 } 32871 } 32872 } 32873 /** 32874 * Evaluate the value of the watcher. 32875 * This only gets called for lazy watchers. 32876 */ 32877 evaluate() { 32878 this.value = this.get(); 32879 this.dirty = false; 32880 } 32881 /** 32882 * Depend on all deps collected by this watcher. 32883 */ 32884 depend() { 32885 let i = this.deps.length; 32886 while (i--) { 32887 this.deps[i].depend(); 32888 } 32889 } 32890 /** 32891 * Remove self from all dependencies' subscriber list. 32892 */ 32893 teardown() { 32894 if (this.vm && !this.vm._isBeingDestroyed) { 32895 remove$2(this.vm._scope.effects, this); 32896 } 32897 if (this.active) { 32898 let i = this.deps.length; 32899 while (i--) { 32900 this.deps[i].removeSub(this); 32901 } 32902 this.active = false; 32903 if (this.onStop) { 32904 this.onStop(); 32905 } 32906 } 32907 } 32908} 32909 32910const sharedPropertyDefinition = { 32911 enumerable: true, 32912 configurable: true, 32913 get: noop, 32914 set: noop 32915}; 32916function proxy(target, sourceKey, key) { 32917 sharedPropertyDefinition.get = function proxyGetter() { 32918 return this[sourceKey][key]; 32919 }; 32920 sharedPropertyDefinition.set = function proxySetter(val) { 32921 this[sourceKey][key] = val; 32922 }; 32923 Object.defineProperty(target, key, sharedPropertyDefinition); 32924} 32925function initState(vm) { 32926 const opts = vm.$options; 32927 if (opts.props) 32928 initProps$1(vm, opts.props); 32929 // Composition API 32930 initSetup(vm); 32931 if (opts.methods) 32932 initMethods(vm, opts.methods); 32933 if (opts.data) { 32934 initData(vm); 32935 } 32936 else { 32937 const ob = observe((vm._data = {})); 32938 ob && ob.vmCount++; 32939 } 32940 if (opts.computed) 32941 initComputed$1(vm, opts.computed); 32942 if (opts.watch && opts.watch !== nativeWatch) { 32943 initWatch(vm, opts.watch); 32944 } 32945} 32946function initProps$1(vm, propsOptions) { 32947 const propsData = vm.$options.propsData || {}; 32948 const props = (vm._props = shallowReactive({})); 32949 // cache prop keys so that future props updates can iterate using Array 32950 // instead of dynamic object key enumeration. 32951 const keys = (vm.$options._propKeys = []); 32952 const isRoot = !vm.$parent; 32953 // root instance props should be converted 32954 if (!isRoot) { 32955 toggleObserving(false); 32956 } 32957 for (const key in propsOptions) { 32958 keys.push(key); 32959 const value = validateProp(key, propsOptions, propsData, vm); 32960 /* istanbul ignore else */ 32961 { 32962 const hyphenatedKey = hyphenate(key); 32963 if (isReservedAttribute(hyphenatedKey) || 32964 config.isReservedAttr(hyphenatedKey)) { 32965 warn$2(`"${hyphenatedKey}" is a reserved attribute and cannot be used as component prop.`, vm); 32966 } 32967 defineReactive(props, key, value, () => { 32968 if (!isRoot && !isUpdatingChildComponent) { 32969 warn$2(`Avoid mutating a prop directly since the value will be ` + 32970 `overwritten whenever the parent component re-renders. ` + 32971 `Instead, use a data or computed property based on the prop's ` + 32972 `value. Prop being mutated: "${key}"`, vm); 32973 } 32974 }, true /* shallow */); 32975 } 32976 // static props are already proxied on the component's prototype 32977 // during Vue.extend(). We only need to proxy props defined at 32978 // instantiation here. 32979 if (!(key in vm)) { 32980 proxy(vm, `_props`, key); 32981 } 32982 } 32983 toggleObserving(true); 32984} 32985function initData(vm) { 32986 let data = vm.$options.data; 32987 data = vm._data = isFunction(data) ? getData(data, vm) : data || {}; 32988 if (!isPlainObject(data)) { 32989 data = {}; 32990 warn$2('data functions should return an object:\n' + 32991 'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm); 32992 } 32993 // proxy data on instance 32994 const keys = Object.keys(data); 32995 const props = vm.$options.props; 32996 const methods = vm.$options.methods; 32997 let i = keys.length; 32998 while (i--) { 32999 const key = keys[i]; 33000 { 33001 if (methods && hasOwn(methods, key)) { 33002 warn$2(`Method "${key}" has already been defined as a data property.`, vm); 33003 } 33004 } 33005 if (props && hasOwn(props, key)) { 33006 warn$2(`The data property "${key}" is already declared as a prop. ` + 33007 `Use prop default value instead.`, vm); 33008 } 33009 else if (!isReserved(key)) { 33010 proxy(vm, `_data`, key); 33011 } 33012 } 33013 // observe data 33014 const ob = observe(data); 33015 ob && ob.vmCount++; 33016} 33017function getData(data, vm) { 33018 // #7573 disable dep collection when invoking data getters 33019 pushTarget(); 33020 try { 33021 return data.call(vm, vm); 33022 } 33023 catch (e) { 33024 handleError(e, vm, `data()`); 33025 return {}; 33026 } 33027 finally { 33028 popTarget(); 33029 } 33030} 33031const computedWatcherOptions = { lazy: true }; 33032function initComputed$1(vm, computed) { 33033 // $flow-disable-line 33034 const watchers = (vm._computedWatchers = Object.create(null)); 33035 // computed properties are just getters during SSR 33036 const isSSR = isServerRendering(); 33037 for (const key in computed) { 33038 const userDef = computed[key]; 33039 const getter = isFunction(userDef) ? userDef : userDef.get; 33040 if (getter == null) { 33041 warn$2(`Getter is missing for computed property "${key}".`, vm); 33042 } 33043 if (!isSSR) { 33044 // create internal watcher for the computed property. 33045 watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions); 33046 } 33047 // component-defined computed properties are already defined on the 33048 // component prototype. We only need to define computed properties defined 33049 // at instantiation here. 33050 if (!(key in vm)) { 33051 defineComputed(vm, key, userDef); 33052 } 33053 else { 33054 if (key in vm.$data) { 33055 warn$2(`The computed property "${key}" is already defined in data.`, vm); 33056 } 33057 else if (vm.$options.props && key in vm.$options.props) { 33058 warn$2(`The computed property "${key}" is already defined as a prop.`, vm); 33059 } 33060 else if (vm.$options.methods && key in vm.$options.methods) { 33061 warn$2(`The computed property "${key}" is already defined as a method.`, vm); 33062 } 33063 } 33064 } 33065} 33066function defineComputed(target, key, userDef) { 33067 const shouldCache = !isServerRendering(); 33068 if (isFunction(userDef)) { 33069 sharedPropertyDefinition.get = shouldCache 33070 ? createComputedGetter(key) 33071 : createGetterInvoker(userDef); 33072 sharedPropertyDefinition.set = noop; 33073 } 33074 else { 33075 sharedPropertyDefinition.get = userDef.get 33076 ? shouldCache && userDef.cache !== false 33077 ? createComputedGetter(key) 33078 : createGetterInvoker(userDef.get) 33079 : noop; 33080 sharedPropertyDefinition.set = userDef.set || noop; 33081 } 33082 if (sharedPropertyDefinition.set === noop) { 33083 sharedPropertyDefinition.set = function () { 33084 warn$2(`Computed property "${key}" was assigned to but it has no setter.`, this); 33085 }; 33086 } 33087 Object.defineProperty(target, key, sharedPropertyDefinition); 33088} 33089function createComputedGetter(key) { 33090 return function computedGetter() { 33091 const watcher = this._computedWatchers && this._computedWatchers[key]; 33092 if (watcher) { 33093 if (watcher.dirty) { 33094 watcher.evaluate(); 33095 } 33096 if (Dep.target) { 33097 if (Dep.target.onTrack) { 33098 Dep.target.onTrack({ 33099 effect: Dep.target, 33100 target: this, 33101 type: "get" /* TrackOpTypes.GET */, 33102 key 33103 }); 33104 } 33105 watcher.depend(); 33106 } 33107 return watcher.value; 33108 } 33109 }; 33110} 33111function createGetterInvoker(fn) { 33112 return function computedGetter() { 33113 return fn.call(this, this); 33114 }; 33115} 33116function initMethods(vm, methods) { 33117 const props = vm.$options.props; 33118 for (const key in methods) { 33119 { 33120 if (typeof methods[key] !== 'function') { 33121 warn$2(`Method "${key}" has type "${typeof methods[key]}" in the component definition. ` + 33122 `Did you reference the function correctly?`, vm); 33123 } 33124 if (props && hasOwn(props, key)) { 33125 warn$2(`Method "${key}" has already been defined as a prop.`, vm); 33126 } 33127 if (key in vm && isReserved(key)) { 33128 warn$2(`Method "${key}" conflicts with an existing Vue instance method. ` + 33129 `Avoid defining component methods that start with _ or $.`); 33130 } 33131 } 33132 vm[key] = typeof methods[key] !== 'function' ? noop : bind$1(methods[key], vm); 33133 } 33134} 33135function initWatch(vm, watch) { 33136 for (const key in watch) { 33137 const handler = watch[key]; 33138 if (isArray(handler)) { 33139 for (let i = 0; i < handler.length; i++) { 33140 createWatcher(vm, key, handler[i]); 33141 } 33142 } 33143 else { 33144 createWatcher(vm, key, handler); 33145 } 33146 } 33147} 33148function createWatcher(vm, expOrFn, handler, options) { 33149 if (isPlainObject(handler)) { 33150 options = handler; 33151 handler = handler.handler; 33152 } 33153 if (typeof handler === 'string') { 33154 handler = vm[handler]; 33155 } 33156 return vm.$watch(expOrFn, handler, options); 33157} 33158function stateMixin(Vue) { 33159 // flow somehow has problems with directly declared definition object 33160 // when using Object.defineProperty, so we have to procedurally build up 33161 // the object here. 33162 const dataDef = {}; 33163 dataDef.get = function () { 33164 return this._data; 33165 }; 33166 const propsDef = {}; 33167 propsDef.get = function () { 33168 return this._props; 33169 }; 33170 { 33171 dataDef.set = function () { 33172 warn$2('Avoid replacing instance root $data. ' + 33173 'Use nested data properties instead.', this); 33174 }; 33175 propsDef.set = function () { 33176 warn$2(`$props is readonly.`, this); 33177 }; 33178 } 33179 Object.defineProperty(Vue.prototype, '$data', dataDef); 33180 Object.defineProperty(Vue.prototype, '$props', propsDef); 33181 Vue.prototype.$set = set; 33182 Vue.prototype.$delete = del; 33183 Vue.prototype.$watch = function (expOrFn, cb, options) { 33184 const vm = this; 33185 if (isPlainObject(cb)) { 33186 return createWatcher(vm, expOrFn, cb, options); 33187 } 33188 options = options || {}; 33189 options.user = true; 33190 const watcher = new Watcher(vm, expOrFn, cb, options); 33191 if (options.immediate) { 33192 const info = `callback for immediate watcher "${watcher.expression}"`; 33193 pushTarget(); 33194 invokeWithErrorHandling(cb, vm, [watcher.value], vm, info); 33195 popTarget(); 33196 } 33197 return function unwatchFn() { 33198 watcher.teardown(); 33199 }; 33200 }; 33201} 33202 33203function initProvide(vm) { 33204 const provideOption = vm.$options.provide; 33205 if (provideOption) { 33206 const provided = isFunction(provideOption) 33207 ? provideOption.call(vm) 33208 : provideOption; 33209 if (!isObject(provided)) { 33210 return; 33211 } 33212 const source = resolveProvided(vm); 33213 // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to 33214 // iterate the keys ourselves. 33215 const keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided); 33216 for (let i = 0; i < keys.length; i++) { 33217 const key = keys[i]; 33218 Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key)); 33219 } 33220 } 33221} 33222function initInjections(vm) { 33223 const result = resolveInject(vm.$options.inject, vm); 33224 if (result) { 33225 toggleObserving(false); 33226 Object.keys(result).forEach(key => { 33227 /* istanbul ignore else */ 33228 { 33229 defineReactive(vm, key, result[key], () => { 33230 warn$2(`Avoid mutating an injected value directly since the changes will be ` + 33231 `overwritten whenever the provided component re-renders. ` + 33232 `injection being mutated: "${key}"`, vm); 33233 }); 33234 } 33235 }); 33236 toggleObserving(true); 33237 } 33238} 33239function resolveInject(inject, vm) { 33240 if (inject) { 33241 // inject is :any because flow is not smart enough to figure out cached 33242 const result = Object.create(null); 33243 const keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject); 33244 for (let i = 0; i < keys.length; i++) { 33245 const key = keys[i]; 33246 // #6574 in case the inject object is observed... 33247 if (key === '__ob__') 33248 continue; 33249 const provideKey = inject[key].from; 33250 if (provideKey in vm._provided) { 33251 result[key] = vm._provided[provideKey]; 33252 } 33253 else if ('default' in inject[key]) { 33254 const provideDefault = inject[key].default; 33255 result[key] = isFunction(provideDefault) 33256 ? provideDefault.call(vm) 33257 : provideDefault; 33258 } 33259 else { 33260 warn$2(`Injection "${key}" not found`, vm); 33261 } 33262 } 33263 return result; 33264 } 33265} 33266 33267let uid = 0; 33268function initMixin$1(Vue) { 33269 Vue.prototype._init = function (options) { 33270 const vm = this; 33271 // a uid 33272 vm._uid = uid++; 33273 let startTag, endTag; 33274 /* istanbul ignore if */ 33275 if (config.performance && mark) { 33276 startTag = `vue-perf-start:${vm._uid}`; 33277 endTag = `vue-perf-end:${vm._uid}`; 33278 mark(startTag); 33279 } 33280 // a flag to mark this as a Vue instance without having to do instanceof 33281 // check 33282 vm._isVue = true; 33283 // avoid instances from being observed 33284 vm.__v_skip = true; 33285 // effect scope 33286 vm._scope = new EffectScope(true /* detached */); 33287 // #13134 edge case where a child component is manually created during the 33288 // render of a parent component 33289 vm._scope.parent = undefined; 33290 vm._scope._vm = true; 33291 // merge options 33292 if (options && options._isComponent) { 33293 // optimize internal component instantiation 33294 // since dynamic options merging is pretty slow, and none of the 33295 // internal component options needs special treatment. 33296 initInternalComponent(vm, options); 33297 } 33298 else { 33299 vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm); 33300 } 33301 /* istanbul ignore else */ 33302 { 33303 initProxy(vm); 33304 } 33305 // expose real self 33306 vm._self = vm; 33307 initLifecycle(vm); 33308 initEvents(vm); 33309 initRender(vm); 33310 callHook$1(vm, 'beforeCreate', undefined, false /* setContext */); 33311 initInjections(vm); // resolve injections before data/props 33312 initState(vm); 33313 initProvide(vm); // resolve provide after data/props 33314 callHook$1(vm, 'created'); 33315 /* istanbul ignore if */ 33316 if (config.performance && mark) { 33317 vm._name = formatComponentName(vm, false); 33318 mark(endTag); 33319 measure(`vue ${vm._name} init`, startTag, endTag); 33320 } 33321 if (vm.$options.el) { 33322 vm.$mount(vm.$options.el); 33323 } 33324 }; 33325} 33326function initInternalComponent(vm, options) { 33327 const opts = (vm.$options = Object.create(vm.constructor.options)); 33328 // doing this because it's faster than dynamic enumeration. 33329 const parentVnode = options._parentVnode; 33330 opts.parent = options.parent; 33331 opts._parentVnode = parentVnode; 33332 const vnodeComponentOptions = parentVnode.componentOptions; 33333 opts.propsData = vnodeComponentOptions.propsData; 33334 opts._parentListeners = vnodeComponentOptions.listeners; 33335 opts._renderChildren = vnodeComponentOptions.children; 33336 opts._componentTag = vnodeComponentOptions.tag; 33337 if (options.render) { 33338 opts.render = options.render; 33339 opts.staticRenderFns = options.staticRenderFns; 33340 } 33341} 33342function resolveConstructorOptions(Ctor) { 33343 let options = Ctor.options; 33344 if (Ctor.super) { 33345 const superOptions = resolveConstructorOptions(Ctor.super); 33346 const cachedSuperOptions = Ctor.superOptions; 33347 if (superOptions !== cachedSuperOptions) { 33348 // super option changed, 33349 // need to resolve new options. 33350 Ctor.superOptions = superOptions; 33351 // check if there are any late-modified/attached options (#4976) 33352 const modifiedOptions = resolveModifiedOptions(Ctor); 33353 // update base extend options 33354 if (modifiedOptions) { 33355 extend(Ctor.extendOptions, modifiedOptions); 33356 } 33357 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions); 33358 if (options.name) { 33359 options.components[options.name] = Ctor; 33360 } 33361 } 33362 } 33363 return options; 33364} 33365function resolveModifiedOptions(Ctor) { 33366 let modified; 33367 const latest = Ctor.options; 33368 const sealed = Ctor.sealedOptions; 33369 for (const key in latest) { 33370 if (latest[key] !== sealed[key]) { 33371 if (!modified) 33372 modified = {}; 33373 modified[key] = latest[key]; 33374 } 33375 } 33376 return modified; 33377} 33378 33379function FunctionalRenderContext(data, props, children, parent, Ctor) { 33380 const options = Ctor.options; 33381 // ensure the createElement function in functional components 33382 // gets a unique context - this is necessary for correct named slot check 33383 let contextVm; 33384 if (hasOwn(parent, '_uid')) { 33385 contextVm = Object.create(parent); 33386 contextVm._original = parent; 33387 } 33388 else { 33389 // the context vm passed in is a functional context as well. 33390 // in this case we want to make sure we are able to get a hold to the 33391 // real context instance. 33392 contextVm = parent; 33393 // @ts-ignore 33394 parent = parent._original; 33395 } 33396 const isCompiled = isTrue(options._compiled); 33397 const needNormalization = !isCompiled; 33398 this.data = data; 33399 this.props = props; 33400 this.children = children; 33401 this.parent = parent; 33402 this.listeners = data.on || emptyObject; 33403 this.injections = resolveInject(options.inject, parent); 33404 this.slots = () => { 33405 if (!this.$slots) { 33406 normalizeScopedSlots(parent, data.scopedSlots, (this.$slots = resolveSlots(children, parent))); 33407 } 33408 return this.$slots; 33409 }; 33410 Object.defineProperty(this, 'scopedSlots', { 33411 enumerable: true, 33412 get() { 33413 return normalizeScopedSlots(parent, data.scopedSlots, this.slots()); 33414 } 33415 }); 33416 // support for compiled functional template 33417 if (isCompiled) { 33418 // exposing $options for renderStatic() 33419 this.$options = options; 33420 // pre-resolve slots for renderSlot() 33421 this.$slots = this.slots(); 33422 this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots); 33423 } 33424 if (options._scopeId) { 33425 this._c = (a, b, c, d) => { 33426 const vnode = createElement$1(contextVm, a, b, c, d, needNormalization); 33427 if (vnode && !isArray(vnode)) { 33428 vnode.fnScopeId = options._scopeId; 33429 vnode.fnContext = parent; 33430 } 33431 return vnode; 33432 }; 33433 } 33434 else { 33435 this._c = (a, b, c, d) => createElement$1(contextVm, a, b, c, d, needNormalization); 33436 } 33437} 33438installRenderHelpers(FunctionalRenderContext.prototype); 33439function createFunctionalComponent(Ctor, propsData, data, contextVm, children) { 33440 const options = Ctor.options; 33441 const props = {}; 33442 const propOptions = options.props; 33443 if (isDef(propOptions)) { 33444 for (const key in propOptions) { 33445 props[key] = validateProp(key, propOptions, propsData || emptyObject); 33446 } 33447 } 33448 else { 33449 if (isDef(data.attrs)) 33450 mergeProps(props, data.attrs); 33451 if (isDef(data.props)) 33452 mergeProps(props, data.props); 33453 } 33454 const renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor); 33455 const vnode = options.render.call(null, renderContext._c, renderContext); 33456 if (vnode instanceof VNode) { 33457 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext); 33458 } 33459 else if (isArray(vnode)) { 33460 const vnodes = normalizeChildren(vnode) || []; 33461 const res = new Array(vnodes.length); 33462 for (let i = 0; i < vnodes.length; i++) { 33463 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); 33464 } 33465 return res; 33466 } 33467} 33468function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) { 33469 // #7817 clone node before setting fnContext, otherwise if the node is reused 33470 // (e.g. it was from a cached normal slot) the fnContext causes named slots 33471 // that should not be matched to match. 33472 const clone = cloneVNode(vnode); 33473 clone.fnContext = contextVm; 33474 clone.fnOptions = options; 33475 { 33476 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = 33477 renderContext; 33478 } 33479 if (data.slot) { 33480 (clone.data || (clone.data = {})).slot = data.slot; 33481 } 33482 return clone; 33483} 33484function mergeProps(to, from) { 33485 for (const key in from) { 33486 to[camelize(key)] = from[key]; 33487 } 33488} 33489 33490function getComponentName(options) { 33491 return options.name || options.__name || options._componentTag; 33492} 33493// inline hooks to be invoked on component VNodes during patch 33494const componentVNodeHooks = { 33495 init(vnode, hydrating) { 33496 if (vnode.componentInstance && 33497 !vnode.componentInstance._isDestroyed && 33498 vnode.data.keepAlive) { 33499 // kept-alive components, treat as a patch 33500 const mountedNode = vnode; // work around flow 33501 componentVNodeHooks.prepatch(mountedNode, mountedNode); 33502 } 33503 else { 33504 const child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance)); 33505 child.$mount(hydrating ? vnode.elm : undefined, hydrating); 33506 } 33507 }, 33508 prepatch(oldVnode, vnode) { 33509 const options = vnode.componentOptions; 33510 const child = (vnode.componentInstance = oldVnode.componentInstance); 33511 updateChildComponent(child, options.propsData, // updated props 33512 options.listeners, // updated listeners 33513 vnode, // new parent vnode 33514 options.children // new children 33515 ); 33516 }, 33517 insert(vnode) { 33518 const { context, componentInstance } = vnode; 33519 if (!componentInstance._isMounted) { 33520 componentInstance._isMounted = true; 33521 callHook$1(componentInstance, 'mounted'); 33522 } 33523 if (vnode.data.keepAlive) { 33524 if (context._isMounted) { 33525 // vue-router#1212 33526 // During updates, a kept-alive component's child components may 33527 // change, so directly walking the tree here may call activated hooks 33528 // on incorrect children. Instead we push them into a queue which will 33529 // be processed after the whole patch process ended. 33530 queueActivatedComponent(componentInstance); 33531 } 33532 else { 33533 activateChildComponent(componentInstance, true /* direct */); 33534 } 33535 } 33536 }, 33537 destroy(vnode) { 33538 const { componentInstance } = vnode; 33539 if (!componentInstance._isDestroyed) { 33540 if (!vnode.data.keepAlive) { 33541 componentInstance.$destroy(); 33542 } 33543 else { 33544 deactivateChildComponent(componentInstance, true /* direct */); 33545 } 33546 } 33547 } 33548}; 33549const hooksToMerge = Object.keys(componentVNodeHooks); 33550function createComponent(Ctor, data, context, children, tag) { 33551 if (isUndef(Ctor)) { 33552 return; 33553 } 33554 const baseCtor = context.$options._base; 33555 // plain options object: turn it into a constructor 33556 if (isObject(Ctor)) { 33557 Ctor = baseCtor.extend(Ctor); 33558 } 33559 // if at this stage it's not a constructor or an async component factory, 33560 // reject. 33561 if (typeof Ctor !== 'function') { 33562 { 33563 warn$2(`Invalid Component definition: ${String(Ctor)}`, context); 33564 } 33565 return; 33566 } 33567 // async component 33568 let asyncFactory; 33569 // @ts-expect-error 33570 if (isUndef(Ctor.cid)) { 33571 asyncFactory = Ctor; 33572 Ctor = resolveAsyncComponent(asyncFactory, baseCtor); 33573 if (Ctor === undefined) { 33574 // return a placeholder node for async component, which is rendered 33575 // as a comment node but preserves all the raw information for the node. 33576 // the information will be used for async server-rendering and hydration. 33577 return createAsyncPlaceholder(asyncFactory, data, context, children, tag); 33578 } 33579 } 33580 data = data || {}; 33581 // resolve constructor options in case global mixins are applied after 33582 // component constructor creation 33583 resolveConstructorOptions(Ctor); 33584 // transform component v-model data into props & events 33585 if (isDef(data.model)) { 33586 // @ts-expect-error 33587 transformModel(Ctor.options, data); 33588 } 33589 // extract props 33590 // @ts-expect-error 33591 const propsData = extractPropsFromVNodeData(data, Ctor, tag); 33592 // functional component 33593 // @ts-expect-error 33594 if (isTrue(Ctor.options.functional)) { 33595 return createFunctionalComponent(Ctor, propsData, data, context, children); 33596 } 33597 // extract listeners, since these needs to be treated as 33598 // child component listeners instead of DOM listeners 33599 const listeners = data.on; 33600 // replace with listeners with .native modifier 33601 // so it gets processed during parent component patch. 33602 data.on = data.nativeOn; 33603 // @ts-expect-error 33604 if (isTrue(Ctor.options.abstract)) { 33605 // abstract components do not keep anything 33606 // other than props & listeners & slot 33607 // work around flow 33608 const slot = data.slot; 33609 data = {}; 33610 if (slot) { 33611 data.slot = slot; 33612 } 33613 } 33614 // install component management hooks onto the placeholder node 33615 installComponentHooks(data); 33616 // return a placeholder vnode 33617 // @ts-expect-error 33618 const name = getComponentName(Ctor.options) || tag; 33619 const vnode = new VNode( 33620 // @ts-expect-error 33621 `vue-component-${Ctor.cid}${name ? `-${name}` : ''}`, data, undefined, undefined, undefined, context, 33622 // @ts-expect-error 33623 { Ctor, propsData, listeners, tag, children }, asyncFactory); 33624 return vnode; 33625} 33626function createComponentInstanceForVnode( 33627// we know it's MountedComponentVNode but flow doesn't 33628vnode, 33629// activeInstance in lifecycle state 33630parent) { 33631 const options = { 33632 _isComponent: true, 33633 _parentVnode: vnode, 33634 parent 33635 }; 33636 // check inline-template render functions 33637 const inlineTemplate = vnode.data.inlineTemplate; 33638 if (isDef(inlineTemplate)) { 33639 options.render = inlineTemplate.render; 33640 options.staticRenderFns = inlineTemplate.staticRenderFns; 33641 } 33642 return new vnode.componentOptions.Ctor(options); 33643} 33644function installComponentHooks(data) { 33645 const hooks = data.hook || (data.hook = {}); 33646 for (let i = 0; i < hooksToMerge.length; i++) { 33647 const key = hooksToMerge[i]; 33648 const existing = hooks[key]; 33649 const toMerge = componentVNodeHooks[key]; 33650 // @ts-expect-error 33651 if (existing !== toMerge && !(existing && existing._merged)) { 33652 hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge; 33653 } 33654 } 33655} 33656function mergeHook(f1, f2) { 33657 const merged = (a, b) => { 33658 // flow complains about extra args which is why we use any 33659 f1(a, b); 33660 f2(a, b); 33661 }; 33662 merged._merged = true; 33663 return merged; 33664} 33665// transform component v-model info (value and callback) into 33666// prop and event handler respectively. 33667function transformModel(options, data) { 33668 const prop = (options.model && options.model.prop) || 'value'; 33669 const event = (options.model && options.model.event) || 'input'; 33670 (data.attrs || (data.attrs = {}))[prop] = data.model.value; 33671 const on = data.on || (data.on = {}); 33672 const existing = on[event]; 33673 const callback = data.model.callback; 33674 if (isDef(existing)) { 33675 if (isArray(existing) 33676 ? existing.indexOf(callback) === -1 33677 : existing !== callback) { 33678 on[event] = [callback].concat(existing); 33679 } 33680 } 33681 else { 33682 on[event] = callback; 33683 } 33684} 33685 33686let warn$2 = noop; 33687let tip = noop; 33688let generateComponentTrace; // work around flow check 33689let formatComponentName; 33690{ 33691 const hasConsole = typeof console !== 'undefined'; 33692 const classifyRE = /(?:^|[-_])(\w)/g; 33693 const classify = str => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, ''); 33694 warn$2 = (msg, vm = currentInstance) => { 33695 const trace = vm ? generateComponentTrace(vm) : ''; 33696 if (config.warnHandler) { 33697 config.warnHandler.call(null, msg, vm, trace); 33698 } 33699 else if (hasConsole && !config.silent) { 33700 console.error(`[Vue warn]: ${msg}${trace}`); 33701 } 33702 }; 33703 tip = (msg, vm) => { 33704 if (hasConsole && !config.silent) { 33705 console.warn(`[Vue tip]: ${msg}` + (vm ? generateComponentTrace(vm) : '')); 33706 } 33707 }; 33708 formatComponentName = (vm, includeFile) => { 33709 if (vm.$root === vm) { 33710 return '<Root>'; 33711 } 33712 const options = isFunction(vm) && vm.cid != null 33713 ? vm.options 33714 : vm._isVue 33715 ? vm.$options || vm.constructor.options 33716 : vm; 33717 let name = getComponentName(options); 33718 const file = options.__file; 33719 if (!name && file) { 33720 const match = file.match(/([^/\\]+)\.vue$/); 33721 name = match && match[1]; 33722 } 33723 return ((name ? `<${classify(name)}>` : `<Anonymous>`) + 33724 (file && includeFile !== false ? ` at ${file}` : '')); 33725 }; 33726 const repeat = (str, n) => { 33727 let res = ''; 33728 while (n) { 33729 if (n % 2 === 1) 33730 res += str; 33731 if (n > 1) 33732 str += str; 33733 n >>= 1; 33734 } 33735 return res; 33736 }; 33737 generateComponentTrace = (vm) => { 33738 if (vm._isVue && vm.$parent) { 33739 const tree = []; 33740 let currentRecursiveSequence = 0; 33741 while (vm) { 33742 if (tree.length > 0) { 33743 const last = tree[tree.length - 1]; 33744 if (last.constructor === vm.constructor) { 33745 currentRecursiveSequence++; 33746 vm = vm.$parent; 33747 continue; 33748 } 33749 else if (currentRecursiveSequence > 0) { 33750 tree[tree.length - 1] = [last, currentRecursiveSequence]; 33751 currentRecursiveSequence = 0; 33752 } 33753 } 33754 tree.push(vm); 33755 vm = vm.$parent; 33756 } 33757 return ('\n\nfound in\n\n' + 33758 tree 33759 .map((vm, i) => `${i === 0 ? '---> ' : repeat(' ', 5 + i * 2)}${isArray(vm) 33760 ? `${formatComponentName(vm[0])}... (${vm[1]} recursive calls)` 33761 : formatComponentName(vm)}`) 33762 .join('\n')); 33763 } 33764 else { 33765 return `\n\n(found in ${formatComponentName(vm)})`; 33766 } 33767 }; 33768} 33769 33770/** 33771 * Option overwriting strategies are functions that handle 33772 * how to merge a parent option value and a child option 33773 * value into the final value. 33774 */ 33775const strats = config.optionMergeStrategies; 33776/** 33777 * Options with restrictions 33778 */ 33779{ 33780 strats.el = strats.propsData = function (parent, child, vm, key) { 33781 if (!vm) { 33782 warn$2(`option "${key}" can only be used during instance ` + 33783 'creation with the `new` keyword.'); 33784 } 33785 return defaultStrat(parent, child); 33786 }; 33787} 33788/** 33789 * Helper that recursively merges two data objects together. 33790 */ 33791function mergeData(to, from, recursive = true) { 33792 if (!from) 33793 return to; 33794 let key, toVal, fromVal; 33795 const keys = hasSymbol 33796 ? Reflect.ownKeys(from) 33797 : Object.keys(from); 33798 for (let i = 0; i < keys.length; i++) { 33799 key = keys[i]; 33800 // in case the object is already observed... 33801 if (key === '__ob__') 33802 continue; 33803 toVal = to[key]; 33804 fromVal = from[key]; 33805 if (!recursive || !hasOwn(to, key)) { 33806 set(to, key, fromVal); 33807 } 33808 else if (toVal !== fromVal && 33809 isPlainObject(toVal) && 33810 isPlainObject(fromVal)) { 33811 mergeData(toVal, fromVal); 33812 } 33813 } 33814 return to; 33815} 33816/** 33817 * Data 33818 */ 33819function mergeDataOrFn(parentVal, childVal, vm) { 33820 if (!vm) { 33821 // in a Vue.extend merge, both should be functions 33822 if (!childVal) { 33823 return parentVal; 33824 } 33825 if (!parentVal) { 33826 return childVal; 33827 } 33828 // when parentVal & childVal are both present, 33829 // we need to return a function that returns the 33830 // merged result of both functions... no need to 33831 // check if parentVal is a function here because 33832 // it has to be a function to pass previous merges. 33833 return function mergedDataFn() { 33834 return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal); 33835 }; 33836 } 33837 else { 33838 return function mergedInstanceDataFn() { 33839 // instance merge 33840 const instanceData = isFunction(childVal) 33841 ? childVal.call(vm, vm) 33842 : childVal; 33843 const defaultData = isFunction(parentVal) 33844 ? parentVal.call(vm, vm) 33845 : parentVal; 33846 if (instanceData) { 33847 return mergeData(instanceData, defaultData); 33848 } 33849 else { 33850 return defaultData; 33851 } 33852 }; 33853 } 33854} 33855strats.data = function (parentVal, childVal, vm) { 33856 if (!vm) { 33857 if (childVal && typeof childVal !== 'function') { 33858 warn$2('The "data" option should be a function ' + 33859 'that returns a per-instance value in component ' + 33860 'definitions.', vm); 33861 return parentVal; 33862 } 33863 return mergeDataOrFn(parentVal, childVal); 33864 } 33865 return mergeDataOrFn(parentVal, childVal, vm); 33866}; 33867/** 33868 * Hooks and props are merged as arrays. 33869 */ 33870function mergeLifecycleHook(parentVal, childVal) { 33871 const res = childVal 33872 ? parentVal 33873 ? parentVal.concat(childVal) 33874 : isArray(childVal) 33875 ? childVal 33876 : [childVal] 33877 : parentVal; 33878 return res ? dedupeHooks(res) : res; 33879} 33880function dedupeHooks(hooks) { 33881 const res = []; 33882 for (let i = 0; i < hooks.length; i++) { 33883 if (res.indexOf(hooks[i]) === -1) { 33884 res.push(hooks[i]); 33885 } 33886 } 33887 return res; 33888} 33889LIFECYCLE_HOOKS.forEach(hook => { 33890 strats[hook] = mergeLifecycleHook; 33891}); 33892/** 33893 * Assets 33894 * 33895 * When a vm is present (instance creation), we need to do 33896 * a three-way merge between constructor options, instance 33897 * options and parent options. 33898 */ 33899function mergeAssets(parentVal, childVal, vm, key) { 33900 const res = Object.create(parentVal || null); 33901 if (childVal) { 33902 assertObjectType(key, childVal, vm); 33903 return extend(res, childVal); 33904 } 33905 else { 33906 return res; 33907 } 33908} 33909ASSET_TYPES.forEach(function (type) { 33910 strats[type + 's'] = mergeAssets; 33911}); 33912/** 33913 * Watchers. 33914 * 33915 * Watchers hashes should not overwrite one 33916 * another, so we merge them as arrays. 33917 */ 33918strats.watch = function (parentVal, childVal, vm, key) { 33919 // work around Firefox's Object.prototype.watch... 33920 //@ts-expect-error work around 33921 if (parentVal === nativeWatch) 33922 parentVal = undefined; 33923 //@ts-expect-error work around 33924 if (childVal === nativeWatch) 33925 childVal = undefined; 33926 /* istanbul ignore if */ 33927 if (!childVal) 33928 return Object.create(parentVal || null); 33929 { 33930 assertObjectType(key, childVal, vm); 33931 } 33932 if (!parentVal) 33933 return childVal; 33934 const ret = {}; 33935 extend(ret, parentVal); 33936 for (const key in childVal) { 33937 let parent = ret[key]; 33938 const child = childVal[key]; 33939 if (parent && !isArray(parent)) { 33940 parent = [parent]; 33941 } 33942 ret[key] = parent ? parent.concat(child) : isArray(child) ? child : [child]; 33943 } 33944 return ret; 33945}; 33946/** 33947 * Other object hashes. 33948 */ 33949strats.props = 33950 strats.methods = 33951 strats.inject = 33952 strats.computed = 33953 function (parentVal, childVal, vm, key) { 33954 if (childVal && true) { 33955 assertObjectType(key, childVal, vm); 33956 } 33957 if (!parentVal) 33958 return childVal; 33959 const ret = Object.create(null); 33960 extend(ret, parentVal); 33961 if (childVal) 33962 extend(ret, childVal); 33963 return ret; 33964 }; 33965strats.provide = function (parentVal, childVal) { 33966 if (!parentVal) 33967 return childVal; 33968 return function () { 33969 const ret = Object.create(null); 33970 mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal); 33971 if (childVal) { 33972 mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive 33973 ); 33974 } 33975 return ret; 33976 }; 33977}; 33978/** 33979 * Default strategy. 33980 */ 33981const defaultStrat = function (parentVal, childVal) { 33982 return childVal === undefined ? parentVal : childVal; 33983}; 33984/** 33985 * Validate component names 33986 */ 33987function checkComponents(options) { 33988 for (const key in options.components) { 33989 validateComponentName(key); 33990 } 33991} 33992function validateComponentName(name) { 33993 if (!new RegExp(`^[a-zA-Z][\\-\\.0-9_${unicodeRegExp.source}]*$`).test(name)) { 33994 warn$2('Invalid component name: "' + 33995 name + 33996 '". Component names ' + 33997 'should conform to valid custom element name in html5 specification.'); 33998 } 33999 if (isBuiltInTag(name) || config.isReservedTag(name)) { 34000 warn$2('Do not use built-in or reserved HTML elements as component ' + 34001 'id: ' + 34002 name); 34003 } 34004} 34005/** 34006 * Ensure all props option syntax are normalized into the 34007 * Object-based format. 34008 */ 34009function normalizeProps(options, vm) { 34010 const props = options.props; 34011 if (!props) 34012 return; 34013 const res = {}; 34014 let i, val, name; 34015 if (isArray(props)) { 34016 i = props.length; 34017 while (i--) { 34018 val = props[i]; 34019 if (typeof val === 'string') { 34020 name = camelize(val); 34021 res[name] = { type: null }; 34022 } 34023 else { 34024 warn$2('props must be strings when using array syntax.'); 34025 } 34026 } 34027 } 34028 else if (isPlainObject(props)) { 34029 for (const key in props) { 34030 val = props[key]; 34031 name = camelize(key); 34032 res[name] = isPlainObject(val) ? val : { type: val }; 34033 } 34034 } 34035 else { 34036 warn$2(`Invalid value for option "props": expected an Array or an Object, ` + 34037 `but got ${toRawType(props)}.`, vm); 34038 } 34039 options.props = res; 34040} 34041/** 34042 * Normalize all injections into Object-based format 34043 */ 34044function normalizeInject(options, vm) { 34045 const inject = options.inject; 34046 if (!inject) 34047 return; 34048 const normalized = (options.inject = {}); 34049 if (isArray(inject)) { 34050 for (let i = 0; i < inject.length; i++) { 34051 normalized[inject[i]] = { from: inject[i] }; 34052 } 34053 } 34054 else if (isPlainObject(inject)) { 34055 for (const key in inject) { 34056 const val = inject[key]; 34057 normalized[key] = isPlainObject(val) 34058 ? extend({ from: key }, val) 34059 : { from: val }; 34060 } 34061 } 34062 else { 34063 warn$2(`Invalid value for option "inject": expected an Array or an Object, ` + 34064 `but got ${toRawType(inject)}.`, vm); 34065 } 34066} 34067/** 34068 * Normalize raw function directives into object format. 34069 */ 34070function normalizeDirectives$1(options) { 34071 const dirs = options.directives; 34072 if (dirs) { 34073 for (const key in dirs) { 34074 const def = dirs[key]; 34075 if (isFunction(def)) { 34076 dirs[key] = { bind: def, update: def }; 34077 } 34078 } 34079 } 34080} 34081function assertObjectType(name, value, vm) { 34082 if (!isPlainObject(value)) { 34083 warn$2(`Invalid value for option "${name}": expected an Object, ` + 34084 `but got ${toRawType(value)}.`, vm); 34085 } 34086} 34087/** 34088 * Merge two option objects into a new one. 34089 * Core utility used in both instantiation and inheritance. 34090 */ 34091function mergeOptions(parent, child, vm) { 34092 { 34093 checkComponents(child); 34094 } 34095 if (isFunction(child)) { 34096 // @ts-expect-error 34097 child = child.options; 34098 } 34099 normalizeProps(child, vm); 34100 normalizeInject(child, vm); 34101 normalizeDirectives$1(child); 34102 // Apply extends and mixins on the child options, 34103 // but only if it is a raw options object that isn't 34104 // the result of another mergeOptions call. 34105 // Only merged options has the _base property. 34106 if (!child._base) { 34107 if (child.extends) { 34108 parent = mergeOptions(parent, child.extends, vm); 34109 } 34110 if (child.mixins) { 34111 for (let i = 0, l = child.mixins.length; i < l; i++) { 34112 parent = mergeOptions(parent, child.mixins[i], vm); 34113 } 34114 } 34115 } 34116 const options = {}; 34117 let key; 34118 for (key in parent) { 34119 mergeField(key); 34120 } 34121 for (key in child) { 34122 if (!hasOwn(parent, key)) { 34123 mergeField(key); 34124 } 34125 } 34126 function mergeField(key) { 34127 const strat = strats[key] || defaultStrat; 34128 options[key] = strat(parent[key], child[key], vm, key); 34129 } 34130 return options; 34131} 34132/** 34133 * Resolve an asset. 34134 * This function is used because child instances need access 34135 * to assets defined in its ancestor chain. 34136 */ 34137function resolveAsset(options, type, id, warnMissing) { 34138 /* istanbul ignore if */ 34139 if (typeof id !== 'string') { 34140 return; 34141 } 34142 const assets = options[type]; 34143 // check local registration variations first 34144 if (hasOwn(assets, id)) 34145 return assets[id]; 34146 const camelizedId = camelize(id); 34147 if (hasOwn(assets, camelizedId)) 34148 return assets[camelizedId]; 34149 const PascalCaseId = capitalize(camelizedId); 34150 if (hasOwn(assets, PascalCaseId)) 34151 return assets[PascalCaseId]; 34152 // fallback to prototype chain 34153 const res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; 34154 if (warnMissing && !res) { 34155 warn$2('Failed to resolve ' + type.slice(0, -1) + ': ' + id); 34156 } 34157 return res; 34158} 34159 34160function validateProp(key, propOptions, propsData, vm) { 34161 const prop = propOptions[key]; 34162 const absent = !hasOwn(propsData, key); 34163 let value = propsData[key]; 34164 // boolean casting 34165 const booleanIndex = getTypeIndex(Boolean, prop.type); 34166 if (booleanIndex > -1) { 34167 if (absent && !hasOwn(prop, 'default')) { 34168 value = false; 34169 } 34170 else if (value === '' || value === hyphenate(key)) { 34171 // only cast empty string / same name to boolean if 34172 // boolean has higher priority 34173 const stringIndex = getTypeIndex(String, prop.type); 34174 if (stringIndex < 0 || booleanIndex < stringIndex) { 34175 value = true; 34176 } 34177 } 34178 } 34179 // check default value 34180 if (value === undefined) { 34181 value = getPropDefaultValue(vm, prop, key); 34182 // since the default value is a fresh copy, 34183 // make sure to observe it. 34184 const prevShouldObserve = shouldObserve; 34185 toggleObserving(true); 34186 observe(value); 34187 toggleObserving(prevShouldObserve); 34188 } 34189 { 34190 assertProp(prop, key, value, vm, absent); 34191 } 34192 return value; 34193} 34194/** 34195 * Get the default value of a prop. 34196 */ 34197function getPropDefaultValue(vm, prop, key) { 34198 // no default, return undefined 34199 if (!hasOwn(prop, 'default')) { 34200 return undefined; 34201 } 34202 const def = prop.default; 34203 // warn against non-factory defaults for Object & Array 34204 if (isObject(def)) { 34205 warn$2('Invalid default value for prop "' + 34206 key + 34207 '": ' + 34208 'Props with type Object/Array must use a factory function ' + 34209 'to return the default value.', vm); 34210 } 34211 // the raw prop value was also undefined from previous render, 34212 // return previous default value to avoid unnecessary watcher trigger 34213 if (vm && 34214 vm.$options.propsData && 34215 vm.$options.propsData[key] === undefined && 34216 vm._props[key] !== undefined) { 34217 return vm._props[key]; 34218 } 34219 // call factory function for non-Function types 34220 // a value is Function if its prototype is function even across different execution context 34221 return isFunction(def) && getType(prop.type) !== 'Function' 34222 ? def.call(vm) 34223 : def; 34224} 34225/** 34226 * Assert whether a prop is valid. 34227 */ 34228function assertProp(prop, name, value, vm, absent) { 34229 if (prop.required && absent) { 34230 warn$2('Missing required prop: "' + name + '"', vm); 34231 return; 34232 } 34233 if (value == null && !prop.required) { 34234 return; 34235 } 34236 let type = prop.type; 34237 let valid = !type || type === true; 34238 const expectedTypes = []; 34239 if (type) { 34240 if (!isArray(type)) { 34241 type = [type]; 34242 } 34243 for (let i = 0; i < type.length && !valid; i++) { 34244 const assertedType = assertType(value, type[i], vm); 34245 expectedTypes.push(assertedType.expectedType || ''); 34246 valid = assertedType.valid; 34247 } 34248 } 34249 const haveExpectedTypes = expectedTypes.some(t => t); 34250 if (!valid && haveExpectedTypes) { 34251 warn$2(getInvalidTypeMessage(name, value, expectedTypes), vm); 34252 return; 34253 } 34254 const validator = prop.validator; 34255 if (validator) { 34256 if (!validator(value)) { 34257 warn$2('Invalid prop: custom validator check failed for prop "' + name + '".', vm); 34258 } 34259 } 34260} 34261const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/; 34262function assertType(value, type, vm) { 34263 let valid; 34264 const expectedType = getType(type); 34265 if (simpleCheckRE.test(expectedType)) { 34266 const t = typeof value; 34267 valid = t === expectedType.toLowerCase(); 34268 // for primitive wrapper objects 34269 if (!valid && t === 'object') { 34270 valid = value instanceof type; 34271 } 34272 } 34273 else if (expectedType === 'Object') { 34274 valid = isPlainObject(value); 34275 } 34276 else if (expectedType === 'Array') { 34277 valid = isArray(value); 34278 } 34279 else { 34280 try { 34281 valid = value instanceof type; 34282 } 34283 catch (e) { 34284 warn$2('Invalid prop type: "' + String(type) + '" is not a constructor', vm); 34285 valid = false; 34286 } 34287 } 34288 return { 34289 valid, 34290 expectedType 34291 }; 34292} 34293const functionTypeCheckRE = /^\s*function (\w+)/; 34294/** 34295 * Use function string name to check built-in types, 34296 * because a simple equality check will fail when running 34297 * across different vms / iframes. 34298 */ 34299function getType(fn) { 34300 const match = fn && fn.toString().match(functionTypeCheckRE); 34301 return match ? match[1] : ''; 34302} 34303function isSameType(a, b) { 34304 return getType(a) === getType(b); 34305} 34306function getTypeIndex(type, expectedTypes) { 34307 if (!isArray(expectedTypes)) { 34308 return isSameType(expectedTypes, type) ? 0 : -1; 34309 } 34310 for (let i = 0, len = expectedTypes.length; i < len; i++) { 34311 if (isSameType(expectedTypes[i], type)) { 34312 return i; 34313 } 34314 } 34315 return -1; 34316} 34317function getInvalidTypeMessage(name, value, expectedTypes) { 34318 let message = `Invalid prop: type check failed for prop "${name}".` + 34319 ` Expected ${expectedTypes.map(capitalize).join(', ')}`; 34320 const expectedType = expectedTypes[0]; 34321 const receivedType = toRawType(value); 34322 // check if we need to specify expected value 34323 if (expectedTypes.length === 1 && 34324 isExplicable(expectedType) && 34325 isExplicable(typeof value) && 34326 !isBoolean(expectedType, receivedType)) { 34327 message += ` with value ${styleValue(value, expectedType)}`; 34328 } 34329 message += `, got ${receivedType} `; 34330 // check if we need to specify received value 34331 if (isExplicable(receivedType)) { 34332 message += `with value ${styleValue(value, receivedType)}.`; 34333 } 34334 return message; 34335} 34336function styleValue(value, type) { 34337 if (type === 'String') { 34338 return `"${value}"`; 34339 } 34340 else if (type === 'Number') { 34341 return `${Number(value)}`; 34342 } 34343 else { 34344 return `${value}`; 34345 } 34346} 34347const EXPLICABLE_TYPES = ['string', 'number', 'boolean']; 34348function isExplicable(value) { 34349 return EXPLICABLE_TYPES.some(elem => value.toLowerCase() === elem); 34350} 34351function isBoolean(...args) { 34352 return args.some(elem => elem.toLowerCase() === 'boolean'); 34353} 34354 34355function Vue(options) { 34356 if (!(this instanceof Vue)) { 34357 warn$2('Vue is a constructor and should be called with the `new` keyword'); 34358 } 34359 this._init(options); 34360} 34361//@ts-expect-error Vue has function type 34362initMixin$1(Vue); 34363//@ts-expect-error Vue has function type 34364stateMixin(Vue); 34365//@ts-expect-error Vue has function type 34366eventsMixin(Vue); 34367//@ts-expect-error Vue has function type 34368lifecycleMixin(Vue); 34369//@ts-expect-error Vue has function type 34370renderMixin(Vue); 34371 34372function initUse(Vue) { 34373 Vue.use = function (plugin) { 34374 const installedPlugins = this._installedPlugins || (this._installedPlugins = []); 34375 if (installedPlugins.indexOf(plugin) > -1) { 34376 return this; 34377 } 34378 // additional parameters 34379 const args = toArray(arguments, 1); 34380 args.unshift(this); 34381 if (isFunction(plugin.install)) { 34382 plugin.install.apply(plugin, args); 34383 } 34384 else if (isFunction(plugin)) { 34385 plugin.apply(null, args); 34386 } 34387 installedPlugins.push(plugin); 34388 return this; 34389 }; 34390} 34391 34392function initMixin(Vue) { 34393 Vue.mixin = function (mixin) { 34394 this.options = mergeOptions(this.options, mixin); 34395 return this; 34396 }; 34397} 34398 34399function initExtend(Vue) { 34400 /** 34401 * Each instance constructor, including Vue, has a unique 34402 * cid. This enables us to create wrapped "child 34403 * constructors" for prototypal inheritance and cache them. 34404 */ 34405 Vue.cid = 0; 34406 let cid = 1; 34407 /** 34408 * Class inheritance 34409 */ 34410 Vue.extend = function (extendOptions) { 34411 extendOptions = extendOptions || {}; 34412 const Super = this; 34413 const SuperId = Super.cid; 34414 const cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {}); 34415 if (cachedCtors[SuperId]) { 34416 return cachedCtors[SuperId]; 34417 } 34418 const name = getComponentName(extendOptions) || getComponentName(Super.options); 34419 if (name) { 34420 validateComponentName(name); 34421 } 34422 const Sub = function VueComponent(options) { 34423 this._init(options); 34424 }; 34425 Sub.prototype = Object.create(Super.prototype); 34426 Sub.prototype.constructor = Sub; 34427 Sub.cid = cid++; 34428 Sub.options = mergeOptions(Super.options, extendOptions); 34429 Sub['super'] = Super; 34430 // For props and computed properties, we define the proxy getters on 34431 // the Vue instances at extension time, on the extended prototype. This 34432 // avoids Object.defineProperty calls for each instance created. 34433 if (Sub.options.props) { 34434 initProps(Sub); 34435 } 34436 if (Sub.options.computed) { 34437 initComputed(Sub); 34438 } 34439 // allow further extension/mixin/plugin usage 34440 Sub.extend = Super.extend; 34441 Sub.mixin = Super.mixin; 34442 Sub.use = Super.use; 34443 // create asset registers, so extended classes 34444 // can have their private assets too. 34445 ASSET_TYPES.forEach(function (type) { 34446 Sub[type] = Super[type]; 34447 }); 34448 // enable recursive self-lookup 34449 if (name) { 34450 Sub.options.components[name] = Sub; 34451 } 34452 // keep a reference to the super options at extension time. 34453 // later at instantiation we can check if Super's options have 34454 // been updated. 34455 Sub.superOptions = Super.options; 34456 Sub.extendOptions = extendOptions; 34457 Sub.sealedOptions = extend({}, Sub.options); 34458 // cache constructor 34459 cachedCtors[SuperId] = Sub; 34460 return Sub; 34461 }; 34462} 34463function initProps(Comp) { 34464 const props = Comp.options.props; 34465 for (const key in props) { 34466 proxy(Comp.prototype, `_props`, key); 34467 } 34468} 34469function initComputed(Comp) { 34470 const computed = Comp.options.computed; 34471 for (const key in computed) { 34472 defineComputed(Comp.prototype, key, computed[key]); 34473 } 34474} 34475 34476function initAssetRegisters(Vue) { 34477 /** 34478 * Create asset registration methods. 34479 */ 34480 ASSET_TYPES.forEach(type => { 34481 // @ts-expect-error function is not exact same type 34482 Vue[type] = function (id, definition) { 34483 if (!definition) { 34484 return this.options[type + 's'][id]; 34485 } 34486 else { 34487 /* istanbul ignore if */ 34488 if (type === 'component') { 34489 validateComponentName(id); 34490 } 34491 if (type === 'component' && isPlainObject(definition)) { 34492 // @ts-expect-error 34493 definition.name = definition.name || id; 34494 definition = this.options._base.extend(definition); 34495 } 34496 if (type === 'directive' && isFunction(definition)) { 34497 definition = { bind: definition, update: definition }; 34498 } 34499 this.options[type + 's'][id] = definition; 34500 return definition; 34501 } 34502 }; 34503 }); 34504} 34505 34506function _getComponentName(opts) { 34507 return opts && (getComponentName(opts.Ctor.options) || opts.tag); 34508} 34509function matches(pattern, name) { 34510 if (isArray(pattern)) { 34511 return pattern.indexOf(name) > -1; 34512 } 34513 else if (typeof pattern === 'string') { 34514 return pattern.split(',').indexOf(name) > -1; 34515 } 34516 else if (isRegExp(pattern)) { 34517 return pattern.test(name); 34518 } 34519 /* istanbul ignore next */ 34520 return false; 34521} 34522function pruneCache(keepAliveInstance, filter) { 34523 const { cache, keys, _vnode, $vnode } = keepAliveInstance; 34524 for (const key in cache) { 34525 const entry = cache[key]; 34526 if (entry) { 34527 const name = entry.name; 34528 if (name && !filter(name)) { 34529 pruneCacheEntry(cache, key, keys, _vnode); 34530 } 34531 } 34532 } 34533 $vnode.componentOptions.children = undefined; 34534} 34535function pruneCacheEntry(cache, key, keys, current) { 34536 const entry = cache[key]; 34537 if (entry && (!current || entry.tag !== current.tag)) { 34538 // @ts-expect-error can be undefined 34539 entry.componentInstance.$destroy(); 34540 } 34541 cache[key] = null; 34542 remove$2(keys, key); 34543} 34544const patternTypes = [String, RegExp, Array]; 34545// TODO defineComponent 34546var KeepAlive = { 34547 name: 'keep-alive', 34548 abstract: true, 34549 props: { 34550 include: patternTypes, 34551 exclude: patternTypes, 34552 max: [String, Number] 34553 }, 34554 methods: { 34555 cacheVNode() { 34556 const { cache, keys, vnodeToCache, keyToCache } = this; 34557 if (vnodeToCache) { 34558 const { tag, componentInstance, componentOptions } = vnodeToCache; 34559 cache[keyToCache] = { 34560 name: _getComponentName(componentOptions), 34561 tag, 34562 componentInstance 34563 }; 34564 keys.push(keyToCache); 34565 // prune oldest entry 34566 if (this.max && keys.length > parseInt(this.max)) { 34567 pruneCacheEntry(cache, keys[0], keys, this._vnode); 34568 } 34569 this.vnodeToCache = null; 34570 } 34571 } 34572 }, 34573 created() { 34574 this.cache = Object.create(null); 34575 this.keys = []; 34576 }, 34577 destroyed() { 34578 for (const key in this.cache) { 34579 pruneCacheEntry(this.cache, key, this.keys); 34580 } 34581 }, 34582 mounted() { 34583 this.cacheVNode(); 34584 this.$watch('include', val => { 34585 pruneCache(this, name => matches(val, name)); 34586 }); 34587 this.$watch('exclude', val => { 34588 pruneCache(this, name => !matches(val, name)); 34589 }); 34590 }, 34591 updated() { 34592 this.cacheVNode(); 34593 }, 34594 render() { 34595 const slot = this.$slots.default; 34596 const vnode = getFirstComponentChild(slot); 34597 const componentOptions = vnode && vnode.componentOptions; 34598 if (componentOptions) { 34599 // check pattern 34600 const name = _getComponentName(componentOptions); 34601 const { include, exclude } = this; 34602 if ( 34603 // not included 34604 (include && (!name || !matches(include, name))) || 34605 // excluded 34606 (exclude && name && matches(exclude, name))) { 34607 return vnode; 34608 } 34609 const { cache, keys } = this; 34610 const key = vnode.key == null 34611 ? // same constructor may get registered as different local components 34612 // so cid alone is not enough (#3269) 34613 componentOptions.Ctor.cid + 34614 (componentOptions.tag ? `::${componentOptions.tag}` : '') 34615 : vnode.key; 34616 if (cache[key]) { 34617 vnode.componentInstance = cache[key].componentInstance; 34618 // make current key freshest 34619 remove$2(keys, key); 34620 keys.push(key); 34621 } 34622 else { 34623 // delay setting the cache until update 34624 this.vnodeToCache = vnode; 34625 this.keyToCache = key; 34626 } 34627 // @ts-expect-error can vnode.data can be undefined 34628 vnode.data.keepAlive = true; 34629 } 34630 return vnode || (slot && slot[0]); 34631 } 34632}; 34633 34634var builtInComponents = { 34635 KeepAlive 34636}; 34637 34638function initGlobalAPI(Vue) { 34639 // config 34640 const configDef = {}; 34641 configDef.get = () => config; 34642 { 34643 configDef.set = () => { 34644 warn$2('Do not replace the Vue.config object, set individual fields instead.'); 34645 }; 34646 } 34647 Object.defineProperty(Vue, 'config', configDef); 34648 // exposed util methods. 34649 // NOTE: these are not considered part of the public API - avoid relying on 34650 // them unless you are aware of the risk. 34651 Vue.util = { 34652 warn: warn$2, 34653 extend, 34654 mergeOptions, 34655 defineReactive 34656 }; 34657 Vue.set = set; 34658 Vue.delete = del; 34659 Vue.nextTick = nextTick; 34660 // 2.6 explicit observable API 34661 Vue.observable = (obj) => { 34662 observe(obj); 34663 return obj; 34664 }; 34665 Vue.options = Object.create(null); 34666 ASSET_TYPES.forEach(type => { 34667 Vue.options[type + 's'] = Object.create(null); 34668 }); 34669 // this is used to identify the "base" constructor to extend all plain-object 34670 // components with in Weex's multi-instance scenarios. 34671 Vue.options._base = Vue; 34672 extend(Vue.options.components, builtInComponents); 34673 initUse(Vue); 34674 initMixin(Vue); 34675 initExtend(Vue); 34676 initAssetRegisters(Vue); 34677} 34678 34679initGlobalAPI(Vue); 34680Object.defineProperty(Vue.prototype, '$isServer', { 34681 get: isServerRendering 34682}); 34683Object.defineProperty(Vue.prototype, '$ssrContext', { 34684 get() { 34685 /* istanbul ignore next */ 34686 return this.$vnode && this.$vnode.ssrContext; 34687 } 34688}); 34689// expose FunctionalRenderContext for ssr runtime helper installation 34690Object.defineProperty(Vue, 'FunctionalRenderContext', { 34691 value: FunctionalRenderContext 34692}); 34693Vue.version = version; 34694 34695// these are reserved for web because they are directly compiled away 34696// during template compilation 34697const isReservedAttr = makeMap('style,class'); 34698// attributes that should be using props for binding 34699const acceptValue = makeMap('input,textarea,option,select,progress'); 34700const mustUseProp = (tag, type, attr) => { 34701 return ((attr === 'value' && acceptValue(tag) && type !== 'button') || 34702 (attr === 'selected' && tag === 'option') || 34703 (attr === 'checked' && tag === 'input') || 34704 (attr === 'muted' && tag === 'video')); 34705}; 34706const isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); 34707const isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only'); 34708const convertEnumeratedValue = (key, value) => { 34709 return isFalsyAttrValue(value) || value === 'false' 34710 ? 'false' 34711 : // allow arbitrary string value for contenteditable 34712 key === 'contenteditable' && isValidContentEditableValue(value) 34713 ? value 34714 : 'true'; 34715}; 34716const isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 34717 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 34718 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + 34719 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + 34720 'required,reversed,scoped,seamless,selected,sortable,' + 34721 'truespeed,typemustmatch,visible'); 34722const xlinkNS = 'http://www.w3.org/1999/xlink'; 34723const isXlink = (name) => { 34724 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'; 34725}; 34726const getXlinkProp = (name) => { 34727 return isXlink(name) ? name.slice(6, name.length) : ''; 34728}; 34729const isFalsyAttrValue = (val) => { 34730 return val == null || val === false; 34731}; 34732 34733function genClassForVnode(vnode) { 34734 let data = vnode.data; 34735 let parentNode = vnode; 34736 let childNode = vnode; 34737 while (isDef(childNode.componentInstance)) { 34738 childNode = childNode.componentInstance._vnode; 34739 if (childNode && childNode.data) { 34740 data = mergeClassData(childNode.data, data); 34741 } 34742 } 34743 // @ts-expect-error parentNode.parent not VNodeWithData 34744 while (isDef((parentNode = parentNode.parent))) { 34745 if (parentNode && parentNode.data) { 34746 data = mergeClassData(data, parentNode.data); 34747 } 34748 } 34749 return renderClass(data.staticClass, data.class); 34750} 34751function mergeClassData(child, parent) { 34752 return { 34753 staticClass: concat(child.staticClass, parent.staticClass), 34754 class: isDef(child.class) ? [child.class, parent.class] : parent.class 34755 }; 34756} 34757function renderClass(staticClass, dynamicClass) { 34758 if (isDef(staticClass) || isDef(dynamicClass)) { 34759 return concat(staticClass, stringifyClass(dynamicClass)); 34760 } 34761 /* istanbul ignore next */ 34762 return ''; 34763} 34764function concat(a, b) { 34765 return a ? (b ? a + ' ' + b : a) : b || ''; 34766} 34767function stringifyClass(value) { 34768 if (Array.isArray(value)) { 34769 return stringifyArray(value); 34770 } 34771 if (isObject(value)) { 34772 return stringifyObject(value); 34773 } 34774 if (typeof value === 'string') { 34775 return value; 34776 } 34777 /* istanbul ignore next */ 34778 return ''; 34779} 34780function stringifyArray(value) { 34781 let res = ''; 34782 let stringified; 34783 for (let i = 0, l = value.length; i < l; i++) { 34784 if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') { 34785 if (res) 34786 res += ' '; 34787 res += stringified; 34788 } 34789 } 34790 return res; 34791} 34792function stringifyObject(value) { 34793 let res = ''; 34794 for (const key in value) { 34795 if (value[key]) { 34796 if (res) 34797 res += ' '; 34798 res += key; 34799 } 34800 } 34801 return res; 34802} 34803 34804const namespaceMap = { 34805 svg: 'http://www.w3.org/2000/svg', 34806 math: 'http://www.w3.org/1998/Math/MathML' 34807}; 34808const isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' + 34809 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + 34810 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + 34811 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + 34812 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' + 34813 'embed,object,param,source,canvas,script,noscript,del,ins,' + 34814 'caption,col,colgroup,table,thead,tbody,td,th,tr,' + 34815 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + 34816 'output,progress,select,textarea,' + 34817 'details,dialog,menu,menuitem,summary,' + 34818 'content,element,shadow,template,blockquote,iframe,tfoot'); 34819// this map is intentionally selective, only covering SVG elements that may 34820// contain child elements. 34821const isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + 34822 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 34823 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true); 34824const isPreTag = (tag) => tag === 'pre'; 34825const isReservedTag = (tag) => { 34826 return isHTMLTag(tag) || isSVG(tag); 34827}; 34828function getTagNamespace(tag) { 34829 if (isSVG(tag)) { 34830 return 'svg'; 34831 } 34832 // basic support for MathML 34833 // note it doesn't support other MathML elements being component roots 34834 if (tag === 'math') { 34835 return 'math'; 34836 } 34837} 34838const unknownElementCache = Object.create(null); 34839function isUnknownElement(tag) { 34840 /* istanbul ignore if */ 34841 if (!inBrowser) { 34842 return true; 34843 } 34844 if (isReservedTag(tag)) { 34845 return false; 34846 } 34847 tag = tag.toLowerCase(); 34848 /* istanbul ignore if */ 34849 if (unknownElementCache[tag] != null) { 34850 return unknownElementCache[tag]; 34851 } 34852 const el = document.createElement(tag); 34853 if (tag.indexOf('-') > -1) { 34854 // https://stackoverflow.com/a/28210364/1070244 34855 return (unknownElementCache[tag] = 34856 el.constructor === window.HTMLUnknownElement || 34857 el.constructor === window.HTMLElement); 34858 } 34859 else { 34860 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString())); 34861 } 34862} 34863const isTextInputType = makeMap('text,number,password,search,email,tel,url'); 34864 34865/** 34866 * Query an element selector if it's not an element already. 34867 */ 34868function query(el) { 34869 if (typeof el === 'string') { 34870 const selected = document.querySelector(el); 34871 if (!selected) { 34872 warn$2('Cannot find element: ' + el); 34873 return document.createElement('div'); 34874 } 34875 return selected; 34876 } 34877 else { 34878 return el; 34879 } 34880} 34881 34882function createElement(tagName, vnode) { 34883 const elm = document.createElement(tagName); 34884 if (tagName !== 'select') { 34885 return elm; 34886 } 34887 // false or null will remove the attribute but undefined will not 34888 if (vnode.data && 34889 vnode.data.attrs && 34890 vnode.data.attrs.multiple !== undefined) { 34891 elm.setAttribute('multiple', 'multiple'); 34892 } 34893 return elm; 34894} 34895function createElementNS(namespace, tagName) { 34896 return document.createElementNS(namespaceMap[namespace], tagName); 34897} 34898function createTextNode(text) { 34899 return document.createTextNode(text); 34900} 34901function createComment(text) { 34902 return document.createComment(text); 34903} 34904function insertBefore(parentNode, newNode, referenceNode) { 34905 parentNode.insertBefore(newNode, referenceNode); 34906} 34907function removeChild(node, child) { 34908 node.removeChild(child); 34909} 34910function appendChild(node, child) { 34911 node.appendChild(child); 34912} 34913function parentNode(node) { 34914 return node.parentNode; 34915} 34916function nextSibling(node) { 34917 return node.nextSibling; 34918} 34919function tagName(node) { 34920 return node.tagName; 34921} 34922function setTextContent(node, text) { 34923 node.textContent = text; 34924} 34925function setStyleScope(node, scopeId) { 34926 node.setAttribute(scopeId, ''); 34927} 34928 34929var nodeOps = /*#__PURE__*/Object.freeze({ 34930 __proto__: null, 34931 createElement: createElement, 34932 createElementNS: createElementNS, 34933 createTextNode: createTextNode, 34934 createComment: createComment, 34935 insertBefore: insertBefore, 34936 removeChild: removeChild, 34937 appendChild: appendChild, 34938 parentNode: parentNode, 34939 nextSibling: nextSibling, 34940 tagName: tagName, 34941 setTextContent: setTextContent, 34942 setStyleScope: setStyleScope 34943}); 34944 34945var ref = { 34946 create(_, vnode) { 34947 registerRef(vnode); 34948 }, 34949 update(oldVnode, vnode) { 34950 if (oldVnode.data.ref !== vnode.data.ref) { 34951 registerRef(oldVnode, true); 34952 registerRef(vnode); 34953 } 34954 }, 34955 destroy(vnode) { 34956 registerRef(vnode, true); 34957 } 34958}; 34959function registerRef(vnode, isRemoval) { 34960 const ref = vnode.data.ref; 34961 if (!isDef(ref)) 34962 return; 34963 const vm = vnode.context; 34964 const refValue = vnode.componentInstance || vnode.elm; 34965 const value = isRemoval ? null : refValue; 34966 const $refsValue = isRemoval ? undefined : refValue; 34967 if (isFunction(ref)) { 34968 invokeWithErrorHandling(ref, vm, [value], vm, `template ref function`); 34969 return; 34970 } 34971 const isFor = vnode.data.refInFor; 34972 const _isString = typeof ref === 'string' || typeof ref === 'number'; 34973 const _isRef = isRef(ref); 34974 const refs = vm.$refs; 34975 if (_isString || _isRef) { 34976 if (isFor) { 34977 const existing = _isString ? refs[ref] : ref.value; 34978 if (isRemoval) { 34979 isArray(existing) && remove$2(existing, refValue); 34980 } 34981 else { 34982 if (!isArray(existing)) { 34983 if (_isString) { 34984 refs[ref] = [refValue]; 34985 setSetupRef(vm, ref, refs[ref]); 34986 } 34987 else { 34988 ref.value = [refValue]; 34989 } 34990 } 34991 else if (!existing.includes(refValue)) { 34992 existing.push(refValue); 34993 } 34994 } 34995 } 34996 else if (_isString) { 34997 if (isRemoval && refs[ref] !== refValue) { 34998 return; 34999 } 35000 refs[ref] = $refsValue; 35001 setSetupRef(vm, ref, value); 35002 } 35003 else if (_isRef) { 35004 if (isRemoval && ref.value !== refValue) { 35005 return; 35006 } 35007 ref.value = value; 35008 } 35009 else { 35010 warn$2(`Invalid template ref type: ${typeof ref}`); 35011 } 35012 } 35013} 35014function setSetupRef({ _setupState }, key, val) { 35015 if (_setupState && hasOwn(_setupState, key)) { 35016 if (isRef(_setupState[key])) { 35017 _setupState[key].value = val; 35018 } 35019 else { 35020 _setupState[key] = val; 35021 } 35022 } 35023} 35024 35025/** 35026 * Virtual DOM patching algorithm based on Snabbdom by 35027 * Simon Friis Vindum (@paldepind) 35028 * Licensed under the MIT License 35029 * https://github.com/paldepind/snabbdom/blob/master/LICENSE 35030 * 35031 * modified by Evan You (@yyx990803) 35032 * 35033 * Not type-checking this because this file is perf-critical and the cost 35034 * of making flow understand it is not worth it. 35035 */ 35036const emptyNode = new VNode('', {}, []); 35037const hooks = ['create', 'activate', 'update', 'remove', 'destroy']; 35038function sameVnode(a, b) { 35039 return (a.key === b.key && 35040 a.asyncFactory === b.asyncFactory && 35041 ((a.tag === b.tag && 35042 a.isComment === b.isComment && 35043 isDef(a.data) === isDef(b.data) && 35044 sameInputType(a, b)) || 35045 (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error)))); 35046} 35047function sameInputType(a, b) { 35048 if (a.tag !== 'input') 35049 return true; 35050 let i; 35051 const typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type; 35052 const typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type; 35053 return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB)); 35054} 35055function createKeyToOldIdx(children, beginIdx, endIdx) { 35056 let i, key; 35057 const map = {}; 35058 for (i = beginIdx; i <= endIdx; ++i) { 35059 key = children[i].key; 35060 if (isDef(key)) 35061 map[key] = i; 35062 } 35063 return map; 35064} 35065function createPatchFunction(backend) { 35066 let i, j; 35067 const cbs = {}; 35068 const { modules, nodeOps } = backend; 35069 for (i = 0; i < hooks.length; ++i) { 35070 cbs[hooks[i]] = []; 35071 for (j = 0; j < modules.length; ++j) { 35072 if (isDef(modules[j][hooks[i]])) { 35073 cbs[hooks[i]].push(modules[j][hooks[i]]); 35074 } 35075 } 35076 } 35077 function emptyNodeAt(elm) { 35078 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm); 35079 } 35080 function createRmCb(childElm, listeners) { 35081 function remove() { 35082 if (--remove.listeners === 0) { 35083 removeNode(childElm); 35084 } 35085 } 35086 remove.listeners = listeners; 35087 return remove; 35088 } 35089 function removeNode(el) { 35090 const parent = nodeOps.parentNode(el); 35091 // element may have already been removed due to v-html / v-text 35092 if (isDef(parent)) { 35093 nodeOps.removeChild(parent, el); 35094 } 35095 } 35096 function isUnknownElement(vnode, inVPre) { 35097 return (!inVPre && 35098 !vnode.ns && 35099 !(config.ignoredElements.length && 35100 config.ignoredElements.some(ignore => { 35101 return isRegExp(ignore) 35102 ? ignore.test(vnode.tag) 35103 : ignore === vnode.tag; 35104 })) && 35105 config.isUnknownElement(vnode.tag)); 35106 } 35107 let creatingElmInVPre = 0; 35108 function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) { 35109 if (isDef(vnode.elm) && isDef(ownerArray)) { 35110 // This vnode was used in a previous render! 35111 // now it's used as a new node, overwriting its elm would cause 35112 // potential patch errors down the road when it's used as an insertion 35113 // reference node. Instead, we clone the node on-demand before creating 35114 // associated DOM element for it. 35115 vnode = ownerArray[index] = cloneVNode(vnode); 35116 } 35117 vnode.isRootInsert = !nested; // for transition enter check 35118 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) { 35119 return; 35120 } 35121 const data = vnode.data; 35122 const children = vnode.children; 35123 const tag = vnode.tag; 35124 if (isDef(tag)) { 35125 { 35126 if (data && data.pre) { 35127 creatingElmInVPre++; 35128 } 35129 if (isUnknownElement(vnode, creatingElmInVPre)) { 35130 warn$2('Unknown custom element: <' + 35131 tag + 35132 '> - did you ' + 35133 'register the component correctly? For recursive components, ' + 35134 'make sure to provide the "name" option.', vnode.context); 35135 } 35136 } 35137 vnode.elm = vnode.ns 35138 ? nodeOps.createElementNS(vnode.ns, tag) 35139 : nodeOps.createElement(tag, vnode); 35140 setScope(vnode); 35141 createChildren(vnode, children, insertedVnodeQueue); 35142 if (isDef(data)) { 35143 invokeCreateHooks(vnode, insertedVnodeQueue); 35144 } 35145 insert(parentElm, vnode.elm, refElm); 35146 if (data && data.pre) { 35147 creatingElmInVPre--; 35148 } 35149 } 35150 else if (isTrue(vnode.isComment)) { 35151 vnode.elm = nodeOps.createComment(vnode.text); 35152 insert(parentElm, vnode.elm, refElm); 35153 } 35154 else { 35155 vnode.elm = nodeOps.createTextNode(vnode.text); 35156 insert(parentElm, vnode.elm, refElm); 35157 } 35158 } 35159 function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) { 35160 let i = vnode.data; 35161 if (isDef(i)) { 35162 const isReactivated = isDef(vnode.componentInstance) && i.keepAlive; 35163 if (isDef((i = i.hook)) && isDef((i = i.init))) { 35164 i(vnode, false /* hydrating */); 35165 } 35166 // after calling the init hook, if the vnode is a child component 35167 // it should've created a child instance and mounted it. the child 35168 // component also has set the placeholder vnode's elm. 35169 // in that case we can just return the element and be done. 35170 if (isDef(vnode.componentInstance)) { 35171 initComponent(vnode, insertedVnodeQueue); 35172 insert(parentElm, vnode.elm, refElm); 35173 if (isTrue(isReactivated)) { 35174 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm); 35175 } 35176 return true; 35177 } 35178 } 35179 } 35180 function initComponent(vnode, insertedVnodeQueue) { 35181 if (isDef(vnode.data.pendingInsert)) { 35182 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert); 35183 vnode.data.pendingInsert = null; 35184 } 35185 vnode.elm = vnode.componentInstance.$el; 35186 if (isPatchable(vnode)) { 35187 invokeCreateHooks(vnode, insertedVnodeQueue); 35188 setScope(vnode); 35189 } 35190 else { 35191 // empty component root. 35192 // skip all element-related modules except for ref (#3455) 35193 registerRef(vnode); 35194 // make sure to invoke the insert hook 35195 insertedVnodeQueue.push(vnode); 35196 } 35197 } 35198 function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) { 35199 let i; 35200 // hack for #4339: a reactivated component with inner transition 35201 // does not trigger because the inner node's created hooks are not called 35202 // again. It's not ideal to involve module-specific logic in here but 35203 // there doesn't seem to be a better way to do it. 35204 let innerNode = vnode; 35205 while (innerNode.componentInstance) { 35206 innerNode = innerNode.componentInstance._vnode; 35207 if (isDef((i = innerNode.data)) && isDef((i = i.transition))) { 35208 for (i = 0; i < cbs.activate.length; ++i) { 35209 cbs.activate[i](emptyNode, innerNode); 35210 } 35211 insertedVnodeQueue.push(innerNode); 35212 break; 35213 } 35214 } 35215 // unlike a newly created component, 35216 // a reactivated keep-alive component doesn't insert itself 35217 insert(parentElm, vnode.elm, refElm); 35218 } 35219 function insert(parent, elm, ref) { 35220 if (isDef(parent)) { 35221 if (isDef(ref)) { 35222 if (nodeOps.parentNode(ref) === parent) { 35223 nodeOps.insertBefore(parent, elm, ref); 35224 } 35225 } 35226 else { 35227 nodeOps.appendChild(parent, elm); 35228 } 35229 } 35230 } 35231 function createChildren(vnode, children, insertedVnodeQueue) { 35232 if (isArray(children)) { 35233 { 35234 checkDuplicateKeys(children); 35235 } 35236 for (let i = 0; i < children.length; ++i) { 35237 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i); 35238 } 35239 } 35240 else if (isPrimitive(vnode.text)) { 35241 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text))); 35242 } 35243 } 35244 function isPatchable(vnode) { 35245 while (vnode.componentInstance) { 35246 vnode = vnode.componentInstance._vnode; 35247 } 35248 return isDef(vnode.tag); 35249 } 35250 function invokeCreateHooks(vnode, insertedVnodeQueue) { 35251 for (let i = 0; i < cbs.create.length; ++i) { 35252 cbs.create[i](emptyNode, vnode); 35253 } 35254 i = vnode.data.hook; // Reuse variable 35255 if (isDef(i)) { 35256 if (isDef(i.create)) 35257 i.create(emptyNode, vnode); 35258 if (isDef(i.insert)) 35259 insertedVnodeQueue.push(vnode); 35260 } 35261 } 35262 // set scope id attribute for scoped CSS. 35263 // this is implemented as a special case to avoid the overhead 35264 // of going through the normal attribute patching process. 35265 function setScope(vnode) { 35266 let i; 35267 if (isDef((i = vnode.fnScopeId))) { 35268 nodeOps.setStyleScope(vnode.elm, i); 35269 } 35270 else { 35271 let ancestor = vnode; 35272 while (ancestor) { 35273 if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) { 35274 nodeOps.setStyleScope(vnode.elm, i); 35275 } 35276 ancestor = ancestor.parent; 35277 } 35278 } 35279 // for slot content they should also get the scopeId from the host instance. 35280 if (isDef((i = activeInstance)) && 35281 i !== vnode.context && 35282 i !== vnode.fnContext && 35283 isDef((i = i.$options._scopeId))) { 35284 nodeOps.setStyleScope(vnode.elm, i); 35285 } 35286 } 35287 function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) { 35288 for (; startIdx <= endIdx; ++startIdx) { 35289 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx); 35290 } 35291 } 35292 function invokeDestroyHook(vnode) { 35293 let i, j; 35294 const data = vnode.data; 35295 if (isDef(data)) { 35296 if (isDef((i = data.hook)) && isDef((i = i.destroy))) 35297 i(vnode); 35298 for (i = 0; i < cbs.destroy.length; ++i) 35299 cbs.destroy[i](vnode); 35300 } 35301 if (isDef((i = vnode.children))) { 35302 for (j = 0; j < vnode.children.length; ++j) { 35303 invokeDestroyHook(vnode.children[j]); 35304 } 35305 } 35306 } 35307 function removeVnodes(vnodes, startIdx, endIdx) { 35308 for (; startIdx <= endIdx; ++startIdx) { 35309 const ch = vnodes[startIdx]; 35310 if (isDef(ch)) { 35311 if (isDef(ch.tag)) { 35312 removeAndInvokeRemoveHook(ch); 35313 invokeDestroyHook(ch); 35314 } 35315 else { 35316 // Text node 35317 removeNode(ch.elm); 35318 } 35319 } 35320 } 35321 } 35322 function removeAndInvokeRemoveHook(vnode, rm) { 35323 if (isDef(rm) || isDef(vnode.data)) { 35324 let i; 35325 const listeners = cbs.remove.length + 1; 35326 if (isDef(rm)) { 35327 // we have a recursively passed down rm callback 35328 // increase the listeners count 35329 rm.listeners += listeners; 35330 } 35331 else { 35332 // directly removing 35333 rm = createRmCb(vnode.elm, listeners); 35334 } 35335 // recursively invoke hooks on child component root node 35336 if (isDef((i = vnode.componentInstance)) && 35337 isDef((i = i._vnode)) && 35338 isDef(i.data)) { 35339 removeAndInvokeRemoveHook(i, rm); 35340 } 35341 for (i = 0; i < cbs.remove.length; ++i) { 35342 cbs.remove[i](vnode, rm); 35343 } 35344 if (isDef((i = vnode.data.hook)) && isDef((i = i.remove))) { 35345 i(vnode, rm); 35346 } 35347 else { 35348 rm(); 35349 } 35350 } 35351 else { 35352 removeNode(vnode.elm); 35353 } 35354 } 35355 function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) { 35356 let oldStartIdx = 0; 35357 let newStartIdx = 0; 35358 let oldEndIdx = oldCh.length - 1; 35359 let oldStartVnode = oldCh[0]; 35360 let oldEndVnode = oldCh[oldEndIdx]; 35361 let newEndIdx = newCh.length - 1; 35362 let newStartVnode = newCh[0]; 35363 let newEndVnode = newCh[newEndIdx]; 35364 let oldKeyToIdx, idxInOld, vnodeToMove, refElm; 35365 // removeOnly is a special flag used only by <transition-group> 35366 // to ensure removed elements stay in correct relative positions 35367 // during leaving transitions 35368 const canMove = !removeOnly; 35369 { 35370 checkDuplicateKeys(newCh); 35371 } 35372 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { 35373 if (isUndef(oldStartVnode)) { 35374 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left 35375 } 35376 else if (isUndef(oldEndVnode)) { 35377 oldEndVnode = oldCh[--oldEndIdx]; 35378 } 35379 else if (sameVnode(oldStartVnode, newStartVnode)) { 35380 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 35381 oldStartVnode = oldCh[++oldStartIdx]; 35382 newStartVnode = newCh[++newStartIdx]; 35383 } 35384 else if (sameVnode(oldEndVnode, newEndVnode)) { 35385 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); 35386 oldEndVnode = oldCh[--oldEndIdx]; 35387 newEndVnode = newCh[--newEndIdx]; 35388 } 35389 else if (sameVnode(oldStartVnode, newEndVnode)) { 35390 // Vnode moved right 35391 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); 35392 canMove && 35393 nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm)); 35394 oldStartVnode = oldCh[++oldStartIdx]; 35395 newEndVnode = newCh[--newEndIdx]; 35396 } 35397 else if (sameVnode(oldEndVnode, newStartVnode)) { 35398 // Vnode moved left 35399 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 35400 canMove && 35401 nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm); 35402 oldEndVnode = oldCh[--oldEndIdx]; 35403 newStartVnode = newCh[++newStartIdx]; 35404 } 35405 else { 35406 if (isUndef(oldKeyToIdx)) 35407 oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); 35408 idxInOld = isDef(newStartVnode.key) 35409 ? oldKeyToIdx[newStartVnode.key] 35410 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx); 35411 if (isUndef(idxInOld)) { 35412 // New element 35413 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); 35414 } 35415 else { 35416 vnodeToMove = oldCh[idxInOld]; 35417 if (sameVnode(vnodeToMove, newStartVnode)) { 35418 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 35419 oldCh[idxInOld] = undefined; 35420 canMove && 35421 nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm); 35422 } 35423 else { 35424 // same key but different element. treat as new element 35425 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); 35426 } 35427 } 35428 newStartVnode = newCh[++newStartIdx]; 35429 } 35430 } 35431 if (oldStartIdx > oldEndIdx) { 35432 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm; 35433 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue); 35434 } 35435 else if (newStartIdx > newEndIdx) { 35436 removeVnodes(oldCh, oldStartIdx, oldEndIdx); 35437 } 35438 } 35439 function checkDuplicateKeys(children) { 35440 const seenKeys = {}; 35441 for (let i = 0; i < children.length; i++) { 35442 const vnode = children[i]; 35443 const key = vnode.key; 35444 if (isDef(key)) { 35445 if (seenKeys[key]) { 35446 warn$2(`Duplicate keys detected: '${key}'. This may cause an update error.`, vnode.context); 35447 } 35448 else { 35449 seenKeys[key] = true; 35450 } 35451 } 35452 } 35453 } 35454 function findIdxInOld(node, oldCh, start, end) { 35455 for (let i = start; i < end; i++) { 35456 const c = oldCh[i]; 35457 if (isDef(c) && sameVnode(node, c)) 35458 return i; 35459 } 35460 } 35461 function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) { 35462 if (oldVnode === vnode) { 35463 return; 35464 } 35465 if (isDef(vnode.elm) && isDef(ownerArray)) { 35466 // clone reused vnode 35467 vnode = ownerArray[index] = cloneVNode(vnode); 35468 } 35469 const elm = (vnode.elm = oldVnode.elm); 35470 if (isTrue(oldVnode.isAsyncPlaceholder)) { 35471 if (isDef(vnode.asyncFactory.resolved)) { 35472 hydrate(oldVnode.elm, vnode, insertedVnodeQueue); 35473 } 35474 else { 35475 vnode.isAsyncPlaceholder = true; 35476 } 35477 return; 35478 } 35479 // reuse element for static trees. 35480 // note we only do this if the vnode is cloned - 35481 // if the new node is not cloned it means the render functions have been 35482 // reset by the hot-reload-api and we need to do a proper re-render. 35483 if (isTrue(vnode.isStatic) && 35484 isTrue(oldVnode.isStatic) && 35485 vnode.key === oldVnode.key && 35486 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) { 35487 vnode.componentInstance = oldVnode.componentInstance; 35488 return; 35489 } 35490 let i; 35491 const data = vnode.data; 35492 if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) { 35493 i(oldVnode, vnode); 35494 } 35495 const oldCh = oldVnode.children; 35496 const ch = vnode.children; 35497 if (isDef(data) && isPatchable(vnode)) { 35498 for (i = 0; i < cbs.update.length; ++i) 35499 cbs.update[i](oldVnode, vnode); 35500 if (isDef((i = data.hook)) && isDef((i = i.update))) 35501 i(oldVnode, vnode); 35502 } 35503 if (isUndef(vnode.text)) { 35504 if (isDef(oldCh) && isDef(ch)) { 35505 if (oldCh !== ch) 35506 updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); 35507 } 35508 else if (isDef(ch)) { 35509 { 35510 checkDuplicateKeys(ch); 35511 } 35512 if (isDef(oldVnode.text)) 35513 nodeOps.setTextContent(elm, ''); 35514 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); 35515 } 35516 else if (isDef(oldCh)) { 35517 removeVnodes(oldCh, 0, oldCh.length - 1); 35518 } 35519 else if (isDef(oldVnode.text)) { 35520 nodeOps.setTextContent(elm, ''); 35521 } 35522 } 35523 else if (oldVnode.text !== vnode.text) { 35524 nodeOps.setTextContent(elm, vnode.text); 35525 } 35526 if (isDef(data)) { 35527 if (isDef((i = data.hook)) && isDef((i = i.postpatch))) 35528 i(oldVnode, vnode); 35529 } 35530 } 35531 function invokeInsertHook(vnode, queue, initial) { 35532 // delay insert hooks for component root nodes, invoke them after the 35533 // element is really inserted 35534 if (isTrue(initial) && isDef(vnode.parent)) { 35535 vnode.parent.data.pendingInsert = queue; 35536 } 35537 else { 35538 for (let i = 0; i < queue.length; ++i) { 35539 queue[i].data.hook.insert(queue[i]); 35540 } 35541 } 35542 } 35543 let hydrationBailed = false; 35544 // list of modules that can skip create hook during hydration because they 35545 // are already rendered on the client or has no need for initialization 35546 // Note: style is excluded because it relies on initial clone for future 35547 // deep updates (#7063). 35548 const isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key'); 35549 // Note: this is a browser-only function so we can assume elms are DOM nodes. 35550 function hydrate(elm, vnode, insertedVnodeQueue, inVPre) { 35551 let i; 35552 const { tag, data, children } = vnode; 35553 inVPre = inVPre || (data && data.pre); 35554 vnode.elm = elm; 35555 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) { 35556 vnode.isAsyncPlaceholder = true; 35557 return true; 35558 } 35559 // assert node match 35560 { 35561 if (!assertNodeMatch(elm, vnode, inVPre)) { 35562 return false; 35563 } 35564 } 35565 if (isDef(data)) { 35566 if (isDef((i = data.hook)) && isDef((i = i.init))) 35567 i(vnode, true /* hydrating */); 35568 if (isDef((i = vnode.componentInstance))) { 35569 // child component. it should have hydrated its own tree. 35570 initComponent(vnode, insertedVnodeQueue); 35571 return true; 35572 } 35573 } 35574 if (isDef(tag)) { 35575 if (isDef(children)) { 35576 // empty element, allow client to pick up and populate children 35577 if (!elm.hasChildNodes()) { 35578 createChildren(vnode, children, insertedVnodeQueue); 35579 } 35580 else { 35581 // v-html and domProps: innerHTML 35582 if (isDef((i = data)) && 35583 isDef((i = i.domProps)) && 35584 isDef((i = i.innerHTML))) { 35585 if (i !== elm.innerHTML) { 35586 /* istanbul ignore if */ 35587 if (typeof console !== 'undefined' && 35588 !hydrationBailed) { 35589 hydrationBailed = true; 35590 console.warn('Parent: ', elm); 35591 console.warn('server innerHTML: ', i); 35592 console.warn('client innerHTML: ', elm.innerHTML); 35593 } 35594 return false; 35595 } 35596 } 35597 else { 35598 // iterate and compare children lists 35599 let childrenMatch = true; 35600 let childNode = elm.firstChild; 35601 for (let i = 0; i < children.length; i++) { 35602 if (!childNode || 35603 !hydrate(childNode, children[i], insertedVnodeQueue, inVPre)) { 35604 childrenMatch = false; 35605 break; 35606 } 35607 childNode = childNode.nextSibling; 35608 } 35609 // if childNode is not null, it means the actual childNodes list is 35610 // longer than the virtual children list. 35611 if (!childrenMatch || childNode) { 35612 /* istanbul ignore if */ 35613 if (typeof console !== 'undefined' && 35614 !hydrationBailed) { 35615 hydrationBailed = true; 35616 console.warn('Parent: ', elm); 35617 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children); 35618 } 35619 return false; 35620 } 35621 } 35622 } 35623 } 35624 if (isDef(data)) { 35625 let fullInvoke = false; 35626 for (const key in data) { 35627 if (!isRenderedModule(key)) { 35628 fullInvoke = true; 35629 invokeCreateHooks(vnode, insertedVnodeQueue); 35630 break; 35631 } 35632 } 35633 if (!fullInvoke && data['class']) { 35634 // ensure collecting deps for deep class bindings for future updates 35635 traverse(data['class']); 35636 } 35637 } 35638 } 35639 else if (elm.data !== vnode.text) { 35640 elm.data = vnode.text; 35641 } 35642 return true; 35643 } 35644 function assertNodeMatch(node, vnode, inVPre) { 35645 if (isDef(vnode.tag)) { 35646 return (vnode.tag.indexOf('vue-component') === 0 || 35647 (!isUnknownElement(vnode, inVPre) && 35648 vnode.tag.toLowerCase() === 35649 (node.tagName && node.tagName.toLowerCase()))); 35650 } 35651 else { 35652 return node.nodeType === (vnode.isComment ? 8 : 3); 35653 } 35654 } 35655 return function patch(oldVnode, vnode, hydrating, removeOnly) { 35656 if (isUndef(vnode)) { 35657 if (isDef(oldVnode)) 35658 invokeDestroyHook(oldVnode); 35659 return; 35660 } 35661 let isInitialPatch = false; 35662 const insertedVnodeQueue = []; 35663 if (isUndef(oldVnode)) { 35664 // empty mount (likely as component), create new root element 35665 isInitialPatch = true; 35666 createElm(vnode, insertedVnodeQueue); 35667 } 35668 else { 35669 const isRealElement = isDef(oldVnode.nodeType); 35670 if (!isRealElement && sameVnode(oldVnode, vnode)) { 35671 // patch existing root node 35672 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly); 35673 } 35674 else { 35675 if (isRealElement) { 35676 // mounting to a real element 35677 // check if this is server-rendered content and if we can perform 35678 // a successful hydration. 35679 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) { 35680 oldVnode.removeAttribute(SSR_ATTR); 35681 hydrating = true; 35682 } 35683 if (isTrue(hydrating)) { 35684 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) { 35685 invokeInsertHook(vnode, insertedVnodeQueue, true); 35686 return oldVnode; 35687 } 35688 else { 35689 warn$2('The client-side rendered virtual DOM tree is not matching ' + 35690 'server-rendered content. This is likely caused by incorrect ' + 35691 'HTML markup, for example nesting block-level elements inside ' + 35692 '<p>, or missing <tbody>. Bailing hydration and performing ' + 35693 'full client-side render.'); 35694 } 35695 } 35696 // either not server-rendered, or hydration failed. 35697 // create an empty node and replace it 35698 oldVnode = emptyNodeAt(oldVnode); 35699 } 35700 // replacing existing element 35701 const oldElm = oldVnode.elm; 35702 const parentElm = nodeOps.parentNode(oldElm); 35703 // create new node 35704 createElm(vnode, insertedVnodeQueue, 35705 // extremely rare edge case: do not insert if old element is in a 35706 // leaving transition. Only happens when combining transition + 35707 // keep-alive + HOCs. (#4590) 35708 oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm)); 35709 // update parent placeholder node element, recursively 35710 if (isDef(vnode.parent)) { 35711 let ancestor = vnode.parent; 35712 const patchable = isPatchable(vnode); 35713 while (ancestor) { 35714 for (let i = 0; i < cbs.destroy.length; ++i) { 35715 cbs.destroy[i](ancestor); 35716 } 35717 ancestor.elm = vnode.elm; 35718 if (patchable) { 35719 for (let i = 0; i < cbs.create.length; ++i) { 35720 cbs.create[i](emptyNode, ancestor); 35721 } 35722 // #6513 35723 // invoke insert hooks that may have been merged by create hooks. 35724 // e.g. for directives that uses the "inserted" hook. 35725 const insert = ancestor.data.hook.insert; 35726 if (insert.merged) { 35727 // start at index 1 to avoid re-invoking component mounted hook 35728 // clone insert hooks to avoid being mutated during iteration. 35729 // e.g. for customed directives under transition group. 35730 const cloned = insert.fns.slice(1); 35731 for (let i = 0; i < cloned.length; i++) { 35732 cloned[i](); 35733 } 35734 } 35735 } 35736 else { 35737 registerRef(ancestor); 35738 } 35739 ancestor = ancestor.parent; 35740 } 35741 } 35742 // destroy old node 35743 if (isDef(parentElm)) { 35744 removeVnodes([oldVnode], 0, 0); 35745 } 35746 else if (isDef(oldVnode.tag)) { 35747 invokeDestroyHook(oldVnode); 35748 } 35749 } 35750 } 35751 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch); 35752 return vnode.elm; 35753 }; 35754} 35755 35756var directives$1 = { 35757 create: updateDirectives, 35758 update: updateDirectives, 35759 destroy: function unbindDirectives(vnode) { 35760 // @ts-expect-error emptyNode is not VNodeWithData 35761 updateDirectives(vnode, emptyNode); 35762 } 35763}; 35764function updateDirectives(oldVnode, vnode) { 35765 if (oldVnode.data.directives || vnode.data.directives) { 35766 _update(oldVnode, vnode); 35767 } 35768} 35769function _update(oldVnode, vnode) { 35770 const isCreate = oldVnode === emptyNode; 35771 const isDestroy = vnode === emptyNode; 35772 const oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context); 35773 const newDirs = normalizeDirectives(vnode.data.directives, vnode.context); 35774 const dirsWithInsert = []; 35775 const dirsWithPostpatch = []; 35776 let key, oldDir, dir; 35777 for (key in newDirs) { 35778 oldDir = oldDirs[key]; 35779 dir = newDirs[key]; 35780 if (!oldDir) { 35781 // new directive, bind 35782 callHook(dir, 'bind', vnode, oldVnode); 35783 if (dir.def && dir.def.inserted) { 35784 dirsWithInsert.push(dir); 35785 } 35786 } 35787 else { 35788 // existing directive, update 35789 dir.oldValue = oldDir.value; 35790 dir.oldArg = oldDir.arg; 35791 callHook(dir, 'update', vnode, oldVnode); 35792 if (dir.def && dir.def.componentUpdated) { 35793 dirsWithPostpatch.push(dir); 35794 } 35795 } 35796 } 35797 if (dirsWithInsert.length) { 35798 const callInsert = () => { 35799 for (let i = 0; i < dirsWithInsert.length; i++) { 35800 callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode); 35801 } 35802 }; 35803 if (isCreate) { 35804 mergeVNodeHook(vnode, 'insert', callInsert); 35805 } 35806 else { 35807 callInsert(); 35808 } 35809 } 35810 if (dirsWithPostpatch.length) { 35811 mergeVNodeHook(vnode, 'postpatch', () => { 35812 for (let i = 0; i < dirsWithPostpatch.length; i++) { 35813 callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode); 35814 } 35815 }); 35816 } 35817 if (!isCreate) { 35818 for (key in oldDirs) { 35819 if (!newDirs[key]) { 35820 // no longer present, unbind 35821 callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy); 35822 } 35823 } 35824 } 35825} 35826const emptyModifiers = Object.create(null); 35827function normalizeDirectives(dirs, vm) { 35828 const res = Object.create(null); 35829 if (!dirs) { 35830 // $flow-disable-line 35831 return res; 35832 } 35833 let i, dir; 35834 for (i = 0; i < dirs.length; i++) { 35835 dir = dirs[i]; 35836 if (!dir.modifiers) { 35837 // $flow-disable-line 35838 dir.modifiers = emptyModifiers; 35839 } 35840 res[getRawDirName(dir)] = dir; 35841 if (vm._setupState && vm._setupState.__sfc) { 35842 const setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name); 35843 if (typeof setupDef === 'function') { 35844 dir.def = { 35845 bind: setupDef, 35846 update: setupDef, 35847 }; 35848 } 35849 else { 35850 dir.def = setupDef; 35851 } 35852 } 35853 dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true); 35854 } 35855 // $flow-disable-line 35856 return res; 35857} 35858function getRawDirName(dir) { 35859 return (dir.rawName || `${dir.name}.${Object.keys(dir.modifiers || {}).join('.')}`); 35860} 35861function callHook(dir, hook, vnode, oldVnode, isDestroy) { 35862 const fn = dir.def && dir.def[hook]; 35863 if (fn) { 35864 try { 35865 fn(vnode.elm, dir, vnode, oldVnode, isDestroy); 35866 } 35867 catch (e) { 35868 handleError(e, vnode.context, `directive ${dir.name} ${hook} hook`); 35869 } 35870 } 35871} 35872 35873var baseModules = [ref, directives$1]; 35874 35875function updateAttrs(oldVnode, vnode) { 35876 const opts = vnode.componentOptions; 35877 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) { 35878 return; 35879 } 35880 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) { 35881 return; 35882 } 35883 let key, cur, old; 35884 const elm = vnode.elm; 35885 const oldAttrs = oldVnode.data.attrs || {}; 35886 let attrs = vnode.data.attrs || {}; 35887 // clone observed objects, as the user probably wants to mutate it 35888 if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) { 35889 attrs = vnode.data.attrs = extend({}, attrs); 35890 } 35891 for (key in attrs) { 35892 cur = attrs[key]; 35893 old = oldAttrs[key]; 35894 if (old !== cur) { 35895 setAttr(elm, key, cur, vnode.data.pre); 35896 } 35897 } 35898 // #4391: in IE9, setting type can reset value for input[type=radio] 35899 // #6666: IE/Edge forces progress value down to 1 before setting a max 35900 /* istanbul ignore if */ 35901 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) { 35902 setAttr(elm, 'value', attrs.value); 35903 } 35904 for (key in oldAttrs) { 35905 if (isUndef(attrs[key])) { 35906 if (isXlink(key)) { 35907 elm.removeAttributeNS(xlinkNS, getXlinkProp(key)); 35908 } 35909 else if (!isEnumeratedAttr(key)) { 35910 elm.removeAttribute(key); 35911 } 35912 } 35913 } 35914} 35915function setAttr(el, key, value, isInPre) { 35916 if (isInPre || el.tagName.indexOf('-') > -1) { 35917 baseSetAttr(el, key, value); 35918 } 35919 else if (isBooleanAttr(key)) { 35920 // set attribute for blank value 35921 // e.g. <option disabled>Select one</option> 35922 if (isFalsyAttrValue(value)) { 35923 el.removeAttribute(key); 35924 } 35925 else { 35926 // technically allowfullscreen is a boolean attribute for <iframe>, 35927 // but Flash expects a value of "true" when used on <embed> tag 35928 value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key; 35929 el.setAttribute(key, value); 35930 } 35931 } 35932 else if (isEnumeratedAttr(key)) { 35933 el.setAttribute(key, convertEnumeratedValue(key, value)); 35934 } 35935 else if (isXlink(key)) { 35936 if (isFalsyAttrValue(value)) { 35937 el.removeAttributeNS(xlinkNS, getXlinkProp(key)); 35938 } 35939 else { 35940 el.setAttributeNS(xlinkNS, key, value); 35941 } 35942 } 35943 else { 35944 baseSetAttr(el, key, value); 35945 } 35946} 35947function baseSetAttr(el, key, value) { 35948 if (isFalsyAttrValue(value)) { 35949 el.removeAttribute(key); 35950 } 35951 else { 35952 // #7138: IE10 & 11 fires input event when setting placeholder on 35953 // <textarea>... block the first input event and remove the blocker 35954 // immediately. 35955 /* istanbul ignore if */ 35956 if (isIE && 35957 !isIE9 && 35958 el.tagName === 'TEXTAREA' && 35959 key === 'placeholder' && 35960 value !== '' && 35961 !el.__ieph) { 35962 const blocker = e => { 35963 e.stopImmediatePropagation(); 35964 el.removeEventListener('input', blocker); 35965 }; 35966 el.addEventListener('input', blocker); 35967 // $flow-disable-line 35968 el.__ieph = true; /* IE placeholder patched */ 35969 } 35970 el.setAttribute(key, value); 35971 } 35972} 35973var attrs = { 35974 create: updateAttrs, 35975 update: updateAttrs 35976}; 35977 35978function updateClass(oldVnode, vnode) { 35979 const el = vnode.elm; 35980 const data = vnode.data; 35981 const oldData = oldVnode.data; 35982 if (isUndef(data.staticClass) && 35983 isUndef(data.class) && 35984 (isUndef(oldData) || 35985 (isUndef(oldData.staticClass) && isUndef(oldData.class)))) { 35986 return; 35987 } 35988 let cls = genClassForVnode(vnode); 35989 // handle transition classes 35990 const transitionClass = el._transitionClasses; 35991 if (isDef(transitionClass)) { 35992 cls = concat(cls, stringifyClass(transitionClass)); 35993 } 35994 // set the class 35995 if (cls !== el._prevClass) { 35996 el.setAttribute('class', cls); 35997 el._prevClass = cls; 35998 } 35999} 36000var klass$1 = { 36001 create: updateClass, 36002 update: updateClass 36003}; 36004 36005const validDivisionCharRE = /[\w).+\-_$\]]/; 36006function parseFilters(exp) { 36007 let inSingle = false; 36008 let inDouble = false; 36009 let inTemplateString = false; 36010 let inRegex = false; 36011 let curly = 0; 36012 let square = 0; 36013 let paren = 0; 36014 let lastFilterIndex = 0; 36015 let c, prev, i, expression, filters; 36016 for (i = 0; i < exp.length; i++) { 36017 prev = c; 36018 c = exp.charCodeAt(i); 36019 if (inSingle) { 36020 if (c === 0x27 && prev !== 0x5c) 36021 inSingle = false; 36022 } 36023 else if (inDouble) { 36024 if (c === 0x22 && prev !== 0x5c) 36025 inDouble = false; 36026 } 36027 else if (inTemplateString) { 36028 if (c === 0x60 && prev !== 0x5c) 36029 inTemplateString = false; 36030 } 36031 else if (inRegex) { 36032 if (c === 0x2f && prev !== 0x5c) 36033 inRegex = false; 36034 } 36035 else if (c === 0x7c && // pipe 36036 exp.charCodeAt(i + 1) !== 0x7c && 36037 exp.charCodeAt(i - 1) !== 0x7c && 36038 !curly && 36039 !square && 36040 !paren) { 36041 if (expression === undefined) { 36042 // first filter, end of expression 36043 lastFilterIndex = i + 1; 36044 expression = exp.slice(0, i).trim(); 36045 } 36046 else { 36047 pushFilter(); 36048 } 36049 } 36050 else { 36051 switch (c) { 36052 case 0x22: 36053 inDouble = true; 36054 break; // " 36055 case 0x27: 36056 inSingle = true; 36057 break; // ' 36058 case 0x60: 36059 inTemplateString = true; 36060 break; // ` 36061 case 0x28: 36062 paren++; 36063 break; // ( 36064 case 0x29: 36065 paren--; 36066 break; // ) 36067 case 0x5b: 36068 square++; 36069 break; // [ 36070 case 0x5d: 36071 square--; 36072 break; // ] 36073 case 0x7b: 36074 curly++; 36075 break; // { 36076 case 0x7d: 36077 curly--; 36078 break; // } 36079 } 36080 if (c === 0x2f) { 36081 // / 36082 let j = i - 1; 36083 let p; 36084 // find first non-whitespace prev char 36085 for (; j >= 0; j--) { 36086 p = exp.charAt(j); 36087 if (p !== ' ') 36088 break; 36089 } 36090 if (!p || !validDivisionCharRE.test(p)) { 36091 inRegex = true; 36092 } 36093 } 36094 } 36095 } 36096 if (expression === undefined) { 36097 expression = exp.slice(0, i).trim(); 36098 } 36099 else if (lastFilterIndex !== 0) { 36100 pushFilter(); 36101 } 36102 function pushFilter() { 36103 (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim()); 36104 lastFilterIndex = i + 1; 36105 } 36106 if (filters) { 36107 for (i = 0; i < filters.length; i++) { 36108 expression = wrapFilter(expression, filters[i]); 36109 } 36110 } 36111 return expression; 36112} 36113function wrapFilter(exp, filter) { 36114 const i = filter.indexOf('('); 36115 if (i < 0) { 36116 // _f: resolveFilter 36117 return `_f("${filter}")(${exp})`; 36118 } 36119 else { 36120 const name = filter.slice(0, i); 36121 const args = filter.slice(i + 1); 36122 return `_f("${name}")(${exp}${args !== ')' ? ',' + args : args}`; 36123 } 36124} 36125 36126/* eslint-disable no-unused-vars */ 36127function baseWarn(msg, range) { 36128 console.error(`[Vue compiler]: ${msg}`); 36129} 36130/* eslint-enable no-unused-vars */ 36131function pluckModuleFunction(modules, key) { 36132 return modules ? modules.map(m => m[key]).filter(_ => _) : []; 36133} 36134function addProp(el, name, value, range, dynamic) { 36135 (el.props || (el.props = [])).push(rangeSetItem({ name, value, dynamic }, range)); 36136 el.plain = false; 36137} 36138function addAttr(el, name, value, range, dynamic) { 36139 const attrs = dynamic 36140 ? el.dynamicAttrs || (el.dynamicAttrs = []) 36141 : el.attrs || (el.attrs = []); 36142 attrs.push(rangeSetItem({ name, value, dynamic }, range)); 36143 el.plain = false; 36144} 36145// add a raw attr (use this in preTransforms) 36146function addRawAttr(el, name, value, range) { 36147 el.attrsMap[name] = value; 36148 el.attrsList.push(rangeSetItem({ name, value }, range)); 36149} 36150function addDirective(el, name, rawName, value, arg, isDynamicArg, modifiers, range) { 36151 (el.directives || (el.directives = [])).push(rangeSetItem({ 36152 name, 36153 rawName, 36154 value, 36155 arg, 36156 isDynamicArg, 36157 modifiers 36158 }, range)); 36159 el.plain = false; 36160} 36161function prependModifierMarker(symbol, name, dynamic) { 36162 return dynamic ? `_p(${name},"${symbol}")` : symbol + name; // mark the event as captured 36163} 36164function addHandler(el, name, value, modifiers, important, warn, range, dynamic) { 36165 modifiers = modifiers || emptyObject; 36166 // warn prevent and passive modifier 36167 /* istanbul ignore if */ 36168 if (warn && modifiers.prevent && modifiers.passive) { 36169 warn("passive and prevent can't be used together. " + 36170 "Passive handler can't prevent default event.", range); 36171 } 36172 // normalize click.right and click.middle since they don't actually fire 36173 // this is technically browser-specific, but at least for now browsers are 36174 // the only target envs that have right/middle clicks. 36175 if (modifiers.right) { 36176 if (dynamic) { 36177 name = `(${name})==='click'?'contextmenu':(${name})`; 36178 } 36179 else if (name === 'click') { 36180 name = 'contextmenu'; 36181 delete modifiers.right; 36182 } 36183 } 36184 else if (modifiers.middle) { 36185 if (dynamic) { 36186 name = `(${name})==='click'?'mouseup':(${name})`; 36187 } 36188 else if (name === 'click') { 36189 name = 'mouseup'; 36190 } 36191 } 36192 // check capture modifier 36193 if (modifiers.capture) { 36194 delete modifiers.capture; 36195 name = prependModifierMarker('!', name, dynamic); 36196 } 36197 if (modifiers.once) { 36198 delete modifiers.once; 36199 name = prependModifierMarker('~', name, dynamic); 36200 } 36201 /* istanbul ignore if */ 36202 if (modifiers.passive) { 36203 delete modifiers.passive; 36204 name = prependModifierMarker('&', name, dynamic); 36205 } 36206 let events; 36207 if (modifiers.native) { 36208 delete modifiers.native; 36209 events = el.nativeEvents || (el.nativeEvents = {}); 36210 } 36211 else { 36212 events = el.events || (el.events = {}); 36213 } 36214 const newHandler = rangeSetItem({ value: value.trim(), dynamic }, range); 36215 if (modifiers !== emptyObject) { 36216 newHandler.modifiers = modifiers; 36217 } 36218 const handlers = events[name]; 36219 /* istanbul ignore if */ 36220 if (Array.isArray(handlers)) { 36221 important ? handlers.unshift(newHandler) : handlers.push(newHandler); 36222 } 36223 else if (handlers) { 36224 events[name] = important ? [newHandler, handlers] : [handlers, newHandler]; 36225 } 36226 else { 36227 events[name] = newHandler; 36228 } 36229 el.plain = false; 36230} 36231function getRawBindingAttr(el, name) { 36232 return (el.rawAttrsMap[':' + name] || 36233 el.rawAttrsMap['v-bind:' + name] || 36234 el.rawAttrsMap[name]); 36235} 36236function getBindingAttr(el, name, getStatic) { 36237 const dynamicValue = getAndRemoveAttr(el, ':' + name) || getAndRemoveAttr(el, 'v-bind:' + name); 36238 if (dynamicValue != null) { 36239 return parseFilters(dynamicValue); 36240 } 36241 else if (getStatic !== false) { 36242 const staticValue = getAndRemoveAttr(el, name); 36243 if (staticValue != null) { 36244 return JSON.stringify(staticValue); 36245 } 36246 } 36247} 36248// note: this only removes the attr from the Array (attrsList) so that it 36249// doesn't get processed by processAttrs. 36250// By default it does NOT remove it from the map (attrsMap) because the map is 36251// needed during codegen. 36252function getAndRemoveAttr(el, name, removeFromMap) { 36253 let val; 36254 if ((val = el.attrsMap[name]) != null) { 36255 const list = el.attrsList; 36256 for (let i = 0, l = list.length; i < l; i++) { 36257 if (list[i].name === name) { 36258 list.splice(i, 1); 36259 break; 36260 } 36261 } 36262 } 36263 if (removeFromMap) { 36264 delete el.attrsMap[name]; 36265 } 36266 return val; 36267} 36268function getAndRemoveAttrByRegex(el, name) { 36269 const list = el.attrsList; 36270 for (let i = 0, l = list.length; i < l; i++) { 36271 const attr = list[i]; 36272 if (name.test(attr.name)) { 36273 list.splice(i, 1); 36274 return attr; 36275 } 36276 } 36277} 36278function rangeSetItem(item, range) { 36279 if (range) { 36280 if (range.start != null) { 36281 item.start = range.start; 36282 } 36283 if (range.end != null) { 36284 item.end = range.end; 36285 } 36286 } 36287 return item; 36288} 36289 36290/** 36291 * Cross-platform code generation for component v-model 36292 */ 36293function genComponentModel(el, value, modifiers) { 36294 const { number, trim } = modifiers || {}; 36295 const baseValueExpression = '$$v'; 36296 let valueExpression = baseValueExpression; 36297 if (trim) { 36298 valueExpression = 36299 `(typeof ${baseValueExpression} === 'string'` + 36300 `? ${baseValueExpression}.trim()` + 36301 `: ${baseValueExpression})`; 36302 } 36303 if (number) { 36304 valueExpression = `_n(${valueExpression})`; 36305 } 36306 const assignment = genAssignmentCode(value, valueExpression); 36307 el.model = { 36308 value: `(${value})`, 36309 expression: JSON.stringify(value), 36310 callback: `function (${baseValueExpression}) {${assignment}}` 36311 }; 36312} 36313/** 36314 * Cross-platform codegen helper for generating v-model value assignment code. 36315 */ 36316function genAssignmentCode(value, assignment) { 36317 const res = parseModel(value); 36318 if (res.key === null) { 36319 return `${value}=${assignment}`; 36320 } 36321 else { 36322 return `$set(${res.exp}, ${res.key}, ${assignment})`; 36323 } 36324} 36325/** 36326 * Parse a v-model expression into a base path and a final key segment. 36327 * Handles both dot-path and possible square brackets. 36328 * 36329 * Possible cases: 36330 * 36331 * - test 36332 * - test[key] 36333 * - test[test1[key]] 36334 * - test["a"][key] 36335 * - xxx.test[a[a].test1[key]] 36336 * - test.xxx.a["asa"][test1[key]] 36337 * 36338 */ 36339let len, str, chr, index, expressionPos, expressionEndPos; 36340function parseModel(val) { 36341 // Fix https://github.com/vuejs/vue/pull/7730 36342 // allow v-model="obj.val " (trailing whitespace) 36343 val = val.trim(); 36344 len = val.length; 36345 if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) { 36346 index = val.lastIndexOf('.'); 36347 if (index > -1) { 36348 return { 36349 exp: val.slice(0, index), 36350 key: '"' + val.slice(index + 1) + '"' 36351 }; 36352 } 36353 else { 36354 return { 36355 exp: val, 36356 key: null 36357 }; 36358 } 36359 } 36360 str = val; 36361 index = expressionPos = expressionEndPos = 0; 36362 while (!eof()) { 36363 chr = next(); 36364 /* istanbul ignore if */ 36365 if (isStringStart(chr)) { 36366 parseString(chr); 36367 } 36368 else if (chr === 0x5b) { 36369 parseBracket(chr); 36370 } 36371 } 36372 return { 36373 exp: val.slice(0, expressionPos), 36374 key: val.slice(expressionPos + 1, expressionEndPos) 36375 }; 36376} 36377function next() { 36378 return str.charCodeAt(++index); 36379} 36380function eof() { 36381 return index >= len; 36382} 36383function isStringStart(chr) { 36384 return chr === 0x22 || chr === 0x27; 36385} 36386function parseBracket(chr) { 36387 let inBracket = 1; 36388 expressionPos = index; 36389 while (!eof()) { 36390 chr = next(); 36391 if (isStringStart(chr)) { 36392 parseString(chr); 36393 continue; 36394 } 36395 if (chr === 0x5b) 36396 inBracket++; 36397 if (chr === 0x5d) 36398 inBracket--; 36399 if (inBracket === 0) { 36400 expressionEndPos = index; 36401 break; 36402 } 36403 } 36404} 36405function parseString(chr) { 36406 const stringQuote = chr; 36407 while (!eof()) { 36408 chr = next(); 36409 if (chr === stringQuote) { 36410 break; 36411 } 36412 } 36413} 36414 36415let warn$1; 36416// in some cases, the event used has to be determined at runtime 36417// so we used some reserved tokens during compile. 36418const RANGE_TOKEN = '__r'; 36419const CHECKBOX_RADIO_TOKEN = '__c'; 36420function model$1(el, dir, _warn) { 36421 warn$1 = _warn; 36422 const value = dir.value; 36423 const modifiers = dir.modifiers; 36424 const tag = el.tag; 36425 const type = el.attrsMap.type; 36426 { 36427 // inputs with type="file" are read only and setting the input's 36428 // value will throw an error. 36429 if (tag === 'input' && type === 'file') { 36430 warn$1(`<${el.tag} v-model="${value}" type="file">:\n` + 36431 `File inputs are read only. Use a v-on:change listener instead.`, el.rawAttrsMap['v-model']); 36432 } 36433 } 36434 if (el.component) { 36435 genComponentModel(el, value, modifiers); 36436 // component v-model doesn't need extra runtime 36437 return false; 36438 } 36439 else if (tag === 'select') { 36440 genSelect(el, value, modifiers); 36441 } 36442 else if (tag === 'input' && type === 'checkbox') { 36443 genCheckboxModel(el, value, modifiers); 36444 } 36445 else if (tag === 'input' && type === 'radio') { 36446 genRadioModel(el, value, modifiers); 36447 } 36448 else if (tag === 'input' || tag === 'textarea') { 36449 genDefaultModel(el, value, modifiers); 36450 } 36451 else if (!config.isReservedTag(tag)) { 36452 genComponentModel(el, value, modifiers); 36453 // component v-model doesn't need extra runtime 36454 return false; 36455 } 36456 else { 36457 warn$1(`<${el.tag} v-model="${value}">: ` + 36458 `v-model is not supported on this element type. ` + 36459 "If you are working with contenteditable, it's recommended to " + 36460 'wrap a library dedicated for that purpose inside a custom component.', el.rawAttrsMap['v-model']); 36461 } 36462 // ensure runtime directive metadata 36463 return true; 36464} 36465function genCheckboxModel(el, value, modifiers) { 36466 const number = modifiers && modifiers.number; 36467 const valueBinding = getBindingAttr(el, 'value') || 'null'; 36468 const trueValueBinding = getBindingAttr(el, 'true-value') || 'true'; 36469 const falseValueBinding = getBindingAttr(el, 'false-value') || 'false'; 36470 addProp(el, 'checked', `Array.isArray(${value})` + 36471 `?_i(${value},${valueBinding})>-1` + 36472 (trueValueBinding === 'true' 36473 ? `:(${value})` 36474 : `:_q(${value},${trueValueBinding})`)); 36475 addHandler(el, 'change', `var $$a=${value},` + 36476 '$$el=$event.target,' + 36477 `$$c=$$el.checked?(${trueValueBinding}):(${falseValueBinding});` + 36478 'if(Array.isArray($$a)){' + 36479 `var $$v=${number ? '_n(' + valueBinding + ')' : valueBinding},` + 36480 '$$i=_i($$a,$$v);' + 36481 `if($$el.checked){$$i<0&&(${genAssignmentCode(value, '$$a.concat([$$v])')})}` + 36482 `else{$$i>-1&&(${genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')})}` + 36483 `}else{${genAssignmentCode(value, '$$c')}}`, null, true); 36484} 36485function genRadioModel(el, value, modifiers) { 36486 const number = modifiers && modifiers.number; 36487 let valueBinding = getBindingAttr(el, 'value') || 'null'; 36488 valueBinding = number ? `_n(${valueBinding})` : valueBinding; 36489 addProp(el, 'checked', `_q(${value},${valueBinding})`); 36490 addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true); 36491} 36492function genSelect(el, value, modifiers) { 36493 const number = modifiers && modifiers.number; 36494 const selectedVal = `Array.prototype.filter` + 36495 `.call($event.target.options,function(o){return o.selected})` + 36496 `.map(function(o){var val = "_value" in o ? o._value : o.value;` + 36497 `return ${number ? '_n(val)' : 'val'}})`; 36498 const assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]'; 36499 let code = `var $$selectedVal = ${selectedVal};`; 36500 code = `${code} ${genAssignmentCode(value, assignment)}`; 36501 addHandler(el, 'change', code, null, true); 36502} 36503function genDefaultModel(el, value, modifiers) { 36504 const type = el.attrsMap.type; 36505 // warn if v-bind:value conflicts with v-model 36506 // except for inputs with v-bind:type 36507 { 36508 const value = el.attrsMap['v-bind:value'] || el.attrsMap[':value']; 36509 const typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type']; 36510 if (value && !typeBinding) { 36511 const binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value'; 36512 warn$1(`${binding}="${value}" conflicts with v-model on the same element ` + 36513 'because the latter already expands to a value binding internally', el.rawAttrsMap[binding]); 36514 } 36515 } 36516 const { lazy, number, trim } = modifiers || {}; 36517 const needCompositionGuard = !lazy && type !== 'range'; 36518 const event = lazy ? 'change' : type === 'range' ? RANGE_TOKEN : 'input'; 36519 let valueExpression = '$event.target.value'; 36520 if (trim) { 36521 valueExpression = `$event.target.value.trim()`; 36522 } 36523 if (number) { 36524 valueExpression = `_n(${valueExpression})`; 36525 } 36526 let code = genAssignmentCode(value, valueExpression); 36527 if (needCompositionGuard) { 36528 code = `if($event.target.composing)return;${code}`; 36529 } 36530 addProp(el, 'value', `(${value})`); 36531 addHandler(el, event, code, null, true); 36532 if (trim || number) { 36533 addHandler(el, 'blur', '$forceUpdate()'); 36534 } 36535} 36536 36537// normalize v-model event tokens that can only be determined at runtime. 36538// it's important to place the event as the first in the array because 36539// the whole point is ensuring the v-model callback gets called before 36540// user-attached handlers. 36541function normalizeEvents(on) { 36542 /* istanbul ignore if */ 36543 if (isDef(on[RANGE_TOKEN])) { 36544 // IE input[type=range] only supports `change` event 36545 const event = isIE ? 'change' : 'input'; 36546 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); 36547 delete on[RANGE_TOKEN]; 36548 } 36549 // This was originally intended to fix #4521 but no longer necessary 36550 // after 2.5. Keeping it for backwards compat with generated code from < 2.4 36551 /* istanbul ignore if */ 36552 if (isDef(on[CHECKBOX_RADIO_TOKEN])) { 36553 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []); 36554 delete on[CHECKBOX_RADIO_TOKEN]; 36555 } 36556} 36557let target; 36558function createOnceHandler(event, handler, capture) { 36559 const _target = target; // save current target element in closure 36560 return function onceHandler() { 36561 const res = handler.apply(null, arguments); 36562 if (res !== null) { 36563 remove(event, onceHandler, capture, _target); 36564 } 36565 }; 36566} 36567// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp 36568// implementation and does not fire microtasks in between event propagation, so 36569// safe to exclude. 36570const useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); 36571function add(name, handler, capture, passive) { 36572 // async edge case #6566: inner click event triggers patch, event handler 36573 // attached to outer element during patch, and triggered again. This 36574 // happens because browsers fire microtask ticks between event propagation. 36575 // the solution is simple: we save the timestamp when a handler is attached, 36576 // and the handler would only fire if the event passed to it was fired 36577 // AFTER it was attached. 36578 if (useMicrotaskFix) { 36579 const attachedTimestamp = currentFlushTimestamp; 36580 const original = handler; 36581 //@ts-expect-error 36582 handler = original._wrapper = function (e) { 36583 if ( 36584 // no bubbling, should always fire. 36585 // this is just a safety net in case event.timeStamp is unreliable in 36586 // certain weird environments... 36587 e.target === e.currentTarget || 36588 // event is fired after handler attachment 36589 e.timeStamp >= attachedTimestamp || 36590 // bail for environments that have buggy event.timeStamp implementations 36591 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState 36592 // #9681 QtWebEngine event.timeStamp is negative value 36593 e.timeStamp <= 0 || 36594 // #9448 bail if event is fired in another document in a multi-page 36595 // electron/nw.js app, since event.timeStamp will be using a different 36596 // starting reference 36597 e.target.ownerDocument !== document) { 36598 return original.apply(this, arguments); 36599 } 36600 }; 36601 } 36602 target.addEventListener(name, handler, supportsPassive ? { capture, passive } : capture); 36603} 36604function remove(name, handler, capture, _target) { 36605 (_target || target).removeEventListener(name, 36606 //@ts-expect-error 36607 handler._wrapper || handler, capture); 36608} 36609function updateDOMListeners(oldVnode, vnode) { 36610 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) { 36611 return; 36612 } 36613 const on = vnode.data.on || {}; 36614 const oldOn = oldVnode.data.on || {}; 36615 // vnode is empty when removing all listeners, 36616 // and use old vnode dom element 36617 target = vnode.elm || oldVnode.elm; 36618 normalizeEvents(on); 36619 updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context); 36620 target = undefined; 36621} 36622var events = { 36623 create: updateDOMListeners, 36624 update: updateDOMListeners, 36625 // @ts-expect-error emptyNode has actually data 36626 destroy: (vnode) => updateDOMListeners(vnode, emptyNode) 36627}; 36628 36629let svgContainer; 36630function updateDOMProps(oldVnode, vnode) { 36631 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) { 36632 return; 36633 } 36634 let key, cur; 36635 const elm = vnode.elm; 36636 const oldProps = oldVnode.data.domProps || {}; 36637 let props = vnode.data.domProps || {}; 36638 // clone observed objects, as the user probably wants to mutate it 36639 if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) { 36640 props = vnode.data.domProps = extend({}, props); 36641 } 36642 for (key in oldProps) { 36643 if (!(key in props)) { 36644 elm[key] = ''; 36645 } 36646 } 36647 for (key in props) { 36648 cur = props[key]; 36649 // ignore children if the node has textContent or innerHTML, 36650 // as these will throw away existing DOM nodes and cause removal errors 36651 // on subsequent patches (#3360) 36652 if (key === 'textContent' || key === 'innerHTML') { 36653 if (vnode.children) 36654 vnode.children.length = 0; 36655 if (cur === oldProps[key]) 36656 continue; 36657 // #6601 work around Chrome version <= 55 bug where single textNode 36658 // replaced by innerHTML/textContent retains its parentNode property 36659 if (elm.childNodes.length === 1) { 36660 elm.removeChild(elm.childNodes[0]); 36661 } 36662 } 36663 if (key === 'value' && elm.tagName !== 'PROGRESS') { 36664 // store value as _value as well since 36665 // non-string values will be stringified 36666 elm._value = cur; 36667 // avoid resetting cursor position when value is the same 36668 const strCur = isUndef(cur) ? '' : String(cur); 36669 if (shouldUpdateValue(elm, strCur)) { 36670 elm.value = strCur; 36671 } 36672 } 36673 else if (key === 'innerHTML' && 36674 isSVG(elm.tagName) && 36675 isUndef(elm.innerHTML)) { 36676 // IE doesn't support innerHTML for SVG elements 36677 svgContainer = svgContainer || document.createElement('div'); 36678 svgContainer.innerHTML = `<svg>${cur}</svg>`; 36679 const svg = svgContainer.firstChild; 36680 while (elm.firstChild) { 36681 elm.removeChild(elm.firstChild); 36682 } 36683 while (svg.firstChild) { 36684 elm.appendChild(svg.firstChild); 36685 } 36686 } 36687 else if ( 36688 // skip the update if old and new VDOM state is the same. 36689 // `value` is handled separately because the DOM value may be temporarily 36690 // out of sync with VDOM state due to focus, composition and modifiers. 36691 // This #4521 by skipping the unnecessary `checked` update. 36692 cur !== oldProps[key]) { 36693 // some property updates can throw 36694 // e.g. `value` on <progress> w/ non-finite value 36695 try { 36696 elm[key] = cur; 36697 } 36698 catch (e) { } 36699 } 36700 } 36701} 36702function shouldUpdateValue(elm, checkVal) { 36703 return ( 36704 //@ts-expect-error 36705 !elm.composing && 36706 (elm.tagName === 'OPTION' || 36707 isNotInFocusAndDirty(elm, checkVal) || 36708 isDirtyWithModifiers(elm, checkVal))); 36709} 36710function isNotInFocusAndDirty(elm, checkVal) { 36711 // return true when textbox (.number and .trim) loses focus and its value is 36712 // not equal to the updated value 36713 let notInFocus = true; 36714 // #6157 36715 // work around IE bug when accessing document.activeElement in an iframe 36716 try { 36717 notInFocus = document.activeElement !== elm; 36718 } 36719 catch (e) { } 36720 return notInFocus && elm.value !== checkVal; 36721} 36722function isDirtyWithModifiers(elm, newVal) { 36723 const value = elm.value; 36724 const modifiers = elm._vModifiers; // injected by v-model runtime 36725 if (isDef(modifiers)) { 36726 if (modifiers.number) { 36727 return toNumber(value) !== toNumber(newVal); 36728 } 36729 if (modifiers.trim) { 36730 return value.trim() !== newVal.trim(); 36731 } 36732 } 36733 return value !== newVal; 36734} 36735var domProps = { 36736 create: updateDOMProps, 36737 update: updateDOMProps 36738}; 36739 36740const parseStyleText = cached(function (cssText) { 36741 const res = {}; 36742 const listDelimiter = /;(?![^(]*\))/g; 36743 const propertyDelimiter = /:(.+)/; 36744 cssText.split(listDelimiter).forEach(function (item) { 36745 if (item) { 36746 const tmp = item.split(propertyDelimiter); 36747 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim()); 36748 } 36749 }); 36750 return res; 36751}); 36752// merge static and dynamic style data on the same vnode 36753function normalizeStyleData(data) { 36754 const style = normalizeStyleBinding(data.style); 36755 // static style is pre-processed into an object during compilation 36756 // and is always a fresh object, so it's safe to merge into it 36757 return data.staticStyle ? extend(data.staticStyle, style) : style; 36758} 36759// normalize possible array / string values into Object 36760function normalizeStyleBinding(bindingStyle) { 36761 if (Array.isArray(bindingStyle)) { 36762 return toObject(bindingStyle); 36763 } 36764 if (typeof bindingStyle === 'string') { 36765 return parseStyleText(bindingStyle); 36766 } 36767 return bindingStyle; 36768} 36769/** 36770 * parent component style should be after child's 36771 * so that parent component's style could override it 36772 */ 36773function getStyle(vnode, checkChild) { 36774 const res = {}; 36775 let styleData; 36776 if (checkChild) { 36777 let childNode = vnode; 36778 while (childNode.componentInstance) { 36779 childNode = childNode.componentInstance._vnode; 36780 if (childNode && 36781 childNode.data && 36782 (styleData = normalizeStyleData(childNode.data))) { 36783 extend(res, styleData); 36784 } 36785 } 36786 } 36787 if ((styleData = normalizeStyleData(vnode.data))) { 36788 extend(res, styleData); 36789 } 36790 let parentNode = vnode; 36791 // @ts-expect-error parentNode.parent not VNodeWithData 36792 while ((parentNode = parentNode.parent)) { 36793 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) { 36794 extend(res, styleData); 36795 } 36796 } 36797 return res; 36798} 36799 36800const cssVarRE = /^--/; 36801const importantRE = /\s*!important$/; 36802const setProp = (el, name, val) => { 36803 /* istanbul ignore if */ 36804 if (cssVarRE.test(name)) { 36805 el.style.setProperty(name, val); 36806 } 36807 else if (importantRE.test(val)) { 36808 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important'); 36809 } 36810 else { 36811 const normalizedName = normalize(name); 36812 if (Array.isArray(val)) { 36813 // Support values array created by autoprefixer, e.g. 36814 // {display: ["-webkit-box", "-ms-flexbox", "flex"]} 36815 // Set them one by one, and the browser will only set those it can recognize 36816 for (let i = 0, len = val.length; i < len; i++) { 36817 el.style[normalizedName] = val[i]; 36818 } 36819 } 36820 else { 36821 el.style[normalizedName] = val; 36822 } 36823 } 36824}; 36825const vendorNames = ['Webkit', 'Moz', 'ms']; 36826let emptyStyle; 36827const normalize = cached(function (prop) { 36828 emptyStyle = emptyStyle || document.createElement('div').style; 36829 prop = camelize(prop); 36830 if (prop !== 'filter' && prop in emptyStyle) { 36831 return prop; 36832 } 36833 const capName = prop.charAt(0).toUpperCase() + prop.slice(1); 36834 for (let i = 0; i < vendorNames.length; i++) { 36835 const name = vendorNames[i] + capName; 36836 if (name in emptyStyle) { 36837 return name; 36838 } 36839 } 36840}); 36841function updateStyle(oldVnode, vnode) { 36842 const data = vnode.data; 36843 const oldData = oldVnode.data; 36844 if (isUndef(data.staticStyle) && 36845 isUndef(data.style) && 36846 isUndef(oldData.staticStyle) && 36847 isUndef(oldData.style)) { 36848 return; 36849 } 36850 let cur, name; 36851 const el = vnode.elm; 36852 const oldStaticStyle = oldData.staticStyle; 36853 const oldStyleBinding = oldData.normalizedStyle || oldData.style || {}; 36854 // if static style exists, stylebinding already merged into it when doing normalizeStyleData 36855 const oldStyle = oldStaticStyle || oldStyleBinding; 36856 const style = normalizeStyleBinding(vnode.data.style) || {}; 36857 // store normalized style under a different key for next diff 36858 // make sure to clone it if it's reactive, since the user likely wants 36859 // to mutate it. 36860 vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style; 36861 const newStyle = getStyle(vnode, true); 36862 for (name in oldStyle) { 36863 if (isUndef(newStyle[name])) { 36864 setProp(el, name, ''); 36865 } 36866 } 36867 for (name in newStyle) { 36868 cur = newStyle[name]; 36869 // ie9 setting to null has no effect, must use empty string 36870 setProp(el, name, cur == null ? '' : cur); 36871 } 36872} 36873var style$1 = { 36874 create: updateStyle, 36875 update: updateStyle 36876}; 36877 36878const whitespaceRE$1 = /\s+/; 36879/** 36880 * Add class with compatibility for SVG since classList is not supported on 36881 * SVG elements in IE 36882 */ 36883function addClass(el, cls) { 36884 /* istanbul ignore if */ 36885 if (!cls || !(cls = cls.trim())) { 36886 return; 36887 } 36888 /* istanbul ignore else */ 36889 if (el.classList) { 36890 if (cls.indexOf(' ') > -1) { 36891 cls.split(whitespaceRE$1).forEach(c => el.classList.add(c)); 36892 } 36893 else { 36894 el.classList.add(cls); 36895 } 36896 } 36897 else { 36898 const cur = ` ${el.getAttribute('class') || ''} `; 36899 if (cur.indexOf(' ' + cls + ' ') < 0) { 36900 el.setAttribute('class', (cur + cls).trim()); 36901 } 36902 } 36903} 36904/** 36905 * Remove class with compatibility for SVG since classList is not supported on 36906 * SVG elements in IE 36907 */ 36908function removeClass(el, cls) { 36909 /* istanbul ignore if */ 36910 if (!cls || !(cls = cls.trim())) { 36911 return; 36912 } 36913 /* istanbul ignore else */ 36914 if (el.classList) { 36915 if (cls.indexOf(' ') > -1) { 36916 cls.split(whitespaceRE$1).forEach(c => el.classList.remove(c)); 36917 } 36918 else { 36919 el.classList.remove(cls); 36920 } 36921 if (!el.classList.length) { 36922 el.removeAttribute('class'); 36923 } 36924 } 36925 else { 36926 let cur = ` ${el.getAttribute('class') || ''} `; 36927 const tar = ' ' + cls + ' '; 36928 while (cur.indexOf(tar) >= 0) { 36929 cur = cur.replace(tar, ' '); 36930 } 36931 cur = cur.trim(); 36932 if (cur) { 36933 el.setAttribute('class', cur); 36934 } 36935 else { 36936 el.removeAttribute('class'); 36937 } 36938 } 36939} 36940 36941function resolveTransition(def) { 36942 if (!def) { 36943 return; 36944 } 36945 /* istanbul ignore else */ 36946 if (typeof def === 'object') { 36947 const res = {}; 36948 if (def.css !== false) { 36949 extend(res, autoCssTransition(def.name || 'v')); 36950 } 36951 extend(res, def); 36952 return res; 36953 } 36954 else if (typeof def === 'string') { 36955 return autoCssTransition(def); 36956 } 36957} 36958const autoCssTransition = cached(name => { 36959 return { 36960 enterClass: `${name}-enter`, 36961 enterToClass: `${name}-enter-to`, 36962 enterActiveClass: `${name}-enter-active`, 36963 leaveClass: `${name}-leave`, 36964 leaveToClass: `${name}-leave-to`, 36965 leaveActiveClass: `${name}-leave-active` 36966 }; 36967}); 36968const hasTransition = inBrowser && !isIE9; 36969const TRANSITION = 'transition'; 36970const ANIMATION = 'animation'; 36971// Transition property/event sniffing 36972let transitionProp = 'transition'; 36973let transitionEndEvent = 'transitionend'; 36974let animationProp = 'animation'; 36975let animationEndEvent = 'animationend'; 36976if (hasTransition) { 36977 /* istanbul ignore if */ 36978 if (window.ontransitionend === undefined && 36979 window.onwebkittransitionend !== undefined) { 36980 transitionProp = 'WebkitTransition'; 36981 transitionEndEvent = 'webkitTransitionEnd'; 36982 } 36983 if (window.onanimationend === undefined && 36984 window.onwebkitanimationend !== undefined) { 36985 animationProp = 'WebkitAnimation'; 36986 animationEndEvent = 'webkitAnimationEnd'; 36987 } 36988} 36989// binding to window is necessary to make hot reload work in IE in strict mode 36990const raf = inBrowser 36991 ? window.requestAnimationFrame 36992 ? window.requestAnimationFrame.bind(window) 36993 : setTimeout 36994 : /* istanbul ignore next */ /* istanbul ignore next */ fn => fn(); 36995function nextFrame(fn) { 36996 raf(() => { 36997 // @ts-expect-error 36998 raf(fn); 36999 }); 37000} 37001function addTransitionClass(el, cls) { 37002 const transitionClasses = el._transitionClasses || (el._transitionClasses = []); 37003 if (transitionClasses.indexOf(cls) < 0) { 37004 transitionClasses.push(cls); 37005 addClass(el, cls); 37006 } 37007} 37008function removeTransitionClass(el, cls) { 37009 if (el._transitionClasses) { 37010 remove$2(el._transitionClasses, cls); 37011 } 37012 removeClass(el, cls); 37013} 37014function whenTransitionEnds(el, expectedType, cb) { 37015 const { type, timeout, propCount } = getTransitionInfo(el, expectedType); 37016 if (!type) 37017 return cb(); 37018 const event = type === TRANSITION ? transitionEndEvent : animationEndEvent; 37019 let ended = 0; 37020 const end = () => { 37021 el.removeEventListener(event, onEnd); 37022 cb(); 37023 }; 37024 const onEnd = e => { 37025 if (e.target === el) { 37026 if (++ended >= propCount) { 37027 end(); 37028 } 37029 } 37030 }; 37031 setTimeout(() => { 37032 if (ended < propCount) { 37033 end(); 37034 } 37035 }, timeout + 1); 37036 el.addEventListener(event, onEnd); 37037} 37038const transformRE = /\b(transform|all)(,|$)/; 37039function getTransitionInfo(el, expectedType) { 37040 const styles = window.getComputedStyle(el); 37041 // JSDOM may return undefined for transition properties 37042 const transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', '); 37043 const transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', '); 37044 const transitionTimeout = getTimeout(transitionDelays, transitionDurations); 37045 const animationDelays = (styles[animationProp + 'Delay'] || '').split(', '); 37046 const animationDurations = (styles[animationProp + 'Duration'] || '').split(', '); 37047 const animationTimeout = getTimeout(animationDelays, animationDurations); 37048 let type; 37049 let timeout = 0; 37050 let propCount = 0; 37051 /* istanbul ignore if */ 37052 if (expectedType === TRANSITION) { 37053 if (transitionTimeout > 0) { 37054 type = TRANSITION; 37055 timeout = transitionTimeout; 37056 propCount = transitionDurations.length; 37057 } 37058 } 37059 else if (expectedType === ANIMATION) { 37060 if (animationTimeout > 0) { 37061 type = ANIMATION; 37062 timeout = animationTimeout; 37063 propCount = animationDurations.length; 37064 } 37065 } 37066 else { 37067 timeout = Math.max(transitionTimeout, animationTimeout); 37068 type = 37069 timeout > 0 37070 ? transitionTimeout > animationTimeout 37071 ? TRANSITION 37072 : ANIMATION 37073 : null; 37074 propCount = type 37075 ? type === TRANSITION 37076 ? transitionDurations.length 37077 : animationDurations.length 37078 : 0; 37079 } 37080 const hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']); 37081 return { 37082 type, 37083 timeout, 37084 propCount, 37085 hasTransform 37086 }; 37087} 37088function getTimeout(delays, durations) { 37089 /* istanbul ignore next */ 37090 while (delays.length < durations.length) { 37091 delays = delays.concat(delays); 37092 } 37093 return Math.max.apply(null, durations.map((d, i) => { 37094 return toMs(d) + toMs(delays[i]); 37095 })); 37096} 37097// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers 37098// in a locale-dependent way, using a comma instead of a dot. 37099// If comma is not replaced with a dot, the input will be rounded down (i.e. acting 37100// as a floor function) causing unexpected behaviors 37101function toMs(s) { 37102 return Number(s.slice(0, -1).replace(',', '.')) * 1000; 37103} 37104 37105function enter(vnode, toggleDisplay) { 37106 const el = vnode.elm; 37107 // call leave callback now 37108 if (isDef(el._leaveCb)) { 37109 el._leaveCb.cancelled = true; 37110 el._leaveCb(); 37111 } 37112 const data = resolveTransition(vnode.data.transition); 37113 if (isUndef(data)) { 37114 return; 37115 } 37116 /* istanbul ignore if */ 37117 if (isDef(el._enterCb) || el.nodeType !== 1) { 37118 return; 37119 } 37120 const { css, type, enterClass, enterToClass, enterActiveClass, appearClass, appearToClass, appearActiveClass, beforeEnter, enter, afterEnter, enterCancelled, beforeAppear, appear, afterAppear, appearCancelled, duration } = data; 37121 // activeInstance will always be the <transition> component managing this 37122 // transition. One edge case to check is when the <transition> is placed 37123 // as the root node of a child component. In that case we need to check 37124 // <transition>'s parent for appear check. 37125 let context = activeInstance; 37126 let transitionNode = activeInstance.$vnode; 37127 while (transitionNode && transitionNode.parent) { 37128 context = transitionNode.context; 37129 transitionNode = transitionNode.parent; 37130 } 37131 const isAppear = !context._isMounted || !vnode.isRootInsert; 37132 if (isAppear && !appear && appear !== '') { 37133 return; 37134 } 37135 const startClass = isAppear && appearClass ? appearClass : enterClass; 37136 const activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass; 37137 const toClass = isAppear && appearToClass ? appearToClass : enterToClass; 37138 const beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter; 37139 const enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter; 37140 const afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter; 37141 const enterCancelledHook = isAppear 37142 ? appearCancelled || enterCancelled 37143 : enterCancelled; 37144 const explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration); 37145 if (explicitEnterDuration != null) { 37146 checkDuration(explicitEnterDuration, 'enter', vnode); 37147 } 37148 const expectsCSS = css !== false && !isIE9; 37149 const userWantsControl = getHookArgumentsLength(enterHook); 37150 const cb = (el._enterCb = once(() => { 37151 if (expectsCSS) { 37152 removeTransitionClass(el, toClass); 37153 removeTransitionClass(el, activeClass); 37154 } 37155 // @ts-expect-error 37156 if (cb.cancelled) { 37157 if (expectsCSS) { 37158 removeTransitionClass(el, startClass); 37159 } 37160 enterCancelledHook && enterCancelledHook(el); 37161 } 37162 else { 37163 afterEnterHook && afterEnterHook(el); 37164 } 37165 el._enterCb = null; 37166 })); 37167 if (!vnode.data.show) { 37168 // remove pending leave element on enter by injecting an insert hook 37169 mergeVNodeHook(vnode, 'insert', () => { 37170 const parent = el.parentNode; 37171 const pendingNode = parent && parent._pending && parent._pending[vnode.key]; 37172 if (pendingNode && 37173 pendingNode.tag === vnode.tag && 37174 pendingNode.elm._leaveCb) { 37175 pendingNode.elm._leaveCb(); 37176 } 37177 enterHook && enterHook(el, cb); 37178 }); 37179 } 37180 // start enter transition 37181 beforeEnterHook && beforeEnterHook(el); 37182 if (expectsCSS) { 37183 addTransitionClass(el, startClass); 37184 addTransitionClass(el, activeClass); 37185 nextFrame(() => { 37186 removeTransitionClass(el, startClass); 37187 // @ts-expect-error 37188 if (!cb.cancelled) { 37189 addTransitionClass(el, toClass); 37190 if (!userWantsControl) { 37191 if (isValidDuration(explicitEnterDuration)) { 37192 setTimeout(cb, explicitEnterDuration); 37193 } 37194 else { 37195 whenTransitionEnds(el, type, cb); 37196 } 37197 } 37198 } 37199 }); 37200 } 37201 if (vnode.data.show) { 37202 toggleDisplay && toggleDisplay(); 37203 enterHook && enterHook(el, cb); 37204 } 37205 if (!expectsCSS && !userWantsControl) { 37206 cb(); 37207 } 37208} 37209function leave(vnode, rm) { 37210 const el = vnode.elm; 37211 // call enter callback now 37212 if (isDef(el._enterCb)) { 37213 el._enterCb.cancelled = true; 37214 el._enterCb(); 37215 } 37216 const data = resolveTransition(vnode.data.transition); 37217 if (isUndef(data) || el.nodeType !== 1) { 37218 return rm(); 37219 } 37220 /* istanbul ignore if */ 37221 if (isDef(el._leaveCb)) { 37222 return; 37223 } 37224 const { css, type, leaveClass, leaveToClass, leaveActiveClass, beforeLeave, leave, afterLeave, leaveCancelled, delayLeave, duration } = data; 37225 const expectsCSS = css !== false && !isIE9; 37226 const userWantsControl = getHookArgumentsLength(leave); 37227 const explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration); 37228 if (isDef(explicitLeaveDuration)) { 37229 checkDuration(explicitLeaveDuration, 'leave', vnode); 37230 } 37231 const cb = (el._leaveCb = once(() => { 37232 if (el.parentNode && el.parentNode._pending) { 37233 el.parentNode._pending[vnode.key] = null; 37234 } 37235 if (expectsCSS) { 37236 removeTransitionClass(el, leaveToClass); 37237 removeTransitionClass(el, leaveActiveClass); 37238 } 37239 // @ts-expect-error 37240 if (cb.cancelled) { 37241 if (expectsCSS) { 37242 removeTransitionClass(el, leaveClass); 37243 } 37244 leaveCancelled && leaveCancelled(el); 37245 } 37246 else { 37247 rm(); 37248 afterLeave && afterLeave(el); 37249 } 37250 el._leaveCb = null; 37251 })); 37252 if (delayLeave) { 37253 delayLeave(performLeave); 37254 } 37255 else { 37256 performLeave(); 37257 } 37258 function performLeave() { 37259 // the delayed leave may have already been cancelled 37260 // @ts-expect-error 37261 if (cb.cancelled) { 37262 return; 37263 } 37264 // record leaving element 37265 if (!vnode.data.show && el.parentNode) { 37266 (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = 37267 vnode; 37268 } 37269 beforeLeave && beforeLeave(el); 37270 if (expectsCSS) { 37271 addTransitionClass(el, leaveClass); 37272 addTransitionClass(el, leaveActiveClass); 37273 nextFrame(() => { 37274 removeTransitionClass(el, leaveClass); 37275 // @ts-expect-error 37276 if (!cb.cancelled) { 37277 addTransitionClass(el, leaveToClass); 37278 if (!userWantsControl) { 37279 if (isValidDuration(explicitLeaveDuration)) { 37280 setTimeout(cb, explicitLeaveDuration); 37281 } 37282 else { 37283 whenTransitionEnds(el, type, cb); 37284 } 37285 } 37286 } 37287 }); 37288 } 37289 leave && leave(el, cb); 37290 if (!expectsCSS && !userWantsControl) { 37291 cb(); 37292 } 37293 } 37294} 37295// only used in dev mode 37296function checkDuration(val, name, vnode) { 37297 if (typeof val !== 'number') { 37298 warn$2(`<transition> explicit ${name} duration is not a valid number - ` + 37299 `got ${JSON.stringify(val)}.`, vnode.context); 37300 } 37301 else if (isNaN(val)) { 37302 warn$2(`<transition> explicit ${name} duration is NaN - ` + 37303 'the duration expression might be incorrect.', vnode.context); 37304 } 37305} 37306function isValidDuration(val) { 37307 return typeof val === 'number' && !isNaN(val); 37308} 37309/** 37310 * Normalize a transition hook's argument length. The hook may be: 37311 * - a merged hook (invoker) with the original in .fns 37312 * - a wrapped component method (check ._length) 37313 * - a plain function (.length) 37314 */ 37315function getHookArgumentsLength(fn) { 37316 if (isUndef(fn)) { 37317 return false; 37318 } 37319 // @ts-expect-error 37320 const invokerFns = fn.fns; 37321 if (isDef(invokerFns)) { 37322 // invoker 37323 return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns); 37324 } 37325 else { 37326 // @ts-expect-error 37327 return (fn._length || fn.length) > 1; 37328 } 37329} 37330function _enter(_, vnode) { 37331 if (vnode.data.show !== true) { 37332 enter(vnode); 37333 } 37334} 37335var transition = inBrowser 37336 ? { 37337 create: _enter, 37338 activate: _enter, 37339 remove(vnode, rm) { 37340 /* istanbul ignore else */ 37341 if (vnode.data.show !== true) { 37342 // @ts-expect-error 37343 leave(vnode, rm); 37344 } 37345 else { 37346 rm(); 37347 } 37348 } 37349 } 37350 : {}; 37351 37352var platformModules = [attrs, klass$1, events, domProps, style$1, transition]; 37353 37354// the directive module should be applied last, after all 37355// built-in modules have been applied. 37356const modules$1 = platformModules.concat(baseModules); 37357const patch = createPatchFunction({ nodeOps, modules: modules$1 }); 37358 37359/** 37360 * Not type checking this file because flow doesn't like attaching 37361 * properties to Elements. 37362 */ 37363/* istanbul ignore if */ 37364if (isIE9) { 37365 // http://www.matts411.com/post/internet-explorer-9-oninput/ 37366 document.addEventListener('selectionchange', () => { 37367 const el = document.activeElement; 37368 // @ts-expect-error 37369 if (el && el.vmodel) { 37370 trigger(el, 'input'); 37371 } 37372 }); 37373} 37374const directive = { 37375 inserted(el, binding, vnode, oldVnode) { 37376 if (vnode.tag === 'select') { 37377 // #6903 37378 if (oldVnode.elm && !oldVnode.elm._vOptions) { 37379 mergeVNodeHook(vnode, 'postpatch', () => { 37380 directive.componentUpdated(el, binding, vnode); 37381 }); 37382 } 37383 else { 37384 setSelected(el, binding, vnode.context); 37385 } 37386 el._vOptions = [].map.call(el.options, getValue); 37387 } 37388 else if (vnode.tag === 'textarea' || isTextInputType(el.type)) { 37389 el._vModifiers = binding.modifiers; 37390 if (!binding.modifiers.lazy) { 37391 el.addEventListener('compositionstart', onCompositionStart); 37392 el.addEventListener('compositionend', onCompositionEnd); 37393 // Safari < 10.2 & UIWebView doesn't fire compositionend when 37394 // switching focus before confirming composition choice 37395 // this also fixes the issue where some browsers e.g. iOS Chrome 37396 // fires "change" instead of "input" on autocomplete. 37397 el.addEventListener('change', onCompositionEnd); 37398 /* istanbul ignore if */ 37399 if (isIE9) { 37400 el.vmodel = true; 37401 } 37402 } 37403 } 37404 }, 37405 componentUpdated(el, binding, vnode) { 37406 if (vnode.tag === 'select') { 37407 setSelected(el, binding, vnode.context); 37408 // in case the options rendered by v-for have changed, 37409 // it's possible that the value is out-of-sync with the rendered options. 37410 // detect such cases and filter out values that no longer has a matching 37411 // option in the DOM. 37412 const prevOptions = el._vOptions; 37413 const curOptions = (el._vOptions = [].map.call(el.options, getValue)); 37414 if (curOptions.some((o, i) => !looseEqual(o, prevOptions[i]))) { 37415 // trigger change event if 37416 // no matching option found for at least one value 37417 const needReset = el.multiple 37418 ? binding.value.some(v => hasNoMatchingOption(v, curOptions)) 37419 : binding.value !== binding.oldValue && 37420 hasNoMatchingOption(binding.value, curOptions); 37421 if (needReset) { 37422 trigger(el, 'change'); 37423 } 37424 } 37425 } 37426 } 37427}; 37428function setSelected(el, binding, vm) { 37429 actuallySetSelected(el, binding, vm); 37430 /* istanbul ignore if */ 37431 if (isIE || isEdge) { 37432 setTimeout(() => { 37433 actuallySetSelected(el, binding, vm); 37434 }, 0); 37435 } 37436} 37437function actuallySetSelected(el, binding, vm) { 37438 const value = binding.value; 37439 const isMultiple = el.multiple; 37440 if (isMultiple && !Array.isArray(value)) { 37441 warn$2(`<select multiple v-model="${binding.expression}"> ` + 37442 `expects an Array value for its binding, but got ${Object.prototype.toString 37443 .call(value) 37444 .slice(8, -1)}`, vm); 37445 return; 37446 } 37447 let selected, option; 37448 for (let i = 0, l = el.options.length; i < l; i++) { 37449 option = el.options[i]; 37450 if (isMultiple) { 37451 selected = looseIndexOf(value, getValue(option)) > -1; 37452 if (option.selected !== selected) { 37453 option.selected = selected; 37454 } 37455 } 37456 else { 37457 if (looseEqual(getValue(option), value)) { 37458 if (el.selectedIndex !== i) { 37459 el.selectedIndex = i; 37460 } 37461 return; 37462 } 37463 } 37464 } 37465 if (!isMultiple) { 37466 el.selectedIndex = -1; 37467 } 37468} 37469function hasNoMatchingOption(value, options) { 37470 return options.every(o => !looseEqual(o, value)); 37471} 37472function getValue(option) { 37473 return '_value' in option ? option._value : option.value; 37474} 37475function onCompositionStart(e) { 37476 e.target.composing = true; 37477} 37478function onCompositionEnd(e) { 37479 // prevent triggering an input event for no reason 37480 if (!e.target.composing) 37481 return; 37482 e.target.composing = false; 37483 trigger(e.target, 'input'); 37484} 37485function trigger(el, type) { 37486 const e = document.createEvent('HTMLEvents'); 37487 e.initEvent(type, true, true); 37488 el.dispatchEvent(e); 37489} 37490 37491// recursively search for possible transition defined inside the component root 37492function locateNode(vnode) { 37493 // @ts-expect-error 37494 return vnode.componentInstance && (!vnode.data || !vnode.data.transition) 37495 ? locateNode(vnode.componentInstance._vnode) 37496 : vnode; 37497} 37498var show = { 37499 bind(el, { value }, vnode) { 37500 vnode = locateNode(vnode); 37501 const transition = vnode.data && vnode.data.transition; 37502 const originalDisplay = (el.__vOriginalDisplay = 37503 el.style.display === 'none' ? '' : el.style.display); 37504 if (value && transition) { 37505 vnode.data.show = true; 37506 enter(vnode, () => { 37507 el.style.display = originalDisplay; 37508 }); 37509 } 37510 else { 37511 el.style.display = value ? originalDisplay : 'none'; 37512 } 37513 }, 37514 update(el, { value, oldValue }, vnode) { 37515 /* istanbul ignore if */ 37516 if (!value === !oldValue) 37517 return; 37518 vnode = locateNode(vnode); 37519 const transition = vnode.data && vnode.data.transition; 37520 if (transition) { 37521 vnode.data.show = true; 37522 if (value) { 37523 enter(vnode, () => { 37524 el.style.display = el.__vOriginalDisplay; 37525 }); 37526 } 37527 else { 37528 leave(vnode, () => { 37529 el.style.display = 'none'; 37530 }); 37531 } 37532 } 37533 else { 37534 el.style.display = value ? el.__vOriginalDisplay : 'none'; 37535 } 37536 }, 37537 unbind(el, binding, vnode, oldVnode, isDestroy) { 37538 if (!isDestroy) { 37539 el.style.display = el.__vOriginalDisplay; 37540 } 37541 } 37542}; 37543 37544var platformDirectives = { 37545 model: directive, 37546 show 37547}; 37548 37549// Provides transition support for a single element/component. 37550const transitionProps = { 37551 name: String, 37552 appear: Boolean, 37553 css: Boolean, 37554 mode: String, 37555 type: String, 37556 enterClass: String, 37557 leaveClass: String, 37558 enterToClass: String, 37559 leaveToClass: String, 37560 enterActiveClass: String, 37561 leaveActiveClass: String, 37562 appearClass: String, 37563 appearActiveClass: String, 37564 appearToClass: String, 37565 duration: [Number, String, Object] 37566}; 37567// in case the child is also an abstract component, e.g. <keep-alive> 37568// we want to recursively retrieve the real component to be rendered 37569function getRealChild(vnode) { 37570 const compOptions = vnode && vnode.componentOptions; 37571 if (compOptions && compOptions.Ctor.options.abstract) { 37572 return getRealChild(getFirstComponentChild(compOptions.children)); 37573 } 37574 else { 37575 return vnode; 37576 } 37577} 37578function extractTransitionData(comp) { 37579 const data = {}; 37580 const options = comp.$options; 37581 // props 37582 for (const key in options.propsData) { 37583 data[key] = comp[key]; 37584 } 37585 // events. 37586 // extract listeners and pass them directly to the transition methods 37587 const listeners = options._parentListeners; 37588 for (const key in listeners) { 37589 data[camelize(key)] = listeners[key]; 37590 } 37591 return data; 37592} 37593function placeholder(h, rawChild) { 37594 // @ts-expect-error 37595 if (/\d-keep-alive$/.test(rawChild.tag)) { 37596 return h('keep-alive', { 37597 props: rawChild.componentOptions.propsData 37598 }); 37599 } 37600} 37601function hasParentTransition(vnode) { 37602 while ((vnode = vnode.parent)) { 37603 if (vnode.data.transition) { 37604 return true; 37605 } 37606 } 37607} 37608function isSameChild(child, oldChild) { 37609 return oldChild.key === child.key && oldChild.tag === child.tag; 37610} 37611const isNotTextNode = (c) => c.tag || isAsyncPlaceholder(c); 37612const isVShowDirective = d => d.name === 'show'; 37613var Transition = { 37614 name: 'transition', 37615 props: transitionProps, 37616 abstract: true, 37617 render(h) { 37618 let children = this.$slots.default; 37619 if (!children) { 37620 return; 37621 } 37622 // filter out text nodes (possible whitespaces) 37623 children = children.filter(isNotTextNode); 37624 /* istanbul ignore if */ 37625 if (!children.length) { 37626 return; 37627 } 37628 // warn multiple elements 37629 if (children.length > 1) { 37630 warn$2('<transition> can only be used on a single element. Use ' + 37631 '<transition-group> for lists.', this.$parent); 37632 } 37633 const mode = this.mode; 37634 // warn invalid mode 37635 if (mode && mode !== 'in-out' && mode !== 'out-in') { 37636 warn$2('invalid <transition> mode: ' + mode, this.$parent); 37637 } 37638 const rawChild = children[0]; 37639 // if this is a component root node and the component's 37640 // parent container node also has transition, skip. 37641 if (hasParentTransition(this.$vnode)) { 37642 return rawChild; 37643 } 37644 // apply transition data to child 37645 // use getRealChild() to ignore abstract components e.g. keep-alive 37646 const child = getRealChild(rawChild); 37647 /* istanbul ignore if */ 37648 if (!child) { 37649 return rawChild; 37650 } 37651 if (this._leaving) { 37652 return placeholder(h, rawChild); 37653 } 37654 // ensure a key that is unique to the vnode type and to this transition 37655 // component instance. This key will be used to remove pending leaving nodes 37656 // during entering. 37657 const id = `__transition-${this._uid}-`; 37658 child.key = 37659 child.key == null 37660 ? child.isComment 37661 ? id + 'comment' 37662 : id + child.tag 37663 : isPrimitive(child.key) 37664 ? String(child.key).indexOf(id) === 0 37665 ? child.key 37666 : id + child.key 37667 : child.key; 37668 const data = ((child.data || (child.data = {})).transition = 37669 extractTransitionData(this)); 37670 const oldRawChild = this._vnode; 37671 const oldChild = getRealChild(oldRawChild); 37672 // mark v-show 37673 // so that the transition module can hand over the control to the directive 37674 if (child.data.directives && child.data.directives.some(isVShowDirective)) { 37675 child.data.show = true; 37676 } 37677 if (oldChild && 37678 oldChild.data && 37679 !isSameChild(child, oldChild) && 37680 !isAsyncPlaceholder(oldChild) && 37681 // #6687 component root is a comment node 37682 !(oldChild.componentInstance && 37683 oldChild.componentInstance._vnode.isComment)) { 37684 // replace old child transition data with fresh one 37685 // important for dynamic transitions! 37686 const oldData = (oldChild.data.transition = extend({}, data)); 37687 // handle transition mode 37688 if (mode === 'out-in') { 37689 // return placeholder node and queue update when leave finishes 37690 this._leaving = true; 37691 mergeVNodeHook(oldData, 'afterLeave', () => { 37692 this._leaving = false; 37693 this.$forceUpdate(); 37694 }); 37695 return placeholder(h, rawChild); 37696 } 37697 else if (mode === 'in-out') { 37698 if (isAsyncPlaceholder(child)) { 37699 return oldRawChild; 37700 } 37701 let delayedLeave; 37702 const performLeave = () => { 37703 delayedLeave(); 37704 }; 37705 mergeVNodeHook(data, 'afterEnter', performLeave); 37706 mergeVNodeHook(data, 'enterCancelled', performLeave); 37707 mergeVNodeHook(oldData, 'delayLeave', leave => { 37708 delayedLeave = leave; 37709 }); 37710 } 37711 } 37712 return rawChild; 37713 } 37714}; 37715 37716// Provides transition support for list items. 37717const props = extend({ 37718 tag: String, 37719 moveClass: String 37720}, transitionProps); 37721delete props.mode; 37722var TransitionGroup = { 37723 props, 37724 beforeMount() { 37725 const update = this._update; 37726 this._update = (vnode, hydrating) => { 37727 const restoreActiveInstance = setActiveInstance(this); 37728 // force removing pass 37729 this.__patch__(this._vnode, this.kept, false, // hydrating 37730 true // removeOnly (!important, avoids unnecessary moves) 37731 ); 37732 this._vnode = this.kept; 37733 restoreActiveInstance(); 37734 update.call(this, vnode, hydrating); 37735 }; 37736 }, 37737 render(h) { 37738 const tag = this.tag || this.$vnode.data.tag || 'span'; 37739 const map = Object.create(null); 37740 const prevChildren = (this.prevChildren = this.children); 37741 const rawChildren = this.$slots.default || []; 37742 const children = (this.children = []); 37743 const transitionData = extractTransitionData(this); 37744 for (let i = 0; i < rawChildren.length; i++) { 37745 const c = rawChildren[i]; 37746 if (c.tag) { 37747 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) { 37748 children.push(c); 37749 map[c.key] = c; 37750 (c.data || (c.data = {})).transition = transitionData; 37751 } 37752 else { 37753 const opts = c.componentOptions; 37754 const name = opts 37755 ? getComponentName(opts.Ctor.options) || opts.tag || '' 37756 : c.tag; 37757 warn$2(`<transition-group> children must be keyed: <${name}>`); 37758 } 37759 } 37760 } 37761 if (prevChildren) { 37762 const kept = []; 37763 const removed = []; 37764 for (let i = 0; i < prevChildren.length; i++) { 37765 const c = prevChildren[i]; 37766 c.data.transition = transitionData; 37767 // @ts-expect-error .getBoundingClientRect is not typed in Node 37768 c.data.pos = c.elm.getBoundingClientRect(); 37769 if (map[c.key]) { 37770 kept.push(c); 37771 } 37772 else { 37773 removed.push(c); 37774 } 37775 } 37776 this.kept = h(tag, null, kept); 37777 this.removed = removed; 37778 } 37779 return h(tag, null, children); 37780 }, 37781 updated() { 37782 const children = this.prevChildren; 37783 const moveClass = this.moveClass || (this.name || 'v') + '-move'; 37784 if (!children.length || !this.hasMove(children[0].elm, moveClass)) { 37785 return; 37786 } 37787 // we divide the work into three loops to avoid mixing DOM reads and writes 37788 // in each iteration - which helps prevent layout thrashing. 37789 children.forEach(callPendingCbs); 37790 children.forEach(recordPosition); 37791 children.forEach(applyTranslation); 37792 // force reflow to put everything in position 37793 // assign to this to avoid being removed in tree-shaking 37794 // $flow-disable-line 37795 this._reflow = document.body.offsetHeight; 37796 children.forEach((c) => { 37797 if (c.data.moved) { 37798 const el = c.elm; 37799 const s = el.style; 37800 addTransitionClass(el, moveClass); 37801 s.transform = s.WebkitTransform = s.transitionDuration = ''; 37802 el.addEventListener(transitionEndEvent, (el._moveCb = function cb(e) { 37803 if (e && e.target !== el) { 37804 return; 37805 } 37806 if (!e || /transform$/.test(e.propertyName)) { 37807 el.removeEventListener(transitionEndEvent, cb); 37808 el._moveCb = null; 37809 removeTransitionClass(el, moveClass); 37810 } 37811 })); 37812 } 37813 }); 37814 }, 37815 methods: { 37816 hasMove(el, moveClass) { 37817 /* istanbul ignore if */ 37818 if (!hasTransition) { 37819 return false; 37820 } 37821 /* istanbul ignore if */ 37822 if (this._hasMove) { 37823 return this._hasMove; 37824 } 37825 // Detect whether an element with the move class applied has 37826 // CSS transitions. Since the element may be inside an entering 37827 // transition at this very moment, we make a clone of it and remove 37828 // all other transition classes applied to ensure only the move class 37829 // is applied. 37830 const clone = el.cloneNode(); 37831 if (el._transitionClasses) { 37832 el._transitionClasses.forEach((cls) => { 37833 removeClass(clone, cls); 37834 }); 37835 } 37836 addClass(clone, moveClass); 37837 clone.style.display = 'none'; 37838 this.$el.appendChild(clone); 37839 const info = getTransitionInfo(clone); 37840 this.$el.removeChild(clone); 37841 return (this._hasMove = info.hasTransform); 37842 } 37843 } 37844}; 37845function callPendingCbs(c) { 37846 /* istanbul ignore if */ 37847 if (c.elm._moveCb) { 37848 c.elm._moveCb(); 37849 } 37850 /* istanbul ignore if */ 37851 if (c.elm._enterCb) { 37852 c.elm._enterCb(); 37853 } 37854} 37855function recordPosition(c) { 37856 c.data.newPos = c.elm.getBoundingClientRect(); 37857} 37858function applyTranslation(c) { 37859 const oldPos = c.data.pos; 37860 const newPos = c.data.newPos; 37861 const dx = oldPos.left - newPos.left; 37862 const dy = oldPos.top - newPos.top; 37863 if (dx || dy) { 37864 c.data.moved = true; 37865 const s = c.elm.style; 37866 s.transform = s.WebkitTransform = `translate(${dx}px,${dy}px)`; 37867 s.transitionDuration = '0s'; 37868 } 37869} 37870 37871var platformComponents = { 37872 Transition, 37873 TransitionGroup 37874}; 37875 37876// install platform specific utils 37877Vue.config.mustUseProp = mustUseProp; 37878Vue.config.isReservedTag = isReservedTag; 37879Vue.config.isReservedAttr = isReservedAttr; 37880Vue.config.getTagNamespace = getTagNamespace; 37881Vue.config.isUnknownElement = isUnknownElement; 37882// install platform runtime directives & components 37883extend(Vue.options.directives, platformDirectives); 37884extend(Vue.options.components, platformComponents); 37885// install platform patch function 37886Vue.prototype.__patch__ = inBrowser ? patch : noop; 37887// public mount method 37888Vue.prototype.$mount = function (el, hydrating) { 37889 el = el && inBrowser ? query(el) : undefined; 37890 return mountComponent(this, el, hydrating); 37891}; 37892// devtools global hook 37893/* istanbul ignore next */ 37894if (inBrowser) { 37895 setTimeout(() => { 37896 if (config.devtools) { 37897 if (devtools) { 37898 devtools.emit('init', Vue); 37899 } 37900 else { 37901 // @ts-expect-error 37902 console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' + 37903 'https://github.com/vuejs/vue-devtools'); 37904 } 37905 } 37906 if (config.productionTip !== false && 37907 typeof console !== 'undefined') { 37908 // @ts-expect-error 37909 console[console.info ? 'info' : 'log'](`You are running Vue in development mode.\n` + 37910 `Make sure to turn on production mode when deploying for production.\n` + 37911 `See more tips at https://vuejs.org/guide/deployment.html`); 37912 } 37913 }, 0); 37914} 37915 37916const defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g; 37917const regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g; 37918const buildRegex = cached(delimiters => { 37919 const open = delimiters[0].replace(regexEscapeRE, '\\$&'); 37920 const close = delimiters[1].replace(regexEscapeRE, '\\$&'); 37921 return new RegExp(open + '((?:.|\\n)+?)' + close, 'g'); 37922}); 37923function parseText(text, delimiters) { 37924 //@ts-expect-error 37925 const tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE; 37926 if (!tagRE.test(text)) { 37927 return; 37928 } 37929 const tokens = []; 37930 const rawTokens = []; 37931 let lastIndex = (tagRE.lastIndex = 0); 37932 let match, index, tokenValue; 37933 while ((match = tagRE.exec(text))) { 37934 index = match.index; 37935 // push text token 37936 if (index > lastIndex) { 37937 rawTokens.push((tokenValue = text.slice(lastIndex, index))); 37938 tokens.push(JSON.stringify(tokenValue)); 37939 } 37940 // tag token 37941 const exp = parseFilters(match[1].trim()); 37942 tokens.push(`_s(${exp})`); 37943 rawTokens.push({ '@binding': exp }); 37944 lastIndex = index + match[0].length; 37945 } 37946 if (lastIndex < text.length) { 37947 rawTokens.push((tokenValue = text.slice(lastIndex))); 37948 tokens.push(JSON.stringify(tokenValue)); 37949 } 37950 return { 37951 expression: tokens.join('+'), 37952 tokens: rawTokens 37953 }; 37954} 37955 37956function transformNode$1(el, options) { 37957 const warn = options.warn || baseWarn; 37958 const staticClass = getAndRemoveAttr(el, 'class'); 37959 if (staticClass) { 37960 const res = parseText(staticClass, options.delimiters); 37961 if (res) { 37962 warn(`class="${staticClass}": ` + 37963 'Interpolation inside attributes has been removed. ' + 37964 'Use v-bind or the colon shorthand instead. For example, ' + 37965 'instead of <div class="{{ val }}">, use <div :class="val">.', el.rawAttrsMap['class']); 37966 } 37967 } 37968 if (staticClass) { 37969 el.staticClass = JSON.stringify(staticClass.replace(/\s+/g, ' ').trim()); 37970 } 37971 const classBinding = getBindingAttr(el, 'class', false /* getStatic */); 37972 if (classBinding) { 37973 el.classBinding = classBinding; 37974 } 37975} 37976function genData$2(el) { 37977 let data = ''; 37978 if (el.staticClass) { 37979 data += `staticClass:${el.staticClass},`; 37980 } 37981 if (el.classBinding) { 37982 data += `class:${el.classBinding},`; 37983 } 37984 return data; 37985} 37986var klass = { 37987 staticKeys: ['staticClass'], 37988 transformNode: transformNode$1, 37989 genData: genData$2 37990}; 37991 37992function transformNode(el, options) { 37993 const warn = options.warn || baseWarn; 37994 const staticStyle = getAndRemoveAttr(el, 'style'); 37995 if (staticStyle) { 37996 /* istanbul ignore if */ 37997 { 37998 const res = parseText(staticStyle, options.delimiters); 37999 if (res) { 38000 warn(`style="${staticStyle}": ` + 38001 'Interpolation inside attributes has been removed. ' + 38002 'Use v-bind or the colon shorthand instead. For example, ' + 38003 'instead of <div style="{{ val }}">, use <div :style="val">.', el.rawAttrsMap['style']); 38004 } 38005 } 38006 el.staticStyle = JSON.stringify(parseStyleText(staticStyle)); 38007 } 38008 const styleBinding = getBindingAttr(el, 'style', false /* getStatic */); 38009 if (styleBinding) { 38010 el.styleBinding = styleBinding; 38011 } 38012} 38013function genData$1(el) { 38014 let data = ''; 38015 if (el.staticStyle) { 38016 data += `staticStyle:${el.staticStyle},`; 38017 } 38018 if (el.styleBinding) { 38019 data += `style:(${el.styleBinding}),`; 38020 } 38021 return data; 38022} 38023var style = { 38024 staticKeys: ['staticStyle'], 38025 transformNode, 38026 genData: genData$1 38027}; 38028 38029let decoder; 38030var he = { 38031 decode(html) { 38032 decoder = decoder || document.createElement('div'); 38033 decoder.innerHTML = html; 38034 return decoder.textContent; 38035 } 38036}; 38037 38038const isUnaryTag = makeMap('area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + 38039 'link,meta,param,source,track,wbr'); 38040// Elements that you can, intentionally, leave open 38041// (and which close themselves) 38042const canBeLeftOpenTag = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'); 38043// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3 38044// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content 38045const isNonPhrasingTag = makeMap('address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + 38046 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + 38047 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + 38048 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + 38049 'title,tr,track'); 38050 38051/** 38052 * Not type-checking this file because it's mostly vendor code. 38053 */ 38054// Regular Expressions for parsing tags and attributes 38055const attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; 38056const dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; 38057const ncname = `[a-zA-Z_][\\-\\.0-9_a-zA-Z${unicodeRegExp.source}]*`; 38058const qnameCapture = `((?:${ncname}\\:)?${ncname})`; 38059const startTagOpen = new RegExp(`^<${qnameCapture}`); 38060const startTagClose = /^\s*(\/?)>/; 38061const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`); 38062const doctype = /^<!DOCTYPE [^>]+>/i; 38063// #7298: escape - to avoid being passed as HTML comment when inlined in page 38064const comment = /^<!\--/; 38065const conditionalComment = /^<!\[/; 38066// Special Elements (can contain anything) 38067const isPlainTextElement = makeMap('script,style,textarea', true); 38068const reCache = {}; 38069const decodingMap = { 38070 '<': '<', 38071 '>': '>', 38072 '"': '"', 38073 '&': '&', 38074 ' ': '\n', 38075 '	': '\t', 38076 ''': "'" 38077}; 38078const encodedAttr = /&(?:lt|gt|quot|amp|#39);/g; 38079const encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g; 38080// #5992 38081const isIgnoreNewlineTag = makeMap('pre,textarea', true); 38082const shouldIgnoreFirstNewline = (tag, html) => tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; 38083function decodeAttr(value, shouldDecodeNewlines) { 38084 const re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr; 38085 return value.replace(re, match => decodingMap[match]); 38086} 38087function parseHTML(html, options) { 38088 const stack = []; 38089 const expectHTML = options.expectHTML; 38090 const isUnaryTag = options.isUnaryTag || no; 38091 const canBeLeftOpenTag = options.canBeLeftOpenTag || no; 38092 let index = 0; 38093 let last, lastTag; 38094 while (html) { 38095 last = html; 38096 // Make sure we're not in a plaintext content element like script/style 38097 if (!lastTag || !isPlainTextElement(lastTag)) { 38098 let textEnd = html.indexOf('<'); 38099 if (textEnd === 0) { 38100 // Comment: 38101 if (comment.test(html)) { 38102 const commentEnd = html.indexOf('-->'); 38103 if (commentEnd >= 0) { 38104 if (options.shouldKeepComment && options.comment) { 38105 options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3); 38106 } 38107 advance(commentEnd + 3); 38108 continue; 38109 } 38110 } 38111 // https://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment 38112 if (conditionalComment.test(html)) { 38113 const conditionalEnd = html.indexOf(']>'); 38114 if (conditionalEnd >= 0) { 38115 advance(conditionalEnd + 2); 38116 continue; 38117 } 38118 } 38119 // Doctype: 38120 const doctypeMatch = html.match(doctype); 38121 if (doctypeMatch) { 38122 advance(doctypeMatch[0].length); 38123 continue; 38124 } 38125 // End tag: 38126 const endTagMatch = html.match(endTag); 38127 if (endTagMatch) { 38128 const curIndex = index; 38129 advance(endTagMatch[0].length); 38130 parseEndTag(endTagMatch[1], curIndex, index); 38131 continue; 38132 } 38133 // Start tag: 38134 const startTagMatch = parseStartTag(); 38135 if (startTagMatch) { 38136 handleStartTag(startTagMatch); 38137 if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) { 38138 advance(1); 38139 } 38140 continue; 38141 } 38142 } 38143 let text, rest, next; 38144 if (textEnd >= 0) { 38145 rest = html.slice(textEnd); 38146 while (!endTag.test(rest) && 38147 !startTagOpen.test(rest) && 38148 !comment.test(rest) && 38149 !conditionalComment.test(rest)) { 38150 // < in plain text, be forgiving and treat it as text 38151 next = rest.indexOf('<', 1); 38152 if (next < 0) 38153 break; 38154 textEnd += next; 38155 rest = html.slice(textEnd); 38156 } 38157 text = html.substring(0, textEnd); 38158 } 38159 if (textEnd < 0) { 38160 text = html; 38161 } 38162 if (text) { 38163 advance(text.length); 38164 } 38165 if (options.chars && text) { 38166 options.chars(text, index - text.length, index); 38167 } 38168 } 38169 else { 38170 let endTagLength = 0; 38171 const stackedTag = lastTag.toLowerCase(); 38172 const reStackedTag = reCache[stackedTag] || 38173 (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i')); 38174 const rest = html.replace(reStackedTag, function (all, text, endTag) { 38175 endTagLength = endTag.length; 38176 if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') { 38177 text = text 38178 .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298 38179 .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1'); 38180 } 38181 if (shouldIgnoreFirstNewline(stackedTag, text)) { 38182 text = text.slice(1); 38183 } 38184 if (options.chars) { 38185 options.chars(text); 38186 } 38187 return ''; 38188 }); 38189 index += html.length - rest.length; 38190 html = rest; 38191 parseEndTag(stackedTag, index - endTagLength, index); 38192 } 38193 if (html === last) { 38194 options.chars && options.chars(html); 38195 if (!stack.length && options.warn) { 38196 options.warn(`Mal-formatted tag at end of template: "${html}"`, { 38197 start: index + html.length 38198 }); 38199 } 38200 break; 38201 } 38202 } 38203 // Clean up any remaining tags 38204 parseEndTag(); 38205 function advance(n) { 38206 index += n; 38207 html = html.substring(n); 38208 } 38209 function parseStartTag() { 38210 const start = html.match(startTagOpen); 38211 if (start) { 38212 const match = { 38213 tagName: start[1], 38214 attrs: [], 38215 start: index 38216 }; 38217 advance(start[0].length); 38218 let end, attr; 38219 while (!(end = html.match(startTagClose)) && 38220 (attr = html.match(dynamicArgAttribute) || html.match(attribute))) { 38221 attr.start = index; 38222 advance(attr[0].length); 38223 attr.end = index; 38224 match.attrs.push(attr); 38225 } 38226 if (end) { 38227 match.unarySlash = end[1]; 38228 advance(end[0].length); 38229 match.end = index; 38230 return match; 38231 } 38232 } 38233 } 38234 function handleStartTag(match) { 38235 const tagName = match.tagName; 38236 const unarySlash = match.unarySlash; 38237 if (expectHTML) { 38238 if (lastTag === 'p' && isNonPhrasingTag(tagName)) { 38239 parseEndTag(lastTag); 38240 } 38241 if (canBeLeftOpenTag(tagName) && lastTag === tagName) { 38242 parseEndTag(tagName); 38243 } 38244 } 38245 const unary = isUnaryTag(tagName) || !!unarySlash; 38246 const l = match.attrs.length; 38247 const attrs = new Array(l); 38248 for (let i = 0; i < l; i++) { 38249 const args = match.attrs[i]; 38250 const value = args[3] || args[4] || args[5] || ''; 38251 const shouldDecodeNewlines = tagName === 'a' && args[1] === 'href' 38252 ? options.shouldDecodeNewlinesForHref 38253 : options.shouldDecodeNewlines; 38254 attrs[i] = { 38255 name: args[1], 38256 value: decodeAttr(value, shouldDecodeNewlines) 38257 }; 38258 if (options.outputSourceRange) { 38259 attrs[i].start = args.start + args[0].match(/^\s*/).length; 38260 attrs[i].end = args.end; 38261 } 38262 } 38263 if (!unary) { 38264 stack.push({ 38265 tag: tagName, 38266 lowerCasedTag: tagName.toLowerCase(), 38267 attrs: attrs, 38268 start: match.start, 38269 end: match.end 38270 }); 38271 lastTag = tagName; 38272 } 38273 if (options.start) { 38274 options.start(tagName, attrs, unary, match.start, match.end); 38275 } 38276 } 38277 function parseEndTag(tagName, start, end) { 38278 let pos, lowerCasedTagName; 38279 if (start == null) 38280 start = index; 38281 if (end == null) 38282 end = index; 38283 // Find the closest opened tag of the same type 38284 if (tagName) { 38285 lowerCasedTagName = tagName.toLowerCase(); 38286 for (pos = stack.length - 1; pos >= 0; pos--) { 38287 if (stack[pos].lowerCasedTag === lowerCasedTagName) { 38288 break; 38289 } 38290 } 38291 } 38292 else { 38293 // If no tag name is provided, clean shop 38294 pos = 0; 38295 } 38296 if (pos >= 0) { 38297 // Close all the open elements, up the stack 38298 for (let i = stack.length - 1; i >= pos; i--) { 38299 if ((i > pos || !tagName) && options.warn) { 38300 options.warn(`tag <${stack[i].tag}> has no matching end tag.`, { 38301 start: stack[i].start, 38302 end: stack[i].end 38303 }); 38304 } 38305 if (options.end) { 38306 options.end(stack[i].tag, start, end); 38307 } 38308 } 38309 // Remove the open elements from the stack 38310 stack.length = pos; 38311 lastTag = pos && stack[pos - 1].tag; 38312 } 38313 else if (lowerCasedTagName === 'br') { 38314 if (options.start) { 38315 options.start(tagName, [], true, start, end); 38316 } 38317 } 38318 else if (lowerCasedTagName === 'p') { 38319 if (options.start) { 38320 options.start(tagName, [], false, start, end); 38321 } 38322 if (options.end) { 38323 options.end(tagName, start, end); 38324 } 38325 } 38326 } 38327} 38328 38329const onRE = /^@|^v-on:/; 38330const dirRE = /^v-|^@|^:|^#/; 38331const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; 38332const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 38333const stripParensRE = /^\(|\)$/g; 38334const dynamicArgRE = /^\[.*\]$/; 38335const argRE = /:(.*)$/; 38336const bindRE = /^:|^\.|^v-bind:/; 38337const modifierRE = /\.[^.\]]+(?=[^\]]*$)/g; 38338const slotRE = /^v-slot(:|$)|^#/; 38339const lineBreakRE = /[\r\n]/; 38340const whitespaceRE = /[ \f\t\r\n]+/g; 38341const invalidAttributeRE = /[\s"'<>\/=]/; 38342const decodeHTMLCached = cached(he.decode); 38343const emptySlotScopeToken = `_empty_`; 38344// configurable state 38345let warn; 38346let delimiters; 38347let transforms; 38348let preTransforms; 38349let postTransforms; 38350let platformIsPreTag; 38351let platformMustUseProp; 38352let platformGetTagNamespace; 38353let maybeComponent; 38354function createASTElement(tag, attrs, parent) { 38355 return { 38356 type: 1, 38357 tag, 38358 attrsList: attrs, 38359 attrsMap: makeAttrsMap(attrs), 38360 rawAttrsMap: {}, 38361 parent, 38362 children: [] 38363 }; 38364} 38365/** 38366 * Convert HTML string to AST. 38367 */ 38368function parse(template, options) { 38369 warn = options.warn || baseWarn; 38370 platformIsPreTag = options.isPreTag || no; 38371 platformMustUseProp = options.mustUseProp || no; 38372 platformGetTagNamespace = options.getTagNamespace || no; 38373 const isReservedTag = options.isReservedTag || no; 38374 maybeComponent = (el) => !!(el.component || 38375 el.attrsMap[':is'] || 38376 el.attrsMap['v-bind:is'] || 38377 !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag))); 38378 transforms = pluckModuleFunction(options.modules, 'transformNode'); 38379 preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); 38380 postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); 38381 delimiters = options.delimiters; 38382 const stack = []; 38383 const preserveWhitespace = options.preserveWhitespace !== false; 38384 const whitespaceOption = options.whitespace; 38385 let root; 38386 let currentParent; 38387 let inVPre = false; 38388 let inPre = false; 38389 let warned = false; 38390 function warnOnce(msg, range) { 38391 if (!warned) { 38392 warned = true; 38393 warn(msg, range); 38394 } 38395 } 38396 function closeElement(element) { 38397 trimEndingWhitespace(element); 38398 if (!inVPre && !element.processed) { 38399 element = processElement(element, options); 38400 } 38401 // tree management 38402 if (!stack.length && element !== root) { 38403 // allow root elements with v-if, v-else-if and v-else 38404 if (root.if && (element.elseif || element.else)) { 38405 { 38406 checkRootConstraints(element); 38407 } 38408 addIfCondition(root, { 38409 exp: element.elseif, 38410 block: element 38411 }); 38412 } 38413 else { 38414 warnOnce(`Component template should contain exactly one root element. ` + 38415 `If you are using v-if on multiple elements, ` + 38416 `use v-else-if to chain them instead.`, { start: element.start }); 38417 } 38418 } 38419 if (currentParent && !element.forbidden) { 38420 if (element.elseif || element.else) { 38421 processIfConditions(element, currentParent); 38422 } 38423 else { 38424 if (element.slotScope) { 38425 // scoped slot 38426 // keep it in the children list so that v-else(-if) conditions can 38427 // find it as the prev node. 38428 const name = element.slotTarget || '"default"'; 38429 (currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element; 38430 } 38431 currentParent.children.push(element); 38432 element.parent = currentParent; 38433 } 38434 } 38435 // final children cleanup 38436 // filter out scoped slots 38437 element.children = element.children.filter(c => !c.slotScope); 38438 // remove trailing whitespace node again 38439 trimEndingWhitespace(element); 38440 // check pre state 38441 if (element.pre) { 38442 inVPre = false; 38443 } 38444 if (platformIsPreTag(element.tag)) { 38445 inPre = false; 38446 } 38447 // apply post-transforms 38448 for (let i = 0; i < postTransforms.length; i++) { 38449 postTransforms[i](element, options); 38450 } 38451 } 38452 function trimEndingWhitespace(el) { 38453 // remove trailing whitespace node 38454 if (!inPre) { 38455 let lastNode; 38456 while ((lastNode = el.children[el.children.length - 1]) && 38457 lastNode.type === 3 && 38458 lastNode.text === ' ') { 38459 el.children.pop(); 38460 } 38461 } 38462 } 38463 function checkRootConstraints(el) { 38464 if (el.tag === 'slot' || el.tag === 'template') { 38465 warnOnce(`Cannot use <${el.tag}> as component root element because it may ` + 38466 'contain multiple nodes.', { start: el.start }); 38467 } 38468 if (el.attrsMap.hasOwnProperty('v-for')) { 38469 warnOnce('Cannot use v-for on stateful component root element because ' + 38470 'it renders multiple elements.', el.rawAttrsMap['v-for']); 38471 } 38472 } 38473 parseHTML(template, { 38474 warn, 38475 expectHTML: options.expectHTML, 38476 isUnaryTag: options.isUnaryTag, 38477 canBeLeftOpenTag: options.canBeLeftOpenTag, 38478 shouldDecodeNewlines: options.shouldDecodeNewlines, 38479 shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref, 38480 shouldKeepComment: options.comments, 38481 outputSourceRange: options.outputSourceRange, 38482 start(tag, attrs, unary, start, end) { 38483 // check namespace. 38484 // inherit parent ns if there is one 38485 const ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag); 38486 // handle IE svg bug 38487 /* istanbul ignore if */ 38488 if (isIE && ns === 'svg') { 38489 attrs = guardIESVGBug(attrs); 38490 } 38491 let element = createASTElement(tag, attrs, currentParent); 38492 if (ns) { 38493 element.ns = ns; 38494 } 38495 { 38496 if (options.outputSourceRange) { 38497 element.start = start; 38498 element.end = end; 38499 element.rawAttrsMap = element.attrsList.reduce((cumulated, attr) => { 38500 cumulated[attr.name] = attr; 38501 return cumulated; 38502 }, {}); 38503 } 38504 attrs.forEach(attr => { 38505 if (invalidAttributeRE.test(attr.name)) { 38506 warn(`Invalid dynamic argument expression: attribute names cannot contain ` + 38507 `spaces, quotes, <, >, / or =.`, options.outputSourceRange 38508 ? { 38509 start: attr.start + attr.name.indexOf(`[`), 38510 end: attr.start + attr.name.length 38511 } 38512 : undefined); 38513 } 38514 }); 38515 } 38516 if (isForbiddenTag(element) && !isServerRendering()) { 38517 element.forbidden = true; 38518 warn('Templates should only be responsible for mapping the state to the ' + 38519 'UI. Avoid placing tags with side-effects in your templates, such as ' + 38520 `<${tag}>` + 38521 ', as they will not be parsed.', { start: element.start }); 38522 } 38523 // apply pre-transforms 38524 for (let i = 0; i < preTransforms.length; i++) { 38525 element = preTransforms[i](element, options) || element; 38526 } 38527 if (!inVPre) { 38528 processPre(element); 38529 if (element.pre) { 38530 inVPre = true; 38531 } 38532 } 38533 if (platformIsPreTag(element.tag)) { 38534 inPre = true; 38535 } 38536 if (inVPre) { 38537 processRawAttrs(element); 38538 } 38539 else if (!element.processed) { 38540 // structural directives 38541 processFor(element); 38542 processIf(element); 38543 processOnce(element); 38544 } 38545 if (!root) { 38546 root = element; 38547 { 38548 checkRootConstraints(root); 38549 } 38550 } 38551 if (!unary) { 38552 currentParent = element; 38553 stack.push(element); 38554 } 38555 else { 38556 closeElement(element); 38557 } 38558 }, 38559 end(tag, start, end) { 38560 const element = stack[stack.length - 1]; 38561 // pop stack 38562 stack.length -= 1; 38563 currentParent = stack[stack.length - 1]; 38564 if (options.outputSourceRange) { 38565 element.end = end; 38566 } 38567 closeElement(element); 38568 }, 38569 chars(text, start, end) { 38570 if (!currentParent) { 38571 { 38572 if (text === template) { 38573 warnOnce('Component template requires a root element, rather than just text.', { start }); 38574 } 38575 else if ((text = text.trim())) { 38576 warnOnce(`text "${text}" outside root element will be ignored.`, { 38577 start 38578 }); 38579 } 38580 } 38581 return; 38582 } 38583 // IE textarea placeholder bug 38584 /* istanbul ignore if */ 38585 if (isIE && 38586 currentParent.tag === 'textarea' && 38587 currentParent.attrsMap.placeholder === text) { 38588 return; 38589 } 38590 const children = currentParent.children; 38591 if (inPre || text.trim()) { 38592 text = isTextTag(currentParent) 38593 ? text 38594 : decodeHTMLCached(text); 38595 } 38596 else if (!children.length) { 38597 // remove the whitespace-only node right after an opening tag 38598 text = ''; 38599 } 38600 else if (whitespaceOption) { 38601 if (whitespaceOption === 'condense') { 38602 // in condense mode, remove the whitespace node if it contains 38603 // line break, otherwise condense to a single space 38604 text = lineBreakRE.test(text) ? '' : ' '; 38605 } 38606 else { 38607 text = ' '; 38608 } 38609 } 38610 else { 38611 text = preserveWhitespace ? ' ' : ''; 38612 } 38613 if (text) { 38614 if (!inPre && whitespaceOption === 'condense') { 38615 // condense consecutive whitespaces into single space 38616 text = text.replace(whitespaceRE, ' '); 38617 } 38618 let res; 38619 let child; 38620 if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) { 38621 child = { 38622 type: 2, 38623 expression: res.expression, 38624 tokens: res.tokens, 38625 text 38626 }; 38627 } 38628 else if (text !== ' ' || 38629 !children.length || 38630 children[children.length - 1].text !== ' ') { 38631 child = { 38632 type: 3, 38633 text 38634 }; 38635 } 38636 if (child) { 38637 if (options.outputSourceRange) { 38638 child.start = start; 38639 child.end = end; 38640 } 38641 children.push(child); 38642 } 38643 } 38644 }, 38645 comment(text, start, end) { 38646 // adding anything as a sibling to the root node is forbidden 38647 // comments should still be allowed, but ignored 38648 if (currentParent) { 38649 const child = { 38650 type: 3, 38651 text, 38652 isComment: true 38653 }; 38654 if (options.outputSourceRange) { 38655 child.start = start; 38656 child.end = end; 38657 } 38658 currentParent.children.push(child); 38659 } 38660 } 38661 }); 38662 return root; 38663} 38664function processPre(el) { 38665 if (getAndRemoveAttr(el, 'v-pre') != null) { 38666 el.pre = true; 38667 } 38668} 38669function processRawAttrs(el) { 38670 const list = el.attrsList; 38671 const len = list.length; 38672 if (len) { 38673 const attrs = (el.attrs = new Array(len)); 38674 for (let i = 0; i < len; i++) { 38675 attrs[i] = { 38676 name: list[i].name, 38677 value: JSON.stringify(list[i].value) 38678 }; 38679 if (list[i].start != null) { 38680 attrs[i].start = list[i].start; 38681 attrs[i].end = list[i].end; 38682 } 38683 } 38684 } 38685 else if (!el.pre) { 38686 // non root node in pre blocks with no attributes 38687 el.plain = true; 38688 } 38689} 38690function processElement(element, options) { 38691 processKey(element); 38692 // determine whether this is a plain element after 38693 // removing structural attributes 38694 element.plain = 38695 !element.key && !element.scopedSlots && !element.attrsList.length; 38696 processRef(element); 38697 processSlotContent(element); 38698 processSlotOutlet(element); 38699 processComponent(element); 38700 for (let i = 0; i < transforms.length; i++) { 38701 element = transforms[i](element, options) || element; 38702 } 38703 processAttrs(element); 38704 return element; 38705} 38706function processKey(el) { 38707 const exp = getBindingAttr(el, 'key'); 38708 if (exp) { 38709 { 38710 if (el.tag === 'template') { 38711 warn(`<template> cannot be keyed. Place the key on real elements instead.`, getRawBindingAttr(el, 'key')); 38712 } 38713 if (el.for) { 38714 const iterator = el.iterator2 || el.iterator1; 38715 const parent = el.parent; 38716 if (iterator && 38717 iterator === exp && 38718 parent && 38719 parent.tag === 'transition-group') { 38720 warn(`Do not use v-for index as key on <transition-group> children, ` + 38721 `this is the same as not using keys.`, getRawBindingAttr(el, 'key'), true /* tip */); 38722 } 38723 } 38724 } 38725 el.key = exp; 38726 } 38727} 38728function processRef(el) { 38729 const ref = getBindingAttr(el, 'ref'); 38730 if (ref) { 38731 el.ref = ref; 38732 el.refInFor = checkInFor(el); 38733 } 38734} 38735function processFor(el) { 38736 let exp; 38737 if ((exp = getAndRemoveAttr(el, 'v-for'))) { 38738 const res = parseFor(exp); 38739 if (res) { 38740 extend(el, res); 38741 } 38742 else { 38743 warn(`Invalid v-for expression: ${exp}`, el.rawAttrsMap['v-for']); 38744 } 38745 } 38746} 38747function parseFor(exp) { 38748 const inMatch = exp.match(forAliasRE); 38749 if (!inMatch) 38750 return; 38751 const res = {}; 38752 res.for = inMatch[2].trim(); 38753 const alias = inMatch[1].trim().replace(stripParensRE, ''); 38754 const iteratorMatch = alias.match(forIteratorRE); 38755 if (iteratorMatch) { 38756 res.alias = alias.replace(forIteratorRE, '').trim(); 38757 res.iterator1 = iteratorMatch[1].trim(); 38758 if (iteratorMatch[2]) { 38759 res.iterator2 = iteratorMatch[2].trim(); 38760 } 38761 } 38762 else { 38763 res.alias = alias; 38764 } 38765 return res; 38766} 38767function processIf(el) { 38768 const exp = getAndRemoveAttr(el, 'v-if'); 38769 if (exp) { 38770 el.if = exp; 38771 addIfCondition(el, { 38772 exp: exp, 38773 block: el 38774 }); 38775 } 38776 else { 38777 if (getAndRemoveAttr(el, 'v-else') != null) { 38778 el.else = true; 38779 } 38780 const elseif = getAndRemoveAttr(el, 'v-else-if'); 38781 if (elseif) { 38782 el.elseif = elseif; 38783 } 38784 } 38785} 38786function processIfConditions(el, parent) { 38787 const prev = findPrevElement(parent.children); 38788 if (prev && prev.if) { 38789 addIfCondition(prev, { 38790 exp: el.elseif, 38791 block: el 38792 }); 38793 } 38794 else { 38795 warn(`v-${el.elseif ? 'else-if="' + el.elseif + '"' : 'else'} ` + 38796 `used on element <${el.tag}> without corresponding v-if.`, el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']); 38797 } 38798} 38799function findPrevElement(children) { 38800 let i = children.length; 38801 while (i--) { 38802 if (children[i].type === 1) { 38803 return children[i]; 38804 } 38805 else { 38806 if (children[i].text !== ' ') { 38807 warn(`text "${children[i].text.trim()}" between v-if and v-else(-if) ` + 38808 `will be ignored.`, children[i]); 38809 } 38810 children.pop(); 38811 } 38812 } 38813} 38814function addIfCondition(el, condition) { 38815 if (!el.ifConditions) { 38816 el.ifConditions = []; 38817 } 38818 el.ifConditions.push(condition); 38819} 38820function processOnce(el) { 38821 const once = getAndRemoveAttr(el, 'v-once'); 38822 if (once != null) { 38823 el.once = true; 38824 } 38825} 38826// handle content being passed to a component as slot, 38827// e.g. <template slot="xxx">, <div slot-scope="xxx"> 38828function processSlotContent(el) { 38829 let slotScope; 38830 if (el.tag === 'template') { 38831 slotScope = getAndRemoveAttr(el, 'scope'); 38832 /* istanbul ignore if */ 38833 if (slotScope) { 38834 warn(`the "scope" attribute for scoped slots have been deprecated and ` + 38835 `replaced by "slot-scope" since 2.5. The new "slot-scope" attribute ` + 38836 `can also be used on plain elements in addition to <template> to ` + 38837 `denote scoped slots.`, el.rawAttrsMap['scope'], true); 38838 } 38839 el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope'); 38840 } 38841 else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) { 38842 /* istanbul ignore if */ 38843 if (el.attrsMap['v-for']) { 38844 warn(`Ambiguous combined usage of slot-scope and v-for on <${el.tag}> ` + 38845 `(v-for takes higher priority). Use a wrapper <template> for the ` + 38846 `scoped slot to make it clearer.`, el.rawAttrsMap['slot-scope'], true); 38847 } 38848 el.slotScope = slotScope; 38849 } 38850 // slot="xxx" 38851 const slotTarget = getBindingAttr(el, 'slot'); 38852 if (slotTarget) { 38853 el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget; 38854 el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']); 38855 // preserve slot as an attribute for native shadow DOM compat 38856 // only for non-scoped slots. 38857 if (el.tag !== 'template' && !el.slotScope) { 38858 addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot')); 38859 } 38860 } 38861 // 2.6 v-slot syntax 38862 { 38863 if (el.tag === 'template') { 38864 // v-slot on <template> 38865 const slotBinding = getAndRemoveAttrByRegex(el, slotRE); 38866 if (slotBinding) { 38867 { 38868 if (el.slotTarget || el.slotScope) { 38869 warn(`Unexpected mixed usage of different slot syntaxes.`, el); 38870 } 38871 if (el.parent && !maybeComponent(el.parent)) { 38872 warn(`<template v-slot> can only appear at the root level inside ` + 38873 `the receiving component`, el); 38874 } 38875 } 38876 const { name, dynamic } = getSlotName(slotBinding); 38877 el.slotTarget = name; 38878 el.slotTargetDynamic = dynamic; 38879 el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf 38880 } 38881 } 38882 else { 38883 // v-slot on component, denotes default slot 38884 const slotBinding = getAndRemoveAttrByRegex(el, slotRE); 38885 if (slotBinding) { 38886 { 38887 if (!maybeComponent(el)) { 38888 warn(`v-slot can only be used on components or <template>.`, slotBinding); 38889 } 38890 if (el.slotScope || el.slotTarget) { 38891 warn(`Unexpected mixed usage of different slot syntaxes.`, el); 38892 } 38893 if (el.scopedSlots) { 38894 warn(`To avoid scope ambiguity, the default slot should also use ` + 38895 `<template> syntax when there are other named slots.`, slotBinding); 38896 } 38897 } 38898 // add the component's children to its default slot 38899 const slots = el.scopedSlots || (el.scopedSlots = {}); 38900 const { name, dynamic } = getSlotName(slotBinding); 38901 const slotContainer = (slots[name] = createASTElement('template', [], el)); 38902 slotContainer.slotTarget = name; 38903 slotContainer.slotTargetDynamic = dynamic; 38904 slotContainer.children = el.children.filter((c) => { 38905 if (!c.slotScope) { 38906 c.parent = slotContainer; 38907 return true; 38908 } 38909 }); 38910 slotContainer.slotScope = slotBinding.value || emptySlotScopeToken; 38911 // remove children as they are returned from scopedSlots now 38912 el.children = []; 38913 // mark el non-plain so data gets generated 38914 el.plain = false; 38915 } 38916 } 38917 } 38918} 38919function getSlotName(binding) { 38920 let name = binding.name.replace(slotRE, ''); 38921 if (!name) { 38922 if (binding.name[0] !== '#') { 38923 name = 'default'; 38924 } 38925 else { 38926 warn(`v-slot shorthand syntax requires a slot name.`, binding); 38927 } 38928 } 38929 return dynamicArgRE.test(name) 38930 ? // dynamic [name] 38931 { name: name.slice(1, -1), dynamic: true } 38932 : // static name 38933 { name: `"${name}"`, dynamic: false }; 38934} 38935// handle <slot/> outlets 38936function processSlotOutlet(el) { 38937 if (el.tag === 'slot') { 38938 el.slotName = getBindingAttr(el, 'name'); 38939 if (el.key) { 38940 warn(`\`key\` does not work on <slot> because slots are abstract outlets ` + 38941 `and can possibly expand into multiple elements. ` + 38942 `Use the key on a wrapping element instead.`, getRawBindingAttr(el, 'key')); 38943 } 38944 } 38945} 38946function processComponent(el) { 38947 let binding; 38948 if ((binding = getBindingAttr(el, 'is'))) { 38949 el.component = binding; 38950 } 38951 if (getAndRemoveAttr(el, 'inline-template') != null) { 38952 el.inlineTemplate = true; 38953 } 38954} 38955function processAttrs(el) { 38956 const list = el.attrsList; 38957 let i, l, name, rawName, value, modifiers, syncGen, isDynamic; 38958 for (i = 0, l = list.length; i < l; i++) { 38959 name = rawName = list[i].name; 38960 value = list[i].value; 38961 if (dirRE.test(name)) { 38962 // mark element as dynamic 38963 el.hasBindings = true; 38964 // modifiers 38965 modifiers = parseModifiers(name.replace(dirRE, '')); 38966 // support .foo shorthand syntax for the .prop modifier 38967 if (modifiers) { 38968 name = name.replace(modifierRE, ''); 38969 } 38970 if (bindRE.test(name)) { 38971 // v-bind 38972 name = name.replace(bindRE, ''); 38973 value = parseFilters(value); 38974 isDynamic = dynamicArgRE.test(name); 38975 if (isDynamic) { 38976 name = name.slice(1, -1); 38977 } 38978 if (value.trim().length === 0) { 38979 warn(`The value for a v-bind expression cannot be empty. Found in "v-bind:${name}"`); 38980 } 38981 if (modifiers) { 38982 if (modifiers.prop && !isDynamic) { 38983 name = camelize(name); 38984 if (name === 'innerHtml') 38985 name = 'innerHTML'; 38986 } 38987 if (modifiers.camel && !isDynamic) { 38988 name = camelize(name); 38989 } 38990 if (modifiers.sync) { 38991 syncGen = genAssignmentCode(value, `$event`); 38992 if (!isDynamic) { 38993 addHandler(el, `update:${camelize(name)}`, syncGen, null, false, warn, list[i]); 38994 if (hyphenate(name) !== camelize(name)) { 38995 addHandler(el, `update:${hyphenate(name)}`, syncGen, null, false, warn, list[i]); 38996 } 38997 } 38998 else { 38999 // handler w/ dynamic event name 39000 addHandler(el, `"update:"+(${name})`, syncGen, null, false, warn, list[i], true // dynamic 39001 ); 39002 } 39003 } 39004 } 39005 if ((modifiers && modifiers.prop) || 39006 (!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name))) { 39007 addProp(el, name, value, list[i], isDynamic); 39008 } 39009 else { 39010 addAttr(el, name, value, list[i], isDynamic); 39011 } 39012 } 39013 else if (onRE.test(name)) { 39014 // v-on 39015 name = name.replace(onRE, ''); 39016 isDynamic = dynamicArgRE.test(name); 39017 if (isDynamic) { 39018 name = name.slice(1, -1); 39019 } 39020 addHandler(el, name, value, modifiers, false, warn, list[i], isDynamic); 39021 } 39022 else { 39023 // normal directives 39024 name = name.replace(dirRE, ''); 39025 // parse arg 39026 const argMatch = name.match(argRE); 39027 let arg = argMatch && argMatch[1]; 39028 isDynamic = false; 39029 if (arg) { 39030 name = name.slice(0, -(arg.length + 1)); 39031 if (dynamicArgRE.test(arg)) { 39032 arg = arg.slice(1, -1); 39033 isDynamic = true; 39034 } 39035 } 39036 addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]); 39037 if (name === 'model') { 39038 checkForAliasModel(el, value); 39039 } 39040 } 39041 } 39042 else { 39043 // literal attribute 39044 { 39045 const res = parseText(value, delimiters); 39046 if (res) { 39047 warn(`${name}="${value}": ` + 39048 'Interpolation inside attributes has been removed. ' + 39049 'Use v-bind or the colon shorthand instead. For example, ' + 39050 'instead of <div id="{{ val }}">, use <div :id="val">.', list[i]); 39051 } 39052 } 39053 addAttr(el, name, JSON.stringify(value), list[i]); 39054 // #6887 firefox doesn't update muted state if set via attribute 39055 // even immediately after element creation 39056 if (!el.component && 39057 name === 'muted' && 39058 platformMustUseProp(el.tag, el.attrsMap.type, name)) { 39059 addProp(el, name, 'true', list[i]); 39060 } 39061 } 39062 } 39063} 39064function checkInFor(el) { 39065 let parent = el; 39066 while (parent) { 39067 if (parent.for !== undefined) { 39068 return true; 39069 } 39070 parent = parent.parent; 39071 } 39072 return false; 39073} 39074function parseModifiers(name) { 39075 const match = name.match(modifierRE); 39076 if (match) { 39077 const ret = {}; 39078 match.forEach(m => { 39079 ret[m.slice(1)] = true; 39080 }); 39081 return ret; 39082 } 39083} 39084function makeAttrsMap(attrs) { 39085 const map = {}; 39086 for (let i = 0, l = attrs.length; i < l; i++) { 39087 if (map[attrs[i].name] && !isIE && !isEdge) { 39088 warn('duplicate attribute: ' + attrs[i].name, attrs[i]); 39089 } 39090 map[attrs[i].name] = attrs[i].value; 39091 } 39092 return map; 39093} 39094// for script (e.g. type="x/template") or style, do not decode content 39095function isTextTag(el) { 39096 return el.tag === 'script' || el.tag === 'style'; 39097} 39098function isForbiddenTag(el) { 39099 return (el.tag === 'style' || 39100 (el.tag === 'script' && 39101 (!el.attrsMap.type || el.attrsMap.type === 'text/javascript'))); 39102} 39103const ieNSBug = /^xmlns:NS\d+/; 39104const ieNSPrefix = /^NS\d+:/; 39105/* istanbul ignore next */ 39106function guardIESVGBug(attrs) { 39107 const res = []; 39108 for (let i = 0; i < attrs.length; i++) { 39109 const attr = attrs[i]; 39110 if (!ieNSBug.test(attr.name)) { 39111 attr.name = attr.name.replace(ieNSPrefix, ''); 39112 res.push(attr); 39113 } 39114 } 39115 return res; 39116} 39117function checkForAliasModel(el, value) { 39118 let _el = el; 39119 while (_el) { 39120 if (_el.for && _el.alias === value) { 39121 warn(`<${el.tag} v-model="${value}">: ` + 39122 `You are binding v-model directly to a v-for iteration alias. ` + 39123 `This will not be able to modify the v-for source array because ` + 39124 `writing to the alias is like modifying a function local variable. ` + 39125 `Consider using an array of objects and use v-model on an object property instead.`, el.rawAttrsMap['v-model']); 39126 } 39127 _el = _el.parent; 39128 } 39129} 39130 39131/** 39132 * Expand input[v-model] with dynamic type bindings into v-if-else chains 39133 * Turn this: 39134 * <input v-model="data[type]" :type="type"> 39135 * into this: 39136 * <input v-if="type === 'checkbox'" type="checkbox" v-model="data[type]"> 39137 * <input v-else-if="type === 'radio'" type="radio" v-model="data[type]"> 39138 * <input v-else :type="type" v-model="data[type]"> 39139 */ 39140function preTransformNode(el, options) { 39141 if (el.tag === 'input') { 39142 const map = el.attrsMap; 39143 if (!map['v-model']) { 39144 return; 39145 } 39146 let typeBinding; 39147 if (map[':type'] || map['v-bind:type']) { 39148 typeBinding = getBindingAttr(el, 'type'); 39149 } 39150 if (!map.type && !typeBinding && map['v-bind']) { 39151 typeBinding = `(${map['v-bind']}).type`; 39152 } 39153 if (typeBinding) { 39154 const ifCondition = getAndRemoveAttr(el, 'v-if', true); 39155 const ifConditionExtra = ifCondition ? `&&(${ifCondition})` : ``; 39156 const hasElse = getAndRemoveAttr(el, 'v-else', true) != null; 39157 const elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true); 39158 // 1. checkbox 39159 const branch0 = cloneASTElement(el); 39160 // process for on the main node 39161 processFor(branch0); 39162 addRawAttr(branch0, 'type', 'checkbox'); 39163 processElement(branch0, options); 39164 branch0.processed = true; // prevent it from double-processed 39165 branch0.if = `(${typeBinding})==='checkbox'` + ifConditionExtra; 39166 addIfCondition(branch0, { 39167 exp: branch0.if, 39168 block: branch0 39169 }); 39170 // 2. add radio else-if condition 39171 const branch1 = cloneASTElement(el); 39172 getAndRemoveAttr(branch1, 'v-for', true); 39173 addRawAttr(branch1, 'type', 'radio'); 39174 processElement(branch1, options); 39175 addIfCondition(branch0, { 39176 exp: `(${typeBinding})==='radio'` + ifConditionExtra, 39177 block: branch1 39178 }); 39179 // 3. other 39180 const branch2 = cloneASTElement(el); 39181 getAndRemoveAttr(branch2, 'v-for', true); 39182 addRawAttr(branch2, ':type', typeBinding); 39183 processElement(branch2, options); 39184 addIfCondition(branch0, { 39185 exp: ifCondition, 39186 block: branch2 39187 }); 39188 if (hasElse) { 39189 branch0.else = true; 39190 } 39191 else if (elseIfCondition) { 39192 branch0.elseif = elseIfCondition; 39193 } 39194 return branch0; 39195 } 39196 } 39197} 39198function cloneASTElement(el) { 39199 return createASTElement(el.tag, el.attrsList.slice(), el.parent); 39200} 39201var model = { 39202 preTransformNode 39203}; 39204 39205var modules = [klass, style, model]; 39206 39207function text(el, dir) { 39208 if (dir.value) { 39209 addProp(el, 'textContent', `_s(${dir.value})`, dir); 39210 } 39211} 39212 39213function html(el, dir) { 39214 if (dir.value) { 39215 addProp(el, 'innerHTML', `_s(${dir.value})`, dir); 39216 } 39217} 39218 39219var directives = { 39220 model: model$1, 39221 text, 39222 html 39223}; 39224 39225const baseOptions = { 39226 expectHTML: true, 39227 modules, 39228 directives, 39229 isPreTag, 39230 isUnaryTag, 39231 mustUseProp, 39232 canBeLeftOpenTag, 39233 isReservedTag, 39234 getTagNamespace, 39235 staticKeys: genStaticKeys$1(modules) 39236}; 39237 39238let isStaticKey; 39239let isPlatformReservedTag; 39240const genStaticKeysCached = cached(genStaticKeys); 39241/** 39242 * Goal of the optimizer: walk the generated template AST tree 39243 * and detect sub-trees that are purely static, i.e. parts of 39244 * the DOM that never needs to change. 39245 * 39246 * Once we detect these sub-trees, we can: 39247 * 39248 * 1. Hoist them into constants, so that we no longer need to 39249 * create fresh nodes for them on each re-render; 39250 * 2. Completely skip them in the patching process. 39251 */ 39252function optimize(root, options) { 39253 if (!root) 39254 return; 39255 isStaticKey = genStaticKeysCached(options.staticKeys || ''); 39256 isPlatformReservedTag = options.isReservedTag || no; 39257 // first pass: mark all non-static nodes. 39258 markStatic(root); 39259 // second pass: mark static roots. 39260 markStaticRoots(root, false); 39261} 39262function genStaticKeys(keys) { 39263 return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' + 39264 (keys ? ',' + keys : '')); 39265} 39266function markStatic(node) { 39267 node.static = isStatic(node); 39268 if (node.type === 1) { 39269 // do not make component slot content static. this avoids 39270 // 1. components not able to mutate slot nodes 39271 // 2. static slot content fails for hot-reloading 39272 if (!isPlatformReservedTag(node.tag) && 39273 node.tag !== 'slot' && 39274 node.attrsMap['inline-template'] == null) { 39275 return; 39276 } 39277 for (let i = 0, l = node.children.length; i < l; i++) { 39278 const child = node.children[i]; 39279 markStatic(child); 39280 if (!child.static) { 39281 node.static = false; 39282 } 39283 } 39284 if (node.ifConditions) { 39285 for (let i = 1, l = node.ifConditions.length; i < l; i++) { 39286 const block = node.ifConditions[i].block; 39287 markStatic(block); 39288 if (!block.static) { 39289 node.static = false; 39290 } 39291 } 39292 } 39293 } 39294} 39295function markStaticRoots(node, isInFor) { 39296 if (node.type === 1) { 39297 if (node.static || node.once) { 39298 node.staticInFor = isInFor; 39299 } 39300 // For a node to qualify as a static root, it should have children that 39301 // are not just static text. Otherwise the cost of hoisting out will 39302 // outweigh the benefits and it's better off to just always render it fresh. 39303 if (node.static && 39304 node.children.length && 39305 !(node.children.length === 1 && node.children[0].type === 3)) { 39306 node.staticRoot = true; 39307 return; 39308 } 39309 else { 39310 node.staticRoot = false; 39311 } 39312 if (node.children) { 39313 for (let i = 0, l = node.children.length; i < l; i++) { 39314 markStaticRoots(node.children[i], isInFor || !!node.for); 39315 } 39316 } 39317 if (node.ifConditions) { 39318 for (let i = 1, l = node.ifConditions.length; i < l; i++) { 39319 markStaticRoots(node.ifConditions[i].block, isInFor); 39320 } 39321 } 39322 } 39323} 39324function isStatic(node) { 39325 if (node.type === 2) { 39326 // expression 39327 return false; 39328 } 39329 if (node.type === 3) { 39330 // text 39331 return true; 39332 } 39333 return !!(node.pre || 39334 (!node.hasBindings && // no dynamic bindings 39335 !node.if && 39336 !node.for && // not v-if or v-for or v-else 39337 !isBuiltInTag(node.tag) && // not a built-in 39338 isPlatformReservedTag(node.tag) && // not a component 39339 !isDirectChildOfTemplateFor(node) && 39340 Object.keys(node).every(isStaticKey))); 39341} 39342function isDirectChildOfTemplateFor(node) { 39343 while (node.parent) { 39344 node = node.parent; 39345 if (node.tag !== 'template') { 39346 return false; 39347 } 39348 if (node.for) { 39349 return true; 39350 } 39351 } 39352 return false; 39353} 39354 39355const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/; 39356const fnInvokeRE = /\([^)]*?\);*$/; 39357const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/; 39358// KeyboardEvent.keyCode aliases 39359const keyCodes = { 39360 esc: 27, 39361 tab: 9, 39362 enter: 13, 39363 space: 32, 39364 up: 38, 39365 left: 37, 39366 right: 39, 39367 down: 40, 39368 delete: [8, 46] 39369}; 39370// KeyboardEvent.key aliases 39371const keyNames = { 39372 // #7880: IE11 and Edge use `Esc` for Escape key name. 39373 esc: ['Esc', 'Escape'], 39374 tab: 'Tab', 39375 enter: 'Enter', 39376 // #9112: IE11 uses `Spacebar` for Space key name. 39377 space: [' ', 'Spacebar'], 39378 // #7806: IE11 uses key names without `Arrow` prefix for arrow keys. 39379 up: ['Up', 'ArrowUp'], 39380 left: ['Left', 'ArrowLeft'], 39381 right: ['Right', 'ArrowRight'], 39382 down: ['Down', 'ArrowDown'], 39383 // #9112: IE11 uses `Del` for Delete key name. 39384 delete: ['Backspace', 'Delete', 'Del'] 39385}; 39386// #4868: modifiers that prevent the execution of the listener 39387// need to explicitly return null so that we can determine whether to remove 39388// the listener for .once 39389const genGuard = condition => `if(${condition})return null;`; 39390const modifierCode = { 39391 stop: '$event.stopPropagation();', 39392 prevent: '$event.preventDefault();', 39393 self: genGuard(`$event.target !== $event.currentTarget`), 39394 ctrl: genGuard(`!$event.ctrlKey`), 39395 shift: genGuard(`!$event.shiftKey`), 39396 alt: genGuard(`!$event.altKey`), 39397 meta: genGuard(`!$event.metaKey`), 39398 left: genGuard(`'button' in $event && $event.button !== 0`), 39399 middle: genGuard(`'button' in $event && $event.button !== 1`), 39400 right: genGuard(`'button' in $event && $event.button !== 2`) 39401}; 39402function genHandlers(events, isNative) { 39403 const prefix = isNative ? 'nativeOn:' : 'on:'; 39404 let staticHandlers = ``; 39405 let dynamicHandlers = ``; 39406 for (const name in events) { 39407 const handlerCode = genHandler(events[name]); 39408 //@ts-expect-error 39409 if (events[name] && events[name].dynamic) { 39410 dynamicHandlers += `${name},${handlerCode},`; 39411 } 39412 else { 39413 staticHandlers += `"${name}":${handlerCode},`; 39414 } 39415 } 39416 staticHandlers = `{${staticHandlers.slice(0, -1)}}`; 39417 if (dynamicHandlers) { 39418 return prefix + `_d(${staticHandlers},[${dynamicHandlers.slice(0, -1)}])`; 39419 } 39420 else { 39421 return prefix + staticHandlers; 39422 } 39423} 39424function genHandler(handler) { 39425 if (!handler) { 39426 return 'function(){}'; 39427 } 39428 if (Array.isArray(handler)) { 39429 return `[${handler.map(handler => genHandler(handler)).join(',')}]`; 39430 } 39431 const isMethodPath = simplePathRE.test(handler.value); 39432 const isFunctionExpression = fnExpRE.test(handler.value); 39433 const isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, '')); 39434 if (!handler.modifiers) { 39435 if (isMethodPath || isFunctionExpression) { 39436 return handler.value; 39437 } 39438 return `function($event){${isFunctionInvocation ? `return ${handler.value}` : handler.value}}`; // inline statement 39439 } 39440 else { 39441 let code = ''; 39442 let genModifierCode = ''; 39443 const keys = []; 39444 for (const key in handler.modifiers) { 39445 if (modifierCode[key]) { 39446 genModifierCode += modifierCode[key]; 39447 // left/right 39448 if (keyCodes[key]) { 39449 keys.push(key); 39450 } 39451 } 39452 else if (key === 'exact') { 39453 const modifiers = handler.modifiers; 39454 genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta'] 39455 .filter(keyModifier => !modifiers[keyModifier]) 39456 .map(keyModifier => `$event.${keyModifier}Key`) 39457 .join('||')); 39458 } 39459 else { 39460 keys.push(key); 39461 } 39462 } 39463 if (keys.length) { 39464 code += genKeyFilter(keys); 39465 } 39466 // Make sure modifiers like prevent and stop get executed after key filtering 39467 if (genModifierCode) { 39468 code += genModifierCode; 39469 } 39470 const handlerCode = isMethodPath 39471 ? `return ${handler.value}.apply(null, arguments)` 39472 : isFunctionExpression 39473 ? `return (${handler.value}).apply(null, arguments)` 39474 : isFunctionInvocation 39475 ? `return ${handler.value}` 39476 : handler.value; 39477 return `function($event){${code}${handlerCode}}`; 39478 } 39479} 39480function genKeyFilter(keys) { 39481 return ( 39482 // make sure the key filters only apply to KeyboardEvents 39483 // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake 39484 // key events that do not have keyCode property... 39485 `if(!$event.type.indexOf('key')&&` + 39486 `${keys.map(genFilterCode).join('&&')})return null;`); 39487} 39488function genFilterCode(key) { 39489 const keyVal = parseInt(key, 10); 39490 if (keyVal) { 39491 return `$event.keyCode!==${keyVal}`; 39492 } 39493 const keyCode = keyCodes[key]; 39494 const keyName = keyNames[key]; 39495 return (`_k($event.keyCode,` + 39496 `${JSON.stringify(key)},` + 39497 `${JSON.stringify(keyCode)},` + 39498 `$event.key,` + 39499 `${JSON.stringify(keyName)}` + 39500 `)`); 39501} 39502 39503function on(el, dir) { 39504 if (dir.modifiers) { 39505 warn$2(`v-on without argument does not support modifiers.`); 39506 } 39507 el.wrapListeners = (code) => `_g(${code},${dir.value})`; 39508} 39509 39510function bind(el, dir) { 39511 el.wrapData = (code) => { 39512 return `_b(${code},'${el.tag}',${dir.value},${dir.modifiers && dir.modifiers.prop ? 'true' : 'false'}${dir.modifiers && dir.modifiers.sync ? ',true' : ''})`; 39513 }; 39514} 39515 39516var baseDirectives = { 39517 on, 39518 bind, 39519 cloak: noop 39520}; 39521 39522class CodegenState { 39523 constructor(options) { 39524 this.options = options; 39525 this.warn = options.warn || baseWarn; 39526 this.transforms = pluckModuleFunction(options.modules, 'transformCode'); 39527 this.dataGenFns = pluckModuleFunction(options.modules, 'genData'); 39528 this.directives = extend(extend({}, baseDirectives), options.directives); 39529 const isReservedTag = options.isReservedTag || no; 39530 this.maybeComponent = (el) => !!el.component || !isReservedTag(el.tag); 39531 this.onceId = 0; 39532 this.staticRenderFns = []; 39533 this.pre = false; 39534 } 39535} 39536function generate(ast, options) { 39537 const state = new CodegenState(options); 39538 // fix #11483, Root level <script> tags should not be rendered. 39539 const code = ast 39540 ? ast.tag === 'script' 39541 ? 'null' 39542 : genElement(ast, state) 39543 : '_c("div")'; 39544 return { 39545 render: `with(this){return ${code}}`, 39546 staticRenderFns: state.staticRenderFns 39547 }; 39548} 39549function genElement(el, state) { 39550 if (el.parent) { 39551 el.pre = el.pre || el.parent.pre; 39552 } 39553 if (el.staticRoot && !el.staticProcessed) { 39554 return genStatic(el, state); 39555 } 39556 else if (el.once && !el.onceProcessed) { 39557 return genOnce(el, state); 39558 } 39559 else if (el.for && !el.forProcessed) { 39560 return genFor(el, state); 39561 } 39562 else if (el.if && !el.ifProcessed) { 39563 return genIf(el, state); 39564 } 39565 else if (el.tag === 'template' && !el.slotTarget && !state.pre) { 39566 return genChildren(el, state) || 'void 0'; 39567 } 39568 else if (el.tag === 'slot') { 39569 return genSlot(el, state); 39570 } 39571 else { 39572 // component or element 39573 let code; 39574 if (el.component) { 39575 code = genComponent(el.component, el, state); 39576 } 39577 else { 39578 let data; 39579 const maybeComponent = state.maybeComponent(el); 39580 if (!el.plain || (el.pre && maybeComponent)) { 39581 data = genData(el, state); 39582 } 39583 let tag; 39584 // check if this is a component in <script setup> 39585 const bindings = state.options.bindings; 39586 if (maybeComponent && bindings && bindings.__isScriptSetup !== false) { 39587 tag = checkBindingType(bindings, el.tag); 39588 } 39589 if (!tag) 39590 tag = `'${el.tag}'`; 39591 const children = el.inlineTemplate ? null : genChildren(el, state, true); 39592 code = `_c(${tag}${data ? `,${data}` : '' // data 39593 }${children ? `,${children}` : '' // children 39594 })`; 39595 } 39596 // module transforms 39597 for (let i = 0; i < state.transforms.length; i++) { 39598 code = state.transforms[i](el, code); 39599 } 39600 return code; 39601 } 39602} 39603function checkBindingType(bindings, key) { 39604 const camelName = camelize(key); 39605 const PascalName = capitalize(camelName); 39606 const checkType = (type) => { 39607 if (bindings[key] === type) { 39608 return key; 39609 } 39610 if (bindings[camelName] === type) { 39611 return camelName; 39612 } 39613 if (bindings[PascalName] === type) { 39614 return PascalName; 39615 } 39616 }; 39617 const fromConst = checkType("setup-const" /* BindingTypes.SETUP_CONST */) || 39618 checkType("setup-reactive-const" /* BindingTypes.SETUP_REACTIVE_CONST */); 39619 if (fromConst) { 39620 return fromConst; 39621 } 39622 const fromMaybeRef = checkType("setup-let" /* BindingTypes.SETUP_LET */) || 39623 checkType("setup-ref" /* BindingTypes.SETUP_REF */) || 39624 checkType("setup-maybe-ref" /* BindingTypes.SETUP_MAYBE_REF */); 39625 if (fromMaybeRef) { 39626 return fromMaybeRef; 39627 } 39628} 39629// hoist static sub-trees out 39630function genStatic(el, state) { 39631 el.staticProcessed = true; 39632 // Some elements (templates) need to behave differently inside of a v-pre 39633 // node. All pre nodes are static roots, so we can use this as a location to 39634 // wrap a state change and reset it upon exiting the pre node. 39635 const originalPreState = state.pre; 39636 if (el.pre) { 39637 state.pre = el.pre; 39638 } 39639 state.staticRenderFns.push(`with(this){return ${genElement(el, state)}}`); 39640 state.pre = originalPreState; 39641 return `_m(${state.staticRenderFns.length - 1}${el.staticInFor ? ',true' : ''})`; 39642} 39643// v-once 39644function genOnce(el, state) { 39645 el.onceProcessed = true; 39646 if (el.if && !el.ifProcessed) { 39647 return genIf(el, state); 39648 } 39649 else if (el.staticInFor) { 39650 let key = ''; 39651 let parent = el.parent; 39652 while (parent) { 39653 if (parent.for) { 39654 key = parent.key; 39655 break; 39656 } 39657 parent = parent.parent; 39658 } 39659 if (!key) { 39660 state.warn(`v-once can only be used inside v-for that is keyed. `, el.rawAttrsMap['v-once']); 39661 return genElement(el, state); 39662 } 39663 return `_o(${genElement(el, state)},${state.onceId++},${key})`; 39664 } 39665 else { 39666 return genStatic(el, state); 39667 } 39668} 39669function genIf(el, state, altGen, altEmpty) { 39670 el.ifProcessed = true; // avoid recursion 39671 return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty); 39672} 39673function genIfConditions(conditions, state, altGen, altEmpty) { 39674 if (!conditions.length) { 39675 return altEmpty || '_e()'; 39676 } 39677 const condition = conditions.shift(); 39678 if (condition.exp) { 39679 return `(${condition.exp})?${genTernaryExp(condition.block)}:${genIfConditions(conditions, state, altGen, altEmpty)}`; 39680 } 39681 else { 39682 return `${genTernaryExp(condition.block)}`; 39683 } 39684 // v-if with v-once should generate code like (a)?_m(0):_m(1) 39685 function genTernaryExp(el) { 39686 return altGen 39687 ? altGen(el, state) 39688 : el.once 39689 ? genOnce(el, state) 39690 : genElement(el, state); 39691 } 39692} 39693function genFor(el, state, altGen, altHelper) { 39694 const exp = el.for; 39695 const alias = el.alias; 39696 const iterator1 = el.iterator1 ? `,${el.iterator1}` : ''; 39697 const iterator2 = el.iterator2 ? `,${el.iterator2}` : ''; 39698 if (state.maybeComponent(el) && 39699 el.tag !== 'slot' && 39700 el.tag !== 'template' && 39701 !el.key) { 39702 state.warn(`<${el.tag} v-for="${alias} in ${exp}">: component lists rendered with ` + 39703 `v-for should have explicit keys. ` + 39704 `See https://v2.vuejs.org/v2/guide/list.html#key for more info.`, el.rawAttrsMap['v-for'], true /* tip */); 39705 } 39706 el.forProcessed = true; // avoid recursion 39707 return (`${altHelper || '_l'}((${exp}),` + 39708 `function(${alias}${iterator1}${iterator2}){` + 39709 `return ${(altGen || genElement)(el, state)}` + 39710 '})'); 39711} 39712function genData(el, state) { 39713 let data = '{'; 39714 // directives first. 39715 // directives may mutate the el's other properties before they are generated. 39716 const dirs = genDirectives(el, state); 39717 if (dirs) 39718 data += dirs + ','; 39719 // key 39720 if (el.key) { 39721 data += `key:${el.key},`; 39722 } 39723 // ref 39724 if (el.ref) { 39725 data += `ref:${el.ref},`; 39726 } 39727 if (el.refInFor) { 39728 data += `refInFor:true,`; 39729 } 39730 // pre 39731 if (el.pre) { 39732 data += `pre:true,`; 39733 } 39734 // record original tag name for components using "is" attribute 39735 if (el.component) { 39736 data += `tag:"${el.tag}",`; 39737 } 39738 // module data generation functions 39739 for (let i = 0; i < state.dataGenFns.length; i++) { 39740 data += state.dataGenFns[i](el); 39741 } 39742 // attributes 39743 if (el.attrs) { 39744 data += `attrs:${genProps(el.attrs)},`; 39745 } 39746 // DOM props 39747 if (el.props) { 39748 data += `domProps:${genProps(el.props)},`; 39749 } 39750 // event handlers 39751 if (el.events) { 39752 data += `${genHandlers(el.events, false)},`; 39753 } 39754 if (el.nativeEvents) { 39755 data += `${genHandlers(el.nativeEvents, true)},`; 39756 } 39757 // slot target 39758 // only for non-scoped slots 39759 if (el.slotTarget && !el.slotScope) { 39760 data += `slot:${el.slotTarget},`; 39761 } 39762 // scoped slots 39763 if (el.scopedSlots) { 39764 data += `${genScopedSlots(el, el.scopedSlots, state)},`; 39765 } 39766 // component v-model 39767 if (el.model) { 39768 data += `model:{value:${el.model.value},callback:${el.model.callback},expression:${el.model.expression}},`; 39769 } 39770 // inline-template 39771 if (el.inlineTemplate) { 39772 const inlineTemplate = genInlineTemplate(el, state); 39773 if (inlineTemplate) { 39774 data += `${inlineTemplate},`; 39775 } 39776 } 39777 data = data.replace(/,$/, '') + '}'; 39778 // v-bind dynamic argument wrap 39779 // v-bind with dynamic arguments must be applied using the same v-bind object 39780 // merge helper so that class/style/mustUseProp attrs are handled correctly. 39781 if (el.dynamicAttrs) { 39782 data = `_b(${data},"${el.tag}",${genProps(el.dynamicAttrs)})`; 39783 } 39784 // v-bind data wrap 39785 if (el.wrapData) { 39786 data = el.wrapData(data); 39787 } 39788 // v-on data wrap 39789 if (el.wrapListeners) { 39790 data = el.wrapListeners(data); 39791 } 39792 return data; 39793} 39794function genDirectives(el, state) { 39795 const dirs = el.directives; 39796 if (!dirs) 39797 return; 39798 let res = 'directives:['; 39799 let hasRuntime = false; 39800 let i, l, dir, needRuntime; 39801 for (i = 0, l = dirs.length; i < l; i++) { 39802 dir = dirs[i]; 39803 needRuntime = true; 39804 const gen = state.directives[dir.name]; 39805 if (gen) { 39806 // compile-time directive that manipulates AST. 39807 // returns true if it also needs a runtime counterpart. 39808 needRuntime = !!gen(el, dir, state.warn); 39809 } 39810 if (needRuntime) { 39811 hasRuntime = true; 39812 res += `{name:"${dir.name}",rawName:"${dir.rawName}"${dir.value 39813 ? `,value:(${dir.value}),expression:${JSON.stringify(dir.value)}` 39814 : ''}${dir.arg ? `,arg:${dir.isDynamicArg ? dir.arg : `"${dir.arg}"`}` : ''}${dir.modifiers ? `,modifiers:${JSON.stringify(dir.modifiers)}` : ''}},`; 39815 } 39816 } 39817 if (hasRuntime) { 39818 return res.slice(0, -1) + ']'; 39819 } 39820} 39821function genInlineTemplate(el, state) { 39822 const ast = el.children[0]; 39823 if ((el.children.length !== 1 || ast.type !== 1)) { 39824 state.warn('Inline-template components must have exactly one child element.', { start: el.start }); 39825 } 39826 if (ast && ast.type === 1) { 39827 const inlineRenderFns = generate(ast, state.options); 39828 return `inlineTemplate:{render:function(){${inlineRenderFns.render}},staticRenderFns:[${inlineRenderFns.staticRenderFns 39829 .map(code => `function(){${code}}`) 39830 .join(',')}]}`; 39831 } 39832} 39833function genScopedSlots(el, slots, state) { 39834 // by default scoped slots are considered "stable", this allows child 39835 // components with only scoped slots to skip forced updates from parent. 39836 // but in some cases we have to bail-out of this optimization 39837 // for example if the slot contains dynamic names, has v-if or v-for on them... 39838 let needsForceUpdate = el.for || 39839 Object.keys(slots).some(key => { 39840 const slot = slots[key]; 39841 return (slot.slotTargetDynamic || slot.if || slot.for || containsSlotChild(slot) // is passing down slot from parent which may be dynamic 39842 ); 39843 }); 39844 // #9534: if a component with scoped slots is inside a conditional branch, 39845 // it's possible for the same component to be reused but with different 39846 // compiled slot content. To avoid that, we generate a unique key based on 39847 // the generated code of all the slot contents. 39848 let needsKey = !!el.if; 39849 // OR when it is inside another scoped slot or v-for (the reactivity may be 39850 // disconnected due to the intermediate scope variable) 39851 // #9438, #9506 39852 // TODO: this can be further optimized by properly analyzing in-scope bindings 39853 // and skip force updating ones that do not actually use scope variables. 39854 if (!needsForceUpdate) { 39855 let parent = el.parent; 39856 while (parent) { 39857 if ((parent.slotScope && parent.slotScope !== emptySlotScopeToken) || 39858 parent.for) { 39859 needsForceUpdate = true; 39860 break; 39861 } 39862 if (parent.if) { 39863 needsKey = true; 39864 } 39865 parent = parent.parent; 39866 } 39867 } 39868 const generatedSlots = Object.keys(slots) 39869 .map(key => genScopedSlot(slots[key], state)) 39870 .join(','); 39871 return `scopedSlots:_u([${generatedSlots}]${needsForceUpdate ? `,null,true` : ``}${!needsForceUpdate && needsKey ? `,null,false,${hash(generatedSlots)}` : ``})`; 39872} 39873function hash(str) { 39874 let hash = 5381; 39875 let i = str.length; 39876 while (i) { 39877 hash = (hash * 33) ^ str.charCodeAt(--i); 39878 } 39879 return hash >>> 0; 39880} 39881function containsSlotChild(el) { 39882 if (el.type === 1) { 39883 if (el.tag === 'slot') { 39884 return true; 39885 } 39886 return el.children.some(containsSlotChild); 39887 } 39888 return false; 39889} 39890function genScopedSlot(el, state) { 39891 const isLegacySyntax = el.attrsMap['slot-scope']; 39892 if (el.if && !el.ifProcessed && !isLegacySyntax) { 39893 return genIf(el, state, genScopedSlot, `null`); 39894 } 39895 if (el.for && !el.forProcessed) { 39896 return genFor(el, state, genScopedSlot); 39897 } 39898 const slotScope = el.slotScope === emptySlotScopeToken ? `` : String(el.slotScope); 39899 const fn = `function(${slotScope}){` + 39900 `return ${el.tag === 'template' 39901 ? el.if && isLegacySyntax 39902 ? `(${el.if})?${genChildren(el, state) || 'undefined'}:undefined` 39903 : genChildren(el, state) || 'undefined' 39904 : genElement(el, state)}}`; 39905 // reverse proxy v-slot without scope on this.$slots 39906 const reverseProxy = slotScope ? `` : `,proxy:true`; 39907 return `{key:${el.slotTarget || `"default"`},fn:${fn}${reverseProxy}}`; 39908} 39909function genChildren(el, state, checkSkip, altGenElement, altGenNode) { 39910 const children = el.children; 39911 if (children.length) { 39912 const el = children[0]; 39913 // optimize single v-for 39914 if (children.length === 1 && 39915 el.for && 39916 el.tag !== 'template' && 39917 el.tag !== 'slot') { 39918 const normalizationType = checkSkip 39919 ? state.maybeComponent(el) 39920 ? `,1` 39921 : `,0` 39922 : ``; 39923 return `${(altGenElement || genElement)(el, state)}${normalizationType}`; 39924 } 39925 const normalizationType = checkSkip 39926 ? getNormalizationType(children, state.maybeComponent) 39927 : 0; 39928 const gen = altGenNode || genNode; 39929 return `[${children.map(c => gen(c, state)).join(',')}]${normalizationType ? `,${normalizationType}` : ''}`; 39930 } 39931} 39932// determine the normalization needed for the children array. 39933// 0: no normalization needed 39934// 1: simple normalization needed (possible 1-level deep nested array) 39935// 2: full normalization needed 39936function getNormalizationType(children, maybeComponent) { 39937 let res = 0; 39938 for (let i = 0; i < children.length; i++) { 39939 const el = children[i]; 39940 if (el.type !== 1) { 39941 continue; 39942 } 39943 if (needsNormalization(el) || 39944 (el.ifConditions && 39945 el.ifConditions.some(c => needsNormalization(c.block)))) { 39946 res = 2; 39947 break; 39948 } 39949 if (maybeComponent(el) || 39950 (el.ifConditions && el.ifConditions.some(c => maybeComponent(c.block)))) { 39951 res = 1; 39952 } 39953 } 39954 return res; 39955} 39956function needsNormalization(el) { 39957 return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'; 39958} 39959function genNode(node, state) { 39960 if (node.type === 1) { 39961 return genElement(node, state); 39962 } 39963 else if (node.type === 3 && node.isComment) { 39964 return genComment(node); 39965 } 39966 else { 39967 return genText(node); 39968 } 39969} 39970function genText(text) { 39971 return `_v(${text.type === 2 39972 ? text.expression // no need for () because already wrapped in _s() 39973 : transformSpecialNewlines(JSON.stringify(text.text))})`; 39974} 39975function genComment(comment) { 39976 return `_e(${JSON.stringify(comment.text)})`; 39977} 39978function genSlot(el, state) { 39979 const slotName = el.slotName || '"default"'; 39980 const children = genChildren(el, state); 39981 let res = `_t(${slotName}${children ? `,function(){return ${children}}` : ''}`; 39982 const attrs = el.attrs || el.dynamicAttrs 39983 ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(attr => ({ 39984 // slot props are camelized 39985 name: camelize(attr.name), 39986 value: attr.value, 39987 dynamic: attr.dynamic 39988 }))) 39989 : null; 39990 const bind = el.attrsMap['v-bind']; 39991 if ((attrs || bind) && !children) { 39992 res += `,null`; 39993 } 39994 if (attrs) { 39995 res += `,${attrs}`; 39996 } 39997 if (bind) { 39998 res += `${attrs ? '' : ',null'},${bind}`; 39999 } 40000 return res + ')'; 40001} 40002// componentName is el.component, take it as argument to shun flow's pessimistic refinement 40003function genComponent(componentName, el, state) { 40004 const children = el.inlineTemplate ? null : genChildren(el, state, true); 40005 return `_c(${componentName},${genData(el, state)}${children ? `,${children}` : ''})`; 40006} 40007function genProps(props) { 40008 let staticProps = ``; 40009 let dynamicProps = ``; 40010 for (let i = 0; i < props.length; i++) { 40011 const prop = props[i]; 40012 const value = transformSpecialNewlines(prop.value); 40013 if (prop.dynamic) { 40014 dynamicProps += `${prop.name},${value},`; 40015 } 40016 else { 40017 staticProps += `"${prop.name}":${value},`; 40018 } 40019 } 40020 staticProps = `{${staticProps.slice(0, -1)}}`; 40021 if (dynamicProps) { 40022 return `_d(${staticProps},[${dynamicProps.slice(0, -1)}])`; 40023 } 40024 else { 40025 return staticProps; 40026 } 40027} 40028// #3895, #4268 40029function transformSpecialNewlines(text) { 40030 return text.replace(/\u2028/g, '\\u2028').replace(/\u2029/g, '\\u2029'); 40031} 40032 40033// these keywords should not appear inside expressions, but operators like 40034// typeof, instanceof and in are allowed 40035const prohibitedKeywordRE = new RegExp('\\b' + 40036 ('do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' + 40037 'super,throw,while,yield,delete,export,import,return,switch,default,' + 40038 'extends,finally,continue,debugger,function,arguments') 40039 .split(',') 40040 .join('\\b|\\b') + 40041 '\\b'); 40042// these unary operators should not be used as property/method names 40043const unaryOperatorsRE = new RegExp('\\b' + 40044 'delete,typeof,void'.split(',').join('\\s*\\([^\\)]*\\)|\\b') + 40045 '\\s*\\([^\\)]*\\)'); 40046// strip strings in expressions 40047const stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; 40048// detect problematic expressions in a template 40049function detectErrors(ast, warn) { 40050 if (ast) { 40051 checkNode(ast, warn); 40052 } 40053} 40054function checkNode(node, warn) { 40055 if (node.type === 1) { 40056 for (const name in node.attrsMap) { 40057 if (dirRE.test(name)) { 40058 const value = node.attrsMap[name]; 40059 if (value) { 40060 const range = node.rawAttrsMap[name]; 40061 if (name === 'v-for') { 40062 checkFor(node, `v-for="${value}"`, warn, range); 40063 } 40064 else if (name === 'v-slot' || name[0] === '#') { 40065 checkFunctionParameterExpression(value, `${name}="${value}"`, warn, range); 40066 } 40067 else if (onRE.test(name)) { 40068 checkEvent(value, `${name}="${value}"`, warn, range); 40069 } 40070 else { 40071 checkExpression(value, `${name}="${value}"`, warn, range); 40072 } 40073 } 40074 } 40075 } 40076 if (node.children) { 40077 for (let i = 0; i < node.children.length; i++) { 40078 checkNode(node.children[i], warn); 40079 } 40080 } 40081 } 40082 else if (node.type === 2) { 40083 checkExpression(node.expression, node.text, warn, node); 40084 } 40085} 40086function checkEvent(exp, text, warn, range) { 40087 const stripped = exp.replace(stripStringRE, ''); 40088 const keywordMatch = stripped.match(unaryOperatorsRE); 40089 if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') { 40090 warn(`avoid using JavaScript unary operator as property name: ` + 40091 `"${keywordMatch[0]}" in expression ${text.trim()}`, range); 40092 } 40093 checkExpression(exp, text, warn, range); 40094} 40095function checkFor(node, text, warn, range) { 40096 checkExpression(node.for || '', text, warn, range); 40097 checkIdentifier(node.alias, 'v-for alias', text, warn, range); 40098 checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range); 40099 checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range); 40100} 40101function checkIdentifier(ident, type, text, warn, range) { 40102 if (typeof ident === 'string') { 40103 try { 40104 new Function(`var ${ident}=_`); 40105 } 40106 catch (e) { 40107 warn(`invalid ${type} "${ident}" in expression: ${text.trim()}`, range); 40108 } 40109 } 40110} 40111function checkExpression(exp, text, warn, range) { 40112 try { 40113 new Function(`return ${exp}`); 40114 } 40115 catch (e) { 40116 const keywordMatch = exp 40117 .replace(stripStringRE, '') 40118 .match(prohibitedKeywordRE); 40119 if (keywordMatch) { 40120 warn(`avoid using JavaScript keyword as property name: ` + 40121 `"${keywordMatch[0]}"\n Raw expression: ${text.trim()}`, range); 40122 } 40123 else { 40124 warn(`invalid expression: ${e.message} in\n\n` + 40125 ` ${exp}\n\n` + 40126 ` Raw expression: ${text.trim()}\n`, range); 40127 } 40128 } 40129} 40130function checkFunctionParameterExpression(exp, text, warn, range) { 40131 try { 40132 new Function(exp, ''); 40133 } 40134 catch (e) { 40135 warn(`invalid function parameter expression: ${e.message} in\n\n` + 40136 ` ${exp}\n\n` + 40137 ` Raw expression: ${text.trim()}\n`, range); 40138 } 40139} 40140 40141const range = 2; 40142function generateCodeFrame(source, start = 0, end = source.length) { 40143 const lines = source.split(/\r?\n/); 40144 let count = 0; 40145 const res = []; 40146 for (let i = 0; i < lines.length; i++) { 40147 count += lines[i].length + 1; 40148 if (count >= start) { 40149 for (let j = i - range; j <= i + range || end > count; j++) { 40150 if (j < 0 || j >= lines.length) 40151 continue; 40152 res.push(`${j + 1}${repeat(` `, 3 - String(j + 1).length)}| ${lines[j]}`); 40153 const lineLength = lines[j].length; 40154 if (j === i) { 40155 // push underline 40156 const pad = start - (count - lineLength) + 1; 40157 const length = end > count ? lineLength - pad : end - start; 40158 res.push(` | ` + repeat(` `, pad) + repeat(`^`, length)); 40159 } 40160 else if (j > i) { 40161 if (end > count) { 40162 const length = Math.min(end - count, lineLength); 40163 res.push(` | ` + repeat(`^`, length)); 40164 } 40165 count += lineLength + 1; 40166 } 40167 } 40168 break; 40169 } 40170 } 40171 return res.join('\n'); 40172} 40173function repeat(str, n) { 40174 let result = ''; 40175 if (n > 0) { 40176 // eslint-disable-next-line no-constant-condition 40177 while (true) { 40178 // eslint-disable-line 40179 if (n & 1) 40180 result += str; 40181 n >>>= 1; 40182 if (n <= 0) 40183 break; 40184 str += str; 40185 } 40186 } 40187 return result; 40188} 40189 40190function createFunction(code, errors) { 40191 try { 40192 return new Function(code); 40193 } 40194 catch (err) { 40195 errors.push({ err, code }); 40196 return noop; 40197 } 40198} 40199function createCompileToFunctionFn(compile) { 40200 const cache = Object.create(null); 40201 return function compileToFunctions(template, options, vm) { 40202 options = extend({}, options); 40203 const warn = options.warn || warn$2; 40204 delete options.warn; 40205 /* istanbul ignore if */ 40206 { 40207 // detect possible CSP restriction 40208 try { 40209 new Function('return 1'); 40210 } 40211 catch (e) { 40212 if (e.toString().match(/unsafe-eval|CSP/)) { 40213 warn('It seems you are using the standalone build of Vue.js in an ' + 40214 'environment with Content Security Policy that prohibits unsafe-eval. ' + 40215 'The template compiler cannot work in this environment. Consider ' + 40216 'relaxing the policy to allow unsafe-eval or pre-compiling your ' + 40217 'templates into render functions.'); 40218 } 40219 } 40220 } 40221 // check cache 40222 const key = options.delimiters 40223 ? String(options.delimiters) + template 40224 : template; 40225 if (cache[key]) { 40226 return cache[key]; 40227 } 40228 // compile 40229 const compiled = compile(template, options); 40230 // check compilation errors/tips 40231 { 40232 if (compiled.errors && compiled.errors.length) { 40233 if (options.outputSourceRange) { 40234 compiled.errors.forEach(e => { 40235 warn(`Error compiling template:\n\n${e.msg}\n\n` + 40236 generateCodeFrame(template, e.start, e.end), vm); 40237 }); 40238 } 40239 else { 40240 warn(`Error compiling template:\n\n${template}\n\n` + 40241 compiled.errors.map(e => `- ${e}`).join('\n') + 40242 '\n', vm); 40243 } 40244 } 40245 if (compiled.tips && compiled.tips.length) { 40246 if (options.outputSourceRange) { 40247 compiled.tips.forEach(e => tip(e.msg, vm)); 40248 } 40249 else { 40250 compiled.tips.forEach(msg => tip(msg, vm)); 40251 } 40252 } 40253 } 40254 // turn code into functions 40255 const res = {}; 40256 const fnGenErrors = []; 40257 res.render = createFunction(compiled.render, fnGenErrors); 40258 res.staticRenderFns = compiled.staticRenderFns.map(code => { 40259 return createFunction(code, fnGenErrors); 40260 }); 40261 // check function generation errors. 40262 // this should only happen if there is a bug in the compiler itself. 40263 // mostly for codegen development use 40264 /* istanbul ignore if */ 40265 { 40266 if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) { 40267 warn(`Failed to generate render function:\n\n` + 40268 fnGenErrors 40269 .map(({ err, code }) => `${err.toString()} in\n\n${code}\n`) 40270 .join('\n'), vm); 40271 } 40272 } 40273 return (cache[key] = res); 40274 }; 40275} 40276 40277function createCompilerCreator(baseCompile) { 40278 return function createCompiler(baseOptions) { 40279 function compile(template, options) { 40280 const finalOptions = Object.create(baseOptions); 40281 const errors = []; 40282 const tips = []; 40283 let warn = (msg, range, tip) => { 40284 (tip ? tips : errors).push(msg); 40285 }; 40286 if (options) { 40287 if (options.outputSourceRange) { 40288 // $flow-disable-line 40289 const leadingSpaceLength = template.match(/^\s*/)[0].length; 40290 warn = (msg, range, tip) => { 40291 const data = typeof msg === 'string' ? { msg } : msg; 40292 if (range) { 40293 if (range.start != null) { 40294 data.start = range.start + leadingSpaceLength; 40295 } 40296 if (range.end != null) { 40297 data.end = range.end + leadingSpaceLength; 40298 } 40299 } 40300 (tip ? tips : errors).push(data); 40301 }; 40302 } 40303 // merge custom modules 40304 if (options.modules) { 40305 finalOptions.modules = (baseOptions.modules || []).concat(options.modules); 40306 } 40307 // merge custom directives 40308 if (options.directives) { 40309 finalOptions.directives = extend(Object.create(baseOptions.directives || null), options.directives); 40310 } 40311 // copy other options 40312 for (const key in options) { 40313 if (key !== 'modules' && key !== 'directives') { 40314 finalOptions[key] = options[key]; 40315 } 40316 } 40317 } 40318 finalOptions.warn = warn; 40319 const compiled = baseCompile(template.trim(), finalOptions); 40320 { 40321 detectErrors(compiled.ast, warn); 40322 } 40323 compiled.errors = errors; 40324 compiled.tips = tips; 40325 return compiled; 40326 } 40327 return { 40328 compile, 40329 compileToFunctions: createCompileToFunctionFn(compile) 40330 }; 40331 }; 40332} 40333 40334// `createCompilerCreator` allows creating compilers that use alternative 40335// parser/optimizer/codegen, e.g the SSR optimizing compiler. 40336// Here we just export a default compiler using the default parts. 40337const createCompiler = createCompilerCreator(function baseCompile(template, options) { 40338 const ast = parse(template.trim(), options); 40339 if (options.optimize !== false) { 40340 optimize(ast, options); 40341 } 40342 const code = generate(ast, options); 40343 return { 40344 ast, 40345 render: code.render, 40346 staticRenderFns: code.staticRenderFns 40347 }; 40348}); 40349 40350const { compile, compileToFunctions } = createCompiler(baseOptions); 40351 40352// check whether current browser encodes a char inside attribute values 40353let div; 40354function getShouldDecode(href) { 40355 div = div || document.createElement('div'); 40356 div.innerHTML = href ? `<a href="\n"/>` : `<div a="\n"/>`; 40357 return div.innerHTML.indexOf(' ') > 0; 40358} 40359// #3663: IE encodes newlines inside attribute values while other browsers don't 40360const shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false; 40361// #6828: chrome encodes content in a[href] 40362const shouldDecodeNewlinesForHref = inBrowser 40363 ? getShouldDecode(true) 40364 : false; 40365 40366const idToTemplate = cached(id => { 40367 const el = query(id); 40368 return el && el.innerHTML; 40369}); 40370const mount = Vue.prototype.$mount; 40371Vue.prototype.$mount = function (el, hydrating) { 40372 el = el && query(el); 40373 /* istanbul ignore if */ 40374 if (el === document.body || el === document.documentElement) { 40375 warn$2(`Do not mount Vue to <html> or <body> - mount to normal elements instead.`); 40376 return this; 40377 } 40378 const options = this.$options; 40379 // resolve template/el and convert to render function 40380 if (!options.render) { 40381 let template = options.template; 40382 if (template) { 40383 if (typeof template === 'string') { 40384 if (template.charAt(0) === '#') { 40385 template = idToTemplate(template); 40386 /* istanbul ignore if */ 40387 if (!template) { 40388 warn$2(`Template element not found or is empty: ${options.template}`, this); 40389 } 40390 } 40391 } 40392 else if (template.nodeType) { 40393 template = template.innerHTML; 40394 } 40395 else { 40396 { 40397 warn$2('invalid template option:' + template, this); 40398 } 40399 return this; 40400 } 40401 } 40402 else if (el) { 40403 // @ts-expect-error 40404 template = getOuterHTML(el); 40405 } 40406 if (template) { 40407 /* istanbul ignore if */ 40408 if (config.performance && mark) { 40409 mark('compile'); 40410 } 40411 const { render, staticRenderFns } = compileToFunctions(template, { 40412 outputSourceRange: true, 40413 shouldDecodeNewlines, 40414 shouldDecodeNewlinesForHref, 40415 delimiters: options.delimiters, 40416 comments: options.comments 40417 }, this); 40418 options.render = render; 40419 options.staticRenderFns = staticRenderFns; 40420 /* istanbul ignore if */ 40421 if (config.performance && mark) { 40422 mark('compile end'); 40423 measure(`vue ${this._name} compile`, 'compile', 'compile end'); 40424 } 40425 } 40426 } 40427 return mount.call(this, el, hydrating); 40428}; 40429/** 40430 * Get outerHTML of elements, taking care 40431 * of SVG elements in IE as well. 40432 */ 40433function getOuterHTML(el) { 40434 if (el.outerHTML) { 40435 return el.outerHTML; 40436 } 40437 else { 40438 const container = document.createElement('div'); 40439 container.appendChild(el.cloneNode(true)); 40440 return container.innerHTML; 40441 } 40442} 40443Vue.compile = compileToFunctions; 40444 40445// export type EffectScheduler = (...args: any[]) => any 40446/** 40447 * @internal since we are not exposing this in Vue 2, it's used only for 40448 * internal testing. 40449 */ 40450function effect(fn, scheduler) { 40451 const watcher = new Watcher(currentInstance, fn, noop, { 40452 sync: true 40453 }); 40454 if (scheduler) { 40455 watcher.update = () => { 40456 scheduler(() => watcher.run()); 40457 }; 40458 } 40459} 40460 40461extend(Vue, vca); 40462Vue.effect = effect; 40463 40464module.exports = Vue; 40465 40466/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../../../../node_modules/timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate)) 40467 40468/***/ }), 40469
vendor: 519 bytes, lines 40470-40483
40470/***/ "./Themes/Cynoebook/node_modules/vue/dist/vue.common.js": 40471/*!**************************************************************!*\ 40472 !*** ./Themes/Cynoebook/node_modules/vue/dist/vue.common.js ***! 40473 \**************************************************************/ 40474/*! no static exports found */ 40475/***/ (function(module, exports, __webpack_require__) { 40476 40477if (false) {} else { 40478 module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./Themes/Cynoebook/node_modules/vue/dist/vue.common.dev.js") 40479} 40480 40481 40482/***/ }), 40483
vendor: 4,119 bytes, lines 40484-40517
40484/***/ "./Themes/Cynoebook/resources/assets/public/js/app.js": 40485/*!************************************************************!*\ 40486 !*** ./Themes/Cynoebook/resources/assets/public/js/app.js ***! 40487 \************************************************************/ 40488/*! no exports provided */ 40489/***/ (function(module, __webpack_exports__, __webpack_require__) { 40490 40491"use strict"; 40492__webpack_require__.r(__webpack_exports__); 40493/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./Themes/Cynoebook/node_modules/vue/dist/vue.common.js"); 40494/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__); 40495/* harmony import */ var _components_layout_NewsletterPopup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/layout/NewsletterPopup */ "./Themes/Cynoebook/resources/assets/public/js/components/layout/NewsletterPopup.js"); 40496/* harmony import */ var _components_layout_NewsletterSubscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/layout/NewsletterSubscription */ "./Themes/Cynoebook/resources/assets/public/js/components/layout/NewsletterSubscription.js"); 40497/* harmony import */ var _components_layout_CookieBar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/layout/CookieBar */ "./Themes/Cynoebook/resources/assets/public/js/components/layout/CookieBar.js"); 40498/* harmony import */ var _components_tezfiles_tezfilesAuth__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/tezfiles/tezfilesAuth */ "./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue"); 40499/* harmony import */ var _components_k2sPlayer_k2sPlayer__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/k2sPlayer/k2sPlayer */ "./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue"); 40500/* harmony import */ var _components_vueEasyLightbox_vueLightbox__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/vueEasyLightbox/vueLightbox */ "./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue"); 40501/* harmony import */ var _functions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./functions */ "./Themes/Cynoebook/resources/assets/public/js/functions.js"); 40502function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } 40503 40504function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 40505 40506function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 40507 40508__webpack_require__(/*! ./bootstrap */ "./Themes/Cynoebook/resources/assets/public/js/bootstrap.js"); 40509 40510 40511 40512 40513 40514 40515 40516 40517vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('newsletter-popup', _c
40517omponents_layout_NewsletterPopup__WEBPACK_IMPORTED_MODULE_1__["default"]); 40518vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('newsletter-subscription', _components_layout_NewsletterSubscription__WEBPACK_IMPORTED_MODULE_2__["default"]); 40519vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('cookie-bar', _components_layout_CookieBar__WEBPACK_IMPORTED_MODULE_3__["default"]); 40520vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('tezfiles-auth', _components_tezfiles_tezfilesAuth__WEBPACK_IMPORTED_MODULE_4__["default"]); 40521vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('k2s-player', _components_k2sPlayer_k2sPlayer__WEBPACK_IMPORTED_MODULE_5__["default"]); 40522vue__WEBPACK_IMPORTED_MODULE_0___default.a.component('vue-lightbox', _components_vueEasyLightbox_vueLightbox__WEBPACK_IMPORTED_MODULE_6__["default"]); 40523new vue__WEBPACK_IMPORTED_MODULE_0___default.a({ 40524 el: '#app' 40525}); 40526 40527$(function () { 40528 if (!('ontouchstart' in window)) { 40529 var screenlistTimer; 40530 $('body').on('mouseenter', '.k2s-preview', function () { 40531 if (!$('iframe', this)[0]) { 40532 var loadThumbs = function loadThumbs(next) { 40533 var offset = thumbs.parent().position().left; 40534 var start = Math.ceil((1 - thumbs.width() - offset) / thumbs.outerWidth(true)); 40535 var end = Math.ceil((preview.width() - offset) / thumbs.outerWidth(true) + 0.5); 40536 thumbs.each(function (index) { 40537 if (index <= end) { 40538 index = (index - start + 10) % 10 + start; 40539 40540 if (next ? index + 1 == end || index == end : index <= end) { 40541 this.style.backgroundImage = ''; 40542 this.style.backgroundImage = 'url("https://static-cache.' + urlParts[0] + '/thumbnail/' + urlParts[2] + '/w320h240/' + index % 10 + '.jpeg")'; 40543 } 40544 } 40545 }); 40546 }; 40547 40548 if (!$('.screenlist', this)[0]) { 40549 $('.poster', this).after('<div class="screenlist"><div class="thumbs">' + Array(16).join('<div></div>') + '</div></div>'); 40550 } 40551 40552 var preview = $(this); 40553 var thumbs = $('.thumbs div', this); 40554 var urlParts = preview.next()[0].dataset.url.slice(8).split('/'); 40555 console.log("urlParts"); 40556 console.log(urlParts); 40557 screenlistTimer = setTimeout(function () { 40558 loadThumbs(); 40559 screenlistTimer = setInterval(loadThumbs, 2000, true); 40560 }, 2000); 40561 loadThumbs(); 40562 } 40563 }).on('mouseleave', '.k2s-preview', function () { 40564 clearInterval(screenlistTimer); 40565 }); 40566 } 40567 40568 ; 40569 var isRTL = $('body').hasClass('rtl'); 40570 var directionClass = isRTL ? 'rtl' : 'ltr'; 40571 /*----------------------------------------*/ 40572 40573 /* sticky nav 40574 /*----------------------------------------*/ 40575 40576 var stickyNavTop = $('.header-wrapper').offset().top; 40577 40578 var stickyNav = function stickyNav() { 40579 var scrollTop = $(window).scrollTop(); 40580 40581 if (scrollTop > stickyNavTop) { 40582 $('.header-inner, .autocomplete-suggestions').addClass('sticky'); 40583 return; 40584 } 40585 40586 $('.header-inner, .autocomplete-suggestions').removeClass('sticky'); 40587 }; 40588 40589 $(window).on('load scroll', function () { 40590 stickyNav(); 40591 }); 40592 /*----------------------------------------*/ 40593 40594 /* content wrapper minimum height 40595 /*----------------------------------------*/ 40596 40597 var contentWrapper = $('.content-wrapper'); 40598 var footer = $('.footer'); 40599 $(window).on('load resize', function () { 40600 $('.content-wrapper').css('min-height', $(window).height() - contentWrapper.offset().top - footer.height() + 'px'); 40601 }); // let linksTezFiles = $('a[href="https://tezfiles.com"]'); 40602 40603 /*----------------------------------------*/ 40604 40605 /* search box 40606 /*----------------------------------------*/ 40607 40608 function autocomplete(selector, options) { 40609 $(selector).autocomplete(Object.assign({ 40610 dataType: 'json', 40611 triggerSelectOnValidInput: false, 40612 transformResult: function transformResult(response) { 40613 var ebooks = response.data.map(function (ebook) { 40614 return { 40615 value: ebook.title.toLowerCase(), 40616 label: ebook.title.toLowerCase() 40617 }; 40618 }); 40619 return { 40620 suggestions: ebooks 40621 }; 40622 }, 40623 onSelect: function onSelect() { 40624 $(selector).closest('#search-box-form').submit(); 40625 } 40626 }, options)); 40627 } 40628 40629 autocomplete('.search-box .search-box-input', { 40630 serviceUrl: function serviceUrl() { 40631 return route('ebooks.index', { 40632 category: $('.search-box-select').val(), 40633 perPage: 10 40634 }); 40635 } 40636 }); 40637 autocomplete('.mobile-search .search-box-input', { 40638 appendTo: '.mobile-search .dropdown-menu', 40639 serviceUrl: function serviceUrl() { 40640 return route('ebooks.index', { 40641 perPage: 5 40642 }); 40643 }, 40644 beforeRender: function beforeRender(container) { 40645 container.addClass('mobile-search-suggestions'); 40646 } 40647 }); 40648 $('#search-box-form').on('submit', function (e) { 40649 e.preventDefault();
40650 var searchBoxInputs = $('.search-box-input'); 40651 searchBoxInputs.each(function (i, el) { 40652 if (el.value === '') { 40653 el.removeAttribute('name'); 40654 } 40655 }); 40656 var categorySelect = $('select[name="category"]'); 40657 40658 if (categorySelect.val() === '') { 40659 categorySelect.removeAttr('name'); 40660 } 40661 40662 e.currentTarget.submit(); 40663 }); 40664 /*----------------------------------------*/ 40665 40666 /* dynamic select option width 40667 /*----------------------------------------*/ 40668 40669 $('.select').each(function () { 40670 var self = $(this); 40671 self.on('change', function () { 40672 var selectOption = self.find('option:selected').text(); 40673 var tempSelect = $('<span>').html(selectOption); 40674 tempSelect.appendTo('body'); 40675 var selectOptionWidth = tempSelect.width(); 40676 tempSelect.remove(); 40677 self.width(selectOptionWidth); 40678 }).change(); 40679 }); 40680 /*----------------------------------------*/ 40681 40682 /* button loader 40683 /*----------------------------------------*/ 40684 40685 $(document).on('click', '[data-loading]', function (e) { 40686 var button = $(e.currentTarget); 40687 40688 if (button.is('i')) { 40689 button = button.parent(); 40690 } 40691 40692 if (button.hasClass('disabled')) { 40693 return e.preventDefault(); 40694 } 40695 40696 button.data('loading-text', button.html()).addClass('btn-loading').button('loading'); 40697 }); 40698 /*----------------------------------------*/ 40699 40700 /* mega menu 40701 /*----------------------------------------*/ 40702 40703 $('.navbar-default .dropdown-toggle').append('<i class="fa fa-angle-down"></i>'); 40704 /*----------------------------------------*/ 40705 40706 /* custom input 40707 /*----------------------------------------*/ 40708 40709 function customInputField() { 40710 var checkboxInput = $('.checkbox > input'); 40711 var switchInput = $('.switch > input'); 40712 40713 function customInput(selector) { 40714 selector.on('click', function (e) { 40715 var target = $(e.currentTarget); 40716 target.toggleClass('checked'); 40717 }); 40718 } 40719 40720 customInput(checkboxInput); 40721 customInput(switchInput); 40722 } 40723 40724 customInputField(); 40725 /*----------------------------------------*/ 40726 40727 /* sidebar 40728 /*----------------------------------------*/ 40729 40730 $('.navbar-toggle').on('click', function () { 40731 $('.wrapper').toggleClass('offcanvas'); 40732 }); 40733 $(window).on('load resize', function () { 40734 if ($(window).width() >= 768) { 40735 $('.wrapper').removeClass('offcanvas'); 40736 } 40737 }); 40738 $('.sidebar-content li').each(function () { 40739 if ($(this).children('ul').length > 0) { 40740 $(this).addClass('parent'); 40741 } 40742 }); 40743 var dropdown = $('.sidebar-content li.parent > a'); 40744 dropdown.after('<i class="fa fa-angle-down pull-right" aria-hidden="true"></i>'); 40745 var sidebarContent = $('.sidebar-content > li'); 40746 sidebarContent.on('click', function () { 40747 if (!$(this).hasClass('active')) { 40748 $('.sidebar-content > li').removeClass('active'); 40749 $(this).addClass('active'); 40750 } else { 40751 $('.sidebar-content > li').removeClass('active'); 40752 } 40753 40754 if (!$(this).children('ul').hasClass('open')) { 40755 $('.sidebar-content .open').removeClass('open').slideUp(300); 40756 $(this).children('ul').addClass('open').slideDown(300); 40757 } else { 40758 $('.sidebar-content .open').removeClass('open').slideUp(300); 40759 } 40760 }); 40761 $('.sidebar-content > li > a').on('click', function (e) { 40762 e.stopPropagation(); 40763 }); 40764 $('.sidebar-content > li > ul').on('click', function (e) { 40765 e.stopPropagation(); 40766 }); 40767 var submenu = $('.submenu'); 40768 submenu.on('click', function () { 40769 if (!$(this).hasClass('active')) { 40770 $(this).addClass('active'); 40771 } else { 40772 $(this).removeClass('active'); 40773 } 40774 40775 $(this).children('ul').slideToggle(300); 40776 }); 40777 $('.submenu ul').on('click', function (e) { 40778 e.stopPropagation(); 40779 }); 40780 /*----------------------------------------*/ 40781 40782 /* dropdown open 40783 /*----------------------------------------*/ 40784 40785 $('body').on('click', '.dropdown-menu', function (e) { 40786 $(this).parent().is('.open') && e.stopPropagation(); 40787 }); 40788 /*----------------------------------------*/ 40789 40790 /* slider animation 40791 /*----------------------------------------*/ 40792 40793 $('.home-slider').on('init', function () { 40794 var firstAnimatingElements = $('div.slide:first-child').find('[data-effect]'); 40795 animateSlider(firstAnimatingElements); 40796 }); 40797 $('.home-slider').on('beforeChange', function (e, slick, currentSlide, nextSlide) { 40798 var animatingElements = $("div.slick-slide[data-slick-index=".concat(nextSlide, "]")).find('[data-effect]'); 40799 animateSlider(animatingElements); 40800 }); 40801 40802 function animateSlider(elements) { 40803 var animationEndEvents = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; 40804 elements.each(function () { 40805 var element = $(this); 40806 var animationDelay = element.data('delay'); 40807 var animationEffect = "animated ".concat(element.data('effect')); 40808 element.css({ 40809 'animation-delay': animationDelay,
40810 '-webkit-animation-delay': animationDelay 40811 }); 40812 element.addClass(animationEffect).one(animationEndEvents, function () { 40813 element.removeClass(animationEffect); 40814 }); 40815 }); 40816 } 40817 /*----------------------------------------*/ 40818 40819 /* home slider 40820 /*----------------------------------------*/ 40821 40822 40823 var homeSlider = $('.home-slider'); 40824 40825 if (homeSlider.length !== 0) { 40826 homeSlider.slick({ 40827 autoplay: !!JSON.parse(homeSlider.data('autoplay')), 40828 autoplaySpeed: parseInt(homeSlider.data('autoplay-speed')), 40829 arrows: !!JSON.parse(homeSlider.data('arrows')), 40830 fade: true, 40831 dots: false, 40832 pauseOnHover: true, 40833 pauseOnFocus: false, 40834 rtl: isRTL 40835 }); 40836 } 40837 /*----------------------------------------*/ 40838 40839 /* resize slick on active tab 40840 /*----------------------------------------*/ 40841 40842 40843 $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) { 40844 $('.ebook-slider, .tab-ebook-slider').slick('setPosition'); 40845 }); 40846 /*----------------------------------------*/ 40847 40848 /* ebook slider 40849 /*----------------------------------------*/ 40850 40851 var ebookSlider = $('.ebook-slider'); 40852 var ebookSlider2 = $('.ebook-slider-2'); 40853 ebookSlider.slick({ 40854 autoplay: false, 40855 autoplaySpeed: 10000, 40856 dots: false, 40857 arrows: true, 40858 slidesToShow: 4, 40859 slidesToScroll: 4, 40860 rtl: isRTL, 40861 responsive: [{ 40862 breakpoint: 1200, 40863 settings: { 40864 slidesToShow: 4, 40865 slidesToScroll: 4 40866 } 40867 }, { 40868 breakpoint: 992, 40869 settings: { 40870 slidesToShow: 3, 40871 slidesToScroll: 3 40872 } 40873 }, { 40874 breakpoint: 681, 40875 settings: { 40876 slidesToShow: 2, 40877 slidesToScroll: 2 40878 } 40879 }, { 40880 breakpoint: 501, 40881 settings: { 40882 slidesToShow: 1, 40883 slidesToScroll: 1 40884 } 40885 }] 40886 }); 40887 ebookSlider2.slick({ 40888 autoplay: false, 40889 autoplaySpeed: 10000, 40890 dots: false, 40891 arrows: true, 40892 slidesToShow: 3, 40893 slidesToScroll: 3, 40894 rtl: isRTL, 40895 responsive: [{ 40896 breakpoint: 681, 40897 settings: { 40898 slidesToShow: 2, 40899 slidesToScroll: 2 40900 } 40901 }, { 40902 breakpoint: 501, 40903 settings: { 40904 slidesToShow: 1, 40905 slidesToScroll: 1 40906 } 40907 }] 40908 }); 40909 /*----------------------------------------*/ 40910 40911 /* tab ebook slider 40912 /*----------------------------------------*/ 40913 40914 var tabeBookSlider = $('.tab-ebook-slider'); 40915 tabeBookSlider.slick({ 40916 autoplay: false, 40917 autoplaySpeed: 10000, 40918 dots: true, 40919 arrows: false, 40920 slidesToShow: 4, 40921 slidesToScroll: 4, 40922 rtl: isRTL, 40923 responsive: [{ 40924 breakpoint: 1200, 40925 settings: { 40926 slidesToShow: 4, 40927 slidesToScroll: 4 40928 } 40929 }, { 40930 breakpoint: 992, 40931 settings: { 40932 slidesToShow: 3, 40933 slidesToScroll: 3 40934 } 40935 }, { 40936 breakpoint: 681, 40937 settings: { 40938 slidesToShow: 2, 40939 slidesToScroll: 2 40940 } 40941 }, { 40942 breakpoint: 501, 40943 settings: { 40944 slidesToShow: 1, 40945 slidesToScroll: 1 40946 } 40947 }] 40948 }); 40949 /*----------------------------------------*/ 40950 40951 /* scroll to top 40952 /*----------------------------------------*/ 40953 40954 $(window).on('load scroll', function () { 40955 if ($(this).scrollTop() > 200) { 40956 $('.scroll-top').addClass('active'); 40957 } else { 40958 $('.scroll-top').removeClass('active'); 40959 } 40960 }); 40961 $('.scroll-top').on('click', function () { 40962 $('html, body').animate({ 40963 scrollTop: 0 40964 }, 1000, 'easeInOutQuint'); 40965 return false; 40966 }); 40967 /*----------------------------------------*/ 40968 40969 /* tooltip 40970 /*----------------------------------------*/ 40971 40972 $('[data-toggle="tooltip"]').tooltip({ 40973 trigger: 'hover' 40974 }); 40975 /*----------------------------------------*/ 40976 40977 /* selectize 40978 /*----------------------------------------*/ 40979 40980 function selectize() { 40981 var selects = $('select.selectize').removeClass('custom-select-black'); 40982 40983 var _iterator = _createForOfIteratorHelper(selects), 40984 _step; 40985 40986 try { 40987 for (_iterator.s(); !(_step = _iterator.n()).done;) { 40988 var select = _step.value; 40989 $(select).selectize({ 40990 delimiter: ',', 40991 persist: true, 40992 selectOnTab: true, 40993 hideSelected: false, 40994 allowEmptyOption: true, 40995 plugins: ['remove_button'] 40996 }); 40997 } 40998 } catch (err) { 40999 _iterator.e(err); 41000 } finally { 41001 _iterator.f(); 41002 } 41003 } 41004 41005 selectize(); 41006 /*----------------------------------------*/ 41007 41008 /* Select2 41009 /*----------------------------------------*/ 41010 41011 function createSelect2() { 41012 var $select2 = $('.select2'); 41013 $select2.select2(); 41014 } //createSelect2(); 41015 41016 /*----------------------------------------*/ 41017 41018 /* filter category 41019 /*----------------------------------------*/ 41020 41021 41022 $('.filter-category li').each(function (i, li) { 41023 if ($(li).children('ul').length > 0) { 41024 $(li).addClass('parent'); 41025 } 41026 }); 41027 var categoryDropdown = $('.filter-category li.parent > a'); 41028 categoryDropdown.before('<i class="fa fa-angle-right pull-left" aria-hidden="true"></i>'); 41029 var parentUls = $('.filter-category li.active').parentsUntil('.filter-category', 'ul'); 41030 parentUls.slideDown().addClass('open'); 41031 $('.filter-category ul.open').siblings('i').addClass('open'); 41032 $('.filter-category li i').on('click', function (e) { 41033 $(e.currentTarget).toggleClass('open').siblings('ul').slideToggle(300); 41034 }); 41035 /*----------------------------------------*/ 41036 41037 /* filter options scroll 41038 /*----------------------------------------*/ 41039 41040 $('.filter-scroll').slimScroll({ 41041 height: '215px' 41042 }); 41043 $(document).ready(function () { 41044 // ÐлееÑ: пÑÑÑем ÑÑÑÑÑ tezfiles-ÑÑÑÐ»ÐºÑ Ð²Ð½ÑÑÑи #ebook-files-preview (оÑÑаÑÑÑÑ preview-виджеÑ) 41045 $('#ebook-files-preview a[href*="tezfiles.com/file"], #ebook-files-preview a[href*="k2s.cc/file"], #ebook-files-preview a[href*="fboom.me/file"]').addClass('link-tezfiles'); // VIP-кнопка ÑкаÑки Ñже в .block-tezfiles-video-download как .link-tezfiles-download (span + data-download-url) 41046 41047 $('.btn-right-actions').on('click', function () { 41048 var ele = $(this).attr('data-target'); 41049 41050 if (ele.length) { 41051 $('body').append('<div class="right-actions-overlay"></div>'); 41052 $(ele).addClass('open'); 41053 $(".right-actions-overlay").show(); 41054 } 41055 }); 41056 $('.right-actions .action-toggle').on('click', function () { 41057 $('.right-actions').removeClass('open'); 41058 $('.right-actions-overlay').hide(); 41059 $('.right-actions-overlay').remove(); 41060 }); 41061 }); 41062 41063 if (!('ontouchstart' in window)) { 41064 var screenlistTimer; 41065 $('body').on('mouseenter', '.k2s-preview', function () { 41066 if (!$('iframe', this)[0]) { 41067 var loadThumbs = function loadThumbs(next) { 41068 var offset = thumbs.parent().position().left;
41069 var start = Math.ceil((1 - thumbs.width() - offset) / thumbs.outerWidth(true)); 41070 var end = Math.ceil((preview.width() - offset) / thumbs.outerWidth(true) + 0.5); 41071 thumbs.each(function (index) { 41072 if (index <= end) { 41073 index = (index - start + 10) % 10 + start; 41074 41075 if (next ? index + 1 == end || index == end : index <= end) { 41076 this.style.backgroundImage = ''; 41077 this.style.backgroundImage = 'url("https://static-cache.' + urlParts[0] + '/thumbnail/' + urlParts[2] + '/w320h240/' + index % 10 + '.jpeg")'; 41078 } 41079 } 41080 }); 41081 }; 41082 41083 if (!$('.screenlist', this)[0]) { 41084 $('.poster', this).after('<div class="screenlist"><div class="thumbs">' + Array(16).join('<div></div>') + '</div></div>'); 41085 } 41086 41087 var preview = $(this); 41088 var thumbs = $('.thumbs div', this); 41089 var urlParts = preview.next()[0].dataset.url.slice(8).split('/'); 41090 screenlistTimer = setTimeout(function () { 41091 loadThumbs(); 41092 screenlistTimer = setInterval(loadThumbs, 2000, true); 41093 }, 2000); 41094 loadThumbs(); 41095 } 41096 }).on('mouseleave', '.k2s-preview', function () { 41097 clearInterval(screenlistTimer); 41098 }); 41099 } 41100 41101 ; 41102}); 41103 41104/***/ }), 41105
41106/***/ "./Themes/Cynoebook/resources/assets/public/js/bootstrap.js": 41107/*!******************************************************************!*\ 41108 !*** ./Themes/Cynoebook/resources/assets/public/js/bootstrap.js ***! 41109 \******************************************************************/ 41110/*! no static exports found */ 41111/***/ (function(module, exports, __webpack_require__) { 41112 41113window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./Themes/Cynoebook/node_modules/jquery/dist/jquery.js"); 41114$.ajaxSetup({ 41115 headers: { 41116 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 41117 } 41118}); 41119 41120__webpack_require__(/*! bootstrap */ "./Themes/Cynoebook/node_modules/bootstrap/dist/js/npm.js"); 41121 41122__webpack_require__(/*! jquery.easing */ "./Themes/Cynoebook/node_modules/jquery.easing/jquery.easing.js"); 41123 41124__webpack_require__(/*! slick-carousel */ "./Themes/Cynoebook/node_modules/slick-carousel/slick/slick.js"); 41125 41126__webpack_require__(/*! slick-lightbox */ "./Themes/Cynoebook/node_modules/slick-lightbox/dist/slick-lightbox.js"); 41127 41128__webpack_require__(/*! jquery-slimscroll */ "./Themes/Cynoebook/node_modules/jquery-slimscroll/jquery.slimscroll.js"); 41129 41130__webpack_require__(/*! devbridge-autocomplete */ "./Themes/Cynoebook/node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js"); 41131 41132__webpack_require__(/*! selectize */ "./Themes/Cynoebook/node_modules/selectize/dist/js/selectize.js"); 41133 41134__webpack_require__(/*! select2 */ "./Themes/Cynoebook/node_modules/select2/dist/js/select2.js"); 41135 41136/***/ }), 41137
41138/***/ "./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue": 41139/*!****************************************************************************************!*\ 41140 !*** ./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue ***! 41141 \****************************************************************************************/ 41142/*! exports provided: default */ 41143/***/ (function(module, __webpack_exports__, __webpack_require__) { 41144 41145"use strict"; 41146__webpack_require__.r(__webpack_exports__); 41147/* harmony import */ var _k2sPlayer_vue_vue_type_template_id_6f9e2405___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./k2sPlayer.vue?vue&type=template&id=6f9e2405& */ "./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=template&id=6f9e2405&"); 41148/* harmony import */ var _k2sPlayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./k2sPlayer.vue?vue&type=script&lang=js& */ "./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=script&lang=js&"); 41149/* empty/unused harmony star reexport *//* harmony import */ var _k2sPlayer_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./k2sPlayer.vue?vue&type=style&index=0&lang=scss& */ "./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss&"); 41150/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js"); 41151 41152 41153 41154 41155 41156 41157/* normalize component */ 41158 41159var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])( 41160 _k2sPlayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"], 41161 _k2sPlayer_vue_vue_type_template_id_6f9e2405___WEBPACK_IMPORTED_MODULE_0__["render"], 41162 _k2sPlayer_vue_vue_type_template_id_6f9e2405___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"], 41163 false, 41164 null, 41165 null, 41166 null 41167 41168) 41169 41170/* hot reload */ 41171if (false) { var api; } 41172component.options.__file = "Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue" 41173/* harmony default export */ __webpack_exports__["default"] = (component.exports); 41174 41175/***/ }), 41176 41177/***/ "./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=script&lang=js&": 41178/*!*****************************************************************************************************************!*\ 41179 !*** ./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=script&lang=js& ***! 41180 \*****************************************************************************************************************/ 41181/*! exports provided: default */ 41182/***/ (function(module, __webpack_exports__, __webpack_require__) { 41183 41184"use strict"; 41185__webpack_require__.r(__webpack_exports__); 41186/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../../node_modules/babel-loader/lib??ref--4-0!../../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./k2sPlayer.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=script&lang=js&"); 41187/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]); 41188 41189/***/ }), 41190 41191/***/ "./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss&": 41192/*!**************************************************************************************************************************!*\ 41193 !*** ./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss& ***! 41194 \**************************************************************************************************************************/ 41195/*! no static exports found */ 41196/***/ (function(module, __webpack_exports__, __webpack_require__) { 41197 41198"use strict"; 41199__webpack_require__.r(__webpack_exports__); 41200/* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_node_modules_vue_loader_lib_loaders_stylePostLo
41200ader_js_node_modules_postcss_loader_src_index_js_ref_15_2_node_modules_sass_loader_lib_loader_js_ref_15_3_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../../node_modules/style-loader!../../../../../../../../node_modules/css-loader!../../../../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../../../../node_modules/postcss-loader/src??ref--15-2!../../../../../../../../node_modules/sass-loader/lib/loader.js??ref--15-3!../../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./k2sPlayer.vue?vue&type=style&index=0&lang=scss& */ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/lib/loader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss&"); 41201/* harmony import */ var _node_modules_style_loader_index_js_node_modules_css_loader_index_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_15_2_node_modules_sass_loader_lib_loader_js_ref_15_3_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_style_loader_index_js_node_modules_css_loader_index_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_15_2_node_modules_sass_loader_lib_loader_js_ref_15_3_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__); 41202/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_style_loader_index_js_node_modules_css_loader_index_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_15_2_node_modules_sass_loader_lib_loader_js_ref_15_3_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_style_loader_index_js_node_modules_css_loader_index_js_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_15_2_node_modules_sass_loader_lib_loader_js_ref_15_3_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_style_index_0_lang_scss___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); 41203 41204 41205/***/ }), 41206 41207/***/ "./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=template&id=6f9e2405&": 41208/*!***********************************************************************************************************************!*\ 41209 !*** ./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=template&id=6f9e2405& ***! 41210 \***********************************************************************************************************************/ 41211/*! exports provided: render, staticRenderFns */ 41212/***/ (function(module, __webpack_exports__, __webpack_require__) { 41213 41214"use strict"; 41215__webpack_require__.r(__webpack_exports__); 41216/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_template_id_6f9e2405___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./k2sPlayer.vue?vue&type=template&id=6f9e2405& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=template&id=6f9e2405&"); 41217/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_template_id_6f9e2405___WEBPACK_IMPORTED_MODULE_0__["render"]; }); 41218 41219/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_k2sPlayer_vue_vue_type_template_id_6f9e2405___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; }); 41220 41221 41222 41223/***/ }), 41224
41225/***/ "./Themes/Cynoebook/resources/assets/public/js/components/layout/CookieBar.js": 41226/*!************************************************************************************!*\ 41227 !*** ./Themes/Cynoebook/resources/assets/public/js/components/layout/CookieBar.js ***! 41228 \************************************************************************************/ 41229/*! exports provided: default */ 41230/***/ (function(module, __webpack_exports__, __webpack_require__) { 41231 41232"use strict"; 41233__webpack_require__.r(__webpack_exports__); 41234/* harmony default export */ __webpack_exports__["default"] = ({ 41235 data: function data() { 41236 return { 41237 show: false 41238 }; 41239 }, 41240 mounted: function mounted() { 41241 var _this = this; 41242 41243 setTimeout(function () { 41244 _this.show = true; 41245 }); 41246 }, 41247 methods: { 41248 accept: function accept() { 41249 this.show = false; 41250 $.ajax({ 41251 method: 'DELETE', 41252 url: route('cynoebook.cookie_bar.destroy') 41253 }); 41254 } 41255 } 41256}); 41257 41258/***/ }), 41259
41260/***/ "./Themes/Cynoebook/resources/assets/public/js/components/layout/NewsletterPopup.js": 41261/*!******************************************************************************************!*\ 41262 !*** ./Themes/Cynoebook/resources/assets/public/js/components/layout/NewsletterPopup.js ***! 41263 \******************************************************************************************/ 41264/*! exports provided: default */ 41265/***/ (function(module, __webpack_exports__, __webpack_require__) { 41266 41267"use strict"; 41268__webpack_require__.r(__webpack_exports__); 41269/* harmony default export */ __webpack_exports__["default"] = ({ 41270 data: function data() { 41271 return { 41272 email: '', 41273 subscribed: false, 41274 subscribing: false, 41275 error: '', 41276 disable_popup: false 41277 }; 41278 }, 41279 watch: { 41280 email: function email() { 41281 this.error = ''; 41282 }, 41283 disable_popup: function disable_popup(bool) { 41284 if (bool) { 41285 this.disableNewsletterPopup(); 41286 } else { 41287 this.enableNewsletterPopup(); 41288 } 41289 } 41290 }, 41291 mounted: function mounted() { 41292 setTimeout(function () { 41293 $('.newsletter-wrap').modal('show'); 41294 }, 1000); 41295 }, 41296 methods: { 41297 enableNewsletterPopup: function enableNewsletterPopup() { 41298 $.ajax({ 41299 method: 'POST', 41300 url: route('cynoebook.newsletter_popup.store') 41301 }); 41302 }, 41303 disableNewsletterPopup: function disableNewsletterPopup() { 41304 $.ajax({ 41305 method: 'DELETE', 41306 url: route('cynoebook.newsletter_popup.destroy') 41307 }); 41308 }, 41309 subscribe: function subscribe() { 41310 var _this = this; 41311 41312 if (!this.email || this.subscribed) { 41313 return; 41314 } 41315 41316 this.subscribing = true; 41317 $.ajax({ 41318 method: 'POST', 41319 url: route('subscribers.store'), 41320 data: { 41321 email: this.email 41322 } 41323 }).then(function () { 41324 _this.email = ''; 41325 _this.subscribed = true; 41326 })["catch"](function (response) { 41327 if (response.status === 422) { 41328 _this.error = response.responseJSON.errors.email[0]; 41329 } else { 41330 _this.error = response.responseJSON.message; 41331 } 41332 }).always(function () { 41333 _this.subscribing = false; 41334 }); 41335 } 41336 } 41337}); 41338 41339/***/ }), 41340
41341/***/ "./Themes/Cynoebook/resources/assets/public/js/components/layout/NewsletterSubscription.js": 41342/*!*************************************************************************************************!*\ 41343 !*** ./Themes/Cynoebook/resources/assets/public/js/components/layout/NewsletterSubscription.js ***! 41344 \*************************************************************************************************/ 41345/*! exports provided: default */ 41346/***/ (function(module, __webpack_exports__, __webpack_require__) { 41347 41348"use strict"; 41349__webpack_require__.r(__webpack_exports__); 41350/* harmony default export */ __webpack_exports__["default"] = ({ 41351 data: function data() { 41352 return { 41353 email: '', 41354 subscribed: false, 41355 subscribing: false, 41356 error: '' 41357 }; 41358 }, 41359 watch: { 41360 email: function email() { 41361 this.error = ''; 41362 } 41363 }, 41364 methods: { 41365 subscribe: function subscribe() { 41366 var _this = this; 41367 41368 if (!this.email || this.subscribed) { 41369 return; 41370 } 41371 41372 this.subscribing = true; 41373 $.ajax({ 41374 method: 'POST', 41375 url: route('subscribers.store'), 41376 data: { 41377 email: this.email 41378 } 41379 }).then(function () { 41380 _this.email = ''; 41381 _this.subscribed = true; 41382 })["catch"](function (response) { 41383 if (response.status === 422) { 41384 _this.error = response.responseJSON.errors.email[0]; 41385 } else { 41386 _this.error = response.responseJSON.message; 41387 } 41388 }).always(function () { 41389 _this.subscribing = false; 41390 }); 41391 } 41392 } 41393}); 41394 41395/***/ }), 41396
41397/***/ "./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue": 41398/*!******************************************************************************************!*\ 41399 !*** ./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue ***! 41400 \******************************************************************************************/ 41401/*! exports provided: default */ 41402/***/ (function(module, __webpack_exports__, __webpack_require__) { 41403 41404"use strict"; 41405__webpack_require__.r(__webpack_exports__); 41406/* harmony import */ var _tezfilesAuth_vue_vue_type_template_id_7e3feff1___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tezfilesAuth.vue?vue&type=template&id=7e3feff1& */ "./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=template&id=7e3feff1&"); 41407/* harmony import */ var _tezfilesAuth_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tezfilesAuth.vue?vue&type=script&lang=js& */ "./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=script&lang=js&"); 41408/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js"); 41409 41410 41411 41412 41413 41414/* normalize component */ 41415 41416var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])( 41417 _tezfilesAuth_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"], 41418 _tezfilesAuth_vue_vue_type_template_id_7e3feff1___WEBPACK_IMPORTED_MODULE_0__["render"], 41419 _tezfilesAuth_vue_vue_type_template_id_7e3feff1___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"], 41420 false, 41421 null, 41422 null, 41423 null 41424 41425) 41426 41427/* hot reload */ 41428if (false) { var api; } 41429component.options.__file = "Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue" 41430/* harmony default export */ __webpack_exports__["default"] = (component.exports); 41431 41432/***/ }), 41433 41434/***/ "./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=script&lang=js&": 41435/*!*******************************************************************************************************************!*\ 41436 !*** ./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=script&lang=js& ***! 41437 \*******************************************************************************************************************/ 41438/*! exports provided: default */ 41439/***/ (function(module, __webpack_exports__, __webpack_require__) { 41440 41441"use strict"; 41442__webpack_require__.r(__webpack_exports__); 41443/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_tezfilesAuth_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../../node_modules/babel-loader/lib??ref--4-0!../../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./tezfilesAuth.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=script&lang=js&"); 41444/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_tezfilesAuth_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]); 41445 41446/***/ }), 41447 41448/***/ "./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=template&id=7e3feff1&": 41449/*!*************************************************************************************************************************!*\ 41450 !*** ./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=template&id=7e3feff1& ***! 41451 \*************************************************************************************************************************/ 41452/*! exports provided: render, staticRenderFns */ 41453/***/ (function(module, __webpack_exports__, __webpack_require__) { 41454 41455"use strict"; 41456__webpack_require__.r(__webpack_exports__); 41457/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_tezfilesAuth_vue_vue_type_template_id_7e3feff1___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./tezfilesAuth.vue?vue&type=template&id=7e3feff1& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=template&id=7e3feff1&"); 41458/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_tezfilesAuth_vue_vue_type_template_id_7e3feff1___WEBPACK_IMPORTED_MODULE_0__["render"]; }); 41459 41460/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_tezfilesAuth_vue_vue_type_template_id_7e3feff1___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; }); 41461 41462 41463 41464/***/ }), 41465
41466/***/ "./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue": 41467/*!************************************************************************************************!*\ 41468 !*** ./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue ***! 41469 \************************************************************************************************/ 41470/*! exports provided: default */ 41471/***/ (function(module, __webpack_exports__, __webpack_require__) { 41472 41473"use strict"; 41474__webpack_require__.r(__webpack_exports__); 41475/* harmony import */ var _vueLightbox_vue_vue_type_template_id_01381383___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vueLightbox.vue?vue&type=template&id=01381383& */ "./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=template&id=01381383&"); 41476/* harmony import */ var _vueLightbox_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vueLightbox.vue?vue&type=script&lang=js& */ "./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=script&lang=js&"); 41477/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js"); 41478 41479 41480 41481 41482 41483/* normalize component */ 41484 41485var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])( 41486 _vueLightbox_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"], 41487 _vueLightbox_vue_vue_type_template_id_01381383___WEBPACK_IMPORTED_MODULE_0__["render"], 41488 _vueLightbox_vue_vue_type_template_id_01381383___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"], 41489 false, 41490 null, 41491 null, 41492 null 41493 41494) 41495 41496/* hot reload */ 41497if (false) { var api; } 41498component.options.__file = "Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue" 41499/* harmony default export */ __webpack_exports__["default"] = (component.exports); 41500 41501/***/ }), 41502 41503/***/ "./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=script&lang=js&": 41504/*!*************************************************************************************************************************!*\ 41505 !*** ./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=script&lang=js& ***! 41506 \*************************************************************************************************************************/ 41507/*! exports provided: default */ 41508/***/ (function(module, __webpack_exports__, __webpack_require__) { 41509 41510"use strict"; 41511__webpack_require__.r(__webpack_exports__); 41512/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_vueLightbox_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../../node_modules/babel-loader/lib??ref--4-0!../../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./vueLightbox.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=script&lang=js&"); 41513/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_vueLightbox_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]); 41514 41515/***/ }), 41516 41517/***/ "./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=template&id=01381383&": 41518/*!*******************************************************************************************************************************!*\ 41519 !*** ./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=template&id=01381383& ***! 41520 \*******************************************************************************************************************************/ 41521/*! exports provided: render, staticRenderFns */ 41522/***/ (function(module, __webpack_exports__, __webpack_require__) { 41523 41524"use strict"; 41525__webpack_require__.r(__webpack_exports__); 41526/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_vueLightbox_vue_vue_type_template_id_01381383___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./vueLightbox.vue?vue&type=template&id=01381383& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=template&id=01381383&"); 41527/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_vueLightbox_vue_vue_type_template_id_01381383___WEBPACK_IMPORTED_MODULE_0__["render"]; }); 41528 41529/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_vueLightbox_vue_vue_type_template_id_01381383___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; }); 41530 41531 41532 41533/***/ }), 41534
41535/***/ "./Themes/Cynoebook/resources/assets/public/js/functions.js": 41536/*!******************************************************************!*\ 41537 !*** ./Themes/Cynoebook/resources/assets/public/js/functions.js ***! 41538 \******************************************************************/ 41539/*! exports provided: stopButtonLoading, trans */ 41540/***/ (function(module, __webpack_exports__, __webpack_require__) { 41541 41542"use strict"; 41543__webpack_require__.r(__webpack_exports__); 41544/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stopButtonLoading", function() { return stopButtonLoading; }); 41545/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trans", function() { return trans; }); 41546function stopButtonLoading(button) { 41547 button = button instanceof jQuery ? button : $(button); 41548 button.data('loading-text', button.html()).removeClass('btn-loading').button('reset'); 41549} 41550function trans(key) { 41551 return CynoEBook.langs[key]; 41552} 41553 41554/***/ }), 41555
vendor: 361 bytes, lines 41556-41566
41556/***/ "./node_modules/axios/index.js": 41557/*!*************************************!*\ 41558 !*** ./node_modules/axios/index.js ***! 41559 \*************************************/ 41560/*! no static exports found */ 41561/***/ (function(module, exports, __webpack_require__) { 41562 41563module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js"); 41564 41565/***/ }), 41566
vendor: 5,974 bytes, lines 41567-41740
41567/***/ "./node_modules/axios/lib/adapters/xhr.js": 41568/*!************************************************!*\ 41569 !*** ./node_modules/axios/lib/adapters/xhr.js ***! 41570 \************************************************/ 41571/*! no static exports found */ 41572/***/ (function(module, exports, __webpack_require__) { 41573 41574"use strict"; 41575 41576 41577var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 41578var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js"); 41579var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js"); 41580var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js"); 41581var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js"); 41582var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js"); 41583 41584module.exports = function xhrAdapter(config) { 41585 return new Promise(function dispatchXhrRequest(resolve, reject) { 41586 var requestData = config.data; 41587 var requestHeaders = config.headers; 41588 41589 if (utils.isFormData(requestData)) { 41590 delete requestHeaders['Content-Type']; // Let the browser set it 41591 } 41592 41593 var request = new XMLHttpRequest(); 41594 41595 // HTTP basic authentication 41596 if (config.auth) { 41597 var username = config.auth.username || ''; 41598 var password = config.auth.password || ''; 41599 requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); 41600 } 41601 41602 request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); 41603 41604 // Set the request timeout in MS 41605 request.timeout = config.timeout; 41606 41607 // Listen for ready state 41608 request.onreadystatechange = function handleLoad() { 41609 if (!request || request.readyState !== 4) { 41610 return; 41611 } 41612 41613 // The request errored out and we didn't get a response, this will be 41614 // handled by onerror instead 41615 // With one exception: request that using file: protocol, most browsers 41616 // will return status as 0 even though it's a successful request 41617 if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { 41618 return; 41619 } 41620 41621 // Prepare the response 41622 var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; 41623 var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; 41624 var response = { 41625 data: responseData, 41626 status: request.status, 41627 statusText: request.statusText, 41628 headers: responseHeaders, 41629 config: config, 41630 request: request 41631 }; 41632 41633 settle(resolve, reject, response); 41634 41635 // Clean up request 41636 request = null; 41637 }; 41638 41639 // Handle low level network errors 41640 request.onerror = function handleError() { 41641 // Real errors are hidden from us by the browser 41642 // onerror should only fire if it's a network error 41643 reject(createError('Network Error', config, null, request)); 41644 41645 // Clean up request 41646 request = null; 41647 }; 41648 41649 // Handle timeout 41650 request.ontimeout = function handleTimeout() { 41651 reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED', 41652 request)); 41653 41654 // Clean up request 41655 request = null; 41656 }; 41657 41658 // Add xsrf header 41659 // This is only done if running in a standard browser environment. 41660 // Specifically not if we're in a web worker, or react-native. 41661 if (utils.isStandardBrowserEnv()) { 41662 var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js"); 41663 41664 // Add xsrf header 41665 var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ? 41666 cookies.read(config.xsrfCookieName) : 41667 undefined; 41668 41669 if (xsrfValue) { 41670 requestHeaders[config.xsrfHeaderName] = xsrfValue; 41671 } 41672 } 41673 41674 // Add headers to the request 41675 if ('setRequestHeader' in request) { 41676 utils.forEach(requestHeaders, function setRequestHeader(val, key) { 41677 if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { 41678 // Remove Content-Type if data is undefined 41679 delete requestHeaders[key]; 41680 } else { 41681 // Otherwise add header to the request 41682 request.setRequestHeader(key, val); 41683 } 41684 }); 41685 } 41686 41687 // Add withCredentials to request if needed 41688 if (config.withCredentials) { 41689 request.withCredentials = true; 41690 } 41691 41692 // Add responseType to request if needed 41693 if (config.responseType) { 41694 try { 41695 request.responseType = config.responseType; 41696 } catch (e) { 41697 // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2. 41698 // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function. 41699 if (config.responseType !== 'json') { 41700 throw e; 41701 } 41702 } 41703 } 41704 41705 // Handle progress if needed 41706 if (typeof config.onDownloadProgress === 'function') { 41707 request.addEventListener('progress', config.onDownloadProgress); 41708 } 41709 41710 // Not all browsers support upload events 41711 if (typeof config.onUploadProgress === 'function' && request.upload) { 41712 request.upload.addEventListener('progress', config.onUploadProgress); 41713 } 41714 41715 if (config.cancelToken) { 41716 // Handle cancellation 41717 config.cancelToken.promise.then(function onCanceled(cancel) { 41718 if (!request) { 41719 return; 41720 } 41721 41722 request.abort(); 41723 reject(cancel); 41724 // Clean up request 41725 request = null; 41726 }); 41727 } 41728 41729 if (requestData === undefined) { 41730 requestData = null; 41731 } 41732 41733 // Send the request 41734 request.send(requestData); 41735 }); 41736}; 41737 41738 41739/***/ }), 41740
vendor: 2,132 bytes, lines 41741-41804
41741/***/ "./node_modules/axios/lib/axios.js": 41742/*!*****************************************!*\ 41743 !*** ./node_modules/axios/lib/axios.js ***! 41744 \*****************************************/ 41745/*! no static exports found */ 41746/***/ (function(module, exports, __webpack_require__) { 41747 41748"use strict"; 41749 41750 41751var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 41752var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 41753var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js"); 41754var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js"); 41755 41756/** 41757 * Create an instance of Axios 41758 * 41759 * @param {Object} defaultConfig The default config for the instance 41760 * @return {Axios} A new instance of Axios 41761 */ 41762function createInstance(defaultConfig) { 41763 var context = new Axios(defaultConfig); 41764 var instance = bind(Axios.prototype.request, context); 41765 41766 // Copy axios.prototype to instance 41767 utils.extend(instance, Axios.prototype, context); 41768 41769 // Copy context to instance 41770 utils.extend(instance, context); 41771 41772 return instance; 41773} 41774 41775// Create the default instance to be exported 41776var axios = createInstance(defaults); 41777 41778// Expose Axios class to allow class inheritance 41779axios.Axios = Axios; 41780 41781// Factory for creating new instances 41782axios.create = function create(instanceConfig) { 41783 return createInstance(utils.merge(defaults, instanceConfig)); 41784}; 41785 41786// Expose Cancel & CancelToken 41787axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 41788axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js"); 41789axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 41790 41791// Expose all/spread 41792axios.all = function all(promises) { 41793 return Promise.all(promises); 41794}; 41795axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js"); 41796 41797module.exports = axios; 41798 41799// Allow use of default import syntax in TypeScript 41800module.exports.default = axios; 41801 41802 41803/***/ }), 41804
vendor: 702 bytes, lines 41805-41835
41805/***/ "./node_modules/axios/lib/cancel/Cancel.js": 41806/*!*************************************************!*\ 41807 !*** ./node_modules/axios/lib/cancel/Cancel.js ***! 41808 \*************************************************/ 41809/*! no static exports found */ 41810/***/ (function(module, exports, __webpack_require__) { 41811 41812"use strict"; 41813 41814 41815/** 41816 * A `Cancel` is an object that is thrown when an operation is canceled. 41817 * 41818 * @class 41819 * @param {string=} message The message. 41820 */ 41821function Cancel(message) { 41822 this.message = message; 41823} 41824 41825Cancel.prototype.toString = function toString() { 41826 return 'Cancel' + (this.message ? ': ' + this.message : ''); 41827}; 41828 41829Cancel.prototype.__CANCEL__ = true; 41830 41831module.exports = Cancel; 41832 41833 41834/***/ }), 41835
vendor: 1,638 bytes, lines 41836-41904
41836/***/ "./node_modules/axios/lib/cancel/CancelToken.js": 41837/*!******************************************************!*\ 41838 !*** ./node_modules/axios/lib/cancel/CancelToken.js ***! 41839 \******************************************************/ 41840/*! no static exports found */ 41841/***/ (function(module, exports, __webpack_require__) { 41842 41843"use strict"; 41844 41845 41846var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js"); 41847 41848/** 41849 * A `CancelToken` is an object that can be used to request cancellation of an operation. 41850 * 41851 * @class 41852 * @param {Function} executor The executor function. 41853 */ 41854function CancelToken(executor) { 41855 if (typeof executor !== 'function') { 41856 throw new TypeError('executor must be a function.'); 41857 } 41858 41859 var resolvePromise; 41860 this.promise = new Promise(function promiseExecutor(resolve) { 41861 resolvePromise = resolve; 41862 }); 41863 41864 var token = this; 41865 executor(function cancel(message) { 41866 if (token.reason) { 41867 // Cancellation has already been requested 41868 return; 41869 } 41870 41871 token.reason = new Cancel(message); 41872 resolvePromise(token.reason); 41873 }); 41874} 41875 41876/** 41877 * Throws a `Cancel` if cancellation has been requested. 41878 */ 41879CancelToken.prototype.throwIfRequested = function throwIfRequested() { 41880 if (this.reason) { 41881 throw this.reason; 41882 } 41883}; 41884 41885/** 41886 * Returns an object that contains a new `CancelToken` and a function that, when called, 41887 * cancels the `CancelToken`. 41888 */ 41889CancelToken.source = function source() { 41890 var cancel; 41891 var token = new CancelToken(function executor(c) { 41892 cancel = c; 41893 }); 41894 return { 41895 token: token, 41896 cancel: cancel 41897 }; 41898}; 41899 41900module.exports = CancelToken; 41901 41902 41903/***/ }), 41904
vendor: 427 bytes, lines 41905-41921
41905/***/ "./node_modules/axios/lib/cancel/isCancel.js": 41906/*!***************************************************!*\ 41907 !*** ./node_modules/axios/lib/cancel/isCancel.js ***! 41908 \***************************************************/ 41909/*! no static exports found */ 41910/***/ (function(module, exports, __webpack_require__) { 41911 41912"use strict"; 41913 41914 41915module.exports = function isCancel(value) { 41916 return !!(value && value.__CANCEL__); 41917}; 41918 41919 41920/***/ }), 41921
vendor: 2,740 bytes, lines 41922-42012
41922/***/ "./node_modules/axios/lib/core/Axios.js": 41923/*!**********************************************!*\ 41924 !*** ./node_modules/axios/lib/core/Axios.js ***! 41925 \**********************************************/ 41926/*! no static exports found */ 41927/***/ (function(module, exports, __webpack_require__) { 41928 41929"use strict"; 41930 41931 41932var defaults = __webpack_require__(/*! ./../defaults */ "./node_modules/axios/lib/defaults.js"); 41933var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 41934var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js"); 41935var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js"); 41936 41937/** 41938 * Create a new instance of Axios 41939 * 41940 * @param {Object} instanceConfig The default config for the instance 41941 */ 41942function Axios(instanceConfig) { 41943 this.defaults = instanceConfig; 41944 this.interceptors = { 41945 request: new InterceptorManager(), 41946 response: new InterceptorManager() 41947 }; 41948} 41949 41950/** 41951 * Dispatch a request 41952 * 41953 * @param {Object} config The config specific for this request (merged with this.defaults) 41954 */ 41955Axios.prototype.request = function request(config) { 41956 /*eslint no-param-reassign:0*/ 41957 // Allow for axios('example/url'[, config]) a la fetch API 41958 if (typeof config === 'string') { 41959 config = utils.merge({ 41960 url: arguments[0] 41961 }, arguments[1]); 41962 } 41963 41964 config = utils.merge(defaults, {method: 'get'}, this.defaults, config); 41965 config.method = config.method.toLowerCase(); 41966 41967 // Hook up interceptors middleware 41968 var chain = [dispatchRequest, undefined]; 41969 var promise = Promise.resolve(config); 41970 41971 this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { 41972 chain.unshift(interceptor.fulfilled, interceptor.rejected); 41973 }); 41974 41975 this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { 41976 chain.push(interceptor.fulfilled, interceptor.rejected); 41977 }); 41978 41979 while (chain.length) { 41980 promise = promise.then(chain.shift(), chain.shift()); 41981 } 41982 41983 return promise; 41984}; 41985 41986// Provide aliases for supported request methods 41987utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { 41988 /*eslint func-names:0*/ 41989 Axios.prototype[method] = function(url, config) { 41990 return this.request(utils.merge(config || {}, { 41991 method: method, 41992 url: url 41993 })); 41994 }; 41995}); 41996 41997utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 41998 /*eslint func-names:0*/ 41999 Axios.prototype[method] = function(url, data, config) { 42000 return this.request(utils.merge(config || {}, { 42001 method: method, 42002 url: url, 42003 data: data 42004 })); 42005 }; 42006}); 42007 42008module.exports = Axios; 42009 42010 42011/***/ }), 42012
vendor: 1,661 bytes, lines 42013-42076
42013/***/ "./node_modules/axios/lib/core/InterceptorManager.js": 42014/*!***********************************************************!*\ 42015 !*** ./node_modules/axios/lib/core/InterceptorManager.js ***! 42016 \***********************************************************/ 42017/*! no static exports found */ 42018/***/ (function(module, exports, __webpack_require__) { 42019 42020"use strict"; 42021 42022 42023var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 42024 42025function InterceptorManager() { 42026 this.handlers = []; 42027} 42028 42029/** 42030 * Add a new interceptor to the stack 42031 * 42032 * @param {Function} fulfilled The function to handle `then` for a `Promise` 42033 * @param {Function} rejected The function to handle `reject` for a `Promise` 42034 * 42035 * @return {Number} An ID used to remove interceptor later 42036 */ 42037InterceptorManager.prototype.use = function use(fulfilled, rejected) { 42038 this.handlers.push({ 42039 fulfilled: fulfilled, 42040 rejected: rejected 42041 }); 42042 return this.handlers.length - 1; 42043}; 42044 42045/** 42046 * Remove an interceptor from the stack 42047 * 42048 * @param {Number} id The ID that was returned by `use` 42049 */ 42050InterceptorManager.prototype.eject = function eject(id) { 42051 if (this.handlers[id]) { 42052 this.handlers[id] = null; 42053 } 42054}; 42055 42056/** 42057 * Iterate over all the registered interceptors 42058 * 42059 * This method is particularly useful for skipping over any 42060 * interceptors that may have become `null` calling `eject`. 42061 * 42062 * @param {Function} fn The function to call for each interceptor 42063 */ 42064InterceptorManager.prototype.forEach = function forEach(fn) { 42065 utils.forEach(this.handlers, function forEachHandler(h) { 42066 if (h !== null) { 42067 fn(h); 42068 } 42069 }); 42070}; 42071 42072module.exports = InterceptorManager; 42073 42074 42075/***/ }), 42076
vendor: 1,019 bytes, lines 42077-42106
42077/***/ "./node_modules/axios/lib/core/createError.js": 42078/*!****************************************************!*\ 42079 !*** ./node_modules/axios/lib/core/createError.js ***! 42080 \****************************************************/ 42081/*! no static exports found */ 42082/***/ (function(module, exports, __webpack_require__) { 42083 42084"use strict"; 42085 42086 42087var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js"); 42088 42089/** 42090 * Create an Error with the specified message, config, error code, request and response. 42091 * 42092 * @param {string} message The error message. 42093 * @param {Object} config The config. 42094 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 42095 * @param {Object} [request] The request. 42096 * @param {Object} [response] The response. 42097 * @returns {Error} The created error. 42098 */ 42099module.exports = function createError(message, config, code, request, response) { 42100 var error = new Error(message); 42101 return enhanceError(error, config, code, request, response); 42102}; 42103 42104 42105/***/ }), 42106
vendor: 2,918 bytes, lines 42107-42204
42107/***/ "./node_modules/axios/lib/core/dispatchRequest.js": 42108/*!********************************************************!*\ 42109 !*** ./node_modules/axios/lib/core/dispatchRequest.js ***! 42110 \********************************************************/ 42111/*! no static exports found */ 42112/***/ (function(module, exports, __webpack_require__) { 42113 42114"use strict"; 42115 42116 42117var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 42118var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js"); 42119var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js"); 42120var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js"); 42121var isAbsoluteURL = __webpack_require__(/*! ./../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js"); 42122var combineURLs = __webpack_require__(/*! ./../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js"); 42123 42124/** 42125 * Throws a `Cancel` if cancellation has been requested. 42126 */ 42127function throwIfCancellationRequested(config) { 42128 if (config.cancelToken) { 42129 config.cancelToken.throwIfRequested(); 42130 } 42131} 42132 42133/** 42134 * Dispatch a request to the server using the configured adapter. 42135 * 42136 * @param {object} config The config that is to be used for the request 42137 * @returns {Promise} The Promise to be fulfilled 42138 */ 42139module.exports = function dispatchRequest(config) { 42140 throwIfCancellationRequested(config); 42141 42142 // Support baseURL config 42143 if (config.baseURL && !isAbsoluteURL(config.url)) { 42144 config.url = combineURLs(config.baseURL, config.url); 42145 } 42146 42147 // Ensure headers exist 42148 config.headers = config.headers || {}; 42149 42150 // Transform request data 42151 config.data = transformData( 42152 config.data, 42153 config.headers, 42154 config.transformRequest 42155 ); 42156 42157 // Flatten headers 42158 config.headers = utils.merge( 42159 config.headers.common || {}, 42160 config.headers[config.method] || {}, 42161 config.headers || {} 42162 ); 42163 42164 utils.forEach( 42165 ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], 42166 function cleanHeaderConfig(method) { 42167 delete config.headers[method]; 42168 } 42169 ); 42170 42171 var adapter = config.adapter || defaults.adapter; 42172 42173 return adapter(config).then(function onAdapterResolution(response) { 42174 throwIfCancellationRequested(config); 42175 42176 // Transform response data 42177 response.data = transformData( 42178 response.data, 42179 response.headers, 42180 config.transformResponse 42181 ); 42182 42183 return response; 42184 }, function onAdapterRejection(reason) { 42185 if (!isCancel(reason)) { 42186 throwIfCancellationRequested(config); 42187 42188 // Transform response data 42189 if (reason && reason.response) { 42190 reason.response.data = transformData( 42191 reason.response.data, 42192 reason.response.headers, 42193 config.transformResponse 42194 ); 42195 } 42196 } 42197 42198 return Promise.reject(reason); 42199 }); 42200}; 42201 42202 42203/***/ }), 42204
vendor: 925 bytes, lines 42205-42237
42205/***/ "./node_modules/axios/lib/core/enhanceError.js": 42206/*!*****************************************************!*\ 42207 !*** ./node_modules/axios/lib/core/enhanceError.js ***! 42208 \*****************************************************/ 42209/*! no static exports found */ 42210/***/ (function(module, exports, __webpack_require__) { 42211 42212"use strict"; 42213 42214 42215/** 42216 * Update an Error with the specified config, error code, and response. 42217 * 42218 * @param {Error} error The error to update. 42219 * @param {Object} config The config. 42220 * @param {string} [code] The error code (for example, 'ECONNABORTED'). 42221 * @param {Object} [request] The request. 42222 * @param {Object} [response] The response. 42223 * @returns {Error} The error. 42224 */ 42225module.exports = function enhanceError(error, config, code, request, response) { 42226 error.config = config; 42227 if (code) { 42228 error.code = code; 42229 } 42230 error.request = request; 42231 error.response = response; 42232 return error; 42233}; 42234 42235 42236/***/ }), 42237
vendor: 1,130 bytes, lines 42238-42275
42238/***/ "./node_modules/axios/lib/core/settle.js": 42239/*!***********************************************!*\ 42240 !*** ./node_modules/axios/lib/core/settle.js ***! 42241 \***********************************************/ 42242/*! no static exports found */ 42243/***/ (function(module, exports, __webpack_require__) { 42244 42245"use strict"; 42246 42247 42248var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js"); 42249 42250/** 42251 * Resolve or reject a Promise based on response status. 42252 * 42253 * @param {Function} resolve A function that resolves the promise. 42254 * @param {Function} reject A function that rejects the promise. 42255 * @param {object} response The response. 42256 */ 42257module.exports = function settle(resolve, reject, response) { 42258 var validateStatus = response.config.validateStatus; 42259 // Note: status is not exposed by XDomainRequest 42260 if (!response.status || !validateStatus || validateStatus(response.status)) { 42261 resolve(response); 42262 } else { 42263 reject(createError( 42264 'Request failed with status code ' + response.status, 42265 response.config, 42266 null, 42267 response.request, 42268 response 42269 )); 42270 } 42271}; 42272 42273 42274/***/ }), 42275
vendor: 940 bytes, lines 42276-42307
42276/***/ "./node_modules/axios/lib/core/transformData.js": 42277/*!******************************************************!*\ 42278 !*** ./node_modules/axios/lib/core/transformData.js ***! 42279 \******************************************************/ 42280/*! no static exports found */ 42281/***/ (function(module, exports, __webpack_require__) { 42282 42283"use strict"; 42284 42285 42286var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 42287 42288/** 42289 * Transform the data for a request or a response 42290 * 42291 * @param {Object|String} data The data to be transformed 42292 * @param {Array} headers The headers for the request or response 42293 * @param {Array|Function} fns A single function or Array of functions 42294 * @returns {*} The resulting transformed data 42295 */ 42296module.exports = function transformData(data, headers, fns) { 42297 /*eslint no-param-reassign:0*/ 42298 utils.forEach(fns, function transform(fn) { 42299 data = fn(data, headers); 42300 }); 42301 42302 return data; 42303}; 42304 42305 42306/***/ }), 42307
vendor: 3,157 bytes, lines 42308-42416
42308/***/ "./node_modules/axios/lib/defaults.js": 42309/*!********************************************!*\ 42310 !*** ./node_modules/axios/lib/defaults.js ***! 42311 \********************************************/ 42312/*! no static exports found */ 42313/***/ (function(module, exports, __webpack_require__) { 42314 42315"use strict"; 42316/* WEBPACK VAR INJECTION */(function(process) { 42317 42318var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js"); 42319var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js"); 42320 42321var DEFAULT_CONTENT_TYPE = { 42322 'Content-Type': 'application/x-www-form-urlencoded' 42323}; 42324 42325function setContentTypeIfUnset(headers, value) { 42326 if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { 42327 headers['Content-Type'] = value; 42328 } 42329} 42330 42331function getDefaultAdapter() { 42332 var adapter; 42333 if (typeof XMLHttpRequest !== 'undefined') { 42334 // For browsers use XHR adapter 42335 adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js"); 42336 } else if (typeof process !== 'undefined') { 42337 // For node use HTTP adapter 42338 adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js"); 42339 } 42340 return adapter; 42341} 42342 42343var defaults = { 42344 adapter: getDefaultAdapter(), 42345 42346 transformRequest: [function transformRequest(data, headers) { 42347 normalizeHeaderName(headers, 'Content-Type'); 42348 if (utils.isFormData(data) || 42349 utils.isArrayBuffer(data) || 42350 utils.isBuffer(data) || 42351 utils.isStream(data) || 42352 utils.isFile(data) || 42353 utils.isBlob(data) 42354 ) { 42355 return data; 42356 } 42357 if (utils.isArrayBufferView(data)) { 42358 return data.buffer; 42359 } 42360 if (utils.isURLSearchParams(data)) { 42361 setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); 42362 return data.toString(); 42363 } 42364 if (utils.isObject(data)) { 42365 setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); 42366 return JSON.stringify(data); 42367 } 42368 return data; 42369 }], 42370 42371 transformResponse: [function transformResponse(data) { 42372 /*eslint no-param-reassign:0*/ 42373 if (typeof data === 'string') { 42374 try { 42375 data = JSON.parse(data); 42376 } catch (e) { /* Ignore */ } 42377 } 42378 return data; 42379 }], 42380 42381 /** 42382 * A timeout in milliseconds to abort a request. If set to 0 (default) a 42383 * timeout is not created. 42384 */ 42385 timeout: 0, 42386 42387 xsrfCookieName: 'XSRF-TOKEN', 42388 xsrfHeaderName: 'X-XSRF-TOKEN', 42389 42390 maxContentLength: -1, 42391 42392 validateStatus: function validateStatus(status) { 42393 return status >= 200 && status < 300; 42394 } 42395}; 42396 42397defaults.headers = { 42398 common: { 42399 'Accept': 'application/json, text/plain, */*' 42400 } 42401}; 42402 42403utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { 42404 defaults.headers[method] = {}; 42405}); 42406 42407utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { 42408 defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); 42409}); 42410 42411module.exports = defaults; 42412 42413/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"))) 42414 42415/***/ }), 42416
vendor: 569 bytes, lines 42417-42439
42417/***/ "./node_modules/axios/lib/helpers/bind.js": 42418/*!************************************************!*\ 42419 !*** ./node_modules/axios/lib/helpers/bind.js ***! 42420 \************************************************/ 42421/*! no static exports found */ 42422/***/ (function(module, exports, __webpack_require__) { 42423 42424"use strict"; 42425 42426 42427module.exports = function bind(fn, thisArg) { 42428 return function wrap() { 42429 var args = new Array(arguments.length); 42430 for (var i = 0; i < args.length; i++) { 42431 args[i] = arguments[i]; 42432 } 42433 return fn.apply(thisArg, args); 42434 }; 42435}; 42436 42437 42438/***/ }), 42439
vendor: 1,931 bytes, lines 42440-42517
42440/***/ "./node_modules/axios/lib/helpers/buildURL.js": 42441/*!****************************************************!*\ 42442 !*** ./node_modules/axios/lib/helpers/buildURL.js ***! 42443 \****************************************************/ 42444/*! no static exports found */ 42445/***/ (function(module, exports, __webpack_require__) { 42446 42447"use strict"; 42448 42449 42450var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 42451 42452function encode(val) { 42453 return encodeURIComponent(val). 42454 replace(/%40/gi, '@'). 42455 replace(/%3A/gi, ':'). 42456 replace(/%24/g, '$'). 42457 replace(/%2C/gi, ','). 42458 replace(/%20/g, '+'). 42459 replace(/%5B/gi, '['). 42460 replace(/%5D/gi, ']'); 42461} 42462 42463/** 42464 * Build a URL by appending params to the end 42465 * 42466 * @param {string} url The base of the url (e.g., http://www.google.com) 42467 * @param {object} [params] The params to be appended 42468 * @returns {string} The formatted url 42469 */ 42470module.exports = function buildURL(url, params, paramsSerializer) { 42471 /*eslint no-param-reassign:0*/ 42472 if (!params) { 42473 return url; 42474 } 42475 42476 var serializedParams; 42477 if (paramsSerializer) { 42478 serializedParams = paramsSerializer(params); 42479 } else if (utils.isURLSearchParams(params)) { 42480 serializedParams = params.toString(); 42481 } else { 42482 var parts = []; 42483 42484 utils.forEach(params, function serialize(val, key) { 42485 if (val === null || typeof val === 'undefined') { 42486 return; 42487 } 42488 42489 if (utils.isArray(val)) { 42490 key = key + '[]'; 42491 } else { 42492 val = [val]; 42493 } 42494 42495 utils.forEach(val, function parseValue(v) { 42496 if (utils.isDate(v)) { 42497 v = v.toISOString(); 42498 } else if (utils.isObject(v)) { 42499 v = JSON.stringify(v); 42500 } 42501 parts.push(encode(key) + '=' + encode(v)); 42502 }); 42503 }); 42504 42505 serializedParams = parts.join('&'); 42506 } 42507 42508 if (serializedParams) { 42509 url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; 42510 } 42511 42512 return url; 42513}; 42514 42515 42516/***/ }), 42517
vendor: 721 bytes, lines 42518-42543
42518/***/ "./node_modules/axios/lib/helpers/combineURLs.js": 42519/*!*******************************************************!*\ 42520 !*** ./node_modules/axios/lib/helpers/combineURLs.js ***! 42521 \*******************************************************/ 42522/*! no static exports found */ 42523/***/ (function(module, exports, __webpack_require__) { 42524 42525"use strict"; 42526 42527 42528/** 42529 * Creates a new URL by combining the specified URLs 42530 * 42531 * @param {string} baseURL The base URL 42532 * @param {string} relativeURL The relative URL 42533 * @returns {string} The combined URL 42534 */ 42535module.exports = function combineURLs(baseURL, relativeURL) { 42536 return relativeURL 42537 ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') 42538 : baseURL; 42539}; 42540 42541 42542/***/ }), 42543
vendor: 1,743 bytes, lines 42544-42608
42544/***/ "./node_modules/axios/lib/helpers/cookies.js": 42545/*!***************************************************!*\ 42546 !*** ./node_modules/axios/lib/helpers/cookies.js ***! 42547 \***************************************************/ 42548/*! no static exports found */ 42549/***/ (function(module, exports, __webpack_require__) { 42550 42551"use strict"; 42552 42553 42554var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 42555 42556module.exports = ( 42557 utils.isStandardBrowserEnv() ? 42558 42559 // Standard browser envs support document.cookie 42560 (function standardBrowserEnv() { 42561 return { 42562 write: function write(name, value, expires, path, domain, secure) { 42563 var cookie = []; 42564 cookie.push(name + '=' + encodeURIComponent(value)); 42565 42566 if (utils.isNumber(expires)) { 42567 cookie.push('expires=' + new Date(expires).toGMTString()); 42568 } 42569 42570 if (utils.isString(path)) { 42571 cookie.push('path=' + path); 42572 } 42573 42574 if (utils.isString(domain)) { 42575 cookie.push('domain=' + domain); 42576 } 42577 42578 if (secure === true) { 42579 cookie.push('secure'); 42580 } 42581 42582 document.cookie = cookie.join('; '); 42583 }, 42584 42585 read: function read(name) { 42586 var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); 42587 return (match ? decodeURIComponent(match[3]) : null); 42588 }, 42589 42590 remove: function remove(name) { 42591 this.write(name, '', Date.now() - 86400000); 42592 } 42593 }; 42594 })() : 42595 42596 // Non standard browser env (web workers, react-native) lack needed support. 42597 (function nonStandardBrowserEnv() { 42598 return { 42599 write: function write() {}, 42600 read: function read() { return null; }, 42601 remove: function remove() {} 42602 }; 42603 })() 42604); 42605 42606 42607/***/ }), 42608
vendor: 912 bytes, lines 42609-42634
42609/***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js": 42610/*!*********************************************************!*\ 42611 !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***! 42612 \*********************************************************/ 42613/*! no static exports found */ 42614/***/ (function(module, exports, __webpack_require__) { 42615 42616"use strict"; 42617 42618 42619/** 42620 * Determines whether the specified URL is absolute 42621 * 42622 * @param {string} url The URL to test 42623 * @returns {boolean} True if the specified URL is absolute, otherwise false 42624 */ 42625module.exports = function isAbsoluteURL(url) { 42626 // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL). 42627 // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed 42628 // by any combination of letters, digits, plus, period, or hyphen. 42629 return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); 42630}; 42631 42632 42633/***/ }), 42634
vendor: 2,655 bytes, lines 42635-42714
42635/***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js": 42636/*!***********************************************************!*\ 42637 !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***! 42638 \***********************************************************/ 42639/*! no static exports found */ 42640/***/ (function(module, exports, __webpack_require__) { 42641 42642"use strict"; 42643 42644 42645var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 42646 42647module.exports = ( 42648 utils.isStandardBrowserEnv() ? 42649 42650 // Standard browser envs have full support of the APIs needed to test 42651 // whether the request URL is of the same origin as current location. 42652 (function standardBrowserEnv() { 42653 var msie = /(msie|trident)/i.test(navigator.userAgent); 42654 var urlParsingNode = document.createElement('a'); 42655 var originURL; 42656 42657 /** 42658 * Parse a URL to discover it's components 42659 * 42660 * @param {String} url The URL to be parsed 42661 * @returns {Object} 42662 */ 42663 function resolveURL(url) { 42664 var href = url; 42665 42666 if (msie) { 42667 // IE needs attribute set twice to normalize properties 42668 urlParsingNode.setAttribute('href', href); 42669 href = urlParsingNode.href; 42670 } 42671 42672 urlParsingNode.setAttribute('href', href); 42673 42674 // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils 42675 return { 42676 href: urlParsingNode.href, 42677 protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', 42678 host: urlParsingNode.host, 42679 search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', 42680 hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', 42681 hostname: urlParsingNode.hostname, 42682 port: urlParsingNode.port, 42683 pathname: (urlParsingNode.pathname.charAt(0) === '/') ? 42684 urlParsingNode.pathname : 42685 '/' + urlParsingNode.pathname 42686 }; 42687 } 42688 42689 originURL = resolveURL(window.location.href); 42690 42691 /** 42692 * Determine if a URL shares the same origin as the current location 42693 * 42694 * @param {String} requestURL The URL to test 42695 * @returns {boolean} True if URL shares the same origin, otherwise false 42696 */ 42697 return function isURLSameOrigin(requestURL) { 42698 var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; 42699 return (parsed.protocol === originURL.protocol && 42700 parsed.host === originURL.host); 42701 }; 42702 })() : 42703 42704 // Non standard browser envs (web workers, react-native) lack needed support. 42705 (function nonStandardBrowserEnv() { 42706 return function isURLSameOrigin() { 42707 return true; 42708 }; 42709 })() 42710); 42711 42712 42713/***/ }), 42714
vendor: 783 bytes, lines 42715-42738
42715/***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js": 42716/*!***************************************************************!*\ 42717 !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***! 42718 \***************************************************************/ 42719/*! no static exports found */ 42720/***/ (function(module, exports, __webpack_require__) { 42721 42722"use strict"; 42723 42724 42725var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js"); 42726 42727module.exports = function normalizeHeaderName(headers, normalizedName) { 42728 utils.forEach(headers, function processHeader(value, name) { 42729 if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { 42730 headers[normalizedName] = value; 42731 delete headers[name]; 42732 } 42733 }); 42734}; 42735 42736 42737/***/ }), 42738
vendor: 1,791 bytes, lines 42739-42803
42739/***/ "./node_modules/axios/lib/helpers/parseHeaders.js": 42740/*!********************************************************!*\ 42741 !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***! 42742 \********************************************************/ 42743/*! no static exports found */ 42744/***/ (function(module, exports, __webpack_require__) { 42745 42746"use strict"; 42747 42748 42749var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js"); 42750 42751// Headers whose duplicates are ignored by node 42752// c.f. https://nodejs.org/api/http.html#http_message_headers 42753var ignoreDuplicateOf = [ 42754 'age', 'authorization', 'content-length', 'content-type', 'etag', 42755 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 42756 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 42757 'referer', 'retry-after', 'user-agent' 42758]; 42759 42760/** 42761 * Parse headers into an object 42762 * 42763 * ``` 42764 * Date: Wed, 27 Aug 2014 08:58:49 GMT 42765 * Content-Type: application/json 42766 * Connection: keep-alive 42767 * Transfer-Encoding: chunked 42768 * ``` 42769 * 42770 * @param {String} headers Headers needing to be parsed 42771 * @returns {Object} Headers parsed into an object 42772 */ 42773module.exports = function parseHeaders(headers) { 42774 var parsed = {}; 42775 var key; 42776 var val; 42777 var i; 42778 42779 if (!headers) { return parsed; } 42780 42781 utils.forEach(headers.split('\n'), function parser(line) { 42782 i = line.indexOf(':'); 42783 key = utils.trim(line.substr(0, i)).toLowerCase(); 42784 val = utils.trim(line.substr(i + 1)); 42785 42786 if (key) { 42787 if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { 42788 return; 42789 } 42790 if (key === 'set-cookie') { 42791 parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); 42792 } else { 42793 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; 42794 } 42795 } 42796 }); 42797 42798 return parsed; 42799}; 42800 42801 42802/***/ }), 42803
vendor: 885 bytes, lines 42804-42842
42804/***/ "./node_modules/axios/lib/helpers/spread.js": 42805/*!**************************************************!*\ 42806 !*** ./node_modules/axios/lib/helpers/spread.js ***! 42807 \**************************************************/ 42808/*! no static exports found */ 42809/***/ (function(module, exports, __webpack_require__) { 42810 42811"use strict"; 42812 42813 42814/** 42815 * Syntactic sugar for invoking a function and expanding an array for arguments. 42816 * 42817 * Common use case would be to use `Function.prototype.apply`. 42818 * 42819 * ```js 42820 * function f(x, y, z) {} 42821 * var args = [1, 2, 3]; 42822 * f.apply(null, args); 42823 * ``` 42824 * 42825 * With `spread` this example can be re-written. 42826 * 42827 * ```js 42828 * spread(function(x, y, z) {})([1, 2, 3]); 42829 * ``` 42830 * 42831 * @param {Function} callback 42832 * @returns {Function} 42833 */ 42834module.exports = function spread(callback) { 42835 return function wrap(arr) { 42836 return callback.apply(null, arr); 42837 }; 42838}; 42839 42840 42841/***/ }), 42842
vendor: 17,128 bytes, lines 42843-43382
42843/***/ "./node_modules/axios/lib/utils.js": 42844/*!*****************************************!*\ 42845 !*** ./node_modules/axios/lib/utils.js ***! 42846 \*****************************************/ 42847/*! no static exports found */ 42848/***/ (function(module, exports, __webpack_require__) { 42849 42850"use strict"; 42851 42852 42853var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js"); 42854var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js"); 42855 42856/*global toString:true*/ 42857 42858// utils is a library of generic helper functions non-specific to axios 42859 42860var toString = Object.prototype.toString; 42861 42862/** 42863 * Determine if a value is an Array 42864 * 42865 * @param {Object} val The value to test 42866 * @returns {boolean} True if value is an Array, otherwise false 42867 */ 42868function isArray(val) { 42869 return toString.call(val) === '[object Array]'; 42870} 42871 42872/** 42873 * Determine if a value is an ArrayBuffer 42874 * 42875 * @param {Object} val The value to test 42876 * @returns {boolean} True if value is an ArrayBuffer, otherwise false 42877 */ 42878function isArrayBuffer(val) { 42879 return toString.call(val) === '[object ArrayBuffer]'; 42880} 42881 42882/** 42883 * Determine if a value is a FormData 42884 * 42885 * @param {Object} val The value to test 42886 * @returns {boolean} True if value is an FormData, otherwise false 42887 */ 42888function isFormData(val) { 42889 return (typeof FormData !== 'undefined') && (val instanceof FormData); 42890} 42891 42892/** 42893 * Determine if a value is a view on an ArrayBuffer 42894 * 42895 * @param {Object} val The value to test 42896 * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false 42897 */ 42898function isArrayBufferView(val) { 42899 var result; 42900 if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { 42901 result = ArrayBuffer.isView(val); 42902 } else { 42903 result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer); 42904 } 42905 return result; 42906} 42907 42908/** 42909 * Determine if a value is a String 42910 * 42911 * @param {Object} val The value to test 42912 * @returns {boolean} True if value is a String, otherwise false 42913 */ 42914function isString(val) { 42915 return typeof val === 'string'; 42916} 42917 42918/** 42919 * Determine if a value is a Number 42920 * 42921 * @param {Object} val The value to test 42922 * @returns {boolean} True if value is a Number, otherwise false 42923 */ 42924function isNumber(val) { 42925 return typeof val === 'number'; 42926} 42927 42928/** 42929 * Determine if a value is undefined 42930 * 42931 * @param {Object} val The value to test 42932 * @returns {boolean} True if the value is undefined, otherwise false 42933 */ 42934function isUndefined(val) { 42935 return typeof val === 'undefined'; 42936} 42937 42938/** 42939 * Determine if a value is an Object 42940 * 42941 * @param {Object} val The value to test 42942 * @returns {boolean} True if value is an Object, otherwise false 42943 */ 42944function isObject(val) { 42945 return val !== null && typeof val === 'object'; 42946} 42947 42948/** 42949 * Determine if a value is a Date 42950 * 42951 * @param {Object} val The value to test 42952 * @returns {boolean} True if value is a Date, otherwise false 42953 */ 42954function isDate(val) { 42955 return toString.call(val) === '[object Date]'; 42956} 42957 42958/** 42959 * Determine if a value is a File 42960 * 42961 * @param {Object} val The value to test 42962 * @returns {boolean} True if value is a File, otherwise false 42963 */ 42964function isFile(val) { 42965 return toString.call(val) === '[object File]'; 42966} 42967 42968/** 42969 * Determine if a value is a Blob 42970 * 42971 * @param {Object} val The value to test 42972 * @returns {boolean} True if value is a Blob, otherwise false 42973 */ 42974function isBlob(val) { 42975 return toString.call(val) === '[object Blob]'; 42976} 42977 42978/** 42979 * Determine if a value is a Function 42980 * 42981 * @param {Object} val The value to test 42982 * @returns {boolean} True if value is a Function, otherwise false 42983 */ 42984function isFunction(val) { 42985 return toString.call(val) === '[object Function]'; 42986} 42987 42988/** 42989 * Determine if a value is a Stream 42990 * 42991 * @param {Object} val The value to test 42992 * @returns {boolean} True if value is a Stream, otherwise false 42993 */ 42994function isStream(val) { 42995 return isObject(val) && isFunction(val.pipe); 42996} 42997 42998/** 42999 * Determine if a value is a URLSearchParams object 43000 * 43001 * @param {Object} val The value to test 43002 * @returns {boolean} True if value is a URLSearchParams object, otherwise false 43003 */ 43004function isURLSearchParams(val) { 43005 return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams; 43006} 43007 43008/** 43009 * Trim excess whitespace off the beginning and end of a string 43010 * 43011 * @param {String} str The String to trim 43012 * @returns {String} The String freed of excess whitespace 43013 */ 43014function trim(str) { 43015 return str.replace(/^\s*/, '').replace(/\s*$/, ''); 43016} 43017 43018/** 43019 * Determine if we're running in a standard browser environment 43020 * 43021 * This allows axios to run in a web worker, and react-native. 43022 * Both environments support XMLHttpRequest, but not fully standard globals. 43023 * 43024 * web workers: 43025 * typeof window -> undefined 43026 * typeof document -> undefined 43027 * 43028 * react-native: 43029 * navigator.product -> 'ReactNative' 43030 */ 43031function isStandardBrowserEnv() { 43032 if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { 43033 return false; 43034 } 43035 return ( 43036 typeof window !== 'undefined' && 43037 typeof document !== 'undefined' 43038 ); 43039} 43040 43041/** 43042 * Iterate over an Array or an Object invoking a function for each item. 43043 * 43044 * If `obj` is an Array callback will be called passing 43045 * the value, index, and complete array for each item. 43046 * 43047 * If 'obj' is an Object callback will be called passing 43048 * the value, key, and complete object for each property. 43049 * 43050 * @param {Object|Array} obj The object to iterate 43051 * @param {Function} fn The callback to invoke for each item 43052 */ 43053function forEach(obj, fn) { 43054 // Don't bother if no value provided 43055 if (obj === null || typeof obj === 'undefined') { 43056 return; 43057 } 43058 43059 // Force an array if not already something iterable 43060 if (typeof obj !== 'object') { 43061 /*eslint no-param-reassign:0*/ 43062 obj = [obj]; 43063 } 43064 43065 if (isArray(obj)) { 43066 // Iterate over array values 43067 for (var i = 0, l = obj.length; i < l; i++) { 43068 fn.call(null, obj[i], i, obj); 43069 } 43070 } else { 43071 // Iterate over object keys 43072 for (var key in obj) { 43073 if (Object.prototype.hasOwnProperty.call(obj, key)) { 43074 fn.call(null, obj[key], key, obj); 43075 } 43076 } 43077 } 43078} 43079 43080/** 43081 * Accepts varargs expecting each argument to be an object, then 43082 * immutably merges the properties of each object and returns result. 43083 * 43084 * When multiple objects contain the same key the later object in 43085 * the arguments list will take precedence. 43086 * 43087 * Example: 43088 * 43089 * ```js 43090 * var result = merge({foo: 123}, {foo: 456}); 43091 * console.log(result.foo); // outputs 456 43092 * ``` 43093 * 43094 * @param {Object} obj1 Object to merge 43095 * @returns {Object} Result of all merge properties 43096 */ 43097function merge(/* obj1, obj2, obj3, ... */) { 43098 var result = {}; 43099 function assignValue(val, key) { 43100 if (typeof result[key] === 'object' && typeof val === 'object') { 43101 result[key] = merge(result[key], val); 43102 } else { 43103 result[key] = val; 43104 } 43105 } 43106 43107 for (var i = 0, l = arguments.length; i < l; i++) { 43108 forEach(arguments[i], assignValue); 43109 } 43110 return result; 43111} 43112 43113/** 43114 * Extends object a by mutably adding to it the properties of object b. 43115 * 43116 * @param {Object} a The object to be extended 43117 * @param {Object} b The object to copy properties from 43118 * @param {Object} thisArg The object to bind function to 43119 * @return {Object} The resulting value of object a 43120 */ 43121function extend(a, b, thisArg) { 43122 forEach(b, function assignValue(val, key) { 43123 if (thisArg && typeof val === 'function') { 43124 a[key] = bind(val, thisArg); 43125 } else { 43126 a[key] = val; 43127 } 43128 }); 43129 return a; 43130} 43131 43132module.exports = { 43133 isArray: isArray, 43134 isArrayBuffer: isArrayBuffer, 43135 isBuffer: isBuffer, 43136 isFormData: isFormData, 43137 isArrayBufferView: isArrayBufferView, 43138 isString: isString, 43139 isNumber: isNumber, 43140 isObject: isObject, 43141 isUndefined: isUndefined, 43142 isDate: isDate, 43143 isFile: isFile, 43144 isBlob: isBlob, 43145 isFunction: isFunction, 43146 isStream: isStream, 43147 isURLSearchParams: isURLSearchParams, 43148 isStandardBrowserEnv: isStandardBrowserEnv, 43149 forEach: forEach, 43150 merge: merge, 43151 extend: extend, 43152 trim: trim 43153}; 43154 43155 43156/***/ }), 43157 43158/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=script&lang=js&": 43159/*!*************************************************************************************************************************************************************************************************************!*\ 43160 !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=script&lang=js& ***! 43161 \*************************************************************************************************************************************************************************************************************/ 43162/*! exports provided: default */ 43163/***/ (function(module, __webpack_exports__, __webpack_require__) { 43164 43165"use strict"; 43166__webpack_require__.r(__webpack_exports__); 43167/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); 43168/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_0__); 43169// 43170// 43171// 43172// 43173// 43174// 43175// 43176// 43177// 43178// 43179// 43180// 43181 43182/* harmony default export */ __webpack_exports__["default"] = ({ 43183 name: "k2sPlayer", 43184 components: {}, 43185 watch: {}, 43186 ///ÐÑли Props бÑÐ´Ñ ÑеакивнÑе Ñо она Ð¸Ñ Ð¿ÐµÑезадаÑÑ ÑеÑез Data 43187 props: {}, 43188 mounted: function mounted() { 43189 this.getScreenList(); 43190 }, 43191 created: function created() {}, 43192 data: function data() { 43193 return { 43194 code: null, 43195 preloader: false, 43196 responseUser: null 43197 }; 43198 }, 43199 computed: {}, 43200 methods: { 43201 getScreenList: function getScreenList() {} 43202 } 43203}); 43204 43205/***/ }), 43206 43207/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=script&lang=js&": 43208/*!***************************************************************************************************************************************************************************************************************!*\ 43209 !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=script&lang=js& ***! 43210 \***************************************************************************************************************************************************************************************************************/ 43211/*! exports provided: default */ 43212/***/ (function(module, __webpack_exports__, __webpack_require__) { 43213 43214"use strict"; 43215__webpack_require__.r(__webpack_exports__); 43216/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! axios */ "./node_modules/axios/index.js"); 43217/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_0__); 43218// 43219// 43220// 43221// 43222// 43223// 43224// 43225// 43226// 43227// 43228// 43229// 43230// 43231// 43232// 43233// 43234 43235axios__WEBPACK_IMPORTED_MODULE_0___default.a.defaults.headers.common['Access-Control-Allow-Origin'] = '*'; 43236/* harmony default export */ __webpack_exports__["default"] = ({ 43237 name: "tezfilesAuth", 43238 props: { 43239 clientTzId: { 43240 type: String, 43241 required: true 43242 }, 43243 redirectTzUri: { 43244 type: String, 43245 required: true 43246 } 43247 }, 43248 data: function data() { 43249 return { 43250 code: null, 43251 preloader: false, 43252 responseUser: null 43253 }; 43254 }, 43255 computed: { 43256 urlLoginTezFiles: function urlLoginTezFiles() { 43257 return 'https://api.tezfiles.com/v1/auth/authorize?client_id=' + this.clientTzId + '&redirect_uri=' + this.redirectTzUri + '&response_type=code'; 43258 } 43259 }, 43260 mounted: function mounted() { 43261 var urlParams = new URLSearchParams(window.location.search); 43262 var code = urlParams.get("code"); 43263 43264 if (code) { 43265 this.code = code; 43266 this.authToken(); 43267 43268 if (window.history.replaceState) { 43269 window.history.replaceState({}, document.title, window.location.pathname); 43270 } 43271 } 43272 }, 43273 methods: { 43274 authToken: function authToken() { 43275 var _this = this; 43276 43277 var params = new URLSearchParams(); 43278 params.append('code', this.code); 43279 this.preloader = true; 43280 axios__WEBPACK_IMPORTED_MODULE_0___default.a.post('/tez-files-auth-token', params).then(function (response) { 43281 console.log("Server Response:", response.data); 43282 var data = response.data; 43283 43284 if (data && data.success) { 43285 console.log("Redirecting now..."); // ÐÐÐ ÐÐТÐÐ ÐÐÐÐÐЫРРÐÐÐÐ ÐÐТ 43286 43287 window.location.href = window.location.origin + '/account'; 43288 } else { 43289 console.error("Auth failed on server side", data); 43290 } 43291 })["catch"](function (e) { 43292 console.error("Axios Error:", e); 43293 })["finally"](function () { 43294 _this.preloader = false; 43295 }); 43296 } 43297 } 43298}); 43299 43300/***/ }), 43301 43302/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=script&lang=js&": 43303/*!*********************************************************************************************************************************************************************************************************************!*\ 43304 !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=script&lang=js& ***! 43305 \*********************************************************************************************************************************************************************************************************************/ 43306/*! exports provided: default */ 43307/***/ (function(module, __webpack_exports__, __webpack_require__) { 43308 43309"use strict"; 43310__webpack_require__.r(__webpack_exports__); 43311/* harmony import */ var vue_easy_lightbox__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-easy-lightbox */ "./node_modules/vue-easy-lightbox/dist/vue-easy-lightbox.es5.esm.min.js"); 43312// 43313// 43314// 43315// 43316 43317/* harmony default export */ __webpack_exports__["default"] = ({ 43318 name: "vueLightbox", 43319 components: { 43320 VueEasyLightbox: vue_easy_lightbox__WEBPACK_IMPORTED_MODULE_0__["default"] 43321 }, 43322 data: function data() { 43323 return { 43324 imgs: '', 43325 // Img Url , string or Array of string 43326 visible: false, 43327 index: 0 // default: 0 43328 43329 }; 43330 }, 43331 methods: { 43332 showSingle: function showSingle() { 43333 this.imgs = 'http://via.placeholder.com/350x150'; // or 43334 43335 this.imgs = { 43336 title: 'this is a placeholder', 43337 src: 'http://via.placeholder.com/350x150' 43338 }; 43339 this.show(); 43340 }, 43341 showMultiple: function showMultiple() { 43342 this.imgs = ['http://via.placeholder.com/350x150', 'http://via.placeholder.com/350x150']; // or 43343 43344 this.imgs = [{ 43345 title: 'test img', 43346 src: 'http://via.placeholder.com/350x150' 43347 }, 'http://via.placeholder.com/350x150']; // allow mixing 43348 43349 this.index = 1; // index of imgList 43350 43351 this.show(); 43352 }, 43353 show: function show() { 43354 this.visible = true; 43355 }, 43356 handleHide: function handleHide() { 43357 this.visible = false; 43358 } 43359 } 43360}); 43361 43362/***/ }), 43363 43364/***/ "./node_modules/css-loader/index.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/lib/loader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss&": 43365/*!****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ 43366 !*** ./node_modules/css-loader!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--15-2!./node_modules/sass-loader/lib/loader.js??ref--15-3!./node_modules/vue-loader/lib??vue-loader-options!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss& ***! 43367 \****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ 43368/*! no static exports found */ 43369/***/ (function(module, exports, __webpack_require__) { 43370 43371exports = module.exports = __webpack_require__(/*! ../../../../../../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false); 43372// imports 43373 43374 43375// module 43376exports.push([module.i, "", ""]); 43377 43378// exports 43379 43380 43381/***/ }), 43382
vendor: 2,555 bytes, lines 43383-43469
43383/***/ "./node_modules/css-loader/lib/css-base.js": 43384/*!*************************************************!*\ 43385 !*** ./node_modules/css-loader/lib/css-base.js ***! 43386 \*************************************************/ 43387/*! no static exports found */ 43388/***/ (function(module, exports) { 43389 43390/* 43391 MIT License http://www.opensource.org/licenses/mit-license.php 43392 Author Tobias Koppers @sokra 43393*/ 43394// css base code, injected by the css-loader 43395module.exports = function(useSourceMap) { 43396 var list = []; 43397 43398 // return the list of modules as css string 43399 list.toString = function toString() { 43400 return this.map(function (item) { 43401 var content = cssWithMappingToString(item, useSourceMap); 43402 if(item[2]) { 43403 return "@media " + item[2] + "{" + content + "}"; 43404 } else { 43405 return content; 43406 } 43407 }).join(""); 43408 }; 43409 43410 // import a list of modules into the list 43411 list.i = function(modules, mediaQuery) { 43412 if(typeof modules === "string") 43413 modules = [[null, modules, ""]]; 43414 var alreadyImportedModules = {}; 43415 for(var i = 0; i < this.length; i++) { 43416 var id = this[i][0]; 43417 if(typeof id === "number") 43418 alreadyImportedModules[id] = true; 43419 } 43420 for(i = 0; i < modules.length; i++) { 43421 var item = modules[i]; 43422 // skip already imported module 43423 // this implementation is not 100% perfect for weird media query combinations 43424 // when a module is imported multiple times with different media queries. 43425 // I hope this will never occur (Hey this way we have smaller bundles) 43426 if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { 43427 if(mediaQuery && !item[2]) { 43428 item[2] = mediaQuery; 43429 } else if(mediaQuery) { 43430 item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; 43431 } 43432 list.push(item); 43433 } 43434 } 43435 }; 43436 return list; 43437}; 43438 43439function cssWithMappingToString(item, useSourceMap) { 43440 var content = item[1] || ''; 43441 var cssMapping = item[3]; 43442 if (!cssMapping) { 43443 return content; 43444 } 43445 43446 if (useSourceMap && typeof btoa === 'function') { 43447 var sourceMapping = toComment(cssMapping); 43448 var sourceURLs = cssMapping.sources.map(function (source) { 43449 return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' 43450 }); 43451 43452 return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); 43453 } 43454 43455 return [content].join('\n'); 43456} 43457 43458// Adapted from convert-source-map (MIT) 43459function toComment(sourceMap) { 43460 // eslint-disable-next-line no-undef 43461 var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); 43462 var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; 43463 43464 return '/*# ' + data + ' */'; 43465} 43466 43467 43468/***/ }), 43469
vendor: 564 bytes, lines 43470-43491
43470/***/ "./node_modules/is-buffer/index.js": 43471/*!*****************************************!*\ 43472 !*** ./node_modules/is-buffer/index.js ***! 43473 \*****************************************/ 43474/*! no static exports found */ 43475/***/ (function(module, exports) { 43476 43477/*! 43478 * Determine if an object is a Buffer 43479 * 43480 * @author Feross Aboukhadijeh <https://feross.org> 43481 * @license MIT 43482 */ 43483 43484module.exports = function isBuffer (obj) { 43485 return obj != null && obj.constructor != null && 43486 typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) 43487} 43488 43489 43490/***/ }), 43491
vendor: 5,681 bytes, lines 43492-43686
43492/***/ "./node_modules/process/browser.js": 43493/*!*****************************************!*\ 43494 !*** ./node_modules/process/browser.js ***! 43495 \*****************************************/ 43496/*! no static exports found */ 43497/***/ (function(module, exports) { 43498 43499// shim for using process in browser 43500var process = module.exports = {}; 43501 43502// cached from whatever global is present so that test runners that stub it 43503// don't break things. But we need to wrap it in a try catch in case it is 43504// wrapped in strict mode code which doesn't define any globals. It's inside a 43505// function because try/catches deoptimize in certain engines. 43506 43507var cachedSetTimeout; 43508var cachedClearTimeout; 43509 43510function defaultSetTimout() { 43511 throw new Error('setTimeout has not been defined'); 43512} 43513function defaultClearTimeout () { 43514 throw new Error('clearTimeout has not been defined'); 43515} 43516(function () { 43517 try { 43518 if (typeof setTimeout === 'function') { 43519 cachedSetTimeout = setTimeout; 43520 } else { 43521 cachedSetTimeout = defaultSetTimout; 43522 } 43523 } catch (e) { 43524 cachedSetTimeout = defaultSetTimout; 43525 } 43526 try { 43527 if (typeof clearTimeout === 'function') { 43528 cachedClearTimeout = clearTimeout; 43529 } else { 43530 cachedClearTimeout = defaultClearTimeout; 43531 } 43532 } catch (e) { 43533 cachedClearTimeout = defaultClearTimeout; 43534 } 43535} ()) 43536function runTimeout(fun) { 43537 if (cachedSetTimeout === setTimeout) { 43538 //normal enviroments in sane situations 43539 return setTimeout(fun, 0); 43540 } 43541 // if setTimeout wasn't available but was latter defined 43542 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 43543 cachedSetTimeout = setTimeout; 43544 return setTimeout(fun, 0); 43545 } 43546 try { 43547 // when when somebody has screwed with setTimeout but no I.E. maddness 43548 return cachedSetTimeout(fun, 0); 43549 } catch(e){ 43550 try { 43551 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 43552 return cachedSetTimeout.call(null, fun, 0); 43553 } catch(e){ 43554 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 43555 return cachedSetTimeout.call(this, fun, 0); 43556 } 43557 } 43558 43559 43560} 43561function runClearTimeout(marker) { 43562 if (cachedClearTimeout === clearTimeout) { 43563 //normal enviroments in sane situations 43564 return clearTimeout(marker); 43565 } 43566 // if clearTimeout wasn't available but was latter defined 43567 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 43568 cachedClearTimeout = clearTimeout; 43569 return clearTimeout(marker); 43570 } 43571 try { 43572 // when when somebody has screwed with setTimeout but no I.E. maddness 43573 return cachedClearTimeout(marker); 43574 } catch (e){ 43575 try { 43576 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 43577 return cachedClearTimeout.call(null, marker); 43578 } catch (e){ 43579 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 43580 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 43581 return cachedClearTimeout.call(this, marker); 43582 } 43583 } 43584 43585 43586 43587} 43588var queue = []; 43589var draining = false; 43590var currentQueue; 43591var queueIndex = -1; 43592 43593function cleanUpNextTick() { 43594 if (!draining || !currentQueue) { 43595 return; 43596 } 43597 draining = false; 43598 if (currentQueue.length) { 43599 queue = currentQueue.concat(queue); 43600 } else { 43601 queueIndex = -1; 43602 } 43603 if (queue.length) { 43604 drainQueue(); 43605 } 43606} 43607 43608function drainQueue() { 43609 if (draining) { 43610 return; 43611 } 43612 var timeout = runTimeout(cleanUpNextTick); 43613 draining = true; 43614 43615 var len = queue.length; 43616 while(len) { 43617 currentQueue = queue; 43618 queue = []; 43619 while (++queueIndex < len) { 43620 if (currentQueue) { 43621 currentQueue[queueIndex].run(); 43622 } 43623 } 43624 queueIndex = -1; 43625 len = queue.length; 43626 } 43627 currentQueue = null; 43628 draining = false; 43629 runClearTimeout(timeout); 43630} 43631 43632process.nextTick = function (fun) { 43633 var args = new Array(arguments.length - 1); 43634 if (arguments.length > 1) { 43635 for (var i = 1; i < arguments.length; i++) { 43636 args[i - 1] = arguments[i]; 43637 } 43638 } 43639 queue.push(new Item(fun, args)); 43640 if (queue.length === 1 && !draining) { 43641 runTimeout(drainQueue); 43642 } 43643}; 43644 43645// v8 likes predictible objects 43646function Item(fun, array) { 43647 this.fun = fun; 43648 this.array = array; 43649} 43650Item.prototype.run = function () { 43651 this.fun.apply(null, this.array); 43652}; 43653process.title = 'browser'; 43654process.browser = true; 43655process.env = {}; 43656process.argv = []; 43657process.version = ''; // empty string to avoid regexp issues 43658process.versions = {}; 43659 43660function noop() {} 43661 43662process.on = noop; 43663process.addListener = noop; 43664process.once = noop; 43665process.off = noop; 43666process.removeListener = noop; 43667process.removeAllListeners = noop; 43668process.emit = noop; 43669process.prependListener = noop; 43670process.prependOnceListener = noop; 43671 43672process.listeners = function (name) { return [] } 43673 43674process.binding = function (name) { 43675 throw new Error('process.binding is not supported'); 43676}; 43677 43678process.cwd = function () { return '/' }; 43679process.chdir = function (dir) { 43680 throw new Error('process.chdir is not supported'); 43681}; 43682process.umask = function() { return 0; }; 43683 43684 43685/***/ }), 43686
vendor: 9,930 bytes, lines 43687-43914
43687/***/ "./node_modules/setimmediate/setImmediate.js": 43688/*!***************************************************!*\ 43689 !*** ./node_modules/setimmediate/setImmediate.js ***! 43690 \***************************************************/ 43691/*! no static exports found */ 43692/***/ (function(module, exports, __webpack_require__) { 43693 43694/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { 43695 "use strict"; 43696 43697 if (global.setImmediate) { 43698 return; 43699 } 43700 43701 var nextHandle = 1; // Spec says greater than zero 43702 var tasksByHandle = {}; 43703 var currentlyRunningATask = false; 43704 var doc = global.document; 43705 var registerImmediate; 43706 43707 function setImmediate(callback) { 43708 // Callback can either be a function or a string 43709 if (typeof callback !== "function") { 43710 callback = new Function("" + callback); 43711 } 43712 // Copy function arguments 43713 var args = new Array(arguments.length - 1); 43714 for (var i = 0; i < args.length; i++) { 43715 args[i] = arguments[i + 1]; 43716 } 43717 // Store and register the task 43718 var task = { callback: callback, args: args }; 43719 tasksByHandle[nextHandle] = task; 43720 registerImmediate(nextHandle); 43721 return nextHandle++; 43722 } 43723 43724 function clearImmediate(handle) { 43725 delete tasksByHandle[handle]; 43726 } 43727 43728 function run(task) { 43729 var callback = task.callback; 43730 var args = task.args; 43731 switch (args.length) { 43732 case 0: 43733 callback(); 43734 break; 43735 case 1: 43736 callback(args[0]); 43737 break; 43738 case 2: 43739 callback(args[0], args[1]); 43740 break; 43741 case 3: 43742 callback(args[0], args[1], args[2]); 43743 break; 43744 default: 43745 callback.apply(undefined, args); 43746 break; 43747 } 43748 } 43749 43750 function runIfPresent(handle) { 43751 // From the spec: "Wait until any invocations of this algorithm started before this one have completed." 43752 // So if we're currently running a task, we'll need to delay this invocation. 43753 if (currentlyRunningATask) { 43754 // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a 43755 // "too much recursion" error. 43756 setTimeout(runIfPresent, 0, handle); 43757 } else { 43758 var task = tasksByHandle[handle]; 43759 if (task) { 43760 currentlyRunningATask = true; 43761 try { 43762 run(task); 43763 } finally { 43764 clearImmediate(handle); 43765 currentlyRunningATask = false; 43766 } 43767 } 43768 } 43769 } 43770 43771 function installNextTickImplementation() { 43772 registerImmediate = function(handle) { 43773 process.nextTick(function () { runIfPresent(handle); }); 43774 }; 43775 } 43776 43777 function canUsePostMessage() { 43778 // The test against `importScripts` prevents this implementation from being installed inside a web worker, 43779 // where `global.postMessage` means something completely different and can't be used for this purpose. 43780 if (global.postMessage && !global.importScripts) { 43781 var postMessageIsAsynchronous = true; 43782 var oldOnMessage = global.onmessage; 43783 global.onmessage = function() { 43784 postMessageIsAsynchronous = false; 43785 }; 43786 global.postMessage("", "*"); 43787 global.onmessage = oldOnMessage; 43788 return postMessageIsAsynchronous; 43789 } 43790 } 43791 43792 function installPostMessageImplementation() { 43793 // Installs an event handler on `global` for the `message` event: see 43794 // * https://developer.mozilla.org/en/DOM/window.postMessage 43795 // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages 43796 43797 var messagePrefix = "setImmediate$" + Math.random() + "$"; 43798 var onGlobalMessage = function(event) { 43799 if (event.source === global && 43800 typeof event.data === "string" && 43801 event.data.indexOf(messagePrefix) === 0) { 43802 runIfPresent(+event.data.slice(messagePrefix.length)); 43803 } 43804 }; 43805 43806 if (global.addEventListener) { 43807 global.addEventListener("message", onGlobalMessage, false); 43808 } else { 43809 global.attachEvent("onmessage", onGlobalMessage); 43810 } 43811 43812 registerImmediate = function(handle) { 43813 global.postMessage(messagePrefix + handle, "*"); 43814 }; 43815 } 43816 43817 function installMessageChannelImplementation() { 43818 var channel = new MessageChannel(); 43819 channel.port1.onmessage = function(event) { 43820 var handle = event.data; 43821 runIfPresent(handle); 43822 }; 43823 43824 registerImmediate = function(handle) { 43825 channel.port2.postMessage(handle); 43826 }; 43827 } 43828 43829 function installReadyStateChangeImplementation() { 43830 var html = doc.documentElement; 43831 registerImmediate = function(handle) { 43832 // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted 43833 // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. 43834 var script = doc.createElement("script"); 43835 script.onreadystatechange = function () { 43836 runIfPresent(handle); 43837 script.onreadystatechange = null; 43838 html.removeChild(script); 43839 script = null; 43840 }; 43841 html.appendChild(script); 43842 }; 43843 } 43844 43845 function installSetTimeoutImplementation() { 43846 registerImmediate = function(handle) { 43847 setTimeout(runIfPresent, 0, handle); 43848 }; 43849 } 43850 43851 // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. 43852 var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); 43853 attachTo = attachTo && attachTo.setTimeout ? attachTo : global; 43854 43855 // Don't get fooled by e.g. browserify environments. 43856 if ({}.toString.call(global.process) === "[object process]") { 43857 // For Node.js before 0.9 43858 installNextTickImplementation(); 43859 43860 } else if (canUsePostMessage()) { 43861 // For non-IE10 modern browsers 43862 installPostMessageImplementation(); 43863 43864 } else if (global.MessageChannel) { 43865 // For web workers, where supported 43866 installMessageChannelImplementation(); 43867 43868 } else if (doc && "onreadystatechange" in doc.createElement("script")) { 43869 // For IE 6â8 43870 installReadyStateChangeImplementation(); 43871 43872 } else { 43873 // For older browsers 43874 installSetTimeoutImplementation(); 43875 } 43876 43877 attachTo.setImmediate = setImmediate; 43878 attachTo.clearImmediate = clearImmediate; 43879}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self)); 43880 43881/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js"))) 43882 43883/***/ }), 43884 43885/***/ "./node_modules/style-loader/index.js!./node_modules/css-loader/index.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/lib/loader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss&": 43886/*!********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\ 43887 !*** ./node_modules/style-loader!./node_modules/css-loader!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--15-2!./node_modules/sass-loader/lib/loader.js??ref--15-3!./node_modules/vue-loader/lib??vue-loader-options!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss& ***! 43888 \********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/ 43889/*! no static exports found */ 43890/***/ (function(module, exports, __webpack_require__) { 43891 43892 43893var content = __webpack_require__(/*! !../../../../../../../../node_modules/css-loader!../../../../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../../../../node_modules/postcss-loader/src??ref--15-2!../../../../../../../../node_modules/sass-loader/lib/loader.js??ref--15-3!../../../../../../../../node_modules/vue-loader/lib??vue-loader-options!./k2sPlayer.vue?vue&type=style&index=0&lang=scss& */ "./node_modules/css-loader/index.js!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/lib/loader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=style&index=0&lang=scss&"); 43894 43895if(typeof content === 'string') content = [[module.i, content, '']]; 43896 43897var transform; 43898var insertInto; 43899 43900 43901 43902var options = {"hmr":true} 43903 43904options.transform = transform 43905options.insertInto = undefined; 43906 43907var update = __webpack_require__(/*! ../../../../../../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options); 43908 43909if(content.locals) module.exports = content.locals; 43910 43911if(false) {} 43912 43913/***/ }), 43914
vendor: 10,739 bytes, lines 43915-44323
43915/***/ "./node_modules/style-loader/lib/addStyles.js": 43916/*!****************************************************!*\ 43917 !*** ./node_modules/style-loader/lib/addStyles.js ***! 43918 \****************************************************/ 43919/*! no static exports found */ 43920/***/ (function(module, exports, __webpack_require__) { 43921 43922/* 43923 MIT License http://www.opensource.org/licenses/mit-license.php 43924 Author Tobias Koppers @sokra 43925*/ 43926 43927var stylesInDom = {}; 43928 43929var memoize = function (fn) { 43930 var memo; 43931 43932 return function () { 43933 if (typeof memo === "undefined") memo = fn.apply(this, arguments); 43934 return memo; 43935 }; 43936}; 43937 43938var isOldIE = memoize(function () { 43939 // Test for IE <= 9 as proposed by Browserhacks 43940 // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805 43941 // Tests for existence of standard globals is to allow style-loader 43942 // to operate correctly into non-standard environments 43943 // @see https://github.com/webpack-contrib/style-loader/issues/177 43944 return window && document && document.all && !window.atob; 43945}); 43946 43947var getTarget = function (target, parent) { 43948 if (parent){ 43949 return parent.querySelector(target); 43950 } 43951 return document.querySelector(target); 43952}; 43953 43954var getElement = (function (fn) { 43955 var memo = {}; 43956 43957 return function(target, parent) { 43958 // If passing function in options, then use it for resolve "head" element. 43959 // Useful for Shadow Root style i.e 43960 // { 43961 // insertInto: function () { return document.querySelector("#foo").shadowRoot } 43962 // } 43963 if (typeof target === 'function') { 43964 return target(); 43965 } 43966 if (typeof memo[target] === "undefined") { 43967 var styleTarget = getTarget.call(this, target, parent); 43968 // Special case to return head of iframe instead of iframe itself 43969 if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) { 43970 try { 43971 // This will throw an exception if access to iframe is blocked 43972 // due to cross-origin restrictions 43973 styleTarget = styleTarget.contentDocument.head; 43974 } catch(e) { 43975 styleTarget = null; 43976 } 43977 } 43978 memo[target] = styleTarget; 43979 } 43980 return memo[target] 43981 }; 43982})(); 43983 43984var singleton = null; 43985var singletonCounter = 0; 43986var stylesInsertedAtTop = []; 43987 43988var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js"); 43989 43990module.exports = function(list, options) { 43991 if (typeof DEBUG !== "undefined" && DEBUG) { 43992 if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); 43993 } 43994 43995 options = options || {}; 43996 43997 options.attrs = typeof options.attrs === "object" ? options.attrs : {}; 43998 43999 // Force single-tag solution on IE6-9, which has a hard limit on the # of <style> 44000 // tags it will allow on a page 44001 if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE(); 44002 44003 // By default, add <style> tags to the <head> element 44004 if (!options.insertInto) options.insertInto = "head"; 44005 44006 // By default, add <style> tags to the bottom of the target 44007 if (!options.insertAt) options.insertAt = "bottom"; 44008 44009 var styles = listToStyles(list, options); 44010 44011 addStylesToDom(styles, options); 44012 44013 return function update (newList) { 44014 var mayRemove = []; 44015 44016 for (var i = 0; i < styles.length; i++) { 44017 var item = styles[i]; 44018 var domStyle = stylesInDom[item.id]; 44019 44020 domStyle.refs--; 44021 mayRemove.push(domStyle); 44022 } 44023 44024 if(newList) { 44025 var newStyles = listToStyles(newList, options); 44026 addStylesToDom(newStyles, options); 44027 } 44028 44029 for (var i = 0; i < mayRemove.length; i++) { 44030 var domStyle = mayRemove[i]; 44031 44032 if(domStyle.refs === 0) { 44033 for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j](); 44034 44035 delete stylesInDom[domStyle.id]; 44036 } 44037 } 44038 }; 44039}; 44040 44041function addStylesToDom (styles, options) { 44042 for (var i = 0; i < styles.length; i++) { 44043 var item = styles[i]; 44044 var domStyle = stylesInDom[item.id]; 44045 44046 if(domStyle) { 44047 domStyle.refs++; 44048 44049 for(var j = 0; j < domStyle.parts.length; j++) { 44050 domStyle.parts[j](item.parts[j]); 44051 } 44052 44053 for(; j < item.parts.length; j++) { 44054 domStyle.parts.push(addStyle(item.parts[j], options)); 44055 } 44056 } else { 44057 var parts = []; 44058 44059 for(var j = 0; j < item.parts.length; j++) { 44060 parts.push(addStyle(item.parts[j], options)); 44061 } 44062 44063 stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; 44064 } 44065 } 44066} 44067 44068function listToStyles (list, options) { 44069 var styles = []; 44070 var newStyles = {}; 44071 44072 for (var i = 0; i < list.length; i++) { 44073 var item = list[i]; 44074 var id = options.base ? item[0] + options.base : item[0]; 44075 var css = item[1]; 44076 var media = item[2]; 44077 var sourceMap = item[3]; 44078 var part = {css: css, media: media, sourceMap: sourceMap}; 44079 44080 if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]}); 44081 else newStyles[id].parts.push(part); 44082 } 44083 44084 return styles; 44085} 44086 44087function insertStyleElement (options, style) { 44088 var target = getElement(options.insertInto) 44089 44090 if (!target) { 44091 throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); 44092 } 44093 44094 var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1]; 44095 44096 if (options.insertAt === "top") { 44097 if (!lastStyleElementInsertedAtTop) { 44098 target.insertBefore(style, target.firstChild); 44099 } else if (lastStyleElementInsertedAtTop.nextSibling) { 44100 target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling); 44101 } else { 44102 target.appendChild(style); 44103 } 44104 stylesInsertedAtTop.push(style); 44105 } else if (options.insertAt === "bottom") { 44106 target.appendChild(style); 44107 } else if (typeof options.insertAt === "object" && options.insertAt.before) { 44108 var nextSibling = getElement(options.insertAt.before, target); 44109 target.insertBefore(style, nextSibling); 44110 } else { 44111 throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); 44112 } 44113} 44114 44115function removeStyleElement (style) { 44116 if (style.parentNode === null) return false; 44117 style.parentNode.removeChild(style); 44118 44119 var idx = stylesInsertedAtTop.indexOf(style); 44120 if(idx >= 0) { 44121 stylesInsertedAtTop.splice(idx, 1); 44122 } 44123} 44124 44125function createStyleElement (options) { 44126 var style = document.createElement("style"); 44127 44128 if(options.attrs.type === undefined) { 44129 options.attrs.type = "text/css"; 44130 } 44131 44132 if(options.attrs.nonce === undefined) { 44133 var nonce = getNonce(); 44134 if (nonce) { 44135 options.attrs.nonce = nonce; 44136 } 44137 } 44138 44139 addAttrs(style, options.attrs); 44140 insertStyleElement(options, style); 44141 44142 return style; 44143} 44144 44145function createLinkElement (options) { 44146 var link = document.createElement("link"); 44147 44148 if(options.attrs.type === undefined) { 44149 options.attrs.type = "text/css"; 44150 } 44151 options.attrs.rel = "stylesheet"; 44152 44153 addAttrs(link, options.attrs); 44154 insertStyleElement(options, link); 44155 44156 return link; 44157} 44158 44159function addAttrs (el, attrs) { 44160 Object.keys(attrs).forEach(function (key) { 44161 el.setAttribute(key, attrs[key]); 44162 }); 44163} 44164 44165function getNonce() { 44166 if (false) {} 44167 44168 return __webpack_require__.nc; 44169} 44170 44171function addStyle (obj, options) { 44172 var style, update, remove, result; 44173 44174 // If a transform function was defined, run it on the css 44175 if (options.transform && obj.css) { 44176 result = typeof options.transform === 'function' 44177 ? options.transform(obj.css) 44178 : options.transform.default(obj.css); 44179 44180 if (result) { 44181 // If transform returns a value, use that instead of the original css. 44182 // This allows running runtime transformations on the css. 44183 obj.css = result; 44184 } else { 44185 // If the transform function returns a falsy value, don't add this css. 44186 // This allows conditional loading of css 44187 return function() { 44188 // noop 44189 }; 44190 } 44191 } 44192 44193 if (options.singleton) { 44194 var styleIndex = singletonCounter++; 44195 44196 style = singleton || (singleton = createStyleElement(options)); 44197 44198 update = applyToSingletonTag.bind(null, style, styleIndex, false); 44199 remove = applyToSingletonTag.bind(null, style, styleIndex, true); 44200 44201 } else if ( 44202 obj.sourceMap && 44203 typeof URL === "function" && 44204 typeof URL.createObjectURL === "function" && 44205 typeof URL.revokeObjectURL === "function" && 44206 typeof Blob === "function" && 44207 typeof btoa === "function" 44208 ) { 44209 style = createLinkElement(options); 44210 update = updateLink.bind(null, style, options); 44211 remove = function () { 44212 removeStyleElement(style); 44213 44214 if(style.href) URL.revokeObjectURL(style.href); 44215 }; 44216 } else { 44217 style = createStyleElement(options); 44218 update = applyToTag.bind(null, style); 44219 remove = function () { 44220 removeStyleElement(style); 44221 }; 44222 } 44223 44224 update(obj); 44225 44226 return function updateStyle (newObj) { 44227 if (newObj) { 44228 if ( 44229 newObj.css === obj.css && 44230 newObj.media === obj.media && 44231 newObj.sourceMap === obj.sourceMap 44232 ) { 44233 return; 44234 } 44235 44236 update(obj = newObj); 44237 } else { 44238 remove(); 44239 } 44240 }; 44241} 44242 44243var replaceText = (function () { 44244 var textStore = []; 44245 44246 return function (index, replacement) { 44247 textStore[index] = replacement; 44248 44249 return textStore.filter(Boolean).join('\n'); 44250 }; 44251})(); 44252 44253function applyToSingletonTag (style, index, remove, obj) { 44254 var css = remove ? "" : obj.css; 44255 44256 if (style.styleSheet) { 44257 style.styleSheet.cssText = replaceText(index, css); 44258 } else { 44259 var cssNode = document.createTextNode(css); 44260 var childNodes = style.childNodes; 44261 44262 if (childNodes[index]) style.removeChild(childNodes[index]); 44263 44264 if (childNodes.length) { 44265 style.insertBefore(cssNode, childNodes[index]); 44266 } else { 44267 style.appendChild(cssNode); 44268 } 44269 } 44270} 44271 44272function applyToTag (style, obj) { 44273 var css = obj.css; 44274 var media = obj.media; 44275 44276 if(media) { 44277 style.setAttribute("media", media) 44278 } 44279 44280 if(style.styleSheet) { 44281 style.styleSheet.cssText = css; 44282 } else { 44283 while(style.firstChild) { 44284 style.removeChild(style.firstChild); 44285 } 44286 44287 style.appendChild(document.createTextNode(css)); 44288 } 44289} 44290 44291function updateLink (link, options, obj) { 44292 var css = obj.css; 44293 var sourceMap = obj.sourceMap; 44294 44295 /* 44296 If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled 44297 and there is no publicPath defined then lets turn convertToAbsoluteUrls 44298 on by default. Otherwise default to the convertToAbsoluteUrls option 44299 directly 44300 */ 44301 var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap; 44302 44303 if (options.convertToAbsoluteUrls || autoFixUrls) { 44304 css = fixUrls(css); 44305 } 44306 44307 if (sourceMap) { 44308 // http://stackoverflow.com/a/26603875 44309 css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; 44310 } 44311 44312 var blob = new Blob([css], { type: "text/css" }); 44313 44314 var oldSrc = link.href; 44315 44316 link.href = URL.createObjectURL(blob); 44317 44318 if(oldSrc) URL.revokeObjectURL(oldSrc); 44319} 44320 44321 44322/***/ }), 44323
vendor: 3,300 bytes, lines 44324-44423
44324/***/ "./node_modules/style-loader/lib/urls.js": 44325/*!***********************************************!*\ 44326 !*** ./node_modules/style-loader/lib/urls.js ***! 44327 \***********************************************/ 44328/*! no static exports found */ 44329/***/ (function(module, exports) { 44330 44331 44332/** 44333 * When source maps are enabled, `style-loader` uses a link element with a data-uri to 44334 * embed the css on the page. This breaks all relative urls because now they are relative to a 44335 * bundle instead of the current page. 44336 * 44337 * One solution is to only use full urls, but that may be impossible. 44338 * 44339 * Instead, this function "fixes" the relative urls to be absolute according to the current page location. 44340 * 44341 * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. 44342 * 44343 */ 44344 44345module.exports = function (css) { 44346 // get current location 44347 var location = typeof window !== "undefined" && window.location; 44348 44349 if (!location) { 44350 throw new Error("fixUrls requires window.location"); 44351 } 44352 44353 // blank or null? 44354 if (!css || typeof css !== "string") { 44355 return css; 44356 } 44357 44358 var baseUrl = location.protocol + "//" + location.host; 44359 var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); 44360 44361 // convert each url(...) 44362 /* 44363 This regular expression is just a way to recursively match brackets within 44364 a string. 44365 44366 /url\s*\( = Match on the word "url" with any whitespace after it and then a parens 44367 ( = Start a capturing group 44368 (?: = Start a non-capturing group 44369 [^)(] = Match anything that isn't a parentheses 44370 | = OR 44371 \( = Match a start parentheses 44372 (?: = Start another non-capturing groups 44373 [^)(]+ = Match anything that isn't a parentheses 44374 | = OR 44375 \( = Match a start parentheses 44376 [^)(]* = Match anything that isn't a parentheses 44377 \) = Match a end parentheses 44378 ) = End Group 44379 *\) = Match anything and then a close parens 44380 ) = Close non-capturing group 44381 * = Match anything 44382 ) = Close capturing group 44383 \) = Match a close parens 44384 44385 /gi = Get all matches, not the first. Be case insensitive. 44386 */ 44387 var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { 44388 // strip quotes (if they exist) 44389 var unquotedOrigUrl = origUrl 44390 .trim() 44391 .replace(/^"(.*)"$/, function(o, $1){ return $1; }) 44392 .replace(/^'(.*)'$/, function(o, $1){ return $1; }); 44393 44394 // already a full url? no change 44395 if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) { 44396 return fullMatch; 44397 } 44398 44399 // convert the url to a full url 44400 var newUrl; 44401 44402 if (unquotedOrigUrl.indexOf("//") === 0) { 44403 //TODO: should we add protocol? 44404 newUrl = unquotedOrigUrl; 44405 } else if (unquotedOrigUrl.indexOf("/") === 0) { 44406 // path should be relative to the base url 44407 newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' 44408 } else { 44409 // path should be relative to current directory 44410 newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' 44411 } 44412 44413 // send back the fixed url(...) 44414 return "url(" + JSON.stringify(newUrl) + ")"; 44415 }); 44416 44417 // send back the fixed css 44418 return fixedCss; 44419}; 44420 44421 44422/***/ }), 44423
vendor: 2,587 bytes, lines 44424-44498
44424/***/ "./node_modules/timers-browserify/main.js": 44425/*!************************************************!*\ 44426 !*** ./node_modules/timers-browserify/main.js ***! 44427 \************************************************/ 44428/*! no static exports found */ 44429/***/ (function(module, exports, __webpack_require__) { 44430 44431/* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) || 44432 (typeof self !== "undefined" && self) || 44433 window; 44434var apply = Function.prototype.apply; 44435 44436// DOM APIs, for completeness 44437 44438exports.setTimeout = function() { 44439 return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout); 44440}; 44441exports.setInterval = function() { 44442 return new Timeout(apply.call(setInterval, scope, arguments), clearInterval); 44443}; 44444exports.clearTimeout = 44445exports.clearInterval = function(timeout) { 44446 if (timeout) { 44447 timeout.close(); 44448 } 44449}; 44450 44451function Timeout(id, clearFn) { 44452 this._id = id; 44453 this._clearFn = clearFn; 44454} 44455Timeout.prototype.unref = Timeout.prototype.ref = function() {}; 44456Timeout.prototype.close = function() { 44457 this._clearFn.call(scope, this._id); 44458}; 44459 44460// Does not start the time, just sets up the members needed. 44461exports.enroll = function(item, msecs) { 44462 clearTimeout(item._idleTimeoutId); 44463 item._idleTimeout = msecs; 44464}; 44465 44466exports.unenroll = function(item) { 44467 clearTimeout(item._idleTimeoutId); 44468 item._idleTimeout = -1; 44469}; 44470 44471exports._unrefActive = exports.active = function(item) { 44472 clearTimeout(item._idleTimeoutId); 44473 44474 var msecs = item._idleTimeout; 44475 if (msecs >= 0) { 44476 item._idleTimeoutId = setTimeout(function onTimeout() { 44477 if (item._onTimeout) 44478 item._onTimeout(); 44479 }, msecs); 44480 } 44481}; 44482 44483// setimmediate attaches itself to the global object 44484__webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js"); 44485// On some exotic environments, it's not clear which object `setimmediate` was 44486// able to install onto. Search each possibility in the same order as the 44487// `setimmediate` library. 44488exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) || 44489 (typeof global !== "undefined" && global.setImmediate) || 44490 (this && this.setImmediate); 44491exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) || 44492 (typeof global !== "undefined" && global.clearImmediate) || 44493 (this && this.clearImmediate); 44494 44495/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) 44496 44497/***/ }), 44498
vendor: 64,095 bytes, lines 44499-44617
44499/***/ "./node_modules/vue-easy-lightbox/dist/vue-easy-lightbox.es5.esm.min.js": 44500/*!******************************************************************************!*\ 44501 !*** ./node_modules/vue-easy-lightbox/dist/vue-easy-lightbox.es5.esm.min.js ***! 44502 \******************************************************************************/ 44503/*! exports provided: default */ 44504/***/ (function(module, __webpack_exports__, __webpack_require__) { 44505 44506"use strict"; 44507__webpack_require__.r(__webpack_exports__); 44508/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js"); 44509/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__); 44510var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t,e){return t(e={exports:{}},e.exports),e.exports}var r=function(t){return t&&t.Math==Math&&t},o=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof e&&e)||function(){return this}()||Function("return this")(),i=function(t){try{return!!t()}catch(t){return!0}},a=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s={}.propertyIsEnumerable,c=Object.getOwnPropertyDescriptor,l={f:c&&!s.call({1:2},1)?function(t){var e=c(this,t);return!!e&&e.enumerable}:s},u=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},f={}.toString,d=function(t){return f.call(t).slice(8,-1)},p="".split,v=i((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==d(t)?p.call(t,""):Object(t)}:Object,h=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},g=function(t){return v(h(t))},m=function(t){return"object"==typeof t?null!==t:"function"==typeof t},y=function(t,e){if(!m(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!m(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!m(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!m(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},b={}.hasOwnProperty,_=function(t,e){return b.call(t,e)},w=o.document,x=m(w)&&m(w.createElement),S=function(t){return x?w.createElement(t):{}},O=!a&&!i((function(){return 7!=Object.defineProperty(S("div"),"a",{get:function(){return 7}}).a})),k=Object.getOwnPropertyDescriptor,I={f:a?k:function(t,e){if(t=g(t),e=y(e,!0),O)try{return k(t,e)}catch(t){}if(_(t,e))return u(!l.f.call(t,e),t[e])}},E=function(t){if(!m(t))throw TypeError(String(t)+" is not an object");return t},C=Object.defineProperty,z={f:a?C:function(t,e,n){if(E(t),e=y(e,!0),E(n),O)try{return C(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},T=a?function(t,e,n){return z.f(t,e,u(1,n))}:function(t,e,n){return t[e]=n,t},j=function(t,e){try{T(o,t,e)}catch(n){o[t]=e}return e},L=o["__core-js_shared__"]||j("__core-js_shared__",{}),A=Function.toString;"function"!=typeof L.inspectSource&&(L.inspectSource=function(t){return A.call(t)});var R,M,P,D=L.inspectSource,N=o.WeakMap,F="function"==typeof N&&/native code/.test(D(N)),B=n((function(t){(t.exports=function(t,e){return L[t]||(L[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.10.1",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),$=0,G=Math.random(),V=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++$+G).toString(36)},Y=B("keys"),X=function(t){return Y[t]||(Y[t]=V(t))},U={},H=o.WeakMap;if(F){var W=L.state||(L.state=new H),K=W.get,q=W.has,Q=W.set;R=function(t,e){return e.facade=t,Q.call(W,t,e),e},M=function(t){return K.call(W,t)||{}},P=function(t){return q.call(W,t)}}else{var J=X("state");U[J]=!0,R=function(t,e){return e.facade=t,T(t,J,e),e},M=function(t){return _(t,J)?t[J]:{}},P=function(t){return _(t,J)}}var Z,tt,et={set:R,get:M,has:P,enforce:function(t){return P(t)?M(t):R(t,{})},getterFor:function(t){return function(e){var n;if(!m(e)||(n=M(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},nt=n((function(t){var e=et.get,n=et.enforce,r=String(String).split("String");(t.exports=function(t,e,i,a){var s,c=!!a&&!!a.unsafe,l=!!a&&!!a.enumerable,u=!!a&&!!a.noTargetGet;"function"==typeof i&&("string"!=typeof e||_(i,"name")||T(i,"name",e),(s=n(i)).source||(s.source=r.join("string"==typeof e?e:""))),t!==o?(c?!u&&t[e]&&(l=!0):delete t[e],l?t[e]=i:T(t,e,i)):l?t[e]=i:j(e,i)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||D(this)}))})),rt=o,ot=function(t){return"function"==typeof t?t:void 0},it=function(t,e){return arguments.length<2?ot(rt[t])||ot(o[t]):rt[t]&&rt[t][e]||o[t]&&o[t][e]},at=Math.ceil,st=Math.floor,ct=function(t){return isNaN(t=+t)?0:(t>0?st:at)(t)},lt=Math.min,ut=function(t){return t>0?lt(ct(t),9007199254740991):0},ft=Math.max,dt=Math.min,pt=function(t,e){var n=ct(t);return n<0?ft(n+e,0):dt(n,e)},vt=function(t){return function(e,n,r){var o,i=g(e),a=ut(i.length),s=pt(r,a);if(t&&n!=n){for(;a>s;)if((o=i[s++])!=o)return!0}else for(;a>s;s++)if((t||s in i)&&i[s]===n)return t||s||0;return!t&&-1}},ht={includes:vt(!0),indexOf:vt(!1)}.indexOf,gt=function(t,e){var n,r=g(t),o=0,i=[];for(n in r)!_(U,n)&&_(r,n)&&i.push(n);for(;e.length>o;)_(r,n=e[o++])&&(~ht(i,n)||i.push(n));return i},mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yt=mt.concat("length","prototype"),bt={f:Object.getOwnPropertyNames||function(t){return gt(t,yt)}},_t={f:Object.getOwnPropertySymbols},wt=it("Reflect","ownKeys")||function(t){var e=bt.f(E(t)),n=_t.f;return n?e.concat(n(t)):e},xt=function(t,e){for(var n=wt(e),r=z.f,o=I.f,i=0;i<n.length;i++){var a=n[i];_(t,a)||r(t,a,o(e,a))}},St=/#|\.prototype\./,Ot=function(t,e){var n=It[kt(t)];return n==Ct||n!=Et&&("function"==typeof e?i(e):!!e)},kt=Ot.normalize=function(t){return String(t).replace(St,".").toLowerCase()},It=Ot.data={},Et=Ot.NATIVE="N",Ct=Ot.POLYFILL="P",zt=Ot,Tt=I.f,jt=function(t,e){var n,r,i,a,s,c=t.target,l=t.global,u=t.stat;if(n=l?o:u?o[c]||j(c,{}):(o[c]||{}).prototype)for(r in e){if(a=e[r],i=t.noTargetGet?(s=Tt(n,r))&&s.value:n[r],!zt(l?r:c+(u?".":"#")+r,t.forced)&&void 0!==i){if(typeof a==typeof i)continue;xt(a,i)}(t.sham||i&&i.sham)&&T(a,"sham",!0),nt(n,r,a,t)}},Lt=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function")}(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},At=function(t){return Object(h(t))},Rt=Array.isArray||function(t){return"Array"==d(t)},Mt="process"==d(o.process),Pt=it("navigator","userAgent")||"",Dt=o.process,Nt=Dt&&Dt.versions,Ft=Nt&&Nt.v8;Ft?tt=(Z=Ft.split("."))[0]+Z[1]:Pt&&(!(Z=Pt.match(/Edge\/(\d+)/))||Z[1]>=74)&&(Z=Pt.match(/Chrome\/(\d+)/))&&(tt=Z[1]);var Bt=tt&&+tt,$t=!!Object.getOwnPropertySymbols&&!i((function(){return!Symbol.sham&&(Mt?38===Bt:Bt>37&&Bt<41)})),Gt=$t&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Vt=B("wks"),Yt=o.Symbol,Xt=Gt?Yt:Yt&&Yt.withoutSetter||V,Ut=function(t){return _(Vt,t)&&($t||"string"==typeof Vt[t])||($t&&_(Yt,t)?Vt[t]=Yt[t]:Vt[t]=Xt("Symbol."+t)),Vt[t]},Ht=Ut("species"),Wt=function(t,e){var n;return Rt(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Rt(n.prototype)?m(n)&&null===(n=n[Ht])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Kt=[].push,qt=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,a=7==t,s=5==t||i;return function(c,l,u,f){for(var d,p,h=At(c),g=v(h),m=Lt(l,u,3),y=ut(g.length),b=0,_=f||Wt,w=e?_(c,y):n||a?_(c,0):void 0;y>b;b++)if((s||b in g)&&(p=m(d=g[b],b,h),t))if(e)w[b]=p;else if(p)switch(t){case 3:return!0;case 5:return d;case 6:return b;case 2:Kt.call(w,d)}else switch(t){case 4:return!1;case 7:Kt.call(w,d)}return i?-1:r||o?o:w}},Qt={forEach:qt(0),map:qt(1),filter:qt(2),some:qt(3),every:qt(4),find:qt(5),findIndex:qt(6),filterOut:qt(7)},Jt=Ut("species"),Zt=function(t){return Bt>=51||!i((function(){var e=[];return(e.constructor={})[Jt]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},te=Qt.filter,ee=Zt("filter");jt({target:"Array",proto:!0,forced:!ee},{filter:function(t){return te(this,t,arguments.length>1?arguments[1]:void 0)}});var ne=Qt.map,re=Zt("map");jt({target:"Array",proto:!0,forced:!re},{map:function(t){return ne(this,t,arguments.length>1?arguments[1]:void 0)}});var oe={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ie=function(t,e){var n=[][t];return!!n&&i((function(){n.call(null,e||function(){throw 1},1)}))},ae=Qt.forEach,se=ie("forEach")?[].forEach:function(t){return ae(this,t,arguments.length>1?arguments[1]:void 0)};for(var ce in oe){var le=o[ce],ue=le&&le.prototype;if(ue&&ue.forEach!==se)try{T(ue,"forEach",se)}catch(t){ue.forEach=se}}var fe,de=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return E(n),function(t){if(!m(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype")}(r),e?t.call(n,r):n.__proto__=r,n}}():void 0),pe=function(t,e,n){var r,o;return de&&"function"==typeof(r=e.constructor)&&r!==n&&m(o=r.prototype)&&o!==n.prototype&&de(t,o),t},ve=Object.keys||function(t){return gt(t,mt)},he=a?Object.defineProperties:function(t,e){E(t);for(var n,r=ve(e),o=r.length,i=0;o>i;)z.f(t,n=r[i++],e[n]);return t},ge=it("document","documentElement"),me=X("IE_PROTO"),ye=function(){},be=function(t){return"<script>"+t+"<\/script>"},_e=function(){try{fe=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;_e=fe?function(t){t.write(be("")),t.close();var e=t.parentWindow.Object;return t=null,e}(fe):((e=S("iframe")).style.display="none",ge.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(be("document.F=Object")),t.close(),t.F);for(var n=mt.length;n--;)delete _e.prototype[mt[n]];return _e()};U[me]=!0;var we=Object.create||function(t,e){var n;return null!==t?(ye.prototype=E(t),n=new ye,ye.prototype=null,n[me]=t):n=_e(),void 0===e?n:he(n,e)},xe="[\t\n\v\f\r  áââââââ ââââââ¯âã\u2028\u2029\ufeff]",Se=RegExp("^"+xe+xe+"*"),Oe=RegExp(xe+xe+"*$"),ke=function(t){return function(e){var n=String(h(e));return 1&t&&(n=n.replace(Se,"")),2&t&&(n=n.replace(Oe,"")),n}},Ie={start:ke(1),end:ke(2),trim:ke(3)},Ee=bt.f,Ce=I.f,ze=z.f,Te=Ie.trim,je=o.Number,Le=je.prototype,Ae="Number"==d(we(Le)),Re=function(t){var e,n,r,o,i,a,s,c,l=y(t,!1);if("string"==typeof l&&l.length>2)if(43===(e=(l=Te(l)).charCodeAt(0))||45===e){if(88===(n=l.charCodeAt(2))||120===n)return NaN}else if(48===e){switch(l.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+l}for(a=(i=l.slice(2)).length,s=0;s<a;s++)if((c=i.charCodeAt(s))<48||c>o)return NaN;return parseInt(i,r)}return+l};if(zt("Number",!je(" 0o1")||!je("0b1")||je("+0x1"))){for(var Me,Pe=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof Pe&&(Ae?i((function(){Le.valueOf.call(n)})):"Number"!=d(n))?pe(new je(Re(e)),n,Pe):Re(e)},De=a?Ee(je):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),Ne=0;De.length>Ne;Ne++)_(je,Me=De[Ne])&&!_(Pe,Me)&&ze(Pe,Me,Ce(je,Me));Pe.prototype=Le,Le.constructor=Pe,nt(o,"Number",Pe)}var Fe=function(t,e){return(Fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function Be(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,n,a):o(e,n))||a);return i>3&&a&&Object.defineProperty(e,n,a),a}function $e(t){return($e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ge(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ve(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function Ye(){return"undefined"!=typeof Reflect&&Reflect.defineMetadata&&Reflect.getOwnMetadataKeys}function Xe(t,e){Ue(t,e),Object.getOwnPropertyNames(e.prototype).forEach((function(n){Ue(t.prototype,e.prototype,n)})),Object.getOwnPropertyNames(e).forEach((function(n){Ue(t,e,n)}))}function Ue(t,e,n){(n?Reflect.getOwnMetadataKeys(e,n):Reflect.getOwnMetadataKeys(e)).forEach((function(r){var o=n?Reflect.getOwnMetadata(r,e,n):Reflect.getOwnMetadata(r,e);n?Reflect.defineMetadata(r,o,t,n):Reflect.defineMetadata(r,o,t)}))}var He={__proto__:[]}instanceof Array;function We(t){return function(e,n,r){var o="function"==typeof e?e:e.constructor;o.__decorators__||(o.__decorators__=[]),"number"!=typeof r&&(r=void 0),o.__decorators__.push((function(e){return t(e,n,r)}))}}function Ke(t,e){var n=e.prototype._init;e.prototype._init=function(){var e=this,n=Object.getOwnPropertyNames(t);if(t.$options.props)for(var r in t.$options.props)t.hasOwnProperty(r)||n.push(r);n.forEach((function(n){Object.defineProperty(e,n,{get:function(){return t[n]},set:function(e){t[n]=e},configurable:!0})}))};var r=new e;e.prototype._init=n;var o={};return Object.keys(r).forEach((function(t){void 0!==r[t]&&(o[t]=r[t])})),o}var qe=["data","beforeCreate","created","beforeMount","mounted","beforeDestroy","destroyed","beforeUpdate","updated","activated","deactivated","render","errorCaptured","serverPrefetch"];function Qe(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n.name=n.name||e._componentTag||e.name;var r=e.prototype;Object.getOwnPropertyNames(r).forEach((function(t){if("constructor"!==t)if(qe.indexOf(t)>-1)n[t]=r[t];else{var e=Object.getOwnPropertyDescriptor(r,t);void 0!==e.value?"function"==typeof e.value?(n.methods||(n.methods={}))[t]=e.value:(n.mixins||(n.mixins=[])).push({data:function(){return Ge({},t,e.value)}}):(e.get||e.set)&&((n.computed||(n.computed={}))[t]={get:e.get,set:e.set})}})),(n.mixins||(n.mixins=[])).push({data:function(){return Ke(this,e)}});var o=e.__decorators__;o&&(o.forEach((function(t){return t(n)})),delete e.__decorators__);var i=Object.getPrototypeOf(e.prototype),a=i instanceof vue__WEBPACK_IMPORTED_MODULE_0___default.a?i.constructor:vue__WEBPACK_IMPORTED_MODULE_0___default.a,s=a.extend(n);return Ze(s,e,a),Ye()&&Xe(s,e),s}var Je={prototype:!0,arguments:!0,callee:!0,caller:!0};function Ze(t,e,n){Object.getOwnPropertyNames(e).forEach((function(r){if(!Je[r]){var o=Object.getOwnPropertyDescriptor(t,r);if(!o||o.configurable){var i,a,s=Object.getOwnPropertyDescriptor(e,r);if(!He){if("cid"===r)return;var c=Object.getOwnPropertyDescriptor(n,r);if(i=s.value,a=$e(i),null!=i&&("object"===a||"function"===a)&&c&&c.value===s.value)return}Object.defineProperty(t,r,s)}}}))}function tn(t){return"function"==typeof t?Qe(t):function(e){return Qe(e,t)}}tn.registerHooks=function(t){qe.push.apply(qe,Ve(t))};var en="undefined"!=typeof Reflect&&void 0!==Reflect.getMetadata;function nn(t){return void 0===t&&(t={}),function(e,n){!function(t,e,n){if(en&&!Array.isArray(t)&&"function"!=typeof t&&void 0===t.type){var r=Reflect.getMetadata("design:type",e,n);r!==Object&&(t.type=r)}}(t,e,n),We((function(e,n){(e.props||(e.props={}))[n]=t}))(e,n)}}function rn(t,e){void 0===e&&(e={});var n=e.deep,r=void 0!==n&&n,o=e.immediate,i=void 0!==o&&o;return We((function(e,n){"object"!=typeof e.watch&&(e.watch=Object.create(null));var o=e.watch;"object"!=typeof o[t]||Array.isArray(o[t])?void 0===o[t]&&(o[t]=[]):o[t]=[o[t]],o[t].push({handler:n,deep:r,immediate:i})}))}!function(){if("undefined"!=typeof window){var t,e=window,n='<svg><symbol id="icon-rotate-right" viewBox="0 0 1024 1024"><path d="M275.199914 450.496179v20.031994c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399a120.255962 120.255962 0 0 1-72.991978-24.895992c-21.503993-15.839995-35.359989-38.751988-41.567987-68.735979h60.831981c9.247997 23.007993 27.167992 34.495989 53.759983 34.49599 37.535988-0.384 56.863982-21.407993 57.983982-63.071981v-38.751988c-28.095991 8.863997-54.303983 13.119996-78.623975 12.735996a91.263971 91.263971 0 0 1-68.447979-27.711991c-18.847994-18.303994-28.095991-47.231985-27.711991-86.847973z m62.55998 24.863992c7.103998 24.799992 25.215992 37.343988 54.271983 37.663989 27.103992-0.288 44.703986-11.327996 52.831984-33.11999 3.135999-8.383997 2.655999-29.599991-1.28-38.559988-8.607997-19.615994-25.791992-29.695991-51.551984-30.20799-28.383991 0.576-46.303986 12.639996-53.759983 36.159988a58.719982 58.719982 0 0 0-0.512 28.063991z m390.335878 115.711964v-116.895963c-1.12-41.311987-20.447994-62.335981-57.983981-63.07198-37.727988 0.768-56.959982 21.791993-57.695982 63.07198v116.895963c0.768 41.663987 19.999994 62.68798 57.695982 63.071981 37.535988-0.384 56.863982-21.407993 57.983981-63.071981z m-174.815945 3.391999v-123.935961c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399-31.10399-0.384-57.887982-10.751997-80.319975-31.10399-23.935993-20.543994-36.127989-49.791984-36.479989-87.679973z m282.559912-479.07185A509.887841 509.887841 0 0 0 511.99984 0.00032C229.215928 0.00032 0 229.216248 0 512.00016s229.215928 511.99984 511.99984 511.99984 511.99984-229.215928 511.99984-511.99984c0-3.743999-0.032-7.455998-0.128-11.167997-1.631999-11.295996-8.159997-27.103992-31.87199-27.103991-27.487991 0-31.67999 21.247993-32.03199 32.06399l0.032 4.127999a30.62399 30.62399 0 0 0 0.16 2.079999H959.9997c0 247.423923-200.575937 447.99986-447.99986 447.99986S63.99998 759.424083 63.99998 512.00016 264.575917 64.0003 511.99984 64.0003a446.079861 446.079861 0 0 1 277.439913 96.22397l-94.91197 91.679971c-25.439992 24.607992-17.439995 44.991986 17.887994 45.599986l188.031942 3.295999a64.31998 64.31998 0 0 0 65.055979-62.84798l3.295999-188.127942C969.407697 15.040315 949.311703 5.792318 923.871711 30.368311l-87.999972 85.023973z" fill="" ></path></symbol><symbol id="icon-rotate-left" viewBox="0 0 1024 1024"><path d="M275.199914 450.496179v20.031994c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399a120.255962 120.255962 0 0 1-72.991978-24.895992c-21.503993-15.839995-35.359989-38.751988-41.567987-68.735979h60.831981c9.247997 23.007993 27.167992 34.495989 53.759983 34.49599 37.535988-0.384 56.863982-21.407993 57.983982-63.071981v-38.751988c-28.095991 8.863997-54.303983 13.119996-78.623975 12.735996a91.263971 91.263971 0 0 1-68.447979-27.711991c-18.847994-18.303994-28.095991-47.231985-27.711991-86.847973z m62.55998 24.863992c7.103998 24.799992 25.215992 37.343988 54.271983 37.663989 27.103992-0.288 44.703986-11.327996 52.831984-33.11999 3.135999-8.383997 2.655999-29.599991-1.28-38.559988-8.607997-19.615994-25.791992-29.695991-51.551984-30.20799-28.383991 0.576-46.303986 12.639996-53.759983 36.159988a58.719982 58.719982 0 0 0-0.512 28.063991z m390.335878 115.711964v-116.895963c-1.12-41.311987-20.447994-62.335981-57.983981-63.07198-37.727988 0.768-56.959982 21.791993-57.695982 63.07198v116.895963c0.768 41.663987 19.999994 62.68798 57.695982 63.071981 37.535988-0.384 56.863982-21.407993 57.983981-63.071981z m-174.815945 3.391999v-123.935961c0.384-38.079988 12.543996-67.423979 36.479989-87.967973 22.431993-20.351994 49.215985-30.55999 80.319975-30.55999 32.06399 0 59.295981 10.175997 81.759974 30.55999 22.815993 20.543994 34.591989 49.887984 35.359989 87.967973v123.935961c-0.768 37.887988-12.543996 67.135979-35.359989 87.679973-22.431993 20.351994-49.695984 30.75199-81.759974 31.10399-31.10399-0.384-57.887982-10.751997-80.319975-31.10399-23.935993-20.543994-36.127989-49.791984-36.479989-87.679973zM188.159941 115.392284A509.887841 509.887841 0 0 1 511.99984 0.00032c282.783912 0 511.99984 229.215928 511.99984 511.99984s-229.215928 511.99984-511.99984 511.99984S0 794.784072 0 512.00016c0-3.743999 0.032-7.455998 0.128-11.167997 1.631999-11.295996 8.159997-27.103992 31.87199-27.103991 27.487991 0 31.67999 21.247993 32.03199 32.06399L63.99998 509.920161a30.62399 30.62399 0 0 1-0.16 2.079999H63.99998c0 247.423923 200.575937 447.99986 447.99986 447.99986s447.99986-200.575937 447.99986-447.99986S759.423763 64.0003 511.99984 64.0003a446.079861 446.079861 0 0 0-277.439913 96.22397l94.91197 91.679971c25.439992 24.607992 17.439995 44.991986-17.887994 45.599986L123.551961 300.800226a64.31998 64.31998 0 0 1-65.055979-62.84798l-3.295999-188.127942C54.591983 15.040315 74.687977 5.792318 100.127969 30.368311l87.999972 85.023973z" fill="" ></path></symbol><symbol id="icon-resize" viewBox="0 0 1024 1024"><path d="M456.036919 791.8108 270.553461 791.8108 460.818829 601.572038l-39.593763-39.567157L231.314785 751.915162l0.873903-183.953615c0-15.465227-12.515035-27.981285-27.981285-27.981285s-27.981285 12.515035-27.981285 27.981285l0 251.829516c0 8.3072 3.415796 14.975063 8.826016 19.564591 5.082762 5.192256 12.132318 8.416693 19.947308 8.416693l251.036453 0c15.46625 0 27.981285-12.514012 27.981285-27.981285C484.018204 804.325835 471.504192 791.8108 456.036919 791.8108zM838.945819 184.644347c-5.082762-5.191232-12.132318-8.416693-19.947308-8.416693L567.961034 176.227654c-15.46625 0-27.981285 12.515035-27.981285 27.981285 0 15.46625 12.514012 27.981285 27.981285 27.981285l185.483458 0L563.206754 422.427962l39.567157 39.567157 189.910281-189.910281-0.873903 183.953615c0 15.46625 12.514012 27.981285 27.981285 27.981285s27.981285-12.514012 27.981285-27.981285L847.772858 204.208938C847.771835 195.902762 844.356039 189.234899 838.945819 184.644347zM847.771835 64.303538 176.227142 64.303538c-61.809741 0-111.924115 50.115398-111.924115 111.924115l0 671.544693c0 61.809741 50.114374 111.924115 111.924115 111.924115l671.544693 0c61.809741 0 111.924115-50.114374 111.924115-111.924115l0-671.544693C959.69595 114.418936 909.581576 64.303538 847.771835 64.303538zM903.733381 847.772346c0 30.878265-25.056676 55.962569-55.962569 55.962569L176.227142 903.734916c-30.90487 0-55.962569-25.084305-55.962569-55.962569l0-671.544693c0-30.9325 25.056676-55.962569 55.962569-55.962569l671.544693 0c30.90487 0 55.962569 25.03007 55.962569 55.962569L903.734404 847.772346z" ></path></symbol><symbol id="icon-img-broken" viewBox="0 0 1024 1024"><path d="M810.666667 128H213.333333c-46.933333 0-85.333333 38.4-85.333333 85.333333v597.333334c0 46.933333 38.4 85.333333 85.333333 85.333333h597.333334c46.933333 0 85.333333-38.4 85.333333-85.333333V213.333333c0-46.933333-38.4-85.333333-85.333333-85.333333z m0 682.666667H213.333333v-195.413334l42.24 42.24 170.666667-170.666666 170.666667 170.666666 170.666666-170.24L810.666667 530.346667V810.666667z m0-401.493334l-43.093334-43.093333-170.666666 171.093333-170.666667-170.666666-170.666667 170.666666-42.24-42.666666V213.333333h597.333334v195.84z" ></path></symbol><symbol id="icon-prev" viewBox="0 0 1024 1024"><path d="M784.652701 955.6957 346.601985 517.644983c-2.822492-2.822492-2.822492-7.902977 0-11.289967l439.179713-439.179713c6.77398-6.77398 10.725469-16.370452 10.725469-25.966924L796.507166 36.692393c0-20.32194-16.370452-36.692393-36.692393-36.692393l-4.515987 0c-9.596472 0-19.192944 3.951488-25.966924 10.725469L250.072767 489.420066c-12.418964 12.418964-12.418964 32.740904 0 45.159868l477.565601 477.565601c7.338479 7.338479 17.499449 11.854465 28.224917 11.854465l0 0c22.015436 0 40.079383-18.063947 40.079383-40.079383l0 0C796.507166 973.759647 791.99118 963.598677 784.652701 955.6957z" ></path></symbol><symbol id="icon-next" viewBox="0 0 1024 1024"><path d="M246.121279 955.6957l438.050717-438.050717c2.822492-2.822492 2.822492-7.902977 0-11.289967L244.992282 67.175303c-6.77398-6.77398-10.725469-16.370452-10.725469-25.966924L234.266814 36.692393C234.266814 16.370452 250.637266 0 270.959206 0l4.515987 0c9.596472 0 19.192944 3.951488 25.966924 10.725469l478.694598 478.694598c12.418964 12.418964 12.418964 32.740904 0 45.159868l-477.565601 477.565601c-7.338479 7.338479-17.499449 11.854465-28.224917 11.854465l0 0c-22.015436 0-40.079383-18.063947-40.079383-40.079383l0 0C234.266814 973.759647 238.7828 963.598677 246.121279 955.6957z" ></path></symbol><symbol id="icon-zoomin" viewBox="0 0 1024 1024"><path d="M725.504 652.864c46.4-61.44 71.744-136.448 71.744-218.752C797.248 230.464 632.768 64 430.656 64S64 230.464 64 434.112C64 639.36 228.48 805.76 430.656 805.76c86.656 0 164.48-30.144 227.52-81.088L889.984 960 960 891.264l-234.496-238.4z m-294.848 67.456c-155.776 0-282.624-128.896-282.624-286.208s126.848-286.208 282.624-286.208 282.624 128.896 282.624 286.208-126.912 286.208-282.624 286.208z" ></path><path d="M235.712 369.92h390.72v127.104H235.712z" ></path><path d="M367.488 238.144h127.104v390.72H367.488z" ></path></symbol><symbol id="icon-close" viewBox="0 0 1024 1024"><path d="M570.24 512l259.2 259.2-58.88 58.24L512 570.24l-261.12 261.12-58.24-58.24L453.76 512 194.56 252.8l58.24-58.24L512 453.76l261.12-261.12 58.24 58.24z" ></path></symbol><symbol id="icon-zoomout" viewBox="0 0 1024 1024"><path d="M725.504 652.864c46.4-61.44 71.744-136.448 71.744-218.752C797.248 230.464 632.768 64 430.656 64S64 230.464 64 434.112C64 639.36 228.48 805.76 430.656 805.76c86.656 0 164.48-30.144 227.52-81.088L889.984 960 960 891.264l-234.496-238.4z m-294.848 67.456c-155.776 0-282.624-128.896-282.624-286.208s126.848-286.208 282.624-286.208 282.624 128.896 282.624 286.208-126.912 286.208-282.624 286.208z" ></path><path d="M235.712 369.92h390.72v127.104H235.712z" ></path></symbol></svg>';if((t=document.getElementsByTagName("script"))[t.length-1].getAttribute("data-injectcss")&&!e.__iconfont__svg__cssinject__){e.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>")}catch(t){console&&console.log(t)}}!function(t){if(document.addEventListener)if(~["complete","loaded","interactive"].indexOf(document.readyState))setTimeout(t,0);else{document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e,!1),t()}),!1)}else document.attachEvent&&(r=t,o=e.document,i=!1,(a=function(){try{o.documentElement.doScroll("left")}catch(t){return void setTimeout(a,50)}n()})(),o.onreadystatechange=function(){"complete"==o.readyState&&(o.onreadystatechange=null,n())});function n(){i||(i=!0,r())}var r,o,i,a}((function(){var t,e,r,o,i,a;(t=document.createElement("div")).innerHTML=n,n=null,(e=t.getElementsByTagName("svg")[0])&&(e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.width=0,e.style.height=0,e.style.overflow="hidden",r=e,(o=document.body).firstChild?(i=r,(a=o.firstChild).parentNode.insertBefore(i,a)):o.appendChild(r))}))}}();var on=vue__WEBPACK_IMPORTED_MODULE_0___default.a.extend({props:{type:{type:String,default:""}},data:function(){return{prefixCls:"vel"}}});function an(t,e,n,r,o,i,a,s,c,l){"boolean"!=typeof a&&(c=s,s=a,a=!1);const u="function"==typeof n?n.options:n;let f;if(t&&t.render&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,o&&(u.functional=!0)),r&&(u._scopeId=r),i?(f=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},u._ssrRegister=f):e&&(f=a?function(t){e.call(this,l(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,s(t))}),f)if(u.functional){const t=u.render;u.render=function(e,n){return f.call(n),t(e,n)}}else{const t=u.beforeCreate;u.beforeCreate=t?[].concat(t,f):[f]}return n}var sn=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),cn=n((function(t){var e=z.f,n=V("meta"),r=0,o=Object.isExtensible||function(){return!0},i=function(t){e(t,n,{value:{objectID:"O"+ ++r,weakData:{}}})},a=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!m(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!_(t,n)){if(!o(t))return"F";if(!e)return"E";i(t)}return t[n].objectID},getWeakData:function(t,e){if(!_(t,n)){if(!o(t))return!0;if(!e)return!1;i(t)}return t[n].weakData},onFreeze:function(t){return sn&&a.REQUIRED&&o(t)&&!_(t,n)&&i(t),t}};U[n]=!0})),ln=(cn.REQUIRED,cn.fastKey,cn.getWeakData,cn.onFreeze,{}),un=Ut("iterator"),fn=Array.prototype,dn={};dn[Ut("toStringTag")]="z";var pn="[object z]"===String(dn),vn=Ut("toStringTag"),hn="Arguments"==d(function(){return arguments}()),gn=pn?d:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),vn))?n:hn?d(e):"Object"==(r=d(e))&&"function"==typeof e.callee?"Arguments":r},mn=Ut("iterator"),yn=function(t){var e=t.return;if(void 0!==e)return E(e.call(t)).value},bn=function(t,e){this.stopped=t,this.result=e},_n=function(t,e,n){var r,o,i,a,s,c,l,u,f=n&&n.that,d=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),v=!(!n||!n.INTERRUPTED),h=Lt(e,f,1+d+v),g=function(t){return r&&yn(r),new bn(!0,t)},m=function(t){return d?(E(t),v?h(t[0],t[1],g):h(t[0],t[1])):v?h(t,g):h(t)};if(p)r=t;else{if("function"!=typeof(o=function(t){if(null!=t)return t[mn]||t["@@iterator"]||ln[gn(t)]}(t)))throw TypeError("Target is not iterable");if(void 0!==(u=o)&&(ln.Array===u||fn[un]===u)){for(i=0,a=ut(t.length);a>i;i++)if((s=m(t[i]))&&s instanceof bn)return s;return new bn(!1)}r=o.call(t)}for(c=r.next;!(l=c.call(r)).done;){try{s=m(l.value)}catch(t){throw yn(r),t}if("object"==typeof s&&s&&s instanceof bn)return s}return new bn(!1)},wn=function(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t},xn=Ut("iterator"),Sn=!1;try{var On=0,kn={next:function(){return{done:!!On++}},return:function(){Sn=!0}};kn[xn]=function(){return this},Array.from(kn,(function(){throw 2}))}catch(t){}var In,En,Cn,zn=z.f,Tn=Ut("toStringTag"),jn=function(t,e,n){t&&!_(t=n?t:t.prototype,Tn)&&zn(t,Tn,{configurable:!0,value:e})},Ln=function(t,e,n){for(var r in e)nt(t,r,e[r],n);return t},An=!i((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Rn=X("IE_PROTO"),Mn=Object.prototype,Pn=An?Object.getPrototypeOf:function(t){return t=At(t),_(t,Rn)?t[Rn]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Mn:null},Dn=Ut("iterator"),Nn=!1;[].keys&&("next"in(Cn=[].keys())?(En=Pn(Pn(Cn)))!==Object.prototype&&(In=En):Nn=!0),(null==In||i((function(){var t={};return In[Dn].call(t)!==t})))&&(In={}),_(In,Dn)||T(In,Dn,(function(){return this}));var Fn={IteratorPrototype:In,BUGGY_SAFARI_ITERATORS:Nn},Bn=Fn.IteratorPrototype,$n=function(){return this},Gn=Fn.IteratorPrototype,Vn=Fn.BUGGY_SAFARI_ITERATORS,Yn=Ut("iterator"),Xn=function(){return this},Un=function(t,e,n,r,o,i,a){!function(t,e,n){var r=e+" Iterator";t.prototype=we(Bn,{next:u(1,n)}),jn(t,r,!1),ln[r]=$n}(n,e,r);var s,c,l,f=function(t){if(t===o&&g)return g;if(!Vn&&t in v)return v[t];switch(t){case"keys":case"values":case"entries":return function(){return new n(this,t)}}return function(){return new n(this)}},d=e+" Iterator",p=!1,v=t.prototype,h=v[Yn]||v["@@iterator"]||o&&v[o],g=!Vn&&h||f(o),m="Array"==e&&v.entries||h;if(m&&(s=Pn(m.call(new t)),Gn!==Object.prototype&&s.next&&(Pn(s)!==Gn&&(de?de(s,Gn):"function"!=typeof s[Yn]&&T(s,Yn,Xn)),jn(s,d,!0))),"values"==o&&h&&"values"!==h.name&&(p=!0,g=function(){return h.call(this)}),v[Yn]!==g&&T(v,Yn,g),ln[e]=g,o)if(c={values:f("values"),keys:i?g:f("keys"),entries:f("entries")},a)for(l in c)(Vn||p||!(l in v))&&nt(v,l,c[l]);else jt({target:e,proto:!0,forced:Vn||p},c);return c},Hn=Ut("species"),Wn=z.f,Kn=cn.fastKey,qn=et.set,Qn=et.getterFor,Jn=(function(t,e,n){var r=-1!==t.indexOf("Map"),a=-1!==t.indexOf("Weak"),s=r?"set":"add",c=o[t],l=c&&c.prototype,u=c,f={},d=function(t){var e=l[t];nt(l,t,"add"==t?function(t){return e.call(this,0===t?0:t),this}:"delete"==t?function(t){return!(a&&!m(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return a&&!m(t)?void 0:e.call(this,0===t?0:t)}:"has"==t?function(t){return!(a&&!m(t))&&e.call(this,0===t?0:t)}:function(t,n){return e.call(this,0===t?0:t,n),this})};if(zt(t,"function"!=typeof c||!(a||l.forEach&&!i((function(){(new c).entries().next()})))))u=n.getConstructor(e,t,r,s),cn.REQUIRED=!0;else if(zt(t,!0)){var p=new u,v=p[s](a?{}:-0,1)!=p,h=i((function(){p.has(1)})),g=function(t,e){if(!e&&!Sn)return!1;var n=!1;try{var r={};r[xn]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n}((function(t){new c(t)})),y=!a&&i((function(){for(var t=new c,e=5;e--;)t[s](e,e);return!t.has(-0)}));g||((u=e((function(e,n){wn(e,u,t);var o=pe(new c,e,u);return null!=n&&_n(n,o[s],{that:o,AS_ENTRIES:r}),o}))).prototype=l,l.constructor=u),(h||y)&&(d("delete"),d("has"),r&&d("get")),(y||v)&&d(s),a&&l.clear&&delete l.clear}f[t]=u,jt({global:!0,forced:u!=c},f),jn(u,t),a||n.setStrong(u,t,r)}("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),{getConstructor:function(t,e,n,r){var o=t((function(t,i){wn(t,o,e),qn(t,{type:e,index:we(null),first:void 0,last:void 0,size:0}),a||(t.size=0),null!=i&&_n(i,t[r],{that:t,AS_ENTRIES:n})})),i=Qn(e),s=function(t,e,n){var r,o,s=i(t),l=c(t,e);return l?l.value=n:(s.last=l={index:o=Kn(e,!0),key:e,value:n,previous:r=s.last,next:void 0,removed:!1},s.first||(s.first=l),r&&(r.next=l),a?s.size++:t.size++,"F"!==o&&(s.index[o]=l)),t},c=function(t,e){var n,r=i(t),o=Kn(e);if("F"!==o)return r.index[o];for(n=r.first;n;n=n.next)if(n.key==e)return n};return Ln(o.prototype,{clear:function(){for(var t=i(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,a?t.size=0:this.size=0},delete:function(t){var e=i(this),n=c(this,t);if(n){var r=n.next,o=n.previous;delete e.index[n.index],n.removed=!0,o&&(o.next=r),r&&(r.previous=o),e.first==n&&(e.first=r),e.last==n&&(e.last=o),a?e.size--:this.size--}return!!n},forEach:function(t){for(var e,n=i(this),r=Lt(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!c(this,t)}}),Ln(o.prototype,n?{get:function(t){var e=c(this,t);return e&&e.value},set:function(t,e){return s(this,0===t?0:t,e)}}:{add:function(t){return s(this,t=0===t?0:t,t)}}),a&&Wn(o.prototype,"size",{get:function(){return i(this).size}}),o},setStrong:function(t,e,n){var r=e+" Iterator",o=Qn(e),i=Qn(r);Un(t,e,(function(t,e){qn(this,{type:r,target:t,state:o(t),kind:e,last:void 0})}),(function(){for(var t=i(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?"keys"==e?{value:n.key,done:!1}:"values"==e?{value:n.value,done:!1}:{value:[n.key,n.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),n?"entries":"values",!n,!0),function(t){var e=it(t),n=z.f;a&&e&&!e[Hn]&&n(e,Hn,{configurable:!0,get:function(){return this}})}(e)}}),pn?{}.toString:function(){return"[object "+gn(this)+"]"});pn||nt(Object.prototype,"toString",Jn,{unsafe:!0});var Zn=function(t){return function(e,n){var r,o,i=String(h(e)),a=ct(n),s=i.length;return a<0||a>=s?t?"":void 0:(r=i.charCodeAt(a))<55296||r>56319||a+1===s||(o=i.charCodeAt(a+1))<56320||o>57343?t?i.charAt(a):r:t?i.slice(a,a+2):o-56320+(r-55296<<10)+65536}},tr={codeAt:Zn(!1),charAt:Zn(!0)}.charAt,er=et.set,nr=et.getterFor("String Iterator");Un(String,"String",(function(t){er(this,{type:"String Iterator",string:String(t),index:0})}),(function(){var t,e=nr(this),n=e.string,r=e.index;return r>=n.length?{value:void 0,done:!0}:(t=tr(n,r),e.index+=t.length,{value:t,done:!1})}));var rr=Ut("unscopables"),or=Array.prototype;null==or[rr]&&z.f(or,rr,{configurable:!0,value:we(null)});var ir=function(t){or[rr][t]=!0},ar=et.set,sr=et.getterFor("Array Iterator"),cr=Un(Array,"Array",(function(t,e){ar(this,{type:"Array Iterator",target:g(t),index:0,kind:e})}),(function(){var t=sr(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==n?{value:r,done:!1}:"values"==n?{value:e[r],done:!1}:{value:[r,e[r]],done:!1}}),"values");ln.Arguments=ln.Array,ir("keys"),ir("values"),ir("entries");var lr=Ut("iterator"),ur=Ut("toStringTag"),fr=cr.values;for(var dr in oe){var pr=o[dr],vr=pr&&pr.prototype;if(vr){if(vr[lr]!==fr)try{T(vr,lr,fr)}catch(t){vr[lr]=fr}if(vr[ur]||T(vr,ur,dr),oe[dr])for(var hr in cr)if(vr[hr]!==cr[hr])try{T(vr,hr,cr[hr])}catch(t){vr[hr]=cr[hr]}}}var gr=[].join,mr=v!=Object,yr=ie("join",",");jt({target:"Array",proto:!0,forced:mr||!yr},{join:function(t){return gr.call(g(this),void 0===t?",":t)}});var br,_r="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function wr(t){return function(t,e){return function(t,e){var n=_r?e.media||"default":t,r=xr[n]||(xr[n]={ids:new Set,styles:[]});if(!r.ids.has(t)){r.ids.add(t);var o=e.source;if(e.map&&(o+="\n/*# sourceURL="+e.map.sources[0]+" */",o+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e.map))))+" */"),r.element||(r.element=document.createElement("style"),r.element.type="text/css",e.media&&r.element.setAttribute("media",e.media),void 0===br&&(br=document.head||document.getElementsByTagName("head")[0]),br.appendChild(r.element)),"styleSheet"in r.element)r.styles.push(o),r.element.styleSheet.cssText=r.styles.filter(Boolean).join("\n");else{var i=r.ids.size-1,a=document.createTextNode(o),s=r.element.childNodes;s[i]&&r.element.removeChild(s[i]),s.length?r.element.insertBefore(a,s[i]):r.element.appendChild(a)}}}(t,e)}}var xr={};var Sr=an({render:function(){var t=this.$createElement,e=this._self._c||t;return e("svg",{class:this.prefixCls+"-icon icon",attrs:{"aria-hidden":"true"}},[e("use",{attrs:{"xlink:href":"#icon-"+this.type}})])},staticRenderFns:[]},(function(t){t&&t("data-v-7221e0ec_0",{source:".vel-icon[data-v-7221e0ec]{width:1em;height:1em;vertical-align:-.15em;fill:currentColor;overflow:hidden}",map:void 0,media:void 0})}),on,"data-v-7221e0ec",!1,void 0,!1,wr,void 0,void 0),Or=function(){},kr=an({render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:t.prefixCls+"-toolbar"},[n("div",{staticClass:"toolbar-btn toolbar-btn__zoomin",on:{click:t.zoomIn}},[n("svg-icon",{attrs:{type:"zoomin"}})],1),t._v(" "),n("div",{staticClass:"toolbar-btn toolbar-btn__zoomout",on:{click:t.zoomOut}},[n("svg-icon",{attrs:{type:"zoomout"}})],1),t._v(" "),n("div",{staticClass:"toolbar-btn toolbar-btn__resize",on:{click:t.resize}},[n("svg-icon",{attrs:{type:"resize"}})],1),t._v(" "),n("div",{staticClass:"toolbar-btn toolbar-btn__rotate",on:{click:t.rotateLeft}},[n("svg-icon",{attrs:{type:"rotate-left"}})],1),t._v(" "),n("div",{staticClass:"toolbar-btn toolbar-btn__rotate",on:{click:t.rotateRight}},[n("svg-icon",{attrs:{type:"rotate-right"}})],1)])},staticRenderFns:[]},(function(t){t&&t("data-v-59338679_0",{source:".vel-toolbar[data-v-59338679]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:absolute;overflow:hidden;bottom:8px;left:50%;-webkit-transform:translate(-50%);transform:translate(-50%);opacity:.9;display:-webkit-box;display:-ms-flexbox;display:flex;background-color:#2d2d2d;border-radius:4px;padding:0}.vel-toolbar .toolbar-btn[data-v-59338679]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0;cursor:pointer;padding:6px 10px;font-size:20px;color:#fff;background-color:#2d2d2d;-webkit-tap-highlight-color:transparent;outline:0}.vel-toolbar .toolbar-btn[data-v-59338679]:active,.vel-toolbar .toolbar-btn[data-v-59338679]:hover{background-color:#3d3d3d}",map:void 0,media:void 0})}),vue__WEBPACK_IMPORTED_MODULE_0___default.a.extend({components:{SvgIcon:Sr},props:{zoomIn:{type:Function,default:Or},zoomOut:{type:Function,default:Or},rotateLeft:{type:Function,default:Or},rotateRight:{type:Function,default:Or},resize:{type:Function,default:Or}},data:function(){return{prefixCls:"vel"}}}),"data-v-59338679",!1,void 0,!1,wr,void 0,void 0),Ir=an({render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{class:this.prefixCls+"-loading"},[e("div",{staticClass:"ring"})])},staticRenderFns:[]},(function(t){t&&t("data-v-5174e3cb_0",{source:'.vel-loading[data-v-5174e3cb]{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.vel-loading .ring[data-v-5174e3cb]{display:inline-block;width:64px;height:64px}.vel-loading .ring[data-v-5174e3cb]::after{content:" ";display:block;width:46px;height:46px;margin:1px;border-radius:50%;border:5px solid rgba(255,255,255,.7);border-color:rgba(255,255,255,.7) transparent rgba(255,255,255,.7) transparent;-webkit-animation:ring-data-v-5174e3cb 1.2s linear infinite;animation:ring-data-v-5174e3cb 1.2s linear infinite}@-webkit-keyframes ring-data-v-5174e3cb{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes ring-data-v-5174e3cb{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}',map:void 0,media:void 0})}),vue__WEBPACK_IMPORTED_MODULE_0___default.a.extend({data:function(){return{prefixCls:"vel"}}}),"data-v-5174e3cb",!1,void 0,!1,wr,void 0,void 0),Er=an({render:function(){var t=this.$createElement,e=this._self._c||t;return e("div",{class:this.prefixCls+"-on-error"},[e("svg-icon",{attrs:{clas:"icon",type:"img-broken"}})],1)},staticRenderFns:[]},(function(t){t&&t("data-v-137806a2_0",{source:".vel-on-error[data-v-137806a2]{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.vel-on-error .icon[data-v-137806a2]{font-size:80px;color:#aaa}",map:void 0,media:void 0})}),vue__WEBPACK_IMPORTED_MODULE_0___default.a.extend({components:{SvgIcon:Sr},data:function(){return{prefixCls:"vel"}}}),"data-v-137806a2",!1,void 0,!1,wr,void 0,void 0),Cr=an({render:function(){var t=this.$createElement;return(this._self._c||t)("div",{class:this.prefixCls+"-img-title"},[this._t("default")],2)},staticRenderFns:[]},(function(t){t&&t("data-v-7f0f8cef_0",{source:".vel-img-title[data-v-7f0f8cef]{overflow:hidden;position:absolute;left:50%;bottom:60px;-webkit-transform:translate(-50%);transform:translate(-50%);max-width:80%;font-size:12px;line-height:1;text-align:center;text-overflow:ellipsis;color:#ccc;opacity:.8;white-space:nowrap;cursor:default;-webkit-transition:opacity .15s;transition:opacity .15s}.vel-img-title[data-v-7f0f8cef]:hover{opacity:1}",map:void 0,media:void 0})}),vue__WEBPACK_IMPORTED_MODULE_0___default.a.extend({data:function(){return{prefixCls:"vel"}}}),"data-v-7f0f8cef",!1,void 0,!1,wr,void 0,void 0),zr=function(t,e,n){var r=y(e);r in t?z.f(t,r,u(0,n)):t[r]=n},Tr=Zt("slice"),jr=Ut("species"),Lr=[].slice,Ar=Math.max;jt({target:"Array",proto:!0,forced:!Tr},{slice:function(t,e){var n,r,o,i=g(this),a=ut(i.length),s=pt(t,a),c=pt(void 0===e?a:e,a);if(Rt(i)&&("function"!=typeof(n=i.constructor)||n!==Array&&!Rt(n.prototype)?m(n)&&null===(n=n[jr])&&(n=void 0):n=void 0,n===Array||void 0===n))return Lr.call(i,s,c);for(r=new(void 0===n?Array:n)(Ar(c-s,0)),o=0;s<c;s++,o++)s in i&&zr(r,o,i[s]);return r.length=o,r}});var Rr=vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer,Mr=!1;if(!Rr)try{var Pr={};Object.defineProperty(Pr,"passive",{get:function(){Mr=!0}}),window.addEventListener("test-passive",(function(){}),Pr)}catch(t){}var Dr=function(t,e,n,r){void 0===r&&(r=!1),Rr||t.addEventListener(e,n,!!Mr&&{capture:!1,passive:r})},Nr=function(t,e,n){Rr||t.removeEventListener(e,n)},Fr=Object.prototype.toString,Br=function(t){return function(e){return Fr.call(e).slice(8,-1)===t}};function $r(t){return Br("Array")(t)}var Gr=function(t){return!!t&&Br("String")(t)};function Vr(t){return null!=t}function Yr(t){return function(t){return!!t&&Br("Object")(t)}(t)&&Gr(t.src)}var Xr=an({render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("transition",{attrs:{name:t.prefixCls+"-fade"}},[t.visible?n("div",{ref:"modal",class:[t.prefixCls+"-img-modal",t.prefixCls+"-modal"],on:{click:function(e){return e.target!==e.currentTarget?null:t.closeDialog(e)}}},[n("transition",{attrs:{name:t.prefixCls+"-fade",mode:"out-in"}},[t.loading?t._t("loading",[n("img-loading")]):t._e(),t._v(" "),t.loadError?t._t("onerror",[n("img-on-error")]):t._e(),t._v(" "),t.loading||t.loadError?t._e():n("div",{class:t.prefixCls+"-img-wrapper",style:t.imgWrapperStyle},[n("img",{ref:"realImg",class:t.prefixCls+"-img",attrs:{src:t.visibleImgSrc,draggable:"false"},on:{mousedown:function(e){return t.handleMouseDown(e)},mouseup:function(e){return t.handleMouseUp(e)},mousemove:function(e){return t.handleMouseMove(e)},touchstart:function(e){return t.handleTouchStart(e)},touchmove:function(e){return t.handleTouchMove(e)},touchend:function(e){return t.handleTouchEnd(e)},load:t.handleRealImgLoad,dragstart:function(e){return t.handleDragStart(e)}}})])],2),t._v(" "),n("img",{staticStyle:{display:"none"},attrs:{src:t.visibleImgSrc},on:{error:t.handleImgError,load:t.handleTestImgLoad}}),t._v(" "),n("div",{class:t.prefixCls+"-btns-wrapper"},[t._t("prev-btn",[t.imgList.length>1?n("div",{staticClass:"btn__prev",class:{disable:!t.loop&&t.imgIndex<=0},on:{click:t.onPrevClick}},[n("svg-icon",{attrs:{type:"prev"}})],1):t._e()],{prev:t.onPrevClick}),t._v(" "),t._t("next-btn",[t.imgList.length>1?n("div",{staticClass:"btn__next",class:{disable:!t.loop&&t.imgIndex>=t.imgList.length-1},on:{click:t.onNextClick}},[n("svg-icon",{attrs:{type:"next"}})],1):t._e()],{next:t.onNextClick}),t._v(" "),t._t("close-btn",[n("div",{staticClass:"btn__close",on:{click:t.closeDialog}},[n("svg-icon",{attrs:{type:"close"}})],1)],{close:t.closeDialog}),t._v(" "),!t.imgTitle||t.titleDisabled||t.loading||t.loadError?t._e():t._t("title",[n("img-title",[t._v(t._s(t.imgTitle))])]),t._v(" "),t._t("toolbar",[n("toolbar",{attrs:{prefixCls:t.prefixCls,zoomIn:t.zoomIn,zoomOut:t.zoomOut,rotateLeft:t.rotateLeft,rotateRight:t.rotateRight,resize:t.resize}})],{toolbarMethods:{zoomIn:t.zoomIn,zoomOut:t.zoomOut,rotate:t.rotateLeft,rotateLeft:t.rotateLeft,rotateRight:t.rotateRight,resize:t.resize}})],2)],1):t._e()])},staticRenderFns:[]},(function(t){t&&t("data-v-6609e1d4_0",{source:".vel-fade-enter-active[data-v-6609e1d4],.vel-fade-leave-active[data-v-6609e1d4]{-webkit-transition:all .3s ease;transition:all .3s ease}.vel-fade-enter[data-v-6609e1d4],.vel-fade-leave-to[data-v-6609e1d4]{opacity:0}.vel-img-swiper[data-v-6609e1d4]{position:relative;display:block}.vel-modal[data-v-6609e1d4]{z-index:9998;position:fixed;top:0;left:0;right:0;bottom:0;margin:0;background:rgba(0,0,0,.5)}.vel-img-wrapper[data-v-6609e1d4]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin:0;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50% -50%);transform:translate(-50% -50%);-webkit-transition:.3s ease-in-out;transition:.3s ease-in-out;will-change:transform opacity}.vel-img[data-v-6609e1d4]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-width:80vw;max-height:80vh;display:block;position:relative;-webkit-transition:-webkit-transform .3s ease-in-out;transition:-webkit-transform .3s ease-in-out;transition:transform .3s ease-in-out;transition:transform .3s ease-in-out,-webkit-transform .3s ease-in-out;-webkit-box-shadow:rgba(0,0,0,.7) 0 5px 20px 2px;box-shadow:rgba(0,0,0,.7) 0 5px 20px 2px;background-color:rgba(0,0,0,.7)}@media (max-width:750px){.vel-img[data-v-6609e1d4]{max-width:85vw;max-height:95vh}}.vel-btns-wrapper .btn__close[data-v-6609e1d4],.vel-btns-wrapper .btn__next[data-v-6609e1d4],.vel-btns-wrapper .btn__prev[data-v-6609e1d4]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);cursor:pointer;opacity:.6;font-size:32px;color:#fff;-webkit-transition:.15s linear;transition:.15s linear;-webkit-tap-highlight-color:transparent;outline:0}.vel-btns-wrapper .btn__close[data-v-6609e1d4]:hover,.vel-btns-wrapper .btn__next[data-v-6609e1d4]:hover,.vel-btns-wrapper .btn__prev[data-v-6609e1d4]:hover{opacity:1}.vel-btns-wrapper .btn__close.disable[data-v-6609e1d4],.vel-btns-wrapper .btn__close.disable[data-v-6609e1d4]:hover,.vel-btns-wrapper .btn__next.disable[data-v-6609e1d4],.vel-btns-wrapper .btn__next.disable[data-v-6609e1d4]:hover,.vel-btns-wrapper .btn__prev.disable[data-v-6609e1d4],.vel-btns-wrapper .btn__prev.disable[data-v-6609e1d4]:hover{cursor:default;opacity:.2}.vel-btns-wrapper .btn__next[data-v-6609e1d4]{right:12px}.vel-btns-wrapper .btn__prev[data-v-6609e1d4]{left:12px}.vel-btns-wrapper .btn__close[data-v-6609e1d4]{top:24px;right:10px}@media (max-width:750px){.vel-btns-wrapper .btn__next[data-v-6609e1d4],.vel-btns-wrapper .btn__prev[data-v-6609e1d4]{font-size:20px}.vel-btns-wrapper .btn__close[data-v-6609e1d4]{font-size:24px}.vel-btns-wrapper .btn__next[data-v-6609e1d4]{right:4px}.vel-btns-wrapper .btn__prev[data-v-6609e1d4]{left:4px}}",map:void 0,media:void 0})}),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.prefixCls="vel",e.scale=1,e.rotateDeg=0,e.imgIndex=0,e.top=0,e.left=0,e.lastX=0,e.lastY=0,e.isDraging=!1,e.loading=!1,e.loadError=!1,e.isTicking=!1,e.isGesturing=!1,e.imgBaseInfo={width:0,height:0,maxScale:1},e.touches=[],e.rafId=0,e}return function(t,e){function n(){this.constructor=t}Fe(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),Object.defineProperty(e.prototype,"imgList",{get:function(){return $r(this.imgs)?this.imgs.map((function(t){return"string"==typeof t?{src:t}:Yr(t)?t:void 0})).filter(Vr):Gr(this.imgs)?[{src:this.imgs}]:[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"visibleImgSrc",{get:function(){var t;return null===(t=this.imgList[this.imgIndex])||void 0===t?void 0:t.src},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imgTitle",{get:function(){var t;return null===(t=this.imgList[this.imgIndex])||void 0===t?void 0:t.title},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imgTotal",{get:function(){return this.imgList.length||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"imgWrapperStyle",{get:function(){var t=this,e=t.scale,n=t.top,r=t.left,o=t.rotateDeg,i=t.moveDisabled,a=t.loadError,s=t.isDraging,c=t.isGesturing;return{transform:"translate(-50%, -50%) scale("+e+") rotate("+o+"deg)",top:"calc(50% + "+n+"px)",left:"calc(50% + "+r+"px)",cursor:i||a?"default":"move",transition:s||c?"none":""}},enumerable:!1,configurable:!0}),e.prototype.checkMoveable=function(t){return void 0===t&&(t=0),!this.moveDisabled&&0===t},e.prototype.handleMouseDown=function(t){this.checkMoveable(t.button)&&(this.lastX=t.clientX,this.lastY=t.clientY,this.isDraging=!0,t.stopPropagation())},e.prototype.handleMouseUp=function(t){this.checkMoveable(t.button)&&(cancelAnimationFrame(this.rafId),this.isDraging=!1,this.isTicking=!1)},e.prototype.handleMouseMove=function(t){var e=this;this.checkMoveable(t.button)&&(this.isDraging&&!this.isTicking&&(this.isTicking=!0,this.rafId=requestAnimationFrame((function(){e.top=e.top-e.lastY+t.clientY,e.left=e.left-e.lastX+t.clientX,e.lastX=t.clientX,e.lastY=t.clientY,e.isTicking=!1}))),t.stopPropagation())},e.prototype.handleTouchStart=function(t){var e=t.touches;e.length>1?(this.isGesturing=!0,this.touches=e):(this.lastX=e[0].clientX,this.lastY=e[0].clientY,this.isDraging=!0),t.stopPropagation()},e.prototype.handleTouchMove=function(t){var e=this;if(!this.isTicking){var n=t.touches;this.checkMoveable()&&!this.isGesturing&&this.isDraging?(this.isTicking=!0,this.rafId=requestAnimationFrame((function(){if(n[0]){var t=n[0].clientX,r=n[0].clientY;e.top=e.top-e.lastY+r,e.left=e.left-e.lastX+t,e.lastX=t,e.lastY=r,e.isTicking=!1}}))):this.isGesturing&&this.touches.length>1&&n.length>1&&(this.isTicking=!0,this.rafId=requestAnimationFrame((function(){var t=(e.getDistance(e.touches[0],e.touches[1])-e.getDistance(n[0],n[1]))/e.imgBaseInfo.width;e.touches=n;var r=e.scale-1.3*t;r>.5&&r<1.5*e.imgBaseInfo.maxScale&&(e.scale=r),e.isTicking=!1})))}},e.prototype.handleTouchEnd=function(t){cancelAnimationFrame(this.rafId),this.isDraging=!1,this.isGesturing=!1,this.isTicking=!1},e.prototype.handleDragStart=function(t){t.preventDefault()},e.prototype.handleKeyPress=function(t){!this.escDisabled&&"Escape"===t.key&&this.visible&&this.closeDialog(),"ArrowLeft"===t.key&&this.onPrevClick(),"ArrowRight"===t.key&&this.onNextClick()},e.prototype.handleWindowResize=function(t){this.getImgSize()},e.prototype.handleTestImgLoad=function(t){this.loading=!1},e.prototype.handleRealImgLoad=function(t){this.getImgSize()},e.prototype.handleImgError=function(t){this.loading=!1,this.loadError=!0,this.$emit("on-error",t)},e.prototype.getImgSize=function(){var t=this.$refs.realImg;if(t){var e=t.width,n=t.height,r=t.naturalWidth;this.imgBaseInfo.maxScale=r/e,this.imgBaseInfo.width=e,this.imgBaseInfo.height=n}},e.prototype.getDistance=function(t,e){var n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)},e.prototype.zoomIn=function(){var t=this.scale+.2;t<3*this.imgBaseInfo.maxScale&&(this.scale=t)},e.prototype.zoomOut=function(){var t=this.scale-.2;t>.1&&(this.scale=t)},e.prototype.rotateLeft=function(){this.rotateDeg-=90},e.prototype.rotateRight=function(){this.rotateDeg+=90},e.prototype.resize=function(){this.scale=1,this.top=0,this.left=0},e.prototype.onNextClick=function(){var t=this.imgIndex,e=this.loop?(t+1)%this.imgList.length:t+1;!this.loop&&e>this.imgList.length-1||this.setIndex(e,["on-next-click","on-next"])},e.prototype.onPrevClick=function(){var t=this.imgIndex,e=t-1;if(0===t){if(!this.loop)return;e=this.imgList.length-1}this.setIndex(e,["on-prev-click","on-prev"])},e.prototype.setIndex=function(t,e){var n=this,r=this.imgIndex;this.reset(),this.imgIndex=t,this.imgList[this.imgIndex]===this.imgList[t]&&this.$nextTick((function(){n.loading=!1})),this.visible&&r!==t&&(e&&($r(e)?e.forEach((function(e){n.$emit(e,r,t)})):this.$emit(e,r,t)),this.$emit("on-index-change",r,t))},e.prototype.closeDialog=function(){this.$emit("hide")},e.prototype.reset=function(){this.scale=1,this.rotateDeg=0,this.top=0,this.left=0,this.isDraging=!1,this.loading=!0,this.loadError=!1},e.prototype.init=function(){var t=this;this.reset();var e=this.imgList.length;if(0===e)return this.imgIndex=0,this.loading=!1,void this.$nextTick((function(){t.loadError=!0}));this.imgIndex=this.index>=e?e-1:this.index<0?0:this.index},e.prototype.onVisibleChanged=function(t){var e=this;t&&(this.init(),this.$nextTick((function(){Dr(e.$refs.modal,"touchmove",(function(t){t.preventDefault()}))})))},e.prototype.onIndexChange=function(t){t<0||t>=this.imgList.length||this.setIndex(t)},e.prototype.mounted=function(){Dr(document,"keydown",this.handleKeyPress),Dr(window,"resize",this.handleWindowResize)},e.prototype.beforeDestroy=function(){Nr(document,"keydown",this.handleKeyPress),Nr(window,"resize",this.handleWindowResize)},Be([nn({type:[Array,String],default:function(){return""}})],e.prototype,"imgs",void 0),Be([nn({type:Boolean,default:!1})],e.prototype,"visible",void 0),Be([nn({type:Number,default:0})],e.prototype,"index",void 0),Be([nn({type:Boolean,default:!1})],e.prototype,"escDisabled",void 0),Be([nn({type:Boolean,default:!1})],e.prototype,"moveDisabled",void 0),Be([nn({type:Boolean,default:!1})],e.prototype,"titleDisabled",void 0),Be([nn({type:Boolean,default:!1})],e.prototype,"loop",void 0),Be([rn("visible",{immediate:!0})],e.prototype,"onVisibleChanged",null),Be([rn("index")],e.prototype,"onIndexChange",null),e=Be([tn({name:"vue-easy-lightbox",components:{SvgIcon:Sr,Toolbar:kr,ImgLoading:Ir,ImgOnError:Er,ImgTitle:Cr}})],e)}(vue__WEBPACK_IMPORTED_MODULE_0___default.a),"data-v-6609e1d4",!1,void 0,!1,wr,void 0,void 0);Xr.install=function(t){t.component("vue-easy-lightbox",Xr)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(Xr.install);/* harmony default export */ __webpack_exports__["default"] = (Xr); 44511 44512/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) 44513 44514/***/ }), 44515 44516/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=template&id=6f9e2405&": 44517/*!*****************************************************************************************************************************************************************************************************************************************************!*\ 44518 !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./Themes/Cynoebook/resources/assets/public/js/components/k2sPlayer/k2sPlayer.vue?vue&type=template&id=6f9e2405& ***! 44519 \*****************************************************************************************************************************************************************************************************************************************************/ 44520/*! exports provided: render, staticRenderFns */ 44521/***/ (function(module, __webpack_exports__, __webpack_require__) { 44522 44523"use strict"; 44524__webpack_require__.r(__webpack_exports__); 44525/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; }); 44526/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; }); 44527var render = function () { 44528 var _vm = this 44529 var _h = _vm.$createElement 44530 var _c = _vm._self._c || _h 44531 return _c("div", { staticClass: "k2s-player-wrapper" }) 44532} 44533var staticRenderFns = [] 44534render._withStripped = true 44535 44536 44537 44538/***/ }), 44539 44540/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=template&id=7e3feff1&": 44541/*!*******************************************************************************************************************************************************************************************************************************************************!*\ 44542 !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./Themes/Cynoebook/resources/assets/public/js/components/tezfiles/tezfilesAuth.vue?vue&type=template&id=7e3feff1& ***! 44543 \*******************************************************************************************************************************************************************************************************************************************************/ 44544/*! exports provided: render, staticRenderFns */ 44545/***/ (function(module, __webpack_exports__, __webpack_require__) { 44546 44547"use strict"; 44548__webpack_require__.r(__webpack_exports__); 44549/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; }); 44550/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; }); 44551var render = function () { 44552 var _vm = this 44553 var _h = _vm.$createElement 44554 var _c = _vm._self._c || _h 44555 return _c("div", { class: { "open-preloader-opacity": _vm.preloader } }, [ 44556 _c("div", { staticClass: "login login-tezfiles form-inner clearfix" }, [ 44557 _vm.preloader 44558 ? _c("div", { staticClass: "preloader-tezfiles-login" }, [ 44559 _c("img", { 44560 staticClass: "preloader", 44561 attrs: { 44562 alt: "preloader tezfiles", 44563 src: "/storage/img/ajax.gif", 44564 }, 44565 }), 44566 ]) 44567 : _vm._e(), 44568 _vm._v(" "), 44569 _c("h3", [_vm._v("Sign in With TezFiles")]), 44570 _vm._v(" "), 44571 _c("div", { staticClass: "sign-in-tez-files" }, [ 44572 _c( 44573 "a", 44574 { 44575 staticClass: "btn btn-tezfiles", 44576 attrs: { href: _vm.urlLoginTezFiles }, 44577 }, 44578 [ 44579 _c("i", { staticClass: "icon-tezfiles" }), 44580 _vm._v("Sign In With TezFiles\n "), 44581 ] 44582 ), 44583 ]), 44584 ]), 44585 ]) 44586} 44587var staticRenderFns = [] 44588render._withStripped = true 44589 44590 44591 44592/***/ }), 44593 44594/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=template&id=01381383&": 44595/*!*************************************************************************************************************************************************************************************************************************************************************!*\ 44596 !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./Themes/Cynoebook/resources/assets/public/js/components/vueEasyLightbox/vueLightbox.vue?vue&type=template&id=01381383& ***! 44597 \*************************************************************************************************************************************************************************************************************************************************************/ 44598/*! exports provided: render, staticRenderFns */ 44599/***/ (function(module, __webpack_exports__, __webpack_require__) { 44600 44601"use strict"; 44602__webpack_require__.r(__webpack_exports__); 44603/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; }); 44604/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; }); 44605var render = function () { 44606 var _vm = this 44607 var _h = _vm.$createElement 44608 var _c = _vm._self._c || _h 44609 return _c("div") 44610} 44611var staticRenderFns = [] 44612render._withStripped = true 44613 44614 44615 44616/***/ }), 44617
vendor: 3,349 bytes, lines 44618-44729
44618/***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js": 44619/*!********************************************************************!*\ 44620 !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***! 44621 \********************************************************************/ 44622/*! exports provided: default */ 44623/***/ (function(module, __webpack_exports__, __webpack_require__) { 44624 44625"use strict"; 44626__webpack_require__.r(__webpack_exports__); 44627/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; }); 44628/* globals __VUE_SSR_CONTEXT__ */ 44629 44630// IMPORTANT: Do NOT use ES2015 features in this file (except for modules). 44631// This module is a runtime utility for cleaner component module output and will 44632// be included in the final webpack user bundle. 44633 44634function normalizeComponent ( 44635 scriptExports, 44636 render, 44637 staticRenderFns, 44638 functionalTemplate, 44639 injectStyles, 44640 scopeId, 44641 moduleIdentifier, /* server only */ 44642 shadowMode /* vue-cli only */ 44643) { 44644 // Vue.extend constructor export interop 44645 var options = typeof scriptExports === 'function' 44646 ? scriptExports.options 44647 : scriptExports 44648 44649 // render functions 44650 if (render) { 44651 options.render = render 44652 options.staticRenderFns = staticRenderFns 44653 options._compiled = true 44654 } 44655 44656 // functional template 44657 if (functionalTemplate) { 44658 options.functional = true 44659 } 44660 44661 // scopedId 44662 if (scopeId) { 44663 options._scopeId = 'data-v-' + scopeId 44664 } 44665 44666 var hook 44667 if (moduleIdentifier) { // server build 44668 hook = function (context) { 44669 // 2.3 injection 44670 context = 44671 context || // cached call 44672 (this.$vnode && this.$vnode.ssrContext) || // stateful 44673 (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional 44674 // 2.2 with runInNewContext: true 44675 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { 44676 context = __VUE_SSR_CONTEXT__ 44677 } 44678 // inject component styles 44679 if (injectStyles) { 44680 injectStyles.call(this, context) 44681 } 44682 // register component module identifier for async chunk inferrence 44683 if (context && context._registeredComponents) { 44684 context._registeredComponents.add(moduleIdentifier) 44685 } 44686 } 44687 // used by ssr in case component is cached and beforeCreate 44688 // never gets called 44689 options._ssrRegister = hook 44690 } else if (injectStyles) { 44691 hook = shadowMode 44692 ? function () { 44693 injectStyles.call( 44694 this, 44695 (options.functional ? this.parent : this).$root.$options.shadowRoot 44696 ) 44697 } 44698 : injectStyles 44699 } 44700 44701 if (hook) { 44702 if (options.functional) { 44703 // for template-only hot-reload because in that case the render fn doesn't 44704 // go through the normalizer 44705 options._injectStyles = hook 44706 // register for functional component in vue file 44707 var originalRender = options.render 44708 options.render = function renderWithStyleInjection (h, context) { 44709 hook.call(context) 44710 return originalRender(h, context) 44711 } 44712 } else { 44713 // inject component registration as beforeCreate hook 44714 var existing = options.beforeCreate 44715 options.beforeCreate = existing 44716 ? [].concat(existing, hook) 44717 : [hook] 44718 } 44719 } 44720 44721 return { 44722 exports: scriptExports, 44723 options: options 44724 } 44725} 44726 44727 44728/***/ }), 44729
vendor: 322,690 bytes, lines 44730-56750
44730/***/ "./node_modules/vue/dist/vue.common.dev.js": 44731/*!*************************************************!*\ 44732 !*** ./node_modules/vue/dist/vue.common.dev.js ***! 44733 \*************************************************/ 44734/*! no static exports found */ 44735/***/ (function(module, exports, __webpack_require__) { 44736 44737"use strict"; 44738/* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*! 44739 * Vue.js v2.6.14 44740 * (c) 2014-2021 Evan You 44741 * Released under the MIT License. 44742 */ 44743 44744 44745/* */ 44746 44747var emptyObject = Object.freeze({}); 44748 44749// These helpers produce better VM code in JS engines due to their 44750// explicitness and function inlining. 44751function isUndef (v) { 44752 return v === undefined || v === null 44753} 44754 44755function isDef (v) { 44756 return v !== undefined && v !== null 44757} 44758 44759function isTrue (v) { 44760 return v === true 44761} 44762 44763function isFalse (v) { 44764 return v === false 44765} 44766 44767/** 44768 * Check if value is primitive. 44769 */ 44770function isPrimitive (value) { 44771 return ( 44772 typeof value === 'string' || 44773 typeof value === 'number' || 44774 // $flow-disable-line 44775 typeof value === 'symbol' || 44776 typeof value === 'boolean' 44777 ) 44778} 44779 44780/** 44781 * Quick object check - this is primarily used to tell 44782 * Objects from primitive values when we know the value 44783 * is a JSON-compliant type. 44784 */ 44785function isObject (obj) { 44786 return obj !== null && typeof obj === 'object' 44787} 44788 44789/** 44790 * Get the raw type string of a value, e.g., [object Object]. 44791 */ 44792var _toString = Object.prototype.toString; 44793 44794function toRawType (value) { 44795 return _toString.call(value).slice(8, -1) 44796} 44797 44798/** 44799 * Strict object type check. Only returns true 44800 * for plain JavaScript objects. 44801 */ 44802function isPlainObject (obj) { 44803 return _toString.call(obj) === '[object Object]' 44804} 44805 44806function isRegExp (v) { 44807 return _toString.call(v) === '[object RegExp]' 44808} 44809 44810/** 44811 * Check if val is a valid array index. 44812 */ 44813function isValidArrayIndex (val) { 44814 var n = parseFloat(String(val)); 44815 return n >= 0 && Math.floor(n) === n && isFinite(val) 44816} 44817 44818function isPromise (val) { 44819 return ( 44820 isDef(val) && 44821 typeof val.then === 'function' && 44822 typeof val.catch === 'function' 44823 ) 44824} 44825 44826/** 44827 * Convert a value to a string that is actually rendered. 44828 */ 44829function toString (val) { 44830 return val == null 44831 ? '' 44832 : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) 44833 ? JSON.stringify(val, null, 2) 44834 : String(val) 44835} 44836 44837/** 44838 * Convert an input value to a number for persistence. 44839 * If the conversion fails, return original string. 44840 */ 44841function toNumber (val) { 44842 var n = parseFloat(val); 44843 return isNaN(n) ? val : n 44844} 44845 44846/** 44847 * Make a map and return a function for checking if a key 44848 * is in that map. 44849 */ 44850function makeMap ( 44851 str, 44852 expectsLowerCase 44853) { 44854 var map = Object.create(null); 44855 var list = str.split(','); 44856 for (var i = 0; i < list.length; i++) { 44857 map[list[i]] = true; 44858 } 44859 return expectsLowerCase 44860 ? function (val) { return map[val.toLowerCase()]; } 44861 : function (val) { return map[val]; } 44862} 44863 44864/** 44865 * Check if a tag is a built-in tag. 44866 */ 44867var isBuiltInTag = makeMap('slot,component', true); 44868 44869/** 44870 * Check if an attribute is a reserved attribute. 44871 */ 44872var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); 44873 44874/** 44875 * Remove an item from an array. 44876 */ 44877function remove (arr, item) { 44878 if (arr.length) { 44879 var index = arr.indexOf(item); 44880 if (index > -1) { 44881 return arr.splice(index, 1) 44882 } 44883 } 44884} 44885 44886/** 44887 * Check whether an object has the property. 44888 */ 44889var hasOwnProperty = Object.prototype.hasOwnProperty; 44890function hasOwn (obj, key) { 44891 return hasOwnProperty.call(obj, key) 44892} 44893 44894/** 44895 * Create a cached version of a pure function. 44896 */ 44897function cached (fn) { 44898 var cache = Object.create(null); 44899 return (function cachedFn (str) { 44900 var hit = cache[str]; 44901 return hit || (cache[str] = fn(str)) 44902 }) 44903} 44904 44905/** 44906 * Camelize a hyphen-delimited string. 44907 */ 44908var camelizeRE = /-(\w)/g; 44909var camelize = cached(function (str) { 44910 return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) 44911}); 44912 44913/** 44914 * Capitalize a string. 44915 */ 44916var capitalize = cached(function (str) { 44917 return str.charAt(0).toUpperCase() + str.slice(1) 44918}); 44919 44920/** 44921 * Hyphenate a camelCase string. 44922 */ 44923var hyphenateRE = /\B([A-Z])/g; 44924var hyphenate = cached(function (str) { 44925 return str.replace(hyphenateRE, '-$1').toLowerCase() 44926}); 44927 44928/** 44929 * Simple bind polyfill for environments that do not support it, 44930 * e.g., PhantomJS 1.x. Technically, we don't need this anymore 44931 * since native bind is now performant enough in most browsers. 44932 * But removing it would mean breaking code that was able to run in 44933 * PhantomJS 1.x, so this must be kept for backward compatibility. 44934 */ 44935 44936/* istanbul ignore next */ 44937function polyfillBind (fn, ctx) { 44938 function boundFn (a) { 44939 var l = arguments.length; 44940 return l 44941 ? l > 1 44942 ? fn.apply(ctx, arguments) 44943 : fn.call(ctx, a) 44944 : fn.call(ctx) 44945 } 44946 44947 boundFn._length = fn.length; 44948 return boundFn 44949} 44950 44951function nativeBind (fn, ctx) { 44952 return fn.bind(ctx) 44953} 44954 44955var bind = Function.prototype.bind 44956 ? nativeBind 44957 : polyfillBind; 44958 44959/** 44960 * Convert an Array-like object to a real Array. 44961 */ 44962function toArray (list, start) { 44963 start = start || 0; 44964 var i = list.length - start; 44965 var ret = new Array(i); 44966 while (i--) { 44967 ret[i] = list[i + start]; 44968 } 44969 return ret 44970} 44971 44972/** 44973 * Mix properties into target object. 44974 */ 44975function extend (to, _from) { 44976 for (var key in _from) { 44977 to[key] = _from[key]; 44978 } 44979 return to 44980} 44981 44982/** 44983 * Merge an Array of Objects into a single Object. 44984 */ 44985function toObject (arr) { 44986 var res = {}; 44987 for (var i = 0; i < arr.length; i++) { 44988 if (arr[i]) { 44989 extend(res, arr[i]); 44990 } 44991 } 44992 return res 44993} 44994 44995/* eslint-disable no-unused-vars */ 44996 44997/** 44998 * Perform no operation. 44999 * Stubbing args to make Flow happy without leaving useless transpiled code 45000 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). 45001 */ 45002function noop (a, b, c) {} 45003 45004/** 45005 * Always return false. 45006 */ 45007var no = function (a, b, c) { return false; }; 45008 45009/* eslint-enable no-unused-vars */ 45010 45011/** 45012 * Return the same value. 45013 */ 45014var identity = function (_) { return _; }; 45015 45016/** 45017 * Generate a string containing static keys from compiler modules. 45018 */ 45019function genStaticKeys (modules) { 45020 return modules.reduce(function (keys, m) { 45021 return keys.concat(m.staticKeys || []) 45022 }, []).join(',') 45023} 45024 45025/** 45026 * Check if two values are loosely equal - that is, 45027 * if they are plain objects, do they have the same shape? 45028 */ 45029function looseEqual (a, b) { 45030 if (a === b) { return true } 45031 var isObjectA = isObject(a); 45032 var isObjectB = isObject(b); 45033 if (isObjectA && isObjectB) { 45034 try { 45035 var isArrayA = Array.isArray(a); 45036 var isArrayB = Array.isArray(b); 45037 if (isArrayA && isArrayB) { 45038 return a.length === b.length && a.every(function (e, i) { 45039 return looseEqual(e, b[i]) 45040 }) 45041 } else if (a instanceof Date && b instanceof Date) { 45042 return a.getTime() === b.getTime() 45043 } else if (!isArrayA && !isArrayB) { 45044 var keysA = Object.keys(a); 45045 var keysB = Object.keys(b); 45046 return keysA.length === keysB.length && keysA.every(function (key) { 45047 return looseEqual(a[key], b[key]) 45048 }) 45049 } else { 45050 /* istanbul ignore next */ 45051 return false 45052 } 45053 } catch (e) { 45054 /* istanbul ignore next */ 45055 return false 45056 } 45057 } else if (!isObjectA && !isObjectB) { 45058 return String(a) === String(b) 45059 } else { 45060 return false 45061 } 45062} 45063 45064/** 45065 * Return the first index at which a loosely equal value can be 45066 * found in the array (if value is a plain object, the array must 45067 * contain an object of the same shape), or -1 if it is not present. 45068 */ 45069function looseIndexOf (arr, val) { 45070 for (var i = 0; i < arr.length; i++) { 45071 if (looseEqual(arr[i], val)) { return i } 45072 } 45073 return -1 45074} 45075 45076/** 45077 * Ensure a function is called only once. 45078 */ 45079function once (fn) { 45080 var called = false; 45081 return function () { 45082 if (!called) { 45083 called = true; 45084 fn.apply(this, arguments); 45085 } 45086 } 45087} 45088 45089var SSR_ATTR = 'data-server-rendered'; 45090 45091var ASSET_TYPES = [ 45092 'component', 45093 'directive', 45094 'filter' 45095]; 45096 45097var LIFECYCLE_HOOKS = [ 45098 'beforeCreate', 45099 'created', 45100 'beforeMount', 45101 'mounted', 45102 'beforeUpdate', 45103 'updated', 45104 'beforeDestroy', 45105 'destroyed', 45106 'activated', 45107 'deactivated', 45108 'errorCaptured', 45109 'serverPrefetch' 45110]; 45111 45112/* */ 45113 45114 45115 45116var config = ({ 45117 /** 45118 * Option merge strategies (used in core/util/options) 45119 */ 45120 // $flow-disable-line 45121 optionMergeStrategies: Object.create(null), 45122 45123 /** 45124 * Whether to suppress warnings. 45125 */ 45126 silent: false, 45127 45128 /** 45129 * Show production mode tip message on boot? 45130 */ 45131 productionTip: "development" !== 'production', 45132 45133 /** 45134 * Whether to enable devtools 45135 */ 45136 devtools: "development" !== 'production', 45137 45138 /** 45139 * Whether to record perf 45140 */ 45141 performance: false, 45142 45143 /** 45144 * Error handler for watcher errors 45145 */ 45146 errorHandler: null, 45147 45148 /** 45149 * Warn handler for watcher warns 45150 */ 45151 warnHandler: null, 45152 45153 /** 45154 * Ignore certain custom elements 45155 */ 45156 ignoredElements: [], 45157 45158 /** 45159 * Custom user key aliases for v-on 45160 */ 45161 // $flow-disable-line 45162 keyCodes: Object.create(null), 45163 45164 /** 45165 * Check if a tag is reserved so that it cannot be registered as a 45166 * component. This is platform-dependent and may be overwritten. 45167 */ 45168 isReservedTag: no, 45169 45170 /** 45171 * Check if an attribute is reserved so that it cannot be used as a component 45172 * prop. This is platform-dependent and may be overwritten. 45173 */ 45174 isReservedAttr: no, 45175 45176 /** 45177 * Check if a tag is an unknown element. 45178 * Platform-dependent. 45179 */ 45180 isUnknownElement: no, 45181 45182 /** 45183 * Get the namespace of an element 45184 */ 45185 getTagNamespace: noop, 45186 45187 /** 45188 * Parse the real tag name for the specific platform. 45189 */ 45190 parsePlatformTagName: identity, 45191 45192 /** 45193 * Check if an attribute must be bound using property, e.g. value 45194 * Platform-dependent. 45195 */ 45196 mustUseProp: no, 45197 45198 /** 45199 * Perform updates asynchronously. Intended to be used by Vue Test Utils 45200 * This will significantly reduce performance if set to false. 45201 */ 45202 async: true, 45203 45204 /** 45205 * Exposed for legacy reasons 45206 */ 45207 _lifecycleHooks: LIFECYCLE_HOOKS 45208}); 45209 45210/* */ 45211 45212/** 45213 * unicode letters used for parsing html tags, component names and property paths. 45214 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname 45215 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS 45216 */ 45217var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/; 45218 45219/** 45220 * Check if a string starts with $ or _ 45221 */ 45222function isReserved (str) { 45223 var c = (str + '').charCodeAt(0); 45224 return c === 0x24 || c === 0x5F 45225} 45226 45227/** 45228 * Define a property. 45229 */ 45230function def (obj, key, val, enumerable) { 45231 Object.defineProperty(obj, key, { 45232 value: val, 45233 enumerable: !!enumerable, 45234 writable: true, 45235 configurable: true 45236 }); 45237} 45238 45239/** 45240 * Parse simple path. 45241 */ 45242var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]")); 45243function parsePath (path) { 45244 if (bailRE.test(path)) { 45245 return 45246 } 45247 var segments = path.split('.'); 45248 return function (obj) { 45249 for (var i = 0; i < segments.length; i++) { 45250 if (!obj) { return } 45251 obj = obj[segments[i]]; 45252 } 45253 return obj 45254 } 45255} 45256 45257/* */ 45258 45259// can we use __proto__? 45260var hasProto = '__proto__' in {}; 45261 45262// Browser environment sniffing 45263var inBrowser = typeof window !== 'undefined'; 45264var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform; 45265var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase(); 45266var UA = inBrowser && window.navigator.userAgent.toLowerCase(); 45267var isIE = UA && /msie|trident/.test(UA); 45268var isIE9 = UA && UA.indexOf('msie 9.0') > 0; 45269var isEdge = UA && UA.indexOf('edge/') > 0; 45270var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android'); 45271var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); 45272var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; 45273var isPhantomJS = UA && /phantomjs/.test(UA); 45274var isFF = UA && UA.match(/firefox\/(\d+)/); 45275 45276// Firefox has a "watch" function on Object.prototype... 45277var nativeWatch = ({}).watch; 45278 45279var supportsPassive = false; 45280if (inBrowser) { 45281 try { 45282 var opts = {}; 45283 Object.defineProperty(opts, 'passive', ({ 45284 get: function get () { 45285 /* istanbul ignore next */ 45286 supportsPassive = true; 45287 } 45288 })); // https://github.com/facebook/flow/issues/285 45289 window.addEventListener('test-passive', null, opts); 45290 } catch (e) {} 45291} 45292 45293// this needs to be lazy-evaled because vue may be required before 45294// vue-server-renderer can set VUE_ENV 45295var _isServer; 45296var isServerRendering = function () { 45297 if (_isServer === undefined) { 45298 /* istanbul ignore if */ 45299 if (!inBrowser && !inWeex && typeof global !== 'undefined') { 45300 // detect presence of vue-server-renderer and avoid 45301 // Webpack shimming the process 45302 _isServer = global['process'] && global['process'].env.VUE_ENV === 'server'; 45303 } else { 45304 _isServer = false; 45305 } 45306 } 45307 return _isServer 45308}; 45309 45310// detect devtools 45311var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; 45312 45313/* istanbul ignore next */ 45314function isNative (Ctor) { 45315 return typeof Ctor === 'function' && /native code/.test(Ctor.toString()) 45316} 45317 45318var hasSymbol = 45319 typeof Symbol !== 'undefined' && isNative(Symbol) && 45320 typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); 45321 45322var _Set; 45323/* istanbul ignore if */ // $flow-disable-line 45324if (typeof Set !== 'undefined' && isNative(Set)) { 45325 // use native Set when available. 45326 _Set = Set; 45327} else { 45328 // a non-standard Set polyfill that only works with primitive keys. 45329 _Set = /*@__PURE__*/(function () { 45330 function Set () { 45331 this.set = Object.create(null); 45332 } 45333 Set.prototype.has = function has (key) { 45334 return this.set[key] === true 45335 }; 45336 Set.prototype.add = function add (key) { 45337 this.set[key] = true; 45338 }; 45339 Set.prototype.clear = function clear () { 45340 this.set = Object.create(null); 45341 }; 45342 45343 return Set; 45344 }()); 45345} 45346 45347/* */ 45348 45349var warn = noop; 45350var tip = noop; 45351var generateComponentTrace = (noop); // work around flow check 45352var formatComponentName = (noop); 45353 45354{ 45355 var hasConsole = typeof console !== 'undefined'; 45356 var classifyRE = /(?:^|[-_])(\w)/g; 45357 var classify = function (str) { return str 45358 .replace(classifyRE, function (c) { return c.toUpperCase(); }) 45359 .replace(/[-_]/g, ''); }; 45360 45361 warn = function (msg, vm) { 45362 var trace = vm ? generateComponentTrace(vm) : ''; 45363 45364 if (config.warnHandler) { 45365 config.warnHandler.call(null, msg, vm, trace); 45366 } else if (hasConsole && (!config.silent)) { 45367 console.error(("[Vue warn]: " + msg + trace)); 45368 } 45369 }; 45370 45371 tip = function (msg, vm) { 45372 if (hasConsole && (!config.silent)) { 45373 console.warn("[Vue tip]: " + msg + ( 45374 vm ? generateComponentTrace(vm) : '' 45375 )); 45376 } 45377 }; 45378 45379 formatComponentName = function (vm, includeFile) { 45380 if (vm.$root === vm) { 45381 return '<Root>' 45382 } 45383 var options = typeof vm === 'function' && vm.cid != null 45384 ? vm.options 45385 : vm._isVue 45386 ? vm.$options || vm.constructor.options 45387 : vm; 45388 var name = options.name || options._componentTag; 45389 var file = options.__file; 45390 if (!name && file) { 45391 var match = file.match(/([^/\\]+)\.vue$/); 45392 name = match && match[1]; 45393 } 45394 45395 return ( 45396 (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") + 45397 (file && includeFile !== false ? (" at " + file) : '') 45398 ) 45399 }; 45400 45401 var repeat = function (str, n) { 45402 var res = ''; 45403 while (n) { 45404 if (n % 2 === 1) { res += str; } 45405 if (n > 1) { str += str; } 45406 n >>= 1; 45407 } 45408 return res 45409 }; 45410 45411 generateComponentTrace = function (vm) { 45412 if (vm._isVue && vm.$parent) { 45413 var tree = []; 45414 var currentRecursiveSequence = 0; 45415 while (vm) { 45416 if (tree.length > 0) { 45417 var last = tree[tree.length - 1]; 45418 if (last.constructor === vm.constructor) { 45419 currentRecursiveSequence++; 45420 vm = vm.$parent; 45421 continue 45422 } else if (currentRecursiveSequence > 0) { 45423 tree[tree.length - 1] = [last, currentRecursiveSequence]; 45424 currentRecursiveSequence = 0; 45425 } 45426 } 45427 tree.push(vm); 45428 vm = vm.$parent; 45429 } 45430 return '\n\nfound in\n\n' + tree 45431 .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm) 45432 ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)") 45433 : formatComponentName(vm))); }) 45434 .join('\n') 45435 } else { 45436 return ("\n\n(found in " + (formatComponentName(vm)) + ")") 45437 } 45438 }; 45439} 45440 45441/* */ 45442 45443var uid = 0; 45444 45445/** 45446 * A dep is an observable that can have multiple 45447 * directives subscribing to it. 45448 */ 45449var Dep = function Dep () { 45450 this.id = uid++; 45451 this.subs = []; 45452}; 45453 45454Dep.prototype.addSub = function addSub (sub) { 45455 this.subs.push(sub); 45456}; 45457 45458Dep.prototype.removeSub = function removeSub (sub) { 45459 remove(this.subs, sub); 45460}; 45461 45462Dep.prototype.depend = function depend () { 45463 if (Dep.target) { 45464 Dep.target.addDep(this); 45465 } 45466}; 45467 45468Dep.prototype.notify = function notify () { 45469 // stabilize the subscriber list first 45470 var subs = this.subs.slice(); 45471 if (!config.async) { 45472 // subs aren't sorted in scheduler if not running async 45473 // we need to sort them now to make sure they fire in correct 45474 // order 45475 subs.sort(function (a, b) { return a.id - b.id; }); 45476 } 45477 for (var i = 0, l = subs.length; i < l; i++) { 45478 subs[i].update(); 45479 } 45480}; 45481 45482// The current target watcher being evaluated. 45483// This is globally unique because only one watcher 45484// can be evaluated at a time. 45485Dep.target = null; 45486var targetStack = []; 45487 45488function pushTarget (target) { 45489 targetStack.push(target); 45490 Dep.target = target; 45491} 45492 45493function popTarget () { 45494 targetStack.pop(); 45495 Dep.target = targetStack[targetStack.length - 1]; 45496} 45497 45498/* */ 45499 45500var VNode = function VNode ( 45501 tag, 45502 data, 45503 children, 45504 text, 45505 elm, 45506 context, 45507 componentOptions, 45508 asyncFactory 45509) { 45510 this.tag = tag; 45511 this.data = data; 45512 this.children = children; 45513 this.text = text; 45514 this.elm = elm; 45515 this.ns = undefined; 45516 this.context = context; 45517 this.fnContext = undefined; 45518 this.fnOptions = undefined; 45519 this.fnScopeId = undefined; 45520 this.key = data && data.key; 45521 this.componentOptions = componentOptions; 45522 this.componentInstance = undefined; 45523 this.parent = undefined; 45524 this.raw = false; 45525 this.isStatic = false; 45526 this.isRootInsert = true; 45527 this.isComment = false; 45528 this.isCloned = false; 45529 this.isOnce = false; 45530 this.asyncFactory = asyncFactory; 45531 this.asyncMeta = undefined; 45532 this.isAsyncPlaceholder = false; 45533}; 45534 45535var prototypeAccessors = { child: { configurable: true } }; 45536 45537// DEPRECATED: alias for componentInstance for backwards compat. 45538/* istanbul ignore next */ 45539prototypeAccessors.child.get = function () { 45540 return this.componentInstance 45541}; 45542 45543Object.defineProperties( VNode.prototype, prototypeAccessors ); 45544 45545var createEmptyVNode = function (text) { 45546 if ( text === void 0 ) text = ''; 45547 45548 var node = new VNode(); 45549 node.text = text; 45550 node.isComment = true; 45551 return node 45552}; 45553 45554function createTextVNode (val) { 45555 return new VNode(undefined, undefined, undefined, String(val)) 45556} 45557 45558// optimized shallow clone 45559// used for static nodes and slot nodes because they may be reused across 45560// multiple renders, cloning them avoids errors when DOM manipulations rely 45561// on their elm reference. 45562function cloneVNode (vnode) { 45563 var cloned = new VNode( 45564 vnode.tag, 45565 vnode.data, 45566 // #7975 45567 // clone children array to avoid mutating original in case of cloning 45568 // a child. 45569 vnode.children && vnode.children.slice(), 45570 vnode.text, 45571 vnode.elm, 45572 vnode.context, 45573 vnode.componentOptions, 45574 vnode.asyncFactory 45575 ); 45576 cloned.ns = vnode.ns; 45577 cloned.isStatic = vnode.isStatic; 45578 cloned.key = vnode.key; 45579 cloned.isComment = vnode.isComment; 45580 cloned.fnContext = vnode.fnContext; 45581 cloned.fnOptions = vnode.fnOptions; 45582 cloned.fnScopeId = vnode.fnScopeId; 45583 cloned.asyncMeta = vnode.asyncMeta; 45584 cloned.isCloned = true; 45585 return cloned 45586} 45587 45588/* 45589 * not type checking this file because flow doesn't play well with 45590 * dynamically accessing methods on Array prototype 45591 */ 45592 45593var arrayProto = Array.prototype; 45594var arrayMethods = Object.create(arrayProto); 45595 45596var methodsToPatch = [ 45597 'push', 45598 'pop', 45599 'shift', 45600 'unshift', 45601 'splice', 45602 'sort', 45603 'reverse' 45604]; 45605 45606/** 45607 * Intercept mutating methods and emit events 45608 */ 45609methodsToPatch.forEach(function (method) { 45610 // cache original method 45611 var original = arrayProto[method]; 45612 def(arrayMethods, method, function mutator () { 45613 var args = [], len = arguments.length; 45614 while ( len-- ) args[ len ] = arguments[ len ]; 45615 45616 var result = original.apply(this, args); 45617 var ob = this.__ob__; 45618 var inserted; 45619 switch (method) { 45620 case 'push': 45621 case 'unshift': 45622 inserted = args; 45623 break 45624 case 'splice': 45625 inserted = args.slice(2); 45626 break 45627 } 45628 if (inserted) { ob.observeArray(inserted); } 45629 // notify change 45630 ob.dep.notify(); 45631 return result 45632 }); 45633}); 45634 45635/* */ 45636 45637var arrayKeys = Object.getOwnPropertyNames(arrayMethods); 45638 45639/** 45640 * In some cases we may want to disable observation inside a component's 45641 * update computation. 45642 */ 45643var shouldObserve = true; 45644 45645function toggleObserving (value) { 45646 shouldObserve = value; 45647} 45648 45649/** 45650 * Observer class that is attached to each observed 45651 * object. Once attached, the observer converts the target 45652 * object's property keys into getter/setters that 45653 * collect dependencies and dispatch updates. 45654 */ 45655var Observer = function Observer (value) { 45656 this.value = value; 45657 this.dep = new Dep(); 45658 this.vmCount = 0; 45659 def(value, '__ob__', this); 45660 if (Array.isArray(value)) { 45661 if (hasProto) { 45662 protoAugment(value, arrayMethods); 45663 } else { 45664 copyAugment(value, arrayMethods, arrayKeys); 45665 } 45666 this.observeArray(value); 45667 } else { 45668 this.walk(value); 45669 } 45670}; 45671 45672/** 45673 * Walk through all properties and convert them into 45674 * getter/setters. This method should only be called when 45675 * value type is Object. 45676 */ 45677Observer.prototype.walk = function walk (obj) { 45678 var keys = Object.keys(obj); 45679 for (var i = 0; i < keys.length; i++) { 45680 defineReactive$$1(obj, keys[i]); 45681 } 45682}; 45683 45684/** 45685 * Observe a list of Array items. 45686 */ 45687Observer.prototype.observeArray = function observeArray (items) { 45688 for (var i = 0, l = items.length; i < l; i++) { 45689 observe(items[i]); 45690 } 45691}; 45692 45693// helpers 45694 45695/** 45696 * Augment a target Object or Array by intercepting 45697 * the prototype chain using __proto__ 45698 */ 45699function protoAugment (target, src) { 45700 /* eslint-disable no-proto */ 45701 target.__proto__ = src; 45702 /* eslint-enable no-proto */ 45703} 45704 45705/** 45706 * Augment a target Object or Array by defining 45707 * hidden properties. 45708 */ 45709/* istanbul ignore next */ 45710function copyAugment (target, src, keys) { 45711 for (var i = 0, l = keys.length; i < l; i++) { 45712 var key = keys[i]; 45713 def(target, key, src[key]); 45714 } 45715} 45716 45717/** 45718 * Attempt to create an observer instance for a value, 45719 * returns the new observer if successfully observed, 45720 * or the existing observer if the value already has one. 45721 */ 45722function observe (value, asRootData) { 45723 if (!isObject(value) || value instanceof VNode) { 45724 return 45725 } 45726 var ob; 45727 if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { 45728 ob = value.__ob__; 45729 } else if ( 45730 shouldObserve && 45731 !isServerRendering() && 45732 (Array.isArray(value) || isPlainObject(value)) && 45733 Object.isExtensible(value) && 45734 !value._isVue 45735 ) { 45736 ob = new Observer(value); 45737 } 45738 if (asRootData && ob) { 45739 ob.vmCount++; 45740 } 45741 return ob 45742} 45743 45744/** 45745 * Define a reactive property on an Object. 45746 */ 45747function defineReactive$$1 ( 45748 obj, 45749 key, 45750 val, 45751 customSetter, 45752 shallow 45753) { 45754 var dep = new Dep(); 45755 45756 var property = Object.getOwnPropertyDescriptor(obj, key); 45757 if (property && property.configurable === false) { 45758 return 45759 } 45760 45761 // cater for pre-defined getter/setters 45762 var getter = property && property.get; 45763 var setter = property && property.set; 45764 if ((!getter || setter) && arguments.length === 2) { 45765 val = obj[key]; 45766 } 45767 45768 var childOb = !shallow && observe(val); 45769 Object.defineProperty(obj, key, { 45770 enumerable: true, 45771 configurable: true, 45772 get: function reactiveGetter () { 45773 var value = getter ? getter.call(obj) : val; 45774 if (Dep.target) { 45775 dep.depend(); 45776 if (childOb) { 45777 childOb.dep.depend(); 45778 if (Array.isArray(value)) { 45779 dependArray(value); 45780 } 45781 } 45782 } 45783 return value 45784 }, 45785 set: function reactiveSetter (newVal) { 45786 var value = getter ? getter.call(obj) : val; 45787 /* eslint-disable no-self-compare */ 45788 if (newVal === value || (newVal !== newVal && value !== value)) { 45789 return 45790 } 45791 /* eslint-enable no-self-compare */ 45792 if (customSetter) { 45793 customSetter(); 45794 } 45795 // #7981: for accessor properties without setter 45796 if (getter && !setter) { return } 45797 if (setter) { 45798 setter.call(obj, newVal); 45799 } else { 45800 val = newVal; 45801 } 45802 childOb = !shallow && observe(newVal); 45803 dep.notify(); 45804 } 45805 }); 45806} 45807 45808/** 45809 * Set a property on an object. Adds the new property and 45810 * triggers change notification if the property doesn't 45811 * already exist. 45812 */ 45813function set (target, key, val) { 45814 if (isUndef(target) || isPrimitive(target) 45815 ) { 45816 warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target)))); 45817 } 45818 if (Array.isArray(target) && isValidArrayIndex(key)) { 45819 target.length = Math.max(target.length, key); 45820 target.splice(key, 1, val); 45821 return val 45822 } 45823 if (key in target && !(key in Object.prototype)) { 45824 target[key] = val; 45825 return val 45826 } 45827 var ob = (target).__ob__; 45828 if (target._isVue || (ob && ob.vmCount)) { 45829 warn( 45830 'Avoid adding reactive properties to a Vue instance or its root $data ' + 45831 'at runtime - declare it upfront in the data option.' 45832 ); 45833 return val 45834 } 45835 if (!ob) { 45836 target[key] = val; 45837 return val 45838 } 45839 defineReactive$$1(ob.value, key, val); 45840 ob.dep.notify(); 45841 return val 45842} 45843 45844/** 45845 * Delete a property and trigger change if necessary. 45846 */ 45847function del (target, key) { 45848 if (isUndef(target) || isPrimitive(target) 45849 ) { 45850 warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target)))); 45851 } 45852 if (Array.isArray(target) && isValidArrayIndex(key)) { 45853 target.splice(key, 1); 45854 return 45855 } 45856 var ob = (target).__ob__; 45857 if (target._isVue || (ob && ob.vmCount)) { 45858 warn( 45859 'Avoid deleting properties on a Vue instance or its root $data ' + 45860 '- just set it to null.' 45861 ); 45862 return 45863 } 45864 if (!hasOwn(target, key)) { 45865 return 45866 } 45867 delete target[key]; 45868 if (!ob) { 45869 return 45870 } 45871 ob.dep.notify(); 45872} 45873 45874/** 45875 * Collect dependencies on array elements when the array is touched, since 45876 * we cannot intercept array element access like property getters. 45877 */ 45878function dependArray (value) { 45879 for (var e = (void 0), i = 0, l = value.length; i < l; i++) { 45880 e = value[i]; 45881 e && e.__ob__ && e.__ob__.dep.depend(); 45882 if (Array.isArray(e)) { 45883 dependArray(e); 45884 } 45885 } 45886} 45887 45888/* */ 45889 45890/** 45891 * Option overwriting strategies are functions that handle 45892 * how to merge a parent option value and a child option 45893 * value into the final value. 45894 */ 45895var strats = config.optionMergeStrategies; 45896 45897/** 45898 * Options with restrictions 45899 */ 45900{ 45901 strats.el = strats.propsData = function (parent, child, vm, key) { 45902 if (!vm) { 45903 warn( 45904 "option \"" + key + "\" can only be used during instance " + 45905 'creation with the `new` keyword.' 45906 ); 45907 } 45908 return defaultStrat(parent, child) 45909 }; 45910} 45911 45912/** 45913 * Helper that recursively merges two data objects together. 45914 */ 45915function mergeData (to, from) { 45916 if (!from) { return to } 45917 var key, toVal, fromVal; 45918 45919 var keys = hasSymbol 45920 ? Reflect.ownKeys(from) 45921 : Object.keys(from); 45922 45923 for (var i = 0; i < keys.length; i++) { 45924 key = keys[i]; 45925 // in case the object is already observed... 45926 if (key === '__ob__') { continue } 45927 toVal = to[key]; 45928 fromVal = from[key]; 45929 if (!hasOwn(to, key)) { 45930 set(to, key, fromVal); 45931 } else if ( 45932 toVal !== fromVal && 45933 isPlainObject(toVal) && 45934 isPlainObject(fromVal) 45935 ) { 45936 mergeData(toVal, fromVal); 45937 } 45938 } 45939 return to 45940} 45941 45942/** 45943 * Data 45944 */ 45945function mergeDataOrFn ( 45946 parentVal, 45947 childVal, 45948 vm 45949) { 45950 if (!vm) { 45951 // in a Vue.extend merge, both should be functions 45952 if (!childVal) { 45953 return parentVal 45954 } 45955 if (!parentVal) { 45956 return childVal 45957 } 45958 // when parentVal & childVal are both present, 45959 // we need to return a function that returns the 45960 // merged result of both functions... no need to 45961 // check if parentVal is a function here because 45962 // it has to be a function to pass previous merges. 45963 return function mergedDataFn () { 45964 return mergeData( 45965 typeof childVal === 'function' ? childVal.call(this, this) : childVal, 45966 typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal 45967 ) 45968 } 45969 } else { 45970 return function mergedInstanceDataFn () { 45971 // instance merge 45972 var instanceData = typeof childVal === 'function' 45973 ? childVal.call(vm, vm) 45974 : childVal; 45975 var defaultData = typeof parentVal === 'function' 45976 ? parentVal.call(vm, vm) 45977 : parentVal; 45978 if (instanceData) { 45979 return mergeData(instanceData, defaultData) 45980 } else { 45981 return defaultData 45982 } 45983 } 45984 } 45985} 45986 45987strats.data = function ( 45988 parentVal, 45989 childVal, 45990 vm 45991) { 45992 if (!vm) { 45993 if (childVal && typeof childVal !== 'function') { 45994 warn( 45995 'The "data" option should be a function ' + 45996 'that returns a per-instance value in component ' + 45997 'definitions.', 45998 vm 45999 ); 46000 46001 return parentVal 46002 } 46003 return mergeDataOrFn(parentVal, childVal) 46004 } 46005 46006 return mergeDataOrFn(parentVal, childVal, vm) 46007}; 46008 46009/** 46010 * Hooks and props are merged as arrays. 46011 */ 46012function mergeHook ( 46013 parentVal, 46014 childVal 46015) { 46016 var res = childVal 46017 ? parentVal 46018 ? parentVal.concat(childVal) 46019 : Array.isArray(childVal) 46020 ? childVal 46021 : [childVal] 46022 : parentVal; 46023 return res 46024 ? dedupeHooks(res) 46025 : res 46026} 46027 46028function dedupeHooks (hooks) { 46029 var res = []; 46030 for (var i = 0; i < hooks.length; i++) { 46031 if (res.indexOf(hooks[i]) === -1) { 46032 res.push(hooks[i]); 46033 } 46034 } 46035 return res 46036} 46037 46038LIFECYCLE_HOOKS.forEach(function (hook) { 46039 strats[hook] = mergeHook; 46040}); 46041 46042/** 46043 * Assets 46044 * 46045 * When a vm is present (instance creation), we need to do 46046 * a three-way merge between constructor options, instance 46047 * options and parent options. 46048 */ 46049function mergeAssets ( 46050 parentVal, 46051 childVal, 46052 vm, 46053 key 46054) { 46055 var res = Object.create(parentVal || null); 46056 if (childVal) { 46057 assertObjectType(key, childVal, vm); 46058 return extend(res, childVal) 46059 } else { 46060 return res 46061 } 46062} 46063 46064ASSET_TYPES.forEach(function (type) { 46065 strats[type + 's'] = mergeAssets; 46066}); 46067 46068/** 46069 * Watchers. 46070 * 46071 * Watchers hashes should not overwrite one 46072 * another, so we merge them as arrays. 46073 */ 46074strats.watch = function ( 46075 parentVal, 46076 childVal, 46077 vm, 46078 key 46079) { 46080 // work around Firefox's Object.prototype.watch... 46081 if (parentVal === nativeWatch) { parentVal = undefined; } 46082 if (childVal === nativeWatch) { childVal = undefined; } 46083 /* istanbul ignore if */ 46084 if (!childVal) { return Object.create(parentVal || null) } 46085 { 46086 assertObjectType(key, childVal, vm); 46087 } 46088 if (!parentVal) { return childVal } 46089 var ret = {}; 46090 extend(ret, parentVal); 46091 for (var key$1 in childVal) { 46092 var parent = ret[key$1]; 46093 var child = childVal[key$1]; 46094 if (parent && !Array.isArray(parent)) { 46095 parent = [parent]; 46096 } 46097 ret[key$1] = parent 46098 ? parent.concat(child) 46099 : Array.isArray(child) ? child : [child]; 46100 } 46101 return ret 46102}; 46103 46104/** 46105 * Other object hashes. 46106 */ 46107strats.props = 46108strats.methods = 46109strats.inject = 46110strats.computed = function ( 46111 parentVal, 46112 childVal, 46113 vm, 46114 key 46115) { 46116 if (childVal && "development" !== 'production') { 46117 assertObjectType(key, childVal, vm); 46118 } 46119 if (!parentVal) { return childVal } 46120 var ret = Object.create(null); 46121 extend(ret, parentVal); 46122 if (childVal) { extend(ret, childVal); } 46123 return ret 46124}; 46125strats.provide = mergeDataOrFn; 46126 46127/** 46128 * Default strategy. 46129 */ 46130var defaultStrat = function (parentVal, childVal) { 46131 return childVal === undefined 46132 ? parentVal 46133 : childVal 46134}; 46135 46136/** 46137 * Validate component names 46138 */ 46139function checkComponents (options) { 46140 for (var key in options.components) { 46141 validateComponentName(key); 46142 } 46143} 46144 46145function validateComponentName (name) { 46146 if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) { 46147 warn( 46148 'Invalid component name: "' + name + '". Component names ' + 46149 'should conform to valid custom element name in html5 specification.' 46150 ); 46151 } 46152 if (isBuiltInTag(name) || config.isReservedTag(name)) { 46153 warn( 46154 'Do not use built-in or reserved HTML elements as component ' + 46155 'id: ' + name 46156 ); 46157 } 46158} 46159 46160/** 46161 * Ensure all props option syntax are normalized into the 46162 * Object-based format. 46163 */ 46164function normalizeProps (options, vm) { 46165 var props = options.props; 46166 if (!props) { return } 46167 var res = {}; 46168 var i, val, name; 46169 if (Array.isArray(props)) { 46170 i = props.length; 46171 while (i--) { 46172 val = props[i]; 46173 if (typeof val === 'string') { 46174 name = camelize(val); 46175 res[name] = { type: null }; 46176 } else { 46177 warn('props must be strings when using array syntax.'); 46178 } 46179 } 46180 } else if (isPlainObject(props)) { 46181 for (var key in props) { 46182 val = props[key]; 46183 name = camelize(key); 46184 res[name] = isPlainObject(val) 46185 ? val 46186 : { type: val }; 46187 } 46188 } else { 46189 warn( 46190 "Invalid value for option \"props\": expected an Array or an Object, " + 46191 "but got " + (toRawType(props)) + ".", 46192 vm 46193 ); 46194 } 46195 options.props = res; 46196} 46197 46198/** 46199 * Normalize all injections into Object-based format 46200 */ 46201function normalizeInject (options, vm) { 46202 var inject = options.inject; 46203 if (!inject) { return } 46204 var normalized = options.inject = {}; 46205 if (Array.isArray(inject)) { 46206 for (var i = 0; i < inject.length; i++) { 46207 normalized[inject[i]] = { from: inject[i] }; 46208 } 46209 } else if (isPlainObject(inject)) { 46210 for (var key in inject) { 46211 var val = inject[key]; 46212 normalized[key] = isPlainObject(val) 46213 ? extend({ from: key }, val) 46214 : { from: val }; 46215 } 46216 } else { 46217 warn( 46218 "Invalid value for option \"inject\": expected an Array or an Object, " + 46219 "but got " + (toRawType(inject)) + ".", 46220 vm 46221 ); 46222 } 46223} 46224 46225/** 46226 * Normalize raw function directives into object format. 46227 */ 46228function normalizeDirectives (options) { 46229 var dirs = options.directives; 46230 if (dirs) { 46231 for (var key in dirs) { 46232 var def$$1 = dirs[key]; 46233 if (typeof def$$1 === 'function') { 46234 dirs[key] = { bind: def$$1, update: def$$1 }; 46235 } 46236 } 46237 } 46238} 46239 46240function assertObjectType (name, value, vm) { 46241 if (!isPlainObject(value)) { 46242 warn( 46243 "Invalid value for option \"" + name + "\": expected an Object, " + 46244 "but got " + (toRawType(value)) + ".", 46245 vm 46246 ); 46247 } 46248} 46249 46250/** 46251 * Merge two option objects into a new one. 46252 * Core utility used in both instantiation and inheritance. 46253 */ 46254function mergeOptions ( 46255 parent, 46256 child, 46257 vm 46258) { 46259 { 46260 checkComponents(child); 46261 } 46262 46263 if (typeof child === 'function') { 46264 child = child.options; 46265 } 46266 46267 normalizeProps(child, vm); 46268 normalizeInject(child, vm); 46269 normalizeDirectives(child); 46270 46271 // Apply extends and mixins on the child options, 46272 // but only if it is a raw options object that isn't 46273 // the result of another mergeOptions call. 46274 // Only merged options has the _base property. 46275 if (!child._base) { 46276 if (child.extends) { 46277 parent = mergeOptions(parent, child.extends, vm); 46278 } 46279 if (child.mixins) { 46280 for (var i = 0, l = child.mixins.length; i < l; i++) { 46281 parent = mergeOptions(parent, child.mixins[i], vm); 46282 } 46283 } 46284 } 46285 46286 var options = {}; 46287 var key; 46288 for (key in parent) { 46289 mergeField(key); 46290 } 46291 for (key in child) { 46292 if (!hasOwn(parent, key)) { 46293 mergeField(key); 46294 } 46295 } 46296 function mergeField (key) { 46297 var strat = strats[key] || defaultStrat; 46298 options[key] = strat(parent[key], child[key], vm, key); 46299 } 46300 return options 46301} 46302 46303/** 46304 * Resolve an asset. 46305 * This function is used because child instances need access 46306 * to assets defined in its ancestor chain. 46307 */ 46308function resolveAsset ( 46309 options, 46310 type, 46311 id, 46312 warnMissing 46313) { 46314 /* istanbul ignore if */ 46315 if (typeof id !== 'string') { 46316 return 46317 } 46318 var assets = options[type]; 46319 // check local registration variations first 46320 if (hasOwn(assets, id)) { return assets[id] } 46321 var camelizedId = camelize(id); 46322 if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } 46323 var PascalCaseId = capitalize(camelizedId); 46324 if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } 46325 // fallback to prototype chain 46326 var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; 46327 if (warnMissing && !res) { 46328 warn( 46329 'Failed to resolve ' + type.slice(0, -1) + ': ' + id, 46330 options 46331 ); 46332 } 46333 return res 46334} 46335 46336/* */ 46337 46338 46339 46340function validateProp ( 46341 key, 46342 propOptions, 46343 propsData, 46344 vm 46345) { 46346 var prop = propOptions[key]; 46347 var absent = !hasOwn(propsData, key); 46348 var value = propsData[key]; 46349 // boolean casting 46350 var booleanIndex = getTypeIndex(Boolean, prop.type); 46351 if (booleanIndex > -1) { 46352 if (absent && !hasOwn(prop, 'default')) { 46353 value = false; 46354 } else if (value === '' || value === hyphenate(key)) { 46355 // only cast empty string / same name to boolean if 46356 // boolean has higher priority 46357 var stringIndex = getTypeIndex(String, prop.type); 46358 if (stringIndex < 0 || booleanIndex < stringIndex) { 46359 value = true; 46360 } 46361 } 46362 } 46363 // check default value 46364 if (value === undefined) { 46365 value = getPropDefaultValue(vm, prop, key); 46366 // since the default value is a fresh copy, 46367 // make sure to observe it. 46368 var prevShouldObserve = shouldObserve; 46369 toggleObserving(true); 46370 observe(value); 46371 toggleObserving(prevShouldObserve); 46372 } 46373 { 46374 assertProp(prop, key, value, vm, absent); 46375 } 46376 return value 46377} 46378 46379/** 46380 * Get the default value of a prop. 46381 */ 46382function getPropDefaultValue (vm, prop, key) { 46383 // no default, return undefined 46384 if (!hasOwn(prop, 'default')) { 46385 return undefined 46386 } 46387 var def = prop.default; 46388 // warn against non-factory defaults for Object & Array 46389 if (isObject(def)) { 46390 warn( 46391 'Invalid default value for prop "' + key + '": ' + 46392 'Props with type Object/Array must use a factory function ' + 46393 'to return the default value.', 46394 vm 46395 ); 46396 } 46397 // the raw prop value was also undefined from previous render, 46398 // return previous default value to avoid unnecessary watcher trigger 46399 if (vm && vm.$options.propsData && 46400 vm.$options.propsData[key] === undefined && 46401 vm._props[key] !== undefined 46402 ) { 46403 return vm._props[key] 46404 } 46405 // call factory function for non-Function types 46406 // a value is Function if its prototype is function even across different execution context 46407 return typeof def === 'function' && getType(prop.type) !== 'Function' 46408 ? def.call(vm) 46409 : def 46410} 46411 46412/** 46413 * Assert whether a prop is valid. 46414 */ 46415function assertProp ( 46416 prop, 46417 name, 46418 value, 46419 vm, 46420 absent 46421) { 46422 if (prop.required && absent) { 46423 warn( 46424 'Missing required prop: "' + name + '"', 46425 vm 46426 ); 46427 return 46428 } 46429 if (value == null && !prop.required) { 46430 return 46431 } 46432 var type = prop.type; 46433 var valid = !type || type === true; 46434 var expectedTypes = []; 46435 if (type) { 46436 if (!Array.isArray(type)) { 46437 type = [type]; 46438 } 46439 for (var i = 0; i < type.length && !valid; i++) { 46440 var assertedType = assertType(value, type[i], vm); 46441 expectedTypes.push(assertedType.expectedType || ''); 46442 valid = assertedType.valid; 46443 } 46444 } 46445 46446 var haveExpectedTypes = expectedTypes.some(function (t) { return t; }); 46447 if (!valid && haveExpectedTypes) { 46448 warn( 46449 getInvalidTypeMessage(name, value, expectedTypes), 46450 vm 46451 ); 46452 return 46453 } 46454 var validator = prop.validator; 46455 if (validator) { 46456 if (!validator(value)) { 46457 warn( 46458 'Invalid prop: custom validator check failed for prop "' + name + '".', 46459 vm 46460 ); 46461 } 46462 } 46463} 46464 46465var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/; 46466 46467function assertType (value, type, vm) { 46468 var valid; 46469 var expectedType = getType(type); 46470 if (simpleCheckRE.test(expectedType)) { 46471 var t = typeof value; 46472 valid = t === expectedType.toLowerCase(); 46473 // for primitive wrapper objects 46474 if (!valid && t === 'object') { 46475 valid = value instanceof type; 46476 } 46477 } else if (expectedType === 'Object') { 46478 valid = isPlainObject(value); 46479 } else if (expectedType === 'Array') { 46480 valid = Array.isArray(value); 46481 } else { 46482 try { 46483 valid = value instanceof type; 46484 } catch (e) { 46485 warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm); 46486 valid = false; 46487 } 46488 } 46489 return { 46490 valid: valid, 46491 expectedType: expectedType 46492 } 46493} 46494 46495var functionTypeCheckRE = /^\s*function (\w+)/; 46496 46497/** 46498 * Use function string name to check built-in types, 46499 * because a simple equality check will fail when running 46500 * across different vms / iframes. 46501 */ 46502function getType (fn) { 46503 var match = fn && fn.toString().match(functionTypeCheckRE); 46504 return match ? match[1] : '' 46505} 46506 46507function isSameType (a, b) { 46508 return getType(a) === getType(b) 46509} 46510 46511function getTypeIndex (type, expectedTypes) { 46512 if (!Array.isArray(expectedTypes)) { 46513 return isSameType(expectedTypes, type) ? 0 : -1 46514 } 46515 for (var i = 0, len = expectedTypes.length; i < len; i++) { 46516 if (isSameType(expectedTypes[i], type)) { 46517 return i 46518 } 46519 } 46520 return -1 46521} 46522 46523function getInvalidTypeMessage (name, value, expectedTypes) { 46524 var message = "Invalid prop: type check failed for prop \"" + name + "\"." + 46525 " Expected " + (expectedTypes.map(capitalize).join(', ')); 46526 var expectedType = expectedTypes[0]; 46527 var receivedType = toRawType(value); 46528 // check if we need to specify expected value 46529 if ( 46530 expectedTypes.length === 1 && 46531 isExplicable(expectedType) && 46532 isExplicable(typeof value) && 46533 !isBoolean(expectedType, receivedType) 46534 ) { 46535 message += " with value " + (styleValue(value, expectedType)); 46536 } 46537 message += ", got " + receivedType + " "; 46538 // check if we need to specify received value 46539 if (isExplicable(receivedType)) { 46540 message += "with value " + (styleValue(value, receivedType)) + "."; 46541 } 46542 return message 46543} 46544 46545function styleValue (value, type) { 46546 if (type === 'String') { 46547 return ("\"" + value + "\"") 46548 } else if (type === 'Number') { 46549 return ("" + (Number(value))) 46550 } else { 46551 return ("" + value) 46552 } 46553} 46554 46555var EXPLICABLE_TYPES = ['string', 'number', 'boolean']; 46556function isExplicable (value) { 46557 return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; }) 46558} 46559 46560function isBoolean () { 46561 var args = [], len = arguments.length; 46562 while ( len-- ) args[ len ] = arguments[ len ]; 46563 46564 return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; }) 46565} 46566 46567/* */ 46568 46569function handleError (err, vm, info) { 46570 // Deactivate deps tracking while processing error handler to avoid possible infinite rendering. 46571 // See: https://github.com/vuejs/vuex/issues/1505 46572 pushTarget(); 46573 try { 46574 if (vm) { 46575 var cur = vm; 46576 while ((cur = cur.$parent)) { 46577 var hooks = cur.$options.errorCaptured; 46578 if (hooks) { 46579 for (var i = 0; i < hooks.length; i++) { 46580 try { 46581 var capture = hooks[i].call(cur, err, vm, info) === false; 46582 if (capture) { return } 46583 } catch (e) { 46584 globalHandleError(e, cur, 'errorCaptured hook'); 46585 } 46586 } 46587 } 46588 } 46589 } 46590 globalHandleError(err, vm, info); 46591 } finally { 46592 popTarget(); 46593 } 46594} 46595 46596function invokeWithErrorHandling ( 46597 handler, 46598 context, 46599 args, 46600 vm, 46601 info 46602) { 46603 var res; 46604 try { 46605 res = args ? handler.apply(context, args) : handler.call(context); 46606 if (res && !res._isVue && isPromise(res) && !res._handled) { 46607 res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); }); 46608 // issue #9511 46609 // avoid catch triggering multiple times when nested calls 46610 res._handled = true; 46611 } 46612 } catch (e) { 46613 handleError(e, vm, info); 46614 } 46615 return res 46616} 46617 46618function globalHandleError (err, vm, info) { 46619 if (config.errorHandler) { 46620 try { 46621 return config.errorHandler.call(null, err, vm, info) 46622 } catch (e) { 46623 // if the user intentionally throws the original error in the handler, 46624 // do not log it twice 46625 if (e !== err) { 46626 logError(e, null, 'config.errorHandler'); 46627 } 46628 } 46629 } 46630 logError(err, vm, info); 46631} 46632 46633function logError (err, vm, info) { 46634 { 46635 warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm); 46636 } 46637 /* istanbul ignore else */ 46638 if ((inBrowser || inWeex) && typeof console !== 'undefined') { 46639 console.error(err); 46640 } else { 46641 throw err 46642 } 46643} 46644 46645/* */ 46646 46647var isUsingMicroTask = false; 46648 46649var callbacks = []; 46650var pending = false; 46651 46652function flushCallbacks () { 46653 pending = false; 46654 var copies = callbacks.slice(0); 46655 callbacks.length = 0; 46656 for (var i = 0; i < copies.length; i++) { 46657 copies[i](); 46658 } 46659} 46660 46661// Here we have async deferring wrappers using microtasks. 46662// In 2.5 we used (macro) tasks (in combination with microtasks). 46663// However, it has subtle problems when state is changed right before repaint 46664// (e.g. #6813, out-in transitions). 46665// Also, using (macro) tasks in event handler would cause some weird behaviors 46666// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109). 46667// So we now use microtasks everywhere, again. 46668// A major drawback of this tradeoff is that there are some scenarios 46669// where microtasks have too high a priority and fire in between supposedly 46670// sequential events (e.g. #4521, #6690, which have workarounds) 46671// or even between bubbling of the same event (#6566). 46672var timerFunc; 46673 46674// The nextTick behavior leverages the microtask queue, which can be accessed 46675// via either native Promise.then or MutationObserver. 46676// MutationObserver has wider support, however it is seriously bugged in 46677// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It 46678// completely stops working after triggering a few times... so, if native 46679// Promise is available, we will use it: 46680/* istanbul ignore next, $flow-disable-line */ 46681if (typeof Promise !== 'undefined' && isNative(Promise)) { 46682 var p = Promise.resolve(); 46683 timerFunc = function () { 46684 p.then(flushCallbacks); 46685 // In problematic UIWebViews, Promise.then doesn't completely break, but 46686 // it can get stuck in a weird state where callbacks are pushed into the 46687 // microtask queue but the queue isn't being flushed, until the browser 46688 // needs to do some other work, e.g. handle a timer. Therefore we can 46689 // "force" the microtask queue to be flushed by adding an empty timer. 46690 if (isIOS) { setTimeout(noop); } 46691 }; 46692 isUsingMicroTask = true; 46693} else if (!isIE && typeof MutationObserver !== 'undefined' && ( 46694 isNative(MutationObserver) || 46695 // PhantomJS and iOS 7.x 46696 MutationObserver.toString() === '[object MutationObserverConstructor]' 46697)) { 46698 // Use MutationObserver where native Promise is not available, 46699 // e.g. PhantomJS, iOS7, Android 4.4 46700 // (#6466 MutationObserver is unreliable in IE11) 46701 var counter = 1; 46702 var observer = new MutationObserver(flushCallbacks); 46703 var textNode = document.createTextNode(String(counter)); 46704 observer.observe(textNode, { 46705 characterData: true 46706 }); 46707 timerFunc = function () { 46708 counter = (counter + 1) % 2; 46709 textNode.data = String(counter); 46710 }; 46711 isUsingMicroTask = true; 46712} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { 46713 // Fallback to setImmediate. 46714 // Technically it leverages the (macro) task queue, 46715 // but it is still a better choice than setTimeout. 46716 timerFunc = function () { 46717 setImmediate(flushCallbacks); 46718 }; 46719} else { 46720 // Fallback to setTimeout. 46721 timerFunc = function () { 46722 setTimeout(flushCallbacks, 0); 46723 }; 46724} 46725 46726function nextTick (cb, ctx) { 46727 var _resolve; 46728 callbacks.push(function () { 46729 if (cb) { 46730 try { 46731 cb.call(ctx); 46732 } catch (e) { 46733 handleError(e, ctx, 'nextTick'); 46734 } 46735 } else if (_resolve) { 46736 _resolve(ctx); 46737 } 46738 }); 46739 if (!pending) { 46740 pending = true; 46741 timerFunc(); 46742 } 46743 // $flow-disable-line 46744 if (!cb && typeof Promise !== 'undefined') { 46745 return new Promise(function (resolve) { 46746 _resolve = resolve; 46747 }) 46748 } 46749} 46750 46751/* */ 46752 46753var mark; 46754var measure; 46755 46756{ 46757 var perf = inBrowser && window.performance; 46758 /* istanbul ignore if */ 46759 if ( 46760 perf && 46761 perf.mark && 46762 perf.measure && 46763 perf.clearMarks && 46764 perf.clearMeasures 46765 ) { 46766 mark = function (tag) { return perf.mark(tag); }; 46767 measure = function (name, startTag, endTag) { 46768 perf.measure(name, startTag, endTag); 46769 perf.clearMarks(startTag); 46770 perf.clearMarks(endTag); 46771 // perf.clearMeasures(name) 46772 }; 46773 } 46774} 46775 46776/* not type checking this file because flow doesn't play well with Proxy */ 46777 46778var initProxy; 46779 46780{ 46781 var allowedGlobals = makeMap( 46782 'Infinity,undefined,NaN,isFinite,isNaN,' + 46783 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + 46784 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' + 46785 'require' // for Webpack/Browserify 46786 ); 46787 46788 var warnNonPresent = function (target, key) { 46789 warn( 46790 "Property or method \"" + key + "\" is not defined on the instance but " + 46791 'referenced during render. Make sure that this property is reactive, ' + 46792 'either in the data option, or for class-based components, by ' + 46793 'initializing the property. ' + 46794 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', 46795 target 46796 ); 46797 }; 46798 46799 var warnReservedPrefix = function (target, key) { 46800 warn( 46801 "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " + 46802 'properties starting with "$" or "_" are not proxied in the Vue instance to ' + 46803 'prevent conflicts with Vue internals. ' + 46804 'See: https://vuejs.org/v2/api/#data', 46805 target 46806 ); 46807 }; 46808 46809 var hasProxy = 46810 typeof Proxy !== 'undefined' && isNative(Proxy); 46811 46812 if (hasProxy) { 46813 var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact'); 46814 config.keyCodes = new Proxy(config.keyCodes, { 46815 set: function set (target, key, value) { 46816 if (isBuiltInModifier(key)) { 46817 warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key)); 46818 return false 46819 } else { 46820 target[key] = value; 46821 return true 46822 } 46823 } 46824 }); 46825 } 46826 46827 var hasHandler = { 46828 has: function has (target, key) { 46829 var has = key in target; 46830 var isAllowed = allowedGlobals(key) || 46831 (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data)); 46832 if (!has && !isAllowed) { 46833 if (key in target.$data) { warnReservedPrefix(target, key); } 46834 else { warnNonPresent(target, key); } 46835 } 46836 return has || !isAllowed 46837 } 46838 }; 46839 46840 var getHandler = { 46841 get: function get (target, key) { 46842 if (typeof key === 'string' && !(key in target)) { 46843 if (key in target.$data) { warnReservedPrefix(target, key); } 46844 else { warnNonPresent(target, key); } 46845 } 46846 return target[key] 46847 } 46848 }; 46849 46850 initProxy = function initProxy (vm) { 46851 if (hasProxy) { 46852 // determine which proxy handler to use 46853 var options = vm.$options; 46854 var handlers = options.render && options.render._withStripped 46855 ? getHandler 46856 : hasHandler; 46857 vm._renderProxy = new Proxy(vm, handlers); 46858 } else { 46859 vm._renderProxy = vm; 46860 } 46861 }; 46862} 46863 46864/* */ 46865 46866var seenObjects = new _Set(); 46867 46868/** 46869 * Recursively traverse an object to evoke all converted 46870 * getters, so that every nested property inside the object 46871 * is collected as a "deep" dependency. 46872 */ 46873function traverse (val) { 46874 _traverse(val, seenObjects); 46875 seenObjects.clear(); 46876} 46877 46878function _traverse (val, seen) { 46879 var i, keys; 46880 var isA = Array.isArray(val); 46881 if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) { 46882 return 46883 } 46884 if (val.__ob__) { 46885 var depId = val.__ob__.dep.id; 46886 if (seen.has(depId)) { 46887 return 46888 } 46889 seen.add(depId); 46890 } 46891 if (isA) { 46892 i = val.length; 46893 while (i--) { _traverse(val[i], seen); } 46894 } else { 46895 keys = Object.keys(val); 46896 i = keys.length; 46897 while (i--) { _traverse(val[keys[i]], seen); } 46898 } 46899} 46900 46901/* */ 46902 46903var normalizeEvent = cached(function (name) { 46904 var passive = name.charAt(0) === '&'; 46905 name = passive ? name.slice(1) : name; 46906 var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first 46907 name = once$$1 ? name.slice(1) : name; 46908 var capture = name.charAt(0) === '!'; 46909 name = capture ? name.slice(1) : name; 46910 return { 46911 name: name, 46912 once: once$$1, 46913 capture: capture, 46914 passive: passive 46915 } 46916}); 46917 46918function createFnInvoker (fns, vm) { 46919 function invoker () { 46920 var arguments$1 = arguments; 46921 46922 var fns = invoker.fns; 46923 if (Array.isArray(fns)) { 46924 var cloned = fns.slice(); 46925 for (var i = 0; i < cloned.length; i++) { 46926 invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler"); 46927 } 46928 } else { 46929 // return handler return value for single handlers 46930 return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler") 46931 } 46932 } 46933 invoker.fns = fns; 46934 return invoker 46935} 46936 46937function updateListeners ( 46938 on, 46939 oldOn, 46940 add, 46941 remove$$1, 46942 createOnceHandler, 46943 vm 46944) { 46945 var name, def$$1, cur, old, event; 46946 for (name in on) { 46947 def$$1 = cur = on[name]; 46948 old = oldOn[name]; 46949 event = normalizeEvent(name); 46950 if (isUndef(cur)) { 46951 warn( 46952 "Invalid handler for event \"" + (event.name) + "\": got " + String(cur), 46953 vm 46954 ); 46955 } else if (isUndef(old)) { 46956 if (isUndef(cur.fns)) { 46957 cur = on[name] = createFnInvoker(cur, vm); 46958 } 46959 if (isTrue(event.once)) { 46960 cur = on[name] = createOnceHandler(event.name, cur, event.capture); 46961 } 46962 add(event.name, cur, event.capture, event.passive, event.params); 46963 } else if (cur !== old) { 46964 old.fns = cur; 46965 on[name] = old; 46966 } 46967 } 46968 for (name in oldOn) { 46969 if (isUndef(on[name])) { 46970 event = normalizeEvent(name); 46971 remove$$1(event.name, oldOn[name], event.capture); 46972 } 46973 } 46974} 46975 46976/* */ 46977 46978function mergeVNodeHook (def, hookKey, hook) { 46979 if (def instanceof VNode) { 46980 def = def.data.hook || (def.data.hook = {}); 46981 } 46982 var invoker; 46983 var oldHook = def[hookKey]; 46984 46985 function wrappedHook () { 46986 hook.apply(this, arguments); 46987 // important: remove merged hook to ensure it's called only once 46988 // and prevent memory leak 46989 remove(invoker.fns, wrappedHook); 46990 } 46991 46992 if (isUndef(oldHook)) { 46993 // no existing hook 46994 invoker = createFnInvoker([wrappedHook]); 46995 } else { 46996 /* istanbul ignore if */ 46997 if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { 46998 // already a merged invoker 46999 invoker = oldHook; 47000 invoker.fns.push(wrappedHook); 47001 } else { 47002 // existing plain hook 47003 invoker = createFnInvoker([oldHook, wrappedHook]); 47004 } 47005 } 47006 47007 invoker.merged = true; 47008 def[hookKey] = invoker; 47009} 47010 47011/* */ 47012 47013function extractPropsFromVNodeData ( 47014 data, 47015 Ctor, 47016 tag 47017) { 47018 // we are only extracting raw values here. 47019 // validation and default values are handled in the child 47020 // component itself. 47021 var propOptions = Ctor.options.props; 47022 if (isUndef(propOptions)) { 47023 return 47024 } 47025 var res = {}; 47026 var attrs = data.attrs; 47027 var props = data.props; 47028 if (isDef(attrs) || isDef(props)) { 47029 for (var key in propOptions) { 47030 var altKey = hyphenate(key); 47031 { 47032 var keyInLowerCase = key.toLowerCase(); 47033 if ( 47034 key !== keyInLowerCase && 47035 attrs && hasOwn(attrs, keyInLowerCase) 47036 ) { 47037 tip( 47038 "Prop \"" + keyInLowerCase + "\" is passed to component " + 47039 (formatComponentName(tag || Ctor)) + ", but the declared prop name is" + 47040 " \"" + key + "\". " + 47041 "Note that HTML attributes are case-insensitive and camelCased " + 47042 "props need to use their kebab-case equivalents when using in-DOM " + 47043 "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"." 47044 ); 47045 } 47046 } 47047 checkProp(res, props, key, altKey, true) || 47048 checkProp(res, attrs, key, altKey, false); 47049 } 47050 } 47051 return res 47052} 47053 47054function checkProp ( 47055 res, 47056 hash, 47057 key, 47058 altKey, 47059 preserve 47060) { 47061 if (isDef(hash)) { 47062 if (hasOwn(hash, key)) { 47063 res[key] = hash[key]; 47064 if (!preserve) { 47065 delete hash[key]; 47066 } 47067 return true 47068 } else if (hasOwn(hash, altKey)) { 47069 res[key] = hash[altKey]; 47070 if (!preserve) { 47071 delete hash[altKey]; 47072 } 47073 return true 47074 } 47075 } 47076 return false 47077} 47078 47079/* */ 47080 47081// The template compiler attempts to minimize the need for normalization by 47082// statically analyzing the template at compile time. 47083// 47084// For plain HTML markup, normalization can be completely skipped because the 47085// generated render function is guaranteed to return Array<VNode>. There are 47086// two cases where extra normalization is needed: 47087 47088// 1. When the children contains components - because a functional component 47089// may return an Array instead of a single root. In this case, just a simple 47090// normalization is needed - if any child is an Array, we flatten the whole 47091// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep 47092// because functional components already normalize their own children. 47093function simpleNormalizeChildren (children) { 47094 for (var i = 0; i < children.length; i++) { 47095 if (Array.isArray(children[i])) { 47096 return Array.prototype.concat.apply([], children) 47097 } 47098 } 47099 return children 47100} 47101 47102// 2. When the children contains constructs that always generated nested Arrays, 47103// e.g. <template>, <slot>, v-for, or when the children is provided by user 47104// with hand-written render functions / JSX. In such cases a full normalization 47105// is needed to cater to all possible types of children values. 47106function normalizeChildren (children) { 47107 return isPrimitive(children) 47108 ? [createTextVNode(children)] 47109 : Array.isArray(children) 47110 ? normalizeArrayChildren(children) 47111 : undefined 47112} 47113 47114function isTextNode (node) { 47115 return isDef(node) && isDef(node.text) && isFalse(node.isComment) 47116} 47117 47118function normalizeArrayChildren (children, nestedIndex) { 47119 var res = []; 47120 var i, c, lastIndex, last; 47121 for (i = 0; i < children.length; i++) { 47122 c = children[i]; 47123 if (isUndef(c) || typeof c === 'boolean') { continue } 47124 lastIndex = res.length - 1; 47125 last = res[lastIndex]; 47126 // nested 47127 if (Array.isArray(c)) { 47128 if (c.length > 0) { 47129 c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)); 47130 // merge adjacent text nodes 47131 if (isTextNode(c[0]) && isTextNode(last)) { 47132 res[lastIndex] = createTextVNode(last.text + (c[0]).text); 47133 c.shift(); 47134 } 47135 res.push.apply(res, c); 47136 } 47137 } else if (isPrimitive(c)) { 47138 if (isTextNode(last)) { 47139 // merge adjacent text nodes 47140 // this is necessary for SSR hydration because text nodes are 47141 // essentially merged when rendered to HTML strings 47142 res[lastIndex] = createTextVNode(last.text + c); 47143 } else if (c !== '') { 47144 // convert primitive to vnode 47145 res.push(createTextVNode(c)); 47146 } 47147 } else { 47148 if (isTextNode(c) && isTextNode(last)) { 47149 // merge adjacent text nodes 47150 res[lastIndex] = createTextVNode(last.text + c.text); 47151 } else { 47152 // default key for nested array children (likely generated by v-for) 47153 if (isTrue(children._isVList) && 47154 isDef(c.tag) && 47155 isUndef(c.key) && 47156 isDef(nestedIndex)) { 47157 c.key = "__vlist" + nestedIndex + "_" + i + "__"; 47158 } 47159 res.push(c); 47160 } 47161 } 47162 } 47163 return res 47164} 47165 47166/* */ 47167 47168function initProvide (vm) { 47169 var provide = vm.$options.provide; 47170 if (provide) { 47171 vm._provided = typeof provide === 'function' 47172 ? provide.call(vm) 47173 : provide; 47174 } 47175} 47176 47177function initInjections (vm) { 47178 var result = resolveInject(vm.$options.inject, vm); 47179 if (result) { 47180 toggleObserving(false); 47181 Object.keys(result).forEach(function (key) { 47182 /* istanbul ignore else */ 47183 { 47184 defineReactive$$1(vm, key, result[key], function () { 47185 warn( 47186 "Avoid mutating an injected value directly since the changes will be " + 47187 "overwritten whenever the provided component re-renders. " + 47188 "injection being mutated: \"" + key + "\"", 47189 vm 47190 ); 47191 }); 47192 } 47193 }); 47194 toggleObserving(true); 47195 } 47196} 47197 47198function resolveInject (inject, vm) { 47199 if (inject) { 47200 // inject is :any because flow is not smart enough to figure out cached 47201 var result = Object.create(null); 47202 var keys = hasSymbol 47203 ? Reflect.ownKeys(inject) 47204 : Object.keys(inject); 47205 47206 for (var i = 0; i < keys.length; i++) { 47207 var key = keys[i]; 47208 // #6574 in case the inject object is observed... 47209 if (key === '__ob__') { continue } 47210 var provideKey = inject[key].from; 47211 var source = vm; 47212 while (source) { 47213 if (source._provided && hasOwn(source._provided, provideKey)) { 47214 result[key] = source._provided[provideKey]; 47215 break 47216 } 47217 source = source.$parent; 47218 } 47219 if (!source) { 47220 if ('default' in inject[key]) { 47221 var provideDefault = inject[key].default; 47222 result[key] = typeof provideDefault === 'function' 47223 ? provideDefault.call(vm) 47224 : provideDefault; 47225 } else { 47226 warn(("Injection \"" + key + "\" not found"), vm); 47227 } 47228 } 47229 } 47230 return result 47231 } 47232} 47233 47234/* */ 47235 47236 47237 47238/** 47239 * Runtime helper for resolving raw children VNodes into a slot object. 47240 */ 47241function resolveSlots ( 47242 children, 47243 context 47244) { 47245 if (!children || !children.length) { 47246 return {} 47247 } 47248 var slots = {}; 47249 for (var i = 0, l = children.length; i < l; i++) { 47250 var child = children[i]; 47251 var data = child.data; 47252 // remove slot attribute if the node is resolved as a Vue slot node 47253 if (data && data.attrs && data.attrs.slot) { 47254 delete data.attrs.slot; 47255 } 47256 // named slots should only be respected if the vnode was rendered in the 47257 // same context. 47258 if ((child.context === context || child.fnContext === context) && 47259 data && data.slot != null 47260 ) { 47261 var name = data.slot; 47262 var slot = (slots[name] || (slots[name] = [])); 47263 if (child.tag === 'template') { 47264 slot.push.apply(slot, child.children || []); 47265 } else { 47266 slot.push(child); 47267 } 47268 } else { 47269 (slots.default || (slots.default = [])).push(child); 47270 } 47271 } 47272 // ignore slots that contains only whitespace 47273 for (var name$1 in slots) { 47274 if (slots[name$1].every(isWhitespace)) { 47275 delete slots[name$1]; 47276 } 47277 } 47278 return slots 47279} 47280 47281function isWhitespace (node) { 47282 return (node.isComment && !node.asyncFactory) || node.text === ' ' 47283} 47284 47285/* */ 47286 47287function isAsyncPlaceholder (node) { 47288 return node.isComment && node.asyncFactory 47289} 47290 47291/* */ 47292 47293function normalizeScopedSlots ( 47294 slots, 47295 normalSlots, 47296 prevSlots 47297) { 47298 var res; 47299 var hasNormalSlots = Object.keys(normalSlots).length > 0; 47300 var isStable = slots ? !!slots.$stable : !hasNormalSlots; 47301 var key = slots && slots.$key; 47302 if (!slots) { 47303 res = {}; 47304 } else if (slots._normalized) { 47305 // fast path 1: child component re-render only, parent did not change 47306 return slots._normalized 47307 } else if ( 47308 isStable && 47309 prevSlots && 47310 prevSlots !== emptyObject && 47311 key === prevSlots.$key && 47312 !hasNormalSlots && 47313 !prevSlots.$hasNormal 47314 ) { 47315 // fast path 2: stable scoped slots w/ no normal slots to proxy, 47316 // only need to normalize once 47317 return prevSlots 47318 } else { 47319 res = {}; 47320 for (var key$1 in slots) { 47321 if (slots[key$1] && key$1[0] !== '$') { 47322 res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]); 47323 } 47324 } 47325 } 47326 // expose normal slots on scopedSlots 47327 for (var key$2 in normalSlots) { 47328 if (!(key$2 in res)) { 47329 res[key$2] = proxyNormalSlot(normalSlots, key$2); 47330 } 47331 } 47332 // avoriaz seems to mock a non-extensible $scopedSlots object 47333 // and when that is passed down this would cause an error 47334 if (slots && Object.isExtensible(slots)) { 47335 (slots)._normalized = res; 47336 } 47337 def(res, '$stable', isStable); 47338 def(res, '$key', key); 47339 def(res, '$hasNormal', hasNormalSlots); 47340 return res 47341} 47342 47343function normalizeScopedSlot(normalSlots, key, fn) { 47344 var normalized = function () { 47345 var res = arguments.length ? fn.apply(null, arguments) : fn({}); 47346 res = res && typeof res === 'object' && !Array.isArray(res) 47347 ? [res] // single vnode 47348 : normalizeChildren(res); 47349 var vnode = res && res[0]; 47350 return res && ( 47351 !vnode || 47352 (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391 47353 ) ? undefined 47354 : res 47355 }; 47356 // this is a slot using the new v-slot syntax without scope. although it is 47357 // compiled as a scoped slot, render fn users would expect it to be present 47358 // on this.$slots because the usage is semantically a normal slot. 47359 if (fn.proxy) { 47360 Object.defineProperty(normalSlots, key, { 47361 get: normalized, 47362 enumerable: true, 47363 configurable: true 47364 }); 47365 } 47366 return normalized 47367} 47368 47369function proxyNormalSlot(slots, key) { 47370 return function () { return slots[key]; } 47371} 47372 47373/* */ 47374 47375/** 47376 * Runtime helper for rendering v-for lists. 47377 */ 47378function renderList ( 47379 val, 47380 render 47381) { 47382 var ret, i, l, keys, key; 47383 if (Array.isArray(val) || typeof val === 'string') { 47384 ret = new Array(val.length); 47385 for (i = 0, l = val.length; i < l; i++) { 47386 ret[i] = render(val[i], i); 47387 } 47388 } else if (typeof val === 'number') { 47389 ret = new Array(val); 47390 for (i = 0; i < val; i++) { 47391 ret[i] = render(i + 1, i); 47392 } 47393 } else if (isObject(val)) { 47394 if (hasSymbol && val[Symbol.iterator]) { 47395 ret = []; 47396 var iterator = val[Symbol.iterator](); 47397 var result = iterator.next(); 47398 while (!result.done) { 47399 ret.push(render(result.value, ret.length)); 47400 result = iterator.next(); 47401 } 47402 } else { 47403 keys = Object.keys(val); 47404 ret = new Array(keys.length); 47405 for (i = 0, l = keys.length; i < l; i++) { 47406 key = keys[i]; 47407 ret[i] = render(val[key], key, i); 47408 } 47409 } 47410 } 47411 if (!isDef(ret)) { 47412 ret = []; 47413 } 47414 (ret)._isVList = true; 47415 return ret 47416} 47417 47418/* */ 47419 47420/** 47421 * Runtime helper for rendering <slot> 47422 */ 47423function renderSlot ( 47424 name, 47425 fallbackRender, 47426 props, 47427 bindObject 47428) { 47429 var scopedSlotFn = this.$scopedSlots[name]; 47430 var nodes; 47431 if (scopedSlotFn) { 47432 // scoped slot 47433 props = props || {}; 47434 if (bindObject) { 47435 if (!isObject(bindObject)) { 47436 warn('slot v-bind without argument expects an Object', this); 47437 } 47438 props = extend(extend({}, bindObject), props); 47439 } 47440 nodes = 47441 scopedSlotFn(props) || 47442 (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); 47443 } else { 47444 nodes = 47445 this.$slots[name] || 47446 (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender); 47447 } 47448 47449 var target = props && props.slot; 47450 if (target) { 47451 return this.$createElement('template', { slot: target }, nodes) 47452 } else { 47453 return nodes 47454 } 47455} 47456 47457/* */ 47458 47459/** 47460 * Runtime helper for resolving filters 47461 */ 47462function resolveFilter (id) { 47463 return resolveAsset(this.$options, 'filters', id, true) || identity 47464} 47465 47466/* */ 47467 47468function isKeyNotMatch (expect, actual) { 47469 if (Array.isArray(expect)) { 47470 return expect.indexOf(actual) === -1 47471 } else { 47472 return expect !== actual 47473 } 47474} 47475 47476/** 47477 * Runtime helper for checking keyCodes from config. 47478 * exposed as Vue.prototype._k 47479 * passing in eventKeyName as last argument separately for backwards compat 47480 */ 47481function checkKeyCodes ( 47482 eventKeyCode, 47483 key, 47484 builtInKeyCode, 47485 eventKeyName, 47486 builtInKeyName 47487) { 47488 var mappedKeyCode = config.keyCodes[key] || builtInKeyCode; 47489 if (builtInKeyName && eventKeyName && !config.keyCodes[key]) { 47490 return isKeyNotMatch(builtInKeyName, eventKeyName) 47491 } else if (mappedKeyCode) { 47492 return isKeyNotMatch(mappedKeyCode, eventKeyCode) 47493 } else if (eventKeyName) { 47494 return hyphenate(eventKeyName) !== key 47495 } 47496 return eventKeyCode === undefined 47497} 47498 47499/* */ 47500 47501/** 47502 * Runtime helper for merging v-bind="object" into a VNode's data. 47503 */ 47504function bindObjectProps ( 47505 data, 47506 tag, 47507 value, 47508 asProp, 47509 isSync 47510) { 47511 if (value) { 47512 if (!isObject(value)) { 47513 warn( 47514 'v-bind without argument expects an Object or Array value', 47515 this 47516 ); 47517 } else { 47518 if (Array.isArray(value)) { 47519 value = toObject(value); 47520 } 47521 var hash; 47522 var loop = function ( key ) { 47523 if ( 47524 key === 'class' || 47525 key === 'style' || 47526 isReservedAttribute(key) 47527 ) { 47528 hash = data; 47529 } else { 47530 var type = data.attrs && data.attrs.type; 47531 hash = asProp || config.mustUseProp(tag, type, key) 47532 ? data.domProps || (data.domProps = {}) 47533 : data.attrs || (data.attrs = {}); 47534 } 47535 var camelizedKey = camelize(key); 47536 var hyphenatedKey = hyphenate(key); 47537 if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) { 47538 hash[key] = value[key]; 47539 47540 if (isSync) { 47541 var on = data.on || (data.on = {}); 47542 on[("update:" + key)] = function ($event) { 47543 value[key] = $event; 47544 }; 47545 } 47546 } 47547 }; 47548 47549 for (var key in value) loop( key ); 47550 } 47551 } 47552 return data 47553} 47554 47555/* */ 47556 47557/** 47558 * Runtime helper for rendering static trees. 47559 */ 47560function renderStatic ( 47561 index, 47562 isInFor 47563) { 47564 var cached = this._staticTrees || (this._staticTrees = []); 47565 var tree = cached[index]; 47566 // if has already-rendered static tree and not inside v-for, 47567 // we can reuse the same tree. 47568 if (tree && !isInFor) { 47569 return tree 47570 } 47571 // otherwise, render a fresh tree. 47572 tree = cached[index] = this.$options.staticRenderFns[index].call( 47573 this._renderProxy, 47574 null, 47575 this // for render fns generated for functional component templates 47576 ); 47577 markStatic(tree, ("__static__" + index), false); 47578 return tree 47579} 47580 47581/** 47582 * Runtime helper for v-once. 47583 * Effectively it means marking the node as static with a unique key. 47584 */ 47585function markOnce ( 47586 tree, 47587 index, 47588 key 47589) { 47590 markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true); 47591 return tree 47592} 47593 47594function markStatic ( 47595 tree, 47596 key, 47597 isOnce 47598) { 47599 if (Array.isArray(tree)) { 47600 for (var i = 0; i < tree.length; i++) { 47601 if (tree[i] && typeof tree[i] !== 'string') { 47602 markStaticNode(tree[i], (key + "_" + i), isOnce); 47603 } 47604 } 47605 } else { 47606 markStaticNode(tree, key, isOnce); 47607 } 47608} 47609 47610function markStaticNode (node, key, isOnce) { 47611 node.isStatic = true; 47612 node.key = key; 47613 node.isOnce = isOnce; 47614} 47615 47616/* */ 47617 47618function bindObjectListeners (data, value) { 47619 if (value) { 47620 if (!isPlainObject(value)) { 47621 warn( 47622 'v-on without argument expects an Object value', 47623 this 47624 ); 47625 } else { 47626 var on = data.on = data.on ? extend({}, data.on) : {}; 47627 for (var key in value) { 47628 var existing = on[key]; 47629 var ours = value[key]; 47630 on[key] = existing ? [].concat(existing, ours) : ours; 47631 } 47632 } 47633 } 47634 return data 47635} 47636 47637/* */ 47638 47639function resolveScopedSlots ( 47640 fns, // see flow/vnode 47641 res, 47642 // the following are added in 2.6 47643 hasDynamicKeys, 47644 contentHashKey 47645) { 47646 res = res || { $stable: !hasDynamicKeys }; 47647 for (var i = 0; i < fns.length; i++) { 47648 var slot = fns[i]; 47649 if (Array.isArray(slot)) { 47650 resolveScopedSlots(slot, res, hasDynamicKeys); 47651 } else if (slot) { 47652 // marker for reverse proxying v-slot without scope on this.$slots 47653 if (slot.proxy) { 47654 slot.fn.proxy = true; 47655 } 47656 res[slot.key] = slot.fn; 47657 } 47658 } 47659 if (contentHashKey) { 47660 (res).$key = contentHashKey; 47661 } 47662 return res 47663} 47664 47665/* */ 47666 47667function bindDynamicKeys (baseObj, values) { 47668 for (var i = 0; i < values.length; i += 2) { 47669 var key = values[i]; 47670 if (typeof key === 'string' && key) { 47671 baseObj[values[i]] = values[i + 1]; 47672 } else if (key !== '' && key !== null) { 47673 // null is a special value for explicitly removing a binding 47674 warn( 47675 ("Invalid value for dynamic directive argument (expected string or null): " + key), 47676 this 47677 ); 47678 } 47679 } 47680 return baseObj 47681} 47682 47683// helper to dynamically append modifier runtime markers to event names. 47684// ensure only append when value is already string, otherwise it will be cast 47685// to string and cause the type check to miss. 47686function prependModifier (value, symbol) { 47687 return typeof value === 'string' ? symbol + value : value 47688} 47689 47690/* */ 47691 47692function installRenderHelpers (target) { 47693 target._o = markOnce; 47694 target._n = toNumber; 47695 target._s = toString; 47696 target._l = renderList; 47697 target._t = renderSlot; 47698 target._q = looseEqual; 47699 target._i = looseIndexOf; 47700 target._m = renderStatic; 47701 target._f = resolveFilter; 47702 target._k = checkKeyCodes; 47703 target._b = bindObjectProps; 47704 target._v = createTextVNode; 47705 target._e = createEmptyVNode; 47706 target._u = resolveScopedSlots; 47707 target._g = bindObjectListeners; 47708 target._d = bindDynamicKeys; 47709 target._p = prependModifier; 47710} 47711 47712/* */ 47713 47714function FunctionalRenderContext ( 47715 data, 47716 props, 47717 children, 47718 parent, 47719 Ctor 47720) { 47721 var this$1 = this; 47722 47723 var options = Ctor.options; 47724 // ensure the createElement function in functional components 47725 // gets a unique context - this is necessary for correct named slot check 47726 var contextVm; 47727 if (hasOwn(parent, '_uid')) { 47728 contextVm = Object.create(parent); 47729 // $flow-disable-line 47730 contextVm._original = parent; 47731 } else { 47732 // the context vm passed in is a functional context as well. 47733 // in this case we want to make sure we are able to get a hold to the 47734 // real context instance. 47735 contextVm = parent; 47736 // $flow-disable-line 47737 parent = parent._original; 47738 } 47739 var isCompiled = isTrue(options._compiled); 47740 var needNormalization = !isCompiled; 47741 47742 this.data = data; 47743 this.props = props; 47744 this.children = children; 47745 this.parent = parent; 47746 this.listeners = data.on || emptyObject; 47747 this.injections = resolveInject(options.inject, parent); 47748 this.slots = function () { 47749 if (!this$1.$slots) { 47750 normalizeScopedSlots( 47751 data.scopedSlots, 47752 this$1.$slots = resolveSlots(children, parent) 47753 ); 47754 } 47755 return this$1.$slots 47756 }; 47757 47758 Object.defineProperty(this, 'scopedSlots', ({ 47759 enumerable: true, 47760 get: function get () { 47761 return normalizeScopedSlots(data.scopedSlots, this.slots()) 47762 } 47763 })); 47764 47765 // support for compiled functional template 47766 if (isCompiled) { 47767 // exposing $options for renderStatic() 47768 this.$options = options; 47769 // pre-resolve slots for renderSlot() 47770 this.$slots = this.slots(); 47771 this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots); 47772 } 47773 47774 if (options._scopeId) { 47775 this._c = function (a, b, c, d) { 47776 var vnode = createElement(contextVm, a, b, c, d, needNormalization); 47777 if (vnode && !Array.isArray(vnode)) { 47778 vnode.fnScopeId = options._scopeId; 47779 vnode.fnContext = parent; 47780 } 47781 return vnode 47782 }; 47783 } else { 47784 this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); }; 47785 } 47786} 47787 47788installRenderHelpers(FunctionalRenderContext.prototype); 47789 47790function createFunctionalComponent ( 47791 Ctor, 47792 propsData, 47793 data, 47794 contextVm, 47795 children 47796) { 47797 var options = Ctor.options; 47798 var props = {}; 47799 var propOptions = options.props; 47800 if (isDef(propOptions)) { 47801 for (var key in propOptions) { 47802 props[key] = validateProp(key, propOptions, propsData || emptyObject); 47803 } 47804 } else { 47805 if (isDef(data.attrs)) { mergeProps(props, data.attrs); } 47806 if (isDef(data.props)) { mergeProps(props, data.props); } 47807 } 47808 47809 var renderContext = new FunctionalRenderContext( 47810 data, 47811 props, 47812 children, 47813 contextVm, 47814 Ctor 47815 ); 47816 47817 var vnode = options.render.call(null, renderContext._c, renderContext); 47818 47819 if (vnode instanceof VNode) { 47820 return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext) 47821 } else if (Array.isArray(vnode)) { 47822 var vnodes = normalizeChildren(vnode) || []; 47823 var res = new Array(vnodes.length); 47824 for (var i = 0; i < vnodes.length; i++) { 47825 res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext); 47826 } 47827 return res 47828 } 47829} 47830 47831function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) { 47832 // #7817 clone node before setting fnContext, otherwise if the node is reused 47833 // (e.g. it was from a cached normal slot) the fnContext causes named slots 47834 // that should not be matched to match. 47835 var clone = cloneVNode(vnode); 47836 clone.fnContext = contextVm; 47837 clone.fnOptions = options; 47838 { 47839 (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext; 47840 } 47841 if (data.slot) { 47842 (clone.data || (clone.data = {})).slot = data.slot; 47843 } 47844 return clone 47845} 47846 47847function mergeProps (to, from) { 47848 for (var key in from) { 47849 to[camelize(key)] = from[key]; 47850 } 47851} 47852 47853/* */ 47854 47855/* */ 47856 47857/* */ 47858 47859/* */ 47860 47861// inline hooks to be invoked on component VNodes during patch 47862var componentVNodeHooks = { 47863 init: function init (vnode, hydrating) { 47864 if ( 47865 vnode.componentInstance && 47866 !vnode.componentInstance._isDestroyed && 47867 vnode.data.keepAlive 47868 ) { 47869 // kept-alive components, treat as a patch 47870 var mountedNode = vnode; // work around flow 47871 componentVNodeHooks.prepatch(mountedNode, mountedNode); 47872 } else { 47873 var child = vnode.componentInstance = createComponentInstanceForVnode( 47874 vnode, 47875 activeInstance 47876 ); 47877 child.$mount(hydrating ? vnode.elm : undefined, hydrating); 47878 } 47879 }, 47880 47881 prepatch: function prepatch (oldVnode, vnode) { 47882 var options = vnode.componentOptions; 47883 var child = vnode.componentInstance = oldVnode.componentInstance; 47884 updateChildComponent( 47885 child, 47886 options.propsData, // updated props 47887 options.listeners, // updated listeners 47888 vnode, // new parent vnode 47889 options.children // new children 47890 ); 47891 }, 47892 47893 insert: function insert (vnode) { 47894 var context = vnode.context; 47895 var componentInstance = vnode.componentInstance; 47896 if (!componentInstance._isMounted) { 47897 componentInstance._isMounted = true; 47898 callHook(componentInstance, 'mounted'); 47899 } 47900 if (vnode.data.keepAlive) { 47901 if (context._isMounted) { 47902 // vue-router#1212 47903 // During updates, a kept-alive component's child components may 47904 // change, so directly walking the tree here may call activated hooks 47905 // on incorrect children. Instead we push them into a queue which will 47906 // be processed after the whole patch process ended. 47907 queueActivatedComponent(componentInstance); 47908 } else { 47909 activateChildComponent(componentInstance, true /* direct */); 47910 } 47911 } 47912 }, 47913 47914 destroy: function destroy (vnode) { 47915 var componentInstance = vnode.componentInstance; 47916 if (!componentInstance._isDestroyed) { 47917 if (!vnode.data.keepAlive) { 47918 componentInstance.$destroy(); 47919 } else { 47920 deactivateChildComponent(componentInstance, true /* direct */); 47921 } 47922 } 47923 } 47924}; 47925 47926var hooksToMerge = Object.keys(componentVNodeHooks); 47927 47928function createComponent ( 47929 Ctor, 47930 data, 47931 context, 47932 children, 47933 tag 47934) { 47935 if (isUndef(Ctor)) { 47936 return 47937 } 47938 47939 var baseCtor = context.$options._base; 47940 47941 // plain options object: turn it into a constructor 47942 if (isObject(Ctor)) { 47943 Ctor = baseCtor.extend(Ctor); 47944 } 47945 47946 // if at this stage it's not a constructor or an async component factory, 47947 // reject. 47948 if (typeof Ctor !== 'function') { 47949 { 47950 warn(("Invalid Component definition: " + (String(Ctor))), context); 47951 } 47952 return 47953 } 47954 47955 // async component 47956 var asyncFactory; 47957 if (isUndef(Ctor.cid)) { 47958 asyncFactory = Ctor; 47959 Ctor = resolveAsyncComponent(asyncFactory, baseCtor); 47960 if (Ctor === undefined) { 47961 // return a placeholder node for async component, which is rendered 47962 // as a comment node but preserves all the raw information for the node. 47963 // the information will be used for async server-rendering and hydration. 47964 return createAsyncPlaceholder( 47965 asyncFactory, 47966 data, 47967 context, 47968 children, 47969 tag 47970 ) 47971 } 47972 } 47973 47974 data = data || {}; 47975 47976 // resolve constructor options in case global mixins are applied after 47977 // component constructor creation 47978 resolveConstructorOptions(Ctor); 47979 47980 // transform component v-model data into props & events 47981 if (isDef(data.model)) { 47982 transformModel(Ctor.options, data); 47983 } 47984 47985 // extract props 47986 var propsData = extractPropsFromVNodeData(data, Ctor, tag); 47987 47988 // functional component 47989 if (isTrue(Ctor.options.functional)) { 47990 return createFunctionalComponent(Ctor, propsData, data, context, children) 47991 } 47992 47993 // extract listeners, since these needs to be treated as 47994 // child component listeners instead of DOM listeners 47995 var listeners = data.on; 47996 // replace with listeners with .native modifier 47997 // so it gets processed during parent component patch. 47998 data.on = data.nativeOn; 47999 48000 if (isTrue(Ctor.options.abstract)) { 48001 // abstract components do not keep anything 48002 // other than props & listeners & slot 48003 48004 // work around flow 48005 var slot = data.slot; 48006 data = {}; 48007 if (slot) { 48008 data.slot = slot; 48009 } 48010 } 48011 48012 // install component management hooks onto the placeholder node 48013 installComponentHooks(data); 48014 48015 // return a placeholder vnode 48016 var name = Ctor.options.name || tag; 48017 var vnode = new VNode( 48018 ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')), 48019 data, undefined, undefined, undefined, context, 48020 { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, 48021 asyncFactory 48022 ); 48023 48024 return vnode 48025} 48026 48027function createComponentInstanceForVnode ( 48028 // we know it's MountedComponentVNode but flow doesn't 48029 vnode, 48030 // activeInstance in lifecycle state 48031 parent 48032) { 48033 var options = { 48034 _isComponent: true, 48035 _parentVnode: vnode, 48036 parent: parent 48037 }; 48038 // check inline-template render functions 48039 var inlineTemplate = vnode.data.inlineTemplate; 48040 if (isDef(inlineTemplate)) { 48041 options.render = inlineTemplate.render; 48042 options.staticRenderFns = inlineTemplate.staticRenderFns; 48043 } 48044 return new vnode.componentOptions.Ctor(options) 48045} 48046 48047function installComponentHooks (data) { 48048 var hooks = data.hook || (data.hook = {}); 48049 for (var i = 0; i < hooksToMerge.length; i++) { 48050 var key = hooksToMerge[i]; 48051 var existing = hooks[key]; 48052 var toMerge = componentVNodeHooks[key]; 48053 if (existing !== toMerge && !(existing && existing._merged)) { 48054 hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge; 48055 } 48056 } 48057} 48058 48059function mergeHook$1 (f1, f2) { 48060 var merged = function (a, b) { 48061 // flow complains about extra args which is why we use any 48062 f1(a, b); 48063 f2(a, b); 48064 }; 48065 merged._merged = true; 48066 return merged 48067} 48068 48069// transform component v-model info (value and callback) into 48070// prop and event handler respectively. 48071function transformModel (options, data) { 48072 var prop = (options.model && options.model.prop) || 'value'; 48073 var event = (options.model && options.model.event) || 'input' 48074 ;(data.attrs || (data.attrs = {}))[prop] = data.model.value; 48075 var on = data.on || (data.on = {}); 48076 var existing = on[event]; 48077 var callback = data.model.callback; 48078 if (isDef(existing)) { 48079 if ( 48080 Array.isArray(existing) 48081 ? existing.indexOf(callback) === -1 48082 : existing !== callback 48083 ) { 48084 on[event] = [callback].concat(existing); 48085 } 48086 } else { 48087 on[event] = callback; 48088 } 48089} 48090 48091/* */ 48092 48093var SIMPLE_NORMALIZE = 1; 48094var ALWAYS_NORMALIZE = 2; 48095 48096// wrapper function for providing a more flexible interface 48097// without getting yelled at by flow 48098function createElement ( 48099 context, 48100 tag, 48101 data, 48102 children, 48103 normalizationType, 48104 alwaysNormalize 48105) { 48106 if (Array.isArray(data) || isPrimitive(data)) { 48107 normalizationType = children; 48108 children = data; 48109 data = undefined; 48110 } 48111 if (isTrue(alwaysNormalize)) { 48112 normalizationType = ALWAYS_NORMALIZE; 48113 } 48114 return _createElement(context, tag, data, children, normalizationType) 48115} 48116 48117function _createElement ( 48118 context, 48119 tag, 48120 data, 48121 children, 48122 normalizationType 48123) { 48124 if (isDef(data) && isDef((data).__ob__)) { 48125 warn( 48126 "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" + 48127 'Always create fresh vnode data objects in each render!', 48128 context 48129 ); 48130 return createEmptyVNode() 48131 } 48132 // object syntax in v-bind 48133 if (isDef(data) && isDef(data.is)) { 48134 tag = data.is; 48135 } 48136 if (!tag) { 48137 // in case of component :is set to falsy value 48138 return createEmptyVNode() 48139 } 48140 // warn against non-primitive key 48141 if (isDef(data) && isDef(data.key) && !isPrimitive(data.key) 48142 ) { 48143 { 48144 warn( 48145 'Avoid using non-primitive value as key, ' + 48146 'use string/number value instead.', 48147 context 48148 ); 48149 } 48150 } 48151 // support single function children as default scoped slot 48152 if (Array.isArray(children) && 48153 typeof children[0] === 'function' 48154 ) { 48155 data = data || {}; 48156 data.scopedSlots = { default: children[0] }; 48157 children.length = 0; 48158 } 48159 if (normalizationType === ALWAYS_NORMALIZE) { 48160 children = normalizeChildren(children); 48161 } else if (normalizationType === SIMPLE_NORMALIZE) { 48162 children = simpleNormalizeChildren(children); 48163 } 48164 var vnode, ns; 48165 if (typeof tag === 'string') { 48166 var Ctor; 48167 ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag); 48168 if (config.isReservedTag(tag)) { 48169 // platform built-in elements 48170 if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') { 48171 warn( 48172 ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."), 48173 context 48174 ); 48175 } 48176 vnode = new VNode( 48177 config.parsePlatformTagName(tag), data, children, 48178 undefined, undefined, context 48179 ); 48180 } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) { 48181 // component 48182 vnode = createComponent(Ctor, data, context, children, tag); 48183 } else { 48184 // unknown or unlisted namespaced elements 48185 // check at runtime because it may get assigned a namespace when its 48186 // parent normalizes children 48187 vnode = new VNode( 48188 tag, data, children, 48189 undefined, undefined, context 48190 ); 48191 } 48192 } else { 48193 // direct component options / constructor 48194 vnode = createComponent(tag, data, context, children); 48195 } 48196 if (Array.isArray(vnode)) { 48197 return vnode 48198 } else if (isDef(vnode)) { 48199 if (isDef(ns)) { applyNS(vnode, ns); } 48200 if (isDef(data)) { registerDeepBindings(data); } 48201 return vnode 48202 } else { 48203 return createEmptyVNode() 48204 } 48205} 48206 48207function applyNS (vnode, ns, force) { 48208 vnode.ns = ns; 48209 if (vnode.tag === 'foreignObject') { 48210 // use default namespace inside foreignObject 48211 ns = undefined; 48212 force = true; 48213 } 48214 if (isDef(vnode.children)) { 48215 for (var i = 0, l = vnode.children.length; i < l; i++) { 48216 var child = vnode.children[i]; 48217 if (isDef(child.tag) && ( 48218 isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) { 48219 applyNS(child, ns, force); 48220 } 48221 } 48222 } 48223} 48224 48225// ref #5318 48226// necessary to ensure parent re-render when deep bindings like :style and 48227// :class are used on slot nodes 48228function registerDeepBindings (data) { 48229 if (isObject(data.style)) { 48230 traverse(data.style); 48231 } 48232 if (isObject(data.class)) { 48233 traverse(data.class); 48234 } 48235} 48236 48237/* */ 48238 48239function initRender (vm) { 48240 vm._vnode = null; // the root of the child tree 48241 vm._staticTrees = null; // v-once cached trees 48242 var options = vm.$options; 48243 var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree 48244 var renderContext = parentVnode && parentVnode.context; 48245 vm.$slots = resolveSlots(options._renderChildren, renderContext); 48246 vm.$scopedSlots = emptyObject; 48247 // bind the createElement fn to this instance 48248 // so that we get proper render context inside it. 48249 // args order: tag, data, children, normalizationType, alwaysNormalize 48250 // internal version is used by render functions compiled from templates 48251 vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); }; 48252 // normalization is always applied for the public version, used in 48253 // user-written render functions. 48254 vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); }; 48255 48256 // $attrs & $listeners are exposed for easier HOC creation. 48257 // they need to be reactive so that HOCs using them are always updated 48258 var parentData = parentVnode && parentVnode.data; 48259 48260 /* istanbul ignore else */ 48261 { 48262 defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () { 48263 !isUpdatingChildComponent && warn("$attrs is readonly.", vm); 48264 }, true); 48265 defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () { 48266 !isUpdatingChildComponent && warn("$listeners is readonly.", vm); 48267 }, true); 48268 } 48269} 48270 48271var currentRenderingInstance = null; 48272 48273function renderMixin (Vue) { 48274 // install runtime convenience helpers 48275 installRenderHelpers(Vue.prototype); 48276 48277 Vue.prototype.$nextTick = function (fn) { 48278 return nextTick(fn, this) 48279 }; 48280 48281 Vue.prototype._render = function () { 48282 var vm = this; 48283 var ref = vm.$options; 48284 var render = ref.render; 48285 var _parentVnode = ref._parentVnode; 48286 48287 if (_parentVnode) { 48288 vm.$scopedSlots = normalizeScopedSlots( 48289 _parentVnode.data.scopedSlots, 48290 vm.$slots, 48291 vm.$scopedSlots 48292 ); 48293 } 48294 48295 // set parent vnode. this allows render functions to have access 48296 // to the data on the placeholder node. 48297 vm.$vnode = _parentVnode; 48298 // render self 48299 var vnode; 48300 try { 48301 // There's no need to maintain a stack because all render fns are called 48302 // separately from one another. Nested component's render fns are called 48303 // when parent component is patched. 48304 currentRenderingInstance = vm; 48305 vnode = render.call(vm._renderProxy, vm.$createElement); 48306 } catch (e) { 48307 handleError(e, vm, "render"); 48308 // return error render result, 48309 // or previous vnode to prevent render error causing blank component 48310 /* istanbul ignore else */ 48311 if (vm.$options.renderError) { 48312 try { 48313 vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e); 48314 } catch (e) { 48315 handleError(e, vm, "renderError"); 48316 vnode = vm._vnode; 48317 } 48318 } else { 48319 vnode = vm._vnode; 48320 } 48321 } finally { 48322 currentRenderingInstance = null; 48323 } 48324 // if the returned array contains only a single node, allow it 48325 if (Array.isArray(vnode) && vnode.length === 1) { 48326 vnode = vnode[0]; 48327 } 48328 // return empty vnode in case the render function errored out 48329 if (!(vnode instanceof VNode)) { 48330 if (Array.isArray(vnode)) { 48331 warn( 48332 'Multiple root nodes returned from render function. Render function ' + 48333 'should return a single root node.', 48334 vm 48335 ); 48336 } 48337 vnode = createEmptyVNode(); 48338 } 48339 // set parent 48340 vnode.parent = _parentVnode; 48341 return vnode 48342 }; 48343} 48344 48345/* */ 48346 48347function ensureCtor (comp, base) { 48348 if ( 48349 comp.__esModule || 48350 (hasSymbol && comp[Symbol.toStringTag] === 'Module') 48351 ) { 48352 comp = comp.default; 48353 } 48354 return isObject(comp) 48355 ? base.extend(comp) 48356 : comp 48357} 48358 48359function createAsyncPlaceholder ( 48360 factory, 48361 data, 48362 context, 48363 children, 48364 tag 48365) { 48366 var node = createEmptyVNode(); 48367 node.asyncFactory = factory; 48368 node.asyncMeta = { data: data, context: context, children: children, tag: tag }; 48369 return node 48370} 48371 48372function resolveAsyncComponent ( 48373 factory, 48374 baseCtor 48375) { 48376 if (isTrue(factory.error) && isDef(factory.errorComp)) { 48377 return factory.errorComp 48378 } 48379 48380 if (isDef(factory.resolved)) { 48381 return factory.resolved 48382 } 48383 48384 var owner = currentRenderingInstance; 48385 if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) { 48386 // already pending 48387 factory.owners.push(owner); 48388 } 48389 48390 if (isTrue(factory.loading) && isDef(factory.loadingComp)) { 48391 return factory.loadingComp 48392 } 48393 48394 if (owner && !isDef(factory.owners)) { 48395 var owners = factory.owners = [owner]; 48396 var sync = true; 48397 var timerLoading = null; 48398 var timerTimeout = null 48399 48400 ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); }); 48401 48402 var forceRender = function (renderCompleted) { 48403 for (var i = 0, l = owners.length; i < l; i++) { 48404 (owners[i]).$forceUpdate(); 48405 } 48406 48407 if (renderCompleted) { 48408 owners.length = 0; 48409 if (timerLoading !== null) { 48410 clearTimeout(timerLoading); 48411 timerLoading = null; 48412 } 48413 if (timerTimeout !== null) { 48414 clearTimeout(timerTimeout); 48415 timerTimeout = null; 48416 } 48417 } 48418 }; 48419 48420 var resolve = once(function (res) { 48421 // cache resolved 48422 factory.resolved = ensureCtor(res, baseCtor); 48423 // invoke callbacks only if this is not a synchronous resolve 48424 // (async resolves are shimmed as synchronous during SSR) 48425 if (!sync) { 48426 forceRender(true); 48427 } else { 48428 owners.length = 0; 48429 } 48430 }); 48431 48432 var reject = once(function (reason) { 48433 warn( 48434 "Failed to resolve async component: " + (String(factory)) + 48435 (reason ? ("\nReason: " + reason) : '') 48436 ); 48437 if (isDef(factory.errorComp)) { 48438 factory.error = true; 48439 forceRender(true); 48440 } 48441 }); 48442 48443 var res = factory(resolve, reject); 48444 48445 if (isObject(res)) { 48446 if (isPromise(res)) { 48447 // () => Promise 48448 if (isUndef(factory.resolved)) { 48449 res.then(resolve, reject); 48450 } 48451 } else if (isPromise(res.component)) { 48452 res.component.then(resolve, reject); 48453 48454 if (isDef(res.error)) { 48455 factory.errorComp = ensureCtor(res.error, baseCtor); 48456 } 48457 48458 if (isDef(res.loading)) { 48459 factory.loadingComp = ensureCtor(res.loading, baseCtor); 48460 if (res.delay === 0) { 48461 factory.loading = true; 48462 } else { 48463 timerLoading = setTimeout(function () { 48464 timerLoading = null; 48465 if (isUndef(factory.resolved) && isUndef(factory.error)) { 48466 factory.loading = true; 48467 forceRender(false); 48468 } 48469 }, res.delay || 200); 48470 } 48471 } 48472 48473 if (isDef(res.timeout)) { 48474 timerTimeout = setTimeout(function () { 48475 timerTimeout = null; 48476 if (isUndef(factory.resolved)) { 48477 reject( 48478 "timeout (" + (res.timeout) + "ms)" 48479 ); 48480 } 48481 }, res.timeout); 48482 } 48483 } 48484 } 48485 48486 sync = false; 48487 // return in case resolved synchronously 48488 return factory.loading 48489 ? factory.loadingComp 48490 : factory.resolved 48491 } 48492} 48493 48494/* */ 48495 48496function getFirstComponentChild (children) { 48497 if (Array.isArray(children)) { 48498 for (var i = 0; i < children.length; i++) { 48499 var c = children[i]; 48500 if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) { 48501 return c 48502 } 48503 } 48504 } 48505} 48506 48507/* */ 48508 48509/* */ 48510 48511function initEvents (vm) { 48512 vm._events = Object.create(null); 48513 vm._hasHookEvent = false; 48514 // init parent attached events 48515 var listeners = vm.$options._parentListeners; 48516 if (listeners) { 48517 updateComponentListeners(vm, listeners); 48518 } 48519} 48520 48521var target; 48522 48523function add (event, fn) { 48524 target.$on(event, fn); 48525} 48526 48527function remove$1 (event, fn) { 48528 target.$off(event, fn); 48529} 48530 48531function createOnceHandler (event, fn) { 48532 var _target = target; 48533 return function onceHandler () { 48534 var res = fn.apply(null, arguments); 48535 if (res !== null) { 48536 _target.$off(event, onceHandler); 48537 } 48538 } 48539} 48540 48541function updateComponentListeners ( 48542 vm, 48543 listeners, 48544 oldListeners 48545) { 48546 target = vm; 48547 updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm); 48548 target = undefined; 48549} 48550 48551function eventsMixin (Vue) { 48552 var hookRE = /^hook:/; 48553 Vue.prototype.$on = function (event, fn) { 48554 var vm = this; 48555 if (Array.isArray(event)) { 48556 for (var i = 0, l = event.length; i < l; i++) { 48557 vm.$on(event[i], fn); 48558 } 48559 } else { 48560 (vm._events[event] || (vm._events[event] = [])).push(fn); 48561 // optimize hook:event cost by using a boolean flag marked at registration 48562 // instead of a hash lookup 48563 if (hookRE.test(event)) { 48564 vm._hasHookEvent = true; 48565 } 48566 } 48567 return vm 48568 }; 48569 48570 Vue.prototype.$once = function (event, fn) { 48571 var vm = this; 48572 function on () { 48573 vm.$off(event, on); 48574 fn.apply(vm, arguments); 48575 } 48576 on.fn = fn; 48577 vm.$on(event, on); 48578 return vm 48579 }; 48580 48581 Vue.prototype.$off = function (event, fn) { 48582 var vm = this; 48583 // all 48584 if (!arguments.length) { 48585 vm._events = Object.create(null); 48586 return vm 48587 } 48588 // array of events 48589 if (Array.isArray(event)) { 48590 for (var i$1 = 0, l = event.length; i$1 < l; i$1++) { 48591 vm.$off(event[i$1], fn); 48592 } 48593 return vm 48594 } 48595 // specific event 48596 var cbs = vm._events[event]; 48597 if (!cbs) { 48598 return vm 48599 } 48600 if (!fn) { 48601 vm._events[event] = null; 48602 return vm 48603 } 48604 // specific handler 48605 var cb; 48606 var i = cbs.length; 48607 while (i--) { 48608 cb = cbs[i]; 48609 if (cb === fn || cb.fn === fn) { 48610 cbs.splice(i, 1); 48611 break 48612 } 48613 } 48614 return vm 48615 }; 48616 48617 Vue.prototype.$emit = function (event) { 48618 var vm = this; 48619 { 48620 var lowerCaseEvent = event.toLowerCase(); 48621 if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) { 48622 tip( 48623 "Event \"" + lowerCaseEvent + "\" is emitted in component " + 48624 (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " + 48625 "Note that HTML attributes are case-insensitive and you cannot use " + 48626 "v-on to listen to camelCase events when using in-DOM templates. " + 48627 "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"." 48628 ); 48629 } 48630 } 48631 var cbs = vm._events[event]; 48632 if (cbs) { 48633 cbs = cbs.length > 1 ? toArray(cbs) : cbs; 48634 var args = toArray(arguments, 1); 48635 var info = "event handler for \"" + event + "\""; 48636 for (var i = 0, l = cbs.length; i < l; i++) { 48637 invokeWithErrorHandling(cbs[i], vm, args, vm, info); 48638 } 48639 } 48640 return vm 48641 }; 48642} 48643 48644/* */ 48645 48646var activeInstance = null; 48647var isUpdatingChildComponent = false; 48648 48649function setActiveInstance(vm) { 48650 var prevActiveInstance = activeInstance; 48651 activeInstance = vm; 48652 return function () { 48653 activeInstance = prevActiveInstance; 48654 } 48655} 48656 48657function initLifecycle (vm) { 48658 var options = vm.$options; 48659 48660 // locate first non-abstract parent 48661 var parent = options.parent; 48662 if (parent && !options.abstract) { 48663 while (parent.$options.abstract && parent.$parent) { 48664 parent = parent.$parent; 48665 } 48666 parent.$children.push(vm); 48667 } 48668 48669 vm.$parent = parent; 48670 vm.$root = parent ? parent.$root : vm; 48671 48672 vm.$children = []; 48673 vm.$refs = {}; 48674 48675 vm._watcher = null; 48676 vm._inactive = null; 48677 vm._directInactive = false; 48678 vm._isMounted = false; 48679 vm._isDestroyed = false; 48680 vm._isBeingDestroyed = false; 48681} 48682 48683function lifecycleMixin (Vue) { 48684 Vue.prototype._update = function (vnode, hydrating) { 48685 var vm = this; 48686 var prevEl = vm.$el; 48687 var prevVnode = vm._vnode; 48688 var restoreActiveInstance = setActiveInstance(vm); 48689 vm._vnode = vnode; 48690 // Vue.prototype.__patch__ is injected in entry points 48691 // based on the rendering backend used. 48692 if (!prevVnode) { 48693 // initial render 48694 vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */); 48695 } else { 48696 // updates 48697 vm.$el = vm.__patch__(prevVnode, vnode); 48698 } 48699 restoreActiveInstance(); 48700 // update __vue__ reference 48701 if (prevEl) { 48702 prevEl.__vue__ = null; 48703 } 48704 if (vm.$el) { 48705 vm.$el.__vue__ = vm; 48706 } 48707 // if parent is an HOC, update its $el as well 48708 if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) { 48709 vm.$parent.$el = vm.$el; 48710 } 48711 // updated hook is called by the scheduler to ensure that children are 48712 // updated in a parent's updated hook. 48713 }; 48714 48715 Vue.prototype.$forceUpdate = function () { 48716 var vm = this; 48717 if (vm._watcher) { 48718 vm._watcher.update(); 48719 } 48720 }; 48721 48722 Vue.prototype.$destroy = function () { 48723 var vm = this; 48724 if (vm._isBeingDestroyed) { 48725 return 48726 } 48727 callHook(vm, 'beforeDestroy'); 48728 vm._isBeingDestroyed = true; 48729 // remove self from parent 48730 var parent = vm.$parent; 48731 if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) { 48732 remove(parent.$children, vm); 48733 } 48734 // teardown watchers 48735 if (vm._watcher) { 48736 vm._watcher.teardown(); 48737 } 48738 var i = vm._watchers.length; 48739 while (i--) { 48740 vm._watchers[i].teardown(); 48741 } 48742 // remove reference from data ob 48743 // frozen object may not have observer. 48744 if (vm._data.__ob__) { 48745 vm._data.__ob__.vmCount--; 48746 } 48747 // call the last hook... 48748 vm._isDestroyed = true; 48749 // invoke destroy hooks on current rendered tree 48750 vm.__patch__(vm._vnode, null); 48751 // fire destroyed hook 48752 callHook(vm, 'destroyed'); 48753 // turn off all instance listeners. 48754 vm.$off(); 48755 // remove __vue__ reference 48756 if (vm.$el) { 48757 vm.$el.__vue__ = null; 48758 } 48759 // release circular reference (#6759) 48760 if (vm.$vnode) { 48761 vm.$vnode.parent = null; 48762 } 48763 }; 48764} 48765 48766function mountComponent ( 48767 vm, 48768 el, 48769 hydrating 48770) { 48771 vm.$el = el; 48772 if (!vm.$options.render) { 48773 vm.$options.render = createEmptyVNode; 48774 { 48775 /* istanbul ignore if */ 48776 if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') || 48777 vm.$options.el || el) { 48778 warn( 48779 'You are using the runtime-only build of Vue where the template ' + 48780 'compiler is not available. Either pre-compile the templates into ' + 48781 'render functions, or use the compiler-included build.', 48782 vm 48783 ); 48784 } else { 48785 warn( 48786 'Failed to mount component: template or render function not defined.', 48787 vm 48788 ); 48789 } 48790 } 48791 } 48792 callHook(vm, 'beforeMount'); 48793 48794 var updateComponent; 48795 /* istanbul ignore if */ 48796 if (config.performance && mark) { 48797 updateComponent = function () { 48798 var name = vm._name; 48799 var id = vm._uid; 48800 var startTag = "vue-perf-start:" + id; 48801 var endTag = "vue-perf-end:" + id; 48802 48803 mark(startTag); 48804 var vnode = vm._render(); 48805 mark(endTag); 48806 measure(("vue " + name + " render"), startTag, endTag); 48807 48808 mark(startTag); 48809 vm._update(vnode, hydrating); 48810 mark(endTag); 48811 measure(("vue " + name + " patch"), startTag, endTag); 48812 }; 48813 } else { 48814 updateComponent = function () { 48815 vm._update(vm._render(), hydrating); 48816 }; 48817 } 48818 48819 // we set this to vm._watcher inside the watcher's constructor 48820 // since the watcher's initial patch may call $forceUpdate (e.g. inside child 48821 // component's mounted hook), which relies on vm._watcher being already defined 48822 new Watcher(vm, updateComponent, noop, { 48823 before: function before () { 48824 if (vm._isMounted && !vm._isDestroyed) { 48825 callHook(vm, 'beforeUpdate'); 48826 } 48827 } 48828 }, true /* isRenderWatcher */); 48829 hydrating = false; 48830 48831 // manually mounted instance, call mounted on self 48832 // mounted is called for render-created child components in its inserted hook 48833 if (vm.$vnode == null) { 48834 vm._isMounted = true; 48835 callHook(vm, 'mounted'); 48836 } 48837 return vm 48838} 48839 48840function updateChildComponent ( 48841 vm, 48842 propsData, 48843 listeners, 48844 parentVnode, 48845 renderChildren 48846) { 48847 { 48848 isUpdatingChildComponent = true; 48849 } 48850 48851 // determine whether component has slot children 48852 // we need to do this before overwriting $options._renderChildren. 48853 48854 // check if there are dynamic scopedSlots (hand-written or compiled but with 48855 // dynamic slot names). Static scoped slots compiled from template has the 48856 // "$stable" marker. 48857 var newScopedSlots = parentVnode.data.scopedSlots; 48858 var oldScopedSlots = vm.$scopedSlots; 48859 var hasDynamicScopedSlot = !!( 48860 (newScopedSlots && !newScopedSlots.$stable) || 48861 (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) || 48862 (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) || 48863 (!newScopedSlots && vm.$scopedSlots.$key) 48864 ); 48865 48866 // Any static slot children from the parent may have changed during parent's 48867 // update. Dynamic scoped slots may also have changed. In such cases, a forced 48868 // update is necessary to ensure correctness. 48869 var needsForceUpdate = !!( 48870 renderChildren || // has new static slots 48871 vm.$options._renderChildren || // has old static slots 48872 hasDynamicScopedSlot 48873 ); 48874 48875 vm.$options._parentVnode = parentVnode; 48876 vm.$vnode = parentVnode; // update vm's placeholder node without re-render 48877 48878 if (vm._vnode) { // update child tree's parent 48879 vm._vnode.parent = parentVnode; 48880 } 48881 vm.$options._renderChildren = renderChildren; 48882 48883 // update $attrs and $listeners hash 48884 // these are also reactive so they may trigger child update if the child 48885 // used them during render 48886 vm.$attrs = parentVnode.data.attrs || emptyObject; 48887 vm.$listeners = listeners || emptyObject; 48888 48889 // update props 48890 if (propsData && vm.$options.props) { 48891 toggleObserving(false); 48892 var props = vm._props; 48893 var propKeys = vm.$options._propKeys || []; 48894 for (var i = 0; i < propKeys.length; i++) { 48895 var key = propKeys[i]; 48896 var propOptions = vm.$options.props; // wtf flow? 48897 props[key] = validateProp(key, propOptions, propsData, vm); 48898 } 48899 toggleObserving(true); 48900 // keep a copy of raw propsData 48901 vm.$options.propsData = propsData; 48902 } 48903 48904 // update listeners 48905 listeners = listeners || emptyObject; 48906 var oldListeners = vm.$options._parentListeners; 48907 vm.$options._parentListeners = listeners; 48908 updateComponentListeners(vm, listeners, oldListeners); 48909 48910 // resolve slots + force update if has children 48911 if (needsForceUpdate) { 48912 vm.$slots = resolveSlots(renderChildren, parentVnode.context); 48913 vm.$forceUpdate(); 48914 } 48915 48916 { 48917 isUpdatingChildComponent = false; 48918 } 48919} 48920 48921function isInInactiveTree (vm) { 48922 while (vm && (vm = vm.$parent)) { 48923 if (vm._inactive) { return true } 48924 } 48925 return false 48926} 48927 48928function activateChildComponent (vm, direct) { 48929 if (direct) { 48930 vm._directInactive = false; 48931 if (isInInactiveTree(vm)) { 48932 return 48933 } 48934 } else if (vm._directInactive) { 48935 return 48936 } 48937 if (vm._inactive || vm._inactive === null) { 48938 vm._inactive = false; 48939 for (var i = 0; i < vm.$children.length; i++) { 48940 activateChildComponent(vm.$children[i]); 48941 } 48942 callHook(vm, 'activated'); 48943 } 48944} 48945 48946function deactivateChildComponent (vm, direct) { 48947 if (direct) { 48948 vm._directInactive = true; 48949 if (isInInactiveTree(vm)) { 48950 return 48951 } 48952 } 48953 if (!vm._inactive) { 48954 vm._inactive = true; 48955 for (var i = 0; i < vm.$children.length; i++) { 48956 deactivateChildComponent(vm.$children[i]); 48957 } 48958 callHook(vm, 'deactivated'); 48959 } 48960} 48961 48962function callHook (vm, hook) { 48963 // #7573 disable dep collection when invoking lifecycle hooks 48964 pushTarget(); 48965 var handlers = vm.$options[hook]; 48966 var info = hook + " hook"; 48967 if (handlers) { 48968 for (var i = 0, j = handlers.length; i < j; i++) { 48969 invokeWithErrorHandling(handlers[i], vm, null, vm, info); 48970 } 48971 } 48972 if (vm._hasHookEvent) { 48973 vm.$emit('hook:' + hook); 48974 } 48975 popTarget(); 48976} 48977 48978/* */ 48979 48980var MAX_UPDATE_COUNT = 100; 48981 48982var queue = []; 48983var activatedChildren = []; 48984var has = {}; 48985var circular = {}; 48986var waiting = false; 48987var flushing = false; 48988var index = 0; 48989 48990/** 48991 * Reset the scheduler's state. 48992 */ 48993function resetSchedulerState () { 48994 index = queue.length = activatedChildren.length = 0; 48995 has = {}; 48996 { 48997 circular = {}; 48998 } 48999 waiting = flushing = false; 49000} 49001 49002// Async edge case #6566 requires saving the timestamp when event listeners are 49003// attached. However, calling performance.now() has a perf overhead especially 49004// if the page has thousands of event listeners. Instead, we take a timestamp 49005// every time the scheduler flushes and use that for all event listeners 49006// attached during that flush. 49007var currentFlushTimestamp = 0; 49008 49009// Async edge case fix requires storing an event listener's attach timestamp. 49010var getNow = Date.now; 49011 49012// Determine what event timestamp the browser is using. Annoyingly, the 49013// timestamp can either be hi-res (relative to page load) or low-res 49014// (relative to UNIX epoch), so in order to compare time we have to use the 49015// same timestamp type when saving the flush timestamp. 49016// All IE versions use low-res event timestamps, and have problematic clock 49017// implementations (#9632) 49018if (inBrowser && !isIE) { 49019 var performance = window.performance; 49020 if ( 49021 performance && 49022 typeof performance.now === 'function' && 49023 getNow() > document.createEvent('Event').timeStamp 49024 ) { 49025 // if the event timestamp, although evaluated AFTER the Date.now(), is 49026 // smaller than it, it means the event is using a hi-res timestamp, 49027 // and we need to use the hi-res version for event listener timestamps as 49028 // well. 49029 getNow = function () { return performance.now(); }; 49030 } 49031} 49032 49033/** 49034 * Flush both queues and run the watchers. 49035 */ 49036function flushSchedulerQueue () { 49037 currentFlushTimestamp = getNow(); 49038 flushing = true; 49039 var watcher, id; 49040 49041 // Sort queue before flush. 49042 // This ensures that: 49043 // 1. Components are updated from parent to child. (because parent is always 49044 // created before the child) 49045 // 2. A component's user watchers are run before its render watcher (because 49046 // user watchers are created before the render watcher) 49047 // 3. If a component is destroyed during a parent component's watcher run, 49048 // its watchers can be skipped. 49049 queue.sort(function (a, b) { return a.id - b.id; }); 49050 49051 // do not cache length because more watchers might be pushed 49052 // as we run existing watchers 49053 for (index = 0; index < queue.length; index++) { 49054 watcher = queue[index]; 49055 if (watcher.before) { 49056 watcher.before(); 49057 } 49058 id = watcher.id; 49059 has[id] = null; 49060 watcher.run(); 49061 // in dev build, check and stop circular updates. 49062 if (has[id] != null) { 49063 circular[id] = (circular[id] || 0) + 1; 49064 if (circular[id] > MAX_UPDATE_COUNT) { 49065 warn( 49066 'You may have an infinite update loop ' + ( 49067 watcher.user 49068 ? ("in watcher with expression \"" + (watcher.expression) + "\"") 49069 : "in a component render function." 49070 ), 49071 watcher.vm 49072 ); 49073 break 49074 } 49075 } 49076 } 49077 49078 // keep copies of post queues before resetting state 49079 var activatedQueue = activatedChildren.slice(); 49080 var updatedQueue = queue.slice(); 49081 49082 resetSchedulerState(); 49083 49084 // call component updated and activated hooks 49085 callActivatedHooks(activatedQueue); 49086 callUpdatedHooks(updatedQueue); 49087 49088 // devtool hook 49089 /* istanbul ignore if */ 49090 if (devtools && config.devtools) { 49091 devtools.emit('flush'); 49092 } 49093} 49094 49095function callUpdatedHooks (queue) { 49096 var i = queue.length; 49097 while (i--) { 49098 var watcher = queue[i]; 49099 var vm = watcher.vm; 49100 if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) { 49101 callHook(vm, 'updated'); 49102 } 49103 } 49104} 49105 49106/** 49107 * Queue a kept-alive component that was activated during patch. 49108 * The queue will be processed after the entire tree has been patched. 49109 */ 49110function queueActivatedComponent (vm) { 49111 // setting _inactive to false here so that a render function can 49112 // rely on checking whether it's in an inactive tree (e.g. router-view) 49113 vm._inactive = false; 49114 activatedChildren.push(vm); 49115} 49116 49117function callActivatedHooks (queue) { 49118 for (var i = 0; i < queue.length; i++) { 49119 queue[i]._inactive = true; 49120 activateChildComponent(queue[i], true /* true */); 49121 } 49122} 49123 49124/** 49125 * Push a watcher into the watcher queue. 49126 * Jobs with duplicate IDs will be skipped unless it's 49127 * pushed when the queue is being flushed. 49128 */ 49129function queueWatcher (watcher) { 49130 var id = watcher.id; 49131 if (has[id] == null) { 49132 has[id] = true; 49133 if (!flushing) { 49134 queue.push(watcher); 49135 } else { 49136 // if already flushing, splice the watcher based on its id 49137 // if already past its id, it will be run next immediately. 49138 var i = queue.length - 1; 49139 while (i > index && queue[i].id > watcher.id) { 49140 i--; 49141 } 49142 queue.splice(i + 1, 0, watcher); 49143 } 49144 // queue the flush 49145 if (!waiting) { 49146 waiting = true; 49147 49148 if (!config.async) { 49149 flushSchedulerQueue(); 49150 return 49151 } 49152 nextTick(flushSchedulerQueue); 49153 } 49154 } 49155} 49156 49157/* */ 49158 49159 49160 49161var uid$2 = 0; 49162 49163/** 49164 * A watcher parses an expression, collects dependencies, 49165 * and fires callback when the expression value changes. 49166 * This is used for both the $watch() api and directives. 49167 */ 49168var Watcher = function Watcher ( 49169 vm, 49170 expOrFn, 49171 cb, 49172 options, 49173 isRenderWatcher 49174) { 49175 this.vm = vm; 49176 if (isRenderWatcher) { 49177 vm._watcher = this; 49178 } 49179 vm._watchers.push(this); 49180 // options 49181 if (options) { 49182 this.deep = !!options.deep; 49183 this.user = !!options.user; 49184 this.lazy = !!options.lazy; 49185 this.sync = !!options.sync; 49186 this.before = options.before; 49187 } else { 49188 this.deep = this.user = this.lazy = this.sync = false; 49189 } 49190 this.cb = cb; 49191 this.id = ++uid$2; // uid for batching 49192 this.active = true; 49193 this.dirty = this.lazy; // for lazy watchers 49194 this.deps = []; 49195 this.newDeps = []; 49196 this.depIds = new _Set(); 49197 this.newDepIds = new _Set(); 49198 this.expression = expOrFn.toString(); 49199 // parse expression for getter 49200 if (typeof expOrFn === 'function') { 49201 this.getter = expOrFn; 49202 } else { 49203 this.getter = parsePath(expOrFn); 49204 if (!this.getter) { 49205 this.getter = noop; 49206 warn( 49207 "Failed watching path: \"" + expOrFn + "\" " + 49208 'Watcher only accepts simple dot-delimited paths. ' + 49209 'For full control, use a function instead.', 49210 vm 49211 ); 49212 } 49213 } 49214 this.value = this.lazy 49215 ? undefined 49216 : this.get(); 49217}; 49218 49219/** 49220 * Evaluate the getter, and re-collect dependencies. 49221 */ 49222Watcher.prototype.get = function get () { 49223 pushTarget(this); 49224 var value; 49225 var vm = this.vm; 49226 try { 49227 value = this.getter.call(vm, vm); 49228 } catch (e) { 49229 if (this.user) { 49230 handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\"")); 49231 } else { 49232 throw e 49233 } 49234 } finally { 49235 // "touch" every property so they are all tracked as 49236 // dependencies for deep watching 49237 if (this.deep) { 49238 traverse(value); 49239 } 49240 popTarget(); 49241 this.cleanupDeps(); 49242 } 49243 return value 49244}; 49245 49246/** 49247 * Add a dependency to this directive. 49248 */ 49249Watcher.prototype.addDep = function addDep (dep) { 49250 var id = dep.id; 49251 if (!this.newDepIds.has(id)) { 49252 this.newDepIds.add(id); 49253 this.newDeps.push(dep); 49254 if (!this.depIds.has(id)) { 49255 dep.addSub(this); 49256 } 49257 } 49258}; 49259 49260/** 49261 * Clean up for dependency collection. 49262 */ 49263Watcher.prototype.cleanupDeps = function cleanupDeps () { 49264 var i = this.deps.length; 49265 while (i--) { 49266 var dep = this.deps[i]; 49267 if (!this.newDepIds.has(dep.id)) { 49268 dep.removeSub(this); 49269 } 49270 } 49271 var tmp = this.depIds; 49272 this.depIds = this.newDepIds; 49273 this.newDepIds = tmp; 49274 this.newDepIds.clear(); 49275 tmp = this.deps; 49276 this.deps = this.newDeps; 49277 this.newDeps = tmp; 49278 this.newDeps.length = 0; 49279}; 49280 49281/** 49282 * Subscriber interface. 49283 * Will be called when a dependency changes. 49284 */ 49285Watcher.prototype.update = function update () { 49286 /* istanbul ignore else */ 49287 if (this.lazy) { 49288 this.dirty = true; 49289 } else if (this.sync) { 49290 this.run(); 49291 } else { 49292 queueWatcher(this); 49293 } 49294}; 49295 49296/** 49297 * Scheduler job interface. 49298 * Will be called by the scheduler. 49299 */ 49300Watcher.prototype.run = function run () { 49301 if (this.active) { 49302 var value = this.get(); 49303 if ( 49304 value !== this.value || 49305 // Deep watchers and watchers on Object/Arrays should fire even 49306 // when the value is the same, because the value may 49307 // have mutated. 49308 isObject(value) || 49309 this.deep 49310 ) { 49311 // set new value 49312 var oldValue = this.value; 49313 this.value = value; 49314 if (this.user) { 49315 var info = "callback for watcher \"" + (this.expression) + "\""; 49316 invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info); 49317 } else { 49318 this.cb.call(this.vm, value, oldValue); 49319 } 49320 } 49321 } 49322}; 49323 49324/** 49325 * Evaluate the value of the watcher. 49326 * This only gets called for lazy watchers. 49327 */ 49328Watcher.prototype.evaluate = function evaluate () { 49329 this.value = this.get(); 49330 this.dirty = false; 49331}; 49332 49333/** 49334 * Depend on all deps collected by this watcher. 49335 */ 49336Watcher.prototype.depend = function depend () { 49337 var i = this.deps.length; 49338 while (i--) { 49339 this.deps[i].depend(); 49340 } 49341}; 49342 49343/** 49344 * Remove self from all dependencies' subscriber list. 49345 */ 49346Watcher.prototype.teardown = function teardown () { 49347 if (this.active) { 49348 // remove self from vm's watcher list 49349 // this is a somewhat expensive operation so we skip it 49350 // if the vm is being destroyed. 49351 if (!this.vm._isBeingDestroyed) { 49352 remove(this.vm._watchers, this); 49353 } 49354 var i = this.deps.length; 49355 while (i--) { 49356 this.deps[i].removeSub(this); 49357 } 49358 this.active = false; 49359 } 49360}; 49361 49362/* */ 49363 49364var sharedPropertyDefinition = { 49365 enumerable: true, 49366 configurable: true, 49367 get: noop, 49368 set: noop 49369}; 49370 49371function proxy (target, sourceKey, key) { 49372 sharedPropertyDefinition.get = function proxyGetter () { 49373 return this[sourceKey][key] 49374 }; 49375 sharedPropertyDefinition.set = function proxySetter (val) { 49376 this[sourceKey][key] = val; 49377 }; 49378 Object.defineProperty(target, key, sharedPropertyDefinition); 49379} 49380 49381function initState (vm) { 49382 vm._watchers = []; 49383 var opts = vm.$options; 49384 if (opts.props) { initProps(vm, opts.props); } 49385 if (opts.methods) { initMethods(vm, opts.methods); } 49386 if (opts.data) { 49387 initData(vm); 49388 } else { 49389 observe(vm._data = {}, true /* asRootData */); 49390 } 49391 if (opts.computed) { initComputed(vm, opts.computed); } 49392 if (opts.watch && opts.watch !== nativeWatch) { 49393 initWatch(vm, opts.watch); 49394 } 49395} 49396 49397function initProps (vm, propsOptions) { 49398 var propsData = vm.$options.propsData || {}; 49399 var props = vm._props = {}; 49400 // cache prop keys so that future props updates can iterate using Array 49401 // instead of dynamic object key enumeration. 49402 var keys = vm.$options._propKeys = []; 49403 var isRoot = !vm.$parent; 49404 // root instance props should be converted 49405 if (!isRoot) { 49406 toggleObserving(false); 49407 } 49408 var loop = function ( key ) { 49409 keys.push(key); 49410 var value = validateProp(key, propsOptions, propsData, vm); 49411 /* istanbul ignore else */ 49412 { 49413 var hyphenatedKey = hyphenate(key); 49414 if (isReservedAttribute(hyphenatedKey) || 49415 config.isReservedAttr(hyphenatedKey)) { 49416 warn( 49417 ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."), 49418 vm 49419 ); 49420 } 49421 defineReactive$$1(props, key, value, function () { 49422 if (!isRoot && !isUpdatingChildComponent) { 49423 warn( 49424 "Avoid mutating a prop directly since the value will be " + 49425 "overwritten whenever the parent component re-renders. " + 49426 "Instead, use a data or computed property based on the prop's " + 49427 "value. Prop being mutated: \"" + key + "\"", 49428 vm 49429 ); 49430 } 49431 }); 49432 } 49433 // static props are already proxied on the component's prototype 49434 // during Vue.extend(). We only need to proxy props defined at 49435 // instantiation here. 49436 if (!(key in vm)) { 49437 proxy(vm, "_props", key); 49438 } 49439 }; 49440 49441 for (var key in propsOptions) loop( key ); 49442 toggleObserving(true); 49443} 49444 49445function initData (vm) { 49446 var data = vm.$options.data; 49447 data = vm._data = typeof data === 'function' 49448 ? getData(data, vm) 49449 : data || {}; 49450 if (!isPlainObject(data)) { 49451 data = {}; 49452 warn( 49453 'data functions should return an object:\n' + 49454 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', 49455 vm 49456 ); 49457 } 49458 // proxy data on instance 49459 var keys = Object.keys(data); 49460 var props = vm.$options.props; 49461 var methods = vm.$options.methods; 49462 var i = keys.length; 49463 while (i--) { 49464 var key = keys[i]; 49465 { 49466 if (methods && hasOwn(methods, key)) { 49467 warn( 49468 ("Method \"" + key + "\" has already been defined as a data property."), 49469 vm 49470 ); 49471 } 49472 } 49473 if (props && hasOwn(props, key)) { 49474 warn( 49475 "The data property \"" + key + "\" is already declared as a prop. " + 49476 "Use prop default value instead.", 49477 vm 49478 ); 49479 } else if (!isReserved(key)) { 49480 proxy(vm, "_data", key); 49481 } 49482 } 49483 // observe data 49484 observe(data, true /* asRootData */); 49485} 49486 49487function getData (data, vm) { 49488 // #7573 disable dep collection when invoking data getters 49489 pushTarget(); 49490 try { 49491 return data.call(vm, vm) 49492 } catch (e) { 49493 handleError(e, vm, "data()"); 49494 return {} 49495 } finally { 49496 popTarget(); 49497 } 49498} 49499 49500var computedWatcherOptions = { lazy: true }; 49501 49502function initComputed (vm, computed) { 49503 // $flow-disable-line 49504 var watchers = vm._computedWatchers = Object.create(null); 49505 // computed properties are just getters during SSR 49506 var isSSR = isServerRendering(); 49507 49508 for (var key in computed) { 49509 var userDef = computed[key]; 49510 var getter = typeof userDef === 'function' ? userDef : userDef.get; 49511 if (getter == null) { 49512 warn( 49513 ("Getter is missing for computed property \"" + key + "\"."), 49514 vm 49515 ); 49516 } 49517 49518 if (!isSSR) { 49519 // create internal watcher for the computed property. 49520 watchers[key] = new Watcher( 49521 vm, 49522 getter || noop, 49523 noop, 49524 computedWatcherOptions 49525 ); 49526 } 49527 49528 // component-defined computed properties are already defined on the 49529 // component prototype. We only need to define computed properties defined 49530 // at instantiation here. 49531 if (!(key in vm)) { 49532 defineComputed(vm, key, userDef); 49533 } else { 49534 if (key in vm.$data) { 49535 warn(("The computed property \"" + key + "\" is already defined in data."), vm); 49536 } else if (vm.$options.props && key in vm.$options.props) { 49537 warn(("The computed property \"" + key + "\" is already defined as a prop."), vm); 49538 } else if (vm.$options.methods && key in vm.$options.methods) { 49539 warn(("The computed property \"" + key + "\" is already defined as a method."), vm); 49540 } 49541 } 49542 } 49543} 49544 49545function defineComputed ( 49546 target, 49547 key, 49548 userDef 49549) { 49550 var shouldCache = !isServerRendering(); 49551 if (typeof userDef === 'function') { 49552 sharedPropertyDefinition.get = shouldCache 49553 ? createComputedGetter(key) 49554 : createGetterInvoker(userDef); 49555 sharedPropertyDefinition.set = noop; 49556 } else { 49557 sharedPropertyDefinition.get = userDef.get 49558 ? shouldCache && userDef.cache !== false 49559 ? createComputedGetter(key) 49560 : createGetterInvoker(userDef.get) 49561 : noop; 49562 sharedPropertyDefinition.set = userDef.set || noop; 49563 } 49564 if (sharedPropertyDefinition.set === noop) { 49565 sharedPropertyDefinition.set = function () { 49566 warn( 49567 ("Computed property \"" + key + "\" was assigned to but it has no setter."), 49568 this 49569 ); 49570 }; 49571 } 49572 Object.defineProperty(target, key, sharedPropertyDefinition); 49573} 49574 49575function createComputedGetter (key) { 49576 return function computedGetter () { 49577 var watcher = this._computedWatchers && this._computedWatchers[key]; 49578 if (watcher) { 49579 if (watcher.dirty) { 49580 watcher.evaluate(); 49581 } 49582 if (Dep.target) { 49583 watcher.depend(); 49584 } 49585 return watcher.value 49586 } 49587 } 49588} 49589 49590function createGetterInvoker(fn) { 49591 return function computedGetter () { 49592 return fn.call(this, this) 49593 } 49594} 49595 49596function initMethods (vm, methods) { 49597 var props = vm.$options.props; 49598 for (var key in methods) { 49599 { 49600 if (typeof methods[key] !== 'function') { 49601 warn( 49602 "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " + 49603 "Did you reference the function correctly?", 49604 vm 49605 ); 49606 } 49607 if (props && hasOwn(props, key)) { 49608 warn( 49609 ("Method \"" + key + "\" has already been defined as a prop."), 49610 vm 49611 ); 49612 } 49613 if ((key in vm) && isReserved(key)) { 49614 warn( 49615 "Method \"" + key + "\" conflicts with an existing Vue instance method. " + 49616 "Avoid defining component methods that start with _ or $." 49617 ); 49618 } 49619 } 49620 vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm); 49621 } 49622} 49623 49624function initWatch (vm, watch) { 49625 for (var key in watch) { 49626 var handler = watch[key]; 49627 if (Array.isArray(handler)) { 49628 for (var i = 0; i < handler.length; i++) { 49629 createWatcher(vm, key, handler[i]); 49630 } 49631 } else { 49632 createWatcher(vm, key, handler); 49633 } 49634 } 49635} 49636 49637function createWatcher ( 49638 vm, 49639 expOrFn, 49640 handler, 49641 options 49642) { 49643 if (isPlainObject(handler)) { 49644 options = handler; 49645 handler = handler.handler; 49646 } 49647 if (typeof handler === 'string') { 49648 handler = vm[handler]; 49649 } 49650 return vm.$watch(expOrFn, handler, options) 49651} 49652 49653function stateMixin (Vue) { 49654 // flow somehow has problems with directly declared definition object 49655 // when using Object.defineProperty, so we have to procedurally build up 49656 // the object here. 49657 var dataDef = {}; 49658 dataDef.get = function () { return this._data }; 49659 var propsDef = {}; 49660 propsDef.get = function () { return this._props }; 49661 { 49662 dataDef.set = function () { 49663 warn( 49664 'Avoid replacing instance root $data. ' + 49665 'Use nested data properties instead.', 49666 this 49667 ); 49668 }; 49669 propsDef.set = function () { 49670 warn("$props is readonly.", this); 49671 }; 49672 } 49673 Object.defineProperty(Vue.prototype, '$data', dataDef); 49674 Object.defineProperty(Vue.prototype, '$props', propsDef); 49675 49676 Vue.prototype.$set = set; 49677 Vue.prototype.$delete = del; 49678 49679 Vue.prototype.$watch = function ( 49680 expOrFn, 49681 cb, 49682 options 49683 ) { 49684 var vm = this; 49685 if (isPlainObject(cb)) { 49686 return createWatcher(vm, expOrFn, cb, options) 49687 } 49688 options = options || {}; 49689 options.user = true; 49690 var watcher = new Watcher(vm, expOrFn, cb, options); 49691 if (options.immediate) { 49692 var info = "callback for immediate watcher \"" + (watcher.expression) + "\""; 49693 pushTarget(); 49694 invokeWithErrorHandling(cb, vm, [watcher.value], vm, info); 49695 popTarget(); 49696 } 49697 return function unwatchFn () { 49698 watcher.teardown(); 49699 } 49700 }; 49701} 49702 49703/* */ 49704 49705var uid$3 = 0; 49706 49707function initMixin (Vue) { 49708 Vue.prototype._init = function (options) { 49709 var vm = this; 49710 // a uid 49711 vm._uid = uid$3++; 49712 49713 var startTag, endTag; 49714 /* istanbul ignore if */ 49715 if (config.performance && mark) { 49716 startTag = "vue-perf-start:" + (vm._uid); 49717 endTag = "vue-perf-end:" + (vm._uid); 49718 mark(startTag); 49719 } 49720 49721 // a flag to avoid this being observed 49722 vm._isVue = true; 49723 // merge options 49724 if (options && options._isComponent) { 49725 // optimize internal component instantiation 49726 // since dynamic options merging is pretty slow, and none of the 49727 // internal component options needs special treatment. 49728 initInternalComponent(vm, options); 49729 } else { 49730 vm.$options = mergeOptions( 49731 resolveConstructorOptions(vm.constructor), 49732 options || {}, 49733 vm 49734 ); 49735 } 49736 /* istanbul ignore else */ 49737 { 49738 initProxy(vm); 49739 } 49740 // expose real self 49741 vm._self = vm; 49742 initLifecycle(vm); 49743 initEvents(vm); 49744 initRender(vm); 49745 callHook(vm, 'beforeCreate'); 49746 initInjections(vm); // resolve injections before data/props 49747 initState(vm); 49748 initProvide(vm); // resolve provide after data/props 49749 callHook(vm, 'created'); 49750 49751 /* istanbul ignore if */ 49752 if (config.performance && mark) { 49753 vm._name = formatComponentName(vm, false); 49754 mark(endTag); 49755 measure(("vue " + (vm._name) + " init"), startTag, endTag); 49756 } 49757 49758 if (vm.$options.el) { 49759 vm.$mount(vm.$options.el); 49760 } 49761 }; 49762} 49763 49764function initInternalComponent (vm, options) { 49765 var opts = vm.$options = Object.create(vm.constructor.options); 49766 // doing this because it's faster than dynamic enumeration. 49767 var parentVnode = options._parentVnode; 49768 opts.parent = options.parent; 49769 opts._parentVnode = parentVnode; 49770 49771 var vnodeComponentOptions = parentVnode.componentOptions; 49772 opts.propsData = vnodeComponentOptions.propsData; 49773 opts._parentListeners = vnodeComponentOptions.listeners; 49774 opts._renderChildren = vnodeComponentOptions.children; 49775 opts._componentTag = vnodeComponentOptions.tag; 49776 49777 if (options.render) { 49778 opts.render = options.render; 49779 opts.staticRenderFns = options.staticRenderFns; 49780 } 49781} 49782 49783function resolveConstructorOptions (Ctor) { 49784 var options = Ctor.options; 49785 if (Ctor.super) { 49786 var superOptions = resolveConstructorOptions(Ctor.super); 49787 var cachedSuperOptions = Ctor.superOptions; 49788 if (superOptions !== cachedSuperOptions) { 49789 // super option changed, 49790 // need to resolve new options. 49791 Ctor.superOptions = superOptions; 49792 // check if there are any late-modified/attached options (#4976) 49793 var modifiedOptions = resolveModifiedOptions(Ctor); 49794 // update base extend options 49795 if (modifiedOptions) { 49796 extend(Ctor.extendOptions, modifiedOptions); 49797 } 49798 options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions); 49799 if (options.name) { 49800 options.components[options.name] = Ctor; 49801 } 49802 } 49803 } 49804 return options 49805} 49806 49807function resolveModifiedOptions (Ctor) { 49808 var modified; 49809 var latest = Ctor.options; 49810 var sealed = Ctor.sealedOptions; 49811 for (var key in latest) { 49812 if (latest[key] !== sealed[key]) { 49813 if (!modified) { modified = {}; } 49814 modified[key] = latest[key]; 49815 } 49816 } 49817 return modified 49818} 49819 49820function Vue (options) { 49821 if (!(this instanceof Vue) 49822 ) { 49823 warn('Vue is a constructor and should be called with the `new` keyword'); 49824 } 49825 this._init(options); 49826} 49827 49828initMixin(Vue); 49829stateMixin(Vue); 49830eventsMixin(Vue); 49831lifecycleMixin(Vue); 49832renderMixin(Vue); 49833 49834/* */ 49835 49836function initUse (Vue) { 49837 Vue.use = function (plugin) { 49838 var installedPlugins = (this._installedPlugins || (this._installedPlugins = [])); 49839 if (installedPlugins.indexOf(plugin) > -1) { 49840 return this 49841 } 49842 49843 // additional parameters 49844 var args = toArray(arguments, 1); 49845 args.unshift(this); 49846 if (typeof plugin.install === 'function') { 49847 plugin.install.apply(plugin, args); 49848 } else if (typeof plugin === 'function') { 49849 plugin.apply(null, args); 49850 } 49851 installedPlugins.push(plugin); 49852 return this 49853 }; 49854} 49855 49856/* */ 49857 49858function initMixin$1 (Vue) { 49859 Vue.mixin = function (mixin) { 49860 this.options = mergeOptions(this.options, mixin); 49861 return this 49862 }; 49863} 49864 49865/* */ 49866 49867function initExtend (Vue) { 49868 /** 49869 * Each instance constructor, including Vue, has a unique 49870 * cid. This enables us to create wrapped "child 49871 * constructors" for prototypal inheritance and cache them. 49872 */ 49873 Vue.cid = 0; 49874 var cid = 1; 49875 49876 /** 49877 * Class inheritance 49878 */ 49879 Vue.extend = function (extendOptions) { 49880 extendOptions = extendOptions || {}; 49881 var Super = this; 49882 var SuperId = Super.cid; 49883 var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {}); 49884 if (cachedCtors[SuperId]) { 49885 return cachedCtors[SuperId] 49886 } 49887 49888 var name = extendOptions.name || Super.options.name; 49889 if (name) { 49890 validateComponentName(name); 49891 } 49892 49893 var Sub = function VueComponent (options) { 49894 this._init(options); 49895 }; 49896 Sub.prototype = Object.create(Super.prototype); 49897 Sub.prototype.constructor = Sub; 49898 Sub.cid = cid++; 49899 Sub.options = mergeOptions( 49900 Super.options, 49901 extendOptions 49902 ); 49903 Sub['super'] = Super; 49904 49905 // For props and computed properties, we define the proxy getters on 49906 // the Vue instances at extension time, on the extended prototype. This 49907 // avoids Object.defineProperty calls for each instance created. 49908 if (Sub.options.props) { 49909 initProps$1(Sub); 49910 } 49911 if (Sub.options.computed) { 49912 initComputed$1(Sub); 49913 } 49914 49915 // allow further extension/mixin/plugin usage 49916 Sub.extend = Super.extend; 49917 Sub.mixin = Super.mixin; 49918 Sub.use = Super.use; 49919 49920 // create asset registers, so extended classes 49921 // can have their private assets too. 49922 ASSET_TYPES.forEach(function (type) { 49923 Sub[type] = Super[type]; 49924 }); 49925 // enable recursive self-lookup 49926 if (name) { 49927 Sub.options.components[name] = Sub; 49928 } 49929 49930 // keep a reference to the super options at extension time. 49931 // later at instantiation we can check if Super's options have 49932 // been updated. 49933 Sub.superOptions = Super.options; 49934 Sub.extendOptions = extendOptions; 49935 Sub.sealedOptions = extend({}, Sub.options); 49936 49937 // cache constructor 49938 cachedCtors[SuperId] = Sub; 49939 return Sub 49940 }; 49941} 49942 49943function initProps$1 (Comp) { 49944 var props = Comp.options.props; 49945 for (var key in props) { 49946 proxy(Comp.prototype, "_props", key); 49947 } 49948} 49949 49950function initComputed$1 (Comp) { 49951 var computed = Comp.options.computed; 49952 for (var key in computed) { 49953 defineComputed(Comp.prototype, key, computed[key]); 49954 } 49955} 49956 49957/* */ 49958 49959function initAssetRegisters (Vue) { 49960 /** 49961 * Create asset registration methods. 49962 */ 49963 ASSET_TYPES.forEach(function (type) { 49964 Vue[type] = function ( 49965 id, 49966 definition 49967 ) { 49968 if (!definition) { 49969 return this.options[type + 's'][id] 49970 } else { 49971 /* istanbul ignore if */ 49972 if (type === 'component') { 49973 validateComponentName(id); 49974 } 49975 if (type === 'component' && isPlainObject(definition)) { 49976 definition.name = definition.name || id; 49977 definition = this.options._base.extend(definition); 49978 } 49979 if (type === 'directive' && typeof definition === 'function') { 49980 definition = { bind: definition, update: definition }; 49981 } 49982 this.options[type + 's'][id] = definition; 49983 return definition 49984 } 49985 }; 49986 }); 49987} 49988 49989/* */ 49990 49991 49992 49993 49994 49995function getComponentName (opts) { 49996 return opts && (opts.Ctor.options.name || opts.tag) 49997} 49998 49999function matches (pattern, name) { 50000 if (Array.isArray(pattern)) { 50001 return pattern.indexOf(name) > -1 50002 } else if (typeof pattern === 'string') { 50003 return pattern.split(',').indexOf(name) > -1 50004 } else if (isRegExp(pattern)) { 50005 return pattern.test(name) 50006 } 50007 /* istanbul ignore next */ 50008 return false 50009} 50010 50011function pruneCache (keepAliveInstance, filter) { 50012 var cache = keepAliveInstance.cache; 50013 var keys = keepAliveInstance.keys; 50014 var _vnode = keepAliveInstance._vnode; 50015 for (var key in cache) { 50016 var entry = cache[key]; 50017 if (entry) { 50018 var name = entry.name; 50019 if (name && !filter(name)) { 50020 pruneCacheEntry(cache, key, keys, _vnode); 50021 } 50022 } 50023 } 50024} 50025 50026function pruneCacheEntry ( 50027 cache, 50028 key, 50029 keys, 50030 current 50031) { 50032 var entry = cache[key]; 50033 if (entry && (!current || entry.tag !== current.tag)) { 50034 entry.componentInstance.$destroy(); 50035 } 50036 cache[key] = null; 50037 remove(keys, key); 50038} 50039 50040var patternTypes = [String, RegExp, Array]; 50041 50042var KeepAlive = { 50043 name: 'keep-alive', 50044 abstract: true, 50045 50046 props: { 50047 include: patternTypes, 50048 exclude: patternTypes, 50049 max: [String, Number] 50050 }, 50051 50052 methods: { 50053 cacheVNode: function cacheVNode() { 50054 var ref = this; 50055 var cache = ref.cache; 50056 var keys = ref.keys; 50057 var vnodeToCache = ref.vnodeToCache; 50058 var keyToCache = ref.keyToCache; 50059 if (vnodeToCache) { 50060 var tag = vnodeToCache.tag; 50061 var componentInstance = vnodeToCache.componentInstance; 50062 var componentOptions = vnodeToCache.componentOptions; 50063 cache[keyToCache] = { 50064 name: getComponentName(componentOptions), 50065 tag: tag, 50066 componentInstance: componentInstance, 50067 }; 50068 keys.push(keyToCache); 50069 // prune oldest entry 50070 if (this.max && keys.length > parseInt(this.max)) { 50071 pruneCacheEntry(cache, keys[0], keys, this._vnode); 50072 } 50073 this.vnodeToCache = null; 50074 } 50075 } 50076 }, 50077 50078 created: function created () { 50079 this.cache = Object.create(null); 50080 this.keys = []; 50081 }, 50082 50083 destroyed: function destroyed () { 50084 for (var key in this.cache) { 50085 pruneCacheEntry(this.cache, key, this.keys); 50086 } 50087 }, 50088 50089 mounted: function mounted () { 50090 var this$1 = this; 50091 50092 this.cacheVNode(); 50093 this.$watch('include', function (val) { 50094 pruneCache(this$1, function (name) { return matches(val, name); }); 50095 }); 50096 this.$watch('exclude', function (val) { 50097 pruneCache(this$1, function (name) { return !matches(val, name); }); 50098 }); 50099 }, 50100 50101 updated: function updated () { 50102 this.cacheVNode(); 50103 }, 50104 50105 render: function render () { 50106 var slot = this.$slots.default; 50107 var vnode = getFirstComponentChild(slot); 50108 var componentOptions = vnode && vnode.componentOptions; 50109 if (componentOptions) { 50110 // check pattern 50111 var name = getComponentName(componentOptions); 50112 var ref = this; 50113 var include = ref.include; 50114 var exclude = ref.exclude; 50115 if ( 50116 // not included 50117 (include && (!name || !matches(include, name))) || 50118 // excluded 50119 (exclude && name && matches(exclude, name)) 50120 ) { 50121 return vnode 50122 } 50123 50124 var ref$1 = this; 50125 var cache = ref$1.cache; 50126 var keys = ref$1.keys; 50127 var key = vnode.key == null 50128 // same constructor may get registered as different local components 50129 // so cid alone is not enough (#3269) 50130 ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '') 50131 : vnode.key; 50132 if (cache[key]) { 50133 vnode.componentInstance = cache[key].componentInstance; 50134 // make current key freshest 50135 remove(keys, key); 50136 keys.push(key); 50137 } else { 50138 // delay setting the cache until update 50139 this.vnodeToCache = vnode; 50140 this.keyToCache = key; 50141 } 50142 50143 vnode.data.keepAlive = true; 50144 } 50145 return vnode || (slot && slot[0]) 50146 } 50147}; 50148 50149var builtInComponents = { 50150 KeepAlive: KeepAlive 50151}; 50152 50153/* */ 50154 50155function initGlobalAPI (Vue) { 50156 // config 50157 var configDef = {}; 50158 configDef.get = function () { return config; }; 50159 { 50160 configDef.set = function () { 50161 warn( 50162 'Do not replace the Vue.config object, set individual fields instead.' 50163 ); 50164 }; 50165 } 50166 Object.defineProperty(Vue, 'config', configDef); 50167 50168 // exposed util methods. 50169 // NOTE: these are not considered part of the public API - avoid relying on 50170 // them unless you are aware of the risk. 50171 Vue.util = { 50172 warn: warn, 50173 extend: extend, 50174 mergeOptions: mergeOptions, 50175 defineReactive: defineReactive$$1 50176 }; 50177 50178 Vue.set = set; 50179 Vue.delete = del; 50180 Vue.nextTick = nextTick; 50181 50182 // 2.6 explicit observable API 50183 Vue.observable = function (obj) { 50184 observe(obj); 50185 return obj 50186 }; 50187 50188 Vue.options = Object.create(null); 50189 ASSET_TYPES.forEach(function (type) { 50190 Vue.options[type + 's'] = Object.create(null); 50191 }); 50192 50193 // this is used to identify the "base" constructor to extend all plain-object 50194 // components with in Weex's multi-instance scenarios. 50195 Vue.options._base = Vue; 50196 50197 extend(Vue.options.components, builtInComponents); 50198 50199 initUse(Vue); 50200 initMixin$1(Vue); 50201 initExtend(Vue); 50202 initAssetRegisters(Vue); 50203} 50204 50205initGlobalAPI(Vue); 50206 50207Object.defineProperty(Vue.prototype, '$isServer', { 50208 get: isServerRendering 50209}); 50210 50211Object.defineProperty(Vue.prototype, '$ssrContext', { 50212 get: function get () { 50213 /* istanbul ignore next */ 50214 return this.$vnode && this.$vnode.ssrContext 50215 } 50216}); 50217 50218// expose FunctionalRenderContext for ssr runtime helper installation 50219Object.defineProperty(Vue, 'FunctionalRenderContext', { 50220 value: FunctionalRenderContext 50221}); 50222 50223Vue.version = '2.6.14'; 50224 50225/* */ 50226 50227// these are reserved for web because they are directly compiled away 50228// during template compilation 50229var isReservedAttr = makeMap('style,class'); 50230 50231// attributes that should be using props for binding 50232var acceptValue = makeMap('input,textarea,option,select,progress'); 50233var mustUseProp = function (tag, type, attr) { 50234 return ( 50235 (attr === 'value' && acceptValue(tag)) && type !== 'button' || 50236 (attr === 'selected' && tag === 'option') || 50237 (attr === 'checked' && tag === 'input') || 50238 (attr === 'muted' && tag === 'video') 50239 ) 50240}; 50241 50242var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck'); 50243 50244var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only'); 50245 50246var convertEnumeratedValue = function (key, value) { 50247 return isFalsyAttrValue(value) || value === 'false' 50248 ? 'false' 50249 // allow arbitrary string value for contenteditable 50250 : key === 'contenteditable' && isValidContentEditableValue(value) 50251 ? value 50252 : 'true' 50253}; 50254 50255var isBooleanAttr = makeMap( 50256 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' + 50257 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' + 50258 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' + 50259 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' + 50260 'required,reversed,scoped,seamless,selected,sortable,' + 50261 'truespeed,typemustmatch,visible' 50262); 50263 50264var xlinkNS = 'http://www.w3.org/1999/xlink'; 50265 50266var isXlink = function (name) { 50267 return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink' 50268}; 50269 50270var getXlinkProp = function (name) { 50271 return isXlink(name) ? name.slice(6, name.length) : '' 50272}; 50273 50274var isFalsyAttrValue = function (val) { 50275 return val == null || val === false 50276}; 50277 50278/* */ 50279 50280function genClassForVnode (vnode) { 50281 var data = vnode.data; 50282 var parentNode = vnode; 50283 var childNode = vnode; 50284 while (isDef(childNode.componentInstance)) { 50285 childNode = childNode.componentInstance._vnode; 50286 if (childNode && childNode.data) { 50287 data = mergeClassData(childNode.data, data); 50288 } 50289 } 50290 while (isDef(parentNode = parentNode.parent)) { 50291 if (parentNode && parentNode.data) { 50292 data = mergeClassData(data, parentNode.data); 50293 } 50294 } 50295 return renderClass(data.staticClass, data.class) 50296} 50297 50298function mergeClassData (child, parent) { 50299 return { 50300 staticClass: concat(child.staticClass, parent.staticClass), 50301 class: isDef(child.class) 50302 ? [child.class, parent.class] 50303 : parent.class 50304 } 50305} 50306 50307function renderClass ( 50308 staticClass, 50309 dynamicClass 50310) { 50311 if (isDef(staticClass) || isDef(dynamicClass)) { 50312 return concat(staticClass, stringifyClass(dynamicClass)) 50313 } 50314 /* istanbul ignore next */ 50315 return '' 50316} 50317 50318function concat (a, b) { 50319 return a ? b ? (a + ' ' + b) : a : (b || '') 50320} 50321 50322function stringifyClass (value) { 50323 if (Array.isArray(value)) { 50324 return stringifyArray(value) 50325 } 50326 if (isObject(value)) { 50327 return stringifyObject(value) 50328 } 50329 if (typeof value === 'string') { 50330 return value 50331 } 50332 /* istanbul ignore next */ 50333 return '' 50334} 50335 50336function stringifyArray (value) { 50337 var res = ''; 50338 var stringified; 50339 for (var i = 0, l = value.length; i < l; i++) { 50340 if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') { 50341 if (res) { res += ' '; } 50342 res += stringified; 50343 } 50344 } 50345 return res 50346} 50347 50348function stringifyObject (value) { 50349 var res = ''; 50350 for (var key in value) { 50351 if (value[key]) { 50352 if (res) { res += ' '; } 50353 res += key; 50354 } 50355 } 50356 return res 50357} 50358 50359/* */ 50360 50361var namespaceMap = { 50362 svg: 'http://www.w3.org/2000/svg', 50363 math: 'http://www.w3.org/1998/Math/MathML' 50364}; 50365 50366var isHTMLTag = makeMap( 50367 'html,body,base,head,link,meta,style,title,' + 50368 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' + 50369 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' + 50370 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' + 50371 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' + 50372 'embed,object,param,source,canvas,script,noscript,del,ins,' + 50373 'caption,col,colgroup,table,thead,tbody,td,th,tr,' + 50374 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' + 50375 'output,progress,select,textarea,' + 50376 'details,dialog,menu,menuitem,summary,' + 50377 'content,element,shadow,template,blockquote,iframe,tfoot' 50378); 50379 50380// this map is intentionally selective, only covering SVG elements that may 50381// contain child elements. 50382var isSVG = makeMap( 50383 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' + 50384 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' + 50385 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', 50386 true 50387); 50388 50389var isPreTag = function (tag) { return tag === 'pre'; }; 50390 50391var isReservedTag = function (tag) { 50392 return isHTMLTag(tag) || isSVG(tag) 50393}; 50394 50395function getTagNamespace (tag) { 50396 if (isSVG(tag)) { 50397 return 'svg' 50398 } 50399 // basic support for MathML 50400 // note it doesn't support other MathML elements being component roots 50401 if (tag === 'math') { 50402 return 'math' 50403 } 50404} 50405 50406var unknownElementCache = Object.create(null); 50407function isUnknownElement (tag) { 50408 /* istanbul ignore if */ 50409 if (!inBrowser) { 50410 return true 50411 } 50412 if (isReservedTag(tag)) { 50413 return false 50414 } 50415 tag = tag.toLowerCase(); 50416 /* istanbul ignore if */ 50417 if (unknownElementCache[tag] != null) { 50418 return unknownElementCache[tag] 50419 } 50420 var el = document.createElement(tag); 50421 if (tag.indexOf('-') > -1) { 50422 // http://stackoverflow.com/a/28210364/1070244 50423 return (unknownElementCache[tag] = ( 50424 el.constructor === window.HTMLUnknownElement || 50425 el.constructor === window.HTMLElement 50426 )) 50427 } else { 50428 return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString())) 50429 } 50430} 50431 50432var isTextInputType = makeMap('text,number,password,search,email,tel,url'); 50433 50434/* */ 50435 50436/** 50437 * Query an element selector if it's not an element already. 50438 */ 50439function query (el) { 50440 if (typeof el === 'string') { 50441 var selected = document.querySelector(el); 50442 if (!selected) { 50443 warn( 50444 'Cannot find element: ' + el 50445 ); 50446 return document.createElement('div') 50447 } 50448 return selected 50449 } else { 50450 return el 50451 } 50452} 50453 50454/* */ 50455 50456function createElement$1 (tagName, vnode) { 50457 var elm = document.createElement(tagName); 50458 if (tagName !== 'select') { 50459 return elm 50460 } 50461 // false or null will remove the attribute but undefined will not 50462 if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) { 50463 elm.setAttribute('multiple', 'multiple'); 50464 } 50465 return elm 50466} 50467 50468function createElementNS (namespace, tagName) { 50469 return document.createElementNS(namespaceMap[namespace], tagName) 50470} 50471 50472function createTextNode (text) { 50473 return document.createTextNode(text) 50474} 50475 50476function createComment (text) { 50477 return document.createComment(text) 50478} 50479 50480function insertBefore (parentNode, newNode, referenceNode) { 50481 parentNode.insertBefore(newNode, referenceNode); 50482} 50483 50484function removeChild (node, child) { 50485 node.removeChild(child); 50486} 50487 50488function appendChild (node, child) { 50489 node.appendChild(child); 50490} 50491 50492function parentNode (node) { 50493 return node.parentNode 50494} 50495 50496function nextSibling (node) { 50497 return node.nextSibling 50498} 50499 50500function tagName (node) { 50501 return node.tagName 50502} 50503 50504function setTextContent (node, text) { 50505 node.textContent = text; 50506} 50507 50508function setStyleScope (node, scopeId) { 50509 node.setAttribute(scopeId, ''); 50510} 50511 50512var nodeOps = /*#__PURE__*/Object.freeze({ 50513 createElement: createElement$1, 50514 createElementNS: createElementNS, 50515 createTextNode: createTextNode, 50516 createComment: createComment, 50517 insertBefore: insertBefore, 50518 removeChild: removeChild, 50519 appendChild: appendChild, 50520 parentNode: parentNode, 50521 nextSibling: nextSibling, 50522 tagName: tagName, 50523 setTextContent: setTextContent, 50524 setStyleScope: setStyleScope 50525}); 50526 50527/* */ 50528 50529var ref = { 50530 create: function create (_, vnode) { 50531 registerRef(vnode); 50532 }, 50533 update: function update (oldVnode, vnode) { 50534 if (oldVnode.data.ref !== vnode.data.ref) { 50535 registerRef(oldVnode, true); 50536 registerRef(vnode); 50537 } 50538 }, 50539 destroy: function destroy (vnode) { 50540 registerRef(vnode, true); 50541 } 50542}; 50543 50544function registerRef (vnode, isRemoval) { 50545 var key = vnode.data.ref; 50546 if (!isDef(key)) { return } 50547 50548 var vm = vnode.context; 50549 var ref = vnode.componentInstance || vnode.elm; 50550 var refs = vm.$refs; 50551 if (isRemoval) { 50552 if (Array.isArray(refs[key])) { 50553 remove(refs[key], ref); 50554 } else if (refs[key] === ref) { 50555 refs[key] = undefined; 50556 } 50557 } else { 50558 if (vnode.data.refInFor) { 50559 if (!Array.isArray(refs[key])) { 50560 refs[key] = [ref]; 50561 } else if (refs[key].indexOf(ref) < 0) { 50562 // $flow-disable-line 50563 refs[key].push(ref); 50564 } 50565 } else { 50566 refs[key] = ref; 50567 } 50568 } 50569} 50570 50571/** 50572 * Virtual DOM patching algorithm based on Snabbdom by 50573 * Simon Friis Vindum (@paldepind) 50574 * Licensed under the MIT License 50575 * https://github.com/paldepind/snabbdom/blob/master/LICENSE 50576 * 50577 * modified by Evan You (@yyx990803) 50578 * 50579 * Not type-checking this because this file is perf-critical and the cost 50580 * of making flow understand it is not worth it. 50581 */ 50582 50583var emptyNode = new VNode('', {}, []); 50584 50585var hooks = ['create', 'activate', 'update', 'remove', 'destroy']; 50586 50587function sameVnode (a, b) { 50588 return ( 50589 a.key === b.key && 50590 a.asyncFactory === b.asyncFactory && ( 50591 ( 50592 a.tag === b.tag && 50593 a.isComment === b.isComment && 50594 isDef(a.data) === isDef(b.data) && 50595 sameInputType(a, b) 50596 ) || ( 50597 isTrue(a.isAsyncPlaceholder) && 50598 isUndef(b.asyncFactory.error) 50599 ) 50600 ) 50601 ) 50602} 50603 50604function sameInputType (a, b) { 50605 if (a.tag !== 'input') { return true } 50606 var i; 50607 var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type; 50608 var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type; 50609 return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB) 50610} 50611 50612function createKeyToOldIdx (children, beginIdx, endIdx) { 50613 var i, key; 50614 var map = {}; 50615 for (i = beginIdx; i <= endIdx; ++i) { 50616 key = children[i].key; 50617 if (isDef(key)) { map[key] = i; } 50618 } 50619 return map 50620} 50621 50622function createPatchFunction (backend) { 50623 var i, j; 50624 var cbs = {}; 50625 50626 var modules = backend.modules; 50627 var nodeOps = backend.nodeOps; 50628 50629 for (i = 0; i < hooks.length; ++i) { 50630 cbs[hooks[i]] = []; 50631 for (j = 0; j < modules.length; ++j) { 50632 if (isDef(modules[j][hooks[i]])) { 50633 cbs[hooks[i]].push(modules[j][hooks[i]]); 50634 } 50635 } 50636 } 50637 50638 function emptyNodeAt (elm) { 50639 return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm) 50640 } 50641 50642 function createRmCb (childElm, listeners) { 50643 function remove$$1 () { 50644 if (--remove$$1.listeners === 0) { 50645 removeNode(childElm); 50646 } 50647 } 50648 remove$$1.listeners = listeners; 50649 return remove$$1 50650 } 50651 50652 function removeNode (el) { 50653 var parent = nodeOps.parentNode(el); 50654 // element may have already been removed due to v-html / v-text 50655 if (isDef(parent)) { 50656 nodeOps.removeChild(parent, el); 50657 } 50658 } 50659 50660 function isUnknownElement$$1 (vnode, inVPre) { 50661 return ( 50662 !inVPre && 50663 !vnode.ns && 50664 !( 50665 config.ignoredElements.length && 50666 config.ignoredElements.some(function (ignore) { 50667 return isRegExp(ignore) 50668 ? ignore.test(vnode.tag) 50669 : ignore === vnode.tag 50670 }) 50671 ) && 50672 config.isUnknownElement(vnode.tag) 50673 ) 50674 } 50675 50676 var creatingElmInVPre = 0; 50677 50678 function createElm ( 50679 vnode, 50680 insertedVnodeQueue, 50681 parentElm, 50682 refElm, 50683 nested, 50684 ownerArray, 50685 index 50686 ) { 50687 if (isDef(vnode.elm) && isDef(ownerArray)) { 50688 // This vnode was used in a previous render! 50689 // now it's used as a new node, overwriting its elm would cause 50690 // potential patch errors down the road when it's used as an insertion 50691 // reference node. Instead, we clone the node on-demand before creating 50692 // associated DOM element for it. 50693 vnode = ownerArray[index] = cloneVNode(vnode); 50694 } 50695 50696 vnode.isRootInsert = !nested; // for transition enter check 50697 if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) { 50698 return 50699 } 50700 50701 var data = vnode.data; 50702 var children = vnode.children; 50703 var tag = vnode.tag; 50704 if (isDef(tag)) { 50705 { 50706 if (data && data.pre) { 50707 creatingElmInVPre++; 50708 } 50709 if (isUnknownElement$$1(vnode, creatingElmInVPre)) { 50710 warn( 50711 'Unknown custom element: <' + tag + '> - did you ' + 50712 'register the component correctly? For recursive components, ' + 50713 'make sure to provide the "name" option.', 50714 vnode.context 50715 ); 50716 } 50717 } 50718 50719 vnode.elm = vnode.ns 50720 ? nodeOps.createElementNS(vnode.ns, tag) 50721 : nodeOps.createElement(tag, vnode); 50722 setScope(vnode); 50723 50724 /* istanbul ignore if */ 50725 { 50726 createChildren(vnode, children, insertedVnodeQueue); 50727 if (isDef(data)) { 50728 invokeCreateHooks(vnode, insertedVnodeQueue); 50729 } 50730 insert(parentElm, vnode.elm, refElm); 50731 } 50732 50733 if (data && data.pre) { 50734 creatingElmInVPre--; 50735 } 50736 } else if (isTrue(vnode.isComment)) { 50737 vnode.elm = nodeOps.createComment(vnode.text); 50738 insert(parentElm, vnode.elm, refElm); 50739 } else { 50740 vnode.elm = nodeOps.createTextNode(vnode.text); 50741 insert(parentElm, vnode.elm, refElm); 50742 } 50743 } 50744 50745 function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) { 50746 var i = vnode.data; 50747 if (isDef(i)) { 50748 var isReactivated = isDef(vnode.componentInstance) && i.keepAlive; 50749 if (isDef(i = i.hook) && isDef(i = i.init)) { 50750 i(vnode, false /* hydrating */); 50751 } 50752 // after calling the init hook, if the vnode is a child component 50753 // it should've created a child instance and mounted it. the child 50754 // component also has set the placeholder vnode's elm. 50755 // in that case we can just return the element and be done. 50756 if (isDef(vnode.componentInstance)) { 50757 initComponent(vnode, insertedVnodeQueue); 50758 insert(parentElm, vnode.elm, refElm); 50759 if (isTrue(isReactivated)) { 50760 reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm); 50761 } 50762 return true 50763 } 50764 } 50765 } 50766 50767 function initComponent (vnode, insertedVnodeQueue) { 50768 if (isDef(vnode.data.pendingInsert)) { 50769 insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert); 50770 vnode.data.pendingInsert = null; 50771 } 50772 vnode.elm = vnode.componentInstance.$el; 50773 if (isPatchable(vnode)) { 50774 invokeCreateHooks(vnode, insertedVnodeQueue); 50775 setScope(vnode); 50776 } else { 50777 // empty component root. 50778 // skip all element-related modules except for ref (#3455) 50779 registerRef(vnode); 50780 // make sure to invoke the insert hook 50781 insertedVnodeQueue.push(vnode); 50782 } 50783 } 50784 50785 function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) { 50786 var i; 50787 // hack for #4339: a reactivated component with inner transition 50788 // does not trigger because the inner node's created hooks are not called 50789 // again. It's not ideal to involve module-specific logic in here but 50790 // there doesn't seem to be a better way to do it. 50791 var innerNode = vnode; 50792 while (innerNode.componentInstance) { 50793 innerNode = innerNode.componentInstance._vnode; 50794 if (isDef(i = innerNode.data) && isDef(i = i.transition)) { 50795 for (i = 0; i < cbs.activate.length; ++i) { 50796 cbs.activate[i](emptyNode, innerNode); 50797 } 50798 insertedVnodeQueue.push(innerNode); 50799 break 50800 } 50801 } 50802 // unlike a newly created component, 50803 // a reactivated keep-alive component doesn't insert itself 50804 insert(parentElm, vnode.elm, refElm); 50805 } 50806 50807 function insert (parent, elm, ref$$1) { 50808 if (isDef(parent)) { 50809 if (isDef(ref$$1)) { 50810 if (nodeOps.parentNode(ref$$1) === parent) { 50811 nodeOps.insertBefore(parent, elm, ref$$1); 50812 } 50813 } else { 50814 nodeOps.appendChild(parent, elm); 50815 } 50816 } 50817 } 50818 50819 function createChildren (vnode, children, insertedVnodeQueue) { 50820 if (Array.isArray(children)) { 50821 { 50822 checkDuplicateKeys(children); 50823 } 50824 for (var i = 0; i < children.length; ++i) { 50825 createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i); 50826 } 50827 } else if (isPrimitive(vnode.text)) { 50828 nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text))); 50829 } 50830 } 50831 50832 function isPatchable (vnode) { 50833 while (vnode.componentInstance) { 50834 vnode = vnode.componentInstance._vnode; 50835 } 50836 return isDef(vnode.tag) 50837 } 50838 50839 function invokeCreateHooks (vnode, insertedVnodeQueue) { 50840 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) { 50841 cbs.create[i$1](emptyNode, vnode); 50842 } 50843 i = vnode.data.hook; // Reuse variable 50844 if (isDef(i)) { 50845 if (isDef(i.create)) { i.create(emptyNode, vnode); } 50846 if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); } 50847 } 50848 } 50849 50850 // set scope id attribute for scoped CSS. 50851 // this is implemented as a special case to avoid the overhead 50852 // of going through the normal attribute patching process. 50853 function setScope (vnode) { 50854 var i; 50855 if (isDef(i = vnode.fnScopeId)) { 50856 nodeOps.setStyleScope(vnode.elm, i); 50857 } else { 50858 var ancestor = vnode; 50859 while (ancestor) { 50860 if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) { 50861 nodeOps.setStyleScope(vnode.elm, i); 50862 } 50863 ancestor = ancestor.parent; 50864 } 50865 } 50866 // for slot content they should also get the scopeId from the host instance. 50867 if (isDef(i = activeInstance) && 50868 i !== vnode.context && 50869 i !== vnode.fnContext && 50870 isDef(i = i.$options._scopeId) 50871 ) { 50872 nodeOps.setStyleScope(vnode.elm, i); 50873 } 50874 } 50875 50876 function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) { 50877 for (; startIdx <= endIdx; ++startIdx) { 50878 createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx); 50879 } 50880 } 50881 50882 function invokeDestroyHook (vnode) { 50883 var i, j; 50884 var data = vnode.data; 50885 if (isDef(data)) { 50886 if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); } 50887 for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); } 50888 } 50889 if (isDef(i = vnode.children)) { 50890 for (j = 0; j < vnode.children.length; ++j) { 50891 invokeDestroyHook(vnode.children[j]); 50892 } 50893 } 50894 } 50895 50896 function removeVnodes (vnodes, startIdx, endIdx) { 50897 for (; startIdx <= endIdx; ++startIdx) { 50898 var ch = vnodes[startIdx]; 50899 if (isDef(ch)) { 50900 if (isDef(ch.tag)) { 50901 removeAndInvokeRemoveHook(ch); 50902 invokeDestroyHook(ch); 50903 } else { // Text node 50904 removeNode(ch.elm); 50905 } 50906 } 50907 } 50908 } 50909 50910 function removeAndInvokeRemoveHook (vnode, rm) { 50911 if (isDef(rm) || isDef(vnode.data)) { 50912 var i; 50913 var listeners = cbs.remove.length + 1; 50914 if (isDef(rm)) { 50915 // we have a recursively passed down rm callback 50916 // increase the listeners count 50917 rm.listeners += listeners; 50918 } else { 50919 // directly removing 50920 rm = createRmCb(vnode.elm, listeners); 50921 } 50922 // recursively invoke hooks on child component root node 50923 if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) { 50924 removeAndInvokeRemoveHook(i, rm); 50925 } 50926 for (i = 0; i < cbs.remove.length; ++i) { 50927 cbs.remove[i](vnode, rm); 50928 } 50929 if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) { 50930 i(vnode, rm); 50931 } else { 50932 rm(); 50933 } 50934 } else { 50935 removeNode(vnode.elm); 50936 } 50937 } 50938 50939 function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) { 50940 var oldStartIdx = 0; 50941 var newStartIdx = 0; 50942 var oldEndIdx = oldCh.length - 1; 50943 var oldStartVnode = oldCh[0]; 50944 var oldEndVnode = oldCh[oldEndIdx]; 50945 var newEndIdx = newCh.length - 1; 50946 var newStartVnode = newCh[0]; 50947 var newEndVnode = newCh[newEndIdx]; 50948 var oldKeyToIdx, idxInOld, vnodeToMove, refElm; 50949 50950 // removeOnly is a special flag used only by <transition-group> 50951 // to ensure removed elements stay in correct relative positions 50952 // during leaving transitions 50953 var canMove = !removeOnly; 50954 50955 { 50956 checkDuplicateKeys(newCh); 50957 } 50958 50959 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { 50960 if (isUndef(oldStartVnode)) { 50961 oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left 50962 } else if (isUndef(oldEndVnode)) { 50963 oldEndVnode = oldCh[--oldEndIdx]; 50964 } else if (sameVnode(oldStartVnode, newStartVnode)) { 50965 patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 50966 oldStartVnode = oldCh[++oldStartIdx]; 50967 newStartVnode = newCh[++newStartIdx]; 50968 } else if (sameVnode(oldEndVnode, newEndVnode)) { 50969 patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); 50970 oldEndVnode = oldCh[--oldEndIdx]; 50971 newEndVnode = newCh[--newEndIdx]; 50972 } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right 50973 patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx); 50974 canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm)); 50975 oldStartVnode = oldCh[++oldStartIdx]; 50976 newEndVnode = newCh[--newEndIdx]; 50977 } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left 50978 patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 50979 canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm); 50980 oldEndVnode = oldCh[--oldEndIdx]; 50981 newStartVnode = newCh[++newStartIdx]; 50982 } else { 50983 if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); } 50984 idxInOld = isDef(newStartVnode.key) 50985 ? oldKeyToIdx[newStartVnode.key] 50986 : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx); 50987 if (isUndef(idxInOld)) { // New element 50988 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); 50989 } else { 50990 vnodeToMove = oldCh[idxInOld]; 50991 if (sameVnode(vnodeToMove, newStartVnode)) { 50992 patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx); 50993 oldCh[idxInOld] = undefined; 50994 canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm); 50995 } else { 50996 // same key but different element. treat as new element 50997 createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx); 50998 } 50999 } 51000 newStartVnode = newCh[++newStartIdx]; 51001 } 51002 } 51003 if (oldStartIdx > oldEndIdx) { 51004 refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm; 51005 addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue); 51006 } else if (newStartIdx > newEndIdx) { 51007 removeVnodes(oldCh, oldStartIdx, oldEndIdx); 51008 } 51009 } 51010 51011 function checkDuplicateKeys (children) { 51012 var seenKeys = {}; 51013 for (var i = 0; i < children.length; i++) { 51014 var vnode = children[i]; 51015 var key = vnode.key; 51016 if (isDef(key)) { 51017 if (seenKeys[key]) { 51018 warn( 51019 ("Duplicate keys detected: '" + key + "'. This may cause an update error."), 51020 vnode.context 51021 ); 51022 } else { 51023 seenKeys[key] = true; 51024 } 51025 } 51026 } 51027 } 51028 51029 function findIdxInOld (node, oldCh, start, end) { 51030 for (var i = start; i < end; i++) { 51031 var c = oldCh[i]; 51032 if (isDef(c) && sameVnode(node, c)) { return i } 51033 } 51034 } 51035 51036 function patchVnode ( 51037 oldVnode, 51038 vnode, 51039 insertedVnodeQueue, 51040 ownerArray, 51041 index, 51042 removeOnly 51043 ) { 51044 if (oldVnode === vnode) { 51045 return 51046 } 51047 51048 if (isDef(vnode.elm) && isDef(ownerArray)) { 51049 // clone reused vnode 51050 vnode = ownerArray[index] = cloneVNode(vnode); 51051 } 51052 51053 var elm = vnode.elm = oldVnode.elm; 51054 51055 if (isTrue(oldVnode.isAsyncPlaceholder)) { 51056 if (isDef(vnode.asyncFactory.resolved)) { 51057 hydrate(oldVnode.elm, vnode, insertedVnodeQueue); 51058 } else { 51059 vnode.isAsyncPlaceholder = true; 51060 } 51061 return 51062 } 51063 51064 // reuse element for static trees. 51065 // note we only do this if the vnode is cloned - 51066 // if the new node is not cloned it means the render functions have been 51067 // reset by the hot-reload-api and we need to do a proper re-render. 51068 if (isTrue(vnode.isStatic) && 51069 isTrue(oldVnode.isStatic) && 51070 vnode.key === oldVnode.key && 51071 (isTrue(vnode.isCloned) || isTrue(vnode.isOnce)) 51072 ) { 51073 vnode.componentInstance = oldVnode.componentInstance; 51074 return 51075 } 51076 51077 var i; 51078 var data = vnode.data; 51079 if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) { 51080 i(oldVnode, vnode); 51081 } 51082 51083 var oldCh = oldVnode.children; 51084 var ch = vnode.children; 51085 if (isDef(data) && isPatchable(vnode)) { 51086 for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); } 51087 if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); } 51088 } 51089 if (isUndef(vnode.text)) { 51090 if (isDef(oldCh) && isDef(ch)) { 51091 if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); } 51092 } else if (isDef(ch)) { 51093 { 51094 checkDuplicateKeys(ch); 51095 } 51096 if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); } 51097 addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); 51098 } else if (isDef(oldCh)) { 51099 removeVnodes(oldCh, 0, oldCh.length - 1); 51100 } else if (isDef(oldVnode.text)) { 51101 nodeOps.setTextContent(elm, ''); 51102 } 51103 } else if (oldVnode.text !== vnode.text) { 51104 nodeOps.setTextContent(elm, vnode.text); 51105 } 51106 if (isDef(data)) { 51107 if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); } 51108 } 51109 } 51110 51111 function invokeInsertHook (vnode, queue, initial) { 51112 // delay insert hooks for component root nodes, invoke them after the 51113 // element is really inserted 51114 if (isTrue(initial) && isDef(vnode.parent)) { 51115 vnode.parent.data.pendingInsert = queue; 51116 } else { 51117 for (var i = 0; i < queue.length; ++i) { 51118 queue[i].data.hook.insert(queue[i]); 51119 } 51120 } 51121 } 51122 51123 var hydrationBailed = false; 51124 // list of modules that can skip create hook during hydration because they 51125 // are already rendered on the client or has no need for initialization 51126 // Note: style is excluded because it relies on initial clone for future 51127 // deep updates (#7063). 51128 var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key'); 51129 51130 // Note: this is a browser-only function so we can assume elms are DOM nodes. 51131 function hydrate (elm, vnode, insertedVnodeQueue, inVPre) { 51132 var i; 51133 var tag = vnode.tag; 51134 var data = vnode.data; 51135 var children = vnode.children; 51136 inVPre = inVPre || (data && data.pre); 51137 vnode.elm = elm; 51138 51139 if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) { 51140 vnode.isAsyncPlaceholder = true; 51141 return true 51142 } 51143 // assert node match 51144 { 51145 if (!assertNodeMatch(elm, vnode, inVPre)) { 51146 return false 51147 } 51148 } 51149 if (isDef(data)) { 51150 if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); } 51151 if (isDef(i = vnode.componentInstance)) { 51152 // child component. it should have hydrated its own tree. 51153 initComponent(vnode, insertedVnodeQueue); 51154 return true 51155 } 51156 } 51157 if (isDef(tag)) { 51158 if (isDef(children)) { 51159 // empty element, allow client to pick up and populate children 51160 if (!elm.hasChildNodes()) { 51161 createChildren(vnode, children, insertedVnodeQueue); 51162 } else { 51163 // v-html and domProps: innerHTML 51164 if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) { 51165 if (i !== elm.innerHTML) { 51166 /* istanbul ignore if */ 51167 if (typeof console !== 'undefined' && 51168 !hydrationBailed 51169 ) { 51170 hydrationBailed = true; 51171 console.warn('Parent: ', elm); 51172 console.warn('server innerHTML: ', i); 51173 console.warn('client innerHTML: ', elm.innerHTML); 51174 } 51175 return false 51176 } 51177 } else { 51178 // iterate and compare children lists 51179 var childrenMatch = true; 51180 var childNode = elm.firstChild; 51181 for (var i$1 = 0; i$1 < children.length; i$1++) { 51182 if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) { 51183 childrenMatch = false; 51184 break 51185 } 51186 childNode = childNode.nextSibling; 51187 } 51188 // if childNode is not null, it means the actual childNodes list is 51189 // longer than the virtual children list. 51190 if (!childrenMatch || childNode) { 51191 /* istanbul ignore if */ 51192 if (typeof console !== 'undefined' && 51193 !hydrationBailed 51194 ) { 51195 hydrationBailed = true; 51196 console.warn('Parent: ', elm); 51197 console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children); 51198 } 51199 return false 51200 } 51201 } 51202 } 51203 } 51204 if (isDef(data)) { 51205 var fullInvoke = false; 51206 for (var key in data) { 51207 if (!isRenderedModule(key)) { 51208 fullInvoke = true; 51209 invokeCreateHooks(vnode, insertedVnodeQueue); 51210 break 51211 } 51212 } 51213 if (!fullInvoke && data['class']) { 51214 // ensure collecting deps for deep class bindings for future updates 51215 traverse(data['class']); 51216 } 51217 } 51218 } else if (elm.data !== vnode.text) { 51219 elm.data = vnode.text; 51220 } 51221 return true 51222 } 51223 51224 function assertNodeMatch (node, vnode, inVPre) { 51225 if (isDef(vnode.tag)) { 51226 return vnode.tag.indexOf('vue-component') === 0 || ( 51227 !isUnknownElement$$1(vnode, inVPre) && 51228 vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase()) 51229 ) 51230 } else { 51231 return node.nodeType === (vnode.isComment ? 8 : 3) 51232 } 51233 } 51234 51235 return function patch (oldVnode, vnode, hydrating, removeOnly) { 51236 if (isUndef(vnode)) { 51237 if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); } 51238 return 51239 } 51240 51241 var isInitialPatch = false; 51242 var insertedVnodeQueue = []; 51243 51244 if (isUndef(oldVnode)) { 51245 // empty mount (likely as component), create new root element 51246 isInitialPatch = true; 51247 createElm(vnode, insertedVnodeQueue); 51248 } else { 51249 var isRealElement = isDef(oldVnode.nodeType); 51250 if (!isRealElement && sameVnode(oldVnode, vnode)) { 51251 // patch existing root node 51252 patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly); 51253 } else { 51254 if (isRealElement) { 51255 // mounting to a real element 51256 // check if this is server-rendered content and if we can perform 51257 // a successful hydration. 51258 if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) { 51259 oldVnode.removeAttribute(SSR_ATTR); 51260 hydrating = true; 51261 } 51262 if (isTrue(hydrating)) { 51263 if (hydrate(oldVnode, vnode, insertedVnodeQueue)) { 51264 invokeInsertHook(vnode, insertedVnodeQueue, true); 51265 return oldVnode 51266 } else { 51267 warn( 51268 'The client-side rendered virtual DOM tree is not matching ' + 51269 'server-rendered content. This is likely caused by incorrect ' + 51270 'HTML markup, for example nesting block-level elements inside ' + 51271 '<p>, or missing <tbody>. Bailing hydration and performing ' + 51272 'full client-side render.' 51273 ); 51274 } 51275 } 51276 // either not server-rendered, or hydration failed. 51277 // create an empty node and replace it 51278 oldVnode = emptyNodeAt(oldVnode); 51279 } 51280 51281 // replacing existing element 51282 var oldElm = oldVnode.elm; 51283 var parentElm = nodeOps.parentNode(oldElm); 51284 51285 // create new node 51286 createElm( 51287 vnode, 51288 insertedVnodeQueue, 51289 // extremely rare edge case: do not insert if old element is in a 51290 // leaving transition. Only happens when combining transition + 51291 // keep-alive + HOCs. (#4590) 51292 oldElm._leaveCb ? null : parentElm, 51293 nodeOps.nextSibling(oldElm) 51294 ); 51295 51296 // update parent placeholder node element, recursively 51297 if (isDef(vnode.parent)) { 51298 var ancestor = vnode.parent; 51299 var patchable = isPatchable(vnode); 51300 while (ancestor) { 51301 for (var i = 0; i < cbs.destroy.length; ++i) { 51302 cbs.destroy[i](ancestor); 51303 } 51304 ancestor.elm = vnode.elm; 51305 if (patchable) { 51306 for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) { 51307 cbs.create[i$1](emptyNode, ancestor); 51308 } 51309 // #6513 51310 // invoke insert hooks that may have been merged by create hooks. 51311 // e.g. for directives that uses the "inserted" hook. 51312 var insert = ancestor.data.hook.insert; 51313 if (insert.merged) { 51314 // start at index 1 to avoid re-invoking component mounted hook 51315 for (var i$2 = 1; i$2 < insert.fns.length; i$2++) { 51316 insert.fns[i$2](); 51317 } 51318 } 51319 } else { 51320 registerRef(ancestor); 51321 } 51322 ancestor = ancestor.parent; 51323 } 51324 } 51325 51326 // destroy old node 51327 if (isDef(parentElm)) { 51328 removeVnodes([oldVnode], 0, 0); 51329 } else if (isDef(oldVnode.tag)) { 51330 invokeDestroyHook(oldVnode); 51331 } 51332 } 51333 } 51334 51335 invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch); 51336 return vnode.elm 51337 } 51338} 51339 51340/* */ 51341 51342var directives = { 51343 create: updateDirectives, 51344 update: updateDirectives, 51345 destroy: function unbindDirectives (vnode) { 51346 updateDirectives(vnode, emptyNode); 51347 } 51348}; 51349 51350function updateDirectives (oldVnode, vnode) { 51351 if (oldVnode.data.directives || vnode.data.directives) { 51352 _update(oldVnode, vnode); 51353 } 51354} 51355 51356function _update (oldVnode, vnode) { 51357 var isCreate = oldVnode === emptyNode; 51358 var isDestroy = vnode === emptyNode; 51359 var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context); 51360 var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context); 51361 51362 var dirsWithInsert = []; 51363 var dirsWithPostpatch = []; 51364 51365 var key, oldDir, dir; 51366 for (key in newDirs) { 51367 oldDir = oldDirs[key]; 51368 dir = newDirs[key]; 51369 if (!oldDir) { 51370 // new directive, bind 51371 callHook$1(dir, 'bind', vnode, oldVnode); 51372 if (dir.def && dir.def.inserted) { 51373 dirsWithInsert.push(dir); 51374 } 51375 } else { 51376 // existing directive, update 51377 dir.oldValue = oldDir.value; 51378 dir.oldArg = oldDir.arg; 51379 callHook$1(dir, 'update', vnode, oldVnode); 51380 if (dir.def && dir.def.componentUpdated) { 51381 dirsWithPostpatch.push(dir); 51382 } 51383 } 51384 } 51385 51386 if (dirsWithInsert.length) { 51387 var callInsert = function () { 51388 for (var i = 0; i < dirsWithInsert.length; i++) { 51389 callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode); 51390 } 51391 }; 51392 if (isCreate) { 51393 mergeVNodeHook(vnode, 'insert', callInsert); 51394 } else { 51395 callInsert(); 51396 } 51397 } 51398 51399 if (dirsWithPostpatch.length) { 51400 mergeVNodeHook(vnode, 'postpatch', function () { 51401 for (var i = 0; i < dirsWithPostpatch.length; i++) { 51402 callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode); 51403 } 51404 }); 51405 } 51406 51407 if (!isCreate) { 51408 for (key in oldDirs) { 51409 if (!newDirs[key]) { 51410 // no longer present, unbind 51411 callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy); 51412 } 51413 } 51414 } 51415} 51416 51417var emptyModifiers = Object.create(null); 51418 51419function normalizeDirectives$1 ( 51420 dirs, 51421 vm 51422) { 51423 var res = Object.create(null); 51424 if (!dirs) { 51425 // $flow-disable-line 51426 return res 51427 } 51428 var i, dir; 51429 for (i = 0; i < dirs.length; i++) { 51430 dir = dirs[i]; 51431 if (!dir.modifiers) { 51432 // $flow-disable-line 51433 dir.modifiers = emptyModifiers; 51434 } 51435 res[getRawDirName(dir)] = dir; 51436 dir.def = resolveAsset(vm.$options, 'directives', dir.name, true); 51437 } 51438 // $flow-disable-line 51439 return res 51440} 51441 51442function getRawDirName (dir) { 51443 return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.'))) 51444} 51445 51446function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) { 51447 var fn = dir.def && dir.def[hook]; 51448 if (fn) { 51449 try { 51450 fn(vnode.elm, dir, vnode, oldVnode, isDestroy); 51451 } catch (e) { 51452 handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook")); 51453 } 51454 } 51455} 51456 51457var baseModules = [ 51458 ref, 51459 directives 51460]; 51461 51462/* */ 51463 51464function updateAttrs (oldVnode, vnode) { 51465 var opts = vnode.componentOptions; 51466 if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) { 51467 return 51468 } 51469 if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) { 51470 return 51471 } 51472 var key, cur, old; 51473 var elm = vnode.elm; 51474 var oldAttrs = oldVnode.data.attrs || {}; 51475 var attrs = vnode.data.attrs || {}; 51476 // clone observed objects, as the user probably wants to mutate it 51477 if (isDef(attrs.__ob__)) { 51478 attrs = vnode.data.attrs = extend({}, attrs); 51479 } 51480 51481 for (key in attrs) { 51482 cur = attrs[key]; 51483 old = oldAttrs[key]; 51484 if (old !== cur) { 51485 setAttr(elm, key, cur, vnode.data.pre); 51486 } 51487 } 51488 // #4391: in IE9, setting type can reset value for input[type=radio] 51489 // #6666: IE/Edge forces progress value down to 1 before setting a max 51490 /* istanbul ignore if */ 51491 if ((isIE || isEdge) && attrs.value !== oldAttrs.value) { 51492 setAttr(elm, 'value', attrs.value); 51493 } 51494 for (key in oldAttrs) { 51495 if (isUndef(attrs[key])) { 51496 if (isXlink(key)) { 51497 elm.removeAttributeNS(xlinkNS, getXlinkProp(key)); 51498 } else if (!isEnumeratedAttr(key)) { 51499 elm.removeAttribute(key); 51500 } 51501 } 51502 } 51503} 51504 51505function setAttr (el, key, value, isInPre) { 51506 if (isInPre || el.tagName.indexOf('-') > -1) { 51507 baseSetAttr(el, key, value); 51508 } else if (isBooleanAttr(key)) { 51509 // set attribute for blank value 51510 // e.g. <option disabled>Select one</option> 51511 if (isFalsyAttrValue(value)) { 51512 el.removeAttribute(key); 51513 } else { 51514 // technically allowfullscreen is a boolean attribute for <iframe>, 51515 // but Flash expects a value of "true" when used on <embed> tag 51516 value = key === 'allowfullscreen' && el.tagName === 'EMBED' 51517 ? 'true' 51518 : key; 51519 el.setAttribute(key, value); 51520 } 51521 } else if (isEnumeratedAttr(key)) { 51522 el.setAttribute(key, convertEnumeratedValue(key, value)); 51523 } else if (isXlink(key)) { 51524 if (isFalsyAttrValue(value)) { 51525 el.removeAttributeNS(xlinkNS, getXlinkProp(key)); 51526 } else { 51527 el.setAttributeNS(xlinkNS, key, value); 51528 } 51529 } else { 51530 baseSetAttr(el, key, value); 51531 } 51532} 51533 51534function baseSetAttr (el, key, value) { 51535 if (isFalsyAttrValue(value)) { 51536 el.removeAttribute(key); 51537 } else { 51538 // #7138: IE10 & 11 fires input event when setting placeholder on 51539 // <textarea>... block the first input event and remove the blocker 51540 // immediately. 51541 /* istanbul ignore if */ 51542 if ( 51543 isIE && !isIE9 && 51544 el.tagName === 'TEXTAREA' && 51545 key === 'placeholder' && value !== '' && !el.__ieph 51546 ) { 51547 var blocker = function (e) { 51548 e.stopImmediatePropagation(); 51549 el.removeEventListener('input', blocker); 51550 }; 51551 el.addEventListener('input', blocker); 51552 // $flow-disable-line 51553 el.__ieph = true; /* IE placeholder patched */ 51554 } 51555 el.setAttribute(key, value); 51556 } 51557} 51558 51559var attrs = { 51560 create: updateAttrs, 51561 update: updateAttrs 51562}; 51563 51564/* */ 51565 51566function updateClass (oldVnode, vnode) { 51567 var el = vnode.elm; 51568 var data = vnode.data; 51569 var oldData = oldVnode.data; 51570 if ( 51571 isUndef(data.staticClass) && 51572 isUndef(data.class) && ( 51573 isUndef(oldData) || ( 51574 isUndef(oldData.staticClass) && 51575 isUndef(oldData.class) 51576 ) 51577 ) 51578 ) { 51579 return 51580 } 51581 51582 var cls = genClassForVnode(vnode); 51583 51584 // handle transition classes 51585 var transitionClass = el._transitionClasses; 51586 if (isDef(transitionClass)) { 51587 cls = concat(cls, stringifyClass(transitionClass)); 51588 } 51589 51590 // set the class 51591 if (cls !== el._prevClass) { 51592 el.setAttribute('class', cls); 51593 el._prevClass = cls; 51594 } 51595} 51596 51597var klass = { 51598 create: updateClass, 51599 update: updateClass 51600}; 51601 51602/* */ 51603 51604var validDivisionCharRE = /[\w).+\-_$\]]/; 51605 51606function parseFilters (exp) { 51607 var inSingle = false; 51608 var inDouble = false; 51609 var inTemplateString = false; 51610 var inRegex = false; 51611 var curly = 0; 51612 var square = 0; 51613 var paren = 0; 51614 var lastFilterIndex = 0; 51615 var c, prev, i, expression, filters; 51616 51617 for (i = 0; i < exp.length; i++) { 51618 prev = c; 51619 c = exp.charCodeAt(i); 51620 if (inSingle) { 51621 if (c === 0x27 && prev !== 0x5C) { inSingle = false; } 51622 } else if (inDouble) { 51623 if (c === 0x22 && prev !== 0x5C) { inDouble = false; } 51624 } else if (inTemplateString) { 51625 if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; } 51626 } else if (inRegex) { 51627 if (c === 0x2f && prev !== 0x5C) { inRegex = false; } 51628 } else if ( 51629 c === 0x7C && // pipe 51630 exp.charCodeAt(i + 1) !== 0x7C && 51631 exp.charCodeAt(i - 1) !== 0x7C && 51632 !curly && !square && !paren 51633 ) { 51634 if (expression === undefined) { 51635 // first filter, end of expression 51636 lastFilterIndex = i + 1; 51637 expression = exp.slice(0, i).trim(); 51638 } else { 51639 pushFilter(); 51640 } 51641 } else { 51642 switch (c) { 51643 case 0x22: inDouble = true; break // " 51644 case 0x27: inSingle = true; break // ' 51645 case 0x60: inTemplateString = true; break // ` 51646 case 0x28: paren++; break // ( 51647 case 0x29: paren--; break // ) 51648 case 0x5B: square++; break // [ 51649 case 0x5D: square--; break // ] 51650 case 0x7B: curly++; break // { 51651 case 0x7D: curly--; break // } 51652 } 51653 if (c === 0x2f) { // / 51654 var j = i - 1; 51655 var p = (void 0); 51656 // find first non-whitespace prev char 51657 for (; j >= 0; j--) { 51658 p = exp.charAt(j); 51659 if (p !== ' ') { break } 51660 } 51661 if (!p || !validDivisionCharRE.test(p)) { 51662 inRegex = true; 51663 } 51664 } 51665 } 51666 } 51667 51668 if (expression === undefined) { 51669 expression = exp.slice(0, i).trim(); 51670 } else if (lastFilterIndex !== 0) { 51671 pushFilter(); 51672 } 51673 51674 function pushFilter () { 51675 (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim()); 51676 lastFilterIndex = i + 1; 51677 } 51678 51679 if (filters) { 51680 for (i = 0; i < filters.length; i++) { 51681 expression = wrapFilter(expression, filters[i]); 51682 } 51683 } 51684 51685 return expression 51686} 51687 51688function wrapFilter (exp, filter) { 51689 var i = filter.indexOf('('); 51690 if (i < 0) { 51691 // _f: resolveFilter 51692 return ("_f(\"" + filter + "\")(" + exp + ")") 51693 } else { 51694 var name = filter.slice(0, i); 51695 var args = filter.slice(i + 1); 51696 return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args)) 51697 } 51698} 51699 51700/* */ 51701 51702 51703 51704/* eslint-disable no-unused-vars */ 51705function baseWarn (msg, range) { 51706 console.error(("[Vue compiler]: " + msg)); 51707} 51708/* eslint-enable no-unused-vars */ 51709 51710function pluckModuleFunction ( 51711 modules, 51712 key 51713) { 51714 return modules 51715 ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; }) 51716 : [] 51717} 51718 51719function addProp (el, name, value, range, dynamic) { 51720 (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range)); 51721 el.plain = false; 51722} 51723 51724function addAttr (el, name, value, range, dynamic) { 51725 var attrs = dynamic 51726 ? (el.dynamicAttrs || (el.dynamicAttrs = [])) 51727 : (el.attrs || (el.attrs = [])); 51728 attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range)); 51729 el.plain = false; 51730} 51731 51732// add a raw attr (use this in preTransforms) 51733function addRawAttr (el, name, value, range) { 51734 el.attrsMap[name] = value; 51735 el.attrsList.push(rangeSetItem({ name: name, value: value }, range)); 51736} 51737 51738function addDirective ( 51739 el, 51740 name, 51741 rawName, 51742 value, 51743 arg, 51744 isDynamicArg, 51745 modifiers, 51746 range 51747) { 51748 (el.directives || (el.directives = [])).push(rangeSetItem({ 51749 name: name, 51750 rawName: rawName, 51751 value: value, 51752 arg: arg, 51753 isDynamicArg: isDynamicArg, 51754 modifiers: modifiers 51755 }, range)); 51756 el.plain = false; 51757} 51758 51759function prependModifierMarker (symbol, name, dynamic) { 51760 return dynamic 51761 ? ("_p(" + name + ",\"" + symbol + "\")") 51762 : symbol + name // mark the event as captured 51763} 51764 51765function addHandler ( 51766 el, 51767 name, 51768 value, 51769 modifiers, 51770 important, 51771 warn, 51772 range, 51773 dynamic 51774) { 51775 modifiers = modifiers || emptyObject; 51776 // warn prevent and passive modifier 51777 /* istanbul ignore if */ 51778 if ( 51779 warn && 51780 modifiers.prevent && modifiers.passive 51781 ) { 51782 warn( 51783 'passive and prevent can\'t be used together. ' + 51784 'Passive handler can\'t prevent default event.', 51785 range 51786 ); 51787 } 51788 51789 // normalize click.right and click.middle since they don't actually fire 51790 // this is technically browser-specific, but at least for now browsers are 51791 // the only target envs that have right/middle clicks. 51792 if (modifiers.right) { 51793 if (dynamic) { 51794 name = "(" + name + ")==='click'?'contextmenu':(" + name + ")"; 51795 } else if (name === 'click') { 51796 name = 'contextmenu'; 51797 delete modifiers.right; 51798 } 51799 } else if (modifiers.middle) { 51800 if (dynamic) { 51801 name = "(" + name + ")==='click'?'mouseup':(" + name + ")"; 51802 } else if (name === 'click') { 51803 name = 'mouseup'; 51804 } 51805 } 51806 51807 // check capture modifier 51808 if (modifiers.capture) { 51809 delete modifiers.capture; 51810 name = prependModifierMarker('!', name, dynamic); 51811 } 51812 if (modifiers.once) { 51813 delete modifiers.once; 51814 name = prependModifierMarker('~', name, dynamic); 51815 } 51816 /* istanbul ignore if */ 51817 if (modifiers.passive) { 51818 delete modifiers.passive; 51819 name = prependModifierMarker('&', name, dynamic); 51820 } 51821 51822 var events; 51823 if (modifiers.native) { 51824 delete modifiers.native; 51825 events = el.nativeEvents || (el.nativeEvents = {}); 51826 } else { 51827 events = el.events || (el.events = {}); 51828 } 51829 51830 var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range); 51831 if (modifiers !== emptyObject) { 51832 newHandler.modifiers = modifiers; 51833 } 51834 51835 var handlers = events[name]; 51836 /* istanbul ignore if */ 51837 if (Array.isArray(handlers)) { 51838 important ? handlers.unshift(newHandler) : handlers.push(newHandler); 51839 } else if (handlers) { 51840 events[name] = important ? [newHandler, handlers] : [handlers, newHandler]; 51841 } else { 51842 events[name] = newHandler; 51843 } 51844 51845 el.plain = false; 51846} 51847 51848function getRawBindingAttr ( 51849 el, 51850 name 51851) { 51852 return el.rawAttrsMap[':' + name] || 51853 el.rawAttrsMap['v-bind:' + name] || 51854 el.rawAttrsMap[name] 51855} 51856 51857function getBindingAttr ( 51858 el, 51859 name, 51860 getStatic 51861) { 51862 var dynamicValue = 51863 getAndRemoveAttr(el, ':' + name) || 51864 getAndRemoveAttr(el, 'v-bind:' + name); 51865 if (dynamicValue != null) { 51866 return parseFilters(dynamicValue) 51867 } else if (getStatic !== false) { 51868 var staticValue = getAndRemoveAttr(el, name); 51869 if (staticValue != null) { 51870 return JSON.stringify(staticValue) 51871 } 51872 } 51873} 51874 51875// note: this only removes the attr from the Array (attrsList) so that it 51876// doesn't get processed by processAttrs. 51877// By default it does NOT remove it from the map (attrsMap) because the map is 51878// needed during codegen. 51879function getAndRemoveAttr ( 51880 el, 51881 name, 51882 removeFromMap 51883) { 51884 var val; 51885 if ((val = el.attrsMap[name]) != null) { 51886 var list = el.attrsList; 51887 for (var i = 0, l = list.length; i < l; i++) { 51888 if (list[i].name === name) { 51889 list.splice(i, 1); 51890 break 51891 } 51892 } 51893 } 51894 if (removeFromMap) { 51895 delete el.attrsMap[name]; 51896 } 51897 return val 51898} 51899 51900function getAndRemoveAttrByRegex ( 51901 el, 51902 name 51903) { 51904 var list = el.attrsList; 51905 for (var i = 0, l = list.length; i < l; i++) { 51906 var attr = list[i]; 51907 if (name.test(attr.name)) { 51908 list.splice(i, 1); 51909 return attr 51910 } 51911 } 51912} 51913 51914function rangeSetItem ( 51915 item, 51916 range 51917) { 51918 if (range) { 51919 if (range.start != null) { 51920 item.start = range.start; 51921 } 51922 if (range.end != null) { 51923 item.end = range.end; 51924 } 51925 } 51926 return item 51927} 51928 51929/* */ 51930 51931/** 51932 * Cross-platform code generation for component v-model 51933 */ 51934function genComponentModel ( 51935 el, 51936 value, 51937 modifiers 51938) { 51939 var ref = modifiers || {}; 51940 var number = ref.number; 51941 var trim = ref.trim; 51942 51943 var baseValueExpression = '$$v'; 51944 var valueExpression = baseValueExpression; 51945 if (trim) { 51946 valueExpression = 51947 "(typeof " + baseValueExpression + " === 'string'" + 51948 "? " + baseValueExpression + ".trim()" + 51949 ": " + baseValueExpression + ")"; 51950 } 51951 if (number) { 51952 valueExpression = "_n(" + valueExpression + ")"; 51953 } 51954 var assignment = genAssignmentCode(value, valueExpression); 51955 51956 el.model = { 51957 value: ("(" + value + ")"), 51958 expression: JSON.stringify(value), 51959 callback: ("function (" + baseValueExpression + ") {" + assignment + "}") 51960 }; 51961} 51962 51963/** 51964 * Cross-platform codegen helper for generating v-model value assignment code. 51965 */ 51966function genAssignmentCode ( 51967 value, 51968 assignment 51969) { 51970 var res = parseModel(value); 51971 if (res.key === null) { 51972 return (value + "=" + assignment) 51973 } else { 51974 return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")") 51975 } 51976} 51977 51978/** 51979 * Parse a v-model expression into a base path and a final key segment. 51980 * Handles both dot-path and possible square brackets. 51981 * 51982 * Possible cases: 51983 * 51984 * - test 51985 * - test[key] 51986 * - test[test1[key]] 51987 * - test["a"][key] 51988 * - xxx.test[a[a].test1[key]] 51989 * - test.xxx.a["asa"][test1[key]] 51990 * 51991 */ 51992 51993var len, str, chr, index$1, expressionPos, expressionEndPos; 51994 51995 51996 51997function parseModel (val) { 51998 // Fix https://github.com/vuejs/vue/pull/7730 51999 // allow v-model="obj.val " (trailing whitespace) 52000 val = val.trim(); 52001 len = val.length; 52002 52003 if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) { 52004 index$1 = val.lastIndexOf('.'); 52005 if (index$1 > -1) { 52006 return { 52007 exp: val.slice(0, index$1), 52008 key: '"' + val.slice(index$1 + 1) + '"' 52009 } 52010 } else { 52011 return { 52012 exp: val, 52013 key: null 52014 } 52015 } 52016 } 52017 52018 str = val; 52019 index$1 = expressionPos = expressionEndPos = 0; 52020 52021 while (!eof()) { 52022 chr = next(); 52023 /* istanbul ignore if */ 52024 if (isStringStart(chr)) { 52025 parseString(chr); 52026 } else if (chr === 0x5B) { 52027 parseBracket(chr); 52028 } 52029 } 52030 52031 return { 52032 exp: val.slice(0, expressionPos), 52033 key: val.slice(expressionPos + 1, expressionEndPos) 52034 } 52035} 52036 52037function next () { 52038 return str.charCodeAt(++index$1) 52039} 52040 52041function eof () { 52042 return index$1 >= len 52043} 52044 52045function isStringStart (chr) { 52046 return chr === 0x22 || chr === 0x27 52047} 52048 52049function parseBracket (chr) { 52050 var inBracket = 1; 52051 expressionPos = index$1; 52052 while (!eof()) { 52053 chr = next(); 52054 if (isStringStart(chr)) { 52055 parseString(chr); 52056 continue 52057 } 52058 if (chr === 0x5B) { inBracket++; } 52059 if (chr === 0x5D) { inBracket--; } 52060 if (inBracket === 0) { 52061 expressionEndPos = index$1; 52062 break 52063 } 52064 } 52065} 52066 52067function parseString (chr) { 52068 var stringQuote = chr; 52069 while (!eof()) { 52070 chr = next(); 52071 if (chr === stringQuote) { 52072 break 52073 } 52074 } 52075} 52076 52077/* */ 52078 52079var warn$1; 52080 52081// in some cases, the event used has to be determined at runtime 52082// so we used some reserved tokens during compile. 52083var RANGE_TOKEN = '__r'; 52084var CHECKBOX_RADIO_TOKEN = '__c'; 52085 52086function model ( 52087 el, 52088 dir, 52089 _warn 52090) { 52091 warn$1 = _warn; 52092 var value = dir.value; 52093 var modifiers = dir.modifiers; 52094 var tag = el.tag; 52095 var type = el.attrsMap.type; 52096 52097 { 52098 // inputs with type="file" are read only and setting the input's 52099 // value will throw an error. 52100 if (tag === 'input' && type === 'file') { 52101 warn$1( 52102 "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" + 52103 "File inputs are read only. Use a v-on:change listener instead.", 52104 el.rawAttrsMap['v-model'] 52105 ); 52106 } 52107 } 52108 52109 if (el.component) { 52110 genComponentModel(el, value, modifiers); 52111 // component v-model doesn't need extra runtime 52112 return false 52113 } else if (tag === 'select') { 52114 genSelect(el, value, modifiers); 52115 } else if (tag === 'input' && type === 'checkbox') { 52116 genCheckboxModel(el, value, modifiers); 52117 } else if (tag === 'input' && type === 'radio') { 52118 genRadioModel(el, value, modifiers); 52119 } else if (tag === 'input' || tag === 'textarea') { 52120 genDefaultModel(el, value, modifiers); 52121 } else if (!config.isReservedTag(tag)) { 52122 genComponentModel(el, value, modifiers); 52123 // component v-model doesn't need extra runtime 52124 return false 52125 } else { 52126 warn$1( 52127 "<" + (el.tag) + " v-model=\"" + value + "\">: " + 52128 "v-model is not supported on this element type. " + 52129 'If you are working with contenteditable, it\'s recommended to ' + 52130 'wrap a library dedicated for that purpose inside a custom component.', 52131 el.rawAttrsMap['v-model'] 52132 ); 52133 } 52134 52135 // ensure runtime directive metadata 52136 return true 52137} 52138 52139function genCheckboxModel ( 52140 el, 52141 value, 52142 modifiers 52143) { 52144 var number = modifiers && modifiers.number; 52145 var valueBinding = getBindingAttr(el, 'value') || 'null'; 52146 var trueValueBinding = getBindingAttr(el, 'true-value') || 'true'; 52147 var falseValueBinding = getBindingAttr(el, 'false-value') || 'false'; 52148 addProp(el, 'checked', 52149 "Array.isArray(" + value + ")" + 52150 "?_i(" + value + "," + valueBinding + ")>-1" + ( 52151 trueValueBinding === 'true' 52152 ? (":(" + value + ")") 52153 : (":_q(" + value + "," + trueValueBinding + ")") 52154 ) 52155 ); 52156 addHandler(el, 'change', 52157 "var $$a=" + value + "," + 52158 '$$el=$event.target,' + 52159 "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" + 52160 'if(Array.isArray($$a)){' + 52161 "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," + 52162 '$$i=_i($$a,$$v);' + 52163 "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" + 52164 "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" + 52165 "}else{" + (genAssignmentCode(value, '$$c')) + "}", 52166 null, true 52167 ); 52168} 52169 52170function genRadioModel ( 52171 el, 52172 value, 52173 modifiers 52174) { 52175 var number = modifiers && modifiers.number; 52176 var valueBinding = getBindingAttr(el, 'value') || 'null'; 52177 valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding; 52178 addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")")); 52179 addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true); 52180} 52181 52182function genSelect ( 52183 el, 52184 value, 52185 modifiers 52186) { 52187 var number = modifiers && modifiers.number; 52188 var selectedVal = "Array.prototype.filter" + 52189 ".call($event.target.options,function(o){return o.selected})" + 52190 ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" + 52191 "return " + (number ? '_n(val)' : 'val') + "})"; 52192 52193 var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]'; 52194 var code = "var $$selectedVal = " + selectedVal + ";"; 52195 code = code + " " + (genAssignmentCode(value, assignment)); 52196 addHandler(el, 'change', code, null, true); 52197} 52198 52199function genDefaultModel ( 52200 el, 52201 value, 52202 modifiers 52203) { 52204 var type = el.attrsMap.type; 52205 52206 // warn if v-bind:value conflicts with v-model 52207 // except for inputs with v-bind:type 52208 { 52209 var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value']; 52210 var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type']; 52211 if (value$1 && !typeBinding) { 52212 var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value'; 52213 warn$1( 52214 binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " + 52215 'because the latter already expands to a value binding internally', 52216 el.rawAttrsMap[binding] 52217 ); 52218 } 52219 } 52220 52221 var ref = modifiers || {}; 52222 var lazy = ref.lazy; 52223 var number = ref.number; 52224 var trim = ref.trim; 52225 var needCompositionGuard = !lazy && type !== 'range'; 52226 var event = lazy 52227 ? 'change' 52228 : type === 'range' 52229 ? RANGE_TOKEN 52230 : 'input'; 52231 52232 var valueExpression = '$event.target.value'; 52233 if (trim) { 52234 valueExpression = "$event.target.value.trim()"; 52235 } 52236 if (number) { 52237 valueExpression = "_n(" + valueExpression + ")"; 52238 } 52239 52240 var code = genAssignmentCode(value, valueExpression); 52241 if (needCompositionGuard) { 52242 code = "if($event.target.composing)return;" + code; 52243 } 52244 52245 addProp(el, 'value', ("(" + value + ")")); 52246 addHandler(el, event, code, null, true); 52247 if (trim || number) { 52248 addHandler(el, 'blur', '$forceUpdate()'); 52249 } 52250} 52251 52252/* */ 52253 52254// normalize v-model event tokens that can only be determined at runtime. 52255// it's important to place the event as the first in the array because 52256// the whole point is ensuring the v-model callback gets called before 52257// user-attached handlers. 52258function normalizeEvents (on) { 52259 /* istanbul ignore if */ 52260 if (isDef(on[RANGE_TOKEN])) { 52261 // IE input[type=range] only supports `change` event 52262 var event = isIE ? 'change' : 'input'; 52263 on[event] = [].concat(on[RANGE_TOKEN], on[event] || []); 52264 delete on[RANGE_TOKEN]; 52265 } 52266 // This was originally intended to fix #4521 but no longer necessary 52267 // after 2.5. Keeping it for backwards compat with generated code from < 2.4 52268 /* istanbul ignore if */ 52269 if (isDef(on[CHECKBOX_RADIO_TOKEN])) { 52270 on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []); 52271 delete on[CHECKBOX_RADIO_TOKEN]; 52272 } 52273} 52274 52275var target$1; 52276 52277function createOnceHandler$1 (event, handler, capture) { 52278 var _target = target$1; // save current target element in closure 52279 return function onceHandler () { 52280 var res = handler.apply(null, arguments); 52281 if (res !== null) { 52282 remove$2(event, onceHandler, capture, _target); 52283 } 52284 } 52285} 52286 52287// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp 52288// implementation and does not fire microtasks in between event propagation, so 52289// safe to exclude. 52290var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53); 52291 52292function add$1 ( 52293 name, 52294 handler, 52295 capture, 52296 passive 52297) { 52298 // async edge case #6566: inner click event triggers patch, event handler 52299 // attached to outer element during patch, and triggered again. This 52300 // happens because browsers fire microtask ticks between event propagation. 52301 // the solution is simple: we save the timestamp when a handler is attached, 52302 // and the handler would only fire if the event passed to it was fired 52303 // AFTER it was attached. 52304 if (useMicrotaskFix) { 52305 var attachedTimestamp = currentFlushTimestamp; 52306 var original = handler; 52307 handler = original._wrapper = function (e) { 52308 if ( 52309 // no bubbling, should always fire. 52310 // this is just a safety net in case event.timeStamp is unreliable in 52311 // certain weird environments... 52312 e.target === e.currentTarget || 52313 // event is fired after handler attachment 52314 e.timeStamp >= attachedTimestamp || 52315 // bail for environments that have buggy event.timeStamp implementations 52316 // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState 52317 // #9681 QtWebEngine event.timeStamp is negative value 52318 e.timeStamp <= 0 || 52319 // #9448 bail if event is fired in another document in a multi-page 52320 // electron/nw.js app, since event.timeStamp will be using a different 52321 // starting reference 52322 e.target.ownerDocument !== document 52323 ) { 52324 return original.apply(this, arguments) 52325 } 52326 }; 52327 } 52328 target$1.addEventListener( 52329 name, 52330 handler, 52331 supportsPassive 52332 ? { capture: capture, passive: passive } 52333 : capture 52334 ); 52335} 52336 52337function remove$2 ( 52338 name, 52339 handler, 52340 capture, 52341 _target 52342) { 52343 (_target || target$1).removeEventListener( 52344 name, 52345 handler._wrapper || handler, 52346 capture 52347 ); 52348} 52349 52350function updateDOMListeners (oldVnode, vnode) { 52351 if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) { 52352 return 52353 } 52354 var on = vnode.data.on || {}; 52355 var oldOn = oldVnode.data.on || {}; 52356 target$1 = vnode.elm; 52357 normalizeEvents(on); 52358 updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context); 52359 target$1 = undefined; 52360} 52361 52362var events = { 52363 create: updateDOMListeners, 52364 update: updateDOMListeners 52365}; 52366 52367/* */ 52368 52369var svgContainer; 52370 52371function updateDOMProps (oldVnode, vnode) { 52372 if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) { 52373 return 52374 } 52375 var key, cur; 52376 var elm = vnode.elm; 52377 var oldProps = oldVnode.data.domProps || {}; 52378 var props = vnode.data.domProps || {}; 52379 // clone observed objects, as the user probably wants to mutate it 52380 if (isDef(props.__ob__)) { 52381 props = vnode.data.domProps = extend({}, props); 52382 } 52383 52384 for (key in oldProps) { 52385 if (!(key in props)) { 52386 elm[key] = ''; 52387 } 52388 } 52389 52390 for (key in props) { 52391 cur = props[key]; 52392 // ignore children if the node has textContent or innerHTML, 52393 // as these will throw away existing DOM nodes and cause removal errors 52394 // on subsequent patches (#3360) 52395 if (key === 'textContent' || key === 'innerHTML') { 52396 if (vnode.children) { vnode.children.length = 0; } 52397 if (cur === oldProps[key]) { continue } 52398 // #6601 work around Chrome version <= 55 bug where single textNode 52399 // replaced by innerHTML/textContent retains its parentNode property 52400 if (elm.childNodes.length === 1) { 52401 elm.removeChild(elm.childNodes[0]); 52402 } 52403 } 52404 52405 if (key === 'value' && elm.tagName !== 'PROGRESS') { 52406 // store value as _value as well since 52407 // non-string values will be stringified 52408 elm._value = cur; 52409 // avoid resetting cursor position when value is the same 52410 var strCur = isUndef(cur) ? '' : String(cur); 52411 if (shouldUpdateValue(elm, strCur)) { 52412 elm.value = strCur; 52413 } 52414 } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) { 52415 // IE doesn't support innerHTML for SVG elements 52416 svgContainer = svgContainer || document.createElement('div'); 52417 svgContainer.innerHTML = "<svg>" + cur + "</svg>"; 52418 var svg = svgContainer.firstChild; 52419 while (elm.firstChild) { 52420 elm.removeChild(elm.firstChild); 52421 } 52422 while (svg.firstChild) { 52423 elm.appendChild(svg.firstChild); 52424 } 52425 } else if ( 52426 // skip the update if old and new VDOM state is the same. 52427 // `value` is handled separately because the DOM value may be temporarily 52428 // out of sync with VDOM state due to focus, composition and modifiers. 52429 // This #4521 by skipping the unnecessary `checked` update. 52430 cur !== oldProps[key] 52431 ) { 52432 // some property updates can throw 52433 // e.g. `value` on <progress> w/ non-finite value 52434 try { 52435 elm[key] = cur; 52436 } catch (e) {} 52437 } 52438 } 52439} 52440 52441// check platforms/web/util/attrs.js acceptValue 52442 52443 52444function shouldUpdateValue (elm, checkVal) { 52445 return (!elm.composing && ( 52446 elm.tagName === 'OPTION' || 52447 isNotInFocusAndDirty(elm, checkVal) || 52448 isDirtyWithModifiers(elm, checkVal) 52449 )) 52450} 52451 52452function isNotInFocusAndDirty (elm, checkVal) { 52453 // return true when textbox (.number and .trim) loses focus and its value is 52454 // not equal to the updated value 52455 var notInFocus = true; 52456 // #6157 52457 // work around IE bug when accessing document.activeElement in an iframe 52458 try { notInFocus = document.activeElement !== elm; } catch (e) {} 52459 return notInFocus && elm.value !== checkVal 52460} 52461 52462function isDirtyWithModifiers (elm, newVal) { 52463 var value = elm.value; 52464 var modifiers = elm._vModifiers; // injected by v-model runtime 52465 if (isDef(modifiers)) { 52466 if (modifiers.number) { 52467 return toNumber(value) !== toNumber(newVal) 52468 } 52469 if (modifiers.trim) { 52470 return value.trim() !== newVal.trim() 52471 } 52472 } 52473 return value !== newVal 52474} 52475 52476var domProps = { 52477 create: updateDOMProps, 52478 update: updateDOMProps 52479}; 52480 52481/* */ 52482 52483var parseStyleText = cached(function (cssText) { 52484 var res = {}; 52485 var listDelimiter = /;(?![^(]*\))/g; 52486 var propertyDelimiter = /:(.+)/; 52487 cssText.split(listDelimiter).forEach(function (item) { 52488 if (item) { 52489 var tmp = item.split(propertyDelimiter); 52490 tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim()); 52491 } 52492 }); 52493 return res 52494}); 52495 52496// merge static and dynamic style data on the same vnode 52497function normalizeStyleData (data) { 52498 var style = normalizeStyleBinding(data.style); 52499 // static style is pre-processed into an object during compilation 52500 // and is always a fresh object, so it's safe to merge into it 52501 return data.staticStyle 52502 ? extend(data.staticStyle, style) 52503 : style 52504} 52505 52506// normalize possible array / string values into Object 52507function normalizeStyleBinding (bindingStyle) { 52508 if (Array.isArray(bindingStyle)) { 52509 return toObject(bindingStyle) 52510 } 52511 if (typeof bindingStyle === 'string') { 52512 return parseStyleText(bindingStyle) 52513 } 52514 return bindingStyle 52515} 52516 52517/** 52518 * parent component style should be after child's 52519 * so that parent component's style could override it 52520 */ 52521function getStyle (vnode, checkChild) { 52522 var res = {}; 52523 var styleData; 52524 52525 if (checkChild) { 52526 var childNode = vnode; 52527 while (childNode.componentInstance) { 52528 childNode = childNode.componentInstance._vnode; 52529 if ( 52530 childNode && childNode.data && 52531 (styleData = normalizeStyleData(childNode.data)) 52532 ) { 52533 extend(res, styleData); 52534 } 52535 } 52536 } 52537 52538 if ((styleData = normalizeStyleData(vnode.data))) { 52539 extend(res, styleData); 52540 } 52541 52542 var parentNode = vnode; 52543 while ((parentNode = parentNode.parent)) { 52544 if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) { 52545 extend(res, styleData); 52546 } 52547 } 52548 return res 52549} 52550 52551/* */ 52552 52553var cssVarRE = /^--/; 52554var importantRE = /\s*!important$/; 52555var setProp = function (el, name, val) { 52556 /* istanbul ignore if */ 52557 if (cssVarRE.test(name)) { 52558 el.style.setProperty(name, val); 52559 } else if (importantRE.test(val)) { 52560 el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important'); 52561 } else { 52562 var normalizedName = normalize(name); 52563 if (Array.isArray(val)) { 52564 // Support values array created by autoprefixer, e.g. 52565 // {display: ["-webkit-box", "-ms-flexbox", "flex"]} 52566 // Set them one by one, and the browser will only set those it can recognize 52567 for (var i = 0, len = val.length; i < len; i++) { 52568 el.style[normalizedName] = val[i]; 52569 } 52570 } else { 52571 el.style[normalizedName] = val; 52572 } 52573 } 52574}; 52575 52576var vendorNames = ['Webkit', 'Moz', 'ms']; 52577 52578var emptyStyle; 52579var normalize = cached(function (prop) { 52580 emptyStyle = emptyStyle || document.createElement('div').style; 52581 prop = camelize(prop); 52582 if (prop !== 'filter' && (prop in emptyStyle)) { 52583 return prop 52584 } 52585 var capName = prop.charAt(0).toUpperCase() + prop.slice(1); 52586 for (var i = 0; i < vendorNames.length; i++) { 52587 var name = vendorNames[i] + capName; 52588 if (name in emptyStyle) { 52589 return name 52590 } 52591 } 52592}); 52593 52594function updateStyle (oldVnode, vnode) { 52595 var data = vnode.data; 52596 var oldData = oldVnode.data; 52597 52598 if (isUndef(data.staticStyle) && isUndef(data.style) && 52599 isUndef(oldData.staticStyle) && isUndef(oldData.style) 52600 ) { 52601 return 52602 } 52603 52604 var cur, name; 52605 var el = vnode.elm; 52606 var oldStaticStyle = oldData.staticStyle; 52607 var oldStyleBinding = oldData.normalizedStyle || oldData.style || {}; 52608 52609 // if static style exists, stylebinding already merged into it when doing normalizeStyleData 52610 var oldStyle = oldStaticStyle || oldStyleBinding; 52611 52612 var style = normalizeStyleBinding(vnode.data.style) || {}; 52613 52614 // store normalized style under a different key for next diff 52615 // make sure to clone it if it's reactive, since the user likely wants 52616 // to mutate it. 52617 vnode.data.normalizedStyle = isDef(style.__ob__) 52618 ? extend({}, style) 52619 : style; 52620 52621 var newStyle = getStyle(vnode, true); 52622 52623 for (name in oldStyle) { 52624 if (isUndef(newStyle[name])) { 52625 setProp(el, name, ''); 52626 } 52627 } 52628 for (name in newStyle) { 52629 cur = newStyle[name]; 52630 if (cur !== oldStyle[name]) { 52631 // ie9 setting to null has no effect, must use empty string 52632 setProp(el, name, cur == null ? '' : cur); 52633 } 52634 } 52635} 52636 52637var style = { 52638 create: updateStyle, 52639 update: updateStyle 52640}; 52641 52642/* */ 52643 52644var whitespaceRE = /\s+/; 52645 52646/** 52647 * Add class with compatibility for SVG since classList is not supported on 52648 * SVG elements in IE 52649 */ 52650function addClass (el, cls) { 52651 /* istanbul ignore if */ 52652 if (!cls || !(cls = cls.trim())) { 52653 return 52654 } 52655 52656 /* istanbul ignore else */ 52657 if (el.classList) { 52658 if (cls.indexOf(' ') > -1) { 52659 cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); }); 52660 } else { 52661 el.classList.add(cls); 52662 } 52663 } else { 52664 var cur = " " + (el.getAttribute('class') || '') + " "; 52665 if (cur.indexOf(' ' + cls + ' ') < 0) { 52666 el.setAttribute('class', (cur + cls).trim()); 52667 } 52668 } 52669} 52670 52671/** 52672 * Remove class with compatibility for SVG since classList is not supported on 52673 * SVG elements in IE 52674 */ 52675function removeClass (el, cls) { 52676 /* istanbul ignore if */ 52677 if (!cls || !(cls = cls.trim())) { 52678 return 52679 } 52680 52681 /* istanbul ignore else */ 52682 if (el.classList) { 52683 if (cls.indexOf(' ') > -1) { 52684 cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); }); 52685 } else { 52686 el.classList.remove(cls); 52687 } 52688 if (!el.classList.length) { 52689 el.removeAttribute('class'); 52690 } 52691 } else { 52692 var cur = " " + (el.getAttribute('class') || '') + " "; 52693 var tar = ' ' + cls + ' '; 52694 while (cur.indexOf(tar) >= 0) { 52695 cur = cur.replace(tar, ' '); 52696 } 52697 cur = cur.trim(); 52698 if (cur) { 52699 el.setAttribute('class', cur); 52700 } else { 52701 el.removeAttribute('class'); 52702 } 52703 } 52704} 52705 52706/* */ 52707 52708function resolveTransition (def$$1) { 52709 if (!def$$1) { 52710 return 52711 } 52712 /* istanbul ignore else */ 52713 if (typeof def$$1 === 'object') { 52714 var res = {}; 52715 if (def$$1.css !== false) { 52716 extend(res, autoCssTransition(def$$1.name || 'v')); 52717 } 52718 extend(res, def$$1); 52719 return res 52720 } else if (typeof def$$1 === 'string') { 52721 return autoCssTransition(def$$1) 52722 } 52723} 52724 52725var autoCssTransition = cached(function (name) { 52726 return { 52727 enterClass: (name + "-enter"), 52728 enterToClass: (name + "-enter-to"), 52729 enterActiveClass: (name + "-enter-active"), 52730 leaveClass: (name + "-leave"), 52731 leaveToClass: (name + "-leave-to"), 52732 leaveActiveClass: (name + "-leave-active") 52733 } 52734}); 52735 52736var hasTransition = inBrowser && !isIE9; 52737var TRANSITION = 'transition'; 52738var ANIMATION = 'animation'; 52739 52740// Transition property/event sniffing 52741var transitionProp = 'transition'; 52742var transitionEndEvent = 'transitionend'; 52743var animationProp = 'animation'; 52744var animationEndEvent = 'animationend'; 52745if (hasTransition) { 52746 /* istanbul ignore if */ 52747 if (window.ontransitionend === undefined && 52748 window.onwebkittransitionend !== undefined 52749 ) { 52750 transitionProp = 'WebkitTransition'; 52751 transitionEndEvent = 'webkitTransitionEnd'; 52752 } 52753 if (window.onanimationend === undefined && 52754 window.onwebkitanimationend !== undefined 52755 ) { 52756 animationProp = 'WebkitAnimation'; 52757 animationEndEvent = 'webkitAnimationEnd'; 52758 } 52759} 52760 52761// binding to window is necessary to make hot reload work in IE in strict mode 52762var raf = inBrowser 52763 ? window.requestAnimationFrame 52764 ? window.requestAnimationFrame.bind(window) 52765 : setTimeout 52766 : /* istanbul ignore next */ function (fn) { return fn(); }; 52767 52768function nextFrame (fn) { 52769 raf(function () { 52770 raf(fn); 52771 }); 52772} 52773 52774function addTransitionClass (el, cls) { 52775 var transitionClasses = el._transitionClasses || (el._transitionClasses = []); 52776 if (transitionClasses.indexOf(cls) < 0) { 52777 transitionClasses.push(cls); 52778 addClass(el, cls); 52779 } 52780} 52781 52782function removeTransitionClass (el, cls) { 52783 if (el._transitionClasses) { 52784 remove(el._transitionClasses, cls); 52785 } 52786 removeClass(el, cls); 52787} 52788 52789function whenTransitionEnds ( 52790 el, 52791 expectedType, 52792 cb 52793) { 52794 var ref = getTransitionInfo(el, expectedType); 52795 var type = ref.type; 52796 var timeout = ref.timeout; 52797 var propCount = ref.propCount; 52798 if (!type) { return cb() } 52799 var event = type === TRANSITION ? transitionEndEvent : animationEndEvent; 52800 var ended = 0; 52801 var end = function () { 52802 el.removeEventListener(event, onEnd); 52803 cb(); 52804 }; 52805 var onEnd = function (e) { 52806 if (e.target === el) { 52807 if (++ended >= propCount) { 52808 end(); 52809 } 52810 } 52811 }; 52812 setTimeout(function () { 52813 if (ended < propCount) { 52814 end(); 52815 } 52816 }, timeout + 1); 52817 el.addEventListener(event, onEnd); 52818} 52819 52820var transformRE = /\b(transform|all)(,|$)/; 52821 52822function getTransitionInfo (el, expectedType) { 52823 var styles = window.getComputedStyle(el); 52824 // JSDOM may return undefined for transition properties 52825 var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', '); 52826 var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', '); 52827 var transitionTimeout = getTimeout(transitionDelays, transitionDurations); 52828 var animationDelays = (styles[animationProp + 'Delay'] || '').split(', '); 52829 var animationDurations = (styles[animationProp + 'Duration'] || '').split(', '); 52830 var animationTimeout = getTimeout(animationDelays, animationDurations); 52831 52832 var type; 52833 var timeout = 0; 52834 var propCount = 0; 52835 /* istanbul ignore if */ 52836 if (expectedType === TRANSITION) { 52837 if (transitionTimeout > 0) { 52838 type = TRANSITION; 52839 timeout = transitionTimeout; 52840 propCount = transitionDurations.length; 52841 } 52842 } else if (expectedType === ANIMATION) { 52843 if (animationTimeout > 0) { 52844 type = ANIMATION; 52845 timeout = animationTimeout; 52846 propCount = animationDurations.length; 52847 } 52848 } else { 52849 timeout = Math.max(transitionTimeout, animationTimeout); 52850 type = timeout > 0 52851 ? transitionTimeout > animationTimeout 52852 ? TRANSITION 52853 : ANIMATION 52854 : null; 52855 propCount = type 52856 ? type === TRANSITION 52857 ? transitionDurations.length 52858 : animationDurations.length 52859 : 0; 52860 } 52861 var hasTransform = 52862 type === TRANSITION && 52863 transformRE.test(styles[transitionProp + 'Property']); 52864 return { 52865 type: type, 52866 timeout: timeout, 52867 propCount: propCount, 52868 hasTransform: hasTransform 52869 } 52870} 52871 52872function getTimeout (delays, durations) { 52873 /* istanbul ignore next */ 52874 while (delays.length < durations.length) { 52875 delays = delays.concat(delays); 52876 } 52877 52878 return Math.max.apply(null, durations.map(function (d, i) { 52879 return toMs(d) + toMs(delays[i]) 52880 })) 52881} 52882 52883// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers 52884// in a locale-dependent way, using a comma instead of a dot. 52885// If comma is not replaced with a dot, the input will be rounded down (i.e. acting 52886// as a floor function) causing unexpected behaviors 52887function toMs (s) { 52888 return Number(s.slice(0, -1).replace(',', '.')) * 1000 52889} 52890 52891/* */ 52892 52893function enter (vnode, toggleDisplay) { 52894 var el = vnode.elm; 52895 52896 // call leave callback now 52897 if (isDef(el._leaveCb)) { 52898 el._leaveCb.cancelled = true; 52899 el._leaveCb(); 52900 } 52901 52902 var data = resolveTransition(vnode.data.transition); 52903 if (isUndef(data)) { 52904 return 52905 } 52906 52907 /* istanbul ignore if */ 52908 if (isDef(el._enterCb) || el.nodeType !== 1) { 52909 return 52910 } 52911 52912 var css = data.css; 52913 var type = data.type; 52914 var enterClass = data.enterClass; 52915 var enterToClass = data.enterToClass; 52916 var enterActiveClass = data.enterActiveClass; 52917 var appearClass = data.appearClass; 52918 var appearToClass = data.appearToClass; 52919 var appearActiveClass = data.appearActiveClass; 52920 var beforeEnter = data.beforeEnter; 52921 var enter = data.enter; 52922 var afterEnter = data.afterEnter; 52923 var enterCancelled = data.enterCancelled; 52924 var beforeAppear = data.beforeAppear; 52925 var appear = data.appear; 52926 var afterAppear = data.afterAppear; 52927 var appearCancelled = data.appearCancelled; 52928 var duration = data.duration; 52929 52930 // activeInstance will always be the <transition> component managing this 52931 // transition. One edge case to check is when the <transition> is placed 52932 // as the root node of a child component. In that case we need to check 52933 // <transition>'s parent for appear check. 52934 var context = activeInstance; 52935 var transitionNode = activeInstance.$vnode; 52936 while (transitionNode && transitionNode.parent) { 52937 context = transitionNode.context; 52938 transitionNode = transitionNode.parent; 52939 } 52940 52941 var isAppear = !context._isMounted || !vnode.isRootInsert; 52942 52943 if (isAppear && !appear && appear !== '') { 52944 return 52945 } 52946 52947 var startClass = isAppear && appearClass 52948 ? appearClass 52949 : enterClass; 52950 var activeClass = isAppear && appearActiveClass 52951 ? appearActiveClass 52952 : enterActiveClass; 52953 var toClass = isAppear && appearToClass 52954 ? appearToClass 52955 : enterToClass; 52956 52957 var beforeEnterHook = isAppear 52958 ? (beforeAppear || beforeEnter) 52959 : beforeEnter; 52960 var enterHook = isAppear 52961 ? (typeof appear === 'function' ? appear : enter) 52962 : enter; 52963 var afterEnterHook = isAppear 52964 ? (afterAppear || afterEnter) 52965 : afterEnter; 52966 var enterCancelledHook = isAppear 52967 ? (appearCancelled || enterCancelled) 52968 : enterCancelled; 52969 52970 var explicitEnterDuration = toNumber( 52971 isObject(duration) 52972 ? duration.enter 52973 : duration 52974 ); 52975 52976 if (explicitEnterDuration != null) { 52977 checkDuration(explicitEnterDuration, 'enter', vnode); 52978 } 52979 52980 var expectsCSS = css !== false && !isIE9; 52981 var userWantsControl = getHookArgumentsLength(enterHook); 52982 52983 var cb = el._enterCb = once(function () { 52984 if (expectsCSS) { 52985 removeTransitionClass(el, toClass); 52986 removeTransitionClass(el, activeClass); 52987 } 52988 if (cb.cancelled) { 52989 if (expectsCSS) { 52990 removeTransitionClass(el, startClass); 52991 } 52992 enterCancelledHook && enterCancelledHook(el); 52993 } else { 52994 afterEnterHook && afterEnterHook(el); 52995 } 52996 el._enterCb = null; 52997 }); 52998 52999 if (!vnode.data.show) { 53000 // remove pending leave element on enter by injecting an insert hook 53001 mergeVNodeHook(vnode, 'insert', function () { 53002 var parent = el.parentNode; 53003 var pendingNode = parent && parent._pending && parent._pending[vnode.key]; 53004 if (pendingNode && 53005 pendingNode.tag === vnode.tag && 53006 pendingNode.elm._leaveCb 53007 ) { 53008 pendingNode.elm._leaveCb(); 53009 } 53010 enterHook && enterHook(el, cb); 53011 }); 53012 } 53013 53014 // start enter transition 53015 beforeEnterHook && beforeEnterHook(el); 53016 if (expectsCSS) { 53017 addTransitionClass(el, startClass); 53018 addTransitionClass(el, activeClass); 53019 nextFrame(function () { 53020 removeTransitionClass(el, startClass); 53021 if (!cb.cancelled) { 53022 addTransitionClass(el, toClass); 53023 if (!userWantsControl) { 53024 if (isValidDuration(explicitEnterDuration)) { 53025 setTimeout(cb, explicitEnterDuration); 53026 } else { 53027 whenTransitionEnds(el, type, cb); 53028 } 53029 } 53030 } 53031 }); 53032 } 53033 53034 if (vnode.data.show) { 53035 toggleDisplay && toggleDisplay(); 53036 enterHook && enterHook(el, cb); 53037 } 53038 53039 if (!expectsCSS && !userWantsControl) { 53040 cb(); 53041 } 53042} 53043 53044function leave (vnode, rm) { 53045 var el = vnode.elm; 53046 53047 // call enter callback now 53048 if (isDef(el._enterCb)) { 53049 el._enterCb.cancelled = true; 53050 el._enterCb(); 53051 } 53052 53053 var data = resolveTransition(vnode.data.transition); 53054 if (isUndef(data) || el.nodeType !== 1) { 53055 return rm() 53056 } 53057 53058 /* istanbul ignore if */ 53059 if (isDef(el._leaveCb)) { 53060 return 53061 } 53062 53063 var css = data.css; 53064 var type = data.type; 53065 var leaveClass = data.leaveClass; 53066 var leaveToClass = data.leaveToClass; 53067 var leaveActiveClass = data.leaveActiveClass; 53068 var beforeLeave = data.beforeLeave; 53069 var leave = data.leave; 53070 var afterLeave = data.afterLeave; 53071 var leaveCancelled = data.leaveCancelled; 53072 var delayLeave = data.delayLeave; 53073 var duration = data.duration; 53074 53075 var expectsCSS = css !== false && !isIE9; 53076 var userWantsControl = getHookArgumentsLength(leave); 53077 53078 var explicitLeaveDuration = toNumber( 53079 isObject(duration) 53080 ? duration.leave 53081 : duration 53082 ); 53083 53084 if (isDef(explicitLeaveDuration)) { 53085 checkDuration(explicitLeaveDuration, 'leave', vnode); 53086 } 53087 53088 var cb = el._leaveCb = once(function () { 53089 if (el.parentNode && el.parentNode._pending) { 53090 el.parentNode._pending[vnode.key] = null; 53091 } 53092 if (expectsCSS) { 53093 removeTransitionClass(el, leaveToClass); 53094 removeTransitionClass(el, leaveActiveClass); 53095 } 53096 if (cb.cancelled) { 53097 if (expectsCSS) { 53098 removeTransitionClass(el, leaveClass); 53099 } 53100 leaveCancelled && leaveCancelled(el); 53101 } else { 53102 rm(); 53103 afterLeave && afterLeave(el); 53104 } 53105 el._leaveCb = null; 53106 }); 53107 53108 if (delayLeave) { 53109 delayLeave(performLeave); 53110 } else { 53111 performLeave(); 53112 } 53113 53114 function performLeave () { 53115 // the delayed leave may have already been cancelled 53116 if (cb.cancelled) { 53117 return 53118 } 53119 // record leaving element 53120 if (!vnode.data.show && el.parentNode) { 53121 (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode; 53122 } 53123 beforeLeave && beforeLeave(el); 53124 if (expectsCSS) { 53125 addTransitionClass(el, leaveClass); 53126 addTransitionClass(el, leaveActiveClass); 53127 nextFrame(function () { 53128 removeTransitionClass(el, leaveClass); 53129 if (!cb.cancelled) { 53130 addTransitionClass(el, leaveToClass); 53131 if (!userWantsControl) { 53132 if (isValidDuration(explicitLeaveDuration)) { 53133 setTimeout(cb, explicitLeaveDuration); 53134 } else { 53135 whenTransitionEnds(el, type, cb); 53136 } 53137 } 53138 } 53139 }); 53140 } 53141 leave && leave(el, cb); 53142 if (!expectsCSS && !userWantsControl) { 53143 cb(); 53144 } 53145 } 53146} 53147 53148// only used in dev mode 53149function checkDuration (val, name, vnode) { 53150 if (typeof val !== 'number') { 53151 warn( 53152 "<transition> explicit " + name + " duration is not a valid number - " + 53153 "got " + (JSON.stringify(val)) + ".", 53154 vnode.context 53155 ); 53156 } else if (isNaN(val)) { 53157 warn( 53158 "<transition> explicit " + name + " duration is NaN - " + 53159 'the duration expression might be incorrect.', 53160 vnode.context 53161 ); 53162 } 53163} 53164 53165function isValidDuration (val) { 53166 return typeof val === 'number' && !isNaN(val) 53167} 53168 53169/** 53170 * Normalize a transition hook's argument length. The hook may be: 53171 * - a merged hook (invoker) with the original in .fns 53172 * - a wrapped component method (check ._length) 53173 * - a plain function (.length) 53174 */ 53175function getHookArgumentsLength (fn) { 53176 if (isUndef(fn)) { 53177 return false 53178 } 53179 var invokerFns = fn.fns; 53180 if (isDef(invokerFns)) { 53181 // invoker 53182 return getHookArgumentsLength( 53183 Array.isArray(invokerFns) 53184 ? invokerFns[0] 53185 : invokerFns 53186 ) 53187 } else { 53188 return (fn._length || fn.length) > 1 53189 } 53190} 53191 53192function _enter (_, vnode) { 53193 if (vnode.data.show !== true) { 53194 enter(vnode); 53195 } 53196} 53197 53198var transition = inBrowser ? { 53199 create: _enter, 53200 activate: _enter, 53201 remove: function remove$$1 (vnode, rm) { 53202 /* istanbul ignore else */ 53203 if (vnode.data.show !== true) { 53204 leave(vnode, rm); 53205 } else { 53206 rm(); 53207 } 53208 } 53209} : {}; 53210 53211var platformModules = [ 53212 attrs, 53213 klass, 53214 events, 53215 domProps, 53216 style, 53217 transition 53218]; 53219 53220/* */ 53221 53222// the directive module should be applied last, after all 53223// built-in modules have been applied. 53224var modules = platformModules.concat(baseModules); 53225 53226var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules }); 53227 53228/** 53229 * Not type checking this file because flow doesn't like attaching 53230 * properties to Elements. 53231 */ 53232 53233/* istanbul ignore if */ 53234if (isIE9) { 53235 // http://www.matts411.com/post/internet-explorer-9-oninput/ 53236 document.addEventListener('selectionchange', function () { 53237 var el = document.activeElement; 53238 if (el && el.vmodel) { 53239 trigger(el, 'input'); 53240 } 53241 }); 53242} 53243 53244var directive = { 53245 inserted: function inserted (el, binding, vnode, oldVnode) { 53246 if (vnode.tag === 'select') { 53247 // #6903 53248 if (oldVnode.elm && !oldVnode.elm._vOptions) { 53249 mergeVNodeHook(vnode, 'postpatch', function () { 53250 directive.componentUpdated(el, binding, vnode); 53251 }); 53252 } else { 53253 setSelected(el, binding, vnode.context); 53254 } 53255 el._vOptions = [].map.call(el.options, getValue); 53256 } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) { 53257 el._vModifiers = binding.modifiers; 53258 if (!binding.modifiers.lazy) { 53259 el.addEventListener('compositionstart', onCompositionStart); 53260 el.addEventListener('compositionend', onCompositionEnd); 53261 // Safari < 10.2 & UIWebView doesn't fire compositionend when 53262 // switching focus before confirming composition choice 53263 // this also fixes the issue where some browsers e.g. iOS Chrome 53264 // fires "change" instead of "input" on autocomplete. 53265 el.addEventListener('change', onCompositionEnd); 53266 /* istanbul ignore if */ 53267 if (isIE9) { 53268 el.vmodel = true; 53269 } 53270 } 53271 } 53272 }, 53273 53274 componentUpdated: function componentUpdated (el, binding, vnode) { 53275 if (vnode.tag === 'select') { 53276 setSelected(el, binding, vnode.context); 53277 // in case the options rendered by v-for have changed, 53278 // it's possible that the value is out-of-sync with the rendered options. 53279 // detect such cases and filter out values that no longer has a matching 53280 // option in the DOM. 53281 var prevOptions = el._vOptions; 53282 var curOptions = el._vOptions = [].map.call(el.options, getValue); 53283 if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) { 53284 // trigger change event if 53285 // no matching option found for at least one value 53286 var needReset = el.multiple 53287 ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); }) 53288 : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions); 53289 if (needReset) { 53290 trigger(el, 'change'); 53291 } 53292 } 53293 } 53294 } 53295}; 53296 53297function setSelected (el, binding, vm) { 53298 actuallySetSelected(el, binding, vm); 53299 /* istanbul ignore if */ 53300 if (isIE || isEdge) { 53301 setTimeout(function () { 53302 actuallySetSelected(el, binding, vm); 53303 }, 0); 53304 } 53305} 53306 53307function actuallySetSelected (el, binding, vm) { 53308 var value = binding.value; 53309 var isMultiple = el.multiple; 53310 if (isMultiple && !Array.isArray(value)) { 53311 warn( 53312 "<select multiple v-model=\"" + (binding.expression) + "\"> " + 53313 "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)), 53314 vm 53315 ); 53316 return 53317 } 53318 var selected, option; 53319 for (var i = 0, l = el.options.length; i < l; i++) { 53320 option = el.options[i]; 53321 if (isMultiple) { 53322 selected = looseIndexOf(value, getValue(option)) > -1; 53323 if (option.selected !== selected) { 53324 option.selected = selected; 53325 } 53326 } else { 53327 if (looseEqual(getValue(option), value)) { 53328 if (el.selectedIndex !== i) { 53329 el.selectedIndex = i; 53330 } 53331 return 53332 } 53333 } 53334 } 53335 if (!isMultiple) { 53336 el.selectedIndex = -1; 53337 } 53338} 53339 53340function hasNoMatchingOption (value, options) { 53341 return options.every(function (o) { return !looseEqual(o, value); }) 53342} 53343 53344function getValue (option) { 53345 return '_value' in option 53346 ? option._value 53347 : option.value 53348} 53349 53350function onCompositionStart (e) { 53351 e.target.composing = true; 53352} 53353 53354function onCompositionEnd (e) { 53355 // prevent triggering an input event for no reason 53356 if (!e.target.composing) { return } 53357 e.target.composing = false; 53358 trigger(e.target, 'input'); 53359} 53360 53361function trigger (el, type) { 53362 var e = document.createEvent('HTMLEvents'); 53363 e.initEvent(type, true, true); 53364 el.dispatchEvent(e); 53365} 53366 53367/* */ 53368 53369// recursively search for possible transition defined inside the component root 53370function locateNode (vnode) { 53371 return vnode.componentInstance && (!vnode.data || !vnode.data.transition) 53372 ? locateNode(vnode.componentInstance._vnode) 53373 : vnode 53374} 53375 53376var show = { 53377 bind: function bind (el, ref, vnode) { 53378 var value = ref.value; 53379 53380 vnode = locateNode(vnode); 53381 var transition$$1 = vnode.data && vnode.data.transition; 53382 var originalDisplay = el.__vOriginalDisplay = 53383 el.style.display === 'none' ? '' : el.style.display; 53384 if (value && transition$$1) { 53385 vnode.data.show = true; 53386 enter(vnode, function () { 53387 el.style.display = originalDisplay; 53388 }); 53389 } else { 53390 el.style.display = value ? originalDisplay : 'none'; 53391 } 53392 }, 53393 53394 update: function update (el, ref, vnode) { 53395 var value = ref.value; 53396 var oldValue = ref.oldValue; 53397 53398 /* istanbul ignore if */ 53399 if (!value === !oldValue) { return } 53400 vnode = locateNode(vnode); 53401 var transition$$1 = vnode.data && vnode.data.transition; 53402 if (transition$$1) { 53403 vnode.data.show = true; 53404 if (value) { 53405 enter(vnode, function () { 53406 el.style.display = el.__vOriginalDisplay; 53407 }); 53408 } else { 53409 leave(vnode, function () { 53410 el.style.display = 'none'; 53411 }); 53412 } 53413 } else { 53414 el.style.display = value ? el.__vOriginalDisplay : 'none'; 53415 } 53416 }, 53417 53418 unbind: function unbind ( 53419 el, 53420 binding, 53421 vnode, 53422 oldVnode, 53423 isDestroy 53424 ) { 53425 if (!isDestroy) { 53426 el.style.display = el.__vOriginalDisplay; 53427 } 53428 } 53429}; 53430 53431var platformDirectives = { 53432 model: directive, 53433 show: show 53434}; 53435 53436/* */ 53437 53438var transitionProps = { 53439 name: String, 53440 appear: Boolean, 53441 css: Boolean, 53442 mode: String, 53443 type: String, 53444 enterClass: String, 53445 leaveClass: String, 53446 enterToClass: String, 53447 leaveToClass: String, 53448 enterActiveClass: String, 53449 leaveActiveClass: String, 53450 appearClass: String, 53451 appearActiveClass: String, 53452 appearToClass: String, 53453 duration: [Number, String, Object] 53454}; 53455 53456// in case the child is also an abstract component, e.g. <keep-alive> 53457// we want to recursively retrieve the real component to be rendered 53458function getRealChild (vnode) { 53459 var compOptions = vnode && vnode.componentOptions; 53460 if (compOptions && compOptions.Ctor.options.abstract) { 53461 return getRealChild(getFirstComponentChild(compOptions.children)) 53462 } else { 53463 return vnode 53464 } 53465} 53466 53467function extractTransitionData (comp) { 53468 var data = {}; 53469 var options = comp.$options; 53470 // props 53471 for (var key in options.propsData) { 53472 data[key] = comp[key]; 53473 } 53474 // events. 53475 // extract listeners and pass them directly to the transition methods 53476 var listeners = options._parentListeners; 53477 for (var key$1 in listeners) { 53478 data[camelize(key$1)] = listeners[key$1]; 53479 } 53480 return data 53481} 53482 53483function placeholder (h, rawChild) { 53484 if (/\d-keep-alive$/.test(rawChild.tag)) { 53485 return h('keep-alive', { 53486 props: rawChild.componentOptions.propsData 53487 }) 53488 } 53489} 53490 53491function hasParentTransition (vnode) { 53492 while ((vnode = vnode.parent)) { 53493 if (vnode.data.transition) { 53494 return true 53495 } 53496 } 53497} 53498 53499function isSameChild (child, oldChild) { 53500 return oldChild.key === child.key && oldChild.tag === child.tag 53501} 53502 53503var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); }; 53504 53505var isVShowDirective = function (d) { return d.name === 'show'; }; 53506 53507var Transition = { 53508 name: 'transition', 53509 props: transitionProps, 53510 abstract: true, 53511 53512 render: function render (h) { 53513 var this$1 = this; 53514 53515 var children = this.$slots.default; 53516 if (!children) { 53517 return 53518 } 53519 53520 // filter out text nodes (possible whitespaces) 53521 children = children.filter(isNotTextNode); 53522 /* istanbul ignore if */ 53523 if (!children.length) { 53524 return 53525 } 53526 53527 // warn multiple elements 53528 if (children.length > 1) { 53529 warn( 53530 '<transition> can only be used on a single element. Use ' + 53531 '<transition-group> for lists.', 53532 this.$parent 53533 ); 53534 } 53535 53536 var mode = this.mode; 53537 53538 // warn invalid mode 53539 if (mode && mode !== 'in-out' && mode !== 'out-in' 53540 ) { 53541 warn( 53542 'invalid <transition> mode: ' + mode, 53543 this.$parent 53544 ); 53545 } 53546 53547 var rawChild = children[0]; 53548 53549 // if this is a component root node and the component's 53550 // parent container node also has transition, skip. 53551 if (hasParentTransition(this.$vnode)) { 53552 return rawChild 53553 } 53554 53555 // apply transition data to child 53556 // use getRealChild() to ignore abstract components e.g. keep-alive 53557 var child = getRealChild(rawChild); 53558 /* istanbul ignore if */ 53559 if (!child) { 53560 return rawChild 53561 } 53562 53563 if (this._leaving) { 53564 return placeholder(h, rawChild) 53565 } 53566 53567 // ensure a key that is unique to the vnode type and to this transition 53568 // component instance. This key will be used to remove pending leaving nodes 53569 // during entering. 53570 var id = "__transition-" + (this._uid) + "-"; 53571 child.key = child.key == null 53572 ? child.isComment 53573 ? id + 'comment' 53574 : id + child.tag 53575 : isPrimitive(child.key) 53576 ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key) 53577 : child.key; 53578 53579 var data = (child.data || (child.data = {})).transition = extractTransitionData(this); 53580 var oldRawChild = this._vnode; 53581 var oldChild = getRealChild(oldRawChild); 53582 53583 // mark v-show 53584 // so that the transition module can hand over the control to the directive 53585 if (child.data.directives && child.data.directives.some(isVShowDirective)) { 53586 child.data.show = true; 53587 } 53588 53589 if ( 53590 oldChild && 53591 oldChild.data && 53592 !isSameChild(child, oldChild) && 53593 !isAsyncPlaceholder(oldChild) && 53594 // #6687 component root is a comment node 53595 !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment) 53596 ) { 53597 // replace old child transition data with fresh one 53598 // important for dynamic transitions! 53599 var oldData = oldChild.data.transition = extend({}, data); 53600 // handle transition mode 53601 if (mode === 'out-in') { 53602 // return placeholder node and queue update when leave finishes 53603 this._leaving = true; 53604 mergeVNodeHook(oldData, 'afterLeave', function () { 53605 this$1._leaving = false; 53606 this$1.$forceUpdate(); 53607 }); 53608 return placeholder(h, rawChild) 53609 } else if (mode === 'in-out') { 53610 if (isAsyncPlaceholder(child)) { 53611 return oldRawChild 53612 } 53613 var delayedLeave; 53614 var performLeave = function () { delayedLeave(); }; 53615 mergeVNodeHook(data, 'afterEnter', performLeave); 53616 mergeVNodeHook(data, 'enterCancelled', performLeave); 53617 mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; }); 53618 } 53619 } 53620 53621 return rawChild 53622 } 53623}; 53624 53625/* */ 53626 53627var props = extend({ 53628 tag: String, 53629 moveClass: String 53630}, transitionProps); 53631 53632delete props.mode; 53633 53634var TransitionGroup = { 53635 props: props, 53636 53637 beforeMount: function beforeMount () { 53638 var this$1 = this; 53639 53640 var update = this._update; 53641 this._update = function (vnode, hydrating) { 53642 var restoreActiveInstance = setActiveInstance(this$1); 53643 // force removing pass 53644 this$1.__patch__( 53645 this$1._vnode, 53646 this$1.kept, 53647 false, // hydrating 53648 true // removeOnly (!important, avoids unnecessary moves) 53649 ); 53650 this$1._vnode = this$1.kept; 53651 restoreActiveInstance(); 53652 update.call(this$1, vnode, hydrating); 53653 }; 53654 }, 53655 53656 render: function render (h) { 53657 var tag = this.tag || this.$vnode.data.tag || 'span'; 53658 var map = Object.create(null); 53659 var prevChildren = this.prevChildren = this.children; 53660 var rawChildren = this.$slots.default || []; 53661 var children = this.children = []; 53662 var transitionData = extractTransitionData(this); 53663 53664 for (var i = 0; i < rawChildren.length; i++) { 53665 var c = rawChildren[i]; 53666 if (c.tag) { 53667 if (c.key != null && String(c.key).indexOf('__vlist') !== 0) { 53668 children.push(c); 53669 map[c.key] = c 53670 ;(c.data || (c.data = {})).transition = transitionData; 53671 } else { 53672 var opts = c.componentOptions; 53673 var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag; 53674 warn(("<transition-group> children must be keyed: <" + name + ">")); 53675 } 53676 } 53677 } 53678 53679 if (prevChildren) { 53680 var kept = []; 53681 var removed = []; 53682 for (var i$1 = 0; i$1 < prevChildren.length; i$1++) { 53683 var c$1 = prevChildren[i$1]; 53684 c$1.data.transition = transitionData; 53685 c$1.data.pos = c$1.elm.getBoundingClientRect(); 53686 if (map[c$1.key]) { 53687 kept.push(c$1); 53688 } else { 53689 removed.push(c$1); 53690 } 53691 } 53692 this.kept = h(tag, null, kept); 53693 this.removed = removed; 53694 } 53695 53696 return h(tag, null, children) 53697 }, 53698 53699 updated: function updated () { 53700 var children = this.prevChildren; 53701 var moveClass = this.moveClass || ((this.name || 'v') + '-move'); 53702 if (!children.length || !this.hasMove(children[0].elm, moveClass)) { 53703 return 53704 } 53705 53706 // we divide the work into three loops to avoid mixing DOM reads and writes 53707 // in each iteration - which helps prevent layout thrashing. 53708 children.forEach(callPendingCbs); 53709 children.forEach(recordPosition); 53710 children.forEach(applyTranslation); 53711 53712 // force reflow to put everything in position 53713 // assign to this to avoid being removed in tree-shaking 53714 // $flow-disable-line 53715 this._reflow = document.body.offsetHeight; 53716 53717 children.forEach(function (c) { 53718 if (c.data.moved) { 53719 var el = c.elm; 53720 var s = el.style; 53721 addTransitionClass(el, moveClass); 53722 s.transform = s.WebkitTransform = s.transitionDuration = ''; 53723 el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) { 53724 if (e && e.target !== el) { 53725 return 53726 } 53727 if (!e || /transform$/.test(e.propertyName)) { 53728 el.removeEventListener(transitionEndEvent, cb); 53729 el._moveCb = null; 53730 removeTransitionClass(el, moveClass); 53731 } 53732 }); 53733 } 53734 }); 53735 }, 53736 53737 methods: { 53738 hasMove: function hasMove (el, moveClass) { 53739 /* istanbul ignore if */ 53740 if (!hasTransition) { 53741 return false 53742 } 53743 /* istanbul ignore if */ 53744 if (this._hasMove) { 53745 return this._hasMove 53746 } 53747 // Detect whether an element with the move class applied has 53748 // CSS transitions. Since the element may be inside an entering 53749 // transition at this very moment, we make a clone of it and remove 53750 // all other transition classes applied to ensure only the move class 53751 // is applied. 53752 var clone = el.cloneNode(); 53753 if (el._transitionClasses) { 53754 el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); }); 53755 } 53756 addClass(clone, moveClass); 53757 clone.style.display = 'none'; 53758 this.$el.appendChild(clone); 53759 var info = getTransitionInfo(clone); 53760 this.$el.removeChild(clone); 53761 return (this._hasMove = info.hasTransform) 53762 } 53763 } 53764}; 53765 53766function callPendingCbs (c) { 53767 /* istanbul ignore if */ 53768 if (c.elm._moveCb) { 53769 c.elm._moveCb(); 53770 } 53771 /* istanbul ignore if */ 53772 if (c.elm._enterCb) { 53773 c.elm._enterCb(); 53774 } 53775} 53776 53777function recordPosition (c) { 53778 c.data.newPos = c.elm.getBoundingClientRect(); 53779} 53780 53781function applyTranslation (c) { 53782 var oldPos = c.data.pos; 53783 var newPos = c.data.newPos; 53784 var dx = oldPos.left - newPos.left; 53785 var dy = oldPos.top - newPos.top; 53786 if (dx || dy) { 53787 c.data.moved = true; 53788 var s = c.elm.style; 53789 s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)"; 53790 s.transitionDuration = '0s'; 53791 } 53792} 53793 53794var platformComponents = { 53795 Transition: Transition, 53796 TransitionGroup: TransitionGroup 53797}; 53798 53799/* */ 53800 53801// install platform specific utils 53802Vue.config.mustUseProp = mustUseProp; 53803Vue.config.isReservedTag = isReservedTag; 53804Vue.config.isReservedAttr = isReservedAttr; 53805Vue.config.getTagNamespace = getTagNamespace; 53806Vue.config.isUnknownElement = isUnknownElement; 53807 53808// install platform runtime directives & components 53809extend(Vue.options.directives, platformDirectives); 53810extend(Vue.options.components, platformComponents); 53811 53812// install platform patch function 53813Vue.prototype.__patch__ = inBrowser ? patch : noop; 53814 53815// public mount method 53816Vue.prototype.$mount = function ( 53817 el, 53818 hydrating 53819) { 53820 el = el && inBrowser ? query(el) : undefined; 53821 return mountComponent(this, el, hydrating) 53822}; 53823 53824// devtools global hook 53825/* istanbul ignore next */ 53826if (inBrowser) { 53827 setTimeout(function () { 53828 if (config.devtools) { 53829 if (devtools) { 53830 devtools.emit('init', Vue); 53831 } else { 53832 console[console.info ? 'info' : 'log']( 53833 'Download the Vue Devtools extension for a better development experience:\n' + 53834 'https://github.com/vuejs/vue-devtools' 53835 ); 53836 } 53837 } 53838 if (config.productionTip !== false && 53839 typeof console !== 'undefined' 53840 ) { 53841 console[console.info ? 'info' : 'log']( 53842 "You are running Vue in development mode.\n" + 53843 "Make sure to turn on production mode when deploying for production.\n" + 53844 "See more tips at https://vuejs.org/guide/deployment.html" 53845 ); 53846 } 53847 }, 0); 53848} 53849 53850/* */ 53851 53852var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g; 53853var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g; 53854 53855var buildRegex = cached(function (delimiters) { 53856 var open = delimiters[0].replace(regexEscapeRE, '\\$&'); 53857 var close = delimiters[1].replace(regexEscapeRE, '\\$&'); 53858 return new RegExp(open + '((?:.|\\n)+?)' + close, 'g') 53859}); 53860 53861 53862 53863function parseText ( 53864 text, 53865 delimiters 53866) { 53867 var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE; 53868 if (!tagRE.test(text)) { 53869 return 53870 } 53871 var tokens = []; 53872 var rawTokens = []; 53873 var lastIndex = tagRE.lastIndex = 0; 53874 var match, index, tokenValue; 53875 while ((match = tagRE.exec(text))) { 53876 index = match.index; 53877 // push text token 53878 if (index > lastIndex) { 53879 rawTokens.push(tokenValue = text.slice(lastIndex, index)); 53880 tokens.push(JSON.stringify(tokenValue)); 53881 } 53882 // tag token 53883 var exp = parseFilters(match[1].trim()); 53884 tokens.push(("_s(" + exp + ")")); 53885 rawTokens.push({ '@binding': exp }); 53886 lastIndex = index + match[0].length; 53887 } 53888 if (lastIndex < text.length) { 53889 rawTokens.push(tokenValue = text.slice(lastIndex)); 53890 tokens.push(JSON.stringify(tokenValue)); 53891 } 53892 return { 53893 expression: tokens.join('+'), 53894 tokens: rawTokens 53895 } 53896} 53897 53898/* */ 53899 53900function transformNode (el, options) { 53901 var warn = options.warn || baseWarn; 53902 var staticClass = getAndRemoveAttr(el, 'class'); 53903 if (staticClass) { 53904 var res = parseText(staticClass, options.delimiters); 53905 if (res) { 53906 warn( 53907 "class=\"" + staticClass + "\": " + 53908 'Interpolation inside attributes has been removed. ' + 53909 'Use v-bind or the colon shorthand instead. For example, ' + 53910 'instead of <div class="{{ val }}">, use <div :class="val">.', 53911 el.rawAttrsMap['class'] 53912 ); 53913 } 53914 } 53915 if (staticClass) { 53916 el.staticClass = JSON.stringify(staticClass); 53917 } 53918 var classBinding = getBindingAttr(el, 'class', false /* getStatic */); 53919 if (classBinding) { 53920 el.classBinding = classBinding; 53921 } 53922} 53923 53924function genData (el) { 53925 var data = ''; 53926 if (el.staticClass) { 53927 data += "staticClass:" + (el.staticClass) + ","; 53928 } 53929 if (el.classBinding) { 53930 data += "class:" + (el.classBinding) + ","; 53931 } 53932 return data 53933} 53934 53935var klass$1 = { 53936 staticKeys: ['staticClass'], 53937 transformNode: transformNode, 53938 genData: genData 53939}; 53940 53941/* */ 53942 53943function transformNode$1 (el, options) { 53944 var warn = options.warn || baseWarn; 53945 var staticStyle = getAndRemoveAttr(el, 'style'); 53946 if (staticStyle) { 53947 /* istanbul ignore if */ 53948 { 53949 var res = parseText(staticStyle, options.delimiters); 53950 if (res) { 53951 warn( 53952 "style=\"" + staticStyle + "\": " + 53953 'Interpolation inside attributes has been removed. ' + 53954 'Use v-bind or the colon shorthand instead. For example, ' + 53955 'instead of <div style="{{ val }}">, use <div :style="val">.', 53956 el.rawAttrsMap['style'] 53957 ); 53958 } 53959 } 53960 el.staticStyle = JSON.stringify(parseStyleText(staticStyle)); 53961 } 53962 53963 var styleBinding = getBindingAttr(el, 'style', false /* getStatic */); 53964 if (styleBinding) { 53965 el.styleBinding = styleBinding; 53966 } 53967} 53968 53969function genData$1 (el) { 53970 var data = ''; 53971 if (el.staticStyle) { 53972 data += "staticStyle:" + (el.staticStyle) + ","; 53973 } 53974 if (el.styleBinding) { 53975 data += "style:(" + (el.styleBinding) + "),"; 53976 } 53977 return data 53978} 53979 53980var style$1 = { 53981 staticKeys: ['staticStyle'], 53982 transformNode: transformNode$1, 53983 genData: genData$1 53984}; 53985 53986/* */ 53987 53988var decoder; 53989 53990var he = { 53991 decode: function decode (html) { 53992 decoder = decoder || document.createElement('div'); 53993 decoder.innerHTML = html; 53994 return decoder.textContent 53995 } 53996}; 53997 53998/* */ 53999 54000var isUnaryTag = makeMap( 54001 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' + 54002 'link,meta,param,source,track,wbr' 54003); 54004 54005// Elements that you can, intentionally, leave open 54006// (and which close themselves) 54007var canBeLeftOpenTag = makeMap( 54008 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source' 54009); 54010 54011// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3 54012// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content 54013var isNonPhrasingTag = makeMap( 54014 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' + 54015 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' + 54016 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' + 54017 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' + 54018 'title,tr,track' 54019); 54020 54021/** 54022 * Not type-checking this file because it's mostly vendor code. 54023 */ 54024 54025// Regular Expressions for parsing tags and attributes 54026var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; 54027var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/; 54028var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*"; 54029var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")"; 54030var startTagOpen = new RegExp(("^<" + qnameCapture)); 54031var startTagClose = /^\s*(\/?)>/; 54032var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>")); 54033var doctype = /^<!DOCTYPE [^>]+>/i; 54034// #7298: escape - to avoid being passed as HTML comment when inlined in page 54035var comment = /^<!\--/; 54036var conditionalComment = /^<!\[/; 54037 54038// Special Elements (can contain anything) 54039var isPlainTextElement = makeMap('script,style,textarea', true); 54040var reCache = {}; 54041 54042var decodingMap = { 54043 '<': '<', 54044 '>': '>', 54045 '"': '"', 54046 '&': '&', 54047 ' ': '\n', 54048 '	': '\t', 54049 ''': "'" 54050}; 54051var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g; 54052var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g; 54053 54054// #5992 54055var isIgnoreNewlineTag = makeMap('pre,textarea', true); 54056var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; }; 54057 54058function decodeAttr (value, shouldDecodeNewlines) { 54059 var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr; 54060 return value.replace(re, function (match) { return decodingMap[match]; }) 54061} 54062 54063function parseHTML (html, options) { 54064 var stack = []; 54065 var expectHTML = options.expectHTML; 54066 var isUnaryTag$$1 = options.isUnaryTag || no; 54067 var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no; 54068 var index = 0; 54069 var last, lastTag; 54070 while (html) { 54071 last = html; 54072 // Make sure we're not in a plaintext content element like script/style 54073 if (!lastTag || !isPlainTextElement(lastTag)) { 54074 var textEnd = html.indexOf('<'); 54075 if (textEnd === 0) { 54076 // Comment: 54077 if (comment.test(html)) { 54078 var commentEnd = html.indexOf('-->'); 54079 54080 if (commentEnd >= 0) { 54081 if (options.shouldKeepComment) { 54082 options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3); 54083 } 54084 advance(commentEnd + 3); 54085 continue 54086 } 54087 } 54088 54089 // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment 54090 if (conditionalComment.test(html)) { 54091 var conditionalEnd = html.indexOf(']>'); 54092 54093 if (conditionalEnd >= 0) { 54094 advance(conditionalEnd + 2); 54095 continue 54096 } 54097 } 54098 54099 // Doctype: 54100 var doctypeMatch = html.match(doctype); 54101 if (doctypeMatch) { 54102 advance(doctypeMatch[0].length); 54103 continue 54104 } 54105 54106 // End tag: 54107 var endTagMatch = html.match(endTag); 54108 if (endTagMatch) { 54109 var curIndex = index; 54110 advance(endTagMatch[0].length); 54111 parseEndTag(endTagMatch[1], curIndex, index); 54112 continue 54113 } 54114 54115 // Start tag: 54116 var startTagMatch = parseStartTag(); 54117 if (startTagMatch) { 54118 handleStartTag(startTagMatch); 54119 if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) { 54120 advance(1); 54121 } 54122 continue 54123 } 54124 } 54125 54126 var text = (void 0), rest = (void 0), next = (void 0); 54127 if (textEnd >= 0) { 54128 rest = html.slice(textEnd); 54129 while ( 54130 !endTag.test(rest) && 54131 !startTagOpen.test(rest) && 54132 !comment.test(rest) && 54133 !conditionalComment.test(rest) 54134 ) { 54135 // < in plain text, be forgiving and treat it as text 54136 next = rest.indexOf('<', 1); 54137 if (next < 0) { break } 54138 textEnd += next; 54139 rest = html.slice(textEnd); 54140 } 54141 text = html.substring(0, textEnd); 54142 } 54143 54144 if (textEnd < 0) { 54145 text = html; 54146 } 54147 54148 if (text) { 54149 advance(text.length); 54150 } 54151 54152 if (options.chars && text) { 54153 options.chars(text, index - text.length, index); 54154 } 54155 } else { 54156 var endTagLength = 0; 54157 var stackedTag = lastTag.toLowerCase(); 54158 var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i')); 54159 var rest$1 = html.replace(reStackedTag, function (all, text, endTag) { 54160 endTagLength = endTag.length; 54161 if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') { 54162 text = text 54163 .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298 54164 .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1'); 54165 } 54166 if (shouldIgnoreFirstNewline(stackedTag, text)) { 54167 text = text.slice(1); 54168 } 54169 if (options.chars) { 54170 options.chars(text); 54171 } 54172 return '' 54173 }); 54174 index += html.length - rest$1.length; 54175 html = rest$1; 54176 parseEndTag(stackedTag, index - endTagLength, index); 54177 } 54178 54179 if (html === last) { 54180 options.chars && options.chars(html); 54181 if (!stack.length && options.warn) { 54182 options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length }); 54183 } 54184 break 54185 } 54186 } 54187 54188 // Clean up any remaining tags 54189 parseEndTag(); 54190 54191 function advance (n) { 54192 index += n; 54193 html = html.substring(n); 54194 } 54195 54196 function parseStartTag () { 54197 var start = html.match(startTagOpen); 54198 if (start) { 54199 var match = { 54200 tagName: start[1], 54201 attrs: [], 54202 start: index 54203 }; 54204 advance(start[0].length); 54205 var end, attr; 54206 while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) { 54207 attr.start = index; 54208 advance(attr[0].length); 54209 attr.end = index; 54210 match.attrs.push(attr); 54211 } 54212 if (end) { 54213 match.unarySlash = end[1]; 54214 advance(end[0].length); 54215 match.end = index; 54216 return match 54217 } 54218 } 54219 } 54220 54221 function handleStartTag (match) { 54222 var tagName = match.tagName; 54223 var unarySlash = match.unarySlash; 54224 54225 if (expectHTML) { 54226 if (lastTag === 'p' && isNonPhrasingTag(tagName)) { 54227 parseEndTag(lastTag); 54228 } 54229 if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) { 54230 parseEndTag(tagName); 54231 } 54232 } 54233 54234 var unary = isUnaryTag$$1(tagName) || !!unarySlash; 54235 54236 var l = match.attrs.length; 54237 var attrs = new Array(l); 54238 for (var i = 0; i < l; i++) { 54239 var args = match.attrs[i]; 54240 var value = args[3] || args[4] || args[5] || ''; 54241 var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href' 54242 ? options.shouldDecodeNewlinesForHref 54243 : options.shouldDecodeNewlines; 54244 attrs[i] = { 54245 name: args[1], 54246 value: decodeAttr(value, shouldDecodeNewlines) 54247 }; 54248 if (options.outputSourceRange) { 54249 attrs[i].start = args.start + args[0].match(/^\s*/).length; 54250 attrs[i].end = args.end; 54251 } 54252 } 54253 54254 if (!unary) { 54255 stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end }); 54256 lastTag = tagName; 54257 } 54258 54259 if (options.start) { 54260 options.start(tagName, attrs, unary, match.start, match.end); 54261 } 54262 } 54263 54264 function parseEndTag (tagName, start, end) { 54265 var pos, lowerCasedTagName; 54266 if (start == null) { start = index; } 54267 if (end == null) { end = index; } 54268 54269 // Find the closest opened tag of the same type 54270 if (tagName) { 54271 lowerCasedTagName = tagName.toLowerCase(); 54272 for (pos = stack.length - 1; pos >= 0; pos--) { 54273 if (stack[pos].lowerCasedTag === lowerCasedTagName) { 54274 break 54275 } 54276 } 54277 } else { 54278 // If no tag name is provided, clean shop 54279 pos = 0; 54280 } 54281 54282 if (pos >= 0) { 54283 // Close all the open elements, up the stack 54284 for (var i = stack.length - 1; i >= pos; i--) { 54285 if (i > pos || !tagName && 54286 options.warn 54287 ) { 54288 options.warn( 54289 ("tag <" + (stack[i].tag) + "> has no matching end tag."), 54290 { start: stack[i].start, end: stack[i].end } 54291 ); 54292 } 54293 if (options.end) { 54294 options.end(stack[i].tag, start, end); 54295 } 54296 } 54297 54298 // Remove the open elements from the stack 54299 stack.length = pos; 54300 lastTag = pos && stack[pos - 1].tag; 54301 } else if (lowerCasedTagName === 'br') { 54302 if (options.start) { 54303 options.start(tagName, [], true, start, end); 54304 } 54305 } else if (lowerCasedTagName === 'p') { 54306 if (options.start) { 54307 options.start(tagName, [], false, start, end); 54308 } 54309 if (options.end) { 54310 options.end(tagName, start, end); 54311 } 54312 } 54313 } 54314} 54315 54316/* */ 54317 54318var onRE = /^@|^v-on:/; 54319var dirRE = /^v-|^@|^:|^#/; 54320var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; 54321var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 54322var stripParensRE = /^\(|\)$/g; 54323var dynamicArgRE = /^\[.*\]$/; 54324 54325var argRE = /:(.*)$/; 54326var bindRE = /^:|^\.|^v-bind:/; 54327var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g; 54328 54329var slotRE = /^v-slot(:|$)|^#/; 54330 54331var lineBreakRE = /[\r\n]/; 54332var whitespaceRE$1 = /[ \f\t\r\n]+/g; 54333 54334var invalidAttributeRE = /[\s"'<>\/=]/; 54335 54336var decodeHTMLCached = cached(he.decode); 54337 54338var emptySlotScopeToken = "_empty_"; 54339 54340// configurable state 54341var warn$2; 54342var delimiters; 54343var transforms; 54344var preTransforms; 54345var postTransforms; 54346var platformIsPreTag; 54347var platformMustUseProp; 54348var platformGetTagNamespace; 54349var maybeComponent; 54350 54351function createASTElement ( 54352 tag, 54353 attrs, 54354 parent 54355) { 54356 return { 54357 type: 1, 54358 tag: tag, 54359 attrsList: attrs, 54360 attrsMap: makeAttrsMap(attrs), 54361 rawAttrsMap: {}, 54362 parent: parent, 54363 children: [] 54364 } 54365} 54366 54367/** 54368 * Convert HTML string to AST. 54369 */ 54370function parse ( 54371 template, 54372 options 54373) { 54374 warn$2 = options.warn || baseWarn; 54375 54376 platformIsPreTag = options.isPreTag || no; 54377 platformMustUseProp = options.mustUseProp || no; 54378 platformGetTagNamespace = options.getTagNamespace || no; 54379 var isReservedTag = options.isReservedTag || no; 54380 maybeComponent = function (el) { return !!( 54381 el.component || 54382 el.attrsMap[':is'] || 54383 el.attrsMap['v-bind:is'] || 54384 !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag)) 54385 ); }; 54386 transforms = pluckModuleFunction(options.modules, 'transformNode'); 54387 preTransforms = pluckModuleFunction(options.modules, 'preTransformNode'); 54388 postTransforms = pluckModuleFunction(options.modules, 'postTransformNode'); 54389 54390 delimiters = options.delimiters; 54391 54392 var stack = []; 54393 var preserveWhitespace = options.preserveWhitespace !== false; 54394 var whitespaceOption = options.whitespace; 54395 var root; 54396 var currentParent; 54397 var inVPre = false; 54398 var inPre = false; 54399 var warned = false; 54400 54401 function warnOnce (msg, range) { 54402 if (!warned) { 54403 warned = true; 54404 warn$2(msg, range); 54405 } 54406 } 54407 54408 function closeElement (element) { 54409 trimEndingWhitespace(element); 54410 if (!inVPre && !element.processed) { 54411 element = processElement(element, options); 54412 } 54413 // tree management 54414 if (!stack.length && element !== root) { 54415 // allow root elements with v-if, v-else-if and v-else 54416 if (root.if && (element.elseif || element.else)) { 54417 { 54418 checkRootConstraints(element); 54419 } 54420 addIfCondition(root, { 54421 exp: element.elseif, 54422 block: element 54423 }); 54424 } else { 54425 warnOnce( 54426 "Component template should contain exactly one root element. " + 54427 "If you are using v-if on multiple elements, " + 54428 "use v-else-if to chain them instead.", 54429 { start: element.start } 54430 ); 54431 } 54432 } 54433 if (currentParent && !element.forbidden) { 54434 if (element.elseif || element.else) { 54435 processIfConditions(element, currentParent); 54436 } else { 54437 if (element.slotScope) { 54438 // scoped slot 54439 // keep it in the children list so that v-else(-if) conditions can 54440 // find it as the prev node. 54441 var name = element.slotTarget || '"default"' 54442 ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element; 54443 } 54444 currentParent.children.push(element); 54445 element.parent = currentParent; 54446 } 54447 } 54448 54449 // final children cleanup 54450 // filter out scoped slots 54451 element.children = element.children.filter(function (c) { return !(c).slotScope; }); 54452 // remove trailing whitespace node again 54453 trimEndingWhitespace(element); 54454 54455 // check pre state 54456 if (element.pre) { 54457 inVPre = false; 54458 } 54459 if (platformIsPreTag(element.tag)) { 54460 inPre = false; 54461 } 54462 // apply post-transforms 54463 for (var i = 0; i < postTransforms.length; i++) { 54464 postTransforms[i](element, options); 54465 } 54466 } 54467 54468 function trimEndingWhitespace (el) { 54469 // remove trailing whitespace node 54470 if (!inPre) { 54471 var lastNode; 54472 while ( 54473 (lastNode = el.children[el.children.length - 1]) && 54474 lastNode.type === 3 && 54475 lastNode.text === ' ' 54476 ) { 54477 el.children.pop(); 54478 } 54479 } 54480 } 54481 54482 function checkRootConstraints (el) { 54483 if (el.tag === 'slot' || el.tag === 'template') { 54484 warnOnce( 54485 "Cannot use <" + (el.tag) + "> as component root element because it may " + 54486 'contain multiple nodes.', 54487 { start: el.start } 54488 ); 54489 } 54490 if (el.attrsMap.hasOwnProperty('v-for')) { 54491 warnOnce( 54492 'Cannot use v-for on stateful component root element because ' + 54493 'it renders multiple elements.', 54494 el.rawAttrsMap['v-for'] 54495 ); 54496 } 54497 } 54498 54499 parseHTML(template, { 54500 warn: warn$2, 54501 expectHTML: options.expectHTML, 54502 isUnaryTag: options.isUnaryTag, 54503 canBeLeftOpenTag: options.canBeLeftOpenTag, 54504 shouldDecodeNewlines: options.shouldDecodeNewlines, 54505 shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref, 54506 shouldKeepComment: options.comments, 54507 outputSourceRange: options.outputSourceRange, 54508 start: function start (tag, attrs, unary, start$1, end) { 54509 // check namespace. 54510 // inherit parent ns if there is one 54511 var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag); 54512 54513 // handle IE svg bug 54514 /* istanbul ignore if */ 54515 if (isIE && ns === 'svg') { 54516 attrs = guardIESVGBug(attrs); 54517 } 54518 54519 var element = createASTElement(tag, attrs, currentParent); 54520 if (ns) { 54521 element.ns = ns; 54522 } 54523 54524 { 54525 if (options.outputSourceRange) { 54526 element.start = start$1; 54527 element.end = end; 54528 element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) { 54529 cumulated[attr.name] = attr; 54530 return cumulated 54531 }, {}); 54532 } 54533 attrs.forEach(function (attr) { 54534 if (invalidAttributeRE.test(attr.name)) { 54535 warn$2( 54536 "Invalid dynamic argument expression: attribute names cannot contain " + 54537 "spaces, quotes, <, >, / or =.", 54538 { 54539 start: attr.start + attr.name.indexOf("["), 54540 end: attr.start + attr.name.length 54541 } 54542 ); 54543 } 54544 }); 54545 } 54546 54547 if (isForbiddenTag(element) && !isServerRendering()) { 54548 element.forbidden = true; 54549 warn$2( 54550 'Templates should only be responsible for mapping the state to the ' + 54551 'UI. Avoid placing tags with side-effects in your templates, such as ' + 54552 "<" + tag + ">" + ', as they will not be parsed.', 54553 { start: element.start } 54554 ); 54555 } 54556 54557 // apply pre-transforms 54558 for (var i = 0; i < preTransforms.length; i++) { 54559 element = preTransforms[i](element, options) || element; 54560 } 54561 54562 if (!inVPre) { 54563 processPre(element); 54564 if (element.pre) { 54565 inVPre = true; 54566 } 54567 } 54568 if (platformIsPreTag(element.tag)) { 54569 inPre = true; 54570 } 54571 if (inVPre) { 54572 processRawAttrs(element); 54573 } else if (!element.processed) { 54574 // structural directives 54575 processFor(element); 54576 processIf(element); 54577 processOnce(element); 54578 } 54579 54580 if (!root) { 54581 root = element; 54582 { 54583 checkRootConstraints(root); 54584 } 54585 } 54586 54587 if (!unary) { 54588 currentParent = element; 54589 stack.push(element); 54590 } else { 54591 closeElement(element); 54592 } 54593 }, 54594 54595 end: function end (tag, start, end$1) { 54596 var element = stack[stack.length - 1]; 54597 // pop stack 54598 stack.length -= 1; 54599 currentParent = stack[stack.length - 1]; 54600 if (options.outputSourceRange) { 54601 element.end = end$1; 54602 } 54603 closeElement(element); 54604 }, 54605 54606 chars: function chars (text, start, end) { 54607 if (!currentParent) { 54608 { 54609 if (text === template) { 54610 warnOnce( 54611 'Component template requires a root element, rather than just text.', 54612 { start: start } 54613 ); 54614 } else if ((text = text.trim())) { 54615 warnOnce( 54616 ("text \"" + text + "\" outside root element will be ignored."), 54617 { start: start } 54618 ); 54619 } 54620 } 54621 return 54622 } 54623 // IE textarea placeholder bug 54624 /* istanbul ignore if */ 54625 if (isIE && 54626 currentParent.tag === 'textarea' && 54627 currentParent.attrsMap.placeholder === text 54628 ) { 54629 return 54630 } 54631 var children = currentParent.children; 54632 if (inPre || text.trim()) { 54633 text = isTextTag(currentParent) ? text : decodeHTMLCached(text); 54634 } else if (!children.length) { 54635 // remove the whitespace-only node right after an opening tag 54636 text = ''; 54637 } else if (whitespaceOption) { 54638 if (whitespaceOption === 'condense') { 54639 // in condense mode, remove the whitespace node if it contains 54640 // line break, otherwise condense to a single space 54641 text = lineBreakRE.test(text) ? '' : ' '; 54642 } else { 54643 text = ' '; 54644 } 54645 } else { 54646 text = preserveWhitespace ? ' ' : ''; 54647 } 54648 if (text) { 54649 if (!inPre && whitespaceOption === 'condense') { 54650 // condense consecutive whitespaces into single space 54651 text = text.replace(whitespaceRE$1, ' '); 54652 } 54653 var res; 54654 var child; 54655 if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) { 54656 child = { 54657 type: 2, 54658 expression: res.expression, 54659 tokens: res.tokens, 54660 text: text 54661 }; 54662 } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') { 54663 child = { 54664 type: 3, 54665 text: text 54666 }; 54667 } 54668 if (child) { 54669 if (options.outputSourceRange) { 54670 child.start = start; 54671 child.end = end; 54672 } 54673 children.push(child); 54674 } 54675 } 54676 }, 54677 comment: function comment (text, start, end) { 54678 // adding anything as a sibling to the root node is forbidden 54679 // comments should still be allowed, but ignored 54680 if (currentParent) { 54681 var child = { 54682 type: 3, 54683 text: text, 54684 isComment: true 54685 }; 54686 if (options.outputSourceRange) { 54687 child.start = start; 54688 child.end = end; 54689 } 54690 currentParent.children.push(child); 54691 } 54692 } 54693 }); 54694 return root 54695} 54696 54697function processPre (el) { 54698 if (getAndRemoveAttr(el, 'v-pre') != null) { 54699 el.pre = true; 54700 } 54701} 54702 54703function processRawAttrs (el) { 54704 var list = el.attrsList; 54705 var len = list.length; 54706 if (len) { 54707 var attrs = el.attrs = new Array(len); 54708 for (var i = 0; i < len; i++) { 54709 attrs[i] = { 54710 name: list[i].name, 54711 value: JSON.stringify(list[i].value) 54712 }; 54713 if (list[i].start != null) { 54714 attrs[i].start = list[i].start; 54715 attrs[i].end = list[i].end; 54716 } 54717 } 54718 } else if (!el.pre) { 54719 // non root node in pre blocks with no attributes 54720 el.plain = true; 54721 } 54722} 54723 54724function processElement ( 54725 element, 54726 options 54727) { 54728 processKey(element); 54729 54730 // determine whether this is a plain element after 54731 // removing structural attributes 54732 element.plain = ( 54733 !element.key && 54734 !element.scopedSlots && 54735 !element.attrsList.length 54736 ); 54737 54738 processRef(element); 54739 processSlotContent(element); 54740 processSlotOutlet(element); 54741 processComponent(element); 54742 for (var i = 0; i < transforms.length; i++) { 54743 element = transforms[i](element, options) || element; 54744 } 54745 processAttrs(element); 54746 return element 54747} 54748 54749function processKey (el) { 54750 var exp = getBindingAttr(el, 'key'); 54751 if (exp) { 54752 { 54753 if (el.tag === 'template') { 54754 warn$2( 54755 "<template> cannot be keyed. Place the key on real elements instead.", 54756 getRawBindingAttr(el, 'key') 54757 ); 54758 } 54759 if (el.for) { 54760 var iterator = el.iterator2 || el.iterator1; 54761 var parent = el.parent; 54762 if (iterator && iterator === exp && parent && parent.tag === 'transition-group') { 54763 warn$2( 54764 "Do not use v-for index as key on <transition-group> children, " + 54765 "this is the same as not using keys.", 54766 getRawBindingAttr(el, 'key'), 54767 true /* tip */ 54768 ); 54769 } 54770 } 54771 } 54772 el.key = exp; 54773 } 54774} 54775 54776function processRef (el) { 54777 var ref = getBindingAttr(el, 'ref'); 54778 if (ref) { 54779 el.ref = ref; 54780 el.refInFor = checkInFor(el); 54781 } 54782} 54783 54784function processFor (el) { 54785 var exp; 54786 if ((exp = getAndRemoveAttr(el, 'v-for'))) { 54787 var res = parseFor(exp); 54788 if (res) { 54789 extend(el, res); 54790 } else { 54791 warn$2( 54792 ("Invalid v-for expression: " + exp), 54793 el.rawAttrsMap['v-for'] 54794 ); 54795 } 54796 } 54797} 54798 54799 54800 54801function parseFor (exp) { 54802 var inMatch = exp.match(forAliasRE); 54803 if (!inMatch) { return } 54804 var res = {}; 54805 res.for = inMatch[2].trim(); 54806 var alias = inMatch[1].trim().replace(stripParensRE, ''); 54807 var iteratorMatch = alias.match(forIteratorRE); 54808 if (iteratorMatch) { 54809 res.alias = alias.replace(forIteratorRE, '').trim(); 54810 res.iterator1 = iteratorMatch[1].trim(); 54811 if (iteratorMatch[2]) { 54812 res.iterator2 = iteratorMatch[2].trim(); 54813 } 54814 } else { 54815 res.alias = alias; 54816 } 54817 return res 54818} 54819 54820function processIf (el) { 54821 var exp = getAndRemoveAttr(el, 'v-if'); 54822 if (exp) { 54823 el.if = exp; 54824 addIfCondition(el, { 54825 exp: exp, 54826 block: el 54827 }); 54828 } else { 54829 if (getAndRemoveAttr(el, 'v-else') != null) { 54830 el.else = true; 54831 } 54832 var elseif = getAndRemoveAttr(el, 'v-else-if'); 54833 if (elseif) { 54834 el.elseif = elseif; 54835 } 54836 } 54837} 54838 54839function processIfConditions (el, parent) { 54840 var prev = findPrevElement(parent.children); 54841 if (prev && prev.if) { 54842 addIfCondition(prev, { 54843 exp: el.elseif, 54844 block: el 54845 }); 54846 } else { 54847 warn$2( 54848 "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " + 54849 "used on element <" + (el.tag) + "> without corresponding v-if.", 54850 el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else'] 54851 ); 54852 } 54853} 54854 54855function findPrevElement (children) { 54856 var i = children.length; 54857 while (i--) { 54858 if (children[i].type === 1) { 54859 return children[i] 54860 } else { 54861 if (children[i].text !== ' ') { 54862 warn$2( 54863 "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " + 54864 "will be ignored.", 54865 children[i] 54866 ); 54867 } 54868 children.pop(); 54869 } 54870 } 54871} 54872 54873function addIfCondition (el, condition) { 54874 if (!el.ifConditions) { 54875 el.ifConditions = []; 54876 } 54877 el.ifConditions.push(condition); 54878} 54879 54880function processOnce (el) { 54881 var once$$1 = getAndRemoveAttr(el, 'v-once'); 54882 if (once$$1 != null) { 54883 el.once = true; 54884 } 54885} 54886 54887// handle content being passed to a component as slot, 54888// e.g. <template slot="xxx">, <div slot-scope="xxx"> 54889function processSlotContent (el) { 54890 var slotScope; 54891 if (el.tag === 'template') { 54892 slotScope = getAndRemoveAttr(el, 'scope'); 54893 /* istanbul ignore if */ 54894 if (slotScope) { 54895 warn$2( 54896 "the \"scope\" attribute for scoped slots have been deprecated and " + 54897 "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " + 54898 "can also be used on plain elements in addition to <template> to " + 54899 "denote scoped slots.", 54900 el.rawAttrsMap['scope'], 54901 true 54902 ); 54903 } 54904 el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope'); 54905 } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) { 54906 /* istanbul ignore if */ 54907 if (el.attrsMap['v-for']) { 54908 warn$2( 54909 "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " + 54910 "(v-for takes higher priority). Use a wrapper <template> for the " + 54911 "scoped slot to make it clearer.", 54912 el.rawAttrsMap['slot-scope'], 54913 true 54914 ); 54915 } 54916 el.slotScope = slotScope; 54917 } 54918 54919 // slot="xxx" 54920 var slotTarget = getBindingAttr(el, 'slot'); 54921 if (slotTarget) { 54922 el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget; 54923 el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']); 54924 // preserve slot as an attribute for native shadow DOM compat 54925 // only for non-scoped slots. 54926 if (el.tag !== 'template' && !el.slotScope) { 54927 addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot')); 54928 } 54929 } 54930 54931 // 2.6 v-slot syntax 54932 { 54933 if (el.tag === 'template') { 54934 // v-slot on <template> 54935 var slotBinding = getAndRemoveAttrByRegex(el, slotRE); 54936 if (slotBinding) { 54937 { 54938 if (el.slotTarget || el.slotScope) { 54939 warn$2( 54940 "Unexpected mixed usage of different slot syntaxes.", 54941 el 54942 ); 54943 } 54944 if (el.parent && !maybeComponent(el.parent)) { 54945 warn$2( 54946 "<template v-slot> can only appear at the root level inside " + 54947 "the receiving component", 54948 el 54949 ); 54950 } 54951 } 54952 var ref = getSlotName(slotBinding); 54953 var name = ref.name; 54954 var dynamic = ref.dynamic; 54955 el.slotTarget = name; 54956 el.slotTargetDynamic = dynamic; 54957 el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf 54958 } 54959 } else { 54960 // v-slot on component, denotes default slot 54961 var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE); 54962 if (slotBinding$1) { 54963 { 54964 if (!maybeComponent(el)) { 54965 warn$2( 54966 "v-slot can only be used on components or <template>.", 54967 slotBinding$1 54968 ); 54969 } 54970 if (el.slotScope || el.slotTarget) { 54971 warn$2( 54972 "Unexpected mixed usage of different slot syntaxes.", 54973 el 54974 ); 54975 } 54976 if (el.scopedSlots) { 54977 warn$2( 54978 "To avoid scope ambiguity, the default slot should also use " + 54979 "<template> syntax when there are other named slots.", 54980 slotBinding$1 54981 ); 54982 } 54983 } 54984 // add the component's children to its default slot 54985 var slots = el.scopedSlots || (el.scopedSlots = {}); 54986 var ref$1 = getSlotName(slotBinding$1); 54987 var name$1 = ref$1.name; 54988 var dynamic$1 = ref$1.dynamic; 54989 var slotContainer = slots[name$1] = createASTElement('template', [], el); 54990 slotContainer.slotTarget = name$1; 54991 slotContainer.slotTargetDynamic = dynamic$1; 54992 slotContainer.children = el.children.filter(function (c) { 54993 if (!c.slotScope) { 54994 c.parent = slotContainer; 54995 return true 54996 } 54997 }); 54998 slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken; 54999 // remove children as they are returned from scopedSlots now 55000 el.children = []; 55001 // mark el non-plain so data gets generated 55002 el.plain = false; 55003 } 55004 } 55005 } 55006} 55007 55008function getSlotName (binding) { 55009 var name = binding.name.replace(slotRE, ''); 55010 if (!name) { 55011 if (binding.name[0] !== '#') { 55012 name = 'default'; 55013 } else { 55014 warn$2( 55015 "v-slot shorthand syntax requires a slot name.", 55016 binding 55017 ); 55018 } 55019 } 55020 return dynamicArgRE.test(name) 55021 // dynamic [name] 55022 ? { name: name.slice(1, -1), dynamic: true } 55023 // static name 55024 : { name: ("\"" + name + "\""), dynamic: false } 55025} 55026 55027// handle <slot/> outlets 55028function processSlotOutlet (el) { 55029 if (el.tag === 'slot') { 55030 el.slotName = getBindingAttr(el, 'name'); 55031 if (el.key) { 55032 warn$2( 55033 "`key` does not work on <slot> because slots are abstract outlets " + 55034 "and can possibly expand into multiple elements. " + 55035 "Use the key on a wrapping element instead.", 55036 getRawBindingAttr(el, 'key') 55037 ); 55038 } 55039 } 55040} 55041 55042function processComponent (el) { 55043 var binding; 55044 if ((binding = getBindingAttr(el, 'is'))) { 55045 el.component = binding; 55046 } 55047 if (getAndRemoveAttr(el, 'inline-template') != null) { 55048 el.inlineTemplate = true; 55049 } 55050} 55051 55052function processAttrs (el) { 55053 var list = el.attrsList; 55054 var i, l, name, rawName, value, modifiers, syncGen, isDynamic; 55055 for (i = 0, l = list.length; i < l; i++) { 55056 name = rawName = list[i].name; 55057 value = list[i].value; 55058 if (dirRE.test(name)) { 55059 // mark element as dynamic 55060 el.hasBindings = true; 55061 // modifiers 55062 modifiers = parseModifiers(name.replace(dirRE, '')); 55063 // support .foo shorthand syntax for the .prop modifier 55064 if (modifiers) { 55065 name = name.replace(modifierRE, ''); 55066 } 55067 if (bindRE.test(name)) { // v-bind 55068 name = name.replace(bindRE, ''); 55069 value = parseFilters(value); 55070 isDynamic = dynamicArgRE.test(name); 55071 if (isDynamic) { 55072 name = name.slice(1, -1); 55073 } 55074 if ( 55075 value.trim().length === 0 55076 ) { 55077 warn$2( 55078 ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"") 55079 ); 55080 } 55081 if (modifiers) { 55082 if (modifiers.prop && !isDynamic) { 55083 name = camelize(name); 55084 if (name === 'innerHtml') { name = 'innerHTML'; } 55085 } 55086 if (modifiers.camel && !isDynamic) { 55087 name = camelize(name); 55088 } 55089 if (modifiers.sync) { 55090 syncGen = genAssignmentCode(value, "$event"); 55091 if (!isDynamic) { 55092 addHandler( 55093 el, 55094 ("update:" + (camelize(name))), 55095 syncGen, 55096 null, 55097 false, 55098 warn$2, 55099 list[i] 55100 ); 55101 if (hyphenate(name) !== camelize(name)) { 55102 addHandler( 55103 el, 55104 ("update:" + (hyphenate(name))), 55105 syncGen, 55106 null, 55107 false, 55108 warn$2, 55109 list[i] 55110 ); 55111 } 55112 } else { 55113 // handler w/ dynamic event name 55114 addHandler( 55115 el, 55116 ("\"update:\"+(" + name + ")"), 55117 syncGen, 55118 null, 55119 false, 55120 warn$2, 55121 list[i], 55122 true // dynamic 55123 ); 55124 } 55125 } 55126 } 55127 if ((modifiers && modifiers.prop) || ( 55128 !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name) 55129 )) { 55130 addProp(el, name, value, list[i], isDynamic); 55131 } else { 55132 addAttr(el, name, value, list[i], isDynamic); 55133 } 55134 } else if (onRE.test(name)) { // v-on 55135 name = name.replace(onRE, ''); 55136 isDynamic = dynamicArgRE.test(name); 55137 if (isDynamic) { 55138 name = name.slice(1, -1); 55139 } 55140 addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic); 55141 } else { // normal directives 55142 name = name.replace(dirRE, ''); 55143 // parse arg 55144 var argMatch = name.match(argRE); 55145 var arg = argMatch && argMatch[1]; 55146 isDynamic = false; 55147 if (arg) { 55148 name = name.slice(0, -(arg.length + 1)); 55149 if (dynamicArgRE.test(arg)) { 55150 arg = arg.slice(1, -1); 55151 isDynamic = true; 55152 } 55153 } 55154 addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]); 55155 if (name === 'model') { 55156 checkForAliasModel(el, value); 55157 } 55158 } 55159 } else { 55160 // literal attribute 55161 { 55162 var res = parseText(value, delimiters); 55163 if (res) { 55164 warn$2( 55165 name + "=\"" + value + "\": " + 55166 'Interpolation inside attributes has been removed. ' + 55167 'Use v-bind or the colon shorthand instead. For example, ' + 55168 'instead of <div id="{{ val }}">, use <div :id="val">.', 55169 list[i] 55170 ); 55171 } 55172 } 55173 addAttr(el, name, JSON.stringify(value), list[i]); 55174 // #6887 firefox doesn't update muted state if set via attribute 55175 // even immediately after element creation 55176 if (!el.component && 55177 name === 'muted' && 55178 platformMustUseProp(el.tag, el.attrsMap.type, name)) { 55179 addProp(el, name, 'true', list[i]); 55180 } 55181 } 55182 } 55183} 55184 55185function checkInFor (el) { 55186 var parent = el; 55187 while (parent) { 55188 if (parent.for !== undefined) { 55189 return true 55190 } 55191 parent = parent.parent; 55192 } 55193 return false 55194} 55195 55196function parseModifiers (name) { 55197 var match = name.match(modifierRE); 55198 if (match) { 55199 var ret = {}; 55200 match.forEach(function (m) { ret[m.slice(1)] = true; }); 55201 return ret 55202 } 55203} 55204 55205function makeAttrsMap (attrs) { 55206 var map = {}; 55207 for (var i = 0, l = attrs.length; i < l; i++) { 55208 if ( 55209 map[attrs[i].name] && !isIE && !isEdge 55210 ) { 55211 warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]); 55212 } 55213 map[attrs[i].name] = attrs[i].value; 55214 } 55215 return map 55216} 55217 55218// for script (e.g. type="x/template") or style, do not decode content 55219function isTextTag (el) { 55220 return el.tag === 'script' || el.tag === 'style' 55221} 55222 55223function isForbiddenTag (el) { 55224 return ( 55225 el.tag === 'style' || 55226 (el.tag === 'script' && ( 55227 !el.attrsMap.type || 55228 el.attrsMap.type === 'text/javascript' 55229 )) 55230 ) 55231} 55232 55233var ieNSBug = /^xmlns:NS\d+/; 55234var ieNSPrefix = /^NS\d+:/; 55235 55236/* istanbul ignore next */ 55237function guardIESVGBug (attrs) { 55238 var res = []; 55239 for (var i = 0; i < attrs.length; i++) { 55240 var attr = attrs[i]; 55241 if (!ieNSBug.test(attr.name)) { 55242 attr.name = attr.name.replace(ieNSPrefix, ''); 55243 res.push(attr); 55244 } 55245 } 55246 return res 55247} 55248 55249function checkForAliasModel (el, value) { 55250 var _el = el; 55251 while (_el) { 55252 if (_el.for && _el.alias === value) { 55253 warn$2( 55254 "<" + (el.tag) + " v-model=\"" + value + "\">: " + 55255 "You are binding v-model directly to a v-for iteration alias. " + 55256 "This will not be able to modify the v-for source array because " + 55257 "writing to the alias is like modifying a function local variable. " + 55258 "Consider using an array of objects and use v-model on an object property instead.", 55259 el.rawAttrsMap['v-model'] 55260 ); 55261 } 55262 _el = _el.parent; 55263 } 55264} 55265 55266/* */ 55267 55268function preTransformNode (el, options) { 55269 if (el.tag === 'input') { 55270 var map = el.attrsMap; 55271 if (!map['v-model']) { 55272 return 55273 } 55274 55275 var typeBinding; 55276 if (map[':type'] || map['v-bind:type']) { 55277 typeBinding = getBindingAttr(el, 'type'); 55278 } 55279 if (!map.type && !typeBinding && map['v-bind']) { 55280 typeBinding = "(" + (map['v-bind']) + ").type"; 55281 } 55282 55283 if (typeBinding) { 55284 var ifCondition = getAndRemoveAttr(el, 'v-if', true); 55285 var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : ""; 55286 var hasElse = getAndRemoveAttr(el, 'v-else', true) != null; 55287 var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true); 55288 // 1. checkbox 55289 var branch0 = cloneASTElement(el); 55290 // process for on the main node 55291 processFor(branch0); 55292 addRawAttr(branch0, 'type', 'checkbox'); 55293 processElement(branch0, options); 55294 branch0.processed = true; // prevent it from double-processed 55295 branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra; 55296 addIfCondition(branch0, { 55297 exp: branch0.if, 55298 block: branch0 55299 }); 55300 // 2. add radio else-if condition 55301 var branch1 = cloneASTElement(el); 55302 getAndRemoveAttr(branch1, 'v-for', true); 55303 addRawAttr(branch1, 'type', 'radio'); 55304 processElement(branch1, options); 55305 addIfCondition(branch0, { 55306 exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra, 55307 block: branch1 55308 }); 55309 // 3. other 55310 var branch2 = cloneASTElement(el); 55311 getAndRemoveAttr(branch2, 'v-for', true); 55312 addRawAttr(branch2, ':type', typeBinding); 55313 processElement(branch2, options); 55314 addIfCondition(branch0, { 55315 exp: ifCondition, 55316 block: branch2 55317 }); 55318 55319 if (hasElse) { 55320 branch0.else = true; 55321 } else if (elseIfCondition) { 55322 branch0.elseif = elseIfCondition; 55323 } 55324 55325 return branch0 55326 } 55327 } 55328} 55329 55330function cloneASTElement (el) { 55331 return createASTElement(el.tag, el.attrsList.slice(), el.parent) 55332} 55333 55334var model$1 = { 55335 preTransformNode: preTransformNode 55336}; 55337 55338var modules$1 = [ 55339 klass$1, 55340 style$1, 55341 model$1 55342]; 55343 55344/* */ 55345 55346function text (el, dir) { 55347 if (dir.value) { 55348 addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir); 55349 } 55350} 55351 55352/* */ 55353 55354function html (el, dir) { 55355 if (dir.value) { 55356 addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir); 55357 } 55358} 55359 55360var directives$1 = { 55361 model: model, 55362 text: text, 55363 html: html 55364}; 55365 55366/* */ 55367 55368var baseOptions = { 55369 expectHTML: true, 55370 modules: modules$1, 55371 directives: directives$1, 55372 isPreTag: isPreTag, 55373 isUnaryTag: isUnaryTag, 55374 mustUseProp: mustUseProp, 55375 canBeLeftOpenTag: canBeLeftOpenTag, 55376 isReservedTag: isReservedTag, 55377 getTagNamespace: getTagNamespace, 55378 staticKeys: genStaticKeys(modules$1) 55379}; 55380 55381/* */ 55382 55383var isStaticKey; 55384var isPlatformReservedTag; 55385 55386var genStaticKeysCached = cached(genStaticKeys$1); 55387 55388/** 55389 * Goal of the optimizer: walk the generated template AST tree 55390 * and detect sub-trees that are purely static, i.e. parts of 55391 * the DOM that never needs to change. 55392 * 55393 * Once we detect these sub-trees, we can: 55394 * 55395 * 1. Hoist them into constants, so that we no longer need to 55396 * create fresh nodes for them on each re-render; 55397 * 2. Completely skip them in the patching process. 55398 */ 55399function optimize (root, options) { 55400 if (!root) { return } 55401 isStaticKey = genStaticKeysCached(options.staticKeys || ''); 55402 isPlatformReservedTag = options.isReservedTag || no; 55403 // first pass: mark all non-static nodes. 55404 markStatic$1(root); 55405 // second pass: mark static roots. 55406 markStaticRoots(root, false); 55407} 55408 55409function genStaticKeys$1 (keys) { 55410 return makeMap( 55411 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' + 55412 (keys ? ',' + keys : '') 55413 ) 55414} 55415 55416function markStatic$1 (node) { 55417 node.static = isStatic(node); 55418 if (node.type === 1) { 55419 // do not make component slot content static. this avoids 55420 // 1. components not able to mutate slot nodes 55421 // 2. static slot content fails for hot-reloading 55422 if ( 55423 !isPlatformReservedTag(node.tag) && 55424 node.tag !== 'slot' && 55425 node.attrsMap['inline-template'] == null 55426 ) { 55427 return 55428 } 55429 for (var i = 0, l = node.children.length; i < l; i++) { 55430 var child = node.children[i]; 55431 markStatic$1(child); 55432 if (!child.static) { 55433 node.static = false; 55434 } 55435 } 55436 if (node.ifConditions) { 55437 for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) { 55438 var block = node.ifConditions[i$1].block; 55439 markStatic$1(block); 55440 if (!block.static) { 55441 node.static = false; 55442 } 55443 } 55444 } 55445 } 55446} 55447 55448function markStaticRoots (node, isInFor) { 55449 if (node.type === 1) { 55450 if (node.static || node.once) { 55451 node.staticInFor = isInFor; 55452 } 55453 // For a node to qualify as a static root, it should have children that 55454 // are not just static text. Otherwise the cost of hoisting out will 55455 // outweigh the benefits and it's better off to just always render it fresh. 55456 if (node.static && node.children.length && !( 55457 node.children.length === 1 && 55458 node.children[0].type === 3 55459 )) { 55460 node.staticRoot = true; 55461 return 55462 } else { 55463 node.staticRoot = false; 55464 } 55465 if (node.children) { 55466 for (var i = 0, l = node.children.length; i < l; i++) { 55467 markStaticRoots(node.children[i], isInFor || !!node.for); 55468 } 55469 } 55470 if (node.ifConditions) { 55471 for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) { 55472 markStaticRoots(node.ifConditions[i$1].block, isInFor); 55473 } 55474 } 55475 } 55476} 55477 55478function isStatic (node) { 55479 if (node.type === 2) { // expression 55480 return false 55481 } 55482 if (node.type === 3) { // text 55483 return true 55484 } 55485 return !!(node.pre || ( 55486 !node.hasBindings && // no dynamic bindings 55487 !node.if && !node.for && // not v-if or v-for or v-else 55488 !isBuiltInTag(node.tag) && // not a built-in 55489 isPlatformReservedTag(node.tag) && // not a component 55490 !isDirectChildOfTemplateFor(node) && 55491 Object.keys(node).every(isStaticKey) 55492 )) 55493} 55494 55495function isDirectChildOfTemplateFor (node) { 55496 while (node.parent) { 55497 node = node.parent; 55498 if (node.tag !== 'template') { 55499 return false 55500 } 55501 if (node.for) { 55502 return true 55503 } 55504 } 55505 return false 55506} 55507 55508/* */ 55509 55510var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/; 55511var fnInvokeRE = /\([^)]*?\);*$/; 55512var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/; 55513 55514// KeyboardEvent.keyCode aliases 55515var keyCodes = { 55516 esc: 27, 55517 tab: 9, 55518 enter: 13, 55519 space: 32, 55520 up: 38, 55521 left: 37, 55522 right: 39, 55523 down: 40, 55524 'delete': [8, 46] 55525}; 55526 55527// KeyboardEvent.key aliases 55528var keyNames = { 55529 // #7880: IE11 and Edge use `Esc` for Escape key name. 55530 esc: ['Esc', 'Escape'], 55531 tab: 'Tab', 55532 enter: 'Enter', 55533 // #9112: IE11 uses `Spacebar` for Space key name. 55534 space: [' ', 'Spacebar'], 55535 // #7806: IE11 uses key names without `Arrow` prefix for arrow keys. 55536 up: ['Up', 'ArrowUp'], 55537 left: ['Left', 'ArrowLeft'], 55538 right: ['Right', 'ArrowRight'], 55539 down: ['Down', 'ArrowDown'], 55540 // #9112: IE11 uses `Del` for Delete key name. 55541 'delete': ['Backspace', 'Delete', 'Del'] 55542}; 55543 55544// #4868: modifiers that prevent the execution of the listener 55545// need to explicitly return null so that we can determine whether to remove 55546// the listener for .once 55547var genGuard = function (condition) { return ("if(" + condition + ")return null;"); }; 55548 55549var modifierCode = { 55550 stop: '$event.stopPropagation();', 55551 prevent: '$event.preventDefault();', 55552 self: genGuard("$event.target !== $event.currentTarget"), 55553 ctrl: genGuard("!$event.ctrlKey"), 55554 shift: genGuard("!$event.shiftKey"), 55555 alt: genGuard("!$event.altKey"), 55556 meta: genGuard("!$event.metaKey"), 55557 left: genGuard("'button' in $event && $event.button !== 0"), 55558 middle: genGuard("'button' in $event && $event.button !== 1"), 55559 right: genGuard("'button' in $event && $event.button !== 2") 55560}; 55561 55562function genHandlers ( 55563 events, 55564 isNative 55565) { 55566 var prefix = isNative ? 'nativeOn:' : 'on:'; 55567 var staticHandlers = ""; 55568 var dynamicHandlers = ""; 55569 for (var name in events) { 55570 var handlerCode = genHandler(events[name]); 55571 if (events[name] && events[name].dynamic) { 55572 dynamicHandlers += name + "," + handlerCode + ","; 55573 } else { 55574 staticHandlers += "\"" + name + "\":" + handlerCode + ","; 55575 } 55576 } 55577 staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}"; 55578 if (dynamicHandlers) { 55579 return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])" 55580 } else { 55581 return prefix + staticHandlers 55582 } 55583} 55584 55585function genHandler (handler) { 55586 if (!handler) { 55587 return 'function(){}' 55588 } 55589 55590 if (Array.isArray(handler)) { 55591 return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]") 55592 } 55593 55594 var isMethodPath = simplePathRE.test(handler.value); 55595 var isFunctionExpression = fnExpRE.test(handler.value); 55596 var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, '')); 55597 55598 if (!handler.modifiers) { 55599 if (isMethodPath || isFunctionExpression) { 55600 return handler.value 55601 } 55602 return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement 55603 } else { 55604 var code = ''; 55605 var genModifierCode = ''; 55606 var keys = []; 55607 for (var key in handler.modifiers) { 55608 if (modifierCode[key]) { 55609 genModifierCode += modifierCode[key]; 55610 // left/right 55611 if (keyCodes[key]) { 55612 keys.push(key); 55613 } 55614 } else if (key === 'exact') { 55615 var modifiers = (handler.modifiers); 55616 genModifierCode += genGuard( 55617 ['ctrl', 'shift', 'alt', 'meta'] 55618 .filter(function (keyModifier) { return !modifiers[keyModifier]; }) 55619 .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); }) 55620 .join('||') 55621 ); 55622 } else { 55623 keys.push(key); 55624 } 55625 } 55626 if (keys.length) { 55627 code += genKeyFilter(keys); 55628 } 55629 // Make sure modifiers like prevent and stop get executed after key filtering 55630 if (genModifierCode) { 55631 code += genModifierCode; 55632 } 55633 var handlerCode = isMethodPath 55634 ? ("return " + (handler.value) + ".apply(null, arguments)") 55635 : isFunctionExpression 55636 ? ("return (" + (handler.value) + ").apply(null, arguments)") 55637 : isFunctionInvocation 55638 ? ("return " + (handler.value)) 55639 : handler.value; 55640 return ("function($event){" + code + handlerCode + "}") 55641 } 55642} 55643 55644function genKeyFilter (keys) { 55645 return ( 55646 // make sure the key filters only apply to KeyboardEvents 55647 // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake 55648 // key events that do not have keyCode property... 55649 "if(!$event.type.indexOf('key')&&" + 55650 (keys.map(genFilterCode).join('&&')) + ")return null;" 55651 ) 55652} 55653 55654function genFilterCode (key) { 55655 var keyVal = parseInt(key, 10); 55656 if (keyVal) { 55657 return ("$event.keyCode!==" + keyVal) 55658 } 55659 var keyCode = keyCodes[key]; 55660 var keyName = keyNames[key]; 55661 return ( 55662 "_k($event.keyCode," + 55663 (JSON.stringify(key)) + "," + 55664 (JSON.stringify(keyCode)) + "," + 55665 "$event.key," + 55666 "" + (JSON.stringify(keyName)) + 55667 ")" 55668 ) 55669} 55670 55671/* */ 55672 55673function on (el, dir) { 55674 if (dir.modifiers) { 55675 warn("v-on without argument does not support modifiers."); 55676 } 55677 el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); }; 55678} 55679 55680/* */ 55681 55682function bind$1 (el, dir) { 55683 el.wrapData = function (code) { 55684 return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")") 55685 }; 55686} 55687 55688/* */ 55689 55690var baseDirectives = { 55691 on: on, 55692 bind: bind$1, 55693 cloak: noop 55694}; 55695 55696/* */ 55697 55698 55699 55700 55701 55702var CodegenState = function CodegenState (options) { 55703 this.options = options; 55704 this.warn = options.warn || baseWarn; 55705 this.transforms = pluckModuleFunction(options.modules, 'transformCode'); 55706 this.dataGenFns = pluckModuleFunction(options.modules, 'genData'); 55707 this.directives = extend(extend({}, baseDirectives), options.directives); 55708 var isReservedTag = options.isReservedTag || no; 55709 this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); }; 55710 this.onceId = 0; 55711 this.staticRenderFns = []; 55712 this.pre = false; 55713}; 55714 55715 55716 55717function generate ( 55718 ast, 55719 options 55720) { 55721 var state = new CodegenState(options); 55722 // fix #11483, Root level <script> tags should not be rendered. 55723 var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")'; 55724 return { 55725 render: ("with(this){return " + code + "}"), 55726 staticRenderFns: state.staticRenderFns 55727 } 55728} 55729 55730function genElement (el, state) { 55731 if (el.parent) { 55732 el.pre = el.pre || el.parent.pre; 55733 } 55734 55735 if (el.staticRoot && !el.staticProcessed) { 55736 return genStatic(el, state) 55737 } else if (el.once && !el.onceProcessed) { 55738 return genOnce(el, state) 55739 } else if (el.for && !el.forProcessed) { 55740 return genFor(el, state) 55741 } else if (el.if && !el.ifProcessed) { 55742 return genIf(el, state) 55743 } else if (el.tag === 'template' && !el.slotTarget && !state.pre) { 55744 return genChildren(el, state) || 'void 0' 55745 } else if (el.tag === 'slot') { 55746 return genSlot(el, state) 55747 } else { 55748 // component or element 55749 var code; 55750 if (el.component) { 55751 code = genComponent(el.component, el, state); 55752 } else { 55753 var data; 55754 if (!el.plain || (el.pre && state.maybeComponent(el))) { 55755 data = genData$2(el, state); 55756 } 55757 55758 var children = el.inlineTemplate ? null : genChildren(el, state, true); 55759 code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")"; 55760 } 55761 // module transforms 55762 for (var i = 0; i < state.transforms.length; i++) { 55763 code = state.transforms[i](el, code); 55764 } 55765 return code 55766 } 55767} 55768 55769// hoist static sub-trees out 55770function genStatic (el, state) { 55771 el.staticProcessed = true; 55772 // Some elements (templates) need to behave differently inside of a v-pre 55773 // node. All pre nodes are static roots, so we can use this as a location to 55774 // wrap a state change and reset it upon exiting the pre node. 55775 var originalPreState = state.pre; 55776 if (el.pre) { 55777 state.pre = el.pre; 55778 } 55779 state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}")); 55780 state.pre = originalPreState; 55781 return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")") 55782} 55783 55784// v-once 55785function genOnce (el, state) { 55786 el.onceProcessed = true; 55787 if (el.if && !el.ifProcessed) { 55788 return genIf(el, state) 55789 } else if (el.staticInFor) { 55790 var key = ''; 55791 var parent = el.parent; 55792 while (parent) { 55793 if (parent.for) { 55794 key = parent.key; 55795 break 55796 } 55797 parent = parent.parent; 55798 } 55799 if (!key) { 55800 state.warn( 55801 "v-once can only be used inside v-for that is keyed. ", 55802 el.rawAttrsMap['v-once'] 55803 ); 55804 return genElement(el, state) 55805 } 55806 return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")") 55807 } else { 55808 return genStatic(el, state) 55809 } 55810} 55811 55812function genIf ( 55813 el, 55814 state, 55815 altGen, 55816 altEmpty 55817) { 55818 el.ifProcessed = true; // avoid recursion 55819 return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty) 55820} 55821 55822function genIfConditions ( 55823 conditions, 55824 state, 55825 altGen, 55826 altEmpty 55827) { 55828 if (!conditions.length) { 55829 return altEmpty || '_e()' 55830 } 55831 55832 var condition = conditions.shift(); 55833 if (condition.exp) { 55834 return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty))) 55835 } else { 55836 return ("" + (genTernaryExp(condition.block))) 55837 } 55838 55839 // v-if with v-once should generate code like (a)?_m(0):_m(1) 55840 function genTernaryExp (el) { 55841 return altGen 55842 ? altGen(el, state) 55843 : el.once 55844 ? genOnce(el, state) 55845 : genElement(el, state) 55846 } 55847} 55848 55849function genFor ( 55850 el, 55851 state, 55852 altGen, 55853 altHelper 55854) { 55855 var exp = el.for; 55856 var alias = el.alias; 55857 var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : ''; 55858 var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : ''; 55859 55860 if (state.maybeComponent(el) && 55861 el.tag !== 'slot' && 55862 el.tag !== 'template' && 55863 !el.key 55864 ) { 55865 state.warn( 55866 "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " + 55867 "v-for should have explicit keys. " + 55868 "See https://vuejs.org/guide/list.html#key for more info.", 55869 el.rawAttrsMap['v-for'], 55870 true /* tip */ 55871 ); 55872 } 55873 55874 el.forProcessed = true; // avoid recursion 55875 return (altHelper || '_l') + "((" + exp + ")," + 55876 "function(" + alias + iterator1 + iterator2 + "){" + 55877 "return " + ((altGen || genElement)(el, state)) + 55878 '})' 55879} 55880 55881function genData$2 (el, state) { 55882 var data = '{'; 55883 55884 // directives first. 55885 // directives may mutate the el's other properties before they are generated. 55886 var dirs = genDirectives(el, state); 55887 if (dirs) { data += dirs + ','; } 55888 55889 // key 55890 if (el.key) { 55891 data += "key:" + (el.key) + ","; 55892 } 55893 // ref 55894 if (el.ref) { 55895 data += "ref:" + (el.ref) + ","; 55896 } 55897 if (el.refInFor) { 55898 data += "refInFor:true,"; 55899 } 55900 // pre 55901 if (el.pre) { 55902 data += "pre:true,"; 55903 } 55904 // record original tag name for components using "is" attribute 55905 if (el.component) { 55906 data += "tag:\"" + (el.tag) + "\","; 55907 } 55908 // module data generation functions 55909 for (var i = 0; i < state.dataGenFns.length; i++) { 55910 data += state.dataGenFns[i](el); 55911 } 55912 // attributes 55913 if (el.attrs) { 55914 data += "attrs:" + (genProps(el.attrs)) + ","; 55915 } 55916 // DOM props 55917 if (el.props) { 55918 data += "domProps:" + (genProps(el.props)) + ","; 55919 } 55920 // event handlers 55921 if (el.events) { 55922 data += (genHandlers(el.events, false)) + ","; 55923 } 55924 if (el.nativeEvents) { 55925 data += (genHandlers(el.nativeEvents, true)) + ","; 55926 } 55927 // slot target 55928 // only for non-scoped slots 55929 if (el.slotTarget && !el.slotScope) { 55930 data += "slot:" + (el.slotTarget) + ","; 55931 } 55932 // scoped slots 55933 if (el.scopedSlots) { 55934 data += (genScopedSlots(el, el.scopedSlots, state)) + ","; 55935 } 55936 // component v-model 55937 if (el.model) { 55938 data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},"; 55939 } 55940 // inline-template 55941 if (el.inlineTemplate) { 55942 var inlineTemplate = genInlineTemplate(el, state); 55943 if (inlineTemplate) { 55944 data += inlineTemplate + ","; 55945 } 55946 } 55947 data = data.replace(/,$/, '') + '}'; 55948 // v-bind dynamic argument wrap 55949 // v-bind with dynamic arguments must be applied using the same v-bind object 55950 // merge helper so that class/style/mustUseProp attrs are handled correctly. 55951 if (el.dynamicAttrs) { 55952 data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")"; 55953 } 55954 // v-bind data wrap 55955 if (el.wrapData) { 55956 data = el.wrapData(data); 55957 } 55958 // v-on data wrap 55959 if (el.wrapListeners) { 55960 data = el.wrapListeners(data); 55961 } 55962 return data 55963} 55964 55965function genDirectives (el, state) { 55966 var dirs = el.directives; 55967 if (!dirs) { return } 55968 var res = 'directives:['; 55969 var hasRuntime = false; 55970 var i, l, dir, needRuntime; 55971 for (i = 0, l = dirs.length; i < l; i++) { 55972 dir = dirs[i]; 55973 needRuntime = true; 55974 var gen = state.directives[dir.name]; 55975 if (gen) { 55976 // compile-time directive that manipulates AST. 55977 // returns true if it also needs a runtime counterpart. 55978 needRuntime = !!gen(el, dir, state.warn); 55979 } 55980 if (needRuntime) { 55981 hasRuntime = true; 55982 res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},"; 55983 } 55984 } 55985 if (hasRuntime) { 55986 return res.slice(0, -1) + ']' 55987 } 55988} 55989 55990function genInlineTemplate (el, state) { 55991 var ast = el.children[0]; 55992 if (el.children.length !== 1 || ast.type !== 1) { 55993 state.warn( 55994 'Inline-template components must have exactly one child element.', 55995 { start: el.start } 55996 ); 55997 } 55998 if (ast && ast.type === 1) { 55999 var inlineRenderFns = generate(ast, state.options); 56000 return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}") 56001 } 56002} 56003 56004function genScopedSlots ( 56005 el, 56006 slots, 56007 state 56008) { 56009 // by default scoped slots are considered "stable", this allows child 56010 // components with only scoped slots to skip forced updates from parent. 56011 // but in some cases we have to bail-out of this optimization 56012 // for example if the slot contains dynamic names, has v-if or v-for on them... 56013 var needsForceUpdate = el.for || Object.keys(slots).some(function (key) { 56014 var slot = slots[key]; 56015 return ( 56016 slot.slotTargetDynamic || 56017 slot.if || 56018 slot.for || 56019 containsSlotChild(slot) // is passing down slot from parent which may be dynamic 56020 ) 56021 }); 56022 56023 // #9534: if a component with scoped slots is inside a conditional branch, 56024 // it's possible for the same component to be reused but with different 56025 // compiled slot content. To avoid that, we generate a unique key based on 56026 // the generated code of all the slot contents. 56027 var needsKey = !!el.if; 56028 56029 // OR when it is inside another scoped slot or v-for (the reactivity may be 56030 // disconnected due to the intermediate scope variable) 56031 // #9438, #9506 56032 // TODO: this can be further optimized by properly analyzing in-scope bindings 56033 // and skip force updating ones that do not actually use scope variables. 56034 if (!needsForceUpdate) { 56035 var parent = el.parent; 56036 while (parent) { 56037 if ( 56038 (parent.slotScope && parent.slotScope !== emptySlotScopeToken) || 56039 parent.for 56040 ) { 56041 needsForceUpdate = true; 56042 break 56043 } 56044 if (parent.if) { 56045 needsKey = true; 56046 } 56047 parent = parent.parent; 56048 } 56049 } 56050 56051 var generatedSlots = Object.keys(slots) 56052 .map(function (key) { return genScopedSlot(slots[key], state); }) 56053 .join(','); 56054 56055 return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")") 56056} 56057 56058function hash(str) { 56059 var hash = 5381; 56060 var i = str.length; 56061 while(i) { 56062 hash = (hash * 33) ^ str.charCodeAt(--i); 56063 } 56064 return hash >>> 0 56065} 56066 56067function containsSlotChild (el) { 56068 if (el.type === 1) { 56069 if (el.tag === 'slot') { 56070 return true 56071 } 56072 return el.children.some(containsSlotChild) 56073 } 56074 return false 56075} 56076 56077function genScopedSlot ( 56078 el, 56079 state 56080) { 56081 var isLegacySyntax = el.attrsMap['slot-scope']; 56082 if (el.if && !el.ifProcessed && !isLegacySyntax) { 56083 return genIf(el, state, genScopedSlot, "null") 56084 } 56085 if (el.for && !el.forProcessed) { 56086 return genFor(el, state, genScopedSlot) 56087 } 56088 var slotScope = el.slotScope === emptySlotScopeToken 56089 ? "" 56090 : String(el.slotScope); 56091 var fn = "function(" + slotScope + "){" + 56092 "return " + (el.tag === 'template' 56093 ? el.if && isLegacySyntax 56094 ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined") 56095 : genChildren(el, state) || 'undefined' 56096 : genElement(el, state)) + "}"; 56097 // reverse proxy v-slot without scope on this.$slots 56098 var reverseProxy = slotScope ? "" : ",proxy:true"; 56099 return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}") 56100} 56101 56102function genChildren ( 56103 el, 56104 state, 56105 checkSkip, 56106 altGenElement, 56107 altGenNode 56108) { 56109 var children = el.children; 56110 if (children.length) { 56111 var el$1 = children[0]; 56112 // optimize single v-for 56113 if (children.length === 1 && 56114 el$1.for && 56115 el$1.tag !== 'template' && 56116 el$1.tag !== 'slot' 56117 ) { 56118 var normalizationType = checkSkip 56119 ? state.maybeComponent(el$1) ? ",1" : ",0" 56120 : ""; 56121 return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType) 56122 } 56123 var normalizationType$1 = checkSkip 56124 ? getNormalizationType(children, state.maybeComponent) 56125 : 0; 56126 var gen = altGenNode || genNode; 56127 return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : '')) 56128 } 56129} 56130 56131// determine the normalization needed for the children array. 56132// 0: no normalization needed 56133// 1: simple normalization needed (possible 1-level deep nested array) 56134// 2: full normalization needed 56135function getNormalizationType ( 56136 children, 56137 maybeComponent 56138) { 56139 var res = 0; 56140 for (var i = 0; i < children.length; i++) { 56141 var el = children[i]; 56142 if (el.type !== 1) { 56143 continue 56144 } 56145 if (needsNormalization(el) || 56146 (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) { 56147 res = 2; 56148 break 56149 } 56150 if (maybeComponent(el) || 56151 (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) { 56152 res = 1; 56153 } 56154 } 56155 return res 56156} 56157 56158function needsNormalization (el) { 56159 return el.for !== undefined || el.tag === 'template' || el.tag === 'slot' 56160} 56161 56162function genNode (node, state) { 56163 if (node.type === 1) { 56164 return genElement(node, state) 56165 } else if (node.type === 3 && node.isComment) { 56166 return genComment(node) 56167 } else { 56168 return genText(node) 56169 } 56170} 56171 56172function genText (text) { 56173 return ("_v(" + (text.type === 2 56174 ? text.expression // no need for () because already wrapped in _s() 56175 : transformSpecialNewlines(JSON.stringify(text.text))) + ")") 56176} 56177 56178function genComment (comment) { 56179 return ("_e(" + (JSON.stringify(comment.text)) + ")") 56180} 56181 56182function genSlot (el, state) { 56183 var slotName = el.slotName || '"default"'; 56184 var children = genChildren(el, state); 56185 var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : ''); 56186 var attrs = el.attrs || el.dynamicAttrs 56187 ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({ 56188 // slot props are camelized 56189 name: camelize(attr.name), 56190 value: attr.value, 56191 dynamic: attr.dynamic 56192 }); })) 56193 : null; 56194 var bind$$1 = el.attrsMap['v-bind']; 56195 if ((attrs || bind$$1) && !children) { 56196 res += ",null"; 56197 } 56198 if (attrs) { 56199 res += "," + attrs; 56200 } 56201 if (bind$$1) { 56202 res += (attrs ? '' : ',null') + "," + bind$$1; 56203 } 56204 return res + ')' 56205} 56206 56207// componentName is el.component, take it as argument to shun flow's pessimistic refinement 56208function genComponent ( 56209 componentName, 56210 el, 56211 state 56212) { 56213 var children = el.inlineTemplate ? null : genChildren(el, state, true); 56214 return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")") 56215} 56216 56217function genProps (props) { 56218 var staticProps = ""; 56219 var dynamicProps = ""; 56220 for (var i = 0; i < props.length; i++) { 56221 var prop = props[i]; 56222 var value = transformSpecialNewlines(prop.value); 56223 if (prop.dynamic) { 56224 dynamicProps += (prop.name) + "," + value + ","; 56225 } else { 56226 staticProps += "\"" + (prop.name) + "\":" + value + ","; 56227 } 56228 } 56229 staticProps = "{" + (staticProps.slice(0, -1)) + "}"; 56230 if (dynamicProps) { 56231 return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])") 56232 } else { 56233 return staticProps 56234 } 56235} 56236 56237// #3895, #4268 56238function transformSpecialNewlines (text) { 56239 return text 56240 .replace(/\u2028/g, '\\u2028') 56241 .replace(/\u2029/g, '\\u2029') 56242} 56243 56244/* */ 56245 56246 56247 56248// these keywords should not appear inside expressions, but operators like 56249// typeof, instanceof and in are allowed 56250var prohibitedKeywordRE = new RegExp('\\b' + ( 56251 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' + 56252 'super,throw,while,yield,delete,export,import,return,switch,default,' + 56253 'extends,finally,continue,debugger,function,arguments' 56254).split(',').join('\\b|\\b') + '\\b'); 56255 56256// these unary operators should not be used as property/method names 56257var unaryOperatorsRE = new RegExp('\\b' + ( 56258 'delete,typeof,void' 56259).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)'); 56260 56261// strip strings in expressions 56262var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g; 56263 56264// detect problematic expressions in a template 56265function detectErrors (ast, warn) { 56266 if (ast) { 56267 checkNode(ast, warn); 56268 } 56269} 56270 56271function checkNode (node, warn) { 56272 if (node.type === 1) { 56273 for (var name in node.attrsMap) { 56274 if (dirRE.test(name)) { 56275 var value = node.attrsMap[name]; 56276 if (value) { 56277 var range = node.rawAttrsMap[name]; 56278 if (name === 'v-for') { 56279 checkFor(node, ("v-for=\"" + value + "\""), warn, range); 56280 } else if (name === 'v-slot' || name[0] === '#') { 56281 checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range); 56282 } else if (onRE.test(name)) { 56283 checkEvent(value, (name + "=\"" + value + "\""), warn, range); 56284 } else { 56285 checkExpression(value, (name + "=\"" + value + "\""), warn, range); 56286 } 56287 } 56288 } 56289 } 56290 if (node.children) { 56291 for (var i = 0; i < node.children.length; i++) { 56292 checkNode(node.children[i], warn); 56293 } 56294 } 56295 } else if (node.type === 2) { 56296 checkExpression(node.expression, node.text, warn, node); 56297 } 56298} 56299 56300function checkEvent (exp, text, warn, range) { 56301 var stripped = exp.replace(stripStringRE, ''); 56302 var keywordMatch = stripped.match(unaryOperatorsRE); 56303 if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') { 56304 warn( 56305 "avoid using JavaScript unary operator as property name: " + 56306 "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()), 56307 range 56308 ); 56309 } 56310 checkExpression(exp, text, warn, range); 56311} 56312 56313function checkFor (node, text, warn, range) { 56314 checkExpression(node.for || '', text, warn, range); 56315 checkIdentifier(node.alias, 'v-for alias', text, warn, range); 56316 checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range); 56317 checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range); 56318} 56319 56320function checkIdentifier ( 56321 ident, 56322 type, 56323 text, 56324 warn, 56325 range 56326) { 56327 if (typeof ident === 'string') { 56328 try { 56329 new Function(("var " + ident + "=_")); 56330 } catch (e) { 56331 warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range); 56332 } 56333 } 56334} 56335 56336function checkExpression (exp, text, warn, range) { 56337 try { 56338 new Function(("return " + exp)); 56339 } catch (e) { 56340 var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE); 56341 if (keywordMatch) { 56342 warn( 56343 "avoid using JavaScript keyword as property name: " + 56344 "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()), 56345 range 56346 ); 56347 } else { 56348 warn( 56349 "invalid expression: " + (e.message) + " in\n\n" + 56350 " " + exp + "\n\n" + 56351 " Raw expression: " + (text.trim()) + "\n", 56352 range 56353 ); 56354 } 56355 } 56356} 56357 56358function checkFunctionParameterExpression (exp, text, warn, range) { 56359 try { 56360 new Function(exp, ''); 56361 } catch (e) { 56362 warn( 56363 "invalid function parameter expression: " + (e.message) + " in\n\n" + 56364 " " + exp + "\n\n" + 56365 " Raw expression: " + (text.trim()) + "\n", 56366 range 56367 ); 56368 } 56369} 56370 56371/* */ 56372 56373var range = 2; 56374 56375function generateCodeFrame ( 56376 source, 56377 start, 56378 end 56379) { 56380 if ( start === void 0 ) start = 0; 56381 if ( end === void 0 ) end = source.length; 56382 56383 var lines = source.split(/\r?\n/); 56384 var count = 0; 56385 var res = []; 56386 for (var i = 0; i < lines.length; i++) { 56387 count += lines[i].length + 1; 56388 if (count >= start) { 56389 for (var j = i - range; j <= i + range || end > count; j++) { 56390 if (j < 0 || j >= lines.length) { continue } 56391 res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j]))); 56392 var lineLength = lines[j].length; 56393 if (j === i) { 56394 // push underline 56395 var pad = start - (count - lineLength) + 1; 56396 var length = end > count ? lineLength - pad : end - start; 56397 res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length)); 56398 } else if (j > i) { 56399 if (end > count) { 56400 var length$1 = Math.min(end - count, lineLength); 56401 res.push(" | " + repeat$1("^", length$1)); 56402 } 56403 count += lineLength + 1; 56404 } 56405 } 56406 break 56407 } 56408 } 56409 return res.join('\n') 56410} 56411 56412function repeat$1 (str, n) { 56413 var result = ''; 56414 if (n > 0) { 56415 while (true) { // eslint-disable-line 56416 if (n & 1) { result += str; } 56417 n >>>= 1; 56418 if (n <= 0) { break } 56419 str += str; 56420 } 56421 } 56422 return result 56423} 56424 56425/* */ 56426 56427 56428 56429function createFunction (code, errors) { 56430 try { 56431 return new Function(code) 56432 } catch (err) { 56433 errors.push({ err: err, code: code }); 56434 return noop 56435 } 56436} 56437 56438function createCompileToFunctionFn (compile) { 56439 var cache = Object.create(null); 56440 56441 return function compileToFunctions ( 56442 template, 56443 options, 56444 vm 56445 ) { 56446 options = extend({}, options); 56447 var warn$$1 = options.warn || warn; 56448 delete options.warn; 56449 56450 /* istanbul ignore if */ 56451 { 56452 // detect possible CSP restriction 56453 try { 56454 new Function('return 1'); 56455 } catch (e) { 56456 if (e.toString().match(/unsafe-eval|CSP/)) { 56457 warn$$1( 56458 'It seems you are using the standalone build of Vue.js in an ' + 56459 'environment with Content Security Policy that prohibits unsafe-eval. ' + 56460 'The template compiler cannot work in this environment. Consider ' + 56461 'relaxing the policy to allow unsafe-eval or pre-compiling your ' + 56462 'templates into render functions.' 56463 ); 56464 } 56465 } 56466 } 56467 56468 // check cache 56469 var key = options.delimiters 56470 ? String(options.delimiters) + template 56471 : template; 56472 if (cache[key]) { 56473 return cache[key] 56474 } 56475 56476 // compile 56477 var compiled = compile(template, options); 56478 56479 // check compilation errors/tips 56480 { 56481 if (compiled.errors && compiled.errors.length) { 56482 if (options.outputSourceRange) { 56483 compiled.errors.forEach(function (e) { 56484 warn$$1( 56485 "Error compiling template:\n\n" + (e.msg) + "\n\n" + 56486 generateCodeFrame(template, e.start, e.end), 56487 vm 56488 ); 56489 }); 56490 } else { 56491 warn$$1( 56492 "Error compiling template:\n\n" + template + "\n\n" + 56493 compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n', 56494 vm 56495 ); 56496 } 56497 } 56498 if (compiled.tips && compiled.tips.length) { 56499 if (options.outputSourceRange) { 56500 compiled.tips.forEach(function (e) { return tip(e.msg, vm); }); 56501 } else { 56502 compiled.tips.forEach(function (msg) { return tip(msg, vm); }); 56503 } 56504 } 56505 } 56506 56507 // turn code into functions 56508 var res = {}; 56509 var fnGenErrors = []; 56510 res.render = createFunction(compiled.render, fnGenErrors); 56511 res.staticRenderFns = compiled.staticRenderFns.map(function (code) { 56512 return createFunction(code, fnGenErrors) 56513 }); 56514 56515 // check function generation errors. 56516 // this should only happen if there is a bug in the compiler itself. 56517 // mostly for codegen development use 56518 /* istanbul ignore if */ 56519 { 56520 if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) { 56521 warn$$1( 56522 "Failed to generate render function:\n\n" + 56523 fnGenErrors.map(function (ref) { 56524 var err = ref.err; 56525 var code = ref.code; 56526 56527 return ((err.toString()) + " in\n\n" + code + "\n"); 56528 }).join('\n'), 56529 vm 56530 ); 56531 } 56532 } 56533 56534 return (cache[key] = res) 56535 } 56536} 56537 56538/* */ 56539 56540function createCompilerCreator (baseCompile) { 56541 return function createCompiler (baseOptions) { 56542 function compile ( 56543 template, 56544 options 56545 ) { 56546 var finalOptions = Object.create(baseOptions); 56547 var errors = []; 56548 var tips = []; 56549 56550 var warn = function (msg, range, tip) { 56551 (tip ? tips : errors).push(msg); 56552 }; 56553 56554 if (options) { 56555 if (options.outputSourceRange) { 56556 // $flow-disable-line 56557 var leadingSpaceLength = template.match(/^\s*/)[0].length; 56558 56559 warn = function (msg, range, tip) { 56560 var data = { msg: msg }; 56561 if (range) { 56562 if (range.start != null) { 56563 data.start = range.start + leadingSpaceLength; 56564 } 56565 if (range.end != null) { 56566 data.end = range.end + leadingSpaceLength; 56567 } 56568 } 56569 (tip ? tips : errors).push(data); 56570 }; 56571 } 56572 // merge custom modules 56573 if (options.modules) { 56574 finalOptions.modules = 56575 (baseOptions.modules || []).concat(options.modules); 56576 } 56577 // merge custom directives 56578 if (options.directives) { 56579 finalOptions.directives = extend( 56580 Object.create(baseOptions.directives || null), 56581 options.directives 56582 ); 56583 } 56584 // copy other options 56585 for (var key in options) { 56586 if (key !== 'modules' && key !== 'directives') { 56587 finalOptions[key] = options[key]; 56588 } 56589 } 56590 } 56591 56592 finalOptions.warn = warn; 56593 56594 var compiled = baseCompile(template.trim(), finalOptions); 56595 { 56596 detectErrors(compiled.ast, warn); 56597 } 56598 compiled.errors = errors; 56599 compiled.tips = tips; 56600 return compiled 56601 } 56602 56603 return { 56604 compile: compile, 56605 compileToFunctions: createCompileToFunctionFn(compile) 56606 } 56607 } 56608} 56609 56610/* */ 56611 56612// `createCompilerCreator` allows creating compilers that use alternative 56613// parser/optimizer/codegen, e.g the SSR optimizing compiler. 56614// Here we just export a default compiler using the default parts. 56615var createCompiler = createCompilerCreator(function baseCompile ( 56616 template, 56617 options 56618) { 56619 var ast = parse(template.trim(), options); 56620 if (options.optimize !== false) { 56621 optimize(ast, options); 56622 } 56623 var code = generate(ast, options); 56624 return { 56625 ast: ast, 56626 render: code.render, 56627 staticRenderFns: code.staticRenderFns 56628 } 56629}); 56630 56631/* */ 56632 56633var ref$1 = createCompiler(baseOptions); 56634var compile = ref$1.compile; 56635var compileToFunctions = ref$1.compileToFunctions; 56636 56637/* */ 56638 56639// check whether current browser encodes a char inside attribute values 56640var div; 56641function getShouldDecode (href) { 56642 div = div || document.createElement('div'); 56643 div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>"; 56644 return div.innerHTML.indexOf(' ') > 0 56645} 56646 56647// #3663: IE encodes newlines inside attribute values while other browsers don't 56648var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false; 56649// #6828: chrome encodes content in a[href] 56650var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false; 56651 56652/* */ 56653 56654var idToTemplate = cached(function (id) { 56655 var el = query(id); 56656 return el && el.innerHTML 56657}); 56658 56659var mount = Vue.prototype.$mount; 56660Vue.prototype.$mount = function ( 56661 el, 56662 hydrating 56663) { 56664 el = el && query(el); 56665 56666 /* istanbul ignore if */ 56667 if (el === document.body || el === document.documentElement) { 56668 warn( 56669 "Do not mount Vue to <html> or <body> - mount to normal elements instead." 56670 ); 56671 return this 56672 } 56673 56674 var options = this.$options; 56675 // resolve template/el and convert to render function 56676 if (!options.render) { 56677 var template = options.template; 56678 if (template) { 56679 if (typeof template === 'string') { 56680 if (template.charAt(0) === '#') { 56681 template = idToTemplate(template); 56682 /* istanbul ignore if */ 56683 if (!template) { 56684 warn( 56685 ("Template element not found or is empty: " + (options.template)), 56686 this 56687 ); 56688 } 56689 } 56690 } else if (template.nodeType) { 56691 template = template.innerHTML; 56692 } else { 56693 { 56694 warn('invalid template option:' + template, this); 56695 } 56696 return this 56697 } 56698 } else if (el) { 56699 template = getOuterHTML(el); 56700 } 56701 if (template) { 56702 /* istanbul ignore if */ 56703 if (config.performance && mark) { 56704 mark('compile'); 56705 } 56706 56707 var ref = compileToFunctions(template, { 56708 outputSourceRange: "development" !== 'production', 56709 shouldDecodeNewlines: shouldDecodeNewlines, 56710 shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref, 56711 delimiters: options.delimiters, 56712 comments: options.comments 56713 }, this); 56714 var render = ref.render; 56715 var staticRenderFns = ref.staticRenderFns; 56716 options.render = render; 56717 options.staticRenderFns = staticRenderFns; 56718 56719 /* istanbul ignore if */ 56720 if (config.performance && mark) { 56721 mark('compile end'); 56722 measure(("vue " + (this._name) + " compile"), 'compile', 'compile end'); 56723 } 56724 } 56725 } 56726 return mount.call(this, el, hydrating) 56727}; 56728 56729/** 56730 * Get outerHTML of elements, taking care 56731 * of SVG elements in IE as well. 56732 */ 56733function getOuterHTML (el) { 56734 if (el.outerHTML) { 56735 return el.outerHTML 56736 } else { 56737 var container = document.createElement('div'); 56738 container.appendChild(el.cloneNode(true)); 56739 return container.innerHTML 56740 } 56741} 56742 56743Vue.compile = compileToFunctions; 56744 56745module.exports = Vue; 56746 56747/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate)) 56748 56749/***/ }), 56750
vendor: 434 bytes, lines 56751-56764
56751/***/ "./node_modules/vue/dist/vue.common.js": 56752/*!*********************************************!*\ 56753 !*** ./node_modules/vue/dist/vue.common.js ***! 56754 \*********************************************/ 56755/*! no static exports found */ 56756/***/ (function(module, exports, __webpack_require__) { 56757 56758if (false) {} else { 56759 module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js") 56760} 56761 56762 56763/***/ }), 56764
vendor: 721 bytes, lines 56765-56794
56765/***/ "./node_modules/webpack/buildin/global.js": 56766/*!***********************************!*\ 56767 !*** (webpack)/buildin/global.js ***! 56768 \***********************************/ 56769/*! no static exports found */ 56770/***/ (function(module, exports) { 56771 56772var g; 56773 56774// This works in non-strict mode 56775g = (function() { 56776 return this; 56777})(); 56778 56779try { 56780 // This works if eval is allowed (see CSP) 56781 g = g || new Function("return this")(); 56782} catch (e) { 56783 // This works if the window reference is available 56784 if (typeof window === "object") g = window; 56785} 56786 56787// g can still be undefined, but nothing to do about it... 56788// We return undefined, instead of nothing here, so it's 56789// easier to handle this case. if(!global) { ...} 56790 56791module.exports = g; 56792 56793 56794/***/ })
56794, 56795 56796/***/ 9: 56797/*!******************************************************************!*\ 56798 !*** multi ./Themes/Cynoebook/resources/assets/public/js/app.js ***! 56799 \******************************************************************/ 56800/*! no static exports found */ 56801/***/ (function(module, exports, __webpack_require__) { 56802 56803module.exports = __webpack_require__(/*! /var/www/www-root/data/www/yesgiantess.com/Themes/Cynoebook/resources/assets/public/js/app.js */"./Themes/Cynoebook/resources/assets/public/js/app.js"); 56804 56805 56806/***/ }) 56807 56808/******/ });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.