You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1449 lines
39 KiB

  1. /*! jQuery UI - v1.13.2 - 2022-08-16
  2. * http://jqueryui.com
  3. * Includes: widget.js, position.js, jquery-patch.js, keycode.js, scroll-parent.js, unique-id.js
  4. * Copyright jQuery Foundation and other contributors; Licensed MIT */
  5. ( function( factory ) {
  6. "use strict";
  7. if ( typeof define === "function" && define.amd ) {
  8. // AMD. Register as an anonymous module.
  9. define( [ "jquery" ], factory );
  10. } else {
  11. // Browser globals
  12. factory( jQuery );
  13. }
  14. } )( function( $ ) {
  15. "use strict";
  16. $.ui = $.ui || {};
  17. var version = $.ui.version = "1.13.2";
  18. /*!
  19. * jQuery UI Widget 1.13.2
  20. * http://jqueryui.com
  21. *
  22. * Copyright jQuery Foundation and other contributors
  23. * Released under the MIT license.
  24. * http://jquery.org/license
  25. */
  26. //>>label: Widget
  27. //>>group: Core
  28. //>>description: Provides a factory for creating stateful widgets with a common API.
  29. //>>docs: http://api.jqueryui.com/jQuery.widget/
  30. //>>demos: http://jqueryui.com/widget/
  31. var widgetUuid = 0;
  32. var widgetHasOwnProperty = Array.prototype.hasOwnProperty;
  33. var widgetSlice = Array.prototype.slice;
  34. $.cleanData = $.cleanData || ( function( orig ) {
  35. return function( elems ) {
  36. var events, elem, i;
  37. for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {
  38. // Only trigger remove when necessary to save time
  39. events = $._data( elem, "events" );
  40. if ( events && events.remove ) {
  41. $( elem ).triggerHandler( "remove" );
  42. }
  43. }
  44. orig( elems );
  45. };
  46. } )( $.cleanData );
  47. $.widget = $.widget || function( name, base, prototype ) {
  48. var existingConstructor, constructor, basePrototype;
  49. // ProxiedPrototype allows the provided prototype to remain unmodified
  50. // so that it can be used as a mixin for multiple widgets (#8876)
  51. var proxiedPrototype = {};
  52. var namespace = name.split( "." )[ 0 ];
  53. name = name.split( "." )[ 1 ];
  54. var fullName = namespace + "-" + name;
  55. if ( !prototype ) {
  56. prototype = base;
  57. base = $.Widget;
  58. }
  59. if ( Array.isArray( prototype ) ) {
  60. prototype = $.extend.apply( null, [ {} ].concat( prototype ) );
  61. }
  62. // Create selector for plugin
  63. $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {
  64. return !!$.data( elem, fullName );
  65. };
  66. $[ namespace ] = $[ namespace ] || {};
  67. existingConstructor = $[ namespace ][ name ];
  68. constructor = $[ namespace ][ name ] = function( options, element ) {
  69. // Allow instantiation without "new" keyword
  70. if ( !this || !this._createWidget ) {
  71. return new constructor( options, element );
  72. }
  73. // Allow instantiation without initializing for simple inheritance
  74. // must use "new" keyword (the code above always passes args)
  75. if ( arguments.length ) {
  76. this._createWidget( options, element );
  77. }
  78. };
  79. // Extend with the existing constructor to carry over any static properties
  80. $.extend( constructor, existingConstructor, {
  81. version: prototype.version,
  82. // Copy the object used to create the prototype in case we need to
  83. // redefine the widget later
  84. _proto: $.extend( {}, prototype ),
  85. // Track widgets that inherit from this widget in case this widget is
  86. // redefined after a widget inherits from it
  87. _childConstructors: []
  88. } );
  89. basePrototype = new base();
  90. // We need to make the options hash a property directly on the new instance
  91. // otherwise we'll modify the options hash on the prototype that we're
  92. // inheriting from
  93. basePrototype.options = $.widget.extend( {}, basePrototype.options );
  94. $.each( prototype, function( prop, value ) {
  95. if ( typeof value !== "function" ) {
  96. proxiedPrototype[ prop ] = value;
  97. return;
  98. }
  99. proxiedPrototype[ prop ] = ( function() {
  100. function _super() {
  101. return base.prototype[ prop ].apply( this, arguments );
  102. }
  103. function _superApply( args ) {
  104. return base.prototype[ prop ].apply( this, args );
  105. }
  106. return function() {
  107. var __super = this._super;
  108. var __superApply = this._superApply;
  109. var returnValue;
  110. this._super = _super;
  111. this._superApply = _superApply;
  112. returnValue = value.apply( this, arguments );
  113. this._super = __super;
  114. this._superApply = __superApply;
  115. return returnValue;
  116. };
  117. } )();
  118. } );
  119. constructor.prototype = $.widget.extend( basePrototype, {
  120. // TODO: remove support for widgetEventPrefix
  121. // always use the name + a colon as the prefix, e.g., draggable:start
  122. // don't prefix for widgets that aren't DOM-based
  123. widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name
  124. }, proxiedPrototype, {
  125. constructor: constructor,
  126. namespace: namespace,
  127. widgetName: name,
  128. widgetFullName: fullName
  129. } );
  130. // If this widget is being redefined then we need to find all widgets that
  131. // are inheriting from it and redefine all of them so that they inherit from
  132. // the new version of this widget. We're essentially trying to replace one
  133. // level in the prototype chain.
  134. if ( existingConstructor ) {
  135. $.each( existingConstructor._childConstructors, function( i, child ) {
  136. var childPrototype = child.prototype;
  137. // Redefine the child widget using the same prototype that was
  138. // originally used, but inherit from the new version of the base
  139. $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,
  140. child._proto );
  141. } );
  142. // Remove the list of existing child constructors from the old constructor
  143. // so the old child constructors can be garbage collected
  144. delete existingConstructor._childConstructors;
  145. } else {
  146. base._childConstructors.push( constructor );
  147. }
  148. $.widget.bridge( name, constructor );
  149. return constructor;
  150. };
  151. $.widget.extend = function( target ) {
  152. var input = widgetSlice.call( arguments, 1 );
  153. var inputIndex = 0;
  154. var inputLength = input.length;
  155. var key;
  156. var value;
  157. for ( ; inputIndex < inputLength; inputIndex++ ) {
  158. for ( key in input[ inputIndex ] ) {
  159. value = input[ inputIndex ][ key ];
  160. if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {
  161. // Clone objects
  162. if ( $.isPlainObject( value ) ) {
  163. target[ key ] = $.isPlainObject( target[ key ] ) ?
  164. $.widget.extend( {}, target[ key ], value ) :
  165. // Don't extend strings, arrays, etc. with objects
  166. $.widget.extend( {}, value );
  167. // Copy everything else by reference
  168. } else {
  169. target[ key ] = value;
  170. }
  171. }
  172. }
  173. }
  174. return target;
  175. };
  176. $.widget.bridge = function( name, object ) {
  177. var fullName = object.prototype.widgetFullName || name;
  178. $.fn[ name ] = function( options ) {
  179. var isMethodCall = typeof options === "string";
  180. var args = widgetSlice.call( arguments, 1 );
  181. var returnValue = this;
  182. if ( isMethodCall ) {
  183. // If this is an empty collection, we need to have the instance method
  184. // return undefined instead of the jQuery instance
  185. if ( !this.length && options === "instance" ) {
  186. returnValue = undefined;
  187. } else {
  188. this.each( function() {
  189. var methodValue;
  190. var instance = $.data( this, fullName );
  191. if ( options === "instance" ) {
  192. returnValue = instance;
  193. return false;
  194. }
  195. if ( !instance ) {
  196. return $.error( "cannot call methods on " + name +
  197. " prior to initialization; " +
  198. "attempted to call method '" + options + "'" );
  199. }
  200. if ( typeof instance[ options ] !== "function" ||
  201. options.charAt( 0 ) === "_" ) {
  202. return $.error( "no such method '" + options + "' for " + name +
  203. " widget instance" );
  204. }
  205. methodValue = instance[ options ].apply( instance, args );
  206. if ( methodValue !== instance && methodValue !== undefined ) {
  207. returnValue = methodValue && methodValue.jquery ?
  208. returnValue.pushStack( methodValue.get() ) :
  209. methodValue;
  210. return false;
  211. }
  212. } );
  213. }
  214. } else {
  215. // Allow multiple hashes to be passed on init
  216. if ( args.length ) {
  217. options = $.widget.extend.apply( null, [ options ].concat( args ) );
  218. }
  219. this.each( function() {
  220. var instance = $.data( this, fullName );
  221. if ( instance ) {
  222. instance.option( options || {} );
  223. if ( instance._init ) {
  224. instance._init();
  225. }
  226. } else {
  227. $.data( this, fullName, new object( options, this ) );
  228. }
  229. } );
  230. }
  231. return returnValue;
  232. };
  233. };
  234. $.Widget = $.Widget || function( /* options, element */ ) {};
  235. $.Widget._childConstructors = [];
  236. $.Widget.prototype = {
  237. widgetName: "widget",
  238. widgetEventPrefix: "",
  239. defaultElement: "<div>",
  240. options: {
  241. classes: {},
  242. disabled: false,
  243. // Callbacks
  244. create: null
  245. },
  246. _createWidget: function( options, element ) {
  247. element = $( element || this.defaultElement || this )[ 0 ];
  248. this.element = $( element );
  249. this.uuid = widgetUuid++;
  250. this.eventNamespace = "." + this.widgetName + this.uuid;
  251. this.bindings = $();
  252. this.hoverable = $();
  253. this.focusable = $();
  254. this.classesElementLookup = {};
  255. if ( element !== this ) {
  256. $.data( element, this.widgetFullName, this );
  257. this._on( true, this.element, {
  258. remove: function( event ) {
  259. if ( event.target === element ) {
  260. this.destroy();
  261. }
  262. }
  263. } );
  264. this.document = $( element.style ?
  265. // Element within the document
  266. element.ownerDocument :
  267. // Element is window or document
  268. element.document || element );
  269. this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );
  270. }
  271. this.options = $.widget.extend( {},
  272. this.options,
  273. this._getCreateOptions(),
  274. options );
  275. this._create();
  276. if ( this.options.disabled ) {
  277. this._setOptionDisabled( this.options.disabled );
  278. }
  279. this._trigger( "create", null, this._getCreateEventData() );
  280. this._init();
  281. },
  282. _getCreateOptions: function() {
  283. return {};
  284. },
  285. _getCreateEventData: $.noop,
  286. _create: $.noop,
  287. _init: $.noop,
  288. destroy: function() {
  289. var that = this;
  290. this._destroy();
  291. $.each( this.classesElementLookup, function( key, value ) {
  292. that._removeClass( value, key );
  293. } );
  294. // We can probably remove the unbind calls in 2.0
  295. // all event bindings should go through this._on()
  296. this.element
  297. .off( this.eventNamespace )
  298. .removeData( this.widgetFullName );
  299. this.widget()
  300. .off( this.eventNamespace )
  301. .removeAttr( "aria-disabled" );
  302. // Clean up events and states
  303. this.bindings.off( this.eventNamespace );
  304. },
  305. _destroy: $.noop,
  306. widget: function() {
  307. return this.element;
  308. },
  309. option: function( key, value ) {
  310. var options = key;
  311. var parts;
  312. var curOption;
  313. var i;
  314. if ( arguments.length === 0 ) {
  315. // Don't return a reference to the internal hash
  316. return $.widget.extend( {}, this.options );
  317. }
  318. if ( typeof key === "string" ) {
  319. // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
  320. options = {};
  321. parts = key.split( "." );
  322. key = parts.shift();
  323. if ( parts.length ) {
  324. curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
  325. for ( i = 0; i < parts.length - 1; i++ ) {
  326. curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
  327. curOption = curOption[ parts[ i ] ];
  328. }
  329. key = parts.pop();
  330. if ( arguments.length === 1 ) {
  331. return curOption[ key ] === undefined ? null : curOption[ key ];
  332. }
  333. curOption[ key ] = value;
  334. } else {
  335. if ( arguments.length === 1 ) {
  336. return this.options[ key ] === undefined ? null : this.options[ key ];
  337. }
  338. options[ key ] = value;
  339. }
  340. }
  341. this._setOptions( options );
  342. return this;
  343. },
  344. _setOptions: function( options ) {
  345. var key;
  346. for ( key in options ) {
  347. this._setOption( key, options[ key ] );
  348. }
  349. return this;
  350. },
  351. _setOption: function( key, value ) {
  352. if ( key === "classes" ) {
  353. this._setOptionClasses( value );
  354. }
  355. this.options[ key ] = value;
  356. if ( key === "disabled" ) {
  357. this._setOptionDisabled( value );
  358. }
  359. return this;
  360. },
  361. _setOptionClasses: function( value ) {
  362. var classKey, elements, currentElements;
  363. for ( classKey in value ) {
  364. currentElements = this.classesElementLookup[ classKey ];
  365. if ( value[ classKey ] === this.options.classes[ classKey ] ||
  366. !currentElements ||
  367. !currentElements.length ) {
  368. continue;
  369. }
  370. // We are doing this to create a new jQuery object because the _removeClass() call
  371. // on the next line is going to destroy the reference to the current elements being
  372. // tracked. We need to save a copy of this collection so that we can add the new classes
  373. // below.
  374. elements = $( currentElements.get() );
  375. this._removeClass( currentElements, classKey );
  376. // We don't use _addClass() here, because that uses this.options.classes
  377. // for generating the string of classes. We want to use the value passed in from
  378. // _setOption(), this is the new value of the classes option which was passed to
  379. // _setOption(). We pass this value directly to _classes().
  380. elements.addClass( this._classes( {
  381. element: elements,
  382. keys: classKey,
  383. classes: value,
  384. add: true
  385. } ) );
  386. }
  387. },
  388. _setOptionDisabled: function( value ) {
  389. this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );
  390. // If the widget is becoming disabled, then nothing is interactive
  391. if ( value ) {
  392. this._removeClass( this.hoverable, null, "ui-state-hover" );
  393. this._removeClass( this.focusable, null, "ui-state-focus" );
  394. }
  395. },
  396. enable: function() {
  397. return this._setOptions( { disabled: false } );
  398. },
  399. disable: function() {
  400. return this._setOptions( { disabled: true } );
  401. },
  402. _classes: function( options ) {
  403. var full = [];
  404. var that = this;
  405. options = $.extend( {
  406. element: this.element,
  407. classes: this.options.classes || {}
  408. }, options );
  409. function bindRemoveEvent() {
  410. var nodesToBind = [];
  411. options.element.each( function( _, element ) {
  412. var isTracked = $.map( that.classesElementLookup, function( elements ) {
  413. return elements;
  414. } )
  415. .some( function( elements ) {
  416. return elements.is( element );
  417. } );
  418. if ( !isTracked ) {
  419. nodesToBind.push( element );
  420. }
  421. } );
  422. that._on( $( nodesToBind ), {
  423. remove: "_untrackClassesElement"
  424. } );
  425. }
  426. function processClassString( classes, checkOption ) {
  427. var current, i;
  428. for ( i = 0; i < classes.length; i++ ) {
  429. current = that.classesElementLookup[ classes[ i ] ] || $();
  430. if ( options.add ) {
  431. bindRemoveEvent();
  432. current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );
  433. } else {
  434. current = $( current.not( options.element ).get() );
  435. }
  436. that.classesElementLookup[ classes[ i ] ] = current;
  437. full.push( classes[ i ] );
  438. if ( checkOption && options.classes[ classes[ i ] ] ) {
  439. full.push( options.classes[ classes[ i ] ] );
  440. }
  441. }
  442. }
  443. if ( options.keys ) {
  444. processClassString( options.keys.match( /\S+/g ) || [], true );
  445. }
  446. if ( options.extra ) {
  447. processClassString( options.extra.match( /\S+/g ) || [] );
  448. }
  449. return full.join( " " );
  450. },
  451. _untrackClassesElement: function( event ) {
  452. var that = this;
  453. $.each( that.classesElementLookup, function( key, value ) {
  454. if ( $.inArray( event.target, value ) !== -1 ) {
  455. that.classesElementLookup[ key ] = $( value.not( event.target ).get() );
  456. }
  457. } );
  458. this._off( $( event.target ) );
  459. },
  460. _removeClass: function( element, keys, extra ) {
  461. return this._toggleClass( element, keys, extra, false );
  462. },
  463. _addClass: function( element, keys, extra ) {
  464. return this._toggleClass( element, keys, extra, true );
  465. },
  466. _toggleClass: function( element, keys, extra, add ) {
  467. add = ( typeof add === "boolean" ) ? add : extra;
  468. var shift = ( typeof element === "string" || element === null ),
  469. options = {
  470. extra: shift ? keys : extra,
  471. keys: shift ? element : keys,
  472. element: shift ? this.element : element,
  473. add: add
  474. };
  475. options.element.toggleClass( this._classes( options ), add );
  476. return this;
  477. },
  478. _on: function( suppressDisabledCheck, element, handlers ) {
  479. var delegateElement;
  480. var instance = this;
  481. // No suppressDisabledCheck flag, shuffle arguments
  482. if ( typeof suppressDisabledCheck !== "boolean" ) {
  483. handlers = element;
  484. element = suppressDisabledCheck;
  485. suppressDisabledCheck = false;
  486. }
  487. // No element argument, shuffle and use this.element
  488. if ( !handlers ) {
  489. handlers = element;
  490. element = this.element;
  491. delegateElement = this.widget();
  492. } else {
  493. element = delegateElement = $( element );
  494. this.bindings = this.bindings.add( element );
  495. }
  496. $.each( handlers, function( event, handler ) {
  497. function handlerProxy() {
  498. // Allow widgets to customize the disabled handling
  499. // - disabled as an array instead of boolean
  500. // - disabled class as method for disabling individual parts
  501. if ( !suppressDisabledCheck &&
  502. ( instance.options.disabled === true ||
  503. $( this ).hasClass( "ui-state-disabled" ) ) ) {
  504. return;
  505. }
  506. return ( typeof handler === "string" ? instance[ handler ] : handler )
  507. .apply( instance, arguments );
  508. }
  509. // Copy the guid so direct unbinding works
  510. if ( typeof handler !== "string" ) {
  511. handlerProxy.guid = handler.guid =
  512. handler.guid || handlerProxy.guid || $.guid++;
  513. }
  514. var match = event.match( /^([\w:-]*)\s*(.*)$/ );
  515. var eventName = match[ 1 ] + instance.eventNamespace;
  516. var selector = match[ 2 ];
  517. if ( selector ) {
  518. delegateElement.on( eventName, selector, handlerProxy );
  519. } else {
  520. element.on( eventName, handlerProxy );
  521. }
  522. } );
  523. },
  524. _off: function( element, eventName ) {
  525. eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +
  526. this.eventNamespace;
  527. element.off( eventName );
  528. // Clear the stack to avoid memory leaks (#10056)
  529. this.bindings = $( this.bindings.not( element ).get() );
  530. this.focusable = $( this.focusable.not( element ).get() );
  531. this.hoverable = $( this.hoverable.not( element ).get() );
  532. },
  533. _delay: function( handler, delay ) {
  534. function handlerProxy() {
  535. return ( typeof handler === "string" ? instance[ handler ] : handler )
  536. .apply( instance, arguments );
  537. }
  538. var instance = this;
  539. return setTimeout( handlerProxy, delay || 0 );
  540. },
  541. _hoverable: function( element ) {
  542. this.hoverable = this.hoverable.add( element );
  543. this._on( element, {
  544. mouseenter: function( event ) {
  545. this._addClass( $( event.currentTarget ), null, "ui-state-hover" );
  546. },
  547. mouseleave: function( event ) {
  548. this._removeClass( $( event.currentTarget ), null, "ui-state-hover" );
  549. }
  550. } );
  551. },
  552. _focusable: function( element ) {
  553. this.focusable = this.focusable.add( element );
  554. this._on( element, {
  555. focusin: function( event ) {
  556. this._addClass( $( event.currentTarget ), null, "ui-state-focus" );
  557. },
  558. focusout: function( event ) {
  559. this._removeClass( $( event.currentTarget ), null, "ui-state-focus" );
  560. }
  561. } );
  562. },
  563. _trigger: function( type, event, data ) {
  564. var prop, orig;
  565. var callback = this.options[ type ];
  566. data = data || {};
  567. event = $.Event( event );
  568. event.type = ( type === this.widgetEventPrefix ?
  569. type :
  570. this.widgetEventPrefix + type ).toLowerCase();
  571. // The original event may come from any element
  572. // so we need to reset the target on the new event
  573. event.target = this.element[ 0 ];
  574. // Copy original event properties over to the new event
  575. orig = event.originalEvent;
  576. if ( orig ) {
  577. for ( prop in orig ) {
  578. if ( !( prop in event ) ) {
  579. event[ prop ] = orig[ prop ];
  580. }
  581. }
  582. }
  583. this.element.trigger( event, data );
  584. return !( typeof callback === "function" &&
  585. callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||
  586. event.isDefaultPrevented() );
  587. }
  588. };
  589. $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
  590. $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
  591. if ( typeof options === "string" ) {
  592. options = { effect: options };
  593. }
  594. var hasOptions;
  595. var effectName = !options ?
  596. method :
  597. options === true || typeof options === "number" ?
  598. defaultEffect :
  599. options.effect || defaultEffect;
  600. options = options || {};
  601. if ( typeof options === "number" ) {
  602. options = { duration: options };
  603. } else if ( options === true ) {
  604. options = {};
  605. }
  606. hasOptions = !$.isEmptyObject( options );
  607. options.complete = callback;
  608. if ( options.delay ) {
  609. element.delay( options.delay );
  610. }
  611. if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
  612. element[ method ]( options );
  613. } else if ( effectName !== method && element[ effectName ] ) {
  614. element[ effectName ]( options.duration, options.easing, callback );
  615. } else {
  616. element.queue( function( next ) {
  617. $( this )[ method ]();
  618. if ( callback ) {
  619. callback.call( element[ 0 ] );
  620. }
  621. next();
  622. } );
  623. }
  624. };
  625. } );
  626. var widget = $.widget;
  627. /*!
  628. * jQuery UI Position 1.13.2
  629. * http://jqueryui.com
  630. *
  631. * Copyright jQuery Foundation and other contributors
  632. * Released under the MIT license.
  633. * http://jquery.org/license
  634. *
  635. * http://api.jqueryui.com/position/
  636. */
  637. //>>label: Position
  638. //>>group: Core
  639. //>>description: Positions elements relative to other elements.
  640. //>>docs: http://api.jqueryui.com/position/
  641. //>>demos: http://jqueryui.com/position/
  642. ( function() {
  643. var cachedScrollbarWidth,
  644. max = Math.max,
  645. abs = Math.abs,
  646. rhorizontal = /left|center|right/,
  647. rvertical = /top|center|bottom/,
  648. roffset = /[\+\-]\d+(\.[\d]+)?%?/,
  649. rposition = /^\w+/,
  650. rpercent = /%$/,
  651. _position = $.fn.position;
  652. function getOffsets( offsets, width, height ) {
  653. return [
  654. parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
  655. parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
  656. ];
  657. }
  658. function parseCss( element, property ) {
  659. return parseInt( $.css( element, property ), 10 ) || 0;
  660. }
  661. function isWindow( obj ) {
  662. return obj != null && obj === obj.window;
  663. }
  664. function getDimensions( elem ) {
  665. var raw = elem[ 0 ];
  666. if ( raw.nodeType === 9 ) {
  667. return {
  668. width: elem.width(),
  669. height: elem.height(),
  670. offset: { top: 0, left: 0 }
  671. };
  672. }
  673. if ( isWindow( raw ) ) {
  674. return {
  675. width: elem.width(),
  676. height: elem.height(),
  677. offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
  678. };
  679. }
  680. if ( raw.preventDefault ) {
  681. return {
  682. width: 0,
  683. height: 0,
  684. offset: { top: raw.pageY, left: raw.pageX }
  685. };
  686. }
  687. return {
  688. width: elem.outerWidth(),
  689. height: elem.outerHeight(),
  690. offset: elem.offset()
  691. };
  692. }
  693. $.position = $.position || {
  694. scrollbarWidth: function() {
  695. if ( cachedScrollbarWidth !== undefined ) {
  696. return cachedScrollbarWidth;
  697. }
  698. var w1, w2,
  699. div = $( "<div style=" +
  700. "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" +
  701. "<div style='height:300px;width:auto;'></div></div>" ),
  702. innerDiv = div.children()[ 0 ];
  703. $( "body" ).append( div );
  704. w1 = innerDiv.offsetWidth;
  705. div.css( "overflow", "scroll" );
  706. w2 = innerDiv.offsetWidth;
  707. if ( w1 === w2 ) {
  708. w2 = div[ 0 ].clientWidth;
  709. }
  710. div.remove();
  711. return ( cachedScrollbarWidth = w1 - w2 );
  712. },
  713. getScrollInfo: function( within ) {
  714. var overflowX = within.isWindow || within.isDocument ? "" :
  715. within.element.css( "overflow-x" ),
  716. overflowY = within.isWindow || within.isDocument ? "" :
  717. within.element.css( "overflow-y" ),
  718. hasOverflowX = overflowX === "scroll" ||
  719. ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ),
  720. hasOverflowY = overflowY === "scroll" ||
  721. ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight );
  722. return {
  723. width: hasOverflowY ? $.position.scrollbarWidth() : 0,
  724. height: hasOverflowX ? $.position.scrollbarWidth() : 0
  725. };
  726. },
  727. getWithinInfo: function( element ) {
  728. var withinElement = $( element || window ),
  729. isElemWindow = isWindow( withinElement[ 0 ] ),
  730. isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9,
  731. hasOffset = !isElemWindow && !isDocument;
  732. return {
  733. element: withinElement,
  734. isWindow: isElemWindow,
  735. isDocument: isDocument,
  736. offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 },
  737. scrollLeft: withinElement.scrollLeft(),
  738. scrollTop: withinElement.scrollTop(),
  739. width: withinElement.outerWidth(),
  740. height: withinElement.outerHeight()
  741. };
  742. }
  743. };
  744. $.fn.position = function( options ) {
  745. if ( !options || !options.of ) {
  746. return _position.apply( this, arguments );
  747. }
  748. // Make a copy, we don't want to modify arguments
  749. options = $.extend( {}, options );
  750. var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
  751. // Make sure string options are treated as CSS selectors
  752. target = typeof options.of === "string" ?
  753. $( document ).find( options.of ) :
  754. $( options.of ),
  755. within = $.position.getWithinInfo( options.within ),
  756. scrollInfo = $.position.getScrollInfo( within ),
  757. collision = ( options.collision || "flip" ).split( " " ),
  758. offsets = {};
  759. dimensions = getDimensions( target );
  760. if ( target[ 0 ].preventDefault ) {
  761. // Force left top to allow flipping
  762. options.at = "left top";
  763. }
  764. targetWidth = dimensions.width;
  765. targetHeight = dimensions.height;
  766. targetOffset = dimensions.offset;
  767. // Clone to reuse original targetOffset later
  768. basePosition = $.extend( {}, targetOffset );
  769. // Force my and at to have valid horizontal and vertical positions
  770. // if a value is missing or invalid, it will be converted to center
  771. $.each( [ "my", "at" ], function() {
  772. var pos = ( options[ this ] || "" ).split( " " ),
  773. horizontalOffset,
  774. verticalOffset;
  775. if ( pos.length === 1 ) {
  776. pos = rhorizontal.test( pos[ 0 ] ) ?
  777. pos.concat( [ "center" ] ) :
  778. rvertical.test( pos[ 0 ] ) ?
  779. [ "center" ].concat( pos ) :
  780. [ "center", "center" ];
  781. }
  782. pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
  783. pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
  784. // Calculate offsets
  785. horizontalOffset = roffset.exec( pos[ 0 ] );
  786. verticalOffset = roffset.exec( pos[ 1 ] );
  787. offsets[ this ] = [
  788. horizontalOffset ? horizontalOffset[ 0 ] : 0,
  789. verticalOffset ? verticalOffset[ 0 ] : 0
  790. ];
  791. // Reduce to just the positions without the offsets
  792. options[ this ] = [
  793. rposition.exec( pos[ 0 ] )[ 0 ],
  794. rposition.exec( pos[ 1 ] )[ 0 ]
  795. ];
  796. } );
  797. // Normalize collision option
  798. if ( collision.length === 1 ) {
  799. collision[ 1 ] = collision[ 0 ];
  800. }
  801. if ( options.at[ 0 ] === "right" ) {
  802. basePosition.left += targetWidth;
  803. } else if ( options.at[ 0 ] === "center" ) {
  804. basePosition.left += targetWidth / 2;
  805. }
  806. if ( options.at[ 1 ] === "bottom" ) {
  807. basePosition.top += targetHeight;
  808. } else if ( options.at[ 1 ] === "center" ) {
  809. basePosition.top += targetHeight / 2;
  810. }
  811. atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
  812. basePosition.left += atOffset[ 0 ];
  813. basePosition.top += atOffset[ 1 ];
  814. return this.each( function() {
  815. var collisionPosition, using,
  816. elem = $( this ),
  817. elemWidth = elem.outerWidth(),
  818. elemHeight = elem.outerHeight(),
  819. marginLeft = parseCss( this, "marginLeft" ),
  820. marginTop = parseCss( this, "marginTop" ),
  821. collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) +
  822. scrollInfo.width,
  823. collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) +
  824. scrollInfo.height,
  825. position = $.extend( {}, basePosition ),
  826. myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
  827. if ( options.my[ 0 ] === "right" ) {
  828. position.left -= elemWidth;
  829. } else if ( options.my[ 0 ] === "center" ) {
  830. position.left -= elemWidth / 2;
  831. }
  832. if ( options.my[ 1 ] === "bottom" ) {
  833. position.top -= elemHeight;
  834. } else if ( options.my[ 1 ] === "center" ) {
  835. position.top -= elemHeight / 2;
  836. }
  837. position.left += myOffset[ 0 ];
  838. position.top += myOffset[ 1 ];
  839. collisionPosition = {
  840. marginLeft: marginLeft,
  841. marginTop: marginTop
  842. };
  843. $.each( [ "left", "top" ], function( i, dir ) {
  844. if ( $.ui.position[ collision[ i ] ] ) {
  845. $.ui.position[ collision[ i ] ][ dir ]( position, {
  846. targetWidth: targetWidth,
  847. targetHeight: targetHeight,
  848. elemWidth: elemWidth,
  849. elemHeight: elemHeight,
  850. collisionPosition: collisionPosition,
  851. collisionWidth: collisionWidth,
  852. collisionHeight: collisionHeight,
  853. offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
  854. my: options.my,
  855. at: options.at,
  856. within: within,
  857. elem: elem
  858. } );
  859. }
  860. } );
  861. if ( options.using ) {
  862. // Adds feedback as second argument to using callback, if present
  863. using = function( props ) {
  864. var left = targetOffset.left - position.left,
  865. right = left + targetWidth - elemWidth,
  866. top = targetOffset.top - position.top,
  867. bottom = top + targetHeight - elemHeight,
  868. feedback = {
  869. target: {
  870. element: target,
  871. left: targetOffset.left,
  872. top: targetOffset.top,
  873. width: targetWidth,
  874. height: targetHeight
  875. },
  876. element: {
  877. element: elem,
  878. left: position.left,
  879. top: position.top,
  880. width: elemWidth,
  881. height: elemHeight
  882. },
  883. horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
  884. vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
  885. };
  886. if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
  887. feedback.horizontal = "center";
  888. }
  889. if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
  890. feedback.vertical = "middle";
  891. }
  892. if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
  893. feedback.important = "horizontal";
  894. } else {
  895. feedback.important = "vertical";
  896. }
  897. options.using.call( this, props, feedback );
  898. };
  899. }
  900. elem.offset( $.extend( position, { using: using } ) );
  901. } );
  902. };
  903. $.ui.position = {
  904. fit: {
  905. left: function( position, data ) {
  906. var within = data.within,
  907. withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
  908. outerWidth = within.width,
  909. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  910. overLeft = withinOffset - collisionPosLeft,
  911. overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
  912. newOverRight;
  913. // Element is wider than within
  914. if ( data.collisionWidth > outerWidth ) {
  915. // Element is initially over the left side of within
  916. if ( overLeft > 0 && overRight <= 0 ) {
  917. newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
  918. withinOffset;
  919. position.left += overLeft - newOverRight;
  920. // Element is initially over right side of within
  921. } else if ( overRight > 0 && overLeft <= 0 ) {
  922. position.left = withinOffset;
  923. // Element is initially over both left and right sides of within
  924. } else {
  925. if ( overLeft > overRight ) {
  926. position.left = withinOffset + outerWidth - data.collisionWidth;
  927. } else {
  928. position.left = withinOffset;
  929. }
  930. }
  931. // Too far left -> align with left edge
  932. } else if ( overLeft > 0 ) {
  933. position.left += overLeft;
  934. // Too far right -> align with right edge
  935. } else if ( overRight > 0 ) {
  936. position.left -= overRight;
  937. // Adjust based on position and margin
  938. } else {
  939. position.left = max( position.left - collisionPosLeft, position.left );
  940. }
  941. },
  942. top: function( position, data ) {
  943. var within = data.within,
  944. withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
  945. outerHeight = data.within.height,
  946. collisionPosTop = position.top - data.collisionPosition.marginTop,
  947. overTop = withinOffset - collisionPosTop,
  948. overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
  949. newOverBottom;
  950. // Element is taller than within
  951. if ( data.collisionHeight > outerHeight ) {
  952. // Element is initially over the top of within
  953. if ( overTop > 0 && overBottom <= 0 ) {
  954. newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
  955. withinOffset;
  956. position.top += overTop - newOverBottom;
  957. // Element is initially over bottom of within
  958. } else if ( overBottom > 0 && overTop <= 0 ) {
  959. position.top = withinOffset;
  960. // Element is initially over both top and bottom of within
  961. } else {
  962. if ( overTop > overBottom ) {
  963. position.top = withinOffset + outerHeight - data.collisionHeight;
  964. } else {
  965. position.top = withinOffset;
  966. }
  967. }
  968. // Too far up -> align with top
  969. } else if ( overTop > 0 ) {
  970. position.top += overTop;
  971. // Too far down -> align with bottom edge
  972. } else if ( overBottom > 0 ) {
  973. position.top -= overBottom;
  974. // Adjust based on position and margin
  975. } else {
  976. position.top = max( position.top - collisionPosTop, position.top );
  977. }
  978. }
  979. },
  980. flip: {
  981. left: function( position, data ) {
  982. var within = data.within,
  983. withinOffset = within.offset.left + within.scrollLeft,
  984. outerWidth = within.width,
  985. offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
  986. collisionPosLeft = position.left - data.collisionPosition.marginLeft,
  987. overLeft = collisionPosLeft - offsetLeft,
  988. overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
  989. myOffset = data.my[ 0 ] === "left" ?
  990. -data.elemWidth :
  991. data.my[ 0 ] === "right" ?
  992. data.elemWidth :
  993. 0,
  994. atOffset = data.at[ 0 ] === "left" ?
  995. data.targetWidth :
  996. data.at[ 0 ] === "right" ?
  997. -data.targetWidth :
  998. 0,
  999. offset = -2 * data.offset[ 0 ],
  1000. newOverRight,
  1001. newOverLeft;
  1002. if ( overLeft < 0 ) {
  1003. newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
  1004. outerWidth - withinOffset;
  1005. if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
  1006. position.left += myOffset + atOffset + offset;
  1007. }
  1008. } else if ( overRight > 0 ) {
  1009. newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
  1010. atOffset + offset - offsetLeft;
  1011. if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
  1012. position.left += myOffset + atOffset + offset;
  1013. }
  1014. }
  1015. },
  1016. top: function( position, data ) {
  1017. var within = data.within,
  1018. withinOffset = within.offset.top + within.scrollTop,
  1019. outerHeight = within.height,
  1020. offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
  1021. collisionPosTop = position.top - data.collisionPosition.marginTop,
  1022. overTop = collisionPosTop - offsetTop,
  1023. overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
  1024. top = data.my[ 1 ] === "top",
  1025. myOffset = top ?
  1026. -data.elemHeight :
  1027. data.my[ 1 ] === "bottom" ?
  1028. data.elemHeight :
  1029. 0,
  1030. atOffset = data.at[ 1 ] === "top" ?
  1031. data.targetHeight :
  1032. data.at[ 1 ] === "bottom" ?
  1033. -data.targetHeight :
  1034. 0,
  1035. offset = -2 * data.offset[ 1 ],
  1036. newOverTop,
  1037. newOverBottom;
  1038. if ( overTop < 0 ) {
  1039. newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
  1040. outerHeight - withinOffset;
  1041. if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) {
  1042. position.top += myOffset + atOffset + offset;
  1043. }
  1044. } else if ( overBottom > 0 ) {
  1045. newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
  1046. offset - offsetTop;
  1047. if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) {
  1048. position.top += myOffset + atOffset + offset;
  1049. }
  1050. }
  1051. }
  1052. },
  1053. flipfit: {
  1054. left: function() {
  1055. $.ui.position.flip.left.apply( this, arguments );
  1056. $.ui.position.fit.left.apply( this, arguments );
  1057. },
  1058. top: function() {
  1059. $.ui.position.flip.top.apply( this, arguments );
  1060. $.ui.position.fit.top.apply( this, arguments );
  1061. }
  1062. }
  1063. };
  1064. } )();
  1065. var position = $.ui.position;
  1066. /*!
  1067. * jQuery UI Support for jQuery core 1.8.x and newer 1.13.2
  1068. * http://jqueryui.com
  1069. *
  1070. * Copyright jQuery Foundation and other contributors
  1071. * Released under the MIT license.
  1072. * http://jquery.org/license
  1073. *
  1074. */
  1075. //>>label: jQuery 1.8+ Support
  1076. //>>group: Core
  1077. //>>description: Support version 1.8.x and newer of jQuery core
  1078. // Support: jQuery 1.9.x or older
  1079. // $.expr[ ":" ] is deprecated.
  1080. if ( !$.expr.pseudos ) {
  1081. $.expr.pseudos = $.expr[ ":" ];
  1082. }
  1083. // Support: jQuery 1.11.x or older
  1084. // $.unique has been renamed to $.uniqueSort
  1085. if ( !$.uniqueSort ) {
  1086. $.uniqueSort = $.unique;
  1087. }
  1088. // Support: jQuery 2.2.x or older.
  1089. // This method has been defined in jQuery 3.0.0.
  1090. // Code from https://github.com/jquery/jquery/blob/e539bac79e666bba95bba86d690b4e609dca2286/src/selector/escapeSelector.js
  1091. if ( !$.escapeSelector ) {
  1092. // CSS string/identifier serialization
  1093. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  1094. var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  1095. var fcssescape = function( ch, asCodePoint ) {
  1096. if ( asCodePoint ) {
  1097. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  1098. if ( ch === "\0" ) {
  1099. return "\uFFFD";
  1100. }
  1101. // Control characters and (dependent upon position) numbers get escaped as code points
  1102. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  1103. }
  1104. // Other potentially-special ASCII characters get backslash-escaped
  1105. return "\\" + ch;
  1106. };
  1107. $.escapeSelector = function( sel ) {
  1108. return ( sel + "" ).replace( rcssescape, fcssescape );
  1109. };
  1110. }
  1111. // Support: jQuery 3.4.x or older
  1112. // These methods have been defined in jQuery 3.5.0.
  1113. if ( !$.fn.even || !$.fn.odd ) {
  1114. $.fn.extend( {
  1115. even: function() {
  1116. return this.filter( function( i ) {
  1117. return i % 2 === 0;
  1118. } );
  1119. },
  1120. odd: function() {
  1121. return this.filter( function( i ) {
  1122. return i % 2 === 1;
  1123. } );
  1124. }
  1125. } );
  1126. }
  1127. ;
  1128. /*!
  1129. * jQuery UI Keycode 1.13.2
  1130. * http://jqueryui.com
  1131. *
  1132. * Copyright jQuery Foundation and other contributors
  1133. * Released under the MIT license.
  1134. * http://jquery.org/license
  1135. */
  1136. //>>label: Keycode
  1137. //>>group: Core
  1138. //>>description: Provide keycodes as keynames
  1139. //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/
  1140. var keycode = $.ui.keyCode = {
  1141. BACKSPACE: 8,
  1142. COMMA: 188,
  1143. DELETE: 46,
  1144. DOWN: 40,
  1145. END: 35,
  1146. ENTER: 13,
  1147. ESCAPE: 27,
  1148. HOME: 36,
  1149. LEFT: 37,
  1150. PAGE_DOWN: 34,
  1151. PAGE_UP: 33,
  1152. PERIOD: 190,
  1153. RIGHT: 39,
  1154. SPACE: 32,
  1155. TAB: 9,
  1156. UP: 38
  1157. };
  1158. /*!
  1159. * jQuery UI Scroll Parent 1.13.2
  1160. * http://jqueryui.com
  1161. *
  1162. * Copyright jQuery Foundation and other contributors
  1163. * Released under the MIT license.
  1164. * http://jquery.org/license
  1165. */
  1166. //>>label: scrollParent
  1167. //>>group: Core
  1168. //>>description: Get the closest ancestor element that is scrollable.
  1169. //>>docs: http://api.jqueryui.com/scrollParent/
  1170. var scrollParent = $.fn.scrollParent = function( includeHidden ) {
  1171. var position = this.css( "position" ),
  1172. excludeStaticParent = position === "absolute",
  1173. overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
  1174. scrollParent = this.parents().filter( function() {
  1175. var parent = $( this );
  1176. if ( excludeStaticParent && parent.css( "position" ) === "static" ) {
  1177. return false;
  1178. }
  1179. return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) +
  1180. parent.css( "overflow-x" ) );
  1181. } ).eq( 0 );
  1182. return position === "fixed" || !scrollParent.length ?
  1183. $( this[ 0 ].ownerDocument || document ) :
  1184. scrollParent;
  1185. };
  1186. /*!
  1187. * jQuery UI Unique ID 1.13.2
  1188. * http://jqueryui.com
  1189. *
  1190. * Copyright jQuery Foundation and other contributors
  1191. * Released under the MIT license.
  1192. * http://jquery.org/license
  1193. */
  1194. //>>label: uniqueId
  1195. //>>group: Core
  1196. //>>description: Functions to generate and remove uniqueId's
  1197. //>>docs: http://api.jqueryui.com/uniqueId/
  1198. var uniqueId = $.fn.extend( {
  1199. uniqueId: ( function() {
  1200. var uuid = 0;
  1201. return function() {
  1202. return this.each( function() {
  1203. if ( !this.id ) {
  1204. this.id = "ui-id-" + ( ++uuid );
  1205. }
  1206. } );
  1207. };
  1208. } )(),
  1209. removeUniqueId: function() {
  1210. return this.each( function() {
  1211. if ( /^ui-id-\d+$/.test( this.id ) ) {
  1212. $( this ).removeAttr( "id" );
  1213. }
  1214. } );
  1215. }
  1216. } );
  1217. } );