]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - Utils.js
929de6ee47980c1cb168323a1e4e8532fe63a301
2 Ext
. ns ( 'Proxmox.Setup' );
4 if (! Ext
. isDefined ( Proxmox
. Setup
. auth_cookie_name
)) {
5 throw "Proxmox library not initialized" ;
8 // avoid errors related to Accessible Rich Internet Applications
9 // (access for people with disabilities)
10 // TODO reenable after all components are upgraded
11 Ext
. enableAria
= false ;
12 Ext
. enableAriaButtons
= false ;
13 Ext
. enableAriaPanels
= false ;
15 // avoid errors when running without development tools
16 if (! Ext
. isDefined ( Ext
. global
. console
)) {
23 Ext
. Ajax
. defaultHeaders
= {
24 'Accept' : 'application/json'
27 Ext
. Ajax
. on ( 'beforerequest' , function ( conn
, options
) {
28 if ( Proxmox
. CSRFPreventionToken
) {
29 if (! options
. headers
) {
32 options
. headers
. CSRFPreventionToken
= Proxmox
. CSRFPreventionToken
;
36 Ext
. define ( 'Proxmox.Utils' , { utilities
: {
38 // this singleton contains miscellaneous utilities
40 yesText
: gettext ( 'Yes' ),
41 noText
: gettext ( 'No' ),
42 enabledText
: gettext ( 'Enabled' ),
43 disabledText
: gettext ( 'Disabled' ),
44 noneText
: gettext ( 'none' ),
45 errorText
: gettext ( 'Error' ),
46 unknownText
: gettext ( 'Unknown' ),
47 defaultText
: gettext ( 'Default' ),
48 daysText
: gettext ( 'days' ),
49 dayText
: gettext ( 'day' ),
50 runningText
: gettext ( 'running' ),
51 stoppedText
: gettext ( 'stopped' ),
52 neverText
: gettext ( 'never' ),
53 totalText
: gettext ( 'Total' ),
54 usedText
: gettext ( 'Used' ),
55 directoryText
: gettext ( 'Directory' ),
56 stateText
: gettext ( 'State' ),
57 groupText
: gettext ( 'Group' ),
60 zh_CN
: 'Chinese (Simplified)' ,
61 zh_TW
: 'Chinese (Traditional)' ,
65 eu
: 'Euskera (Basque)' ,
71 nb
: 'Norwegian (Bokmal)' ,
72 nn
: 'Norwegian (Nynorsk)' ,
73 fa
: 'Persian (Farsi)' ,
75 pt_BR
: 'Portuguese (Brazil)' ,
82 render_language : function ( value
) {
84 return Proxmox
. Utils
. defaultText
+ ' (English)' ;
86 var text
= Proxmox
. Utils
. language_map
[ value
];
88 return text
+ ' (' + value
+ ')' ;
93 language_array : function () {
94 var data
= [[ '__default__' , Proxmox
. Utils
. render_language ( '' )]];
95 Ext
. Object
. each ( Proxmox
. Utils
. language_map
, function ( key
, value
) {
96 data
. push ([ key
, Proxmox
. Utils
. render_language ( value
)]);
102 bond_mode_gettext_map
: {
103 '802.3ad' : 'LACP (802.3ad)' ,
104 'lacp-balance-slb' : 'LACP (balance-slb)' ,
105 'lacp-balance-tcp' : 'LACP (balance-tcp)' ,
108 render_bond_mode : function ( value
) {
109 var val
= Proxmox
. Utils
. bond_mode_gettext_map
[ value
];
116 bond_mode_array : function ( modes
) {
119 for ( i
= 0 ; i
< modes
. length
; i
++) {
120 arr
. push ([ modes
[ i
], Proxmox
. Utils
. render_bond_mode ( modes
[ i
])]);
125 getNoSubKeyHtml : function ( url
) {
126 // url http://www.proxmox.com/products/proxmox-ve/subscription-service-plans
127 return Ext
. String
. format ( 'You do not have a valid subscription for this server. Please visit <a target="_blank" href="{0}">www.proxmox.com</a> to get a list of available options.' , url
|| 'https://www.proxmox.com' );
130 format_boolean_with_default : function ( value
) {
131 if ( Ext
. isDefined ( value
) && value
!== '__default__' ) {
132 return value
? Proxmox
. Utils
. yesText
: Proxmox
. Utils
. noText
;
134 return Proxmox
. Utils
. defaultText
;
137 format_boolean : function ( value
) {
138 return value
? Proxmox
. Utils
. yesText
: Proxmox
. Utils
. noText
;
141 format_neg_boolean : function ( value
) {
142 return ! value
? Proxmox
. Utils
. yesText
: Proxmox
. Utils
. noText
;
145 format_enabled_toggle : function ( value
) {
146 return value
? Proxmox
. Utils
. enabledText
: Proxmox
. Utils
. disabledText
;
149 format_expire : function ( date
) {
151 return Proxmox
. Utils
. neverText
;
153 return Ext
. Date
. format ( date
, "Y-m-d" );
156 format_duration_long : function ( ut
) {
158 var days
= Math
. floor ( ut
/ 86400 );
160 var hours
= Math
. floor ( ut
/ 3600 );
162 var mins
= Math
. floor ( ut
/ 60 );
165 var hours_str
= '00' + hours
. toString ();
166 hours_str
= hours_str
. substr ( hours_str
. length
- 2 );
167 var mins_str
= "00" + mins
. toString ();
168 mins_str
= mins_str
. substr ( mins_str
. length
- 2 );
169 var ut_str
= "00" + ut
. toString ();
170 ut_str
= ut_str
. substr ( ut_str
. length
- 2 );
173 var ds
= days
> 1 ? Proxmox
. Utils
. daysText
: Proxmox
. Utils
. dayText
;
174 return days
. toString () + ' ' + ds
+ ' ' +
175 hours_str
+ ':' + mins_str
+ ':' + ut_str
;
177 return hours_str
+ ':' + mins_str
+ ':' + ut_str
;
181 format_subscription_level : function ( level
) {
184 } else if ( level
=== 'b' ) {
186 } else if ( level
=== 's' ) {
188 } else if ( level
=== 'p' ) {
191 return Proxmox
. Utils
. noneText
;
195 compute_min_label_width : function ( text
, width
) {
197 if ( width
=== undefined ) { width
= 100 ; }
199 var tm
= new Ext
. util
. TextMetrics ();
200 var min
= tm
. getWidth ( text
+ ':' );
202 return min
< width
? width
: min
;
205 setAuthData : function ( data
) {
206 Proxmox
. CSRFPreventionToken
= data
. CSRFPreventionToken
;
207 Proxmox
. UserName
= data
. username
;
208 Proxmox
. LoggedOut
= data
. LoggedOut
;
209 // creates a session cookie (expire = null)
210 // that way the cookie gets deleted after the browser window is closed
211 Ext
. util
. Cookies
. set ( Proxmox
. Setup
. auth_cookie_name
, data
. ticket
, null , '/' , null , true );
215 if ( Proxmox
. LoggedOut
) {
218 return ( Proxmox
. UserName
!== '' ) && Ext
. util
. Cookies
. get ( Proxmox
. Setup
. auth_cookie_name
);
221 authClear : function () {
222 if ( Proxmox
. LoggedOut
) {
225 Ext
. util
. Cookies
. clear ( Proxmox
. Setup
. auth_cookie_name
);
228 // comp.setLoading() is buggy in ExtJS 4.0.7, so we
229 // use el.mask() instead
230 setErrorMask : function ( comp
, msg
) {
239 el
. mask ( gettext ( "Loading..." ));
246 monStoreErrors : function ( me
, store
, clearMaskBeforeLoad
) {
247 if ( clearMaskBeforeLoad
) {
248 me
. mon ( store
, 'beforeload' , function ( s
, operation
, eOpts
) {
249 Proxmox
. Utils
. setErrorMask ( me
, false );
252 me
. mon ( store
, 'beforeload' , function ( s
, operation
, eOpts
) {
254 me
. loadCount
= 0 ; // make sure it is numeric
255 Proxmox
. Utils
. setErrorMask ( me
, true );
260 // only works with 'proxmox' proxy
261 me
. mon ( store
. proxy
, 'afterload' , function ( proxy
, request
, success
) {
265 Proxmox
. Utils
. setErrorMask ( me
, false );
270 /*jslint nomen: true */
271 var operation
= request
. _operation
;
272 var error
= operation
. getError ();
273 if ( error
. statusText
) {
274 msg
= error
. statusText
+ ' (' + error
. status
+ ')' ;
276 msg
= gettext ( 'Connection error' );
278 Proxmox
. Utils
. setErrorMask ( me
, msg
);
282 extractRequestError : function ( result
, verbose
) {
283 var msg
= gettext ( 'Successful' );
285 if (! result
. success
) {
286 msg
= gettext ( "Unknown error" );
287 if ( result
. message
) {
288 msg
= result
. message
;
290 msg
+= ' (' + result
. status
+ ')' ;
293 if ( verbose
&& Ext
. isObject ( result
. errors
)) {
295 Ext
. Object
. each ( result
. errors
, function ( prop
, desc
) {
296 msg
+= "<br><b>" + Ext
. htmlEncode ( prop
) + "</b>: " +
297 Ext
. htmlEncode ( desc
);
306 API2Request : function ( reqOpts
) {
308 var newopts
= Ext
. apply ({
309 waitMsg
: gettext ( 'Please wait...' )
312 if (! newopts
. url
. match ( /^\/api2/ )) {
313 newopts
. url
= '/api2/extjs' + newopts
. url
;
315 delete newopts
. callback
;
317 var createWrapper = function ( successFn
, callbackFn
, failureFn
) {
319 success : function ( response
, options
) {
320 if ( options
. waitMsgTarget
) {
321 if ( Proxmox
. Utils
. toolkit
=== 'touch' ) {
322 options
. waitMsgTarget
. setMasked ( false );
324 options
. waitMsgTarget
. setLoading ( false );
327 var result
= Ext
. decode ( response
. responseText
);
328 response
. result
= result
;
329 if (! result
. success
) {
330 response
. htmlStatus
= Proxmox
. Utils
. extractRequestError ( result
, true );
331 Ext
. callback ( callbackFn
, options
. scope
, [ options
, false , response
]);
332 Ext
. callback ( failureFn
, options
. scope
, [ response
, options
]);
335 Ext
. callback ( callbackFn
, options
. scope
, [ options
, true , response
]);
336 Ext
. callback ( successFn
, options
. scope
, [ response
, options
]);
338 failure : function ( response
, options
) {
339 if ( options
. waitMsgTarget
) {
340 if ( Proxmox
. Utils
. toolkit
=== 'touch' ) {
341 options
. waitMsgTarget
. setMasked ( false );
343 options
. waitMsgTarget
. setLoading ( false );
346 response
. result
= {};
348 response
. result
= Ext
. decode ( response
. responseText
);
350 var msg
= gettext ( 'Connection error' ) + ' - server offline?' ;
351 if ( response
. aborted
) {
352 msg
= gettext ( 'Connection error' ) + ' - aborted.' ;
353 } else if ( response
. timedout
) {
354 msg
= gettext ( 'Connection error' ) + ' - Timeout.' ;
355 } else if ( response
. status
&& response
. statusText
) {
356 msg
= gettext ( 'Connection error' ) + ' ' + response
. status
+ ': ' + response
. statusText
;
358 response
. htmlStatus
= msg
;
359 Ext
. callback ( callbackFn
, options
. scope
, [ options
, false , response
]);
360 Ext
. callback ( failureFn
, options
. scope
, [ response
, options
]);
365 createWrapper ( reqOpts
. success
, reqOpts
. callback
, reqOpts
. failure
);
367 var target
= newopts
. waitMsgTarget
;
369 if ( Proxmox
. Utils
. toolkit
=== 'touch' ) {
370 target
. setMasked ({ xtype
: 'loadmask' , message
: newopts
. waitMsg
} );
372 // Note: ExtJS bug - this does not work when component is not rendered
373 target
. setLoading ( newopts
. waitMsg
);
376 Ext
. Ajax
. request ( newopts
);
379 checked_command : function ( orig_cmd
) {
380 Proxmox
. Utils
. API2Request ({
381 url
: '/nodes/localhost/subscription' ,
384 failure : function ( response
, opts
) {
385 Ext
. Msg
. alert ( gettext ( 'Error' ), response
. htmlStatus
);
387 success : function ( response
, opts
) {
388 var data
= response
. result
. data
;
390 if ( data
. status
!== 'Active' ) {
392 title
: gettext ( 'No valid subscription' ),
393 icon
: Ext
. Msg
. WARNING
,
394 msg
: Proxmox
. Utils
. getNoSubKeyHtml ( data
. url
),
396 callback : function ( btn
) {
410 assemble_field_data : function ( values
, data
) {
411 if ( Ext
. isObject ( data
)) {
412 Ext
. Object
. each ( data
, function ( name
, val
) {
413 if ( values
. hasOwnProperty ( name
)) {
414 var bucket
= values
[ name
];
415 if (! Ext
. isArray ( bucket
)) {
416 bucket
= values
[ name
] = [ bucket
];
418 if ( Ext
. isArray ( val
)) {
419 values
[ name
] = bucket
. concat ( val
);
430 dialog_title : function ( subject
, create
, isAdd
) {
433 return gettext ( 'Add' ) + ': ' + subject
;
435 return gettext ( 'Create' ) + ': ' + subject
;
438 return gettext ( 'Edit' ) + ': ' + subject
;
442 network_iface_types
: {
443 eth
: gettext ( "Network Device" ),
444 bridge
: 'Linux Bridge' ,
447 OVSBridge
: 'OVS Bridge' ,
450 OVSIntPort
: 'OVS IntPort'
453 render_network_iface_type : function ( value
) {
454 return Proxmox
. Utils
. network_iface_types
[ value
] ||
455 Proxmox
. Utils
. unknownText
;
459 acmenewcert
: [ 'SRV' , gettext ( 'Order Certificate' ) ],
460 acmeregister
: [ 'ACME Account' , gettext ( 'Register' ) ],
461 acmedeactivate
: [ 'ACME Account' , gettext ( 'Deactivate' ) ],
462 acmeupdate
: [ 'ACME Account' , gettext ( 'Update' ) ],
463 acmerefresh
: [ 'ACME Account' , gettext ( 'Refresh' ) ],
464 acmerenew
: [ 'SRV' , gettext ( 'Renew Certificate' ) ],
465 acmerevoke
: [ 'SRV' , gettext ( 'Revoke Certificate' ) ],
466 'move_volume' : [ 'CT' , gettext ( 'Move Volume' ) ],
467 clustercreate
: [ '' , gettext ( 'Create Cluster' ) ],
468 clusterjoin
: [ '' , gettext ( 'Join Cluster' ) ],
469 diskinit
: [ 'Disk' , gettext ( 'Initialize Disk with GPT' ) ],
470 vncproxy
: [ 'VM/CT' , gettext ( 'Console' ) ],
471 spiceproxy
: [ 'VM/CT' , gettext ( 'Console' ) + ' (Spice)' ],
472 vncshell
: [ '' , gettext ( 'Shell' ) ],
473 spiceshell
: [ '' , gettext ( 'Shell' ) + ' (Spice)' ],
474 qmsnapshot
: [ 'VM' , gettext ( 'Snapshot' ) ],
475 qmrollback
: [ 'VM' , gettext ( 'Rollback' ) ],
476 qmdelsnapshot
: [ 'VM' , gettext ( 'Delete Snapshot' ) ],
477 qmcreate
: [ 'VM' , gettext ( 'Create' ) ],
478 qmrestore
: [ 'VM' , gettext ( 'Restore' ) ],
479 qmdestroy
: [ 'VM' , gettext ( 'Destroy' ) ],
480 qmigrate
: [ 'VM' , gettext ( 'Migrate' ) ],
481 qmclone
: [ 'VM' , gettext ( 'Clone' ) ],
482 qmmove
: [ 'VM' , gettext ( 'Move disk' ) ],
483 qmtemplate
: [ 'VM' , gettext ( 'Convert to template' ) ],
484 qmstart
: [ 'VM' , gettext ( 'Start' ) ],
485 qmstop
: [ 'VM' , gettext ( 'Stop' ) ],
486 qmreset
: [ 'VM' , gettext ( 'Reset' ) ],
487 qmshutdown
: [ 'VM' , gettext ( 'Shutdown' ) ],
488 qmsuspend
: [ 'VM' , gettext ( 'Hibernate' ) ],
489 qmpause
: [ 'VM' , gettext ( 'Pause' ) ],
490 qmresume
: [ 'VM' , gettext ( 'Resume' ) ],
491 qmconfig
: [ 'VM' , gettext ( 'Configure' ) ],
492 vzsnapshot
: [ 'CT' , gettext ( 'Snapshot' ) ],
493 vzrollback
: [ 'CT' , gettext ( 'Rollback' ) ],
494 vzdelsnapshot
: [ 'CT' , gettext ( 'Delete Snapshot' ) ],
495 vzcreate
: [ 'CT' , gettext ( 'Create' ) ],
496 vzrestore
: [ 'CT' , gettext ( 'Restore' ) ],
497 vzdestroy
: [ 'CT' , gettext ( 'Destroy' ) ],
498 vzmigrate
: [ 'CT' , gettext ( 'Migrate' ) ],
499 vzclone
: [ 'CT' , gettext ( 'Clone' ) ],
500 vztemplate
: [ 'CT' , gettext ( 'Convert to template' ) ],
501 vzstart
: [ 'CT' , gettext ( 'Start' ) ],
502 vzstop
: [ 'CT' , gettext ( 'Stop' ) ],
503 vzmount
: [ 'CT' , gettext ( 'Mount' ) ],
504 vzumount
: [ 'CT' , gettext ( 'Unmount' ) ],
505 vzshutdown
: [ 'CT' , gettext ( 'Shutdown' ) ],
506 vzsuspend
: [ 'CT' , gettext ( 'Suspend' ) ],
507 vzresume
: [ 'CT' , gettext ( 'Resume' ) ],
508 hamigrate
: [ 'HA' , gettext ( 'Migrate' ) ],
509 hastart
: [ 'HA' , gettext ( 'Start' ) ],
510 hastop
: [ 'HA' , gettext ( 'Stop' ) ],
511 srvstart
: [ 'SRV' , gettext ( 'Start' ) ],
512 srvstop
: [ 'SRV' , gettext ( 'Stop' ) ],
513 srvrestart
: [ 'SRV' , gettext ( 'Restart' ) ],
514 srvreload
: [ 'SRV' , gettext ( 'Reload' ) ],
515 cephcreatemgr
: [ 'Ceph Manager' , gettext ( 'Create' ) ],
516 cephdestroymgr
: [ 'Ceph Manager' , gettext ( 'Destroy' ) ],
517 cephcreatemon
: [ 'Ceph Monitor' , gettext ( 'Create' ) ],
518 cephdestroymon
: [ 'Ceph Monitor' , gettext ( 'Destroy' ) ],
519 cephcreateosd
: [ 'Ceph OSD' , gettext ( 'Create' ) ],
520 cephdestroyosd
: [ 'Ceph OSD' , gettext ( 'Destroy' ) ],
521 cephcreatepool
: [ 'Ceph Pool' , gettext ( 'Create' ) ],
522 cephdestroypool
: [ 'Ceph Pool' , gettext ( 'Destroy' ) ],
523 cephfscreate
: [ 'CephFS' , gettext ( 'Create' ) ],
524 cephcreatemds
: [ 'Ceph Metadata Server' , gettext ( 'Create' ) ],
525 cephdestroymds
: [ 'Ceph Metadata Server' , gettext ( 'Destroy' ) ],
526 imgcopy
: [ '' , gettext ( 'Copy data' ) ],
527 imgdel
: [ '' , gettext ( 'Erase data' ) ],
528 unknownimgdel
: [ '' , gettext ( 'Destroy image from unknown guest' ) ],
529 download
: [ '' , gettext ( 'Download' ) ],
530 vzdump
: [ 'VM/CT' , gettext ( 'Backup' ) ],
531 aptupdate
: [ '' , gettext ( 'Update package database' ) ],
532 startall
: [ '' , gettext ( 'Start all VMs and Containers' ) ],
533 stopall
: [ '' , gettext ( 'Stop all VMs and Containers' ) ],
534 migrateall
: [ '' , gettext ( 'Migrate all VMs and Containers' ) ],
535 dircreate
: [ gettext ( 'Directory Storage' ), gettext ( 'Create' ) ],
536 lvmcreate
: [ gettext ( 'LVM Storage' ), gettext ( 'Create' ) ],
537 lvmthincreate
: [ gettext ( 'LVM-Thin Storage' ), gettext ( 'Create' ) ],
538 zfscreate
: [ gettext ( 'ZFS Storage' ), gettext ( 'Create' ) ]
541 format_task_description : function ( type
, id
) {
542 var farray
= Proxmox
. Utils
. task_desc_table
[ type
];
551 var prefix
= farray
[ 0 ];
554 return prefix
+ ' ' + id
+ ' - ' + text
;
559 format_size : function ( size
) {
560 /*jslint confusion: true */
562 var units
= [ '' , 'Ki' , 'Mi' , 'Gi' , 'Ti' , 'Pi' , 'Ei' , 'Zi' , 'Yi' ];
565 while ( size
>= 1024 && (( num
++)+ 1 ) < units
. length
) {
569 return size
. toFixed (( num
> 0 )? 2 : 0 ) + " " + units
[ num
] + "B" ;
572 render_upid : function ( value
, metaData
, record
) {
573 var type
= record
. data
. type
;
574 var id
= record
. data
. id
;
576 return Proxmox
. Utils
. format_task_description ( type
, id
);
579 render_uptime : function ( value
) {
583 if ( uptime
=== undefined ) {
591 return Proxmox
. Utils
. format_duration_long ( uptime
);
594 parse_task_upid : function ( upid
) {
597 var res
= upid
. match ( /^UPID:(\S+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8,9}):([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/ );
599 throw "unable to parse upid '" + upid
+ "'" ;
602 task
. pid
= parseInt ( res
[ 2 ], 16 );
603 task
. pstart
= parseInt ( res
[ 3 ], 16 );
604 task
. starttime
= parseInt ( res
[ 4 ], 16 );
609 task
. desc
= Proxmox
. Utils
. format_task_description ( task
. type
, task
. id
);
614 render_timestamp : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
615 var servertime
= new Date ( value
* 1000 );
616 return Ext
. Date
. format ( servertime
, 'Y-m-d H:i:s' );
619 get_help_info : function ( section
) {
621 if ( typeof proxmoxOnlineHelpInfo
!== 'undefined' ) {
622 helpMap
= proxmoxOnlineHelpInfo
;
623 } else if ( typeof pveOnlineHelpInfo
!== 'undefined' ) {
624 // be backward compatible with older pve-doc-generators
625 helpMap
= pveOnlineHelpInfo
;
627 throw "no global OnlineHelpInfo map declared" ;
630 return helpMap
[ section
];
633 get_help_link : function ( section
) {
634 var info
= Proxmox
. Utils
. get_help_info ( section
);
639 return window
. location
. origin
+ info
. link
;
642 openXtermJsViewer : function ( vmtype
, vmid
, nodename
, vmname
, cmd
) {
643 var url
= Ext
. Object
. toQueryString ({
644 console
: vmtype
, // kvm, lxc, upgrade or shell
652 var nw
= window
. open ( "?" + url
, '_blank' , 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420' );
661 constructor : function () {
663 Ext
. apply ( me
, me
. utilities
);
665 var IPV4_OCTET
= "(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])" ;
666 var IPV4_REGEXP
= "(?:(?:" + IPV4_OCTET
+ " \\ .){3}" + IPV4_OCTET
+ ")" ;
667 var IPV6_H16
= "(?:[0-9a-fA-F]{1,4})" ;
668 var IPV6_LS32
= "(?:(?:" + IPV6_H16
+ ":" + IPV6_H16
+ ")|" + IPV4_REGEXP
+ ")" ;
669 var IPV4_CIDR_MASK
= "([0-9]{1,2})" ;
670 var IPV6_CIDR_MASK
= "([0-9]{1,3})" ;
673 me
. IP4_match
= new RegExp ( "^(?:" + IPV4_REGEXP
+ ")$" );
674 me
. IP4_cidr_match
= new RegExp ( "^(?:" + IPV4_REGEXP
+ ")\/" + IPV4_CIDR_MASK
+ "$" );
676 var IPV6_REGEXP
= "(?:" +
677 "(?:(?:" + "(?:" + IPV6_H16
+ ":){6})" + IPV6_LS32
+ ")|" +
678 "(?:(?:" + "::" + "(?:" + IPV6_H16
+ ":){5})" + IPV6_LS32
+ ")|" +
679 "(?:(?:(?:" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){4})" + IPV6_LS32
+ ")|" +
680 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,1}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){3})" + IPV6_LS32
+ ")|" +
681 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,2}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){2})" + IPV6_LS32
+ ")|" +
682 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,3}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){1})" + IPV6_LS32
+ ")|" +
683 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,4}" + IPV6_H16
+ ")?::" + ")" + IPV6_LS32
+ ")|" +
684 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,5}" + IPV6_H16
+ ")?::" + ")" + IPV6_H16
+ ")|" +
685 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,7}" + IPV6_H16
+ ")?::" + ")" + ")" +
688 me
. IP6_match
= new RegExp ( "^(?:" + IPV6_REGEXP
+ ")$" );
689 me
. IP6_cidr_match
= new RegExp ( "^(?:" + IPV6_REGEXP
+ ")\/" + IPV6_CIDR_MASK
+ "$" );
690 me
. IP6_bracket_match
= new RegExp ( "^ \\ [(" + IPV6_REGEXP
+ ") \\ ]" );
692 me
. IP64_match
= new RegExp ( "^(?:" + IPV6_REGEXP
+ "|" + IPV4_REGEXP
+ ")$" );
693 me
. IP64_cidr_match
= new RegExp ( "^(?:" + IPV6_REGEXP
+ "\/" + IPV6_CIDR_MASK
+ ")|(?:" + IPV4_REGEXP
+ "\/" + IPV4_CIDR_MASK
+ ")$" );
695 var DnsName_REGEXP
= "(?:(([a-zA-Z0-9]([a-zA-Z0-9 \\ -]*[a-zA-Z0-9])?) \\ .)*([A-Za-z0-9]([A-Za-z0-9 \\ -]*[A-Za-z0-9])?))" ;
696 me
. DnsName_match
= new RegExp ( "^" + DnsName_REGEXP
+ "$" );
698 me
. HostPort_match
= new RegExp ( "^(" + IPV4_REGEXP
+ "|" + DnsName_REGEXP
+ ")(: \\ d+)?$" );
699 me
. HostPortBrackets_match
= new RegExp ( "^ \\ [(?:" + IPV6_REGEXP
+ "|" + IPV4_REGEXP
+ "|" + DnsName_REGEXP
+ ") \\ ](: \\ d+)?$" );
700 me
. IP6_dotnotation_match
= new RegExp ( "^" + IPV6_REGEXP
+ "( \\ . \\ d+)?$" );